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