Skip to content

Commit

Permalink
solid
Browse files Browse the repository at this point in the history
  • Loading branch information
yamader committed May 19, 2024
1 parent 24f1e42 commit 5b5a29e
Show file tree
Hide file tree
Showing 30 changed files with 285 additions and 289 deletions.
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"semi": false,
"bracketSameLine": true,
"arrowParens": "avoid",
"plugins": ["prettier-plugin-astro", "prettier-plugin-organize-imports", "prettier-plugin-svelte"]
"plugins": ["prettier-plugin-astro", "prettier-plugin-organize-imports"]
}
5 changes: 2 additions & 3 deletions astro.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import mdx from "@astrojs/mdx"
import svelte from "@astrojs/svelte"
import qwikdev from "@qwikdev/astro"
import solid from "@astrojs/solid-js"
import { defineConfig, passthroughImageService } from "astro/config"
import rehypeKatex from "rehype-katex"
import remarkMath from "remark-math"
Expand All @@ -16,7 +15,7 @@ export default defineConfig({
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
},
integrations: [mdx(), svelte(), qwikdev()],
integrations: [mdx(), solid()],
vite: {
css: { transformer: "lightningcss" },
// build: { cssMinify: "lightningcss" },
Expand Down
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,20 @@
"name": "yamad.me",
"version": "2.0.4",
"dependencies": {
"@builder.io/qwik": "1.5.4",
"katex": "0.16.10",
"qwik-transition": "0.0.7",
"svelte": "4.2.17"
"solid-js": "1.8.17"
},
"devDependencies": {
"@astrojs/check": "0.7.0",
"@astrojs/mdx": "3.0.0",
"@astrojs/svelte": "5.4.0",
"@qwikdev/astro": "0.5.15",
"@astrojs/solid-js": "4.2.0",
"astro": "4.8.6",
"badgen": "3.2.3",
"js-beautify": "1.15.1",
"lightningcss": "1.25.0",
"prettier": "3.2.5",
"prettier-plugin-astro": "0.13.0",
"prettier-plugin-organize-imports": "3.2.4",
"prettier-plugin-svelte": "3.2.3",
"rehype-katex": "7.0.0",
"remark-math": "6.0.0"
},
Expand Down
8 changes: 2 additions & 6 deletions scripts/beautify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@ set -e
shopt -s globstar

DIR=dist

BEAUTIFY_OPTS='-s 2 -T pre -T textarea -T script -T style -E [] --no-preserve-newlines'
BEAUTIFY_OPTS="-s 2 -T pre -T script -T style -E [] --no-preserve-newlines"

for f in $DIR/**/*.html; do
t=`mktemp`
echo "beautifying $t -> $f"
perl -pe '
s|\}\n|\}|g;
s|/\* \@vite-ignore \*/\s*||g;
s|<!-- prettier-ignore -->\s*||g;
s|\(\n|\(|g;
s|<!--(?![\$/])(?!astro).*?-->\s*||g;
' $f > $t
html-beautify $BEAUTIFY_OPTS $t > $f
rm $t
Expand Down
8 changes: 4 additions & 4 deletions src/apps/Launcher.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { component$, type Signal } from "@builder.io/qwik"
import { type Signal } from "solid-js"
import Window from "~/components/Window"

export default component$(({ launchSignal }: { launchSignal: Signal<boolean> }) => {
export default function Launcher(props: { activeSignal: Signal<boolean> }) {
return (
<Window active={launchSignal}>
<Window activeSignal={props.activeSignal}>
<p>hello!</p>
</Window>
)
})
}
5 changes: 2 additions & 3 deletions src/apps/Panel.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { component$ } from "@builder.io/qwik"
import Window from "~/components/Window"

export default component$(() => {
export default function Panel() {
return (
<Window>
<p>
Expand All @@ -13,4 +12,4 @@ export default component$(() => {
</p>
</Window>
)
})
}
5 changes: 2 additions & 3 deletions src/apps/Term.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { component$ } from "@builder.io/qwik"
import Window from "~/components/Window"

export default component$(() => {
export default function Term() {
return (
<Window>
<p>hello!</p>
</Window>
)
})
}
36 changes: 23 additions & 13 deletions src/components/EasterEgg.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { component$, useSignal, useVisibleTask$ } from "@builder.io/qwik"
import Launcher from "~/apps/Launcher"
import { createSignal, lazy, onMount } from "solid-js"

declare global {
var _easter_init: boolean
}

const command = [
"ArrowUp",
Expand All @@ -14,24 +17,31 @@ const command = [
"a",
]

export default component$(() => {
const cur = useSignal(0)
const easter = useSignal(false)
export default function EasterEgg() {
const [cur, setCur] = createSignal(0)
const [easter, setEaster] = createSignal(false)
const [load, setLoad] = createSignal(false)

onMount(() => {
if (globalThis._easter_init) return
globalThis._easter_init = true

useVisibleTask$(() => {
console.log("%cこんにちは!", "color: red; font-size: 8em; font-weight: bold;")

document.addEventListener("keydown", e => {
if (e.key == command[cur.value++]) {
if (cur.value == command.length) {
easter.value = true
cur.value = 0
if (e.key == command[cur()]) {
setCur(cur => cur + 1)
if (cur() > command.length / 2) setLoad(true)
if (cur() == command.length) {
setEaster(true)
setCur(0)
}
} else {
cur.value = 0
setCur(0)
}
})
})

return <Launcher launchSignal={easter} />
})
const Launcher = lazy(() => import("~/apps/Launcher"))
return <>{load() && <Launcher activeSignal={[easter, setEaster]} />}</>
}
84 changes: 40 additions & 44 deletions src/layouts/Layout.astro → src/components/Layout.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
import { ViewTransitions } from "astro:transitions"
import EasterEgg from "~/components/EasterEgg"
import Header from "~/components/Header.astro"
Expand All @@ -15,9 +14,6 @@ const {
description = "山Dのウェブサイト",
noRobots,
} = Astro.props.frontmatter || Astro.props
// <html lang="ja" transition:animate="none">
// <ViewTransitions />
---

<html lang="ja">
Expand All @@ -44,50 +40,50 @@ const {
<small>&copy; 2020-2024 YamaD</small>
</footer>
</main>
<EasterEgg transition:persist />
<EasterEgg client:idle />
</body>
</html>

<style is:global>
html {
background: black;
color: white;
}
<style is:global>
html {
background: black;
color: white;
}

body {
display: flex;
margin: 0;
}
body {
display: flex;
margin: 0;
}

main {
display: flex;
flex-direction: column;
width: 100%;
max-width: 48rem;
overflow: hidden;
background: #222;
main {
display: flex;
flex-direction: column;
width: 100%;
max-width: 48rem;
overflow: hidden;
background: #222;

@media (width > 48rem) {
height: 100%; /* fit-content */
margin: 1.5rem auto;
border: 1px solid #383838;
border-radius: 0.5rem;
}
}
@media (width > 48rem) {
height: 100%; /* fit-content */
margin: 1.5rem auto;
border: 1px solid #383838;
border-radius: 0.5rem;
}
}

footer {
margin-top: auto;
padding: 0.5rem 0;
text-align: center;
}
footer {
margin-top: auto;
padding: 0.5rem 0;
text-align: center;
}

.container {
display: flex;
flex-direction: column;
padding: 0 1rem;
.container {
display: flex;
flex-direction: column;
padding: 0 1rem;

& > :first-child {
margin-top: 1rem;
}
}
</style>
</body>
</html>
& > :first-child {
margin-top: 1rem;
}
}
</style>
Loading

0 comments on commit 5b5a29e

Please sign in to comment.