@sylphx/lens-solid 1.0.2
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/context.d.ts +50 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +765 -0
- package/dist/primitives.d.ts +151 -0
- package/dist/primitives.d.ts.map +1 -0
- package/dist/primitives.test.d.ts +5 -0
- package/dist/primitives.test.d.ts.map +1 -0
- package/package.json +44 -0
- package/src/context.tsx +86 -0
- package/src/index.ts +30 -0
- package/src/primitives.test.tsx +279 -0
- package/src/primitives.ts +315 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sylphx/lens-solid - Context
|
|
3
|
+
*
|
|
4
|
+
* SolidJS context for Lens client injection.
|
|
5
|
+
*/
|
|
6
|
+
import type { LensClient } from "@sylphx/lens-client";
|
|
7
|
+
import { type ParentComponent } from "solid-js";
|
|
8
|
+
export interface LensProviderProps {
|
|
9
|
+
/** Lens client instance */
|
|
10
|
+
client: LensClient<any, any>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Provider for Lens client in SolidJS.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* import { createClient, httpLink } from '@sylphx/lens-client';
|
|
18
|
+
* import { LensProvider } from '@sylphx/lens-solid';
|
|
19
|
+
* import type { AppRouter } from './server';
|
|
20
|
+
*
|
|
21
|
+
* const client = createClient<AppRouter>({
|
|
22
|
+
* links: [httpLink({ url: '/api' })],
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* function App() {
|
|
26
|
+
* return (
|
|
27
|
+
* <LensProvider client={client}>
|
|
28
|
+
* <UserProfile />
|
|
29
|
+
* </LensProvider>
|
|
30
|
+
* );
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare const LensProvider: ParentComponent<LensProviderProps>;
|
|
35
|
+
/**
|
|
36
|
+
* Get Lens client from context.
|
|
37
|
+
*
|
|
38
|
+
* @throws Error if used outside LensProvider
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* function UserProfile() {
|
|
43
|
+
* const client = useLensClient<AppRouter>();
|
|
44
|
+
* const user = createQuery(() => client.queries.getUser({ id: '123' }));
|
|
45
|
+
* return <h1>{user.data?.name}</h1>;
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function useLensClient<TRouter = any>(): LensClient<any, any> & TRouter;
|
|
50
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,KAAK,eAAe,EAA6B,MAAM,UAAU,CAAC;AAa3E,MAAM,WAAW,iBAAiB;IACjC,2BAA2B;IAE3B,MAAM,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,YAAY,EAAE,eAAe,CAAC,iBAAiB,CAI3D,CAAC;AAMF;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,aAAa,CAAC,OAAO,GAAG,GAAG,KAAK,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,OAAO,CAY7E"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sylphx/lens-solid
|
|
3
|
+
*
|
|
4
|
+
* SolidJS bindings for Lens API framework.
|
|
5
|
+
* Reactive primitives that integrate with SolidJS fine-grained reactivity.
|
|
6
|
+
*/
|
|
7
|
+
export { LensProvider, useLensClient, type LensProviderProps } from "./context";
|
|
8
|
+
export { createQuery, createLazyQuery, createMutation, type CreateQueryResult, type CreateMutationResult, type CreateLazyQueryResult, type CreateQueryOptions, type MutationFn, } from "./primitives";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAMhF,OAAO,EAEN,WAAW,EACX,eAAe,EAEf,cAAc,EAEd,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,UAAU,GACf,MAAM,cAAc,CAAC"}
|