@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
package/README.md ADDED
@@ -0,0 +1,84 @@
1
+ <!--
2
+ Get your module up and running quickly.
3
+
4
+ Find and replace all on all files (CMD+SHIFT+F):
5
+ - Name: My Module
6
+ - Package name: my-module
7
+ - Description: My new Nuxt module
8
+ -->
9
+
10
+ # My Module
11
+
12
+ [![npm version][npm-version-src]][npm-version-href]
13
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
14
+ [![License][license-src]][license-href]
15
+ [![Nuxt][nuxt-src]][nuxt-href]
16
+
17
+ My new Nuxt module for doing amazing things.
18
+
19
+ - [✨ &nbsp;Release Notes](/CHANGELOG.md)
20
+ <!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/my-module?file=playground%2Fapp.vue) -->
21
+ <!-- - [📖 &nbsp;Documentation](https://example.com) -->
22
+
23
+ ## Features
24
+
25
+ <!-- Highlight some of the features your module provide here -->
26
+ - ⛰ &nbsp;Foo
27
+ - 🚠 &nbsp;Bar
28
+ - 🌲 &nbsp;Baz
29
+
30
+ ## Quick Setup
31
+
32
+ Install the module to your Nuxt application with one command:
33
+
34
+ ```bash
35
+ npx nuxt module add my-module
36
+ ```
37
+
38
+ That's it! You can now use My Module in your Nuxt app ✨
39
+
40
+
41
+ ## Contribution
42
+
43
+ <details>
44
+ <summary>Local development</summary>
45
+
46
+ ```bash
47
+ # Install dependencies
48
+ npm install
49
+
50
+ # Generate type stubs
51
+ npm run dev:prepare
52
+
53
+ # Develop with the playground
54
+ npm run dev
55
+
56
+ # Build the playground
57
+ npm run dev:build
58
+
59
+ # Run ESLint
60
+ npm run lint
61
+
62
+ # Run Vitest
63
+ npm run test
64
+ npm run test:watch
65
+
66
+ # Release new version
67
+ npm run release
68
+ ```
69
+
70
+ </details>
71
+
72
+
73
+ <!-- Badges -->
74
+ [npm-version-src]: https://img.shields.io/npm/v/my-module/latest.svg?style=flat&colorA=020420&colorB=00DC82
75
+ [npm-version-href]: https://npmjs.com/package/my-module
76
+
77
+ [npm-downloads-src]: https://img.shields.io/npm/dm/my-module.svg?style=flat&colorA=020420&colorB=00DC82
78
+ [npm-downloads-href]: https://npm.chart.dev/my-module
79
+
80
+ [license-src]: https://img.shields.io/npm/l/my-module.svg?style=flat&colorA=020420&colorB=00DC82
81
+ [license-href]: https://npmjs.com/package/my-module
82
+
83
+ [nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt
84
+ [nuxt-href]: https://nuxt.com
@@ -0,0 +1,49 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+
3
+ interface ModuleOptions {
4
+ /**
5
+ * Base URL for the collaboration server (WebSocket + REST).
6
+ * Can also be set via NUXT_PUBLIC_COLLAB_URL env variable.
7
+ */
8
+ baseUrl?: string;
9
+ /** Authentication configuration */
10
+ auth?: {
11
+ /** 'managed' = built-in email/password, 'custom' = bring your own, 'none' = no auth */
12
+ mode?: "managed" | "custom" | "none";
13
+ /** Auto-refresh tokens before expiry */
14
+ autoRefresh?: boolean;
15
+ /** Seconds before token expiry to trigger refresh */
16
+ refreshBuffer?: number;
17
+ };
18
+ /** Offline support configuration */
19
+ offline?: {
20
+ /** Enable IndexedDB persistence for documents */
21
+ enablePersistence?: boolean;
22
+ /** Enable offline file upload queue */
23
+ enableUploadQueue?: boolean;
24
+ /** IndexedDB database name prefix */
25
+ persistenceDbName?: string;
26
+ };
27
+ /** Auto-import composables from this module */
28
+ autoImports?: boolean;
29
+ /** Add global auth middleware (redirects unauthenticated users) */
30
+ globalAuth?: boolean;
31
+ /** Redirect paths */
32
+ redirects?: {
33
+ login?: string;
34
+ logout?: string;
35
+ callback?: string;
36
+ };
37
+ /** Debug logging */
38
+ debug?: boolean;
39
+ }
40
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
41
+
42
+ declare module "@nuxt/schema" {
43
+ interface PublicRuntimeConfig {
44
+ collab: ModuleOptions;
45
+ }
46
+ }
47
+
48
+ export { _default as default };
49
+ export type { ModuleOptions };
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@collab/nuxt",
3
+ "configKey": "collab",
4
+ "compatibility": {
5
+ "nuxt": "^3.0.0 || ^4.0.0"
6
+ },
7
+ "version": "1.0.1",
8
+ "builder": {
9
+ "@nuxt/module-builder": "1.0.2",
10
+ "unbuild": "3.6.1"
11
+ }
12
+ }
@@ -0,0 +1,126 @@
1
+ import { defineNuxtModule, createResolver, addPlugin, addComponentsDir, addImports, addImportsDir, addRouteMiddleware } from '@nuxt/kit';
2
+ import { defu } from 'defu';
3
+
4
+ const module$1 = defineNuxtModule({
5
+ meta: {
6
+ name: "@collab/nuxt",
7
+ configKey: "collab",
8
+ compatibility: {
9
+ nuxt: "^3.0.0 || ^4.0.0"
10
+ }
11
+ },
12
+ defaults: {
13
+ baseUrl: "",
14
+ auth: {
15
+ mode: "managed",
16
+ autoRefresh: true,
17
+ refreshBuffer: 3600
18
+ },
19
+ offline: {
20
+ enablePersistence: true,
21
+ enableUploadQueue: true,
22
+ persistenceDbName: "collab"
23
+ },
24
+ autoImports: true,
25
+ globalAuth: false,
26
+ redirects: {
27
+ login: "/login",
28
+ logout: "/",
29
+ callback: "/"
30
+ },
31
+ debug: false
32
+ },
33
+ async setup(options, nuxt) {
34
+ const resolver = createResolver(import.meta.url);
35
+ console.log("[Collab Module] setup running");
36
+ nuxt.options.runtimeConfig.public.collab = defu(
37
+ nuxt.options.runtimeConfig.public.collab,
38
+ {
39
+ baseUrl: options.baseUrl || process.env.NUXT_PUBLIC_COLLAB_URL || "",
40
+ auth: options.auth,
41
+ offline: options.offline,
42
+ redirects: options.redirects,
43
+ debug: options.debug
44
+ }
45
+ );
46
+ nuxt.options.vite.optimizeDeps = nuxt.options.vite.optimizeDeps || {};
47
+ nuxt.options.vite.optimizeDeps.include = nuxt.options.vite.optimizeDeps.include || [];
48
+ nuxt.options.vite.optimizeDeps.include.push(
49
+ "@rgby/collab-core",
50
+ "@rgby/collab-vue",
51
+ "@hocuspocus/provider",
52
+ "yjs",
53
+ "y-indexeddb",
54
+ "y-protocols/awareness",
55
+ "y-protocols/sync",
56
+ "y-protocols/auth",
57
+ "lib0 > isomorphic.js",
58
+ "@tiptap/core",
59
+ "@tiptap/vue-3",
60
+ "@tiptap/pm/state",
61
+ "@tiptap/pm/view",
62
+ "@tiptap/pm/tables",
63
+ "@tiptap/extension-emoji",
64
+ "@tiptap/extension-list",
65
+ "@tiptap/extension-table",
66
+ "tiptap-extension-code-block-shiki",
67
+ "@internationalized/date",
68
+ "lucide-vue-next",
69
+ "scule"
70
+ );
71
+ nuxt.options.build.transpile = nuxt.options.build.transpile || [];
72
+ nuxt.options.build.transpile.push("@rgby/collab-core", "@rgby/collab-vue");
73
+ addPlugin({
74
+ src: resolver.resolve("./runtime/plugin"),
75
+ mode: "client"
76
+ });
77
+ addComponentsDir({
78
+ path: resolver.resolve("./runtime/components"),
79
+ prefix: "Collab",
80
+ global: true
81
+ });
82
+ const clientComposables = [
83
+ "provideCollabClient",
84
+ "useCollabClient",
85
+ "useDocument",
86
+ "useSyncedMap",
87
+ "useSyncedArray",
88
+ "useSyncedText",
89
+ "useSyncedXml",
90
+ "useAwareness",
91
+ "useLiveComments",
92
+ "useAuth",
93
+ "useTiptapEditor",
94
+ "useCollaborativeDocument"
95
+ ];
96
+ const clientPath = await resolver.resolvePath("@rgby/collab-vue");
97
+ console.log(`[Collab Module] Resolved client path: ${clientPath}`);
98
+ for (const name of clientComposables) {
99
+ if (options.debug) {
100
+ console.log(`[Collab Module] Auto-importing ${name} from ${clientPath}`);
101
+ }
102
+ addImports({
103
+ name,
104
+ as: name,
105
+ from: clientPath
106
+ });
107
+ }
108
+ if (options.autoImports) {
109
+ addImportsDir(resolver.resolve("./runtime/composables"));
110
+ }
111
+ if (options.globalAuth) {
112
+ addRouteMiddleware({
113
+ name: "collab-auth",
114
+ path: resolver.resolve("./runtime/middleware/collab-auth"),
115
+ global: true
116
+ });
117
+ } else {
118
+ addRouteMiddleware({
119
+ name: "collab-auth",
120
+ path: resolver.resolve("./runtime/middleware/collab-auth")
121
+ });
122
+ }
123
+ }
124
+ });
125
+
126
+ export { module$1 as default };
@@ -0,0 +1,17 @@
1
+ type __VLS_Props = {
2
+ /** Space ID */
3
+ spaceId: string;
4
+ /** Document ID (if omitted, shows space-level activity) */
5
+ documentId?: string;
6
+ /** Max items to display */
7
+ limit?: number;
8
+ };
9
+ declare function loadActivity(): Promise<void>;
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
11
+ refresh: typeof loadActivity;
12
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
13
+ documentId: string;
14
+ limit: number;
15
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
+ declare const _default: typeof __VLS_export;
17
+ export default _default;
@@ -0,0 +1,108 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ spaceId: { type: String, required: true },
4
+ documentId: { type: String, required: false, default: void 0 },
5
+ limit: { type: Number, required: false, default: 20 }
6
+ });
7
+ const client = useCollabClient();
8
+ const activities = ref([]);
9
+ const loading = ref(true);
10
+ const timelineItems = computed(
11
+ () => activities.value.map((a) => ({
12
+ title: a.title,
13
+ description: `${a.description} \xB7 ${formatTimeAgo(a.time)}`,
14
+ icon: a.icon
15
+ }))
16
+ );
17
+ async function loadActivity() {
18
+ loading.value = true;
19
+ const items = [];
20
+ try {
21
+ if (props.documentId) {
22
+ const snapshots = await client.documents.getSnapshots(props.spaceId, props.documentId);
23
+ for (const snap of snapshots.slice(0, props.limit)) {
24
+ items.push({
25
+ title: "Document updated",
26
+ description: formatSize(snap.size),
27
+ icon: "i-lucide-history",
28
+ time: new Date(snap.createdAt)
29
+ });
30
+ }
31
+ try {
32
+ const comments = await client.comments.list(props.spaceId, props.documentId);
33
+ for (const thread of comments.threads) {
34
+ items.push({
35
+ title: `${thread.authorName} commented`,
36
+ description: thread.content.slice(0, 60) + (thread.content.length > 60 ? "..." : ""),
37
+ icon: "i-lucide-message-square",
38
+ time: new Date(thread.createdAt)
39
+ });
40
+ for (const reply of thread.replies) {
41
+ items.push({
42
+ title: `${reply.authorName} replied`,
43
+ description: reply.content.slice(0, 60) + (reply.content.length > 60 ? "..." : ""),
44
+ icon: "i-lucide-reply",
45
+ time: new Date(reply.createdAt)
46
+ });
47
+ }
48
+ }
49
+ } catch {
50
+ }
51
+ }
52
+ items.sort((a, b) => b.time.getTime() - a.time.getTime());
53
+ activities.value = items.slice(0, props.limit);
54
+ } finally {
55
+ loading.value = false;
56
+ }
57
+ }
58
+ function formatTimeAgo(date) {
59
+ const now = /* @__PURE__ */ new Date();
60
+ const diffMs = now.getTime() - date.getTime();
61
+ const diffMins = Math.floor(diffMs / 6e4);
62
+ if (diffMins < 1) return "Just now";
63
+ if (diffMins < 60) return `${diffMins}m ago`;
64
+ const diffHours = Math.floor(diffMins / 60);
65
+ if (diffHours < 24) return `${diffHours}h ago`;
66
+ const diffDays = Math.floor(diffHours / 24);
67
+ if (diffDays < 30) return `${diffDays}d ago`;
68
+ return date.toLocaleDateString();
69
+ }
70
+ function formatSize(bytes) {
71
+ if (bytes == null || isNaN(bytes)) return "";
72
+ if (bytes < 1024) return `${bytes} B`;
73
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
74
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
75
+ }
76
+ watch(
77
+ () => [props.spaceId, props.documentId],
78
+ loadActivity,
79
+ { immediate: true }
80
+ );
81
+ defineExpose({ refresh: loadActivity });
82
+ </script>
83
+
84
+ <template>
85
+ <div class="space-y-3">
86
+ <div class="flex items-center justify-between">
87
+ <h3 class="text-sm font-medium">Activity</h3>
88
+ <UButton
89
+ icon="i-lucide-refresh-cw"
90
+ variant="ghost"
91
+ color="neutral"
92
+ size="xs"
93
+ @click="loadActivity"
94
+ />
95
+ </div>
96
+
97
+ <USkeleton v-if="loading" class="h-32" />
98
+
99
+ <UEmpty
100
+ v-else-if="activities.length === 0"
101
+ icon="i-lucide-activity"
102
+ title="No activity yet"
103
+ size="sm"
104
+ />
105
+
106
+ <UTimeline v-else :items="timelineItems" color="neutral" size="sm" />
107
+ </div>
108
+ </template>
@@ -0,0 +1,17 @@
1
+ type __VLS_Props = {
2
+ /** Space ID */
3
+ spaceId: string;
4
+ /** Document ID (if omitted, shows space-level activity) */
5
+ documentId?: string;
6
+ /** Max items to display */
7
+ limit?: number;
8
+ };
9
+ declare function loadActivity(): Promise<void>;
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
11
+ refresh: typeof loadActivity;
12
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
13
+ documentId: string;
14
+ limit: number;
15
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
+ declare const _default: typeof __VLS_export;
17
+ export default _default;
@@ -0,0 +1,20 @@
1
+ type __VLS_Props = {
2
+ /** Login or signup mode */
3
+ mode?: "login" | "signup";
4
+ /** Redirect URL after success */
5
+ redirectTo?: string;
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ error: (err: Error) => any;
9
+ success: (session: any) => any;
10
+ "update:mode": (mode: "login" | "signup") => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onError?: ((err: Error) => any) | undefined;
13
+ onSuccess?: ((session: any) => any) | undefined;
14
+ "onUpdate:mode"?: ((mode: "login" | "signup") => any) | undefined;
15
+ }>, {
16
+ mode: "login" | "signup";
17
+ redirectTo: string;
18
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
@@ -0,0 +1,78 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ mode: { type: String, required: false, default: "login" },
4
+ redirectTo: { type: String, required: false, default: void 0 }
5
+ });
6
+ const emit = defineEmits(["update:mode", "success", "error"]);
7
+ const { login, signup } = useAuth();
8
+ const toast = useToast();
9
+ const loading = ref(false);
10
+ const errorMessage = ref("");
11
+ const loginFields = [
12
+ { name: "email", type: "email", label: "Email", placeholder: "you@example.com", required: true },
13
+ { name: "password", type: "password", label: "Password", placeholder: "Enter your password", required: true }
14
+ ];
15
+ const signupFields = [
16
+ { name: "name", type: "text", label: "Name", placeholder: "Your name", required: true },
17
+ { name: "email", type: "email", label: "Email", placeholder: "you@example.com", required: true },
18
+ { name: "password", type: "password", label: "Password", placeholder: "Choose a password", required: true }
19
+ ];
20
+ const fields = computed(() => props.mode === "signup" ? signupFields : loginFields);
21
+ async function onSubmit(event) {
22
+ loading.value = true;
23
+ errorMessage.value = "";
24
+ try {
25
+ let session;
26
+ if (props.mode === "signup") {
27
+ session = await signup(event.data.email, event.data.password, event.data.name);
28
+ } else {
29
+ session = await login(event.data.email, event.data.password);
30
+ }
31
+ toast.add({
32
+ title: props.mode === "signup" ? "Account created" : "Logged in",
33
+ color: "success",
34
+ icon: "i-lucide-check"
35
+ });
36
+ emit("success", session);
37
+ if (props.redirectTo) {
38
+ navigateTo(props.redirectTo);
39
+ }
40
+ } catch (err) {
41
+ errorMessage.value = err?.message || "Authentication failed";
42
+ emit("error", err);
43
+ } finally {
44
+ loading.value = false;
45
+ }
46
+ }
47
+ </script>
48
+
49
+ <template>
50
+ <div class="space-y-4">
51
+ <UAuthForm
52
+ :title="mode === 'signup' ? 'Create Account' : 'Welcome Back'"
53
+ :description="mode === 'signup' ? 'Sign up to get started.' : 'Sign in to your account.'"
54
+ :icon="mode === 'signup' ? 'i-lucide-user-plus' : 'i-lucide-log-in'"
55
+ :fields="fields"
56
+ :loading="loading"
57
+ :submit="{ label: mode === 'signup' ? 'Sign Up' : 'Sign In', block: true }"
58
+ @submit="onSubmit"
59
+ >
60
+ <template #footer>
61
+ <div class="text-center">
62
+ <UAlert v-if="errorMessage" :title="errorMessage" color="error" variant="subtle" icon="i-lucide-alert-circle" class="mb-3" />
63
+
64
+ <span class="text-sm text-(--ui-text-muted)">
65
+ <template v-if="mode === 'login'">
66
+ Don't have an account?
67
+ <UButton variant="link" label="Sign up" size="sm" @click="emit('update:mode', 'signup')" />
68
+ </template>
69
+ <template v-else>
70
+ Already have an account?
71
+ <UButton variant="link" label="Sign in" size="sm" @click="emit('update:mode', 'login')" />
72
+ </template>
73
+ </span>
74
+ </div>
75
+ </template>
76
+ </UAuthForm>
77
+ </div>
78
+ </template>
@@ -0,0 +1,20 @@
1
+ type __VLS_Props = {
2
+ /** Login or signup mode */
3
+ mode?: "login" | "signup";
4
+ /** Redirect URL after success */
5
+ redirectTo?: string;
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ error: (err: Error) => any;
9
+ success: (session: any) => any;
10
+ "update:mode": (mode: "login" | "signup") => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onError?: ((err: Error) => any) | undefined;
13
+ onSuccess?: ((session: any) => any) | undefined;
14
+ "onUpdate:mode"?: ((mode: "login" | "signup") => any) | undefined;
15
+ }>, {
16
+ mode: "login" | "signup";
17
+ redirectTo: string;
18
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import type { ShallowRef } from "vue";
2
+ import type { CollabProvider } from "@rgby/collab-core";
3
+ type __VLS_Props = {
4
+ spaceId: string;
5
+ documentId: string;
6
+ provider: ShallowRef<CollabProvider | null> | CollabProvider | null;
7
+ };
8
+ declare const __VLS_export: 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>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;