app-studio 0.4.6 → 0.5.0

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,94 +1,218 @@
1
- # App Studio
1
+ # App-Studio Documentation
2
+
3
+ ## Table of Contents
4
+ - [App-Studio Documentation](#app-studio-documentation)
5
+ - [Table of Contents](#table-of-contents)
6
+ - [1. Introduction](#1-introduction)
7
+ - [Features](#features)
8
+ - [2. Installation](#2-installation)
9
+ - [3. Core Components](#3-core-components)
10
+ - [Element](#element)
11
+ - [Usage](#usage)
12
+ - [Key Properties](#key-properties)
13
+ - [View](#view)
14
+ - [Usage](#usage-1)
15
+ - [Text](#text)
16
+ - [Usage](#usage-2)
17
+ - [Form](#form)
18
+ - [Usage](#usage-3)
19
+ - [Image](#image)
20
+ - [Usage](#usage-4)
21
+ - [4. Responsive Design](#4-responsive-design)
22
+ - [Media Prop](#media-prop)
23
+ - [Example](#example)
24
+ - [useResponsive Hook](#useresponsive-hook)
25
+ - [Example](#example-1)
26
+ - [5. Event Management](#5-event-management)
27
+ - [Example](#example-2)
28
+ - [6. Theming](#6-theming)
29
+ - [Setting up the Theme](#setting-up-the-theme)
30
+ - [Using ThemeProvider](#using-themeprovider)
31
+ - [Applying Theme in Components](#applying-theme-in-components)
32
+ - [7. Custom Hooks](#7-custom-hooks)
33
+ - [useMount](#usemount)
34
+ - [Usage](#usage-5)
35
+ - [8. Design Props](#8-design-props)
36
+ - [Example](#example-3)
37
+ - [Shadow Prop](#shadow-prop)
38
+ - [9. Animations](#9-animations)
39
+ - [Basic Usage](#basic-usage)
40
+ - [Available Animations](#available-animations)
41
+ - [Customizing Animations](#customizing-animations)
42
+ - [Creating Custom Animations](#creating-custom-animations)
43
+ - [Combining Animations](#combining-animations)
44
+ - [Animation Events](#animation-events)
45
+ - [10. Advanced Usage](#10-advanced-usage)
46
+ - [10. Contributing](#10-contributing)
47
+ - [11. License](#11-license)
48
+
49
+ ## 1. Introduction
50
+
51
+ 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.
52
+
53
+ ### Features
54
+
55
+ - 🌈 Add styled props to your application
56
+ - 📦 A set of simple and powerful React components
57
+ - 🌍 Internationalization support for dozens of languages
58
+ - 🎨 Powerful theme customization in every detail
59
+
60
+ ## 2. Installation
61
+
62
+ To install App-Studio, run the following command:
2
63
 
3
- [![npm version](https://img.shields.io/npm/v/app-studio.svg?style=for-the-badge)](https://www.npmjs.com/package/app-studio)
4
- [![npm](https://img.shields.io/npm/dt/app-studio.svg?style=for-the-badge)](https://www.npmjs.com/package/app-studio)
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)
6
- [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg?style=for-the-badge)](https://github.com/prettier/prettier)
64
+ ```bash
65
+ npm install app-studio --save
66
+ ```
7
67
 
68
+ ## 3. Core Components
8
69
 
9
- [npm-image]: http://img.shields.io/npm/v/app-studio.svg?style=flat-square
10
- [npm-url]: http://npmjs.org/package/app-studio
11
- [github-action-image]: https://github.com/rize-network/app-studio/workflows/%E2%9C%85%20test/badge.svg
12
- [github-action-url]: https://github.com/rize-network/app-studio/actions?query=workflow%3A%22%E2%9C%85+test%22
70
+ ### Element
13
71
 
14
- [download-image]: https://img.shields.io/npm/dm/app-studio.svg?style=flat-square
15
- [download-url]: https://npmjs.org/package/app-studio
72
+ The `Element` component is the foundation of App-Studio. It handles a large part of the styling for other components, including responsiveness, shadow, margins, and padding.
16
73
 
17
- [help-wanted-image]: https://flat.badgen.net/github/label-issues/rize-network/app-studio/help%20wanted/open
18
- [help-wanted-url]: https://github.com/rize-network/app-studio/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22
74
+ #### Usage
75
+
76
+ ```jsx
77
+ <Element backgroundColor="color.blue" padding={10}>
78
+ This is an element
79
+ </Element>
80
+ ```
19
81
 
20
- [discussions-image]: https://img.shields.io/badge/discussions-on%20github-blue?style=flat-square
21
- [discussions-url]: https://github.com/rize-network/app-studio/discussions
82
+ #### Key Properties
22
83
 
23
- [issues-helper-image]: https://img.shields.io/badge/using-issues--helper-orange?style=flat-square
24
- [issues-helper-url]: https://github.com/actions-cool/issues-helper
84
+ - `size`: Sets equal width and height
85
+ - `on`: Defines styles for different CSS events
86
+ - `media`: Defines styles for different media queries
87
+ - `shadow`: Adds shadow to an element (boolean, number, or `Shadow` object)
25
88
 
89
+ ### View
26
90
 
91
+ The `View` component is a versatile layout component that extends the basic HTML `div` tag with additional styling properties.
27
92
 
28
- `App-studio` provides CSS design props for layout, spacing, sizing, shadows with the 'shadow' prop, event management through the `on` prop, and theming. Components include `Element` for fundamental design, `View` based on the `div`, `Text` for text styles, `Form` for form-related designs, and `Image` based on the `img` tag.
93
+ #### Usage
29
94
 
30
- Supported events: `hover`, `active`, `focus`, and `disabled`.
95
+ ```jsx
96
+ <View backgroundColor="color.red" color="color.white" padding={20}>
97
+ This is a view
98
+ </View>
99
+ ```
31
100
 
32
- ## ✨ Features
101
+ ### Text
33
102
 
34
- - 🌈 Add styled props to your application.
35
- - 📦 A set of Simple and powerful React components.
36
- - 🌍 Internationalization support for dozens of languages.
37
- - 🎨 Powerful theme customization in every detail.
103
+ The `Text` component extends the HTML `div` tag with additional text styling properties.
38
104
 
39
- ## 📦 Install
105
+ #### Usage
40
106
 
41
- ```bash
42
- npm install app-studio --save
107
+ ```jsx
108
+ <Text color="color.blue">This is a text</Text>
43
109
  ```
44
110
 
45
- ## 🔨 Usage
111
+ ### Form
46
112
 
47
- The `<View>` component supports all of the default [CSSProperties](https://developer.mozilla.org/fr/docs/Web/CSS/CSS_Properties_Reference) as props. The styles are transformed.
113
+ The `Form` component extends the HTML `form` tag and provides `Button` and `Input` subcomponents.
48
114
 
49
- 1. Add Responsive and Theme Provider to your application root:
115
+ #### Usage
50
116
 
51
117
  ```jsx
52
- import React from 'react';
53
- import { ResponsiveProvider, ThemeProvider } from 'app-studio';
118
+ <Form>
119
+ <Input placeholder="Enter your name" />
120
+ <Button>Submit</Button>
121
+ </Form>
122
+ ```
54
123
 
55
- const Root = () => {
56
- return (
57
- <ResponsiveProvider>
58
- <ThemeProvider>
59
- <App />
60
- </ThemeProvider>
61
- </ResponsiveProvider>
62
- );
63
- };
124
+ ### Image
125
+
126
+ The `Image` component extends the HTML `img` tag with additional properties like `shadow`, `media`, and `on`.
127
+
128
+ #### Usage
129
+
130
+ ```jsx
131
+ <Image src="url_to_image" alt="description" />
64
132
  ```
65
133
 
66
- 2. Use components in your application:
134
+ ## 4. Responsive Design
135
+
136
+ App-Studio offers two primary methods for implementing responsive design: the `media` prop and the `useResponsive` hook.
137
+
138
+ ### Media Prop
139
+
140
+ The `media` prop allows you to specify different styles for various devices or screen sizes without causing component re-renders.
141
+
142
+ #### Example
67
143
 
68
144
  ```jsx
69
- import React from 'react';
70
- import { View } from 'app-studio';
145
+ <View size={100}
146
+ media={{
147
+ mobile: { backgroundColor: 'color.green' },
148
+ tablet: { backgroundColor: 'color.yellow' },
149
+ xl: { backgroundColor: 'color.blue' },
150
+ }}
151
+ />
152
+ ```
71
153
 
72
- function Example() {
73
- return (
74
- <View
75
- backgroundColor="color.grey"
76
- padding={20}
77
- on={{ hover: { backgroundColor: 'color.blue.100' } }}
78
- >
79
- Hello
80
- </View>
81
- );
82
- }
154
+ ### useResponsive Hook
155
+
156
+ The `useResponsive` hook provides information about the current screen size and device type based on defined breakpoints and devices.
157
+
158
+ #### Example
159
+
160
+ ```jsx
161
+ const { screen, on } = useResponsive();
162
+
163
+ return (
164
+ <View size={100} backgroundColor={responsive[screen]}>
165
+ {screen} - mobile: {on('mobile') ? 'yes' : 'no'}
166
+ </View>
167
+ );
83
168
  ```
84
169
 
85
- You can use View for a `<div>` tag. You can also use Div, Span, Form, Input, and Image components if you need another tag.
170
+ To use these responsive features, wrap your app with `ResponsiveProvider`:
86
171
 
87
- ## Advanced Example
172
+ ```jsx
173
+ <ResponsiveProvider
174
+ breakpoints={{
175
+ xs: 0,
176
+ sm: 340,
177
+ md: 560,
178
+ lg: 1080,
179
+ xl: 1300,
180
+ }}
181
+ devices={{
182
+ mobile: ['xs', 'sm'],
183
+ tablet: ['md', 'lg'],
184
+ desktop: ['lg', 'xl']
185
+ }}
186
+ >
187
+ <App />
188
+ </ResponsiveProvider>
189
+ ```
190
+
191
+ ## 5. Event Management
192
+
193
+ 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.
194
+
195
+ #### Example
88
196
 
89
197
  ```jsx
90
- import { ThemeProvider, ResponsiveProvider, View, Span, Text, Button } from 'app-studio';
198
+ <View
199
+ backgroundColor="grey"
200
+ padding={20}
201
+ on={{ hover: { backgroundColor: 'blue.100' } }}
202
+ >
203
+ Hover over me
204
+ </View>
205
+ ```
206
+
207
+ Supported events include `hover`, `active`, `focus`, and `disabled`.
208
+
209
+ ## 6. Theming
91
210
 
211
+ App-Studio's theming system allows you to maintain a consistent look across your application using the `ThemeProvider` component.
212
+
213
+ #### Setting up the Theme
214
+
215
+ ```javascript
92
216
  const theme = {
93
217
  main: { primary: '#fff7ed' },
94
218
  components: { button: { background: '#fff7ed' } }
@@ -96,86 +220,274 @@ const theme = {
96
220
 
97
221
  const colors = {
98
222
  main: { blue: '#94a3b8' },
99
- palette: { blueGray: { 500: '#64748b' } }
223
+ palette: {
224
+ blueGray: {
225
+ 50: '#f8fafc',
226
+ // ... other shades
227
+ 900: '#0f172a'
228
+ }
229
+ }
230
+ };
231
+ ```
232
+
233
+ #### Using ThemeProvider
234
+
235
+ ```jsx
236
+ <ThemeProvider theme={theme} colors={colors}>
237
+ <App />
238
+ </ThemeProvider>
239
+ ```
240
+
241
+ #### Applying Theme in Components
242
+
243
+ ```jsx
244
+ <View backgroundColor="color.blue">
245
+ <Text color="theme.primary">Hello</Text>
246
+ <Button backgroundColor="theme.button.background">Click me</Button>
247
+ </View>
248
+ ```
249
+
250
+ ## 7. Custom Hooks
251
+
252
+ ### useMount
253
+
254
+ The `useMount` hook executes logic when a component first mounts.
255
+
256
+ #### Usage
257
+
258
+ ```jsx
259
+ import { useMount } from '@your-org/app-studio';
260
+
261
+ const MyComponent = () => {
262
+ useMount(() => {
263
+ console.log('MyComponent mounted');
264
+ });
265
+
266
+ return <div>MyComponent</div>;
100
267
  };
268
+ ```
269
+
270
+ ## 8. Design Props
271
+
272
+ 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.
273
+
274
+ ### Example
275
+
276
+ ```jsx
277
+ <View
278
+ backgroundColor="theme.primary"
279
+ padding={20}
280
+ margin={10}
281
+ width={200}
282
+ height={100}
283
+ >
284
+ I am a View component with custom styling
285
+ </View>
286
+ ```
287
+
288
+ ### Shadow Prop
289
+
290
+ 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.
291
+
292
+ ```jsx
293
+ <View
294
+ backgroundColor="theme.primary"
295
+ padding={20}
296
+ shadow={6}
297
+ >
298
+ I have a shadow
299
+ </View>
300
+ ```
301
+
302
+ ## 9. Animations
303
+
304
+ App-Studio provides a powerful and flexible animation system that allows you to easily add dynamic effects to your components. The animation system is based on CSS animations and can be applied using the `animate` prop.
305
+
306
+ ### Basic Usage
307
+
308
+ To apply an animation to a component, use the `animate` prop with an animation object:
309
+
310
+ ```jsx
311
+ import { View, Animation } from 'app-studio';
101
312
 
102
313
  function Example() {
103
314
  return (
104
- <ResponsiveProvider>
105
- <ThemeProvider theme={theme} colors={colors}>
106
- <Span
107
- backgroundColor="color.blue"
108
- padding={10}
109
- media={{
110
- mobile: {
111
- padding: 20
112
- }
113
- }}
114
- >
115
- Base element
116
- </Span>
117
- <View
118
- backgroundColor="theme.primary"
119
- margin={10}
120
- width={200}
121
- on={{ hover: { backgroundColor: 'color.blueGray.500' } }}
122
- >
123
- Hover to change color
124
- </View>
125
- <Button backgroundColor="theme.button.background">Click here</Button>
126
- <Text color="theme.primary">Hello</Text>
127
- </ThemeProvider>
128
- </ResponsiveProvider>
315
+ <View
316
+ animate={Animation.fadeIn()}
317
+ backgroundColor="theme.primary"
318
+ padding={20}
319
+ >
320
+ This view will fade in
321
+ </View>
129
322
  );
130
323
  }
131
324
  ```
132
325
 
133
- ## Transform JavaScript/TypeScript JSX
326
+ ### Available Animations
134
327
 
135
- To transform your existing JavaScript/TypeScript JSX code to use App-Studio:
328
+ App-Studio comes with a set of pre-defined animations that you can use out of the box:
136
329
 
137
- 1. Install the codemod tool:
330
+ - `fadeIn` / `fadeOut`
331
+ - `slideInLeft` / `slideInRight` / `slideInUp` / `slideInDown`
332
+ - `zoomIn` / `zoomOut`
333
+ - `bounce`
334
+ - `rotate`
335
+ - `pulse`
336
+ - `flash`
337
+ - `shake`
338
+ - `swing`
339
+ - `rubberBand`
340
+ - `wobble`
341
+ - `flip`
342
+ - `heartBeat`
343
+ - `rollIn` / `rollOut`
344
+ - `lightSpeedIn` / `lightSpeedOut`
345
+ - `hinge`
346
+ - `jackInTheBox`
138
347
 
139
- ```bash
140
- npm install -g @app-studio/codemod
348
+ Each animation function accepts parameters to customize the duration, timing function, and other properties.
349
+
350
+ ### Customizing Animations
351
+
352
+ You can customize animations by passing parameters to the animation functions:
353
+
354
+ ```jsx
355
+ <View
356
+ animate={Animation.fadeIn('2s', 'ease-in-out')}
357
+ backgroundColor="theme.primary"
358
+ padding={20}
359
+ >
360
+ This view will fade in slowly
361
+ </View>
141
362
  ```
142
363
 
143
- 2. Run the transformation:
364
+ ### Creating Custom Animations
144
365
 
145
- ```bash
146
- app-studio-codemod to-app-studio <path_to_your_js_or_tsx_files> --assetsDir=src/assets --assetsUrl=/assets
366
+ You can also create custom animations by defining your own keyframes:
367
+
368
+ ```jsx
369
+ const customAnimation = {
370
+ from: { opacity: 0, transform: 'translateY(-50px)' },
371
+ to: { opacity: 1, transform: 'translateY(0)' },
372
+ duration: '1s',
373
+ timingFunction: 'ease-out'
374
+ };
375
+
376
+ <View
377
+ animate={customAnimation}
378
+ backgroundColor="theme.primary"
379
+ padding={20}
380
+ >
381
+ This view will have a custom animation
382
+ </View>
383
+ ```
384
+
385
+ ### Combining Animations
386
+
387
+ You can combine multiple animations by using the `Animation.compose` function:
388
+
389
+ ```jsx
390
+ const combinedAnimation = Animation.compose(
391
+ Animation.fadeIn(),
392
+ Animation.slideInUp()
393
+ );
394
+
395
+ <View
396
+ animate={combinedAnimation}
397
+ backgroundColor="theme.primary"
398
+ padding={20}
399
+ >
400
+ This view will fade in and slide up simultaneously
401
+ </View>
147
402
  ```
148
403
 
149
- Replace `<path_to_your_js_or_tsx_files>` with the actual path to your JavaScript/TypeScript files.
404
+ ### Animation Events
150
405
 
151
- ## 🔗 Links
152
- - [Change Log](CHANGELOG.md)
153
- - [Versioning Release Note](https://github.com/rize-network/app-studio/wiki/)
154
- - [How to Apply for Being A Collaborator](https://github.com/rize-network/app-studio/wiki/Collaborators#how-to-apply-for-being-a-collaborator)
406
+ You can also listen to animation events using the `onAnimationStart`, `onAnimationEnd`, and `onAnimationIteration` props:
155
407
 
156
- ## 🤝 Contributing [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
408
+ ```jsx
409
+ <View
410
+ animate={Animation.bounce()}
411
+ onAnimationStart={() => console.log('Animation started')}
412
+ onAnimationEnd={() => console.log('Animation ended')}
413
+ backgroundColor="theme.primary"
414
+ padding={20}
415
+ >
416
+ This view will bounce
417
+ </View>
418
+ ```
157
419
 
158
- Read our [contributing guide](https://ant.design/docs/react/contributing) and let's build a better rize-network together.
420
+ By leveraging these animation capabilities, you can create rich, interactive user interfaces with App-Studio.
159
421
 
160
- We welcome all contributions. Please read our [CONTRIBUTING.md](https://github.com/rize-network/app-studio/blob/master/.github/CONTRIBUTING.md) first. You can submit any ideas as [pull requests](https://github.com/rize-network/app-studio/pulls) or as [GitHub issues](https://github.com/rize-network/app-studio/issues). If you'd like to improve code, check out the [Development Instructions](https://github.com/rize-network/app-studio/wiki/Development) and have a good time! :)
422
+ ## 10. Advanced Usage
161
423
 
162
- If you are a collaborator, please follow our [Pull Request principle](https://github.com/rize-network/app-studio/wiki/PR-principle) to create a Pull Request with [collaborator template](https://github.com/rize-network/app-studio/compare?expand=1&template=collaborator.md).
424
+ Here's an advanced example showcasing various features of App-Studio, including animations:
425
+
426
+ ```jsx
427
+ import { ThemeProvider, ResponsiveProvider, View, Span, Text, Button, Animation } from 'app-studio';
428
+
429
+ const theme = {
430
+ main: { primary: '#fff7ed' },
431
+ components: { button: { background: '#fff7ed' } }
432
+ };
433
+
434
+ const colors = {
435
+ main: { blue: '#94a3b8' },
436
+ palette: { blueGray: { 500: '#64748b' } }
437
+ };
163
438
 
164
- [![Let's fund issues in this repository](https://issuehunt.io/static/embed/issuehunt-button-v1.svg)](https://issuehunt.io/o/rize-network)
439
+ function Example() {
440
+ return (
441
+ <ResponsiveProvider>
442
+ <ThemeProvider theme={theme} colors={colors}>
443
+ <Span
444
+ animate={Animation.fadeIn('1s', 'ease-out')}
445
+ backgroundColor="color.blue"
446
+ padding={10}
447
+ media={{
448
+ mobile: {
449
+ padding: 20
450
+ }
451
+ }}
452
+ >
453
+ Base element
454
+ </Span>
455
+ <View
456
+ animate={Animation.slideInRight()}
457
+ backgroundColor="theme.primary"
458
+ margin={10}
459
+ width={200}
460
+ on={{ hover: { backgroundColor: 'color.blueGray.500' } }}
461
+ >
462
+ Hover to change color
463
+ </View>
464
+ <Button
465
+ animate={Animation.pulse('infinite')}
466
+ backgroundColor="theme.button.background"
467
+ >
468
+ Click here
469
+ </Button>
470
+ <Text
471
+ animate={Animation.typewriter('Hello', 100)}
472
+ color="theme.primary"
473
+ />
474
+ </ThemeProvider>
475
+ </ResponsiveProvider>
476
+ );
477
+ }
478
+ ```
165
479
 
166
- ## Roadmap
167
480
 
168
- - Integrate React Native
481
+ ## 10. Contributing
169
482
 
170
- ## Author
483
+ 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.
171
484
 
172
- SteedMonteiro, steed@rize.network
485
+ 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).
173
486
 
174
- ## ❤️ Sponsors and Backers [![](https://opencollective.com/rize/tiers/sponsors/badge.svg?label=Sponsors&color=brightgreen)](https://opencollective.com/rize#support) [![](https://opencollective.com/rize/tiers/backers/badge.svg?label=Backers&color=brightgreen)](https://opencollective.com/rize#support)
487
+ ## 11. License
175
488
 
176
- [![](https://opencollective.com/rize/tiers/sponsors.svg?avatarHeight=36)](https://opencollective.com/rize#support)
177
- [![](https://opencollective.com/rize/tiers/backers.svg?avatarHeight=36)](https://opencollective.com/rize#support)
489
+ App-Studio is available under the MIT license. See the LICENSE file for more info.
178
490
 
179
- ## License
491
+ ---
180
492
 
181
- App Studio is available under the MIT license. See the LICENSE file for more info.
493
+ For the latest updates, changelog, and more detailed information, please visit our [GitHub repository](https://github.com/rize-network/app-studio).