@abraca/nuxt 1.6.0 → 1.8.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 +6 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +16 -2
- package/dist/runtime/assets/sources.css +1 -0
- package/dist/runtime/components/ADocumentTree.d.vue.ts +11 -1
- package/dist/runtime/components/ADocumentTree.vue +13 -6
- package/dist/runtime/components/ADocumentTree.vue.d.ts +11 -1
- package/dist/runtime/components/renderers/AChecklistRenderer.vue +22 -4
- package/dist/runtime/components/renderers/ADashboardRenderer.vue +4 -2
- package/dist/runtime/components/renderers/AGalleryRenderer.vue +97 -70
- package/dist/runtime/components/renderers/AGraphRenderer.vue +209 -58
- package/dist/runtime/components/renderers/AKanbanRenderer.vue +145 -34
- package/dist/runtime/components/renderers/AMediaRenderer.vue +27 -17
- package/dist/runtime/components/renderers/AOutlineRenderer.vue +38 -23
- package/dist/runtime/components/renderers/ASlidesRenderer.d.vue.ts +21 -0
- package/dist/runtime/components/renderers/ASlidesRenderer.vue +591 -0
- package/dist/runtime/components/renderers/ASlidesRenderer.vue.d.ts +21 -0
- package/dist/runtime/components/renderers/ASpatialRenderer.vue +23 -0
- package/dist/runtime/components/renderers/ATableRenderer.vue +20 -391
- package/dist/runtime/components/renderers/gallery/AGalleryItemCard.d.vue.ts +40 -0
- package/dist/runtime/components/renderers/gallery/AGalleryItemCard.vue +227 -0
- package/dist/runtime/components/renderers/gallery/AGalleryItemCard.vue.d.ts +40 -0
- package/dist/runtime/components/renderers/spatial/SpatialTransformInputs.d.vue.ts +16 -0
- package/dist/runtime/components/renderers/spatial/SpatialTransformInputs.vue +66 -0
- package/dist/runtime/components/renderers/spatial/SpatialTransformInputs.vue.d.ts +16 -0
- package/dist/runtime/components/renderers/table/ATableFlatMode.d.vue.ts +2 -0
- package/dist/runtime/components/renderers/table/ATableFlatMode.vue +184 -21
- package/dist/runtime/components/renderers/table/ATableFlatMode.vue.d.ts +2 -0
- package/dist/runtime/components/renderers/table/ATableHierarchyMode.d.vue.ts +26 -0
- package/dist/runtime/components/renderers/table/ATableHierarchyMode.vue +662 -0
- package/dist/runtime/components/renderers/table/ATableHierarchyMode.vue.d.ts +26 -0
- package/dist/runtime/composables/useAwareness.js +14 -3
- package/dist/runtime/composables/useBackgroundSync.js +19 -1
- package/dist/runtime/composables/useFileIndex.js +38 -17
- package/dist/runtime/composables/useSearchIndex.js +41 -16
- package/dist/runtime/composables/useSlidesNavigation.d.ts +45 -0
- package/dist/runtime/composables/useSlidesNavigation.js +185 -0
- package/dist/runtime/composables/useYDoc.d.ts +1 -1
- package/dist/runtime/composables/useYDoc.js +47 -9
- package/dist/runtime/locale.d.ts +38 -0
- package/dist/runtime/locale.js +41 -3
- package/dist/runtime/utils/docTypes.js +17 -0
- package/package.json +3 -3
|
@@ -286,24 +286,33 @@ defineExpose({ connectedUsers });
|
|
|
286
286
|
{{ item.label || locale.empty }}
|
|
287
287
|
</span>
|
|
288
288
|
|
|
289
|
-
<!-- Hover actions -->
|
|
289
|
+
<!-- Hover actions — absolute-positioned to avoid layout shift -->
|
|
290
290
|
<div
|
|
291
291
|
v-if="editable"
|
|
292
|
-
class="
|
|
292
|
+
class="outline-row-actions opacity-0 group-hover:opacity-100 absolute right-1 top-1/2 -translate-y-1/2 flex items-center gap-0.5 bg-(--ui-bg-elevated) rounded-(--ui-radius) px-0.5 transition-opacity"
|
|
293
293
|
>
|
|
294
|
-
<
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
294
|
+
<UTooltip
|
|
295
|
+
:text="locale.openAsSlideover"
|
|
296
|
+
:content="{ side: 'bottom' }"
|
|
297
|
+
>
|
|
298
|
+
<UButton
|
|
299
|
+
icon="i-lucide-external-link"
|
|
300
|
+
size="xs"
|
|
301
|
+
variant="ghost"
|
|
302
|
+
color="neutral"
|
|
303
|
+
@click.stop="openNode(item.id, item.label)"
|
|
304
|
+
/>
|
|
305
|
+
</UTooltip>
|
|
306
|
+
<UTooltip
|
|
307
|
+
:text="locale.addChild"
|
|
308
|
+
:content="{ side: 'bottom' }"
|
|
309
|
+
>
|
|
310
|
+
<UButton
|
|
311
|
+
icon="i-lucide-plus"
|
|
312
|
+
size="xs"
|
|
313
|
+
variant="ghost"
|
|
314
|
+
color="neutral"
|
|
315
|
+
@click.stop="() => {
|
|
307
316
|
const id = tree.createChild(item.id, '');
|
|
308
317
|
nextTick(() => {
|
|
309
318
|
editingId = id;
|
|
@@ -311,14 +320,20 @@ defineExpose({ connectedUsers });
|
|
|
311
320
|
nextTick(() => inputRefs[id]?.focus());
|
|
312
321
|
});
|
|
313
322
|
}"
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
323
|
+
/>
|
|
324
|
+
</UTooltip>
|
|
325
|
+
<UTooltip
|
|
326
|
+
:text="locale.delete"
|
|
327
|
+
:content="{ side: 'bottom' }"
|
|
328
|
+
>
|
|
329
|
+
<UButton
|
|
330
|
+
icon="i-lucide-trash-2"
|
|
331
|
+
size="xs"
|
|
332
|
+
variant="ghost"
|
|
333
|
+
color="error"
|
|
334
|
+
@click.stop="tree.deleteEntry(item.id)"
|
|
335
|
+
/>
|
|
336
|
+
</UTooltip>
|
|
322
337
|
</div>
|
|
323
338
|
</div>
|
|
324
339
|
</UContextMenu>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type RendererBaseProps } from '../../composables/useRendererBase.js';
|
|
2
|
+
import type { AbracadabraLocale } from '../../locale.js';
|
|
3
|
+
type __VLS_Props = RendererBaseProps & {
|
|
4
|
+
labels?: Partial<AbracadabraLocale['renderers']['slides']>;
|
|
5
|
+
editable?: boolean;
|
|
6
|
+
followingUser?: string | null;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
9
|
+
connectedUsers: import("vue").ComputedRef<{
|
|
10
|
+
clientId: number;
|
|
11
|
+
name: string;
|
|
12
|
+
color: string;
|
|
13
|
+
avatar: string | undefined;
|
|
14
|
+
publicKey: any;
|
|
15
|
+
}[]>;
|
|
16
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
17
|
+
editable: boolean;
|
|
18
|
+
followingUser: string | null;
|
|
19
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed, watch, watchEffect, nextTick, shallowRef, markRaw, onMounted } from "vue";
|
|
3
|
+
import { useRuntimeConfig } from "#imports";
|
|
4
|
+
import { useRendererBase } from "../../composables/useRendererBase";
|
|
5
|
+
import { useNodePanel } from "../../composables/useNodePanel";
|
|
6
|
+
import { useNodePanelFollow } from "../../composables/useNodePanelFollow";
|
|
7
|
+
import { useSlidesNavigation } from "../../composables/useSlidesNavigation";
|
|
8
|
+
import { resolveDocType } from "../../utils/docTypes";
|
|
9
|
+
import { DEFAULT_LOCALE } from "../../locale";
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
docId: { type: String, required: true },
|
|
12
|
+
childProvider: { type: null, required: true },
|
|
13
|
+
docLabel: { type: String, required: true },
|
|
14
|
+
pageTypes: { type: Array, required: false },
|
|
15
|
+
labels: { type: Object, required: false },
|
|
16
|
+
editable: { type: Boolean, required: false, default: true },
|
|
17
|
+
followingUser: { type: [String, null], required: false, default: null }
|
|
18
|
+
});
|
|
19
|
+
const config = useRuntimeConfig();
|
|
20
|
+
const locale = computed(() => ({
|
|
21
|
+
...DEFAULT_LOCALE.renderers.slides,
|
|
22
|
+
...config.public?.abracadabra?.locale?.renderers?.slides ?? {},
|
|
23
|
+
...props.labels ?? {}
|
|
24
|
+
}));
|
|
25
|
+
const { tree, childProviderRef, states, setLocalState, connectedUsers } = useRendererBase(props);
|
|
26
|
+
const {
|
|
27
|
+
openNodeId,
|
|
28
|
+
openNodeLabel,
|
|
29
|
+
openNodeProvider,
|
|
30
|
+
openNode,
|
|
31
|
+
closePanel
|
|
32
|
+
} = useNodePanel(childProviderRef);
|
|
33
|
+
useNodePanelFollow(openNodeId, openNodeLabel, openNode, closePanel, () => props.followingUser, states, setLocalState);
|
|
34
|
+
const {
|
|
35
|
+
position,
|
|
36
|
+
currentSlideId,
|
|
37
|
+
currentSlide,
|
|
38
|
+
canGoLeft,
|
|
39
|
+
canGoRight,
|
|
40
|
+
canGoUp,
|
|
41
|
+
canGoDown,
|
|
42
|
+
goLeft,
|
|
43
|
+
goRight,
|
|
44
|
+
goUp,
|
|
45
|
+
goDown,
|
|
46
|
+
goTo,
|
|
47
|
+
goNext,
|
|
48
|
+
goPrev,
|
|
49
|
+
groups,
|
|
50
|
+
subSlidesOf,
|
|
51
|
+
currentNumber,
|
|
52
|
+
totalSlides,
|
|
53
|
+
currentTransition,
|
|
54
|
+
lastDirection,
|
|
55
|
+
adjacentSlideIds
|
|
56
|
+
} = useSlidesNavigation({
|
|
57
|
+
tree,
|
|
58
|
+
docId: props.docId,
|
|
59
|
+
setLocalState,
|
|
60
|
+
followingUser: () => props.followingUser,
|
|
61
|
+
states
|
|
62
|
+
});
|
|
63
|
+
const slidesTheme = computed(() => {
|
|
64
|
+
const v = tree.treeMap.data?.[props.docId]?.meta?.slidesTheme;
|
|
65
|
+
return v ?? "dark";
|
|
66
|
+
});
|
|
67
|
+
const currentSlideTypeKey = computed(() => currentSlide.value?.type);
|
|
68
|
+
const currentSlideTypeDef = computed(() => resolveDocType(currentSlideTypeKey.value));
|
|
69
|
+
const slideEditing = ref(false);
|
|
70
|
+
const slideProvider = shallowRef(null);
|
|
71
|
+
const slideLoading = ref(false);
|
|
72
|
+
watch(currentSlideId, async (id) => {
|
|
73
|
+
slideEditing.value = false;
|
|
74
|
+
slideProvider.value = null;
|
|
75
|
+
if (!id || !childProviderRef.value) return;
|
|
76
|
+
slideLoading.value = true;
|
|
77
|
+
try {
|
|
78
|
+
const prov = await childProviderRef.value.loadChild(id);
|
|
79
|
+
if (!prov.isSynced) {
|
|
80
|
+
await new Promise((resolve) => {
|
|
81
|
+
const done = () => {
|
|
82
|
+
prov.off("synced", done);
|
|
83
|
+
resolve();
|
|
84
|
+
};
|
|
85
|
+
prov.on("synced", done);
|
|
86
|
+
setTimeout(resolve, 6e3);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
const frag = prov.document.getXmlFragment("default");
|
|
90
|
+
if (!frag._item) {
|
|
91
|
+
prov.document.transact(() => void frag.length, "system");
|
|
92
|
+
}
|
|
93
|
+
if (currentSlideId.value === id) {
|
|
94
|
+
slideProvider.value = markRaw(prov);
|
|
95
|
+
}
|
|
96
|
+
} finally {
|
|
97
|
+
slideLoading.value = false;
|
|
98
|
+
}
|
|
99
|
+
}, { immediate: true });
|
|
100
|
+
const preloadedIds = /* @__PURE__ */ new Set();
|
|
101
|
+
watchEffect(() => {
|
|
102
|
+
for (const id of adjacentSlideIds.value) {
|
|
103
|
+
if (!preloadedIds.has(id) && childProviderRef.value) {
|
|
104
|
+
preloadedIds.add(id);
|
|
105
|
+
childProviderRef.value.loadChild(id).catch(() => {
|
|
106
|
+
preloadedIds.delete(id);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
const transitionName = computed(() => {
|
|
112
|
+
const t = currentTransition.value;
|
|
113
|
+
if (t === "none") return "slides-none";
|
|
114
|
+
if (t === "slide") return lastDirection.value === "left" || lastDirection.value === "up" ? "slides-slide-reverse" : "slides-slide";
|
|
115
|
+
return "slides-fade";
|
|
116
|
+
});
|
|
117
|
+
const showHelp = ref(false);
|
|
118
|
+
const rootRef = ref(null);
|
|
119
|
+
function isInsidePanel(el) {
|
|
120
|
+
while (el) {
|
|
121
|
+
if (el.hasAttribute?.("data-doc-slideover") || el.hasAttribute?.("data-doc-panel")) return true;
|
|
122
|
+
el = el.parentElement;
|
|
123
|
+
}
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
function onKeydown(e) {
|
|
127
|
+
const active = document.activeElement;
|
|
128
|
+
if (active && isInsidePanel(active)) return;
|
|
129
|
+
if (e.key === "Escape") {
|
|
130
|
+
e.preventDefault();
|
|
131
|
+
if (slideEditing.value) {
|
|
132
|
+
slideEditing.value = false;
|
|
133
|
+
rootRef.value?.focus();
|
|
134
|
+
} else if (showHelp.value) {
|
|
135
|
+
showHelp.value = false;
|
|
136
|
+
} else if (openNodeId.value) {
|
|
137
|
+
closePanel();
|
|
138
|
+
}
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (slideEditing.value) return;
|
|
142
|
+
switch (e.key) {
|
|
143
|
+
case "ArrowLeft":
|
|
144
|
+
e.preventDefault();
|
|
145
|
+
goLeft();
|
|
146
|
+
break;
|
|
147
|
+
case "ArrowRight":
|
|
148
|
+
e.preventDefault();
|
|
149
|
+
goRight();
|
|
150
|
+
break;
|
|
151
|
+
case "ArrowUp":
|
|
152
|
+
e.preventDefault();
|
|
153
|
+
goUp();
|
|
154
|
+
break;
|
|
155
|
+
case "ArrowDown":
|
|
156
|
+
e.preventDefault();
|
|
157
|
+
goDown();
|
|
158
|
+
break;
|
|
159
|
+
case " ":
|
|
160
|
+
case "PageDown":
|
|
161
|
+
e.preventDefault();
|
|
162
|
+
goNext();
|
|
163
|
+
break;
|
|
164
|
+
case "PageUp":
|
|
165
|
+
e.preventDefault();
|
|
166
|
+
goPrev();
|
|
167
|
+
break;
|
|
168
|
+
case "?":
|
|
169
|
+
e.preventDefault();
|
|
170
|
+
showHelp.value = !showHelp.value;
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function addSlide() {
|
|
175
|
+
if (!props.editable) return;
|
|
176
|
+
const id = tree.createChild(null, locale.value.newSlide);
|
|
177
|
+
nextTick(() => {
|
|
178
|
+
const idx = groups.value.findIndex((g) => g.id === id);
|
|
179
|
+
if (idx >= 0) goTo({ groupIndex: idx, subIndex: 0 });
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function addSubSlide() {
|
|
183
|
+
if (!props.editable) return;
|
|
184
|
+
const group = groups.value[position.value.groupIndex];
|
|
185
|
+
if (!group) return;
|
|
186
|
+
const id = tree.createChild(group.id, locale.value.newSubSlide);
|
|
187
|
+
nextTick(() => {
|
|
188
|
+
const subs = subSlidesOf(group.id);
|
|
189
|
+
const idx = subs.findIndex((s) => s.id === id);
|
|
190
|
+
if (idx >= 0) goTo({ groupIndex: position.value.groupIndex, subIndex: idx + 1 });
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
function editCurrentSlide() {
|
|
194
|
+
const id = currentSlideId.value;
|
|
195
|
+
const slide = currentSlide.value;
|
|
196
|
+
if (id && slide) openNode(id, slide.label);
|
|
197
|
+
}
|
|
198
|
+
function deleteCurrentSlide() {
|
|
199
|
+
if (!props.editable) return;
|
|
200
|
+
const id = currentSlideId.value;
|
|
201
|
+
if (!id) return;
|
|
202
|
+
tree.deleteEntry(id);
|
|
203
|
+
}
|
|
204
|
+
function slideMenuItems() {
|
|
205
|
+
return [
|
|
206
|
+
[
|
|
207
|
+
{ label: locale.value.editSlide, icon: "i-lucide-pencil", onSelect: editCurrentSlide },
|
|
208
|
+
{ label: locale.value.addSlide, icon: "i-lucide-plus", onSelect: addSlide },
|
|
209
|
+
...groups.value.length > 0 ? [{ label: locale.value.addSubSlide, icon: "i-lucide-arrow-down-to-line", onSelect: addSubSlide }] : []
|
|
210
|
+
],
|
|
211
|
+
[
|
|
212
|
+
{ label: locale.value.delete, icon: "i-lucide-trash-2", color: "error", onSelect: deleteCurrentSlide }
|
|
213
|
+
]
|
|
214
|
+
];
|
|
215
|
+
}
|
|
216
|
+
const myClientId = computed(() => props.childProvider?.awareness?.clientID ?? 0);
|
|
217
|
+
function remoteUsersOnGroup(groupIndex) {
|
|
218
|
+
return states.value.filter((s) => {
|
|
219
|
+
if (s.clientId === myClientId.value) return false;
|
|
220
|
+
const pos = s["slides:position"];
|
|
221
|
+
return pos && pos.groupIndex === groupIndex;
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
const stageRef = ref(null);
|
|
225
|
+
const swipeOffset = ref({ x: 0, y: 0 });
|
|
226
|
+
const isSwiping = ref(false);
|
|
227
|
+
let touchStartX = 0;
|
|
228
|
+
let touchStartY = 0;
|
|
229
|
+
let touchAxis = null;
|
|
230
|
+
function onStageTouchStart(e) {
|
|
231
|
+
if (slideEditing.value) return;
|
|
232
|
+
const touch = e.touches[0];
|
|
233
|
+
touchStartX = touch.clientX;
|
|
234
|
+
touchStartY = touch.clientY;
|
|
235
|
+
touchAxis = null;
|
|
236
|
+
isSwiping.value = false;
|
|
237
|
+
swipeOffset.value = { x: 0, y: 0 };
|
|
238
|
+
}
|
|
239
|
+
function onStageTouchMove(e) {
|
|
240
|
+
if (slideEditing.value) return;
|
|
241
|
+
const touch = e.touches[0];
|
|
242
|
+
const dx = touch.clientX - touchStartX;
|
|
243
|
+
const dy = touch.clientY - touchStartY;
|
|
244
|
+
if (!touchAxis) {
|
|
245
|
+
if (Math.abs(dx) < 10 && Math.abs(dy) < 10) return;
|
|
246
|
+
touchAxis = Math.abs(dx) >= Math.abs(dy) ? "x" : "y";
|
|
247
|
+
}
|
|
248
|
+
isSwiping.value = true;
|
|
249
|
+
if (touchAxis === "x") {
|
|
250
|
+
const valid = dx < 0 && canGoRight.value || dx > 0 && canGoLeft.value;
|
|
251
|
+
swipeOffset.value = { x: dx * (valid ? 0.4 : 0.1), y: 0 };
|
|
252
|
+
} else {
|
|
253
|
+
const valid = dy < 0 && canGoDown.value || dy > 0 && canGoUp.value;
|
|
254
|
+
swipeOffset.value = { x: 0, y: dy * (valid ? 0.4 : 0.1) };
|
|
255
|
+
}
|
|
256
|
+
e.preventDefault();
|
|
257
|
+
}
|
|
258
|
+
function onStageTouchEnd() {
|
|
259
|
+
if (slideEditing.value) return;
|
|
260
|
+
const SWIPE_TRIGGER = 24;
|
|
261
|
+
if (touchAxis === "x" && Math.abs(swipeOffset.value.x) > SWIPE_TRIGGER) {
|
|
262
|
+
if (swipeOffset.value.x < 0 && canGoRight.value) goRight();
|
|
263
|
+
else if (swipeOffset.value.x > 0 && canGoLeft.value) goLeft();
|
|
264
|
+
} else if (touchAxis === "y" && Math.abs(swipeOffset.value.y) > SWIPE_TRIGGER) {
|
|
265
|
+
if (swipeOffset.value.y < 0 && canGoDown.value) goDown();
|
|
266
|
+
else if (swipeOffset.value.y > 0 && canGoUp.value) goUp();
|
|
267
|
+
}
|
|
268
|
+
swipeOffset.value = { x: 0, y: 0 };
|
|
269
|
+
isSwiping.value = false;
|
|
270
|
+
touchAxis = null;
|
|
271
|
+
}
|
|
272
|
+
onMounted(() => {
|
|
273
|
+
rootRef.value?.focus();
|
|
274
|
+
});
|
|
275
|
+
defineExpose({ connectedUsers });
|
|
276
|
+
</script>
|
|
277
|
+
|
|
278
|
+
<template>
|
|
279
|
+
<div
|
|
280
|
+
ref="rootRef"
|
|
281
|
+
class="flex-1 min-h-0 flex flex-col relative outline-none"
|
|
282
|
+
tabindex="0"
|
|
283
|
+
@keydown="onKeydown"
|
|
284
|
+
>
|
|
285
|
+
<!-- Toolbar -->
|
|
286
|
+
<div class="flex items-center justify-between px-4 py-2 border-b border-(--ui-border) shrink-0">
|
|
287
|
+
<div class="flex items-center gap-2">
|
|
288
|
+
<span class="text-xs text-(--ui-text-muted) tabular-nums">
|
|
289
|
+
{{ currentNumber }} / {{ totalSlides }}
|
|
290
|
+
</span>
|
|
291
|
+
</div>
|
|
292
|
+
<div class="flex items-center gap-1">
|
|
293
|
+
<UTooltip
|
|
294
|
+
:text="locale.keyboardHelp"
|
|
295
|
+
:content="{ side: 'bottom' }"
|
|
296
|
+
>
|
|
297
|
+
<UButton
|
|
298
|
+
icon="i-lucide-keyboard"
|
|
299
|
+
size="xs"
|
|
300
|
+
variant="ghost"
|
|
301
|
+
color="neutral"
|
|
302
|
+
@click="showHelp = !showHelp"
|
|
303
|
+
/>
|
|
304
|
+
</UTooltip>
|
|
305
|
+
<UDropdownMenu
|
|
306
|
+
v-if="editable"
|
|
307
|
+
:items="slideMenuItems()"
|
|
308
|
+
:content="{ align: 'end' }"
|
|
309
|
+
>
|
|
310
|
+
<UButton
|
|
311
|
+
icon="i-lucide-ellipsis"
|
|
312
|
+
size="xs"
|
|
313
|
+
variant="ghost"
|
|
314
|
+
color="neutral"
|
|
315
|
+
/>
|
|
316
|
+
</UDropdownMenu>
|
|
317
|
+
<UButton
|
|
318
|
+
v-if="editable"
|
|
319
|
+
icon="i-lucide-plus"
|
|
320
|
+
size="xs"
|
|
321
|
+
variant="ghost"
|
|
322
|
+
color="neutral"
|
|
323
|
+
:label="locale.addSlide"
|
|
324
|
+
@click="addSlide"
|
|
325
|
+
/>
|
|
326
|
+
</div>
|
|
327
|
+
</div>
|
|
328
|
+
|
|
329
|
+
<!-- Stage -->
|
|
330
|
+
<div
|
|
331
|
+
ref="stageRef"
|
|
332
|
+
data-swipe-ignore
|
|
333
|
+
class="flex-1 flex items-center justify-center relative overflow-hidden select-none"
|
|
334
|
+
:class="slidesTheme === 'dark' ? 'bg-neutral-950' : 'bg-neutral-100'"
|
|
335
|
+
@touchstart.passive="onStageTouchStart"
|
|
336
|
+
@touchmove="onStageTouchMove"
|
|
337
|
+
@touchend.passive="onStageTouchEnd"
|
|
338
|
+
@touchcancel.passive="onStageTouchEnd"
|
|
339
|
+
>
|
|
340
|
+
<!-- Empty state -->
|
|
341
|
+
<div
|
|
342
|
+
v-if="groups.length === 0"
|
|
343
|
+
class="flex flex-col items-center justify-center h-full gap-3 text-center"
|
|
344
|
+
>
|
|
345
|
+
<UIcon
|
|
346
|
+
name="i-lucide-presentation"
|
|
347
|
+
class="size-10 text-(--ui-text-dimmed)"
|
|
348
|
+
/>
|
|
349
|
+
<p class="text-sm text-(--ui-text-muted)">
|
|
350
|
+
{{ locale.empty }}
|
|
351
|
+
</p>
|
|
352
|
+
<UButton
|
|
353
|
+
v-if="editable"
|
|
354
|
+
icon="i-lucide-plus"
|
|
355
|
+
:label="locale.addSlide"
|
|
356
|
+
size="sm"
|
|
357
|
+
@click="addSlide"
|
|
358
|
+
/>
|
|
359
|
+
</div>
|
|
360
|
+
|
|
361
|
+
<template v-else>
|
|
362
|
+
<!-- Left indicator -->
|
|
363
|
+
<Transition name="slides-indicator">
|
|
364
|
+
<button
|
|
365
|
+
v-if="canGoLeft"
|
|
366
|
+
class="absolute left-3 z-10 flex items-center justify-center size-10 rounded-full bg-(--ui-bg-elevated)/60 backdrop-blur-sm border border-(--ui-border)/50 hover:bg-(--ui-bg-elevated) hover:scale-110 transition-all duration-150 cursor-pointer"
|
|
367
|
+
:class="slidesTheme === 'dark' ? 'text-white/60 hover:text-white' : 'text-neutral-500 hover:text-neutral-800'"
|
|
368
|
+
@click="goLeft"
|
|
369
|
+
>
|
|
370
|
+
<UIcon
|
|
371
|
+
name="i-lucide-chevron-left"
|
|
372
|
+
class="size-5"
|
|
373
|
+
/>
|
|
374
|
+
</button>
|
|
375
|
+
</Transition>
|
|
376
|
+
|
|
377
|
+
<!-- Up indicator -->
|
|
378
|
+
<Transition name="slides-indicator">
|
|
379
|
+
<button
|
|
380
|
+
v-if="canGoUp"
|
|
381
|
+
class="absolute top-3 z-10 flex items-center justify-center size-10 rounded-full bg-(--ui-bg-elevated)/60 backdrop-blur-sm border border-(--ui-border)/50 hover:bg-(--ui-bg-elevated) hover:scale-110 transition-all duration-150 cursor-pointer"
|
|
382
|
+
:class="slidesTheme === 'dark' ? 'text-white/60 hover:text-white' : 'text-neutral-500 hover:text-neutral-800'"
|
|
383
|
+
@click="goUp"
|
|
384
|
+
>
|
|
385
|
+
<UIcon
|
|
386
|
+
name="i-lucide-chevron-up"
|
|
387
|
+
class="size-5"
|
|
388
|
+
/>
|
|
389
|
+
</button>
|
|
390
|
+
</Transition>
|
|
391
|
+
|
|
392
|
+
<!-- Slide frame -->
|
|
393
|
+
<Transition
|
|
394
|
+
:name="isSwiping ? 'slides-none' : transitionName"
|
|
395
|
+
mode="out-in"
|
|
396
|
+
>
|
|
397
|
+
<div
|
|
398
|
+
:key="currentSlideId ?? 'empty'"
|
|
399
|
+
class="w-[90%] max-w-5xl max-h-[90%] rounded-xl shadow-2xl ring-1 relative"
|
|
400
|
+
:class="[
|
|
401
|
+
slideEditing ? 'overflow-y-auto' : 'overflow-hidden',
|
|
402
|
+
slidesTheme === 'dark' ? 'bg-neutral-900 ring-white/10' : 'bg-white ring-neutral-200'
|
|
403
|
+
]"
|
|
404
|
+
:style="isSwiping ? { transform: `translate(${swipeOffset.x}px, ${swipeOffset.y}px)`, transition: 'none' } : { transition: 'transform 300ms ease' }"
|
|
405
|
+
>
|
|
406
|
+
<!-- Slide content (renders the slide's actual page type) -->
|
|
407
|
+
<div
|
|
408
|
+
v-if="slideProvider && currentSlideId"
|
|
409
|
+
class="w-full h-full overflow-hidden"
|
|
410
|
+
:class="!slideEditing ? 'pointer-events-none' : ''"
|
|
411
|
+
>
|
|
412
|
+
<component
|
|
413
|
+
:is="currentSlideTypeDef.component"
|
|
414
|
+
:key="`${currentSlideId}-${currentSlideTypeKey ?? 'doc'}`"
|
|
415
|
+
:doc-id="currentSlideId"
|
|
416
|
+
:child-provider="slideProvider"
|
|
417
|
+
:doc-label="currentSlide?.label ?? ''"
|
|
418
|
+
/>
|
|
419
|
+
</div>
|
|
420
|
+
|
|
421
|
+
<!-- Loading -->
|
|
422
|
+
<div
|
|
423
|
+
v-else-if="slideLoading"
|
|
424
|
+
class="w-full h-full flex items-center justify-center"
|
|
425
|
+
>
|
|
426
|
+
<UIcon
|
|
427
|
+
name="i-lucide-loader-2"
|
|
428
|
+
class="size-6 animate-spin text-(--ui-text-muted)"
|
|
429
|
+
/>
|
|
430
|
+
</div>
|
|
431
|
+
|
|
432
|
+
<!-- Fallback: label only -->
|
|
433
|
+
<div
|
|
434
|
+
v-else-if="currentSlide"
|
|
435
|
+
class="w-full h-full flex items-center justify-center p-8"
|
|
436
|
+
>
|
|
437
|
+
<h2
|
|
438
|
+
class="text-2xl font-semibold text-center"
|
|
439
|
+
:class="slidesTheme === 'dark' ? 'text-white' : 'text-neutral-900'"
|
|
440
|
+
>
|
|
441
|
+
{{ currentSlide.label }}
|
|
442
|
+
</h2>
|
|
443
|
+
</div>
|
|
444
|
+
|
|
445
|
+
<!-- Click-to-edit overlay -->
|
|
446
|
+
<div
|
|
447
|
+
v-if="editable && slideProvider && !slideEditing"
|
|
448
|
+
class="absolute inset-0 z-10 cursor-pointer"
|
|
449
|
+
@click="slideEditing = true"
|
|
450
|
+
/>
|
|
451
|
+
|
|
452
|
+
<!-- Editing indicator -->
|
|
453
|
+
<Transition name="slides-indicator">
|
|
454
|
+
<div
|
|
455
|
+
v-if="slideEditing"
|
|
456
|
+
class="absolute top-2 right-2 z-10 flex items-center gap-1.5 px-2 py-1 rounded-lg text-xs bg-black/50 text-white/80 backdrop-blur-sm"
|
|
457
|
+
>
|
|
458
|
+
<UIcon
|
|
459
|
+
name="i-lucide-pencil"
|
|
460
|
+
class="size-3"
|
|
461
|
+
/>
|
|
462
|
+
<span>{{ locale.editing }}</span>
|
|
463
|
+
<span class="text-white/50 ml-1">{{ locale.escToExit }}</span>
|
|
464
|
+
</div>
|
|
465
|
+
</Transition>
|
|
466
|
+
</div>
|
|
467
|
+
</Transition>
|
|
468
|
+
|
|
469
|
+
<!-- Right indicator -->
|
|
470
|
+
<Transition name="slides-indicator">
|
|
471
|
+
<button
|
|
472
|
+
v-if="canGoRight"
|
|
473
|
+
class="absolute right-3 z-10 flex items-center justify-center size-10 rounded-full bg-(--ui-bg-elevated)/60 backdrop-blur-sm border border-(--ui-border)/50 hover:bg-(--ui-bg-elevated) hover:scale-110 transition-all duration-150 cursor-pointer"
|
|
474
|
+
:class="slidesTheme === 'dark' ? 'text-white/60 hover:text-white' : 'text-neutral-500 hover:text-neutral-800'"
|
|
475
|
+
@click="goRight"
|
|
476
|
+
>
|
|
477
|
+
<UIcon
|
|
478
|
+
name="i-lucide-chevron-right"
|
|
479
|
+
class="size-5"
|
|
480
|
+
/>
|
|
481
|
+
</button>
|
|
482
|
+
</Transition>
|
|
483
|
+
|
|
484
|
+
<!-- Down indicator -->
|
|
485
|
+
<Transition name="slides-indicator">
|
|
486
|
+
<button
|
|
487
|
+
v-if="canGoDown"
|
|
488
|
+
class="absolute bottom-14 z-10 flex items-center justify-center size-10 rounded-full bg-(--ui-bg-elevated)/60 backdrop-blur-sm border border-(--ui-border)/50 hover:bg-(--ui-bg-elevated) hover:scale-110 transition-all duration-150 cursor-pointer"
|
|
489
|
+
:class="slidesTheme === 'dark' ? 'text-white/60 hover:text-white' : 'text-neutral-500 hover:text-neutral-800'"
|
|
490
|
+
@click="goDown"
|
|
491
|
+
>
|
|
492
|
+
<UIcon
|
|
493
|
+
name="i-lucide-chevron-down"
|
|
494
|
+
class="size-5"
|
|
495
|
+
/>
|
|
496
|
+
</button>
|
|
497
|
+
</Transition>
|
|
498
|
+
|
|
499
|
+
<!-- Position dots -->
|
|
500
|
+
<div class="absolute bottom-4 z-10 flex items-center gap-1.5">
|
|
501
|
+
<button
|
|
502
|
+
v-for="(group, i) in groups"
|
|
503
|
+
:key="group.id"
|
|
504
|
+
class="rounded-full transition-all duration-200 cursor-pointer relative"
|
|
505
|
+
:class="[
|
|
506
|
+
i === position.groupIndex ? 'size-2.5 bg-(--ui-primary)' : slidesTheme === 'dark' ? 'size-2 bg-white/30 hover:bg-white/50' : 'size-2 bg-neutral-400/40 hover:bg-neutral-400/60'
|
|
507
|
+
]"
|
|
508
|
+
@click="goTo({ groupIndex: i, subIndex: 0 })"
|
|
509
|
+
>
|
|
510
|
+
<span
|
|
511
|
+
v-if="subSlidesOf(group.id).length > 0"
|
|
512
|
+
class="absolute -top-1.5 left-1/2 -translate-x-1/2 size-1 rounded-full"
|
|
513
|
+
:class="slidesTheme === 'dark' ? 'bg-white/20' : 'bg-neutral-400/30'"
|
|
514
|
+
/>
|
|
515
|
+
<span
|
|
516
|
+
v-for="u in remoteUsersOnGroup(i)"
|
|
517
|
+
:key="u.clientId"
|
|
518
|
+
class="absolute -bottom-2.5 left-1/2 -translate-x-1/2 size-1.5 rounded-full"
|
|
519
|
+
:style="{ backgroundColor: u.user?.color ?? '#888' }"
|
|
520
|
+
/>
|
|
521
|
+
</button>
|
|
522
|
+
</div>
|
|
523
|
+
|
|
524
|
+
<!-- Vertical position indicator -->
|
|
525
|
+
<div
|
|
526
|
+
v-if="subSlidesOf(groups[position.groupIndex]?.id ?? '').length > 0"
|
|
527
|
+
class="absolute right-5 top-1/2 -translate-y-1/2 z-10 flex flex-col items-center gap-1.5"
|
|
528
|
+
>
|
|
529
|
+
<button
|
|
530
|
+
v-for="si in subSlidesOf(groups[position.groupIndex]?.id ?? '').length + 1"
|
|
531
|
+
:key="si"
|
|
532
|
+
class="rounded-full transition-all duration-200 cursor-pointer"
|
|
533
|
+
:class="[
|
|
534
|
+
si - 1 === position.subIndex ? 'size-2.5 bg-(--ui-primary)' : slidesTheme === 'dark' ? 'size-1.5 bg-white/30 hover:bg-white/50' : 'size-1.5 bg-neutral-400/40 hover:bg-neutral-400/60'
|
|
535
|
+
]"
|
|
536
|
+
@click="goTo({ groupIndex: position.groupIndex, subIndex: si - 1 })"
|
|
537
|
+
/>
|
|
538
|
+
</div>
|
|
539
|
+
</template>
|
|
540
|
+
</div>
|
|
541
|
+
|
|
542
|
+
<!-- Keyboard help overlay -->
|
|
543
|
+
<Transition name="slides-fade">
|
|
544
|
+
<div
|
|
545
|
+
v-if="showHelp"
|
|
546
|
+
class="absolute inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-sm"
|
|
547
|
+
@click="showHelp = false"
|
|
548
|
+
>
|
|
549
|
+
<div
|
|
550
|
+
class="bg-(--ui-bg-elevated) rounded-xl p-6 shadow-2xl max-w-sm w-full mx-4 ring-1 ring-(--ui-border)"
|
|
551
|
+
@click.stop
|
|
552
|
+
>
|
|
553
|
+
<h3 class="text-sm font-semibold text-(--ui-text) mb-4">
|
|
554
|
+
{{ locale.keyboardHelp }}
|
|
555
|
+
</h3>
|
|
556
|
+
<div class="space-y-2 text-sm text-(--ui-text-muted)">
|
|
557
|
+
<div class="flex items-center justify-between">
|
|
558
|
+
<span>{{ locale.helpArrows }}</span>
|
|
559
|
+
<div class="flex gap-1">
|
|
560
|
+
<kbd class="px-1.5 py-0.5 rounded bg-(--ui-bg) text-xs font-mono border border-(--ui-border)">←</kbd>
|
|
561
|
+
<kbd class="px-1.5 py-0.5 rounded bg-(--ui-bg) text-xs font-mono border border-(--ui-border)">→</kbd>
|
|
562
|
+
<kbd class="px-1.5 py-0.5 rounded bg-(--ui-bg) text-xs font-mono border border-(--ui-border)">↑</kbd>
|
|
563
|
+
<kbd class="px-1.5 py-0.5 rounded bg-(--ui-bg) text-xs font-mono border border-(--ui-border)">↓</kbd>
|
|
564
|
+
</div>
|
|
565
|
+
</div>
|
|
566
|
+
<div class="flex items-center justify-between">
|
|
567
|
+
<span>{{ locale.helpSpace }}</span>
|
|
568
|
+
<kbd class="px-1.5 py-0.5 rounded bg-(--ui-bg) text-xs font-mono border border-(--ui-border)">Space</kbd>
|
|
569
|
+
</div>
|
|
570
|
+
<div class="flex items-center justify-between">
|
|
571
|
+
<span>{{ locale.helpDblClick }}</span>
|
|
572
|
+
<span class="text-xs">2× click</span>
|
|
573
|
+
</div>
|
|
574
|
+
</div>
|
|
575
|
+
</div>
|
|
576
|
+
</div>
|
|
577
|
+
</Transition>
|
|
578
|
+
|
|
579
|
+
<!-- Node panel -->
|
|
580
|
+
<ANodePanel
|
|
581
|
+
:node-id="openNodeId"
|
|
582
|
+
:node-label="openNodeLabel"
|
|
583
|
+
:child-provider="openNodeProvider"
|
|
584
|
+
@close="closePanel"
|
|
585
|
+
/>
|
|
586
|
+
</div>
|
|
587
|
+
</template>
|
|
588
|
+
|
|
589
|
+
<style scoped>
|
|
590
|
+
.slides-fade-enter-active,.slides-fade-leave-active{transition:opacity .3s ease}.slides-fade-enter-from,.slides-fade-leave-to{opacity:0}.slides-slide-enter-active,.slides-slide-leave-active{transition:opacity .3s ease,transform .3s ease}.slides-slide-enter-from{opacity:0;transform:translateX(60px)}.slides-slide-leave-to{opacity:0;transform:translateX(-60px)}.slides-slide-reverse-enter-active,.slides-slide-reverse-leave-active{transition:opacity .3s ease,transform .3s ease}.slides-slide-reverse-enter-from{opacity:0;transform:translateX(-60px)}.slides-slide-reverse-leave-to{opacity:0;transform:translateX(60px)}.slides-none-enter-active,.slides-none-leave-active{transition:none}.slides-indicator-enter-active,.slides-indicator-leave-active{transition:opacity .2s ease}.slides-indicator-enter-from,.slides-indicator-leave-to{opacity:0}
|
|
591
|
+
</style>
|