intentx-solid 0.1.0 → 0.2.0

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/README.md CHANGED
@@ -63,7 +63,7 @@ npm install intentx-solid
63
63
  ## 🧩 Core Logic (Framework-Agnostic)
64
64
 
65
65
  ``` ts
66
- import { createLogic } from "intentx-runtime"
66
+ import { createLogic } from "intentx-solid"
67
67
 
68
68
  export const counterLogic = createLogic({
69
69
  name: "counter",
@@ -168,7 +168,7 @@ useLogic(logic, {
168
168
  Custom bus:
169
169
 
170
170
  ``` ts
171
- import { createIntentBus } from "intentx-runtime"
171
+ import { createIntentBus } from "intentx-solid"
172
172
 
173
173
  const bus = createIntentBus()
174
174
 
package/build/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { createIntentBus, LogicActions, LogicFactory, Scope } from 'intentx-runtime';
1
+ import { createIntentBus, LogicActions, InferComputed, Scope, ComputedDef, LogicFactory } from 'intentx-runtime';
2
2
  export { EffectMode, ExtractLogicTypes, IntentContext, LogicActions, LogicFactory, LogicRuntime, createIntentBus, createLogic, effect } from 'intentx-runtime';
3
3
  import * as solid_js from 'solid-js';
4
4
 
@@ -6,13 +6,7 @@ type IntentBus = ReturnType<typeof createIntentBus>;
6
6
  declare function getGlobalBus(): IntentBus;
7
7
  declare function getScopedBus(scope?: string): IntentBus;
8
8
 
