Skip to content

Commit 5032463

Browse files
committed
🎉 feat: new doc
1 parent 43db447 commit 5032463

35 files changed

+3171
-293
lines changed

bun.lockb

795 Bytes
Binary file not shown.

components/blog/Landing.vue

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<template>
2-
<header
3-
class="flex flex-col justify-center items-center max-w-3xl gap-3 w-full mx-auto pt-20 pb-4"
4-
>
2+
<Ray class="h-[62.5vh] -top-14 left-0 z-[100] opacity-30 dark:opacity-[.55] pointer-events-none" />
3+
<header class="flex flex-col justify-center items-center max-w-3xl gap-3 w-full mx-auto pt-20 pb-4">
54
<h1 class="text-2xl md:text-3xl text-gray-700 dark:text-gray-100 font-semibold">
65
Latest Updates
76
</h1>
@@ -10,11 +9,9 @@
109
</p>
1110
</header>
1211
<main class="flex flex-col max-w-xl gap-4 w-full mx-auto my-8">
13-
<a
14-
v-for="blog in props.blogs"
12+
<a v-for="blog in props.blogs"
1513
class="px-4 py-2 rounded-lg hover:bg-gray-50 focus:bg-gray-50 dark:hover:bg-gray-700 dark:focus:bg-gray-700 transition-colors cursor-pointer"
16-
:href="blog.href"
17-
>
14+
:href="blog.href">
1815
<article class="flex flex-col gap-2">
1916
<h2 class="text-xl font-semibold text-gray-700 dark:text-gray-100">
2017
{{ blog.title }}
@@ -28,6 +25,8 @@
2825
<script lang="ts" setup>
2926
import { defineProps } from 'vue'
3027
28+
import Ray from '../../components/midori/ray.vue'
29+
3130
import '../tailwind.css'
3231
3332
const props = defineProps<{

components/midori/editor.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { text } from 'stream/consumers'
1010
1111
let code = `const app = new Elysia()
1212
.get('/', () => 'Hello!')
13+
// Try edit this line
1314
.get('/hello', () => 'Hello from Elysia!')
1415
.listen(80)
1516
@@ -183,11 +184,11 @@ onMounted(() => {
183184

184185
<aside class="flex flex-col md:flex-row justify-center items-center w-full max-w-6xl gap-8 my-8">
185186
<section
186-
class="flex flex-col w-full h-96 border dark:border-gray-600 bg-white dark:bg-gray-700 rounded-2xl"
187+
class="flex flex-col w-full h-96 border dark:border-slate-700 bg-white dark:bg-slate-800 rounded-2xl"
187188
>
188189
<div class="mockup-window flex relative w-full h-full shadow-xl">
189190
<Prism
190-
class="elysia-editor !bg-transparent !text-base !font-mono rounded-xl w-full max-w-xl h-full !pt-6 !px-1 outline-none"
191+
class="elysia-editor block !bg-transparent !text-base !font-mono rounded-xl w-full max-w-xl h-full !pt-0 !px-2 outline-none"
191192
language="typescript"
192193
contenteditable="true"
193194
>
@@ -203,9 +204,9 @@ onMounted(() => {
203204
</footer>
204205
</div>
205206
</section>
206-
<div class="w-full mockup-browser h-96 shadow-xl border dark:border-gray-600 bg-white dark:bg-gray-700 max-w-full">
207+
<div class="w-full mockup-browser h-96 shadow-xl border dark:border-slate-700 bg-white dark:bg-slate-800 max-w-full">
207208
<div class="mockup-browser-toolbar">
208-
<form class="input font-medium !bg-gray-100 dark:!bg-gray-600" @submit.prevent="execute">
209+
<form class="input font-medium !bg-gray-100 dark:!bg-slate-700" @submit.prevent="execute">
209210
<span class="text-gray-400 dark:text-gray-300">localhost</span>
210211
<input
211212
class="absolute"

components/midori/fast.vue

Lines changed: 16 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,15 @@ const graphs = [
1616
</script>
1717

1818
<template>
19-
<article
20-
class="flex justify-between flex-col lg:flex-row items-center w-full max-w-6xl mx-auto my-8 gap-12"
21-
>
19+
<article class="flex justify-between flex-col lg:flex-row items-center w-full max-w-6xl mx-auto my-8 gap-12">
2220
<section class="flex flex-col w-full max-w-lg">
2321
<header class="flex flex-col justify-center items-start">
24-
<h2
25-
class="text-4xl leading-tight font-medium text-gray-400 mb-2"
26-
>
22+
<h2 class="text-4xl leading-tight font-medium text-gray-400 mb-2">
2723
Elysia is fast
2824
</h2>
29-
<h2
30-
class="text-4xl leading-tight font-medium text-gray-400 mb-4"
31-
>
25+
<h2 class="text-4xl leading-tight font-medium text-gray-400 mb-4">
3226
<span
33-
class="leading-tight text-8xl font-bold bg-clip-text text-transparent bg-gradient-to-br from-lime-300 to-cyan-300"
34-
>
27+
class="leading-tight text-8xl font-bold bg-clip-text text-transparent bg-gradient-to-br from-lime-300 to-cyan-300">
3528
18x
3629
</span>
3730
faster than Express
@@ -47,71 +40,48 @@ const graphs = [
4740
</p>
4841
</section>
4942
<section class="flex flex-col w-full max-w-xl">
50-
<ol
51-
class="flex flex-col gap-2 list-none w-full text-gray-500 dark:text-gray-400 text-lg"
52-
>
43+
<ol class="flex flex-col gap-2 list-none w-full text-gray-500 dark:text-gray-400 text-lg">
5344
<li class="flex flex-row items-stretch w-full gap-4">
54-
<p
55-
class="flex items-end gap-2 w-full max-w-[6em] dark:text-gray-400"
56-
>
45+
<p class="flex items-end gap-2 w-full max-w-[6em] dark:text-gray-400">
5746
Elysia
5847
<span class="text-gray-400 text-xs pb-1">
5948
Bun
6049
</span>
6150
</p>
6251
<div class="w-full h-7">
6352
<div
64-
class="flex justify-end items-center text-sm font-bold text-white h-7 px-2.5 py-0.5 bg-gradient-to-r from-lime-200 to-cyan-300 rounded-full"
65-
>
53+
class="flex justify-end items-center text-sm font-bold text-white h-7 px-2.5 py-0.5 bg-gradient-to-r from-lime-200 to-cyan-300 rounded-full">
6654
276,322
6755
</div>
6856
</div>
6957
</li>
70-
<li
71-
v-for="[name, runtime, value] in graphs"
72-
class="flex flex-row w-full gap-4"
73-
>
74-
<p
75-
class="flex items-end gap-2 w-full max-w-[6em] dark:text-gray-400"
76-
>
58+
<li v-for="[name, runtime, value] in graphs" class="flex flex-row w-full gap-4">
59+
<p class="flex items-end gap-2 w-full max-w-[6em] dark:text-gray-400">
7760
{{ name }}
7861
<span class="text-gray-400 text-xs pb-1">
7962
{{ runtime }}
8063
</span>
8164
</p>
8265
<div class="w-full h-7">
83-
<div
84-
class="relative flex justify-end items-center text-sm px-2.5 py-0.5 bg-gray-200 dark:bg-gray-700 rounded-full mr-auto h-7"
85-
:style="scaleStyle(value)"
86-
>
87-
<span
88-
v-if="scale(value) > 40"
89-
class="absolute z-1 flex items-center text-sm h-7"
90-
>
66+
<div class="relative flex justify-end items-center text-sm px-2.5 py-0.5 bg-gray-200 dark:bg-gray-700 rounded-full mr-auto h-7"
67+
:style="scaleStyle(value)">
68+
<span v-if="scale(value) > 40" class="absolute z-1 flex items-center text-sm h-7">
9169
{{ format(value) }}
9270
</span>
93-
<span
94-
v-else
95-
class="absolute -right-14 flex items-center text-sm h-7"
96-
>
71+
<span v-else class="absolute -right-14 flex items-center text-sm h-7">
9772
{{ format(value) }}
9873
</span>
9974
</div>
10075
</div>
10176
</li>
10277
</ol>
10378
<br />
104-
<span
105-
class="text-sm text-gray-400 dark:text-gray-500"
106-
>
79+
<span class="text-sm text-gray-400 dark:text-gray-500">
10780
Measure in requests/second. Benchmark for parsing query, path
10881
parameter and set response header on Debian 11, Intel i7-13700K
10982
tested on Bun 0.7.2 at 6 Aug 2023. See the benchmark condition
110-
<a
111-
href="https://github.com/SaltyAom/bun-http-framework-benchmark/tree/c7e26fe3f1bfee7ffbd721dbade10ad72a0a14ab#results"
112-
target="_blank"
113-
class="text-green-500 underline font-semibold"
114-
>
83+
<a href="https://github.com/SaltyAom/bun-http-framework-benchmark/tree/c7e26fe3f1bfee7ffbd721dbade10ad72a0a14ab#results"
84+
target="_blank" class="text-green-500 underline font-semibold">
11585
here
11686
</a>
11787
</span>

components/midori/hero.vue

Lines changed: 58 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,71 @@
11
<template>
2-
<div
3-
id="splash"
4-
class="pointer-events-none absolute top-[-70vh] max-w-full flex justify-center w-full h-screen opacity-50"
5-
>
6-
<div :class="(isDark ? 'block gradient -dark' : 'block gradient -light')" />
2+
<Ray class="h-screen -top-14 z-[100] pointer-events-none opacity-[0.35] dark:opacity-50" />
3+
<div id="splash"
4+
class="pointer-events-none absolute top-[-70vh] max-w-full flex justify-center w-full h-screen opacity-50">
5+
<div :class="isDark ? 'block gradient -dark' : 'block gradient -light'" />
76
</div>
87
<header
98
class="relative flex flex-col justify-center items-center font-sans w-full px-6 pt-20 mb-16 md:mb-8 overflow-hidden"
10-
style="min-height: calc(100vh - 64px)"
11-
>
9+
style="min-height: calc(100vh - 64px)">
1210
<h1
13-
class="text-3xl leading-relaxed font-semibold text-center text-transparent mr-auto md:mx-auto bg-clip-text bg-gradient-to-r from-indigo-400 to-purple-400"
14-
>
11+
class="text-3xl leading-relaxed font-semibold text-center text-transparent mr-auto md:mx-auto bg-clip-text bg-gradient-to-r from-indigo-400 to-purple-400">
1512
ElysiaJS
1613
</h1>
1714
<h2
18-
class="relative text-5xl md:text-6xl md:leading-tight font-bold md:text-center leading-tight text-transparent bg-clip-text bg-gradient-to-r from-sky-300 to-indigo-400 mt-2 mb-8"
19-
>
20-
Ergonomic Framework for Humans<span
21-
class="absolute w-10 md:w-12 h-10 md:h-12 bottom-0 mb-4 ml-2 md:ml-0 md:mb-10 text-indigo-400"
22-
>
15+
class="relative text-5xl md:text-6xl md:leading-tight font-bold md:text-center leading-tight text-transparent bg-clip-text bg-gradient-to-r from-sky-300 to-indigo-400 mt-2 mb-6">
16+
Ergonomic Framework for Humans
17+
<span class="absolute w-10 md:w-12 h-10 md:h-12 bottom-0 mb-4 ml-2 md:ml-0 md:mb-10 text-indigo-400">
2318
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
2419
<rect width="256" height="256" fill="none" />
2520
<path
2621
d="M138.7,175.5l-19.2,52.1a8,8,0,0,1-15,0L85.3,175.5a8.1,8.1,0,0,0-4.8-4.8L28.4,151.5a8,8,0,0,1,0-15l52.1-19.2a8.1,8.1,0,0,0,4.8-4.8l19.2-52.1a8,8,0,0,1,15,0l19.2,52.1a8.1,8.1,0,0,0,4.8,4.8l52.1,19.2a8,8,0,0,1,0,15l-52.1,19.2A8.1,8.1,0,0,0,138.7,175.5Z"
27-
fill="currentcolor"
28-
stroke="currentcolor"
29-
stroke-linecap="round"
30-
stroke-linejoin="round"
31-
stroke-width="0"
32-
/>
33-
<line
34-
x1="176"
35-
y1="16"
36-
x2="176"
37-
y2="64"
38-
fill="none"
39-
stroke="currentcolor"
40-
stroke-linecap="round"
41-
stroke-linejoin="round"
42-
stroke-width="16"
43-
/>
44-
<line
45-
x1="200"
46-
y1="40"
47-
x2="152"
48-
y2="40"
49-
fill="none"
50-
stroke="currentcolor"
51-
stroke-linecap="round"
52-
stroke-linejoin="round"
53-
stroke-width="16"
54-
/>
55-
<line
56-
x1="224"
57-
y1="72"
58-
x2="224"
59-
y2="104"
60-
fill="none"
61-
stroke="currentcolor"
62-
stroke-linecap="round"
63-
stroke-linejoin="round"
64-
stroke-width="16"
65-
/>
66-
<line
67-
x1="240"
68-
y1="88"
69-
x2="208"
70-
y2="88"
71-
fill="none"
72-
stroke="currentcolor"
73-
stroke-linecap="round"
74-
stroke-linejoin="round"
75-
stroke-width="16"
76-
/>
22+
fill="currentcolor" stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round"
23+
stroke-width="0" />
24+
<line x1="176" y1="16" x2="176" y2="64" fill="none" stroke="currentcolor" stroke-linecap="round"
25+
stroke-linejoin="round" stroke-width="16" />
26+
<line x1="200" y1="40" x2="152" y2="40" fill="none" stroke="currentcolor" stroke-linecap="round"
27+
stroke-linejoin="round" stroke-width="16" />
28+
<line x1="224" y1="72" x2="224" y2="104" fill="none" stroke="currentcolor" stroke-linecap="round"
29+
stroke-linejoin="round" stroke-width="16" />
30+
<line x1="240" y1="88" x2="208" y2="88" fill="none" stroke="currentcolor" stroke-linecap="round"
31+
stroke-linejoin="round" stroke-width="16" />
7732
</svg>
7833
</span>
7934
</h2>
8035
<h3
81-
class="text-xl md:text-2xl leading-relaxed text-gray-400 text-left md:text-center w-full max-w-[49rem]"
82-
>
36+
class="text-xl md:text-2xl leading-relaxed text-gray-500 dark:text-gray-400 !leading-normal text-left md:text-center w-full max-w-[49rem]">
8337
TypeScript framework supercharged by Bun with
8438
<span
85-
class="text-transparent font-semibold bg-clip-text bg-gradient-to-r from-indigo-400 to-purple-400"
86-
>End-to-End Type Safety</span
87-
>, unified type system and outstanding developer experience
39+
class="text-transparent font-semibold bg-clip-text bg-gradient-to-r from-indigo-400 to-purple-400">End-to-End
40+
Type Safety</span>, unified type system and outstanding developer experience
8841
</h3>
89-
<section
90-
class="flex flex-col sm:flex-row items-start w-full md:w-auto gap-4 mt-10 mb-12"
91-
>
92-
<a
93-
class="text-white font-medium text-lg bg-blue-500 px-6 py-2.5 rounded-full"
94-
href="/introduction"
95-
>
42+
<section class="flex flex-col sm:flex-row items-start sm:items-center w-full md:w-auto gap-4 mt-10 mb-12">
43+
<a class="text-white font-medium text-lg bg-blue-500 px-6 py-2.5 rounded-full" href="/introduction">
9644
Get Started
9745
</a>
98-
<code
99-
class="text-blue-500 font-mono font-medium text-lg bg-blue-200/25 dark:bg-blue-500/20 px-6 py-2.5 rounded-full"
100-
>
101-
bun create elysia app
102-
</code>
46+
<div class="relative flex flex-1 gap-3 text-blue-500">
47+
<code
48+
class="text-blue-500 font-mono font-medium text-lg bg-blue-200/25 dark:bg-blue-500/20 px-6 py-2.5 rounded-full">
49+
bun create elysia app
50+
</code>
51+
<button
52+
class="p-3 rounded-2xl active:rounded-full hover:bg-blue-200/25 focus:bg-blue-200/25 active:bg-blue-200/50 hover:dark:bg-blue-500/20 focus:dark:bg-blue-500/20 active:dark:bg-blue-500/20 transition-all"
53+
@click="copied = true">
54+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
55+
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
56+
class="feather feather-copy">
57+
<rect x="9" y="9" width="13" height="13" rx="2" ry="2" />
58+
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
59+
</svg>
60+
</button>
61+
<p v-if="copied" className="absolute -bottom-8 right-0">Copied</p>
62+
</div>
10363
</section>
10464
<p class="flex justify-center items-center gap-2 text-gray-400">
10565
See why developers love Elysia
106-
<svg
107-
xmlns="http://www.w3.org/2000/svg"
108-
width="24"
109-
height="24"
110-
viewBox="0 0 24 24"
111-
fill="none"
112-
stroke="currentColor"
113-
stroke-width="1.5"
114-
stroke-linecap="round"
115-
stroke-linejoin="round"
116-
class="w-6 h-6 motion-safe:animate-bounce"
117-
>
66+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
67+
stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"
68+
class="w-6 h-6 motion-safe:animate-bounce">
11869
<line x1="12" y1="5" x2="12" y2="19"></line>
11970
<polyline points="19 12 12 19 5 12"></polyline>
12071
</svg>
@@ -123,29 +74,23 @@
12374
</template>
12475

12576
<script setup lang="ts">
126-
import { onMounted, ref } from 'vue'
77+
import { onMounted, ref, watch } from 'vue'
12778
128-
const isDark = ref(false)
129-
const safari =
130-
onMounted(() => {
131-
// @ts-ignore
132-
isDark.value = document.documentElement.classList.contains('dark')
79+
import Ray from './ray.vue'
13380
134-
// @ts-ignore
135-
const attrObserver = new MutationObserver((mutations) => {
136-
mutations.forEach((mutation) => {
137-
if (mutation.attributeName !== 'class') return
81+
const copied = ref(false)
82+
watch(copied, (value) => {
83+
if (value) {
84+
// @ts-ignore
85+
navigator.clipboard.writeText('bun create elysia app')
13886
139-
// @ts-ignore
140-
isDark.value = document.documentElement.classList.contains('dark')
141-
})
142-
})
143-
144-
// @ts-ignore
145-
attrObserver.observe(document.documentElement, { attributes: true })
146-
147-
return () => {
148-
attrObserver.disconnect()
87+
setTimeout(() => {
88+
copied.value = false
89+
}, 2000)
14990
}
15091
})
92+
93+
import { useData } from 'vitepress'
94+
95+
const { isDark } = useData()
15196
</script>

0 commit comments

Comments
 (0)