@livequery/react 2.0.104 → 2.0.106

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,10 +1,10 @@
1
1
  # @livequery/react
2
2
 
3
- Thin React bindings for `@livequery/core`.
3
+ Thin React bindings for `@livequery/client`.
4
4
 
5
5
  This repository is the React bindings library package, not an application. Changes here should preserve reusable hook behavior unless a task explicitly targets a breaking change.
6
6
 
7
- This package provides a small set of hooks and helpers for wiring a `LivequeryCore` instance into a React app, subscribing to RxJS streams, and reading collection or document state from `@livequery/core`.
7
+ This package provides a small set of hooks and helpers for wiring a `LivequeryClient` instance into a React app, subscribing to RxJS streams, and reading collection or document state from `@livequery/client`.
8
8
 
9
9
  ## AI Agent Guidance
10
10
 
@@ -13,24 +13,24 @@ Repository-specific agent guidance lives in `AGENTS.md` and `copilot-instruction
13
13
  - `AGENTS.md` is the implementation-focused guide for coding agents modifying this package.
14
14
  - `copilot-instructions.md` provides repo-level instructions for Copilot when generating or reviewing code in this workspace.
15
15
  - Both documents assume this repo is a React bindings library package, so agent changes should avoid app-specific scaffolding and should preserve public API compatibility by default.
16
- - Agents generating consumer code should create one shared `LivequeryCore`, provide it through `LivequeryCoreProvider`, and subscribe to collection state with `useObservable()`.
16
+ - Agents generating consumer code should create one shared `LivequeryClient`, provide it through `LivequeryClientProvider`, and subscribe to collection state with `useObservable()`.
17
17
 
18
18
  ## Install
19
19
 
20
20
  ```bash
21
- bun add @livequery/react @livequery/core react rxjs
21
+ bun add @livequery/react @livequery/client react rxjs
22
22
  ```
23
23
 
24
24
  Or with npm:
25
25
 
26
26
  ```bash
27
- npm install @livequery/react @livequery/core react rxjs
27
+ npm install @livequery/react @livequery/client react rxjs
28
28
  ```
29
29
 
30
30
  ## Exports
31
31
 
32
- - `LivequeryCoreProvider`
33
- - `useLivequeryCore`
32
+ - `LivequeryClientProvider`
33
+ - `useLivequeryClient`
34
34
  - `useCollection`
35
35
  - `useDocument`
36
36
  - `useObservable`
@@ -39,21 +39,21 @@ npm install @livequery/react @livequery/core react rxjs
39
39
 
40
40
  ## Core setup
41
41
 
42
- `useCollection` and `useDocument` read the active `LivequeryCore` instance from `LivequeryCoreProvider`.
42
+ `useCollection` and `useDocument` read the active `LivequeryClient` instance from `LivequeryClientProvider`.
43
43
 
44
44
  ```tsx
45
- import { LivequeryCore } from '@livequery/core'
46
- import { LivequeryCoreProvider } from '@livequery/react'
45
+ import { LivequeryClient } from '@livequery/client'
46
+ import { LivequeryClientProvider } from '@livequery/react'
47
47
 
