Skip to content

Commit 3d2186d

Browse files
committed
📘 doc: polish thing
1 parent aef198d commit 3d2186d

File tree

10 files changed

+33
-74
lines changed

10 files changed

+33
-74
lines changed

docs/.vitepress/theme/layout.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ const prompt = computed(() =>
178178

179179
<template #doc-before>
180180
<div
181-
class="sm:absolute flex gap-2.5 sm:justify-end items-center w-full pt-0.5 pr-2 text-gray-400 dark:text-gray-500 text-xs *:z-20 [&>a>svg]:size-4.5 sm:[&>a>svg]:size-5 [&>a>svg]:opacity-50 [&>a>svg]:interact:opacity-100 [&>a>svg]:transition-opacity"
182-
style="max-width: 688px"
181+
id="open-elysia-in"
182+
class="sm:absolute right-0 flex gap-2.5 sm:justify-end items-center pt-0.5 pr-2 text-gray-400 dark:text-gray-500 text-xs *:z-20 [&>a>svg]:size-4.5 sm:[&>a>svg]:size-5 [&>a>svg]:opacity-50 [&>a>svg]:interact:opacity-100 [&>a>svg]:transition-opacity"
183183
>
184184
Open in
185185
<a

docs/components/fern/tweet.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<a
3-
class="flex flex-col w-full rounded-2xl border dark:border-gray-700 bg-gray-50/90 dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 hover:scale-105 hover:shadow-xl hover:z-10 p-4 gap-3 text-gray-500 dark:text-gray-300 transition-all ease-in-expo duration-250"
3+
class="flex flex-col w-full rounded-2xl border dark:border-gray-700 bg-gray-50/90 dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 hover:scale-105 hover:shadow-xl hover:z-10 p-4 gap-3 text-gray-500 dark:text-gray-300 transition-all ease-out-expo duration-600"
44
>
55
<header class="flex gap-2.5">
66
<img loading="lazy" class="w-12 h-12 rounded-full" :src="image" />

docs/migrate/from-express.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -313,14 +313,9 @@ import { z } from 'zod'
313313

314314
const app = new Elysia()
315315
.patch('/user/:id', ({ params, body }) => ({
316-
// ^?
317316
params,
318317
body
319-
// ^?
320318
}),
321-
322-
323-
324319
{
325320
params: z.object({
326321
id: z.number()
@@ -337,14 +332,9 @@ import * as v from 'valibot'
337332

338333
const app = new Elysia()
339334
.patch('/user/:id', ({ params, body }) => ({
340-
// ^?
341335
params,
342336
body
343-
// ^?
344337
}),
345-
346-
347-
348338
{
349339
params: v.object({
350340
id: v.number()

docs/migrate/from-fastify.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -302,14 +302,9 @@ import { Elysia, t } from 'elysia'
302302

303303
const app = new Elysia()
304304
.patch('/user/:id', ({ params, body }) => ({
305-
// ^?
306305
params,
307306
body
308-
// ^?
309307
}),
310-
311-
312-
313308
{
314309
params: t.Object({
315310
id: t.Number()
@@ -326,14 +321,9 @@ import { z } from 'zod'
326321

327322
const app = new Elysia()
328323
.patch('/user/:id', ({ params, body }) => ({
329-
// ^?
330324
params,
331325
body
332-
// ^?
333326
}),
334-
335-
336-
337327
{
338328
params: z.object({
339329
id: z.number()
@@ -350,14 +340,9 @@ import * as v from 'zod'
350340

351341
const app = new Elysia()
352342
.patch('/user/:id', ({ params, body }) => ({
353-
// ^?
354343
params,
355344
body
356-
// ^?
357345
}),
358-
359-
360-
361346
{
362347
params: v.object({
363348
id: v.number()

docs/migrate/from-hono.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -298,14 +298,9 @@ import { Elysia, t } from 'elysia'
298298

299299
const app = new Elysia()
300300
.patch('/user/:id', ({ params, body }) => ({
301-
// ^?
302301
params,
303302
body
304-
// ^?
305303
}),
306-
307-
308-
309304
{
310305
params: t.Object({
311306
id: t.Number()
@@ -322,14 +317,9 @@ import { z } from 'zod'
322317

323318
const app = new Elysia()
324319
.patch('/user/:id', ({ params, body }) => ({
325-
// ^?
326320
params,
327321
body
328-
// ^?
329322
}),
330-
331-
332-
333323
{
334324
params: z.object({
335325
id: z.number()
@@ -346,14 +336,9 @@ import * as v from 'valibot'
346336

347337
const app = new Elysia()
348338
.patch('/user/:id', ({ params, body }) => ({
349-
// ^?
350339
params,
351340
body
352-
// ^?
353341
}),
354-
355-
356-
357342
{
358343
params: v.object({
359344
id: v.number()

docs/migrate/from-trpc.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,9 @@ import { Elysia, t } from 'elysia'
296296

297297
const app = new Elysia()
298298
.patch('/user/:id', ({ params, body }) => ({
299-
// ^?
300299
params,
301300
body
302-
// ^?
303301
}),
304-
305-
306-
307302
{
308303
params: t.Object({
309304
id: t.Number()
@@ -320,14 +315,9 @@ import { z } from 'zod'
320315

321316
const app = new Elysia()
322317
.patch('/user/:id', ({ params, body }) => ({
323-
// ^?
324318
params,
325319
body
326-
// ^?
327320
}),
328-
329-
330-
331321
{
332322
params: z.object({
333323
id: z.number()
@@ -344,14 +334,9 @@ import * as v from 'zod'
344334

345335
const app = new Elysia()
346336
.patch('/user/:id', ({ params, body }) => ({
347-
// ^?
348337
params,
349338
body
350-
// ^?
351339
}),
352-
353-
354-
355340
{
356341
params: v.object({
357342
id: v.number()

docs/patterns/fullstack-dev-server.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
2-
title: Extends Context - ElysiaJS
2+
title: Fullstack Dev Server - ElysiaJS
33
head:
44
- - meta
55
- property: 'og:title'
6-
content: Extends Context - ElysiaJS
6+
content: Fullstack Dev Server - ElysiaJS
77

88
- - meta
99
- name: 'description'
10-
content: Elysia provides a minimal Context by default, allowing us to extend Context for our specific need using state, decorate, derive, and resolve.
10+
content: Bun Fullstack Dev Server allows us to develop frontend and backend in a single project without any bundler. Learn how to use Elysia with Bun Fullstack Dev Server with HMR, and Tailwind support.
1111

1212
- - meta
1313
- property: 'og:description'
14-
content: Elysia provides a minimal Context by default, allowing us to extend Context for our specific need using state, decorate, derive, and resolve.
14+
content: Bun Fullstack Dev Server allows us to develop frontend and backend in a single project without any bundler. Learn how to use Elysia with Bun Fullstack Dev Server with HMR, and Tailwind support.
1515
---
1616

1717
# Elysia with Bun Fullstack Dev Server
@@ -87,7 +87,7 @@ root.render(<App />)
8787

8888
This would allows us to develop frontend and backend in a single project without any bundler.
8989

90-
We have tested that Fullstack Dev Server works with HMR, [Tailwind](#tailwind), Tanstack Query, [Eden Treaty](/eden/overview), and path alias.
90+
We have verified that Fullstack Dev Server works with HMR, [Tailwind](#tailwind), Tanstack Query, [Eden Treaty](/eden/overview), and path alias.
9191

9292
## Custom prefix path
9393

docs/patterns/typebox.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: Type - ElysiaJS
2+
title: TypeBox (Elysia.t) - ElysiaJS
33
head:
44
- - meta
55
- property: 'og:title'
6-
content: Type - ElysiaJS
6+
content: TypeBox (Elysia.t) - ElysiaJS
77

88
- - meta
99
- name: 'description'
@@ -19,7 +19,7 @@ import Card from '../components/nearl/card.vue'
1919
import Deck from '../components/nearl/card-deck.vue'
2020
</script>
2121

22-
# Type
22+
# TypeBox (Elysia.t)
2323

2424
Here's a common patterns for writing validation types using `Elysia.t`.
2525

docs/patterns/typescript.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
2-
title: Type - ElysiaJS
2+
title: TypeScript - ElysiaJS
33
head:
44
- - meta
55
- property: 'og:title'
6-
content: Type - ElysiaJS
6+
content: TypeScript - ElysiaJS
77

88
- - meta
99
- name: 'description'
10-
content: Schemas are strictly typed definitions, used to infer TypeScript's type and data validation of an incoming request and outgoing response. Elysia's schema validation is based on Sinclair's TypeBox, a TypeScript library for data validation.
10+
content: TypeScript has first-class support in Elysia. Learn how to leverage TypeScript's powerful type system with Elysia's intuitive API, schema-based validation and debugging type inference performance issue.
1111

1212
- - meta
1313
- property: 'og:description'
14-
content: Schemas are strictly typed definitions, used to infer TypeScript's type and data validation of an incoming request and outgoing response. Elysia's schema validation is based on Sinclair's TypeBox, a TypeScript library for data validation.
14+
content: TypeScript has first-class support in Elysia. Learn how to leverage TypeScript's powerful type system with Elysia's intuitive API, schema-based validation and debugging type inference performance issue.
1515
---
1616

1717
<script setup>
@@ -29,12 +29,13 @@ Most of the time, you wouldn't need to add any TypeScript annotations manually.
2929
## Inference
3030
Elysia infers the type of request and response based on the schema you provide.
3131

32-
```ts
32+
```ts twoslash
3333
import { Elysia, t } from 'elysia'
34+
import { z } from 'zod'
3435

3536
const app = new Elysia()
36-
.post('/user/:id', ({ body }) => body {
37-
// ^?
37+
.post('/user/:id', ({ body }) => body, {
38+
// ^?
3839
body: t.Object({
3940
id: t.String()
4041
}),
@@ -187,3 +188,5 @@ const api = treaty<subApp>('localhost:3000') // [!code ++]
187188
```
188189

189190
This should make your type inference faster it doesn't need to evaluate the whole app.
191+
192+
See [Eden Treaty](/eden/overview) to learn more about Eden.

docs/tailwind.css

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,18 @@ button.copy::after {
814814
@apply !pt-4 xl:!pt-8;
815815
}
816816

817+
.VPDoc > .container {
818+
& > .content {
819+
& > .content-container {
820+
@apply relative;
821+
822+
& > #open-elysia-in {
823+
max-width: 688px;
824+
}
825+
}
826+
}
827+
}
828+
817829
.VPDoc > .container.-wide {
818830
& > .content {
819831
@apply lg:px-0;
@@ -824,7 +836,6 @@ button.copy::after {
824836

825837
& > *:not(.main) {
826838
@apply mx-auto;
827-
max-width: 668px;
828839
}
829840
}
830841
}

0 commit comments

Comments
 (0)