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/dist/ziko.js CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Tue Feb 27 2024 20:39:54 GMT+0100 (UTC+01:00)
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
@@ -3386,6 +3386,332 @@
3386
3386
  }
3387
3387
  var Pointer = target => new ZikoEventPointer(target);
3388
3388
 
3389
+ class ZikoEventMouse extends ZikoEvent {
3390
+ constructor(target) {
3391
+ super(target);
3392
+ this.event = null;
3393
+ this.dx = 0;
3394
+ this.dy = 0;
3395
+ this.dt = 0;
3396
+ this.mx = 0;
3397
+ this.my = 0;
3398
+ this.mt = 0;
3399
+ this.ux = 0;
3400
+ this.uy = 0;
3401
+ this.ut = 0;
3402
+ this.swippe = {
3403
+ h: null,
3404
+ v: null,
3405
+ delta_x: 0,
3406
+ delta_y: 0
3407
+ };
3408
+ this.isMoving = false;
3409
+ this.isDown = false;
3410
+ this.cache = {
3411
+ prefixe: "mouse",
3412
+ preventDefault: {
3413
+ down: false,
3414
+ move: false,
3415
+ up: false,
3416
+ enter: false,
3417
+ out: false,
3418
+ leave: false,
3419
+ over: false
3420
+ },
3421
+ paused: {
3422
+ down: false,
3423
+ move: false,
3424
+ up: false,
3425
+ enter: false,
3426
+ out: false,
3427
+ leave: false,
3428
+ over: false
3429
+ },
3430
+ stream: {
3431
+ enabled: {
3432
+ down: false,
3433
+ move: false,
3434
+ up: false,
3435
+ enter: false,
3436
+ out: false,
3437
+ leave: false,
3438
+ over: false
3439
+ },
3440
+ clear: {
3441
+ down: false,
3442
+ move: false,
3443
+ up: false,
3444
+ enter: false,
3445
+ out: false,
3446
+ leave: false,
3447
+ over: false
3448
+ },
3449
+ history: {
3450
+ down: [],
3451
+ move: [],
3452
+ up: [],
3453
+ enter: [],
3454
+ out: [],
3455
+ leave: [],
3456
+ over: []
3457
+ }
3458
+ },
3459
+ callbacks: {
3460
+ down: [self => console.log({
3461
+ dx: self.dx,
3462
+ dy: self.dy,
3463
+ down: self.down,
3464
+ move: self.move,
3465
+ t: self.dt
3466
+ })],
3467
+ move: [self => console.log({
3468
+ mx: self.mx,
3469
+ my: self.my,
3470
+ down: self.down,
3471
+ move: self.move,
3472
+ t: self.dt
3473
+ })],
3474
+ up: [self => console.log({
3475
+ ux: self.ux,
3476
+ uy: self.uy,
3477
+ down: self.down,
3478
+ move: self.move,
3479
+ t: self.dt
3480
+ })],
3481
+ enter: [self => console.log({
3482
+ dx: self.dx,
3483
+ dy: self.dy,
3484
+ down: self.down,
3485
+ move: self.move,
3486
+ t: self.dt
3487
+ })],
3488
+ out: [self => console.log({
3489
+ mx: self.mx,
3490
+ my: self.my,
3491
+ down: self.down,
3492
+ move: self.move,
3493
+ t: self.dt
3494
+ })],
3495
+ leave: [self => console.log({
3496
+ ux: self.ux,
3497
+ uy: self.uy,
3498
+ down: self.down,
3499
+ move: self.move,
3500
+ t: self.dt
3501
+ })],
3502
+ over: [self => console.log({
3503
+ ux: self.ux,
3504
+ uy: self.uy,
3505
+ down: self.down,
3506
+ move: self.move,
3507
+ t: self.dt
3508
+ })]
3509
+ }
3510
+ };
3511
+ this.__controller = {
3512
+ down: mousedown_controller.bind(this),
3513
+ move: mousemove_controller.bind(this),
3514
+ up: mouseup_controller.bind(this),
3515
+ enter: mouseenter_controller.bind(this),
3516
+ out: mouseout_controller.bind(this),
3517
+ leave: mouseleave_controller.bind(this),
3518
+ over: mouseover_controller.bind(this)
3519
+ };
3520
+ }
3521
+ onDown(...callbacks) {
3522
+ if (callbacks.length === 0) callbacks = [() => {}];
3523
+ this.__onEvent("down", {
3524
+ down: true,
3525
+ move: false,
3526
+ up: false,
3527
+ enter: false,
3528
+ out: false,
3529
+ leave: false,
3530
+ over: false
3531
+ }, ...callbacks);
3532
+ return this;
3533
+ }
3534
+ onMove(...callbacks) {
3535
+ if (callbacks.length === 0) callbacks = [() => {}];
3536
+ this.__onEvent("move", {
3537
+ down: false,
3538
+ move: true,
3539
+ up: false,
3540
+ enter: false,
3541
+ out: false,
3542
+ leave: false,
3543
+ over: false
3544
+ }, ...callbacks);
3545
+ return this;
3546
+ }
3547
+ onUp(...callbacks) {
3548
+ if (callbacks.length === 0) callbacks = [() => {}];
3549
+ this.__onEvent("up", {
3550
+ down: false,
3551
+ move: false,
3552
+ up: true,
3553
+ enter: false,
3554
+ out: false,
3555
+ leave: false,
3556
+ over: false
3557
+ }, ...callbacks);
3558
+ return this;
3559
+ }
3560
+ onEnter(...callbacks) {
3561
+ if (callbacks.length === 0) callbacks = [() => {}];
3562
+ this.__onEvent("enter", {
3563
+ down: false,
3564
+ move: false,
3565
+ up: false,
3566
+ enter: true,
3567
+ out: false,
3568
+ leave: false,
3569
+ over: false
3570
+ }, ...callbacks);
3571
+ return this;
3572
+ }
3573
+ onOut(...callbacks) {
3574
+ if (callbacks.length === 0) callbacks = [() => {}];
3575
+ this.__onEvent("out", {
3576
+ down: false,
3577
+ move: false,
3578
+ up: false,
3579
+ enter: false,
3580
+ out: true,
3581
+ leave: false,
3582
+ over: false
3583
+ }, ...callbacks);
3584
+ return this;
3585
+ }
3586
+ onLeave(...callbacks) {
3587
+ if (callbacks.length === 0) callbacks = [() => {}];
3588
+ this.__onEvent("leave", {
3589
+ down: false,
3590
+ move: false,
3591
+ up: false,
3592
+ enter: false,
3593
+ out: false,
3594
+ leave: true,
3595
+ over: false
3596
+ }, ...callbacks);
3597
+ return this;
3598
+ }
3599
+ onOver(...callbacks) {
3600
+ if (callbacks.length === 0) callbacks = [() => {}];
3601
+ this.__onEvent("over", {
3602
+ down: false,
3603
+ move: false,
3604
+ up: false,
3605
+ enter: false,
3606
+ out: false,
3607
+ leave: false,
3608
+ over: true
3609
+ }, ...callbacks);
3610
+ return this;
3611
+ }
3612
+ }
3613
+ function mousedown_controller(e) {
3614
+ EVENT_CONTROLLER.call(this, e, "down", () => {
3615
+ this.dx = parseInt(e.offsetX);
3616
+ this.dy = parseInt(e.offsetY);
3617
+ this.isDown = true;
3618
+ }, {
3619
+ x: this.dx,
3620
+ y: this.dy,
3621
+ t: Date.now() - this.cache.stream.t0
3622
+ });
3623
+ }
3624
+ function mousemove_controller(e) {
3625
+ EVENT_CONTROLLER.call(this, e, "move", () => {
3626
+ this.mx = parseInt(e.offsetX);
3627
+ this.my = parseInt(e.offsetY);
3628
+ this.isMoving = true;
3629
+ }, {
3630
+ x: this.mx,
3631
+ y: this.my,
3632
+ t: Date.now() - this.cache.stream.t0
3633
+ });
3634
+ }
3635
+ function mouseup_controller(e) {
3636
+ EVENT_CONTROLLER.call(this, e, "up", () => {
3637
+ this.ux = parseInt(e.offsetX);
3638
+ this.uy = parseInt(e.offsetY);
3639
+ this.isDown = false;
3640
+ const dx = this.dx;
3641
+ const dy = this.dy;
3642
+ const ux = this.ux;
3643
+ const uy = this.uy;
3644
+ const delta_x = (ux - dx) / this.target.Width;
3645
+ const delta_y = (dy - uy) / this.target.Height;
3646
+ const HORIZONTAL_SWIPPE = delta_x < 0 ? "left" : delta_x > 0 ? "right" : "none";
3647
+ const VERTICAL_SWIPPE = delta_y < 0 ? "bottom" : delta_y > 0 ? "top" : "none";
3648
+ this.swippe = {
3649
+ h: HORIZONTAL_SWIPPE,
3650
+ v: VERTICAL_SWIPPE,
3651
+ delta_x,
3652
+ delta_y
3653
+ };
3654
+ }, {
3655
+ x: this.ux,
3656
+ y: this.uy,
3657
+ t: Date.now() - this.cache.stream.t0
3658
+ });
3659
+ }
3660
+ function mouseenter_controller(e) {
3661
+ EVENT_CONTROLLER.call(this, e, "enter", null, null);
3662
+ }
3663
+ function mouseleave_controller(e) {
3664
+ EVENT_CONTROLLER.call(this, e, "leave", null, null);
3665
+ }
3666
+ function mouseout_controller(e) {
3667
+ EVENT_CONTROLLER.call(this, e, "out", null, null);
3668
+ }
3669
+ function mouseover_controller(e) {
3670
+ EVENT_CONTROLLER.call(this, e, "out", null, null);
3671
+ }
3672
+ const Mouse = target => new ZikoEventMouse(target);
3673
+
3674
+ function wheel_controller(e) {
3675
+ EVENT_CONTROLLER.call(this, e, "wheel", null, null);
3676
+ }
3677
+ class ZikoEventWheel extends ZikoEvent {
3678
+ constructor(target) {
3679
+ super(target);
3680
+ this.event = null;
3681
+ this.cache = {
3682
+ prefixe: "",
3683
+ preventDefault: {
3684
+ wheel: false
3685
+ },
3686
+ paused: {
3687
+ wheel: false
3688
+ },
3689
+ stream: {
3690
+ enabled: {
3691
+ wheel: false
3692
+ },
3693
+ clear: {
3694
+ wheel: false
3695
+ },
3696
+ history: {
3697
+ wheel: []
3698
+ }
3699
+ },
3700
+ callbacks: {
3701
+ click: []
3702
+ }
3703
+ };
3704
+ this.__controller = {
3705
+ wheel: wheel_controller.bind(this)
3706
+ };
3707
+ }
3708
+ onWheel(...callbacks) {
3709
+ this.__onEvent("wheel", {}, ...callbacks);
3710
+ return this;
3711
+ }
3712
+ }
3713
+ const Wheel = Target => new ZikoEventWheel(Target);
3714
+
3389
3715
  function keydown_controller(e) {
3390
3716
  EVENT_CONTROLLER.call(this, e, "down", () => this.kd = e.key, {
3391
3717
  key: e.key,
@@ -3876,53 +4202,53 @@
3876
4202
  }
3877
4203
  const Input$1 = Target => new ZikoEventInput(Target);
3878
4204
 
3879
- const custom_event_controller = event_name => function (e) {
3880
- EVENT_CONTROLLER.call(this, e, event_name, null, null);
3881
- };
3882
- class ZikoCustomEvent extends ZikoEvent {
4205
+ function hashchange_controller(e) {
4206
+ EVENT_CONTROLLER.call(this, e, "hashchange", null, null);
4207
+ }
4208
+ class ZikoEventHash extends ZikoEvent {
3883
4209
  constructor(target) {
3884
4210
  super(target);
3885
4211
  this.event = null;
3886
4212
  this.cache = {
3887
4213
  prefixe: "",
3888
- preventDefault: {},
3889
- paused: {},
4214
+ preventDefault: {
4215
+ hashchange: false
4216
+ },
4217
+ paused: {
4218
+ hashchange: false
4219
+ },
3890
4220
  stream: {
3891
- enabled: {},
3892
- clear: {},
3893
- history: {}
4221
+ enabled: {
4222
+ hashchange: false
4223
+ },
4224
+ clear: {
4225
+ hashchange: false
4226
+ },
4227
+ history: {
4228
+ hashchange: []
4229
+ }
3894
4230
  },
3895
- callbacks: {}
4231
+ callbacks: {
4232
+ hashchange: []
4233
+ }
4234
+ };
4235
+ this.__controller = {
4236
+ hashchange: hashchange_controller.bind(this)
3896
4237
  };
3897
- this.__controller = {};
3898
- }
3899
- #init(event_name) {
3900
- this.cache.preventDefault[event_name] = false;
3901
- this.cache.paused[event_name] = false;
3902
- this.cache.stream.enabled = false;
3903
- this.cache.stream.clear = false;
3904
- this.cache.stream.history = [];
3905
- this.cache.callbacks[event_name] = [];
3906
- this.__controller[event_name] = custom_event_controller(event_name).bind(this);
3907
- return this;
3908
- }
3909
- on(event_name, ...callbacks) {
3910
- if (!this.__controller[event_name]) this.#init(event_name);
3911
- this.__onEvent(event_name, {}, ...callbacks);
3912
- return this;
3913
4238
  }
3914
- emit(event_name, detail = {}) {
3915
- if (!this.__controller[event_name]) this.#init(event_name);
3916
- this.detail = detail;
3917
- const event = new Event(event_name);
3918
- this.targetElement.dispatchEvent(event);
4239
+ onChange(...callbacks) {
4240
+ this.__onEvent("hashchange", {}, ...callbacks);
3919
4241
  return this;
3920
4242
  }
3921
4243
  }
3922
- const CustomEvent = Target => new ZikoCustomEvent(Target);
4244
+ const HashEvent = Target => new ZikoEventHash(Target);
4245
+
4246
+ const customEvent = Target => new customEvent();
3923
4247
 
3924
4248
  const Events = {
3925
4249
  Pointer,
4250
+ Mouse,
4251
+ Wheel,
3926
4252
  Key,
3927
4253
  Drag,
3928
4254
  Drop,
@@ -3930,6 +4256,7 @@
3930
4256
  Clipboard,
3931
4257
  Focus,
3932
4258
  Input: Input$1,
4259
+ HashEvent,
3933
4260
  CustomEvent,
3934
4261
  ExtractAll: function () {
3935
4262
  const keys = Object.keys(this);
@@ -6117,18 +6444,16 @@
6117
6444
  isRoot: false,
6118
6445
  isHidden: false,
6119
6446
  isFrozzen: false,
6120
- // transformMatrix:matrix([
6121
- // [0,0,0],
6122
- // [0,0,0],
6123
- // [1,1,0]
6124
- // ]),
6125
6447
  style: ZikoStyle({}),
6126
6448
  attributes: {},
6127
- filters: {}
6449
+ filters: {},
6450
+ temp: {}
6128
6451
  };
6129
6452
  this.items = [];
6130
6453
  this.events = {
6131
6454
  ptr: null,
6455
+ mouse: null,
6456
+ Wheel: null,
6132
6457
  key: null,
6133
6458
  drag: null,
6134
6459
  drop: null,
@@ -6173,7 +6498,7 @@
6173
6498
  root = root.parent;
6174
6499
  }
6175
6500
  }
6176
- clone() {
6501
+ clone(render = false) {
6177
6502
  // Not working For Table
6178
6503
  const UI = new this.constructor();
6179
6504
  UI.__proto__ = this.__proto__;
@@ -6181,7 +6506,7 @@
6181
6506
  const items = [...this.items].map(n => n.clone());
6182
6507
  UI.append(...items);
6183
6508
  } else UI.element = this.element.cloneNode(true);
6184
- return UI;
6509
+ return UI.render(render);
6185
6510
  }
6186
6511
  style(styles, {
6187
6512
  target = "parent",
@@ -6357,10 +6682,13 @@
6357
6682
  this.items.forEach(callback);
6358
6683
  return this;
6359
6684
  }
6360
- filter(condition_callback, if_callback, else_callback) {
6685
+ where(condition_callback, if_callback, else_callback) {
6361
6686
  this.items.filter(condition_callback).forEach(if_callback);
6362
6687
  return this;
6363
6688
  }
6689
+ filter(condition) {
6690
+ return this.items.filter(condition);
6691
+ }
6364
6692
  filterByTextContent(text, exactMatch = false) {
6365
6693
  this.items.map(n => n.render());
6366
6694
  this.items.filter(n => {
@@ -6414,6 +6742,41 @@
6414
6742
  this.events.ptr.onOut(...callbacks);
6415
6743
  return this;
6416
6744
  }
6745
+ onMouseMove(...callbacks) {
6746
+ if (!this.events.mouse) this.events.mouse = Mouse(this);
6747
+ this.events.mouse.onMove(...callbacks);
6748
+ return this;
6749
+ }
6750
+ onMouseDown(...callbacks) {
6751
+ if (!this.events.mouse) this.events.mouse = Mouse(this);
6752
+ this.events.mouse.onDown(...callbacks);
6753
+ return this;
6754
+ }
6755
+ onMouseUp(...callbacks) {
6756
+ if (!this.events.mouse) this.events.mouse = Mouse(this);
6757
+ this.events.mouse.onUp(...callbacks);
6758
+ return this;
6759
+ }
6760
+ onMouseEnter(...callbacks) {
6761
+ if (!this.events.mouse) this.events.mouse = Mouse(this);
6762
+ this.events.mouse.onEnter(...callbacks);
6763
+ return this;
6764
+ }
6765
+ onMouseLeave(...callbacks) {
6766
+ if (!this.events.mouse) this.events.mouse = Mouse(this);
6767
+ this.events.mouse.onLeave(...callbacks);
6768
+ return this;
6769
+ }
6770
+ onMouseOut(...callbacks) {
6771
+ if (!this.events.mouse) this.events.mouse = Mouse(this);
6772
+ this.events.mouse.onOut(...callbacks);
6773
+ return this;
6774
+ }
6775
+ onWheel(...callbacks) {
6776
+ if (!this.events.wheel) this.events.wheel = Wheel(this);
6777
+ this.events.wheel.onWheel(...callbacks);
6778
+ return this;
6779
+ }
6417
6780
  onKeyDown(...callbacks) {
6418
6781
  if (!this.events.key) this.events.key = Key(this);
6419
6782
  this.events.key.onDown(...callbacks);
@@ -6501,12 +6864,12 @@
6501
6864
  return this;
6502
6865
  }
6503
6866
  on(event_name, ...callbacks) {
6504
- if (!this.events.custom) this.events.custom = CustomEvent(this);
6867
+ if (!this.events.custom) this.events.custom = customEvent();
6505
6868
  this.events.custom.on(event_name, ...callbacks);
6506
6869
  return this;
6507
6870
  }
6508
6871
  emit(event_name, detail = {}) {
6509
- if (!this.events.custom) this.events.custom = CustomEvent(this);
6872
+ if (!this.events.custom) this.events.custom = customEvent();
6510
6873
  this.events.custom.emit(event_name, detail);
6511
6874
  return this;
6512
6875
  }
@@ -6539,18 +6902,6 @@
6539
6902
  isVisible: topVisible || bottomVisible || rightVisible || leftVisible
6540
6903
  };
6541
6904
  }
6542
-
6543
- // toggleSlide() {}
6544
-
6545
- // Glassmorphism(background = "rgba(255,255,255,0.1)", blur = "1px") {
6546
- // this.style({ background: background, backdropFilter: blur });
6547
- // return this;
6548
- // }
6549
- // Neumorphism(r = "50px", bg = "cyan", box = "13px -13px 49px #5d8fac") {
6550
- // this.style({ borderRadius: r, background: bg, boxShadow: box });
6551
- // return this;
6552
- // }
6553
-
6554
6905
  setFullScreen(set = true, e) {
6555
6906
  if (!this.element.requestFullscreen) {
6556
6907
  console.error("Fullscreen API is not supported in this browser.");
@@ -7312,6 +7663,9 @@
7312
7663
  });
7313
7664
  this.render();
7314
7665
  }
7666
+ get t() {
7667
+ return this.element.currentTime;
7668
+ }
7315
7669
  useControls(enabled = true) {
7316
7670
  this.element.controls = enabled;
7317
7671
  return this;
@@ -7332,6 +7686,12 @@
7332
7686
  this.element.requestPictureInPicture(e);
7333
7687
  return this;
7334
7688
  }
7689
+ seekTo(time) {
7690
+ this.element.currentTime = time;
7691
+ return this;
7692
+ }
7693
+ onPlay() {}
7694
+ onPause() {}
7335
7695
  }
7336
7696
  const video = (src, width, height) => new ZikoUIVideo(src, width, height);
7337
7697
 
@@ -7340,7 +7700,10 @@
7340
7700
  super("audio", "audio");
7341
7701
  this.element.setAttribute("src", src);
7342
7702
  this.render();
7343
- this.controls();
7703
+ this.useControls();
7704
+ }
7705
+ get t() {
7706
+ return this.element.currentTime;
7344
7707
  }
7345
7708
  useControls(enabled = true) {
7346
7709
  this.element.controls = enabled;
@@ -7354,6 +7717,12 @@
7354
7717
  this.element.pause();
7355
7718
  return this;
7356
7719
  }
7720
+ seekTo(time) {
7721
+ this.element.currentTime = time;
7722
+ return this;
7723
+ }
7724
+ onPlay() {}
7725
+ onPause() {}
7357
7726
  }
7358
7727
  const audio = src => new ZikoUIAudio(src);
7359
7728
 
@@ -7384,32 +7753,8 @@
7384
7753
  }
