medesign 1.6.0 → 1.7.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.
- package/README.md +152 -86
- package/SKILL.md +169 -0
- package/bin/medesign.js +130 -27
- package/data/cip/deliverables.csv +51 -0
- package/data/cip/industries.csv +21 -0
- package/data/cip/mockup-contexts.csv +21 -0
- package/data/cip/styles.csv +21 -0
- package/data/icon/styles.csv +16 -0
- package/data/logo/colors.csv +56 -0
- package/data/logo/industries.csv +56 -0
- package/data/logo/styles.csv +56 -0
- package/docs/architecture/v1.7-proposal.md +279 -0
- package/docs/audit/COMPETITIVE-BENCHMARK.md +101 -0
- package/docs/audit/INITIAL-SOURCE-AUDIT.md +89 -0
- package/docs/benchmark/BENCHMARK-SUITE.md +97 -0
- package/docs/roadmap/FRONTEND-DESIGN-SKILL-ROADMAP.md +277 -0
- package/examples/snapshots/cadastral-qaqc-slide-desktop-1440x900.png +0 -0
- package/examples/snapshots/cadastral-qaqc-slide-mobile-390x844.png +0 -0
- package/examples/snapshots/cadastral-qaqc-slide-tablet-820x1180.png +0 -0
- package/package.json +85 -81
- package/presets/metha/design-tokens.css +12 -12
- package/references/design-routing.md +96 -207
- package/references/quality-gate.md +1 -1
- package/references/slides-copywriting-formulas.md +5 -8
- package/references/slides-layout-patterns.md +8 -23
- package/references/slides-strategies.md +0 -10
- package/tests/browser-audit.js +24 -6
- package/tests/linter.js +131 -13
- package/tests/snapshot.js +5 -2
- package/tests/visual-testbed.html +682 -681
|
@@ -1,207 +1,96 @@
|
|
|
1
|
-
# Design Routing Guide
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
|
15
|
-
|
|
16
|
-
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
| "How do I build a button component?" | ui-styling |
|
|
98
|
-
| "Is this on-brand?" | brand |
|
|
99
|
-
| "Should I use a CSS variable here?" | design-system |
|
|
100
|
-
| "How do I add dark mode?" | ui-styling |
|
|
101
|
-
| "Create a logo for my brand" | logo-design |
|
|
102
|
-
| "Generate business card mockups" | cip-design |
|
|
103
|
-
| "Create a pitch deck" | slides |
|
|
104
|
-
| "Design brand identity package" | cip-design |
|
|
105
|
-
| "What logo style fits my industry?" | logo-design |
|
|
106
|
-
| "Design a Facebook cover" | design (built-in banner) |
|
|
107
|
-
| "Create ad banners for Google" | design (built-in banner) |
|
|
108
|
-
| "Make a website hero banner" | design (built-in banner) |
|
|
109
|
-
| "Generate a settings icon" | icon-design |
|
|
110
|
-
| "Create SVG icons for my app" | icon-design |
|
|
111
|
-
| "Design an icon set" | icon-design |
|
|
112
|
-
|
|
113
|
-
## Multi-Skill Workflows
|
|
114
|
-
|
|
115
|
-
### New Project Setup
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
1. brand → Define identity
|
|
119
|
-
- Colors, typography, voice
|
|
120
|
-
|
|
121
|
-
2. design-system → Create tokens
|
|
122
|
-
- Primitive, semantic, component
|
|
123
|
-
|
|
124
|
-
3. ui-styling → Implement
|
|
125
|
-
- Configure Tailwind, add components
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### Design System Migration
|
|
129
|
-
|
|
130
|
-
```
|
|
131
|
-
1. brand → Audit existing
|
|
132
|
-
- Extract brand colors, fonts
|
|
133
|
-
|
|
134
|
-
2. design-system → Formalize tokens
|
|
135
|
-
- Create three-layer architecture
|
|
136
|
-
|
|
137
|
-
3. ui-styling → Update code
|
|
138
|
-
- Replace hardcoded values
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### Component Creation
|
|
142
|
-
|
|
143
|
-
```
|
|
144
|
-
1. design-system → Reference specs
|
|
145
|
-
- Button states, sizes, variants
|
|
146
|
-
|
|
147
|
-
2. ui-styling → Implement
|
|
148
|
-
- Build with shadcn/ui + Tailwind
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
## Skill Dependencies
|
|
152
|
-
|
|
153
|
-
```
|
|
154
|
-
brand
|
|
155
|
-
↓ (colors, typography)
|
|
156
|
-
design-system
|
|
157
|
-
↓ (tokens, specs)
|
|
158
|
-
ui-styling
|
|
159
|
-
↓ (components)
|
|
160
|
-
Application Code
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
## Quick Commands
|
|
164
|
-
|
|
165
|
-
**Brand:**
|
|
166
|
-
```bash
|
|
167
|
-
node ../brand/scripts/inject-brand-context.cjs
|
|
168
|
-
node ../brand/scripts/validate-asset.cjs <path>
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
**Tokens:**
|
|
172
|
-
```bash
|
|
173
|
-
node ../design-system/scripts/generate-tokens.cjs -c tokens.json
|
|
174
|
-
node ../design-system/scripts/validate-tokens.cjs -d src/
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
**Components:**
|
|
178
|
-
```bash
|
|
179
|
-
npx shadcn@latest add button card input
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
## When to Use Multiple Skills
|
|
183
|
-
|
|
184
|
-
Use **all eight** when:
|
|
185
|
-
- Complete brand package from scratch (logo → CIP → presentation)
|
|
186
|
-
|
|
187
|
-
Use **brand + design-system + ui-styling** when:
|
|
188
|
-
- Design system setup and implementation
|
|
189
|
-
|
|
190
|
-
Use **logo-design + cip-design** when:
|
|
191
|
-
- Complete brand identity package with deliverable mockups
|
|
192
|
-
|
|
193
|
-
Use **logo-design + cip-design + slides** when:
|
|
194
|
-
- Brand pitch: generate logo, create CIP mockups, build pitch deck
|
|
195
|
-
|
|
196
|
-
Use **design (banner) + brand** when:
|
|
197
|
-
- Social media presence: branded banners across all platforms
|
|
198
|
-
|
|
199
|
-
Use **icon-design + design-system** when:
|
|
200
|
-
- Custom icon set matching design tokens and component specs
|
|
201
|
-
|
|
202
|
-
Use **brand + design-system** when:
|
|
203
|
-
- Defining design language without implementation
|
|
204
|
-
|
|
205
|
-
Use **design-system + ui-styling** when:
|
|
206
|
-
- Implementing existing brand in code
|
|
207
|
-
- Building component library
|
|
1
|
+
# ME-DESIGN — Knowledge & Design Intelligence Routing Guide
|
|
2
|
+
|
|
3
|
+
This document classifies all references within ME-DESIGN, mapping product contexts, intents, and user domains to relevant architectural modules.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Reference Classification (Four-Tier Architecture)
|
|
8
|
+
|
|
9
|
+
To minimize context pollution and prevent unnecessary loading, all 60+ repository references are organized into four distinct tiers:
|
|
10
|
+
|
|
11
|
+
### Tier 1: Core Engineering Knowledge (Load on Frontend Design Workflows)
|
|
12
|
+
These references establish the non-negotiable foundations of web accessibility, layout, typography, and delivery verification:
|
|
13
|
+
|
|
14
|
+
| Reference | Domain & Purpose | Trigger Condition |
|
|
15
|
+
|---|---|---|
|
|
16
|
+
| `references/design-core.md` | Layout principles, 8-pt grid, closed spacing tokens, visual hierarchy | Spatial layout, spacing, containers |
|
|
17
|
+
| `references/typography-thai-latin.md` | Bilingual Thai-Latin font pairing, vertical metrics, line-height >= 1.7 | Typography, font stacks, Thai diacritic clipping |
|
|
18
|
+
| `references/modern-craft-invariants.md` | WCAG 2.2 standards, touch target contracts (44px), high contrast outline | Accessibility, interactive states, contracts |
|
|
19
|
+
| `references/quality-gate.md` | Deterministic verification: Squint Test, Grayscale, 10-State Matrix | Delivery review, code completion |
|
|
20
|
+
| `references/brief-intake.md` | Mode detection (`new` / `revamp` / `like`), ambiguity resolution | Initial brief intake (deep path) |
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
### Tier 2: Specialized Design Intelligence (Load JIT Based on Domain/Task)
|
|
25
|
+
Load only the reference matching the specific product domain or technical task:
|
|
26
|
+
|
|
27
|
+
| Reference | Domain & Purpose | Recommended Stack / Context |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| `references/argon-design-archetypes.md` | 38 Curated Domain Archetypes (SaaS, GIS, Cadastre, Telemetry, FinTech) | Creating distinct, non-generic interfaces |
|
|
30
|
+
| `references/brand-design-tokens.md` | 74 Global Brand System Profiles & OKLCH token mappings | Brand inspiration or theme adaptation |
|
|
31
|
+
| `references/motion-tokens.md` | 120fps spring physics curves, duration scales, micro-interactions | Animation, transition, hover/active physics |
|
|
32
|
+
| `references/compositor-smoothness.md` | Hardware-accelerated CSS properties (`transform`, `opacity`) | High-framerate interaction, scroll performance |
|
|
33
|
+
| `references/components.md` | Accessible component blueprints (dialog, combobox, tooltip, table) | Component implementation, complex controls |
|
|
34
|
+
| `references/ui-styling-shadcn.md` | Tailwind CSS + shadcn/ui integration conventions | React / Next.js / Tailwind stack |
|
|
35
|
+
| `references/web-retrofit-protocol.md` | Safe legacy web modernization (Tier 1-3 progressive patches) | Refactoring existing webbases without breakage |
|
|
36
|
+
| `references/style-extraction.md` | Methodical CSS / token reverse-engineering from live sites | `/medesign extract <url>` or theme cloning |
|
|
37
|
+
| `references/image-to-code.md` | Figma / screenshot to production code mapping protocol | Converting visual designs to code |
|
|
38
|
+
| `references/ai-tells.md` | Catalog of 44 AI-generated visual tells to detect and eradicate | Anti-generic polish, design critique |
|
|
39
|
+
| `references/redesign-audit.md` | Pre-implementation audit checklist for existing projects | Planning a surface or application revamp |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### Tier 3: Optional Media & Graphic References (User Explicit Request Only)
|
|
44
|
+
Do not load during web application or frontend development unless explicitly asked for graphics or slides:
|
|
45
|
+
|
|
46
|
+
| Reference | Media Type | Deliverable |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| `references/slides.md` | Presentation | HTML pitch decks with Chart.js |
|
|
49
|
+
| `references/slides-html-template.md` | Presentation | Reusable semantic HTML slide boilerplate |
|
|
50
|
+
| `references/slides-layout-patterns.md` | Presentation | Bento, split, timeline, and metric slide layouts |
|
|
51
|
+
| `references/slides-copywriting-formulas.md`| Presentation | Executive storytelling and slide messaging formulas |
|
|
52
|
+
| `references/slides-strategies.md` | Presentation | Slide deck pacing and structural strategies |
|
|
53
|
+
| `references/banner-sizes-and-styles.md` | Graphic Design | Social and display ad banner specifications (22 styles) |
|
|
54
|
+
| `references/social-photos-design.md` | Graphic Design | OpenGraph, Twitter card, and social post graphics |
|
|
55
|
+
| `references/logo-design.md` | Identity | SVG logo prompts, geometric/minimalist styles |
|
|
56
|
+
| `references/cip-design.md` | Identity | Corporate Identity Program (stationery, collateral) |
|
|
57
|
+
| `references/icon-design.md` | Graphic Design | Vector SVG icon design protocols (15 styles) |
|
|
58
|
+
| `references/executive-reports.md` | Documentation | High-density technical and executive report templates |
|
|
59
|
+
| `references/image-mockup-direction.md` | Mockup | 3D device mockup composition guides |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
### Tier 4: Archived & Superset References (Retained for Provenance)
|
|
64
|
+
These references represent earlier iterations or raw vocabulary sources:
|
|
65
|
+
|
|
66
|
+
- `references/intake.md`: Early English brief intake (superseded by `brief-intake.md` v2.3).
|
|
67
|
+
- `references/redesign.md`: Legacy redesign notes (superseded by `web-retrofit-protocol.md`).
|
|
68
|
+
- `references/vocabulary.md`: Legacy UI vocabulary (superseded by `vocab-protocol.md` and `ui-ux-vocabulary-vault.md`).
|
|
69
|
+
- `references/ui-ux-vocabulary-vault.md` & `ui-ux-vocabulary-vault.json`: 90KB raw lexicon vault used by discovery indexing.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 2. Design Decision Matrix (Context-Driven Architecture)
|
|
74
|
+
|
|
75
|
+
Design decisions must be derived from context, not arbitrary taste. Never force a single archetype or visual style across different products:
|
|
76
|
+
|
|
77
|
+
| Product Domain | Target Audience | Spatial Model | Recommended Typography | Primary Palette | Motion Profile |
|
|
78
|
+
|---|---|---|---|---|---|
|
|
79
|
+
| **B2B SaaS / Admin** | Technical Operators, Admins | Bento / Column Grid (Dense) | Geist / Inter + JetBrains Mono | Monochromatic Slate + Vibrant Action | `spring-settle` (160ms) |
|
|
80
|
+
| **GIS / Cadastre / Mapping** | Surveyors, Civil Engineers | 16:10 Split Canvas + Data Shelf | JetBrains Mono + IBM Plex Sans Thai | Ultra-Dark Obsidian + Electric Cyan (#00f5fb) | `precision` (120ms max) |
|
|
81
|
+
| **Telemetry / Industrial** | Operations Center, SREs | Multi-Pane Cockpit (100dvh) | Tabular Monospace | High-Contrast Charcoal + Passed Emerald | `instant` / `precision` |
|
|
82
|
+
| **FinTech / Banking** | Institutional / Retail Investors | Tabular Density + Key Metrics | Plus Jakarta Sans + Tabular Mono | Deep Navy / Forest + Restrained Gold/Emerald | `precision` (140ms) |
|
|
83
|
+
| **Consumer / E-Commerce** | Everyday Consumers | Fluid Editorial / Story Grid | Plus Jakarta Sans / Cabinet Grotesk | Warm Neutral + Product Accent | `soft-settle` (240ms) |
|
|
84
|
+
| **Developer Tooling** | Software Engineers | Terminal-First / Split Pane | Geist Sans + Geist Mono | Deep Void / Monochrome Carbon | `instant` (0-80ms) |
|
|
85
|
+
| **Public Sector / Utility** | General Public (High Diversity) | Simple Linear / Card Stack | Inter + System Sans (WCAG AAA) | High-Contrast Neutral + Accessible Blue | None / `soft-settle` |
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 3. Anti-Default Guarantees (No Universal Style)
|
|
90
|
+
|
|
91
|
+
ME-DESIGN strictly forbids enforcing the following as universal requirements:
|
|
92
|
+
1. **No Forced Dark Mode:** Choose light, dark, or system-adaptive based entirely on product domain and lighting environment.
|
|
93
|
+
2. **No Forced Bento Grid:** Use Bento layouts only when content units have genuine hierarchical asymmetry. Never distort tabular data into Bento boxes.
|
|
94
|
+
3. **No Forced 3-Pane Cockpit:** Reserve 3-pane spatial layouts for map-centric, CAD, or telemetry tools. Never apply cockpit layouts to landing pages or mobile applications.
|
|
95
|
+
4. **No Forced Neon Accents:** Saturated OKLCH cyan/magenta is suitable for technical displays; consumer, medical, and banking products require restrained semantic colors.
|
|
96
|
+
5. **No Universal Font:** Thai requires Latin fonts defined first (`"Plus Jakarta Sans", "IBM Plex Sans Thai"`), with `line-height >= 1.7` to prevent diacritic clipping.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
- `MOTION_INTENSITY = 6/10` (Spring Physics `cubic-bezier(0.22, 1, 0.36, 1)` สำหรับ Hover/Drawer + 0ms Instant State Sync สำหรับการสลับเหรียญ/กรองตาราง + เคารพ `@media (prefers-reduced-motion: reduce)`)
|
|
9
9
|
- `VISUAL_DENSITY = 7–8/10` (High-Craft Telemetry Density: ใช้ `font-variant-numeric: tabular-nums` ทุกตัวเลขราคา/พิกัด/เวลา, ช่องว่างภายในสัมพันธ์กับรัศมีขอบ)
|
|
10
10
|
- **Gapless Bento & Viewport Budget:**
|
|
11
|
-
- กริดแบบ Bento
|
|
11
|
+
- กริดแบบ Bento ให้จัดวางด้วย `grid-auto-flow: row;` ร่วมกับ Named Grid Areas หรือวางคอลัมน์ให้เต็มพอดี (ห้ามใช้ `grid-auto-flow: dense;` เด็ดขาด เพื่อป้องกัน DOM/Tab Order สลับตำแหน่งตามกฎ MD101)
|
|
12
12
|
- ใช้ `min-height: 100dvh;` แทน `100vh` และล็อก `overflow-x: hidden;` บน `body`
|
|
13
13
|
- **Viewport Budget:** ใน 1 หน้าจอแรก (Above the Fold) ห้ามมีกลุ่มองค์ประกอบแยกกันเกิน 3 โซนหลัก และต้องมีพื้นที่ว่าง (Whitespace / Surface Canvas) อย่างน้อย 25%
|
|
14
14
|
|
|
@@ -62,15 +62,12 @@
|
|
|
62
62
|
- "Join [notable company] and [notable company]"
|
|
63
63
|
- "As seen in [publication]"
|
|
64
64
|
|
|
65
|
-
##
|
|
65
|
+
## Formula Selection Heuristic
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
# Get emotion-appropriate formula
|
|
72
|
-
python ../design-system/scripts/search-slides.py "urgency cta" -d copy
|
|
73
|
-
```
|
|
67
|
+
- **Cold Audiences:** Start with PAS (Pain, Agitate, Solve)
|
|
68
|
+
- **Feature Announcements:** Use FAB (Features, Advantages, Benefits)
|
|
69
|
+
- **High-Stakes Pitches:** Lead with Problem-Agitation into Inevitable Solution
|
|
70
|
+
- **Action / Conversion Slides:** Conclude with Clear Urgency CTA
|
|
74
71
|
|
|
75
72
|
## Quick Reference
|
|
76
73
|
|
|
@@ -109,29 +109,14 @@
|
|
|
109
109
|
| `contrast-pair` | Before/after |
|
|
110
110
|
| `logo-grayscale` | Client logos |
|
|
111
111
|
|
|
112
|
-
## Search Commands
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
# Find layout for specific use
|
|
116
|
-
python ../design-system/scripts/search-slides.py "metrics dashboard" -d layout
|
|
117
|
-
|
|
118
|
-
# Contextual recommendation
|
|
119
|
-
python ../design-system/scripts/search-slides.py "traction slide" \
|
|
120
|
-
--context --position 4 --total 10
|
|
121
|
-
```
|
|
122
|
-
|
|
123
112
|
## Layout Decision Flow
|
|
124
113
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
└─> Search color-logic.csv
|
|
114
|
+
1. **What is the slide goal?**
|
|
115
|
+
- High Impact Intro -> Hero Pattern
|
|
116
|
+
- Metric Comparison -> Split Comparison or 3-Card Bento
|
|
117
|
+
- Sequence of Events -> Timeline Pattern
|
|
118
|
+
- Multi-feature Overview -> 4-Column Feature Grid
|
|
131
119
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
4. Should it break pattern?
|
|
136
|
-
└─> Check position (1/3, 2/3) → Use full-bleed
|
|
137
|
-
```
|
|
120
|
+
2. **What visual density is required?**
|
|
121
|
+
- Executive / Pitch: Low density, high whitespace (40%+ canvas)
|
|
122
|
+
- Technical Review: High tabular density with Chart.js container
|
|
@@ -72,16 +72,6 @@ What Is → What Could Be → What Is → What Could Be → New Bliss
|
|
|
72
72
|
|
|
73
73
|
Pattern breaks at 1/3 and 2/3 positions create engagement peaks.
|
|
74
74
|
|
|
75
|
-
## Search Commands
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
# Find strategy by goal
|
|
79
|
-
python ../design-system/scripts/search-slides.py "investor pitch" -d strategy
|
|
80
|
-
|
|
81
|
-
# Get emotion arc
|
|
82
|
-
python ../design-system/scripts/search-slides.py "series a funding" -d strategy --json
|
|
83
|
-
```
|
|
84
|
-
|
|
85
75
|
## Matching Strategy to Context
|
|
86
76
|
|
|
87
77
|
| Context | Recommended Strategy |
|
package/tests/browser-audit.js
CHANGED
|
@@ -61,6 +61,11 @@ if (!fs.existsSync(targetFile)) {
|
|
|
61
61
|
process.exit(2);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
if (typeof WebSocket === 'undefined') {
|
|
65
|
+
console.error(`${ANSI_RED}Error:${ANSI_RESET} Headless browser audit requires native WebSocket support (Node.js >= 20.10.0 or Node.js >= 22). Current: ${process.version}`);
|
|
66
|
+
process.exit(2);
|
|
67
|
+
}
|
|
68
|
+
|
|
64
69
|
const resolvedPath = path.resolve(targetFile);
|
|
65
70
|
const fileUrl = 'file:///' + resolvedPath.replace(/\\/g, '/');
|
|
66
71
|
|
|
@@ -367,12 +372,19 @@ async function runAudit() {
|
|
|
367
372
|
highContrastOutlineRendered = hasOutline;
|
|
368
373
|
}
|
|
369
374
|
|
|
375
|
+
// Test 4: Viewport Horizontal Overflow Detection
|
|
376
|
+
const docEl = document.documentElement;
|
|
377
|
+
const horizontalOverflow = (docEl.scrollWidth - window.innerWidth) > 2.0;
|
|
378
|
+
|
|
370
379
|
return {
|
|
371
380
|
buttonCount: buttons.length,
|
|
372
381
|
hitTargetViolations,
|
|
373
382
|
minContrastRatio: Math.round(minContrast * 10) / 10,
|
|
374
383
|
focusVisibleRendered,
|
|
375
384
|
highContrastOutlineRendered,
|
|
385
|
+
horizontalOverflow,
|
|
386
|
+
scrollWidth: docEl.scrollWidth,
|
|
387
|
+
viewportWidth: window.innerWidth,
|
|
376
388
|
debugContrast
|
|
377
389
|
};
|
|
378
390
|
})()
|
|
@@ -404,8 +416,9 @@ async function runAudit() {
|
|
|
404
416
|
const focusPass = isForced
|
|
405
417
|
? (r.highContrastOutlineRendered || r.buttonCount === 0)
|
|
406
418
|
: (r.focusVisibleRendered || r.buttonCount === 0);
|
|
419
|
+
const overflowPass = !r.horizontalOverflow;
|
|
407
420
|
|
|
408
|
-
if (!contrastPass || !hitTargetPass || !focusPass) overallPass = false;
|
|
421
|
+
if (!contrastPass || !hitTargetPass || !focusPass || !overflowPass) overallPass = false;
|
|
409
422
|
});
|
|
410
423
|
|
|
411
424
|
if (isJson) {
|
|
@@ -420,11 +433,11 @@ async function runAudit() {
|
|
|
420
433
|
// Render Matrix Card
|
|
421
434
|
console.log(`\n${ANSI_BOLD}ME-DESIGN Phase 2 — Browser Verification Matrix${ANSI_RESET}`);
|
|
422
435
|
console.log(`${ANSI_CYAN}Headless Chromium Runtime Engine (CDP v156)${ANSI_RESET}`);
|
|
423
|
-
console.log(`${ANSI_GRAY}
|
|
436
|
+
console.log(`${ANSI_GRAY}────────────────────────────────────────────────────────────────────────────────────────${ANSI_RESET}`);
|
|
424
437
|
console.log(`Target: ${path.basename(targetFile)}\n`);
|
|
425
438
|
|
|
426
|
-
console.log(`${'VIEWPORT'.padEnd(10)} | ${'MODE'.padEnd(14)} | ${'CONTRAST'.padEnd(10)} | ${'HIT-TARGET (≥44px)'.padEnd(20)} | ${'TAB FOCUS'.padEnd(
|
|
427
|
-
console.log(`${ANSI_GRAY}
|
|
439
|
+
console.log(`${'VIEWPORT'.padEnd(10)} | ${'MODE'.padEnd(14)} | ${'CONTRAST'.padEnd(10)} | ${'HIT-TARGET (≥44px)'.padEnd(20)} | ${'TAB FOCUS'.padEnd(12)} | ${'OVERFLOW'}`);
|
|
440
|
+
console.log(`${ANSI_GRAY}----------------------------------------------------------------------------------------${ANSI_RESET}`);
|
|
428
441
|
|
|
429
442
|
auditResults.forEach(r => {
|
|
430
443
|
const isForced = r.theme === 'forced-colors';
|
|
@@ -433,6 +446,7 @@ async function runAudit() {
|
|
|
433
446
|
const focusPass = isForced
|
|
434
447
|
? (r.highContrastOutlineRendered || r.buttonCount === 0)
|
|
435
448
|
: (r.focusVisibleRendered || r.buttonCount === 0);
|
|
449
|
+
const overflowPass = !r.horizontalOverflow;
|
|
436
450
|
|
|
437
451
|
const contrastStr = isForced
|
|
438
452
|
? ANSI_CYAN + 'SYS-HIGH' + ANSI_RESET
|
|
@@ -444,10 +458,14 @@ async function runAudit() {
|
|
|
444
458
|
|
|
445
459
|
const focusStr = (focusPass ? ANSI_GREEN : ANSI_RED) + (focusPass ? (isForced ? 'OUTLINE OK' : 'VERIFIED') : (isForced ? 'NO OUTLINE' : 'NO FOCUS')) + ANSI_RESET;
|
|
446
460
|
|
|
447
|
-
|
|
461
|
+
const overflowStr = overflowPass
|
|
462
|
+
? ANSI_GREEN + 'OK (Fit)' + ANSI_RESET
|
|
463
|
+
: ANSI_RED + `FAIL (+${Math.round(r.scrollWidth - r.viewportWidth)}px)` + ANSI_RESET;
|
|
464
|
+
|
|
465
|
+
console.log(`${r.viewport.padEnd(10)} | ${r.theme.padEnd(14)} | ${contrastStr.padEnd(19)} | ${hitStr.padEnd(31)} | ${focusStr.padEnd(21)} | ${overflowStr}`);
|
|
448
466
|
});
|
|
449
467
|
|
|
450
|
-
console.log(`${ANSI_GRAY}
|
|
468
|
+
console.log(`${ANSI_GRAY}────────────────────────────────────────────────────────────────────────────────────────${ANSI_RESET}`);
|
|
451
469
|
if (overallPass) {
|
|
452
470
|
console.log(`${ANSI_GREEN}${ANSI_BOLD}BROWSER MATRIX VERIFICATION: PASS (Exit Code: 0)${ANSI_RESET}\n`);
|
|
453
471
|
process.exit(0);
|