ziko 0.38.1 → 0.40.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.
Files changed (51) hide show
  1. package/dist/ziko.cjs +962 -1360
  2. package/dist/ziko.js +962 -1360
  3. package/dist/ziko.min.js +2 -2
  4. package/dist/ziko.mjs +902 -1342
  5. package/package.json +1 -1
  6. package/src/data/index.js +2 -2
  7. package/src/data/string/checkers.js +27 -0
  8. package/src/data/string/converters.js +24 -0
  9. package/src/data/string/index.js +2 -1
  10. package/src/data/string-dep/index.js +1 -0
  11. package/src/events/types/clipboard.d.ts +2 -2
  12. package/src/events/types/focus.d.ts +2 -2
  13. package/src/events/types/pointer.d.ts +2 -2
  14. package/src/hooks/use-state.js +11 -8
  15. package/src/index.js +2 -1
  16. package/src/math/index.js +17 -17
  17. package/src/reactivity/hooks/UI/index.js +1 -1
  18. package/src/reactivity/hooks/UI/useRoot.js +3 -3
  19. package/src/time/animation/index.js +88 -70
  20. package/src/time/clocks/clock.js +62 -0
  21. package/src/time/clocks/index.js +3 -0
  22. package/src/time/clocks/scheduler.js +69 -0
  23. package/src/time/clocks/tick.js +34 -0
  24. package/src/time/converters/index.js +1 -0
  25. package/src/time/delay/index.js +2 -0
  26. package/src/time/delay/sleep.js +3 -0
  27. package/src/time/delay/timeout.js +15 -0
  28. package/src/time/ease/index.js +77 -0
  29. package/src/time/index.js +6 -9
  30. package/src/time/loop/index.js +67 -51
  31. package/src/time/utils/index.js +2 -2
  32. package/src/ui/__methods__/attrs.js +49 -0
  33. package/src/ui/__methods__/index.js +2 -1
  34. package/src/ui/__methods__/style.js +34 -0
  35. package/src/ui/__utils__/index.js +2 -2
  36. package/src/ui/constructors/{ZikoUIElement.js → UIElement.js} +23 -64
  37. package/src/ui/constructors/{ZikoUINode.js → UINode.js} +2 -2
  38. package/src/ui/constructors/style/index.js +2 -1
  39. package/src/ui/flex/index.js +8 -8
  40. package/src/ui/graphics/canvas.js +2 -2
  41. package/src/ui/graphics/svg.js +2 -2
  42. package/src/ui/grid/index.js +4 -4
  43. package/src/ui/index.js +2 -2
  44. package/src/ui/suspense/index.js +3 -3
  45. package/src/ui/tags/index.d.ts.txt +125 -125
  46. package/src/ui/tags/index.js +12 -16
  47. package/src/ui/text/index.js +2 -2
  48. package/src/ui/wrapper/index.js +3 -3
  49. package/src/time/utils/ease.js +0 -144
  50. /package/src/data/{string → string-dep}/patterns.js +0 -0
  51. /package/src/data/{string → string-dep}/string.js +0 -0
package/dist/ziko.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Sun Aug 17 2025 21:52:49 GMT+0100 (UTC+01:00)
5
+ Date : Tue Aug 19 2025 09:41:09 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
@@ -10,22 +10,22 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const { PI: PI$1, E } = Math;
13
+ const { PI: PI$2, E } = Math;
14
14
  const EPSILON=Number.EPSILON;
15
15
 
