app-studio 0.0.1
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/LICENSE +21 -0
- package/README.md +208 -0
- package/dist/app-studio.cjs.development.js +944 -0
- package/dist/app-studio.cjs.development.js.map +1 -0
- package/dist/app-studio.cjs.production.min.js +2 -0
- package/dist/app-studio.cjs.production.min.js.map +1 -0
- package/dist/app-studio.esm.js +907 -0
- package/dist/app-studio.esm.js.map +1 -0
- package/dist/components/Element.d.ts +30 -0
- package/dist/components/Image.d.ts +23 -0
- package/dist/components/Layout.d.ts +11 -0
- package/dist/components/Text.d.ts +23 -0
- package/dist/components/View.d.ts +32 -0
- package/dist/components/Wrapper.d.ts +4 -0
- package/dist/hooks/useMount.d.ts +1 -0
- package/dist/hooks/useResponsive.d.ts +9 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/providers/Responsive.d.ts +20 -0
- package/dist/providers/Theme.d.ts +19 -0
- package/dist/utils/colors.d.ts +14 -0
- package/dist/utils/env.d.ts +15 -0
- package/dist/utils/shadow.d.ts +103 -0
- package/dist/utils/typography.d.ts +46 -0
- package/package.json +114 -0
- package/src/components/Element.tsx +430 -0
- package/src/components/Image.tsx +56 -0
- package/src/components/Layout.tsx +49 -0
- package/src/components/Text.tsx +118 -0
- package/src/components/View.md +6 -0
- package/src/components/View.tsx +87 -0
- package/src/components/Wrapper.tsx +11 -0
- package/src/hooks/useMount.ts +6 -0
- package/src/hooks/useResponsive.ts +102 -0
- package/src/index.tsx +8 -0
- package/src/providers/Responsive.tsx +61 -0
- package/src/providers/Theme.tsx +73 -0
- package/src/types/module.d.ts +1 -0
- package/src/types/style.d.ts +696 -0
- package/src/utils/colors.ts +321 -0
- package/src/utils/env.ts +43 -0
- package/src/utils/shadow.ts +102 -0
- package/src/utils/typography.ts +45 -0
|
@@ -0,0 +1,907 @@
|
|
|
1
|
+
import React, { createContext, useContext, useEffect, useState } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
function _extends() {
|
|
5
|
+
_extends = Object.assign || function (target) {
|
|
6
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7
|
+
var source = arguments[i];
|
|
8
|
+
|
|
9
|
+
for (var key in source) {
|
|
10
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
11
|
+
target[key] = source[key];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return target;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return _extends.apply(this, arguments);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function _inheritsLoose(subClass, superClass) {
|
|
23
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
24
|
+
subClass.prototype.constructor = subClass;
|
|
25
|
+
|
|
26
|
+
_setPrototypeOf(subClass, superClass);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function _setPrototypeOf(o, p) {
|
|
30
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
31
|
+
o.__proto__ = p;
|
|
32
|
+
return o;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return _setPrototypeOf(o, p);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
39
|
+
if (source == null) return {};
|
|
40
|
+
var target = {};
|
|
41
|
+
var sourceKeys = Object.keys(source);
|
|
42
|
+
var key, i;
|
|
43
|
+
|
|
44
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
45
|
+
key = sourceKeys[i];
|
|
46
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
47
|
+
target[key] = source[key];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return target;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var palette = {
|
|
54
|
+
whiteAlpha: {
|
|
55
|
+
50: 'rgba(255, 255, 255, 0.04)',
|
|
56
|
+
100: 'rgba(255, 255, 255, 0.06)',
|
|
57
|
+
200: 'rgba(255, 255, 255, 0.08)',
|
|
58
|
+
300: 'rgba(255, 255, 255, 0.16)',
|
|
59
|
+
400: 'rgba(255, 255, 255, 0.24)',
|
|
60
|
+
500: 'rgba(255, 255, 255, 0.36)',
|
|
61
|
+
600: 'rgba(255, 255, 255, 0.48)',
|
|
62
|
+
700: 'rgba(255, 255, 255, 0.64)',
|
|
63
|
+
800: 'rgba(255, 255, 255, 0.80)',
|
|
64
|
+
900: 'rgba(255, 255, 255, 0.92)'
|
|
65
|
+
},
|
|
66
|
+
blackAlpha: {
|
|
67
|
+
50: 'rgba(0, 0, 0, 0.04)',
|
|
68
|
+
100: 'rgba(0, 0, 0, 0.06)',
|
|
69
|
+
200: 'rgba(0, 0, 0, 0.08)',
|
|
70
|
+
300: 'rgba(0, 0, 0, 0.16)',
|
|
71
|
+
400: 'rgba(0, 0, 0, 0.24)',
|
|
72
|
+
500: 'rgba(0, 0, 0, 0.36)',
|
|
73
|
+
600: 'rgba(0, 0, 0, 0.48)',
|
|
74
|
+
700: 'rgba(0, 0, 0, 0.64)',
|
|
75
|
+
800: 'rgba(0, 0, 0, 0.80)',
|
|
76
|
+
900: 'rgba(0, 0, 0, 0.92)'
|
|
77
|
+
},
|
|
78
|
+
rose: {
|
|
79
|
+
50: '#fff1f2',
|
|
80
|
+
100: '#ffe4e6',
|
|
81
|
+
200: '#fecdd3',
|
|
82
|
+
300: '#fda4af',
|
|
83
|
+
400: '#fb7185',
|
|
84
|
+
500: '#f43f5e',
|
|
85
|
+
600: '#e11d48',
|
|
86
|
+
700: '#be123c',
|
|
87
|
+
800: '#9f1239',
|
|
88
|
+
900: '#881337'
|
|
89
|
+
},
|
|
90
|
+
pink: {
|
|
91
|
+
50: '#fdf2f8',
|
|
92
|
+
100: '#fce7f3',
|
|
93
|
+
200: '#fbcfe8',
|
|
94
|
+
300: '#f9a8d4',
|
|
95
|
+
400: '#f472b6',
|
|
96
|
+
500: '#ec4899',
|
|
97
|
+
600: '#db2777',
|
|
98
|
+
700: '#be185d',
|
|
99
|
+
800: '#9d174d',
|
|
100
|
+
900: '#831843'
|
|
101
|
+
},
|
|
102
|
+
fuchsia: {
|
|
103
|
+
50: '#fdf4ff',
|
|
104
|
+
100: '#fae8ff',
|
|
105
|
+
200: '#f5d0fe',
|
|
106
|
+
300: '#f0abfc',
|
|
107
|
+
400: '#e879f9',
|
|
108
|
+
500: '#d946ef',
|
|
109
|
+
600: '#c026d3',
|
|
110
|
+
700: '#a21caf',
|
|
111
|
+
800: '#86198f',
|
|
112
|
+
900: '#701a75'
|
|
113
|
+
},
|
|
114
|
+
purple: {
|
|
115
|
+
50: '#faf5ff',
|
|
116
|
+
100: '#f3e8ff',
|
|
117
|
+
200: '#e9d5ff',
|
|
118
|
+
300: '#d8b4fe',
|
|
119
|
+
400: '#c084fc',
|
|
120
|
+
500: '#a855f7',
|
|
121
|
+
600: '#9333ea',
|
|
122
|
+
700: '#7e22ce',
|
|
123
|
+
800: '#6b21a8',
|
|
124
|
+
900: '#581c87'
|
|
125
|
+
},
|
|
126
|
+
violet: {
|
|
127
|
+
50: '#f5f3ff',
|
|
128
|
+
100: '#ede9fe',
|
|
129
|
+
200: '#ddd6fe',
|
|
130
|
+
300: '#c4b5fd',
|
|
131
|
+
400: '#a78bfa',
|
|
132
|
+
500: '#8b5cf6',
|
|
133
|
+
600: '#7c3aed',
|
|
134
|
+
700: '#6d28d9',
|
|
135
|
+
800: '#5b21b6',
|
|
136
|
+
900: '#4c1d95'
|
|
137
|
+
},
|
|
138
|
+
indigo: {
|
|
139
|
+
50: '#eef2ff',
|
|
140
|
+
100: '#e0e7ff',
|
|
141
|
+
200: '#c7d2fe',
|
|
142
|
+
300: '#a5b4fc',
|
|
143
|
+
400: '#818cf8',
|
|
144
|
+
500: '#6366f1',
|
|
145
|
+
600: '#4f46e5',
|
|
146
|
+
700: '#4338ca',
|
|
147
|
+
800: '#3730a3',
|
|
148
|
+
900: '#312e81'
|
|
149
|
+
},
|
|
150
|
+
blue: {
|
|
151
|
+
50: '#eff6ff',
|
|
152
|
+
100: '#dbeafe',
|
|
153
|
+
200: '#bfdbfe',
|
|
154
|
+
300: '#93c5fd',
|
|
155
|
+
400: '#60a5fa',
|
|
156
|
+
500: '#3b82f6',
|
|
157
|
+
600: '#2563eb',
|
|
158
|
+
700: '#1d4ed8',
|
|
159
|
+
800: '#1e40af',
|
|
160
|
+
900: '#1e3a8a'
|
|
161
|
+
},
|
|
162
|
+
lightBlue: {
|
|
163
|
+
50: '#f0f9ff',
|
|
164
|
+
100: '#e0f2fe',
|
|
165
|
+
200: '#bae6fd',
|
|
166
|
+
300: '#7dd3fc',
|
|
167
|
+
400: '#38bdf8',
|
|
168
|
+
500: '#0ea5e9',
|
|
169
|
+
600: '#0284c7',
|
|
170
|
+
700: '#0369a1',
|
|
171
|
+
800: '#075985',
|
|
172
|
+
900: '#0c4a6e'
|
|
173
|
+
},
|
|
174
|
+
cyan: {
|
|
175
|
+
50: '#ecfeff',
|
|
176
|
+
100: '#cffafe',
|
|
177
|
+
200: '#a5f3fc',
|
|
178
|
+
300: '#67e8f9',
|
|
179
|
+
400: '#22d3ee',
|
|
180
|
+
500: '#06b6d4',
|
|
181
|
+
600: '#0891b2',
|
|
182
|
+
700: '#0e7490',
|
|
183
|
+
800: '#155e75',
|
|
184
|
+
900: '#164e63'
|
|
185
|
+
},
|
|
186
|
+
teal: {
|
|
187
|
+
50: '#f0fdfa',
|
|
188
|
+
100: '#ccfbf1',
|
|
189
|
+
200: '#99f6e4',
|
|
190
|
+
300: '#5eead4',
|
|
191
|
+
400: '#2dd4bf',
|
|
192
|
+
500: '#14b8a6',
|
|
193
|
+
600: '#0d9488',
|
|
194
|
+
700: '#0f766e',
|
|
195
|
+
800: '#115e59',
|
|
196
|
+
900: '#134e4a'
|
|
197
|
+
},
|
|
198
|
+
emerald: {
|
|
199
|
+
50: '#ecfdf5',
|
|
200
|
+
100: '#d1fae5',
|
|
201
|
+
200: '#a7f3d0',
|
|
202
|
+
300: '#6ee7b7',
|
|
203
|
+
400: '#34d399',
|
|
204
|
+
500: '#10b981',
|
|
205
|
+
600: '#059669',
|
|
206
|
+
700: '#047857',
|
|
207
|
+
800: '#065f46',
|
|
208
|
+
900: '#064e3b'
|
|
209
|
+
},
|
|
210
|
+
green: {
|
|
211
|
+
50: '#f0fdf4',
|
|
212
|
+
100: '#dcfce7',
|
|
213
|
+
200: '#bbf7d0',
|
|
214
|
+
300: '#86efac',
|
|
215
|
+
400: '#4ade80',
|
|
216
|
+
500: '#22c55e',
|
|
217
|
+
600: '#16a34a',
|
|
218
|
+
700: '#15803d',
|
|
219
|
+
800: '#166534',
|
|
220
|
+
900: '#14532d'
|
|
221
|
+
},
|
|
222
|
+
lime: {
|
|
223
|
+
50: '#f7fee7',
|
|
224
|
+
100: '#ecfccb',
|
|
225
|
+
200: '#d9f99d',
|
|
226
|
+
300: '#bef264',
|
|
227
|
+
400: '#a3e635',
|
|
228
|
+
500: '#84cc16',
|
|
229
|
+
600: '#65a30d',
|
|
230
|
+
700: '#4d7c0f',
|
|
231
|
+
800: '#3f6212',
|
|
232
|
+
900: '#365314'
|
|
233
|
+
},
|
|
234
|
+
yellow: {
|
|
235
|
+
50: '#fefce8',
|
|
236
|
+
100: '#fef9c3',
|
|
237
|
+
200: '#fef08a',
|
|
238
|
+
300: '#fde047',
|
|
239
|
+
400: '#facc15',
|
|
240
|
+
500: '#eab308',
|
|
241
|
+
600: '#ca8a04',
|
|
242
|
+
700: '#a16207',
|
|
243
|
+
800: '#854d0e',
|
|
244
|
+
900: '#713f12'
|
|
245
|
+
},
|
|
246
|
+
amber: {
|
|
247
|
+
50: '#fffbeb',
|
|
248
|
+
100: '#fef3c7',
|
|
249
|
+
200: '#fde68a',
|
|
250
|
+
300: '#fcd34d',
|
|
251
|
+
400: '#fbbf24',
|
|
252
|
+
500: '#f59e0b',
|
|
253
|
+
600: '#d97706',
|
|
254
|
+
700: '#b45309',
|
|
255
|
+
800: '#92400e',
|
|
256
|
+
900: '#78350f'
|
|
257
|
+
},
|
|
258
|
+
orange: {
|
|
259
|
+
50: '#fff7ed',
|
|
260
|
+
100: '#ffedd5',
|
|
261
|
+
200: '#fed7aa',
|
|
262
|
+
300: '#fdba74',
|
|
263
|
+
400: '#fb923c',
|
|
264
|
+
500: '#f97316',
|
|
265
|
+
600: '#ea580c',
|
|
266
|
+
700: '#c2410c',
|
|
267
|
+
800: '#9a3412',
|
|
268
|
+
900: '#7c2d12'
|
|
269
|
+
},
|
|
270
|
+
red: {
|
|
271
|
+
50: '#fef2f2',
|
|
272
|
+
100: '#fee2e2',
|
|
273
|
+
200: '#fecaca',
|
|
274
|
+
300: '#fca5a5',
|
|
275
|
+
400: '#f87171',
|
|
276
|
+
500: '#ef4444',
|
|
277
|
+
600: '#dc2626',
|
|
278
|
+
700: '#b91c1c',
|
|
279
|
+
800: '#991b1b',
|
|
280
|
+
900: '#7f1d1d'
|
|
281
|
+
},
|
|
282
|
+
warmGray: {
|
|
283
|
+
50: '#fafaf9',
|
|
284
|
+
100: '#f5f5f4',
|
|
285
|
+
200: '#e7e5e4',
|
|
286
|
+
300: '#d6d3d1',
|
|
287
|
+
400: '#a8a29e',
|
|
288
|
+
500: '#78716c',
|
|
289
|
+
600: '#57534e',
|
|
290
|
+
700: '#44403c',
|
|
291
|
+
800: '#292524',
|
|
292
|
+
900: '#1c1917'
|
|
293
|
+
},
|
|
294
|
+
trueGray: {
|
|
295
|
+
50: '#fafafa',
|
|
296
|
+
100: '#f5f5f5',
|
|
297
|
+
200: '#e5e5e5',
|
|
298
|
+
300: '#d4d4d4',
|
|
299
|
+
400: '#a3a3a3',
|
|
300
|
+
500: '#737373',
|
|
301
|
+
600: '#525252',
|
|
302
|
+
700: '#404040',
|
|
303
|
+
800: '#262626',
|
|
304
|
+
900: '#171717'
|
|
305
|
+
},
|
|
306
|
+
gray: {
|
|
307
|
+
50: '#fafafa',
|
|
308
|
+
100: '#f4f4f5',
|
|
309
|
+
200: '#e4e4e7',
|
|
310
|
+
300: '#d4d4d8',
|
|
311
|
+
400: '#a1a1aa',
|
|
312
|
+
500: '#71717a',
|
|
313
|
+
600: '#52525b',
|
|
314
|
+
700: '#3f3f46',
|
|
315
|
+
800: '#27272a',
|
|
316
|
+
900: '#18181b'
|
|
317
|
+
},
|
|
318
|
+
dark: {
|
|
319
|
+
50: '#18181b',
|
|
320
|
+
100: '#27272a',
|
|
321
|
+
200: '#3f3f46',
|
|
322
|
+
300: '#52525b',
|
|
323
|
+
400: '#71717a',
|
|
324
|
+
500: '#a1a1aa',
|
|
325
|
+
600: '#d4d4d8',
|
|
326
|
+
700: '#e4e4e7',
|
|
327
|
+
800: '#f4f4f5',
|
|
328
|
+
900: '#fafafa'
|
|
329
|
+
},
|
|
330
|
+
coolGray: {
|
|
331
|
+
50: '#f9fafb',
|
|
332
|
+
100: '#f3f4f6',
|
|
333
|
+
200: '#e5e7eb',
|
|
334
|
+
300: '#d1d5db',
|
|
335
|
+
400: '#9ca3af',
|
|
336
|
+
500: '#6b7280',
|
|
337
|
+
600: '#4b5563',
|
|
338
|
+
700: '#374151',
|
|
339
|
+
800: '#1f2937',
|
|
340
|
+
900: '#111827'
|
|
341
|
+
},
|
|
342
|
+
blueGray: {
|
|
343
|
+
50: '#f8fafc',
|
|
344
|
+
100: '#f1f5f9',
|
|
345
|
+
200: '#e2e8f0',
|
|
346
|
+
300: '#cbd5e1',
|
|
347
|
+
400: '#94a3b8',
|
|
348
|
+
500: '#64748b',
|
|
349
|
+
600: '#475569',
|
|
350
|
+
700: '#334155',
|
|
351
|
+
800: '#1e293b',
|
|
352
|
+
900: '#0f172a'
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
var defaultColors = {
|
|
357
|
+
white: '#FFFFFF',
|
|
358
|
+
black: '#000000'
|
|
359
|
+
};
|
|
360
|
+
var ThemeContext = /*#__PURE__*/createContext({
|
|
361
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
362
|
+
getColor: function getColor(name) {
|
|
363
|
+
return name;
|
|
364
|
+
},
|
|
365
|
+
colors: defaultColors,
|
|
366
|
+
palette: palette
|
|
367
|
+
});
|
|
368
|
+
var useTheme = function useTheme() {
|
|
369
|
+
return useContext(ThemeContext);
|
|
370
|
+
};
|
|
371
|
+
var ThemeProvider = function ThemeProvider(_ref) {
|
|
372
|
+
var _ref$palette = _ref.palette,
|
|
373
|
+
palette$1 = _ref$palette === void 0 ? palette : _ref$palette,
|
|
374
|
+
_ref$colors = _ref.colors,
|
|
375
|
+
colors = _ref$colors === void 0 ? defaultColors : _ref$colors,
|
|
376
|
+
children = _ref.children;
|
|
377
|
+
|
|
378
|
+
var getColor = function getColor(name) {
|
|
379
|
+
// console.log('getColor', name);
|
|
380
|
+
if (name === 'transparent') return name;
|
|
381
|
+
|
|
382
|
+
try {
|
|
383
|
+
if (name.indexOf('.') !== -1) {
|
|
384
|
+
var keys = name.split('.');
|
|
385
|
+
|
|
386
|
+
if (palette$1 && palette$1[keys[0]][keys[1]] !== undefined) {
|
|
387
|
+
return palette$1[keys[0]][keys[1]];
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
if (palette$1[keys[0]][parseInt(keys[1])] !== undefined) {
|
|
391
|
+
return palette$1[keys[0]][parseInt(keys[1])];
|
|
392
|
+
}
|
|
393
|
+
} else if (colors && colors[name] !== undefined) {
|
|
394
|
+
return colors[name];
|
|
395
|
+
}
|
|
396
|
+
} catch (e) {
|
|
397
|
+
console.log('Color ' + name + ' not found');
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
return name;
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
return React.createElement(ThemeContext.Provider, {
|
|
404
|
+
value: {
|
|
405
|
+
getColor: getColor,
|
|
406
|
+
colors: colors,
|
|
407
|
+
palette: palette$1
|
|
408
|
+
}
|
|
409
|
+
}, children);
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
var TransformStyleProps = ['transform', 'transformMatrix', 'rotation', 'scaleX', 'scaleY', 'translateX', 'translateY', // 'perspective',
|
|
413
|
+
// 'rotate',
|
|
414
|
+
// 'rotateX',
|
|
415
|
+
// 'rotateY',
|
|
416
|
+
// 'rotateZ',
|
|
417
|
+
// 'scale',
|
|
418
|
+
// 'skewX',
|
|
419
|
+
// 'skewY',
|
|
420
|
+
'testID', 'decomposedMatrix'];
|
|
421
|
+
var ImageStyleProps = ['borderTopRightRadius', 'backfaceVisibility', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'borderColor', 'borderRadius', 'borderTopLeftRadius', 'backgroundColor', 'borderWidth', 'opacity', 'overflow', 'overflowX', 'overflowY', 'resizeMode', 'tintColor', 'overlayColor'];
|
|
422
|
+
var LayoutStyleProps = ['alignContent', 'alignItems', 'alignSelf', 'aspectRatio', 'borderBottomWidth', 'borderEndWidth', 'borderLeftWidth', 'borderRightWidth', 'borderStartWidth', 'borderTopWidth', 'borderWidth', 'bottom', 'direction', 'display', 'end', 'flex', 'flexBasis', 'flexDirection', 'flexGrow', 'flexShrink', 'flexWrap', 'height', 'justifyContent', 'left', 'margin', 'marginBottom', 'marginEnd', 'marginHorizontal', 'marginLeft', 'marginRight', 'marginStart', 'marginTop', 'marginVertical', 'maxHeight', 'maxWidth', 'minHeight', 'minWidth', 'overflow', 'overflowX', 'overflowY', 'padding', 'paddingBottom', 'paddingEnd', 'paddingHorizontal', 'paddingLeft', 'paddingRight', 'paddingStart', 'paddingTop', 'paddingVertical', 'position', 'right', 'start', 'top', 'width', 'zIndex'];
|
|
423
|
+
var ShadowStyleProps = ['shadowColor', 'shadowOffset', 'shadowOpacity', 'shadowRadius'];
|
|
424
|
+
var TextStyleProps = ['textShadowOffset', 'color', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'textAlign', 'textDecorationLine', 'textShadowColor', 'fontFamily', 'textShadowRadius', 'includeFontPadding', 'textAlignVertical', 'fontVariant', 'letterSpacing', 'textDecorationColor', 'textDecorationStyle', 'textTransform', 'writingDirection'];
|
|
425
|
+
var ViewStyleProps = ['borderRightColor', 'backfaceVisibility', 'borderBottomColor', 'borderBottomEndRadius', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'borderBottomStartRadius', 'borderBottomWidth', 'borderColor', 'borderEndColor', 'borderLeftColor', 'borderLeftWidth', 'borderRadius', 'backgroundColor', 'borderRightWidth', 'borderStartColor', 'borderStyle', 'borderTopColor', 'borderTopEndRadius', 'borderTopLeftRadius', 'borderTopRightRadius', 'borderTopStartRadius', 'borderTopWidth', 'borderWidth', 'border', 'opacity', 'elevation', 'size'];
|
|
426
|
+
var ScrollViewStyleProps = ['alwaysBounceHorizontal', 'alwaysBounceVertical', 'automaticallyAdjustContentInsets', 'bounces', 'bouncesZoom', 'canCancelContentTouches', 'centerContent', 'contentLayoutStyle', 'contentInset', 'contentInsetAdjustmentBehavior', 'contentOffset', 'decelerationRate', 'directionalLockEnabled', 'disableIntervalMomentum', 'disableScrollViewPanResponder', 'endFillColor', 'fadingEdgeLength', 'horizontal', 'indicatorStyle', 'invertStickyHeaders', 'keyboardDismissMode', 'keyboardShouldPersistTaps', 'maintainVisibleContentPosition', 'maximumZoomScale', 'minimumZoomScale', 'nestedScrollEnabled', 'onContentSizeChange', 'onMomentumScrollBegin', 'onMomentumScrollEnd', 'onScroll', 'onScrollBeginDrag', 'onScrollEndDrag', 'onScrollToTop', 'overScrollMode', 'pagingEnabled', 'persistentScrollbar', 'pinchGestureEnabled', 'refreshControl', 'removeClippedSubviews', 'scrollBarThumbImage', 'scrollEnabled', 'scrollEventThrottle', 'scrollIndicatorInsets', 'scrollPerfTag', 'scrollToOverflowEnabled', 'scrollsToTop', 'DEPRECATED_sendUpdatedChildFrames', 'showsHorizontalScrollIndicator', 'showsVerticalScrollIndicator', 'snapToAlignment', 'snapToEnd', 'snapToInterval', 'snapToOffsets', 'snapToStart', 'stickyHeaderIndices', 'zoomScale'];
|
|
427
|
+
var allStyleProps = /*#__PURE__*/LayoutStyleProps.concat(ShadowStyleProps, TransformStyleProps, ViewStyleProps, ScrollViewStyleProps, TextStyleProps, ImageStyleProps);
|
|
428
|
+
var StyleProps = {};
|
|
429
|
+
allStyleProps.map(function (property) {
|
|
430
|
+
StyleProps[property] = true;
|
|
431
|
+
});
|
|
432
|
+
var setSize = function setSize(newSize, newProps) {
|
|
433
|
+
newProps.height = newProps.width = newSize;
|
|
434
|
+
};
|
|
435
|
+
var applyStyle = function applyStyle(props) {
|
|
436
|
+
var _useTheme = useTheme(),
|
|
437
|
+
getColor = _useTheme.getColor;
|
|
438
|
+
|
|
439
|
+
var newProps = {};
|
|
440
|
+
|
|
441
|
+
if (props.onClick) {
|
|
442
|
+
newProps.cursor = 'pointer';
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
var size = props.height !== undefined && props.width !== undefined && props.height === props.width ? props.height : props.size ? props.size : null;
|
|
446
|
+
|
|
447
|
+
if (size) {
|
|
448
|
+
setSize(size, newProps);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
if (props.paddingHorizontal) {
|
|
452
|
+
newProps.paddingLeft = props.paddingHorizontal;
|
|
453
|
+
newProps.paddingRight = props.paddingHorizontal;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (props.marginHorizontal) {
|
|
457
|
+
newProps.marginLeft = props.marginHorizontal;
|
|
458
|
+
newProps.marginRight = props.marginHorizontal;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
if (props.paddingVertical) {
|
|
462
|
+
newProps.paddingTop = props.paddingVertical;
|
|
463
|
+
newProps.paddingBottom = props.paddingVertical;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
if (props.marginVertical) {
|
|
467
|
+
newProps.marginTop = props.marginVertical;
|
|
468
|
+
newProps.marginBottom = props.marginVertical;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
Object.keys(props).filter(function (property) {
|
|
472
|
+
return StyleProps[property] !== undefined || property[0] == '&';
|
|
473
|
+
}).map(function (property) {
|
|
474
|
+
newProps[property] = props[property]; // console.log(property, propertyType);
|
|
475
|
+
|
|
476
|
+
if (property.toLowerCase().indexOf('color') !== -1) {
|
|
477
|
+
newProps[property] = getColor(props[property]);
|
|
478
|
+
}
|
|
479
|
+
}); // return {newProps,responsive};
|
|
480
|
+
|
|
481
|
+
return newProps;
|
|
482
|
+
}; // function convertToCSS(props: any) {
|
|
483
|
+
// return Object.entries(props).reduce((str, [key, val]) => {
|
|
484
|
+
// const casedKey = key.replace(
|
|
485
|
+
// /[A-Z]/g,
|
|
486
|
+
// (match) => `-${match.toLowerCase()}`
|
|
487
|
+
// );
|
|
488
|
+
// return `${str}${casedKey}:${typeof val === 'number' ? val + 'px' : val};\n`;
|
|
489
|
+
// }, '');
|
|
490
|
+
// }
|
|
491
|
+
// export const getResponsiveMediaQueries = (props: any) => {
|
|
492
|
+
// const { breakpointKeys, breakpoints } = useResponsive();
|
|
493
|
+
// console.log('mediaQueries', props);
|
|
494
|
+
// const mediaQueries = breakpointKeys
|
|
495
|
+
// .map((size) => {
|
|
496
|
+
// return props && props[size] !== undefined
|
|
497
|
+
// ? `
|
|
498
|
+
// @media ${
|
|
499
|
+
// breakpoints[size].min
|
|
500
|
+
// ? ' (min-width:' +
|
|
501
|
+
// (breakpoints[size].min > 0 ? breakpoints[size].min : 0) +
|
|
502
|
+
// 'px)'
|
|
503
|
+
// : ''
|
|
504
|
+
// } ${
|
|
505
|
+
// breakpoints[size].min &&
|
|
506
|
+
// breakpoints[size].max &&
|
|
507
|
+
// breakpoints[size].max >= 0 &&
|
|
508
|
+
// breakpoints[size].max < Infinity
|
|
509
|
+
// ? ' and '
|
|
510
|
+
// : ''
|
|
511
|
+
// } ${
|
|
512
|
+
// breakpoints[size].max &&
|
|
513
|
+
// breakpoints[size].max >= 0 &&
|
|
514
|
+
// breakpoints[size].max < Infinity
|
|
515
|
+
// ? ' (max-width:' + breakpoints[size].max + 'px)'
|
|
516
|
+
// : ''
|
|
517
|
+
// } {
|
|
518
|
+
// ${convertToCSS(props[size])}
|
|
519
|
+
// }`
|
|
520
|
+
// : '';
|
|
521
|
+
// })
|
|
522
|
+
// .join('\n');
|
|
523
|
+
// return mediaQueries;
|
|
524
|
+
// };
|
|
525
|
+
|
|
526
|
+
var StyledView = /*#__PURE__*/styled.div(function (props) {
|
|
527
|
+
return applyStyle(props);
|
|
528
|
+
});
|
|
529
|
+
var StyledImage = /*#__PURE__*/styled.img(function (props) {
|
|
530
|
+
return applyStyle(props);
|
|
531
|
+
});
|
|
532
|
+
var ViewElement = /*#__PURE__*/function (_React$PureComponent) {
|
|
533
|
+
_inheritsLoose(ViewElement, _React$PureComponent);
|
|
534
|
+
|
|
535
|
+
function ViewElement() {
|
|
536
|
+
return _React$PureComponent.apply(this, arguments) || this;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
var _proto = ViewElement.prototype;
|
|
540
|
+
|
|
541
|
+
_proto.render = function render() {
|
|
542
|
+
var onClick = this.props.onClick;
|
|
543
|
+
|
|
544
|
+
if (this.props.onPress !== undefined) {
|
|
545
|
+
onClick = this.props.onPress;
|
|
546
|
+
} //console.log(this.props);
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
return React.createElement(StyledView, Object.assign({}, this.props, {
|
|
550
|
+
onClick: onClick
|
|
551
|
+
}));
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
return ViewElement;
|
|
555
|
+
}(React.PureComponent);
|
|
556
|
+
var ImageElement = /*#__PURE__*/function (_React$PureComponent2) {
|
|
557
|
+
_inheritsLoose(ImageElement, _React$PureComponent2);
|
|
558
|
+
|
|
559
|
+
function ImageElement() {
|
|
560
|
+
return _React$PureComponent2.apply(this, arguments) || this;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
var _proto2 = ImageElement.prototype;
|
|
564
|
+
|
|
565
|
+
_proto2.render = function render() {
|
|
566
|
+
var onClick = this.props.onClick;
|
|
567
|
+
|
|
568
|
+
if (this.props.onPress !== undefined) {
|
|
569
|
+
onClick = this.props.onPress;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
return React.createElement(StyledImage, Object.assign({}, this.props, {
|
|
573
|
+
onClick: onClick
|
|
574
|
+
}));
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
return ImageElement;
|
|
578
|
+
}(React.PureComponent);
|
|
579
|
+
|
|
580
|
+
var View = function View(props) {
|
|
581
|
+
return React.createElement(ViewElement, Object.assign({}, props));
|
|
582
|
+
};
|
|
583
|
+
var SafeArea = View;
|
|
584
|
+
var Scroll = function Scroll(props) {
|
|
585
|
+
return React.createElement(View, Object.assign({
|
|
586
|
+
overflow: 'auto'
|
|
587
|
+
}, props));
|
|
588
|
+
};
|
|
589
|
+
var Horizontal = function Horizontal(props) {
|
|
590
|
+
return React.createElement(View, Object.assign({
|
|
591
|
+
display: 'flex',
|
|
592
|
+
flexDirection: "row"
|
|
593
|
+
}, props));
|
|
594
|
+
};
|
|
595
|
+
var HorizontalScroll = function HorizontalScroll(props) {
|
|
596
|
+
return React.createElement(Horizontal, Object.assign({
|
|
597
|
+
overflowX: "auto"
|
|
598
|
+
}, props));
|
|
599
|
+
};
|
|
600
|
+
var Vertical = function Vertical(props) {
|
|
601
|
+
return React.createElement(View, Object.assign({
|
|
602
|
+
flexDirection: "column"
|
|
603
|
+
}, props));
|
|
604
|
+
};
|
|
605
|
+
var VerticalScroll = function VerticalScroll(props) {
|
|
606
|
+
return React.createElement(Vertical, Object.assign({
|
|
607
|
+
overflowY: "auto"
|
|
608
|
+
}, props));
|
|
609
|
+
};
|
|
610
|
+
var Inline = function Inline(props) {
|
|
611
|
+
return React.createElement(View, Object.assign({
|
|
612
|
+
display: 'flex',
|
|
613
|
+
flexDirection: "row",
|
|
614
|
+
wordBreak: "break-word"
|
|
615
|
+
}, props));
|
|
616
|
+
};
|
|
617
|
+
var Start = function Start(props) {
|
|
618
|
+
return React.createElement(View, Object.assign({
|
|
619
|
+
display: 'flex',
|
|
620
|
+
alignSelf: "flex-start"
|
|
621
|
+
}, props));
|
|
622
|
+
};
|
|
623
|
+
var End = function End(props) {
|
|
624
|
+
return React.createElement(View, Object.assign({
|
|
625
|
+
display: 'flex',
|
|
626
|
+
alignSelf: "flex-end"
|
|
627
|
+
}, props));
|
|
628
|
+
};
|
|
629
|
+
var Center = function Center(props) {
|
|
630
|
+
return React.createElement(View, Object.assign({
|
|
631
|
+
display: 'flex',
|
|
632
|
+
justifyContent: "center",
|
|
633
|
+
alignItems: 'center'
|
|
634
|
+
}, props));
|
|
635
|
+
};
|
|
636
|
+
var AlignStart = function AlignStart(props) {
|
|
637
|
+
return React.createElement(View, Object.assign({
|
|
638
|
+
display: 'flex',
|
|
639
|
+
justifyContent: "flex-start"
|
|
640
|
+
}, props));
|
|
641
|
+
};
|
|
642
|
+
var AlignCenter = function AlignCenter(props) {
|
|
643
|
+
return React.createElement(View, Object.assign({
|
|
644
|
+
display: 'flex',
|
|
645
|
+
justifyContent: "center",
|
|
646
|
+
width: '100%'
|
|
647
|
+
}, props));
|
|
648
|
+
};
|
|
649
|
+
var AlignEnd = function AlignEnd(props) {
|
|
650
|
+
return React.createElement(View, Object.assign({
|
|
651
|
+
display: 'flex',
|
|
652
|
+
justifyContent: "flex-end",
|
|
653
|
+
width: '100%'
|
|
654
|
+
}, props));
|
|
655
|
+
};
|
|
656
|
+
|
|
657
|
+
var _excluded = ["src", "style", "onClick", "onPress"],
|
|
658
|
+
_excluded2 = ["size", "src"],
|
|
659
|
+
_excluded3 = ["size", "src"];
|
|
660
|
+
var ImageBackground = /*#__PURE__*/function (_React$PureComponent) {
|
|
661
|
+
_inheritsLoose(ImageBackground, _React$PureComponent);
|
|
662
|
+
|
|
663
|
+
function ImageBackground() {
|
|
664
|
+
return _React$PureComponent.apply(this, arguments) || this;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
var _proto = ImageBackground.prototype;
|
|
668
|
+
|
|
669
|
+
_proto.render = function render() {
|
|
670
|
+
var _this$props = this.props,
|
|
671
|
+
src = _this$props.src,
|
|
672
|
+
style = _this$props.style,
|
|
673
|
+
onClick = _this$props.onClick,
|
|
674
|
+
onPress = _this$props.onPress,
|
|
675
|
+
props = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
676
|
+
|
|
677
|
+
return React.createElement(View, Object.assign({
|
|
678
|
+
style: _extends({
|
|
679
|
+
backgroundSize: 'contain',
|
|
680
|
+
backgroundImage: "url(\"" + src + "\")",
|
|
681
|
+
backgroundPosition: 'center center',
|
|
682
|
+
backgroundRepeat: 'no-repeat'
|
|
683
|
+
}, style),
|
|
684
|
+
onClick: onClick ? onClick : onPress
|
|
685
|
+
}, props));
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
return ImageBackground;
|
|
689
|
+
}(React.PureComponent);
|
|
690
|
+
var Image = function Image(props) {
|
|
691
|
+
return React.createElement(ImageElement, Object.assign({}, props));
|
|
692
|
+
};
|
|
693
|
+
var RoundedImage = function RoundedImage(_ref) {
|
|
694
|
+
var size = _ref.size,
|
|
695
|
+
src = _ref.src,
|
|
696
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
697
|
+
|
|
698
|
+
return React.createElement(ImageBackground, Object.assign({
|
|
699
|
+
borderRadius: size / 2,
|
|
700
|
+
size: size,
|
|
701
|
+
src: src
|
|
702
|
+
}, props));
|
|
703
|
+
};
|
|
704
|
+
var SquaredImage = function SquaredImage(_ref2) {
|
|
705
|
+
var size = _ref2.size,
|
|
706
|
+
src = _ref2.src,
|
|
707
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded3);
|
|
708
|
+
|
|
709
|
+
return React.createElement(ImageBackground, Object.assign({}, props, {
|
|
710
|
+
size: size,
|
|
711
|
+
src: src
|
|
712
|
+
}));
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
var _excluded$1 = ["hint", "disabled", "opacity", "fontSize"],
|
|
716
|
+
_excluded2$1 = ["toUpperCase", "children", "textTypographyConfig"];
|
|
717
|
+
var formatTextStyle = function formatTextStyle(_ref) {
|
|
718
|
+
var _ref$hint = _ref.hint,
|
|
719
|
+
hint = _ref$hint === void 0 ? false : _ref$hint,
|
|
720
|
+
_ref$disabled = _ref.disabled,
|
|
721
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
722
|
+
opacity = _ref.opacity,
|
|
723
|
+
fontSize = _ref.fontSize,
|
|
724
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
725
|
+
|
|
726
|
+
if (props) {
|
|
727
|
+
if (hint) {
|
|
728
|
+
opacity = hint;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
if (disabled) {
|
|
732
|
+
opacity = disabled;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
return _extends({}, props, {
|
|
736
|
+
opacity: opacity,
|
|
737
|
+
fontSize: fontSize
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
return props;
|
|
742
|
+
};
|
|
743
|
+
var TextSpan = /*#__PURE__*/styled.div(function (props) {
|
|
744
|
+
props.display = 'inherit';
|
|
745
|
+
props.flexDirection = 'column';
|
|
746
|
+
return applyStyle(props);
|
|
747
|
+
});
|
|
748
|
+
var TextComponent = function TextComponent(textProps) {
|
|
749
|
+
var _useTheme = useTheme(),
|
|
750
|
+
getColor = _useTheme.getColor;
|
|
751
|
+
|
|
752
|
+
var styledProps = applyStyle(textProps);
|
|
753
|
+
|
|
754
|
+
var _styledProps$toUpperC = styledProps.toUpperCase,
|
|
755
|
+
toUpperCase = _styledProps$toUpperC === void 0 ? false : _styledProps$toUpperC,
|
|
756
|
+
children = styledProps.children,
|
|
757
|
+
textTypographyConfig = styledProps.textTypographyConfig,
|
|
758
|
+
props = _objectWithoutPropertiesLoose(styledProps, _excluded2$1);
|
|
759
|
+
|
|
760
|
+
var content = children;
|
|
761
|
+
|
|
762
|
+
if (children && typeof children === 'string') {
|
|
763
|
+
content = children.toString().trim();
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
if (typeof content === 'string' && toUpperCase) {
|
|
767
|
+
content = content.toUpperCase();
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
var style = props.style || {};
|
|
771
|
+
|
|
772
|
+
if (textTypographyConfig) {
|
|
773
|
+
style = formatTextStyle(_extends({}, textTypographyConfig, style));
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
if (typeof content === 'string') {
|
|
777
|
+
content = content.split('\n').map(function (item, key) {
|
|
778
|
+
return React.createElement("span", {
|
|
779
|
+
key: key.toString()
|
|
780
|
+
}, item, React.createElement("br", null));
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
Object.values(style).map(function (val) {
|
|
785
|
+
if (typeof val === 'string' && val.toLowerCase().indexOf('color') !== -1) {
|
|
786
|
+
val = getColor(val);
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
return React.createElement(TextSpan, Object.assign({}, style, props), content);
|
|
790
|
+
};
|
|
791
|
+
var Text = TextComponent;
|
|
792
|
+
|
|
793
|
+
var useMount = function useMount(callback) {
|
|
794
|
+
useEffect(function () {
|
|
795
|
+
callback();
|
|
796
|
+
}, []);
|
|
797
|
+
};
|
|
798
|
+
|
|
799
|
+
var defaultBreakpointsConfig = {
|
|
800
|
+
xs: 0,
|
|
801
|
+
sm: 340,
|
|
802
|
+
md: 560,
|
|
803
|
+
lg: 1080,
|
|
804
|
+
xl: 1300
|
|
805
|
+
};
|
|
806
|
+
var defaultDeviceConfig = {
|
|
807
|
+
mobile: ['xs', 'sm'],
|
|
808
|
+
tablet: ['md', 'lg'],
|
|
809
|
+
desktop: ['lg', 'xl']
|
|
810
|
+
};
|
|
811
|
+
var defaultScreenConfig = {
|
|
812
|
+
breakpoints: defaultBreakpointsConfig,
|
|
813
|
+
devices: defaultDeviceConfig
|
|
814
|
+
};
|
|
815
|
+
var ResponsiveContext = /*#__PURE__*/createContext(defaultScreenConfig);
|
|
816
|
+
var useResponsiveContext = function useResponsiveContext() {
|
|
817
|
+
return useContext(ResponsiveContext);
|
|
818
|
+
};
|
|
819
|
+
var ResponsiveProvider = function ResponsiveProvider(_ref) {
|
|
820
|
+
var _ref$breakpoints = _ref.breakpoints,
|
|
821
|
+
breakpoints = _ref$breakpoints === void 0 ? defaultBreakpointsConfig : _ref$breakpoints,
|
|
822
|
+
_ref$devices = _ref.devices,
|
|
823
|
+
devices = _ref$devices === void 0 ? defaultDeviceConfig : _ref$devices,
|
|
824
|
+
children = _ref.children;
|
|
825
|
+
return React.createElement(ResponsiveContext.Provider, {
|
|
826
|
+
value: {
|
|
827
|
+
breakpoints: breakpoints,
|
|
828
|
+
devices: devices
|
|
829
|
+
}
|
|
830
|
+
}, children);
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
var createQuery = function createQuery(keyScreen, query, set) {
|
|
834
|
+
var mql = window.matchMedia(query);
|
|
835
|
+
|
|
836
|
+
var onChange = function onChange() {
|
|
837
|
+
if (!!mql.matches) {
|
|
838
|
+
set(keyScreen);
|
|
839
|
+
}
|
|
840
|
+
};
|
|
841
|
+
|
|
842
|
+
mql.addListener(onChange);
|
|
843
|
+
|
|
844
|
+
if (!!mql.matches) {
|
|
845
|
+
set(keyScreen);
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
return function () {
|
|
849
|
+
mql.removeListener(onChange);
|
|
850
|
+
};
|
|
851
|
+
};
|
|
852
|
+
var useResponsive = function useResponsive() {
|
|
853
|
+
var _useResponsiveContext = useResponsiveContext(),
|
|
854
|
+
breakpoints = _useResponsiveContext.breakpoints,
|
|
855
|
+
devices = _useResponsiveContext.devices;
|
|
856
|
+
|
|
857
|
+
var _useState = useState('xs'),
|
|
858
|
+
screen = _useState[0],
|
|
859
|
+
setScreen = _useState[1];
|
|
860
|
+
|
|
861
|
+
var _useState2 = useState('landscape'),
|
|
862
|
+
orientation = _useState2[0],
|
|
863
|
+
setOrientation = _useState2[1];
|
|
864
|
+
|
|
865
|
+
var keys = Object.keys(breakpoints);
|
|
866
|
+
useMount(function () {
|
|
867
|
+
var breakpointValue = keys.map(function (breakpoint) {
|
|
868
|
+
var value = {
|
|
869
|
+
breakpoint: breakpoint,
|
|
870
|
+
min: breakpoints[breakpoint],
|
|
871
|
+
max: 0
|
|
872
|
+
};
|
|
873
|
+
return value;
|
|
874
|
+
}).sort(function (a, b) {
|
|
875
|
+
return a.min - b.min;
|
|
876
|
+
});
|
|
877
|
+
breakpointValue.reduce(function (a, b) {
|
|
878
|
+
if (b) a.max = b.min;
|
|
879
|
+
return b;
|
|
880
|
+
});
|
|
881
|
+
breakpointValue.map(function (sizeScreen) {
|
|
882
|
+
createQuery(sizeScreen.breakpoint, "only screen " + (sizeScreen.min && sizeScreen.min >= 0 ? 'and (min-width:' + sizeScreen.min + 'px)' : '') + " " + (sizeScreen.max && sizeScreen.max >= 0 ? 'and (max-width:' + sizeScreen.max + 'px)' : ''), setScreen); // if (
|
|
883
|
+
// window.innerWidth >= sizeScreen.min &&
|
|
884
|
+
// window.innerWidth <= sizeScreen.max
|
|
885
|
+
// ) {
|
|
886
|
+
// setScreen(key as ScreenResponsiveConfig);
|
|
887
|
+
// }
|
|
888
|
+
});
|
|
889
|
+
createQuery('landscape', 'only screen and (orientation: landscape)', setOrientation);
|
|
890
|
+
createQuery('portrait', 'only screen and (orientation: portrait)', setOrientation);
|
|
891
|
+
});
|
|
892
|
+
|
|
893
|
+
var on = function on(device) {
|
|
894
|
+
return devices[device].includes(screen);
|
|
895
|
+
};
|
|
896
|
+
|
|
897
|
+
return {
|
|
898
|
+
breakpoints: breakpoints,
|
|
899
|
+
devices: devices,
|
|
900
|
+
orientation: orientation,
|
|
901
|
+
screen: screen,
|
|
902
|
+
on: on
|
|
903
|
+
};
|
|
904
|
+
};
|
|
905
|
+
|
|
906
|
+
export { AlignCenter, AlignEnd, AlignStart, Center, End, Horizontal, HorizontalScroll, Image, ImageBackground, Inline, ResponsiveContext, ResponsiveProvider, RoundedImage, SafeArea, Scroll, SquaredImage, Start, Text, TextComponent, TextSpan, ThemeContext, ThemeProvider, Vertical, VerticalScroll, View, createQuery, formatTextStyle, useMount, useResponsive, useResponsiveContext, useTheme };
|
|
907
|
+
//# sourceMappingURL=app-studio.esm.js.map
|