ziko 0.0.2 → 0.0.4
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 +11 -15
- package/dist/ziko.cjs +459 -82
- package/dist/ziko.js +459 -82
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +459 -82
- package/package.json +5 -7
- package/src/App/app.js +9 -0
- package/src/Reactivity/Events/Global/CustomEvent.js +2 -2
- package/src/Reactivity/Events/Global/Mouse.js +230 -0
- package/src/Reactivity/Events/Global/Touch.js +0 -0
- package/src/Reactivity/Events/Global/Wheel.js +44 -0
- package/src/Reactivity/Events/Partiel/Hash.js +44 -0
- package/src/Reactivity/Events/Partiel/MediaEvent.js +1 -0
- package/src/Reactivity/Events/index.js +11 -2
- package/src/UI/CustomElement/Flex.js +22 -22
- package/src/UI/Media/Audio/index.js +14 -1
- package/src/UI/Media/Video/index.js +13 -0
- package/src/UI/ZikoUIElement.js +52 -29
- package/starter/bin/index.js +0 -10
package/dist/ziko.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date :
|
|
5
|
+
Date : Mon Mar 18 2024 11:29:55 GMT+0000 (UTC)
|
|
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
|
|
@@ -3384,6 +3384,332 @@ class ZikoEventPointer extends ZikoEvent {
|
|
|
3384
3384
|
}
|
|
3385
3385
|
var Pointer = target => new ZikoEventPointer(target);
|
|
3386
3386
|
|
|
3387
|
+
class ZikoEventMouse extends ZikoEvent {
|
|
3388
|
+
constructor(target) {
|
|
3389
|
+
super(target);
|
|
3390
|
+
this.event = null;
|
|
3391
|
+
this.dx = 0;
|
|
3392
|
+
this.dy = 0;
|
|
3393
|
+
this.dt = 0;
|
|
3394
|
+
this.mx = 0;
|
|
3395
|
+
this.my = 0;
|
|
3396
|
+
this.mt = 0;
|
|
3397
|
+
this.ux = 0;
|
|
3398
|
+
this.uy = 0;
|
|
3399
|
+
this.ut = 0;
|
|
3400
|
+
this.swippe = {
|
|
3401
|
+
h: null,
|
|
3402
|
+
v: null,
|
|
3403
|
+
delta_x: 0,
|
|
3404
|
+
delta_y: 0
|
|
3405
|
+
};
|
|
3406
|
+
this.isMoving = false;
|
|
3407
|
+
this.isDown = false;
|
|
3408
|
+
this.cache = {
|
|
3409
|
+
prefixe: "mouse",
|
|
3410
|
+
preventDefault: {
|
|
3411
|
+
down: false,
|
|
3412
|
+
move: false,
|
|
3413
|
+
up: false,
|
|
3414
|
+
enter: false,
|
|
3415
|
+
out: false,
|
|
3416
|
+
leave: false,
|
|
3417
|
+
over: false
|
|
3418
|
+
},
|
|
3419
|
+
paused: {
|
|
3420
|
+
down: false,
|
|
3421
|
+
move: false,
|
|
3422
|
+
up: false,
|
|
3423
|
+
enter: false,
|
|
3424
|
+
out: false,
|
|
3425
|
+
leave: false,
|
|
3426
|
+
over: false
|
|
3427
|
+
},
|
|
3428
|
+
stream: {
|
|
3429
|
+
enabled: {
|
|
3430
|
+
down: false,
|
|
3431
|
+
move: false,
|
|
3432
|
+
up: false,
|
|
3433
|
+
enter: false,
|
|
3434
|
+
out: false,
|
|
3435
|
+
leave: false,
|
|
3436
|
+
over: false
|
|
3437
|
+
},
|
|
3438
|
+
clear: {
|
|
3439
|
+
down: false,
|
|
3440
|
+
move: false,
|
|
3441
|
+
up: false,
|
|
3442
|
+
enter: false,
|
|
3443
|
+
out: false,
|
|
3444
|
+
leave: false,
|
|
3445
|
+
over: false
|
|
3446
|
+
},
|
|
3447
|
+
history: {
|
|
3448
|
+
down: [],
|
|
3449
|
+
move: [],
|
|
3450
|
+
up: [],
|
|
3451
|
+
enter: [],
|
|
3452
|
+
out: [],
|
|
3453
|
+
leave: [],
|
|
3454
|
+
over: []
|
|
3455
|
+
}
|
|
3456
|
+
},
|
|
3457
|
+
callbacks: {
|
|
3458
|
+
down: [self => console.log({
|
|
3459
|
+
dx: self.dx,
|
|
3460
|
+
dy: self.dy,
|
|
3461
|
+
down: self.down,
|
|
3462
|
+
move: self.move,
|
|
3463
|
+
t: self.dt
|
|
3464
|
+
})],
|
|
3465
|
+
move: [self => console.log({
|
|
3466
|
+
mx: self.mx,
|
|
3467
|
+
my: self.my,
|
|
3468
|
+
down: self.down,
|
|
3469
|
+
move: self.move,
|
|
3470
|
+
t: self.dt
|
|
3471
|
+
})],
|
|
3472
|
+
up: [self => console.log({
|
|
3473
|
+
ux: self.ux,
|
|
3474
|
+
uy: self.uy,
|
|
3475
|
+
down: self.down,
|
|
3476
|
+
move: self.move,
|
|
3477
|
+
t: self.dt
|
|
3478
|
+
})],
|
|
3479
|
+
enter: [self => console.log({
|
|
3480
|
+
dx: self.dx,
|
|
3481
|
+
dy: self.dy,
|
|
3482
|
+
down: self.down,
|
|
3483
|
+
move: self.move,
|
|
3484
|
+
t: self.dt
|
|
3485
|
+
})],
|
|
3486
|
+
out: [self => console.log({
|
|
3487
|
+
mx: self.mx,
|
|
3488
|
+
my: self.my,
|
|
3489
|
+
down: self.down,
|
|
3490
|
+
move: self.move,
|
|
3491
|
+
t: self.dt
|
|
3492
|
+
})],
|
|
3493
|
+
leave: [self => console.log({
|
|
3494
|
+
ux: self.ux,
|
|
3495
|
+
uy: self.uy,
|
|
3496
|
+
down: self.down,
|
|
3497
|
+
move: self.move,
|
|
3498
|
+
t: self.dt
|
|
3499
|
+
})],
|
|
3500
|
+
over: [self => console.log({
|
|
3501
|
+
ux: self.ux,
|
|
3502
|
+
uy: self.uy,
|
|
3503
|
+
down: self.down,
|
|
3504
|
+
move: self.move,
|
|
3505
|
+
t: self.dt
|
|
3506
|
+
})]
|
|
3507
|
+
}
|
|
3508
|
+
};
|
|
3509
|
+
this.__controller = {
|
|
3510
|
+
down: mousedown_controller.bind(this),
|
|
3511
|
+
move: mousemove_controller.bind(this),
|
|
3512
|
+
up: mouseup_controller.bind(this),
|
|
3513
|
+
enter: mouseenter_controller.bind(this),
|
|
3514
|
+
out: mouseout_controller.bind(this),
|
|
3515
|
+
leave: mouseleave_controller.bind(this),
|
|
3516
|
+
over: mouseover_controller.bind(this)
|
|
3517
|
+
};
|
|
3518
|
+
}
|
|
3519
|
+
onDown(...callbacks) {
|
|
3520
|
+
if (callbacks.length === 0) callbacks = [() => {}];
|
|
3521
|
+
this.__onEvent("down", {
|
|
3522
|
+
down: true,
|
|
3523
|
+
move: false,
|
|
3524
|
+
up: false,
|
|
3525
|
+
enter: false,
|
|
3526
|
+
out: false,
|
|
3527
|
+
leave: false,
|
|
3528
|
+
over: false
|
|
3529
|
+
}, ...callbacks);
|
|
3530
|
+
return this;
|
|
3531
|
+
}
|
|
3532
|
+
onMove(...callbacks) {
|
|
3533
|
+
if (callbacks.length === 0) callbacks = [() => {}];
|
|
3534
|
+
this.__onEvent("move", {
|
|
3535
|
+
down: false,
|
|
3536
|
+
move: true,
|
|
3537
|
+
up: false,
|
|
3538
|
+
enter: false,
|
|
3539
|
+
out: false,
|
|
3540
|
+
leave: false,
|
|
3541
|
+
over: false
|
|
3542
|
+
}, ...callbacks);
|
|
3543
|
+
return this;
|
|
3544
|
+
}
|
|
3545
|
+
onUp(...callbacks) {
|
|
3546
|
+
if (callbacks.length === 0) callbacks = [() => {}];
|
|
3547
|
+
this.__onEvent("up", {
|
|
3548
|
+
down: false,
|
|
3549
|
+
move: false,
|
|
3550
|
+
up: true,
|
|
3551
|
+
enter: false,
|
|
3552
|
+
out: false,
|
|
3553
|
+
leave: false,
|
|
3554
|
+
over: false
|
|
3555
|
+
}, ...callbacks);
|
|
3556
|
+
return this;
|
|
3557
|
+
}
|
|
3558
|
+
onEnter(...callbacks) {
|
|
3559
|
+
if (callbacks.length === 0) callbacks = [() => {}];
|
|
3560
|
+
this.__onEvent("enter", {
|
|
3561
|
+
down: false,
|
|
3562
|
+
move: false,
|
|
3563
|
+
up: false,
|
|
3564
|
+
enter: true,
|
|
3565
|
+
out: false,
|
|
3566
|
+
leave: false,
|
|
3567
|
+
over: false
|
|
3568
|
+
}, ...callbacks);
|
|
3569
|
+
return this;
|
|
3570
|
+
}
|
|
3571
|
+
onOut(...callbacks) {
|
|
3572
|
+
if (callbacks.length === 0) callbacks = [() => {}];
|
|
3573
|
+
this.__onEvent("out", {
|
|
3574
|
+
down: false,
|
|
3575
|
+
move: false,
|
|
3576
|
+
up: false,
|
|
3577
|
+
enter: false,
|
|
3578
|
+
out: true,
|
|
3579
|
+
leave: false,
|
|
3580
|
+
over: false
|
|
3581
|
+
}, ...callbacks);
|
|
3582
|
+
return this;
|
|
3583
|
+
}
|
|
3584
|
+
onLeave(...callbacks) {
|
|
3585
|
+
if (callbacks.length === 0) callbacks = [() => {}];
|
|
3586
|
+
this.__onEvent("leave", {
|
|
3587
|
+
down: false,
|
|
3588
|
+
move: false,
|
|
3589
|
+
up: false,
|
|
3590
|
+
enter: false,
|
|
3591
|
+
out: false,
|
|
3592
|
+
leave: true,
|
|
3593
|
+
over: false
|
|
3594
|
+
}, ...callbacks);
|
|
3595
|
+
return this;
|
|
3596
|
+
}
|
|
3597
|
+
onOver(...callbacks) {
|
|
3598
|
+
if (callbacks.length === 0) callbacks = [() => {}];
|
|
3599
|
+
this.__onEvent("over", {
|
|
3600
|
+
down: false,
|
|
3601
|
+
move: false,
|
|
3602
|
+
up: false,
|
|
3603
|
+
enter: false,
|
|
3604
|
+
out: false,
|
|
3605
|
+
leave: false,
|
|
3606
|
+
over: true
|
|
3607
|
+
}, ...callbacks);
|
|
3608
|
+
return this;
|
|
3609
|
+
}
|
|
3610
|
+
}
|
|
3611
|
+
function mousedown_controller(e) {
|
|
3612
|
+
EVENT_CONTROLLER.call(this, e, "down", () => {
|
|
3613
|
+
this.dx = parseInt(e.offsetX);
|
|
3614
|
+
this.dy = parseInt(e.offsetY);
|
|
3615
|
+
this.isDown = true;
|
|
3616
|
+
}, {
|
|
3617
|
+
x: this.dx,
|
|
3618
|
+
y: this.dy,
|
|
3619
|
+
t: Date.now() - this.cache.stream.t0
|
|
3620
|
+
});
|
|
3621
|
+
}
|
|
3622
|
+
function mousemove_controller(e) {
|
|
3623
|
+
EVENT_CONTROLLER.call(this, e, "move", () => {
|
|
3624
|
+
this.mx = parseInt(e.offsetX);
|
|
3625
|
+
this.my = parseInt(e.offsetY);
|
|
3626
|
+
this.isMoving = true;
|
|
3627
|
+
}, {
|
|
3628
|
+
x: this.mx,
|
|
3629
|
+
y: this.my,
|
|
3630
|
+
t: Date.now() - this.cache.stream.t0
|
|
3631
|
+
});
|
|
3632
|
+
}
|
|
3633
|
+
function mouseup_controller(e) {
|
|
3634
|
+
EVENT_CONTROLLER.call(this, e, "up", () => {
|
|
3635
|
+
this.ux = parseInt(e.offsetX);
|
|
3636
|
+
this.uy = parseInt(e.offsetY);
|
|
3637
|
+
this.isDown = false;
|
|
3638
|
+
const dx = this.dx;
|
|
3639
|
+
const dy = this.dy;
|
|
3640
|
+
const ux = this.ux;
|
|
3641
|
+
const uy = this.uy;
|
|
3642
|
+
const delta_x = (ux - dx) / this.target.Width;
|
|
3643
|
+
const delta_y = (dy - uy) / this.target.Height;
|
|
3644
|
+
const HORIZONTAL_SWIPPE = delta_x < 0 ? "left" : delta_x > 0 ? "right" : "none";
|
|
3645
|
+
const VERTICAL_SWIPPE = delta_y < 0 ? "bottom" : delta_y > 0 ? "top" : "none";
|
|
3646
|
+
this.swippe = {
|
|
3647
|
+
h: HORIZONTAL_SWIPPE,
|
|
3648
|
+
v: VERTICAL_SWIPPE,
|
|
3649
|
+
delta_x,
|
|
3650
|
+
delta_y
|
|
3651
|
+
};
|
|
3652
|
+
}, {
|
|
3653
|
+
x: this.ux,
|
|
3654
|
+
y: this.uy,
|
|
3655
|
+
t: Date.now() - this.cache.stream.t0
|
|
3656
|
+
});
|
|
3657
|
+
}
|
|
3658
|
+
function mouseenter_controller(e) {
|
|
3659
|
+
EVENT_CONTROLLER.call(this, e, "enter", null, null);
|
|
3660
|
+
}
|
|
3661
|
+
function mouseleave_controller(e) {
|
|
3662
|
+
EVENT_CONTROLLER.call(this, e, "leave", null, null);
|
|
3663
|
+
}
|
|
3664
|
+
function mouseout_controller(e) {
|
|
3665
|
+
EVENT_CONTROLLER.call(this, e, "out", null, null);
|
|
3666
|
+
}
|
|
3667
|
+
function mouseover_controller(e) {
|
|
3668
|
+
EVENT_CONTROLLER.call(this, e, "out", null, null);
|
|
3669
|
+
}
|
|
3670
|
+
const Mouse = target => new ZikoEventMouse(target);
|
|
3671
|
+
|
|
3672
|
+
function wheel_controller(e) {
|
|
3673
|
+
EVENT_CONTROLLER.call(this, e, "wheel", null, null);
|
|
3674
|
+
}
|
|
3675
|
+
class ZikoEventWheel extends ZikoEvent {
|
|
3676
|
+
constructor(target) {
|
|
3677
|
+
super(target);
|
|
3678
|
+
this.event = null;
|
|
3679
|
+
this.cache = {
|
|
3680
|
+
prefixe: "",
|
|
3681
|
+
preventDefault: {
|
|
3682
|
+
wheel: false
|
|
3683
|
+
},
|
|
3684
|
+
paused: {
|
|
3685
|
+
wheel: false
|
|
3686
|
+
},
|
|
3687
|
+
stream: {
|
|
3688
|
+
enabled: {
|
|
3689
|
+
wheel: false
|
|
3690
|
+
},
|
|
3691
|
+
clear: {
|
|
3692
|
+
wheel: false
|
|
3693
|
+
},
|
|
3694
|
+
history: {
|
|
3695
|
+
wheel: []
|
|
3696
|
+
}
|
|
3697
|
+
},
|
|
3698
|
+
callbacks: {
|
|
3699
|
+
click: []
|
|
3700
|
+
}
|
|
3701
|
+
};
|
|
3702
|
+
this.__controller = {
|
|
3703
|
+
wheel: wheel_controller.bind(this)
|
|
3704
|
+
};
|
|
3705
|
+
}
|
|
3706
|
+
onWheel(...callbacks) {
|
|
3707
|
+
this.__onEvent("wheel", {}, ...callbacks);
|
|
3708
|
+
return this;
|
|
3709
|
+
}
|
|
3710
|
+
}
|
|
3711
|
+
const Wheel = Target => new ZikoEventWheel(Target);
|
|
3712
|
+
|
|
3387
3713
|
function keydown_controller(e) {
|
|
3388
3714
|
EVENT_CONTROLLER.call(this, e, "down", () => this.kd = e.key, {
|
|
3389
3715
|
key: e.key,
|
|
@@ -3874,53 +4200,53 @@ class ZikoEventInput extends ZikoEvent {
|
|
|
3874
4200
|
}
|
|
3875
4201
|
const Input$1 = Target => new ZikoEventInput(Target);
|
|
3876
4202
|
|
|
3877
|
-
|
|
3878
|
-
EVENT_CONTROLLER.call(this, e,
|
|
3879
|
-
}
|
|
3880
|
-
class
|
|
4203
|
+
function hashchange_controller(e) {
|
|
4204
|
+
EVENT_CONTROLLER.call(this, e, "hashchange", null, null);
|
|
4205
|
+
}
|
|
4206
|
+
class ZikoEventHash extends ZikoEvent {
|
|
3881
4207
|
constructor(target) {
|
|
3882
4208
|
super(target);
|
|
3883
4209
|
this.event = null;
|
|
3884
4210
|
this.cache = {
|
|
3885
4211
|
prefixe: "",
|
|
3886
|
-
preventDefault: {
|
|
3887
|
-
|
|
4212
|
+
preventDefault: {
|
|
4213
|
+
hashchange: false
|
|
4214
|
+
},
|
|
4215
|
+
paused: {
|
|
4216
|
+
hashchange: false
|
|
4217
|
+
},
|
|
3888
4218
|
stream: {
|
|
3889
|
-
enabled: {
|
|
3890
|
-
|
|
3891
|
-
|
|
4219
|
+
enabled: {
|
|
4220
|
+
hashchange: false
|
|
4221
|
+
},
|
|
4222
|
+
clear: {
|
|
4223
|
+
hashchange: false
|
|
4224
|
+
},
|
|
4225
|
+
history: {
|
|
4226
|
+
hashchange: []
|
|
4227
|
+
}
|
|
3892
4228
|
},
|
|
3893
|
-
callbacks: {
|
|
4229
|
+
callbacks: {
|
|
4230
|
+
hashchange: []
|
|
4231
|
+
}
|
|
4232
|
+
};
|
|
4233
|
+
this.__controller = {
|
|
4234
|
+
hashchange: hashchange_controller.bind(this)
|
|
3894
4235
|
};
|
|
3895
|
-
this.__controller = {};
|
|
3896
|
-
}
|
|
3897
|
-
#init(event_name) {
|
|
3898
|
-
this.cache.preventDefault[event_name] = false;
|
|
3899
|
-
this.cache.paused[event_name] = false;
|
|
3900
|
-
this.cache.stream.enabled = false;
|
|
3901
|
-
this.cache.stream.clear = false;
|
|
3902
|
-
this.cache.stream.history = [];
|
|
3903
|
-
this.cache.callbacks[event_name] = [];
|
|
3904
|
-
this.__controller[event_name] = custom_event_controller(event_name).bind(this);
|
|
3905
|
-
return this;
|
|
3906
|
-
}
|
|
3907
|
-
on(event_name, ...callbacks) {
|
|
3908
|
-
if (!this.__controller[event_name]) this.#init(event_name);
|
|
3909
|
-
this.__onEvent(event_name, {}, ...callbacks);
|
|
3910
|
-
return this;
|
|
3911
4236
|
}
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
this.detail = detail;
|
|
3915
|
-
const event = new Event(event_name);
|
|
3916
|
-
this.targetElement.dispatchEvent(event);
|
|
4237
|
+
onChange(...callbacks) {
|
|
4238
|
+
this.__onEvent("hashchange", {}, ...callbacks);
|
|
3917
4239
|
return this;
|
|
3918
4240
|
}
|
|
3919
4241
|
}
|
|
3920
|
-
const
|
|
4242
|
+
const HashEvent = Target => new ZikoEventHash(Target);
|
|
4243
|
+
|
|
4244
|
+
const customEvent = Target => new customEvent();
|
|
3921
4245
|
|
|
3922
4246
|
const Events = {
|
|
3923
4247
|
Pointer,
|
|
4248
|
+
Mouse,
|
|
4249
|
+
Wheel,
|
|
3924
4250
|
Key,
|
|
3925
4251
|
Drag,
|
|
3926
4252
|
Drop,
|
|
@@ -3928,6 +4254,7 @@ const Events = {
|
|
|
3928
4254
|
Clipboard,
|
|
3929
4255
|
Focus,
|
|
3930
4256
|
Input: Input$1,
|
|
4257
|
+
HashEvent,
|
|
3931
4258
|
CustomEvent,
|
|
3932
4259
|
ExtractAll: function () {
|
|
3933
4260
|
const keys = Object.keys(this);
|
|
@@ -6115,18 +6442,16 @@ class ZikoUIElement {
|
|
|
6115
6442
|
isRoot: false,
|
|
6116
6443
|
isHidden: false,
|
|
6117
6444
|
isFrozzen: false,
|
|
6118
|
-
// transformMatrix:matrix([
|
|
6119
|
-
// [0,0,0],
|
|
6120
|
-
// [0,0,0],
|
|
6121
|
-
// [1,1,0]
|
|
6122
|
-
// ]),
|
|
6123
6445
|
style: ZikoStyle({}),
|
|
6124
6446
|
attributes: {},
|
|
6125
|
-
filters: {}
|
|
6447
|
+
filters: {},
|
|
6448
|
+
temp: {}
|
|
6126
6449
|
};
|
|
6127
6450
|
this.items = [];
|
|
6128
6451
|
this.events = {
|
|
6129
6452
|
ptr: null,
|
|
6453
|
+
mouse: null,
|
|
6454
|
+
Wheel: null,
|
|
6130
6455
|
key: null,
|
|
6131
6456
|
drag: null,
|
|
6132
6457
|
drop: null,
|
|
@@ -6171,7 +6496,7 @@ class ZikoUIElement {
|
|
|
6171
6496
|
root = root.parent;
|
|
6172
6497
|
}
|
|
6173
6498
|
}
|
|
6174
|
-
clone() {
|
|
6499
|
+
clone(render = false) {
|
|
6175
6500
|
// Not working For Table
|
|
6176
6501
|
const UI = new this.constructor();
|
|
6177
6502
|
UI.__proto__ = this.__proto__;
|
|
@@ -6179,7 +6504,7 @@ class ZikoUIElement {
|
|
|
6179
6504
|
const items = [...this.items].map(n => n.clone());
|
|
6180
6505
|
UI.append(...items);
|
|
6181
6506
|
} else UI.element = this.element.cloneNode(true);
|
|
6182
|
-
return UI;
|
|
6507
|
+
return UI.render(render);
|
|
6183
6508
|
}
|
|
6184
6509
|
style(styles, {
|
|
6185
6510
|
target = "parent",
|
|
@@ -6355,10 +6680,13 @@ class ZikoUIElement {
|
|
|
6355
6680
|
this.items.forEach(callback);
|
|
6356
6681
|
return this;
|
|
6357
6682
|
}
|
|
6358
|
-
|
|
6683
|
+
where(condition_callback, if_callback, else_callback) {
|
|
6359
6684
|
this.items.filter(condition_callback).forEach(if_callback);
|
|
6360
6685
|
return this;
|
|
6361
6686
|
}
|
|
6687
|
+
filter(condition) {
|
|
6688
|
+
return this.items.filter(condition);
|
|
6689
|
+
}
|
|
6362
6690
|
filterByTextContent(text, exactMatch = false) {
|
|
6363
6691
|
this.items.map(n => n.render());
|
|
6364
6692
|
this.items.filter(n => {
|
|
@@ -6412,6 +6740,41 @@ class ZikoUIElement {
|
|
|
6412
6740
|
this.events.ptr.onOut(...callbacks);
|
|
6413
6741
|
return this;
|
|
6414
6742
|
}
|
|
6743
|
+
onMouseMove(...callbacks) {
|
|
6744
|
+
if (!this.events.mouse) this.events.mouse = Mouse(this);
|
|
6745
|
+
this.events.mouse.onMove(...callbacks);
|
|
6746
|
+
return this;
|
|
6747
|
+
}
|
|
6748
|
+
onMouseDown(...callbacks) {
|
|
6749
|
+
if (!this.events.mouse) this.events.mouse = Mouse(this);
|
|
6750
|
+
this.events.mouse.onDown(...callbacks);
|
|
6751
|
+
return this;
|
|
6752
|
+
}
|
|
6753
|
+
onMouseUp(...callbacks) {
|
|
6754
|
+
if (!this.events.mouse) this.events.mouse = Mouse(this);
|
|
6755
|
+
this.events.mouse.onUp(...callbacks);
|
|
6756
|
+
return this;
|
|
6757
|
+
}
|
|
6758
|
+
onMouseEnter(...callbacks) {
|
|
6759
|
+
if (!this.events.mouse) this.events.mouse = Mouse(this);
|
|
6760
|
+
this.events.mouse.onEnter(...callbacks);
|
|
6761
|
+
return this;
|
|
6762
|
+
}
|
|
6763
|
+
onMouseLeave(...callbacks) {
|
|
6764
|
+
if (!this.events.mouse) this.events.mouse = Mouse(this);
|
|
6765
|
+
this.events.mouse.onLeave(...callbacks);
|
|
6766
|
+
return this;
|
|
6767
|
+
}
|
|
6768
|
+
onMouseOut(...callbacks) {
|
|
6769
|
+
if (!this.events.mouse) this.events.mouse = Mouse(this);
|
|
6770
|
+
this.events.mouse.onOut(...callbacks);
|
|
6771
|
+
return this;
|
|
6772
|
+
}
|
|
6773
|
+
onWheel(...callbacks) {
|
|
6774
|
+
if (!this.events.wheel) this.events.wheel = Wheel(this);
|
|
6775
|
+
this.events.wheel.onWheel(...callbacks);
|
|
6776
|
+
return this;
|
|
6777
|
+
}
|
|
6415
6778
|
onKeyDown(...callbacks) {
|
|
6416
6779
|
if (!this.events.key) this.events.key = Key(this);
|
|
6417
6780
|
this.events.key.onDown(...callbacks);
|
|
@@ -6499,12 +6862,12 @@ class ZikoUIElement {
|
|
|
6499
6862
|
return this;
|
|
6500
6863
|
}
|
|
6501
6864
|
on(event_name, ...callbacks) {
|
|
6502
|
-
if (!this.events.custom) this.events.custom =
|
|
6865
|
+
if (!this.events.custom) this.events.custom = customEvent();
|
|
6503
6866
|
this.events.custom.on(event_name, ...callbacks);
|
|
6504
6867
|
return this;
|
|
6505
6868
|
}
|
|
6506
6869
|
emit(event_name, detail = {}) {
|
|
6507
|
-
if (!this.events.custom) this.events.custom =
|
|
6870
|
+
if (!this.events.custom) this.events.custom = customEvent();
|
|
6508
6871
|
this.events.custom.emit(event_name, detail);
|
|
6509
6872
|
return this;
|
|
6510
6873
|
}
|
|
@@ -6537,18 +6900,6 @@ class ZikoUIElement {
|
|
|
6537
6900
|
isVisible: topVisible || bottomVisible || rightVisible || leftVisible
|
|
6538
6901
|
};
|
|
6539
6902
|
}
|
|
6540
|
-
|
|
6541
|
-
// toggleSlide() {}
|
|
6542
|
-
|
|
6543
|
-
// Glassmorphism(background = "rgba(255,255,255,0.1)", blur = "1px") {
|
|
6544
|
-
// this.style({ background: background, backdropFilter: blur });
|
|
6545
|
-
// return this;
|
|
6546
|
-
// }
|
|
6547
|
-
// Neumorphism(r = "50px", bg = "cyan", box = "13px -13px 49px #5d8fac") {
|
|
6548
|
-
// this.style({ borderRadius: r, background: bg, boxShadow: box });
|
|
6549
|
-
// return this;
|
|
6550
|
-
// }
|
|
6551
|
-
|
|
6552
6903
|
setFullScreen(set = true, e) {
|
|
6553
6904
|
if (!this.element.requestFullscreen) {
|
|
6554
6905
|
console.error("Fullscreen API is not supported in this browser.");
|
|
@@ -7310,6 +7661,9 @@ class ZikoUIVideo extends ZikoUIElement {
|
|
|
7310
7661
|
});
|
|
7311
7662
|
this.render();
|
|
7312
7663
|
}
|
|
7664
|
+
get t() {
|
|
7665
|
+
return this.element.currentTime;
|
|
7666
|
+
}
|
|
7313
7667
|
useControls(enabled = true) {
|
|
7314
7668
|
this.element.controls = enabled;
|
|
7315
7669
|
return this;
|
|
@@ -7330,6 +7684,12 @@ class ZikoUIVideo extends ZikoUIElement {
|
|
|
7330
7684
|
this.element.requestPictureInPicture(e);
|
|
7331
7685
|
return this;
|
|
7332
7686
|
}
|
|
7687
|
+
seekTo(time) {
|
|
7688
|
+
this.element.currentTime = time;
|
|
7689
|
+
return this;
|
|
7690
|
+
}
|
|
7691
|
+
onPlay() {}
|
|
7692
|
+
onPause() {}
|
|
7333
7693
|
}
|
|
7334
7694
|
const video = (src, width, height) => new ZikoUIVideo(src, width, height);
|
|
7335
7695
|
|
|
@@ -7338,7 +7698,10 @@ class ZikoUIAudio extends ZikoUIElement {
|
|
|
7338
7698
|
super("audio", "audio");
|
|
7339
7699
|
this.element.setAttribute("src", src);
|
|
7340
7700
|
this.render();
|
|
7341
|
-
this.
|
|
7701
|
+
this.useControls();
|
|
7702
|
+
}
|
|
7703
|
+
get t() {
|
|
7704
|
+
return this.element.currentTime;
|
|
7342
7705
|
}
|
|
7343
7706
|
useControls(enabled = true) {
|
|
7344
7707
|
this.element.controls = enabled;
|
|
@@ -7352,6 +7715,12 @@ class ZikoUIAudio extends ZikoUIElement {
|
|
|
7352
7715
|
this.element.pause();
|
|
7353
7716
|
return this;
|
|
7354
7717
|
}
|
|
7718
|
+
seekTo(time) {
|
|
7719
|
+
this.element.currentTime = time;
|
|
7720
|
+
return this;
|
|
7721
|
+
}
|
|
7722
|
+
onPlay() {}
|
|
7723
|
+
onPause() {}
|
|
7355
7724
|
}
|
|
7356
7725
|
const audio = src => new ZikoUIAudio(src);
|
|
7357
7726
|
|
|
@@ -7382,32 +7751,8 @@ class ZikoUIWebcame extends ZikoUIVideo {
|
|
|
7382
7751
|
}
|
|
7383
7752
|
const inputCamera = () => new ZikoUIWebcame();
|
|
7384
7753
|
|
|
7385
|
-
function set_vertical(direction) {
|
|
7386
|
-
direction == 1 ? this.style({
|
|
7387
|
-
flexDirection: "column"
|
|
7388
|
-
}) : direction == -1 && this.style({
|
|
7389
|
-
flexDirection: "column-reverse"
|
|
7390
|
-
});
|
|
7391
|
-
return this;
|
|
7392
|
-
}
|
|
7393
|
-
function set_horizontal(direction) {
|
|
7394
|
-
direction == 1 ? this.style({
|
|
7395
|
-
flexDirection: "row"
|
|
7396
|
-
}) : direction == -1 && this.style({
|
|
7397
|
-
flexDirection: "row-reverse"
|
|
7398
|
-
});
|
|
7399
|
-
return this;
|
|
7400
|
-
}
|
|
7401
|
-
function map_pos_x(align) {
|
|
7402
|
-
let pos = ["flex-start", "center", "flex-end"];
|
|
7403
|
-
if (typeof align === "number") align = pos[align + 1];
|
|
7404
|
-
return align;
|
|
7405
|
-
}
|
|
7406
|
-
function map_pos_y(align) {
|
|
7407
|
-
return map_pos_x(-align);
|
|
7408
|
-
}
|
|
7409
7754
|
class ZikoUIFlex extends ZikoUIElement {
|
|
7410
|
-
constructor(tag, w = "100%", h = "100%") {
|
|
7755
|
+
constructor(tag = "div", w = "100%", h = "100%") {
|
|
7411
7756
|
super(tag, "Flex");
|
|
7412
7757
|
this.direction = "cols";
|
|
7413
7758
|
if (typeof w == "number") w += "%";
|
|
@@ -7497,6 +7842,30 @@ const Flex = (...ZikoUIElement) => {
|
|
|
7497
7842
|
}
|
|
7498
7843
|
return new ZikoUIFlex(tag).append(...ZikoUIElement);
|
|
7499
7844
|
};
|
|
7845
|
+
function set_vertical(direction) {
|
|
7846
|
+
direction == 1 ? this.style({
|
|
7847
|
+
flexDirection: "column"
|
|
7848
|
+
}) : direction == -1 && this.style({
|
|
7849
|
+
flexDirection: "column-reverse"
|
|
7850
|
+
});
|
|
7851
|
+
return this;
|
|
7852
|
+
}
|
|
7853
|
+
function set_horizontal(direction) {
|
|
7854
|
+
direction == 1 ? this.style({
|
|
7855
|
+
flexDirection: "row"
|
|
7856
|
+
}) : direction == -1 && this.style({
|
|
7857
|
+
flexDirection: "row-reverse"
|
|
7858
|
+
});
|
|
7859
|
+
return this;
|
|
7860
|
+
}
|
|
7861
|
+
function map_pos_x(align) {
|
|
7862
|
+
let pos = ["flex-start", "center", "flex-end"];
|
|
7863
|
+
if (typeof align === "number") align = pos[align + 1];
|
|
7864
|
+
return align;
|
|
7865
|
+
}
|
|
7866
|
+
function map_pos_y(align) {
|
|
7867
|
+
return map_pos_x(-align);
|
|
7868
|
+
}
|
|
7500
7869
|
|
|
7501
7870
|
class ZikoUIGrid extends ZikoUIElement {
|
|
7502
7871
|
constructor(tag = "div", w = "50vw", h = "50vh") {
|
|
@@ -9510,6 +9879,9 @@ class ZikoUIApp extends ZikoUIFlex {
|
|
|
9510
9879
|
this.head = null;
|
|
9511
9880
|
this.#init();
|
|
9512
9881
|
this.seo = Seo(this);
|
|
9882
|
+
Object.assign(this.events, {
|
|
9883
|
+
hash: null
|
|
9884
|
+
});
|
|
9513
9885
|
Object.assign(this.cache, {
|
|
9514
9886
|
theme: null,
|
|
9515
9887
|
isRoot: true
|
|
@@ -9531,6 +9903,11 @@ class ZikoUIApp extends ZikoUIFlex {
|
|
|
9531
9903
|
}
|
|
9532
9904
|
prefetch() {}
|
|
9533
9905
|
description() {}
|
|
9906
|
+
onHashChange(...callbacks) {
|
|
9907
|
+
if (!this.events.hash) this.events.hash = HashEvent(this);
|
|
9908
|
+
this.events.hash.onChange(...callbacks);
|
|
9909
|
+
return this;
|
|
9910
|
+
}
|
|
9534
9911
|
}
|
|
9535
9912
|
const App = (...UIElement) => new ZikoUIApp().append(...UIElement);
|
|
9536
9913
|
|