ziko 0.35.0 → 0.36.0

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.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Thu Aug 07 2025 10:32:14 GMT+0100 (UTC+01:00)
5
+ Date : Tue Aug 12 2025 11:00:20 GMT+0100 (UTC+01:00)
6
6
  Git-Repo : https://github.com/zakarialaoui10/ziko.js
7
7
  Git-Wiki : https://github.com/zakarialaoui10/ziko.js/wiki
8
8
  Released under MIT License
@@ -1200,6 +1200,22 @@ const json2xmlFile=(json,indent)=>{
1200
1200
  }
1201
1201
  };
1202
1202
 
1203
+ class ZikoUINode {
1204
+ constructor(node){
1205
+ this.cache = {
1206
+ node
1207
+ };
1208
+ }
1209
+ isZikoUINode(){
1210
+ return true
1211
+ }
1212
+ get node(){
1213
+ return this.cache.node;
1214
+ }
1215
+ }
1216
+
1217
+ globalThis.node = (node) => new ZikoUINode(node);
1218
+
1203
1219
  const DomMethods = {
1204
1220
  append(...ele) {
1205
1221
  __addItem__.call(this, "append", "push", ...ele);
@@ -1726,7 +1742,7 @@ Object.entries(Events$1).forEach(([name, eventList]) => {
1726
1742
  });
1727
1743
  });
1728
1744
 
