@argon-router/react 0.2.2 → 0.3.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/README.md CHANGED
@@ -0,0 +1,21 @@
1
+ # ☄️ argon-router/react
2
+
3
+ Router without a headache
4
+
5
+ > [!WARNING]
6
+ > argon-router is extermely unstable & maybe buggy. DO NOT USE IN PRODUCTION!
7
+
8
+ ## Documentation
9
+
10
+ For additional information, guides and api reference visit [documentation site](https://movpushmov.dev/argon-router/)
11
+
12
+ ## Packages
13
+
14
+ - [@argon-router/core](https://www.npmjs.com/package/@argon-router/core)
15
+ - [@argon-router/react](https://www.npmjs.com/package/@argon-router/react)
16
+
17
+ ## Installation
18
+
19
+ ```
20
+ npm i @argon-router/react
21
+ ```
package/dist/index.cjs CHANGED
@@ -1,30 +1,31 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("react"),re=require("effector-react");var ee={exports:{}},W={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("react"),X=require("effector-react");var L={exports:{}},k={};/**
2
2
  * @license React
3
- * react-jsx-runtime.production.min.js
3
+ * react-jsx-runtime.production.js
4
4
  *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var je;function pr(){if(je)return W;je=1;var c=K,y=Symbol.for("react.element"),b=Symbol.for("react.fragment"),R=Object.prototype.hasOwnProperty,g=c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,S={key:!0,ref:!0,__self:!0,__source:!0};function m(E,i,T){var v,w={},j=null,V=null;T!==void 0&&(j=""+T),i.key!==void 0&&(j=""+i.key),i.ref!==void 0&&(V=i.ref);for(v in i)R.call(i,v)&&!S.hasOwnProperty(v)&&(w[v]=i[v]);if(E&&E.defaultProps)for(v in i=E.defaultProps,i)w[v]===void 0&&(w[v]=i[v]);return{$$typeof:y,type:E,key:j,ref:V,props:w,_owner:g.current}}return W.Fragment=b,W.jsx=m,W.jsxs=m,W}var L={};/**
9
+ */var Ee;function Oe(){if(Ee)return k;Ee=1;var a=Symbol.for("react.transitional.element"),v=Symbol.for("react.fragment");function d(E,i,l){var b=null;if(l!==void 0&&(b=""+l),i.key!==void 0&&(b=""+i.key),"key"in i){l={};for(var g in i)g!=="key"&&(l[g]=i[g])}else l=i;return i=l.ref,{$$typeof:a,type:E,key:b,ref:i!==void 0?i:null,props:l}}return k.Fragment=v,k.jsx=d,k.jsxs=d,k}var O={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Ce;function yr(){return Ce||(Ce=1,process.env.NODE_ENV!=="production"&&function(){var c=K,y=Symbol.for("react.element"),b=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),E=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),ne=Symbol.iterator,ke="@@iterator";function De(e){if(e===null||typeof e!="object")return null;var r=ne&&e[ne]||e[ke];return typeof r=="function"?r:null}var k=c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function d(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];Fe("error",e,t)}}function Fe(e,r,t){{var n=k.ReactDebugCurrentFrame,u=n.getStackAddendum();u!==""&&(r+="%s",t=t.concat([u]));var s=t.map(function(o){return String(o)});s.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,s)}}var Ae=!1,Ie=!1,$e=!1,We=!1,Le=!1,ae;ae=Symbol.for("react.module.reference");function Ve(e){return!!(typeof e=="string"||typeof e=="function"||e===R||e===S||Le||e===g||e===T||e===v||We||e===V||Ae||Ie||$e||typeof e=="object"&&e!==null&&(e.$$typeof===j||e.$$typeof===w||e.$$typeof===m||e.$$typeof===E||e.$$typeof===i||e.$$typeof===ae||e.getModuleId!==void 0))}function Ye(e,r,t){var n=e.displayName;if(n)return n;var u=r.displayName||r.name||"";return u!==""?t+"("+u+")":t}function oe(e){return e.displayName||"Context"}function P(e){if(e==null)return null;if(typeof e.tag=="number"&&d("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case R:return"Fragment";case b:return"Portal";case S:return"Profiler";case g:return"StrictMode";case T:return"Suspense";case v:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case E:var r=e;return oe(r)+".Consumer";case m:var t=e;return oe(t._context)+".Provider";case i:return Ye(e,e.render,"ForwardRef");case w:var n=e.displayName||null;return n!==null?n:P(e.type)||"Memo";case j:{var u=e,s=u._payload,o=u._init;try{return P(o(s))}catch{return null}}}return null}var C=Object.assign,A=0,ie,ue,se,le,fe,ce,de;function ve(){}ve.__reactDisabledLog=!0;function Ue(){{if(A===0){ie=console.log,ue=console.info,se=console.warn,le=console.error,fe=console.group,ce=console.groupCollapsed,de=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ve,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}A++}}function Me(){{if(A--,A===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:C({},e,{value:ie}),info:C({},e,{value:ue}),warn:C({},e,{value:se}),error:C({},e,{value:le}),group:C({},e,{value:fe}),groupCollapsed:C({},e,{value:ce}),groupEnd:C({},e,{value:de})})}A<0&&d("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var q=k.ReactCurrentDispatcher,B;function Y(e,r,t){{if(B===void 0)try{throw Error()}catch(u){var n=u.stack.trim().match(/\n( *(at )?)/);B=n&&n[1]||""}return`
18
- `+B+e}}var J=!1,U;{var Ne=typeof WeakMap=="function"?WeakMap:Map;U=new Ne}function pe(e,r){if(!e||J)return"";{var t=U.get(e);if(t!==void 0)return t}var n;J=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var s;s=q.current,q.current=null,Ue();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(h){n=h}Reflect.construct(e,[],o)}else{try{o.call()}catch(h){n=h}e.call(o.prototype)}}else{try{throw Error()}catch(h){n=h}e()}}catch(h){if(h&&n&&typeof h.stack=="string"){for(var a=h.stack.split(`
19
- `),p=n.stack.split(`
20
- `),l=a.length-1,f=p.length-1;l>=1&&f>=0&&a[l]!==p[f];)f--;for(;l>=1&&f>=0;l--,f--)if(a[l]!==p[f]){if(l!==1||f!==1)do if(l--,f--,f<0||a[l]!==p[f]){var _=`
21
- `+a[l].replace(" at new "," at ");return e.displayName&&_.includes("<anonymous>")&&(_=_.replace("<anonymous>",e.displayName)),typeof e=="function"&&U.set(e,_),_}while(l>=1&&f>=0);break}}}finally{J=!1,q.current=s,Me(),Error.prepareStackTrace=u}var F=e?e.displayName||e.name:"",x=F?Y(F):"";return typeof e=="function"&&U.set(e,x),x}function Ke(e,r,t){return pe(e,!1)}function qe(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function M(e,r,t){if(e==null)return"";if(typeof e=="function")return pe(e,qe(e));if(typeof e=="string")return Y(e);switch(e){case T:return Y("Suspense");case v:return Y("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case i:return Ke(e.render);case w:return M(e.type,r,t);case j:{var n=e,u=n._payload,s=n._init;try{return M(s(u),r,t)}catch{}}}return""}var I=Object.prototype.hasOwnProperty,ye={},Re=k.ReactDebugCurrentFrame;function N(e){if(e){var r=e._owner,t=M(e.type,e._source,r?r.type:null);Re.setExtraStackFrame(t)}else Re.setExtraStackFrame(null)}function Be(e,r,t,n,u){{var s=Function.call.bind(I);for(var o in e)if(s(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var p=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(l){a=l}a&&!(a instanceof Error)&&(N(u),d("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,o,typeof a),N(null)),a instanceof Error&&!(a.message in ye)&&(ye[a.message]=!0,N(u),d("Failed %s type: %s",t,a.message),N(null))}}}var Je=Array.isArray;function G(e){return Je(e)}function Ge(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function ze(e){try{return he(e),!1}catch{return!0}}function he(e){return""+e}function ge(e){if(ze(e))return d("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ge(e)),he(e)}var $=k.ReactCurrentOwner,Xe={key:!0,ref:!0,__self:!0,__source:!0},be,Ee,z;z={};function He(e){if(I.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Ze(e){if(I.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Qe(e,r){if(typeof e.ref=="string"&&$.current&&r&&$.current.stateNode!==r){var t=P($.current.type);z[t]||(d('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',P($.current.type),e.ref),z[t]=!0)}}function er(e,r){{var t=function(){be||(be=!0,d("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function rr(e,r){{var t=function(){Ee||(Ee=!0,d("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var tr=function(e,r,t,n,u,s,o){var a={$$typeof:y,type:e,key:r,ref:t,props:o,_owner:s};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:u}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function nr(e,r,t,n,u){{var s,o={},a=null,p=null;t!==void 0&&(ge(t),a=""+t),Ze(r)&&(ge(r.key),a=""+r.key),He(r)&&(p=r.ref,Qe(r,u));for(s in r)I.call(r,s)&&!Xe.hasOwnProperty(s)&&(o[s]=r[s]);if(e&&e.defaultProps){var l=e.defaultProps;for(s in l)o[s]===void 0&&(o[s]=l[s])}if(a||p){var f=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&er(o,f),p&&rr(o,f)}return tr(e,a,p,u,n,$.current,o)}}var X=k.ReactCurrentOwner,_e=k.ReactDebugCurrentFrame;function D(e){if(e){var r=e._owner,t=M(e.type,e._source,r?r.type:null);_e.setExtraStackFrame(t)}else _e.setExtraStackFrame(null)}var H;H=!1;function Z(e){return typeof e=="object"&&e!==null&&e.$$typeof===y}function me(){{if(X.current){var e=P(X.current.type);if(e)return`
22
-
23
- Check the render method of \``+e+"`."}return""}}function ar(e){return""}var we={};function or(e){{var r=me();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
24
-
25
- Check the top-level render call using <`+t+">.")}return r}}function Te(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=or(r);if(we[t])return;we[t]=!0;var n="";e&&e._owner&&e._owner!==X.current&&(n=" It was passed a child from "+P(e._owner.type)+"."),D(e),d('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),D(null)}}function Pe(e,r){{if(typeof e!="object")return;if(G(e))for(var t=0;t<e.length;t++){var n=e[t];Z(n)&&Te(n,r)}else if(Z(e))e._store&&(e._store.validated=!0);else if(e){var u=De(e);if(typeof u=="function"&&u!==e.entries)for(var s=u.call(e),o;!(o=s.next()).done;)Z(o.value)&&Te(o.value,r)}}}function ir(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===i||r.$$typeof===w))t=r.propTypes;else return;if(t){var n=P(r);Be(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!H){H=!0;var u=P(r);d("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",u||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&d("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ur(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){D(e),d("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),D(null);break}}e.ref!==null&&(D(e),d("Invalid attribute `ref` supplied to `React.Fragment`."),D(null))}}var Oe={};function Se(e,r,t,n,u,s){{var o=Ve(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var p=ar();p?a+=p:a+=me();var l;e===null?l="null":G(e)?l="array":e!==void 0&&e.$$typeof===y?(l="<"+(P(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):l=typeof e,d("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,a)}var f=nr(e,r,t,u,s);if(f==null)return f;if(o){var _=r.children;if(_!==void 0)if(n)if(G(_)){for(var F=0;F<_.length;F++)Pe(_[F],e);Object.freeze&&Object.freeze(_)}else d("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Pe(_,e)}if(I.call(r,"key")){var x=P(e),h=Object.keys(r).filter(function(vr){return vr!=="key"}),Q=h.length>0?"{key: someKey, "+h.join(": ..., ")+": ...}":"{key: someKey}";if(!Oe[x+Q]){var dr=h.length>0?"{"+h.join(": ..., ")+": ...}":"{}";d(`A props object containing a "key" prop is being spread into JSX:
17
+ */var be;function Se(){return be||(be=1,process.env.NODE_ENV!=="production"&&function(){function a(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===pe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Y:return"Fragment";case Te:return"Portal";case I:return"Profiler";case Z:return"StrictMode";case $:return"Suspense";case U:return"SuspenseList"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case D:return(e.displayName||"Context")+".Provider";case Q:return(e._context.displayName||"Context")+".Consumer";case M:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case W:return r=e.displayName||null,r!==null?r:a(e.type)||"Memo";case V:r=e._payload,e=e._init;try{return a(e(r))}catch{}}return null}function v(e){return""+e}function d(e){try{v(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,n=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",n),v(e)}}function E(){}function i(){if(p===0){te=console.log,oe=console.info,ne=console.warn,ae=console.error,ue=console.group,ie=console.groupCollapsed,se=console.groupEnd;var e={configurable:!0,enumerable:!0,value:E,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}p++}function l(){if(p--,p===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:h({},e,{value:te}),info:h({},e,{value:oe}),warn:h({},e,{value:ne}),error:h({},e,{value:ae}),group:h({},e,{value:ue}),groupCollapsed:h({},e,{value:ie}),groupEnd:h({},e,{value:se})})}0>p&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function b(e){if(z===void 0)try{throw Error()}catch(t){var r=t.stack.trim().match(/\n( *(at )?)/);z=r&&r[1]||"",le=-1<t.stack.indexOf(`
18
+ at`)?" (<anonymous>)":-1<t.stack.indexOf("@")?"@unknown:0:0":""}return`
19
+ `+z+e+le}function g(e,r){if(!e||G)return"";var t=J.get(e);if(t!==void 0)return t;G=!0,t=Error.prepareStackTrace,Error.prepareStackTrace=void 0;var n=null;n=_.H,_.H=null,i();try{var c={DetermineComponentFrameRoot:function(){try{if(r){var y=function(){throw Error()};if(Object.defineProperty(y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(y,[])}catch(w){var S=w}Reflect.construct(e,[],y)}else{try{y.call()}catch(w){S=w}e.call(y.prototype)}}else{try{throw Error()}catch(w){S=w}(y=e())&&typeof y.catch=="function"&&y.catch(function(){})}}catch(w){if(w&&S&&typeof w.stack=="string")return[w.stack,S.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=c.DetermineComponentFrameRoot(),R=o[0],j=o[1];if(R&&j){var f=R.split(`
20
+ `),T=j.split(`
21
+ `);for(o=u=0;u<f.length&&!f[u].includes("DetermineComponentFrameRoot");)u++;for(;o<T.length&&!T[o].includes("DetermineComponentFrameRoot");)o++;if(u===f.length||o===T.length)for(u=f.length-1,o=T.length-1;1<=u&&0<=o&&f[u]!==T[o];)o--;for(;1<=u&&0<=o;u--,o--)if(f[u]!==T[o]){if(u!==1||o!==1)do if(u--,o--,0>o||f[u]!==T[o]){var C=`
22
+ `+f[u].replace(" at new "," at ");return e.displayName&&C.includes("<anonymous>")&&(C=C.replace("<anonymous>",e.displayName)),typeof e=="function"&&J.set(e,C),C}while(1<=u&&0<=o);break}}}finally{G=!1,_.H=n,l(),Error.prepareStackTrace=t}return f=(f=e?e.displayName||e.name:"")?b(f):"",typeof e=="function"&&J.set(e,f),f}function m(e){if(e==null)return"";if(typeof e=="function"){var r=e.prototype;return g(e,!(!r||!r.isReactComponent))}if(typeof e=="string")return b(e);switch(e){case $:return b("Suspense");case U:return b("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case M:return e=g(e.render,!1),e;case W:return m(e.type);case V:r=e._payload,e=e._init;try{return m(e(r))}catch{}}return""}function s(){var e=_.A;return e===null?null:e.getOwner()}function A(e){if(re.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function we(e,r){function t(){ce||(ce=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function xe(){var e=a(this.type);return fe[e]||(fe[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function ye(e,r,t,n,c,u){return t=u.ref,e={$$typeof:P,type:e,key:r,props:u,_owner:c},(t!==void 0?t:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:xe}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function B(e,r,t,n,c,u){if(typeof e=="string"||typeof e=="function"||e===Y||e===I||e===Z||e===$||e===U||e===je||typeof e=="object"&&e!==null&&(e.$$typeof===V||e.$$typeof===W||e.$$typeof===D||e.$$typeof===Q||e.$$typeof===M||e.$$typeof===Ce||e.getModuleId!==void 0)){var o=r.children;if(o!==void 0)if(n)if(q(o)){for(n=0;n<o.length;n++)F(o[n],e);Object.freeze&&Object.freeze(o)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else F(o,e)}else o="",(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(o+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),e===null?n="null":q(e)?n="array":e!==void 0&&e.$$typeof===P?(n="<"+(a(e.type)||"Unknown")+" />",o=" Did you accidentally export a JSX literal instead of a component?"):n=typeof e,console.error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",n,o);if(re.call(r,"key")){o=a(e);var R=Object.keys(r).filter(function(f){return f!=="key"});n=0<R.length?"{key: someKey, "+R.join(": ..., ")+": ...}":"{key: someKey}",de[o+n]||(R=0<R.length?"{"+R.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
26
23
  let props = %s;
27
24
  <%s {...props} />
28
25
  React keys must be passed directly to JSX without using spread:
29
26
  let props = %s;
30
- <%s key={someKey} {...props} />`,Q,x,dr,x),Oe[x+Q]=!0}}return e===R?ur(f):ir(f),f}}function sr(e,r,t){return Se(e,r,t,!0)}function lr(e,r,t){return Se(e,r,t,!1)}var fr=lr,cr=sr;L.Fragment=R,L.jsx=fr,L.jsxs=cr}()),L}process.env.NODE_ENV==="production"?ee.exports=pr():ee.exports=yr();var O=ee.exports;const xe=K.createContext(null),Rr=c=>O.jsx(xe.Provider,{value:c.router,children:c.children});function te(){const c=K.useContext(xe);if(!c)throw new Error("[useRouter] Router not found. Insert RouterProvider in app root");return c}function hr(c){const{to:y,params:b,onClick:R,...g}=c,m=te().mappedRoutes.find(({route:i})=>i===y),{onOpen:E}=re.useUnit(y);if(!m){const{internal:i}=y;throw new Error(`[Link] Route with path "${i.path}" not found. Maybe it is not passed into createRouter?`)}return O.jsx("a",{...g,href:m.toPath(b??void 0),onClick:i=>{R==null||R(i),!i.defaultPrevented&&(g.target&&g.target!=="_self"||i.metaKey||i.altKey||i.ctrlKey||i.shiftKey||(i.preventDefault(),E({params:b||{}})))}})}const gr=c=>({...c,view:()=>{const{view:y,layout:b,route:R}=c,{isOpened:g}=re.useUnit(R);return g?b?O.jsx(b,{children:O.jsx(y,{})}):O.jsx(y,{}):null}}),br=c=>{const{routes:y,otherwise:b}=c;return()=>{const R=te(),g=re.useUnit(R.$activeRoutes),S=g.reduce((T,v)=>T.filter(w=>w!==v.internal.parent),g),m=y.find(T=>T.route===S.at(-1));if(!m)return b?O.jsx(b,{}):null;const{view:E,layout:i}=m;return i?O.jsx(i,{children:O.jsx(E,{})}):O.jsx(E,{})}};exports.Link=hr;exports.RouterProvider=Rr;exports.createRouteView=gr;exports.createRoutesView=br;exports.useRouter=te;
27
+ <%s key={someKey} {...props} />`,n,o,R,o),de[o+n]=!0)}if(o=null,t!==void 0&&(d(t),o=""+t),A(r)&&(d(r.key),o=""+r.key),"key"in r){t={};for(var j in r)j!=="key"&&(t[j]=r[j])}else t=r;return o&&we(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),ye(e,o,u,c,s(),t)}function F(e,r){if(typeof e=="object"&&e&&e.$$typeof!==ke){if(q(e))for(var t=0;t<e.length;t++){var n=e[t];N(n)&&K(n,r)}else if(N(e))e._store&&(e._store.validated=1);else if(e===null||typeof e!="object"?t=null:(t=ee&&e[ee]||e["@@iterator"],t=typeof t=="function"?t:null),typeof t=="function"&&t!==e.entries&&(t=t.call(e),t!==e))for(;!(e=t.next()).done;)N(e.value)&&K(e.value,r)}}function N(e){return typeof e=="object"&&e!==null&&e.$$typeof===P}function K(e,r){if(e._store&&!e._store.validated&&e.key==null&&(e._store.validated=1,r=_e(r),!ve[r])){ve[r]=!0;var t="";e&&e._owner!=null&&e._owner!==s()&&(t=null,typeof e._owner.tag=="number"?t=a(e._owner.type):typeof e._owner.name=="string"&&(t=e._owner.name),t=" It was passed a child from "+t+".");var n=_.getCurrentStack;_.getCurrentStack=function(){var c=m(e.type);return n&&(c+=n()||""),c},console.error('Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',r,t),_.getCurrentStack=n}}function _e(e){var r="",t=s();return t&&(t=a(t.type))&&(r=`
28
+
29
+ Check the render method of \``+t+"`."),r||(e=a(e))&&(r=`
30
+
31
+ Check the top-level render call using <`+e+">."),r}var he=H,P=Symbol.for("react.transitional.element"),Te=Symbol.for("react.portal"),Y=Symbol.for("react.fragment"),Z=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),Q=Symbol.for("react.consumer"),D=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),je=Symbol.for("react.offscreen"),ee=Symbol.iterator,pe=Symbol.for("react.client.reference"),_=he.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re=Object.prototype.hasOwnProperty,h=Object.assign,Ce=Symbol.for("react.client.reference"),q=Array.isArray,p=0,te,oe,ne,ae,ue,ie,se;E.__reactDisabledLog=!0;var z,le,G=!1,J=new(typeof WeakMap=="function"?WeakMap:Map),ke=Symbol.for("react.client.reference"),ce,fe={},de={},ve={};O.Fragment=Y,O.jsx=function(e,r,t,n,c){return B(e,r,t,!1,n,c)},O.jsxs=function(e,r,t,n,c){return B(e,r,t,!0,n,c)}}()),O}process.env.NODE_ENV==="production"?L.exports=Oe():L.exports=Se();var x=L.exports;const ge=H.createContext(null),Ae=a=>x.jsx(ge.Provider,{value:a.router,children:a.children});function me(){const a=H.useContext(ge);if(!a)throw new Error("[useRouter] Router not found. Add RouterProvider in app root");return a}function Re(){return X.useUnit(me())}function Ne(a){const{to:v,params:d,onClick:E,ref:i,...l}=a,{mappedRoutes:b}=me(),g=b.find(({route:s})=>s===v),{onOpen:m}=X.useUnit(v);if(!g){const{internal:s}=v;throw new Error(`[Link] Route with path "${s.path}" not found. Maybe it is not passed into createRouter?`)}return x.jsx("a",{...l,ref:i,href:g.toPath(d??void 0),onClick:s=>{E==null||E(s),!s.defaultPrevented&&(l.target&&l.target!=="_self"||s.metaKey||s.altKey||s.ctrlKey||s.shiftKey||(s.preventDefault(),m({params:d||{}})))}})}const Pe=a=>({...a,view:()=>{const{view:v,layout:d,route:E}=a,{isOpened:i}=X.useUnit(E);return i?d?x.jsx(d,{children:x.jsx(v,{})}):x.jsx(v,{}):null}}),Ye=a=>{const{routes:v,otherwise:d}=a;return()=>{const{activeRoutes:E}=Re(),i=E.reduce((m,s)=>m.filter(A=>A!==s.internal.parent),E),l=v.find(m=>m.route===i.at(-1));if(!l)return d?x.jsx(d,{}):null;const{view:b,layout:g}=l;return g?x.jsx(g,{children:x.jsx(b,{})}):x.jsx(b,{})}};exports.Link=Ne;exports.RouterProvider=Ae;exports.createRouteView=Pe;exports.createRoutesView=Ye;exports.useRouter=Re;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import { AnchorHTMLAttributes } from 'react';
2
2
  import { ComponentType } from 'react';
