@abraca/nuxt 2.52.0 → 2.54.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.json +1 -1
- package/dist/runtime/components/ADocRenderer.vue +6 -3
- package/dist/runtime/components/ADocSubPageList.vue +1 -0
- package/dist/runtime/components/ADocumentTree.vue +1 -0
- package/dist/runtime/components/AEditor.d.vue.ts +10 -10
- package/dist/runtime/components/AEditor.vue +246 -235
- package/dist/runtime/components/AEditor.vue.d.ts +10 -10
- package/dist/runtime/components/ANodePanel.d.vue.ts +10 -0
- package/dist/runtime/components/ANodePanel.vue +40 -12
- package/dist/runtime/components/ANodePanel.vue.d.ts +10 -0
- package/dist/runtime/components/ANodeSettingsPanel.d.vue.ts +8 -0
- package/dist/runtime/components/ANodeSettingsPanel.vue +22 -8
- package/dist/runtime/components/ANodeSettingsPanel.vue.d.ts +8 -0
- package/dist/runtime/components/aware/APresenceBlobs.vue +9 -2
- package/dist/runtime/components/renderers/ACalendarRenderer.vue +1 -0
- package/dist/runtime/components/renderers/AChartRenderer.client.vue +1 -0
- package/dist/runtime/components/renderers/AChecklistRenderer.vue +1 -0
- package/dist/runtime/components/renderers/ADashboardRenderer.vue +1 -0
- package/dist/runtime/components/renderers/AGalleryRenderer.vue +1 -0
- package/dist/runtime/components/renderers/AGraphRenderer.vue +1 -0
- package/dist/runtime/components/renderers/AKanbanRenderer.vue +1 -0
- package/dist/runtime/components/renderers/AMapRenderer.vue +1 -0
- package/dist/runtime/components/renderers/AMediaRenderer.vue +1 -0
- package/dist/runtime/components/renderers/AOutlineRenderer.vue +1 -0
- package/dist/runtime/components/renderers/AOverviewRenderer.vue +1 -0
- package/dist/runtime/components/renderers/ASheetsRenderer.client.vue +1 -0
- package/dist/runtime/components/renderers/ASlidesRenderer.vue +1 -0
- package/dist/runtime/components/renderers/ATableRenderer.vue +1 -0
- package/dist/runtime/components/renderers/ATimelineRenderer.vue +1 -0
- package/dist/runtime/components/shell/ADocPanelSettings.d.vue.ts +8 -0
- package/dist/runtime/components/shell/ADocPanelSettings.vue +5 -2
- package/dist/runtime/components/shell/ADocPanelSettings.vue.d.ts +8 -0
- package/dist/runtime/components/shell/AUserMenu.d.vue.ts +2 -2
- package/dist/runtime/components/shell/AUserMenu.vue.d.ts +2 -2
- package/dist/runtime/composables/useNodePanel.d.ts +11 -4
- package/dist/runtime/composables/useNodePanel.js +2 -17
- package/dist/runtime/composables/useProviderRole.d.ts +17 -0
- package/dist/runtime/composables/useProviderRole.js +22 -0
- package/dist/runtime/composables/useYDoc.js +27 -5
- package/dist/runtime/extensions/views/DocLinkView.vue +5 -4
- package/dist/runtime/extensions/views/DocumentMetaView.vue +50 -0
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { shallowRef, watch, onScopeDispose, toValue } from "vue";
|
|
2
|
+
export function useProviderRole(provider) {
|
|
3
|
+
const role = shallowRef(null);
|
|
4
|
+
let attached = null;
|
|
5
|
+
const onRoleChanged = ({ role: next }) => {
|
|
6
|
+
role.value = next ?? null;
|
|
7
|
+
};
|
|
8
|
+
const detach = () => {
|
|
9
|
+
attached?.off?.("roleChanged", onRoleChanged);
|
|
10
|
+
attached = null;
|
|
11
|
+
};
|
|
12
|
+
watch(() => toValue(provider), (p) => {
|
|
13
|
+
detach();
|
|
14
|
+
role.value = p?.effectiveRole ?? null;
|
|
15
|
+
if (p?.on) {
|
|
16
|
+
attached = p;
|
|
17
|
+
p.on("roleChanged", onRoleChanged);
|
|
18
|
+
}
|
|
19
|
+
}, { immediate: true });
|
|
20
|
+
onScopeDispose(detach);
|
|
21
|
+
return role;
|
|
22
|
+
}
|
|
@@ -193,33 +193,55 @@ export function useSmoothedCursors(provider, posKey = "pos", lerpFactor = 0.3) {
|
|
|
193
193
|
const { states, setLocalState } = useAwarenessOf(provider);
|
|
194
194
|
const localId = computed(() => provider.value?.awareness?.clientID ?? 0);
|
|
195
195
|
const cursors = ref([]);
|
|
196
|
-
|
|
196
|
+
const byId = /* @__PURE__ */ new Map();
|
|
197
|
+
let frame = 0;
|
|
198
|
+
let running = false;
|
|
197
199
|
const EPS_SQ = 25e-4;
|
|
198
200
|
const tick = () => {
|
|
199
201
|
const activeIds = /* @__PURE__ */ new Set();
|
|
202
|
+
let unsettled = false;
|
|
200
203
|
for (const s of states.value) {
|
|
201
204
|
if (s.clientId === localId.value) continue;
|
|
202
205
|
const pos = s[posKey];
|
|
203
206
|
if (pos == null) continue;
|
|
204
207
|
activeIds.add(s.clientId);
|
|
205
|
-
const entry =
|
|
208
|
+
const entry = byId.get(s.clientId);
|
|
206
209
|
if (!entry) {
|
|
207
210
|
cursors.value.push({ clientId: s.clientId, x: pos.x, y: pos.y, state: s });
|
|
211
|
+
byId.set(s.clientId, cursors.value[cursors.value.length - 1]);
|
|
208
212
|
continue;
|
|
209
213
|
}
|
|
210
214
|
const dx = pos.x - entry.x;
|
|
211
215
|
const dy = pos.y - entry.y;
|
|
212
|
-
if (dx * dx + dy * dy < EPS_SQ
|
|
216
|
+
if (dx * dx + dy * dy < EPS_SQ) {
|
|
217
|
+
if (entry.state !== s) entry.state = s;
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
unsettled = true;
|
|
213
221
|
entry.x += dx * lerpFactor;
|
|
214
222
|
entry.y += dy * lerpFactor;
|
|
215
223
|
entry.state = s;
|
|
216
224
|
}
|
|
217
225
|
for (let i = cursors.value.length - 1; i >= 0; i--) {
|
|
218
|
-
|
|
226
|
+
const id = cursors.value[i].clientId;
|
|
227
|
+
if (!activeIds.has(id)) {
|
|
228
|
+
cursors.value.splice(i, 1);
|
|
229
|
+
byId.delete(id);
|
|
230
|
+
}
|
|
219
231
|
}
|
|
232
|
+
if (!unsettled) {
|
|
233
|
+
running = false;
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
frame = requestAnimationFrame(tick);
|
|
237
|
+
};
|
|
238
|
+
const wake = () => {
|
|
239
|
+
if (running) return;
|
|
240
|
+
running = true;
|
|
220
241
|
frame = requestAnimationFrame(tick);
|
|
221
242
|
};
|
|
222
|
-
onMounted(
|
|
243
|
+
onMounted(wake);
|
|
244
|
+
watch(states, wake);
|
|
223
245
|
onBeforeUnmount(() => cancelAnimationFrame(frame));
|
|
224
246
|
return { cursors, states, setLocalState };
|
|
225
247
|
}
|
|
@@ -8,7 +8,7 @@ import { useFavorites } from "../../composables/useFavorites";
|
|
|
8
8
|
import { useWindowManager } from "../../composables/useWindowManager";
|
|
9
9
|
import { useNodePanel } from "../../composables/useNodePanel";
|
|
10
10
|
import { useNodeContextMenu } from "../../composables/useNodeContextMenu";
|
|
11
|
-
import {
|
|
11
|
+
import { useNodeViewEditable } from "../../composables/useNodeView";
|
|
12
12
|
import { useDocSlugs } from "../../composables/useDocSlugs";
|
|
13
13
|
import { resolveDocType } from "../../utils/docTypes";
|
|
14
14
|
import ANodeContextMenu from "../../components/shell/ANodeContextMenu.vue";
|
|
@@ -27,15 +27,15 @@ const props = defineProps({
|
|
|
27
27
|
extension: { type: Object, required: true },
|
|
28
28
|
HTMLAttributes: { type: Object, required: true }
|
|
29
29
|
});
|
|
30
|
-
const { doc: rootDoc, provider, registry, isReady
|
|
30
|
+
const { doc: rootDoc, provider, registry, isReady } = useAbracadabra();
|
|
31
31
|
const { getDocUrl } = useDocSlugs();
|
|
32
32
|
const docId = computed(() => props.node.attrs.docId);
|
|
33
33
|
const tree = useChildTree(rootDoc, docId.value);
|
|
34
34
|
const { treeMap } = tree;
|
|
35
35
|
const { isFavorite, toggleFavorite } = useFavorites(rootDoc);
|
|
36
36
|
const { floatWindowsAvailable } = useWindowManager();
|
|
37
|
-
const
|
|
38
|
-
const canWrite =
|
|
37
|
+
const hostEditable = useNodeViewEditable(props);
|
|
38
|
+
const canWrite = hostEditable;
|
|
39
39
|
const treeEntry = computed(() => treeMap.data[docId.value]);
|
|
40
40
|
const exists = computed(() => !!treeEntry.value);
|
|
41
41
|
const docType = computed(() => resolveDocType(treeEntry.value?.type, registry));
|
|
@@ -152,6 +152,7 @@ const menuItems = computed(() => useNodeContextMenu({
|
|
|
152
152
|
:node-label="openNodeLabel"
|
|
153
153
|
:child-provider="openNodeProvider"
|
|
154
154
|
:doc-type="treeMap.data[openNodeId]?.type"
|
|
155
|
+
:editable="hostEditable"
|
|
155
156
|
@close="closePanel"
|
|
156
157
|
/>
|
|
157
158
|
|
|
@@ -21,6 +21,35 @@ const items = computed(() => {
|
|
|
21
21
|
void props.node.content.size;
|
|
22
22
|
return buildMetaMenuItems(props.editor);
|
|
23
23
|
});
|
|
24
|
+
const pageMeta = computed(
|
|
25
|
+
() => props.editor.storage?.metaField?.pageMeta ?? null
|
|
26
|
+
);
|
|
27
|
+
const fallbackChips = computed(() => {
|
|
28
|
+
if (editable.value || props.node.childCount > 0) return [];
|
|
29
|
+
const m = pageMeta.value;
|
|
30
|
+
if (!m) return [];
|
|
31
|
+
const chips = [];
|
|
32
|
+
if (m.status && m.status !== "none") chips.push({ icon: "i-lucide-circle-dot", label: String(m.status) });
|
|
33
|
+
if (typeof m.priority === "number" && m.priority > 0) chips.push({ icon: "i-lucide-flag", label: `P${m.priority}` });
|
|
34
|
+
if (typeof m.rating === "number" && m.rating > 0) chips.push({ icon: "i-lucide-star", label: `${m.rating}/5` });
|
|
35
|
+
if (m.dateStart || m.dateEnd) chips.push({ icon: "i-lucide-calendar", label: [m.dateStart, m.dateEnd].filter(Boolean).join(" \u2192 ") });
|
|
36
|
+
if (Array.isArray(m.members)) {
|
|
37
|
+
for (const mem of m.members) {
|
|
38
|
+
if (mem?.label) chips.push({ icon: "i-lucide-user", label: mem.label });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (Array.isArray(m.tags)) {
|
|
42
|
+
for (const t of m.tags) chips.push({ icon: "i-lucide-tag", label: t });
|
|
43
|
+
}
|
|
44
|
+
if (m.url) chips.push({ icon: "i-lucide-link", label: String(m.url) });
|
|
45
|
+
if (m.email) chips.push({ icon: "i-lucide-mail", label: String(m.email) });
|
|
46
|
+
if (m.phone) chips.push({ icon: "i-lucide-phone", label: String(m.phone) });
|
|
47
|
+
if (typeof m.number === "number") chips.push({ icon: "i-lucide-hash", label: `${m.number}${m.unit ? ` ${m.unit}` : ""}` });
|
|
48
|
+
return chips;
|
|
49
|
+
});
|
|
50
|
+
const hiddenWhenEmpty = computed(
|
|
51
|
+
() => !editable.value && props.node.childCount === 0 && fallbackChips.value.length === 0
|
|
52
|
+
);
|
|
24
53
|
function placeCursorInMeta(event) {
|
|
25
54
|
const target = event.target;
|
|
26
55
|
if (!target) return;
|
|
@@ -56,6 +85,7 @@ function placeCursorInMeta(event) {
|
|
|
56
85
|
as="div"
|
|
57
86
|
data-type="document-meta"
|
|
58
87
|
class="group/meta"
|
|
88
|
+
:class="{ 'meta-hidden': hiddenWhenEmpty }"
|
|
59
89
|
draggable="false"
|
|
60
90
|
@mousedown="placeCursorInMeta"
|
|
61
91
|
@dragstart.prevent.stop
|
|
@@ -68,6 +98,22 @@ function placeCursorInMeta(event) {
|
|
|
68
98
|
class="meta-content"
|
|
69
99
|
style="display: contents"
|
|
70
100
|
/>
|
|
101
|
+
<!-- Read-only fallback: static chips from the doc-tree meta when no
|
|
102
|
+
metaField chips were ever materialized in the content. -->
|
|
103
|
+
<template v-if="!editable && props.node.childCount === 0">
|
|
104
|
+
<UBadge
|
|
105
|
+
v-for="(chip, i) in fallbackChips"
|
|
106
|
+
:key="`${chip.icon}-${chip.label}-${i}`"
|
|
107
|
+
:icon="chip.icon"
|
|
108
|
+
color="neutral"
|
|
109
|
+
variant="soft"
|
|
110
|
+
size="sm"
|
|
111
|
+
class="rounded-full"
|
|
112
|
+
contenteditable="false"
|
|
113
|
+
>
|
|
114
|
+
{{ chip.label }}
|
|
115
|
+
</UBadge>
|
|
116
|
+
</template>
|
|
71
117
|
<span
|
|
72
118
|
v-show="editable"
|
|
73
119
|
contenteditable="false"
|
|
@@ -89,3 +135,7 @@ function placeCursorInMeta(event) {
|
|
|
89
135
|
</span>
|
|
90
136
|
</NodeViewWrapper>
|
|
91
137
|
</template>
|
|
138
|
+
|
|
139
|
+
<style scoped>
|
|
140
|
+
.meta-hidden{display:none!important}
|
|
141
|
+
</style>
|