@graffiti-garden/wrapper-vue 0.1.7 → 0.3.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/README.md +14 -19
- package/dist/Discover.vue.d.ts +13 -8
- package/dist/Discover.vue.d.ts.map +1 -0
- package/dist/Get.vue.d.ts +13 -22
- package/dist/Get.vue.d.ts.map +1 -0
- package/dist/RecoverOrphans.vue.d.ts +13 -8
- package/dist/RecoverOrphans.vue.d.ts.map +1 -0
- package/dist/composables.d.ts +55 -100
- package/dist/composables.d.ts.map +1 -0
- package/dist/globals.d.ts +43 -0
- package/dist/globals.d.ts.map +1 -0
- package/dist/plugin.d.ts +267 -14
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +30 -1
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs +6061 -186
- package/dist/plugin.mjs.map +1 -1
- package/dist/pollers.d.ts +5 -4
- package/dist/pollers.d.ts.map +1 -0
- package/dist/reducers.d.ts +10 -26
- package/dist/reducers.d.ts.map +1 -0
- package/package.json +10 -6
- package/src/Discover.vue +14 -2
- package/src/Get.vue +11 -2
- package/src/RecoverOrphans.vue +14 -2
- package/src/composables.ts +116 -89
- package/src/globals.ts +67 -0
- package/src/plugin.ts +156 -16
- package/src/pollers.ts +23 -18
- package/src/reducers.ts +19 -11
- package/dist/injections.d.ts +0 -6
- package/src/injections.ts +0 -24
package/README.md
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
# Graffiti Wrapper for Vue.js
|
|
2
2
|
|
|
3
|
-
This is a
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
in
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
that holds the user's most recent log-in state announced
|
|
15
|
-
from [`sessionEvents`](https://api.graffiti.garden/classes/Graffiti.html#sessionevents).
|
|
16
|
-
It is accessible via the `$graffitiSession` global property in templates and the Options API,
|
|
17
|
-
or the `useGraffitiSession` composable in the Composition API.
|
|
3
|
+
This is a [Vue.js](https://vuejs.org/) plugin that wraps around
|
|
4
|
+
the [Graffiti API](https://api.graffiti.garden/classes/Graffiti.html)
|
|
5
|
+
to provide [reactive](https://en.wikipedia.org/wiki/Reactive_programming) versions
|
|
6
|
+
of various Graffiti API methods.
|
|
7
|
+
These reactive methods are available as both
|
|
8
|
+
[renderless components](https://vuejs.org/guide/components/slots#renderless-components),
|
|
9
|
+
which make it possible to create a whole Graffiti app in an HTML template,
|
|
10
|
+
and [composables](https://vuejs.org/guide/reusability/composables.html),
|
|
11
|
+
which can be used in the programmatic [composition API](https://vuejs.org/guide/extras/composition-api-faq.html).
|
|
12
|
+
|
|
13
|
+
[**Read the API documentation**](https://vue.graffiti.garden/variables/GraffitiPlugin.html).
|
|
18
14
|
|
|
19
15
|
## Installation
|
|
20
16
|
|
|
21
17
|
You must install this package along with Vue.js and an implementation of the Graffiti API.
|
|
22
|
-
In this example, we will use the [
|
|
18
|
+
In this example, we will use the [local implementation](https://github.com/graffiti-garden/implementation-local)
|
|
23
19
|
of the Graffiti API, but any other would be similar.
|
|
24
20
|
In node.js, simply install them with npm:
|
|
25
21
|
|
|
@@ -40,7 +36,7 @@ Add an import map the the `<head>` of your HTML file:
|
|
|
40
36
|
"imports": {
|
|
41
37
|
"vue": "https://cdn.jsdelivr.net/npm/vue/dist/vue.esm-browser.js",
|
|
42
38
|
"@graffiti-garden/implementation-local": "https://cdn.jsdelivr.net/npm/@graffiti-garden/implementation-local/dist/index.browser.js",
|
|
43
|
-
"@graffiti-garden/wrapper-vue": "https://cdn.jsdelivr.net/npm/@graffiti-garden/wrapper-vue/dist/plugin.
|
|
39
|
+
"@graffiti-garden/wrapper-vue": "https://cdn.jsdelivr.net/npm/@graffiti-garden/wrapper-vue/dist/plugin.mjs"
|
|
44
40
|
}
|
|
45
41
|
}
|
|
46
42
|
</script>
|
|
@@ -61,5 +57,4 @@ createApp({})
|
|
|
61
57
|
.mount("#app");
|
|
62
58
|
```
|
|
63
59
|
|
|
64
|
-
See
|
|
65
|
-
which are live [here](https://graffiti.garden/wrapper-vue/).
|
|
60
|
+
[See live examples of both methods](https://vue.graffiti.garden/examples/)
|
package/dist/Discover.vue.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GraffitiSession,
|
|
2
|
-
declare const _default: <Schema extends
|
|
1
|
+
import { GraffitiSession, JSONSchema, GraffitiObject } from '@graffiti-garden/api';
|
|
2
|
+
declare const _default: <Schema extends JSONSchema>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & {
|
|
4
4
|
channels: string[];
|
|
5
5
|
schema: Schema;
|
|
@@ -7,12 +7,16 @@ declare const _default: <Schema extends JSONSchema4>(__VLS_props: NonNullable<Aw
|
|
|
7
7
|
} & Partial<{}>> & import('vue').PublicProps;
|
|
8
8
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
9
9
|
attrs: any;
|
|
10
|
-
slots: {
|
|
11
|
-
default?(
|
|
12
|
-
results:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
slots: Readonly<{
|
|
11
|
+
default?(props: {
|
|
12
|
+
results: GraffitiObject<Schema>[];
|
|
13
|
+
poll: () => void;
|
|
14
|
+
isPolling: boolean;
|
|
15
|
+
}): any;
|
|
16
|
+
}> & {
|
|
17
|
+
default?(props: {
|
|
18
|
+
results: GraffitiObject<Schema>[];
|
|
19
|
+
poll: () => void;
|
|
16
20
|
isPolling: boolean;
|
|
17
21
|
}): any;
|
|
18
22
|
};
|
|
@@ -24,3 +28,4 @@ export default _default;
|
|
|
24
28
|
type __VLS_PrettifyLocal<T> = {
|
|
25
29
|
[K in keyof T]: T[K];
|
|
26
30
|
} & {};
|
|
31
|
+
//# sourceMappingURL=Discover.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Discover.vue.d.ts","sourceRoot":"","sources":["../src/Discover.vue"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EACR,eAAe,EACf,UAAU,EACV,cAAc,EACjB,MAAM,sBAAsB,CAAC;yBAGb,MAAM,SAAS,UAAU,eAC5B,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WAmE1D,mBAAmB,CAAC;kBAhEd,MAAM,EAAE;gBACV,MAAM;kBACJ,eAAe,GAAG,IAAI;mBA8D0D,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;wBA3DS;YACZ,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;YAClC,IAAI,EAAE,MAAM,IAAI,CAAC;YACjB,SAAS,EAAE,OAAO,CAAC;SACtB,GAAG,GAAG;;wBAJS;YACZ,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;YAClC,IAAI,EAAE,MAAM,IAAI,CAAC;YACjB,SAAS,EAAE,OAAO,CAAC;SACtB,GAAG,GAAG;;UAyDJ,EAAE;OAGG,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AA7EzE,wBA6E4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
package/dist/Get.vue.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GraffitiLocation, GraffitiSession,
|
|
2
|
-
declare const _default: <Schema extends
|
|
1
|
+
import { GraffitiLocation, GraffitiObject, GraffitiSession, JSONSchema } from '@graffiti-garden/api';
|
|
2
|
+
declare const _default: <Schema extends JSONSchema>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & {
|
|
4
4
|
locationOrUri: string | GraffitiLocation;
|
|
5
5
|
schema: Schema;
|
|
@@ -7,26 +7,16 @@ declare const _default: <Schema extends JSONSchema4>(__VLS_props: NonNullable<Aw
|
|
|
7
7
|
} & Partial<{}>> & import('vue').PublicProps;
|
|
8
8
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
9
9
|
attrs: any;
|
|
10
|
-
slots: {
|
|
11
|
-
default?(
|
|
12
|
-
result:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}>, import('vue').Ref<any, any> & import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
|
|
21
|
-
tombstone: false;
|
|
22
|
-
}> : import('vue').Ref<import('vue').UnwrapRef<import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
|
|
23
|
-
tombstone: false;
|
|
24
|
-
}> | null | undefined, (import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
|
|
25
|
-
tombstone: false;
|
|
26
|
-
}) | import('vue').UnwrapRef<import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
|
|
27
|
-
tombstone: false;
|
|
28
|
-
}> | null | undefined>>;
|
|
29
|
-
poll: () => Promise<void>;
|
|
10
|
+
slots: Readonly<{
|
|
11
|
+
default?(props: {
|
|
12
|
+
result: GraffitiObject<Schema> | undefined | null;
|
|
13
|
+
poll: () => void;
|
|
14
|
+
isPolling: boolean;
|
|
15
|
+
}): any;
|
|
16
|
+
}> & {
|
|
17
|
+
default?(props: {
|
|
18
|
+
result: GraffitiObject<Schema> | undefined | null;
|
|
19
|
+
poll: () => void;
|
|
30
20
|
isPolling: boolean;
|
|
31
21
|
}): any;
|
|
32
22
|
};
|
|
@@ -38,3 +28,4 @@ export default _default;
|
|
|
38
28
|
type __VLS_PrettifyLocal<T> = {
|
|
39
29
|
[K in keyof T]: T[K];
|
|
40
30
|
} & {};
|
|
31
|
+
//# sourceMappingURL=Get.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Get.vue.d.ts","sourceRoot":"","sources":["../src/Get.vue"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EACR,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,UAAU,EACb,MAAM,sBAAsB,CAAC;yBAGb,MAAM,SAAS,UAAU,eAC5B,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WAmE1D,mBAAmB,CAAC;uBAhET,MAAM,GAAG,gBAAgB;gBAChC,MAAM;kBACJ,eAAe,GAAG,IAAI;mBA8D0D,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;wBA3DS;YACZ,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC;YAClD,IAAI,EAAE,MAAM,IAAI,CAAC;YACjB,SAAS,EAAE,OAAO,CAAC;SACtB,GAAG,GAAG;;wBAJS;YACZ,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC;YAClD,IAAI,EAAE,MAAM,IAAI,CAAC;YACjB,SAAS,EAAE,OAAO,CAAC;SACtB,GAAG,GAAG;;UAyDJ,EAAE;OAGG,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AA7EzE,wBA6E4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import { GraffitiSession,
|
|
2
|
-
declare const _default: <Schema extends
|
|
1
|
+
import { GraffitiSession, JSONSchema, GraffitiObject } from '@graffiti-garden/api';
|
|
2
|
+
declare const _default: <Schema extends JSONSchema>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & {
|
|
4
4
|
schema: Schema;
|
|
5
5
|
session: GraffitiSession;
|
|
6
6
|
} & Partial<{}>> & import('vue').PublicProps;
|
|
7
7
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
8
8
|
attrs: any;
|
|
9
|
-
slots: {
|
|
10
|
-
default?(
|
|
11
|
-
results:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
slots: Readonly<{
|
|
10
|
+
default?(props: {
|
|
11
|
+
results: GraffitiObject<Schema>[];
|
|
12
|
+
poll: () => void;
|
|
13
|
+
isPolling: boolean;
|
|
14
|
+
}): any;
|
|
15
|
+
}> & {
|
|
16
|
+
default?(props: {
|
|
17
|
+
results: GraffitiObject<Schema>[];
|
|
18
|
+
poll: () => void;
|
|
15
19
|
isPolling: boolean;
|
|
16
20
|
}): any;
|
|
17
21
|
};
|
|
@@ -23,3 +27,4 @@ export default _default;
|
|
|
23
27
|
type __VLS_PrettifyLocal<T> = {
|
|
24
28
|
[K in keyof T]: T[K];
|
|
25
29
|
} & {};
|
|
30
|
+
//# sourceMappingURL=RecoverOrphans.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecoverOrphans.vue.d.ts","sourceRoot":"","sources":["../src/RecoverOrphans.vue"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EACR,eAAe,EACf,UAAU,EACV,cAAc,EACjB,MAAM,sBAAsB,CAAC;yBAGb,MAAM,SAAS,UAAU,eAC5B,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WAiE1D,mBAAmB,CAAC;gBA9DhB,MAAM;iBACL,eAAe;mBA6DkE,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;wBA1DS;YACZ,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;YAClC,IAAI,EAAE,MAAM,IAAI,CAAC;YACjB,SAAS,EAAE,OAAO,CAAC;SACtB,GAAG,GAAG;;wBAJS;YACZ,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;YAClC,IAAI,EAAE,MAAM,IAAI,CAAC;YACjB,SAAS,EAAE,OAAO,CAAC;SACtB,GAAG,GAAG;;UAwDJ,EAAE;OAGG,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AA3EzE,wBA2E4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
package/dist/composables.d.ts
CHANGED
|
@@ -1,124 +1,79 @@
|
|
|
1
|
-
import { MaybeRefOrGetter } from 'vue';
|
|
2
|
-
import { GraffitiLocation, GraffitiSession,
|
|
1
|
+
import { Ref, MaybeRefOrGetter } from 'vue';
|
|
2
|
+
import { GraffitiLocation, GraffitiObject, GraffitiSession, JSONSchema } from '@graffiti-garden/api';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* method
|
|
6
|
-
*
|
|
7
|
-
* automatically update.
|
|
4
|
+
* The [Graffiti.discover](https://api.graffiti.garden/classes/Graffiti.html#discover)
|
|
5
|
+
* method as a reactive [composable](https://vuejs.org/guide/reusability/composables.html)
|
|
6
|
+
* for use in the Vue [composition API](https://vuejs.org/guide/introduction.html#composition-api).
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
* function returns a reactive array of objects. It also
|
|
11
|
-
* provides a method to poll for new results and a boolean
|
|
12
|
-
* ref indicating if the poll is currently running.
|
|
8
|
+
* Its corresponding renderless component is {@link GraffitiDiscover}.
|
|
13
9
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
export declare function useGraffitiDiscover<Schema extends JSONSchema4>(
|
|
23
|
-
/**
|
|
24
|
-
* A list of channels to discover objects from.
|
|
25
|
-
* Reactivity will only trigger
|
|
26
|
-
* when the root array changes, not when the elements
|
|
27
|
-
* change. If you need reactivity on the elements,
|
|
28
|
-
* create a getter, e.g. `() => [toValue(myReactiveChannel)]`.
|
|
10
|
+
* The arguments of this composable as the same as Graffiti.discover,
|
|
11
|
+
* only they can also be [Refs](https://vuejs.org/api/reactivity-core.html#ref)
|
|
12
|
+
* or [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get#description).
|
|
13
|
+
* As they change the output will automatically update.
|
|
14
|
+
* Reactivity only triggers when the root array or object changes,
|
|
15
|
+
* not when the elements or properties change.
|
|
16
|
+
* If you need deep reactivity, wrap your argument in a getter.
|
|
29
17
|
*/
|
|
30
|
-
channels: MaybeRefOrGetter<string[]>,
|
|
18
|
+
export declare function useGraffitiDiscover<Schema extends JSONSchema>(channels: MaybeRefOrGetter<string[]>, schema: MaybeRefOrGetter<Schema>,
|
|
31
19
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* Reactivity only triggers when the root object changes, not when
|
|
36
|
-
* the root object changes, not when the properties change.
|
|
37
|
-
* Create a getter if you need reactivity on the properties.
|
|
38
|
-
*/
|
|
39
|
-
schema: MaybeRefOrGetter<Schema>,
|
|
40
|
-
/**
|
|
41
|
-
* A Graffiti session object. If not provided, the
|
|
42
|
-
* global plugin session will be used.
|
|
20
|
+
* If the session is `undefined`, the global session,
|
|
21
|
+
* {@link ComponentCustomProperties.$graffitiSession | $graffitiSession},
|
|
22
|
+
* will be used. Otherwise, the provided value will be used.
|
|
43
23
|
*/
|
|
44
24
|
session?: MaybeRefOrGetter<GraffitiSession | undefined | null>): {
|
|
45
|
-
results:
|
|
46
|
-
tombstone: false;
|
|
47
|
-
}>[], import('@vue/reactivity').UnwrapRefSimple<import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
|
|
48
|
-
tombstone: false;
|
|
49
|
-
}>[] | (import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
|
|
25
|
+
results: Ref<(GraffitiObject<Schema> & {
|
|
50
26
|
tombstone: false;
|
|
51
27
|
})[]>;
|
|
52
28
|
poll: () => Promise<void>;
|
|
53
|
-
isPolling:
|
|
29
|
+
isPolling: Ref<boolean>;
|
|
54
30
|
};
|
|
55
31
|
/**
|
|
56
|
-
*
|
|
57
|
-
* method
|
|
58
|
-
*
|
|
59
|
-
* automatically update.
|
|
32
|
+
* The [Graffiti.get](https://api.graffiti.garden/classes/Graffiti.html#get)
|
|
33
|
+
* method as a reactive [composable](https://vuejs.org/guide/reusability/composables.html)
|
|
34
|
+
* for use in the Vue [composition API](https://vuejs.org/guide/introduction.html#composition-api).
|
|
60
35
|
*
|
|
61
|
-
*
|
|
62
|
-
* function returns a reactive object. It also
|
|
63
|
-
* provides a method to poll for new results and a boolean
|
|
64
|
-
* ref indicating if the poll is currently running.
|
|
36
|
+
* Its corresponding renderless component is {@link GraffitiGet}.
|
|
65
37
|
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* - `results`: a reactive array of Graffiti objects
|
|
74
|
-
* - `poll`: a method to poll for new results
|
|
75
|
-
* - `isPolling`: a boolean ref indicating if the poll is currently running
|
|
76
|
-
*/
|
|
77
|
-
export declare function useGraffitiGet<Schema extends JSONSchema4>(
|
|
78
|
-
/**
|
|
79
|
-
* A Graffiti location or URI to fetch the object from.
|
|
38
|
+
* The arguments of this composable as the same as Graffiti.get,
|
|
39
|
+
* only they can also be [Refs](https://vuejs.org/api/reactivity-core.html#ref)
|
|
40
|
+
* or [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get#description).
|
|
41
|
+
* As they change the output will automatically update.
|
|
42
|
+
* Reactivity only triggers when the root array or object changes,
|
|
43
|
+
* not when the elements or properties change.
|
|
44
|
+
* If you need deep reactivity, wrap your argument in a getter.
|
|
80
45
|
*/
|
|
81
|
-
locationOrUri: MaybeRefOrGetter<GraffitiLocation | string>,
|
|
46
|
+
export declare function useGraffitiGet<Schema extends JSONSchema>(locationOrUri: MaybeRefOrGetter<GraffitiLocation | string>, schema: MaybeRefOrGetter<Schema>,
|
|
82
47
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* Like the `channels` argument, reactivity only triggers when
|
|
87
|
-
*/
|
|
88
|
-
schema: MaybeRefOrGetter<Schema>,
|
|
89
|
-
/**
|
|
90
|
-
* A Graffiti session object. If not provided, the
|
|
91
|
-
* global plugin session will be used.
|
|
48
|
+
* If the session is `undefined`, the global session,
|
|
49
|
+
* {@link ComponentCustomProperties.$graffitiSession | $graffitiSession},
|
|
50
|
+
* will be used. Otherwise, the provided value will be used.
|
|
92
51
|
*/
|
|
93
52
|
session?: MaybeRefOrGetter<GraffitiSession | undefined | null>): {
|
|
94
|
-
result:
|
|
95
|
-
tombstone: false;
|
|
96
|
-
}) | null | undefined] extends [import('vue').Ref<any, any>] ? import('@vue/shared').IfAny<import('vue').Ref<any, any> & import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
|
|
97
|
-
tombstone: false;
|
|
98
|
-
}, import('vue').Ref<import('vue').Ref<any, any> & import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
|
|
99
|
-
tombstone: false;
|
|
100
|
-
}, import('vue').Ref<any, any> & import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
|
|
101
|
-
tombstone: false;
|
|
102
|
-
}>, import('vue').Ref<any, any> & import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
|
|
103
|
-
tombstone: false;
|
|
104
|
-
}> : import('vue').Ref<import('vue').UnwrapRef<import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
|
|
105
|
-
tombstone: false;
|
|
106
|
-
}> | null | undefined, (import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
|
|
107
|
-
tombstone: false;
|
|
108
|
-
}) | import('vue').UnwrapRef<import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
|
|
109
|
-
tombstone: false;
|
|
110
|
-
}> | null | undefined>;
|
|
53
|
+
result: Ref<GraffitiObject<Schema> | null | undefined>;
|
|
111
54
|
poll: () => Promise<void>;
|
|
112
|
-
isPolling:
|
|
55
|
+
isPolling: Ref<boolean>;
|
|
113
56
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
57
|
+
/**
|
|
58
|
+
* The [Graffiti.recoverOrphans](https://api.graffiti.garden/classes/Graffiti.html#recoverorphans)
|
|
59
|
+
* method as a reactive [composable](https://vuejs.org/guide/reusability/composables.html)
|
|
60
|
+
* for use in the Vue [composition API](https://vuejs.org/guide/introduction.html#composition-api).
|
|
61
|
+
*
|
|
62
|
+
* Its corresponding renderless component is {@link GraffitiRecoverOrphans}.
|
|
63
|
+
*
|
|
64
|
+
* The arguments of this composable as the same as Graffiti.get,
|
|
65
|
+
* only they can also be [Refs](https://vuejs.org/api/reactivity-core.html#ref)
|
|
66
|
+
* or [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get#description).
|
|
67
|
+
* As they change the output will automatically update.
|
|
68
|
+
* Reactivity only triggers when the root array or object changes,
|
|
69
|
+
* not when the elements or properties change.
|
|
70
|
+
* If you need deep reactivity, wrap your argument in a getter.
|
|
71
|
+
*/
|
|
72
|
+
export declare function useGraffitiRecoverOrphans<Schema extends JSONSchema>(schema: MaybeRefOrGetter<Schema>, session: MaybeRefOrGetter<GraffitiSession>): {
|
|
73
|
+
results: Ref<(GraffitiObject<Schema> & {
|
|
120
74
|
tombstone: false;
|
|
121
75
|
})[]>;
|
|
122
76
|
poll: () => Promise<void>;
|
|
123
|
-
isPolling:
|
|
77
|
+
isPolling: Ref<boolean>;
|
|
124
78
|
};
|
|
79
|
+
//# sourceMappingURL=composables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composables.d.ts","sourceRoot":"","sources":["../src/composables.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AACjD,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,UAAU,EAEX,MAAM,sBAAsB,CAAC;AA+E9B;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,SAAS,UAAU,EAC3D,QAAQ,EAAE,gBAAgB,CAAC,MAAM,EAAE,CAAC,EACpC,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC;AAChC;;;;GAIG;AACH,OAAO,CAAC,EAAE,gBAAgB,CAAC,eAAe,GAAG,SAAS,GAAG,IAAI,CAAC,GAC7D;IACD,OAAO,EAAE,GAAG,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG;QAAE,SAAS,EAAE,KAAK,CAAA;KAAE,CAAC,EAAE,CAAC,CAAC;IAChE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;CACzB,CAwCA;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,MAAM,SAAS,UAAU,EACtD,aAAa,EAAE,gBAAgB,CAAC,gBAAgB,GAAG,MAAM,CAAC,EAC1D,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC;AAChC;;;;GAIG;AACH,OAAO,CAAC,EAAE,gBAAgB,CAAC,eAAe,GAAG,SAAS,GAAG,IAAI,CAAC,GAC7D;IACD,MAAM,EAAE,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IACvD,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;CACzB,CA6CA;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,SAAS,UAAU,EACjE,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAChC,OAAO,EAAE,gBAAgB,CAAC,eAAe,CAAC,GACzC;IACD,OAAO,EAAE,GAAG,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG;QAAE,SAAS,EAAE,KAAK,CAAA;KAAE,CAAC,EAAE,CAAC,CAAC;IAChE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;CACzB,CAuCA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { InjectionKey, Ref } from 'vue';
|
|
2
|
+
import { Graffiti, GraffitiSession } from '@graffiti-garden/api';
|
|
3
|
+
import { GraffitiSynchronize } from '@graffiti-garden/wrapper-synchronize';
|
|
4
|
+
export declare const graffitiInjectKey: InjectionKey<GraffitiSynchronize>;
|
|
5
|
+
export declare const graffitiSessionInjectKey: InjectionKey<Ref<GraffitiSession | undefined | null>>;
|
|
6
|
+
/**
|
|
7
|
+
* Returns the global [Graffiti](https://api.graffiti.garden/classes/Graffiti.html) instance
|
|
8
|
+
* that has been wrapped by the {@link GraffitiPlugin} with the [GraffitiSynchronize](https://sync.graffiti.garden/classes/GraffitiSynchronize.html).
|
|
9
|
+
* @throws If the {@link GraffitiPlugin} is not installed
|
|
10
|
+
*/
|
|
11
|
+
export declare function useGraffitiSynchronize(): GraffitiSynchronize;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the global [Graffiti](https://api.graffiti.garden/classes/Graffiti.html) instance.
|
|
14
|
+
*
|
|
15
|
+
* In Vue templates and the [options API](https://vuejs.org/guide/introduction.html#options-api)
|
|
16
|
+
* use the global variable {@link ComponentCustomProperties.$graffiti | $graffiti} instead.
|
|
17
|
+
*
|
|
18
|
+
* This is the same Graffiti registered with the {@link GraffitiPlugin}
|
|
19
|
+
* via {@link GraffitiPluginOptions.graffiti}, only it has been wrapped
|
|
20
|
+
* with [GraffitiSynchronize](https://sync.graffiti.garden/classes/GraffitiSynchronize.html).
|
|
21
|
+
* Be sure to use the wrapped instance to enable reactivity.
|
|
22
|
+
*
|
|
23
|
+
* @throws If the {@link GraffitiPlugin} is not installed
|
|
24
|
+
*/
|
|
25
|
+
export declare function useGraffiti(): Graffiti;
|
|
26
|
+
/**
|
|
27
|
+
* Returns a global reactive [GraffitiSession](https://api.graffiti.garden/interfaces/GraffitiSession.html) instance
|
|
28
|
+
* as a [Vue ref](https://vuejs.org/api/reactivity-core.html#ref).
|
|
29
|
+
*
|
|
30
|
+
* In Vue templates and the [options API](https://vuejs.org/guide/introduction.html#options-api)
|
|
31
|
+
* use the global variable {@link ComponentCustomProperties.$graffitiSession | $graffitiSession} instead.
|
|
32
|
+
*
|
|
33
|
+
* While the application is loading and restoring any previous sessions,
|
|
34
|
+
* the value will be `undefined`. If the user is not logged in,
|
|
35
|
+
* the value will be `null`.
|
|
36
|
+
*
|
|
37
|
+
* This only keeps track of one session. If your app needs
|
|
38
|
+
* to support multiple login sessions, you'll need to manage them
|
|
39
|
+
* yourself using [`Graffiti.sessionEvents`](https://api.graffiti.garden/classes/Graffiti.html#sessionevents).
|
|
40
|
+
* @throws If the {@link GraffitiPlugin} is not installed
|
|
41
|
+
*/
|
|
42
|
+
export declare function useGraffitiSession(): Ref<GraffitiSession | null | undefined, GraffitiSession | null | undefined>;
|
|
43
|
+
//# sourceMappingURL=globals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../src/globals.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAEhF,eAAO,MAAM,iBAAiB,EAAe,YAAY,CAAC,mBAAmB,CAAC,CAAC;AAC/E,eAAO,MAAM,wBAAwB,EAAe,YAAY,CAC9D,GAAG,CAAC,eAAe,GAAG,SAAS,GAAG,IAAI,CAAC,CACxC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,sBAAsB,wBAQrC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CAEtC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,gFAQjC"}
|