@evolu/react 2.0.6 → 2.0.8

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
@@ -1,3 +1,15 @@
1
1
  # Evolu for React
2
2
 
3
3
  [Evolu](https://github.com/evoluhq/evolu) for [React](https://react.dev).
4
+
5
+ ## Documentation
6
+
7
+ For detailed information and usage examples, please visit [evolu.dev](https://www.evolu.dev).
8
+
9
+ ## Community
10
+
11
+ The Evolu community is on [GitHub Discussions](https://github.com/evoluhq/evolu/discussions), where you can ask questions and voice ideas.
12
+
13
+ To chat with other community members, you can join the [Evolu Discord](https://discord.gg/2J8yyyyxtZ).
14
+
15
+ [![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/evoluhq.svg?style=social&label=Follow%20%40evoluhq)](https://twitter.com/evoluhq)
package/dist/index.d.ts CHANGED
@@ -1,4 +1,30 @@
1
- export { Id, NonEmptyString1000, Owner, PositiveInt, SqliteBoolean, SqliteDate, String, String1000, canUseDom, cast, id, jsonArrayFrom, jsonObjectFrom, } from "@evolu/common";
2
- export type { EvoluError, Mnemonic, OwnerId, SyncState } from "@evolu/common";
3
- export declare const create: <From, To extends import("@evolu/common").Schema>(schema: import("@effect/schema/Schema").Schema<From, To>, config?: Partial<import("@evolu/common").Config> | undefined) => import("@evolu/common-react").ReactHooks<To>;
1
+ export { parseMnemonic } from "@evolu/common-web";
2
+ export * from "@evolu/common/public";
3
+ /**
4
+ * Create Evolu for React.
5
+ *
6
+ * ### Example
7
+ *
8
+ * ```ts
9
+ * import * as S from "@effect/schema/Schema";
10
+ * import * as Evolu from "@evolu/react";
11
+ *
12
+ * const TodoId = Evolu.id("Todo");
13
+ * type TodoId = S.Schema.To<typeof TodoId>;
14
+ *
15
+ * const TodoTable = S.struct({
16
+ * id: TodoId,
17
+ * title: Evolu.NonEmptyString1000,
18
+ * });
19
+ * type TodoTable = S.Schema.To<typeof TodoTable>;
20
+ *
21
+ * const Database = S.struct({
22
+ * todo: TodoTable,
23
+ * });
24
+ *
25
+ * const { useEvolu, useEvoluError, useQuery, useOwner } =
26
+ * Evolu.create(Database);
27
+ * ```
28
+ */
29
+ export declare const create: <From, To extends import("@evolu/common").Schema>(schema: import("@effect/schema/Schema").Schema<From, To>, config?: Partial<import("@evolu/common").Config> | undefined) => import("@evolu/common-react").EvoluReact<To>;
4
30
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,EAAE,EACF,kBAAkB,EAClB,KAAK,EACL,WAAW,EACX,aAAa,EACb,UAAU,EACV,MAAM,EACN,UAAU,EACV,SAAS,EACT,IAAI,EACJ,EAAE,EACF,aAAa,EACb,cAAc,GACf,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE9E,eAAO,MAAM,MAAM,2NAOlB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,cAAc,sBAAsB,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,MAAM,2NAGlB,CAAC"}
package/dist/index.js CHANGED
@@ -1,8 +1,32 @@
1
- import { NanoIdLive } from "@evolu/common";
2
- import { makeReactHooksForPlatform } from "@evolu/common-react";
3
- import { AppStateLive, Bip39Live, DbWorkerLive, FlushSyncLive, PlatformLive, } from "@evolu/common-web";
1
+ import { EvoluReactLive, makeCreateEvoluReact } from "@evolu/common-react";
2
+ import { EvoluWebLive } from "@evolu/common-web";
4
3
  import { Layer } from "effect";
5
- // Public API. It must be copy-pasted to all Evolu UI libs because re-exporting
6
- // from @evolu/common/Public is not working for some reason.
7
- export { Id, NonEmptyString1000, Owner, PositiveInt, SqliteBoolean, SqliteDate, String, String1000, canUseDom, cast, id, jsonArrayFrom, jsonObjectFrom, } from "@evolu/common";
8
- export const create = makeReactHooksForPlatform(Layer.use(DbWorkerLive, PlatformLive), Layer.use(AppStateLive, PlatformLive), PlatformLive, Bip39Live, NanoIdLive, FlushSyncLive);
4
+ export { parseMnemonic } from "@evolu/common-web";
5
+ export * from "@evolu/common/public";
6
+ /**
7
+ * Create Evolu for React.
8
+ *
9
+ * ### Example
10
+ *
11
+ * ```ts
12
+ * import * as S from "@effect/schema/Schema";
13
+ * import * as Evolu from "@evolu/react";
14
+ *
15
+ * const TodoId = Evolu.id("Todo");
16
+ * type TodoId = S.Schema.To<typeof TodoId>;
17
+ *
18
+ * const TodoTable = S.struct({
19
+ * id: TodoId,
20
+ * title: Evolu.NonEmptyString1000,
21
+ * });
22
+ * type TodoTable = S.Schema.To<typeof TodoTable>;
23
+ *
24
+ * const Database = S.struct({
25
+ * todo: TodoTable,
26
+ * });
27
+ *
28
+ * const { useEvolu, useEvoluError, useQuery, useOwner } =
29
+ * Evolu.create(Database);
30
+ * ```
31
+ */
32
+ export const create = EvoluReactLive.pipe(Layer.provide(EvoluWebLive), makeCreateEvoluReact);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evolu/react",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "description": "Evolu for React",
5
5
  "keywords": [
6
6
  "evolu",
@@ -29,21 +29,21 @@
29
29
  "README.md"
30
30
  ],
31
31
  "devDependencies": {
32
- "@types/react-dom": "^18.2.14",
33
- "eslint": "^8.52.0",
32
+ "@types/react-dom": "^18.2.17",
33
+ "eslint": "^8.54.0",
34
34
  "react-dom": "^18.2.0",
35
- "typescript": "^5.2.2",
35
+ "typescript": "^5.3.2",
36
36
  "vitest": "^0.34.6",
37
- "@evolu/common": "1.0.13",
38
- "@evolu/common-react": "1.0.7",
39
- "@evolu/common-web": "1.1.5",
37
+ "@evolu/common": "2.0.5",
38
+ "@evolu/common-react": "2.0.2",
39
+ "@evolu/common-web": "2.0.1",
40
40
  "@evolu/tsconfig": "0.0.2",
41
- "eslint-config-evolu": "0.0.2"
41
+ "eslint-config-evolu": "1.0.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "@evolu/common": "^1.0.13",
45
- "@evolu/common-react": "^1.0.7",
46
- "@evolu/common-web": "^1.1.5",
44
+ "@evolu/common": "^2.0.5",
45
+ "@evolu/common-react": "^2.0.2",
46
+ "@evolu/common-web": "^2.0.1",
47
47
  "@types/react-dom": "^18.2.7",
48
48
  "react-dom": "^18.2.0"
49
49
  },
@@ -53,12 +53,12 @@
53
53
  "engines": {
54
54
  "node": ">=18.16"
55
55
  },
56
- "sideEffects": false,
56
+ "sideEffects": [],
57
57
  "scripts": {
58
58
  "dev": "tsc --watch",
59
59
  "build": "rm -rf dist && tsc",
60
- "lint": "TIMING=1 eslint src --ext .ts,.tsx",
61
- "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
60
+ "lint": "eslint src --ext .ts,.tsx",
61
+ "clean": "rm -rf .turbo node_modules dist",
62
62
  "format": "prettier --write \"src/*.{ts,tsx,md}\""
63
63
  }
64
64
  }
package/src/index.ts CHANGED
@@ -1,39 +1,37 @@
1
- import { NanoIdLive } from "@evolu/common";
2
- import { makeReactHooksForPlatform } from "@evolu/common-react";
3
- import {
4
- AppStateLive,
5
- Bip39Live,
6
- DbWorkerLive,
7
- FlushSyncLive,
8
- PlatformLive,
9
- } from "@evolu/common-web";
1
+ import { EvoluReactLive, makeCreateEvoluReact } from "@evolu/common-react";
2
+ import { EvoluWebLive } from "@evolu/common-web";
10
3
  import { Layer } from "effect";
11
4
 
12
- // Public API. It must be copy-pasted to all Evolu UI libs because re-exporting
13
- // from @evolu/common/Public is not working for some reason.
14
- export {
15
- Id,
16
- NonEmptyString1000,
17
- Owner,
18
- PositiveInt,
19
- SqliteBoolean,
20
- SqliteDate,
21
- String,
22
- String1000,
23
- canUseDom,
24
- cast,
25
- id,
26
- jsonArrayFrom,
27
- jsonObjectFrom,
28
- } from "@evolu/common";
29
- // Re-exporting a type when 'isolatedModules' is enabled requires using 'export type'.
30
- export type { EvoluError, Mnemonic, OwnerId, SyncState } from "@evolu/common";
5
+ export { parseMnemonic } from "@evolu/common-web";
6
+ export * from "@evolu/common/public";
31
7
 
32
- export const create = makeReactHooksForPlatform(
33
- Layer.use(DbWorkerLive, PlatformLive),
34
- Layer.use(AppStateLive, PlatformLive),
35
- PlatformLive,
36
- Bip39Live,
37
- NanoIdLive,
38
- FlushSyncLive,
8
+ /**
9
+ * Create Evolu for React.
10
+ *
11
+ * ### Example
12
+ *
13
+ * ```ts
14
+ * import * as S from "@effect/schema/Schema";
15
+ * import * as Evolu from "@evolu/react";
16
+ *
17
+ * const TodoId = Evolu.id("Todo");
18
+ * type TodoId = S.Schema.To<typeof TodoId>;
19
+ *
20
+ * const TodoTable = S.struct({
21
+ * id: TodoId,
22
+ * title: Evolu.NonEmptyString1000,
23
+ * });
24
+ * type TodoTable = S.Schema.To<typeof TodoTable>;
25
+ *
26
+ * const Database = S.struct({
27
+ * todo: TodoTable,
28
+ * });
29
+ *
30
+ * const { useEvolu, useEvoluError, useQuery, useOwner } =
31
+ * Evolu.create(Database);
32
+ * ```
33
+ */
34
+ export const create = EvoluReactLive.pipe(
35
+ Layer.provide(EvoluWebLive),
36
+ makeCreateEvoluReact,
39
37
  );