@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.
Files changed (151) hide show
  1. package/README.md +84 -0
  2. package/dist/module.d.mts +49 -0
  3. package/dist/module.json +12 -0
  4. package/dist/module.mjs +126 -0
  5. package/dist/runtime/components/ActivityTimeline.d.vue.ts +17 -0
  6. package/dist/runtime/components/ActivityTimeline.vue +108 -0
  7. package/dist/runtime/components/ActivityTimeline.vue.d.ts +17 -0
  8. package/dist/runtime/components/AuthForm.d.vue.ts +20 -0
  9. package/dist/runtime/components/AuthForm.vue +78 -0
  10. package/dist/runtime/components/AuthForm.vue.d.ts +20 -0
  11. package/dist/runtime/components/CommentThread.d.vue.ts +10 -0
  12. package/dist/runtime/components/CommentThread.vue +149 -0
  13. package/dist/runtime/components/CommentThread.vue.d.ts +10 -0
  14. package/dist/runtime/components/ConnectionStatus.d.vue.ts +13 -0
  15. package/dist/runtime/components/ConnectionStatus.vue +27 -0
  16. package/dist/runtime/components/ConnectionStatus.vue.d.ts +13 -0
  17. package/dist/runtime/components/DocumentBreadcrumb.d.vue.ts +13 -0
  18. package/dist/runtime/components/DocumentBreadcrumb.vue +38 -0
  19. package/dist/runtime/components/DocumentBreadcrumb.vue.d.ts +13 -0
  20. package/dist/runtime/components/DocumentCard.d.vue.ts +30 -0
  21. package/dist/runtime/components/DocumentCard.vue +88 -0
  22. package/dist/runtime/components/DocumentCard.vue.d.ts +30 -0
  23. package/dist/runtime/components/DocumentSearchPalette.d.vue.ts +22 -0
  24. package/dist/runtime/components/DocumentSearchPalette.vue +99 -0
  25. package/dist/runtime/components/DocumentSearchPalette.vue.d.ts +22 -0
  26. package/dist/runtime/components/DocumentTree.d.vue.ts +32 -0
  27. package/dist/runtime/components/DocumentTree.vue +497 -0
  28. package/dist/runtime/components/DocumentTree.vue.d.ts +32 -0
  29. package/dist/runtime/components/Editor.d.vue.ts +11 -0
  30. package/dist/runtime/components/Editor.vue +328 -0
  31. package/dist/runtime/components/Editor.vue.d.ts +11 -0
  32. package/dist/runtime/components/ExportMenu.d.vue.ts +9 -0
  33. package/dist/runtime/components/ExportMenu.vue +55 -0
  34. package/dist/runtime/components/ExportMenu.vue.d.ts +9 -0
  35. package/dist/runtime/components/FileUploader.d.vue.ts +22 -0
  36. package/dist/runtime/components/FileUploader.vue +148 -0
  37. package/dist/runtime/components/FileUploader.vue.d.ts +22 -0
  38. package/dist/runtime/components/MemberManager.d.vue.ts +9 -0
  39. package/dist/runtime/components/MemberManager.vue +153 -0
  40. package/dist/runtime/components/MemberManager.vue.d.ts +9 -0
  41. package/dist/runtime/components/OfflineIndicator.d.vue.ts +9 -0
  42. package/dist/runtime/components/OfflineIndicator.vue +44 -0
  43. package/dist/runtime/components/OfflineIndicator.vue.d.ts +9 -0
  44. package/dist/runtime/components/PermissionGuard.d.vue.ts +25 -0
  45. package/dist/runtime/components/PermissionGuard.vue +16 -0
  46. package/dist/runtime/components/PermissionGuard.vue.d.ts +25 -0
  47. package/dist/runtime/components/RoleBadge.d.vue.ts +11 -0
  48. package/dist/runtime/components/RoleBadge.vue +30 -0
  49. package/dist/runtime/components/RoleBadge.vue.d.ts +11 -0
  50. package/dist/runtime/components/ShareDialog.d.vue.ts +15 -0
  51. package/dist/runtime/components/ShareDialog.vue +119 -0
  52. package/dist/runtime/components/ShareDialog.vue.d.ts +15 -0
  53. package/dist/runtime/components/SnapshotTimeline.d.vue.ts +15 -0
  54. package/dist/runtime/components/SnapshotTimeline.vue +118 -0
  55. package/dist/runtime/components/SnapshotTimeline.vue.d.ts +15 -0
  56. package/dist/runtime/components/SpaceSettings.d.vue.ts +7 -0
  57. package/dist/runtime/components/SpaceSettings.vue +105 -0
  58. package/dist/runtime/components/SpaceSettings.vue.d.ts +7 -0
  59. package/dist/runtime/components/SpaceSwitcher.d.vue.ts +18 -0
  60. package/dist/runtime/components/SpaceSwitcher.vue +104 -0
  61. package/dist/runtime/components/SpaceSwitcher.vue.d.ts +18 -0
  62. package/dist/runtime/components/TrashBin.d.vue.ts +7 -0
  63. package/dist/runtime/components/TrashBin.vue +159 -0
  64. package/dist/runtime/components/TrashBin.vue.d.ts +7 -0
  65. package/dist/runtime/components/UserMenu.d.vue.ts +13 -0
  66. package/dist/runtime/components/UserMenu.vue +50 -0
  67. package/dist/runtime/components/UserMenu.vue.d.ts +13 -0
  68. package/dist/runtime/components/UserPresence.d.vue.ts +13 -0
  69. package/dist/runtime/components/UserPresence.vue +34 -0
  70. package/dist/runtime/components/UserPresence.vue.d.ts +13 -0
  71. package/dist/runtime/components/editor/CollaborationUsers.d.vue.ts +7 -0
  72. package/dist/runtime/components/editor/CollaborationUsers.vue +31 -0
  73. package/dist/runtime/components/editor/CollaborationUsers.vue.d.ts +7 -0
  74. package/dist/runtime/components/editor/CompletionExtension.d.ts +43 -0
  75. package/dist/runtime/components/editor/CompletionExtension.js +133 -0
  76. package/dist/runtime/components/editor/ImageUploadExtension.d.ts +10 -0
  77. package/dist/runtime/components/editor/ImageUploadExtension.js +31 -0
  78. package/dist/runtime/components/editor/ImageUploadNode.d.vue.ts +4 -0
  79. package/dist/runtime/components/editor/ImageUploadNode.vue +59 -0
  80. package/dist/runtime/components/editor/ImageUploadNode.vue.d.ts +4 -0
  81. package/dist/runtime/components/editor/LinkPopover.d.vue.ts +8 -0
  82. package/dist/runtime/components/editor/LinkPopover.vue +131 -0
  83. package/dist/runtime/components/editor/LinkPopover.vue.d.ts +8 -0
  84. package/dist/runtime/components/widgets/ButtonWidget.d.vue.ts +4 -0
  85. package/dist/runtime/components/widgets/ButtonWidget.vue +32 -0
  86. package/dist/runtime/components/widgets/ButtonWidget.vue.d.ts +4 -0
  87. package/dist/runtime/components/widgets/CalendarWidget.d.vue.ts +4 -0
  88. package/dist/runtime/components/widgets/CalendarWidget.vue +36 -0
  89. package/dist/runtime/components/widgets/CalendarWidget.vue.d.ts +4 -0
  90. package/dist/runtime/components/widgets/CheckboxWidget.d.vue.ts +4 -0
  91. package/dist/runtime/components/widgets/CheckboxWidget.vue +32 -0
  92. package/dist/runtime/components/widgets/CheckboxWidget.vue.d.ts +4 -0
  93. package/dist/runtime/components/widgets/ColorPickerWidget.d.vue.ts +4 -0
  94. package/dist/runtime/components/widgets/ColorPickerWidget.vue +30 -0
  95. package/dist/runtime/components/widgets/ColorPickerWidget.vue.d.ts +4 -0
  96. package/dist/runtime/components/widgets/IconWidget.d.vue.ts +4 -0
  97. package/dist/runtime/components/widgets/IconWidget.vue +102 -0
  98. package/dist/runtime/components/widgets/IconWidget.vue.d.ts +4 -0
  99. package/dist/runtime/components/widgets/InputDateWidget.d.vue.ts +4 -0
  100. package/dist/runtime/components/widgets/InputDateWidget.vue +38 -0
  101. package/dist/runtime/components/widgets/InputDateWidget.vue.d.ts +4 -0
  102. package/dist/runtime/components/widgets/ScrollAreaWidget.d.vue.ts +4 -0
  103. package/dist/runtime/components/widgets/ScrollAreaWidget.vue +41 -0
  104. package/dist/runtime/components/widgets/ScrollAreaWidget.vue.d.ts +4 -0
  105. package/dist/runtime/components/widgets/SliderWidget.d.vue.ts +4 -0
  106. package/dist/runtime/components/widgets/SliderWidget.vue +42 -0
  107. package/dist/runtime/components/widgets/SliderWidget.vue.d.ts +4 -0
  108. package/dist/runtime/components/widgets/SwitchWidget.d.vue.ts +4 -0
  109. package/dist/runtime/components/widgets/SwitchWidget.vue +35 -0
  110. package/dist/runtime/components/widgets/SwitchWidget.vue.d.ts +4 -0
  111. package/dist/runtime/components/widgets/TabPanelWidget.d.vue.ts +4 -0
  112. package/dist/runtime/components/widgets/TabPanelWidget.vue +22 -0
  113. package/dist/runtime/components/widgets/TabPanelWidget.vue.d.ts +4 -0
  114. package/dist/runtime/components/widgets/TabsWidget.d.vue.ts +4 -0
  115. package/dist/runtime/components/widgets/TabsWidget.vue +109 -0
  116. package/dist/runtime/components/widgets/TabsWidget.vue.d.ts +4 -0
  117. package/dist/runtime/components/widgets/index.d.ts +13 -0
  118. package/dist/runtime/components/widgets/index.js +278 -0
  119. package/dist/runtime/composables/index.d.ts +14 -0
  120. package/dist/runtime/composables/index.js +13 -0
  121. package/dist/runtime/composables/useCollabStatus.d.ts +10 -0
  122. package/dist/runtime/composables/useCollabStatus.js +23 -0
  123. package/dist/runtime/composables/useDocumentPermissions.d.ts +11 -0
  124. package/dist/runtime/composables/useDocumentPermissions.js +44 -0
  125. package/dist/runtime/composables/useEditorCollaboration.d.ts +25 -0
  126. package/dist/runtime/composables/useEditorCollaboration.js +141 -0
  127. package/dist/runtime/composables/useEditorCompletion.d.ts +60 -0
  128. package/dist/runtime/composables/useEditorCompletion.js +42 -0
  129. package/dist/runtime/composables/useEditorDragHandle.d.ts +10 -0
  130. package/dist/runtime/composables/useEditorDragHandle.js +130 -0
  131. package/dist/runtime/composables/useEditorEmojis.d.ts +4 -0
  132. package/dist/runtime/composables/useEditorEmojis.js +9 -0
  133. package/dist/runtime/composables/useEditorMentions.d.ts +4 -0
  134. package/dist/runtime/composables/useEditorMentions.js +27 -0
  135. package/dist/runtime/composables/useEditorSuggestions.d.ts +149 -0
  136. package/dist/runtime/composables/useEditorSuggestions.js +114 -0
  137. package/dist/runtime/composables/useEditorToolbar.d.ts +12 -0
  138. package/dist/runtime/composables/useEditorToolbar.js +194 -0
  139. package/dist/runtime/composables/useLucideIcons.d.ts +4 -0
  140. package/dist/runtime/composables/useLucideIcons.js +16 -0
  141. package/dist/runtime/composables/useOnlineStatus.d.ts +6 -0
  142. package/dist/runtime/composables/useOnlineStatus.js +44 -0
  143. package/dist/runtime/composables/useSpaces.d.ts +36 -0
  144. package/dist/runtime/composables/useSpaces.js +29 -0
  145. package/dist/runtime/middleware/collab-auth.d.ts +2 -0
  146. package/dist/runtime/middleware/collab-auth.js +18 -0
  147. package/dist/runtime/plugin.d.ts +7 -0
  148. package/dist/runtime/plugin.js +39 -0
  149. package/dist/runtime/server/tsconfig.json +3 -0
  150. package/dist/types.d.mts +3 -0
  151. 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,2 @@
1
+ declare const _default: import("#app").RouteMiddleware;
2
+ export default _default;
@@ -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,7 @@
1
+ import { CollabClient } from "@rgby/collab-core";
2
+ declare const _default: import("#app").Plugin<{
3
+ collabClient: CollabClient;
4
+ }> & import("#app").ObjectPlugin<{
5
+ collabClient: CollabClient;
6
+ }>;
7
+ export default _default;
@@ -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
+ });
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "../../../.nuxt/tsconfig.server.json",
3
+ }
@@ -0,0 +1,3 @@
1
+ export { default } from './module.mjs'
2
+
3
+ export { type ModuleOptions } from './module.mjs'
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
+ }