@mearie/svelte 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 +20 -0
- package/dist/index.svelte.cjs +109 -0
- package/dist/index.svelte.d.cts +69 -0
- package/dist/index.svelte.d.ts +69 -0
- package/dist/index.svelte.js +80 -0
- package/package.json +35 -0
- package/src/index.svelte.ts +9 -0
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.
|
|
@@ -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 svelte = require("svelte");
|
|
25
|
+
svelte = __toESM(svelte);
|
|
26
|
+
|
|
27
|
+
//#region src/client-context.svelte.ts
|
|
28
|
+
const CLIENT_KEY = Symbol("mearie-client");
|
|
29
|
+
const setClient = (client) => {
|
|
30
|
+
(0, svelte.setContext)(CLIENT_KEY, client);
|
|
31
|
+
};
|
|
32
|
+
const getClient = () => {
|
|
33
|
+
const client = (0, svelte.getContext)(CLIENT_KEY);
|
|
34
|
+
if (!client) throw new Error("getClient must be used within a context that has called setClient");
|
|
35
|
+
return client;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/create-query.svelte.ts
|
|
40
|
+
const createQuery = (document, variables) => {
|
|
41
|
+
let data = $state(void 0);
|
|
42
|
+
let loading = $state(true);
|
|
43
|
+
let error = $state(void 0);
|
|
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.svelte.ts
|
|
60
|
+
const createSubscription = (document, variables, options) => {
|
|
61
|
+
let data = $state(void 0);
|
|
62
|
+
let loading = $state(true);
|
|
63
|
+
let error = $state(void 0);
|
|
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.svelte.ts
|
|
79
|
+
const createMutation = (document) => {
|
|
80
|
+
let data = $state(void 0);
|
|
81
|
+
let loading = $state(false);
|
|
82
|
+
let error = $state(void 0);
|
|
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.svelte.ts
|
|
99
|
+
const createFragment = (document, fragmentRef) => {
|
|
100
|
+
return $derived.by(() => ({}));
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
exports.createFragment = createFragment;
|
|
105
|
+
exports.createMutation = createMutation;
|
|
106
|
+
exports.createQuery = createQuery;
|
|
107
|
+
exports.createSubscription = createSubscription;
|
|
108
|
+
exports.getClient = getClient;
|
|
109
|
+
exports.setClient = setClient;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Client, DataOf, DocumentNode, FragmentRef, VariablesOf } from "@mearie/core";
|
|
2
|
+
|
|
3
|
+
//#region src/client-context.svelte.d.ts
|
|
4
|
+
declare const setClient: (client: Client) => void;
|
|
5
|
+
declare const getClient: () => Client;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/create-query.svelte.d.ts
|
|
8
|
+
type CreateQueryReturn<Document$1 extends DocumentNode> = {
|
|
9
|
+
data: undefined;
|
|
10
|
+
loading: true;
|
|
11
|
+
error: undefined;
|
|
12
|
+
refetch: () => void;
|
|
13
|
+
} | {
|
|
14
|
+
data: DataOf<Document$1>;
|
|
15
|
+
loading: false;
|
|
16
|
+
error: undefined;
|
|
17
|
+
refetch: () => void;
|
|
18
|
+
} | {
|
|
19
|
+
data: DataOf<Document$1> | undefined;
|
|
20
|
+
loading: false;
|
|
21
|
+
error: Error;
|
|
22
|
+
refetch: () => void;
|
|
23
|
+
};
|
|
24
|
+
declare const createQuery: <Document extends DocumentNode>(document: Document, variables: () => VariablesOf<Document>) => CreateQueryReturn<Document>;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/create-subscription.svelte.d.ts
|
|
27
|
+
type CreateSubscriptionReturn<Document$1 extends DocumentNode> = {
|
|
28
|
+
data: undefined;
|
|
29
|
+
loading: true;
|
|
30
|
+
error: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
data: DataOf<Document$1>;
|
|
33
|
+
loading: false;
|
|
34
|
+
error: undefined;
|
|
35
|
+
} | {
|
|
36
|
+
data: DataOf<Document$1> | undefined;
|
|
37
|
+
loading: false;
|
|
38
|
+
error: Error;
|
|
39
|
+
};
|
|
40
|
+
type CreateSubscriptionOptions<Document$1 extends DocumentNode> = {
|
|
41
|
+
onData?: (data: DataOf<Document$1>) => void;
|
|
42
|
+
onError?: (error: Error) => void;
|
|
43
|
+
};
|
|
44
|
+
declare const createSubscription: <Document extends DocumentNode>(document: Document, variables: () => VariablesOf<Document>, options?: CreateSubscriptionOptions<Document>) => CreateSubscriptionReturn<Document>;
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/create-mutation.svelte.d.ts
|
|
47
|
+
type CreateMutationReturn<Document$1 extends DocumentNode> = {
|
|
48
|
+
data: undefined;
|
|
49
|
+
loading: true;
|
|
50
|
+
error: undefined;
|
|
51
|
+
mutate: (variables: VariablesOf<Document$1>) => Promise<DataOf<Document$1>>;
|
|
52
|
+
} | {
|
|
53
|
+
data: DataOf<Document$1>;
|
|
54
|
+
loading: false;
|
|
55
|
+
error: undefined;
|
|
56
|
+
mutate: (variables: VariablesOf<Document$1>) => Promise<DataOf<Document$1>>;
|
|
57
|
+
} | {
|
|
58
|
+
data: DataOf<Document$1> | undefined;
|
|
59
|
+
loading: false;
|
|
60
|
+
error: Error;
|
|
61
|
+
mutate: (variables: VariablesOf<Document$1>) => Promise<DataOf<Document$1>>;
|
|
62
|
+
};
|
|
63
|
+
declare const createMutation: <Document extends DocumentNode>(document: Document) => CreateMutationReturn<Document>;
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/create-fragment.svelte.d.ts
|
|
66
|
+
type CreateFragmentReturn<Document$1 extends DocumentNode> = DataOf<Document$1>;
|
|
67
|
+
declare const createFragment: <Document extends DocumentNode>(document: Document, fragmentRef: () => FragmentRef<Document>) => CreateFragmentReturn<Document>;
|
|
68
|
+
//#endregion
|
|
69
|
+
export { type CreateFragmentReturn, type CreateMutationReturn, type CreateQueryReturn, type CreateSubscriptionOptions, type CreateSubscriptionReturn, createFragment, createMutation, createQuery, createSubscription, getClient, setClient };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Client, DataOf, DocumentNode, FragmentRef, VariablesOf } from "@mearie/core";
|
|
2
|
+
|
|
3
|
+
//#region src/client-context.svelte.d.ts
|
|
4
|
+
declare const setClient: (client: Client) => void;
|
|
5
|
+
declare const getClient: () => Client;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/create-query.svelte.d.ts
|
|
8
|
+
type CreateQueryReturn<Document$1 extends DocumentNode> = {
|
|
9
|
+
data: undefined;
|
|
10
|
+
loading: true;
|
|
11
|
+
error: undefined;
|
|
12
|
+
refetch: () => void;
|
|
13
|
+
} | {
|
|
14
|
+
data: DataOf<Document$1>;
|
|
15
|
+
loading: false;
|
|
16
|
+
error: undefined;
|
|
17
|
+
refetch: () => void;
|
|
18
|
+
} | {
|
|
19
|
+
data: DataOf<Document$1> | undefined;
|
|
20
|
+
loading: false;
|
|
21
|
+
error: Error;
|
|
22
|
+
refetch: () => void;
|
|
23
|
+
};
|
|
24
|
+
declare const createQuery: <Document extends DocumentNode>(document: Document, variables: () => VariablesOf<Document>) => CreateQueryReturn<Document>;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/create-subscription.svelte.d.ts
|
|
27
|
+
type CreateSubscriptionReturn<Document$1 extends DocumentNode> = {
|
|
28
|
+
data: undefined;
|
|
29
|
+
loading: true;
|
|
30
|
+
error: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
data: DataOf<Document$1>;
|
|
33
|
+
loading: false;
|
|
34
|
+
error: undefined;
|
|
35
|
+
} | {
|
|
36
|
+
data: DataOf<Document$1> | undefined;
|
|
37
|
+
loading: false;
|
|
38
|
+
error: Error;
|
|
39
|
+
};
|
|
40
|
+
type CreateSubscriptionOptions<Document$1 extends DocumentNode> = {
|
|
41
|
+
onData?: (data: DataOf<Document$1>) => void;
|
|
42
|
+
onError?: (error: Error) => void;
|
|
43
|
+
};
|
|
44
|
+
declare const createSubscription: <Document extends DocumentNode>(document: Document, variables: () => VariablesOf<Document>, options?: CreateSubscriptionOptions<Document>) => CreateSubscriptionReturn<Document>;
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/create-mutation.svelte.d.ts
|
|
47
|
+
type CreateMutationReturn<Document$1 extends DocumentNode> = {
|
|
48
|
+
data: undefined;
|
|
49
|
+
loading: true;
|
|
50
|
+
error: undefined;
|
|
51
|
+
mutate: (variables: VariablesOf<Document$1>) => Promise<DataOf<Document$1>>;
|
|
52
|
+
} | {
|
|
53
|
+
data: DataOf<Document$1>;
|
|
54
|
+
loading: false;
|
|
55
|
+
error: undefined;
|
|
56
|
+
mutate: (variables: VariablesOf<Document$1>) => Promise<DataOf<Document$1>>;
|
|
57
|
+
} | {
|
|
58
|
+
data: DataOf<Document$1> | undefined;
|
|
59
|
+
loading: false;
|
|
60
|
+
error: Error;
|
|
61
|
+
mutate: (variables: VariablesOf<Document$1>) => Promise<DataOf<Document$1>>;
|
|
62
|
+
};
|
|
63
|
+
declare const createMutation: <Document extends DocumentNode>(document: Document) => CreateMutationReturn<Document>;
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/create-fragment.svelte.d.ts
|
|
66
|
+
type CreateFragmentReturn<Document$1 extends DocumentNode> = DataOf<Document$1>;
|
|
67
|
+
declare const createFragment: <Document extends DocumentNode>(document: Document, fragmentRef: () => FragmentRef<Document>) => CreateFragmentReturn<Document>;
|
|
68
|
+
//#endregion
|
|
69
|
+
export { type CreateFragmentReturn, type CreateMutationReturn, type CreateQueryReturn, type CreateSubscriptionOptions, type CreateSubscriptionReturn, createFragment, createMutation, createQuery, createSubscription, getClient, setClient };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { getContext, setContext } from "svelte";
|
|
2
|
+
|
|
3
|
+
//#region src/client-context.svelte.ts
|
|
4
|
+
const CLIENT_KEY = Symbol("mearie-client");
|
|
5
|
+
const setClient = (client) => {
|
|
6
|
+
setContext(CLIENT_KEY, client);
|
|
7
|
+
};
|
|
8
|
+
const getClient = () => {
|
|
9
|
+
const client = getContext(CLIENT_KEY);
|
|
10
|
+
if (!client) throw new Error("getClient must be used within a context that has called setClient");
|
|
11
|
+
return client;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/create-query.svelte.ts
|
|
16
|
+
const createQuery = (document, variables) => {
|
|
17
|
+
let data = $state(void 0);
|
|
18
|
+
let loading = $state(true);
|
|
19
|
+
let error = $state(void 0);
|
|
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.svelte.ts
|
|
36
|
+
const createSubscription = (document, variables, options) => {
|
|
37
|
+
let data = $state(void 0);
|
|
38
|
+
let loading = $state(true);
|
|
39
|
+
let error = $state(void 0);
|
|
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.svelte.ts
|
|
55
|
+
const createMutation = (document) => {
|
|
56
|
+
let data = $state(void 0);
|
|
57
|
+
let loading = $state(false);
|
|
58
|
+
let error = $state(void 0);
|
|
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.svelte.ts
|
|
75
|
+
const createFragment = (document, fragmentRef) => {
|
|
76
|
+
return $derived.by(() => ({}));
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
//#endregion
|
|
80
|
+
export { createFragment, createMutation, createQuery, createSubscription, getClient, setClient };
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mearie/svelte",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Svelte integration for Mearie",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./src/index.svelte.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@mearie/client": "0.0.0"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"svelte": "^5.0.0",
|
|
16
|
+
"tsdown": "^0.15.7"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"svelte": "^5.0.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.svelte.d.ts",
|
|
31
|
+
"import": "./dist/index.svelte.js",
|
|
32
|
+
"require": "./dist/index.svelte.cjs"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { setClient, getClient } from './client-context.svelte.ts';
|
|
2
|
+
export { createQuery, type CreateQueryReturn } from './create-query.svelte.ts';
|
|
3
|
+
export {
|
|
4
|
+
createSubscription,
|
|
5
|
+
type CreateSubscriptionReturn,
|
|
6
|
+
type CreateSubscriptionOptions,
|
|
7
|
+
} from './create-subscription.svelte.ts';
|
|
8
|
+
export { createMutation, type CreateMutationReturn } from './create-mutation.svelte.ts';
|
|
9
|
+
export { createFragment, type CreateFragmentReturn } from './create-fragment.svelte.ts';
|