@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,153 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ spaceId: { type: String, required: true },
4
+ currentUserRole: { type: String, required: false, default: "owner" }
5
+ });
6
+ const client = useCollabClient();
7
+ const toast = useToast();
8
+ const members = ref([]);
9
+ const loading = ref(true);
10
+ const roleItems = ["owner", "admin", "member", "editor", "viewer"];
11
+ const canManage = computed(
12
+ () => ["owner", "admin"].includes(props.currentUserRole)
13
+ );
14
+ function roleColor(role) {
15
+ const map = {
16
+ owner: "error",
17
+ admin: "warning",
18
+ member: "primary",
19
+ editor: "info",
20
+ viewer: "neutral"
21
+ };
22
+ return map[role] ?? "neutral";
23
+ }
24
+ async function loadMembers() {
25
+ loading.value = true;
26
+ try {
27
+ members.value = await client.spaces.getMembers(props.spaceId);
28
+ } finally {
29
+ loading.value = false;
30
+ }
31
+ }
32
+ async function updateRole(userId, newRole) {
33
+ try {
34
+ await client.spaces.updateRole(props.spaceId, userId, newRole);
35
+ toast.add({ title: "Role updated", color: "success" });
36
+ await loadMembers();
37
+ } catch {
38
+ toast.add({ title: "Failed to update role", color: "error" });
39
+ }
40
+ }
41
+ async function removeMember(userId) {
42
+ try {
43
+ await client.spaces.removeMember(props.spaceId, userId);
44
+ toast.add({ title: "Member removed", color: "success" });
45
+ await loadMembers();
46
+ } catch {
47
+ toast.add({ title: "Failed to remove member", color: "error" });
48
+ }
49
+ }
50
+ const showInvite = ref(false);
51
+ const inviteEmail = ref("");
52
+ const inviteRole = ref("member");
53
+ const inviting = ref(false);
54
+ async function inviteMember() {
55
+ if (!inviteEmail.value.trim()) return;
56
+ inviting.value = true;
57
+ try {
58
+ await client.spaces.addMember(props.spaceId, inviteEmail.value.trim(), inviteRole.value);
59
+ toast.add({
60
+ title: "Invitation sent",
61
+ description: `${inviteEmail.value} invited as ${inviteRole.value}`,
62
+ color: "success"
63
+ });
64
+ inviteEmail.value = "";
65
+ inviteRole.value = "member";
66
+ showInvite.value = false;
67
+ await loadMembers();
68
+ } catch {
69
+ toast.add({ title: "Failed to invite member", color: "error" });
70
+ } finally {
71
+ inviting.value = false;
72
+ }
73
+ }
74
+ watch(() => props.spaceId, loadMembers);
75
+ onMounted(loadMembers);
76
+ </script>
77
+
78
+ <template>
79
+ <div class="space-y-4">
80
+ <div class="flex items-center justify-between">
81
+ <h3 class="text-sm font-medium">Members</h3>
82
+ <UButton
83
+ v-if="canManage"
84
+ icon="i-lucide-user-plus"
85
+ label="Invite"
86
+ variant="soft"
87
+ size="xs"
88
+ @click="showInvite = true"
89
+ />
90
+ </div>
91
+
92
+ <USkeleton v-if="loading" class="h-32" />
93
+
94
+ <div v-else class="space-y-1">
95
+ <div
96
+ v-for="member in members"
97
+ :key="member.id"
98
+ class="flex items-center justify-between gap-3 px-2 py-2"
99
+ >
100
+ <UUser
101
+ :name="member.user?.name || member.userId"
102
+ :description="member.user?.email"
103
+ :avatar="{ src: member.user?.image, alt: member.user?.name || member.userId }"
104
+ size="sm"
105
+ />
106
+
107
+ <div class="flex items-center gap-2 shrink-0">
108
+ <USelect
109
+ v-if="canManage && member.role !== 'owner'"
110
+ :model-value="member.role"
111
+ :items="roleItems"
112
+ size="xs"
113
+ class="w-24"
114
+ @update:model-value="updateRole(member.userId, $event)"
115
+ />
116
+ <UBadge v-else :label="member.role" :color="roleColor(member.role)" variant="subtle" size="xs" />
117
+
118
+ <UDropdownMenu
119
+ v-if="canManage && member.role !== 'owner'"
120
+ :items="[
121
+ [{ label: 'Remove', icon: 'i-lucide-user-minus', color: 'error', onSelect: () => removeMember(member.userId) }]
122
+ ]"
123
+ >
124
+ <UButton icon="i-lucide-ellipsis-vertical" variant="ghost" color="neutral" size="2xs" />
125
+ </UDropdownMenu>
126
+ </div>
127
+ </div>
128
+ </div>
129
+
130
+ <UModal v-model:open="showInvite" title="Invite Member" description="Add someone to this space.">
131
+ <template #body>
132
+ <div class="space-y-3">
133
+ <UFormField label="Email" required>
134
+ <UInput
135
+ v-model="inviteEmail"
136
+ type="email"
137
+ placeholder="user@example.com"
138
+ autofocus
139
+ @keydown.enter="inviteMember"
140
+ />
141
+ </UFormField>
142
+ <UFormField label="Role">
143
+ <USelect v-model="inviteRole" :items="roleItems.filter((r) => r !== 'owner')" />
144
+ </UFormField>
145
+ </div>
146
+ </template>
147
+ <template #footer>
148
+ <UButton variant="ghost" color="neutral" label="Cancel" @click="showInvite = false" />
149
+ <UButton label="Invite" :loading="inviting" :disabled="!inviteEmail.trim()" @click="inviteMember" />
150
+ </template>
151
+ </UModal>
152
+ </div>
153
+ </template>
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ spaceId: string;
3
+ currentUserRole?: string;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
+ currentUserRole: string;
7
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ /** Show pending upload count */
3
+ showPendingUploads?: boolean;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
+ showPendingUploads: boolean;
7
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,44 @@
1
+ <script setup>
2
+ defineProps({
3
+ showPendingUploads: { type: Boolean, required: false, default: true }
4
+ });
5
+ const { isOnline, pendingUploads } = useOnlineStatus();
6
+ const dismissed = ref(false);
7
+ watch(isOnline, (online) => {
8
+ if (online) dismissed.value = false;
9
+ });
10
+ const message = computed(() => {
11
+ if (isOnline.value) return "";
12
+ let msg = "You're offline. Changes will sync when reconnected.";
13
+ if (pendingUploads.value > 0) {
14
+ msg += ` ${pendingUploads.value} upload${pendingUploads.value > 1 ? "s" : ""} pending.`;
15
+ }
16
+ return msg;
17
+ });
18
+ </script>
19
+
20
+ <template>
21
+ <Transition
22
+ enter-active-class="transition-all duration-300 ease-out"
23
+ enter-from-class="opacity-0 -translate-y-2"
24
+ enter-to-class="opacity-100 translate-y-0"
25
+ leave-active-class="transition-all duration-200 ease-in"
26
+ leave-from-class="opacity-100 translate-y-0"
27
+ leave-to-class="opacity-0 -translate-y-2"
28
+ >
29
+ <UAlert
30
+ v-if="!isOnline && !dismissed"
31
+ :title="message"
32
+ color="warning"
33
+ variant="subtle"
34
+ icon="i-lucide-wifi-off"
35
+ :close="{
36
+ icon: 'i-lucide-x',
37
+ color: 'neutral',
38
+ variant: 'ghost',
39
+ size: 'xs'
40
+ }"
41
+ @update:open="dismissed = true"
42
+ />
43
+ </Transition>
44
+ </template>
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ /** Show pending upload count */
3
+ showPendingUploads?: boolean;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
+ showPendingUploads: boolean;
7
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,25 @@
1
+ type __VLS_Props = {
2
+ /** Current user role */
3
+ role: string;
4
+ /** Required role(s) — user must have at least one */
5
+ requires: string | string[];
6
+ /** Fallback text when unauthorized */
7
+ fallback?: string;
8
+ };
9
+ declare var __VLS_1: {}, __VLS_3: {};
10
+ type __VLS_Slots = {} & {
11
+ default?: (props: typeof __VLS_1) => any;
12
+ } & {
13
+ fallback?: (props: typeof __VLS_3) => any;
14
+ };
15
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
16
+ fallback: string;
17
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
21
+ type __VLS_WithSlots<T, S> = T & {
22
+ new (): {
23
+ $slots: S;
24
+ };
25
+ };
@@ -0,0 +1,16 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ role: { type: String, required: true },
4
+ requires: { type: [String, Array], required: true },
5
+ fallback: { type: String, required: false, default: void 0 }
6
+ });
7
+ const { meetsRole } = useDocumentPermissions(computed(() => props.role));
8
+ const allowed = computed(() => meetsRole(props.requires));
9
+ </script>
10
+
11
+ <template>
12
+ <slot v-if="allowed" />
13
+ <slot v-else name="fallback">
14
+ <span v-if="fallback" class="text-sm text-(--ui-text-muted)">{{ fallback }}</span>
15
+ </slot>
16
+ </template>
@@ -0,0 +1,25 @@
1
+ type __VLS_Props = {
2
+ /** Current user role */
3
+ role: string;
4
+ /** Required role(s) — user must have at least one */
5
+ requires: string | string[];
6
+ /** Fallback text when unauthorized */
7
+ fallback?: string;
8
+ };
9
+ declare var __VLS_1: {}, __VLS_3: {};
10
+ type __VLS_Slots = {} & {
11
+ default?: (props: typeof __VLS_1) => any;
12
+ } & {
13
+ fallback?: (props: typeof __VLS_3) => any;
14
+ };
15
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
16
+ fallback: string;
17
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
21
+ type __VLS_WithSlots<T, S> = T & {
22
+ new (): {
23
+ $slots: S;
24
+ };
25
+ };
@@ -0,0 +1,11 @@
1
+ type __VLS_Props = {
2
+ /** User role */
3
+ role: string;
4
+ /** Badge size */
5
+ size?: "xs" | "sm" | "md" | "lg";
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
8
+ size: "xs" | "sm" | "md" | "lg";
9
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
@@ -0,0 +1,30 @@
1
+ <script setup>
2
+ defineProps({
3
+ role: { type: String, required: true },
4
+ size: { type: String, required: false, default: "xs" }
5
+ });
6
+ const roleColors = {
7
+ owner: "error",
8
+ admin: "warning",
9
+ member: "primary",
10
+ editor: "info",
11
+ viewer: "neutral"
12
+ };
13
+ const roleIcons = {
14
+ owner: "i-lucide-crown",
15
+ admin: "i-lucide-shield",
16
+ member: "i-lucide-user",
17
+ editor: "i-lucide-pencil",
18
+ viewer: "i-lucide-eye"
19
+ };
20
+ </script>
21
+
22
+ <template>
23
+ <UBadge
24
+ :label="role"
25
+ :color="roleColors[role] ?? 'neutral'"
26
+ :icon="roleIcons[role]"
27
+ variant="subtle"
28
+ :size="size"
29
+ />
30
+ </template>
@@ -0,0 +1,11 @@
1
+ type __VLS_Props = {
2
+ /** User role */
3
+ role: string;
4
+ /** Badge size */
5
+ size?: "xs" | "sm" | "md" | "lg";
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
8
+ size: "xs" | "sm" | "md" | "lg";
9
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
@@ -0,0 +1,15 @@
1
+ type __VLS_Props = {
2
+ /** Space ID */
3
+ spaceId: string;
4
+ /** Document ID */
5
+ documentId: string;
6
+ /** Control open state */
7
+ open: boolean;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ "update:open": (value: boolean) => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
13
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
@@ -0,0 +1,119 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ spaceId: { type: String, required: true },
4
+ documentId: { type: String, required: true },
5
+ open: { type: Boolean, required: true }
6
+ });
7
+ const emit = defineEmits(["update:open"]);
8
+ const client = useCollabClient();
9
+ const toast = useToast();
10
+ const isOpen = computed({
11
+ get: () => props.open,
12
+ set: (val) => emit("update:open", val)
13
+ });
14
+ const shareEnabled = ref(false);
15
+ const shareUrl = ref("");
16
+ const shareToken = ref("");
17
+ const loading = ref(true);
18
+ const toggling = ref(false);
19
+ const copied = ref(false);
20
+ async function loadShareState() {
21
+ loading.value = true;
22
+ try {
23
+ const res = await client.share.get(props.spaceId, props.documentId);
24
+ const info = res.data || res;
25
+ shareEnabled.value = !!info.enabled;
26
+ shareUrl.value = info.url || "";
27
+ shareToken.value = info.token || "";
28
+ } catch {
29
+ } finally {
30
+ loading.value = false;
31
+ }
32
+ }
33
+ async function toggleSharing(enabled) {
34
+ toggling.value = true;
35
+ try {
36
+ if (enabled) {
37
+ const res = await client.share.enable(props.spaceId, props.documentId);
38
+ const result = res.data || res;
39
+ shareEnabled.value = true;
40
+ shareUrl.value = result.url;
41
+ shareToken.value = result.token;
42
+ } else {
43
+ await client.share.disable(props.spaceId, props.documentId);
44
+ shareEnabled.value = false;
45
+ shareUrl.value = "";
46
+ shareToken.value = "";
47
+ }
48
+ } catch {
49
+ toast.add({ title: "Failed to update sharing", color: "error" });
50
+ } finally {
51
+ toggling.value = false;
52
+ }
53
+ }
54
+ async function copyUrl() {
55
+ if (!shareUrl.value) return;
56
+ try {
57
+ await navigator.clipboard.writeText(shareUrl.value);
58
+ copied.value = true;
59
+ toast.add({ title: "Link copied", color: "success", icon: "i-lucide-check" });
60
+ setTimeout(() => {
61
+ copied.value = false;
62
+ }, 2e3);
63
+ } catch {
64
+ toast.add({ title: "Failed to copy", color: "error" });
65
+ }
66
+ }
67
+ watch(isOpen, (open) => {
68
+ if (open) loadShareState();
69
+ });
70
+ </script>
71
+
72
+ <template>
73
+ <UModal v-model:open="isOpen" title="Share Document" description="Anyone with the link can view this document.">
74
+ <template #body>
75
+ <div class="space-y-4">
76
+ <USkeleton v-if="loading" class="h-16" />
77
+
78
+ <template v-else>
79
+ <div class="flex items-center justify-between">
80
+ <div>
81
+ <div class="text-sm font-medium">Public sharing</div>
82
+ <div class="text-xs text-muted">Enable to generate a shareable link</div>
83
+ </div>
84
+ <USwitch
85
+ :model-value="shareEnabled"
86
+ :loading="toggling"
87
+ @update:model-value="toggleSharing"
88
+ />
89
+ </div>
90
+
91
+ <div v-if="shareEnabled && shareUrl" class="space-y-2">
92
+ <UFormField label="Shareable link">
93
+ <div class="flex items-center gap-2">
94
+ <UInput
95
+ :model-value="shareUrl"
96
+ readonly
97
+ class="flex-1"
98
+ size="sm"
99
+ />
100
+ <UButton
101
+ :icon="copied ? 'i-lucide-check' : 'i-lucide-copy'"
102
+ variant="soft"
103
+ size="sm"
104
+ @click="copyUrl"
105
+ />
106
+ </div>
107
+ </UFormField>
108
+ </div>
109
+ </template>
110
+ </div>
111
+ </template>
112
+
113
+ <template #footer>
114
+ <div class="flex justify-end">
115
+ <UButton variant="ghost" color="neutral" label="Close" @click="isOpen = false" />
116
+ </div>
117
+ </template>
118
+ </UModal>
119
+ </template>
@@ -0,0 +1,15 @@
1
+ type __VLS_Props = {
2
+ /** Space ID */
3
+ spaceId: string;
4
+ /** Document ID */
5
+ documentId: string;
6
+ /** Control open state */
7
+ open: boolean;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ "update:open": (value: boolean) => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
13
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
@@ -0,0 +1,15 @@
1
+ import type { DocumentSnapshot } from "@rgby/collab-core";
2
+ type __VLS_Props = {
3
+ spaceId: string;
4
+ documentId: string;
5
+ };
6
+ declare function loadSnapshots(): Promise<void>;
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
8
+ refresh: typeof loadSnapshots;
9
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ restore: (snapshot: DocumentSnapshot) => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onRestore?: ((snapshot: DocumentSnapshot) => any) | undefined;
13
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
@@ -0,0 +1,118 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ spaceId: { type: String, required: true },
4
+ documentId: { type: String, required: true }
5
+ });
6
+ const emit = defineEmits(["restore"]);
7
+ const client = useCollabClient();
8
+ const toast = useToast();
9
+ const snapshots = ref([]);
10
+ const loading = ref(true);
11
+ const timelineItems = computed(
12
+ () => snapshots.value.map((snap) => ({
13
+ title: formatDate(snap.createdAt),
14
+ description: formatSize(snap.size),
15
+ icon: "i-lucide-history",
16
+ value: snap.id
17
+ }))
18
+ );
19
+ const selectedId = ref();
20
+ const showConfirm = ref(false);
21
+ const restoring = ref(false);
22
+ function promptRestore(snapshotId) {
23
+ selectedId.value = snapshotId;
24
+ showConfirm.value = true;
25
+ }
26
+ async function confirmRestore() {
27
+ if (!selectedId.value) return;
28
+ restoring.value = true;
29
+ try {
30
+ await client.documents.restoreSnapshot(props.spaceId, props.documentId, selectedId.value);
31
+ const snap = snapshots.value.find((s) => s.id === selectedId.value);
32
+ if (snap) emit("restore", snap);
33
+ toast.add({ title: "Snapshot restored", color: "success", icon: "i-lucide-check" });
34
+ showConfirm.value = false;
35
+ } catch {
36
+ toast.add({ title: "Failed to restore snapshot", color: "error" });
37
+ } finally {
38
+ restoring.value = false;
39
+ }
40
+ }
41
+ async function loadSnapshots() {
42
+ loading.value = true;
43
+ try {
44
+ snapshots.value = await client.documents.getSnapshots(props.spaceId, props.documentId);
45
+ } finally {
46
+ loading.value = false;
47
+ }
48
+ }
49
+ function formatDate(dateStr) {
50
+ return new Date(dateStr).toLocaleString(void 0, {
51
+ month: "short",
52
+ day: "numeric",
53
+ hour: "2-digit",
54
+ minute: "2-digit"
55
+ });
56
+ }
57
+ function formatSize(bytes) {
58
+ if (bytes == null || isNaN(bytes)) return "";
59
+ if (bytes < 1024) return `${bytes} B`;
60
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
61
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
62
+ }
63
+ watch(
64
+ () => [props.spaceId, props.documentId],
65
+ loadSnapshots,
66
+ { immediate: true }
67
+ );
68
+ defineExpose({ refresh: loadSnapshots });
69
+ </script>
70
+
71
+ <template>
72
+ <div class="space-y-3">
73
+ <div class="flex items-center justify-between">
74
+ <h3 class="text-sm font-medium">Version History</h3>
75
+ <UButton
76
+ icon="i-lucide-refresh-cw"
77
+ variant="ghost"
78
+ color="neutral"
79
+ size="xs"
80
+ @click="loadSnapshots"
81
+ />
82
+ </div>
83
+
84
+ <USkeleton v-if="loading" class="h-32" />
85
+
86
+ <UEmpty
87
+ v-else-if="snapshots.length === 0"
88
+ icon="i-lucide-history"
89
+ title="No snapshots yet"
90
+ size="sm"
91
+ />
92
+
93
+ <template v-else>
94
+ <UTimeline :items="timelineItems" color="primary" size="sm">
95
+ <template #title="{ item }">
96
+ <div class="flex items-center justify-between w-full">
97
+ <span class="text-sm">{{ item.title }}</span>
98
+ <UButton
99
+ icon="i-lucide-rotate-ccw"
100
+ label="Restore"
101
+ variant="ghost"
102
+ color="neutral"
103
+ size="2xs"
104
+ @click="promptRestore(item.value)"
105
+ />
106
+ </div>
107
+ </template>
108
+ </UTimeline>
109
+ </template>
110
+
111
+ <UModal v-model:open="showConfirm" title="Restore Snapshot" description="This will replace the current document content with this snapshot. This cannot be undone.">
112
+ <template #footer>
113
+ <UButton variant="ghost" color="neutral" label="Cancel" @click="showConfirm = false" />
114
+ <UButton label="Restore" color="warning" :loading="restoring" @click="confirmRestore" />
115
+ </template>
116
+ </UModal>
117
+ </div>
118
+ </template>
@@ -0,0 +1,15 @@
1
+ import type { DocumentSnapshot } from "@rgby/collab-core";
2
+ type __VLS_Props = {
3
+ spaceId: string;
4
+ documentId: string;
5
+ };
6
+ declare function loadSnapshots(): Promise<void>;
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
8
+ refresh: typeof loadSnapshots;
9
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ restore: (snapshot: DocumentSnapshot) => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onRestore?: ((snapshot: DocumentSnapshot) => any) | undefined;
13
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
@@ -0,0 +1,7 @@
1
+ type __VLS_Props = {
2
+ /** Space ID to manage */
3
+ spaceId: string;
4
+ };
5
+ 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>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;