medesign 1.2.0 → 1.6.0

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.
Files changed (51) hide show
  1. package/README.md +223 -129
  2. package/bin/mebolder.js +4 -0
  3. package/bin/medesign.js +992 -200
  4. package/bin/melint.js +4 -0
  5. package/bin/mepolish.js +4 -0
  6. package/bin/mequiet.js +4 -0
  7. package/bin/mesearch.js +4 -0
  8. package/bin/mesnapshot.js +4 -0
  9. package/examples/cadastral-qaqc-slide.html +577 -0
  10. package/examples/executive-summary-report.html +597 -0
  11. package/examples/executive-summary-report.pdf +0 -0
  12. package/examples/geospatial-banner-1200x630.html +370 -0
  13. package/examples/geospatial-banner-1200x630.svg +149 -0
  14. package/examples/linear-issue-board.html +1273 -0
  15. package/examples/snapshots/cadastral-qaqc-slide-desktop-1440x900.png +0 -0
  16. package/examples/snapshots/cadastral-qaqc-slide-mobile-390x844.png +0 -0
  17. package/examples/snapshots/cadastral-qaqc-slide-tablet-820x1180.png +0 -0
  18. package/examples/snapshots/executive-summary-report-desktop-1440x900.png +0 -0
  19. package/examples/snapshots/executive-summary-report-mobile-390x844.png +0 -0
  20. package/examples/snapshots/executive-summary-report-tablet-820x1180.png +0 -0
  21. package/examples/snapshots/geospatial-banner-1200x630-og-banner-1200x630.png +0 -0
  22. package/examples/snapshots/linear-issue-board-desktop-1440x900.png +0 -0
  23. package/examples/snapshots/linear-issue-board-mobile-390x844.png +0 -0
  24. package/examples/snapshots/linear-issue-board-tablet-820x1180.png +0 -0
  25. package/examples/snapshots/spotify-web-player-desktop-1440x900.png +0 -0
  26. package/examples/snapshots/spotify-web-player-mobile-390x844.png +0 -0
  27. package/examples/snapshots/spotify-web-player-tablet-820x1180.png +0 -0
  28. package/examples/spotify-web-player.html +1446 -0
  29. package/package.json +21 -4
  30. package/presets/metha/guidelines.md +26 -17
  31. package/presets/metha/preset.json +16 -16
  32. package/references/ai-tells.md +9 -2
  33. package/references/brand-design-tokens.md +27 -28
  34. package/references/brief-intake.md +90 -0
  35. package/references/catalog.json +1024 -101
  36. package/references/cli-architecture.md +1 -1
  37. package/references/compositor-smoothness.md +161 -0
  38. package/references/design-core.md +11 -4
  39. package/references/executive-reports.md +234 -0
  40. package/references/image-mockup-direction.md +53 -53
  41. package/references/image-to-code.md +46 -46
  42. package/references/modern-craft-invariants.md +55 -9
  43. package/references/prompt-templates.md +49 -0
  44. package/references/quality-gate.md +42 -12
  45. package/references/typography-thai-latin.md +206 -0
  46. package/references/view-transitions-engine.md +89 -0
  47. package/references/web-retrofit-protocol.md +103 -0
  48. package/scripts/export-tokens.js +419 -403
  49. package/tests/browser-audit.js +463 -442
  50. package/tests/linter.js +457 -412
  51. package/tests/snapshot.js +263 -0
