@sidekickdb/vue 0.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +202 -0
- package/NOTICE +27 -0
- package/README.md +45 -2
- package/dist/InstantVueDatabase.d.ts +190 -0
- package/dist/InstantVueDatabase.d.ts.map +1 -0
- package/dist/InstantVueDatabase.js +267 -0
- package/dist/InstantVueDatabase.js.map +1 -0
- package/dist/InstantVueRoom.d.ts +90 -0
- package/dist/InstantVueRoom.d.ts.map +1 -0
- package/dist/InstantVueRoom.js +180 -0
- package/dist/InstantVueRoom.js.map +1 -0
- package/dist/chunks/Cursor.vue_vue_type_script_setup_true_lang-DeM0moKd.js +32 -0
- package/dist/chunks/Cursor.vue_vue_type_script_setup_true_lang-DeM0moKd.js.map +1 -0
- package/dist/chunks/Cursors.vue_vue_type_script_setup_true_lang-C6eE1KRI.js +128 -0
- package/dist/chunks/Cursors.vue_vue_type_script_setup_true_lang-C6eE1KRI.js.map +1 -0
- package/dist/chunks/SignedIn.vue_vue_type_script_setup_true_lang-MJrQPE2B.js +18 -0
- package/dist/chunks/SignedIn.vue_vue_type_script_setup_true_lang-MJrQPE2B.js.map +1 -0
- package/dist/chunks/SignedOut.vue_vue_type_script_setup_true_lang-CcoDHmXu.js +18 -0
- package/dist/chunks/SignedOut.vue_vue_type_script_setup_true_lang-CcoDHmXu.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -0
- package/dist/components/Cursor.js +5 -0
- package/dist/components/Cursor.js.map +1 -0
- package/dist/components/Cursor.vue.d.ts +6 -0
- package/dist/components/Cursor.vue.d.ts.map +1 -0
- package/dist/components/Cursors.js +5 -0
- package/dist/components/Cursors.js.map +1 -0
- package/dist/components/Cursors.vue.d.ts +32 -0
- package/dist/components/Cursors.vue.d.ts.map +1 -0
- package/dist/components/SignedIn.js +5 -0
- package/dist/components/SignedIn.js.map +1 -0
- package/dist/components/SignedIn.vue.d.ts +18 -0
- package/dist/components/SignedIn.vue.d.ts.map +1 -0
- package/dist/components/SignedOut.js +5 -0
- package/dist/components/SignedOut.js.map +1 -0
- package/dist/components/SignedOut.vue.d.ts +18 -0
- package/dist/components/SignedOut.vue.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/useInfiniteQuery.d.ts +25 -0
- package/dist/useInfiniteQuery.d.ts.map +1 -0
- package/dist/useInfiniteQuery.js +57 -0
- package/dist/useInfiniteQuery.js.map +1 -0
- package/dist/utils.d.ts +8 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +12 -0
- package/dist/utils.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/package.json +58 -3
|
@@ -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 '@sidekickdb/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 '@sidekickdb/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 '@sidekickdb/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;;;;;;"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
package/dist/cli.js
ADDED
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"Cursors.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { RoomSchemaShape } from '@sidekickdb/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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-0,0 +1,18 @@
|
|
|
1
|
+
import type { InstantSchemaDef } from '@sidekickdb/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,kBAAkB,CAAC;AACzD,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 @@
|
|
|
1
|
+
{"version":3,"file":"SignedOut.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { InstantSchemaDef } from '@sidekickdb/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,kBAAkB,CAAC;AACzD,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"}
|
package/dist/index.d.ts
ADDED
|
@@ -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 InstantRouteHandlerPayloadByType, type InstantRouteHandlerType, type InstantRouteHandlerBody, type StoreInterfaceStoreName, type Logger } from '@sidekickdb/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, type InstantRouteHandlerPayloadByType, type InstantRouteHandlerType, type InstantRouteHandlerBody, type Logger, };
|
|
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,EACrB,KAAK,UAAU,EAGf,KAAK,YAAY,EAGjB,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,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EACrC,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAG5B,KAAK,MAAM,GACZ,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { InstantAPIError, StoreInterface, SyncTableCallbackEventType, createInstantRouteHandler, i, id, lookup, tx } from "@sidekickdb/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":";;;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { InstaQLResponse, ValidQuery, InstantCoreDatabase, InstantSchemaDef, InstaQLOptions } from '@sidekickdb/core';
|
|
2
|
+
import type { ShallowRef, Ref, MaybeRefOrGetter } from 'vue';
|
|
3
|
+
export type InfiniteQueryResult<Schema extends InstantSchemaDef<any, any, any>, Q extends ValidQuery<Q, Schema>, UseDates extends boolean> = {
|
|
4
|
+
isLoading: Ref<boolean>;
|
|
5
|
+
data: ShallowRef<InstaQLResponse<Schema, Q, UseDates> | undefined>;
|
|
6
|
+
error: ShallowRef<{
|
|
7
|
+
message: string;
|
|
8
|
+
} | undefined>;
|
|
9
|
+
canLoadNextPage: Ref<boolean>;
|
|
10
|
+
loadNextPage: () => void;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Subscribe to a query and incrementally load more items.
|
|
14
|
+
*
|
|
15
|
+
* Only one top-level namespace in the query is allowed. Changing the query or
|
|
16
|
+
* options while the subscription is active resets and starts over.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const { data, isLoading, error, loadNextPage, canLoadNextPage } =
|
|
20
|
+
* db.useInfiniteQuery({
|
|
21
|
+
* posts: { $: { limit: 20, order: { createdAt: 'desc' } } },
|
|
22
|
+
* });
|
|
23
|
+
*/
|
|
24
|
+
export declare function useInfiniteQuery<Schema extends InstantSchemaDef<any, any, any>, Q extends ValidQuery<Q, Schema>, UseDates extends boolean>(core: InstantCoreDatabase<Schema, UseDates>, query: MaybeRefOrGetter<Q | null>, opts?: MaybeRefOrGetter<InstaQLOptions | undefined>): InfiniteQueryResult<Schema, Q, UseDates>;
|
|
25
|
+
//# sourceMappingURL=useInfiniteQuery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInfiniteQuery.d.ts","sourceRoot":"","sources":["../src/useInfiniteQuery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EAEV,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAI7D,MAAM,MAAM,mBAAmB,CAC7B,MAAM,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC9C,CAAC,SAAS,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,EAC/B,QAAQ,SAAS,OAAO,IACtB;IACF,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACxB,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC,CAAC;IACnE,KAAK,EAAE,UAAU,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC,CAAC;IACnD,eAAe,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC9B,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,SAAS,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC9C,CAAC,SAAS,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,EAC/B,QAAQ,SAAS,OAAO,EAExB,IAAI,EAAE,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,EAC3C,KAAK,EAAE,gBAAgB,CAAC,CAAC,GAAG,IAAI,CAAC,EACjC,IAAI,CAAC,EAAE,gBAAgB,CAAC,cAAc,GAAG,SAAS,CAAC,GAClD,mBAAmB,CAAC,MAAM,EAAE,CAAC,EAAE,QAAQ,CAAC,CA6D1C"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { getInfiniteQueryInitialSnapshot, weakHash } from "@sidekickdb/core";
|
|
2
|
+
import { toValue, ref, shallowRef, watch } from "vue";
|
|
3
|
+
import { tryOnScopeDispose } from "./utils.js";
|
|
4
|
+
function useInfiniteQuery(core, query, opts) {
|
|
5
|
+
const initialQuery = toValue(query);
|
|
6
|
+
const snapshot = initialQuery ? getInfiniteQueryInitialSnapshot(core, initialQuery, toValue(opts)) : { data: void 0, error: void 0, canLoadNextPage: false };
|
|
7
|
+
const isLoading = ref(!snapshot.data && !snapshot.error);
|
|
8
|
+
const data = shallowRef(
|
|
9
|
+
snapshot.data
|
|
10
|
+
);
|
|
11
|
+
const error = shallowRef(snapshot.error);
|
|
12
|
+
const canLoadNextPage = ref(snapshot.canLoadNextPage);
|
|
13
|
+
let subRef = null;
|
|
14
|
+
const stop = watch(
|
|
15
|
+
[() => weakHash(toValue(query)), () => weakHash(toValue(opts))],
|
|
16
|
+
(_, __, onCleanup) => {
|
|
17
|
+
subRef = null;
|
|
18
|
+
error.value = void 0;
|
|
19
|
+
data.value = void 0;
|
|
20
|
+
isLoading.value = true;
|
|
21
|
+
canLoadNextPage.value = false;
|
|
22
|
+
const q = toValue(query);
|
|
23
|
+
if (!q) return;
|
|
24
|
+
const sub = core.subscribeInfiniteQuery(
|
|
25
|
+
q,
|
|
26
|
+
(resp) => {
|
|
27
|
+
error.value = resp.error;
|
|
28
|
+
data.value = resp.data;
|
|
29
|
+
isLoading.value = false;
|
|
30
|
+
canLoadNextPage.value = resp.canLoadNextPage;
|
|
31
|
+
},
|
|
32
|
+
toValue(opts)
|
|
33
|
+
);
|
|
34
|
+
subRef = sub;
|
|
35
|
+
onCleanup(() => {
|
|
36
|
+
sub.unsubscribe();
|
|
37
|
+
if (subRef === sub) subRef = null;
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
{ immediate: true }
|
|
41
|
+
);
|
|
42
|
+
const loadNextPage = () => {
|
|
43
|
+
subRef == null ? void 0 : subRef.loadNextPage();
|
|
44
|
+
};
|
|
45
|
+
tryOnScopeDispose(stop);
|
|
46
|
+
return {
|
|
47
|
+
isLoading,
|
|
48
|
+
data,
|
|
49
|
+
error,
|
|
50
|
+
canLoadNextPage,
|
|
51
|
+
loadNextPage
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
useInfiniteQuery
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=useInfiniteQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInfiniteQuery.js","sources":["../src/useInfiniteQuery.ts"],"sourcesContent":["import { weakHash, getInfiniteQueryInitialSnapshot } from '@sidekickdb/core';\nimport type {\n InstaQLResponse,\n ValidQuery,\n InfiniteQuerySubscription,\n InstantCoreDatabase,\n InstantSchemaDef,\n InstaQLOptions,\n} from '@sidekickdb/core';\nimport { shallowRef, ref, watch, toValue } from 'vue';\nimport type { ShallowRef, Ref, MaybeRefOrGetter } from 'vue';\n\nimport { tryOnScopeDispose } from './utils.js';\n\nexport type InfiniteQueryResult<\n Schema extends InstantSchemaDef<any, any, any>,\n Q extends ValidQuery<Q, Schema>,\n UseDates extends boolean,\n> = {\n isLoading: Ref<boolean>;\n data: ShallowRef<InstaQLResponse<Schema, Q, UseDates> | undefined>;\n error: ShallowRef<{ message: string } | undefined>;\n canLoadNextPage: Ref<boolean>;\n loadNextPage: () => void;\n};\n\n/**\n * Subscribe to a query and incrementally load more items.\n *\n * Only one top-level namespace in the query is allowed. Changing the query or\n * options while the subscription is active resets and starts over.\n *\n * @example\n * const { data, isLoading, error, loadNextPage, canLoadNextPage } =\n * db.useInfiniteQuery({\n * posts: { $: { limit: 20, order: { createdAt: 'desc' } } },\n * });\n */\nexport function useInfiniteQuery<\n Schema extends InstantSchemaDef<any, any, any>,\n Q extends ValidQuery<Q, Schema>,\n UseDates extends boolean,\n>(\n core: InstantCoreDatabase<Schema, UseDates>,\n query: MaybeRefOrGetter<Q | null>,\n opts?: MaybeRefOrGetter<InstaQLOptions | undefined>,\n): InfiniteQueryResult<Schema, Q, UseDates> {\n const initialQuery = toValue(query);\n const snapshot = initialQuery\n ? getInfiniteQueryInitialSnapshot(core, initialQuery, toValue(opts))\n : { data: undefined, error: undefined, canLoadNextPage: false };\n\n const isLoading = ref(!snapshot.data && !snapshot.error);\n const data = shallowRef<InstaQLResponse<Schema, Q, UseDates> | undefined>(\n snapshot.data as any,\n );\n const error = shallowRef<{ message: string } | undefined>(snapshot.error);\n const canLoadNextPage = ref(snapshot.canLoadNextPage);\n\n let subRef: InfiniteQuerySubscription | null = null;\n\n const stop = watch(\n [() => weakHash(toValue(query)), () => weakHash(toValue(opts))],\n (_, __, onCleanup) => {\n subRef = null;\n error.value = undefined;\n data.value = undefined;\n isLoading.value = true;\n canLoadNextPage.value = false;\n\n const q = toValue(query);\n if (!q) return;\n\n const sub = core.subscribeInfiniteQuery(\n q,\n (resp: any) => {\n error.value = resp.error;\n data.value = resp.data;\n isLoading.value = false;\n canLoadNextPage.value = resp.canLoadNextPage;\n },\n toValue(opts),\n );\n\n subRef = sub;\n\n onCleanup(() => {\n sub.unsubscribe();\n if (subRef === sub) subRef = null;\n });\n },\n { immediate: true },\n );\n\n const loadNextPage = () => {\n subRef?.loadNextPage();\n };\n\n tryOnScopeDispose(stop);\n\n return {\n isLoading,\n data,\n error,\n canLoadNextPage,\n loadNextPage,\n } as InfiniteQueryResult<Schema, Q, UseDates>;\n}\n"],"names":[],"mappings":";;;AAsCgB,SAAA,iBAKd,MACA,OACA,MAC0C;AACpC,QAAA,eAAe,QAAQ,KAAK;AAClC,QAAM,WAAW,eACb,gCAAgC,MAAM,cAAc,QAAQ,IAAI,CAAC,IACjE,EAAE,MAAM,QAAW,OAAO,QAAW,iBAAiB,MAAM;AAEhE,QAAM,YAAY,IAAI,CAAC,SAAS,QAAQ,CAAC,SAAS,KAAK;AACvD,QAAM,OAAO;AAAA,IACX,SAAS;AAAA,EACX;AACM,QAAA,QAAQ,WAA4C,SAAS,KAAK;AAClE,QAAA,kBAAkB,IAAI,SAAS,eAAe;AAEpD,MAAI,SAA2C;AAE/C,QAAM,OAAO;AAAA,IACX,CAAC,MAAM,SAAS,QAAQ,KAAK,CAAC,GAAG,MAAM,SAAS,QAAQ,IAAI,CAAC,CAAC;AAAA,IAC9D,CAAC,GAAG,IAAI,cAAc;AACX,eAAA;AACT,YAAM,QAAQ;AACd,WAAK,QAAQ;AACb,gBAAU,QAAQ;AAClB,sBAAgB,QAAQ;AAElB,YAAA,IAAI,QAAQ,KAAK;AACvB,UAAI,CAAC,EAAG;AAER,YAAM,MAAM,KAAK;AAAA,QACf;AAAA,QACA,CAAC,SAAc;AACb,gBAAM,QAAQ,KAAK;AACnB,eAAK,QAAQ,KAAK;AAClB,oBAAU,QAAQ;AAClB,0BAAgB,QAAQ,KAAK;AAAA,QAC/B;AAAA,QACA,QAAQ,IAAI;AAAA,MACd;AAES,eAAA;AAET,gBAAU,MAAM;AACd,YAAI,YAAY;AACZ,YAAA,WAAW,IAAc,UAAA;AAAA,MAAA,CAC9B;AAAA,IACH;AAAA,IACA,EAAE,WAAW,KAAK;AAAA,EACpB;AAEA,QAAM,eAAe,MAAM;AACzB,qCAAQ;AAAA,EACV;AAEA,oBAAkB,IAAI;AAEf,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run `fn` when the current effect scope is disposed. Returns true if a scope
|
|
3
|
+
* was active (and the callback was registered), false otherwise. Lets hooks
|
|
4
|
+
* work both inside component setup and inside a manual `effectScope()` without
|
|
5
|
+
* blowing up when called outside any scope.
|
|
6
|
+
*/
|
|
7
|
+
export declare function tryOnScopeDispose(fn: () => void): boolean;
|
|
8
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,OAAO,CAMzD"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import { onScopeDispose, getCurrentScope } from 'vue';\n\n/**\n * Run `fn` when the current effect scope is disposed. Returns true if a scope\n * was active (and the callback was registered), false otherwise. Lets hooks\n * work both inside component setup and inside a manual `effectScope()` without\n * blowing up when called outside any scope.\n */\nexport function tryOnScopeDispose(fn: () => void): boolean {\n if (getCurrentScope()) {\n onScopeDispose(fn);\n return true;\n }\n return false;\n}\n"],"names":[],"mappings":";AAQO,SAAS,kBAAkB,IAAyB;AACzD,MAAI,mBAAmB;AACrB,mBAAe,EAAE;AACV,WAAA;AAAA,EAAA;AAEF,SAAA;AACT;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,eAAe,OAAO,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sidekickdb/vue",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "2.0.1",
|
|
5
|
+
"description": "Vue client for SidekickDB",
|
|
5
6
|
"license": "Apache-2.0",
|
|
7
|
+
"homepage": "https://sidekickdb.co/docs/start-vue",
|
|
6
8
|
"repository": {
|
|
7
9
|
"type": "git",
|
|
8
10
|
"url": "git+https://github.com/SidekickDB/sidekick.git",
|
|
9
11
|
"directory": "client/packages/vue"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/SidekickDB/sidekick/issues"
|
|
15
|
+
},
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"module": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
"./package.json": "./package.json",
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"default": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./dist/cli": {
|
|
27
|
+
"types": "./dist/cli.d.ts",
|
|
28
|
+
"default": "./dist/cli.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"!dist/**/*.test.*",
|
|
34
|
+
"!dist/**/*.spec.*",
|
|
35
|
+
"LICENSE.md",
|
|
36
|
+
"NOTICE"
|
|
37
|
+
],
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"vue": "^3.4.0"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@sidekickdb/core": "2.0.1",
|
|
43
|
+
"@sidekickdb/version": "2.0.1"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@vitejs/plugin-vue": "^5.2.0",
|
|
47
|
+
"@vue/test-utils": "^2.4.0",
|
|
48
|
+
"jsdom": "^25.0.0",
|
|
49
|
+
"typescript": "^5.0.0",
|
|
50
|
+
"vite": "^5.2.0",
|
|
51
|
+
"vitest": "^2.0.0",
|
|
52
|
+
"vue": "^3.5.0",
|
|
53
|
+
"vue-tsc": "^2.2.0"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"test": "vitest run",
|
|
57
|
+
"test:watch": "vitest",
|
|
58
|
+
"test:ci": "vitest run",
|
|
59
|
+
"check": "vue-tsc --noEmit",
|
|
60
|
+
"build:types": "vue-tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
61
|
+
"build:js": "vite build",
|
|
62
|
+
"build": "rm -rf dist && pnpm build:types && pnpm build:js",
|
|
63
|
+
"dev": "vite build --watch",
|
|
64
|
+
"publish-package": "pnpm pack && npm publish *.tgz --access public"
|
|
10
65
|
}
|
|
11
|
-
}
|
|
66
|
+
}
|