@virentia/react 0.1.0 → 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/dist/index.d.cts CHANGED
@@ -26,7 +26,7 @@ interface ModelCache<Key, Props, Model extends object> {
26
26
  delete(key: Key, scope?: Scope): boolean;
27
27
  clear(scope?: Scope): void;
28
28
  }
29
- type UnitShape<Shape> = Shape extends readonly UnitLike[] ? { readonly [Key in keyof Shape]: UnitValue<Shape[Key]> } : Shape extends Record<string, UnitLike> ? { readonly [Key in keyof Shape]: UnitValue<Shape[Key]> } : never;
29
+ type UnitShape<Shape> = Shape extends readonly unknown[] ? { readonly [Key in keyof Shape]: UnitValue<Shape[Key]> } : Shape extends Record<string, unknown> ? { readonly [Key in keyof Shape]: UnitValue<Shape[Key]> } : never;
30
30
  type CacheOptions<Props, Key, Model extends object> = {
31
31
  readonly cache: ModelCache<Key, Props, Model>;
32
32
  readonly key: Key;
@@ -66,8 +66,11 @@ declare function useModel<Props, Model extends object>(factory: ModelFactory<Pro
66
66
  declare function useModel<Props, Key, Model extends object>(factory: ModelFactory<Props, Model, Key>, props: Props, options: CacheOptions<Props, Key, Model>): ReactiveModel<Model>;
67
67
  //#endregion
68
68
  //#region lib/use-unit.d.ts
69
- declare function useUnit<Unit extends UnitLike>(unit: Unit): UnitValue<Unit>;
70
- declare function useUnit<Shape extends readonly UnitLike[]>(shape: Shape): UnitShape<Shape>;
71
- declare function useUnit<Shape extends Record<string, UnitLike>>(shape: Shape): UnitShape<Shape>;
69
+ declare function useUnit<State>(unit: StoreWritable<State>): State;
70
+ declare function useUnit<State>(unit: Store<State>): State;
71
+ declare function useUnit<Payload>(unit: EventCallable<Payload>): UnitValue<EventCallable<Payload>>;
72
+ declare function useUnit<Params, Done, Fail>(unit: Effect<Params, Done, Fail>): UnitValue<Effect<Params, Done, Fail>>;
73
+ declare function useUnit<const Shape extends readonly UnitLike[]>(shape: Shape): UnitShape<Shape>;
74
+ declare function useUnit<const Shape extends Record<string, UnitLike>>(shape: Shape): UnitShape<Shape>;
72
75
  //#endregion
73
76
  export { type ModelCache, type ModelContext, type ModelFactory, type ModelInstance, type ReactiveModel, ScopeProvider, type UnitLike, type UnitValue, component, createModelCache, useModel, useProvidedScope, useUnit };
package/dist/index.d.mts CHANGED
@@ -26,7 +26,7 @@ interface ModelCache<Key, Props, Model extends object> {
26
26
  delete(key: Key, scope?: Scope): boolean;
27
27
  clear(scope?: Scope): void;
28
28
  }
29
- type UnitShape<Shape> = Shape extends readonly UnitLike[] ? { readonly [Key in keyof Shape]: UnitValue<Shape[Key]> } : Shape extends Record<string, UnitLike> ? { readonly [Key in keyof Shape]: UnitValue<Shape[Key]> } : never;
29
+ type UnitShape<Shape> = Shape extends readonly unknown[] ? { readonly [Key in keyof Shape]: UnitValue<Shape[Key]> } : Shape extends Record<string, unknown> ? { readonly [Key in keyof Shape]: UnitValue<Shape[Key]> } : never;
30
30
  type CacheOptions<Props, Key, Model extends object> = {
31
31
  readonly cache: ModelCache<Key, Props, Model>;
32
32
  readonly key: Key;
@@ -66,8 +66,11 @@ declare function useModel<Props, Model extends object>(factory: ModelFactory<Pro
66
66
  declare function useModel<Props, Key, Model extends object>(factory: ModelFactory<Props, Model, Key>, props: Props, options: CacheOptions<Props, Key, Model>): ReactiveModel<Model>;
67
67
  //#endregion
68
68
  //#region lib/use-unit.d.ts
69
- declare function useUnit<Unit extends UnitLike>(unit: Unit): UnitValue<Unit>;
70
- declare function useUnit<Shape extends readonly UnitLike[]>(shape: Shape): UnitShape<Shape>;
71
- declare function useUnit<Shape extends Record<string, UnitLike>>(shape: Shape): UnitShape<Shape>;
69
+ declare function useUnit<State>(unit: StoreWritable<State>): State;
70
+ declare function useUnit<State>(unit: Store<State>): State;
71
+ declare function useUnit<Payload>(unit: EventCallable<Payload>): UnitValue<EventCallable<Payload>>;
72
+ declare function useUnit<Params, Done, Fail>(unit: Effect<Params, Done, Fail>): UnitValue<Effect<Params, Done, Fail>>;
73
+ declare function useUnit<const Shape extends readonly UnitLike[]>(shape: Shape): UnitShape<Shape>;
74
+ declare function useUnit<const Shape extends Record<string, UnitLike>>(shape: Shape): UnitShape<Shape>;
72
75
  //#endregion
73
76
  export { type ModelCache, type ModelContext, type ModelFactory, type ModelInstance, type ReactiveModel, ScopeProvider, type UnitLike, type UnitValue, component, createModelCache, useModel, useProvidedScope, useUnit };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virentia/react",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://movpushmov.dev/virentia/react/",
@@ -32,16 +32,21 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
- "@virentia/core": "0.1.0"
35
+ "@virentia/core": "0.1.1"
36
36
  },
37
37
  "devDependencies": {
38
+ "@testing-library/react": "^16.3.0",
38
39
  "@types/react": "^19.2.7",
39
- "react": "^19.2.1"
40
+ "happy-dom": "^20.0.10",
41
+ "react": "^19.2.1",
42
+ "react-dom": "^19.2.1"
40
43
  },
41
44
  "peerDependencies": {
42
45
  "react": ">=18"
43
46
  },
44
47
  "scripts": {
45
- "build": "tsdown"
48
+ "build": "tsdown",
49
+ "test": "vitest run",
50
+ "test:watch": "vitest"
46
51
  }
47
52
  }