ziko 0.38.1 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ziko.mjs 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 : Mon Aug 18 2025 11:00:54 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
@@ -1043,7 +1043,7 @@ const json2xmlFile=(json,indent)=>{
1043
1043
  }
1044
1044
  };
1045
1045
 
1046
- class ZikoUINode {
1046
+ class UINode {
1047
1047
  constructor(node){
1048
1048
  this.cache = {
1049
1049
  node
@@ -1057,7 +1057,7 @@ class ZikoUINode {
1057
1057
  }
1058
1058
  }
1059
1059
 
1060
- globalThis.node = (node) => new ZikoUINode(node);
1060
+ globalThis.node = (node) => new UINode(node);
1061
1061
 
1062
1062
  function register_to_class(target, ...mixins){
1063
1063
  mixins.forEach(n => _register_to_class_(target, n));
@@ -1100,7 +1100,55 @@ const register = (target, ...mixins) => {
1100
1100
  else register_to_instance(target, ...mixins);
1101
1101
  };
1102
1102
 
1103
- class ZikoUIText extends ZikoUINode {
1103
+ const isStateGetter = (arg) => {
1104
+ return typeof(arg) === 'function' && arg?.()?.isStateGetter?.()
1105
+ };
1106
+
1107
+ // To Do add getter, watchAttr
1108
+ const AttrsMethods = {
1109
+ setAttr(name, value) {
1110
+ if(name instanceof Object){
1111
+ const [names,values]=[Object.keys(name),Object.values(name)];
1112
+ for(let i=0;i<names.length;i++){
1113
+ if(values[i] instanceof Array)value[i] = values[i].join(" ");
1114
+ _set_attrs_.call(this, names[i], values[i]);
1115
+ }
1116
+ }
1117
+ else {
1118
+ if(value instanceof Array) value = value.join(" ");
1119
+ _set_attrs_.call(this, name, value);
1120
+ }
1121
+ return this;
1122
+ },
1123
+ removeAttr(...names) {
1124
+ for(let i=0;i<names.length;i++)this.element?.removeAttribute(names[i]);
1125
+ return this;
1126
+ },
1127
+ getAttr(name){
1128
+ name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
1129
+ return this.element.attributes[name].value;
1130
+ },
1131
+ setContentEditable(bool = true) {
1132
+ this.setAttr("contenteditable", bool);
1133
+ return this;
1134
+ }
1135
+ };
1136
+
1137
+ function _set_attrs_(name, value){
1138
+ if(this.element?.tagName !== "svg") name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
1139
+ if(this?.attr[name] && this?.attr[name]===value) return;
1140
+ if(isStateGetter(value)){
1141
+ const getter = value();
1142
+ getter._subscribe(
1143
+ (newValue) => this.element?.setAttribute(name, newValue),
1144
+ this
1145
+ );
1146
+ }
1147
+ else this.element?.setAttribute(name, value);
1148
+ Object.assign(this.cache.attributes, {[name]:value});
1149
+ }
1150
+
1151
+ class ZikoUIText extends UINode {
1104
1152
  constructor(...value) {
1105
1153
  super("span", "text", false, ...value);
1106
1154
  this.element = globalThis?.document?.createTextNode(...value);
@@ -1646,587 +1694,20 @@ const IndexingMethods = {
1646
1694
  },
1647
1695
  };
1648
1696
 
1649
- class ZikoUseStyle {
1650
- constructor(style = {}, use = style.hasOwnProperty("default")? "default" : Object.keys(style)[0], id = 0) {
1651
- this.id = "Ziko-Style-" + id;
1652
- this.keys = new Set();
1653
- this.styles = {
1654
- default: {
1655
- fontSize: "1em",
1656
- color : "green"
1657
- },
1658
- other: {
1659
- fontSize : "2em",
1660
- color : "cyan"
1661
- }
1662
- };
1663
- style && this.add(style);
1664
- use && this.use(use);
1665
- }
1666
-
1667
- get current() {
1668
- return [...this.keys].reduce((key, value) => {
1669
- key[value] = `var(--${value}-${this.id})`;
1670
- return key;
1671
- }, {});
1672
- }
1673
-
1674
- add(name, style = {}) {
1675
- if (name && typeof name === 'object' && !Array.isArray(name)) {
1676
- Object.assign(this.styles, name);
1677
- } else if (typeof name === 'string') {
1678
- Object.assign(this.styles, { [name]: style });
1679
- }
1680
- return this;
1681
- }
1682
-
1683
- #useStyleIndex(index) {
1684
- const keys = Object.keys(this.styles);
1685
- for (let a in this.styles[keys[index]]) {
1686
- if (Object.prototype.hasOwnProperty.call(this.styles[keys[index]], a)) {
1687
- document.documentElement.style.setProperty(`--${a}-${this.id}`, this.styles[keys[index]][a]);
1688
- this.keys.add(a);
1689
- }
1690
- }
1691
- return this;
1692
- }
1693
-
1694
- #useStyleName(name) {
1695
- if (!this.styles[name]) return this;
1696
- for (let a in this.styles[name]) {
1697
- if (Object.prototype.hasOwnProperty.call(this.styles[name], a)) {
1698
- document.documentElement.style.setProperty(`--${a}-${this.id}`, this.styles[name][a]);
1699
- this.keys.add(a);
1700
- }
1701
- }
1702
- return this;
1703
- }
1704
-
1705
- #useStyleObject(style) {
1706
- for (let a in style) {
1707
- if (Object.prototype.hasOwnProperty.call(style, a)) {
1708
- document.documentElement.style.setProperty(`--${a}-${this.id}`, style[a]);
1709
- this.keys.add(a);
1710
- }
1711
- }
1712
- return this;
1713
- }
1714
-
1715
- use(style) {
1716
- if (typeof style === "number") return this.#useStyleIndex(style);
1717
- if (typeof style === "string") return this.#useStyleName(style);
1718
- if (style && typeof style === "object") return this.#useStyleObject(style);
1719
- return this;
1720
- }
1721
- }
1722
-
1723
- const useStyle = (styles, use, id) => new ZikoUseStyle(styles, use, id);
1724
-
1725
- const addSuffixeToNumber=(value,suffixe="px")=>{
1726
- if(typeof value === "number") value+=suffixe;
1727
- if(value instanceof Array)value=value.map(n=>typeof n==="number"?n+=suffixe:n).join(" ");
1728
- return value;
1729
- };
1730
-
1731
- class ZikoUIElementStyle{
1732
- constructor(defaultStyle={}){
1733
- this.target=null;
1734
- this.styles=new Map(
1735
- [["default",defaultStyle]]
1736
- );
1737
- this.cache={
1738
- isHidden:false,
1739
- isFaddedOut:false,
1740
- transformation:{
1741
- Flip:[0,0,0],
1742
- matrix:new Matrix([
1743
- [1,0,0,0],
1744
- [0,1,0,0],
1745
- [0,0,1,0],
1746
- [0,0,0,1]
1747
- ])
1748
- }
1749
- };
1750
- }
1697
+ // Process width and height
1698
+ const StyleMethods = {
1751
1699
  style(styles){
1752
- for(const [key, value] of Object.entries(styles)){
1753
- if(Str.isCamelCase(key)){
1754
- delete styles[key];
1755
- Object.assign(styles,{[Str.camel2hyphencase(key)]:value});
1756
- }
1757
- }
1758
- if(this?.target?.element?.style)Object.assign(this?.target?.element?.style, styles);
1759
- return this;
1760
- }
1761
- linkTo(target){
1762
- this.target=target;
1763
- return this;
1764
- }
1765
- use(name="default"){
1766
- this.style(this.styles.get(name));
1767
- return this;
1768
- }
1769
- update(name,styles){
1770
- const old=this.styles.get(name);
1771
- old?this.styles.set(name,Object.assign(old,styles)):this.styles.set(name,styles);
1772
- return this;
1773
- }
1774
- add(name,styles){
1775
- this.styles.set(name,styles);
1776
- return this;
1777
- }
1778
- replace(name,styles){
1779
- this.styles.set(name,styles);
1780
- return this;
1781
- }
1782
- delete(...names){
1783
- names.forEach(n=>this.styles.delete(n));
1784
- return this;
1785
- }
1786
- updateDefaultStyle(){
1787
- const defaultStyle=Object.fromEntries(
1788
- Object.entries(this.target.element.style).filter(n=>isNaN(+n[0]))
1789
- );
1790
- this.update("default",defaultStyle);
1791
- return this;
1792
- }
1793
- hover(styles){
1794
- //this.updateDefaultStyle()
1795
- if(styles)this.add("hover",styles);
1796
- this.target?.element?.addEventListener("pointerenter",()=>this.use("hover"));
1797
- this.target?.element?.addEventListener("pointerleave",()=>this.use("default"));
1798
- return this;
1799
- }
1800
- // Checkers
1801
- isInline(){
1802
- return getComputedStyle(this.target.element).display.includes("inline");
1803
- }
1804
- isBlock(){
1805
- return !(this.isInline());
1806
- }
1807
- // Size
1808
- size(width,height){
1809
- this.style({
1810
- width,
1811
- height
1812
- });
1813
- return this;
1814
- }
1815
- width(w){
1816
- if(w instanceof Object){
1817
- if(w instanceof Array)w={min:w[0],max:w[1]};
1818
- if("min" in w || "max" in w){
1819
- let min= w.min ?? w.max;
1820
- let max= w.max ?? w.min;
1821
- min=addSuffixeToNumber(min,"px");
1822
- max=addSuffixeToNumber(max,"px");
1823
- this.style({ minWidth: min, maxWidth: max }, { target, maskVector });
1824
- }
1825
- }
1826
- else {
1827
- w=addSuffixeToNumber(w,"px");
1828
- this.style({width:w});
1829
- }
1830
- return this
1831
- }
1832
- height(h){
1833
- if(h instanceof Object){
1834
- if(h instanceof Array)h={min:h[0],max:h[1]};
1835
- if("min" in h || "max" in h){
1836
- let min= h.min ?? h.max;
1837
- let max= h.max ?? h.min;
1838
- min=addSuffixeToNumber(min,"px");
1839
- max=addSuffixeToNumber(max,"px");
1840
- this.style({ minHeight: min, maxHeight: max }, { target, maskVector });
1841
- }
1842
- }
1843
- else {
1844
- h=addSuffixeToNumber(h,"px");
1845
- this.style({height:h});
1846
- }
1847
- return this
1848
- }
1849
- enableResize(h=false,v=false){
1850
- let resize="none";
1851
- if(h)v?resize="both":resize="horizontal";
1852
- else v?resize="vertical":resize="none";
1853
- this.style({
1854
- resize,
1855
- overflow:"hidden"
1856
- });
1857
- if(this.isInline()){
1858
- console.group("Ziko Issue : Temporarily Incompatible Method");
1859
- console.warn(".enableResize has no effect on inline elements!");
1860
- 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");
1861
- console.groupEnd();
1862
- }
1863
- return this;
1864
- }
1865
- // Apparence
1866
- hide({after, target, maskVector } = {}){
1867
- if(typeof after==="number"){
1868
- const wrapper=()=>this.hide({target,maskVector});
1869
- setTimeout(wrapper, after);
1870
- clearTimeout(wrapper);
1871
- }
1872
- else {
1873
- this.cache.isHidden=true;
1874
- this.style({display:"none"},{target,maskVector});
1875
- }
1876
- return this;
1877
- }
1878
- show({after, target, maskVector } = {}){
1879
- if(typeof after==="number"){
1880
- const wrapper=()=>this.show({target,maskVector});
1881
- setTimeout(wrapper, after);
1882
- clearTimeout(wrapper);
1883
- }
1884
- else {
1885
- this.cache.isHidden=false;
1886
- this.style({display:""},{target,maskVector});
1887
- }
1888
- return this;
1889
- }
1890
- color(color){
1891
- this.style({color});
1892
- return this;
1893
- }
1894
- background(background){
1895
- this.style({background});
1896
- return this;
1897
- }
1898
- backgroundColor(backgroundColor){
1899
- this.style({backgroundColor});
1900
- return this;
1901
- }
1902
- opacity(opacity, { target, maskVector } = {}) {
1903
- this.style({ opacity }, { target, maskVector });
1904
- return this;
1905
- }
1906
- // Placement
1907
- position(position){
1908
- this.style({position});
1909
- return this
1910
- }
1911
- display(disp, { target, maskVector } = {}) {
1912
- this.style({ display: disp }, { target, maskVector });
1913
- return this;
1914
- }
1915
- zIndex(z){
1916
- this.style({zIndex:z});
1917
- return this;
1918
- }
1919
- float(float, { target, maskVector } = {}) {
1920
- this.style({ float: float }, { target, maskVector });
1921
- return this;
1922
- }
1923
- // Box Model
1924
- border(border = "1px solid red", { target, maskVector } = {}){
1925
- this.style({border}, { target, maskVector });
1926
- return this;
1927
- }
1928
- borderTop(borderTop = "1px solid red", { target, maskVector } = {}){
1929
- this.style({borderTop}, { target, maskVector });
1930
- return this;
1931
- }
1932
- borderRight(borderRight = "1px solid red", { target, maskVector } = {}){
1933
- this.style({borderRight}, { target, maskVector });
1934
- return this;
1935
- }
1936
- borderBottom(borderBottom = "1px solid red", { target, maskVector } = {}){
1937
- this.style({borderBottom}, { target, maskVector });
1700
+ Object.assign(this.element.style, styles);
1938
1701
  return this;
1939
- }
1940
- borderLeft(borderLeft = "1px solid red", { target, maskVector } = {}){
1941
- this.style({borderLeft}, { target, maskVector });
1942
- return this;
1943
- }
1944
- borderRadius(radius){
1945
- radius=addSuffixeToNumber(radius,"px");
1946
- this.style({ borderRadius: radius }, { target, maskVector });
1947
- return this;
1948
- }
1949
- margin(margin){
1950
- margin=addSuffixeToNumber(margin,"px");
1951
- this.style({ margin }, { target, maskVector });
1952
- return this;
1953
- }
1954
- marginTop(marginTop){
1955
- marginTop=addSuffixeToNumber(marginTop,"px");
1956
- this.style({marginTop});
1957
- return this;
1958
- }
1959
- marginRight(marginRight){
1960
- marginRight=addSuffixeToNumber(marginRight,"px");
1961
- this.style({marginRight});
1962
- return this;
1963
- }
1964
- marginBootom(marginBootom){
1965
- marginBootom=addSuffixeToNumber(marginBootom,"px");
1966
- this.style({marginBootom});
1967
- return this;
1968
- }
1969
- marginLeft(marginLeft){
1970
- marginLeft=addSuffixeToNumber(marginLeft,"px");
1971
- this.style({marginLeft});
1972
- return this;
1973
- }
1974
- padding(padding){
1975
- padding=addSuffixeToNumber(padding,"px");
1976
- this.style({padding});
1977
- return this;
1978
- }
1979
- paddingTop(paddingTop){
1980
- paddingTop=addSuffixeToNumber(paddingTop,"px");
1981
- this.style({paddingTop});
1982
- return this;
1983
- }
1984
- paddingRight(paddingRight){
1985
- paddingRight=addSuffixeToNumber(paddingRight,"px");
1986
- this.style({paddingRight});
1987
- return this;
1988
- }
1989
- paddingBootom(paddingBootom){
1990
- paddingBootom=addSuffixeToNumber(paddingBootom,"px");
1991
- this.style({paddingBootom});
1992
- return this;
1993
- }
1994
- paddingLeft(paddingLeft){
1995
- paddingLeft=addSuffixeToNumber(paddingLeft,"px");
1996
- this.style({paddingLeft});
1997
- return this;
1998
- }
1999
- // Typographie
2000
- font(font){
2001
- this.style({font});
2002
- return this;
2003
- }
2004
- fontFamily(fontFamily=""){
2005
- this.style({fontFamily});
2006
- return this;
2007
- }
2008
- fontSize(fontSize){
2009
- this.style({fontSize});
2010
- return this;
2011
- }
2012
- // Misc
2013
- cursor(type="pointer"){
2014
- this.style({ cursor: type });
2015
- return this;
2016
- }
2017
- overflow(x,y){
2018
- const values=["hidden","auto"];
2019
- this.style({
2020
- overflowX:typeof x==="number"?values[x]:x,
2021
- overflowY:typeof y==="number"?values[y]:y
2022
- },{target,maskVector});
2023
- return this;
2024
- }
2025
- clip(polygon, { target, maskVector } = {}) {
2026
- if (typeof polygon === "string") polygon = "polygon(" + polygon + ")";
2027
- this.style({ clipPath: polygon }, { target, maskVector });
2028
- return this;
2029
- }
2030
- // Transfromations
2031
- fadeOut(transitionTimming = 1) {
2032
- this.style({
2033
- transition:`opacity ${transitionTimming/1000}s`,
2034
- opacity: 0
2035
- });
2036
- this.cache.isFaddedOut=true;
2037
- return this;
2038
- }
2039
- fadeIn(transitionTimming = 1) {
2040
- this.style({
2041
- transition: `opacity ${transitionTimming/1000}s`,
2042
- opacity: 1
2043
- });
2044
- this.cache.isFaddedOut=false;
2045
- return this;
2046
- }
2047
- toggleFade(t_in = 1000,t_out=t_in){
2048
- this.cache.isFaddedOut?this.fadeIn(t_in):this.fadeOut(t_out);
2049
- return this;
2050
- }
2051
- morphBorderRadius(newValue, transitionTimming){
2052
- this.style({
2053
- borderRadius: newValue,
2054
- transition: `borderRadius ${transitionTimming/1000}s`,
2055
- });
2056
- return this;
2057
- }
2058
- #applyTransformMatrix(transitionTimming){
2059
- const transformMatrix = this.cache.transformation.matrix.arr.join(",");
2060
- this.style({
2061
- transform: `matrix3d(${transformMatrix})`,
2062
- "-webkit-transform": `matrix3d(${transformMatrix})`,
2063
- "-moz-transform": `matrix3d(${transformMatrix})`,
2064
- "-ms-transform": `matrix3d(${transformMatrix})`,
2065
- "-o-transform": `matrix3d(${transformMatrix})`
2066
- });
2067
- if (transitionTimming != 0) this.style({ transition: `transform ${transitionTimming/1000}s ease` });
2068
- }
2069
- translate(dx, dy = dx ,dz = 0, transitionTimming = 0) {
2070
- this.cache.transformation.matrix.set(3,0,dx);
2071
- this.cache.transformation.matrix.set(3,1,dy);
2072
- this.cache.transformation.matrix.set(3,2,dz);
2073
- this.#applyTransformMatrix(transitionTimming);
2074
- return this;
2075
- }
2076
- translateX(dx, transitionTimming = 0) {
2077
- this.cache.transformation.matrix.set(3,0,dx);
2078
- this.#applyTransformMatrix(transitionTimming);
2079
- return this;
2080
- }
2081
- translateY(dy, transitionTimming = 0) {
2082
- this.cache.transformation.matrix.set(3,1,dy);
2083
- this.#applyTransformMatrix(transitionTimming);
2084
- return this;
2085
- }
2086
- translateZ(dz, transitionTimming = 0) {
2087
- const d=-1/this.cache.transformation.matrix[2][2];
2088
- this.cache.transformation.matrix.set(3,2,z);
2089
- this.cache.transformation.matrix.set(3,3,1-(dz/d));
2090
- this.#applyTransformMatrix(transitionTimming);
2091
- return this;
2092
- }
2093
- perspective(distance,transitionTimming=0){
2094
- const z=this.cache.transformation.matrix[3][2];
2095
- this.cache.transformation.matrix.set(2,2,-1/d);
2096
- this.cache.transformation.matrix.set(3,3,1-(z/distance));
2097
- this.#applyTransformMatrix(transitionTimming);
2098
- return this;
2099
- }
2100
- scale(sx, sy = sx, transitionTimming = 0) {
2101
- this.cache.transformation.matrix.set(0,0,sx);
2102
- this.cache.transformation.matrix.set(1,1,sy);
2103
- // const transformMatrix = this.cache.transformation.matrix.arr.join(",");
2104
- this.#applyTransformMatrix(transitionTimming);
2105
- return this;
2106
- }
2107
- scaleX(x = 1 , transitionTimming = 0) {
2108
- this.cache.transformation.matrix.set(0,0,x);
2109
- // const transformMatrix = this.cache.transformation.matrix.arr.join(",");
2110
- this.#applyTransformMatrix(transitionTimming);
2111
- return this;
2112
- }
2113
- scaleY(y = 1, transitionTimming = 0) {
2114
- this.cache.transformation.matrix.set(1,1,y);
2115
- this.cache.transformation.matrix.arr.join(",");
2116
- this.#applyTransformMatrix(transitionTimming);
2117
- return this;
2118
- }
2119
- skew(x, y = x, transitionTimming = 0) {
2120
- this.cache.transformation.matrix.set(0,1,x);
2121
- this.cache.transformation.matrix.set(1,0,y);
2122
- this.cache.transformation.matrix.arr.join(",");
2123
- this.#applyTransformMatrix(transitionTimming);
2124
- return this;
2125
- }
2126
- skewX(x = 1 , transitionTimming = 0) {
2127
- this.cache.transformation.matrix.set(0,1,x);
2128
- this.cache.transformation.matrix.arr.join(",");
2129
- this.#applyTransformMatrix(transitionTimming);
2130
- return this;
2131
- }
2132
- skewY(y = 1, transitionTimming = 0) {
2133
- this.cache.transformation.matrix.set(1,0,y);
2134
- this.cache.transformation.matrix.arr.join(",");
2135
- this.#applyTransformMatrix(transitionTimming);
2136
- return this;
2137
- }
2138
- rotateX(rx, transitionTimming = 0) {
2139
- this.cache.transformation.matrix.set(1,1,cos(rx));
2140
- this.cache.transformation.matrix.set(1,2,-sin(rx));
2141
- this.cache.transformation.matrix.set(2,1,sin(rx));
2142
- this.cache.transformation.matrix.set(1,2,cos(rx));
2143
- this.#applyTransformMatrix(transitionTimming);
2144
- return this;
2145
- }
2146
- rotateY(ry, transitionTimming = 0) {
2147
- this.cache.transformation.matrix.set(0,0,cos(ry));
2148
- this.cache.transformation.matrix.set(0,2,sin(ry));
2149
- this.cache.transformation.matrix.set(2,0,-sin(ry));
2150
- this.cache.transformation.matrix.set(2,2,cos(ry));
2151
- this.#applyTransformMatrix(transitionTimming);
2152
- return this;
2153
- }
2154
- rotateZ(rz, transitionTimming = 0) {
2155
- this.cache.transformation.matrix.set(0,0,cos(rz));
2156
- this.cache.transformation.matrix.set(0,1,-sin(rz));
2157
- this.cache.transformation.matrix.set(1,0,sin(rz));
2158
- this.cache.transformation.matrix.set(1,1,cos(rz));
2159
- this.#applyTransformMatrix(transitionTimming);
2160
- return this;
2161
- }
2162
- flipeX(transitionTimming = 1) {
2163
- this.cache.transformation.Flip[0] += 180;
2164
- this.cache.transformation.Flip[0] %= 360;
2165
- this.rotateX(this.cache.transformation.Flip[0], transitionTimming);
2166
- return this;
2167
- }
2168
- flipeY(transitionTimming = 1) {
2169
- this.cache.transformation.Flip[1] += 180 ;
2170
- this.cache.transformation.Flip[1] %= 360;
2171
- this.rotateY(this.cache.transformation.Flip[1], transitionTimming);
2172
- return this;
2173
- }
2174
- flipeZ(transitionTimming = 1) {
2175
- this.cache.transformation.Flip[2] += 180;
2176
- this.cache.transformation.Flip[2] %= 360;
2177
- this.rotateZ(this.cache.transformation.Flip[2], transitionTimming);
2178
- return this;
2179
- }
2180
- slideHeightIn(transitionTimming = 1, h = this.h) {
2181
- this.style({ transition: transitionTimming + "s", height: h });
2182
- return this;
2183
- }
2184
- slideHeightOut(transitionTimming = 1) {
2185
- this.style({ transition: transitionTimming + "s", height: 0 });
2186
- this.target?.element?.n("transitionend", () =>
2187
- this.style({ opacity: "none" }),
2188
- );
2189
- return this;
2190
- }
2191
- slideWidthIn(transitionTimming = 1, w = this.w) {
2192
- this.style({ transition: transitionTimming + "s", width: w });
2193
- return this;
2194
- }
2195
- slideWidthOut(transitionTimming = 1) {
2196
- this.style({ transition: transitionTimming + "s", width: 0 });
2197
- const wrapper=()=>{
2198
- this.style({ opacity: "none" });
2199
- };
2200
- this.target?.element?.addEventListener("transitionend",wrapper);
2201
- this.target?.element?.removeEventListener("transitionend",wrapper);
2202
- return this;
2203
- }
2204
- slideIn({ transitionTimming = 1, w = "100%", h = "auto" } = {}) {
2205
- this.style({
2206
- transition: transitionTimming + "s",
2207
- width: w,
2208
- height: h,
2209
- visibility: "visible",
2210
- });
2211
- return this;
2212
- }
2213
- slideOut({ transitionTimming = 1, width = 0, heightransitionTimming = 0 } = {}) {
2214
- this.style({
2215
- visibility: "hidden",
2216
- transition: transitionTimming + "s",
2217
- opacity: "none",
2218
- width: width,
2219
- height: height,
2220
- });
2221
- const wrapper=()=>{
2222
- this.style({ opacity: "none" });
2223
- };
2224
- this.target?.element?.addEventListener("transitionend",wrapper);
2225
- this.target?.element?.removeEventListener("transitionend",wrapper);
1702
+ },
1703
+ size(width, height){
1704
+ return this.style({width, height})
1705
+ },
1706
+ animate(keyframe, {duration=1000, iterations=1, easing="ease"}={}){
1707
+ this.element?.animate(keyframe,{duration, iterations, easing});
2226
1708
  return this;
2227
- }
2228
-
2229
- }
1709
+ }
1710
+ };
2230
1711
 
2231
1712
  function EVENT_CONTROLLER(e,EVENT,setter,push_object){
2232
1713
  this.event=e;
@@ -3267,8 +2748,8 @@ function __init__global__(){
3267
2748
  }
3268
2749
 
3269
2750
  __init__global__();
3270
- class ZikoUIElement extends ZikoUINode{
3271
- constructor(element, name="", {type="html", useDefaultStyle=false}={}){
2751
+ class UIElement extends UINode{
2752
+ constructor({element, name ='', type="html", useDefaultStyle=false}={}){
3272
2753
  super();
3273
2754
  this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
3274
2755
  if(typeof element === "string") {
@@ -3279,9 +2760,16 @@ class ZikoUIElement extends ZikoUINode{
3279
2760
  }
3280
2761
  }
3281
2762
  else {
3282
- this.target = element.parentElement;
3283
- }
3284
- register(this, DomMethods, IndexingMethods, EventsMethodes);
2763
+ this.target = element?.parentElement;
2764
+ }
2765
+ register(
2766
+ this,
2767
+ AttrsMethods,
2768
+ DomMethods,
2769
+ StyleMethods,
2770
+ IndexingMethods,
2771
+ EventsMethodes
2772
+ );
3285
2773
  Object.assign(this.cache, {
3286
2774
  name,
3287
2775
  isInteractive : [true, false][Math.floor(2*Math.random())],
@@ -3291,7 +2779,6 @@ class ZikoUIElement extends ZikoUINode{
3291
2779
  isHidden: false,
3292
2780
  isFrozzen:false,
3293
2781
  legacyParent : null,
3294
- style: new ZikoUIElementStyle({}),
3295
2782
  attributes: {},
3296
2783
  filters: {},
3297
2784
  temp:{}
@@ -3316,7 +2803,6 @@ class ZikoUIElement extends ZikoUINode{
3316
2803
  if(element)Object.assign(this.cache,{element});
3317
2804
  this.uuid = `${this.cache.name}-${Random.string(16)}`;
3318
2805
  this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
3319
- this.cache.style.linkTo(this);
3320
2806
  useDefaultStyle && this.style({
3321
2807
  position: "relative",
3322
2808
  boxSizing:"border-box",
@@ -3398,25 +2884,17 @@ class ZikoUIElement extends ZikoUINode{
3398
2884
  else UI.element=this.element.cloneNode(true);
3399
2885
  return UI.render(render);
3400
2886
  }
3401
- style(styles){
3402
- styles instanceof ZikoUseStyle ? this.st.style(styles.current): this.st.style(styles);
3403
- return this;
3404
- }
3405
- size(width,height){
3406
- this.st.size(width,height);
3407
- return this;
3408
- }
3409
2887
  [Symbol.iterator]() {
3410
2888
  return this.items[Symbol.iterator]();
3411
2889
  }
3412
2890
  maintain() {
3413
- for (let i = 0; i < this.items.length; i++) {
3414
- Object.defineProperty(this, i, {
3415
- value: this.items[i],
3416
- writable: true,
3417
- configurable: true,
3418
- enumerable: false
3419
- });
2891
+ for (let i = 0; i < this.items.length; i++) {
2892
+ Object.defineProperty(this, i, {
2893
+ value: this.items[i],
2894
+ writable: true,
2895
+ configurable: true,
2896
+ enumerable: false
2897
+ });
3420
2898
  }
3421
2899
  }
3422
2900
  freeze(freeze){
@@ -3434,43 +2912,6 @@ class ZikoUIElement extends ZikoUINode{
3434
2912
  describe(label){
3435
2913
  if(label)this.setAttr("aria-label",label);
3436
2914
  }
3437
- animate(keyframe, {duration=1000, iterations=1, easing="ease"}={}){
3438
- this.element?.animate(keyframe,{duration, iterations, easing});
3439
- return this;
3440
- }
3441
- // Attributes
3442
- #setAttr(name, value){
3443
- if(this.element?.tagName !== "svg") name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
3444
- if(this?.attr[name] && this?.attr[name]===value) return;
3445
- this.element?.setAttribute(name, value);
3446
- Object.assign(this.cache.attributes, {[name]:value});
3447
- }
3448
- setAttr(name, value) {
3449
- if(name instanceof Object){
3450
- const [names,values]=[Object.keys(name),Object.values(name)];
3451
- for(let i=0;i<names.length;i++){
3452
- if(values[i] instanceof Array)value[i] = values[i].join(" ");
3453
- this.#setAttr(names[i], values[i]);
3454
- }
3455
- }
3456
- else {
3457
- if(value instanceof Array)value = value.join(" ");
3458
- this.#setAttr(name, value);
3459
- }
3460
- return this;
3461
- }
3462
- removeAttr(...names) {
3463
- for(let i=0;i<names.length;i++)this.element?.removeAttribute(names[i]);
3464
- return this;
3465
- }
3466
- getAttr(name){
3467
- name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
3468
- return this.element.attributes[name].value;
3469
- }
3470
- setContentEditable(bool = true) {
3471
- this.setAttr("contenteditable", bool);
3472
- return this;
3473
- }
3474
2915
  get children() {
3475
2916
  return [...this.element.children];
3476
2917
  }
@@ -3665,10 +3106,6 @@ const SVGTags = [
3665
3106
  "desc", "title", "metadata", "foreignObject"
3666
3107
  ];
3667
3108
 
3668
- const isStateGetter = (arg) => {
3669
- return typeof(arg) === 'function' && arg?.()?.isStateGetter?.()
3670
- };
3671
-
3672
3109
  const tags = new Proxy({}, {
3673
3110
  get(target, prop) {
3674
3111
  if (typeof prop !== 'string') return undefined;
@@ -3685,18 +3122,18 @@ const tags = new Proxy({}, {
3685
3122
  // }
3686
3123
  if(
3687
3124
  ['string', 'number'].includes(typeof args[0])
3688
- || args[0] instanceof ZikoUIElement
3125
+ || args[0] instanceof UIElement
3689
3126
  || (typeof args[0] === 'function' && args[0]().isStateGetter())
3690
- ) return new ZikoUIElement(tag, tag, {type}).append(...args);
3691
- return new ZikoUIElement(tag).setAttr(args.shift()).append(...args)
3127
+ ) return new UIElement({element :tag, name : tag, type}).append(...args);
3128
+ return new UIElement({element : tag}).setAttr(args.shift()).append(...args)
3692
3129
  }
3693
- // if(SVGTags.includes(tag)) return (...args) => new ZikoUIElement(tag,"",{el_type : "svg"}).append(...args);
3130
+ // if(SVGTags.includes(tag)) return (...args) => new UIElement(tag,"",{el_type : "svg"}).append(...args);
3694
3131
  // return (...args)=>{
3695
- // if(!(args[0] instanceof ZikoUIElement) && args[0] instanceof Object){
3132
+ // if(!(args[0] instanceof UIElement) && args[0] instanceof Object){
3696
3133
  // let attributes = args.shift()
3697
- // return new ZikoUIElement(tag).setAttr(attributes).append(...args)
3134
+ // return new UIElement(tag).setAttr(attributes).append(...args)
3698
3135
  // }
3699
- // return new ZikoUIElement(tag).append(...args);
3136
+ // return new UIElement(tag).append(...args);
3700
3137
  // }
3701
3138
  // // switch(tag){
3702
3139
  // case "html" : globalThis?.document?.createElement("html")
@@ -3706,14 +3143,14 @@ const tags = new Proxy({}, {
3706
3143
  // case "meta" :
3707
3144
  // case "srcipt":
3708
3145
  // case "body" : return null; break;
3709
- // default : return new ZikoUIElement(tag);
3146
+ // default : return new UIElement(tag);
3710
3147
  // }
3711
3148
  }
3712
3149
  });
3713
3150
 
3714
- class ZikoUIFlex extends ZikoUIElement {
3151
+ class ZikoUIFlex extends UIElement {
3715
3152
  constructor(tag = "div", w = "100%", h = "100%") {
3716
- super(tag ,"Flex");
3153
+ super({element : tag , name : "Flex"});
3717
3154
  this.direction = "cols";
3718
3155
  if (typeof w == "number") w += "%";
3719
3156
  if (typeof h == "number") h += "%";
@@ -3781,13 +3218,13 @@ class ZikoUIFlex extends ZikoUIElement {
3781
3218
  }
3782
3219
  }
3783
3220
 
3784
- const Flex = (...ZikoUIElement) =>{
3221
+ const Flex = (...UIElement) =>{
3785
3222
  let tag="div";
3786
- if(typeof ZikoUIElement[0]==="string"){
3787
- tag=ZikoUIElement[0];
3788
- ZikoUIElement.pop();
3223
+ if(typeof UIElement[0]==="string"){
3224
+ tag=UIElement[0];
3225
+ UIElement.pop();
3789
3226
  }
3790
- return new ZikoUIFlex(tag).append(...ZikoUIElement);
3227
+ return new ZikoUIFlex(tag).append(...UIElement);
3791
3228
  };
3792
3229
  function set_vertical(direction){
3793
3230
  direction == 1
@@ -3810,9 +3247,9 @@ function map_pos_y(align){
3810
3247
  return map_pos_x(-align);
3811
3248
  }
3812
3249
 
3813
- class ZikoUIGrid extends ZikoUIElement {
3250
+ class ZikoUIGrid extends UIElement {
3814
3251
  constructor(tag ="div", w = "50vw", h = "50vh") {
3815
- super(tag,"Grid");
3252
+ super({element : tag, name : "Grid"});
3816
3253
  this.direction = "cols";
3817
3254
  if (typeof w == "number") w += "%";
3818
3255
  if (typeof h == "number") h += "%";
@@ -3840,11 +3277,11 @@ class ZikoUIGrid extends ZikoUIElement {
3840
3277
  return this;
3841
3278
  }
3842
3279
  }
3843
- const Grid$1 = (...ZikoUIElement) => new ZikoUIGrid("div").append(...ZikoUIElement);
3280
+ const Grid$1 = (...UIElement) => new ZikoUIGrid("div").append(...UIElement);
3844
3281
 
3845
- class ZikoUISuspense extends ZikoUIElement{
3282
+ class ZikoUISuspense extends UIElement{
3846
3283
  constructor(fallback_ui, callback){
3847
- super("div", "suspense");
3284
+ super({element : "div", name : "suspense"});
3848
3285
  this.setAttr({
3849
3286
  dataTemp : "suspense"
3850
3287
  });
@@ -3866,9 +3303,9 @@ class ZikoUISuspense extends ZikoUIElement{
3866
3303
 
3867
3304
  const Suspense = (fallback_ui, callback) => new ZikoUISuspense(fallback_ui, callback);
3868
3305
 
3869
- class ZikoUIXMLWrapper extends ZikoUIElement{
3306
+ class ZikoUIXMLWrapper extends UIElement{
3870
3307
  constructor(XMLContent, type){
3871
- super("div", "");
3308
+ super({element : "div", name : ""});
3872
3309
  this.element.append(type==="svg"?svg2dom(XMLContent):html2dom(XMLContent));
3873
3310
  }
3874
3311
  }
@@ -3900,7 +3337,7 @@ class ZikoUISVGWrapper extends ZikoUIXMLWrapper{
3900
3337
  const HTMLWrapper = (HTMLContent) => new ZikoUIHTMLWrapper(HTMLContent);
3901
3338
  const SVGWrapper = (SVGContent) => new ZikoUISVGWrapper(SVGContent);
3902
3339
 
3903
- class ZikoUICanvas extends ZikoUIElement{
3340
+ class ZikoUICanvas extends UIElement{
3904
3341
  constructor(w,h){
3905
3342
  super("canvas","canvas");
3906
3343
  this.ctx = this.element?.getContext("2d");
@@ -4070,7 +3507,7 @@ class ZikoUICanvas extends ZikoUIElement{
4070
3507
 
4071
3508
  const Canvas=(w,h)=>new ZikoUICanvas(w,h);
4072
3509
 
4073
- class ZikoUISvg extends ZikoUIElement {
3510
+ class ZikoUISvg extends UIElement {
4074
3511
  constructor(w=360,h=300) {
4075
3512
  super("svg","svg");
4076
3513
  //this.cache={};
@@ -6235,4 +5672,4 @@ if(globalThis?.document){
6235
5672
  document?.addEventListener("DOMContentLoaded", __Ziko__.__Config__.init());
6236
5673
  }
6237
5674
 
6238
- export { App, Base, Canvas, Combinaison, Complex, E, EPSILON, Ease, FileBasedRouting, Flex, Grid$1 as Grid, HTMLWrapper, Logic$1 as Logic, Matrix, PI$1 as PI, Permutation, Random, SPA, SVGWrapper, Str, Suspense, Svg, Utils, ZikoApp, ZikoCustomEvent, ZikoEventClick, ZikoEventClipboard, ZikoEventCustom, ZikoEventDrag, ZikoEventFocus, ZikoEventInput, ZikoEventKey, ZikoEventMouse, ZikoEventPointer, ZikoEventSwipe, ZikoEventTouch, ZikoEventWheel, ZikoHead, ZikoMutationObserver, ZikoSPA, ZikoUICanvas, ZikoUIElement, ZikoUIFlex, ZikoUIGrid, ZikoUIHTMLWrapper, ZikoUINode, ZikoUISVGWrapper, ZikoUISuspense, ZikoUISvg, ZikoUIText, ZikoUIXMLWrapper, ZikoUseRoot, ZikoUseStyle, __ZikoEvent__, abs, accum, acos, acosh, acot, add, arange, arr2str, asin, asinh, atan, atan2, atanh, bindClickEvent, bindClipboardEvent, bindCustomEvent, bindDragEvent, bindFocusEvent, bindHashEvent, bindKeyEvent, bindMouseEvent, bindPointerEvent, bindTouchEvent, bindWheelEvent, cartesianProduct, ceil, clamp, combinaison, complex, cos, cosh, cot, coth, count, countWords, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, debounce, defineParamsGetter, deg2rad, div, e, fact, floor, geomspace, getEvent, hypot, inRange, isApproximatlyEqual, json2arr, json2css, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, lerp, linspace, ln, logspace, map, mapfun$1 as mapfun, matrix, matrix2, matrix3, matrix4, max, min, modulo, mul, norm, nums, obj2str, ones, pgcd, pow, powerSet, ppcm, preload, prod, rad2deg, removeExtraSpace, round, sec, sig, sign, sin, sinc, sinh, sqrt, sqrtn, str, sub, subSet, sum, svg2ascii, svg2img, svg2imgUrl, svg2str, tags, tan, tanh, text, throttle, timeTaken, time_memory_Taken, useAnimation, useChannel, useCustomEvent, useEventEmitter, useFavIcon, useFps, useHashEvent, useHead, useInputEvent, useLocaleStorage, useMediaQuery, useMeta, useRoot, useSessionStorage, useStyle, useSuccesifKeys, useSwipeEvent, useThread, useTimeLoop, useTitle, wait, waitForUIElm, waitForUIElmSync, watch, watchAttr, watchChildren, watchIntersection, watchScreen, watchSize, zeros };
5675
+ export { App, Base, Canvas, Combinaison, Complex, E, EPSILON, Ease, FileBasedRouting, Flex, Grid$1 as Grid, HTMLWrapper, Logic$1 as Logic, Matrix, PI$1 as PI, Permutation, Random, SPA, SVGWrapper, Str, Suspense, Svg, UIElement, UINode, Utils, ZikoApp, ZikoCustomEvent, ZikoEventClick, ZikoEventClipboard, ZikoEventCustom, ZikoEventDrag, ZikoEventFocus, ZikoEventInput, ZikoEventKey, ZikoEventMouse, ZikoEventPointer, ZikoEventSwipe, ZikoEventTouch, ZikoEventWheel, ZikoHead, ZikoMutationObserver, ZikoSPA, ZikoUICanvas, ZikoUIFlex, ZikoUIGrid, ZikoUIHTMLWrapper, ZikoUISVGWrapper, ZikoUISuspense, ZikoUISvg, ZikoUIText, ZikoUIXMLWrapper, ZikoUseRoot, __ZikoEvent__, abs, accum, acos, acosh, acot, add, arange, arr2str, asin, asinh, atan, atan2, atanh, bindClickEvent, bindClipboardEvent, bindCustomEvent, bindDragEvent, bindFocusEvent, bindHashEvent, bindKeyEvent, bindMouseEvent, bindPointerEvent, bindTouchEvent, bindWheelEvent, cartesianProduct, ceil, clamp, combinaison, complex, cos, cosh, cot, coth, count, countWords, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, debounce, defineParamsGetter, deg2rad, div, e, fact, floor, geomspace, getEvent, hypot, inRange, isApproximatlyEqual, json2arr, json2css, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, lerp, linspace, ln, logspace, map, mapfun$1 as mapfun, matrix, matrix2, matrix3, matrix4, max, min, modulo, mul, norm, nums, obj2str, ones, pgcd, pow, powerSet, ppcm, preload, prod, rad2deg, removeExtraSpace, round, sec, sig, sign, sin, sinc, sinh, sqrt, sqrtn, str, sub, subSet, sum, svg2ascii, svg2img, svg2imgUrl, svg2str, tags, tan, tanh, text, throttle, timeTaken, time_memory_Taken, useAnimation, useChannel, useCustomEvent, useEventEmitter, useFavIcon, useFps, useHashEvent, useHead, useInputEvent, useLocaleStorage, useMediaQuery, useMeta, useRoot, useSessionStorage, useSuccesifKeys, useSwipeEvent, useThread, useTimeLoop, useTitle, wait, waitForUIElm, waitForUIElmSync, watch, watchAttr, watchChildren, watchIntersection, watchScreen, watchSize, zeros };