@cou.sh/nuxt 1.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/README.md +84 -0
- package/dist/module.d.mts +49 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +126 -0
- package/dist/runtime/components/ActivityTimeline.d.vue.ts +17 -0
- package/dist/runtime/components/ActivityTimeline.vue +108 -0
- package/dist/runtime/components/ActivityTimeline.vue.d.ts +17 -0
- package/dist/runtime/components/AuthForm.d.vue.ts +20 -0
- package/dist/runtime/components/AuthForm.vue +78 -0
- package/dist/runtime/components/AuthForm.vue.d.ts +20 -0
- package/dist/runtime/components/CommentThread.d.vue.ts +10 -0
- package/dist/runtime/components/CommentThread.vue +149 -0
- package/dist/runtime/components/CommentThread.vue.d.ts +10 -0
- package/dist/runtime/components/ConnectionStatus.d.vue.ts +13 -0
- package/dist/runtime/components/ConnectionStatus.vue +27 -0
- package/dist/runtime/components/ConnectionStatus.vue.d.ts +13 -0
- package/dist/runtime/components/DocumentBreadcrumb.d.vue.ts +13 -0
- package/dist/runtime/components/DocumentBreadcrumb.vue +38 -0
- package/dist/runtime/components/DocumentBreadcrumb.vue.d.ts +13 -0
- package/dist/runtime/components/DocumentCard.d.vue.ts +30 -0
- package/dist/runtime/components/DocumentCard.vue +88 -0
- package/dist/runtime/components/DocumentCard.vue.d.ts +30 -0
- package/dist/runtime/components/DocumentSearchPalette.d.vue.ts +22 -0
- package/dist/runtime/components/DocumentSearchPalette.vue +99 -0
- package/dist/runtime/components/DocumentSearchPalette.vue.d.ts +22 -0
- package/dist/runtime/components/DocumentTree.d.vue.ts +32 -0
- package/dist/runtime/components/DocumentTree.vue +497 -0
- package/dist/runtime/components/DocumentTree.vue.d.ts +32 -0
- package/dist/runtime/components/Editor.d.vue.ts +11 -0
- package/dist/runtime/components/Editor.vue +328 -0
- package/dist/runtime/components/Editor.vue.d.ts +11 -0
- package/dist/runtime/components/ExportMenu.d.vue.ts +9 -0
- package/dist/runtime/components/ExportMenu.vue +55 -0
- package/dist/runtime/components/ExportMenu.vue.d.ts +9 -0
- package/dist/runtime/components/FileUploader.d.vue.ts +22 -0
- package/dist/runtime/components/FileUploader.vue +148 -0
- package/dist/runtime/components/FileUploader.vue.d.ts +22 -0
- package/dist/runtime/components/MemberManager.d.vue.ts +9 -0
- package/dist/runtime/components/MemberManager.vue +153 -0
- package/dist/runtime/components/MemberManager.vue.d.ts +9 -0
- package/dist/runtime/components/OfflineIndicator.d.vue.ts +9 -0
- package/dist/runtime/components/OfflineIndicator.vue +44 -0
- package/dist/runtime/components/OfflineIndicator.vue.d.ts +9 -0
- package/dist/runtime/components/PermissionGuard.d.vue.ts +25 -0
- package/dist/runtime/components/PermissionGuard.vue +16 -0
- package/dist/runtime/components/PermissionGuard.vue.d.ts +25 -0
- package/dist/runtime/components/RoleBadge.d.vue.ts +11 -0
- package/dist/runtime/components/RoleBadge.vue +30 -0
- package/dist/runtime/components/RoleBadge.vue.d.ts +11 -0
- package/dist/runtime/components/ShareDialog.d.vue.ts +15 -0
- package/dist/runtime/components/ShareDialog.vue +119 -0
- package/dist/runtime/components/ShareDialog.vue.d.ts +15 -0
- package/dist/runtime/components/SnapshotTimeline.d.vue.ts +15 -0
- package/dist/runtime/components/SnapshotTimeline.vue +118 -0
- package/dist/runtime/components/SnapshotTimeline.vue.d.ts +15 -0
- package/dist/runtime/components/SpaceSettings.d.vue.ts +7 -0
- package/dist/runtime/components/SpaceSettings.vue +105 -0
- package/dist/runtime/components/SpaceSettings.vue.d.ts +7 -0
- package/dist/runtime/components/SpaceSwitcher.d.vue.ts +18 -0
- package/dist/runtime/components/SpaceSwitcher.vue +104 -0
- package/dist/runtime/components/SpaceSwitcher.vue.d.ts +18 -0
- package/dist/runtime/components/TrashBin.d.vue.ts +7 -0
- package/dist/runtime/components/TrashBin.vue +159 -0
- package/dist/runtime/components/TrashBin.vue.d.ts +7 -0
- package/dist/runtime/components/UserMenu.d.vue.ts +13 -0
- package/dist/runtime/components/UserMenu.vue +50 -0
- package/dist/runtime/components/UserMenu.vue.d.ts +13 -0
- package/dist/runtime/components/UserPresence.d.vue.ts +13 -0
- package/dist/runtime/components/UserPresence.vue +34 -0
- package/dist/runtime/components/UserPresence.vue.d.ts +13 -0
- package/dist/runtime/components/editor/CollaborationUsers.d.vue.ts +7 -0
- package/dist/runtime/components/editor/CollaborationUsers.vue +31 -0
- package/dist/runtime/components/editor/CollaborationUsers.vue.d.ts +7 -0
- package/dist/runtime/components/editor/CompletionExtension.d.ts +43 -0
- package/dist/runtime/components/editor/CompletionExtension.js +133 -0
- package/dist/runtime/components/editor/ImageUploadExtension.d.ts +10 -0
- package/dist/runtime/components/editor/ImageUploadExtension.js +31 -0
- package/dist/runtime/components/editor/ImageUploadNode.d.vue.ts +4 -0
- package/dist/runtime/components/editor/ImageUploadNode.vue +59 -0
- package/dist/runtime/components/editor/ImageUploadNode.vue.d.ts +4 -0
- package/dist/runtime/components/editor/LinkPopover.d.vue.ts +8 -0
- package/dist/runtime/components/editor/LinkPopover.vue +131 -0
- package/dist/runtime/components/editor/LinkPopover.vue.d.ts +8 -0
- package/dist/runtime/components/widgets/ButtonWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/ButtonWidget.vue +32 -0
- package/dist/runtime/components/widgets/ButtonWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/CalendarWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/CalendarWidget.vue +36 -0
- package/dist/runtime/components/widgets/CalendarWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/CheckboxWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/CheckboxWidget.vue +32 -0
- package/dist/runtime/components/widgets/CheckboxWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/ColorPickerWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/ColorPickerWidget.vue +30 -0
- package/dist/runtime/components/widgets/ColorPickerWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/IconWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/IconWidget.vue +102 -0
- package/dist/runtime/components/widgets/IconWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/InputDateWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/InputDateWidget.vue +38 -0
- package/dist/runtime/components/widgets/InputDateWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/ScrollAreaWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/ScrollAreaWidget.vue +41 -0
- package/dist/runtime/components/widgets/ScrollAreaWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/SliderWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/SliderWidget.vue +42 -0
- package/dist/runtime/components/widgets/SliderWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/SwitchWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/SwitchWidget.vue +35 -0
- package/dist/runtime/components/widgets/SwitchWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/TabPanelWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/TabPanelWidget.vue +22 -0
- package/dist/runtime/components/widgets/TabPanelWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/TabsWidget.d.vue.ts +4 -0
- package/dist/runtime/components/widgets/TabsWidget.vue +109 -0
- package/dist/runtime/components/widgets/TabsWidget.vue.d.ts +4 -0
- package/dist/runtime/components/widgets/index.d.ts +13 -0
- package/dist/runtime/components/widgets/index.js +278 -0
- package/dist/runtime/composables/index.d.ts +14 -0
- package/dist/runtime/composables/index.js +13 -0
- package/dist/runtime/composables/useCollabStatus.d.ts +10 -0
- package/dist/runtime/composables/useCollabStatus.js +23 -0
- package/dist/runtime/composables/useDocumentPermissions.d.ts +11 -0
- package/dist/runtime/composables/useDocumentPermissions.js +44 -0
- package/dist/runtime/composables/useEditorCollaboration.d.ts +25 -0
- package/dist/runtime/composables/useEditorCollaboration.js +141 -0
- package/dist/runtime/composables/useEditorCompletion.d.ts +60 -0
- package/dist/runtime/composables/useEditorCompletion.js +42 -0
- package/dist/runtime/composables/useEditorDragHandle.d.ts +10 -0
- package/dist/runtime/composables/useEditorDragHandle.js +130 -0
- package/dist/runtime/composables/useEditorEmojis.d.ts +4 -0
- package/dist/runtime/composables/useEditorEmojis.js +9 -0
- package/dist/runtime/composables/useEditorMentions.d.ts +4 -0
- package/dist/runtime/composables/useEditorMentions.js +27 -0
- package/dist/runtime/composables/useEditorSuggestions.d.ts +149 -0
- package/dist/runtime/composables/useEditorSuggestions.js +114 -0
- package/dist/runtime/composables/useEditorToolbar.d.ts +12 -0
- package/dist/runtime/composables/useEditorToolbar.js +194 -0
- package/dist/runtime/composables/useLucideIcons.d.ts +4 -0
- package/dist/runtime/composables/useLucideIcons.js +16 -0
- package/dist/runtime/composables/useOnlineStatus.d.ts +6 -0
- package/dist/runtime/composables/useOnlineStatus.js +44 -0
- package/dist/runtime/composables/useSpaces.d.ts +36 -0
- package/dist/runtime/composables/useSpaces.js +29 -0
- package/dist/runtime/middleware/collab-auth.d.ts +2 -0
- package/dist/runtime/middleware/collab-auth.js +18 -0
- package/dist/runtime/plugin.d.ts +7 -0
- package/dist/runtime/plugin.js +39 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/types.d.mts +3 -0
- package/package.json +66 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ref, onMounted, onUnmounted } from "vue";
|
|
2
|
+
export function useOnlineStatus() {
|
|
3
|
+
const isOnline = ref(typeof navigator !== "undefined" ? navigator.onLine : true);
|
|
4
|
+
const lastOnline = ref(/* @__PURE__ */ new Date());
|
|
5
|
+
const pendingUploads = ref(0);
|
|
6
|
+
let unsubscribeQueue = null;
|
|
7
|
+
function handleOnline() {
|
|
8
|
+
isOnline.value = true;
|
|
9
|
+
lastOnline.value = /* @__PURE__ */ new Date();
|
|
10
|
+
}
|
|
11
|
+
function handleOffline() {
|
|
12
|
+
isOnline.value = false;
|
|
13
|
+
}
|
|
14
|
+
async function refreshPendingUploads() {
|
|
15
|
+
try {
|
|
16
|
+
const client = useCollabClient();
|
|
17
|
+
pendingUploads.value = await client.getPendingUploadsCount();
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
onMounted(() => {
|
|
22
|
+
window.addEventListener("online", handleOnline);
|
|
23
|
+
window.addEventListener("offline", handleOffline);
|
|
24
|
+
try {
|
|
25
|
+
const client = useCollabClient();
|
|
26
|
+
unsubscribeQueue = client.onUploadQueue("queue-changed", () => {
|
|
27
|
+
refreshPendingUploads();
|
|
28
|
+
});
|
|
29
|
+
refreshPendingUploads();
|
|
30
|
+
} catch {
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
onUnmounted(() => {
|
|
34
|
+
window.removeEventListener("online", handleOnline);
|
|
35
|
+
window.removeEventListener("offline", handleOffline);
|
|
36
|
+
unsubscribeQueue?.();
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
isOnline,
|
|
40
|
+
lastOnline,
|
|
41
|
+
pendingUploads,
|
|
42
|
+
refreshPendingUploads
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Space } from "@rgby/collab-core";
|
|
2
|
+
export declare function useSpaces(): {
|
|
3
|
+
spaces: import("vue").Ref<{
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
slug: string;
|
|
7
|
+
logo?: string | null | undefined;
|
|
8
|
+
createdAt: string;
|
|
9
|
+
role: string;
|
|
10
|
+
memberCount?: number | undefined;
|
|
11
|
+
documentCount?: number | undefined;
|
|
12
|
+
}[], Space[] | {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
slug: string;
|
|
16
|
+
logo?: string | null | undefined;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
role: string;
|
|
19
|
+
memberCount?: number | undefined;
|
|
20
|
+
documentCount?: number | undefined;
|
|
21
|
+
}[]>;
|
|
22
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
23
|
+
currentSpaceId: import("vue").Ref<string | undefined, string | undefined>;
|
|
24
|
+
currentSpace: import("vue").ComputedRef<{
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
slug: string;
|
|
28
|
+
logo?: string | null | undefined;
|
|
29
|
+
createdAt: string;
|
|
30
|
+
role: string;
|
|
31
|
+
memberCount?: number | undefined;
|
|
32
|
+
documentCount?: number | undefined;
|
|
33
|
+
} | undefined>;
|
|
34
|
+
refresh: () => Promise<void>;
|
|
35
|
+
setCurrentSpace: (spaceId: string) => void;
|
|
36
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ref, computed } from "vue";
|
|
2
|
+
export function useSpaces() {
|
|
3
|
+
const client = useCollabClient();
|
|
4
|
+
const spaces = ref([]);
|
|
5
|
+
const loading = ref(false);
|
|
6
|
+
const currentSpaceId = ref();
|
|
7
|
+
const currentSpace = computed(
|
|
8
|
+
() => spaces.value.find((s) => s.id === currentSpaceId.value)
|
|
9
|
+
);
|
|
10
|
+
async function refresh() {
|
|
11
|
+
loading.value = true;
|
|
12
|
+
try {
|
|
13
|
+
spaces.value = await client.spaces.list();
|
|
14
|
+
} finally {
|
|
15
|
+
loading.value = false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function setCurrentSpace(spaceId) {
|
|
19
|
+
currentSpaceId.value = spaceId;
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
spaces,
|
|
23
|
+
loading,
|
|
24
|
+
currentSpaceId,
|
|
25
|
+
currentSpace,
|
|
26
|
+
refresh,
|
|
27
|
+
setCurrentSpace
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineNuxtRouteMiddleware, navigateTo, useRuntimeConfig } from "#app";
|
|
2
|
+
export default defineNuxtRouteMiddleware((to) => {
|
|
3
|
+
if (import.meta.server) return;
|
|
4
|
+
const config = useRuntimeConfig().public.collab;
|
|
5
|
+
if (config.auth?.mode === "none") return;
|
|
6
|
+
const loginPath = config.redirects?.login || "/login";
|
|
7
|
+
if (to.path === loginPath) return;
|
|
8
|
+
const { $collabClient } = useNuxtApp();
|
|
9
|
+
const client = $collabClient;
|
|
10
|
+
if (!client) return;
|
|
11
|
+
const session = client.getSession?.();
|
|
12
|
+
if (!session) {
|
|
13
|
+
return navigateTo({
|
|
14
|
+
path: loginPath,
|
|
15
|
+
query: { redirect: to.fullPath }
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { defineNuxtPlugin, useRuntimeConfig } from "#app";
|
|
2
|
+
import { CollabClient } from "@rgby/collab-core";
|
|
3
|
+
import { CollabClientKey } from "@rgby/collab-vue";
|
|
4
|
+
export default defineNuxtPlugin({
|
|
5
|
+
name: "collab-client",
|
|
6
|
+
enforce: "pre",
|
|
7
|
+
setup(nuxtApp) {
|
|
8
|
+
console.log("[Collab Plugin] Setup running");
|
|
9
|
+
console.log("[Collab Plugin] Key:", CollabClientKey.toString());
|
|
10
|
+
const config = useRuntimeConfig().public.collab;
|
|
11
|
+
const authConfig = config.auth?.mode === "managed" ? {
|
|
12
|
+
managedAuth: {
|
|
13
|
+
autoRefresh: config.auth.autoRefresh ?? true,
|
|
14
|
+
refreshBuffer: config.auth.refreshBuffer ?? 3600
|
|
15
|
+
}
|
|
16
|
+
} : {};
|
|
17
|
+
const client = new CollabClient({
|
|
18
|
+
baseUrl: config.baseUrl || "http://localhost:8000",
|
|
19
|
+
...authConfig,
|
|
20
|
+
offline: {
|
|
21
|
+
enablePersistence: config.offline?.enablePersistence ?? true,
|
|
22
|
+
enableUploadQueue: config.offline?.enableUploadQueue ?? true,
|
|
23
|
+
persistenceDbName: config.offline?.persistenceDbName ?? "collab"
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
if (config.debug) {
|
|
27
|
+
console.log("[Collab] Client initialized", {
|
|
28
|
+
baseUrl: config.baseUrl,
|
|
29
|
+
auth: config.auth?.mode
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
nuxtApp.vueApp.provide(CollabClientKey, client);
|
|
33
|
+
return {
|
|
34
|
+
provide: {
|
|
35
|
+
collabClient: client
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
});
|
package/dist/types.d.mts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cou.sh/nuxt",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "CoUnit Nuxt Module",
|
|
5
|
+
"repository": "@cou.sh/nuxt",
|
|
6
|
+
"private": false,
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/types.d.mts",
|
|
12
|
+
"import": "./dist/module.mjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"main": "./dist/module.mjs",
|
|
16
|
+
"typesVersions": {
|
|
17
|
+
"*": {
|
|
18
|
+
".": [
|
|
19
|
+
"./dist/types.d.mts"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"workspaces": [
|
|
27
|
+
"playground"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"prepack": "nuxt-module-build build",
|
|
31
|
+
"dev": "NODE_OPTIONS='--max-old-space-size=8192' bun run dev:prepare && NODE_OPTIONS='--max-old-space-size=8192' nuxt dev playground",
|
|
32
|
+
"dev:build": "NODE_OPTIONS='--max-old-space-size=8192' nuxt build playground",
|
|
33
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playground",
|
|
34
|
+
"release": "bun run prepack && changelogen --release && npm publish && git push --follow-tags",
|
|
35
|
+
"lint": "eslint .",
|
|
36
|
+
"test": "vitest run",
|
|
37
|
+
"test:watch": "vitest watch",
|
|
38
|
+
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@nuxt/kit": "^4.3.1",
|
|
42
|
+
"@rgby/collab-core": "latest",
|
|
43
|
+
"@rgby/collab-vue": "latest",
|
|
44
|
+
"defu": "^6.1.4"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@nuxt/devtools": "^3.2.1",
|
|
48
|
+
"@nuxt/eslint": "1.15.1",
|
|
49
|
+
"@nuxt/eslint-config": "^1.15.1",
|
|
50
|
+
"@nuxt/module-builder": "^1.0.2",
|
|
51
|
+
"@nuxt/schema": "^4.3.1",
|
|
52
|
+
"@nuxt/test-utils": "^4.0.0",
|
|
53
|
+
"@nuxt/ui": "^4.4.0",
|
|
54
|
+
"@types/node": "latest",
|
|
55
|
+
"changelogen": "^0.6.2",
|
|
56
|
+
"eslint": "^10.0.0",
|
|
57
|
+
"nuxt": "^4.3.1",
|
|
58
|
+
"typescript": "~5.9.3",
|
|
59
|
+
"vitest": "^4.0.18",
|
|
60
|
+
"vue-tsc": "^3.2.4",
|
|
61
|
+
"@rgby/collab-sdk": "latest"
|
|
62
|
+
},
|
|
63
|
+
"overrides": {
|
|
64
|
+
"@rgby/collab-core": "latest"
|
|
65
|
+
}
|
|
66
|
+
}
|