@evolu/react 5.0.4 → 5.0.5
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.ts +31 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -2
- package/package.json +6 -6
- package/src/index.ts +42 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,33 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from "@evolu/common-web";
|
|
1
|
+
export { parseMnemonic } from "@evolu/common-web";
|
|
3
2
|
export * from "@evolu/common/public";
|
|
3
|
+
/**
|
|
4
|
+
* Create Evolu for React.
|
|
5
|
+
*
|
|
6
|
+
* Tables with a name prefixed with `_` are local-only, which means they are
|
|
7
|
+
* never synced. It's useful for device-specific or temporal data.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import * as S from "@effect/schema/Schema";
|
|
11
|
+
* import { NonEmptyString1000, createEvolu, id } from "@evolu/react";
|
|
12
|
+
*
|
|
13
|
+
* const TodoId = id("Todo");
|
|
14
|
+
* type TodoId = S.Schema.To<typeof TodoId>;
|
|
15
|
+
*
|
|
16
|
+
* const TodoTable = table({
|
|
17
|
+
* id: TodoId,
|
|
18
|
+
* title: NonEmptyString1000,
|
|
19
|
+
* });
|
|
20
|
+
* type TodoTable = S.Schema.To<typeof TodoTable>;
|
|
21
|
+
*
|
|
22
|
+
* const Database = database({
|
|
23
|
+
* // _todo is local-only table
|
|
24
|
+
* _todo: TodoTable,
|
|
25
|
+
* todo: TodoTable,
|
|
26
|
+
* });
|
|
27
|
+
* type Database = S.Schema.To<typeof Database>;
|
|
28
|
+
*
|
|
29
|
+
* const evolu = createEvolu(Database);
|
|
30
|
+
*/
|
|
31
|
+
export declare const createEvolu: <From, To extends import("@evolu/common").DatabaseSchema>(schema: import("@effect/schema/Schema").Schema<To, From, never>, config?: Partial<import("@evolu/common").Config> | undefined) => import("@evolu/common").Evolu<To>;
|
|
32
|
+
export * from "@evolu/common-react";
|
|
4
33
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,cAAc,sBAAsB,CAAC;AAIrC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,WAAW,+NAEvB,CAAC;AAEF,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { FlushSync, makeCreateEvolu } from "@evolu/common";
|
|
2
|
+
import { EvoluWebLive } from "@evolu/common-web";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import { flushSync } from "react-dom";
|
|
5
|
+
export { parseMnemonic } from "@evolu/common-web";
|
|
3
6
|
export * from "@evolu/common/public";
|
|
7
|
+
const FlushSyncLive = Layer.succeed(FlushSync, flushSync);
|
|
8
|
+
/**
|
|
9
|
+
* Create Evolu for React.
|
|
10
|
+
*
|
|
11
|
+
* Tables with a name prefixed with `_` are local-only, which means they are
|
|
12
|
+
* never synced. It's useful for device-specific or temporal data.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* import * as S from "@effect/schema/Schema";
|
|
16
|
+
* import { NonEmptyString1000, createEvolu, id } from "@evolu/react";
|
|
17
|
+
*
|
|
18
|
+
* const TodoId = id("Todo");
|
|
19
|
+
* type TodoId = S.Schema.To<typeof TodoId>;
|
|
20
|
+
*
|
|
21
|
+
* const TodoTable = table({
|
|
22
|
+
* id: TodoId,
|
|
23
|
+
* title: NonEmptyString1000,
|
|
24
|
+
* });
|
|
25
|
+
* type TodoTable = S.Schema.To<typeof TodoTable>;
|
|
26
|
+
*
|
|
27
|
+
* const Database = database({
|
|
28
|
+
* // _todo is local-only table
|
|
29
|
+
* _todo: TodoTable,
|
|
30
|
+
* todo: TodoTable,
|
|
31
|
+
* });
|
|
32
|
+
* type Database = S.Schema.To<typeof Database>;
|
|
33
|
+
*
|
|
34
|
+
* const evolu = createEvolu(Database);
|
|
35
|
+
*/
|
|
36
|
+
export const createEvolu = makeCreateEvolu(EvoluWebLive.pipe(Layer.provide(FlushSyncLive)));
|
|
37
|
+
export * from "@evolu/common-react";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evolu/react",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.5",
|
|
4
4
|
"description": "Evolu for React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"evolu",
|
|
@@ -30,20 +30,20 @@
|
|
|
30
30
|
],
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/react-dom": "^18.2.19",
|
|
33
|
-
"eslint": "^8.
|
|
33
|
+
"eslint": "^8.57.0",
|
|
34
34
|
"react-dom": "^18.2.0",
|
|
35
35
|
"typescript": "^5.3.3",
|
|
36
36
|
"vitest": "^1.3.1",
|
|
37
|
-
"@evolu/common": "3.1.
|
|
37
|
+
"@evolu/common": "3.1.6",
|
|
38
38
|
"@evolu/common-react": "5.0.4",
|
|
39
|
-
"@evolu/common-web": "5.0.
|
|
39
|
+
"@evolu/common-web": "5.0.6",
|
|
40
40
|
"@evolu/tsconfig": "0.0.2",
|
|
41
41
|
"eslint-config-evolu": "1.0.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@evolu/common": "^3.1.
|
|
44
|
+
"@evolu/common": "^3.1.6",
|
|
45
45
|
"@evolu/common-react": "^5.0.4",
|
|
46
|
-
"@evolu/common-web": "^5.0.
|
|
46
|
+
"@evolu/common-web": "^5.0.6",
|
|
47
47
|
"@types/react-dom": "^18.2.7",
|
|
48
48
|
"react-dom": "^18.2.0"
|
|
49
49
|
},
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { FlushSync, makeCreateEvolu } from "@evolu/common";
|
|
2
|
+
import { EvoluWebLive } from "@evolu/common-web";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import { flushSync } from "react-dom";
|
|
5
|
+
|
|
6
|
+
export { parseMnemonic } from "@evolu/common-web";
|
|
3
7
|
export * from "@evolu/common/public";
|
|
8
|
+
|
|
9
|
+
const FlushSyncLive = Layer.succeed(FlushSync, flushSync);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Create Evolu for React.
|
|
13
|
+
*
|
|
14
|
+
* Tables with a name prefixed with `_` are local-only, which means they are
|
|
15
|
+
* never synced. It's useful for device-specific or temporal data.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* import * as S from "@effect/schema/Schema";
|
|
19
|
+
* import { NonEmptyString1000, createEvolu, id } from "@evolu/react";
|
|
20
|
+
*
|
|
21
|
+
* const TodoId = id("Todo");
|
|
22
|
+
* type TodoId = S.Schema.To<typeof TodoId>;
|
|
23
|
+
*
|
|
24
|
+
* const TodoTable = table({
|
|
25
|
+
* id: TodoId,
|
|
26
|
+
* title: NonEmptyString1000,
|
|
27
|
+
* });
|
|
28
|
+
* type TodoTable = S.Schema.To<typeof TodoTable>;
|
|
29
|
+
*
|
|
30
|
+
* const Database = database({
|
|
31
|
+
* // _todo is local-only table
|
|
32
|
+
* _todo: TodoTable,
|
|
33
|
+
* todo: TodoTable,
|
|
34
|
+
* });
|
|
35
|
+
* type Database = S.Schema.To<typeof Database>;
|
|
36
|
+
*
|
|
37
|
+
* const evolu = createEvolu(Database);
|
|
38
|
+
*/
|
|
39
|
+
export const createEvolu = makeCreateEvolu(
|
|
40
|
+
EvoluWebLive.pipe(Layer.provide(FlushSyncLive)),
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
export * from "@evolu/common-react";
|