ziko 0.38.0 → 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.cjs +165 -759
- package/dist/ziko.js +165 -759
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +164 -756
- package/package.json +2 -1
- package/src/__helpers__/composition-dep/compose-class.js +46 -0
- package/src/__helpers__/register/index.js +6 -0
- package/src/__helpers__/register/register-to-class.js +16 -0
- package/src/__helpers__/register/register-to-instance.js +18 -0
- package/src/__ziko__/index.js +12 -11
- package/src/events/types/clipboard.d.ts +2 -2
- package/src/events/types/focus.d.ts +2 -2
- package/src/events/types/pointer.d.ts +2 -2
- package/src/hooks/use-state.js +5 -0
- package/src/reactivity/hooks/UI/index.js +1 -1
- package/src/ui/__methods__/attrs.js +46 -0
- package/src/ui/__methods__/index.js +5 -0
- package/src/ui/__methods__/style.js +14 -0
- package/src/ui/__utils__/index.js +2 -2
- package/src/ui/constructors/{ZikoUIElement.js → UIElement.js} +30 -82
- package/src/ui/constructors/{ZikoUINode.js → UINode.js} +2 -2
- package/src/ui/flex/index.js +8 -8
- package/src/ui/graphics/canvas.js +2 -2
- package/src/ui/graphics/svg.js +2 -2
- package/src/ui/grid/index.js +4 -4
- package/src/ui/index.js +2 -2
- package/src/ui/suspense/index.js +3 -3
- package/src/ui/tags/index.d.ts.txt +125 -125
- package/src/ui/tags/index.js +28 -18
- package/src/ui/text/index.js +2 -2
- package/src/ui/wrapper/index.js +3 -3
- package/src/__helpers__/composition/compose-class.js +0 -28
- /package/src/__helpers__/{composition → composition-dep}/compose-instance.js +0 -0
- /package/src/__helpers__/{composition → composition-dep}/compose.js +0 -0
- /package/src/__helpers__/{composition → composition-dep}/index.js +0 -0
- /package/src/ui/constructors/{ZikoUIElementMethodesToBeMoved.js → ZikoUIElementMethodesToBeMoved-dep.js} +0 -0
package/dist/ziko.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date :
|
|
5
|
+
Date : 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
|
|
@@ -945,21 +945,6 @@ const preload=(url)=>{
|
|
|
945
945
|
}
|
|
946
946
|
};
|
|
947
947
|
|
|
948
|
-
async function fetchdom(url='https://github.com/zakarialaoui10'){
|
|
949
|
-
const data=await fetch(url);
|
|
950
|
-
const html=await data.text();
|
|
951
|
-
const dom= new DOMParser().parseFromString(html,'text/xml');
|
|
952
|
-
return dom.documentElement
|
|
953
|
-
}
|
|
954
|
-
function fetchdomSync(url='https://github.com/zakarialaoui10'){
|
|
955
|
-
const data=preload(url);
|
|
956
|
-
const dom= new DOMParser().parseFromString(data,'text/xml');
|
|
957
|
-
return dom.documentElement;
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
globalThis.fetchdom=fetchdom;
|
|
961
|
-
globalThis.fetchdomSync=fetchdomSync;
|
|
962
|
-
|
|
963
948
|
const csv2arr = (csv, delimiter = ",")=>csv.trim().trimEnd().split("\n").map(n=>n.split(delimiter));
|
|
964
949
|
const csv2matrix = (csv, delimiter = ",")=>new Matrix(csv2arr(csv,delimiter));
|
|
965
950
|
const csv2object = (csv, delimiter = ",") => {
|
|
@@ -1058,7 +1043,7 @@ const json2xmlFile=(json,indent)=>{
|
|
|
1058
1043
|
}
|
|
1059
1044
|
};
|
|
1060
1045
|
|
|
1061
|
-
class
|
|
1046
|
+
class UINode {
|
|
1062
1047
|
constructor(node){
|
|
1063
1048
|
this.cache = {
|
|
1064
1049
|
node
|
|
@@ -1072,38 +1057,29 @@ class ZikoUINode {
|
|
|
1072
1057
|
}
|
|
1073
1058
|
}
|
|
1074
1059
|
|
|
1075
|
-
globalThis.node = (node) => new
|
|
1060
|
+
globalThis.node = (node) => new UINode(node);
|
|
1076
1061
|
|
|
1077
|
-
function
|
|
1062
|
+
function register_to_class(target, ...mixins){
|
|
1063
|
+
mixins.forEach(n => _register_to_class_(target, n));
|
|
1064
|
+
}
|
|
1065
|
+
function _register_to_class_(target, mixin) {
|
|
1078
1066
|
const descriptors = Object.getOwnPropertyDescriptors(mixin);
|
|
1079
|
-
|
|
1080
|
-
class Composed extends Class {
|
|
1081
|
-
constructor(...args) {
|
|
1082
|
-
super(...args);
|
|
1083
|
-
for (const key of Reflect.ownKeys(descriptors)) {
|
|
1084
|
-
const desc = descriptors[key];
|
|
1085
|
-
|
|
1086
|
-
if (typeof desc.value === 'function') {
|
|
1087
|
-
this[key] = desc.value.bind(this);
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
1067
|
for (const key of Reflect.ownKeys(descriptors)) {
|
|
1094
1068
|
const desc = descriptors[key];
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1069
|
+
if ('get' in desc || 'set' in desc || typeof desc.value !== 'function') {
|
|
1070
|
+
Object.defineProperty(Object.getPrototypeOf(target), key, desc);
|
|
1071
|
+
} else if (typeof desc.value === 'function') {
|
|
1072
|
+
if (!Object.getPrototypeOf(target).hasOwnProperty(key)) {
|
|
1073
|
+
Object.defineProperty(Object.getPrototypeOf(target), key, desc);
|
|
1074
|
+
}
|
|
1100
1075
|
}
|
|
1101
1076
|
}
|
|
1102
|
-
|
|
1103
|
-
return Composed;
|
|
1104
1077
|
}
|
|
1105
1078
|
|
|
1106
|
-
function
|
|
1079
|
+
function register_to_instance(target, ...mixins){
|
|
1080
|
+
mixins.forEach(n => _register_to_instance_(target, n));
|
|
1081
|
+
}
|
|
1082
|
+
function _register_to_instance_(instance, mixin) {
|
|
1107
1083
|
const descriptors = Object.getOwnPropertyDescriptors(mixin);
|
|
1108
1084
|
|
|
1109
1085
|
for (const key of Reflect.ownKeys(descriptors)) {
|
|
@@ -1119,17 +1095,60 @@ function composeInstance(instance, mixin) {
|
|
|
1119
1095
|
}
|
|
1120
1096
|
}
|
|
1121
1097
|
|
|
1122
|
-
|
|
1123
|
-
if
|
|
1124
|
-
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1098
|
+
const register = (target, ...mixins) => {
|
|
1099
|
+
if(typeof target === 'function') register_to_class(target, ...mixins);
|
|
1100
|
+
else register_to_instance(target, ...mixins);
|
|
1101
|
+
};
|
|
1102
|
+
|
|
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;
|
|
1129
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});
|
|
1130
1149
|
}
|
|
1131
1150
|
|
|
1132
|
-
class ZikoUIText extends
|
|
1151
|
+
class ZikoUIText extends UINode {
|
|
1133
1152
|
constructor(...value) {
|
|
1134
1153
|
super("span", "text", false, ...value);
|
|
1135
1154
|
this.element = globalThis?.document?.createTextNode(...value);
|
|
@@ -1248,22 +1267,6 @@ function __addItem__(adder, pusher, ...ele) {
|
|
|
1248
1267
|
return this;
|
|
1249
1268
|
}
|
|
1250
1269
|
|
|
1251
|
-
const IndexingMethods = {
|
|
1252
|
-
at(index) {
|
|
1253
|
-
return this.items.at(index);
|
|
1254
|
-
},
|
|
1255
|
-
forEach(callback) {
|
|
1256
|
-
this.items.forEach(callback);
|
|
1257
|
-
return this;
|
|
1258
|
-
},
|
|
1259
|
-
map(callback) {
|
|
1260
|
-
return this.items.map(callback);
|
|
1261
|
-
},
|
|
1262
|
-
find(condition) {
|
|
1263
|
-
return this.items.filter(condition);
|
|
1264
|
-
},
|
|
1265
|
-
};
|
|
1266
|
-
|
|
1267
1270
|
const Events = {
|
|
1268
1271
|
'Click' : [
|
|
1269
1272
|
'Click',
|
|
@@ -1675,587 +1678,36 @@ Object.entries(Events).forEach(([name, eventList]) => {
|
|
|
1675
1678
|
});
|
|
1676
1679
|
});
|
|
1677
1680
|
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
this.
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
fontSize: "1em",
|
|
1685
|
-
color : "green"
|
|
1686
|
-
},
|
|
1687
|
-
other: {
|
|
1688
|
-
fontSize : "2em",
|
|
1689
|
-
color : "cyan"
|
|
1690
|
-
}
|
|
1691
|
-
};
|
|
1692
|
-
style && this.add(style);
|
|
1693
|
-
use && this.use(use);
|
|
1694
|
-
}
|
|
1695
|
-
|
|
1696
|
-
get current() {
|
|
1697
|
-
return [...this.keys].reduce((key, value) => {
|
|
1698
|
-
key[value] = `var(--${value}-${this.id})`;
|
|
1699
|
-
return key;
|
|
1700
|
-
}, {});
|
|
1701
|
-
}
|
|
1702
|
-
|
|
1703
|
-
add(name, style = {}) {
|
|
1704
|
-
if (name && typeof name === 'object' && !Array.isArray(name)) {
|
|
1705
|
-
Object.assign(this.styles, name);
|
|
1706
|
-
} else if (typeof name === 'string') {
|
|
1707
|
-
Object.assign(this.styles, { [name]: style });
|
|
1708
|
-
}
|
|
1709
|
-
return this;
|
|
1710
|
-
}
|
|
1711
|
-
|
|
1712
|
-
#useStyleIndex(index) {
|
|
1713
|
-
const keys = Object.keys(this.styles);
|
|
1714
|
-
for (let a in this.styles[keys[index]]) {
|
|
1715
|
-
if (Object.prototype.hasOwnProperty.call(this.styles[keys[index]], a)) {
|
|
1716
|
-
document.documentElement.style.setProperty(`--${a}-${this.id}`, this.styles[keys[index]][a]);
|
|
1717
|
-
this.keys.add(a);
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
return this;
|
|
1721
|
-
}
|
|
1722
|
-
|
|
1723
|
-
#useStyleName(name) {
|
|
1724
|
-
if (!this.styles[name]) return this;
|
|
1725
|
-
for (let a in this.styles[name]) {
|
|
1726
|
-
if (Object.prototype.hasOwnProperty.call(this.styles[name], a)) {
|
|
1727
|
-
document.documentElement.style.setProperty(`--${a}-${this.id}`, this.styles[name][a]);
|
|
1728
|
-
this.keys.add(a);
|
|
1729
|
-
}
|
|
1730
|
-
}
|
|
1731
|
-
return this;
|
|
1732
|
-
}
|
|
1733
|
-
|
|
1734
|
-
#useStyleObject(style) {
|
|
1735
|
-
for (let a in style) {
|
|
1736
|
-
if (Object.prototype.hasOwnProperty.call(style, a)) {
|
|
1737
|
-
document.documentElement.style.setProperty(`--${a}-${this.id}`, style[a]);
|
|
1738
|
-
this.keys.add(a);
|
|
1739
|
-
}
|
|
1740
|
-
}
|
|
1741
|
-
return this;
|
|
1742
|
-
}
|
|
1743
|
-
|
|
1744
|
-
use(style) {
|
|
1745
|
-
if (typeof style === "number") return this.#useStyleIndex(style);
|
|
1746
|
-
if (typeof style === "string") return this.#useStyleName(style);
|
|
1747
|
-
if (style && typeof style === "object") return this.#useStyleObject(style);
|
|
1681
|
+
const IndexingMethods = {
|
|
1682
|
+
at(index) {
|
|
1683
|
+
return this.items.at(index);
|
|
1684
|
+
},
|
|
1685
|
+
forEach(callback) {
|
|
1686
|
+
this.items.forEach(callback);
|
|
1748
1687
|
return this;
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
if(value instanceof Array)value=value.map(n=>typeof n==="number"?n+=suffixe:n).join(" ");
|
|
1757
|
-
return value;
|
|
1688
|
+
},
|
|
1689
|
+
map(callback) {
|
|
1690
|
+
return this.items.map(callback);
|
|
1691
|
+
},
|
|
1692
|
+
find(condition) {
|
|
1693
|
+
return this.items.filter(condition);
|
|
1694
|
+
},
|
|
1758
1695
|
};
|
|
1759
1696
|
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
this.target=null;
|
|
1763
|
-
this.styles=new Map(
|
|
1764
|
-
[["default",defaultStyle]]
|
|
1765
|
-
);
|
|
1766
|
-
this.cache={
|
|
1767
|
-
isHidden:false,
|
|
1768
|
-
isFaddedOut:false,
|
|
1769
|
-
transformation:{
|
|
1770
|
-
Flip:[0,0,0],
|
|
1771
|
-
matrix:new Matrix([
|
|
1772
|
-
[1,0,0,0],
|
|
1773
|
-
[0,1,0,0],
|
|
1774
|
-
[0,0,1,0],
|
|
1775
|
-
[0,0,0,1]
|
|
1776
|
-
])
|
|
1777
|
-
}
|
|
1778
|
-
};
|
|
1779
|
-
}
|
|
1697
|
+
// Process width and height
|
|
1698
|
+
const StyleMethods = {
|
|
1780
1699
|
style(styles){
|
|
1781
|
-
|
|
1782
|
-
if(Str.isCamelCase(key)){
|
|
1783
|
-
delete styles[key];
|
|
1784
|
-
Object.assign(styles,{[Str.camel2hyphencase(key)]:value});
|
|
1785
|
-
}
|
|
1786
|
-
}
|
|
1787
|
-
if(this?.target?.element?.style)Object.assign(this?.target?.element?.style, styles);
|
|
1788
|
-
return this;
|
|
1789
|
-
}
|
|
1790
|
-
linkTo(target){
|
|
1791
|
-
this.target=target;
|
|
1792
|
-
return this;
|
|
1793
|
-
}
|
|
1794
|
-
use(name="default"){
|
|
1795
|
-
this.style(this.styles.get(name));
|
|
1796
|
-
return this;
|
|
1797
|
-
}
|
|
1798
|
-
update(name,styles){
|
|
1799
|
-
const old=this.styles.get(name);
|
|
1800
|
-
old?this.styles.set(name,Object.assign(old,styles)):this.styles.set(name,styles);
|
|
1801
|
-
return this;
|
|
1802
|
-
}
|
|
1803
|
-
add(name,styles){
|
|
1804
|
-
this.styles.set(name,styles);
|
|
1805
|
-
return this;
|
|
1806
|
-
}
|
|
1807
|
-
replace(name,styles){
|
|
1808
|
-
this.styles.set(name,styles);
|
|
1809
|
-
return this;
|
|
1810
|
-
}
|
|
1811
|
-
delete(...names){
|
|
1812
|
-
names.forEach(n=>this.styles.delete(n));
|
|
1813
|
-
return this;
|
|
1814
|
-
}
|
|
1815
|
-
updateDefaultStyle(){
|
|
1816
|
-
const defaultStyle=Object.fromEntries(
|
|
1817
|
-
Object.entries(this.target.element.style).filter(n=>isNaN(+n[0]))
|
|
1818
|
-
);
|
|
1819
|
-
this.update("default",defaultStyle);
|
|
1820
|
-
return this;
|
|
1821
|
-
}
|
|
1822
|
-
hover(styles){
|
|
1823
|
-
//this.updateDefaultStyle()
|
|
1824
|
-
if(styles)this.add("hover",styles);
|
|
1825
|
-
this.target?.element?.addEventListener("pointerenter",()=>this.use("hover"));
|
|
1826
|
-
this.target?.element?.addEventListener("pointerleave",()=>this.use("default"));
|
|
1827
|
-
return this;
|
|
1828
|
-
}
|
|
1829
|
-
// Checkers
|
|
1830
|
-
isInline(){
|
|
1831
|
-
return getComputedStyle(this.target.element).display.includes("inline");
|
|
1832
|
-
}
|
|
1833
|
-
isBlock(){
|
|
1834
|
-
return !(this.isInline());
|
|
1835
|
-
}
|
|
1836
|
-
// Size
|
|
1837
|
-
size(width,height){
|
|
1838
|
-
this.style({
|
|
1839
|
-
width,
|
|
1840
|
-
height
|
|
1841
|
-
});
|
|
1842
|
-
return this;
|
|
1843
|
-
}
|
|
1844
|
-
width(w){
|
|
1845
|
-
if(w instanceof Object){
|
|
1846
|
-
if(w instanceof Array)w={min:w[0],max:w[1]};
|
|
1847
|
-
if("min" in w || "max" in w){
|
|
1848
|
-
let min= w.min ?? w.max;
|
|
1849
|
-
let max= w.max ?? w.min;
|
|
1850
|
-
min=addSuffixeToNumber(min,"px");
|
|
1851
|
-
max=addSuffixeToNumber(max,"px");
|
|
1852
|
-
this.style({ minWidth: min, maxWidth: max }, { target, maskVector });
|
|
1853
|
-
}
|
|
1854
|
-
}
|
|
1855
|
-
else {
|
|
1856
|
-
w=addSuffixeToNumber(w,"px");
|
|
1857
|
-
this.style({width:w});
|
|
1858
|
-
}
|
|
1859
|
-
return this
|
|
1860
|
-
}
|
|
1861
|
-
height(h){
|
|
1862
|
-
if(h instanceof Object){
|
|
1863
|
-
if(h instanceof Array)h={min:h[0],max:h[1]};
|
|
1864
|
-
if("min" in h || "max" in h){
|
|
1865
|
-
let min= h.min ?? h.max;
|
|
1866
|
-
let max= h.max ?? h.min;
|
|
1867
|
-
min=addSuffixeToNumber(min,"px");
|
|
1868
|
-
max=addSuffixeToNumber(max,"px");
|
|
1869
|
-
this.style({ minHeight: min, maxHeight: max }, { target, maskVector });
|
|
1870
|
-
}
|
|
1871
|
-
}
|
|
1872
|
-
else {
|
|
1873
|
-
h=addSuffixeToNumber(h,"px");
|
|
1874
|
-
this.style({height:h});
|
|
1875
|
-
}
|
|
1876
|
-
return this
|
|
1877
|
-
}
|
|
1878
|
-
enableResize(h=false,v=false){
|
|
1879
|
-
let resize="none";
|
|
1880
|
-
if(h)v?resize="both":resize="horizontal";
|
|
1881
|
-
else v?resize="vertical":resize="none";
|
|
1882
|
-
this.style({
|
|
1883
|
-
resize,
|
|
1884
|
-
overflow:"hidden"
|
|
1885
|
-
});
|
|
1886
|
-
if(this.isInline()){
|
|
1887
|
-
console.group("Ziko Issue : Temporarily Incompatible Method");
|
|
1888
|
-
console.warn(".enableResize has no effect on inline elements!");
|
|
1889
|
-
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");
|
|
1890
|
-
console.groupEnd();
|
|
1891
|
-
}
|
|
1892
|
-
return this;
|
|
1893
|
-
}
|
|
1894
|
-
// Apparence
|
|
1895
|
-
hide({after, target, maskVector } = {}){
|
|
1896
|
-
if(typeof after==="number"){
|
|
1897
|
-
const wrapper=()=>this.hide({target,maskVector});
|
|
1898
|
-
setTimeout(wrapper, after);
|
|
1899
|
-
clearTimeout(wrapper);
|
|
1900
|
-
}
|
|
1901
|
-
else {
|
|
1902
|
-
this.cache.isHidden=true;
|
|
1903
|
-
this.style({display:"none"},{target,maskVector});
|
|
1904
|
-
}
|
|
1905
|
-
return this;
|
|
1906
|
-
}
|
|
1907
|
-
show({after, target, maskVector } = {}){
|
|
1908
|
-
if(typeof after==="number"){
|
|
1909
|
-
const wrapper=()=>this.show({target,maskVector});
|
|
1910
|
-
setTimeout(wrapper, after);
|
|
1911
|
-
clearTimeout(wrapper);
|
|
1912
|
-
}
|
|
1913
|
-
else {
|
|
1914
|
-
this.cache.isHidden=false;
|
|
1915
|
-
this.style({display:""},{target,maskVector});
|
|
1916
|
-
}
|
|
1917
|
-
return this;
|
|
1918
|
-
}
|
|
1919
|
-
color(color){
|
|
1920
|
-
this.style({color});
|
|
1921
|
-
return this;
|
|
1922
|
-
}
|
|
1923
|
-
background(background){
|
|
1924
|
-
this.style({background});
|
|
1925
|
-
return this;
|
|
1926
|
-
}
|
|
1927
|
-
backgroundColor(backgroundColor){
|
|
1928
|
-
this.style({backgroundColor});
|
|
1700
|
+
Object.assign(this.element.style, styles);
|
|
1929
1701
|
return this;
|
|
1930
|
-
}
|
|
1931
|
-
|
|
1932
|
-
this.style({
|
|
1933
|
-
|
|
1934
|
-
}
|
|
1935
|
-
|
|
1936
|
-
position(position){
|
|
1937
|
-
this.style({position});
|
|
1938
|
-
return this
|
|
1939
|
-
}
|
|
1940
|
-
display(disp, { target, maskVector } = {}) {
|
|
1941
|
-
this.style({ display: disp }, { target, maskVector });
|
|
1942
|
-
return this;
|
|
1943
|
-
}
|
|
1944
|
-
zIndex(z){
|
|
1945
|
-
this.style({zIndex:z});
|
|
1946
|
-
return this;
|
|
1947
|
-
}
|
|
1948
|
-
float(float, { target, maskVector } = {}) {
|
|
1949
|
-
this.style({ float: float }, { target, maskVector });
|
|
1950
|
-
return this;
|
|
1951
|
-
}
|
|
1952
|
-
// Box Model
|
|
1953
|
-
border(border = "1px solid red", { target, maskVector } = {}){
|
|
1954
|
-
this.style({border}, { target, maskVector });
|
|
1955
|
-
return this;
|
|
1956
|
-
}
|
|
1957
|
-
borderTop(borderTop = "1px solid red", { target, maskVector } = {}){
|
|
1958
|
-
this.style({borderTop}, { target, maskVector });
|
|
1959
|
-
return this;
|
|
1960
|
-
}
|
|
1961
|
-
borderRight(borderRight = "1px solid red", { target, maskVector } = {}){
|
|
1962
|
-
this.style({borderRight}, { target, maskVector });
|
|
1963
|
-
return this;
|
|
1964
|
-
}
|
|
1965
|
-
borderBottom(borderBottom = "1px solid red", { target, maskVector } = {}){
|
|
1966
|
-
this.style({borderBottom}, { target, maskVector });
|
|
1967
|
-
return this;
|
|
1968
|
-
}
|
|
1969
|
-
borderLeft(borderLeft = "1px solid red", { target, maskVector } = {}){
|
|
1970
|
-
this.style({borderLeft}, { target, maskVector });
|
|
1971
|
-
return this;
|
|
1972
|
-
}
|
|
1973
|
-
borderRadius(radius){
|
|
1974
|
-
radius=addSuffixeToNumber(radius,"px");
|
|
1975
|
-
this.style({ borderRadius: radius }, { target, maskVector });
|
|
1976
|
-
return this;
|
|
1977
|
-
}
|
|
1978
|
-
margin(margin){
|
|
1979
|
-
margin=addSuffixeToNumber(margin,"px");
|
|
1980
|
-
this.style({ margin }, { target, maskVector });
|
|
1981
|
-
return this;
|
|
1982
|
-
}
|
|
1983
|
-
marginTop(marginTop){
|
|
1984
|
-
marginTop=addSuffixeToNumber(marginTop,"px");
|
|
1985
|
-
this.style({marginTop});
|
|
1986
|
-
return this;
|
|
1987
|
-
}
|
|
1988
|
-
marginRight(marginRight){
|
|
1989
|
-
marginRight=addSuffixeToNumber(marginRight,"px");
|
|
1990
|
-
this.style({marginRight});
|
|
1991
|
-
return this;
|
|
1992
|
-
}
|
|
1993
|
-
marginBootom(marginBootom){
|
|
1994
|
-
marginBootom=addSuffixeToNumber(marginBootom,"px");
|
|
1995
|
-
this.style({marginBootom});
|
|
1996
|
-
return this;
|
|
1997
|
-
}
|
|
1998
|
-
marginLeft(marginLeft){
|
|
1999
|
-
marginLeft=addSuffixeToNumber(marginLeft,"px");
|
|
2000
|
-
this.style({marginLeft});
|
|
2001
|
-
return this;
|
|
2002
|
-
}
|
|
2003
|
-
padding(padding){
|
|
2004
|
-
padding=addSuffixeToNumber(padding,"px");
|
|
2005
|
-
this.style({padding});
|
|
2006
|
-
return this;
|
|
2007
|
-
}
|
|
2008
|
-
paddingTop(paddingTop){
|
|
2009
|
-
paddingTop=addSuffixeToNumber(paddingTop,"px");
|
|
2010
|
-
this.style({paddingTop});
|
|
2011
|
-
return this;
|
|
2012
|
-
}
|
|
2013
|
-
paddingRight(paddingRight){
|
|
2014
|
-
paddingRight=addSuffixeToNumber(paddingRight,"px");
|
|
2015
|
-
this.style({paddingRight});
|
|
2016
|
-
return this;
|
|
2017
|
-
}
|
|
2018
|
-
paddingBootom(paddingBootom){
|
|
2019
|
-
paddingBootom=addSuffixeToNumber(paddingBootom,"px");
|
|
2020
|
-
this.style({paddingBootom});
|
|
2021
|
-
return this;
|
|
2022
|
-
}
|
|
2023
|
-
paddingLeft(paddingLeft){
|
|
2024
|
-
paddingLeft=addSuffixeToNumber(paddingLeft,"px");
|
|
2025
|
-
this.style({paddingLeft});
|
|
2026
|
-
return this;
|
|
2027
|
-
}
|
|
2028
|
-
// Typographie
|
|
2029
|
-
font(font){
|
|
2030
|
-
this.style({font});
|
|
2031
|
-
return this;
|
|
2032
|
-
}
|
|
2033
|
-
fontFamily(fontFamily=""){
|
|
2034
|
-
this.style({fontFamily});
|
|
2035
|
-
return this;
|
|
2036
|
-
}
|
|
2037
|
-
fontSize(fontSize){
|
|
2038
|
-
this.style({fontSize});
|
|
2039
|
-
return this;
|
|
2040
|
-
}
|
|
2041
|
-
// Misc
|
|
2042
|
-
cursor(type="pointer"){
|
|
2043
|
-
this.style({ cursor: type });
|
|
2044
|
-
return this;
|
|
2045
|
-
}
|
|
2046
|
-
overflow(x,y){
|
|
2047
|
-
const values=["hidden","auto"];
|
|
2048
|
-
this.style({
|
|
2049
|
-
overflowX:typeof x==="number"?values[x]:x,
|
|
2050
|
-
overflowY:typeof y==="number"?values[y]:y
|
|
2051
|
-
},{target,maskVector});
|
|
2052
|
-
return this;
|
|
2053
|
-
}
|
|
2054
|
-
clip(polygon, { target, maskVector } = {}) {
|
|
2055
|
-
if (typeof polygon === "string") polygon = "polygon(" + polygon + ")";
|
|
2056
|
-
this.style({ clipPath: polygon }, { target, maskVector });
|
|
2057
|
-
return this;
|
|
2058
|
-
}
|
|
2059
|
-
// Transfromations
|
|
2060
|
-
fadeOut(transitionTimming = 1) {
|
|
2061
|
-
this.style({
|
|
2062
|
-
transition:`opacity ${transitionTimming/1000}s`,
|
|
2063
|
-
opacity: 0
|
|
2064
|
-
});
|
|
2065
|
-
this.cache.isFaddedOut=true;
|
|
2066
|
-
return this;
|
|
2067
|
-
}
|
|
2068
|
-
fadeIn(transitionTimming = 1) {
|
|
2069
|
-
this.style({
|
|
2070
|
-
transition: `opacity ${transitionTimming/1000}s`,
|
|
2071
|
-
opacity: 1
|
|
2072
|
-
});
|
|
2073
|
-
this.cache.isFaddedOut=false;
|
|
2074
|
-
return this;
|
|
2075
|
-
}
|
|
2076
|
-
toggleFade(t_in = 1000,t_out=t_in){
|
|
2077
|
-
this.cache.isFaddedOut?this.fadeIn(t_in):this.fadeOut(t_out);
|
|
2078
|
-
return this;
|
|
2079
|
-
}
|
|
2080
|
-
morphBorderRadius(newValue, transitionTimming){
|
|
2081
|
-
this.style({
|
|
2082
|
-
borderRadius: newValue,
|
|
2083
|
-
transition: `borderRadius ${transitionTimming/1000}s`,
|
|
2084
|
-
});
|
|
2085
|
-
return this;
|
|
2086
|
-
}
|
|
2087
|
-
#applyTransformMatrix(transitionTimming){
|
|
2088
|
-
const transformMatrix = this.cache.transformation.matrix.arr.join(",");
|
|
2089
|
-
this.style({
|
|
2090
|
-
transform: `matrix3d(${transformMatrix})`,
|
|
2091
|
-
"-webkit-transform": `matrix3d(${transformMatrix})`,
|
|
2092
|
-
"-moz-transform": `matrix3d(${transformMatrix})`,
|
|
2093
|
-
"-ms-transform": `matrix3d(${transformMatrix})`,
|
|
2094
|
-
"-o-transform": `matrix3d(${transformMatrix})`
|
|
2095
|
-
});
|
|
2096
|
-
if (transitionTimming != 0) this.style({ transition: `transform ${transitionTimming/1000}s ease` });
|
|
2097
|
-
}
|
|
2098
|
-
translate(dx, dy = dx ,dz = 0, transitionTimming = 0) {
|
|
2099
|
-
this.cache.transformation.matrix.set(3,0,dx);
|
|
2100
|
-
this.cache.transformation.matrix.set(3,1,dy);
|
|
2101
|
-
this.cache.transformation.matrix.set(3,2,dz);
|
|
2102
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
2103
|
-
return this;
|
|
2104
|
-
}
|
|
2105
|
-
translateX(dx, transitionTimming = 0) {
|
|
2106
|
-
this.cache.transformation.matrix.set(3,0,dx);
|
|
2107
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
2108
|
-
return this;
|
|
2109
|
-
}
|
|
2110
|
-
translateY(dy, transitionTimming = 0) {
|
|
2111
|
-
this.cache.transformation.matrix.set(3,1,dy);
|
|
2112
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
2113
|
-
return this;
|
|
2114
|
-
}
|
|
2115
|
-
translateZ(dz, transitionTimming = 0) {
|
|
2116
|
-
const d=-1/this.cache.transformation.matrix[2][2];
|
|
2117
|
-
this.cache.transformation.matrix.set(3,2,z);
|
|
2118
|
-
this.cache.transformation.matrix.set(3,3,1-(dz/d));
|
|
2119
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
2120
|
-
return this;
|
|
2121
|
-
}
|
|
2122
|
-
perspective(distance,transitionTimming=0){
|
|
2123
|
-
const z=this.cache.transformation.matrix[3][2];
|
|
2124
|
-
this.cache.transformation.matrix.set(2,2,-1/d);
|
|
2125
|
-
this.cache.transformation.matrix.set(3,3,1-(z/distance));
|
|
2126
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
2127
|
-
return this;
|
|
2128
|
-
}
|
|
2129
|
-
scale(sx, sy = sx, transitionTimming = 0) {
|
|
2130
|
-
this.cache.transformation.matrix.set(0,0,sx);
|
|
2131
|
-
this.cache.transformation.matrix.set(1,1,sy);
|
|
2132
|
-
// const transformMatrix = this.cache.transformation.matrix.arr.join(",");
|
|
2133
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
2134
|
-
return this;
|
|
2135
|
-
}
|
|
2136
|
-
scaleX(x = 1 , transitionTimming = 0) {
|
|
2137
|
-
this.cache.transformation.matrix.set(0,0,x);
|
|
2138
|
-
// const transformMatrix = this.cache.transformation.matrix.arr.join(",");
|
|
2139
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
2140
|
-
return this;
|
|
2141
|
-
}
|
|
2142
|
-
scaleY(y = 1, transitionTimming = 0) {
|
|
2143
|
-
this.cache.transformation.matrix.set(1,1,y);
|
|
2144
|
-
this.cache.transformation.matrix.arr.join(",");
|
|
2145
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
2146
|
-
return this;
|
|
2147
|
-
}
|
|
2148
|
-
skew(x, y = x, transitionTimming = 0) {
|
|
2149
|
-
this.cache.transformation.matrix.set(0,1,x);
|
|
2150
|
-
this.cache.transformation.matrix.set(1,0,y);
|
|
2151
|
-
this.cache.transformation.matrix.arr.join(",");
|
|
2152
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
2153
|
-
return this;
|
|
2154
|
-
}
|
|
2155
|
-
skewX(x = 1 , transitionTimming = 0) {
|
|
2156
|
-
this.cache.transformation.matrix.set(0,1,x);
|
|
2157
|
-
this.cache.transformation.matrix.arr.join(",");
|
|
2158
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
2159
|
-
return this;
|
|
2160
|
-
}
|
|
2161
|
-
skewY(y = 1, transitionTimming = 0) {
|
|
2162
|
-
this.cache.transformation.matrix.set(1,0,y);
|
|
2163
|
-
this.cache.transformation.matrix.arr.join(",");
|
|
2164
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
2165
|
-
return this;
|
|
2166
|
-
}
|
|
2167
|
-
rotateX(rx, transitionTimming = 0) {
|
|
2168
|
-
this.cache.transformation.matrix.set(1,1,cos(rx));
|
|
2169
|
-
this.cache.transformation.matrix.set(1,2,-sin(rx));
|
|
2170
|
-
this.cache.transformation.matrix.set(2,1,sin(rx));
|
|
2171
|
-
this.cache.transformation.matrix.set(1,2,cos(rx));
|
|
2172
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
2173
|
-
return this;
|
|
2174
|
-
}
|
|
2175
|
-
rotateY(ry, transitionTimming = 0) {
|
|
2176
|
-
this.cache.transformation.matrix.set(0,0,cos(ry));
|
|
2177
|
-
this.cache.transformation.matrix.set(0,2,sin(ry));
|
|
2178
|
-
this.cache.transformation.matrix.set(2,0,-sin(ry));
|
|
2179
|
-
this.cache.transformation.matrix.set(2,2,cos(ry));
|
|
2180
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
2181
|
-
return this;
|
|
2182
|
-
}
|
|
2183
|
-
rotateZ(rz, transitionTimming = 0) {
|
|
2184
|
-
this.cache.transformation.matrix.set(0,0,cos(rz));
|
|
2185
|
-
this.cache.transformation.matrix.set(0,1,-sin(rz));
|
|
2186
|
-
this.cache.transformation.matrix.set(1,0,sin(rz));
|
|
2187
|
-
this.cache.transformation.matrix.set(1,1,cos(rz));
|
|
2188
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
2189
|
-
return this;
|
|
2190
|
-
}
|
|
2191
|
-
flipeX(transitionTimming = 1) {
|
|
2192
|
-
this.cache.transformation.Flip[0] += 180;
|
|
2193
|
-
this.cache.transformation.Flip[0] %= 360;
|
|
2194
|
-
this.rotateX(this.cache.transformation.Flip[0], transitionTimming);
|
|
2195
|
-
return this;
|
|
2196
|
-
}
|
|
2197
|
-
flipeY(transitionTimming = 1) {
|
|
2198
|
-
this.cache.transformation.Flip[1] += 180 ;
|
|
2199
|
-
this.cache.transformation.Flip[1] %= 360;
|
|
2200
|
-
this.rotateY(this.cache.transformation.Flip[1], transitionTimming);
|
|
2201
|
-
return this;
|
|
2202
|
-
}
|
|
2203
|
-
flipeZ(transitionTimming = 1) {
|
|
2204
|
-
this.cache.transformation.Flip[2] += 180;
|
|
2205
|
-
this.cache.transformation.Flip[2] %= 360;
|
|
2206
|
-
this.rotateZ(this.cache.transformation.Flip[2], transitionTimming);
|
|
2207
|
-
return this;
|
|
2208
|
-
}
|
|
2209
|
-
slideHeightIn(transitionTimming = 1, h = this.h) {
|
|
2210
|
-
this.style({ transition: transitionTimming + "s", height: h });
|
|
2211
|
-
return this;
|
|
2212
|
-
}
|
|
2213
|
-
slideHeightOut(transitionTimming = 1) {
|
|
2214
|
-
this.style({ transition: transitionTimming + "s", height: 0 });
|
|
2215
|
-
this.target?.element?.n("transitionend", () =>
|
|
2216
|
-
this.style({ opacity: "none" }),
|
|
2217
|
-
);
|
|
2218
|
-
return this;
|
|
2219
|
-
}
|
|
2220
|
-
slideWidthIn(transitionTimming = 1, w = this.w) {
|
|
2221
|
-
this.style({ transition: transitionTimming + "s", width: w });
|
|
2222
|
-
return this;
|
|
2223
|
-
}
|
|
2224
|
-
slideWidthOut(transitionTimming = 1) {
|
|
2225
|
-
this.style({ transition: transitionTimming + "s", width: 0 });
|
|
2226
|
-
const wrapper=()=>{
|
|
2227
|
-
this.style({ opacity: "none" });
|
|
2228
|
-
};
|
|
2229
|
-
this.target?.element?.addEventListener("transitionend",wrapper);
|
|
2230
|
-
this.target?.element?.removeEventListener("transitionend",wrapper);
|
|
2231
|
-
return this;
|
|
2232
|
-
}
|
|
2233
|
-
slideIn({ transitionTimming = 1, w = "100%", h = "auto" } = {}) {
|
|
2234
|
-
this.style({
|
|
2235
|
-
transition: transitionTimming + "s",
|
|
2236
|
-
width: w,
|
|
2237
|
-
height: h,
|
|
2238
|
-
visibility: "visible",
|
|
2239
|
-
});
|
|
2240
|
-
return this;
|
|
2241
|
-
}
|
|
2242
|
-
slideOut({ transitionTimming = 1, width = 0, heightransitionTimming = 0 } = {}) {
|
|
2243
|
-
this.style({
|
|
2244
|
-
visibility: "hidden",
|
|
2245
|
-
transition: transitionTimming + "s",
|
|
2246
|
-
opacity: "none",
|
|
2247
|
-
width: width,
|
|
2248
|
-
height: height,
|
|
2249
|
-
});
|
|
2250
|
-
const wrapper=()=>{
|
|
2251
|
-
this.style({ opacity: "none" });
|
|
2252
|
-
};
|
|
2253
|
-
this.target?.element?.addEventListener("transitionend",wrapper);
|
|
2254
|
-
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});
|
|
2255
1708
|
return this;
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
}
|
|
1709
|
+
}
|
|
1710
|
+
};
|
|
2259
1711
|
|
|
2260
1712
|
function EVENT_CONTROLLER(e,EVENT,setter,push_object){
|
|
2261
1713
|
this.event=e;
|
|
@@ -3282,43 +2734,42 @@ const __CACHE__ = {
|
|
|
3282
2734
|
}
|
|
3283
2735
|
};
|
|
3284
2736
|
|
|
3285
|
-
|
|
3286
|
-
globalThis
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
2737
|
+
function __init__global__(){
|
|
2738
|
+
if ( !globalThis?.__Ziko__ ){
|
|
2739
|
+
globalThis.__Ziko__ = {
|
|
2740
|
+
__UI__,
|
|
2741
|
+
__HYDRATION__,
|
|
2742
|
+
__HYDRATION_MAP__,
|
|
2743
|
+
__Config__,
|
|
2744
|
+
__CACHE__,
|
|
2745
|
+
};
|
|
2746
|
+
defineParamsGetter$1(__Ziko__);
|
|
2747
|
+
}
|
|
3294
2748
|
}
|
|
3295
2749
|
|
|
3296
|
-
|
|
3297
|
-
|
|
2750
|
+
__init__global__();
|
|
2751
|
+
class UIElement extends UINode{
|
|
2752
|
+
constructor({element, name ='', type="html", useDefaultStyle=false}={}){
|
|
3298
2753
|
super();
|
|
3299
2754
|
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
|
|
3300
2755
|
if(typeof element === "string") {
|
|
3301
|
-
switch(
|
|
2756
|
+
switch(type){
|
|
3302
2757
|
case "html" : element = globalThis?.document?.createElement(element); break;
|
|
3303
2758
|
case "svg" : element = globalThis?.document?.createElementNS("http://www.w3.org/2000/svg", element);
|
|
3304
2759
|
default : throw Error("Not supported")
|
|
3305
2760
|
}
|
|
3306
2761
|
}
|
|
3307
2762
|
else {
|
|
3308
|
-
this.target = element
|
|
2763
|
+
this.target = element?.parentElement;
|
|
3309
2764
|
}
|
|
3310
|
-
|
|
3311
|
-
compose(
|
|
2765
|
+
register(
|
|
3312
2766
|
this,
|
|
3313
|
-
|
|
3314
|
-
|
|
2767
|
+
AttrsMethods,
|
|
2768
|
+
DomMethods,
|
|
2769
|
+
StyleMethods,
|
|
2770
|
+
IndexingMethods,
|
|
3315
2771
|
EventsMethodes
|
|
3316
2772
|
);
|
|
3317
|
-
// if(false){
|
|
3318
|
-
// import("../methods/tree.js").then(({ default: ExternalMethods }) => {
|
|
3319
|
-
// compose(this, ExternalMethods);
|
|
3320
|
-
// });
|
|
3321
|
-
// }
|
|
3322
2773
|
Object.assign(this.cache, {
|
|
3323
2774
|
name,
|
|
3324
2775
|
isInteractive : [true, false][Math.floor(2*Math.random())],
|
|
@@ -3328,7 +2779,6 @@ class ZikoUIElement extends ZikoUINode{
|
|
|
3328
2779
|
isHidden: false,
|
|
3329
2780
|
isFrozzen:false,
|
|
3330
2781
|
legacyParent : null,
|
|
3331
|
-
style: new ZikoUIElementStyle({}),
|
|
3332
2782
|
attributes: {},
|
|
3333
2783
|
filters: {},
|
|
3334
2784
|
temp:{}
|
|
@@ -3353,7 +2803,6 @@ class ZikoUIElement extends ZikoUINode{
|
|
|
3353
2803
|
if(element)Object.assign(this.cache,{element});
|
|
3354
2804
|
this.uuid = `${this.cache.name}-${Random.string(16)}`;
|
|
3355
2805
|
this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
|
|
3356
|
-
this.cache.style.linkTo(this);
|
|
3357
2806
|
useDefaultStyle && this.style({
|
|
3358
2807
|
position: "relative",
|
|
3359
2808
|
boxSizing:"border-box",
|
|
@@ -3386,10 +2835,6 @@ class ZikoUIElement extends ZikoUINode{
|
|
|
3386
2835
|
isZikoUIElement(){
|
|
3387
2836
|
return true;
|
|
3388
2837
|
}
|
|
3389
|
-
register(){
|
|
3390
|
-
|
|
3391
|
-
return this;
|
|
3392
|
-
}
|
|
3393
2838
|
get st(){
|
|
3394
2839
|
return this.cache.style;
|
|
3395
2840
|
}
|
|
@@ -3439,25 +2884,17 @@ class ZikoUIElement extends ZikoUINode{
|
|
|
3439
2884
|
else UI.element=this.element.cloneNode(true);
|
|
3440
2885
|
return UI.render(render);
|
|
3441
2886
|
}
|
|
3442
|
-
style(styles){
|
|
3443
|
-
styles instanceof ZikoUseStyle ? this.st.style(styles.current): this.st.style(styles);
|
|
3444
|
-
return this;
|
|
3445
|
-
}
|
|
3446
|
-
size(width,height){
|
|
3447
|
-
this.st.size(width,height);
|
|
3448
|
-
return this;
|
|
3449
|
-
}
|
|
3450
2887
|
[Symbol.iterator]() {
|
|
3451
2888
|
return this.items[Symbol.iterator]();
|
|
3452
2889
|
}
|
|
3453
2890
|
maintain() {
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
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
|
+
});
|
|
3461
2898
|
}
|
|
3462
2899
|
}
|
|
3463
2900
|
freeze(freeze){
|
|
@@ -3475,43 +2912,6 @@ class ZikoUIElement extends ZikoUINode{
|
|
|
3475
2912
|
describe(label){
|
|
3476
2913
|
if(label)this.setAttr("aria-label",label);
|
|
3477
2914
|
}
|
|
3478
|
-
animate(keyframe, {duration=1000, iterations=1, easing="ease"}={}){
|
|
3479
|
-
this.element?.animate(keyframe,{duration, iterations, easing});
|
|
3480
|
-
return this;
|
|
3481
|
-
}
|
|
3482
|
-
// Attributes
|
|
3483
|
-
#setAttr(name, value){
|
|
3484
|
-
if(this.element?.tagName !== "svg") name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
|
|
3485
|
-
if(this?.attr[name] && this?.attr[name]===value) return;
|
|
3486
|
-
this.element?.setAttribute(name, value);
|
|
3487
|
-
Object.assign(this.cache.attributes, {[name]:value});
|
|
3488
|
-
}
|
|
3489
|
-
setAttr(name, value) {
|
|
3490
|
-
if(name instanceof Object){
|
|
3491
|
-
const [names,values]=[Object.keys(name),Object.values(name)];
|
|
3492
|
-
for(let i=0;i<names.length;i++){
|
|
3493
|
-
if(values[i] instanceof Array)value[i] = values[i].join(" ");
|
|
3494
|
-
this.#setAttr(names[i], values[i]);
|
|
3495
|
-
}
|
|
3496
|
-
}
|
|
3497
|
-
else {
|
|
3498
|
-
if(value instanceof Array)value = value.join(" ");
|
|
3499
|
-
this.#setAttr(name, value);
|
|
3500
|
-
}
|
|
3501
|
-
return this;
|
|
3502
|
-
}
|
|
3503
|
-
removeAttr(...names) {
|
|
3504
|
-
for(let i=0;i<names.length;i++)this.element?.removeAttribute(names[i]);
|
|
3505
|
-
return this;
|
|
3506
|
-
}
|
|
3507
|
-
getAttr(name){
|
|
3508
|
-
name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
|
|
3509
|
-
return this.element.attributes[name].value;
|
|
3510
|
-
}
|
|
3511
|
-
setContentEditable(bool = true) {
|
|
3512
|
-
this.setAttr("contenteditable", bool);
|
|
3513
|
-
return this;
|
|
3514
|
-
}
|
|
3515
2915
|
get children() {
|
|
3516
2916
|
return [...this.element.children];
|
|
3517
2917
|
}
|
|
@@ -3710,23 +3110,32 @@ const tags = new Proxy({}, {
|
|
|
3710
3110
|
get(target, prop) {
|
|
3711
3111
|
if (typeof prop !== 'string') return undefined;
|
|
3712
3112
|
let tag = prop.replaceAll("_","-").toLowerCase();
|
|
3113
|
+
let type ;
|
|
3114
|
+
if(HTMLTags.includes(tag)) type = 'html';
|
|
3115
|
+
if(SVGTags.includes(tag)) type = 'svg';
|
|
3713
3116
|
if(HTMLTags.includes(tag)) return (...args)=>{
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
//
|
|
3117
|
+
console.log(isStateGetter(args[0]));
|
|
3118
|
+
// if(typeof args[0] === 'function') {
|
|
3119
|
+
// console.log(args[0], args[0]?.() instanceof StateGetter)
|
|
3120
|
+
// globalThis.a = args[0]
|
|
3121
|
+
// console.log({t : a.constructor})
|
|
3122
|
+
// }
|
|
3123
|
+
if(
|
|
3124
|
+
['string', 'number'].includes(typeof args[0])
|
|
3125
|
+
|| args[0] instanceof UIElement
|
|
3126
|
+
|| (typeof args[0] === 'function' && args[0]().isStateGetter())
|
|
3127
|
+
) return new UIElement({element :tag, name : tag, type}).append(...args);
|
|
3128
|
+
return new UIElement({element : tag}).setAttr(args.shift()).append(...args)
|
|
3129
|
+
}
|
|
3130
|
+
// if(SVGTags.includes(tag)) return (...args) => new UIElement(tag,"",{el_type : "svg"}).append(...args);
|
|
3131
|
+
// return (...args)=>{
|
|
3132
|
+
// if(!(args[0] instanceof UIElement) && args[0] instanceof Object){
|
|
3133
|
+
// let attributes = args.shift()
|
|
3134
|
+
// return new UIElement(tag).setAttr(attributes).append(...args)
|
|
3135
|
+
// }
|
|
3136
|
+
// return new UIElement(tag).append(...args);
|
|
3137
|
+
// }
|
|
3138
|
+
// // switch(tag){
|
|
3730
3139
|
// case "html" : globalThis?.document?.createElement("html")
|
|
3731
3140
|
// case "head" :
|
|
3732
3141
|
// case "style" :
|
|
@@ -3734,14 +3143,14 @@ const tags = new Proxy({}, {
|
|
|
3734
3143
|
// case "meta" :
|
|
3735
3144
|
// case "srcipt":
|
|
3736
3145
|
// case "body" : return null; break;
|
|
3737
|
-
// default : return new
|
|
3146
|
+
// default : return new UIElement(tag);
|
|
3738
3147
|
// }
|
|
3739
3148
|
}
|
|
3740
3149
|
});
|
|
3741
3150
|
|
|
3742
|
-
class ZikoUIFlex extends
|
|
3151
|
+
class ZikoUIFlex extends UIElement {
|
|
3743
3152
|
constructor(tag = "div", w = "100%", h = "100%") {
|
|
3744
|
-
super(tag ,"Flex");
|
|
3153
|
+
super({element : tag , name : "Flex"});
|
|
3745
3154
|
this.direction = "cols";
|
|
3746
3155
|
if (typeof w == "number") w += "%";
|
|
3747
3156
|
if (typeof h == "number") h += "%";
|
|
@@ -3809,13 +3218,13 @@ class ZikoUIFlex extends ZikoUIElement {
|
|
|
3809
3218
|
}
|
|
3810
3219
|
}
|
|
3811
3220
|
|
|
3812
|
-
const Flex = (...
|
|
3221
|
+
const Flex = (...UIElement) =>{
|
|
3813
3222
|
let tag="div";
|
|
3814
|
-
if(typeof
|
|
3815
|
-
tag=
|
|
3816
|
-
|
|
3223
|
+
if(typeof UIElement[0]==="string"){
|
|
3224
|
+
tag=UIElement[0];
|
|
3225
|
+
UIElement.pop();
|
|
3817
3226
|
}
|
|
3818
|
-
return new ZikoUIFlex(tag).append(...
|
|
3227
|
+
return new ZikoUIFlex(tag).append(...UIElement);
|
|
3819
3228
|
};
|
|
3820
3229
|
function set_vertical(direction){
|
|
3821
3230
|
direction == 1
|
|
@@ -3838,9 +3247,9 @@ function map_pos_y(align){
|
|
|
3838
3247
|
return map_pos_x(-align);
|
|
3839
3248
|
}
|
|
3840
3249
|
|
|
3841
|
-
class ZikoUIGrid extends
|
|
3250
|
+
class ZikoUIGrid extends UIElement {
|
|
3842
3251
|
constructor(tag ="div", w = "50vw", h = "50vh") {
|
|
3843
|
-
super(tag,"Grid");
|
|
3252
|
+
super({element : tag, name : "Grid"});
|
|
3844
3253
|
this.direction = "cols";
|
|
3845
3254
|
if (typeof w == "number") w += "%";
|
|
3846
3255
|
if (typeof h == "number") h += "%";
|
|
@@ -3868,11 +3277,11 @@ class ZikoUIGrid extends ZikoUIElement {
|
|
|
3868
3277
|
return this;
|
|
3869
3278
|
}
|
|
3870
3279
|
}
|
|
3871
|
-
const Grid$1 = (...
|
|
3280
|
+
const Grid$1 = (...UIElement) => new ZikoUIGrid("div").append(...UIElement);
|
|
3872
3281
|
|
|
3873
|
-
class ZikoUISuspense extends
|
|
3282
|
+
class ZikoUISuspense extends UIElement{
|
|
3874
3283
|
constructor(fallback_ui, callback){
|
|
3875
|
-
super("div", "suspense");
|
|
3284
|
+
super({element : "div", name : "suspense"});
|
|
3876
3285
|
this.setAttr({
|
|
3877
3286
|
dataTemp : "suspense"
|
|
3878
3287
|
});
|
|
@@ -3894,9 +3303,9 @@ class ZikoUISuspense extends ZikoUIElement{
|
|
|
3894
3303
|
|
|
3895
3304
|
const Suspense = (fallback_ui, callback) => new ZikoUISuspense(fallback_ui, callback);
|
|
3896
3305
|
|
|
3897
|
-
class ZikoUIXMLWrapper extends
|
|
3306
|
+
class ZikoUIXMLWrapper extends UIElement{
|
|
3898
3307
|
constructor(XMLContent, type){
|
|
3899
|
-
super("div", "");
|
|
3308
|
+
super({element : "div", name : ""});
|
|
3900
3309
|
this.element.append(type==="svg"?svg2dom(XMLContent):html2dom(XMLContent));
|
|
3901
3310
|
}
|
|
3902
3311
|
}
|
|
@@ -3928,7 +3337,7 @@ class ZikoUISVGWrapper extends ZikoUIXMLWrapper{
|
|
|
3928
3337
|
const HTMLWrapper = (HTMLContent) => new ZikoUIHTMLWrapper(HTMLContent);
|
|
3929
3338
|
const SVGWrapper = (SVGContent) => new ZikoUISVGWrapper(SVGContent);
|
|
3930
3339
|
|
|
3931
|
-
class ZikoUICanvas extends
|
|
3340
|
+
class ZikoUICanvas extends UIElement{
|
|
3932
3341
|
constructor(w,h){
|
|
3933
3342
|
super("canvas","canvas");
|
|
3934
3343
|
this.ctx = this.element?.getContext("2d");
|
|
@@ -4098,7 +3507,7 @@ class ZikoUICanvas extends ZikoUIElement{
|
|
|
4098
3507
|
|
|
4099
3508
|
const Canvas=(w,h)=>new ZikoUICanvas(w,h);
|
|
4100
3509
|
|
|
4101
|
-
class ZikoUISvg extends
|
|
3510
|
+
class ZikoUISvg extends UIElement {
|
|
4102
3511
|
constructor(w=360,h=300) {
|
|
4103
3512
|
super("svg","svg");
|
|
4104
3513
|
//this.cache={};
|
|
@@ -5798,8 +5207,7 @@ class ZikoTimeAnimation{
|
|
|
5798
5207
|
const useAnimation=(callback,ease=Ease.Linear,step=50,config)=>new ZikoTimeAnimation(callback,ease=Ease.Linear,step=50,config);
|
|
5799
5208
|
|
|
5800
5209
|
const debounce=(fn,delay=1000)=>{
|
|
5801
|
-
|
|
5802
|
-
return (...args) => id ? clearTimeout(id) : setTimeout(()=>fn(...args),delay);
|
|
5210
|
+
return (...args) => setTimeout(()=>fn(...args),delay);
|
|
5803
5211
|
};
|
|
5804
5212
|
const throttle=(fn,delay)=>{
|
|
5805
5213
|
let lastTime=0;
|
|
@@ -6264,4 +5672,4 @@ if(globalThis?.document){
|
|
|
6264
5672
|
document?.addEventListener("DOMContentLoaded", __Ziko__.__Config__.init());
|
|
6265
5673
|
}
|
|
6266
5674
|
|
|
6267
|
-
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,
|
|
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 };
|