@su-record/vibe 2.8.37 → 2.8.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,83 +1,74 @@
1
- # React+TailwindProject Stack Conversion Rules
2
-
3
- ## Mode Selection (Do This First)
4
-
5
- Classify each section before writing any code. Literal mode if ANY of:
6
- - 15+ asset URLs in the section
7
- - Fractional coordinates (`left-[117.13px]`)
8
- - `mix-blend-*` on any layer
9
- - `rotate-[Ndeg]` or `-scale-y-100`
10
- - `mask-image` usage
11
- - `blur-[Npx]` filter
12
- - BG cropped from 2560px+ source
13
-
14
- Normal mode only when ALL of:
15
- - Flex/grid layout, no absolute coordinates (or integer-only)
16
- - Fewer than 10 asset URLs
17
- - No blend/rotate/mask/blur
18
-
19
- ## Normal Mode Rules
20
-
21
- - Extract CSS values from Tailwind classes — never estimate
22
- - Apply `scaleFactor` to all `px` values; never to colors, opacity, z-index, line-height (unitless)
23
- - Put layout properties in `layout/_section.scss`, visual/text properties in `components/_section.scss`
24
- - No `<style>` block in the component file
25
- - No inline `style=""` attribute in the template
26
-
27
- ## Literal Mode Rules
28
-
29
- - Preserve the full HTML nesting structure 1:1
30
- - Keep all absolute coordinates, fractional px values (rounded after scaling)
31
- - Keep all `mix-blend-mode`, `rotate`, `mask-image`, `blur` values unchanged
32
- - Put all styles in `<style scoped>` inside the component
33
- - Do not create external SCSS files for literal sections
34
-
35
- ## Tailwind Class Gotchas
36
-
37
- | Tailwind | Correct CSS | Common Mistake |
38
- |----------|------------|----------------|
39
- | `size-full` | `width: 100%; height: 100%` | Only setting `width: 100%` |
40
- | `inset-0` | `inset: 0` (shorthand) | Expanding to 4 properties |
41
- | `inset-[-18.13%]` | `inset: -18.13%` | Scaling the % value |
42
- | `overflow-clip` | `overflow: clip` | Using `overflow: hidden` |
43
- | `leading-[1.4]` | `line-height: 1.4` | Applying scaleFactor |
44
- | `max-w-none` | `max-width: none` | Omitting entirely |
45
- | `object-cover` on `<img>` | `object-fit: cover` + parent `overflow: hidden` | Forgetting parent clip |
46
- | `pointer-events-none` | `pointer-events: none` | Omitting for decorative layers |
47
- | `text-white` | `color: #FFFFFF` | Using `color: white` |
48
- | `font-black` | `font-weight: 900` | Using `font-weight: bold` |
49
-
50
- ## Scale Application
51
-
52
- Apply `× scaleFactor` to:
53
- - `px` sizes: font-size, padding, margin, gap, border-radius, width, height, top, left, bottom, right
54
- - `px` in box-shadow, blur filter, letter-spacing
55
-
56
- Do NOT scale:
57
- - Color values
58
- - Opacity values
59
- - `%` values
60
- - Unitless line-height
61
- - z-index
62
- - `mix-blend-mode` values
63
- - `rotate` degree values
64
-
65
- ## Sprite / Overflow Image Pattern
66
-
67
- When `left` is a large negative %, it is a sprite crop — do NOT scale:
68
- ```css
69
- /* Correct */
70
- left: -129.09%;
71
- width: 229.09%;
72
-
73
- /* Wrong — do not scale % values */
74
- left: -86.09%; /* -129.09 × 0.667 — incorrect */
1
+ # TreeCode Conversion Rules
2
+
3
+ ## Core Principle
4
+
5
+ 모든 CSS 값은 tree.json에서 직접 매핑한다. 추정하지 않는다.
6
+
7
+ ## Node HTML Mapping (Do This First)
8
+
9
+ 노드를 순서대로 분류:
10
+
11
+ | 노드 조건 | HTML 매핑 |
12
+ |-----------|----------|
13
+ | FRAME + Auto Layout | `<div>` + flex (direction/gap/padding 직접) |
14
+ | FRAME + no Auto Layout | `<div>` + position:relative (자식 absolute) |
15
+ | TEXT | `<span>` Claude가 `<h2>/<p>/<button>` 승격 |
16
+ | RECTANGLE/VECTOR + imageRef | `<img src="다운로드된 파일">` |
17
+ | VECTOR/GROUP ≤ 64px | 아이콘 → `<img>` (렌더링 이미지) |
18
+ | INSTANCE 반복 3+ | v-for (Vue) 또는 .map() (React) |
19
+ | 크기 0px | 스킵 |
20
+ | VECTOR 장식선 (w/h ≤ 2px) | 스킵 |
21
+
22
+ ## 배경 레이어 판별
23
+
24
+ 부모와 동일 크기(±5%) + imageRef + 형제 중 첫 위치:
25
+ `position: absolute; inset: 0; z-index: 0; object-fit: cover`
26
+ → 부모에 `position: relative; overflow: hidden` 추가
27
+
28
+ ## CSS 직접 매핑 규칙
29
+
30
+ tree.json의 css 객체를 SCSS에 1:1 매핑한다:
31
+
32
+ ### layout/ 파일에 넣는 속성
33
+ ```
34
+ display, flex-direction, justify-content, align-items,
35
+ gap, padding, width, height, position, overflow, z-index, inset
75
36
  ```
76
37
 
77
- ## Class Naming (Literal Mode)
38
+ ### components/ 파일에 넣는 속성
39
+ ```
40
+ background-color, color, font-family, font-size, font-weight,
41
+ line-height, letter-spacing, text-align, border, border-radius,
42
+ box-shadow, opacity, mix-blend-mode, filter, backdrop-filter
43
+ ```
44
+
45
+ ## Scale Factor 적용
46
+
47
+ **적용 (px 값):**
48
+ font-size, padding, margin, gap, width, height, border-radius,
49
+ border-width, box-shadow px, filter px, letter-spacing
50
+
51
+ **미적용:**
52
+ color, opacity, font-weight, font-family, z-index,
53
+ line-height(단위 없을 때), text-align, mix-blend-mode,
54
+ rotate, % 값
55
+
56
+ ## 장식 레이어 최적화
57
+
58
+ BG 그룹 내 장식 요소가 10개 이상:
59
+ → 배경 이미지 1장 + 핵심 장식 2~3개만 유지
60
+ → 나머지 생략 (Phase 4 스크린샷 검증에서 확인)
61
+
62
+ ## Class Naming
63
+
64
+ BEM 패턴: `.sectionName__childName`
65
+ - 부모: `.heroSection`
66
+ - 자식: `.heroSection__bg`, `.heroSection__title`, `.heroSection__shareBtn`
67
+ - template에서 사용한 모든 클래스가 SCSS에 정의되어야 함
68
+
69
+ ## 자가 검증 (코드 작성 후)
78
70
 
79
- Source priority: `data-name` attribute `data-node-id`
80
- - `data-name="BG"` `.bg`
81
- - `data-name="Light"``.light`
82
- - No `data-name` `.node-{nodeId}` (replace `:` with `-`)
83
- - Conflicts: append parent name prefix (`.heroLight`, `.kidLight`)
71
+ - [ ] template 클래스 ↔ SCSS 클래스 1:1 일치
72
+ - [ ] 모든 img src가 static/에 실제 존재
73
+ - [ ] Auto Layout 노드 SCSS에 flex 속성 존재
74
+ - [ ] tree.json에 없는 CSS 값이 SCSS에 없음
@@ -1,152 +1,144 @@
1
- # Component Output Template
1
+ # Component Output Template — Tree-Based Generation
2
2
 
3
- Use this template when generating a section component from Figma reference code.
3
+ tree.json 노드를 기반으로 컴포넌트를 생성할 템플릿을 따른다.
4
4
 
5
5
  ---
6
6
 
7
- ## Normal Mode (External SCSS)
7
+ ## Vue / Nuxt (External SCSS)
8
8
 
9
9
  ```vue
