@instantdb/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.
Files changed (50) hide show
  1. package/README.md +62 -0
  2. package/dist/InstantVueDatabase.d.ts +189 -0
  3. package/dist/InstantVueDatabase.d.ts.map +1 -0
  4. package/dist/InstantVueDatabase.js +265 -0
  5. package/dist/InstantVueDatabase.js.map +1 -0
  6. package/dist/InstantVueRoom.d.ts +84 -0
  7. package/dist/InstantVueRoom.d.ts.map +1 -0
  8. package/dist/InstantVueRoom.js +180 -0
  9. package/dist/InstantVueRoom.js.map +1 -0
  10. package/dist/chunks/Cursor.vue_vue_type_script_setup_true_lang-DeM0moKd.js +32 -0
  11. package/dist/chunks/Cursor.vue_vue_type_script_setup_true_lang-DeM0moKd.js.map +1 -0
  12. package/dist/chunks/Cursors.vue_vue_type_script_setup_true_lang-C6eE1KRI.js +128 -0
  13. package/dist/chunks/Cursors.vue_vue_type_script_setup_true_lang-C6eE1KRI.js.map +1 -0
  14. package/dist/chunks/SignedIn.vue_vue_type_script_setup_true_lang-MJrQPE2B.js +18 -0
  15. package/dist/chunks/SignedIn.vue_vue_type_script_setup_true_lang-MJrQPE2B.js.map +1 -0
  16. package/dist/chunks/SignedOut.vue_vue_type_script_setup_true_lang-CcoDHmXu.js +18 -0
  17. package/dist/chunks/SignedOut.vue_vue_type_script_setup_true_lang-CcoDHmXu.js.map +1 -0
  18. package/dist/components/Cursor.js +5 -0
  19. package/dist/components/Cursor.js.map +1 -0
  20. package/dist/components/Cursor.vue.d.ts +6 -0
  21. package/dist/components/Cursor.vue.d.ts.map +1 -0
  22. package/dist/components/Cursors.js +5 -0
  23. package/dist/components/Cursors.js.map +1 -0
  24. package/dist/components/Cursors.vue.d.ts +32 -0
  25. package/dist/components/Cursors.vue.d.ts.map +1 -0
  26. package/dist/components/SignedIn.js +5 -0
  27. package/dist/components/SignedIn.js.map +1 -0
  28. package/dist/components/SignedIn.vue.d.ts +18 -0
  29. package/dist/components/SignedIn.vue.d.ts.map +1 -0
  30. package/dist/components/SignedOut.js +5 -0
  31. package/dist/components/SignedOut.js.map +1 -0
  32. package/dist/components/SignedOut.vue.d.ts +18 -0
  33. package/dist/components/SignedOut.vue.d.ts.map +1 -0
  34. package/dist/index.d.ts +8 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +23 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/useInfiniteQuery.d.ts +25 -0
  39. package/dist/useInfiniteQuery.d.ts.map +1 -0
  40. package/dist/useInfiniteQuery.js +57 -0
  41. package/dist/useInfiniteQuery.js.map +1 -0
  42. package/dist/utils.d.ts +8 -0
  43. package/dist/utils.d.ts.map +1 -0
  44. package/dist/utils.js +12 -0
  45. package/dist/utils.js.map +1 -0
  46. package/dist/version.d.ts +3 -0
  47. package/dist/version.d.ts.map +1 -0
  48. package/dist/version.js +6 -0
  49. package/dist/version.js.map +1 -0
  50. package/package.json +56 -0
