Skip to content

Commit 80d5e07

Browse files
authored
Merge branch 'main' into elysia-env-plugins
2 parents 74782bf + e6875cc commit 80d5e07

File tree

21 files changed

+284
-72
lines changed

21 files changed

+284
-72
lines changed

components/midori/hero.vue

Lines changed: 132 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,143 @@
11
<template>
2-
<Ray class="h-[60vh] -top-16 pointer-events-none opacity-[.35] dark:opacity-50" />
3-
<div id="splash"
4-
class="pointer-events-none absolute top-[-70vh] max-w-full justify-center w-full h-screen opacity-25 block gradient">
5-
</div>
6-
<header class="relative flex flex-col justify-center items-center w-full px-6 pt-20 mb-16 md:mb-8 overflow-hidden"
7-
style="min-height: calc(100vh - 64px)">
8-
<h1
9-
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">
2+
<link rel="preload" as="image" href="/assets/elysia_v.webp" />
3+
<Ray
4+
class="h-[60vh] -top-16 pointer-events-none opacity-[.35] dark:opacity-50"
5+
/>
6+
<div
7+
id="splash"
8+
class="pointer-events-none absolute top-[-70vh] max-w-full justify-center w-full h-screen opacity-25 block gradient"
9+
></div>
10+
<header
11+
class="relative flex flex-col justify-center items-center w-full px-6 pt-6 md:pt-0 mb-16 md:mb-8 overflow-hidden"
12+
style="min-height: calc(100vh - 64px)"
13+
>
14+
<!-- <h1
15+
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"
16+
>
1017
ElysiaJS
11-
</h1>
18+
</h1> -->
19+
<img
20+
src="/assets/elysia_v.webp"
21+
alt="Curved text logo saying 'Elysia JS'"
22+
class="max-w-[40ch] w-full object-contain object-left md:object-center mr-auto md:mr-0"
23+
style="aspect-ratio: 1.5 / 1"
24+
/>
1225
<h2
13-
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">
26+
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 mb-6"
27+
>
1428
Ergonomic Framework for Humans
15-
<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">
29+
<span
30+
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"
31+
>
1632
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
1733
<rect width="256" height="256" fill="none" />
1834
<path
1935
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"
20-
fill="currentcolor" stroke="currentcolor" stroke-linecap="round" stroke-linejoin="round"
21-
stroke-width="0" />
22-
<line x1="176" y1="16" x2="176" y2="64" fill="none" stroke="currentcolor" stroke-linecap="round"
23-
stroke-linejoin="round" stroke-width="16" />
24-
<line x1="200" y1="40" x2="152" y2="40" fill="none" stroke="currentcolor" stroke-linecap="round"
25-
stroke-linejoin="round" stroke-width="16" />
26-
<line x1="224" y1="72" x2="224" y2="104" fill="none" stroke="currentcolor" stroke-linecap="round"
27-
stroke-linejoin="round" stroke-width="16" />
28-
<line x1="240" y1="88" x2="208" y2="88" fill="none" stroke="currentcolor" stroke-linecap="round"
29-
stroke-linejoin="round" stroke-width="16" />
36+
fill="currentcolor"
37+
stroke="currentcolor"
38+
stroke-linecap="round"
39+
stroke-linejoin="round"
40+
stroke-width="0"
41+
/>
42+
<line
43+
x1="176"
44+
y1="16"
45+
x2="176"
46+
y2="64"
47+
fill="none"
48+
stroke="currentcolor"
49+
stroke-linecap="round"
50+
stroke-linejoin="round"
51+
stroke-width="16"
52+
/>
53+
<line
54+
x1="200"
55+
y1="40"
56+
x2="152"
57+
y2="40"
58+
fill="none"
59+
stroke="currentcolor"
60+
stroke-linecap="round"
61+
stroke-linejoin="round"
62+
stroke-width="16"
63+
/>
64+
<line
65+
x1="224"
66+
y1="72"
67+
x2="224"
68+
y2="104"
69+
fill="none"
70+
stroke="currentcolor"
71+
stroke-linecap="round"
72+
stroke-linejoin="round"
73+
stroke-width="16"
74+
/>
75+
<line
76+
x1="240"
77+
y1="88"
78+
x2="208"
79+
y2="88"
80+
fill="none"
81+
stroke="currentcolor"
82+
stroke-linecap="round"
83+
stroke-linejoin="round"
84+
stroke-width="16"
85+
/>
3086
</svg>
3187
</span>
3288
</h2>
3389
<h3
34-
class="text-xl md:text-2xl text-gray-500 dark:text-gray-400 !leading-normal text-left md:text-center w-full max-w-[49rem]">
90+
class="text-xl md:text-2xl text-gray-500 dark:text-gray-400 !leading-normal text-left md:text-center w-full max-w-[49rem]"
91+
>
3592
TypeScript with
3693
<span
37-
class="text-transparent font-semibold bg-clip-text bg-gradient-to-r from-indigo-400 to-purple-400">End-to-End
38-
Type Safety</span>, unified type system and outstanding developer experience. Supercharged by Bun.
94+
class="text-transparent font-semibold bg-clip-text bg-gradient-to-r from-indigo-400 to-purple-400"
95+
>End-to-End Type Safety</span
96+
>, unified type system and outstanding developer experience.
97+
Supercharged by Bun.
3998
</h3>
40-
<section class="flex flex-col sm:flex-row items-start sm:items-center w-full md:w-auto gap-4 mt-10 mb-12">
41-
<a class="text-white font-medium text-lg bg-blue-500 px-6 py-2.5 rounded-full" href="/at-glance">
99+
<section
100+
class="flex flex-col sm:flex-row items-start sm:items-center w-full md:w-auto gap-4 mt-10 mb-12"
101+
>
102+
<a
103+
class="text-white font-medium text-lg bg-blue-500 px-6 py-2.5 rounded-full"
104+
href="/at-glance"
105+
>
42106
Get Started
43107
</a>
44108
<div class="relative flex flex-1 gap-3 text-blue-500">
45109
<code
46-
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">
47-
bun create elysia app
48-
</code>
110+
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"
111+
>
112+
bun create elysia app
113+
</code>
49114
<button
50-
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"
51-
@click="copied = true">
52-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
53-
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
54-
class="feather feather-copy">
55-
<rect x="9" y="9" width="13" height="13" rx="2" ry="2" />
56-
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
115+
class="hidden sm:inline-flex 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"
116+
@click="copied = true"
117+
>
118+
<svg
119+
xmlns="http://www.w3.org/2000/svg"
120+
width="24"
121+
height="24"
122+
viewBox="0 0 24 24"
123+
fill="none"
124+
stroke="currentColor"
125+
stroke-width="2"
126+
stroke-linecap="round"
127+
stroke-linejoin="round"
128+
class="feather feather-copy"
129+
>
130+
<rect
131+
x="9"
132+
y="9"
133+
width="13"
134+
height="13"
135+
rx="2"
136+
ry="2"
137+
/>
138+
<path
139+
d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"
140+
/>
57141
</svg>
58142
</button>
59143
<p v-if="copied" className="absolute -bottom-8 right-0">
@@ -63,9 +147,18 @@
63147
</section>
64148
<p class="flex justify-center items-center gap-2 text-gray-400">
65149
See why developers love Elysia
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">
150+
<svg
151+
xmlns="http://www.w3.org/2000/svg"
152+
width="24"
153+
height="24"
154+
viewBox="0 0 24 24"
155+
fill="none"
156+
stroke="currentColor"
157+
stroke-width="1.5"
158+
stroke-linecap="round"
159+
stroke-linejoin="round"
160+
class="w-6 h-6 motion-safe:animate-bounce"
161+
>
69162
<line x1="12" y1="5" x2="12" y2="19"></line>
70163
<polyline points="19 12 12 19 5 12"></polyline>
71164
</svg>

