@ea-lab/reactive-json 0.0.0 → 0.0.2
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 +70 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,18 +7,73 @@ This lib lessens the need to write JS code for building frontend apps.
|
|
|
7
7
|
With *reactive-json*, build your apps and forms frontend, embed them into your websites,
|
|
8
8
|
and make them interactive with your backend.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
TODO: make and insert a descriptive image.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## How to use *reactive-json*
|
|
13
13
|
|
|
14
14
|
The library can be:
|
|
15
15
|
|
|
16
|
-
- included in your React project: use the provided `<ReactiveJsonRoot>` component
|
|
17
|
-
in your React app. This is the way to go if you want to use reactive-json plugins.
|
|
18
16
|
- used as a standalone lib: simply load the dist files in your web page
|
|
19
17
|
and it will work on the `<reactive-json>` HTML tags.
|
|
18
|
+
- included in your React project: use the provided `<ReactiveJsonRoot>` component
|
|
19
|
+
in your React app. This is the way to go if you want to use reactive-json plugins.
|
|
20
|
+
|
|
21
|
+
If you retrieved the source code of *reactive-json*, a demo app is available for use.
|
|
22
|
+
|
|
23
|
+
```shell
|
|
24
|
+
npm run dev
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## How to install *reactive-json*
|
|
28
|
+
|
|
29
|
+
### Standalone mode
|
|
30
|
+
|
|
31
|
+
This mode only needs you to download the `/dist` folder and load the JS and CSS assets
|
|
32
|
+
in your web pages.
|
|
33
|
+
|
|
34
|
+
If the `/dist` is not available (probably because you pulled the library from
|
|
35
|
+
the source code repository), you will have to generate it:
|
|
36
|
+
|
|
37
|
+
```shell
|
|
38
|
+
npm install && npm run build
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Library mode
|
|
42
|
+
|
|
43
|
+
This mode is when you have a React project, and you want to include *reactive-json*
|
|
44
|
+
as a part of your project.
|
|
20
45
|
|
|
21
|
-
|
|
46
|
+
First, install the lib:
|
|
47
|
+
|
|
48
|
+
```shell
|
|
49
|
+
npm install @ea-lab/reactive-json
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
And that's all!
|
|
53
|
+
|
|
54
|
+
You will have to use the `<ReactiveJsonRoot>` component, with the appropriate
|
|
55
|
+
options.
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
import {ReactiveJsonRoot} from "@ea-lab/reactive-json";
|
|
59
|
+
|
|
60
|
+
//...
|
|
61
|
+
|
|
62
|
+
const YourComponent = () => {
|
|
63
|
+
return (
|
|
64
|
+
<div>
|
|
65
|
+
<ReactiveJsonRoot dataUrl={"/path/to/build.json"}/>
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## How to extend *reactive-json*
|
|
72
|
+
|
|
73
|
+
To add new components, you must be in library mode. Indeed, the
|
|
74
|
+
standalone mode is a fixed set of functionality. This can be changed later if
|
|
75
|
+
a plugin system can be implemented; do not hesitate to contribute in this
|
|
76
|
+
project if you know how to make it, it would be really appreciated!
|
|
22
77
|
|
|
23
78
|
## Project structure
|
|
24
79
|
|
|
@@ -28,13 +83,14 @@ The following is the specific documentation for the *reactive-json* project.
|
|
|
28
83
|
|
|
29
84
|
### Components `/lib/component`
|
|
30
85
|
|
|
31
|
-
This is where the
|
|
86
|
+
This is where the main component code is located.
|
|
32
87
|
|
|
33
88
|
We provided a basic set of components that people will mostly need.
|
|
34
89
|
Those components usually wrap around famous third-party libs such as
|
|
35
90
|
*React-Bootstrap* and *Chart.js*.
|
|
36
91
|
|
|
37
|
-
Of course, you can add your own components
|
|
92
|
+
Of course, you can add your own components in your React project,
|
|
93
|
+
by following the same pattern.
|
|
38
94
|
|
|
39
95
|
#### Actions `/lib/component/action`
|
|
40
96
|
|
|
@@ -71,13 +127,17 @@ Generic reusable code.
|
|
|
71
127
|
|
|
72
128
|
Contains the core functionality of *reactive-json*.
|
|
73
129
|
|
|
74
|
-
This is where `ReactiveJsonRoot.jsx
|
|
75
|
-
|
|
76
|
-
(* the main entrypoint component of *reactive-json*.)
|
|
130
|
+
This is where `ReactiveJsonRoot.jsx` is.
|
|
77
131
|
|
|
78
132
|
Usually, you won't need to edit its content. (But feel free to inspect it if you
|
|
79
133
|
want to contribute!)
|
|
80
134
|
|
|
135
|
+
### Public files `public`
|
|
136
|
+
|
|
137
|
+
This directory contains files for the demo app.
|
|
138
|
+
|
|
139
|
+
This directory is not included in the build.
|
|
140
|
+
|
|
81
141
|
### Demo app `src`
|
|
82
142
|
|
|
83
143
|
All the demo app related code is here. This code is not included in the build.
|