@abraca/nuxt 0.1.0

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 (299) hide show
  1. package/README.md +84 -0
  2. package/dist/module.d.mts +201 -0
  3. package/dist/module.json +12 -0
  4. package/dist/module.mjs +170 -0
  5. package/dist/runtime/components/ACollaborationUsers.d.vue.ts +11 -0
  6. package/dist/runtime/components/ACollaborationUsers.vue +48 -0
  7. package/dist/runtime/components/ACollaborationUsers.vue.d.ts +11 -0
  8. package/dist/runtime/components/AColorPicker.d.vue.ts +13 -0
  9. package/dist/runtime/components/AColorPicker.vue +71 -0
  10. package/dist/runtime/components/AColorPicker.vue.d.ts +13 -0
  11. package/dist/runtime/components/ACommandPalette.d.vue.ts +13 -0
  12. package/dist/runtime/components/ACommandPalette.vue +31 -0
  13. package/dist/runtime/components/ACommandPalette.vue.d.ts +13 -0
  14. package/dist/runtime/components/AConnectionStatus.d.vue.ts +13 -0
  15. package/dist/runtime/components/AConnectionStatus.vue +50 -0
  16. package/dist/runtime/components/AConnectionStatus.vue.d.ts +13 -0
  17. package/dist/runtime/components/ADocTypeSelect.d.vue.ts +10 -0
  18. package/dist/runtime/components/ADocTypeSelect.vue +34 -0
  19. package/dist/runtime/components/ADocTypeSelect.vue.d.ts +10 -0
  20. package/dist/runtime/components/ADocumentTree.d.vue.ts +53 -0
  21. package/dist/runtime/components/ADocumentTree.vue +350 -0
  22. package/dist/runtime/components/ADocumentTree.vue.d.ts +53 -0
  23. package/dist/runtime/components/AEditor.d.vue.ts +60 -0
  24. package/dist/runtime/components/AEditor.vue +174 -0
  25. package/dist/runtime/components/AEditor.vue.d.ts +60 -0
  26. package/dist/runtime/components/AFloatingWindow.d.vue.ts +24 -0
  27. package/dist/runtime/components/AFloatingWindow.vue +232 -0
  28. package/dist/runtime/components/AFloatingWindow.vue.d.ts +24 -0
  29. package/dist/runtime/components/AIconPicker.d.vue.ts +13 -0
  30. package/dist/runtime/components/AIconPicker.vue +257 -0
  31. package/dist/runtime/components/AIconPicker.vue.d.ts +13 -0
  32. package/dist/runtime/components/ANodePanel.d.vue.ts +15 -0
  33. package/dist/runtime/components/ANodePanel.vue +541 -0
  34. package/dist/runtime/components/ANodePanel.vue.d.ts +15 -0
  35. package/dist/runtime/components/ANotifications.d.vue.ts +7 -0
  36. package/dist/runtime/components/ANotifications.vue +75 -0
  37. package/dist/runtime/components/ANotifications.vue.d.ts +7 -0
  38. package/dist/runtime/components/APermissionGuard.d.vue.ts +21 -0
  39. package/dist/runtime/components/APermissionGuard.vue +22 -0
  40. package/dist/runtime/components/APermissionGuard.vue.d.ts +21 -0
  41. package/dist/runtime/components/APresence.d.vue.ts +43 -0
  42. package/dist/runtime/components/APresence.vue +36 -0
  43. package/dist/runtime/components/APresence.vue.d.ts +43 -0
  44. package/dist/runtime/components/AProvider.d.vue.ts +27 -0
  45. package/dist/runtime/components/AProvider.vue +42 -0
  46. package/dist/runtime/components/AProvider.vue.d.ts +27 -0
  47. package/dist/runtime/components/ARoleBadge.d.vue.ts +11 -0
  48. package/dist/runtime/components/ARoleBadge.vue +29 -0
  49. package/dist/runtime/components/ARoleBadge.vue.d.ts +11 -0
  50. package/dist/runtime/components/AVoiceBar.d.vue.ts +13 -0
  51. package/dist/runtime/components/AVoiceBar.vue +379 -0
  52. package/dist/runtime/components/AVoiceBar.vue.d.ts +13 -0
  53. package/dist/runtime/components/AVoiceTile.d.vue.ts +10 -0
  54. package/dist/runtime/components/AVoiceTile.vue +48 -0
  55. package/dist/runtime/components/AVoiceTile.vue.d.ts +10 -0
  56. package/dist/runtime/components/AWindowLayer.d.vue.ts +3 -0
  57. package/dist/runtime/components/AWindowLayer.vue +17 -0
  58. package/dist/runtime/components/AWindowLayer.vue.d.ts +3 -0
  59. package/dist/runtime/components/aware/AArea.d.vue.ts +42 -0
  60. package/dist/runtime/components/aware/AArea.vue +45 -0
  61. package/dist/runtime/components/aware/AArea.vue.d.ts +42 -0
  62. package/dist/runtime/components/aware/AAvatar.d.vue.ts +25 -0
  63. package/dist/runtime/components/aware/AAvatar.vue +86 -0
  64. package/dist/runtime/components/aware/AAvatar.vue.d.ts +25 -0
  65. package/dist/runtime/components/aware/AButton.d.vue.ts +7 -0
  66. package/dist/runtime/components/aware/AButton.vue +39 -0
  67. package/dist/runtime/components/aware/AButton.vue.d.ts +7 -0
  68. package/dist/runtime/components/aware/ACursorLabel.d.vue.ts +12 -0
  69. package/dist/runtime/components/aware/ACursorLabel.vue +44 -0
  70. package/dist/runtime/components/aware/ACursorLabel.vue.d.ts +12 -0
  71. package/dist/runtime/components/aware/ADocBadge.d.vue.ts +11 -0
  72. package/dist/runtime/components/aware/ADocBadge.vue +27 -0
  73. package/dist/runtime/components/aware/ADocBadge.vue.d.ts +11 -0
  74. package/dist/runtime/components/aware/AFacepile.d.vue.ts +20 -0
  75. package/dist/runtime/components/aware/AFacepile.vue +92 -0
  76. package/dist/runtime/components/aware/AFacepile.vue.d.ts +20 -0
  77. package/dist/runtime/components/aware/AInput.d.vue.ts +7 -0
  78. package/dist/runtime/components/aware/AInput.vue +44 -0
  79. package/dist/runtime/components/aware/AInput.vue.d.ts +7 -0
  80. package/dist/runtime/components/aware/ASelect.d.vue.ts +7 -0
  81. package/dist/runtime/components/aware/ASelect.vue +51 -0
  82. package/dist/runtime/components/aware/ASelect.vue.d.ts +7 -0
  83. package/dist/runtime/components/aware/ATextarea.d.vue.ts +7 -0
  84. package/dist/runtime/components/aware/ATextarea.vue +44 -0
  85. package/dist/runtime/components/aware/ATextarea.vue.d.ts +7 -0
  86. package/dist/runtime/components/aware/AUserList.d.vue.ts +17 -0
  87. package/dist/runtime/components/aware/AUserList.vue +72 -0
  88. package/dist/runtime/components/aware/AUserList.vue.d.ts +17 -0
  89. package/dist/runtime/components/renderers/ACalendarRenderer.d.vue.ts +8 -0
  90. package/dist/runtime/components/renderers/ACalendarRenderer.vue +154 -0
  91. package/dist/runtime/components/renderers/ACalendarRenderer.vue.d.ts +8 -0
  92. package/dist/runtime/components/renderers/AGalleryRenderer.d.vue.ts +8 -0
  93. package/dist/runtime/components/renderers/AGalleryRenderer.vue +88 -0
  94. package/dist/runtime/components/renderers/AGalleryRenderer.vue.d.ts +8 -0
  95. package/dist/runtime/components/renderers/AKanbanRenderer.d.vue.ts +8 -0
  96. package/dist/runtime/components/renderers/AKanbanRenderer.vue +179 -0
  97. package/dist/runtime/components/renderers/AKanbanRenderer.vue.d.ts +8 -0
  98. package/dist/runtime/components/renderers/AOutlineRenderer.d.vue.ts +8 -0
  99. package/dist/runtime/components/renderers/AOutlineRenderer.vue +180 -0
  100. package/dist/runtime/components/renderers/AOutlineRenderer.vue.d.ts +8 -0
  101. package/dist/runtime/components/renderers/ATableRenderer.d.vue.ts +8 -0
  102. package/dist/runtime/components/renderers/ATableRenderer.vue +191 -0
  103. package/dist/runtime/components/renderers/ATableRenderer.vue.d.ts +8 -0
  104. package/dist/runtime/composables/useAAField.d.ts +42 -0
  105. package/dist/runtime/composables/useAAField.js +62 -0
  106. package/dist/runtime/composables/useAbraLocale.d.ts +14 -0
  107. package/dist/runtime/composables/useAbraLocale.js +11 -0
  108. package/dist/runtime/composables/useAbracadabra.d.ts +11 -0
  109. package/dist/runtime/composables/useAbracadabra.js +3 -0
  110. package/dist/runtime/composables/useAbracadabraAuth.d.ts +23 -0
  111. package/dist/runtime/composables/useAbracadabraAuth.js +22 -0
  112. package/dist/runtime/composables/useAwareness.d.ts +22 -0
  113. package/dist/runtime/composables/useAwareness.js +48 -0
  114. package/dist/runtime/composables/useAwarenessPeers.d.ts +34 -0
  115. package/dist/runtime/composables/useAwarenessPeers.js +33 -0
  116. package/dist/runtime/composables/useBackgroundSync.d.ts +37 -0
  117. package/dist/runtime/composables/useBackgroundSync.js +73 -0
  118. package/dist/runtime/composables/useChat.d.ts +65 -0
  119. package/dist/runtime/composables/useChat.js +210 -0
  120. package/dist/runtime/composables/useChatUsers.d.ts +21 -0
  121. package/dist/runtime/composables/useChatUsers.js +39 -0
  122. package/dist/runtime/composables/useChildTree.d.ts +119 -0
  123. package/dist/runtime/composables/useChildTree.js +100 -0
  124. package/dist/runtime/composables/useCommandPalette.d.ts +58 -0
  125. package/dist/runtime/composables/useCommandPalette.js +94 -0
  126. package/dist/runtime/composables/useConnectionStatus.d.ts +17 -0
  127. package/dist/runtime/composables/useConnectionStatus.js +37 -0
  128. package/dist/runtime/composables/useDashboard.d.ts +3 -0
  129. package/dist/runtime/composables/useDashboard.js +23 -0
  130. package/dist/runtime/composables/useDocExport.d.ts +5 -0
  131. package/dist/runtime/composables/useDocExport.js +256 -0
  132. package/dist/runtime/composables/useDocImport.d.ts +10 -0
  133. package/dist/runtime/composables/useDocImport.js +227 -0
  134. package/dist/runtime/composables/useDocJump.d.ts +29 -0
  135. package/dist/runtime/composables/useDocJump.js +17 -0
  136. package/dist/runtime/composables/useDocumentPermissions.d.ts +20 -0
  137. package/dist/runtime/composables/useDocumentPermissions.js +33 -0
  138. package/dist/runtime/composables/useEditor.d.ts +45 -0
  139. package/dist/runtime/composables/useEditor.js +121 -0
  140. package/dist/runtime/composables/useEditorDragHandle.d.ts +26 -0
  141. package/dist/runtime/composables/useEditorDragHandle.js +219 -0
  142. package/dist/runtime/composables/useEditorMentions.d.ts +28 -0
  143. package/dist/runtime/composables/useEditorMentions.js +40 -0
  144. package/dist/runtime/composables/useEditorSuggestions.d.ts +18 -0
  145. package/dist/runtime/composables/useEditorSuggestions.js +45 -0
  146. package/dist/runtime/composables/useEditorToolbar.d.ts +22 -0
  147. package/dist/runtime/composables/useEditorToolbar.js +60 -0
  148. package/dist/runtime/composables/useFileBlobStore.d.ts +15 -0
  149. package/dist/runtime/composables/useFileBlobStore.js +22 -0
  150. package/dist/runtime/composables/useFileIndex.d.ts +20 -0
  151. package/dist/runtime/composables/useFileIndex.js +69 -0
  152. package/dist/runtime/composables/useFollowUser.d.ts +5 -0
  153. package/dist/runtime/composables/useFollowUser.js +40 -0
  154. package/dist/runtime/composables/useNotifications.d.ts +82 -0
  155. package/dist/runtime/composables/useNotifications.js +171 -0
  156. package/dist/runtime/composables/useOfflineUploadQueue.d.ts +90 -0
  157. package/dist/runtime/composables/useOfflineUploadQueue.js +33 -0
  158. package/dist/runtime/composables/usePasskeyAccounts.d.ts +32 -0
  159. package/dist/runtime/composables/usePasskeyAccounts.js +46 -0
  160. package/dist/runtime/composables/usePluginRegistry.d.ts +6 -0
  161. package/dist/runtime/composables/usePluginRegistry.js +3 -0
  162. package/dist/runtime/composables/useRendererBase.d.ts +186 -0
  163. package/dist/runtime/composables/useRendererBase.js +46 -0
  164. package/dist/runtime/composables/useSearchIndex.d.ts +20 -0
  165. package/dist/runtime/composables/useSearchIndex.js +104 -0
  166. package/dist/runtime/composables/useTrash.d.ts +50 -0
  167. package/dist/runtime/composables/useTrash.js +127 -0
  168. package/dist/runtime/composables/useVoice.d.ts +51 -0
  169. package/dist/runtime/composables/useVoice.js +220 -0
  170. package/dist/runtime/composables/useWindowManager.d.ts +122 -0
  171. package/dist/runtime/composables/useWindowManager.js +141 -0
  172. package/dist/runtime/composables/useYDoc.d.ts +142 -0
  173. package/dist/runtime/composables/useYDoc.js +172 -0
  174. package/dist/runtime/extensions/accordion.d.ts +3 -0
  175. package/dist/runtime/extensions/accordion.js +49 -0
  176. package/dist/runtime/extensions/badge.d.ts +2 -0
  177. package/dist/runtime/extensions/badge.js +39 -0
  178. package/dist/runtime/extensions/callout.d.ts +2 -0
  179. package/dist/runtime/extensions/callout.js +28 -0
  180. package/dist/runtime/extensions/card.d.ts +3 -0
  181. package/dist/runtime/extensions/card.js +53 -0
  182. package/dist/runtime/extensions/code-collapse.d.ts +2 -0
  183. package/dist/runtime/extensions/code-collapse.js +32 -0
  184. package/dist/runtime/extensions/code-group.d.ts +2 -0
  185. package/dist/runtime/extensions/code-group.js +17 -0
  186. package/dist/runtime/extensions/collapsible.d.ts +2 -0
  187. package/dist/runtime/extensions/collapsible.js +35 -0
  188. package/dist/runtime/extensions/document-header.d.ts +11 -0
  189. package/dist/runtime/extensions/document-header.js +82 -0
  190. package/dist/runtime/extensions/document-meta.d.ts +20 -0
  191. package/dist/runtime/extensions/document-meta.js +121 -0
  192. package/dist/runtime/extensions/document.d.ts +6 -0
  193. package/dist/runtime/extensions/document.js +6 -0
  194. package/dist/runtime/extensions/file-block.d.ts +15 -0
  195. package/dist/runtime/extensions/file-block.js +34 -0
  196. package/dist/runtime/extensions/file-drop.d.ts +6 -0
  197. package/dist/runtime/extensions/file-drop.js +65 -0
  198. package/dist/runtime/extensions/kbd.d.ts +2 -0
  199. package/dist/runtime/extensions/kbd.js +33 -0
  200. package/dist/runtime/extensions/prose-icon.d.ts +2 -0
  201. package/dist/runtime/extensions/prose-icon.js +33 -0
  202. package/dist/runtime/extensions/search-highlight.d.ts +10 -0
  203. package/dist/runtime/extensions/search-highlight.js +129 -0
  204. package/dist/runtime/extensions/steps.d.ts +2 -0
  205. package/dist/runtime/extensions/steps.js +32 -0
  206. package/dist/runtime/extensions/tabs.d.ts +3 -0
  207. package/dist/runtime/extensions/tabs.js +49 -0
  208. package/dist/runtime/extensions/views/AccordionItemView.d.vue.ts +4 -0
  209. package/dist/runtime/extensions/views/AccordionItemView.vue +41 -0
  210. package/dist/runtime/extensions/views/AccordionItemView.vue.d.ts +4 -0
  211. package/dist/runtime/extensions/views/AccordionView.d.vue.ts +4 -0
  212. package/dist/runtime/extensions/views/AccordionView.vue +22 -0
  213. package/dist/runtime/extensions/views/AccordionView.vue.d.ts +4 -0
  214. package/dist/runtime/extensions/views/BadgeView.d.vue.ts +4 -0
  215. package/dist/runtime/extensions/views/BadgeView.vue +23 -0
  216. package/dist/runtime/extensions/views/BadgeView.vue.d.ts +4 -0
  217. package/dist/runtime/extensions/views/CalloutView.d.vue.ts +4 -0
  218. package/dist/runtime/extensions/views/CalloutView.vue +43 -0
  219. package/dist/runtime/extensions/views/CalloutView.vue.d.ts +4 -0
  220. package/dist/runtime/extensions/views/CardGroupView.d.vue.ts +4 -0
  221. package/dist/runtime/extensions/views/CardGroupView.vue +22 -0
  222. package/dist/runtime/extensions/views/CardGroupView.vue.d.ts +4 -0
  223. package/dist/runtime/extensions/views/CardView.d.vue.ts +4 -0
  224. package/dist/runtime/extensions/views/CardView.vue +28 -0
  225. package/dist/runtime/extensions/views/CardView.vue.d.ts +4 -0
  226. package/dist/runtime/extensions/views/CodeCollapseView.d.vue.ts +4 -0
  227. package/dist/runtime/extensions/views/CodeCollapseView.vue +45 -0
  228. package/dist/runtime/extensions/views/CodeCollapseView.vue.d.ts +4 -0
  229. package/dist/runtime/extensions/views/CodeGroupView.d.vue.ts +4 -0
  230. package/dist/runtime/extensions/views/CodeGroupView.vue +53 -0
  231. package/dist/runtime/extensions/views/CodeGroupView.vue.d.ts +4 -0
  232. package/dist/runtime/extensions/views/CollapsibleView.d.vue.ts +4 -0
  233. package/dist/runtime/extensions/views/CollapsibleView.vue +42 -0
  234. package/dist/runtime/extensions/views/CollapsibleView.vue.d.ts +4 -0
  235. package/dist/runtime/extensions/views/FileNodeView.d.vue.ts +4 -0
  236. package/dist/runtime/extensions/views/FileNodeView.vue +140 -0
  237. package/dist/runtime/extensions/views/FileNodeView.vue.d.ts +4 -0
  238. package/dist/runtime/extensions/views/KbdView.d.vue.ts +4 -0
  239. package/dist/runtime/extensions/views/KbdView.vue +23 -0
  240. package/dist/runtime/extensions/views/KbdView.vue.d.ts +4 -0
  241. package/dist/runtime/extensions/views/ProseIconView.d.vue.ts +4 -0
  242. package/dist/runtime/extensions/views/ProseIconView.vue +23 -0
  243. package/dist/runtime/extensions/views/ProseIconView.vue.d.ts +4 -0
  244. package/dist/runtime/extensions/views/StepsView.d.vue.ts +4 -0
  245. package/dist/runtime/extensions/views/StepsView.vue +32 -0
  246. package/dist/runtime/extensions/views/StepsView.vue.d.ts +4 -0
  247. package/dist/runtime/extensions/views/TabsItemView.d.vue.ts +4 -0
  248. package/dist/runtime/extensions/views/TabsItemView.vue +22 -0
  249. package/dist/runtime/extensions/views/TabsItemView.vue.d.ts +4 -0
  250. package/dist/runtime/extensions/views/TabsView.d.vue.ts +4 -0
  251. package/dist/runtime/extensions/views/TabsView.vue +56 -0
  252. package/dist/runtime/extensions/views/TabsView.vue.d.ts +4 -0
  253. package/dist/runtime/locale.d.ts +134 -0
  254. package/dist/runtime/locale.js +119 -0
  255. package/dist/runtime/middleware/abracadabra-auth.d.ts +11 -0
  256. package/dist/runtime/middleware/abracadabra-auth.js +9 -0
  257. package/dist/runtime/plugin-abracadabra.client.d.ts +7 -0
  258. package/dist/runtime/plugin-abracadabra.client.js +898 -0
  259. package/dist/runtime/plugin-abracadabra.server.d.ts +2 -0
  260. package/dist/runtime/plugin-abracadabra.server.js +71 -0
  261. package/dist/runtime/plugin-registry.d.ts +34 -0
  262. package/dist/runtime/plugin-registry.js +83 -0
  263. package/dist/runtime/plugin-shared-globals.client.d.ts +2 -0
  264. package/dist/runtime/plugin-shared-globals.client.js +20 -0
  265. package/dist/runtime/plugins/core.plugin.d.ts +12 -0
  266. package/dist/runtime/plugins/core.plugin.js +179 -0
  267. package/dist/runtime/server/api/_abracadabra/render/[docId].get.d.ts +18 -0
  268. package/dist/runtime/server/api/_abracadabra/render/[docId].get.js +51 -0
  269. package/dist/runtime/server/api/_abracadabra/spaces.get.d.ts +11 -0
  270. package/dist/runtime/server/api/_abracadabra/spaces.get.js +16 -0
  271. package/dist/runtime/server/plugins/abracadabra-service.d.ts +2 -0
  272. package/dist/runtime/server/plugins/abracadabra-service.js +116 -0
  273. package/dist/runtime/server/runners/doc-tree-cache.d.ts +11 -0
  274. package/dist/runtime/server/runners/doc-tree-cache.js +65 -0
  275. package/dist/runtime/server/tsconfig.json +3 -0
  276. package/dist/runtime/server/utils/docCache.d.ts +25 -0
  277. package/dist/runtime/server/utils/docCache.js +131 -0
  278. package/dist/runtime/server/utils/serverRunner.d.ts +28 -0
  279. package/dist/runtime/server/utils/serverRunner.js +58 -0
  280. package/dist/runtime/types.d.ts +444 -0
  281. package/dist/runtime/types.js +93 -0
  282. package/dist/runtime/utils/VoiceClient.d.ts +94 -0
  283. package/dist/runtime/utils/VoiceClient.js +599 -0
  284. package/dist/runtime/utils/avatarStyle.d.ts +15 -0
  285. package/dist/runtime/utils/avatarStyle.js +20 -0
  286. package/dist/runtime/utils/colorPalettes.d.ts +13 -0
  287. package/dist/runtime/utils/colorPalettes.js +49 -0
  288. package/dist/runtime/utils/docTypes.d.ts +129 -0
  289. package/dist/runtime/utils/docTypes.js +116 -0
  290. package/dist/runtime/utils/markdownToYjs.d.ts +23 -0
  291. package/dist/runtime/utils/markdownToYjs.js +440 -0
  292. package/dist/runtime/utils/metaFieldDefinitions.d.ts +7 -0
  293. package/dist/runtime/utils/metaFieldDefinitions.js +182 -0
  294. package/dist/runtime/utils/voiceErrors.d.ts +33 -0
  295. package/dist/runtime/utils/voiceErrors.js +54 -0
  296. package/dist/runtime/utils/yjsConvert.d.ts +14 -0
  297. package/dist/runtime/utils/yjsConvert.js +331 -0
  298. package/dist/types.d.mts +13 -0
  299. package/package.json +100 -0
