@mearie/solid 0.0.0

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/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright 2025 Bae Junehyeon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/dist/index.cjs ADDED
@@ -0,0 +1,109 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+
23
+ //#endregion
24
+ let solid_js = require("solid-js");
25
+ solid_js = __toESM(solid_js);
26
+
27
+ //#region src/client-provider.tsx
28
+ const ClientContext = (0, solid_js.createContext)();
29
+ const ClientProvider = (props) => {
30
+ return <ClientContext.Provider value={props.client}>{props.children}</ClientContext.Provider>;
31
+ };
32
+ const useClient = () => {
33
+ const client = (0, solid_js.useContext)(ClientContext);
34
+ if (!client) throw new Error("useClient must be used within ClientProvider");
35
+ return client;
36
+ };
37
+
38
+ //#endregion
39
+ //#region src/create-query.ts
40
+ const createQuery = (document, variables) => {
41
+ const [data] = (0, solid_js.createSignal)();
42
+ const [loading] = (0, solid_js.createSignal)(true);
43
+ const [error] = (0, solid_js.createSignal)();
44
+ return {
45
+ get data() {
46
+ return data();
47
+ },
48
+ get loading() {
49
+ return loading();
50
+ },
51
+ get error() {
52
+ return error();
53
+ },
54
+ refetch: () => {}
55
+ };
56
+ };
57
+
58
+ //#endregion
59
+ //#region src/create-subscription.ts
60
+ const createSubscription = (document, variables, options) => {
61
+ const [data] = (0, solid_js.createSignal)();
62
+ const [loading] = (0, solid_js.createSignal)(true);
63
+ const [error] = (0, solid_js.createSignal)();
64
+ return {
65
+ get data() {
66
+ return data();
67
+ },
68
+ get loading() {
69
+ return loading();
70
+ },
71
+ get error() {
72
+ return error();
73
+ }
74
+ };
75
+ };
76
+
77
+ //#endregion
78
+ //#region src/create-mutation.ts
79
+ const createMutation = (document) => {
80
+ const [data] = (0, solid_js.createSignal)();
81
+ const [loading] = (0, solid_js.createSignal)(false);
82
+ const [error] = (0, solid_js.createSignal)();
83
+ return {
84
+ get data() {
85
+ return data();
86
+ },
87
+ get loading() {
88
+ return loading();
89
+ },
90
+ get error() {
91
+ return error();
92
+ },
93
+ mutate: async () => ({})
94
+ };
95
+ };
96
+
97
+ //#endregion
98
+ //#region src/create-fragment.ts
99
+ const createFragment = (document, fragmentRef) => {
100
+ return (0, solid_js.createMemo)(() => ({}));
101
+ };
102
+
103
+ //#endregion
104
+ exports.ClientProvider = ClientProvider;
105
+ exports.createFragment = createFragment;
106
+ exports.createMutation = createMutation;
107
+ exports.createQuery = createQuery;
108
+ exports.createSubscription = createSubscription;
109
+ exports.useClient = useClient;
@@ -0,0 +1,74 @@
1
+ import { Accessor, JSX } from "solid-js";
2
+ import { Client, DataOf, DocumentNode, FragmentRef, VariablesOf } from "@mearie/core";
3
+
4
+ //#region src/client-provider.d.ts
5
+ type ClientProviderProps = {
6
+ client: Client;
7
+ children: JSX.Element;
8
+ };
9
+ declare const ClientProvider: (props: ClientProviderProps) => JSX.Element;
10
+ declare const useClient: () => Client;
11
+ //#endregion
12
+ //#region src/create-query.d.ts
13
+ type CreateQueryReturn<Document$1 extends DocumentNode> = {
14
+ data: undefined;
15
+ loading: true;
16
+ error: undefined;
17
+ refetch: () => void;
18
+ } | {
19
+ data: DataOf<Document$1>;
20
+ loading: false;
21
+ error: undefined;
22
+ refetch: () => void;
23
+ } | {
24
+ data: DataOf<Document$1> | undefined;
25
+ loading: false;
26
+ error: Error;
27
+ refetch: () => void;
28
+ };
29
+ declare const createQuery: <Document extends DocumentNode>(document: Document, variables: Accessor<VariablesOf<Document>>) => CreateQueryReturn<Document>;
30
+ //#endregion
31
+ //#region src/create-subscription.d.ts
32
+ type CreateSubscriptionReturn<Document$1 extends DocumentNode> = {
33
+ data: undefined;
34
+ loading: true;
35
+ error: undefined;
36
+ } | {
37
+ data: DataOf<Document$1>;
38
+ loading: false;
39
+ error: undefined;
40
+ } | {
41
+ data: DataOf<Document$1> | undefined;
42
+ loading: false;
43
+ error: Error;
44
+ };
45
+ type CreateSubscriptionOptions<Document$1 extends DocumentNode> = {
46
+ onData?: (data: DataOf<Document$1>) => void;
47
+ onError?: (error: Error) => void;
48
+ };
49
+ declare const createSubscription: <Document extends DocumentNode>(document: Document, variables: Accessor<VariablesOf<Document>>, options?: CreateSubscriptionOptions<Document>) => CreateSubscriptionReturn<Document>;
50
+ //#endregion
51
+ //#region src/create-mutation.d.ts
52
+ type CreateMutationReturn<Document$1 extends DocumentNode> = {
53
+ data: undefined;
54
+ loading: true;
55
+ error: undefined;
56
+ mutate: (variables: VariablesOf<Document$1>) => Promise<DataOf<Document$1>>;
57
+ } | {
58
+ data: DataOf<Document$1>;
59
+ loading: false;
60
+ error: undefined;
61
+ mutate: (variables: VariablesOf<Document$1>) => Promise<DataOf<Document$1>>;
62
+ } | {
63
+ data: DataOf<Document$1> | undefined;
64
+ loading: false;
65
+ error: Error;
66
+ mutate: (variables: VariablesOf<Document$1>) => Promise<DataOf<Document$1>>;
67
+ };
68
+ declare const createMutation: <Document extends DocumentNode>(document: Document) => CreateMutationReturn<Document>;
69
+ //#endregion
70
+ //#region src/create-fragment.d.ts
71
+ type CreateFragmentReturn<Document$1 extends DocumentNode> = Accessor<DataOf<Document$1>>;
72
+ declare const createFragment: <Document extends DocumentNode>(document: Document, fragmentRef: Accessor<FragmentRef<Document>>) => CreateFragmentReturn<Document>;
73
+ //#endregion
74
+ export { ClientProvider, type ClientProviderProps, type CreateFragmentReturn, type CreateMutationReturn, type CreateQueryReturn, type CreateSubscriptionOptions, type CreateSubscriptionReturn, createFragment, createMutation, createQuery, createSubscription, useClient };
@@ -0,0 +1,74 @@
1
+ import { Accessor, JSX } from "solid-js";
2
+ import { Client, DataOf, DocumentNode, FragmentRef, VariablesOf } from "@mearie/core";
3
+
4
+ //#region src/client-provider.d.ts
5
+ type ClientProviderProps = {
6
+ client: Client;
7
+ children: JSX.Element;
8
+ };
9
+ declare const ClientProvider: (props: ClientProviderProps) => JSX.Element;
10
+ declare const useClient: () => Client;
11
+ //#endregion
12
+ //#region src/create-query.d.ts
13
+ type CreateQueryReturn<Document$1 extends DocumentNode> = {
14
+ data: undefined;
15
+ loading: true;
16
+ error: undefined;
17
+ refetch: () => void;
18
+ } | {
19
+ data: DataOf<Document$1>;
20
+ loading: false;
21
+ error: undefined;
22
+ refetch: () => void;
23
+ } | {
24
+ data: DataOf<Document$1> | undefined;
25
+ loading: false;
26
+ error: Error;
27
+ refetch: () => void;
28
+ };
29
+ declare const createQuery: <Document extends DocumentNode>(document: Document, variables: Accessor<VariablesOf<Document>>) => CreateQueryReturn<Document>;
30
+ //#endregion
31
+ //#region src/create-subscription.d.ts
32
+ type CreateSubscriptionReturn<Document$1 extends DocumentNode> = {
33
+ data: undefined;
34
+ loading: true;
35
+ error: undefined;
36
+ } | {
37
+ data: DataOf<Document$1>;
38
+ loading: false;
39
+ error: undefined;
40
+ } | {
41
+ data: DataOf<Document$1> | undefined;
42
+ loading: false;
43
+ error: Error;
44
+ };
45
+ type CreateSubscriptionOptions<Document$1 extends DocumentNode> = {
46
+ onData?: (data: DataOf<Document$1>) => void;
47
+ onError?: (error: Error) => void;
48
+ };
49
+ declare const createSubscription: <Document extends DocumentNode>(document: Document, variables: Accessor<VariablesOf<Document>>, options?: CreateSubscriptionOptions<Document>) => CreateSubscriptionReturn<Document>;
50
+ //#endregion
51
+ //#region src/create-mutation.d.ts
52
+ type CreateMutationReturn<Document$1 extends DocumentNode> = {
53
+ data: undefined;
54
+ loading: true;
55
+ error: undefined;
56
+ mutate: (variables: VariablesOf<Document$1>) => Promise<DataOf<Document$1>>;
57
+ } | {
58
+ data: DataOf<Document$1>;
59
+ loading: false;
60
+ error: undefined;
61
+ mutate: (variables: VariablesOf<Document$1>) => Promise<DataOf<Document$1>>;
62
+ } | {
63
+ data: DataOf<Document$1> | undefined;
64
+ loading: false;
65
+ error: Error;
66
+ mutate: (variables: VariablesOf<Document$1>) => Promise<DataOf<Document$1>>;
67
+ };
68
+ declare const createMutation: <Document extends DocumentNode>(document: Document) => CreateMutationReturn<Document>;
69
+ //#endregion
70
+ //#region src/create-fragment.d.ts
71
+ type CreateFragmentReturn<Document$1 extends DocumentNode> = Accessor<DataOf<Document$1>>;
72
+ declare const createFragment: <Document extends DocumentNode>(document: Document, fragmentRef: Accessor<FragmentRef<Document>>) => CreateFragmentReturn<Document>;
73
+ //#endregion
74
+ export { ClientProvider, type ClientProviderProps, type CreateFragmentReturn, type CreateMutationReturn, type CreateQueryReturn, type CreateSubscriptionOptions, type CreateSubscriptionReturn, createFragment, createMutation, createQuery, createSubscription, useClient };
package/dist/index.js ADDED
@@ -0,0 +1,80 @@
1
+ import { createContext, createMemo, createSignal, useContext } from "solid-js";
2
+
3
+ //#region src/client-provider.tsx
4
+ const ClientContext = createContext();
5
+ const ClientProvider = (props) => {
6
+ return <ClientContext.Provider value={props.client}>{props.children}</ClientContext.Provider>;
7
+ };
8
+ const useClient = () => {
9
+ const client = useContext(ClientContext);
10
+ if (!client) throw new Error("useClient must be used within ClientProvider");
11
+ return client;
12
+ };
13
+
14
+ //#endregion
15
+ //#region src/create-query.ts
16
+ const createQuery = (document, variables) => {
17
+ const [data] = createSignal();
18
+ const [loading] = createSignal(true);
19
+ const [error] = createSignal();
20
+ return {
21
+ get data() {
22
+ return data();
23
+ },
24
+ get loading() {
25
+ return loading();
26
+ },
27
+ get error() {
28
+ return error();
29
+ },
30
+ refetch: () => {}
31
+ };
32
+ };
33
+
34
+ //#endregion
35
+ //#region src/create-subscription.ts
36
+ const createSubscription = (document, variables, options) => {
37
+ const [data] = createSignal();
38
+ const [loading] = createSignal(true);
39
+ const [error] = createSignal();
40
+ return {
41
+ get data() {
42
+ return data();
43
+ },
44
+ get loading() {
45
+ return loading();
46
+ },
47
+ get error() {
48
+ return error();
49
+ }
50
+ };
51
+ };
52
+
53
+ //#endregion
54
+ //#region src/create-mutation.ts
55
+ const createMutation = (document) => {
56
+ const [data] = createSignal();
57
+ const [loading] = createSignal(false);
58
+ const [error] = createSignal();
59
+ return {
60
+ get data() {
61
+ return data();
62
+ },
63
+ get loading() {
64
+ return loading();
65
+ },
66
+ get error() {
67
+ return error();
68
+ },
69
+ mutate: async () => ({})
70
+ };
71
+ };
72
+
73
+ //#endregion
74
+ //#region src/create-fragment.ts
75
+ const createFragment = (document, fragmentRef) => {
76
+ return createMemo(() => ({}));
77
+ };
78
+
79
+ //#endregion
80
+ export { ClientProvider, createFragment, createMutation, createQuery, createSubscription, useClient };
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@mearie/solid",
3
+ "version": "0.0.0",
4
+ "description": "Solid integration for Mearie",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./src/index.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "dependencies": {
12
+ "@mearie/client": "0.0.0"
13
+ },
14
+ "devDependencies": {
15
+ "solid-js": "^1.9.0",
16
+ "tsdown": "^0.15.7"
17
+ },
18
+ "peerDependencies": {
19
+ "solid-js": "^1.8.0"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "scripts": {
25
+ "build": "tsdown",
26
+ "dev": "tsdown --watch"
27
+ },
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "import": "./dist/index.js",
32
+ "require": "./dist/index.cjs"
33
+ }
34
+ }
35
+ }
package/src/index.ts ADDED
@@ -0,0 +1,9 @@
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';