10
- <!-- components/{{FEATURE_KEY}}/{{ComponentName}}.vue -->
10
+ <!--
11
+ tree.json 구조:
12
+ {{SECTION_NAME}} ({{TYPE}} {{WIDTH}}x{{HEIGHT}})
13
+ ├── BG (FRAME — 배경 레이어)
14
+ │ └── imageRef → {{BG_IMAGE}}
15
+ ├── {{CHILD_1}} (FRAME — flex-column, gap:{{GAP}}px)
16
+ │ ├── TEXT "{{TEXT_1}}"
17
+ │ └── TEXT "{{TEXT_2}}"
18
+ └── {{CHILD_2}} (FRAME — flex-row, gap:{{GAP_2}}px)
19
+ └── INSTANCE × {{REPEAT_COUNT}} (반복 패턴)
20
+ -->
11
21
  <template>
12
22
  <section class="{{sectionName}}">
13
- <!-- BG Layer (if section has background image) -->
14
- <div class="{{sectionName}}Bg">
15
- <img src="/images/{{FEATURE_KEY}}/{{bg-file}}.webp" alt="" aria-hidden="true" />
23
+ <!-- BG: 부모와 동일 크기 + imageRef 배경 레이어 -->
24
+ <div class="{{sectionName}}__bg">
25
+ <img src="/images/{{FEATURE_KEY}}/{{bg-file}}.png" alt="" aria-hidden="true" />
16
26
  </div>
