@quantajs/react 2.0.0-beta.1 → 2.0.0-beta.3
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/index.cjs +7 -15
- package/dist/index.d.ts +16 -8
- package/dist/index.js +326 -603
- package/package.json +8 -4
- package/readme.md +140 -133
package/dist/index.cjs
CHANGED
|
@@ -20,33 +20,25 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
22
22
|
*/
|
|
23
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
23
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),u=require("@quantajs/core");function k(o,s){try{return p.useSyncExternalStore(o.subscribe,()=>{try{return s?s(o):o}catch(r){throw u.logger.error(`useQuantaStore: Failed to get store snapshot: ${r instanceof Error?r.message:String(r)}`),r}},()=>{try{return s?s(o):o}catch(r){throw u.logger.error(`useQuantaStore: Failed to get server snapshot: ${r instanceof Error?r.message:String(r)}`),r}})}catch(r){throw u.logger.error(`useQuantaStore: Hook execution failed: ${r instanceof Error?r.message:String(r)}`),r}}const y=p.createContext({stores:{}});function q(){try{const o=p.useContext(y);if(!o){const s="useQuantaContext must be used within a QuantaProvider";throw u.logger.error(`QuantaContext: ${s}`),new Error(s)}return o}catch(o){throw u.logger.error(`QuantaContext: Failed to access context: ${o instanceof Error?o.message:String(o)}`),o}}function ae(o,s){try{const{stores:r}=q(),f=r[o];if(!f){const n=`Store with name "${o}" does not exist in the context.`;throw u.logger.error(`useStore: ${n}`),new Error(n)}return s?k(f,s):k(f)}catch(r){throw u.logger.error(`useStore: Failed to access store "${o}": ${r instanceof Error?r.message:String(r)}`),r}}function se(o,s,r,f){try{const n=p.useRef(void 0);if(!n.current)try{n.current=u.createStore(o,{state:s,getters:r,actions:f})}catch(l){throw u.logger.error(`useCreateStore: Failed to create store "${o}": ${l instanceof Error?l.message:String(l)}`),l}return n.current}catch(n){throw u.logger.error(`useCreateStore: Hook execution failed: ${n instanceof Error?n.message:String(n)}`),n}}var _={exports:{}},v={};/**
|
|
24
24
|
* @license React
|
|
25
|
-
* react-jsx-runtime.production.
|
|
25
|
+
* react-jsx-runtime.production.js
|
|
26
26
|
*
|
|
27
|
-
* Copyright (c)
|
|
27
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the MIT license found in the
|
|
30
30
|
* LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/var
|
|
31
|
+
*/var D;function ue(){if(D)return v;D=1;var o=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function r(f,n,l){var E=null;if(l!==void 0&&(E=""+l),n.key!==void 0&&(E=""+n.key),"key"in n){l={};for(var b in n)b!=="key"&&(l[b]=n[b])}else l=n;return n=l.ref,{$$typeof:o,type:f,key:E,ref:n!==void 0?n:null,props:l}}return v.Fragment=s,v.jsx=r,v.jsxs=r,v}var R={};/**
|
|
32
32
|
* @license React
|
|
33
33
|
* react-jsx-runtime.development.js
|
|
34
34
|
*
|
|
35
|
-
* Copyright (c)
|
|
35
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
36
36
|
*
|
|
37
37
|
* This source code is licensed under the MIT license found in the
|
|
38
38
|
* LICENSE file in the root directory of this source tree.
|
|
39
|
-
*/var
|
|
40
|
-
`+Q+e}}var B=!1,V;{var Ne=typeof WeakMap=="function"?WeakMap:Map;V=new Ne}function de(e,r){if(!e||B)return"";{var t=V.get(e);if(t!==void 0)return t}var n;B=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var u;u=J.current,J.current=null,Ve();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(b){n=b}Reflect.construct(e,[],o)}else{try{o.call()}catch(b){n=b}e.call(o.prototype)}}else{try{throw Error()}catch(b){n=b}e()}}catch(b){if(b&&n&&typeof b.stack=="string"){for(var a=b.stack.split(`
|
|
41
|
-
`),p=n.stack.split(`
|
|
42
|
-
`),s=a.length-1,f=p.length-1;s>=1&&f>=0&&a[s]!==p[f];)f--;for(;s>=1&&f>=0;s--,f--)if(a[s]!==p[f]){if(s!==1||f!==1)do if(s--,f--,f<0||a[s]!==p[f]){var y=`
|
|
43
|
-
`+a[s].replace(" at new "," at ");return e.displayName&&y.includes("<anonymous>")&&(y=y.replace("<anonymous>",e.displayName)),typeof e=="function"&&V.set(e,y),y}while(s>=1&&f>=0);break}}}finally{B=!1,J.current=u,Ue(),Error.prepareStackTrace=i}var x=e?e.displayName||e.name:"",O=x?M(x):"";return typeof e=="function"&&V.set(e,O),O}function qe(e,r,t){return de(e,!1)}function Je(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function U(e,r,t){if(e==null)return"";if(typeof e=="function")return de(e,Je(e));if(typeof e=="string")return M(e);switch(e){case P:return M("Suspense");case g:return M("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case d:return qe(e.render);case h:return U(e.type,r,t);case S:{var n=e,i=n._payload,u=n._init;try{return U(u(i),r,t)}catch{}}}return""}var A=Object.prototype.hasOwnProperty,ve={},pe=C.ReactDebugCurrentFrame;function N(e){if(e){var r=e._owner,t=U(e.type,e._source,r?r.type:null);pe.setExtraStackFrame(t)}else pe.setExtraStackFrame(null)}function Qe(e,r,t,n,i){{var u=Function.call.bind(A);for(var o in e)if(u(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(s){a=s}a&&!(a instanceof Error)&&(N(i),v("%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 ve)&&(ve[a.message]=!0,N(i),v("Failed %s type: %s",t,a.message),N(null))}}}var Be=Array.isArray;function K(e){return Be(e)}function Ke(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function Ge(e){try{return be(e),!1}catch{return!0}}function be(e){return""+e}function ge(e){if(Ge(e))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ke(e)),be(e)}var ye=C.ReactCurrentOwner,ze={key:!0,ref:!0,__self:!0,__source:!0},he,Ee;function Xe(e){if(A.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function He(e){if(A.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Ze(e,r){typeof e.ref=="string"&&ye.current}function er(e,r){{var t=function(){he||(he=!0,v("%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,v("%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,i,u,o){var a={$$typeof:l,type:e,key:r,ref:t,props:o,_owner:u};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:i}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function nr(e,r,t,n,i){{var u,o={},a=null,p=null;t!==void 0&&(ge(t),a=""+t),He(r)&&(ge(r.key),a=""+r.key),Xe(r)&&(p=r.ref,Ze(r,i));for(u in r)A.call(r,u)&&!ze.hasOwnProperty(u)&&(o[u]=r[u]);if(e&&e.defaultProps){var s=e.defaultProps;for(u in s)o[u]===void 0&&(o[u]=s[u])}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,i,n,ye.current,o)}}var G=C.ReactCurrentOwner,Re=C.ReactDebugCurrentFrame;function w(e){if(e){var r=e._owner,t=U(e.type,e._source,r?r.type:null);Re.setExtraStackFrame(t)}else Re.setExtraStackFrame(null)}var z;z=!1;function X(e){return typeof e=="object"&&e!==null&&e.$$typeof===l}function _e(){{if(G.current){var e=_(G.current.type);if(e)return`
|
|
44
|
-
|
|
45
|
-
Check the render method of \``+e+"`."}return""}}function ar(e){return""}var me={};function or(e){{var r=_e();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
46
|
-
|
|
47
|
-
Check the top-level render call using <`+t+">.")}return r}}function Se(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=or(r);if(me[t])return;me[t]=!0;var n="";e&&e._owner&&e._owner!==G.current&&(n=" It was passed a child from "+_(e._owner.type)+"."),w(e),v('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),w(null)}}function Te(e,r){{if(typeof e!="object")return;if(K(e))for(var t=0;t<e.length;t++){var n=e[t];X(n)&&Se(n,r)}else if(X(e))e._store&&(e._store.validated=!0);else if(e){var i=De(e);if(typeof i=="function"&&i!==e.entries)for(var u=i.call(e),o;!(o=u.next()).done;)X(o.value)&&Se(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===d||r.$$typeof===h))t=r.propTypes;else return;if(t){var n=_(r);Qe(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!z){z=!0;var i=_(r);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&v("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"){w(e),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),w(null);break}}e.ref!==null&&(w(e),v("Invalid attribute `ref` supplied to `React.Fragment`."),w(null))}}var Oe={};function Pe(e,r,t,n,i,u){{var o=Le(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+=_e();var s;e===null?s="null":K(e)?s="array":e!==void 0&&e.$$typeof===l?(s="<"+(_(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):s=typeof e,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",s,a)}var f=nr(e,r,t,i,u);if(f==null)return f;if(o){var y=r.children;if(y!==void 0)if(n)if(K(y)){for(var x=0;x<y.length;x++)Te(y[x],e);Object.freeze&&Object.freeze(y)}else v("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 Te(y,e)}if(A.call(r,"key")){var O=_(e),b=Object.keys(r).filter(function(vr){return vr!=="key"}),H=b.length>0?"{key: someKey, "+b.join(": ..., ")+": ...}":"{key: someKey}";if(!Oe[O+H]){var dr=b.length>0?"{"+b.join(": ..., ")+": ...}":"{}";v(`A props object containing a "key" prop is being spread into JSX:
|
|
39
|
+
*/var L;function ce(){return L||(L=1,process.env.NODE_ENV!=="production"&&function(){function o(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case h:return"Fragment";case G:return"Profiler";case V:return"StrictMode";case Z:return"Suspense";case K:return"SuspenseList";case re:return"Activity"}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 z:return"Portal";case H:return(e.displayName||"Context")+".Provider";case X:return(e._context.displayName||"Context")+".Consumer";case B:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ee:return t=e.displayName||null,t!==null?t:o(e.type)||"Memo";case N:t=e._payload,e=e._init;try{return o(e(t))}catch{}}return null}function s(e){return""+e}function r(e){try{s(e);var t=!1}catch{t=!0}if(t){t=console;var a=t.error,c=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a.call(t,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",c),s(e)}}function f(e){if(e===h)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===N)return"<...>";try{var t=o(e);return t?"<"+t+">":"<...>"}catch{return"<...>"}}function n(){var e=T.A;return e===null?null:e.getOwner()}function l(){return Error("react-stack-top-frame")}function E(e){if($.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function b(e,t){function a(){F||(F=!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)",t))}a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}function U(){var e=o(this.type);return Y[e]||(Y[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 J(e,t,a,c,m,d,x,P){return a=d.ref,e={$$typeof:C,type:e,key:t,props:d,_owner:m},(a!==void 0?a:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:U}):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.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:x}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:P}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function j(e,t,a,c,m,d,x,P){var i=t.children;if(i!==void 0)if(c)if(oe(i)){for(c=0;c<i.length;c++)A(i[c]);Object.freeze&&Object.freeze(i)}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 A(i);if($.call(t,"key")){i=o(e);var g=Object.keys(t).filter(function(ne){return ne!=="key"});c=0<g.length?"{key: someKey, "+g.join(": ..., ")+": ...}":"{key: someKey}",M[i+c]||(g=0<g.length?"{"+g.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
48
40
|
let props = %s;
|
|
49
41
|
<%s {...props} />
|
|
50
42
|
React keys must be passed directly to JSX without using spread:
|
|
51
43
|
let props = %s;
|
|
52
|
-
<%s key={someKey} {...props} />`,
|
|
44
|
+
<%s key={someKey} {...props} />`,c,i,g,i),M[i+c]=!0)}if(i=null,a!==void 0&&(r(a),i=""+a),E(t)&&(r(t.key),i=""+t.key),"key"in t){a={};for(var O in t)O!=="key"&&(a[O]=t[O])}else a=t;return i&&b(a,typeof e=="function"?e.displayName||e.name||"Unknown":e),J(e,i,d,m,n(),a,x,P)}function A(e){typeof e=="object"&&e!==null&&e.$$typeof===C&&e._store&&(e._store.validated=1)}var S=p,C=Symbol.for("react.transitional.element"),z=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),V=Symbol.for("react.strict_mode"),G=Symbol.for("react.profiler"),X=Symbol.for("react.consumer"),H=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),Z=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),re=Symbol.for("react.activity"),te=Symbol.for("react.client.reference"),T=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,oe=Array.isArray,w=console.createTask?console.createTask:function(){return null};S={react_stack_bottom_frame:function(e){return e()}};var F,Y={},Q=S.react_stack_bottom_frame.bind(S,l)(),I=w(f(l)),M={};R.Fragment=h,R.jsx=function(e,t,a,c,m){var d=1e4>T.recentlyCreatedOwnerStacks++;return j(e,t,a,!1,c,m,d?Error("react-stack-top-frame"):Q,d?w(f(e)):I)},R.jsxs=function(e,t,a,c,m){var d=1e4>T.recentlyCreatedOwnerStacks++;return j(e,t,a,!0,c,m,d?Error("react-stack-top-frame"):Q,d?w(f(e)):I)}}()),R}var W;function ie(){return W||(W=1,process.env.NODE_ENV==="production"?_.exports=ue():_.exports=ce()),_.exports}var le=ie();function fe({stores:o,children:s}){try{if(!o||typeof o!="object"){const r="QuantaProvider: Invalid stores prop provided";throw u.logger.error(r),new Error(r)}for(const[r,f]of Object.entries(o))if(!f||typeof f!="object"){const n=`QuantaProvider: Invalid store "${r}" provided`;throw u.logger.error(n),new Error(n)}return le.jsx(y.Provider,{value:{stores:o},children:s})}catch(r){throw u.logger.error(`QuantaProvider: Failed to render provider: ${r instanceof Error?r.message:String(r)}`),r}}Object.defineProperty(exports,"computed",{enumerable:!0,get:()=>u.computed});Object.defineProperty(exports,"createStore",{enumerable:!0,get:()=>u.createStore});Object.defineProperty(exports,"logger",{enumerable:!0,get:()=>u.logger});Object.defineProperty(exports,"reactive",{enumerable:!0,get:()=>u.reactive});Object.defineProperty(exports,"watch",{enumerable:!0,get:()=>u.watch});exports.QuantaContext=y;exports.QuantaProvider=fe;exports.useCreateStore=se;exports.useQuantaContext=q;exports.useQuantaStore=k;exports.useStore=ae;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { computed } from '@quantajs/core';
|
|
|
3
3
|
import { Context } from 'react';
|
|
4
4
|
import { createStore } from '@quantajs/core';
|
|
5
5
|
import { GetterDefinition } from '@quantajs/core';
|
|
6
|
-
import { JSX
|
|
6
|
+
import { JSX } from 'react/jsx-runtime';
|
|
7
|
+
import { logger } from '@quantajs/core';
|
|
7
8
|
import { reactive } from '@quantajs/core';
|
|
8
9
|
import { ReactNode } from 'react';
|
|
9
10
|
import { StateDefinition } from '@quantajs/core';
|
|
@@ -20,21 +21,27 @@ export { createStore }
|
|
|
20
21
|
|
|
21
22
|
export { GetterDefinition }
|
|
22
23
|
|
|
23
|
-
export
|
|
24
|
+
export { logger }
|
|
25
|
+
|
|
26
|
+
export declare const QuantaContext: Context<QuantaContextValue>;
|
|
24
27
|
|
|
25
28
|
declare interface QuantaContextValue {
|
|
26
|
-
|
|
29
|
+
stores: {
|
|
30
|
+
[name: string]: StoreInstance<any, any, any>;
|
|
31
|
+
};
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
/**
|
|
30
35
|
* Provider component that makes a QuantaJS store available to all child components
|
|
31
|
-
* @param
|
|
32
|
-
* @param children - Child components that can access the
|
|
36
|
+
* @param stores - The QuantaJS stores instances to provide
|
|
37
|
+
* @param children - Child components that can access the stores
|
|
33
38
|
*/
|
|
34
|
-
export declare function QuantaProvider({
|
|
39
|
+
export declare function QuantaProvider({ stores, children }: QuantaProviderProps): JSX.Element;
|
|
35
40
|
|
|
36
41
|
declare interface QuantaProviderProps {
|
|
37
|
-
|
|
42
|
+
stores: {
|
|
43
|
+
[key: string]: StoreInstance<any, any, any>;
|
|
44
|
+
};
|
|
38
45
|
children: ReactNode;
|
|
39
46
|
}
|
|
40
47
|
|
|
@@ -71,10 +78,11 @@ export declare function useQuantaStore<S extends object, G extends object, A ext
|
|
|
71
78
|
|
|
72
79
|
/**
|
|
73
80
|
* Hook to access and subscribe to the QuantaJS store from context
|
|
81
|
+
* @param name - The name of the store to access
|
|
74
82
|
* @param selector - Optional selector function to pick specific parts of the store
|
|
75
83
|
* @returns The store instance or selected value that updates reactively
|
|
76
84
|
*/
|
|
77
|
-
export declare function useStore<T = any>(selector?: (store: StoreInstance<any, any, any>) => T): T extends undefined ? StoreInstance<any, any, any> : T;
|
|
85
|
+
export declare function useStore<T = any>(name: string, selector?: (store: StoreInstance<any, any, any>) => T): T extends undefined ? StoreInstance<any, any, any> : T;
|
|
78
86
|
|
|
79
87
|
export { watch }
|
|
80
88
|
|