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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +208 -0
  3. package/dist/app-studio.cjs.development.js +944 -0
  4. package/dist/app-studio.cjs.development.js.map +1 -0
  5. package/dist/app-studio.cjs.production.min.js +2 -0
  6. package/dist/app-studio.cjs.production.min.js.map +1 -0
  7. package/dist/app-studio.esm.js +907 -0
  8. package/dist/app-studio.esm.js.map +1 -0
  9. package/dist/components/Element.d.ts +30 -0
  10. package/dist/components/Image.d.ts +23 -0
  11. package/dist/components/Layout.d.ts +11 -0
  12. package/dist/components/Text.d.ts +23 -0
  13. package/dist/components/View.d.ts +32 -0
  14. package/dist/components/Wrapper.d.ts +4 -0
  15. package/dist/hooks/useMount.d.ts +1 -0
  16. package/dist/hooks/useResponsive.d.ts +9 -0
  17. package/dist/index.d.ts +8 -0
  18. package/dist/index.js +8 -0
  19. package/dist/providers/Responsive.d.ts +20 -0
  20. package/dist/providers/Theme.d.ts +19 -0
  21. package/dist/utils/colors.d.ts +14 -0
  22. package/dist/utils/env.d.ts +15 -0
  23. package/dist/utils/shadow.d.ts +103 -0
  24. package/dist/utils/typography.d.ts +46 -0
  25. package/package.json +114 -0
  26. package/src/components/Element.tsx +430 -0
  27. package/src/components/Image.tsx +56 -0
  28. package/src/components/Layout.tsx +49 -0
  29. package/src/components/Text.tsx +118 -0
  30. package/src/components/View.md +6 -0
  31. package/src/components/View.tsx +87 -0
  32. package/src/components/Wrapper.tsx +11 -0
  33. package/src/hooks/useMount.ts +6 -0
  34. package/src/hooks/useResponsive.ts +102 -0
  35. package/src/index.tsx +8 -0
  36. package/src/providers/Responsive.tsx +61 -0
  37. package/src/providers/Theme.tsx +73 -0
  38. package/src/types/module.d.ts +1 -0
  39. package/src/types/style.d.ts +696 -0
  40. package/src/utils/colors.ts +321 -0
  41. package/src/utils/env.ts +43 -0
  42. package/src/utils/shadow.ts +102 -0
  43. package/src/utils/typography.ts +45 -0
