@abraca/nuxt 0.2.0 → 0.3.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/dist/module.d.mts +46 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +95 -2
- package/dist/runtime/assets/editor.css +1 -0
- package/dist/runtime/components/ACommandPalette.vue +4 -1
- package/dist/runtime/components/ADocRenderer.d.vue.ts +29 -0
- package/dist/runtime/components/ADocRenderer.vue +99 -0
- package/dist/runtime/components/ADocRenderer.vue.d.ts +29 -0
- package/dist/runtime/components/ADocTypeSelect.vue +4 -1
- package/dist/runtime/components/ADocumentTree.vue +78 -19
- package/dist/runtime/components/AEditor.d.vue.ts +9 -4
- package/dist/runtime/components/AEditor.vue +102 -7
- package/dist/runtime/components/AEditor.vue.d.ts +9 -4
- package/dist/runtime/components/AIconPicker.vue +8 -2
- package/dist/runtime/components/ANodePanel.vue +100 -61
- package/dist/runtime/components/ANotifications.vue +35 -8
- package/dist/runtime/components/APermissionGuard.vue +3 -1
- package/dist/runtime/components/APresence.vue +14 -3
- package/dist/runtime/components/AProvider.vue +7 -1
- package/dist/runtime/components/AVoiceBar.vue +57 -15
- package/dist/runtime/components/AVoiceTile.vue +4 -1
- package/dist/runtime/components/aware/AArea.vue +1 -1
- package/dist/runtime/components/aware/AAvatar.vue +85 -16
- package/dist/runtime/components/aware/AButton.vue +5 -1
- package/dist/runtime/components/aware/ACursorLabel.vue +5 -1
- package/dist/runtime/components/aware/ADocBadge.vue +4 -1
- package/dist/runtime/components/aware/AFacepile.vue +13 -3
- package/dist/runtime/components/aware/AInput.vue +5 -1
- package/dist/runtime/components/aware/ATextarea.vue +5 -1
- package/dist/runtime/components/aware/AUserList.vue +8 -2
- package/dist/runtime/components/renderers/ACalendarRenderer.d.vue.ts +12 -1
- package/dist/runtime/components/renderers/ACalendarRenderer.vue +388 -114
- package/dist/runtime/components/renderers/ACalendarRenderer.vue.d.ts +12 -1
- package/dist/runtime/components/renderers/ACallRenderer.d.vue.ts +13 -0
- package/dist/runtime/components/renderers/ACallRenderer.vue +169 -0
- package/dist/runtime/components/renderers/ACallRenderer.vue.d.ts +13 -0
- package/dist/runtime/components/renderers/AChecklistRenderer.d.vue.ts +19 -0
- package/dist/runtime/components/renderers/AChecklistRenderer.vue +581 -0
- package/dist/runtime/components/renderers/AChecklistRenderer.vue.d.ts +19 -0
- package/dist/runtime/components/renderers/ADashboardRenderer.d.vue.ts +19 -0
- package/dist/runtime/components/renderers/ADashboardRenderer.vue +1372 -0
- package/dist/runtime/components/renderers/ADashboardRenderer.vue.d.ts +19 -0
- package/dist/runtime/components/renderers/AGalleryCoverImage.d.vue.ts +8 -0
- package/dist/runtime/components/renderers/AGalleryCoverImage.vue +60 -0
- package/dist/runtime/components/renderers/AGalleryCoverImage.vue.d.ts +8 -0
- package/dist/runtime/components/renderers/AGalleryRenderer.d.vue.ts +12 -1
- package/dist/runtime/components/renderers/AGalleryRenderer.vue +221 -55
- package/dist/runtime/components/renderers/AGalleryRenderer.vue.d.ts +12 -1
- package/dist/runtime/components/renderers/AGraphRenderer.d.vue.ts +19 -0
- package/dist/runtime/components/renderers/AGraphRenderer.vue +1027 -0
- package/dist/runtime/components/renderers/AGraphRenderer.vue.d.ts +19 -0
- package/dist/runtime/components/renderers/AKanbanRenderer.d.vue.ts +13 -1
- package/dist/runtime/components/renderers/AKanbanRenderer.vue +474 -140
- package/dist/runtime/components/renderers/AKanbanRenderer.vue.d.ts +13 -1
- package/dist/runtime/components/renderers/AMapRenderer.d.vue.ts +19 -0
- package/dist/runtime/components/renderers/AMapRenderer.vue +1622 -0
- package/dist/runtime/components/renderers/AMapRenderer.vue.d.ts +19 -0
- package/dist/runtime/components/renderers/AOutlineRenderer.d.vue.ts +12 -1
- package/dist/runtime/components/renderers/AOutlineRenderer.vue +294 -134
- package/dist/runtime/components/renderers/AOutlineRenderer.vue.d.ts +12 -1
- package/dist/runtime/components/renderers/ATableRenderer.d.vue.ts +12 -1
- package/dist/runtime/components/renderers/ATableRenderer.vue +437 -145
- package/dist/runtime/components/renderers/ATableRenderer.vue.d.ts +12 -1
- package/dist/runtime/components/renderers/ATimelineRenderer.d.vue.ts +19 -0
- package/dist/runtime/components/renderers/ATimelineRenderer.vue +446 -0
- package/dist/runtime/components/renderers/ATimelineRenderer.vue.d.ts +19 -0
- package/dist/runtime/composables/useAwareness.js +5 -0
- package/dist/runtime/composables/useBroadcastSync.d.ts +18 -0
- package/dist/runtime/composables/useBroadcastSync.js +26 -0
- package/dist/runtime/composables/useChat.js +4 -2
- package/dist/runtime/composables/useChatUsers.js +2 -1
- package/dist/runtime/composables/useCommandPalette.js +62 -3
- package/dist/runtime/composables/useConnectionStatus.js +7 -0
- package/dist/runtime/composables/useDevicePairing.d.ts +58 -0
- package/dist/runtime/composables/useDevicePairing.js +108 -0
- package/dist/runtime/composables/useDocExport.d.ts +5 -0
- package/dist/runtime/composables/useDocExport.js +2 -2
- package/dist/runtime/composables/useDocImport.js +4 -3
- package/dist/runtime/composables/useDocSeo.d.ts +20 -0
- package/dist/runtime/composables/useDocSeo.js +44 -0
- package/dist/runtime/composables/useDocSlugs.d.ts +7 -0
- package/dist/runtime/composables/useDocSlugs.js +20 -0
- package/dist/runtime/composables/useDocTree.d.ts +34 -0
- package/dist/runtime/composables/useDocTree.js +35 -0
- package/dist/runtime/composables/useEditorDragHandle.js +2 -1
- package/dist/runtime/composables/useEditorMentions.js +4 -2
- package/dist/runtime/composables/useEditorSuggestions.d.ts +1 -0
- package/dist/runtime/composables/useEditorSuggestions.js +9 -2
- package/dist/runtime/composables/useEditorToolbar.js +2 -1
- package/dist/runtime/composables/useFileIndex.js +2 -1
- package/dist/runtime/composables/useFileTransfer.d.ts +112 -0
- package/dist/runtime/composables/useFileTransfer.js +171 -0
- package/dist/runtime/composables/useFollowUser.js +2 -1
- package/dist/runtime/composables/useInvites.d.ts +56 -0
- package/dist/runtime/composables/useInvites.js +77 -0
- package/dist/runtime/composables/useNodePanel.d.ts +14 -0
- package/dist/runtime/composables/useNodePanel.js +52 -0
- package/dist/runtime/composables/useNotifications.js +4 -2
- package/dist/runtime/composables/usePasskeyAccounts.js +4 -2
- package/dist/runtime/composables/useSearchIndex.d.ts +1 -0
- package/dist/runtime/composables/useSearchIndex.js +13 -5
- package/dist/runtime/composables/useServerInfo.d.ts +31 -0
- package/dist/runtime/composables/useServerInfo.js +80 -0
- package/dist/runtime/composables/useSlugRoute.d.ts +6 -0
- package/dist/runtime/composables/useSlugRoute.js +19 -0
- package/dist/runtime/composables/useSpaces.d.ts +37 -0
- package/dist/runtime/composables/useSpaces.js +83 -0
- package/dist/runtime/composables/useTouchDrag.d.ts +34 -0
- package/dist/runtime/composables/useTouchDrag.js +191 -0
- package/dist/runtime/composables/useTrash.d.ts +1 -1
- package/dist/runtime/composables/useTrash.js +6 -3
- package/dist/runtime/composables/useWebRTC.d.ts +50 -0
- package/dist/runtime/composables/useWebRTC.js +177 -0
- package/dist/runtime/extensions/meta-field.d.ts +4 -1
- package/dist/runtime/extensions/steps.js +1 -1
- package/dist/runtime/extensions/views/AccordionItemView.vue +13 -3
- package/dist/runtime/extensions/views/AccordionView.vue +4 -1
- package/dist/runtime/extensions/views/BadgeView.vue +11 -2
- package/dist/runtime/extensions/views/CalloutView.vue +4 -1
- package/dist/runtime/extensions/views/CardGroupView.vue +4 -1
- package/dist/runtime/extensions/views/CardView.vue +17 -3
- package/dist/runtime/extensions/views/CodeGroupView.vue +4 -1
- package/dist/runtime/extensions/views/CollapsibleView.vue +8 -2
- package/dist/runtime/extensions/views/FileNodeView.vue +32 -8
- package/dist/runtime/extensions/views/KbdView.vue +8 -2
- package/dist/runtime/extensions/views/MetaFieldView.vue +208 -46
- package/dist/runtime/extensions/views/ProseIconView.vue +8 -2
- package/dist/runtime/extensions/views/TabsView.vue +17 -4
- package/dist/runtime/locale.d.ts +71 -0
- package/dist/runtime/locale.js +71 -0
- package/dist/runtime/plugin-abracadabra.client.js +29 -3
- package/dist/runtime/plugin-abracadabra.server.js +2 -0
- package/dist/runtime/server/api/_abracadabra/render/[docId].get.d.ts +1 -1
- package/dist/runtime/server/api/_abracadabra/render/[docId].get.js +29 -4
- package/dist/runtime/server/api/_abracadabra/resolve/[...slug].get.d.ts +2 -0
- package/dist/runtime/server/api/_abracadabra/resolve/[...slug].get.js +43 -0
- package/dist/runtime/server/api/_abracadabra/slugs.get.d.ts +2 -0
- package/dist/runtime/server/api/_abracadabra/slugs.get.js +7 -0
- package/dist/runtime/server/plugins/abracadabra-service.js +10 -5
- package/dist/runtime/server/runners/doc-tree-cache.js +4 -0
- package/dist/runtime/server/utils/slugMap.d.ts +32 -0
- package/dist/runtime/server/utils/slugMap.js +58 -0
- package/dist/runtime/types.d.ts +1 -0
- package/dist/runtime/utils/docTypes.d.ts +29 -1
- package/dist/runtime/utils/docTypes.js +129 -1
- package/dist/runtime/utils/markdownToYjs.js +2 -2
- package/dist/runtime/utils/sdkRef.d.ts +2 -0
- package/dist/runtime/utils/sdkRef.js +7 -0
- package/dist/runtime/utils/slugify.d.ts +40 -0
- package/dist/runtime/utils/slugify.js +36 -0
- package/dist/types.d.mts +6 -0
- package/package.json +32 -19
|
@@ -1,4 +1,42 @@
|
|
|
1
1
|
import { defineAsyncComponent } from "vue";
|
|
2
|
+
const GEO_COLOR_PRESETS = ["#3b82f6", "#f97316", "#22c55e", "#ef4444", "#a855f7"];
|
|
3
|
+
const GEO_ICON_OPTIONS = [
|
|
4
|
+
"map-pin",
|
|
5
|
+
"star",
|
|
6
|
+
"flag",
|
|
7
|
+
"home",
|
|
8
|
+
"building-2",
|
|
9
|
+
"coffee",
|
|
10
|
+
"utensils",
|
|
11
|
+
"camera",
|
|
12
|
+
"heart",
|
|
13
|
+
"zap",
|
|
14
|
+
"triangle-alert",
|
|
15
|
+
"car",
|
|
16
|
+
"plane",
|
|
17
|
+
"anchor",
|
|
18
|
+
"tree-pine",
|
|
19
|
+
"mountain",
|
|
20
|
+
"waves",
|
|
21
|
+
"shield",
|
|
22
|
+
"crosshair",
|
|
23
|
+
"circle-dot",
|
|
24
|
+
"bookmark",
|
|
25
|
+
"gem",
|
|
26
|
+
"radio",
|
|
27
|
+
"compass"
|
|
28
|
+
];
|
|
29
|
+
export const GEO_TYPE_META_SCHEMAS = {
|
|
30
|
+
marker: [
|
|
31
|
+
{ type: "location", latKey: "geoLat", lngKey: "geoLng", label: "Location" },
|
|
32
|
+
{ type: "icon", key: "icon", options: GEO_ICON_OPTIONS, label: "Icon" },
|
|
33
|
+
{ type: "colorPreset", key: "color", presets: GEO_COLOR_PRESETS, label: "Color" }
|
|
34
|
+
],
|
|
35
|
+
line: [
|
|
36
|
+
{ type: "colorPreset", key: "color", presets: GEO_COLOR_PRESETS, label: "Color" }
|
|
37
|
+
],
|
|
38
|
+
measure: []
|
|
39
|
+
};
|
|
2
40
|
export const DOC_TYPES = {
|
|
3
41
|
doc: {
|
|
4
42
|
key: "doc",
|
|
@@ -77,11 +115,100 @@ export const DOC_TYPES = {
|
|
|
77
115
|
{ type: "datetimerange", startKey: "datetimeStart", endKey: "datetimeEnd", allDayKey: "allDay" },
|
|
78
116
|
{ type: "colorPreset", key: "color", presets: ["#6366f1", "#ec4899", "#f97316", "#22c55e", "#3b82f6", "#a855f7"], label: "Color" }
|
|
79
117
|
]
|
|
118
|
+
},
|
|
119
|
+
checklist: {
|
|
120
|
+
key: "checklist",
|
|
121
|
+
label: "Checklist",
|
|
122
|
+
icon: "i-lucide-check-square",
|
|
123
|
+
description: "Hierarchical task list with priority and due dates",
|
|
124
|
+
available: true,
|
|
125
|
+
supportsChildren: true,
|
|
126
|
+
childLabel: "Task",
|
|
127
|
+
defaultDepth: -1,
|
|
128
|
+
component: defineAsyncComponent(
|
|
129
|
+
() => import("../components/renderers/AChecklistRenderer.vue")
|
|
130
|
+
),
|
|
131
|
+
metaSchema: [
|
|
132
|
+
{ type: "toggle", key: "checked", label: "Done" },
|
|
133
|
+
{ type: "select", key: "priority", options: ["none", "low", "medium", "high"], label: "Priority" },
|
|
134
|
+
{ type: "date", key: "dateEnd", label: "Due date" }
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
timeline: {
|
|
138
|
+
key: "timeline",
|
|
139
|
+
label: "Timeline",
|
|
140
|
+
icon: "i-lucide-gantt-chart",
|
|
141
|
+
description: "Gantt-style project timeline with epics and tasks",
|
|
142
|
+
available: true,
|
|
143
|
+
supportsChildren: true,
|
|
144
|
+
childLabel: "Epic",
|
|
145
|
+
grandchildLabel: "Task",
|
|
146
|
+
component: defineAsyncComponent(
|
|
147
|
+
() => import("../components/renderers/ATimelineRenderer.vue")
|
|
148
|
+
),
|
|
149
|
+
metaSchema: [
|
|
150
|
+
{ type: "daterange", startKey: "dateStart", endKey: "dateEnd" },
|
|
151
|
+
{ type: "slider", key: "taskProgress", min: 0, max: 100, label: "Progress" },
|
|
152
|
+
{ type: "colorPreset", key: "color", presets: ["#6366f1", "#818cf8", "#f97316", "#22c55e", "#3b82f6", "#a855f7"], label: "Color" }
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
call: {
|
|
156
|
+
key: "call",
|
|
157
|
+
label: "Call",
|
|
158
|
+
icon: "i-lucide-phone",
|
|
159
|
+
description: "Video call room with real-time audio and video",
|
|
160
|
+
available: true,
|
|
161
|
+
supportsChildren: false,
|
|
162
|
+
component: defineAsyncComponent(
|
|
163
|
+
() => import("../components/renderers/ACallRenderer.vue")
|
|
164
|
+
)
|
|
165
|
+
},
|
|
166
|
+
graph: {
|
|
167
|
+
key: "graph",
|
|
168
|
+
label: "Graph",
|
|
169
|
+
icon: "i-lucide-git-fork",
|
|
170
|
+
description: "Force-directed graph visualization of document relationships",
|
|
171
|
+
available: true,
|
|
172
|
+
supportsChildren: true,
|
|
173
|
+
childLabel: "Node",
|
|
174
|
+
component: defineAsyncComponent(
|
|
175
|
+
() => import("../components/renderers/AGraphRenderer.vue")
|
|
176
|
+
)
|
|
177
|
+
},
|
|
178
|
+
dashboard: {
|
|
179
|
+
key: "dashboard",
|
|
180
|
+
label: "Dashboard",
|
|
181
|
+
icon: "i-lucide-layout-dashboard",
|
|
182
|
+
description: "Desktop-like icon grid with widgets and free-form positioning",
|
|
183
|
+
available: true,
|
|
184
|
+
supportsChildren: true,
|
|
185
|
+
childLabel: "Item",
|
|
186
|
+
component: defineAsyncComponent(
|
|
187
|
+
() => import("../components/renderers/ADashboardRenderer.vue")
|
|
188
|
+
)
|
|
189
|
+
},
|
|
190
|
+
map: {
|
|
191
|
+
key: "map",
|
|
192
|
+
label: "Map",
|
|
193
|
+
icon: "i-lucide-map",
|
|
194
|
+
description: "Interactive map with markers, lines, and measurements",
|
|
195
|
+
available: true,
|
|
196
|
+
supportsChildren: true,
|
|
197
|
+
childLabel: "Location",
|
|
198
|
+
component: defineAsyncComponent(
|
|
199
|
+
() => import("../components/renderers/AMapRenderer.vue")
|
|
200
|
+
),
|
|
201
|
+
metaSchema: [
|
|
202
|
+
{ type: "location", latKey: "geoLat", lngKey: "geoLng", label: "Location" },
|
|
203
|
+
{ type: "icon", key: "icon", options: GEO_ICON_OPTIONS, label: "Icon" },
|
|
204
|
+
{ type: "colorPreset", key: "color", presets: GEO_COLOR_PRESETS, label: "Color" }
|
|
205
|
+
]
|
|
80
206
|
}
|
|
81
207
|
};
|
|
82
208
|
export const DEFAULT_DOC_TYPE = DOC_TYPES.doc;
|
|
83
209
|
export function resolveDocType(typeKey, registry) {
|
|
84
210
|
if (!typeKey) return DEFAULT_DOC_TYPE;
|
|
211
|
+
if (DOC_TYPES[typeKey]) return DOC_TYPES[typeKey];
|
|
85
212
|
if (registry) {
|
|
86
213
|
const pluginTypes = registry.getAllPageTypes();
|
|
87
214
|
if (pluginTypes[typeKey]) {
|
|
@@ -92,11 +219,12 @@ export function resolveDocType(typeKey, registry) {
|
|
|
92
219
|
icon: pt.icon,
|
|
93
220
|
component: pt.component,
|
|
94
221
|
hasEditor: pt.hasEditor,
|
|
222
|
+
metaSchema: pt.metaSchema,
|
|
95
223
|
available: true
|
|
96
224
|
};
|
|
97
225
|
}
|
|
98
226
|
}
|
|
99
|
-
return
|
|
227
|
+
return DEFAULT_DOC_TYPE;
|
|
100
228
|
}
|
|
101
229
|
export function getAvailableDocTypes(registry) {
|
|
102
230
|
const all = { ...DOC_TYPES };
|
|
@@ -115,7 +115,7 @@ function parseMdcProps(propsStr) {
|
|
|
115
115
|
function parseInline(text) {
|
|
116
116
|
const stripped = text.replace(/\{lang="[^"]*"\}/g, "").replace(/:(?!badge|icon|kbd)(\w[\w-]*)\[([^\]]*)\](\{[^}]*\})?/g, "$2").replace(/:(?!badge|icon|kbd)(\w[\w-]*)(\{[^}]*\})/g, "");
|
|
117
117
|
const tokens = [];
|
|
118
|
-
const re = /:badge\[([^\]]*)\](\{[^}]*\})?|:icon\{([^}]*)\}|:kbd\{([^}]*)\}|!?\[\[([^\]|]
|
|
118
|
+
const re = /:badge\[([^\]]*)\](\{[^}]*\})?|:icon\{([^}]*)\}|:kbd\{([^}]*)\}|!?\[\[([^\]|]+)(?:\|([^\]]+))?\]\]|~~(.+?)~~|\*\*(.+?)\*\*|\*(.+?)\*|_(.+?)_|`(.+?)`|\[(.+?)\]\((.+?)\)/g;
|
|
119
119
|
let lastIndex = 0;
|
|
120
120
|
let match;
|
|
121
121
|
while ((match = re.exec(stripped)) !== null) {
|
|
@@ -161,7 +161,7 @@ function parseTableRow(line) {
|
|
|
161
161
|
function isTableSeparator(line) {
|
|
162
162
|
return /^\|[\s|:-]+\|$/.test(line.trim());
|
|
163
163
|
}
|
|
164
|
-
const TASK_RE = /^[-*+]\s+\[([
|
|
164
|
+
const TASK_RE = /^[-*+]\s+\[([ x])\]\s+(.*)/i;
|
|
165
165
|
function parseBlocks(markdown) {
|
|
166
166
|
const rawLines = markdown.split("\n");
|
|
167
167
|
let firstContentLine = 0;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Isomorphic slug utilities for Abracadabra documents.
|
|
3
|
+
*
|
|
4
|
+
* Generates deterministic, hierarchical, human-readable URL slugs from the
|
|
5
|
+
* doc-tree. Same tree always produces the same slug map.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Convert a label to a URL-safe slug.
|
|
9
|
+
*
|
|
10
|
+
* - Lowercases
|
|
11
|
+
* - Normalizes unicode (NFD, strip diacritics)
|
|
12
|
+
* - Replaces non-alphanumeric with hyphens
|
|
13
|
+
* - Collapses consecutive hyphens
|
|
14
|
+
* - Trims leading/trailing hyphens
|
|
15
|
+
* - Returns 'untitled' for empty input
|
|
16
|
+
*/
|
|
17
|
+
export declare function slugify(label: string): string;
|
|
18
|
+
/** Check whether a string is a valid UUID v4 (case-insensitive). */
|
|
19
|
+
export declare const isUUID: (s: string) => boolean;
|
|
20
|
+
export interface SlugMapEntry {
|
|
21
|
+
id: string;
|
|
22
|
+
label: string;
|
|
23
|
+
parentId: string | null;
|
|
24
|
+
order: number;
|
|
25
|
+
trashed?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface SlugMap {
|
|
28
|
+
slugToId: Record<string, string>;
|
|
29
|
+
idToSlug: Record<string, string>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Build a bidirectional slug↔docId map from tree entries.
|
|
33
|
+
*
|
|
34
|
+
* Slugs are hierarchical: a child's full slug is `parentSlug/childSlug`.
|
|
35
|
+
* Duplicate slugs at the same level get `-1`, `-2` suffixes (first occurrence
|
|
36
|
+
* keeps the base slug).
|
|
37
|
+
*
|
|
38
|
+
* The output is deterministic: entries are sorted by order, then by id.
|
|
39
|
+
*/
|
|
40
|
+
export declare function buildSlugMap(entries: SlugMapEntry[]): SlugMap;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export function slugify(label) {
|
|
2
|
+
const slug = label.normalize("NFD").replace(/[\u0300-\u036F]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/-{2,}/g, "-").replace(/^-|-$/g, "");
|
|
3
|
+
return slug || "untitled";
|
|
4
|
+
}
|
|
5
|
+
export const isUUID = (s) => /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(s);
|
|
6
|
+
export function buildSlugMap(entries) {
|
|
7
|
+
const slugToId = {};
|
|
8
|
+
const idToSlug = {};
|
|
9
|
+
const active = entries.filter((e) => !e.trashed);
|
|
10
|
+
const byParent = /* @__PURE__ */ new Map();
|
|
11
|
+
for (const entry of active) {
|
|
12
|
+
const key = entry.parentId ?? null;
|
|
13
|
+
if (!byParent.has(key)) byParent.set(key, []);
|
|
14
|
+
byParent.get(key).push(entry);
|
|
15
|
+
}
|
|
16
|
+
for (const children of byParent.values()) {
|
|
17
|
+
children.sort((a, b) => (a.order ?? 0) - (b.order ?? 0) || a.id.localeCompare(b.id));
|
|
18
|
+
}
|
|
19
|
+
function processLevel(parentId, parentPath) {
|
|
20
|
+
const children = byParent.get(parentId);
|
|
21
|
+
if (!children) return;
|
|
22
|
+
const slugCount = /* @__PURE__ */ new Map();
|
|
23
|
+
for (const entry of children) {
|
|
24
|
+
const baseSlug = slugify(entry.label);
|
|
25
|
+
const count = slugCount.get(baseSlug) ?? 0;
|
|
26
|
+
slugCount.set(baseSlug, count + 1);
|
|
27
|
+
const slug = count === 0 ? baseSlug : `${baseSlug}-${count}`;
|
|
28
|
+
const fullPath = parentPath ? `${parentPath}/${slug}` : slug;
|
|
29
|
+
slugToId[fullPath] = entry.id;
|
|
30
|
+
idToSlug[entry.id] = fullPath;
|
|
31
|
+
processLevel(entry.id, fullPath);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
processLevel(null, "");
|
|
35
|
+
return { slugToId, idToSlug };
|
|
36
|
+
}
|
package/dist/types.d.mts
CHANGED
|
@@ -2,6 +2,12 @@ export { type AbracadabraPlugin, type AbracadabraState, type CachedTreeNode, typ
|
|
|
2
2
|
|
|
3
3
|
export { type AbracadabraLocale } from '../dist/runtime/locale.js'
|
|
4
4
|
|
|
5
|
+
export { type DocTreeReturn } from '../dist/runtime/composables/useDocTree.js'
|
|
6
|
+
|
|
7
|
+
export { type DocSeoOptions } from '../dist/runtime/composables/useDocSeo.js'
|
|
8
|
+
|
|
9
|
+
export { type SlugMap, type SlugMapEntry, type buildSlugMap, type isUUID, type slugify } from '../dist/runtime/utils/slugify.js'
|
|
10
|
+
|
|
5
11
|
export { type avatarBorderStyle, type avatarGradient, type avatarStyleFromName } from '../dist/runtime/utils/avatarStyle.js'
|
|
6
12
|
|
|
7
13
|
export { type COLOR_PALETTES, type ColorPalette, type ColorShade, type findPaletteByHex } from '../dist/runtime/utils/colorPalettes.js'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abraca/nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "First-class Nuxt module for the Abracadabra CRDT collaboration platform",
|
|
5
5
|
"repository": "abracadabra/abracadabra-nuxt",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
"lint": "eslint .",
|
|
35
35
|
"test": "vitest run",
|
|
36
36
|
"test:watch": "vitest watch",
|
|
37
|
+
"test:integration": "vitest run --config test/integration/vitest.config.ts --reporter=verbose",
|
|
37
38
|
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
38
39
|
},
|
|
39
40
|
"dependencies": {
|
|
40
41
|
"@nuxt/kit": "^4.4.2",
|
|
41
|
-
"@vueuse/core": "^
|
|
42
|
+
"@vueuse/core": "^14.2.1",
|
|
42
43
|
"defu": "^6.1.4",
|
|
43
|
-
"nanoevents": "^9.
|
|
44
|
+
"nanoevents": "^9.1.0"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
47
|
"@abraca/dabra": ">=1.0.0",
|
|
47
|
-
"jszip": ">=3.0.0",
|
|
48
48
|
"@noble/ed25519": ">=2.0.0",
|
|
49
49
|
"@noble/hashes": ">=1.0.0",
|
|
50
50
|
"@nuxt/ui": ">=3.0.0",
|
|
@@ -52,14 +52,23 @@
|
|
|
52
52
|
"@tiptap/extension-collaboration": ">=3.0.0",
|
|
53
53
|
"@tiptap/extension-collaboration-caret": ">=3.0.0",
|
|
54
54
|
"@tiptap/vue-3": ">=3.0.0",
|
|
55
|
+
"d3-force": ">=3.0.0",
|
|
56
|
+
"jszip": ">=3.0.0",
|
|
57
|
+
"mapbox-gl": ">=3.0.0",
|
|
55
58
|
"nuxt": ">=4.0.0",
|
|
56
59
|
"vue": ">=3.4.0",
|
|
57
60
|
"yjs": ">=13.0.0"
|
|
58
61
|
},
|
|
59
62
|
"peerDependenciesMeta": {
|
|
63
|
+
"d3-force": {
|
|
64
|
+
"optional": true
|
|
65
|
+
},
|
|
60
66
|
"jszip": {
|
|
61
67
|
"optional": true
|
|
62
68
|
},
|
|
69
|
+
"mapbox-gl": {
|
|
70
|
+
"optional": true
|
|
71
|
+
},
|
|
63
72
|
"@tiptap/core": {
|
|
64
73
|
"optional": false
|
|
65
74
|
},
|
|
@@ -74,29 +83,33 @@
|
|
|
74
83
|
}
|
|
75
84
|
},
|
|
76
85
|
"devDependencies": {
|
|
77
|
-
"@abraca/dabra": "
|
|
78
|
-
"@noble/ed25519": "^
|
|
79
|
-
"@noble/hashes": "^1.
|
|
80
|
-
"@nuxt/devtools": "
|
|
86
|
+
"@abraca/dabra": "1.0.9",
|
|
87
|
+
"@noble/ed25519": "^3.0.1",
|
|
88
|
+
"@noble/hashes": "^1.8.0",
|
|
89
|
+
"@nuxt/devtools": "4.0.0-alpha.3",
|
|
81
90
|
"@nuxt/eslint-config": "^1.15.2",
|
|
82
91
|
"@nuxt/module-builder": "^1.0.2",
|
|
83
92
|
"@nuxt/schema": "^4.4.2",
|
|
84
93
|
"@nuxt/test-utils": "^4.0.0",
|
|
85
|
-
"@nuxt/ui": "^4.
|
|
86
|
-
"@tiptap/core": "^3.
|
|
87
|
-
"@tiptap/extension-collaboration": "^3.
|
|
88
|
-
"@tiptap/extension-collaboration-caret": "^3.
|
|
89
|
-
"@tiptap/vue-3": "^3.
|
|
94
|
+
"@nuxt/ui": "^4.6.0",
|
|
95
|
+
"@tiptap/core": "^3.20.5",
|
|
96
|
+
"@tiptap/extension-collaboration": "^3.20.5",
|
|
97
|
+
"@tiptap/extension-collaboration-caret": "^3.20.5",
|
|
98
|
+
"@tiptap/vue-3": "^3.20.5",
|
|
99
|
+
"@types/d3-force": "^3.0.10",
|
|
90
100
|
"@types/node": "latest",
|
|
101
|
+
"@types/ws": "^8.18.1",
|
|
91
102
|
"changelogen": "^0.6.2",
|
|
92
|
-
"
|
|
103
|
+
"d3-force": "^3.0.0",
|
|
104
|
+
"eslint": "^10.1.0",
|
|
93
105
|
"nuxt": "^4.4.2",
|
|
94
106
|
"tslib": "^2.8.1",
|
|
95
|
-
"typescript": "~
|
|
96
|
-
"vitest": "^4.1.
|
|
97
|
-
"vue": "^3.5.
|
|
98
|
-
"vue-tsc": "^3.2.
|
|
99
|
-
"
|
|
107
|
+
"typescript": "~6.0.2",
|
|
108
|
+
"vitest": "^4.1.1",
|
|
109
|
+
"vue": "^3.5.30",
|
|
110
|
+
"vue-tsc": "^3.2.6",
|
|
111
|
+
"ws": "^8.20.0",
|
|
112
|
+
"yjs": "^13.6.30"
|
|
100
113
|
},
|
|
101
114
|
"packageManager": "pnpm@10.29.3+sha512.498e1fb4cca5aa06c1dcf2611e6fafc50972ffe7189998c409e90de74566444298ffe43e6cd2acdc775ba1aa7cc5e092a8b7054c811ba8c5770f84693d33d2dc"
|
|
102
115
|
}
|