@unsetsoft/ryunixjs 1.1.6-canary.78 → 1.1.6-canary.79

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/Ryunix.js CHANGED
@@ -164,6 +164,7 @@
164
164
  * `setState` function that can be used to update the state.
165
165
  */
166
166
  const useStore = (initial) => {
167
+ console.log('[useStore] Initial state:', initial);
167
168
  const oldHook =
168
169
  vars.wipFiber.alternate &&
169
170
  vars.wipFiber.alternate.hooks &&
@@ -173,14 +174,17 @@
173
174
  queue: oldHook ? [...oldHook.queue] : [],
174
175
  };
175
176
 
177
+ console.log('[useStore] Hook before processing queue:', hook);
176
178
  hook.queue.forEach((action) => {
177
179
  hook.state =
178
180
  typeof action === STRINGS.function ? action(hook.state) : action;
179
181
  });
180
182
 
183
+ console.log('[useStore] Hook after processing queue:', hook);
181
184
  hook.queue = [];
182
185
 
183
186
  const setState = (action) => {
187
+ console.log('[useStore] setState called with action:', action);
184
188
  hook.queue.push(action);
185
189
 
186
190
  vars.wipRoot = {
@@ -199,6 +203,10 @@
199
203
  vars.hookIndex++;
200
204
  }
201
205
 
206
+ console.log('[useStore] Returning state and setState:', [
207
+ hook.state,
208
+ setState,
209
+ ]);
202
210
  return [hook.state, setState]
203
211
  };
204
212
 
@@ -683,6 +691,7 @@
683
691
  * fiber's subtree
684
692
  */
685
693
  const reconcileChildren = (wipFiber, elements) => {
694
+ console.log('[reconcileChildren] Start reconciliation for fiber:', wipFiber);
686
695
  let index = 0;
687
696
  let oldFiber = wipFiber.alternate && wipFiber.alternate.child;
688
697
  let prevSibling = null;
@@ -724,6 +733,7 @@
724
733
  }
725
734
 
726
735
  if (newFiber) {
736
+ console.log('[reconcileChildren] New fiber created:', newFiber);
727
737
  // Ensure hooks and state are properly initialized for new fibers
728
738
  if (!newFiber.alternate) {
729
739
  newFiber.hooks = [];
@@ -731,9 +741,17 @@
731
741
  newFiber.hooks = newFiber.alternate.hooks || [];
732
742
  }
733
743
 
734
- // Propagate parent state to child fibers
744
+ // Synchronize state between parent and child fibers
735
745
  if (wipFiber.hooks) {
736
- newFiber.parentState = wipFiber.hooks.map((hook) => hook.state);
746
+ newFiber.hooks = wipFiber.hooks.map((hook) => ({ ...hook }));
747
+ newFiber.hooks.forEach((hook) => {
748
+ if (hook.queue.length > 0) {
749
+ hook.state = hook.queue.reduce((state, action) => {
750
+ return typeof action === 'function' ? action(state) : action
751
+ }, hook.state);
752
+ hook.queue = [];
753
+ }
754
+ });
737
755
  }
738
756
  }
739
757
 
@@ -751,6 +769,11 @@
751
769
  oldFiber.effectTag = EFFECT_TAGS.DELETION;
752
770
  vars.deletions.push(oldFiber);
753
771
  });
772
+
773
+ console.log(
774
+ '[reconcileChildren] Reconciliation complete for fiber:',
775
+ wipFiber,
776
+ );
754
777
  };
755
778
 