1729
- let ZikoUseStyle$1 = class ZikoUseStyle {
1745
+ class ZikoUseStyle {
1730
1746
  constructor(style = {}, use = style.hasOwnProperty("default")? "default" : Object.keys(style)[0], id = 0) {
1731
1747
  this.id = "Ziko-Style-" + id;
1732
1748
  this.keys = new Set();
@@ -1798,7 +1814,9 @@ let ZikoUseStyle$1 = class ZikoUseStyle {
1798
1814
  if (style && typeof style === "object") return this.#useStyleObject(style);
1799
1815
  return this;
1800
1816
  }
1801
- };
1817
+ }
1818
+
1819
+ const useStyle = (styles, use, id) => new ZikoUseStyle(styles, use, id);
1802
1820
 
1803
1821
  const addSuffixeToNumber=(value,suffixe="px")=>{
1804
1822
  if(typeof value === "number") value+=suffixe;
@@ -3234,82 +3252,6 @@ let ZikoHead$1 = class ZikoHead{
3234
3252
 
3235
3253
  const useHead$1=({ title, lang, icon, meta, noscript })=>new ZikoHead$1({ title, lang, icon, meta, noscript });
3236
3254
 
3237
- class ZikoUseStyle {
3238
- constructor(style = {}, use = style.hasOwnProperty("default")? "default" : Object.keys(style)[0], id = 0) {
3239
- this.id = "Ziko-Style-" + id;
3240
- this.keys = new Set();
3241
- this.styles = {
3242
- default: {
3243
- fontSize: "1em",
3244
- color : "green"
3245
- },
3246
- other: {
3247
- fontSize : "2em",
3248
- color : "cyan"
3249
- }
3250
- };
3251
- style && this.add(style);
3252
- use && this.use(use);
3253
- }
3254
-
3255
- get current() {
3256
- return [...this.keys].reduce((key, value) => {
3257
- key[value] = `var(--${value}-${this.id})`;
3258
- return key;
3259
- }, {});
3260
- }
3261
-
3262
- add(name, style = {}) {
3263
- if (name && typeof name === 'object' && !Array.isArray(name)) {
3264
- Object.assign(this.styles, name);
3265
- } else if (typeof name === 'string') {
3266
- Object.assign(this.styles, { [name]: style });
3267
- }
3268
- return this;
3269
- }
3270
-
3271
- #useStyleIndex(index) {
3272
- const keys = Object.keys(this.styles);
3273
- for (let a in this.styles[keys[index]]) {
3274
- if (Object.prototype.hasOwnProperty.call(this.styles[keys[index]], a)) {
3275
- document.documentElement.style.setProperty(`--${a}-${this.id}`, this.styles[keys[index]][a]);
3276
- this.keys.add(a);
3277
- }
3278
- }
3279
- return this;
3280
- }
3281
-
3282
- #useStyleName(name) {
3283
- if (!this.styles[name]) return this;
3284
- for (let a in this.styles[name]) {
3285
- if (Object.prototype.hasOwnProperty.call(this.styles[name], a)) {
3286
- document.documentElement.style.setProperty(`--${a}-${this.id}`, this.styles[name][a]);
3287
- this.keys.add(a);
3288
- }
3289
- }
3290
- return this;
3291
- }
3292
-
3293
- #useStyleObject(style) {
3294
- for (let a in style) {
3295
- if (Object.prototype.hasOwnProperty.call(style, a)) {
3296
- document.documentElement.style.setProperty(`--${a}-${this.id}`, style[a]);
3297
- this.keys.add(a);
3298
- }
3299
- }
3300
- return this;
3301
- }
3302
-
3303
- use(style) {
3304
- if (typeof style === "number") return this.#useStyleIndex(style);
3305
- if (typeof style === "string") return this.#useStyleName(style);
3306
- if (style && typeof style === "object") return this.#useStyleObject(style);
3307
- return this;
3308
- }
3309
- }
3310
-
3311
- const useStyle = (styles, use, id) => new ZikoUseStyle(styles, use, id);
3312
-
3313
3255
  /*
3314
3256
  [
3315
3257
  {
@@ -3408,8 +3350,9 @@ const Reactivity={
3408
3350
  ...Hooks,
3409
3351
  };
3410
3352
 
3411
- class ZikoUIElement {
3353
+ class ZikoUIElement extends ZikoUINode{
3412
3354
  constructor(element, name="", {el_type="html", useDefaultStyle=false}={}){
3355
+ super();
3413
3356
  this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
3414
3357
  if(typeof element === "string") {
3415
3358
  switch(el_type){
@@ -3421,7 +3364,7 @@ class ZikoUIElement {
3421
3364
  else {
3422
3365
  this.target = element.parentElement;
3423
3366
  }
3424
- if(element)this.__ele__ = element;
3367
+ // if(element)this.__ele__ = element;
3425
3368
  compose(
3426
3369
  this,
3427
3370
  DomMethods,
@@ -3433,8 +3376,9 @@ class ZikoUIElement {
3433
3376
  // compose(this, ExternalMethods);
3434
3377
  // });
3435
3378
  // }
3436
- this.cache = {
3379
+ Object.assign(this.cache, {
3437
3380
  name,
3381
+ isInteractive : [true, false][Math.floor(2*Math.random())],
3438
3382
  parent:null,
3439
3383
  isBody:false,
3440
3384
  isRoot:false,
@@ -3445,7 +3389,7 @@ class ZikoUIElement {
3445
3389
  attributes: {},
3446
3390
  filters: {},
3447
3391
  temp:{}
3448
- };
3392
+ });
3449
3393
  this.events = {
3450
3394
  ptr:null,
3451
3395
  mouse:null,
@@ -3463,6 +3407,7 @@ class ZikoUIElement {
3463
3407
  resize:null,
3464
3408
  intersection:null
3465
3409
  };
3410
+ if(element)Object.assign(this.cache,{element});
3466
3411
  this.uuid = `${this.cache.name}-${Random.string(16)}`;
3467
3412
  this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
3468
3413
  this.cache.style.linkTo(this);
@@ -3490,12 +3435,13 @@ class ZikoUIElement {
3490
3435
  }
3491
3436
  }
3492
3437
  get element(){
3493
- return this.__ele__;
3438
+ return this.cache.element;
3494
3439
  }
3495
3440
  isInteractive(){
3496
- return [true, false][Math.floor(2*Math.random())];
3441
+ return this.cache.isInteractive;
3497
3442
  }
3498
- get isZikoUIElement(){
3443
+ // Remove get
3444
+ isZikoUIElement(){
3499
3445
  return true;
3500
3446
  }
3501
3447
  register(){
@@ -3552,18 +3498,25 @@ class ZikoUIElement {
3552
3498
  return UI.render(render);
3553
3499
  }
3554
3500
  style(styles){
3555
- styles instanceof ZikoUseStyle$1 ? this.st.style(styles.current): this.st.style(styles);
3501
+ styles instanceof ZikoUseStyle ? this.st.style(styles.current): this.st.style(styles);
3556
3502
  return this;
3557
3503
  }
3558
3504
  size(width,height){
3559
3505
  this.st.size(width,height);
3560
3506
  return this;
3561
3507
  }
3508
+ [Symbol.iterator]() {
3509
+ return this.items[Symbol.iterator]();
3510
+ }
3562
3511
  maintain() {
3563
- for (let i = 0; i < this.items.length; i++)
3564
- Object.assign(this, { [[i]]: this.items[i] });
3565
- this.length = this.items.length;
3566
- return this;
3512
+ for (let i = 0; i < this.items.length; i++) {
3513
+ Object.defineProperty(this, i, {
3514
+ value: this.items[i],
3515
+ writable: true,
3516
+ configurable: true,
3517
+ enumerable: false
3518
+ });
3519
+ }
3567
3520
  }
3568
3521
  filter(condition_callback, if_callback = () => {}, else_callback = () => {}) {
3569
3522
  const FilterItems = this.items.filter(condition_callback);
@@ -6035,7 +5988,7 @@ class Matrix extends ZikoMath{
6035
5988
  this.cols = cols;
6036
5989
  this.arr = arr;
6037
5990
  }
6038
- this._maintain();
5991
+ this.#maintain();
6039
5992
  //Object.seal(this);
6040
5993
  }
6041
5994
  toString(){
@@ -6072,9 +6025,18 @@ class Matrix extends ZikoMath{
6072
6025
  get imag() {
6073
6026
  return new Matrix(this.cols, this.rows, this.arr.flat(1).imag);
6074
6027
  }
6075
- _maintain(){
6076
- for(let i=0;i<this.arr.length;i++)Object.assign(this,{[[i]]:this.arr[i]});
6077
- return this;
6028
+ [Symbol.iterator]() {
6029
+ return this.arr[Symbol.iterator]();
6030
+ }
6031
+ #maintain() {
6032
+ for (let i = 0; i < this.arr.length; i++) {
6033
+ Object.defineProperty(this, i, {
6034
+ value: this.arr[i],
6035
+ writable: true,
6036
+ configurable: true,
6037
+ enumerable: false
6038
+ });
6039
+ }
6078
6040
  }
6079
6041
  get(row = 0, col = 0) {
6080
6042
  if (col == -1) return this.arr[row];
package/dist/ziko.js CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Thu Aug 07 2025 10:35:46 GMT+0100 (UTC+01:00)
5
+ Date : Tue Aug 12 2025 11:00:20 GMT+0100 (UTC+01:00)
6
6
  Git-Repo : https://github.com/zakarialaoui10/ziko.js
7
7
  Git-Wiki : https://github.com/zakarialaoui10/ziko.js/wiki
8
8
  Released under MIT License
@@ -1202,6 +1202,22 @@
1202
1202
  }
1203
1203
  };
1204
1204
 
1205
+ class ZikoUINode {
1206
+ constructor(node){
1207
+ this.cache = {
1208
+ node
1209
+ };
1210
+ }
1211
+ isZikoUINode(){
1212
+ return true
1213
+ }
1214
+ get node(){
1215
+ return this.cache.node;
1216
+ }
1217
+ }
1218
+
1219
+ globalThis.node = (node) => new ZikoUINode(node);
1220
+
1205
1221
  const DomMethods = {
1206
1222
  append(...ele) {
1207
1223
  __addItem__.call(this, "append", "push", ...ele);
@@ -1728,7 +1744,7 @@
1728
1744
  });
1729
1745
  });
1730
1746
 
1731
- let ZikoUseStyle$1 = class ZikoUseStyle {
1747
+ class ZikoUseStyle {
1732
1748
  constructor(style = {}, use = style.hasOwnProperty("default")? "default" : Object.keys(style)[0], id = 0) {
1733
1749
  this.id = "Ziko-Style-" + id;
1734
1750
  this.keys = new Set();
@@ -1800,7 +1816,9 @@
1800
1816
  if (style && typeof style === "object") return this.#useStyleObject(style);
1801
1817
  return this;
1802
1818
  }
1803
- };
1819
+ }
1820
+
1821
+ const useStyle = (styles, use, id) => new ZikoUseStyle(styles, use, id);
1804
1822
 
1805
1823
  const addSuffixeToNumber=(value,suffixe="px")=>{
1806
1824
  if(typeof value === "number") value+=suffixe;
@@ -3236,82 +3254,6 @@
3236
3254
 
3237
3255
  const useHead$1=({ title, lang, icon, meta, noscript })=>new ZikoHead$1({ title, lang, icon, meta, noscript });
3238
3256
 
3239
- class ZikoUseStyle {
3240
- constructor(style = {}, use = style.hasOwnProperty("default")? "default" : Object.keys(style)[0], id = 0) {
3241
- this.id = "Ziko-Style-" + id;
3242
- this.keys = new Set();
3243
- this.styles = {
3244
- default: {
3245
- fontSize: "1em",
3246
- color : "green"
3247
- },
3248
- other: {
3249
- fontSize : "2em",
3250
- color : "cyan"
3251
- }
3252
- };
3253
- style && this.add(style);
3254
- use && this.use(use);
3255
- }
3256
-
3257
- get current() {
3258
- return [...this.keys].reduce((key, value) => {
3259
- key[value] = `var(--${value}-${this.id})`;
3260
- return key;
3261
- }, {});
3262
- }
3263
-
3264
- add(name, style = {}) {
3265
- if (name && typeof name === 'object' && !Array.isArray(name)) {
3266
- Object.assign(this.styles, name);
3267
- } else if (typeof name === 'string') {
3268
- Object.assign(this.styles, { [name]: style });
3269
- }
3270
- return this;
3271
- }
3272
-
3273
- #useStyleIndex(index) {
3274
- const keys = Object.keys(this.styles);
3275
- for (let a in this.styles[keys[index]]) {
3276
- if (Object.prototype.hasOwnProperty.call(this.styles[keys[index]], a)) {
3277
- document.documentElement.style.setProperty(`--${a}-${this.id}`, this.styles[keys[index]][a]);
3278
- this.keys.add(a);
3279
- }
3280
- }
3281
- return this;
3282
- }
3283
-
3284
- #useStyleName(name) {
3285
- if (!this.styles[name]) return this;
3286
- for (let a in this.styles[name]) {
3287
- if (Object.prototype.hasOwnProperty.call(this.styles[name], a)) {
3288
- document.documentElement.style.setProperty(`--${a}-${this.id}`, this.styles[name][a]);
3289
- this.keys.add(a);
3290
- }
3291
- }
3292
- return this;
3293
- }
3294
-
3295
- #useStyleObject(style) {
3296
- for (let a in style) {
3297
- if (Object.prototype.hasOwnProperty.call(style, a)) {
3298
- document.documentElement.style.setProperty(`--${a}-${this.id}`, style[a]);
3299
- this.keys.add(a);
3300
- }
3301
- }
3302
- return this;
3303
- }
3304
-
3305
- use(style) {
3306
- if (typeof style === "number") return this.#useStyleIndex(style);
3307
- if (typeof style === "string") return this.#useStyleName(style);
3308
- if (style && typeof style === "object") return this.#useStyleObject(style);
3309
- return this;
3310
- }
3311
- }
3312
-
3313
- const useStyle = (styles, use, id) => new ZikoUseStyle(styles, use, id);
3314
-
3315
3257
  /*
3316
3258
  [
3317
3259
  {
@@ -3410,8 +3352,9 @@
3410
3352
  ...Hooks,
3411
3353
  };
3412
3354
 
3413
- class ZikoUIElement {
3355
+ class ZikoUIElement extends ZikoUINode{
3414
3356
  constructor(element, name="", {el_type="html", useDefaultStyle=false}={}){
3357
+ super();
3415
3358
  this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
3416
3359
  if(typeof element === "string") {
3417
3360
  switch(el_type){
@@ -3423,7 +3366,7 @@
3423
3366
  else {
3424
3367
  this.target = element.parentElement;
3425
3368
  }
3426
- if(element)this.__ele__ = element;
3369
+ // if(element)this.__ele__ = element;
3427
3370
  compose(
3428
3371
  this,
3429
3372
  DomMethods,
@@ -3435,8 +3378,9 @@
3435
3378
  // compose(this, ExternalMethods);
3436
3379
  // });
3437
3380
  // }
3438
- this.cache = {
3381
+ Object.assign(this.cache, {
3439
3382
  name,
3383
+ isInteractive : [true, false][Math.floor(2*Math.random())],
3440
3384
  parent:null,
3441
3385
  isBody:false,
3442
3386
  isRoot:false,
@@ -3447,7 +3391,7 @@
3447
3391
  attributes: {},
3448
3392
  filters: {},
3449
3393
  temp:{}
3450
- };
3394
+ });
3451
3395
  this.events = {
3452
3396
  ptr:null,
3453
3397
  mouse:null,
@@ -3465,6 +3409,7 @@
3465
3409
  resize:null,
3466
3410
  intersection:null
3467
3411
  };
3412
+ if(element)Object.assign(this.cache,{element});
3468
3413
  this.uuid = `${this.cache.name}-${Random.string(16)}`;
3469
3414
  this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
3470
3415
  this.cache.style.linkTo(this);
@@ -3492,12 +3437,13 @@
3492
3437
  }
3493
3438
  }
3494
3439
  get element(){
3495
- return this.__ele__;
3440
+ return this.cache.element;
3496
3441
  }
3497
3442
  isInteractive(){
3498
- return [true, false][Math.floor(2*Math.random())];
3443
+ return this.cache.isInteractive;
3499
3444
  }
3500
- get isZikoUIElement(){
3445
+ // Remove get
3446
+ isZikoUIElement(){
3501
3447
  return true;
3502
3448
  }
3503
3449
  register(){
@@ -3554,18 +3500,25 @@
3554
3500
  return UI.render(render);
3555
3501
  }
3556
3502
  style(styles){
3557
- styles instanceof ZikoUseStyle$1 ? this.st.style(styles.current): this.st.style(styles);
3503
+ styles instanceof ZikoUseStyle ? this.st.style(styles.current): this.st.style(styles);
3558
3504
  return this;
3559
3505
  }
3560
3506
  size(width,height){
3561
3507
  this.st.size(width,height);
3562
3508
  return this;
3563
3509
  }
3510
+ [Symbol.iterator]() {
3511
+ return this.items[Symbol.iterator]();
3512
+ }
3564
3513
  maintain() {
3565
- for (let i = 0; i < this.items.length; i++)
3566
- Object.assign(this, { [[i]]: this.items[i] });
3567
- this.length = this.items.length;
3568
- return this;
3514
+ for (let i = 0; i < this.items.length; i++) {
3515
+ Object.defineProperty(this, i, {
3516
+ value: this.items[i],
3517
+ writable: true,
3518
+ configurable: true,
3519
+ enumerable: false
3520
+ });
3521
+ }
3569
3522
  }
3570
3523
  filter(condition_callback, if_callback = () => {}, else_callback = () => {}) {
3571
3524
  const FilterItems = this.items.filter(condition_callback);
@@ -6037,7 +5990,7 @@
6037
5990
  this.cols = cols;
6038
5991
  this.arr = arr;
6039
5992
  }
6040
- this._maintain();
5993
+ this.#maintain();
6041
5994
  //Object.seal(this);
6042
5995
  }
6043
5996
  toString(){
@@ -6074,9 +6027,18 @@
6074
6027
  get imag() {
6075
6028
  return new Matrix(this.cols, this.rows, this.arr.flat(1).imag);
6076
6029
  }
6077
- _maintain(){
6078
- for(let i=0;i<this.arr.length;i++)Object.assign(this,{[[i]]:this.arr[i]});
6079
- return this;
6030
+ [Symbol.iterator]() {
6031
+ return this.arr[Symbol.iterator]();
6032
+ }
6033
+ #maintain() {
6034
+ for (let i = 0; i < this.arr.length; i++) {
6035
+ Object.defineProperty(this, i, {
6036
+ value: this.arr[i],
6037
+ writable: true,
6038
+ configurable: true,
6039
+ enumerable: false
6040
+ });
6041
+ }
6080
6042
  }
6081
6043
  get(row = 0, col = 0) {
6082
6044
  if (col == -1) return this.arr[row];