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