@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.
- package/README.md +84 -0
- package/dist/module.d.mts +201 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +170 -0
- package/dist/runtime/components/ACollaborationUsers.d.vue.ts +11 -0
- package/dist/runtime/components/ACollaborationUsers.vue +48 -0
- package/dist/runtime/components/ACollaborationUsers.vue.d.ts +11 -0
- package/dist/runtime/components/AColorPicker.d.vue.ts +13 -0
- package/dist/runtime/components/AColorPicker.vue +71 -0
- package/dist/runtime/components/AColorPicker.vue.d.ts +13 -0
- package/dist/runtime/components/ACommandPalette.d.vue.ts +13 -0
- package/dist/runtime/components/ACommandPalette.vue +31 -0
- package/dist/runtime/components/ACommandPalette.vue.d.ts +13 -0
- package/dist/runtime/components/AConnectionStatus.d.vue.ts +13 -0
- package/dist/runtime/components/AConnectionStatus.vue +50 -0
- package/dist/runtime/components/AConnectionStatus.vue.d.ts +13 -0
- package/dist/runtime/components/ADocTypeSelect.d.vue.ts +10 -0
- package/dist/runtime/components/ADocTypeSelect.vue +34 -0
- package/dist/runtime/components/ADocTypeSelect.vue.d.ts +10 -0
- package/dist/runtime/components/ADocumentTree.d.vue.ts +53 -0
- package/dist/runtime/components/ADocumentTree.vue +350 -0
- package/dist/runtime/components/ADocumentTree.vue.d.ts +53 -0
- package/dist/runtime/components/AEditor.d.vue.ts +60 -0
- package/dist/runtime/components/AEditor.vue +174 -0
- package/dist/runtime/components/AEditor.vue.d.ts +60 -0
- package/dist/runtime/components/AFloatingWindow.d.vue.ts +24 -0
- package/dist/runtime/components/AFloatingWindow.vue +232 -0
- package/dist/runtime/components/AFloatingWindow.vue.d.ts +24 -0
- package/dist/runtime/components/AIconPicker.d.vue.ts +13 -0
- package/dist/runtime/components/AIconPicker.vue +257 -0
- package/dist/runtime/components/AIconPicker.vue.d.ts +13 -0
- package/dist/runtime/components/ANodePanel.d.vue.ts +15 -0
- package/dist/runtime/components/ANodePanel.vue +541 -0
- package/dist/runtime/components/ANodePanel.vue.d.ts +15 -0
- package/dist/runtime/components/ANotifications.d.vue.ts +7 -0
- package/dist/runtime/components/ANotifications.vue +75 -0
- package/dist/runtime/components/ANotifications.vue.d.ts +7 -0
- package/dist/runtime/components/APermissionGuard.d.vue.ts +21 -0
- package/dist/runtime/components/APermissionGuard.vue +22 -0
- package/dist/runtime/components/APermissionGuard.vue.d.ts +21 -0
- package/dist/runtime/components/APresence.d.vue.ts +43 -0
- package/dist/runtime/components/APresence.vue +36 -0
- package/dist/runtime/components/APresence.vue.d.ts +43 -0
- package/dist/runtime/components/AProvider.d.vue.ts +27 -0
- package/dist/runtime/components/AProvider.vue +42 -0
- package/dist/runtime/components/AProvider.vue.d.ts +27 -0
- package/dist/runtime/components/ARoleBadge.d.vue.ts +11 -0
- package/dist/runtime/components/ARoleBadge.vue +29 -0
- package/dist/runtime/components/ARoleBadge.vue.d.ts +11 -0
- package/dist/runtime/components/AVoiceBar.d.vue.ts +13 -0
- package/dist/runtime/components/AVoiceBar.vue +379 -0
- package/dist/runtime/components/AVoiceBar.vue.d.ts +13 -0
- package/dist/runtime/components/AVoiceTile.d.vue.ts +10 -0
- package/dist/runtime/components/AVoiceTile.vue +48 -0
- package/dist/runtime/components/AVoiceTile.vue.d.ts +10 -0
- package/dist/runtime/components/AWindowLayer.d.vue.ts +3 -0
- package/dist/runtime/components/AWindowLayer.vue +17 -0
- package/dist/runtime/components/AWindowLayer.vue.d.ts +3 -0
- package/dist/runtime/components/aware/AArea.d.vue.ts +42 -0
- package/dist/runtime/components/aware/AArea.vue +45 -0
- package/dist/runtime/components/aware/AArea.vue.d.ts +42 -0
- package/dist/runtime/components/aware/AAvatar.d.vue.ts +25 -0
- package/dist/runtime/components/aware/AAvatar.vue +86 -0
- package/dist/runtime/components/aware/AAvatar.vue.d.ts +25 -0
- package/dist/runtime/components/aware/AButton.d.vue.ts +7 -0
- package/dist/runtime/components/aware/AButton.vue +39 -0
- package/dist/runtime/components/aware/AButton.vue.d.ts +7 -0
- package/dist/runtime/components/aware/ACursorLabel.d.vue.ts +12 -0
- package/dist/runtime/components/aware/ACursorLabel.vue +44 -0
- package/dist/runtime/components/aware/ACursorLabel.vue.d.ts +12 -0
- package/dist/runtime/components/aware/ADocBadge.d.vue.ts +11 -0
- package/dist/runtime/components/aware/ADocBadge.vue +27 -0
- package/dist/runtime/components/aware/ADocBadge.vue.d.ts +11 -0
- package/dist/runtime/components/aware/AFacepile.d.vue.ts +20 -0
- package/dist/runtime/components/aware/AFacepile.vue +92 -0
- package/dist/runtime/components/aware/AFacepile.vue.d.ts +20 -0
- package/dist/runtime/components/aware/AInput.d.vue.ts +7 -0
- package/dist/runtime/components/aware/AInput.vue +44 -0
- package/dist/runtime/components/aware/AInput.vue.d.ts +7 -0
- package/dist/runtime/components/aware/ASelect.d.vue.ts +7 -0
- package/dist/runtime/components/aware/ASelect.vue +51 -0
- package/dist/runtime/components/aware/ASelect.vue.d.ts +7 -0
- package/dist/runtime/components/aware/ATextarea.d.vue.ts +7 -0
- package/dist/runtime/components/aware/ATextarea.vue +44 -0
- package/dist/runtime/components/aware/ATextarea.vue.d.ts +7 -0
- package/dist/runtime/components/aware/AUserList.d.vue.ts +17 -0
- package/dist/runtime/components/aware/AUserList.vue +72 -0
- package/dist/runtime/components/aware/AUserList.vue.d.ts +17 -0
- package/dist/runtime/components/renderers/ACalendarRenderer.d.vue.ts +8 -0
- package/dist/runtime/components/renderers/ACalendarRenderer.vue +154 -0
- package/dist/runtime/components/renderers/ACalendarRenderer.vue.d.ts +8 -0
- package/dist/runtime/components/renderers/AGalleryRenderer.d.vue.ts +8 -0
- package/dist/runtime/components/renderers/AGalleryRenderer.vue +88 -0
- package/dist/runtime/components/renderers/AGalleryRenderer.vue.d.ts +8 -0
- package/dist/runtime/components/renderers/AKanbanRenderer.d.vue.ts +8 -0
- package/dist/runtime/components/renderers/AKanbanRenderer.vue +179 -0
- package/dist/runtime/components/renderers/AKanbanRenderer.vue.d.ts +8 -0
- package/dist/runtime/components/renderers/AOutlineRenderer.d.vue.ts +8 -0
- package/dist/runtime/components/renderers/AOutlineRenderer.vue +180 -0
- package/dist/runtime/components/renderers/AOutlineRenderer.vue.d.ts +8 -0
- package/dist/runtime/components/renderers/ATableRenderer.d.vue.ts +8 -0
- package/dist/runtime/components/renderers/ATableRenderer.vue +191 -0
- package/dist/runtime/components/renderers/ATableRenderer.vue.d.ts +8 -0
- package/dist/runtime/composables/useAAField.d.ts +42 -0
- package/dist/runtime/composables/useAAField.js +62 -0
- package/dist/runtime/composables/useAbraLocale.d.ts +14 -0
- package/dist/runtime/composables/useAbraLocale.js +11 -0
- package/dist/runtime/composables/useAbracadabra.d.ts +11 -0
- package/dist/runtime/composables/useAbracadabra.js +3 -0
- package/dist/runtime/composables/useAbracadabraAuth.d.ts +23 -0
- package/dist/runtime/composables/useAbracadabraAuth.js +22 -0
- package/dist/runtime/composables/useAwareness.d.ts +22 -0
- package/dist/runtime/composables/useAwareness.js +48 -0
- package/dist/runtime/composables/useAwarenessPeers.d.ts +34 -0
- package/dist/runtime/composables/useAwarenessPeers.js +33 -0
- package/dist/runtime/composables/useBackgroundSync.d.ts +37 -0
- package/dist/runtime/composables/useBackgroundSync.js +73 -0
- package/dist/runtime/composables/useChat.d.ts +65 -0
- package/dist/runtime/composables/useChat.js +210 -0
- package/dist/runtime/composables/useChatUsers.d.ts +21 -0
- package/dist/runtime/composables/useChatUsers.js +39 -0
- package/dist/runtime/composables/useChildTree.d.ts +119 -0
- package/dist/runtime/composables/useChildTree.js +100 -0
- package/dist/runtime/composables/useCommandPalette.d.ts +58 -0
- package/dist/runtime/composables/useCommandPalette.js +94 -0
- package/dist/runtime/composables/useConnectionStatus.d.ts +17 -0
- package/dist/runtime/composables/useConnectionStatus.js +37 -0
- package/dist/runtime/composables/useDashboard.d.ts +3 -0
- package/dist/runtime/composables/useDashboard.js +23 -0
- package/dist/runtime/composables/useDocExport.d.ts +5 -0
- package/dist/runtime/composables/useDocExport.js +256 -0
- package/dist/runtime/composables/useDocImport.d.ts +10 -0
- package/dist/runtime/composables/useDocImport.js +227 -0
- package/dist/runtime/composables/useDocJump.d.ts +29 -0
- package/dist/runtime/composables/useDocJump.js +17 -0
- package/dist/runtime/composables/useDocumentPermissions.d.ts +20 -0
- package/dist/runtime/composables/useDocumentPermissions.js +33 -0
- package/dist/runtime/composables/useEditor.d.ts +45 -0
- package/dist/runtime/composables/useEditor.js +121 -0
- package/dist/runtime/composables/useEditorDragHandle.d.ts +26 -0
- package/dist/runtime/composables/useEditorDragHandle.js +219 -0
- package/dist/runtime/composables/useEditorMentions.d.ts +28 -0
- package/dist/runtime/composables/useEditorMentions.js +40 -0
- package/dist/runtime/composables/useEditorSuggestions.d.ts +18 -0
- package/dist/runtime/composables/useEditorSuggestions.js +45 -0
- package/dist/runtime/composables/useEditorToolbar.d.ts +22 -0
- package/dist/runtime/composables/useEditorToolbar.js +60 -0
- package/dist/runtime/composables/useFileBlobStore.d.ts +15 -0
- package/dist/runtime/composables/useFileBlobStore.js +22 -0
- package/dist/runtime/composables/useFileIndex.d.ts +20 -0
- package/dist/runtime/composables/useFileIndex.js +69 -0
- package/dist/runtime/composables/useFollowUser.d.ts +5 -0
- package/dist/runtime/composables/useFollowUser.js +40 -0
- package/dist/runtime/composables/useNotifications.d.ts +82 -0
- package/dist/runtime/composables/useNotifications.js +171 -0
- package/dist/runtime/composables/useOfflineUploadQueue.d.ts +90 -0
- package/dist/runtime/composables/useOfflineUploadQueue.js +33 -0
- package/dist/runtime/composables/usePasskeyAccounts.d.ts +32 -0
- package/dist/runtime/composables/usePasskeyAccounts.js +46 -0
- package/dist/runtime/composables/usePluginRegistry.d.ts +6 -0
- package/dist/runtime/composables/usePluginRegistry.js +3 -0
- package/dist/runtime/composables/useRendererBase.d.ts +186 -0
- package/dist/runtime/composables/useRendererBase.js +46 -0
- package/dist/runtime/composables/useSearchIndex.d.ts +20 -0
- package/dist/runtime/composables/useSearchIndex.js +104 -0
- package/dist/runtime/composables/useTrash.d.ts +50 -0
- package/dist/runtime/composables/useTrash.js +127 -0
- package/dist/runtime/composables/useVoice.d.ts +51 -0
- package/dist/runtime/composables/useVoice.js +220 -0
- package/dist/runtime/composables/useWindowManager.d.ts +122 -0
- package/dist/runtime/composables/useWindowManager.js +141 -0
- package/dist/runtime/composables/useYDoc.d.ts +142 -0
- package/dist/runtime/composables/useYDoc.js +172 -0
- package/dist/runtime/extensions/accordion.d.ts +3 -0
- package/dist/runtime/extensions/accordion.js +49 -0
- package/dist/runtime/extensions/badge.d.ts +2 -0
- package/dist/runtime/extensions/badge.js +39 -0
- package/dist/runtime/extensions/callout.d.ts +2 -0
- package/dist/runtime/extensions/callout.js +28 -0
- package/dist/runtime/extensions/card.d.ts +3 -0
- package/dist/runtime/extensions/card.js +53 -0
- package/dist/runtime/extensions/code-collapse.d.ts +2 -0
- package/dist/runtime/extensions/code-collapse.js +32 -0
- package/dist/runtime/extensions/code-group.d.ts +2 -0
- package/dist/runtime/extensions/code-group.js +17 -0
- package/dist/runtime/extensions/collapsible.d.ts +2 -0
- package/dist/runtime/extensions/collapsible.js +35 -0
- package/dist/runtime/extensions/document-header.d.ts +11 -0
- package/dist/runtime/extensions/document-header.js +82 -0
- package/dist/runtime/extensions/document-meta.d.ts +20 -0
- package/dist/runtime/extensions/document-meta.js +121 -0
- package/dist/runtime/extensions/document.d.ts +6 -0
- package/dist/runtime/extensions/document.js +6 -0
- package/dist/runtime/extensions/file-block.d.ts +15 -0
- package/dist/runtime/extensions/file-block.js +34 -0
- package/dist/runtime/extensions/file-drop.d.ts +6 -0
- package/dist/runtime/extensions/file-drop.js +65 -0
- package/dist/runtime/extensions/kbd.d.ts +2 -0
- package/dist/runtime/extensions/kbd.js +33 -0
- package/dist/runtime/extensions/prose-icon.d.ts +2 -0
- package/dist/runtime/extensions/prose-icon.js +33 -0
- package/dist/runtime/extensions/search-highlight.d.ts +10 -0
- package/dist/runtime/extensions/search-highlight.js +129 -0
- package/dist/runtime/extensions/steps.d.ts +2 -0
- package/dist/runtime/extensions/steps.js +32 -0
- package/dist/runtime/extensions/tabs.d.ts +3 -0
- package/dist/runtime/extensions/tabs.js +49 -0
- package/dist/runtime/extensions/views/AccordionItemView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/AccordionItemView.vue +41 -0
- package/dist/runtime/extensions/views/AccordionItemView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/AccordionView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/AccordionView.vue +22 -0
- package/dist/runtime/extensions/views/AccordionView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/BadgeView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/BadgeView.vue +23 -0
- package/dist/runtime/extensions/views/BadgeView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/CalloutView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/CalloutView.vue +43 -0
- package/dist/runtime/extensions/views/CalloutView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/CardGroupView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/CardGroupView.vue +22 -0
- package/dist/runtime/extensions/views/CardGroupView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/CardView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/CardView.vue +28 -0
- package/dist/runtime/extensions/views/CardView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/CodeCollapseView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/CodeCollapseView.vue +45 -0
- package/dist/runtime/extensions/views/CodeCollapseView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/CodeGroupView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/CodeGroupView.vue +53 -0
- package/dist/runtime/extensions/views/CodeGroupView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/CollapsibleView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/CollapsibleView.vue +42 -0
- package/dist/runtime/extensions/views/CollapsibleView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/FileNodeView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/FileNodeView.vue +140 -0
- package/dist/runtime/extensions/views/FileNodeView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/KbdView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/KbdView.vue +23 -0
- package/dist/runtime/extensions/views/KbdView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/ProseIconView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/ProseIconView.vue +23 -0
- package/dist/runtime/extensions/views/ProseIconView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/StepsView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/StepsView.vue +32 -0
- package/dist/runtime/extensions/views/StepsView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/TabsItemView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/TabsItemView.vue +22 -0
- package/dist/runtime/extensions/views/TabsItemView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/TabsView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/TabsView.vue +56 -0
- package/dist/runtime/extensions/views/TabsView.vue.d.ts +4 -0
- package/dist/runtime/locale.d.ts +134 -0
- package/dist/runtime/locale.js +119 -0
- package/dist/runtime/middleware/abracadabra-auth.d.ts +11 -0
- package/dist/runtime/middleware/abracadabra-auth.js +9 -0
- package/dist/runtime/plugin-abracadabra.client.d.ts +7 -0
- package/dist/runtime/plugin-abracadabra.client.js +898 -0
- package/dist/runtime/plugin-abracadabra.server.d.ts +2 -0
- package/dist/runtime/plugin-abracadabra.server.js +71 -0
- package/dist/runtime/plugin-registry.d.ts +34 -0
- package/dist/runtime/plugin-registry.js +83 -0
- package/dist/runtime/plugin-shared-globals.client.d.ts +2 -0
- package/dist/runtime/plugin-shared-globals.client.js +20 -0
- package/dist/runtime/plugins/core.plugin.d.ts +12 -0
- package/dist/runtime/plugins/core.plugin.js +179 -0
- package/dist/runtime/server/api/_abracadabra/render/[docId].get.d.ts +18 -0
- package/dist/runtime/server/api/_abracadabra/render/[docId].get.js +51 -0
- package/dist/runtime/server/api/_abracadabra/spaces.get.d.ts +11 -0
- package/dist/runtime/server/api/_abracadabra/spaces.get.js +16 -0
- package/dist/runtime/server/plugins/abracadabra-service.d.ts +2 -0
- package/dist/runtime/server/plugins/abracadabra-service.js +116 -0
- package/dist/runtime/server/runners/doc-tree-cache.d.ts +11 -0
- package/dist/runtime/server/runners/doc-tree-cache.js +65 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/server/utils/docCache.d.ts +25 -0
- package/dist/runtime/server/utils/docCache.js +131 -0
- package/dist/runtime/server/utils/serverRunner.d.ts +28 -0
- package/dist/runtime/server/utils/serverRunner.js +58 -0
- package/dist/runtime/types.d.ts +444 -0
- package/dist/runtime/types.js +93 -0
- package/dist/runtime/utils/VoiceClient.d.ts +94 -0
- package/dist/runtime/utils/VoiceClient.js +599 -0
- package/dist/runtime/utils/avatarStyle.d.ts +15 -0
- package/dist/runtime/utils/avatarStyle.js +20 -0
- package/dist/runtime/utils/colorPalettes.d.ts +13 -0
- package/dist/runtime/utils/colorPalettes.js +49 -0
- package/dist/runtime/utils/docTypes.d.ts +129 -0
- package/dist/runtime/utils/docTypes.js +116 -0
- package/dist/runtime/utils/markdownToYjs.d.ts +23 -0
- package/dist/runtime/utils/markdownToYjs.js +440 -0
- package/dist/runtime/utils/metaFieldDefinitions.d.ts +7 -0
- package/dist/runtime/utils/metaFieldDefinitions.js +182 -0
- package/dist/runtime/utils/voiceErrors.d.ts +33 -0
- package/dist/runtime/utils/voiceErrors.js +54 -0
- package/dist/runtime/utils/yjsConvert.d.ts +14 -0
- package/dist/runtime/utils/yjsConvert.js +331 -0
- package/dist/types.d.mts +13 -0
- package/package.json +100 -0
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
import type { ShallowRef, Ref, Component } from 'vue';
|
|
2
|
+
import type { Extension } from '@tiptap/core';
|
|
3
|
+
import type { Editor } from '@tiptap/vue-3';
|
|
4
|
+
import type * as Y from 'yjs';
|
|
5
|
+
/**
|
|
6
|
+
* An Abracadabra plugin contributes editor extensions, page types, toolbar items,
|
|
7
|
+
* slash commands, mentions, awareness fields, command palette items, and more.
|
|
8
|
+
*
|
|
9
|
+
* Plugins are registered before the registry is frozen at boot.
|
|
10
|
+
* After freezing all contributions are stable for the lifetime of the app.
|
|
11
|
+
*/
|
|
12
|
+
export interface AbracadabraPlugin {
|
|
13
|
+
/** Unique slug — must be stable across versions, e.g. 'core', 'kanban', 'my-plugin' */
|
|
14
|
+
name: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
version?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
/** TipTap extensions (nodes, marks, extensions) contributed by this plugin */
|
|
19
|
+
extensions?: () => Extension[];
|
|
20
|
+
/**
|
|
21
|
+
* Optional promise that resolves when this plugin's extensions are fully
|
|
22
|
+
* loaded. Used by PluginRegistry.waitForExtensions() to ensure the editor
|
|
23
|
+
* doesn't initialize before async extension bundles are ready.
|
|
24
|
+
*/
|
|
25
|
+
extensionsReady?: Promise<void>;
|
|
26
|
+
/** Document/page type renderers keyed by type slug */
|
|
27
|
+
pageTypes?: Record<string, AbracadabraPageType>;
|
|
28
|
+
/** Extra toolbar item groups appended after the built-in toolbar groups */
|
|
29
|
+
toolbarItems?: (ctx: EditorPluginCtx) => AbracadabraToolbarItem[][];
|
|
30
|
+
/** Extra bubble menu item groups (appear on text selection) */
|
|
31
|
+
bubbleMenuItems?: (ctx: EditorPluginCtx) => AbracadabraToolbarItem[][];
|
|
32
|
+
/** Slash command (/) suggestion menu item groups */
|
|
33
|
+
suggestionItems?: (ctx: EditorPluginCtx) => AbracadabraSuggestionItem[][];
|
|
34
|
+
/** Extra drag-handle menu items (per-block context menu) */
|
|
35
|
+
dragHandleItems?: (ctx: DragHandlePluginCtx) => AbracadabraDragHandleItem[][];
|
|
36
|
+
/** Custom editor handlers merged into UEditorCustomHandlers */
|
|
37
|
+
customHandlers?: () => Record<string, (...args: any[]) => any>;
|
|
38
|
+
/** Mention (@) providers contributing items to the mention popup */
|
|
39
|
+
mentionProviders?: AbracadabraMentionProvider[];
|
|
40
|
+
/** Awareness field declarations — keys this plugin reads/writes on awareness */
|
|
41
|
+
awarenessContributions?: AbracadabraAwarenessContribution[];
|
|
42
|
+
/** Global command palette (⌘K) items */
|
|
43
|
+
commandPaletteItems?: (ctx: CommandPaletteCtx) => AbracadabraCommandItem[] | Promise<AbracadabraCommandItem[]>;
|
|
44
|
+
/** Extra tabs rendered in the child document slideover panel */
|
|
45
|
+
nodePanelSlots?: AbracadabraNodePanelSlot[];
|
|
46
|
+
/** Settings panel contributed to the global settings view */
|
|
47
|
+
settingsPanel?: AbracadabraSettingsPanel;
|
|
48
|
+
/** Global keyboard shortcuts registered on document (not inside TipTap scope) */
|
|
49
|
+
keyboardShortcuts?: AbracadabraKeyboardShortcut[];
|
|
50
|
+
/**
|
|
51
|
+
* Client-side setup hook — called once after client + provider are ready.
|
|
52
|
+
* May return a teardown function called on app unmount.
|
|
53
|
+
*/
|
|
54
|
+
clientSetup?: (ctx: ClientPluginCtx) => void | Promise<void | (() => void)>;
|
|
55
|
+
/** TipTap extensions safe for server-side Y.Doc → HTML rendering (no Vue NodeViews) */
|
|
56
|
+
serverExtensions?: () => Extension[];
|
|
57
|
+
/**
|
|
58
|
+
* Custom cache renderer for non-doc page types.
|
|
59
|
+
* Receives the Y.Doc and returns serializable data for the cache.
|
|
60
|
+
*/
|
|
61
|
+
serverCacheRenderer?: (docId: string, ydoc: Y.Doc) => any;
|
|
62
|
+
/**
|
|
63
|
+
* Server-side background runners (Nitro context).
|
|
64
|
+
* Each runner receives a ServerRunnerContext and returns a cleanup function.
|
|
65
|
+
* Called once after the service provider syncs with the root document.
|
|
66
|
+
*
|
|
67
|
+
* Requires service credentials configured in module options
|
|
68
|
+
* (NUXT_ABRACADABRA_SERVICE_PUBLIC_KEY + NUXT_ABRACADABRA_SERVICE_PRIVATE_KEY).
|
|
69
|
+
*/
|
|
70
|
+
serverRunners?: ServerRunnerDefinition[];
|
|
71
|
+
}
|
|
72
|
+
/** Context passed to editor-scoped plugin hooks */
|
|
73
|
+
export interface EditorPluginCtx {
|
|
74
|
+
/** The TipTap Editor instance — shallowRef, do NOT deep-watch */
|
|
75
|
+
editor: ShallowRef<Editor | null>;
|
|
76
|
+
docId: string;
|
|
77
|
+
}
|
|
78
|
+
/** Context passed to drag-handle plugin hooks */
|
|
79
|
+
export interface DragHandlePluginCtx extends EditorPluginCtx {
|
|
80
|
+
selectedNode: Ref<{
|
|
81
|
+
node: any | null;
|
|
82
|
+
pos: number;
|
|
83
|
+
} | undefined>;
|
|
84
|
+
}
|
|
85
|
+
/** Context passed to the plugin's clientSetup hook */
|
|
86
|
+
export interface ClientPluginCtx {
|
|
87
|
+
/** Full reactive Abracadabra state (same as useAbracadabra()) */
|
|
88
|
+
abracadabra: AbracadabraState;
|
|
89
|
+
}
|
|
90
|
+
export interface AbracadabraPageType {
|
|
91
|
+
/** Human-readable label shown in the "create document" UI */
|
|
92
|
+
label: string;
|
|
93
|
+
/** Lucide icon name, e.g. 'file-text', 'kanban', 'calendar' */
|
|
94
|
+
icon: string;
|
|
95
|
+
/**
|
|
96
|
+
* Vue component that renders this document type.
|
|
97
|
+
* Wrap in defineAsyncComponent for code splitting.
|
|
98
|
+
*/
|
|
99
|
+
component: Component;
|
|
100
|
+
/**
|
|
101
|
+
* Whether this page type uses the TipTap editor.
|
|
102
|
+
* Controls toolbar visibility. Default: false.
|
|
103
|
+
*/
|
|
104
|
+
hasEditor?: boolean;
|
|
105
|
+
/** Metadata fields shown/edited in the document panel sidebar */
|
|
106
|
+
metaFields?: AbracadabraMetaField[];
|
|
107
|
+
}
|
|
108
|
+
export interface AbracadabraToolbarItem {
|
|
109
|
+
id: string;
|
|
110
|
+
label: string;
|
|
111
|
+
icon: string;
|
|
112
|
+
active?: (ctx: EditorPluginCtx) => boolean;
|
|
113
|
+
disabled?: (ctx: EditorPluginCtx) => boolean;
|
|
114
|
+
action: (ctx: EditorPluginCtx) => void;
|
|
115
|
+
/** Keyboard shortcut hint displayed in the tooltip */
|
|
116
|
+
shortcut?: string;
|
|
117
|
+
}
|
|
118
|
+
export interface AbracadabraSuggestionItem {
|
|
119
|
+
id: string;
|
|
120
|
+
label: string;
|
|
121
|
+
description?: string;
|
|
122
|
+
icon?: string;
|
|
123
|
+
action: (ctx: EditorPluginCtx) => void;
|
|
124
|
+
}
|
|
125
|
+
export interface AbracadabraDragHandleItem {
|
|
126
|
+
id: string;
|
|
127
|
+
label: string;
|
|
128
|
+
icon?: string;
|
|
129
|
+
action: (ctx: DragHandlePluginCtx) => void;
|
|
130
|
+
}
|
|
131
|
+
export interface CommandPaletteCtx {
|
|
132
|
+
docId: string | null;
|
|
133
|
+
router: any;
|
|
134
|
+
abracadabra: any;
|
|
135
|
+
tree: any | null;
|
|
136
|
+
}
|
|
137
|
+
export interface AbracadabraCommandItem {
|
|
138
|
+
id: string;
|
|
139
|
+
label: string;
|
|
140
|
+
description?: string;
|
|
141
|
+
icon?: string;
|
|
142
|
+
group?: string;
|
|
143
|
+
shortcut?: string;
|
|
144
|
+
when?: (ctx: CommandPaletteCtx) => boolean;
|
|
145
|
+
handler: (ctx: CommandPaletteCtx) => void | Promise<void>;
|
|
146
|
+
}
|
|
147
|
+
export interface AbracadabraMentionProvider {
|
|
148
|
+
/** Group label shown in the suggestion popup */
|
|
149
|
+
label: string;
|
|
150
|
+
getItems: (query: string, ctx: MentionPluginCtx) => AbracadabraMentionItem[] | Promise<AbracadabraMentionItem[]>;
|
|
151
|
+
}
|
|
152
|
+
export interface MentionPluginCtx {
|
|
153
|
+
docId: string;
|
|
154
|
+
connectedUsers: CollaborationUser[];
|
|
155
|
+
rootDoc: any;
|
|
156
|
+
}
|
|
157
|
+
export interface AbracadabraMentionItem {
|
|
158
|
+
id: string;
|
|
159
|
+
label: string;
|
|
160
|
+
avatar?: string;
|
|
161
|
+
color?: string;
|
|
162
|
+
attrs?: Record<string, any>;
|
|
163
|
+
}
|
|
164
|
+
export interface AbracadabraAwarenessContribution {
|
|
165
|
+
/** Namespaced keys this plugin writes, e.g. ['cursor', 'presence:kanban'] */
|
|
166
|
+
keys: string[];
|
|
167
|
+
/** Optional per-canvas cursor overlay component */
|
|
168
|
+
cursorComponent?: Component;
|
|
169
|
+
}
|
|
170
|
+
export interface AbracadabraNodePanelSlot {
|
|
171
|
+
id: string;
|
|
172
|
+
label: string;
|
|
173
|
+
icon: string;
|
|
174
|
+
when: (ctx: NodePanelCtx) => boolean;
|
|
175
|
+
component: Component;
|
|
176
|
+
}
|
|
177
|
+
export interface NodePanelCtx {
|
|
178
|
+
childId: string;
|
|
179
|
+
childDoc: any | null;
|
|
180
|
+
parentDocId: string;
|
|
181
|
+
parentType: string | undefined;
|
|
182
|
+
meta: Record<string, any>;
|
|
183
|
+
tree: any;
|
|
184
|
+
}
|
|
185
|
+
export interface AbracadabraSettingsPanel {
|
|
186
|
+
label: string;
|
|
187
|
+
icon: string;
|
|
188
|
+
component: Component;
|
|
189
|
+
}
|
|
190
|
+
export interface AbracadabraKeyboardShortcut {
|
|
191
|
+
/** e.g. 'Meta+Shift+K', 'Control+Alt+P' */
|
|
192
|
+
key: string;
|
|
193
|
+
description: string;
|
|
194
|
+
handler: () => void | Promise<void>;
|
|
195
|
+
}
|
|
196
|
+
export interface AbracadabraMetaField {
|
|
197
|
+
id: string;
|
|
198
|
+
type: string;
|
|
199
|
+
label?: string;
|
|
200
|
+
key?: string;
|
|
201
|
+
options?: string[];
|
|
202
|
+
min?: number;
|
|
203
|
+
max?: number;
|
|
204
|
+
}
|
|
205
|
+
export interface UserMetaField {
|
|
206
|
+
id: string;
|
|
207
|
+
type: string;
|
|
208
|
+
label?: string;
|
|
209
|
+
key?: string;
|
|
210
|
+
latKey?: string;
|
|
211
|
+
lngKey?: string;
|
|
212
|
+
startKey?: string;
|
|
213
|
+
endKey?: string;
|
|
214
|
+
allDayKey?: string;
|
|
215
|
+
presets?: string[];
|
|
216
|
+
options?: string[];
|
|
217
|
+
min?: number;
|
|
218
|
+
max?: number;
|
|
219
|
+
step?: number;
|
|
220
|
+
unit?: string;
|
|
221
|
+
}
|
|
222
|
+
export interface DocPageMeta extends Record<string, unknown> {
|
|
223
|
+
color?: string;
|
|
224
|
+
icon?: string;
|
|
225
|
+
datetimeStart?: string;
|
|
226
|
+
datetimeEnd?: string;
|
|
227
|
+
allDay?: boolean;
|
|
228
|
+
dateStart?: string;
|
|
229
|
+
dateEnd?: string;
|
|
230
|
+
timeStart?: string;
|
|
231
|
+
timeEnd?: string;
|
|
232
|
+
taskProgress?: number;
|
|
233
|
+
tags?: string[];
|
|
234
|
+
checked?: boolean;
|
|
235
|
+
priority?: number;
|
|
236
|
+
status?: string;
|
|
237
|
+
rating?: number;
|
|
238
|
+
url?: string;
|
|
239
|
+
email?: string;
|
|
240
|
+
phone?: string;
|
|
241
|
+
number?: number;
|
|
242
|
+
unit?: string;
|
|
243
|
+
subtitle?: string;
|
|
244
|
+
note?: string;
|
|
245
|
+
coverUploadId?: string;
|
|
246
|
+
coverDocId?: string;
|
|
247
|
+
coverMimeType?: string;
|
|
248
|
+
geoType?: 'marker' | 'line' | 'measure';
|
|
249
|
+
geoLat?: number;
|
|
250
|
+
geoLng?: number;
|
|
251
|
+
geoDescription?: string;
|
|
252
|
+
deskX?: number;
|
|
253
|
+
deskY?: number;
|
|
254
|
+
deskMode?: string;
|
|
255
|
+
mmX?: number;
|
|
256
|
+
mmY?: number;
|
|
257
|
+
graphX?: number;
|
|
258
|
+
graphY?: number;
|
|
259
|
+
graphPinned?: boolean;
|
|
260
|
+
_metaFields?: UserMetaField[];
|
|
261
|
+
_metaInitialized?: boolean;
|
|
262
|
+
}
|
|
263
|
+
export interface TreeEntry {
|
|
264
|
+
id: string;
|
|
265
|
+
label: string;
|
|
266
|
+
parentId: string | null;
|
|
267
|
+
order: number;
|
|
268
|
+
type?: string;
|
|
269
|
+
meta?: DocPageMeta;
|
|
270
|
+
createdAt?: number;
|
|
271
|
+
updatedAt?: number;
|
|
272
|
+
}
|
|
273
|
+
export interface CollaborationUser {
|
|
274
|
+
name: string;
|
|
275
|
+
color: string;
|
|
276
|
+
publicKey?: string;
|
|
277
|
+
docId?: string;
|
|
278
|
+
}
|
|
279
|
+
export interface AwarenessUser {
|
|
280
|
+
clientId: number;
|
|
281
|
+
user?: {
|
|
282
|
+
name?: string;
|
|
283
|
+
color?: string;
|
|
284
|
+
avatar?: string;
|
|
285
|
+
};
|
|
286
|
+
/** Which document this user is currently viewing */
|
|
287
|
+
docId?: string;
|
|
288
|
+
[key: string]: any;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Enriched awareness peer returned by useAwarenessPeers().
|
|
292
|
+
* Same as AwarenessUser but with computed idle status.
|
|
293
|
+
*/
|
|
294
|
+
export interface AwarenessPeer extends AwarenessUser {
|
|
295
|
+
/** True when the peer has not sent an awareness update in 45+ seconds */
|
|
296
|
+
idle: boolean;
|
|
297
|
+
}
|
|
298
|
+
export interface SpaceMeta {
|
|
299
|
+
id: string;
|
|
300
|
+
doc_id: string;
|
|
301
|
+
name: string;
|
|
302
|
+
description: string | null;
|
|
303
|
+
visibility: 'public' | 'private' | 'invite';
|
|
304
|
+
is_hub: boolean;
|
|
305
|
+
owner_id: string | null;
|
|
306
|
+
created_at: number;
|
|
307
|
+
updated_at: number;
|
|
308
|
+
}
|
|
309
|
+
export interface SavedServer {
|
|
310
|
+
url: string;
|
|
311
|
+
label: string;
|
|
312
|
+
entryDocId?: string;
|
|
313
|
+
spacesEnabled?: boolean;
|
|
314
|
+
cachedSpaces?: SpaceMeta[];
|
|
315
|
+
hubDocId?: string;
|
|
316
|
+
}
|
|
317
|
+
export interface ServerInfo {
|
|
318
|
+
name?: string;
|
|
319
|
+
version?: string;
|
|
320
|
+
index_doc_id?: string;
|
|
321
|
+
}
|
|
322
|
+
export interface LogEntry {
|
|
323
|
+
time: string;
|
|
324
|
+
message: string;
|
|
325
|
+
type: 'system' | 'connection' | 'auth' | 'sync' | 'user' | 'data';
|
|
326
|
+
}
|
|
327
|
+
export declare const UI_COLORS: readonly ["red", "orange", "amber", "yellow", "lime", "green", "emerald", "teal", "cyan", "sky", "blue", "indigo", "violet", "purple", "fuchsia", "pink", "rose", "grass", "diamond", "gold", "redstone", "lapis", "wood", "discord", "steam", "oxidized"];
|
|
328
|
+
export declare const UI_NEUTRALS: readonly ["slate", "gray", "zinc", "neutral", "stone", "cobblestone", "bedrock", "cream", "sage", "lavender", "blush", "copper", "oxidized", "mint", "peach", "mist", "mauve"];
|
|
329
|
+
export declare const COLOR_HUES: Record<string, number>;
|
|
330
|
+
export declare function deriveColorFromPubKey(pubKey: string): {
|
|
331
|
+
name: string;
|
|
332
|
+
hsl: string;
|
|
333
|
+
neutralName: string;
|
|
334
|
+
};
|
|
335
|
+
/** Injected into nuxtApp as $abracadabra */
|
|
336
|
+
export interface AbracadabraState {
|
|
337
|
+
doc: ShallowRef<Y.Doc>;
|
|
338
|
+
provider: ShallowRef<any | null>;
|
|
339
|
+
client: ShallowRef<any | null>;
|
|
340
|
+
keystore: ShallowRef<any | null>;
|
|
341
|
+
status: Ref<'disconnected' | 'connecting' | 'connected'>;
|
|
342
|
+
synced: Ref<boolean>;
|
|
343
|
+
isReady: Ref<boolean>;
|
|
344
|
+
logs: Ref<LogEntry[]>;
|
|
345
|
+
userName: Ref<string>;
|
|
346
|
+
userColor: Ref<string>;
|
|
347
|
+
userColorName: Ref<string>;
|
|
348
|
+
userNeutralColorName: Ref<string>;
|
|
349
|
+
userCount: Ref<number>;
|
|
350
|
+
publicKeyB64: Ref<string>;
|
|
351
|
+
connectionError: Ref<string | null>;
|
|
352
|
+
isClaimed: Ref<boolean>;
|
|
353
|
+
identityLost: Ref<boolean>;
|
|
354
|
+
needsReauth: Ref<boolean>;
|
|
355
|
+
requirePasskeyOnLogin: Ref<boolean>;
|
|
356
|
+
isConnectionBlocked: Ref<boolean>;
|
|
357
|
+
currentServerUrl: Ref<string>;
|
|
358
|
+
savedServers: Ref<SavedServer[]>;
|
|
359
|
+
currentServerSpaces: any;
|
|
360
|
+
currentServerSpacesEnabled: any;
|
|
361
|
+
pendingInviteCode: Ref<string | null>;
|
|
362
|
+
registry: import('./plugin-registry').PluginRegistry;
|
|
363
|
+
addLog: (message: string, type?: LogEntry['type']) => void;
|
|
364
|
+
setUserName: (name: string) => void;
|
|
365
|
+
setUserColor: (colorName: string) => void;
|
|
366
|
+
setNeutralColor: (colorName: string) => void;
|
|
367
|
+
setRequirePasskey: (enabled: boolean) => void;
|
|
368
|
+
claimAccount: () => Promise<boolean | undefined>;
|
|
369
|
+
loginWithHardware: (credentialIdHint?: string) => Promise<boolean>;
|
|
370
|
+
logout: () => Promise<void>;
|
|
371
|
+
reconnect: () => void;
|
|
372
|
+
addServer: (url: string) => Promise<void>;
|
|
373
|
+
removeServer: (url: string) => void;
|
|
374
|
+
switchServer: (url: string) => Promise<void>;
|
|
375
|
+
switchSpace: (serverUrl: string, spaceDocId: string) => Promise<void>;
|
|
376
|
+
refreshSpaces: () => Promise<void>;
|
|
377
|
+
createSpace: (opts: {
|
|
378
|
+
name: string;
|
|
379
|
+
description?: string;
|
|
380
|
+
visibility?: SpaceMeta['visibility'];
|
|
381
|
+
id?: string;
|
|
382
|
+
}) => Promise<SpaceMeta>;
|
|
383
|
+
updateSpace: (id: string, opts: Partial<Pick<SpaceMeta, 'name' | 'description' | 'visibility' | 'is_hub'>>) => Promise<SpaceMeta>;
|
|
384
|
+
deleteSpace: (id: string) => Promise<void>;
|
|
385
|
+
redeemInvite: (code: string) => Promise<void>;
|
|
386
|
+
createInvite: (opts?: {
|
|
387
|
+
role?: string;
|
|
388
|
+
maxUses?: number;
|
|
389
|
+
expiresIn?: number;
|
|
390
|
+
}) => Promise<any>;
|
|
391
|
+
listInvites: () => Promise<any[]>;
|
|
392
|
+
revokeInvite: (code: string) => Promise<void>;
|
|
393
|
+
init: (serverUrl?: string) => Promise<void>;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Cleanup function returned by a runner's start().
|
|
397
|
+
* Called on graceful server shutdown.
|
|
398
|
+
*/
|
|
399
|
+
export type RunnerCleanup = (() => void | Promise<void>) | void;
|
|
400
|
+
/**
|
|
401
|
+
* Context provided to every server-side runner.
|
|
402
|
+
* Available after the service provider successfully syncs with the root document.
|
|
403
|
+
*/
|
|
404
|
+
export interface ServerRunnerContext {
|
|
405
|
+
/** Service-role REST + auth client (AbracadabraClient) */
|
|
406
|
+
client: any;
|
|
407
|
+
/** Shared HocuspocusProviderWebsocket — reuse for all child providers */
|
|
408
|
+
wsp: any;
|
|
409
|
+
/** Root Y.Doc (the world document) */
|
|
410
|
+
rootDoc: any;
|
|
411
|
+
/** Root AbracadabraProvider — call .loadChild(docId) to open sub-documents */
|
|
412
|
+
rootProvider: any;
|
|
413
|
+
/** Nitro useStorage() handle — use for persistent cache across requests */
|
|
414
|
+
storage: any;
|
|
415
|
+
/** Document cache API: read/write HTML+JSON renders, build tree snapshots */
|
|
416
|
+
docCache: DocCacheAPI;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* A named background task that runs inside the Nitro server process.
|
|
420
|
+
* start() is called once after the root doc syncs; returns a cleanup function.
|
|
421
|
+
*/
|
|
422
|
+
export interface ServerRunnerDefinition {
|
|
423
|
+
name: string;
|
|
424
|
+
start: (ctx: ServerRunnerContext) => Promise<RunnerCleanup>;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* API surface for reading/writing cached document renders.
|
|
428
|
+
* Backed by Nitro storage (disk or memory depending on server config).
|
|
429
|
+
*/
|
|
430
|
+
export interface DocCacheAPI {
|
|
431
|
+
getHTML: (docId: string) => Promise<string | null>;
|
|
432
|
+
getJSON: (docId: string) => Promise<any | null>;
|
|
433
|
+
invalidate: (docId: string) => Promise<void>;
|
|
434
|
+
getTree: () => Promise<CachedTreeNode[]>;
|
|
435
|
+
}
|
|
436
|
+
/** A fully rendered and cached document node (used for SSR tree traversal) */
|
|
437
|
+
export interface CachedTreeNode {
|
|
438
|
+
id: string;
|
|
439
|
+
label: string;
|
|
440
|
+
type: string;
|
|
441
|
+
html: string | null;
|
|
442
|
+
data: any | null;
|
|
443
|
+
children: CachedTreeNode[];
|
|
444
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export const UI_COLORS = [
|
|
2
|
+
"red",
|
|
3
|
+
"orange",
|
|
4
|
+
"amber",
|
|
5
|
+
"yellow",
|
|
6
|
+
"lime",
|
|
7
|
+
"green",
|
|
8
|
+
"emerald",
|
|
9
|
+
"teal",
|
|
10
|
+
"cyan",
|
|
11
|
+
"sky",
|
|
12
|
+
"blue",
|
|
13
|
+
"indigo",
|
|
14
|
+
"violet",
|
|
15
|
+
"purple",
|
|
16
|
+
"fuchsia",
|
|
17
|
+
"pink",
|
|
18
|
+
"rose",
|
|
19
|
+
"grass",
|
|
20
|
+
"diamond",
|
|
21
|
+
"gold",
|
|
22
|
+
"redstone",
|
|
23
|
+
"lapis",
|
|
24
|
+
"wood",
|
|
25
|
+
"discord",
|
|
26
|
+
"steam",
|
|
27
|
+
"oxidized"
|
|
28
|
+
];
|
|
29
|
+
export const UI_NEUTRALS = [
|
|
30
|
+
"slate",
|
|
31
|
+
"gray",
|
|
32
|
+
"zinc",
|
|
33
|
+
"neutral",
|
|
34
|
+
"stone",
|
|
35
|
+
"cobblestone",
|
|
36
|
+
"bedrock",
|
|
37
|
+
"cream",
|
|
38
|
+
"sage",
|
|
39
|
+
"lavender",
|
|
40
|
+
"blush",
|
|
41
|
+
"copper",
|
|
42
|
+
"oxidized",
|
|
43
|
+
"mint",
|
|
44
|
+
"peach",
|
|
45
|
+
"mist",
|
|
46
|
+
"mauve"
|
|
47
|
+
];
|
|
48
|
+
export const COLOR_HUES = {
|
|
49
|
+
red: 0,
|
|
50
|
+
orange: 24,
|
|
51
|
+
amber: 38,
|
|
52
|
+
yellow: 48,
|
|
53
|
+
lime: 84,
|
|
54
|
+
green: 142,
|
|
55
|
+
emerald: 160,
|
|
56
|
+
teal: 173,
|
|
57
|
+
cyan: 189,
|
|
58
|
+
sky: 199,
|
|
59
|
+
blue: 217,
|
|
60
|
+
indigo: 239,
|
|
61
|
+
violet: 258,
|
|
62
|
+
purple: 271,
|
|
63
|
+
fuchsia: 292,
|
|
64
|
+
pink: 330,
|
|
65
|
+
rose: 350,
|
|
66
|
+
grass: 142,
|
|
67
|
+
diamond: 187,
|
|
68
|
+
gold: 48,
|
|
69
|
+
redstone: 0,
|
|
70
|
+
lapis: 217,
|
|
71
|
+
wood: 20,
|
|
72
|
+
discord: 235,
|
|
73
|
+
steam: 84,
|
|
74
|
+
oxidized: 168
|
|
75
|
+
};
|
|
76
|
+
export function deriveColorFromPubKey(pubKey) {
|
|
77
|
+
let hash = 0;
|
|
78
|
+
for (let i = 0; i < pubKey.length; i++) {
|
|
79
|
+
hash = (hash << 5) - hash + pubKey.charCodeAt(i);
|
|
80
|
+
hash |= 0;
|
|
81
|
+
}
|
|
82
|
+
const index = Math.abs(hash) % UI_COLORS.length;
|
|
83
|
+
const name = UI_COLORS[index] || "blue";
|
|
84
|
+
const h = COLOR_HUES[name] || 0;
|
|
85
|
+
let hash2 = hash ^ 2654435769;
|
|
86
|
+
for (let i = pubKey.length - 1; i >= 0; i--) {
|
|
87
|
+
hash2 = (hash2 << 5) - hash2 + pubKey.charCodeAt(i);
|
|
88
|
+
hash2 |= 0;
|
|
89
|
+
}
|
|
90
|
+
const neutralIndex = Math.abs(hash2) % UI_NEUTRALS.length;
|
|
91
|
+
const neutralName = UI_NEUTRALS[neutralIndex] || "zinc";
|
|
92
|
+
return { name, hsl: `hsl(${h}, 70%, 75%)`, neutralName };
|
|
93
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { VoiceError } from './voiceErrors.js';
|
|
2
|
+
export type VoiceConnectionStatus = 'idle' | 'connecting' | 'connected' | 'disconnected';
|
|
3
|
+
export interface VoicePeer {
|
|
4
|
+
id: string;
|
|
5
|
+
userId: string;
|
|
6
|
+
stream: MediaStream | null;
|
|
7
|
+
videoStream: MediaStream | null;
|
|
8
|
+
screenStream: MediaStream | null;
|
|
9
|
+
remoteMuted: boolean;
|
|
10
|
+
localMuted: boolean;
|
|
11
|
+
audioLevel: number;
|
|
12
|
+
remoteVideo: boolean;
|
|
13
|
+
remoteScreen: boolean;
|
|
14
|
+
displayName: string | null;
|
|
15
|
+
color: string | null;
|
|
16
|
+
}
|
|
17
|
+
interface VoiceClientEvents {
|
|
18
|
+
statusChange: (status: VoiceConnectionStatus) => void;
|
|
19
|
+
peerJoined: (peer: VoicePeer) => void;
|
|
20
|
+
peerLeft: (peerId: string) => void;
|
|
21
|
+
peerStream: (peer: VoicePeer) => void;
|
|
22
|
+
audioLevel: (peerId: string, level: number) => void;
|
|
23
|
+
localAudioLevel: (level: number) => void;
|
|
24
|
+
mute: (isMuted: boolean) => void;
|
|
25
|
+
remoteMute: (peerId: string, muted: boolean) => void;
|
|
26
|
+
videoChange: (enabled: boolean) => void;
|
|
27
|
+
screenChange: (enabled: boolean) => void;
|
|
28
|
+
peerVideoStream: (peerId: string, stream: MediaStream | null, kind: 'camera' | 'screen') => void;
|
|
29
|
+
peerMediaState: (peerId: string, video: boolean, screen: boolean) => void;
|
|
30
|
+
peerProfile: (peerId: string, name: string, color: string) => void;
|
|
31
|
+
error: (err: VoiceError) => void;
|
|
32
|
+
}
|
|
33
|
+
export declare class VoiceClient {
|
|
34
|
+
private readonly url;
|
|
35
|
+
private ws;
|
|
36
|
+
private audioCtx;
|
|
37
|
+
private _masterVolume;
|
|
38
|
+
private localStream;
|
|
39
|
+
private _localVideoStream;
|
|
40
|
+
private _localScreenStream;
|
|
41
|
+
private localAudioTimer;
|
|
42
|
+
private peerConnections;
|
|
43
|
+
private peerAudio;
|
|
44
|
+
readonly peers: Map<string, VoicePeer>;
|
|
45
|
+
private emitter;
|
|
46
|
+
private myPeerId;
|
|
47
|
+
private _muted;
|
|
48
|
+
private _videoEnabled;
|
|
49
|
+
private _screenEnabled;
|
|
50
|
+
private _profile;
|
|
51
|
+
private _status;
|
|
52
|
+
/** Serialises async message handling so messages never run concurrently. */
|
|
53
|
+
private _msgQueue;
|
|
54
|
+
constructor(url: string);
|
|
55
|
+
on<E extends keyof VoiceClientEvents>(event: E, handler: VoiceClientEvents[E]): import("nanoevents").Unsubscribe;
|
|
56
|
+
get status(): VoiceConnectionStatus;
|
|
57
|
+
get isMuted(): boolean;
|
|
58
|
+
get videoEnabled(): boolean;
|
|
59
|
+
get screenEnabled(): boolean;
|
|
60
|
+
get localVideoStream(): MediaStream | null;
|
|
61
|
+
get localScreenStream(): MediaStream | null;
|
|
62
|
+
private setStatus;
|
|
63
|
+
private send;
|
|
64
|
+
connect(): Promise<void>;
|
|
65
|
+
private handleMessage;
|
|
66
|
+
private addPeer;
|
|
67
|
+
private removePeer;
|
|
68
|
+
private wirePcEvents;
|
|
69
|
+
private closePeerConnection;
|
|
70
|
+
/**
|
|
71
|
+
* Create a new PC as the offerer — pre-creates the 3-transceiver layout
|
|
72
|
+
* (audio, camera video, screen video) so the offer SDP defines the m-line order.
|
|
73
|
+
*/
|
|
74
|
+
private createPeerConnectionForOffer;
|
|
75
|
+
/**
|
|
76
|
+
* Create a new PC as the answerer — does NOT pre-create transceivers.
|
|
77
|
+
* `setRemoteDescription(offer)` will create them to match the offer's m-lines.
|
|
78
|
+
*/
|
|
79
|
+
private createPeerConnectionForAnswer;
|
|
80
|
+
private attachLocalTracksToAnswer;
|
|
81
|
+
private setupPeerAudio;
|
|
82
|
+
private initiateOffer;
|
|
83
|
+
private handleOffer;
|
|
84
|
+
private renegotiateAll;
|
|
85
|
+
toggleMute(): Promise<void>;
|
|
86
|
+
toggleVideo(): Promise<void>;
|
|
87
|
+
toggleScreen(): Promise<void>;
|
|
88
|
+
setProfile(name: string, color: string): void;
|
|
89
|
+
togglePeerMute(peerId: string): void;
|
|
90
|
+
setPeerVolume(peerId: string, volume: number): void;
|
|
91
|
+
setMasterVolume(volume: number): void;
|
|
92
|
+
disconnect(): void;
|
|
93
|
+
}
|
|
94
|
+
export {};
|