docs/.vitepress/theme/custom.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ html, body {
2727
--vp-custom-block-tip-border: #dcfce7;
2828
--vp-custom-block-tip-text: #15803d;
2929
--vp-c-brand-nav-active: color-mix(in srgb, var(--vp-c-brand-light) 15%, transparent 100%);
30+
--vp-nav-logo-height: 28px;
3031
}
3132

3233
.dark {
@@ -63,6 +64,14 @@ button.copy::after {
6364
border: 0;
6465
}
6566

67+
/* .VPNavBarTitle > a > span {
68+
@apply hidden;
69+
}
70+
71+
.logo {
72+
@apply hidden;
73+
} */
74+
6675
#embedded-editor {
6776
@apply my-6 h-[720px] w-full rounded-lg border-0;
6877
}

docs/.vitepress/theme/header.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<template>
2+
<!-- <img
3+
src="/assets/elysia_v.webp"
4+
alt="Curved text logo saying 'Elysia JS'"
5+
class="h-[64px]"
6+
/> -->
7+
</template>

docs/.vitepress/theme/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// https://vitepress.dev/guide/custom-theme
2+
import { h } from 'vue'
23
import DefaultTheme from 'vitepress/theme'
4+
35
import Layout from './layout.vue'
6+
import Header from './header.vue'
47

58
import TwoslashFloatingVue from '@shikijs/vitepress-twoslash/client'
69
import '@shikijs/vitepress-twoslash/style.css'
@@ -12,7 +15,11 @@ import type { Theme } from 'vitepress'
1215