7385
7754
  const inputCamera = () => new ZikoUIWebcame();
7386
7755
 
7387
- function set_vertical(direction) {
7388
- direction == 1 ? this.style({
7389
- flexDirection: "column"
7390
- }) : direction == -1 && this.style({
7391
- flexDirection: "column-reverse"
7392
- });
7393
- return this;
7394
- }
7395
- function set_horizontal(direction) {
7396
- direction == 1 ? this.style({
7397
- flexDirection: "row"
7398
- }) : direction == -1 && this.style({
7399
- flexDirection: "row-reverse"
7400
- });
7401
- return this;
7402
- }
7403
- function map_pos_x(align) {
7404
- let pos = ["flex-start", "center", "flex-end"];
7405
- if (typeof align === "number") align = pos[align + 1];
7406
- return align;
7407
- }
7408
- function map_pos_y(align) {
7409
- return map_pos_x(-align);
7410
- }
7411
7756
  class ZikoUIFlex extends ZikoUIElement {
7412
- constructor(tag, w = "100%", h = "100%") {
7757
+ constructor(tag = "div", w = "100%", h = "100%") {
7413
7758
  super(tag, "Flex");
7414
7759
  this.direction = "cols";
7415
7760
  if (typeof w == "number") w += "%";
@@ -7499,6 +7844,30 @@
7499
7844
  }
7500
7845
  return new ZikoUIFlex(tag).append(...ZikoUIElement);
7501
7846
  };
7847
+ function set_vertical(direction) {
7848
+ direction == 1 ? this.style({
7849
+ flexDirection: "column"
7850
+ }) : direction == -1 && this.style({
7851
+ flexDirection: "column-reverse"
7852
+ });
7853
+ return this;
7854
+ }
7855
+ function set_horizontal(direction) {
7856
+ direction == 1 ? this.style({
7857
+ flexDirection: "row"
7858
+ }) : direction == -1 && this.style({
7859
+ flexDirection: "row-reverse"
7860
+ });
7861
+ return this;
7862
+ }
7863
+ function map_pos_x(align) {
7864
+ let pos = ["flex-start", "center", "flex-end"];
7865
+ if (typeof align === "number") align = pos[align + 1];
7866
+ return align;
7867
+ }
7868
+ function map_pos_y(align) {
7869
+ return map_pos_x(-align);
7870
+ }
7502
7871
 
7503
7872
  class ZikoUIGrid extends ZikoUIElement {
7504
7873
  constructor(tag = "div", w = "50vw", h = "50vh") {
@@ -8865,8 +9234,8 @@
8865
9234
  super();
8866
9235
  this.element = document.createElementNS("http://www.w3.org/2000/svg", "svg");
8867
9236
  //this.cache={};
8868
- this.setAttribute("width", w);
8869
- this.setAttribute("height", h);
9237
+ this.setAttr("width", w);
9238
+ this.setAttr("height", h);
8870
9239
  this.style({
8871
9240
  border: "1px black solid"
8872
9241
  });
@@ -8878,7 +9247,7 @@
8878
9247
  let width = Math.abs(x2 - x1);
8879
9248
  let height = Math.abs(y2 - y1);
8880
9249
  //this.element.style.transform="scale("+Math.sign(x2-x1)+","+(-Math.sign(y2-y1))+")";
8881
- this.element.setAttribute("viewBox", [x1, y1, width, height].join(" "));
9250
+ this.setAttr("viewBox", [x1, y1, width, height].join(" "));
8882
9251
  //console.log({width:width,height:height})
8883
9252
  return this;
8884
9253
  }
@@ -9460,7 +9829,7 @@
9460
9829
  const __init__ = () => document.documentElement.setAttribute("data-engine", "zikojs");
9461
9830
 
9462
9831
  var __Target__ = null;
9463
- if (document.body) __Target__ = document.body;
9832
+ if (globalThis?.document?.body) __Target__ = document.body;
9464
9833
 
9465
9834
  class ZikoSeo {
9466
9835
  constructor(app) {
@@ -9512,6 +9881,9 @@
9512
9881
  this.head = null;
9513
9882
  this.#init();
9514
9883
  this.seo = Seo(this);
9884
+ Object.assign(this.events, {
9885
+ hash: null
9886
+ });
9515
9887
  Object.assign(this.cache, {
9516
9888
  theme: null,
9517
9889
  isRoot: true
@@ -9533,6 +9905,11 @@
9533
9905
  }
9534
9906
  prefetch() {}
9535
9907
  description() {}
9908
+ onHashChange(...callbacks) {
9909
+ if (!this.events.hash) this.events.hash = HashEvent(this);
9910
+ this.events.hash.onChange(...callbacks);
9911
+ return this;
9912
+ }
9536
9913
  }
9537
9914
  const App = (...UIElement) => new ZikoUIApp().append(...UIElement);
9538
9915
 
@@ -9615,7 +9992,6 @@
9615
9992
  exports.Time = Time;
9616
9993
  exports.UI = UI$1;
9617
9994
  exports.Utils = Utils;
9618
- exports.Ziko = Ziko;
9619
9995
  exports.ZikoHtml = ZikoHtml;
9620
9996
  exports.ZikoUIArticle = ZikoUIArticle;
9621
9997
  exports.ZikoUIAside = ZikoUIAside;
@@ -9678,6 +10054,7 @@
9678
10054
  exports.csv2object = csv2object;
9679
10055
  exports.csv2sql = csv2sql;
9680
10056
  exports.datalist = datalist;
10057
+ exports.default = Ziko;
9681
10058
  exports.deg2rad = deg2rad;
9682
10059
  exports.div = div;
9683
10060
  exports.e = e;
@@ -9789,4 +10166,6 @@
9789
10166
  exports.waitForUIElmSync = waitForUIElmSync;
9790
10167
  exports.zeros = zeros;
9791
10168
 
10169
+ Object.defineProperty(exports, '__esModule', { value: true });
10170
+
9792
10171
  }));