@directive-run/solid 0.1.1
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/LICENSE +21 -0
- package/README.md +43 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +162 -0
- package/dist/index.d.ts +162 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jason Comes
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @directive-run/solid
|
|
2
|
+
|
|
3
|
+
Solid.js signals adapter for Directive. Provides `Accessor`-based primitives for reading facts, derivations, and dispatching events.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @directive-run/core @directive-run/solid
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { useFact, useDerived, useEvents } from "@directive-run/solid";
|
|
15
|
+
|
|
16
|
+
function Counter() {
|
|
17
|
+
const count = useFact(system, "count");
|
|
18
|
+
const doubled = useDerived(system, "doubled");
|
|
19
|
+
const events = useEvents(system);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div>
|
|
23
|
+
<p>Count: {count()} (doubled: {doubled()})</p>
|
|
24
|
+
<button onClick={() => events.increment()}>+</button>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Exports
|
|
31
|
+
|
|
32
|
+
`useFact`, `useDerived`, `useSelector`, `useDispatch`, `useEvents`, `useWatch`, `useInspect`, `useRequirementStatus`, `useSuspenseRequirement`, `useExplain`, `useConstraintStatus`, `useOptimisticUpdate`, `useTimeTravel`, `useDirective`, `createTypedHooks`, `createFactSignal`, `createDerivedSignal`, `shallowEqual`
|
|
33
|
+
|
|
34
|
+
## Peer Dependencies
|
|
35
|
+
|
|
36
|
+
- `solid-js >= 1`
|
|
37
|
+
- `@directive-run/core`
|
|
38
|
+
|
|
39
|
+
## License
|
|
40
|
+
|
|
41
|
+
MIT
|
|
42
|
+
|
|
43
|
+
[Full documentation](https://directive.run/docs)
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var solidJs=require('solid-js'),core=require('@directive-run/core'),adapterUtils=require('@directive-run/core/adapter-utils');function V(e,t){return adapterUtils.assertSystem("useFact",e),process.env.NODE_ENV!=="production"&&typeof t=="function"&&console.error("[Directive] useFact() received a function. Did you mean useSelector()? useFact() takes a string key or array of keys, not a selector function."),Array.isArray(t)?C(e,t):E(e,t)}function E(e,t){process.env.NODE_ENV!=="production"&&(e.facts.$store.has(t)||console.warn(`[Directive] useFact("${t}") \u2014 fact not found in store. Check that "${t}" is defined in your module's schema.`));let[s,r]=solidJs.createSignal(e.facts.$store.get(t)),n=e.facts.$store.subscribe([t],()=>{r(()=>e.facts.$store.get(t));});return solidJs.onCleanup(n),s}function C(e,t){let s=()=>{let u={};for(let i of t)u[i]=e.facts.$store.get(i);return u},[r,n]=solidJs.createSignal(s()),o=e.facts.$store.subscribe(t,()=>{n(s);});return solidJs.onCleanup(o),r}function q(e,t){return adapterUtils.assertSystem("useDerived",e),process.env.NODE_ENV!=="production"&&typeof t=="function"&&console.error("[Directive] useDerived() received a function. Did you mean useSelector()? useDerived() takes a string key or array of keys, not a selector function."),Array.isArray(t)?P(e,t):$(e,t)}function $(e,t){process.env.NODE_ENV!=="production"&&e.read(t)===void 0&&console.warn(`[Directive] useDerived("${t}") returned undefined. Check that "${t}" is defined in your module's derive property.`);let[s,r]=solidJs.createSignal(e.read(t)),n=e.subscribe([t],()=>{r(()=>e.read(t));});return solidJs.onCleanup(n),s}function P(e,t){let s=()=>{let u={};for(let i of t)u[i]=e.read(i);return u},[r,n]=solidJs.createSignal(s()),o=e.subscribe(t,()=>{n(s);});return solidJs.onCleanup(o),r}function L(e,t,s=adapterUtils.defaultEquality){adapterUtils.assertSystem("useSelector",e);let r=new Set(Object.keys(e.derive??{})),n=()=>adapterUtils.runTrackedSelector(e,r,t),o=n(),u=o.factKeys,i=o.deriveKeys,[c,f]=solidJs.createSignal(o.value),d=[],y=()=>{for(let p of d)p();d.length=0;let S=()=>{let p=n();f(b=>s(b,p.value)?b:p.value),adapterUtils.depsChanged(u,p.factKeys,i,p.deriveKeys)&&(u=p.factKeys,i=p.deriveKeys,y());};u.length>0?d.push(e.facts.$store.subscribe(u,S)):i.length===0&&d.push(e.facts.$store.subscribeAll(S)),i.length>0&&d.push(e.subscribe(i,S));};return y(),solidJs.onCleanup(()=>{for(let S of d)S();}),c}function H(e){return adapterUtils.assertSystem("useDispatch",e),t=>{e.dispatch(t);}}function U(e){return adapterUtils.assertSystem("useEvents",e),e.events}function W(e,t,s,r){adapterUtils.assertSystem("useWatch",e);let n=t==="fact"&&typeof s=="string"&&typeof r=="function",o=n?s:t,u=n?r:s,i=e.watch(o,u);solidJs.onCleanup(i);}function G(e,t){adapterUtils.assertSystem("useInspect",e);let[s,r]=solidJs.createSignal(adapterUtils.computeInspectState(e)),n=()=>{r(adapterUtils.computeInspectState(e));};if(t?.throttleMs&&t.throttleMs>0){let{throttled:o,cleanup:u}=adapterUtils.createThrottle(n,t.throttleMs),i=e.facts.$store.subscribeAll(o),c=e.onSettledChange(o);solidJs.onCleanup(()=>{u(),i(),c();});}else {let o=e.facts.$store.subscribeAll(n),u=e.onSettledChange(n);solidJs.onCleanup(()=>{o(),u();});}return s}function k(e,t){if(Array.isArray(t)){let o=()=>{let f={};for(let d of t)f[d]=e.getStatus(d);return f},[u,i]=solidJs.createSignal(o()),c=e.subscribe(()=>{i(o);});return solidJs.onCleanup(c),u}let[s,r]=solidJs.createSignal(e.getStatus(t)),n=e.subscribe(()=>{r(e.getStatus(t));});return solidJs.onCleanup(n),s}function J(e,t){adapterUtils.assertSystem("useExplain",e);let[s,r]=solidJs.createSignal(e.explain(t)),n=()=>r(e.explain(t)),o=e.facts.$store.subscribeAll(n),u=e.onSettledChange(n);return solidJs.onCleanup(()=>{o(),u();}),s}function Q(e,t){adapterUtils.assertSystem("useConstraintStatus",e);let s=()=>{let c=e.inspect();return t?c.constraints.find(f=>f.id===t)??null:c.constraints},[r,n]=solidJs.createSignal(s()),o=()=>n(s),u=e.facts.$store.subscribeAll(o),i=e.onSettledChange(o);return solidJs.onCleanup(()=>{u(),i();}),r}function X(e,t,s){adapterUtils.assertSystem("useOptimisticUpdate",e);let[r,n]=solidJs.createSignal(false),[o,u]=solidJs.createSignal(null),i=null,c=null,f=()=>{i&&(e.restore(i),i=null),n(false),u(null),c?.(),c=null;},d=y=>{i=e.getSnapshot(),n(true),u(null),e.batch(y),t&&s&&(c?.(),c=t.subscribe(()=>{let S=t.getStatus(s);!S.isLoading&&!S.hasError?(i=null,n(false),c?.(),c=null):S.hasError&&(u(()=>S.lastError),f());}));};return solidJs.onCleanup(()=>{c?.();}),{mutate:d,isPending:r,error:o,rollback:f}}function Y(e,t){let s=Array.isArray(t)?t:[t],r=()=>s.some(n=>e.getStatus(n).isLoading);if(r())throw new Promise(n=>{let o=e.subscribe(()=>{r()||(o(),n());});});return k(e,t)}function Z(e){adapterUtils.assertSystem("useTimeTravel",e);let[t,s]=solidJs.createSignal(adapterUtils.buildTimeTravelState(e)),r=e.onTimeTravelChange(()=>s(adapterUtils.buildTimeTravelState(e)));return solidJs.onCleanup(r),t}function O(e,t){let s=[...t?.plugins??[]],r;if(t?.status){let v=core.createRequirementStatusPlugin();r=v,s.push(v.plugin);}let n=core.createSystem({module:e,plugins:s.length>0?s:void 0,debug:t?.debug,errorBoundary:t?.errorBoundary,tickMs:t?.tickMs,zeroConfig:t?.zeroConfig,initialFacts:t?.initialFacts});n.start(),solidJs.onCleanup(()=>{n.destroy();});let o=t?.facts,u=t?.derived,i=!o&&!u,[c,f]=solidJs.createSignal(i?n.facts.$store.toObject():adapterUtils.pickFacts(n,o??[])),d=i?n.facts.$store.subscribeAll(()=>{f(()=>n.facts.$store.toObject());}):o&&o.length>0?n.facts.$store.subscribe(o,()=>{f(()=>adapterUtils.pickFacts(n,o));}):null,y=i?Object.keys(n.derive??{}):u??[],S=()=>{let v={};for(let M of y)v[M]=n.read(M);return v},[p,b]=solidJs.createSignal(S()),A=y.length>0?n.subscribe(y,()=>{b(S);}):null;solidJs.onCleanup(()=>{d?.(),A?.();});let R=n.events;return {system:n,facts:c,derived:p,events:R,dispatch:v=>n.dispatch(v),statusPlugin:r}}function ee(e,t){let[s,r]=solidJs.createSignal(e.read(t)),n=e.subscribe([t],()=>{r(()=>e.read(t));});return [s,n]}function te(e,t){let[s,r]=solidJs.createSignal(e.facts.$store.get(t)),n=e.facts.$store.subscribe([t],()=>{r(()=>e.facts.$store.get(t));});return [s,n]}function ne(){return {useFact:(e,t)=>V(e,t),useDerived:(e,t)=>q(e,t),useDispatch:e=>t=>{e.dispatch(t);},useEvents:e=>U(e),useWatch:(e,t,s)=>W(e,t,s)}}Object.defineProperty(exports,"shallowEqual",{enumerable:true,get:function(){return adapterUtils.shallowEqual}});exports.createDerivedSignal=ee;exports.createFactSignal=te;exports.createTypedHooks=ne;exports.useConstraintStatus=Q;exports.useDerived=q;exports.useDirective=O;exports.useDispatch=H;exports.useEvents=U;exports.useExplain=J;exports.useFact=V;exports.useInspect=G;exports.useOptimisticUpdate=X;exports.useRequirementStatus=k;exports.useSelector=L;exports.useSuspenseRequirement=Y;exports.useTimeTravel=Z;exports.useWatch=W;//# sourceMappingURL=index.cjs.map
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["useFact","system","keyOrKeys","assertSystem","_useFactMulti","_useFactSingle","factKey","value","setValue","createSignal","unsubscribe","onCleanup","factKeys","getValues","result","key","state","setState","useDerived","idOrIds","_useDerivedMulti","_useDerivedSingle","derivationId","derivationIds","id","useSelector","selector","equalityFn","defaultEquality","deriveKeySet","runWithTracking","runTrackedSelector","initial","trackedFactKeys","trackedDeriveKeys","selected","setSelected","unsubs","resubscribe","unsub","onUpdate","prev","depsChanged","useDispatch","event","useEvents","useWatch","derivationIdOrKind","callbackOrFactKey","maybeCallback","isFact","callback","useInspect","options","computeInspectState","update","throttled","cleanup","createThrottle","unsubFacts","unsubSettled","useRequirementStatus","statusPlugin","typeOrTypes","type","status","setStatus","useExplain","requirementId","explanation","setExplanation","useConstraintStatus","constraintId","getVal","inspection","c","useOptimisticUpdate","requirementType","isPending","setIsPending","error","setError","snapshot","statusUnsub","rollback","mutate","updateFn","useSuspenseRequirement","types","anyLoading","t","resolve","useTimeTravel","buildTimeTravelState","useDirective","moduleDef","config","allPlugins","sp","createRequirementStatusPlugin","createSystem","derivedKeys","subscribeAll","factsState","setFactsState","pickFacts","allDerivationKeys","getDerived","derivedState","setDerivedState","unsubDerived","events","createDerivedSignal","createFactSignal","createTypedHooks"],"mappings":"2IAgEO,SAASA,CAAAA,CAEfC,EACAC,CAAAA,CACoB,CAUpB,OATAC,yBAAAA,CAAa,SAAA,CAAWF,CAAM,CAAA,CAC1B,OAAA,CAAQ,GAAA,CAAI,QAAA,GAAa,cAAgB,OAAOC,CAAAA,EAAc,YACjE,OAAA,CAAQ,KAAA,CACP,gJAED,CAAA,CAIG,KAAA,CAAM,OAAA,CAAQA,CAAS,EACnBE,CAAAA,CAAcH,CAAAA,CAAQC,CAAS,CAAA,CAIhCG,CAAAA,CAAeJ,EAAQC,CAAS,CACxC,CAGA,SAASG,EAAeJ,CAAAA,CAAiCK,CAAAA,CAAoC,CACxF,OAAA,CAAQ,GAAA,CAAI,WAAa,YAAA,GACvBL,CAAAA,CAAO,MAAM,MAAA,CAAO,GAAA,CAAIK,CAAO,CAAA,EACnC,OAAA,CAAQ,KACP,CAAA,qBAAA,EAAwBA,CAAO,kDAChBA,CAAO,CAAA,qCAAA,CACvB,CAAA,CAAA,CAIF,GAAM,CAACC,CAAAA,CAAOC,CAAQ,EAAIC,oBAAAA,CAAaR,CAAAA,CAAO,MAAM,MAAA,CAAO,GAAA,CAAIK,CAAO,CAAC,EACjEI,CAAAA,CAAcT,CAAAA,CAAO,MAAM,MAAA,CAAO,SAAA,CAAU,CAACK,CAAO,CAAA,CAAG,IAAM,CAClEE,EAAS,IAAMP,CAAAA,CAAO,MAAM,MAAA,CAAO,GAAA,CAAIK,CAAO,CAAC,EAChD,CAAC,CAAA,CACD,OAAAK,iBAAAA,CAAUD,CAAW,EACdH,CACR,CAGA,SAASH,CAAAA,CAAcH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AAkC4C,EAAa5C,CAAM,CAAA,CACjE,SAAU,CACTA,CAAAA,CACAc,EACAoC,CAAAA,GAGAL,CAAAA,CAAS7C,EAAmCc,CAAAA,CAAKoC,CAAQ,CAC3D,CACD","file":"index.cjs","sourcesContent":["/**\n * Solid Adapter - Consolidated SolidJS primitives for Directive\n *\n * 16 active exports: useFact, useDerived, useDispatch, useSelector,\n * useWatch, useInspect, useRequirementStatus, useEvents, useExplain,\n * useConstraintStatus, useOptimisticUpdate, useDirective, useTimeTravel,\n * createTypedHooks, useSuspenseRequirement, shallowEqual\n *\n * Signal factories: createDerivedSignal, createFactSignal\n */\n\nimport {\n\tcreateSignal,\n\tonCleanup,\n\ttype Accessor,\n} from \"solid-js\";\nimport type {\n\tModuleSchema,\n\tModuleDef,\n\tPlugin,\n\tDebugConfig,\n\tErrorBoundaryConfig,\n\tInferFacts,\n\tInferDerivations,\n\tInferSelectorState,\n\tInferEvents,\n\tSingleModuleSystem,\n\tSystemSnapshot,\n} from \"@directive-run/core\";\nimport {\n\tcreateSystem,\n\tcreateRequirementStatusPlugin,\n} from \"@directive-run/core\";\nimport type { RequirementTypeStatus } from \"@directive-run/core\";\nimport {\n\ttype InspectState,\n\ttype ConstraintInfo,\n\tcomputeInspectState,\n\tcreateThrottle,\n\tassertSystem,\n\tdefaultEquality,\n\tbuildTimeTravelState,\n\tpickFacts,\n\trunTrackedSelector,\n\tdepsChanged,\n\tshallowEqual,\n} from \"@directive-run/core/adapter-utils\";\n\n// Re-export for convenience\nexport type { RequirementTypeStatus, InspectState, ConstraintInfo };\nexport { shallowEqual };\n\n/** Type for the requirement status plugin return value */\nexport type StatusPlugin = ReturnType<typeof createRequirementStatusPlugin>;\n\n// ============================================================================\n// useFact — single key or multi key\n// ============================================================================\n\n/** Single key overload */\nexport function useFact<S extends ModuleSchema, K extends keyof InferFacts<S> & string>(system: SingleModuleSystem<S>, factKey: K): Accessor<InferFacts<S>[K] | undefined>;\n/** Multi-key overload */\nexport function useFact<S extends ModuleSchema, K extends keyof InferFacts<S> & string>(system: SingleModuleSystem<S>, factKeys: K[]): Accessor<Pick<InferFacts<S>, K>>;\n/** Implementation */\nexport function useFact(\n\t// biome-ignore lint/suspicious/noExplicitAny: Implementation signature\n\tsystem: SingleModuleSystem<any>,\n\tkeyOrKeys: string | string[],\n): Accessor<unknown> {\n\tassertSystem(\"useFact\", system);\n\tif (process.env.NODE_ENV !== \"production\" && typeof keyOrKeys === \"function\") {\n\t\tconsole.error(\n\t\t\t\"[Directive] useFact() received a function. Did you mean useSelector()? \" +\n\t\t\t\t\"useFact() takes a string key or array of keys, not a selector function.\",\n\t\t);\n\t}\n\n\t// Multi-key path\n\tif (Array.isArray(keyOrKeys)) {\n\t\treturn _useFactMulti(system, keyOrKeys);\n\t}\n\n\t// Single key path\n\treturn _useFactSingle(system, keyOrKeys);\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: Internal\nfunction _useFactSingle(system: SingleModuleSystem<any>, factKey: string): Accessor<unknown> {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tif (!system.facts.$store.has(factKey)) {\n\t\t\tconsole.warn(\n\t\t\t\t`[Directive] useFact(\"${factKey}\") — fact not found in store. ` +\n\t\t\t\t`Check that \"${factKey}\" is defined in your module's schema.`,\n\t\t\t);\n\t\t}\n\t}\n\n\tconst [value, setValue] = createSignal(system.facts.$store.get(factKey));\n\tconst unsubscribe = system.facts.$store.subscribe([factKey], () => {\n\t\tsetValue(() => system.facts.$store.get(factKey));\n\t});\n\tonCleanup(unsubscribe);\n\treturn value;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: Internal\nfunction _useFactMulti(system: SingleModuleSystem<any>, factKeys: string[]): Accessor<Record<string, unknown>> {\n\tconst getValues = (): Record<string, unknown> => {\n\t\tconst result: Record<string, unknown> = {};\n\t\tfor (const key of factKeys) {\n\t\t\tresult[key] = system.facts.$store.get(key);\n\t\t}\n\t\treturn result;\n\t};\n\tconst [state, setState] = createSignal(getValues());\n\tconst unsubscribe = system.facts.$store.subscribe(factKeys, () => {\n\t\tsetState(getValues);\n\t});\n\tonCleanup(unsubscribe);\n\treturn state;\n}\n\n// ============================================================================\n// useDerived — single key or multi key\n// ============================================================================\n\n/** Single key overload */\nexport function useDerived<S extends ModuleSchema, K extends keyof InferDerivations<S> & string>(system: SingleModuleSystem<S>, derivationId: K): Accessor<InferDerivations<S>[K]>;\n/** Multi-key overload */\nexport function useDerived<S extends ModuleSchema, K extends keyof InferDerivations<S> & string>(system: SingleModuleSystem<S>, derivationIds: K[]): Accessor<Pick<InferDerivations<S>, K>>;\n/** Implementation */\nexport function useDerived(\n\t// biome-ignore lint/suspicious/noExplicitAny: Implementation signature\n\tsystem: SingleModuleSystem<any>,\n\tidOrIds: string | string[],\n): Accessor<unknown> {\n\tassertSystem(\"useDerived\", system);\n\tif (process.env.NODE_ENV !== \"production\" && typeof idOrIds === \"function\") {\n\t\tconsole.error(\n\t\t\t\"[Directive] useDerived() received a function. Did you mean useSelector()? \" +\n\t\t\t\t\"useDerived() takes a string key or array of keys, not a selector function.\",\n\t\t);\n\t}\n\n\t// Multi-key path\n\tif (Array.isArray(idOrIds)) {\n\t\treturn _useDerivedMulti(system, idOrIds);\n\t}\n\n\t// Single key path\n\treturn _useDerivedSingle(system, idOrIds);\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: Internal\nfunction _useDerivedSingle(system: SingleModuleSystem<any>, derivationId: string): Accessor<unknown> {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tconst initialValue = system.read(derivationId);\n\t\tif (initialValue === undefined) {\n\t\t\tconsole.warn(\n\t\t\t\t`[Directive] useDerived(\"${derivationId}\") returned undefined. ` +\n\t\t\t\t`Check that \"${derivationId}\" is defined in your module's derive property.`,\n\t\t\t);\n\t\t}\n\t}\n\tconst [value, setValue] = createSignal(system.read(derivationId));\n\tconst unsubscribe = system.subscribe([derivationId], () => {\n\t\tsetValue(() => system.read(derivationId));\n\t});\n\tonCleanup(unsubscribe);\n\treturn value;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: Internal\nfunction _useDerivedMulti(system: SingleModuleSystem<any>, derivationIds: string[]): Accessor<Record<string, unknown>> {\n\tconst getValues = (): Record<string, unknown> => {\n\t\tconst result: Record<string, unknown> = {};\n\t\tfor (const id of derivationIds) {\n\t\t\tresult[id] = system.read(id);\n\t\t}\n\t\treturn result;\n\t};\n\tconst [state, setState] = createSignal(getValues());\n\tconst unsubscribe = system.subscribe(derivationIds, () => {\n\t\tsetState(getValues);\n\t});\n\tonCleanup(unsubscribe);\n\treturn state;\n}\n\n// ============================================================================\n// useSelector — auto-tracking selector over facts and derivations\n// ============================================================================\n\n/**\n * Auto-tracking selector over facts and derivations.\n * Uses `withTracking()` to detect which facts the selector accesses,\n * then subscribes only to those keys.\n */\nexport function useSelector<S extends ModuleSchema, R>(\n\tsystem: SingleModuleSystem<S>,\n\tselector: (state: InferSelectorState<S>) => R,\n\tequalityFn?: (a: R, b: R) => boolean,\n): Accessor<R>;\nexport function useSelector<R>(\n\t// biome-ignore lint/suspicious/noExplicitAny: Backward-compatible fallback\n\tsystem: SingleModuleSystem<any>,\n\t// biome-ignore lint/suspicious/noExplicitAny: Selector receives dynamic state\n\tselector: (state: Record<string, any>) => R,\n\tequalityFn?: (a: R, b: R) => boolean,\n): Accessor<R>;\nexport function useSelector(\n\t// biome-ignore lint/suspicious/noExplicitAny: Implementation signature\n\tsystem: SingleModuleSystem<any>,\n\t// biome-ignore lint/suspicious/noExplicitAny: Implementation signature\n\tselector: (state: any) => unknown,\n\tequalityFn: (a: unknown, b: unknown) => boolean = defaultEquality,\n): Accessor<unknown> {\n\tassertSystem(\"useSelector\", system);\n\tconst deriveKeySet = new Set(Object.keys(system.derive ?? {}));\n\n\t// Build a tracking-aware state proxy that exposes both facts and derivations\n\tconst runWithTracking = () => runTrackedSelector(system, deriveKeySet, selector);\n\n\tconst initial = runWithTracking();\n\tlet trackedFactKeys = initial.factKeys;\n\tlet trackedDeriveKeys = initial.deriveKeys;\n\tconst [selected, setSelected] = createSignal(initial.value);\n\n\tconst unsubs: Array<() => void> = [];\n\n\tconst resubscribe = () => {\n\t\tfor (const unsub of unsubs) unsub();\n\t\tunsubs.length = 0;\n\n\t\tconst onUpdate = () => {\n\t\t\tconst result = runWithTracking();\n\t\t\tsetSelected((prev) => {\n\t\t\t\tif (!equalityFn(prev, result.value)) return result.value;\n\t\t\t\treturn prev;\n\t\t\t});\n\t\t\t// Re-track: check if deps changed\n\t\t\tif (depsChanged(trackedFactKeys, result.factKeys, trackedDeriveKeys, result.deriveKeys)) {\n\t\t\t\ttrackedFactKeys = result.factKeys;\n\t\t\t\ttrackedDeriveKeys = result.deriveKeys;\n\t\t\t\tresubscribe();\n\t\t\t}\n\t\t};\n\n\t\tif (trackedFactKeys.length > 0) {\n\t\t\tunsubs.push(system.facts.$store.subscribe(trackedFactKeys, onUpdate));\n\t\t} else if (trackedDeriveKeys.length === 0) {\n\t\t\tunsubs.push(system.facts.$store.subscribeAll(onUpdate));\n\t\t}\n\t\tif (trackedDeriveKeys.length > 0) {\n\t\t\tunsubs.push(system.subscribe(trackedDeriveKeys, onUpdate));\n\t\t}\n\t};\n\n\tresubscribe();\n\n\tonCleanup(() => {\n\t\tfor (const unsub of unsubs) unsub();\n\t});\n\n\treturn selected;\n}\n\n// ============================================================================\n// useDispatch\n// ============================================================================\n\nexport function useDispatch<S extends ModuleSchema>(\n\tsystem: SingleModuleSystem<S>,\n): (event: InferEvents<S>) => void {\n\tassertSystem(\"useDispatch\", system);\n\treturn (event: InferEvents<S>) => {\n\t\tsystem.dispatch(event);\n\t};\n}\n\n// ============================================================================\n// useEvents — memoized events reference\n// ============================================================================\n\n/**\n * Returns the system's events dispatcher.\n */\nexport function useEvents<S extends ModuleSchema>(\n\tsystem: SingleModuleSystem<S>,\n): SingleModuleSystem<S>[\"events\"] {\n\tassertSystem(\"useEvents\", system);\n\treturn system.events;\n}\n\n// ============================================================================\n// useWatch — derivation or fact side-effect\n// ============================================================================\n\n/** Watch a derivation or fact by key (auto-detected). When a key exists in both facts and derivations, the derivation overload takes priority. */\nexport function useWatch<S extends ModuleSchema, K extends keyof InferDerivations<S> & string>(\n\tsystem: SingleModuleSystem<S>,\n\tkey: K,\n\tcallback: (newValue: InferDerivations<S>[K], previousValue: InferDerivations<S>[K] | undefined) => void,\n): void;\n/** Watch a fact key with auto-detection. */\nexport function useWatch<S extends ModuleSchema, K extends keyof InferFacts<S> & string>(\n\tsystem: SingleModuleSystem<S>,\n\tkey: K,\n\tcallback: (newValue: InferFacts<S>[K] | undefined, previousValue: InferFacts<S>[K] | undefined) => void,\n): void;\n/**\n * Watch a fact by explicit \"fact\" discriminator.\n * @deprecated Use `useWatch(system, key, callback)` instead — facts are now auto-detected.\n */\nexport function useWatch<S extends ModuleSchema, K extends keyof InferFacts<S> & string>(\n\tsystem: SingleModuleSystem<S>,\n\tkind: \"fact\",\n\tfactKey: K,\n\tcallback: (newValue: InferFacts<S>[K] | undefined, previousValue: InferFacts<S>[K] | undefined) => void,\n): void;\n/** Watch a fact or derivation (generic fallback) */\nexport function useWatch<T>(\n\t// biome-ignore lint/suspicious/noExplicitAny: Backward-compatible fallback\n\tsystem: SingleModuleSystem<any>,\n\tkey: string,\n\tcallback: (newValue: T, previousValue: T | undefined) => void,\n): void;\n/** Implementation */\nexport function useWatch(\n\t// biome-ignore lint/suspicious/noExplicitAny: Implementation signature\n\tsystem: SingleModuleSystem<any>,\n\tderivationIdOrKind: string,\n\tcallbackOrFactKey: string | ((newValue: unknown, prevValue: unknown) => void),\n\tmaybeCallback?: (newValue: unknown, prevValue: unknown) => void,\n): void {\n\tassertSystem(\"useWatch\", system);\n\t// Backward compat: useWatch(system, \"fact\", factKey, callback)\n\tconst isFact =\n\t\tderivationIdOrKind === \"fact\" &&\n\t\ttypeof callbackOrFactKey === \"string\" &&\n\t\ttypeof maybeCallback === \"function\";\n\n\tconst key = isFact ? (callbackOrFactKey as string) : derivationIdOrKind;\n\tconst callback = isFact\n\t\t? maybeCallback!\n\t\t: (callbackOrFactKey as (newValue: unknown, prevValue: unknown) => void);\n\n\tconst unsubscribe = system.watch(key, callback);\n\tonCleanup(unsubscribe);\n}\n\n// ============================================================================\n// useInspect — consolidated inspection hook\n// ============================================================================\n\n/** Options for useInspect */\nexport interface UseInspectOptions {\n\tthrottleMs?: number;\n}\n\n/**\n * Consolidated system inspection hook.\n * Returns Accessor<InspectState> with optional throttling.\n */\nexport function useInspect(\n\t// biome-ignore lint/suspicious/noExplicitAny: Must work with any schema\n\tsystem: SingleModuleSystem<any>,\n\toptions?: UseInspectOptions,\n): Accessor<InspectState> {\n\tassertSystem(\"useInspect\", system);\n\tconst [state, setState] = createSignal<InspectState>(computeInspectState(system));\n\n\tconst update = () => {\n\t\tsetState(computeInspectState(system));\n\t};\n\n\tif (options?.throttleMs && options.throttleMs > 0) {\n\t\tconst { throttled, cleanup } = createThrottle(update, options.throttleMs);\n\t\tconst unsubFacts = system.facts.$store.subscribeAll(throttled);\n\t\tconst unsubSettled = system.onSettledChange(throttled);\n\t\tonCleanup(() => {\n\t\t\tcleanup();\n\t\t\tunsubFacts();\n\t\t\tunsubSettled();\n\t\t});\n\t} else {\n\t\tconst unsubFacts = system.facts.$store.subscribeAll(update);\n\t\tconst unsubSettled = system.onSettledChange(update);\n\t\tonCleanup(() => {\n\t\t\tunsubFacts();\n\t\t\tunsubSettled();\n\t\t});\n\t}\n\n\treturn state;\n}\n\n// ============================================================================\n// useRequirementStatus — single or multi\n// ============================================================================\n\n/** Single type overload */\nexport function useRequirementStatus(statusPlugin: StatusPlugin, type: string): Accessor<RequirementTypeStatus>;\n/** Multi-type overload */\nexport function useRequirementStatus(statusPlugin: StatusPlugin, types: string[]): Accessor<Record<string, RequirementTypeStatus>>;\n/** Implementation */\nexport function useRequirementStatus(\n\tstatusPlugin: StatusPlugin,\n\ttypeOrTypes: string | string[],\n): Accessor<RequirementTypeStatus> | Accessor<Record<string, RequirementTypeStatus>> {\n\tif (Array.isArray(typeOrTypes)) {\n\t\tconst getValues = (): Record<string, RequirementTypeStatus> => {\n\t\t\tconst result: Record<string, RequirementTypeStatus> = {};\n\t\t\tfor (const type of typeOrTypes) {\n\t\t\t\tresult[type] = statusPlugin.getStatus(type);\n\t\t\t}\n\t\t\treturn result;\n\t\t};\n\t\tconst [state, setState] = createSignal(getValues());\n\t\tconst unsubscribe = statusPlugin.subscribe(() => {\n\t\t\tsetState(getValues);\n\t\t});\n\t\tonCleanup(unsubscribe);\n\t\treturn state;\n\t}\n\n\tconst [status, setStatus] = createSignal<RequirementTypeStatus>(statusPlugin.getStatus(typeOrTypes));\n\tconst unsubscribe = statusPlugin.subscribe(() => {\n\t\tsetStatus(statusPlugin.getStatus(typeOrTypes));\n\t});\n\tonCleanup(unsubscribe);\n\treturn status;\n}\n\n// ============================================================================\n// useExplain — reactive requirement explanation\n// ============================================================================\n\n/**\n * Reactively returns the explanation string for a requirement.\n */\nexport function useExplain(\n\t// biome-ignore lint/suspicious/noExplicitAny: Must work with any schema\n\tsystem: SingleModuleSystem<any>,\n\trequirementId: string,\n): Accessor<string | null> {\n\tassertSystem(\"useExplain\", system);\n\tconst [explanation, setExplanation] = createSignal<string | null>(system.explain(requirementId));\n\n\tconst update = () => setExplanation(system.explain(requirementId));\n\tconst unsubFacts = system.facts.$store.subscribeAll(update);\n\tconst unsubSettled = system.onSettledChange(update);\n\tonCleanup(() => {\n\t\tunsubFacts();\n\t\tunsubSettled();\n\t});\n\n\treturn explanation;\n}\n\n// ============================================================================\n// useConstraintStatus — reactive constraint inspection\n// ============================================================================\n\n/** Get all constraints */\nexport function useConstraintStatus(\n\tsystem: SingleModuleSystem<any>,\n): Accessor<ConstraintInfo[]>;\n/** Get a single constraint by ID */\nexport function useConstraintStatus(\n\tsystem: SingleModuleSystem<any>,\n\tconstraintId: string,\n): Accessor<ConstraintInfo | null>;\n/** Implementation */\nexport function useConstraintStatus(\n\t// biome-ignore lint/suspicious/noExplicitAny: Must work with any schema\n\tsystem: SingleModuleSystem<any>,\n\tconstraintId?: string,\n): Accessor<ConstraintInfo[] | ConstraintInfo | null> {\n\tassertSystem(\"useConstraintStatus\", system);\n\tconst getVal = () => {\n\t\tconst inspection = system.inspect();\n\t\tif (!constraintId) return inspection.constraints;\n\t\treturn inspection.constraints.find((c: ConstraintInfo) => c.id === constraintId) ?? null;\n\t};\n\n\tconst [state, setState] = createSignal<ConstraintInfo[] | ConstraintInfo | null>(getVal());\n\n\tconst update = () => setState(getVal);\n\tconst unsubFacts = system.facts.$store.subscribeAll(update);\n\tconst unsubSettled = system.onSettledChange(update);\n\tonCleanup(() => {\n\t\tunsubFacts();\n\t\tunsubSettled();\n\t});\n\n\treturn state;\n}\n\n// ============================================================================\n// useOptimisticUpdate — batch with rollback on failure\n// ============================================================================\n\nexport interface OptimisticUpdateResult {\n\tmutate: (updateFn: () => void) => void;\n\tisPending: Accessor<boolean>;\n\terror: Accessor<Error | null>;\n\trollback: () => void;\n}\n\n/**\n * Optimistic update hook. Saves a snapshot before mutating, monitors\n * a requirement type via statusPlugin, and rolls back on failure.\n */\nexport function useOptimisticUpdate(\n\t// biome-ignore lint/suspicious/noExplicitAny: Must work with any schema\n\tsystem: SingleModuleSystem<any>,\n\tstatusPlugin?: StatusPlugin,\n\trequirementType?: string,\n): OptimisticUpdateResult {\n\tassertSystem(\"useOptimisticUpdate\", system);\n\tconst [isPending, setIsPending] = createSignal(false);\n\tconst [error, setError] = createSignal<Error | null>(null);\n\tlet snapshot: SystemSnapshot | null = null;\n\tlet statusUnsub: (() => void) | null = null;\n\n\tconst rollback = () => {\n\t\tif (snapshot) {\n\t\t\tsystem.restore(snapshot);\n\t\t\tsnapshot = null;\n\t\t}\n\t\tsetIsPending(false);\n\t\tsetError(null);\n\t\tstatusUnsub?.();\n\t\tstatusUnsub = null;\n\t};\n\n\tconst mutate = (updateFn: () => void) => {\n\t\tsnapshot = system.getSnapshot();\n\t\tsetIsPending(true);\n\t\tsetError(null);\n\t\tsystem.batch(updateFn);\n\n\t\tif (statusPlugin && requirementType) {\n\t\t\tstatusUnsub?.();\n\t\t\tstatusUnsub = statusPlugin.subscribe(() => {\n\t\t\t\tconst status = statusPlugin.getStatus(requirementType);\n\t\t\t\tif (!status.isLoading && !status.hasError) {\n\t\t\t\t\tsnapshot = null;\n\t\t\t\t\tsetIsPending(false);\n\t\t\t\t\tstatusUnsub?.();\n\t\t\t\t\tstatusUnsub = null;\n\t\t\t\t} else if (status.hasError) {\n\t\t\t\t\tsetError(() => status.lastError);\n\t\t\t\t\trollback();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t};\n\n\tonCleanup(() => {\n\t\tstatusUnsub?.();\n\t});\n\n\treturn { mutate, isPending, error, rollback };\n}\n\n// ============================================================================\n// useSuspenseRequirement — Solid-specific Suspense integration\n// ============================================================================\n\n/**\n * Single type: throws a promise while the requirement is pending (Suspense).\n */\nexport function useSuspenseRequirement(statusPlugin: StatusPlugin, type: string): Accessor<RequirementTypeStatus>;\n/**\n * Multi-type: throws a promise while any of the requirements are pending.\n */\nexport function useSuspenseRequirement(statusPlugin: StatusPlugin, types: string[]): Accessor<Record<string, RequirementTypeStatus>>;\n/** Implementation */\nexport function useSuspenseRequirement(\n\tstatusPlugin: StatusPlugin,\n\ttypeOrTypes: string | string[],\n): Accessor<RequirementTypeStatus> | Accessor<Record<string, RequirementTypeStatus>> {\n\tconst types = Array.isArray(typeOrTypes) ? typeOrTypes : [typeOrTypes];\n\n\t// Check if any are still loading — if so, throw a promise\n\tconst anyLoading = () => types.some((t) => statusPlugin.getStatus(t).isLoading);\n\n\tif (anyLoading()) {\n\t\tthrow new Promise<void>((resolve) => {\n\t\t\tconst unsub = statusPlugin.subscribe(() => {\n\t\t\t\tif (!anyLoading()) {\n\t\t\t\t\tunsub();\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\t// Once resolved, return normal accessor\n\tif (Array.isArray(typeOrTypes)) {\n\t\treturn useRequirementStatus(statusPlugin, typeOrTypes) as Accessor<Record<string, RequirementTypeStatus>>;\n\t}\n\treturn useRequirementStatus(statusPlugin, typeOrTypes) as Accessor<RequirementTypeStatus>;\n}\n\n// ============================================================================\n// useTimeTravel — reactive time-travel signal\n// ============================================================================\n\n/**\n * Reactive time-travel signal. Returns an Accessor that updates\n * when snapshots are taken or navigation occurs.\n *\n * @example\n * ```tsx\n * const tt = useTimeTravel(system);\n * <button disabled={!tt()?.canUndo} onClick={() => tt()?.undo()}>Undo</button>\n * ```\n */\nexport function useTimeTravel(\n\t// biome-ignore lint/suspicious/noExplicitAny: Must work with any schema\n\tsystem: SingleModuleSystem<any>,\n): Accessor<ReturnType<typeof buildTimeTravelState>> {\n\tassertSystem(\"useTimeTravel\", system);\n\tconst [state, setState] = createSignal<ReturnType<typeof buildTimeTravelState>>(buildTimeTravelState(system));\n\tconst unsub = system.onTimeTravelChange(() => setState(buildTimeTravelState(system)));\n\tonCleanup(unsub);\n\treturn state;\n}\n\n// ============================================================================\n// Scoped System\n// ============================================================================\n\n/** Configuration for useDirective */\ninterface UseDirectiveConfig {\n\t// biome-ignore lint/suspicious/noExplicitAny: Plugin types vary\n\tplugins?: Plugin<any>[];\n\tdebug?: DebugConfig;\n\terrorBoundary?: ErrorBoundaryConfig;\n\ttickMs?: number;\n\tzeroConfig?: boolean;\n\t// biome-ignore lint/suspicious/noExplicitAny: Facts type varies\n\tinitialFacts?: Record<string, any>;\n\tstatus?: boolean;\n\t/** Fact keys to subscribe to (omit for all) */\n\tfacts?: string[];\n\t/** Derivation keys to subscribe to (omit for all) */\n\tderived?: string[];\n}\n\n/**\n * Create a scoped Directive system with automatic lifecycle management.\n * When no `facts` or `derived` keys are specified, subscribes to ALL\n * facts and derivations and returns reactive signals.\n *\n * @example\n * ```tsx\n * // Subscribe to everything\n * const { facts, derived, events, dispatch } = useDirective(counterModule);\n *\n * // Selective keys\n * const { facts, derived } = useDirective(counterModule, { facts: [\"count\"], derived: [\"doubled\"] });\n * ```\n */\nexport function useDirective<M extends ModuleSchema>(\n\tmoduleDef: ModuleDef<M>,\n\tconfig?: UseDirectiveConfig,\n) {\n\tconst allPlugins = [...(config?.plugins ?? [])];\n\tlet statusPlugin: StatusPlugin | undefined;\n\n\tif (config?.status) {\n\t\tconst sp = createRequirementStatusPlugin();\n\t\tstatusPlugin = sp;\n\t\t// biome-ignore lint/suspicious/noExplicitAny: Plugin generic issues\n\t\tallPlugins.push(sp.plugin as Plugin<any>);\n\t}\n\n\t// biome-ignore lint/suspicious/noExplicitAny: Required for overload compatibility\n\tconst system = createSystem({\n\t\tmodule: moduleDef,\n\t\tplugins: allPlugins.length > 0 ? allPlugins : undefined,\n\t\tdebug: config?.debug,\n\t\terrorBoundary: config?.errorBoundary,\n\t\ttickMs: config?.tickMs,\n\t\tzeroConfig: config?.zeroConfig,\n\t\tinitialFacts: config?.initialFacts,\n\t} as any) as unknown as SingleModuleSystem<M>;\n\n\tsystem.start();\n\n\tonCleanup(() => {\n\t\tsystem.destroy();\n\t});\n\n\tconst factKeys = config?.facts;\n\tconst derivedKeys = config?.derived;\n\tconst subscribeAll = !factKeys && !derivedKeys;\n\n\t// Subscribe to facts\n\tconst [factsState, setFactsState] = createSignal(\n\t\tsubscribeAll\n\t\t\t? (system.facts.$store.toObject() as InferFacts<M>)\n\t\t\t: (pickFacts(system, factKeys ?? []) as InferFacts<M>),\n\t);\n\tconst unsubFacts = subscribeAll\n\t\t? system.facts.$store.subscribeAll(() => {\n\t\t\tsetFactsState(() => system.facts.$store.toObject() as InferFacts<M>);\n\t\t})\n\t\t: factKeys && factKeys.length > 0\n\t\t\t? system.facts.$store.subscribe(factKeys, () => {\n\t\t\t\tsetFactsState(() => pickFacts(system, factKeys) as InferFacts<M>);\n\t\t\t})\n\t\t\t: null;\n\n\t// Subscribe to derivations\n\tconst allDerivationKeys = subscribeAll ? Object.keys(system.derive ?? {}) : (derivedKeys ?? []);\n\tconst getDerived = (): InferDerivations<M> => {\n\t\tconst result: Record<string, unknown> = {};\n\t\tfor (const key of allDerivationKeys) {\n\t\t\tresult[key] = system.read(key);\n\t\t}\n\t\treturn result as InferDerivations<M>;\n\t};\n\tconst [derivedState, setDerivedState] = createSignal(getDerived());\n\tconst unsubDerived = allDerivationKeys.length > 0\n\t\t? system.subscribe(allDerivationKeys, () => { setDerivedState(getDerived); })\n\t\t: null;\n\n\tonCleanup(() => {\n\t\tunsubFacts?.();\n\t\tunsubDerived?.();\n\t});\n\n\tconst events = system.events;\n\tconst dispatch = (event: InferEvents<M>) => system.dispatch(event);\n\n\treturn {\n\t\tsystem,\n\t\tfacts: factsState as Accessor<InferFacts<M>>,\n\t\tderived: derivedState as Accessor<InferDerivations<M>>,\n\t\tevents,\n\t\tdispatch,\n\t\tstatusPlugin,\n\t};\n}\n\n// ============================================================================\n// Signal Factories (for use outside components)\n// ============================================================================\n\n/**\n * Create a derivation signal outside of a component.\n */\nexport function createDerivedSignal<T>(\n\t// biome-ignore lint/suspicious/noExplicitAny: Must work with any schema\n\tsystem: SingleModuleSystem<any>,\n\tderivationId: string,\n): [Accessor<T>, () => void] {\n\tconst [value, setValue] = createSignal<T>(system.read(derivationId) as T);\n\tconst unsubscribe = system.subscribe([derivationId], () => {\n\t\tsetValue(() => system.read(derivationId) as T);\n\t});\n\treturn [value, unsubscribe];\n}\n\n/**\n * Create a fact signal outside of a component.\n */\nexport function createFactSignal<T>(\n\t// biome-ignore lint/suspicious/noExplicitAny: Must work with any schema\n\tsystem: SingleModuleSystem<any>,\n\tfactKey: string,\n): [Accessor<T | undefined>, () => void] {\n\tconst [value, setValue] = createSignal<T | undefined>(\n\t\tsystem.facts.$store.get(factKey) as T | undefined,\n\t);\n\tconst unsubscribe = system.facts.$store.subscribe([factKey], () => {\n\t\tsetValue(() => system.facts.$store.get(factKey) as T | undefined);\n\t});\n\treturn [value, unsubscribe];\n}\n\n// ============================================================================\n// Typed Hooks Factory\n// ============================================================================\n\nexport function createTypedHooks<M extends ModuleSchema>(): {\n\tuseFact: <K extends keyof InferFacts<M> & string>(\n\t\tsystem: SingleModuleSystem<M>,\n\t\tfactKey: K,\n\t) => Accessor<InferFacts<M>[K] | undefined>;\n\tuseDerived: <K extends keyof InferDerivations<M> & string>(\n\t\tsystem: SingleModuleSystem<M>,\n\t\tderivationId: K,\n\t) => Accessor<InferDerivations<M>[K]>;\n\tuseDispatch: (system: SingleModuleSystem<M>) => (event: InferEvents<M>) => void;\n\tuseEvents: (system: SingleModuleSystem<M>) => SingleModuleSystem<M>[\"events\"];\n\tuseWatch: <K extends string>(\n\t\tsystem: SingleModuleSystem<M>,\n\t\tkey: K,\n\t\tcallback: (newValue: unknown, previousValue: unknown) => void,\n\t) => void;\n} {\n\treturn {\n\t\tuseFact: <K extends keyof InferFacts<M> & string>(system: SingleModuleSystem<M>, factKey: K) =>\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: Required for overload compatibility\n\t\t\tuseFact(system as SingleModuleSystem<any>, factKey as string) as Accessor<InferFacts<M>[K] | undefined>,\n\t\tuseDerived: <K extends keyof InferDerivations<M> & string>(system: SingleModuleSystem<M>, derivationId: K) =>\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: Required for overload compatibility\n\t\t\tuseDerived(system as SingleModuleSystem<any>, derivationId as string) as Accessor<InferDerivations<M>[K]>,\n\t\tuseDispatch: (system: SingleModuleSystem<M>) => {\n\t\t\treturn (event: InferEvents<M>) => {\n\t\t\t\tsystem.dispatch(event);\n\t\t\t};\n\t\t},\n\t\tuseEvents: (system: SingleModuleSystem<M>) => useEvents<M>(system),\n\t\tuseWatch: <K extends string>(\n\t\t\tsystem: SingleModuleSystem<M>,\n\t\t\tkey: K,\n\t\t\tcallback: (newValue: unknown, previousValue: unknown) => void,\n\t\t) =>\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: Required for overload compatibility\n\t\t\tuseWatch(system as SingleModuleSystem<any>, key, callback),\n\t};\n}\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { Accessor } from 'solid-js';
|
|
2
|
+
import { createRequirementStatusPlugin, SingleModuleSystem, ModuleSchema, InferFacts, InferDerivations, InferEvents, ModuleDef, Plugin, DebugConfig, ErrorBoundaryConfig, RequirementTypeStatus, InferSelectorState } from '@directive-run/core';
|
|
3
|
+
export { RequirementTypeStatus } from '@directive-run/core';
|
|
4
|
+
import { ConstraintInfo, InspectState, buildTimeTravelState } from '@directive-run/core/adapter-utils';
|
|
5
|
+
export { ConstraintInfo, InspectState, shallowEqual } from '@directive-run/core/adapter-utils';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Solid Adapter - Consolidated SolidJS primitives for Directive
|
|
9
|
+
*
|
|
10
|
+
* 16 active exports: useFact, useDerived, useDispatch, useSelector,
|
|
11
|
+
* useWatch, useInspect, useRequirementStatus, useEvents, useExplain,
|
|
12
|
+
* useConstraintStatus, useOptimisticUpdate, useDirective, useTimeTravel,
|
|
13
|
+
* createTypedHooks, useSuspenseRequirement, shallowEqual
|
|
14
|
+
*
|
|
15
|
+
* Signal factories: createDerivedSignal, createFactSignal
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** Type for the requirement status plugin return value */
|
|
19
|
+
type StatusPlugin = ReturnType<typeof createRequirementStatusPlugin>;
|
|
20
|
+
/** Single key overload */
|
|
21
|
+
declare function useFact<S extends ModuleSchema, K extends keyof InferFacts<S> & string>(system: SingleModuleSystem<S>, factKey: K): Accessor<InferFacts<S>[K] | undefined>;
|
|
22
|
+
/** Multi-key overload */
|
|
23
|
+
declare function useFact<S extends ModuleSchema, K extends keyof InferFacts<S> & string>(system: SingleModuleSystem<S>, factKeys: K[]): Accessor<Pick<InferFacts<S>, K>>;
|
|
24
|
+
/** Single key overload */
|
|
25
|
+
declare function useDerived<S extends ModuleSchema, K extends keyof InferDerivations<S> & string>(system: SingleModuleSystem<S>, derivationId: K): Accessor<InferDerivations<S>[K]>;
|
|
26
|
+
/** Multi-key overload */
|
|
27
|
+
declare function useDerived<S extends ModuleSchema, K extends keyof InferDerivations<S> & string>(system: SingleModuleSystem<S>, derivationIds: K[]): Accessor<Pick<InferDerivations<S>, K>>;
|
|
28
|
+
/**
|
|
29
|
+
* Auto-tracking selector over facts and derivations.
|
|
30
|
+
* Uses `withTracking()` to detect which facts the selector accesses,
|
|
31
|
+
* then subscribes only to those keys.
|
|
32
|
+
*/
|
|
33
|
+
declare function useSelector<S extends ModuleSchema, R>(system: SingleModuleSystem<S>, selector: (state: InferSelectorState<S>) => R, equalityFn?: (a: R, b: R) => boolean): Accessor<R>;
|
|
34
|
+
declare function useSelector<R>(system: SingleModuleSystem<any>, selector: (state: Record<string, any>) => R, equalityFn?: (a: R, b: R) => boolean): Accessor<R>;
|
|
35
|
+
declare function useDispatch<S extends ModuleSchema>(system: SingleModuleSystem<S>): (event: InferEvents<S>) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the system's events dispatcher.
|
|
38
|
+
*/
|
|
39
|
+
declare function useEvents<S extends ModuleSchema>(system: SingleModuleSystem<S>): SingleModuleSystem<S>["events"];
|
|
40
|
+
/** Watch a derivation or fact by key (auto-detected). When a key exists in both facts and derivations, the derivation overload takes priority. */
|
|
41
|
+
declare function useWatch<S extends ModuleSchema, K extends keyof InferDerivations<S> & string>(system: SingleModuleSystem<S>, key: K, callback: (newValue: InferDerivations<S>[K], previousValue: InferDerivations<S>[K] | undefined) => void): void;
|
|
42
|
+
/** Watch a fact key with auto-detection. */
|
|
43
|
+
declare function useWatch<S extends ModuleSchema, K extends keyof InferFacts<S> & string>(system: SingleModuleSystem<S>, key: K, callback: (newValue: InferFacts<S>[K] | undefined, previousValue: InferFacts<S>[K] | undefined) => void): void;
|
|
44
|
+
/**
|
|
45
|
+
* Watch a fact by explicit "fact" discriminator.
|
|
46
|
+
* @deprecated Use `useWatch(system, key, callback)` instead — facts are now auto-detected.
|
|
47
|
+
*/
|
|
48
|
+
declare function useWatch<S extends ModuleSchema, K extends keyof InferFacts<S> & string>(system: SingleModuleSystem<S>, kind: "fact", factKey: K, callback: (newValue: InferFacts<S>[K] | undefined, previousValue: InferFacts<S>[K] | undefined) => void): void;
|
|
49
|
+
/** Watch a fact or derivation (generic fallback) */
|
|
50
|
+
declare function useWatch<T>(system: SingleModuleSystem<any>, key: string, callback: (newValue: T, previousValue: T | undefined) => void): void;
|
|
51
|
+
/** Options for useInspect */
|
|
52
|
+
interface UseInspectOptions {
|
|
53
|
+
throttleMs?: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Consolidated system inspection hook.
|
|
57
|
+
* Returns Accessor<InspectState> with optional throttling.
|
|
58
|
+
*/
|
|
59
|
+
declare function useInspect(system: SingleModuleSystem<any>, options?: UseInspectOptions): Accessor<InspectState>;
|
|
60
|
+
/** Single type overload */
|
|
61
|
+
declare function useRequirementStatus(statusPlugin: StatusPlugin, type: string): Accessor<RequirementTypeStatus>;
|
|
62
|
+
/** Multi-type overload */
|
|
63
|
+
declare function useRequirementStatus(statusPlugin: StatusPlugin, types: string[]): Accessor<Record<string, RequirementTypeStatus>>;
|
|
64
|
+
/**
|
|
65
|
+
* Reactively returns the explanation string for a requirement.
|
|
66
|
+
*/
|
|
67
|
+
declare function useExplain(system: SingleModuleSystem<any>, requirementId: string): Accessor<string | null>;
|
|
68
|
+
/** Get all constraints */
|
|
69
|
+
declare function useConstraintStatus(system: SingleModuleSystem<any>): Accessor<ConstraintInfo[]>;
|
|
70
|
+
/** Get a single constraint by ID */
|
|
71
|
+
declare function useConstraintStatus(system: SingleModuleSystem<any>, constraintId: string): Accessor<ConstraintInfo | null>;
|
|
72
|
+
interface OptimisticUpdateResult {
|
|
73
|
+
mutate: (updateFn: () => void) => void;
|
|
74
|
+
isPending: Accessor<boolean>;
|
|
75
|
+
error: Accessor<Error | null>;
|
|
76
|
+
rollback: () => void;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Optimistic update hook. Saves a snapshot before mutating, monitors
|
|
80
|
+
* a requirement type via statusPlugin, and rolls back on failure.
|
|
81
|
+
*/
|
|
82
|
+
declare function useOptimisticUpdate(system: SingleModuleSystem<any>, statusPlugin?: StatusPlugin, requirementType?: string): OptimisticUpdateResult;
|
|
83
|
+
/**
|
|
84
|
+
* Single type: throws a promise while the requirement is pending (Suspense).
|
|
85
|
+
*/
|
|
86
|
+
declare function useSuspenseRequirement(statusPlugin: StatusPlugin, type: string): Accessor<RequirementTypeStatus>;
|
|
87
|
+
/**
|
|
88
|
+
* Multi-type: throws a promise while any of the requirements are pending.
|
|
89
|
+
*/
|
|
90
|
+
declare function useSuspenseRequirement(statusPlugin: StatusPlugin, types: string[]): Accessor<Record<string, RequirementTypeStatus>>;
|
|
91
|
+
/**
|
|
92
|
+
* Reactive time-travel signal. Returns an Accessor that updates
|
|
93
|
+
* when snapshots are taken or navigation occurs.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```tsx
|
|
97
|
+
* const tt = useTimeTravel(system);
|
|
98
|
+
* <button disabled={!tt()?.canUndo} onClick={() => tt()?.undo()}>Undo</button>
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
declare function useTimeTravel(system: SingleModuleSystem<any>): Accessor<ReturnType<typeof buildTimeTravelState>>;
|
|
102
|
+
/** Configuration for useDirective */
|
|
103
|
+
interface UseDirectiveConfig {
|
|
104
|
+
plugins?: Plugin<any>[];
|
|
105
|
+
debug?: DebugConfig;
|
|
106
|
+
errorBoundary?: ErrorBoundaryConfig;
|
|
107
|
+
tickMs?: number;
|
|
108
|
+
zeroConfig?: boolean;
|
|
109
|
+
initialFacts?: Record<string, any>;
|
|
110
|
+
status?: boolean;
|
|
111
|
+
/** Fact keys to subscribe to (omit for all) */
|
|
112
|
+
facts?: string[];
|
|
113
|
+
/** Derivation keys to subscribe to (omit for all) */
|
|
114
|
+
derived?: string[];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Create a scoped Directive system with automatic lifecycle management.
|
|
118
|
+
* When no `facts` or `derived` keys are specified, subscribes to ALL
|
|
119
|
+
* facts and derivations and returns reactive signals.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```tsx
|
|
123
|
+
* // Subscribe to everything
|
|
124
|
+
* const { facts, derived, events, dispatch } = useDirective(counterModule);
|
|
125
|
+
*
|
|
126
|
+
* // Selective keys
|
|
127
|
+
* const { facts, derived } = useDirective(counterModule, { facts: ["count"], derived: ["doubled"] });
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
declare function useDirective<M extends ModuleSchema>(moduleDef: ModuleDef<M>, config?: UseDirectiveConfig): {
|
|
131
|
+
system: SingleModuleSystem<M>;
|
|
132
|
+
facts: Accessor<InferFacts<M>>;
|
|
133
|
+
derived: Accessor<InferDerivations<M>>;
|
|
134
|
+
events: M["events"] extends Record<string, unknown> ? { [E in keyof M["events"]]: M["events"][E] extends Record<string, unknown> ? keyof M["events"][E] extends never ? () => void : (payload: M["events"][E] extends infer T ? T extends M["events"][E] ? T extends Record<string, unknown> ? { [K in keyof T]: T[K] extends {
|
|
135
|
+
_type: infer T_1;
|
|
136
|
+
} ? T_1 : T[K]; } : never : never : never) => void : () => void; } : Record<string, never>;
|
|
137
|
+
dispatch: (event: InferEvents<M>) => void;
|
|
138
|
+
statusPlugin: {
|
|
139
|
+
plugin: Plugin<never>;
|
|
140
|
+
getStatus: (type: string) => RequirementTypeStatus;
|
|
141
|
+
getAllStatus: () => Map<string, RequirementTypeStatus>;
|
|
142
|
+
subscribe: (listener: () => void) => () => void;
|
|
143
|
+
reset: () => void;
|
|
144
|
+
} | undefined;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Create a derivation signal outside of a component.
|
|
148
|
+
*/
|
|
149
|
+
declare function createDerivedSignal<T>(system: SingleModuleSystem<any>, derivationId: string): [Accessor<T>, () => void];
|
|
150
|
+
/**
|
|
151
|
+
* Create a fact signal outside of a component.
|
|
152
|
+
*/
|
|
153
|
+
declare function createFactSignal<T>(system: SingleModuleSystem<any>, factKey: string): [Accessor<T | undefined>, () => void];
|
|
154
|
+
declare function createTypedHooks<M extends ModuleSchema>(): {
|
|
155
|
+
useFact: <K extends keyof InferFacts<M> & string>(system: SingleModuleSystem<M>, factKey: K) => Accessor<InferFacts<M>[K] | undefined>;
|
|
156
|
+
useDerived: <K extends keyof InferDerivations<M> & string>(system: SingleModuleSystem<M>, derivationId: K) => Accessor<InferDerivations<M>[K]>;
|
|
157
|
+
useDispatch: (system: SingleModuleSystem<M>) => (event: InferEvents<M>) => void;
|
|
158
|
+
useEvents: (system: SingleModuleSystem<M>) => SingleModuleSystem<M>["events"];
|
|
159
|
+
useWatch: <K extends string>(system: SingleModuleSystem<M>, key: K, callback: (newValue: unknown, previousValue: unknown) => void) => void;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export { type OptimisticUpdateResult, type StatusPlugin, type UseInspectOptions, createDerivedSignal, createFactSignal, createTypedHooks, useConstraintStatus, useDerived, useDirective, useDispatch, useEvents, useExplain, useFact, useInspect, useOptimisticUpdate, useRequirementStatus, useSelector, useSuspenseRequirement, useTimeTravel, useWatch };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { Accessor } from 'solid-js';
|
|
2
|
+
import { createRequirementStatusPlugin, SingleModuleSystem, ModuleSchema, InferFacts, InferDerivations, InferEvents, ModuleDef, Plugin, DebugConfig, ErrorBoundaryConfig, RequirementTypeStatus, InferSelectorState } from '@directive-run/core';
|
|
3
|
+
export { RequirementTypeStatus } from '@directive-run/core';
|
|
4
|
+
import { ConstraintInfo, InspectState, buildTimeTravelState } from '@directive-run/core/adapter-utils';
|
|
5
|
+
export { ConstraintInfo, InspectState, shallowEqual } from '@directive-run/core/adapter-utils';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Solid Adapter - Consolidated SolidJS primitives for Directive
|
|
9
|
+
*
|
|
10
|
+
* 16 active exports: useFact, useDerived, useDispatch, useSelector,
|
|
11
|
+
* useWatch, useInspect, useRequirementStatus, useEvents, useExplain,
|
|
12
|
+
* useConstraintStatus, useOptimisticUpdate, useDirective, useTimeTravel,
|
|
13
|
+
* createTypedHooks, useSuspenseRequirement, shallowEqual
|
|
14
|
+
*
|
|
15
|
+
* Signal factories: createDerivedSignal, createFactSignal
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** Type for the requirement status plugin return value */
|
|
19
|
+
type StatusPlugin = ReturnType<typeof createRequirementStatusPlugin>;
|
|
20
|
+
/** Single key overload */
|
|
21
|
+
declare function useFact<S extends ModuleSchema, K extends keyof InferFacts<S> & string>(system: SingleModuleSystem<S>, factKey: K): Accessor<InferFacts<S>[K] | undefined>;
|
|
22
|
+
/** Multi-key overload */
|
|
23
|
+
declare function useFact<S extends ModuleSchema, K extends keyof InferFacts<S> & string>(system: SingleModuleSystem<S>, factKeys: K[]): Accessor<Pick<InferFacts<S>, K>>;
|
|
24
|
+
/** Single key overload */
|
|
25
|
+
declare function useDerived<S extends ModuleSchema, K extends keyof InferDerivations<S> & string>(system: SingleModuleSystem<S>, derivationId: K): Accessor<InferDerivations<S>[K]>;
|
|
26
|
+
/** Multi-key overload */
|
|
27
|
+
declare function useDerived<S extends ModuleSchema, K extends keyof InferDerivations<S> & string>(system: SingleModuleSystem<S>, derivationIds: K[]): Accessor<Pick<InferDerivations<S>, K>>;
|
|
28
|
+
/**
|
|
29
|
+
* Auto-tracking selector over facts and derivations.
|
|
30
|
+
* Uses `withTracking()` to detect which facts the selector accesses,
|
|
31
|
+
* then subscribes only to those keys.
|
|
32
|
+
*/
|
|
33
|
+
declare function useSelector<S extends ModuleSchema, R>(system: SingleModuleSystem<S>, selector: (state: InferSelectorState<S>) => R, equalityFn?: (a: R, b: R) => boolean): Accessor<R>;
|
|
34
|
+
declare function useSelector<R>(system: SingleModuleSystem<any>, selector: (state: Record<string, any>) => R, equalityFn?: (a: R, b: R) => boolean): Accessor<R>;
|
|
35
|
+
declare function useDispatch<S extends ModuleSchema>(system: SingleModuleSystem<S>): (event: InferEvents<S>) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the system's events dispatcher.
|
|
38
|
+
*/
|
|
39
|
+
declare function useEvents<S extends ModuleSchema>(system: SingleModuleSystem<S>): SingleModuleSystem<S>["events"];
|
|
40
|
+
/** Watch a derivation or fact by key (auto-detected). When a key exists in both facts and derivations, the derivation overload takes priority. */
|
|
41
|
+
declare function useWatch<S extends ModuleSchema, K extends keyof InferDerivations<S> & string>(system: SingleModuleSystem<S>, key: K, callback: (newValue: InferDerivations<S>[K], previousValue: InferDerivations<S>[K] | undefined) => void): void;
|
|
42
|
+
/** Watch a fact key with auto-detection. */
|
|
43
|
+
declare function useWatch<S extends ModuleSchema, K extends keyof InferFacts<S> & string>(system: SingleModuleSystem<S>, key: K, callback: (newValue: InferFacts<S>[K] | undefined, previousValue: InferFacts<S>[K] | undefined) => void): void;
|
|
44
|
+
/**
|
|
45
|
+
* Watch a fact by explicit "fact" discriminator.
|
|
46
|
+
* @deprecated Use `useWatch(system, key, callback)` instead — facts are now auto-detected.
|
|
47
|
+
*/
|
|
48
|
+
declare function useWatch<S extends ModuleSchema, K extends keyof InferFacts<S> & string>(system: SingleModuleSystem<S>, kind: "fact", factKey: K, callback: (newValue: InferFacts<S>[K] | undefined, previousValue: InferFacts<S>[K] | undefined) => void): void;
|
|
49
|
+
/** Watch a fact or derivation (generic fallback) */
|
|
50
|
+
declare function useWatch<T>(system: SingleModuleSystem<any>, key: string, callback: (newValue: T, previousValue: T | undefined) => void): void;
|
|
51
|
+
/** Options for useInspect */
|
|
52
|
+
interface UseInspectOptions {
|
|
53
|
+
throttleMs?: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Consolidated system inspection hook.
|
|
57
|
+
* Returns Accessor<InspectState> with optional throttling.
|
|
58
|
+
*/
|
|
59
|
+
declare function useInspect(system: SingleModuleSystem<any>, options?: UseInspectOptions): Accessor<InspectState>;
|
|
60
|
+
/** Single type overload */
|
|
61
|
+
declare function useRequirementStatus(statusPlugin: StatusPlugin, type: string): Accessor<RequirementTypeStatus>;
|
|
62
|
+
/** Multi-type overload */
|
|
63
|
+
declare function useRequirementStatus(statusPlugin: StatusPlugin, types: string[]): Accessor<Record<string, RequirementTypeStatus>>;
|
|
64
|
+
/**
|
|
65
|
+
* Reactively returns the explanation string for a requirement.
|
|
66
|
+
*/
|
|
67
|
+
declare function useExplain(system: SingleModuleSystem<any>, requirementId: string): Accessor<string | null>;
|
|
68
|
+
/** Get all constraints */
|
|
69
|
+
declare function useConstraintStatus(system: SingleModuleSystem<any>): Accessor<ConstraintInfo[]>;
|
|
70
|
+
/** Get a single constraint by ID */
|
|
71
|
+
declare function useConstraintStatus(system: SingleModuleSystem<any>, constraintId: string): Accessor<ConstraintInfo | null>;
|
|
72
|
+
interface OptimisticUpdateResult {
|
|
73
|
+
mutate: (updateFn: () => void) => void;
|
|
74
|
+
isPending: Accessor<boolean>;
|
|
75
|
+
error: Accessor<Error | null>;
|
|
76
|
+
rollback: () => void;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Optimistic update hook. Saves a snapshot before mutating, monitors
|
|
80
|
+
* a requirement type via statusPlugin, and rolls back on failure.
|
|
81
|
+
*/
|
|
82
|
+
declare function useOptimisticUpdate(system: SingleModuleSystem<any>, statusPlugin?: StatusPlugin, requirementType?: string): OptimisticUpdateResult;
|
|
83
|
+
/**
|
|
84
|
+
* Single type: throws a promise while the requirement is pending (Suspense).
|
|
85
|
+
*/
|
|
86
|
+
declare function useSuspenseRequirement(statusPlugin: StatusPlugin, type: string): Accessor<RequirementTypeStatus>;
|
|
87
|
+
/**
|
|
88
|
+
* Multi-type: throws a promise while any of the requirements are pending.
|
|
89
|
+
*/
|
|
90
|
+
declare function useSuspenseRequirement(statusPlugin: StatusPlugin, types: string[]): Accessor<Record<string, RequirementTypeStatus>>;
|
|
91
|
+
/**
|
|
92
|
+
* Reactive time-travel signal. Returns an Accessor that updates
|
|
93
|
+
* when snapshots are taken or navigation occurs.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```tsx
|
|
97
|
+
* const tt = useTimeTravel(system);
|
|
98
|
+
* <button disabled={!tt()?.canUndo} onClick={() => tt()?.undo()}>Undo</button>
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
declare function useTimeTravel(system: SingleModuleSystem<any>): Accessor<ReturnType<typeof buildTimeTravelState>>;
|
|
102
|
+
/** Configuration for useDirective */
|
|
103
|
+
interface UseDirectiveConfig {
|
|
104
|
+
plugins?: Plugin<any>[];
|
|
105
|
+
debug?: DebugConfig;
|
|
106
|
+
errorBoundary?: ErrorBoundaryConfig;
|
|
107
|
+
tickMs?: number;
|
|
108
|
+
zeroConfig?: boolean;
|
|
109
|
+
initialFacts?: Record<string, any>;
|
|
110
|
+
status?: boolean;
|
|
111
|
+
/** Fact keys to subscribe to (omit for all) */
|
|
112
|
+
facts?: string[];
|
|
113
|
+
/** Derivation keys to subscribe to (omit for all) */
|
|
114
|
+
derived?: string[];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Create a scoped Directive system with automatic lifecycle management.
|
|
118
|
+
* When no `facts` or `derived` keys are specified, subscribes to ALL
|
|
119
|
+
* facts and derivations and returns reactive signals.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```tsx
|
|
123
|
+
* // Subscribe to everything
|
|
124
|
+
* const { facts, derived, events, dispatch } = useDirective(counterModule);
|
|
125
|
+
*
|
|
126
|
+
* // Selective keys
|
|
127
|
+
* const { facts, derived } = useDirective(counterModule, { facts: ["count"], derived: ["doubled"] });
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
declare function useDirective<M extends ModuleSchema>(moduleDef: ModuleDef<M>, config?: UseDirectiveConfig): {
|
|
131
|
+
system: SingleModuleSystem<M>;
|
|
132
|
+
facts: Accessor<InferFacts<M>>;
|
|
133
|
+
derived: Accessor<InferDerivations<M>>;
|
|
134
|
+
events: M["events"] extends Record<string, unknown> ? { [E in keyof M["events"]]: M["events"][E] extends Record<string, unknown> ? keyof M["events"][E] extends never ? () => void : (payload: M["events"][E] extends infer T ? T extends M["events"][E] ? T extends Record<string, unknown> ? { [K in keyof T]: T[K] extends {
|
|
135
|
+
_type: infer T_1;
|
|
136
|
+
} ? T_1 : T[K]; } : never : never : never) => void : () => void; } : Record<string, never>;
|
|
137
|
+
dispatch: (event: InferEvents<M>) => void;
|
|
138
|
+
statusPlugin: {
|
|
139
|
+
plugin: Plugin<never>;
|
|
140
|
+
getStatus: (type: string) => RequirementTypeStatus;
|
|
141
|
+
getAllStatus: () => Map<string, RequirementTypeStatus>;
|
|
142
|
+
subscribe: (listener: () => void) => () => void;
|
|
143
|
+
reset: () => void;
|
|
144
|
+
} | undefined;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Create a derivation signal outside of a component.
|
|
148
|
+
*/
|
|
149
|
+
declare function createDerivedSignal<T>(system: SingleModuleSystem<any>, derivationId: string): [Accessor<T>, () => void];
|
|
150
|
+
/**
|
|
151
|
+
* Create a fact signal outside of a component.
|
|
152
|
+
*/
|
|
153
|
+
declare function createFactSignal<T>(system: SingleModuleSystem<any>, factKey: string): [Accessor<T | undefined>, () => void];
|
|
154
|
+
declare function createTypedHooks<M extends ModuleSchema>(): {
|
|
155
|
+
useFact: <K extends keyof InferFacts<M> & string>(system: SingleModuleSystem<M>, factKey: K) => Accessor<InferFacts<M>[K] | undefined>;
|
|
156
|
+
useDerived: <K extends keyof InferDerivations<M> & string>(system: SingleModuleSystem<M>, derivationId: K) => Accessor<InferDerivations<M>[K]>;
|
|
157
|
+
useDispatch: (system: SingleModuleSystem<M>) => (event: InferEvents<M>) => void;
|
|
158
|
+
useEvents: (system: SingleModuleSystem<M>) => SingleModuleSystem<M>["events"];
|
|
159
|
+
useWatch: <K extends string>(system: SingleModuleSystem<M>, key: K, callback: (newValue: unknown, previousValue: unknown) => void) => void;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export { type OptimisticUpdateResult, type StatusPlugin, type UseInspectOptions, createDerivedSignal, createFactSignal, createTypedHooks, useConstraintStatus, useDerived, useDirective, useDispatch, useEvents, useExplain, useFact, useInspect, useOptimisticUpdate, useRequirementStatus, useSelector, useSuspenseRequirement, useTimeTravel, useWatch };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {createSignal,onCleanup}from'solid-js';import {createRequirementStatusPlugin,createSystem}from'@directive-run/core';import {defaultEquality,assertSystem,computeInspectState,createThrottle,buildTimeTravelState,pickFacts,runTrackedSelector,depsChanged}from'@directive-run/core/adapter-utils';export{shallowEqual}from'@directive-run/core/adapter-utils';function V(e,t){return assertSystem("useFact",e),process.env.NODE_ENV!=="production"&&typeof t=="function"&&console.error("[Directive] useFact() received a function. Did you mean useSelector()? useFact() takes a string key or array of keys, not a selector function."),Array.isArray(t)?C(e,t):E(e,t)}function E(e,t){process.env.NODE_ENV!=="production"&&(e.facts.$store.has(t)||console.warn(`[Directive] useFact("${t}") \u2014 fact not found in store. Check that "${t}" is defined in your module's schema.`));let[s,r]=createSignal(e.facts.$store.get(t)),n=e.facts.$store.subscribe([t],()=>{r(()=>e.facts.$store.get(t));});return onCleanup(n),s}function C(e,t){let s=()=>{let u={};for(let i of t)u[i]=e.facts.$store.get(i);return u},[r,n]=createSignal(s()),o=e.facts.$store.subscribe(t,()=>{n(s);});return onCleanup(o),r}function q(e,t){return assertSystem("useDerived",e),process.env.NODE_ENV!=="production"&&typeof t=="function"&&console.error("[Directive] useDerived() received a function. Did you mean useSelector()? useDerived() takes a string key or array of keys, not a selector function."),Array.isArray(t)?P(e,t):$(e,t)}function $(e,t){process.env.NODE_ENV!=="production"&&e.read(t)===void 0&&console.warn(`[Directive] useDerived("${t}") returned undefined. Check that "${t}" is defined in your module's derive property.`);let[s,r]=createSignal(e.read(t)),n=e.subscribe([t],()=>{r(()=>e.read(t));});return onCleanup(n),s}function P(e,t){let s=()=>{let u={};for(let i of t)u[i]=e.read(i);return u},[r,n]=createSignal(s()),o=e.subscribe(t,()=>{n(s);});return onCleanup(o),r}function L(e,t,s=defaultEquality){assertSystem("useSelector",e);let r=new Set(Object.keys(e.derive??{})),n=()=>runTrackedSelector(e,r,t),o=n(),u=o.factKeys,i=o.deriveKeys,[c,f]=createSignal(o.value),d=[],y=()=>{for(let p of d)p();d.length=0;let S=()=>{let p=n();f(b=>s(b,p.value)?b:p.value),depsChanged(u,p.factKeys,i,p.deriveKeys)&&(u=p.factKeys,i=p.deriveKeys,y());};u.length>0?d.push(e.facts.$store.subscribe(u,S)):i.length===0&&d.push(e.facts.$store.subscribeAll(S)),i.length>0&&d.push(e.subscribe(i,S));};return y(),onCleanup(()=>{for(let S of d)S();}),c}function H(e){return assertSystem("useDispatch",e),t=>{e.dispatch(t);}}function U(e){return assertSystem("useEvents",e),e.events}function W(e,t,s,r){assertSystem("useWatch",e);let n=t==="fact"&&typeof s=="string"&&typeof r=="function",o=n?s:t,u=n?r:s,i=e.watch(o,u);onCleanup(i);}function G(e,t){assertSystem("useInspect",e);let[s,r]=createSignal(computeInspectState(e)),n=()=>{r(computeInspectState(e));};if(t?.throttleMs&&t.throttleMs>0){let{throttled:o,cleanup:u}=createThrottle(n,t.throttleMs),i=e.facts.$store.subscribeAll(o),c=e.onSettledChange(o);onCleanup(()=>{u(),i(),c();});}else {let o=e.facts.$store.subscribeAll(n),u=e.onSettledChange(n);onCleanup(()=>{o(),u();});}return s}function k(e,t){if(Array.isArray(t)){let o=()=>{let f={};for(let d of t)f[d]=e.getStatus(d);return f},[u,i]=createSignal(o()),c=e.subscribe(()=>{i(o);});return onCleanup(c),u}let[s,r]=createSignal(e.getStatus(t)),n=e.subscribe(()=>{r(e.getStatus(t));});return onCleanup(n),s}function J(e,t){assertSystem("useExplain",e);let[s,r]=createSignal(e.explain(t)),n=()=>r(e.explain(t)),o=e.facts.$store.subscribeAll(n),u=e.onSettledChange(n);return onCleanup(()=>{o(),u();}),s}function Q(e,t){assertSystem("useConstraintStatus",e);let s=()=>{let c=e.inspect();return t?c.constraints.find(f=>f.id===t)??null:c.constraints},[r,n]=createSignal(s()),o=()=>n(s),u=e.facts.$store.subscribeAll(o),i=e.onSettledChange(o);return onCleanup(()=>{u(),i();}),r}function X(e,t,s){assertSystem("useOptimisticUpdate",e);let[r,n]=createSignal(false),[o,u]=createSignal(null),i=null,c=null,f=()=>{i&&(e.restore(i),i=null),n(false),u(null),c?.(),c=null;},d=y=>{i=e.getSnapshot(),n(true),u(null),e.batch(y),t&&s&&(c?.(),c=t.subscribe(()=>{let S=t.getStatus(s);!S.isLoading&&!S.hasError?(i=null,n(false),c?.(),c=null):S.hasError&&(u(()=>S.lastError),f());}));};return onCleanup(()=>{c?.();}),{mutate:d,isPending:r,error:o,rollback:f}}function Y(e,t){let s=Array.isArray(t)?t:[t],r=()=>s.some(n=>e.getStatus(n).isLoading);if(r())throw new Promise(n=>{let o=e.subscribe(()=>{r()||(o(),n());});});return k(e,t)}function Z(e){assertSystem("useTimeTravel",e);let[t,s]=createSignal(buildTimeTravelState(e)),r=e.onTimeTravelChange(()=>s(buildTimeTravelState(e)));return onCleanup(r),t}function O(e,t){let s=[...t?.plugins??[]],r;if(t?.status){let v=createRequirementStatusPlugin();r=v,s.push(v.plugin);}let n=createSystem({module:e,plugins:s.length>0?s:void 0,debug:t?.debug,errorBoundary:t?.errorBoundary,tickMs:t?.tickMs,zeroConfig:t?.zeroConfig,initialFacts:t?.initialFacts});n.start(),onCleanup(()=>{n.destroy();});let o=t?.facts,u=t?.derived,i=!o&&!u,[c,f]=createSignal(i?n.facts.$store.toObject():pickFacts(n,o??[])),d=i?n.facts.$store.subscribeAll(()=>{f(()=>n.facts.$store.toObject());}):o&&o.length>0?n.facts.$store.subscribe(o,()=>{f(()=>pickFacts(n,o));}):null,y=i?Object.keys(n.derive??{}):u??[],S=()=>{let v={};for(let M of y)v[M]=n.read(M);return v},[p,b]=createSignal(S()),A=y.length>0?n.subscribe(y,()=>{b(S);}):null;onCleanup(()=>{d?.(),A?.();});let R=n.events;return {system:n,facts:c,derived:p,events:R,dispatch:v=>n.dispatch(v),statusPlugin:r}}function ee(e,t){let[s,r]=createSignal(e.read(t)),n=e.subscribe([t],()=>{r(()=>e.read(t));});return [s,n]}function te(e,t){let[s,r]=createSignal(e.facts.$store.get(t)),n=e.facts.$store.subscribe([t],()=>{r(()=>e.facts.$store.get(t));});return [s,n]}function ne(){return {useFact:(e,t)=>V(e,t),useDerived:(e,t)=>q(e,t),useDispatch:e=>t=>{e.dispatch(t);},useEvents:e=>U(e),useWatch:(e,t,s)=>W(e,t,s)}}export{ee as createDerivedSignal,te as createFactSignal,ne as createTypedHooks,Q as useConstraintStatus,q as useDerived,O as useDirective,H as useDispatch,U as useEvents,J as useExplain,V as useFact,G as useInspect,X as useOptimisticUpdate,k as useRequirementStatus,L as useSelector,Y as useSuspenseRequirement,Z as useTimeTravel,W as useWatch};//# sourceMappingURL=index.js.map
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["useFact","system","keyOrKeys","assertSystem","_useFactMulti","_useFactSingle","factKey","value","setValue","createSignal","unsubscribe","onCleanup","factKeys","getValues","result","key","state","setState","useDerived","idOrIds","_useDerivedMulti","_useDerivedSingle","derivationId","derivationIds","id","useSelector","selector","equalityFn","defaultEquality","deriveKeySet","runWithTracking","runTrackedSelector","initial","trackedFactKeys","trackedDeriveKeys","selected","setSelected","unsubs","resubscribe","unsub","onUpdate","prev","depsChanged","useDispatch","event","useEvents","useWatch","derivationIdOrKind","callbackOrFactKey","maybeCallback","isFact","callback","useInspect","options","computeInspectState","update","throttled","cleanup","createThrottle","unsubFacts","unsubSettled","useRequirementStatus","statusPlugin","typeOrTypes","type","status","setStatus","useExplain","requirementId","explanation","setExplanation","useConstraintStatus","constraintId","getVal","inspection","c","useOptimisticUpdate","requirementType","isPending","setIsPending","error","setError","snapshot","statusUnsub","rollback","mutate","updateFn","useSuspenseRequirement","types","anyLoading","t","resolve","useTimeTravel","buildTimeTravelState","useDirective","moduleDef","config","allPlugins","sp","createRequirementStatusPlugin","createSystem","derivedKeys","subscribeAll","factsState","setFactsState","pickFacts","allDerivationKeys","getDerived","derivedState","setDerivedState","unsubDerived","events","createDerivedSignal","createFactSignal","createTypedHooks"],"mappings":"qWAgEO,SAASA,CAAAA,CAEfC,EACAC,CAAAA,CACoB,CAUpB,OATAC,YAAAA,CAAa,SAAA,CAAWF,CAAM,CAAA,CAC1B,OAAA,CAAQ,GAAA,CAAI,QAAA,GAAa,cAAgB,OAAOC,CAAAA,EAAc,YACjE,OAAA,CAAQ,KAAA,CACP,gJAED,CAAA,CAIG,KAAA,CAAM,OAAA,CAAQA,CAAS,EACnBE,CAAAA,CAAcH,CAAAA,CAAQC,CAAS,CAAA,CAIhCG,CAAAA,CAAeJ,EAAQC,CAAS,CACxC,CAGA,SAASG,EAAeJ,CAAAA,CAAiCK,CAAAA,CAAoC,CACxF,OAAA,CAAQ,GAAA,CAAI,WAAa,YAAA,GACvBL,CAAAA,CAAO,MAAM,MAAA,CAAO,GAAA,CAAIK,CAAO,CAAA,EACnC,OAAA,CAAQ,KACP,CAAA,qBAAA,EAAwBA,CAAO,kDAChBA,CAAO,CAAA,qCAAA,CACvB,CAAA,CAAA,CAIF,GAAM,CAACC,CAAAA,CAAOC,CAAQ,EAAIC,YAAAA,CAAaR,CAAAA,CAAO,MAAM,MAAA,CAAO,GAAA,CAAIK,CAAO,CAAC,EACjEI,CAAAA,CAAcT,CAAAA,CAAO,MAAM,MAAA,CAAO,SAAA,CAAU,CAACK,CAAO,CAAA,CAAG,IAAM,CAClEE,EAAS,IAAMP,CAAAA,CAAO,MAAM,MAAA,CAAO,GAAA,CAAIK,CAAO,CAAC,EAChD,CAAC,CAAA,CACD,OAAAK,SAAAA,CAAUD,CAAW,EACdH,CACR,CAGA,SAASH,CAAAA,CAAcH,CAAAA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AoC,CAAAA,GAGAL,CAAAA,CAAS7C,EAAmCc,CAAAA,CAAKoC,CAAQ,CAC3D,CACD","file":"index.js","sourcesContent":["/**\n * Solid Adapter - Consolidated SolidJS primitives for Directive\n *\n * 16 active exports: useFact, useDerived, useDispatch, useSelector,\n * useWatch, useInspect, useRequirementStatus, useEvents, useExplain,\n * useConstraintStatus, useOptimisticUpdate, useDirective, useTimeTravel,\n * createTypedHooks, useSuspenseRequirement, shallowEqual\n *\n * Signal factories: createDerivedSignal, createFactSignal\n */\n\nimport {\n\tcreateSignal,\n\tonCleanup,\n\ttype Accessor,\n} from \"solid-js\";\nimport type {\n\tModuleSchema,\n\tModuleDef,\n\tPlugin,\n\tDebugConfig,\n\tErrorBoundaryConfig,\n\tInferFacts,\n\tInferDerivations,\n\tInferSelectorState,\n\tInferEvents,\n\tSingleModuleSystem,\n\tSystemSnapshot,\n} from \"@directive-run/core\";\nimport {\n\tcreateSystem,\n\tcreateRequirementStatusPlugin,\n} from \"@directive-run/core\";\nimport type { RequirementTypeStatus } from \"@directive-run/core\";\nimport {\n\ttype InspectState,\n\ttype ConstraintInfo,\n\tcomputeInspectState,\n\tcreateThrottle,\n\tassertSystem,\n\tdefaultEquality,\n\tbuildTimeTravelState,\n\tpickFacts,\n\trunTrackedSelector,\n\tdepsChanged,\n\tshallowEqual,\n} from \"@directive-run/core/adapter-utils\";\n\n// Re-export for convenience\nexport type { RequirementTypeStatus, InspectState, ConstraintInfo };\nexport { shallowEqual };\n\n/** Type for the requirement status plugin return value */\nexport type StatusPlugin = ReturnType<typeof createRequirementStatusPlugin>;\n\n// ============================================================================\n// useFact — single key or multi key\n// ============================================================================\n\n/** Single key overload */\nexport function useFact<S extends ModuleSchema, K extends keyof InferFacts<S> & string>(system: SingleModuleSystem<S>, factKey: K): Accessor<InferFacts<S>[K] | undefined>;\n/** Multi-key overload */\nexport function useFact<S extends ModuleSchema, K extends keyof InferFacts<S> & string>(system: SingleModuleSystem<S>, factKeys: K[]): Accessor<Pick<InferFacts<S>, K>>;\n/** Implementation */\nexport function useFact(\n\t// biome-ignore lint/suspicious/noExplicitAny: Implementation signature\n\tsystem: SingleModuleSystem<any>,\n\tkeyOrKeys: string | string[],\n): Accessor<unknown> {\n\tassertSystem(\"useFact\", system);\n\tif (process.env.NODE_ENV !== \"production\" && typeof keyOrKeys === \"function\") {\n\t\tconsole.error(\n\t\t\t\"[Directive] useFact() received a function. Did you mean useSelector()? \" +\n\t\t\t\t\"useFact() takes a string key or array of keys, not a selector function.\",\n\t\t);\n\t}\n\n\t// Multi-key path\n\tif (Array.isArray(keyOrKeys)) {\n\t\treturn _useFactMulti(system, keyOrKeys);\n\t}\n\n\t// Single key path\n\treturn _useFactSingle(system, keyOrKeys);\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: Internal\nfunction _useFactSingle(system: SingleModuleSystem<any>, factKey: string): Accessor<unknown> {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tif (!system.facts.$store.has(factKey)) {\n\t\t\tconsole.warn(\n\t\t\t\t`[Directive] useFact(\"${factKey}\") — fact not found in store. ` +\n\t\t\t\t`Check that \"${factKey}\" is defined in your module's schema.`,\n\t\t\t);\n\t\t}\n\t}\n\n\tconst [value, setValue] = createSignal(system.facts.$store.get(factKey));\n\tconst unsubscribe = system.facts.$store.subscribe([factKey], () => {\n\t\tsetValue(() => system.facts.$store.get(factKey));\n\t});\n\tonCleanup(unsubscribe);\n\treturn value;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: Internal\nfunction _useFactMulti(system: SingleModuleSystem<any>, factKeys: string[]): Accessor<Record<string, unknown>> {\n\tconst getValues = (): Record<string, unknown> => {\n\t\tconst result: Record<string, unknown> = {};\n\t\tfor (const key of factKeys) {\n\t\t\tresult[key] = system.facts.$store.get(key);\n\t\t}\n\t\treturn result;\n\t};\n\tconst [state, setState] = createSignal(getValues());\n\tconst unsubscribe = system.facts.$store.subscribe(factKeys, () => {\n\t\tsetState(getValues);\n\t});\n\tonCleanup(unsubscribe);\n\treturn state;\n}\n\n// ============================================================================\n// useDerived — single key or multi key\n// ============================================================================\n\n/** Single key overload */\nexport function useDerived<S extends ModuleSchema, K extends keyof InferDerivations<S> & string>(system: SingleModuleSystem<S>, derivationId: K): Accessor<InferDerivations<S>[K]>;\n/** Multi-key overload */\nexport function useDerived<S extends ModuleSchema, K extends keyof InferDerivations<S> & string>(system: SingleModuleSystem<S>, derivationIds: K[]): Accessor<Pick<InferDerivations<S>, K>>;\n/** Implementation */\nexport function useDerived(\n\t// biome-ignore lint/suspicious/noExplicitAny: Implementation signature\n\tsystem: SingleModuleSystem<any>,\n\tidOrIds: string | string[],\n): Accessor<unknown> {\n\tassertSystem(\"useDerived\", system);\n\tif (process.env.NODE_ENV !== \"production\" && typeof idOrIds === \"function\") {\n\t\tconsole.error(\n\t\t\t\"[Directive] useDerived() received a function. Did you mean useSelector()? \" +\n\t\t\t\t\"useDerived() takes a string key or array of keys, not a selector function.\",\n\t\t);\n\t}\n\n\t// Multi-key path\n\tif (Array.isArray(idOrIds)) {\n\t\treturn _useDerivedMulti(system, idOrIds);\n\t}\n\n\t// Single key path\n\treturn _useDerivedSingle(system, idOrIds);\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: Internal\nfunction _useDerivedSingle(system: SingleModuleSystem<any>, derivationId: string): Accessor<unknown> {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tconst initialValue = system.read(derivationId);\n\t\tif (initialValue === undefined) {\n\t\t\tconsole.warn(\n\t\t\t\t`[Directive] useDerived(\"${derivationId}\") returned undefined. ` +\n\t\t\t\t`Check that \"${derivationId}\" is defined in your module's derive property.`,\n\t\t\t);\n\t\t}\n\t}\n\tconst [value, setValue] = createSignal(system.read(derivationId));\n\tconst unsubscribe = system.subscribe([derivationId], () => {\n\t\tsetValue(() => system.read(derivationId));\n\t});\n\tonCleanup(unsubscribe);\n\treturn value;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: Internal\nfunction _useDerivedMulti(system: SingleModuleSystem<any>, derivationIds: string[]): Accessor<Record<string, unknown>> {\n\tconst getValues = (): Record<string, unknown> => {\n\t\tconst result: Record<string, unknown> = {};\n\t\tfor (const id of derivationIds) {\n\t\t\tresult[id] = system.read(id);\n\t\t}\n\t\treturn result;\n\t};\n\tconst [state, setState] = createSignal(getValues());\n\tconst unsubscribe = system.subscribe(derivationIds, () => {\n\t\tsetState(getValues);\n\t});\n\tonCleanup(unsubscribe);\n\treturn state;\n}\n\n// ============================================================================\n// useSelector — auto-tracking selector over facts and derivations\n// ============================================================================\n\n/**\n * Auto-tracking selector over facts and derivations.\n * Uses `withTracking()` to detect which facts the selector accesses,\n * then subscribes only to those keys.\n */\nexport function useSelector<S extends ModuleSchema, R>(\n\tsystem: SingleModuleSystem<S>,\n\tselector: (state: InferSelectorState<S>) => R,\n\tequalityFn?: (a: R, b: R) => boolean,\n): Accessor<R>;\nexport function useSelector<R>(\n\t// biome-ignore lint/suspicious/noExplicitAny: Backward-compatible fallback\n\tsystem: SingleModuleSystem<any>,\n\t// biome-ignore lint/suspicious/noExplicitAny: Selector receives dynamic state\n\tselector: (state: Record<string, any>) => R,\n\tequalityFn?: (a: R, b: R) => boolean,\n): Accessor<R>;\nexport function useSelector(\n\t// biome-ignore lint/suspicious/noExplicitAny: Implementation signature\n\tsystem: SingleModuleSystem<any>,\n\t// biome-ignore lint/suspicious/noExplicitAny: Implementation signature\n\tselector: (state: any) => unknown,\n\tequalityFn: (a: unknown, b: unknown) => boolean = defaultEquality,\n): Accessor<unknown> {\n\tassertSystem(\"useSelector\", system);\n\tconst deriveKeySet = new Set(Object.keys(system.derive ?? {}));\n\n\t// Build a tracking-aware state proxy that exposes both facts and derivations\n\tconst runWithTracking = () => runTrackedSelector(system, deriveKeySet, selector);\n\n\tconst initial = runWithTracking();\n\tlet trackedFactKeys = initial.factKeys;\n\tlet trackedDeriveKeys = initial.deriveKeys;\n\tconst [selected, setSelected] = createSignal(initial.value);\n\n\tconst unsubs: Array<() => void> = [];\n\n\tconst resubscribe = () => {\n\t\tfor (const unsub of unsubs) unsub();\n\t\tunsubs.length = 0;\n\n\t\tconst onUpdate = () => {\n\t\t\tconst result = runWithTracking();\n\t\t\tsetSelected((prev) => {\n\t\t\t\tif (!equalityFn(prev, result.value)) return result.value;\n\t\t\t\treturn prev;\n\t\t\t});\n\t\t\t// Re-track: check if deps changed\n\t\t\tif (depsChanged(trackedFactKeys, result.factKeys, trackedDeriveKeys, result.deriveKeys)) {\n\t\t\t\ttrackedFactKeys = result.factKeys;\n\t\t\t\ttrackedDeriveKeys = result.deriveKeys;\n\t\t\t\tresubscribe();\n\t\t\t}\n\t\t};\n\n\t\tif (trackedFactKeys.length > 0) {\n\t\t\tunsubs.push(system.facts.$store.subscribe(trackedFactKeys, onUpdate));\n\t\t} else if (trackedDeriveKeys.length === 0) {\n\t\t\tunsubs.push(system.facts.$store.subscribeAll(onUpdate));\n\t\t}\n\t\tif (trackedDeriveKeys.length > 0) {\n\t\t\tunsubs.push(system.subscribe(trackedDeriveKeys, onUpdate));\n\t\t}\n\t};\n\n\tresubscribe();\n\n\tonCleanup(() => {\n\t\tfor (const unsub of unsubs) unsub();\n\t});\n\n\treturn selected;\n}\n\n// ============================================================================\n// useDispatch\n// ============================================================================\n\nexport function useDispatch<S extends ModuleSchema>(\n\tsystem: SingleModuleSystem<S>,\n): (event: InferEvents<S>) => void {\n\tassertSystem(\"useDispatch\", system);\n\treturn (event: InferEvents<S>) => {\n\t\tsystem.dispatch(event);\n\t};\n}\n\n// ============================================================================\n// useEvents — memoized events reference\n// ============================================================================\n\n/**\n * Returns the system's events dispatcher.\n */\nexport function useEvents<S extends ModuleSchema>(\n\tsystem: SingleModuleSystem<S>,\n): SingleModuleSystem<S>[\"events\"] {\n\tassertSystem(\"useEvents\", system);\n\treturn system.events;\n}\n\n// ============================================================================\n// useWatch — derivation or fact side-effect\n// ============================================================================\n\n/** Watch a derivation or fact by key (auto-detected). When a key exists in both facts and derivations, the derivation overload takes priority. */\nexport function useWatch<S extends ModuleSchema, K extends keyof InferDerivations<S> & string>(\n\tsystem: SingleModuleSystem<S>,\n\tkey: K,\n\tcallback: (newValue: InferDerivations<S>[K], previousValue: InferDerivations<S>[K] | undefined) => void,\n): void;\n/** Watch a fact key with auto-detection. */\nexport function useWatch<S extends ModuleSchema, K extends keyof InferFacts<S> & string>(\n\tsystem: SingleModuleSystem<S>,\n\tkey: K,\n\tcallback: (newValue: InferFacts<S>[K] | undefined, previousValue: InferFacts<S>[K] | undefined) => void,\n): void;\n/**\n * Watch a fact by explicit \"fact\" discriminator.\n * @deprecated Use `useWatch(system, key, callback)` instead — facts are now auto-detected.\n */\nexport function useWatch<S extends ModuleSchema, K extends keyof InferFacts<S> & string>(\n\tsystem: SingleModuleSystem<S>,\n\tkind: \"fact\",\n\tfactKey: K,\n\tcallback: (newValue: InferFacts<S>[K] | undefined, previousValue: InferFacts<S>[K] | undefined) => void,\n): void;\n/** Watch a fact or derivation (generic fallback) */\nexport function useWatch<T>(\n\t// biome-ignore lint/suspicious/noExplicitAny: Backward-compatible fallback\n\tsystem: SingleModuleSystem<any>,\n\tkey: string,\n\tcallback: (newValue: T, previousValue: T | undefined) => void,\n): void;\n/** Implementation */\nexport function useWatch(\n\t// biome-ignore lint/suspicious/noExplicitAny: Implementation signature\n\tsystem: SingleModuleSystem<any>,\n\tderivationIdOrKind: string,\n\tcallbackOrFactKey: string | ((newValue: unknown, prevValue: unknown) => void),\n\tmaybeCallback?: (newValue: unknown, prevValue: unknown) => void,\n): void {\n\tassertSystem(\"useWatch\", system);\n\t// Backward compat: useWatch(system, \"fact\", factKey, callback)\n\tconst isFact =\n\t\tderivationIdOrKind === \"fact\" &&\n\t\ttypeof callbackOrFactKey === \"string\" &&\n\t\ttypeof maybeCallback === \"function\";\n\n\tconst key = isFact ? (callbackOrFactKey as string) : derivationIdOrKind;\n\tconst callback = isFact\n\t\t? maybeCallback!\n\t\t: (callbackOrFactKey as (newValue: unknown, prevValue: unknown) => void);\n\n\tconst unsubscribe = system.watch(key, callback);\n\tonCleanup(unsubscribe);\n}\n\n// ============================================================================\n// useInspect — consolidated inspection hook\n// ============================================================================\n\n/** Options for useInspect */\nexport interface UseInspectOptions {\n\tthrottleMs?: number;\n}\n\n/**\n * Consolidated system inspection hook.\n * Returns Accessor<InspectState> with optional throttling.\n */\nexport function useInspect(\n\t// biome-ignore lint/suspicious/noExplicitAny: Must work with any schema\n\tsystem: SingleModuleSystem<any>,\n\toptions?: UseInspectOptions,\n): Accessor<InspectState> {\n\tassertSystem(\"useInspect\", system);\n\tconst [state, setState] = createSignal<InspectState>(computeInspectState(system));\n\n\tconst update = () => {\n\t\tsetState(computeInspectState(system));\n\t};\n\n\tif (options?.throttleMs && options.throttleMs > 0) {\n\t\tconst { throttled, cleanup } = createThrottle(update, options.throttleMs);\n\t\tconst unsubFacts = system.facts.$store.subscribeAll(throttled);\n\t\tconst unsubSettled = system.onSettledChange(throttled);\n\t\tonCleanup(() => {\n\t\t\tcleanup();\n\t\t\tunsubFacts();\n\t\t\tunsubSettled();\n\t\t});\n\t} else {\n\t\tconst unsubFacts = system.facts.$store.subscribeAll(update);\n\t\tconst unsubSettled = system.onSettledChange(update);\n\t\tonCleanup(() => {\n\t\t\tunsubFacts();\n\t\t\tunsubSettled();\n\t\t});\n\t}\n\n\treturn state;\n}\n\n// ============================================================================\n// useRequirementStatus — single or multi\n// ============================================================================\n\n/** Single type overload */\nexport function useRequirementStatus(statusPlugin: StatusPlugin, type: string): Accessor<RequirementTypeStatus>;\n/** Multi-type overload */\nexport function useRequirementStatus(statusPlugin: StatusPlugin, types: string[]): Accessor<Record<string, RequirementTypeStatus>>;\n/** Implementation */\nexport function useRequirementStatus(\n\tstatusPlugin: StatusPlugin,\n\ttypeOrTypes: string | string[],\n): Accessor<RequirementTypeStatus> | Accessor<Record<string, RequirementTypeStatus>> {\n\tif (Array.isArray(typeOrTypes)) {\n\t\tconst getValues = (): Record<string, RequirementTypeStatus> => {\n\t\t\tconst result: Record<string, RequirementTypeStatus> = {};\n\t\t\tfor (const type of typeOrTypes) {\n\t\t\t\tresult[type] = statusPlugin.getStatus(type);\n\t\t\t}\n\t\t\treturn result;\n\t\t};\n\t\tconst [state, setState] = createSignal(getValues());\n\t\tconst unsubscribe = statusPlugin.subscribe(() => {\n\t\t\tsetState(getValues);\n\t\t});\n\t\tonCleanup(unsubscribe);\n\t\treturn state;\n\t}\n\n\tconst [status, setStatus] = createSignal<RequirementTypeStatus>(statusPlugin.getStatus(typeOrTypes));\n\tconst unsubscribe = statusPlugin.subscribe(() => {\n\t\tsetStatus(statusPlugin.getStatus(typeOrTypes));\n\t});\n\tonCleanup(unsubscribe);\n\treturn status;\n}\n\n// ============================================================================\n// useExplain — reactive requirement explanation\n// ============================================================================\n\n/**\n * Reactively returns the explanation string for a requirement.\n */\nexport function useExplain(\n\t// biome-ignore lint/suspicious/noExplicitAny: Must work with any schema\n\tsystem: SingleModuleSystem<any>,\n\trequirementId: string,\n): Accessor<string | null> {\n\tassertSystem(\"useExplain\", system);\n\tconst [explanation, setExplanation] = createSignal<string | null>(system.explain(requirementId));\n\n\tconst update = () => setExplanation(system.explain(requirementId));\n\tconst unsubFacts = system.facts.$store.subscribeAll(update);\n\tconst unsubSettled = system.onSettledChange(update);\n\tonCleanup(() => {\n\t\tunsubFacts();\n\t\tunsubSettled();\n\t});\n\n\treturn explanation;\n}\n\n// ============================================================================\n// useConstraintStatus — reactive constraint inspection\n// ============================================================================\n\n/** Get all constraints */\nexport function useConstraintStatus(\n\tsystem: SingleModuleSystem<any>,\n): Accessor<ConstraintInfo[]>;\n/** Get a single constraint by ID */\nexport function useConstraintStatus(\n\tsystem: SingleModuleSystem<any>,\n\tconstraintId: string,\n): Accessor<ConstraintInfo | null>;\n/** Implementation */\nexport function useConstraintStatus(\n\t// biome-ignore lint/suspicious/noExplicitAny: Must work with any schema\n\tsystem: SingleModuleSystem<any>,\n\tconstraintId?: string,\n): Accessor<ConstraintInfo[] | ConstraintInfo | null> {\n\tassertSystem(\"useConstraintStatus\", system);\n\tconst getVal = () => {\n\t\tconst inspection = system.inspect();\n\t\tif (!constraintId) return inspection.constraints;\n\t\treturn inspection.constraints.find((c: ConstraintInfo) => c.id === constraintId) ?? null;\n\t};\n\n\tconst [state, setState] = createSignal<ConstraintInfo[] | ConstraintInfo | null>(getVal());\n\n\tconst update = () => setState(getVal);\n\tconst unsubFacts = system.facts.$store.subscribeAll(update);\n\tconst unsubSettled = system.onSettledChange(update);\n\tonCleanup(() => {\n\t\tunsubFacts();\n\t\tunsubSettled();\n\t});\n\n\treturn state;\n}\n\n// ============================================================================\n// useOptimisticUpdate — batch with rollback on failure\n// ============================================================================\n\nexport interface OptimisticUpdateResult {\n\tmutate: (updateFn: () => void) => void;\n\tisPending: Accessor<boolean>;\n\terror: Accessor<Error | null>;\n\trollback: () => void;\n}\n\n/**\n * Optimistic update hook. Saves a snapshot before mutating, monitors\n * a requirement type via statusPlugin, and rolls back on failure.\n */\nexport function useOptimisticUpdate(\n\t// biome-ignore lint/suspicious/noExplicitAny: Must work with any schema\n\tsystem: SingleModuleSystem<any>,\n\tstatusPlugin?: StatusPlugin,\n\trequirementType?: string,\n): OptimisticUpdateResult {\n\tassertSystem(\"useOptimisticUpdate\", system);\n\tconst [isPending, setIsPending] = createSignal(false);\n\tconst [error, setError] = createSignal<Error | null>(null);\n\tlet snapshot: SystemSnapshot | null = null;\n\tlet statusUnsub: (() => void) | null = null;\n\n\tconst rollback = () => {\n\t\tif (snapshot) {\n\t\t\tsystem.restore(snapshot);\n\t\t\tsnapshot = null;\n\t\t}\n\t\tsetIsPending(false);\n\t\tsetError(null);\n\t\tstatusUnsub?.();\n\t\tstatusUnsub = null;\n\t};\n\n\tconst mutate = (updateFn: () => void) => {\n\t\tsnapshot = system.getSnapshot();\n\t\tsetIsPending(true);\n\t\tsetError(null);\n\t\tsystem.batch(updateFn);\n\n\t\tif (statusPlugin && requirementType) {\n\t\t\tstatusUnsub?.();\n\t\t\tstatusUnsub = statusPlugin.subscribe(() => {\n\t\t\t\tconst status = statusPlugin.getStatus(requirementType);\n\t\t\t\tif (!status.isLoading && !status.hasError) {\n\t\t\t\t\tsnapshot = null;\n\t\t\t\t\tsetIsPending(false);\n\t\t\t\t\tstatusUnsub?.();\n\t\t\t\t\tstatusUnsub = null;\n\t\t\t\t} else if (status.hasError) {\n\t\t\t\t\tsetError(() => status.lastError);\n\t\t\t\t\trollback();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t};\n\n\tonCleanup(() => {\n\t\tstatusUnsub?.();\n\t});\n\n\treturn { mutate, isPending, error, rollback };\n}\n\n// ============================================================================\n// useSuspenseRequirement — Solid-specific Suspense integration\n// ============================================================================\n\n/**\n * Single type: throws a promise while the requirement is pending (Suspense).\n */\nexport function useSuspenseRequirement(statusPlugin: StatusPlugin, type: string): Accessor<RequirementTypeStatus>;\n/**\n * Multi-type: throws a promise while any of the requirements are pending.\n */\nexport function useSuspenseRequirement(statusPlugin: StatusPlugin, types: string[]): Accessor<Record<string, RequirementTypeStatus>>;\n/** Implementation */\nexport function useSuspenseRequirement(\n\tstatusPlugin: StatusPlugin,\n\ttypeOrTypes: string | string[],\n): Accessor<RequirementTypeStatus> | Accessor<Record<string, RequirementTypeStatus>> {\n\tconst types = Array.isArray(typeOrTypes) ? typeOrTypes : [typeOrTypes];\n\n\t// Check if any are still loading — if so, throw a promise\n\tconst anyLoading = () => types.some((t) => statusPlugin.getStatus(t).isLoading);\n\n\tif (anyLoading()) {\n\t\tthrow new Promise<void>((resolve) => {\n\t\t\tconst unsub = statusPlugin.subscribe(() => {\n\t\t\t\tif (!anyLoading()) {\n\t\t\t\t\tunsub();\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\t// Once resolved, return normal accessor\n\tif (Array.isArray(typeOrTypes)) {\n\t\treturn useRequirementStatus(statusPlugin, typeOrTypes) as Accessor<Record<string, RequirementTypeStatus>>;\n\t}\n\treturn useRequirementStatus(statusPlugin, typeOrTypes) as Accessor<RequirementTypeStatus>;\n}\n\n// ============================================================================\n// useTimeTravel — reactive time-travel signal\n// ============================================================================\n\n/**\n * Reactive time-travel signal. Returns an Accessor that updates\n * when snapshots are taken or navigation occurs.\n *\n * @example\n * ```tsx\n * const tt = useTimeTravel(system);\n * <button disabled={!tt()?.canUndo} onClick={() => tt()?.undo()}>Undo</button>\n * ```\n */\nexport function useTimeTravel(\n\t// biome-ignore lint/suspicious/noExplicitAny: Must work with any schema\n\tsystem: SingleModuleSystem<any>,\n): Accessor<ReturnType<typeof buildTimeTravelState>> {\n\tassertSystem(\"useTimeTravel\", system);\n\tconst [state, setState] = createSignal<ReturnType<typeof buildTimeTravelState>>(buildTimeTravelState(system));\n\tconst unsub = system.onTimeTravelChange(() => setState(buildTimeTravelState(system)));\n\tonCleanup(unsub);\n\treturn state;\n}\n\n// ============================================================================\n// Scoped System\n// ============================================================================\n\n/** Configuration for useDirective */\ninterface UseDirectiveConfig {\n\t// biome-ignore lint/suspicious/noExplicitAny: Plugin types vary\n\tplugins?: Plugin<any>[];\n\tdebug?: DebugConfig;\n\terrorBoundary?: ErrorBoundaryConfig;\n\ttickMs?: number;\n\tzeroConfig?: boolean;\n\t// biome-ignore lint/suspicious/noExplicitAny: Facts type varies\n\tinitialFacts?: Record<string, any>;\n\tstatus?: boolean;\n\t/** Fact keys to subscribe to (omit for all) */\n\tfacts?: string[];\n\t/** Derivation keys to subscribe to (omit for all) */\n\tderived?: string[];\n}\n\n/**\n * Create a scoped Directive system with automatic lifecycle management.\n * When no `facts` or `derived` keys are specified, subscribes to ALL\n * facts and derivations and returns reactive signals.\n *\n * @example\n * ```tsx\n * // Subscribe to everything\n * const { facts, derived, events, dispatch } = useDirective(counterModule);\n *\n * // Selective keys\n * const { facts, derived } = useDirective(counterModule, { facts: [\"count\"], derived: [\"doubled\"] });\n * ```\n */\nexport function useDirective<M extends ModuleSchema>(\n\tmoduleDef: ModuleDef<M>,\n\tconfig?: UseDirectiveConfig,\n) {\n\tconst allPlugins = [...(config?.plugins ?? [])];\n\tlet statusPlugin: StatusPlugin | undefined;\n\n\tif (config?.status) {\n\t\tconst sp = createRequirementStatusPlugin();\n\t\tstatusPlugin = sp;\n\t\t// biome-ignore lint/suspicious/noExplicitAny: Plugin generic issues\n\t\tallPlugins.push(sp.plugin as Plugin<any>);\n\t}\n\n\t// biome-ignore lint/suspicious/noExplicitAny: Required for overload compatibility\n\tconst system = createSystem({\n\t\tmodule: moduleDef,\n\t\tplugins: allPlugins.length > 0 ? allPlugins : undefined,\n\t\tdebug: config?.debug,\n\t\terrorBoundary: config?.errorBoundary,\n\t\ttickMs: config?.tickMs,\n\t\tzeroConfig: config?.zeroConfig,\n\t\tinitialFacts: config?.initialFacts,\n\t} as any) as unknown as SingleModuleSystem<M>;\n\n\tsystem.start();\n\n\tonCleanup(() => {\n\t\tsystem.destroy();\n\t});\n\n\tconst factKeys = config?.facts;\n\tconst derivedKeys = config?.derived;\n\tconst subscribeAll = !factKeys && !derivedKeys;\n\n\t// Subscribe to facts\n\tconst [factsState, setFactsState] = createSignal(\n\t\tsubscribeAll\n\t\t\t? (system.facts.$store.toObject() as InferFacts<M>)\n\t\t\t: (pickFacts(system, factKeys ?? []) as InferFacts<M>),\n\t);\n\tconst unsubFacts = subscribeAll\n\t\t? system.facts.$store.subscribeAll(() => {\n\t\t\tsetFactsState(() => system.facts.$store.toObject() as InferFacts<M>);\n\t\t})\n\t\t: factKeys && factKeys.length > 0\n\t\t\t? system.facts.$store.subscribe(factKeys, () => {\n\t\t\t\tsetFactsState(() => pickFacts(system, factKeys) as InferFacts<M>);\n\t\t\t})\n\t\t\t: null;\n\n\t// Subscribe to derivations\n\tconst allDerivationKeys = subscribeAll ? Object.keys(system.derive ?? {}) : (derivedKeys ?? []);\n\tconst getDerived = (): InferDerivations<M> => {\n\t\tconst result: Record<string, unknown> = {};\n\t\tfor (const key of allDerivationKeys) {\n\t\t\tresult[key] = system.read(key);\n\t\t}\n\t\treturn result as InferDerivations<M>;\n\t};\n\tconst [derivedState, setDerivedState] = createSignal(getDerived());\n\tconst unsubDerived = allDerivationKeys.length > 0\n\t\t? system.subscribe(allDerivationKeys, () => { setDerivedState(getDerived); })\n\t\t: null;\n\n\tonCleanup(() => {\n\t\tunsubFacts?.();\n\t\tunsubDerived?.();\n\t});\n\n\tconst events = system.events;\n\tconst dispatch = (event: InferEvents<M>) => system.dispatch(event);\n\n\treturn {\n\t\tsystem,\n\t\tfacts: factsState as Accessor<InferFacts<M>>,\n\t\tderived: derivedState as Accessor<InferDerivations<M>>,\n\t\tevents,\n\t\tdispatch,\n\t\tstatusPlugin,\n\t};\n}\n\n// ============================================================================\n// Signal Factories (for use outside components)\n// ============================================================================\n\n/**\n * Create a derivation signal outside of a component.\n */\nexport function createDerivedSignal<T>(\n\t// biome-ignore lint/suspicious/noExplicitAny: Must work with any schema\n\tsystem: SingleModuleSystem<any>,\n\tderivationId: string,\n): [Accessor<T>, () => void] {\n\tconst [value, setValue] = createSignal<T>(system.read(derivationId) as T);\n\tconst unsubscribe = system.subscribe([derivationId], () => {\n\t\tsetValue(() => system.read(derivationId) as T);\n\t});\n\treturn [value, unsubscribe];\n}\n\n/**\n * Create a fact signal outside of a component.\n */\nexport function createFactSignal<T>(\n\t// biome-ignore lint/suspicious/noExplicitAny: Must work with any schema\n\tsystem: SingleModuleSystem<any>,\n\tfactKey: string,\n): [Accessor<T | undefined>, () => void] {\n\tconst [value, setValue] = createSignal<T | undefined>(\n\t\tsystem.facts.$store.get(factKey) as T | undefined,\n\t);\n\tconst unsubscribe = system.facts.$store.subscribe([factKey], () => {\n\t\tsetValue(() => system.facts.$store.get(factKey) as T | undefined);\n\t});\n\treturn [value, unsubscribe];\n}\n\n// ============================================================================\n// Typed Hooks Factory\n// ============================================================================\n\nexport function createTypedHooks<M extends ModuleSchema>(): {\n\tuseFact: <K extends keyof InferFacts<M> & string>(\n\t\tsystem: SingleModuleSystem<M>,\n\t\tfactKey: K,\n\t) => Accessor<InferFacts<M>[K] | undefined>;\n\tuseDerived: <K extends keyof InferDerivations<M> & string>(\n\t\tsystem: SingleModuleSystem<M>,\n\t\tderivationId: K,\n\t) => Accessor<InferDerivations<M>[K]>;\n\tuseDispatch: (system: SingleModuleSystem<M>) => (event: InferEvents<M>) => void;\n\tuseEvents: (system: SingleModuleSystem<M>) => SingleModuleSystem<M>[\"events\"];\n\tuseWatch: <K extends string>(\n\t\tsystem: SingleModuleSystem<M>,\n\t\tkey: K,\n\t\tcallback: (newValue: unknown, previousValue: unknown) => void,\n\t) => void;\n} {\n\treturn {\n\t\tuseFact: <K extends keyof InferFacts<M> & string>(system: SingleModuleSystem<M>, factKey: K) =>\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: Required for overload compatibility\n\t\t\tuseFact(system as SingleModuleSystem<any>, factKey as string) as Accessor<InferFacts<M>[K] | undefined>,\n\t\tuseDerived: <K extends keyof InferDerivations<M> & string>(system: SingleModuleSystem<M>, derivationId: K) =>\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: Required for overload compatibility\n\t\t\tuseDerived(system as SingleModuleSystem<any>, derivationId as string) as Accessor<InferDerivations<M>[K]>,\n\t\tuseDispatch: (system: SingleModuleSystem<M>) => {\n\t\t\treturn (event: InferEvents<M>) => {\n\t\t\t\tsystem.dispatch(event);\n\t\t\t};\n\t\t},\n\t\tuseEvents: (system: SingleModuleSystem<M>) => useEvents<M>(system),\n\t\tuseWatch: <K extends string>(\n\t\t\tsystem: SingleModuleSystem<M>,\n\t\t\tkey: K,\n\t\t\tcallback: (newValue: unknown, previousValue: unknown) => void,\n\t\t) =>\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: Required for overload compatibility\n\t\t\tuseWatch(system as SingleModuleSystem<any>, key, callback),\n\t};\n}\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@directive-run/solid",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Solid.js signals adapter for Directive.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Jason Comes",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/directive-run/directive",
|
|
10
|
+
"directory": "packages/solid"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://directive.run",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/directive-run/directive/issues"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public",
|
|
18
|
+
"registry": "https://registry.npmjs.org"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"directive",
|
|
25
|
+
"solid",
|
|
26
|
+
"solidjs",
|
|
27
|
+
"signals",
|
|
28
|
+
"state-management",
|
|
29
|
+
"reactive",
|
|
30
|
+
"constraint-driven"
|
|
31
|
+
],
|
|
32
|
+
"sideEffects": false,
|
|
33
|
+
"type": "module",
|
|
34
|
+
"main": "./dist/index.cjs",
|
|
35
|
+
"module": "./dist/index.js",
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"require": "./dist/index.cjs",
|
|
41
|
+
"import": "./dist/index.js"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"files": [
|
|
45
|
+
"dist"
|
|
46
|
+
],
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"solid-js": ">=1",
|
|
49
|
+
"@directive-run/core": "0.1.1"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/node": "^25.2.0",
|
|
53
|
+
"solid-js": "^1.8.0",
|
|
54
|
+
"tsup": "^8.3.5",
|
|
55
|
+
"typescript": "^5.7.2",
|
|
56
|
+
"@directive-run/core": "0.1.1"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "tsup",
|
|
60
|
+
"dev": "tsup --watch",
|
|
61
|
+
"test": "vitest run",
|
|
62
|
+
"typecheck": "tsc --noEmit",
|
|
63
|
+
"clean": "rm -rf dist"
|
|
64
|
+
}
|
|
65
|
+
}
|