Skip to content

Commit fa21673

Browse files
committed
Feat search
1 parent 3e8984c commit fa21673

27 files changed

Lines changed: 1032 additions & 475 deletions

File tree

apps/front/package.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
{
22
"name": "front",
33
"version": "0.1.0",
4+
"type": "module",
45
"private": true,
56
"scripts": {
6-
"dev": "next dev",
7-
"build": "next build",
8-
"start": "next start",
7+
"dev": "node ./script.js && next dev",
8+
"search": "node ./script.js",
9+
"build": "node ./script.js && next build",
10+
"start": "npx serve ./out",
911
"test": "bun test"
1012
},
1113
"dependencies": {
1214
"@devup-api/fetch": "^0.1",
1315
"@devup-api/react-query": "^0.1",
16+
"@devup-ui/components": "^0.1.44",
1417
"@devup-ui/react": "^1",
1518
"@devup-ui/reset-css": "^1",
1619
"@mdx-js/loader": "^3.1.1",
@@ -20,8 +23,13 @@
2023
"next": "^16",
2124
"react": "^19",
2225
"rehype-pretty-code": "^0.14.3",
26+
"rehype-sanitize": "^6.0.0",
2327
"rehype-slug": "^6.0.0",
24-
"shiki": "^4.0.2"
28+
"rehype-stringify": "^10.0.1",
29+
"remark-parse": "^11.0.0",
30+
"remark-rehype": "^11.1.2",
31+
"shiki": "^4.0.2",
32+
"unified": "^11.0.5"
2533
},
2634
"devDependencies": {
2735
"@types/mdx": "^2.0.13",

apps/front/public/icons/close.svg

Lines changed: 11 additions & 0 deletions
Loading

apps/front/public/search.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[null,null,null,null,{"text":"## What is Devup UI?eeeeeeeeeeee\r\n\r\n**Devup UI is not just another CSS-in-JS library — it's the future of CSS-in-JS itself.**\r\n\r\nDevup UI is a zero-runtime CSS-in-JS preprocessor powered by Rust and WebAssembly. It transforms all your styles at build time, completely eliminating runtime overhead while providing full CSS-in-JS syntax coverage.\r\n\r\n### The Problem with Traditional CSS-in-JS\r\n\r\nTraditional CSS-in-JS solutions force you to choose between:\r\n\r\n- **Developer Experience**: Intuitive APIs, co-located styles, dynamic theming\r\n- **Performance**: No runtime overhead, fast page loads, optimal Core Web Vitals\r\n\r\nLibraries like styled-components and Emotion offer great DX but execute JavaScript at runtime to generate styles. Zero-runtime alternatives like Vanilla Extract sacrifice some flexibility for performance.\r\n\r\n### The Devup UI Solution\r\n\r\nDevup UI eliminates this trade-off entirely. Our Rust-powered preprocessor analyzes your code at build time and handles every CSS-in-JS pattern:\r\n\r\n- **Variables** — Dynamic values become CSS custom properties\r\n- **Conditionals** — Ternary expressions are statically analyzed\r\n- **Responsive Arrays** — Breakpoint-based styles are pre-generated\r\n- **Pseudo Selectors** — `_hover`, `_focus`, `_active` work seamlessly\r\n- **Themes** — Type-safe theme tokens with zero-cost switching\r\n\r\n### Key Advantages\r\n\r\n<Table>\r\n <TableHead>\r\n <TableRow>\r\n <TableHeaderCell>Feature</TableHeaderCell>\r\n <TableHeaderCell>Devup UI</TableHeaderCell>\r\n <TableHeaderCell>styled-components</TableHeaderCell>\r\n <TableHeaderCell>Emotion</TableHeaderCell>\r\n <TableHeaderCell>Vanilla Extract</TableHeaderCell>\r\n </TableRow>\r\n </TableHead>\r\n <TableBody>\r\n <TableRow>\r\n <TableCell>Zero Runtime</TableCell>\r\n <TableCell>Yes</TableCell>\r\n <TableCell>No</TableCell>\r\n <TableCell>No</TableCell>\r\n <TableCell>Yes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>Dynamic Values</TableCell>\r\n <TableCell>Yes</TableCell>\r\n <TableCell>Yes</TableCell>\r\n <TableCell>Yes</TableCell>\r\n <TableCell>Limited</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>Full Syntax Coverage</TableCell>\r\n <TableCell>Yes</TableCell>\r\n <TableCell>Yes</TableCell>\r\n <TableCell>Yes</TableCell>\r\n <TableCell>No</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>Type-Safe Themes</TableCell>\r\n <TableCell>Yes</TableCell>\r\n <TableCell>Limited</TableCell>\r\n <TableCell>Limited</TableCell>\r\n <TableCell>Yes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>Build Performance</TableCell>\r\n <TableCell>Fastest</TableCell>\r\n <TableCell>N/A</TableCell>\r\n <TableCell>N/A</TableCell>\r\n <TableCell>Fast</TableCell>\r\n </TableRow>\r\n </TableBody>\r\n</Table>\r\n\r\n### How It Works\r\n\r\n```tsx\r\n// You write familiar CSS-in-JS syntax\r\nconst example = <Box _hover={{ bg: 'blue' }} bg=\"red\" p={4} />\r\n\r\n// Devup UI transforms it at build time\r\nconst generated = <div className=\"a b c\" />\r\n\r\n// With optimized atomic CSS\r\n// .a { background-color: red; }\r\n// .b { padding: 16px; } /* 4 * 4 = 16px */\r\n// .c:hover { background-color: blue; }\r\n```\r\n\r\n> Numeric values are multiplied by 4. `p={4}` becomes `padding: 16px`.\r\n\r\nClass names use compact base-37 encoding (`a`, `b`, ... `z`, `_`, `aa`, `ab`, ...) for minimal CSS output.\r\n\r\n### Familiar API\r\n\r\nIf you've used styled-components or Emotion, you'll feel right at home:\r\n\r\n```tsx\r\nimport { styled } from '@devup-ui/react'\r\n\r\nconst Card = styled('div', {\r\n bg: 'white',\r\n p: 4, // 4 * 4 = 16px\r\n borderRadius: '8px',\r\n boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)',\r\n _hover: {\r\n boxShadow: '0 10px 15px rgba(0, 0, 0, 0.1)',\r\n },\r\n})\r\n```\r\n\r\n### Proven Performance\r\n\r\nBenchmarks on Next.js (GitHub Actions - ubuntu-latest):\r\n\r\n<Table>\r\n <TableHead>\r\n <TableRow>\r\n <TableHeaderCell>Library</TableHeaderCell>\r\n <TableHeaderCell>Version</TableHeaderCell>\r\n <TableHeaderCell>Build Time</TableHeaderCell>\r\n <TableHeaderCell>Build Size</TableHeaderCell>\r\n </TableRow>\r\n </TableHead>\r\n <TableBody>\r\n <TableRow>\r\n <TableCell>tailwindcss</TableCell>\r\n <TableCell>4.1.13</TableCell>\r\n <TableCell>19.31s</TableCell>\r\n <TableCell>59,521,539 bytes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>styleX</TableCell>\r\n <TableCell>0.15.4</TableCell>\r\n <TableCell>41.78s</TableCell>\r\n <TableCell>86,869,452 bytes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>vanilla-extract</TableCell>\r\n <TableCell>1.17.4</TableCell>\r\n <TableCell>19.50s</TableCell>\r\n <TableCell>61,494,033 bytes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>kuma-ui</TableCell>\r\n <TableCell>1.5.9</TableCell>\r\n <TableCell>20.93s</TableCell>\r\n <TableCell>69,924,179 bytes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>panda-css</TableCell>\r\n <TableCell>1.3.1</TableCell>\r\n <TableCell>20.64s</TableCell>\r\n <TableCell>64,573,260 bytes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>chakra-ui</TableCell>\r\n <TableCell>3.27.0</TableCell>\r\n <TableCell>28.81s</TableCell>\r\n <TableCell>222,435,802 bytes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>mui</TableCell>\r\n <TableCell>7.3.2</TableCell>\r\n <TableCell>20.86s</TableCell>\r\n <TableCell>97,964,458 bytes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>**devup-ui (per-file css)**</TableCell>\r\n <TableCell>**1.0.18**</TableCell>\r\n <TableCell>**16.90s**</TableCell>\r\n <TableCell>59,540,459 bytes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>**devup-ui (single css)**</TableCell>\r\n <TableCell>**1.0.18**</TableCell>\r\n <TableCell>**17.05s**</TableCell>\r\n <TableCell>**59,520,196 bytes**</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>tailwindcss (turbopack)</TableCell>\r\n <TableCell>4.1.13</TableCell>\r\n <TableCell>6.72s</TableCell>\r\n <TableCell>5,355,082 bytes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>**devup-ui (single css + turbopack)**</TableCell>\r\n <TableCell>**1.0.18**</TableCell>\r\n <TableCell>10.34s</TableCell>\r\n <TableCell>**4,772,050 bytes**</TableCell>\r\n </TableRow>\r\n </TableBody>\r\n</Table>\r\n\r\n### Get Started\r\n\r\nReady to experience the future of CSS-in-JS? Head to the [Installation](/docs/installation) guide to get started in minutes.\r\n","title":"What is Devup UI?eeeeeeeeeeee","url":"/documentation/concept/concept-1"},null,null,null,null,null,{"text":"## What is Devup UI?\r\n\r\n**Devup UI is not just another CSS-in-JS library — it's the future of CSS-in-JS itself.**\r\n\r\nDevup UI is a zero-runtime CSS-in-JS preprocessor powered by Rust and WebAssembly. It transforms all your styles at build time, completely eliminating runtime overhead while providing full CSS-in-JS syntax coverage.\r\n\r\n### The Problem with Traditional CSS-in-JS\r\n\r\nTraditional CSS-in-JS solutions force you to choose between:\r\n\r\n- **Developer Experience**: Intuitive APIs, co-located styles, dynamic theming\r\n- **Performance**: No runtime overhead, fast page loads, optimal Core Web Vitals\r\n\r\nLibraries like styled-components and Emotion offer great DX but execute JavaScript at runtime to generate styles. Zero-runtime alternatives like Vanilla Extract sacrifice some flexibility for performance.\r\n\r\n### The Devup UI Solution\r\n\r\nDevup UI eliminates this trade-off entirely. Our Rust-powered preprocessor analyzes your code at build time and handles every CSS-in-JS pattern:\r\n\r\n- **Variables** — Dynamic values become CSS custom properties\r\n- **Conditionals** — Ternary expressions are statically analyzed\r\n- **Responsive Arrays** — Breakpoint-based styles are pre-generated\r\n- **Pseudo Selectors** — `_hover`, `_focus`, `_active` work seamlessly\r\n- **Themes** — Type-safe theme tokens with zero-cost switching\r\n\r\n### Key Advantages\r\n\r\n<Table>\r\n <TableHead>\r\n <TableRow>\r\n <TableHeaderCell>Feature</TableHeaderCell>\r\n <TableHeaderCell>Devup UI</TableHeaderCell>\r\n <TableHeaderCell>styled-components</TableHeaderCell>\r\n <TableHeaderCell>Emotion</TableHeaderCell>\r\n <TableHeaderCell>Vanilla Extract</TableHeaderCell>\r\n </TableRow>\r\n </TableHead>\r\n <TableBody>\r\n <TableRow>\r\n <TableCell>Zero Runtime</TableCell>\r\n <TableCell>Yes</TableCell>\r\n <TableCell>No</TableCell>\r\n <TableCell>No</TableCell>\r\n <TableCell>Yes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>Dynamic Values</TableCell>\r\n <TableCell>Yes</TableCell>\r\n <TableCell>Yes</TableCell>\r\n <TableCell>Yes</TableCell>\r\n <TableCell>Limited</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>Full Syntax Coverage</TableCell>\r\n <TableCell>Yes</TableCell>\r\n <TableCell>Yes</TableCell>\r\n <TableCell>Yes</TableCell>\r\n <TableCell>No</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>Type-Safe Themes</TableCell>\r\n <TableCell>Yes</TableCell>\r\n <TableCell>Limited</TableCell>\r\n <TableCell>Limited</TableCell>\r\n <TableCell>Yes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>Build Performance</TableCell>\r\n <TableCell>Fastest</TableCell>\r\n <TableCell>N/A</TableCell>\r\n <TableCell>N/A</TableCell>\r\n <TableCell>Fast</TableCell>\r\n </TableRow>\r\n </TableBody>\r\n</Table>\r\n\r\n### How It Works\r\n\r\n```tsx\r\n// You write familiar CSS-in-JS syntax\r\nconst example = <Box _hover={{ bg: 'blue' }} bg=\"red\" p={4} />\r\n\r\n// Devup UI transforms it at build time\r\nconst generated = <div className=\"a b c\" />\r\n\r\n// With optimized atomic CSS\r\n// .a { background-color: red; }\r\n// .b { padding: 16px; } /* 4 * 4 = 16px */\r\n// .c:hover { background-color: blue; }\r\n```\r\n\r\n> Numeric values are multiplied by 4. `p={4}` becomes `padding: 16px`.\r\n\r\nClass names use compact base-37 encoding (`a`, `b`, ... `z`, `_`, `aa`, `ab`, ...) for minimal CSS output.\r\n\r\n### Familiar API\r\n\r\nIf you've used styled-components or Emotion, you'll feel right at home:\r\n\r\n```tsx\r\nimport { styled } from '@devup-ui/react'\r\n\r\nconst Card = styled('div', {\r\n bg: 'white',\r\n p: 4, // 4 * 4 = 16px\r\n borderRadius: '8px',\r\n boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)',\r\n _hover: {\r\n boxShadow: '0 10px 15px rgba(0, 0, 0, 0.1)',\r\n },\r\n})\r\n```\r\n\r\n### Proven Performance\r\n\r\nBenchmarks on Next.js (GitHub Actions - ubuntu-latest):\r\n\r\n<Table>\r\n <TableHead>\r\n <TableRow>\r\n <TableHeaderCell>Library</TableHeaderCell>\r\n <TableHeaderCell>Version</TableHeaderCell>\r\n <TableHeaderCell>Build Time</TableHeaderCell>\r\n <TableHeaderCell>Build Size</TableHeaderCell>\r\n </TableRow>\r\n </TableHead>\r\n <TableBody>\r\n <TableRow>\r\n <TableCell>tailwindcss</TableCell>\r\n <TableCell>4.1.13</TableCell>\r\n <TableCell>19.31s</TableCell>\r\n <TableCell>59,521,539 bytes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>styleX</TableCell>\r\n <TableCell>0.15.4</TableCell>\r\n <TableCell>41.78s</TableCell>\r\n <TableCell>86,869,452 bytes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>vanilla-extract</TableCell>\r\n <TableCell>1.17.4</TableCell>\r\n <TableCell>19.50s</TableCell>\r\n <TableCell>61,494,033 bytes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>kuma-ui</TableCell>\r\n <TableCell>1.5.9</TableCell>\r\n <TableCell>20.93s</TableCell>\r\n <TableCell>69,924,179 bytes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>panda-css</TableCell>\r\n <TableCell>1.3.1</TableCell>\r\n <TableCell>20.64s</TableCell>\r\n <TableCell>64,573,260 bytes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>chakra-ui</TableCell>\r\n <TableCell>3.27.0</TableCell>\r\n <TableCell>28.81s</TableCell>\r\n <TableCell>222,435,802 bytes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>mui</TableCell>\r\n <TableCell>7.3.2</TableCell>\r\n <TableCell>20.86s</TableCell>\r\n <TableCell>97,964,458 bytes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>**devup-ui (per-file css)**</TableCell>\r\n <TableCell>**1.0.18**</TableCell>\r\n <TableCell>**16.90s**</TableCell>\r\n <TableCell>59,540,459 bytes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>**devup-ui (single css)**</TableCell>\r\n <TableCell>**1.0.18**</TableCell>\r\n <TableCell>**17.05s**</TableCell>\r\n <TableCell>**59,520,196 bytes**</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>tailwindcss (turbopack)</TableCell>\r\n <TableCell>4.1.13</TableCell>\r\n <TableCell>6.72s</TableCell>\r\n <TableCell>5,355,082 bytes</TableCell>\r\n </TableRow>\r\n <TableRow>\r\n <TableCell>**devup-ui (single css + turbopack)**</TableCell>\r\n <TableCell>**1.0.18**</TableCell>\r\n <TableCell>10.34s</TableCell>\r\n <TableCell>**4,772,050 bytes**</TableCell>\r\n </TableRow>\r\n </TableBody>\r\n</Table>\r\n\r\n### Get Started\r\n\r\nReady to experience the future of CSS-in-JS? Head to the [Installation](/docs/installation) guide to get started in minutes.\r\n","title":"What is Devup UI?","url":"/documentation/overview"},null,null,null]

apps/front/script.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { glob, readFile, writeFile } from 'node:fs/promises'
2+
3+
const files = await glob('src/**/*.mdx')
4+
5+
const q = []
6+
for await (const file of files) {
7+
q.push(
8+
readFile(file, {
9+
encoding: 'utf-8',
10+
}).then((content) => {
11+
const titleIndex = content.toString().indexOf('#')
12+
if (content.trim().length === 0 || titleIndex === -1) {
13+
return null
14+
}
15+
const titleMatch = /^#+\s+(.*)/m.exec(content.toString())
16+
if (!titleMatch) {
17+
return null
18+
}
19+
20+
const url =
21+
'/' +
22+
file
23+
.replace(/\\/g, '/')
24+
.replace(/^src\/app\//, '')
25+
.replace(/\/\[\.\.\.[^\]]+\]\//, '/')
26+
.replace(/\.mdx$/, '')
27+
.replace(/\./g, '/')
28+
29+
return {
30+
text: content.toString().substring(titleIndex),
31+
title: titleMatch[1],
32+
url,
33+
}
34+
}),
35+
)
36+
}
37+
38+
const res = await Promise.all(q)
39+
40+
await writeFile('public/search.json', JSON.stringify(res))
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { Box, css } from '@devup-ui/react'
2+
3+
import { Effect } from '@/components/header/effect'
4+
import { Search as SearchComponent } from '@/components/search'
5+
import { SearchForm } from '@/components/search/form'
6+
import { SheetRouteTrigger } from '@/components/sheet/router'
7+
8+
import { SearchSheetRouteContainer } from './route-container'
9+
10+
export function SearchSheet() {
11+
return (
12+
<SearchSheetRouteContainer
13+
className={css({
14+
display: 'flex',
15+
alignItems: 'center',
16+
borderRadius: '0px',
17+
h: '68px',
18+
py: '$spacingSpacing12',
19+
pl: '$spacingSpacing04',
20+
pr: '$spacingSpacing20',
21+
gap: '4px',
22+
zIndex: '200',
23+
})}
24+
name="search"
25+
position="top"
26+
>
27+
<SheetRouteTrigger name="search">
28+
<Effect>
29+
<Box
30+
aspectRatio="1"
31+
bg="$title"
32+
boxSize="24px"
33+
maskImage="url('/icons/close.svg')"
34+
maskPos="center"
35+
maskRepeat="no-repeat"
36+
maskSize="contain"
37+
/>
38+
</Effect>
39+
</SheetRouteTrigger>
40+
<SearchForm>
41+
<SearchComponent id="mobile-search" />
42+
</SearchForm>
43+
</SearchSheetRouteContainer>
44+
)
45+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use client'
2+
import { ComponentProps } from 'react'
3+
4+
import { useSearchContext } from '@/components/search/provider'
5+
import { SheetRouteContainer } from '@/components/sheet/router'
6+
7+
export function RouteContainer(
8+
props: ComponentProps<typeof SheetRouteContainer>,
9+
) {
10+
const { insideClickRefs } = useSearchContext()
11+
return (
12+
<SheetRouteContainer
13+
ref={(el) => {
14+
if (!el) return
15+
insideClickRefs.current.add(el)
16+
return () => {
17+
insideClickRefs.current.delete(el)
18+
}
19+
}}
20+
{...props}
21+
/>
22+
)
23+
}
24+
25+
export { RouteContainer as SearchSheetRouteContainer }

0 commit comments

Comments
 (0)