@evolu/react 10.2.0 → 10.3.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.
@@ -1,3 +1,3 @@
1
- import { Evolu } from "@evolu/common/evolu";
1
+ import { Evolu } from "@evolu/common/local-first";
2
2
  export declare const EvoluContext: import("react").Context<Evolu<any> | null>;
3
3
  //# sourceMappingURL=EvoluContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EvoluContext.d.ts","sourceRoot":"","sources":["../src/EvoluContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,eAAO,MAAM,YAAY,4CAAyC,CAAC"}
1
+ {"version":3,"file":"EvoluContext.d.ts","sourceRoot":"","sources":["../src/EvoluContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAGlD,eAAO,MAAM,YAAY,4CAAyC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Evolu } from "@evolu/common/evolu";
1
+ import { Evolu } from "@evolu/common/local-first";
2
2
  import { ReactNode } from "react";
3
3
  export declare const EvoluProvider: ({ children, value, }: {
4
4
  readonly children?: ReactNode | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"EvoluProvider.d.ts","sourceRoot":"","sources":["../src/EvoluProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,eAAO,MAAM,aAAa,GAAI,sBAG3B;IACD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;CAC5B,KAAG,KAAK,CAAC,YAAqE,CAAC"}
1
+ {"version":3,"file":"EvoluProvider.d.ts","sourceRoot":"","sources":["../src/EvoluProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,eAAO,MAAM,aAAa,GAAI,sBAG3B;IACD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;CAC5B,KAAG,KAAK,CAAC,YAAqE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Evolu } from "@evolu/common/evolu";
1
+ import { Evolu } from "@evolu/common/local-first";
2
2
  /**
3
3
  * React Hook returning a generic instance of {@link Evolu}.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"useEvolu.d.ts","sourceRoot":"","sources":["../src/useEvolu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAK5C;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,QAAO,KAQ3B,CAAC"}
1
+ {"version":3,"file":"useEvolu.d.ts","sourceRoot":"","sources":["../src/useEvolu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAKlD;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,QAAO,KAQ3B,CAAC"}
@@ -1,22 +1,9 @@
1
1
  import { SyncOwner } from "@evolu/common";
2
2
  /**
3
- * React Hook for managing sync owner subscriptions.
3
+ * React Hook for Evolu `useOwner` method.
4
4
  *
5
- * When the component mounts, it registers the owner for syncing. When the
6
- * component unmounts or the owner changes, it automatically unregisters.
7
- *
8
- * ### Example
9
- *
10
- * ```tsx
11
- * import { useOwner } from "@evolu/react";
12
- *
13
- * function MyComponent({ shardOwner }: { shardOwner: SyncOwner | null }) {
14
- * useOwner(shardOwner);
15
- *
16
- * // Component will sync with shardOwner while mounted
17
- * return <div>Syncing with shard...</div>;
18
- * }
19
- * ```
5
+ * Using an owner means syncing it with its transports, or the transports
6
+ * defined in Evolu config if the owner has no transports defined.
20
7
  */
21
8
  export declare const useOwner: (owner: SyncOwner | null) => void;
22
9
  //# sourceMappingURL=useOwner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useOwner.d.ts","sourceRoot":"","sources":["../src/useOwner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI1C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,SAAS,GAAG,IAAI,KAAG,IAOlD,CAAC"}
1
+ {"version":3,"file":"useOwner.d.ts","sourceRoot":"","sources":["../src/useOwner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI1C;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,SAAS,GAAG,IAAI,KAAG,IAOlD,CAAC"}
package/dist/useOwner.js CHANGED
@@ -1,23 +1,10 @@
1
1
  import { useEffect } from "react";
2
2
  import { useEvolu } from "./useEvolu.js";
3
3
  /**
4
- * React Hook for managing sync owner subscriptions.
4
+ * React Hook for Evolu `useOwner` method.
5
5
  *
6
- * When the component mounts, it registers the owner for syncing. When the
7
- * component unmounts or the owner changes, it automatically unregisters.
8
- *
9
- * ### Example
10
- *
11
- * ```tsx
12
- * import { useOwner } from "@evolu/react";
13
- *
14
- * function MyComponent({ shardOwner }: { shardOwner: SyncOwner | null }) {
15
- * useOwner(shardOwner);
16
- *
17
- * // Component will sync with shardOwner while mounted
18
- * return <div>Syncing with shard...</div>;
19
- * }
20
- * ```
6
+ * Using an owner means syncing it with its transports, or the transports
7
+ * defined in Evolu config if the owner has no transports defined.
21
8
  */
22
9
  export const useOwner = (owner) => {
23
10
  const evolu = useEvolu();
@@ -1,4 +1,4 @@
1
- import { Queries, QueriesToQueryRows, QueriesToQueryRowsPromises, Row } from "@evolu/common/evolu";
1
+ import { Queries, QueriesToQueryRows, QueriesToQueryRowsPromises, Row } from "@evolu/common/local-first";
2
2
  /**
3
3
  * The same as {@link useQuery}, but for many queries.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"useQueries.d.ts","sourceRoot":"","sources":["../src/useQueries.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,0BAA0B,EAC1B,GAAG,EACJ,MAAM,qBAAqB,CAAC;AAO7B;;;;GAIG;AACH,eAAO,MAAM,UAAU,GACrB,CAAC,SAAS,GAAG,EACb,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,EACpB,EAAE,SAAS,OAAO,CAAC,CAAC,CAAC,EAErB,SAAS,CAAC,GAAG,CAAC,CAAC,EACf,UAAS,OAAO,CAAC;IACf,6DAA6D;IAC7D,QAAQ,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;IAEvB,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,EAAE,CACjB,GAAG,0BAA0B,CAAC,CAAC,CAAC,EAChC,GAAG,0BAA0B,CAAC,EAAE,CAAC,CAClC,CAAC;CACH,CAAM,KACN,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,EAAE,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAkBtD,CAAC"}
1
+ {"version":3,"file":"useQueries.d.ts","sourceRoot":"","sources":["../src/useQueries.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,0BAA0B,EAC1B,GAAG,EACJ,MAAM,2BAA2B,CAAC;AAOnC;;;;GAIG;AACH,eAAO,MAAM,UAAU,GACrB,CAAC,SAAS,GAAG,EACb,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,EACpB,EAAE,SAAS,OAAO,CAAC,CAAC,CAAC,EAErB,SAAS,CAAC,GAAG,CAAC,CAAC,EACf,UAAS,OAAO,CAAC;IACf,6DAA6D;IAC7D,QAAQ,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;IAEvB,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,EAAE,CACjB,GAAG,0BAA0B,CAAC,CAAC,CAAC,EAChC,GAAG,0BAA0B,CAAC,EAAE,CAAC,CAClC,CAAC;CACH,CAAM,KACN,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,EAAE,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAkBtD,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Query, QueryRows, Row } from "@evolu/common/evolu";
1
+ import { Query, QueryRows, Row } from "@evolu/common/local-first";
2
2
  /**
3
3
  * Load and subscribe to the Query, and return an object with `rows` and `row`
4
4
  * properties that are automatically updated when data changes.
@@ -1 +1 @@
1
- {"version":3,"file":"useQuery.d.ts","sourceRoot":"","sources":["../src/useQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAO5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,GAAG,EACpC,OAAO,KAAK,CAAC,CAAC,CAAC,EACf,UAAS,OAAO,CAAC;IACf,sCAAsC;IACtC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAEvB,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;CACzC,CAAM,KACN,SAAS,CAAC,CAAC,CAWb,CAAC"}
1
+ {"version":3,"file":"useQuery.d.ts","sourceRoot":"","sources":["../src/useQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAOlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,GAAG,EACpC,OAAO,KAAK,CAAC,CAAC,CAAC,EACf,UAAS,OAAO,CAAC;IACf,sCAAsC;IACtC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAEvB,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;CACzC,CAAM,KACN,SAAS,CAAC,CAAC,CAWb,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Query, QueryRows, Row } from "@evolu/common/evolu";
1
+ import { Query, QueryRows, Row } from "@evolu/common/local-first";
2
2
  /** Subscribe to {@link Query} {@link QueryRows} changes. */
3
3
  export declare const useQuerySubscription: <R extends Row>(query: Query<R>, options?: Partial<{
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"useQuerySubscription.d.ts","sourceRoot":"","sources":["../src/useQuerySubscription.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAa,MAAM,qBAAqB,CAAC;AAIvE,4DAA4D;AAC5D,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,GAAG,EAChD,OAAO,KAAK,CAAC,CAAC,CAAC,EACf,UAAS,OAAO,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB,CAAM,KACN,SAAS,CAAC,CAAC,CAsBb,CAAC"}
1
+ {"version":3,"file":"useQuerySubscription.d.ts","sourceRoot":"","sources":["../src/useQuerySubscription.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAa,MAAM,2BAA2B,CAAC;AAI7E,4DAA4D;AAC5D,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,GAAG,EAChD,OAAO,KAAK,CAAC,CAAC,CAAC,EACf,UAAS,OAAO,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB,CAAM,KACN,SAAS,CAAC,CAAC,CAsBb,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { constVoid } from "@evolu/common";
2
- import { emptyRows } from "@evolu/common/evolu";
2
+ import { emptyRows } from "@evolu/common/local-first";
3
3
  import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
4
4
  import { useEvolu } from "./useEvolu.js";
5
5
  /** Subscribe to {@link Query} {@link QueryRows} changes. */
@@ -1,4 +1,4 @@
1
- import { SyncState } from "@evolu/common/evolu";
1
+ import { SyncState } from "@evolu/common/local-first";
2
2
  /** Subscribe to {@link SyncState} changes. */
3
3
  export declare const useSyncState: () => SyncState;
4
4
  //# sourceMappingURL=useSyncState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSyncState.d.ts","sourceRoot":"","sources":["../src/useSyncState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,8CAA8C;AAC9C,eAAO,MAAM,YAAY,QAAO,SAQ/B,CAAC"}
1
+ {"version":3,"file":"useSyncState.d.ts","sourceRoot":"","sources":["../src/useSyncState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAGtD,8CAA8C;AAC9C,eAAO,MAAM,YAAY,QAAO,SAQ/B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evolu/react",
3
- "version": "10.2.0",
3
+ "version": "10.3.0",
4
4
  "description": "Evolu for React",
5
5
  "keywords": [
6
6
  "evolu",
@@ -36,11 +36,11 @@
36
36
  "shx": "^0.4.0",
37
37
  "typescript": "^5.9.2",
38
38
  "vitest": "^4.0.4",
39
- "@evolu/tsconfig": "0.0.2",
40
- "@evolu/common": "7.2.0"
39
+ "@evolu/common": "7.3.0",
40
+ "@evolu/tsconfig": "0.0.2"
41
41
  },
42
42
  "peerDependencies": {
43
- "@evolu/common": "^7.2.0",
43
+ "@evolu/common": "^7.3.0",
44
44
  "react": ">=19"
45
45
  },
46
46
  "publishConfig": {
@@ -1,4 +1,4 @@
1
- import { Evolu } from "@evolu/common/evolu";
1
+ import { Evolu } from "@evolu/common/local-first";
2
2
  import { createContext } from "react";
3
3
 
4
4
  export const EvoluContext = createContext<Evolu<any> | null>(null);
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { Evolu } from "@evolu/common/evolu";
3
+ import { Evolu } from "@evolu/common/local-first";
4
4
  import { ReactNode } from "react";
5
5
  import { EvoluContext } from "./EvoluContext.js";
6
6
 
package/src/useEvolu.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Evolu } from "@evolu/common/evolu";
1
+ import { Evolu } from "@evolu/common/local-first";
2
2
  import { useContext } from "react";
3
3
  import { EvoluContext } from "./EvoluContext.js";
4
4
  import type { createUseEvolu } from "./createUseEvolu.js";
package/src/useOwner.ts CHANGED
@@ -3,23 +3,10 @@ import { useEffect } from "react";
3
3
  import { useEvolu } from "./useEvolu.js";
4
4
 
5
5
  /**
6
- * React Hook for managing sync owner subscriptions.
6
+ * React Hook for Evolu `useOwner` method.
7
7
  *
8
- * When the component mounts, it registers the owner for syncing. When the
9
- * component unmounts or the owner changes, it automatically unregisters.
10
- *
11
- * ### Example
12
- *
13
- * ```tsx
14
- * import { useOwner } from "@evolu/react";
15
- *
16
- * function MyComponent({ shardOwner }: { shardOwner: SyncOwner | null }) {
17
- * useOwner(shardOwner);
18
- *
19
- * // Component will sync with shardOwner while mounted
20
- * return <div>Syncing with shard...</div>;
21
- * }
22
- * ```
8
+ * Using an owner means syncing it with its transports, or the transports
9
+ * defined in Evolu config if the owner has no transports defined.
23
10
  */
24
11
  export const useOwner = (owner: SyncOwner | null): void => {
25
12
  const evolu = useEvolu();
package/src/useQueries.ts CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  QueriesToQueryRows,
4
4
  QueriesToQueryRowsPromises,
5
5
  Row,
6
- } from "@evolu/common/evolu";
6
+ } from "@evolu/common/local-first";
7
7
  import { use, useRef } from "react";
8
8
  import { useEvolu } from "./useEvolu.js";
9
9
  import type { useQuery } from "./useQuery.js";
package/src/useQuery.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Query, QueryRows, Row } from "@evolu/common/evolu";
1
+ import { Query, QueryRows, Row } from "@evolu/common/local-first";
2
2
  import { use } from "react";
3
3
  import { useEvolu } from "./useEvolu.js";
4
4
  import type { useQueries } from "./useQueries.js";
@@ -1,5 +1,5 @@
1
1
  import { constVoid } from "@evolu/common";
2
- import { Query, QueryRows, Row, emptyRows } from "@evolu/common/evolu";
2
+ import { Query, QueryRows, Row, emptyRows } from "@evolu/common/local-first";
3
3
  import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
4
4
  import { useEvolu } from "./useEvolu.js";
5
5
 
@@ -1,4 +1,4 @@
1
- import { SyncState } from "@evolu/common/evolu";
1
+ import { SyncState } from "@evolu/common/local-first";
2
2
  import { useEvolu } from "./useEvolu.js";
3
3
 
4
4
  /** Subscribe to {@link SyncState} changes. */