ziko 0.0.20 → 0.0.21
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/dist/ziko.cjs +317 -186
- package/dist/ziko.js +317 -186
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +314 -186
- package/package.json +2 -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 +119 -11
- package/src/ui/elements/primitives/misc/hyperscript.js +11 -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 12:19:40 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
|
};
|
|
@@ -4845,7 +4856,7 @@
|
|
|
4845
4856
|
if(typeof element === "string") {
|
|
4846
4857
|
element === "svg" ? element=globalThis?.document?.createElementNS("http://www.w3.org/2000/svg", "svg"): element = globalThis?.document?.createElement(element);
|
|
4847
4858
|
}
|
|
4848
|
-
if(element)this.
|
|
4859
|
+
if(element)this.__ele__ = element;
|
|
4849
4860
|
this.uuid=this.constructor.name+"-"+Random.string(10);
|
|
4850
4861
|
this.cache = {
|
|
4851
4862
|
name,
|
|
@@ -4881,14 +4892,17 @@
|
|
|
4881
4892
|
this.style({
|
|
4882
4893
|
position: "relative",
|
|
4883
4894
|
boxSizing:"border-box",
|
|
4884
|
-
// fontFamily:"verdana",
|
|
4885
4895
|
margin:0,
|
|
4886
4896
|
padding:0,
|
|
4887
4897
|
});
|
|
4898
|
+
this.items = [];
|
|
4888
4899
|
this.size("auto", "auto");
|
|
4889
4900
|
globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
|
|
4890
4901
|
element && globalThis.__Ziko__.__Config__.default.render && this.render();
|
|
4891
4902
|
}
|
|
4903
|
+
get element(){
|
|
4904
|
+
return this.__ele__
|
|
4905
|
+
}
|
|
4892
4906
|
get isZikoUIElement(){
|
|
4893
4907
|
return true
|
|
4894
4908
|
}
|
|
@@ -4910,15 +4924,6 @@
|
|
|
4910
4924
|
get isBody(){
|
|
4911
4925
|
return this.element === globalThis?.document.body;
|
|
4912
4926
|
}
|
|
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
4927
|
get parent(){
|
|
4923
4928
|
return this.cache.parent;
|
|
4924
4929
|
}
|
|
@@ -4958,6 +4963,120 @@
|
|
|
4958
4963
|
this.st.size(width,height);
|
|
4959
4964
|
return this;
|
|
4960
4965
|
}
|
|
4966
|
+
maintain() {
|
|
4967
|
+
for (let i = 0; i < this.items.length; i++)
|
|
4968
|
+
Object.assign(this, { [[i]]: this.items[i] });
|
|
4969
|
+
this.length = this.items.length;
|
|
4970
|
+
return this;
|
|
4971
|
+
}
|
|
4972
|
+
at(index) {
|
|
4973
|
+
return this.items.at(index);
|
|
4974
|
+
}
|
|
4975
|
+
#addItem(adder, pusher, ...ele) {
|
|
4976
|
+
if (this.cache.isFrozzen) {
|
|
4977
|
+
console.warn("You can't append new item to frozzen element");
|
|
4978
|
+
return this;
|
|
4979
|
+
}
|
|
4980
|
+
for (let i = 0; i < ele.length; i++) {
|
|
4981
|
+
if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
4982
|
+
if (ele[i] instanceof ZikoUIElement) {
|
|
4983
|
+
ele[i].cache.parent = this;
|
|
4984
|
+
this.element[adder](ele[i].element);
|
|
4985
|
+
ele[i].target = this.element;
|
|
4986
|
+
this.items[pusher](ele[i]);
|
|
4987
|
+
} else if (ele[i] instanceof Object) {
|
|
4988
|
+
if (ele[i]?.style) this.style(ele[i]?.style);
|
|
4989
|
+
if (ele[i]?.attr) {
|
|
4990
|
+
Object.entries(ele[i].attr).forEach((n) =>
|
|
4991
|
+
this.setAttr("" + n[0], n[1]),
|
|
4992
|
+
);
|
|
4993
|
+
}
|
|
4994
|
+
}
|
|
4995
|
+
}
|
|
4996
|
+
this.maintain();
|
|
4997
|
+
return this;
|
|
4998
|
+
}
|
|
4999
|
+
append(...ele) {
|
|
5000
|
+
this.#addItem("append", "push", ...ele);
|
|
5001
|
+
return this;
|
|
5002
|
+
}
|
|
5003
|
+
prepend(...ele) {
|
|
5004
|
+
this.#addItem("prepend", "unshift", ...ele);
|
|
5005
|
+
return this;
|
|
5006
|
+
}
|
|
5007
|
+
insertAt(index, ...ele) {
|
|
5008
|
+
if (index >= this.element.children.length) this.append(...ele);
|
|
5009
|
+
else
|
|
5010
|
+
for (let i = 0; i < ele.length; i++) {
|
|
5011
|
+
if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
5012
|
+
this.element?.insertBefore(ele[i].element, this.items[index].element);
|
|
5013
|
+
this.items.splice(index, 0, ele[i]);
|
|
5014
|
+
}
|
|
5015
|
+
return this;
|
|
5016
|
+
}
|
|
5017
|
+
remove(...ele) {
|
|
5018
|
+
const remove = (ele) => {
|
|
5019
|
+
if (typeof ele === "number") ele = this.items[ele];
|
|
5020
|
+
if (ele instanceof ZikoUIElement) this.element?.removeChild(ele.element);
|
|
5021
|
+
this.items = this.items.filter((n) => n !== ele);
|
|
5022
|
+
};
|
|
5023
|
+
for (let i = 0; i < ele.length; i++) remove(ele[i]);
|
|
5024
|
+
for (let i = 0; i < this.items.length; i++)
|
|
5025
|
+
Object.assign(this, { [[i]]: this.items[i] });
|
|
5026
|
+
// Remove from item
|
|
5027
|
+
return this;
|
|
5028
|
+
}
|
|
5029
|
+
forEach(callback) {
|
|
5030
|
+
this.items.forEach(callback);
|
|
5031
|
+
return this;
|
|
5032
|
+
}
|
|
5033
|
+
map(callback) {
|
|
5034
|
+
return this.items.map(callback);
|
|
5035
|
+
}
|
|
5036
|
+
find(condition) {
|
|
5037
|
+
return this.items.filter(condition);
|
|
5038
|
+
}
|
|
5039
|
+
filter(condition_callback, if_callback = () => {}, else_callback = () => {}) {
|
|
5040
|
+
const FilterItems = this.items.filter(condition_callback);
|
|
5041
|
+
FilterItems.forEach(if_callback);
|
|
5042
|
+
this.items
|
|
5043
|
+
.filter((item) => !FilterItems.includes(item))
|
|
5044
|
+
.forEach(else_callback);
|
|
5045
|
+
return this;
|
|
5046
|
+
}
|
|
5047
|
+
filterByTextContent(text, exactMatch = false) {
|
|
5048
|
+
this.items.forEach((n) => n.render());
|
|
5049
|
+
this.filter(
|
|
5050
|
+
(n) => !(exactMatch ? n.text === text : n.text.includes(text)),
|
|
5051
|
+
(e) => e.unrender(),
|
|
5052
|
+
);
|
|
5053
|
+
// this.items.filter(n=>{
|
|
5054
|
+
// const content=n.element.textContent;
|
|
5055
|
+
// return !(exactMatch?content===text:content.includes(text))
|
|
5056
|
+
// }).map(n=>n.unrender());
|
|
5057
|
+
// return this;
|
|
5058
|
+
}
|
|
5059
|
+
filterByClass(value) {
|
|
5060
|
+
this.items.map((n) => n.render());
|
|
5061
|
+
this.items
|
|
5062
|
+
.filter((n) => !n.classes.includes(value))
|
|
5063
|
+
.map((n) => n.unrender());
|
|
5064
|
+
return this;
|
|
5065
|
+
}
|
|
5066
|
+
sortByTextContent(value, displays) {
|
|
5067
|
+
let item = this.children;
|
|
5068
|
+
item
|
|
5069
|
+
.filter((n) => !n.textContent.toLowerCase().includes(value.toLowerCase()))
|
|
5070
|
+
.map((n) => {
|
|
5071
|
+
n.style.display = "none";
|
|
5072
|
+
});
|
|
5073
|
+
item
|
|
5074
|
+
.filter((n) => n.textContent.toLowerCase().includes(value.toLowerCase()))
|
|
5075
|
+
.map((n, i) => (n.style.display = displays[i]));
|
|
5076
|
+
//return item.filter(n=>n.style.display!="none")
|
|
5077
|
+
item.filter((n) => n.style.display != "none");
|
|
5078
|
+
return this;
|
|
5079
|
+
}
|
|
4961
5080
|
get #SwitchedStyleRTL_LTR(){
|
|
4962
5081
|
const CalculedStyle = globalThis.getComputedStyle(this.element);
|
|
4963
5082
|
const SwitchedStyle = {};
|
|
@@ -5313,161 +5432,120 @@
|
|
|
5313
5432
|
super(element, name);
|
|
5314
5433
|
this.items = [];
|
|
5315
5434
|
}
|
|
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
|
-
// }
|
|
5435
|
+
// maintain() {
|
|
5436
|
+
// for (let i = 0; i < this.items.length; i++)
|
|
5437
|
+
// Object.assign(this, { [[i]]: this.items[i] });
|
|
5438
|
+
// this.length = this.items.length;
|
|
5439
|
+
// return this;
|
|
5440
|
+
// }
|
|
5441
|
+
// at(index) {
|
|
5442
|
+
// return this.items.at(index);
|
|
5443
|
+
// }
|
|
5444
|
+
// #addItem(adder, pusher, ...ele) {
|
|
5445
|
+
// if (this.cache.isFrozzen) {
|
|
5446
|
+
// console.warn("You can't append new item to frozzen element");
|
|
5447
|
+
// return this;
|
|
5448
|
+
// }
|
|
5449
|
+
// for (let i = 0; i < ele.length; i++) {
|
|
5450
|
+
// if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
5451
|
+
// if (ele[i] instanceof ZikoUIElement) {
|
|
5452
|
+
// ele[i].cache.parent = this;
|
|
5453
|
+
// this.element[adder](ele[i].element);
|
|
5454
|
+
// ele[i].target = this.element;
|
|
5455
|
+
// this.items[pusher](ele[i]);
|
|
5456
|
+
// } else if (ele[i] instanceof Object) {
|
|
5457
|
+
// if (ele[i]?.style) this.style(ele[i]?.style);
|
|
5458
|
+
// if (ele[i]?.attr) {
|
|
5459
|
+
// Object.entries(ele[i].attr).forEach((n) =>
|
|
5460
|
+
// this.setAttr("" + n[0], n[1]),
|
|
5461
|
+
// );
|
|
5376
5462
|
// }
|
|
5377
5463
|
// }
|
|
5378
|
-
// this.maintain();
|
|
5379
|
-
// return this;
|
|
5380
5464
|
// }
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5465
|
+
// this.maintain();
|
|
5466
|
+
// return this;
|
|
5467
|
+
// }
|
|
5468
|
+
// append(...ele) {
|
|
5469
|
+
// this.#addItem("append", "push", ...ele);
|
|
5470
|
+
// return this;
|
|
5471
|
+
// }
|
|
5472
|
+
// prepend(...ele) {
|
|
5473
|
+
// this.#addItem("prepend", "unshift", ...ele);
|
|
5474
|
+
// return this;
|
|
5475
|
+
// }
|
|
5476
|
+
// insertAt(index, ...ele) {
|
|
5477
|
+
// if (index >= this.element.children.length) this.append(...ele);
|
|
5478
|
+
// else
|
|
5479
|
+
// for (let i = 0; i < ele.length; i++) {
|
|
5480
|
+
// if (["number", "string"].includes(typeof ele[i])) ele[i] = text(ele[i]);
|
|
5481
|
+
// this.element?.insertBefore(ele[i].element, this.items[index].element);
|
|
5482
|
+
// this.items.splice(index, 0, ele[i]);
|
|
5483
|
+
// }
|
|
5484
|
+
// return this;
|
|
5485
|
+
// }
|
|
5391
5486
|
// remove(...ele) {
|
|
5392
|
-
//
|
|
5393
|
-
// if(
|
|
5394
|
-
//
|
|
5395
|
-
//
|
|
5396
|
-
//
|
|
5397
|
-
//
|
|
5398
|
-
//
|
|
5399
|
-
//
|
|
5400
|
-
//
|
|
5401
|
-
//
|
|
5402
|
-
//
|
|
5403
|
-
//
|
|
5404
|
-
//
|
|
5405
|
-
//
|
|
5487
|
+
// const remove = (ele) => {
|
|
5488
|
+
// if (typeof ele === "number") ele = this.items[ele];
|
|
5489
|
+
// if (ele instanceof ZikoUIElement) this.element?.removeChild(ele.element);
|
|
5490
|
+
// this.items = this.items.filter((n) => n !== ele);
|
|
5491
|
+
// };
|
|
5492
|
+
// for (let i = 0; i < ele.length; i++) remove(ele[i]);
|
|
5493
|
+
// for (let i = 0; i < this.items.length; i++)
|
|
5494
|
+
// Object.assign(this, { [[i]]: this.items[i] });
|
|
5495
|
+
// // Remove from item
|
|
5496
|
+
// return this;
|
|
5497
|
+
// }
|
|
5498
|
+
// forEach(callback) {
|
|
5499
|
+
// this.items.forEach(callback);
|
|
5500
|
+
// return this;
|
|
5501
|
+
// }
|
|
5502
|
+
// map(callback) {
|
|
5503
|
+
// return this.items.map(callback);
|
|
5504
|
+
// }
|
|
5505
|
+
// find(condition) {
|
|
5506
|
+
// return this.items.filter(condition);
|
|
5507
|
+
// }
|
|
5508
|
+
// filter(condition_callback, if_callback = () => {}, else_callback = () => {}) {
|
|
5509
|
+
// const FilterItems = this.items.filter(condition_callback);
|
|
5510
|
+
// FilterItems.forEach(if_callback);
|
|
5511
|
+
// this.items
|
|
5512
|
+
// .filter((item) => !FilterItems.includes(item))
|
|
5513
|
+
// .forEach(else_callback);
|
|
5514
|
+
// return this;
|
|
5515
|
+
// }
|
|
5516
|
+
// filterByTextContent(text, exactMatch = false) {
|
|
5517
|
+
// this.items.forEach((n) => n.render());
|
|
5518
|
+
// this.filter(
|
|
5519
|
+
// (n) => !(exactMatch ? n.text === text : n.text.includes(text)),
|
|
5520
|
+
// (e) => e.unrender(),
|
|
5521
|
+
// );
|
|
5522
|
+
// // this.items.filter(n=>{
|
|
5523
|
+
// // const content=n.element.textContent;
|
|
5524
|
+
// // return !(exactMatch?content===text:content.includes(text))
|
|
5525
|
+
// // }).map(n=>n.unrender());
|
|
5526
|
+
// // return this;
|
|
5527
|
+
// }
|
|
5528
|
+
// filterByClass(value) {
|
|
5529
|
+
// this.items.map((n) => n.render());
|
|
5530
|
+
// this.items
|
|
5531
|
+
// .filter((n) => !n.classes.includes(value))
|
|
5532
|
+
// .map((n) => n.unrender());
|
|
5533
|
+
// return this;
|
|
5534
|
+
// }
|
|
5535
|
+
// sortByTextContent(value, displays) {
|
|
5536
|
+
// let item = this.children;
|
|
5537
|
+
// item
|
|
5538
|
+
// .filter((n) => !n.textContent.toLowerCase().includes(value.toLowerCase()))
|
|
5539
|
+
// .map((n) => {
|
|
5540
|
+
// n.style.display = "none";
|
|
5541
|
+
// });
|
|
5542
|
+
// item
|
|
5543
|
+
// .filter((n) => n.textContent.toLowerCase().includes(value.toLowerCase()))
|
|
5544
|
+
// .map((n, i) => (n.style.display = displays[i]));
|
|
5545
|
+
// //return item.filter(n=>n.style.display!="none")
|
|
5546
|
+
// item.filter((n) => n.style.display != "none");
|
|
5406
5547
|
// return this;
|
|
5407
5548
|
// }
|
|
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
5549
|
}
|
|
5472
5550
|
|
|
5473
5551
|
class __ZikoUIText__ extends ZikoUIContainerElement {
|
|
@@ -6136,6 +6214,53 @@
|
|
|
6136
6214
|
const HTMLWrapper = (HTMLContent) => new ZikoUIHTMLWrapper(HTMLContent);
|
|
6137
6215
|
const SVGWrapper = (SVGContent) => new ZikoUISVGWrapper(SVGContent);
|
|
6138
6216
|
|
|
6217
|
+
// function loadComponent() {
|
|
6218
|
+
// return new Promise((resolve) => {
|
|
6219
|
+
// setTimeout(() => {
|
|
6220
|
+
// resolve(p(1000))
|
|
6221
|
+
// }, 500);
|
|
6222
|
+
// });
|
|
6223
|
+
// }
|
|
6224
|
+
|
|
6225
|
+
// Suspense(p("Loading ..."),()=>fetch('https://jsonplaceholder.typicode.com/todos/1')
|
|
6226
|
+
// .then(response => response.json())
|
|
6227
|
+
// .then(json => h2(json.title)))
|
|
6228
|
+
|
|
6229
|
+
|
|
6230
|
+
|
|
6231
|
+
class ZikoUISuspense extends ZikoUIElement{
|
|
6232
|
+
constructor(fallback_ui, callback){
|
|
6233
|
+
super("div", "suspense");
|
|
6234
|
+
this.setAttr({
|
|
6235
|
+
dataTemp : "suspense"
|
|
6236
|
+
});
|
|
6237
|
+
this.fallback_ui = fallback_ui;
|
|
6238
|
+
this.append(fallback_ui);
|
|
6239
|
+
(async ()=>{
|
|
6240
|
+
try{
|
|
6241
|
+
const ui = await callback();
|
|
6242
|
+
fallback_ui.unrender();
|
|
6243
|
+
this.append(ui);
|
|
6244
|
+
// console.log(content)
|
|
6245
|
+
}
|
|
6246
|
+
catch(error){
|
|
6247
|
+
console.log({error});
|
|
6248
|
+
}
|
|
6249
|
+
})();
|
|
6250
|
+
}
|
|
6251
|
+
}
|
|
6252
|
+
|
|
6253
|
+
const Suspense = (fallback_ui, callback) => new ZikoUISuspense(fallback_ui, callback);
|
|
6254
|
+
|
|
6255
|
+
function h(tag, attributes = {}, ...children){
|
|
6256
|
+
const {name, style, ...attrs} = attributes;
|
|
6257
|
+
let element = new ZikoUIElement(tag,name);
|
|
6258
|
+
style && element.style(style);
|
|
6259
|
+
attrs && element.setAttr(attrs);
|
|
6260
|
+
children && element.append(...children);
|
|
6261
|
+
return element
|
|
6262
|
+
}
|
|
6263
|
+
|
|
6139
6264
|
class ZikoUIHtmlTag extends ZikoUIContainerElement {
|
|
6140
6265
|
constructor(element) {
|
|
6141
6266
|
super(element,"html");
|
|
@@ -6226,16 +6351,19 @@
|
|
|
6226
6351
|
__proto__: null,
|
|
6227
6352
|
HTMLWrapper: HTMLWrapper,
|
|
6228
6353
|
SVGWrapper: SVGWrapper,
|
|
6354
|
+
Suspense: Suspense,
|
|
6229
6355
|
ZikoUIBr: ZikoUIBr,
|
|
6230
6356
|
ZikoUIHTMLWrapper: ZikoUIHTMLWrapper,
|
|
6231
6357
|
ZikoUIHr: ZikoUIHr,
|
|
6232
6358
|
ZikoUIHtmlTag: ZikoUIHtmlTag,
|
|
6233
6359
|
ZikoUILink: ZikoUILink,
|
|
6234
6360
|
ZikoUISVGWrapper: ZikoUISVGWrapper,
|
|
6361
|
+
ZikoUISuspense: ZikoUISuspense,
|
|
6235
6362
|
ZikoUIXMLWrapper: ZikoUIXMLWrapper,
|
|
6236
6363
|
br: br,
|
|
6237
6364
|
brs: brs,
|
|
6238
6365
|
btn: btn,
|
|
6366
|
+
h: h,
|
|
6239
6367
|
hr: hr,
|
|
6240
6368
|
hrs: hrs,
|
|
6241
6369
|
html: html,
|
|
@@ -11645,7 +11773,7 @@
|
|
|
11645
11773
|
exports.Matrix = Matrix;
|
|
11646
11774
|
exports.Modal = Modal;
|
|
11647
11775
|
exports.Nav = Nav;
|
|
11648
|
-
exports.PI = PI;
|
|
11776
|
+
exports.PI = PI$1;
|
|
11649
11777
|
exports.Permutation = Permutation;
|
|
11650
11778
|
exports.Random = Random;
|
|
11651
11779
|
exports.SPA = SPA;
|
|
@@ -11654,6 +11782,7 @@
|
|
|
11654
11782
|
exports.Slider = Slider;
|
|
11655
11783
|
exports.Splitter = Splitter;
|
|
11656
11784
|
exports.Str = Str;
|
|
11785
|
+
exports.Suspense = Suspense;
|
|
11657
11786
|
exports.Svg = Svg;
|
|
11658
11787
|
exports.Table = Table$1;
|
|
11659
11788
|
exports.Tabs = Tabs;
|
|
@@ -11739,6 +11868,7 @@
|
|
|
11739
11868
|
exports.ZikoUISelect = ZikoUISelect;
|
|
11740
11869
|
exports.ZikoUISubText = ZikoUISubText;
|
|
11741
11870
|
exports.ZikoUISupText = ZikoUISupText;
|
|
11871
|
+
exports.ZikoUISuspense = ZikoUISuspense;
|
|
11742
11872
|
exports.ZikoUISvg = ZikoUISvg;
|
|
11743
11873
|
exports.ZikoUIText = ZikoUIText;
|
|
11744
11874
|
exports.ZikoUITextArea = ZikoUITextArea;
|
|
@@ -11810,6 +11940,7 @@
|
|
|
11810
11940
|
exports.floor = floor;
|
|
11811
11941
|
exports.gamma = gamma;
|
|
11812
11942
|
exports.geomspace = geomspace;
|
|
11943
|
+
exports.h = h;
|
|
11813
11944
|
exports.h1 = h1;
|
|
11814
11945
|
exports.h2 = h2;
|
|
11815
11946
|
exports.h3 = h3;
|