ziko 0.0.16 → 0.0.18
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 +479 -1901
- package/dist/ziko.js +7648 -8185
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +7614 -8182
- package/package.json +1 -1
- package/readme.md +137 -0
- package/src/app/spa-file-based-routing.js +0 -1
- package/src/data/datatypes/color.js +11 -0
- package/src/graphics/canvas/canvas.js +13 -26
- package/src/graphics/canvas/elements/{Basic → basic}/arc.js +1 -1
- package/src/graphics/canvas/elements/{Basic → basic}/line.js +1 -1
- package/src/graphics/canvas/elements/{Basic → basic}/points.js +1 -1
- package/src/graphics/canvas/elements/{Basic → basic}/rect.js +1 -1
- package/src/graphics/canvas/elements/index.js +4 -4
- package/src/graphics/canvas/index.js +2 -15
- package/src/graphics/index.js +9 -68
- package/src/graphics/svg/{Elements/Basic → elements/basic}/circle.js +5 -2
- package/src/graphics/svg/{Elements/Basic → elements/basic}/ellipse.js +5 -2
- package/src/graphics/svg/{Elements/Basic/foreignObject.js → elements/basic/foreign-object.js} +7 -4
- package/src/graphics/svg/{Elements/Basic → elements/basic}/groupe.js +5 -2
- package/src/graphics/svg/{Elements/Basic → elements/basic}/image.js +5 -2
- package/src/graphics/svg/elements/basic/index.js +11 -0
- package/src/graphics/svg/{Elements/Basic → elements/basic}/line.js +5 -2
- package/src/graphics/svg/{Elements/Basic → elements/basic}/link.js +5 -2
- package/src/graphics/svg/{Elements/Basic → elements/basic}/path.js +5 -2
- package/src/graphics/svg/{Elements/Basic → elements/basic}/polygon.js +1 -1
- package/src/graphics/svg/{Elements/Basic → elements/basic}/polyline.js +4 -1
- package/src/graphics/svg/{Elements/Basic → elements/basic}/rect.js +5 -2
- package/src/graphics/svg/{Elements/Basic → elements/basic}/text.js +5 -2
- package/src/graphics/svg/{Elements/Derived → elements/derived}/grid.js +1 -1
- package/src/graphics/svg/elements/derived/index.js +1 -0
- package/src/graphics/svg/elements/index.js +2 -0
- package/src/graphics/svg/{Elements/ZikoSvgElement.js → elements/ziko-svg-element.js} +5 -3
- package/src/graphics/svg/index.js +1 -1
- package/src/graphics/svg/svg.js +19 -65
- package/src/index.js +2 -1
- package/src/reactivity/events/index.js +12 -63
- package/src/reactivity/hooks/index.js +8 -91
- package/src/reactivity/hooks/ui/index.js +2 -1
- package/src/reactivity/hooks/ui/useRoot.js +39 -0
- package/src/reactivity/index.js +2 -2
- package/src/ui/elements/primitives/ZikoUIContainerElement.js +155 -118
- package/src/ui/elements/primitives/ZikoUIElement.js +3 -3
- package/src/ui/elements/primitives/misc/xml-wrapper.js +3 -2
- package/src/ui/index.js +10 -1
- package/README.md +0 -246
- package/src/graphics/canvas/elements/Groupe.js +0 -0
- package/src/graphics/canvas/elements/grid.js +0 -0
- package/src/graphics/canvas/filter/index.js +0 -0
- package/src/graphics/canvas/paint/index.js +0 -0
- package/src/graphics/svg/Elements/index.js +0 -14
- /package/src/graphics/canvas/elements/{Basic → basic}/image.js +0 -0
- /package/src/graphics/canvas/elements/{Basic → basic}/path.js +0 -0
- /package/src/graphics/canvas/elements/{Basic → basic}/polygon.js +0 -0
- /package/src/graphics/canvas/elements/{Basic → basic}/polyline.js +0 -0
- /package/src/graphics/canvas/elements/{Basic → basic}/text.js +0 -0
- /package/src/graphics/canvas/elements/{Chart → chart}/histogram.js +0 -0
- /package/src/graphics/canvas/elements/{Chart → chart}/plot.js +0 -0
- /package/src/graphics/canvas/elements/{Chart → chart}/scatter.js +0 -0
- /package/src/graphics/canvas/elements/{Chart → chart}/stem.js +0 -0
- /package/src/graphics/canvas/elements/{Element.js → element.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 : Sat Oct 19 2024 15:07:57 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
|
|
@@ -1511,13 +1511,13 @@ class ZikoUseStyle {
|
|
|
1511
1511
|
|
|
1512
1512
|
const useStyle = (styles, use, id) => new ZikoUseStyle(styles, use, id);
|
|
1513
1513
|
|
|
1514
|
-
const addSuffixeToNumber
|
|
1514
|
+
const addSuffixeToNumber=(value,suffixe="px")=>{
|
|
1515
1515
|
if(typeof value === "number") value+=suffixe;
|
|
1516
1516
|
if(value instanceof Array)value=value.map(n=>typeof n==="number"?n+=suffixe:n).join(" ");
|
|
1517
1517
|
return value;
|
|
1518
1518
|
};
|
|
1519
1519
|
|
|
1520
|
-
|
|
1520
|
+
class ZikoUIElementStyle{
|
|
1521
1521
|
constructor(defaultStyle={}){
|
|
1522
1522
|
this.target=null;
|
|
1523
1523
|
this.styles=new Map(
|
|
@@ -1617,13 +1617,13 @@ let ZikoUIElementStyle$1 = class ZikoUIElementStyle{
|
|
|
1617
1617
|
if("min" in w || "max" in w){
|
|
1618
1618
|
let min= w.min ?? w.max;
|
|
1619
1619
|
let max= w.max ?? w.min;
|
|
1620
|
-
min=addSuffixeToNumber
|
|
1621
|
-
max=addSuffixeToNumber
|
|
1620
|
+
min=addSuffixeToNumber(min,"px");
|
|
1621
|
+
max=addSuffixeToNumber(max,"px");
|
|
1622
1622
|
this.style({ minWidth: min, maxWidth: max }, { target, maskVector });
|
|
1623
1623
|
}
|
|
1624
1624
|
}
|
|
1625
1625
|
else {
|
|
1626
|
-
w=addSuffixeToNumber
|
|
1626
|
+
w=addSuffixeToNumber(w,"px");
|
|
1627
1627
|
this.style({width:w},{ target, maskVector });
|
|
1628
1628
|
}
|
|
1629
1629
|
return this
|
|
@@ -1634,13 +1634,13 @@ let ZikoUIElementStyle$1 = class ZikoUIElementStyle{
|
|
|
1634
1634
|
if("min" in h || "max" in h){
|
|
1635
1635
|
let min= h.min ?? h.max;
|
|
1636
1636
|
let max= h.max ?? h.min;
|
|
1637
|
-
min=addSuffixeToNumber
|
|
1638
|
-
max=addSuffixeToNumber
|
|
1637
|
+
min=addSuffixeToNumber(min,"px");
|
|
1638
|
+
max=addSuffixeToNumber(max,"px");
|
|
1639
1639
|
this.style({ minHeight: min, maxHeight: max }, { target, maskVector });
|
|
1640
1640
|
}
|
|
1641
1641
|
}
|
|
1642
1642
|
else {
|
|
1643
|
-
h=addSuffixeToNumber
|
|
1643
|
+
h=addSuffixeToNumber(h,"px");
|
|
1644
1644
|
this.style({height:h},{ target, maskVector });
|
|
1645
1645
|
}
|
|
1646
1646
|
return this
|
|
@@ -1741,57 +1741,57 @@ let ZikoUIElementStyle$1 = class ZikoUIElementStyle{
|
|
|
1741
1741
|
return this;
|
|
1742
1742
|
}
|
|
1743
1743
|
borderRadius(radius,{ target, maskVector } = {}){
|
|
1744
|
-
radius=addSuffixeToNumber
|
|
1744
|
+
radius=addSuffixeToNumber(radius,"px");
|
|
1745
1745
|
this.style({ borderRadius: radius }, { target, maskVector });
|
|
1746
1746
|
return this;
|
|
1747
1747
|
}
|
|
1748
1748
|
margin(margin,{ target, maskVector } = {}){
|
|
1749
|
-
margin=addSuffixeToNumber
|
|
1749
|
+
margin=addSuffixeToNumber(margin,"px");
|
|
1750
1750
|
this.style({ margin }, { target, maskVector });
|
|
1751
1751
|
return this;
|
|
1752
1752
|
}
|
|
1753
1753
|
marginTop(marginTop,{ target, maskVector } = {}){
|
|
1754
|
-
marginTop=addSuffixeToNumber
|
|
1754
|
+
marginTop=addSuffixeToNumber(marginTop,"px");
|
|
1755
1755
|
this.style({marginTop},{ target, maskVector });
|
|
1756
1756
|
return this;
|
|
1757
1757
|
}
|
|
1758
1758
|
marginRight(marginRight,{ target, maskVector } = {}){
|
|
1759
|
-
marginRight=addSuffixeToNumber
|
|
1759
|
+
marginRight=addSuffixeToNumber(marginRight,"px");
|
|
1760
1760
|
this.style({marginRight},{ target, maskVector });
|
|
1761
1761
|
return this;
|
|
1762
1762
|
}
|
|
1763
1763
|
marginBootom(marginBootom,{ target, maskVector } = {}){
|
|
1764
|
-
marginBootom=addSuffixeToNumber
|
|
1764
|
+
marginBootom=addSuffixeToNumber(marginBootom,"px");
|
|
1765
1765
|
this.style({marginBootom},{ target, maskVector });
|
|
1766
1766
|
return this;
|
|
1767
1767
|
}
|
|
1768
1768
|
marginLeft(marginLeft,{ target, maskVector } = {}){
|
|
1769
|
-
marginLeft=addSuffixeToNumber
|
|
1769
|
+
marginLeft=addSuffixeToNumber(marginLeft,"px");
|
|
1770
1770
|
this.style({marginLeft},{ target, maskVector });
|
|
1771
1771
|
return this;
|
|
1772
1772
|
}
|
|
1773
1773
|
padding(padding,{ target, maskVector } = {}){
|
|
1774
|
-
padding=addSuffixeToNumber
|
|
1774
|
+
padding=addSuffixeToNumber(padding,"px");
|
|
1775
1775
|
this.style({padding},{ target, maskVector });
|
|
1776
1776
|
return this;
|
|
1777
1777
|
}
|
|
1778
1778
|
paddingTop(paddingTop,{ target, maskVector } = {}){
|
|
1779
|
-
paddingTop=addSuffixeToNumber
|
|
1779
|
+
paddingTop=addSuffixeToNumber(paddingTop,"px");
|
|
1780
1780
|
this.style({paddingTop},{ target, maskVector });
|
|
1781
1781
|
return this;
|
|
1782
1782
|
}
|
|
1783
1783
|
paddingRight(paddingRight,{ target, maskVector } = {}){
|
|
1784
|
-
paddingRight=addSuffixeToNumber
|
|
1784
|
+
paddingRight=addSuffixeToNumber(paddingRight,"px");
|
|
1785
1785
|
this.style({paddingRight},{ target, maskVector });
|
|
1786
1786
|
return this;
|
|
1787
1787
|
}
|
|
1788
1788
|
paddingBootom(paddingBootom,{ target, maskVector } = {}){
|
|
1789
|
-
paddingBootom=addSuffixeToNumber
|
|
1789
|
+
paddingBootom=addSuffixeToNumber(paddingBootom,"px");
|
|
1790
1790
|
this.style({paddingBootom},{ target, maskVector });
|
|
1791
1791
|
return this;
|
|
1792
1792
|
}
|
|
1793
1793
|
paddingLeft(paddingLeft,{ target, maskVector } = {}){
|
|
1794
|
-
paddingLeft=addSuffixeToNumber
|
|
1794
|
+
paddingLeft=addSuffixeToNumber(paddingLeft,"px");
|
|
1795
1795
|
this.style({paddingLeft},{ target, maskVector });
|
|
1796
1796
|
return this;
|
|
1797
1797
|
}
|
|
@@ -2025,7 +2025,7 @@ let ZikoUIElementStyle$1 = class ZikoUIElementStyle{
|
|
|
2025
2025
|
return this;
|
|
2026
2026
|
}
|
|
2027
2027
|
|
|
2028
|
-
}
|
|
2028
|
+
}
|
|
2029
2029
|
|
|
2030
2030
|
function EVENT_CONTROLLER(e,EVENT,setter,push_object){
|
|
2031
2031
|
this.event=e;
|
|
@@ -5832,7 +5832,7 @@ const Reactivity={
|
|
|
5832
5832
|
...Hooks,
|
|
5833
5833
|
};
|
|
5834
5834
|
|
|
5835
|
-
|
|
5835
|
+
class ZikoUIElement {
|
|
5836
5836
|
constructor(element ,name="") {
|
|
5837
5837
|
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
|
|
5838
5838
|
if(typeof element === "string") {
|
|
@@ -5848,7 +5848,7 @@ let ZikoUIElement$1 = class ZikoUIElement {
|
|
|
5848
5848
|
isHidden: false,
|
|
5849
5849
|
isFrozzen:false,
|
|
5850
5850
|
legacyParent : null,
|
|
5851
|
-
style: new ZikoUIElementStyle
|
|
5851
|
+
style: new ZikoUIElementStyle({}),
|
|
5852
5852
|
attributes: {},
|
|
5853
5853
|
filters: {},
|
|
5854
5854
|
temp:{}
|
|
@@ -6042,7 +6042,7 @@ let ZikoUIElement$1 = class ZikoUIElement {
|
|
|
6042
6042
|
}
|
|
6043
6043
|
// Attributes
|
|
6044
6044
|
#setAttr(name, value){
|
|
6045
|
-
name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
|
|
6045
|
+
if(this.element.tagName !== "svg") name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
|
|
6046
6046
|
if(this?.attr[name] && this?.attr[name]===value) return;
|
|
6047
6047
|
this.element.setAttribute(name, value);
|
|
6048
6048
|
Object.assign(this.cache.attributes, {[name]:value});
|
|
@@ -6299,9 +6299,9 @@ let ZikoUIElement$1 = class ZikoUIElement {
|
|
|
6299
6299
|
if(__ZikoPdf__);
|
|
6300
6300
|
return this;
|
|
6301
6301
|
}
|
|
6302
|
-
}
|
|
6302
|
+
}
|
|
6303
6303
|
|
|
6304
|
-
class ZikoUIContainerElement extends ZikoUIElement
|
|
6304
|
+
class ZikoUIContainerElement extends ZikoUIElement{
|
|
6305
6305
|
constructor(element, name=""){
|
|
6306
6306
|
super(element, name);
|
|
6307
6307
|
this.items = [];
|
|
@@ -6322,7 +6322,7 @@ class ZikoUIContainerElement extends ZikoUIElement$1{
|
|
|
6322
6322
|
}
|
|
6323
6323
|
for (let i = 0; i < ele.length; i++){
|
|
6324
6324
|
if(["number","string"].includes(typeof ele[i]))ele[i]=text$1(ele[i]);
|
|
6325
|
-
if (ele[i] instanceof ZikoUIElement
|
|
6325
|
+
if (ele[i] instanceof ZikoUIElement) {
|
|
6326
6326
|
ele[i].cache.parent=this;
|
|
6327
6327
|
this.element?.appendChild(ele[i].element);
|
|
6328
6328
|
ele[i].target = this.element;
|
|
@@ -6369,7 +6369,7 @@ class ZikoUIContainerElement extends ZikoUIElement$1{
|
|
|
6369
6369
|
remove(...ele) {
|
|
6370
6370
|
const remove = (ele) => {
|
|
6371
6371
|
if(typeof ele === "number") ele=this.items[ele];
|
|
6372
|
-
if(ele instanceof ZikoUIElement
|
|
6372
|
+
if(ele instanceof ZikoUIElement)this.element?.removeChild(ele.element);
|
|
6373
6373
|
this.items=this.items.filter(n=>n!==ele);
|
|
6374
6374
|
};
|
|
6375
6375
|
for (let i = 0; i < ele.length; i++) remove(ele[i]);
|
|
@@ -6449,7 +6449,7 @@ class __ZikoUIText__ extends ZikoUIContainerElement {
|
|
|
6449
6449
|
addValue(...value) {
|
|
6450
6450
|
value.forEach((item,i) => {
|
|
6451
6451
|
if (typeof item === "string" || typeof item === "number") this.element?.appendChild(globalThis?.document.createTextNode(item));
|
|
6452
|
-
else if (item instanceof ZikoUIElement
|
|
6452
|
+
else if (item instanceof ZikoUIElement) this.element?.appendChild(item.element);
|
|
6453
6453
|
else if (item instanceof Complex || item instanceof Matrix) this.element?.appendChild(new Text(item.toString()));
|
|
6454
6454
|
else if (item instanceof Array) this.element?.appendChild(new Text(arr2str(item)));
|
|
6455
6455
|
else if (item instanceof Object) this.element?.appendChild(new Text(obj2str(item)));
|
|
@@ -6559,7 +6559,7 @@ class ZikoUIBlockQuote extends __ZikoUIText__ {
|
|
|
6559
6559
|
const p = (...ZikoUIElement) => new ZikoUIParagraphe(...ZikoUIElement);
|
|
6560
6560
|
const blockQuote = (cite, quote) => new ZikoUIBlockQuote(cite, quote);
|
|
6561
6561
|
|
|
6562
|
-
class ZikoUIHeading extends ZikoUIElement
|
|
6562
|
+
class ZikoUIHeading extends ZikoUIElement {
|
|
6563
6563
|
constructor(type = 1, value = "") {
|
|
6564
6564
|
super(`h${type}`,`h${type}`);
|
|
6565
6565
|
this.element.textContent = value;
|
|
@@ -6637,7 +6637,7 @@ class ZikoUIList extends ZikoUIContainerElement {
|
|
|
6637
6637
|
for (let i = 0; i < arr.length; i++) {
|
|
6638
6638
|
let li = null;
|
|
6639
6639
|
if(["string","number"].includes(typeof arr[i]))arr[i]=text$1(arr[i]);
|
|
6640
|
-
if (arr[i] instanceof ZikoUIElement
|
|
6640
|
+
if (arr[i] instanceof ZikoUIElement)li=new ZikoUILI(arr[i]);
|
|
6641
6641
|
li.setTarget(this.element);
|
|
6642
6642
|
this.items.push(li[0]);
|
|
6643
6643
|
this.maintain();
|
|
@@ -6650,7 +6650,7 @@ class ZikoUIList extends ZikoUIContainerElement {
|
|
|
6650
6650
|
else {
|
|
6651
6651
|
const remove = (ele) => {
|
|
6652
6652
|
if(typeof ele === "number") ele=this.items[ele];
|
|
6653
|
-
if(ele instanceof ZikoUIElement
|
|
6653
|
+
if(ele instanceof ZikoUIElement)this.element?.removeChild(ele.parent.element);
|
|
6654
6654
|
this.items=this.items.filter(n=>n!==ele);
|
|
6655
6655
|
};
|
|
6656
6656
|
for (let i = 0; i < ele.length; i++) remove(ele[i]);
|
|
@@ -6665,7 +6665,7 @@ class ZikoUIList extends ZikoUIContainerElement {
|
|
|
6665
6665
|
for (let i = 0; i < ele.length; i++) {
|
|
6666
6666
|
let li = null;
|
|
6667
6667
|
if(["number","string"].includes(typeof ele[i]))ele[i]=text$1(ele[i]);
|
|
6668
|
-
if (ele[i] instanceof ZikoUIElement
|
|
6668
|
+
if (ele[i] instanceof ZikoUIElement)li=new ZikoUILI(ele[i]);
|
|
6669
6669
|
this.element?.insertBefore(li.element, this.items[index].parent.element);
|
|
6670
6670
|
this.items.splice(index, 0, ele[i][0]);
|
|
6671
6671
|
}
|
|
@@ -6757,7 +6757,7 @@ var List = /*#__PURE__*/Object.freeze({
|
|
|
6757
6757
|
ul: ul
|
|
6758
6758
|
});
|
|
6759
6759
|
|
|
6760
|
-
class ZikoUIInput extends ZikoUIElement
|
|
6760
|
+
class ZikoUIInput extends ZikoUIElement {
|
|
6761
6761
|
constructor(type, name , value = "", datalist) {
|
|
6762
6762
|
super("input", "input");
|
|
6763
6763
|
Object.assign(this.events, { input: null });
|
|
@@ -7062,7 +7062,7 @@ class ZikoUIInputDateTime extends ZikoUIInput {
|
|
|
7062
7062
|
}
|
|
7063
7063
|
const inputDateTime = () => new ZikoUIInputDateTime();
|
|
7064
7064
|
|
|
7065
|
-
class ZikoUIXMLWrapper extends ZikoUIElement
|
|
7065
|
+
class ZikoUIXMLWrapper extends ZikoUIElement{
|
|
7066
7066
|
constructor(XMLContent, type){
|
|
7067
7067
|
super("div", "");
|
|
7068
7068
|
this.element.append(type==="svg"?svg2dom(XMLContent):html2dom(XMLContent));
|
|
@@ -7075,7 +7075,7 @@ function html2dom(htmlString) {
|
|
|
7075
7075
|
}
|
|
7076
7076
|
function svg2dom(svgString) {
|
|
7077
7077
|
const parser = new DOMParser();
|
|
7078
|
-
const doc = parser.parseFromString(svgString, 'image/svg+xml');
|
|
7078
|
+
const doc = parser.parseFromString(svgString.replace(/\s+/g, ' ').trim(), 'image/svg+xml');
|
|
7079
7079
|
return doc.documentElement; // SVG elements are usually at the root
|
|
7080
7080
|
}
|
|
7081
7081
|
class ZikoUIHTMLWrapper extends ZikoUIXMLWrapper{
|
|
@@ -7089,14 +7089,14 @@ class ZikoUISVGWrapper extends ZikoUIXMLWrapper{
|
|
|
7089
7089
|
}
|
|
7090
7090
|
}
|
|
7091
7091
|
const HTMLWrapper = (HTMLContent) => new ZikoUIHTMLWrapper(HTMLContent);
|
|
7092
|
-
const SVGWrapper = (SVGContent) => new
|
|
7092
|
+
const SVGWrapper = (SVGContent) => new ZikoUISVGWrapper(SVGContent);
|
|
7093
7093
|
|
|
7094
7094
|
class ZikoUIHtmlTag extends ZikoUIContainerElement {
|
|
7095
7095
|
constructor(element) {
|
|
7096
7096
|
super(element,"html");
|
|
7097
7097
|
}
|
|
7098
7098
|
}
|
|
7099
|
-
class ZikoUIBtn extends ZikoUIElement
|
|
7099
|
+
class ZikoUIBtn extends ZikoUIElement {
|
|
7100
7100
|
constructor(value = "button") {
|
|
7101
7101
|
super("button","btn");
|
|
7102
7102
|
this.element = document?.createElement("button");
|
|
@@ -7108,7 +7108,7 @@ class ZikoUIBtn extends ZikoUIElement$1 {
|
|
|
7108
7108
|
return true
|
|
7109
7109
|
}
|
|
7110
7110
|
setValue(value) {
|
|
7111
|
-
if (value instanceof ZikoUIElement
|
|
7111
|
+
if (value instanceof ZikoUIElement) value.setTarget(this.element);
|
|
7112
7112
|
else {
|
|
7113
7113
|
this.element?.appendChild(document.createTextNode(""));
|
|
7114
7114
|
this.element.childNodes[0].data = value;
|
|
@@ -7127,7 +7127,7 @@ class ZikoUIBtn extends ZikoUIElement$1 {
|
|
|
7127
7127
|
return this;
|
|
7128
7128
|
}
|
|
7129
7129
|
}
|
|
7130
|
-
class ZikoUIBr extends ZikoUIElement
|
|
7130
|
+
class ZikoUIBr extends ZikoUIElement {
|
|
7131
7131
|
constructor() {
|
|
7132
7132
|
super("br","br");
|
|
7133
7133
|
}
|
|
@@ -7135,7 +7135,7 @@ class ZikoUIBr extends ZikoUIElement$1 {
|
|
|
7135
7135
|
return true
|
|
7136
7136
|
}
|
|
7137
7137
|
}
|
|
7138
|
-
class ZikoUIHr extends ZikoUIElement
|
|
7138
|
+
class ZikoUIHr extends ZikoUIElement {
|
|
7139
7139
|
constructor() {
|
|
7140
7140
|
super("hr","hr");
|
|
7141
7141
|
this.setAttr("role", "none");
|
|
@@ -7197,7 +7197,7 @@ var Misc = /*#__PURE__*/Object.freeze({
|
|
|
7197
7197
|
link: link
|
|
7198
7198
|
});
|
|
7199
7199
|
|
|
7200
|
-
class ZikoUIInputImage extends ZikoUIElement
|
|
7200
|
+
class ZikoUIInputImage extends ZikoUIElement {
|
|
7201
7201
|
constructor(text = "File") {
|
|
7202
7202
|
super("inputImage");
|
|
7203
7203
|
this._aux_element = btn(text).setTarget(this.target);
|
|
@@ -7235,7 +7235,7 @@ class ZikoUIInputImage extends ZikoUIElement$1 {
|
|
|
7235
7235
|
}
|
|
7236
7236
|
const inputImage = (text) => new ZikoUIInputImage(text);
|
|
7237
7237
|
|
|
7238
|
-
class ZikoUIImage extends ZikoUIElement
|
|
7238
|
+
class ZikoUIImage extends ZikoUIElement {
|
|
7239
7239
|
constructor(src,alt, w, h) {
|
|
7240
7240
|
super("img","image");
|
|
7241
7241
|
this.value=src;
|
|
@@ -7268,7 +7268,7 @@ class ZikoUIImage extends ZikoUIElement$1 {
|
|
|
7268
7268
|
}
|
|
7269
7269
|
const image = (src,alt, width, height) => new ZikoUIImage(src,alt, width, height);
|
|
7270
7270
|
|
|
7271
|
-
class ZikoUIFigure extends ZikoUIElement
|
|
7271
|
+
class ZikoUIFigure extends ZikoUIElement{
|
|
7272
7272
|
constructor(src,caption){
|
|
7273
7273
|
super("figure","figure");
|
|
7274
7274
|
this.img=src.width("100%").element;
|
|
@@ -7283,7 +7283,7 @@ class ZikoUIFigure extends ZikoUIElement$1{
|
|
|
7283
7283
|
}
|
|
7284
7284
|
const figure =(image,caption) =>new ZikoUIFigure(image,caption);
|
|
7285
7285
|
|
|
7286
|
-
class __ZikoUIDynamicMediaElement__ extends ZikoUIElement
|
|
7286
|
+
class __ZikoUIDynamicMediaElement__ extends ZikoUIElement {
|
|
7287
7287
|
constructor(element, name) {
|
|
7288
7288
|
super(element, name);
|
|
7289
7289
|
this.useControls();
|
|
@@ -7398,7 +7398,7 @@ class ZikoUIWebcame extends ZikoUIVideo{
|
|
|
7398
7398
|
}
|
|
7399
7399
|
const inputCamera=()=>new ZikoUIWebcame();
|
|
7400
7400
|
|
|
7401
|
-
class ZikoUILabel extends ZikoUIElement
|
|
7401
|
+
class ZikoUILabel extends ZikoUIElement{
|
|
7402
7402
|
constructor(){
|
|
7403
7403
|
super();
|
|
7404
7404
|
this.element=document?.createElement("label");
|
|
@@ -7407,7 +7407,7 @@ class ZikoUILabel extends ZikoUIElement$1{
|
|
|
7407
7407
|
return true;
|
|
7408
7408
|
}
|
|
7409
7409
|
}
|
|
7410
|
-
class ZikoUIInputOption extends ZikoUIElement
|
|
7410
|
+
class ZikoUIInputOption extends ZikoUIElement {
|
|
7411
7411
|
constructor(value = "") {
|
|
7412
7412
|
super();
|
|
7413
7413
|
this.element = document?.createElement("option");
|
|
@@ -7426,7 +7426,7 @@ class ZikoUIInputOption extends ZikoUIElement$1 {
|
|
|
7426
7426
|
return this;
|
|
7427
7427
|
}
|
|
7428
7428
|
}
|
|
7429
|
-
let ZikoUIInputDatalist$1 = class ZikoUIInputDatalist extends ZikoUIElement
|
|
7429
|
+
let ZikoUIInputDatalist$1 = class ZikoUIInputDatalist extends ZikoUIElement {
|
|
7430
7430
|
constructor(...options){
|
|
7431
7431
|
super();
|
|
7432
7432
|
this.element = document?.createElement("datalist");
|
|
@@ -7443,7 +7443,7 @@ let ZikoUIInputDatalist$1 = class ZikoUIInputDatalist extends ZikoUIElement$1 {
|
|
|
7443
7443
|
|
|
7444
7444
|
const datalist = (...options) => new ZikoUIInputDatalist$1(...options);
|
|
7445
7445
|
|
|
7446
|
-
class ZikoUISelect extends ZikoUIElement
|
|
7446
|
+
class ZikoUISelect extends ZikoUIElement {
|
|
7447
7447
|
constructor(){
|
|
7448
7448
|
super();
|
|
7449
7449
|
this.element=document?.createElement("select");
|
|
@@ -7458,7 +7458,7 @@ class ZikoUISelect extends ZikoUIElement$1 {
|
|
|
7458
7458
|
}
|
|
7459
7459
|
const select=()=>new ZikoUISelect();
|
|
7460
7460
|
|
|
7461
|
-
class ZikoUITextArea extends ZikoUIElement
|
|
7461
|
+
class ZikoUITextArea extends ZikoUIElement {
|
|
7462
7462
|
constructor() {
|
|
7463
7463
|
super();
|
|
7464
7464
|
this.element = document?.createElement("textarea");
|
|
@@ -7650,35 +7650,35 @@ var Io = /*#__PURE__*/Object.freeze({
|
|
|
7650
7650
|
textarea: textarea
|
|
7651
7651
|
});
|
|
7652
7652
|
|
|
7653
|
-
class ZikoUITr extends ZikoUIElement
|
|
7653
|
+
class ZikoUITr extends ZikoUIElement{
|
|
7654
7654
|
constructor(...ZikoUIElement){
|
|
7655
7655
|
super();
|
|
7656
7656
|
this.element=document?.createElement("Tr");
|
|
7657
7657
|
this.append(...ZikoUIElement);
|
|
7658
7658
|
}
|
|
7659
7659
|
}
|
|
7660
|
-
class ZikoUITd extends ZikoUIElement
|
|
7660
|
+
class ZikoUITd extends ZikoUIElement{
|
|
7661
7661
|
constructor(...ZikoUIElement){
|
|
7662
7662
|
super();
|
|
7663
7663
|
this.element=document?.createElement("Td");
|
|
7664
7664
|
this.append(...ZikoUIElement);
|
|
7665
7665
|
}
|
|
7666
7666
|
}
|
|
7667
|
-
class ZikoUIThead extends ZikoUIElement
|
|
7667
|
+
class ZikoUIThead extends ZikoUIElement{
|
|
7668
7668
|
constructor(...ZikoUITr){
|
|
7669
7669
|
super();
|
|
7670
7670
|
this.element=document?.createElement("Thead");
|
|
7671
7671
|
this.append(...ZikoUITr);
|
|
7672
7672
|
}
|
|
7673
7673
|
}
|
|
7674
|
-
class ZikoUITbody extends ZikoUIElement
|
|
7674
|
+
class ZikoUITbody extends ZikoUIElement{
|
|
7675
7675
|
constructor(...ZikoUITr){
|
|
7676
7676
|
super();
|
|
7677
7677
|
this.element=document?.createElement("Tbody");
|
|
7678
7678
|
this.append(...ZikoUITr);
|
|
7679
7679
|
}
|
|
7680
7680
|
}
|
|
7681
|
-
class ZikoUICaption extends ZikoUIElement
|
|
7681
|
+
class ZikoUICaption extends ZikoUIElement{
|
|
7682
7682
|
constructor(ZikoUIElement){
|
|
7683
7683
|
super();
|
|
7684
7684
|
this.element=document?.createElement("Caption");
|
|
@@ -7689,14 +7689,14 @@ class ZikoUICaption extends ZikoUIElement$1{
|
|
|
7689
7689
|
const tr=(...ZikoUIElement)=>new ZikoUITr(...ZikoUIElement);
|
|
7690
7690
|
const td=(...UI)=>{
|
|
7691
7691
|
UI=UI.map(n=>{
|
|
7692
|
-
if(!(n instanceof ZikoUIElement
|
|
7692
|
+
if(!(n instanceof ZikoUIElement))n=text$1(n);
|
|
7693
7693
|
return n
|
|
7694
7694
|
});
|
|
7695
7695
|
return new ZikoUITd(...UI)
|
|
7696
7696
|
};
|
|
7697
7697
|
const thead=(...ZikoUITd)=>{
|
|
7698
7698
|
ZikoUITd=ZikoUITd.map(n=>{
|
|
7699
|
-
if(!(n instanceof ZikoUIElement
|
|
7699
|
+
if(!(n instanceof ZikoUIElement))n=td(n);
|
|
7700
7700
|
return n
|
|
7701
7701
|
});
|
|
7702
7702
|
return new ZikoUIThead(...UI)
|
|
@@ -7716,7 +7716,7 @@ const MatrixToTableUI=matrix=>{
|
|
|
7716
7716
|
return Tr
|
|
7717
7717
|
};
|
|
7718
7718
|
|
|
7719
|
-
class ZikoUITable extends ZikoUIElement
|
|
7719
|
+
class ZikoUITable extends ZikoUIElement {
|
|
7720
7720
|
constructor(body,{caption=null,head=null,foot=null}={}){
|
|
7721
7721
|
super("table","Table");
|
|
7722
7722
|
this.structure={
|
|
@@ -7948,7 +7948,7 @@ class ZikoUIGrid extends ZikoUIContainerElement {
|
|
|
7948
7948
|
}
|
|
7949
7949
|
const Grid$1 = (...ZikoUIElement) => new ZikoUIGrid("div").append(...ZikoUIElement);
|
|
7950
7950
|
|
|
7951
|
-
class ZikoUICollapbsible extends ZikoUIElement
|
|
7951
|
+
class ZikoUICollapbsible extends ZikoUIElement{
|
|
7952
7952
|
constructor(summary,content,openIcon="😁", closeIcon=openIcon){
|
|
7953
7953
|
super("details","Collapsible");
|
|
7954
7954
|
Object.assign(this.cache,{
|
|
@@ -8814,7 +8814,7 @@ const infoAlert=(title, content)=>new ZikoUIAlert("info", title, content);
|
|
|
8814
8814
|
const warningAlert=(title, content)=>new ZikoUIAlert("warning", title, content);
|
|
8815
8815
|
const dangerAlert=(title, content)=>new ZikoUIAlert("danger", title, content);
|
|
8816
8816
|
|
|
8817
|
-
class __ZikoUISplitter__ extends ZikoUIElement
|
|
8817
|
+
class __ZikoUISplitter__ extends ZikoUIElement{
|
|
8818
8818
|
constructor(flexDirection, resizerCursor, resizerProp){
|
|
8819
8819
|
super("div", "Splitter");
|
|
8820
8820
|
Object.assign(this.cache,{
|
|
@@ -8829,7 +8829,7 @@ class __ZikoUISplitter__ extends ZikoUIElement$1{
|
|
|
8829
8829
|
border: "2px solid #333",
|
|
8830
8830
|
overflow: "hidden"
|
|
8831
8831
|
});
|
|
8832
|
-
this.resizer = new ZikoUIElement
|
|
8832
|
+
this.resizer = new ZikoUIElement("div", "resizer").style({
|
|
8833
8833
|
[this.cache.resizerProp]:"5px",
|
|
8834
8834
|
backgroundColor: "gold",
|
|
8835
8835
|
cursor: this.cache.resizerCursor,
|
|
@@ -8951,7 +8951,7 @@ const Splitter = ({orintation = "horizontal",slides = []}) =>{
|
|
|
8951
8951
|
else ;
|
|
8952
8952
|
};
|
|
8953
8953
|
|
|
8954
|
-
class ZikoUIBreadcrumbs extends ZikoUIElement
|
|
8954
|
+
class ZikoUIBreadcrumbs extends ZikoUIElement{
|
|
8955
8955
|
constructor(...items){
|
|
8956
8956
|
super("ul", "Breadcrumbs");
|
|
8957
8957
|
Object.assign(this.cache,{
|
|
@@ -9104,7 +9104,7 @@ class ZikoUIMenu3d extends ZikoUIFlex$1{
|
|
|
9104
9104
|
}
|
|
9105
9105
|
setupCover(){
|
|
9106
9106
|
if( this.cover ) this.cover.element.parentNode.removeChild( this.cover.element );
|
|
9107
|
-
this.cover=new ZikoUIElement
|
|
9107
|
+
this.cover=new ZikoUIElement("div","div").style({
|
|
9108
9108
|
position:"absolute",
|
|
9109
9109
|
display:"block",
|
|
9110
9110
|
width:"100%",
|
|
@@ -9547,7 +9547,9 @@ const UI$1 = {
|
|
|
9547
9547
|
...Table,
|
|
9548
9548
|
...Semantic,
|
|
9549
9549
|
...Misc,
|
|
9550
|
-
...Derived
|
|
9550
|
+
...Derived,
|
|
9551
|
+
ZikoUIElement,
|
|
9552
|
+
ZikoUIContainerElement
|
|
9551
9553
|
};
|
|
9552
9554
|
|
|
9553
9555
|
const svg2str=svg=>(new XMLSerializer()).serializeToString(svg);
|
|
@@ -11306,1198 +11308,128 @@ const Math$1 = {
|
|
|
11306
11308
|
...__Calculus__,
|
|
11307
11309
|
};
|
|
11308
11310
|
|
|
11309
|
-
|
|
11310
|
-
|
|
11311
|
-
|
|
11312
|
-
|
|
11313
|
-
|
|
11314
|
-
|
|
11315
|
-
|
|
11316
|
-
|
|
11317
|
-
this.target=null;
|
|
11318
|
-
this.styles=new Map(
|
|
11319
|
-
[["default",defaultStyle]]
|
|
11320
|
-
);
|
|
11321
|
-
this.cache={
|
|
11322
|
-
isHidden:false,
|
|
11323
|
-
isFaddedOut:false,
|
|
11324
|
-
transformation:{
|
|
11325
|
-
Flip:[0,0,0],
|
|
11326
|
-
matrix:new Matrix([
|
|
11327
|
-
[1,0,0,0],
|
|
11328
|
-
[0,1,0,0],
|
|
11329
|
-
[0,0,1,0],
|
|
11330
|
-
[0,0,0,1]
|
|
11331
|
-
])
|
|
11332
|
-
}
|
|
11333
|
-
};
|
|
11334
|
-
}
|
|
11335
|
-
// style(styles ,{target = "parent", maskVector = null } = {}){
|
|
11336
|
-
// if (target === "parent" || target === 0)style(this.target.element, styles);
|
|
11337
|
-
// else if(target === "parent" || target === 0){
|
|
11338
|
-
// if (maskVector) {
|
|
11339
|
-
// this.items.map((n, i) => maskVector[i] == 1 && n.style(styles));
|
|
11340
|
-
// }
|
|
11341
|
-
// else this.items.map((n) => n.style(styles));
|
|
11342
|
-
// }
|
|
11343
|
-
// return this;
|
|
11344
|
-
// }
|
|
11345
|
-
style(styles){
|
|
11346
|
-
for(const [key, value] of Object.entries(styles)){
|
|
11347
|
-
if(Str.isCamelCase(key)){
|
|
11348
|
-
delete styles[key];
|
|
11349
|
-
Object.assign(styles,{[Str.camel2hyphencase(key)]:value});
|
|
11350
|
-
}
|
|
11351
|
-
}
|
|
11352
|
-
if(this?.target?.element?.style)Object.assign(this?.target?.element?.style, styles);
|
|
11353
|
-
return this;
|
|
11311
|
+
class ZikoUISvg extends ZikoUIContainerElement {
|
|
11312
|
+
constructor(... ZikoSvgElement) {
|
|
11313
|
+
super("svg","svg");
|
|
11314
|
+
// this.setAttr("width",w);
|
|
11315
|
+
// this.setAttr("height",h);
|
|
11316
|
+
this.style({border:"1px black solid"});
|
|
11317
|
+
this.view(-10,-10,10,10);
|
|
11318
|
+
this.add(...ZikoSvgElement);
|
|
11354
11319
|
}
|
|
11355
|
-
|
|
11356
|
-
|
|
11357
|
-
|
|
11320
|
+
size(width, height){
|
|
11321
|
+
this.setAttr({
|
|
11322
|
+
width ,
|
|
11323
|
+
height
|
|
11324
|
+
});
|
|
11325
|
+
return this;
|
|
11358
11326
|
}
|
|
11359
|
-
|
|
11360
|
-
|
|
11361
|
-
|
|
11327
|
+
view(x1,y1,x2,y2){
|
|
11328
|
+
let width=Math.abs(x2-x1);
|
|
11329
|
+
let height=Math.abs(y2-y1);
|
|
11330
|
+
this.setAttr("viewBox",[x1,y1,width,height].join(" "));
|
|
11331
|
+
this.st.scaleY(-1);
|
|
11332
|
+
return this;
|
|
11362
11333
|
}
|
|
11363
|
-
|
|
11364
|
-
|
|
11365
|
-
|
|
11366
|
-
|
|
11334
|
+
add(...svgElement){
|
|
11335
|
+
for(let i=0;i<svgElement.length;i++){
|
|
11336
|
+
this.element.append(svgElement[i].element);
|
|
11337
|
+
this.items.push(svgElement[i]);
|
|
11338
|
+
}
|
|
11339
|
+
this.maintain();
|
|
11340
|
+
return this;
|
|
11367
11341
|
}
|
|
11368
|
-
|
|
11369
|
-
|
|
11370
|
-
|
|
11342
|
+
remove(...svgElement){
|
|
11343
|
+
for(let i=0;i<svgElement.length;i++){
|
|
11344
|
+
this.element?.removeChild(svgElement[i].element);
|
|
11345
|
+
this.items=this.items.filter(n=>!svgElement);
|
|
11346
|
+
}
|
|
11347
|
+
this.maintain();
|
|
11348
|
+
return this;
|
|
11371
11349
|
}
|
|
11372
|
-
|
|
11373
|
-
|
|
11374
|
-
return this;
|
|
11350
|
+
mask(){
|
|
11351
|
+
|
|
11375
11352
|
}
|
|
11376
|
-
|
|
11377
|
-
|
|
11378
|
-
return this;
|
|
11353
|
+
toString(){
|
|
11354
|
+
return (new XMLSerializer()).serializeToString(this.element);
|
|
11379
11355
|
}
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
Object.entries(this.target.element.style).filter(n=>isNaN(+n[0]))
|
|
11383
|
-
);
|
|
11384
|
-
this.update("default",defaultStyle);
|
|
11385
|
-
return this;
|
|
11356
|
+
btoa(){
|
|
11357
|
+
return btoa(this.toString())
|
|
11386
11358
|
}
|
|
11387
|
-
|
|
11388
|
-
|
|
11389
|
-
if(styles)this.add("hover",styles);
|
|
11390
|
-
this.target?.element?.addEventListener("pointerenter",()=>this.use("hover"));
|
|
11391
|
-
this.target?.element?.addEventListener("pointerleave",()=>this.use("default"));
|
|
11392
|
-
return this;
|
|
11359
|
+
toImg(){
|
|
11360
|
+
return 'data:image/svg+xml;base64,'+this.btoa()
|
|
11393
11361
|
}
|
|
11394
|
-
|
|
11395
|
-
|
|
11396
|
-
return getComputedStyle(this.target.element).display.includes("inline");
|
|
11362
|
+
toImg2(){
|
|
11363
|
+
return "data:image/svg+xml;charset=utf8,"+this.toString().replaceAll("<","%3C").replaceAll(">","%3E").replaceAll("#","%23").replaceAll('"',"'");
|
|
11397
11364
|
}
|
|
11398
|
-
|
|
11399
|
-
|
|
11365
|
+
}
|
|
11366
|
+
|
|
11367
|
+
const Svg =(...items)=>new ZikoUISvg(...items);
|
|
11368
|
+
|
|
11369
|
+
class ZikoSvgElement {
|
|
11370
|
+
constructor(type) {
|
|
11371
|
+
this.cache = {
|
|
11372
|
+
type
|
|
11373
|
+
};
|
|
11374
|
+
}
|
|
11375
|
+
pos(x,y){
|
|
11376
|
+
return this.posX(x).posY(y);
|
|
11377
|
+
}
|
|
11378
|
+
posX(x){
|
|
11379
|
+
if(["circle","ellipse"].includes(this.cache.type))this.element.cx.baseVal.value=x;
|
|
11380
|
+
else this.element.x.baseVal.value=x;
|
|
11381
|
+
return this;
|
|
11382
|
+
}
|
|
11383
|
+
posY(y){
|
|
11384
|
+
if(["circle","ellipse"].includes(this.cache.type))this.element.cy.baseVal.value=y;
|
|
11385
|
+
else this.element.y.baseVal.value=y;
|
|
11386
|
+
return this;
|
|
11387
|
+
}
|
|
11388
|
+
translate(x,y){
|
|
11389
|
+
return this;
|
|
11390
|
+
}
|
|
11391
|
+
color({ stroke, fill }) {
|
|
11392
|
+
this.element?.setAttribute("stroke", stroke);
|
|
11393
|
+
this.element?.setAttribute("fill", fill);
|
|
11394
|
+
return this;
|
|
11395
|
+
}
|
|
11396
|
+
fill(color = "none") {
|
|
11397
|
+
this.element?.setAttribute("fill", color);
|
|
11398
|
+
return this;
|
|
11399
|
+
}
|
|
11400
|
+
stroke(color = "none", width) {
|
|
11401
|
+
this.element?.setAttribute("stroke", color);
|
|
11402
|
+
width && this.strokeWidth(width);
|
|
11403
|
+
return this;
|
|
11404
|
+
}
|
|
11405
|
+
strokeWidth(width = 1) {
|
|
11406
|
+
this.element?.setAttribute("stroke-width", width);
|
|
11407
|
+
return this;
|
|
11408
|
+
}
|
|
11409
|
+
opacity(value = 1) {
|
|
11410
|
+
this.element?.setAttribute("opacity", value);
|
|
11411
|
+
return this;
|
|
11412
|
+
}
|
|
11413
|
+
}
|
|
11414
|
+
|
|
11415
|
+
class ZikoSvgCircle extends ZikoSvgElement{
|
|
11416
|
+
constructor(cx,cy,r){
|
|
11417
|
+
super("circle");
|
|
11418
|
+
this.element=document.createElementNS(
|
|
11419
|
+
"http://www.w3.org/2000/svg",
|
|
11420
|
+
"circle",
|
|
11421
|
+
);
|
|
11422
|
+
this.pos(cx,cy).setR(r);
|
|
11400
11423
|
}
|
|
11401
|
-
|
|
11402
|
-
|
|
11403
|
-
|
|
11404
|
-
width,
|
|
11405
|
-
height
|
|
11406
|
-
},{ target, maskVector });
|
|
11407
|
-
return this;
|
|
11424
|
+
setR(r){
|
|
11425
|
+
this.element.r.baseVal.value=r;
|
|
11426
|
+
return this;
|
|
11408
11427
|
}
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
if(w instanceof Array)w={min:w[0],max:w[1]};
|
|
11412
|
-
if("min" in w || "max" in w){
|
|
11413
|
-
let min= w.min ?? w.max;
|
|
11414
|
-
let max= w.max ?? w.min;
|
|
11415
|
-
min=addSuffixeToNumber(min,"px");
|
|
11416
|
-
max=addSuffixeToNumber(max,"px");
|
|
11417
|
-
this.style({ minWidth: min, maxWidth: max }, { target, maskVector });
|
|
11418
|
-
}
|
|
11419
|
-
}
|
|
11420
|
-
else {
|
|
11421
|
-
w=addSuffixeToNumber(w,"px");
|
|
11422
|
-
this.style({width:w},{ target, maskVector });
|
|
11423
|
-
}
|
|
11424
|
-
return this
|
|
11428
|
+
get r(){
|
|
11429
|
+
return this.element.baseVal.value;
|
|
11425
11430
|
}
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
if(h instanceof Array)h={min:h[0],max:h[1]};
|
|
11429
|
-
if("min" in h || "max" in h){
|
|
11430
|
-
let min= h.min ?? h.max;
|
|
11431
|
-
let max= h.max ?? h.min;
|
|
11432
|
-
min=addSuffixeToNumber(min,"px");
|
|
11433
|
-
max=addSuffixeToNumber(max,"px");
|
|
11434
|
-
this.style({ minHeight: min, maxHeight: max }, { target, maskVector });
|
|
11435
|
-
}
|
|
11436
|
-
}
|
|
11437
|
-
else {
|
|
11438
|
-
h=addSuffixeToNumber(h,"px");
|
|
11439
|
-
this.style({height:h},{ target, maskVector });
|
|
11440
|
-
}
|
|
11441
|
-
return this
|
|
11442
|
-
}
|
|
11443
|
-
enableResize(h=false,v=false,{ target, maskVector } = {}){
|
|
11444
|
-
let resize="none";
|
|
11445
|
-
if(h)v?resize="both":resize="horizontal";
|
|
11446
|
-
else v?resize="vertical":resize="none";
|
|
11447
|
-
this.style({
|
|
11448
|
-
resize,
|
|
11449
|
-
overflow:"hidden"
|
|
11450
|
-
},{ target, maskVector });
|
|
11451
|
-
if(this.isInline()){
|
|
11452
|
-
console.group("Ziko Issue : Temporarily Incompatible Method");
|
|
11453
|
-
console.warn(".enableResize has no effect on inline elements!");
|
|
11454
|
-
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");
|
|
11455
|
-
console.groupEnd();
|
|
11456
|
-
}
|
|
11457
|
-
return this;
|
|
11458
|
-
}
|
|
11459
|
-
// Apparence
|
|
11460
|
-
hide({after, target, maskVector } = {}){
|
|
11461
|
-
if(typeof after==="number"){
|
|
11462
|
-
const wrapper=()=>this.hide({target,maskVector});
|
|
11463
|
-
setTimeout(wrapper, after);
|
|
11464
|
-
clearTimeout(wrapper);
|
|
11465
|
-
}
|
|
11466
|
-
else {
|
|
11467
|
-
this.cache.isHidden=true;
|
|
11468
|
-
this.style({display:"none"},{target,maskVector});
|
|
11469
|
-
}
|
|
11470
|
-
return this;
|
|
11471
|
-
}
|
|
11472
|
-
show({after, target, maskVector } = {}){
|
|
11473
|
-
if(typeof after==="number"){
|
|
11474
|
-
const wrapper=()=>this.show({target,maskVector});
|
|
11475
|
-
setTimeout(wrapper, after);
|
|
11476
|
-
clearTimeout(wrapper);
|
|
11477
|
-
}
|
|
11478
|
-
else {
|
|
11479
|
-
this.cache.isHidden=false;
|
|
11480
|
-
this.style({display:""},{target,maskVector});
|
|
11481
|
-
}
|
|
11482
|
-
return this;
|
|
11483
|
-
}
|
|
11484
|
-
color(color,{ target, maskVector } = {}){
|
|
11485
|
-
this.style({color},{ target, maskVector });
|
|
11486
|
-
return this;
|
|
11487
|
-
}
|
|
11488
|
-
background(background,{ target, maskVector } = {}){
|
|
11489
|
-
this.style({background},{ target, maskVector });
|
|
11490
|
-
return this;
|
|
11491
|
-
}
|
|
11492
|
-
backgroundColor(backgroundColor,{ target, maskVector } = {}){
|
|
11493
|
-
this.style({backgroundColor},{ target, maskVector });
|
|
11494
|
-
return this;
|
|
11495
|
-
}
|
|
11496
|
-
opacity(opacity, { target, maskVector } = {}) {
|
|
11497
|
-
this.style({ opacity }, { target, maskVector });
|
|
11498
|
-
return this;
|
|
11499
|
-
}
|
|
11500
|
-
// Placement
|
|
11501
|
-
position(position,{ target, maskVector } = {}){
|
|
11502
|
-
this.style({position},{ target, maskVector });
|
|
11503
|
-
return this
|
|
11504
|
-
}
|
|
11505
|
-
display(disp, { target, maskVector } = {}) {
|
|
11506
|
-
this.style({ display: disp }, { target, maskVector });
|
|
11507
|
-
return this;
|
|
11508
|
-
}
|
|
11509
|
-
zIndex(z,{ target, maskVector } = {}){
|
|
11510
|
-
this.style({zIndex:z},{ target, maskVector });
|
|
11511
|
-
return this;
|
|
11512
|
-
}
|
|
11513
|
-
float(float, { target, maskVector } = {}) {
|
|
11514
|
-
this.style({ float: float }, { target, maskVector });
|
|
11515
|
-
return this;
|
|
11516
|
-
}
|
|
11517
|
-
// Box Model
|
|
11518
|
-
border(border = "1px solid red", { target, maskVector } = {}){
|
|
11519
|
-
this.style({border}, { target, maskVector });
|
|
11520
|
-
return this;
|
|
11521
|
-
}
|
|
11522
|
-
borderTop(borderTop = "1px solid red", { target, maskVector } = {}){
|
|
11523
|
-
this.style({borderTop}, { target, maskVector });
|
|
11524
|
-
return this;
|
|
11525
|
-
}
|
|
11526
|
-
borderRight(borderRight = "1px solid red", { target, maskVector } = {}){
|
|
11527
|
-
this.style({borderRight}, { target, maskVector });
|
|
11528
|
-
return this;
|
|
11529
|
-
}
|
|
11530
|
-
borderBottom(borderBottom = "1px solid red", { target, maskVector } = {}){
|
|
11531
|
-
this.style({borderBottom}, { target, maskVector });
|
|
11532
|
-
return this;
|
|
11533
|
-
}
|
|
11534
|
-
borderLeft(borderLeft = "1px solid red", { target, maskVector } = {}){
|
|
11535
|
-
this.style({borderLeft}, { target, maskVector });
|
|
11536
|
-
return this;
|
|
11537
|
-
}
|
|
11538
|
-
borderRadius(radius,{ target, maskVector } = {}){
|
|
11539
|
-
radius=addSuffixeToNumber(radius,"px");
|
|
11540
|
-
this.style({ borderRadius: radius }, { target, maskVector });
|
|
11541
|
-
return this;
|
|
11542
|
-
}
|
|
11543
|
-
margin(margin,{ target, maskVector } = {}){
|
|
11544
|
-
margin=addSuffixeToNumber(margin,"px");
|
|
11545
|
-
this.style({ margin }, { target, maskVector });
|
|
11546
|
-
return this;
|
|
11547
|
-
}
|
|
11548
|
-
marginTop(marginTop,{ target, maskVector } = {}){
|
|
11549
|
-
marginTop=addSuffixeToNumber(marginTop,"px");
|
|
11550
|
-
this.style({marginTop},{ target, maskVector });
|
|
11551
|
-
return this;
|
|
11552
|
-
}
|
|
11553
|
-
marginRight(marginRight,{ target, maskVector } = {}){
|
|
11554
|
-
marginRight=addSuffixeToNumber(marginRight,"px");
|
|
11555
|
-
this.style({marginRight},{ target, maskVector });
|
|
11556
|
-
return this;
|
|
11557
|
-
}
|
|
11558
|
-
marginBootom(marginBootom,{ target, maskVector } = {}){
|
|
11559
|
-
marginBootom=addSuffixeToNumber(marginBootom,"px");
|
|
11560
|
-
this.style({marginBootom},{ target, maskVector });
|
|
11561
|
-
return this;
|
|
11562
|
-
}
|
|
11563
|
-
marginLeft(marginLeft,{ target, maskVector } = {}){
|
|
11564
|
-
marginLeft=addSuffixeToNumber(marginLeft,"px");
|
|
11565
|
-
this.style({marginLeft},{ target, maskVector });
|
|
11566
|
-
return this;
|
|
11567
|
-
}
|
|
11568
|
-
padding(padding,{ target, maskVector } = {}){
|
|
11569
|
-
padding=addSuffixeToNumber(padding,"px");
|
|
11570
|
-
this.style({padding},{ target, maskVector });
|
|
11571
|
-
return this;
|
|
11572
|
-
}
|
|
11573
|
-
paddingTop(paddingTop,{ target, maskVector } = {}){
|
|
11574
|
-
paddingTop=addSuffixeToNumber(paddingTop,"px");
|
|
11575
|
-
this.style({paddingTop},{ target, maskVector });
|
|
11576
|
-
return this;
|
|
11577
|
-
}
|
|
11578
|
-
paddingRight(paddingRight,{ target, maskVector } = {}){
|
|
11579
|
-
paddingRight=addSuffixeToNumber(paddingRight,"px");
|
|
11580
|
-
this.style({paddingRight},{ target, maskVector });
|
|
11581
|
-
return this;
|
|
11582
|
-
}
|
|
11583
|
-
paddingBootom(paddingBootom,{ target, maskVector } = {}){
|
|
11584
|
-
paddingBootom=addSuffixeToNumber(paddingBootom,"px");
|
|
11585
|
-
this.style({paddingBootom},{ target, maskVector });
|
|
11586
|
-
return this;
|
|
11587
|
-
}
|
|
11588
|
-
paddingLeft(paddingLeft,{ target, maskVector } = {}){
|
|
11589
|
-
paddingLeft=addSuffixeToNumber(paddingLeft,"px");
|
|
11590
|
-
this.style({paddingLeft},{ target, maskVector });
|
|
11591
|
-
return this;
|
|
11592
|
-
}
|
|
11593
|
-
// Typographie
|
|
11594
|
-
font(font,{ target, maskVector } = {}){
|
|
11595
|
-
this.style({font},{ target, maskVector });
|
|
11596
|
-
return this;
|
|
11597
|
-
}
|
|
11598
|
-
fontFamily(fontFamily="",{ target, maskVector } = {}){
|
|
11599
|
-
this.style({fontFamily},{ target, maskVector });
|
|
11600
|
-
return this;
|
|
11601
|
-
}
|
|
11602
|
-
fontSize(fontSize,{ target, maskVector } = {}){
|
|
11603
|
-
this.style({fontSize},{ target, maskVector });
|
|
11604
|
-
return this;
|
|
11605
|
-
}
|
|
11606
|
-
// Misc
|
|
11607
|
-
cursor(type="pointer"){
|
|
11608
|
-
this.style({ cursor: type });
|
|
11609
|
-
return this;
|
|
11610
|
-
}
|
|
11611
|
-
overflow(x,y,{ target, maskVector } = {}){
|
|
11612
|
-
const values=["hidden","auto"];
|
|
11613
|
-
this.style({
|
|
11614
|
-
overflowX:typeof x==="number"?values[x]:x,
|
|
11615
|
-
overflowY:typeof y==="number"?values[y]:y
|
|
11616
|
-
},{target,maskVector});
|
|
11617
|
-
return this;
|
|
11618
|
-
}
|
|
11619
|
-
clip(polygon, { target, maskVector } = {}) {
|
|
11620
|
-
if (typeof polygon === "string") polygon = "polygon(" + polygon + ")";
|
|
11621
|
-
this.style({ clipPath: polygon }, { target, maskVector });
|
|
11622
|
-
return this;
|
|
11623
|
-
}
|
|
11624
|
-
// Transfromations
|
|
11625
|
-
fadeOut(transitionTimming = 1) {
|
|
11626
|
-
this.style({
|
|
11627
|
-
transition:`opacity ${transitionTimming/1000}s`,
|
|
11628
|
-
opacity: 0
|
|
11629
|
-
});
|
|
11630
|
-
this.cache.isFaddedOut=true;
|
|
11631
|
-
return this;
|
|
11632
|
-
}
|
|
11633
|
-
fadeIn(transitionTimming = 1) {
|
|
11634
|
-
this.style({
|
|
11635
|
-
transition: `opacity ${transitionTimming/1000}s`,
|
|
11636
|
-
opacity: 1
|
|
11637
|
-
});
|
|
11638
|
-
this.cache.isFaddedOut=false;
|
|
11639
|
-
return this;
|
|
11640
|
-
}
|
|
11641
|
-
toggleFade(t_in = 1000,t_out=t_in){
|
|
11642
|
-
this.cache.isFaddedOut?this.fadeIn(t_in):this.fadeOut(t_out);
|
|
11643
|
-
return this;
|
|
11644
|
-
}
|
|
11645
|
-
morphBorderRadius(newValue, transitionTimming){
|
|
11646
|
-
this.style({
|
|
11647
|
-
borderRadius: newValue,
|
|
11648
|
-
transition: `borderRadius ${transitionTimming/1000}s`,
|
|
11649
|
-
});
|
|
11650
|
-
return this;
|
|
11651
|
-
}
|
|
11652
|
-
#applyTransformMatrix(transitionTimming){
|
|
11653
|
-
const transformMatrix = this.cache.transformation.matrix.arr.join(",");
|
|
11654
|
-
this.style({
|
|
11655
|
-
transform: `matrix3d(${transformMatrix})`,
|
|
11656
|
-
"-webkit-transform": `matrix3d(${transformMatrix})`,
|
|
11657
|
-
"-moz-transform": `matrix3d(${transformMatrix})`,
|
|
11658
|
-
"-ms-transform": `matrix3d(${transformMatrix})`,
|
|
11659
|
-
"-o-transform": `matrix3d(${transformMatrix})`
|
|
11660
|
-
});
|
|
11661
|
-
if (transitionTimming != 0) this.style({ transition: `transform ${transitionTimming/1000}s ease` });
|
|
11662
|
-
}
|
|
11663
|
-
translate(dx, dy = dx ,dz = 0, transitionTimming = 0) {
|
|
11664
|
-
this.cache.transformation.matrix.set(3,0,dx);
|
|
11665
|
-
this.cache.transformation.matrix.set(3,1,dy);
|
|
11666
|
-
this.cache.transformation.matrix.set(3,2,dz);
|
|
11667
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
11668
|
-
return this;
|
|
11669
|
-
}
|
|
11670
|
-
translateX(dx, transitionTimming = 0) {
|
|
11671
|
-
this.cache.transformation.matrix.set(3,0,dx);
|
|
11672
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
11673
|
-
return this;
|
|
11674
|
-
}
|
|
11675
|
-
translateY(dy, transitionTimming = 0) {
|
|
11676
|
-
this.cache.transformation.matrix.set(3,1,dy);
|
|
11677
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
11678
|
-
return this;
|
|
11679
|
-
}
|
|
11680
|
-
translateZ(dz, transitionTimming = 0) {
|
|
11681
|
-
const d=-1/this.cache.transformation.matrix[2][2];
|
|
11682
|
-
this.cache.transformation.matrix.set(3,2,z);
|
|
11683
|
-
this.cache.transformation.matrix.set(3,3,1-(dz/d));
|
|
11684
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
11685
|
-
return this;
|
|
11686
|
-
}
|
|
11687
|
-
perspective(distance,transitionTimming=0){
|
|
11688
|
-
const z=this.cache.transformation.matrix[3][2];
|
|
11689
|
-
this.cache.transformation.matrix.set(2,2,-1/d);
|
|
11690
|
-
this.cache.transformation.matrix.set(3,3,1-(z/distance));
|
|
11691
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
11692
|
-
return this;
|
|
11693
|
-
}
|
|
11694
|
-
scale(sx, sy = sx, transitionTimming = 0) {
|
|
11695
|
-
this.cache.transformation.matrix.set(0,0,sx);
|
|
11696
|
-
this.cache.transformation.matrix.set(1,1,sy);
|
|
11697
|
-
// const transformMatrix = this.cache.transformation.matrix.arr.join(",");
|
|
11698
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
11699
|
-
return this;
|
|
11700
|
-
}
|
|
11701
|
-
scaleX(x = 1 , transitionTimming = 0) {
|
|
11702
|
-
this.cache.transformation.matrix.set(0,0,x);
|
|
11703
|
-
// const transformMatrix = this.cache.transformation.matrix.arr.join(",");
|
|
11704
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
11705
|
-
return this;
|
|
11706
|
-
}
|
|
11707
|
-
scaleY(y = 1, transitionTimming = 0) {
|
|
11708
|
-
this.cache.transformation.matrix.set(1,1,y);
|
|
11709
|
-
this.cache.transformation.matrix.arr.join(",");
|
|
11710
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
11711
|
-
return this;
|
|
11712
|
-
}
|
|
11713
|
-
skew(x, y = x, transitionTimming = 0) {
|
|
11714
|
-
this.cache.transformation.matrix.set(0,1,x);
|
|
11715
|
-
this.cache.transformation.matrix.set(1,0,y);
|
|
11716
|
-
this.cache.transformation.matrix.arr.join(",");
|
|
11717
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
11718
|
-
return this;
|
|
11719
|
-
}
|
|
11720
|
-
skewX(x = 1 , transitionTimming = 0) {
|
|
11721
|
-
this.cache.transformation.matrix.set(0,1,x);
|
|
11722
|
-
this.cache.transformation.matrix.arr.join(",");
|
|
11723
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
11724
|
-
return this;
|
|
11725
|
-
}
|
|
11726
|
-
skewY(y = 1, transitionTimming = 0) {
|
|
11727
|
-
this.cache.transformation.matrix.set(1,0,y);
|
|
11728
|
-
this.cache.transformation.matrix.arr.join(",");
|
|
11729
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
11730
|
-
return this;
|
|
11731
|
-
}
|
|
11732
|
-
rotateX(rx, transitionTimming = 0) {
|
|
11733
|
-
this.cache.transformation.matrix.set(1,1,cos(rx));
|
|
11734
|
-
this.cache.transformation.matrix.set(1,2,-sin(rx));
|
|
11735
|
-
this.cache.transformation.matrix.set(2,1,sin(rx));
|
|
11736
|
-
this.cache.transformation.matrix.set(1,2,cos(rx));
|
|
11737
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
11738
|
-
return this;
|
|
11739
|
-
}
|
|
11740
|
-
rotateY(ry, transitionTimming = 0) {
|
|
11741
|
-
this.cache.transformation.matrix.set(0,0,cos(ry));
|
|
11742
|
-
this.cache.transformation.matrix.set(0,2,sin(ry));
|
|
11743
|
-
this.cache.transformation.matrix.set(2,0,-sin(ry));
|
|
11744
|
-
this.cache.transformation.matrix.set(2,2,cos(ry));
|
|
11745
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
11746
|
-
return this;
|
|
11747
|
-
}
|
|
11748
|
-
rotateZ(rz, transitionTimming = 0) {
|
|
11749
|
-
this.cache.transformation.matrix.set(0,0,cos(rz));
|
|
11750
|
-
this.cache.transformation.matrix.set(0,1,-sin(rz));
|
|
11751
|
-
this.cache.transformation.matrix.set(1,0,sin(rz));
|
|
11752
|
-
this.cache.transformation.matrix.set(1,1,cos(rz));
|
|
11753
|
-
this.#applyTransformMatrix(transitionTimming);
|
|
11754
|
-
return this;
|
|
11755
|
-
}
|
|
11756
|
-
flipeX(transitionTimming = 1) {
|
|
11757
|
-
this.cache.transformation.Flip[0] += 180;
|
|
11758
|
-
this.cache.transformation.Flip[0] %= 360;
|
|
11759
|
-
this.rotateX(this.cache.transformation.Flip[0], transitionTimming);
|
|
11760
|
-
return this;
|
|
11761
|
-
}
|
|
11762
|
-
flipeY(transitionTimming = 1) {
|
|
11763
|
-
this.cache.transformation.Flip[1] += 180 ;
|
|
11764
|
-
this.cache.transformation.Flip[1] %= 360;
|
|
11765
|
-
this.rotateY(this.cache.transformation.Flip[1], transitionTimming);
|
|
11766
|
-
return this;
|
|
11767
|
-
}
|
|
11768
|
-
flipeZ(transitionTimming = 1) {
|
|
11769
|
-
this.cache.transformation.Flip[2] += 180;
|
|
11770
|
-
this.cache.transformation.Flip[2] %= 360;
|
|
11771
|
-
this.rotateZ(this.cache.transformation.Flip[2], transitionTimming);
|
|
11772
|
-
return this;
|
|
11773
|
-
}
|
|
11774
|
-
slideHeightIn(transitionTimming = 1, h = this.h) {
|
|
11775
|
-
this.style({ transition: transitionTimming + "s", height: h });
|
|
11776
|
-
return this;
|
|
11777
|
-
}
|
|
11778
|
-
slideHeightOut(transitionTimming = 1) {
|
|
11779
|
-
this.style({ transition: transitionTimming + "s", height: 0 });
|
|
11780
|
-
this.target?.element?.n("transitionend", () =>
|
|
11781
|
-
this.style({ opacity: "none" }),
|
|
11782
|
-
);
|
|
11783
|
-
return this;
|
|
11784
|
-
}
|
|
11785
|
-
slideWidthIn(transitionTimming = 1, w = this.w) {
|
|
11786
|
-
this.style({ transition: transitionTimming + "s", width: w });
|
|
11787
|
-
return this;
|
|
11788
|
-
}
|
|
11789
|
-
slideWidthOut(transitionTimming = 1) {
|
|
11790
|
-
this.style({ transition: transitionTimming + "s", width: 0 });
|
|
11791
|
-
const wrapper=()=>{
|
|
11792
|
-
this.style({ opacity: "none" });
|
|
11793
|
-
};
|
|
11794
|
-
this.target?.element?.addEventListener("transitionend",wrapper);
|
|
11795
|
-
this.target?.element?.removeEventListener("transitionend",wrapper);
|
|
11796
|
-
return this;
|
|
11797
|
-
}
|
|
11798
|
-
slideIn({ transitionTimming = 1, w = "100%", h = "auto" } = {}) {
|
|
11799
|
-
this.style({
|
|
11800
|
-
transition: transitionTimming + "s",
|
|
11801
|
-
width: w,
|
|
11802
|
-
height: h,
|
|
11803
|
-
visibility: "visible",
|
|
11804
|
-
});
|
|
11805
|
-
return this;
|
|
11806
|
-
}
|
|
11807
|
-
slideOut({ transitionTimming = 1, width = 0, heightransitionTimming = 0 } = {}) {
|
|
11808
|
-
this.style({
|
|
11809
|
-
visibility: "hidden",
|
|
11810
|
-
transition: transitionTimming + "s",
|
|
11811
|
-
opacity: "none",
|
|
11812
|
-
width: width,
|
|
11813
|
-
height: height,
|
|
11814
|
-
});
|
|
11815
|
-
const wrapper=()=>{
|
|
11816
|
-
this.style({ opacity: "none" });
|
|
11817
|
-
};
|
|
11818
|
-
this.target?.element?.addEventListener("transitionend",wrapper);
|
|
11819
|
-
this.target?.element?.removeEventListener("transitionend",wrapper);
|
|
11820
|
-
return this;
|
|
11821
|
-
}
|
|
11822
|
-
|
|
11823
|
-
}
|
|
11824
|
-
|
|
11825
|
-
class ZikoUIElement {
|
|
11826
|
-
constructor(element ,name="") {
|
|
11827
|
-
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
|
|
11828
|
-
if(typeof element === "string") {
|
|
11829
|
-
element === "svg" ? element=globalThis?.document?.createElementNS("http://www.w3.org/2000/svg", "svg"): element = globalThis?.document?.createElement(element);
|
|
11830
|
-
}
|
|
11831
|
-
this.element = element;
|
|
11832
|
-
this.uuid=this.constructor.name+"-"+Random.string(10);
|
|
11833
|
-
this.cache = {
|
|
11834
|
-
name,
|
|
11835
|
-
parent:null,
|
|
11836
|
-
isBody:false,
|
|
11837
|
-
isRoot:false,
|
|
11838
|
-
isHidden: false,
|
|
11839
|
-
isFrozzen:false,
|
|
11840
|
-
legacyParent : null,
|
|
11841
|
-
style: new ZikoUIElementStyle({}),
|
|
11842
|
-
attributes: {},
|
|
11843
|
-
filters: {},
|
|
11844
|
-
temp:{}
|
|
11845
|
-
};
|
|
11846
|
-
this.events = {
|
|
11847
|
-
ptr:null,
|
|
11848
|
-
mouse:null,
|
|
11849
|
-
wheel:null,
|
|
11850
|
-
key:null,
|
|
11851
|
-
drag:null,
|
|
11852
|
-
drop:null,
|
|
11853
|
-
click:null,
|
|
11854
|
-
clipboard:null,
|
|
11855
|
-
focus:null,
|
|
11856
|
-
swipe:null,
|
|
11857
|
-
custom:null,
|
|
11858
|
-
};
|
|
11859
|
-
this.observer={
|
|
11860
|
-
resize:null,
|
|
11861
|
-
intersection:null
|
|
11862
|
-
};
|
|
11863
|
-
this.cache.style.linkTo(this);
|
|
11864
|
-
this.style({
|
|
11865
|
-
position: "relative",
|
|
11866
|
-
boxSizing:"border-box",
|
|
11867
|
-
// fontFamily:"verdana",
|
|
11868
|
-
margin:0,
|
|
11869
|
-
padding:0,
|
|
11870
|
-
});
|
|
11871
|
-
this.size("auto", "auto");
|
|
11872
|
-
globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
|
|
11873
|
-
globalThis.__Ziko__.__Config__.default.render && this.render();
|
|
11874
|
-
}
|
|
11875
|
-
get isZikoUIElement(){
|
|
11876
|
-
return true
|
|
11877
|
-
}
|
|
11878
|
-
get st(){
|
|
11879
|
-
return this.cache.style;
|
|
11880
|
-
}
|
|
11881
|
-
get attr(){
|
|
11882
|
-
return this.cache.attributes;
|
|
11883
|
-
}
|
|
11884
|
-
get evt(){
|
|
11885
|
-
return this.cache.events;
|
|
11886
|
-
}
|
|
11887
|
-
get html(){
|
|
11888
|
-
return this.element.innerHTML;
|
|
11889
|
-
}
|
|
11890
|
-
get text(){
|
|
11891
|
-
return this.element.textContent;
|
|
11892
|
-
}
|
|
11893
|
-
get isBody(){
|
|
11894
|
-
return this.element === globalThis?.document.body;
|
|
11895
|
-
}
|
|
11896
|
-
get __app__(){
|
|
11897
|
-
if(this.cache.isRoot)return this;
|
|
11898
|
-
let root=this.cache.parent;
|
|
11899
|
-
while(1){
|
|
11900
|
-
if(!root)return null;
|
|
11901
|
-
if(root.cache.isRoot)return root;
|
|
11902
|
-
root=root.parent;
|
|
11903
|
-
}
|
|
11904
|
-
}
|
|
11905
|
-
get parent(){
|
|
11906
|
-
return this.cache.parent;
|
|
11907
|
-
}
|
|
11908
|
-
get width(){
|
|
11909
|
-
return this.element.getBoundingClientRect().width;
|
|
11910
|
-
}
|
|
11911
|
-
get height(){
|
|
11912
|
-
return this.element.getBoundingClientRect().height;
|
|
11913
|
-
}
|
|
11914
|
-
get top(){
|
|
11915
|
-
return this.element.getBoundingClientRect().top;
|
|
11916
|
-
}
|
|
11917
|
-
get right(){
|
|
11918
|
-
return this.element.getBoundingClientRect().right;
|
|
11919
|
-
}
|
|
11920
|
-
get bottom(){
|
|
11921
|
-
return this.element.getBoundingClientRect().bottom;
|
|
11922
|
-
}
|
|
11923
|
-
get left(){
|
|
11924
|
-
return this.element.getBoundingClientRect().left;
|
|
11925
|
-
}
|
|
11926
|
-
clone(render=false) {
|
|
11927
|
-
const UI = new this.constructor();
|
|
11928
|
-
UI.__proto__=this.__proto__;
|
|
11929
|
-
if(this.items.length){
|
|
11930
|
-
const items = [...this.items].map(n=>n.clone());
|
|
11931
|
-
UI.append(...items);
|
|
11932
|
-
}
|
|
11933
|
-
else UI.element=this.element.cloneNode(true);
|
|
11934
|
-
return UI.render(render);
|
|
11935
|
-
}
|
|
11936
|
-
style(styles){
|
|
11937
|
-
styles instanceof ZikoUseStyle ? this.st.style(styles.current): this.st.style(styles);
|
|
11938
|
-
return this;
|
|
11939
|
-
}
|
|
11940
|
-
size(width,height){
|
|
11941
|
-
this.st.size(width,height);
|
|
11942
|
-
return this;
|
|
11943
|
-
}
|
|
11944
|
-
get #SwitchedStyleRTL_LTR(){
|
|
11945
|
-
const CalculedStyle = globalThis.getComputedStyle(this.element);
|
|
11946
|
-
const SwitchedStyle = {};
|
|
11947
|
-
if(CalculedStyle.marginRight!=="0px")Object.assign(SwitchedStyle, {marginLeft: CalculedStyle.marginRight});
|
|
11948
|
-
if(CalculedStyle.marginLeft!=="0px")Object.assign(SwitchedStyle, {marginRight: CalculedStyle.marginLeft});
|
|
11949
|
-
if(CalculedStyle.paddingRight!=="0px")Object.assign(SwitchedStyle, {paddingLeft: CalculedStyle.paddingRight});
|
|
11950
|
-
if(CalculedStyle.paddingLeft!=="0px")Object.assign(SwitchedStyle, {paddingRight: CalculedStyle.paddingLeft});
|
|
11951
|
-
if(CalculedStyle.left!=="0px")Object.assign(SwitchedStyle, {right: CalculedStyle.left});
|
|
11952
|
-
if(CalculedStyle.right!=="0px")Object.assign(SwitchedStyle, {left: CalculedStyle.right});
|
|
11953
|
-
if(CalculedStyle.textAlign === "right")Object.assign(SwitchedStyle, {textAlign: "left"});
|
|
11954
|
-
if(CalculedStyle.textAlign === "left")Object.assign(SwitchedStyle, {textAlign: "right"});
|
|
11955
|
-
if(CalculedStyle.float === "right")Object.assign(SwitchedStyle, {float: "left"});
|
|
11956
|
-
if(CalculedStyle.float === "left")Object.assign(SwitchedStyle, {float: "right"});
|
|
11957
|
-
if(CalculedStyle.borderRadiusLeft!=="0px")Object.assign(SwitchedStyle, {right: CalculedStyle.borderRadiusRight});
|
|
11958
|
-
if(CalculedStyle.borderRadiusRight!=="0px")Object.assign(SwitchedStyle, {right: CalculedStyle.borderRadiusLeft});
|
|
11959
|
-
if(["flex","inline-flex"].includes(CalculedStyle.display)){
|
|
11960
|
-
if(CalculedStyle.justifyContent === "flex-end")Object.assign(SwitchedStyle, {justifyContent: "flex-start"});
|
|
11961
|
-
if(CalculedStyle.justifyContent === "flex-start")Object.assign(SwitchedStyle, {justifyContent: "flex-end"});
|
|
11962
|
-
}
|
|
11963
|
-
return SwitchedStyle;
|
|
11964
|
-
}
|
|
11965
|
-
useRtl(switchAll = false){
|
|
11966
|
-
switchAll ? this.style({
|
|
11967
|
-
...this.#SwitchedStyleRTL_LTR,
|
|
11968
|
-
direction : "rtl"
|
|
11969
|
-
}) : this.style({direction : "rtl"});
|
|
11970
|
-
return this;
|
|
11971
|
-
}
|
|
11972
|
-
useLtr(switchAll = false){
|
|
11973
|
-
switchAll ? this.style({
|
|
11974
|
-
...this.#SwitchedStyleRTL_LTR,
|
|
11975
|
-
direction : "ltr"
|
|
11976
|
-
}) : this.style({direction : "ltr"});
|
|
11977
|
-
return this;
|
|
11978
|
-
}
|
|
11979
|
-
freeze(freeze){
|
|
11980
|
-
this.cache.isFrozzen=freeze;
|
|
11981
|
-
return this;
|
|
11982
|
-
}
|
|
11983
|
-
setTarget(tg) {
|
|
11984
|
-
if(this.isBody) return ;
|
|
11985
|
-
if (tg instanceof ZikoUIElement) tg = tg.element;
|
|
11986
|
-
this.unrender();
|
|
11987
|
-
this.target = tg;
|
|
11988
|
-
this.render();
|
|
11989
|
-
return this;
|
|
11990
|
-
}
|
|
11991
|
-
describe(label){
|
|
11992
|
-
if(label)this.setAttr("aria-label",label);
|
|
11993
|
-
}
|
|
11994
|
-
clear(){
|
|
11995
|
-
this?.items?.forEach(n=>n.unrender());
|
|
11996
|
-
this.element.innerHTML = "";
|
|
11997
|
-
return this;
|
|
11998
|
-
}
|
|
11999
|
-
render(target = this.target) {
|
|
12000
|
-
if(this.isBody)return ;
|
|
12001
|
-
if(target instanceof ZikoUIElement)target=target.element;
|
|
12002
|
-
this.target=target;
|
|
12003
|
-
this.target?.appendChild(this.element);
|
|
12004
|
-
return this;
|
|
12005
|
-
}
|
|
12006
|
-
unrender(){
|
|
12007
|
-
if(this.cache.parent)this.cache.parent.remove(this);
|
|
12008
|
-
else if(this.target?.children?.length && [...this.target?.children].includes(this.element)) this.target.removeChild(this.element);
|
|
12009
|
-
return this;
|
|
12010
|
-
}
|
|
12011
|
-
renderAfter(t = 1) {
|
|
12012
|
-
setTimeout(() => this.render(), t);
|
|
12013
|
-
return this;
|
|
12014
|
-
}
|
|
12015
|
-
unrenderAfter(t = 1) {
|
|
12016
|
-
setTimeout(() => this.unrender(), t);
|
|
12017
|
-
return this;
|
|
12018
|
-
}
|
|
12019
|
-
after(ui){
|
|
12020
|
-
if(ui instanceof ZikoUIElement) ui=ui.element;
|
|
12021
|
-
this.element?.after(ui);
|
|
12022
|
-
return this;
|
|
12023
|
-
}
|
|
12024
|
-
before(ui){
|
|
12025
|
-
if(ui instanceof ZikoUIElement) ui=ui.element;
|
|
12026
|
-
this.element?.before(ui);
|
|
12027
|
-
return this;
|
|
12028
|
-
}
|
|
12029
|
-
animate(keyframe, {duration=1000, iterations=1, easing="ease"}={}){
|
|
12030
|
-
this.element?.animate(keyframe,{duration, iterations, easing});
|
|
12031
|
-
return this;
|
|
12032
|
-
}
|
|
12033
|
-
// Attributes
|
|
12034
|
-
#setAttr(name, value){
|
|
12035
|
-
name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
|
|
12036
|
-
if(this?.attr[name] && this?.attr[name]===value) return;
|
|
12037
|
-
this.element.setAttribute(name, value);
|
|
12038
|
-
Object.assign(this.cache.attributes, {[name]:value});
|
|
12039
|
-
}
|
|
12040
|
-
setAttr(name, value) {
|
|
12041
|
-
if(name instanceof Object){
|
|
12042
|
-
const [names,values]=[Object.keys(name),Object.values(name)];
|
|
12043
|
-
for(let i=0;i<names.length;i++){
|
|
12044
|
-
if(values[i] instanceof Array)value[i] = values[i].join(" ");
|
|
12045
|
-
this.#setAttr(names[i], values[i]);
|
|
12046
|
-
}
|
|
12047
|
-
}
|
|
12048
|
-
else {
|
|
12049
|
-
if(value instanceof Array)value = value.join(" ");
|
|
12050
|
-
this.#setAttr(name, value);
|
|
12051
|
-
}
|
|
12052
|
-
return this;
|
|
12053
|
-
}
|
|
12054
|
-
removeAttr(...names) {
|
|
12055
|
-
for(let i=0;i<names.length;i++)this.element?.removeAttribute(names[i]);
|
|
12056
|
-
return this;
|
|
12057
|
-
}
|
|
12058
|
-
getAttr(name){
|
|
12059
|
-
name = Str.isCamelCase(name) ? Str.camel2hyphencase(name) : name;
|
|
12060
|
-
return this.element.attributes[name].value;
|
|
12061
|
-
}
|
|
12062
|
-
setContentEditable(bool = true) {
|
|
12063
|
-
this.setAttr("contenteditable", bool);
|
|
12064
|
-
return this;
|
|
12065
|
-
}
|
|
12066
|
-
get children() {
|
|
12067
|
-
return [...this.element.children];
|
|
12068
|
-
}
|
|
12069
|
-
get cloneElement() {
|
|
12070
|
-
return this.element.cloneNode(true);
|
|
12071
|
-
}
|
|
12072
|
-
setClasses(...value) {
|
|
12073
|
-
this.setAttr("class", value.join(" "));
|
|
12074
|
-
return this;
|
|
12075
|
-
}
|
|
12076
|
-
get classes(){
|
|
12077
|
-
const classes=this.element.getAttribute("class");
|
|
12078
|
-
return classes===null?[]:classes.split(" ");
|
|
12079
|
-
}
|
|
12080
|
-
addClass() {
|
|
12081
|
-
/*this.setAttr("class", value);
|
|
12082
|
-
return this;*/
|
|
12083
|
-
}
|
|
12084
|
-
setId(id) {
|
|
12085
|
-
this.setAttr("id", id);
|
|
12086
|
-
return this;
|
|
12087
|
-
}
|
|
12088
|
-
get id() {
|
|
12089
|
-
return this.element.getAttribute("id");
|
|
12090
|
-
}
|
|
12091
|
-
onPtrMove(...callbacks){
|
|
12092
|
-
if(!this.events.ptr)this.events.ptr = usePointerEvent(this);
|
|
12093
|
-
this.events.ptr.onMove(...callbacks);
|
|
12094
|
-
return this;
|
|
12095
|
-
}
|
|
12096
|
-
onPtrDown(...callbacks){
|
|
12097
|
-
if(!this.events.ptr)this.events.ptr = usePointerEvent(this);
|
|
12098
|
-
this.events.ptr.onDown(...callbacks);
|
|
12099
|
-
return this;
|
|
12100
|
-
}
|
|
12101
|
-
onPtrUp(...callbacks){
|
|
12102
|
-
if(!this.events.ptr)this.events.ptr = usePointerEvent(this);
|
|
12103
|
-
this.events.ptr.onUp(...callbacks);
|
|
12104
|
-
return this;
|
|
12105
|
-
}
|
|
12106
|
-
onPtrEnter(...callbacks){
|
|
12107
|
-
if(!this.events.ptr)this.events.ptr = usePointerEvent(this);
|
|
12108
|
-
this.events.ptr.onEnter(...callbacks);
|
|
12109
|
-
return this;
|
|
12110
|
-
}
|
|
12111
|
-
onPtrLeave(...callbacks){
|
|
12112
|
-
if(!this.events.ptr)this.events.ptr = usePointerEvent(this);
|
|
12113
|
-
this.events.ptr.onLeave(...callbacks);
|
|
12114
|
-
return this;
|
|
12115
|
-
}
|
|
12116
|
-
onPtrOut(...callbacks){
|
|
12117
|
-
if(!this.events.ptr)this.events.ptr = usePointerEvent(this);
|
|
12118
|
-
this.events.ptr.onOut(...callbacks);
|
|
12119
|
-
return this;
|
|
12120
|
-
}
|
|
12121
|
-
onPtrCancel(...callbacks){
|
|
12122
|
-
if(!this.events.ptr)this.events.ptr = usePointerEvent(this);
|
|
12123
|
-
this.events.ptr.onCancel(...callbacks);
|
|
12124
|
-
return this;
|
|
12125
|
-
}
|
|
12126
|
-
onSwipe(width_threshold, height_threshold,...callbacks){
|
|
12127
|
-
if(!this.events.swipe)this.events.swipe = useSwipeEvent(this, width_threshold, height_threshold);
|
|
12128
|
-
this.events.swipe.onSwipe(...callbacks);
|
|
12129
|
-
return this;
|
|
12130
|
-
}
|
|
12131
|
-
onMouseMove(...callbacks){
|
|
12132
|
-
if(!this.events.mouse)this.events.mouse = useMouseEvent(this);
|
|
12133
|
-
this.events.mouse.onMove(...callbacks);
|
|
12134
|
-
return this;
|
|
12135
|
-
}
|
|
12136
|
-
onMouseDown(...callbacks){
|
|
12137
|
-
if(!this.events.mouse)this.events.mouse = useMouseEvent(this);
|
|
12138
|
-
this.events.mouse.onDown(...callbacks);
|
|
12139
|
-
return this;
|
|
12140
|
-
}
|
|
12141
|
-
onMouseUp(...callbacks){
|
|
12142
|
-
if(!this.events.mouse)this.events.mouse = useMouseEvent(this);
|
|
12143
|
-
this.events.mouse.onUp(...callbacks);
|
|
12144
|
-
return this;
|
|
12145
|
-
}
|
|
12146
|
-
onMouseEnter(...callbacks){
|
|
12147
|
-
if(!this.events.mouse)this.events.mouse = useMouseEvent(this);
|
|
12148
|
-
this.events.mouse.onEnter(...callbacks);
|
|
12149
|
-
return this;
|
|
12150
|
-
}
|
|
12151
|
-
onMouseLeave(...callbacks){
|
|
12152
|
-
if(!this.events.mouse)this.events.mouse = useMouseEvent(this);
|
|
12153
|
-
this.events.mouse.onLeave(...callbacks);
|
|
12154
|
-
return this;
|
|
12155
|
-
}
|
|
12156
|
-
onMouseOut(...callbacks){
|
|
12157
|
-
if(!this.events.mouse)this.events.mouse = useMouseEvent(this);
|
|
12158
|
-
this.events.mouse.onOut(...callbacks);
|
|
12159
|
-
return this;
|
|
12160
|
-
}
|
|
12161
|
-
onWheel(...callbacks){
|
|
12162
|
-
if(!this.events.wheel)this.events.wheel = useWheelEvent(this);
|
|
12163
|
-
this.events.wheel.onWheel(...callbacks);
|
|
12164
|
-
return this;
|
|
12165
|
-
}
|
|
12166
|
-
onKeyDown(...callbacks){
|
|
12167
|
-
if(!this.events.key)this.events.key = useKeyEvent(this);
|
|
12168
|
-
this.events.key.onDown(...callbacks);
|
|
12169
|
-
return this;
|
|
12170
|
-
}
|
|
12171
|
-
onKeyPress(...callbacks){
|
|
12172
|
-
if(!this.events.key)this.events.key = useKeyEvent(this);
|
|
12173
|
-
this.events.key.onPress(...callbacks);
|
|
12174
|
-
return this;
|
|
12175
|
-
}
|
|
12176
|
-
onKeyUp(...callbacks){
|
|
12177
|
-
if(!this.events.key)this.events.key = useKeyEvent(this);
|
|
12178
|
-
this.events.key.onUp(...callbacks);
|
|
12179
|
-
return this;
|
|
12180
|
-
}
|
|
12181
|
-
onKeysDown({keys=[],callback}={}){
|
|
12182
|
-
if(!this.events.key)this.events.key = useKeyEvent(this);
|
|
12183
|
-
this.events.key.handleSuccessifKeys({keys,callback});
|
|
12184
|
-
return this;
|
|
12185
|
-
}
|
|
12186
|
-
onDragStart(...callbacks){
|
|
12187
|
-
if(!this.events.drag)this.events.drag = useDragEvent(this);
|
|
12188
|
-
this.events.drag.onStart(...callbacks);
|
|
12189
|
-
return this;
|
|
12190
|
-
}
|
|
12191
|
-
onDrag(...callbacks){
|
|
12192
|
-
if(!this.events.drag)this.events.drag = useDragEvent(this);
|
|
12193
|
-
this.events.drag.onDrag(...callbacks);
|
|
12194
|
-
return this;
|
|
12195
|
-
}
|
|
12196
|
-
onDragEnd(...callbacks){
|
|
12197
|
-
if(!this.events.drag)this.events.drag = useDragEvent(this);
|
|
12198
|
-
this.events.drag.onEnd(...callbacks);
|
|
12199
|
-
return this;
|
|
12200
|
-
}
|
|
12201
|
-
onDrop(...callbacks){
|
|
12202
|
-
if(!this.events.drop)this.events.drop = useDropEvent(this);
|
|
12203
|
-
this.events.drop.onDrop(...callbacks);
|
|
12204
|
-
return this;
|
|
12205
|
-
}
|
|
12206
|
-
onClick(...callbacks){
|
|
12207
|
-
if(!this.events.click)this.events.click = useClickEvent(this);
|
|
12208
|
-
this.events.click.onClick(...callbacks);
|
|
12209
|
-
return this;
|
|
12210
|
-
}
|
|
12211
|
-
onDbClick(...callbacks){
|
|
12212
|
-
if(!this.events.click)this.events.click = useClickEvent(this);
|
|
12213
|
-
this.events.click.onDbClick(...callbacks);
|
|
12214
|
-
return this;
|
|
12215
|
-
}
|
|
12216
|
-
onCopy(...callbacks){
|
|
12217
|
-
if(!this.events.clipboard)this.events.clipboard = useClipboardEvent(this);
|
|
12218
|
-
this.events.clipboard.onCopy(...callbacks);
|
|
12219
|
-
return this;
|
|
12220
|
-
}
|
|
12221
|
-
onCut(...callbacks){
|
|
12222
|
-
if(!this.events.clipboard)this.events.clipboard = useClipboardEvent(this);
|
|
12223
|
-
this.events.clipboard.onCut(...callbacks);
|
|
12224
|
-
return this;
|
|
12225
|
-
}
|
|
12226
|
-
onPaste(...callbacks){
|
|
12227
|
-
if(!this.events.clipboard)this.events.clipboard = useClipboardEvent(this);
|
|
12228
|
-
this.events.clipboard.onPaste(...callbacks);
|
|
12229
|
-
return this;
|
|
12230
|
-
}
|
|
12231
|
-
onSelect(...callbacks){
|
|
12232
|
-
if(!this.events.clipboard)this.events.clipboard = useClipboardEvent(this);
|
|
12233
|
-
this.events.clipboard.onSelect(...callbacks);
|
|
12234
|
-
return this;
|
|
12235
|
-
}
|
|
12236
|
-
onFocus(...callbacks){
|
|
12237
|
-
if(!this.events.focus)this.events.focus = useFocusEvent(this);
|
|
12238
|
-
this.events.focus.onFocus(...callbacks);
|
|
12239
|
-
return this;
|
|
12240
|
-
}
|
|
12241
|
-
onBlur(...callbacks){
|
|
12242
|
-
if(!this.events.focus)this.events.focus = useFocusEvent(this);
|
|
12243
|
-
this.events.focus.onFocus(...callbacks);
|
|
12244
|
-
return this;
|
|
12245
|
-
}
|
|
12246
|
-
on(event_name,...callbacks){
|
|
12247
|
-
if(!this.events.custom)this.events.custom = useCustomEvent(this);
|
|
12248
|
-
this.events.custom.on(event_name,...callbacks);
|
|
12249
|
-
return this;
|
|
12250
|
-
}
|
|
12251
|
-
emit(event_name,detail={}){
|
|
12252
|
-
if(!this.events.custom)this.events.custom = useCustomEvent(this);
|
|
12253
|
-
this.events.custom.emit(event_name,detail);
|
|
12254
|
-
return this;
|
|
12255
|
-
}
|
|
12256
|
-
watchAttr(callback){
|
|
12257
|
-
if(!this.observer.attr)this.observer.attr = watchAttr(this,callback);
|
|
12258
|
-
return this;
|
|
12259
|
-
}
|
|
12260
|
-
watchChildren(callback){
|
|
12261
|
-
if(!this.observer.children)this.observer.children = watchChildren(this,callback);
|
|
12262
|
-
return this;
|
|
12263
|
-
}
|
|
12264
|
-
watchSize(callback){
|
|
12265
|
-
if(!this.observer.resize)this.observer.resize = watchSize(this,callback);
|
|
12266
|
-
this.observer.resize.start();
|
|
12267
|
-
return this;
|
|
12268
|
-
}
|
|
12269
|
-
watchIntersection(callback,config){
|
|
12270
|
-
if(!this.observer.intersection)this.observer.intersection = watchIntersection(this,callback,config);
|
|
12271
|
-
this.observer.intersection.start();
|
|
12272
|
-
return this;
|
|
12273
|
-
}
|
|
12274
|
-
setFullScreen(set = true, e) {
|
|
12275
|
-
if(!this.element.requestFullscreen){
|
|
12276
|
-
console.error("Fullscreen API is not supported in this browser.");
|
|
12277
|
-
return this;
|
|
12278
|
-
}
|
|
12279
|
-
if (set) this.element.requestFullscreen(e);
|
|
12280
|
-
else globalThis.document.exitFullscreen();
|
|
12281
|
-
return this;
|
|
12282
|
-
}
|
|
12283
|
-
toggleFullScreen(e) {
|
|
12284
|
-
if (!globalThis.document.fullscreenElement) this.element.requestFullscreen(e);
|
|
12285
|
-
else globalThis.document.exitFullscreen();
|
|
12286
|
-
return this;
|
|
12287
|
-
}
|
|
12288
|
-
toPdf(){
|
|
12289
|
-
if(__ZikoPdf__);
|
|
12290
|
-
return this;
|
|
12291
|
-
}
|
|
12292
|
-
}
|
|
12293
|
-
|
|
12294
|
-
// import svgRect from "./Elements/rect.js";
|
|
12295
|
-
// import svgCircle from "./Elements/circle.js";
|
|
12296
|
-
// import svgEllipse from "./Elements/ellipse.js";
|
|
12297
|
-
// import svgLine from "./Elements/line.js";
|
|
12298
|
-
// //import svgPath from "./Elements/path.js";
|
|
12299
|
-
// import svgPolygon from "./Elements/polygon.js";
|
|
12300
|
-
// import svgImage from "./Elements/image.js";
|
|
12301
|
-
// import svgText from "./Elements/text.js";
|
|
12302
|
-
// import svgGroupe from "./Elements/groupe.js";
|
|
12303
|
-
// import svgLink from "./Elements/link.js";
|
|
12304
|
-
// //import svgObject from "./Elements/foreignObject.js";
|
|
12305
|
-
// //import svgGrid from "./Elements/grid.js";
|
|
12306
|
-
|
|
12307
|
-
class ZikoUISvg extends ZikoUIElement {
|
|
12308
|
-
constructor(w=360,h=300) {
|
|
12309
|
-
super("svg","svg");
|
|
12310
|
-
//this.cache={};
|
|
12311
|
-
this.setAttr("width",w);
|
|
12312
|
-
this.setAttr("height",h);
|
|
12313
|
-
this.style({border:"1px black solid"});
|
|
12314
|
-
//this.view(-w/2,-h/2,w/2,h/2)
|
|
12315
|
-
this.view(-10,-10,10,10);
|
|
12316
|
-
}
|
|
12317
|
-
view(x1,y1,x2,y2){
|
|
12318
|
-
let width=Math.abs(x2-x1);
|
|
12319
|
-
let height=Math.abs(y2-y1);
|
|
12320
|
-
this.setAttr("viewBox",[x1,y1,width,height].join(" "));
|
|
12321
|
-
this.st.scaleY(-1);
|
|
12322
|
-
return this;
|
|
12323
|
-
}
|
|
12324
|
-
add(...svgElement){
|
|
12325
|
-
for(let i=0;i<svgElement.length;i++){
|
|
12326
|
-
this.element?.appendChildddddddd(svgElement[i].element);
|
|
12327
|
-
this.items.push(svgElement[i]);
|
|
12328
|
-
}
|
|
12329
|
-
this.maintain();
|
|
12330
|
-
return this;
|
|
12331
|
-
}
|
|
12332
|
-
remove(...svgElement){
|
|
12333
|
-
for(let i=0;i<svgElement.length;i++){
|
|
12334
|
-
this.element?.removeChild(svgElement[i].element);
|
|
12335
|
-
this.items=this.items.filter(n=>!svgElement);
|
|
12336
|
-
}
|
|
12337
|
-
this.maintain();
|
|
12338
|
-
return this;
|
|
12339
|
-
}
|
|
12340
|
-
// text(text,x,y){
|
|
12341
|
-
// let item=svgText(text,x,y);
|
|
12342
|
-
// this.element?.appendChildd(item.element);
|
|
12343
|
-
// item.x(x-item.element.getComputedTextLength()/2);
|
|
12344
|
-
// return item;
|
|
12345
|
-
// }
|
|
12346
|
-
// rect(x,y,w,h){
|
|
12347
|
-
// let item=svgRect(x,y,w,h);
|
|
12348
|
-
// this.add(item);
|
|
12349
|
-
// return item;
|
|
12350
|
-
// }
|
|
12351
|
-
// line(x1,y1,x2,y2){
|
|
12352
|
-
// let item=svgLine(x1,y1,x2,y2);
|
|
12353
|
-
// this.element?.appendChildd(item.element);
|
|
12354
|
-
// return item;
|
|
12355
|
-
// }
|
|
12356
|
-
// circle(cx,cy,r){
|
|
12357
|
-
// let item=svgCircle(cx,cy,r);
|
|
12358
|
-
// this.element?.appendChildd(item.element);
|
|
12359
|
-
// return item;
|
|
12360
|
-
// }
|
|
12361
|
-
// ellipse(cx,cy,rx,ry){
|
|
12362
|
-
// let item=svgEllipse(cx,cy,rx,ry);
|
|
12363
|
-
// this.element?.appendChildd(item.element);
|
|
12364
|
-
// return item;
|
|
12365
|
-
// }
|
|
12366
|
-
// polygon(X,Y){
|
|
12367
|
-
// let item=svgPolygon(X,Y);
|
|
12368
|
-
// this.element?.appendChildd(item.element);
|
|
12369
|
-
// item.addPoints(X,Y)
|
|
12370
|
-
// return item;
|
|
12371
|
-
// }
|
|
12372
|
-
// image(src,w,h,x,y){
|
|
12373
|
-
// let item=svgImage(src,w,h,x,y);
|
|
12374
|
-
// this.element?.appendddChild(item.element);
|
|
12375
|
-
// return item;
|
|
12376
|
-
// }
|
|
12377
|
-
mask(){
|
|
12378
|
-
|
|
12379
|
-
}
|
|
12380
|
-
toString(){
|
|
12381
|
-
return (new XMLSerializer()).serializeToString(this.element);
|
|
12382
|
-
}
|
|
12383
|
-
btoa(){
|
|
12384
|
-
return btoa(this.toString())
|
|
12385
|
-
}
|
|
12386
|
-
toImg(){
|
|
12387
|
-
return 'data:image/svg+xml;base64,'+this.btoa()
|
|
12388
|
-
}
|
|
12389
|
-
toImg2(){
|
|
12390
|
-
return "data:image/svg+xml;charset=utf8,"+this.toString().replaceAll("<","%3C").replaceAll(">","%3E").replaceAll("#","%23").replaceAll('"',"'");
|
|
12391
|
-
}
|
|
12392
|
-
}
|
|
12393
|
-
|
|
12394
|
-
const Svg =(w,h)=>new ZikoUISvg(w,h);
|
|
12395
|
-
|
|
12396
|
-
class ZikoSvgElement {
|
|
12397
|
-
constructor(type) {
|
|
12398
|
-
this.cache = {
|
|
12399
|
-
type
|
|
12400
|
-
};
|
|
12401
|
-
}
|
|
12402
|
-
pos(x,y){
|
|
12403
|
-
return this.posX(x).posY(y);
|
|
12404
|
-
}
|
|
12405
|
-
posX(x){
|
|
12406
|
-
if(["circle","ellipse"].includes(this.cache.type))this.element.cx.baseVal.value=x;
|
|
12407
|
-
else this.element.x.baseVal.value=x;
|
|
12408
|
-
return this;
|
|
12409
|
-
}
|
|
12410
|
-
posY(y){
|
|
12411
|
-
if(["circle","ellipse"].includes(this.cache.type))this.element.cy.baseVal.value=y;
|
|
12412
|
-
else this.element.y.baseVal.value=y;
|
|
12413
|
-
return this;
|
|
12414
|
-
}
|
|
12415
|
-
translate(x,y){
|
|
12416
|
-
return this;
|
|
12417
|
-
}
|
|
12418
|
-
color({ stroke, fill }) {
|
|
12419
|
-
this.element?.setAttribute("stroke", stroke);
|
|
12420
|
-
this.element?.setAttribute("fill", fill);
|
|
12421
|
-
return this;
|
|
12422
|
-
}
|
|
12423
|
-
fill(color = "none") {
|
|
12424
|
-
this.element?.setAttribute("fill", color);
|
|
12425
|
-
return this;
|
|
12426
|
-
}
|
|
12427
|
-
stroke(color = "none", width) {
|
|
12428
|
-
this.element?.setAttribute("stroke", color);
|
|
12429
|
-
width && this.strokeWidth(width);
|
|
12430
|
-
return this;
|
|
12431
|
-
}
|
|
12432
|
-
strokeWidth(width = 1) {
|
|
12433
|
-
this.element?.setAttribute("stroke-width", width);
|
|
12434
|
-
return this;
|
|
12435
|
-
}
|
|
12436
|
-
opacity(value = 1) {
|
|
12437
|
-
this.element?.setAttribute("opacity", value);
|
|
12438
|
-
return this;
|
|
12439
|
-
}
|
|
12440
|
-
}
|
|
12441
|
-
|
|
12442
|
-
class ZikoSvgRectangle extends ZikoSvgElement{
|
|
12443
|
-
constructor(x,y,w,h,center=true){
|
|
12444
|
-
super();
|
|
12445
|
-
this.element=document?.createElementNS(
|
|
12446
|
-
"http://www.w3.org/2000/svg",
|
|
12447
|
-
"rect",
|
|
12448
|
-
);
|
|
12449
|
-
this.setX(x).setY(y).width(w).height(h);
|
|
12450
|
-
this.rx=this.x+this.w/2;
|
|
12451
|
-
this.ty=this.y+this.h/2;
|
|
12452
|
-
}
|
|
12453
|
-
setX(x){
|
|
12454
|
-
this.element.x.baseVal.value=x;
|
|
12455
|
-
this.x=x;
|
|
12456
|
-
return this;
|
|
12457
|
-
}
|
|
12458
|
-
setY(y){
|
|
12459
|
-
this.element.y.baseVal.value=y;
|
|
12460
|
-
this.y=y;
|
|
12461
|
-
return this;
|
|
12462
|
-
}
|
|
12463
|
-
r(rx,ry){
|
|
12464
|
-
this.rx=rx;
|
|
12465
|
-
this.ry=ry;
|
|
12466
|
-
this.setX(this.rx-this.w/2);
|
|
12467
|
-
this.setY(this.ry-this.h/2);
|
|
12468
|
-
return this;
|
|
12469
|
-
}
|
|
12470
|
-
width(w){
|
|
12471
|
-
this.element.width.baseVal.value=w;
|
|
12472
|
-
this.w=w;
|
|
12473
|
-
return this;
|
|
12474
|
-
}
|
|
12475
|
-
height(h){
|
|
12476
|
-
this.element.height.baseVal.value=h;
|
|
12477
|
-
this.h=h;
|
|
12478
|
-
return this;
|
|
12479
|
-
}
|
|
12480
|
-
}
|
|
12481
|
-
const svgRect=(x,y,w,h,center)=>new ZikoSvgRectangle(x,y,w,h,center);
|
|
12482
|
-
|
|
12483
|
-
class ZikoSvgCircle extends ZikoSvgElement{
|
|
12484
|
-
constructor(cx,cy,r){
|
|
12485
|
-
super("circle");
|
|
12486
|
-
this.element=document.createElementNS(
|
|
12487
|
-
"http://www.w3.org/2000/svg",
|
|
12488
|
-
"circle",
|
|
12489
|
-
);
|
|
12490
|
-
this.pos(cx,cy).setR(r);
|
|
12491
|
-
}
|
|
12492
|
-
setR(r){
|
|
12493
|
-
this.element.r.baseVal.value=r;
|
|
12494
|
-
return this;
|
|
12495
|
-
}
|
|
12496
|
-
get r(){
|
|
12497
|
-
return this.element.baseVal.value;
|
|
12498
|
-
}
|
|
12499
|
-
get cx(){
|
|
12500
|
-
return this.element.baseVal.value;
|
|
11431
|
+
get cx(){
|
|
11432
|
+
return this.element.baseVal.value;
|
|
12501
11433
|
}
|
|
12502
11434
|
get cy(){
|
|
12503
11435
|
return this.element.baseVal.value;
|
|
@@ -12525,150 +11457,64 @@ class ZikoSvgEllipse extends ZikoSvgElement{
|
|
|
12525
11457
|
}
|
|
12526
11458
|
const svgEllipse=(x,y,rx,ry)=>new ZikoSvgEllipse(x,y,rx,ry);
|
|
12527
11459
|
|
|
12528
|
-
class
|
|
12529
|
-
constructor(
|
|
12530
|
-
super();
|
|
11460
|
+
class ZikoSvgForeignObject extends ZikoSvgElement{
|
|
11461
|
+
constructor(x=0,y=0,w="100%",h="100%",...ZikoUIElement){
|
|
11462
|
+
super("foreignObject");
|
|
11463
|
+
this.items=[];
|
|
12531
11464
|
this.element=document?.createElementNS(
|
|
12532
11465
|
"http://www.w3.org/2000/svg",
|
|
12533
|
-
"
|
|
11466
|
+
"foreignObject",
|
|
12534
11467
|
);
|
|
12535
|
-
this.
|
|
12536
|
-
|
|
12537
|
-
|
|
12538
|
-
this.element.x1.baseVal.value=x1;
|
|
12539
|
-
return this;
|
|
12540
|
-
}
|
|
12541
|
-
y1(y1){
|
|
12542
|
-
this.element.y1.baseVal.value=y1;
|
|
12543
|
-
return this;
|
|
12544
|
-
}
|
|
12545
|
-
x2(x2){
|
|
12546
|
-
this.element.x2.baseVal.value=x2;
|
|
12547
|
-
return this;
|
|
12548
|
-
}
|
|
12549
|
-
y2(y2){
|
|
12550
|
-
this.element.y2.baseVal.value=y2;
|
|
12551
|
-
return this;
|
|
11468
|
+
this.container=Flex$1().setTarget(this.element).vertical(0,0).size("auto","auto");
|
|
11469
|
+
this.container.st.scaleY(-1);
|
|
11470
|
+
this.posX(x).posY(y).width(w).height(h);
|
|
12552
11471
|
}
|
|
12553
|
-
|
|
12554
|
-
|
|
12555
|
-
|
|
12556
|
-
class ZikoSvgPolyLine extends ZikoSvgElement{}
|
|
12557
|
-
const svgPolyLine=(X,Y)=>new ZikoSvgPolyLine(X,Y);
|
|
12558
|
-
|
|
12559
|
-
class ZikoSvgPath extends ZikoSvgElement{
|
|
12560
|
-
constructor(){
|
|
12561
|
-
super();
|
|
12562
|
-
this.element=document?.createElementNS(
|
|
12563
|
-
"http://www.w3.org/2000/svg",
|
|
12564
|
-
"path",
|
|
12565
|
-
);
|
|
12566
|
-
this.path="";
|
|
12567
|
-
|
|
12568
|
-
}
|
|
12569
|
-
setPath(){
|
|
12570
|
-
this.element.etAttribute("d",this.path);
|
|
12571
|
-
return this;
|
|
12572
|
-
}
|
|
12573
|
-
clear(){
|
|
12574
|
-
this.path="";
|
|
12575
|
-
this.setPath();
|
|
12576
|
-
return this;
|
|
12577
|
-
}
|
|
12578
|
-
moveTo(x,y){
|
|
12579
|
-
this.path+=`M${x} ${y} `;
|
|
12580
|
-
this.setPath();
|
|
12581
|
-
return this;
|
|
12582
|
-
}
|
|
12583
|
-
lineTo(x,y){
|
|
12584
|
-
this.path+=`L${x} ${y} `;
|
|
12585
|
-
this.setPath();
|
|
12586
|
-
return this;
|
|
12587
|
-
}
|
|
12588
|
-
hr(x){
|
|
12589
|
-
this.path+=`H${x} `;
|
|
12590
|
-
this.setPath();
|
|
12591
|
-
return this;
|
|
12592
|
-
}
|
|
12593
|
-
vr(y){
|
|
12594
|
-
this.path+=`V${y} `;
|
|
12595
|
-
this.setPath();
|
|
11472
|
+
width(w){
|
|
11473
|
+
this.element.etAttribute("width",w);
|
|
12596
11474
|
return this;
|
|
12597
11475
|
}
|
|
12598
|
-
|
|
12599
|
-
this.
|
|
12600
|
-
this.setPath();
|
|
12601
|
-
return this;
|
|
12602
|
-
}
|
|
12603
|
-
quadratic(x1,y1,x,y){
|
|
12604
|
-
this.path+=`Q ${x1} ${y1} ${x} ${y} `;
|
|
12605
|
-
this.setPath();
|
|
12606
|
-
return this;
|
|
12607
|
-
}
|
|
12608
|
-
close(){
|
|
12609
|
-
this.path+="Z";
|
|
12610
|
-
this.setPath();
|
|
11476
|
+
height(h){
|
|
11477
|
+
this.element.etAttribute("height",h);
|
|
12611
11478
|
return this;
|
|
12612
11479
|
}
|
|
12613
|
-
|
|
12614
|
-
|
|
12615
|
-
const svgPath=()=>new ZikoSvgPath();
|
|
12616
|
-
|
|
12617
|
-
class ZikoSvgPolygon extends ZikoSvgElement{
|
|
12618
|
-
constructor(X=[],Y=[]){
|
|
12619
|
-
super();
|
|
12620
|
-
this.X=X;
|
|
12621
|
-
this.Y=Y;
|
|
12622
|
-
this.element=document?.createElementNS(
|
|
12623
|
-
"http://www.w3.org/2000/svg",
|
|
12624
|
-
"polygon",
|
|
12625
|
-
);
|
|
12626
|
-
this.element?.setAttribute("points","");
|
|
12627
|
-
this.addPoints(X,Y);
|
|
12628
|
-
}
|
|
12629
|
-
addPoint(x,y){
|
|
12630
|
-
let p=this.element.parentElement.createSVGPoint();
|
|
12631
|
-
p.x=x;
|
|
12632
|
-
p.y=y;
|
|
12633
|
-
this.element.points.appendItem(p);
|
|
11480
|
+
add(...ZikoUIElement){
|
|
11481
|
+
this.container.append(...ZikoUIElement);
|
|
12634
11482
|
return this;
|
|
12635
|
-
}
|
|
12636
|
-
addPoints(X,Y){
|
|
12637
|
-
for(let i=0;i<X.length;i++){
|
|
12638
|
-
let p=this.element.parentElement.createSVGPoint();
|
|
12639
|
-
p.x=X[i];
|
|
12640
|
-
p.y=Y[i];
|
|
12641
|
-
this.element.oints.appendItem(p);
|
|
12642
11483
|
}
|
|
12643
|
-
|
|
12644
|
-
|
|
11484
|
+
remove(...ZikoUIElement){
|
|
11485
|
+
this.container.append(...ZikoUIElement);
|
|
11486
|
+
return this;
|
|
11487
|
+
}
|
|
12645
11488
|
}
|
|
12646
|
-
const
|
|
11489
|
+
const svgObject=(x, y, w, h)=>new ZikoSvgForeignObject(x, y, w, h);
|
|
12647
11490
|
|
|
12648
|
-
class
|
|
12649
|
-
constructor(
|
|
11491
|
+
class ZikoSvgGroupe extends ZikoSvgElement{
|
|
11492
|
+
constructor(...svgElement){
|
|
12650
11493
|
super();
|
|
11494
|
+
this.items=[];
|
|
12651
11495
|
this.element=document?.createElementNS(
|
|
12652
11496
|
"http://www.w3.org/2000/svg",
|
|
12653
|
-
"
|
|
11497
|
+
"g",
|
|
12654
11498
|
);
|
|
12655
|
-
this.
|
|
12656
|
-
this.x(x).y(y);
|
|
12657
|
-
}
|
|
12658
|
-
x(x){
|
|
12659
|
-
this.element?.setAttribute("x",x);
|
|
12660
|
-
return this;
|
|
11499
|
+
this.add(...svgElement);
|
|
12661
11500
|
}
|
|
12662
|
-
|
|
12663
|
-
|
|
12664
|
-
|
|
11501
|
+
add(...svgElement){
|
|
11502
|
+
for(let i=0;i<svgElement.length;i++){
|
|
11503
|
+
this.element?.appendChild(svgElement[i].element);
|
|
11504
|
+
this.items.push(svgElement[i]);
|
|
11505
|
+
}
|
|
11506
|
+
if(svgElement.length===1)return svgElement[0]
|
|
11507
|
+
return svgElement;
|
|
12665
11508
|
}
|
|
12666
|
-
|
|
12667
|
-
|
|
12668
|
-
|
|
11509
|
+
remove(...svgElement){
|
|
11510
|
+
for(let i=0;i<svgElement.length;i++){
|
|
11511
|
+
this.element?.removeChild(svgElement[i].element);
|
|
11512
|
+
this.items=this.items.filter(n=>n!=svgElement);
|
|
11513
|
+
}
|
|
11514
|
+
return this;
|
|
12669
11515
|
}
|
|
12670
|
-
|
|
12671
|
-
const
|
|
11516
|
+
}
|
|
11517
|
+
const svgGroupe=(...svgElement)=>new ZikoSvgGroupe(...svgElement);
|
|
12672
11518
|
|
|
12673
11519
|
class ZikoSvgImage extends ZikoSvgElement{
|
|
12674
11520
|
constructor(src="",w="100%",h="100%",x=0,y=0){
|
|
@@ -12702,64 +11548,33 @@ class ZikoSvgImage extends ZikoSvgElement{
|
|
|
12702
11548
|
}
|
|
12703
11549
|
const svgImage=(src,w,h,x,y)=>new ZikoSvgImage(src,w,h,x,y);
|
|
12704
11550
|
|
|
12705
|
-
class
|
|
12706
|
-
constructor(
|
|
12707
|
-
super("foreignObject");
|
|
12708
|
-
this.items=[];
|
|
12709
|
-
this.element=document?.createElementNS(
|
|
12710
|
-
"http://www.w3.org/2000/svg",
|
|
12711
|
-
"foreignObject",
|
|
12712
|
-
);
|
|
12713
|
-
this.container=Flex$1().setTarget(this.element).vertical(0,0).size("auto","auto");
|
|
12714
|
-
this.container.st.scaleY(-1);
|
|
12715
|
-
this.posX(x).posY(y).width(w).height(h);
|
|
12716
|
-
}
|
|
12717
|
-
width(w){
|
|
12718
|
-
this.element.etAttribute("width",w);
|
|
12719
|
-
return this;
|
|
12720
|
-
}
|
|
12721
|
-
height(h){
|
|
12722
|
-
this.element.etAttribute("height",h);
|
|
12723
|
-
return this;
|
|
12724
|
-
}
|
|
12725
|
-
add(...ZikoUIElement){
|
|
12726
|
-
this.container.append(...ZikoUIElement);
|
|
12727
|
-
return this;
|
|
12728
|
-
}
|
|
12729
|
-
remove(...ZikoUIElement){
|
|
12730
|
-
this.container.append(...ZikoUIElement);
|
|
12731
|
-
return this;
|
|
12732
|
-
}
|
|
12733
|
-
}
|
|
12734
|
-
const svgObject=(x,y,r)=>new ZikoSvgForeignObject(x,y,r);
|
|
12735
|
-
|
|
12736
|
-
class ZikoSvgGroupe extends ZikoSvgElement{
|
|
12737
|
-
constructor(...svgElement){
|
|
11551
|
+
class ZikoSvgLine extends ZikoSvgElement{
|
|
11552
|
+
constructor(x1,y1,x2,y2){
|
|
12738
11553
|
super();
|
|
12739
|
-
this.items=[];
|
|
12740
11554
|
this.element=document?.createElementNS(
|
|
12741
11555
|
"http://www.w3.org/2000/svg",
|
|
12742
|
-
"
|
|
11556
|
+
"line",
|
|
12743
11557
|
);
|
|
12744
|
-
this.
|
|
11558
|
+
this.x1(x1).y1(y1).x2(x2).y2(y2).stroke("black");
|
|
12745
11559
|
}
|
|
12746
|
-
|
|
12747
|
-
|
|
12748
|
-
|
|
12749
|
-
this.items.push(svgElement[i]);
|
|
12750
|
-
}
|
|
12751
|
-
if(svgElement.length===1)return svgElement[0]
|
|
12752
|
-
return svgElement;
|
|
11560
|
+
x1(x1){
|
|
11561
|
+
this.element.x1.baseVal.value=x1;
|
|
11562
|
+
return this;
|
|
12753
11563
|
}
|
|
12754
|
-
|
|
12755
|
-
|
|
12756
|
-
|
|
12757
|
-
this.items=this.items.filter(n=>n!=svgElement);
|
|
12758
|
-
}
|
|
12759
|
-
return this;
|
|
11564
|
+
y1(y1){
|
|
11565
|
+
this.element.y1.baseVal.value=y1;
|
|
11566
|
+
return this;
|
|
12760
11567
|
}
|
|
12761
|
-
|
|
12762
|
-
|
|
11568
|
+
x2(x2){
|
|
11569
|
+
this.element.x2.baseVal.value=x2;
|
|
11570
|
+
return this;
|
|
11571
|
+
}
|
|
11572
|
+
y2(y2){
|
|
11573
|
+
this.element.y2.baseVal.value=y2;
|
|
11574
|
+
return this;
|
|
11575
|
+
}
|
|
11576
|
+
}
|
|
11577
|
+
const svgLine=(x1,y1,x2,y2)=>new ZikoSvgLine(x1,y1,x2,y2);
|
|
12763
11578
|
|
|
12764
11579
|
class ZikoSvgLink extends ZikoSvgElement{
|
|
12765
11580
|
constructor(href,...svgElement){
|
|
@@ -12790,511 +11605,269 @@ class ZikoSvgLink extends ZikoSvgElement{
|
|
|
12790
11605
|
}
|
|
12791
11606
|
const svgLink=(href,...svgElement)=>new ZikoSvgLink(href,...svgElement);
|
|
12792
11607
|
|
|
12793
|
-
|
|
12794
|
-
|
|
12795
|
-
|
|
12796
|
-
|
|
12797
|
-
|
|
12798
|
-
|
|
12799
|
-
|
|
12800
|
-
|
|
12801
|
-
|
|
12802
|
-
constructor(w,h){
|
|
12803
|
-
super("canvas","canvas");
|
|
12804
|
-
//this.element=document?.createElement("canvas");
|
|
12805
|
-
this.ctx = this.element?.getContext("2d");
|
|
12806
|
-
this.style({
|
|
12807
|
-
border:"1px red solid",
|
|
12808
|
-
//width:"300px",
|
|
12809
|
-
//height:"300px"
|
|
12810
|
-
});
|
|
12811
|
-
this.transformMatrix=new Matrix([
|
|
12812
|
-
[1,0,0],
|
|
12813
|
-
[0,1,0],
|
|
12814
|
-
[0,0,1]
|
|
12815
|
-
]);
|
|
12816
|
-
this.axisMatrix=new Matrix([
|
|
12817
|
-
[-10,-10],
|
|
12818
|
-
[10,10]
|
|
12819
|
-
]);
|
|
12820
|
-
// this.render(globalThis.__Ziko__.__Config__.default.render);
|
|
12821
|
-
setTimeout(()=>this.resize(w,h),0);
|
|
12822
|
-
this.on("sizeupdated",()=>this.adjust());
|
|
12823
|
-
}
|
|
12824
|
-
get Width(){
|
|
12825
|
-
return this.element?.width;
|
|
12826
|
-
}
|
|
12827
|
-
get Height(){
|
|
12828
|
-
return this.element?.height;
|
|
12829
|
-
}
|
|
12830
|
-
get Xmin(){
|
|
12831
|
-
return this.axisMatrix[0][0];
|
|
12832
|
-
}
|
|
12833
|
-
get Ymin(){
|
|
12834
|
-
return this.axisMatrix[0][1];
|
|
12835
|
-
}
|
|
12836
|
-
get Xmax(){
|
|
12837
|
-
return this.axisMatrix[1][0];
|
|
12838
|
-
}
|
|
12839
|
-
get Ymax(){
|
|
12840
|
-
return this.axisMatrix[1][1];
|
|
12841
|
-
}
|
|
12842
|
-
get ImageData(){
|
|
12843
|
-
return this.ctx.getImageData(0,0,c.Width,c.Height);
|
|
12844
|
-
}
|
|
12845
|
-
draw(all=true){
|
|
12846
|
-
if(all){
|
|
12847
|
-
this.clear();
|
|
12848
|
-
this.items.forEach(element => {
|
|
12849
|
-
element.parent=this;
|
|
12850
|
-
element.draw(this.ctx);
|
|
12851
|
-
});
|
|
12852
|
-
}
|
|
12853
|
-
else {
|
|
12854
|
-
this.items.at(-1).parent=this;
|
|
12855
|
-
this.items.at(-1).draw(this.ctx);
|
|
12856
|
-
}
|
|
12857
|
-
this.maintain();
|
|
12858
|
-
return this;
|
|
12859
|
-
}
|
|
12860
|
-
applyTransformMatrix(){
|
|
12861
|
-
this.ctx.setTransform(
|
|
12862
|
-
this.transformMatrix[0][0],
|
|
12863
|
-
this.transformMatrix[1][0],
|
|
12864
|
-
this.transformMatrix[0][1],
|
|
12865
|
-
this.transformMatrix[1][1],
|
|
12866
|
-
this.transformMatrix[0][2],
|
|
12867
|
-
this.transformMatrix[1][2],
|
|
12868
|
-
);
|
|
12869
|
-
return this;
|
|
11608
|
+
class ZikoSvgPath extends ZikoSvgElement{
|
|
11609
|
+
constructor(){
|
|
11610
|
+
super();
|
|
11611
|
+
this.element=document?.createElementNS(
|
|
11612
|
+
"http://www.w3.org/2000/svg",
|
|
11613
|
+
"path",
|
|
11614
|
+
);
|
|
11615
|
+
this.path="";
|
|
11616
|
+
|
|
12870
11617
|
}
|
|
12871
|
-
|
|
12872
|
-
|
|
12873
|
-
// width:w,
|
|
12874
|
-
// height:h
|
|
12875
|
-
// })
|
|
12876
|
-
this.size(w,h);
|
|
12877
|
-
this.lineWidth();
|
|
12878
|
-
this.view(this.axisMatrix[0][0], this.axisMatrix[0][1], this.axisMatrix[1][0], this.axisMatrix[1][1]);
|
|
12879
|
-
this.emit("sizeupdated");
|
|
12880
|
-
return this;
|
|
12881
|
-
}
|
|
12882
|
-
adjust(){
|
|
12883
|
-
this.element.width =this.element?.getBoundingClientRect().width;
|
|
12884
|
-
this.element.height =this.element?.getBoundingClientRect().height;
|
|
12885
|
-
this.view(this.axisMatrix[0][0], this.axisMatrix[0][1], this.axisMatrix[1][0], this.axisMatrix[1][1]);
|
|
12886
|
-
return this;
|
|
12887
|
-
}
|
|
12888
|
-
view(xMin,yMin,xMax,yMax){
|
|
12889
|
-
this.transformMatrix[0][0]=this.Width/(xMax-xMin); // scaleX
|
|
12890
|
-
this.transformMatrix[1][1]=-this.Height/(yMax-yMin); // scaleY
|
|
12891
|
-
this.transformMatrix[0][2]=this.Width/2;
|
|
12892
|
-
this.transformMatrix[1][2]=this.Height/2;
|
|
12893
|
-
this.axisMatrix=new Matrix([
|
|
12894
|
-
[xMin,yMin],
|
|
12895
|
-
[xMax,yMax]
|
|
12896
|
-
]);
|
|
12897
|
-
|
|
12898
|
-
this.applyTransformMatrix();
|
|
12899
|
-
this.clear();
|
|
12900
|
-
this.lineWidth(1);
|
|
12901
|
-
this.draw();
|
|
11618
|
+
setPath(){
|
|
11619
|
+
this.element.etAttribute("d",this.path);
|
|
12902
11620
|
return this;
|
|
12903
11621
|
}
|
|
12904
|
-
|
|
12905
|
-
this.
|
|
11622
|
+
clear(){
|
|
11623
|
+
this.path="";
|
|
11624
|
+
this.setPath();
|
|
12906
11625
|
return this;
|
|
12907
11626
|
}
|
|
12908
|
-
|
|
12909
|
-
this.
|
|
12910
|
-
this.
|
|
11627
|
+
moveTo(x,y){
|
|
11628
|
+
this.path+=`M${x} ${y} `;
|
|
11629
|
+
this.setPath();
|
|
12911
11630
|
return this;
|
|
12912
11631
|
}
|
|
12913
|
-
|
|
12914
|
-
this.
|
|
12915
|
-
this.
|
|
12916
|
-
this.ctx.fillRect(0, 0, this.Width, this.Height);
|
|
12917
|
-
this.applyTransformMatrix();
|
|
12918
|
-
this.draw();
|
|
12919
|
-
}
|
|
12920
|
-
lineWidth(w){
|
|
12921
|
-
this.ctx.lineWidth=w/this.transformMatrix[0][0];
|
|
12922
|
-
return this
|
|
12923
|
-
}
|
|
12924
|
-
getImageData(x=0,y=0,w=this.Width,h=this.Height){
|
|
12925
|
-
return this.ctx.getImageData(x,y,w,h);
|
|
12926
|
-
}
|
|
12927
|
-
clear(){
|
|
12928
|
-
this.ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
12929
|
-
this.ctx.clearRect(0, 0, this.Width, this.Height);
|
|
12930
|
-
this.applyTransformMatrix();
|
|
12931
|
-
return this;
|
|
12932
|
-
}
|
|
12933
|
-
clone(){
|
|
12934
|
-
console.log(this.Width);
|
|
12935
|
-
const canvas=new ZikoUICanvas();
|
|
12936
|
-
canvas.items=this.items;
|
|
12937
|
-
canvas.transformMatrix=this.transformMatrix;
|
|
12938
|
-
canvas.axisMatrix=this.axisMatrix;
|
|
12939
|
-
Object.assign(canvas.cache,{...this.cache});
|
|
12940
|
-
//waitForUIElm(this)
|
|
12941
|
-
//console.log(element)
|
|
12942
|
-
this.size(this.element.style.width,this.element.style.width);
|
|
12943
|
-
this.applyTransformMatrix();
|
|
12944
|
-
this.draw();
|
|
12945
|
-
this.adjust();
|
|
12946
|
-
return canvas;
|
|
12947
|
-
}
|
|
12948
|
-
toImage() {
|
|
12949
|
-
this.img = document?.createElement("img");
|
|
12950
|
-
this.img.src = this.element?.toDataURL("image/png");
|
|
12951
|
-
return this;
|
|
12952
|
-
}
|
|
12953
|
-
toBlob() {
|
|
12954
|
-
var canvas = this.element;
|
|
12955
|
-
canvas.toBlob(function (blob) {
|
|
12956
|
-
var newImg = document?.createElement("img"),
|
|
12957
|
-
url = URL.createObjectURL(blob);
|
|
12958
|
-
newImg.onload = function () {
|
|
12959
|
-
URL.revokeObjectURL(url);
|
|
12960
|
-
};
|
|
12961
|
-
newImg.src = url;
|
|
12962
|
-
console.log(newImg);
|
|
12963
|
-
});
|
|
12964
|
-
}
|
|
12965
|
-
zoomIn(){
|
|
12966
|
-
|
|
12967
|
-
}
|
|
12968
|
-
zoomOut(){
|
|
12969
|
-
|
|
12970
|
-
}
|
|
12971
|
-
undo(n){
|
|
12972
|
-
|
|
12973
|
-
}
|
|
12974
|
-
redo(n){
|
|
12975
|
-
|
|
12976
|
-
}
|
|
12977
|
-
stream(){
|
|
12978
|
-
|
|
12979
|
-
}
|
|
12980
|
-
}
|
|
12981
|
-
|
|
12982
|
-
const Canvas=(w,h)=>new ZikoUICanvas(w,h);
|
|
12983
|
-
|
|
12984
|
-
class ZikoCanvasElement{
|
|
12985
|
-
constructor(x,y){
|
|
12986
|
-
this.parent=null;
|
|
12987
|
-
this.position={
|
|
12988
|
-
x,
|
|
12989
|
-
y
|
|
12990
|
-
};
|
|
12991
|
-
this.cache={
|
|
12992
|
-
interact:null/*avoid redraw*/,
|
|
12993
|
-
config:{
|
|
12994
|
-
draggable:false,
|
|
12995
|
-
selected:false,
|
|
12996
|
-
highlighted:false,
|
|
12997
|
-
rendered:false
|
|
12998
|
-
},
|
|
12999
|
-
style:{
|
|
13000
|
-
normal:{
|
|
13001
|
-
strokeEnabled:true,
|
|
13002
|
-
fillEnabled:false,
|
|
13003
|
-
strokeColor:"#111111",
|
|
13004
|
-
fillColor:"#777777",
|
|
13005
|
-
},
|
|
13006
|
-
highlighted:{
|
|
13007
|
-
strokeEnabled:true,
|
|
13008
|
-
fillEnabled:false,
|
|
13009
|
-
strokeColor:null,
|
|
13010
|
-
fillColor:null,
|
|
13011
|
-
}
|
|
13012
|
-
},
|
|
13013
|
-
};
|
|
13014
|
-
this.history={
|
|
13015
|
-
position:[],
|
|
13016
|
-
styles:[]
|
|
13017
|
-
};
|
|
13018
|
-
this.render();
|
|
13019
|
-
}
|
|
13020
|
-
get px(){
|
|
13021
|
-
//_x=====>px
|
|
13022
|
-
return (this.position.x??0)+(this.parent?.position?.x??0);
|
|
13023
|
-
}
|
|
13024
|
-
get py(){
|
|
13025
|
-
//_y=====>py
|
|
13026
|
-
return (this.position.y??0)+(this.parent?.position?.y??0);
|
|
13027
|
-
}
|
|
13028
|
-
isIntersectedWith(){
|
|
13029
|
-
|
|
13030
|
-
}
|
|
13031
|
-
isInStroke(x,y){
|
|
13032
|
-
let is;
|
|
13033
|
-
if(this.parent){
|
|
13034
|
-
this.parent.ctx.setTransform(1,0,0,1,0,0);
|
|
13035
|
-
is=this.parent.ctx.isPointInStroke(this.path,x,y);
|
|
13036
|
-
this.parent.applyTransformMatrix();
|
|
13037
|
-
}
|
|
13038
|
-
return is;
|
|
13039
|
-
}
|
|
13040
|
-
isInPath(x,y){
|
|
13041
|
-
let is;
|
|
13042
|
-
if(this.parent){
|
|
13043
|
-
this.parent.ctx.setTransform(1,0,0,1,0,0);
|
|
13044
|
-
is=this.parent.ctx.isPointInPath(this.path,x,y);
|
|
13045
|
-
this.parent.applyTransformMatrix();
|
|
13046
|
-
}
|
|
13047
|
-
return is;
|
|
13048
|
-
}
|
|
13049
|
-
posX(x){
|
|
13050
|
-
this.position.x=x;
|
|
13051
|
-
if(this.parent)this.parent.draw();
|
|
11632
|
+
lineTo(x,y){
|
|
11633
|
+
this.path+=`L${x} ${y} `;
|
|
11634
|
+
this.setPath();
|
|
13052
11635
|
return this;
|
|
13053
11636
|
}
|
|
13054
|
-
|
|
13055
|
-
this.
|
|
13056
|
-
|
|
11637
|
+
hr(x){
|
|
11638
|
+
this.path+=`H${x} `;
|
|
11639
|
+
this.setPath();
|
|
13057
11640
|
return this;
|
|
13058
11641
|
}
|
|
13059
|
-
|
|
13060
|
-
this.
|
|
13061
|
-
this.
|
|
13062
|
-
if(this.parent)this.parent.draw();
|
|
11642
|
+
vr(y){
|
|
11643
|
+
this.path+=`V${y} `;
|
|
11644
|
+
this.setPath();
|
|
13063
11645
|
return this;
|
|
13064
11646
|
}
|
|
13065
|
-
|
|
13066
|
-
this.
|
|
13067
|
-
this.
|
|
13068
|
-
|
|
13069
|
-
return;
|
|
11647
|
+
bezier(x1,y1,x2,y2,x,y){
|
|
11648
|
+
this.path+=`C ${x1} ${y1},${x2} ${y2},${x} ${y} `;
|
|
11649
|
+
this.setPath();
|
|
11650
|
+
return this;
|
|
13070
11651
|
}
|
|
13071
|
-
|
|
13072
|
-
|
|
13073
|
-
|
|
13074
|
-
return this;
|
|
11652
|
+
quadratic(x1,y1,x,y){
|
|
11653
|
+
this.path+=`Q ${x1} ${y1} ${x} ${y} `;
|
|
11654
|
+
this.setPath();
|
|
11655
|
+
return this;
|
|
13075
11656
|
}
|
|
13076
|
-
|
|
13077
|
-
|
|
13078
|
-
|
|
11657
|
+
close(){
|
|
11658
|
+
this.path+="Z";
|
|
11659
|
+
this.setPath();
|
|
13079
11660
|
return this;
|
|
13080
11661
|
}
|
|
13081
|
-
|
|
13082
|
-
|
|
13083
|
-
|
|
13084
|
-
|
|
13085
|
-
|
|
11662
|
+
}
|
|
11663
|
+
|
|
11664
|
+
const svgPath=()=>new ZikoSvgPath();
|
|
11665
|
+
|
|
11666
|
+
class ZikoSvgPolygon extends ZikoSvgElement{
|
|
11667
|
+
constructor(X=[],Y=[]){
|
|
11668
|
+
super();
|
|
11669
|
+
this.X=X;
|
|
11670
|
+
this.Y=Y;
|
|
11671
|
+
this.element=document?.createElementNS(
|
|
11672
|
+
"http://www.w3.org/2000/svg",
|
|
11673
|
+
"polygon",
|
|
11674
|
+
);
|
|
11675
|
+
this.element?.setAttribute("points","");
|
|
11676
|
+
this.addPoints(X,Y);
|
|
13086
11677
|
}
|
|
13087
|
-
|
|
13088
|
-
|
|
13089
|
-
|
|
13090
|
-
|
|
13091
|
-
|
|
11678
|
+
addPoint(x,y){
|
|
11679
|
+
let p=this.element.parentElement.createSVGPoint();
|
|
11680
|
+
p.x=x;
|
|
11681
|
+
p.y=y;
|
|
11682
|
+
this.element.points.appendItem(p);
|
|
11683
|
+
return this;
|
|
13092
11684
|
}
|
|
13093
|
-
|
|
13094
|
-
|
|
13095
|
-
|
|
11685
|
+
addPoints(X,Y){
|
|
11686
|
+
for(let i=0;i<X.length;i++){
|
|
11687
|
+
let p=this.element.parentElement.createSVGPoint();
|
|
11688
|
+
p.x=X[i];
|
|
11689
|
+
p.y=Y[i];
|
|
11690
|
+
this.element.oints.appendItem(p);
|
|
11691
|
+
}
|
|
11692
|
+
return this;
|
|
13096
11693
|
}
|
|
13097
|
-
}
|
|
11694
|
+
}
|
|
11695
|
+
const svgPolygon=(X,Y)=>new ZikoSvgPolygon(X,Y);
|
|
13098
11696
|
|
|
13099
|
-
class
|
|
13100
|
-
constructor(x,y,
|
|
13101
|
-
|
|
13102
|
-
|
|
13103
|
-
|
|
13104
|
-
|
|
11697
|
+
class ZikoSvgRectangle extends ZikoSvgElement{
|
|
11698
|
+
constructor(x,y,w,h,center=true){
|
|
11699
|
+
super();
|
|
11700
|
+
this.element=document?.createElementNS(
|
|
11701
|
+
"http://www.w3.org/2000/svg",
|
|
11702
|
+
"rect",
|
|
11703
|
+
);
|
|
11704
|
+
this.setX(x).setY(y).width(w).height(h);
|
|
11705
|
+
this.rx=this.x+this.w/2;
|
|
11706
|
+
this.ty=this.y+this.h/2;
|
|
13105
11707
|
}
|
|
13106
|
-
|
|
13107
|
-
|
|
13108
|
-
|
|
13109
|
-
|
|
13110
|
-
ctx.beginPath();
|
|
13111
|
-
this.path=new Path2D();
|
|
13112
|
-
this.path.arc(this.px, this.py, this.r, 0, this.angle);
|
|
13113
|
-
const{strokeEnabled,fillEnabled}=this.cache.style.normal;
|
|
13114
|
-
if(strokeEnabled)ctx.stroke(this.path);
|
|
13115
|
-
if(fillEnabled)ctx.fill(this.path);
|
|
13116
|
-
ctx.closePath();
|
|
13117
|
-
ctx.restore();
|
|
13118
|
-
}
|
|
13119
|
-
return this;
|
|
11708
|
+
setX(x){
|
|
11709
|
+
this.element.x.baseVal.value=x;
|
|
11710
|
+
this.x=x;
|
|
11711
|
+
return this;
|
|
13120
11712
|
}
|
|
13121
|
-
|
|
13122
|
-
|
|
13123
|
-
|
|
13124
|
-
|
|
11713
|
+
setY(y){
|
|
11714
|
+
this.element.y.baseVal.value=y;
|
|
11715
|
+
this.y=y;
|
|
11716
|
+
return this;
|
|
13125
11717
|
}
|
|
13126
|
-
|
|
13127
|
-
|
|
13128
|
-
|
|
13129
|
-
|
|
13130
|
-
|
|
13131
|
-
|
|
13132
|
-
|
|
13133
|
-
|
|
13134
|
-
|
|
13135
|
-
|
|
13136
|
-
|
|
13137
|
-
}
|
|
13138
|
-
|
|
13139
|
-
|
|
11718
|
+
r(rx,ry){
|
|
11719
|
+
this.rx=rx;
|
|
11720
|
+
this.ry=ry;
|
|
11721
|
+
this.setX(this.rx-this.w/2);
|
|
11722
|
+
this.setY(this.ry-this.h/2);
|
|
11723
|
+
return this;
|
|
11724
|
+
}
|
|
11725
|
+
width(w){
|
|
11726
|
+
this.element.width.baseVal.value=w;
|
|
11727
|
+
this.w=w;
|
|
11728
|
+
return this;
|
|
11729
|
+
}
|
|
11730
|
+
height(h){
|
|
11731
|
+
this.element.height.baseVal.value=h;
|
|
11732
|
+
this.h=h;
|
|
11733
|
+
return this;
|
|
11734
|
+
}
|
|
11735
|
+
}
|
|
11736
|
+
const svgRect=(x,y,w,h,center)=>new ZikoSvgRectangle(x,y,w,h,center);
|
|
13140
11737
|
|
|
13141
|
-
class
|
|
13142
|
-
constructor(
|
|
13143
|
-
|
|
13144
|
-
|
|
13145
|
-
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
13149
|
-
|
|
13150
|
-
}
|
|
13151
|
-
draw(ctx){
|
|
13152
|
-
if(this.cache.config.rendered){
|
|
13153
|
-
ctx.save();
|
|
13154
|
-
this.applyNormalStyle(ctx);
|
|
13155
|
-
ctx.beginPath();
|
|
13156
|
-
this.path.moveTo(this.points[1][0]+this._x,this.points[1][1]+this._y);
|
|
13157
|
-
for(let i=1;i<this.points.length;i++){
|
|
13158
|
-
this.path.lineTo(this.points[i][0]+this._x,this.points[i][1]+this._y);
|
|
13159
|
-
}
|
|
13160
|
-
ctx.stroke(this.path);
|
|
13161
|
-
ctx.restore();
|
|
13162
|
-
}
|
|
13163
|
-
return this;
|
|
11738
|
+
class ZikoSvgText extends ZikoSvgElement{
|
|
11739
|
+
constructor(text,x,y){
|
|
11740
|
+
super();
|
|
11741
|
+
this.element=document?.createElementNS(
|
|
11742
|
+
"http://www.w3.org/2000/svg",
|
|
11743
|
+
"text",
|
|
11744
|
+
);
|
|
11745
|
+
this.setText(text);
|
|
11746
|
+
this.x(x).y(y);
|
|
13164
11747
|
}
|
|
13165
|
-
|
|
13166
|
-
|
|
13167
|
-
|
|
11748
|
+
x(x){
|
|
11749
|
+
this.element?.setAttribute("x",x);
|
|
11750
|
+
return this;
|
|
13168
11751
|
}
|
|
13169
|
-
|
|
13170
|
-
|
|
13171
|
-
|
|
13172
|
-
return this;
|
|
11752
|
+
y(y){
|
|
11753
|
+
this.element?.setAttribute("y",y);
|
|
11754
|
+
return this;
|
|
13173
11755
|
}
|
|
13174
|
-
|
|
13175
|
-
|
|
13176
|
-
|
|
13177
|
-
this.parent.ctx.setTransform(1,0,0,1,0,0);
|
|
13178
|
-
is=this.parent.ctx.isPointInPath(this.path,x,y);
|
|
13179
|
-
this.parent.applyTransformMatrix();
|
|
13180
|
-
}
|
|
13181
|
-
return is;
|
|
11756
|
+
setText(text=""){
|
|
11757
|
+
this.element.textContent=text;
|
|
11758
|
+
return this;
|
|
13182
11759
|
}
|
|
13183
|
-
}
|
|
11760
|
+
}
|
|
11761
|
+
const svgText=(text,x,y)=>new ZikoSvgText(text,x,y);
|
|
13184
11762
|
|
|
13185
|
-
const
|
|
11763
|
+
const svgGrid=(w,h,r=10,c=10)=>{
|
|
11764
|
+
let path=svgPath().fill("none").stroke("coral").strokeWidth(0.6);
|
|
11765
|
+
console.log({x:w/r,y:h/c});
|
|
11766
|
+
for(let i=0;i<w;i++) path.moveTo(0,i*w/r).hr(w);
|
|
11767
|
+
for(let j=0;j<h;j++) path.moveTo(j*h/c,0).vr(h);
|
|
11768
|
+
return path
|
|
11769
|
+
};
|
|
13186
11770
|
|
|
13187
|
-
|
|
13188
|
-
|
|
13189
|
-
|
|
13190
|
-
|
|
13191
|
-
|
|
13192
|
-
|
|
13193
|
-
|
|
13194
|
-
|
|
13195
|
-
|
|
13196
|
-
|
|
13197
|
-
|
|
13198
|
-
|
|
13199
|
-
|
|
13200
|
-
|
|
13201
|
-
|
|
13202
|
-
|
|
13203
|
-
|
|
13204
|
-
|
|
13205
|
-
|
|
13206
|
-
|
|
13207
|
-
|
|
13208
|
-
|
|
13209
|
-
|
|
13210
|
-
|
|
11771
|
+
var SVG = /*#__PURE__*/Object.freeze({
|
|
11772
|
+
__proto__: null,
|
|
11773
|
+
Svg: Svg,
|
|
11774
|
+
ZikoSvgCircle: ZikoSvgCircle,
|
|
11775
|
+
ZikoSvgEllipse: ZikoSvgEllipse,
|
|
11776
|
+
ZikoSvgForeignObject: ZikoSvgForeignObject,
|
|
11777
|
+
ZikoSvgGroupe: ZikoSvgGroupe,
|
|
11778
|
+
ZikoSvgImage: ZikoSvgImage,
|
|
11779
|
+
ZikoSvgLine: ZikoSvgLine,
|
|
11780
|
+
ZikoSvgLink: ZikoSvgLink,
|
|
11781
|
+
ZikoSvgPath: ZikoSvgPath,
|
|
11782
|
+
ZikoSvgRectangle: ZikoSvgRectangle,
|
|
11783
|
+
ZikoSvgText: ZikoSvgText,
|
|
11784
|
+
ZikoUISvg: ZikoUISvg,
|
|
11785
|
+
svgCircle: svgCircle,
|
|
11786
|
+
svgEllipse: svgEllipse,
|
|
11787
|
+
svgGrid: svgGrid,
|
|
11788
|
+
svgGroupe: svgGroupe,
|
|
11789
|
+
svgImage: svgImage,
|
|
11790
|
+
svgLine: svgLine,
|
|
11791
|
+
svgLink: svgLink,
|
|
11792
|
+
svgObject: svgObject,
|
|
11793
|
+
svgPath: svgPath,
|
|
11794
|
+
svgPolygon: svgPolygon,
|
|
11795
|
+
svgRect: svgRect,
|
|
11796
|
+
svgText: svgText
|
|
11797
|
+
});
|
|
13211
11798
|
|
|
13212
|
-
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
|
|
13216
|
-
|
|
13217
|
-
|
|
13218
|
-
|
|
13219
|
-
|
|
13220
|
-
|
|
13221
|
-
|
|
13222
|
-
|
|
13223
|
-
|
|
13224
|
-
|
|
13225
|
-
|
|
13226
|
-
|
|
13227
|
-
|
|
13228
|
-
|
|
13229
|
-
|
|
13230
|
-
|
|
13231
|
-
|
|
13232
|
-
|
|
13233
|
-
|
|
13234
|
-
|
|
13235
|
-
|
|
13236
|
-
|
|
13237
|
-
|
|
13238
|
-
|
|
13239
|
-
|
|
13240
|
-
|
|
13241
|
-
|
|
13242
|
-
|
|
13243
|
-
|
|
13244
|
-
|
|
13245
|
-
|
|
13246
|
-
|
|
13247
|
-
|
|
13248
|
-
|
|
13249
|
-
|
|
13250
|
-
|
|
13251
|
-
|
|
13252
|
-
|
|
13253
|
-
|
|
13254
|
-
|
|
13255
|
-
|
|
13256
|
-
|
|
13257
|
-
|
|
13258
|
-
|
|
13259
|
-
|
|
13260
|
-
|
|
13261
|
-
|
|
13262
|
-
|
|
13263
|
-
|
|
13264
|
-
|
|
13265
|
-
|
|
13266
|
-
|
|
13267
|
-
|
|
13268
|
-
|
|
13269
|
-
|
|
13270
|
-
|
|
13271
|
-
|
|
13272
|
-
|
|
13273
|
-
|
|
13274
|
-
|
|
13275
|
-
|
|
13276
|
-
|
|
13277
|
-
|
|
13278
|
-
|
|
13279
|
-
|
|
13280
|
-
|
|
13281
|
-
|
|
13282
|
-
|
|
13283
|
-
|
|
13284
|
-
}
|
|
13285
|
-
}
|
|
13286
|
-
return this;
|
|
13287
|
-
},
|
|
13288
|
-
RemoveAll: function () {
|
|
13289
|
-
const keys = Object.keys(this);
|
|
13290
|
-
for (let i = 0; i < keys.length; i++) {
|
|
13291
|
-
const key = keys[i];
|
|
13292
|
-
if (key !== 'RemoveAll') {
|
|
13293
|
-
delete globalThis[key];
|
|
13294
|
-
}
|
|
13295
|
-
}
|
|
13296
|
-
return this;
|
|
13297
|
-
}
|
|
11799
|
+
// import{
|
|
11800
|
+
// Svg,
|
|
11801
|
+
// ZikoUISvg,
|
|
11802
|
+
// svgCircle,
|
|
11803
|
+
// svgEllipse,
|
|
11804
|
+
// svgImage,
|
|
11805
|
+
// svgLine,
|
|
11806
|
+
// svgPolygon,
|
|
11807
|
+
// svgRect,
|
|
11808
|
+
// svgText,
|
|
11809
|
+
// svgGroupe,
|
|
11810
|
+
// svgLink,
|
|
11811
|
+
// svgGrid,
|
|
11812
|
+
// svgObject,
|
|
11813
|
+
// svgPath
|
|
11814
|
+
// } from "./svg/index.js";
|
|
11815
|
+
// import {
|
|
11816
|
+
// Canvas,
|
|
11817
|
+
// canvasArc,
|
|
11818
|
+
// canvasCircle,
|
|
11819
|
+
// canvasPoints,
|
|
11820
|
+
// canvasLine,
|
|
11821
|
+
// canvasRect
|
|
11822
|
+
// } from "./canvas/index.js";
|
|
11823
|
+
// const Graphics={
|
|
11824
|
+
// Svg,
|
|
11825
|
+
// ZikoUISvg,
|
|
11826
|
+
// svgCircle,
|
|
11827
|
+
// svgEllipse,
|
|
11828
|
+
// svgImage,
|
|
11829
|
+
// svgLine,
|
|
11830
|
+
// svgPolygon,
|
|
11831
|
+
// svgRect,
|
|
11832
|
+
// svgText,
|
|
11833
|
+
// svgGroupe,
|
|
11834
|
+
// svgLink,
|
|
11835
|
+
// svgGrid,
|
|
11836
|
+
// svgObject,
|
|
11837
|
+
// svgPath,
|
|
11838
|
+
// Canvas,
|
|
11839
|
+
// canvasArc,
|
|
11840
|
+
// canvasCircle,
|
|
11841
|
+
// canvasPoints,
|
|
11842
|
+
// canvasLine,
|
|
11843
|
+
// canvasRect,
|
|
11844
|
+
// ExtractAll: function () {
|
|
11845
|
+
// const keys = Object.keys(this);
|
|
11846
|
+
// for (let i = 0; i < keys.length; i++) {
|
|
11847
|
+
// const key = keys[i];
|
|
11848
|
+
// if (key !== 'ExtractAll' && key !== 'RemoveAll') {
|
|
11849
|
+
// globalThis[key] = this[key];
|
|
11850
|
+
// }
|
|
11851
|
+
// }
|
|
11852
|
+
// return this;
|
|
11853
|
+
// },
|
|
11854
|
+
// RemoveAll: function () {
|
|
11855
|
+
// const keys = Object.keys(this);
|
|
11856
|
+
// for (let i = 0; i < keys.length; i++) {
|
|
11857
|
+
// const key = keys[i];
|
|
11858
|
+
// if (key !== 'RemoveAll') {
|
|
11859
|
+
// delete globalThis[key];
|
|
11860
|
+
// }
|
|
11861
|
+
// }
|
|
11862
|
+
// return this;
|
|
11863
|
+
// }
|
|
11864
|
+
// }
|
|
11865
|
+
// export * from "./svg/index.js"
|
|
11866
|
+
// export * from "./canvas/index.js"
|
|
11867
|
+
// export default Graphics;
|
|
11868
|
+
|
|
11869
|
+
const Graphics = {
|
|
11870
|
+
...SVG
|
|
13298
11871
|
};
|
|
13299
11872
|
|
|
13300
11873
|
class ZikoApp {
|
|
@@ -13630,7 +12203,8 @@ const App={
|
|
|
13630
12203
|
UI$1,
|
|
13631
12204
|
Time,
|
|
13632
12205
|
Data,
|
|
13633
|
-
Reactivity
|
|
12206
|
+
Reactivity,
|
|
12207
|
+
Graphics
|
|
13634
12208
|
].forEach(n=>Object.assign(n,{
|
|
13635
12209
|
ExtractAll:()=>__ExtractAll__(n),
|
|
13636
12210
|
RemoveAll:()=>__RemoveAll__(n)
|
|
@@ -13693,7 +12267,6 @@ exports.Article = Article;
|
|
|
13693
12267
|
exports.Aside = Aside;
|
|
13694
12268
|
exports.Base = Base;
|
|
13695
12269
|
exports.Breadcrumbs = Breadcrumbs;
|
|
13696
|
-
exports.Canvas = Canvas;
|
|
13697
12270
|
exports.Carousel = Carousel;
|
|
13698
12271
|
exports.CodeCell = CodeCell;
|
|
13699
12272
|
exports.CodeNote = CodeNote;
|
|
@@ -13734,6 +12307,16 @@ exports.ZikoApp = ZikoApp;
|
|
|
13734
12307
|
exports.ZikoJsonStyleSheet = ZikoJsonStyleSheet;
|
|
13735
12308
|
exports.ZikoMutationObserver = ZikoMutationObserver;
|
|
13736
12309
|
exports.ZikoSPA = ZikoSPA;
|
|
12310
|
+
exports.ZikoSvgCircle = ZikoSvgCircle;
|
|
12311
|
+
exports.ZikoSvgEllipse = ZikoSvgEllipse;
|
|
12312
|
+
exports.ZikoSvgForeignObject = ZikoSvgForeignObject;
|
|
12313
|
+
exports.ZikoSvgGroupe = ZikoSvgGroupe;
|
|
12314
|
+
exports.ZikoSvgImage = ZikoSvgImage;
|
|
12315
|
+
exports.ZikoSvgLine = ZikoSvgLine;
|
|
12316
|
+
exports.ZikoSvgLink = ZikoSvgLink;
|
|
12317
|
+
exports.ZikoSvgPath = ZikoSvgPath;
|
|
12318
|
+
exports.ZikoSvgRectangle = ZikoSvgRectangle;
|
|
12319
|
+
exports.ZikoSvgText = ZikoSvgText;
|
|
13737
12320
|
exports.ZikoUIAbbrText = ZikoUIAbbrText;
|
|
13738
12321
|
exports.ZikoUIAccordion = ZikoUIAccordion;
|
|
13739
12322
|
exports.ZikoUIArticle = ZikoUIArticle;
|
|
@@ -13742,10 +12325,11 @@ exports.ZikoUIAudio = ZikoUIAudio;
|
|
|
13742
12325
|
exports.ZikoUIBlockQuote = ZikoUIBlockQuote;
|
|
13743
12326
|
exports.ZikoUIBr = ZikoUIBr;
|
|
13744
12327
|
exports.ZikoUIBreadcrumbs = ZikoUIBreadcrumbs;
|
|
13745
|
-
exports.ZikoUICanvas = ZikoUICanvas;
|
|
13746
12328
|
exports.ZikoUICodeNote = ZikoUICodeNote;
|
|
13747
12329
|
exports.ZikoUICodeText = ZikoUICodeText;
|
|
12330
|
+
exports.ZikoUIContainerElement = ZikoUIContainerElement;
|
|
13748
12331
|
exports.ZikoUIDefintion = ZikoUIDefintion;
|
|
12332
|
+
exports.ZikoUIElement = ZikoUIElement;
|
|
13749
12333
|
exports.ZikoUIFigure = ZikoUIFigure;
|
|
13750
12334
|
exports.ZikoUIFlex = ZikoUIFlex$1;
|
|
13751
12335
|
exports.ZikoUIFooter = ZikoUIFooter;
|
|
@@ -13818,11 +12402,6 @@ exports.blockQuote = blockQuote;
|
|
|
13818
12402
|
exports.br = br;
|
|
13819
12403
|
exports.brs = brs;
|
|
13820
12404
|
exports.btn = btn;
|
|
13821
|
-
exports.canvasArc = canvasArc;
|
|
13822
|
-
exports.canvasCircle = canvasCircle;
|
|
13823
|
-
exports.canvasLine = canvasLine;
|
|
13824
|
-
exports.canvasPoints = canvasPoints;
|
|
13825
|
-
exports.canvasRect = canvasRect;
|
|
13826
12405
|
exports.cartesianProduct = cartesianProduct;
|
|
13827
12406
|
exports.ceil = ceil;
|
|
13828
12407
|
exports.checkbox = checkbox;
|
|
@@ -13959,7 +12538,6 @@ exports.svgLine = svgLine;
|
|
|
13959
12538
|
exports.svgLink = svgLink;
|
|
13960
12539
|
exports.svgObject = svgObject;
|
|
13961
12540
|
exports.svgPath = svgPath;
|
|
13962
|
-
exports.svgPolyLine = svgPolyLine;
|
|
13963
12541
|
exports.svgPolygon = svgPolygon;
|
|
13964
12542
|
exports.svgRect = svgRect;
|
|
13965
12543
|
exports.svgText = svgText;
|