backpack-viewer 0.7.13 → 0.7.15
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/app/assets/index-Cab62Pxr.css +1 -0
- package/dist/app/assets/index-DpElI3pz.js +6 -0
- package/dist/app/assets/index-Dz__sU13.js +12 -0
- package/dist/app/assets/layout-worker-4xak23M6.js +1 -0
- package/dist/app/index.html +18 -0
- package/dist/extensions/share/index-B8_hkT8R.js +6277 -0
- package/dist/extensions/share/src/index.js +300 -520
- package/dist/server-api-routes.js +19 -0
- package/dist/sidebar.js +18 -2
- package/dist/style.css +16 -0
- package/package.json +3 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { listBackpacks, getActiveBackpack, setActiveBackpack, registerBackpack, unregisterBackpack, } from "backpack-ontology";
|
|
2
|
+
import { readExtensionSettings } from "./server-extensions.js";
|
|
2
3
|
// --- Small HTTP helpers (used only inside this module) ---
|
|
3
4
|
function readBody(req) {
|
|
4
5
|
return new Promise((resolve, reject) => {
|
|
@@ -375,6 +376,24 @@ export async function handleApiRequest(req, res, ctx) {
|
|
|
375
376
|
}
|
|
376
377
|
return true;
|
|
377
378
|
}
|
|
379
|
+
// --- /api/sync-status ---
|
|
380
|
+
if (url === "/api/sync-status" && method === "GET") {
|
|
381
|
+
try {
|
|
382
|
+
const settings = await readExtensionSettings("share");
|
|
383
|
+
const syncedMap = settings.synced;
|
|
384
|
+
const synced = [];
|
|
385
|
+
if (syncedMap && typeof syncedMap === "object" && !Array.isArray(syncedMap)) {
|
|
386
|
+
for (const name of Object.keys(syncedMap)) {
|
|
387
|
+
synced.push(name);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
sendJson(res, 200, { synced });
|
|
391
|
+
}
|
|
392
|
+
catch {
|
|
393
|
+
sendJson(res, 200, { synced: [] });
|
|
394
|
+
}
|
|
395
|
+
return true;
|
|
396
|
+
}
|
|
378
397
|
// --- /api/ontologies/* ---
|
|
379
398
|
if (url === "/api/ontologies" && method === "GET") {
|
|
380
399
|
try {
|
package/dist/sidebar.js
CHANGED
|
@@ -254,6 +254,10 @@ export function initSidebar(container, onSelectOrCallbacks) {
|
|
|
254
254
|
const lockBatchPromise = fetch("/api/locks")
|
|
255
255
|
.then((r) => r.json())
|
|
256
256
|
.catch(() => ({}));
|
|
257
|
+
const syncStatusPromise = fetch("/api/sync-status")
|
|
258
|
+
.then((r) => r.json())
|
|
259
|
+
.then((d) => new Set(d.synced))
|
|
260
|
+
.catch(() => new Set());
|
|
257
261
|
items = summaries.map((s) => {
|
|
258
262
|
const li = document.createElement("li");
|
|
259
263
|
li.className = "ontology-item";
|
|
@@ -273,8 +277,6 @@ export function initSidebar(container, onSelectOrCallbacks) {
|
|
|
273
277
|
lockBadge.className = "sidebar-lock-badge";
|
|
274
278
|
lockBadge.dataset.graph = s.name;
|
|
275
279
|
lockBatchPromise.then((locks) => {
|
|
276
|
-
// Bail if this badge has been detached from the DOM (sidebar
|
|
277
|
-
// re-rendered before the batch resolved)
|
|
278
280
|
if (!lockBadge.isConnected)
|
|
279
281
|
return;
|
|
280
282
|
const lock = locks[s.name];
|
|
@@ -284,9 +286,23 @@ export function initSidebar(container, onSelectOrCallbacks) {
|
|
|
284
286
|
lockBadge.classList.add("active");
|
|
285
287
|
}
|
|
286
288
|
});
|
|
289
|
+
// Sync badge — shows a cloud icon for graphs that have been synced
|
|
290
|
+
const syncBadge = document.createElement("span");
|
|
291
|
+
syncBadge.className = "sidebar-sync-badge";
|
|
292
|
+
syncBadge.dataset.graph = s.name;
|
|
293
|
+
syncStatusPromise.then((syncedSet) => {
|
|
294
|
+
if (!syncBadge.isConnected)
|
|
295
|
+
return;
|
|
296
|
+
if (syncedSet.has(s.name)) {
|
|
297
|
+
syncBadge.textContent = "synced";
|
|
298
|
+
syncBadge.title = "This graph has been synced";
|
|
299
|
+
syncBadge.classList.add("active");
|
|
300
|
+
}
|
|
301
|
+
});
|
|
287
302
|
li.appendChild(nameSpan);
|
|
288
303
|
li.appendChild(statsSpan);
|
|
289
304
|
li.appendChild(lockBadge);
|
|
305
|
+
li.appendChild(syncBadge);
|
|
290
306
|
li.appendChild(branchSpan);
|
|
291
307
|
if (cbs.onRename) {
|
|
292
308
|
const editBtn = document.createElement("button");
|
package/dist/style.css
CHANGED
|
@@ -506,6 +506,22 @@ body {
|
|
|
506
506
|
color: #c08c00;
|
|
507
507
|
}
|
|
508
508
|
|
|
509
|
+
.sidebar-sync-badge {
|
|
510
|
+
font-size: 10px;
|
|
511
|
+
color: #5a9fd4;
|
|
512
|
+
display: none;
|
|
513
|
+
margin-top: 2px;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
.sidebar-sync-badge.active {
|
|
517
|
+
display: block;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
.sidebar-sync-badge.active::before {
|
|
521
|
+
content: "☁ ";
|
|
522
|
+
color: #5a9fd4;
|
|
523
|
+
}
|
|
524
|
+
|
|
509
525
|
.branch-picker {
|
|
510
526
|
background: var(--bg-surface);
|
|
511
527
|
border: 1px solid var(--border);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "backpack-viewer",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.15",
|
|
4
4
|
"description": "Web-based graph visualizer for backpack-ontology — Canvas 2D, force-directed layout, live reload",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Noah Irzinger",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"build": "npm run build:lib && node scripts/bundle-extensions.js && vite build",
|
|
19
19
|
"preview": "vite preview",
|
|
20
20
|
"serve": "node bin/serve.js",
|
|
21
|
-
"prepare": "npm run build:lib",
|
|
21
|
+
"prepare": "test -d dist || npm run build:lib",
|
|
22
|
+
"prepublishOnly": "npm run build",
|
|
22
23
|
"preversion": "npm run build",
|
|
23
24
|
"release:patch": "npm version patch && git push && git push --tags",
|
|
24
25
|
"release:minor": "npm version minor && git push && git push --tags",
|