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.
Files changed (103) hide show
  1. package/CHANGELOG.md +0 -6
  2. package/README.md +144 -28
  3. package/contributing.md +2 -2
  4. package/dist/{src/types.d.ts → index.d.ts} +9 -18
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +415 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/{src/module.js → module.js} +87 -130
  9. package/dist/module.js.map +1 -0
  10. package/dist/{src/sacho → sacho}/loadCss.js +0 -0
  11. package/dist/{src/sacho → sacho}/swipe.js +25 -13
  12. package/dist/{src/sacho → sacho}/swipe1.js +0 -0
  13. package/dist/{src/scripts → scripts}/Router.js +5 -3
  14. package/dist/{src/scripts → scripts}/Scaffold.js +5 -19
  15. package/dist/{src/scripts → scripts}/Screen.js +29 -40
  16. package/dist/{src/scripts → scripts}/ajax.js +0 -0
  17. package/dist/{src/scripts → scripts}/createSignal.js +0 -0
  18. package/dist/{src/scripts → scripts}/fns.js +3 -15
  19. package/dist/scripts/init.js +9 -0
  20. package/dist/{src/scripts → scripts}/track.js +1 -6
  21. package/dist/{src/types.js → types.js} +0 -0
  22. package/package.json +8 -10
  23. package/src/index.ts +42 -53
  24. package/src/sacho/swipe.ts +27 -15
  25. package/src/scripts/Router.ts +5 -4
  26. package/src/scripts/Scaffold.ts +5 -22
  27. package/src/scripts/Screen.ts +36 -44
  28. package/src/scripts/fns.ts +3 -15
  29. package/src/scripts/init.ts +3 -4
  30. package/src/scripts/track.ts +1 -7
  31. package/src/types.ts +1 -8
  32. package/tsconfig.json +1 -1
  33. package/.vscode/settings.json +0 -3
  34. package/dist/site/app.d.ts +0 -1
  35. package/dist/site/app.js +0 -2
  36. package/dist/site/assets/badge.svg +0 -85
  37. package/dist/site/assets/bulb.png +0 -0
  38. package/dist/site/assets/cloud.png +0 -0
  39. package/dist/site/assets/correct.svg +0 -1
  40. package/dist/site/assets/cradova.png +0 -0
  41. package/dist/site/assets/des.svg +0 -132
  42. package/dist/site/assets/sacho.png +0 -0
  43. package/dist/site/assets/shoot.svg +0 -1
  44. package/dist/site/assets/spaceship.svg +0 -1
  45. package/dist/site/assets/star.svg +0 -11
  46. package/dist/site/assets/support.svg +0 -1
  47. package/dist/site/doc/about.d.ts +0 -2
  48. package/dist/site/doc/about.js +0 -17
  49. package/dist/site/doc/home.d.ts +0 -2
  50. package/dist/site/doc/home.js +0 -31
  51. package/dist/site/doc/info.d.ts +0 -2
  52. package/dist/site/doc/info.js +0 -67
  53. package/dist/site/index.d.ts +0 -5
  54. package/dist/site/index.html +0 -40
  55. package/dist/site/index.js +0 -22
  56. package/dist/site/prism/prism.css +0 -3
  57. package/dist/site/prism/prism.js +0 -1013
  58. package/dist/site/styles/style.css +0 -201
  59. package/dist/src/index.d.ts +0 -46
  60. package/dist/src/index.js +0 -1505
  61. package/dist/src/index.js.map +0 -1
  62. package/dist/src/module.js.map +0 -1
  63. package/dist/src/sacho/loadCss.d.ts +0 -1
  64. package/dist/src/sacho/swipe.d.ts +0 -12
  65. package/dist/src/sacho/swipe1.d.ts +0 -12
  66. package/dist/src/scripts/Router.d.ts +0 -8
  67. package/dist/src/scripts/Scaffold.d.ts +0 -8
  68. package/dist/src/scripts/Screen.d.ts +0 -54
  69. package/dist/src/scripts/ajax.d.ts +0 -16
  70. package/dist/src/scripts/createSignal.d.ts +0 -124
  71. package/dist/src/scripts/fns.d.ts +0 -151
  72. package/dist/src/scripts/init.d.ts +0 -1
  73. package/dist/src/scripts/init.js +0 -10
  74. package/dist/src/scripts/track.d.ts +0 -8
  75. package/dist/src/scripts/utils.d.ts +0 -1
  76. package/dist/src/scripts/utils.js +0 -10
  77. package/dist/src/types.d.ts.map +0 -1
  78. package/site/app.ts +0 -3
  79. package/site/assets/badge.svg +0 -85
  80. package/site/assets/bulb.png +0 -0
  81. package/site/assets/cloud.png +0 -0
  82. package/site/assets/correct.svg +0 -1
  83. package/site/assets/cradova.png +0 -0
  84. package/site/assets/des.svg +0 -132
  85. package/site/assets/sacho.png +0 -0
  86. package/site/assets/shoot.svg +0 -1
  87. package/site/assets/spaceship.svg +0 -1
  88. package/site/assets/star.svg +0 -11
  89. package/site/assets/support.svg +0 -1
  90. package/site/doc/about.ts +0 -26
  91. package/site/doc/home.ts +0 -41
  92. package/site/doc/info.ts +0 -147
  93. package/site/index.html +0 -40
  94. package/site/index.ts +0 -24
  95. package/site/manifest.json +0 -37
  96. package/site/package.json +0 -15
  97. package/site/prism/prism.css +0 -3
  98. package/site/prism/prism.js +0 -1013
  99. package/site/styles/style.css +0 -201
  100. package/site/sw.js +0 -58
  101. package/site/workers/online-only-after-initial-cache.ts +0 -131
  102. package/site/workers/service-worker.ts +0 -60
  103. package/src/scripts/utils.ts +0 -12
