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