cradova 1.0.7 → 1.0.9
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 +144 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Cradova
|
|
2
2
|
|
|
3
|
+
<center>
|
|
4
|
+
<img src="cradova.png" width="100px">
|
|
5
|
+
|
|
6
|
+
Cradova is a JavaScript framework for building Single Page Applications and PWAs.
|
|
7
|
+
|
|
8
|
+
</center>
|
|
9
|
+
<br>
|
|
3
10
|
<p>
|
|
4
11
|
<a href="https://www.npmjs.com/package/cradova">
|
|
5
12
|
<img src="https://img.shields.io/npm/v/cradova.svg" alt="npm Version" />
|
|
@@ -17,68 +24,177 @@
|
|
|
17
24
|
<a href="https://opencollective.com/cradova">
|
|
18
25
|
<img src="https://img.shields.io/opencollective/all/cradova.svg?colorB=brightgreen" alt="Donate at OpenCollective">
|
|
19
26
|
</a>
|
|
27
|
+
|
|
20
28
|
</p>
|
|
21
29
|
|
|
30
|
+
[](https://github.com/cradova/cradova.js/blob/next/contributing.md)
|
|
31
|
+
|
|
32
|
+
<br>
|
|
33
|
+
<br>
|
|
34
|
+
|
|
35
|
+
## Contents
|
|
36
|
+
|
|
22
37
|
- [What is cradova.js?](#what-is-cradova?)
|
|
38
|
+
- [Why we built cradova?](#the-?)
|
|
23
39
|
- [Installation](#installation)
|
|
40
|
+
- [Examples](#examples)
|
|
24
41
|
- [Documentation](#documentation)
|
|
25
42
|
- [Getting Help](#getting-help)
|
|
26
|
-
- [Contributing](#
|
|
43
|
+
- [Contributing](#contributing)
|
|
27
44
|
|
|
28
45
|
## What is cradova.js?
|
|
29
46
|
|
|
30
47
|
cradova is a JavaScript framework for building Single Page Applications and PWAs.
|
|
31
48
|
|
|
32
|
-
It's small, fast and provides routing and XHR utilities out of the box.
|
|
49
|
+
It's small, fast and provides state management, routing and XHR utilities out of the box.
|
|
33
50
|
|
|
34
51
|
cradova.js supports various versions of IE11, Firefox ESR, and Firefox,
|
|
35
52
|
Edge, Safari, and Chrome. No polyfills required.
|
|
36
53
|
|
|
37
|
-
|
|
54
|
+
# why cradova?
|
|
55
|
+
|
|
56
|
+
Javascript is a powerful language.
|
|
57
|
+
our aim is not to limit what you can achieve but rather make your make them limitless.
|
|
58
|
+
|
|
59
|
+
we made Cradova to give you more power at no cost.
|
|
60
|
+
but extra speed, ease and security.
|
|
61
|
+
|
|
62
|
+
we don't use visual DOM or diff algorithms to manage the DOM, we rather do it the natural way.
|
|
63
|
+
|
|
64
|
+
which is fast and simple, with all the benefits and no abstracts whatsoever.
|
|
65
|
+
|
|
66
|
+
cradova has been used in production and we will update this README to reflect them as ASAP.
|
|
67
|
+
|
|
68
|
+
Happy coding.
|
|
69
|
+
|
|
70
|
+
# Installation
|
|
38
71
|
|
|
39
|
-
### CDN
|
|
72
|
+
### CDN sources
|
|
40
73
|
|
|
41
74
|
```html
|
|
42
|
-
<!--
|
|
43
|
-
|
|
44
|
-
<script src="https://
|
|
75
|
+
<!-- unpkg -->
|
|
76
|
+
|
|
77
|
+
<script src="https://unpkg.com/cradova/dist/module.js"></script>
|
|
78
|
+
|
|
79
|
+
<!-- jsdeliver -->
|
|
80
|
+
|
|
81
|
+
<script src="https://cdn.jsdelivr.net/npm/cradova/dist/module.js"></script>
|
|
45
82
|
```
|
|
46
83
|
|
|
47
84
|
### npm
|
|
48
85
|
|
|
49
86
|
```bash
|
|
50
|
-
npm
|
|
87
|
+
npm i cradova
|
|
51
88
|
```
|
|
52
89
|
|
|
53
|
-
|
|
90
|
+
# Examples
|
|
91
|
+
|
|
92
|
+
Before you confirm these below, please know that they are many cool parts about cradova not described here but will be on a later time.
|
|
93
|
+
|
|
94
|
+
You can get deeper insights from the telegram community for the moment.
|
|
54
95
|
|
|
55
|
-
|
|
96
|
+
Here's an example of create a basic component in cradova:
|
|
56
97
|
|
|
57
|
-
|
|
58
|
-
|
|
98
|
+
```js
|
|
99
|
+
import _, { frag } from "cradova";
|
|
59
100
|
|
|
60
|
-
|
|
61
|
-
|
|
101
|
+
function HelloMessage({ name }) {
|
|
102
|
+
return _("div", "Hello " + name);
|
|
103
|
+
}
|
|
104
|
+
// using frag
|
|
105
|
+
const html = frag(HelloMessage("friday"));
|
|
106
|
+
document.body.append(html);
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## using screen
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
import _, { Screen, Router } from "cradova";
|
|
113
|
+
|
|
114
|
+
function HelloMessage(name) {
|
|
115
|
+
// an effect run once after screen renders
|
|
116
|
+
this.effect(() => {
|
|
117
|
+
return new Promise((res) => {
|
|
118
|
+
res("friday");
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
// effects can be used to make api calls
|
|
122
|
+
// which will rerender this screen when done
|
|
123
|
+
// with the data returned
|
|
124
|
+
return _("div", "Hello" + name);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const home = new Screen({
|
|
128
|
+
name: "home page", // page title
|
|
129
|
+
template: HelloMessage,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
Router.route("/", home);
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
# State management
|
|
136
|
+
|
|
137
|
+
```js
|
|
138
|
+
import _, { dispatch, Ref } from "cradova";
|
|
139
|
+
|
|
140
|
+
function HelloMessage(name) {
|
|
141
|
+
return _("div.foo#bar", {
|
|
142
|
+
stateID: "bar",
|
|
143
|
+
text: "hello ____" + (name || ""),
|
|
144
|
+
onclick() {
|
|
145
|
+
const name = prompt();
|
|
146
|
+
dispatch("bar", { text: "hello " + name });
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const nameRef = new Ref(function (name) {
|
|
152
|
+
const self = this;
|
|
153
|
+
return _("div.foo#bar", {
|
|
154
|
+
text: "hello ____" + (name || ""),
|
|
155
|
+
onclick() {
|
|
156
|
+
const name = prompt();
|
|
157
|
+
self.updateState({ text: "hello " + name });
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
function Home() {
|
|
163
|
+
return _(
|
|
164
|
+
"div",
|
|
165
|
+
{ id: "foo", class: "bar" },
|
|
166
|
+
HelloMessage,
|
|
167
|
+
nameRef.render(null)
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const home = new Screen({
|
|
172
|
+
name: "home page", // page title
|
|
173
|
+
template: Home,
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
Router.route("/", home);
|
|
177
|
+
```
|
|
62
178
|
|
|
63
|
-
|
|
179
|
+
# Documentation
|
|
64
180
|
|
|
65
|
-
|
|
66
|
-
See the section about [running tests](https://fridaycandour.github.io/cradova/docs/running-tests) for more information.
|
|
181
|
+
We are currently working building cradova's documentation and we have only a few hands, if you are interested you can join the community and learn first hand and also support cradova's progress.
|
|
67
182
|
|
|
68
|
-
|
|
183
|
+
# getting help
|
|
69
184
|
|
|
70
|
-
|
|
71
|
-
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
185
|
+
To get help visit our new [telegram community](https://t.me/cradovaframework)
|
|
72
186
|
|
|
73
|
-
|
|
74
|
-
Your app is ready to be deployed!
|
|
187
|
+
# contributing
|
|
75
188
|
|
|
76
|
-
|
|
189
|
+
we are currently working to set up.
|
|
77
190
|
|
|
78
|
-
|
|
191
|
+
- Cradova Documentation Website
|
|
192
|
+
- UI component libraries for cradova
|
|
193
|
+
- Sample projects
|
|
194
|
+
- maintenance and promotion
|
|
79
195
|
|
|
80
|
-
|
|
196
|
+
community [telegram](https://t.me/cradovaframework)
|
|
81
197
|
|
|
82
|
-
|
|
198
|
+
# How to Sponsor
|
|
83
199
|
|
|
84
|
-
|
|
200
|
+
Sponsorships can be done via [OpenCollective](https://opencollective.com/cradova). Invoices can be obtained via GitHub's payment system. Both monthly-recurring sponsorships and one-time donations are accepted. Recurring sponsorships will be entitled to logo placements in Tiers.
|