@quantajs/react 2.0.0-beta.3 → 2.0.0-beta.5

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 CHANGED
@@ -20,25 +20,9 @@ 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 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
- * @license React
25
- * react-jsx-runtime.production.js
26
- *
27
- * Copyright (c) Meta Platforms, Inc. and affiliates.
28
- *
29
- * This source code is licensed under the MIT license found in the
30
- * LICENSE file in the root directory of this source tree.
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
- * @license React
33
- * react-jsx-runtime.development.js
34
- *
35
- * Copyright (c) Meta Platforms, Inc. and affiliates.
36
- *
37
- * This source code is licensed under the MIT license found in the
38
- * LICENSE file in the root directory of this source tree.
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:
23
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react"),i=require("@quantajs/core");function $(r,c){if(!r.subscribe){const a=new Error("QuantaJS store missing `subscribe`—ensure core v0.1.0-beta.2+.");throw i.logger.error(`useQuantaStore: ${a.message}`),a}const n=E.useRef(null),u=E.useCallback(()=>{const R={...r.state??{}};return Object.keys(r.actions??{}).forEach(S=>{R[S]=r.actions[S].bind(r)}),r.getters&&Object.keys(r.getters).forEach(S=>{const g=r.getters[S];R[S]=typeof g=="function"?g.bind(r):g}),R},[r]);n.current===null&&(n.current=u());const o=E.useCallback(a=>{const R=S=>{try{const h={...S??r.state??{}};Object.keys(r.actions??{}).forEach(b=>{h[b]=r.actions[b]}),r.getters&&Object.keys(r.getters).forEach(b=>{const _=r.getters[b];h[b]=typeof _=="function"?_.bind(r):_}),n.current=h,a()}catch(g){i.logger.warn(`useQuantaStore: Failed to update snapshot: ${g instanceof Error?g.message:String(g)}`)}};return r.subscribe(R)},[r]),l=E.useCallback(()=>{try{return n.current||(n.current=u()),c?c(n.current):n.current}catch(a){throw i.logger.error(`useQuantaStore: getSnapshot failed: ${a instanceof Error?a.message:String(a)}`),a}},[c,u]),v=E.useCallback(()=>{try{const a=u();return c?c(a):a}catch(a){throw i.logger.error(`useQuantaStore: getServerSnapshot failed: ${a instanceof Error?a.message:String(a)}`),a}},[c,u]);return E.useSyncExternalStore(o,l,v)}const N=E.createContext({stores:{}});function J(){try{const r=E.useContext(N);if(!r){const c="useQuantaContext must be used within a QuantaProvider";throw i.logger.error(`QuantaContext: ${c}`),new Error(c)}return r}catch(r){throw i.logger.error(`QuantaContext: Failed to access context: ${r instanceof Error?r.message:String(r)}`),r}}function ae(r,c){try{const{stores:n}=J(),u=n[r];if(!u){const o=`Store with name "${r}" does not exist in the context.`;throw i.logger.error(`useStore: ${o}`),new Error(o)}return c?$(u,c):$(u)}catch(n){throw i.logger.error(`useStore: Failed to access store "${r}": ${n instanceof Error?n.message:String(n)}`),n}}function se(r,c,n,u){try{const o=E.useRef(void 0);if(!o.current)try{o.current=i.createStore(r,{state:c,getters:n,actions:u})}catch(l){throw i.logger.error(`useCreateStore: Failed to create store "${r}": ${l instanceof Error?l.message:String(l)}`),l}return o.current}catch(o){throw i.logger.error(`useCreateStore: Hook execution failed: ${o instanceof Error?o.message:String(o)}`),o}}var k={exports:{}},T={};var W;function ce(){if(W)return T;W=1;var r=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function n(u,o,l){var v=null;if(l!==void 0&&(v=""+l),o.key!==void 0&&(v=""+o.key),"key"in o){l={};for(var a in o)a!=="key"&&(l[a]=o[a])}else l=o;return o=l.ref,{$$typeof:r,type:u,key:v,ref:o!==void 0?o:null,props:l}}return T.Fragment=c,T.jsx=n,T.jsxs=n,T}var O={};var q;function ue(){return q||(q=1,process.env.NODE_ENV!=="production"&&(function(){function r(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 P: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:r(e.type)||"Memo";case Q:t=e._payload,e=e._init;try{return r(e(t))}catch{}}return null}function c(e){return""+e}function n(e){try{c(e);var t=!1}catch{t=!0}if(t){t=console;var s=t.error,f=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return s.call(t,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",f),c(e)}}function u(e){if(e===P)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===Q)return"<...>";try{var t=r(e);return t?"<"+t+">":"<...>"}catch{return"<...>"}}function o(){var e=x.A;return e===null?null:e.getOwner()}function l(){return Error("react-stack-top-frame")}function v(e){if(Y.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function a(e,t){function s(){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))}s.isReactWarning=!0,Object.defineProperty(e,"key",{get:s,configurable:!0})}function R(){var e=r(this.type);return I[e]||(I[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 S(e,t,s,f,p,m,j,C){return s=m.ref,e={$$typeof:_,type:e,key:t,props:m,_owner:p},(s!==void 0?s:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:R}):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:j}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:C}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function g(e,t,s,f,p,m,j,C){var d=t.children;if(d!==void 0)if(f)if(ne(d)){for(f=0;f<d.length;f++)h(d[f]);Object.freeze&&Object.freeze(d)}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 h(d);if(Y.call(t,"key")){d=r(e);var w=Object.keys(t).filter(function(oe){return oe!=="key"});f=0<w.length?"{key: someKey, "+w.join(": ..., ")+": ...}":"{key: someKey}",L[d+f]||(w=0<w.length?"{"+w.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
40
24
  let props = %s;
41
25
  <%s {...props} />
42
26
  React keys must be passed directly to JSX without using spread:
43
27
  let props = %s;
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;
28
+ <%s key={someKey} {...props} />`,f,d,w,d),L[d+f]=!0)}if(d=null,s!==void 0&&(n(s),d=""+s),v(t)&&(n(t.key),d=""+t.key),"key"in t){s={};for(var A in t)A!=="key"&&(s[A]=t[A])}else s=t;return d&&a(s,typeof e=="function"?e.displayName||e.name||"Unknown":e),S(e,d,m,p,o(),s,j,C)}function h(e){typeof e=="object"&&e!==null&&e.$$typeof===_&&e._store&&(e._store.validated=1)}var b=E,_=Symbol.for("react.transitional.element"),z=Symbol.for("react.portal"),P=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"),Q=Symbol.for("react.lazy"),re=Symbol.for("react.activity"),te=Symbol.for("react.client.reference"),x=b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,ne=Array.isArray,y=console.createTask?console.createTask:function(){return null};b={react_stack_bottom_frame:function(e){return e()}};var F,I={},M=b.react_stack_bottom_frame.bind(b,l)(),D=y(u(l)),L={};O.Fragment=P,O.jsx=function(e,t,s,f,p){var m=1e4>x.recentlyCreatedOwnerStacks++;return g(e,t,s,!1,f,p,m?Error("react-stack-top-frame"):M,m?y(u(e)):D)},O.jsxs=function(e,t,s,f,p){var m=1e4>x.recentlyCreatedOwnerStacks++;return g(e,t,s,!0,f,p,m?Error("react-stack-top-frame"):M,m?y(u(e)):D)}})()),O}var U;function ie(){return U||(U=1,process.env.NODE_ENV==="production"?k.exports=ce():k.exports=ue()),k.exports}var le=ie();function fe({stores:r,children:c}){try{if(!r||typeof r!="object"){const n="QuantaProvider: Invalid stores prop provided";throw i.logger.error(n),new Error(n)}for(const[n,u]of Object.entries(r))if(!u||typeof u!="object"){const o=`QuantaProvider: Invalid store "${n}" provided`;throw i.logger.error(o),new Error(o)}return le.jsx(N.Provider,{value:{stores:r},children:c})}catch(n){throw i.logger.error(`QuantaProvider: Failed to render provider: ${n instanceof Error?n.message:String(n)}`),n}}Object.defineProperty(exports,"computed",{enumerable:!0,get:()=>i.computed});Object.defineProperty(exports,"createStore",{enumerable:!0,get:()=>i.createStore});Object.defineProperty(exports,"logger",{enumerable:!0,get:()=>i.logger});Object.defineProperty(exports,"reactive",{enumerable:!0,get:()=>i.reactive});Object.defineProperty(exports,"watch",{enumerable:!0,get:()=>i.watch});exports.QuantaContext=N;exports.QuantaProvider=fe;exports.useCreateStore=se;exports.useQuantaContext=J;exports.useQuantaStore=$;exports.useStore=ae;
package/dist/index.js CHANGED
@@ -20,250 +20,260 @@ 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
- import oe, { useSyncExternalStore as ne, createContext as ae, useContext as se, useRef as ue } from "react";
24
- import { logger as f, createStore as ce } from "@quantajs/core";
25
- import { computed as ge, createStore as he, logger as Te, reactive as we, watch as xe } from "@quantajs/core";
26
- function I(o, s) {
27
- try {
28
- return ne(
29
- o.subscribe,
30
- () => {
31
- try {
32
- return s ? s(o) : o;
33
- } catch (r) {
34
- throw f.error(
35
- `useQuantaStore: Failed to get store snapshot: ${r instanceof Error ? r.message : String(r)}`
36
- ), r;
37
- }
38
- },
39
- () => {
40
- try {
41
- return s ? s(o) : o;
42
- } catch (r) {
43
- throw f.error(
44
- `useQuantaStore: Failed to get server snapshot: ${r instanceof Error ? r.message : String(r)}`
45
- ), r;
46
- }
47
- }
23
+ import ae, { useRef as J, useCallback as x, useSyncExternalStore as se, createContext as ce, useContext as ue } from "react";
24
+ import { logger as d, createStore as ie } from "@quantajs/core";
25
+ import { computed as _e, createStore as we, logger as Te, reactive as xe, watch as ke } from "@quantajs/core";
26
+ function D(r, c) {
27
+ if (!r.subscribe) {
28
+ const a = new Error(
29
+ "QuantaJS store missing `subscribe`—ensure core v0.1.0-beta.2+."
48
30
  );
49
- } catch (r) {
50
- throw f.error(
51
- `useQuantaStore: Hook execution failed: ${r instanceof Error ? r.message : String(r)}`
52
- ), r;
31
+ throw d.error(`useQuantaStore: ${a.message}`), a;
53
32
  }
33
+ const n = J(null), u = x(() => {
34
+ const g = { ...r.state ?? {} };
35
+ return Object.keys(r.actions ?? {}).forEach((p) => {
36
+ g[p] = r.actions[p].bind(r);
37
+ }), r.getters && Object.keys(r.getters).forEach((p) => {
38
+ const m = r.getters[p];
39
+ g[p] = typeof m == "function" ? m.bind(r) : m;
40
+ }), g;
41
+ }, [r]);
42
+ n.current === null && (n.current = u());
43
+ const o = x(
44
+ (a) => {
45
+ const g = (p) => {
46
+ try {
47
+ const R = { ...p ?? r.state ?? {} };
48
+ Object.keys(r.actions ?? {}).forEach((E) => {
49
+ R[E] = r.actions[E];
50
+ }), r.getters && Object.keys(r.getters).forEach((E) => {
51
+ const h = r.getters[E];
52
+ R[E] = typeof h == "function" ? h.bind(r) : h;
53
+ }), n.current = R, a();
54
+ } catch (m) {
55
+ d.warn(
56
+ `useQuantaStore: Failed to update snapshot: ${m instanceof Error ? m.message : String(m)}`
57
+ );
58
+ }
59
+ };
60
+ return r.subscribe(g);
61
+ },
62
+ [r]
63
+ ), i = x(() => {
64
+ try {
65
+ return n.current || (n.current = u()), c ? c(n.current) : n.current;
66
+ } catch (a) {
67
+ throw d.error(
68
+ `useQuantaStore: getSnapshot failed: ${a instanceof Error ? a.message : String(a)}`
69
+ ), a;
70
+ }
71
+ }, [c, u]), S = x(() => {
72
+ try {
73
+ const a = u();
74
+ return c ? c(a) : a;
75
+ } catch (a) {
76
+ throw d.error(
77
+ `useQuantaStore: getServerSnapshot failed: ${a instanceof Error ? a.message : String(a)}`
78
+ ), a;
79
+ }
80
+ }, [c, u]);
81
+ return se(o, i, S);
54
82
  }
55
- const L = ae({ stores: {} });
56
- function ie() {
83
+ const q = ce({ stores: {} });
84
+ function le() {
57
85
  try {
58
- const o = se(L);
59
- if (!o) {
60
- const s = "useQuantaContext must be used within a QuantaProvider";
61
- throw f.error(`QuantaContext: ${s}`), new Error(s);
86
+ const r = ue(q);
87
+ if (!r) {
88
+ const c = "useQuantaContext must be used within a QuantaProvider";
89
+ throw d.error(`QuantaContext: ${c}`), new Error(c);
62
90
  }
63
- return o;
64
- } catch (o) {
65
- throw f.error(
66
- `QuantaContext: Failed to access context: ${o instanceof Error ? o.message : String(o)}`
67
- ), o;
91
+ return r;
92
+ } catch (r) {
93
+ throw d.error(
94
+ `QuantaContext: Failed to access context: ${r instanceof Error ? r.message : String(r)}`
95
+ ), r;
68
96
  }
69
97
  }
70
- function be(o, s) {
98
+ function ve(r, c) {
71
99
  try {
72
- const { stores: r } = ie(), l = r[o];
73
- if (!l) {
74
- const n = `Store with name "${o}" does not exist in the context.`;
75
- throw f.error(`useStore: ${n}`), new Error(n);
100
+ const { stores: n } = le(), u = n[r];
101
+ if (!u) {
102
+ const o = `Store with name "${r}" does not exist in the context.`;
103
+ throw d.error(`useStore: ${o}`), new Error(o);
76
104
  }
77
- return s ? I(l, s) : I(l);
78
- } catch (r) {
79
- throw f.error(
80
- `useStore: Failed to access store "${o}": ${r instanceof Error ? r.message : String(r)}`
81
- ), r;
105
+ return c ? D(u, c) : D(u);
106
+ } catch (n) {
107
+ throw d.error(
108
+ `useStore: Failed to access store "${r}": ${n instanceof Error ? n.message : String(n)}`
109
+ ), n;
82
110
  }
83
111
  }
84
- function Re(o, s, r, l) {
112
+ function Se(r, c, n, u) {
85
113
  try {
86
- const n = ue(void 0);
87
- if (!n.current)
114
+ const o = J(void 0);
115
+ if (!o.current)
88
116
  try {
89
- n.current = ce(o, {
90
- state: s,
91
- getters: r,
92
- actions: l
117
+ o.current = ie(r, {
118
+ state: c,
119
+ getters: n,
120
+ actions: u
93
121
  });
94
122
  } catch (i) {
95
- throw f.error(
96
- `useCreateStore: Failed to create store "${o}": ${i instanceof Error ? i.message : String(i)}`
123
+ throw d.error(
124
+ `useCreateStore: Failed to create store "${r}": ${i instanceof Error ? i.message : String(i)}`
97
125
  ), i;
98
126
  }
99
- return n.current;
100
- } catch (n) {
101
- throw f.error(
102
- `useCreateStore: Hook execution failed: ${n instanceof Error ? n.message : String(n)}`
103
- ), n;
127
+ return o.current;
128
+ } catch (o) {
129
+ throw d.error(
130
+ `useCreateStore: Hook execution failed: ${o instanceof Error ? o.message : String(o)}`
131
+ ), o;
104
132
  }
105
133
  }
106
- var S = { exports: {} }, R = {};
107
- /**
108
- * @license React
109
- * react-jsx-runtime.production.js
110
- *
111
- * Copyright (c) Meta Platforms, Inc. and affiliates.
112
- *
113
- * This source code is licensed under the MIT license found in the
114
- * LICENSE file in the root directory of this source tree.
115
- */
116
- var M;
117
- function le() {
118
- if (M) return R;
119
- M = 1;
120
- var o = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
121
- function r(l, n, i) {
122
- var v = null;
123
- if (i !== void 0 && (v = "" + i), n.key !== void 0 && (v = "" + n.key), "key" in n) {
134
+ var k = { exports: {} }, w = {};
135
+ var L;
136
+ function fe() {
137
+ if (L) return w;
138
+ L = 1;
139
+ var r = Symbol.for("react.transitional.element"), c = Symbol.for("react.fragment");
140
+ function n(u, o, i) {
141
+ var S = null;
142
+ if (i !== void 0 && (S = "" + i), o.key !== void 0 && (S = "" + o.key), "key" in o) {
124
143
  i = {};
125
- for (var b in n)
126
- b !== "key" && (i[b] = n[b]);
127
- } else i = n;
128
- return n = i.ref, {
129
- $$typeof: o,
130
- type: l,
131
- key: v,
132
- ref: n !== void 0 ? n : null,
144
+ for (var a in o)
145
+ a !== "key" && (i[a] = o[a]);
146
+ } else i = o;
147
+ return o = i.ref, {
148
+ $$typeof: r,
149
+ type: u,
150
+ key: S,
151
+ ref: o !== void 0 ? o : null,
133
152
  props: i
134
153
  };
135
154
  }
136
- return R.Fragment = s, R.jsx = r, R.jsxs = r, R;
155
+ return w.Fragment = c, w.jsx = n, w.jsxs = n, w;
137
156
  }
138
- var _ = {};
139
- /**
140
- * @license React
141
- * react-jsx-runtime.development.js
142
- *
143
- * Copyright (c) Meta Platforms, Inc. and affiliates.
144
- *
145
- * This source code is licensed under the MIT license found in the
146
- * LICENSE file in the root directory of this source tree.
147
- */
148
- var Q;
149
- function fe() {
150
- return Q || (Q = 1, process.env.NODE_ENV !== "production" && function() {
151
- function o(e) {
157
+ var T = {};
158
+ var W;
159
+ function de() {
160
+ return W || (W = 1, process.env.NODE_ENV !== "production" && (function() {
161
+ function r(e) {
152
162
  if (e == null) return null;
153
163
  if (typeof e == "function")
154
- return e.$$typeof === ee ? null : e.displayName || e.name || null;
164
+ return e.$$typeof === te ? null : e.displayName || e.name || null;
155
165
  if (typeof e == "string") return e;
156
166
  switch (e) {
157
- case g:
167
+ case O:
158
168
  return "Fragment";
159
- case z:
169
+ case G:
160
170
  return "Profiler";
161
- case J:
171
+ case V:
162
172
  return "StrictMode";
163
- case H:
173
+ case Z:
164
174
  return "Suspense";
165
- case B:
166
- return "SuspenseList";
167
175
  case K:
176
+ return "SuspenseList";
177
+ case re:
168
178
  return "Activity";
169
179
  }
170
180
  if (typeof e == "object")
171
181
  switch (typeof e.tag == "number" && console.error(
172
182
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
173
183
  ), e.$$typeof) {
174
- case q:
184
+ case z:
175
185
  return "Portal";
176
- case G:
186
+ case H:
177
187
  return (e.displayName || "Context") + ".Provider";
178
- case V:
179
- return (e._context.displayName || "Context") + ".Consumer";
180
188
  case X:
189
+ return (e._context.displayName || "Context") + ".Consumer";
190
+ case B:
181
191
  var t = e.render;
182
192
  return e = e.displayName, e || (e = t.displayName || t.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
183
- case Z:
184
- return t = e.displayName || null, t !== null ? t : o(e.type) || "Memo";
185
- case A:
193
+ case ee:
194
+ return t = e.displayName || null, t !== null ? t : r(e.type) || "Memo";
195
+ case $:
186
196
  t = e._payload, e = e._init;
187
197
  try {
188
- return o(e(t));
198
+ return r(e(t));
189
199
  } catch {
190
200
  }
191
201
  }
192
202
  return null;
193
203
  }
194
- function s(e) {
204
+ function c(e) {
195
205
  return "" + e;
196
206
  }
197
- function r(e) {
207
+ function n(e) {
198
208
  try {
199
- s(e);
209
+ c(e);
200
210
  var t = !1;
201
211
  } catch {
202
212
  t = !0;
203
213
  }
204
214
  if (t) {
205
215
  t = console;
206
- var a = t.error, u = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
207
- return a.call(
216
+ var s = t.error, l = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
217
+ return s.call(
208
218
  t,
209
219
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
210
- u
211
- ), s(e);
220
+ l
221
+ ), c(e);
212
222
  }
213
223
  }
214
- function l(e) {
215
- if (e === g) return "<>";
216
- if (typeof e == "object" && e !== null && e.$$typeof === A)
224
+ function u(e) {
225
+ if (e === O) return "<>";
226
+ if (typeof e == "object" && e !== null && e.$$typeof === $)
217
227
  return "<...>";
218
228
  try {
219
- var t = o(e);
229
+ var t = r(e);
220
230
  return t ? "<" + t + ">" : "<...>";
221
231
  } catch {
222
232
  return "<...>";
223
233
  }
224
234
  }
225
- function n() {
226
- var e = h.A;
235
+ function o() {
236
+ var e = P.A;
227
237
  return e === null ? null : e.getOwner();
228
238
  }
229
239
  function i() {
230
240
  return Error("react-stack-top-frame");
231
241
  }
232
- function v(e) {
233
- if (j.call(e, "key")) {
242
+ function S(e) {
243
+ if (N.call(e, "key")) {
234
244
  var t = Object.getOwnPropertyDescriptor(e, "key").get;
235
245
  if (t && t.isReactWarning) return !1;
236
246
  }
237
247
  return e.key !== void 0;
238
248
  }
239
- function b(e, t) {
240
- function a() {
241
- C || (C = !0, console.error(
249
+ function a(e, t) {
250
+ function s() {
251
+ Y || (Y = !0, console.error(
242
252
  "%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)",
243
253
  t
244
254
  ));
245
255
  }
246
- a.isReactWarning = !0, Object.defineProperty(e, "key", {
247
- get: a,
256
+ s.isReactWarning = !0, Object.defineProperty(e, "key", {
257
+ get: s,
248
258
  configurable: !0
249
259
  });
250
260
  }
251
- function W() {
252
- var e = o(this.type);
253
- return N[e] || (N[e] = !0, console.error(
261
+ function g() {
262
+ var e = r(this.type);
263
+ return F[e] || (F[e] = !0, console.error(
254
264
  "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."
255
265
  )), e = this.props.ref, e !== void 0 ? e : null;
256
266
  }
257
- function U(e, t, a, u, m, d, w, x) {
258
- return a = d.ref, e = {
259
- $$typeof: y,
267
+ function p(e, t, s, l, v, b, y, A) {
268
+ return s = b.ref, e = {
269
+ $$typeof: h,
260
270
  type: e,
261
271
  key: t,
262
- props: d,
263
- _owner: m
264
- }, (a !== void 0 ? a : null) !== null ? Object.defineProperty(e, "ref", {
272
+ props: b,
273
+ _owner: v
274
+ }, (s !== void 0 ? s : null) !== null ? Object.defineProperty(e, "ref", {
265
275
  enumerable: !1,
266
- get: W
276
+ get: g
267
277
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
268
278
  configurable: !1,
269
279
  enumerable: !1,
@@ -278,139 +288,139 @@ function fe() {
278
288
  configurable: !1,
279
289
  enumerable: !1,
280
290
  writable: !0,
281
- value: w
291
+ value: y
282
292
  }), Object.defineProperty(e, "_debugTask", {
283
293
  configurable: !1,
284
294
  enumerable: !1,
285
295
  writable: !0,
286
- value: x
296
+ value: A
287
297
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
288
298
  }
289
- function P(e, t, a, u, m, d, w, x) {
290
- var c = t.children;
291
- if (c !== void 0)
292
- if (u)
293
- if (re(c)) {
294
- for (u = 0; u < c.length; u++)
295
- O(c[u]);
296
- Object.freeze && Object.freeze(c);
299
+ function m(e, t, s, l, v, b, y, A) {
300
+ var f = t.children;
301
+ if (f !== void 0)
302
+ if (l)
303
+ if (ne(f)) {
304
+ for (l = 0; l < f.length; l++)
305
+ R(f[l]);
306
+ Object.freeze && Object.freeze(f);
297
307
  } else
298
308
  console.error(
299
309
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
300
310
  );
301
- else O(c);
302
- if (j.call(t, "key")) {
303
- c = o(e);
304
- var E = Object.keys(t).filter(function(te) {
305
- return te !== "key";
311
+ else R(f);
312
+ if (N.call(t, "key")) {
313
+ f = r(e);
314
+ var _ = Object.keys(t).filter(function(oe) {
315
+ return oe !== "key";
306
316
  });
307
- u = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", Y[c + u] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
317
+ l = 0 < _.length ? "{key: someKey, " + _.join(": ..., ") + ": ...}" : "{key: someKey}", M[f + l] || (_ = 0 < _.length ? "{" + _.join(": ..., ") + ": ...}" : "{}", console.error(
308
318
  `A props object containing a "key" prop is being spread into JSX:
309
319
  let props = %s;
310
320
  <%s {...props} />
311
321
  React keys must be passed directly to JSX without using spread:
312
322
  let props = %s;
313
323
  <%s key={someKey} {...props} />`,
314
- u,
315
- c,
316
- E,
317
- c
318
- ), Y[c + u] = !0);
324
+ l,
325
+ f,
326
+ _,
327
+ f
328
+ ), M[f + l] = !0);
319
329
  }
320
- if (c = null, a !== void 0 && (r(a), c = "" + a), v(t) && (r(t.key), c = "" + t.key), "key" in t) {
321
- a = {};
322
- for (var k in t)
323
- k !== "key" && (a[k] = t[k]);
324
- } else a = t;
325
- return c && b(
326
- a,
330
+ if (f = null, s !== void 0 && (n(s), f = "" + s), S(t) && (n(t.key), f = "" + t.key), "key" in t) {
331
+ s = {};
332
+ for (var C in t)
333
+ C !== "key" && (s[C] = t[C]);
334
+ } else s = t;
335
+ return f && a(
336
+ s,
327
337
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
328
- ), U(
338
+ ), p(
329
339
  e,
330
- c,
331
- d,
332
- m,
333
- n(),
334
- a,
335
- w,
336
- x
340
+ f,
341
+ b,
342
+ v,
343
+ o(),
344
+ s,
345
+ y,
346
+ A
337
347
  );
338
348
  }
339
- function O(e) {
340
- typeof e == "object" && e !== null && e.$$typeof === y && e._store && (e._store.validated = 1);
349
+ function R(e) {
350
+ typeof e == "object" && e !== null && e.$$typeof === h && e._store && (e._store.validated = 1);
341
351
  }
342
- var p = oe, y = Symbol.for("react.transitional.element"), q = Symbol.for("react.portal"), g = Symbol.for("react.fragment"), J = Symbol.for("react.strict_mode"), z = Symbol.for("react.profiler"), V = Symbol.for("react.consumer"), G = Symbol.for("react.context"), X = Symbol.for("react.forward_ref"), H = Symbol.for("react.suspense"), B = Symbol.for("react.suspense_list"), Z = Symbol.for("react.memo"), A = Symbol.for("react.lazy"), K = Symbol.for("react.activity"), ee = Symbol.for("react.client.reference"), h = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, re = Array.isArray, T = console.createTask ? console.createTask : function() {
352
+ var E = ae, h = Symbol.for("react.transitional.element"), z = Symbol.for("react.portal"), O = 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"), $ = Symbol.for("react.lazy"), re = Symbol.for("react.activity"), te = Symbol.for("react.client.reference"), P = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, N = Object.prototype.hasOwnProperty, ne = Array.isArray, j = console.createTask ? console.createTask : function() {
343
353
  return null;
344
354
  };
345
- p = {
355
+ E = {
346
356
  react_stack_bottom_frame: function(e) {
347
357
  return e();
348
358
  }
349
359
  };
350
- var C, N = {}, $ = p.react_stack_bottom_frame.bind(
351
- p,
360
+ var Y, F = {}, I = E.react_stack_bottom_frame.bind(
361
+ E,
352
362
  i
353
- )(), F = T(l(i)), Y = {};
354
- _.Fragment = g, _.jsx = function(e, t, a, u, m) {
355
- var d = 1e4 > h.recentlyCreatedOwnerStacks++;
356
- return P(
363
+ )(), Q = j(u(i)), M = {};
364
+ T.Fragment = O, T.jsx = function(e, t, s, l, v) {
365
+ var b = 1e4 > P.recentlyCreatedOwnerStacks++;
366
+ return m(
357
367
  e,
358
368
  t,
359
- a,
369
+ s,
360
370
  !1,
361
- u,
362
- m,
363
- d ? Error("react-stack-top-frame") : $,
364
- d ? T(l(e)) : F
371
+ l,
372
+ v,
373
+ b ? Error("react-stack-top-frame") : I,
374
+ b ? j(u(e)) : Q
365
375
  );
366
- }, _.jsxs = function(e, t, a, u, m) {
367
- var d = 1e4 > h.recentlyCreatedOwnerStacks++;
368
- return P(
376
+ }, T.jsxs = function(e, t, s, l, v) {
377
+ var b = 1e4 > P.recentlyCreatedOwnerStacks++;
378
+ return m(
369
379
  e,
370
380
  t,
371
- a,
381
+ s,
372
382
  !0,
373
- u,
374
- m,
375
- d ? Error("react-stack-top-frame") : $,
376
- d ? T(l(e)) : F
383
+ l,
384
+ v,
385
+ b ? Error("react-stack-top-frame") : I,
386
+ b ? j(u(e)) : Q
377
387
  );
378
388
  };
379
- }()), _;
389
+ })()), T;
380
390
  }
381
- var D;
382
- function de() {
383
- return D || (D = 1, process.env.NODE_ENV === "production" ? S.exports = le() : S.exports = fe()), S.exports;
391
+ var U;
392
+ function me() {
393
+ return U || (U = 1, process.env.NODE_ENV === "production" ? k.exports = fe() : k.exports = de()), k.exports;
384
394
  }
385
- var me = de();
386
- function _e({ stores: o, children: s }) {
395
+ var Ee = me();
396
+ function ge({ stores: r, children: c }) {
387
397
  try {
388
- if (!o || typeof o != "object") {
389
- const r = "QuantaProvider: Invalid stores prop provided";
390
- throw f.error(r), new Error(r);
398
+ if (!r || typeof r != "object") {
399
+ const n = "QuantaProvider: Invalid stores prop provided";
400
+ throw d.error(n), new Error(n);
391
401
  }
392
- for (const [r, l] of Object.entries(o))
393
- if (!l || typeof l != "object") {
394
- const n = `QuantaProvider: Invalid store "${r}" provided`;
395
- throw f.error(n), new Error(n);
402
+ for (const [n, u] of Object.entries(r))
403
+ if (!u || typeof u != "object") {
404
+ const o = `QuantaProvider: Invalid store "${n}" provided`;
405
+ throw d.error(o), new Error(o);
396
406
  }
397
- return /* @__PURE__ */ me.jsx(L.Provider, { value: { stores: o }, children: s });
398
- } catch (r) {
399
- throw f.error(
400
- `QuantaProvider: Failed to render provider: ${r instanceof Error ? r.message : String(r)}`
401
- ), r;
407
+ return /* @__PURE__ */ Ee.jsx(q.Provider, { value: { stores: r }, children: c });
408
+ } catch (n) {
409
+ throw d.error(
410
+ `QuantaProvider: Failed to render provider: ${n instanceof Error ? n.message : String(n)}`
411
+ ), n;
402
412
  }
403
413
  }
404
414
  export {
405
- L as QuantaContext,
406
- _e as QuantaProvider,
407
- ge as computed,
408
- he as createStore,
415
+ q as QuantaContext,
416
+ ge as QuantaProvider,
417
+ _e as computed,
418
+ we as createStore,
409
419
  Te as logger,
410
- we as reactive,
411
- Re as useCreateStore,
412
- ie as useQuantaContext,
413
- I as useQuantaStore,
414
- be as useStore,
415
- xe as watch
420
+ xe as reactive,
421
+ Se as useCreateStore,
422
+ le as useQuantaContext,
423
+ D as useQuantaStore,
424
+ ve as useStore,
425
+ ke as watch
416
426
  };
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "url": "https://github.com/quanta-js/quanta/issues"
23
23
  },
24
24
  "homepage": "https://quantajs.com",
25
- "version": "2.0.0-beta.3",
25
+ "version": "2.0.0-beta.5",
26
26
  "type": "module",
27
27
  "license": "MIT",
28
28
  "main": "./dist/index.js",
@@ -43,10 +43,10 @@
43
43
  "react": ">=16.8.0"
44
44
  },
45
45
  "dependencies": {
46
- "@quantajs/core": "2.0.0-beta.3"
46
+ "@quantajs/core": "2.0.0-beta.5"
47
47
  },
48
48
  "devDependencies": {
49
- "@types/react": "^19.1.9",
49
+ "@types/react": "^19.1.13",
50
50
  "react": "^19.1.1"
51
51
  },
52
52
  "publishConfig": {