package/CHANGELOG.md CHANGED
@@ -36,9 +36,3 @@ and we went along with it.
36
36
  - bug fixes
37
37
  - big performance gain
38
38
  - battle testing green
39
-
40
- ## 1.0.7
41
-
42
- - bug fixes
43
- - big performance gain
44
- - battle testing green
package/README.md CHANGED
@@ -1,5 +1,12 @@
1
- # cradova PWA sample
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>&nbsp;
27
+
20
28
  </p>
21
29
 
30
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](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](#building-cradova-parkages)
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
- ## Installation
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
- <!-- Production: whichever you prefer -->
43
- <script src="https://unpkg.com/cradova/cradova.min.js"></script>
44
- <script src="https://cdn.jsdelivr.net/npm/cradova/cradova.min.js"></script>
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 install cradova --save
87
+ npm i cradova
51
88
  ```
52
89
 
53
- <img src="cradova.jpg">
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
- ### `npm start`
96
+ Here's an example of create a basic component in cradova:
56
97
 
57
- Runs the app in the development mode.\
58
- Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
98
+ ```js
99
+ import _, { frag } from "cradova";
59
100
 
60
- The page will reload when you make changes.\
61
- You may also see any lint errors in the console.
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
- ### `npm test`
179
+ # Documentation
64
180
 
65
- Launches the test runner in the interactive watch mode.\
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
- ### `npm run build`
183
+ # getting help
69
184
 
70
- Builds the app for production to the `build` folder.\
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
- The build is minified and the filenames include the hashes.\
74
- Your app is ready to be deployed!
187
+ # contributing
75
188
 
76
- See the section about [deployment](https://fridaycandour.github.io/cradova/docs/deployment) for more information.
189
+ we are currently working to set up.
77
190
 
78
- ### Analyzing the Bundle Size
191
+ - Cradova Documentation Website
192
+ - UI component libraries for cradova
193
+ - Sample projects
194
+ - maintenance and promotion
79
195
 
80
- This section has moved here: [https://fridaycandour.github.io/cradova/docs/analyzing-the-bundle-size](https://fridaycandour.github.io/cradova/docs/analyzing-the-bundle-size)
196
+ community [telegram](https://t.me/cradovaframework)
81
197
 
82
- ### Making a Progressive Web App
198
+ # How to Sponsor
83
199
 
84
- This section has moved here: [https://fridaycandour.github.io/cradova/docs/making-a-progressive-web-app](https://fridaycandour.github.io/cradova/docs/making-a-progressive-web-app)
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
@@ -2,6 +2,6 @@ What does Cradova needs?
2
2
 
3
3
  - Cradova Documentation Website
4
4
  - Sample projects
5
- - More Tools and UI libraries for cradova
5
+ - UI component libraries for cradova
6
6
 
7
- community [telegram](https://t.me/cradova)
7
+ community [telegram](https://t.me/cradovaframework)
@@ -3,10 +3,10 @@
3
3
  * ---
4
4
  * Now you can detect swipes the best way possible
5
5
  *
6
- * @param callback
6
+ * @param callabck
7
7
  * @param touching?
8
8
  */
9
- export function swipe(callback: (swipe_data: Record<string, number>) => void, touching?: boolean, element?: HTMLElement): {
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
- effector(): Promise<void>;
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
- deActivate(): void;
226
- Activate(data?: any, force?: boolean): Promise<void>;
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 () => HTMLElement
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: H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EAAE,qBAcxD,CAAC;ACzfF;;;;;;GAMG;AAEH,yBACE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACrC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UAsC5B;AC7JD;;;;;;;;;GASG;AACH,qBACE,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,GACA;IACE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC,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"}