@livestore/react 0.0.0-snapshot-8d3edf87cb1e88c7b67c5f3ea9d0b307253c33df
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 +1 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/LiveStoreContext.d.ts +7 -0
- package/dist/LiveStoreContext.d.ts.map +1 -0
- package/dist/LiveStoreContext.js +13 -0
- package/dist/LiveStoreContext.js.map +1 -0
- package/dist/LiveStoreProvider.d.ts +49 -0
- package/dist/LiveStoreProvider.d.ts.map +1 -0
- package/dist/LiveStoreProvider.js +168 -0
- package/dist/LiveStoreProvider.js.map +1 -0
- package/dist/LiveStoreProvider.test.d.ts +2 -0
- package/dist/LiveStoreProvider.test.d.ts.map +1 -0
- package/dist/LiveStoreProvider.test.js +62 -0
- package/dist/LiveStoreProvider.test.js.map +1 -0
- package/dist/__tests__/fixture.d.ts +567 -0
- package/dist/__tests__/fixture.d.ts.map +1 -0
- package/dist/__tests__/fixture.js +61 -0
- package/dist/__tests__/fixture.js.map +1 -0
- package/dist/experimental/components/LiveList.d.ts +21 -0
- package/dist/experimental/components/LiveList.d.ts.map +1 -0
- package/dist/experimental/components/LiveList.js +31 -0
- package/dist/experimental/components/LiveList.js.map +1 -0
- package/dist/experimental/mod.d.ts +2 -0
- package/dist/experimental/mod.d.ts.map +1 -0
- package/dist/experimental/mod.js +2 -0
- package/dist/experimental/mod.js.map +1 -0
- package/dist/mod.d.ts +8 -0
- package/dist/mod.d.ts.map +1 -0
- package/dist/mod.js +8 -0
- package/dist/mod.js.map +1 -0
- package/dist/useAtom.d.ts +10 -0
- package/dist/useAtom.d.ts.map +1 -0
- package/dist/useAtom.js +37 -0
- package/dist/useAtom.js.map +1 -0
- package/dist/useQuery.d.ts +9 -0
- package/dist/useQuery.d.ts.map +1 -0
- package/dist/useQuery.js +88 -0
- package/dist/useQuery.js.map +1 -0
- package/dist/useQuery.test.d.ts +2 -0
- package/dist/useQuery.test.d.ts.map +1 -0
- package/dist/useQuery.test.js +51 -0
- package/dist/useQuery.test.js.map +1 -0
- package/dist/useRow.d.ts +46 -0
- package/dist/useRow.d.ts.map +1 -0
- package/dist/useRow.js +96 -0
- package/dist/useRow.js.map +1 -0
- package/dist/useRow.test.d.ts +2 -0
- package/dist/useRow.test.d.ts.map +1 -0
- package/dist/useRow.test.js +212 -0
- package/dist/useRow.test.js.map +1 -0
- package/dist/useTemporaryQuery.d.ts +22 -0
- package/dist/useTemporaryQuery.d.ts.map +1 -0
- package/dist/useTemporaryQuery.js +75 -0
- package/dist/useTemporaryQuery.js.map +1 -0
- package/dist/useTemporaryQuery.test.d.ts +2 -0
- package/dist/useTemporaryQuery.test.d.ts.map +1 -0
- package/dist/useTemporaryQuery.test.js +59 -0
- package/dist/useTemporaryQuery.test.js.map +1 -0
- package/dist/utils/stack-info.d.ts +4 -0
- package/dist/utils/stack-info.d.ts.map +1 -0
- package/dist/utils/stack-info.js +11 -0
- package/dist/utils/stack-info.js.map +1 -0
- package/dist/utils/useStateRefWithReactiveInput.d.ts +13 -0
- package/dist/utils/useStateRefWithReactiveInput.d.ts.map +1 -0
- package/dist/utils/useStateRefWithReactiveInput.js +38 -0
- package/dist/utils/useStateRefWithReactiveInput.js.map +1 -0
- package/package.json +54 -0
- package/src/LiveStoreContext.ts +19 -0
- package/src/LiveStoreProvider.test.tsx +109 -0
- package/src/LiveStoreProvider.tsx +295 -0
- package/src/__snapshots__/useRow.test.tsx.snap +359 -0
- package/src/__tests__/fixture.tsx +119 -0
- package/src/ambient.d.ts +2 -0
- package/src/experimental/components/LiveList.tsx +84 -0
- package/src/experimental/mod.ts +1 -0
- package/src/mod.ts +13 -0
- package/src/useAtom.ts +55 -0
- package/src/useQuery.test.tsx +82 -0
- package/src/useQuery.ts +122 -0
- package/src/useRow.test.tsx +346 -0
- package/src/useRow.ts +182 -0
- package/src/useTemporaryQuery.test.tsx +98 -0
- package/src/useTemporaryQuery.ts +131 -0
- package/src/utils/stack-info.ts +13 -0
- package/src/utils/useStateRefWithReactiveInput.ts +51 -0
- package/tsconfig.json +20 -0
- package/vitest.config.js +17 -0
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
import { DbSchema } from '@livestore/common/schema';
|
|
2
|
+
import { Effect } from '@livestore/utils/effect';
|
|
3
|
+
import type * as otel from '@opentelemetry/api';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
export type Todo = {
|
|
6
|
+
id: string;
|
|
7
|
+
text: string;
|
|
8
|
+
completed: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type Filter = 'all' | 'active' | 'completed';
|
|
11
|
+
export type AppState = {
|
|
12
|
+
newTodoText: string;
|
|
13
|
+
filter: Filter;
|
|
14
|
+
};
|
|
15
|
+
export declare const todos: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"todos", {
|
|
16
|
+
id: {
|
|
17
|
+
columnType: "text";
|
|
18
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
19
|
+
default: import("effect/Option").None<never>;
|
|
20
|
+
nullable: false;
|
|
21
|
+
primaryKey: true;
|
|
22
|
+
};
|
|
23
|
+
text: {
|
|
24
|
+
columnType: "text";
|
|
25
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
26
|
+
default: import("effect/Option").Some<"">;
|
|
27
|
+
nullable: false;
|
|
28
|
+
primaryKey: false;
|
|
29
|
+
};
|
|
30
|
+
completed: {
|
|
31
|
+
columnType: "integer";
|
|
32
|
+
schema: import("effect/Schema").Schema<boolean, number, never>;
|
|
33
|
+
default: import("effect/Option").Some<false>;
|
|
34
|
+
nullable: false;
|
|
35
|
+
primaryKey: false;
|
|
36
|
+
};
|
|
37
|
+
}>, false, {
|
|
38
|
+
isSingleton: false;
|
|
39
|
+
disableAutomaticIdColumn: false;
|
|
40
|
+
deriveMutations: {
|
|
41
|
+
enabled: true;
|
|
42
|
+
localOnly: boolean;
|
|
43
|
+
};
|
|
44
|
+
isSingleColumn: false;
|
|
45
|
+
}, import("effect/Schema").Schema<{
|
|
46
|
+
readonly id: string;
|
|
47
|
+
readonly text: string;
|
|
48
|
+
readonly completed: boolean;
|
|
49
|
+
}, {
|
|
50
|
+
readonly id: string;
|
|
51
|
+
readonly text: string;
|
|
52
|
+
readonly completed: number;
|
|
53
|
+
}, never>>;
|
|
54
|
+
export declare const app: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"app", {
|
|
55
|
+
id: {
|
|
56
|
+
columnType: "text";
|
|
57
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
58
|
+
default: import("effect/Option").None<never>;
|
|
59
|
+
nullable: false;
|
|
60
|
+
primaryKey: true;
|
|
61
|
+
};
|
|
62
|
+
newTodoText: {
|
|
63
|
+
columnType: "text";
|
|
64
|
+
schema: import("effect/Schema").Schema<string | null, string | null, never>;
|
|
65
|
+
default: import("effect/Option").Some<"">;
|
|
66
|
+
nullable: true;
|
|
67
|
+
primaryKey: false;
|
|
68
|
+
};
|
|
69
|
+
filter: {
|
|
70
|
+
columnType: "text";
|
|
71
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
72
|
+
default: import("effect/Option").Some<"all">;
|
|
73
|
+
nullable: false;
|
|
74
|
+
primaryKey: false;
|
|
75
|
+
};
|
|
76
|
+
}>, false, {
|
|
77
|
+
isSingleton: false;
|
|
78
|
+
disableAutomaticIdColumn: false;
|
|
79
|
+
deriveMutations: never;
|
|
80
|
+
isSingleColumn: false;
|
|
81
|
+
}, import("effect/Schema").Schema<{
|
|
82
|
+
readonly id: string;
|
|
83
|
+
readonly newTodoText: string | null;
|
|
84
|
+
readonly filter: string;
|
|
85
|
+
}, {
|
|
86
|
+
readonly id: string;
|
|
87
|
+
readonly newTodoText: string | null;
|
|
88
|
+
readonly filter: string;
|
|
89
|
+
}, never>>;
|
|
90
|
+
export declare const AppComponentSchema: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"UserInfo", {
|
|
91
|
+
username: {
|
|
92
|
+
columnType: "text";
|
|
93
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
94
|
+
default: import("effect/Option").Some<"">;
|
|
95
|
+
nullable: false;
|
|
96
|
+
primaryKey: false;
|
|
97
|
+
};
|
|
98
|
+
text: {
|
|
99
|
+
columnType: "text";
|
|
100
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
101
|
+
default: import("effect/Option").Some<"">;
|
|
102
|
+
nullable: false;
|
|
103
|
+
primaryKey: false;
|
|
104
|
+
};
|
|
105
|
+
id: DbSchema.SqliteDsl.ColumnDefinition<string, string>;
|
|
106
|
+
}>, false, {
|
|
107
|
+
isSingleton: false;
|
|
108
|
+
disableAutomaticIdColumn: false;
|
|
109
|
+
deriveMutations: {
|
|
110
|
+
enabled: true;
|
|
111
|
+
localOnly: boolean;
|
|
112
|
+
};
|
|
113
|
+
isSingleColumn: false;
|
|
114
|
+
}, import("effect/Schema").Schema<{
|
|
115
|
+
readonly username: string;
|
|
116
|
+
readonly text: string;
|
|
117
|
+
readonly id: string;
|
|
118
|
+
}, {
|
|
119
|
+
readonly username: string;
|
|
120
|
+
readonly text: string;
|
|
121
|
+
readonly id: string;
|
|
122
|
+
}, never>>;
|
|
123
|
+
export declare const AppRouterSchema: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"AppRouter", {
|
|
124
|
+
currentTaskId: {
|
|
125
|
+
columnType: "text";
|
|
126
|
+
schema: import("effect/Schema").Schema<string | null, string | null, never>;
|
|
127
|
+
default: import("effect/Option").Some<null>;
|
|
128
|
+
nullable: true;
|
|
129
|
+
primaryKey: false;
|
|
130
|
+
};
|
|
131
|
+
id: DbSchema.SqliteDsl.ColumnDefinition<"singleton", "singleton">;
|
|
132
|
+
}>, false, {
|
|
133
|
+
isSingleton: true;
|
|
134
|
+
disableAutomaticIdColumn: false;
|
|
135
|
+
deriveMutations: {
|
|
136
|
+
enabled: true;
|
|
137
|
+
localOnly: boolean;
|
|
138
|
+
};
|
|
139
|
+
isSingleColumn: false;
|
|
140
|
+
}, import("effect/Schema").Schema<{
|
|
141
|
+
readonly currentTaskId: string | null;
|
|
142
|
+
readonly id: "singleton";
|
|
143
|
+
}, {
|
|
144
|
+
readonly currentTaskId: string | null;
|
|
145
|
+
readonly id: "singleton";
|
|
146
|
+
}, never>>;
|
|
147
|
+
export declare const tables: {
|
|
148
|
+
todos: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"todos", {
|
|
149
|
+
id: {
|
|
150
|
+
columnType: "text";
|
|
151
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
152
|
+
default: import("effect/Option").None<never>;
|
|
153
|
+
nullable: false;
|
|
154
|
+
primaryKey: true;
|
|
155
|
+
};
|
|
156
|
+
text: {
|
|
157
|
+
columnType: "text";
|
|
158
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
159
|
+
default: import("effect/Option").Some<"">;
|
|
160
|
+
nullable: false;
|
|
161
|
+
primaryKey: false;
|
|
162
|
+
};
|
|
163
|
+
completed: {
|
|
164
|
+
columnType: "integer";
|
|
165
|
+
schema: import("effect/Schema").Schema<boolean, number, never>;
|
|
166
|
+
default: import("effect/Option").Some<false>;
|
|
167
|
+
nullable: false;
|
|
168
|
+
primaryKey: false;
|
|
169
|
+
};
|
|
170
|
+
}>, false, {
|
|
171
|
+
isSingleton: false;
|
|
172
|
+
disableAutomaticIdColumn: false;
|
|
173
|
+
deriveMutations: {
|
|
174
|
+
enabled: true;
|
|
175
|
+
localOnly: boolean;
|
|
176
|
+
};
|
|
177
|
+
isSingleColumn: false;
|
|
178
|
+
}, import("effect/Schema").Schema<{
|
|
179
|
+
readonly id: string;
|
|
180
|
+
readonly text: string;
|
|
181
|
+
readonly completed: boolean;
|
|
182
|
+
}, {
|
|
183
|
+
readonly id: string;
|
|
184
|
+
readonly text: string;
|
|
185
|
+
readonly completed: number;
|
|
186
|
+
}, never>>;
|
|
187
|
+
app: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"app", {
|
|
188
|
+
id: {
|
|
189
|
+
columnType: "text";
|
|
190
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
191
|
+
default: import("effect/Option").None<never>;
|
|
192
|
+
nullable: false;
|
|
193
|
+
primaryKey: true;
|
|
194
|
+
};
|
|
195
|
+
newTodoText: {
|
|
196
|
+
columnType: "text";
|
|
197
|
+
schema: import("effect/Schema").Schema<string | null, string | null, never>;
|
|
198
|
+
default: import("effect/Option").Some<"">;
|
|
199
|
+
nullable: true;
|
|
200
|
+
primaryKey: false;
|
|
201
|
+
};
|
|
202
|
+
filter: {
|
|
203
|
+
columnType: "text";
|
|
204
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
205
|
+
default: import("effect/Option").Some<"all">;
|
|
206
|
+
nullable: false;
|
|
207
|
+
primaryKey: false;
|
|
208
|
+
};
|
|
209
|
+
}>, false, {
|
|
210
|
+
isSingleton: false;
|
|
211
|
+
disableAutomaticIdColumn: false;
|
|
212
|
+
deriveMutations: never;
|
|
213
|
+
isSingleColumn: false;
|
|
214
|
+
}, import("effect/Schema").Schema<{
|
|
215
|
+
readonly id: string;
|
|
216
|
+
readonly newTodoText: string | null;
|
|
217
|
+
readonly filter: string;
|
|
218
|
+
}, {
|
|
219
|
+
readonly id: string;
|
|
220
|
+
readonly newTodoText: string | null;
|
|
221
|
+
readonly filter: string;
|
|
222
|
+
}, never>>;
|
|
223
|
+
AppComponentSchema: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"UserInfo", {
|
|
224
|
+
username: {
|
|
225
|
+
columnType: "text";
|
|
226
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
227
|
+
default: import("effect/Option").Some<"">;
|
|
228
|
+
nullable: false;
|
|
229
|
+
primaryKey: false;
|
|
230
|
+
};
|
|
231
|
+
text: {
|
|
232
|
+
columnType: "text";
|
|
233
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
234
|
+
default: import("effect/Option").Some<"">;
|
|
235
|
+
nullable: false;
|
|
236
|
+
primaryKey: false;
|
|
237
|
+
};
|
|
238
|
+
id: DbSchema.SqliteDsl.ColumnDefinition<string, string>;
|
|
239
|
+
}>, false, {
|
|
240
|
+
isSingleton: false;
|
|
241
|
+
disableAutomaticIdColumn: false;
|
|
242
|
+
deriveMutations: {
|
|
243
|
+
enabled: true;
|
|
244
|
+
localOnly: boolean;
|
|
245
|
+
};
|
|
246
|
+
isSingleColumn: false;
|
|
247
|
+
}, import("effect/Schema").Schema<{
|
|
248
|
+
readonly username: string;
|
|
249
|
+
readonly text: string;
|
|
250
|
+
readonly id: string;
|
|
251
|
+
}, {
|
|
252
|
+
readonly username: string;
|
|
253
|
+
readonly text: string;
|
|
254
|
+
readonly id: string;
|
|
255
|
+
}, never>>;
|
|
256
|
+
AppRouterSchema: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"AppRouter", {
|
|
257
|
+
currentTaskId: {
|
|
258
|
+
columnType: "text";
|
|
259
|
+
schema: import("effect/Schema").Schema<string | null, string | null, never>;
|
|
260
|
+
default: import("effect/Option").Some<null>;
|
|
261
|
+
nullable: true;
|
|
262
|
+
primaryKey: false;
|
|
263
|
+
};
|
|
264
|
+
id: DbSchema.SqliteDsl.ColumnDefinition<"singleton", "singleton">;
|
|
265
|
+
}>, false, {
|
|
266
|
+
isSingleton: true;
|
|
267
|
+
disableAutomaticIdColumn: false;
|
|
268
|
+
deriveMutations: {
|
|
269
|
+
enabled: true;
|
|
270
|
+
localOnly: boolean;
|
|
271
|
+
};
|
|
272
|
+
isSingleColumn: false;
|
|
273
|
+
}, import("effect/Schema").Schema<{
|
|
274
|
+
readonly currentTaskId: string | null;
|
|
275
|
+
readonly id: "singleton";
|
|
276
|
+
}, {
|
|
277
|
+
readonly currentTaskId: string | null;
|
|
278
|
+
readonly id: "singleton";
|
|
279
|
+
}, never>>;
|
|
280
|
+
};
|
|
281
|
+
export declare const schema: import("@livestore/common/schema").FromInputSchema.DeriveSchema<{
|
|
282
|
+
tables: {
|
|
283
|
+
todos: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"todos", {
|
|
284
|
+
id: {
|
|
285
|
+
columnType: "text";
|
|
286
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
287
|
+
default: import("effect/Option").None<never>;
|
|
288
|
+
nullable: false;
|
|
289
|
+
primaryKey: true;
|
|
290
|
+
};
|
|
291
|
+
text: {
|
|
292
|
+
columnType: "text";
|
|
293
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
294
|
+
default: import("effect/Option").Some<"">;
|
|
295
|
+
nullable: false;
|
|
296
|
+
primaryKey: false;
|
|
297
|
+
};
|
|
298
|
+
completed: {
|
|
299
|
+
columnType: "integer";
|
|
300
|
+
schema: import("effect/Schema").Schema<boolean, number, never>;
|
|
301
|
+
default: import("effect/Option").Some<false>;
|
|
302
|
+
nullable: false;
|
|
303
|
+
primaryKey: false;
|
|
304
|
+
};
|
|
305
|
+
}>, false, {
|
|
306
|
+
isSingleton: false;
|
|
307
|
+
disableAutomaticIdColumn: false;
|
|
308
|
+
deriveMutations: {
|
|
309
|
+
enabled: true;
|
|
310
|
+
localOnly: boolean;
|
|
311
|
+
};
|
|
312
|
+
isSingleColumn: false;
|
|
313
|
+
}, import("effect/Schema").Schema<{
|
|
314
|
+
readonly id: string;
|
|
315
|
+
readonly text: string;
|
|
316
|
+
readonly completed: boolean;
|
|
317
|
+
}, {
|
|
318
|
+
readonly id: string;
|
|
319
|
+
readonly text: string;
|
|
320
|
+
readonly completed: number;
|
|
321
|
+
}, never>>;
|
|
322
|
+
app: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"app", {
|
|
323
|
+
id: {
|
|
324
|
+
columnType: "text";
|
|
325
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
326
|
+
default: import("effect/Option").None<never>;
|
|
327
|
+
nullable: false;
|
|
328
|
+
primaryKey: true;
|
|
329
|
+
};
|
|
330
|
+
newTodoText: {
|
|
331
|
+
columnType: "text";
|
|
332
|
+
schema: import("effect/Schema").Schema<string | null, string | null, never>;
|
|
333
|
+
default: import("effect/Option").Some<"">;
|
|
334
|
+
nullable: true;
|
|
335
|
+
primaryKey: false;
|
|
336
|
+
};
|
|
337
|
+
filter: {
|
|
338
|
+
columnType: "text";
|
|
339
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
340
|
+
default: import("effect/Option").Some<"all">;
|
|
341
|
+
nullable: false;
|
|
342
|
+
primaryKey: false;
|
|
343
|
+
};
|
|
344
|
+
}>, false, {
|
|
345
|
+
isSingleton: false;
|
|
346
|
+
disableAutomaticIdColumn: false;
|
|
347
|
+
deriveMutations: never;
|
|
348
|
+
isSingleColumn: false;
|
|
349
|
+
}, import("effect/Schema").Schema<{
|
|
350
|
+
readonly id: string;
|
|
351
|
+
readonly newTodoText: string | null;
|
|
352
|
+
readonly filter: string;
|
|
353
|
+
}, {
|
|
354
|
+
readonly id: string;
|
|
355
|
+
readonly newTodoText: string | null;
|
|
356
|
+
readonly filter: string;
|
|
357
|
+
}, never>>;
|
|
358
|
+
AppComponentSchema: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"UserInfo", {
|
|
359
|
+
username: {
|
|
360
|
+
columnType: "text";
|
|
361
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
362
|
+
default: import("effect/Option").Some<"">;
|
|
363
|
+
nullable: false;
|
|
364
|
+
primaryKey: false;
|
|
365
|
+
};
|
|
366
|
+
text: {
|
|
367
|
+
columnType: "text";
|
|
368
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
369
|
+
default: import("effect/Option").Some<"">;
|
|
370
|
+
nullable: false;
|
|
371
|
+
primaryKey: false;
|
|
372
|
+
};
|
|
373
|
+
id: DbSchema.SqliteDsl.ColumnDefinition<string, string>;
|
|
374
|
+
}>, false, {
|
|
375
|
+
isSingleton: false;
|
|
376
|
+
disableAutomaticIdColumn: false;
|
|
377
|
+
deriveMutations: {
|
|
378
|
+
enabled: true;
|
|
379
|
+
localOnly: boolean;
|
|
380
|
+
};
|
|
381
|
+
isSingleColumn: false;
|
|
382
|
+
}, import("effect/Schema").Schema<{
|
|
383
|
+
readonly username: string;
|
|
384
|
+
readonly text: string;
|
|
385
|
+
readonly id: string;
|
|
386
|
+
}, {
|
|
387
|
+
readonly username: string;
|
|
388
|
+
readonly text: string;
|
|
389
|
+
readonly id: string;
|
|
390
|
+
}, never>>;
|
|
391
|
+
AppRouterSchema: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"AppRouter", {
|
|
392
|
+
currentTaskId: {
|
|
393
|
+
columnType: "text";
|
|
394
|
+
schema: import("effect/Schema").Schema<string | null, string | null, never>;
|
|
395
|
+
default: import("effect/Option").Some<null>;
|
|
396
|
+
nullable: true;
|
|
397
|
+
primaryKey: false;
|
|
398
|
+
};
|
|
399
|
+
id: DbSchema.SqliteDsl.ColumnDefinition<"singleton", "singleton">;
|
|
400
|
+
}>, false, {
|
|
401
|
+
isSingleton: true;
|
|
402
|
+
disableAutomaticIdColumn: false;
|
|
403
|
+
deriveMutations: {
|
|
404
|
+
enabled: true;
|
|
405
|
+
localOnly: boolean;
|
|
406
|
+
};
|
|
407
|
+
isSingleColumn: false;
|
|
408
|
+
}, import("effect/Schema").Schema<{
|
|
409
|
+
readonly currentTaskId: string | null;
|
|
410
|
+
readonly id: "singleton";
|
|
411
|
+
}, {
|
|
412
|
+
readonly currentTaskId: string | null;
|
|
413
|
+
readonly id: "singleton";
|
|
414
|
+
}, never>>;
|
|
415
|
+
};
|
|
416
|
+
}>;
|
|
417
|
+
export declare const makeTodoMvcReact: ({ otelTracer, otelContext, useGlobalReactivityGraph, strictMode, }?: {
|
|
418
|
+
otelTracer?: otel.Tracer;
|
|
419
|
+
otelContext?: otel.Context;
|
|
420
|
+
useGlobalReactivityGraph?: boolean;
|
|
421
|
+
strictMode?: boolean;
|
|
422
|
+
}) => Effect.Effect<{
|
|
423
|
+
wrapper: ({ children }: any) => React.JSX.Element;
|
|
424
|
+
store: import("@livestore/livestore/src/store.js").Store<import("@livestore/livestore/src/store.js").BaseGraphQLContext, import("@livestore/common/schema").FromInputSchema.DeriveSchema<{
|
|
425
|
+
tables: {
|
|
426
|
+
todos: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"todos", {
|
|
427
|
+
id: {
|
|
428
|
+
columnType: "text";
|
|
429
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
430
|
+
default: import("effect/Option").None<never>;
|
|
431
|
+
nullable: false;
|
|
432
|
+
primaryKey: true;
|
|
433
|
+
};
|
|
434
|
+
text: {
|
|
435
|
+
columnType: "text";
|
|
436
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
437
|
+
default: import("effect/Option").Some<"">;
|
|
438
|
+
nullable: false;
|
|
439
|
+
primaryKey: false;
|
|
440
|
+
};
|
|
441
|
+
completed: {
|
|
442
|
+
columnType: "integer";
|
|
443
|
+
schema: import("effect/Schema").Schema<boolean, number, never>;
|
|
444
|
+
default: import("effect/Option").Some<false>;
|
|
445
|
+
nullable: false;
|
|
446
|
+
primaryKey: false;
|
|
447
|
+
};
|
|
448
|
+
}>, false, {
|
|
449
|
+
isSingleton: false;
|
|
450
|
+
disableAutomaticIdColumn: false;
|
|
451
|
+
deriveMutations: {
|
|
452
|
+
enabled: true;
|
|
453
|
+
localOnly: boolean;
|
|
454
|
+
};
|
|
455
|
+
isSingleColumn: false;
|
|
456
|
+
}, import("effect/Schema").Schema<{
|
|
457
|
+
readonly id: string;
|
|
458
|
+
readonly text: string;
|
|
459
|
+
readonly completed: boolean;
|
|
460
|
+
}, {
|
|
461
|
+
readonly id: string;
|
|
462
|
+
readonly text: string;
|
|
463
|
+
readonly completed: number;
|
|
464
|
+
}, never>>;
|
|
465
|
+
app: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"app", {
|
|
466
|
+
id: {
|
|
467
|
+
columnType: "text";
|
|
468
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
469
|
+
default: import("effect/Option").None<never>;
|
|
470
|
+
nullable: false;
|
|
471
|
+
primaryKey: true;
|
|
472
|
+
};
|
|
473
|
+
newTodoText: {
|
|
474
|
+
columnType: "text";
|
|
475
|
+
schema: import("effect/Schema").Schema<string | null, string | null, never>;
|
|
476
|
+
default: import("effect/Option").Some<"">;
|
|
477
|
+
nullable: true;
|
|
478
|
+
primaryKey: false;
|
|
479
|
+
};
|
|
480
|
+
filter: {
|
|
481
|
+
columnType: "text";
|
|
482
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
483
|
+
default: import("effect/Option").Some<"all">;
|
|
484
|
+
nullable: false;
|
|
485
|
+
primaryKey: false;
|
|
486
|
+
};
|
|
487
|
+
}>, false, {
|
|
488
|
+
isSingleton: false;
|
|
489
|
+
disableAutomaticIdColumn: false;
|
|
490
|
+
deriveMutations: never;
|
|
491
|
+
isSingleColumn: false;
|
|
492
|
+
}, import("effect/Schema").Schema<{
|
|
493
|
+
readonly id: string;
|
|
494
|
+
readonly newTodoText: string | null;
|
|
495
|
+
readonly filter: string;
|
|
496
|
+
}, {
|
|
497
|
+
readonly id: string;
|
|
498
|
+
readonly newTodoText: string | null;
|
|
499
|
+
readonly filter: string;
|
|
500
|
+
}, never>>;
|
|
501
|
+
AppComponentSchema: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"UserInfo", {
|
|
502
|
+
username: {
|
|
503
|
+
columnType: "text";
|
|
504
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
505
|
+
default: import("effect/Option").Some<"">;
|
|
506
|
+
nullable: false;
|
|
507
|
+
primaryKey: false;
|
|
508
|
+
};
|
|
509
|
+
text: {
|
|
510
|
+
columnType: "text";
|
|
511
|
+
schema: import("effect/Schema").Schema<string, string, never>;
|
|
512
|
+
default: import("effect/Option").Some<"">;
|
|
513
|
+
nullable: false;
|
|
514
|
+
primaryKey: false;
|
|
515
|
+
};
|
|
516
|
+
id: DbSchema.SqliteDsl.ColumnDefinition<string, string>;
|
|
517
|
+
}>, false, {
|
|
518
|
+
isSingleton: false;
|
|
519
|
+
disableAutomaticIdColumn: false;
|
|
520
|
+
deriveMutations: {
|
|
521
|
+
enabled: true;
|
|
522
|
+
localOnly: boolean;
|
|
523
|
+
};
|
|
524
|
+
isSingleColumn: false;
|
|
525
|
+
}, import("effect/Schema").Schema<{
|
|
526
|
+
readonly username: string;
|
|
527
|
+
readonly text: string;
|
|
528
|
+
readonly id: string;
|
|
529
|
+
}, {
|
|
530
|
+
readonly username: string;
|
|
531
|
+
readonly text: string;
|
|
532
|
+
readonly id: string;
|
|
533
|
+
}, never>>;
|
|
534
|
+
AppRouterSchema: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"AppRouter", {
|
|
535
|
+
currentTaskId: {
|
|
536
|
+
columnType: "text";
|
|
537
|
+
schema: import("effect/Schema").Schema<string | null, string | null, never>;
|
|
538
|
+
default: import("effect/Option").Some<null>;
|
|
539
|
+
nullable: true;
|
|
540
|
+
primaryKey: false;
|
|
541
|
+
};
|
|
542
|
+
id: DbSchema.SqliteDsl.ColumnDefinition<"singleton", "singleton">;
|
|
543
|
+
}>, false, {
|
|
544
|
+
isSingleton: true;
|
|
545
|
+
disableAutomaticIdColumn: false;
|
|
546
|
+
deriveMutations: {
|
|
547
|
+
enabled: true;
|
|
548
|
+
localOnly: boolean;
|
|
549
|
+
};
|
|
550
|
+
isSingleColumn: false;
|
|
551
|
+
}, import("effect/Schema").Schema<{
|
|
552
|
+
readonly currentTaskId: string | null;
|
|
553
|
+
readonly id: "singleton";
|
|
554
|
+
}, {
|
|
555
|
+
readonly currentTaskId: string | null;
|
|
556
|
+
readonly id: "singleton";
|
|
557
|
+
}, never>>;
|
|
558
|
+
};
|
|
559
|
+
}>>;
|
|
560
|
+
reactivityGraph: import("@livestore/livestore/src/index.js").ReactivityGraph;
|
|
561
|
+
makeRenderCount: () => {
|
|
562
|
+
readonly val: number;
|
|
563
|
+
inc: () => void;
|
|
564
|
+
};
|
|
565
|
+
strictMode: boolean;
|
|
566
|
+
}, import("@livestore/common").UnexpectedError, import("effect/Scope").Scope>;
|
|
567
|
+
//# sourceMappingURL=fixture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixture.d.ts","sourceRoot":"","sources":["../../src/__tests__/fixture.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAc,MAAM,0BAA0B,CAAA;AAG/D,OAAO,EAAE,MAAM,EAAY,MAAM,yBAAyB,CAAA;AAE1D,OAAO,KAAK,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,MAAM,IAAI,GAAG;IACjB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,WAAW,CAAA;AAEnD,MAAM,MAAM,QAAQ,GAAG;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAQjB,CAAA;AAED,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAId,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAO9B,CAAA;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;UAM3B,CAAA;AAED,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAsD,CAAA;AACzE,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAyB,CAAA;AAE5C,eAAO,MAAM,gBAAgB,wEAK1B;IACD,UAAU,CAAC,EAAE,IAAI,CAAC,MAAM,CAAA;IACxB,WAAW,CAAC,EAAE,IAAI,CAAC,OAAO,CAAA;IAC1B,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;4BAuCkC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6EASlC,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { sql } from '@livestore/common';
|
|
2
|
+
import { DbSchema, makeSchema } from '@livestore/common/schema';
|
|
3
|
+
import { createStore, globalReactivityGraph, makeReactivityGraph } from '@livestore/livestore';
|
|
4
|
+
import { Effect, FiberSet } from '@livestore/utils/effect';
|
|
5
|
+
import { makeInMemoryAdapter } from '@livestore/web';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import * as LiveStoreReact from '../mod.js';
|
|
8
|
+
export const todos = DbSchema.table('todos', {
|
|
9
|
+
id: DbSchema.text({ primaryKey: true }),
|
|
10
|
+
text: DbSchema.text({ default: '', nullable: false }),
|
|
11
|
+
completed: DbSchema.boolean({ default: false, nullable: false }),
|
|
12
|
+
}, { deriveMutations: true, isSingleton: false });
|
|
13
|
+
export const app = DbSchema.table('app', {
|
|
14
|
+
id: DbSchema.text({ primaryKey: true }),
|
|
15
|
+
newTodoText: DbSchema.text({ default: '', nullable: true }),
|
|
16
|
+
filter: DbSchema.text({ default: 'all', nullable: false }),
|
|
17
|
+
});
|
|
18
|
+
export const AppComponentSchema = DbSchema.table('UserInfo', {
|
|
19
|
+
username: DbSchema.text({ default: '' }),
|
|
20
|
+
text: DbSchema.text({ default: '' }),
|
|
21
|
+
}, { deriveMutations: true });
|
|
22
|
+
export const AppRouterSchema = DbSchema.table('AppRouter', {
|
|
23
|
+
currentTaskId: DbSchema.text({ default: null, nullable: true }),
|
|
24
|
+
}, { isSingleton: true, deriveMutations: true });
|
|
25
|
+
export const tables = { todos, app, AppComponentSchema, AppRouterSchema };
|
|
26
|
+
export const schema = makeSchema({ tables });
|
|
27
|
+
export const makeTodoMvcReact = ({ otelTracer, otelContext, useGlobalReactivityGraph = true, strictMode = process.env.REACT_STRICT_MODE !== undefined, } = {}) => Effect.gen(function* () {
|
|
28
|
+
const makeRenderCount = () => {
|
|
29
|
+
let val = 0;
|
|
30
|
+
const inc = () => {
|
|
31
|
+
val += strictMode ? 0.5 : 1;
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
get val() {
|
|
35
|
+
return val;
|
|
36
|
+
},
|
|
37
|
+
inc,
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
const reactivityGraph = useGlobalReactivityGraph ? globalReactivityGraph : makeReactivityGraph();
|
|
41
|
+
const fiberSet = yield* FiberSet.make();
|
|
42
|
+
const store = yield* createStore({
|
|
43
|
+
schema,
|
|
44
|
+
storeId: 'default',
|
|
45
|
+
boot: (db) => db.execute(sql `INSERT OR IGNORE INTO app (id, newTodoText, filter) VALUES ('static', '', 'all');`),
|
|
46
|
+
adapter: makeInMemoryAdapter(),
|
|
47
|
+
reactivityGraph,
|
|
48
|
+
otelOptions: {
|
|
49
|
+
tracer: otelTracer,
|
|
50
|
+
rootSpanContext: otelContext,
|
|
51
|
+
},
|
|
52
|
+
fiberSet,
|
|
53
|
+
});
|
|
54
|
+
// TODO improve typing of `LiveStoreContext`
|
|
55
|
+
const storeContext = { stage: 'running', store };
|
|
56
|
+
const MaybeStrictMode = strictMode ? React.StrictMode : React.Fragment;
|
|
57
|
+
const wrapper = ({ children }) => (React.createElement(MaybeStrictMode, null,
|
|
58
|
+
React.createElement(LiveStoreReact.LiveStoreContext.Provider, { value: storeContext }, children)));
|
|
59
|
+
return { wrapper, store, reactivityGraph, makeRenderCount, strictMode };
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=fixture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixture.js","sourceRoot":"","sources":["../../src/__tests__/fixture.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { LiveQuery } from '@livestore/livestore';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export type LiveListProps<TItem> = {
|
|
4
|
+
items$: LiveQuery<ReadonlyArray<TItem>>;
|
|
5
|
+
renderItem: (item: TItem, opts: {
|
|
6
|
+
index: number;
|
|
7
|
+
isInitialListRender: boolean;
|
|
8
|
+
}) => React.ReactNode;
|
|
9
|
+
/** Needs to be unique across all list items */
|
|
10
|
+
getKey: (item: TItem, index: number) => string | number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* This component is a helper component for rendering a list of items for a LiveQuery of an array of items.
|
|
14
|
+
* The idea is that instead of letting React handle the rendering of the items array directly,
|
|
15
|
+
* we derive a item LiveQuery for each item which moves the reactivity to the item level when a single item changes.
|
|
16
|
+
*
|
|
17
|
+
* In the future we want to make this component even more efficient by using incremental rendering (https://github.com/livestorejs/livestore/pull/55)
|
|
18
|
+
* e.g. when an item is added/removed/moved to only re-render the affected DOM nodes.
|
|
19
|
+
*/
|
|
20
|
+
export declare const LiveList: <TItem>({ items$, renderItem, getKey }: LiveListProps<TItem>) => React.ReactNode;
|
|
21
|
+
//# sourceMappingURL=LiveList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveList.d.ts","sourceRoot":"","sources":["../../../src/experimental/components/LiveList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAErD,OAAO,KAAK,MAAM,OAAO,CAAA;AAWzB,MAAM,MAAM,aAAa,CAAC,KAAK,IAAI;IACjC,MAAM,EAAE,SAAS,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAA;IAEvC,UAAU,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,mBAAmB,EAAE,OAAO,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAA;IACnG,+CAA+C;IAC/C,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAAA;CACxD,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,kCAAmC,aAAa,CAAC,KAAK,CAAC,KAAG,KAAK,CAAC,SA8B7F,CAAA"}
|