@livestore/livestore 0.4.0-dev.19 → 0.4.0-dev.20
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/.tsbuildinfo +1 -1
- package/dist/mod.d.ts +2 -2
- package/dist/mod.d.ts.map +1 -1
- package/dist/mod.js +2 -2
- package/dist/mod.js.map +1 -1
- package/dist/store/create-store.d.ts +4 -3
- package/dist/store/create-store.d.ts.map +1 -1
- package/dist/store/create-store.js.map +1 -1
- package/dist/store/store-types.d.ts +2 -0
- package/dist/store/store-types.d.ts.map +1 -1
- package/dist/store/store-types.js +2 -2
- package/dist/store/store-types.js.map +1 -1
- package/dist/utils/dev.d.ts.map +1 -1
- package/dist/utils/dev.js +0 -2
- package/dist/utils/dev.js.map +1 -1
- package/docs/examples/index.md +1 -1
- package/docs/examples/web-adapter/index.md +1 -0
- package/docs/index.md +1 -0
- package/docs/llms.txt +1 -0
- package/docs/reference/events/index.md +130 -31
- package/docs/reference/framework-integrations/svelte-integration/index.md +42 -0
- package/docs/tutorial/6-persist-ui-state/index.md +19 -18
- package/package.json +5 -5
- package/src/mod.ts +8 -1
- package/src/store/create-store.ts +10 -4
- package/src/store/store-types.ts +2 -2
- package/src/utils/dev.ts +0 -3
|
@@ -174,6 +174,15 @@ export interface CreateStoreOptions<
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
export type CreateStoreOptionsPromise<
|
|
178
|
+
TSchema extends LiveStoreSchema = LiveStoreSchema.Any,
|
|
179
|
+
TContext = {},
|
|
180
|
+
TSyncPayloadSchema extends Schema.Schema<any> = typeof Schema.JsonValue,
|
|
181
|
+
> = CreateStoreOptions<TSchema, TContext, TSyncPayloadSchema> & {
|
|
182
|
+
signal?: AbortSignal
|
|
183
|
+
otelOptions?: Partial<OtelOptions>
|
|
184
|
+
}
|
|
185
|
+
|
|
177
186
|
/** Create a new LiveStore Store */
|
|
178
187
|
export const createStorePromise = async <
|
|
179
188
|
TSchema extends LiveStoreSchema = LiveStoreSchema.Any,
|
|
@@ -183,10 +192,7 @@ export const createStorePromise = async <
|
|
|
183
192
|
signal,
|
|
184
193
|
otelOptions,
|
|
185
194
|
...options
|
|
186
|
-
}:
|
|
187
|
-
signal?: AbortSignal
|
|
188
|
-
otelOptions?: Partial<OtelOptions>
|
|
189
|
-
}): Promise<Store<TSchema, TContext>> =>
|
|
195
|
+
}: CreateStoreOptionsPromise<TSchema, TContext, TSyncPayloadSchema>): Promise<Store<TSchema, TContext>> =>
|
|
190
196
|
Effect.gen(function* () {
|
|
191
197
|
const scope = yield* Scope.make()
|
|
192
198
|
const runtime = yield* Effect.runtime()
|
package/src/store/store-types.ts
CHANGED
|
@@ -277,7 +277,7 @@ export namespace Queryable {
|
|
|
277
277
|
export type Result<TQueryable extends Queryable<any>> = TQueryable extends Queryable<infer TResult> ? TResult : never
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
const isLiveQueryDef = (value: unknown): value is LiveQueryDef<any> | SignalDef<any> => {
|
|
280
|
+
export const isLiveQueryDef = (value: unknown): value is LiveQueryDef<any> | SignalDef<any> => {
|
|
281
281
|
if (typeof value !== 'object' || value === null) {
|
|
282
282
|
return false
|
|
283
283
|
}
|
|
@@ -305,7 +305,7 @@ const isLiveQueryDef = (value: unknown): value is LiveQueryDef<any> | SignalDef<
|
|
|
305
305
|
return true
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
-
const isLiveQueryInstance = (value: unknown): value is LiveQuery<any> => Predicate.hasProperty(value, TypeId)
|
|
308
|
+
export const isLiveQueryInstance = (value: unknown): value is LiveQuery<any> => Predicate.hasProperty(value, TypeId)
|
|
309
309
|
|
|
310
310
|
export const isQueryable = (value: unknown): value is Queryable<unknown> =>
|
|
311
311
|
isQueryBuilder(value) || isLiveQueryInstance(value) || isLiveQueryDef(value)
|
package/src/utils/dev.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { SqliteDb } from '@livestore/common'
|
|
2
2
|
import { prettyBytes } from '@livestore/utils'
|
|
3
3
|
import { Effect } from '@livestore/utils/effect'
|
|
4
|
-
import { Opfs } from '@livestore/utils/effect/browser'
|
|
5
4
|
|
|
6
5
|
declare global {
|
|
7
|
-
// declaring a global *value* is the least fussy when augmenting inline
|
|
8
6
|
var __debugLiveStoreUtils: any
|
|
9
7
|
}
|
|
10
8
|
|
|
@@ -34,7 +32,6 @@ export const downloadURL = (data: string, fileName: string) => {
|
|
|
34
32
|
|
|
35
33
|
export const exposeDebugUtils = () => {
|
|
36
34
|
globalThis.__debugLiveStoreUtils = {
|
|
37
|
-
opfs: Opfs.debugUtils,
|
|
38
35
|
downloadBlob,
|
|
39
36
|
runSync: (effect: Effect.Effect<any, any, never>) => Effect.runSync(effect),
|
|
40
37
|
runFork: (effect: Effect.Effect<any, any, never>) => Effect.runFork(effect),
|