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.js
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
|
|
@@ -1348,7 +1348,7 @@
|
|
|
1348
1348
|
// return this;
|
|
1349
1349
|
// }
|
|
1350
1350
|
style(styles){
|
|
1351
|
-
Object.assign(this
|
|
1351
|
+
if(this?.target?.element?.style)Object.assign(this?.target?.element?.style, styles);
|
|
1352
1352
|
return this;
|
|
1353
1353
|
}
|
|
1354
1354
|
linkTo(target){
|
|
@@ -3091,7 +3091,7 @@
|
|
|
3091
3091
|
return this;
|
|
3092
3092
|
}
|
|
3093
3093
|
}
|
|
3094
|
-
const useTheme=(id=0)=>
|
|
3094
|
+
const useTheme=(theme, id=0)=>new ZikoUseTheme(theme,id);
|
|
3095
3095
|
|
|
3096
3096
|
class ZikoUseEventEmitter {
|
|
3097
3097
|
constructor() {
|
|
@@ -3196,7 +3196,7 @@
|
|
|
3196
3196
|
this.set(FavIcon);
|
|
3197
3197
|
}
|
|
3198
3198
|
#init(){
|
|
3199
|
-
this.__FavIcon__=document.querySelector("link[rel*='icon']") || document
|
|
3199
|
+
this.__FavIcon__=document.querySelector("link[rel*='icon']") || document?.createElement('link');
|
|
3200
3200
|
this.__FavIcon__.type = 'image/x-icon';
|
|
3201
3201
|
this.__FavIcon__.rel = 'shortcut icon';
|
|
3202
3202
|
return this;
|
|
@@ -3447,6 +3447,15 @@
|
|
|
3447
3447
|
null
|
|
3448
3448
|
);
|
|
3449
3449
|
}
|
|
3450
|
+
function pointercancel_controller(e){
|
|
3451
|
+
EVENT_CONTROLLER.call(
|
|
3452
|
+
this,
|
|
3453
|
+
e,
|
|
3454
|
+
"cancel",
|
|
3455
|
+
null,
|
|
3456
|
+
null
|
|
3457
|
+
);
|
|
3458
|
+
}
|
|
3450
3459
|
class ZikoEventPointer extends ZikoEvent{
|
|
3451
3460
|
constructor(target){
|
|
3452
3461
|
super(target);
|
|
@@ -3477,6 +3486,7 @@
|
|
|
3477
3486
|
enter:false,
|
|
3478
3487
|
out:false,
|
|
3479
3488
|
leave:false,
|
|
3489
|
+
cancel:false
|
|
3480
3490
|
},
|
|
3481
3491
|
paused:{
|
|
3482
3492
|
down:false,
|
|
@@ -3484,7 +3494,8 @@
|
|
|
3484
3494
|
up:false,
|
|
3485
3495
|
enter:false,
|
|
3486
3496
|
out:false,
|
|
3487
|
-
leave:false,
|
|
3497
|
+
leave:false,
|
|
3498
|
+
cancel:false
|
|
3488
3499
|
},
|
|
3489
3500
|
stream:{
|
|
3490
3501
|
enabled:{
|
|
@@ -3494,6 +3505,7 @@
|
|
|
3494
3505
|
enter:false,
|
|
3495
3506
|
out:false,
|
|
3496
3507
|
leave:false,
|
|
3508
|
+
cancel:false
|
|
3497
3509
|
},
|
|
3498
3510
|
clear:{
|
|
3499
3511
|
down:false,
|
|
@@ -3501,7 +3513,8 @@
|
|
|
3501
3513
|
up:false,
|
|
3502
3514
|
enter:false,
|
|
3503
3515
|
out:false,
|
|
3504
|
-
leave:false,
|
|
3516
|
+
leave:false,
|
|
3517
|
+
cancel:false
|
|
3505
3518
|
},
|
|
3506
3519
|
history:{
|
|
3507
3520
|
down:[],
|
|
@@ -3518,7 +3531,8 @@
|
|
|
3518
3531
|
up:[(self)=>console.log({ux:self.ux,uy:self.uy,down:self.down,move:self.move,t:self.dt})],
|
|
3519
3532
|
enter:[(self)=>console.log({dx:self.dx,dy:self.dy,down:self.down,move:self.move,t:self.dt})],
|
|
3520
3533
|
out:[(self)=>console.log({mx:self.mx,my:self.my,down:self.down,move:self.move,t:self.dt})],
|
|
3521
|
-
leave:[(self)=>console.log({ux:self.ux,uy:self.uy,down:self.down,move:self.move,t:self.dt})]
|
|
3534
|
+
leave:[(self)=>console.log({ux:self.ux,uy:self.uy,down:self.down,move:self.move,t:self.dt})],
|
|
3535
|
+
cancel:[(self)=>console.log({ux:self.ux,uy:self.uy,down:self.down,move:self.move,t:self.dt})]
|
|
3522
3536
|
}
|
|
3523
3537
|
};
|
|
3524
3538
|
this.__controller={
|
|
@@ -3528,36 +3542,42 @@
|
|
|
3528
3542
|
enter:pointerenter_controller.bind(this),
|
|
3529
3543
|
out:pointerout_controller.bind(this),
|
|
3530
3544
|
leave:pointerleave_controller.bind(this),
|
|
3545
|
+
cancel:pointercancel_controller.bind(this),
|
|
3531
3546
|
};
|
|
3532
3547
|
}
|
|
3533
3548
|
onDown(...callbacks){
|
|
3534
3549
|
if(callbacks.length===0)callbacks=[()=>{}];
|
|
3535
|
-
this.__onEvent("down",{down:true,move:false,up:false,enter:false,out:false,leave:false},...callbacks);
|
|
3550
|
+
this.__onEvent("down",{down:true,move:false,up:false,enter:false,out:false,leave:false,cancel:false},...callbacks);
|
|
3536
3551
|
return this;
|
|
3537
3552
|
}
|
|
3538
3553
|
onMove(...callbacks){
|
|
3539
3554
|
if(callbacks.length===0)callbacks=[()=>{}];
|
|
3540
|
-
this.__onEvent("move",{down:false,move:true,up:false,enter:false,out:false,leave:false},...callbacks);
|
|
3555
|
+
this.__onEvent("move",{down:false,move:true,up:false,enter:false,out:false,leave:false,cancel:false},...callbacks);
|
|
3541
3556
|
return this;
|
|
3542
3557
|
}
|
|
3543
3558
|
onUp(...callbacks){
|
|
3544
3559
|
if(callbacks.length===0)callbacks=[()=>{}];
|
|
3545
|
-
this.__onEvent("up",{down:false,move:false,up:true,enter:false,out:false,leave:false},...callbacks);
|
|
3560
|
+
this.__onEvent("up",{down:false,move:false,up:true,enter:false,out:false,leave:false,cancel:false},...callbacks);
|
|
3546
3561
|
return this;
|
|
3547
3562
|
}
|
|
3548
3563
|
onEnter(...callbacks){
|
|
3549
3564
|
if(callbacks.length===0)callbacks=[()=>{}];
|
|
3550
|
-
this.__onEvent("enter",{down:false,move:false,up:false,enter:true,out:false,leave:false},...callbacks);
|
|
3565
|
+
this.__onEvent("enter",{down:false,move:false,up:false,enter:true,out:false,leave:false,cancel:false},...callbacks);
|
|
3551
3566
|
return this;
|
|
3552
3567
|
}
|
|
3553
3568
|
onOut(...callbacks){
|
|
3554
3569
|
if(callbacks.length===0)callbacks=[()=>{}];
|
|
3555
|
-
this.__onEvent("out",{down:false,move:false,up:false,enter:false,out:true,leave:false},...callbacks);
|
|
3570
|
+
this.__onEvent("out",{down:false,move:false,up:false,enter:false,out:true,leave:false,cancel:false},...callbacks);
|
|
3556
3571
|
return this;
|
|
3557
3572
|
}
|
|
3558
3573
|
onLeave(...callbacks){
|
|
3559
3574
|
if(callbacks.length===0)callbacks=[()=>{}];
|
|
3560
|
-
this.__onEvent("leave",{down:false,move:false,up:false,enter:false,out:false,leave:true},...callbacks);
|
|
3575
|
+
this.__onEvent("leave",{down:false,move:false,up:false,enter:false,out:false,leave:true,cancel:false},...callbacks);
|
|
3576
|
+
return this;
|
|
3577
|
+
}
|
|
3578
|
+
onCancel(...callbacks){
|
|
3579
|
+
if(callbacks.length===0)callbacks=[()=>{}];
|
|
3580
|
+
this.__onEvent("cancel",{down:false,move:false,up:false,enter:false,out:false,leave:false,cancel:true},...callbacks);
|
|
3561
3581
|
return this;
|
|
3562
3582
|
}
|
|
3563
3583
|
// handle({down=false,move=false,up=false}={}){
|
|
@@ -4959,91 +4979,6 @@
|
|
|
4959
4979
|
}
|
|
4960
4980
|
const useGeolocation=()=>new ZikoUseGeolocation();
|
|
4961
4981
|
|
|
4962
|
-
function useType(func, ...expectedTypes) {
|
|
4963
|
-
const argNames = func.toString()
|
|
4964
|
-
.match(/\(([^)]*)\)/)[1]
|
|
4965
|
-
.split(',')
|
|
4966
|
-
.map(arg => arg.trim());
|
|
4967
|
-
return function(...args) {
|
|
4968
|
-
const lastExpectedType = expectedTypes[expectedTypes.length - 1];
|
|
4969
|
-
for (let i = 0; i < args.length; i++) {
|
|
4970
|
-
const isRestParam = i >= expectedTypes.length;
|
|
4971
|
-
const expectedType = isRestParam ? lastExpectedType : expectedTypes[i];
|
|
4972
|
-
const arg = args[i];
|
|
4973
|
-
isRestParam ? `${argNames[argNames.length - 1]}[${i - expectedTypes.length + 1}]` : argNames[i] || `Argument ${i + 1}`;
|
|
4974
|
-
let isValid = false;
|
|
4975
|
-
if(typeof expectedType === "object"){
|
|
4976
|
-
if (expectedType.or) {
|
|
4977
|
-
for (const type of expectedType.types) {
|
|
4978
|
-
if (checkTypeOrInstance(type, arg)) {
|
|
4979
|
-
isValid = true;
|
|
4980
|
-
break;
|
|
4981
|
-
}
|
|
4982
|
-
}
|
|
4983
|
-
}
|
|
4984
|
-
if (expectedType.nor) {
|
|
4985
|
-
for (const type of expectedType.types) {
|
|
4986
|
-
if (checkTypeOrInstance(type, arg)) {
|
|
4987
|
-
isValid = false;
|
|
4988
|
-
break;
|
|
4989
|
-
}
|
|
4990
|
-
isValid = true;
|
|
4991
|
-
}
|
|
4992
|
-
}
|
|
4993
|
-
else if (expectedType.not) isValid = !checkTypeOrInstance(expectedType.type, arg);
|
|
4994
|
-
}
|
|
4995
|
-
else isValid = checkTypeOrInstance(expectedType, arg);
|
|
4996
|
-
// Should Fix Nor error Message
|
|
4997
|
-
if (!isValid) {
|
|
4998
|
-
// const expectedTypeName = typeof expectedType === 'object'
|
|
4999
|
-
// ? expectedType.or
|
|
5000
|
-
// ? expectedType.types.map(type => (typeof type === 'string' ? type : type.name)).join(' or ')
|
|
5001
|
-
// : expectedType.not
|
|
5002
|
-
// ? `not ${typeof expectedType.type === 'string' ? expectedType.type : expectedType.type.name}`
|
|
5003
|
-
// : Array.isArray(expectedType)
|
|
5004
|
-
// ? `[${expectedType.map(type => (typeof type === 'string' ? type : type.name)).join(', ')}]`
|
|
5005
|
-
// : `{${Object.entries(expectedType).map(([key, type]) => `${key}: ${typeof type === 'string' ? type : type.name}`).join(', ')}}`
|
|
5006
|
-
// : typeof expectedType === 'string'
|
|
5007
|
-
// ? expectedType
|
|
5008
|
-
// : expectedType.name;
|
|
5009
|
-
// throw new TypeError(`${argName} should be of type ${expectedTypeName}`);
|
|
5010
|
-
throw new TypeError("jjj")
|
|
5011
|
-
}
|
|
5012
|
-
}
|
|
5013
|
-
return func(...args);
|
|
5014
|
-
};
|
|
5015
|
-
}
|
|
5016
|
-
|
|
5017
|
-
function useOr(...types) {
|
|
5018
|
-
return { or: true, types };
|
|
5019
|
-
}
|
|
5020
|
-
function useNot(type) {
|
|
5021
|
-
return { not: true, type };
|
|
5022
|
-
}
|
|
5023
|
-
function useNor(...types){
|
|
5024
|
-
return { nor: true, types}
|
|
5025
|
-
}
|
|
5026
|
-
const checkTypeOrInstance = (type, arg) => {
|
|
5027
|
-
if (typeof type === 'string') return typeof arg === type;
|
|
5028
|
-
else if (type instanceof Function) return arg instanceof type;
|
|
5029
|
-
else if (Array.isArray(type))
|
|
5030
|
-
return (!Array.isArray(arg) || arg.length !== type.length)? false: arg.every((item, index) => checkTypeOrInstance(type[index], item));
|
|
5031
|
-
else if (typeof type === 'object' && !Array.isArray(type))
|
|
5032
|
-
return (typeof arg !== 'object' || arg === null)? false : Object.keys(type).every(key => key in arg && checkTypeOrInstance(type[key], arg[key]))
|
|
5033
|
-
return false;
|
|
5034
|
-
};
|
|
5035
|
-
globalThis.useType = useType;
|
|
5036
|
-
globalThis.useNot = useNot;
|
|
5037
|
-
globalThis.useOr = useOr;
|
|
5038
|
-
|
|
5039
|
-
function add$1(a, b = 0){
|
|
5040
|
-
return a+b
|
|
5041
|
-
}
|
|
5042
|
-
|
|
5043
|
-
add$1 = useType(add$1,"number",useNor("string","number"));
|
|
5044
|
-
|
|
5045
|
-
console.log(add$1(1));
|
|
5046
|
-
|
|
5047
4982
|
class ZikoTimeLoop {
|
|
5048
4983
|
constructor(callback, step = 1000/30, startTime=0, endTime = Infinity, started = true) {
|
|
5049
4984
|
this.callback = callback;
|
|
@@ -5309,7 +5244,7 @@
|
|
|
5309
5244
|
}
|
|
5310
5245
|
});
|
|
5311
5246
|
|
|
5312
|
-
observer.observe(document
|
|
5247
|
+
observer.observe(document?.body, {
|
|
5313
5248
|
childList: true,
|
|
5314
5249
|
subtree: true
|
|
5315
5250
|
});
|
|
@@ -5577,9 +5512,9 @@
|
|
|
5577
5512
|
|
|
5578
5513
|
class ZikoUIElement {
|
|
5579
5514
|
constructor(element,name="") {
|
|
5580
|
-
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis
|
|
5515
|
+
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
|
|
5581
5516
|
if(typeof element === "string") {
|
|
5582
|
-
element === "svg" ? element=document
|
|
5517
|
+
element === "svg" ? element=globalThis?.document?.createElementNS("http://www.w3.org/2000/svg", "svg"): element = globalThis?.document?.createElement(element);
|
|
5583
5518
|
}
|
|
5584
5519
|
this.element = element;
|
|
5585
5520
|
this.uuid=this.constructor.name+"-"+Random.string(10);
|
|
@@ -5687,6 +5622,41 @@
|
|
|
5687
5622
|
this.st.size(width,height);
|
|
5688
5623
|
return this;
|
|
5689
5624
|
}
|
|
5625
|
+
get #SwitchedStyleRTL_LTR(){
|
|
5626
|
+
const CalculedStyle = globalThis.getComputedStyle(this.element);
|
|
5627
|
+
const SwitchedStyle = {};
|
|
5628
|
+
if(CalculedStyle.marginRight!=="0px")Object.assign(SwitchedStyle, {marginLeft: CalculedStyle.marginRight});
|
|
5629
|
+
if(CalculedStyle.marginLeft!=="0px")Object.assign(SwitchedStyle, {marginRight: CalculedStyle.marginLeft});
|
|
5630
|
+
if(CalculedStyle.paddingRight!=="0px")Object.assign(SwitchedStyle, {paddingLeft: CalculedStyle.paddingRight});
|
|
5631
|
+
if(CalculedStyle.paddingLeft!=="0px")Object.assign(SwitchedStyle, {paddingRight: CalculedStyle.paddingLeft});
|
|
5632
|
+
if(CalculedStyle.left!=="0px")Object.assign(SwitchedStyle, {right: CalculedStyle.left});
|
|
5633
|
+
if(CalculedStyle.right!=="0px")Object.assign(SwitchedStyle, {left: CalculedStyle.right});
|
|
5634
|
+
if(CalculedStyle.textAlign === "right")Object.assign(SwitchedStyle, {textAlign: "left"});
|
|
5635
|
+
if(CalculedStyle.textAlign === "left")Object.assign(SwitchedStyle, {textAlign: "right"});
|
|
5636
|
+
if(CalculedStyle.float === "right")Object.assign(SwitchedStyle, {float: "left"});
|
|
5637
|
+
if(CalculedStyle.float === "left")Object.assign(SwitchedStyle, {float: "right"});
|
|
5638
|
+
if(CalculedStyle.borderRadiusLeft!=="0px")Object.assign(SwitchedStyle, {right: CalculedStyle.borderRadiusRight});
|
|
5639
|
+
if(CalculedStyle.borderRadiusRight!=="0px")Object.assign(SwitchedStyle, {right: CalculedStyle.borderRadiusLeft});
|
|
5640
|
+
if(["flex","inline-flex"].includes(CalculedStyle.display)){
|
|
5641
|
+
if(CalculedStyle.justifyContent === "flex-end")Object.assign(SwitchedStyle, {justifyContent: "flex-start"});
|
|
5642
|
+
if(CalculedStyle.justifyContent === "flex-start")Object.assign(SwitchedStyle, {justifyContent: "flex-end"});
|
|
5643
|
+
}
|
|
5644
|
+
return SwitchedStyle;
|
|
5645
|
+
}
|
|
5646
|
+
useRtl(switchAll = false){
|
|
5647
|
+
switchAll ? this.style({
|
|
5648
|
+
...this.#SwitchedStyleRTL_LTR,
|
|
5649
|
+
direction : "rtl"
|
|
5650
|
+
}) : this.style({direction : "rtl"});
|
|
5651
|
+
return this;
|
|
5652
|
+
}
|
|
5653
|
+
useLtr(switchAll = false){
|
|
5654
|
+
switchAll ? this.style({
|
|
5655
|
+
...this.#SwitchedStyleRTL_LTR,
|
|
5656
|
+
direction : "ltr"
|
|
5657
|
+
}) : this.style({direction : "ltr"});
|
|
5658
|
+
return this;
|
|
5659
|
+
}
|
|
5690
5660
|
freeze(freeze){
|
|
5691
5661
|
this.cache.isFrozzen=freeze;
|
|
5692
5662
|
return this;
|
|
@@ -5701,7 +5671,7 @@
|
|
|
5701
5671
|
render(/*render = true , */target = this.target) {
|
|
5702
5672
|
if(target instanceof ZikoUIElement)target=target.element;
|
|
5703
5673
|
this.target=target;
|
|
5704
|
-
this.target
|
|
5674
|
+
this.target?.appendChild(this.element);
|
|
5705
5675
|
// if(render) {
|
|
5706
5676
|
// this.target.appendChild(this.element);
|
|
5707
5677
|
// }
|
|
@@ -5710,7 +5680,7 @@
|
|
|
5710
5680
|
}
|
|
5711
5681
|
unrender(){
|
|
5712
5682
|
if(this.cache.parent)this.cache.parent.remove(this);
|
|
5713
|
-
else if(this.target
|
|
5683
|
+
else if(this.target?.children?.length && [...this.target?.children].includes(this.element)) this.target.removeChild(this.element);
|
|
5714
5684
|
return this;
|
|
5715
5685
|
}
|
|
5716
5686
|
renderAfter(t = 1) {
|
|
@@ -5808,6 +5778,11 @@
|
|
|
5808
5778
|
this.events.ptr.onOut(...callbacks);
|
|
5809
5779
|
return this;
|
|
5810
5780
|
}
|
|
5781
|
+
onPtrCancel(...callbacks){
|
|
5782
|
+
if(!this.events.ptr)this.events.ptr = usePointerEvent(this);
|
|
5783
|
+
this.events.ptr.onCancel(...callbacks);
|
|
5784
|
+
return this;
|
|
5785
|
+
}
|
|
5811
5786
|
onMouseMove(...callbacks){
|
|
5812
5787
|
if(!this.events.mouse)this.events.mouse = useMouseEvent(this);
|
|
5813
5788
|
this.events.mouse.onMove(...callbacks);
|
|
@@ -5997,6 +5972,9 @@
|
|
|
5997
5972
|
if (typeof w == "number") w += "%";
|
|
5998
5973
|
if (typeof h == "number") h += "%";
|
|
5999
5974
|
this.style({ border: "1px solid black", width: w, height: h });
|
|
5975
|
+
}
|
|
5976
|
+
get isImg(){
|
|
5977
|
+
return true;
|
|
6000
5978
|
}
|
|
6001
5979
|
updateSrc(url){
|
|
6002
5980
|
this.value=url;
|
|
@@ -6021,22 +5999,21 @@
|
|
|
6021
5999
|
constructor(src,caption){
|
|
6022
6000
|
super("figure","figure");
|
|
6023
6001
|
this.img=src.width("100%").element;
|
|
6024
|
-
this.caption=document
|
|
6002
|
+
this.caption=document?.createElementt("figcaption");
|
|
6025
6003
|
this.caption.append(caption.element);
|
|
6026
6004
|
this.element.append(this.img);
|
|
6027
6005
|
this.element.append(this.caption);
|
|
6028
6006
|
}
|
|
6007
|
+
get isFigure(){
|
|
6008
|
+
return true;
|
|
6009
|
+
}
|
|
6029
6010
|
}
|
|
6030
6011
|
const figure =(image,caption) =>new ZikoUIFigure(image,caption);
|
|
6031
6012
|
|
|
6032
|
-
class
|
|
6033
|
-
constructor(
|
|
6034
|
-
super(
|
|
6035
|
-
|
|
6036
|
-
else this.element.setAttribute("src", src);
|
|
6037
|
-
if (typeof w == "number") w += "%";
|
|
6038
|
-
if (typeof h == "number") h += "%";
|
|
6039
|
-
this.style({ width: w, height: h });
|
|
6013
|
+
class __ZikoUIDynamicMediaElement__ extends ZikoUIElement {
|
|
6014
|
+
constructor(element, name) {
|
|
6015
|
+
super(element, name);
|
|
6016
|
+
this.useControls();
|
|
6040
6017
|
}
|
|
6041
6018
|
get t(){
|
|
6042
6019
|
return this.element.currentTime;
|
|
@@ -6045,20 +6022,24 @@
|
|
|
6045
6022
|
this.element.controls = enabled;
|
|
6046
6023
|
return this;
|
|
6047
6024
|
}
|
|
6048
|
-
|
|
6049
|
-
this.element.
|
|
6025
|
+
enableControls(){
|
|
6026
|
+
this.element.controls = true;
|
|
6050
6027
|
return this;
|
|
6051
6028
|
}
|
|
6052
|
-
|
|
6053
|
-
this.element.
|
|
6029
|
+
disableControls(){
|
|
6030
|
+
this.element.controls = true;
|
|
6054
6031
|
return this;
|
|
6055
6032
|
}
|
|
6056
|
-
|
|
6057
|
-
this.element.
|
|
6033
|
+
toggleControls(){
|
|
6034
|
+
this.element.controls = !this.element.controls;
|
|
6058
6035
|
return this;
|
|
6059
6036
|
}
|
|
6060
|
-
|
|
6061
|
-
this.element.
|
|
6037
|
+
play() {
|
|
6038
|
+
this.element.play();
|
|
6039
|
+
return this;
|
|
6040
|
+
}
|
|
6041
|
+
pause() {
|
|
6042
|
+
this.element.pause();
|
|
6062
6043
|
return this;
|
|
6063
6044
|
}
|
|
6064
6045
|
seekTo(time) {
|
|
@@ -6071,39 +6052,40 @@
|
|
|
6071
6052
|
onPause(){
|
|
6072
6053
|
|
|
6073
6054
|
}
|
|
6074
|
-
}
|
|
6075
|
-
const video = (src, width, height) => new ZikoUIVideo(src, width, height);
|
|
6055
|
+
}
|
|
6076
6056
|
|
|
6077
|
-
class
|
|
6078
|
-
constructor(src) {
|
|
6079
|
-
super("
|
|
6080
|
-
this.element.setAttribute("src", src);
|
|
6081
|
-
this.
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
}
|
|
6086
|
-
useControls(enabled = true) {
|
|
6087
|
-
this.element.controls = enabled;
|
|
6088
|
-
return this;
|
|
6057
|
+
class ZikoUIVideo extends __ZikoUIDynamicMediaElement__ {
|
|
6058
|
+
constructor(src="", w = "100%", h = "50vh") {
|
|
6059
|
+
super("video","video");
|
|
6060
|
+
if (src.nodeName === "VIDEO") this.element.setAttribute("src", src.src);
|
|
6061
|
+
else this.element.setAttribute("src", src);
|
|
6062
|
+
if (typeof w == "number") w += "%";
|
|
6063
|
+
if (typeof h == "number") h += "%";
|
|
6064
|
+
this.style({ width: w, height: h });
|
|
6089
6065
|
}
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
return this;
|
|
6066
|
+
get isVideo(){
|
|
6067
|
+
return true;
|
|
6093
6068
|
}
|
|
6094
|
-
|
|
6095
|
-
this.element.
|
|
6069
|
+
usePoster(src=""){
|
|
6070
|
+
this.element.poster=src;
|
|
6096
6071
|
return this;
|
|
6097
6072
|
}
|
|
6098
|
-
|
|
6099
|
-
this.element.
|
|
6073
|
+
usePIP(e){
|
|
6074
|
+
this.element.requestPictureInPicture(e);
|
|
6100
6075
|
return this;
|
|
6101
6076
|
}
|
|
6102
|
-
|
|
6103
|
-
|
|
6077
|
+
}
|
|
6078
|
+
const video = (src, width, height) => new ZikoUIVideo(src, width, height);
|
|
6079
|
+
|
|
6080
|
+
class ZikoUIAudio extends __ZikoUIDynamicMediaElement__ {
|
|
6081
|
+
constructor(src) {
|
|
6082
|
+
super("audio","audio");
|
|
6083
|
+
this.element.setAttribute("src", src);
|
|
6084
|
+
this.size("150px","30px");
|
|
6085
|
+
// this.useControls();
|
|
6104
6086
|
}
|
|
6105
|
-
|
|
6106
|
-
|
|
6087
|
+
get isAudio(){
|
|
6088
|
+
return true;
|
|
6107
6089
|
}
|
|
6108
6090
|
}
|
|
6109
6091
|
const audio = (src) => new ZikoUIAudio(src);
|
|
@@ -7086,8 +7068,8 @@
|
|
|
7086
7068
|
}
|
|
7087
7069
|
toTable() {
|
|
7088
7070
|
var table = new DocumentFragment();
|
|
7089
|
-
var Tr = new Array(this.rows).fill(null).map(() => document
|
|
7090
|
-
var Td = this.arr.map((n) => n.map(() => document
|
|
7071
|
+
var Tr = new Array(this.rows).fill(null).map(() => document?.createElement("tr"));
|
|
7072
|
+
var Td = this.arr.map((n) => n.map(() => document?.createElement("td")));
|
|
7091
7073
|
for (let i = 0; i < Td.length; i++) {
|
|
7092
7074
|
for (let j = 0; j < Td[0].length; j++) {
|
|
7093
7075
|
Td[i][j].innerHTML = this.arr[i][j];
|
|
@@ -8100,6 +8082,9 @@
|
|
|
8100
8082
|
lineBreak,
|
|
8101
8083
|
});
|
|
8102
8084
|
}
|
|
8085
|
+
get isText(){
|
|
8086
|
+
return true;
|
|
8087
|
+
}
|
|
8103
8088
|
get value(){
|
|
8104
8089
|
return this.element.textContent;
|
|
8105
8090
|
}
|
|
@@ -8110,11 +8095,11 @@
|
|
|
8110
8095
|
}
|
|
8111
8096
|
addValue(...value) {
|
|
8112
8097
|
value.forEach((item,i) => {
|
|
8113
|
-
if (typeof item === "string" || typeof item === "number") this.element
|
|
8114
|
-
else if (item instanceof ZikoUIElement) this.element
|
|
8115
|
-
else if (item instanceof Complex || item instanceof Matrix) this.element
|
|
8116
|
-
else if (item instanceof Array) this.element
|
|
8117
|
-
else if (item instanceof Object) this.element
|
|
8098
|
+
if (typeof item === "string" || typeof item === "number") this.element?.appendChild(globalThis?.document.createTextNode(item));
|
|
8099
|
+
else if (item instanceof ZikoUIElement) this.element?.appendChild(item.element);
|
|
8100
|
+
else if (item instanceof Complex || item instanceof Matrix) this.element?.appendChild(new Text(item.toString()));
|
|
8101
|
+
else if (item instanceof Array) this.element?.appendChild(new Text(arr2str(item)));
|
|
8102
|
+
else if (item instanceof Object) this.element?.appendChild(new Text(obj2str(item)));
|
|
8118
8103
|
|
|
8119
8104
|
// if(
|
|
8120
8105
|
// (item !== value[value.length - 1])
|
|
@@ -8122,11 +8107,11 @@
|
|
|
8122
8107
|
// && !(value[i-1] instanceof ZikoUIElement)
|
|
8123
8108
|
// ) this.element.appendChild(new Text(" "))
|
|
8124
8109
|
|
|
8125
|
-
if(this.cache.lineBreak)this.element
|
|
8110
|
+
if(this.cache.lineBreak)this.element?.appendChild(globalThis.document?.createElement("br"));
|
|
8126
8111
|
});
|
|
8127
|
-
this.element
|
|
8128
|
-
.replace(/\n/g, '<br>')
|
|
8129
|
-
|
|
8112
|
+
if(this.element?.innerHTML){
|
|
8113
|
+
this.element.innerHTML = this.element.innerHTML.replace(/\n/g, '<br>').replace(/(?<!<[^>]+) /g, ' ');
|
|
8114
|
+
}
|
|
8130
8115
|
return this
|
|
8131
8116
|
}
|
|
8132
8117
|
setValue(...value) {
|
|
@@ -8148,32 +8133,50 @@
|
|
|
8148
8133
|
fontStyle: "italic"
|
|
8149
8134
|
});
|
|
8150
8135
|
}
|
|
8136
|
+
get isQuote(){
|
|
8137
|
+
return true
|
|
8138
|
+
}
|
|
8151
8139
|
}
|
|
8152
8140
|
class ZikoUIDefintion extends __ZikoUIText__ {
|
|
8153
8141
|
constructor(...value) {
|
|
8154
8142
|
super("dfn", "dfnText", false, ...value);
|
|
8155
8143
|
}
|
|
8144
|
+
get isDfnText(){
|
|
8145
|
+
return true
|
|
8146
|
+
}
|
|
8156
8147
|
}
|
|
8157
8148
|
class ZikoUISupText extends __ZikoUIText__ {
|
|
8158
8149
|
constructor(sup) {
|
|
8159
8150
|
super("sup", "supText", false, sup);
|
|
8160
8151
|
}
|
|
8152
|
+
get isSupText(){
|
|
8153
|
+
return true
|
|
8154
|
+
}
|
|
8161
8155
|
}
|
|
8162
8156
|
class ZikoUISubText extends __ZikoUIText__ {
|
|
8163
8157
|
constructor(...value) {
|
|
8164
8158
|
super("sub", "subText", false, ...value);
|
|
8165
8159
|
}
|
|
8160
|
+
get isSubText(){
|
|
8161
|
+
return true
|
|
8162
|
+
}
|
|
8166
8163
|
}
|
|
8167
8164
|
class ZikoUICodeText extends __ZikoUIText__ {
|
|
8168
8165
|
constructor(...value) {
|
|
8169
8166
|
super("code", "codeText", false, ...value);
|
|
8170
8167
|
}
|
|
8168
|
+
get isCodeText(){
|
|
8169
|
+
return true
|
|
8170
|
+
}
|
|
8171
8171
|
}
|
|
8172
8172
|
class ZikoUIAbbrText extends __ZikoUIText__ {
|
|
8173
8173
|
constructor(abbr, title) {
|
|
8174
8174
|
super("abbr", "abbrText", false, abbr);
|
|
8175
8175
|
this.setAttr("title", title);
|
|
8176
8176
|
}
|
|
8177
|
+
get isAbbrText(){
|
|
8178
|
+
return true
|
|
8179
|
+
}
|
|
8177
8180
|
}
|
|
8178
8181
|
const text$1 = (...str) => new ZikoUIText(...str);
|
|
8179
8182
|
const quote = (...str) => new ZikoUIQuote(...str);
|
|
@@ -8187,12 +8190,18 @@
|
|
|
8187
8190
|
constructor(...value) {
|
|
8188
8191
|
super("p", "p", true, ...value);
|
|
8189
8192
|
}
|
|
8193
|
+
get isPara(){
|
|
8194
|
+
return true;
|
|
8195
|
+
}
|
|
8190
8196
|
}
|
|
8191
8197
|
class ZikoUIBlockQuote extends __ZikoUIText__ {
|
|
8192
8198
|
constructor(cite,quote) {
|
|
8193
8199
|
super("blockquote", "blockquote", true, quote);
|
|
8194
8200
|
this.setAttr("cite", cite);
|
|
8195
8201
|
}
|
|
8202
|
+
get isBlockQuote(){
|
|
8203
|
+
return true;
|
|
8204
|
+
}
|
|
8196
8205
|
}
|
|
8197
8206
|
const p = (...ZikoUIElement) => new ZikoUIParagraphe(...ZikoUIElement);
|
|
8198
8207
|
const blockQuote = (cite, quote) => new ZikoUIBlockQuote(cite, quote);
|
|
@@ -8202,6 +8211,9 @@
|
|
|
8202
8211
|
super(`h${type}`,`h${type}`);
|
|
8203
8212
|
this.element.textContent = value;
|
|
8204
8213
|
}
|
|
8214
|
+
get isHeading(){
|
|
8215
|
+
return true;
|
|
8216
|
+
}
|
|
8205
8217
|
get value() {
|
|
8206
8218
|
return this.element.innerText;
|
|
8207
8219
|
}
|
|
@@ -8229,11 +8241,14 @@
|
|
|
8229
8241
|
class ZikoUIBtn extends ZikoUIElement {
|
|
8230
8242
|
constructor(value = "button") {
|
|
8231
8243
|
super("button","btn");
|
|
8232
|
-
this.element = document
|
|
8244
|
+
this.element = document?.createElement("button");
|
|
8233
8245
|
this.setValue(value);
|
|
8234
8246
|
this.st.cursor("pointer");
|
|
8235
8247
|
globalThis.__Ziko__.__Config__.default.render && this.render();
|
|
8236
8248
|
}
|
|
8249
|
+
get isBtn(){
|
|
8250
|
+
return true
|
|
8251
|
+
}
|
|
8237
8252
|
setValue(value) {
|
|
8238
8253
|
if (value instanceof ZikoUIElement) value.setTarget(this.element);
|
|
8239
8254
|
else {
|
|
@@ -8257,23 +8272,43 @@
|
|
|
8257
8272
|
class ZikoUIBr extends ZikoUIElement {
|
|
8258
8273
|
constructor() {
|
|
8259
8274
|
super("br","br");
|
|
8260
|
-
|
|
8275
|
+
}
|
|
8276
|
+
get isBr(){
|
|
8277
|
+
return true
|
|
8261
8278
|
}
|
|
8262
8279
|
}
|
|
8263
8280
|
class ZikoUIHr extends ZikoUIElement {
|
|
8264
8281
|
constructor() {
|
|
8265
8282
|
super("hr","hr");
|
|
8266
|
-
|
|
8283
|
+
}
|
|
8284
|
+
get isHr(){
|
|
8285
|
+
return true
|
|
8267
8286
|
}
|
|
8268
8287
|
}
|
|
8269
8288
|
class ZikoUILink extends ZikoUIContainerElement{
|
|
8270
8289
|
constructor(href){
|
|
8271
8290
|
super("a","link");
|
|
8291
|
+
Object.assign(this.cache,{
|
|
8292
|
+
defaultStyle:{
|
|
8293
|
+
color:"#0275d8",
|
|
8294
|
+
textDecoration: "none"
|
|
8295
|
+
},
|
|
8296
|
+
hoverStyle:{
|
|
8297
|
+
color:"#01447e",
|
|
8298
|
+
textDecoration: "underline"
|
|
8299
|
+
},
|
|
8300
|
+
});
|
|
8272
8301
|
this.setHref(href);
|
|
8302
|
+
this.style(this.cache.defaultStyle);
|
|
8303
|
+
this.onPtrEnter(()=>this.style(this.cache.hoverStyle));
|
|
8304
|
+
this.onPtrLeave(()=>this.style(this.cache.defaultStyle));
|
|
8273
8305
|
}
|
|
8274
8306
|
setHref(href){
|
|
8275
8307
|
this.element.href=href;
|
|
8276
8308
|
}
|
|
8309
|
+
get isLink(){
|
|
8310
|
+
return true
|
|
8311
|
+
}
|
|
8277
8312
|
}
|
|
8278
8313
|
const br = () => new ZikoUIBr();
|
|
8279
8314
|
const hr = () => new ZikoUIHr();
|
|
@@ -8288,6 +8323,9 @@
|
|
|
8288
8323
|
super("li","li");
|
|
8289
8324
|
this.append(UI);
|
|
8290
8325
|
}
|
|
8326
|
+
get isLi(){
|
|
8327
|
+
return true;
|
|
8328
|
+
}
|
|
8291
8329
|
}
|
|
8292
8330
|
class ZikoUIList extends ZikoUIContainerElement {
|
|
8293
8331
|
constructor(element,name) {
|
|
@@ -8295,6 +8333,9 @@
|
|
|
8295
8333
|
delete this.append;
|
|
8296
8334
|
this.style({ listStylePosition: "inside" });
|
|
8297
8335
|
}
|
|
8336
|
+
get isList(){
|
|
8337
|
+
return true;
|
|
8338
|
+
}
|
|
8298
8339
|
append(...arr){
|
|
8299
8340
|
for (let i = 0; i < arr.length; i++) {
|
|
8300
8341
|
let li = null;
|
|
@@ -8387,6 +8428,9 @@
|
|
|
8387
8428
|
super("ol","ol");
|
|
8388
8429
|
this.append(...arr);
|
|
8389
8430
|
}
|
|
8431
|
+
get isOl(){
|
|
8432
|
+
return true;
|
|
8433
|
+
}
|
|
8390
8434
|
type(tp = 1) {
|
|
8391
8435
|
this.element.setAttribute("type", tp);
|
|
8392
8436
|
return this;
|
|
@@ -8401,93 +8445,68 @@
|
|
|
8401
8445
|
super("ul","ul");
|
|
8402
8446
|
this.append(...arr);
|
|
8403
8447
|
}
|
|
8448
|
+
get isUl(){
|
|
8449
|
+
return true;
|
|
8450
|
+
}
|
|
8404
8451
|
}
|
|
8405
8452
|
const li=UI=>new ZikoUILI(UI);
|
|
8406
8453
|
const ol = (...arr) => new ZikoUIOList(...arr);
|
|
8407
8454
|
const ul = (...arr) => new ZikoUIUList(...arr);
|
|
8408
8455
|
|
|
8409
|
-
class ZikoUIInputOption extends ZikoUIElement {
|
|
8410
|
-
constructor(value = "") {
|
|
8411
|
-
super();
|
|
8412
|
-
this.element = document.createElement("option");
|
|
8413
|
-
if(value instanceof Object&&"value" in value){
|
|
8414
|
-
this.setValue(value.value);
|
|
8415
|
-
this.setText(value?.text??value.value);
|
|
8416
|
-
}
|
|
8417
|
-
else this.setValue(value);
|
|
8418
|
-
}
|
|
8419
|
-
setValue(str = "") {
|
|
8420
|
-
this.element.value = str;
|
|
8421
|
-
return this;
|
|
8422
|
-
}
|
|
8423
|
-
setText(text=""){
|
|
8424
|
-
if(text)this.element.textContent=text;
|
|
8425
|
-
return this;
|
|
8426
|
-
}
|
|
8427
|
-
}
|
|
8428
|
-
|
|
8429
|
-
class ZikoUITextArea extends ZikoUIElement {
|
|
8430
|
-
constructor() {
|
|
8431
|
-
super();
|
|
8432
|
-
this.element = document.createElement("textarea");
|
|
8433
|
-
//Object.assign(this,inputComposer.call(this));
|
|
8434
|
-
}
|
|
8435
|
-
get value(){
|
|
8436
|
-
return this.element.textContent;
|
|
8437
|
-
}
|
|
8438
|
-
}
|
|
8439
|
-
|
|
8440
|
-
const textarea =()=> new ZikoUITextArea();
|
|
8441
|
-
|
|
8442
|
-
//import { select } from "./select.js";
|
|
8443
|
-
//import { debounce,throttle} from "../../Data/decorators.js";
|
|
8444
|
-
|
|
8445
8456
|
class ZikoUIInput extends ZikoUIElement {
|
|
8446
|
-
constructor(name , value = "",datalist) {
|
|
8447
|
-
super("input",
|
|
8448
|
-
Object.assign(this.events,{input:null});
|
|
8457
|
+
constructor(type, name , value = "", datalist) {
|
|
8458
|
+
super("input", "input");
|
|
8459
|
+
Object.assign(this.events, { input: null });
|
|
8449
8460
|
this.setValue(value);
|
|
8450
|
-
|
|
8461
|
+
this.setAttr("type", type);
|
|
8462
|
+
this.setAttr("name", name);
|
|
8463
|
+
if (datalist) this.linkDatalist(datalist);
|
|
8464
|
+
}
|
|
8465
|
+
get isInput() {
|
|
8466
|
+
return true;
|
|
8467
|
+
}
|
|
8468
|
+
setName(name){
|
|
8469
|
+
this.setAttr("name", name);
|
|
8470
|
+
return this;
|
|
8451
8471
|
}
|
|
8452
|
-
onInput(...callbacks){
|
|
8453
|
-
if(!this.events.input)this.events.input = useInputEvent(this);
|
|
8472
|
+
onInput(...callbacks) {
|
|
8473
|
+
if (!this.events.input) this.events.input = useInputEvent(this);
|
|
8454
8474
|
this.events.input.onInput(...callbacks);
|
|
8455
8475
|
return this;
|
|
8456
8476
|
}
|
|
8457
|
-
onChange(...callbacks){
|
|
8458
|
-
if(!this.events.input)this.events.input = useInputEvent(this);
|
|
8477
|
+
onChange(...callbacks) {
|
|
8478
|
+
if (!this.events.input) this.events.input = useInputEvent(this);
|
|
8459
8479
|
this.events.input.onChange(...callbacks);
|
|
8460
8480
|
return this;
|
|
8461
8481
|
}
|
|
8462
8482
|
linkDatalist(datalist) {
|
|
8463
8483
|
let id;
|
|
8464
|
-
if(datalist instanceof ZikoUIInputDatalist)id=datalist.Id;
|
|
8465
|
-
else if(datalist instanceof Array){
|
|
8466
|
-
const Datalist=new ZikoUIInputDatalist(...datalist);
|
|
8467
|
-
id=Datalist.Id;
|
|
8484
|
+
if (datalist instanceof ZikoUIInputDatalist) id = datalist.Id;
|
|
8485
|
+
else if (datalist instanceof Array) {
|
|
8486
|
+
const Datalist = new ZikoUIInputDatalist(...datalist);
|
|
8487
|
+
id = Datalist.Id;
|
|
8468
8488
|
console.log(Datalist);
|
|
8469
|
-
}
|
|
8470
|
-
else id=datalist;
|
|
8489
|
+
} else id = datalist;
|
|
8471
8490
|
this.element.setAttribute("list", id);
|
|
8472
8491
|
return this;
|
|
8473
8492
|
}
|
|
8474
8493
|
get value() {
|
|
8475
8494
|
return this.element.value;
|
|
8476
8495
|
}
|
|
8477
|
-
_setType(type) {
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
}
|
|
8481
|
-
setValue(value="") {
|
|
8496
|
+
// _setType(type) {
|
|
8497
|
+
// this.element.type = type;
|
|
8498
|
+
// return this;
|
|
8499
|
+
// }
|
|
8500
|
+
setValue(value = "") {
|
|
8482
8501
|
this.element.value = value;
|
|
8483
8502
|
return this;
|
|
8484
8503
|
}
|
|
8485
|
-
useState(state){
|
|
8504
|
+
useState(state) {
|
|
8486
8505
|
this.setValue(state);
|
|
8487
|
-
return [{value:this.value},e=>this.setValue(e)]
|
|
8506
|
+
return [{ value: this.value }, (e) => this.setValue(e)];
|
|
8488
8507
|
}
|
|
8489
8508
|
setPlaceholder(value) {
|
|
8490
|
-
if(value)this.element.placeholder = value;
|
|
8509
|
+
if (value) this.element.placeholder = value;
|
|
8491
8510
|
return this;
|
|
8492
8511
|
}
|
|
8493
8512
|
get isValide() {
|
|
@@ -8516,260 +8535,362 @@
|
|
|
8516
8535
|
return this;
|
|
8517
8536
|
}
|
|
8518
8537
|
}
|
|
8538
|
+
|
|
8539
|
+
const input = (value, datalist) => {
|
|
8540
|
+
if (value instanceof Object) {
|
|
8541
|
+
const { datalist, placeholder } = value;
|
|
8542
|
+
value = value.value ?? "";
|
|
8543
|
+
return new ZikoUIInput("text", "input", value, datalist).setPlaceholder(placeholder);
|
|
8544
|
+
}
|
|
8545
|
+
return new ZikoUIInput("text", "input", value, datalist);
|
|
8546
|
+
};
|
|
8547
|
+
|
|
8548
|
+
class ZikoUIInputNumber extends ZikoUIInput {
|
|
8549
|
+
constructor(min, max, step = 1) {
|
|
8550
|
+
super("number", "inpuNumber");
|
|
8551
|
+
this.setMin(min).setMax(max).setStep(step);
|
|
8552
|
+
}
|
|
8553
|
+
get isInputNumber() {
|
|
8554
|
+
return true;
|
|
8555
|
+
}
|
|
8556
|
+
get value() {
|
|
8557
|
+
return +this.element.value;
|
|
8558
|
+
}
|
|
8559
|
+
setMin(min) {
|
|
8560
|
+
this.element.min = min;
|
|
8561
|
+
return this;
|
|
8562
|
+
}
|
|
8563
|
+
setMax(max) {
|
|
8564
|
+
this.element.max = max;
|
|
8565
|
+
return this;
|
|
8566
|
+
}
|
|
8567
|
+
setStep(step) {
|
|
8568
|
+
this.element.step = step;
|
|
8569
|
+
return this;
|
|
8570
|
+
}
|
|
8571
|
+
}
|
|
8572
|
+
const inputNumber = (min, max, step) => {
|
|
8573
|
+
if (min instanceof Object) {
|
|
8574
|
+
const { value, max = 10, step = 1, placeholder = "" } = min;
|
|
8575
|
+
min = min?.min ?? 0;
|
|
8576
|
+
return new ZikoUIInputSlider(min, max, step)
|
|
8577
|
+
.setValue(value)
|
|
8578
|
+
.setPlaceholder(placeholder);
|
|
8579
|
+
}
|
|
8580
|
+
return new ZikoUIInputNumber(min, max, step);
|
|
8581
|
+
};
|
|
8582
|
+
|
|
8583
|
+
let ZikoUIInputSlider$1 = class ZikoUIInputSlider extends ZikoUIInput {
|
|
8584
|
+
constructor(val = 0, min = 0, max = 10, step = 1) {
|
|
8585
|
+
super("range", "inputSlider");
|
|
8586
|
+
this.setMin(min).setMax(max).setValue(val).setStep(step);
|
|
8587
|
+
}
|
|
8588
|
+
get isInputSlider(){
|
|
8589
|
+
return true;
|
|
8590
|
+
}
|
|
8591
|
+
setMin(min) {
|
|
8592
|
+
this.element.min = min;
|
|
8593
|
+
return this;
|
|
8594
|
+
}
|
|
8595
|
+
setMax(max) {
|
|
8596
|
+
this.element.max = max;
|
|
8597
|
+
return this;
|
|
8598
|
+
}
|
|
8599
|
+
setStep(step) {
|
|
8600
|
+
this.element.step = step;
|
|
8601
|
+
return this;
|
|
8602
|
+
}
|
|
8603
|
+
};
|
|
8604
|
+
const slider = (value, min, max, step) =>{
|
|
8605
|
+
if(value instanceof Object){
|
|
8606
|
+
const {min=0,max=10,step=1}=value;
|
|
8607
|
+
value=value?.value??5;
|
|
8608
|
+
return new ZikoUIInputSlider$1(value, min, max, step);
|
|
8609
|
+
}
|
|
8610
|
+
return new ZikoUIInputSlider$1(value, min, max, step);
|
|
8611
|
+
};
|
|
8612
|
+
|
|
8613
|
+
class ZikoUIInputColor extends ZikoUIInput {
|
|
8614
|
+
constructor() {
|
|
8615
|
+
super("color", "inputColor");
|
|
8616
|
+
this.background(this.value);
|
|
8617
|
+
this.onInput(() => this.background(this.value));
|
|
8618
|
+
}
|
|
8619
|
+
get isInputColor(){
|
|
8620
|
+
return true;
|
|
8621
|
+
}
|
|
8622
|
+
}
|
|
8623
|
+
const inputColor = () => new ZikoUIInputColor();
|
|
8624
|
+
|
|
8519
8625
|
class ZikoUIInputSearch extends ZikoUIInput {
|
|
8520
8626
|
constructor() {
|
|
8521
|
-
super("inputSearch");
|
|
8522
|
-
this._setType("search");
|
|
8627
|
+
super("search", "inputSearch");
|
|
8523
8628
|
this.Length = 0;
|
|
8524
8629
|
}
|
|
8630
|
+
get isInputSearch() {
|
|
8631
|
+
return true;
|
|
8632
|
+
}
|
|
8525
8633
|
onsearch(callback) {
|
|
8526
8634
|
this.element.addEventListener("search", () => callback());
|
|
8527
8635
|
return this;
|
|
8528
8636
|
}
|
|
8529
8637
|
connect(...UIElement) {
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
|
|
8535
|
-
|
|
8638
|
+
/*
|
|
8639
|
+
let memory = new Array(UIElement.length).fill([]);
|
|
8640
|
+
UIElement.map((n, i) => {
|
|
8641
|
+
//console.log(n)
|
|
8642
|
+
n.items.map((m, j) => {
|
|
8643
|
+
memory[i][j] = m.element.style.display;
|
|
8644
|
+
});
|
|
8536
8645
|
});
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
)
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
*/
|
|
8646
|
+
UIElement.map((n, i) =>
|
|
8647
|
+
this.onInput(() => {
|
|
8648
|
+
n.filterByTextContent(this.value, memory[i]);
|
|
8649
|
+
this.Length = n.children.filter(
|
|
8650
|
+
(n) => n.style.display != "none"
|
|
8651
|
+
).length;
|
|
8652
|
+
})
|
|
8653
|
+
);
|
|
8654
|
+
*/
|
|
8547
8655
|
return this;
|
|
8548
8656
|
}
|
|
8549
8657
|
displayLength(UIElement) {
|
|
8550
8658
|
this.element.addEventListener("keyup", () =>
|
|
8551
|
-
UIElement.setValue(this.Length)
|
|
8659
|
+
UIElement.setValue(this.Length),
|
|
8552
8660
|
);
|
|
8553
8661
|
return this;
|
|
8554
8662
|
}
|
|
8555
8663
|
}
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8664
|
+
const search = (...a) => new ZikoUIInputSearch().connect(...a);
|
|
8665
|
+
|
|
8666
|
+
class ZikoUIInputCheckbox extends ZikoUIInput {
|
|
8667
|
+
constructor() {
|
|
8668
|
+
super("checkbox", "inputCheckbox");
|
|
8669
|
+
this.cursor("pointer");
|
|
8670
|
+
}
|
|
8671
|
+
get isInputCheckbox(){
|
|
8672
|
+
return true;
|
|
8673
|
+
}
|
|
8674
|
+
get checked() {
|
|
8675
|
+
return this.element.checked;
|
|
8676
|
+
}
|
|
8677
|
+
check(checked = true) {
|
|
8678
|
+
this.element.checked = checked;
|
|
8679
|
+
return this;
|
|
8680
|
+
}
|
|
8681
|
+
color(color) {
|
|
8682
|
+
this.element.style.accentColor = color;
|
|
8683
|
+
return this;
|
|
8684
|
+
}
|
|
8577
8685
|
}
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8686
|
+
const checkbox = () => new ZikoUIInputCheckbox();
|
|
8687
|
+
|
|
8688
|
+
class ZikoUIInputRadio extends ZikoUIInput {
|
|
8689
|
+
constructor() {
|
|
8690
|
+
super("radio", "inputRadio");
|
|
8691
|
+
this.cursor("pointer");
|
|
8692
|
+
}
|
|
8693
|
+
get isInputRadio(){
|
|
8694
|
+
return true;
|
|
8695
|
+
}
|
|
8696
|
+
get checked() {
|
|
8697
|
+
return this.element.checked;
|
|
8698
|
+
}
|
|
8699
|
+
check(checked = true) {
|
|
8700
|
+
this.element.checked = checked;
|
|
8701
|
+
return this;
|
|
8702
|
+
}
|
|
8703
|
+
color(color) {
|
|
8704
|
+
this.element.style.accentColor = color;
|
|
8705
|
+
return this;
|
|
8706
|
+
}
|
|
8584
8707
|
}
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8708
|
+
const radio = () => new ZikoUIInputRadio();
|
|
8709
|
+
|
|
8710
|
+
class ZikoUIInputEmail extends ZikoUIInput {
|
|
8711
|
+
constructor() {
|
|
8712
|
+
super("email", "inputEmail");
|
|
8713
|
+
}
|
|
8714
|
+
get isInputEmail(){
|
|
8715
|
+
return true;
|
|
8716
|
+
}
|
|
8591
8717
|
}
|
|
8592
|
-
|
|
8718
|
+
const inputEmail = () => new ZikoUIInputEmail();
|
|
8719
|
+
|
|
8593
8720
|
class ZikoUIInputPassword extends ZikoUIInput {
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
constructor() {
|
|
8601
|
-
super("inputEmail");
|
|
8602
|
-
this._setType("email");
|
|
8721
|
+
constructor() {
|
|
8722
|
+
super("password", "inputPassword");
|
|
8723
|
+
}
|
|
8724
|
+
get isInputPassword(){
|
|
8725
|
+
return true;
|
|
8726
|
+
}
|
|
8603
8727
|
}
|
|
8728
|
+
const inputPassword = () => new ZikoUIInputPassword();
|
|
8729
|
+
|
|
8730
|
+
class ZikoUIInputDate extends ZikoUIInput {
|
|
8731
|
+
constructor() {
|
|
8732
|
+
super("date", "inputDate");
|
|
8733
|
+
}
|
|
8734
|
+
get isInputDate(){
|
|
8735
|
+
return true;
|
|
8736
|
+
}
|
|
8604
8737
|
}
|
|
8738
|
+
const inputDate = () => new ZikoUIInputDate();
|
|
8739
|
+
|
|
8605
8740
|
class ZikoUIInputTime extends ZikoUIInput {
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
constructor() {
|
|
8613
|
-
super("inputDate");
|
|
8614
|
-
this._setType("date");
|
|
8615
|
-
}
|
|
8741
|
+
constructor() {
|
|
8742
|
+
super("time", "inputTime");
|
|
8743
|
+
}
|
|
8744
|
+
get isInputTime(){
|
|
8745
|
+
return true;
|
|
8746
|
+
}
|
|
8616
8747
|
}
|
|
8748
|
+
const inputTime = () => new ZikoUIInputTime();
|
|
8749
|
+
|
|
8617
8750
|
class ZikoUIInputDateTime extends ZikoUIInput {
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
constructor() {
|
|
8625
|
-
super("inputCheckbox");
|
|
8626
|
-
this._setType("checkbox");
|
|
8627
|
-
this.cursor("pointer");
|
|
8628
|
-
}
|
|
8629
|
-
get checked() {
|
|
8630
|
-
return this.element.checked;
|
|
8631
|
-
}
|
|
8632
|
-
check(checked = true) {
|
|
8633
|
-
this.element.checked = checked;
|
|
8634
|
-
return this;
|
|
8635
|
-
}
|
|
8636
|
-
color(color) {
|
|
8637
|
-
this.element.style.accentColor = color;
|
|
8638
|
-
return this;
|
|
8639
|
-
}
|
|
8640
|
-
}
|
|
8641
|
-
class ZikoUIInputRadio extends ZikoUIInput {
|
|
8642
|
-
constructor() {
|
|
8643
|
-
super("inputRadio");
|
|
8644
|
-
this._setType("radio");
|
|
8645
|
-
this.cursor("pointer");
|
|
8646
|
-
}
|
|
8647
|
-
get checked() {
|
|
8648
|
-
return this.element.checked;
|
|
8649
|
-
}
|
|
8650
|
-
check(checked = true) {
|
|
8651
|
-
this.element.checked = checked;
|
|
8652
|
-
return this;
|
|
8653
|
-
}
|
|
8654
|
-
color(color) {
|
|
8655
|
-
this.element.style.accentColor = color;
|
|
8656
|
-
return this;
|
|
8657
|
-
}
|
|
8751
|
+
constructor() {
|
|
8752
|
+
super("datetime-local", "inputDateTime");
|
|
8753
|
+
}
|
|
8754
|
+
get isInputDateTime(){
|
|
8755
|
+
return true;
|
|
8756
|
+
}
|
|
8658
8757
|
}
|
|
8659
|
-
|
|
8660
|
-
|
|
8758
|
+
const inputDateTime = () => new ZikoUIInputDateTime();
|
|
8759
|
+
|
|
8661
8760
|
class ZikoUIInputImage extends ZikoUIElement {
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8761
|
+
constructor(text = "File") {
|
|
8762
|
+
super("inputImage");
|
|
8763
|
+
this._aux_element = btn(text).setTarget(this.target);
|
|
8764
|
+
this.element = document?.createElement("input");
|
|
8765
|
+
this.element.setAttribute("type", "file");
|
|
8766
|
+
this.element.setAttribute("accept", "image");
|
|
8767
|
+
this._aux_element.onClick(() => this.element.click());
|
|
8768
|
+
this.element.onChange = this.handleImage.bind(this);
|
|
8769
|
+
}
|
|
8770
|
+
get isInputImage(){
|
|
8771
|
+
return true;
|
|
8772
|
+
}
|
|
8773
|
+
handleImage(e) {
|
|
8774
|
+
const reader = new FileReader();
|
|
8775
|
+
const img = new Image();
|
|
8776
|
+
reader.onload = function (event) {
|
|
8777
|
+
img.src = event.target.result;
|
|
8778
|
+
console.log(img.src);
|
|
8779
|
+
};
|
|
8780
|
+
reader.readAsDataURL(e.target.files[0]);
|
|
8781
|
+
this.img = img;
|
|
8782
|
+
}
|
|
8783
|
+
get value() {
|
|
8784
|
+
return this.img;
|
|
8785
|
+
}
|
|
8786
|
+
render(bool = true) {
|
|
8787
|
+
if (bool) this.target.appendChild(this._aux_element.element);
|
|
8788
|
+
else this.remove();
|
|
8789
|
+
return this;
|
|
8790
|
+
}
|
|
8791
|
+
remove() {
|
|
8792
|
+
if (this.target.children.length) this.target.removeChild(this._aux_element.element);
|
|
8793
|
+
return this;
|
|
8794
|
+
}
|
|
8795
|
+
}
|
|
8796
|
+
const inputImage = (text) => new ZikoUIInputImage(text);
|
|
8797
|
+
|
|
8798
|
+
class ZikoUIWebcame extends ZikoUIVideo{
|
|
8799
|
+
constructor(){
|
|
8800
|
+
super();
|
|
8801
|
+
this.element.setAttribute("src", "");
|
|
8802
|
+
this.constraints = { audio: true, video: { width: 1280, height: 720 } };
|
|
8803
|
+
//this.video=this.element
|
|
8804
|
+
}
|
|
8805
|
+
get isInputCamera(){
|
|
8806
|
+
return true;
|
|
8807
|
+
}
|
|
8808
|
+
start(){
|
|
8809
|
+
navigator.mediaDevices.getUserMedia(this.constraints).then((mediaStream)=>{
|
|
8810
|
+
this.element.srcObject = mediaStream;
|
|
8811
|
+
this.element.onloadedmetadata = () =>{
|
|
8812
|
+
this.element.play();
|
|
8813
|
+
};
|
|
8814
|
+
})
|
|
8815
|
+
.catch(function(err) { console.log(err.name + ": " + err.message); });
|
|
8816
|
+
return this;
|
|
8817
|
+
}
|
|
8683
8818
|
}
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8819
|
+
const inputCamera=()=>new ZikoUIWebcame();
|
|
8820
|
+
|
|
8821
|
+
class ZikoUILabel extends ZikoUIElement{
|
|
8822
|
+
constructor(){
|
|
8823
|
+
super();
|
|
8824
|
+
this.element=document?.createElement("label");
|
|
8825
|
+
}
|
|
8826
|
+
get isLabel(){
|
|
8827
|
+
return true;
|
|
8688
8828
|
}
|
|
8689
|
-
remove() {
|
|
8690
|
-
if (this.target.children.length) this.target.removeChild(this._aux_element.element);
|
|
8691
|
-
return this;
|
|
8692
8829
|
}
|
|
8830
|
+
class ZikoUIInputOption extends ZikoUIElement {
|
|
8831
|
+
constructor(value = "") {
|
|
8832
|
+
super();
|
|
8833
|
+
this.element = document?.createElement("option");
|
|
8834
|
+
if(value instanceof Object&&"value" in value){
|
|
8835
|
+
this.setValue(value.value);
|
|
8836
|
+
this.setText(value?.text??value.value);
|
|
8837
|
+
}
|
|
8838
|
+
else this.setValue(value);
|
|
8839
|
+
}
|
|
8840
|
+
setValue(str = "") {
|
|
8841
|
+
this.element.value = str;
|
|
8842
|
+
return this;
|
|
8843
|
+
}
|
|
8844
|
+
setText(text=""){
|
|
8845
|
+
if(text)this.element.textContent=text;
|
|
8846
|
+
return this;
|
|
8847
|
+
}
|
|
8693
8848
|
}
|
|
8694
|
-
|
|
8695
|
-
class ZikoUIInputDatalist extends ZikoUIElement {
|
|
8849
|
+
let ZikoUIInputDatalist$1 = class ZikoUIInputDatalist extends ZikoUIElement {
|
|
8696
8850
|
constructor(...options){
|
|
8697
8851
|
super();
|
|
8698
|
-
this.element = document
|
|
8852
|
+
this.element = document?.createElement("datalist");
|
|
8699
8853
|
this.addOptions(...options).setId("ziko-datalist-id"+Random.string(10));
|
|
8700
8854
|
}
|
|
8855
|
+
get isDatalist(){
|
|
8856
|
+
return true;
|
|
8857
|
+
}
|
|
8701
8858
|
addOptions(...options) {
|
|
8702
8859
|
options.map((n) => this.append(new ZikoUIInputOption(n)));
|
|
8703
8860
|
return this;
|
|
8704
8861
|
}
|
|
8705
|
-
}
|
|
8706
|
-
const input = (value,datalist) => {
|
|
8707
|
-
if(value instanceof Object){
|
|
8708
|
-
const {datalist,placeholder}=value;
|
|
8709
|
-
value=value.value??"";
|
|
8710
|
-
return new ZikoUIInput(value,datalist).setPlaceholder(placeholder);
|
|
8711
|
-
}
|
|
8712
|
-
return new ZikoUIInput(value,datalist);
|
|
8713
|
-
};
|
|
8714
|
-
const datalist = (...options) => new ZikoUIInputDatalist(...options);
|
|
8715
|
-
const slider = (value, min, max, step) =>{
|
|
8716
|
-
if(value instanceof Object){
|
|
8717
|
-
const {min=0,max=10,step=1}=value;
|
|
8718
|
-
value=value?.value??5;
|
|
8719
|
-
return new ZikoUIInputSlider(value, min, max, step);
|
|
8720
|
-
}
|
|
8721
|
-
return new ZikoUIInputSlider(value, min, max, step);
|
|
8722
8862
|
};
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
const {value,max=10,step=1,placeholder=""}=min;
|
|
8726
|
-
min=min?.min??0;
|
|
8727
|
-
return new ZikoUIInputSlider(min, max, step).setValue(value).setPlaceholder(placeholder);
|
|
8728
|
-
}
|
|
8729
|
-
return new ZikoUIInputNumber(min,max,step);
|
|
8730
|
-
};
|
|
8731
|
-
const search = (...a) => new ZikoUIInputSearch().connect(...a);
|
|
8732
|
-
const inputImage = (text) => new ZikoUIInputImage(text);
|
|
8733
|
-
const inputPassword = () => new ZikoUIInputPassword();
|
|
8734
|
-
const inputEmail = () => new ZikoUIInputEmail();
|
|
8735
|
-
const inputColor = () => new ZikoUIInputColor();
|
|
8736
|
-
const inputTime = () => new ZikoUIInputTime();
|
|
8737
|
-
const inputDate = () => new ZikoUIInputDate();
|
|
8738
|
-
const inputDateTime = () => new ZikoUIInputDateTime();
|
|
8739
|
-
const checkbox = () => new ZikoUIInputCheckbox();
|
|
8740
|
-
const radio = () => new ZikoUIInputRadio();
|
|
8863
|
+
|
|
8864
|
+
const datalist = (...options) => new ZikoUIInputDatalist$1(...options);
|
|
8741
8865
|
|
|
8742
8866
|
class ZikoUISelect extends ZikoUIElement {
|
|
8743
8867
|
constructor(){
|
|
8744
8868
|
super();
|
|
8745
|
-
this.element=document
|
|
8869
|
+
this.element=document?.createElement("select");
|
|
8746
8870
|
}
|
|
8747
8871
|
addOptions(...options) {
|
|
8748
8872
|
options.map(n => this.append(new ZikoUIInputOption(n)));
|
|
8749
8873
|
return this;
|
|
8750
8874
|
}
|
|
8875
|
+
get isSelect(){
|
|
8876
|
+
return true;
|
|
8877
|
+
}
|
|
8751
8878
|
}
|
|
8752
8879
|
const select=()=>new ZikoUISelect();
|
|
8753
8880
|
|
|
8754
|
-
class
|
|
8755
|
-
constructor(){
|
|
8881
|
+
class ZikoUITextArea extends ZikoUIElement {
|
|
8882
|
+
constructor() {
|
|
8756
8883
|
super();
|
|
8757
|
-
this.element
|
|
8758
|
-
this.constraints = { audio: true, video: { width: 1280, height: 720 } };
|
|
8759
|
-
//this.video=this.element
|
|
8884
|
+
this.element = document?.createElement("textarea");
|
|
8760
8885
|
}
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
this.element.srcObject = mediaStream;
|
|
8764
|
-
this.element.onloadedmetadata = () =>{
|
|
8765
|
-
this.element.play();
|
|
8766
|
-
};
|
|
8767
|
-
})
|
|
8768
|
-
.catch(function(err) { console.log(err.name + ": " + err.message); });
|
|
8769
|
-
return this;
|
|
8886
|
+
get value(){
|
|
8887
|
+
return this.element.textContent;
|
|
8770
8888
|
}
|
|
8771
|
-
|
|
8772
|
-
|
|
8889
|
+
get isTextArea(){
|
|
8890
|
+
return true;
|
|
8891
|
+
}
|
|
8892
|
+
}
|
|
8893
|
+
const textarea =()=> new ZikoUITextArea();
|
|
8773
8894
|
|
|
8774
8895
|
class ZikoUIFlex extends ZikoUIContainerElement {
|
|
8775
8896
|
constructor(tag = "div", w = "100%", h = "100%") {
|
|
@@ -8781,6 +8902,9 @@
|
|
|
8781
8902
|
this.style({ display: "flex" });
|
|
8782
8903
|
// this.render();
|
|
8783
8904
|
}
|
|
8905
|
+
get isFlex(){
|
|
8906
|
+
return true;
|
|
8907
|
+
}
|
|
8784
8908
|
resp(px,wrap = true) {
|
|
8785
8909
|
this.wrap(wrap);
|
|
8786
8910
|
if (this.element.clientWidth < px) this.vertical();
|
|
@@ -8867,6 +8991,44 @@
|
|
|
8867
8991
|
return map_pos_x(-align);
|
|
8868
8992
|
}
|
|
8869
8993
|
|
|
8994
|
+
class ZikoUIForm extends ZikoUIFlex{
|
|
8995
|
+
constructor(...items){
|
|
8996
|
+
super("form", "Form");
|
|
8997
|
+
this.append(...items);
|
|
8998
|
+
this.setMethod("POST");
|
|
8999
|
+
this.setAction("/");
|
|
9000
|
+
}
|
|
9001
|
+
setAction(action = "/"){
|
|
9002
|
+
this.setAttr("action", action);
|
|
9003
|
+
return this;
|
|
9004
|
+
}
|
|
9005
|
+
setMethod(method = "post"){
|
|
9006
|
+
this.setAttr("method", method);
|
|
9007
|
+
return this;
|
|
9008
|
+
}
|
|
9009
|
+
get data(){
|
|
9010
|
+
let formData = new FormData(this.element);
|
|
9011
|
+
this.items.forEach(n=>{
|
|
9012
|
+
if(n.isInput||n.isSelect||n.isTextarea)formData.append(n.element.name, n.value);
|
|
9013
|
+
});
|
|
9014
|
+
return formData;
|
|
9015
|
+
}
|
|
9016
|
+
sendFormData(){
|
|
9017
|
+
fetch(this.element.action, {
|
|
9018
|
+
method: this.element.method,
|
|
9019
|
+
body: this.data
|
|
9020
|
+
})
|
|
9021
|
+
.then(response => response.json())
|
|
9022
|
+
.then(data => console.log(data))
|
|
9023
|
+
.catch(error => console.error('Error:', error));
|
|
9024
|
+
return this;
|
|
9025
|
+
}
|
|
9026
|
+
getByName(name){
|
|
9027
|
+
return this.data.get(name);
|
|
9028
|
+
}
|
|
9029
|
+
}
|
|
9030
|
+
const Form = (...items) => new ZikoUIForm(...items);
|
|
9031
|
+
|
|
8870
9032
|
class ZikoUIGrid extends ZikoUIContainerElement {
|
|
8871
9033
|
constructor(tag ="div", w = "50vw", h = "50vh") {
|
|
8872
9034
|
super(tag,"Grid");
|
|
@@ -8877,6 +9039,9 @@
|
|
|
8877
9039
|
this.style({ display: "grid" });
|
|
8878
9040
|
// this.render();
|
|
8879
9041
|
}
|
|
9042
|
+
get isGird(){
|
|
9043
|
+
return true;
|
|
9044
|
+
}
|
|
8880
9045
|
columns(n) {
|
|
8881
9046
|
let temp = "";
|
|
8882
9047
|
for (let i = 0; i < n; i++) temp = temp.concat(" auto");
|
|
@@ -9054,6 +9219,9 @@
|
|
|
9054
9219
|
// Handle outside up
|
|
9055
9220
|
});
|
|
9056
9221
|
}
|
|
9222
|
+
get isCarousel(){
|
|
9223
|
+
return true;
|
|
9224
|
+
}
|
|
9057
9225
|
}
|
|
9058
9226
|
const Carousel=(...ZikoUIElement)=>new ZikoUICarousel(...ZikoUIElement);
|
|
9059
9227
|
|
|
@@ -9067,6 +9235,9 @@
|
|
|
9067
9235
|
});
|
|
9068
9236
|
this.vertical(0,0);
|
|
9069
9237
|
}
|
|
9238
|
+
get isCodeNote(){
|
|
9239
|
+
return true;
|
|
9240
|
+
}
|
|
9070
9241
|
setCurrentNote(currentNote){
|
|
9071
9242
|
this.cache.currentNote=currentNote;
|
|
9072
9243
|
this.cache.currentNoteIndex=this.items.findIndex(n=>n===currentNote);
|
|
@@ -9255,6 +9426,9 @@
|
|
|
9255
9426
|
// })
|
|
9256
9427
|
}
|
|
9257
9428
|
}
|
|
9429
|
+
get isCodeCell(){
|
|
9430
|
+
return true;
|
|
9431
|
+
}
|
|
9258
9432
|
// space  
|
|
9259
9433
|
get codeText() {
|
|
9260
9434
|
return (this.Input.element.getElementsByClassName("cm-content")[0])
|
|
@@ -9406,6 +9580,9 @@
|
|
|
9406
9580
|
this.init();
|
|
9407
9581
|
this.display(0);
|
|
9408
9582
|
}
|
|
9583
|
+
get isTabs(){
|
|
9584
|
+
return true;
|
|
9585
|
+
}
|
|
9409
9586
|
init(){
|
|
9410
9587
|
// Remove old listener
|
|
9411
9588
|
for(let i=0;i<this.Controller.length;i++){
|
|
@@ -9466,41 +9643,361 @@
|
|
|
9466
9643
|
|
|
9467
9644
|
const Tabs=(Controllers,Contents)=>new ZikoUITabs(Controllers,Contents);
|
|
9468
9645
|
|
|
9646
|
+
const palette = {
|
|
9647
|
+
success: {
|
|
9648
|
+
titleColor:"green",
|
|
9649
|
+
contentColor: "#35495e",
|
|
9650
|
+
bgColor: "#d4edda", // Fixed
|
|
9651
|
+
bgColor:"linear-gradient(-225deg, #DFFFCD 0%, #90F9C4 48%, #39F3BB 100%)",
|
|
9652
|
+
borderColor: "#28a745", // Fixed
|
|
9653
|
+
icon: "✅"
|
|
9654
|
+
},
|
|
9655
|
+
info: {
|
|
9656
|
+
titleColor:"blue",
|
|
9657
|
+
contentColor: "#00204a",
|
|
9658
|
+
bgColor: "#93deff", // Fixed
|
|
9659
|
+
bgColor:"radial-gradient(circle at 10% 20%, rgb(147, 230, 241) 0%, rgb(145, 192, 241) 45.5%)",
|
|
9660
|
+
borderColor: "#005689", // Fixed
|
|
9661
|
+
icon: "ℹ️"
|
|
9662
|
+
},
|
|
9663
|
+
warning: {
|
|
9664
|
+
titleColor:"#e4663a",
|
|
9665
|
+
contentColor: "#45171d",
|
|
9666
|
+
bgColor:"#fdffcd",
|
|
9667
|
+
bgColor:"radial-gradient(907px at 3.4% 19.8%, rgb(255, 243, 122) 0%, rgb(255, 102, 145) 97.4%)",
|
|
9668
|
+
borderColor: "#efd510",
|
|
9669
|
+
icon: "⚠️"
|
|
9670
|
+
},
|
|
9671
|
+
danger: {
|
|
9672
|
+
titleColor:"red",
|
|
9673
|
+
contentColor: "#721c24",
|
|
9674
|
+
bgColor: "#f8d7da", // Fixed
|
|
9675
|
+
bgColor:"linear-gradient(90deg, rgb(255, 157, 129) 24.3%, rgb(255, 138, 138) 78.3%)",
|
|
9676
|
+
borderColor: "#c50000", // Fixed
|
|
9677
|
+
icon: "❌"
|
|
9678
|
+
},
|
|
9679
|
+
tips: {
|
|
9680
|
+
titleColor:null,
|
|
9681
|
+
contentColor: null,
|
|
9682
|
+
bgColor: null,
|
|
9683
|
+
borderColor: null,
|
|
9684
|
+
icon: "💡"
|
|
9685
|
+
},
|
|
9686
|
+
important: {
|
|
9687
|
+
titleColor:null,
|
|
9688
|
+
contentColor: null,
|
|
9689
|
+
bgColor: null,
|
|
9690
|
+
borderColor: null,
|
|
9691
|
+
icon: "📌"
|
|
9692
|
+
},
|
|
9693
|
+
|
|
9694
|
+
};
|
|
9695
|
+
|
|
9696
|
+
class ZikoUIAlert extends ZikoUIFlex{
|
|
9697
|
+
constructor(type, title, content){
|
|
9698
|
+
super();
|
|
9699
|
+
this.title = h3(title);
|
|
9700
|
+
this.icon = text$1(palette[type].icon).style({
|
|
9701
|
+
display: "flex",
|
|
9702
|
+
justifyContent:"center",
|
|
9703
|
+
borderRadius:"50%",
|
|
9704
|
+
minWidth:"30px",
|
|
9705
|
+
minHeight:"30px",
|
|
9706
|
+
});
|
|
9707
|
+
this.content = content;
|
|
9708
|
+
this.vertical()
|
|
9709
|
+
.size("200px", "auto")
|
|
9710
|
+
.style({
|
|
9711
|
+
borderRadius:"10px",
|
|
9712
|
+
padding:"10px"
|
|
9713
|
+
});
|
|
9714
|
+
this.append(
|
|
9715
|
+
Flex(
|
|
9716
|
+
this.title,
|
|
9717
|
+
this.icon
|
|
9718
|
+
).size("100%", "40px").style({}).horizontal("space-between",0),
|
|
9719
|
+
this.content
|
|
9720
|
+
);
|
|
9721
|
+
this.useType(type);
|
|
9722
|
+
}
|
|
9723
|
+
get isAlert(){
|
|
9724
|
+
return true;
|
|
9725
|
+
}
|
|
9726
|
+
useType(type){
|
|
9727
|
+
this.style({
|
|
9728
|
+
color:palette[type].color,
|
|
9729
|
+
background:palette[type].bgColor,
|
|
9730
|
+
border: `1px darkblue solid`,
|
|
9731
|
+
borderLeft: `15px ${palette[type].borderColor} solid`,
|
|
9732
|
+
});
|
|
9733
|
+
this.title.style({
|
|
9734
|
+
color:palette[type].titleColor
|
|
9735
|
+
});
|
|
9736
|
+
this.content.st.color(palette[type].titleColor);
|
|
9737
|
+
this.icon.setValue(palette[type].icon).style({
|
|
9738
|
+
border:`2px ${palette[type].borderColor} solid`,
|
|
9739
|
+
alignItems: type==="warning"?"flex-start":"center",
|
|
9740
|
+
});
|
|
9741
|
+
return this;
|
|
9742
|
+
}
|
|
9743
|
+
useSuccess(){
|
|
9744
|
+
this.useType("success");
|
|
9745
|
+
return this;
|
|
9746
|
+
}
|
|
9747
|
+
useInfo(){
|
|
9748
|
+
this.useType("info");
|
|
9749
|
+
return this;
|
|
9750
|
+
}
|
|
9751
|
+
useWarning(){
|
|
9752
|
+
this.useType("warning");
|
|
9753
|
+
return this;
|
|
9754
|
+
}
|
|
9755
|
+
useDanger(){
|
|
9756
|
+
this.useType("danger");
|
|
9757
|
+
return this;
|
|
9758
|
+
}
|
|
9759
|
+
}
|
|
9760
|
+
|
|
9761
|
+
const successAlert=(title, content)=>new ZikoUIAlert("success", title, content);
|
|
9762
|
+
const infoAlert=(title, content)=>new ZikoUIAlert("info", title, content);
|
|
9763
|
+
const warningAlert=(title, content)=>new ZikoUIAlert("warning", title, content);
|
|
9764
|
+
const dangerAlert=(title, content)=>new ZikoUIAlert("danger", title, content);
|
|
9765
|
+
|
|
9766
|
+
class __ZikoUISplitter__ extends ZikoUIElement{
|
|
9767
|
+
constructor(flexDirection, resizerCursor, resizerProp){
|
|
9768
|
+
super("div", "Splitter");
|
|
9769
|
+
Object.assign(this.cache,{
|
|
9770
|
+
isResizing : false,
|
|
9771
|
+
flexDirection,
|
|
9772
|
+
resizerCursor,
|
|
9773
|
+
resizerProp
|
|
9774
|
+
});
|
|
9775
|
+
this.style({
|
|
9776
|
+
display:"flex",
|
|
9777
|
+
flexDirection : this.cache.flexDirection,
|
|
9778
|
+
border: "2px solid #333",
|
|
9779
|
+
overflow: "hidden"
|
|
9780
|
+
});
|
|
9781
|
+
this.resizer = new ZikoUIElement("div", "resizer").style({
|
|
9782
|
+
[this.cache.resizerProp]:"5px",
|
|
9783
|
+
backgroundColor: "gold",
|
|
9784
|
+
cursor: this.cache.resizerCursor,
|
|
9785
|
+
touchAction: "none",
|
|
9786
|
+
});
|
|
9787
|
+
this.onPtrDown(e=>{
|
|
9788
|
+
this.cache.isResizing = true;
|
|
9789
|
+
this.style({
|
|
9790
|
+
cursor : this.cache.resizerCursor // ns-resize
|
|
9791
|
+
});
|
|
9792
|
+
this.resizer.element.setPointerCapture(e.event.pointerId);
|
|
9793
|
+
});
|
|
9794
|
+
this.onPtrUp(e=>{
|
|
9795
|
+
this.cache.isResizing = false;
|
|
9796
|
+
this.style({
|
|
9797
|
+
cursor: "default"
|
|
9798
|
+
});
|
|
9799
|
+
this.resizer.element.releasePointerCapture(e.event.pointerId);
|
|
9800
|
+
});
|
|
9801
|
+
this.onPtrCancel(()=>{
|
|
9802
|
+
this.cache.isResizing = false;
|
|
9803
|
+
this.style({
|
|
9804
|
+
cursor: "default"
|
|
9805
|
+
});
|
|
9806
|
+
});
|
|
9807
|
+
this.onPtrOut(()=>{
|
|
9808
|
+
if (this.cache.isResizing) {
|
|
9809
|
+
this.cache.isResizing = false;
|
|
9810
|
+
this.style({
|
|
9811
|
+
cursor: "default"
|
|
9812
|
+
});
|
|
9813
|
+
}
|
|
9814
|
+
});
|
|
9815
|
+
}
|
|
9816
|
+
get isSplitter(){
|
|
9817
|
+
return true;
|
|
9818
|
+
}
|
|
9819
|
+
styleResizer(style={}){
|
|
9820
|
+
this.resizer.style(style);
|
|
9821
|
+
return this;
|
|
9822
|
+
}
|
|
9823
|
+
}
|
|
9824
|
+
|
|
9825
|
+
class ZikoUIHorizontalSplitter extends __ZikoUISplitter__{
|
|
9826
|
+
constructor(leftPane, rightPane){
|
|
9827
|
+
super("row", "ew-resize", "width");
|
|
9828
|
+
this.leftPane = leftPane.style({
|
|
9829
|
+
width:"50%",
|
|
9830
|
+
flexGrow: 1,
|
|
9831
|
+
overflow: "hidden"
|
|
9832
|
+
});
|
|
9833
|
+
this.rightPane = rightPane.style({
|
|
9834
|
+
width:"50%",
|
|
9835
|
+
flexGrow: 1,
|
|
9836
|
+
overflow: "hidden"
|
|
9837
|
+
});
|
|
9838
|
+
this.element.append(
|
|
9839
|
+
this.leftPane.element,
|
|
9840
|
+
this.resizer.element,
|
|
9841
|
+
this.rightPane.element
|
|
9842
|
+
);
|
|
9843
|
+
this.onPtrMove(e=>{
|
|
9844
|
+
if (!this.cache.isResizing) return;
|
|
9845
|
+
const containerWidth = this.element.getBoundingClientRect().width; // height
|
|
9846
|
+
const pointerRelativeXpos = e.event.clientX - this.element.getBoundingClientRect().x; // y
|
|
9847
|
+
let newLeftPaneWidth = (pointerRelativeXpos / containerWidth) * 100;
|
|
9848
|
+
let newRightPaneWidth = 100 - newLeftPaneWidth;
|
|
9849
|
+
if (newLeftPaneWidth < 0) newLeftPaneWidth = 0;
|
|
9850
|
+
if (newRightPaneWidth < 0) newRightPaneWidth = 0;
|
|
9851
|
+
this.leftPane.element.style.width = `${newLeftPaneWidth}%`;
|
|
9852
|
+
this.rightPane.element.style.width = `${newRightPaneWidth}%`;
|
|
9853
|
+
});
|
|
9854
|
+
}
|
|
9855
|
+
get isHorizontalSplitter(){
|
|
9856
|
+
return true;
|
|
9857
|
+
}
|
|
9858
|
+
}
|
|
9859
|
+
const hSplitter=(leftPane, rightPane)=>new ZikoUIHorizontalSplitter(leftPane, rightPane);
|
|
9860
|
+
|
|
9861
|
+
class ZikoUIVerticalSplitter extends __ZikoUISplitter__{
|
|
9862
|
+
constructor(topPane, bottomPane){
|
|
9863
|
+
super("column", "ns-resize", "height");
|
|
9864
|
+
this.topPane = topPane.style({
|
|
9865
|
+
height:"50%",
|
|
9866
|
+
flexGrow: 1,
|
|
9867
|
+
overflow: "hidden"
|
|
9868
|
+
});
|
|
9869
|
+
this.bottomPane = bottomPane.style({
|
|
9870
|
+
height:"50%",
|
|
9871
|
+
flexGrow: 1,
|
|
9872
|
+
overflow: "hidden"
|
|
9873
|
+
});
|
|
9874
|
+
this.element.append(
|
|
9875
|
+
this.topPane.element,
|
|
9876
|
+
this.resizer.element,
|
|
9877
|
+
this.bottomPane.element
|
|
9878
|
+
);
|
|
9879
|
+
this.onPtrMove(e=>{
|
|
9880
|
+
if (!this.cache.isResizing) return;
|
|
9881
|
+
const containerHeight = this.element.getBoundingClientRect().height; // height
|
|
9882
|
+
const pointerRelativeYpos = e.event.clientY - this.element.getBoundingClientRect().y; // y
|
|
9883
|
+
let newTopPaneHeight = (pointerRelativeYpos / containerHeight) * 100;
|
|
9884
|
+
let newBottomPaneHeight = 100 - newTopPaneHeight;
|
|
9885
|
+
if (newTopPaneHeight < 0) newTopPaneHeight = 0;
|
|
9886
|
+
if (newBottomPaneHeight < 0) newBottomPaneHeight = 0;
|
|
9887
|
+
this.topPane.element.style.height = `${newTopPaneHeight}%`;
|
|
9888
|
+
this.bottomPane.element.style.height = `${newBottomPaneHeight}%`;
|
|
9889
|
+
});
|
|
9890
|
+
}
|
|
9891
|
+
get isHorizontalSplitter(){
|
|
9892
|
+
return true;
|
|
9893
|
+
}
|
|
9894
|
+
}
|
|
9895
|
+
const vSplitter=(topPane, bottomPane)=>new ZikoUIVerticalSplitter(topPane, bottomPane);
|
|
9896
|
+
|
|
9897
|
+
class ZikoUIBreadcrumbs extends ZikoUIElement{
|
|
9898
|
+
constructor(...items){
|
|
9899
|
+
super("ul", "Breadcrumbs");
|
|
9900
|
+
Object.assign(this.cache,{
|
|
9901
|
+
separatorTextContent:"/"
|
|
9902
|
+
});
|
|
9903
|
+
this.style({
|
|
9904
|
+
listStyle: "none",
|
|
9905
|
+
display: "flex",
|
|
9906
|
+
flexWrap: "wrap"
|
|
9907
|
+
});
|
|
9908
|
+
this.list=html('li').style({
|
|
9909
|
+
display: "flex",
|
|
9910
|
+
flexWrap: "wrap"
|
|
9911
|
+
});
|
|
9912
|
+
this.append(...items);
|
|
9913
|
+
}
|
|
9914
|
+
#addItem(item){
|
|
9915
|
+
if(["string","number","boolean"].includes(typeof item))item = text$1(item);
|
|
9916
|
+
const li = html("li", item).style({
|
|
9917
|
+
display: "flex",
|
|
9918
|
+
alignItems: "center"
|
|
9919
|
+
});
|
|
9920
|
+
if(this.element.children.length>0){
|
|
9921
|
+
const separator = text$1(this.cache.separatorTextContent).style({
|
|
9922
|
+
padding: "0 4px"
|
|
9923
|
+
});
|
|
9924
|
+
this.element.append(separator.element);
|
|
9925
|
+
}
|
|
9926
|
+
this.element.append(li.element);
|
|
9927
|
+
}
|
|
9928
|
+
append(...items){
|
|
9929
|
+
items.forEach(n=>this.#addItem(n));
|
|
9930
|
+
return this;
|
|
9931
|
+
}
|
|
9932
|
+
configSeparator(separatorTextContent = this.cache.separator, style = {}){
|
|
9933
|
+
this.cache.separatorTextContent = separatorTextContent;
|
|
9934
|
+
const separators = [...this.element.children].filter(n=>n.tagName==="SPAN");
|
|
9935
|
+
separators.forEach(node=>{
|
|
9936
|
+
node.textContent = separatorTextContent;
|
|
9937
|
+
Object.assign(node.style, style);
|
|
9938
|
+
}
|
|
9939
|
+
);
|
|
9940
|
+
return this;
|
|
9941
|
+
}
|
|
9942
|
+
}
|
|
9943
|
+
const Breadcrumbs=(...items)=>new ZikoUIBreadcrumbs(...items);
|
|
9944
|
+
|
|
9469
9945
|
class ZikoUIMain extends ZikoUIContainerElement{
|
|
9470
9946
|
constructor(){
|
|
9471
9947
|
super("main","Main");
|
|
9472
9948
|
}
|
|
9949
|
+
get isMain(){
|
|
9950
|
+
return true
|
|
9951
|
+
}
|
|
9473
9952
|
}
|
|
9474
9953
|
class ZikoUIHeader extends ZikoUIContainerElement{
|
|
9475
9954
|
constructor(){
|
|
9476
9955
|
super("header","Header");
|
|
9477
9956
|
}
|
|
9957
|
+
get isHeader(){
|
|
9958
|
+
return true
|
|
9959
|
+
}
|
|
9478
9960
|
}
|
|
9479
9961
|
class ZikoUINav extends ZikoUIContainerElement{
|
|
9480
9962
|
constructor(){
|
|
9481
9963
|
super("nav","Nav");
|
|
9482
9964
|
}
|
|
9965
|
+
get isNav(){
|
|
9966
|
+
return true
|
|
9967
|
+
}
|
|
9483
9968
|
}
|
|
9484
9969
|
class ZikoUISection extends ZikoUIContainerElement{
|
|
9485
9970
|
constructor(){
|
|
9486
9971
|
super("section","Section");
|
|
9487
9972
|
this.style({position:"relative"});
|
|
9488
9973
|
}
|
|
9974
|
+
get isSection(){
|
|
9975
|
+
return true
|
|
9976
|
+
}
|
|
9489
9977
|
}
|
|
9490
9978
|
class ZikoUIArticle extends ZikoUIContainerElement{
|
|
9491
9979
|
constructor(){
|
|
9492
9980
|
super("article","Article");
|
|
9493
9981
|
}
|
|
9982
|
+
get isArticle(){
|
|
9983
|
+
return true
|
|
9984
|
+
}
|
|
9494
9985
|
}
|
|
9495
9986
|
class ZikoUIAside extends ZikoUIContainerElement{
|
|
9496
9987
|
constructor(){
|
|
9497
9988
|
super("aside","Aside");
|
|
9498
9989
|
}
|
|
9990
|
+
get isAside(){
|
|
9991
|
+
return true
|
|
9992
|
+
}
|
|
9499
9993
|
}
|
|
9500
9994
|
class ZikoUIFooter extends ZikoUIContainerElement{
|
|
9501
9995
|
constructor(){
|
|
9502
9996
|
super("footer","Footer");
|
|
9503
|
-
this.element=document
|
|
9997
|
+
this.element=document?.createElement("footer");
|
|
9998
|
+
}
|
|
9999
|
+
get isFooter(){
|
|
10000
|
+
return true
|
|
9504
10001
|
}
|
|
9505
10002
|
}
|
|
9506
10003
|
const Section$1 = (...ZikoUIElement) => new ZikoUISection().append(...ZikoUIElement);
|
|
@@ -9514,35 +10011,35 @@
|
|
|
9514
10011
|
class ZikoUITr extends ZikoUIElement{
|
|
9515
10012
|
constructor(...ZikoUIElement){
|
|
9516
10013
|
super();
|
|
9517
|
-
this.element=document
|
|
10014
|
+
this.element=document?.createElement("Tr");
|
|
9518
10015
|
this.append(...ZikoUIElement);
|
|
9519
10016
|
}
|
|
9520
10017
|
}
|
|
9521
10018
|
class ZikoUITd extends ZikoUIElement{
|
|
9522
10019
|
constructor(...ZikoUIElement){
|
|
9523
10020
|
super();
|
|
9524
|
-
this.element=document
|
|
10021
|
+
this.element=document?.createElement("Td");
|
|
9525
10022
|
this.append(...ZikoUIElement);
|
|
9526
10023
|
}
|
|
9527
10024
|
}
|
|
9528
10025
|
class ZikoUIThead extends ZikoUIElement{
|
|
9529
10026
|
constructor(...ZikoUITr){
|
|
9530
10027
|
super();
|
|
9531
|
-
this.element=document
|
|
10028
|
+
this.element=document?.createElement("Thead");
|
|
9532
10029
|
this.append(...ZikoUITr);
|
|
9533
10030
|
}
|
|
9534
10031
|
}
|
|
9535
10032
|
class ZikoUITbody extends ZikoUIElement{
|
|
9536
10033
|
constructor(...ZikoUITr){
|
|
9537
10034
|
super();
|
|
9538
|
-
this.element=document
|
|
10035
|
+
this.element=document?.createElement("Tbody");
|
|
9539
10036
|
this.append(...ZikoUITr);
|
|
9540
10037
|
}
|
|
9541
10038
|
}
|
|
9542
10039
|
class ZikoUICaption extends ZikoUIElement{
|
|
9543
10040
|
constructor(ZikoUIElement){
|
|
9544
10041
|
super();
|
|
9545
|
-
this.element=document
|
|
10042
|
+
this.element=document?.createElement("Caption");
|
|
9546
10043
|
this.append(ZikoUIElement);
|
|
9547
10044
|
}
|
|
9548
10045
|
}
|
|
@@ -9589,6 +10086,9 @@
|
|
|
9589
10086
|
if(body)this.fromMatrix(body);
|
|
9590
10087
|
if(caption)this.setCaption(caption);
|
|
9591
10088
|
}
|
|
10089
|
+
get isTable(){
|
|
10090
|
+
return true;
|
|
10091
|
+
}
|
|
9592
10092
|
get caption(){
|
|
9593
10093
|
return this.structure.caption;
|
|
9594
10094
|
}
|
|
@@ -9710,6 +10210,7 @@
|
|
|
9710
10210
|
link,
|
|
9711
10211
|
ol,
|
|
9712
10212
|
ul,
|
|
10213
|
+
Form,
|
|
9713
10214
|
input,
|
|
9714
10215
|
search,
|
|
9715
10216
|
slider,
|
|
@@ -9747,6 +10248,13 @@
|
|
|
9747
10248
|
Tabs,
|
|
9748
10249
|
Collapsible,
|
|
9749
10250
|
Accordion,
|
|
10251
|
+
hSplitter,
|
|
10252
|
+
vSplitter,
|
|
10253
|
+
Breadcrumbs,
|
|
10254
|
+
successAlert,
|
|
10255
|
+
infoAlert,
|
|
10256
|
+
warningAlert,
|
|
10257
|
+
dangerAlert,
|
|
9750
10258
|
ExtractAll: function () {
|
|
9751
10259
|
const keys = Object.keys(this);
|
|
9752
10260
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -9920,7 +10428,7 @@
|
|
|
9920
10428
|
class ZikoSvgRectangle extends ZikoSvgElement{
|
|
9921
10429
|
constructor(x,y,w,h,center=true){
|
|
9922
10430
|
super();
|
|
9923
|
-
this.element=document
|
|
10431
|
+
this.element=document?.createElementNS(
|
|
9924
10432
|
"http://www.w3.org/2000/svg",
|
|
9925
10433
|
"rect",
|
|
9926
10434
|
);
|
|
@@ -9961,7 +10469,7 @@
|
|
|
9961
10469
|
class ZikoSvgCircle extends ZikoSvgElement{
|
|
9962
10470
|
constructor(cx,cy,r){
|
|
9963
10471
|
super("circle");
|
|
9964
|
-
this.element=document
|
|
10472
|
+
this.element=document?.createElementttNS(
|
|
9965
10473
|
"http://www.w3.org/2000/svg",
|
|
9966
10474
|
"circle",
|
|
9967
10475
|
);
|
|
@@ -9986,7 +10494,7 @@
|
|
|
9986
10494
|
class ZikoSvgEllipse extends ZikoSvgElement{
|
|
9987
10495
|
constructor(cx,cy,rx,ry){
|
|
9988
10496
|
super("ellipse");
|
|
9989
|
-
this.element=document
|
|
10497
|
+
this.element=document?.createElementNS(
|
|
9990
10498
|
"http://www.w3.org/2000/svg",
|
|
9991
10499
|
"ellipse",
|
|
9992
10500
|
);
|
|
@@ -10006,7 +10514,7 @@
|
|
|
10006
10514
|
class ZikoSvgLine extends ZikoSvgElement{
|
|
10007
10515
|
constructor(x1,y1,x2,y2){
|
|
10008
10516
|
super();
|
|
10009
|
-
this.element=document
|
|
10517
|
+
this.element=document?.createElementtNS(
|
|
10010
10518
|
"http://www.w3.org/2000/svg",
|
|
10011
10519
|
"line",
|
|
10012
10520
|
);
|
|
@@ -10037,7 +10545,7 @@
|
|
|
10037
10545
|
class ZikoSvgPath extends ZikoSvgElement{
|
|
10038
10546
|
constructor(){
|
|
10039
10547
|
super();
|
|
10040
|
-
this.element=document
|
|
10548
|
+
this.element=document?.createElementNS(
|
|
10041
10549
|
"http://www.w3.org/2000/svg",
|
|
10042
10550
|
"path",
|
|
10043
10551
|
);
|
|
@@ -10097,7 +10605,7 @@
|
|
|
10097
10605
|
super();
|
|
10098
10606
|
this.X=X;
|
|
10099
10607
|
this.Y=Y;
|
|
10100
|
-
this.element=document
|
|
10608
|
+
this.element=document?.createElementtNS(
|
|
10101
10609
|
"http://www.w3.org/2000/svg",
|
|
10102
10610
|
"polygon",
|
|
10103
10611
|
);
|
|
@@ -10126,7 +10634,7 @@
|
|
|
10126
10634
|
class ZikoSvgText extends ZikoSvgElement{
|
|
10127
10635
|
constructor(text,x,y){
|
|
10128
10636
|
super();
|
|
10129
|
-
this.element=document
|
|
10637
|
+
this.element=document?.createElementNS(
|
|
10130
10638
|
"http://www.w3.org/2000/svg",
|
|
10131
10639
|
"text",
|
|
10132
10640
|
);
|
|
@@ -10151,7 +10659,7 @@
|
|
|
10151
10659
|
class ZikoSvgImage extends ZikoSvgElement{
|
|
10152
10660
|
constructor(src="",w="100%",h="100%",x=0,y=0){
|
|
10153
10661
|
super();
|
|
10154
|
-
this.element=document
|
|
10662
|
+
this.element=document?.createElementNS(
|
|
10155
10663
|
"http://www.w3.org/2000/svg",
|
|
10156
10664
|
"image",
|
|
10157
10665
|
);
|
|
@@ -10184,7 +10692,7 @@
|
|
|
10184
10692
|
constructor(x=0,y=0,w="100%",h="100%",...ZikoUIElement){
|
|
10185
10693
|
super("foreignObject");
|
|
10186
10694
|
this.items=[];
|
|
10187
|
-
this.element=document
|
|
10695
|
+
this.element=document?.createElementtNS(
|
|
10188
10696
|
"http://www.w3.org/2000/svg",
|
|
10189
10697
|
"foreignObject",
|
|
10190
10698
|
);
|
|
@@ -10215,7 +10723,7 @@
|
|
|
10215
10723
|
constructor(...svgElement){
|
|
10216
10724
|
super();
|
|
10217
10725
|
this.items=[];
|
|
10218
|
-
this.element=document
|
|
10726
|
+
this.element=document?.createElementNS(
|
|
10219
10727
|
"http://www.w3.org/2000/svg",
|
|
10220
10728
|
"g",
|
|
10221
10729
|
);
|
|
@@ -10243,7 +10751,7 @@
|
|
|
10243
10751
|
constructor(href,...svgElement){
|
|
10244
10752
|
super();
|
|
10245
10753
|
this.items=[];
|
|
10246
|
-
this.element=document
|
|
10754
|
+
this.element=document?.createElementNS(
|
|
10247
10755
|
"http://www.w3.org/2000/svg",
|
|
10248
10756
|
"a",
|
|
10249
10757
|
);
|
|
@@ -10279,7 +10787,7 @@
|
|
|
10279
10787
|
class ZikoUICanvas extends ZikoUIContainerElement{
|
|
10280
10788
|
constructor(w,h){
|
|
10281
10789
|
super("canvas","canvas");
|
|
10282
|
-
//this.element=document
|
|
10790
|
+
//this.element=document?.createElement("canvas");
|
|
10283
10791
|
this.ctx = this.element.getContext("2d");
|
|
10284
10792
|
this.style({
|
|
10285
10793
|
border:"1px red solid",
|
|
@@ -10423,14 +10931,14 @@
|
|
|
10423
10931
|
return canvas;
|
|
10424
10932
|
}
|
|
10425
10933
|
toImage() {
|
|
10426
|
-
this.img = document
|
|
10934
|
+
this.img = document?.createElement("img");
|
|
10427
10935
|
this.img.src = this.element.toDataURL("image/png");
|
|
10428
10936
|
return this;
|
|
10429
10937
|
}
|
|
10430
10938
|
toBlob() {
|
|
10431
10939
|
var canvas = this.element;
|
|
10432
10940
|
canvas.toBlob(function (blob) {
|
|
10433
|
-
var newImg = document
|
|
10941
|
+
var newImg = document?.createElement("img"),
|
|
10434
10942
|
url = URL.createObjectURL(blob);
|
|
10435
10943
|
newImg.onload = function () {
|
|
10436
10944
|
URL.revokeObjectURL(url);
|
|
@@ -10854,42 +11362,6 @@
|
|
|
10854
11362
|
init:()=>document.documentElement.setAttribute("data-engine","zikojs")
|
|
10855
11363
|
};
|
|
10856
11364
|
|
|
10857
|
-
if(globalThis?.document){
|
|
10858
|
-
class ZikoUIComponent extends HTMLElement{
|
|
10859
|
-
constructor(){
|
|
10860
|
-
super();
|
|
10861
|
-
this.shadowDOM = this.attachShadow({ mode: 'open' });
|
|
10862
|
-
this.wrapper=document.createElement("div");
|
|
10863
|
-
}
|
|
10864
|
-
connectedCallback() {
|
|
10865
|
-
this.setAttribute('role', 'region');
|
|
10866
|
-
this.setAttribute('data-engine',"zikojs");
|
|
10867
|
-
this.shadowDOM.append(this.wrapper);
|
|
10868
|
-
this.observeContentChanges();
|
|
10869
|
-
}
|
|
10870
|
-
observeContentChanges() {
|
|
10871
|
-
const observer = new MutationObserver((mutations) => {
|
|
10872
|
-
mutations.forEach((mutation) => {
|
|
10873
|
-
if (mutation.type === 'childList' || mutation.type === 'characterData') {
|
|
10874
|
-
this.wrapper.innerHTML="";
|
|
10875
|
-
__Ziko__.__Config__.setDefault({ target: this.wrapper });
|
|
10876
|
-
globalThis.eval(this.innerHTML);
|
|
10877
|
-
}
|
|
10878
|
-
});
|
|
10879
|
-
});
|
|
10880
|
-
observer.observe(this, { childList: true, subtree: true, characterData: true });
|
|
10881
|
-
}
|
|
10882
|
-
|
|
10883
|
-
disconnectedCallback() {
|
|
10884
|
-
console.log('ZikoUIComponent removed from page.');
|
|
10885
|
-
}
|
|
10886
|
-
}
|
|
10887
|
-
globalThis.customElements.define('ziko-ui', ZikoUIComponent);
|
|
10888
|
-
}
|
|
10889
|
-
else {
|
|
10890
|
-
exports.ZikoUIComponent = null;
|
|
10891
|
-
}
|
|
10892
|
-
|
|
10893
11365
|
class ZikoSeo{
|
|
10894
11366
|
constructor(app){
|
|
10895
11367
|
this.app=app;
|
|
@@ -10898,7 +11370,7 @@
|
|
|
10898
11370
|
}
|
|
10899
11371
|
#setMeta(key,value){
|
|
10900
11372
|
const meta=document.querySelector(`meta[name=${key}]`);
|
|
10901
|
-
this.meta=meta?meta:document
|
|
11373
|
+
this.meta=meta?meta:document?.createElement("meta");
|
|
10902
11374
|
this.meta.setAttribute("name",key);
|
|
10903
11375
|
this.meta.setAttribute("content",value);
|
|
10904
11376
|
if(!meta)this.app.head.append(this.meta);
|
|
@@ -10906,7 +11378,7 @@
|
|
|
10906
11378
|
}
|
|
10907
11379
|
charset(charset="utf-8"){
|
|
10908
11380
|
const meta=document.querySelector("meta[charset]");
|
|
10909
|
-
this.meta=meta?meta:document
|
|
11381
|
+
this.meta=meta?meta:document?.createElementt("meta");
|
|
10910
11382
|
this.meta.setAttribute("charset",charset);
|
|
10911
11383
|
if(!meta)this.app.head.append(this.meta);
|
|
10912
11384
|
return this;
|
|
@@ -10952,10 +11424,10 @@
|
|
|
10952
11424
|
#init(){
|
|
10953
11425
|
this.root.setAttribute("data-engine","zikojs");
|
|
10954
11426
|
const head=this.root.getElementsByTagName("head")[0];
|
|
10955
|
-
this.head=head?head:this.head=document
|
|
10956
|
-
if(!head)this.root.insertBefore(this.head,document
|
|
11427
|
+
this.head=head?head:this.head=document?.createElementtt("head");
|
|
11428
|
+
if(!head)this.root.insertBefore(this.head,document?.body);
|
|
10957
11429
|
const title=this.head.getElementsByTagName("title")[0];
|
|
10958
|
-
this.Title=title?title:document
|
|
11430
|
+
this.Title=title?title:document?.createElementt("title");
|
|
10959
11431
|
if(!title)this.head.append(this.Title);
|
|
10960
11432
|
}
|
|
10961
11433
|
title(title=this.title.textContent){
|
|
@@ -11024,6 +11496,7 @@
|
|
|
11024
11496
|
exports.Article = Article;
|
|
11025
11497
|
exports.Aside = Aside;
|
|
11026
11498
|
exports.Base = Base;
|
|
11499
|
+
exports.Breadcrumbs = Breadcrumbs;
|
|
11027
11500
|
exports.Canvas = Canvas;
|
|
11028
11501
|
exports.Carousel = Carousel;
|
|
11029
11502
|
exports.CodeCell = CodeCell;
|
|
@@ -11040,6 +11513,7 @@
|
|
|
11040
11513
|
exports.Fixed = Fixed;
|
|
11041
11514
|
exports.Flex = Flex;
|
|
11042
11515
|
exports.Footer = Footer;
|
|
11516
|
+
exports.Form = Form;
|
|
11043
11517
|
exports.Graphics = Graphics;
|
|
11044
11518
|
exports.Grid = Grid$1;
|
|
11045
11519
|
exports.Header = Header;
|
|
@@ -11073,6 +11547,7 @@
|
|
|
11073
11547
|
exports.ZikoUIAudio = ZikoUIAudio;
|
|
11074
11548
|
exports.ZikoUIBlockQuote = ZikoUIBlockQuote;
|
|
11075
11549
|
exports.ZikoUIBr = ZikoUIBr;
|
|
11550
|
+
exports.ZikoUIBreadcrumbs = ZikoUIBreadcrumbs;
|
|
11076
11551
|
exports.ZikoUICanvas = ZikoUICanvas;
|
|
11077
11552
|
exports.ZikoUICodeNote = ZikoUICodeNote;
|
|
11078
11553
|
exports.ZikoUICodeText = ZikoUICodeText;
|
|
@@ -11080,21 +11555,42 @@
|
|
|
11080
11555
|
exports.ZikoUIElement = ZikoUIElement;
|
|
11081
11556
|
exports.ZikoUIFigure = ZikoUIFigure;
|
|
11082
11557
|
exports.ZikoUIFooter = ZikoUIFooter;
|
|
11558
|
+
exports.ZikoUIForm = ZikoUIForm;
|
|
11083
11559
|
exports.ZikoUIHeader = ZikoUIHeader;
|
|
11084
11560
|
exports.ZikoUIHeading = ZikoUIHeading;
|
|
11561
|
+
exports.ZikoUIHorizontalSplitter = ZikoUIHorizontalSplitter;
|
|
11085
11562
|
exports.ZikoUIHr = ZikoUIHr;
|
|
11086
11563
|
exports.ZikoUIHtmlTag = ZikoUIHtmlTag;
|
|
11087
11564
|
exports.ZikoUIImage = ZikoUIImage;
|
|
11565
|
+
exports.ZikoUIInput = ZikoUIInput;
|
|
11566
|
+
exports.ZikoUIInputCheckbox = ZikoUIInputCheckbox;
|
|
11567
|
+
exports.ZikoUIInputColor = ZikoUIInputColor;
|
|
11568
|
+
exports.ZikoUIInputDatalist = ZikoUIInputDatalist$1;
|
|
11569
|
+
exports.ZikoUIInputDate = ZikoUIInputDate;
|
|
11570
|
+
exports.ZikoUIInputDateTime = ZikoUIInputDateTime;
|
|
11571
|
+
exports.ZikoUIInputEmail = ZikoUIInputEmail;
|
|
11572
|
+
exports.ZikoUIInputImage = ZikoUIInputImage;
|
|
11573
|
+
exports.ZikoUIInputNumber = ZikoUIInputNumber;
|
|
11574
|
+
exports.ZikoUIInputOption = ZikoUIInputOption;
|
|
11575
|
+
exports.ZikoUIInputPassword = ZikoUIInputPassword;
|
|
11576
|
+
exports.ZikoUIInputRadio = ZikoUIInputRadio;
|
|
11577
|
+
exports.ZikoUIInputSearch = ZikoUIInputSearch;
|
|
11578
|
+
exports.ZikoUIInputSlider = ZikoUIInputSlider$1;
|
|
11579
|
+
exports.ZikoUIInputTime = ZikoUIInputTime;
|
|
11580
|
+
exports.ZikoUILabel = ZikoUILabel;
|
|
11088
11581
|
exports.ZikoUILink = ZikoUILink;
|
|
11089
11582
|
exports.ZikoUIMain = ZikoUIMain;
|
|
11090
11583
|
exports.ZikoUINav = ZikoUINav;
|
|
11091
11584
|
exports.ZikoUIParagraphe = ZikoUIParagraphe;
|
|
11092
11585
|
exports.ZikoUIQuote = ZikoUIQuote;
|
|
11093
11586
|
exports.ZikoUISection = ZikoUISection;
|
|
11587
|
+
exports.ZikoUISelect = ZikoUISelect;
|
|
11094
11588
|
exports.ZikoUISubText = ZikoUISubText;
|
|
11095
11589
|
exports.ZikoUISupText = ZikoUISupText;
|
|
11096
11590
|
exports.ZikoUISvg = ZikoUISvg;
|
|
11097
11591
|
exports.ZikoUIText = ZikoUIText;
|
|
11592
|
+
exports.ZikoUITextArea = ZikoUITextArea;
|
|
11593
|
+
exports.ZikoUIVerticalSplitter = ZikoUIVerticalSplitter;
|
|
11098
11594
|
exports.ZikoUIVideo = ZikoUIVideo;
|
|
11099
11595
|
exports.__Config__ = __Config__;
|
|
11100
11596
|
exports.abbrText = abbrText;
|
|
@@ -11143,6 +11639,7 @@
|
|
|
11143
11639
|
exports.csv2matrix = csv2matrix;
|
|
11144
11640
|
exports.csv2object = csv2object;
|
|
11145
11641
|
exports.csv2sql = csv2sql;
|
|
11642
|
+
exports.dangerAlert = dangerAlert;
|
|
11146
11643
|
exports.datalist = datalist;
|
|
11147
11644
|
exports.default = Ziko;
|
|
11148
11645
|
exports.deg2rad = deg2rad;
|
|
@@ -11160,12 +11657,14 @@
|
|
|
11160
11657
|
exports.h4 = h4;
|
|
11161
11658
|
exports.h5 = h5;
|
|
11162
11659
|
exports.h6 = h6;
|
|
11660
|
+
exports.hSplitter = hSplitter;
|
|
11163
11661
|
exports.hr = hr;
|
|
11164
11662
|
exports.hrs = hrs;
|
|
11165
11663
|
exports.html = html;
|
|
11166
11664
|
exports.hypot = hypot;
|
|
11167
11665
|
exports.image = image;
|
|
11168
11666
|
exports.inRange = inRange;
|
|
11667
|
+
exports.infoAlert = infoAlert;
|
|
11169
11668
|
exports.input = input;
|
|
11170
11669
|
exports.inputCamera = inputCamera;
|
|
11171
11670
|
exports.inputColor = inputColor;
|
|
@@ -11234,6 +11733,7 @@
|
|
|
11234
11733
|
exports.sub = sub;
|
|
11235
11734
|
exports.subSet = subSet;
|
|
11236
11735
|
exports.subText = subText;
|
|
11736
|
+
exports.successAlert = successAlert;
|
|
11237
11737
|
exports.sum = sum;
|
|
11238
11738
|
exports.supText = supText;
|
|
11239
11739
|
exports.svg2ascii = svg2ascii;
|
|
@@ -11290,10 +11790,12 @@
|
|
|
11290
11790
|
exports.useTimeLoop = useTimeLoop;
|
|
11291
11791
|
exports.useTitle = useTitle;
|
|
11292
11792
|
exports.useWheelEvent = useWheelEventnent;
|
|
11793
|
+
exports.vSplitter = vSplitter;
|
|
11293
11794
|
exports.video = video;
|
|
11294
11795
|
exports.wait = wait;
|
|
11295
11796
|
exports.waitForUIElm = waitForUIElm;
|
|
11296
11797
|
exports.waitForUIElmSync = waitForUIElmSync;
|
|
11798
|
+
exports.warningAlert = warningAlert;
|
|
11297
11799
|
exports.watchAttr = watchAttr;
|
|
11298
11800
|
exports.watchChildren = watchChildren;
|
|
11299
11801
|
exports.watchIntersection = watchIntersection;
|