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