@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 +2 -18
- package/dist/index.js +247 -237
- package/package.json +3 -3
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
|
|
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} />`,
|
|
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
|
|
24
|
-
import { logger as
|
|
25
|
-
import { computed as
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
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
|
|
56
|
-
function
|
|
83
|
+
const q = ce({ stores: {} });
|
|
84
|
+
function le() {
|
|
57
85
|
try {
|
|
58
|
-
const
|
|
59
|
-
if (!
|
|
60
|
-
const
|
|
61
|
-
throw
|
|
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
|
|
64
|
-
} catch (
|
|
65
|
-
throw
|
|
66
|
-
`QuantaContext: Failed to access context: ${
|
|
67
|
-
),
|
|
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
|
|
98
|
+
function ve(r, c) {
|
|
71
99
|
try {
|
|
72
|
-
const { stores:
|
|
73
|
-
if (!
|
|
74
|
-
const
|
|
75
|
-
throw
|
|
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
|
|
78
|
-
} catch (
|
|
79
|
-
throw
|
|
80
|
-
`useStore: Failed to access store "${
|
|
81
|
-
),
|
|
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
|
|
112
|
+
function Se(r, c, n, u) {
|
|
85
113
|
try {
|
|
86
|
-
const
|
|
87
|
-
if (!
|
|
114
|
+
const o = J(void 0);
|
|
115
|
+
if (!o.current)
|
|
88
116
|
try {
|
|
89
|
-
|
|
90
|
-
state:
|
|
91
|
-
getters:
|
|
92
|
-
actions:
|
|
117
|
+
o.current = ie(r, {
|
|
118
|
+
state: c,
|
|
119
|
+
getters: n,
|
|
120
|
+
actions: u
|
|
93
121
|
});
|
|
94
122
|
} catch (i) {
|
|
95
|
-
throw
|
|
96
|
-
`useCreateStore: Failed to create store "${
|
|
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
|
|
100
|
-
} catch (
|
|
101
|
-
throw
|
|
102
|
-
`useCreateStore: Hook execution failed: ${
|
|
103
|
-
),
|
|
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
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
|
126
|
-
|
|
127
|
-
} else i =
|
|
128
|
-
return
|
|
129
|
-
$$typeof:
|
|
130
|
-
type:
|
|
131
|
-
key:
|
|
132
|
-
ref:
|
|
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
|
|
155
|
+
return w.Fragment = c, w.jsx = n, w.jsxs = n, w;
|
|
137
156
|
}
|
|
138
|
-
var
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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 ===
|
|
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
|
|
167
|
+
case O:
|
|
158
168
|
return "Fragment";
|
|
159
|
-
case
|
|
169
|
+
case G:
|
|
160
170
|
return "Profiler";
|
|
161
|
-
case
|
|
171
|
+
case V:
|
|
162
172
|
return "StrictMode";
|
|
163
|
-
case
|
|
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
|
|
184
|
+
case z:
|
|
175
185
|
return "Portal";
|
|
176
|
-
case
|
|
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
|
|
184
|
-
return t = e.displayName || null, t !== null ? t :
|
|
185
|
-
case
|
|
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
|
|
198
|
+
return r(e(t));
|
|
189
199
|
} catch {
|
|
190
200
|
}
|
|
191
201
|
}
|
|
192
202
|
return null;
|
|
193
203
|
}
|
|
194
|
-
function
|
|
204
|
+
function c(e) {
|
|
195
205
|
return "" + e;
|
|
196
206
|
}
|
|
197
|
-
function
|
|
207
|
+
function n(e) {
|
|
198
208
|
try {
|
|
199
|
-
|
|
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
|
|
207
|
-
return
|
|
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
|
-
|
|
211
|
-
),
|
|
220
|
+
l
|
|
221
|
+
), c(e);
|
|
212
222
|
}
|
|
213
223
|
}
|
|
214
|
-
function
|
|
215
|
-
if (e ===
|
|
216
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
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 =
|
|
229
|
+
var t = r(e);
|
|
220
230
|
return t ? "<" + t + ">" : "<...>";
|
|
221
231
|
} catch {
|
|
222
232
|
return "<...>";
|
|
223
233
|
}
|
|
224
234
|
}
|
|
225
|
-
function
|
|
226
|
-
var e =
|
|
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
|
|
233
|
-
if (
|
|
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
|
|
240
|
-
function
|
|
241
|
-
|
|
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
|
-
|
|
247
|
-
get:
|
|
256
|
+
s.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
257
|
+
get: s,
|
|
248
258
|
configurable: !0
|
|
249
259
|
});
|
|
250
260
|
}
|
|
251
|
-
function
|
|
252
|
-
var e =
|
|
253
|
-
return
|
|
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
|
|
258
|
-
return
|
|
259
|
-
$$typeof:
|
|
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:
|
|
263
|
-
_owner:
|
|
264
|
-
}, (
|
|
272
|
+
props: b,
|
|
273
|
+
_owner: v
|
|
274
|
+
}, (s !== void 0 ? s : null) !== null ? Object.defineProperty(e, "ref", {
|
|
265
275
|
enumerable: !1,
|
|
266
|
-
get:
|
|
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:
|
|
291
|
+
value: y
|
|
282
292
|
}), Object.defineProperty(e, "_debugTask", {
|
|
283
293
|
configurable: !1,
|
|
284
294
|
enumerable: !1,
|
|
285
295
|
writable: !0,
|
|
286
|
-
value:
|
|
296
|
+
value: A
|
|
287
297
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
288
298
|
}
|
|
289
|
-
function
|
|
290
|
-
var
|
|
291
|
-
if (
|
|
292
|
-
if (
|
|
293
|
-
if (
|
|
294
|
-
for (
|
|
295
|
-
|
|
296
|
-
Object.freeze && Object.freeze(
|
|
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
|
|
302
|
-
if (
|
|
303
|
-
|
|
304
|
-
var
|
|
305
|
-
return
|
|
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
|
-
|
|
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
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
),
|
|
324
|
+
l,
|
|
325
|
+
f,
|
|
326
|
+
_,
|
|
327
|
+
f
|
|
328
|
+
), M[f + l] = !0);
|
|
319
329
|
}
|
|
320
|
-
if (
|
|
321
|
-
|
|
322
|
-
for (var
|
|
323
|
-
|
|
324
|
-
} else
|
|
325
|
-
return
|
|
326
|
-
|
|
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
|
-
),
|
|
338
|
+
), p(
|
|
329
339
|
e,
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
340
|
+
f,
|
|
341
|
+
b,
|
|
342
|
+
v,
|
|
343
|
+
o(),
|
|
344
|
+
s,
|
|
345
|
+
y,
|
|
346
|
+
A
|
|
337
347
|
);
|
|
338
348
|
}
|
|
339
|
-
function
|
|
340
|
-
typeof e == "object" && e !== null && e.$$typeof ===
|
|
349
|
+
function R(e) {
|
|
350
|
+
typeof e == "object" && e !== null && e.$$typeof === h && e._store && (e._store.validated = 1);
|
|
341
351
|
}
|
|
342
|
-
var
|
|
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
|
-
|
|
355
|
+
E = {
|
|
346
356
|
react_stack_bottom_frame: function(e) {
|
|
347
357
|
return e();
|
|
348
358
|
}
|
|
349
359
|
};
|
|
350
|
-
var
|
|
351
|
-
|
|
360
|
+
var Y, F = {}, I = E.react_stack_bottom_frame.bind(
|
|
361
|
+
E,
|
|
352
362
|
i
|
|
353
|
-
)(),
|
|
354
|
-
|
|
355
|
-
var
|
|
356
|
-
return
|
|
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
|
-
|
|
369
|
+
s,
|
|
360
370
|
!1,
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
371
|
+
l,
|
|
372
|
+
v,
|
|
373
|
+
b ? Error("react-stack-top-frame") : I,
|
|
374
|
+
b ? j(u(e)) : Q
|
|
365
375
|
);
|
|
366
|
-
},
|
|
367
|
-
var
|
|
368
|
-
return
|
|
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
|
-
|
|
381
|
+
s,
|
|
372
382
|
!0,
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
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
|
|
382
|
-
function
|
|
383
|
-
return
|
|
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
|
|
386
|
-
function
|
|
395
|
+
var Ee = me();
|
|
396
|
+
function ge({ stores: r, children: c }) {
|
|
387
397
|
try {
|
|
388
|
-
if (!
|
|
389
|
-
const
|
|
390
|
-
throw
|
|
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 [
|
|
393
|
-
if (!
|
|
394
|
-
const
|
|
395
|
-
throw
|
|
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__ */
|
|
398
|
-
} catch (
|
|
399
|
-
throw
|
|
400
|
-
`QuantaProvider: Failed to render provider: ${
|
|
401
|
-
),
|
|
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
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
415
|
+
q as QuantaContext,
|
|
416
|
+
ge as QuantaProvider,
|
|
417
|
+
_e as computed,
|
|
418
|
+
we as createStore,
|
|
409
419
|
Te as logger,
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
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.
|
|
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.
|
|
46
|
+
"@quantajs/core": "2.0.0-beta.5"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@types/react": "^19.1.
|
|
49
|
+
"@types/react": "^19.1.13",
|
|
50
50
|
"react": "^19.1.1"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|