Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dist/components/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/components/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

30 changes: 27 additions & 3 deletions src/components/scripts/explorer.inline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,7 @@ function renderTree(node, container, currentSlug, folderBehavior, savedState, pa
simpleFolderPath &&
simpleFolderPath === simplifiedCurrentSlug.slice(0, simpleFolderPath.length);

if ((!isCollapsed || folderIsPrefixOfCurrentSlug) && folderOuter) {
folderOuter.classList.add("open");
}
const shouldOpen = (!isCollapsed || folderIsPrefixOfCurrentSlug);

// Render children
if (node.children && node.children.length > 0 && contentUl) {
Expand All @@ -220,6 +218,16 @@ function renderTree(node, container, currentSlug, folderBehavior, savedState, pa
}

container.appendChild(clone);

if (shouldOpen) {
const appendedFolderOuter = container.lastElementChild?.querySelector(".folder-outer");
if (appendedFolderOuter) {
appendedFolderOuter.style.transition = "none";
appendedFolderOuter.offsetHeight; // force reflow
appendedFolderOuter.classList.add("open");
}
}

} else if (node.data) {
const clone = fileTemplate.content.cloneNode(true);
const link = clone.querySelector("a");
Expand All @@ -232,6 +240,7 @@ function renderTree(node, container, currentSlug, folderBehavior, savedState, pa
}
container.appendChild(clone);
}

}

async function handleNavOrRender(e) {
Expand Down Expand Up @@ -282,6 +291,14 @@ async function handleNavOrRender(e) {
for (const child of trie.children) {
renderTree(child, explorerUl, currentSlug, folderBehavior, savedState, "");
}
// ← tambah di sini, setelah loop render selesai
requestAnimationFrame(() => {
requestAnimationFrame(() => {
document.querySelectorAll(".folder-outer.open").forEach((el) => {
(el as HTMLElement).style.transition = "";
});
});
});
console.log("[Explorer] Render complete, final list length:", explorerUl.children.length);
} else {
console.warn("[Explorer] No trie or empty children");
Expand Down Expand Up @@ -399,9 +416,16 @@ async function handleNavOrRender(e) {
mobileExplorer.classList.remove("hide-until-loaded");

if (mobileExplorer.checkVisibility && mobileExplorer.checkVisibility()) {
const content = explorer.querySelector(".explorer-content") as HTMLElement;
if (content) content.style.transition = "none";
explorer.classList.add("collapsed");
explorer.setAttribute("aria-expanded", "false");
document.documentElement.classList.remove("mobile-no-scroll");
requestAnimationFrame(() => {
requestAnimationFrame(() => {
if (content) content.style.transition = "";
});
});
}
}
} catch (err) {
Expand Down
4 changes: 4 additions & 0 deletions src/components/styles/explorer.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.preload *, .explorer-content .folder-outer.no-transition {
transition: none !important;
}

@media all and (max-width: 800px) {
.page > #quartz-body > :not(.sidebar.left:has(.explorer)) {
transition: transform 300ms ease-in-out;
Expand Down