@@ -0,0 +1,34 @@
1
+ import type { MaybeRef } from 'vue';
2
+ import type { AwarenessPeer } from '../types.js';
3
+ /**
4
+ * Reactive awareness peer list with idle detection and doc-scoped filtering.
5
+ *
6
+ * Built on top of useAwarenessOf() — provides a typed, self-excluded list of
7
+ * connected peers, plus helpers to filter by document and detect idle state.
8
+ *
9
+ * Usage:
10
+ * const { peers, peersInDoc, isIdle } = useAwarenessPeers()
11
+ * const here = peersInDoc(docId) // Computed<AwarenessPeer[]>
12
+ */
13
+ export declare function useAwarenessPeers(): {
14
+ peers: import("vue").ComputedRef<AwarenessPeer[]>;
15
+ currentUser: import("vue").Ref<{
16
+ [x: string]: any;
17
+ clientId: number;
18
+ user?: {
19
+ name?: string | undefined;
20
+ color?: string | undefined;
21
+ avatar?: string | undefined;
22
+ } | undefined;
23
+ } | null, import("./useYDoc.js").AwarenessUser | {
24
+ [x: string]: any;
25
+ clientId: number;
26
+ user?: {
27
+ name?: string | undefined;
28
+ color?: string | undefined;
29
+ avatar?: string | undefined;
30
+ } | undefined;
31
+ } | null>;
32
+ isIdle: (clientId: number, thresholdMs?: number) => boolean;
33
+ peersInDoc: (docId: MaybeRef<string>) => import("vue").ComputedRef<AwarenessPeer[]>;
34
+ };
@@ -0,0 +1,33 @@
1
+ import { shallowRef, computed, watch, isRef } from "vue";
2
+ import { useAwarenessOf } from "./useYDoc.js";
3
+ export function useAwarenessPeers() {
4
+ const { provider } = useAbracadabra();
5
+ const providerRef = shallowRef(provider.value);
6
+ watch(provider, (p) => {
7
+ providerRef.value = p;
8
+ }, { immediate: true });
9
+ const { states, currentUser } = useAwarenessOf(providerRef);
10
+ function isIdle(clientId, thresholdMs = 45e3) {
11
+ const meta = providerRef.value?.awareness?.meta?.get(clientId);
12
+ if (!meta) return false;
13
+ return Date.now() - meta.lastUpdated > thresholdMs;
14
+ }
15
+ const peers = computed(
16
+ () => states.value.filter((s) => s.clientId !== currentUser.value?.clientId).map((s) => ({
17
+ ...s,
18
+ idle: isIdle(s.clientId)
19
+ }))
20
+ );
21
+ function peersInDoc(docId) {
22
+ return computed(() => {
23
+ const id = isRef(docId) ? docId.value : docId;
24
+ return peers.value.filter((p) => p.docId === id);
25
+ });
26
+ }
27
+ return {
28
+ peers,
29
+ currentUser,
30
+ isIdle,
31
+ peersInDoc
32
+ };
33
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * useBackgroundSync
3
+ *
4
+ * Wraps BackgroundSyncManager from @abraca/dabra.
5
+ * Initialized by the main plugin after root provider syncs.
6
+ *
7
+ * Usage:
8
+ * const { syncStates, isSyncing, progress, syncNow } = useBackgroundSync()
9
+ */
10
+ interface DocSyncState {
11
+ status: 'pending' | 'syncing' | 'synced' | 'error' | 'skipped';
12
+ lastSynced?: number;
13
+ error?: string;
14
+ }
15
+ export declare function _initBackgroundSync(manager: any, intervalMs?: number): void;
16
+ export declare function _destroyBackgroundSync(): void;
17
+ declare function syncNow(): Promise<void>;
18
+ declare function syncDoc(docId: string): Promise<void>;
19
+ export declare function useBackgroundSync(): {
20
+ syncStates: import("vue").Ref<Map<string, {
21
+ status: "pending" | "syncing" | "synced" | "error" | "skipped";
22
+ lastSynced?: number | undefined;
23
+ error?: string | undefined;
24
+ }> & Omit<Map<string, DocSyncState>, keyof Map<any, any>>, Map<string, DocSyncState> | (Map<string, {
25
+ status: "pending" | "syncing" | "synced" | "error" | "skipped";
26
+ lastSynced?: number | undefined;
27
+ error?: string | undefined;
28
+ }> & Omit<Map<string, DocSyncState>, keyof Map<any, any>>)>;
29
+ isSyncing: import("vue").Ref<boolean, boolean>;
30
+ syncedCount: import("vue").ComputedRef<number>;
31
+ errorCount: import("vue").ComputedRef<number>;
32
+ progress: import("vue").ComputedRef<number>;
33
+ lastCompletedAt: import("vue").Ref<number | null, number | null>;
34
+ syncNow: typeof syncNow;
35
+ syncDoc: typeof syncDoc;
36
+ };
37
+ export {};
@@ -0,0 +1,73 @@
1
+ import { ref, computed } from "vue";
2
+ const syncStates = ref(/* @__PURE__ */ new Map());
3
+ const isSyncing = ref(false);
4
+ const lastCompletedAt = ref(null);
5
+ let _manager = null;
6
+ let _stopPeriodicSync = null;
7
+ const syncedCount = computed(() => {
8
+ let n = 0;
9
+ for (const s of syncStates.value.values()) {
10
+ if (s.status === "synced") n++;
11
+ }
12
+ return n;
13
+ });
14
+ const errorCount = computed(() => {
15
+ let n = 0;
16
+ for (const s of syncStates.value.values()) {
17
+ if (s.status === "error") n++;
18
+ }
19
+ return n;
20
+ });
21
+ const progress = computed(() => {
22
+ const total = syncStates.value.size;
23
+ if (total === 0) return 0;
24
+ let done = 0;
25
+ for (const s of syncStates.value.values()) {
26
+ if (s.status === "synced" || s.status === "error" || s.status === "skipped") done++;
27
+ }
28
+ return Math.min(1, done / total);
29
+ });
30
+ export function _initBackgroundSync(manager, intervalMs = 5 * 60 * 1e3) {
31
+ _manager = manager;
32
+ const existing = _manager.getSyncStatus();
33
+ syncStates.value = new Map(existing);
34
+ _manager.on("stateChanged", ({ docId, state }) => {
35
+ syncStates.value = new Map(syncStates.value).set(docId, state);
36
+ });
37
+ _stopPeriodicSync = _manager.startPeriodicSync(intervalMs);
38
+ }
39
+ export function _destroyBackgroundSync() {
40
+ _stopPeriodicSync?.();
41
+ _stopPeriodicSync = null;
42
+ _manager?.destroy();
43
+ _manager = null;
44
+ syncStates.value = /* @__PURE__ */ new Map();
45
+ isSyncing.value = false;
46
+ lastCompletedAt.value = null;
47
+ }
48
+ async function syncNow() {
49
+ if (!_manager || isSyncing.value) return;
50
+ isSyncing.value = true;
51
+ try {
52
+ await _manager.syncAll();
53
+ lastCompletedAt.value = Date.now();
54
+ } finally {
55
+ isSyncing.value = false;
56
+ }
57
+ }
58
+ async function syncDoc(docId) {
59
+ if (!_manager) return;
60
+ await _manager.syncDoc(docId);
61
+ }
62
+ export function useBackgroundSync() {
63
+ return {
64
+ syncStates,
65
+ isSyncing,
66
+ syncedCount,
67
+ errorCount,
68
+ progress,
69
+ lastCompletedAt,
70
+ syncNow,
71
+ syncDoc
72
+ };
73
+ }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * useChat
3
+ *
4
+ * Real-time group and DM chat via provider.sendStateless().
5
+ * Wire _handleStatelessChat() into the provider's onStateless callback
6
+ * from the main plugin.
7
+ *
8
+ * Usage:
9
+ * const { channels, sendMessage, setActiveChannel } = useChat()
10
+ * const { messages, typingUsers } = useChatChannel('group:<docId>')
11
+ */
12
+ export interface ChatMessage {
13
+ id: string;
14
+ channel: string;
15
+ senderId: string;
16
+ senderName: string;
17
+ content: string;
18
+ createdAt: number;
19
+ }
20
+ export interface ChatChannel {
21
+ id: string;
22
+ type: 'group' | 'dm';
23
+ label: string;
24
+ lastMessage?: ChatMessage;
25
+ unreadCount: number;
26
+ }
27
+ export declare function buildDmChannelId(a: string, b: string): string;
28
+ declare let _publicKeyB64: import("vue").Ref<string, string>;
29
+ declare let _userName: import("vue").Ref<string, string>;
30
+ export declare function _initChat(publicKeyB64Ref: typeof _publicKeyB64, userNameRef: typeof _userName): void;
31
+ export declare function _destroyChat(): void;
32
+ export declare function _handleStatelessChat(payload: string): void;
33
+ declare function sendMessage(channelId: string, content: string): void;
34
+ declare function fetchHistory(channelId: string, opts?: {
35
+ before?: number;
36
+ limit?: number;
37
+ }): void;
38
+ declare function sendTyping(channelId: string): void;
39
+ declare function setActiveChannel(channelId: string | null): void;
40
+ export declare function useChat(): {
41
+ channels: import("vue").Ref<Record<string, ChatChannel>, Record<string, ChatChannel>>;
42
+ activeChannel: import("vue").Ref<string | null, string | null>;
43
+ messagesByChannel: import("vue").Ref<Record<string, ChatMessage[]>, Record<string, ChatMessage[]>>;
44
+ typingByChannel: import("vue").Ref<Record<string, Set<string>>, Record<string, Set<string>>>;
45
+ sendMessage: typeof sendMessage;
46
+ fetchHistory: typeof fetchHistory;
47
+ sendTyping: typeof sendTyping;
48
+ setActiveChannel: typeof setActiveChannel;
49
+ buildDmChannelId: typeof buildDmChannelId;
50
+ };
51
+ export declare function useChatChannel(channelId: string): {
52
+ messages: import("vue").ComputedRef<ChatMessage[]>;
53
+ channel: import("vue").ComputedRef<ChatChannel | undefined>;
54
+ typingUsers: import("vue").ComputedRef<string[]>;
55
+ unreadCount: import("vue").ComputedRef<number>;
56
+ send: (content: string) => void;
57
+ loadHistory: (opts?: {
58
+ before?: number;
59
+ limit?: number;
60
+ }) => void;
61
+ typing: () => void;
62
+ focus: () => void;
63
+ blur: () => void;
64
+ };
65
+ export {};
@@ -0,0 +1,210 @@
1
+ import { ref, computed } from "vue";
2
+ export function buildDmChannelId(a, b) {
3
+ return `dm:${[a, b].sort().join(":")}`;
4
+ }
5
+ const messagesByChannel = ref({});
6
+ const channels = ref({});
7
+ const typingByChannel = ref({});
8
+ const activeChannel = ref(null);
9
+ const typingTimers = /* @__PURE__ */ new Map();
10
+ let _publicKeyB64 = ref("");
11
+ let _userName = ref("");
12
+ export function _initChat(publicKeyB64Ref, userNameRef) {
13
+ _publicKeyB64 = publicKeyB64Ref;
14
+ _userName = userNameRef;
15
+ messagesByChannel.value = {};
16
+ channels.value = {};
17
+ typingByChannel.value = {};
18
+ activeChannel.value = null;
19
+ }
20
+ export function _destroyChat() {
21
+ messagesByChannel.value = {};
22
+ channels.value = {};
23
+ typingByChannel.value = {};
24
+ activeChannel.value = null;
25
+ for (const t of typingTimers.values()) clearTimeout(t);
26
+ typingTimers.clear();
27
+ }
28
+ function resolveChannelLabel(channelId, senderName, senderId) {
29
+ const { doc } = useAbracadabra();
30
+ if (channelId.startsWith("group:")) {
31
+ const docId = channelId.slice("group:".length);
32
+ try {
33
+ const entry = doc.value?.getMap("doc-tree")?.get(docId);
34
+ if (entry?.label) return `${entry.label} Chat`;
35
+ } catch {
36
+ }
37
+ return "Group Chat";
38
+ }
39
+ if (channelId.startsWith("dm:")) {
40
+ if (senderName && senderId && senderId !== _publicKeyB64.value) return senderName;
41
+ const msgs = messagesByChannel.value[channelId];
42
+ if (msgs) {
43
+ const otherMsg = msgs.find((m) => m.senderId !== _publicKeyB64.value);
44
+ if (otherMsg) return otherMsg.senderName;
45
+ }
46
+ }
47
+ return channelId;
48
+ }
49
+ function ensureChannel(channelId, label) {
50
+ const resolvedLabel = label || resolveChannelLabel(channelId) || channelId;
51
+ if (!channels.value[channelId]) {
52
+ const type = channelId.startsWith("dm:") ? "dm" : "group";
53
+ channels.value = { ...channels.value, [channelId]: { id: channelId, type, label: resolvedLabel, unreadCount: 0 } };
54
+ } else if (channels.value[channelId].label === channelId && resolvedLabel !== channelId) {
55
+ channels.value = { ...channels.value, [channelId]: { ...channels.value[channelId], label: resolvedLabel } };
56
+ }
57
+ }
58
+ function addMessage(msg) {
59
+ const list = messagesByChannel.value[msg.channel] ?? [];
60
+ if (list.some((m) => m.id === msg.id)) return;
61
+ const sorted = [...list, msg].sort((a, b) => a.createdAt - b.createdAt);
62
+ messagesByChannel.value = { ...messagesByChannel.value, [msg.channel]: sorted };
63
+ const chan = channels.value[msg.channel];
64
+ if (chan) {
65
+ const isActive = activeChannel.value === msg.channel;
66
+ channels.value = {
67
+ ...channels.value,
68
+ [msg.channel]: {
69
+ ...chan,
70
+ lastMessage: msg,
71
+ unreadCount: isActive ? 0 : chan.unreadCount + 1
72
+ }
73
+ };
74
+ }
75
+ }
76
+ export function _handleStatelessChat(payload) {
77
+ if (!payload.includes('"chat:')) return;
78
+ try {
79
+ const data = JSON.parse(payload);
80
+ if (!data.type?.startsWith("chat:")) return;
81
+ switch (data.type) {
82
+ case "chat:history": {
83
+ const msgs = (data.messages || []).map((m) => ({
84
+ id: m.id,
85
+ channel: m.channel,
86
+ senderId: m.sender_id ?? "",
87
+ senderName: m.sender_name ?? "User",
88
+ content: m.content,
89
+ createdAt: typeof m.created_at === "number" ? m.created_at : new Date(m.created_at).getTime()
90
+ }));
91
+ for (const msg of msgs) {
92
+ ensureChannel(msg.channel, resolveChannelLabel(msg.channel, msg.senderName, msg.senderId));
93
+ addMessage(msg);
94
+ }
95
+ break;
96
+ }
97
+ case "chat:message": {
98
+ const msg = {
99
+ id: data.id ?? crypto.randomUUID(),
100
+ channel: data.channel,
101
+ senderId: data.sender_id ?? "",
102
+ senderName: data.sender_name ?? "User",
103
+ content: data.content,
104
+ createdAt: typeof data.created_at === "number" ? data.created_at : Date.now()
105
+ };
106
+ ensureChannel(msg.channel, resolveChannelLabel(msg.channel, msg.senderName, msg.senderId));
107
+ addMessage(msg);
108
+ const typing = typingByChannel.value[msg.channel];
109
+ if (typing?.has(msg.senderName)) {
110
+ const next = new Set(typing);
111
+ next.delete(msg.senderName);
112
+ typingByChannel.value = { ...typingByChannel.value, [msg.channel]: next };
113
+ }
114
+ break;
115
+ }
116
+ case "chat:typing": {
117
+ const channel = data.channel;
118
+ const name = data.sender_name ?? "User";
119
+ if (data.sender_id === _publicKeyB64.value) break;
120
+ const current = typingByChannel.value[channel] ?? /* @__PURE__ */ new Set();
121
+ const next = new Set(current).add(name);
122
+ typingByChannel.value = { ...typingByChannel.value, [channel]: next };
123
+ const timerKey = `${channel}:${name}`;
124
+ const existing = typingTimers.get(timerKey);
125
+ if (existing) clearTimeout(existing);
126
+ typingTimers.set(timerKey, setTimeout(() => {
127
+ typingTimers.delete(timerKey);
128
+ const cur = typingByChannel.value[channel];
129
+ if (!cur) return;
130
+ const updated = new Set(cur);
131
+ updated.delete(name);
132
+ typingByChannel.value = { ...typingByChannel.value, [channel]: updated };
133
+ }, 4e3));
134
+ break;
135
+ }
136
+ }
137
+ } catch {
138
+ }
139
+ }
140
+ function sendMessage(channelId, content) {
141
+ const { provider } = useAbracadabra();
142
+ if (!provider.value || !content.trim()) return;
143
+ provider.value.sendStateless(JSON.stringify({
144
+ type: "chat:send",
145
+ channel: channelId,
146
+ content: content.trim()
147
+ }));
148
+ }
149
+ function fetchHistory(channelId, opts) {
150
+ const { provider } = useAbracadabra();
151
+ if (!provider.value) return;
152
+ provider.value.sendStateless(JSON.stringify({
153
+ type: "chat:history",
154
+ channel: channelId,
155
+ before: opts?.before,
156
+ limit: opts?.limit ?? 50
157
+ }));
158
+ }
159
+ function sendTyping(channelId) {
160
+ const { provider } = useAbracadabra();
161
+ if (!provider.value) return;
162
+ provider.value.sendStateless(JSON.stringify({
163
+ type: "chat:typing",
164
+ channel: channelId
165
+ }));
166
+ }
167
+ function setActiveChannel(channelId) {
168
+ activeChannel.value = channelId;
169
+ if (channelId && channels.value[channelId]) {
170
+ channels.value = {
171
+ ...channels.value,
172
+ [channelId]: { ...channels.value[channelId], unreadCount: 0 }
173
+ };
174
+ }
175
+ }
176
+ export function useChat() {
177
+ return {
178
+ channels,
179
+ activeChannel,
180
+ messagesByChannel,
181
+ typingByChannel,
182
+ sendMessage,
183
+ fetchHistory,
184
+ sendTyping,
185
+ setActiveChannel,
186
+ buildDmChannelId
187
+ };
188
+ }
189
+ export function useChatChannel(channelId) {
190
+ const messages = computed(() => messagesByChannel.value[channelId] ?? []);
191
+ const channel = computed(() => channels.value[channelId]);
192
+ const typingUsers = computed(() => [...typingByChannel.value[channelId] ?? []]);
193
+ const unreadCount = computed(() => channels.value[channelId]?.unreadCount ?? 0);
194
+ function send(content) {
195
+ sendMessage(channelId, content);
196
+ }
197
+ function loadHistory(opts) {
198
+ fetchHistory(channelId, opts);
199
+ }
200
+ function typing() {
201
+ sendTyping(channelId);
202
+ }
203
+ function focus() {
204
+ setActiveChannel(channelId);
205
+ }
206
+ function blur() {
207
+ if (activeChannel.value === channelId) setActiveChannel(null);
208
+ }
209
+ return { messages, channel, typingUsers, unreadCount, send, loadHistory, typing, focus, blur };
210
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * useChatUsers
3
+ *
4
+ * Maps awareness public keys to user appearance data (name, color, neutral).
5
+ * Provides `getUserAppearance(publicKey)` and `onlineUsers` — useful when
6
+ * rendering chat messages from users who may be offline.
7
+ *
8
+ * Usage:
9
+ * const { getUserAppearance, onlineUsers } = useChatUsers()
10
+ */
11
+ export interface ChatUserAppearance {
12
+ name: string;
13
+ color: string;
14
+ neutralName: string;
15
+ publicKey: string;
16
+ isOnline: boolean;
17
+ }
18
+ export declare function useChatUsers(): {
19
+ onlineUsers: import("vue").ComputedRef<ChatUserAppearance[]>;
20
+ getUserAppearance: (publicKey: string) => ChatUserAppearance;
21
+ };
@@ -0,0 +1,39 @@
1
+ import { computed } from "vue";
2
+ import { deriveColorFromPubKey } from "../types.js";
3
+ export function useChatUsers() {
4
+ const { provider } = useAbracadabra();
5
+ const onlineUsers = computed(() => {
6
+ if (!provider.value?.awareness) return [];
7
+ const result = [];
8
+ try {
9
+ const states = provider.value.awareness.states;
10
+ for (const state of states.values()) {
11
+ const u = state.user;
12
+ if (u?.publicKey) {
13
+ result.push({
14
+ name: u.name ?? "Anonymous",
15
+ color: u.color ?? "#888",
16
+ neutralName: "zinc",
17
+ publicKey: u.publicKey,
18
+ isOnline: true
19
+ });
20
+ }
21
+ }
22
+ } catch {
23
+ }
24
+ return result;
25
+ });
26
+ function getUserAppearance(publicKey) {
27
+ const online = onlineUsers.value.find((u) => u.publicKey === publicKey);
28
+ if (online) return online;
29
+ const derived = deriveColorFromPubKey(publicKey);
30
+ return {
31
+ name: "User",
32
+ color: derived.hsl,
33
+ neutralName: derived.neutralName,
34
+ publicKey,
35
+ isOnline: false
36
+ };
37
+ }
38
+ return { onlineUsers, getUserAppearance };
39
+ }
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Document tree management over the root Y.Doc's "doc-tree" Y.Map.
3
+ *
4
+ * Scoped to descendants of `parentDocId`. Items created here appear in
5
+ * document tree UIs automatically because all clients read the same Y.Map.
6
+ *
7
+ * - childrenOf(null) → direct children of `parentDocId`
8
+ * - childrenOf(id) → direct children of `id` (nested, e.g. kanban cards inside a column)
9
+ *
10
+ * Ported from cou-sh/app/composables/useChildTree.ts.
11
+ */
12
+ import { type ShallowRef } from 'vue';
13
+ import type * as Y from 'yjs';
14
+ import type { DocPageMeta, TreeEntry } from '../types.js';
15
+ export { type DocPageMeta, type TreeEntry } from '../types.js';
16
+ export declare function useChildTree(rootDoc: ShallowRef<Y.Doc | null>, parentDocId: string): {
17
+ entries: import("vue").ComputedRef<TreeEntry[]>;
18
+ childrenOf: (parentId: string | null) => TreeEntry[];
19
+ descendantsOf: (id: string) => TreeEntry[];
20
+ createChild: (parentId: string | null, label: string, type?: string) => string;
21
+ moveEntry: (id: string, newParentId: string | null, newOrder: number) => void;
22
+ deleteEntry: (id: string) => void;
23
+ renameEntry: (id: string, label: string) => void;
24
+ updateMeta: (id: string, patch: Partial<DocPageMeta>) => void;
25
+ duplicateEntry: (id: string) => string;
26
+ treeMap: {
27
+ data: Record<string, {
28
+ label: string;
29
+ parentId: string | null;
30
+ order: number;
31
+ type?: string;
32
+ meta?: DocPageMeta;
33
+ createdAt?: number;
34
+ updatedAt?: number;
35
+ }>;
36
+ lastUpdateLocal: ShallowRef<boolean, boolean>;
37
+ set: (key: string, value: {
38
+ label: string;
39
+ parentId: string | null;
40
+ order: number;
41
+ type?: string;
42
+ meta?: DocPageMeta;
43
+ createdAt?: number;
44
+ updatedAt?: number;
45
+ }) => {
46
+ label: string;
47
+ parentId: string | null;
48
+ order: number;
49
+ type?: string;
50
+ meta?: DocPageMeta;
51
+ createdAt?: number;
52
+ updatedAt?: number;
53
+ } | undefined;
54
+ remove: (key: string) => void | undefined;
55
+ clear: () => void | undefined;
56
+ get: (key: string) => {
57
+ label: string;
58
+ parentId: string | null;
59
+ order: number;
60
+ type?: string;
61
+ meta?: DocPageMeta;
62
+ createdAt?: number;
63
+ updatedAt?: number;
64
+ } | undefined;
65
+ yMap: import("vue").ComputedRef<Y.Map<{
66
+ label: string;
67
+ parentId: string | null;
68
+ order: number;
69
+ type?: string;
70
+ meta?: DocPageMeta;
71
+ createdAt?: number;
72
+ updatedAt?: number;
73
+ }> | null>;
74
+ };
75
+ trashMap: {
76
+ data: Record<string, {
77
+ label: string;
78
+ parentId: string | null;
79
+ order: number;
80
+ type?: string;
81
+ meta?: DocPageMeta;
82
+ deletedAt: number;
83
+ }>;
84
+ lastUpdateLocal: ShallowRef<boolean, boolean>;
85
+ set: (key: string, value: {
86
+ label: string;
87
+ parentId: string | null;
88
+ order: number;
89
+ type?: string;
90
+ meta?: DocPageMeta;
91
+ deletedAt: number;
92
+ }) => {
93
+ label: string;
94
+ parentId: string | null;
95
+ order: number;
96
+ type?: string;
97
+ meta?: DocPageMeta;
98
+ deletedAt: number;
99
+ } | undefined;
100
+ remove: (key: string) => void | undefined;
101
+ clear: () => void | undefined;
102
+ get: (key: string) => {
103
+ label: string;
104
+ parentId: string | null;
105
+ order: number;
106
+ type?: string;
107
+ meta?: DocPageMeta;
108
+ deletedAt: number;
109
+ } | undefined;
110
+ yMap: import("vue").ComputedRef<Y.Map<{
111
+ label: string;
112
+ parentId: string | null;
113
+ order: number;
114
+ type?: string;
115
+ meta?: DocPageMeta;
116
+ deletedAt: number;
117
+ }> | null>;
118
+ };
119
+ };