48
- const core = new LivequeryCore({
48
+ const client = new LivequeryClient({
49
49
  endpoint: 'https://your-livequery-server'
50
50
  })
51
51
 
52
52
  export function AppProviders({ children }: { children: React.ReactNode }) {
53
53
  return (
54
- <LivequeryCoreProvider core={core}>
54
+ <LivequeryClientProvider client={client}>
55
55
  {children}
56
- </LivequeryCoreProvider>
56
+ </LivequeryClientProvider>
57
57
  )
58
58
  }
59
59
  ```
@@ -140,12 +140,12 @@ You can also pass a function when the observable should be resolved lazily.
140
140
  `useGlobalValue` stores a lazily created singleton on `globalThis`. This is useful when an app should reuse one object across renders or across multiple React roots in the same runtime.
141
141
 
142
142
  ```tsx
143
- import { LivequeryCore } from '@livequery/core'
143
+ import { LivequeryClient } from '@livequery/client'
144
144
  import { useGlobalValue } from '@livequery/react'
145
145
 
146
- export function useAppCore() {
147
- return useGlobalValue('livequery-core', () => {
148
- return new LivequeryCore({
146
+ export function useAppClient() {
147
+ return useGlobalValue('livequery-client', () => {
148
+ return new LivequeryClient({
149
149
  endpoint: 'https://your-livequery-server'
150
150
  })
151
151
  })
@@ -180,7 +180,7 @@ Compared to creating context by hand, `createContextFromHook` removes the repeti
180
180
 
181
181
  It is especially useful when you want an API that reads like a hook-based service locator, but stays explicit through React providers.
182
182
 
183
- The `LivequeryCoreProvider` and `useLivequeryCore` pair in this package is built from this helper.
183
+ The `LivequeryClientProvider` and `useLivequeryClient` pair in this package is built from this helper.
184
184
 
185
185
  ### Mental model
186
186
 
@@ -224,7 +224,7 @@ This is why the consumer side feels like a plain hook even though the data flow
224
224
 
225
225
  ### Good use cases
226
226
 
227
- - exposing a configured client instance such as `LivequeryCore`
227
+ - exposing a configured client instance such as `LivequeryClient`
228
228
  - deriving session or auth state from provider props
229
229
  - wrapping feature-specific state that should be consumed through a single custom hook
230
230
  - hiding context implementation details from package consumers
@@ -0,0 +1,5 @@
1
+ import type { LivequeryClient } from "@livequery/client";
2
+ export declare const useLivequeryClient: () => LivequeryClient, LivequeryClientProvider: (props: import("react").PropsWithChildren<{
3
+ core: any;
4
+ }>) => import("react").JSX.Element;
5
+ //# sourceMappingURL=LivequeryClientContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LivequeryClientContext.d.ts","sourceRoot":"","sources":["../src/LivequeryClientContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD,eAAO,MAAO,kBAAkB,yBAAE,uBAAuB;UACrC,GAAG;kCACtB,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { createContextFromHook } from "./createContextFromHook.js";
2
+ export const [useLivequeryClient, LivequeryClientProvider] = createContextFromHook((props) => props.core);
3
+ //# sourceMappingURL=LivequeryClientContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LivequeryClientContext.js","sourceRoot":"","sources":["../src/LivequeryClientContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,GAAG,qBAAqB,CAC9E,CAAC,KAAoB,EAAE,EAAE,CAAC,KAAK,CAAC,IAAuB,CAC1D,CAAA"}
package/dist/index.d.ts CHANGED
@@ -2,6 +2,6 @@ export * from './createContextFromHook.js';
2
2
  export * from './useCollection.js';
3
3
  export * from './useDocument.js';
4
4
  export * from './useObservable.js';
5
- export * from './LivequeryCoreContext.js';
5
+ export * from './LivequeryClientContext.js';
6
6
  export * from './useAction.js';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,2BAA2B,CAAA;AACzC,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gBAAgB,CAAA"}
package/dist/index.js CHANGED
@@ -2,6 +2,6 @@ export * from './createContextFromHook.js';
2
2
  export * from './useCollection.js';
3
3
  export * from './useDocument.js';
4
4
  export * from './useObservable.js';
5
- export * from './LivequeryCoreContext.js';
5
+ export * from './LivequeryClientContext.js';
6
6
  export * from './useAction.js';
7
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,2BAA2B,CAAA;AACzC,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gBAAgB,CAAA"}
@@ -1,3 +1,3 @@
1
- import { LivequeryCollection, type Doc, type LivequeryCollectionOptions } from "@livequery/core";
1
+ import { LivequeryCollection, type Doc, type LivequeryCollectionOptions } from "@livequery/client";
2
2
  export declare const useCollection: <T extends Doc>(ref: string | undefined | "" | null | false, options?: Partial<LivequeryCollectionOptions<T>>) => LivequeryCollection<T>;
3
3
  //# sourceMappingURL=useCollection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCollection.d.ts","sourceRoot":"","sources":["../src/useCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,KAAK,GAAG,EAAE,KAAK,0BAA0B,EAAE,MAAM,iBAAiB,CAAA;AAMhG,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,GAAG,EAAE,KAAK,MAAM,GAAG,SAAS,GAAG,EAAE,GAAG,IAAI,GAAG,KAAK,EAAE,UAAS,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAM,2BAW7I,CAAA"}
1
+ {"version":3,"file":"useCollection.d.ts","sourceRoot":"","sources":["../src/useCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,KAAK,GAAG,EAAE,KAAK,0BAA0B,EAAE,MAAM,mBAAmB,CAAA;AAMlG,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,GAAG,EAAE,KAAK,MAAM,GAAG,SAAS,GAAG,EAAE,GAAG,IAAI,GAAG,KAAK,EAAE,UAAS,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAM,2BAW7I,CAAA"}
@@ -1,17 +1,17 @@
1
- import { LivequeryCollection } from "@livequery/core";
1
+ import { LivequeryCollection } from "@livequery/client";
2
2
  import { useMemo, useEffect } from "react";
3
- import { useLivequeryCore } from "./LivequeryCoreContext.js";
3
+ import { useLivequeryClient } from "./LivequeryClientContext.js";
4
4
  export const useCollection = (ref, options = {}) => {
5
- const core = useLivequeryCore();
6
- const collection = useMemo(() => new LivequeryCollection(core, options), []);
5
+ const client = useLivequeryClient();
6
+ const collection = useMemo(() => new LivequeryCollection(client, options), []);
7
7
  useEffect(() => {
8
- if (!ref || !core)
8
+ if (!ref || !client)
9
9
  return;
10
10
  const linker = collection.initialize(ref);
11
11
  return () => {
12
12
  linker?.unsubscribe();
13
13
  };
14
- }, [collection, core, ref]);
14
+ }, [collection, client, ref]);
15
15
  return collection;
16
16
  };
17
17
  //# sourceMappingURL=useCollection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCollection.js","sourceRoot":"","sources":["../src/useCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAA6C,MAAM,iBAAiB,CAAA;AAChG,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAI5D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAgB,GAA2C,EAAE,UAAkD,EAAE,EAAE,EAAE;IAC9I,MAAM,IAAI,GAAG,gBAAgB,EAAE,CAAA;IAC/B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,mBAAmB,CAAI,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAA;IAC/E,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI;YAAE,OAAM;QACzB,MAAM,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;QACzC,OAAO,GAAG,EAAE;YACR,MAAM,EAAE,WAAW,EAAE,CAAA;QACzB,CAAC,CAAA;IACL,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,CAAA;IAC3B,OAAO,UAAU,CAAA;AACrB,CAAC,CAAA"}
1
+ {"version":3,"file":"useCollection.js","sourceRoot":"","sources":["../src/useCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAA6C,MAAM,mBAAmB,CAAA;AAClG,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAIhE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAgB,GAA2C,EAAE,UAAkD,EAAE,EAAE,EAAE;IAC9I,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAA;IACnC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,mBAAmB,CAAI,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAA;IACjF,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM;YAAE,OAAM;QAC3B,MAAM,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;QACzC,OAAO,GAAG,EAAE;YACR,MAAM,EAAE,WAAW,EAAE,CAAA;QACzB,CAAC,CAAA;IACL,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;IAC7B,OAAO,UAAU,CAAA;AACrB,CAAC,CAAA"}
@@ -1,5 +1,5 @@
1
- import { type Doc } from "@livequery/core";
1
+ import { type Doc } from "@livequery/client";
2
2
  export declare const useDocument: <T extends Doc>(ref: string | undefined | "" | null | false, options?: {
3
3
  lazy?: boolean;
4
- }) => readonly [import("@livequery/core").LivequeryDocument<import("@livequery/core").DocState<T>> | undefined, import("@livequery/core").LivequeryLoadingState];
4
+ }) => readonly [import("@livequery/client").LivequeryDocument<import("@livequery/client").DocState<T>> | undefined, import("@livequery/client").LivequeryLoadingState];
5
5
  //# sourceMappingURL=useDocument.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDocument.d.ts","sourceRoot":"","sources":["../src/useDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAK1C,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,GAAG,EAAE,KAAK,MAAM,GAAG,SAAS,GAAG,EAAE,GAAG,IAAI,GAAG,KAAK,EAAE,UAAS;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,+JAKvH,CAAA"}
1
+ {"version":3,"file":"useDocument.d.ts","sourceRoot":"","sources":["../src/useDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAK5C,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,GAAG,EAAE,KAAK,MAAM,GAAG,SAAS,GAAG,EAAE,GAAG,IAAI,GAAG,KAAK,EAAE,UAAS;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,qKAKvH,CAAA"}
@@ -1,4 +1,4 @@
1
- import {} from "@livequery/core";
1
+ import {} from "@livequery/client";
2
2
  import { useObservable } from "./useObservable.js";
3
3
  import { useCollection } from "./useCollection.js";
4
4
  export const useDocument = (ref, options = {}) => {
@@ -1 +1 @@
1
- {"version":3,"file":"useDocument.js","sourceRoot":"","sources":["../src/useDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGlD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAgB,GAA2C,EAAE,UAA8B,EAAE,EAAE,EAAE;IACxH,MAAM,UAAU,GAAG,aAAa,CAAI,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;IAChE,MAAM,KAAK,GAAG,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IAC7C,MAAM,OAAO,GAAG,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;IACjD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAU,CAAA;AACvC,CAAC,CAAA"}
1
+ {"version":3,"file":"useDocument.js","sourceRoot":"","sources":["../src/useDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGlD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAgB,GAA2C,EAAE,UAA8B,EAAE,EAAE,EAAE;IACxH,MAAM,UAAU,GAAG,aAAa,CAAI,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;IAChE,MAAM,KAAK,GAAG,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IAC7C,MAAM,OAAO,GAAG,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;IACjD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAU,CAAA;AACvC,CAAC,CAAA"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "url": "https://github.com/livequery/react"
5
5
  },
6
6
  "type": "module",
7
- "version": "2.0.104",
7
+ "version": "2.0.106",
8
8
  "description": "",
9
9
  "main": "./dist/index.js",
10
10
  "types": "./dist/index.d.ts",
@@ -19,10 +19,10 @@
19
19
  "import": "./dist/createContextFromHook.js",
20
20
  "default": "./dist/createContextFromHook.js"
21
21
  },
22
- "./LivequeryCoreContext": {
23
- "types": "./dist/LivequeryCoreContext.d.ts",
24
- "import": "./dist/LivequeryCoreContext.js",
25
- "default": "./dist/LivequeryCoreContext.js"
22
+ "./LivequeryClientContext": {
23
+ "types": "./dist/LivequeryClientContext.d.ts",
24
+ "import": "./dist/LivequeryClientContext.js",
25
+ "default": "./dist/LivequeryClientContext.js"
26
26
  },
27
27
  "./useAction": {
28
28
  "types": "./dist/useAction.d.ts",
@@ -52,7 +52,7 @@
52
52
  "@types/react": "^19.2.14"
53
53
  },
54
54
  "peerDependencies": {
55
- "@livequery/core": "^2.0.104",
55
+ "@livequery/client": "^2.0.106",
56
56
  "rxjs": "^7.8.2",
57
57
  "react": "^19.2.5"
58
58
  },
@@ -1,5 +0,0 @@
1
- import type { LivequeryCore } from "@livequery/core";
2
- export declare const useLivequeryCore: () => LivequeryCore, LivequeryCoreProvider: (props: import("react").PropsWithChildren<{
3
- core: any;
4
- }>) => import("react").JSX.Element;
5
- //# sourceMappingURL=LivequeryCoreContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LivequeryCoreContext.d.ts","sourceRoot":"","sources":["../src/LivequeryCoreContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,eAAO,MAAO,gBAAgB,uBAAE,qBAAqB;UACjC,GAAG;kCACtB,CAAA"}
@@ -1,3 +0,0 @@
1
- import { createContextFromHook } from "./createContextFromHook.js";
2
- export const [useLivequeryCore, LivequeryCoreProvider] = createContextFromHook((props) => props.core);
3
- //# sourceMappingURL=LivequeryCoreContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LivequeryCoreContext.js","sourceRoot":"","sources":["../src/LivequeryCoreContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,GAAG,qBAAqB,CAC1E,CAAC,KAAoB,EAAE,EAAE,CAAC,KAAK,CAAC,IAAqB,CACxD,CAAA"}