ziko 0.48.1 → 0.49.0
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 +187 -157
- package/dist/ziko.js +187 -157
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +152 -122
- package/package.json +8 -8
- package/src/__ziko__/__signature__.js +0 -0
- package/src/app/spa.js +7 -7
- package/src/app/ziko-app.js +1 -1
- package/src/data/converter/svg.js +1 -1
- package/src/math/complex/index.js +6 -17
- package/src/time/animation/index.js +2 -2
- package/src/time/ease/index.js +115 -74
- package/src/ui/__methods__/dom.js +5 -5
- package/src/ui/constructors/UIElement.js +3 -3
- package/src/ui/constructors/UIElementCore.js +3 -3
- package/src/ui/constructors/_m.js.txt +5 -5
- package/src/ui/flex/index.js +1 -1
- package/src/ui/grid/index.js +1 -1
- package/src/ui/logic/switch/index.js +1 -1
- package/src/ui/suspense/index.js +1 -1
- package/src/ui/web-component/index.js +4 -4
- package/types/index.d.ts +2 -0
- package/types/math/complex/index.d.ts +52 -0
- package/types/math/index.d.ts +2 -0
- package/types/math/utils/index.d.ts +1 -0
- package/types/math/utils/mapfun.d.ts +43 -0
- package/types/time/ease/index.d.ts +103 -0
- package/types/time/index.d.ts +1 -0
package/dist/ziko.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date :
|
|
5
|
+
Date : Sat Nov 22 2025 13:34:29 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
|
|
@@ -1338,7 +1338,7 @@ class UIElementCore extends UINode{
|
|
|
1338
1338
|
// // UI.append(...items);
|
|
1339
1339
|
// // }
|
|
1340
1340
|
// // else UI.element=this.element.cloneNode(true);
|
|
1341
|
-
// // return UI.
|
|
1341
|
+
// // return UI.mount(render);
|
|
1342
1342
|
// }
|
|
1343
1343
|
|
|
1344
1344
|
// freeze(freeze){
|
|
@@ -1348,9 +1348,9 @@ class UIElementCore extends UINode{
|
|
|
1348
1348
|
// setTarget(tg) {
|
|
1349
1349
|
// if(this.isBody) return ;
|
|
1350
1350
|
// if (tg?.isUIElement) tg = tg.element;
|
|
1351
|
-
// this.
|
|
1351
|
+
// this.unmount();
|
|
1352
1352
|
// this.target = tg;
|
|
1353
|
-
// this.
|
|
1353
|
+
// this.mount();
|
|
1354
1354
|
// return this;
|
|
1355
1355
|
// }
|
|
1356
1356
|
// describe(label){
|
|
@@ -1656,18 +1656,18 @@ function remove(...ele) {
|
|
|
1656
1656
|
return this;
|
|
1657
1657
|
}
|
|
1658
1658
|
function clear(){
|
|
1659
|
-
this?.items?.forEach(n=>n.
|
|
1659
|
+
this?.items?.forEach(n=>n.unmount());
|
|
1660
1660
|
this.element.innerHTML = "";
|
|
1661
1661
|
return this;
|
|
1662
1662
|
}
|
|
1663
|
-
function
|
|
1663
|
+
function mount(target = this.target) {
|
|
1664
1664
|
if(this.isBody)return ;
|
|
1665
1665
|
if(target?.isUIElement)target=target.element;
|
|
1666
1666
|
this.target=target;
|
|
1667
1667
|
this.target?.appendChild(this.element);
|
|
1668
1668
|
return this;
|
|
1669
1669
|
}
|
|
1670
|
-
function
|
|
1670
|
+
function unmount(){
|
|
1671
1671
|
if(this.cache.parent)this.cache.parent.remove(this);
|
|
1672
1672
|
else if(this.target?.children?.length && [...this.target?.children].includes(this.element)) this.target.removeChild(this.element);
|
|
1673
1673
|
return this;
|
|
@@ -1680,11 +1680,11 @@ function replaceElementWith(new_element){
|
|
|
1680
1680
|
return this
|
|
1681
1681
|
}
|
|
1682
1682
|
function renderAfter(t = 1) {
|
|
1683
|
-
setTimeout(() => this.
|
|
1683
|
+
setTimeout(() => this.mount(), t);
|
|
1684
1684
|
return this;
|
|
1685
1685
|
}
|
|
1686
1686
|
function unrenderAfter(t = 1) {
|
|
1687
|
-
setTimeout(() => this.
|
|
1687
|
+
setTimeout(() => this.unmount(), t);
|
|
1688
1688
|
return this;
|
|
1689
1689
|
}
|
|
1690
1690
|
function after(ui){
|
|
@@ -1705,12 +1705,12 @@ var DomMethods = /*#__PURE__*/Object.freeze({
|
|
|
1705
1705
|
before: before,
|
|
1706
1706
|
clear: clear,
|
|
1707
1707
|
insertAt: insertAt,
|
|
1708
|
+
mount: mount,
|
|
1708
1709
|
prepend: prepend,
|
|
1709
1710
|
remove: remove,
|
|
1710
|
-
render: render,
|
|
1711
1711
|
renderAfter: renderAfter,
|
|
1712
1712
|
replaceElementWith: replaceElementWith,
|
|
1713
|
-
|
|
1713
|
+
unmount: unmount,
|
|
1714
1714
|
unrenderAfter: unrenderAfter
|
|
1715
1715
|
});
|
|
1716
1716
|
|
|
@@ -2415,7 +2415,7 @@ let UIElement$1 = class UIElement extends UIElementCore{
|
|
|
2415
2415
|
// // UI.append(...items);
|
|
2416
2416
|
// // }
|
|
2417
2417
|
// // else UI.element=this.element.cloneNode(true);
|
|
2418
|
-
// // return UI.
|
|
2418
|
+
// // return UI.mount(render);
|
|
2419
2419
|
// }
|
|
2420
2420
|
// [Symbol.iterator]() {
|
|
2421
2421
|
// return this.items[Symbol.iterator]();
|
|
@@ -2437,9 +2437,9 @@ let UIElement$1 = class UIElement extends UIElementCore{
|
|
|
2437
2437
|
// setTarget(tg) {
|
|
2438
2438
|
// if(this.isBody) return ;
|
|
2439
2439
|
// if (tg?.isUIElement) tg = tg.element;
|
|
2440
|
-
// this.
|
|
2440
|
+
// this.unmount();
|
|
2441
2441
|
// this.target = tg;
|
|
2442
|
-
// this.
|
|
2442
|
+
// this.mount();
|
|
2443
2443
|
// return this;
|
|
2444
2444
|
// }
|
|
2445
2445
|
// describe(label){
|
|
@@ -2702,7 +2702,7 @@ class ZikoUIFlex extends UIElement$1 {
|
|
|
2702
2702
|
if (typeof h == "number") h += "%";
|
|
2703
2703
|
this.style({ width: w, height: h });
|
|
2704
2704
|
this.style({ display: "flex" });
|
|
2705
|
-
// this.
|
|
2705
|
+
// this.mount();
|
|
2706
2706
|
}
|
|
2707
2707
|
get isFlex(){
|
|
2708
2708
|
return true;
|
|
@@ -2810,7 +2810,7 @@ class ZikoUISuspense extends UIElement{
|
|
|
2810
2810
|
(async ()=>{
|
|
2811
2811
|
try{
|
|
2812
2812
|
const ui = await callback();
|
|
2813
|
-
fallback_ui.
|
|
2813
|
+
fallback_ui.unmount();
|
|
2814
2814
|
this.append(ui);
|
|
2815
2815
|
// console.log(content)
|
|
2816
2816
|
}
|
|
@@ -2912,19 +2912,19 @@ function define_wc(name, UIElement, props = {}, { mode = 'open'} = {}) {
|
|
|
2912
2912
|
}
|
|
2913
2913
|
|
|
2914
2914
|
connectedCallback() {
|
|
2915
|
-
this.
|
|
2915
|
+
this.mount();
|
|
2916
2916
|
}
|
|
2917
2917
|
|
|
2918
|
-
|
|
2918
|
+
mount() {
|
|
2919
2919
|
this.shadowRoot.innerHTML = '';
|
|
2920
|
-
this.UIElement = UIElement(this.props).
|
|
2920
|
+
this.UIElement = UIElement(this.props).mount(this.shadowRoot);
|
|
2921
2921
|
}
|
|
2922
2922
|
|
|
2923
2923
|
attributeChangedCallback(name, _, newValue) {
|
|
2924
2924
|
Object.assign(this.props, {
|
|
2925
2925
|
[name]: this.mask[name].type(newValue)
|
|
2926
2926
|
});
|
|
2927
|
-
this.
|
|
2927
|
+
this.mount();
|
|
2928
2928
|
}
|
|
2929
2929
|
}
|
|
2930
2930
|
);
|
|
@@ -2938,7 +2938,7 @@ class UISwitch extends UIElement$1{
|
|
|
2938
2938
|
this.init();
|
|
2939
2939
|
}
|
|
2940
2940
|
init(){
|
|
2941
|
-
Object.values(this.cases).filter(n=>n != this.current).forEach(n=>n.
|
|
2941
|
+
Object.values(this.cases).filter(n=>n != this.current).forEach(n=>n.unmount());
|
|
2942
2942
|
super.init(this.current.element);
|
|
2943
2943
|
}
|
|
2944
2944
|
get current(){
|
|
@@ -2965,7 +2965,7 @@ const Switch=({key, cases})=> new UISwitch(key, cases);
|
|
|
2965
2965
|
const svg2str=svg=>(new XMLSerializer()).serializeToString(svg);
|
|
2966
2966
|
const svg2ascii=svg=>btoa(svg2str(svg));
|
|
2967
2967
|
const svg2imgUrl=svg=>'data:image/svg+xml;base64,'+svg2ascii(svg);
|
|
2968
|
-
const svg2img=(svg,render=true)=>tags.img(svg2imgUrl(svg)).
|
|
2968
|
+
const svg2img=(svg,render=true)=>tags.img(svg2imgUrl(svg)).mount(render);
|
|
2969
2969
|
|
|
2970
2970
|
// const obj2str=(object)=>{
|
|
2971
2971
|
// const recursiveToString = (obj) => {
|
|
@@ -3781,27 +3781,27 @@ class Complex extends ZikoMath{
|
|
|
3781
3781
|
this.b=a.b;
|
|
3782
3782
|
}
|
|
3783
3783
|
else if(typeof(a)==="object"){
|
|
3784
|
-
if(("a" in
|
|
3784
|
+
if(("a" in a && "b" in a)){
|
|
3785
3785
|
this.a=a.a;
|
|
3786
3786
|
this.b=a.b;
|
|
3787
3787
|
}
|
|
3788
|
-
else if(("a" in
|
|
3788
|
+
else if(("a" in a && "z" in a)){
|
|
3789
3789
|
this.a=a.a;
|
|
3790
3790
|
this.b=sqrt$2((a.z**2)-(a.a**2));
|
|
3791
3791
|
}
|
|
3792
|
-
else if(("a" in
|
|
3792
|
+
else if(("a" in a && "phi" in a)){
|
|
3793
3793
|
this.a=a.a;
|
|
3794
3794
|
this.b=a.a*tan(a.phi);
|
|
3795
3795
|
}
|
|
3796
|
-
else if(("b" in
|
|
3796
|
+
else if(("b" in a && "z" in a)){
|
|
3797
3797
|
this.b=a.b;
|
|
3798
3798
|
this.a=sqrt$2((a.z**2)-(a.b**2));
|
|
3799
3799
|
}
|
|
3800
|
-
else if(("b" in
|
|
3800
|
+
else if(("b" in a && "phi" in a)){
|
|
3801
3801
|
this.b=b;
|
|
3802
3802
|
this.a=a.b/tan(a.phi);
|
|
3803
3803
|
}
|
|
3804
|
-
else if(("z" in
|
|
3804
|
+
else if(("z" in a && "phi" in a)){
|
|
3805
3805
|
this.a=a.z*cos$2(a.phi);
|
|
3806
3806
|
this.a=a.z*sin$2(a.phi);
|
|
3807
3807
|
}
|
|
@@ -3940,17 +3940,6 @@ class Complex extends ZikoMath{
|
|
|
3940
3940
|
const de=cos$2(this.a*2)+cosh$1(this.b*2);
|
|
3941
3941
|
return complex(sin$2(2*this.a)/de,sinh$1(2*this.b)/de);
|
|
3942
3942
|
}
|
|
3943
|
-
printInConsole() {
|
|
3944
|
-
let string = this.a + " + " + this.b + " * i";
|
|
3945
|
-
console.log(string);
|
|
3946
|
-
return string;
|
|
3947
|
-
}
|
|
3948
|
-
print() {
|
|
3949
|
-
//return text(this.a + " + i * " + this.b);
|
|
3950
|
-
}
|
|
3951
|
-
UI() {
|
|
3952
|
-
return "<span>" + this.a + " + i * " + this.b + "</span>";
|
|
3953
|
-
}
|
|
3954
3943
|
}
|
|
3955
3944
|
const complex=(a,b)=>{
|
|
3956
3945
|
if((a instanceof Array||ArrayBuffer.isView(a)) && (b instanceof Array||ArrayBuffer.isView(a)))return a.map((n,i)=>complex(a[i],b[i]));
|
|
@@ -4078,86 +4067,127 @@ const hypot=(...x)=>{
|
|
|
4078
4067
|
)
|
|
4079
4068
|
};
|
|
4080
4069
|
|
|
4081
|
-
const {PI, sqrt: sqrt$1, cos: cos$1, sin: sin$1, acos, pow} = Math;
|
|
4082
|
-
|
|
4083
|
-
const
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
const
|
|
4087
|
-
|
|
4088
|
-
const
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
const
|
|
4093
|
-
const
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
const
|
|
4098
|
-
const
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
const
|
|
4105
|
-
const
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
const
|
|
4110
|
-
const
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
const
|
|
4117
|
-
const
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
const
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
const
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
const
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4070
|
+
const { PI, sqrt: sqrt$1, cos: cos$1, sin: sin$1, acos, pow } = Math;
|
|
4071
|
+
|
|
4072
|
+
const linear = t => t;
|
|
4073
|
+
|
|
4074
|
+
// --- Sin ---
|
|
4075
|
+
const in_sin = t => 1 - cos$1((t * PI) / 2);
|
|
4076
|
+
const out_sin = t => sin$1((t * PI) / 2);
|
|
4077
|
+
const in_out_sin = t => -(cos$1(PI * t) - 1) / 2;
|
|
4078
|
+
|
|
4079
|
+
// --- Quad ---
|
|
4080
|
+
const in_quad = t => t ** 2;
|
|
4081
|
+
const out_quad = t => 1 - (1 - t) ** 2;
|
|
4082
|
+
const in_out_quad = t =>
|
|
4083
|
+
t < 0.5 ? 2 * (t ** 2) : 1 - (-2 * t + 2) ** 2 / 2;
|
|
4084
|
+
|
|
4085
|
+
// --- Cubic ---
|
|
4086
|
+
const in_cubic = t => t ** 3;
|
|
4087
|
+
const out_cubic = t => 1 - (1 - t) ** 3;
|
|
4088
|
+
const in_out_cubic = t =>
|
|
4089
|
+
t < 0.5 ? 4 * (t ** 3) : 1 - (-2 * t + 2) ** 3 / 2;
|
|
4090
|
+
|
|
4091
|
+
// --- Quart ---
|
|
4092
|
+
const in_quart = t => t ** 4;
|
|
4093
|
+
const out_quart = t => 1 - (1 - t) ** 4;
|
|
4094
|
+
const in_out_quart = t =>
|
|
4095
|
+
t < 0.5 ? 8 * (t ** 4) : 1 - (-2 * t + 2) ** 4 / 2;
|
|
4096
|
+
|
|
4097
|
+
// --- Quint ---
|
|
4098
|
+
const in_quint = t => t ** 5;
|
|
4099
|
+
const out_quint = t => 1 - (1 - t) ** 5;
|
|
4100
|
+
const in_out_quint = t =>
|
|
4101
|
+
t < 0.5 ? 16 * (t ** 5) : 1 - (-2 * t + 2) ** 5 / 2;
|
|
4102
|
+
|
|
4103
|
+
// --- Expo ---
|
|
4104
|
+
const in_expo = t => (t === 0 ? 0 : 2 ** (10 * t - 10));
|
|
4105
|
+
const out_expo = t => (t === 1 ? 1 : 1 - 2 ** (-10 * t));
|
|
4106
|
+
const in_out_expo = t =>
|
|
4107
|
+
t === 0
|
|
4108
|
+
? 0
|
|
4109
|
+
: t === 1
|
|
4110
|
+
? 1
|
|
4111
|
+
: t < 0.5
|
|
4112
|
+
? 2 ** (20 * t - 10) / 2
|
|
4113
|
+
: (2 - 2 ** (-20 * t + 10)) / 2;
|
|
4114
|
+
|
|
4115
|
+
// --- Circ ---
|
|
4116
|
+
const in_circ = t => 1 - sqrt$1(1 - t ** 2);
|
|
4117
|
+
const out_circ = t => sqrt$1(1 - (t - 1) ** 2);
|
|
4118
|
+
const in_out_circ = t =>
|
|
4119
|
+
t < 0.5
|
|
4120
|
+
? (1 - sqrt$1(1 - (2 * t) ** 2)) / 2
|
|
4121
|
+
: (sqrt$1(1 - (-2 * t + 2) ** 2) + 1) / 2;
|
|
4122
|
+
|
|
4123
|
+
// --- Arc ---
|
|
4124
|
+
const arc = t => 1 - sin$1(acos(t));
|
|
4125
|
+
|
|
4126
|
+
// --- Back ---
|
|
4127
|
+
const back = (t, x = 1) => (t ** 2) * ((x + 1) * t - x);
|
|
4128
|
+
|
|
4129
|
+
// --- Elastic ---
|
|
4130
|
+
const elastic = t =>
|
|
4131
|
+
-2 * pow(2, 10 * (t - 1)) * cos$1((20 * PI * t) / 3 * t);
|
|
4132
|
+
|
|
4133
|
+
// --- Back variations ---
|
|
4134
|
+
const in_back = (t, c1 = 1.70158, c3 = c1 + 1) =>
|
|
4135
|
+
c3 * pow(t, 3) - c1 * (t ** 2);
|
|
4136
|
+
|
|
4137
|
+
const out_back = (t, c1 = 1.70158, c3 = c1 + 1) =>
|
|
4138
|
+
1 + c3 * pow(t - 1, 3) + c1 * pow(t - 1, 2);
|
|
4139
|
+
|
|
4140
|
+
const in_out_back = (t, c1 = 1.70158, c2 = c1 * 1.525) =>
|
|
4141
|
+
t < 0.5
|
|
4142
|
+
? (pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2
|
|
4143
|
+
: (pow(2 * t - 2, 2) * ((c2 + 1) * (t * 2 - 2) + c2) + 2) / 2;
|
|
4144
|
+
|
|
4145
|
+
// --- Elastic variations ---
|
|
4146
|
+
const in_elastic = (t, c4 = (2 * PI) / 3) =>
|
|
4147
|
+
t === 0
|
|
4148
|
+
? 0
|
|
4149
|
+
: t === 1
|
|
4150
|
+
? 1
|
|
4151
|
+
: -pow(2, 10 * t - 10) * sin$1((t * 10 - 10.75) * c4);
|
|
4152
|
+
|
|
4153
|
+
const out_elastic = (t, c4 = (2 * PI) / 3) =>
|
|
4154
|
+
t === 0
|
|
4155
|
+
? 0
|
|
4156
|
+
: t === 1
|
|
4157
|
+
? 1
|
|
4158
|
+
: pow(2, -10 * t) * sin$1((t * 10 - 0.75) * c4) + 1;
|
|
4159
|
+
|
|
4160
|
+
const in_out_elastic = (t, c5 = (2 * PI) / 4.5) =>
|
|
4161
|
+
t === 0
|
|
4162
|
+
? 0
|
|
4163
|
+
: t === 1
|
|
4164
|
+
? 1
|
|
4165
|
+
: t < 0.5
|
|
4166
|
+
? -(pow(2, 20 * t - 10) * sin$1((20 * t - 11.125) * c5)) / 2
|
|
4167
|
+
: (pow(2, -20 * t + 10) * sin$1((20 * t - 11.125) * c5)) / 2 + 1;
|
|
4168
|
+
|
|
4169
|
+
// --- Bounce ---
|
|
4170
|
+
const in_bounce = (t, n1 = 7.5625, d1 = 2.75) =>
|
|
4171
|
+
1 - out_bounce(1 - t, n1, d1);
|
|
4172
|
+
|
|
4173
|
+
const out_bounce = (t, n1 = 7.5625, d1 = 2.75) => {
|
|
4174
|
+
if (t < 1 / d1) return n1 * t * t;
|
|
4175
|
+
if (t < 2 / d1) return n1 * (t -= 1.5 / d1) * t + 0.75;
|
|
4176
|
+
if (t < 2.5 / d1) return n1 * (t -= 2.25 / d1) * t + 0.9375;
|
|
4150
4177
|
return n1 * (t -= 2.625 / d1) * t + 0.984375;
|
|
4151
4178
|
};
|
|
4152
4179
|
|
|
4153
|
-
const
|
|
4154
|
-
|
|
4180
|
+
const in_out_bounce = (t, n1 = 7.5625, d1 = 2.75) =>
|
|
4181
|
+
t < 0.5
|
|
4182
|
+
? out_bounce(1 - 2 * t, n1, d1) / 2
|
|
4183
|
+
: out_bounce(2 * t - 1, n1, d1) / 2;
|
|
4155
4184
|
|
|
4156
|
-
|
|
4157
|
-
const
|
|
4185
|
+
// --- Step / Discrete ---
|
|
4186
|
+
const step = (t, steps = 5) => Math.floor(t * steps) / steps;
|
|
4187
|
+
const discret = (t, segments = 5) => Math.ceil(t * segments) / segments;
|
|
4158
4188
|
|
|
4159
4189
|
class TimeAnimation {
|
|
4160
|
-
constructor(callback, { ease =
|
|
4190
|
+
constructor(callback, { ease = linear, step = 50, t0 = 0, start = true, duration = 3000 } = {}) {
|
|
4161
4191
|
this.callback = callback;
|
|
4162
4192
|
this.state = {
|
|
4163
4193
|
isRunning: false,
|
|
@@ -4825,7 +4855,7 @@ class ZikoApp {
|
|
|
4825
4855
|
this.head && this.setHead(this.head);
|
|
4826
4856
|
this.wrapper && this.setWrapper(this.wrapper);
|
|
4827
4857
|
this.target && this.setTarget(this.target);
|
|
4828
|
-
if(this.wrapper && this.target)this.wrapper.
|
|
4858
|
+
if(this.wrapper && this.target)this.wrapper.mount(this.target);
|
|
4829
4859
|
}
|
|
4830
4860
|
setTarget(target){
|
|
4831
4861
|
if(target instanceof HTMLElement) this.target = target;
|
|
@@ -4901,16 +4931,16 @@ class ZikoSPA extends ZikoApp{
|
|
|
4901
4931
|
...Object.entries(routes)
|
|
4902
4932
|
]);
|
|
4903
4933
|
this.clear();
|
|
4904
|
-
globalThis.onpopstate = this.
|
|
4934
|
+
globalThis.onpopstate = this.mount(location.pathname);
|
|
4905
4935
|
}
|
|
4906
4936
|
clear(){
|
|
4907
4937
|
[...this.routes].forEach(n=>{
|
|
4908
|
-
!isDynamic(n[0]) && n[1]?.isUIElement && n[1].
|
|
4938
|
+
!isDynamic(n[0]) && n[1]?.isUIElement && n[1].unmount();
|
|
4909
4939
|
});
|
|
4910
4940
|
// this.wrapper.clear();
|
|
4911
4941
|
return this;
|
|
4912
4942
|
}
|
|
4913
|
-
|
|
4943
|
+
mount(path){
|
|
4914
4944
|
const [mask, callback] = [...this.routes].find(route=>routesMatcher(route[0],path));
|
|
4915
4945
|
let element ;
|
|
4916
4946
|
if(isDynamic(mask)){
|
|
@@ -4918,13 +4948,13 @@ class ZikoSPA extends ZikoApp{
|
|
|
4918
4948
|
element = callback.call(this,params);
|
|
4919
4949
|
}
|
|
4920
4950
|
else {
|
|
4921
|
-
callback?.isUIElement && callback.
|
|
4951
|
+
callback?.isUIElement && callback.mount(this.wrapper);
|
|
4922
4952
|
if(typeof callback === "function") element = callback();
|
|
4923
4953
|
}
|
|
4924
|
-
if(element?.isUIElement) element.
|
|
4925
|
-
// if(element?.isZikoApp) element.
|
|
4954
|
+
if(element?.isUIElement) element.mount(this.wrapper);
|
|
4955
|
+
// if(element?.isZikoApp) element.mount(this.wrapper);
|
|
4926
4956
|
if(element instanceof Promise){
|
|
4927
|
-
element.then(e=>e.
|
|
4957
|
+
element.then(e=>e.mount(this.wrapper));
|
|
4928
4958
|
}
|
|
4929
4959
|
globalThis.history.pushState({}, "", path);
|
|
4930
4960
|
return this;
|
|
@@ -5359,4 +5389,4 @@ if(globalThis?.document){
|
|
|
5359
5389
|
document?.addEventListener("DOMContentLoaded", __Ziko__.__Config__.init());
|
|
5360
5390
|
}
|
|
5361
5391
|
|
|
5362
|
-
export { App,
|
|
5392
|
+
export { App, Base, Clock, Combinaison, Complex, E, EPSILON, FileBasedRouting, Flex, HTMLWrapper, Logic$1 as Logic, Matrix, PI$2 as PI, Permutation, Random, SPA, SVGWrapper, Scheduler, Suspense, Switch, Tick, TimeAnimation, TimeLoop, TimeScheduler, UIElement$1 as UIElement, UIHTMLWrapper, UINode, UISVGWrapper, UISwitch, UIView, Utils, View, ZikoApp, ZikoEventClick, ZikoEventClipboard, ZikoEventCustom, ZikoEventDrag, ZikoEventFocus, ZikoEventHash, ZikoEventKey, ZikoEventMouse, ZikoEventPointer, ZikoEventTouch, ZikoEventWheel, ZikoSPA, ZikoUIFlex, ZikoUISuspense, ZikoUIText, ZikoUseRoot, __ZikoEvent__, abs, accum, acos$1 as acos, acosh, acot, add, animation, arange, arc, arr2str, asin, asinh, atan, atan2, atanh, back, bindCustomEvent, bindHashEvent, bindTouchEvent, bind_click_event, bind_clipboard_event, bind_drag_event, bind_focus_event, bind_key_event, bind_mouse_event, bind_pointer_event, bind_wheel_event, cartesianProduct, ceil, clamp, clock, combinaison, complex, cos$2 as cos, cosh$1 as cosh, cot, coth, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, debounce, defineParamsGetter, define_wc, deg2rad, discret, div, e, elastic, fact, floor, geomspace, getEvent, hypot, inRange, in_back, in_bounce, in_circ, in_cubic, in_elastic, in_expo, in_out_back, in_out_bounce, in_out_circ, in_out_cubic, in_out_elastic, in_out_expo, in_out_quad, in_out_quart, in_out_quint, in_out_sin, in_quad, in_quart, in_quint, in_sin, isApproximatlyEqual, isStateGetter, json2arr, json2css, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, lerp, linear, linspace, ln, logspace, loop, map$1 as map, mapfun$1 as mapfun, matrix, matrix2, matrix3, matrix4, max, min, modulo, mul, norm, nums, obj2str, ones, out_back, out_bounce, out_circ, out_cubic, out_elastic, out_expo, out_quad, out_quart, out_quint, out_sin, pgcd, pow$1 as pow, powerSet, ppcm, preload, prod, rad2deg, round, sec, sig, sign, sin$2 as sin, sinc, sinh$1 as sinh, sleep, sqrt$2 as sqrt, sqrtn, step, step_fps, sub, subSet, sum, svg2ascii, svg2img, svg2imgUrl, svg2str, tags, tan, tanh, text, throttle, tick, timeTaken, time_memory_Taken, timeout, useChannel, useDerived, useEventEmitter, useLocaleStorage, useReactive, useRoot, useSessionStorage, useState, useThread, wait, waitForUIElm, waitForUIElmSync, zeros };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ziko",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.0",
|
|
4
4
|
"description": "A versatile JavaScript library offering a rich set of Hyperscript Based UI components, advanced mathematical utilities, interactivity ,animations, client side routing and more ...",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"front-end",
|
|
@@ -24,16 +24,17 @@
|
|
|
24
24
|
"types",
|
|
25
25
|
"LICENCE"
|
|
26
26
|
],
|
|
27
|
-
"types": "./types/global.d.ts",
|
|
28
27
|
"exports": {
|
|
29
|
-
"./*":
|
|
28
|
+
"./*": {
|
|
29
|
+
"import" : "./src/*/index.js",
|
|
30
|
+
"types" : "./types/*/index.d.ts"
|
|
31
|
+
},
|
|
30
32
|
".": {
|
|
31
33
|
"import": "./dist/ziko.mjs",
|
|
32
|
-
"require": "./dist/ziko.cjs"
|
|
33
|
-
|
|
34
|
-
"./math": {
|
|
35
|
-
"import": "./src/math/index.js"
|
|
34
|
+
"require": "./dist/ziko.cjs",
|
|
35
|
+
"types" : "./types/index.d.ts"
|
|
36
36
|
},
|
|
37
|
+
|
|
37
38
|
"./helpers": {
|
|
38
39
|
"import": "./src/__helpers__.js"
|
|
39
40
|
},
|
|
@@ -59,7 +60,6 @@
|
|
|
59
60
|
"./src": "./src/index.js",
|
|
60
61
|
"./html": {},
|
|
61
62
|
"./app": {},
|
|
62
|
-
"./time": {},
|
|
63
63
|
"./components": {}
|
|
64
64
|
},
|
|
65
65
|
"sideEffects" : true,
|
|
File without changes
|
package/src/app/spa.js
CHANGED
|
@@ -9,16 +9,16 @@ class ZikoSPA extends ZikoApp{
|
|
|
9
9
|
...Object.entries(routes)
|
|
10
10
|
]);
|
|
11
11
|
this.clear();
|
|
12
|
-
globalThis.onpopstate = this.
|
|
12
|
+
globalThis.onpopstate = this.mount(location.pathname);
|
|
13
13
|
}
|
|
14
14
|
clear(){
|
|
15
15
|
[...this.routes].forEach(n=>{
|
|
16
|
-
!isDynamic(n[0]) && n[1]?.isUIElement && n[1].
|
|
16
|
+
!isDynamic(n[0]) && n[1]?.isUIElement && n[1].unmount()
|
|
17
17
|
})
|
|
18
18
|
// this.wrapper.clear();
|
|
19
19
|
return this;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
mount(path){
|
|
22
22
|
const [mask, callback] = [...this.routes].find(route=>routesMatcher(route[0],path));
|
|
23
23
|
let element ;
|
|
24
24
|
if(isDynamic(mask)){
|
|
@@ -26,13 +26,13 @@ class ZikoSPA extends ZikoApp{
|
|
|
26
26
|
element = callback.call(this,params)
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
|
-
callback?.isUIElement && callback.
|
|
29
|
+
callback?.isUIElement && callback.mount(this.wrapper);
|
|
30
30
|
if(typeof callback === "function") element = callback();
|
|
31
31
|
}
|
|
32
|
-
if(element?.isUIElement) element.
|
|
33
|
-
// if(element?.isZikoApp) element.
|
|
32
|
+
if(element?.isUIElement) element.mount(this.wrapper);
|
|
33
|
+
// if(element?.isZikoApp) element.mount(this.wrapper);
|
|
34
34
|
if(element instanceof Promise){
|
|
35
|
-
element.then(e=>e.
|
|
35
|
+
element.then(e=>e.mount(this.wrapper))
|
|
36
36
|
}
|
|
37
37
|
globalThis.history.pushState({}, "", path);
|
|
38
38
|
return this;
|
package/src/app/ziko-app.js
CHANGED
|
@@ -13,7 +13,7 @@ class ZikoApp {
|
|
|
13
13
|
this.head && this.setHead(this.head);
|
|
14
14
|
this.wrapper && this.setWrapper(this.wrapper);
|
|
15
15
|
this.target && this.setTarget(this.target);
|
|
16
|
-
if(this.wrapper && this.target)this.wrapper.
|
|
16
|
+
if(this.wrapper && this.target)this.wrapper.mount(this.target);
|
|
17
17
|
}
|
|
18
18
|
setTarget(target){
|
|
19
19
|
if(target instanceof HTMLElement) this.target = target;
|
|
@@ -2,7 +2,7 @@ import { tags } from "../../ui"
|
|
|
2
2
|
const svg2str=svg=>(new XMLSerializer()).serializeToString(svg);
|
|
3
3
|
const svg2ascii=svg=>btoa(svg2str(svg));
|
|
4
4
|
const svg2imgUrl=svg=>'data:image/svg+xml;base64,'+svg2ascii(svg);
|
|
5
|
-
const svg2img=(svg,render=true)=>tags.img(svg2imgUrl(svg)).
|
|
5
|
+
const svg2img=(svg,render=true)=>tags.img(svg2imgUrl(svg)).mount(render);
|
|
6
6
|
export{
|
|
7
7
|
svg2str,
|
|
8
8
|
svg2ascii,
|
|
@@ -23,27 +23,27 @@ class Complex extends ZikoMath{
|
|
|
23
23
|
this.b=a.b;
|
|
24
24
|
}
|
|
25
25
|
else if(typeof(a)==="object"){
|
|
26
|
-
if(("a" in
|
|
26
|
+
if(("a" in a && "b" in a)){
|
|
27
27
|
this.a=a.a;
|
|
28
28
|
this.b=a.b;
|
|
29
29
|
}
|
|
30
|
-
else if(("a" in
|
|
30
|
+
else if(("a" in a && "z" in a)){
|
|
31
31
|
this.a=a.a;
|
|
32
32
|
this.b=sqrt((a.z**2)-(a.a**2));
|
|
33
33
|
}
|
|
34
|
-
else if(("a" in
|
|
34
|
+
else if(("a" in a && "phi" in a)){
|
|
35
35
|
this.a=a.a;
|
|
36
36
|
this.b=a.a*tan(a.phi);
|
|
37
37
|
}
|
|
38
|
-
else if(("b" in
|
|
38
|
+
else if(("b" in a && "z" in a)){
|
|
39
39
|
this.b=a.b;
|
|
40
40
|
this.a=sqrt((a.z**2)-(a.b**2));
|
|
41
41
|
}
|
|
42
|
-
else if(("b" in
|
|
42
|
+
else if(("b" in a && "phi" in a)){
|
|
43
43
|
this.b=b;
|
|
44
44
|
this.a=a.b/tan(a.phi);
|
|
45
45
|
}
|
|
46
|
-
else if(("z" in
|
|
46
|
+
else if(("z" in a && "phi" in a)){
|
|
47
47
|
this.a=a.z*cos(a.phi);
|
|
48
48
|
this.a=a.z*sin(a.phi);
|
|
49
49
|
}
|
|
@@ -182,17 +182,6 @@ class Complex extends ZikoMath{
|
|
|
182
182
|
const de=cos(this.a*2)+cosh(this.b*2);
|
|
183
183
|
return complex(sin(2*this.a)/de,sinh(2*this.b)/de);
|
|
184
184
|
}
|
|
185
|
-
printInConsole() {
|
|
186
|
-
let string = this.a + " + " + this.b + " * i";
|
|
187
|
-
console.log(string);
|
|
188
|
-
return string;
|
|
189
|
-
}
|
|
190
|
-
print() {
|
|
191
|
-
//return text(this.a + " + i * " + this.b);
|
|
192
|
-
}
|
|
193
|
-
UI() {
|
|
194
|
-
return "<span>" + this.a + " + i * " + this.b + "</span>";
|
|
195
|
-
}
|
|
196
185
|
}
|
|
197
186
|
const complex=(a,b)=>{
|
|
198
187
|
if((a instanceof Array||ArrayBuffer.isView(a)) && (b instanceof Array||ArrayBuffer.isView(a)))return a.map((n,i)=>complex(a[i],b[i]));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { linear } from "../ease/index.js";
|
|
2
2
|
import { map } from "../../math/utils/index.js";
|
|
3
3
|
|
|
4
4
|
class TimeAnimation {
|
|
5
|
-
constructor(callback, { ease =
|
|
5
|
+
constructor(callback, { ease = linear, step = 50, t0 = 0, start = true, duration = 3000 } = {}) {
|
|
6
6
|
this.callback = callback;
|
|
7
7
|
this.state = {
|
|
8
8
|
isRunning: false,
|