A music player that connects to your cloud/distributed storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: make generated split-view remember divider positions

+22 -4
+22 -4
src/facets/tools/split-view.inline.js
··· 24 24 * @typedef {PaneNode | SplitNode} Node 25 25 */ 26 26 27 - const STORAGE_KEY = "diffuse:split-view:layout"; 27 + const STORAGE_KEY = "diffuse/facets/tools/split-view/builder/layout"; 28 28 29 29 // ─── State ─────────────────────────────────────────────────────────────────── 30 30 ··· 366 366 return `${indent}<div class="pane"></div>`; 367 367 } 368 368 369 - function generateSimplifiedHTML() { 369 + /** 370 + * @param {string} id 371 + */ 372 + function generateSimplifiedHTML(id) { 370 373 const scriptClose = "</" + "script>"; 371 374 return `\ 372 375 <link rel="stylesheet" href="vendor/@awesome.me/webawesome/styles/themes/default.css" /> ··· 401 404 document.addEventListener("mouseup", () => { 402 405 layout.classList.remove("dragging"); 403 406 }); 407 + 408 + const POSITIONS_KEY = "diffuse/facets/tools/split-view/${id}/positions"; 409 + const savedPositions = (() => { 410 + try { return JSON.parse(localStorage.getItem(POSITIONS_KEY) ?? "{}"); } 411 + catch { return {}; } 412 + })(); 413 + 414 + document.querySelectorAll("wa-split-panel").forEach((panel, i) => { 415 + if (savedPositions[i] !== undefined) panel.position = savedPositions[i]; 416 + panel.addEventListener("wa-reposition", () => { 417 + savedPositions[i] = panel.position; 418 + localStorage.setItem(POSITIONS_KEY, JSON.stringify(savedPositions)); 419 + }); 420 + }); 404 421 ${scriptClose}`; 405 422 } 406 423 ··· 408 425 const output = foundation.orchestrator.output(); 409 426 await Output.waitUntilLoaded(output.facets); 410 427 411 - const html = generateSimplifiedHTML(); 428 + const id = crypto.randomUUID(); 429 + const html = generateSimplifiedHTML(id); 412 430 const now = new Date().toISOString(); 413 431 414 432 await output.facets.save([ 415 433 ...output.facets.collection(), 416 434 { 417 435 $type: "sh.diffuse.output.facet", 418 - id: crypto.randomUUID(), 436 + id, 419 437 name: "Split View", 420 438 html, 421 439 createdAt: now,