intentx-solid 0.2.1-z1 → 0.2.2-z1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intentx-solid",
3
- "version": "0.2.1-z1",
3
+ "version": "0.2.2-z1",
4
4
  "description": "Intent-driven logic adapter for SolidJS. Connects intentx-runtime with Solid's fine-grained reactivity.",
5
5
  "license": "MIT",
6
6
  "author": "Delpi.Kye",
@@ -55,7 +55,7 @@
55
55
  "solid-js": "^1.8.0"
56
56
  },
57
57
  "dependencies": {
58
- "intentx-runtime": "^0.2.4"
58
+ "intentx-runtime": "^0.2.6"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@rollup/plugin-commonjs": "^25.0.0",
package/build/index.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";var e=require("intentx-runtime"),t=require("solid-js/store"),r=require("solid-js");let n=null;const o=new Map;function c(){return n||(n=e.createIntentBus()),n}function s(t){return t?(o.has(t)||o.set(t,e.createIntentBus()),o.get(t)):c()}const i="undefined"!=typeof window;function u(n,o){const c="string"==typeof o?.scope?e.createScope(o.scope):o?.scope,u=o?.bus??(o?.sharedBus?s("string"==typeof o?.scope?o.scope:void 0):void 0),a=u?n.create(c,u):n.create(c),[p,f]=t.createStore(a.getSnapshot());let d=()=>{};return i&&(d=a.subscribe(()=>{f(t.reconcile(a.getSnapshot()))}),r.onCleanup(()=>{d(),a.destroy?.()})),{runtime:a,store:p,state:p,actions:a.actions,emit:a.emit.bind(a)}}const a=r.createContext({});Object.defineProperty(exports,"createIntentBus",{enumerable:!0,get:function(){return e.createIntentBus}}),Object.defineProperty(exports,"createLogic",{enumerable:!0,get:function(){return e.createLogic}}),Object.defineProperty(exports,"effect",{enumerable:!0,get:function(){return e.effect}}),exports.getGlobalBus=c,exports.getScopedBus=s,exports.setLogicContext=function(e,t,r){const n=u(t,r);return{Provider:function(t){return a.Provider({value:{[e]:n},get children(){return t.children}})},store:n}},exports.useLogic=u,exports.useLogicContext=function(e){const t=r.useContext(a);if(!t||!t[e])throw Error(`Logic "${e}" not found in context`);return t[e]};
package/build/index.d.ts DELETED
@@ -1,33 +0,0 @@
1
- import { createIntentBus, LogicActions, InferComputed, Scope, ComputedDef, LogicFactory } from 'intentx-runtime';
2
- export { EffectMode, ExtractLogicTypes, IntentContext, LogicActions, LogicFactory, LogicRuntime, createIntentBus, createLogic, effect } from 'intentx-runtime';
3
- import * as solid_js from 'solid-js';
4
-
5
- type IntentBus = ReturnType<typeof createIntentBus>;
6
- declare function getGlobalBus(): IntentBus;
7
- declare function getScopedBus(scope?: string): IntentBus;
8
-
9
- type LogicApi<S, C, A extends LogicActions> = {
10
- runtime: any;
11
- store: Readonly<S & InferComputed<C>>;
12
- state: Readonly<S & InferComputed<C>>;
13
- actions: A;
14
- emit: (...args: any[]) => Promise<void>;
15
- };
16
-
17
- type LogicOptions = {
18
- scope?: Scope | string;
19
- sharedBus?: boolean;
20
- bus?: IntentBus;
21
- };
22
- declare function useLogic<S extends object, C extends ComputedDef<S>, A extends LogicActions>(logic: LogicFactory<S, C, A>, options?: LogicOptions): LogicApi<S, C, A>;
23
-
24
- declare function setLogicContext<S extends object, C extends ComputedDef<S>, A extends LogicActions>(key: string, logic: LogicFactory<S, C, A>, options?: LogicOptions): {
25
- Provider: (props: {
26
- children: any;
27
- }) => solid_js.JSX.Element;
28
- store: LogicApi<S, C, A>;
29
- };
30
- declare function useLogicContext<T>(key: string): T;
31
-
32
- export { getGlobalBus, getScopedBus, setLogicContext, useLogic, useLogicContext };
33
- export type { IntentBus, LogicApi, LogicOptions };
package/build/index.js DELETED
@@ -1 +0,0 @@
1
- import{createIntentBus as t,createScope as e}from"intentx-runtime";export{createIntentBus,createLogic,effect}from"intentx-runtime";import{createStore as n,reconcile as o}from"solid-js/store";import{onCleanup as r,createContext as i,useContext as s}from"solid-js";let c=null;const u=new Map;function f(){return c||(c=t()),c}function p(e){return e?(u.has(e)||u.set(e,t()),u.get(e)):f()}const d="undefined"!=typeof window;function a(t,i){const s="string"==typeof i?.scope?e(i.scope):i?.scope,c=i?.bus??(i?.sharedBus?p("string"==typeof i?.scope?i.scope:void 0):void 0),u=c?t.create(s,c):t.create(s),[f,a]=n(u.getSnapshot());let m=()=>{};return d&&(m=u.subscribe(()=>{a(o(u.getSnapshot()))}),r(()=>{m(),u.destroy?.()})),{runtime:u,store:f,state:f,actions:u.actions,emit:u.emit.bind(u)}}const m=i({});function l(t,e,n){const o=a(e,n);return{Provider:function(e){return m.Provider({value:{[t]:o},get children(){return e.children}})},store:o}}function g(t){const e=s(m);if(!e||!e[t])throw Error(`Logic "${t}" not found in context`);return e[t]}export{f as getGlobalBus,p as getScopedBus,l as setLogicContext,a as useLogic,g as useLogicContext};
@@ -1,4 +0,0 @@
1
- import { createIntentBus } from "intentx-runtime";
2
- export type IntentBus = ReturnType<typeof createIntentBus>;
3
- export declare function getGlobalBus(): IntentBus;
4
- export declare function getScopedBus(scope?: string): IntentBus;
@@ -1,9 +0,0 @@
1
- import type { LogicFactory, LogicActions, ComputedDef } from "intentx-runtime";
2
- import type { LogicOptions } from "./useLogic";
3
- export declare function setLogicContext<S extends object, C extends ComputedDef<S>, A extends LogicActions>(key: string, logic: LogicFactory<S, C, A>, options?: LogicOptions): {
4
- Provider: (props: {
5
- children: any;
6
- }) => import("solid-js").JSX.Element;
7
- store: import("./types").LogicApi<S, C, A>;
8
- };
9
- export declare function useLogicContext<T>(key: string): T;
@@ -1,4 +0,0 @@
1
- export * from "./useLogic";
2
- export * from "./context";
3
- export * from "./bus";
4
- export * from "./types";
@@ -1,8 +0,0 @@
1
- import type { InferComputed, LogicActions } from "intentx-runtime";
2
- export type LogicApi<S, C, A extends LogicActions> = {
3
- runtime: any;
4
- store: Readonly<S & InferComputed<C>>;
5
- state: Readonly<S & InferComputed<C>>;
6
- actions: A;
7
- emit: (...args: any[]) => Promise<void>;
8
- };
@@ -1,9 +0,0 @@
1
- import type { Scope, LogicFactory, LogicActions, ComputedDef } from "intentx-runtime";
2
- import type { IntentBus } from "./bus";
3
- import type { LogicApi } from "./types";
4
- export type LogicOptions = {
5
- scope?: Scope | string;
6
- sharedBus?: boolean;
7
- bus?: IntentBus;
8
- };
9
- export declare function useLogic<S extends object, C extends ComputedDef<S>, A extends LogicActions>(logic: LogicFactory<S, C, A>, options?: LogicOptions): LogicApi<S, C, A>;