1316
export default {
1417
extends: DefaultTheme,
15-
Layout,
18+
Layout() {
19+
return h(DefaultTheme.Layout, null, {
20+
'nav-bar-title-after': () => h(Header)
21+
})
22+
},
1623
enhanceApp({ app }: EnhanceAppContext) {
1724
app.use(TwoslashFloatingVue)
1825
}

docs/eden/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ app.
104104
const { data } = await app.index.get()
105105

106106
// Call [POST] at '/nendoroid/:id'
107-
const { data: nendoroid, error } = await app.nendoroid({ id: 1895 }).put({
107+
const { data: nendoroid, error } = await app.nendoroid({ id: 1895 }).post({
108108
name: 'Skadi',
109109
from: 'Arknights'
110110
})

docs/eden/treaty/response.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ head:
1717
# Response
1818
Once fetch method is called, Eden Treaty return an Promise with object as follows:
1919
- data - returned value of the response (2xx)
20-
- error - returnd value from the response (>= 3xx)
20+
- error - returned value from the response (>= 3xx)
2121
- response `Response` - Web Standard Response class
2222
- status `number` - HTTP status code
2323
- headers `FetchRequestInit['headers']` - response's headers
@@ -73,4 +73,4 @@ By default, Elysia will infers error and response type to TypeScript automatical
7373
If server response with HTTP status >= 300, then value will be always be null, and error will have a returned value instead.
7474

7575
Otherwise, response will be passed to data.
76-
:::
76+
:::

docs/essential/life-cycle.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ head:
1616

1717
# Life Cycle
1818

19-
Also knows as middleware with name in Express or Hook in Fastify.
19+
Also known as middleware with name in Express or Hook in Fastify.
2020

2121
Imagine we want to return a text of HTML.
2222

2323
We need to set **"Content-Type"** headers as **"text/html"** to for browser to render HTML.
2424

25-
Explicitly specify that response is HTML could be repetitive if there are a lot of handlers, says ~200 endpoints.
25+
Explicitly specifying that response is HTML could be repetitive if there are a lot of handlers, says ~200 endpoints.
2626

27-
We can see a duplicated code for just to specify that response is HTML.
27+
We can see a duplicated code for just specifying that response is HTML.
2828

2929
But what if after we sent a response, we could detect if a response is an HTML string then append headers automatically?
3030

@@ -46,7 +46,7 @@ Most of the events you are going to use are highlighted in the blue area but to
4646
Elysia does the following for every request:
4747

4848
1. **Request**
49-
- Notify new event is received, providing only the most minimal context to reduce overhead
49+
- Notify when a new event is received, providing only the most minimal context to reduce overhead
5050
- Best for:
5151
- Caching
5252
- Analytics
@@ -87,15 +87,15 @@ These events are designed to help you decouple code into smaller reusable pieces
8787

8888
## Hook
8989

90-
We refer to each function that intercepts the life cycle event as **"hook"**, as the function hook into the lifecycle event.
90+
We refer to each function that intercepts the life cycle event as **"hook"**, as the function hooks into the lifecycle event.
9191

9292
Hooks can be categorized into 2 types:
9393

9494
1. Local Hook: Execute on a specific route
9595
2. Interceptor Hook: Execute on every route
9696

9797
::: tip
98-
The hook will accept the same Context as a handler, you can imagine you adding a route handler but at a specific point.
98+
The hook will accept the same Context as a handler, you can imagine adding a route handler but at a specific point.
9999
:::
100100

101101
## Local Hook
@@ -187,4 +187,4 @@ Console should log as the following:
187187
1
188188
2
189189
3
190-
```
190+
```

docs/essential/route.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,23 @@ import Playground from '../../components/nearl/playground.vue'
1919
import { Elysia } from 'elysia'
2020

2121
const demo1 = new Elysia()
22-
.get('/', () => 'hello')
23-
.post('/hi', () => 'hi')
22+
.get('/', () => 'Landing')
23+
.get('/hello', () => 'Hi')
2424

2525
const demo2 = new Elysia()
2626
.get('/', () => 'hello')
27-
.post('/hi', () => 'world')
27+
.post('/hi', () => 'hi')
2828

2929
const demo3 = new Elysia()
3030
.get('/get', () => 'hello')
3131
.post('/post', () => 'hi')
3232
.route('M-SEARCH', '/m-search', () => 'connect')
3333

3434
const demo4 = new Elysia()
35-
.get('/', () => 'hello')
36-
.post('/', () => 'hello')
37-
.delete('/', () => 'hello')
35+
.all('/', () => 'hi')
3836

3937
const demo5 = new Elysia()
4038
.get('/', () => 'hello')
41-
.post('/', () => 'hello')
4239
.get('/hi', ({ error }) => error(404))
4340
</script>
4441

@@ -52,8 +49,8 @@ We can define a route by calling a **method named after HTTP verbs**, passing a
5249
import { Elysia } from 'elysia'
5350

5451
new Elysia()
55-
.get('/', () => 'Landing')
56-
.get('/hello', () => 'Hi')
52+
.get('/', () => 'hello')
53+
.get('/hi', () => 'hi')
5754
.listen(3000)
5855
```
5956

0 commit comments

Comments
 (0)