ziko 0.48.2 → 0.49.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 : Fri Nov 21 2025 22:08:16 GMT+0100 (UTC+01:00)
5
+ Date : Sat Nov 22 2025 13:34:29 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
@@ -1340,7 +1340,7 @@ class UIElementCore extends UINode{
1340
1340
  // // UI.append(...items);
1341
1341
  // // }
1342
1342
  // // else UI.element=this.element.cloneNode(true);
1343
- // // return UI.render(render);
1343
+ // // return UI.mount(render);
1344
1344
  // }
1345
1345
 
1346
1346
  // freeze(freeze){
@@ -1350,9 +1350,9 @@ class UIElementCore extends UINode{
1350
1350
  // setTarget(tg) {
1351
1351
  // if(this.isBody) return ;
1352
1352
  // if (tg?.isUIElement) tg = tg.element;
1353
- // this.unrender();
1353
+ // this.unmount();
1354
1354
  // this.target = tg;
1355
- // this.render();
1355
+ // this.mount();
1356
1356
  // return this;
1357
1357
  // }
1358
1358
  // describe(label){
@@ -1658,18 +1658,18 @@ function remove(...ele) {
1658
1658
  return this;
1659
1659
  }
1660
1660
  function clear(){
1661
- this?.items?.forEach(n=>n.unrender());
1661
+ this?.items?.forEach(n=>n.unmount());
1662
1662
  this.element.innerHTML = "";
1663
1663
  return this;
1664
1664
  }
1665
- function render(target = this.target) {
1665
+ function mount(target = this.target) {
1666
1666
  if(this.isBody)return ;
1667
1667
  if(target?.isUIElement)target=target.element;
1668
1668
  this.target=target;
1669
1669
  this.target?.appendChild(this.element);
1670
1670
  return this;
1671
1671
  }
1672
- function unrender(){
1672
+ function unmount(){
1673
1673
  if(this.cache.parent)this.cache.parent.remove(this);
1674
1674
  else if(this.target?.children?.length && [...this.target?.children].includes(this.element)) this.target.removeChild(this.element);
1675
1675
  return this;
@@ -1682,11 +1682,11 @@ function replaceElementWith(new_element){
1682
1682
  return this
1683
1683
  }
1684
1684
  function renderAfter(t = 1) {
1685
- setTimeout(() => this.render(), t);
1685
+ setTimeout(() => this.mount(), t);
1686
1686
  return this;
1687
1687
  }
1688
1688
  function unrenderAfter(t = 1) {
1689
- setTimeout(() => this.unrender(), t);
1689
+ setTimeout(() => this.unmount(), t);
1690
1690
  return this;
1691
1691
  }
1692
1692
  function after(ui){
@@ -1707,12 +1707,12 @@ var DomMethods = /*#__PURE__*/Object.freeze({
1707
1707
  before: before,
1708
1708
  clear: clear,
1709
1709
  insertAt: insertAt,
1710
+ mount: mount,
1710
1711
  prepend: prepend,
1711
1712
  remove: remove,
1712
- render: render,
1713
1713
  renderAfter: renderAfter,
1714
1714
  replaceElementWith: replaceElementWith,
1715
- unrender: unrender,
1715
+ unmount: unmount,
1716
1716
  unrenderAfter: unrenderAfter
1717
1717
  });
1718
1718
 
@@ -2417,7 +2417,7 @@ let UIElement$1 = class UIElement extends UIElementCore{
2417
2417
  // // UI.append(...items);
2418
2418
  // // }
2419
2419
  // // else UI.element=this.element.cloneNode(true);
2420
- // // return UI.render(render);
2420
+ // // return UI.mount(render);
2421
2421
  // }
2422
2422
  // [Symbol.iterator]() {
2423
2423
  // return this.items[Symbol.iterator]();
@@ -2439,9 +2439,9 @@ let UIElement$1 = class UIElement extends UIElementCore{
2439
2439
  // setTarget(tg) {
2440
2440
  // if(this.isBody) return ;
2441
2441
  // if (tg?.isUIElement) tg = tg.element;
2442
- // this.unrender();
2442
+ // this.unmount();
2443
2443
  // this.target = tg;
2444
- // this.render();
2444
+ // this.mount();
2445
2445
  // return this;
2446
2446
  // }
2447
2447
  // describe(label){
@@ -2704,7 +2704,7 @@ class ZikoUIFlex extends UIElement$1 {
2704
2704
  if (typeof h == "number") h += "%";
2705
2705
  this.style({ width: w, height: h });
2706
2706
  this.style({ display: "flex" });
2707
- // this.render();
2707
+ // this.mount();
2708
2708
  }
2709
2709
  get isFlex(){
2710
2710
  return true;
@@ -2812,7 +2812,7 @@ class ZikoUISuspense extends UIElement{
2812
2812
  (async ()=>{
2813
2813
  try{
2814
2814
  const ui = await callback();
2815
- fallback_ui.unrender();
2815
+ fallback_ui.unmount();
2816
2816
  this.append(ui);
2817
2817
  // console.log(content)
2818
2818
  }
@@ -2914,19 +2914,19 @@ function define_wc(name, UIElement, props = {}, { mode = 'open'} = {}) {
2914
2914
  }
2915
2915
 
2916
2916
  connectedCallback() {
2917
- this.render();
2917
+ this.mount();
2918
2918
  }
2919
2919
 
2920
- render() {
2920
+ mount() {
2921
2921
  this.shadowRoot.innerHTML = '';
2922
- this.UIElement = UIElement(this.props).render(this.shadowRoot);
2922
+ this.UIElement = UIElement(this.props).mount(this.shadowRoot);
2923
2923
  }
2924
2924
 
2925
2925
  attributeChangedCallback(name, _, newValue) {
2926
2926
  Object.assign(this.props, {
2927
2927
  [name]: this.mask[name].type(newValue)
2928
2928
  });
2929
- this.render();
2929
+ this.mount();
2930
2930
  }
2931
2931
  }
2932
2932
  );
@@ -2940,7 +2940,7 @@ class UISwitch extends UIElement$1{
2940
2940
  this.init();
2941
2941
  }
2942
2942
  init(){
2943
- Object.values(this.cases).filter(n=>n != this.current).forEach(n=>n.unrender());
2943
+ Object.values(this.cases).filter(n=>n != this.current).forEach(n=>n.unmount());
2944
2944
  super.init(this.current.element);
2945
2945
  }
2946
2946
  get current(){
@@ -2967,7 +2967,7 @@ const Switch=({key, cases})=> new UISwitch(key, cases);
2967
2967
  const svg2str=svg=>(new XMLSerializer()).serializeToString(svg);
2968
2968
  const svg2ascii=svg=>btoa(svg2str(svg));
2969
2969
  const svg2imgUrl=svg=>'data:image/svg+xml;base64,'+svg2ascii(svg);
2970
- const svg2img=(svg,render=true)=>tags.img(svg2imgUrl(svg)).render(render);
2970
+ const svg2img=(svg,render=true)=>tags.img(svg2imgUrl(svg)).mount(render);
2971
2971
 
2972
2972
  // const obj2str=(object)=>{
2973
2973
  // const recursiveToString = (obj) => {
@@ -4857,7 +4857,7 @@ class ZikoApp {
4857
4857
  this.head && this.setHead(this.head);
4858
4858
  this.wrapper && this.setWrapper(this.wrapper);
4859
4859
  this.target && this.setTarget(this.target);
4860
- if(this.wrapper && this.target)this.wrapper.render(this.target);
4860
+ if(this.wrapper && this.target)this.wrapper.mount(this.target);
4861
4861
  }
4862
4862
  setTarget(target){
4863
4863
  if(target instanceof HTMLElement) this.target = target;
@@ -4933,16 +4933,16 @@ class ZikoSPA extends ZikoApp{
4933
4933
  ...Object.entries(routes)
4934
4934
  ]);
4935
4935
  this.clear();
4936
- globalThis.onpopstate = this.render(location.pathname);
4936
+ globalThis.onpopstate = this.mount(location.pathname);
4937
4937
  }
4938
4938
  clear(){
4939
4939
  [...this.routes].forEach(n=>{
4940
- !isDynamic(n[0]) && n[1]?.isUIElement && n[1].unrender();
4940
+ !isDynamic(n[0]) && n[1]?.isUIElement && n[1].unmount();
4941
4941
  });
4942
4942
  // this.wrapper.clear();
4943
4943
  return this;
4944
4944
  }
4945
- render(path){
4945
+ mount(path){
4946
4946
  const [mask, callback] = [...this.routes].find(route=>routesMatcher(route[0],path));
4947
4947
  let element ;
4948
4948
  if(isDynamic(mask)){
@@ -4950,13 +4950,13 @@ class ZikoSPA extends ZikoApp{
4950
4950
  element = callback.call(this,params);
4951
4951
  }
4952
4952
  else {
4953
- callback?.isUIElement && callback.render(this.wrapper);
4953
+ callback?.isUIElement && callback.mount(this.wrapper);
4954
4954
  if(typeof callback === "function") element = callback();
4955
4955
  }
4956
- if(element?.isUIElement) element.render(this.wrapper);
4957
- // if(element?.isZikoApp) element.render(this.wrapper);
4956
+ if(element?.isUIElement) element.mount(this.wrapper);
4957
+ // if(element?.isZikoApp) element.mount(this.wrapper);
4958
4958
  if(element instanceof Promise){
4959
- element.then(e=>e.render(this.wrapper));
4959
+ element.then(e=>e.mount(this.wrapper));
4960
4960
  }
4961
4961
  globalThis.history.pushState({}, "", path);
4962
4962
  return this;
package/dist/ziko.js CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Fri Nov 21 2025 22:08:16 GMT+0100 (UTC+01:00)
5
+ Date : Sat Nov 22 2025 13:34:29 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
@@ -1344,7 +1344,7 @@
1344
1344
  // // UI.append(...items);
1345
1345
  // // }
1346
1346
  // // else UI.element=this.element.cloneNode(true);
1347
- // // return UI.render(render);
1347
+ // // return UI.mount(render);
1348
1348
  // }
1349
1349
 
1350
1350
  // freeze(freeze){
@@ -1354,9 +1354,9 @@
1354
1354
  // setTarget(tg) {
1355
1355
  // if(this.isBody) return ;
1356
1356
  // if (tg?.isUIElement) tg = tg.element;
1357
- // this.unrender();
1357
+ // this.unmount();
1358
1358
  // this.target = tg;
1359
- // this.render();
1359
+ // this.mount();
1360
1360
  // return this;
1361
1361
  // }
1362
1362
  // describe(label){
@@ -1662,18 +1662,18 @@
1662
1662
  return this;
1663
1663
  }
1664
1664
  function clear(){
1665
- this?.items?.forEach(n=>n.unrender());
1665
+ this?.items?.forEach(n=>n.unmount());
1666
1666
  this.element.innerHTML = "";
1667
1667
  return this;
1668
1668
  }
1669
- function render(target = this.target) {
1669
+ function mount(target = this.target) {
1670
1670
  if(this.isBody)return ;
1671
1671
  if(target?.isUIElement)target=target.element;
1672
1672
  this.target=target;
1673
1673
  this.target?.appendChild(this.element);
1674
1674
  return this;
1675
1675
  }
1676
- function unrender(){
1676
+ function unmount(){
1677
1677
  if(this.cache.parent)this.cache.parent.remove(this);
1678
1678
  else if(this.target?.children?.length && [...this.target?.children].includes(this.element)) this.target.removeChild(this.element);
1679
1679
  return this;
@@ -1686,11 +1686,11 @@
1686
1686
  return this
1687
1687
  }
1688
1688
  function renderAfter(t = 1) {
1689
- setTimeout(() => this.render(), t);
1689
+ setTimeout(() => this.mount(), t);
1690
1690
  return this;
1691
1691
  }
1692
1692
  function unrenderAfter(t = 1) {
1693
- setTimeout(() => this.unrender(), t);
1693
+ setTimeout(() => this.unmount(), t);
1694
1694
  return this;
1695
1695
  }
1696
1696
  function after(ui){
@@ -1711,12 +1711,12 @@
1711
1711
  before: before,
1712
1712
  clear: clear,
1713
1713
  insertAt: insertAt,
1714
+ mount: mount,
1714
1715
  prepend: prepend,
1715
1716
  remove: remove,
1716
- render: render,
1717
1717
  renderAfter: renderAfter,
1718
1718
  replaceElementWith: replaceElementWith,
1719
- unrender: unrender,
1719
+ unmount: unmount,
1720
1720
  unrenderAfter: unrenderAfter
1721
1721
  });
1722
1722
 
@@ -2421,7 +2421,7 @@
2421
2421
  // // UI.append(...items);
2422
2422
  // // }
2423
2423
  // // else UI.element=this.element.cloneNode(true);
2424
- // // return UI.render(render);
2424
+ // // return UI.mount(render);
2425
2425
  // }
2426
2426
  // [Symbol.iterator]() {
2427
2427
  // return this.items[Symbol.iterator]();
@@ -2443,9 +2443,9 @@
2443
2443
  // setTarget(tg) {
2444
2444
  // if(this.isBody) return ;
2445
2445
  // if (tg?.isUIElement) tg = tg.element;
2446
- // this.unrender();
2446
+ // this.unmount();
2447
2447
  // this.target = tg;
2448
- // this.render();
2448
+ // this.mount();
2449
2449
  // return this;
2450
2450
  // }
2451
2451
  // describe(label){
@@ -2708,7 +2708,7 @@
2708
2708
  if (typeof h == "number") h += "%";
2709
2709
  this.style({ width: w, height: h });
2710
2710
  this.style({ display: "flex" });
2711
- // this.render();
2711
+ // this.mount();
2712
2712
  }
2713
2713
  get isFlex(){
2714
2714
  return true;
@@ -2816,7 +2816,7 @@
2816
2816
  (async ()=>{
2817
2817
  try{
2818
2818
  const ui = await callback();
2819
- fallback_ui.unrender();
2819
+ fallback_ui.unmount();
2820
2820
  this.append(ui);
2821
2821
  // console.log(content)
2822
2822
  }
@@ -2918,19 +2918,19 @@
2918
2918
  }
2919
2919
 
2920
2920
  connectedCallback() {
2921
- this.render();
2921
+ this.mount();
2922
2922
  }
2923
2923
 
2924
- render() {
2924
+ mount() {
2925
2925
  this.shadowRoot.innerHTML = '';
2926
- this.UIElement = UIElement(this.props).render(this.shadowRoot);
2926
+ this.UIElement = UIElement(this.props).mount(this.shadowRoot);
2927
2927
  }
2928
2928
 
2929
2929
  attributeChangedCallback(name, _, newValue) {
2930
2930
  Object.assign(this.props, {
2931
2931
  [name]: this.mask[name].type(newValue)
2932
2932
  });
2933
- this.render();
2933
+ this.mount();
2934
2934
  }
2935
2935
  }
2936
2936
  );
@@ -2944,7 +2944,7 @@
2944
2944
  this.init();
2945
2945
  }
2946
2946
  init(){
2947
- Object.values(this.cases).filter(n=>n != this.current).forEach(n=>n.unrender());
2947
+ Object.values(this.cases).filter(n=>n != this.current).forEach(n=>n.unmount());
2948
2948
  super.init(this.current.element);
2949
2949
  }
2950
2950
  get current(){
@@ -2971,7 +2971,7 @@
2971
2971
  const svg2str=svg=>(new XMLSerializer()).serializeToString(svg);
2972
2972
  const svg2ascii=svg=>btoa(svg2str(svg));
2973
2973
  const svg2imgUrl=svg=>'data:image/svg+xml;base64,'+svg2ascii(svg);
2974
- const svg2img=(svg,render=true)=>tags.img(svg2imgUrl(svg)).render(render);
2974
+ const svg2img=(svg,render=true)=>tags.img(svg2imgUrl(svg)).mount(render);
2975
2975
 
2976
2976
  // const obj2str=(object)=>{
2977
2977
  // const recursiveToString = (obj) => {
@@ -4861,7 +4861,7 @@
4861
4861
  this.head && this.setHead(this.head);
4862
4862
  this.wrapper && this.setWrapper(this.wrapper);
4863
4863
  this.target && this.setTarget(this.target);
4864
- if(this.wrapper && this.target)this.wrapper.render(this.target);
4864
+ if(this.wrapper && this.target)this.wrapper.mount(this.target);
4865
4865
  }
4866
4866
  setTarget(target){
4867
4867
  if(target instanceof HTMLElement) this.target = target;
@@ -4937,16 +4937,16 @@
4937
4937
  ...Object.entries(routes)
4938
4938
  ]);
4939
4939
  this.clear();
4940
- globalThis.onpopstate = this.render(location.pathname);
4940
+ globalThis.onpopstate = this.mount(location.pathname);
4941
4941
  }
4942
4942
  clear(){
4943
4943
  [...this.routes].forEach(n=>{
4944
- !isDynamic(n[0]) && n[1]?.isUIElement && n[1].unrender();
4944
+ !isDynamic(n[0]) && n[1]?.isUIElement && n[1].unmount();
4945
4945
  });
4946
4946
  // this.wrapper.clear();
4947
4947
  return this;
4948
4948
  }
4949
- render(path){
4949
+ mount(path){
4950
4950
  const [mask, callback] = [...this.routes].find(route=>routesMatcher(route[0],path));
4951
4951
  let element ;
4952
4952
  if(isDynamic(mask)){
@@ -4954,13 +4954,13 @@
4954
4954
  element = callback.call(this,params);
4955
4955
  }
4956
4956
  else {
4957
- callback?.isUIElement && callback.render(this.wrapper);
4957
+ callback?.isUIElement && callback.mount(this.wrapper);
4958
4958
  if(typeof callback === "function") element = callback();
4959
4959
  }
4960
- if(element?.isUIElement) element.render(this.wrapper);
4961
- // if(element?.isZikoApp) element.render(this.wrapper);
4960
+ if(element?.isUIElement) element.mount(this.wrapper);
4961
+ // if(element?.isZikoApp) element.mount(this.wrapper);
4962
4962
  if(element instanceof Promise){
4963
- element.then(e=>e.render(this.wrapper));
4963
+ element.then(e=>e.mount(this.wrapper));
4964
4964
  }
4965
4965
  globalThis.history.pushState({}, "", path);
4966
4966
  return this;