@@ -0,0 +1,180 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import { toValue, shallowRef, watchEffect } from "vue";
5
+ import { tryOnScopeDispose } from "./utils.js";
6
+ const defaultActivityStopTimeout = 1e3;
7
+ function useTopicEffect(room, topic, onEvent) {
8
+ watchEffect((onCleanup) => {
9
+ const type = toValue(room.type);
10
+ const id = toValue(room.id);
11
+ const unsub = room.core._reactor.subscribeTopic(
12
+ type,
13
+ id,
14
+ topic,
15
+ (event, peer) => {
16
+ onEvent(event, peer);
17
+ }
18
+ );
19
+ onCleanup(unsub);
20
+ });
21
+ }
22
+ function usePublishTopic(room, topic) {
23
+ watchEffect((onCleanup) => {
24
+ const type = toValue(room.type);
25
+ const id = toValue(room.id);
26
+ const unsub = room.core._reactor.joinRoom(type, id);
27
+ onCleanup(unsub);
28
+ });
29
+ return (data) => {
30
+ room.core._reactor.publishTopic({
31
+ roomType: toValue(room.type),
32
+ roomId: toValue(room.id),
33
+ topic,
34
+ data
35
+ });
36
+ };
37
+ }
38
+ function usePresence(room, opts = {}) {
39
+ const initial = room.core._reactor.getPresence(
40
+ toValue(room.type),
41
+ toValue(room.id),
42
+ opts
43
+ ) ?? {
44
+ peers: {},
45
+ isLoading: true
46
+ };
47
+ const peers = shallowRef(initial.peers);
48
+ const isLoading = shallowRef(initial.isLoading);
49
+ const user = shallowRef(initial.user);
50
+ const error = shallowRef(initial.error);
51
+ watchEffect((onCleanup) => {
52
+ const type = toValue(room.type);
53
+ const id = toValue(room.id);
54
+ const unsub = room.core._reactor.subscribePresence(
55
+ type,
56
+ id,
57
+ opts,
58
+ (data) => {
59
+ peers.value = data.peers;
60
+ isLoading.value = data.isLoading;
61
+ if ("user" in data) user.value = data.user;
62
+ if ("error" in data) error.value = data.error;
63
+ }
64
+ );
65
+ onCleanup(unsub);
66
+ });
67
+ return {
68
+ peers,
69
+ isLoading,
70
+ user,
71
+ error,
72
+ publishPresence: (data) => {
73
+ room.core._reactor.publishPresence(
74
+ toValue(room.type),
75
+ toValue(room.id),
76
+ data
77
+ );
78
+ }
79
+ };
80
+ }
81
+ function useSyncPresence(room, data) {
82
+ watchEffect((onCleanup) => {
83
+ const type = toValue(room.type);
84
+ const id = toValue(room.id);
85
+ const unsub = room.core._reactor.joinRoom(type, id, toValue(data));
86
+ onCleanup(unsub);
87
+ });
88
+ watchEffect(() => {
89
+ room.core._reactor.publishPresence(
90
+ toValue(room.type),
91
+ toValue(room.id),
92
+ toValue(data)
93
+ );
94
+ });
95
+ }
96
+ function useTypingIndicator(room, inputName, opts = {}) {
97
+ let timeoutId = null;
98
+ const presence = usePresence(room, {
99
+ keys: [inputName]
100
+ });
101
+ const active = shallowRef([]);
102
+ watchEffect(() => {
103
+ if (opts == null ? void 0 : opts.writeOnly) {
104
+ active.value = [];
105
+ return;
106
+ }
107
+ presence.peers.value;
108
+ const snapshot = room.core._reactor.getPresence(
109
+ toValue(room.type),
110
+ toValue(room.id)
111
+ );
112
+ active.value = Object.values((snapshot == null ? void 0 : snapshot.peers) ?? {}).filter(
113
+ (p) => p[inputName] === true
114
+ );
115
+ });
116
+ const setActive = (isActive) => {
117
+ room.core._reactor.publishPresence(toValue(room.type), toValue(room.id), {
118
+ [inputName]: isActive ? true : null
119
+ });
120
+ if (timeoutId) {
121
+ clearTimeout(timeoutId);
122
+ timeoutId = null;
123
+ }
124
+ if (!isActive) return;
125
+ if ((opts == null ? void 0 : opts.timeout) === null || (opts == null ? void 0 : opts.timeout) === 0) return;
126
+ timeoutId = setTimeout(() => {
127
+ room.core._reactor.publishPresence(toValue(room.type), toValue(room.id), {
128
+ [inputName]: null
129
+ });
130
+ }, (opts == null ? void 0 : opts.timeout) ?? defaultActivityStopTimeout);
131
+ };
132
+ tryOnScopeDispose(() => {
133
+ if (timeoutId) {
134
+ clearTimeout(timeoutId);
135
+ timeoutId = null;
136
+ }
137
+ setActive(false);
138
+ });
139
+ const onKeyDown = (e) => {
140
+ const isEnter = (opts == null ? void 0 : opts.stopOnEnter) && e.key === "Enter";
141
+ const isActive = !isEnter;
142
+ setActive(isActive);
143
+ };
144
+ const onBlur = () => {
145
+ setActive(false);
146
+ };
147
+ return {
148
+ active,
149
+ setActive,
150
+ inputProps: { onKeyDown, onBlur }
151
+ };
152
+ }
153
+ const rooms = {
154
+ useTopicEffect,
155
+ usePublishTopic,
156
+ usePresence,
157
+ useSyncPresence,
158
+ useTypingIndicator
159
+ };
160
+ class InstantVueRoom {
161
+ constructor(core, type, id) {
162
+ __publicField(this, "core");
163
+ __publicField(this, "type");
164
+ __publicField(this, "id");
165
+ this.core = core;
166
+ this.type = type;
167
+ this.id = id;
168
+ }
169
+ }
170
+ export {
171
+ InstantVueRoom,
172
+ defaultActivityStopTimeout,
173
+ rooms,
174
+ usePresence,
175
+ usePublishTopic,
176
+ useSyncPresence,
177
+ useTopicEffect,
178
+ useTypingIndicator
179
+ };
180
+ //# sourceMappingURL=InstantVueRoom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InstantVueRoom.js","sources":["../src/InstantVueRoom.ts"],"sourcesContent":["import {\n type PresenceOpts,\n type PresenceResponse,\n type RoomSchemaShape,\n InstantCoreDatabase,\n InstantSchemaDef,\n} from '@instantdb/core';\n\nimport { shallowRef, watchEffect, toValue } from 'vue';\nimport type { Ref, ShallowRef, MaybeRefOrGetter, ComputedRef } from 'vue';\n\nimport { tryOnScopeDispose } from './utils.js';\n\n// ------\n// Types\n\nexport type PresenceHandle<PresenceShape, Keys extends keyof PresenceShape> = {\n [K in keyof PresenceResponse<PresenceShape, Keys>]: ShallowRef<\n PresenceResponse<PresenceShape, Keys>[K]\n >;\n} & {\n publishPresence: (data: Partial<PresenceShape>) => void;\n};\n\nexport type TypingIndicatorOpts = {\n timeout?: number | null;\n stopOnEnter?: boolean;\n // Perf opt - `active` will always be an empty array\n writeOnly?: boolean;\n};\n\nexport type TypingIndicatorHandle<PresenceShape> = {\n active: Ref<PresenceShape[]>;\n setActive(active: boolean): void;\n inputProps: {\n onKeyDown: (e: KeyboardEvent) => void;\n onBlur: () => void;\n };\n};\n\nexport const defaultActivityStopTimeout = 1_000;\n\n// ------\n// Topics\n\n/**\n * Listen for broadcasted events given a room and topic.\n *\n * @see https://instantdb.com/docs/presence-and-topics\n * @example\n * const room = db.room('chats', roomId);\n * db.rooms.useTopicEffect(room, 'emoji', (message, peer) => {\n * console.log(peer.name, 'sent', message);\n * });\n */\nexport function useTopicEffect<\n RoomSchema extends RoomSchemaShape,\n RoomType extends keyof RoomSchema,\n TopicType extends keyof RoomSchema[RoomType]['topics'],\n>(\n room: InstantVueRoom<any, RoomSchema, RoomType>,\n topic: TopicType,\n onEvent: (\n event: RoomSchema[RoomType]['topics'][TopicType],\n peer: RoomSchema[RoomType]['presence'],\n ) => any,\n): void {\n watchEffect((onCleanup) => {\n const type = toValue(room.type);\n const id = toValue(room.id);\n const unsub = room.core._reactor.subscribeTopic(\n type,\n id,\n topic,\n (event: any, peer: any) => {\n onEvent(event, peer);\n },\n );\n onCleanup(unsub);\n });\n}\n\n/**\n * Broadcast an event to a room.\n *\n * @see https://instantdb.com/docs/presence-and-topics\n * @example\n * const room = db.room('chat', roomId);\n * const publishTopic = db.rooms.usePublishTopic(room, 'emoji');\n * publishTopic({ emoji: \"🔥\" });\n */\nexport function usePublishTopic<\n RoomSchema extends RoomSchemaShape,\n RoomType extends keyof RoomSchema,\n TopicType extends keyof RoomSchema[RoomType]['topics'],\n>(\n room: InstantVueRoom<any, RoomSchema, RoomType>,\n topic: TopicType,\n): (data: RoomSchema[RoomType]['topics'][TopicType]) => void {\n watchEffect((onCleanup) => {\n const type = toValue(room.type) as string;\n const id = toValue(room.id);\n const unsub = room.core._reactor.joinRoom(type, id);\n onCleanup(unsub);\n });\n\n return (data: RoomSchema[RoomType]['topics'][TopicType]) => {\n room.core._reactor.publishTopic({\n roomType: toValue(room.type),\n roomId: toValue(room.id),\n topic,\n data,\n });\n };\n}\n\n// ---------\n// Presence\n\n/**\n * Listen for peer's presence data in a room, and publish the current user's presence.\n *\n * @see https://instantdb.com/docs/presence-and-topics\n * @example\n * const room = db.room('chat', roomId);\n * const { peers, isLoading, publishPresence } = db.rooms.usePresence(room, { keys: [\"name\", \"avatar\"] });\n */\nexport function usePresence<\n RoomSchema extends RoomSchemaShape,\n RoomType extends keyof RoomSchema,\n Keys extends keyof RoomSchema[RoomType]['presence'],\n>(\n room: InstantVueRoom<any, RoomSchema, RoomType>,\n opts: PresenceOpts<RoomSchema[RoomType]['presence'], Keys> = {},\n): PresenceHandle<RoomSchema[RoomType]['presence'], Keys> {\n const initial = (room.core._reactor.getPresence(\n toValue(room.type),\n toValue(room.id),\n opts,\n ) ?? {\n peers: {},\n isLoading: true,\n }) as PresenceResponse<RoomSchema[RoomType]['presence'], Keys>;\n\n const peers = shallowRef(initial.peers);\n const isLoading = shallowRef(initial.isLoading);\n const user = shallowRef<any>((initial as any).user);\n const error = shallowRef<any>((initial as any).error);\n\n watchEffect((onCleanup) => {\n const type = toValue(room.type);\n const id = toValue(room.id);\n const unsub = room.core._reactor.subscribePresence(\n type,\n id,\n opts,\n (data: any) => {\n peers.value = data.peers;\n isLoading.value = data.isLoading;\n if ('user' in data) user.value = data.user;\n if ('error' in data) error.value = data.error;\n },\n );\n onCleanup(unsub);\n });\n\n return {\n peers,\n isLoading,\n user,\n error,\n publishPresence: (data: Partial<RoomSchema[RoomType]['presence']>) => {\n room.core._reactor.publishPresence(\n toValue(room.type),\n toValue(room.id),\n data,\n );\n },\n } as PresenceHandle<RoomSchema[RoomType]['presence'], Keys>;\n}\n\n/**\n * Publishes presence data to a room\n *\n * @see https://instantdb.com/docs/presence-and-topics\n * @example\n * const room = db.room('chat', roomId);\n * db.rooms.useSyncPresence(room, { nickname });\n */\nexport function useSyncPresence<\n RoomSchema extends RoomSchemaShape,\n RoomType extends keyof RoomSchema,\n>(\n room: InstantVueRoom<any, RoomSchema, RoomType>,\n data: MaybeRefOrGetter<Partial<RoomSchema[RoomType]['presence']>>,\n): void {\n watchEffect((onCleanup) => {\n const type = toValue(room.type) as string;\n const id = toValue(room.id);\n const unsub = room.core._reactor.joinRoom(type, id, toValue(data));\n onCleanup(unsub);\n });\n\n watchEffect(() => {\n room.core._reactor.publishPresence(\n toValue(room.type),\n toValue(room.id),\n toValue(data),\n );\n });\n}\n\n// -----------------\n// Typing Indicator\n\n/**\n * Manage typing indicator state\n *\n * @see https://instantdb.com/docs/presence-and-topics\n * @example\n * const room = db.room('chat', roomId);\n * const typing = db.rooms.useTypingIndicator(room, 'chat-input');\n * // typing.active.value, typing.setActive(bool), typing.inputProps\n */\nexport function useTypingIndicator<\n RoomSchema extends RoomSchemaShape,\n RoomType extends keyof RoomSchema,\n>(\n room: InstantVueRoom<any, RoomSchema, RoomType>,\n inputName: string,\n opts: TypingIndicatorOpts = {},\n): TypingIndicatorHandle<RoomSchema[RoomType]['presence']> {\n let timeoutId: ReturnType<typeof setTimeout> | null = null;\n\n const presence = usePresence(room, {\n keys: [inputName] as (keyof RoomSchema[RoomType]['presence'])[],\n });\n\n const active = shallowRef<RoomSchema[RoomType]['presence'][]>([]);\n\n watchEffect(() => {\n if (opts?.writeOnly) {\n active.value = [];\n return;\n }\n // Track peers so we re-run when presence updates\n presence.peers.value;\n const snapshot = room.core._reactor.getPresence(\n toValue(room.type),\n toValue(room.id),\n );\n active.value = Object.values(snapshot?.peers ?? {}).filter(\n (p: any) => p[inputName] === true,\n );\n });\n\n const setActive = (isActive: boolean) => {\n room.core._reactor.publishPresence(toValue(room.type), toValue(room.id), {\n [inputName]: isActive ? true : null,\n } as Partial<RoomSchema[RoomType]['presence']>);\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n\n if (!isActive) return;\n if (opts?.timeout === null || opts?.timeout === 0) return;\n\n timeoutId = setTimeout(() => {\n room.core._reactor.publishPresence(toValue(room.type), toValue(room.id), {\n [inputName]: null,\n } as Partial<RoomSchema[RoomType]['presence']>);\n }, opts?.timeout ?? defaultActivityStopTimeout);\n };\n\n tryOnScopeDispose(() => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n // Clear sticky typing state on unmount, even when timeout is disabled.\n setActive(false);\n });\n\n const onKeyDown = (e: KeyboardEvent) => {\n const isEnter = opts?.stopOnEnter && e.key === 'Enter';\n const isActive = !isEnter;\n setActive(isActive);\n };\n\n const onBlur = () => {\n setActive(false);\n };\n\n return {\n active,\n setActive,\n inputProps: { onKeyDown, onBlur },\n };\n}\n\n// --------------\n// Hooks namespace\n\nexport const rooms = {\n useTopicEffect,\n usePublishTopic,\n usePresence,\n useSyncPresence,\n useTypingIndicator,\n};\n\n// ------------\n// Class\n\nexport class InstantVueRoom<\n Schema extends InstantSchemaDef<any, any, any>,\n RoomSchema extends RoomSchemaShape,\n RoomType extends keyof RoomSchema,\n> {\n core: InstantCoreDatabase<Schema, boolean>;\n type: ComputedRef<RoomType> | RoomType;\n id: ComputedRef<string> | string;\n\n constructor(\n core: InstantCoreDatabase<Schema, boolean>,\n type: ComputedRef<RoomType> | RoomType,\n id: ComputedRef<string> | string,\n ) {\n this.core = core;\n this.type = type;\n this.id = id;\n }\n}\n"],"names":[],"mappings":";;;;;AAwCO,MAAM,6BAA6B;AAe1B,SAAA,eAKd,MACA,OACA,SAIM;AACN,cAAY,CAAC,cAAc;AACnB,UAAA,OAAO,QAAQ,KAAK,IAAI;AACxB,UAAA,KAAK,QAAQ,KAAK,EAAE;AACpB,UAAA,QAAQ,KAAK,KAAK,SAAS;AAAA,MAC/B;AAAA,MACA;AAAA,MACA;AAAA,MACA,CAAC,OAAY,SAAc;AACzB,gBAAQ,OAAO,IAAI;AAAA,MAAA;AAAA,IAEvB;AACA,cAAU,KAAK;AAAA,EAAA,CAChB;AACH;AAWgB,SAAA,gBAKd,MACA,OAC2D;AAC3D,cAAY,CAAC,cAAc;AACnB,UAAA,OAAO,QAAQ,KAAK,IAAI;AACxB,UAAA,KAAK,QAAQ,KAAK,EAAE;AAC1B,UAAM,QAAQ,KAAK,KAAK,SAAS,SAAS,MAAM,EAAE;AAClD,cAAU,KAAK;AAAA,EAAA,CAChB;AAED,SAAO,CAAC,SAAoD;AACrD,SAAA,KAAK,SAAS,aAAa;AAAA,MAC9B,UAAU,QAAQ,KAAK,IAAI;AAAA,MAC3B,QAAQ,QAAQ,KAAK,EAAE;AAAA,MACvB;AAAA,MACA;AAAA,IAAA,CACD;AAAA,EACH;AACF;AAaO,SAAS,YAKd,MACA,OAA6D,IACL;AAClD,QAAA,UAAW,KAAK,KAAK,SAAS;AAAA,IAClC,QAAQ,KAAK,IAAI;AAAA,IACjB,QAAQ,KAAK,EAAE;AAAA,IACf;AAAA,EAAA,KACG;AAAA,IACH,OAAO,CAAC;AAAA,IACR,WAAW;AAAA,EACb;AAEM,QAAA,QAAQ,WAAW,QAAQ,KA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cAAU,KAAK;AAAA,EACjB;AAEO,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA,YAAY,EAAE,WAAW,OAAO;AAAA,EAClC;AACF;AAKO,MAAM,QAAQ;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKO,MAAM,eAIX;AAAA,EAKA,YACE,MACA,MACA,IACA;AARF;AACA;AACA;AAOE,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,KAAK;AAAA,EAAA;AAEd;"}
@@ -0,0 +1,32 @@
1
+ import { defineComponent, createElementBlock, openBlock, createStaticVNode, createElementVNode } from "vue";
2
+ const _hoisted_1 = {
3
+ style: { "height": "35px", "width": "35px" },
4
+ viewBox: "0 0 35 35",
5
+ fill: "none",
6
+ xmlns: "http://www.w3.org/2000/svg"
7
+ };
8
+ const _hoisted_2 = ["fill"];
9
+ const _sfc_main = /* @__PURE__ */ defineComponent({
10
+ __name: "Cursor",
11
+ props: {
12
+ color: {}
13
+ },
14
+ setup(__props) {
15
+ return (_ctx, _cache) => {
16
+ return openBlock(), createElementBlock("svg", _hoisted_1, [
17
+ _cache[1] || (_cache[1] = createStaticVNode('<g fill="rgba(0,0,0,.2)" transform="matrix(1, 0, 0, 1, -11.999999046325684, -8.406899452209473)"><path d="m12 24.4219v-16.015l11.591 11.619h-6.781l-.411.124z"></path><path d="m21.0845 25.0962-3.605 1.535-4.682-11.089 3.686-1.553z"></path></g><g fill="white" transform="matrix(1, 0, 0, 1, -11.999999046325684, -8.406899452209473)"><path d="m12 24.4219v-16.015l11.591 11.619h-6.781l-.411.124z"></path><path d="m21.0845 25.0962-3.605 1.535-4.682-11.089 3.686-1.553z"></path></g>', 2)),
18
+ createElementVNode("g", {
19
+ fill: _ctx.color || "black",
20
+ transform: "matrix(1, 0, 0, 1, -11.999999046325684, -8.406899452209473)"
21
+ }, _cache[0] || (_cache[0] = [
22
+ createElementVNode("path", { d: "m19.751 24.4155-1.844.774-3.1-7.374 1.841-.775z" }, null, -1),
23
+ createElementVNode("path", { d: "m13 10.814v11.188l2.969-2.866.428-.139h4.768z" }, null, -1)
24
+ ]), 8, _hoisted_2)
25
+ ]);
26
+ };
27
+ }
28
+ });
29
+ export {
30
+ _sfc_main as _
31
+ };
32
+ //# sourceMappingURL=Cursor.vue_vue_type_script_setup_true_lang-DeM0moKd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cursor.vue_vue_type_script_setup_true_lang-DeM0moKd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,128 @@
1
+ import { defineComponent, computed, toValue, createBlock, openBlock, resolveDynamicComponent, withCtx, renderSlot, createElementVNode, normalizeStyle, createElementBlock, Fragment, renderList, createVNode } from "vue";
2
+ import { usePresence } from "../InstantVueRoom.js";
3
+ import { _ as _sfc_main$1 } from "./Cursor.vue_vue_type_script_setup_true_lang-DeM0moKd.js";
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ __name: "Cursors",
6
+ props: {
7
+ room: {},
8
+ spaceId: {},
9
+ as: { default: "div" },
10
+ userCursorColor: {},
11
+ propagate: { type: Boolean, default: false },
12
+ zIndex: { default: 99999 }
13
+ },
14
+ setup(__props) {
15
+ const props = __props;
16
+ const spaceId = computed(
17
+ () => props.spaceId || `cursors-space-default--${String(toValue(props.room.type))}-${toValue(props.room.id)}`
18
+ );
19
+ const { peers, publishPresence } = usePresence(props.room, {
20
+ keys: [spaceId.value]
21
+ });
22
+ const fullPresence = computed(() => {
23
+ peers.value;
24
+ return props.room.core._reactor.getPresence(
25
+ toValue(props.room.type),
26
+ toValue(props.room.id)
27
+ );
28
+ });
29
+ const cursorPeers = computed(() => {
30
+ const sid = spaceId.value;
31
+ return Object.entries(peers.value || {}).flatMap(([peerId, p]) => {
32
+ const cursor = p == null ? void 0 : p[sid];
33
+ return cursor ? [{ peerId, cursor }] : [];
34
+ });
35
+ });
36
+ function publishCursor(rect, touch) {
37
+ const x = touch.clientX;
38
+ const y = touch.clientY;
39
+ const xPercent = (x - rect.left) / rect.width * 100;
40
+ const yPercent = (y - rect.top) / rect.height * 100;
41
+ publishPresence({
42
+ [spaceId.value]: {
43
+ x,
44
+ y,
45
+ xPercent,
46
+ yPercent,
47
+ color: props.userCursorColor
48
+ }
49
+ });
50
+ }
51
+ function onMouseMove(e) {
52
+ if (!props.propagate) e.stopPropagation();
53
+ const rect = e.currentTarget.getBoundingClientRect();
54
+ publishCursor(rect, e);
55
+ }
56
+ function clearCursor() {
57
+ publishPresence({
58
+ [spaceId.value]: void 0
59
+ });
60
+ }
61
+ function onTouchMove(e) {
62
+ if (e.touches.length !== 1) return;
63
+ const touch = e.touches[0];
64
+ if (!touch || !(touch.target instanceof Element)) return;
65
+ if (!props.propagate) e.stopPropagation();
66
+ const rect = touch.target.getBoundingClientRect();
67
+ publishCursor(rect, touch);
68
+ }
69
+ return (_ctx, _cache) => {
70
+ return openBlock(), createBlock(resolveDynamicComponent(_ctx.as), {
71
+ style: { position: "relative" },
72
+ onMousemove: onMouseMove,
73
+ onMouseout: clearCursor,
74
+ onBlur: clearCursor,
75
+ onTouchmove: onTouchMove,
76
+ onTouchend: clearCursor
77
+ }, {
78
+ default: withCtx(() => [
79
+ renderSlot(_ctx.$slots, "default"),
80
+ createElementVNode("div", {
81
+ style: normalizeStyle({
82
+ position: "absolute",
83
+ top: 0,
84
+ left: 0,
85
+ bottom: 0,
86
+ right: 0,
87
+ overflow: "hidden",
88
+ pointerEvents: "none",
89
+ userSelect: "none",
90
+ zIndex: _ctx.zIndex
91
+ })
92
+ }, [
93
+ (openBlock(true), createElementBlock(Fragment, null, renderList(cursorPeers.value, ({ peerId, cursor }) => {
94
+ var _a;
95
+ return openBlock(), createElementBlock("div", {
96
+ key: peerId,
97
+ style: normalizeStyle({
98
+ position: "absolute",
99
+ top: 0,
100
+ left: 0,
101
+ bottom: 0,
102
+ right: 0,
103
+ transform: `translate(${cursor.xPercent}%, ${cursor.yPercent}%)`,
104
+ transformOrigin: "0 0",
105
+ transition: "transform 100ms"
106
+ })
107
+ }, [
108
+ renderSlot(_ctx.$slots, "cursor", {
109
+ color: cursor.color,
110
+ presence: (_a = fullPresence.value) == null ? void 0 : _a.peers[peerId]
111
+ }, () => [
112
+ createVNode(_sfc_main$1, {
113
+ color: cursor.color ?? ""
114
+ }, null, 8, ["color"])
115
+ ])
116
+ ], 4);
117
+ }), 128))
118
+ ], 4)
119
+ ]),
120
+ _: 3
121
+ }, 32);
122
+ };
123
+ }
124
+ });
125
+ export {
126
+ _sfc_main as _
127
+ };
128
+ //# sourceMappingURL=Cursors.vue_vue_type_script_setup_true_lang-C6eE1KRI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cursors.vue_vue_type_script_setup_true_lang-C6eE1KRI.js","sources":["../../src/components/Cursors.vue"],"sourcesContent":["<script\n setup\n lang=\"ts\"\n generic=\"RoomSchema extends RoomSchemaShape, RoomType extends string & keyof RoomSchema\"\n>\nimport { computed, toValue } from 'vue';\nimport type { RoomSchemaShape } from '@instantdb/core';\nimport { usePresence } from '../InstantVueRoom.js';\nimport type { InstantVueRoom } from '../InstantVueRoom.js';\nimport Cursor from './Cursor.vue';\n\ntype CursorPresence = {\n x: number;\n y: number;\n xPercent: number;\n yPercent: number;\n color?: string;\n};\n\nconst props = withDefaults(\n defineProps<{\n room: InstantVueRoom<any, RoomSchema, RoomType>;\n spaceId?: string;\n as?: string;\n userCursorColor?: string;\n propagate?: boolean;\n zIndex?: number;\n }>(),\n {\n as: 'div',\n propagate: false,\n zIndex: 99999,\n },\n);\n\nconst spaceId = computed(\n () =>\n props.spaceId ||\n `cursors-space-default--${String(toValue(props.room.type))}-${toValue(props.room.id)}`,\n);\n\nconst { peers, publishPresence } = usePresence(props.room, {\n keys: [spaceId.value] as (keyof RoomSchema[RoomType]['presence'])[],\n});\n\nconst fullPresence = computed(() => {\n // Track peers so the snapshot refreshes when presence changes.\n peers.value;\n return props.room.core._reactor.getPresence(\n toValue(props.room.type),\n toValue(props.room.id),\n );\n});\n\nconst cursorPeers = computed(() => {\n const sid = spaceId.value;\n return Object.entries(peers.value || {}).flatMap(([peerId, p]) => {\n const cursor = (p as any)?.[sid] as CursorPresence | undefined;\n return cursor ? [{ peerId, cursor }] : [];\n });\n});\n\nfunction publishCursor(\n rect: DOMRect,\n touch: { clientX: number; clientY: number },\n) {\n const x = touch.clientX;\n const y = touch.clientY;\n const xPercent = ((x - rect.left) / rect.width) * 100;\n const yPercent = ((y - rect.top) / rect.height) * 100;\n publishPresence({\n [spaceId.value]: {\n x,\n y,\n xPercent,\n yPercent,\n color: props.userCursorColor,\n },\n } as RoomSchema[RoomType]['presence']);\n}\n\nfunction onMouseMove(e: MouseEvent) {\n if (!props.propagate) e.stopPropagation();\n const rect = (e.currentTarget as Element).getBoundingClientRect();\n publishCursor(rect, e);\n}\n\nfunction clearCursor() {\n publishPresence({\n [spaceId.value]: undefined,\n } as RoomSchema[RoomType]['presence']);\n}\n\nfunction onTouchMove(e: TouchEvent) {\n if (e.touches.length !== 1) return;\n const touch = e.touches[0];\n if (!touch || !(touch.target instanceof Element)) return;\n if (!props.propagate) e.stopPropagation();\n const rect = touch.target.getBoundingClientRect();\n publishCursor(rect, touch);\n}\n</script>\n\n<template>\n <component\n :is=\"as\"\n :style=\"{ position: 'relative' }\"\n @mousemove=\"onMouseMove\"\n @mouseout=\"clearCursor\"\n @blur=\"clearCursor\"\n @touchmove=\"onTouchMove\"\n @touchend=\"clearCursor\"\n >\n <slot />\n <div\n :style=\"{\n position: 'absolute',\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n overflow: 'hidden',\n pointerEvents: 'none',\n userSelect: 'none',\n zIndex,\n }\"\n >\n <div\n v-for=\"{ peerId, cursor } in cursorPeers\"\n :key=\"peerId\"\n :style=\"{\n position: 'absolute',\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n transform: `translate(${cursor.xPercent}%, ${cursor.yPercent}%)`,\n transformOrigin: '0 0',\n transition: 'transform 100ms',\n }\"\n >\n <slot\n name=\"cursor\"\n :color=\"cursor.color\"\n :presence=\"fullPresence?.peers[peerId]\"\n >\n <Cursor :color=\"cursor.color ?? ''\" />\n </slot>\n </div>\n </div>\n </component>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAmBA,UAAM,QAAQ;AAgBd,UAAM,UAAU;AAAA,MACd,MACE,MAAM,WACN,0BAA0B,OAAO,QAAQ,MAAM,KAAK,IAAI,CAAC,CAAC,IAAI,QAAQ,MAAM,KAAK,EAAE,CAAC;AAAA,IACxF;AAEA,UAAM,EAAE,OAAO,gBAAA,IAAoB,YAAY,MAAM,MAAM;AAAA,MACzD,MAAM,CAAC,QAAQ,KAAK;AAAA,IAAA,CACrB;AAEK,UAAA,eAAe,SAAS,MAAM;AAE5B,YAAA;AACC,aAAA,MAAM,KAAK,KAAK,SAAS;AAAA,QAC9B,QAAQ,MAAM,KAAK,IAAI;AAAA,QACvB,QAAQ,MAAM,KAAK,EAAE;AAAA,MACvB;AAAA,IAAA,CACD;AAEK,UAAA,cAAc,SAAS,MAAM;AACjC,YAAM,MAAM,QAAQ;AACpB,aAAO,OAAO,QAAQ,MAAM,SAAS,CAAA,CAAE,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM;AAC1D,cAAA,SAAU,uBAAY;AAC5B,eAAO,SAAS,CAAC,EAAE,QAAQ,OAAO,CAAC,IAAI,CAAC;AAAA,MAAA,CACzC;AAAA,IAAA,CACF;AAEQ,aAAA,cACP,MACA,OACA;AACA,YAAM,IAAI,MAAM;AAChB,YAAM,IAAI,MAAM;AAChB,YAAM,YAAa,IAAI,KAAK,QAAQ,KAAK,QAAS;AAClD,YAAM,YAAa,IAAI,KAAK,OAAO,KAAK,SAAU;AAClC,sBAAA;AAAA,QACd,CAAC,QAAQ,KAAK,GAAG;AAAA,UACf;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,OAAO,MAAM;AAAA,QAAA;AAAA,MACf,CACmC;AAAA,IAAA;AAGvC,aAAS,YAAY,GAAe;AAClC,UAAI,CAAC,MAAM,UAAW,GAAE,gBAAgB;AAClC,YAAA,OAAQ,EAAE,cAA0B,sBAAsB;AAChE,oBAAc,MAAM,CAAC;AAAA,IAAA;AAGvB,aAAS,cAAc;AACL,sBAAA;AAAA,QACd,CAAC,QAAQ,KAAK,GAAG;AAAA,MAAA,CACkB;AAAA,IAAA;AAGvC,aAAS,YAAY,GAAe;AAC9B,UAAA,EAAE,QAAQ,WAAW,EAAG;AACtB,YAAA,QAAQ,EAAE,QAAQ,CAAC;AACzB,UAAI,CAAC,SAAS,EAAE,MAAM,kBAAkB,SAAU;AAClD,UAAI,CAAC,MAAM,UAAW,GAAE,gBAAgB;AAClC,YAAA,OAAO,MAAM,OAAO,sBAAsB;AAChD,oBAAc,MAAM,KAAK;AAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,18 @@
1
+ import { defineComponent, renderSlot, createCommentVNode, unref } from "vue";
2
+ const _sfc_main = /* @__PURE__ */ defineComponent({
3
+ __name: "SignedIn",
4
+ props: {
5
+ db: {}
6
+ },
7
+ setup(__props) {
8
+ const props = __props;
9
+ const { isLoading, error, user } = props.db.useAuth();
10
+ return (_ctx, _cache) => {
11
+ return !unref(isLoading) && !unref(error) && unref(user) ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true);
12
+ };
13
+ }
14
+ });
15
+ export {
16
+ _sfc_main as _
17
+ };
18
+ //# sourceMappingURL=SignedIn.vue_vue_type_script_setup_true_lang-MJrQPE2B.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignedIn.vue_vue_type_script_setup_true_lang-MJrQPE2B.js","sources":["../../src/components/SignedIn.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { InstantSchemaDef } from '@instantdb/core';\nimport type { InstantVueDatabase } from '../InstantVueDatabase.js';\n\nconst props = defineProps<{\n db: InstantVueDatabase<InstantSchemaDef<any, any, any>, boolean>;\n}>();\n\nconst { isLoading, error, user } = props.db.useAuth();\n</script>\n\n<template>\n <slot v-if=\"!isLoading && !error && user\" />\n</template>\n"],"names":[],"mappings":";;;;;;;AAIA,UAAM,QAAQ;AAId,UAAM,EAAE,WAAW,OAAO,KAAS,IAAA,MAAM,GAAG,QAAQ;;;;;;"}
@@ -0,0 +1,18 @@
1
+ import { defineComponent, renderSlot, createCommentVNode, unref } from "vue";
2
+ const _sfc_main = /* @__PURE__ */ defineComponent({
3
+ __name: "SignedOut",
4
+ props: {
5
+ db: {}
6
+ },
7
+ setup(__props) {
8
+ const props = __props;
9
+ const { isLoading, error, user } = props.db.useAuth();
10
+ return (_ctx, _cache) => {
11
+ return !unref(isLoading) && !unref(error) && !unref(user) ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true);
12
+ };
13
+ }
14
+ });
15
+ export {
16
+ _sfc_main as _
17
+ };
18
+ //# sourceMappingURL=SignedOut.vue_vue_type_script_setup_true_lang-CcoDHmXu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignedOut.vue_vue_type_script_setup_true_lang-CcoDHmXu.js","sources":["../../src/components/SignedOut.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { InstantSchemaDef } from '@instantdb/core';\nimport type { InstantVueDatabase } from '../InstantVueDatabase.js';\n\nconst props = defineProps<{\n db: InstantVueDatabase<InstantSchemaDef<any, any, any>, boolean>;\n}>();\n\nconst { isLoading, error, user } = props.db.useAuth();\n</script>\n\n<template>\n <slot v-if=\"!isLoading && !error && !user\" />\n</template>\n"],"names":[],"mappings":";;;;;;;AAIA,UAAM,QAAQ;AAId,UAAM,EAAE,WAAW,OAAO,KAAS,IAAA,MAAM,GAAG,QAAQ;;;;;;"}
@@ -0,0 +1,5 @@
1
+ import { _ as _sfc_main } from "../chunks/Cursor.vue_vue_type_script_setup_true_lang-DeM0moKd.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
5
+ //# sourceMappingURL=Cursor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cursor.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,6 @@
1
+ type __VLS_Props = {
2
+ color: string;
3
+ };
4
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ export default _default;
6
+ //# sourceMappingURL=Cursor.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cursor.vue.d.ts","sourceRoot":"","sources":["../../src/components/Cursor.vue"],"names":[],"mappings":"AAoCA,KAAK,WAAW,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;;AAkErC,wBAMG"}
@@ -0,0 +1,5 @@
1
+ import { _ as _sfc_main } from "../chunks/Cursors.vue_vue_type_script_setup_true_lang-C6eE1KRI.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
5
+ //# sourceMappingURL=Cursors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cursors.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,32 @@
1
+ import type { RoomSchemaShape } from '@instantdb/core';
2
+ import type { InstantVueRoom } from '../InstantVueRoom.js';
3
+ declare const _default: <RoomSchema extends RoomSchemaShape, RoomType extends string & keyof RoomSchema>(__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<{
4
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & {
5
+ room: InstantVueRoom<any, RoomSchema, RoomType>;
6
+ spaceId?: string;
7
+ as?: string;
8
+ userCursorColor?: string;
9
+ propagate?: boolean;
10
+ zIndex?: number;
11
+ } & Partial<{}>> & import("vue").PublicProps;
12
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
13
+ attrs: any;
14
+ slots: {
15
+ default?: (props: {}) => any;
16
+ } & {
17
+ cursor?: (props: {
18
+ color: string | undefined;
19
+ presence: (Pick<any, string | number | symbol> & {
20
+ peerId: string;
21
+ }) | undefined;
22
+ }) => any;
23
+ };
24
+ emit: {};
25
+ }>) => import("vue").VNode & {
26
+ __ctx?: Awaited<typeof __VLS_setup>;
27
+ };
28
+ export default _default;
29
+ type __VLS_PrettifyLocal<T> = {
30
+ [K in keyof T]: T[K];
31
+ } & {};
32
+ //# sourceMappingURL=Cursors.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cursors.vue.d.ts","sourceRoot":"","sources":["../../src/components/Cursors.vue"],"names":[],"mappings":"AA2JA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;yBAG1C,UAAU,SAAS,eAAe,EAAE,QAAQ,SAAS,MAAM,GAAG,MAAM,UAAU,EAC9F,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,EAC3G,eAAe,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EACjE;WAyNO,mBAAmB,CAAC;cA/MlB,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE,QAAQ,CAAC;kBACrC,MAAM;aACX,MAAM;0BACO,MAAM;oBACZ,OAAO;iBACV,MAAM;QA0M8C,OAAO,IAAsB,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;kBA9BG,CAAC,KAAK,IAAiB,KAAK,GAAG;;iBAChC,CAAC,KAAK;;;;;SAAiB,KAAK,GAAG;;UA+BrC,EAAE;EAEL,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AApOzE,wBAoO4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { _ as _sfc_main } from "../chunks/SignedIn.vue_vue_type_script_setup_true_lang-MJrQPE2B.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
5
+ //# sourceMappingURL=SignedIn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignedIn.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,18 @@
1
+ import type { InstantSchemaDef } from '@instantdb/core';
2
+ import type { InstantVueDatabase } from '../InstantVueDatabase.js';
3
+ type __VLS_Props = {
4
+ db: InstantVueDatabase<InstantSchemaDef<any, any, any>, boolean>;
5
+ };
6
+ declare var __VLS_1: {};
7
+ type __VLS_Slots = {} & {
8
+ default?: (props: typeof __VLS_1) => any;
9
+ };
10
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
12
+ export default _default;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
18
+ //# sourceMappingURL=SignedIn.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignedIn.vue.d.ts","sourceRoot":"","sources":["../../src/components/SignedIn.vue"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;CAClE,CAAC;AAkBF,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAqB/C,QAAA,MAAM,eAAe,kSAMnB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { _ as _sfc_main } from "../chunks/SignedOut.vue_vue_type_script_setup_true_lang-CcoDHmXu.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
5
+ //# sourceMappingURL=SignedOut.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignedOut.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,18 @@
1
+ import type { InstantSchemaDef } from '@instantdb/core';
2
+ import type { InstantVueDatabase } from '../InstantVueDatabase.js';
3
+ type __VLS_Props = {
4
+ db: InstantVueDatabase<InstantSchemaDef<any, any, any>, boolean>;
5
+ };
6
+ declare var __VLS_1: {};
7
+ type __VLS_Slots = {} & {
8
+ default?: (props: typeof __VLS_1) => any;
9
+ };
10
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
12
+ export default _default;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
18
+ //# sourceMappingURL=SignedOut.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignedOut.vue.d.ts","sourceRoot":"","sources":["../../src/components/SignedOut.vue"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;CAClE,CAAC;AAkBF,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAqB/C,QAAA,MAAM,eAAe,kSAMnB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { id, tx, lookup, i, InstantAPIError, SyncTableCallbackEventType, type QueryResponse, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantObject, type InstantEntity, type InstantSchemaDatabase, type InstantUnknownSchemaDef, type IInstantDatabase, type User, type AuthState, type Query, type Config, type InstaQLParams, type ConnectionStatus, type ValidQuery, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type InstantGraph, type InstantConfig, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type InstaQLEntity, type InstaQLFields, type InstaQLResult, type InstaQLEntitySubquery, type RoomsOf, type RoomsDef, type PresenceOf, type TopicsOf, type TopicOf, type RoomHandle, type TransactionChunk, type InstantUnknownSchema, type InstantSchemaDef, type BackwardsCompatibleSchema, type InstantRules, type UpdateParams, type LinkParams, type CreateParams, type CheckMagicCodeParams, type CheckMagicCodeResponse, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, StoreInterface, createInstantRouteHandler, type StoreInterfaceStoreName } from '@instantdb/core';
2
+ import { InstantVueDatabase, init } from './InstantVueDatabase.js';
3
+ import { InstantVueRoom } from './InstantVueRoom.js';
4
+ import SignedIn from './components/SignedIn.vue';
5
+ import SignedOut from './components/SignedOut.vue';
6
+ import Cursors from './components/Cursors.vue';
7
+ export { id, tx, lookup, init, InstantVueDatabase, InstantVueRoom, SignedIn, SignedOut, Cursors, i, InstantAPIError, SyncTableCallbackEventType, type Config, type InstantConfig, type InstantUnknownSchemaDef, type Query, type QueryResponse, type InstantObject, type User, type AuthState, type ConnectionStatus, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantEntity, type InstantSchemaDatabase, type IInstantDatabase, type InstaQLParams, type ValidQuery, type InstaQLFields, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type InstantGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type InstaQLEntity, type InstaQLResult, type InstaQLEntitySubquery, type RoomsOf, type RoomsDef, type TransactionChunk, type PresenceOf, type TopicsOf, type TopicOf, type RoomHandle, type InstantUnknownSchema, type InstantSchemaDef, type BackwardsCompatibleSchema, type InstantRules, type UpdateParams, type LinkParams, type CreateParams, type CheckMagicCodeParams, type CheckMagicCodeResponse, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, StoreInterface, type StoreInterfaceStoreName, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, createInstantRouteHandler, };
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,EAAE,EACF,EAAE,EACF,MAAM,EACN,CAAC,EAGD,eAAe,EAGf,0BAA0B,EAG1B,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACr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AK,qBAAqB,EAC1B,KAAK,cAAc,EAGnB,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EAGvB,cAAc,EACd,KAAK,uBAAuB,EAG5B,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EAGxB,yBAAyB,GAC1B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ import { InstantAPIError, StoreInterface, SyncTableCallbackEventType, createInstantRouteHandler, i, id, lookup, tx } from "@instantdb/core";
2
+ import { InstantVueDatabase, init } from "./InstantVueDatabase.js";
3
+ import { InstantVueRoom } from "./InstantVueRoom.js";
4
+ import { _ } from "./chunks/SignedIn.vue_vue_type_script_setup_true_lang-MJrQPE2B.js";
5
+ import { _ as _2 } from "./chunks/SignedOut.vue_vue_type_script_setup_true_lang-CcoDHmXu.js";
6
+ import { _ as _3 } from "./chunks/Cursors.vue_vue_type_script_setup_true_lang-C6eE1KRI.js";
7
+ export {
8
+ _3 as Cursors,
9
+ InstantAPIError,
10
+ InstantVueDatabase,
11
+ InstantVueRoom,
12
+ _ as SignedIn,
13
+ _2 as SignedOut,
14
+ StoreInterface,
15
+ SyncTableCallbackEventType,
16
+ createInstantRouteHandler,
17
+ i,
18
+ id,
19
+ init,
20
+ lookup,
21
+ tx
22
+ };
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}