17
27
 
18
- <!-- Content Layer -->
19
- <div class="{{sectionName}}Content">
20
- <!-- Title image (if present) -->
21
- <div class="{{sectionName}}Title">
22
- <img src="/images/{{FEATURE_KEY}}/{{title-file}}.webp" alt="{{TITLE_ALT_TEXT}}" />
23
- </div>
24
-
25
- <!-- Repeating items (from storyboard mock data) -->
26
- <ul class="{{sectionName}}List">
27
- <li
28
- v-for="item in items"
29
- :key="item.id"
30
- class="{{sectionName}}Item"
31
- >
32
- <img :src="item.image" :alt="item.label" />
33
- <p class="{{sectionName}}ItemLabel">{{ item.label }}</p>
34
- </li>
35
- </ul>
36
-
37
- <!-- CTA Button -->
38
- <button class="{{sectionName}}Btn" @click="handleAction">
39
- {{BUTTON_LABEL}}
40
- </button>
28
+ <!-- {{CHILD_1}}: tree flex-column, gap:{{GAP}}px → 직접 매핑 -->
29
+ <div class="{{sectionName}}__{{child1Name}}">
30
+ <!-- TEXT 노드 Claude가 시맨틱 태그 판단 -->
31
+ <h2 class="{{sectionName}}__title">{{TEXT_1}}</h2>
32
+ <p class="{{sectionName}}__desc">{{TEXT_2}}</p>
41
33
  </div>
34
+
35
+ <!-- {{CHILD_2}}: INSTANCE 반복 → v-for -->
36
+ <ul class="{{sectionName}}__list">
37
+ <li
38
+ v-for="item in items"
39
+ :key="item.id"
40
+ class="{{sectionName}}__item"
41
+ >
42
+ <img :src="item.image" :alt="item.name" class="{{sectionName}}__itemImg" />
43
+ <span class="{{sectionName}}__itemLabel">{{ item.name }}</span>
44
+ </li>
45
+ </ul>
42
46
  </section>
43
47
  </template>
44
48
 
