@shivaedev/effect-react 0.2.0 → 0.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.1 - 2026-10-05
4
+
5
+ ### Changed
6
+
7
+ - Delegate the existing `resume-signal.ts` entry to the shared browser-safe implementation in effect-contract. Install that package as a runtime dependency so existing imports keep working; signal types and behavior remain compatible. Work Board can import the shared native implementation without React peers.
8
+
3
9
  ## 0.2.0 - 2026-10-04
4
10
 
5
11
  ### Changed
@@ -1,17 +1,6 @@
1
- import * as Atom from "effect/unstable/reactivity/Atom";
2
- export type ResumeSource = (resume: () => void) => () => void;
3
- type ResumeEvent = "online" | "visibilitychange";
4
- export interface ResumeWindow {
5
- readonly addEventListener: (type: ResumeEvent, listener: () => void) => void;
6
- readonly document: {
7
- readonly visibilityState: string;
8
- };
9
- readonly removeEventListener: (type: ResumeEvent, listener: () => void) => void;
10
- }
11
- export interface ResumeOptions {
12
- readonly native?: ResumeSource;
13
- readonly window?: ResumeWindow;
14
- }
15
- export declare const resumeSignal: ({ window, native }: ResumeOptions) => Atom.Atom<number>;
16
- export {};
1
+ import { type ResumeOptions as ContractOptions, type ResumeSource as ContractSource, type ResumeWindow as ContractWindow } from "@shivaedev/effect-contract/resume.ts";
2
+ export type ResumeSource = ContractSource;
3
+ export type ResumeWindow = ContractWindow;
4
+ export type ResumeOptions = ContractOptions;
5
+ export declare function resumeSignal(options: ResumeOptions): import("effect/unstable/reactivity/Atom").Atom<number>;
17
6
  //# sourceMappingURL=resume-signal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resume-signal.d.ts","sourceRoot":"","sources":["../src/resume-signal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iCAAiC,CAAC;AAExD,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;AAE9D,KAAK,WAAW,GAAG,QAAQ,GAAG,kBAAkB,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,gBAAgB,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAC7E,QAAQ,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,QAAQ,CAAC,mBAAmB,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CAChF;AAED,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;CAC/B;AAcD,eAAO,MAAM,YAAY,GAAI,oBAAoB,aAAa,KAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAWhF,CAAC"}