16
- 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;
16
+ const {PI: PI$1, cos: cos$2, sin: sin$2, tan: tan$1, acos: acos$2, 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;
17
17
  let Fixed={
18
- cos: cos$1,
19
- sin: sin$1,
18
+ cos: cos$2,
19
+ sin: sin$2,
20
20
  tan: tan$1,
21
- sinc: x => sin$1(PI*x)/(PI*x),
22
- sec: x => 1/cos$1(x),
23
- csc: x => 1/sin$1(x),
21
+ sinc: x => sin$2(PI$1*x)/(PI$1*x),
22
+ sec: x => 1/cos$2(x),
23
+ csc: x => 1/sin$2(x),
24
24
  cot: x => 1/tan$1(x),
25
- acos: acos$1,
25
+ acos: acos$2,
26
26
  asin: asin$1,
27
27
  atan: atan$1,
28
- acot: x => PI/2-atan$1(x),
28
+ acot: x => PI$1/2-atan$1(x),
29
29
  cosh: cosh$1,
30
30
  sinh: sinh$1,
31
31
  tanh: tanh$1,
@@ -63,20 +63,20 @@ const mapfun$1=(fun,...X)=>{
63
63
  const [a,b,z,phi]=[x.a,x.b,x.z,x.phi];
64
64
  switch(fun){
65
65
  case Math.log: return complex(ln(z),phi); // Done
66
- case Math.exp: return complex(e(a)*cos(b),e(a)*sin(b)); // Done
66
+ case Math.exp: return complex(e(a)*cos$1(b),e(a)*sin$1(b)); // Done
67
67
  case Math.abs: return z; // Done
68
- case Math.sqrt: return complex(sqrt(z)*cos(phi/2),sqrt(z)*sin(phi/2)); // Done
69
- case Fixed.cos: return complex(cos(a)*cosh(b),-(sin(a)*sinh(b)));
70
- case Fixed.sin: return complex(sin(a)*cosh(b),cos(a)*sinh(b));
68
+ case Math.sqrt: return complex(sqrt$1(z)*cos$1(phi/2),sqrt$1(z)*sin$1(phi/2)); // Done
69
+ case Fixed.cos: return complex(cos$1(a)*cosh(b),-(sin$1(a)*sinh(b)));
70
+ case Fixed.sin: return complex(sin$1(a)*cosh(b),cos$1(a)*sinh(b));
71
71
  case Fixed.tan:{
72
- const DEN = cos(2*a)+cosh(2*b);
73
- return complex(sin(2*a)/DEN,sinh(2*b)/DEN);
72
+ const DEN = cos$1(2*a)+cosh(2*b);
73
+ return complex(sin$1(2*a)/DEN,sinh(2*b)/DEN);
74
74
  }
75
- case Fixed.cosh:return complex(cosh(a)*cos(b),sinh(a)*sin(b));
76
- case Fixed.sinh:return complex(sinh(a)*cos(b),cosh(a)*sin(b));
75
+ case Fixed.cosh:return complex(cosh(a)*cos$1(b),sinh(a)*sin$1(b));
76
+ case Fixed.sinh:return complex(sinh(a)*cos$1(b),cosh(a)*sin$1(b));
77
77
  case Fixed.tanh:{
78
- const DEN=cosh(2*a)+cos(2*b);
79
- return complex(sinh(2*a)/DEN,sin(2*b)/DEN)
78
+ const DEN=cosh(2*a)+cos$1(2*b);
79
+ return complex(sinh(2*a)/DEN,sin$1(2*b)/DEN)
80
80
  }
81
81
  default : return fun(x)
82
82
  }
@@ -317,7 +317,7 @@ const linspace=(a,b,n=abs(b-a)+1,endpoint=true)=>{
317
317
  }
318
318
  };
319
319
  const logspace=(a,b,n=b-a+1,base=E,endpoint=true)=>{
320
- return linspace(a,b,n,endpoint).map(n=>pow(base,n))
320
+ return linspace(a,b,n,endpoint).map(n=>pow$1(base,n))
321
321
  };
322
322
  const geomspace=(a,b,n=abs(b-a)+1,endpoint=true)=>{
323
323
  if(Math.floor(n)!==n)return;
@@ -1045,7 +1045,7 @@ const json2xmlFile=(json,indent)=>{
1045
1045
  }
1046
1046
  };
1047
1047
 
1048
- class ZikoUINode {
1048
+ class UINode {
1049
1049
  constructor(node){
1050
1050
  this.cache = {
1051
1051
  node
@@ -1059,7 +1059,7 @@ class ZikoUINode {
1059
1059
  }
1060
1060
  }
1061
1061
 
1062
- globalThis.node = (node) => new ZikoUINode(node);
1062
+ globalThis.node = (node) => new UINode(node);
1063
1063
 
1064
1064
  function register_to_class(target, ...mixins){
1065
1065
  mixins.forEach(n => _register_to_class_(target, n));
@@ -1102,7 +1102,114 @@ const register = (target, ...mixins) => {
1102
1102
  else register_to_instance(target, ...mixins);
1103
1103
  };
1104
1104
 
1105
- class ZikoUIText extends ZikoUINode {
1105
+ function useState(initialValue) {
1106
+ let value = initialValue;
1107
+ const subscribers = new Set();
1108
+ let paused = false;
1109
+
1110
+ function getValue() {
1111
+ return {
1112
+ value,
1113
+ isStateGetter: () => true,
1114
+ _subscribe: (
1115
+ fn,
1116
+ // UIElement
1117
+ ) => {
1118
+ subscribers.add(fn);
1119
+
1120
+ // const observer = new MutationObserver(() => {
1121
+ // if (!document.body.contains(UIElement.element)) {
1122
+ // subscribers.delete(fn);
1123
+ // observer.disconnect();
1124
+ // }
1125
+ // });
1126
+
1127
+ // observer.observe(document.body, { childList: true, subtree: true });
1128
+ },
1129
+ };
1130
+ }
1131
+
1132
+ function setValue(newValue) {
1133
+ if (paused) return;
1134
+ if (typeof newValue === "function") newValue = newValue(value);
1135
+ if (newValue !== value) {
1136
+ value = newValue;
1137
+ subscribers.forEach(fn => fn(value));
1138
+ }
1139
+ }
1140
+
1141
+ const controller = {
1142
+ pause: () => { paused = true; },
1143
+ resume: () => { paused = false; },
1144
+ clear: () => { subscribers.clear(); },
1145
+ force: (newValue) => { // force update even if paused
1146
+ if (typeof newValue === "function") newValue = newValue(value);
1147
+ value = newValue;
1148
+ subscribers.forEach(fn => fn(value));
1149
+ },
1150
+ getSubscribers: () => new Set(subscribers),
1151
+ };
1152
+
1153
+ return [getValue, setValue, controller];
1154
+ }
1155
+
1156
+ const isStateGetter = (arg) => {
1157
+ return typeof(arg) === 'function' && arg?.()?.isStateGetter?.()
1158
+ };
1159
+
1160
+ const camel2hyphencase = (text = '') => text.replace(/[A-Z]/g, match => '-' + match.toLowerCase());
1161
+
1162
+ const is_camelcase = (text = '') =>{
1163
+ if (text.length === 0) return false;
1164
+ const camelCasePattern = /^[a-z][a-zA-Z0-9]*$/;
1165
+ return camelCasePattern.test(text);
1166
+ };
1167
+
1168
+ // To Do add getter, watchAttr
1169
+ const AttrsMethods = {
1170
+ setAttr(name, value) {
1171
+ if(name instanceof Object){
1172
+ const [names,values]=[Object.keys(name),Object.values(name)];
1173
+ for(let i=0;i<names.length;i++){
1174
+ if(values[i] instanceof Array)value[i] = values[i].join(" ");
1175
+ _set_attrs_.call(this, names[i], values[i]);
1176
+ }
1177
+ }
1178
+ else {
1179
+ if(value instanceof Array) value = value.join(" ");
1180
+ _set_attrs_.call(this, name, value);
1181
+ }
1182
+ return this;
1183
+ },
1184
+ removeAttr(...names) {
1185
+ for(let i=0;i<names.length;i++)this.element?.removeAttribute(names[i]);
1186
+ return this;
1187
+ },
1188
+ getAttr(name){
1189
+ name = is_camelcase(name) ? camel2hyphencase(name) : name;
1190
+ return this.element.attributes[name].value;
1191
+ },
1192
+ setContentEditable(bool = true) {
1193
+ this.setAttr("contenteditable", bool);
1194
+ return this;
1195
+ }
1196
+ };
1197
+
1198
+ function _set_attrs_(name, value){
1199
+ if(this.element?.tagName !== "svg") name = is_camelcase(name) ? camel2hyphencase(name) : name;
1200
+ if(this?.attr[name] && this?.attr[name]===value) return;
1201
+ if(isStateGetter(value)){
1202
+ const getter = value();
1203
+ getter._subscribe(
1204
+ (newValue) => this.element?.setAttribute(name, newValue),
1205
+ this
1206
+ );
1207
+ }
1208
+ else this.element?.setAttribute(name, value);
1209
+ Object.assign(this.cache.attributes, {[name]:value});
1210
+ }
1211
+
1212
+ class ZikoUIText extends UINode {
1106
1213
  constructor(...value) {
1107
1214
  super("span", "text", false, ...value);
1108
1215
  this.element = globalThis?.document?.createTextNode(...value);
@@ -1648,723 +1755,175 @@ const IndexingMethods = {
1648
1755
  },
1649
1756
  };
1650
1757
 
1651
- class ZikoUseStyle {
1652
- constructor(style = {}, use = style.hasOwnProperty("default")? "default" : Object.keys(style)[0], id = 0) {
1653
- this.id = "Ziko-Style-" + id;
1654
- this.keys = new Set();
1655
- this.styles = {
1656
- default: {
1657
- fontSize: "1em",
1658
- color : "green"
1659
- },
1660
- other: {
1661
- fontSize : "2em",
1662
- color : "cyan"
1663
- }
1664
- };
1665
- style && this.add(style);
1666
- use && this.use(use);
1667
- }
1668
-
1669
- get current() {
1670
- return [...this.keys].reduce((key, value) => {
1671
- key[value] = `var(--${value}-${this.id})`;
1672
- return key;
1673
- }, {});
1674
- }
1675
-
1676
- add(name, style = {}) {
1677
- if (name && typeof name === 'object' && !Array.isArray(name)) {
1678
- Object.assign(this.styles, name);
1679
- } else if (typeof name === 'string') {
1680
- Object.assign(this.styles, { [name]: style });
1681
- }
1682
- return this;
1683
- }
1684
-
1685
- #useStyleIndex(index) {
1686
- const keys = Object.keys(this.styles);
1687
- for (let a in this.styles[keys[index]]) {
1688
- if (Object.prototype.hasOwnProperty.call(this.styles[keys[index]], a)) {
1689
- document.documentElement.style.setProperty(`--${a}-${this.id}`, this.styles[keys[index]][a]);
1690
- this.keys.add(a);
1691
- }
1692
- }
1693
- return this;
1694
- }
1695
-
1696
- #useStyleName(name) {
1697
- if (!this.styles[name]) return this;
1698
- for (let a in this.styles[name]) {
1699
- if (Object.prototype.hasOwnProperty.call(this.styles[name], a)) {
1700
- document.documentElement.style.setProperty(`--${a}-${this.id}`, this.styles[name][a]);
1701
- this.keys.add(a);
1702
- }
1703
- }
1704
- return this;
1705
- }
1706
-
1707
- #useStyleObject(style) {
1708
- for (let a in style) {
1709
- if (Object.prototype.hasOwnProperty.call(style, a)) {
1710
- document.documentElement.style.setProperty(`--${a}-${this.id}`, style[a]);
1711
- this.keys.add(a);
1712
- }
1713
- }
1714
- return this;
1715
- }
1716
-
1717
- use(style) {
1718
- if (typeof style === "number") return this.#useStyleIndex(style);
1719
- if (typeof style === "string") return this.#useStyleName(style);
1720
- if (style && typeof style === "object") return this.#useStyleObject(style);
1721
- return this;
1722
- }
1723
- }
1724
-
1725
- const useStyle = (styles, use, id) => new ZikoUseStyle(styles, use, id);
1726
-
1727
- const addSuffixeToNumber=(value,suffixe="px")=>{
1728
- if(typeof value === "number") value+=suffixe;
1729
- if(value instanceof Array)value=value.map(n=>typeof n==="number"?n+=suffixe:n).join(" ");
1730
- return value;
1731
- };
1732
-
1733
- class ZikoUIElementStyle{
1734
- constructor(defaultStyle={}){
1735
- this.target=null;
1736
- this.styles=new Map(
1737
- [["default",defaultStyle]]
1738
- );
1739
- this.cache={
1740
- isHidden:false,
1741
- isFaddedOut:false,
1742
- transformation:{
1743
- Flip:[0,0,0],
1744
- matrix:new Matrix([
1745
- [1,0,0,0],
1746
- [0,1,0,0],
1747
- [0,0,1,0],
1748
- [0,0,0,1]
1749
- ])
1750
- }
1751
- };
1752
- }
1758
+ const StyleMethods = {
1753
1759
  style(styles){
1754
- for(const [key, value] of Object.entries(styles)){
1755
- if(Str.isCamelCase(key)){
1756
- delete styles[key];
1757
- Object.assign(styles,{[Str.camel2hyphencase(key)]:value});
1760
+ for(let key in styles){
1761
+ const value = styles[key];
1762
+ if(isStateGetter(value)){
1763
+ const getter = value();
1764
+ Object.assign(this.element.style, {[key] : getter.value});
1765
+ getter._subscribe(
1766
+ (newValue) => {
1767
+ console.log({newValue});
1768
+ Object.assign(this.element.style, {[key] : newValue});
1769
+ },
1770
+ // this
1771
+ );
1758
1772
  }
1773
+ else Object.assign(this.element.style, {[key] : value});
1759
1774
  }
1760
- if(this?.target?.element?.style)Object.assign(this?.target?.element?.style, styles);
1761
- return this;
1762
- }
1763
- linkTo(target){
1764
- this.target=target;
1765
- return this;
1766
- }
1767
- use(name="default"){
1768
- this.style(this.styles.get(name));
1769
- return this;
1770
- }
1771
- update(name,styles){
1772
- const old=this.styles.get(name);
1773
- old?this.styles.set(name,Object.assign(old,styles)):this.styles.set(name,styles);
1774
- return this;
1775
- }
1776
- add(name,styles){
1777
- this.styles.set(name,styles);
1778
1775
  return this;
1779
- }
1780
- replace(name,styles){
1781
- this.styles.set(name,styles);
1776
+ },
1777
+ size(width, height){
1778
+ return this.style({width, height})
1779
+ },
1780
+ hide(){
1781
+
1782
+ },
1783
+ show(){
1784
+
1785
+ },
1786
+ animate(keyframe, {duration=1000, iterations=1, easing="ease"}={}){
1787
+ this.element?.animate(keyframe,{duration, iterations, easing});
1782
1788
  return this;
1783
1789
  }
1784
- delete(...names){
1785
- names.forEach(n=>this.styles.delete(n));
1786
- return this;
1790
+ };
1791
+
1792
+ function EVENT_CONTROLLER(e,EVENT,setter,push_object){
1793
+ this.event=e;
1794
+ if(this.cache.preventDefault[EVENT])e.preventDefault();
1795
+ console.log({setter});
1796
+ if(setter)setter();
1797
+ if(this.cache.stream.enabled[EVENT]&&push_object)this.cache.stream.history[EVENT].push(push_object);
1798
+ this.cache.callbacks[EVENT].map(n=>n(this));
1799
+ return this;
1800
+ }
1801
+ class ZikoEvent{
1802
+ constructor(target){
1803
+ this.target=null;
1804
+ this.setTarget(target);
1805
+ this.__dispose=this.dispose.bind(this);
1806
+ // this.EventIndex=Garbage.Pointer.data.length;
1807
+ // Garbage.Pointer.data.push({event:this,index:this.EventIndex});
1787
1808
  }
1788
- updateDefaultStyle(){
1789
- const defaultStyle=Object.fromEntries(
1790
- Object.entries(this.target.element.style).filter(n=>isNaN(+n[0]))
1791
- );
1792
- this.update("default",defaultStyle);
1793
- return this;
1809
+ get targetElement(){
1810
+ return this.target.element
1794
1811
  }
1795
- hover(styles){
1796
- //this.updateDefaultStyle()
1797
- if(styles)this.add("hover",styles);
1798
- this.target?.element?.addEventListener("pointerenter",()=>this.use("hover"));
1799
- this.target?.element?.addEventListener("pointerleave",()=>this.use("default"));
1812
+ setTarget(UI){
1813
+ this.target=UI;
1800
1814
  return this;
1801
1815
  }
1802
- // Checkers
1803
- isInline(){
1804
- return getComputedStyle(this.target.element).display.includes("inline");
1816
+ __handle(event,handler,dispose){
1817
+ const EVENT=(event==="drag")?event:`${this.cache.prefixe}${event}`;
1818
+ this.dispose(dispose);
1819
+ this.targetElement?.addEventListener(EVENT,handler);
1820
+ return this;
1805
1821
  }
1806
- isBlock(){
1807
- return !(this.isInline());
1822
+ __onEvent(event,dispose,...callbacks){
1823
+ if(callbacks.length===0){
1824
+ if(this.cache.callbacks.length>1){
1825
+ this.cache.callbacks.map(n=>e=>n.call(this,e));
1826
+ }
1827
+ else {
1828
+ return this;
1829
+ }
1830
+ }
1831
+ else this.cache.callbacks[event]=callbacks.map(n=>e=>n.call(this,e));
1832
+ this.__handle(event,this.__controller[event],dispose);
1833
+ return this;
1808
1834
  }
1809
- // Size
1810
- size(width,height){
1811
- this.style({
1812
- width,
1813
- height
1814
- });
1835
+ preventDefault(config={}){
1836
+ Object.assign(this.cache.preventDefault,config);
1815
1837
  return this;
1816
1838
  }
1817
- width(w){
1818
- if(w instanceof Object){
1819
- if(w instanceof Array)w={min:w[0],max:w[1]};
1820
- if("min" in w || "max" in w){
1821
- let min= w.min ?? w.max;
1822
- let max= w.max ?? w.min;
1823
- min=addSuffixeToNumber(min,"px");
1824
- max=addSuffixeToNumber(max,"px");
1825
- this.style({ minWidth: min, maxWidth: max }, { target, maskVector });
1826
- }
1827
- }
1828
- else {
1829
- w=addSuffixeToNumber(w,"px");
1830
- this.style({width:w});
1831
- }
1832
- return this
1833
- }
1834
- height(h){
1835
- if(h instanceof Object){
1836
- if(h instanceof Array)h={min:h[0],max:h[1]};
1837
- if("min" in h || "max" in h){
1838
- let min= h.min ?? h.max;
1839
- let max= h.max ?? h.min;
1840
- min=addSuffixeToNumber(min,"px");
1841
- max=addSuffixeToNumber(max,"px");
1842
- this.style({ minHeight: min, maxHeight: max }, { target, maskVector });
1843
- }
1844
- }
1845
- else {
1846
- h=addSuffixeToNumber(h,"px");
1847
- this.style({height:h});
1848
- }
1849
- return this
1850
- }
1851
- enableResize(h=false,v=false){
1852
- let resize="none";
1853
- if(h)v?resize="both":resize="horizontal";
1854
- else v?resize="vertical":resize="none";
1855
- this.style({
1856
- resize,
1857
- overflow:"hidden"
1858
- });
1859
- if(this.isInline()){
1860
- console.group("Ziko Issue : Temporarily Incompatible Method");
1861
- console.warn(".enableResize has no effect on inline elements!");
1862
- console.info("%cConsider using other display types such as block, inline-block, flex, or grid for proper resizing behavior.","color:gold;background-color:#3333cc;padding:5px");
1863
- console.groupEnd();
1839
+ pause(config={}){
1840
+ const all=Object.fromEntries(Object.keys(this.cache.stream.enabled).map(n=>[n,true]));
1841
+ config={...all,...config};
1842
+ for(let key in config){
1843
+ if(config[key]){
1844
+ this.targetElement?.removeEventListener(`${this.cache.prefixe}${key}`,this.__controller[`${this.cache.prefixe}${key}`]);
1845
+ this.cache.paused[`${this.cache.prefixe}${key}`]=true;
1846
+ }
1864
1847
  }
1865
1848
  return this;
1866
- }
1867
- // Apparence
1868
- hide({after, target, maskVector } = {}){
1869
- if(typeof after==="number"){
1870
- const wrapper=()=>this.hide({target,maskVector});
1871
- setTimeout(wrapper, after);
1872
- clearTimeout(wrapper);
1873
- }
1874
- else {
1875
- this.cache.isHidden=true;
1876
- this.style({display:"none"},{target,maskVector});
1849
+ }
1850
+ resume(config={}){
1851
+ const all=Object.fromEntries(Object.keys(this.cache.stream.enabled).map(n=>[n,true]));
1852
+ config={...all,...config};
1853
+ for(let key in config){
1854
+ if(config[key]){
1855
+ this.targetElement?.addEventListener(`${this.cache.prefixe}${key}`,this.__controller[`${this.cache.prefixe}${key}`]);
1856
+ this.cache.paused[`${this.cache.prefixe}${key}`]=false;
1857
+ }
1877
1858
  }
1878
1859
  return this;
1879
- }
1880
- show({after, target, maskVector } = {}){
1881
- if(typeof after==="number"){
1882
- const wrapper=()=>this.show({target,maskVector});
1883
- setTimeout(wrapper, after);
1884
- clearTimeout(wrapper);
1885
- }
1886
- else {
1887
- this.cache.isHidden=false;
1888
- this.style({display:""},{target,maskVector});
1889
- }
1860
+ }
1861
+ dispose(config={}){
1862
+ this.pause(config);
1890
1863
  return this;
1891
- }
1892
- color(color){
1893
- this.style({color});
1864
+ }
1865
+ stream(config={}){
1866
+ this.cache.stream.t0=Date.now();
1867
+ const all=Object.fromEntries(Object.keys(this.cache.stream.enabled).map(n=>[n,true]));
1868
+ config={...all,...config};
1869
+ Object.assign(this.cache.stream.enabled,config);
1894
1870
  return this;
1895
- }
1896
- background(background){
1897
- this.style({background});
1871
+ }
1872
+ clear(config={}){
1873
+ const all=Object.fromEntries(Object.keys(this.cache.stream.clear).map(n=>[n,true]));
1874
+ config={...all,...config};
1875
+ for(let key in config){
1876
+ if(config[key]){
1877
+ this.cache.stream.history[key]=[];
1878
+ }
1879
+ }
1898
1880
  return this;
1899
1881
  }
1900
- backgroundColor(backgroundColor){
1901
- this.style({backgroundColor});
1902
- return this;
1903
- }
1904
- opacity(opacity, { target, maskVector } = {}) {
1905
- this.style({ opacity }, { target, maskVector });
1906
- return this;
1907
- }
1908
- // Placement
1909
- position(position){
1910
- this.style({position});
1911
- return this
1912
- }
1913
- display(disp, { target, maskVector } = {}) {
1914
- this.style({ display: disp }, { target, maskVector });
1915
- return this;
1916
- }
1917
- zIndex(z){
1918
- this.style({zIndex:z});
1919
- return this;
1920
- }
1921
- float(float, { target, maskVector } = {}) {
1922
- this.style({ float: float }, { target, maskVector });
1923
- return this;
1924
- }
1925
- // Box Model
1926
- border(border = "1px solid red", { target, maskVector } = {}){
1927
- this.style({border}, { target, maskVector });
1928
- return this;
1929
- }
1930
- borderTop(borderTop = "1px solid red", { target, maskVector } = {}){
1931
- this.style({borderTop}, { target, maskVector });
1932
- return this;
1933
- }
1934
- borderRight(borderRight = "1px solid red", { target, maskVector } = {}){
1935
- this.style({borderRight}, { target, maskVector });
1936
- return this;
1937
- }
1938
- borderBottom(borderBottom = "1px solid red", { target, maskVector } = {}){
1939
- this.style({borderBottom}, { target, maskVector });
1940
- return this;
1941
- }
1942
- borderLeft(borderLeft = "1px solid red", { target, maskVector } = {}){
1943
- this.style({borderLeft}, { target, maskVector });
1944
- return this;
1945
- }
1946
- borderRadius(radius){
1947
- radius=addSuffixeToNumber(radius,"px");
1948
- this.style({ borderRadius: radius }, { target, maskVector });
1949
- return this;
1950
- }
1951
- margin(margin){
1952
- margin=addSuffixeToNumber(margin,"px");
1953
- this.style({ margin }, { target, maskVector });
1954
- return this;
1955
- }
1956
- marginTop(marginTop){
1957
- marginTop=addSuffixeToNumber(marginTop,"px");
1958
- this.style({marginTop});
1959
- return this;
1960
- }
1961
- marginRight(marginRight){
1962
- marginRight=addSuffixeToNumber(marginRight,"px");
1963
- this.style({marginRight});
1964
- return this;
1965
- }
1966
- marginBootom(marginBootom){
1967
- marginBootom=addSuffixeToNumber(marginBootom,"px");
1968
- this.style({marginBootom});
1969
- return this;
1970
- }
1971
- marginLeft(marginLeft){
1972
- marginLeft=addSuffixeToNumber(marginLeft,"px");
1973
- this.style({marginLeft});
1974
- return this;
1975
- }
1976
- padding(padding){
1977
- padding=addSuffixeToNumber(padding,"px");
1978
- this.style({padding});
1979
- return this;
1980
- }
1981
- paddingTop(paddingTop){
1982
- paddingTop=addSuffixeToNumber(paddingTop,"px");
1983
- this.style({paddingTop});
1984
- return this;
1985
- }
1986
- paddingRight(paddingRight){
1987
- paddingRight=addSuffixeToNumber(paddingRight,"px");
1988
- this.style({paddingRight});
1989
- return this;
1990
- }
1991
- paddingBootom(paddingBootom){
1992
- paddingBootom=addSuffixeToNumber(paddingBootom,"px");
1993
- this.style({paddingBootom});
1994
- return this;
1995
- }
1996
- paddingLeft(paddingLeft){
1997
- paddingLeft=addSuffixeToNumber(paddingLeft,"px");
1998
- this.style({paddingLeft});
1999
- return this;
2000
- }
2001
- // Typographie
2002
- font(font){
2003
- this.style({font});
2004
- return this;
2005
- }
2006
- fontFamily(fontFamily=""){
2007
- this.style({fontFamily});
2008
- return this;
2009
- }
2010
- fontSize(fontSize){
2011
- this.style({fontSize});
2012
- return this;
2013
- }
2014
- // Misc
2015
- cursor(type="pointer"){
2016
- this.style({ cursor: type });
2017
- return this;
2018
- }
2019
- overflow(x,y){
2020
- const values=["hidden","auto"];
2021
- this.style({
2022
- overflowX:typeof x==="number"?values[x]:x,
2023
- overflowY:typeof y==="number"?values[y]:y
2024
- },{target,maskVector});
2025
- return this;
2026
- }
2027
- clip(polygon, { target, maskVector } = {}) {
2028
- if (typeof polygon === "string") polygon = "polygon(" + polygon + ")";
2029
- this.style({ clipPath: polygon }, { target, maskVector });
2030
- return this;
2031
- }
2032
- // Transfromations
2033
- fadeOut(transitionTimming = 1) {
2034
- this.style({
2035
- transition:`opacity ${transitionTimming/1000}s`,
2036
- opacity: 0
2037
- });
2038
- this.cache.isFaddedOut=true;
2039
- return this;
2040
- }
2041
- fadeIn(transitionTimming = 1) {
2042
- this.style({
2043
- transition: `opacity ${transitionTimming/1000}s`,
2044
- opacity: 1
2045
- });
2046
- this.cache.isFaddedOut=false;
2047
- return this;
2048
- }
2049
- toggleFade(t_in = 1000,t_out=t_in){
2050
- this.cache.isFaddedOut?this.fadeIn(t_in):this.fadeOut(t_out);
2051
- return this;
2052
- }
2053
- morphBorderRadius(newValue, transitionTimming){
2054
- this.style({
2055
- borderRadius: newValue,
2056
- transition: `borderRadius ${transitionTimming/1000}s`,
2057
- });
2058
- return this;
2059
- }
2060
- #applyTransformMatrix(transitionTimming){
2061
- const transformMatrix = this.cache.transformation.matrix.arr.join(",");
2062
- this.style({
2063
- transform: `matrix3d(${transformMatrix})`,
2064
- "-webkit-transform": `matrix3d(${transformMatrix})`,
2065
- "-moz-transform": `matrix3d(${transformMatrix})`,
2066
- "-ms-transform": `matrix3d(${transformMatrix})`,
2067
- "-o-transform": `matrix3d(${transformMatrix})`
2068
- });
2069
- if (transitionTimming != 0) this.style({ transition: `transform ${transitionTimming/1000}s ease` });
2070
- }
2071
- translate(dx, dy = dx ,dz = 0, transitionTimming = 0) {
2072
- this.cache.transformation.matrix.set(3,0,dx);
2073
- this.cache.transformation.matrix.set(3,1,dy);
2074
- this.cache.transformation.matrix.set(3,2,dz);
2075
- this.#applyTransformMatrix(transitionTimming);
2076
- return this;
2077
- }
2078
- translateX(dx, transitionTimming = 0) {
2079
- this.cache.transformation.matrix.set(3,0,dx);
2080
- this.#applyTransformMatrix(transitionTimming);
2081
- return this;
2082
- }
2083
- translateY(dy, transitionTimming = 0) {
2084
- this.cache.transformation.matrix.set(3,1,dy);
2085
- this.#applyTransformMatrix(transitionTimming);
2086
- return this;
2087
- }
2088
- translateZ(dz, transitionTimming = 0) {
2089
- const d=-1/this.cache.transformation.matrix[2][2];
2090
- this.cache.transformation.matrix.set(3,2,z);
2091
- this.cache.transformation.matrix.set(3,3,1-(dz/d));
2092
- this.#applyTransformMatrix(transitionTimming);
2093
- return this;
2094
- }
2095
- perspective(distance,transitionTimming=0){
2096
- const z=this.cache.transformation.matrix[3][2];
2097
- this.cache.transformation.matrix.set(2,2,-1/d);
2098
- this.cache.transformation.matrix.set(3,3,1-(z/distance));
2099
- this.#applyTransformMatrix(transitionTimming);
2100
- return this;
2101
- }
2102
- scale(sx, sy = sx, transitionTimming = 0) {
2103
- this.cache.transformation.matrix.set(0,0,sx);
2104
- this.cache.transformation.matrix.set(1,1,sy);
2105
- // const transformMatrix = this.cache.transformation.matrix.arr.join(",");
2106
- this.#applyTransformMatrix(transitionTimming);
2107
- return this;
2108
- }
2109
- scaleX(x = 1 , transitionTimming = 0) {
2110
- this.cache.transformation.matrix.set(0,0,x);
2111
- // const transformMatrix = this.cache.transformation.matrix.arr.join(",");
2112
- this.#applyTransformMatrix(transitionTimming);
2113
- return this;
2114
- }
2115
- scaleY(y = 1, transitionTimming = 0) {
2116
- this.cache.transformation.matrix.set(1,1,y);
2117
- this.cache.transformation.matrix.arr.join(",");
2118
- this.#applyTransformMatrix(transitionTimming);
2119
- return this;
2120
- }
2121
- skew(x, y = x, transitionTimming = 0) {
2122
- this.cache.transformation.matrix.set(0,1,x);
2123
- this.cache.transformation.matrix.set(1,0,y);
2124
- this.cache.transformation.matrix.arr.join(",");
2125
- this.#applyTransformMatrix(transitionTimming);
2126
- return this;
2127
- }
2128
- skewX(x = 1 , transitionTimming = 0) {
2129
- this.cache.transformation.matrix.set(0,1,x);
2130
- this.cache.transformation.matrix.arr.join(",");
2131
- this.#applyTransformMatrix(transitionTimming);
2132
- return this;
2133
- }
2134
- skewY(y = 1, transitionTimming = 0) {
2135
- this.cache.transformation.matrix.set(1,0,y);
2136
- this.cache.transformation.matrix.arr.join(",");
2137
- this.#applyTransformMatrix(transitionTimming);
2138
- return this;
2139
- }
2140
- rotateX(rx, transitionTimming = 0) {
2141
- this.cache.transformation.matrix.set(1,1,cos(rx));
2142
- this.cache.transformation.matrix.set(1,2,-sin(rx));
2143
- this.cache.transformation.matrix.set(2,1,sin(rx));
2144
- this.cache.transformation.matrix.set(1,2,cos(rx));
2145
- this.#applyTransformMatrix(transitionTimming);
2146
- return this;
2147
- }
2148
- rotateY(ry, transitionTimming = 0) {
2149
- this.cache.transformation.matrix.set(0,0,cos(ry));
2150
- this.cache.transformation.matrix.set(0,2,sin(ry));
2151
- this.cache.transformation.matrix.set(2,0,-sin(ry));
2152
- this.cache.transformation.matrix.set(2,2,cos(ry));
2153
- this.#applyTransformMatrix(transitionTimming);
2154
- return this;
2155
- }
2156
- rotateZ(rz, transitionTimming = 0) {
2157
- this.cache.transformation.matrix.set(0,0,cos(rz));
2158
- this.cache.transformation.matrix.set(0,1,-sin(rz));
2159
- this.cache.transformation.matrix.set(1,0,sin(rz));
2160
- this.cache.transformation.matrix.set(1,1,cos(rz));
2161
- this.#applyTransformMatrix(transitionTimming);
2162
- return this;
2163
- }
2164
- flipeX(transitionTimming = 1) {
2165
- this.cache.transformation.Flip[0] += 180;
2166
- this.cache.transformation.Flip[0] %= 360;
2167
- this.rotateX(this.cache.transformation.Flip[0], transitionTimming);
2168
- return this;
2169
- }
2170
- flipeY(transitionTimming = 1) {
2171
- this.cache.transformation.Flip[1] += 180 ;
2172
- this.cache.transformation.Flip[1] %= 360;
2173
- this.rotateY(this.cache.transformation.Flip[1], transitionTimming);
2174
- return this;
2175
- }
2176
- flipeZ(transitionTimming = 1) {
2177
- this.cache.transformation.Flip[2] += 180;
2178
- this.cache.transformation.Flip[2] %= 360;
2179
- this.rotateZ(this.cache.transformation.Flip[2], transitionTimming);
2180
- return this;
2181
- }
2182
- slideHeightIn(transitionTimming = 1, h = this.h) {
2183
- this.style({ transition: transitionTimming + "s", height: h });
2184
- return this;
2185
- }
2186
- slideHeightOut(transitionTimming = 1) {
2187
- this.style({ transition: transitionTimming + "s", height: 0 });
2188
- this.target?.element?.n("transitionend", () =>
2189
- this.style({ opacity: "none" }),
2190
- );
2191
- return this;
2192
- }
2193
- slideWidthIn(transitionTimming = 1, w = this.w) {
2194
- this.style({ transition: transitionTimming + "s", width: w });
2195
- return this;
2196
- }
2197
- slideWidthOut(transitionTimming = 1) {
2198
- this.style({ transition: transitionTimming + "s", width: 0 });
2199
- const wrapper=()=>{
2200
- this.style({ opacity: "none" });
2201
- };
2202
- this.target?.element?.addEventListener("transitionend",wrapper);
2203
- this.target?.element?.removeEventListener("transitionend",wrapper);
2204
- return this;
2205
- }
2206
- slideIn({ transitionTimming = 1, w = "100%", h = "auto" } = {}) {
2207
- this.style({
2208
- transition: transitionTimming + "s",
2209
- width: w,
2210
- height: h,
2211
- visibility: "visible",
2212
- });
2213
- return this;
2214
- }
2215
- slideOut({ transitionTimming = 1, width = 0, heightransitionTimming = 0 } = {}) {
2216
- this.style({
2217
- visibility: "hidden",
2218
- transition: transitionTimming + "s",
2219
- opacity: "none",
2220
- width: width,
2221
- height: height,
2222
- });
2223
- const wrapper=()=>{
2224
- this.style({ opacity: "none" });
2225
- };
2226
- this.target?.element?.addEventListener("transitionend",wrapper);
2227
- this.target?.element?.removeEventListener("transitionend",wrapper);
2228
- return this;
2229
- }
2230
-
2231
- }
2232
-
2233
- function EVENT_CONTROLLER(e,EVENT,setter,push_object){
2234
- this.event=e;
2235
- if(this.cache.preventDefault[EVENT])e.preventDefault();
2236
- console.log({setter});
2237
- if(setter)setter();
2238
- if(this.cache.stream.enabled[EVENT]&&push_object)this.cache.stream.history[EVENT].push(push_object);
2239
- this.cache.callbacks[EVENT].map(n=>n(this));
2240
- return this;
2241
- }
2242
- class ZikoEvent{
2243
- constructor(target){
2244
- this.target=null;
2245
- this.setTarget(target);
2246
- this.__dispose=this.dispose.bind(this);
2247
- // this.EventIndex=Garbage.Pointer.data.length;
2248
- // Garbage.Pointer.data.push({event:this,index:this.EventIndex});
2249
- }
2250
- get targetElement(){
2251
- return this.target.element
2252
- }
2253
- setTarget(UI){
2254
- this.target=UI;
2255
- return this;
2256
- }
2257
- __handle(event,handler,dispose){
2258
- const EVENT=(event==="drag")?event:`${this.cache.prefixe}${event}`;
2259
- this.dispose(dispose);
2260
- this.targetElement?.addEventListener(EVENT,handler);
2261
- return this;
2262
- }
2263
- __onEvent(event,dispose,...callbacks){
2264
- if(callbacks.length===0){
2265
- if(this.cache.callbacks.length>1){
2266
- this.cache.callbacks.map(n=>e=>n.call(this,e));
2267
- }
2268
- else {
2269
- return this;
2270
- }
2271
- }
2272
- else this.cache.callbacks[event]=callbacks.map(n=>e=>n.call(this,e));
2273
- this.__handle(event,this.__controller[event],dispose);
2274
- return this;
2275
- }
2276
- preventDefault(config={}){
2277
- Object.assign(this.cache.preventDefault,config);
2278
- return this;
2279
- }
2280
- pause(config={}){
2281
- const all=Object.fromEntries(Object.keys(this.cache.stream.enabled).map(n=>[n,true]));
2282
- config={...all,...config};
2283
- for(let key in config){
2284
- if(config[key]){
2285
- this.targetElement?.removeEventListener(`${this.cache.prefixe}${key}`,this.__controller[`${this.cache.prefixe}${key}`]);
2286
- this.cache.paused[`${this.cache.prefixe}${key}`]=true;
2287
- }
2288
- }
2289
- return this;
2290
- }
2291
- resume(config={}){
2292
- const all=Object.fromEntries(Object.keys(this.cache.stream.enabled).map(n=>[n,true]));
2293
- config={...all,...config};
2294
- for(let key in config){
2295
- if(config[key]){
2296
- this.targetElement?.addEventListener(`${this.cache.prefixe}${key}`,this.__controller[`${this.cache.prefixe}${key}`]);
2297
- this.cache.paused[`${this.cache.prefixe}${key}`]=false;
2298
- }
2299
- }
2300
- return this;
2301
- }
2302
- dispose(config={}){
2303
- this.pause(config);
2304
- return this;
2305
- }
2306
- stream(config={}){
2307
- this.cache.stream.t0=Date.now();
2308
- const all=Object.fromEntries(Object.keys(this.cache.stream.enabled).map(n=>[n,true]));
2309
- config={...all,...config};
2310
- Object.assign(this.cache.stream.enabled,config);
2311
- return this;
2312
- }
2313
- clear(config={}){
2314
- const all=Object.fromEntries(Object.keys(this.cache.stream.clear).map(n=>[n,true]));
2315
- config={...all,...config};
2316
- for(let key in config){
2317
- if(config[key]){
2318
- this.cache.stream.history[key]=[];
2319
- }
2320
- }
2321
- return this;
2322
- }
2323
- }
2324
-
2325
- function input_controller(e){
2326
- EVENT_CONTROLLER.call(this,e,"input",null,null);
2327
- }
2328
- function change_controller(e){
2329
- EVENT_CONTROLLER.call(this,e,"change",null,null);
2330
- }
2331
- class ZikoEventInput extends ZikoEvent{
2332
- constructor(target){
2333
- super(target);
2334
- this.event=null;
2335
- this.cache={
2336
- prefixe:"",
2337
- preventDefault:{
2338
- input:false,
2339
- change:false,
2340
- },
2341
- paused:{
2342
- input:false,
2343
- change:false,
2344
- },
2345
- stream:{
2346
- enabled:{
2347
- input:false,
2348
- change:false,
2349
- },
2350
- clear:{
2351
- input:false,
2352
- change:false,
2353
- },
2354
- history:{
2355
- input:[],
2356
- change:[],
2357
- }
2358
- },
2359
- callbacks:{
2360
- input:[],
2361
- change:[],
2362
- }
2363
- };
2364
- this.__controller={
2365
- input:input_controller.bind(this),
2366
- change:change_controller.bind(this),
2367
- };
1882
+ }
1883
+
1884
+ function input_controller(e){
1885
+ EVENT_CONTROLLER.call(this,e,"input",null,null);
1886
+ }
1887
+ function change_controller(e){
1888
+ EVENT_CONTROLLER.call(this,e,"change",null,null);
1889
+ }
1890
+ class ZikoEventInput extends ZikoEvent{
1891
+ constructor(target){
1892
+ super(target);
1893
+ this.event=null;
1894
+ this.cache={
1895
+ prefixe:"",
1896
+ preventDefault:{
1897
+ input:false,
1898
+ change:false,
1899
+ },
1900
+ paused:{
1901
+ input:false,
1902
+ change:false,
1903
+ },
1904
+ stream:{
1905
+ enabled:{
1906
+ input:false,
1907
+ change:false,
1908
+ },
1909
+ clear:{
1910
+ input:false,
1911
+ change:false,
1912
+ },
1913
+ history:{
1914
+ input:[],
1915
+ change:[],
1916
+ }
1917
+ },
1918
+ callbacks:{
1919
+ input:[],
1920
+ change:[],
1921
+ }
1922
+ };
1923
+ this.__controller={
1924
+ input:input_controller.bind(this),
1925
+ change:change_controller.bind(this),
1926
+ };
2368
1927
  }
2369
1928
  get value(){
2370
1929
  return this.target.value;
@@ -3269,8 +2828,8 @@ function __init__global__(){
3269
2828
  }
3270
2829
 
3271
2830
  __init__global__();
3272
- class ZikoUIElement extends ZikoUINode{
3273
- constructor(element, name="", {type="html", useDefaultStyle=false}={}){
2831
+ class UIElement extends UINode{
2832
+ constructor({element, name ='', type="html", useDefaultStyle=false}={}){
3274
2833
  super();
3275
2834
  this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
3276
2835
  if(typeof element === "string") {
@@ -3281,9 +2840,16 @@ class ZikoUIElement extends ZikoUINode{
3281
2840
  }
3282
2841
  }
3283
2842
  else {
3284
- this.target = element.parentElement;
3285
- }
3286
- register(this, DomMethods, IndexingMethods, EventsMethodes);
2843
+ this.target = element?.parentElement;
2844
+ }
2845
+ register(
2846
+ this,
2847
+ AttrsMethods,
2848
+ DomMethods,
2849
+ StyleMethods,
2850
+ IndexingMethods,
2851
+ EventsMethodes
2852
+ );
3287
2853
  Object.assign(this.cache, {
3288
2854
  name,
3289
2855
  isInteractive : [true, false][Math.floor(2*Math.random())],
@@ -3293,7 +2859,6 @@ class ZikoUIElement extends ZikoUINode{
3293
2859
  isHidden: false,
3294
2860
  isFrozzen:false,
3295
2861
  legacyParent : null,
3296
- style: new ZikoUIElementStyle({}),
3297
2862
  attributes: {},
3298
2863
  filters: {},
3299
2864
  temp:{}
@@ -3318,7 +2883,6 @@ class ZikoUIElement extends ZikoUINode{
3318
2883
  if(element)Object.assign(this.cache,{element});
3319
2884
  this.uuid = `${this.cache.name}-${Random.string(16)}`;
3320
2885
  this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
3321
- this.cache.style.linkTo(this);
3322
2886
  useDefaultStyle && this.style({
3323
2887
  position: "relative",
3324
2888
  boxSizing:"border-box",
@@ -3400,25 +2964,17 @@ class ZikoUIElement extends ZikoUINode{
3400
2964
  else UI.element=this.element.cloneNode(true);
3401
2965
  return UI.render(render);
3402
2966
  }
3403
- style(styles){
3404
- styles instanceof ZikoUseStyle ? this.st.style(styles.current): this.st.style(styles);
3405
- return this;
3406
- }
3407
- size(width,height){
3408
- this.st.size(width,height);
3409
- return this;
3410
- }
3411
2967
  [Symbol.iterator]() {
3412
2968
  return this.items[Symbol.iterator]();
3413
2969
  }
3414
2970
  maintain() {
3415
- for (let i = 0; i < this.items.length; i++) {
3416
- Object.defineProperty(this, i, {
3417
- value: this.items[i],
3418
- writable: true,
3419
- configurable: true,
3420
- enumerable: false
3421
- });
2971
+ for (let i = 0; i < this.items.length; i++) {
2972
+ Object.defineProperty(this, i, {
2973
+ value: this.items[i],
2974
+ writable: true,
2975
+ configurable: true,
2976
+ enumerable: false
2977
+ });
3422
2978
  }
3423
2979
  }
3424
2980
  freeze(freeze){
@@ -3436,43 +2992,6 @@ class ZikoUIElement extends ZikoUINode{
3436
2992
  describe(label){
3437
2993
  if(label)this.setAttr("aria-label",label);
3438
2994
  }
3439
- animate(keyframe, {duration=1000, iterations=1, easing="ease"}={}){
3440
- this.element?.animate(keyframe,{duration, iterations, easing});
3441
- return this;
3442
- }
3443
- // Attributes
3444
- #setAttr(name, value){
3445
- if(this.element?.tagName !== "svg") name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
3446
- if(this?.attr[name] && this?.attr[name]===value) return;
3447
- this.element?.setAttribute(name, value);
3448
- Object.assign(this.cache.attributes, {[name]:value});
3449
- }
3450
- setAttr(name, value) {
3451
- if(name instanceof Object){
3452
- const [names,values]=[Object.keys(name),Object.values(name)];
3453
- for(let i=0;i<names.length;i++){
3454
- if(values[i] instanceof Array)value[i] = values[i].join(" ");
3455
- this.#setAttr(names[i], values[i]);
3456
- }
3457
- }
3458
- else {
3459
- if(value instanceof Array)value = value.join(" ");
3460
- this.#setAttr(name, value);
3461
- }
3462
- return this;
3463
- }
3464
- removeAttr(...names) {
3465
- for(let i=0;i<names.length;i++)this.element?.removeAttribute(names[i]);
3466
- return this;
3467
- }
3468
- getAttr(name){
3469
- name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
3470
- return this.element.attributes[name].value;
3471
- }
3472
- setContentEditable(bool = true) {
3473
- this.setAttr("contenteditable", bool);
3474
- return this;
3475
- }
3476
2995
  get children() {
3477
2996
  return [...this.element.children];
3478
2997
  }
@@ -3667,10 +3186,6 @@ const SVGTags = [
3667
3186
  "desc", "title", "metadata", "foreignObject"
3668
3187
  ];
3669
3188
 
3670
- const isStateGetter = (arg) => {
3671
- return typeof(arg) === 'function' && arg?.()?.isStateGetter?.()
3672
- };
3673
-
3674
3189
  const tags = new Proxy({}, {
3675
3190
  get(target, prop) {
3676
3191
  if (typeof prop !== 'string') return undefined;
@@ -3678,27 +3193,23 @@ const tags = new Proxy({}, {
3678
3193
  let type ;
3679
3194
  if(HTMLTags.includes(tag)) type = 'html';
3680
3195
  if(SVGTags.includes(tag)) type = 'svg';
3681
- if(HTMLTags.includes(tag)) return (...args)=>{
3196
+ return (...args)=>{
3682
3197
  console.log(isStateGetter(args[0]));
3683
- // if(typeof args[0] === 'function') {
3684
- // console.log(args[0], args[0]?.() instanceof StateGetter)
3685
- // globalThis.a = args[0]
3686
- // console.log({t : a.constructor})
3687
- // }
3688
3198
  if(
3689
3199
  ['string', 'number'].includes(typeof args[0])
3690
- || args[0] instanceof ZikoUIElement
3200
+ || args[0] instanceof UIElement
3691
3201
  || (typeof args[0] === 'function' && args[0]().isStateGetter())
3692
- ) return new ZikoUIElement(tag, tag, {type}).append(...args);
3693
- return new ZikoUIElement(tag).setAttr(args.shift()).append(...args)
3202
+ ) return new UIElement({element : tag, name : tag, type}).append(...args);
3203
+ // console.log(args[0])
3204
+ return new UIElement({element : tag}).setAttr(args.shift()).append(...args)
3694
3205
  }
3695
- // if(SVGTags.includes(tag)) return (...args) => new ZikoUIElement(tag,"",{el_type : "svg"}).append(...args);
3206
+ // if(SVGTags.includes(tag)) return (...args) => new UIElement(tag,"",{el_type : "svg"}).append(...args);
3696
3207
  // return (...args)=>{
3697
- // if(!(args[0] instanceof ZikoUIElement) && args[0] instanceof Object){
3208
+ // if(!(args[0] instanceof UIElement) && args[0] instanceof Object){
3698
3209
  // let attributes = args.shift()
3699
- // return new ZikoUIElement(tag).setAttr(attributes).append(...args)
3210
+ // return new UIElement(tag).setAttr(attributes).append(...args)
3700
3211
  // }
3701
- // return new ZikoUIElement(tag).append(...args);
3212
+ // return new UIElement(tag).append(...args);
3702
3213
  // }
3703
3214
  // // switch(tag){
3704
3215
  // case "html" : globalThis?.document?.createElement("html")
@@ -3708,14 +3219,14 @@ const tags = new Proxy({}, {
3708
3219
  // case "meta" :
3709
3220
  // case "srcipt":
3710
3221
  // case "body" : return null; break;
3711
- // default : return new ZikoUIElement(tag);
3222
+ // default : return new UIElement(tag);
3712
3223
  // }
3713
3224
  }
3714
3225
  });
3715
3226
 
3716
- class ZikoUIFlex extends ZikoUIElement {
3227
+ class ZikoUIFlex extends UIElement {
3717
3228
  constructor(tag = "div", w = "100%", h = "100%") {
3718
- super(tag ,"Flex");
3229
+ super({element : tag , name : "Flex"});
3719
3230
  this.direction = "cols";
3720
3231
  if (typeof w == "number") w += "%";
3721
3232
  if (typeof h == "number") h += "%";
@@ -3783,13 +3294,13 @@ class ZikoUIFlex extends ZikoUIElement {
3783
3294
  }
3784
3295
  }
3785
3296
 
3786
- const Flex = (...ZikoUIElement) =>{
3297
+ const Flex = (...UIElement) =>{
3787
3298
  let tag="div";
3788
- if(typeof ZikoUIElement[0]==="string"){
3789
- tag=ZikoUIElement[0];
3790
- ZikoUIElement.pop();
3299
+ if(typeof UIElement[0]==="string"){
3300
+ tag=UIElement[0];
3301
+ UIElement.pop();
3791
3302
  }
3792
- return new ZikoUIFlex(tag).append(...ZikoUIElement);
3303
+ return new ZikoUIFlex(tag).append(...UIElement);
3793
3304
  };
3794
3305
  function set_vertical(direction){
3795
3306
  direction == 1
@@ -3812,9 +3323,9 @@ function map_pos_y(align){
3812
3323
  return map_pos_x(-align);
3813
3324
  }
3814
3325
 
3815
- class ZikoUIGrid extends ZikoUIElement {
3326
+ class ZikoUIGrid extends UIElement {
3816
3327
  constructor(tag ="div", w = "50vw", h = "50vh") {
3817
- super(tag,"Grid");
3328
+ super({element : tag, name : "Grid"});
3818
3329
  this.direction = "cols";
3819
3330
  if (typeof w == "number") w += "%";
3820
3331
  if (typeof h == "number") h += "%";
@@ -3842,11 +3353,11 @@ class ZikoUIGrid extends ZikoUIElement {
3842
3353
  return this;
3843
3354
  }
3844
3355
  }
3845
- const Grid$1 = (...ZikoUIElement) => new ZikoUIGrid("div").append(...ZikoUIElement);
3356
+ const Grid$1 = (...UIElement) => new ZikoUIGrid("div").append(...UIElement);
3846
3357
 
3847
- class ZikoUISuspense extends ZikoUIElement{
3358
+ class ZikoUISuspense extends UIElement{
3848
3359
  constructor(fallback_ui, callback){
3849
- super("div", "suspense");
3360
+ super({element : "div", name : "suspense"});
3850
3361
  this.setAttr({
3851
3362
  dataTemp : "suspense"
3852
3363
  });
@@ -3868,9 +3379,9 @@ class ZikoUISuspense extends ZikoUIElement{
3868
3379
 
3869
3380
  const Suspense = (fallback_ui, callback) => new ZikoUISuspense(fallback_ui, callback);
3870
3381
 
3871
- class ZikoUIXMLWrapper extends ZikoUIElement{
3382
+ class ZikoUIXMLWrapper extends UIElement{
3872
3383
  constructor(XMLContent, type){
3873
- super("div", "");
3384
+ super({element : "div", name : ""});
3874
3385
  this.element.append(type==="svg"?svg2dom(XMLContent):html2dom(XMLContent));
3875
3386
  }
3876
3387
  }
@@ -3902,7 +3413,7 @@ class ZikoUISVGWrapper extends ZikoUIXMLWrapper{
3902
3413
  const HTMLWrapper = (HTMLContent) => new ZikoUIHTMLWrapper(HTMLContent);
3903
3414
  const SVGWrapper = (SVGContent) => new ZikoUISVGWrapper(SVGContent);
3904
3415
 
3905
- class ZikoUICanvas extends ZikoUIElement{
3416
+ class ZikoUICanvas extends UIElement{
3906
3417
  constructor(w,h){
3907
3418
  super("canvas","canvas");
3908
3419
  this.ctx = this.element?.getContext("2d");
@@ -4072,7 +3583,7 @@ class ZikoUICanvas extends ZikoUIElement{
4072
3583
 
4073
3584
  const Canvas=(w,h)=>new ZikoUICanvas(w,h);
4074
3585
 
4075
- class ZikoUISvg extends ZikoUIElement {
3586
+ class ZikoUISvg extends UIElement {
4076
3587
  constructor(w=360,h=300) {
4077
3588
  super("svg","svg");
4078
3589
  //this.cache={};
@@ -4281,175 +3792,6 @@ function trimKeys(obj) {
4281
3792
  }, Array.isArray(obj) ? [] : {});
4282
3793
  }
4283
3794
 
4284
- const Patterns={
4285
- isDigit: /^\d+$/,
4286
- isURL: /^(https?:\/\/)?([\w\-]+\.)+[\w\-]+(\/[\w\-./?%&=]*)?$/,
4287
- isHexColor: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,
4288
- isIPv4: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
4289
- isMACAddress: /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/,
4290
- isDate: /^\d{4}-\d{2}-\d{2}$/,
4291
- };
4292
-
4293
- class Str{
4294
- constructor(string){
4295
- this.string=string;
4296
- }
4297
- isDigit() {
4298
- return Patterns.isDigit.test(this.string);
4299
- }
4300
- static isDigit(string){
4301
- return new Str(string).isDigit();
4302
- }
4303
- isNumber() {
4304
- return !isNaN(this.string);
4305
- }
4306
- static isNumber(string){
4307
- return new Str(string).isNumber();
4308
- }
4309
- isUrl(){
4310
- return Patterns.isURL.test(this.string);
4311
- }
4312
- static isUrl(string){
4313
- return new Str(string).isUrl();
4314
- }
4315
- isHexColor(){
4316
- return Patterns.isHexColor.test(this.string);
4317
- }
4318
- static isHexColor(string){
4319
- return new Str(string).isHexColor();
4320
- }
4321
- isIPv4(){
4322
- return Patterns.isIPv4.test(this.string);
4323
- }
4324
- static isIPv4(string){
4325
- return new Str(string).isIPv4();
4326
- }
4327
- isDate(){
4328
- return Patterns.isDate.test(this.string);
4329
- }
4330
- static isDate(string){
4331
- return new Str(string).isDate();
4332
- }
4333
- isMACAddress(){
4334
- return Patterns.isMACAddress.test(this.string);
4335
- }
4336
- static isMACAddress(string){
4337
- return new Str(string).isMACAddress();
4338
- }
4339
- isPascalCase(){
4340
- if (this.string.length === 0) return false;
4341
- const PascalCasePattern = /^[A-Z][a-zA-Z0-9]*$/;
4342
- return PascalCasePattern.test(this.string);
4343
- }
4344
- static isPascalCase(string){
4345
- return new Str(string).isPascalCase();
4346
- }
4347
- isCamelCase() {
4348
- if (this.string.length === 0) return false;
4349
- const camelCasePattern = /^[a-z][a-zA-Z0-9]*$/;
4350
- return camelCasePattern.test(this.string);
4351
- }
4352
- static isCamelCase(string){
4353
- return new Str(string).isCamelCase();
4354
- }
4355
- isHyphenCase(){
4356
- return this.string.split('-').length > 1;
4357
- }
4358
- static isHyphenCase(string){
4359
- return new Str(string).isHyphenCase();
4360
- }
4361
- isSnakeCase(){
4362
- return this.string.split('_').length > 1;
4363
- }
4364
- static isSnakeCase(string){
4365
- return new Str(string).isSnakeCase();
4366
- }
4367
- isPalindrome(){
4368
- const str=this.string.toLocaleLowerCase();
4369
- let l=str.length,i;
4370
- for(i=0;i<l/2;i++)if(str[i]!=str[l-i-1])return false;
4371
- return true;
4372
- }
4373
- static isPalindrome(string){
4374
- return new Str(string).isPalindrome();
4375
- }
4376
- static isAnagrams(word,words){
4377
- word=word.split("").sort();
4378
- words=words.split("").sort();
4379
- return JSON.stringify(word)===JSON.stringify(words);
4380
- }
4381
- isIsogram(){
4382
- return [...new Set(this.string.toLowerCase())].length===this.string.length;
4383
- }
4384
- static isIsogram(string){
4385
- return new Str(string).isIsogram();
4386
- }
4387
- static camel2hyphencase(text) {
4388
- return text.replace(/[A-Z]/g, match => '-' + match.toLowerCase());
4389
- }
4390
- static camel2snakecase(text) {
4391
- return text.replace(/[A-Z]/g, match => '_' + match.toLowerCase());
4392
- }
4393
- static camel2pascalcase(text) {
4394
- return text.charAt(0).toUpperCase() + text.slice(1);
4395
- }
4396
- static camel2constantcase(text) {
4397
- return text.replace(/[A-Z]/g, match => '_' + match).toUpperCase();
4398
- }
4399
- static pascal2snakecase(text) {
4400
- return text.replace(/([A-Z])/g, (match, offset) => offset ? '_' + match.toLowerCase() : match.toLowerCase());
4401
- }
4402
- static pascal2hyphencase(text) {
4403
- return text.replace(/([A-Z])/g, (match, offset) => offset ? '-' + match.toLowerCase() : match.toLowerCase());
4404
- }
4405
- static pascal2camelcase(text) {
4406
- return text.charAt(0).toLowerCase() + text.slice(1);
4407
- }
4408
- static pascal2constantcase(text) {
4409
- return text.replace(/([A-Z])/g, (match, offset) => offset ? '_' + match : match).toUpperCase();
4410
- }
4411
- static snake2camelcase(text) {
4412
- return text.replace(/(_\w)/g, match => match[1].toUpperCase());
4413
- }
4414
- static snake2hyphencase(text) {
4415
- return text.replace(/_/g, "-");
4416
- }
4417
- static snake2pascalcase(text) {
4418
- return text.split('_').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
4419
- }
4420
- static snake2constantcase(text) {
4421
- return text.toUpperCase();
4422
- }
4423
- static hyphen2camelcase(text) {
4424
- return text.replace(/-([a-z])/g, match => match[1].toUpperCase());
4425
- }
4426
- static hyphen2snakecase(text) {
4427
- return text.replace(/-/g, '_');
4428
- }
4429
- static hyphen2pascalcase(text) {
4430
- return text.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
4431
- }
4432
- static hyphen2constantcase(text) {
4433
- return text.replace(/-/g, '_').toUpperCase();
4434
- }
4435
- static constant2camelcase(text) {
4436
- return text.toLowerCase().replace(/_([a-z])/g, match => match[1].toUpperCase());
4437
- }
4438
- static constant2snakecase(text) {
4439
- return text.toLowerCase();
4440
- }
4441
- static constant2pascalcase(text) {
4442
- return text.toLowerCase().split('_').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
4443
- }
4444
- static constant2hyphencase(text) {
4445
- return text.toLowerCase().replace(/_/g, '-');
4446
- }
4447
- }
4448
- const removeExtraSpace=str=>str.replace(/\s+/g,' ');
4449
- const count=(str,value)=>str.split("").filter(x => x==value).length;
4450
- const countWords=(str,value)=>str.split(" ").filter(x => x==value).length;
4451
- const str=string=>new Str(string);
4452
-
4453
3795
  class Matrix extends ZikoMath{
4454
3796
  constructor(rows, cols, element = [] ) {
4455
3797
  super();
@@ -4608,7 +3950,7 @@ class Matrix extends ZikoMath{
4608
3950
  .mul(determinat(deleteRowAndColumn(M, i)))
4609
3951
  );*/
4610
3952
  //const to_be_added=Utils.add(Utils.mul(pow(-1, i),Utils.mul(M[0][i],determinat(deleteRowAndColumn(M, i)))));
4611
- const to_be_added=Utils.add(Utils.mul(pow(-1, i),Utils.mul(M[0][i],determinat(deleteRowAndColumn(M, i)))));
3953
+ const to_be_added=Utils.add(Utils.mul(pow$1(-1, i),Utils.mul(M[0][i],determinat(deleteRowAndColumn(M, i)))));
4612
3954
  answer=Utils.add(answer,to_be_added);
4613
3955
  }
4614
3956
  return answer;
@@ -5131,7 +4473,7 @@ class Complex extends ZikoMath{
5131
4473
  }
5132
4474
  else if(("a" in b && "z" in a)){
5133
4475
  this.a=a.a;
5134
- this.b=sqrt((a.z**2)-(a.a**2));
4476
+ this.b=sqrt$1((a.z**2)-(a.a**2));
5135
4477
  }
5136
4478
  else if(("a" in b && "phi" in a)){
5137
4479
  this.a=a.a;
@@ -5139,15 +4481,15 @@ class Complex extends ZikoMath{
5139
4481
  }
5140
4482
  else if(("b" in b && "z" in a)){
5141
4483
  this.b=a.b;
5142
- this.a=sqrt((a.z**2)-(a.b**2));
4484
+ this.a=sqrt$1((a.z**2)-(a.b**2));
5143
4485
  }
5144
4486
  else if(("b" in b && "phi" in a)){
5145
4487
  this.b=b;
5146
4488
  this.a=a.b/tan(a.phi);
5147
4489
  }
5148
4490
  else if(("z" in b && "phi" in a)){
5149
- this.a=a.z*cos(a.phi);
5150
- this.a=a.z*sin(a.phi);
4491
+ this.a=a.z*cos$1(a.phi);
4492
+ this.a=a.z*sin$1(a.phi);
5151
4493
  }
5152
4494
  }
5153
4495
  else if(typeof(a)==="number"&&typeof(b)==="number"){
@@ -5187,7 +4529,7 @@ class Complex extends ZikoMath{
5187
4529
  return new Complex(this.a, -this.b);
5188
4530
  }
5189
4531
  get inv() {
5190
- return new Complex(this.a / (pow(this.a, 2) + pow(this.b, 2)), -this.b / (pow(this.a, 2) + pow(this.b, 2)));
4532
+ return new Complex(this.a / (pow$1(this.a, 2) + pow$1(this.b, 2)), -this.b / (pow$1(this.a, 2) + pow$1(this.b, 2)));
5191
4533
  }
5192
4534
  add(...z) {
5193
4535
  for (let i = 0; i < z.length; i++) {
@@ -5215,8 +4557,8 @@ class Complex extends ZikoMath{
5215
4557
  }
5216
4558
  let Z=+prod(this.z,...z.map(n=>n.z)).toFixed(15);
5217
4559
  let phi=+sum(this.phi,...z.map(n=>n.phi)).toFixed(15);
5218
- this.a=+(Z*cos(phi).toFixed(15)).toFixed(14);
5219
- this.b=+(Z*sin(phi).toFixed(15)).toFixed(14);
4560
+ this.a=+(Z*cos$1(phi).toFixed(15)).toFixed(14);
4561
+ this.b=+(Z*sin$1(phi).toFixed(15)).toFixed(14);
5220
4562
  return this;
5221
4563
  }
5222
4564
  div(...z) {
@@ -5225,23 +4567,23 @@ class Complex extends ZikoMath{
5225
4567
  }
5226
4568
  let Z=+(this.z/prod(...z.map(n=>n.z))).toFixed(15);
5227
4569
  let phi=+(this.phi-sum(...z.map(n=>n.phi))).toFixed(15);
5228
- this.a=+(Z*cos(phi).toFixed(15)).toFixed(15);
5229
- this.b=+(Z*sin(phi).toFixed(15)).toFixed(15);
4570
+ this.a=+(Z*cos$1(phi).toFixed(15)).toFixed(15);
4571
+ this.b=+(Z*sin$1(phi).toFixed(15)).toFixed(15);
5230
4572
  return this;
5231
4573
  }
5232
4574
  pow(n) {
5233
4575
  if (floor(n) === n && n > 0) {
5234
4576
  let z=+(this.z**n).toFixed(15);
5235
4577
  let phi=+(this.phi*n).toFixed(15);
5236
- this.a=+(z*cos(phi).toFixed(15)).toFixed(15);
5237
- this.b=+(z*sin(phi).toFixed(15)).toFixed(15);
4578
+ this.a=+(z*cos$1(phi).toFixed(15)).toFixed(15);
4579
+ this.b=+(z*sin$1(phi).toFixed(15)).toFixed(15);
5238
4580
  }
5239
4581
  return this;
5240
4582
  }
5241
4583
  static fromExpo(z, phi) {
5242
4584
  return new Complex(
5243
- +(z * cos(phi)).toFixed(13),
5244
- +(z * sin(phi)).toFixed(13)
4585
+ +(z * cos$1(phi)).toFixed(13),
4586
+ +(z * sin$1(phi)).toFixed(13)
5245
4587
  );
5246
4588
  }
5247
4589
  get expo() {
@@ -5263,10 +4605,10 @@ class Complex extends ZikoMath{
5263
4605
  return z.clone.pow(n);
5264
4606
  }
5265
4607
  static xpowZ(x){
5266
- return complex((x**this.a)*cos(this.b*ln(x)),(x**this.a)*sin(this.b*ln(x)));
4608
+ return complex((x**this.a)*cos$1(this.b*ln(x)),(x**this.a)*sin$1(this.b*ln(x)));
5267
4609
  }
5268
4610
  sqrtn(n=2){
5269
- return complex(sqrtn(this.z,n)*cos(this.phi/n),sqrtn(this.z,n)*sin(this.phi/n));
4611
+ return complex(sqrtn(this.z,n)*cos$1(this.phi/n),sqrtn(this.z,n)*sin$1(this.phi/n));
5270
4612
  }
5271
4613
  get sqrt(){
5272
4614
  return this.sqrtn(2);
@@ -5275,14 +4617,14 @@ class Complex extends ZikoMath{
5275
4617
  return complex(this.z,this.phi);
5276
4618
  }
5277
4619
  get cos(){
5278
- return complex(cos(this.a)*cosh(this.b),sin(this.a)*sinh(this.b))
4620
+ return complex(cos$1(this.a)*cosh(this.b),sin$1(this.a)*sinh(this.b))
5279
4621
  }
5280
4622
  get sin(){
5281
- return complex(sin(this.a)*cosh(this.b),cos(this.a)*sinh(this.b))
4623
+ return complex(sin$1(this.a)*cosh(this.b),cos$1(this.a)*sinh(this.b))
5282
4624
  }
5283
4625
  get tan(){
5284
- const de=cos(this.a*2)+cosh(this.b*2);
5285
- return complex(sin(2*this.a)/de,sinh(2*this.b)/de);
4626
+ const de=cos$1(this.a*2)+cosh(this.b*2);
4627
+ return complex(sin$1(2*this.a)/de,sinh(2*this.b)/de);
5286
4628
  }
5287
4629
  printInConsole() {
5288
4630
  let string = this.a + " + " + this.b + " * i";
@@ -5313,12 +4655,12 @@ const complex=(a,b)=>{
5313
4655
  // } from "../calculus/index.js";
5314
4656
 
5315
4657
  const abs=(...x)=>mapfun$1(Math.abs,...x);
5316
- const sqrt=(...x)=>mapfun$1(Math.sqrt,...x);
5317
- const pow=(x,n)=>{
4658
+ const sqrt$1=(...x)=>mapfun$1(Math.sqrt,...x);
4659
+ const pow$1=(x,n)=>{
5318
4660
  if(typeof x === "number"){
5319
4661
  if(typeof n === "number")return Math.pow(x,n);
5320
4662
  else if(n instanceof Complex)return Complex.fromExpo(x**n.a,n.b*ln(x))
5321
- else return mapfun$1(a=>pow(x,a),...n);
4663
+ else return mapfun$1(a=>pow$1(x,a),...n);
5322
4664
  }
5323
4665
  else if(x instanceof Complex){
5324
4666
  if(typeof n === "number")return Complex.fromExpo(x.z**n,x.phi*n);
@@ -5326,14 +4668,14 @@ const pow=(x,n)=>{
5326
4668
  x.z**n.a*e(-x.phi*n.b),
5327
4669
  ln(x.z)*n.b+n.a*x.phi
5328
4670
  )
5329
- else return mapfun$1(a=>pow(x,a),...n);
4671
+ else return mapfun$1(a=>pow$1(x,a),...n);
5330
4672
  }
5331
4673
  else if(x instanceof Array){
5332
- if(typeof n === "number") return mapfun$1(a=>pow(a,n),...x);
4674
+ if(typeof n === "number") return mapfun$1(a=>pow$1(a,n),...x);
5333
4675
  else if(n instanceof Array){
5334
4676
  const Y=[];
5335
4677
  for(let i=0;i<x.length;i++){
5336
- Y.push(mapfun$1(a=>pow(x[i],a),...n));
4678
+ Y.push(mapfun$1(a=>pow$1(x[i],a),...n));
5337
4679
  }
5338
4680
  return Y;
5339
4681
  }
@@ -5358,293 +4700,533 @@ const sqrtn=(x,n)=>{
5358
4700
  return Y;
5359
4701
  }
5360
4702
  }
5361
- };
5362
- const e=(...x) => mapfun$1(Math.exp,...x);
5363
- const ln=(...x) => mapfun$1(Math.log,...x);
5364
- const cos=(...x) => mapfun$1(Fixed.cos,...x);
5365
- const sin=(...x) => mapfun$1(Fixed.sin,...x);
5366
- const tan=(...x) => mapfun$1(Fixed.tan,...x);
5367
- const sec=(...x) => mapfun$1(Fixed.sec,...x);
5368
- const sinc=(...x) => mapfun$1(Fixed.sinc,...x);
5369
- const csc=(...x) => mapfun$1(Fixed.csc,...x);
5370
- const cot=(...x) => mapfun$1(Fixed.cot,...x);
5371
- const acos=(...x) => mapfun$1(Fixed.acos,...x);
5372
- const asin=(...x) => mapfun$1(Fixed.asin,...x);
5373
- const atan=(...x) => mapfun$1(Fixed.atan,...x);
5374
- const acot=(...x) => mapfun$1(Fixed.acot,...x);
5375
- const cosh=(...x) => mapfun$1(Fixed.cosh,...x);
5376
- const sinh=(...x) => mapfun$1(Fixed.sinh,...x);
5377
- const tanh=(...x) => mapfun$1(Fixed.tanh,...x);
5378
- const coth=(...x) => mapfun$1(Fixed.coth,...x);
5379
- const acosh=(...x) => mapfun$1(Fixed.acosh,...x);
5380
- const asinh=(...x) => mapfun$1(Fixed.asinh,...x);
5381
- const atanh=(...x) => mapfun$1(Fixed.atanh,...x);
5382
- const ceil=(...x) => mapfun$1(Math.ceil,...x);
5383
- const floor=(...x) => mapfun$1(Math.floor,...x);
5384
- const round=(...x) => mapfun$1(Math.round,...x);
5385
- const atan2=(x,y,rad=true)=>{
5386
- if(typeof x === "number"){
5387
- if(typeof y === "number")return rad?Math.atan2(x,y):Math.atan2(x,y)*180/Math.PI;
5388
- else return mapfun$1(a=>atan2(x,a,rad),...y);
4703
+ };
4704
+ const e=(...x) => mapfun$1(Math.exp,...x);
4705
+ const ln=(...x) => mapfun$1(Math.log,...x);
4706
+ const cos$1=(...x) => mapfun$1(Fixed.cos,...x);
4707
+ const sin$1=(...x) => mapfun$1(Fixed.sin,...x);
4708
+ const tan=(...x) => mapfun$1(Fixed.tan,...x);
4709
+ const sec=(...x) => mapfun$1(Fixed.sec,...x);
4710
+ const sinc=(...x) => mapfun$1(Fixed.sinc,...x);
4711
+ const csc=(...x) => mapfun$1(Fixed.csc,...x);
4712
+ const cot=(...x) => mapfun$1(Fixed.cot,...x);
4713
+ const acos$1=(...x) => mapfun$1(Fixed.acos,...x);
4714
+ const asin=(...x) => mapfun$1(Fixed.asin,...x);
4715
+ const atan=(...x) => mapfun$1(Fixed.atan,...x);
4716
+ const acot=(...x) => mapfun$1(Fixed.acot,...x);
4717
+ const cosh=(...x) => mapfun$1(Fixed.cosh,...x);
4718
+ const sinh=(...x) => mapfun$1(Fixed.sinh,...x);
4719
+ const tanh=(...x) => mapfun$1(Fixed.tanh,...x);
4720
+ const coth=(...x) => mapfun$1(Fixed.coth,...x);
4721
+ const acosh=(...x) => mapfun$1(Fixed.acosh,...x);
4722
+ const asinh=(...x) => mapfun$1(Fixed.asinh,...x);
4723
+ const atanh=(...x) => mapfun$1(Fixed.atanh,...x);
4724
+ const ceil=(...x) => mapfun$1(Math.ceil,...x);
4725
+ const floor=(...x) => mapfun$1(Math.floor,...x);
4726
+ const round=(...x) => mapfun$1(Math.round,...x);
4727
+ const atan2=(x,y,rad=true)=>{
4728
+ if(typeof x === "number"){
4729
+ if(typeof y === "number")return rad?Math.atan2(x,y):Math.atan2(x,y)*180/Math.PI;
4730
+ else return mapfun$1(a=>atan2(x,a,rad),...y);
4731
+ }
4732
+ // else if(x instanceof Complex){
4733
+ // if(typeof n === "number")return Complex.fromExpo(x.z**n,x.phi*n);
4734
+ // else return mapfun(a=>pow(x,a),...n);
4735
+ // }
4736
+ else if(x instanceof Array){
4737
+ if(typeof y === "number") return mapfun$1(a=>atan2(a,y,rad),...x);
4738
+ else if(y instanceof Array){
4739
+ const Y=[];
4740
+ for(let i=0;i<x.length;i++){
4741
+ Y.push(mapfun$1(a=>pow$1(x[i],a),...y));
4742
+ }
4743
+ return Y;
4744
+ }
4745
+ }
4746
+ };
4747
+ const fact=(...x)=>mapfun$1(n=> {
4748
+ let i,
4749
+ y = 1;
4750
+ if (n == 0) y = 1;
4751
+ else if (n > 0) for (i = 1; i <= n; i++) y *= i;
4752
+ else y = NaN;
4753
+ return y;
4754
+ },...x);
4755
+ const sign=(...x)=>mapfun$1(Math.sign,...x);
4756
+
4757
+ const sig=(...x)=>mapfun$1(n=>1/(1+e(-n)),...x);
4758
+
4759
+ const hypot=(...x)=>{
4760
+ if(x.every(n=>typeof n === "number"))return Math.hypot(...x);
4761
+ if(x.every(n=>n instanceof Array))return mapfun$1(
4762
+ Math.hypot,
4763
+ ...x
4764
+ )
4765
+ };
4766
+
4767
+ const {PI, sqrt, cos, sin, acos, pow} = Math;
4768
+
4769
+ const Linear = t => t;
4770
+ const InSin = t => 1 - cos((t * PI) / 2);
4771
+ const OutSin = t => sin((t * PI) / 2);
4772
+ const InOutSin = t => -(cos(PI * t) - 1) / 2;
4773
+
4774
+ const InQuad = t => t**2;
4775
+ const OutQuad = t => 1 - (1-t)**2;
4776
+ const InOutQuad = t => t < 0.5 ? 2 * (t**2) : 1 - (-2 * t + 2)**2 / 2;
4777
+
4778
+ const InCubic = t => t**3;
4779
+ const OutCubic = t => 1 - (1-t)**3;
4780
+ const InOutCubic = t => t < 0.5 ? 4 * (t**3) : 1 - (-2 * t + 2)**3 / 2;
4781
+
4782
+ const InQuart = t => t**4;
4783
+ const OutQuart = t => 1 - (1-t)**4;
4784
+ const InOutQuart = t => t < 0.5 ? 8 * (t**4) : 1 - (-2 * t + 2)**4 / 2;
4785
+
4786
+ const InQuint = t => t**5;
4787
+ const OutQuint = t => 1 - (1-t)**5;
4788
+ const InOutQuint = t => t < 0.5 ? 16 * (t**5) : 1 - (-2 * t + 2)**5 / 2;
4789
+
4790
+ const InExpo = t => t === 0 ? 0 : 2**(10*t - 10);
4791
+ const OutExpo = t => t === 1 ? 1 : 1 - 2**(-10 * t);
4792
+ const InOutExpo = t => t === 0? 0: t === 1? 1: t < 0.5 ? 2**(20 * t - 10) / 2: (2 - 2**(-20 * t + 10)) / 2;
4793
+
4794
+ const InCirc = t => 1 - sqrt(1 - t**2);
4795
+ const OutCirc = t => sqrt(1 - (t-1)**2);
4796
+ const InOutCirc = t => t < 0.5? (1 - sqrt(1 - (2*t)**2)) / 2: (sqrt(1 - (-2*t+2)**2) + 1) / 2;
4797
+
4798
+ const Arc = t => 1 - sin(acos(t));
4799
+ const Back = (t, x = 1) => (t**2) * ((x+1)*t - x);
4800
+ const Elastic = t => -2*pow(2, 10 * (t - 1)) * cos(20 * PI * t / 3 * t);
4801
+
4802
+ const InBack = (t, c1 = 1.70158, c3 = c1 + 1) => c3 * pow(t,3)- c1 * (t**2);
4803
+ const OutBack = (t, c1 = 1.70158, c3 = c1 + 1) => 1 + c3 * pow(t - 1, 3) + c1 * pow(t - 1, 2);
4804
+ const InOutBack = (t, c1 = 1.70158, c2 = c1 * 1.525) => t < 0.5 ? (pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2 : (pow(2 * t - 2, 2) * ((c2 + 1) * (t * 2 - 2) + c2) + 2) / 2;
4805
+
4806
+ const InElastic = (t, c4 = 2*PI/3) => {
4807
+ return t === 0
4808
+ ? 0
4809
+ : t === 1
4810
+ ? 1
4811
+ : -pow(2, 10 * t - 10) * sin((t * 10 - 10.75) * c4);
4812
+ };
4813
+
4814
+ const OutElastic = (t, c4 = 2*PI/3) => {
4815
+ return t === 0
4816
+ ? 0
4817
+ : t === 1
4818
+ ? 1
4819
+ : pow(2, -10 * t) * sin((t * 10 - 0.75) * c4) + 1;
4820
+ };
4821
+ const InOutElastic = (t, c5 = 2 * PI / 4.5) => {
4822
+ return t === 0
4823
+ ? 0
4824
+ : t === 1
4825
+ ? 1
4826
+ : t < 0.5
4827
+ ? -(pow(2, 20 * t - 10) * sin((20 * t - 11.125) * c5)) / 2
4828
+ : (pow(2, -20 * t + 10) * sin((20 * t - 11.125) * c5)) / 2 + 1;
4829
+ };
4830
+
4831
+ const InBounce = (t, n1 = 7.5625, d1 = 2.75) => 1 - OutBounce(1-t, n1, d1);
4832
+ const OutBounce = (t, n1 = 7.5625, d1 = 2.75) => {
4833
+ if(t<1/d1) return n1 * t * t;
4834
+ if(t < 2 / d1) return n1 * (t -= 1.5 / d1) * t + 0.75;
4835
+ if(t < 2.5 / d1) return n1 * (t -= 2.25 / d1) * t + 0.9375;
4836
+ return n1 * (t -= 2.625 / d1) * t + 0.984375;
4837
+ };
4838
+
4839
+ const InOutBounce = (t, n1 = 7.5625, d1 = 2.75) => t < 0.5 ? OutBounce(1 - 2 * t, n1, d1)/2 : OutBounce(2 * t - 1, n1, d1)/2;
4840
+
4841
+
4842
+ const Step = (t, steps = 5) => Math.floor(t*steps) / steps;
4843
+ const Discret = (t, segments = 5) => Math.ceil(t*segments) / segments;
4844
+
4845
+ class TimeAnimation {
4846
+ constructor(callback, { ease = Linear, step = 50, t0 = 0, start = true, duration = 3000 } = {}) {
4847
+ this.callback = callback;
4848
+ this.state = {
4849
+ isRunning: false,
4850
+ animationId: null,
4851
+ startTime: null,
4852
+ ease,
4853
+ step,
4854
+ // interval: [t0, t1],
4855
+ autoStart: start,
4856
+ duration
4857
+ };
4858
+
4859
+ this.t = 0; // elapsed time
4860
+ this.tx = 0; // normalized [0,1]
4861
+ this.ty = 0; // eased value
4862
+ this.i = 0; // frame index
4863
+
4864
+ if (this.state.autoStart) {
4865
+ this.start();
4866
+ }
4867
+ }
4868
+
4869
+ // ---- private loop handler ----
4870
+ #tick = () => {
4871
+ this.t += this.state.step;
4872
+ this.i++;
4873
+
4874
+ this.tx = map(this.t, 0, this.state.duration, 0, 1);
4875
+ this.ty = this.state.ease(this.tx);
4876
+
4877
+ this.callback(this);
4878
+
4879
+ if (this.t >= this.state.duration) {
4880
+ clearInterval(this.state.animationId);
4881
+ this.state.isRunning = false;
4882
+ }
4883
+ };
4884
+
4885
+ // ---- core runner ----
4886
+ #run(reset = true) {
4887
+ if (!this.state.isRunning) {
4888
+ if (reset) this.reset(false);
4889
+
4890
+ this.state.isRunning = true;
4891
+ this.state.startTime = Date.now();
4892
+ this.state.animationId = setInterval(this.#tick, this.state.step);
4893
+ }
4894
+ return this;
4895
+ }
4896
+
4897
+ // ---- lifecycle methods ----
4898
+ start() {
4899
+ return this.#run(true);
4900
+ }
4901
+
4902
+ pause() {
4903
+ if (this.state.isRunning) {
4904
+ clearInterval(this.state.animationId);
4905
+ this.state.isRunning = false;
4906
+ }
4907
+ return this;
4908
+ }
4909
+
4910
+ resume() {
4911
+ return this.#run(false);
4912
+ }
4913
+
4914
+ stop() {
4915
+ this.pause();
4916
+ this.reset(false);
4917
+ return this;
4918
+ }
4919
+
4920
+ reset(restart = true) {
4921
+ this.t = 0;
4922
+ this.tx = 0;
4923
+ this.ty = 0;
4924
+ this.i = 0;
4925
+
4926
+ if (restart) this.start();
4927
+ return this;
4928
+ }
4929
+ }
4930
+
4931
+ // Hook-style factory
4932
+ const animation = (callback, {ease, t0, t1, start, duration} = {}) =>
4933
+ new TimeAnimation(callback, {ease, t0, t1, start, duration});
4934
+
4935
+ class Tick {
4936
+ constructor(ms, fn) {
4937
+ this.ms = ms;
4938
+ this.fn = fn;
4939
+ this.id = null;
4940
+ this.running = false;
4941
+ }
4942
+
4943
+ start() {
4944
+ if (!this.running) {
4945
+ this.running = true;
4946
+ this.id = setInterval(this.fn, this.ms);
4947
+ }
4948
+ return this;
4949
+ }
4950
+
4951
+ stop() {
4952
+ if (this.running) {
4953
+ this.running = false;
4954
+ clearInterval(this.id);
4955
+ this.id = null;
5389
4956
  }
5390
- // else if(x instanceof Complex){
5391
- // if(typeof n === "number")return Complex.fromExpo(x.z**n,x.phi*n);
5392
- // else return mapfun(a=>pow(x,a),...n);
5393
- // }
5394
- else if(x instanceof Array){
5395
- if(typeof y === "number") return mapfun$1(a=>atan2(a,y,rad),...x);
5396
- else if(y instanceof Array){
5397
- const Y=[];
5398
- for(let i=0;i<x.length;i++){
5399
- Y.push(mapfun$1(a=>pow(x[i],a),...y));
5400
- }
5401
- return Y;
5402
- }
4957
+ return this;
4958
+ }
4959
+
4960
+ isRunning() {
4961
+ return this.running;
4962
+ }
4963
+ }
4964
+ const tick = (ms, fn) => new Tick(ms, fn);
4965
+
4966
+ class Clock extends Tick {
4967
+ constructor(tickMs = 1000 / 60) {
4968
+ super(tickMs, () => this._tick());
4969
+ this.elapsed = 0;
4970
+ this._lastTime = performance.now();
4971
+ this._callbacks = new Set();
4972
+ }
4973
+
4974
+ _tick() {
4975
+ const now = performance.now();
4976
+ const delta = now - this._lastTime;
4977
+ this.elapsed += delta;
4978
+ this._lastTime = now;
4979
+
4980
+ for (const cb of this._callbacks) {
4981
+ cb({ elapsed: this.elapsed, delta });
5403
4982
  }
5404
- };
5405
- const fact=(...x)=>mapfun$1(n=> {
5406
- let i,
5407
- y = 1;
5408
- if (n == 0) y = 1;
5409
- else if (n > 0) for (i = 1; i <= n; i++) y *= i;
5410
- else y = NaN;
5411
- return y;
5412
- },...x);
5413
- const sign=(...x)=>mapfun$1(Math.sign,...x);
4983
+ }
5414
4984
 
5415
- const sig=(...x)=>mapfun$1(n=>1/(1+e(-n)),...x);
4985
+ onTick(cb) {
4986
+ this._callbacks.add(cb);
4987
+ return () => this._callbacks.delete(cb);
4988
+ }
5416
4989
 
5417
- const hypot=(...x)=>{
5418
- if(x.every(n=>typeof n === "number"))return Math.hypot(...x);
5419
- if(x.every(n=>n instanceof Array))return mapfun$1(
5420
- Math.hypot,
5421
- ...x
5422
- )
4990
+ reset() {
4991
+ this.elapsed = 0;
4992
+ this._lastTime = performance.now();
4993
+ }
4994
+
4995
+ pause() {
4996
+ super.stop();
4997
+ }
4998
+
4999
+ resume() {
5000
+ this._lastTime = performance.now();
5001
+ super.start();
5002
+ }
5003
+ }
5004
+
5005
+ const clock = (tickMs) => new Clock(tickMs);
5006
+
5007
+
5008
+ /*
5009
+
5010
+ const clock = new Clock(200);
5011
+
5012
+ clock.onTick(({ elapsed, delta }) => {
5013
+ console.log(`Elapsed: ${elapsed.toFixed(0)}ms, Delta: ${delta.toFixed(0)}ms`);
5014
+ });
5015
+
5016
+ clock.start();
5017
+
5018
+ setTimeout(() => clock.pause(), 1000);
5019
+ setTimeout(() => clock.resume(), 2000);
5020
+
5021
+ */
5022
+
5023
+ class TimeScheduler {
5024
+ constructor(tasks = [], { repeat = 1, loop = false } = {}) {
5025
+ this.tasks = tasks;
5026
+ this.repeat = repeat;
5027
+ this.loop = loop;
5028
+
5029
+ this.stopped = false;
5030
+ this.running = false;
5031
+
5032
+ // lifecycle hooks
5033
+ this.onStart = null;
5034
+ this.onTask = null;
5035
+ this.onEnd = null;
5036
+ }
5037
+
5038
+ async run() {
5039
+ if (this.running) return;
5040
+ this.running = true;
5041
+ this.stopped = false;
5042
+
5043
+ if (this.onStart) this.onStart();
5044
+
5045
+ let repeatCount = this.repeat;
5046
+
5047
+ do {
5048
+ for (const task of this.tasks) {
5049
+ if (this.stopped) return;
5050
+
5051
+ if (Array.isArray(task)) {
5052
+ // Parallel tasks
5053
+ await Promise.all(
5054
+ task.map(({ fn, delay = 0 }) =>
5055
+ new Promise(async (resolve) => {
5056
+ if (delay > 0) await new Promise(r => setTimeout(r, delay));
5057
+ if (this.onTask) this.onTask(fn);
5058
+ await fn();
5059
+ resolve();
5060
+ })
5061
+ )
5062
+ );
5063
+ } else {
5064
+ // Single task
5065
+ const { fn, delay = 0 } = task;
5066
+ if (delay > 0) await new Promise(r => setTimeout(r, delay));
5067
+ if (this.onTask) this.onTask(fn);
5068
+ await fn();
5069
+ }
5070
+ }
5071
+ } while (this.loop && !this.stopped && (repeatCount === Infinity || repeatCount-- > 1));
5072
+
5073
+ if (!this.stopped && this.onEnd) this.onEnd();
5074
+ this.running = false;
5075
+ }
5076
+
5077
+ stop() {
5078
+ this.stopped = true;
5079
+ this.running = false;
5080
+ }
5081
+
5082
+ addTask(task) {
5083
+ this.tasks.push(task);
5084
+ }
5085
+
5086
+ clearTasks() {
5087
+ this.tasks = [];
5088
+ }
5089
+ }
5090
+
5091
+ const Scheduler = (tasks, { repeat = null} = {}) => new TimeScheduler(tasks, { repeat});
5092
+
5093
+ const step_fps = (step_or_fps) => 1000 / step_or_fps;
5094
+
5095
+ const debounce=(fn,delay=1000)=>{
5096
+ return (...args) => setTimeout(()=>fn(...args),delay);
5097
+ };
5098
+ const throttle=(fn,delay)=>{
5099
+ let lastTime=0;
5100
+ return (...args) => {
5101
+ const now = new Date().getTime();
5102
+ if(now-lastTime < delay) return;
5103
+ lastTime = now;
5104
+ fn(...args);
5105
+ }
5423
5106
  };
5424
5107
 
5425
- class ZikoTimeLoop {
5426
- constructor(callback, step = 1000/30, startTime=0, endTime = Infinity, started = true) {
5108
+ function timeout(ms, fn) {
5109
+ let id;
5110
+ const promise = new Promise((resolve) => {
5111
+ id = setTimeout(() => {
5112
+ if (fn) fn();
5113
+ resolve();
5114
+ }, ms);
5115
+ });
5116
+
5117
+ return {
5118
+ id,
5119
+ clear: () => clearTimeout(id),
5120
+ promise
5121
+ };
5122
+ }
5123
+
5124
+ const sleep= ms => new Promise(res => setTimeout(res, ms));
5125
+
5126
+ // use it with await
5127
+
5128
+ class TimeLoop {
5129
+ constructor(callback, { step = 1000, t0 = 0, t1 = Infinity, autoplay = true } = {}) {
5427
5130
  this.callback = callback;
5428
5131
  this.cache = {
5429
5132
  isRunning: false,
5430
- AnimationId : null,
5431
- t0 : null,
5133
+ id: null,
5134
+ last_tick: null,
5432
5135
  step,
5433
- // fps,
5434
- startTime,
5435
- endTime,
5436
- started
5136
+ t0,
5137
+ t1,
5138
+ autoplay,
5139
+ pauseTime: null,
5140
+ frame : 0,
5437
5141
  };
5438
- this.init();
5439
- this.i=0;
5440
- }
5441
- init(){
5442
- // if(this.cache.step && this.cache.fps){
5443
- // console.warn(`Fps will be adjusted from ${this.cache.fps} to ${1000/this.cache.step} to ensure a smoother animation`);
5444
- // this.cache.fps=1000/this.cache.step;
5445
- // }
5446
- if(this.cache.started){
5447
- this.cache.startTime?this.startAfter(this.cache.startTime):this.start();
5448
- if(this.cache.endTime&&this.cache.endTime!==Infinity)this.stopAfter(this.cache.endTime);
5142
+
5143
+ if (autoplay) {
5144
+ t0 ? this.startAfter(t0) : this.start();
5145
+ if (t1 !== Infinity) this.stopAfter(t1);
5449
5146
  }
5450
- return this;
5451
5147
  }
5452
- // get TIME_STEP() {
5453
- // // return this.cache.step?this.cache.step:1000 / this.cache.fps;
5454
- // return this.cache.step;
5455
- // }
5148
+
5149
+ get frame(){
5150
+ return this.cache.frame;
5151
+ }
5152
+ get elapsed(){
5153
+ return this.cache.elapsed;
5154
+ }
5155
+
5456
5156
  start() {
5457
5157
  if (!this.cache.isRunning) {
5458
- this.i=0;
5158
+ this.cache.frame = 0;
5459
5159
  this.cache.isRunning = true;
5460
- this.cache.t0 = Date.now();
5160
+ this.cache.last_tick = Date.now();
5461
5161
  this.animate();
5462
5162
  }
5463
5163
  return this;
5464
5164
  }
5165
+
5465
5166
  pause() {
5466
5167
  if (this.cache.isRunning) {
5467
- clearTimeout(this.cache.AnimationId);
5168
+ clearTimeout(this.cache.id);
5468
5169
  this.cache.isRunning = false;
5170
+ this.cache.pauseTime = Date.now();
5469
5171
  }
5470
5172
  return this;
5471
5173
  }
5472
- stop(){
5473
- this.pause();
5474
- this.i=0;
5174
+
5175
+ resume() {
5176
+ if (!this.cache.isRunning) {
5177
+ this.cache.isRunning = true;
5178
+ if (this.cache.pauseTime) {
5179
+ // adjust start time so delta stays consistent
5180
+ const pausedDuration = Date.now() - this.cache.pauseTime;
5181
+ this.cache.last_tick += pausedDuration;
5182
+ }
5183
+ this.animate();
5184
+ }
5475
5185
  return this;
5476
5186
  }
5477
- resume(){
5478
- this.cache.isRunning=true;
5479
- this.animate();
5187
+
5188
+ stop() {
5189
+ this.pause();
5190
+ this.cache.frame = 0;
5480
5191
  return this;
5481
5192
  }
5482
- startAfter(t=1000){
5483
- setTimeout(this.start.bind(this),t);
5193
+
5194
+ startAfter(t = 1000) {
5195
+ setTimeout(() => this.start(), t);
5484
5196
  return this;
5485
5197
  }
5486
- stopAfter(t=1000){
5487
- setTimeout(this.stop.bind(this),t);
5488
- return this;
5198
+
5199
+ stopAfter(t = 1000) {
5200
+ setTimeout(() => this.stop(), t);
5201
+ return this;
5489
5202
  }
5203
+
5490
5204
  animate = () => {
5491
5205
  if (this.cache.isRunning) {
5492
5206
  const now = Date.now();
5493
- const delta = now - this.cache.t0;
5494
- if (delta > this.cache.step) {
5207
+ const delta = now - this.cache.last_tick;
5208
+
5209
+ if (delta >= this.cache.step) {
5210
+ this.cache.elapsed = now - (this.cache.t0 || 0);
5495
5211
  this.callback(this);
5496
- this.i++;
5497
- this.cache.t0 = now - (delta % this.cache.step);
5212
+ this.cache.frame++;
5213
+ this.cache.last_tick = now - (delta % this.cache.step);
5498
5214
  }
5499
- this.cache.AnimationId = setTimeout(this.animate, 0);
5500
- } }
5501
- }
5502
- const useFps = fps => 1000/fps;
5503
- const useTimeLoop = (callback, step, startTime, endTime, started) => new ZikoTimeLoop(callback, step, startTime, endTime, started);
5504
-
5505
- const Ease={
5506
- Linear:function(t){
5507
- return t;
5508
- },
5509
- InSin(t){
5510
- return 1 - Math.cos((t * Math.PI) / 2);
5511
- },
5512
- OutSin(t){
5513
- return Math.sin((t * Math.PI) / 2);
5514
- },
5515
- InOutSin(t){
5516
- return -(Math.cos(Math.PI * t) - 1) / 2;
5517
- },
5518
- InQuad(t){
5519
- return t**2;
5520
- },
5521
- OutQuad(t){
5522
- return 1 - Math.pow((1 - t),2)
5523
- },
5524
- InOutQuad(t){
5525
- return t < 0.5 ? 2 * Math.pow(t,2) : 1 - Math.pow(-2 * t + 2, 2) / 2;
5526
- },
5527
- InCubic(t){
5528
- return t**3;
5529
- },
5530
- OutCubic(t){
5531
- return 1 - Math.pow((1 - t),3)
5532
- },
5533
- InOutCubic(t){
5534
- return t < 0.5 ? 4 * Math.pow(t,3) : 1 - Math.pow(-2 * t + 2, 3) / 2;
5535
- },
5536
- InQuart(t){
5537
- return t**4;
5538
- },
5539
- OutQuart(t){
5540
- return 1 - Math.pow((1 - t),4);
5541
- },
5542
- InOutQuart(t){
5543
- return t < 0.5 ? 8 * Math.pow(t,4) : 1 - Math.pow(-2 * t + 2, 4) / 2;
5544
- },
5545
- InQuint(t){
5546
- return t**5;
5547
- },
5548
- OutQuint(t){
5549
- return 1 - Math.pow((1 - t),5);
5550
- },
5551
- InOutQuint(t){
5552
- return t < 0.5 ? 16 * Math.pow(t,5) : 1 - Math.pow(-2 * t + 2, 5) / 2;
5553
- },
5554
- InExpo(t){
5555
- return t === 0 ? 0 : Math.pow(2, 10 * t - 10);
5556
- },
5557
- OutExpo(t){
5558
- return t === 1 ? 1 : 1 - Math.pow(2, -10 * t);
5559
- },
5560
- InOutExpo(t){
5561
- return t === 0? 0: t === 1? 1: t < 0.5 ? Math.pow(2, 20 * t - 10) / 2: (2 - Math.pow(2, -20 * t + 10)) / 2;
5562
- },
5563
- InCirc(t){
5564
- return 1 - Math.sqrt(1 - Math.pow(t, 2));
5565
- },
5566
- OutCirc(t){
5567
- return Math.sqrt(1 - Math.pow(t - 1, 2));
5568
- },
5569
- InOutCic(t){
5570
- return t < 0.5? (1 - Math.sqrt(1 - Math.pow(2 * t, 2))) / 2: (Math.sqrt(1 - Math.pow(-2 * t + 2, 2)) + 1) / 2;
5571
- },
5572
- Arc(t){
5573
- return 1 - Math.sin(Math.acos(t));
5574
- },
5575
- Back(t){
5576
- // To Be Changed
5577
- let x=1;
5578
- return Math.pow(t, 2) * ((x + 1) * t - x);
5579
- },
5580
- Elastic(t){
5581
- return -2*Math.pow(2, 10 * (t - 1)) * Math.cos(20 * Math.PI * t / 3 * t);
5582
- },
5583
- InBack(t){
5584
- const c1 = 1.70158;
5585
- const c3 = c1 + 1;
5586
- return c3 *Math.pow(t,3)- c1 * (t**2);
5587
- },
5588
- OutBack(t){
5589
- const c1 = 1.70158;
5590
- const c3 = c1 + 1;
5591
- return 1 + c3 * Math.pow(t - 1, 3) + c1 * Math.pow(t - 1, 2);
5592
- },
5593
- InOutBack(t){
5594
- const c1 = 1.70158;
5595
- const c2 = c1 * 1.525;
5596
- return t < 0.5
5597
- ? (Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2
5598
- : (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (t * 2 - 2) + c2) + 2) / 2;
5599
- },
5600
- InElastic(t){
5601
- const c4 = (2 * Math.PI) / 3;return t === 0
5602
- ? 0
5603
- : t === 1
5604
- ? 1
5605
- : -Math.pow(2, 10 * t - 10) * Math.sin((t * 10 - 10.75) * c4);
5606
- },
5607
- OutElastic(t){
5608
- const c4 = (2 * Math.PI) / 3;
5609
- return t === 0
5610
- ? 0
5611
- : t === 1
5612
- ? 1
5613
- : Math.pow(2, -10 * t) * Math.sin((t * 10 - 0.75) * c4) + 1;
5614
- },
5615
- InOutElastic(t){
5616
- const c5 = (2 * Math.PI) / 4.5;
5617
- return t === 0
5618
- ? 0
5619
- : t === 1
5620
- ? 1
5621
- : t < 0.5
5622
- ? -(Math.pow(2, 20 * t - 10) * Math.sin((20 * t - 11.125) * c5)) / 2
5623
- : (Math.pow(2, -20 * t + 10) * Math.sin((20 * t - 11.125) * c5)) / 2 + 1;
5624
- },
5625
- InBounce(t){
5626
- return 1 - Ease.OutBounce(1-t);
5627
- },
5628
- OutBounce(t){
5629
- const n1 = 7.5625;
5630
- const d1 = 2.75;
5631
- if (t < 1 / d1) {
5632
- return n1 * t * t;
5633
- } else if (t < 2 / d1) {
5634
- return n1 * (t -= 1.5 / d1) * t + 0.75;
5635
- } else if (t < 2.5 / d1) {
5636
- return n1 * (t -= 2.25 / d1) * t + 0.9375;
5637
- } else {
5638
- return n1 * (t -= 2.625 / d1) * t + 0.984375;
5639
- }
5640
5215
 
5641
- },
5642
- InOutBounce(t){
5643
- return t < 0.5
5644
- ? (1 - Ease.OutBounce(1 - 2 * t)) / 2
5645
- : (1 + Ease.OutBounce(2 * t - 1)) / 2;
5216
+ this.cache.id = setTimeout(this.animate, 0);
5646
5217
  }
5647
- };
5218
+ }
5219
+ }
5220
+
5221
+ const loop = (callback, options = {}) => new TimeLoop(callback, options);
5222
+
5223
+
5224
+ // Helpers
5225
+ // const useFps = (fps) => 1000 / fps;
5226
+
5227
+ // const _loop = loop( e => {
5228
+ // console.log("Frame:", e.frame, " Elapsed: ", e.elapsed);
5229
+ // });
5648
5230
 
5649
5231
  const time_memory_Taken = (callback) => {
5650
5232
  const t0 = Date.now();
@@ -5687,6 +5269,7 @@ const waitForUIElm=(UIElement)=>{
5687
5269
  }
5688
5270
  };
5689
5271
 
5272
+ // import Ease from "./ease.js";
5690
5273
  const wait=(delayInMS)=>{
5691
5274
  return new Promise((resolve) => setTimeout(resolve, delayInMS));
5692
5275
  };
@@ -5697,93 +5280,6 @@ const timeTaken = callback => {
5697
5280
  return r;
5698
5281
  };
5699
5282
 
5700
- class ZikoTimeAnimation{
5701
- constructor(callback,ease=Ease.Linear,step=50,{t=[0,null],start=true,duration=3000}={}){
5702
- this.cache={
5703
- isRunning:false,
5704
- AnimationId:null,
5705
- startTime:null,
5706
- ease,
5707
- step,
5708
- intervall:t,
5709
- started:start,
5710
- duration
5711
- };
5712
- this.t=0;
5713
- this.tx=0;
5714
- this.ty=0;
5715
- this.i=0;
5716
- this.callback=callback;
5717
- }
5718
- #animation_handler(){
5719
- this.t+=this.cache.step;
5720
- this.i++;
5721
- this.tx=map(this.t,0,this.cache.duration,0,1);
5722
- this.ty=this.cache.ease(this.tx);
5723
- this.callback(this);
5724
- if(this.t>=this.cache.duration){
5725
- clearInterval(this.cache.AnimationId);
5726
- this.cache.isRunning=false;
5727
- }
5728
- }
5729
- reset(restart=true){
5730
- this.t=0;
5731
- this.tx=0;
5732
- this.ty=0;
5733
- this.i=0;
5734
- if(restart)this.start();
5735
- return this;
5736
- }
5737
- #animate(reset=true){
5738
- if(!this.cache.isRunning){
5739
- if(reset)this.reset(false);
5740
- this.cache.isRunning=true;
5741
- this.cache.startTime = Date.now();
5742
- this.cache.AnimationId=setInterval(this.#animation_handler.bind(this),this.cache.step);
5743
- }
5744
- return this;
5745
- }
5746
- start(){
5747
- this.#animate(true);
5748
- return this;
5749
- }
5750
- pause(){
5751
- if (this.cache.isRunning) {
5752
- clearTimeout(this.cache.AnimationId);
5753
- this.cache.isRunning = false;
5754
- }
5755
- return this;
5756
- }
5757
- resume(){
5758
- this.#animate(false);
5759
- return this;
5760
- }
5761
- stop(){
5762
- this.pause();
5763
- this.reset(false);
5764
- return this;
5765
- }
5766
- // clear(){
5767
- // }
5768
- // stream(){
5769
- // }
5770
- }
5771
-
5772
- const useAnimation=(callback,ease=Ease.Linear,step=50,config)=>new ZikoTimeAnimation(callback,ease=Ease.Linear,step=50,config);
5773
-
5774
- const debounce=(fn,delay=1000)=>{
5775
- return (...args) => setTimeout(()=>fn(...args),delay);
5776
- };
5777
- const throttle=(fn,delay)=>{
5778
- let lastTime=0;
5779
- return (...args) => {
5780
- const now = new Date().getTime();
5781
- if(now-lastTime < delay) return;
5782
- lastTime = now;
5783
- fn(...args);
5784
- }
5785
- };
5786
-
5787
5283
  class ZikoApp {
5788
5284
  constructor({head = null, wrapper = null, target = null}){
5789
5285
  this.head = head;
@@ -5999,6 +5495,70 @@ function findCommonPath(paths) {
5999
5495
  return commonPath;
6000
5496
  }
6001
5497
 
5498
+ function useDerived(deriveFn, sources) {
5499
+ let value = deriveFn(...sources.map(s => s().value));
5500
+ const subscribers = new Set();
5501
+ let paused = false;
5502
+
5503
+ function getValue() {
5504
+ return {
5505
+ value,
5506
+ isStateGetter: () => true,
5507
+ _subscribe: (fn, UIElement) => {
5508
+ subscribers.add(fn);
5509
+
5510
+ const observer = new MutationObserver(() => {
5511
+ if (!document.body.contains(UIElement.element)) {
5512
+ subscribers.delete(fn);
5513
+ observer.disconnect();
5514
+ }
5515
+ });
5516
+
5517
+ observer.observe(document.body, { childList: true, subtree: true });
5518
+ },
5519
+ };
5520
+ }
5521
+
5522
+ function setValue(newValue) {
5523
+ if (paused) return;
5524
+ if (typeof newValue === "function") newValue = newValue(value);
5525
+ if (newValue !== value) {
5526
+ value = newValue;
5527
+ subscribers.forEach(fn => fn(value));
5528
+ }
5529
+ }
5530
+
5531
+ const controller = {
5532
+ pause: () => { paused = true; },
5533
+ resume: () => { paused = false; },
5534
+ clear: () => { subscribers.clear(); },
5535
+ force: (newValue) => {
5536
+ if (typeof newValue === "function") newValue = newValue(value);
5537
+ value = newValue;
5538
+ subscribers.forEach(fn => fn(value));
5539
+ },
5540
+ getSubscribers: () => new Set(subscribers),
5541
+ };
5542
+
5543
+ // Subscribe to source states
5544
+ sources.forEach(source => {
5545
+ const srcValue = source(); // getValue()
5546
+ srcValue._subscribe(() => {
5547
+ if (!paused) {
5548
+ const newVal = deriveFn(...sources.map(s => s().value));
5549
+ if (newVal !== value) {
5550
+ value = newVal;
5551
+ subscribers.forEach(fn => fn(value));
5552
+ }
5553
+ }
5554
+ }, { element: document.body }); // dummy UIElement
5555
+ });
5556
+
5557
+ return [getValue, setValue, controller];
5558
+ }
5559
+
5560
+ const useReactive = (nested_value) => mapfun$1(n => useState(n), nested_value);
5561
+
6002
5562
  class ZikoUseChannel{
6003
5563
  constructor(name = ""){
6004
5564
  this.channel = new BroadcastChannel(name);
@@ -6238,27 +5798,69 @@ if(globalThis?.document){
6238
5798
  }
6239
5799
 
6240
5800
  exports.App = App;
5801
+ exports.Arc = Arc;
5802
+ exports.Back = Back;
6241
5803
  exports.Base = Base;
6242
5804
  exports.Canvas = Canvas;
5805
+ exports.Clock = Clock;
6243
5806
  exports.Combinaison = Combinaison;
6244
5807
  exports.Complex = Complex;
5808
+ exports.Discret = Discret;
6245
5809
  exports.E = E;
6246
5810
  exports.EPSILON = EPSILON;
6247
- exports.Ease = Ease;
5811
+ exports.Elastic = Elastic;
6248
5812
  exports.FileBasedRouting = FileBasedRouting;
6249
5813
  exports.Flex = Flex;
6250
5814
  exports.Grid = Grid$1;
6251
5815
  exports.HTMLWrapper = HTMLWrapper;
5816
+ exports.InBack = InBack;
5817
+ exports.InBounce = InBounce;
5818
+ exports.InCirc = InCirc;
5819
+ exports.InCubic = InCubic;
5820
+ exports.InElastic = InElastic;
5821
+ exports.InExpo = InExpo;
5822
+ exports.InOutBack = InOutBack;
5823
+ exports.InOutBounce = InOutBounce;
5824
+ exports.InOutCirc = InOutCirc;
5825
+ exports.InOutCubic = InOutCubic;
5826
+ exports.InOutElastic = InOutElastic;
5827
+ exports.InOutExpo = InOutExpo;
5828
+ exports.InOutQuad = InOutQuad;
5829
+ exports.InOutQuart = InOutQuart;
5830
+ exports.InOutQuint = InOutQuint;
5831
+ exports.InOutSin = InOutSin;
5832
+ exports.InQuad = InQuad;
5833
+ exports.InQuart = InQuart;
5834
+ exports.InQuint = InQuint;
5835
+ exports.InSin = InSin;
5836
+ exports.Linear = Linear;
6252
5837
  exports.Logic = Logic$1;
6253
5838
  exports.Matrix = Matrix;
6254
- exports.PI = PI$1;
5839
+ exports.OutBack = OutBack;
5840
+ exports.OutBounce = OutBounce;
5841
+ exports.OutCirc = OutCirc;
5842
+ exports.OutCubic = OutCubic;
5843
+ exports.OutElastic = OutElastic;
5844
+ exports.OutExpo = OutExpo;
5845
+ exports.OutQuad = OutQuad;
5846
+ exports.OutQuart = OutQuart;
5847
+ exports.OutQuint = OutQuint;
5848
+ exports.OutSin = OutSin;
5849
+ exports.PI = PI$2;
6255
5850
  exports.Permutation = Permutation;
6256
5851
  exports.Random = Random;
6257
5852
  exports.SPA = SPA;
6258
5853
  exports.SVGWrapper = SVGWrapper;
6259
- exports.Str = Str;
5854
+ exports.Scheduler = Scheduler;
5855
+ exports.Step = Step;
6260
5856
  exports.Suspense = Suspense;
6261
5857
  exports.Svg = Svg;
5858
+ exports.Tick = Tick;
5859
+ exports.TimeAnimation = TimeAnimation;
5860
+ exports.TimeLoop = TimeLoop;
5861
+ exports.TimeScheduler = TimeScheduler;
5862
+ exports.UIElement = UIElement;
5863
+ exports.UINode = UINode;
6262
5864
  exports.Utils = Utils;
6263
5865
  exports.ZikoApp = ZikoApp;
6264
5866
  exports.ZikoCustomEvent = ZikoCustomEvent;
@@ -6278,25 +5880,23 @@ exports.ZikoHead = ZikoHead;
6278
5880
  exports.ZikoMutationObserver = ZikoMutationObserver;
6279
5881
  exports.ZikoSPA = ZikoSPA;
6280
5882
  exports.ZikoUICanvas = ZikoUICanvas;
6281
- exports.ZikoUIElement = ZikoUIElement;
6282
5883
  exports.ZikoUIFlex = ZikoUIFlex;
6283
5884
  exports.ZikoUIGrid = ZikoUIGrid;
6284
5885
  exports.ZikoUIHTMLWrapper = ZikoUIHTMLWrapper;
6285
- exports.ZikoUINode = ZikoUINode;
6286
5886
  exports.ZikoUISVGWrapper = ZikoUISVGWrapper;
6287
5887
  exports.ZikoUISuspense = ZikoUISuspense;
6288
5888
  exports.ZikoUISvg = ZikoUISvg;
6289
5889
  exports.ZikoUIText = ZikoUIText;
6290
5890
  exports.ZikoUIXMLWrapper = ZikoUIXMLWrapper;
6291
5891
  exports.ZikoUseRoot = ZikoUseRoot;
6292
- exports.ZikoUseStyle = ZikoUseStyle;
6293
5892
  exports.__ZikoEvent__ = __ZikoEvent__;
6294
5893
  exports.abs = abs;
6295
5894
  exports.accum = accum;
6296
- exports.acos = acos;
5895
+ exports.acos = acos$1;
6297
5896
  exports.acosh = acosh;
6298
5897
  exports.acot = acot;
6299
5898
  exports.add = add;
5899
+ exports.animation = animation;
6300
5900
  exports.arange = arange;
6301
5901
  exports.arr2str = arr2str;
6302
5902
  exports.asin = asin;
@@ -6318,14 +5918,13 @@ exports.bindWheelEvent = bindWheelEvent;
6318
5918
  exports.cartesianProduct = cartesianProduct;
6319
5919
  exports.ceil = ceil;
6320
5920
  exports.clamp = clamp;
5921
+ exports.clock = clock;
6321
5922
  exports.combinaison = combinaison;
6322
5923
  exports.complex = complex;
6323
- exports.cos = cos;
5924
+ exports.cos = cos$1;
6324
5925
  exports.cosh = cosh;
6325
5926
  exports.cot = cot;
6326
5927
  exports.coth = coth;
6327
- exports.count = count;
6328
- exports.countWords = countWords;
6329
5928
  exports.csc = csc;
6330
5929
  exports.csv2arr = csv2arr;
6331
5930
  exports.csv2json = csv2json;
@@ -6344,6 +5943,7 @@ exports.getEvent = getEvent;
6344
5943
  exports.hypot = hypot;
6345
5944
  exports.inRange = inRange;
6346
5945
  exports.isApproximatlyEqual = isApproximatlyEqual;
5946
+ exports.isStateGetter = isStateGetter;
6347
5947
  exports.json2arr = json2arr;
6348
5948
  exports.json2css = json2css;
6349
5949
  exports.json2csv = json2csv;
@@ -6356,6 +5956,7 @@ exports.lerp = lerp;
6356
5956
  exports.linspace = linspace;
6357
5957
  exports.ln = ln;
6358
5958
  exports.logspace = logspace;
5959
+ exports.loop = loop;
6359
5960
  exports.map = map;
6360
5961
  exports.mapfun = mapfun$1;
6361
5962
  exports.matrix = matrix;
@@ -6371,23 +5972,23 @@ exports.nums = nums;
6371
5972
  exports.obj2str = obj2str;
6372
5973
  exports.ones = ones;
6373
5974
  exports.pgcd = pgcd;
6374
- exports.pow = pow;
5975
+ exports.pow = pow$1;
6375
5976
  exports.powerSet = powerSet;
6376
5977
  exports.ppcm = ppcm;
6377
5978
  exports.preload = preload;
6378
5979
  exports.prod = prod;
6379
5980
  exports.rad2deg = rad2deg;
6380
- exports.removeExtraSpace = removeExtraSpace;
6381
5981
  exports.round = round;
6382
5982
  exports.sec = sec;
6383
5983
  exports.sig = sig;
6384
5984
  exports.sign = sign;
6385
- exports.sin = sin;
5985
+ exports.sin = sin$1;
6386
5986
  exports.sinc = sinc;
6387
5987
  exports.sinh = sinh;
6388
- exports.sqrt = sqrt;
5988
+ exports.sleep = sleep;
5989
+ exports.sqrt = sqrt$1;
6389
5990
  exports.sqrtn = sqrtn;
6390
- exports.str = str;
5991
+ exports.step_fps = step_fps;
6391
5992
  exports.sub = sub;
6392
5993
  exports.subSet = subSet;
6393
5994
  exports.sum = sum;
@@ -6400,27 +6001,28 @@ exports.tan = tan;
6400
6001
  exports.tanh = tanh;
6401
6002
  exports.text = text;
6402
6003
  exports.throttle = throttle;
6004
+ exports.tick = tick;
6403
6005
  exports.timeTaken = timeTaken;
6404
6006
  exports.time_memory_Taken = time_memory_Taken;
6405
- exports.useAnimation = useAnimation;
6007
+ exports.timeout = timeout;
6406
6008
  exports.useChannel = useChannel;
6407
6009
  exports.useCustomEvent = useCustomEvent;
6010
+ exports.useDerived = useDerived;
6408
6011
  exports.useEventEmitter = useEventEmitter;
6409
6012
  exports.useFavIcon = useFavIcon;
6410
- exports.useFps = useFps;
6411
6013
  exports.useHashEvent = useHashEvent;
6412
6014
  exports.useHead = useHead;
6413
6015
  exports.useInputEvent = useInputEvent;
6414
6016
  exports.useLocaleStorage = useLocaleStorage;
6415
6017
  exports.useMediaQuery = useMediaQuery;
6416
6018
  exports.useMeta = useMeta;
6019
+ exports.useReactive = useReactive;
6417
6020
  exports.useRoot = useRoot;
6418
6021
  exports.useSessionStorage = useSessionStorage;
6419
- exports.useStyle = useStyle;
6022
+ exports.useState = useState;
6420
6023
  exports.useSuccesifKeys = useSuccesifKeys;
6421
6024
  exports.useSwipeEvent = useSwipeEvent;
6422
6025
  exports.useThread = useThread;
6423
- exports.useTimeLoop = useTimeLoop;
6424
6026
  exports.useTitle = useTitle;
6425
6027
  exports.wait = wait;
6426
6028
  exports.waitForUIElm = waitForUIElm;