cradova 1.0.9 → 1.0.10
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/contributing.md +2 -2
- package/dist/{src/index.d.ts → index.d.ts} +0 -0
- package/dist/index.js +434 -0
- package/dist/{src/types.d.ts → module.d.ts} +1 -1
- package/dist/{src/types.d.ts.map → module.d.ts.map} +1 -1
- package/dist/{src/module.js → module.js} +4 -3
- package/dist/module.js.map +1 -0
- package/dist/{src/sacho → sacho}/loadCss.d.ts +0 -0
- package/dist/{src/sacho → sacho}/loadCss.js +0 -0
- package/dist/{src/sacho → sacho}/swipe.d.ts +0 -0
- package/dist/{src/sacho → sacho}/swipe.js +0 -0
- package/dist/{src/sacho → sacho}/swipe1.d.ts +0 -0
- package/dist/{src/sacho → sacho}/swipe1.js +0 -0
- package/dist/{src/scripts → scripts}/Router.d.ts +0 -0
- package/dist/{src/scripts → scripts}/Router.js +0 -0
- package/dist/{src/scripts → scripts}/Scaffold.d.ts +0 -0
- package/dist/{src/scripts → scripts}/Scaffold.js +0 -0
- package/dist/{src/scripts → scripts}/Screen.d.ts +0 -0
- package/dist/{src/scripts → scripts}/Screen.js +0 -0
- package/dist/{src/scripts → scripts}/ajax.d.ts +0 -0
- package/dist/{src/scripts → scripts}/ajax.js +0 -0
- package/dist/{src/scripts → scripts}/createSignal.d.ts +0 -0
- package/dist/{src/scripts → scripts}/createSignal.js +0 -0
- package/dist/{src/scripts → scripts}/fns.d.ts +0 -0
- package/dist/{src/scripts → scripts}/fns.js +0 -0
- package/dist/{src/scripts → scripts}/init.d.ts +0 -0
- package/dist/{src/scripts → scripts}/init.js +0 -0
- package/dist/{src/scripts → scripts}/track.d.ts +0 -0
- package/dist/{src/scripts → scripts}/track.js +0 -0
- package/dist/{src/scripts → scripts}/utils.d.ts +0 -0
- package/dist/{src/scripts → scripts}/utils.js +0 -0
- package/dist/types.d.ts +248 -0
- package/dist/{src/types.js → types.js} +0 -0
- package/package.json +25 -10
- 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.js +0 -1505
- package/dist/src/index.js.map +0 -1
- package/dist/src/module.js.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/index.ts +0 -507
- package/src/sacho/loadCss.ts +0 -216
- package/src/sacho/style.css +0 -187
- package/src/sacho/swipe.ts +0 -126
- package/src/sacho/swipe1.ts +0 -136
- package/src/scripts/Router.ts +0 -268
- package/src/scripts/Scaffold.ts +0 -68
- package/src/scripts/Screen.ts +0 -188
- package/src/scripts/ajax.ts +0 -83
- package/src/scripts/createSignal.ts +0 -273
- package/src/scripts/fns.ts +0 -627
- package/src/scripts/init.ts +0 -10
- package/src/scripts/track.ts +0 -164
- package/src/scripts/utils.ts +0 -12
- package/src/types.ts +0 -294
package/contributing.md
CHANGED
|
File without changes
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
/* eslint-disable no-undef */
|
|
2
|
+
/*
|
|
3
|
+
|
|
4
|
+
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
5
|
+
"
|
|
6
|
+
" ██████╗ ██████╗ █████ ██████╗ ███████╗ ██╗ ██╗ █████
|
|
7
|
+
" ██╔════╝ ██╔══██╗ ██╔═╗██ █ ██ ██╔═════╝ ██║ ██║ ██╔═╗██
|
|
8
|
+
" ██║ ██████╔╝ ██████╗ █ ██ ██║ ██ ██║ ██║ ██████╗
|
|
9
|
+
" ██║ ██╔══██ ██║ ██║ █ ██ ██║ ██ ╚██╗ ██╔╝ ██║ ██
|
|
10
|
+
" ╚██████╗ ██║ ██║ ██║ ██║ ███████╔╝ ██████ ╚████╔╝ ██║ ██║
|
|
11
|
+
" ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚════╝ ╚═══╝ ╚═╝ ╚═╝
|
|
12
|
+
" Sacho inside
|
|
13
|
+
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
14
|
+
|
|
15
|
+
" =============================================================================
|
|
16
|
+
" By Friday Candour
|
|
17
|
+
" -----------------------------------------------------------------------------
|
|
18
|
+
" =============================================================================
|
|
19
|
+
" Cradova FrameWork
|
|
20
|
+
" @version 1.*.*
|
|
21
|
+
" -----------------------------------------------------------------------------
|
|
22
|
+
" License: Apache V2
|
|
23
|
+
" -----------------------------------------------------------------------------
|
|
24
|
+
" fridaymaxtour@gmail.com ...
|
|
25
|
+
" =============================================================================
|
|
26
|
+
|
|
27
|
+
Apache License
|
|
28
|
+
Version 2.0, January 2004
|
|
29
|
+
http://www.apache.org/licenses/
|
|
30
|
+
|
|
31
|
+
Copyright 2022 Friday Candour. All Rights Reserved.
|
|
32
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
33
|
+
you may not use this file except in compliance with the License.
|
|
34
|
+
You may obtain a copy of the License at
|
|
35
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
36
|
+
Unless required by applicable law or agreed to in writing, software
|
|
37
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
38
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
39
|
+
See the License for the specific language governing permissions and
|
|
40
|
+
limitations under the License.
|
|
41
|
+
*/
|
|
42
|
+
// importing cradova helper scripts
|
|
43
|
+
export { swipe } from "./sacho/swipe";
|
|
44
|
+
export { Signal as createSignal } from "./scripts/createSignal";
|
|
45
|
+
export { Router } from "./scripts/Router";
|
|
46
|
+
export { Screen } from "./scripts/Screen";
|
|
47
|
+
export { Scaffold } from "./scripts/Scaffold";
|
|
48
|
+
export { dispatch } from "./scripts/track";
|
|
49
|
+
export { Ajax } from "./scripts/ajax";
|
|
50
|
+
export { IsElementInView } from "./scripts/utils";
|
|
51
|
+
export { frag, fullScreen, assert, uuid, animate, controls, PromptBeforeLeave, RefElement, css, media, ls, Ref, RefList, assertOr, } from "./scripts/fns";
|
|
52
|
+
import { Init } from "./scripts/init";
|
|
53
|
+
("use strict");
|
|
54
|
+
const make = function (txx) {
|
|
55
|
+
if (Array.isArray(txx)) {
|
|
56
|
+
txx = txx[0].trim();
|
|
57
|
+
}
|
|
58
|
+
if (!txx) {
|
|
59
|
+
return {
|
|
60
|
+
tag: "div",
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
let tag;
|
|
64
|
+
const itemsPurifier = (impure, pure, items) => {
|
|
65
|
+
if (!items.includes(pure))
|
|
66
|
+
return [];
|
|
67
|
+
const pureItems = [];
|
|
68
|
+
items = items.split(pure);
|
|
69
|
+
for (let i = 0; i < items.length; i++) {
|
|
70
|
+
if (items[i].includes(impure)) {
|
|
71
|
+
items[i] = items[i].split(impure)[0];
|
|
72
|
+
}
|
|
73
|
+
pureItems.push(items[i]);
|
|
74
|
+
}
|
|
75
|
+
return pureItems;
|
|
76
|
+
};
|
|
77
|
+
let innerValue;
|
|
78
|
+
if (txx.includes("|")) {
|
|
79
|
+
const tc = txx.split("|");
|
|
80
|
+
innerValue = tc[1];
|
|
81
|
+
txx = tc[0] && tc[0];
|
|
82
|
+
}
|
|
83
|
+
const classes = itemsPurifier("#", ".", txx);
|
|
84
|
+
const ids = itemsPurifier(".", "#", txx);
|
|
85
|
+
if (typeof tag !== "string") {
|
|
86
|
+
tag = classes.shift();
|
|
87
|
+
}
|
|
88
|
+
if (typeof tag !== "string") {
|
|
89
|
+
tag = ids.shift();
|
|
90
|
+
}
|
|
91
|
+
if (!tag) {
|
|
92
|
+
tag = "div";
|
|
93
|
+
}
|
|
94
|
+
if (!txx.includes(".") && !txx.includes("#")) {
|
|
95
|
+
tag = txx;
|
|
96
|
+
ids.length = 0;
|
|
97
|
+
classes.length = 0;
|
|
98
|
+
}
|
|
99
|
+
const ID = ids[1] ? ids[1].trim() : null;
|
|
100
|
+
const className = classes.join(" ");
|
|
101
|
+
return { tag, className, ID, innerValue };
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Creates new cradova HTML element
|
|
105
|
+
* @example
|
|
106
|
+
* _("p") // or _("p.class") or _("p#id") or _("p.class#id")
|
|
107
|
+
* using inline props
|
|
108
|
+
* _("p",{
|
|
109
|
+
* text: "am a p tag",
|
|
110
|
+
* style: {
|
|
111
|
+
* color: "blue"
|
|
112
|
+
* }
|
|
113
|
+
* )
|
|
114
|
+
* adding children
|
|
115
|
+
* _("p",
|
|
116
|
+
* _("span",{text:" am a span tag like so",
|
|
117
|
+
* {style: {color: "brown"}
|
|
118
|
+
* })
|
|
119
|
+
* )
|
|
120
|
+
*
|
|
121
|
+
* props and children
|
|
122
|
+
* _("p",
|
|
123
|
+
* // props first
|
|
124
|
+
* {
|
|
125
|
+
* text: "am a p tag",
|
|
126
|
+
* style: {
|
|
127
|
+
* color: "blue"
|
|
128
|
+
* },
|
|
129
|
+
* // all children goes after
|
|
130
|
+
* _("span",{text:" am a span tag like so",
|
|
131
|
+
* {style: {color: "brown"}
|
|
132
|
+
* })
|
|
133
|
+
* )
|
|
134
|
+
*
|
|
135
|
+
* @param {...any} element_initials
|
|
136
|
+
* @returns function - cradova element
|
|
137
|
+
*/
|
|
138
|
+
const _ = (...element_initials) => {
|
|
139
|
+
let properties, childrens = [], beforeMount;
|
|
140
|
+
if (typeof element_initials[1] == "object" &&
|
|
141
|
+
!(element_initials[1] instanceof HTMLElement && !element_initials[1].tagName)) {
|
|
142
|
+
properties = element_initials[1];
|
|
143
|
+
if (properties?.beforeMount) {
|
|
144
|
+
beforeMount = properties["beforeMount"];
|
|
145
|
+
}
|
|
146
|
+
if (element_initials.length > 2) {
|
|
147
|
+
childrens = element_initials.slice(2, element_initials.length);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
if (element_initials[1] instanceof HTMLElement ||
|
|
152
|
+
typeof element_initials[1] === "function" ||
|
|
153
|
+
typeof element_initials[1] === "string") {
|
|
154
|
+
childrens = element_initials.slice(1, element_initials.length);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (element_initials[0].raw) {
|
|
158
|
+
// getting the value of static cradova calls
|
|
159
|
+
element_initials[0] = element_initials[0]["raw"][0];
|
|
160
|
+
}
|
|
161
|
+
// verifying the children array
|
|
162
|
+
function identify(element_initials) {
|
|
163
|
+
if (typeof element_initials !== "object") {
|
|
164
|
+
element_initials = [element_initials];
|
|
165
|
+
}
|
|
166
|
+
const initials = make(element_initials[0]);
|
|
167
|
+
// TODO: tag debugger
|
|
168
|
+
// const { tag, className, ID, innerValue } = initials;
|
|
169
|
+
/**
|
|
170
|
+
*
|
|
171
|
+
* --- Cradova Element Initials ---
|
|
172
|
+
* --------------------------------
|
|
173
|
+
*
|
|
174
|
+
* Note: this element has not been initialized!
|
|
175
|
+
*
|
|
176
|
+
* add to a parent element or call this return function
|
|
177
|
+
*
|
|
178
|
+
* .
|
|
179
|
+
*/
|
|
180
|
+
return (...incoming) => {
|
|
181
|
+
/*
|
|
182
|
+
*
|
|
183
|
+
* --- Cradova Element Initials ---
|
|
184
|
+
* --------------------------------
|
|
185
|
+
*
|
|
186
|
+
* Note: this element has not been initialized!
|
|
187
|
+
*
|
|
188
|
+
* add to a parent element or call this return function
|
|
189
|
+
*
|
|
190
|
+
* .
|
|
191
|
+
*/
|
|
192
|
+
let childrens2rd = [], props = {}, text;
|
|
193
|
+
for (let i = 0; i < incoming.length; i++) {
|
|
194
|
+
if (typeof incoming[i] === "function" ||
|
|
195
|
+
incoming[i] instanceof HTMLElement) {
|
|
196
|
+
childrens2rd.push(incoming[i]);
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
if (!Array.isArray(incoming[i]) && typeof incoming[i] === "object") {
|
|
200
|
+
if (incoming[i].beforeMount) {
|
|
201
|
+
beforeMount = incoming[i]["beforeMount"];
|
|
202
|
+
incoming[i]["beforeMount"] = undefined;
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
props = incoming[i];
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
//
|
|
209
|
+
if (typeof incoming[i] === "string") {
|
|
210
|
+
text = incoming[i];
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// @ts-ignore
|
|
215
|
+
incoming = undefined;
|
|
216
|
+
if (childrens.length) {
|
|
217
|
+
childrens2rd.push(...childrens);
|
|
218
|
+
}
|
|
219
|
+
let element;
|
|
220
|
+
try {
|
|
221
|
+
element = document.createElement(initials.tag.trim());
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
throw new TypeError(" ✘ Cradova err: invalid tag given " + initials.tag);
|
|
225
|
+
}
|
|
226
|
+
if (!element) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if (initials.className) {
|
|
230
|
+
element.className = initials.className.trim();
|
|
231
|
+
}
|
|
232
|
+
if (initials.ID) {
|
|
233
|
+
element.setAttribute("id", initials.ID.trim());
|
|
234
|
+
}
|
|
235
|
+
if (initials.innerValue) {
|
|
236
|
+
element.innerText = initials.innerValue;
|
|
237
|
+
}
|
|
238
|
+
for (const prop in properties) {
|
|
239
|
+
if (prop === "style" && typeof properties[prop] === "object") {
|
|
240
|
+
for (const [k, v] of Object.entries(properties[prop])) {
|
|
241
|
+
if ((element.style[k] === "" && k !== "src") ||
|
|
242
|
+
typeof element.style[k] === "string") {
|
|
243
|
+
element.style[k] = v;
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
console.error(element);
|
|
247
|
+
throw new Error("✘ Cradova err : " +
|
|
248
|
+
element +
|
|
249
|
+
" does not have " +
|
|
250
|
+
k +
|
|
251
|
+
" as a valid css style property");
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
if (element.style[prop] === "" && prop !== "src") {
|
|
257
|
+
element.style[prop] = properties[prop];
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
if (prop === "class" && typeof properties[prop] === "string") {
|
|
261
|
+
const classes = properties[prop].split(" ");
|
|
262
|
+
for (let i = 0; i < classes.length; i++) {
|
|
263
|
+
if (classes[i]) {
|
|
264
|
+
element.classList.add(classes[i]);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
if (prop === "text") {
|
|
270
|
+
text = properties[prop];
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
try {
|
|
274
|
+
element[prop] = properties[prop];
|
|
275
|
+
}
|
|
276
|
+
catch (error) {
|
|
277
|
+
console.error(" ✘ Cradova err: cradova got ", properties[prop], " which is invalid!");
|
|
278
|
+
throw new Error(" ✘ Cradova err: invalid props " +
|
|
279
|
+
prop +
|
|
280
|
+
" for this element type with value " +
|
|
281
|
+
properties[prop]);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
//
|
|
285
|
+
// dynamic props
|
|
286
|
+
// over-rides props that appear in the first level
|
|
287
|
+
if (props && typeof props === "object" && !Array.isArray(props)) {
|
|
288
|
+
for (const prop in props) {
|
|
289
|
+
if (prop === "style" && typeof props[prop] === "object") {
|
|
290
|
+
for (const [k, v] of Object.entries(props[prop])) {
|
|
291
|
+
if (typeof element.style[k] !== "undefined" && k !== "src") {
|
|
292
|
+
element.style[k] = v;
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
throw new Error("✘ Cradova err : " +
|
|
296
|
+
k +
|
|
297
|
+
" is not a valid css style property");
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
if (element.style[prop] === "" && prop !== "src") {
|
|
303
|
+
element.style[prop] = props[prop];
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
if (prop === "text" && typeof props[prop] === "string") {
|
|
307
|
+
text = props[prop];
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
if (prop === "class" && typeof props[prop] === "string") {
|
|
311
|
+
element.classList.add(props[prop]);
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
if (prop === "beforeMount") {
|
|
315
|
+
beforeMount = props["beforeMount"];
|
|
316
|
+
props["beforeMount"] = undefined;
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
try {
|
|
320
|
+
element[prop] = props[prop];
|
|
321
|
+
}
|
|
322
|
+
catch (error) {
|
|
323
|
+
console.error(" ✘ Cradova err: ", error);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
// getting children ready
|
|
328
|
+
if (childrens2rd.length) {
|
|
329
|
+
for (let i = 0; i < childrens2rd.length; i++) {
|
|
330
|
+
// single child lane
|
|
331
|
+
if (typeof childrens2rd[i] === "function") {
|
|
332
|
+
let child = childrens2rd[i]();
|
|
333
|
+
if (typeof child === "function") {
|
|
334
|
+
child = child();
|
|
335
|
+
}
|
|
336
|
+
try {
|
|
337
|
+
if (child) {
|
|
338
|
+
element.append(child);
|
|
339
|
+
}
|
|
340
|
+
if (child && child.afterMount) {
|
|
341
|
+
child.afterMount(child);
|
|
342
|
+
child.afterMount = undefined;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
catch (error) {
|
|
346
|
+
console.error(" ✘ Cradova err: ", error);
|
|
347
|
+
if (!(child instanceof HTMLElement)) {
|
|
348
|
+
throw new Error(" ✘ Cradova err: invalid child type: " +
|
|
349
|
+
child +
|
|
350
|
+
" (" +
|
|
351
|
+
typeof child +
|
|
352
|
+
")");
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
continue;
|
|
356
|
+
}
|
|
357
|
+
// children array
|
|
358
|
+
if (Array.isArray(childrens2rd[i])) {
|
|
359
|
+
const arrCX = childrens2rd[i];
|
|
360
|
+
const arrCXLenght = arrCX.length;
|
|
361
|
+
const arrSET = [];
|
|
362
|
+
for (let p = 0; p < arrCXLenght; p++) {
|
|
363
|
+
if (!(arrCX[p] instanceof HTMLElement) &&
|
|
364
|
+
typeof arrCX[p] !== "function" &&
|
|
365
|
+
!Array.isArray(arrCX[p])) {
|
|
366
|
+
console.error(" ✘ Cradova err: ", arrCX[p]);
|
|
367
|
+
throw new TypeError(" ✘ Cradova err: invalid tag type or template literal, cradova was enable to create this element show above ⇑");
|
|
368
|
+
}
|
|
369
|
+
arrSET.push(arrCX[p]);
|
|
370
|
+
}
|
|
371
|
+
//
|
|
372
|
+
childrens2rd = [
|
|
373
|
+
...childrens2rd.slice(0, i + 1),
|
|
374
|
+
...arrSET,
|
|
375
|
+
...childrens2rd.slice(i + 1, childrens2rd.length),
|
|
376
|
+
];
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
const child = childrens2rd[i];
|
|
380
|
+
if (child instanceof HTMLElement ||
|
|
381
|
+
child instanceof DocumentFragment) {
|
|
382
|
+
element.append(child);
|
|
383
|
+
// @ts-ignore
|
|
384
|
+
if (child.afterMount) {
|
|
385
|
+
// @ts-ignore
|
|
386
|
+
child.afterMount(child);
|
|
387
|
+
// @ts-ignore
|
|
388
|
+
child.afterMount = undefined;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
if (typeof child === "string") {
|
|
393
|
+
text = child;
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
console.error(" ✘ Cradova err: got", child);
|
|
397
|
+
throw new Error(" ✘ Cradova err: invalid child type: " +
|
|
398
|
+
"(" +
|
|
399
|
+
typeof child +
|
|
400
|
+
")");
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
//
|
|
406
|
+
if (text) {
|
|
407
|
+
element.innerText = text;
|
|
408
|
+
}
|
|
409
|
+
if (element.stateID) {
|
|
410
|
+
// adding cradova dynamic signature
|
|
411
|
+
element.classList.add("cra_child_doc");
|
|
412
|
+
}
|
|
413
|
+
if (beforeMount) {
|
|
414
|
+
beforeMount(element);
|
|
415
|
+
}
|
|
416
|
+
return element;
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
if (typeof element_initials[0] !== "string") {
|
|
420
|
+
console.error(" ✘ Cradova err: NO TEMPLATE STRING PROVIDED");
|
|
421
|
+
return () => "NO TEMPLATE STRING PROVIDED";
|
|
422
|
+
}
|
|
423
|
+
// const CradovaElement: () => HTMLElement | undefined =
|
|
424
|
+
// identify(element_initials);
|
|
425
|
+
// if (!CradovaElement) {
|
|
426
|
+
// throw new Error(
|
|
427
|
+
// " ✘ Cradova err: invalid element initials " + element_initials
|
|
428
|
+
// );
|
|
429
|
+
// }
|
|
430
|
+
// return CradovaElement;
|
|
431
|
+
return identify(element_initials);
|
|
432
|
+
};
|
|
433
|
+
Init();
|
|
434
|
+
export default _;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAEA;;;;;;;GAOG;AACH,sBACE,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,EACtD,QAAQ,UAAQ,EAChB,OAAO,CAAC,EAAE,WAAW;;;EAgHtB;AC7HD;;;;;;;;;;;;;;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,KAAK,EAAE,OAAO,EAAE,eAAe,CAAC,EAAE,OAAO;IAwB7C;;;;;;;OAOG;IAEH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,OAAO;IAqB1D;;;;;;;;OAQG;IAEH,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,OAAO;IAcxE;;;;;;;;OAQG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,OAAO;IAgB1E;;;;;;OAMG;IACH,YAAY,CACV,IAAI,EAAE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AE,GAAG;IAGlB;;;;;;OAMG;IACH,MAAM,CAAC,GAAG,IAAI,EAAE,GAAG;IAiCnB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,EAAE,GAAG;IAGrB;;;;;;OAMG;IACH,WAAW,CAAC,GAAG,IAAI,EAAE,GAAG;IAkDxB,MAAM;CAGP;AAED;;;;GAIG;AAEH,oBAAoB,MAAM,CAAC,MAAM,WAAW,CAAC,GAAG,WAAW,CAAC;AAE5D,OAAO,MAAM,oBAA8B,YAAY,EAAE,qBAcxD,CAAC;AC/fF;;;;;;GAMG;AAEH,yBACE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACrC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UAsC5B;ACnKD;;;;;;;;;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;ACjFD,gCAAgC,OAAO,EAAE,WAAW,WAUnD;AE4HD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,QAAA,MAAM,CAAC,EAAE,GA2UR,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/utils.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,null,"/* eslint-disable no-undef */\n/*\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 { IsElementInView } from \"./scripts/utils\";\n\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\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 childrens2rd.push(incoming[i]);\n continue;\n }\n\n if (!Array.isArray(incoming[i]) && typeof incoming[i] === \"object\") {\n if (incoming[i].beforeMount) {\n beforeMount = incoming[i][\"beforeMount\"];\n incoming[i][\"beforeMount\"] = undefined;\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 // @ts-ignore\n incoming = undefined;\n\n if (childrens.length) {\n childrens2rd.push(...childrens);\n }\n\n let element: CradovaElementType | undefined;\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.setAttribute(\"id\", initials.ID.trim());\n }\n if (initials.innerValue) {\n element.innerText = initials.innerValue;\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 if (element.style[k] === \"\" && k !== \"src\") {\n element.style[k] = v;\n } else {\n throw new Error(\n \"✘ Cradova err : \" + k + \" is not a valid css style property\"\n );\n }\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 text = 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 if (typeof element.style[k] !== \"undefined\" && k !== \"src\") {\n element.style[k] = v;\n } else {\n throw new Error(\n \"✘ Cradova err : \" +\n k +\n \" is not a valid css style property\"\n );\n }\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 text = 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 props[\"beforeMount\"] = undefined;\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 ) {\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 if (typeof child === \"string\") {\n text = child;\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 //\n if (text) {\n element.innerText = text;\n }\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 return identify(element_initials);\n};\n\nInit();\n\nexport default _;\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
|
1
|
+
{"mappings":"AAEA;;;;;;;GAOG;AACH,sBACE,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,EACtD,QAAQ,UAAQ,EAChB,OAAO,CAAC,EAAE,WAAW;;;EAgHtB;AC7HD;;;;;;;;;;;;;;GAcG;AAEH;IASE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G,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;ACjFD,gCAAgC,OAAO,EAAE,WAAW,WAUnD;AE4HD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,QAAA,MAAM,CAAC,EAAE,GAmVR,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/utils.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,null,"/* eslint-disable no-undef */\n/*\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 { IsElementInView } from \"./scripts/utils\";\n\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\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 childrens2rd.push(incoming[i]);\n continue;\n }\n\n if (!Array.isArray(incoming[i]) && typeof incoming[i] === \"object\") {\n if (incoming[i].beforeMount) {\n beforeMount = incoming[i][\"beforeMount\"];\n incoming[i][\"beforeMount\"] = undefined;\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 // @ts-ignore\n incoming = undefined;\n\n if (childrens.length) {\n childrens2rd.push(...childrens);\n }\n\n let element: CradovaElementType | undefined;\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.setAttribute(\"id\", initials.ID.trim());\n }\n if (initials.innerValue) {\n element.innerText = initials.innerValue;\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 if (\n (element.style[k] === \"\" && k !== \"src\") ||\n typeof element.style[k] === \"string\"\n ) {\n element.style[k] = v;\n } else {\n console.error(element);\n throw new Error(\n \"✘ Cradova err : \" +\n element +\n \" does not have \" +\n k +\n \" as a valid css style property\"\n );\n }\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 text = 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 if (typeof element.style[k] !== \"undefined\" && k !== \"src\") {\n element.style[k] = v;\n } else {\n throw new Error(\n \"✘ Cradova err : \" +\n k +\n \" is not a valid css style property\"\n );\n }\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 text = 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 props[\"beforeMount\"] = undefined;\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 ) {\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 if (typeof child === \"string\") {\n text = child;\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 //\n if (text) {\n element.innerText = text;\n }\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 return identify(element_initials);\n};\n\nInit();\n\nexport default _;\n"],"names":[],"version":3,"file":"module.d.ts.map"}
|
|
@@ -1330,9 +1330,10 @@ const $149c1bd638913645$var$make = function(txx) {
|
|
|
1330
1330
|
if (initials.innerValue) element.innerText = initials.innerValue;
|
|
1331
1331
|
for(const prop in properties){
|
|
1332
1332
|
if (prop === "style" && typeof properties[prop] === "object") {
|
|
1333
|
-
for (const [k, v] of Object.entries(properties[prop]))
|
|
1334
|
-
|
|
1335
|
-
|
|
1333
|
+
for (const [k, v] of Object.entries(properties[prop]))if (element.style[k] === "" && k !== "src" || typeof element.style[k] === "string") element.style[k] = v;
|
|
1334
|
+
else {
|
|
1335
|
+
console.error(element);
|
|
1336
|
+
throw new Error("✘ Cradova err : " + element + " does not have " + k + " as a valid css style property");
|
|
1336
1337
|
}
|
|
1337
1338
|
continue;
|
|
1338
1339
|
}
|