756
779
  var Reconciler = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("lodash")):"function"==typeof define&&define.amd?define(["exports","lodash"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Ryunix={},e.lodash)}(this,(function(e,t){"use strict";let o={containerRoot:{},nextUnitOfWork:{},currentRoot:{},wipRoot:{},deletions:[],wipFiber:{},hookIndex:0};const n=/[A-Z]/g,r=Object.freeze({TEXT_ELEMENT:Symbol("text.element"),Ryunix_ELEMENT:Symbol("ryunix.element"),RYUNIX_EFFECT:Symbol("ryunix.effect"),RYUNIX_MEMO:Symbol("ryunix.memo"),RYUNIX_URL_QUERY:Symbol("ryunix.urlQuery"),RYUNIX_REF:Symbol("ryunix.ref"),RYUNIX_STORE:Symbol("ryunix.store"),RYUNIX_REDUCE:Symbol("ryunix.reduce")}),s=Object.freeze({object:"object",function:"function",style:"ryunix-style",className:"ryunix-class",children:"children",boolean:"boolean",string:"string"}),i=Object.freeze({style:"style",className:"className"}),a=Object.freeze({PLACEMENT:Symbol("ryunix.reconciler.status.placement").toString(),UPDATE:Symbol("ryunix.reconciler.status.update").toString(),DELETION:Symbol("ryunix.reconciler.status.deletion").toString()}),l=e=>`${e}-${Math.random().toString(36).substring(2,9)}`,c=(e,t)=>(t=t||[],null==e||typeof e==s.boolean||(Array.isArray(e)?e.some((e=>{c(e,t)})):t.push(e)),t),p=(e,t,...o)=>{o=c(o,[]);const n=t&&t.key?l(t.key):l(r.Ryunix_ELEMENT.toString());return{type:e,props:{...t,key:n,children:o.map((e=>typeof e===s.object?e:u(e)))}}},u=e=>({type:r.TEXT_ELEMENT,props:{nodeValue:e,children:[]}}),d=(e,t)=>{o.wipRoot={dom:t,props:{children:[e]},alternate:o.currentRoot},o.deletions=[],o.nextUnitOfWork=o.wipRoot},f=e=>{const t=o.wipFiber.alternate&&o.wipFiber.alternate.hooks&&o.wipFiber.alternate.hooks[o.hookIndex],n={state:t?t.state:e,queue:t?[...t.queue]:[]};n.queue.forEach((e=>{n.state=typeof e===s.function?e(n.state):e})),n.queue=[];return o.wipFiber&&o.wipFiber.hooks&&(o.wipFiber.hooks.push(n),o.hookIndex++),[n.state,e=>{n.queue.push(e),o.wipRoot={dom:o.currentRoot.dom,props:{...o.currentRoot.props},alternate:o.currentRoot},o.nextUnitOfWork=o.wipRoot,o.deletions=[]}]},h=(e,n)=>{const s=o.wipFiber.alternate&&o.wipFiber.alternate.hooks&&o.wipFiber.alternate.hooks[o.hookIndex],i={type:r.RYUNIX_EFFECT,deps:n};s&&t.isEqual(s.deps,i.deps)||e(),o.wipFiber.hooks&&(o.wipFiber.hooks.push(i),o.hookIndex++)},m=(e,n)=>{const s=o.wipFiber.alternate&&o.wipFiber.alternate.hooks&&o.wipFiber.alternate.hooks[o.hookIndex],i={type:r.RYUNIX_MEMO,value:null,deps:n};return s&&t.isEqual(s.deps,i.deps)?i.value=s.value:i.value=e(),o.wipFiber.hooks&&(o.wipFiber.hooks.push(i),o.hookIndex++),i.value},y=()=>{const e=new URLSearchParams(window.location.search),t={};for(let[o,n]of e.entries())t[o]=n;return t},b=e=>e.startsWith("on"),E=e=>e!==s.children&&!b(e),k=(e,t)=>o=>e[o]!==t[o],w=e=>t=>!(t in e),R=e=>{e.hooks&&e.hooks.filter((e=>e.tag===r.RYUNIX_EFFECT&&e.cancel)).forEach((e=>{e.cancel()}))},x=e=>{e.hooks&&e.hooks.filter((e=>e.tag===r.RYUNIX_EFFECT&&e.effect)).forEach((e=>{e.cancel=e.effect()}))},F=e=>{const t=e.type==r.TEXT_ELEMENT?document.createTextNode(""):document.createElement(e.type);return _(t,{},e.props),t},_=(e,t,o)=>{Object.keys(t).filter(b).filter((e=>w(o)(e)||k(t,o)(e))).forEach((o=>{const n=o.toLowerCase().substring(2);e.removeEventListener(n,t[o])})),Object.keys(t).filter(E).filter(w(o)).forEach((t=>{e[t]=""})),Object.keys(o).filter(E).filter(k(t,o)).forEach((n=>{if(n===s.style)N(e,o["ryunix-style"]);else if(n===i.style)N(e,o.style);else if(n===s.className){if(""===o["ryunix-class"])throw new Error("data-class cannot be empty.");t["ryunix-class"]&&e.classList.remove(...t["ryunix-class"].split(/\s+/)),e.classList.add(...o["ryunix-class"].split(/\s+/))}else if(n===i.className){if(""===o.className)throw new Error("className cannot be empty.");t.className&&e.classList.remove(...t.className.split(/\s+/)),e.classList.add(...o.className.split(/\s+/))}else e[n]=o[n]})),Object.keys(o).filter(b).filter(k(t,o)).forEach((t=>{const n=t.toLowerCase().substring(2);e.addEventListener(n,o[t])}))},N=(e,t)=>{e.style=Object.keys(t).reduce(((e,o)=>e+=`${o.replace(n,(function(e){return"-"+e.toLowerCase()}))}: ${t[o]};`),"")};var g=Object.freeze({__proto__:null,DomStyle:N,createDom:F,updateDom:_});const T=()=>{o.deletions.forEach(v),o.wipRoot&&o.wipRoot.child&&(v(o.wipRoot.child),o.currentRoot=o.wipRoot),o.wipRoot=void 0},v=e=>{if(!e)return;let t=e.parent;for(;!t.dom;)t=t.parent;const o=t.dom;if(e.effectTag===a.PLACEMENT&&null!=e.dom)o.appendChild(e.dom),x(e);else if(e.effectTag===a.UPDATE&&null!=e.dom)R(e),_(e.dom,e.alternate.props,e.props),x(e);else if(e.effectTag===a.DELETION)return O(e,o),void R(e);v(e.child),v(e.sibling)},O=(e,t)=>{e.dom?t.removeChild(e.dom):O(e.child,t)};var I=Object.freeze({__proto__:null,commitDeletion:O,commitRoot:T,commitWork:v});const L=(e,t)=>{let n=0,r=e.alternate&&e.alternate.child,s=null;const i=new Map;for(;r;){const e=r.props.key||r.type;i.set(e,r),r=r.sibling}for(;n<t.length;){const o=t[n],r=o.props.key||o.type,l=i.get(r);let c;l&&o&&o.type===l.type?(c={type:l.type,props:o.props,dom:l.dom,parent:e,alternate:l,effectTag:a.UPDATE},i.delete(r)):o&&(c={type:o.type,props:o.props,dom:void 0,parent:e,alternate:void 0,effectTag:a.PLACEMENT}),c&&(c.alternate?c.hooks=c.alternate.hooks||[]:c.hooks=[],e.hooks&&(c.parentState=e.hooks.map((e=>e.state)))),0===n?e.child=c:s&&(s.sibling=c),s=c,n++}i.forEach((e=>{e.effectTag=a.DELETION,o.deletions.push(e)}))};var U=Object.freeze({__proto__:null,reconcileChildren:L});const C=e=>{o.wipFiber=e,o.hookIndex=0,o.wipFiber.hooks=[];const t=e.type(e.props);let n=Array.isArray(t)?t:[t];L(e,n)},S=e=>{e.dom||(e.dom=F(e)),L(e,e.props.children)};var j=Object.freeze({__proto__:null,updateFunctionComponent:C,updateHostComponent:S});const M=e=>{let t=!1;for(;o.nextUnitOfWork&&!t;)o.nextUnitOfWork=X(o.nextUnitOfWork),t=e.timeRemaining()<1;!o.nextUnitOfWork&&o.wipRoot&&T(),requestIdleCallback(M)};requestIdleCallback(M);const X=e=>{if(e.type instanceof Function?C(e):S(e),e.child)return e.child;let t=e;for(;t;){if(t.sibling)return t.sibling;t=t.parent}};var D={createElement:p,render:d,init:(e,t="__ryunix")=>{o.containerRoot=document.getElementById(t),d(e,o.containerRoot)},Fragment:e=>e.children,Dom:g,Workers:Object.freeze({__proto__:null,performUnitOfWork:X,workLoop:M}),Reconciler:U,Components:j,Commits:I};window.Ryunix=D,e.default=D,e.useCallback=(e,t)=>m((()=>e),t),e.useEffect=h,e.useMemo=m,e.useQuery=y,e.useRef=e=>{const t=o.wipFiber.alternate&&o.wipFiber.alternate.hooks&&o.wipFiber.alternate.hooks[o.hookIndex],n={type:r.RYUNIX_REF,value:t?t.value:{current:e}};return o.wipFiber.hooks&&(o.wipFiber.hooks.push(n),o.hookIndex++),n.value},e.useRouter=e=>{const[t,o]=f(window.location.pathname),n=(e,t)=>{const o=t.split("?")[0],r=e.find((e=>e.NotFound)),s=r?{route:{component:r.NotFound},params:{}}:{route:{component:null},params:{}};for(const r of e){if(r.subRoutes){const e=n(r.subRoutes,t);if(e)return e}if("*"===r.path)return s;if(!r.path||"string"!=typeof r.path){console.warn("Invalid route detected:",r),console.info("if you are using { NotFound: NotFound } please add { path: '*', NotFound: NotFound }");continue}const e=[],i=new RegExp(`^${r.path.replace(/:\w+/g,(t=>(e.push(t.substring(1)),"([^/]+)")))}$`),a=o.match(i);if(a){return{route:r,params:e.reduce(((e,t,o)=>(e[t]=a[o+1],e)),{})}}}return s},r=e=>{window.history.pushState({},"",e),i(e)},i=e=>{const t=e.split("?")[0];o(t)};h((()=>{const e=()=>i(window.location.pathname);return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)}),[]);const a=n(e,t)||{};return{Children:()=>{const e=y(),{route:t}=a;return t&&t.component&&typeof t.component===s.function?t.component({params:a.params||{},query:e}):(console.error("Component not found for current path or the component is not a valid function:",a),null)},NavLink:({to:e,...t})=>p("a",{href:e,onClick:t=>{t.preventDefault(),r(e)},...t},t.children),navigate:r}},e.useStore=f,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("lodash")):"function"==typeof define&&define.amd?define(["exports","lodash"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self).Ryunix={},e.lodash)}(this,(function(e,o){"use strict";let t={containerRoot:{},nextUnitOfWork:{},currentRoot:{},wipRoot:{},deletions:[],wipFiber:{},hookIndex:0};const n=/[A-Z]/g,r=Object.freeze({TEXT_ELEMENT:Symbol("text.element"),Ryunix_ELEMENT:Symbol("ryunix.element"),RYUNIX_EFFECT:Symbol("ryunix.effect"),RYUNIX_MEMO:Symbol("ryunix.memo"),RYUNIX_URL_QUERY:Symbol("ryunix.urlQuery"),RYUNIX_REF:Symbol("ryunix.ref"),RYUNIX_STORE:Symbol("ryunix.store"),RYUNIX_REDUCE:Symbol("ryunix.reduce")}),s=Object.freeze({object:"object",function:"function",style:"ryunix-style",className:"ryunix-class",children:"children",boolean:"boolean",string:"string"}),i=Object.freeze({style:"style",className:"className"}),l=Object.freeze({PLACEMENT:Symbol("ryunix.reconciler.status.placement").toString(),UPDATE:Symbol("ryunix.reconciler.status.update").toString(),DELETION:Symbol("ryunix.reconciler.status.deletion").toString()}),a=e=>`${e}-${Math.random().toString(36).substring(2,9)}`,c=(e,o)=>(o=o||[],null==e||typeof e==s.boolean||(Array.isArray(e)?e.some((e=>{c(e,o)})):o.push(e)),o),p=(e,o,...t)=>{t=c(t,[]);const n=o&&o.key?a(o.key):a(r.Ryunix_ELEMENT.toString());return{type:e,props:{...o,key:n,children:t.map((e=>typeof e===s.object?e:u(e)))}}},u=e=>({type:r.TEXT_ELEMENT,props:{nodeValue:e,children:[]}}),d=(e,o)=>{t.wipRoot={dom:o,props:{children:[e]},alternate:t.currentRoot},t.deletions=[],t.nextUnitOfWork=t.wipRoot},f=e=>{console.log("[useStore] Initial state:",e);const o=t.wipFiber.alternate&&t.wipFiber.alternate.hooks&&t.wipFiber.alternate.hooks[t.hookIndex],n={state:o?o.state:e,queue:o?[...o.queue]:[]};console.log("[useStore] Hook before processing queue:",n),n.queue.forEach((e=>{n.state=typeof e===s.function?e(n.state):e})),console.log("[useStore] Hook after processing queue:",n),n.queue=[];const r=e=>{console.log("[useStore] setState called with action:",e),n.queue.push(e),t.wipRoot={dom:t.currentRoot.dom,props:{...t.currentRoot.props},alternate:t.currentRoot},t.nextUnitOfWork=t.wipRoot,t.deletions=[]};return t.wipFiber&&t.wipFiber.hooks&&(t.wipFiber.hooks.push(n),t.hookIndex++),console.log("[useStore] Returning state and setState:",[n.state,r]),[n.state,r]},h=(e,n)=>{const s=t.wipFiber.alternate&&t.wipFiber.alternate.hooks&&t.wipFiber.alternate.hooks[t.hookIndex],i={type:r.RYUNIX_EFFECT,deps:n};s&&o.isEqual(s.deps,i.deps)||e(),t.wipFiber.hooks&&(t.wipFiber.hooks.push(i),t.hookIndex++)},m=(e,n)=>{const s=t.wipFiber.alternate&&t.wipFiber.alternate.hooks&&t.wipFiber.alternate.hooks[t.hookIndex],i={type:r.RYUNIX_MEMO,value:null,deps:n};return s&&o.isEqual(s.deps,i.deps)?i.value=s.value:i.value=e(),t.wipFiber.hooks&&(t.wipFiber.hooks.push(i),t.hookIndex++),i.value},y=()=>{const e=new URLSearchParams(window.location.search),o={};for(let[t,n]of e.entries())o[t]=n;return o},b=e=>e.startsWith("on"),E=e=>e!==s.children&&!b(e),k=(e,o)=>t=>e[t]!==o[t],w=e=>o=>!(o in e),R=e=>{e.hooks&&e.hooks.filter((e=>e.tag===r.RYUNIX_EFFECT&&e.cancel)).forEach((e=>{e.cancel()}))},g=e=>{e.hooks&&e.hooks.filter((e=>e.tag===r.RYUNIX_EFFECT&&e.effect)).forEach((e=>{e.cancel=e.effect()}))},x=e=>{const o=e.type==r.TEXT_ELEMENT?document.createTextNode(""):document.createElement(e.type);return F(o,{},e.props),o},F=(e,o,t)=>{Object.keys(o).filter(b).filter((e=>w(t)(e)||k(o,t)(e))).forEach((t=>{const n=t.toLowerCase().substring(2);e.removeEventListener(n,o[t])})),Object.keys(o).filter(E).filter(w(t)).forEach((o=>{e[o]=""})),Object.keys(t).filter(E).filter(k(o,t)).forEach((n=>{if(n===s.style)N(e,t["ryunix-style"]);else if(n===i.style)N(e,t.style);else if(n===s.className){if(""===t["ryunix-class"])throw new Error("data-class cannot be empty.");o["ryunix-class"]&&e.classList.remove(...o["ryunix-class"].split(/\s+/)),e.classList.add(...t["ryunix-class"].split(/\s+/))}else if(n===i.className){if(""===t.className)throw new Error("className cannot be empty.");o.className&&e.classList.remove(...o.className.split(/\s+/)),e.classList.add(...t.className.split(/\s+/))}else e[n]=t[n]})),Object.keys(t).filter(b).filter(k(o,t)).forEach((o=>{const n=o.toLowerCase().substring(2);e.addEventListener(n,t[o])}))},N=(e,o)=>{e.style=Object.keys(o).reduce(((e,t)=>e+=`${t.replace(n,(function(e){return"-"+e.toLowerCase()}))}: ${o[t]};`),"")};var _=Object.freeze({__proto__:null,DomStyle:N,createDom:x,updateDom:F});const T=()=>{t.deletions.forEach(v),t.wipRoot&&t.wipRoot.child&&(v(t.wipRoot.child),t.currentRoot=t.wipRoot),t.wipRoot=void 0},v=e=>{if(!e)return;let o=e.parent;for(;!o.dom;)o=o.parent;const t=o.dom;if(e.effectTag===l.PLACEMENT&&null!=e.dom)t.appendChild(e.dom),g(e);else if(e.effectTag===l.UPDATE&&null!=e.dom)R(e),F(e.dom,e.alternate.props,e.props),g(e);else if(e.effectTag===l.DELETION)return I(e,t),void R(e);v(e.child),v(e.sibling)},I=(e,o)=>{e.dom?o.removeChild(e.dom):I(e.child,o)};var O=Object.freeze({__proto__:null,commitDeletion:I,commitRoot:T,commitWork:v});const S=(e,o)=>{console.log("[reconcileChildren] Start reconciliation for fiber:",e);let n=0,r=e.alternate&&e.alternate.child,s=null;const i=new Map;for(;r;){const e=r.props.key||r.type;i.set(e,r),r=r.sibling}for(;n<o.length;){const t=o[n],r=t.props.key||t.type,a=i.get(r);let c;a&&t&&t.type===a.type?(c={type:a.type,props:t.props,dom:a.dom,parent:e,alternate:a,effectTag:l.UPDATE},i.delete(r)):t&&(c={type:t.type,props:t.props,dom:void 0,parent:e,alternate:void 0,effectTag:l.PLACEMENT}),c&&(console.log("[reconcileChildren] New fiber created:",c),c.alternate?c.hooks=c.alternate.hooks||[]:c.hooks=[],e.hooks&&(c.hooks=e.hooks.map((e=>({...e}))),c.hooks.forEach((e=>{e.queue.length>0&&(e.state=e.queue.reduce(((e,o)=>"function"==typeof o?o(e):o),e.state),e.queue=[])})))),0===n?e.child=c:s&&(s.sibling=c),s=c,n++}i.forEach((e=>{e.effectTag=l.DELETION,t.deletions.push(e)})),console.log("[reconcileChildren] Reconciliation complete for fiber:",e)};var C=Object.freeze({__proto__:null,reconcileChildren:S});const L=e=>{t.wipFiber=e,t.hookIndex=0,t.wipFiber.hooks=[];const o=e.type(e.props);let n=Array.isArray(o)?o:[o];S(e,n)},U=e=>{e.dom||(e.dom=x(e)),S(e,e.props.children)};var j=Object.freeze({__proto__:null,updateFunctionComponent:L,updateHostComponent:U});const q=e=>{let o=!1;for(;t.nextUnitOfWork&&!o;)t.nextUnitOfWork=M(t.nextUnitOfWork),o=e.timeRemaining()<1;!t.nextUnitOfWork&&t.wipRoot&&T(),requestIdleCallback(q)};requestIdleCallback(q);const M=e=>{if(e.type instanceof Function?L(e):U(e),e.child)return e.child;let o=e;for(;o;){if(o.sibling)return o.sibling;o=o.parent}};var X={createElement:p,render:d,init:(e,o="__ryunix")=>{t.containerRoot=document.getElementById(o),d(e,t.containerRoot)},Fragment:e=>e.children,Dom:_,Workers:Object.freeze({__proto__:null,performUnitOfWork:M,workLoop:q}),Reconciler:C,Components:j,Commits:O};window.Ryunix=X,e.default=X,e.useCallback=(e,o)=>m((()=>e),o),e.useEffect=h,e.useMemo=m,e.useQuery=y,e.useRef=e=>{const o=t.wipFiber.alternate&&t.wipFiber.alternate.hooks&&t.wipFiber.alternate.hooks[t.hookIndex],n={type:r.RYUNIX_REF,value:o?o.value:{current:e}};return t.wipFiber.hooks&&(t.wipFiber.hooks.push(n),t.hookIndex++),n.value},e.useRouter=e=>{const[o,t]=f(window.location.pathname),n=(e,o)=>{const t=o.split("?")[0],r=e.find((e=>e.NotFound)),s=r?{route:{component:r.NotFound},params:{}}:{route:{component:null},params:{}};for(const r of e){if(r.subRoutes){const e=n(r.subRoutes,o);if(e)return e}if("*"===r.path)return s;if(!r.path||"string"!=typeof r.path){console.warn("Invalid route detected:",r),console.info("if you are using { NotFound: NotFound } please add { path: '*', NotFound: NotFound }");continue}const e=[],i=new RegExp(`^${r.path.replace(/:\w+/g,(o=>(e.push(o.substring(1)),"([^/]+)")))}$`),l=t.match(i);if(l){return{route:r,params:e.reduce(((e,o,t)=>(e[o]=l[t+1],e)),{})}}}return s},r=e=>{window.history.pushState({},"",e),i(e)},i=e=>{const o=e.split("?")[0];t(o)};h((()=>{const e=()=>i(window.location.pathname);return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)}),[]);const l=n(e,o)||{};return{Children:()=>{const e=y(),{route:o}=l;return o&&o.component&&typeof o.component===s.function?o.component({params:l.params||{},query:e}):(console.error("Component not found for current path or the component is not a valid function:",l),null)},NavLink:({to:e,...o})=>p("a",{href:e,onClick:o=>{o.preventDefault(),r(e)},...o},o.children),navigate:r}},e.useStore=f,Object.defineProperty(e,"__esModule",{value:!0})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unsetsoft/ryunixjs",
3
- "version": "1.1.6-canary.78",
3
+ "version": "1.1.6-canary.79",
4
4
  "license": "MIT",
5
5
  "main": "./dist/Ryunix.min.js",
6
6
  "types": "./dist/Ryunix.d.ts",