1
+ {"version":3,"file":"resume-signal.d.ts","sourceRoot":"","sources":["../src/resume-signal.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,aAAa,IAAI,eAAe,EACrC,KAAK,YAAY,IAAI,cAAc,EACnC,KAAK,YAAY,IAAI,cAAc,EAEnC,MAAM,sCAAsC,CAAC;AAE9C,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC;AAC1C,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC;AAC1C,MAAM,MAAM,aAAa,GAAG,eAAe,CAAC;AAC5C,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,0DAElD"}
@@ -1,23 +1,5 @@
1
- import * as Atom from "effect/unstable/reactivity/Atom";
2
- const whileVisible = (target, type) => (resume) => {
3
- const visible = () => {
4
- if (target.document.visibilityState === "visible") {
5
- resume();
6
- }
7
- };
8
- target.addEventListener(type, visible);
9
- return () => target.removeEventListener(type, visible);
10
- };
11
- export const resumeSignal = ({ window, native }) => {
12
- const browser = window === undefined ? [] : [whileVisible(window, "visibilitychange"), whileVisible(window, "online")];
13
- const sources = native === undefined ? browser : [...browser, native];
14
- return Atom.readable((get) => {
15
- let count = 0;
16
- const resume = () => get.setSelf(++count);
17
- for (const source of sources) {
18
- get.addFinalizer(source(resume));
19
- }
20
- return count;
21
- });
22
- };
1
+ import { resumeSignal as contractResumeSignal, } from "@shivaedev/effect-contract/resume.ts";
2
+ export function resumeSignal(options) {
3
+ return contractResumeSignal(options);
4
+ }
23
5
  //# sourceMappingURL=resume-signal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resume-signal.js","sourceRoot":"","sources":["../src/resume-signal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iCAAiC,CAAC;AAiBxD,MAAM,YAAY,GACjB,CAAC,MAAoB,EAAE,IAAiB,EAAgB,EAAE,CAC1D,CAAC,MAAM,EAAE,EAAE;IACV,MAAM,OAAO,GAAG,GAAG,EAAE;QACpB,IAAI,MAAM,CAAC,QAAQ,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YACnD,MAAM,EAAE,CAAC;QACV,CAAC;IACF,CAAC,CAAC;IACF,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACvC,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,EAAiB,EAAqB,EAAE;IACpF,MAAM,OAAO,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAAE,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IACvH,MAAM,OAAO,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,CAAC,CAAC;IACtE,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,EAAE;QAC5B,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;QAC1C,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC9B,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QAClC,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"resume-signal.js","sourceRoot":"","sources":["../src/resume-signal.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,YAAY,IAAI,oBAAoB,GACpC,MAAM,sCAAsC,CAAC;AAK9C,MAAM,UAAU,YAAY,CAAC,OAAsB;IAClD,OAAO,oBAAoB,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shivaedev/effect-react",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "React query, action, editor and session hooks for native Effect atoms",
5
5
  "homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/effect-react#readme",
6
6
  "bugs": {
@@ -15,7 +15,7 @@
15
15
  "sideEffects": false,
16
16
  "type": "module",
17
17
  "imports": {
18
- "#test/*": "./test/*",
18
+ "#test/*": "./src/test-support/*",
19
19
  "#*.ts": {
20
20
  "source": "./src/*.ts",
21
21
  "types": "./dist/*.d.ts",
@@ -34,17 +34,24 @@
34
34
  "files": [
35
35
  "dist",
36
36
  "src",
37
+ "!src/**/*.test.ts",
38
+ "!src/**/*.test.tsx",
39
+ "!src/**/*.spec.ts",
40
+ "!src/**/*.spec.tsx",
41
+ "!src/**/test-support",
37
42
  "CHANGELOG.md",
38
43
  "README.md"
39
44
  ],
45
+ "dependencies": {
46
+ "@shivaedev/effect-contract": "0.4.0"
47
+ },
40
48
  "devDependencies": {
41
49
  "@effect/atom-react": "4.0.0-rc.112",
42
50
  "@effect/sql-sqlite-node": "4.0.0-rc.112",
43
- "@shivaedev/effect-contract": "0.3.0",
44
51
  "@shivaedev/effect-form": "0.2.0",
45
52
  "@shivaedev/effect-service": "0.2.0",
46
53
  "@shivaedev/effect-sql": "0.2.0",
47
- "@shivaedev/quality": "0.9.0",
54
+ "@shivaedev/quality": "0.15.0",
48
55
  "@types/node": "24.10.1",
49
56
  "@types/react": "19.2.18",
50
57
  "@types/react-dom": "19.2.4",
@@ -54,7 +61,7 @@
54
61
  "react": "19.2.8",
55
62
  "react-dom": "19.2.8",
56
63
  "typescript": "npm:@typescript/typescript6@6.0.2",
57
- "vitest": "4.1.9"
64
+ "vitest": "4.1.11"
58
65
  },
59
66
  "peerDependencies": {
60
67
  "@effect/atom-react": "4.0.0-rc.112",
@@ -1,41 +1,13 @@
1
- import * as Atom from "effect/unstable/reactivity/Atom";
2
-
3
- export type ResumeSource = (resume: () => void) => () => void;
4
-
5
- type ResumeEvent = "online" | "visibilitychange";
6
-
7
- export interface ResumeWindow {
8
- readonly addEventListener: (type: ResumeEvent, listener: () => void) => void;
9
- readonly document: { readonly visibilityState: string };
10
- readonly removeEventListener: (type: ResumeEvent, listener: () => void) => void;
1
+ import {
2
+ type ResumeOptions as ContractOptions,
3
+ type ResumeSource as ContractSource,
4
+ type ResumeWindow as ContractWindow,
5
+ resumeSignal as contractResumeSignal,
6
+ } from "@shivaedev/effect-contract/resume.ts";
7
+
8
+ export type ResumeSource = ContractSource;
9
+ export type ResumeWindow = ContractWindow;
10
+ export type ResumeOptions = ContractOptions;
11
+ export function resumeSignal(options: ResumeOptions) {
12
+ return contractResumeSignal(options);
11
13
  }
12
-
13
- export interface ResumeOptions {
14
- readonly native?: ResumeSource;
15
- readonly window?: ResumeWindow;
16
- }
17
-
18
- const whileVisible =
19
- (target: ResumeWindow, type: ResumeEvent): ResumeSource =>
20
- (resume) => {
21
- const visible = () => {
22
- if (target.document.visibilityState === "visible") {
23
- resume();
24
- }
25
- };
26
- target.addEventListener(type, visible);
27
- return () => target.removeEventListener(type, visible);
28
- };
29
-
30
- export const resumeSignal = ({ window, native }: ResumeOptions): Atom.Atom<number> => {
31
- const browser = window === undefined ? [] : [whileVisible(window, "visibilitychange"), whileVisible(window, "online")];
32
- const sources = native === undefined ? browser : [...browser, native];
33
- return Atom.readable((get) => {
34
- let count = 0;
35
- const resume = () => get.setSelf(++count);
36
- for (const source of sources) {
37
- get.addFinalizer(source(resume));
38
- }
39
- return count;
40
- });
41
- };