@logixjs/react 0.1.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.
Files changed (42) hide show
  1. package/README.md +64 -0
  2. package/dist/Hooks.cjs +2194 -0
  3. package/dist/Hooks.d.cts +77 -0
  4. package/dist/Hooks.d.ts +77 -0
  5. package/dist/Hooks.js +27 -0
  6. package/dist/ModuleRef-wZSQ3Wwo.d.cts +73 -0
  7. package/dist/ModuleRef-wZSQ3Wwo.d.ts +73 -0
  8. package/dist/ModuleScope.cjs +2695 -0
  9. package/dist/ModuleScope.d.cts +62 -0
  10. package/dist/ModuleScope.d.ts +62 -0
  11. package/dist/ModuleScope.js +9 -0
  12. package/dist/Platform.cjs +60 -0
  13. package/dist/Platform.d.cts +6 -0
  14. package/dist/Platform.d.ts +6 -0
  15. package/dist/Platform.js +6 -0
  16. package/dist/ReactPlatform.cjs +2813 -0
  17. package/dist/ReactPlatform.d.cts +40 -0
  18. package/dist/ReactPlatform.d.ts +40 -0
  19. package/dist/ReactPlatform.js +11 -0
  20. package/dist/RuntimeProvider.cjs +1618 -0
  21. package/dist/RuntimeProvider.d.cts +66 -0
  22. package/dist/RuntimeProvider.d.ts +66 -0
  23. package/dist/RuntimeProvider.js +8 -0
  24. package/dist/chunk-2WFULYPJ.js +856 -0
  25. package/dist/chunk-4G7H66OY.js +54 -0
  26. package/dist/chunk-G5MRIFKK.js +95 -0
  27. package/dist/chunk-JXAJTWSZ.js +773 -0
  28. package/dist/chunk-PYWHL7TA.js +351 -0
  29. package/dist/chunk-UFFCJGSZ.js +981 -0
  30. package/dist/chunk-VFWWMK67.js +0 -0
  31. package/dist/chunk-ZANGOPUQ.js +34 -0
  32. package/dist/global.d.cjs +1 -0
  33. package/dist/global.d.d.cts +9 -0
  34. package/dist/global.d.d.ts +9 -0
  35. package/dist/global.d.js +0 -0
  36. package/dist/index.cjs +3118 -0
  37. package/dist/index.d.cts +10 -0
  38. package/dist/index.d.ts +10 -0
  39. package/dist/index.js +44 -0
  40. package/dist/useDispatch-BnzYVkRE.d.ts +81 -0
  41. package/dist/useDispatch-CnO5-66H.d.cts +81 -0
  42. package/package.json +58 -0
File without changes
@@ -0,0 +1,34 @@
1
+ // src/internal/platform/ReactPlatformLayer.ts
2
+ import { Effect, Layer, Ref } from "effect";
3
+ import { Platform } from "@logixjs/core";
4
+ var ReactPlatformImpl = class {
5
+ constructor(suspendRef, resumeRef, resetRef) {
6
+ this.suspendRef = suspendRef;
7
+ this.resumeRef = resumeRef;
8
+ this.resetRef = resetRef;
9
+ this.lifecycle = {
10
+ onSuspend: (eff) => Ref.update(this.suspendRef, (list) => [...list, eff]).pipe(Effect.asVoid),
11
+ onResume: (eff) => Ref.update(this.resumeRef, (list) => [...list, eff]).pipe(Effect.asVoid),
12
+ onReset: (eff) => Ref.update(this.resetRef, (list) => [...list, eff]).pipe(Effect.asVoid)
13
+ };
14
+ // The emit* methods are not part of the official Logic.Platform interface; they are for host/test use only.
15
+ // After retrieving the instance via `Effect.service(Logic.Platform)`, call them via `any`.
16
+ this.emitSuspend = () => Ref.get(this.suspendRef).pipe(Effect.flatMap((effects) => Effect.forEach(effects, (eff) => eff, { discard: true })));
17
+ this.emitResume = () => Ref.get(this.resumeRef).pipe(Effect.flatMap((effects) => Effect.forEach(effects, (eff) => eff, { discard: true })));
18
+ this.emitReset = () => Ref.get(this.resetRef).pipe(Effect.flatMap((effects) => Effect.forEach(effects, (eff) => eff, { discard: true })));
19
+ }
20
+ };
21
+ var makeReactPlatform = Effect.gen(function* () {
22
+ const suspendRef = yield* Ref.make([]);
23
+ const resumeRef = yield* Ref.make([]);
24
+ const resetRef = yield* Ref.make([]);
25
+ return new ReactPlatformImpl(suspendRef, resumeRef, resetRef);
26
+ });
27
+ var ReactPlatformLayer = Layer.scoped(
28
+ Platform.tag,
29
+ makeReactPlatform
30
+ );
31
+
32
+ export {
33
+ ReactPlatformLayer
34
+ };
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,9 @@
1
+ declare module 'use-sync-external-store/shim/with-selector.js' {
2
+ export function useSyncExternalStoreWithSelector<Snapshot, Selection>(
3
+ subscribe: (onStoreChange: () => void) => () => void,
4
+ getSnapshot: () => Snapshot,
5
+ getServerSnapshot: undefined | null | (() => Snapshot),
6
+ selector: (snapshot: Snapshot) => Selection,
7
+ isEqual?: (a: Selection, b: Selection) => boolean,
8
+ ): Selection
9
+ }
@@ -0,0 +1,9 @@
1
+ declare module 'use-sync-external-store/shim/with-selector.js' {
2
+ export function useSyncExternalStoreWithSelector<Snapshot, Selection>(
3
+ subscribe: (onStoreChange: () => void) => () => void,
4
+ getSnapshot: () => Snapshot,
5
+ getServerSnapshot: undefined | null | (() => Snapshot),
6
+ selector: (snapshot: Snapshot) => Selection,
7
+ isEqual?: (a: Selection, b: Selection) => boolean,
8
+ ): Selection
9
+ }
File without changes