cradova 1.0.7 → 1.0.8
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/CHANGELOG.md +0 -6
- package/README.md +144 -28
- package/contributing.md +2 -2
- package/dist/{src/types.d.ts → index.d.ts} +9 -18
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +415 -0
- package/dist/index.js.map +1 -0
- package/dist/{src/module.js → module.js} +87 -130
- package/dist/module.js.map +1 -0
- package/dist/{src/sacho → sacho}/loadCss.js +0 -0
- package/dist/{src/sacho → sacho}/swipe.js +25 -13
- package/dist/{src/sacho → sacho}/swipe1.js +0 -0
- package/dist/{src/scripts → scripts}/Router.js +5 -3
- package/dist/{src/scripts → scripts}/Scaffold.js +5 -19
- package/dist/{src/scripts → scripts}/Screen.js +29 -40
- package/dist/{src/scripts → scripts}/ajax.js +0 -0
- package/dist/{src/scripts → scripts}/createSignal.js +0 -0
- package/dist/{src/scripts → scripts}/fns.js +3 -15
- package/dist/scripts/init.js +9 -0
- package/dist/{src/scripts → scripts}/track.js +1 -6
- package/dist/{src/types.js → types.js} +0 -0
- package/package.json +8 -10
- package/src/index.ts +42 -53
- package/src/sacho/swipe.ts +27 -15
- package/src/scripts/Router.ts +5 -4
- package/src/scripts/Scaffold.ts +5 -22
- package/src/scripts/Screen.ts +36 -44
- package/src/scripts/fns.ts +3 -15
- package/src/scripts/init.ts +3 -4
- package/src/scripts/track.ts +1 -7
- package/src/types.ts +1 -8
- package/tsconfig.json +1 -1
- package/.vscode/settings.json +0 -3
- package/dist/site/app.d.ts +0 -1
- package/dist/site/app.js +0 -2
- package/dist/site/assets/badge.svg +0 -85
- package/dist/site/assets/bulb.png +0 -0
- package/dist/site/assets/cloud.png +0 -0
- package/dist/site/assets/correct.svg +0 -1
- package/dist/site/assets/cradova.png +0 -0
- package/dist/site/assets/des.svg +0 -132
- package/dist/site/assets/sacho.png +0 -0
- package/dist/site/assets/shoot.svg +0 -1
- package/dist/site/assets/spaceship.svg +0 -1
- package/dist/site/assets/star.svg +0 -11
- package/dist/site/assets/support.svg +0 -1
- package/dist/site/doc/about.d.ts +0 -2
- package/dist/site/doc/about.js +0 -17
- package/dist/site/doc/home.d.ts +0 -2
- package/dist/site/doc/home.js +0 -31
- package/dist/site/doc/info.d.ts +0 -2
- package/dist/site/doc/info.js +0 -67
- package/dist/site/index.d.ts +0 -5
- package/dist/site/index.html +0 -40
- package/dist/site/index.js +0 -22
- package/dist/site/prism/prism.css +0 -3
- package/dist/site/prism/prism.js +0 -1013
- package/dist/site/styles/style.css +0 -201
- package/dist/src/index.d.ts +0 -46
- package/dist/src/index.js +0 -1505
- package/dist/src/index.js.map +0 -1
- package/dist/src/module.js.map +0 -1
- package/dist/src/sacho/loadCss.d.ts +0 -1
- package/dist/src/sacho/swipe.d.ts +0 -12
- package/dist/src/sacho/swipe1.d.ts +0 -12
- package/dist/src/scripts/Router.d.ts +0 -8
- package/dist/src/scripts/Scaffold.d.ts +0 -8
- package/dist/src/scripts/Screen.d.ts +0 -54
- package/dist/src/scripts/ajax.d.ts +0 -16
- package/dist/src/scripts/createSignal.d.ts +0 -124
- package/dist/src/scripts/fns.d.ts +0 -151
- package/dist/src/scripts/init.d.ts +0 -1
- package/dist/src/scripts/init.js +0 -10
- package/dist/src/scripts/track.d.ts +0 -8
- package/dist/src/scripts/utils.d.ts +0 -1
- package/dist/src/scripts/utils.js +0 -10
- package/dist/src/types.d.ts.map +0 -1
- package/site/app.ts +0 -3
- package/site/assets/badge.svg +0 -85
- package/site/assets/bulb.png +0 -0
- package/site/assets/cloud.png +0 -0
- package/site/assets/correct.svg +0 -1
- package/site/assets/cradova.png +0 -0
- package/site/assets/des.svg +0 -132
- package/site/assets/sacho.png +0 -0
- package/site/assets/shoot.svg +0 -1
- package/site/assets/spaceship.svg +0 -1
- package/site/assets/star.svg +0 -11
- package/site/assets/support.svg +0 -1
- package/site/doc/about.ts +0 -26
- package/site/doc/home.ts +0 -41
- package/site/doc/info.ts +0 -147
- package/site/index.html +0 -40
- package/site/index.ts +0 -24
- package/site/manifest.json +0 -37
- package/site/package.json +0 -15
- package/site/prism/prism.css +0 -3
- package/site/prism/prism.js +0 -1013
- package/site/styles/style.css +0 -201
- package/site/sw.js +0 -58
- package/site/workers/online-only-after-initial-cache.ts +0 -131
- package/site/workers/service-worker.ts +0 -60
- package/src/scripts/utils.ts +0 -12
package/CHANGELOG.md
CHANGED
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.
|
package/contributing.md
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* ---
|
|
4
4
|
* Now you can detect swipes the best way possible
|
|
5
5
|
*
|
|
6
|
-
* @param
|
|
6
|
+
* @param callabck
|
|
7
7
|
* @param touching?
|
|
8
8
|
*/
|
|
9
|
-
export function swipe(
|
|
9
|
+
export function swipe(callabck: (swipe_data: Record<string, number>) => void, touching?: boolean): {
|
|
10
10
|
start(): void;
|
|
11
11
|
stop(): void;
|
|
12
12
|
};
|
|
@@ -215,15 +215,14 @@ export class Screen {
|
|
|
215
215
|
*/
|
|
216
216
|
persist: boolean;
|
|
217
217
|
rendered: boolean;
|
|
218
|
-
effects: (() => unknown | Promise<unknown>)[];
|
|
219
218
|
constructor(cradova_screen_initials: CradovaScreenType);
|
|
220
|
-
effect(fn: () => unknown | Promise<unknown>): void
|
|
221
|
-
|
|
222
|
-
package(data?: any): Promise<void>;
|
|
219
|
+
effect(fn: () => unknown | Promise<unknown>): Promise<void>;
|
|
220
|
+
package(data: any): Promise<void>;
|
|
223
221
|
onActivate(cb: (data: any) => void): void;
|
|
222
|
+
onDeactivate(cb: (data: any) => void): void;
|
|
224
223
|
addChild(...addOns: any[]): void;
|
|
225
|
-
|
|
226
|
-
Activate(data
|
|
224
|
+
detach(): void;
|
|
225
|
+
Activate(data: any, force: boolean): Promise<void>;
|
|
227
226
|
}
|
|
228
227
|
export class Scaffold {
|
|
229
228
|
push(label: string, data?: unknown, force?: boolean): Promise<void>;
|
|
@@ -328,7 +327,6 @@ export class RefList {
|
|
|
328
327
|
stale(datas: any): void;
|
|
329
328
|
render(datas?: any): any;
|
|
330
329
|
updateState(datas: any[]): void;
|
|
331
|
-
remove(): void;
|
|
332
330
|
}
|
|
333
331
|
/**
|
|
334
332
|
* Cradova Ref
|
|
@@ -344,15 +342,9 @@ export class Ref {
|
|
|
344
342
|
* ---
|
|
345
343
|
* returns html with cradova reference
|
|
346
344
|
* @param data
|
|
347
|
-
* @returns
|
|
345
|
+
* @returns html
|
|
348
346
|
*/
|
|
349
347
|
render(...data: any): () => any;
|
|
350
|
-
/**
|
|
351
|
-
* Cradova Ref
|
|
352
|
-
* ---
|
|
353
|
-
* runs on every state update
|
|
354
|
-
*
|
|
355
|
-
*/
|
|
356
348
|
onStateUpdate(cb: any): void;
|
|
357
349
|
/**
|
|
358
350
|
* Cradova Ref
|
|
@@ -395,7 +387,6 @@ export function Ajax(url: string | URL, opts?: {
|
|
|
395
387
|
header?: Record<string, any>;
|
|
396
388
|
callbacks?: Record<string, (arg: any) => void>;
|
|
397
389
|
} | any): Promise<unknown>;
|
|
398
|
-
export function IsElementInView(element: HTMLElement): boolean;
|
|
399
390
|
/**
|
|
400
391
|
* Creates new cradova HTML element
|
|
401
392
|
* @example
|
|
@@ -434,4 +425,4 @@ export function IsElementInView(element: HTMLElement): boolean;
|
|
|
434
425
|
declare const _: any;
|
|
435
426
|
export default _;
|
|
436
427
|
|
|
437
|
-
//# sourceMappingURL=
|
|
428
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA;;;;;;;GAOG;AACH,sBACE,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,EACtD,QAAQ,UAAQ;;;EAgHjB;AC1HD;;;;;;;;;;;;;;GAcG;AAEH;IASE,KAAK,EAAE,GAAG,CAAQ;gBAGhB,OAAO,EAAE,OAAO,EAChB,KAAK,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE;IAepE;;;;;;OAMG;IACH,GAAG,CAAC,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AC,CAAC;CAChD,GACD,GAAQ,oBA+Db;AEkDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,QAAA,MAAM,CAAC,EAAE,GAmUR,CAAC;AAIF,eAAe,CAAC,CAAC","sources":["src/src/sacho/swipe.ts","src/src/scripts/createSignal.ts","src/src/types.ts","src/src/scripts/Router.ts","src/src/scripts/Screen.ts","src/src/scripts/Scaffold.ts","src/src/scripts/fns.ts","src/src/scripts/track.ts","src/src/scripts/ajax.ts","src/src/scripts/init.ts","src/src/index.ts","src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,"/*\n\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\"\n\" ██████╗ ██████╗ █████ ██████╗ ███████╗ ██╗ ██╗ █████ \n\" ██╔════╝ ██╔══██╗ ██╔═╗██ █ ██ ██╔═════╝ ██║ ██║ ██╔═╗██ \n\" ██║ ██████╔╝ ██████╗ █ ██ ██║ ██ ██║ ██║ ██████╗ \n\" ██║ ██╔══██ ██║ ██║ █ ██ ██║ ██ ╚██╗ ██╔╝ ██║ ██ \n\" ╚██████╗ ██║ ██║ ██║ ██║ ███████╔╝ ██████ ╚████╔╝ ██║ ██║\n\" ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚════╝ ╚═══╝ ╚═╝ ╚═╝ \n\" Sacho inside\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\n\" =============================================================================\n\" By Friday Candour\n\" -----------------------------------------------------------------------------\n\" =============================================================================\n\" Cradova FrameWork\n\" @version 1.*.*\n\" -----------------------------------------------------------------------------\n\" License: Apache V2\n\" -----------------------------------------------------------------------------\n\" fridaymaxtour@gmail.com ...\n\" =============================================================================\n\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n \n Copyright 2022 Friday Candour. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n\n// importing cradova helper scripts\n\nexport { swipe } from \"./sacho/swipe\";\nexport { Signal as createSignal } from \"./scripts/createSignal\";\nexport { Router } from \"./scripts/Router\";\nexport { Screen } from \"./scripts/Screen\";\nexport { Scaffold } from \"./scripts/Scaffold\";\nexport { dispatch } from \"./scripts/track\";\nexport { Ajax } from \"./scripts/ajax\";\nexport {\n frag,\n fullScreen,\n assert,\n uuid,\n animate,\n controls,\n PromptBeforeLeave,\n RefElement,\n css,\n media,\n ls,\n Ref,\n RefList,\n assertOr,\n} from \"./scripts/fns\";\n\nimport { Init } from \"./scripts/init\";\n\n// importing types declarations\n\nimport { CradovaElementType } from \"./types\";\n\n(\"use strict\");\n\nconst make = function (txx: any) {\n if (Array.isArray(txx)) {\n txx = txx[0].trim();\n }\n\n if (!txx) {\n return {\n tag: \"div\",\n };\n }\n\n let tag;\n const itemsPurifier = (impure: string, pure: string, items: any) => {\n if (!items.includes(pure)) return [];\n const pureItems = [];\n items = items.split(pure);\n for (let i = 0; i < items.length; i++) {\n if (items[i].includes(impure)) {\n items[i] = items[i].split(impure)[0];\n }\n pureItems.push(items[i]);\n }\n return pureItems;\n };\n\n let innerValue;\n if (txx.includes(\"|\")) {\n const tc = txx.split(\"|\");\n innerValue = tc[1];\n txx = tc[0] && tc[0];\n }\n\n const classes = itemsPurifier(\"#\", \".\", txx);\n const ids = itemsPurifier(\".\", \"#\", txx);\n\n if (typeof tag !== \"string\") {\n tag = classes.shift();\n }\n if (typeof tag !== \"string\") {\n tag = ids.shift();\n }\n\n if (!tag) {\n tag = \"div\";\n }\n\n if (!txx.includes(\".\") && !txx.includes(\"#\")) {\n tag = txx;\n ids.length = 0;\n classes.length = 0;\n }\n\n const ID = ids[1] ? ids[1].trim() : null;\n const className = classes.join(\" \");\n return { tag, className, ID, innerValue };\n};\n\n/**\n * Creates new cradova HTML element\n * @example\n * _(\"p\") // or _(\"p.class\") or _(\"p#id\") or _(\"p.class#id\")\n * using inline props\n * _(\"p\",{\n * text: \"am a p tag\",\n * style: {\n * color: \"blue\"\n * }\n * )\n * adding children\n * _(\"p\",\n * _(\"span\",{text:\" am a span tag like so\",\n * {style: {color: \"brown\"}\n * })\n * )\n *\n * props and children\n * _(\"p\",\n * // props first\n * {\n * text: \"am a p tag\",\n * style: {\n * color: \"blue\"\n * },\n * // all children goes after\n * _(\"span\",{text:\" am a span tag like so\",\n * {style: {color: \"brown\"}\n * })\n * )\n *\n * @param {...any} element_initials\n * @returns function - cradova element\n */\n\nconst _: any = (...element_initials: any) => {\n let properties: Record<string, any>,\n childrens: string | any[] = [],\n beforeMount: (self: HTMLElement) => void;\n\n if (\n typeof element_initials[1] == \"object\" &&\n !(\n element_initials[1] instanceof HTMLElement && !element_initials[1].tagName\n )\n ) {\n properties = element_initials[1];\n if (properties?.beforeMount) {\n beforeMount = properties[\"beforeMount\"];\n }\n if (element_initials.length > 2) {\n childrens = element_initials.slice(2, element_initials.length);\n }\n } else {\n if (\n element_initials[1] instanceof HTMLElement ||\n typeof element_initials[1] === \"function\" ||\n typeof element_initials[1] === \"string\"\n ) {\n childrens = element_initials.slice(1, element_initials.length);\n }\n }\n\n if (element_initials[0].raw) {\n // getting the value of static cradova calls\n element_initials[0] = element_initials[0][\"raw\"][0];\n }\n // verifying the children array\n\n function identify(element_initials: any) {\n if (typeof element_initials !== \"object\") {\n element_initials = [element_initials];\n }\n const initials = make(element_initials[0]);\n // TODO: tag debugger\n // const { tag, className, ID, innerValue } = initials;\n\n /**\n *\n * --- Cradova Element Initials ---\n * --------------------------------\n *\n * Note: this element has not been initialized!\n *\n * add to a parent element or call this return function\n *\n * .\n */\n return (...incoming: string[] | any[]) => {\n /*\n *\n * --- Cradova Element Initials ---\n * --------------------------------\n *\n * Note: this element has not been initialized!\n *\n * add to a parent element or call this return function\n *\n * .\n */\n let childrens2rd = [],\n props: Record<string, any> = {},\n text;\n\n for (let i = 0; i < incoming.length; i++) {\n if (\n typeof incoming[i] === \"function\" ||\n incoming[i] instanceof HTMLElement\n // ||\n // incoming[i].tagName\n ) {\n childrens2rd.push(incoming[i]);\n continue;\n }\n\n if (\n // !incoming[i].tagName &&\n !(incoming[i] instanceof HTMLElement) &&\n !Array.isArray(incoming[i]) &&\n typeof incoming[i] === \"object\" &&\n !incoming[i].tagName\n ) {\n if (incoming[i].beforeMount) {\n beforeMount = incoming[i][\"beforeMount\"];\n continue;\n }\n if (incoming[i].composedPath) {\n continue;\n }\n props = incoming[i];\n continue;\n }\n //\n if (typeof incoming[i] === \"string\") {\n text = incoming[i];\n continue;\n }\n }\n\n if (childrens.length) {\n childrens2rd.push(...childrens);\n }\n\n let element: CradovaElementType | undefined;\n\n try {\n element = document.createElement(initials.tag.trim());\n } catch (error) {\n throw new TypeError(\n \" ✘ Cradova err: invalid tag given \" + initials.tag\n );\n }\n if (!element) {\n return;\n }\n if (initials.className) {\n element.className = initials.className.trim();\n }\n\n if (initials.ID) {\n element.id = initials.ID.trim();\n }\n if (initials.innerValue) {\n element.append(initials.innerValue);\n }\n\n for (const prop in properties) {\n if (prop === \"style\" && typeof properties[prop] === \"object\") {\n for (const [k, v] of Object.entries(properties[prop])) {\n element.style[k] = v;\n }\n continue;\n }\n\n if (element.style[prop] === \"\" && prop !== \"src\") {\n element.style[prop] = properties[prop];\n continue;\n }\n\n if (prop === \"class\" && typeof properties[prop] === \"string\") {\n const classes = properties[prop].split(\" \");\n for (let i = 0; i < classes.length; i++) {\n if (classes[i]) {\n element.classList.add(classes[i]);\n }\n }\n continue;\n }\n if (prop === \"text\") {\n element.innerText = properties[prop];\n continue;\n }\n try {\n element[prop] = properties[prop];\n } catch (error) {\n console.error(\n \" ✘ Cradova err: cradova got \",\n properties[prop],\n \" which is invalid!\"\n );\n throw new Error(\n \" ✘ Cradova err: invalid props \" +\n prop +\n \" for this element type with value \" +\n properties[prop]\n );\n }\n }\n\n //\n // dynamic props\n // over-rides props that appear in the first level\n\n if (props && typeof props === \"object\" && !Array.isArray(props)) {\n for (const prop in props) {\n if (prop === \"style\" && typeof props[prop] === \"object\") {\n for (const [k, v] of Object.entries(props[prop])) {\n element.style[k] = v;\n }\n continue;\n }\n if (element.style[prop] === \"\" && prop !== \"src\") {\n element.style[prop] = props[prop];\n continue;\n }\n if (prop === \"text\" && typeof props[prop] === \"string\") {\n element.innerText = props[prop];\n continue;\n }\n if (prop === \"class\" && typeof props[prop] === \"string\") {\n element.classList.add(props[prop]);\n continue;\n }\n\n if (prop === \"beforeMount\") {\n beforeMount = props[\"beforeMount\"];\n continue;\n }\n\n try {\n element[prop] = props[prop];\n } catch (error) {\n console.error(\" ✘ Cradova err: \" , error);\n }\n }\n }\n // getting children ready\n if (childrens2rd.length) {\n for (let i = 0; i < childrens2rd.length; i++) {\n // single child lane\n if (typeof childrens2rd[i] === \"function\") {\n let child = childrens2rd[i]();\n if (typeof child === \"function\") {\n child = child();\n }\n try {\n if (child) {\n element.append(child);\n }\n if (child && child.afterMount) {\n child.afterMount(child);\n child.afterMount = undefined;\n }\n } catch (error) {\n console.error(\" ✘ Cradova err: \" , error);\n if (!(child instanceof HTMLElement)) {\n throw new Error(\n \" ✘ Cradova err: invalid child type: \" +\n child +\n \" (\" +\n typeof child +\n \")\"\n );\n }\n }\n continue;\n }\n // children array\n if (Array.isArray(childrens2rd[i])) {\n const arrCX: HTMLElement[] | Function[] = childrens2rd[i];\n const arrCXLenght = arrCX.length;\n const arrSET = [];\n for (let p = 0; p < arrCXLenght; p++) {\n if (\n !(arrCX[p] instanceof HTMLElement) &&\n typeof arrCX[p] !== \"function\" &&\n !Array.isArray(arrCX[p])\n ) {\n console.error(\" ✘ Cradova err: \", arrCX[p]);\n throw new TypeError(\n \" ✘ Cradova err: invalid tag type or template literal, cradova was enable to create this element show above ⇑\"\n );\n }\n arrSET.push(arrCX[p]);\n }\n //\n childrens2rd = [\n ...childrens2rd.slice(0, i + 1),\n ...arrSET,\n ...childrens2rd.slice(i + 1, childrens2rd.length),\n ];\n continue;\n }\n const child = childrens2rd[i];\n if (\n child instanceof HTMLElement ||\n child instanceof DocumentFragment ||\n typeof child === \"string\"\n ) {\n element.append(child);\n // @ts-ignore\n if (child.afterMount) {\n // @ts-ignore\n child.afterMount(child);\n // @ts-ignore\n child.afterMount = undefined;\n }\n } else {\n console.error(\" ✘ Cradova err: got\", child);\n throw new Error(\n \" ✘ Cradova err: invalid child type: \" +\n \"(\" +\n typeof child +\n \")\"\n );\n }\n }\n }\n //\n if (text) {\n element.append(text);\n }\n // TODO: this will be updated to use data-stateid soon\n // speed test still going on\n if (element.stateID) {\n // adding cradova dynamic signature\n element.classList.add(\"cra_child_doc\");\n }\n\n if (beforeMount) {\n beforeMount(element);\n }\n\n return element;\n };\n }\n if (typeof element_initials[0] !== \"string\") {\n console.error(\" ✘ Cradova err: NO TEMPLATE STRING PROVIDED\");\n return () => \"NO TEMPLATE STRING PROVIDED\";\n }\n const CradovaElement: () => HTMLElement | undefined =\n identify(element_initials);\n if (!CradovaElement) {\n throw new Error(\n \" ✘ Cradova err: invalid element initials \" + element_initials\n );\n }\n return CradovaElement;\n};\n\nInit();\n\nexport default _;\n"],"names":[],"version":3,"file":"index.d.ts.map"}
|