@abraca/nuxt 2.0.11 → 2.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 +68 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +99 -4
- package/dist/runtime/components/ACodeEditor.d.vue.ts +26 -0
- package/dist/runtime/components/ACodeEditor.vue +268 -0
- package/dist/runtime/components/ACodeEditor.vue.d.ts +26 -0
- package/dist/runtime/components/ADocumentTree.vue +52 -20
- package/dist/runtime/components/AEditor.d.vue.ts +20 -13
- package/dist/runtime/components/AEditor.vue +55 -2
- package/dist/runtime/components/AEditor.vue.d.ts +20 -13
- package/dist/runtime/components/ANodePanel.vue +64 -60
- package/dist/runtime/components/ANotificationBell.d.vue.ts +1 -1
- package/dist/runtime/components/ANotificationBell.vue.d.ts +1 -1
- package/dist/runtime/components/ASpaceFormModal.d.vue.ts +2 -2
- package/dist/runtime/components/ASpaceFormModal.vue.d.ts +2 -2
- package/dist/runtime/components/aware/AMedia.d.vue.ts +1 -1
- package/dist/runtime/components/aware/AMedia.vue.d.ts +1 -1
- package/dist/runtime/components/aware/APresenceBlobs.d.vue.ts +29 -1
- package/dist/runtime/components/aware/APresenceBlobs.vue +54 -8
- package/dist/runtime/components/aware/APresenceBlobs.vue.d.ts +29 -1
- package/dist/runtime/components/aware/APresenceCursors.d.vue.ts +11 -0
- package/dist/runtime/components/aware/APresenceCursors.vue +74 -9
- package/dist/runtime/components/aware/APresenceCursors.vue.d.ts +11 -0
- package/dist/runtime/components/aware/AToggleGroup.d.vue.ts +28 -13
- package/dist/runtime/components/aware/AToggleGroup.vue +56 -20
- package/dist/runtime/components/aware/AToggleGroup.vue.d.ts +28 -13
- package/dist/runtime/components/docs/ADocsNavigation.d.vue.ts +1 -1
- package/dist/runtime/components/docs/ADocsNavigation.vue.d.ts +1 -1
- package/dist/runtime/components/docs/ADocsSearch.d.vue.ts +1 -1
- package/dist/runtime/components/docs/ADocsSearch.vue.d.ts +1 -1
- package/dist/runtime/components/docs/ADocsSearchButton.d.vue.ts +1 -1
- package/dist/runtime/components/docs/ADocsSearchButton.vue.d.ts +1 -1
- package/dist/runtime/components/docs/ADocsToc.d.vue.ts +2 -2
- package/dist/runtime/components/docs/ADocsToc.vue.d.ts +2 -2
- package/dist/runtime/components/editor/AEditorRedoButton.d.vue.ts +1 -1
- package/dist/runtime/components/editor/AEditorRedoButton.vue.d.ts +1 -1
- package/dist/runtime/components/editor/AEditorUndoButton.d.vue.ts +1 -1
- package/dist/runtime/components/editor/AEditorUndoButton.vue.d.ts +1 -1
- package/dist/runtime/components/editor/ANodeInlineLabel.d.vue.ts +1 -1
- package/dist/runtime/components/editor/ANodeInlineLabel.vue.d.ts +1 -1
- package/dist/runtime/components/registry/APluginBrowser.d.vue.ts +23 -0
- package/dist/runtime/components/registry/APluginBrowser.vue +155 -0
- package/dist/runtime/components/registry/APluginBrowser.vue.d.ts +23 -0
- package/dist/runtime/components/registry/APluginCapabilityDialog.d.vue.ts +17 -0
- package/dist/runtime/components/registry/APluginCapabilityDialog.vue +159 -0
- package/dist/runtime/components/registry/APluginCapabilityDialog.vue.d.ts +17 -0
- package/dist/runtime/components/registry/APluginCard.d.vue.ts +20 -0
- package/dist/runtime/components/registry/APluginCard.vue +91 -0
- package/dist/runtime/components/registry/APluginCard.vue.d.ts +20 -0
- package/dist/runtime/components/registry/APluginDetail.d.vue.ts +18 -0
- package/dist/runtime/components/registry/APluginDetail.vue +252 -0
- package/dist/runtime/components/registry/APluginDetail.vue.d.ts +18 -0
- package/dist/runtime/components/renderers/ACodeRenderer.d.vue.ts +15 -0
- package/dist/runtime/components/renderers/ACodeRenderer.vue +68 -0
- package/dist/runtime/components/renderers/ACodeRenderer.vue.d.ts +15 -0
- package/dist/runtime/components/renderers/AGraphRenderer.vue +416 -120
- package/dist/runtime/components/renderers/AProseRenderer.d.vue.ts +2 -2
- package/dist/runtime/components/renderers/AProseRenderer.vue.d.ts +2 -2
- package/dist/runtime/components/shell/ABreadcrumbForDoc.d.vue.ts +11 -0
- package/dist/runtime/components/shell/ABreadcrumbForDoc.vue +16 -0
- package/dist/runtime/components/shell/ABreadcrumbForDoc.vue.d.ts +11 -0
- package/dist/runtime/components/shell/ASettingsSection.d.vue.ts +35 -0
- package/dist/runtime/components/shell/ASettingsSection.vue +26 -0
- package/dist/runtime/components/shell/ASettingsSection.vue.d.ts +35 -0
- package/dist/runtime/components/shell/ASidebar.d.vue.ts +1 -1
- package/dist/runtime/components/shell/ASidebar.vue.d.ts +1 -1
- package/dist/runtime/components/shell/AUserMenu.d.vue.ts +5 -2
- package/dist/runtime/components/shell/AUserMenu.vue +4 -0
- package/dist/runtime/components/shell/AUserMenu.vue.d.ts +5 -2
- package/dist/runtime/composables/useAbracadabraSchema.d.ts +83 -0
- package/dist/runtime/composables/useAbracadabraSchema.js +52 -0
- package/dist/runtime/composables/useAggregatedPresence.d.ts +1 -6
- package/dist/runtime/composables/useCalendarView.d.ts +1 -1
- package/dist/runtime/composables/useChat.js +1 -0
- package/dist/runtime/composables/useDocBreadcrumb.d.ts +21 -0
- package/dist/runtime/composables/useDocBreadcrumb.js +33 -0
- package/dist/runtime/composables/useDocEntryTyped.d.ts +60 -0
- package/dist/runtime/composables/useDocEntryTyped.js +70 -0
- package/dist/runtime/composables/useEditorDragHandle.js +18 -0
- package/dist/runtime/composables/useEditorSuggestions.js +2 -1
- package/dist/runtime/composables/useInstalledPlugins.d.ts +3 -21
- package/dist/runtime/composables/useInstalledPlugins.js +2 -12
- package/dist/runtime/composables/useMetaMenuItems.d.ts +21 -0
- package/dist/runtime/composables/useMetaMenuItems.js +115 -0
- package/dist/runtime/composables/useMetaValidator.d.ts +27 -0
- package/dist/runtime/composables/useMetaValidator.js +10 -0
- package/dist/runtime/composables/usePluginCatalog.d.ts +161 -0
- package/dist/runtime/composables/usePluginCatalog.js +234 -0
- package/dist/runtime/composables/useQuery.d.ts +79 -0
- package/dist/runtime/composables/useQuery.js +97 -0
- package/dist/runtime/composables/useSpaces.js +4 -5
- package/dist/runtime/composables/useTableView.d.ts +3 -3
- package/dist/runtime/composables/useTypedDoc.d.ts +97 -0
- package/dist/runtime/composables/useTypedDoc.js +114 -0
- package/dist/runtime/composables/useWebRTC.js +44 -5
- package/dist/runtime/extensions/document-meta.js +5 -0
- package/dist/runtime/extensions/timeline.d.ts +11 -0
- package/dist/runtime/extensions/timeline.js +52 -0
- package/dist/runtime/extensions/views/DocumentMetaView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/DocumentMetaView.vue +63 -0
- package/dist/runtime/extensions/views/DocumentMetaView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/TimelineItemView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/TimelineItemView.vue +131 -0
- package/dist/runtime/extensions/views/TimelineItemView.vue.d.ts +4 -0
- package/dist/runtime/extensions/views/TimelineView.d.vue.ts +9 -0
- package/dist/runtime/extensions/views/TimelineView.vue +29 -0
- package/dist/runtime/extensions/views/TimelineView.vue.d.ts +9 -0
- package/dist/runtime/locale.d.ts +2 -0
- package/dist/runtime/locale.js +2 -0
- package/dist/runtime/plugin-abracadabra.client.js +107 -6
- package/dist/runtime/plugin-registry.d.ts +11 -30
- package/dist/runtime/plugin-registry.js +2 -82
- package/dist/runtime/plugins/core.plugin.js +10 -4
- package/dist/runtime/server/api/_abracadabra/spaces.get.d.ts +1 -1
- package/dist/runtime/server/plugins/abracadabra-service.js +28 -0
- package/dist/runtime/server/utils/docCache.js +24 -3
- package/dist/runtime/server/utils/schemaServerSupport.d.ts +52 -0
- package/dist/runtime/server/utils/schemaServerSupport.js +51 -0
- package/dist/runtime/types.d.ts +63 -46
- package/dist/runtime/utils/docTypes.d.ts +15 -0
- package/dist/runtime/utils/docTypes.js +20 -0
- package/dist/runtime/utils/loadCodeMirror.d.ts +32 -0
- package/dist/runtime/utils/loadCodeMirror.js +65 -0
- package/dist/runtime/utils/markdownToYjs.d.ts +1 -23
- package/dist/runtime/utils/markdownToYjs.js +5 -440
- package/dist/runtime/utils/schemaSupport.d.ts +60 -0
- package/dist/runtime/utils/schemaSupport.js +40 -0
- package/dist/runtime/utils/yjsConvert.d.ts +1 -14
- package/dist/runtime/utils/yjsConvert.js +5 -331
- package/package.json +84 -23
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, onMounted, ref, watch } from "vue";
|
|
3
|
+
import { useRuntimeConfig, useToast } from "#imports";
|
|
4
|
+
import { usePluginCatalog } from "../../composables/usePluginCatalog";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
id: { type: String, required: true },
|
|
7
|
+
serverUrl: { type: String, required: false }
|
|
8
|
+
});
|
|
9
|
+
const emit = defineEmits(["back", "installed"]);
|
|
10
|
+
const registry = usePluginCatalog();
|
|
11
|
+
const detail = ref(null);
|
|
12
|
+
const latest = ref(null);
|
|
13
|
+
const isLoading = ref(false);
|
|
14
|
+
const error = ref(null);
|
|
15
|
+
const showDialog = ref(false);
|
|
16
|
+
const toast = useToast();
|
|
17
|
+
const installed = computed(() => registry.isInstalled(props.id));
|
|
18
|
+
const decision = computed(() => registry.policyDecisionFor(props.id));
|
|
19
|
+
const cfg = useRuntimeConfig();
|
|
20
|
+
const resolvedServerUrl = computed(() => {
|
|
21
|
+
if (props.serverUrl) return props.serverUrl;
|
|
22
|
+
const moduleUrl = cfg.public.abracadabra?.url;
|
|
23
|
+
const flatUrl = cfg.public.abracadabraUrl;
|
|
24
|
+
return moduleUrl ?? flatUrl ?? null;
|
|
25
|
+
});
|
|
26
|
+
async function load() {
|
|
27
|
+
isLoading.value = true;
|
|
28
|
+
error.value = null;
|
|
29
|
+
try {
|
|
30
|
+
const [d, l] = await Promise.all([
|
|
31
|
+
registry.get(props.id),
|
|
32
|
+
registry.getLatest(props.id)
|
|
33
|
+
]);
|
|
34
|
+
detail.value = d;
|
|
35
|
+
latest.value = l;
|
|
36
|
+
} catch (e) {
|
|
37
|
+
error.value = e instanceof Error ? e : new Error(String(e));
|
|
38
|
+
} finally {
|
|
39
|
+
isLoading.value = false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function startInstall() {
|
|
43
|
+
if (!latest.value) return;
|
|
44
|
+
showDialog.value = true;
|
|
45
|
+
}
|
|
46
|
+
async function confirmInstall(d) {
|
|
47
|
+
try {
|
|
48
|
+
await registry.install(d.plugin_id);
|
|
49
|
+
toast.add({
|
|
50
|
+
title: `${d.manifest.name ?? d.plugin_id} installed`,
|
|
51
|
+
description: `v${d.version}`,
|
|
52
|
+
color: "success"
|
|
53
|
+
});
|
|
54
|
+
emit("installed", d);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
toast.add({ title: "Install failed", description: e.message, color: "error" });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async function refreshPolicy() {
|
|
60
|
+
if (!resolvedServerUrl.value) return;
|
|
61
|
+
try {
|
|
62
|
+
await registry.loadPolicy(resolvedServerUrl.value);
|
|
63
|
+
} catch {
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
onMounted(() => {
|
|
67
|
+
load();
|
|
68
|
+
refreshPolicy();
|
|
69
|
+
});
|
|
70
|
+
watch(() => props.id, load);
|
|
71
|
+
watch(resolvedServerUrl, refreshPolicy);
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<template>
|
|
75
|
+
<div class="flex h-full flex-col gap-4">
|
|
76
|
+
<div class="flex items-center gap-2">
|
|
77
|
+
<UButton
|
|
78
|
+
variant="ghost"
|
|
79
|
+
color="neutral"
|
|
80
|
+
icon="i-lucide-arrow-left"
|
|
81
|
+
size="sm"
|
|
82
|
+
@click="emit('back')"
|
|
83
|
+
/>
|
|
84
|
+
<h2 class="truncate text-lg font-semibold text-highlighted">
|
|
85
|
+
{{ detail?.plugin.name ?? id }}
|
|
86
|
+
</h2>
|
|
87
|
+
<UBadge v-if="installed" color="success" variant="subtle" size="sm" icon="i-lucide-check" label="Installed" />
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<div v-if="isLoading" class="flex flex-1 items-center justify-center text-sm text-muted">
|
|
91
|
+
Loading…
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<div v-else-if="error" class="flex flex-1 flex-col items-center justify-center gap-2 text-center">
|
|
95
|
+
<UIcon name="i-lucide-alert-circle" class="text-2xl text-error" />
|
|
96
|
+
<p class="text-sm text-error">
|
|
97
|
+
{{ error.message }}
|
|
98
|
+
</p>
|
|
99
|
+
<UButton size="sm" variant="soft" label="Retry" @click="load" />
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
<div v-else-if="detail && latest" class="flex flex-1 flex-col gap-4 overflow-auto">
|
|
103
|
+
<div class="rounded-lg border border-default bg-default p-4">
|
|
104
|
+
<p class="font-mono text-xs text-muted">
|
|
105
|
+
{{ detail.plugin.id }} · v{{ latest.version }} · by {{ detail.plugin.owner_login ?? "\u2014" }}
|
|
106
|
+
</p>
|
|
107
|
+
<p class="mt-2 text-sm text-default">
|
|
108
|
+
{{ detail.plugin.description }}
|
|
109
|
+
</p>
|
|
110
|
+
<div class="mt-3 flex flex-wrap items-center gap-1.5">
|
|
111
|
+
<UBadge
|
|
112
|
+
v-for="cat in detail.plugin.categories"
|
|
113
|
+
:key="cat"
|
|
114
|
+
size="xs"
|
|
115
|
+
variant="outline"
|
|
116
|
+
color="neutral"
|
|
117
|
+
>
|
|
118
|
+
{{ cat }}
|
|
119
|
+
</UBadge>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<section>
|
|
124
|
+
<h3 class="mb-2 text-sm font-semibold text-highlighted">
|
|
125
|
+
Capabilities
|
|
126
|
+
</h3>
|
|
127
|
+
<div class="flex flex-wrap gap-1.5">
|
|
128
|
+
<UBadge
|
|
129
|
+
v-for="cap in latest.manifest.capabilities.required"
|
|
130
|
+
:key="`req-${cap}`"
|
|
131
|
+
size="sm"
|
|
132
|
+
color="primary"
|
|
133
|
+
variant="subtle"
|
|
134
|
+
>
|
|
135
|
+
{{ cap }}
|
|
136
|
+
</UBadge>
|
|
137
|
+
<UBadge
|
|
138
|
+
v-for="cap in latest.manifest.capabilities.optional ?? []"
|
|
139
|
+
:key="`opt-${cap}`"
|
|
140
|
+
size="sm"
|
|
141
|
+
color="neutral"
|
|
142
|
+
variant="outline"
|
|
143
|
+
>
|
|
144
|
+
{{ cap }}
|
|
145
|
+
</UBadge>
|
|
146
|
+
</div>
|
|
147
|
+
</section>
|
|
148
|
+
|
|
149
|
+
<section v-if="latest.manifest.contributes">
|
|
150
|
+
<h3 class="mb-2 text-sm font-semibold text-highlighted">
|
|
151
|
+
Contributes
|
|
152
|
+
</h3>
|
|
153
|
+
<dl class="space-y-1 text-sm">
|
|
154
|
+
<template
|
|
155
|
+
v-for="(items, field) in latest.manifest.contributes"
|
|
156
|
+
:key="field"
|
|
157
|
+
>
|
|
158
|
+
<div v-if="items && items.length > 0" class="flex gap-2">
|
|
159
|
+
<dt class="w-32 shrink-0 text-muted">
|
|
160
|
+
{{ field }}
|
|
161
|
+
</dt>
|
|
162
|
+
<dd class="flex flex-wrap gap-1">
|
|
163
|
+
<code
|
|
164
|
+
v-for="item in items"
|
|
165
|
+
:key="item"
|
|
166
|
+
class="rounded bg-elevated px-1.5 py-0.5 font-mono text-xs"
|
|
167
|
+
>{{ item }}</code>
|
|
168
|
+
</dd>
|
|
169
|
+
</div>
|
|
170
|
+
</template>
|
|
171
|
+
</dl>
|
|
172
|
+
</section>
|
|
173
|
+
|
|
174
|
+
<section>
|
|
175
|
+
<h3 class="mb-2 text-sm font-semibold text-highlighted">
|
|
176
|
+
Versions
|
|
177
|
+
</h3>
|
|
178
|
+
<ul class="divide-y divide-default rounded-md border border-default">
|
|
179
|
+
<li
|
|
180
|
+
v-for="v in detail.versions"
|
|
181
|
+
:key="v.version"
|
|
182
|
+
class="flex items-center justify-between gap-2 px-3 py-2 text-sm"
|
|
183
|
+
>
|
|
184
|
+
<span class="font-mono">v{{ v.version }}</span>
|
|
185
|
+
<span class="font-mono text-xs text-muted">{{ v.integrity.slice(0, 16) }}…</span>
|
|
186
|
+
<UBadge
|
|
187
|
+
size="xs"
|
|
188
|
+
variant="subtle"
|
|
189
|
+
:color="v.status === 'live' ? 'success' : v.status === 'rejected' ? 'error' : 'neutral'"
|
|
190
|
+
>
|
|
191
|
+
{{ v.status }}
|
|
192
|
+
</UBadge>
|
|
193
|
+
<span class="text-xs text-muted">
|
|
194
|
+
{{ new Date(v.submitted_at).toLocaleDateString() }}
|
|
195
|
+
</span>
|
|
196
|
+
</li>
|
|
197
|
+
</ul>
|
|
198
|
+
</section>
|
|
199
|
+
|
|
200
|
+
<div class="sticky bottom-0 flex items-center justify-end gap-2 border-t border-default bg-default py-3">
|
|
201
|
+
<UButton
|
|
202
|
+
v-if="detail.plugin.repository"
|
|
203
|
+
variant="ghost"
|
|
204
|
+
color="neutral"
|
|
205
|
+
icon="i-lucide-external-link"
|
|
206
|
+
label="Repository"
|
|
207
|
+
:to="resolveRepoUrl(detail.plugin.repository)"
|
|
208
|
+
target="_blank"
|
|
209
|
+
/>
|
|
210
|
+
<UButton
|
|
211
|
+
v-if="installed"
|
|
212
|
+
variant="soft"
|
|
213
|
+
color="success"
|
|
214
|
+
icon="i-lucide-check"
|
|
215
|
+
label="Installed"
|
|
216
|
+
disabled
|
|
217
|
+
/>
|
|
218
|
+
<UBadge
|
|
219
|
+
v-else-if="decision.state === 'blocked'"
|
|
220
|
+
color="warning"
|
|
221
|
+
variant="subtle"
|
|
222
|
+
size="md"
|
|
223
|
+
icon="i-lucide-shield-alert"
|
|
224
|
+
:title="decision.reason"
|
|
225
|
+
:label="`Not allowed by your server`"
|
|
226
|
+
/>
|
|
227
|
+
<UButton
|
|
228
|
+
v-else
|
|
229
|
+
:color="decision.state === 'allowed' ? 'success' : 'primary'"
|
|
230
|
+
:icon="decision.state === 'allowed' ? 'i-lucide-shield-check' : 'i-lucide-download'"
|
|
231
|
+
:label="decision.state === 'allowed' ? `Approved \u2014 install v${latest.version}` : `Install v${latest.version}`"
|
|
232
|
+
@click="startInstall"
|
|
233
|
+
/>
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
|
|
237
|
+
<APluginCapabilityDialog
|
|
238
|
+
v-model="showDialog"
|
|
239
|
+
:detail="latest"
|
|
240
|
+
@confirm="confirmInstall"
|
|
241
|
+
/>
|
|
242
|
+
</div>
|
|
243
|
+
</template>
|
|
244
|
+
|
|
245
|
+
<script>
|
|
246
|
+
function resolveRepoUrl(repo) {
|
|
247
|
+
if (repo.startsWith("github:")) {
|
|
248
|
+
return `https://github.com/${repo.slice("github:".length)}`;
|
|
249
|
+
}
|
|
250
|
+
return repo;
|
|
251
|
+
}
|
|
252
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type CatalogVersionDetail } from '../../composables/usePluginCatalog.js';
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<{
|
|
5
|
+
id: string;
|
|
6
|
+
/** See `<APluginBrowser>` — same fallback chain. */
|
|
7
|
+
serverUrl?: string;
|
|
8
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
|
+
installed: (detail: CatalogVersionDetail) => any;
|
|
10
|
+
back: () => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
12
|
+
id: string;
|
|
13
|
+
/** See `<APluginBrowser>` — same fallback chain. */
|
|
14
|
+
serverUrl?: string;
|
|
15
|
+
}> & Readonly<{
|
|
16
|
+
onInstalled?: ((detail: CatalogVersionDetail) => any) | undefined;
|
|
17
|
+
onBack?: (() => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RendererBaseProps } from '../../composables/useRendererBase.js';
|
|
2
|
+
type __VLS_Props = RendererBaseProps & {
|
|
3
|
+
editable?: boolean;
|
|
4
|
+
/** Optional initial meta hint — page-types pass `docMeta` through; we read `language`. */
|
|
5
|
+
docMeta?: Record<string, unknown>;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
updateMeta: (patch: Record<string, unknown>) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
onUpdateMeta?: ((patch: Record<string, unknown>) => any) | undefined;
|
|
11
|
+
}>, {
|
|
12
|
+
editable: boolean;
|
|
13
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref, watch } from "vue";
|
|
3
|
+
import { useRendererBase } from "../../composables/useRendererBase";
|
|
4
|
+
import ACodeEditor from "../ACodeEditor.vue";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
docId: { type: String, required: true },
|
|
7
|
+
childProvider: { type: null, required: true },
|
|
8
|
+
docLabel: { type: String, required: true },
|
|
9
|
+
pageTypes: { type: Array, required: false },
|
|
10
|
+
editable: { type: Boolean, required: false, default: true },
|
|
11
|
+
docMeta: { type: Object, required: false }
|
|
12
|
+
});
|
|
13
|
+
const emit = defineEmits(["updateMeta"]);
|
|
14
|
+
const { childProviderRef, connectedUsers } = useRendererBase(props);
|
|
15
|
+
const LANGUAGES = ["javascript", "typescript", "tsx", "jsx", "css", "vue", "json", "markdown", "plain"];
|
|
16
|
+
const language = ref(props.docMeta?.language ?? "javascript");
|
|
17
|
+
watch(() => props.docMeta?.language, (next) => {
|
|
18
|
+
const lang = next;
|
|
19
|
+
if (lang && LANGUAGES.includes(lang) && lang !== language.value) language.value = lang;
|
|
20
|
+
});
|
|
21
|
+
function selectLanguage(lang) {
|
|
22
|
+
if (lang === language.value) return;
|
|
23
|
+
language.value = lang;
|
|
24
|
+
if (props.editable) emit("updateMeta", { language: lang });
|
|
25
|
+
}
|
|
26
|
+
const languageItems = computed(() => LANGUAGES.map((l) => ({
|
|
27
|
+
label: l,
|
|
28
|
+
onSelect: () => selectLanguage(l)
|
|
29
|
+
})));
|
|
30
|
+
const _peers = computed(() => connectedUsers.value);
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<div class="acoder">
|
|
35
|
+
<!-- Header strip: language picker + presence facepile -->
|
|
36
|
+
<div class="acoder__header">
|
|
37
|
+
<div class="acoder__heading">
|
|
38
|
+
<UIcon name="i-lucide-code-2" class="size-3.5 text-(--ui-text-muted)" />
|
|
39
|
+
<span class="acoder__label">{{ docLabel || "Untitled" }}</span>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div class="acoder__tools">
|
|
43
|
+
<UDropdownMenu :items="languageItems" :content="{ side: 'bottom', align: 'end' }">
|
|
44
|
+
<UButton
|
|
45
|
+
size="xs"
|
|
46
|
+
variant="ghost"
|
|
47
|
+
color="neutral"
|
|
48
|
+
:label="language"
|
|
49
|
+
trailing-icon="i-lucide-chevron-down"
|
|
50
|
+
:disabled="!editable"
|
|
51
|
+
/>
|
|
52
|
+
</UDropdownMenu>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<!-- Editor -->
|
|
57
|
+
<ACodeEditor
|
|
58
|
+
:provider="childProviderRef"
|
|
59
|
+
field-name="code"
|
|
60
|
+
:language="language"
|
|
61
|
+
:read-only="!editable"
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<style scoped>
|
|
67
|
+
.acoder{display:flex;flex:1 1 0;flex-direction:column;min-height:0;overflow:hidden}.acoder__header{align-items:center;background:var(--ui-bg);border-bottom:1px solid var(--ui-border);display:flex;flex-shrink:0;justify-content:space-between;padding:.375rem .75rem}.acoder__heading{align-items:center;display:flex;gap:.5rem;min-width:0}.acoder__label{color:var(--ui-text-highlighted);font-size:.75rem;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.acoder__tools{align-items:center;display:flex;gap:.25rem}
|
|
68
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RendererBaseProps } from '../../composables/useRendererBase.js';
|
|
2
|
+
type __VLS_Props = RendererBaseProps & {
|
|
3
|
+
editable?: boolean;
|
|
4
|
+
/** Optional initial meta hint — page-types pass `docMeta` through; we read `language`. */
|
|
5
|
+
docMeta?: Record<string, unknown>;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
updateMeta: (patch: Record<string, unknown>) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
onUpdateMeta?: ((patch: Record<string, unknown>) => any) | undefined;
|
|
11
|
+
}>, {
|
|
12
|
+
editable: boolean;
|
|
13
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|