cradova 1.5.0 → 2.1.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,20 +1,33 @@
1
- <div style="display: flex; align-items:center; justify-content: space-around; width: 100%;">
2
- <h1 style="border: none"> Cradova</h1>
3
- <a><img src="cradova.png" alt="cradova logo" width="100" height="100"></a>
4
- </div>
5
- <br>
6
- <hr>
7
- <br>
8
- <br>
9
-
1
+ <br/>
2
+ <p align="center">
3
+ <a href="https://github.com/fridaycandour/cradova">
4
+ <img src="cradova.png" alt="Logo" width="80" height="80">
5
+ </a>
6
+
7
+ <h1 align="center">Cradova</h1>
8
+
9
+ <p align="center">
10
+ Cradova is a JavaScript framework for building Single Page Applications and PWAs.
11
+ <br/>
12
+ <br/>
13
+ <a href="https://github.com/fridaycandour/cradova#examples"><strong>Explore the docs »</strong></a>
14
+ <br/>
15
+ <br/>
16
+ <a href="https://t.me/cradovaframework">Join Community</a>
17
+ .
18
+ <a href="https://github.com/fridaycandour/cradova/issues">Report Bug</a>
19
+ .
20
+ <a href="https://github.com/fridaycandour/cradova/issues">Request Feature</a>
21
+ </p>
22
+ </p>
23
+
24
+ ![Contributors](https://img.shields.io/github/contributors/fridaycandour/cradova?color=dark-green) ![Issues](https://img.shields.io/github/issues/fridaycandour/cradova) ![License](https://img.shields.io/github/license/fridaycandour/cradova)
10
25
  [![npm Version](https://img.shields.io/npm/v/cradova.svg)](https://www.npmjs.com/package/cradova)
11
26
  [![License](https://img.shields.io/npm/l/cradova.svg)](https://github.com/cradova/cradova.js/blob/next/LICENSE)
12
27
  [![npm Downloads](https://img.shields.io/npm/dm/cradova.svg)](https://www.npmjs.com/package/cradova)
13
- [![Build Status](https://img.shields.io/travis/cradova/cradova.js/next.svg?colorB=brightgreen)](https://www.npmjs.com/package/cradova)
14
- [![Donate at OpenCollective](https://img.shields.io/opencollective/all/cradova.svg?colorB=brightgreen)](https://opencollective.com/cradova)
15
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/cradova/cradova.js/blob/next/contributing.md)
28
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/cradova/cradova.js/blob/next/contributing.md)![Forks](https://img.shields.io/github/forks/fridaycandour/cradova?style=social) ![Stargazers](https://img.shields.io/github/stars/fridaycandour/cradova?style=social)
16
29
 
17
- ## Contents
30
+ # Contents
18
31
 
19
32
  - [What is Cradova](#what-is-cradova)
20
33
  - [Why Cradova?](#whats-the-benefit)
@@ -69,10 +82,17 @@ Many aspects of Cradova are not reflected in the following example. More functio
69
82
  Here's an example of create a basic component in Cradova:
70
83
 
71
84
  ```js
72
- import _ from "cradova";
85
+ // cradova v2.0.0 comes with all html tags prebuilt and fully typed
86
+ // this gives your app more performance gain.
87
+ import _, { h1 } from "cradova";
73
88
 
74
89
  function Hello(name) {
75
- return _("h1", "Hello " + name);
90
+ return h1("Hello " + name, {
91
+ className: "title",
92
+ style: {
93
+ color: "grey",
94
+ },
95
+ });
76
96
  }
77
97
 
78
98
  // document fragment empty cradova call _()
@@ -82,6 +102,19 @@ const html = _(Hello("peter"), Hello("joe"));
82
102
  document.body.append(html);
83
103
  ```
84
104
 
105
+ ```js
106
+ // regular example
107
+ import _ from "cradova";
108
+
109
+ function Hello(name) {
110
+ return _("h1", "Hello " + name);
111
+ }
112
+
113
+ const html = _(Hello("peter"), Hello("joe"));
114
+
115
+ document.body.append(html);
116
+ ```
117
+
85
118
  ## Using Screen
86
119
 
87
120
  ```js
@@ -99,6 +132,19 @@ function HelloMessage(name) {
99
132
  return _("div", "Hello " + name);
100
133
  }
101
134
 
135
+
136
+ /*
137
+
138
+ when using router and screens
139
+
140
+ cradova will create a div with data-cra-id=cradova-app-wrapper
141
+
142
+ if it already exist cradova will use it instead
143
+
144
+ so if you want to use your own mount point then create a div with data-cra-id="cradova-app-wrapper"
145
+
146
+ */
147
+
102
148
  const home = new Screen({
103
149
  name: "hello page", // page title
104
150
  template: HelloMessage,
@@ -108,24 +154,25 @@ const home = new Screen({
108
154
  Router.route("/", home);
109
155
 
110
156
  // navigates to that page
111
- // Router.navigate("/home");
157
+ // Router.navigate("/home", data, force);
112
158
  // get the page ready in the background
113
159
  // Router.packageScreen("/home");
160
+ // get route params for this page
161
+ // Router.getParams();
114
162
 
115
163
  ```
116
164
 
117
165
  ## State management
118
166
 
119
167
  ```js
120
- // we have
121
168
 
122
- // dispatch - global (element) requires state ID
123
169
 
124
- // element can have this.updateState when shouldUpdate is true
170
+ // element can have this.updateState when the shouldUpdate props is true
125
171
 
126
- // Ref components (global and local)
172
+ // Ref components
127
173
 
128
174
  // state can be managed from a store when using createSignal or simpleStores
175
+ // this method is not yet documented
129
176
 
130
177
  import _, { Ref } from "cradova";
131
178
 
@@ -175,6 +222,15 @@ const nameRef = new Ref(function ( name ) {
175
222
  });
176
223
  });
177
224
 
225
+ /*
226
+ cradova Ref are component objects
227
+ with methods for rendering, pre-rendering, and updating a it dom elements.
228
+
229
+ Ref also has the feature to stash input values need by the components
230
+
231
+ */
232
+
233
+
178
234
  function Home() {
179
235
  return _("div.foo#bar",
180
236
  counter,
@@ -190,6 +246,28 @@ const home = new Screen({
190
246
  ...
191
247
  });
192
248
 
249
+ /*
250
+
251
+ Nice things about cradova screens
252
+
253
+ screens are rendered once by default to hack
254
+ responsiveness making your app work fast as user navigates.
255
+
256
+ this behavior can be override
257
+ by passing
258
+ prerender: false
259
+ in the constructor
260
+
261
+
262
+ Cradova screens has
263
+ onActivate() and
264
+ onDeactivate() methods
265
+
266
+ these allow you manage rendering
267
+ circle for each in your app
268
+
269
+ */
270
+
193
271
  Router.route("/", home);
194
272
  ```
195
273