cradova 1.2.0 → 1.4.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/LICENSE +0 -0
- package/README.md +84 -94
- package/dist/index.d.ts +202 -273
- package/dist/index.js +722 -1018
- package/dist/types.ts +418 -0
- package/package.json +3 -2
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -1,41 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<br>
|
|
10
|
-
<p>
|
|
11
|
-
<a href="https://www.npmjs.com/package/cradova">
|
|
12
|
-
<img src="https://img.shields.io/npm/v/cradova.svg" alt="npm Version" />
|
|
13
|
-
</a>
|
|
14
|
-
<a href="https://github.com/cradova/cradova.js/blob/next/LICENSE">
|
|
15
|
-
<img src="https://img.shields.io/npm/l/cradova.svg" alt="License" />
|
|
16
|
-
</a>
|
|
17
|
-
<a href="https://www.npmjs.com/package/cradova">
|
|
18
|
-
<img src="https://img.shields.io/npm/dm/cradova.svg" alt="npm Downloads">
|
|
19
|
-
</a>
|
|
20
|
-
<a href="https://www.npmjs.com/package/cradova">
|
|
21
|
-
<img src="https://img.shields.io/travis/cradova/cradova.js/next.svg?colorB=brightgreen" alt="Build Status">
|
|
22
|
-
</a>
|
|
23
|
-
|
|
24
|
-
<a href="https://opencollective.com/cradova">
|
|
25
|
-
<img src="https://img.shields.io/opencollective/all/cradova.svg?colorB=brightgreen" alt="Donate at OpenCollective">
|
|
26
|
-
</a>
|
|
27
|
-
|
|
28
|
-
</p>
|
|
29
|
-
|
|
1
|
+
<a><img src="cradova.png" alt="logo" width="80" height="80" align="right"></a>
|
|
2
|
+
|
|
3
|
+
# Cradova.js
|
|
4
|
+
[](https://www.npmjs.com/package/cradova)
|
|
5
|
+
[](https://github.com/cradova/cradova.js/blob/next/LICENSE)
|
|
6
|
+
[](https://www.npmjs.com/package/cradova)
|
|
7
|
+
[](https://www.npmjs.com/package/cradova)
|
|
8
|
+
[](https://opencollective.com/cradova)
|
|
30
9
|
[](https://github.com/cradova/cradova.js/blob/next/contributing.md)
|
|
31
10
|
|
|
32
|
-
<br>
|
|
33
|
-
<br>
|
|
34
11
|
|
|
35
12
|
## Contents
|
|
36
13
|
|
|
37
|
-
- [What is
|
|
38
|
-
- [Why we
|
|
14
|
+
- [What is Cradova](#what-is-cradovajs)
|
|
15
|
+
- [Why did we build Cradova?](#whats-the-benefit)
|
|
39
16
|
- [Installation](#installation)
|
|
40
17
|
- [Examples](#examples)
|
|
41
18
|
- [Documentation](#documentation)
|
|
@@ -44,30 +21,17 @@ Cradova is a JavaScript framework for building Single Page Applications and PWAs
|
|
|
44
21
|
|
|
45
22
|
## What is cradova.js?
|
|
46
23
|
|
|
47
|
-
|
|
24
|
+
Cradova is a JavaScript framework for building Single Page Applications and PWAs.
|
|
48
25
|
|
|
49
26
|
It's small, fast and provides state management, routing and XHR utilities out of the box.
|
|
50
27
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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.
|
|
28
|
+
## What's the benefit?
|
|
29
|
+
We aim to be fast and simple with and no hidden abstractions whatsoever.
|
|
30
|
+
We don't use visual DOM or any diff algorithms to manage the DOM.
|
|
61
31
|
|
|
62
|
-
|
|
32
|
+
Cradova has been used in production and we will update this README to reflect our lessons as we go.
|
|
63
33
|
|
|
64
|
-
|
|
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
|
|
34
|
+
## Installation
|
|
71
35
|
|
|
72
36
|
### CDN sources
|
|
73
37
|
|
|
@@ -87,27 +51,27 @@ Happy coding.
|
|
|
87
51
|
npm i cradova
|
|
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
54
|
|
|
94
|
-
|
|
55
|
+
## Examples
|
|
56
|
+
Many aspects of Cradova are not reflected in the following example. More functionality will be entailed in future docs.
|
|
95
57
|
|
|
96
|
-
Here's an example of create a basic component in
|
|
58
|
+
Here's an example of create a basic component in Cradova:
|
|
97
59
|
|
|
98
60
|
```js
|
|
99
61
|
import _, { frag } from "cradova";
|
|
100
62
|
|
|
101
|
-
function
|
|
102
|
-
return _("
|
|
63
|
+
function Hello(name) {
|
|
64
|
+
return _("h1", "Hello " + name);
|
|
103
65
|
}
|
|
66
|
+
|
|
67
|
+
// calling Hello returns the HTML
|
|
68
|
+
const html = Hello("peter")(); // or
|
|
104
69
|
// using frag
|
|
105
|
-
const html = frag(
|
|
70
|
+
const html = frag(Hello("peter"), Hello("joe"));
|
|
106
71
|
document.body.append(html);
|
|
107
72
|
```
|
|
108
73
|
|
|
109
|
-
##
|
|
110
|
-
|
|
74
|
+
## Using Screen
|
|
111
75
|
```js
|
|
112
76
|
import _, { Screen, Router } from "cradova";
|
|
113
77
|
|
|
@@ -118,83 +82,109 @@ function HelloMessage(name) {
|
|
|
118
82
|
res("friday");
|
|
119
83
|
});
|
|
120
84
|
});
|
|
121
|
-
// effects can be used to make api calls
|
|
122
|
-
|
|
123
|
-
// with the data returned
|
|
124
|
-
return _("div", "Hello" + name);
|
|
85
|
+
// effects can be used to make api calls needed for the page
|
|
86
|
+
return _("div", "Hello " + name);
|
|
125
87
|
}
|
|
126
88
|
|
|
127
89
|
const home = new Screen({
|
|
128
|
-
name: "
|
|
90
|
+
name: "hello page", // page title
|
|
129
91
|
template: HelloMessage,
|
|
92
|
+
...
|
|
130
93
|
});
|
|
131
94
|
|
|
132
95
|
Router.route("/", home);
|
|
96
|
+
|
|
97
|
+
// navigates to that page
|
|
98
|
+
// Router.navigate("/home");
|
|
99
|
+
// get the page ready in the background
|
|
100
|
+
// Router.packageScreen("/home");
|
|
101
|
+
|
|
133
102
|
```
|
|
134
103
|
|
|
135
|
-
|
|
104
|
+
## State management
|
|
136
105
|
|
|
137
106
|
```js
|
|
138
|
-
|
|
107
|
+
// we have
|
|
108
|
+
|
|
109
|
+
// dispatch - global (element) requires state ID
|
|
110
|
+
|
|
111
|
+
// element can have this.updateState when shouldUpdate is true
|
|
112
|
+
|
|
113
|
+
// Ref components (global and local)
|
|
114
|
+
|
|
115
|
+
// state can be managed from a store when using createSignal or simpleStores
|
|
116
|
+
|
|
117
|
+
import _, { Ref } from "cradova";
|
|
118
|
+
|
|
119
|
+
// simple count
|
|
120
|
+
|
|
121
|
+
function counter() {
|
|
122
|
+
let num = 0;
|
|
123
|
+
return _("h1| 0", {
|
|
124
|
+
shouldUpdate: true,
|
|
125
|
+
onclick() {
|
|
126
|
+
num++;
|
|
127
|
+
this.updateState({ text: num });
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
}
|
|
139
131
|
|
|
140
132
|
function HelloMessage(name) {
|
|
141
133
|
return _("div.foo#bar", {
|
|
142
|
-
|
|
143
|
-
text: "hello
|
|
134
|
+
shouldUpdate: true,
|
|
135
|
+
text: "hello " + (name || "no name"),
|
|
144
136
|
onclick() {
|
|
145
|
-
const name = prompt();
|
|
146
|
-
|
|
137
|
+
const name = prompt("what are your names");
|
|
138
|
+
this.updateState({ text: "hello " + name });
|
|
147
139
|
},
|
|
148
140
|
});
|
|
149
141
|
}
|
|
150
142
|
|
|
151
|
-
const nameRef = new Ref(function (name) {
|
|
143
|
+
const nameRef = new Ref(function ({ name }) {
|
|
152
144
|
const self = this;
|
|
153
145
|
return _("div.foo#bar", {
|
|
154
|
-
text: "hello
|
|
146
|
+
text: "hello" + (name || "no name"),
|
|
155
147
|
onclick() {
|
|
156
148
|
const name = prompt();
|
|
157
|
-
self.updateState({
|
|
149
|
+
self.updateState({ name });
|
|
158
150
|
},
|
|
159
151
|
});
|
|
160
152
|
});
|
|
161
153
|
|
|
162
154
|
function Home() {
|
|
163
|
-
return _(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
nameRef.render(null)
|
|
155
|
+
return _("div.foo#bar",
|
|
156
|
+
counter,
|
|
157
|
+
HelloMessage,
|
|
158
|
+
nameRef.render({ name: "no name" })
|
|
168
159
|
);
|
|
169
160
|
}
|
|
170
161
|
|
|
171
162
|
const home = new Screen({
|
|
172
163
|
name: "home page", // page title
|
|
173
164
|
template: Home,
|
|
165
|
+
...
|
|
174
166
|
});
|
|
175
167
|
|
|
176
168
|
Router.route("/", home);
|
|
177
169
|
```
|
|
178
170
|
|
|
179
|
-
|
|
171
|
+
## Documentation
|
|
172
|
+
We are currently building cradova's documentation and we have only a few hands, if you're interested in helping you can join the community, learn first hand, and support cradova's progress.
|
|
180
173
|
|
|
181
|
-
|
|
174
|
+
## Getting Help
|
|
175
|
+
To get further insights and help on Cradova, visit our new [Telegram Community Chat](https://t.me/cradovaframework).
|
|
182
176
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
To get help visit our new [telegram community](https://t.me/cradovaframework)
|
|
186
|
-
|
|
187
|
-
# contributing
|
|
188
|
-
|
|
189
|
-
we are currently working to set up.
|
|
177
|
+
## Contributing
|
|
178
|
+
We are currently working to set up:
|
|
190
179
|
|
|
191
180
|
- Cradova Documentation Website
|
|
192
181
|
- UI component libraries for cradova
|
|
193
182
|
- Sample projects
|
|
194
183
|
- maintenance and promotion
|
|
184
|
+
- building cradova CLI
|
|
195
185
|
|
|
196
|
-
community [telegram](https://t.me/cradovaframework)
|
|
197
|
-
|
|
198
|
-
# How to Sponsor
|
|
199
186
|
|
|
200
|
-
|
|
187
|
+
## Sponsor
|
|
188
|
+
Your support is appriciated and needed to advance Cradova further into the future.\
|
|
189
|
+
Sponsorships can be done via [Patreon](https://www.patreon.com/FridayCandour).\
|
|
190
|
+
Both monthly-recurring sponsorships and one-time donations are accepted. Recurring sponsorships will be entitled to logo placements in Tiers.
|