refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게 [공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류. 문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인). - Topic_Programming → Domain_Programming (내부 구조 보존) - Topic_Graphic → Domain_Design - Topic_Business → Domain_Product - Topic_General → Domain_General - _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning), Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing) - 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서) - 빈 폴더 정리 (memory/procedures) - 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+190
@@ -0,0 +1,190 @@
|
||||
---
|
||||
id: wiki-2026-0508-단일-코드베이스를-통한-멀티-디바이스-모바일-데스크톱-웹-
|
||||
title: 단일 코드베이스를 통한 멀티 디바이스(모바일-데스크톱) 웹 인터페이스 구축
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [responsive web, adaptive UI, cross-device web, universal web app]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [frontend, responsive, adaptive, multi-device, cross-platform]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: typescript
|
||||
framework: react
|
||||
---
|
||||
|
||||
# 단일 코드베이스를 통한 멀티 디바이스(모바일-데스크톱) 웹 인터페이스 구축
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 한 코드베이스, 매 device-aware rendering"**. 2026 modern web 은 매 mobile/desktop 분리 코드 X — 매 container query + adaptive component + capability-based fork 로 매 한 React/Svelte/Solid app 이 매 모든 viewport, 매 input modality (touch/mouse/pen), 매 connection (5G/3G) 에 매 최적화. Responsive(rule-based) 에서 Adaptive(behavior-based) 로 진화.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 3-tier 전략
|
||||
- **Layout (CSS)**: container query, `clamp()`, `dvh/svh`, logical property (`inline-size`).
|
||||
- **Component**: 매 same component, 매 different rendering — `useMediaQuery` + `<Show>`.
|
||||
- **Capability fork**: 매 touch vs mouse, 매 hover-capable, 매 prefers-reduced-motion.
|
||||
|
||||
### 매 결정 트리
|
||||
```
|
||||
Viewport-only difference? → CSS container query (no JS)
|
||||
Behavior different? → Adaptive component (JS branching)
|
||||
Entire flow different? → Route-level fork (e.g. /m/checkout vs /checkout)
|
||||
Feature unsupported? → Progressive enhancement
|
||||
```
|
||||
|
||||
### 매 응용
|
||||
1. SaaS dashboard (admin desktop, support mobile).
|
||||
2. E-commerce (mobile-first, desktop dense).
|
||||
3. Internal tool (desktop primary, mobile read-only).
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Container query (modern, 2026 표준)
|
||||
```css
|
||||
.card-host { container-type: inline-size; }
|
||||
|
||||
.card { display: grid; gap: 8px; }
|
||||
@container (min-width: 480px) {
|
||||
.card { grid-template-columns: 120px 1fr; }
|
||||
}
|
||||
@container (min-width: 800px) {
|
||||
.card { grid-template-columns: 200px 1fr 200px; }
|
||||
}
|
||||
```
|
||||
|
||||
### Adaptive component (capability-based)
|
||||
```tsx
|
||||
import { useMediaQuery } from '@/hooks/useMediaQuery';
|
||||
|
||||
export function Navigation() {
|
||||
const isCoarse = useMediaQuery('(pointer: coarse)');
|
||||
const isWide = useMediaQuery('(min-width: 1024px)');
|
||||
|
||||
if (isWide && !isCoarse) return <DesktopSidebar />;
|
||||
if (isCoarse) return <MobileBottomTabs />; // thumb-reach
|
||||
return <CompactTopBar />;
|
||||
}
|
||||
```
|
||||
|
||||
### Logical property + dvh (mobile keyboard 안전)
|
||||
```css
|
||||
.modal {
|
||||
block-size: 100dvh; /* 매 dynamic viewport — keyboard 등장 시 reflow */
|
||||
padding-inline: clamp(16px, 4vw, 32px);
|
||||
padding-block: env(safe-area-inset-top) env(safe-area-inset-bottom);
|
||||
}
|
||||
```
|
||||
|
||||
### Input-aware interaction
|
||||
```tsx
|
||||
function Tooltip({ children, label }: Props) {
|
||||
const canHover = useMediaQuery('(hover: hover)');
|
||||
// 매 touch 에선 hover X — long-press 로 fallback
|
||||
return canHover
|
||||
? <HoverTooltip label={label}>{children}</HoverTooltip>
|
||||
: <LongPressTooltip label={label}>{children}</LongPressTooltip>;
|
||||
}
|
||||
```
|
||||
|
||||
### Route-level adaptive (Next.js App Router)
|
||||
```ts
|
||||
// middleware.ts
|
||||
import { userAgent } from 'next/server';
|
||||
export function middleware(req) {
|
||||
const { device } = userAgent(req);
|
||||
if (device.type === 'mobile' && req.nextUrl.pathname === '/dashboard') {
|
||||
return NextResponse.rewrite(new URL('/m/dashboard', req.url));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Network-aware loading
|
||||
```tsx
|
||||
function HeroImage() {
|
||||
const conn = (navigator as any).connection;
|
||||
const slow = conn?.effectiveType === '2g' || conn?.saveData;
|
||||
return (
|
||||
<picture>
|
||||
{!slow && <source srcSet="/hero-2x.avif" type="image/avif" />}
|
||||
<img src={slow ? '/hero-low.jpg' : '/hero.jpg'} alt="" loading="lazy" />
|
||||
</picture>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### Density-aware list (virtualization)
|
||||
```tsx
|
||||
import { useVirtualizer } from '@tanstack/react-virtual';
|
||||
|
||||
function ItemList({ items }) {
|
||||
const isMobile = useMediaQuery('(max-width: 768px)');
|
||||
const rowHeight = isMobile ? 72 : 48; // touch target ≥ 44px
|
||||
const v = useVirtualizer({
|
||||
count: items.length,
|
||||
estimateSize: () => rowHeight,
|
||||
overscan: 8,
|
||||
});
|
||||
return /* virtualized rows */;
|
||||
}
|
||||
```
|
||||
|
||||
### Server-side device hints (Client Hints, 2026)
|
||||
```http
|
||||
Accept-CH: Sec-CH-UA-Mobile, Sec-CH-Viewport-Width, Sec-CH-DPR
|
||||
```
|
||||
```ts
|
||||
// 매 server 가 매 mobile-optimized HTML 우선 stream
|
||||
const isMobile = req.headers.get('Sec-CH-UA-Mobile') === '?1';
|
||||
```
|
||||
|
||||
### Reduced motion + prefers-color-scheme
|
||||
```css
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
* { animation-duration: 0.01ms !important; transition: none !important; }
|
||||
}
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Layout 크기만 차이 | container query (JS X) |
|
||||
| 동작 (nav, modal) 차이 | adaptive component |
|
||||
| 매 device 별 user journey 자체 다름 | route-level fork or 별도 app |
|
||||
| Email / SEO landing | server-rendered + Client Hints |
|
||||
| Native-feel mobile + desktop | PWA + responsive |
|
||||
| 매 truly native | React Native Web + Tamagui (univ. UI) |
|
||||
|
||||
**기본값**: container query first, `useMediaQuery` for behavior, route fork only when flows truly diverge.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Large_Frontend_Projects|Frontend Architecture]] · [[Responsive Design]]
|
||||
- 변형: [[Adaptive UI]] · [[Progressive Enhancement]] · [[PWA]]
|
||||
- 응용: [[Large_Frontend_Projects]]
|
||||
- Adjacent: [[컨테이너 쿼리 (Container Queries)|Container Queries]] · [[Core Web Vitals Optimization (INP, LCP, CLS)|Core Web Vitals]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: design spec → component variant 자동 생성, breakpoint heuristic 추천, accessibility audit.
|
||||
**언제 X**: 매 actual visual layout 결정 — designer 의 감각 + user testing 의 사용.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **User-agent sniffing 만**: 매 brittle, 매 future-proof X — Client Hints + capability query 의 사용.
|
||||
- **Mobile-only / desktop-only fork 코드 2배**: 매 maintenance 폭발 — adaptive component 우선.
|
||||
- **Fixed `vh`**: mobile address bar / keyboard 시 깨짐 — `dvh/svh` 의 사용.
|
||||
- **Hover 전제 design**: 매 touch user 에 매 hidden interaction.
|
||||
- **44px 미만 touch target**: WCAG fail.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (W3C container queries Lvl 1, MDN 2026, web.dev responsive guide, Tamagui 1.x docs).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — full content (container queries, adaptive components, capability fork) |
|
||||
Reference in New Issue
Block a user