@@ -75,7 +75,7 @@ export interface Diagnostic {
75
75
  $$Q = 0.30H + 0.25I + 0.20G + 0.15R + 0.10V$$
76
76
 
77
77
  - **$H$ (Hierarchy & Task Saliency - 30%):** จุดโฟกัสสอดคล้องกับ Attention Model (Task-First, Spatial, Alert-First, Reading, F, Z)
78
- - **$I$ (Information Architecture - 25%):** ความครบถ้วนของ State Contract (6 สถานะ), แหล่งข้อมูล และการจัดกลุ่มข้อมูล
78
+ - **$I$ (Information Architecture - 25%):** ความครบถ้วนของ State Handling (10-State Machine Matrix), แหล่งข้อมูล และการจัดกลุ่มข้อมูล
79
79
  - **$G$ (Geometry & Coherence - 20%):** Concentric Border Radius, Hit Target $\ge 44\text{px}$, และ Aspect Ratio ของโมดูล
80
80
  - **$R$ (Responsive Stability & CLS - 15%):** Reserved Geometry, Stable Data Regions, Breakpoint Flow (CLS $\approx 0$)
81
81
  - **$V$ (Visual Craft & Anti-Slop - 10%):** การใช้ OKLCH/OKLab, Tinted Neutrals, Zero Em-Dash, Zero Decisionless Uniformity
@@ -0,0 +1,161 @@
1
+ # 120fps Compositor-Only Threading & Web Smoothness Guide
2
+
3
+ คู่มือวิศวกรรมความลื่นไหลระดับ 60–120fps สำหรับเว็บยุคใหม่ ครอบคลุมสถาปัตยกรรม Compositor Pipeline, Scroll Physics (Lenis vs Pure CSS), Offscreen Render Culling (`content-visibility: auto`), และการป้องกัน Layout Thrashing ขั้นเด็ดขาด
4
+
5
+ ---
6
+
7
+ ## 1. ⚡ The Compositor Thread Invariant (กฎเหล็ก 0ms Layout Cost)
8
+
9
+ ### A. Rendering Pipeline Architecture
10
+ เบราว์เซอร์สมัยใหม่แยกการทำงานเป็น 2 Thread หลัก:
11
+ 1. **Main Thread (JS / DOM / Style / Layout / Paint):** รับผิดชอบตรรกะ JavaScript, Event handling, และการคำนวณตำแหน่งเรขาคณิต (Reflow/Layout) หากเธรดนี้ติดภาระงาน (Long Task > 50ms) การแสดงผลจะสะดุดทันที
12
+ 2. **Compositor Thread (GPU Rasterization & Composition):** รับผิดชอบการนำเลเยอร์ภาพที่วาดเสร็จแล้วมาจัดวางบนจอผ่าน GPU ทำงานขนานกับ Main Thread ได้อย่างอิสระที่ **60fps / 120fps นิ่งสนิท**
13
+
14
+ ```
15
+ ❌ BAD (Triggers Layout + Paint):
16
+ Changing top, left, width, height, margin, padding
17
+ ┌─────────────┐ ┌────────────┐ ┌───────────┐ ┌──────────────┐
18
+ │ JavaScript │ ─> │ Layout │ ─> │ Paint │ ─> │ Composite │ (Jank Risk: 100%)
19
+ └─────────────┘ └────────────┘ └───────────┘ └──────────────┘
20
+
21
+ ✅ COMPOSITOR-ONLY (Bypasses Layout + Paint):
22
+ Changing transform (translate3d, scale, rotate) or opacity
23
+ ┌─────────────┐ ┌──────────────┐
24
+ │ JavaScript │ ────────────────────────────────────> │ Composite │ (120fps Locked)
25
+ └─────────────┘ └──────────────┘
26
+ ```
27
+
28
+ ### B. Compositor Safe Properties
29
+ อนิเมชัน การเลื่อน หรือ Micro-interaction ทั้งหมด **ต้องใช้เฉพาะ 2 คุณสมบัตินี้เท่านั้น**:
30
+ 1. `transform` (บังคับใช้ `translate3d(x, y, 0)` หรือ CSS Transform functions สมัยใหม่ เช่น `translate`, `scale`, `rotate`)
31
+ 2. `opacity`
32
+
33
+ > [!CAUTION]
34
+ > **ห้าม Animate ด้วย Properties ต่อไปนี้เด็ดขาด:** `width`, `height`, `top`, `bottom`, `left`, `right`, `margin`, `padding`, `border-width`, `font-size` เพราะจะบังคับให้เกิด Full Reflow ทั่วทั้ง DOM Tree
35
+
36
+ ### C. กฎการใช้ `will-change` อย่างปลอดภัย
37
+ - **ปัญหา:** การใส่ `will-change: transform` ทิ้งไว้ในคลาสปกติทุกชิ้นจะบังคับให้ GPU จอง VRAM Layer แยก ทำให้กินหน่วยความจำมหาศาลและเว็บช้าลง
38
+ - **แนวทางปฏิบัติ:** ใส่เฉพาะเมื่อใกล้จะเกิดการขยับเท่านั้น เช่น ในสถานะ `:hover` หรือเพิ่มผ่าน JS ทันทีที่มีการทัช/ลาก แล้วถอดออกเมื่อจบอนิเมชัน:
39
+ ```css
40
+ /* ✅ ใส่ will-change เฉพาะขณะ Hover */
41
+ .interactive-card {
42
+ transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
43
+ }
44
+ .interactive-card:hover {
45
+ will-change: transform;
46
+ transform: translateY(-4px) scale(1.01);
47
+ }
48
+ ```
49
+
50
+ ---
51
+
52
+ ## 2. 🌀 Scroll Physics & Momentum Engineering
53
+
54
+ ### A. Scroll Architecture Matrix (เลือกใช้งานให้ถูกบริบท)
55
+
56
+ | Architecture | เหมาะสำหรับ | ข้อดี | ข้อจำกัด / ข้อควรระวัง |
57
+ | :--- | :--- | :--- | :--- |
58
+ | **1. CSS Scroll-Driven Animations** | Hero reveal, Reading progress, Card stacks, Bento grid entry | **0KB JS**, รันบน Compositor Thread 100% แม้ Main Thread จะบล็อก | ต้องมี `@supports (animation-timeline: view())` fallback |
59
+ | **2. Lenis (Virtual Smooth Scroll)** | Agency Portfolio, Showcase, Luxury Landing Page | สัมผัส Inertial Scroll นุ่มนวล ควบคุม Lerp ได้อิสระ | ไม่ควรใช้กับ Dashboard หนักๆ หรือตารางข้อมูล GIS |
60
+ | **3. Native Browser Momentum** | High-density Web Apps, GIS Dashboard, Admin Portals | ประสิทธิภาพสูงสุด เข้าถึงง่าย ทำงานตาม OS ดั้งเดิม | การหมุนเมาส์ Wheel บน Windows อาจรู้สึกกระตุกเป็นสเต็ป |
61
+
62
+ ### B. Lenis Implementation Blueprint (React / Next.js)
63
+ ```tsx
64
+ "use client";
65
+ import { useEffect } from "react";
66
+ import Lenis from "lenis";
67
+
68
+ export function SmoothScrollProvider({ children }: { children: React.ReactNode }) {
69
+ useEffect(() => {
70
+ // ปิดการใช้งานหากผู้ใช้เปิด prefers-reduced-motion
71
+ if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
72
+
73
+ const lenis = new Lenis({
74
+ duration: 1.15,
75
+ easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)), // Exponential Ease Out
76
+ wheelMultiplier: 0.95,
77
+ touchMultiplier: 1.5,
78
+ autoResize: true,
79
+ });
80
+
81
+ function raf(time: number) {
82
+ lenis.raf(time);
83
+ requestAnimationFrame(raf);
84
+ }
85
+ const rafId = requestAnimationFrame(raf);
86
+
87
+ return () => {
88
+ cancelAnimationFrame(rafId);
89
+ lenis.destroy();
90
+ };
91
+ }, []);
92
+
93
+ return <>{children}</>;
94
+ }
95
+ ```
96
+
97
+ ### C. Scroll Chaining Prevention & Gutter Stabilization
98
+ ```css
99
+ /* ป้องกันหน้าหลักข้างหลังเลื่อนตามเมื่อเลื่อน Drawer หรือ Modal จนสุด */
100
+ .modal-body,
101
+ .drawer-content {
102
+ overscroll-behavior: contain;
103
+ -webkit-overflow-scrolling: touch;
104
+ }
105
+
106
+ /* ป้องกันหน้าจอกระตุก 15px เวลาเปิด Modal แล้ว Scrollbar หายไป */
107
+ html {
108
+ scrollbar-gutter: stable;
109
+ }
110
+ ```
111
+
112
+ ---
113
+
114
+ ## 3. 🚀 Off-Screen Render Culling (`content-visibility: auto`)
115
+
116
+ สำหรับหน้าเว็บที่มีความยาว (Long Page) หรือมีหลาย Section ให้เปิดใช้ `content-visibility: auto`:
117
+ ```css
118
+ /* ทุก Section ที่อยู่นอกสายตาแรก (Below the fold) */
119
+ .section-deferred {
120
+ content-visibility: auto;
121
+ contain-intrinsic-size: auto 650px; /* ประมาณความสูงเพื่อรักษาระยะ Scrollbar ให้แม่นยำ */
122
+ }
123
+ ```
124
+ **ผลลัพธ์เชิงประจักษ์:**
125
+ - ลดเวลา Initial Rendering Time ลง 50–70%
126
+ - ลดการกิน CPU ในขณะเลื่อนหน้าจออย่างเห็นได้ชัด
127
+ - เบราว์เซอร์จะคำนวณ Layout และ Paint เฉพาะเมื่อ Section เลื่อนเข้ามาใกล้ระยะมองเห็น 1000px
128
+
129
+ ---
130
+
131
+ ## 4. 🛑 Anti-Layout-Thrashing Patterns (ป้องกันการคำนวณ DOM วนซ้ำ)
132
+
133
+ Layout Thrashing (Forced Synchronous Layout) เกิดขึ้นเมื่อโค้ด JavaScript อ่านค่าเรขาคณิต (Read) สลับกับการกำหนดสไตล์ (Write) ในเฟรมเดียวกัน
134
+
135
+ ### ตารางคุณสมบัติที่เป็นตัวกระตุ้น Reflow (Avoid reading in loops):
136
+ `offsetWidth`, `offsetHeight`, `clientWidth`, `clientHeight`, `scrollWidth`, `scrollHeight`, `scrollTop`, `scrollLeft`, `getBoundingClientRect()`, `getComputedStyle()`
137
+
138
+ ### ตัวอย่างการ Refactor แก้ปัญหา:
139
+ ```javascript
140
+ // ❌ ผิด: อ่านและเขียนสลับกันในลูป ทำให้เกิด Reflow ซ้ำตามจำนวนการ์ด
141
+ cards.forEach(card => {
142
+ const currentHeight = card.offsetHeight; // BROWSER FORCED REFLOW!
143
+ card.style.height = `${currentHeight + 20}px`;
144
+ });
145
+
146
+ // ✅ ถูก: แยกเป็น Phase อ่านทั้งหมดก่อน แล้วค่อยเขียนพร้อมกัน (Batching)
147
+ const heights = cards.map(card => card.offsetHeight); // Single Read Phase
148
+ cards.forEach((card, index) => {
149
+ card.style.height = `${heights[index] + 20}px`; // Single Write Phase
150
+ });
151
+ ```
152
+
153
+ ---
154
+
155
+ ## 5. 🎯 Checklist ความสมูทก่อนส่งมอบงาน (Smoothness Quality Gate)
156
+ - [ ] แอนิเมชันและ Transition ทั้งหมดใช้เฉพาะ `transform` และ `opacity`
157
+ - [ ] ไม่มี CSS Transition บน `height: auto` แบบดั้งเดิม (ให้ใช้ `interpolate-size: allow-keywords;` หรือ Grid Fr trick)
158
+ - [ ] เพิ่ม `content-visibility: auto` และ `contain-intrinsic-size` บน Section ที่อยู่ใต้ Fold
159
+ - [ ] ติดตั้ง `scrollbar-gutter: stable;` ที่ `:root`
160
+ - [ ] Modal และ Drawer มี `overscroll-behavior: contain;`
161
+ - [ ] รัน Performance Trace บน DevTools พบค่า Long Tasks (>50ms) เป็น 0 ในช่วงการ Scroll
@@ -3,14 +3,21 @@
3
3
  1. **Zero AI-Slop Negative Prompts (ข้อห้ามเด็ดขาด):**
4
4
  - **No Gaudy Gradients:** ห้ามใช้ multi-stop rainbow/neon gradient ทับปุ่มหรือการ์ดมั่วซั่ว (อนุญาตเฉพาะ subtle atmospheric radial glow ≤ 10% opacity)
5
5
  - **No Emoji Spam in Headings:** ห้ามใส่ Emoji เรียงหน้าหัวข้อหลัก (`🚀 Features`, `✨ Overview`) ยกเว้นผู้ใช้ระบุหรือเป็น Icon Badge เฉพาะจุด
6
- - **No Heavy Drop Shadows:** ห้ามใช้ `shadow-md/lg/xl` ดำทึบเดี่ยวๆ → ต้องเป็น Frosted Glass (`backdrop-blur`) หรือ Stacked Inset Hairline Ring (`1px solid`) เสมอ
6
+ - **In-flow vs Floating Surface Rule (No Heavy Drop Shadows):** บัตร/พาเนลบนหน้าเว็บ (In-flow Surfaces) ใช้ขอบ Hairline 1px และ **"ห้ามใส่ Drop Shadow เด็ดขาด"** (เงาสงวนไว้ให้ Floating Popover/Dialog/Modal เท่านั้น) ใน Dark Mode ให้ยกระดับพื้นผิวด้วยความสว่าง Lighter Surface (+2-4% L) แทนเงาดำ
7
7
  - **No Colored Border Clutter:** ห้ามตีกรอบสีสด (`border-blue-500`, `border-purple-500`) รอบการ์ดทุกใบ ใช้ hairline border โปร่งแสง (`rgba(..., 0.08–0.15)`) เท่านั้น
8
8
  - **No Unnecessary Hover Bounces:** ห้ามทำการ์ดเด้งลอยสูง (`-translate-y-2`, `scale-105`) หรือ Parallax กวนสายตา → จำกัด motion ไม่เกิน `150ms–200ms` (`active:scale-[0.97]` เฉพาะปุ่มกด)
9
9
  - **Zero Cliche AI Palette:** ห้ามใช้โทนม่วง-ฟ้า AI มาตรฐาน (`bg-indigo-600` + `bg-purple-600`) หรือขาว-ส้มการตลาดทื่อๆ ที่ไม่ได้มาจาก Brand Token หรือ User DNA
10
- 2. **Typography Discipline:**
11
- - หัวข้อทุกตัวต้องบีบ `letter-spacing: -0.025em` ถึง `-0.035em`
10
+ 2. **Discrete Spacing & Control Geometry (สเกลปิดและเรขาคณิตควบคุม):**
11
+ - **Closed Spacing System:** ห้ามใช้ gap/margin นอกเหนือจาก `2, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128` (สเกลปิดเด็ดขาด $S \in \{2, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128\}\text{px}$) ห้ามใช้ arbitrary values เช่น 7px, 11px, 22px
12
+ - **Proximity Ratio ≥ 2:1:** ช่องว่างระหว่างกลุ่มต้องกว้างเป็นอย่างน้อย 2 เท่าของช่องว่างภายในกลุ่มเสมอ ($\text{Gap}_{\text{external}} \ge 2 \times \text{Gap}_{\text{internal}}$)
13
+ - **Control Heights Ladder:** ปุ่ม/อินพุตล็อกที่ `28 / 32 / 36 / 40px` (Desktop) และ `44 / 48px` (Mobile)
14
+ - **Nested Radius Invariant:** บังคับสูตร $r_{\text{outer}} = r_{\text{inner}} + \text{padding}$ ป้องกันมุมโค้งลอย
15
+ 3. **Typography Discipline:**
16
+ - **Latin-First Rule:** Font Stack ต้องวาง Latin นำหน้า Font ไทยเสมอ (เช่น `Inter, IBM Plex Sans Thai...`)
17
+ - **Thai Calibration:** บังคับ `letter-spacing: 0` สำหรับภาษาไทย (ห้ามใส่ Negative Tracking เพราะวรรณยุกต์จะชนกัน), Line-height สำหรับภาษาไทยต้องอยู่ที่ `1.7–1.8` (Body) และ `≥ 1.3` (Headings)
18
+ - หัวข้อภาษาอังกฤษบีบ `letter-spacing: -0.025em` ถึง `-0.035em`
12
19
  - ตัวเลข พิกัด สถิติ เวลา และรหัสสถานะ ต้องใช้ `font-mono tabular-nums` (`Geist Mono` / `JetBrains Mono`) เสมอ
13
- 3. **Min-UI Principle (สำหรับ Tool / Engineering / SaaS Workspace เช่น MESURV, Mesnooker):**
20
+ 4. **Min-UI Principle (สำหรับ Tool / Engineering / SaaS Workspace เช่น MESURV, Mesnooker):**
14
21
  - **Controls Near Content:** วางปุ่มควบคุมและตัวกรองไว้ติดกับข้อมูลที่ถูกกระทำ ไม่แยกห่างเกินจำเป็น
15
22
  - **Verbs Over Nouns:** ปุ่ม Action ใช้คำกริยาที่ชัดเจน (`Calculate Traverse`, `Export GeoJSON`, `Start Frame`) แทนคำนามลอยๆ
16
23
  - **Zero Marketing Fluff:** ในหน้าทำงานจริง (Workspace/Calculator/Map) ตัดคำโฆษณาเวิ่นเว้อออก เน้นความคมชัดของข้อมูล (High Signal-to-Noise)
@@ -0,0 +1,234 @@
1
+ # Executive PDF Reports & Strategic Document Architecture
2
+
3
+ คู่มือมาตรฐานสถาปัตยกรรมเอกสารและรายงานบริหาร (Executive PDF Reports) สำหรับ `/medesign` ออกแบบมาเพื่อรายงานระดับ C-Suite, บอร์ดบริหาร, และงานวิศวกรรมยุทธศาสตร์ที่ต้องการความน่าเชื่อถือระดับสูงสุด ยึดหลัก 5-Second Scan, ไร้สิ่งรบกวนทางสายตา (Zero Slop), และความสมบูรณ์แบบในการพิมพ์ (Print-Ready)
4
+
5
+ ---
6
+
7
+ ## 1. 📐 12-Column Grid Snapping บน 4pt Baseline
8
+
9
+ ### 1.1 Vertical Rhythm: 4pt Baseline Grid
10
+ ทุกองค์ประกอบทางสายตา (Visual Elements) ต้องมีขนาด, ความสูงบรรทัด (Line-Height), Padding, และ Margin ที่ลงตัวกับทวีคูณของ **4pt / 4px**:
11
+ - **Baseline Steps:** `4pt, 8pt, 12pt, 16pt, 20pt, 24pt, 28pt, 32pt, 40pt, 48pt`
12
+ - **Text Alignment:** Baseline ของข้อความในคอลัมน์คู่ขนานต้องวางทาบตรงกันเป๊ะตามแนวขวาง (Snapping to Baseline)
13
+ - **Line-Height Multiples:**
14
+ - หัวข้อหลัก (Title): `28pt` หรือ `32pt`
15
+ - หัวข้อย่อย (Subtitle): `20pt` หรือ `24pt`
16
+ - ข้อความเนื้อหา (Body): `16pt` (บน Font Size `9.5pt` หรือ `10pt`)
17
+
18
+ ### 1.2 12-Column Layout Geometry (A4 Landscape & Portrait)
19
+ - **A4 Landscape Dimensions:** $297\text{mm} \times 210\text{mm}$ ($841.89\text{pt} \times 595.28\text{pt}$)
20
+ - **Margins:** ซ้าย/ขวา `32pt`, บน/ล่าง `28pt`
21
+ - **Columns & Gutters:** 12 คอลัมน์เท่ากัน พร้อม Gutter ขนาดคงที่ `16pt`
22
+
23
+ ```css
24
+ :root {
25
+ --page-width: 297mm;
26
+ --page-height: 210mm;
27
+ --baseline-unit: 4pt;
28
+
29
+ --margin-x: 32pt;
30
+ --margin-y: 28pt;
31
+ --column-gutter: 16pt;
32
+ --grid-columns: 12;
33
+ }
34
+
35
+ .report-grid-12 {
36
+ display: grid;
37
+ grid-template-columns: repeat(12, 1fr);
38
+ column-gap: var(--column-gutter);
39
+ row-gap: calc(var(--baseline-unit) * 4); /* 16pt */
40
+ }
41
+ ```
42
+
43
+ ---
44
+
45
+ ## 2. 🏛️ The 8 + 4 Consulting Split (McKinsey / BCG / Bain Standard)
46
+
47
+ ในการนำเสนอข้อมูลเชิงบริหาร ห้ามกระจายเนื้อหาเต็ม 12 คอลัมน์แบบหน้ากระดาษธรรมดา ให้ใช้โครงสร้าง **8 + 4 Consulting Split**:
48
+
49
+ ```
50
+ ┌────────────────────────────────────────────────────────┬───────────────────────────┐
51
+ │ 8 COLUMNS: MAIN STAGE & ANALYTICAL NARRATIVE │ 4 COLUMNS: MARGIN RAIL │
52
+ │ • Action Title & Executive Summary │ • Executive Key Takeaways │
53
+ │ • Core Quantitative Chart / Map Telemetry │ • Data Provenance & Date │
54
+ │ • Comparative Synthesis Table │ • Methodology Footnotes │
55
+ │ • Analytical Deep Dive Paragraphs │ • Next Strategic Action │
56
+ └────────────────────────────────────────────────────────┴───────────────────────────┘
57
+ ```
58
+
59
+ ### 2.1 หน้าที่ของ 8 คอลัมน์หลัก (Main Stage)
60
+ - ครองพื้นที่ $66.7\%$ ของหน้ากระดาษ
61
+ - บรรจุ **Hero Visual** (ชาร์ตข้อมูลขนาดใหญ่, แผนที่รังวัด/GIS, หรือตารางเปรียบเทียบ)
62
+ - บรรจุเนื้อหาบทวิเคราะห์ที่ขับเคลื่อนด้วยหลักฐานเชิงประจักษ์ (Evidence-backed prose)
63
+
64
+ ### 2.2 หน้าที่ของ 4 คอลัมน์ขวา (Margin Rail)
65
+ - ครองพื้นที่ $33.3\%$ ของหน้ากระดาษ
66
+ - **Executive Callout Box:** กล่องสรุปข้อค้นพบสำคัญ (Key Takeaway) พร้อมตัวเลขไฮไลต์
67
+ - **Data Provenance & Sources:** ที่มาของชุดข้อมูล, วันที่เก็บข้อมูลภาคสนาม, ค่าพิกัด, และสมมติฐานทางสถิติ
68
+ - **Methodology & Footnotes:** อธิบายสูตรคำนวณหรือข้อจำกัดทางวิศวกรรม
69
+
70
+ ```css
71
+ .consulting-stage {
72
+ grid-column: span 8;
73
+ }
74
+ .consulting-rail {
75
+ grid-column: span 4;
76
+ border-left: 0.5pt solid var(--border-subtle, #e5e7eb);
77
+ padding-left: var(--column-gutter);
78
+ }
79
+ ```
80
+
81
+ ---
82
+
83
+ ## 3. ⚡ The L1 / L2 / L3 5-Second Scan Framework
84
+
85
+ ผู้บริหารระดับสูงมีเวลาสแกนเอกสารแต่ละหน้าเพียง **5 วินาที** ก่อนตัดสินใจ โครงสร้างเอกสารต้องส่งสารได้ครบทั้ง 3 ระดับทันที:
86
+
87
+ ### 3.1 L1: Action Title (สแกน 1 วินาทีแรก)
88
+ - **กฎเหล็ก:** **หัวข้อทุกตัวต้องเป็น "ประโยคสรุปผลเต็มประโยค" (Action Title)** ที่บอกข้อสรุปหรือ Insight ทันที
89
+ - ❌ **ห้ามใช้หัวข้อบอกหัวเรื่องทั่วไป:**
90
+ - ❌ *"ผลการดำเนินงานไตรมาส 3"*
91
+ - ❌ *"การวิเคราะห์ความคลาดเคลื่อนทางรังวัด"*
92
+ - ❌ *"Revenue Breakdown"*
93
+ - ✅ **ต้องใช้ Action Title ที่ได้ข้อสรุป:**
94
+ - ✅ *"รายได้ Q3 เติบโต 24% จากการขยายฐานลูกค้าระดับ Enterprise ในกลุ่มพลังงาน"*
95
+ - ✅ *"ความคลาดเคลื่อนแนวราบเฉลี่ย 1.8 ซม. อยู่ในเกณฑ์มาตรฐานชั้น 1 ของกรมที่ดิน"*
96
+ - ✅ *"ต้นทุนด้านคลาวด์ลดลง 38% หลังย้ายเวิร์กโหลดสู่ On-Premise GPU Cluster"*
97
+
98
+ ### 3.2 L2: Directly Labeled Visuals (สแกน 2 วินาทีถัดมา)
99
+ - **กฎเหล็กตัดกล่อง Legend ทิ้ง:** **ห้ามใส่กล่อง Legend แยกต่างหากเด็ดขาด** (`legend: { display: false }`)
100
+ - **Direct Labeling:** ให้พิมพ์ชื่อชุดข้อมูลและตัวเลขสรุปผลกำกับไว้ที่ **ปลายเส้นกราฟ (Line endpoint)** หรือ **บนแท่งกราฟ (Bar header)** โดยตรงด้วยสีเดียวกับข้อมูลนั้น
101
+ - **เหตุผลทางประสาทวิทยาการรับรู้:** การมีกล่อง Legend บังคับให้สมองผู้บริหารต้องกวาดสายตาสลับไปมาระหว่างเส้นกราฟกับกล่องสัญลักษณ์ถึง 6–8 ครั้ง เกิด Cognitive Friction ที่ไม่จำเป็น
102
+
103
+ ### 3.3 L3: Quantitative Detail & Provenance (สแกน 2 วินาทีสุดท้าย)
104
+ - ตัวเลขสถิติเจาะลึก, ค่าเบี่ยงเบนมาตรฐาน ($\pm \sigma$), ขนาดกลุ่มตัวอย่าง ($n$), และข้อมูลผู้ตรวจรับงาน
105
+ - จัดวางอย่างประณีตใน 4 คอลัมน์ขวาหรือ Footnote ท้ายหน้า
106
+
107
+ ---
108
+
109
+ ## 4. 📊 Executive Table Discipline (วินัยแห่งตารางข้อมูลบริหาร)
110
+
111
+ ตารางข้อมูลในรายงานบริหารต้องมีความสง่างามระดับสูงสุดตามมาตรฐานวารสารวิทยาศาสตร์และการเงินระดับโลก (The Economist / Nature Standard):
112
+
113
+ ```
114
+ ┌────────────────────────────────────────────────────────────────────────┐
115
+ │ Metric / Asset Name Sample Size Mean (m) Status │ ← Hairline 0.5pt (Top/Bottom)
116
+ ├────────────────────────────────────────────────────────────────────────┤
117
+ │ BM-KU-01 (Station Bench) 1,240 14.285 PASS │
118
+ │ BM-KU-02 (Survey Boundary) 850 8.104 PASS │ ← Hairline 0.25pt horizontal only
119
+ │ BM-KU-03 (Cadastral Pin) 2,100 22.950 PASS │
120
+ ├────────────────────────────────────────────────────────────────────────┤
121
+ │ Total Aggregate / Tolerance 4,190 15.113 PASS │ ← Hairline 0.5pt
122
+ └────────────────────────────────────────────────────────────────────────┘
123
+ (ไม่มีเส้นแนวตั้งแม้แต่เส้นเดียว / ตัวเลขชิดขวา tabular-nums ทุกช่อง)
124
+ ```
125
+
126
+ ### 4.1 กฎเหล็ก 4 ประการของ Executive Table
127
+ 1. **Horizontal Hairlines 0.25pt:**
128
+ - เส้นคั่นแนวนอนใต้ Header และระหว่างแถวต้องใช้เส้นบางพิเศษ `0.25pt` (หรือ `0.5px` ใน CSS)
129
+ - เส้นตีกรอบบนและล่างสุดของตารางใช้ขนาด `0.5pt`
130
+ 2. **Zero Vertical Gridlines (ตัดเส้นแนวตั้งทิ้ง 100%):**
131
+ - **ห้ามมีเส้นคั่นแนวตั้งเด็ดขาด** (`border-left: 0; border-right: 0;`)
132
+ - ความเป็นระเบียบของคอลัมน์เกิดจาก Alignment ทางสายตาและ Gutter ที่แม่นยำ ไม่ใช่เส้นกรงขัง
133
+ 3. **Right-Aligned Numerical Discipline:**
134
+ - คอลัมน์ตัวเลข, พิกัด, ยอดเงิน, สถิติ, และเปอร์เซ็นต์ ต้อง **ชิดขวาเสมอ** (`text-align: right;`)
135
+ - บังคับเปิดใช้ `font-variant-numeric: tabular-nums lining-nums;` เพื่อให้หลักหน่วย สิบ ร้อย พัน ตรงกันเป็นแนวดิ่งเป๊ะ
136
+ - คอลัมน์ข้อความชิดซ้าย (`text-align: left;`), คอลัมน์สถานะ/Badge อยู่กึ่งกลาง (`text-align: center;`)
137
+ 4. **Zebra Striping Limitation:**
138
+ - **ห้ามใช้ Zebra Striping กับตารางทั่วไป** ให้ใช้พื้นหลังขาวสะอาด
139
+ - อนุญาตให้ใช้ Zebra Striping อ่อนมาก (`rgba(0,0,0,0.02)`) เฉพาะในตารางกว้างที่มี **$\ge 8$ คอลัมน์** เท่านั้น
140
+ - **Print Reset:** เมื่อพิมพ์หรือส่งออกเป็น PDF ต้องตัด Zebra Striping ทิ้งทั้งหมด:
141
+ ```css
142
+ @media print {
143
+ table.wide-table tr:nth-child(even) {
144
+ background-color: transparent !important;
145
+ }
146
+ }
147
+ ```
148
+
149
+ ---
150
+
151
+ ## 5. 🖨️ Print & PDF Export CSS Engine (Paged Media Standard)
152
+
153
+ ชุดคำสั่ง CSS มาตรฐานเพื่อให้เอกสารเรนเดอร์และพิมพ์ออกเป็น PDF ได้สมบูรณ์แบบโดยไม่มีหน้าฉีกหรือ Layout เพี้ยน:
154
+
155
+ ```css
156
+ @page {
157
+ size: A4 landscape;
158
+ margin: 20mm 15mm 15mm 15mm;
159
+
160
+ @top-left {
161
+ content: "EXECUTIVE BRIEFING | DIVISION OF SURVEY ENGINEERING";
162
+ font-family: "Geist", "Noto Sans Thai", sans-serif;
163
+ font-size: 7pt;
164
+ letter-spacing: 0.05em;
165
+ color: #6b7280;
166
+ }
167
+
168
+ @top-right {
169
+ content: "STRICTLY CONFIDENTIAL";
170
+ font-family: "Geist Mono", monospace;
171
+ font-size: 7pt;
172
+ color: #9ca3af;
173
+ }
174
+
175
+ @bottom-left {
176
+ content: "Project: Metha Cadastre & Geodetic QA/QC";
177
+ font-family: "Geist", "Noto Sans Thai", sans-serif;
178
+ font-size: 7pt;
179
+ color: #9ca3af;
180
+ }
181
+
182
+ @bottom-right {
183
+ content: "Page " counter(page) " of " counter(pages);
184
+ font-family: "Geist Mono", monospace;
185
+ font-size: 7pt;
186
+ color: #6b7280;
187
+ }
188
+ }
189
+
190
+ @media print {
191
+ body {
192
+ -webkit-print-color-adjust: exact !important;
193
+ print-color-adjust: exact !important;
194
+ background: #ffffff !important;
195
+ color: #111827 !important;
196
+ font-size: 9.5pt;
197
+ line-height: 1.6;
198
+ }
199
+
200
+ /* ป้องกันการตัดขาดครึ่งชิ้นระหว่างหน้า */
201
+ .report-card,
202
+ .chart-container,
203
+ .executive-table,
204
+ .metric-kpi-block {
205
+ break-inside: avoid !important;
206
+ page-break-inside: avoid !important;
207
+ }
208
+
209
+ /* บังคับตัดขึ้นหน้าใหม่สำหรับหมวดหมู่ใหญ่ */
210
+ .page-break-before {
211
+ break-before: page !important;
212
+ page-break-before: always !important;
213
+ }
214
+
215
+ /* ซ่อนชิ้นส่วนนำทางหน้าจอที่ไม่จำเป็น */
216
+ .no-print,
217
+ .screen-toolbar,
218
+ nav,
219
+ button:not(.print-keep) {
220
+ display: none !important;
221
+ }
222
+ }
223
+ ```
224
+
225
+ ---
226
+
227
+ ## 6. ✅ Executive Pre-Ship Quality Checklist
228
+
229
+ - [ ] **12-Col / 4pt Baseline:** ทุกกล่องข้อความและชาร์ตยึด 12 คอลัมน์ และระยะดิ่งลงตัวกับ 4pt Baseline
230
+ - [ ] **8 + 4 Consulting Split:** แบ่งแยกชัดเจนระหว่างเนื้อหาหลัก 8 คอลัมน์ และรางข้อมูล/แหล่งที่มา 4 คอลัมน์
231
+ - [ ] **Action Titles (L1):** ทุกหน้าและทุกชาร์ตมีหัวข้อเป็นประโยคสรุปผลเต็มประโยค (ไม่มีหัวข้อลอยๆ)
232
+ - [ ] **Direct Labeling (L2):** ตัดกล่อง Legend ทิ้งทั้งหมด ข้อมูลกำกับไว้ที่เส้น/แท่งกราฟโดยตรง
233
+ - [ ] **Table Cleanliness:** เส้นคั่นแนวนอน `0.25pt`, เส้นแนวตั้งเป็นศูนย์, ตัวเลขชิดขวา `tabular-nums`
234
+ - [ ] **Print Integrity:** ทดสอบ Print Preview หน้าไม่แตก, `break-inside: avoid` ทำงาน, สีไม่เพี้ยน
@@ -1,53 +1,53 @@
1
- # Premium Web & Mobile UI Image Art Direction
2
-
3
- มาตรฐานการออกแบบคำสั่งสร้างภาพต้นแบบ (UI Mockup Direction) สำหรับหน้าเว็บและแอปมือถือ เพื่อสร้างภาพอ้างอิงระดับเวิลด์คลาสก่อนลงมือเขียนโค้ดจริง
4
-
5
- ---
6
-
7
- ## 1. กฎเหล็กการสร้างภาพ (Hard Output Rules)
8
-
9
- 1. **One Separate Image Per Section (หน้าเว็บ):**
10
- - สร้างภาพแนวนอน (Aspect Ratio `16:9` หรือ `3:2`) แยก 1 ภาพต่อ 1 Section เสมอ
11
- - ห้ามรวบทั้งหน้าเว็บ Landing Page ลงในภาพแนวยาวเพียงภาพเดียวเด็ดขาด เพราะจะทำให้ฟอนต์เล็ก ละเอียด และไม่สามารถแกะโค้ดต่อได้
12
- 2. **One Focused Screen / Flow Per Generation (แอปมือถือ):**
13
- - สร้างภาพแนวตั้ง (Aspect Ratio `9:16` หรือ `3:4`) เน้นหน้าจอเดี่ยวที่คมชัด หรือ Side-by-side Flow ไม่เกิน 2-3 จอ
14
- - จำลอง Safe Area ของ iOS/Android (Status Bar, Home Indicator, Dynamic Island) ให้สมจริง
15
-
16
- ---
17
-
18
- ## 2. ทลายความจำเจของ Hero Section (Break Hero Clichés)
19
-
20
- หลีกเลี่ยงการใช้เลย์เอาต์ซ้ำซาก **"ข้อความซ้าย / ภาพขวา"** เป็นค่าเริ่มต้น ให้เลือกใช้ทางเลือกต่อไปนี้:
21
- - **Centered over Ambient Depth:** ข้อความกึ่งกลางบนพื้นหลังกราฟิก 3D หรือภาพ Abstract Depth
22
- - **Bottom-Left Over Canvas:** ข้อความวางชิดซ้ายล่าง พาดทับฉากหลังขนาดใหญ่แบบภาพยนตร์
23
- - **Editorial Asymmetry:** ข้อความตัวใหญ่แบบนิตยสาร พร้อมคอลัมน์รูปภาพขนาดเล็กตัดกัน
24
- - **Stacked Split Canvas:** สื่อ/เดโมอยู่กึ่งกลางเต็มจอ พร้อม Floating Badge แสดงฟังก์ชันหลัก
25
-
26
- ---
27
-
28
- ## 3. มาตรฐานการกำหนดคำสั่ง (Prompt Blueprint)
29
-
30
- ### ก. โครงสร้างพรอมต์หน้าเว็บ (Web Section Prompt):
31
- ```text
32
- UI concept comp for a [industry/purpose] website, [specific section name] section.
33
- Layout: [e.g. Asymmetric bento grid / Full-width hero with bottom typography].
34
- Style & Aesthetics: Premium dark-mode void background (#09090b), crisp 1px borders with subtle glow, refined typography with Serif display headline and sans-serif body, restrained indigo accent (#6366f1).
35
- Visual Content: High-fidelity dashboard widgets, clean interactive toggles, real data visualizations, generous whitespace, sharp contrast, zero blur on text elements.
36
- Presentation: Direct screen capture, clean 16:9 desktop viewport, professional Dribbble/Awwwards award-winning aesthetic, flat straight-on view, no device mockup frame.
37
- ```
38
-
39
- ### ข. โครงสร้างพรอมต์แอปมือถือ (Mobile App Screen Prompt):
40
- ```text
41
- Mobile app UI design for iOS [purpose/domain, e.g. Fintech wealth tracker], single screen [e.g. Home Dashboard].
42
- Aesthetics: Warm dark surface (#111115), frosted glass navigation bar, refined tabular figures with Geist Mono font, subtle accent voltage (#f59e0b).
43
- Components: Top status bar with Dynamic Island, total balance hero card, segmented asset allocation chart, quick action pill buttons, recent transactions feed.
44
- Presentation: Ultra-clean 9:16 mobile screen view, pixel-perfect native iOS guidelines, crisp typography hierarchy, believable metric values, no external phone frame.
45
- ```
46
-
47
- ---
48
-
49
- ## 4. สิ่งที่ต้องกำจัดในภาพต้นแบบ (Anti-Generic Tells)
50
- - ห้ามใช้คำศัพท์ Interface ปลอมหรือข้อความ Lorem Ipsum ที่มั่วซั่ว
51
- - ห้ามใส่แสงนีออนฟุ้งกระจายจนอ่านข้อความไม่ออก
52
- - ห้ามสร้างการ์ดซ้อนการ์ดเกิน 3 ชั้น
53
- - รักษาคู่สีให้คุมโทน สอดคล้องกับ [user-profile.json](file:///D:/WSL/.gemini/config/skills/medesign/user-profile.json) ของผู้ใช้
1
+ # Premium Web & Mobile UI Image Art Direction
2
+
3
+ มาตรฐานการออกแบบคำสั่งสร้างภาพต้นแบบ (UI Mockup Direction) สำหรับหน้าเว็บและแอปมือถือ เพื่อสร้างภาพอ้างอิงระดับเวิลด์คลาสก่อนลงมือเขียนโค้ดจริง
4
+
5
+ ---
6
+
7
+ ## 1. กฎเหล็กการสร้างภาพ (Hard Output Rules)
8
+
9
+ 1. **One Separate Image Per Section (หน้าเว็บ):**
10
+ - สร้างภาพแนวนอน (Aspect Ratio `16:9` หรือ `3:2`) แยก 1 ภาพต่อ 1 Section เสมอ
11
+ - ห้ามรวบทั้งหน้าเว็บ Landing Page ลงในภาพแนวยาวเพียงภาพเดียวเด็ดขาด เพราะจะทำให้ฟอนต์เล็ก ละเอียด และไม่สามารถแกะโค้ดต่อได้
12
+ 2. **One Focused Screen / Flow Per Generation (แอปมือถือ):**
13
+ - สร้างภาพแนวตั้ง (Aspect Ratio `9:16` หรือ `3:4`) เน้นหน้าจอเดี่ยวที่คมชัด หรือ Side-by-side Flow ไม่เกิน 2-3 จอ
14
+ - จำลอง Safe Area ของ iOS/Android (Status Bar, Home Indicator, Dynamic Island) ให้สมจริง
15
+
16
+ ---
17
+
18
+ ## 2. ทลายความจำเจของ Hero Section (Break Hero Clichés)
19
+
20
+ หลีกเลี่ยงการใช้เลย์เอาต์ซ้ำซาก **"ข้อความซ้าย / ภาพขวา"** เป็นค่าเริ่มต้น ให้เลือกใช้ทางเลือกต่อไปนี้:
21
+ - **Centered over Ambient Depth:** ข้อความกึ่งกลางบนพื้นหลังกราฟิก 3D หรือภาพ Abstract Depth
22
+ - **Bottom-Left Over Canvas:** ข้อความวางชิดซ้ายล่าง พาดทับฉากหลังขนาดใหญ่แบบภาพยนตร์
23
+ - **Editorial Asymmetry:** ข้อความตัวใหญ่แบบนิตยสาร พร้อมคอลัมน์รูปภาพขนาดเล็กตัดกัน
24
+ - **Stacked Split Canvas:** สื่อ/เดโมอยู่กึ่งกลางเต็มจอ พร้อม Floating Badge แสดงฟังก์ชันหลัก
25
+
26
+ ---
27
+
28
+ ## 3. มาตรฐานการกำหนดคำสั่ง (Prompt Blueprint)
29
+
30
+ ### ก. โครงสร้างพรอมต์หน้าเว็บ (Web Section Prompt):
31
+ ```text
32
+ UI concept comp for a [industry/purpose] website, [specific section name] section.
33
+ Layout: [e.g. Asymmetric bento grid / Full-width hero with bottom typography].
34
+ Style & Aesthetics: Premium dark-mode void background (#09090b), crisp 1px borders with subtle glow, refined typography with Serif display headline and sans-serif body, restrained indigo accent (#6366f1).
35
+ Visual Content: High-fidelity dashboard widgets, clean interactive toggles, real data visualizations, generous whitespace, sharp contrast, zero blur on text elements.
36
+ Presentation: Direct screen capture, clean 16:9 desktop viewport, professional Dribbble/Awwwards award-winning aesthetic, flat straight-on view, no device mockup frame.
37
+ ```
38
+
39
+ ### ข. โครงสร้างพรอมต์แอปมือถือ (Mobile App Screen Prompt):
40
+ ```text
41
+ Mobile app UI design for iOS [purpose/domain, e.g. Fintech wealth tracker], single screen [e.g. Home Dashboard].
42
+ Aesthetics: Warm dark surface (#111115), frosted glass navigation bar, refined tabular figures with Geist Mono font, subtle accent voltage (#f59e0b).
43
+ Components: Top status bar with Dynamic Island, total balance hero card, segmented asset allocation chart, quick action pill buttons, recent transactions feed.
44
+ Presentation: Ultra-clean 9:16 mobile screen view, pixel-perfect native iOS guidelines, crisp typography hierarchy, believable metric values, no external phone frame.
45
+ ```
46
+
47
+ ---
48
+
49
+ ## 4. สิ่งที่ต้องกำจัดในภาพต้นแบบ (Anti-Generic Tells)
50
+ - ห้ามใช้คำศัพท์ Interface ปลอมหรือข้อความ Lorem Ipsum ที่มั่วซั่ว
51
+ - ห้ามใส่แสงนีออนฟุ้งกระจายจนอ่านข้อความไม่ออก
52
+ - ห้ามสร้างการ์ดซ้อนการ์ดเกิน 3 ชั้น
53
+ - รักษาคู่สีให้คุมโทน สอดคล้องกับ [user-profile.json](../user-profile.json) ของผู้ใช้