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/dist/ziko.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Sun Mar 10 2024 11:12:39 GMT+0000 (UTC)
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
@@ -3380,6 +3380,332 @@ class ZikoEventPointer extends ZikoEvent {
3380
3380
  }
3381
3381
  var Pointer = target => new ZikoEventPointer(target);
3382
3382
 
3383
+ class ZikoEventMouse extends ZikoEvent {
3384
+ constructor(target) {
3385
+ super(target);
3386
+ this.event = null;
3387
+ this.dx = 0;
3388
+ this.dy = 0;
3389
+ this.dt = 0;
3390
+ this.mx = 0;
3391
+ this.my = 0;
3392
+ this.mt = 0;
3393
+ this.ux = 0;
3394
+ this.uy = 0;
3395
+ this.ut = 0;
3396
+ this.swippe = {
3397
+ h: null,
3398
+ v: null,
3399
+ delta_x: 0,
3400
+ delta_y: 0
3401
+ };
3402
+ this.isMoving = false;
3403
+ this.isDown = false;
3404
+ this.cache = {
3405
+ prefixe: "mouse",
3406
+ preventDefault: {
3407
+ down: false,
3408
+ move: false,
3409
+ up: false,
3410
+ enter: false,
3411
+ out: false,
3412
+ leave: false,
3413
+ over: false
3414
+ },
3415
+ paused: {
3416
+ down: false,
3417
+ move: false,
3418
+ up: false,
3419
+ enter: false,
3420
+ out: false,
3421
+ leave: false,
3422
+ over: false
3423
+ },
3424
+ stream: {
3425
+ enabled: {
3426
+ down: false,
3427
+ move: false,
3428
+ up: false,
3429
+ enter: false,
3430
+ out: false,
3431
+ leave: false,
3432
+ over: false
3433
+ },
3434
+ clear: {
3435
+ down: false,
3436
+ move: false,
3437
+ up: false,
3438
+ enter: false,
3439
+ out: false,
3440
+ leave: false,
3441
+ over: false
3442
+ },
3443
+ history: {
3444
+ down: [],
3445
+ move: [],
3446
+ up: [],
3447
+ enter: [],
3448
+ out: [],
3449
+ leave: [],
3450
+ over: []
3451
+ }
3452
+ },
3453
+ callbacks: {
3454
+ down: [self => console.log({
3455
+ dx: self.dx,
3456
+ dy: self.dy,
3457
+ down: self.down,
3458
+ move: self.move,
3459
+ t: self.dt
3460
+ })],
3461
+ move: [self => console.log({
3462
+ mx: self.mx,
3463
+ my: self.my,
3464
+ down: self.down,
3465
+ move: self.move,
3466
+ t: self.dt
3467
+ })],
3468
+ up: [self => console.log({
3469
+ ux: self.ux,
3470
+ uy: self.uy,
3471
+ down: self.down,
3472
+ move: self.move,
3473
+ t: self.dt
3474
+ })],
3475
+ enter: [self => console.log({
3476
+ dx: self.dx,
3477
+ dy: self.dy,
3478
+ down: self.down,
3479
+ move: self.move,
3480
+ t: self.dt
3481
+ })],
3482
+ out: [self => console.log({
3483
+ mx: self.mx,
3484
+ my: self.my,
3485
+ down: self.down,
3486
+ move: self.move,
3487
+ t: self.dt
3488
+ })],
3489
+ leave: [self => console.log({
3490
+ ux: self.ux,
3491
+ uy: self.uy,
3492
+ down: self.down,
3493
+ move: self.move,
3494
+ t: self.dt
3495
+ })],
3496
+ over: [self => console.log({
3497
+ ux: self.ux,
3498
+ uy: self.uy,
3499
+ down: self.down,
3500
+ move: self.move,
3501
+ t: self.dt
3502
+ })]
3503
+ }
3504
+ };
3505
+ this.__controller = {
3506
+ down: mousedown_controller.bind(this),
3507
+ move: mousemove_controller.bind(this),
3508
+ up: mouseup_controller.bind(this),
3509
+ enter: mouseenter_controller.bind(this),
3510
+ out: mouseout_controller.bind(this),
3511
+ leave: mouseleave_controller.bind(this),
3512
+ over: mouseover_controller.bind(this)
3513
+ };
3514
+ }
3515
+ onDown(...callbacks) {
3516
+ if (callbacks.length === 0) callbacks = [() => {}];
3517
+ this.__onEvent("down", {
3518
+ down: true,
3519
+ move: false,
3520
+ up: false,
3521
+ enter: false,
3522
+ out: false,
3523
+ leave: false,
3524
+ over: false
3525
+ }, ...callbacks);
3526
+ return this;
3527
+ }
3528
+ onMove(...callbacks) {
3529
+ if (callbacks.length === 0) callbacks = [() => {}];
3530
+ this.__onEvent("move", {
3531
+ down: false,
3532
+ move: true,
3533
+ up: false,
3534
+ enter: false,
3535
+ out: false,
3536
+ leave: false,
3537
+ over: false
3538
+ }, ...callbacks);
3539
+ return this;
3540
+ }
3541
+ onUp(...callbacks) {
3542
+ if (callbacks.length === 0) callbacks = [() => {}];
3543
+ this.__onEvent("up", {
3544
+ down: false,
3545
+ move: false,
3546
+ up: true,
3547
+ enter: false,
3548
+ out: false,
3549
+ leave: false,
3550
+ over: false
3551
+ }, ...callbacks);
3552
+ return this;
3553
+ }
3554
+ onEnter(...callbacks) {
3555
+ if (callbacks.length === 0) callbacks = [() => {}];
3556
+ this.__onEvent("enter", {
3557
+ down: false,
3558
+ move: false,
3559
+ up: false,
3560
+ enter: true,
3561
+ out: false,
3562
+ leave: false,
3563
+ over: false
3564
+ }, ...callbacks);
3565
+ return this;
3566
+ }
3567
+ onOut(...callbacks) {
3568
+ if (callbacks.length === 0) callbacks = [() => {}];
3569
+ this.__onEvent("out", {
3570
+ down: false,
3571
+ move: false,
3572
+ up: false,
3573
+ enter: false,
3574
+ out: true,
3575
+ leave: false,
3576
+ over: false
3577
+ }, ...callbacks);
3578
+ return this;
3579
+ }
3580
+ onLeave(...callbacks) {
3581
+ if (callbacks.length === 0) callbacks = [() => {}];
3582
+ this.__onEvent("leave", {
3583
+ down: false,
3584
+ move: false,
3585
+ up: false,
3586
+ enter: false,
3587
+ out: false,
3588
+ leave: true,
3589
+ over: false
3590
+ }, ...callbacks);
3591
+ return this;
3592
+ }
3593
+ onOver(...callbacks) {
3594
+ if (callbacks.length === 0) callbacks = [() => {}];
3595
+ this.__onEvent("over", {
3596
+ down: false,
3597
+ move: false,
3598
+ up: false,
3599
+ enter: false,
3600
+ out: false,
3601
+ leave: false,
3602
+ over: true
3603
+ }, ...callbacks);
3604
+ return this;
3605
+ }
3606
+ }
3607
+ function mousedown_controller(e) {
3608
+ EVENT_CONTROLLER.call(this, e, "down", () => {
3609
+ this.dx = parseInt(e.offsetX);
3610
+ this.dy = parseInt(e.offsetY);
3611
+ this.isDown = true;
3612
+ }, {
3613
+ x: this.dx,
3614
+ y: this.dy,
3615
+ t: Date.now() - this.cache.stream.t0
3616
+ });
3617
+ }
3618
+ function mousemove_controller(e) {
3619
+ EVENT_CONTROLLER.call(this, e, "move", () => {
3620
+ this.mx = parseInt(e.offsetX);
3621
+ this.my = parseInt(e.offsetY);
3622
+ this.isMoving = true;
3623
+ }, {
3624
+ x: this.mx,
3625
+ y: this.my,
3626
+ t: Date.now() - this.cache.stream.t0
3627
+ });
3628
+ }
3629
+ function mouseup_controller(e) {
3630
+ EVENT_CONTROLLER.call(this, e, "up", () => {
3631
+ this.ux = parseInt(e.offsetX);
3632
+ this.uy = parseInt(e.offsetY);
3633
+ this.isDown = false;
3634
+ const dx = this.dx;
3635
+ const dy = this.dy;
3636
+ const ux = this.ux;
3637
+ const uy = this.uy;
3638
+ const delta_x = (ux - dx) / this.target.Width;
3639
+ const delta_y = (dy - uy) / this.target.Height;
3640
+ const HORIZONTAL_SWIPPE = delta_x < 0 ? "left" : delta_x > 0 ? "right" : "none";
3641
+ const VERTICAL_SWIPPE = delta_y < 0 ? "bottom" : delta_y > 0 ? "top" : "none";
3642
+ this.swippe = {
3643
+ h: HORIZONTAL_SWIPPE,
3644
+ v: VERTICAL_SWIPPE,
3645
+ delta_x,
3646
+ delta_y
3647
+ };
3648
+ }, {
3649
+ x: this.ux,
3650
+ y: this.uy,
3651
+ t: Date.now() - this.cache.stream.t0
3652
+ });
3653
+ }
3654
+ function mouseenter_controller(e) {
3655
+ EVENT_CONTROLLER.call(this, e, "enter", null, null);
3656
+ }
3657
+ function mouseleave_controller(e) {
3658
+ EVENT_CONTROLLER.call(this, e, "leave", null, null);
3659
+ }
3660
+ function mouseout_controller(e) {
3661
+ EVENT_CONTROLLER.call(this, e, "out", null, null);
3662
+ }
3663
+ function mouseover_controller(e) {
3664
+ EVENT_CONTROLLER.call(this, e, "out", null, null);
3665
+ }
3666
+ const Mouse = target => new ZikoEventMouse(target);
3667
+
3668
+ function wheel_controller(e) {
3669
+ EVENT_CONTROLLER.call(this, e, "wheel", null, null);
3670
+ }
3671
+ class ZikoEventWheel extends ZikoEvent {
3672
+ constructor(target) {
3673
+ super(target);
3674
+ this.event = null;
3675
+ this.cache = {
3676
+ prefixe: "",
3677
+ preventDefault: {
3678
+ wheel: false
3679
+ },
3680
+ paused: {
3681
+ wheel: false
3682
+ },
3683
+ stream: {
3684
+ enabled: {
3685
+ wheel: false
3686
+ },
3687
+ clear: {
3688
+ wheel: false
3689
+ },
3690
+ history: {
3691
+ wheel: []
3692
+ }
3693
+ },
3694
+ callbacks: {
3695
+ click: []
3696
+ }
3697
+ };
3698
+ this.__controller = {
3699
+ wheel: wheel_controller.bind(this)
3700
+ };
3701
+ }
3702
+ onWheel(...callbacks) {
3703
+ this.__onEvent("wheel", {}, ...callbacks);
3704
+ return this;
3705
+ }
3706
+ }
3707
+ const Wheel = Target => new ZikoEventWheel(Target);
3708
+
3383
3709
  function keydown_controller(e) {
3384
3710
  EVENT_CONTROLLER.call(this, e, "down", () => this.kd = e.key, {
3385
3711
  key: e.key,
@@ -3870,53 +4196,53 @@ class ZikoEventInput extends ZikoEvent {
3870
4196
  }
3871
4197
  const Input$1 = Target => new ZikoEventInput(Target);
3872
4198
 
3873
- const custom_event_controller = event_name => function (e) {
3874
- EVENT_CONTROLLER.call(this, e, event_name, null, null);
3875
- };
3876
- class ZikoCustomEvent extends ZikoEvent {
4199
+ function hashchange_controller(e) {
4200
+ EVENT_CONTROLLER.call(this, e, "hashchange", null, null);
4201
+ }
4202
+ class ZikoEventHash extends ZikoEvent {
3877
4203
  constructor(target) {
3878
4204
  super(target);
3879
4205
  this.event = null;
3880
4206
  this.cache = {
3881
4207
  prefixe: "",
3882
- preventDefault: {},
3883
- paused: {},
4208
+ preventDefault: {
4209
+ hashchange: false
4210
+ },
4211
+ paused: {
4212
+ hashchange: false
4213
+ },
3884
4214
  stream: {
3885
- enabled: {},
3886
- clear: {},
3887
- history: {}
4215
+ enabled: {
4216
+ hashchange: false
4217
+ },
4218
+ clear: {
4219
+ hashchange: false
4220
+ },
4221
+ history: {
4222
+ hashchange: []
4223
+ }
3888
4224
  },
3889
- callbacks: {}
4225
+ callbacks: {
4226
+ hashchange: []
4227
+ }
4228
+ };
4229
+ this.__controller = {
4230
+ hashchange: hashchange_controller.bind(this)
3890
4231
  };
3891
- this.__controller = {};
3892
- }
3893
- #init(event_name) {
3894
- this.cache.preventDefault[event_name] = false;
3895
- this.cache.paused[event_name] = false;
3896
- this.cache.stream.enabled = false;
3897
- this.cache.stream.clear = false;
3898
- this.cache.stream.history = [];
3899
- this.cache.callbacks[event_name] = [];
3900
- this.__controller[event_name] = custom_event_controller(event_name).bind(this);
3901
- return this;
3902
- }
3903
- on(event_name, ...callbacks) {
3904
- if (!this.__controller[event_name]) this.#init(event_name);
3905
- this.__onEvent(event_name, {}, ...callbacks);
3906
- return this;
3907
4232
  }
3908
- emit(event_name, detail = {}) {
3909
- if (!this.__controller[event_name]) this.#init(event_name);
3910
- this.detail = detail;
3911
- const event = new Event(event_name);
3912
- this.targetElement.dispatchEvent(event);
4233
+ onChange(...callbacks) {
4234
+ this.__onEvent("hashchange", {}, ...callbacks);
3913
4235
  return this;
3914
4236
  }
3915
4237
  }
3916
- const CustomEvent = Target => new ZikoCustomEvent(Target);
4238
+ const HashEvent = Target => new ZikoEventHash(Target);
4239
+
4240
+ const customEvent = Target => new customEvent();
3917
4241
 
3918
4242
  const Events = {
3919
4243
  Pointer,
4244
+ Mouse,
4245
+ Wheel,
3920
4246
  Key,
3921
4247
  Drag,
3922
4248
  Drop,
@@ -3924,6 +4250,7 @@ const Events = {
3924
4250
  Clipboard,
3925
4251
  Focus,
3926
4252
  Input: Input$1,
4253
+ HashEvent,
3927
4254
  CustomEvent,
3928
4255
  ExtractAll: function () {
3929
4256
  const keys = Object.keys(this);
@@ -6111,18 +6438,16 @@ class ZikoUIElement {
6111
6438
  isRoot: false,
6112
6439
  isHidden: false,
6113
6440
  isFrozzen: false,
6114
- // transformMatrix:matrix([
6115
- // [0,0,0],
6116
- // [0,0,0],
6117
- // [1,1,0]
6118
- // ]),
6119
6441
  style: ZikoStyle({}),
6120
6442
  attributes: {},
6121
- filters: {}
6443
+ filters: {},
6444
+ temp: {}
6122
6445
  };
6123
6446
  this.items = [];
6124
6447
  this.events = {
6125
6448
  ptr: null,
6449
+ mouse: null,
6450
+ Wheel: null,
6126
6451
  key: null,
6127
6452
  drag: null,
6128
6453
  drop: null,
@@ -6167,7 +6492,7 @@ class ZikoUIElement {
6167
6492
  root = root.parent;
6168
6493
  }
6169
6494
  }
6170
- clone() {
6495
+ clone(render = false) {
6171
6496
  // Not working For Table
6172
6497
  const UI = new this.constructor();
6173
6498
  UI.__proto__ = this.__proto__;
@@ -6175,7 +6500,7 @@ class ZikoUIElement {
6175
6500
  const items = [...this.items].map(n => n.clone());
6176
6501
  UI.append(...items);
6177
6502
  } else UI.element = this.element.cloneNode(true);
6178
- return UI;
6503
+ return UI.render(render);
6179
6504
  }
6180
6505
  style(styles, {
6181
6506
  target = "parent",
@@ -6351,10 +6676,13 @@ class ZikoUIElement {
6351
6676
  this.items.forEach(callback);
6352
6677
  return this;
6353
6678
  }
6354
- filter(condition_callback, if_callback, else_callback) {
6679
+ where(condition_callback, if_callback, else_callback) {
6355
6680
  this.items.filter(condition_callback).forEach(if_callback);
6356
6681
  return this;
6357
6682
  }
6683
+ filter(condition) {
6684
+ return this.items.filter(condition);
6685
+ }
6358
6686
  filterByTextContent(text, exactMatch = false) {
6359
6687
  this.items.map(n => n.render());
6360
6688
  this.items.filter(n => {
@@ -6408,6 +6736,41 @@ class ZikoUIElement {
6408
6736
  this.events.ptr.onOut(...callbacks);
6409
6737
  return this;
6410
6738
  }
6739
+ onMouseMove(...callbacks) {
6740
+ if (!this.events.mouse) this.events.mouse = Mouse(this);
6741
+ this.events.mouse.onMove(...callbacks);
6742
+ return this;
6743
+ }
6744
+ onMouseDown(...callbacks) {
6745
+ if (!this.events.mouse) this.events.mouse = Mouse(this);
6746
+ this.events.mouse.onDown(...callbacks);
6747
+ return this;
6748
+ }
6749
+ onMouseUp(...callbacks) {
6750
+ if (!this.events.mouse) this.events.mouse = Mouse(this);
6751
+ this.events.mouse.onUp(...callbacks);
6752
+ return this;
6753
+ }
6754
+ onMouseEnter(...callbacks) {
6755
+ if (!this.events.mouse) this.events.mouse = Mouse(this);
6756
+ this.events.mouse.onEnter(...callbacks);
6757
+ return this;
6758
+ }
6759
+ onMouseLeave(...callbacks) {
6760
+ if (!this.events.mouse) this.events.mouse = Mouse(this);
6761
+ this.events.mouse.onLeave(...callbacks);
6762
+ return this;
6763
+ }
6764
+ onMouseOut(...callbacks) {
6765
+ if (!this.events.mouse) this.events.mouse = Mouse(this);
6766
+ this.events.mouse.onOut(...callbacks);
6767
+ return this;
6768
+ }
6769
+ onWheel(...callbacks) {
6770
+ if (!this.events.wheel) this.events.wheel = Wheel(this);
6771
+ this.events.wheel.onWheel(...callbacks);
6772
+ return this;
6773
+ }
6411
6774
  onKeyDown(...callbacks) {
6412
6775
  if (!this.events.key) this.events.key = Key(this);
6413
6776
  this.events.key.onDown(...callbacks);
@@ -6495,12 +6858,12 @@ class ZikoUIElement {
6495
6858
  return this;
6496
6859
  }
6497
6860
  on(event_name, ...callbacks) {
6498
- if (!this.events.custom) this.events.custom = CustomEvent(this);
6861
+ if (!this.events.custom) this.events.custom = customEvent();
6499
6862
  this.events.custom.on(event_name, ...callbacks);
6500
6863
  return this;
6501
6864
  }
6502
6865
  emit(event_name, detail = {}) {
6503
- if (!this.events.custom) this.events.custom = CustomEvent(this);
6866
+ if (!this.events.custom) this.events.custom = customEvent();
6504
6867
  this.events.custom.emit(event_name, detail);
6505
6868
  return this;
6506
6869
  }
@@ -6533,18 +6896,6 @@ class ZikoUIElement {
6533
6896
  isVisible: topVisible || bottomVisible || rightVisible || leftVisible
6534
6897
  };
6535
6898
  }
6536
-
6537
- // toggleSlide() {}
6538
-
6539
- // Glassmorphism(background = "rgba(255,255,255,0.1)", blur = "1px") {
6540
- // this.style({ background: background, backdropFilter: blur });
6541
- // return this;
6542
- // }
6543
- // Neumorphism(r = "50px", bg = "cyan", box = "13px -13px 49px #5d8fac") {
6544
- // this.style({ borderRadius: r, background: bg, boxShadow: box });
6545
- // return this;
6546
- // }
6547
-
6548
6899
  setFullScreen(set = true, e) {
6549
6900
  if (!this.element.requestFullscreen) {
6550
6901
  console.error("Fullscreen API is not supported in this browser.");
@@ -7306,6 +7657,9 @@ class ZikoUIVideo extends ZikoUIElement {
7306
7657
  });
7307
7658
  this.render();
7308
7659
  }
7660
+ get t() {
7661
+ return this.element.currentTime;
7662
+ }
7309
7663
  useControls(enabled = true) {
7310
7664
  this.element.controls = enabled;
7311
7665
  return this;
@@ -7326,6 +7680,12 @@ class ZikoUIVideo extends ZikoUIElement {
7326
7680
  this.element.requestPictureInPicture(e);
7327
7681
  return this;
7328
7682
  }
7683
+ seekTo(time) {
7684
+ this.element.currentTime = time;
7685
+ return this;
7686
+ }
7687
+ onPlay() {}
7688
+ onPause() {}
7329
7689
  }
7330
7690
  const video = (src, width, height) => new ZikoUIVideo(src, width, height);
7331
7691
 
@@ -7334,7 +7694,10 @@ class ZikoUIAudio extends ZikoUIElement {
7334
7694
  super("audio", "audio");
7335
7695
  this.element.setAttribute("src", src);
7336
7696
  this.render();
7337
- this.controls();
7697
+ this.useControls();
7698
+ }
7699
+ get t() {
7700
+ return this.element.currentTime;
7338
7701
  }
7339
7702
  useControls(enabled = true) {
7340
7703
  this.element.controls = enabled;
@@ -7348,6 +7711,12 @@ class ZikoUIAudio extends ZikoUIElement {
7348
7711
  this.element.pause();
7349
7712
  return this;
7350
7713
  }
7714
+ seekTo(time) {
7715
+ this.element.currentTime = time;
7716
+ return this;
7717
+ }
7718
+ onPlay() {}
7719
+ onPause() {}
7351
7720
  }
7352
7721
  const audio = src => new ZikoUIAudio(src);
7353
7722
 
@@ -7378,32 +7747,8 @@ class ZikoUIWebcame extends ZikoUIVideo {
7378
7747
  }
7379
7748
  const inputCamera = () => new ZikoUIWebcame();
7380
7749
 
7381
- function set_vertical(direction) {
7382
- direction == 1 ? this.style({
7383
- flexDirection: "column"
7384
- }) : direction == -1 && this.style({
7385
- flexDirection: "column-reverse"
7386
- });
7387
- return this;
7388
- }
7389
- function set_horizontal(direction) {
7390
- direction == 1 ? this.style({
7391
- flexDirection: "row"
7392
- }) : direction == -1 && this.style({
7393
- flexDirection: "row-reverse"
7394
- });
7395
- return this;
7396
- }
7397
- function map_pos_x(align) {
7398
- let pos = ["flex-start", "center", "flex-end"];
7399
- if (typeof align === "number") align = pos[align + 1];
7400
- return align;
7401
- }
7402
- function map_pos_y(align) {
7403
- return map_pos_x(-align);
7404
- }
7405
7750
  class ZikoUIFlex extends ZikoUIElement {
7406
- constructor(tag, w = "100%", h = "100%") {
7751
+ constructor(tag = "div", w = "100%", h = "100%") {
7407
7752
  super(tag, "Flex");
7408
7753
  this.direction = "cols";
7409
7754
  if (typeof w == "number") w += "%";
@@ -7493,6 +7838,30 @@ const Flex = (...ZikoUIElement) => {
7493
7838
  }
7494
7839
  return new ZikoUIFlex(tag).append(...ZikoUIElement);
7495
7840
  };
7841
+ function set_vertical(direction) {
7842
+ direction == 1 ? this.style({
7843
+ flexDirection: "column"
7844
+ }) : direction == -1 && this.style({
7845
+ flexDirection: "column-reverse"
7846
+ });
7847
+ return this;
7848
+ }
7849
+ function set_horizontal(direction) {
7850
+ direction == 1 ? this.style({
7851
+ flexDirection: "row"
7852
+ }) : direction == -1 && this.style({
7853
+ flexDirection: "row-reverse"
7854
+ });
7855
+ return this;
7856
+ }
7857
+ function map_pos_x(align) {
7858
+ let pos = ["flex-start", "center", "flex-end"];
7859
+ if (typeof align === "number") align = pos[align + 1];
7860
+ return align;
7861
+ }
7862
+ function map_pos_y(align) {
7863
+ return map_pos_x(-align);
7864
+ }
7496
7865
 
7497
7866
  class ZikoUIGrid extends ZikoUIElement {
7498
7867
  constructor(tag = "div", w = "50vw", h = "50vh") {
@@ -9506,6 +9875,9 @@ class ZikoUIApp extends ZikoUIFlex {
9506
9875
  this.head = null;
9507
9876
  this.#init();
9508
9877
  this.seo = Seo(this);
9878
+ Object.assign(this.events, {
9879
+ hash: null
9880
+ });
9509
9881
  Object.assign(this.cache, {
9510
9882
  theme: null,
9511
9883
  isRoot: true
@@ -9527,6 +9899,11 @@ class ZikoUIApp extends ZikoUIFlex {
9527
9899
  }
9528
9900
  prefetch() {}
9529
9901
  description() {}
9902
+ onHashChange(...callbacks) {
9903
+ if (!this.events.hash) this.events.hash = HashEvent(this);
9904
+ this.events.hash.onChange(...callbacks);
9905
+ return this;
9906
+ }
9530
9907
  }
9531
9908
  const App = (...UIElement) => new ZikoUIApp().append(...UIElement);
9532
9909