@@ -0,0 +1,321 @@
1
+ export type ColorPalette = Record<string, Record<number, string>>;
2
+
3
+ export type ColorSingleton = Record<
4
+ string,
5
+ {
6
+ 50: string;
7
+ 100: string;
8
+ 200: string;
9
+ 300: string;
10
+ 400: string;
11
+ 500: string;
12
+ 600: string;
13
+ 700: string;
14
+ 800: string;
15
+ 900: string;
16
+ }
17
+ >;
18
+
19
+ export const palette: ColorPalette = {
20
+ whiteAlpha: {
21
+ 50: 'rgba(255, 255, 255, 0.04)',
22
+ 100: 'rgba(255, 255, 255, 0.06)',
23
+ 200: 'rgba(255, 255, 255, 0.08)',
24
+ 300: 'rgba(255, 255, 255, 0.16)',
25
+ 400: 'rgba(255, 255, 255, 0.24)',
26
+ 500: 'rgba(255, 255, 255, 0.36)',
27
+ 600: 'rgba(255, 255, 255, 0.48)',
28
+ 700: 'rgba(255, 255, 255, 0.64)',
29
+ 800: 'rgba(255, 255, 255, 0.80)',
30
+ 900: 'rgba(255, 255, 255, 0.92)',
31
+ },
32
+
33
+ blackAlpha: {
34
+ 50: 'rgba(0, 0, 0, 0.04)',
35
+ 100: 'rgba(0, 0, 0, 0.06)',
36
+ 200: 'rgba(0, 0, 0, 0.08)',
37
+ 300: 'rgba(0, 0, 0, 0.16)',
38
+ 400: 'rgba(0, 0, 0, 0.24)',
39
+ 500: 'rgba(0, 0, 0, 0.36)',
40
+ 600: 'rgba(0, 0, 0, 0.48)',
41
+ 700: 'rgba(0, 0, 0, 0.64)',
42
+ 800: 'rgba(0, 0, 0, 0.80)',
43
+ 900: 'rgba(0, 0, 0, 0.92)',
44
+ },
45
+ rose: {
46
+ 50: '#fff1f2',
47
+ 100: '#ffe4e6',
48
+ 200: '#fecdd3',
49
+ 300: '#fda4af',
50
+ 400: '#fb7185',
51
+ 500: '#f43f5e',
52
+ 600: '#e11d48',
53
+ 700: '#be123c',
54
+ 800: '#9f1239',
55
+ 900: '#881337',
56
+ },
57
+ pink: {
58
+ 50: '#fdf2f8',
59
+ 100: '#fce7f3',
60
+ 200: '#fbcfe8',
61
+ 300: '#f9a8d4',
62
+ 400: '#f472b6',
63
+ 500: '#ec4899',
64
+ 600: '#db2777',
65
+ 700: '#be185d',
66
+ 800: '#9d174d',
67
+ 900: '#831843',
68
+ },
69
+ fuchsia: {
70
+ 50: '#fdf4ff',
71
+ 100: '#fae8ff',
72
+ 200: '#f5d0fe',
73
+ 300: '#f0abfc',
74
+ 400: '#e879f9',
75
+ 500: '#d946ef',
76
+ 600: '#c026d3',
77
+ 700: '#a21caf',
78
+ 800: '#86198f',
79
+ 900: '#701a75',
80
+ },
81
+ purple: {
82
+ 50: '#faf5ff',
83
+ 100: '#f3e8ff',
84
+ 200: '#e9d5ff',
85
+ 300: '#d8b4fe',
86
+ 400: '#c084fc',
87
+ 500: '#a855f7',
88
+ 600: '#9333ea',
89
+ 700: '#7e22ce',
90
+ 800: '#6b21a8',
91
+ 900: '#581c87',
92
+ },
93
+ violet: {
94
+ 50: '#f5f3ff',
95
+ 100: '#ede9fe',
96
+ 200: '#ddd6fe',
97
+ 300: '#c4b5fd',
98
+ 400: '#a78bfa',
99
+ 500: '#8b5cf6',
100
+ 600: '#7c3aed',
101
+ 700: '#6d28d9',
102
+ 800: '#5b21b6',
103
+ 900: '#4c1d95',
104
+ },
105
+ indigo: {
106
+ 50: '#eef2ff',
107
+ 100: '#e0e7ff',
108
+ 200: '#c7d2fe',
109
+ 300: '#a5b4fc',
110
+ 400: '#818cf8',
111
+ 500: '#6366f1',
112
+ 600: '#4f46e5',
113
+ 700: '#4338ca',
114
+ 800: '#3730a3',
115
+ 900: '#312e81',
116
+ },
117
+ blue: {
118
+ 50: '#eff6ff',
119
+ 100: '#dbeafe',
120
+ 200: '#bfdbfe',
121
+ 300: '#93c5fd',
122
+ 400: '#60a5fa',
123
+ 500: '#3b82f6',
124
+ 600: '#2563eb',
125
+ 700: '#1d4ed8',
126
+ 800: '#1e40af',
127
+ 900: '#1e3a8a',
128
+ },
129
+ lightBlue: {
130
+ 50: '#f0f9ff',
131
+ 100: '#e0f2fe',
132
+ 200: '#bae6fd',
133
+ 300: '#7dd3fc',
134
+ 400: '#38bdf8',
135
+ 500: '#0ea5e9',
136
+ 600: '#0284c7',
137
+ 700: '#0369a1',
138
+ 800: '#075985',
139
+ 900: '#0c4a6e',
140
+ },
141
+ cyan: {
142
+ 50: '#ecfeff',
143
+ 100: '#cffafe',
144
+ 200: '#a5f3fc',
145
+ 300: '#67e8f9',
146
+ 400: '#22d3ee',
147
+ 500: '#06b6d4',
148
+ 600: '#0891b2',
149
+ 700: '#0e7490',
150
+ 800: '#155e75',
151
+ 900: '#164e63',
152
+ },
153
+ teal: {
154
+ 50: '#f0fdfa',
155
+ 100: '#ccfbf1',
156
+ 200: '#99f6e4',
157
+ 300: '#5eead4',
158
+ 400: '#2dd4bf',
159
+ 500: '#14b8a6',
160
+ 600: '#0d9488',
161
+ 700: '#0f766e',
162
+ 800: '#115e59',
163
+ 900: '#134e4a',
164
+ },
165
+ emerald: {
166
+ 50: '#ecfdf5',
167
+ 100: '#d1fae5',
168
+ 200: '#a7f3d0',
169
+ 300: '#6ee7b7',
170
+ 400: '#34d399',
171
+ 500: '#10b981',
172
+ 600: '#059669',
173
+ 700: '#047857',
174
+ 800: '#065f46',
175
+ 900: '#064e3b',
176
+ },
177
+ green: {
178
+ 50: '#f0fdf4',
179
+ 100: '#dcfce7',
180
+ 200: '#bbf7d0',
181
+ 300: '#86efac',
182
+ 400: '#4ade80',
183
+ 500: '#22c55e',
184
+ 600: '#16a34a',
185
+ 700: '#15803d',
186
+ 800: '#166534',
187
+ 900: '#14532d',
188
+ },
189
+ lime: {
190
+ 50: '#f7fee7',
191
+ 100: '#ecfccb',
192
+ 200: '#d9f99d',
193
+ 300: '#bef264',
194
+ 400: '#a3e635',
195
+ 500: '#84cc16',
196
+ 600: '#65a30d',
197
+ 700: '#4d7c0f',
198
+ 800: '#3f6212',
199
+ 900: '#365314',
200
+ },
201
+ yellow: {
202
+ 50: '#fefce8',
203
+ 100: '#fef9c3',
204
+ 200: '#fef08a',
205
+ 300: '#fde047',
206
+ 400: '#facc15',
207
+ 500: '#eab308',
208
+ 600: '#ca8a04',
209
+ 700: '#a16207',
210
+ 800: '#854d0e',
211
+ 900: '#713f12',
212
+ },
213
+ amber: {
214
+ 50: '#fffbeb',
215
+ 100: '#fef3c7',
216
+ 200: '#fde68a',
217
+ 300: '#fcd34d',
218
+ 400: '#fbbf24',
219
+ 500: '#f59e0b',
220
+ 600: '#d97706',
221
+ 700: '#b45309',
222
+ 800: '#92400e',
223
+ 900: '#78350f',
224
+ },
225
+ orange: {
226
+ 50: '#fff7ed',
227
+ 100: '#ffedd5',
228
+ 200: '#fed7aa',
229
+ 300: '#fdba74',
230
+ 400: '#fb923c',
231
+ 500: '#f97316',
232
+ 600: '#ea580c',
233
+ 700: '#c2410c',
234
+ 800: '#9a3412',
235
+ 900: '#7c2d12',
236
+ },
237
+ red: {
238
+ 50: '#fef2f2',
239
+ 100: '#fee2e2',
240
+ 200: '#fecaca',
241
+ 300: '#fca5a5',
242
+ 400: '#f87171',
243
+ 500: '#ef4444',
244
+ 600: '#dc2626',
245
+ 700: '#b91c1c',
246
+ 800: '#991b1b',
247
+ 900: '#7f1d1d',
248
+ },
249
+ warmGray: {
250
+ 50: '#fafaf9',
251
+ 100: '#f5f5f4',
252
+ 200: '#e7e5e4',
253
+ 300: '#d6d3d1',
254
+ 400: '#a8a29e',
255
+ 500: '#78716c',
256
+ 600: '#57534e',
257
+ 700: '#44403c',
258
+ 800: '#292524',
259
+ 900: '#1c1917',
260
+ },
261
+ trueGray: {
262
+ 50: '#fafafa',
263
+ 100: '#f5f5f5',
264
+ 200: '#e5e5e5',
265
+ 300: '#d4d4d4',
266
+ 400: '#a3a3a3',
267
+ 500: '#737373',
268
+ 600: '#525252',
269
+ 700: '#404040',
270
+ 800: '#262626',
271
+ 900: '#171717',
272
+ },
273
+ gray: {
274
+ 50: '#fafafa',
275
+ 100: '#f4f4f5',
276
+ 200: '#e4e4e7',
277
+ 300: '#d4d4d8',
278
+ 400: '#a1a1aa',
279
+ 500: '#71717a',
280
+ 600: '#52525b',
281
+ 700: '#3f3f46',
282
+ 800: '#27272a',
283
+ 900: '#18181b',
284
+ },
285
+ dark: {
286
+ 50: '#18181b',
287
+ 100: '#27272a',
288
+ 200: '#3f3f46',
289
+ 300: '#52525b',
290
+ 400: '#71717a',
291
+ 500: '#a1a1aa',
292
+ 600: '#d4d4d8',
293
+ 700: '#e4e4e7',
294
+ 800: '#f4f4f5',
295
+ 900: '#fafafa',
296
+ },
297
+ coolGray: {
298
+ 50: '#f9fafb',
299
+ 100: '#f3f4f6',
300
+ 200: '#e5e7eb',
301
+ 300: '#d1d5db',
302
+ 400: '#9ca3af',
303
+ 500: '#6b7280',
304
+ 600: '#4b5563',
305
+ 700: '#374151',
306
+ 800: '#1f2937',
307
+ 900: '#111827',
308
+ },
309
+ blueGray: {
310
+ 50: '#f8fafc',
311
+ 100: '#f1f5f9',
312
+ 200: '#e2e8f0',
313
+ 300: '#cbd5e1',
314
+ 400: '#94a3b8',
315
+ 500: '#64748b',
316
+ 600: '#475569',
317
+ 700: '#334155',
318
+ 800: '#1e293b',
319
+ 900: '#0f172a',
320
+ },
321
+ };
@@ -0,0 +1,43 @@
1
+ /**
2
+ * whether in browser env
3
+ */
4
+ export const isBrowser = (): boolean =>
5
+ typeof window !== 'undefined' &&
6
+ typeof window.document !== 'undefined' &&
7
+ typeof window.document.createElement !== 'undefined';
8
+
9
+ /**
10
+ * get window.g_initialProps
11
+ */
12
+ export const getWindowInitialProps = () =>
13
+ isBrowser() ? (window as any).g_initialProps : undefined;
14
+
15
+ /**
16
+ * whether SSR success in client
17
+ */
18
+ export const isSSR = !isBrowser();
19
+
20
+ export function isDev() {
21
+ let dev = false;
22
+
23
+ if (isBrowser()) {
24
+ dev = !(window.location.hostname.indexOf('localhost') === -1);
25
+ }
26
+ return dev;
27
+ }
28
+
29
+ export function isProd() {
30
+ if (isBrowser()) {
31
+ if (window && window.location && window.location.hostname) {
32
+ return (
33
+ window.location.hostname.includes('localhost') ||
34
+ window.location.hostname.includes('develop')
35
+ );
36
+ }
37
+ }
38
+ return false;
39
+ }
40
+
41
+ export function isMobile() {
42
+ return navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i);
43
+ }
@@ -0,0 +1,102 @@
1
+ export default {
2
+ 0: {
3
+ shadowColor: '#000',
4
+ shadowOffset: {
5
+ width: 0,
6
+ height: 1,
7
+ },
8
+ shadowOpacity: 0.18,
9
+ shadowRadius: 1.0,
10
+ elevation: 1,
11
+ },
12
+ 1: {
13
+ shadowColor: '#000',
14
+ shadowOffset: {
15
+ width: 0,
16
+ height: 1,
17
+ },
18
+ shadowOpacity: 0.2,
19
+ shadowRadius: 1.41,
20
+ elevation: 2,
21
+ },
22
+ 2: {
23
+ shadowColor: '#000',
24
+ shadowOffset: {
25
+ width: 0,
26
+ height: 1,
27
+ },
28
+ shadowOpacity: 0.22,
29
+ shadowRadius: 2.22,
30
+ elevation: 3,
31
+ },
32
+ 3: {
33
+ shadowColor: '#000',
34
+ shadowOffset: {
35
+ width: 0,
36
+ height: 2,
37
+ },
38
+ shadowOpacity: 0.23,
39
+ shadowRadius: 2.62,
40
+ elevation: 4,
41
+ },
42
+ 4: {
43
+ shadowColor: '#000',
44
+ shadowOffset: {
45
+ width: 0,
46
+ height: 2,
47
+ },
48
+ shadowOpacity: 0.25,
49
+ shadowRadius: 3.84,
50
+ elevation: 5,
51
+ },
52
+ 5: {
53
+ shadowColor: '#000',
54
+ shadowOffset: {
55
+ width: 0,
56
+ height: 3,
57
+ },
58
+ shadowOpacity: 0.27,
59
+ shadowRadius: 4.65,
60
+ elevation: 6,
61
+ },
62
+ 6: {
63
+ shadowColor: '#000',
64
+ shadowOffset: {
65
+ width: 0,
66
+ height: 3,
67
+ },
68
+ shadowOpacity: 0.29,
69
+ shadowRadius: 4.65,
70
+ elevation: 7,
71
+ },
72
+ 7: {
73
+ shadowColor: '#000',
74
+ shadowOffset: {
75
+ width: 0,
76
+ height: 4,
77
+ },
78
+ shadowOpacity: 0.3,
79
+ shadowRadius: 4.65,
80
+ elevation: 8,
81
+ },
82
+ 8: {
83
+ shadowColor: '#000',
84
+ shadowOffset: {
85
+ width: 0,
86
+ height: 4,
87
+ },
88
+ shadowOpacity: 0.32,
89
+ shadowRadius: 5.46,
90
+ elevation: 9,
91
+ },
92
+ 9: {
93
+ shadowColor: '#000',
94
+ shadowOffset: {
95
+ width: 0,
96
+ height: 5,
97
+ },
98
+ shadowOpacity: 0.34,
99
+ shadowRadius: 6.27,
100
+ elevation: 10,
101
+ },
102
+ };
@@ -0,0 +1,45 @@
1
+ export default {
2
+ letterSpacings: {
3
+ tighter: -0.08,
4
+ tight: -0.4,
5
+ normal: 0,
6
+ wide: 0.4,
7
+ wider: 0.8,
8
+ widest: 1.6,
9
+ },
10
+ lineHeights: {
11
+ xs: 12,
12
+ sm: 14,
13
+ md: 16,
14
+ lg: 18,
15
+ xl: 20,
16
+ '2xl': 24,
17
+ '3xl': 30,
18
+ '4xl': 36,
19
+ '5xl': 48,
20
+ '6xl': 64,
21
+ },
22
+ fontWeights: {
23
+ hairline: 100,
24
+ thin: 200,
25
+ light: 300,
26
+ normal: 400,
27
+ medium: 500,
28
+ semiBold: 600,
29
+ bold: 700,
30
+ extraBold: 800,
31
+ black: 900,
32
+ },
33
+ fontSizes: {
34
+ xs: 12,
35
+ sm: 14,
36
+ md: 16,
37
+ lg: 18,
38
+ xl: 20,
39
+ '2xl': 24,
40
+ '3xl': 30,
41
+ '4xl': 36,
42
+ '5xl': 48,
43
+ '6xl': 64,
44
+ },
45
+ };