@developer_tribe/react-builder 0.1.27 → 0.1.29
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/dist/RenderPage.d.ts +13 -13
- package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +2 -2
- package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +18 -4
- package/dist/build-components/OnboardItem/OnboardItemProps.generated.d.ts +6 -1
- package/dist/build-components/OnboardProvider/OnboardProviderProps.generated.d.ts +4 -0
- package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +23 -1
- package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +23 -0
- package/dist/build-components/Text/TextProps.generated.d.ts +23 -0
- package/dist/build-components/View/ViewProps.generated.d.ts +15 -3
- package/dist/build-components/index.d.ts +1 -0
- package/dist/build-components/patterns.generated.d.ts +389 -0
- package/dist/index.cjs.js +28 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.esm.js +28 -1
- package/dist/size-matters/index.d.ts +6 -0
- package/dist/store.d.ts +25 -0
- package/dist/styles.css +1 -1
- package/dist/types/PreviewConfig.d.ts +2 -0
- package/dist/utils/getDevices.d.ts +1 -0
- package/dist/utils/patterns.d.ts +3 -2
- package/package.json +2 -1
- package/scripts/prebuild/build-components.js +2 -0
- package/scripts/prebuild/utils/createBuildComponentsIndex.js +5 -1
- package/scripts/prebuild/utils/createPatternsGenerated.js +23 -0
- package/scripts/prebuild/utils/index.js +1 -0
- package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +126 -1
- package/src/RenderPage.tsx +33 -29
- package/src/build-components/Button/Button.tsx +2 -2
- package/src/build-components/Carousel/Carousel.tsx +2 -2
- package/src/build-components/CarouselButtons/CarouselButtons.tsx +2 -2
- package/src/build-components/CarouselDots/CarouselDots.tsx +2 -2
- package/src/build-components/CarouselItem/CarouselItem.tsx +2 -2
- package/src/build-components/CarouselProvider/CarouselProvider.tsx +2 -2
- package/src/build-components/Image/Image.tsx +2 -3
- package/src/build-components/Onboard/Onboard.tsx +2 -2
- package/src/build-components/OnboardButton/OnboardButton.tsx +13 -6
- package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +2 -2
- package/src/build-components/OnboardButton/pattern.json +2 -2
- package/src/build-components/OnboardButtons/OnboardButtons.tsx +14 -9
- package/src/build-components/OnboardDot/OnboardDot.tsx +2 -2
- package/src/build-components/OnboardFooter/OnboardFooter.tsx +22 -12
- package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +29 -4
- package/src/build-components/OnboardFooter/pattern.json +4 -19
- package/src/build-components/OnboardImage/OnboardImage.tsx +2 -2
- package/src/build-components/OnboardItem/OnboardItem.tsx +20 -19
- package/src/build-components/OnboardItem/OnboardItemProps.generated.ts +6 -1
- package/src/build-components/OnboardItem/pattern.json +12 -1
- package/src/build-components/OnboardProvider/OnboardProvider.tsx +15 -12
- package/src/build-components/OnboardProvider/OnboardProviderProps.generated.ts +4 -0
- package/src/build-components/OnboardProvider/pattern.json +11 -1
- package/src/build-components/OnboardSubtitle/OnboardSubtitle.tsx +3 -17
- package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +29 -1
- package/src/build-components/OnboardSubtitle/pattern.json +3 -19
- package/src/build-components/OnboardTitle/OnboardTitle.tsx +4 -17
- package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +29 -0
- package/src/build-components/OnboardTitle/pattern.json +5 -19
- package/src/build-components/Text/Text.tsx +21 -9
- package/src/build-components/Text/TextProps.generated.ts +29 -0
- package/src/build-components/Text/pattern.json +1 -0
- package/src/build-components/View/View.tsx +3 -3
- package/src/build-components/View/ViewProps.generated.ts +15 -3
- package/src/build-components/View/pattern.json +15 -3
- package/src/build-components/index.ts +2 -0
- package/src/build-components/patterns.generated.ts +502 -0
- package/src/build-components/useNode.ts +1 -0
- package/src/index.ts +1 -2
- package/src/size-matters/index.ts +64 -0
- package/src/store.ts +56 -0
- package/src/styles/_reset.scss +30 -0
- package/src/styles/index.scss +2 -0
- package/src/types/PreviewConfig.ts +2 -2
- package/src/utils/getDevices.ts +4 -0
- package/src/utils/novaToJson.ts +46 -8
- package/src/utils/patterns.ts +14 -45
- package/dist/RenderMainNode.d.ts +0 -16
- package/src/RenderMainNode.tsx +0 -37
|
@@ -15,11 +15,23 @@ export interface ViewPropsGenerated {
|
|
|
15
15
|
| 'space-between'
|
|
16
16
|
| 'space-around'
|
|
17
17
|
| 'space-evenly';
|
|
18
|
-
gap?:
|
|
18
|
+
gap?: string;
|
|
19
19
|
padding?: number;
|
|
20
|
-
|
|
20
|
+
paddingHorizontal?: string;
|
|
21
|
+
paddingVertical?: string;
|
|
22
|
+
paddingTop?: string;
|
|
23
|
+
paddingBottom?: string;
|
|
24
|
+
paddingLeft?: string;
|
|
25
|
+
paddingRight?: string;
|
|
26
|
+
margin?: string;
|
|
27
|
+
marginHorizontal?: string;
|
|
28
|
+
marginVertical?: string;
|
|
29
|
+
marginTop?: string;
|
|
30
|
+
marginBottom?: string;
|
|
31
|
+
marginLeft?: string;
|
|
32
|
+
marginRight?: string;
|
|
21
33
|
backgroundColor?: string;
|
|
22
|
-
borderRadius?:
|
|
34
|
+
borderRadius?: string;
|
|
23
35
|
width?: number;
|
|
24
36
|
height?: number;
|
|
25
37
|
};
|
|
@@ -16,11 +16,23 @@
|
|
|
16
16
|
"space-around",
|
|
17
17
|
"space-evenly"
|
|
18
18
|
],
|
|
19
|
-
"gap": "
|
|
19
|
+
"gap": "string",
|
|
20
20
|
"padding": "number",
|
|
21
|
-
"
|
|
21
|
+
"paddingHorizontal": "string",
|
|
22
|
+
"paddingVertical": "string",
|
|
23
|
+
"paddingTop": "string",
|
|
24
|
+
"paddingBottom": "string",
|
|
25
|
+
"paddingLeft": "string",
|
|
26
|
+
"paddingRight": "string",
|
|
27
|
+
"margin": "string",
|
|
28
|
+
"marginHorizontal": "string",
|
|
29
|
+
"marginVertical": "string",
|
|
30
|
+
"marginTop": "string",
|
|
31
|
+
"marginBottom": "string",
|
|
32
|
+
"marginLeft": "string",
|
|
33
|
+
"marginRight": "string",
|
|
22
34
|
"backgroundColor": "string",
|
|
23
|
-
"borderRadius": "
|
|
35
|
+
"borderRadius": "string",
|
|
24
36
|
"width": "number",
|
|
25
37
|
"height": "number"
|
|
26
38
|
}
|
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
/* AUTO-GENERATED FILE - DO NOT EDIT */
|
|
2
|
+
|
|
3
|
+
// Export resolved patterns (after extends resolution)
|
|
4
|
+
export const patterns = [
|
|
5
|
+
{
|
|
6
|
+
schemaVersion: 1,
|
|
7
|
+
allowUnknownAttributes: false,
|
|
8
|
+
pattern: {
|
|
9
|
+
type: 'button',
|
|
10
|
+
children: 'string',
|
|
11
|
+
attributes: {
|
|
12
|
+
color: 'string',
|
|
13
|
+
fontSize: 'number',
|
|
14
|
+
fontWeight: [
|
|
15
|
+
'normal',
|
|
16
|
+
'bold',
|
|
17
|
+
'100',
|
|
18
|
+
'200',
|
|
19
|
+
'300',
|
|
20
|
+
'400',
|
|
21
|
+
'500',
|
|
22
|
+
'600',
|
|
23
|
+
'700',
|
|
24
|
+
'800',
|
|
25
|
+
'900',
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
schemaVersion: 1,
|
|
32
|
+
allowUnknownAttributes: false,
|
|
33
|
+
pattern: { type: 'carousel', children: 'carouselItem', attributes: {} },
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
schemaVersion: 1,
|
|
37
|
+
allowUnknownAttributes: false,
|
|
38
|
+
pattern: {
|
|
39
|
+
type: 'carouselButtons',
|
|
40
|
+
children: 'never',
|
|
41
|
+
attributes: {
|
|
42
|
+
buttonType: ['previous_button', 'next_button', 'skip_button'],
|
|
43
|
+
skipNumber: 'number',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
schemaVersion: 1,
|
|
49
|
+
allowUnknownAttributes: false,
|
|
50
|
+
pattern: {
|
|
51
|
+
type: 'carouselDots',
|
|
52
|
+
children: 'never',
|
|
53
|
+
attributes: {
|
|
54
|
+
dotType: [
|
|
55
|
+
'expanding_dot',
|
|
56
|
+
'normal_dot',
|
|
57
|
+
'scaling_dot',
|
|
58
|
+
'sliding_border',
|
|
59
|
+
'sliding_dot',
|
|
60
|
+
'liquid_like',
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
schemaVersion: 1,
|
|
67
|
+
allowUnknownAttributes: false,
|
|
68
|
+
pattern: { type: 'carouselItem', children: 'node', attributes: {} },
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
schemaVersion: 1,
|
|
72
|
+
allowUnknownAttributes: false,
|
|
73
|
+
pattern: { type: 'carouselProvider', children: 'node', attributes: {} },
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
schemaVersion: 1,
|
|
77
|
+
allowUnknownAttributes: false,
|
|
78
|
+
pattern: {
|
|
79
|
+
type: 'image',
|
|
80
|
+
children: 'never',
|
|
81
|
+
attributes: {
|
|
82
|
+
src: 'string',
|
|
83
|
+
width: 'number',
|
|
84
|
+
height: 'number',
|
|
85
|
+
resizeMode: ['cover', 'contain', 'stretch', 'center'],
|
|
86
|
+
borderRadius: 'number',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
schemaVersion: 1,
|
|
92
|
+
allowUnknownAttributes: false,
|
|
93
|
+
pattern: { type: 'Onboard', children: 'node', attributes: {} },
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
schemaVersion: 1,
|
|
97
|
+
allowUnknownAttributes: false,
|
|
98
|
+
pattern: {
|
|
99
|
+
type: 'OnboardButton',
|
|
100
|
+
children: 'never',
|
|
101
|
+
attributes: {
|
|
102
|
+
labelKey: 'string',
|
|
103
|
+
button_text_color: 'string',
|
|
104
|
+
animation: [
|
|
105
|
+
'simple-animation',
|
|
106
|
+
'line-animation',
|
|
107
|
+
'blur',
|
|
108
|
+
'blur-animation',
|
|
109
|
+
'blur-line-animation',
|
|
110
|
+
],
|
|
111
|
+
animation_color: 'string',
|
|
112
|
+
button_background_color: 'string',
|
|
113
|
+
flex: 'number',
|
|
114
|
+
targetIndex: 'number',
|
|
115
|
+
events: 'EventObject[]',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
types: {
|
|
119
|
+
EventObject: {
|
|
120
|
+
type: ['Permission', 'Navigate'],
|
|
121
|
+
permission: ['att', 'notification', 'rating', 'null'],
|
|
122
|
+
navigate_to: ['string', 'null'],
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
schemaVersion: 1,
|
|
128
|
+
allowUnknownAttributes: false,
|
|
129
|
+
pattern: {
|
|
130
|
+
type: 'OnboardButtons',
|
|
131
|
+
children: 'node',
|
|
132
|
+
attributes: {
|
|
133
|
+
buttonType: ['previous_button', 'next_button', 'skip_button'],
|
|
134
|
+
skipNumber: 'number',
|
|
135
|
+
buttons_direction: ['row', 'column'],
|
|
136
|
+
forIndex: 'number',
|
|
137
|
+
seperatorColor: 'string',
|
|
138
|
+
condition: ['carousel-index'],
|
|
139
|
+
conditionVariable: 'number',
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
schemaVersion: 1,
|
|
145
|
+
allowUnknownAttributes: false,
|
|
146
|
+
pattern: {
|
|
147
|
+
type: 'OnboardDot',
|
|
148
|
+
children: 'node',
|
|
149
|
+
attributes: {
|
|
150
|
+
dotType: [
|
|
151
|
+
'expanding_dot',
|
|
152
|
+
'normal_dot',
|
|
153
|
+
'scaling_dot',
|
|
154
|
+
'sliding_border',
|
|
155
|
+
'sliding_dot',
|
|
156
|
+
'liquid_like',
|
|
157
|
+
],
|
|
158
|
+
inactive_dot_opacity: 'number',
|
|
159
|
+
expanding_dot_width: 'number',
|
|
160
|
+
dot_style: 'string',
|
|
161
|
+
container_style: 'string',
|
|
162
|
+
active_dot_color: 'string',
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
schemaVersion: 1,
|
|
168
|
+
allowUnknownAttributes: false,
|
|
169
|
+
pattern: {
|
|
170
|
+
type: 'OnboardFooter',
|
|
171
|
+
children: 'node',
|
|
172
|
+
attributes: {
|
|
173
|
+
color: 'string',
|
|
174
|
+
fontSize: 'number',
|
|
175
|
+
fontWeight: [
|
|
176
|
+
'normal',
|
|
177
|
+
'bold',
|
|
178
|
+
'100',
|
|
179
|
+
'200',
|
|
180
|
+
'300',
|
|
181
|
+
'400',
|
|
182
|
+
'500',
|
|
183
|
+
'600',
|
|
184
|
+
'700',
|
|
185
|
+
'800',
|
|
186
|
+
'900',
|
|
187
|
+
],
|
|
188
|
+
scrollable: 'boolean',
|
|
189
|
+
flexDirection: ['row', 'column'],
|
|
190
|
+
alignItems: ['flex-start', 'center', 'flex-end', 'stretch', 'baseline'],
|
|
191
|
+
justifyContent: [
|
|
192
|
+
'flex-start',
|
|
193
|
+
'center',
|
|
194
|
+
'flex-end',
|
|
195
|
+
'space-between',
|
|
196
|
+
'space-around',
|
|
197
|
+
'space-evenly',
|
|
198
|
+
],
|
|
199
|
+
gap: 'string',
|
|
200
|
+
padding: 'number',
|
|
201
|
+
paddingHorizontal: 'string',
|
|
202
|
+
paddingVertical: 'string',
|
|
203
|
+
paddingTop: 'string',
|
|
204
|
+
paddingBottom: 'string',
|
|
205
|
+
paddingLeft: 'string',
|
|
206
|
+
paddingRight: 'string',
|
|
207
|
+
margin: 'string',
|
|
208
|
+
marginHorizontal: 'string',
|
|
209
|
+
marginVertical: 'string',
|
|
210
|
+
marginTop: 'string',
|
|
211
|
+
marginBottom: 'string',
|
|
212
|
+
marginLeft: 'string',
|
|
213
|
+
marginRight: 'string',
|
|
214
|
+
backgroundColor: 'string',
|
|
215
|
+
borderRadius: 'string',
|
|
216
|
+
width: 'number',
|
|
217
|
+
height: 'number',
|
|
218
|
+
textLocalizationKey: 'string',
|
|
219
|
+
linkedWordFirstLocalizationKey: 'string',
|
|
220
|
+
linkedWordFirstColor: 'string',
|
|
221
|
+
linkedWordFirstPage: 'string',
|
|
222
|
+
linkedWordSecondLocalizationKey: 'string',
|
|
223
|
+
linkedWordSecondColor: 'string',
|
|
224
|
+
linkedWordSecondPage: 'string',
|
|
225
|
+
},
|
|
226
|
+
textAlign: ['left', 'center', 'right', 'justify'],
|
|
227
|
+
},
|
|
228
|
+
defaults: { paddingHorizontal: '24@s' },
|
|
229
|
+
types: {},
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
schemaVersion: 1,
|
|
233
|
+
allowUnknownAttributes: false,
|
|
234
|
+
pattern: {
|
|
235
|
+
type: 'OnboardImage',
|
|
236
|
+
children: 'node',
|
|
237
|
+
attributes: {
|
|
238
|
+
src: 'string',
|
|
239
|
+
width: 'number',
|
|
240
|
+
height: 'number',
|
|
241
|
+
resizeMode: ['cover', 'contain', 'stretch', 'center'],
|
|
242
|
+
borderRadius: 'number',
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
schemaVersion: 1,
|
|
248
|
+
allowUnknownAttributes: false,
|
|
249
|
+
pattern: {
|
|
250
|
+
type: 'OnboardItem',
|
|
251
|
+
children: 'node',
|
|
252
|
+
attributes: {
|
|
253
|
+
display: ['flex', 'block'],
|
|
254
|
+
gap: 'string',
|
|
255
|
+
flexDirection: ['row', 'column'],
|
|
256
|
+
paddingHorizontal: 'string',
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
defaults: {
|
|
260
|
+
gap: '16@vs',
|
|
261
|
+
display: 'flex',
|
|
262
|
+
flexDirection: 'column',
|
|
263
|
+
paddingHorizontal: '24@s',
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
schemaVersion: 1,
|
|
268
|
+
allowUnknownAttributes: false,
|
|
269
|
+
pattern: {
|
|
270
|
+
type: 'OnboardProvider',
|
|
271
|
+
children: 'node',
|
|
272
|
+
attributes: {
|
|
273
|
+
theme: 'string',
|
|
274
|
+
use_safe_area_inset: 'boolean',
|
|
275
|
+
paddingTop: 'number',
|
|
276
|
+
paddingRight: 'number',
|
|
277
|
+
paddingBottom: 'number',
|
|
278
|
+
paddingLeft: 'number',
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
defaults: {
|
|
282
|
+
paddingTop: 0,
|
|
283
|
+
paddingRight: 0,
|
|
284
|
+
paddingBottom: 8,
|
|
285
|
+
paddingLeft: 0,
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
schemaVersion: 1,
|
|
290
|
+
allowUnknownAttributes: false,
|
|
291
|
+
pattern: {
|
|
292
|
+
type: 'OnboardSubtitle',
|
|
293
|
+
children: 'node',
|
|
294
|
+
attributes: {
|
|
295
|
+
color: 'string',
|
|
296
|
+
fontSize: 'number',
|
|
297
|
+
fontWeight: [
|
|
298
|
+
'normal',
|
|
299
|
+
'bold',
|
|
300
|
+
'100',
|
|
301
|
+
'200',
|
|
302
|
+
'300',
|
|
303
|
+
'400',
|
|
304
|
+
'500',
|
|
305
|
+
'600',
|
|
306
|
+
'700',
|
|
307
|
+
'800',
|
|
308
|
+
'900',
|
|
309
|
+
],
|
|
310
|
+
scrollable: 'boolean',
|
|
311
|
+
flexDirection: ['row', 'column'],
|
|
312
|
+
alignItems: ['flex-start', 'center', 'flex-end', 'stretch', 'baseline'],
|
|
313
|
+
justifyContent: [
|
|
314
|
+
'flex-start',
|
|
315
|
+
'center',
|
|
316
|
+
'flex-end',
|
|
317
|
+
'space-between',
|
|
318
|
+
'space-around',
|
|
319
|
+
'space-evenly',
|
|
320
|
+
],
|
|
321
|
+
gap: 'string',
|
|
322
|
+
padding: 'number',
|
|
323
|
+
paddingHorizontal: 'string',
|
|
324
|
+
paddingVertical: 'string',
|
|
325
|
+
paddingTop: 'string',
|
|
326
|
+
paddingBottom: 'string',
|
|
327
|
+
paddingLeft: 'string',
|
|
328
|
+
paddingRight: 'string',
|
|
329
|
+
margin: 'string',
|
|
330
|
+
marginHorizontal: 'string',
|
|
331
|
+
marginVertical: 'string',
|
|
332
|
+
marginTop: 'string',
|
|
333
|
+
marginBottom: 'string',
|
|
334
|
+
marginLeft: 'string',
|
|
335
|
+
marginRight: 'string',
|
|
336
|
+
backgroundColor: 'string',
|
|
337
|
+
borderRadius: 'string',
|
|
338
|
+
width: 'number',
|
|
339
|
+
height: 'number',
|
|
340
|
+
},
|
|
341
|
+
textAlign: ['left', 'center', 'right', 'justify'],
|
|
342
|
+
},
|
|
343
|
+
defaults: { fontSize: '14@fs', fontWeight: '600' },
|
|
344
|
+
types: {},
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
schemaVersion: 1,
|
|
348
|
+
allowUnknownAttributes: false,
|
|
349
|
+
pattern: {
|
|
350
|
+
type: 'OnboardTitle',
|
|
351
|
+
children: 'node',
|
|
352
|
+
attributes: {
|
|
353
|
+
color: 'string',
|
|
354
|
+
fontSize: 'number',
|
|
355
|
+
fontWeight: [
|
|
356
|
+
'normal',
|
|
357
|
+
'bold',
|
|
358
|
+
'100',
|
|
359
|
+
'200',
|
|
360
|
+
'300',
|
|
361
|
+
'400',
|
|
362
|
+
'500',
|
|
363
|
+
'600',
|
|
364
|
+
'700',
|
|
365
|
+
'800',
|
|
366
|
+
'900',
|
|
367
|
+
],
|
|
368
|
+
scrollable: 'boolean',
|
|
369
|
+
flexDirection: ['row', 'column'],
|
|
370
|
+
alignItems: ['flex-start', 'center', 'flex-end', 'stretch', 'baseline'],
|
|
371
|
+
justifyContent: [
|
|
372
|
+
'flex-start',
|
|
373
|
+
'center',
|
|
374
|
+
'flex-end',
|
|
375
|
+
'space-between',
|
|
376
|
+
'space-around',
|
|
377
|
+
'space-evenly',
|
|
378
|
+
],
|
|
379
|
+
gap: 'string',
|
|
380
|
+
padding: 'number',
|
|
381
|
+
paddingHorizontal: 'string',
|
|
382
|
+
paddingVertical: 'string',
|
|
383
|
+
paddingTop: 'string',
|
|
384
|
+
paddingBottom: 'string',
|
|
385
|
+
paddingLeft: 'string',
|
|
386
|
+
paddingRight: 'string',
|
|
387
|
+
margin: 'string',
|
|
388
|
+
marginHorizontal: 'string',
|
|
389
|
+
marginVertical: 'string',
|
|
390
|
+
marginTop: 'string',
|
|
391
|
+
marginBottom: 'string',
|
|
392
|
+
marginLeft: 'string',
|
|
393
|
+
marginRight: 'string',
|
|
394
|
+
backgroundColor: 'string',
|
|
395
|
+
borderRadius: 'string',
|
|
396
|
+
width: 'number',
|
|
397
|
+
height: 'number',
|
|
398
|
+
},
|
|
399
|
+
textAlign: ['left', 'center', 'right', 'justify'],
|
|
400
|
+
},
|
|
401
|
+
defaults: { fontSize: '24@fs', fontWeight: '700', textAlign: 'center' },
|
|
402
|
+
types: {},
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
schemaVersion: 1,
|
|
406
|
+
allowUnknownAttributes: false,
|
|
407
|
+
pattern: {
|
|
408
|
+
type: 'text',
|
|
409
|
+
children: 'string',
|
|
410
|
+
attributes: {
|
|
411
|
+
scrollable: 'boolean',
|
|
412
|
+
flexDirection: ['row', 'column'],
|
|
413
|
+
alignItems: ['flex-start', 'center', 'flex-end', 'stretch', 'baseline'],
|
|
414
|
+
justifyContent: [
|
|
415
|
+
'flex-start',
|
|
416
|
+
'center',
|
|
417
|
+
'flex-end',
|
|
418
|
+
'space-between',
|
|
419
|
+
'space-around',
|
|
420
|
+
'space-evenly',
|
|
421
|
+
],
|
|
422
|
+
gap: 'string',
|
|
423
|
+
padding: 'number',
|
|
424
|
+
paddingHorizontal: 'string',
|
|
425
|
+
paddingVertical: 'string',
|
|
426
|
+
paddingTop: 'string',
|
|
427
|
+
paddingBottom: 'string',
|
|
428
|
+
paddingLeft: 'string',
|
|
429
|
+
paddingRight: 'string',
|
|
430
|
+
margin: 'string',
|
|
431
|
+
marginHorizontal: 'string',
|
|
432
|
+
marginVertical: 'string',
|
|
433
|
+
marginTop: 'string',
|
|
434
|
+
marginBottom: 'string',
|
|
435
|
+
marginLeft: 'string',
|
|
436
|
+
marginRight: 'string',
|
|
437
|
+
backgroundColor: 'string',
|
|
438
|
+
borderRadius: 'string',
|
|
439
|
+
width: 'number',
|
|
440
|
+
height: 'number',
|
|
441
|
+
color: 'string',
|
|
442
|
+
fontSize: 'number',
|
|
443
|
+
fontWeight: [
|
|
444
|
+
'normal',
|
|
445
|
+
'bold',
|
|
446
|
+
'100',
|
|
447
|
+
'200',
|
|
448
|
+
'300',
|
|
449
|
+
'400',
|
|
450
|
+
'500',
|
|
451
|
+
'600',
|
|
452
|
+
'700',
|
|
453
|
+
'800',
|
|
454
|
+
'900',
|
|
455
|
+
],
|
|
456
|
+
},
|
|
457
|
+
textAlign: ['left', 'center', 'right', 'justify'],
|
|
458
|
+
},
|
|
459
|
+
types: {},
|
|
460
|
+
defaults: {},
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
schemaVersion: 1,
|
|
464
|
+
allowUnknownAttributes: false,
|
|
465
|
+
pattern: {
|
|
466
|
+
type: 'view',
|
|
467
|
+
children: ['node', 'array'],
|
|
468
|
+
attributes: {
|
|
469
|
+
scrollable: 'boolean',
|
|
470
|
+
flexDirection: ['row', 'column'],
|
|
471
|
+
alignItems: ['flex-start', 'center', 'flex-end', 'stretch', 'baseline'],
|
|
472
|
+
justifyContent: [
|
|
473
|
+
'flex-start',
|
|
474
|
+
'center',
|
|
475
|
+
'flex-end',
|
|
476
|
+
'space-between',
|
|
477
|
+
'space-around',
|
|
478
|
+
'space-evenly',
|
|
479
|
+
],
|
|
480
|
+
gap: 'string',
|
|
481
|
+
padding: 'number',
|
|
482
|
+
paddingHorizontal: 'string',
|
|
483
|
+
paddingVertical: 'string',
|
|
484
|
+
paddingTop: 'string',
|
|
485
|
+
paddingBottom: 'string',
|
|
486
|
+
paddingLeft: 'string',
|
|
487
|
+
paddingRight: 'string',
|
|
488
|
+
margin: 'string',
|
|
489
|
+
marginHorizontal: 'string',
|
|
490
|
+
marginVertical: 'string',
|
|
491
|
+
marginTop: 'string',
|
|
492
|
+
marginBottom: 'string',
|
|
493
|
+
marginLeft: 'string',
|
|
494
|
+
marginRight: 'string',
|
|
495
|
+
backgroundColor: 'string',
|
|
496
|
+
borderRadius: 'string',
|
|
497
|
+
width: 'number',
|
|
498
|
+
height: 'number',
|
|
499
|
+
},
|
|
500
|
+
},
|
|
501
|
+
},
|
|
502
|
+
] as const;
|
|
@@ -6,6 +6,7 @@ export default function useNode<
|
|
|
6
6
|
>(node: NodeData<T>): NodeData<T> {
|
|
7
7
|
const type = node?.type;
|
|
8
8
|
const defaults = getDefaultsForType(type) as Partial<T> | undefined;
|
|
9
|
+
console.log('defaults', type, defaults);
|
|
9
10
|
if (!defaults) return node;
|
|
10
11
|
const mergedAttributes: T = {
|
|
11
12
|
...(defaults as T),
|
package/src/index.ts
CHANGED
|
@@ -16,11 +16,10 @@ export { getBasicSamples } from './assets/samples/getSamples';
|
|
|
16
16
|
export { getOnboardSamples } from './assets/samples/getSamples';
|
|
17
17
|
export { PreviewConfig } from './types/PreviewConfig';
|
|
18
18
|
export { RenderPage } from './RenderPage';
|
|
19
|
-
export { RenderMainNode } from './RenderMainNode';
|
|
20
19
|
export { DeviceMockFrame } from './DeviceMockFrame';
|
|
21
20
|
export { novaToJson } from './utils/novaToJson';
|
|
22
21
|
export type { Localication } from './types/PreviewConfig';
|
|
23
|
-
export { getDevices } from './utils/getDevices';
|
|
22
|
+
export { getDevices, getDefaultDevice } from './utils/getDevices';
|
|
24
23
|
export type { Device } from './types/Device';
|
|
25
24
|
export { AttributesEditor };
|
|
26
25
|
export * from './build-components/index';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useRenderStore } from '../store';
|
|
2
|
+
|
|
3
|
+
function getBaseDimensions() {
|
|
4
|
+
const currentState = useRenderStore.getState();
|
|
5
|
+
let device = currentState.device;
|
|
6
|
+
const [shortDimension, longDimension] =
|
|
7
|
+
device.width < device.height
|
|
8
|
+
? [device.width, device.height]
|
|
9
|
+
: [device.height, device.width];
|
|
10
|
+
|
|
11
|
+
return { baseSize: currentState.baseSize, shortDimension, longDimension };
|
|
12
|
+
}
|
|
13
|
+
export function scale(size: number) {
|
|
14
|
+
const { baseSize, shortDimension } = getBaseDimensions();
|
|
15
|
+
return (shortDimension / baseSize.width) * size;
|
|
16
|
+
}
|
|
17
|
+
export function verticalScale(size: number) {
|
|
18
|
+
const { baseSize, longDimension } = getBaseDimensions();
|
|
19
|
+
return (longDimension / baseSize.height) * size;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const s = scale;
|
|
23
|
+
export const vs = verticalScale;
|
|
24
|
+
export const fs = verticalScale;
|
|
25
|
+
|
|
26
|
+
export function parseSize(value?: string | number) {
|
|
27
|
+
if (value === undefined) return undefined;
|
|
28
|
+
if (typeof value === 'number') {
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const raw = String(value).trim();
|
|
33
|
+
const lower = raw.toLowerCase();
|
|
34
|
+
|
|
35
|
+
// Handle explicit scalers via suffixes
|
|
36
|
+
if (lower.endsWith('@s')) {
|
|
37
|
+
const n = parseFloat(lower.slice(0, -2));
|
|
38
|
+
return Number.isFinite(n) ? s(n) : raw;
|
|
39
|
+
}
|
|
40
|
+
if (lower.endsWith('@vs')) {
|
|
41
|
+
const n = parseFloat(lower.slice(0, -3));
|
|
42
|
+
return Number.isFinite(n) ? vs(n) : raw;
|
|
43
|
+
}
|
|
44
|
+
if (lower.endsWith('@f') || lower.endsWith('@fs')) {
|
|
45
|
+
const cut = lower.endsWith('@f') ? -2 : -3;
|
|
46
|
+
const n = parseFloat(lower.slice(0, cut));
|
|
47
|
+
return Number.isFinite(n) ? fs(n) : raw;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Handle px explicitly (treat as absolute, not scaled)
|
|
51
|
+
if (lower.endsWith('px')) {
|
|
52
|
+
const n = parseFloat(lower.replace('px', ''));
|
|
53
|
+
return Number.isFinite(n) ? n : raw;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Plain numeric strings fall back to provided scaler
|
|
57
|
+
const numeric = parseFloat(lower);
|
|
58
|
+
if (Number.isFinite(numeric)) {
|
|
59
|
+
return numeric;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Unknown format, return as-is
|
|
63
|
+
return raw;
|
|
64
|
+
}
|