45
49
  <script setup lang="ts">
46
50
  /**
47
51
  * {{SECTION_DISPLAY_NAME}}
52
+ * tree.json: {{SECTION_NAME}} ({{TYPE}} {{WIDTH}}x{{HEIGHT}})
48
53
  *
49
54
  * [기능 정의]
50
55
  * - {{FEATURE_REQUIREMENT_1}}
51
- * - {{FEATURE_REQUIREMENT_2}}
52
56
  *
53
57
  * [인터랙션]
54
58
  * ① {{INTERACTION_1}}
55
- * ② {{INTERACTION_2}}
56
59
  *
57
60
  * [상태] {{STATE_LIST}}
58
61
  */
59
62
 
60
63
  interface {{ItemType}} {
61
- id: number
62
- label: string
64
+ id: string
65
+ name: string
63
66
  image: string
64
67
  }
65
68
 
66
- const items: {{ItemType}}[] = [
67
- { id: 1, label: '{{MOCK_LABEL_1}}', image: '/images/{{FEATURE_KEY}}/{{mock-img-1}}.webp' },
68
- { id: 2, label: '{{MOCK_LABEL_2}}', image: '/images/{{FEATURE_KEY}}/{{mock-img-2}}.webp' },
69
- { id: 3, label: '{{MOCK_LABEL_3}}', image: '/images/{{FEATURE_KEY}}/{{mock-img-3}}.webp' },
70
- ]
71
-
72
- const emit = defineEmits<{
73
- action: []
69
+ defineProps<{
70
+ items: {{ItemType}}[]
74
71
  }>()
75
-
76
- function handleAction(): void {
77
- // TODO: {{ACTION_DESCRIPTION}}
78
- emit('action')
79
- }
80
72
  </script>
81
73
  <!-- styles: styles/{{FEATURE_KEY}}/layout/_{{section}}.scss + components/_{{section}}.scss -->
82
74
  ```
83
75
 
84
76
  ---
85
77
 
86
- ## Literal Mode (Scoped CSS)
87
-
88
- ```vue
89
- <!-- components/{{FEATURE_KEY}}/{{ComponentName}}.vue -->
90
- <template>
91
- <section class="{{sectionName}}">
92
- <!-- 1:1 structure from reference code — preserve all nesting -->
93
- <div class="bg">
94
- <img src="/images/{{FEATURE_KEY}}/{{bg-file}}.webp" alt="" aria-hidden="true" />
95
- </div>
96
- <div class="titleArea">
97
- <img src="/images/{{FEATURE_KEY}}/{{title-file}}.webp" alt="{{TITLE_ALT_TEXT}}" />
98
- </div>
99
- <!-- Re-insert Phase 1 functional elements at appropriate positions -->
100
- <button class="ctaBtn" @click="handleAction">{{BUTTON_LABEL}}</button>
101
- </section>
102
- </template>
78
+ ## SCSS Layout (tree.json 직접 매핑)
103
79
 
104
- <script setup lang="ts">
105
- /**
106
- * {{SECTION_DISPLAY_NAME}}
107
- * [기능 정의] {{FEATURE_REQUIREMENT_1}}
108
- * [인터랙션] {{INTERACTION_1}}
109
- * [상태] {{STATE_LIST}}
110
- */
80
+ ```scss
81
+ // tree.json 데이터:
82
+ // {{SECTION_NAME}}: { width:{{WIDTH}}, height:{{HEIGHT}}, overflow:hidden }
83
+ // {{CHILD_1}}: { display:flex, flexDirection:column, gap:{{GAP}}px, padding:"{{PADDING}}" }
84
+ // scaleFactor = {{SCALE_FACTOR}}
111
85
 
112
- function handleAction(): void {
113
- // TODO: {{ACTION_DESCRIPTION}}
114
- }
115
- </script>
116
-
117
- <style scoped>
118
86
  .{{sectionName}} {
119
87
  position: relative;
120
88
  width: 100%;
121
- height: {{SECTION_HEIGHT_SCALED}}px; /* {{SECTION_HEIGHT_ORIGINAL}} × {{SCALE_FACTOR}} */
122
- overflow: hidden;
89
+ height: {{HEIGHT_SCALED}}px; // tree: {{HEIGHT}} × {{SCALE_FACTOR}}
90
+ overflow: hidden; // tree: overflow:hidden
123
91
  }
124
92
 
125
- .bg {
93
+ .{{sectionName}}__bg {
126
94
  position: absolute;
127
95
  inset: 0;
96
+ z-index: 0;
97
+ img { width: 100%; height: 100%; object-fit: cover; }
128
98
  }
129
99
 
130
- .bg img {
131
- width: 100%;
132
- height: 100%;
133
- object-fit: cover;
100
+ .{{sectionName}}__{{child1Name}} {
101
+ display: flex; // tree: display:flex
102
+ flex-direction: column; // tree: flexDirection:column
103
+ gap: {{GAP_SCALED}}px; // tree: {{GAP}} × {{SCALE_FACTOR}}
104
+ padding: {{PADDING_SCALED}}; // tree: "{{PADDING}}" × {{SCALE_FACTOR}}
134
105
  }
106
+ ```
135
107
 
136
- .titleArea {
137
- position: absolute;
138
- top: {{TITLE_TOP_SCALED}}px; /* {{TITLE_TOP_ORIGINAL}} × {{SCALE_FACTOR}} */
139
- left: 50%;
140
- transform: translateX(-50%);
141
- width: {{TITLE_WIDTH_SCALED}}px;
142
- height: {{TITLE_HEIGHT_SCALED}}px;
143
- }
108
+ ---
109
+
110
+ ## SCSS Components (tree.json 직접 매핑)
111
+
112
+ ```scss
113
+ // tree.json 데이터:
114
+ // TEXT "{{TEXT_1}}": { fontSize:{{FONT_SIZE}}px, fontWeight:{{FONT_WEIGHT}}, color:{{COLOR}} }
144
115
 
145
- /* {{RESPONSIVE_BREAKPOINT}} */
146
- @media (min-width: {{BP_PC}}px) {
147
- .{{sectionName}} {
148
- height: {{SECTION_HEIGHT_PC_SCALED}}px;
149
- }
116
+ .{{sectionName}}__title {
117
+ font-size: {{FONT_SIZE_SCALED}}px; // tree: {{FONT_SIZE}} × {{SCALE_FACTOR}}
118
+ font-weight: {{FONT_WEIGHT}}; // tree: 직접 (scaleFactor 미적용)
119
+ color: {{COLOR}}; // tree: 직접 (scaleFactor 미적용)
150
120
  }
151
- </style>
152
121
  ```
122
+
123
+ ---
124
+
125
+ ## React / Next.js 변환
126
+
127
+ | Vue | React |
128
+ |-----|-------|
129
+ | `class="..."` | `className={styles.xxx}` (CSS Module) |
130
+ | `v-for="i in items" :key="i.id"` | `{items.map(i => <X key={i.id} />)}` |
131
+ | `v-if="condition"` | `{condition && <X />}` |
132
+ | `@click="handler"` | `onClick={handler}` |
133
+ | `<img src="/images/..."` | `<Image src="/images/..."` |
134
+
135
+ ---
136
+
137
+ ## 검증 체크리스트
138
+
139
+ - [ ] tree.json에 없는 CSS 값이 SCSS에 없음
140
+ - [ ] template 클래스 ↔ SCSS 클래스 1:1 일치
141
+ - [ ] 모든 img src가 static/에 실제 존재
142
+ - [ ] TEXT 노드의 characters가 template에 그대로 삽입됨
143
+ - [ ] Auto Layout 노드 → SCSS에 flex 속성 존재
144
+ - [ ] 빌드 성공