ziko 0.0.1 → 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 +17 -4
- package/dist/ziko.cjs +466 -87
- package/dist/ziko.js +466 -87
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +464 -87
- package/package.json +8 -3
- package/src/App/Globals/__Target__.js +1 -1
- package/src/App/app.js +9 -0
- package/src/Graphics/Svg/svg.js +3 -3
- 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/src/index.js +8 -7
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
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
+
|
|
13
15
|
class AbstractZikoMath {}
|
|
14
16
|
|
|
15
17
|
class Complex extends AbstractZikoMath {
|
|
@@ -3382,6 +3384,332 @@ class ZikoEventPointer extends ZikoEvent {
|
|
|
3382
3384
|
}
|
|
3383
3385
|
var Pointer = target => new ZikoEventPointer(target);
|
|
3384
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
|
+
|
|
3385
3713
|
function keydown_controller(e) {
|
|
3386
3714
|
EVENT_CONTROLLER.call(this, e, "down", () => this.kd = e.key, {
|
|
3387
3715
|
key: e.key,
|
|
@@ -3872,53 +4200,53 @@ class ZikoEventInput extends ZikoEvent {
|
|
|
3872
4200
|
}
|
|
3873
4201
|
const Input$1 = Target => new ZikoEventInput(Target);
|
|
3874
4202
|
|
|
3875
|
-
|
|
3876
|
-
EVENT_CONTROLLER.call(this, e,
|
|
3877
|
-
}
|
|
3878
|
-
class
|
|
4203
|
+
function hashchange_controller(e) {
|
|
4204
|
+
EVENT_CONTROLLER.call(this, e, "hashchange", null, null);
|
|
4205
|
+
}
|
|
4206
|
+
class ZikoEventHash extends ZikoEvent {
|
|
3879
4207
|
constructor(target) {
|
|
3880
4208
|
super(target);
|
|
3881
4209
|
this.event = null;
|
|
3882
4210
|
this.cache = {
|
|
3883
4211
|
prefixe: "",
|
|
3884
|
-
preventDefault: {
|
|
3885
|
-
|
|
4212
|
+
preventDefault: {
|
|
4213
|
+
hashchange: false
|
|
4214
|
+
},
|
|
4215
|
+
paused: {
|
|
4216
|
+
hashchange: false
|
|
4217
|
+
},
|
|
3886
4218
|
stream: {
|
|
3887
|
-
enabled: {
|
|
3888
|
-
|
|
3889
|
-
|
|
4219
|
+
enabled: {
|
|
4220
|
+
hashchange: false
|
|
4221
|
+
},
|
|
4222
|
+
clear: {
|
|
4223
|
+
hashchange: false
|
|
4224
|
+
},
|
|
4225
|
+
history: {
|
|
4226
|
+
hashchange: []
|
|
4227
|
+
}
|
|
3890
4228
|
},
|
|
3891
|
-
callbacks: {
|
|
4229
|
+
callbacks: {
|
|
4230
|
+
hashchange: []
|
|
4231
|
+
}
|
|
4232
|
+
};
|
|
4233
|
+
this.__controller = {
|
|
4234
|
+
hashchange: hashchange_controller.bind(this)
|
|
3892
4235
|
};
|
|
3893
|
-
this.__controller = {};
|
|
3894
|
-
}
|
|
3895
|
-
#init(event_name) {
|
|
3896
|
-
this.cache.preventDefault[event_name] = false;
|
|
3897
|
-
this.cache.paused[event_name] = false;
|
|
3898
|
-
this.cache.stream.enabled = false;
|
|
3899
|
-
this.cache.stream.clear = false;
|
|
3900
|
-
this.cache.stream.history = [];
|
|
3901
|
-
this.cache.callbacks[event_name] = [];
|
|
3902
|
-
this.__controller[event_name] = custom_event_controller(event_name).bind(this);
|
|
3903
|
-
return this;
|
|
3904
|
-
}
|
|
3905
|
-
on(event_name, ...callbacks) {
|
|
3906
|
-
if (!this.__controller[event_name]) this.#init(event_name);
|
|
3907
|
-
this.__onEvent(event_name, {}, ...callbacks);
|
|
3908
|
-
return this;
|
|
3909
4236
|
}
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
this.detail = detail;
|
|
3913
|
-
const event = new Event(event_name);
|
|
3914
|
-
this.targetElement.dispatchEvent(event);
|
|
4237
|
+
onChange(...callbacks) {
|
|
4238
|
+
this.__onEvent("hashchange", {}, ...callbacks);
|
|
3915
4239
|
return this;
|
|
3916
4240
|
}
|
|
3917
4241
|
}
|
|
3918
|
-
const
|
|
4242
|
+
const HashEvent = Target => new ZikoEventHash(Target);
|
|
4243
|
+
|
|
4244
|
+
const customEvent = Target => new customEvent();
|
|
3919
4245
|
|
|
3920
4246
|
const Events = {
|
|
3921
4247
|
Pointer,
|
|
4248
|
+
Mouse,
|
|
4249
|
+
Wheel,
|
|
3922
4250
|
Key,
|
|
3923
4251
|
Drag,
|
|
3924
4252
|
Drop,
|
|
@@ -3926,6 +4254,7 @@ const Events = {
|
|
|
3926
4254
|
Clipboard,
|
|
3927
4255
|
Focus,
|
|
3928
4256
|
Input: Input$1,
|
|
4257
|
+
HashEvent,
|
|
3929
4258
|
CustomEvent,
|
|
3930
4259
|
ExtractAll: function () {
|
|
3931
4260
|
const keys = Object.keys(this);
|
|
@@ -6113,18 +6442,16 @@ class ZikoUIElement {
|
|
|
6113
6442
|
isRoot: false,
|
|
6114
6443
|
isHidden: false,
|
|
6115
6444
|
isFrozzen: false,
|
|
6116
|
-
// transformMatrix:matrix([
|
|
6117
|
-
// [0,0,0],
|
|
6118
|
-
// [0,0,0],
|
|
6119
|
-
// [1,1,0]
|
|
6120
|
-
// ]),
|
|
6121
6445
|
style: ZikoStyle({}),
|
|
6122
6446
|
attributes: {},
|
|
6123
|
-
filters: {}
|
|
6447
|
+
filters: {},
|
|
6448
|
+
temp: {}
|
|
6124
6449
|
};
|
|
6125
6450
|
this.items = [];
|
|
6126
6451
|
this.events = {
|
|
6127
6452
|
ptr: null,
|
|
6453
|
+
mouse: null,
|
|
6454
|
+
Wheel: null,
|
|
6128
6455
|
key: null,
|
|
6129
6456
|
drag: null,
|
|
6130
6457
|
drop: null,
|
|
@@ -6169,7 +6496,7 @@ class ZikoUIElement {
|
|
|
6169
6496
|
root = root.parent;
|
|
6170
6497
|
}
|
|
6171
6498
|
}
|
|
6172
|
-
clone() {
|
|
6499
|
+
clone(render = false) {
|
|
6173
6500
|
// Not working For Table
|
|
6174
6501
|
const UI = new this.constructor();
|
|
6175
6502
|
UI.__proto__ = this.__proto__;
|
|
@@ -6177,7 +6504,7 @@ class ZikoUIElement {
|
|
|
6177
6504
|
const items = [...this.items].map(n => n.clone());
|
|
6178
6505
|
UI.append(...items);
|
|
6179
6506
|
} else UI.element = this.element.cloneNode(true);
|
|
6180
|
-
return UI;
|
|
6507
|
+
return UI.render(render);
|
|
6181
6508
|
}
|
|
6182
6509
|
style(styles, {
|
|
6183
6510
|
target = "parent",
|
|
@@ -6353,10 +6680,13 @@ class ZikoUIElement {
|
|
|
6353
6680
|
this.items.forEach(callback);
|
|
6354
6681
|
return this;
|
|
6355
6682
|
}
|
|
6356
|
-
|
|
6683
|
+
where(condition_callback, if_callback, else_callback) {
|
|
6357
6684
|
this.items.filter(condition_callback).forEach(if_callback);
|
|
6358
6685
|
return this;
|
|
6359
6686
|
}
|
|
6687
|
+
filter(condition) {
|
|
6688
|
+
return this.items.filter(condition);
|
|
6689
|
+
}
|
|
6360
6690
|
filterByTextContent(text, exactMatch = false) {
|
|
6361
6691
|
this.items.map(n => n.render());
|
|
6362
6692
|
this.items.filter(n => {
|
|
@@ -6410,6 +6740,41 @@ class ZikoUIElement {
|
|
|
6410
6740
|
this.events.ptr.onOut(...callbacks);
|
|
6411
6741
|
return this;
|
|
6412
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
|
+
}
|
|
6413
6778
|
onKeyDown(...callbacks) {
|
|
6414
6779
|
if (!this.events.key) this.events.key = Key(this);
|
|
6415
6780
|
this.events.key.onDown(...callbacks);
|
|
@@ -6497,12 +6862,12 @@ class ZikoUIElement {
|
|
|
6497
6862
|
return this;
|
|
6498
6863
|
}
|
|
6499
6864
|
on(event_name, ...callbacks) {
|
|
6500
|
-
if (!this.events.custom) this.events.custom =
|
|
6865
|
+
if (!this.events.custom) this.events.custom = customEvent();
|
|
6501
6866
|
this.events.custom.on(event_name, ...callbacks);
|
|
6502
6867
|
return this;
|
|
6503
6868
|
}
|
|
6504
6869
|
emit(event_name, detail = {}) {
|
|
6505
|
-
if (!this.events.custom) this.events.custom =
|
|
6870
|
+
if (!this.events.custom) this.events.custom = customEvent();
|
|
6506
6871
|
this.events.custom.emit(event_name, detail);
|
|
6507
6872
|
return this;
|
|
6508
6873
|
}
|
|
@@ -6535,18 +6900,6 @@ class ZikoUIElement {
|
|
|
6535
6900
|
isVisible: topVisible || bottomVisible || rightVisible || leftVisible
|
|
6536
6901
|
};
|
|
6537
6902
|
}
|
|
6538
|
-
|
|
6539
|
-
// toggleSlide() {}
|
|
6540
|
-
|
|
6541
|
-
// Glassmorphism(background = "rgba(255,255,255,0.1)", blur = "1px") {
|
|
6542
|
-
// this.style({ background: background, backdropFilter: blur });
|
|
6543
|
-
// return this;
|
|
6544
|
-
// }
|
|
6545
|
-
// Neumorphism(r = "50px", bg = "cyan", box = "13px -13px 49px #5d8fac") {
|
|
6546
|
-
// this.style({ borderRadius: r, background: bg, boxShadow: box });
|
|
6547
|
-
// return this;
|
|
6548
|
-
// }
|
|
6549
|
-
|
|
6550
6903
|
setFullScreen(set = true, e) {
|
|
6551
6904
|
if (!this.element.requestFullscreen) {
|
|
6552
6905
|
console.error("Fullscreen API is not supported in this browser.");
|
|
@@ -7308,6 +7661,9 @@ class ZikoUIVideo extends ZikoUIElement {
|
|
|
7308
7661
|
});
|
|
7309
7662
|
this.render();
|
|
7310
7663
|
}
|
|
7664
|
+
get t() {
|
|
7665
|
+
return this.element.currentTime;
|
|
7666
|
+
}
|
|
7311
7667
|
useControls(enabled = true) {
|
|
7312
7668
|
this.element.controls = enabled;
|
|
7313
7669
|
return this;
|
|
@@ -7328,6 +7684,12 @@ class ZikoUIVideo extends ZikoUIElement {
|
|
|
7328
7684
|
this.element.requestPictureInPicture(e);
|
|
7329
7685
|
return this;
|
|
7330
7686
|
}
|
|
7687
|
+
seekTo(time) {
|
|
7688
|
+
this.element.currentTime = time;
|
|
7689
|
+
return this;
|
|
7690
|
+
}
|
|
7691
|
+
onPlay() {}
|
|
7692
|
+
onPause() {}
|
|
7331
7693
|
}
|
|
7332
7694
|
const video = (src, width, height) => new ZikoUIVideo(src, width, height);
|
|
7333
7695
|
|
|
@@ -7336,7 +7698,10 @@ class ZikoUIAudio extends ZikoUIElement {
|
|
|
7336
7698
|
super("audio", "audio");
|
|
7337
7699
|
this.element.setAttribute("src", src);
|
|
7338
7700
|
this.render();
|
|
7339
|
-
this.
|
|
7701
|
+
this.useControls();
|
|
7702
|
+
}
|
|
7703
|
+
get t() {
|
|
7704
|
+
return this.element.currentTime;
|
|
7340
7705
|
}
|
|
7341
7706
|
useControls(enabled = true) {
|
|
7342
7707
|
this.element.controls = enabled;
|
|
@@ -7350,6 +7715,12 @@ class ZikoUIAudio extends ZikoUIElement {
|
|
|
7350
7715
|
this.element.pause();
|
|
7351
7716
|
return this;
|
|
7352
7717
|
}
|
|
7718
|
+
seekTo(time) {
|
|
7719
|
+
this.element.currentTime = time;
|
|
7720
|
+
return this;
|
|
7721
|
+
}
|
|
7722
|
+
onPlay() {}
|
|
7723
|
+
onPause() {}
|
|
7353
7724
|
}
|
|
7354
7725
|
const audio = src => new ZikoUIAudio(src);
|
|
7355
7726
|
|
|
@@ -7380,32 +7751,8 @@ class ZikoUIWebcame extends ZikoUIVideo {
|
|
|
7380
7751
|
}
|
|
7381
7752
|
const inputCamera = () => new ZikoUIWebcame();
|
|
7382
7753
|
|
|
7383
|
-
function set_vertical(direction) {
|
|
7384
|
-
direction == 1 ? this.style({
|
|
7385
|
-
flexDirection: "column"
|
|
7386
|
-
}) : direction == -1 && this.style({
|
|
7387
|
-
flexDirection: "column-reverse"
|
|
7388
|
-
});
|
|
7389
|
-
return this;
|
|
7390
|
-
}
|
|
7391
|
-
function set_horizontal(direction) {
|
|
7392
|
-
direction == 1 ? this.style({
|
|
7393
|
-
flexDirection: "row"
|
|
7394
|
-
}) : direction == -1 && this.style({
|
|
7395
|
-
flexDirection: "row-reverse"
|
|
7396
|
-
});
|
|
7397
|
-
return this;
|
|
7398
|
-
}
|
|
7399
|
-
function map_pos_x(align) {
|
|
7400
|
-
let pos = ["flex-start", "center", "flex-end"];
|
|
7401
|
-
if (typeof align === "number") align = pos[align + 1];
|
|
7402
|
-
return align;
|
|
7403
|
-
}
|
|
7404
|
-
function map_pos_y(align) {
|
|
7405
|
-
return map_pos_x(-align);
|
|
7406
|
-
}
|
|
7407
7754
|
class ZikoUIFlex extends ZikoUIElement {
|
|
7408
|
-
constructor(tag, w = "100%", h = "100%") {
|
|
7755
|
+
constructor(tag = "div", w = "100%", h = "100%") {
|
|
7409
7756
|
super(tag, "Flex");
|
|
7410
7757
|
this.direction = "cols";
|
|
7411
7758
|
if (typeof w == "number") w += "%";
|
|
@@ -7495,6 +7842,30 @@ const Flex = (...ZikoUIElement) => {
|
|
|
7495
7842
|
}
|
|
7496
7843
|
return new ZikoUIFlex(tag).append(...ZikoUIElement);
|
|
7497
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
|
+
}
|
|
7498
7869
|
|
|
7499
7870
|
class ZikoUIGrid extends ZikoUIElement {
|
|
7500
7871
|
constructor(tag = "div", w = "50vw", h = "50vh") {
|
|
@@ -8861,8 +9232,8 @@ class ZikoUISvg extends ZikoUIElement {
|
|
|
8861
9232
|
super();
|
|
8862
9233
|
this.element = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
8863
9234
|
//this.cache={};
|
|
8864
|
-
this.
|
|
8865
|
-
this.
|
|
9235
|
+
this.setAttr("width", w);
|
|
9236
|
+
this.setAttr("height", h);
|
|
8866
9237
|
this.style({
|
|
8867
9238
|
border: "1px black solid"
|
|
8868
9239
|
});
|
|
@@ -8874,7 +9245,7 @@ class ZikoUISvg extends ZikoUIElement {
|
|
|
8874
9245
|
let width = Math.abs(x2 - x1);
|
|
8875
9246
|
let height = Math.abs(y2 - y1);
|
|
8876
9247
|
//this.element.style.transform="scale("+Math.sign(x2-x1)+","+(-Math.sign(y2-y1))+")";
|
|
8877
|
-
this.
|
|
9248
|
+
this.setAttr("viewBox", [x1, y1, width, height].join(" "));
|
|
8878
9249
|
//console.log({width:width,height:height})
|
|
8879
9250
|
return this;
|
|
8880
9251
|
}
|
|
@@ -9456,7 +9827,7 @@ const SPA = (root_UI, routes, patterns) => new ZikoSPA(root_UI, routes, patterns
|
|
|
9456
9827
|
const __init__ = () => document.documentElement.setAttribute("data-engine", "zikojs");
|
|
9457
9828
|
|
|
9458
9829
|
var __Target__ = null;
|
|
9459
|
-
if (document
|
|
9830
|
+
if (globalThis?.document?.body) __Target__ = document.body;
|
|
9460
9831
|
|
|
9461
9832
|
class ZikoSeo {
|
|
9462
9833
|
constructor(app) {
|
|
@@ -9508,6 +9879,9 @@ class ZikoUIApp extends ZikoUIFlex {
|
|
|
9508
9879
|
this.head = null;
|
|
9509
9880
|
this.#init();
|
|
9510
9881
|
this.seo = Seo(this);
|
|
9882
|
+
Object.assign(this.events, {
|
|
9883
|
+
hash: null
|
|
9884
|
+
});
|
|
9511
9885
|
Object.assign(this.cache, {
|
|
9512
9886
|
theme: null,
|
|
9513
9887
|
isRoot: true
|
|
@@ -9529,6 +9903,11 @@ class ZikoUIApp extends ZikoUIFlex {
|
|
|
9529
9903
|
}
|
|
9530
9904
|
prefetch() {}
|
|
9531
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
|
+
}
|
|
9532
9911
|
}
|
|
9533
9912
|
const App = (...UIElement) => new ZikoUIApp().append(...UIElement);
|
|
9534
9913
|
|
|
@@ -9611,7 +9990,6 @@ exports.Themes = Themes;
|
|
|
9611
9990
|
exports.Time = Time;
|
|
9612
9991
|
exports.UI = UI$1;
|
|
9613
9992
|
exports.Utils = Utils;
|
|
9614
|
-
exports.Ziko = Ziko;
|
|
9615
9993
|
exports.ZikoHtml = ZikoHtml;
|
|
9616
9994
|
exports.ZikoUIArticle = ZikoUIArticle;
|
|
9617
9995
|
exports.ZikoUIAside = ZikoUIAside;
|
|
@@ -9674,6 +10052,7 @@ exports.csv2matrix = csv2matrix;
|
|
|
9674
10052
|
exports.csv2object = csv2object;
|
|
9675
10053
|
exports.csv2sql = csv2sql;
|
|
9676
10054
|
exports.datalist = datalist;
|
|
10055
|
+
exports.default = Ziko;
|
|
9677
10056
|
exports.deg2rad = deg2rad;
|
|
9678
10057
|
exports.div = div;
|
|
9679
10058
|
exports.e = e;
|