ziko 0.0.20 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/ziko.cjs +463 -189
- package/dist/ziko.js +463 -189
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +457 -189
- package/package.json +1 -1
- package/src/math/functions/helper.js +30 -20
- package/src/math/functions/index.js +2 -1
- package/src/math/index.js +2 -2
- package/src/math/utils/mapfun.js +3 -2
- package/src/ui/elements/primitives/ZikoUIContainerElement.js +108 -149
- package/src/ui/elements/primitives/ZikoUIElement.js +126 -13
- package/src/ui/elements/primitives/misc/hyperscript.js +144 -0
- package/src/ui/elements/primitives/misc/index.js +3 -1
- package/src/ui/elements/primitives/misc/suspense.js +42 -0
- package/starter/bin/index.js +1 -1
- package/src/math/complex/Fractals/julia.js +0 -0
- package/src/ui/elements/derived/elements/Notification.js +0 -0
- package/src/ui/elements/derived/elements/Popover.js +0 -0
- package/src/ui/elements/derived/elements/Popup.js +0 -0
- package/src/ui/elements/derived/elements/Swipper.js +0 -4
- package/src/ui/elements/derived/elements/Timeline.js +0 -0
- package/src/ui/elements/derived/elements/Toast.js +0 -0
- package/src/ui/elements/derived/elements/Treeview.js +0 -0
- package/src/ui/elements/derived/elements/columns.js +0 -1
- package/src/ui/elements/derived/elements/fab.js +0 -0
- package/src/ui/elements/derived/elements/index.js +0 -9
package/dist/ziko.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date :
|
|
5
|
+
Date : Sun Dec 08 2024 23:39:16 GMT+0100 (UTC+01:00)
|
|
6
6
|
Git-Repo : https://github.com/zakarialaoui10/ziko.js
|
|
7
7
|
Git-Wiki : https://github.com/zakarialaoui10/ziko.js/wiki
|
|
8
8
|
Released under MIT License
|
|
@@ -33,36 +33,46 @@
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
const { PI, E } = Math;
|
|
36
|
+
const { PI: PI$1, E } = Math;
|
|
37
37
|
const EPSILON=Number.EPSILON;
|
|
38
38
|
|
|
39
39
|
var __Const__ = /*#__PURE__*/Object.freeze({
|
|
40
40
|
__proto__: null,
|
|
41
41
|
E: E,
|
|
42
42
|
EPSILON: EPSILON,
|
|
43
|
-
PI: PI
|
|
43
|
+
PI: PI$1
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
46
|
+
const {PI, cos: cos$1, sin: sin$1, tan: tan$1, acos: acos$1, asin: asin$1, atan: atan$1, cosh: cosh$1, sinh: sinh$1, tanh: tanh$1, acosh: acosh$1, asinh: asinh$1, atanh: atanh$1, log} = Math;
|
|
47
|
+
let Fixed={
|
|
48
|
+
cos: cos$1,
|
|
49
|
+
sin: sin$1,
|
|
50
|
+
tan: tan$1,
|
|
51
|
+
sinc: x => sin$1(PI*x)/(PI*x),
|
|
52
|
+
sec: x => 1/cos$1(x),
|
|
53
|
+
csc: x => 1/sin$1(x),
|
|
54
|
+
cot: x => 1/tan$1(x),
|
|
55
|
+
acos: acos$1,
|
|
56
|
+
asin: asin$1,
|
|
57
|
+
atan: atan$1,
|
|
58
|
+
acot: x => PI/2-atan$1(x),
|
|
59
|
+
cosh: cosh$1,
|
|
60
|
+
sinh: sinh$1,
|
|
61
|
+
tanh: tanh$1,
|
|
62
|
+
coth: n => (1/2*log((1+n)/(1-n))),
|
|
63
|
+
acosh: acosh$1,
|
|
64
|
+
asinh: asinh$1,
|
|
65
|
+
atanh: atanh$1,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
Fixed = new Proxy(Fixed, {
|
|
69
|
+
get(target, prop) {
|
|
70
|
+
if(prop in target){
|
|
71
|
+
return x => + target[prop](x).toFixed(15);
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
66
76
|
|
|
67
77
|
class ZikoMath {}
|
|
68
78
|
|
|
@@ -106,8 +116,9 @@
|
|
|
106
116
|
default : return fun(x)
|
|
107
117
|
}
|
|
108
118
|
}
|
|
109
|
-
else if(x instanceof Object)
|
|
110
|
-
|
|
119
|
+
else if(x instanceof Object){
|
|
120
|
+
return fun(Object) || Object.fromEntries(Object.entries(x).map(n=>n=[n[0],mapfun$1(fun,n[1])]))
|
|
121
|
+
}
|
|
111
122
|
});
|
|
112
123
|
return Y.length==1?Y[0]:Y;
|
|
113
124
|
};
|
|
@@ -4840,12 +4851,16 @@
|
|
|
4840
4851
|
};
|
|
4841
4852
|
|
|
4842
4853
|
class ZikoUIElement {
|
|
4843
|
-
constructor(element ,name="") {
|
|
4854
|
+
constructor(element ,name="", el_type="html") {
|
|
4844
4855
|
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
|
|
4845
4856
|
if(typeof element === "string") {
|
|
4846
|
-
|
|
4857
|
+
switch(el_type){
|
|
4858
|
+
case "html" : element = globalThis?.document?.createElement(element); break;
|
|
4859
|
+
case "svg" : element = globalThis?.document?.createElementNS("http://www.w3.org/2000/svg", element);
|
|
4860
|
+
default : throw Error("Not supported")
|
|
4861
|
+
}
|
|
4847
4862
|
}
|
|
4848
|
-
if(element)this.
|
|
4863
|
+
if(element)this.__ele__ = element;
|
|
4849
4864
|
this.uuid=this.constructor.name+"-"+Random.string(10);
|
|
4850
4865
|
this.cache = {
|
|
4851
4866
|
name,
|
|
@@ -4881,14 +4896,17 @@
|
|
|
4881
4896
|
this.style({
|
|
4882
4897
|
position: "relative",
|
|
4883
4898
|
boxSizing:"border-box",
|
|
4884
|
-
// fontFamily:"verdana",
|
|
4885
4899
|
margin:0,
|
|
4886
4900
|
padding:0,
|
|
4887
4901
|
});
|
|
4902
|
+
this.items = [];
|
|
4888
4903
|
this.size("auto", "auto");
|
|
4889
4904
|
globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
|
|
4890
4905
|
element && globalThis.__Ziko__.__Config__.default.render && this.render();
|
|
4891
4906
|
}
|
|
4907
|
+
get element(){
|
|
4908
|
+
return this.__ele__
|
|
4909
|
+
}
|
|
4892
4910
|
get isZikoUIElement(){
|
|
4893
4911
|
return true
|
|
4894
4912
|
}
|
|
@@ -4910,15 +4928,6 @@
|
|
|
4910
4928
|
get isBody(){
|
|
4911
4929
|
return this.element === globalThis?.document.body;
|
|
4912
4930
|
}
|
|
4913
|
-
get __app__(){
|
|
4914
|
-
if(this.cache.isRoot)return this;
|
|
4915
|
-
let root=this.cache.parent;
|
|
4916
|
-
while(1){
|
|
4917
|
-
if(!root)return null;
|
|
4918
|
-
if(root.cache.isRoot)return root;
|
|
4919
|
-
root=root.parent;
|
|
4920
|
-
}
|
|
4921
|
-
}
|
|
4922
4931
|
get parent(){
|
|
4923
4932
|
return this.cache.parent;
|
|
4924
4933
|
}
|
|
@@ -4958,6 +4967,120 @@
|
|
|
4958
4967
|
this.st.size(width,height);
|
|
4959
4968
|
return this;
|
|
4960
4969
|
}
|
|
4970
|
+
maintain() {
|
|
4971
|
+
for (let i = 0; i < this.items.length; i++)
|
|
4972
|
+
Object.assign(this, { [[i]]: this.items[i] });
|
|
4973
|
+
this.length = this.items.length;
|
|
4974
|
+
return this;
|
|
4975
|
+
}
|
|
4976
|
+
at(index) {
|
|
4977
|
+
return this.items.at(index);
|
|
4978
|
+
}
|
|
4979
|
+
#addItem(adder, pusher, ...ele) {
|
|
4980
|
+
if (this.cache.isFrozzen) {
|
|
4981
|
+
console.warn("You can't append new item to frozzen element");
|
|
4982
|
+
return this;
|
|
4983
|
+
}
|
|
4984
|
+
for (let i = 0; i < ele.length; i++) {
|
|
4985
|
+
if (["number", "string"].includes(typeof ele[i])) ele[i] = text$1(ele[i]);
|
|
4986
|
+
if (ele[i] instanceof ZikoUIElement) {
|
|
4987
|
+
ele[i].cache.parent = this;
|
|
4988
|
+
this.element[adder](ele[i].element);
|
|
4989
|
+
ele[i].target = this.element;
|
|
4990
|
+
this.items[pusher](ele[i]);
|
|
4991
|
+
} else if (ele[i] instanceof Object) {
|
|
4992
|
+
if (ele[i]?.style) this.style(ele[i]?.style);
|
|
4993
|
+
if (ele[i]?.attr) {
|
|
4994
|
+
Object.entries(ele[i].attr).forEach((n) =>
|
|
4995
|
+
this.setAttr("" + n[0], n[1]),
|
|
4996
|
+
);
|
|
4997
|
+
}
|
|
4998
|
+
}
|
|
4999
|
+
}
|
|
5000
|
+
this.maintain();
|
|
5001
|
+
return this;
|
|
5002
|
+
}
|
|
5003
|
+
append(...ele) {
|
|
5004
|
+
this.#addItem("append", "push", ...ele);
|
|
5005
|
+
return this;
|
|
5006
|
+
}
|
|
5007
|
+
prepend(...ele) {
|
|
5008
|
+
this.#addItem("prepend", "unshift", ...ele);
|
|
5009
|
+
return this;
|
|
5010
|
+
}
|
|
5011
|
+
insertAt(index, ...ele) {
|
|
5012
|
+
if (index >= this.element.children.length) this.append(...ele);
|
|
5013
|
+
else
|
|
5014
|
+
for (let i = 0; i < ele.length; i++) {
|
|
5015
|
+
if (["number", "string"].includes(typeof ele[i])) ele[i] = text$1(ele[i]);
|
|
5016
|
+
this.element?.insertBefore(ele[i].element, this.items[index].element);
|
|
5017
|
+
this.items.splice(index, 0, ele[i]);
|
|
5018
|
+
}
|
|
5019
|
+
return this;
|
|
5020
|
+
}
|
|
5021
|
+
remove(...ele) {
|
|
5022
|
+
const remove = (ele) => {
|
|
5023
|
+
if (typeof ele === "number") ele = this.items[ele];
|
|
5024
|
+
if (ele instanceof ZikoUIElement) this.element?.removeChild(ele.element);
|
|
5025
|
+
this.items = this.items.filter((n) => n !== ele);
|
|
5026
|
+
};
|
|
5027
|
+
for (let i = 0; i < ele.length; i++) remove(ele[i]);
|
|
5028
|
+
for (let i = 0; i < this.items.length; i++)
|
|
5029
|
+
Object.assign(this, { [[i]]: this.items[i] });
|
|
5030
|
+
// Remove from item
|
|
5031
|
+
return this;
|
|
5032
|
+
}
|
|
5033
|
+
forEach(callback) {
|
|
5034
|
+
this.items.forEach(callback);
|
|
5035
|
+
return this;
|
|
5036
|
+
}
|
|
5037
|
+
map(callback) {
|
|
5038
|
+
return this.items.map(callback);
|
|
5039
|
+
}
|
|
5040
|
+
find(condition) {
|
|
5041
|
+
return this.items.filter(condition);
|
|
5042
|
+
}
|
|
5043
|
+
filter(condition_callback, if_callback = () => {}, else_callback = () => {}) {
|
|
5044
|
+
const FilterItems = this.items.filter(condition_callback);
|
|
5045
|
+
FilterItems.forEach(if_callback);
|
|
5046
|
+
this.items
|
|
5047
|
+
.filter((item) => !FilterItems.includes(item))
|
|
5048
|
+
.forEach(else_callback);
|
|
5049
|
+
return this;
|
|
5050
|
+
}
|
|
5051
|
+
filterByTextContent(text, exactMatch = false) {
|
|
5052
|
+
this.items.forEach((n) => n.render());
|
|
5053
|
+
this.filter(
|
|
5054
|
+
(n) => !(exactMatch ? n.text === text : n.text.includes(text)),
|
|
5055
|
+
(e) => e.unrender(),
|
|
5056
|
+
);
|
|
5057
|
+
// this.items.filter(n=>{
|
|
5058
|
+
// const content=n.element.textContent;
|
|
5059
|
+
// return !(exactMatch?content===text:content.includes(text))
|
|
5060
|
+
// }).map(n=>n.unrender());
|
|
5061
|
+
// return this;
|
|
5062
|
+
}
|
|
5063
|
+
filterByClass(value) {
|
|
5064
|
+
this.items.map((n) => n.render());
|
|
5065
|
+
this.items
|
|
5066
|
+
.filter((n) => !n.classes.includes(value))
|
|
5067
|
+
.map((n) => n.unrender());
|
|
5068
|
+
return this;
|
|
5069
|
+
}
|
|
5070
|
+
sortByTextContent(value, displays) {
|
|
5071
|
+
let item = this.children;
|
|
5072
|
+
item
|
|
5073
|
+
.filter((n) => !n.textContent.toLowerCase().includes(value.toLowerCase()))
|
|
5074
|
+
.map((n) => {
|
|
5075
|
+
n.style.display = "none";
|
|
5076
|
+
});
|
|
5077
|
+
item
|
|
5078
|
+
.filter((n) => n.textContent.toLowerCase().includes(value.toLowerCase()))
|
|
5079
|
+
.map((n, i) => (n.style.display = displays[i]));
|
|
5080
|
+
//return item.filter(n=>n.style.display!="none")
|
|
5081
|
+
item.filter((n) => n.style.display != "none");
|
|
5082
|
+
return this;
|
|
5083
|
+
}
|
|
4961
5084
|
get #SwitchedStyleRTL_LTR(){
|
|
4962
5085
|
const CalculedStyle = globalThis.getComputedStyle(this.element);
|
|
4963
5086
|
const SwitchedStyle = {};
|
|
@@ -5313,161 +5436,120 @@
|
|
|
5313
5436
|
super(element, name);
|
|
5314
5437
|
this.items = [];
|
|
5315
5438
|
}
|
|
5316
|
-
maintain() {
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
}
|
|
5322
|
-
at(index) {
|
|
5323
|
-
|
|
5324
|
-
}
|
|
5325
|
-
#addItem(adder, pusher, ...ele) {
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
}
|
|
5344
|
-
}
|
|
5345
|
-
}
|
|
5346
|
-
this.maintain();
|
|
5347
|
-
return this;
|
|
5348
|
-
}
|
|
5349
|
-
append(...ele) {
|
|
5350
|
-
this.#addItem("append", "push", ...ele);
|
|
5351
|
-
return this;
|
|
5352
|
-
}
|
|
5353
|
-
prepend(...ele) {
|
|
5354
|
-
this.#addItem("prepend", "unshift", ...ele);
|
|
5355
|
-
return this;
|
|
5356
|
-
}
|
|
5357
|
-
// append(...ele) {
|
|
5358
|
-
// if(this.cache.isFrozzen){
|
|
5359
|
-
// console.warn("You can't append new item to frozzen element");
|
|
5360
|
-
// return this;
|
|
5361
|
-
// }
|
|
5362
|
-
// for (let i = 0; i < ele.length; i++){
|
|
5363
|
-
// if(["number","string"].includes(typeof ele[i]))ele[i]=text(ele[i]);
|
|
5364
|
-
// if (ele[i] instanceof ZikoUIElement) {
|
|
5365
|
-
// ele[i].cache.parent=this;
|
|
5366
|
-
// this.element?.appendChild(ele[i].element);
|
|
5367
|
-
// ele[i].target = this.element;
|
|
5368
|
-
// this.items.push(ele[i]);
|
|
5369
|
-
// } else if (ele[i] instanceof Object) {
|
|
5370
|
-
// if (ele[i]?.style) this.style(ele[i]?.style);
|
|
5371
|
-
// if (ele[i]?.attr) {
|
|
5372
|
-
// Object.entries(ele[i].attr).forEach((n) =>
|
|
5373
|
-
// this.setAttr("" + n[0], n[1]),
|
|
5374
|
-
// );
|
|
5375
|
-
// }
|
|
5439
|
+
// maintain() {
|
|
5440
|
+
// for (let i = 0; i < this.items.length; i++)
|
|
5441
|
+
// Object.assign(this, { [[i]]: this.items[i] });
|
|
5442
|
+
// this.length = this.items.length;
|
|
5443
|
+
// return this;
|
|
5444
|
+
// }
|
|
5445
|
+
// at(index) {
|
|
5446
|
+
// return this.items.at(index);
|
|
5447
|
+
// }
|
|
5448
|
+
// #addItem(adder, pusher, ...ele) {
|
|
5449
|
+
// if (this.cache.isFrozzen) {
|
|
5450
|
+
// console.warn("You can't append new item to frozzen element");
|
|
5451
|
+
// return this;
|
|
5452
|
+
// }
|
|
5453
|
+
// for (let i = 0; i < ele.length; i++) {
|
|
5454
|
+
// if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
5455
|
+
// if (ele[i] instanceof ZikoUIElement) {
|
|
5456
|
+
// ele[i].cache.parent = this;
|
|
5457
|
+
// this.element[adder](ele[i].element);
|
|
5458
|
+
// ele[i].target = this.element;
|
|
5459
|
+
// this.items[pusher](ele[i]);
|
|
5460
|
+
// } else if (ele[i] instanceof Object) {
|
|
5461
|
+
// if (ele[i]?.style) this.style(ele[i]?.style);
|
|
5462
|
+
// if (ele[i]?.attr) {
|
|
5463
|
+
// Object.entries(ele[i].attr).forEach((n) =>
|
|
5464
|
+
// this.setAttr("" + n[0], n[1]),
|
|
5465
|
+
// );
|
|
5376
5466
|
// }
|
|
5377
5467
|
// }
|
|
5378
|
-
// this.maintain();
|
|
5379
|
-
// return this;
|
|
5380
5468
|
// }
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5469
|
+
// this.maintain();
|
|
5470
|
+
// return this;
|
|
5471
|
+
// }
|
|
5472
|
+
// append(...ele) {
|
|
5473
|
+
// this.#addItem("append", "push", ...ele);
|
|
5474
|
+
// return this;
|
|
5475
|
+
// }
|
|
5476
|
+
// prepend(...ele) {
|
|
5477
|
+
// this.#addItem("prepend", "unshift", ...ele);
|
|
5478
|
+
// return this;
|
|
5479
|
+
// }
|
|
5480
|
+
// insertAt(index, ...ele) {
|
|
5481
|
+
// if (index >= this.element.children.length) this.append(...ele);
|
|
5482
|
+
// else
|
|
5483
|
+
// for (let i = 0; i < ele.length; i++) {
|
|
5484
|
+
// if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
5485
|
+
// this.element?.insertBefore(ele[i].element, this.items[index].element);
|
|
5486
|
+
// this.items.splice(index, 0, ele[i]);
|
|
5487
|
+
// }
|
|
5488
|
+
// return this;
|
|
5489
|
+
// }
|
|
5391
5490
|
// remove(...ele) {
|
|
5392
|
-
//
|
|
5393
|
-
// if(
|
|
5394
|
-
//
|
|
5395
|
-
//
|
|
5396
|
-
//
|
|
5397
|
-
//
|
|
5398
|
-
//
|
|
5399
|
-
//
|
|
5400
|
-
//
|
|
5401
|
-
//
|
|
5402
|
-
//
|
|
5403
|
-
//
|
|
5404
|
-
//
|
|
5405
|
-
//
|
|
5491
|
+
// const remove = (ele) => {
|
|
5492
|
+
// if (typeof ele === "number") ele = this.items[ele];
|
|
5493
|
+
// if (ele instanceof ZikoUIElement) this.element?.removeChild(ele.element);
|
|
5494
|
+
// this.items = this.items.filter((n) => n !== ele);
|
|
5495
|
+
// };
|
|
5496
|
+
// for (let i = 0; i < ele.length; i++) remove(ele[i]);
|
|
5497
|
+
// for (let i = 0; i < this.items.length; i++)
|
|
5498
|
+
// Object.assign(this, { [[i]]: this.items[i] });
|
|
5499
|
+
// // Remove from item
|
|
5500
|
+
// return this;
|
|
5501
|
+
// }
|
|
5502
|
+
// forEach(callback) {
|
|
5503
|
+
// this.items.forEach(callback);
|
|
5504
|
+
// return this;
|
|
5505
|
+
// }
|
|
5506
|
+
// map(callback) {
|
|
5507
|
+
// return this.items.map(callback);
|
|
5508
|
+
// }
|
|
5509
|
+
// find(condition) {
|
|
5510
|
+
// return this.items.filter(condition);
|
|
5511
|
+
// }
|
|
5512
|
+
// filter(condition_callback, if_callback = () => {}, else_callback = () => {}) {
|
|
5513
|
+
// const FilterItems = this.items.filter(condition_callback);
|
|
5514
|
+
// FilterItems.forEach(if_callback);
|
|
5515
|
+
// this.items
|
|
5516
|
+
// .filter((item) => !FilterItems.includes(item))
|
|
5517
|
+
// .forEach(else_callback);
|
|
5518
|
+
// return this;
|
|
5519
|
+
// }
|
|
5520
|
+
// filterByTextContent(text, exactMatch = false) {
|
|
5521
|
+
// this.items.forEach((n) => n.render());
|
|
5522
|
+
// this.filter(
|
|
5523
|
+
// (n) => !(exactMatch ? n.text === text : n.text.includes(text)),
|
|
5524
|
+
// (e) => e.unrender(),
|
|
5525
|
+
// );
|
|
5526
|
+
// // this.items.filter(n=>{
|
|
5527
|
+
// // const content=n.element.textContent;
|
|
5528
|
+
// // return !(exactMatch?content===text:content.includes(text))
|
|
5529
|
+
// // }).map(n=>n.unrender());
|
|
5530
|
+
// // return this;
|
|
5531
|
+
// }
|
|
5532
|
+
// filterByClass(value) {
|
|
5533
|
+
// this.items.map((n) => n.render());
|
|
5534
|
+
// this.items
|
|
5535
|
+
// .filter((n) => !n.classes.includes(value))
|
|
5536
|
+
// .map((n) => n.unrender());
|
|
5537
|
+
// return this;
|
|
5538
|
+
// }
|
|
5539
|
+
// sortByTextContent(value, displays) {
|
|
5540
|
+
// let item = this.children;
|
|
5541
|
+
// item
|
|
5542
|
+
// .filter((n) => !n.textContent.toLowerCase().includes(value.toLowerCase()))
|
|
5543
|
+
// .map((n) => {
|
|
5544
|
+
// n.style.display = "none";
|
|
5545
|
+
// });
|
|
5546
|
+
// item
|
|
5547
|
+
// .filter((n) => n.textContent.toLowerCase().includes(value.toLowerCase()))
|
|
5548
|
+
// .map((n, i) => (n.style.display = displays[i]));
|
|
5549
|
+
// //return item.filter(n=>n.style.display!="none")
|
|
5550
|
+
// item.filter((n) => n.style.display != "none");
|
|
5406
5551
|
// return this;
|
|
5407
5552
|
// }
|
|
5408
|
-
remove(...ele) {
|
|
5409
|
-
const remove = (ele) => {
|
|
5410
|
-
if (typeof ele === "number") ele = this.items[ele];
|
|
5411
|
-
if (ele instanceof ZikoUIElement) this.element?.removeChild(ele.element);
|
|
5412
|
-
this.items = this.items.filter((n) => n !== ele);
|
|
5413
|
-
};
|
|
5414
|
-
for (let i = 0; i < ele.length; i++) remove(ele[i]);
|
|
5415
|
-
for (let i = 0; i < this.items.length; i++)
|
|
5416
|
-
Object.assign(this, { [[i]]: this.items[i] });
|
|
5417
|
-
// Remove from item
|
|
5418
|
-
return this;
|
|
5419
|
-
}
|
|
5420
|
-
forEach(callback) {
|
|
5421
|
-
this.items.forEach(callback);
|
|
5422
|
-
return this;
|
|
5423
|
-
}
|
|
5424
|
-
map(callback) {
|
|
5425
|
-
return this.items.map(callback);
|
|
5426
|
-
}
|
|
5427
|
-
find(condition) {
|
|
5428
|
-
return this.items.filter(condition);
|
|
5429
|
-
}
|
|
5430
|
-
filter(condition_callback, if_callback = () => {}, else_callback = () => {}) {
|
|
5431
|
-
const FilterItems = this.items.filter(condition_callback);
|
|
5432
|
-
FilterItems.forEach(if_callback);
|
|
5433
|
-
this.items
|
|
5434
|
-
.filter((item) => !FilterItems.includes(item))
|
|
5435
|
-
.forEach(else_callback);
|
|
5436
|
-
return this;
|
|
5437
|
-
}
|
|
5438
|
-
filterByTextContent(text, exactMatch = false) {
|
|
5439
|
-
this.items.forEach((n) => n.render());
|
|
5440
|
-
this.filter(
|
|
5441
|
-
(n) => !(exactMatch ? n.text === text : n.text.includes(text)),
|
|
5442
|
-
(e) => e.unrender(),
|
|
5443
|
-
);
|
|
5444
|
-
// this.items.filter(n=>{
|
|
5445
|
-
// const content=n.element.textContent;
|
|
5446
|
-
// return !(exactMatch?content===text:content.includes(text))
|
|
5447
|
-
// }).map(n=>n.unrender());
|
|
5448
|
-
// return this;
|
|
5449
|
-
}
|
|
5450
|
-
filterByClass(value) {
|
|
5451
|
-
this.items.map((n) => n.render());
|
|
5452
|
-
this.items
|
|
5453
|
-
.filter((n) => !n.classes.includes(value))
|
|
5454
|
-
.map((n) => n.unrender());
|
|
5455
|
-
return this;
|
|
5456
|
-
}
|
|
5457
|
-
sortByTextContent(value, displays) {
|
|
5458
|
-
let item = this.children;
|
|
5459
|
-
item
|
|
5460
|
-
.filter((n) => !n.textContent.toLowerCase().includes(value.toLowerCase()))
|
|
5461
|
-
.map((n) => {
|
|
5462
|
-
n.style.display = "none";
|
|
5463
|
-
});
|
|
5464
|
-
item
|
|
5465
|
-
.filter((n) => n.textContent.toLowerCase().includes(value.toLowerCase()))
|
|
5466
|
-
.map((n, i) => (n.style.display = displays[i]));
|
|
5467
|
-
//return item.filter(n=>n.style.display!="none")
|
|
5468
|
-
item.filter((n) => n.style.display != "none");
|
|
5469
|
-
return this;
|
|
5470
|
-
}
|
|
5471
5553
|
}
|
|
5472
5554
|
|
|
5473
5555
|
class __ZikoUIText__ extends ZikoUIContainerElement {
|
|
@@ -6136,6 +6218,186 @@
|
|
|
6136
6218
|
const HTMLWrapper = (HTMLContent) => new ZikoUIHTMLWrapper(HTMLContent);
|
|
6137
6219
|
const SVGWrapper = (SVGContent) => new ZikoUISVGWrapper(SVGContent);
|
|
6138
6220
|
|
|
6221
|
+
// function loadComponent() {
|
|
6222
|
+
// return new Promise((resolve) => {
|
|
6223
|
+
// setTimeout(() => {
|
|
6224
|
+
// resolve(p(1000))
|
|
6225
|
+
// }, 500);
|
|
6226
|
+
// });
|
|
6227
|
+
// }
|
|
6228
|
+
|
|
6229
|
+
// Suspense(p("Loading ..."),()=>fetch('https://jsonplaceholder.typicode.com/todos/1')
|
|
6230
|
+
// .then(response => response.json())
|
|
6231
|
+
// .then(json => h2(json.title)))
|
|
6232
|
+
|
|
6233
|
+
|
|
6234
|
+
|
|
6235
|
+
class ZikoUISuspense extends ZikoUIElement{
|
|
6236
|
+
constructor(fallback_ui, callback){
|
|
6237
|
+
super("div", "suspense");
|
|
6238
|
+
this.setAttr({
|
|
6239
|
+
dataTemp : "suspense"
|
|
6240
|
+
});
|
|
6241
|
+
this.fallback_ui = fallback_ui;
|
|
6242
|
+
this.append(fallback_ui);
|
|
6243
|
+
(async ()=>{
|
|
6244
|
+
try{
|
|
6245
|
+
const ui = await callback();
|
|
6246
|
+
fallback_ui.unrender();
|
|
6247
|
+
this.append(ui);
|
|
6248
|
+
// console.log(content)
|
|
6249
|
+
}
|
|
6250
|
+
catch(error){
|
|
6251
|
+
console.log({error});
|
|
6252
|
+
}
|
|
6253
|
+
})();
|
|
6254
|
+
}
|
|
6255
|
+
}
|
|
6256
|
+
|
|
6257
|
+
const Suspense = (fallback_ui, callback) => new ZikoUISuspense(fallback_ui, callback);
|
|
6258
|
+
|
|
6259
|
+
const _h=(tag, type, attributes, ...children)=>{
|
|
6260
|
+
const { name, style, ...attrs } = attributes;
|
|
6261
|
+
let element = new ZikoUIElement(tag, name, type);
|
|
6262
|
+
style && element.style(style);
|
|
6263
|
+
attrs && element.setAttr(attrs);
|
|
6264
|
+
children && element.append(...children);
|
|
6265
|
+
return element;
|
|
6266
|
+
};
|
|
6267
|
+
const h=(tag, attributes = {}, ...children)=> _h(tag, "html", attributes, ...children);
|
|
6268
|
+
const s=(tag, attributes = {}, ...children)=> _h(tag, "svg", attributes, ...children);
|
|
6269
|
+
|
|
6270
|
+
const HTMLTags = [
|
|
6271
|
+
'a',
|
|
6272
|
+
'abb',
|
|
6273
|
+
'address',
|
|
6274
|
+
'area',
|
|
6275
|
+
'article',
|
|
6276
|
+
'aside',
|
|
6277
|
+
'audio',
|
|
6278
|
+
'b',
|
|
6279
|
+
'base',
|
|
6280
|
+
'bdi',
|
|
6281
|
+
'bdo',
|
|
6282
|
+
'blockquote',
|
|
6283
|
+
'br',
|
|
6284
|
+
'button',
|
|
6285
|
+
'canvas',
|
|
6286
|
+
'caption',
|
|
6287
|
+
'cite',
|
|
6288
|
+
'code',
|
|
6289
|
+
'col',
|
|
6290
|
+
'colgroup',
|
|
6291
|
+
'data',
|
|
6292
|
+
'datalist',
|
|
6293
|
+
'dd',
|
|
6294
|
+
'del',
|
|
6295
|
+
'details',
|
|
6296
|
+
'dfn',
|
|
6297
|
+
'dialog',
|
|
6298
|
+
'div',
|
|
6299
|
+
'dl',
|
|
6300
|
+
'dt',
|
|
6301
|
+
'em',
|
|
6302
|
+
'embed',
|
|
6303
|
+
'fieldset',
|
|
6304
|
+
'figcaption',
|
|
6305
|
+
'figure',
|
|
6306
|
+
'footer',
|
|
6307
|
+
'form',
|
|
6308
|
+
'h1',
|
|
6309
|
+
'h2',
|
|
6310
|
+
'h3',
|
|
6311
|
+
'h4',
|
|
6312
|
+
'h5',
|
|
6313
|
+
'h6',
|
|
6314
|
+
'header',
|
|
6315
|
+
'hgroup',
|
|
6316
|
+
'hr',
|
|
6317
|
+
'i',
|
|
6318
|
+
'iframe',
|
|
6319
|
+
'img',
|
|
6320
|
+
'ipnut',
|
|
6321
|
+
'ins',
|
|
6322
|
+
'kbd',
|
|
6323
|
+
'label',
|
|
6324
|
+
'legend',
|
|
6325
|
+
'li',
|
|
6326
|
+
'main',
|
|
6327
|
+
'map',
|
|
6328
|
+
'mark',
|
|
6329
|
+
'menu',
|
|
6330
|
+
'meter',
|
|
6331
|
+
'nav',
|
|
6332
|
+
'object',
|
|
6333
|
+
'ol',
|
|
6334
|
+
'optgroup',
|
|
6335
|
+
'option',
|
|
6336
|
+
'output',
|
|
6337
|
+
'p',
|
|
6338
|
+
'param',
|
|
6339
|
+
'picture',
|
|
6340
|
+
'pre',
|
|
6341
|
+
'progress',
|
|
6342
|
+
'q',
|
|
6343
|
+
'rp',
|
|
6344
|
+
'rt',
|
|
6345
|
+
'ruby',
|
|
6346
|
+
's',
|
|
6347
|
+
'samp',
|
|
6348
|
+
'search',
|
|
6349
|
+
'section',
|
|
6350
|
+
'select',
|
|
6351
|
+
'small',
|
|
6352
|
+
'source',
|
|
6353
|
+
'span',
|
|
6354
|
+
'strong',
|
|
6355
|
+
'sub',
|
|
6356
|
+
'summary',
|
|
6357
|
+
'sup',
|
|
6358
|
+
'svg',
|
|
6359
|
+
'table',
|
|
6360
|
+
'tbody',
|
|
6361
|
+
'td',
|
|
6362
|
+
'template',
|
|
6363
|
+
'textarea',
|
|
6364
|
+
'tfoot',
|
|
6365
|
+
'th',
|
|
6366
|
+
'thead',
|
|
6367
|
+
'time',
|
|
6368
|
+
'title',
|
|
6369
|
+
'tr',
|
|
6370
|
+
'track',
|
|
6371
|
+
'u',
|
|
6372
|
+
'ul',
|
|
6373
|
+
'var',
|
|
6374
|
+
'video',
|
|
6375
|
+
'wbr'
|
|
6376
|
+
];
|
|
6377
|
+
|
|
6378
|
+
const SVGTags = [
|
|
6379
|
+
"svg", "g", "defs", "symbol", "use", "image", "switch",
|
|
6380
|
+
"rect", "circle", "ellipse", "line", "polyline", "polygon", "path",
|
|
6381
|
+
"text", "tspan", "textPath", "altGlyph", "altGlyphDef", "altGlyphItem", "glyph", "glyphRef",
|
|
6382
|
+
"linearGradient", "radialGradient", "pattern", "solidColor",
|
|
6383
|
+
"filter", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix",
|
|
6384
|
+
"feDiffuseLighting", "feDisplacementMap", "feDropShadow", "feFlood", "feFuncA", "feFuncR", "feFuncG", "feFuncB",
|
|
6385
|
+
"feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "feSpecularLighting",
|
|
6386
|
+
"feTile", "feTurbulence",
|
|
6387
|
+
"animate", "animateMotion", "animateTransform", "set",
|
|
6388
|
+
"script",
|
|
6389
|
+
"desc", "title", "metadata", "foreignObject"
|
|
6390
|
+
];
|
|
6391
|
+
|
|
6392
|
+
const hTags = HTMLTags.reduce((acc, key) => {
|
|
6393
|
+
acc[key] = (attr, ...children) => h(key, attr, ...children);
|
|
6394
|
+
return acc;
|
|
6395
|
+
}, {});
|
|
6396
|
+
const sTags = SVGTags.reduce((acc, key) => {
|
|
6397
|
+
acc[key] = (attr, ...children) => h(key, attr, ...children);
|
|
6398
|
+
return acc;
|
|
6399
|
+
}, {});
|
|
6400
|
+
|
|
6139
6401
|
class ZikoUIHtmlTag extends ZikoUIContainerElement {
|
|
6140
6402
|
constructor(element) {
|
|
6141
6403
|
super(element,"html");
|
|
@@ -6226,20 +6488,26 @@
|
|
|
6226
6488
|
__proto__: null,
|
|
6227
6489
|
HTMLWrapper: HTMLWrapper,
|
|
6228
6490
|
SVGWrapper: SVGWrapper,
|
|
6491
|
+
Suspense: Suspense,
|
|
6229
6492
|
ZikoUIBr: ZikoUIBr,
|
|
6230
6493
|
ZikoUIHTMLWrapper: ZikoUIHTMLWrapper,
|
|
6231
6494
|
ZikoUIHr: ZikoUIHr,
|
|
6232
6495
|
ZikoUIHtmlTag: ZikoUIHtmlTag,
|
|
6233
6496
|
ZikoUILink: ZikoUILink,
|
|
6234
6497
|
ZikoUISVGWrapper: ZikoUISVGWrapper,
|
|
6498
|
+
ZikoUISuspense: ZikoUISuspense,
|
|
6235
6499
|
ZikoUIXMLWrapper: ZikoUIXMLWrapper,
|
|
6236
6500
|
br: br,
|
|
6237
6501
|
brs: brs,
|
|
6238
6502
|
btn: btn,
|
|
6503
|
+
h: h,
|
|
6504
|
+
hTags: hTags,
|
|
6239
6505
|
hr: hr,
|
|
6240
6506
|
hrs: hrs,
|
|
6241
6507
|
html: html,
|
|
6242
|
-
link: link
|
|
6508
|
+
link: link,
|
|
6509
|
+
s: s,
|
|
6510
|
+
sTags: sTags
|
|
6243
6511
|
});
|
|
6244
6512
|
|
|
6245
6513
|
class ZikoUIInputImage extends ZikoUIElement {
|
|
@@ -11645,7 +11913,7 @@
|
|
|
11645
11913
|
exports.Matrix = Matrix;
|
|
11646
11914
|
exports.Modal = Modal;
|
|
11647
11915
|
exports.Nav = Nav;
|
|
11648
|
-
exports.PI = PI;
|
|
11916
|
+
exports.PI = PI$1;
|
|
11649
11917
|
exports.Permutation = Permutation;
|
|
11650
11918
|
exports.Random = Random;
|
|
11651
11919
|
exports.SPA = SPA;
|
|
@@ -11654,6 +11922,7 @@
|
|
|
11654
11922
|
exports.Slider = Slider;
|
|
11655
11923
|
exports.Splitter = Splitter;
|
|
11656
11924
|
exports.Str = Str;
|
|
11925
|
+
exports.Suspense = Suspense;
|
|
11657
11926
|
exports.Svg = Svg;
|
|
11658
11927
|
exports.Table = Table$1;
|
|
11659
11928
|
exports.Tabs = Tabs;
|
|
@@ -11739,6 +12008,7 @@
|
|
|
11739
12008
|
exports.ZikoUISelect = ZikoUISelect;
|
|
11740
12009
|
exports.ZikoUISubText = ZikoUISubText;
|
|
11741
12010
|
exports.ZikoUISupText = ZikoUISupText;
|
|
12011
|
+
exports.ZikoUISuspense = ZikoUISuspense;
|
|
11742
12012
|
exports.ZikoUISvg = ZikoUISvg;
|
|
11743
12013
|
exports.ZikoUIText = ZikoUIText;
|
|
11744
12014
|
exports.ZikoUITextArea = ZikoUITextArea;
|
|
@@ -11810,6 +12080,7 @@
|
|
|
11810
12080
|
exports.floor = floor;
|
|
11811
12081
|
exports.gamma = gamma;
|
|
11812
12082
|
exports.geomspace = geomspace;
|
|
12083
|
+
exports.h = h;
|
|
11813
12084
|
exports.h1 = h1;
|
|
11814
12085
|
exports.h2 = h2;
|
|
11815
12086
|
exports.h3 = h3;
|
|
@@ -11818,6 +12089,7 @@
|
|
|
11818
12089
|
exports.h6 = h6;
|
|
11819
12090
|
exports.hSlider = hSlider;
|
|
11820
12091
|
exports.hSplitter = hSplitter;
|
|
12092
|
+
exports.hTags = hTags;
|
|
11821
12093
|
exports.hr = hr;
|
|
11822
12094
|
exports.hrs = hrs;
|
|
11823
12095
|
exports.html = html;
|
|
@@ -11882,6 +12154,8 @@
|
|
|
11882
12154
|
exports.radio = radio;
|
|
11883
12155
|
exports.removeExtraSpace = removeExtraSpace;
|
|
11884
12156
|
exports.round = round;
|
|
12157
|
+
exports.s = s;
|
|
12158
|
+
exports.sTags = sTags;
|
|
11885
12159
|
exports.search = search;
|
|
11886
12160
|
exports.sec = sec;
|
|
11887
12161
|
exports.select = select;
|