9
- type ComputedDef<S> = Record<string, (context: {
10
- state: Readonly<S>;
11
- }) => any>;
12
- type InferComputed<C> = {
13
- [K in keyof C]: C[K] extends (...args: any) => infer R ? R : never;
14
- };
15
- type LogicInstance<S, C, A extends LogicActions> = {
9
+ type LogicApi<S, C, A extends LogicActions> = {
16
10
  runtime: any;
17
11
  store: Readonly<S & InferComputed<C>>;
18
12
  state: Readonly<S & InferComputed<C>>;
@@ -20,19 +14,20 @@ type LogicInstance<S, C, A extends LogicActions> = {
20
14
  emit: (...args: any[]) => Promise<void>;
21
15
  };
22
16
 
23
- declare function useLogic<S extends object, C extends ComputedDef<S>, A extends LogicActions>(logic: LogicFactory<S, C, A>, options?: {
17
+ type LogicOptions = {
24
18
  scope?: Scope | string;
25
19
  sharedBus?: boolean;
26
- bus?: ReturnType<typeof getScopedBus>;
27
- }): LogicInstance<S, C, A>;
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>;
28
23
 
29
- declare function setLogicContext<S extends object, C extends ComputedDef<S>, A extends LogicActions>(key: string, logic: LogicFactory<S, C, A>, options?: Parameters<typeof useLogic<S, C, A>>[1]): {
24
+ declare function setLogicContext<S extends object, C extends ComputedDef<S>, A extends LogicActions>(key: string, logic: LogicFactory<S, C, A>, options?: LogicOptions): {
30
25
  Provider: (props: {
31
26
  children: any;
32
27
  }) => solid_js.JSX.Element;
33
- store: LogicInstance<S, C, A>;
28
+ store: LogicApi<S, C, A>;
34
29
  };
35
30
  declare function useLogicContext<T>(key: string): T;
36
31
 
37
32
  export { getGlobalBus, getScopedBus, setLogicContext, useLogic, useLogicContext };
38
- export type { ComputedDef, InferComputed, IntentBus, LogicInstance };
33
+ export type { IntentBus, LogicApi, LogicOptions };
@@ -1,10 +1,9 @@
1
- import type { LogicFactory, LogicActions } from "intentx-runtime";
2
- import { useLogic } from "./useLogic";
3
- import type { ComputedDef } from "./types";
4
- export declare function setLogicContext<S extends object, C extends ComputedDef<S>, A extends LogicActions>(key: string, logic: LogicFactory<S, C, A>, options?: Parameters<typeof useLogic<S, C, A>>[1]): {
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): {
5
4
  Provider: (props: {
6
5
  children: any;
7
6
  }) => import("solid-js").JSX.Element;
8
- store: import("./types").LogicInstance<S, C, A>;
7
+ store: import("./types").LogicApi<S, C, A>;
9
8
  };
10
9
  export declare function useLogicContext<T>(key: string): T;
@@ -1,11 +1,5 @@
1
- import type { LogicActions } from "intentx-runtime";
2
- export type ComputedDef<S> = Record<string, (context: {
3
- state: Readonly<S>;
4
- }) => any>;
5
- export type InferComputed<C> = {
6
- [K in keyof C]: C[K] extends (...args: any) => infer R ? R : never;
7
- };
8
- export type LogicInstance<S, C, A extends LogicActions> = {
1
+ import type { InferComputed, LogicActions } from "intentx-runtime";
2
+ export type LogicApi<S, C, A extends LogicActions> = {
9
3
  runtime: any;
10
4
  store: Readonly<S & InferComputed<C>>;
11
5
  state: Readonly<S & InferComputed<C>>;
@@ -1,8 +1,9 @@
1
- import type { Scope, LogicFactory, LogicActions } from "intentx-runtime";
2
- import { getScopedBus } from "./bus";
3
- import type { ComputedDef, LogicInstance } from "./types";
4
- export declare function useLogic<S extends object, C extends ComputedDef<S>, A extends LogicActions>(logic: LogicFactory<S, C, A>, options?: {
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
5
  scope?: Scope | string;
6
6
  sharedBus?: boolean;
7
- bus?: ReturnType<typeof getScopedBus>;
8
- }): LogicInstance<S, C, A>;
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>;
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "intentx-solid",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
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",
7
7
  "type": "module",
8
+
8
9
  "main": "build/index.cjs",
9
10
  "module": "build/index.js",
10
11
  "types": "build/index.d.ts",
12
+
11
13
  "exports": {
12
14
  ".": {
13
15
  "import": "./build/index.js",
@@ -15,22 +17,29 @@
15
17
  "types": "./build/index.d.ts"
16
18
  }
17
19
  },
20
+
18
21
  "files": [
19
22
  "build"
20
23
  ],
24
+
21
25
  "sideEffects": false,
26
+
22
27
  "repository": {
23
28
  "type": "git",
24
29
  "url": "https://github.com/delpikye-v/intentx-solid.git"
25
30
  },
31
+
26
32
  "homepage": "https://github.com/delpikye-v/intentx-solid#readme",
33
+
27
34
  "bugs": {
28
35
  "url": "https://github.com/delpikye-v/intentx-solid/issues"
29
36
  },
37
+
30
38
  "funding": {
31
39
  "type": "github",
32
40
  "url": "https://github.com/sponsors/delpikye-v"
33
41
  },
42
+
34
43
  "keywords": [
35
44
  "solid",
36
45
  "solidjs",
@@ -43,15 +52,25 @@
43
52
  "microfrontend",
44
53
  "architecture"
45
54
  ],
55
+
46
56
  "engines": {
47
57
  "node": ">=18"
48
58
  },
59
+
60
+ "scripts": {
61
+ "clean": "rimraf build",
62
+ "build": "rollup -c",
63
+ "cb": "npm run clean && npm run build"
64
+ },
65
+
49
66
  "peerDependencies": {
50
67
  "solid-js": "^1.8.0"
51
68
  },
69
+
52
70
  "dependencies": {
53
- "intentx-runtime": ">=0.2.2"
71
+ "intentx-runtime": "^0.2.4"
54
72
  },
73
+
55
74
  "devDependencies": {
56
75
  "@rollup/plugin-commonjs": "^25.0.0",
57
76
  "@rollup/plugin-node-resolve": "^15.2.3",
@@ -65,10 +84,5 @@
65
84
  "tslib": "^2.6.2",
66
85
  "typescript": "^5.3.3",
67
86
  "unplugin-solid": "^1.0.0"
68
- },
69
- "scripts": {
70
- "clean": "rimraf build",
71
- "build": "rollup -c",
72
- "cb": "npm run clean && npm run build"
73
87
  }
74
88
  }