@graffiti-garden/wrapper-vue 0.1.7 → 0.2.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 CHANGED
@@ -1,25 +1,21 @@
1
1
  # Graffiti Wrapper for Vue.js
2
2
 
3
- This is a wrapper around the [Graffiti API](https://api.graffiti.garden/classes/Graffiti.html)
4
- as [Vue.js](https://vuejs.org/) plugin.
5
- It provides the following features:
6
- - A global Graffiti instance via the `$graffiti`
7
- [global property](https://vuejs.org/api/application.html#app-config-globalproperties)
8
- in templates and the Options API, or the `useGraffiti` [composable](https://vuejs.org/guide/reusability/composables.html)
9
- in the Composition API.
10
- - A `useGraffitiDiscover` [composable](https://vuejs.org/guide/reusability/composables.html)
11
- and a `GraffitiDiscover` [renderless component](https://vuejs.org/guide/components/slots#renderless-components)
12
- that produce a reactive arrays of objects from the results of [`discover`](https://api.graffiti.garden/classes/Graffiti.html#discover).
13
- - A reactive [`GraffitiSession`](https://api.graffiti.garden/interfaces/GraffitiSession.html) object
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/GrafittiPlugin.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 [PouchDB implementation](https://github.com/graffiti-garden/implementation-local)
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.js"
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 full examples of both with both methods in the [examples](./examples) directory,
65
- which are live [here](https://graffiti.garden/wrapper-vue/).
60
+ [See live examples of both methods](/examples).
@@ -24,3 +24,4 @@ export default _default;
24
24
  type __VLS_PrettifyLocal<T> = {
25
25
  [K in keyof T]: T[K];
26
26
  } & {};
27
+ //# sourceMappingURL=Discover.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Discover.vue.d.ts","sourceRoot":"","sources":["../src/Discover.vue"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;yBAGxD,MAAM,SAAS,WAAW,eAC7B,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;WA8D1D,mBAAmB,CAAC;kBA3Dd,MAAM,EAAE;gBACV,MAAM;kBACJ,eAAe,GAAG,IAAI;mBAyD0D,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;;;;;;;YA9BkB,GAAG;;UAgCzB,EAAE;OAGG,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AAxEzE,wBAwE4E;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
@@ -38,3 +38,4 @@ export default _default;
38
38
  type __VLS_PrettifyLocal<T> = {
39
39
  [K in keyof T]: T[K];
40
40
  } & {};
41
+ //# sourceMappingURL=Get.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Get.vue.d.ts","sourceRoot":"","sources":["../src/Get.vue"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EACR,gBAAgB,EAChB,eAAe,EACf,WAAW,EACd,MAAM,sBAAsB,CAAC;yBAGb,MAAM,SAAS,WAAW,eAC7B,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;WA8D1D,mBAAmB,CAAC;uBA3DT,MAAM,GAAG,gBAAgB;gBAChC,MAAM;kBACJ,eAAe,GAAG,IAAI;mBAyD0D,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;;;;;;;;;;;;;;;;;;;;;YA9BkB,GAAG;;UAgCzB,EAAE;OAGG,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AAxEzE,wBAwE4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -23,3 +23,4 @@ export default _default;
23
23
  type __VLS_PrettifyLocal<T> = {
24
24
  [K in keyof T]: T[K];
25
25
  } & {};
26
+ //# sourceMappingURL=RecoverOrphans.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecoverOrphans.vue.d.ts","sourceRoot":"","sources":["../src/RecoverOrphans.vue"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;yBAGxD,MAAM,SAAS,WAAW,eAC7B,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;WA4D1D,mBAAmB,CAAC;gBAzDhB,MAAM;iBACL,eAAe;mBAwDkE,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;;;;;;;YA9BkB,GAAG;;UAgCzB,EAAE;OAGG,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AAtEzE,wBAsE4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -1,47 +1,31 @@
1
1
  import { MaybeRefOrGetter } from 'vue';
2
2
  import { GraffitiLocation, GraffitiSession, JSONSchema4 } from '@graffiti-garden/api';
3
3
  /**
4
- * A reactive version of the [`Graffiti.discover`](https://api.graffiti.garden/classes/Graffiti.html#discover)
5
- * method. Its arguments are the same, but now they can be
6
- * reactive Vue refs or getters. As they change the output will
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
- * Rather than returning a stream of Graffiti objects, this
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
- * All [`tombstone`](https://api.graffiti.garden/interfaces/GraffitiObjectBase.html#tombstone)d
15
- * objects are filtered out.
16
- *
17
- * @returns An object containing
18
- * - `results`: a reactive array of Graffiti objects
19
- * - `poll`: a method to poll for new results
20
- * - `isPolling`: a boolean ref indicating if the poll is currently running
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 JSONSchema4>(channels: MaybeRefOrGetter<string[]>, schema: MaybeRefOrGetter<Schema>,
31
19
  /**
32
- * A [JSON Schema](https://json-schema.org/) object describing the schema
33
- * of the objects to discover. All other objects will be filtered out
34
- * and the output will be typed as `GraffitiObject<Schema>`.
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>): {
25
+ /**
26
+ * A [Ref](https://vuejs.org/api/reactivity-core.html#ref) that contains
27
+ * an array of Graffiti objects. All tombstoned objects have been filtered out.
28
+ */
45
29
  results: import('vue').Ref<import('@vue/reactivity').UnwrapRefSimple<import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
46
30
  tombstone: false;
47
31
  }>[], import('@vue/reactivity').UnwrapRefSimple<import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
@@ -49,48 +33,44 @@ session?: MaybeRefOrGetter<GraffitiSession | undefined | null>): {
49
33
  }>[] | (import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
50
34
  tombstone: false;
51
35
  })[]>;
36
+ /**
37
+ * A method to poll for new results.
38
+ */
52
39
  poll: () => Promise<void>;
40
+ /**
41
+ * A boolean [Ref](https://vuejs.org/api/reactivity-core.html#ref)
42
+ * that indicates if the poll is currently running.
43
+ * Useful to show a loading spinner or disable a button.
44
+ */
53
45
  isPolling: import('vue').Ref<boolean, boolean>;
54
46
  };
55
47
  /**
56
- * A reactive version of the [`Graffiti.get`](https://api.graffiti.garden/classes/Graffiti.html#get)
57
- * method. Its arguments are the same, but now they can be
58
- * reactive Vue refs or getters. As they change the output will
59
- * automatically update.
60
- *
61
- * Rather than returning a single Graffiti object, this
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.
48
+ * The [Graffiti.get](https://api.graffiti.garden/classes/Graffiti.html#get)
49
+ * method as a reactive [composable](https://vuejs.org/guide/reusability/composables.html)
50
+ * for use in the Vue [composition API](https://vuejs.org/guide/introduction.html#composition-api).
65
51
  *
66
- * While the object is first being fetched, the result
67
- * is `undefined`. If the object has been deleted,
68
- * the result is `null`. Otherwise, the result is the
69
- * most recent object fetched. All [`tombstone`](https://api.graffiti.garden/interfaces/GraffitiObjectBase.html#tombstone)d
70
- * objects are filtered out.
52
+ * Its corresponding renderless component is {@link GraffitiGet}.
71
53
  *
72
- * @returns An object containing
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.
80
- */
81
- locationOrUri: MaybeRefOrGetter<GraffitiLocation | string>,
82
- /**
83
- * A [JSON Schema](https://json-schema.org/) object describing the schema
84
- * of the objects to discover. All other objects will be filtered out
85
- * and the output will be typed as `GraffitiObject<Schema>`.
86
- * Like the `channels` argument, reactivity only triggers when
54
+ * The arguments of this composable as the same as Graffiti.get,
55
+ * only they can also be [Refs](https://vuejs.org/api/reactivity-core.html#ref)
56
+ * or [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get#description).
57
+ * As they change the output will automatically update.
58
+ * Reactivity only triggers when the root array or object changes,
59
+ * not when the elements or properties change.
60
+ * If you need deep reactivity, wrap your argument in a getter.
87
61
  */
88
- schema: MaybeRefOrGetter<Schema>,
62
+ export declare function useGraffitiGet<Schema extends JSONSchema4>(locationOrUri: MaybeRefOrGetter<GraffitiLocation | string>, schema: MaybeRefOrGetter<Schema>,
89
63
  /**
90
- * A Graffiti session object. If not provided, the
91
- * global plugin session will be used.
64
+ * If the session is `undefined`, the global session,
65
+ * {@link ComponentCustomProperties.$graffitiSession | $graffitiSession},
66
+ * will be used. Otherwise, the provided value will be used.
92
67
  */
93
68
  session?: MaybeRefOrGetter<GraffitiSession | undefined | null>): {
69
+ /**
70
+ * A [Ref](https://vuejs.org/api/reactivity-core.html#ref) that contains
71
+ * the retrieved Graffiti object, if it exists. If the object has been deleted,
72
+ * the result is `null`. If the object is still being fetched, the result is `undefined`.
73
+ */
94
74
  result: [(import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
95
75
  tombstone: false;
96
76
  }) | 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> & {
@@ -108,10 +88,37 @@ session?: MaybeRefOrGetter<GraffitiSession | undefined | null>): {
108
88
  }) | import('vue').UnwrapRef<import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
109
89
  tombstone: false;
110
90
  }> | null | undefined>;
91
+ /**
92
+ * A method to poll for new results.
93
+ */
111
94
  poll: () => Promise<void>;
95
+ /**
96
+ * A boolean [Ref](https://vuejs.org/api/reactivity-core.html#ref)
97
+ * that indicates if the poll is currently running.
98
+ * Useful to show a loading spinner or disable a button.
99
+ */
112
100
  isPolling: import('vue').Ref<boolean, boolean>;
113
101
  };
102
+ /**
103
+ * The [Graffiti.recoverOrphans](https://api.graffiti.garden/classes/Graffiti.html#recoverorphans)
104
+ * method as a reactive [composable](https://vuejs.org/guide/reusability/composables.html)
105
+ * for use in the Vue [composition API](https://vuejs.org/guide/introduction.html#composition-api).
106
+ *
107
+ * Its corresponding renderless component is {@link GraffitiRecoverOrphans}.
108
+ *
109
+ * The arguments of this composable as the same as Graffiti.get,
110
+ * only they can also be [Refs](https://vuejs.org/api/reactivity-core.html#ref)
111
+ * or [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get#description).
112
+ * As they change the output will automatically update.
113
+ * Reactivity only triggers when the root array or object changes,
114
+ * not when the elements or properties change.
115
+ * If you need deep reactivity, wrap your argument in a getter.
116
+ */
114
117
  export declare function useGraffitiRecoverOrphans<Schema extends JSONSchema4>(schema: MaybeRefOrGetter<Schema>, session: MaybeRefOrGetter<GraffitiSession>): {
118
+ /**
119
+ * A [Ref](https://vuejs.org/api/reactivity-core.html#ref) that contains
120
+ * an array of Graffiti objects. All tombstoned objects have been filtered out.
121
+ */
115
122
  results: import('vue').Ref<import('@vue/reactivity').UnwrapRefSimple<import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
116
123
  tombstone: false;
117
124
  }>[], import('@vue/reactivity').UnwrapRefSimple<import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
@@ -119,6 +126,15 @@ export declare function useGraffitiRecoverOrphans<Schema extends JSONSchema4>(sc
119
126
  }>[] | (import('@graffiti-garden/api').GraffitiObjectBase & import('ajv/dist/core').JTDDataType<Schema> & {
120
127
  tombstone: false;
121
128
  })[]>;
129
+ /**
130
+ * A method to poll for new results.
131
+ */
122
132
  poll: () => Promise<void>;
133
+ /**
134
+ * A boolean [Ref](https://vuejs.org/api/reactivity-core.html#ref)
135
+ * that indicates if the poll is currently running.
136
+ * Useful to show a loading spinner or disable a button.
137
+ */
123
138
  isPolling: import('vue').Ref<boolean, boolean>;
124
139
  };
140
+ //# sourceMappingURL=composables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composables.d.ts","sourceRoot":"","sources":["../src/composables.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,KAAK,CAAC;AACb,OAAO,KAAK,EACV,gBAAgB,EAEhB,eAAe,EACf,WAAW,EACZ,MAAM,sBAAsB,CAAC;AAgF9B;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,SAAS,WAAW,EAC5D,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;IAyB5D;;;OAGG;;;;;;;;IAEH;;OAEG;;IAEH;;;;OAIG;;EAGN;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,MAAM,SAAS,WAAW,EACvD,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;IA4B5D;;;;OAIG;;;;;;;;;;;;;;;;;;IAEH;;OAEG;;IAEH;;;;OAIG;;EAGN;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,SAAS,WAAW,EAClE,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAChC,OAAO,EAAE,gBAAgB,CAAC,eAAe,CAAC;IAwBxC;;;OAGG;;;;;;;;IAEH;;OAEG;;IAEH;;;;OAIG;;EAGN"}
@@ -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"}