@mearie/solid 0.0.0 → 0.0.1-next.1
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 +57 -0
- package/package.json +14 -10
- package/src/index.ts +0 -9
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @mearie/solid
|
|
2
|
+
|
|
3
|
+
Solid bindings for Mearie GraphQL client.
|
|
4
|
+
|
|
5
|
+
This package provides Solid primitives and components for using Mearie in Solid
|
|
6
|
+
applications.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install mearie @mearie/solid
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { type Component } from 'solid-js';
|
|
18
|
+
import { createClient, httpLink, cacheLink, graphql } from 'mearie';
|
|
19
|
+
import { ClientProvider, createQuery } from '@mearie/solid';
|
|
20
|
+
|
|
21
|
+
const client = createClient({
|
|
22
|
+
links: [cacheLink(), httpLink({ url: 'https://api.example.com/graphql' })],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const App: Component = () => {
|
|
26
|
+
return (
|
|
27
|
+
<ClientProvider client={client}>
|
|
28
|
+
<UserProfile userId="1" />
|
|
29
|
+
</ClientProvider>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
interface UserProfileProps {
|
|
34
|
+
userId: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const UserProfile: Component<UserProfileProps> = (props) => {
|
|
38
|
+
const query = createQuery(
|
|
39
|
+
graphql(`
|
|
40
|
+
query GetUser($id: ID!) {
|
|
41
|
+
user(id: $id) {
|
|
42
|
+
id
|
|
43
|
+
name
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`),
|
|
47
|
+
() => ({ id: props.userId }),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
if (query.loading) return <div>Loading...</div>;
|
|
51
|
+
return <h1>{query.data.user.name}</h1>;
|
|
52
|
+
};
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Documentation
|
|
56
|
+
|
|
57
|
+
Full documentation is available at <https://mearie.dev/frameworks/solid>.
|
package/package.json
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mearie/solid",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"license": "MIT",
|
|
3
|
+
"version": "0.0.1-next.1",
|
|
4
|
+
"sideEffects": false,
|
|
6
5
|
"type": "module",
|
|
7
|
-
"main": "./
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
8
7
|
"files": [
|
|
9
|
-
"dist"
|
|
8
|
+
"dist",
|
|
9
|
+
"package.json",
|
|
10
|
+
"README.md"
|
|
10
11
|
],
|
|
11
12
|
"dependencies": {
|
|
12
|
-
"@mearie/client": "0.0.
|
|
13
|
+
"@mearie/client": "0.0.1-next.1"
|
|
13
14
|
},
|
|
14
15
|
"devDependencies": {
|
|
15
|
-
"solid-js": "^1.9.
|
|
16
|
-
"tsdown": "^0.15.
|
|
16
|
+
"solid-js": "^1.9.9",
|
|
17
|
+
"tsdown": "^0.15.8"
|
|
17
18
|
},
|
|
18
19
|
"peerDependencies": {
|
|
19
20
|
"solid-js": "^1.8.0"
|
|
@@ -30,6 +31,9 @@
|
|
|
30
31
|
"types": "./dist/index.d.ts",
|
|
31
32
|
"import": "./dist/index.js",
|
|
32
33
|
"require": "./dist/index.cjs"
|
|
33
|
-
}
|
|
34
|
-
|
|
34
|
+
},
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"module": "./dist/index.js",
|
|
38
|
+
"types": "./dist/index.d.ts"
|
|
35
39
|
}
|
package/src/index.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { ClientProvider, useClient, type ClientProviderProps } from './client-provider.tsx';
|
|
2
|
-
export { createQuery, type CreateQueryReturn } from './create-query.ts';
|
|
3
|
-
export {
|
|
4
|
-
createSubscription,
|
|
5
|
-
type CreateSubscriptionReturn,
|
|
6
|
-
type CreateSubscriptionOptions,
|
|
7
|
-
} from './create-subscription.ts';
|
|
8
|
-
export { createMutation, type CreateMutationReturn } from './create-mutation.ts';
|
|
9
|
-
export { createFragment, type CreateFragmentReturn } from './create-fragment.ts';
|