@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,440 @@
|
|
|
1
|
+
import * as Y from "yjs";
|
|
2
|
+
export function filenameToLabel(raw) {
|
|
3
|
+
const base = raw.replace(/\.[^.]+$/, "");
|
|
4
|
+
const spaced = base.replace(/([a-z])([A-Z])/g, "$1 $2");
|
|
5
|
+
const clean = spaced.replace(/[-_.]+/g, " ").replace(/\s+/g, " ").trim();
|
|
6
|
+
return clean.charAt(0).toUpperCase() + clean.slice(1);
|
|
7
|
+
}
|
|
8
|
+
function coerceScalar(raw) {
|
|
9
|
+
const trimmed = raw.trim();
|
|
10
|
+
if (trimmed === "true") return true;
|
|
11
|
+
if (trimmed === "false") return false;
|
|
12
|
+
const num = Number(trimmed);
|
|
13
|
+
if (!Number.isNaN(num) && trimmed !== "") return num;
|
|
14
|
+
if (trimmed.startsWith('"') && trimmed.endsWith('"') || trimmed.startsWith("'") && trimmed.endsWith("'")) {
|
|
15
|
+
return trimmed.slice(1, -1);
|
|
16
|
+
}
|
|
17
|
+
return trimmed;
|
|
18
|
+
}
|
|
19
|
+
void coerceScalar;
|
|
20
|
+
function parseInlineArray(raw) {
|
|
21
|
+
return raw.slice(1, -1).split(",").map((s) => s.trim()).filter(Boolean);
|
|
22
|
+
}
|
|
23
|
+
export function parseFrontmatter(markdown) {
|
|
24
|
+
const noResult = { meta: {}, body: markdown };
|
|
25
|
+
const match = markdown.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);
|
|
26
|
+
if (!match) return noResult;
|
|
27
|
+
const yamlBlock = match[1];
|
|
28
|
+
const body = markdown.slice(match[0].length);
|
|
29
|
+
const raw = {};
|
|
30
|
+
const lines = yamlBlock.split("\n");
|
|
31
|
+
let i = 0;
|
|
32
|
+
while (i < lines.length) {
|
|
33
|
+
const line = lines[i];
|
|
34
|
+
const blockSeqKey = line.match(/^(\w[\w-]*):\s*$/);
|
|
35
|
+
if (blockSeqKey && i + 1 < lines.length && /^\s+-\s/.test(lines[i + 1])) {
|
|
36
|
+
const key = blockSeqKey[1];
|
|
37
|
+
const items = [];
|
|
38
|
+
i++;
|
|
39
|
+
while (i < lines.length && /^\s+-\s/.test(lines[i])) {
|
|
40
|
+
items.push(lines[i].replace(/^\s+-\s/, "").trim());
|
|
41
|
+
i++;
|
|
42
|
+
}
|
|
43
|
+
raw[key] = items;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const kvMatch = line.match(/^(\w[\w-]*):\s*(.*)$/);
|
|
47
|
+
if (kvMatch) {
|
|
48
|
+
const key = kvMatch[1];
|
|
49
|
+
const val = kvMatch[2].trim();
|
|
50
|
+
if (val.startsWith("[") && val.endsWith("]")) {
|
|
51
|
+
raw[key] = parseInlineArray(val);
|
|
52
|
+
} else {
|
|
53
|
+
raw[key] = val;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
i++;
|
|
57
|
+
}
|
|
58
|
+
const meta = {};
|
|
59
|
+
const getStr = (keys) => {
|
|
60
|
+
for (const k of keys) {
|
|
61
|
+
const v = raw[k];
|
|
62
|
+
if (typeof v === "string" && v) return v;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const getArr = (keys) => {
|
|
66
|
+
for (const k of keys) {
|
|
67
|
+
const v = raw[k];
|
|
68
|
+
if (Array.isArray(v)) return v;
|
|
69
|
+
if (typeof v === "string" && v) return [v];
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
if (raw["tags"]) meta.tags = Array.isArray(raw["tags"]) ? raw["tags"] : [raw["tags"]];
|
|
73
|
+
const color = getStr(["color"]);
|
|
74
|
+
if (color) meta.color = color;
|
|
75
|
+
const icon = getStr(["icon"]);
|
|
76
|
+
if (icon) meta.icon = icon;
|
|
77
|
+
const status = getStr(["status"]);
|
|
78
|
+
if (status) meta.status = status;
|
|
79
|
+
const priorityRaw = getStr(["priority"]);
|
|
80
|
+
if (priorityRaw !== void 0) {
|
|
81
|
+
const map = { low: 1, medium: 2, high: 3, urgent: 4 };
|
|
82
|
+
meta.priority = map[priorityRaw.toLowerCase()] ?? (Number(priorityRaw) || 0);
|
|
83
|
+
}
|
|
84
|
+
const checkedRaw = raw["checked"] ?? raw["done"];
|
|
85
|
+
if (checkedRaw !== void 0) meta.checked = checkedRaw === "true" || checkedRaw === true;
|
|
86
|
+
const dateStart = getStr(["date", "created"]);
|
|
87
|
+
if (dateStart) meta.dateStart = dateStart;
|
|
88
|
+
const dateEnd = getStr(["due"]);
|
|
89
|
+
if (dateEnd) meta.dateEnd = dateEnd;
|
|
90
|
+
const subtitle = getStr(["description", "subtitle"]);
|
|
91
|
+
if (subtitle) meta.subtitle = subtitle;
|
|
92
|
+
const url = getStr(["url"]);
|
|
93
|
+
if (url) meta.url = url;
|
|
94
|
+
const ratingRaw = getStr(["rating"]);
|
|
95
|
+
if (ratingRaw !== void 0) {
|
|
96
|
+
const n = Number(ratingRaw);
|
|
97
|
+
if (!Number.isNaN(n)) meta.rating = Math.min(5, Math.max(0, n));
|
|
98
|
+
}
|
|
99
|
+
const tagsResult = getArr(["tags"]);
|
|
100
|
+
if (tagsResult) meta.tags = tagsResult;
|
|
101
|
+
const title = typeof raw["title"] === "string" ? raw["title"] : void 0;
|
|
102
|
+
const type = getStr(["type"]);
|
|
103
|
+
return { title, type, meta, body };
|
|
104
|
+
}
|
|
105
|
+
function parseMdcProps(propsStr) {
|
|
106
|
+
if (!propsStr) return {};
|
|
107
|
+
const result = {};
|
|
108
|
+
const re = /(\w[\w-]*)="([^"]*)"/g;
|
|
109
|
+
let m;
|
|
110
|
+
while ((m = re.exec(propsStr)) !== null) {
|
|
111
|
+
result[m[1]] = m[2];
|
|
112
|
+
}
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
function parseInline(text) {
|
|
116
|
+
const stripped = text.replace(/\{lang="[^"]*"\}/g, "").replace(/:(?!badge|icon|kbd)(\w[\w-]*)\[([^\]]*)\](\{[^}]*\})?/g, "$2").replace(/:(?!badge|icon|kbd)(\w[\w-]*)(\{[^}]*\})/g, "");
|
|
117
|
+
const tokens = [];
|
|
118
|
+
const re = /:badge\[([^\]]*)\](\{[^}]*\})?|:icon\{([^}]*)\}|:kbd\{([^}]*)\}|!?\[\[([^\]|]+?)(?:\|([^\]]+?))?\]\]|~~(.+?)~~|\*\*(.+?)\*\*|\*(.+?)\*|_(.+?)_|`(.+?)`|\[(.+?)\]\((.+?)\)/g;
|
|
119
|
+
let lastIndex = 0;
|
|
120
|
+
let match;
|
|
121
|
+
while ((match = re.exec(stripped)) !== null) {
|
|
122
|
+
if (match.index > lastIndex) {
|
|
123
|
+
tokens.push({ text: stripped.slice(lastIndex, match.index) });
|
|
124
|
+
}
|
|
125
|
+
if (match[1] !== void 0) {
|
|
126
|
+
const badgeProps = parseMdcProps(match[2]);
|
|
127
|
+
tokens.push({ text: match[1] || "Badge", attrs: { badge: { label: match[1] || "Badge", color: badgeProps["color"] || "neutral", variant: badgeProps["variant"] || "subtle" } } });
|
|
128
|
+
} else if (match[3] !== void 0) {
|
|
129
|
+
const iconProps = parseMdcProps(`{${match[3]}}`);
|
|
130
|
+
tokens.push({ text: "\u200B", attrs: { proseIcon: { name: iconProps["name"] || "i-lucide-star" } } });
|
|
131
|
+
} else if (match[4] !== void 0) {
|
|
132
|
+
const kbdProps = parseMdcProps(`{${match[4]}}`);
|
|
133
|
+
tokens.push({ text: kbdProps["value"] || "", attrs: { kbd: { value: kbdProps["value"] || "" } } });
|
|
134
|
+
} else if (match[5] !== void 0) {
|
|
135
|
+
const displayText = match[6] ?? match[5];
|
|
136
|
+
tokens.push({ text: displayText });
|
|
137
|
+
} else if (match[7] !== void 0) {
|
|
138
|
+
tokens.push({ text: match[7], attrs: { strike: true } });
|
|
139
|
+
} else if (match[8] !== void 0) {
|
|
140
|
+
tokens.push({ text: match[8], attrs: { bold: true } });
|
|
141
|
+
} else if (match[9] !== void 0) {
|
|
142
|
+
tokens.push({ text: match[9], attrs: { italic: true } });
|
|
143
|
+
} else if (match[10] !== void 0) {
|
|
144
|
+
tokens.push({ text: match[10], attrs: { italic: true } });
|
|
145
|
+
} else if (match[11] !== void 0) {
|
|
146
|
+
tokens.push({ text: match[11], attrs: { code: true } });
|
|
147
|
+
} else if (match[12] !== void 0 && match[13] !== void 0) {
|
|
148
|
+
tokens.push({ text: match[12], attrs: { link: { href: match[13] } } });
|
|
149
|
+
}
|
|
150
|
+
lastIndex = match.index + match[0].length;
|
|
151
|
+
}
|
|
152
|
+
if (lastIndex < stripped.length) {
|
|
153
|
+
tokens.push({ text: stripped.slice(lastIndex) });
|
|
154
|
+
}
|
|
155
|
+
return tokens.filter((t) => t.text.length > 0);
|
|
156
|
+
}
|
|
157
|
+
function parseTableRow(line) {
|
|
158
|
+
const parts = line.split("|");
|
|
159
|
+
return parts.slice(1, parts.length - 1).map((c) => c.trim());
|
|
160
|
+
}
|
|
161
|
+
function isTableSeparator(line) {
|
|
162
|
+
return /^\|[\s|:-]+\|$/.test(line.trim());
|
|
163
|
+
}
|
|
164
|
+
const TASK_RE = /^[-*+]\s+\[([ xX])\]\s+(.*)/;
|
|
165
|
+
function parseBlocks(markdown) {
|
|
166
|
+
const rawLines = markdown.split("\n");
|
|
167
|
+
let firstContentLine = 0;
|
|
168
|
+
while (firstContentLine < rawLines.length) {
|
|
169
|
+
const l = rawLines[firstContentLine];
|
|
170
|
+
if (l.trim() === "" || /^import\s/.test(l) || /^export\s/.test(l)) {
|
|
171
|
+
firstContentLine++;
|
|
172
|
+
} else {
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const stripped = rawLines.slice(firstContentLine).join("\n");
|
|
177
|
+
const blocks = [];
|
|
178
|
+
const lines = stripped.split("\n");
|
|
179
|
+
let i = 0;
|
|
180
|
+
while (i < lines.length) {
|
|
181
|
+
const line = lines[i];
|
|
182
|
+
const fenceBlockMatch = line.match(/^(`{3,})(.*)$/);
|
|
183
|
+
if (fenceBlockMatch) {
|
|
184
|
+
const fence = fenceBlockMatch[1];
|
|
185
|
+
const lang = fenceBlockMatch[2].trim().replace(/\{[^}]*\}$/, "").replace(/\s*\[.*\]$/, "").trim();
|
|
186
|
+
const codeLines = [];
|
|
187
|
+
i++;
|
|
188
|
+
while (i < lines.length && !lines[i].startsWith(fence)) {
|
|
189
|
+
codeLines.push(lines[i]);
|
|
190
|
+
i++;
|
|
191
|
+
}
|
|
192
|
+
i++;
|
|
193
|
+
blocks.push({ type: "codeBlock", lang, code: codeLines.join("\n") });
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
const headingMatch = line.match(/^(#{1,6})\s+(.*)/);
|
|
197
|
+
if (headingMatch) {
|
|
198
|
+
blocks.push({ type: "heading", level: headingMatch[1].length, text: headingMatch[2].trim() });
|
|
199
|
+
i++;
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
if (/^[-*_]{3,}\s*$/.test(line)) {
|
|
203
|
+
blocks.push({ type: "hr" });
|
|
204
|
+
i++;
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
const imgMatch = line.match(/^!\[([^\]]*)\]\(([^)]+)\)(\{[^}]*\})?\s*$/);
|
|
208
|
+
if (imgMatch) {
|
|
209
|
+
const alt = imgMatch[1] ?? "";
|
|
210
|
+
const src = imgMatch[2] ?? "";
|
|
211
|
+
const attrs = parseMdcProps(imgMatch[3]);
|
|
212
|
+
blocks.push({ type: "image", src, alt, width: attrs["width"], height: attrs["height"] });
|
|
213
|
+
i++;
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
if (line.startsWith("> ") || line === ">") {
|
|
217
|
+
const bqLines = [];
|
|
218
|
+
while (i < lines.length && (lines[i].startsWith("> ") || lines[i] === ">")) {
|
|
219
|
+
bqLines.push(lines[i].replace(/^>\s?/, ""));
|
|
220
|
+
i++;
|
|
221
|
+
}
|
|
222
|
+
blocks.push({ type: "blockquote", lines: bqLines });
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
if (/^\s*\|/.test(line)) {
|
|
226
|
+
const tableLines = [];
|
|
227
|
+
while (i < lines.length && /^\s*\|/.test(lines[i])) {
|
|
228
|
+
tableLines.push(lines[i]);
|
|
229
|
+
i++;
|
|
230
|
+
}
|
|
231
|
+
if (tableLines.length >= 2 && isTableSeparator(tableLines[1])) {
|
|
232
|
+
const headerRow = parseTableRow(tableLines[0]);
|
|
233
|
+
const dataRows = tableLines.slice(2).filter((l) => !isTableSeparator(l)).map(parseTableRow);
|
|
234
|
+
blocks.push({ type: "table", headerRow, dataRows });
|
|
235
|
+
} else {
|
|
236
|
+
for (const l of tableLines) blocks.push({ type: "paragraph", text: l });
|
|
237
|
+
}
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
const MDC_OPEN = /^\s*(:{2,})(\w[\w-]*)(\{[^}]*\})?\s*$/;
|
|
241
|
+
if (MDC_OPEN.test(line)) {
|
|
242
|
+
const colons = line.match(/^\s*(:+)/)?.[1]?.length ?? 2;
|
|
243
|
+
i++;
|
|
244
|
+
while (i < lines.length) {
|
|
245
|
+
const l = lines[i];
|
|
246
|
+
if (new RegExp(`^\\s*:{${colons}}\\s*$`).test(l)) {
|
|
247
|
+
i++;
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
i++;
|
|
251
|
+
}
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
if (TASK_RE.test(line)) {
|
|
255
|
+
const items = [];
|
|
256
|
+
while (i < lines.length && TASK_RE.test(lines[i])) {
|
|
257
|
+
const m = lines[i].match(TASK_RE);
|
|
258
|
+
items.push({ checked: m[1].toLowerCase() === "x", text: m[2] });
|
|
259
|
+
i++;
|
|
260
|
+
}
|
|
261
|
+
blocks.push({ type: "taskList", items });
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
if (/^[-*+]\s+/.test(line)) {
|
|
265
|
+
const items = [];
|
|
266
|
+
while (i < lines.length && /^[-*+]\s+/.test(lines[i]) && !TASK_RE.test(lines[i])) {
|
|
267
|
+
items.push(lines[i].replace(/^[-*+]\s+/, ""));
|
|
268
|
+
i++;
|
|
269
|
+
}
|
|
270
|
+
if (items.length) {
|
|
271
|
+
blocks.push({ type: "bulletList", items });
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (/^\d+\.\s+/.test(line)) {
|
|
276
|
+
const items = [];
|
|
277
|
+
while (i < lines.length && /^\d+\.\s+/.test(lines[i])) {
|
|
278
|
+
items.push(lines[i].replace(/^\d+\.\s+/, ""));
|
|
279
|
+
i++;
|
|
280
|
+
}
|
|
281
|
+
blocks.push({ type: "orderedList", items });
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
if (line.trim() === "") {
|
|
285
|
+
i++;
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
const paraLines = [];
|
|
289
|
+
while (i < lines.length && lines[i].trim() !== "" && !/^(#{1,6}\s|[-*+]\s|\d+\.\s|>|`{3,}|\s*\||[-*_]{3,}\s*$|\s*:{2,}\w)/.test(lines[i])) {
|
|
290
|
+
paraLines.push(lines[i]);
|
|
291
|
+
i++;
|
|
292
|
+
}
|
|
293
|
+
if (paraLines.length) {
|
|
294
|
+
blocks.push({ type: "paragraph", text: paraLines.join(" ") });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return blocks;
|
|
298
|
+
}
|
|
299
|
+
function fillTextInto(el, tokens) {
|
|
300
|
+
const filtered = tokens.filter((t) => t.text.length > 0);
|
|
301
|
+
if (!filtered.length) return;
|
|
302
|
+
const xtNodes = filtered.map(() => new Y.XmlText());
|
|
303
|
+
el.insert(0, xtNodes);
|
|
304
|
+
filtered.forEach((tok, i) => {
|
|
305
|
+
if (tok.attrs) {
|
|
306
|
+
xtNodes[i].insert(0, tok.text, tok.attrs);
|
|
307
|
+
} else {
|
|
308
|
+
xtNodes[i].insert(0, tok.text);
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
function blockElName(b) {
|
|
313
|
+
switch (b.type) {
|
|
314
|
+
case "heading":
|
|
315
|
+
return "heading";
|
|
316
|
+
case "paragraph":
|
|
317
|
+
return "paragraph";
|
|
318
|
+
case "bulletList":
|
|
319
|
+
return "bulletList";
|
|
320
|
+
case "orderedList":
|
|
321
|
+
return "orderedList";
|
|
322
|
+
case "taskList":
|
|
323
|
+
return "taskList";
|
|
324
|
+
case "codeBlock":
|
|
325
|
+
return "codeBlock";
|
|
326
|
+
case "blockquote":
|
|
327
|
+
return "blockquote";
|
|
328
|
+
case "table":
|
|
329
|
+
return "table";
|
|
330
|
+
case "hr":
|
|
331
|
+
return "horizontalRule";
|
|
332
|
+
case "image":
|
|
333
|
+
return "image";
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
function fillBlock(el, block) {
|
|
337
|
+
switch (block.type) {
|
|
338
|
+
case "heading": {
|
|
339
|
+
el.setAttribute("level", block.level);
|
|
340
|
+
fillTextInto(el, parseInline(block.text));
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
case "paragraph": {
|
|
344
|
+
fillTextInto(el, parseInline(block.text));
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
case "bulletList":
|
|
348
|
+
case "orderedList": {
|
|
349
|
+
const listItemEls = block.items.map(() => new Y.XmlElement("listItem"));
|
|
350
|
+
el.insert(0, listItemEls);
|
|
351
|
+
block.items.forEach((text, i) => {
|
|
352
|
+
const paraEl = new Y.XmlElement("paragraph");
|
|
353
|
+
listItemEls[i].insert(0, [paraEl]);
|
|
354
|
+
fillTextInto(paraEl, parseInline(text));
|
|
355
|
+
});
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
case "taskList": {
|
|
359
|
+
const taskItemEls = block.items.map(() => new Y.XmlElement("taskItem"));
|
|
360
|
+
el.insert(0, taskItemEls);
|
|
361
|
+
block.items.forEach((item, i) => {
|
|
362
|
+
taskItemEls[i].setAttribute("checked", item.checked);
|
|
363
|
+
const paraEl = new Y.XmlElement("paragraph");
|
|
364
|
+
taskItemEls[i].insert(0, [paraEl]);
|
|
365
|
+
fillTextInto(paraEl, parseInline(item.text));
|
|
366
|
+
});
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
case "codeBlock": {
|
|
370
|
+
if (block.lang) el.setAttribute("language", block.lang);
|
|
371
|
+
const xt = new Y.XmlText();
|
|
372
|
+
el.insert(0, [xt]);
|
|
373
|
+
xt.insert(0, block.code);
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
376
|
+
case "blockquote": {
|
|
377
|
+
const paraEls = block.lines.map(() => new Y.XmlElement("paragraph"));
|
|
378
|
+
el.insert(0, paraEls);
|
|
379
|
+
block.lines.forEach((line, i) => fillTextInto(paraEls[i], parseInline(line)));
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
382
|
+
case "table": {
|
|
383
|
+
const headerRowEl = new Y.XmlElement("tableRow");
|
|
384
|
+
const dataRowEls = block.dataRows.map(() => new Y.XmlElement("tableRow"));
|
|
385
|
+
el.insert(0, [headerRowEl, ...dataRowEls]);
|
|
386
|
+
const headerCellEls = block.headerRow.map(() => new Y.XmlElement("tableHeader"));
|
|
387
|
+
headerRowEl.insert(0, headerCellEls);
|
|
388
|
+
block.headerRow.forEach((cellText, i) => {
|
|
389
|
+
const paraEl = new Y.XmlElement("paragraph");
|
|
390
|
+
headerCellEls[i].insert(0, [paraEl]);
|
|
391
|
+
fillTextInto(paraEl, parseInline(cellText));
|
|
392
|
+
});
|
|
393
|
+
block.dataRows.forEach((row, ri) => {
|
|
394
|
+
const cellEls = row.map(() => new Y.XmlElement("tableCell"));
|
|
395
|
+
dataRowEls[ri].insert(0, cellEls);
|
|
396
|
+
row.forEach((cellText, ci) => {
|
|
397
|
+
const paraEl = new Y.XmlElement("paragraph");
|
|
398
|
+
cellEls[ci].insert(0, [paraEl]);
|
|
399
|
+
fillTextInto(paraEl, parseInline(cellText));
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
break;
|
|
403
|
+
}
|
|
404
|
+
case "hr":
|
|
405
|
+
break;
|
|
406
|
+
case "image": {
|
|
407
|
+
el.setAttribute("src", block.src);
|
|
408
|
+
if (block.alt) el.setAttribute("alt", block.alt);
|
|
409
|
+
if (block.width) el.setAttribute("width", block.width);
|
|
410
|
+
if (block.height) el.setAttribute("height", block.height);
|
|
411
|
+
break;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
export function populateYDocFromMarkdown(fragment, markdown, fallbackTitle = "Untitled") {
|
|
416
|
+
const ydoc = fragment.doc;
|
|
417
|
+
if (!ydoc) {
|
|
418
|
+
console.warn("[markdownToYjs] fragment has no doc \u2014 skipping population");
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
const blocks = parseBlocks(markdown);
|
|
422
|
+
let title = fallbackTitle;
|
|
423
|
+
let contentBlocks = blocks;
|
|
424
|
+
const h1 = blocks.findIndex((b) => b.type === "heading" && b.level === 1);
|
|
425
|
+
if (h1 !== -1) {
|
|
426
|
+
title = blocks[h1].text;
|
|
427
|
+
contentBlocks = blocks.filter((_, i) => i !== h1);
|
|
428
|
+
}
|
|
429
|
+
if (!contentBlocks.length) contentBlocks = [{ type: "paragraph", text: "" }];
|
|
430
|
+
ydoc.transact(() => {
|
|
431
|
+
const headerEl = new Y.XmlElement("documentHeader");
|
|
432
|
+
const metaEl = new Y.XmlElement("documentMeta");
|
|
433
|
+
const bodyEls = contentBlocks.map((b) => new Y.XmlElement(blockElName(b)));
|
|
434
|
+
fragment.insert(0, [headerEl, metaEl, ...bodyEls]);
|
|
435
|
+
const headerXt = new Y.XmlText();
|
|
436
|
+
headerEl.insert(0, [headerXt]);
|
|
437
|
+
headerXt.insert(0, title);
|
|
438
|
+
contentBlocks.forEach((block, i) => fillBlock(bodyEls[i], block));
|
|
439
|
+
});
|
|
440
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
export const META_FIELD_DEFINITIONS = [
|
|
2
|
+
{
|
|
3
|
+
label: "Date Range",
|
|
4
|
+
icon: "i-lucide-calendar-range",
|
|
5
|
+
kind: "metaFieldDate",
|
|
6
|
+
buildAttrs: () => {
|
|
7
|
+
const t = Date.now();
|
|
8
|
+
return { fieldType: "daterange", fieldLabel: "Date", userDefined: true, startKey: `_start_${t}`, endKey: `_end_${t}` };
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
label: "Date & Time",
|
|
13
|
+
icon: "i-lucide-calendar-clock",
|
|
14
|
+
kind: "metaFieldDateTime",
|
|
15
|
+
buildAttrs: () => {
|
|
16
|
+
const t = Date.now();
|
|
17
|
+
return { fieldType: "datetimerange", fieldLabel: "Date & Time", userDefined: true, startKey: `_dtstart_${t}`, endKey: `_dtend_${t}`, allDayKey: `_allday_${t}` };
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: "Date",
|
|
22
|
+
icon: "i-lucide-calendar",
|
|
23
|
+
kind: "metaFieldDateSingle",
|
|
24
|
+
buildAttrs: () => {
|
|
25
|
+
const t = Date.now();
|
|
26
|
+
return { fieldType: "date", fieldLabel: "Date", userDefined: true, metaKey: `_date_${t}` };
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: "Datetime",
|
|
31
|
+
icon: "i-lucide-calendar-clock",
|
|
32
|
+
kind: "metaFieldDatetimeSingle",
|
|
33
|
+
buildAttrs: () => {
|
|
34
|
+
const t = Date.now();
|
|
35
|
+
return { fieldType: "datetime", fieldLabel: "Datetime", userDefined: true, metaKey: `_datetime_${t}` };
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: "Time",
|
|
40
|
+
icon: "i-lucide-clock",
|
|
41
|
+
kind: "metaFieldTime",
|
|
42
|
+
buildAttrs: () => {
|
|
43
|
+
const t = Date.now();
|
|
44
|
+
return { fieldType: "time", fieldLabel: "Time", userDefined: true, metaKey: `_time_${t}` };
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: "Time Range",
|
|
49
|
+
icon: "i-lucide-clock-4",
|
|
50
|
+
kind: "metaFieldTimeRange",
|
|
51
|
+
buildAttrs: () => {
|
|
52
|
+
const t = Date.now();
|
|
53
|
+
return { fieldType: "timerange", fieldLabel: "Time Range", userDefined: true, startKey: `_tstart_${t}`, endKey: `_tend_${t}` };
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
label: "Number",
|
|
58
|
+
icon: "i-lucide-hash",
|
|
59
|
+
kind: "metaFieldNumber",
|
|
60
|
+
buildAttrs: () => {
|
|
61
|
+
const t = Date.now();
|
|
62
|
+
return { fieldType: "number", fieldLabel: "Number", userDefined: true, metaKey: `_num_${t}` };
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
label: "Slider",
|
|
67
|
+
icon: "i-lucide-sliders-horizontal",
|
|
68
|
+
kind: "metaFieldSlider",
|
|
69
|
+
buildAttrs: () => {
|
|
70
|
+
const t = Date.now();
|
|
71
|
+
return { fieldType: "slider", fieldLabel: "Slider", userDefined: true, metaKey: `_slider_${t}`, sliderMin: 0, sliderMax: 100 };
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: "Progress",
|
|
76
|
+
icon: "i-lucide-bar-chart-2",
|
|
77
|
+
kind: "metaFieldProgress",
|
|
78
|
+
buildAttrs: () => {
|
|
79
|
+
const t = Date.now();
|
|
80
|
+
return { fieldType: "slider", fieldLabel: "Progress", userDefined: true, metaKey: `_progress_${t}`, sliderMin: 0, sliderMax: 100 };
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
label: "Rating",
|
|
85
|
+
icon: "i-lucide-star",
|
|
86
|
+
kind: "metaFieldRating",
|
|
87
|
+
buildAttrs: () => {
|
|
88
|
+
const t = Date.now();
|
|
89
|
+
return { fieldType: "rating", fieldLabel: "Rating", userDefined: true, metaKey: `_rating_${t}`, sliderMax: 5 };
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: "Toggle",
|
|
94
|
+
icon: "i-lucide-toggle-right",
|
|
95
|
+
kind: "metaFieldToggle",
|
|
96
|
+
buildAttrs: () => {
|
|
97
|
+
const t = Date.now();
|
|
98
|
+
return { fieldType: "toggle", fieldLabel: "Toggle", userDefined: true, metaKey: `_toggle_${t}` };
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
label: "Color Preset",
|
|
103
|
+
icon: "i-lucide-palette",
|
|
104
|
+
kind: "metaFieldColor",
|
|
105
|
+
buildAttrs: () => {
|
|
106
|
+
const t = Date.now();
|
|
107
|
+
return { fieldType: "colorPreset", fieldLabel: "Color", userDefined: true, metaKey: `_color_${t}`, presets: JSON.stringify(["#6366f1", "#f97316", "#22c55e", "#ef4444", "#a855f7"]) };
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
label: "Color Picker",
|
|
112
|
+
icon: "i-lucide-pipette",
|
|
113
|
+
kind: "metaFieldColorPicker",
|
|
114
|
+
buildAttrs: () => {
|
|
115
|
+
const t = Date.now();
|
|
116
|
+
return { fieldType: "colorPicker", fieldLabel: "Color", userDefined: true, metaKey: `_cpick_${t}` };
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
label: "Select",
|
|
121
|
+
icon: "i-lucide-chevron-down-circle",
|
|
122
|
+
kind: "metaFieldSelect",
|
|
123
|
+
buildAttrs: () => {
|
|
124
|
+
const t = Date.now();
|
|
125
|
+
return { fieldType: "select", fieldLabel: "Select", userDefined: true, metaKey: `_sel_${t}`, options: JSON.stringify([]) };
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
label: "Multi Select",
|
|
130
|
+
icon: "i-lucide-list-checks",
|
|
131
|
+
kind: "metaFieldMultiSelect",
|
|
132
|
+
buildAttrs: () => {
|
|
133
|
+
const t = Date.now();
|
|
134
|
+
return { fieldType: "multiselect", fieldLabel: "Multi Select", userDefined: true, metaKey: `_msel_${t}`, options: JSON.stringify([]) };
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
label: "Tags",
|
|
139
|
+
icon: "i-lucide-tags",
|
|
140
|
+
kind: "metaFieldTags",
|
|
141
|
+
buildAttrs: () => {
|
|
142
|
+
const t = Date.now();
|
|
143
|
+
return { fieldType: "tags", fieldLabel: "Tags", userDefined: true, metaKey: `_tags_${t}` };
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
label: "URL",
|
|
148
|
+
icon: "i-lucide-link",
|
|
149
|
+
kind: "metaFieldUrl",
|
|
150
|
+
buildAttrs: () => {
|
|
151
|
+
const t = Date.now();
|
|
152
|
+
return { fieldType: "url", fieldLabel: "URL", userDefined: true, metaKey: `_url_${t}` };
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
label: "Text Area",
|
|
157
|
+
icon: "i-lucide-align-left",
|
|
158
|
+
kind: "metaFieldTextarea",
|
|
159
|
+
buildAttrs: () => {
|
|
160
|
+
const t = Date.now();
|
|
161
|
+
return { fieldType: "textarea", fieldLabel: "Text", userDefined: true, metaKey: `_text_${t}` };
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
label: "Location",
|
|
166
|
+
icon: "i-lucide-map-pin",
|
|
167
|
+
kind: "metaFieldLocation",
|
|
168
|
+
buildAttrs: () => {
|
|
169
|
+
const t = Date.now();
|
|
170
|
+
return { fieldType: "location", fieldLabel: "Location", userDefined: true, latKey: `_lat_${t}`, lngKey: `_lng_${t}` };
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
label: "Icon",
|
|
175
|
+
icon: "i-lucide-smile",
|
|
176
|
+
kind: "metaFieldIcon",
|
|
177
|
+
buildAttrs: () => {
|
|
178
|
+
const t = Date.now();
|
|
179
|
+
return { fieldType: "icon", fieldLabel: "Icon", userDefined: true, metaKey: `_icon_${t}` };
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare enum VoiceErrorCode {
|
|
2
|
+
CONNECT_FAILED = "CONNECT_FAILED",
|
|
3
|
+
CONNECT_TIMEOUT = "CONNECT_TIMEOUT",
|
|
4
|
+
MEDIA_PERMISSION_DENIED = "MEDIA_PERMISSION_DENIED",
|
|
5
|
+
MEDIA_NOT_FOUND = "MEDIA_NOT_FOUND",
|
|
6
|
+
MEDIA_GENERIC = "MEDIA_GENERIC",
|
|
7
|
+
PEER_CONNECTION_FAILED = "PEER_CONNECTION_FAILED",
|
|
8
|
+
ICE_FAILED = "ICE_FAILED",
|
|
9
|
+
OFFER_FAILED = "OFFER_FAILED",
|
|
10
|
+
ANSWER_FAILED = "ANSWER_FAILED",
|
|
11
|
+
ROOM_FULL = "ROOM_FULL",
|
|
12
|
+
ROOM_FORBIDDEN = "ROOM_FORBIDDEN",
|
|
13
|
+
WEBSOCKET_ERROR = "WEBSOCKET_ERROR",
|
|
14
|
+
INSECURE_CONTEXT = "INSECURE_CONTEXT",
|
|
15
|
+
MICROPHONE_NOT_FOUND = "MICROPHONE_NOT_FOUND",
|
|
16
|
+
MICROPHONE_PERMISSION_DENIED = "MICROPHONE_PERMISSION_DENIED",
|
|
17
|
+
CAMERA_PERMISSION_DENIED = "CAMERA_PERMISSION_DENIED",
|
|
18
|
+
CAMERA_NOT_FOUND = "CAMERA_NOT_FOUND",
|
|
19
|
+
SCREENSHARE_FAILED = "SCREENSHARE_FAILED",
|
|
20
|
+
UNKNOWN = "UNKNOWN"
|
|
21
|
+
}
|
|
22
|
+
export declare const VoiceErrorMessages: Record<VoiceErrorCode, string>;
|
|
23
|
+
export interface VoiceError {
|
|
24
|
+
code: VoiceErrorCode;
|
|
25
|
+
message: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function createVoiceError(code: VoiceErrorCode, detail?: string): VoiceError;
|
|
28
|
+
/**
|
|
29
|
+
* Errors that should NOT set the persistent voiceError state.
|
|
30
|
+
* These are non-fatal — the audio call is still working.
|
|
31
|
+
* They should be shown as transient toasts instead.
|
|
32
|
+
*/
|
|
33
|
+
export declare const TRANSIENT_ERROR_CODES: Set<VoiceErrorCode>;
|