This commit is contained in:
parent
5d5af62baf
commit
bd9c74d6f3
@ -6,6 +6,9 @@ import wasmPack from 'vite-plugin-wasm-pack';
|
|||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
prefetch: {
|
||||||
|
prefetchAll: true
|
||||||
|
},
|
||||||
integrations: [mdx()],
|
integrations: [mdx()],
|
||||||
markdown: {
|
markdown: {
|
||||||
remarkPlugins: [
|
remarkPlugins: [
|
||||||
|
@ -104,6 +104,7 @@ select {
|
|||||||
border-radius: 1em;
|
border-radius: 1em;
|
||||||
border: 1px solid var(--blog_content-border);
|
border: 1px solid var(--blog_content-border);
|
||||||
background: var(--blog_background-main);
|
background: var(--blog_background-main);
|
||||||
|
color: var(--blog_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ const { title, showAfterMain, mainTransitionName } = Astro.props;
|
|||||||
<header transition:persist="nav">
|
<header transition:persist="nav">
|
||||||
<Navbar />
|
<Navbar />
|
||||||
</header>
|
</header>
|
||||||
<main transition:name={ mainTransitionName }>
|
<main transition:name={ mainTransitionName || "main" }>
|
||||||
<slot />
|
<slot />
|
||||||
</main>
|
</main>
|
||||||
{showAfterMain ? <div class="after-main">
|
{showAfterMain ? <div class="after-main">
|
||||||
|
@ -46,5 +46,5 @@ if (diaryMain.data.repository) {
|
|||||||
{ diaryPages.map((page) => <li><a href={collectionBasePath + "/" + page.slug}>{page.data.title}</a></li>) }
|
{ diaryPages.map((page) => <li><a href={collectionBasePath + "/" + page.slug}>{page.data.title}</a></li>) }
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<DiaryNavBar collectionName={diary} slot="footer-nav" />
|
<DiaryNavBar collectionName={diary} slot="footer-nav" transition:name="diary-footer-nav" />
|
||||||
</MarkdownLayout>
|
</MarkdownLayout>
|
@ -30,5 +30,5 @@ const { Content } = await entry.render();
|
|||||||
<MarkdownLayout title={entry.data.site_title || entry.data.title} slug={entry.slug} srcPath={`${diary}/${entry.id}`} published={entry.data.published}>
|
<MarkdownLayout title={entry.data.site_title || entry.data.title} slug={entry.slug} srcPath={`${diary}/${entry.id}`} published={entry.data.published}>
|
||||||
<DiaryNavTop collectionName="rust" slot="main-nav" />
|
<DiaryNavTop collectionName="rust" slot="main-nav" />
|
||||||
<Content />
|
<Content />
|
||||||
<DiaryNavBar collectionName="rust" slot="footer-nav" />
|
<DiaryNavBar collectionName="rust" slot="footer-nav" transition:name="diary-footer-nav" />
|
||||||
</MarkdownLayout>
|
</MarkdownLayout>
|
||||||
|
@ -46,7 +46,20 @@ const wasmVersion = wasmData.version;
|
|||||||
const screens = document.querySelectorAll("[data-terminal-screen]") as NodeListOf<HTMLDivElement>;
|
const screens = document.querySelectorAll("[data-terminal-screen]") as NodeListOf<HTMLDivElement>;
|
||||||
const template = document.querySelector("[data-terminal-user-cmd]") as HTMLTemplateElement;
|
const template = document.querySelector("[data-terminal-user-cmd]") as HTMLTemplateElement;
|
||||||
|
|
||||||
screens.forEach((s) => s.addEventListener("click", () => inputs[0]?.focus()))
|
screens.forEach((s) => s.addEventListener("click", () => inputs[0]?.focus()));
|
||||||
|
|
||||||
|
screens.forEach((screen) => {
|
||||||
|
new MutationObserver((changes) => {
|
||||||
|
const totalNewHeight = changes.reduce((prev, change) => {
|
||||||
|
change.addedNodes.forEach(n => prev += (n as HTMLPreElement).clientHeight || 0);
|
||||||
|
return prev;
|
||||||
|
}, 0);
|
||||||
|
|
||||||
|
if (screen.scrollTop + screen.clientHeight >= screen.scrollHeight - totalNewHeight - 40) {
|
||||||
|
screen.scrollTo(0, screen.scrollHeight);
|
||||||
|
}
|
||||||
|
}).observe(screen, { childList: true, subtree: true });
|
||||||
|
});
|
||||||
|
|
||||||
const { default: init, Console } = await wasm;
|
const { default: init, Console } = await wasm;
|
||||||
|
|
||||||
@ -69,9 +82,11 @@ const wasmVersion = wasmData.version;
|
|||||||
inputLine.querySelector(".user-cmd")!.textContent = cmd;
|
inputLine.querySelector(".user-cmd")!.textContent = cmd;
|
||||||
inputLine.querySelector(".pwd")!.textContent = prevPwd;
|
inputLine.querySelector(".pwd")!.textContent = prevPwd;
|
||||||
outputs.forEach((output) => {
|
outputs.forEach((output) => {
|
||||||
output.prepend(inputLine);
|
output.append(inputLine);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
input.value = "";
|
||||||
|
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
const resp = c.execute(cmd);
|
const resp = c.execute(cmd);
|
||||||
|
|
||||||
@ -79,20 +94,15 @@ const wasmVersion = wasmData.version;
|
|||||||
const outputLine = document.createElement("pre");
|
const outputLine = document.createElement("pre");
|
||||||
outputLine.textContent = resp
|
outputLine.textContent = resp
|
||||||
outputs.forEach((output) => {
|
outputs.forEach((output) => {
|
||||||
output.prepend(outputLine);
|
output.append(outputLine);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
input.value = "";
|
|
||||||
updatePwd();
|
updatePwd();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
screens.forEach((screen) => {
|
|
||||||
new MutationObserver(() => screen.scrollTo(0, screen.scrollHeight)).observe(screen, { childList: true, subtree: true });
|
|
||||||
});
|
|
||||||
})()
|
})()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -127,7 +137,7 @@ const wasmVersion = wasmData.version;
|
|||||||
|
|
||||||
[data-terminal-output] {
|
[data-terminal-output] {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column-reverse;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,6 +174,7 @@ const wasmVersion = wasmData.version;
|
|||||||
appearance: none !important;
|
appearance: none !important;
|
||||||
outline: none;
|
outline: none;
|
||||||
caret-shape: block;
|
caret-shape: block;
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
&::-moz-focus-outer, &::-moz-focus-inner, &:focus, &:focus *, &:-moz-focusring, &:-moz-focusring * {
|
&::-moz-focus-outer, &::-moz-focus-inner, &:focus, &:focus *, &:-moz-focusring, &:-moz-focusring * {
|
||||||
border: none !important;
|
border: none !important;
|
||||||
|
Loading…
Reference in New Issue
Block a user