app-studio 0.5.71 → 0.5.72

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/README.md CHANGED
@@ -1,487 +1,714 @@
1
- # App-Studio
2
-
3
- App-Studio is a powerful React-based library designed to simplify the process of building responsive, interactive, and visually consistent web applications. It provides CSS design props for layout, spacing, sizing, shadows, event management, and theming.
4
-
5
- ### Features
6
-
7
- - 🌈 Add styled props to your application
8
- - 📦 A set of simple and powerful React components
9
- - 🌍 Internationalization support for dozens of languages
10
- - 🎨 Powerful theme customization in every detail
11
-
12
- ## Table of Contents
13
-
14
- - [Installation](#2-installation)
15
- - [Core Components](#3-core-components)
16
- - [Element](#element)
17
- - [View](#view)
18
- - [Text](#text)
19
- - [Form](#form)
20
- - [Image](#image)
21
- - [Responsive Design](#4-responsive-design)
22
- - [Media Prop](#media-prop)
23
- - [useResponsive Hook](#useresponsive-hook)
24
- - [Event Management](#5-event-management)
25
- - [Theming](#6-theming)
26
- - [Custom Hooks](#7-custom-hooks)
27
- - [useMount](#usemount)
28
- - [Design Props](#8-design-props)
29
- - [Shadow Prop](#shadow-prop)
30
- - [Animation](#9-animation)
31
- - [Basic Usage](#basic-usage)
32
- - [Available Animations](#available-animations)
33
- - [Animation Properties](#animation-properties)
34
- - [Advanced Usage](#10-advanced-usage)
35
- - [Contributing](#11-contributing)
36
- - [License](#12-license)
37
-
38
- ## 2. Installation
39
-
40
- To install App-Studio, run the following command:
1
+ # App-Studio
2
+
3
+ App-Studio is a React library that simplifies the creation of modern web applications by providing reusable components, hooks, and utilities. It offers built-in support for theming, responsive design, and analytics, making it an ideal choice for developers aiming to build high-quality, efficient, and scalable projects. Key features include:
4
+
5
+ - A robust set of UI components for layouts, forms, and more.
6
+ - Hooks for managing state, events, and responsiveness.
7
+ - Providers for theming, responsiveness, and analytics.
8
+ - Utilities for styling, colors, and typography.
9
+
10
+ Whether you're building a small prototype or a large-scale application, App-Studio empowers you to work faster and smarter.
11
+
12
+ ---
13
+
14
+ # Installation
15
+
16
+ To get started with App-Studio, install it via npm and set up the necessary providers in your application.
17
+
18
+ Prerequisites
19
+
20
+ - Node.js (>= 14.x)
21
+ - React (>= 17.x)
22
+
23
+ # Installation Steps
24
+
25
+ Run the following command to install App-Studio:
26
+
27
+ bash
41
28
 
42
29
  ```bash
43
- npm install app-studio --save
30
+ npm install --save app-studio
31
+ ```
32
+
33
+ After installation, wrap your application with the core providers to enable theming, responsiveness, and analytics:
34
+
35
+ jsx
36
+
37
+ ```jsx
38
+ import { ThemeProvider, ResponsiveProvider, AnalyticsProvider } from 'app-studio';
39
+
40
+ function App() {
41
+ return (
42
+ <ThemeProvider>
43
+ <ResponsiveProvider>
44
+ <AnalyticsProvider>
45
+ {/* Your application components */}
46
+ </AnalyticsProvider>
47
+ </ResponsiveProvider>
48
+ </ThemeProvider>
49
+ );
50
+ }
51
+
52
+ export default App;
44
53
  ```
45
54
 
46
- ## 3. Core Components
55
+ ---
56
+
57
+ # Components
58
+
59
+ App-Studio provides a set of reusable components to handle common UI tasks. Below is detailed documentation for each component.
60
+
61
+ ## View
47
62
 
48
- ### Element
63
+ The View component is a versatile container for creating layouts, supporting a wide range of styling options.
49
64
 
50
- The `Element` component is the base for all other components. It handles responsiveness, shadows, margins, padding, and more.
65
+ Props
51
66
 
52
- #### Key Features
67
+ | **Prop** | **Type** | **Default** | **Description** |
68
+ | --- | --- | --- | --- |
69
+ | as | string | 'div' | The HTML element to render as. |
70
+ | children | React.ReactNode | - | Content inside the view. |
53
71
 
54
- - Sets both `width` and `height` with the `size` prop.
55
- - Defines styles for different CSS events with the `on` prop.
56
- - Defines responsive styles for different media queries with the `media` prop.
57
- - Applies shadow effects with the `shadow` prop.
72
+ Example
58
73
 
59
- #### Usage
74
+ jsx
60
75
 
61
76
  ```jsx
62
- <Element backgroundColor="color.blue" padding={10}>
63
- This is an element
64
- </Element>
77
+ import { View } from 'app-studio';
78
+
79
+ function MyComponent() {
80
+ return (
81
+ <View
82
+ backgroundColor="color.blue.500"
83
+ padding={16}
84
+ borderRadius={8}
85
+ onClick={() => console.log('Clicked!')}
86
+ >
87
+ Hello, World!
88
+ </View>
89
+ );
90
+ }
65
91
  ```
66
92
 
67
- ### View
93
+ Best Practices
68
94
 
69
- The `View` component extends the basic `div` HTML element. It's a generic container used to create various layouts.
95
+ - Use as to render semantic HTML elements (e.g., section, article).
96
+ - Leverage theme colors for consistent styling.
70
97
 
71
- #### Key Features
98
+ ## Image
72
99
 
73
- - Provides a flexible way to structure content.
74
- - Supports all `Element` props.
100
+ The Image component optimizes image loading and rendering.
75
101
 
76
- #### Usage
102
+ Props
103
+
104
+ | **Prop** | **Type** | **Default** | **Description** |
105
+ | --- | --- | --- | --- |
106
+ | src | string | - | Image URL. |
107
+ | alt | string | - | Alternative text for the image. |
108
+ | lazy | boolean | true | Enables lazy loading. |
109
+
110
+ Example
111
+
112
+ jsx
77
113
 
78
114
  ```jsx
79
- <View backgroundColor="color.red" color="color.white" padding={20}>
80
- This is a view
81
- </View>
115
+ import { Image } from 'app-studio';
116
+
117
+ function MyComponent() {
118
+ return <Image src="example.jpg" alt="Example" lazy />;
119
+ }
82
120
  ```
83
121
 
84
- ### Text
122
+ ## Text
123
+
124
+ The Text component provides styled text with typography support.
85
125
 
86
- The `Text` component extends the basic `div` HTML element for rendering text content.
126
+ Props
87
127
 
88
- #### Key Features
128
+ | **Prop** | **Type** | **Default** | **Description** |
129
+ | --- | --- | --- | --- |
130
+ | as | string | 'p' | HTML element to render as. |
131
+ | size | string | 'md' | Font size (e.g., 'sm', 'lg'). |
132
+ | weight | string | 'normal' | Font weight (e.g., 'bold'). |
89
133
 
90
- - Provides text-specific styling options.
91
- - Supports all `Element` props.
134
+ Example
92
135
 
93
- #### Usage
136
+ jsx
94
137
 
95
138
  ```jsx
96
- <Text color="color.blue">This is a text</Text>
139
+ import { Text } from 'app-studio';
140
+
141
+ function MyComponent() {
142
+ return <Text size="lg" weight="bold">Bold Large Text</Text>;
143
+ }
97
144
  ```
98
145
 
99
- ### Form
146
+ ## Form
147
+
148
+ The Form component simplifies form creation and validation.
100
149
 
101
- The `Form` component extends the basic `form` HTML element and provides nested `Form.Button` and `Form.Input` components.
150
+ Props
102
151
 
103
- #### Key Features
152
+ | **Prop** | **Type** | **Default** | **Description** |
153
+ | --- | --- | --- | --- |
154
+ | onSubmit | function | - | Callback on form submission. |
155
+ | children | React.ReactNode | - | Form fields and elements. |
104
156
 
105
- - Simplifies form creation and management.
106
- - Supports all `Element` props.
157
+ Example
107
158
 
108
- #### Usage
159
+ jsx
109
160
 
110
161
  ```jsx
111
- <Form>
112
- <Form.Input placeholder="Enter your name" />
113
- <Form.Button>Submit</Form.Button>
114
- </Form>
162
+ import { Form } from 'app-studio';
163
+
164
+ function MyComponent() {
165
+ return (
166
+ <Form onSubmit={(data) => console.log(data)}>
167
+ <input name="username" />
168
+ <button type="submit">Submit</button>
169
+ </Form>
170
+ );
171
+ }
115
172
  ```
116
173
 
117
- ### Image
174
+ ## Skeleton
175
+
176
+ The Skeleton component displays a placeholder while content loads.
118
177
 
119
- The `Image` component extends the basic `img` HTML element for displaying images.
178
+ Props
120
179
 
121
- #### Key Features
180
+ | **Prop** | **Type** | **Default** | **Description** |
181
+ | --- | --- | --- | --- |
182
+ | width | string | '100%' | Width of the skeleton. |
183
+ | height | string | '20px' | Height of the skeleton. |
122
184
 
123
- - Supports responsive image loading with `media`.
124
- - Applies shadow effects with `shadow`.
125
- - Handles events with `on`.
185
+ Example
126
186
 
127
- #### Usage
187
+ jsx
128
188
 
129
189
  ```jsx
130
- <Image src="url_to_image" alt="description" />
190
+ import { Skeleton } from 'app-studio';
191
+
192
+ function MyComponent() {
193
+ return <Skeleton width="200px" height="30px" />;
194
+ }
131
195
  ```
132
196
 
133
- ## 4. Responsive Design
197
+ # Hooks
198
+
199
+ App-Studio includes a variety of hooks to manage state, events, and responsiveness.
200
+
201
+ ## useActive
134
202
 
135
- App-Studio offers two primary methods for implementing responsive design: the `media` prop and the `useResponsive` hook.
203
+ Detects if an element is active (e.g., pressed).
136
204
 
137
- ### Media Prop
205
+ Parameters
138
206
 
139
- The `media` prop allows you to specify different styles for various devices or screen sizes without causing component re-renders.
207
+ None.
140
208
 
141
- #### Example
209
+ Return Values
210
+
211
+ | **Value** | **Type** | **Description** |
212
+ | --- | --- | --- |
213
+ | active | boolean | Whether the element is active. |
214
+
215
+ Example
216
+
217
+ jsx
142
218
 
143
219
  ```jsx
144
- <View size={100}
145
- media={{
146
- mobile: { backgroundColor: 'color.green' },
147
- tablet: { backgroundColor: 'color.yellow' },
148
- xl: { backgroundColor: 'color.blue' },
149
- }}
150
- />
220
+ import { useActive } from 'app-studio';
221
+
222
+ function MyComponent() {
223
+ const { active } = useActive();
224
+ return <button style={{ opacity: active ? 0.7 : 1 }}>Click me</button>;
225
+ }
151
226
  ```
152
227
 
153
- ### useResponsive Hook
228
+ ## useClickOutside
229
+
230
+ Triggers a callback when clicking outside an element.
154
231
 
155
- The `useResponsive` hook provides information about the current screen size and device type based on defined breakpoints and devices.
232
+ Parameters
156
233
 
157
- #### Example
234
+ | **Param** | **Type** | **Description** |
235
+ | --- | --- | --- |
236
+ | callback | function | Called when clicking outside. |
237
+
238
+ Example
239
+
240
+ jsx
158
241
 
159
242
  ```jsx
160
- const { screen, on } = useResponsive();
243
+ import { useClickOutside } from 'app-studio';
244
+ import { useRef } from 'react';
161
245
 
162
- return (
163
- <View size={100} backgroundColor={responsive[screen]}>
164
- {screen} - mobile: {on('mobile') ? 'yes' : 'no'}
165
- </View>
166
- );
246
+ function MyComponent() {
247
+ const ref = useRef();
248
+ useClickOutside(() => console.log('Clicked outside'), ref);
249
+ return <div ref={ref}>Click outside me</div>;
250
+ }
167
251
  ```
168
252
 
169
- To use these responsive features, wrap your app with `ResponsiveProvider`:
253
+ ## useFocus
254
+
255
+ Tracks focus state of an element.
256
+
257
+ Return Values
258
+
259
+ | **Value** | **Type** | **Description** |
260
+ | --- | --- | --- |
261
+ | focused | boolean | Whether the element is focused. |
262
+
263
+ Example
264
+
265
+ jsx
170
266
 
171
267
  ```jsx
172
- <ResponsiveProvider
173
- breakpoints={{
174
- xs: 0,
175
- sm: 340,
176
- md: 560,
177
- lg: 1080,
178
- xl: 1300,
179
- }}
180
- devices={{
181
- mobile: ['xs', 'sm'],
182
- tablet: ['md', 'lg'],
183
- desktop: ['lg', 'xl']
184
- }}
185
- >
186
- <App />
187
- </ResponsiveProvider>
268
+ import { useFocus } from 'app-studio';
269
+
270
+ function MyComponent() {
271
+ const { focused } = useFocus();
272
+ return <input style={{ borderColor: focused ? 'blue' : 'gray' }} />;
273
+ }
188
274
  ```
189
275
 
190
- ## 5. Event Management
276
+ ## useHover
277
+
278
+ Detects if an element is being hovered.
279
+
280
+ Return Values
191
281
 
192
- App-Studio provides an intuitive way to manage CSS events through the `on` prop. This feature allows you to style elements based on various interactive states.
282
+ | **Value** | **Type** | **Description** |
283
+ | --- | --- | --- |
284
+ | hovered | boolean | Whether the element is hovered. |
193
285
 
194
- #### Example
286
+ Example
287
+
288
+ jsx
195
289
 
196
290
  ```jsx
197
- <View
198
- backgroundColor="grey"
199
- padding={20}
200
- on={{ hover: { backgroundColor: 'blue.100' } }}
201
- >
202
- Hover over me
203
- </View>
291
+ import { useHover } from 'app-studio';
292
+
293
+ function MyComponent() {
294
+ const { hovered } = useHover();
295
+ return <div style={{ background: hovered ? 'lightgray' : 'white' }}>Hover me</div>;
296
+ }
204
297
  ```
205
298
 
206
- Supported events include `hover`, `active`, `focus`, and `disabled`.
299
+ ## useInView
207
300
 
208
- ## 6. Theming
301
+ Detects if an element is in the viewport.
209
302
 
210
- App-Studio's theming system allows you to maintain a consistent look across your application using the `ThemeProvider` component.
303
+ Return Values
211
304
 
212
- #### Setting up the Theme
305
+ | **Value** | **Type** | **Description** |
306
+ | --- | --- | --- |
307
+ | inView | boolean | Whether the element is in view. |
213
308
 
214
- ```javascript
215
- const theme = {
216
- main: { primary: '#fff7ed' },
217
- components: { button: { background: '#fff7ed' } }
218
- };
309
+ Example
310
+
311
+ jsx
312
+
313
+ ```jsx
314
+ import { useInView } from 'app-studio';
315
+ import { useRef } from 'react';
219
316
 
220
- const colors = {
221
- main: { blue: '#94a3b8' },
222
- palette: {
223
- blueGray: {
224
- 50: '#f8fafc',
225
- // ... other shades
226
- 900: '#0f172a'
227
- }
228
- }
229
- };
317
+ function MyComponent() {
318
+ const ref = useRef();
319
+ const { inView } = useInView(ref);
320
+ return <div ref={ref}>{inView ? 'Visible' : 'Hidden'}</div>;
321
+ }
230
322
  ```
231
323
 
232
- #### Using ThemeProvider
324
+ ## useKeyPress
325
+
326
+ Detects key presses.
327
+
328
+ Parameters
329
+
330
+ | **Param** | **Type** | **Description** |
331
+ | --- | --- | --- |
332
+ | key | string | The key to listen for (e.g., 'Enter'). |
333
+
334
+ Return Values
335
+
336
+ | **Value** | **Type** | **Description** |
337
+ | --- | --- | --- |
338
+ | pressed | boolean | Whether the key is pressed. |
339
+
340
+ Example
341
+
342
+ jsx
233
343
 
234
344
  ```jsx
235
- <ThemeProvider theme={theme} colors={colors}>
236
- <App />
237
- </ThemeProvider>
345
+ import { useKeyPress } from 'app-studio';
346
+
347
+ function MyComponent() {
348
+ const pressed = useKeyPress('Enter');
349
+ return <div>{pressed ? 'Enter pressed' : 'Waiting...'}</div>;
350
+ }
238
351
  ```
239
352
 
240
- #### Applying Theme in Components
353
+ ## useMount
354
+
355
+ Runs a callback when the component mounts.
356
+
357
+ Parameters
358
+
359
+ | **Param** | **Type** | **Description** |
360
+ | --- | --- | --- |
361
+ | callback | function | Called on mount. |
362
+
363
+ Example
364
+
365
+ jsx
241
366
 
242
367
  ```jsx
243
- <View backgroundColor="color.blue">
244
- <Text color="theme.primary">Hello</Text>
245
- <Button backgroundColor="theme.button.background">Click me</Button>
246
- </View>
368
+ import { useMount } from 'app-studio';
369
+
370
+ function MyComponent() {
371
+ useMount(() => console.log('Mounted'));
372
+ return <div>Hello</div>;
373
+ }
247
374
  ```
248
375
 
249
- ## 7. Custom Hooks
376
+ ## useOnScreen
377
+
378
+ Similar to useInView, detects if an element is on screen.
379
+
380
+ Return Values
250
381
 
251
- ### useMount
382
+ | **Value** | **Type** | **Description** |
383
+ | --- | --- | --- |
384
+ | onScreen | boolean | Whether the element is on screen. |
252
385
 
253
- The `useMount` hook executes logic when a component first mounts.
386
+ Example
254
387
 
255
- #### Usage
388
+ jsx
256
389
 
257
390
  ```jsx
258
- import { useMount } from '@your-org/app-studio';
391
+ import { useOnScreen } from 'app-studio';
392
+ import { useRef } from 'react';
393
+
394
+ function MyComponent() {
395
+ const ref = useRef();
396
+ const { onScreen } = useOnScreen(ref);
397
+ return <div ref={ref}>{onScreen ? 'On screen' : 'Off screen'}</div>;
398
+ }
399
+ ```
400
+
401
+ ## useResponsive
402
+
403
+ Provides screen size and orientation data.
404
+
405
+ Return Values
259
406
 
260
- const MyComponent = () => {
261
- useMount(() => {
262
- console.log('MyComponent mounted');
263
- });
407
+ | **Value** | **Type** | **Description** |
408
+ | --- | --- | --- |
409
+ | screen | string | Current screen size (e.g., 'xs', 'sm'). |
410
+ | orientation | `'landscape' | 'portrait'` |
411
+ | on | function | Checks if the screen matches a size. |
264
412
 
265
- return <div>MyComponent</div>;
266
- };
413
+ Example
414
+
415
+ jsx
416
+
417
+ ```jsx
418
+ import { useResponsive } from 'app-studio';
419
+
420
+ function MyComponent() {
421
+ const { screen, orientation, on } = useResponsive();
422
+ return (
423
+ <div>
424
+ Screen: {screen}, Orientation: {orientation}
425
+ {on('mobile') && <div>Mobile view</div>}
426
+ </div>
427
+ );
428
+ }
267
429
  ```
268
430
 
269
- ## 8. Design Props
431
+ ## useScroll
270
432
 
271
- App-Studio provides additional props to better manage design integration in CSS. These props offer more control over the styling of components, including layout, spacing, and sizing.
433
+ Tracks scroll position and direction.
272
434
 
273
- ### Example
435
+ Parameters
436
+
437
+ | **Param** | **Type** | **Default** | **Description** |
438
+ | --- | --- | --- | --- |
439
+ | throttleMs | number | 100 | Throttle updates (in ms). |
440
+
441
+ Return Values
442
+
443
+ | **Value** | **Type** | **Description** |
444
+ | --- | --- | --- |
445
+ | scrollY | number | Vertical scroll position. |
446
+ | scrollX | number | Horizontal scroll position. |
447
+
448
+ Example
449
+
450
+ jsx
274
451
 
275
452
  ```jsx
276
- <View
277
- backgroundColor="theme.primary"
278
- padding={20}
279
- margin={10}
280
- width={200}
281
- height={100}
282
- >
283
- I am a View component with custom styling
284
- </View>
453
+ import { useScroll } from 'app-studio';
454
+
455
+ function MyComponent() {
456
+ const { scrollY } = useScroll({ throttleMs: 200 });
457
+ return <div>Scroll Y: {scrollY}px</div>;
458
+ }
285
459
  ```
286
460
 
287
- ### Shadow Prop
461
+ ## useWindowSize
462
+
463
+ Tracks window dimensions.
464
+
465
+ Return Values
288
466
 
289
- The `shadow` prop is used to manage shadows in CSS. It takes a number or a string as a value, which defines the shadow effect to apply to the component.
467
+ | **Value** | **Type** | **Description** |
468
+ | --- | --- | --- |
469
+ | width | number | Window width. |
470
+ | height | number | Window height. |
471
+
472
+ Example
473
+
474
+ jsx
290
475
 
291
476
  ```jsx
292
- <View
293
- backgroundColor="theme.primary"
294
- padding={20}
295
- shadow={6}
296
- >
297
- I have a shadow
298
- </View>
477
+ import { useWindowSize } from 'app-studio';
478
+
479
+ function MyComponent() {
480
+ const { width, height } = useWindowSize();
481
+ return <div>Window: {width}x{height}</div>;
482
+ }
299
483
  ```
300
484
 
301
- ## 9. Animation
485
+ ---
486
+
487
+ # Providers
488
+
489
+ Providers manage global state and functionality across your application.
490
+
491
+ ## AnalyticsProvider
492
+
493
+ Enables analytics tracking.
302
494
 
303
- App-Studio provides a powerful animation system through the `Animation` object. Animations can be applied to any `Element` or its derivatives using the `animate` prop.
495
+ Props
304
496
 
305
- #### Usage
497
+ | **Prop** | **Type** | **Default** | **Description** |
498
+ | --- | --- | --- | --- |
499
+ | trackEvent | function | - | Callback for tracking events. |
500
+
501
+ Example
502
+
503
+ jsx
306
504
 
307
505
  ```jsx
308
- // Basic animation
309
- <View
310
- animate={Animation.fadeIn({
311
- duration: '1s',
312
- timingFunction: 'ease',
313
- iterationCount: '1'
314
- })}
315
- />
506
+ import { AnalyticsProvider } from 'app-studio';
316
507
 
317
- // Animation sequence
318
- const sequence = [
319
- {
320
- from: { opacity: 0, transform: 'translateY(-100px)' },
321
- to: { opacity: 1, transform: 'translateY(0)' },
322
- duration: '2s',
323
- timingFunction: 'ease-in'
324
- },
325
- {
326
- from: { opacity: 1, transform: 'translateY(100px)' },
327
- to: { opacity: 0, transform: 'translateY(0)' },
328
- duration: '2s',
329
- timingFunction: 'ease-out'
330
- }
331
- ];
332
-
333
- <View animate={sequence} />
334
-
335
- // Animation on hover
336
- <View
337
- on={{
338
- hover: {
339
- animate: Animation.rotate({ duration: '1s', timingFunction: 'ease' })
340
- }
341
- }}
342
- />
508
+ function App() {
509
+ return (
510
+ <AnalyticsProvider
511
+ trackEvent={({ type, target, ...event }) => {
512
+ AppAnalytics.track(`${type}_${target}`, event);
513
+ }}>
514
+ {/* App content */}
515
+ </AnalyticsProvider>
516
+ );
517
+ }
343
518
  ```
344
519
 
345
- #### Available Animations
520
+ ## ResponsiveProvider
346
521
 
347
- All animations are available through the `Animation` object:
348
- - `Animation.fadeIn()`
349
- - `Animation.fadeOut()`
350
- - `Animation.bounce()`
351
- - `Animation.rotate()`
352
- - `Animation.pulse()`
353
- - And many more...
522
+ Manages responsive design context.
354
523
 
355
- ### Basic Usage
524
+ Props
356
525
 
357
- To apply an animation to a component, use the `animate` prop with an animation object:
526
+ | **Prop** | **Type** | **Default** | **Description** |
527
+ | --- | --- | --- | --- |
528
+ | breakpoints | object | - | Custom breakpoints. |
529
+
530
+ Example
531
+
532
+ jsx
358
533
 
359
534
  ```jsx
360
- import { View, Animation } from 'app-studio';
535
+ import { ResponsiveProvider } from 'app-studio';
361
536
 
362
- function Example() {
537
+ function App() {
363
538
  return (
364
- <View
365
- animate={Animation.fadeIn()} // Fades in the view
366
- backgroundColor="theme.primary"
367
- padding={20}
368
- >
369
- This view will fade in
370
- </View>
539
+ <ResponsiveProvider breakpoints={{ xs: 0, sm: 600, md: 960 }}>
540
+ {/* App content */}
541
+ </ResponsiveProvider>
542
+ );
543
+ }
544
+ ```
545
+
546
+ ## ThemeProvider
547
+
548
+ Manages theming, including colors and typography.
549
+
550
+ Props
551
+
552
+ | **Prop** | **Type** | **Default** | **Description** |
553
+ | --- | --- | --- | --- |
554
+ | theme | Theme | - | Custom theme configuration. |
555
+ | mode | `'light' | 'dark'` | 'light' |
556
+ | dark | Colors | - | Dark mode colors. |
557
+ | light | Colors | - | Light mode colors. |
558
+
559
+ Context
560
+
561
+ - getColor: Resolves theme colors.
562
+ - theme: Current theme configuration.
563
+ - themeMode: Current mode.
564
+ - setThemeMode: Switches mode.
565
+
566
+ Example
567
+
568
+ jsx
569
+
570
+ ```jsx
571
+ import { ThemeProvider, useTheme } from 'app-studio';
572
+
573
+ function App() {
574
+ return (
575
+ <ThemeProvider mode="dark">
576
+ <MyComponent />
577
+ </ThemeProvider>
371
578
  );
372
579
  }
580
+
581
+ function MyComponent() {
582
+ const { getColor, themeMode } = useTheme();
583
+ return <div style={{ color: getColor('primary') }}>{themeMode} mode</div>;
584
+ }
585
+ ```
586
+
587
+ ---
588
+
589
+ # Utilities
590
+
591
+ Utilities provide helper functions and constants.
592
+
593
+ Colors
594
+
595
+ Predefined color palettes for theming.
596
+
597
+ Usage
598
+
599
+ jsx
600
+
601
+ ```jsx
602
+ import { useTheme } from 'app-studio';
603
+
604
+ function MyComponent() {
605
+ const { getColor } = useTheme();
606
+ return <div style={{ backgroundColor: getColor('color.blue.500') }} />;
607
+ }
608
+ ```
609
+
610
+ # Constants
611
+
612
+ Common values like breakpoints and sizes.
613
+
614
+ Usage
615
+
616
+ jsx
617
+
618
+ ```jsx
619
+ import { BREAKPOINTS } from 'app-studio/constants';
620
+
621
+ console.log(BREAKPOINTS.sm); // 600
373
622
  ```
374
623
 
375
- ### Available Animations
624
+ ## Theming
376
625
 
377
- App-Studio comes with a set of pre-defined animations that you can use out of the box:
626
+ Customize themes with ThemeProvider. Define light and dark modes and use getColor to access colors.
378
627
 
379
- #### Transition Animations
628
+ Example
380
629
 
381
- - `fadeIn` / `fadeOut`
382
- - `slideInLeft` / `slideInRight` / `slideInUp` / `slideInDown`
383
- - `zoomIn` / `zoomOut`
630
+ jsx
384
631
 
385
- #### Transform Animations
632
+ ```jsx
633
+ <ThemeProvider
634
+ theme={{ primary: '#007bff' }}
635
+ dark={{ background: '#333' }}
636
+ light={{ background: '#fff' }}
637
+ />
638
+ ```
386
639
 
387
- - `rotate`
388
- - `scale`
389
- - `translate`
640
+ ---
390
641
 
391
- #### Effect Animations
642
+ # Responsive Design
392
643
 
393
- - `bounce`
394
- - `pulse`
395
- - `flash`
396
- - `shake`
397
- - `swing`
398
- - `rubberBand`
399
- - `wobble`
400
- - `flip`
401
- - `heartBeat`
402
- - `rollIn` / `rollOut`
403
- - `lightSpeedIn` / `lightSpeedOut`
404
- - `hinge`
405
- - `jackInTheBox`
644
+ Use ResponsiveProvider and useResponsive to adapt to screen sizes.
406
645
 
407
- Each animation function accepts parameters to customize the duration, timing function, and other properties.
646
+ Example
408
647
 
409
- #### Animation Properties
648
+ jsx
410
649
 
411
- Each animation function accepts an object with the following properties:
650
+ ```jsx
651
+ const { on } = useResponsive();
652
+ return on('sm') ? <SmallLayout /> : <LargeLayout />;
653
+ ```
412
654
 
413
- - `duration`: Length of the animation (e.g., '1s', '500ms')
414
- - `timingFunction`: CSS timing function (e.g., 'ease', 'linear', 'ease-in-out')
415
- - `iterationCount`: Number of times to play the animation (number or 'infinite') // e.g., '1', 'infinite'
655
+ ---
656
+
657
+ ## Analytics
658
+
659
+ Integrate analytics with AnalyticsProvider to track events.
416
660
 
417
- ## 10. Advanced Usage
661
+ Example
418
662
 
419
- Here's an advanced example showcasing various features of App-Studio, including animations:
663
+ jsx
420
664
 
421
665
  ```jsx
422
- import { ThemeProvider, ResponsiveProvider, View, Span, Text, Button, Animation } from 'app-studio';
666
+ <AnalyticsProvider config={{ provider: 'google', trackingId: 'UA-123' }} />
667
+ ```
668
+
669
+ ---
423
670
 
424
- const theme = {
425
- main: { primary: '#fff7ed' },
426
- components: { button: { background: '#fff7ed' } }
427
- };
671
+ API Reference
428
672
 
429
- const colors = {
430
- main: { blue: '#94a3b8' },
431
- palette: { blueGray: { 500: '#64748b' } }
432
- };
673
+ - Components: View, Image, Text, Form, Skeleton, Wrapper
674
+ - Hooks: useActive, useClickOutside, etc.
675
+ - Providers: AnalyticsProvider, ResponsiveProvider, ThemeProvider
676
+ - Utilities: colors, constants, etc.
433
677
 
434
- function Example() {
678
+ ---
679
+
680
+ Examples
681
+
682
+ ## Responsive Layout
683
+
684
+ jsx
685
+
686
+ ```jsx
687
+ import { View, useResponsive } from 'app-studio';
688
+
689
+ function Layout() {
690
+ const { on } = useResponsive();
435
691
  return (
436
- <ResponsiveProvider>
437
- <ThemeProvider theme={theme} colors={colors}>
438
- <Span
439
- animate={Animation.fadeIn({duration: '1s',timingFunction:'ease-out'})}
440
- backgroundColor="color.blue"
441
- padding={10}
442
- media={{
443
- mobile: {
444
- padding: 20
445
- }
446
- }}
447
- >
448
- Base element
449
- </Span>
450
- <View
451
- animate={Animation.slideInRight()}
452
- backgroundColor="theme.primary"
453
- margin={10}
454
- width={200}
455
- on={{ hover: { backgroundColor: 'color.blueGray.500' } }}
456
- >
457
- Hover to change color
458
- </View>
459
- <Button
460
- animate={Animation.pulse({timingFunction:'infinite'})}
461
- backgroundColor="theme.button.background"
462
- >
463
- Click here
464
- </Button>
465
- <Text
466
- animate={Animation.typewriter('Hello', 100)}
467
- color="theme.primary"
468
- />
469
- </ThemeProvider>
470
- </ResponsiveProvider>
692
+ <View flexDirection={on('mobile') ? 'column' : 'row'}>
693
+ <View>Sidebar</View>
694
+ <View>Main Content</View>
695
+ </View>
471
696
  );
472
697
  }
473
698
  ```
474
699
 
475
- ## 11. Contributing
476
-
477
- We welcome all contributions to App-Studio. Please read our [contributing guide](https://ant.design/docs/react/contributing) and let's build a better App-Studio together.
700
+ ---
478
701
 
479
- For more detailed information on contributing, including how to apply for being a collaborator, please refer to our [GitHub repository](https://github.com/rize-network/app-studio).
702
+ Contributing
480
703
 
481
- ## 12. License
704
+ Contributions are welcome! Please follow these steps:
482
705
 
483
- App-Studio is available under the MIT license. See the LICENSE file for more info.
706
+ 1. Fork the repository.
707
+ 2. Create a feature branch.
708
+ 3. Submit a pull request with tests.
484
709
 
485
710
  ---
486
711
 
487
- For the latest updates, changelog, and more detailed information, please visit our [GitHub repository](https://github.com/rize-network/app-studio).
712
+ Changelog
713
+
714
+ - v1.0.0: Initial release with components, hooks, and providers.