@mearie/vue 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,81 @@
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 vue = require("vue");
25
+ vue = __toESM(vue);
26
+
27
+ //#region src/client-plugin.ts
28
+ const ClientKey = Symbol("mearie-client");
29
+ const ClientPlugin = { install(app, options) {
30
+ app.provide(ClientKey, options.client);
31
+ } };
32
+ const useClient = () => {
33
+ const client = (0, vue.inject)(ClientKey);
34
+ if (!client) throw new Error("useClient must be used within a ClientPlugin context");
35
+ return client;
36
+ };
37
+
38
+ //#endregion
39
+ //#region src/use-query.ts
40
+ const useQuery = (document, variables, options) => {
41
+ return {
42
+ data: (0, vue.ref)(void 0),
43
+ loading: (0, vue.ref)(true),
44
+ error: (0, vue.ref)(void 0),
45
+ refetch: () => {}
46
+ };
47
+ };
48
+
49
+ //#endregion
50
+ //#region src/use-subscription.ts
51
+ const useSubscription = (document, variables, options) => {
52
+ return {
53
+ data: (0, vue.ref)(void 0),
54
+ loading: (0, vue.ref)(true),
55
+ error: (0, vue.ref)(void 0)
56
+ };
57
+ };
58
+
59
+ //#endregion
60
+ //#region src/use-mutation.ts
61
+ const useMutation = (document) => {
62
+ return [async () => ({}), {
63
+ data: (0, vue.ref)(void 0),
64
+ loading: (0, vue.ref)(false),
65
+ error: (0, vue.ref)(void 0)
66
+ }];
67
+ };
68
+
69
+ //#endregion
70
+ //#region src/use-fragment.ts
71
+ const useFragment = (document, fragmentRef) => {
72
+ return (0, vue.computed)(() => ({}));
73
+ };
74
+
75
+ //#endregion
76
+ exports.ClientPlugin = ClientPlugin;
77
+ exports.useClient = useClient;
78
+ exports.useFragment = useFragment;
79
+ exports.useMutation = useMutation;
80
+ exports.useQuery = useQuery;
81
+ exports.useSubscription = useSubscription;
@@ -0,0 +1,76 @@
1
+ import { App, ComputedRef, MaybeRefOrGetter, Ref } from "vue";
2
+ import { Client, DataOf, DocumentNode, FragmentRef, VariablesOf } from "@mearie/core";
3
+
4
+ //#region src/client-plugin.d.ts
5
+ type ClientPluginOptions = {
6
+ client: Client;
7
+ };
8
+ declare const ClientPlugin: {
9
+ install(app: App, options: ClientPluginOptions): void;
10
+ };
11
+ declare const useClient: () => Client;
12
+ //#endregion
13
+ //#region src/use-query.d.ts
14
+ type UseQueryOptions = {
15
+ skip?: MaybeRefOrGetter<boolean>;
16
+ };
17
+ type UseQueryReturn<Document$1 extends DocumentNode> = {
18
+ data: Ref<undefined>;
19
+ loading: Ref<true>;
20
+ error: Ref<undefined>;
21
+ refetch: () => void;
22
+ } | {
23
+ data: Ref<DataOf<Document$1>>;
24
+ loading: Ref<false>;
25
+ error: Ref<undefined>;
26
+ refetch: () => void;
27
+ } | {
28
+ data: Ref<DataOf<Document$1> | undefined>;
29
+ loading: Ref<false>;
30
+ error: Ref<Error>;
31
+ refetch: () => void;
32
+ };
33
+ declare const useQuery: <Document extends DocumentNode>(document: Document, variables: MaybeRefOrGetter<VariablesOf<Document>>, options?: UseQueryOptions) => UseQueryReturn<Document>;
34
+ //#endregion
35
+ //#region src/use-subscription.d.ts
36
+ type UseSubscriptionReturn<Document$1 extends DocumentNode> = {
37
+ data: Ref<undefined>;
38
+ loading: Ref<true>;
39
+ error: Ref<undefined>;
40
+ } | {
41
+ data: Ref<DataOf<Document$1>>;
42
+ loading: Ref<false>;
43
+ error: Ref<undefined>;
44
+ } | {
45
+ data: Ref<DataOf<Document$1> | undefined>;
46
+ loading: Ref<false>;
47
+ error: Ref<Error>;
48
+ };
49
+ type UseSubscriptionOptions<Document$1 extends DocumentNode> = {
50
+ onData?: (data: DataOf<Document$1>) => void;
51
+ onError?: (error: Error) => void;
52
+ };
53
+ declare const useSubscription: <Document extends DocumentNode>(document: Document, variables: MaybeRefOrGetter<VariablesOf<Document>>, options?: UseSubscriptionOptions<Document>) => UseSubscriptionReturn<Document>;
54
+ //#endregion
55
+ //#region src/use-mutation.d.ts
56
+ type UseMutationResult<Document$1 extends DocumentNode> = {
57
+ data: Ref<undefined>;
58
+ loading: Ref<true>;
59
+ error: Ref<undefined>;
60
+ } | {
61
+ data: Ref<DataOf<Document$1>>;
62
+ loading: Ref<false>;
63
+ error: Ref<undefined>;
64
+ } | {
65
+ data: Ref<DataOf<Document$1> | undefined>;
66
+ loading: Ref<false>;
67
+ error: Ref<Error>;
68
+ };
69
+ type UseMutationReturn<Document$1 extends DocumentNode> = [(variables: VariablesOf<Document$1>) => Promise<DataOf<Document$1>>, UseMutationResult<Document$1>];
70
+ declare const useMutation: <Document extends DocumentNode>(document: Document) => UseMutationReturn<Document>;
71
+ //#endregion
72
+ //#region src/use-fragment.d.ts
73
+ type UseFragmentReturn<Document$1 extends DocumentNode> = ComputedRef<DataOf<Document$1>>;
74
+ declare const useFragment: <Document extends DocumentNode>(document: Document, fragmentRef: MaybeRefOrGetter<FragmentRef<Document>>) => UseFragmentReturn<Document>;
75
+ //#endregion
76
+ export { ClientPlugin, type ClientPluginOptions, type UseFragmentReturn, type UseMutationResult, type UseMutationReturn, type UseQueryOptions, type UseQueryReturn, type UseSubscriptionOptions, type UseSubscriptionReturn, useClient, useFragment, useMutation, useQuery, useSubscription };
@@ -0,0 +1,76 @@
1
+ import { App, ComputedRef, MaybeRefOrGetter, Ref } from "vue";
2
+ import { Client, DataOf, DocumentNode, FragmentRef, VariablesOf } from "@mearie/core";
3
+
4
+ //#region src/client-plugin.d.ts
5
+ type ClientPluginOptions = {
6
+ client: Client;
7
+ };
8
+ declare const ClientPlugin: {
9
+ install(app: App, options: ClientPluginOptions): void;
10
+ };
11
+ declare const useClient: () => Client;
12
+ //#endregion
13
+ //#region src/use-query.d.ts
14
+ type UseQueryOptions = {
15
+ skip?: MaybeRefOrGetter<boolean>;
16
+ };
17
+ type UseQueryReturn<Document$1 extends DocumentNode> = {
18
+ data: Ref<undefined>;
19
+ loading: Ref<true>;
20
+ error: Ref<undefined>;
21
+ refetch: () => void;
22
+ } | {
23
+ data: Ref<DataOf<Document$1>>;
24
+ loading: Ref<false>;
25
+ error: Ref<undefined>;
26
+ refetch: () => void;
27
+ } | {
28
+ data: Ref<DataOf<Document$1> | undefined>;
29
+ loading: Ref<false>;
30
+ error: Ref<Error>;
31
+ refetch: () => void;
32
+ };
33
+ declare const useQuery: <Document extends DocumentNode>(document: Document, variables: MaybeRefOrGetter<VariablesOf<Document>>, options?: UseQueryOptions) => UseQueryReturn<Document>;
34
+ //#endregion
35
+ //#region src/use-subscription.d.ts
36
+ type UseSubscriptionReturn<Document$1 extends DocumentNode> = {
37
+ data: Ref<undefined>;
38
+ loading: Ref<true>;
39
+ error: Ref<undefined>;
40
+ } | {
41
+ data: Ref<DataOf<Document$1>>;
42
+ loading: Ref<false>;
43
+ error: Ref<undefined>;
44
+ } | {
45
+ data: Ref<DataOf<Document$1> | undefined>;
46
+ loading: Ref<false>;
47
+ error: Ref<Error>;
48
+ };
49
+ type UseSubscriptionOptions<Document$1 extends DocumentNode> = {
50
+ onData?: (data: DataOf<Document$1>) => void;
51
+ onError?: (error: Error) => void;
52
+ };
53
+ declare const useSubscription: <Document extends DocumentNode>(document: Document, variables: MaybeRefOrGetter<VariablesOf<Document>>, options?: UseSubscriptionOptions<Document>) => UseSubscriptionReturn<Document>;
54
+ //#endregion
55
+ //#region src/use-mutation.d.ts
56
+ type UseMutationResult<Document$1 extends DocumentNode> = {
57
+ data: Ref<undefined>;
58
+ loading: Ref<true>;
59
+ error: Ref<undefined>;
60
+ } | {
61
+ data: Ref<DataOf<Document$1>>;
62
+ loading: Ref<false>;
63
+ error: Ref<undefined>;
64
+ } | {
65
+ data: Ref<DataOf<Document$1> | undefined>;
66
+ loading: Ref<false>;
67
+ error: Ref<Error>;
68
+ };
69
+ type UseMutationReturn<Document$1 extends DocumentNode> = [(variables: VariablesOf<Document$1>) => Promise<DataOf<Document$1>>, UseMutationResult<Document$1>];
70
+ declare const useMutation: <Document extends DocumentNode>(document: Document) => UseMutationReturn<Document>;
71
+ //#endregion
72
+ //#region src/use-fragment.d.ts
73
+ type UseFragmentReturn<Document$1 extends DocumentNode> = ComputedRef<DataOf<Document$1>>;
74
+ declare const useFragment: <Document extends DocumentNode>(document: Document, fragmentRef: MaybeRefOrGetter<FragmentRef<Document>>) => UseFragmentReturn<Document>;
75
+ //#endregion
76
+ export { ClientPlugin, type ClientPluginOptions, type UseFragmentReturn, type UseMutationResult, type UseMutationReturn, type UseQueryOptions, type UseQueryReturn, type UseSubscriptionOptions, type UseSubscriptionReturn, useClient, useFragment, useMutation, useQuery, useSubscription };
package/dist/index.js ADDED
@@ -0,0 +1,52 @@
1
+ import { computed, inject, ref } from "vue";
2
+
3
+ //#region src/client-plugin.ts
4
+ const ClientKey = Symbol("mearie-client");
5
+ const ClientPlugin = { install(app, options) {
6
+ app.provide(ClientKey, options.client);
7
+ } };
8
+ const useClient = () => {
9
+ const client = inject(ClientKey);
10
+ if (!client) throw new Error("useClient must be used within a ClientPlugin context");
11
+ return client;
12
+ };
13
+
14
+ //#endregion
15
+ //#region src/use-query.ts
16
+ const useQuery = (document, variables, options) => {
17
+ return {
18
+ data: ref(void 0),
19
+ loading: ref(true),
20
+ error: ref(void 0),
21
+ refetch: () => {}
22
+ };
23
+ };
24
+
25
+ //#endregion
26
+ //#region src/use-subscription.ts
27
+ const useSubscription = (document, variables, options) => {
28
+ return {
29
+ data: ref(void 0),
30
+ loading: ref(true),
31
+ error: ref(void 0)
32
+ };
33
+ };
34
+
35
+ //#endregion
36
+ //#region src/use-mutation.ts
37
+ const useMutation = (document) => {
38
+ return [async () => ({}), {
39
+ data: ref(void 0),
40
+ loading: ref(false),
41
+ error: ref(void 0)
42
+ }];
43
+ };
44
+
45
+ //#endregion
46
+ //#region src/use-fragment.ts
47
+ const useFragment = (document, fragmentRef) => {
48
+ return computed(() => ({}));
49
+ };
50
+
51
+ //#endregion
52
+ export { ClientPlugin, useClient, useFragment, useMutation, useQuery, useSubscription };
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@mearie/vue",
3
+ "version": "0.0.0",
4
+ "description": "Vue 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
+ "tsdown": "^0.15.7",
16
+ "vue": "^3.5.0"
17
+ },
18
+ "peerDependencies": {
19
+ "vue": "^3.3.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,5 @@
1
+ export { ClientPlugin, useClient, type ClientPluginOptions } from './client-plugin.ts';
2
+ export { useQuery, type UseQueryOptions, type UseQueryReturn } from './use-query.ts';
3
+ export { useSubscription, type UseSubscriptionReturn, type UseSubscriptionOptions } from './use-subscription.ts';
4
+ export { useMutation, type UseMutationResult, type UseMutationReturn } from './use-mutation.ts';
5
+ export { useFragment, type UseFragmentReturn } from './use-fragment.ts';