@abraca/junis 2.82.0 → 2.83.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 +19 -14
- package/dist/module.json +1 -1
- package/dist/module.mjs +7 -0
- package/dist/runtime/assets/css/jun.css +1 -1
- package/dist/runtime/components/JunCampfireChat.vue +1 -1
- package/dist/runtime/components/JunCampfirePanel.vue +12 -12
- package/dist/runtime/components/JunCampfirePresence.client.vue +8 -8
- package/dist/runtime/components/JunCampfireRoster.vue +13 -13
- package/dist/runtime/components/JunCampfireYou.vue +9 -9
- package/dist/runtime/components/JunGlobeEditor.client.vue +396 -183
- package/dist/runtime/components/JunGlobeMap.client.vue +1 -0
- package/dist/runtime/components/JunHorizontalTimeline.vue +41 -4
- package/dist/runtime/components/JunImagePopup.client.vue +1 -1
- package/dist/runtime/components/renderers/JunAppsRenderer.vue +5 -5
- package/dist/runtime/components/renderers/JunCvRenderer.vue +1 -1
- package/dist/runtime/components/renderers/JunEntryRenderer.vue +1 -1
- package/dist/runtime/components/renderers/JunGuestbookRenderer.vue +2 -0
- package/dist/runtime/components/renderers/JunHomeRenderer.vue +2 -2
- package/dist/runtime/components/renderers/JunJournalRenderer.vue +6 -6
- package/dist/runtime/components/renderers/JunLiveRenderer.vue +2 -1
- package/dist/runtime/components/renderers/JunMovieRenderer.vue +1 -1
- package/dist/runtime/components/renderers/JunNowRenderer.vue +39 -0
- package/dist/runtime/components/renderers/JunProjectRenderer.vue +2 -2
- package/dist/runtime/components/renderers/JunStatsRenderer.vue +15 -2
- package/dist/runtime/components/renderers/JunTrackRenderer.vue +44 -0
- package/dist/runtime/components/renderers/JunWallRenderer.vue +1 -0
- package/dist/runtime/composables/useJunChrome.js +11 -2
- package/dist/runtime/composables/useJunTheme.js +9 -0
- package/dist/runtime/plugins/jun-fresh-server.client.d.ts +2 -0
- package/dist/runtime/plugins/jun-fresh-server.client.js +42 -0
- package/dist/runtime/server/janitor/junJanitorChores.d.ts +23 -2
- package/dist/runtime/server/janitor/junJanitorChores.js +74 -8
- package/dist/runtime/server/janitor/junJanitorMachine.js +16 -2
- package/dist/runtime/server/janitor/junJanitorStore.d.ts +35 -1
- package/dist/runtime/server/janitor/junJanitorStore.js +62 -4
- package/dist/runtime/server/plugins/jun-bootstrap.js +88 -3
- package/dist/runtime/server/utils/junVisibility.js +2 -0
- package/dist/runtime/utils/junVisibility.js +2 -0
- package/package.json +4 -2
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed, ref, watch } from "vue";
|
|
2
|
+
import { computed, nextTick, ref, watch } from "vue";
|
|
3
3
|
import { useLocalStorage } from "@vueuse/core";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
useJunRename,
|
|
6
|
+
useJunRouting,
|
|
7
|
+
useToast
|
|
8
|
+
} from "#imports";
|
|
9
|
+
import {
|
|
10
|
+
JUN_TRANSPORT as TRANSPORT,
|
|
11
|
+
JUN_TRANSPORT_MODES as TRANSPORT_MODES,
|
|
12
|
+
normalizeTransport
|
|
13
|
+
} from "../utils/junTransportModes";
|
|
6
14
|
const props = defineProps({
|
|
7
15
|
tree: { type: Object, required: true },
|
|
8
16
|
waypoints: { type: Array, required: true },
|
|
@@ -13,17 +21,26 @@ const emit = defineEmits(["update:adding", "select"]);
|
|
|
13
21
|
const { geocode, reverseGeocode, directions } = useJunRouting();
|
|
14
22
|
const { renameDoc } = useJunRename();
|
|
15
23
|
const toast = useToast();
|
|
16
|
-
const COLOR_SWATCHES = [
|
|
24
|
+
const COLOR_SWATCHES = [
|
|
25
|
+
{ value: "", label: "Match the transport mode" },
|
|
26
|
+
...TRANSPORT_MODES.map((m) => ({ value: TRANSPORT[m].color, label: `${TRANSPORT[m].label} colour` }))
|
|
27
|
+
];
|
|
17
28
|
const defaultMode = ref("plane");
|
|
18
29
|
const busyId = ref(null);
|
|
30
|
+
const regeneratingAll = ref(false);
|
|
31
|
+
const paletteFor = ref(null);
|
|
19
32
|
const collapsed = useLocalStorage("jun_globe_routes_collapsed", false);
|
|
33
|
+
const CORNER = "top-right";
|
|
34
|
+
const corner = computed(() => CORNER);
|
|
20
35
|
const query = ref("");
|
|
21
36
|
const results = ref([]);
|
|
22
37
|
const searching = ref(false);
|
|
38
|
+
const cursor = ref(-1);
|
|
23
39
|
let searchTimer = null;
|
|
24
40
|
let searchSeq = 0;
|
|
25
41
|
watch(query, (q) => {
|
|
26
42
|
if (searchTimer) clearTimeout(searchTimer);
|
|
43
|
+
cursor.value = -1;
|
|
27
44
|
if (!q.trim()) {
|
|
28
45
|
results.value = [];
|
|
29
46
|
return;
|
|
@@ -38,6 +55,23 @@ watch(query, (q) => {
|
|
|
38
55
|
}
|
|
39
56
|
}, 320);
|
|
40
57
|
});
|
|
58
|
+
function onSearchKeydown(e) {
|
|
59
|
+
if (!results.value.length) return;
|
|
60
|
+
if (e.key === "ArrowDown") {
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
cursor.value = (cursor.value + 1) % results.value.length;
|
|
63
|
+
} else if (e.key === "ArrowUp") {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
cursor.value = cursor.value <= 0 ? results.value.length - 1 : cursor.value - 1;
|
|
66
|
+
} else if (e.key === "Enter") {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
const pick = results.value[cursor.value] ?? results.value[0];
|
|
69
|
+
if (pick) pickResult(pick);
|
|
70
|
+
} else if (e.key === "Escape") {
|
|
71
|
+
results.value = [];
|
|
72
|
+
cursor.value = -1;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
41
75
|
function locOf(wp) {
|
|
42
76
|
if (typeof wp.meta?.geoLat === "number" && typeof wp.meta?.geoLng === "number") {
|
|
43
77
|
return { lng: wp.meta.geoLng, lat: wp.meta.geoLat };
|
|
@@ -58,6 +92,7 @@ function pickResult(r) {
|
|
|
58
92
|
void addWaypoint(r.label.split(",")[0].trim(), r.lng, r.lat);
|
|
59
93
|
query.value = "";
|
|
60
94
|
results.value = [];
|
|
95
|
+
cursor.value = -1;
|
|
61
96
|
}
|
|
62
97
|
async function addAt(at) {
|
|
63
98
|
const name = await reverseGeocode(at.lng, at.lat);
|
|
@@ -97,14 +132,79 @@ function setMode(wp, i, mode) {
|
|
|
97
132
|
function regenerate(wp, i) {
|
|
98
133
|
setMode(wp, i, normalizeTransport(wp.meta?.transport));
|
|
99
134
|
}
|
|
135
|
+
async function regenerateAll() {
|
|
136
|
+
if (regeneratingAll.value) return;
|
|
137
|
+
regeneratingAll.value = true;
|
|
138
|
+
try {
|
|
139
|
+
for (let i = 1; i < props.waypoints.length; i++) {
|
|
140
|
+
const wp = props.waypoints[i];
|
|
141
|
+
await generateLeg(wp, normalizeTransport(wp.meta?.transport), props.waypoints[i - 1]);
|
|
142
|
+
}
|
|
143
|
+
toast.add({ title: "Routes regenerated", icon: "i-lucide-route", color: "neutral" });
|
|
144
|
+
} finally {
|
|
145
|
+
regeneratingAll.value = false;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
100
148
|
function setColor(wp, c) {
|
|
101
149
|
props.tree.updateMeta(wp.id, { color: c || "" });
|
|
150
|
+
paletteFor.value = null;
|
|
102
151
|
}
|
|
103
152
|
function rename(wp, v) {
|
|
104
153
|
if (v.trim()) renameDoc(wp.id, v.trim());
|
|
105
154
|
}
|
|
106
|
-
function remove(wp) {
|
|
155
|
+
function remove(wp, i) {
|
|
156
|
+
const snapshot = { label: wp.label, meta: { ...wp.meta ?? {} } };
|
|
107
157
|
props.tree.deleteEntry(wp.id);
|
|
158
|
+
toast.add({
|
|
159
|
+
title: `Removed ${wp.label}`,
|
|
160
|
+
icon: "i-lucide-trash-2",
|
|
161
|
+
color: "neutral",
|
|
162
|
+
actions: [{
|
|
163
|
+
label: "Undo",
|
|
164
|
+
onClick: () => {
|
|
165
|
+
const id = props.tree.createChild(null, snapshot.label, "doc");
|
|
166
|
+
props.tree.updateMeta(id, snapshot.meta);
|
|
167
|
+
void nextTick(() => {
|
|
168
|
+
const back = props.waypoints.find((w) => w.id === id);
|
|
169
|
+
const at = props.waypoints.findIndex((w) => w.id === id);
|
|
170
|
+
if (back && at > 0) void generateLeg(back, normalizeTransport(back.meta?.transport), props.waypoints[at - 1]);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}]
|
|
174
|
+
});
|
|
175
|
+
void i;
|
|
176
|
+
}
|
|
177
|
+
const totals = computed(() => {
|
|
178
|
+
let km = 0;
|
|
179
|
+
let min = 0;
|
|
180
|
+
for (const wp of props.waypoints) {
|
|
181
|
+
km += Number(wp.meta?.routeKm) || 0;
|
|
182
|
+
min += Number(wp.meta?.routeMin) || 0;
|
|
183
|
+
}
|
|
184
|
+
return { km, min, legs: Math.max(0, props.waypoints.length - 1) };
|
|
185
|
+
});
|
|
186
|
+
function humanDuration(min) {
|
|
187
|
+
if (!min) return "";
|
|
188
|
+
if (min < 60) return `${Math.round(min)}m`;
|
|
189
|
+
const h = Math.floor(min / 60);
|
|
190
|
+
if (h < 24) {
|
|
191
|
+
const m = Math.round(min % 60);
|
|
192
|
+
return m ? `${h}h ${m}m` : `${h}h`;
|
|
193
|
+
}
|
|
194
|
+
const d = Math.floor(h / 24);
|
|
195
|
+
const rh = h % 24;
|
|
196
|
+
return rh ? `${d}d ${rh}h` : `${d}d`;
|
|
197
|
+
}
|
|
198
|
+
const humanKm = (km) => km >= 1e4 ? `${(km / 1e3).toFixed(1)}k` : km.toLocaleString();
|
|
199
|
+
function legColor(wp) {
|
|
200
|
+
return wp.meta?.color || TRANSPORT[normalizeTransport(wp.meta?.transport)].color;
|
|
201
|
+
}
|
|
202
|
+
function legDash(wp) {
|
|
203
|
+
const d = TRANSPORT[normalizeTransport(wp.meta?.transport)].dash;
|
|
204
|
+
if (d === "dot") return "1px 4px";
|
|
205
|
+
if (d === "short") return "4px 4px";
|
|
206
|
+
if (d === "long") return "10px 5px";
|
|
207
|
+
return "";
|
|
108
208
|
}
|
|
109
209
|
const addingModel = computed({
|
|
110
210
|
get: () => !!props.adding,
|
|
@@ -114,202 +214,315 @@ const addingModel = computed({
|
|
|
114
214
|
|
|
115
215
|
<template>
|
|
116
216
|
<!-- Collapsed: a quiet chip in the panel's corner — click to unfold. -->
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
class="size-4 text-muted"
|
|
128
|
-
/>
|
|
129
|
-
<span class="text-sm font-medium text-highlighted tabular-nums">{{ waypoints.length }}</span>
|
|
130
|
-
<UIcon
|
|
131
|
-
name="i-lucide-chevrons-up-down"
|
|
132
|
-
class="size-3.5 text-dimmed"
|
|
133
|
-
/>
|
|
134
|
-
</button>
|
|
135
|
-
|
|
136
|
-
<div
|
|
137
|
-
v-else
|
|
138
|
-
class="jun-globe-editor jun-chrome"
|
|
139
|
-
>
|
|
140
|
-
<header class="flex items-center gap-2 px-3 py-2 border-b border-default">
|
|
217
|
+
<Transition name="jun-globe-panel">
|
|
218
|
+
<button
|
|
219
|
+
v-if="collapsed"
|
|
220
|
+
type="button"
|
|
221
|
+
class="jun-bar jun-globe-editor-chip jun-chrome"
|
|
222
|
+
:data-jun-corner="corner"
|
|
223
|
+
aria-label="Open routes panel"
|
|
224
|
+
title="Routes"
|
|
225
|
+
@click="collapsed = false"
|
|
226
|
+
>
|
|
141
227
|
<UIcon
|
|
142
228
|
name="i-lucide-route"
|
|
143
|
-
class="size-4
|
|
229
|
+
class="size-4 opacity-60"
|
|
144
230
|
/>
|
|
145
|
-
<span class="text-sm font-
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
variant="subtle"
|
|
150
|
-
class="ml-auto"
|
|
151
|
-
>
|
|
152
|
-
{{ waypoints.length }}
|
|
153
|
-
</UBadge>
|
|
154
|
-
<UButton
|
|
155
|
-
icon="i-lucide-chevrons-down-up"
|
|
156
|
-
size="xs"
|
|
157
|
-
color="neutral"
|
|
158
|
-
variant="ghost"
|
|
159
|
-
aria-label="Collapse routes panel"
|
|
160
|
-
@click="collapsed = true"
|
|
231
|
+
<span class="text-sm font-medium tabular-nums">{{ waypoints.length }}</span>
|
|
232
|
+
<UIcon
|
|
233
|
+
name="i-lucide-chevrons-up-down"
|
|
234
|
+
class="size-3.5 opacity-40"
|
|
161
235
|
/>
|
|
162
|
-
</
|
|
236
|
+
</button>
|
|
237
|
+
</Transition>
|
|
163
238
|
|
|
164
|
-
|
|
165
|
-
<div
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
239
|
+
<Transition name="jun-globe-panel">
|
|
240
|
+
<div
|
|
241
|
+
v-if="!collapsed"
|
|
242
|
+
class="jun-bar jun-globe-editor jun-chrome"
|
|
243
|
+
:data-jun-corner="corner"
|
|
244
|
+
>
|
|
245
|
+
<!-- Header. The totals ARE the headline: how far, how long, how many
|
|
246
|
+
legs, so the panel answers the obvious question without scrolling. -->
|
|
247
|
+
<header class="jun-globe-head">
|
|
248
|
+
<UIcon
|
|
249
|
+
name="i-lucide-route"
|
|
250
|
+
class="size-4 shrink-0 opacity-60"
|
|
251
|
+
/>
|
|
252
|
+
<div class="min-w-0 flex-1">
|
|
253
|
+
<div class="text-sm font-semibold">
|
|
254
|
+
Routes
|
|
255
|
+
</div>
|
|
256
|
+
<!-- Distance leads when there IS one. A leg only carries `routeKm`
|
|
257
|
+
once it has been generated, and a seeded or hand-written route
|
|
258
|
+
has none — reporting "0 km · 3 legs" states a measurement that was
|
|
259
|
+
never taken, which is worse than saying nothing about distance. -->
|
|
260
|
+
<div class="jun-globe-sub tabular-nums">
|
|
261
|
+
<template v-if="totals.km">
|
|
262
|
+
{{ humanKm(totals.km) }} km<template v-if="totals.min">
|
|
263
|
+
· {{ humanDuration(totals.min) }}
|
|
264
|
+
</template> ·
|
|
265
|
+
</template>
|
|
266
|
+
<template v-if="totals.legs">
|
|
267
|
+
{{ totals.legs }} leg{{ totals.legs === 1 ? "" : "s" }}
|
|
268
|
+
</template>
|
|
269
|
+
<template v-else>
|
|
270
|
+
{{ waypoints.length }} waypoint{{ waypoints.length === 1 ? "" : "s" }}
|
|
271
|
+
</template>
|
|
272
|
+
</div>
|
|
273
|
+
</div>
|
|
274
|
+
<button
|
|
275
|
+
v-if="totals.legs"
|
|
276
|
+
type="button"
|
|
277
|
+
class="jun-globe-icon"
|
|
278
|
+
:class="regeneratingAll ? 'is-busy' : ''"
|
|
279
|
+
:disabled="regeneratingAll"
|
|
280
|
+
aria-label="Regenerate every leg"
|
|
281
|
+
title="Regenerate every leg"
|
|
282
|
+
@click="regenerateAll()"
|
|
183
283
|
>
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
:icon="addingModel ? 'i-lucide-map-pin-check' : 'i-lucide-map-pin-plus'"
|
|
189
|
-
size="sm"
|
|
190
|
-
block
|
|
191
|
-
:color="addingModel ? 'primary' : 'neutral'"
|
|
192
|
-
:variant="addingModel ? 'solid' : 'soft'"
|
|
193
|
-
@click="addingModel = !addingModel"
|
|
194
|
-
>
|
|
195
|
-
{{ addingModel ? "Click the globe to drop\u2026" : "Drop on map" }}
|
|
196
|
-
</UButton>
|
|
197
|
-
</div>
|
|
198
|
-
|
|
199
|
-
<!-- Waypoint list -->
|
|
200
|
-
<div class="flex-1 min-h-0 overflow-y-auto p-2 space-y-1.5">
|
|
201
|
-
<p
|
|
202
|
-
v-if="!waypoints.length"
|
|
203
|
-
class="text-xs text-muted text-center py-6"
|
|
204
|
-
>
|
|
205
|
-
No waypoints yet. Search a place or drop one on the globe.
|
|
206
|
-
</p>
|
|
207
|
-
|
|
208
|
-
<div
|
|
209
|
-
v-for="(wp, i) in waypoints"
|
|
210
|
-
:key="wp.id"
|
|
211
|
-
class="rounded-lg bg-muted border border-default p-2 space-y-2"
|
|
212
|
-
>
|
|
213
|
-
<!-- Label + fly + delete -->
|
|
214
|
-
<div class="flex items-center gap-1.5">
|
|
215
|
-
<span
|
|
216
|
-
class="size-2.5 rounded-full flex-none"
|
|
217
|
-
:style="{ background: wp.meta?.color || TRANSPORT[normalizeTransport(wp.meta?.transport)].color }"
|
|
284
|
+
<UIcon
|
|
285
|
+
:name="regeneratingAll ? 'i-lucide-loader-circle' : 'i-lucide-refresh-cw'"
|
|
286
|
+
class="size-3.5"
|
|
287
|
+
:class="regeneratingAll ? 'animate-spin' : ''"
|
|
218
288
|
/>
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
@click="emit('select', wp)"
|
|
231
|
-
/>
|
|
232
|
-
<UButton
|
|
233
|
-
icon="i-lucide-trash-2"
|
|
234
|
-
size="xs"
|
|
235
|
-
color="error"
|
|
236
|
-
variant="ghost"
|
|
237
|
-
aria-label="Delete"
|
|
238
|
-
@click="remove(wp)"
|
|
289
|
+
</button>
|
|
290
|
+
<button
|
|
291
|
+
type="button"
|
|
292
|
+
class="jun-globe-icon"
|
|
293
|
+
aria-label="Collapse routes panel"
|
|
294
|
+
title="Collapse"
|
|
295
|
+
@click="collapsed = true"
|
|
296
|
+
>
|
|
297
|
+
<UIcon
|
|
298
|
+
name="i-lucide-chevrons-down-up"
|
|
299
|
+
class="size-3.5"
|
|
239
300
|
/>
|
|
240
|
-
</
|
|
301
|
+
</button>
|
|
302
|
+
</header>
|
|
241
303
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
<
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
:
|
|
261
|
-
|
|
304
|
+
<!-- Add by search, or by dropping on the globe. -->
|
|
305
|
+
<div class="jun-globe-add">
|
|
306
|
+
<UInput
|
|
307
|
+
v-model="query"
|
|
308
|
+
icon="i-lucide-search"
|
|
309
|
+
size="sm"
|
|
310
|
+
placeholder="Search a place to add…"
|
|
311
|
+
:loading="searching"
|
|
312
|
+
class="w-full"
|
|
313
|
+
@keydown="onSearchKeydown"
|
|
314
|
+
/>
|
|
315
|
+
<Transition name="jun-globe-results">
|
|
316
|
+
<ul
|
|
317
|
+
v-if="results.length"
|
|
318
|
+
class="jun-globe-results"
|
|
319
|
+
>
|
|
320
|
+
<li
|
|
321
|
+
v-for="(r, ri) in results"
|
|
322
|
+
:key="`${r.lng},${r.lat}`"
|
|
323
|
+
class="jun-globe-result"
|
|
324
|
+
:class="ri === cursor ? 'is-cursor' : ''"
|
|
325
|
+
@click="pickResult(r)"
|
|
326
|
+
@mouseenter="cursor = ri"
|
|
262
327
|
>
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
<!-- Transport mode for the leg arriving here (skip for first waypoint) -->
|
|
273
|
-
<div
|
|
274
|
-
v-if="i > 0"
|
|
275
|
-
class="flex items-center gap-1"
|
|
328
|
+
{{ r.label }}
|
|
329
|
+
</li>
|
|
330
|
+
</ul>
|
|
331
|
+
</Transition>
|
|
332
|
+
<button
|
|
333
|
+
type="button"
|
|
334
|
+
class="jun-globe-drop"
|
|
335
|
+
:class="addingModel ? 'is-on' : ''"
|
|
336
|
+
@click="addingModel = !addingModel"
|
|
276
337
|
>
|
|
277
|
-
<
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
:icon="TRANSPORT[m].icon"
|
|
281
|
-
size="xs"
|
|
282
|
-
:color="normalizeTransport(wp.meta?.transport) === m ? 'primary' : 'neutral'"
|
|
283
|
-
:variant="normalizeTransport(wp.meta?.transport) === m ? 'solid' : 'ghost'"
|
|
284
|
-
:aria-label="TRANSPORT[m].label"
|
|
285
|
-
@click="setMode(wp, i, m)"
|
|
286
|
-
/>
|
|
287
|
-
<UButton
|
|
288
|
-
:icon="busyId === wp.id ? 'i-lucide-loader-circle' : 'i-lucide-refresh-cw'"
|
|
289
|
-
:class="{ 'animate-spin': busyId === wp.id }"
|
|
290
|
-
size="xs"
|
|
291
|
-
color="neutral"
|
|
292
|
-
variant="ghost"
|
|
293
|
-
class="ml-auto"
|
|
294
|
-
aria-label="Regenerate route"
|
|
295
|
-
@click="regenerate(wp, i)"
|
|
338
|
+
<UIcon
|
|
339
|
+
:name="addingModel ? 'i-lucide-map-pin-check' : 'i-lucide-map-pin-plus'"
|
|
340
|
+
class="size-3.5"
|
|
296
341
|
/>
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
342
|
+
{{ addingModel ? "Click the globe to drop\u2026" : "Drop on map" }}
|
|
343
|
+
</button>
|
|
344
|
+
</div>
|
|
345
|
+
|
|
346
|
+
<!-- The route itself. -->
|
|
347
|
+
<div class="jun-globe-list">
|
|
302
348
|
<p
|
|
303
|
-
v-
|
|
304
|
-
class="
|
|
349
|
+
v-if="!waypoints.length"
|
|
350
|
+
class="jun-globe-empty"
|
|
305
351
|
>
|
|
306
|
-
|
|
352
|
+
No waypoints yet.<br>Search a place, or drop one on the globe.
|
|
307
353
|
</p>
|
|
354
|
+
|
|
355
|
+
<TransitionGroup name="jun-globe-wp">
|
|
356
|
+
<div
|
|
357
|
+
v-for="(wp, i) in waypoints"
|
|
358
|
+
:key="wp.id"
|
|
359
|
+
class="jun-globe-stop"
|
|
360
|
+
>
|
|
361
|
+
<!-- THE LEG ARRIVING HERE. Its own row, beside a connector that
|
|
362
|
+
runs continuously from the previous waypoint's dot down to this
|
|
363
|
+
one, drawn in that leg's own colour and dash — the same two the
|
|
364
|
+
map uses. -->
|
|
365
|
+
<div
|
|
366
|
+
v-if="i > 0"
|
|
367
|
+
class="jun-globe-leg"
|
|
368
|
+
>
|
|
369
|
+
<span class="jun-globe-gutter">
|
|
370
|
+
<span
|
|
371
|
+
class="jun-globe-line"
|
|
372
|
+
:style="{ borderColor: legColor(wp), borderStyle: legDash(wp) ? 'dashed' : 'solid' }"
|
|
373
|
+
/>
|
|
374
|
+
</span>
|
|
375
|
+
<div class="jun-globe-leg-body">
|
|
376
|
+
<div class="jun-globe-modes">
|
|
377
|
+
<button
|
|
378
|
+
v-for="m in TRANSPORT_MODES"
|
|
379
|
+
:key="m"
|
|
380
|
+
type="button"
|
|
381
|
+
class="jun-globe-mode"
|
|
382
|
+
:class="normalizeTransport(wp.meta?.transport) === m ? 'is-on' : ''"
|
|
383
|
+
:style="normalizeTransport(wp.meta?.transport) === m ? { color: legColor(wp) } : void 0"
|
|
384
|
+
:aria-label="TRANSPORT[m].label"
|
|
385
|
+
:title="TRANSPORT[m].label"
|
|
386
|
+
@click="setMode(wp, i, m)"
|
|
387
|
+
>
|
|
388
|
+
<UIcon
|
|
389
|
+
:name="TRANSPORT[m].icon"
|
|
390
|
+
class="size-3.5"
|
|
391
|
+
/>
|
|
392
|
+
</button>
|
|
393
|
+
</div>
|
|
394
|
+
<span
|
|
395
|
+
v-if="wp.meta?.routeKm"
|
|
396
|
+
class="jun-globe-dist tabular-nums"
|
|
397
|
+
>
|
|
398
|
+
{{ humanKm(Number(wp.meta.routeKm)) }} km<template v-if="wp.meta?.routeMin"> · {{ humanDuration(Number(wp.meta.routeMin)) }}</template>
|
|
399
|
+
</span>
|
|
400
|
+
<button
|
|
401
|
+
type="button"
|
|
402
|
+
class="jun-globe-icon ml-auto"
|
|
403
|
+
:aria-label="`Regenerate the leg into ${wp.label}`"
|
|
404
|
+
title="Regenerate this leg"
|
|
405
|
+
@click="regenerate(wp, i)"
|
|
406
|
+
>
|
|
407
|
+
<UIcon
|
|
408
|
+
:name="busyId === wp.id ? 'i-lucide-loader-circle' : 'i-lucide-refresh-cw'"
|
|
409
|
+
class="size-3"
|
|
410
|
+
:class="busyId === wp.id ? 'animate-spin' : ''"
|
|
411
|
+
/>
|
|
412
|
+
</button>
|
|
413
|
+
</div>
|
|
414
|
+
</div>
|
|
415
|
+
|
|
416
|
+
<!-- THE WAYPOINT. Its dot is NEUTRAL: the colour on this row used
|
|
417
|
+
to be `legColor(wp)`, which is the colour of the leg ARRIVING
|
|
418
|
+
here — so the first waypoint, which has no arriving leg at all,
|
|
419
|
+
was painted in the default mode's red and claimed a journey it
|
|
420
|
+
is only the start of. A place is not a mode of travel. -->
|
|
421
|
+
<div class="jun-globe-wp">
|
|
422
|
+
<span class="jun-globe-gutter is-stop">
|
|
423
|
+
<span class="jun-globe-dot" />
|
|
424
|
+
<!-- The tail below this dot belongs to the NEXT leg, and is
|
|
425
|
+
drawn in that leg's colour. Half the connector lives here
|
|
426
|
+
and half in the next stop's leg row; between them the line
|
|
427
|
+
is continuous from dot to dot without any row needing to
|
|
428
|
+
know how tall its neighbour is. -->
|
|
429
|
+
<span
|
|
430
|
+
v-if="waypoints[i + 1]"
|
|
431
|
+
class="jun-globe-line is-tail"
|
|
432
|
+
:style="{ borderColor: legColor(waypoints[i + 1]), borderStyle: legDash(waypoints[i + 1]) ? 'dashed' : 'solid' }"
|
|
433
|
+
/>
|
|
434
|
+
</span>
|
|
435
|
+
<div class="jun-globe-wp-body">
|
|
436
|
+
<div class="jun-globe-wp-top">
|
|
437
|
+
<input
|
|
438
|
+
:value="wp.label"
|
|
439
|
+
class="jun-globe-name"
|
|
440
|
+
:aria-label="`Rename ${wp.label}`"
|
|
441
|
+
@change="rename(wp, $event.target.value)"
|
|
442
|
+
>
|
|
443
|
+
<button
|
|
444
|
+
type="button"
|
|
445
|
+
class="jun-globe-icon"
|
|
446
|
+
aria-label="Fly here"
|
|
447
|
+
title="Fly here"
|
|
448
|
+
@click="emit('select', wp)"
|
|
449
|
+
>
|
|
450
|
+
<UIcon
|
|
451
|
+
name="i-lucide-locate"
|
|
452
|
+
class="size-3"
|
|
453
|
+
/>
|
|
454
|
+
</button>
|
|
455
|
+
<button
|
|
456
|
+
type="button"
|
|
457
|
+
class="jun-globe-icon"
|
|
458
|
+
:aria-label="`Delete ${wp.label}`"
|
|
459
|
+
title="Delete"
|
|
460
|
+
@click="remove(wp, i)"
|
|
461
|
+
>
|
|
462
|
+
<UIcon
|
|
463
|
+
name="i-lucide-trash-2"
|
|
464
|
+
class="size-3"
|
|
465
|
+
/>
|
|
466
|
+
</button>
|
|
467
|
+
</div>
|
|
468
|
+
<div class="jun-globe-wp-meta">
|
|
469
|
+
<!-- The date is the ORDER — the renderer sorts on it — so it
|
|
470
|
+
leads the row rather than sitting beside a colour picker. -->
|
|
471
|
+
<AMetaChip
|
|
472
|
+
field-type="date"
|
|
473
|
+
label="Date"
|
|
474
|
+
:meta="wp.meta ?? {}"
|
|
475
|
+
meta-key="date"
|
|
476
|
+
@patch="tree.updateMeta(wp.id, $event)"
|
|
477
|
+
/>
|
|
478
|
+
<span
|
|
479
|
+
v-if="i === 0"
|
|
480
|
+
class="jun-globe-start"
|
|
481
|
+
>Start</span>
|
|
482
|
+
<button
|
|
483
|
+
type="button"
|
|
484
|
+
class="jun-globe-swatch ml-auto"
|
|
485
|
+
:style="{ background: legColor(wp) }"
|
|
486
|
+
:aria-label="`Colour for ${wp.label}`"
|
|
487
|
+
title="Leg colour"
|
|
488
|
+
@click="paletteFor = paletteFor === wp.id ? null : wp.id"
|
|
489
|
+
/>
|
|
490
|
+
</div>
|
|
491
|
+
<!-- One palette open at a time. Collapsed by default, because
|
|
492
|
+
eight swatches per waypoint is what made this a rainbow. -->
|
|
493
|
+
<Transition name="jun-globe-results">
|
|
494
|
+
<div
|
|
495
|
+
v-if="paletteFor === wp.id"
|
|
496
|
+
class="jun-globe-palette"
|
|
497
|
+
>
|
|
498
|
+
<button
|
|
499
|
+
v-for="c in COLOR_SWATCHES"
|
|
500
|
+
:key="c.value || 'none'"
|
|
501
|
+
type="button"
|
|
502
|
+
class="jun-globe-swatch"
|
|
503
|
+
:class="(wp.meta?.color || '') === c.value ? 'is-on' : ''"
|
|
504
|
+
:style="{ background: c.value || 'transparent' }"
|
|
505
|
+
:aria-label="c.label"
|
|
506
|
+
:title="c.label"
|
|
507
|
+
@click="setColor(wp, c.value)"
|
|
508
|
+
>
|
|
509
|
+
<UIcon
|
|
510
|
+
v-if="!c.value"
|
|
511
|
+
name="i-lucide-slash"
|
|
512
|
+
class="size-3 opacity-50"
|
|
513
|
+
/>
|
|
514
|
+
</button>
|
|
515
|
+
</div>
|
|
516
|
+
</Transition>
|
|
517
|
+
</div>
|
|
518
|
+
</div>
|
|
519
|
+
</div>
|
|
520
|
+
</TransitionGroup>
|
|
308
521
|
</div>
|
|
309
522
|
</div>
|
|
310
|
-
</
|
|
523
|
+
</Transition>
|
|
311
524
|
</template>
|
|
312
525
|
|
|
313
526
|
<style scoped>
|
|
314
|
-
.jun-globe-editor{border-radius:14px;flex-direction:column;max-height:calc(
|
|
527
|
+
.jun-globe-editor{border-radius:14px;display:flex;flex-direction:column;max-height:calc(100dvh - var(--jun-chrome-top, 1rem) - var(--jun-chrome-bottom, 1rem) - 5rem);max-width:calc(100vw - 2rem);overflow:hidden;width:20rem}.jun-globe-editor-chip{align-items:center;border-radius:9999px;cursor:pointer;display:flex;gap:.375rem;padding:.375rem .75rem}.jun-globe-head{align-items:center;border-bottom:1px solid color-mix(in srgb,currentColor 10%,transparent);display:flex;gap:.5rem;padding:.625rem .75rem}.jun-globe-sub{font-size:10px;line-height:1.3;margin-top:1px;opacity:.55}.jun-globe-add{border-bottom:1px solid color-mix(in srgb,currentColor 10%,transparent);display:flex;flex-direction:column;gap:.5rem;padding:.75rem}.jun-globe-results{background:var(--color-neutral-100);border-radius:.5rem;box-shadow:inset 0 0 0 1px color-mix(in srgb,currentColor 10%,transparent);overflow:hidden}:root.dark .jun-globe-results{background:var(--color-neutral-800)}.jun-globe-result{cursor:pointer;font-size:11px;overflow:hidden;padding:.375rem .625rem;text-overflow:ellipsis;transition:background-color .15s ease;white-space:nowrap}.jun-globe-result.is-cursor{background:color-mix(in srgb,currentColor 10%,transparent)}.jun-globe-drop{align-items:center;background:color-mix(in srgb,currentColor 7%,transparent);border-radius:.5rem;cursor:pointer;display:flex;font-size:12px;gap:.375rem;justify-content:center;padding:.375rem .625rem;transition:background-color .2s ease,color .2s ease;width:100%}.jun-globe-drop:hover{background:color-mix(in srgb,currentColor 12%,transparent)}.jun-globe-drop.is-on{background:var(--color-neutral-900);color:var(--color-neutral-50)}:root.dark .jun-globe-drop.is-on{background:var(--color-neutral-100);color:var(--color-neutral-900)}.jun-globe-list{flex:1;min-height:0;overflow-y:auto;padding:.5rem .75rem .75rem;position:relative}.jun-globe-empty{font-size:11px;line-height:1.6;opacity:.5;padding:1.5rem 0;text-align:center}.jun-globe-stop{display:flex;flex-direction:column}.jun-globe-leg{align-items:stretch;display:flex;gap:.5rem;min-height:2rem}.jun-globe-gutter{display:flex;flex:none;justify-content:center;width:.625rem}.jun-globe-gutter.is-stop{align-items:center;flex-direction:column}.jun-globe-line{border-left-width:2px;opacity:.6;transition:border-color .3s ease;width:0}.jun-globe-leg .jun-globe-line{margin-bottom:-.375rem}.jun-globe-line.is-tail{flex:1;margin-top:.125rem;min-height:.25rem}.jun-globe-leg-body{align-items:center;display:flex;flex:1;gap:.375rem;min-width:0;padding:.25rem 0}.jun-globe-modes{align-items:center;display:flex;gap:1px}.jun-globe-mode{align-items:center;border-radius:.375rem;cursor:pointer;display:flex;height:1.5rem;justify-content:center;opacity:.35;transition:opacity .2s ease,background-color .2s ease,transform .2s cubic-bezier(.22,1,.36,1);width:1.5rem}.jun-globe-mode:hover{background:color-mix(in srgb,currentColor 8%,transparent);opacity:.7}.jun-globe-mode.is-on{background:color-mix(in srgb,currentColor 14%,transparent);opacity:1}.jun-globe-dist{font-size:10px;opacity:.55;white-space:nowrap}.jun-globe-wp{align-items:stretch;display:flex;gap:.5rem}.jun-globe-dot{background:var(--color-neutral-50);border-radius:999px;box-shadow:inset 0 0 0 2px color-mix(in srgb,currentColor 55%,transparent);flex:none;height:.625rem;margin-top:.3125rem;width:.625rem}:root.dark .jun-globe-dot{background:var(--color-neutral-900)}.jun-globe-wp-body{flex:1;min-width:0}.jun-globe-wp-top{align-items:center;display:flex;gap:.125rem}.jun-globe-name{background:transparent;border-bottom:1px solid transparent;color:inherit;flex:1;font-size:13px;font-weight:500;min-width:0;outline:none;padding:1px 0;transition:border-color .2s ease}.jun-globe-name:focus{border-bottom-color:color-mix(in srgb,currentColor 45%,transparent)}.jun-globe-wp-meta{align-items:center;display:flex;gap:.375rem;margin-top:.125rem}.jun-globe-start{font-size:9px;letter-spacing:.08em;opacity:.4;text-transform:uppercase}.jun-globe-palette{align-items:center;display:flex;gap:.375rem;padding-top:.375rem}.jun-globe-swatch{align-items:center;border-radius:999px;box-shadow:inset 0 0 0 1px color-mix(in srgb,currentColor 30%,transparent);cursor:pointer;display:flex;flex:none;height:.75rem;justify-content:center;opacity:.85;transition:transform .18s cubic-bezier(.22,1,.36,1),box-shadow .18s ease,opacity .18s ease;width:.75rem}.jun-globe-swatch:hover{opacity:1;transform:scale(1.18)}.jun-globe-swatch.is-on{box-shadow:0 0 0 2px color-mix(in srgb,currentColor 65%,transparent)}.jun-globe-icon{align-items:center;border-radius:.375rem;cursor:pointer;display:flex;flex:none;height:1.375rem;justify-content:center;opacity:.45;transition:opacity .2s ease,background-color .2s ease;width:1.375rem}.jun-globe-icon:hover{background:color-mix(in srgb,currentColor 10%,transparent);opacity:1}.jun-globe-icon:disabled{cursor:default}.jun-globe-icon.is-busy{opacity:.8}.jun-globe-panel-enter-active,.jun-globe-panel-leave-active{transition:opacity .28s ease,transform .28s cubic-bezier(.22,1,.36,1)}.jun-globe-panel-enter-from,.jun-globe-panel-leave-to{opacity:0;transform:translateY(-8px) scale(.98)}.jun-globe-results-enter-active,.jun-globe-results-leave-active{display:grid;grid-template-rows:1fr;overflow:hidden;transition:opacity .2s ease,grid-template-rows .24s cubic-bezier(.22,1,.36,1)}.jun-globe-results-enter-from,.jun-globe-results-leave-to{grid-template-rows:0fr;opacity:0}.jun-globe-wp-enter-active,.jun-globe-wp-leave-active,.jun-globe-wp-move{transition:opacity .28s ease,transform .28s cubic-bezier(.22,1,.36,1)}.jun-globe-wp-enter-from,.jun-globe-wp-leave-to{opacity:0;transform:translateX(10px)}.jun-globe-wp-leave-active{position:absolute;width:calc(100% - 1.5rem)}@media (prefers-reduced-motion:reduce){.jun-globe-icon,.jun-globe-mode,.jun-globe-panel-enter-active,.jun-globe-panel-leave-active,.jun-globe-results-enter-active,.jun-globe-results-leave-active,.jun-globe-swatch,.jun-globe-wp-enter-active,.jun-globe-wp-leave-active,.jun-globe-wp-move{transition:none}.jun-globe-swatch:hover{transform:none}}
|
|
315
528
|
</style>
|
|
@@ -53,6 +53,7 @@ function buildMarkerEl(wp) {
|
|
|
53
53
|
const container = document.createElement("div");
|
|
54
54
|
container.className = "jun-map-marker";
|
|
55
55
|
container.dataset.id = wp.id;
|
|
56
|
+
container.dataset.junAnchor = `map:${wp.id}`;
|
|
56
57
|
const orb = document.createElement("div");
|
|
57
58
|
orb.className = "jun-map-orb";
|
|
58
59
|
orb.style.setProperty("--c", color);
|