3
3
  import { JSX as JSX_2 } from 'react/jsx-runtime';
4
+ import { Query } from '@argon-router/core';
4
5
  import { ReactNode } from 'react';
6
+ import { RefObject } from 'react';
5
7
  import { Route } from '@argon-router/core';
6
8
  import { Router } from '@argon-router/core';
7
9
 
@@ -10,6 +12,7 @@ declare type AnchorProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>
10
12
  declare type BaseLinkProps<Params> = {
11
13
  to: Route<Params>;
12
14
  children?: ReactNode;
15
+ ref?: RefObject<HTMLAnchorElement>;
13
16
  } & AnchorProps;
14
17
 
15
18
  export declare const createRoutesView: (props: CreateRoutesViewProps) => () => JSX_2.Element | null;
@@ -50,6 +53,21 @@ declare interface RouterProviderProps {
50
53
  router: Router;
51
54
  }
52
55
 
53
- export declare function useRouter(): Router;
56
+ export declare function useRouter(): {
57
+ query: Query;
58
+ path: string;
59
+ activeRoutes: Route<any>[];
60
+ onBack: () => void;
61
+ onForward: () => void;
62
+ onNavigate: (payload: {
63
+ path: string;
64
+ query: Query;
65
+ replace?: boolean;
66
+ }) => {
67
+ path: string;
68
+ query: Query;
69
+ replace?: boolean;
70
+ };
71
+ };
54
72
 
55
73
  export { }