ziko 0.0.11 → 0.0.12
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/README.md +6 -3
- package/dist/ziko.cjs +977 -475
- package/dist/ziko.js +977 -475
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +948 -476
- package/package.json +1 -1
package/dist/ziko.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date :
|
|
5
|
+
Date : Wed Sep 04 2024 17:52:59 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
|
|
@@ -1342,7 +1342,7 @@ class ZikoUIElementStyle{
|
|
|
1342
1342
|
// return this;
|
|
1343
1343
|
// }
|
|
1344
1344
|
style(styles){
|
|
1345
|
-
Object.assign(this
|
|
1345
|
+
if(this?.target?.element?.style)Object.assign(this?.target?.element?.style, styles);
|
|
1346
1346
|
return this;
|
|
1347
1347
|
}
|
|
1348
1348
|
linkTo(target){
|
|
@@ -3085,7 +3085,7 @@ class ZikoUseTheme{
|
|
|
3085
3085
|
return this;
|
|
3086
3086
|
}
|
|
3087
3087
|
}
|
|
3088
|
-
const useTheme=(id=0)=>
|
|
3088
|
+
const useTheme=(theme, id=0)=>new ZikoUseTheme(theme,id);
|
|
3089
3089
|
|
|
3090
3090
|
class ZikoUseEventEmitter {
|
|
3091
3091
|
constructor() {
|
|
@@ -3190,7 +3190,7 @@ class ZikoUseFavIcon{
|
|
|
3190
3190
|
this.set(FavIcon);
|
|
3191
3191
|
}
|
|
3192
3192
|
#init(){
|
|
3193
|
-
this.__FavIcon__=document.querySelector("link[rel*='icon']") || document
|
|
3193
|
+
this.__FavIcon__=document.querySelector("link[rel*='icon']") || document?.createElement('link');
|
|
3194
3194
|
this.__FavIcon__.type = 'image/x-icon';
|
|
3195
3195
|
this.__FavIcon__.rel = 'shortcut icon';
|
|
3196
3196
|
return this;
|
|
@@ -3441,6 +3441,15 @@ function pointerout_controller(e){
|
|
|
3441
3441
|
null
|
|
3442
3442
|
);
|
|
3443
3443
|
}
|
|
3444
|
+
function pointercancel_controller(e){
|
|
3445
|
+
EVENT_CONTROLLER.call(
|
|
3446
|
+
this,
|
|
3447
|
+
e,
|
|
3448
|
+
"cancel",
|
|
3449
|
+
null,
|
|
3450
|
+
null
|
|
3451
|
+
);
|
|
3452
|
+
}
|
|
3444
3453
|
class ZikoEventPointer extends ZikoEvent{
|
|
3445
3454
|
constructor(target){
|
|
3446
3455
|
super(target);
|
|
@@ -3471,6 +3480,7 @@ class ZikoEventPointer extends ZikoEvent{
|
|
|
3471
3480
|
enter:false,
|
|
3472
3481
|
out:false,
|
|
3473
3482
|
leave:false,
|
|
3483
|
+
cancel:false
|
|
3474
3484
|
},
|
|
3475
3485
|
paused:{
|
|
3476
3486
|
down:false,
|
|
@@ -3478,7 +3488,8 @@ class ZikoEventPointer extends ZikoEvent{
|
|
|
3478
3488
|
up:false,
|
|
3479
3489
|
enter:false,
|
|
3480
3490
|
out:false,
|
|
3481
|
-
leave:false,
|
|
3491
|
+
leave:false,
|
|
3492
|
+
cancel:false
|
|
3482
3493
|
},
|
|
3483
3494
|
stream:{
|
|
3484
3495
|
enabled:{
|
|
@@ -3488,6 +3499,7 @@ class ZikoEventPointer extends ZikoEvent{
|
|
|
3488
3499
|
enter:false,
|
|
3489
3500
|
out:false,
|
|
3490
3501
|
leave:false,
|
|
3502
|
+
cancel:false
|
|
3491
3503
|
},
|
|
3492
3504
|
clear:{
|
|
3493
3505
|
down:false,
|
|
@@ -3495,7 +3507,8 @@ class ZikoEventPointer extends ZikoEvent{
|
|
|
3495
3507
|
up:false,
|
|
3496
3508
|
enter:false,
|
|
3497
3509
|
out:false,
|
|
3498
|
-
leave:false,
|
|
3510
|
+
leave:false,
|
|
3511
|
+
cancel:false
|
|
3499
3512
|
},
|
|
3500
3513
|
history:{
|
|
3501
3514
|
down:[],
|
|
@@ -3512,7 +3525,8 @@ class ZikoEventPointer extends ZikoEvent{
|
|
|
3512
3525
|
up:[(self)=>console.log({ux:self.ux,uy:self.uy,down:self.down,move:self.move,t:self.dt})],
|
|
3513
3526
|
enter:[(self)=>console.log({dx:self.dx,dy:self.dy,down:self.down,move:self.move,t:self.dt})],
|
|
3514
3527
|
out:[(self)=>console.log({mx:self.mx,my:self.my,down:self.down,move:self.move,t:self.dt})],
|
|
3515
|
-
leave:[(self)=>console.log({ux:self.ux,uy:self.uy,down:self.down,move:self.move,t:self.dt})]
|
|
3528
|
+
leave:[(self)=>console.log({ux:self.ux,uy:self.uy,down:self.down,move:self.move,t:self.dt})],
|
|
3529
|
+
cancel:[(self)=>console.log({ux:self.ux,uy:self.uy,down:self.down,move:self.move,t:self.dt})]
|
|
3516
3530
|
}
|
|
3517
3531
|
};
|
|
3518
3532
|
this.__controller={
|
|
@@ -3522,36 +3536,42 @@ class ZikoEventPointer extends ZikoEvent{
|
|
|
3522
3536
|
enter:pointerenter_controller.bind(this),
|
|
3523
3537
|
out:pointerout_controller.bind(this),
|
|
3524
3538
|
leave:pointerleave_controller.bind(this),
|
|
3539
|
+
cancel:pointercancel_controller.bind(this),
|
|
3525
3540
|
};
|
|
3526
3541
|
}
|
|
3527
3542
|
onDown(...callbacks){
|
|
3528
3543
|
if(callbacks.length===0)callbacks=[()=>{}];
|
|
3529
|
-
this.__onEvent("down",{down:true,move:false,up:false,enter:false,out:false,leave:false},...callbacks);
|
|
3544
|
+
this.__onEvent("down",{down:true,move:false,up:false,enter:false,out:false,leave:false,cancel:false},...callbacks);
|
|
3530
3545
|
return this;
|
|
3531
3546
|
}
|
|
3532
3547
|
onMove(...callbacks){
|
|
3533
3548
|
if(callbacks.length===0)callbacks=[()=>{}];
|
|
3534
|
-
this.__onEvent("move",{down:false,move:true,up:false,enter:false,out:false,leave:false},...callbacks);
|
|
3549
|
+
this.__onEvent("move",{down:false,move:true,up:false,enter:false,out:false,leave:false,cancel:false},...callbacks);
|
|
3535
3550
|
return this;
|
|
3536
3551
|
}
|
|
3537
3552
|
onUp(...callbacks){
|
|
3538
3553
|
if(callbacks.length===0)callbacks=[()=>{}];
|
|
3539
|
-
this.__onEvent("up",{down:false,move:false,up:true,enter:false,out:false,leave:false},...callbacks);
|
|
3554
|
+
this.__onEvent("up",{down:false,move:false,up:true,enter:false,out:false,leave:false,cancel:false},...callbacks);
|
|
3540
3555
|
return this;
|
|
3541
3556
|
}
|
|
3542
3557
|
onEnter(...callbacks){
|
|
3543
3558
|
if(callbacks.length===0)callbacks=[()=>{}];
|
|
3544
|
-
this.__onEvent("enter",{down:false,move:false,up:false,enter:true,out:false,leave:false},...callbacks);
|
|
3559
|
+
this.__onEvent("enter",{down:false,move:false,up:false,enter:true,out:false,leave:false,cancel:false},...callbacks);
|
|
3545
3560
|
return this;
|
|
3546
3561
|
}
|
|
3547
3562
|
onOut(...callbacks){
|
|
3548
3563
|
if(callbacks.length===0)callbacks=[()=>{}];
|
|
3549
|
-
this.__onEvent("out",{down:false,move:false,up:false,enter:false,out:true,leave:false},...callbacks);
|
|
3564
|
+
this.__onEvent("out",{down:false,move:false,up:false,enter:false,out:true,leave:false,cancel:false},...callbacks);
|
|
3550
3565
|
return this;
|
|
3551
3566
|
}
|
|
3552
3567
|
onLeave(...callbacks){
|
|
3553
3568
|
if(callbacks.length===0)callbacks=[()=>{}];
|
|
3554
|
-
this.__onEvent("leave",{down:false,move:false,up:false,enter:false,out:false,leave:true},...callbacks);
|
|
3569
|
+
this.__onEvent("leave",{down:false,move:false,up:false,enter:false,out:false,leave:true,cancel:false},...callbacks);
|
|
3570
|
+
return this;
|
|
3571
|
+
}
|
|
3572
|
+
onCancel(...callbacks){
|
|
3573
|
+
if(callbacks.length===0)callbacks=[()=>{}];
|
|
3574
|
+
this.__onEvent("cancel",{down:false,move:false,up:false,enter:false,out:false,leave:false,cancel:true},...callbacks);
|
|
3555
3575
|
return this;
|
|
3556
3576
|
}
|
|
3557
3577
|
// handle({down=false,move=false,up=false}={}){
|
|
@@ -4953,91 +4973,6 @@ class ZikoUseGeolocation{
|
|
|
4953
4973
|
}
|
|
4954
4974
|
const useGeolocation=()=>new ZikoUseGeolocation();
|
|
4955
4975
|
|
|
4956
|
-
function useType(func, ...expectedTypes) {
|
|
4957
|
-
const argNames = func.toString()
|
|
4958
|
-
.match(/\(([^)]*)\)/)[1]
|
|
4959
|
-
.split(',')
|
|
4960
|
-
.map(arg => arg.trim());
|
|
4961
|
-
return function(...args) {
|
|
4962
|
-
const lastExpectedType = expectedTypes[expectedTypes.length - 1];
|
|
4963
|
-
for (let i = 0; i < args.length; i++) {
|
|
4964
|
-
const isRestParam = i >= expectedTypes.length;
|
|
4965
|
-
const expectedType = isRestParam ? lastExpectedType : expectedTypes[i];
|
|
4966
|
-
const arg = args[i];
|
|
4967
|
-
isRestParam ? `${argNames[argNames.length - 1]}[${i - expectedTypes.length + 1}]` : argNames[i] || `Argument ${i + 1}`;
|
|
4968
|
-
let isValid = false;
|
|
4969
|
-
if(typeof expectedType === "object"){
|
|
4970
|
-
if (expectedType.or) {
|
|
4971
|
-
for (const type of expectedType.types) {
|
|
4972
|
-
if (checkTypeOrInstance(type, arg)) {
|
|
4973
|
-
isValid = true;
|
|
4974
|
-
break;
|
|
4975
|
-
}
|
|
4976
|
-
}
|
|
4977
|
-
}
|
|
4978
|
-
if (expectedType.nor) {
|
|
4979
|
-
for (const type of expectedType.types) {
|
|
4980
|
-
if (checkTypeOrInstance(type, arg)) {
|
|
4981
|
-
isValid = false;
|
|
4982
|
-
break;
|
|
4983
|
-
}
|
|
4984
|
-
isValid = true;
|
|
4985
|
-
}
|
|
4986
|
-
}
|
|
4987
|
-
else if (expectedType.not) isValid = !checkTypeOrInstance(expectedType.type, arg);
|
|
4988
|
-
}
|
|
4989
|
-
else isValid = checkTypeOrInstance(expectedType, arg);
|
|
4990
|
-
// Should Fix Nor error Message
|
|
4991
|
-
if (!isValid) {
|
|
4992
|
-
// const expectedTypeName = typeof expectedType === 'object'
|
|
4993
|
-
// ? expectedType.or
|
|
4994
|
-
// ? expectedType.types.map(type => (typeof type === 'string' ? type : type.name)).join(' or ')
|
|
4995
|
-
// : expectedType.not
|
|
4996
|
-
// ? `not ${typeof expectedType.type === 'string' ? expectedType.type : expectedType.type.name}`
|
|
4997
|
-
// : Array.isArray(expectedType)
|
|
4998
|
-
// ? `[${expectedType.map(type => (typeof type === 'string' ? type : type.name)).join(', ')}]`
|
|
4999
|
-
// : `{${Object.entries(expectedType).map(([key, type]) => `${key}: ${typeof type === 'string' ? type : type.name}`).join(', ')}}`
|
|
5000
|
-
// : typeof expectedType === 'string'
|
|
5001
|
-
// ? expectedType
|
|
5002
|
-
// : expectedType.name;
|
|
5003
|
-
// throw new TypeError(`${argName} should be of type ${expectedTypeName}`);
|
|
5004
|
-
throw new TypeError("jjj")
|
|
5005
|
-
}
|
|
5006
|
-
}
|
|
5007
|
-
return func(...args);
|
|
5008
|
-
};
|
|
5009
|
-
}
|
|
5010
|
-
|
|
5011
|
-
function useOr(...types) {
|
|
5012
|
-
return { or: true, types };
|
|
5013
|
-
}
|
|
5014
|
-
function useNot(type) {
|
|
5015
|
-
return { not: true, type };
|
|
5016
|
-
}
|
|
5017
|
-
function useNor(...types){
|
|
5018
|
-
return { nor: true, types}
|
|
5019
|
-
}
|
|
5020
|
-
const checkTypeOrInstance = (type, arg) => {
|
|
5021
|
-
if (typeof type === 'string') return typeof arg === type;
|
|
5022
|
-
else if (type instanceof Function) return arg instanceof type;
|
|
5023
|
-
else if (Array.isArray(type))
|
|
5024
|
-
return (!Array.isArray(arg) || arg.length !== type.length)? false: arg.every((item, index) => checkTypeOrInstance(type[index], item));
|
|
5025
|
-
else if (typeof type === 'object' && !Array.isArray(type))
|
|
5026
|
-
return (typeof arg !== 'object' || arg === null)? false : Object.keys(type).every(key => key in arg && checkTypeOrInstance(type[key], arg[key]))
|
|
5027
|
-
return false;
|
|
5028
|
-
};
|
|
5029
|
-
globalThis.useType = useType;
|
|
5030
|
-
globalThis.useNot = useNot;
|
|
5031
|
-
globalThis.useOr = useOr;
|
|
5032
|
-
|
|
5033
|
-
function add$1(a, b = 0){
|
|
5034
|
-
return a+b
|
|
5035
|
-
}
|
|
5036
|
-
|
|
5037
|
-
add$1 = useType(add$1,"number",useNor("string","number"));
|
|
5038
|
-
|
|
5039
|
-
console.log(add$1(1));
|
|
5040
|
-
|
|
5041
4976
|
class ZikoTimeLoop {
|
|
5042
4977
|
constructor(callback, step = 1000/30, startTime=0, endTime = Infinity, started = true) {
|
|
5043
4978
|
this.callback = callback;
|
|
@@ -5303,7 +5238,7 @@ const waitForUIElm=(UIElement)=>{
|
|
|
5303
5238
|
}
|
|
5304
5239
|
});
|
|
5305
5240
|
|
|
5306
|
-
observer.observe(document
|
|
5241
|
+
observer.observe(document?.body, {
|
|
5307
5242
|
childList: true,
|
|
5308
5243
|
subtree: true
|
|
5309
5244
|
});
|
|
@@ -5571,9 +5506,9 @@ const Reactivity={
|
|
|
5571
5506
|
|
|
5572
5507
|
class ZikoUIElement {
|
|
5573
5508
|
constructor(element,name="") {
|
|
5574
|
-
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis
|
|
5509
|
+
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
|
|
5575
5510
|
if(typeof element === "string") {
|
|
5576
|
-
element === "svg" ? element=document
|
|
5511
|
+
element === "svg" ? element=globalThis?.document?.createElementNS("http://www.w3.org/2000/svg", "svg"): element = globalThis?.document?.createElement(element);
|
|
5577
5512
|
}
|
|
5578
5513
|
this.element = element;
|
|
5579
5514
|
this.uuid=this.constructor.name+"-"+Random.string(10);
|
|
@@ -5681,6 +5616,41 @@ class ZikoUIElement {
|
|
|
5681
5616
|
this.st.size(width,height);
|
|
5682
5617
|
return this;
|
|
5683
5618
|
}
|
|
5619
|
+
get #SwitchedStyleRTL_LTR(){
|
|
5620
|
+
const CalculedStyle = globalThis.getComputedStyle(this.element);
|
|
5621
|
+
const SwitchedStyle = {};
|
|
5622
|
+
if(CalculedStyle.marginRight!=="0px")Object.assign(SwitchedStyle, {marginLeft: CalculedStyle.marginRight});
|
|
5623
|
+
if(CalculedStyle.marginLeft!=="0px")Object.assign(SwitchedStyle, {marginRight: CalculedStyle.marginLeft});
|
|
5624
|
+
if(CalculedStyle.paddingRight!=="0px")Object.assign(SwitchedStyle, {paddingLeft: CalculedStyle.paddingRight});
|
|
5625
|
+
if(CalculedStyle.paddingLeft!=="0px")Object.assign(SwitchedStyle, {paddingRight: CalculedStyle.paddingLeft});
|
|
5626
|
+
if(CalculedStyle.left!=="0px")Object.assign(SwitchedStyle, {right: CalculedStyle.left});
|
|
5627
|
+
if(CalculedStyle.right!=="0px")Object.assign(SwitchedStyle, {left: CalculedStyle.right});
|
|
5628
|
+
if(CalculedStyle.textAlign === "right")Object.assign(SwitchedStyle, {textAlign: "left"});
|
|
5629
|
+
if(CalculedStyle.textAlign === "left")Object.assign(SwitchedStyle, {textAlign: "right"});
|
|
5630
|
+
if(CalculedStyle.float === "right")Object.assign(SwitchedStyle, {float: "left"});
|
|
5631
|
+
if(CalculedStyle.float === "left")Object.assign(SwitchedStyle, {float: "right"});
|
|
5632
|
+
if(CalculedStyle.borderRadiusLeft!=="0px")Object.assign(SwitchedStyle, {right: CalculedStyle.borderRadiusRight});
|
|
5633
|
+
if(CalculedStyle.borderRadiusRight!=="0px")Object.assign(SwitchedStyle, {right: CalculedStyle.borderRadiusLeft});
|
|
5634
|
+
if(["flex","inline-flex"].includes(CalculedStyle.display)){
|
|
5635
|
+
if(CalculedStyle.justifyContent === "flex-end")Object.assign(SwitchedStyle, {justifyContent: "flex-start"});
|
|
5636
|
+
if(CalculedStyle.justifyContent === "flex-start")Object.assign(SwitchedStyle, {justifyContent: "flex-end"});
|
|
5637
|
+
}
|
|
5638
|
+
return SwitchedStyle;
|
|
5639
|
+
}
|
|
5640
|
+
useRtl(switchAll = false){
|
|
5641
|
+
switchAll ? this.style({
|
|
5642
|
+
...this.#SwitchedStyleRTL_LTR,
|
|
5643
|
+
direction : "rtl"
|
|
5644
|
+
}) : this.style({direction : "rtl"});
|
|
5645
|
+
return this;
|
|
5646
|
+
}
|
|
5647
|
+
useLtr(switchAll = false){
|
|
5648
|
+
switchAll ? this.style({
|
|
5649
|
+
...this.#SwitchedStyleRTL_LTR,
|
|
5650
|
+
direction : "ltr"
|
|
5651
|
+
}) : this.style({direction : "ltr"});
|
|
5652
|
+
return this;
|
|
5653
|
+
}
|
|
5684
5654
|
freeze(freeze){
|
|
5685
5655
|
this.cache.isFrozzen=freeze;
|
|
5686
5656
|
return this;
|
|
@@ -5695,7 +5665,7 @@ class ZikoUIElement {
|
|
|
5695
5665
|
render(/*render = true , */target = this.target) {
|
|
5696
5666
|
if(target instanceof ZikoUIElement)target=target.element;
|
|
5697
5667
|
this.target=target;
|
|
5698
|
-
this.target
|
|
5668
|
+
this.target?.appendChild(this.element);
|
|
5699
5669
|
// if(render) {
|
|
5700
5670
|
// this.target.appendChild(this.element);
|
|
5701
5671
|
// }
|
|
@@ -5704,7 +5674,7 @@ class ZikoUIElement {
|
|
|
5704
5674
|
}
|
|
5705
5675
|
unrender(){
|
|
5706
5676
|
if(this.cache.parent)this.cache.parent.remove(this);
|
|
5707
|
-
else if(this.target
|
|
5677
|
+
else if(this.target?.children?.length && [...this.target?.children].includes(this.element)) this.target.removeChild(this.element);
|
|
5708
5678
|
return this;
|
|
5709
5679
|
}
|
|
5710
5680
|
renderAfter(t = 1) {
|
|
@@ -5802,6 +5772,11 @@ class ZikoUIElement {
|
|
|
5802
5772
|
this.events.ptr.onOut(...callbacks);
|
|
5803
5773
|
return this;
|
|
5804
5774
|
}
|
|
5775
|
+
onPtrCancel(...callbacks){
|
|
5776
|
+
if(!this.events.ptr)this.events.ptr = usePointerEvent(this);
|
|
5777
|
+
this.events.ptr.onCancel(...callbacks);
|
|
5778
|
+
return this;
|
|
5779
|
+
}
|
|
5805
5780
|
onMouseMove(...callbacks){
|
|
5806
5781
|
if(!this.events.mouse)this.events.mouse = useMouseEvent(this);
|
|
5807
5782
|
this.events.mouse.onMove(...callbacks);
|
|
@@ -5991,6 +5966,9 @@ class ZikoUIImage extends ZikoUIElement {
|
|
|
5991
5966
|
if (typeof w == "number") w += "%";
|
|
5992
5967
|
if (typeof h == "number") h += "%";
|
|
5993
5968
|
this.style({ border: "1px solid black", width: w, height: h });
|
|
5969
|
+
}
|
|
5970
|
+
get isImg(){
|
|
5971
|
+
return true;
|
|
5994
5972
|
}
|
|
5995
5973
|
updateSrc(url){
|
|
5996
5974
|
this.value=url;
|
|
@@ -6015,22 +5993,21 @@ class ZikoUIFigure extends ZikoUIElement{
|
|
|
6015
5993
|
constructor(src,caption){
|
|
6016
5994
|
super("figure","figure");
|
|
6017
5995
|
this.img=src.width("100%").element;
|
|
6018
|
-
this.caption=document
|
|
5996
|
+
this.caption=document?.createElementt("figcaption");
|
|
6019
5997
|
this.caption.append(caption.element);
|
|
6020
5998
|
this.element.append(this.img);
|
|
6021
5999
|
this.element.append(this.caption);
|
|
6022
6000
|
}
|
|
6001
|
+
get isFigure(){
|
|
6002
|
+
return true;
|
|
6003
|
+
}
|
|
6023
6004
|
}
|
|
6024
6005
|
const figure =(image,caption) =>new ZikoUIFigure(image,caption);
|
|
6025
6006
|
|
|
6026
|
-
class
|
|
6027
|
-
constructor(
|
|
6028
|
-
super(
|
|
6029
|
-
|
|
6030
|
-
else this.element.setAttribute("src", src);
|
|
6031
|
-
if (typeof w == "number") w += "%";
|
|
6032
|
-
if (typeof h == "number") h += "%";
|
|
6033
|
-
this.style({ width: w, height: h });
|
|
6007
|
+
class __ZikoUIDynamicMediaElement__ extends ZikoUIElement {
|
|
6008
|
+
constructor(element, name) {
|
|
6009
|
+
super(element, name);
|
|
6010
|
+
this.useControls();
|
|
6034
6011
|
}
|
|
6035
6012
|
get t(){
|
|
6036
6013
|
return this.element.currentTime;
|
|
@@ -6039,20 +6016,24 @@ class ZikoUIVideo extends ZikoUIElement {
|
|
|
6039
6016
|
this.element.controls = enabled;
|
|
6040
6017
|
return this;
|
|
6041
6018
|
}
|
|
6042
|
-
|
|
6043
|
-
this.element.
|
|
6019
|
+
enableControls(){
|
|
6020
|
+
this.element.controls = true;
|
|
6044
6021
|
return this;
|
|
6045
6022
|
}
|
|
6046
|
-
|
|
6047
|
-
this.element.
|
|
6023
|
+
disableControls(){
|
|
6024
|
+
this.element.controls = true;
|
|
6048
6025
|
return this;
|
|
6049
6026
|
}
|
|
6050
|
-
|
|
6051
|
-
this.element.
|
|
6027
|
+
toggleControls(){
|
|
6028
|
+
this.element.controls = !this.element.controls;
|
|
6052
6029
|
return this;
|
|
6053
6030
|
}
|
|
6054
|
-
|
|
6055
|
-
this.element.
|
|
6031
|
+
play() {
|
|
6032
|
+
this.element.play();
|
|
6033
|
+
return this;
|
|
6034
|
+
}
|
|
6035
|
+
pause() {
|
|
6036
|
+
this.element.pause();
|
|
6056
6037
|
return this;
|
|
6057
6038
|
}
|
|
6058
6039
|
seekTo(time) {
|
|
@@ -6065,39 +6046,40 @@ class ZikoUIVideo extends ZikoUIElement {
|
|
|
6065
6046
|
onPause(){
|
|
6066
6047
|
|
|
6067
6048
|
}
|
|
6068
|
-
}
|
|
6069
|
-
const video = (src, width, height) => new ZikoUIVideo(src, width, height);
|
|
6049
|
+
}
|
|
6070
6050
|
|
|
6071
|
-
class
|
|
6072
|
-
constructor(src) {
|
|
6073
|
-
super("
|
|
6074
|
-
this.element.setAttribute("src", src);
|
|
6075
|
-
this.
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
}
|
|
6080
|
-
useControls(enabled = true) {
|
|
6081
|
-
this.element.controls = enabled;
|
|
6082
|
-
return this;
|
|
6051
|
+
class ZikoUIVideo extends __ZikoUIDynamicMediaElement__ {
|
|
6052
|
+
constructor(src="", w = "100%", h = "50vh") {
|
|
6053
|
+
super("video","video");
|
|
6054
|
+
if (src.nodeName === "VIDEO") this.element.setAttribute("src", src.src);
|
|
6055
|
+
else this.element.setAttribute("src", src);
|
|
6056
|
+
if (typeof w == "number") w += "%";
|
|
6057
|
+
if (typeof h == "number") h += "%";
|
|
6058
|
+
this.style({ width: w, height: h });
|
|
6083
6059
|
}
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
return this;
|
|
6060
|
+
get isVideo(){
|
|
6061
|
+
return true;
|
|
6087
6062
|
}
|
|
6088
|
-
|
|
6089
|
-
this.element.
|
|
6063
|
+
usePoster(src=""){
|
|
6064
|
+
this.element.poster=src;
|
|
6090
6065
|
return this;
|
|
6091
6066
|
}
|
|
6092
|
-
|
|
6093
|
-
this.element.
|
|
6067
|
+
usePIP(e){
|
|
6068
|
+
this.element.requestPictureInPicture(e);
|
|
6094
6069
|
return this;
|
|
6095
6070
|
}
|
|
6096
|
-
|
|
6097
|
-
|
|
6071
|
+
}
|
|
6072
|
+
const video = (src, width, height) => new ZikoUIVideo(src, width, height);
|
|
6073
|
+
|
|
6074
|
+
class ZikoUIAudio extends __ZikoUIDynamicMediaElement__ {
|
|
6075
|
+
constructor(src) {
|
|
6076
|
+
super("audio","audio");
|
|
6077
|
+
this.element.setAttribute("src", src);
|
|
6078
|
+
this.size("150px","30px");
|
|
6079
|
+
// this.useControls();
|
|
6098
6080
|
}
|
|
6099
|
-
|
|
6100
|
-
|
|
6081
|
+
get isAudio(){
|
|
6082
|
+
return true;
|
|
6101
6083
|
}
|
|
6102
6084
|
}
|
|
6103
6085
|
const audio = (src) => new ZikoUIAudio(src);
|
|
@@ -7080,8 +7062,8 @@ class Matrix extends ZikoMath{
|
|
|
7080
7062
|
}
|
|
7081
7063
|
toTable() {
|
|
7082
7064
|
var table = new DocumentFragment();
|
|
7083
|
-
var Tr = new Array(this.rows).fill(null).map(() => document
|
|
7084
|
-
var Td = this.arr.map((n) => n.map(() => document
|
|
7065
|
+
var Tr = new Array(this.rows).fill(null).map(() => document?.createElement("tr"));
|
|
7066
|
+
var Td = this.arr.map((n) => n.map(() => document?.createElement("td")));
|
|
7085
7067
|
for (let i = 0; i < Td.length; i++) {
|
|
7086
7068
|
for (let j = 0; j < Td[0].length; j++) {
|
|
7087
7069
|
Td[i][j].innerHTML = this.arr[i][j];
|
|
@@ -8094,6 +8076,9 @@ class __ZikoUIText__ extends ZikoUIContainerElement {
|
|
|
8094
8076
|
lineBreak,
|
|
8095
8077
|
});
|
|
8096
8078
|
}
|
|
8079
|
+
get isText(){
|
|
8080
|
+
return true;
|
|
8081
|
+
}
|
|
8097
8082
|
get value(){
|
|
8098
8083
|
return this.element.textContent;
|
|
8099
8084
|
}
|
|
@@ -8104,11 +8089,11 @@ class __ZikoUIText__ extends ZikoUIContainerElement {
|
|
|
8104
8089
|
}
|
|
8105
8090
|
addValue(...value) {
|
|
8106
8091
|
value.forEach((item,i) => {
|
|
8107
|
-
if (typeof item === "string" || typeof item === "number") this.element
|
|
8108
|
-
else if (item instanceof ZikoUIElement) this.element
|
|
8109
|
-
else if (item instanceof Complex || item instanceof Matrix) this.element
|
|
8110
|
-
else if (item instanceof Array) this.element
|
|
8111
|
-
else if (item instanceof Object) this.element
|
|
8092
|
+
if (typeof item === "string" || typeof item === "number") this.element?.appendChild(globalThis?.document.createTextNode(item));
|
|
8093
|
+
else if (item instanceof ZikoUIElement) this.element?.appendChild(item.element);
|
|
8094
|
+
else if (item instanceof Complex || item instanceof Matrix) this.element?.appendChild(new Text(item.toString()));
|
|
8095
|
+
else if (item instanceof Array) this.element?.appendChild(new Text(arr2str(item)));
|
|
8096
|
+
else if (item instanceof Object) this.element?.appendChild(new Text(obj2str(item)));
|
|
8112
8097
|
|
|
8113
8098
|
// if(
|
|
8114
8099
|
// (item !== value[value.length - 1])
|
|
@@ -8116,11 +8101,11 @@ class __ZikoUIText__ extends ZikoUIContainerElement {
|
|
|
8116
8101
|
// && !(value[i-1] instanceof ZikoUIElement)
|
|
8117
8102
|
// ) this.element.appendChild(new Text(" "))
|
|
8118
8103
|
|
|
8119
|
-
if(this.cache.lineBreak)this.element
|
|
8104
|
+
if(this.cache.lineBreak)this.element?.appendChild(globalThis.document?.createElement("br"));
|
|
8120
8105
|
});
|
|
8121
|
-
this.element
|
|
8122
|
-
.replace(/\n/g, '<br>')
|
|
8123
|
-
|
|
8106
|
+
if(this.element?.innerHTML){
|
|
8107
|
+
this.element.innerHTML = this.element.innerHTML.replace(/\n/g, '<br>').replace(/(?<!<[^>]+) /g, ' ');
|
|
8108
|
+
}
|
|
8124
8109
|
return this
|
|
8125
8110
|
}
|
|
8126
8111
|
setValue(...value) {
|
|
@@ -8142,32 +8127,50 @@ class ZikoUIQuote extends __ZikoUIText__ {
|
|
|
8142
8127
|
fontStyle: "italic"
|
|
8143
8128
|
});
|
|
8144
8129
|
}
|
|
8130
|
+
get isQuote(){
|
|
8131
|
+
return true
|
|
8132
|
+
}
|
|
8145
8133
|
}
|
|
8146
8134
|
class ZikoUIDefintion extends __ZikoUIText__ {
|
|
8147
8135
|
constructor(...value) {
|
|
8148
8136
|
super("dfn", "dfnText", false, ...value);
|
|
8149
8137
|
}
|
|
8138
|
+
get isDfnText(){
|
|
8139
|
+
return true
|
|
8140
|
+
}
|
|
8150
8141
|
}
|
|
8151
8142
|
class ZikoUISupText extends __ZikoUIText__ {
|
|
8152
8143
|
constructor(sup) {
|
|
8153
8144
|
super("sup", "supText", false, sup);
|
|
8154
8145
|
}
|
|
8146
|
+
get isSupText(){
|
|
8147
|
+
return true
|
|
8148
|
+
}
|
|
8155
8149
|
}
|
|
8156
8150
|
class ZikoUISubText extends __ZikoUIText__ {
|
|
8157
8151
|
constructor(...value) {
|
|
8158
8152
|
super("sub", "subText", false, ...value);
|
|
8159
8153
|
}
|
|
8154
|
+
get isSubText(){
|
|
8155
|
+
return true
|
|
8156
|
+
}
|
|
8160
8157
|
}
|
|
8161
8158
|
class ZikoUICodeText extends __ZikoUIText__ {
|
|
8162
8159
|
constructor(...value) {
|
|
8163
8160
|
super("code", "codeText", false, ...value);
|
|
8164
8161
|
}
|
|
8162
|
+
get isCodeText(){
|
|
8163
|
+
return true
|
|
8164
|
+
}
|
|
8165
8165
|
}
|
|
8166
8166
|
class ZikoUIAbbrText extends __ZikoUIText__ {
|
|
8167
8167
|
constructor(abbr, title) {
|
|
8168
8168
|
super("abbr", "abbrText", false, abbr);
|
|
8169
8169
|
this.setAttr("title", title);
|
|
8170
8170
|
}
|
|
8171
|
+
get isAbbrText(){
|
|
8172
|
+
return true
|
|
8173
|
+
}
|
|
8171
8174
|
}
|
|
8172
8175
|
const text$1 = (...str) => new ZikoUIText(...str);
|
|
8173
8176
|
const quote = (...str) => new ZikoUIQuote(...str);
|
|
@@ -8181,12 +8184,18 @@ class ZikoUIParagraphe extends __ZikoUIText__ {
|
|
|
8181
8184
|
constructor(...value) {
|
|
8182
8185
|
super("p", "p", true, ...value);
|
|
8183
8186
|
}
|
|
8187
|
+
get isPara(){
|
|
8188
|
+
return true;
|
|
8189
|
+
}
|
|
8184
8190
|
}
|
|
8185
8191
|
class ZikoUIBlockQuote extends __ZikoUIText__ {
|
|
8186
8192
|
constructor(cite,quote) {
|
|
8187
8193
|
super("blockquote", "blockquote", true, quote);
|
|
8188
8194
|
this.setAttr("cite", cite);
|
|
8189
8195
|
}
|
|
8196
|
+
get isBlockQuote(){
|
|
8197
|
+
return true;
|
|
8198
|
+
}
|
|
8190
8199
|
}
|
|
8191
8200
|
const p = (...ZikoUIElement) => new ZikoUIParagraphe(...ZikoUIElement);
|
|
8192
8201
|
const blockQuote = (cite, quote) => new ZikoUIBlockQuote(cite, quote);
|
|
@@ -8196,6 +8205,9 @@ class ZikoUIHeading extends ZikoUIElement {
|
|
|
8196
8205
|
super(`h${type}`,`h${type}`);
|
|
8197
8206
|
this.element.textContent = value;
|
|
8198
8207
|
}
|
|
8208
|
+
get isHeading(){
|
|
8209
|
+
return true;
|
|
8210
|
+
}
|
|
8199
8211
|
get value() {
|
|
8200
8212
|
return this.element.innerText;
|
|
8201
8213
|
}
|
|
@@ -8223,11 +8235,14 @@ class ZikoUIHtmlTag extends ZikoUIContainerElement {
|
|
|
8223
8235
|
class ZikoUIBtn extends ZikoUIElement {
|
|
8224
8236
|
constructor(value = "button") {
|
|
8225
8237
|
super("button","btn");
|
|
8226
|
-
this.element = document
|
|
8238
|
+
this.element = document?.createElement("button");
|
|
8227
8239
|
this.setValue(value);
|
|
8228
8240
|
this.st.cursor("pointer");
|
|
8229
8241
|
globalThis.__Ziko__.__Config__.default.render && this.render();
|
|
8230
8242
|
}
|
|
8243
|
+
get isBtn(){
|
|
8244
|
+
return true
|
|
8245
|
+
}
|
|
8231
8246
|
setValue(value) {
|
|
8232
8247
|
if (value instanceof ZikoUIElement) value.setTarget(this.element);
|
|
8233
8248
|
else {
|
|
@@ -8251,23 +8266,43 @@ class ZikoUIBtn extends ZikoUIElement {
|
|
|
8251
8266
|
class ZikoUIBr extends ZikoUIElement {
|
|
8252
8267
|
constructor() {
|
|
8253
8268
|
super("br","br");
|
|
8254
|
-
|
|
8269
|
+
}
|
|
8270
|
+
get isBr(){
|
|
8271
|
+
return true
|
|
8255
8272
|
}
|
|
8256
8273
|
}
|
|
8257
8274
|
class ZikoUIHr extends ZikoUIElement {
|
|
8258
8275
|
constructor() {
|
|
8259
8276
|
super("hr","hr");
|
|
8260
|
-
|
|
8277
|
+
}
|
|
8278
|
+
get isHr(){
|
|
8279
|
+
return true
|
|
8261
8280
|
}
|
|
8262
8281
|
}
|
|
8263
8282
|
class ZikoUILink extends ZikoUIContainerElement{
|
|
8264
8283
|
constructor(href){
|
|
8265
8284
|
super("a","link");
|
|
8285
|
+
Object.assign(this.cache,{
|
|
8286
|
+
defaultStyle:{
|
|
8287
|
+
color:"#0275d8",
|
|
8288
|
+
textDecoration: "none"
|
|
8289
|
+
},
|
|
8290
|
+
hoverStyle:{
|
|
8291
|
+
color:"#01447e",
|
|
8292
|
+
textDecoration: "underline"
|
|
8293
|
+
},
|
|
8294
|
+
});
|
|
8266
8295
|
this.setHref(href);
|
|
8296
|
+
this.style(this.cache.defaultStyle);
|
|
8297
|
+
this.onPtrEnter(()=>this.style(this.cache.hoverStyle));
|
|
8298
|
+
this.onPtrLeave(()=>this.style(this.cache.defaultStyle));
|
|
8267
8299
|
}
|
|
8268
8300
|
setHref(href){
|
|
8269
8301
|
this.element.href=href;
|
|
8270
8302
|
}
|
|
8303
|
+
get isLink(){
|
|
8304
|
+
return true
|
|
8305
|
+
}
|
|
8271
8306
|
}
|
|
8272
8307
|
const br = () => new ZikoUIBr();
|
|
8273
8308
|
const hr = () => new ZikoUIHr();
|
|
@@ -8282,6 +8317,9 @@ class ZikoUILI extends ZikoUIContainerElement{
|
|
|
8282
8317
|
super("li","li");
|
|
8283
8318
|
this.append(UI);
|
|
8284
8319
|
}
|
|
8320
|
+
get isLi(){
|
|
8321
|
+
return true;
|
|
8322
|
+
}
|
|
8285
8323
|
}
|
|
8286
8324
|
class ZikoUIList extends ZikoUIContainerElement {
|
|
8287
8325
|
constructor(element,name) {
|
|
@@ -8289,6 +8327,9 @@ class ZikoUIList extends ZikoUIContainerElement {
|
|
|
8289
8327
|
delete this.append;
|
|
8290
8328
|
this.style({ listStylePosition: "inside" });
|
|
8291
8329
|
}
|
|
8330
|
+
get isList(){
|
|
8331
|
+
return true;
|
|
8332
|
+
}
|
|
8292
8333
|
append(...arr){
|
|
8293
8334
|
for (let i = 0; i < arr.length; i++) {
|
|
8294
8335
|
let li = null;
|
|
@@ -8381,6 +8422,9 @@ class ZikoUIOList extends ZikoUIList{
|
|
|
8381
8422
|
super("ol","ol");
|
|
8382
8423
|
this.append(...arr);
|
|
8383
8424
|
}
|
|
8425
|
+
get isOl(){
|
|
8426
|
+
return true;
|
|
8427
|
+
}
|
|
8384
8428
|
type(tp = 1) {
|
|
8385
8429
|
this.element.setAttribute("type", tp);
|
|
8386
8430
|
return this;
|
|
@@ -8395,93 +8439,68 @@ class ZikoUIUList extends ZikoUIList{
|
|
|
8395
8439
|
super("ul","ul");
|
|
8396
8440
|
this.append(...arr);
|
|
8397
8441
|
}
|
|
8442
|
+
get isUl(){
|
|
8443
|
+
return true;
|
|
8444
|
+
}
|
|
8398
8445
|
}
|
|
8399
8446
|
const li=UI=>new ZikoUILI(UI);
|
|
8400
8447
|
const ol = (...arr) => new ZikoUIOList(...arr);
|
|
8401
8448
|
const ul = (...arr) => new ZikoUIUList(...arr);
|
|
8402
8449
|
|
|
8403
|
-
class ZikoUIInputOption extends ZikoUIElement {
|
|
8404
|
-
constructor(value = "") {
|
|
8405
|
-
super();
|
|
8406
|
-
this.element = document.createElement("option");
|
|
8407
|
-
if(value instanceof Object&&"value" in value){
|
|
8408
|
-
this.setValue(value.value);
|
|
8409
|
-
this.setText(value?.text??value.value);
|
|
8410
|
-
}
|
|
8411
|
-
else this.setValue(value);
|
|
8412
|
-
}
|
|
8413
|
-
setValue(str = "") {
|
|
8414
|
-
this.element.value = str;
|
|
8415
|
-
return this;
|
|
8416
|
-
}
|
|
8417
|
-
setText(text=""){
|
|
8418
|
-
if(text)this.element.textContent=text;
|
|
8419
|
-
return this;
|
|
8420
|
-
}
|
|
8421
|
-
}
|
|
8422
|
-
|
|
8423
|
-
class ZikoUITextArea extends ZikoUIElement {
|
|
8424
|
-
constructor() {
|
|
8425
|
-
super();
|
|
8426
|
-
this.element = document.createElement("textarea");
|
|
8427
|
-
//Object.assign(this,inputComposer.call(this));
|
|
8428
|
-
}
|
|
8429
|
-
get value(){
|
|
8430
|
-
return this.element.textContent;
|
|
8431
|
-
}
|
|
8432
|
-
}
|
|
8433
|
-
|
|
8434
|
-
const textarea =()=> new ZikoUITextArea();
|
|
8435
|
-
|
|
8436
|
-
//import { select } from "./select.js";
|
|
8437
|
-
//import { debounce,throttle} from "../../Data/decorators.js";
|
|
8438
|
-
|
|
8439
8450
|
class ZikoUIInput extends ZikoUIElement {
|
|
8440
|
-
constructor(name , value = "",datalist) {
|
|
8441
|
-
super("input",
|
|
8442
|
-
Object.assign(this.events,{input:null});
|
|
8451
|
+
constructor(type, name , value = "", datalist) {
|
|
8452
|
+
super("input", "input");
|
|
8453
|
+
Object.assign(this.events, { input: null });
|
|
8443
8454
|
this.setValue(value);
|
|
8444
|
-
|
|
8455
|
+
this.setAttr("type", type);
|
|
8456
|
+
this.setAttr("name", name);
|
|
8457
|
+
if (datalist) this.linkDatalist(datalist);
|
|
8458
|
+
}
|
|
8459
|
+
get isInput() {
|
|
8460
|
+
return true;
|
|
8461
|
+
}
|
|
8462
|
+
setName(name){
|
|
8463
|
+
this.setAttr("name", name);
|
|
8464
|
+
return this;
|
|
8445
8465
|
}
|
|
8446
|
-
onInput(...callbacks){
|
|
8447
|
-
if(!this.events.input)this.events.input = useInputEvent(this);
|
|
8466
|
+
onInput(...callbacks) {
|
|
8467
|
+
if (!this.events.input) this.events.input = useInputEvent(this);
|
|
8448
8468
|
this.events.input.onInput(...callbacks);
|
|
8449
8469
|
return this;
|
|
8450
8470
|
}
|
|
8451
|
-
onChange(...callbacks){
|
|
8452
|
-
if(!this.events.input)this.events.input = useInputEvent(this);
|
|
8471
|
+
onChange(...callbacks) {
|
|
8472
|
+
if (!this.events.input) this.events.input = useInputEvent(this);
|
|
8453
8473
|
this.events.input.onChange(...callbacks);
|
|
8454
8474
|
return this;
|
|
8455
8475
|
}
|
|
8456
8476
|
linkDatalist(datalist) {
|
|
8457
8477
|
let id;
|
|
8458
|
-
if(datalist instanceof ZikoUIInputDatalist)id=datalist.Id;
|
|
8459
|
-
else if(datalist instanceof Array){
|
|
8460
|
-
const Datalist=new ZikoUIInputDatalist(...datalist);
|
|
8461
|
-
id=Datalist.Id;
|
|
8478
|
+
if (datalist instanceof ZikoUIInputDatalist) id = datalist.Id;
|
|
8479
|
+
else if (datalist instanceof Array) {
|
|
8480
|
+
const Datalist = new ZikoUIInputDatalist(...datalist);
|
|
8481
|
+
id = Datalist.Id;
|
|
8462
8482
|
console.log(Datalist);
|
|
8463
|
-
}
|
|
8464
|
-
else id=datalist;
|
|
8483
|
+
} else id = datalist;
|
|
8465
8484
|
this.element.setAttribute("list", id);
|
|
8466
8485
|
return this;
|
|
8467
8486
|
}
|
|
8468
8487
|
get value() {
|
|
8469
8488
|
return this.element.value;
|
|
8470
8489
|
}
|
|
8471
|
-
_setType(type) {
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
}
|
|
8475
|
-
setValue(value="") {
|
|
8490
|
+
// _setType(type) {
|
|
8491
|
+
// this.element.type = type;
|
|
8492
|
+
// return this;
|
|
8493
|
+
// }
|
|
8494
|
+
setValue(value = "") {
|
|
8476
8495
|
this.element.value = value;
|
|
8477
8496
|
return this;
|
|
8478
8497
|
}
|
|
8479
|
-
useState(state){
|
|
8498
|
+
useState(state) {
|
|
8480
8499
|
this.setValue(state);
|
|
8481
|
-
return [{value:this.value},e=>this.setValue(e)]
|
|
8500
|
+
return [{ value: this.value }, (e) => this.setValue(e)];
|
|
8482
8501
|
}
|
|
8483
8502
|
setPlaceholder(value) {
|
|
8484
|
-
if(value)this.element.placeholder = value;
|
|
8503
|
+
if (value) this.element.placeholder = value;
|
|
8485
8504
|
return this;
|
|
8486
8505
|
}
|
|
8487
8506
|
get isValide() {
|
|
@@ -8510,260 +8529,362 @@ class ZikoUIInput extends ZikoUIElement {
|
|
|
8510
8529
|
return this;
|
|
8511
8530
|
}
|
|
8512
8531
|
}
|
|
8532
|
+
|
|
8533
|
+
const input = (value, datalist) => {
|
|
8534
|
+
if (value instanceof Object) {
|
|
8535
|
+
const { datalist, placeholder } = value;
|
|
8536
|
+
value = value.value ?? "";
|
|
8537
|
+
return new ZikoUIInput("text", "input", value, datalist).setPlaceholder(placeholder);
|
|
8538
|
+
}
|
|
8539
|
+
return new ZikoUIInput("text", "input", value, datalist);
|
|
8540
|
+
};
|
|
8541
|
+
|
|
8542
|
+
class ZikoUIInputNumber extends ZikoUIInput {
|
|
8543
|
+
constructor(min, max, step = 1) {
|
|
8544
|
+
super("number", "inpuNumber");
|
|
8545
|
+
this.setMin(min).setMax(max).setStep(step);
|
|
8546
|
+
}
|
|
8547
|
+
get isInputNumber() {
|
|
8548
|
+
return true;
|
|
8549
|
+
}
|
|
8550
|
+
get value() {
|
|
8551
|
+
return +this.element.value;
|
|
8552
|
+
}
|
|
8553
|
+
setMin(min) {
|
|
8554
|
+
this.element.min = min;
|
|
8555
|
+
return this;
|
|
8556
|
+
}
|
|
8557
|
+
setMax(max) {
|
|
8558
|
+
this.element.max = max;
|
|
8559
|
+
return this;
|
|
8560
|
+
}
|
|
8561
|
+
setStep(step) {
|
|
8562
|
+
this.element.step = step;
|
|
8563
|
+
return this;
|
|
8564
|
+
}
|
|
8565
|
+
}
|
|
8566
|
+
const inputNumber = (min, max, step) => {
|
|
8567
|
+
if (min instanceof Object) {
|
|
8568
|
+
const { value, max = 10, step = 1, placeholder = "" } = min;
|
|
8569
|
+
min = min?.min ?? 0;
|
|
8570
|
+
return new ZikoUIInputSlider(min, max, step)
|
|
8571
|
+
.setValue(value)
|
|
8572
|
+
.setPlaceholder(placeholder);
|
|
8573
|
+
}
|
|
8574
|
+
return new ZikoUIInputNumber(min, max, step);
|
|
8575
|
+
};
|
|
8576
|
+
|
|
8577
|
+
let ZikoUIInputSlider$1 = class ZikoUIInputSlider extends ZikoUIInput {
|
|
8578
|
+
constructor(val = 0, min = 0, max = 10, step = 1) {
|
|
8579
|
+
super("range", "inputSlider");
|
|
8580
|
+
this.setMin(min).setMax(max).setValue(val).setStep(step);
|
|
8581
|
+
}
|
|
8582
|
+
get isInputSlider(){
|
|
8583
|
+
return true;
|
|
8584
|
+
}
|
|
8585
|
+
setMin(min) {
|
|
8586
|
+
this.element.min = min;
|
|
8587
|
+
return this;
|
|
8588
|
+
}
|
|
8589
|
+
setMax(max) {
|
|
8590
|
+
this.element.max = max;
|
|
8591
|
+
return this;
|
|
8592
|
+
}
|
|
8593
|
+
setStep(step) {
|
|
8594
|
+
this.element.step = step;
|
|
8595
|
+
return this;
|
|
8596
|
+
}
|
|
8597
|
+
};
|
|
8598
|
+
const slider = (value, min, max, step) =>{
|
|
8599
|
+
if(value instanceof Object){
|
|
8600
|
+
const {min=0,max=10,step=1}=value;
|
|
8601
|
+
value=value?.value??5;
|
|
8602
|
+
return new ZikoUIInputSlider$1(value, min, max, step);
|
|
8603
|
+
}
|
|
8604
|
+
return new ZikoUIInputSlider$1(value, min, max, step);
|
|
8605
|
+
};
|
|
8606
|
+
|
|
8607
|
+
class ZikoUIInputColor extends ZikoUIInput {
|
|
8608
|
+
constructor() {
|
|
8609
|
+
super("color", "inputColor");
|
|
8610
|
+
this.background(this.value);
|
|
8611
|
+
this.onInput(() => this.background(this.value));
|
|
8612
|
+
}
|
|
8613
|
+
get isInputColor(){
|
|
8614
|
+
return true;
|
|
8615
|
+
}
|
|
8616
|
+
}
|
|
8617
|
+
const inputColor = () => new ZikoUIInputColor();
|
|
8618
|
+
|
|
8513
8619
|
class ZikoUIInputSearch extends ZikoUIInput {
|
|
8514
8620
|
constructor() {
|
|
8515
|
-
super("inputSearch");
|
|
8516
|
-
this._setType("search");
|
|
8621
|
+
super("search", "inputSearch");
|
|
8517
8622
|
this.Length = 0;
|
|
8518
8623
|
}
|
|
8624
|
+
get isInputSearch() {
|
|
8625
|
+
return true;
|
|
8626
|
+
}
|
|
8519
8627
|
onsearch(callback) {
|
|
8520
8628
|
this.element.addEventListener("search", () => callback());
|
|
8521
8629
|
return this;
|
|
8522
8630
|
}
|
|
8523
8631
|
connect(...UIElement) {
|
|
8524
|
-
/*
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8632
|
+
/*
|
|
8633
|
+
let memory = new Array(UIElement.length).fill([]);
|
|
8634
|
+
UIElement.map((n, i) => {
|
|
8635
|
+
//console.log(n)
|
|
8636
|
+
n.items.map((m, j) => {
|
|
8637
|
+
memory[i][j] = m.element.style.display;
|
|
8638
|
+
});
|
|
8530
8639
|
});
|
|
8531
|
-
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
|
|
8535
|
-
|
|
8536
|
-
|
|
8537
|
-
)
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
*/
|
|
8640
|
+
UIElement.map((n, i) =>
|
|
8641
|
+
this.onInput(() => {
|
|
8642
|
+
n.filterByTextContent(this.value, memory[i]);
|
|
8643
|
+
this.Length = n.children.filter(
|
|
8644
|
+
(n) => n.style.display != "none"
|
|
8645
|
+
).length;
|
|
8646
|
+
})
|
|
8647
|
+
);
|
|
8648
|
+
*/
|
|
8541
8649
|
return this;
|
|
8542
8650
|
}
|
|
8543
8651
|
displayLength(UIElement) {
|
|
8544
8652
|
this.element.addEventListener("keyup", () =>
|
|
8545
|
-
UIElement.setValue(this.Length)
|
|
8653
|
+
UIElement.setValue(this.Length),
|
|
8546
8654
|
);
|
|
8547
8655
|
return this;
|
|
8548
8656
|
}
|
|
8549
8657
|
}
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8658
|
+
const search = (...a) => new ZikoUIInputSearch().connect(...a);
|
|
8659
|
+
|
|
8660
|
+
class ZikoUIInputCheckbox extends ZikoUIInput {
|
|
8661
|
+
constructor() {
|
|
8662
|
+
super("checkbox", "inputCheckbox");
|
|
8663
|
+
this.cursor("pointer");
|
|
8664
|
+
}
|
|
8665
|
+
get isInputCheckbox(){
|
|
8666
|
+
return true;
|
|
8667
|
+
}
|
|
8668
|
+
get checked() {
|
|
8669
|
+
return this.element.checked;
|
|
8670
|
+
}
|
|
8671
|
+
check(checked = true) {
|
|
8672
|
+
this.element.checked = checked;
|
|
8673
|
+
return this;
|
|
8674
|
+
}
|
|
8675
|
+
color(color) {
|
|
8676
|
+
this.element.style.accentColor = color;
|
|
8677
|
+
return this;
|
|
8678
|
+
}
|
|
8571
8679
|
}
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8680
|
+
const checkbox = () => new ZikoUIInputCheckbox();
|
|
8681
|
+
|
|
8682
|
+
class ZikoUIInputRadio extends ZikoUIInput {
|
|
8683
|
+
constructor() {
|
|
8684
|
+
super("radio", "inputRadio");
|
|
8685
|
+
this.cursor("pointer");
|
|
8686
|
+
}
|
|
8687
|
+
get isInputRadio(){
|
|
8688
|
+
return true;
|
|
8689
|
+
}
|
|
8690
|
+
get checked() {
|
|
8691
|
+
return this.element.checked;
|
|
8692
|
+
}
|
|
8693
|
+
check(checked = true) {
|
|
8694
|
+
this.element.checked = checked;
|
|
8695
|
+
return this;
|
|
8696
|
+
}
|
|
8697
|
+
color(color) {
|
|
8698
|
+
this.element.style.accentColor = color;
|
|
8699
|
+
return this;
|
|
8700
|
+
}
|
|
8578
8701
|
}
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8702
|
+
const radio = () => new ZikoUIInputRadio();
|
|
8703
|
+
|
|
8704
|
+
class ZikoUIInputEmail extends ZikoUIInput {
|
|
8705
|
+
constructor() {
|
|
8706
|
+
super("email", "inputEmail");
|
|
8707
|
+
}
|
|
8708
|
+
get isInputEmail(){
|
|
8709
|
+
return true;
|
|
8710
|
+
}
|
|
8585
8711
|
}
|
|
8586
|
-
|
|
8712
|
+
const inputEmail = () => new ZikoUIInputEmail();
|
|
8713
|
+
|
|
8587
8714
|
class ZikoUIInputPassword extends ZikoUIInput {
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
constructor() {
|
|
8595
|
-
super("inputEmail");
|
|
8596
|
-
this._setType("email");
|
|
8715
|
+
constructor() {
|
|
8716
|
+
super("password", "inputPassword");
|
|
8717
|
+
}
|
|
8718
|
+
get isInputPassword(){
|
|
8719
|
+
return true;
|
|
8720
|
+
}
|
|
8597
8721
|
}
|
|
8722
|
+
const inputPassword = () => new ZikoUIInputPassword();
|
|
8723
|
+
|
|
8724
|
+
class ZikoUIInputDate extends ZikoUIInput {
|
|
8725
|
+
constructor() {
|
|
8726
|
+
super("date", "inputDate");
|
|
8727
|
+
}
|
|
8728
|
+
get isInputDate(){
|
|
8729
|
+
return true;
|
|
8730
|
+
}
|
|
8598
8731
|
}
|
|
8732
|
+
const inputDate = () => new ZikoUIInputDate();
|
|
8733
|
+
|
|
8599
8734
|
class ZikoUIInputTime extends ZikoUIInput {
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
constructor() {
|
|
8607
|
-
super("inputDate");
|
|
8608
|
-
this._setType("date");
|
|
8609
|
-
}
|
|
8735
|
+
constructor() {
|
|
8736
|
+
super("time", "inputTime");
|
|
8737
|
+
}
|
|
8738
|
+
get isInputTime(){
|
|
8739
|
+
return true;
|
|
8740
|
+
}
|
|
8610
8741
|
}
|
|
8742
|
+
const inputTime = () => new ZikoUIInputTime();
|
|
8743
|
+
|
|
8611
8744
|
class ZikoUIInputDateTime extends ZikoUIInput {
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
constructor() {
|
|
8619
|
-
super("inputCheckbox");
|
|
8620
|
-
this._setType("checkbox");
|
|
8621
|
-
this.cursor("pointer");
|
|
8622
|
-
}
|
|
8623
|
-
get checked() {
|
|
8624
|
-
return this.element.checked;
|
|
8625
|
-
}
|
|
8626
|
-
check(checked = true) {
|
|
8627
|
-
this.element.checked = checked;
|
|
8628
|
-
return this;
|
|
8629
|
-
}
|
|
8630
|
-
color(color) {
|
|
8631
|
-
this.element.style.accentColor = color;
|
|
8632
|
-
return this;
|
|
8633
|
-
}
|
|
8634
|
-
}
|
|
8635
|
-
class ZikoUIInputRadio extends ZikoUIInput {
|
|
8636
|
-
constructor() {
|
|
8637
|
-
super("inputRadio");
|
|
8638
|
-
this._setType("radio");
|
|
8639
|
-
this.cursor("pointer");
|
|
8640
|
-
}
|
|
8641
|
-
get checked() {
|
|
8642
|
-
return this.element.checked;
|
|
8643
|
-
}
|
|
8644
|
-
check(checked = true) {
|
|
8645
|
-
this.element.checked = checked;
|
|
8646
|
-
return this;
|
|
8647
|
-
}
|
|
8648
|
-
color(color) {
|
|
8649
|
-
this.element.style.accentColor = color;
|
|
8650
|
-
return this;
|
|
8651
|
-
}
|
|
8745
|
+
constructor() {
|
|
8746
|
+
super("datetime-local", "inputDateTime");
|
|
8747
|
+
}
|
|
8748
|
+
get isInputDateTime(){
|
|
8749
|
+
return true;
|
|
8750
|
+
}
|
|
8652
8751
|
}
|
|
8653
|
-
|
|
8654
|
-
|
|
8752
|
+
const inputDateTime = () => new ZikoUIInputDateTime();
|
|
8753
|
+
|
|
8655
8754
|
class ZikoUIInputImage extends ZikoUIElement {
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8755
|
+
constructor(text = "File") {
|
|
8756
|
+
super("inputImage");
|
|
8757
|
+
this._aux_element = btn(text).setTarget(this.target);
|
|
8758
|
+
this.element = document?.createElement("input");
|
|
8759
|
+
this.element.setAttribute("type", "file");
|
|
8760
|
+
this.element.setAttribute("accept", "image");
|
|
8761
|
+
this._aux_element.onClick(() => this.element.click());
|
|
8762
|
+
this.element.onChange = this.handleImage.bind(this);
|
|
8763
|
+
}
|
|
8764
|
+
get isInputImage(){
|
|
8765
|
+
return true;
|
|
8766
|
+
}
|
|
8767
|
+
handleImage(e) {
|
|
8768
|
+
const reader = new FileReader();
|
|
8769
|
+
const img = new Image();
|
|
8770
|
+
reader.onload = function (event) {
|
|
8771
|
+
img.src = event.target.result;
|
|
8772
|
+
console.log(img.src);
|
|
8773
|
+
};
|
|
8774
|
+
reader.readAsDataURL(e.target.files[0]);
|
|
8775
|
+
this.img = img;
|
|
8776
|
+
}
|
|
8777
|
+
get value() {
|
|
8778
|
+
return this.img;
|
|
8779
|
+
}
|
|
8780
|
+
render(bool = true) {
|
|
8781
|
+
if (bool) this.target.appendChild(this._aux_element.element);
|
|
8782
|
+
else this.remove();
|
|
8783
|
+
return this;
|
|
8784
|
+
}
|
|
8785
|
+
remove() {
|
|
8786
|
+
if (this.target.children.length) this.target.removeChild(this._aux_element.element);
|
|
8787
|
+
return this;
|
|
8788
|
+
}
|
|
8789
|
+
}
|
|
8790
|
+
const inputImage = (text) => new ZikoUIInputImage(text);
|
|
8791
|
+
|
|
8792
|
+
class ZikoUIWebcame extends ZikoUIVideo{
|
|
8793
|
+
constructor(){
|
|
8794
|
+
super();
|
|
8795
|
+
this.element.setAttribute("src", "");
|
|
8796
|
+
this.constraints = { audio: true, video: { width: 1280, height: 720 } };
|
|
8797
|
+
//this.video=this.element
|
|
8798
|
+
}
|
|
8799
|
+
get isInputCamera(){
|
|
8800
|
+
return true;
|
|
8801
|
+
}
|
|
8802
|
+
start(){
|
|
8803
|
+
navigator.mediaDevices.getUserMedia(this.constraints).then((mediaStream)=>{
|
|
8804
|
+
this.element.srcObject = mediaStream;
|
|
8805
|
+
this.element.onloadedmetadata = () =>{
|
|
8806
|
+
this.element.play();
|
|
8807
|
+
};
|
|
8808
|
+
})
|
|
8809
|
+
.catch(function(err) { console.log(err.name + ": " + err.message); });
|
|
8810
|
+
return this;
|
|
8811
|
+
}
|
|
8677
8812
|
}
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8813
|
+
const inputCamera=()=>new ZikoUIWebcame();
|
|
8814
|
+
|
|
8815
|
+
class ZikoUILabel extends ZikoUIElement{
|
|
8816
|
+
constructor(){
|
|
8817
|
+
super();
|
|
8818
|
+
this.element=document?.createElement("label");
|
|
8819
|
+
}
|
|
8820
|
+
get isLabel(){
|
|
8821
|
+
return true;
|
|
8682
8822
|
}
|
|
8683
|
-
remove() {
|
|
8684
|
-
if (this.target.children.length) this.target.removeChild(this._aux_element.element);
|
|
8685
|
-
return this;
|
|
8686
8823
|
}
|
|
8824
|
+
class ZikoUIInputOption extends ZikoUIElement {
|
|
8825
|
+
constructor(value = "") {
|
|
8826
|
+
super();
|
|
8827
|
+
this.element = document?.createElement("option");
|
|
8828
|
+
if(value instanceof Object&&"value" in value){
|
|
8829
|
+
this.setValue(value.value);
|
|
8830
|
+
this.setText(value?.text??value.value);
|
|
8831
|
+
}
|
|
8832
|
+
else this.setValue(value);
|
|
8833
|
+
}
|
|
8834
|
+
setValue(str = "") {
|
|
8835
|
+
this.element.value = str;
|
|
8836
|
+
return this;
|
|
8837
|
+
}
|
|
8838
|
+
setText(text=""){
|
|
8839
|
+
if(text)this.element.textContent=text;
|
|
8840
|
+
return this;
|
|
8841
|
+
}
|
|
8687
8842
|
}
|
|
8688
|
-
|
|
8689
|
-
class ZikoUIInputDatalist extends ZikoUIElement {
|
|
8843
|
+
let ZikoUIInputDatalist$1 = class ZikoUIInputDatalist extends ZikoUIElement {
|
|
8690
8844
|
constructor(...options){
|
|
8691
8845
|
super();
|
|
8692
|
-
this.element = document
|
|
8846
|
+
this.element = document?.createElement("datalist");
|
|
8693
8847
|
this.addOptions(...options).setId("ziko-datalist-id"+Random.string(10));
|
|
8694
8848
|
}
|
|
8849
|
+
get isDatalist(){
|
|
8850
|
+
return true;
|
|
8851
|
+
}
|
|
8695
8852
|
addOptions(...options) {
|
|
8696
8853
|
options.map((n) => this.append(new ZikoUIInputOption(n)));
|
|
8697
8854
|
return this;
|
|
8698
8855
|
}
|
|
8699
|
-
}
|
|
8700
|
-
const input = (value,datalist) => {
|
|
8701
|
-
if(value instanceof Object){
|
|
8702
|
-
const {datalist,placeholder}=value;
|
|
8703
|
-
value=value.value??"";
|
|
8704
|
-
return new ZikoUIInput(value,datalist).setPlaceholder(placeholder);
|
|
8705
|
-
}
|
|
8706
|
-
return new ZikoUIInput(value,datalist);
|
|
8707
|
-
};
|
|
8708
|
-
const datalist = (...options) => new ZikoUIInputDatalist(...options);
|
|
8709
|
-
const slider = (value, min, max, step) =>{
|
|
8710
|
-
if(value instanceof Object){
|
|
8711
|
-
const {min=0,max=10,step=1}=value;
|
|
8712
|
-
value=value?.value??5;
|
|
8713
|
-
return new ZikoUIInputSlider(value, min, max, step);
|
|
8714
|
-
}
|
|
8715
|
-
return new ZikoUIInputSlider(value, min, max, step);
|
|
8716
8856
|
};
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
const {value,max=10,step=1,placeholder=""}=min;
|
|
8720
|
-
min=min?.min??0;
|
|
8721
|
-
return new ZikoUIInputSlider(min, max, step).setValue(value).setPlaceholder(placeholder);
|
|
8722
|
-
}
|
|
8723
|
-
return new ZikoUIInputNumber(min,max,step);
|
|
8724
|
-
};
|
|
8725
|
-
const search = (...a) => new ZikoUIInputSearch().connect(...a);
|
|
8726
|
-
const inputImage = (text) => new ZikoUIInputImage(text);
|
|
8727
|
-
const inputPassword = () => new ZikoUIInputPassword();
|
|
8728
|
-
const inputEmail = () => new ZikoUIInputEmail();
|
|
8729
|
-
const inputColor = () => new ZikoUIInputColor();
|
|
8730
|
-
const inputTime = () => new ZikoUIInputTime();
|
|
8731
|
-
const inputDate = () => new ZikoUIInputDate();
|
|
8732
|
-
const inputDateTime = () => new ZikoUIInputDateTime();
|
|
8733
|
-
const checkbox = () => new ZikoUIInputCheckbox();
|
|
8734
|
-
const radio = () => new ZikoUIInputRadio();
|
|
8857
|
+
|
|
8858
|
+
const datalist = (...options) => new ZikoUIInputDatalist$1(...options);
|
|
8735
8859
|
|
|
8736
8860
|
class ZikoUISelect extends ZikoUIElement {
|
|
8737
8861
|
constructor(){
|
|
8738
8862
|
super();
|
|
8739
|
-
this.element=document
|
|
8863
|
+
this.element=document?.createElement("select");
|
|
8740
8864
|
}
|
|
8741
8865
|
addOptions(...options) {
|
|
8742
8866
|
options.map(n => this.append(new ZikoUIInputOption(n)));
|
|
8743
8867
|
return this;
|
|
8744
8868
|
}
|
|
8869
|
+
get isSelect(){
|
|
8870
|
+
return true;
|
|
8871
|
+
}
|
|
8745
8872
|
}
|
|
8746
8873
|
const select=()=>new ZikoUISelect();
|
|
8747
8874
|
|
|
8748
|
-
class
|
|
8749
|
-
constructor(){
|
|
8875
|
+
class ZikoUITextArea extends ZikoUIElement {
|
|
8876
|
+
constructor() {
|
|
8750
8877
|
super();
|
|
8751
|
-
this.element
|
|
8752
|
-
this.constraints = { audio: true, video: { width: 1280, height: 720 } };
|
|
8753
|
-
//this.video=this.element
|
|
8878
|
+
this.element = document?.createElement("textarea");
|
|
8754
8879
|
}
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
this.element.srcObject = mediaStream;
|
|
8758
|
-
this.element.onloadedmetadata = () =>{
|
|
8759
|
-
this.element.play();
|
|
8760
|
-
};
|
|
8761
|
-
})
|
|
8762
|
-
.catch(function(err) { console.log(err.name + ": " + err.message); });
|
|
8763
|
-
return this;
|
|
8880
|
+
get value(){
|
|
8881
|
+
return this.element.textContent;
|
|
8764
8882
|
}
|
|
8765
|
-
|
|
8766
|
-
|
|
8883
|
+
get isTextArea(){
|
|
8884
|
+
return true;
|
|
8885
|
+
}
|
|
8886
|
+
}
|
|
8887
|
+
const textarea =()=> new ZikoUITextArea();
|
|
8767
8888
|
|
|
8768
8889
|
class ZikoUIFlex extends ZikoUIContainerElement {
|
|
8769
8890
|
constructor(tag = "div", w = "100%", h = "100%") {
|
|
@@ -8775,6 +8896,9 @@ class ZikoUIFlex extends ZikoUIContainerElement {
|
|
|
8775
8896
|
this.style({ display: "flex" });
|
|
8776
8897
|
// this.render();
|
|
8777
8898
|
}
|
|
8899
|
+
get isFlex(){
|
|
8900
|
+
return true;
|
|
8901
|
+
}
|
|
8778
8902
|
resp(px,wrap = true) {
|
|
8779
8903
|
this.wrap(wrap);
|
|
8780
8904
|
if (this.element.clientWidth < px) this.vertical();
|
|
@@ -8861,6 +8985,44 @@ function map_pos_y(align){
|
|
|
8861
8985
|
return map_pos_x(-align);
|
|
8862
8986
|
}
|
|
8863
8987
|
|
|
8988
|
+
class ZikoUIForm extends ZikoUIFlex{
|
|
8989
|
+
constructor(...items){
|
|
8990
|
+
super("form", "Form");
|
|
8991
|
+
this.append(...items);
|
|
8992
|
+
this.setMethod("POST");
|
|
8993
|
+
this.setAction("/");
|
|
8994
|
+
}
|
|
8995
|
+
setAction(action = "/"){
|
|
8996
|
+
this.setAttr("action", action);
|
|
8997
|
+
return this;
|
|
8998
|
+
}
|
|
8999
|
+
setMethod(method = "post"){
|
|
9000
|
+
this.setAttr("method", method);
|
|
9001
|
+
return this;
|
|
9002
|
+
}
|
|
9003
|
+
get data(){
|
|
9004
|
+
let formData = new FormData(this.element);
|
|
9005
|
+
this.items.forEach(n=>{
|
|
9006
|
+
if(n.isInput||n.isSelect||n.isTextarea)formData.append(n.element.name, n.value);
|
|
9007
|
+
});
|
|
9008
|
+
return formData;
|
|
9009
|
+
}
|
|
9010
|
+
sendFormData(){
|
|
9011
|
+
fetch(this.element.action, {
|
|
9012
|
+
method: this.element.method,
|
|
9013
|
+
body: this.data
|
|
9014
|
+
})
|
|
9015
|
+
.then(response => response.json())
|
|
9016
|
+
.then(data => console.log(data))
|
|
9017
|
+
.catch(error => console.error('Error:', error));
|
|
9018
|
+
return this;
|
|
9019
|
+
}
|
|
9020
|
+
getByName(name){
|
|
9021
|
+
return this.data.get(name);
|
|
9022
|
+
}
|
|
9023
|
+
}
|
|
9024
|
+
const Form = (...items) => new ZikoUIForm(...items);
|
|
9025
|
+
|
|
8864
9026
|
class ZikoUIGrid extends ZikoUIContainerElement {
|
|
8865
9027
|
constructor(tag ="div", w = "50vw", h = "50vh") {
|
|
8866
9028
|
super(tag,"Grid");
|
|
@@ -8871,6 +9033,9 @@ class ZikoUIGrid extends ZikoUIContainerElement {
|
|
|
8871
9033
|
this.style({ display: "grid" });
|
|
8872
9034
|
// this.render();
|
|
8873
9035
|
}
|
|
9036
|
+
get isGird(){
|
|
9037
|
+
return true;
|
|
9038
|
+
}
|
|
8874
9039
|
columns(n) {
|
|
8875
9040
|
let temp = "";
|
|
8876
9041
|
for (let i = 0; i < n; i++) temp = temp.concat(" auto");
|
|
@@ -9048,6 +9213,9 @@ class ZikoUICarousel extends ZikoUIFlex{
|
|
|
9048
9213
|
// Handle outside up
|
|
9049
9214
|
});
|
|
9050
9215
|
}
|
|
9216
|
+
get isCarousel(){
|
|
9217
|
+
return true;
|
|
9218
|
+
}
|
|
9051
9219
|
}
|
|
9052
9220
|
const Carousel=(...ZikoUIElement)=>new ZikoUICarousel(...ZikoUIElement);
|
|
9053
9221
|
|
|
@@ -9061,6 +9229,9 @@ class ZikoUICodeNote extends ZikoUIFlex{
|
|
|
9061
9229
|
});
|
|
9062
9230
|
this.vertical(0,0);
|
|
9063
9231
|
}
|
|
9232
|
+
get isCodeNote(){
|
|
9233
|
+
return true;
|
|
9234
|
+
}
|
|
9064
9235
|
setCurrentNote(currentNote){
|
|
9065
9236
|
this.cache.currentNote=currentNote;
|
|
9066
9237
|
this.cache.currentNoteIndex=this.items.findIndex(n=>n===currentNote);
|
|
@@ -9249,6 +9420,9 @@ class ZikoUICodeCell extends ZikoUIFlex{
|
|
|
9249
9420
|
// })
|
|
9250
9421
|
}
|
|
9251
9422
|
}
|
|
9423
|
+
get isCodeCell(){
|
|
9424
|
+
return true;
|
|
9425
|
+
}
|
|
9252
9426
|
// space  
|
|
9253
9427
|
get codeText() {
|
|
9254
9428
|
return (this.Input.element.getElementsByClassName("cm-content")[0])
|
|
@@ -9400,6 +9574,9 @@ class ZikoUITabs extends ZikoUIFlex{
|
|
|
9400
9574
|
this.init();
|
|
9401
9575
|
this.display(0);
|
|
9402
9576
|
}
|
|
9577
|
+
get isTabs(){
|
|
9578
|
+
return true;
|
|
9579
|
+
}
|
|
9403
9580
|
init(){
|
|
9404
9581
|
// Remove old listener
|
|
9405
9582
|
for(let i=0;i<this.Controller.length;i++){
|
|
@@ -9460,41 +9637,361 @@ class ZikoUITabs extends ZikoUIFlex{
|
|
|
9460
9637
|
|
|
9461
9638
|
const Tabs=(Controllers,Contents)=>new ZikoUITabs(Controllers,Contents);
|
|
9462
9639
|
|
|
9640
|
+
const palette = {
|
|
9641
|
+
success: {
|
|
9642
|
+
titleColor:"green",
|
|
9643
|
+
contentColor: "#35495e",
|
|
9644
|
+
bgColor: "#d4edda", // Fixed
|
|
9645
|
+
bgColor:"linear-gradient(-225deg, #DFFFCD 0%, #90F9C4 48%, #39F3BB 100%)",
|
|
9646
|
+
borderColor: "#28a745", // Fixed
|
|
9647
|
+
icon: "✅"
|
|
9648
|
+
},
|
|
9649
|
+
info: {
|
|
9650
|
+
titleColor:"blue",
|
|
9651
|
+
contentColor: "#00204a",
|
|
9652
|
+
bgColor: "#93deff", // Fixed
|
|
9653
|
+
bgColor:"radial-gradient(circle at 10% 20%, rgb(147, 230, 241) 0%, rgb(145, 192, 241) 45.5%)",
|
|
9654
|
+
borderColor: "#005689", // Fixed
|
|
9655
|
+
icon: "ℹ️"
|
|
9656
|
+
},
|
|
9657
|
+
warning: {
|
|
9658
|
+
titleColor:"#e4663a",
|
|
9659
|
+
contentColor: "#45171d",
|
|
9660
|
+
bgColor:"#fdffcd",
|
|
9661
|
+
bgColor:"radial-gradient(907px at 3.4% 19.8%, rgb(255, 243, 122) 0%, rgb(255, 102, 145) 97.4%)",
|
|
9662
|
+
borderColor: "#efd510",
|
|
9663
|
+
icon: "⚠️"
|
|
9664
|
+
},
|
|
9665
|
+
danger: {
|
|
9666
|
+
titleColor:"red",
|
|
9667
|
+
contentColor: "#721c24",
|
|
9668
|
+
bgColor: "#f8d7da", // Fixed
|
|
9669
|
+
bgColor:"linear-gradient(90deg, rgb(255, 157, 129) 24.3%, rgb(255, 138, 138) 78.3%)",
|
|
9670
|
+
borderColor: "#c50000", // Fixed
|
|
9671
|
+
icon: "❌"
|
|
9672
|
+
},
|
|
9673
|
+
tips: {
|
|
9674
|
+
titleColor:null,
|
|
9675
|
+
contentColor: null,
|
|
9676
|
+
bgColor: null,
|
|
9677
|
+
borderColor: null,
|
|
9678
|
+
icon: "💡"
|
|
9679
|
+
},
|
|
9680
|
+
important: {
|
|
9681
|
+
titleColor:null,
|
|
9682
|
+
contentColor: null,
|
|
9683
|
+
bgColor: null,
|
|
9684
|
+
borderColor: null,
|
|
9685
|
+
icon: "📌"
|
|
9686
|
+
},
|
|
9687
|
+
|
|
9688
|
+
};
|
|
9689
|
+
|
|
9690
|
+
class ZikoUIAlert extends ZikoUIFlex{
|
|
9691
|
+
constructor(type, title, content){
|
|
9692
|
+
super();
|
|
9693
|
+
this.title = h3(title);
|
|
9694
|
+
this.icon = text$1(palette[type].icon).style({
|
|
9695
|
+
display: "flex",
|
|
9696
|
+
justifyContent:"center",
|
|
9697
|
+
borderRadius:"50%",
|
|
9698
|
+
minWidth:"30px",
|
|
9699
|
+
minHeight:"30px",
|
|
9700
|
+
});
|
|
9701
|
+
this.content = content;
|
|
9702
|
+
this.vertical()
|
|
9703
|
+
.size("200px", "auto")
|
|
9704
|
+
.style({
|
|
9705
|
+
borderRadius:"10px",
|
|
9706
|
+
padding:"10px"
|
|
9707
|
+
});
|
|
9708
|
+
this.append(
|
|
9709
|
+
Flex(
|
|
9710
|
+
this.title,
|
|
9711
|
+
this.icon
|
|
9712
|
+
).size("100%", "40px").style({}).horizontal("space-between",0),
|
|
9713
|
+
this.content
|
|
9714
|
+
);
|
|
9715
|
+
this.useType(type);
|
|
9716
|
+
}
|
|
9717
|
+
get isAlert(){
|
|
9718
|
+
return true;
|
|
9719
|
+
}
|
|
9720
|
+
useType(type){
|
|
9721
|
+
this.style({
|
|
9722
|
+
color:palette[type].color,
|
|
9723
|
+
background:palette[type].bgColor,
|
|
9724
|
+
border: `1px darkblue solid`,
|
|
9725
|
+
borderLeft: `15px ${palette[type].borderColor} solid`,
|
|
9726
|
+
});
|
|
9727
|
+
this.title.style({
|
|
9728
|
+
color:palette[type].titleColor
|
|
9729
|
+
});
|
|
9730
|
+
this.content.st.color(palette[type].titleColor);
|
|
9731
|
+
this.icon.setValue(palette[type].icon).style({
|
|
9732
|
+
border:`2px ${palette[type].borderColor} solid`,
|
|
9733
|
+
alignItems: type==="warning"?"flex-start":"center",
|
|
9734
|
+
});
|
|
9735
|
+
return this;
|
|
9736
|
+
}
|
|
9737
|
+
useSuccess(){
|
|
9738
|
+
this.useType("success");
|
|
9739
|
+
return this;
|
|
9740
|
+
}
|
|
9741
|
+
useInfo(){
|
|
9742
|
+
this.useType("info");
|
|
9743
|
+
return this;
|
|
9744
|
+
}
|
|
9745
|
+
useWarning(){
|
|
9746
|
+
this.useType("warning");
|
|
9747
|
+
return this;
|
|
9748
|
+
}
|
|
9749
|
+
useDanger(){
|
|
9750
|
+
this.useType("danger");
|
|
9751
|
+
return this;
|
|
9752
|
+
}
|
|
9753
|
+
}
|
|
9754
|
+
|
|
9755
|
+
const successAlert=(title, content)=>new ZikoUIAlert("success", title, content);
|
|
9756
|
+
const infoAlert=(title, content)=>new ZikoUIAlert("info", title, content);
|
|
9757
|
+
const warningAlert=(title, content)=>new ZikoUIAlert("warning", title, content);
|
|
9758
|
+
const dangerAlert=(title, content)=>new ZikoUIAlert("danger", title, content);
|
|
9759
|
+
|
|
9760
|
+
class __ZikoUISplitter__ extends ZikoUIElement{
|
|
9761
|
+
constructor(flexDirection, resizerCursor, resizerProp){
|
|
9762
|
+
super("div", "Splitter");
|
|
9763
|
+
Object.assign(this.cache,{
|
|
9764
|
+
isResizing : false,
|
|
9765
|
+
flexDirection,
|
|
9766
|
+
resizerCursor,
|
|
9767
|
+
resizerProp
|
|
9768
|
+
});
|
|
9769
|
+
this.style({
|
|
9770
|
+
display:"flex",
|
|
9771
|
+
flexDirection : this.cache.flexDirection,
|
|
9772
|
+
border: "2px solid #333",
|
|
9773
|
+
overflow: "hidden"
|
|
9774
|
+
});
|
|
9775
|
+
this.resizer = new ZikoUIElement("div", "resizer").style({
|
|
9776
|
+
[this.cache.resizerProp]:"5px",
|
|
9777
|
+
backgroundColor: "gold",
|
|
9778
|
+
cursor: this.cache.resizerCursor,
|
|
9779
|
+
touchAction: "none",
|
|
9780
|
+
});
|
|
9781
|
+
this.onPtrDown(e=>{
|
|
9782
|
+
this.cache.isResizing = true;
|
|
9783
|
+
this.style({
|
|
9784
|
+
cursor : this.cache.resizerCursor // ns-resize
|
|
9785
|
+
});
|
|
9786
|
+
this.resizer.element.setPointerCapture(e.event.pointerId);
|
|
9787
|
+
});
|
|
9788
|
+
this.onPtrUp(e=>{
|
|
9789
|
+
this.cache.isResizing = false;
|
|
9790
|
+
this.style({
|
|
9791
|
+
cursor: "default"
|
|
9792
|
+
});
|
|
9793
|
+
this.resizer.element.releasePointerCapture(e.event.pointerId);
|
|
9794
|
+
});
|
|
9795
|
+
this.onPtrCancel(()=>{
|
|
9796
|
+
this.cache.isResizing = false;
|
|
9797
|
+
this.style({
|
|
9798
|
+
cursor: "default"
|
|
9799
|
+
});
|
|
9800
|
+
});
|
|
9801
|
+
this.onPtrOut(()=>{
|
|
9802
|
+
if (this.cache.isResizing) {
|
|
9803
|
+
this.cache.isResizing = false;
|
|
9804
|
+
this.style({
|
|
9805
|
+
cursor: "default"
|
|
9806
|
+
});
|
|
9807
|
+
}
|
|
9808
|
+
});
|
|
9809
|
+
}
|
|
9810
|
+
get isSplitter(){
|
|
9811
|
+
return true;
|
|
9812
|
+
}
|
|
9813
|
+
styleResizer(style={}){
|
|
9814
|
+
this.resizer.style(style);
|
|
9815
|
+
return this;
|
|
9816
|
+
}
|
|
9817
|
+
}
|
|
9818
|
+
|
|
9819
|
+
class ZikoUIHorizontalSplitter extends __ZikoUISplitter__{
|
|
9820
|
+
constructor(leftPane, rightPane){
|
|
9821
|
+
super("row", "ew-resize", "width");
|
|
9822
|
+
this.leftPane = leftPane.style({
|
|
9823
|
+
width:"50%",
|
|
9824
|
+
flexGrow: 1,
|
|
9825
|
+
overflow: "hidden"
|
|
9826
|
+
});
|
|
9827
|
+
this.rightPane = rightPane.style({
|
|
9828
|
+
width:"50%",
|
|
9829
|
+
flexGrow: 1,
|
|
9830
|
+
overflow: "hidden"
|
|
9831
|
+
});
|
|
9832
|
+
this.element.append(
|
|
9833
|
+
this.leftPane.element,
|
|
9834
|
+
this.resizer.element,
|
|
9835
|
+
this.rightPane.element
|
|
9836
|
+
);
|
|
9837
|
+
this.onPtrMove(e=>{
|
|
9838
|
+
if (!this.cache.isResizing) return;
|
|
9839
|
+
const containerWidth = this.element.getBoundingClientRect().width; // height
|
|
9840
|
+
const pointerRelativeXpos = e.event.clientX - this.element.getBoundingClientRect().x; // y
|
|
9841
|
+
let newLeftPaneWidth = (pointerRelativeXpos / containerWidth) * 100;
|
|
9842
|
+
let newRightPaneWidth = 100 - newLeftPaneWidth;
|
|
9843
|
+
if (newLeftPaneWidth < 0) newLeftPaneWidth = 0;
|
|
9844
|
+
if (newRightPaneWidth < 0) newRightPaneWidth = 0;
|
|
9845
|
+
this.leftPane.element.style.width = `${newLeftPaneWidth}%`;
|
|
9846
|
+
this.rightPane.element.style.width = `${newRightPaneWidth}%`;
|
|
9847
|
+
});
|
|
9848
|
+
}
|
|
9849
|
+
get isHorizontalSplitter(){
|
|
9850
|
+
return true;
|
|
9851
|
+
}
|
|
9852
|
+
}
|
|
9853
|
+
const hSplitter=(leftPane, rightPane)=>new ZikoUIHorizontalSplitter(leftPane, rightPane);
|
|
9854
|
+
|
|
9855
|
+
class ZikoUIVerticalSplitter extends __ZikoUISplitter__{
|
|
9856
|
+
constructor(topPane, bottomPane){
|
|
9857
|
+
super("column", "ns-resize", "height");
|
|
9858
|
+
this.topPane = topPane.style({
|
|
9859
|
+
height:"50%",
|
|
9860
|
+
flexGrow: 1,
|
|
9861
|
+
overflow: "hidden"
|
|
9862
|
+
});
|
|
9863
|
+
this.bottomPane = bottomPane.style({
|
|
9864
|
+
height:"50%",
|
|
9865
|
+
flexGrow: 1,
|
|
9866
|
+
overflow: "hidden"
|
|
9867
|
+
});
|
|
9868
|
+
this.element.append(
|
|
9869
|
+
this.topPane.element,
|
|
9870
|
+
this.resizer.element,
|
|
9871
|
+
this.bottomPane.element
|
|
9872
|
+
);
|
|
9873
|
+
this.onPtrMove(e=>{
|
|
9874
|
+
if (!this.cache.isResizing) return;
|
|
9875
|
+
const containerHeight = this.element.getBoundingClientRect().height; // height
|
|
9876
|
+
const pointerRelativeYpos = e.event.clientY - this.element.getBoundingClientRect().y; // y
|
|
9877
|
+
let newTopPaneHeight = (pointerRelativeYpos / containerHeight) * 100;
|
|
9878
|
+
let newBottomPaneHeight = 100 - newTopPaneHeight;
|
|
9879
|
+
if (newTopPaneHeight < 0) newTopPaneHeight = 0;
|
|
9880
|
+
if (newBottomPaneHeight < 0) newBottomPaneHeight = 0;
|
|
9881
|
+
this.topPane.element.style.height = `${newTopPaneHeight}%`;
|
|
9882
|
+
this.bottomPane.element.style.height = `${newBottomPaneHeight}%`;
|
|
9883
|
+
});
|
|
9884
|
+
}
|
|
9885
|
+
get isHorizontalSplitter(){
|
|
9886
|
+
return true;
|
|
9887
|
+
}
|
|
9888
|
+
}
|
|
9889
|
+
const vSplitter=(topPane, bottomPane)=>new ZikoUIVerticalSplitter(topPane, bottomPane);
|
|
9890
|
+
|
|
9891
|
+
class ZikoUIBreadcrumbs extends ZikoUIElement{
|
|
9892
|
+
constructor(...items){
|
|
9893
|
+
super("ul", "Breadcrumbs");
|
|
9894
|
+
Object.assign(this.cache,{
|
|
9895
|
+
separatorTextContent:"/"
|
|
9896
|
+
});
|
|
9897
|
+
this.style({
|
|
9898
|
+
listStyle: "none",
|
|
9899
|
+
display: "flex",
|
|
9900
|
+
flexWrap: "wrap"
|
|
9901
|
+
});
|
|
9902
|
+
this.list=html('li').style({
|
|
9903
|
+
display: "flex",
|
|
9904
|
+
flexWrap: "wrap"
|
|
9905
|
+
});
|
|
9906
|
+
this.append(...items);
|
|
9907
|
+
}
|
|
9908
|
+
#addItem(item){
|
|
9909
|
+
if(["string","number","boolean"].includes(typeof item))item = text$1(item);
|
|
9910
|
+
const li = html("li", item).style({
|
|
9911
|
+
display: "flex",
|
|
9912
|
+
alignItems: "center"
|
|
9913
|
+
});
|
|
9914
|
+
if(this.element.children.length>0){
|
|
9915
|
+
const separator = text$1(this.cache.separatorTextContent).style({
|
|
9916
|
+
padding: "0 4px"
|
|
9917
|
+
});
|
|
9918
|
+
this.element.append(separator.element);
|
|
9919
|
+
}
|
|
9920
|
+
this.element.append(li.element);
|
|
9921
|
+
}
|
|
9922
|
+
append(...items){
|
|
9923
|
+
items.forEach(n=>this.#addItem(n));
|
|
9924
|
+
return this;
|
|
9925
|
+
}
|
|
9926
|
+
configSeparator(separatorTextContent = this.cache.separator, style = {}){
|
|
9927
|
+
this.cache.separatorTextContent = separatorTextContent;
|
|
9928
|
+
const separators = [...this.element.children].filter(n=>n.tagName==="SPAN");
|
|
9929
|
+
separators.forEach(node=>{
|
|
9930
|
+
node.textContent = separatorTextContent;
|
|
9931
|
+
Object.assign(node.style, style);
|
|
9932
|
+
}
|
|
9933
|
+
);
|
|
9934
|
+
return this;
|
|
9935
|
+
}
|
|
9936
|
+
}
|
|
9937
|
+
const Breadcrumbs=(...items)=>new ZikoUIBreadcrumbs(...items);
|
|
9938
|
+
|
|
9463
9939
|
class ZikoUIMain extends ZikoUIContainerElement{
|
|
9464
9940
|
constructor(){
|
|
9465
9941
|
super("main","Main");
|
|
9466
9942
|
}
|
|
9943
|
+
get isMain(){
|
|
9944
|
+
return true
|
|
9945
|
+
}
|
|
9467
9946
|
}
|
|
9468
9947
|
class ZikoUIHeader extends ZikoUIContainerElement{
|
|
9469
9948
|
constructor(){
|
|
9470
9949
|
super("header","Header");
|
|
9471
9950
|
}
|
|
9951
|
+
get isHeader(){
|
|
9952
|
+
return true
|
|
9953
|
+
}
|
|
9472
9954
|
}
|
|
9473
9955
|
class ZikoUINav extends ZikoUIContainerElement{
|
|
9474
9956
|
constructor(){
|
|
9475
9957
|
super("nav","Nav");
|
|
9476
9958
|
}
|
|
9959
|
+
get isNav(){
|
|
9960
|
+
return true
|
|
9961
|
+
}
|
|
9477
9962
|
}
|
|
9478
9963
|
class ZikoUISection extends ZikoUIContainerElement{
|
|
9479
9964
|
constructor(){
|
|
9480
9965
|
super("section","Section");
|
|
9481
9966
|
this.style({position:"relative"});
|
|
9482
9967
|
}
|
|
9968
|
+
get isSection(){
|
|
9969
|
+
return true
|
|
9970
|
+
}
|
|
9483
9971
|
}
|
|
9484
9972
|
class ZikoUIArticle extends ZikoUIContainerElement{
|
|
9485
9973
|
constructor(){
|
|
9486
9974
|
super("article","Article");
|
|
9487
9975
|
}
|
|
9976
|
+
get isArticle(){
|
|
9977
|
+
return true
|
|
9978
|
+
}
|
|
9488
9979
|
}
|
|
9489
9980
|
class ZikoUIAside extends ZikoUIContainerElement{
|
|
9490
9981
|
constructor(){
|
|
9491
9982
|
super("aside","Aside");
|
|
9492
9983
|
}
|
|
9984
|
+
get isAside(){
|
|
9985
|
+
return true
|
|
9986
|
+
}
|
|
9493
9987
|
}
|
|
9494
9988
|
class ZikoUIFooter extends ZikoUIContainerElement{
|
|
9495
9989
|
constructor(){
|
|
9496
9990
|
super("footer","Footer");
|
|
9497
|
-
this.element=document
|
|
9991
|
+
this.element=document?.createElement("footer");
|
|
9992
|
+
}
|
|
9993
|
+
get isFooter(){
|
|
9994
|
+
return true
|
|
9498
9995
|
}
|
|
9499
9996
|
}
|
|
9500
9997
|
const Section$1 = (...ZikoUIElement) => new ZikoUISection().append(...ZikoUIElement);
|
|
@@ -9508,35 +10005,35 @@ const Aside = (...ZikoUIElement) => new ZikoUIAside().append(...ZikoUIElement);
|
|
|
9508
10005
|
class ZikoUITr extends ZikoUIElement{
|
|
9509
10006
|
constructor(...ZikoUIElement){
|
|
9510
10007
|
super();
|
|
9511
|
-
this.element=document
|
|
10008
|
+
this.element=document?.createElement("Tr");
|
|
9512
10009
|
this.append(...ZikoUIElement);
|
|
9513
10010
|
}
|
|
9514
10011
|
}
|
|
9515
10012
|
class ZikoUITd extends ZikoUIElement{
|
|
9516
10013
|
constructor(...ZikoUIElement){
|
|
9517
10014
|
super();
|
|
9518
|
-
this.element=document
|
|
10015
|
+
this.element=document?.createElement("Td");
|
|
9519
10016
|
this.append(...ZikoUIElement);
|
|
9520
10017
|
}
|
|
9521
10018
|
}
|
|
9522
10019
|
class ZikoUIThead extends ZikoUIElement{
|
|
9523
10020
|
constructor(...ZikoUITr){
|
|
9524
10021
|
super();
|
|
9525
|
-
this.element=document
|
|
10022
|
+
this.element=document?.createElement("Thead");
|
|
9526
10023
|
this.append(...ZikoUITr);
|
|
9527
10024
|
}
|
|
9528
10025
|
}
|
|
9529
10026
|
class ZikoUITbody extends ZikoUIElement{
|
|
9530
10027
|
constructor(...ZikoUITr){
|
|
9531
10028
|
super();
|
|
9532
|
-
this.element=document
|
|
10029
|
+
this.element=document?.createElement("Tbody");
|
|
9533
10030
|
this.append(...ZikoUITr);
|
|
9534
10031
|
}
|
|
9535
10032
|
}
|
|
9536
10033
|
class ZikoUICaption extends ZikoUIElement{
|
|
9537
10034
|
constructor(ZikoUIElement){
|
|
9538
10035
|
super();
|
|
9539
|
-
this.element=document
|
|
10036
|
+
this.element=document?.createElement("Caption");
|
|
9540
10037
|
this.append(ZikoUIElement);
|
|
9541
10038
|
}
|
|
9542
10039
|
}
|
|
@@ -9583,6 +10080,9 @@ class ZikoUITable extends ZikoUIElement {
|
|
|
9583
10080
|
if(body)this.fromMatrix(body);
|
|
9584
10081
|
if(caption)this.setCaption(caption);
|
|
9585
10082
|
}
|
|
10083
|
+
get isTable(){
|
|
10084
|
+
return true;
|
|
10085
|
+
}
|
|
9586
10086
|
get caption(){
|
|
9587
10087
|
return this.structure.caption;
|
|
9588
10088
|
}
|
|
@@ -9704,6 +10204,7 @@ const UI$1={
|
|
|
9704
10204
|
link,
|
|
9705
10205
|
ol,
|
|
9706
10206
|
ul,
|
|
10207
|
+
Form,
|
|
9707
10208
|
input,
|
|
9708
10209
|
search,
|
|
9709
10210
|
slider,
|
|
@@ -9741,6 +10242,13 @@ const UI$1={
|
|
|
9741
10242
|
Tabs,
|
|
9742
10243
|
Collapsible,
|
|
9743
10244
|
Accordion,
|
|
10245
|
+
hSplitter,
|
|
10246
|
+
vSplitter,
|
|
10247
|
+
Breadcrumbs,
|
|
10248
|
+
successAlert,
|
|
10249
|
+
infoAlert,
|
|
10250
|
+
warningAlert,
|
|
10251
|
+
dangerAlert,
|
|
9744
10252
|
ExtractAll: function () {
|
|
9745
10253
|
const keys = Object.keys(this);
|
|
9746
10254
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -9914,7 +10422,7 @@ class ZikoSvgElement {
|
|
|
9914
10422
|
class ZikoSvgRectangle extends ZikoSvgElement{
|
|
9915
10423
|
constructor(x,y,w,h,center=true){
|
|
9916
10424
|
super();
|
|
9917
|
-
this.element=document
|
|
10425
|
+
this.element=document?.createElementNS(
|
|
9918
10426
|
"http://www.w3.org/2000/svg",
|
|
9919
10427
|
"rect",
|
|
9920
10428
|
);
|
|
@@ -9955,7 +10463,7 @@ class ZikoSvgRectangle extends ZikoSvgElement{
|
|
|
9955
10463
|
class ZikoSvgCircle extends ZikoSvgElement{
|
|
9956
10464
|
constructor(cx,cy,r){
|
|
9957
10465
|
super("circle");
|
|
9958
|
-
this.element=document
|
|
10466
|
+
this.element=document?.createElementttNS(
|
|
9959
10467
|
"http://www.w3.org/2000/svg",
|
|
9960
10468
|
"circle",
|
|
9961
10469
|
);
|
|
@@ -9980,7 +10488,7 @@ const svgCircle=(x,y,r)=>new ZikoSvgCircle(x,y,r);
|
|
|
9980
10488
|
class ZikoSvgEllipse extends ZikoSvgElement{
|
|
9981
10489
|
constructor(cx,cy,rx,ry){
|
|
9982
10490
|
super("ellipse");
|
|
9983
|
-
this.element=document
|
|
10491
|
+
this.element=document?.createElementNS(
|
|
9984
10492
|
"http://www.w3.org/2000/svg",
|
|
9985
10493
|
"ellipse",
|
|
9986
10494
|
);
|
|
@@ -10000,7 +10508,7 @@ const svgEllipse=(x,y,rx,ry)=>new ZikoSvgEllipse(x,y,rx,ry);
|
|
|
10000
10508
|
class ZikoSvgLine extends ZikoSvgElement{
|
|
10001
10509
|
constructor(x1,y1,x2,y2){
|
|
10002
10510
|
super();
|
|
10003
|
-
this.element=document
|
|
10511
|
+
this.element=document?.createElementtNS(
|
|
10004
10512
|
"http://www.w3.org/2000/svg",
|
|
10005
10513
|
"line",
|
|
10006
10514
|
);
|
|
@@ -10031,7 +10539,7 @@ const svgPolyLine=(X,Y)=>new ZikoSvgPolyLine(X,Y);
|
|
|
10031
10539
|
class ZikoSvgPath extends ZikoSvgElement{
|
|
10032
10540
|
constructor(){
|
|
10033
10541
|
super();
|
|
10034
|
-
this.element=document
|
|
10542
|
+
this.element=document?.createElementNS(
|
|
10035
10543
|
"http://www.w3.org/2000/svg",
|
|
10036
10544
|
"path",
|
|
10037
10545
|
);
|
|
@@ -10091,7 +10599,7 @@ class ZikoSvgPolygon extends ZikoSvgElement{
|
|
|
10091
10599
|
super();
|
|
10092
10600
|
this.X=X;
|
|
10093
10601
|
this.Y=Y;
|
|
10094
|
-
this.element=document
|
|
10602
|
+
this.element=document?.createElementtNS(
|
|
10095
10603
|
"http://www.w3.org/2000/svg",
|
|
10096
10604
|
"polygon",
|
|
10097
10605
|
);
|
|
@@ -10120,7 +10628,7 @@ const svgPolygon=(X,Y)=>new ZikoSvgPolygon(X,Y);
|
|
|
10120
10628
|
class ZikoSvgText extends ZikoSvgElement{
|
|
10121
10629
|
constructor(text,x,y){
|
|
10122
10630
|
super();
|
|
10123
|
-
this.element=document
|
|
10631
|
+
this.element=document?.createElementNS(
|
|
10124
10632
|
"http://www.w3.org/2000/svg",
|
|
10125
10633
|
"text",
|
|
10126
10634
|
);
|
|
@@ -10145,7 +10653,7 @@ const svgText=(text,x,y)=>new ZikoSvgText(text,x,y);
|
|
|
10145
10653
|
class ZikoSvgImage extends ZikoSvgElement{
|
|
10146
10654
|
constructor(src="",w="100%",h="100%",x=0,y=0){
|
|
10147
10655
|
super();
|
|
10148
|
-
this.element=document
|
|
10656
|
+
this.element=document?.createElementNS(
|
|
10149
10657
|
"http://www.w3.org/2000/svg",
|
|
10150
10658
|
"image",
|
|
10151
10659
|
);
|
|
@@ -10178,7 +10686,7 @@ class ZikoSvgForeignObject extends ZikoSvgElement{
|
|
|
10178
10686
|
constructor(x=0,y=0,w="100%",h="100%",...ZikoUIElement){
|
|
10179
10687
|
super("foreignObject");
|
|
10180
10688
|
this.items=[];
|
|
10181
|
-
this.element=document
|
|
10689
|
+
this.element=document?.createElementtNS(
|
|
10182
10690
|
"http://www.w3.org/2000/svg",
|
|
10183
10691
|
"foreignObject",
|
|
10184
10692
|
);
|
|
@@ -10209,7 +10717,7 @@ class ZikoSvgGroupe extends ZikoSvgElement{
|
|
|
10209
10717
|
constructor(...svgElement){
|
|
10210
10718
|
super();
|
|
10211
10719
|
this.items=[];
|
|
10212
|
-
this.element=document
|
|
10720
|
+
this.element=document?.createElementNS(
|
|
10213
10721
|
"http://www.w3.org/2000/svg",
|
|
10214
10722
|
"g",
|
|
10215
10723
|
);
|
|
@@ -10237,7 +10745,7 @@ class ZikoSvgLink extends ZikoSvgElement{
|
|
|
10237
10745
|
constructor(href,...svgElement){
|
|
10238
10746
|
super();
|
|
10239
10747
|
this.items=[];
|
|
10240
|
-
this.element=document
|
|
10748
|
+
this.element=document?.createElementNS(
|
|
10241
10749
|
"http://www.w3.org/2000/svg",
|
|
10242
10750
|
"a",
|
|
10243
10751
|
);
|
|
@@ -10273,7 +10781,7 @@ const svgGrid=(w,h,r=10,c=10)=>{
|
|
|
10273
10781
|
class ZikoUICanvas extends ZikoUIContainerElement{
|
|
10274
10782
|
constructor(w,h){
|
|
10275
10783
|
super("canvas","canvas");
|
|
10276
|
-
//this.element=document
|
|
10784
|
+
//this.element=document?.createElement("canvas");
|
|
10277
10785
|
this.ctx = this.element.getContext("2d");
|
|
10278
10786
|
this.style({
|
|
10279
10787
|
border:"1px red solid",
|
|
@@ -10417,14 +10925,14 @@ class ZikoUICanvas extends ZikoUIContainerElement{
|
|
|
10417
10925
|
return canvas;
|
|
10418
10926
|
}
|
|
10419
10927
|
toImage() {
|
|
10420
|
-
this.img = document
|
|
10928
|
+
this.img = document?.createElement("img");
|
|
10421
10929
|
this.img.src = this.element.toDataURL("image/png");
|
|
10422
10930
|
return this;
|
|
10423
10931
|
}
|
|
10424
10932
|
toBlob() {
|
|
10425
10933
|
var canvas = this.element;
|
|
10426
10934
|
canvas.toBlob(function (blob) {
|
|
10427
|
-
var newImg = document
|
|
10935
|
+
var newImg = document?.createElement("img"),
|
|
10428
10936
|
url = URL.createObjectURL(blob);
|
|
10429
10937
|
newImg.onload = function () {
|
|
10430
10938
|
URL.revokeObjectURL(url);
|
|
@@ -10848,42 +11356,6 @@ const __Config__={
|
|
|
10848
11356
|
init:()=>document.documentElement.setAttribute("data-engine","zikojs")
|
|
10849
11357
|
};
|
|
10850
11358
|
|
|
10851
|
-
if(globalThis?.document){
|
|
10852
|
-
class ZikoUIComponent extends HTMLElement{
|
|
10853
|
-
constructor(){
|
|
10854
|
-
super();
|
|
10855
|
-
this.shadowDOM = this.attachShadow({ mode: 'open' });
|
|
10856
|
-
this.wrapper=document.createElement("div");
|
|
10857
|
-
}
|
|
10858
|
-
connectedCallback() {
|
|
10859
|
-
this.setAttribute('role', 'region');
|
|
10860
|
-
this.setAttribute('data-engine',"zikojs");
|
|
10861
|
-
this.shadowDOM.append(this.wrapper);
|
|
10862
|
-
this.observeContentChanges();
|
|
10863
|
-
}
|
|
10864
|
-
observeContentChanges() {
|
|
10865
|
-
const observer = new MutationObserver((mutations) => {
|
|
10866
|
-
mutations.forEach((mutation) => {
|
|
10867
|
-
if (mutation.type === 'childList' || mutation.type === 'characterData') {
|
|
10868
|
-
this.wrapper.innerHTML="";
|
|
10869
|
-
__Ziko__.__Config__.setDefault({ target: this.wrapper });
|
|
10870
|
-
globalThis.eval(this.innerHTML);
|
|
10871
|
-
}
|
|
10872
|
-
});
|
|
10873
|
-
});
|
|
10874
|
-
observer.observe(this, { childList: true, subtree: true, characterData: true });
|
|
10875
|
-
}
|
|
10876
|
-
|
|
10877
|
-
disconnectedCallback() {
|
|
10878
|
-
console.log('ZikoUIComponent removed from page.');
|
|
10879
|
-
}
|
|
10880
|
-
}
|
|
10881
|
-
globalThis.customElements.define('ziko-ui', ZikoUIComponent);
|
|
10882
|
-
}
|
|
10883
|
-
else {
|
|
10884
|
-
var ZikoUIComponent = null;
|
|
10885
|
-
}
|
|
10886
|
-
|
|
10887
11359
|
class ZikoSeo{
|
|
10888
11360
|
constructor(app){
|
|
10889
11361
|
this.app=app;
|
|
@@ -10892,7 +11364,7 @@ class ZikoSeo{
|
|
|
10892
11364
|
}
|
|
10893
11365
|
#setMeta(key,value){
|
|
10894
11366
|
const meta=document.querySelector(`meta[name=${key}]`);
|
|
10895
|
-
this.meta=meta?meta:document
|
|
11367
|
+
this.meta=meta?meta:document?.createElement("meta");
|
|
10896
11368
|
this.meta.setAttribute("name",key);
|
|
10897
11369
|
this.meta.setAttribute("content",value);
|
|
10898
11370
|
if(!meta)this.app.head.append(this.meta);
|
|
@@ -10900,7 +11372,7 @@ class ZikoSeo{
|
|
|
10900
11372
|
}
|
|
10901
11373
|
charset(charset="utf-8"){
|
|
10902
11374
|
const meta=document.querySelector("meta[charset]");
|
|
10903
|
-
this.meta=meta?meta:document
|
|
11375
|
+
this.meta=meta?meta:document?.createElementt("meta");
|
|
10904
11376
|
this.meta.setAttribute("charset",charset);
|
|
10905
11377
|
if(!meta)this.app.head.append(this.meta);
|
|
10906
11378
|
return this;
|
|
@@ -10946,10 +11418,10 @@ class ZikoUIApp extends ZikoUIFlex{
|
|
|
10946
11418
|
#init(){
|
|
10947
11419
|
this.root.setAttribute("data-engine","zikojs");
|
|
10948
11420
|
const head=this.root.getElementsByTagName("head")[0];
|
|
10949
|
-
this.head=head?head:this.head=document
|
|
10950
|
-
if(!head)this.root.insertBefore(this.head,document
|
|
11421
|
+
this.head=head?head:this.head=document?.createElementtt("head");
|
|
11422
|
+
if(!head)this.root.insertBefore(this.head,document?.body);
|
|
10951
11423
|
const title=this.head.getElementsByTagName("title")[0];
|
|
10952
|
-
this.Title=title?title:document
|
|
11424
|
+
this.Title=title?title:document?.createElementt("title");
|
|
10953
11425
|
if(!title)this.head.append(this.Title);
|
|
10954
11426
|
}
|
|
10955
11427
|
title(title=this.title.textContent){
|
|
@@ -11013,4 +11485,4 @@ function RemoveAll(){
|
|
|
11013
11485
|
Data.RemoveAll();
|
|
11014
11486
|
}
|
|
11015
11487
|
|
|
11016
|
-
export { Accordion, App, Article, Aside, Base, Canvas, Carousel, CodeCell, CodeNote, Collapsible, Combinaison, Complex, DarkThemes, Data, E, EPSILON, Ease, ExtractAll, Fixed, Flex, Footer, Graphics, Grid$1 as Grid, Header, LightThemes, LinearSystem, Logic$1 as Logic, Main, Math$1 as Math, Matrix, Nav, PI, Permutation, Random, Reactivity, RemoveAll, SPA, Section$1 as Section, Signal, Str, Svg, Table, Tabs, Themes, Time, UI$1 as UI, Utils, ZikoUIAbbrText, ZikoUIAccordion, ZikoUIArticle, ZikoUIAside, ZikoUIAudio, ZikoUIBlockQuote, ZikoUIBr, ZikoUICanvas, ZikoUICodeNote, ZikoUICodeText,
|
|
11488
|
+
export { Accordion, App, Article, Aside, Base, Breadcrumbs, Canvas, Carousel, CodeCell, CodeNote, Collapsible, Combinaison, Complex, DarkThemes, Data, E, EPSILON, Ease, ExtractAll, Fixed, Flex, Footer, Form, Graphics, Grid$1 as Grid, Header, LightThemes, LinearSystem, Logic$1 as Logic, Main, Math$1 as Math, Matrix, Nav, PI, Permutation, Random, Reactivity, RemoveAll, SPA, Section$1 as Section, Signal, Str, Svg, Table, Tabs, Themes, Time, UI$1 as UI, Utils, ZikoUIAbbrText, ZikoUIAccordion, ZikoUIArticle, ZikoUIAside, ZikoUIAudio, ZikoUIBlockQuote, ZikoUIBr, ZikoUIBreadcrumbs, ZikoUICanvas, ZikoUICodeNote, ZikoUICodeText, ZikoUIDefintion, ZikoUIElement, ZikoUIFigure, ZikoUIFooter, ZikoUIForm, ZikoUIHeader, ZikoUIHeading, ZikoUIHorizontalSplitter, ZikoUIHr, ZikoUIHtmlTag, ZikoUIImage, ZikoUIInput, ZikoUIInputCheckbox, ZikoUIInputColor, ZikoUIInputDatalist$1 as ZikoUIInputDatalist, ZikoUIInputDate, ZikoUIInputDateTime, ZikoUIInputEmail, ZikoUIInputImage, ZikoUIInputNumber, ZikoUIInputOption, ZikoUIInputPassword, ZikoUIInputRadio, ZikoUIInputSearch, ZikoUIInputSlider$1 as ZikoUIInputSlider, ZikoUIInputTime, ZikoUILabel, ZikoUILink, ZikoUIMain, ZikoUINav, ZikoUIParagraphe, ZikoUIQuote, ZikoUISection, ZikoUISelect, ZikoUISubText, ZikoUISupText, ZikoUISvg, ZikoUIText, ZikoUITextArea, ZikoUIVerticalSplitter, ZikoUIVideo, __Config__, abbrText, abs, accum, acos, acosh, acot, add, adoc2html, arange, arr2str, asin, asinh, atan, atan2, atanh, audio, bessel, beta, blockQuote, br, brs, btn, canvasArc, canvasCircle, canvasLine, canvasPoints, canvasRect, cartesianProduct, ceil, checkbox, choleskyDecomposition, clamp, codeText, complex, cos, cosh, cot, coth, count, countWords, csc, csv2arr, csv2json, csv2matrix, csv2object, csv2sql, dangerAlert, datalist, Ziko as default, deg2rad, dfnText, div, e, fact, figure, floor, gamma, geomspace, h1, h2, h3, h4, h5, h6, hSplitter, hr, hrs, html, hypot, image, inRange, infoAlert, input, inputCamera, inputColor, inputDate, inputDateTime, inputEmail, inputImage, inputNumber, inputPassword, inputTime, isApproximatlyEqual, json2arr, json2csv, json2csvFile, json2xml, json2xmlFile, json2yml, json2ymlFile, lerp, li, link, linspace, ln, logspace, luDecomposition, map, mapfun$1 as mapfun, markdown2html, matrix, matrix2, matrix3, matrix4, max, min, modulo, mul, norm, nums, obj2str, ol, ones, p, pgcd, pow, powerSet, ppcm, prod, qrDecomposition, quote, rad2deg, radio, removeExtraSpace, round, search, sec, select, sig, sign, sin, sinc, sinh, slider, sqrt, sqrtn, str, sub, subSet, subText, successAlert, sum, supText, svg2ascii, svg2img, svg2imgUrl, svg2str, svgCircle, svgEllipse, svgGrid, svgGroupe, svgImage, svgLine, svgLink, svgObject, svgPath, svgPolyLine, svgPolygon, svgRect, svgText, tan, tanh, text$1 as text, textarea, timeTaken, time_memory_Taken, ul, useAnimation, useBattery, useBluetooth, useChannel, useClickEventnt as useClickEvent, useClipboardEvent, useCustomEvent, useDebounce, useDragEvent, useDropEvent, useEventEmitter, useFavIcon, useFocusEvent, useGeolocation, useHashEvent, useInputEvent, useKeyEvenent as useKeyEvent, useLocaleStorage, useMediaQuery, useMouseEvent, usePointerEvent, useSessionStorage, useStyle, useSuccesifKeys, useTheme, useThread, useThrottle, useTimeLoop, useTitle, useWheelEventnent as useWheelEvent, vSplitter, video, wait, waitForUIElm, waitForUIElmSync, warningAlert, watchAttr, watchChildren, watchIntersection, watchScreen, watchSize, zeros };
|