ziko 0.0.30 → 0.0.31

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 : Tue Jul 29 2025 15:18:10 GMT+0100 (UTC+01:00)
5
+ Date : Wed Jul 30 2025 15:18:05 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
@@ -4663,7 +4663,7 @@ class ZikoUIElement {
4663
4663
  intersection:null
4664
4664
  };
4665
4665
  this.uuid = `${this.cache.name}-${Random.string(16)}`;
4666
- this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
4666
+ this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
4667
4667
  this.cache.style.linkTo(this);
4668
4668
  useDefaultStyle && this.style({
4669
4669
  position: "relative",
@@ -4676,14 +4676,24 @@ class ZikoUIElement {
4676
4676
  this.items = [];
4677
4677
  globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
4678
4678
  element && globalThis.__Ziko__.__Config__.default.render && this.render();
4679
- this.setAttr("data-ui-index", this.ui_index);
4680
- if(globalThis.__Ziko__.__Config__.renderingMode !== "spa" && !globalThis.__Ziko__.__Config__.isSSC) {
4681
- globalThis.__Ziko__.__HYDRATION_MAP__.set(this.uuid, ()=>this);
4682
- }
4679
+ if(
4680
+ // globalThis.__Ziko__.__Config__.renderingMode !== "spa"
4681
+ // &&
4682
+ // !globalThis.__Ziko__.__Config__.isSSC
4683
+ // &&
4684
+ this.isInteractive()
4685
+ ){
4686
+ this.setAttr("ziko-hydration-index", globalThis.__Ziko__.__HYDRATION__.index);
4687
+ globalThis.__Ziko__.__HYDRATION__.map.set(globalThis.__Ziko__.__HYDRATION__.index, ()=>this);
4688
+ globalThis.__Ziko__.__HYDRATION__.increment();
4689
+ }
4683
4690
  }
4684
4691
  get element(){
4685
4692
  return this.__ele__;
4686
4693
  }
4694
+ isInteractive(){
4695
+ return [true, false][Math.floor(2*Math.random())];
4696
+ }
4687
4697
  get isZikoUIElement(){
4688
4698
  return true;
4689
4699
  }
@@ -6939,7 +6949,7 @@ const tags = new Proxy({}, {
6939
6949
  if (typeof prop !== 'string') return undefined;
6940
6950
  let tag = prop.replaceAll("_","-").toLowerCase();
6941
6951
  switch(tag){
6942
- case "html" :
6952
+ case "html" : globalThis?.document?.createElement("html");
6943
6953
  case "head" :
6944
6954
  case "style" :
6945
6955
  case "link" :
@@ -9150,6 +9160,13 @@ const __UI__={
9150
9160
 
9151
9161
  }
9152
9162
  };
9163
+ const __HYDRATION__ = {
9164
+ map : new Map(),
9165
+ index : 0,
9166
+ increment : function(){
9167
+ return this.index ++
9168
+ }
9169
+ };
9153
9170
  const __HYDRATION_MAP__ = new Map();
9154
9171
  const __Config__={
9155
9172
  default:{
@@ -9162,9 +9179,11 @@ const __Config__={
9162
9179
  setDefault:function(pairs){
9163
9180
  const keys=Object.keys(pairs);
9164
9181
  const values=Object.values(pairs);
9165
- for(let i=0;i<keys.length;i++)this.default[keys[i]]=values[i];
9182
+ for(let i=0; i<keys.length; i++) this.default[keys[i]]=values[i];
9183
+ },
9184
+ init:()=>{
9185
+ // document.documentElement.setAttribute("data-engine","zikojs")
9166
9186
  },
9167
- init:()=>document.documentElement.setAttribute("data-engine","zikojs"),
9168
9187
  renderingMode :"spa",
9169
9188
  isSSC : false,
9170
9189
  };
@@ -9180,6 +9199,7 @@ var Global = /*#__PURE__*/Object.freeze({
9180
9199
  __CACHE__: __CACHE__,
9181
9200
  __Config__: __Config__,
9182
9201
  __HYDRATION_MAP__: __HYDRATION_MAP__,
9202
+ __HYDRATION__: __HYDRATION__,
9183
9203
  __UI__: __UI__
9184
9204
  });
9185
9205
 
@@ -9279,6 +9299,7 @@ if ( globalThis.__Ziko__ ) {
9279
9299
  globalThis.__Ziko__={
9280
9300
  ...Ziko,
9281
9301
  __UI__,
9302
+ __HYDRATION__,
9282
9303
  __HYDRATION_MAP__,
9283
9304
  __Config__,
9284
9305
  __CACHE__,
@@ -9422,6 +9443,7 @@ exports.ZikoUseStyle = ZikoUseStyle;
9422
9443
  exports.__CACHE__ = __CACHE__;
9423
9444
  exports.__Config__ = __Config__;
9424
9445
  exports.__HYDRATION_MAP__ = __HYDRATION_MAP__;
9446
+ exports.__HYDRATION__ = __HYDRATION__;
9425
9447
  exports.__UI__ = __UI__;
9426
9448
  exports.abbrText = abbrText;
9427
9449
  exports.abs = abs;
package/dist/ziko.js CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Tue Jul 29 2025 15:18:10 GMT+0100 (UTC+01:00)
5
+ Date : Wed Jul 30 2025 15:18:05 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
@@ -4665,7 +4665,7 @@
4665
4665
  intersection:null
4666
4666
  };
4667
4667
  this.uuid = `${this.cache.name}-${Random.string(16)}`;
4668
- this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
4668
+ this.ui_index = globalThis.__Ziko__.__CACHE__.get_ui_index();
4669
4669
  this.cache.style.linkTo(this);
4670
4670
  useDefaultStyle && this.style({
4671
4671
  position: "relative",
@@ -4678,14 +4678,24 @@
4678
4678
  this.items = [];
4679
4679
  globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
4680
4680
  element && globalThis.__Ziko__.__Config__.default.render && this.render();
4681
- this.setAttr("data-ui-index", this.ui_index);
4682
- if(globalThis.__Ziko__.__Config__.renderingMode !== "spa" && !globalThis.__Ziko__.__Config__.isSSC) {
4683
- globalThis.__Ziko__.__HYDRATION_MAP__.set(this.uuid, ()=>this);
4684
- }
4681
+ if(
4682
+ // globalThis.__Ziko__.__Config__.renderingMode !== "spa"
4683
+ // &&
4684
+ // !globalThis.__Ziko__.__Config__.isSSC
4685
+ // &&
4686
+ this.isInteractive()
4687
+ ){
4688
+ this.setAttr("ziko-hydration-index", globalThis.__Ziko__.__HYDRATION__.index);
4689
+ globalThis.__Ziko__.__HYDRATION__.map.set(globalThis.__Ziko__.__HYDRATION__.index, ()=>this);
4690
+ globalThis.__Ziko__.__HYDRATION__.increment();
4691
+ }
4685
4692
  }
4686
4693
  get element(){
4687
4694
  return this.__ele__;
4688
4695
  }
4696
+ isInteractive(){
4697
+ return [true, false][Math.floor(2*Math.random())];
4698
+ }
4689
4699
  get isZikoUIElement(){
4690
4700
  return true;
4691
4701
  }
@@ -6941,7 +6951,7 @@
6941
6951
  if (typeof prop !== 'string') return undefined;
6942
6952
  let tag = prop.replaceAll("_","-").toLowerCase();
6943
6953
  switch(tag){
6944
- case "html" :
6954
+ case "html" : globalThis?.document?.createElement("html");
6945
6955
  case "head" :
6946
6956
  case "style" :
6947
6957
  case "link" :
@@ -9152,6 +9162,13 @@
9152
9162
 
9153
9163
  }
9154
9164
  };
9165
+ const __HYDRATION__ = {
9166
+ map : new Map(),
9167
+ index : 0,
9168
+ increment : function(){
9169
+ return this.index ++
9170
+ }
9171
+ };
9155
9172
  const __HYDRATION_MAP__ = new Map();
9156
9173
  const __Config__={
9157
9174
  default:{
@@ -9164,9 +9181,11 @@
9164
9181
  setDefault:function(pairs){
9165
9182
  const keys=Object.keys(pairs);
9166
9183
  const values=Object.values(pairs);
9167
- for(let i=0;i<keys.length;i++)this.default[keys[i]]=values[i];
9184
+ for(let i=0; i<keys.length; i++) this.default[keys[i]]=values[i];
9185
+ },
9186
+ init:()=>{
9187
+ // document.documentElement.setAttribute("data-engine","zikojs")
9168
9188
  },
9169
- init:()=>document.documentElement.setAttribute("data-engine","zikojs"),
9170
9189
  renderingMode :"spa",
9171
9190
  isSSC : false,
9172
9191
  };
@@ -9182,6 +9201,7 @@
9182
9201
  __CACHE__: __CACHE__,
9183
9202
  __Config__: __Config__,
9184
9203
  __HYDRATION_MAP__: __HYDRATION_MAP__,
9204
+ __HYDRATION__: __HYDRATION__,
9185
9205
  __UI__: __UI__
9186
9206
  });
9187
9207
 
@@ -9281,6 +9301,7 @@
9281
9301
  globalThis.__Ziko__={
9282
9302
  ...Ziko,
9283
9303
  __UI__,
9304
+ __HYDRATION__,
9284
9305
  __HYDRATION_MAP__,
9285
9306
  __Config__,
9286
9307
  __CACHE__,
@@ -9424,6 +9445,7 @@
9424
9445
  exports.__CACHE__ = __CACHE__;
9425
9446
  exports.__Config__ = __Config__;
9426
9447
  exports.__HYDRATION_MAP__ = __HYDRATION_MAP__;
9448
+ exports.__HYDRATION__ = __HYDRATION__;
9427
9449
  exports.__UI__ = __UI__;
9428
9450
  exports.abbrText = abbrText;
9429
9451
  exports.abs = abs;