vc-extras 0.1.0 → 0.1.1

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 (249) hide show
  1. package/README.md +128 -71
  2. package/agent-install.mjs +159 -0
  3. package/agents/tester.md +23 -23
  4. package/install-extras.mjs +41 -109
  5. package/install-menu.mjs +22 -43
  6. package/install-skills.mjs +112 -112
  7. package/package.json +72 -28
  8. package/plugin-registry.mjs +73 -0
  9. package/plugins/config-ui/index.ts +159 -159
  10. package/plugins/config-ui/lib/arguments.mjs +24 -24
  11. package/plugins/config-ui/lib/documents.mjs +67 -67
  12. package/plugins/config-ui/lib/frontmatter.mjs +91 -91
  13. package/plugins/config-ui/lib/open.mjs +16 -16
  14. package/plugins/config-ui/lib/ownership.mjs +99 -99
  15. package/plugins/config-ui/lib/page.mjs +11 -11
  16. package/plugins/config-ui/lib/patch.mjs +35 -35
  17. package/plugins/config-ui/lib/paths.mjs +14 -14
  18. package/plugins/config-ui/lib/plugin-fields.mjs +86 -86
  19. package/plugins/config-ui/lib/plugin-validation.mjs +28 -28
  20. package/plugins/config-ui/lib/redaction.mjs +8 -8
  21. package/plugins/config-ui/lib/registry.mjs +282 -282
  22. package/plugins/config-ui/lib/secrets.mjs +44 -44
  23. package/plugins/config-ui/lib/server.mjs +250 -250
  24. package/plugins/config-ui/lib/sources.mjs +96 -96
  25. package/plugins/config-ui/lib/state.mjs +156 -156
  26. package/plugins/config-ui/lib/themes.mjs +113 -113
  27. package/plugins/config-ui/lib/writer.mjs +690 -690
  28. package/plugins/config-ui/project-local-owner.ts +106 -106
  29. package/plugins/config-ui/vc-extras.plugin.json +13 -0
  30. package/plugins/config-ui/web/app.mjs +997 -997
  31. package/plugins/config-ui/web/index.html +342 -342
  32. package/plugins/pi-blackhole/vc-extras.plugin.json +12 -0
  33. package/plugins/pi-btw/vc-extras.plugin.json +12 -0
  34. package/plugins/pi-claude-code/vc-extras.plugin.json +12 -0
  35. package/plugins/pi-fff/vc-extras.plugin.json +12 -0
  36. package/plugins/pi-jev-auto-mode/vc-extras.plugin.json +12 -0
  37. package/plugins/pi-mcp-adapter/vc-extras.plugin.json +12 -0
  38. package/plugins/pi-web-access/vc-extras.plugin.json +12 -0
  39. package/plugins/vc-ask/claude-hook.mjs +37 -0
  40. package/plugins/vc-ask/codex-native.mjs +28 -0
  41. package/plugins/vc-ask/host-channel.mjs +75 -0
  42. package/plugins/vc-ask/index.ts +57 -0
  43. package/plugins/vc-ask/native-questions.mjs +33 -0
  44. package/plugins/vc-ask/package.json +10 -0
  45. package/plugins/vc-ask/payload.ts +170 -0
  46. package/plugins/vc-ask/questionnaire/LICENSE.ask-user-question +21 -0
  47. package/plugins/vc-ask/questionnaire/UPSTREAM.md +104 -0
  48. package/plugins/vc-ask/questionnaire/answer-channel.ts +135 -0
  49. package/plugins/vc-ask/questionnaire/config.ts +180 -0
  50. package/plugins/vc-ask/questionnaire/events.ts +154 -0
  51. package/plugins/vc-ask/questionnaire/execute.ts +688 -0
  52. package/plugins/vc-ask/questionnaire/i18n.ts +73 -0
  53. package/plugins/vc-ask/questionnaire/inline-entry.ts +312 -0
  54. package/plugins/vc-ask/questionnaire/locales/de.json +43 -0
  55. package/plugins/vc-ask/questionnaire/locales/en.json +42 -0
  56. package/plugins/vc-ask/questionnaire/locales/es.json +43 -0
  57. package/plugins/vc-ask/questionnaire/locales/fr.json +43 -0
  58. package/plugins/vc-ask/questionnaire/locales/pt-BR.json +43 -0
  59. package/plugins/vc-ask/questionnaire/locales/pt.json +43 -0
  60. package/plugins/vc-ask/questionnaire/locales/ru.json +43 -0
  61. package/plugins/vc-ask/questionnaire/locales/uk.json +43 -0
  62. package/plugins/vc-ask/questionnaire/locales/zh.json +46 -0
  63. package/plugins/vc-ask/questionnaire/presentation.ts +11 -0
  64. package/plugins/vc-ask/questionnaire/question-preview.ts +6 -0
  65. package/plugins/vc-ask/questionnaire/rpc.ts +221 -0
  66. package/plugins/vc-ask/questionnaire/session-timeout.ts +67 -0
  67. package/plugins/vc-ask/questionnaire/state/build-questionnaire.ts +144 -0
  68. package/plugins/vc-ask/questionnaire/state/external-editor.ts +62 -0
  69. package/plugins/vc-ask/questionnaire/state/geometry.ts +131 -0
  70. package/plugins/vc-ask/questionnaire/state/key-router.ts +382 -0
  71. package/plugins/vc-ask/questionnaire/state/panel-router.ts +32 -0
  72. package/plugins/vc-ask/questionnaire/state/questionnaire-session.ts +642 -0
  73. package/plugins/vc-ask/questionnaire/state/row-intent.ts +143 -0
  74. package/plugins/vc-ask/questionnaire/state/selectors/contract.ts +24 -0
  75. package/plugins/vc-ask/questionnaire/state/selectors/derivations.ts +40 -0
  76. package/plugins/vc-ask/questionnaire/state/selectors/focus.ts +17 -0
  77. package/plugins/vc-ask/questionnaire/state/selectors/projections.ts +99 -0
  78. package/plugins/vc-ask/questionnaire/state/state-reducer.ts +455 -0
  79. package/plugins/vc-ask/questionnaire/state/state.ts +90 -0
  80. package/plugins/vc-ask/questionnaire/state/vertical.ts +158 -0
  81. package/plugins/vc-ask/questionnaire/timeout.ts +59 -0
  82. package/plugins/vc-ask/questionnaire/tool/external-answer.ts +103 -0
  83. package/plugins/vc-ask/questionnaire/tool/format-answer.ts +24 -0
  84. package/plugins/vc-ask/questionnaire/tool/normalize-params.ts +37 -0
  85. package/plugins/vc-ask/questionnaire/tool/response-envelope.ts +75 -0
  86. package/plugins/vc-ask/questionnaire/tool/types.ts +74 -0
  87. package/plugins/vc-ask/questionnaire/tool/validate-questionnaire.ts +75 -0
  88. package/plugins/vc-ask/questionnaire/view/card-theme.ts +245 -0
  89. package/plugins/vc-ask/questionnaire/view/components/inline-input.ts +66 -0
  90. package/plugins/vc-ask/questionnaire/view/components/multi-select-view.ts +177 -0
  91. package/plugins/vc-ask/questionnaire/view/components/option-list-view.ts +65 -0
  92. package/plugins/vc-ask/questionnaire/view/components/preview/markdown-content-cache.ts +101 -0
  93. package/plugins/vc-ask/questionnaire/view/components/preview/preview-block-renderer.ts +130 -0
  94. package/plugins/vc-ask/questionnaire/view/components/preview/preview-box-renderer.ts +86 -0
  95. package/plugins/vc-ask/questionnaire/view/components/preview/preview-layout-decider.ts +204 -0
  96. package/plugins/vc-ask/questionnaire/view/components/preview/preview-pane.ts +257 -0
  97. package/plugins/vc-ask/questionnaire/view/components/submit-picker.ts +65 -0
  98. package/plugins/vc-ask/questionnaire/view/components/tab-bar.ts +57 -0
  99. package/plugins/vc-ask/questionnaire/view/components/wrapping-select.ts +269 -0
  100. package/plugins/vc-ask/questionnaire/view/dialog-builder.ts +319 -0
  101. package/plugins/vc-ask/questionnaire/view/document-theme.ts +53 -0
  102. package/plugins/vc-ask/questionnaire/view/document-view.ts +306 -0
  103. package/plugins/vc-ask/questionnaire/view/panel-chrome.ts +133 -0
  104. package/plugins/vc-ask/questionnaire/view/props-adapter.ts +77 -0
  105. package/plugins/vc-ask/questionnaire/view/stateful-view.ts +24 -0
  106. package/plugins/vc-ask/questionnaire/view/tab-components.ts +16 -0
  107. package/plugins/vc-ask/questionnaire/view/tab-content-strategy.ts +280 -0
  108. package/plugins/vc-ask/questionnaire/view/vertical-view.ts +218 -0
  109. package/plugins/vc-ask/user-input-events.ts +34 -0
  110. package/plugins/vc-ask/vc-extras.plugin.json +18 -0
  111. package/plugins/vc-footer/agents/claude-code/adapter.mjs +29 -0
  112. package/plugins/vc-footer/agents/claude-code/cli.mjs +23 -0
  113. package/plugins/vc-footer/agents/claude-code/renderer.mjs +1 -0
  114. package/plugins/vc-footer/agents/claude-code/types.d.ts +38 -0
  115. package/plugins/vc-footer/agents/codex/adapter.mjs +13 -0
  116. package/plugins/vc-footer/agents/codex/mcp.mjs +45 -0
  117. package/plugins/vc-footer/agents/codex/native.mjs +19 -0
  118. package/plugins/vc-footer/agents/codex/renderer.mjs +2 -0
  119. package/plugins/vc-footer/agents/pi/adapter.mjs +23 -0
  120. package/plugins/vc-footer/agents/pi/index.js +84 -0
  121. package/plugins/vc-footer/agents/pi/project-local-owner.mjs +97 -0
  122. package/plugins/vc-footer/agents/pi/renderer.mjs +5 -0
  123. package/plugins/vc-footer/core/data.mjs +218 -0
  124. package/plugins/vc-footer/core/render.mjs +291 -0
  125. package/plugins/vc-footer/core/types.d.ts +29 -0
  126. package/plugins/vc-footer/package.json +22 -0
  127. package/plugins/vc-footer/vc-extras.plugin.json +32 -0
  128. package/skills/animate/LICENSE +21 -21
  129. package/skills/animate/RECIPES.md +324 -324
  130. package/skills/animate/SKILL.md +208 -208
  131. package/skills/animate/UPSTREAM.md +19 -19
  132. package/skills/animation-performance/LICENSE +21 -21
  133. package/skills/animation-performance/SKILL.md +223 -223
  134. package/skills/animation-performance/UPSTREAM.md +19 -19
  135. package/skills/answer-me-with-html/SKILL.md +174 -174
  136. package/skills/answer-me-with-html/scripts/am.mjs +12896 -12896
  137. package/skills/apple-design/LICENSE +21 -21
  138. package/skills/apple-design/SKILL.md +291 -291
  139. package/skills/apple-design/UPSTREAM.md +19 -19
  140. package/skills/bad-smell/SKILL.md +44 -44
  141. package/skills/commit/SKILL.md +90 -90
  142. package/skills/emil-design-eng/LICENSE +21 -21
  143. package/skills/emil-design-eng/SKILL.md +677 -677
  144. package/skills/emil-design-eng/UPSTREAM.md +19 -19
  145. package/skills/find-the-truth/SKILL.md +38 -38
  146. package/skills/find-the-truth/references/trace-method.md +48 -48
  147. package/skills/find-the-truth/references/truth-method.md +39 -39
  148. package/skills/gestures/LICENSE +21 -21
  149. package/skills/gestures/SKILL.md +107 -107
  150. package/skills/gestures/UPSTREAM.md +19 -19
  151. package/skills/humanizer-zh/LICENSE +21 -21
  152. package/skills/humanizer-zh/SKILL.md +409 -409
  153. package/skills/humanizer-zh/UPSTREAM.md +7 -7
  154. package/skills/impeccable/LICENSE +191 -191
  155. package/skills/impeccable/NOTICE.md +11 -11
  156. package/skills/impeccable/SKILL.md +89 -89
  157. package/skills/impeccable/licenses/modern-screenshot-MIT.txt +8 -8
  158. package/skills/impeccable/licenses/platform-design-skills-MIT.txt +21 -21
  159. package/skills/impeccable/reference/adapt.md +318 -318
  160. package/skills/impeccable/reference/adapt.native.md +58 -58
  161. package/skills/impeccable/reference/android.md +46 -46
  162. package/skills/impeccable/reference/animate.md +89 -89
  163. package/skills/impeccable/reference/audit.md +139 -139
  164. package/skills/impeccable/reference/audit.native.md +139 -139
  165. package/skills/impeccable/reference/bolder.md +33 -33
  166. package/skills/impeccable/reference/clarify.md +94 -94
  167. package/skills/impeccable/reference/colorize.md +86 -86
  168. package/skills/impeccable/reference/component-review.md +63 -63
  169. package/skills/impeccable/reference/craft-floor.md +44 -44
  170. package/skills/impeccable/reference/craft.md +5 -5
  171. package/skills/impeccable/reference/critique.md +819 -819
  172. package/skills/impeccable/reference/degraded/asset-producer.md +41 -41
  173. package/skills/impeccable/reference/degraded/documenter.md +23 -23
  174. package/skills/impeccable/reference/degraded/finish-reviewer.md +37 -37
  175. package/skills/impeccable/reference/degraded/manual-edit-applier.md +92 -92
  176. package/skills/impeccable/reference/delight.md +70 -70
  177. package/skills/impeccable/reference/distill.md +111 -111
  178. package/skills/impeccable/reference/doctor.md +54 -54
  179. package/skills/impeccable/reference/document.md +416 -416
  180. package/skills/impeccable/reference/extract.md +69 -69
  181. package/skills/impeccable/reference/generate.md +101 -101
  182. package/skills/impeccable/reference/harden.md +362 -362
  183. package/skills/impeccable/reference/hooks.md +114 -114
  184. package/skills/impeccable/reference/init.md +131 -131
  185. package/skills/impeccable/reference/ios.md +51 -51
  186. package/skills/impeccable/reference/layout.md +84 -84
  187. package/skills/impeccable/reference/live-setup.md +104 -104
  188. package/skills/impeccable/reference/live.md +327 -327
  189. package/skills/impeccable/reference/mode-operate.md +21 -21
  190. package/skills/impeccable/reference/mode-persuade.md +19 -19
  191. package/skills/impeccable/reference/mode-read.md +21 -21
  192. package/skills/impeccable/reference/new-work.md +152 -152
  193. package/skills/impeccable/reference/onboard.md +234 -234
  194. package/skills/impeccable/reference/operate.md +61 -61
  195. package/skills/impeccable/reference/optimize.md +257 -257
  196. package/skills/impeccable/reference/overdrive.md +127 -127
  197. package/skills/impeccable/reference/polish.md +105 -105
  198. package/skills/impeccable/reference/quieter.md +99 -99
  199. package/skills/impeccable/reference/region-map.md +26 -26
  200. package/skills/impeccable/reference/routing.md +24 -24
  201. package/skills/impeccable/reference/shape.md +59 -59
  202. package/skills/impeccable/reference/typeset.md +90 -90
  203. package/skills/impeccable/reference/visualize.md +47 -47
  204. package/skills/impeccable/scripts/VERSION +1 -1
  205. package/skills/impeccable/scripts/command-metadata.json +98 -98
  206. package/skills/impeccable/scripts/data/font-index-failures.json +120 -120
  207. package/skills/impeccable/scripts/engine-checksums.txt +9 -9
  208. package/skills/impeccable/scripts/impeccable +249 -249
  209. package/skills/impeccable/scripts/impeccable.cmd +278 -278
  210. package/skills/impeccable/scripts/live-browser-dom.js +320 -320
  211. package/skills/impeccable/scripts/live-browser-ignores.js +246 -246
  212. package/skills/impeccable/scripts/live-browser-session.js +183 -183
  213. package/skills/impeccable/scripts/live-browser.js +13862 -13862
  214. package/skills/impeccable/scripts/modern-screenshot.umd.js +14 -14
  215. package/skills/improve-animations/AUDIT.md +115 -115
  216. package/skills/improve-animations/LICENSE +21 -21
  217. package/skills/improve-animations/PLAN-TEMPLATE.md +73 -73
  218. package/skills/improve-animations/SKILL.md +110 -110
  219. package/skills/improve-animations/UPSTREAM.md +19 -19
  220. package/skills/pick-ui-library/LICENSE +21 -21
  221. package/skills/pick-ui-library/SKILL.md +85 -85
  222. package/skills/pick-ui-library/UPSTREAM.md +19 -19
  223. package/skills/review-animations/LICENSE +21 -21
  224. package/skills/review-animations/SKILL.md +120 -120
  225. package/skills/review-animations/STANDARDS.md +187 -187
  226. package/skills/review-animations/UPSTREAM.md +19 -19
  227. package/skills/test/SKILL.md +29 -29
  228. package/skills/test/references/test-method.md +60 -60
  229. package/skills/write-doc/SKILL.md +115 -115
  230. package/skills/write-doc/examples/result-report.md +53 -53
  231. package/skills/write-doc/examples/task-summary.md +45 -45
  232. package/skills/write-doc/references/terminology.md +147 -147
  233. package/specs/ask-host-protocol-v1.md +58 -0
  234. package/specs/design-demo.md +1102 -1102
  235. package/specs/frontend-immersive.md +28 -28
  236. package/specs/plugin-install-v2.md +123 -0
  237. package/specs/plugin-install.md +38 -0
  238. package/specs/web-modes/explore.md +31 -31
  239. package/specs/web-modes/risk.md +15 -15
  240. package/specs/web-modes/verify.md +16 -16
  241. package/vc-extras.mjs +46 -62
  242. package/plugins/essrj/context.ts +0 -47
  243. package/plugins/essrj/data.ts +0 -190
  244. package/plugins/essrj/index.ts +0 -139
  245. package/plugins/essrj/package.json +0 -12
  246. package/plugins/essrj/project-local-owner.ts +0 -106
  247. package/plugins/essrj/render.ts +0 -217
  248. package/plugins/essrj/types.ts +0 -40
  249. package/plugins.json +0 -38
@@ -1,362 +1,362 @@
1
- Designs that only work with perfect data aren't production-ready. Harden the interface against the inputs, errors, languages, and network conditions that real users will throw at it.
2
-
3
- ## Assess Hardening Needs
4
-
5
- Identify weaknesses and edge cases:
6
-
7
- 1. **Test with extreme inputs**:
8
- - Very long text (names, descriptions, titles)
9
- - Very short text (empty, single character)
10
- - Special characters (emoji, RTL text, accents)
11
- - Large numbers (millions, billions)
12
- - Many items (1000+ list items, 50+ options)
13
- - No data (empty states)
14
-
15
- 2. **Test error scenarios**:
16
- - Network failures (offline, slow, timeout)
17
- - API errors (400, 401, 403, 404, 500)
18
- - Validation errors
19
- - Permission errors
20
- - Rate limiting
21
- - Concurrent operations
22
-
23
- 3. **Test internationalization**:
24
- - Long translations (German is often 30% longer than English)
25
- - RTL languages (Arabic, Hebrew)
26
- - Character sets (Chinese, Japanese, Korean, emoji)
27
- - Date/time formats
28
- - Number formats (1,000 vs 1.000)
29
- - Currency symbols
30
-
31
- Designs that only work with perfect data aren't production-ready.
32
-
33
- ## Hardening Dimensions
34
-
35
- Systematically improve resilience:
36
-
37
- ### Text Overflow & Wrapping
38
-
39
- **Long text handling**:
40
- ```css
41
- /* Single line with ellipsis */
42
- .truncate {
43
- overflow: hidden;
44
- text-overflow: ellipsis;
45
- white-space: nowrap;
46
- }
47
-
48
- /* Multi-line with clamp */
49
- .line-clamp {
50
- display: -webkit-box;
51
- -webkit-line-clamp: 3;
52
- -webkit-box-orient: vertical;
53
- overflow: hidden;
54
- }
55
-
56
- /* Allow wrapping */
57
- .wrap {
58
- word-wrap: break-word;
59
- overflow-wrap: break-word;
60
- hyphens: auto;
61
- }
62
- ```
63
-
64
- **Flex/Grid overflow**:
65
- ```css
66
- /* Prevent flex items from overflowing */
67
- .flex-item {
68
- min-width: 0; /* Allow shrinking below content size */
69
- overflow: hidden;
70
- }
71
-
72
- /* Prevent grid items from overflowing */
73
- .grid-item {
74
- min-width: 0;
75
- min-height: 0;
76
- }
77
- ```
78
-
79
- **Responsive text sizing**:
80
- - Use `clamp()` for fluid typography
81
- - Set minimum readable sizes (16px body on mobile, the same floor the typography guidance sets; 14px only for genuinely secondary text. iOS Safari force-zooms focused inputs under 16px, which breaks form layouts)
82
- - Test text scaling (zoom to 200%)
83
- - Ensure containers expand with text
84
-
85
- ### Internationalization (i18n)
86
-
87
- **Text expansion**:
88
- - Add 30-40% space budget for translations
89
- - Use flexbox/grid that adapts to content
90
- - Test with longest language (usually German)
91
- - Avoid fixed widths on text containers
92
-
93
- ```jsx
94
- // ❌ Bad: Assumes short English text
95
- <button className="w-24">Submit</button>
96
-
97
- // ✅ Good: Adapts to content
98
- <button className="px-4 py-2">Submit</button>
99
- ```
100
-
101
- **RTL (Right-to-Left) support**:
102
- ```css
103
- /* Use logical properties */
104
- margin-inline-start: 1rem; /* Not margin-left */
105
- padding-inline: 1rem; /* Not padding-left/right */
106
- border-inline-end: 1px solid; /* Not border-right */
107
-
108
- /* Or use dir attribute */
109
- [dir="rtl"] .arrow { transform: scaleX(-1); }
110
- ```
111
-
112
- **Arabic-script specifics** (Arabic, Persian, Urdu, Pashto, Kurdish):
113
- - Preserve Zero-Width Non-Joiner (U+200C). Persian and Kurdish use ZWNJ between compound-word parts to break cursive joining while keeping the word together. A filter or sanitizer that strips it changes meaning. Never normalize it away.
114
- - Handle Yeh and Kaf variants. Persian uses ی (U+06CC) and ک (U+06A9), while Arabic uses ي (U+064A) and ك (U+0643). Preserve the original form in storage. For search and validation, treat the corresponding letters as equivalent so that Arabic-keyboard input matches Persian text. Rejecting one variant locks out users whose keyboard sends the other.
115
- - Support locale-aware digits. Persian (`fa-IR`) and Arabic locales use Eastern Arabic-Indic numerals (۰-۹ and ٠-٩). Use `Intl.NumberFormat` with the correct locale rather than hardcoding Western digits.
116
-
117
- ```javascript
118
- // ✅ Locale-aware digit formatting
119
- new Intl.NumberFormat('fa-IR').format(1234); // ۱٬۲۳۴
120
- new Intl.NumberFormat('ar-SA').format(1234); // ١٬٢٣٤
121
- ```
122
-
123
- - Respect calendar systems. Persian users expect the Solar Hijri (Jalali) calendar; many Arabic-speaking users expect the Hijri (Islamic) calendar. Use `Intl.DateTimeFormat` with the appropriate locale or calendar parameter.
124
-
125
- ```javascript
126
- // ✅ Locale-appropriate calendar
127
- new Intl.DateTimeFormat('fa-IR').format(new Date());
128
- new Intl.DateTimeFormat('ar-SA-u-ca-islamic').format(new Date());
129
- ```
130
-
131
- **Character set support**:
132
- - Use UTF-8 encoding everywhere
133
- - Test with Chinese/Japanese/Korean (CJK) characters
134
- - Test with emoji (they can be 2-4 bytes)
135
- - Handle different scripts (Latin, Cyrillic, Arabic, etc.)
136
-
137
- **Date/Time formatting**:
138
- ```javascript
139
- // ✅ Use Intl API for proper formatting
140
- new Intl.DateTimeFormat('en-US').format(date); // 1/15/2024
141
- new Intl.DateTimeFormat('de-DE').format(date); // 15.1.2024
142
-
143
- new Intl.NumberFormat('en-US', {
144
- style: 'currency',
145
- currency: 'USD'
146
- }).format(1234.56); // $1,234.56
147
- ```
148
-
149
- **Pluralization**:
150
- ```javascript
151
- // ❌ Bad: Assumes English pluralization
152
- `${count} item${count !== 1 ? 's' : ''}`
153
-
154
- // ✅ Good: Use proper i18n library
155
- t('items', { count }) // Handles complex plural rules
156
- ```
157
-
158
- ### Error Handling
159
-
160
- **Network errors**:
161
- - Show clear error messages
162
- - Provide retry button
163
- - Explain what happened
164
- - Offer offline mode (if applicable)
165
- - Handle timeout scenarios
166
-
167
- ```jsx
168
- // Error states with recovery
169
- {error && (
170
- <ErrorMessage>
171
- <p>Failed to load data. {error.message}</p>
172
- <button onClick={retry}>Try again</button>
173
- </ErrorMessage>
174
- )}
175
- ```
176
-
177
- **Form validation errors**:
178
- - Inline errors near fields
179
- - Clear, specific messages
180
- - Suggest corrections
181
- - Don't block submission unnecessarily
182
- - Preserve user input on error
183
-
184
- **API errors**:
185
- - Handle each status code appropriately
186
- - 400: Show validation errors
187
- - 401: Redirect to login
188
- - 403: Show permission error
189
- - 404: Show not found state
190
- - 429: Show rate limit message
191
- - 500: Show generic error, offer support
192
-
193
- **Graceful degradation**:
194
- - Core functionality works without JavaScript
195
- - Images have alt text
196
- - Progressive enhancement
197
- - Fallbacks for unsupported features
198
-
199
- ### Edge Cases & Boundary Conditions
200
-
201
- **Empty states**:
202
- - No items in list
203
- - No search results
204
- - No notifications
205
- - No data to display
206
- - Provide clear next action
207
-
208
- **Loading states**:
209
- - Initial load
210
- - Pagination load
211
- - Refresh
212
- - Show what's loading ("Loading your projects...")
213
- - Time estimates for long operations
214
-
215
- **Large datasets**:
216
- - Pagination or virtual scrolling
217
- - Search/filter capabilities
218
- - Performance optimization
219
- - Don't load all 10,000 items at once
220
-
221
- **Concurrent operations**:
222
- - Prevent double-submission (disable button while loading)
223
- - Handle race conditions
224
- - Optimistic updates with rollback
225
- - Conflict resolution
226
-
227
- **Interrupted gestures** (custom sliders, drag surfaces, scrollable control strips):
228
- - A second finger or pointer lands mid-drag: the first drag keeps its pointer or ends cleanly, never jumps to the new one
229
- - The browser cancels the gesture to scroll (`pointercancel`), capture is lost (`lostpointercapture`), the pointer is released outside the control, or the window loses focus (`blur`) mid-drag: clear the dragging state and release capture
230
- - After each of these, the next tap or drag works without a reload
231
-
232
- **Permission states**:
233
- - No permission to view
234
- - No permission to edit
235
- - Read-only mode
236
- - Clear explanation of why
237
-
238
- **Browser compatibility**:
239
- - Polyfills for modern features
240
- - Fallbacks for unsupported CSS
241
- - Feature detection (not browser detection)
242
- - Test in target browsers
243
-
244
- ### Input Validation & Sanitization
245
-
246
- **Client-side validation**:
247
- - Required fields
248
- - Format validation (email, phone, URL)
249
- - Length limits
250
- - Pattern matching
251
- - Custom validation rules
252
-
253
- **Server-side validation** (always):
254
- - Never trust client-side only
255
- - Validate and sanitize all inputs
256
- - Protect against injection attacks
257
- - Rate limiting
258
-
259
- **Constraint handling**:
260
- ```html
261
- <!-- Set clear constraints -->
262
- <input
263
- type="text"
264
- maxlength="100"
265
- pattern="[A-Za-z0-9]+"
266
- required
267
- aria-describedby="username-hint"
268
- />
269
- <small id="username-hint">
270
- Letters and numbers only, up to 100 characters
271
- </small>
272
- ```
273
-
274
- ### Accessibility Resilience
275
-
276
- **Keyboard navigation**:
277
- - All functionality accessible via keyboard
278
- - Logical tab order
279
- - Focus management in modals
280
- - Skip links for long content
281
-
282
- **Screen reader support**:
283
- - Proper ARIA labels
284
- - Announce dynamic changes (live regions)
285
- - Descriptive alt text
286
- - Semantic HTML
287
-
288
- **High contrast mode**:
289
- - Test in Windows high contrast mode
290
- - Don't rely only on color
291
- - Provide alternative visual cues
292
-
293
- ### Performance Resilience
294
-
295
- **Slow connections**:
296
- - Progressive image loading
297
- - Skeleton screens
298
- - Optimistic UI updates
299
- - Offline support (service workers)
300
-
301
- **Memory leaks**:
302
- - Clean up event listeners
303
- - Cancel subscriptions
304
- - Clear timers/intervals
305
- - Abort pending requests on unmount
306
-
307
- **Throttling & Debouncing**:
308
- ```javascript
309
- // Debounce search input
310
- const debouncedSearch = debounce(handleSearch, 300);
311
-
312
- // Throttle scroll handler
313
- const throttledScroll = throttle(handleScroll, 100);
314
- ```
315
-
316
- ## Testing Strategies
317
-
318
- **Manual testing**:
319
- - Test with extreme data (very long, very short, empty)
320
- - Test in different languages
321
- - Test offline
322
- - Test slow connection (throttle to 3G)
323
- - Test with screen reader
324
- - Test keyboard-only navigation
325
- - Test on old browsers
326
-
327
- **Automated testing**:
328
- - Unit tests for edge cases
329
- - Integration tests for error scenarios
330
- - E2E tests for critical paths
331
- - A behavioral regression for each confirmed gesture fix, when the project's test runner can drive input
332
- - Visual regression tests
333
- - Accessibility tests (axe, WAVE)
334
-
335
- **Avoid**:
336
- - Assume perfect input (validate everything)
337
- - Ignore internationalization (design for global)
338
- - Leave error messages generic ("Error occurred")
339
- - Forget offline scenarios
340
- - Trust client-side validation alone
341
- - Use fixed widths for text
342
- - Assume English-length text
343
- - Block entire interface when one component errors
344
-
345
- ## Verify Hardening
346
-
347
- Test thoroughly with edge cases:
348
-
349
- - **Long text**: Try names with 100+ characters
350
- - **Emoji**: Use emoji in all text fields
351
- - **RTL**: Test with Arabic or Hebrew
352
- - **CJK**: Test with Chinese/Japanese/Korean
353
- - **Network issues**: Disable internet, throttle connection
354
- - **Large datasets**: Test with 1000+ items
355
- - **Concurrent actions**: Click submit 10 times rapidly
356
- - **Interrupted gestures**: Add a second finger mid-drag, scroll across the control, release outside it, switch windows mid-drag; then drag again
357
- - **Errors**: Force API errors, test all error states
358
- - **Empty**: Remove all data, test empty states
359
-
360
- For gestures, say what produced the evidence (emulated viewport, synthesized touch, which engine, physical device) and name what stayed untested.
361
-
362
- When edge cases are covered, hand off to `/impeccable polish` for the final pass.
1
+ Designs that only work with perfect data aren't production-ready. Harden the interface against the inputs, errors, languages, and network conditions that real users will throw at it.
2
+
3
+ ## Assess Hardening Needs
4
+
5
+ Identify weaknesses and edge cases:
6
+
7
+ 1. **Test with extreme inputs**:
8
+ - Very long text (names, descriptions, titles)
9
+ - Very short text (empty, single character)
10
+ - Special characters (emoji, RTL text, accents)
11
+ - Large numbers (millions, billions)
12
+ - Many items (1000+ list items, 50+ options)
13
+ - No data (empty states)
14
+
15
+ 2. **Test error scenarios**:
16
+ - Network failures (offline, slow, timeout)
17
+ - API errors (400, 401, 403, 404, 500)
18
+ - Validation errors
19
+ - Permission errors
20
+ - Rate limiting
21
+ - Concurrent operations
22
+
23
+ 3. **Test internationalization**:
24
+ - Long translations (German is often 30% longer than English)
25
+ - RTL languages (Arabic, Hebrew)
26
+ - Character sets (Chinese, Japanese, Korean, emoji)
27
+ - Date/time formats
28
+ - Number formats (1,000 vs 1.000)
29
+ - Currency symbols
30
+
31
+ Designs that only work with perfect data aren't production-ready.
32
+
33
+ ## Hardening Dimensions
34
+
35
+ Systematically improve resilience:
36
+
37
+ ### Text Overflow & Wrapping
38
+
39
+ **Long text handling**:
40
+ ```css
41
+ /* Single line with ellipsis */
42
+ .truncate {
43
+ overflow: hidden;
44
+ text-overflow: ellipsis;
45
+ white-space: nowrap;
46
+ }
47
+
48
+ /* Multi-line with clamp */
49
+ .line-clamp {
50
+ display: -webkit-box;
51
+ -webkit-line-clamp: 3;
52
+ -webkit-box-orient: vertical;
53
+ overflow: hidden;
54
+ }
55
+
56
+ /* Allow wrapping */
57
+ .wrap {
58
+ word-wrap: break-word;
59
+ overflow-wrap: break-word;
60
+ hyphens: auto;
61
+ }
62
+ ```
63
+
64
+ **Flex/Grid overflow**:
65
+ ```css
66
+ /* Prevent flex items from overflowing */
67
+ .flex-item {
68
+ min-width: 0; /* Allow shrinking below content size */
69
+ overflow: hidden;
70
+ }
71
+
72
+ /* Prevent grid items from overflowing */
73
+ .grid-item {
74
+ min-width: 0;
75
+ min-height: 0;
76
+ }
77
+ ```
78
+
79
+ **Responsive text sizing**:
80
+ - Use `clamp()` for fluid typography
81
+ - Set minimum readable sizes (16px body on mobile, the same floor the typography guidance sets; 14px only for genuinely secondary text. iOS Safari force-zooms focused inputs under 16px, which breaks form layouts)
82
+ - Test text scaling (zoom to 200%)
83
+ - Ensure containers expand with text
84
+
85
+ ### Internationalization (i18n)
86
+
87
+ **Text expansion**:
88
+ - Add 30-40% space budget for translations
89
+ - Use flexbox/grid that adapts to content
90
+ - Test with longest language (usually German)
91
+ - Avoid fixed widths on text containers
92
+
93
+ ```jsx
94
+ // ❌ Bad: Assumes short English text
95
+ <button className="w-24">Submit</button>
96
+
97
+ // ✅ Good: Adapts to content
98
+ <button className="px-4 py-2">Submit</button>
99
+ ```
100
+
101
+ **RTL (Right-to-Left) support**:
102
+ ```css
103
+ /* Use logical properties */
104
+ margin-inline-start: 1rem; /* Not margin-left */
105
+ padding-inline: 1rem; /* Not padding-left/right */
106
+ border-inline-end: 1px solid; /* Not border-right */
107
+
108
+ /* Or use dir attribute */
109
+ [dir="rtl"] .arrow { transform: scaleX(-1); }
110
+ ```
111
+
112
+ **Arabic-script specifics** (Arabic, Persian, Urdu, Pashto, Kurdish):
113
+ - Preserve Zero-Width Non-Joiner (U+200C). Persian and Kurdish use ZWNJ between compound-word parts to break cursive joining while keeping the word together. A filter or sanitizer that strips it changes meaning. Never normalize it away.
114
+ - Handle Yeh and Kaf variants. Persian uses ی (U+06CC) and ک (U+06A9), while Arabic uses ي (U+064A) and ك (U+0643). Preserve the original form in storage. For search and validation, treat the corresponding letters as equivalent so that Arabic-keyboard input matches Persian text. Rejecting one variant locks out users whose keyboard sends the other.
115
+ - Support locale-aware digits. Persian (`fa-IR`) and Arabic locales use Eastern Arabic-Indic numerals (۰-۹ and ٠-٩). Use `Intl.NumberFormat` with the correct locale rather than hardcoding Western digits.
116
+
117
+ ```javascript
118
+ // ✅ Locale-aware digit formatting
119
+ new Intl.NumberFormat('fa-IR').format(1234); // ۱٬۲۳۴
120
+ new Intl.NumberFormat('ar-SA').format(1234); // ١٬٢٣٤
121
+ ```
122
+
123
+ - Respect calendar systems. Persian users expect the Solar Hijri (Jalali) calendar; many Arabic-speaking users expect the Hijri (Islamic) calendar. Use `Intl.DateTimeFormat` with the appropriate locale or calendar parameter.
124
+
125
+ ```javascript
126
+ // ✅ Locale-appropriate calendar
127
+ new Intl.DateTimeFormat('fa-IR').format(new Date());
128
+ new Intl.DateTimeFormat('ar-SA-u-ca-islamic').format(new Date());
129
+ ```
130
+
131
+ **Character set support**:
132
+ - Use UTF-8 encoding everywhere
133
+ - Test with Chinese/Japanese/Korean (CJK) characters
134
+ - Test with emoji (they can be 2-4 bytes)
135
+ - Handle different scripts (Latin, Cyrillic, Arabic, etc.)
136
+
137
+ **Date/Time formatting**:
138
+ ```javascript
139
+ // ✅ Use Intl API for proper formatting
140
+ new Intl.DateTimeFormat('en-US').format(date); // 1/15/2024
141
+ new Intl.DateTimeFormat('de-DE').format(date); // 15.1.2024
142
+
143
+ new Intl.NumberFormat('en-US', {
144
+ style: 'currency',
145
+ currency: 'USD'
146
+ }).format(1234.56); // $1,234.56
147
+ ```
148
+
149
+ **Pluralization**:
150
+ ```javascript
151
+ // ❌ Bad: Assumes English pluralization
152
+ `${count} item${count !== 1 ? 's' : ''}`
153
+
154
+ // ✅ Good: Use proper i18n library
155
+ t('items', { count }) // Handles complex plural rules
156
+ ```
157
+
158
+ ### Error Handling
159
+
160
+ **Network errors**:
161
+ - Show clear error messages
162
+ - Provide retry button
163
+ - Explain what happened
164
+ - Offer offline mode (if applicable)
165
+ - Handle timeout scenarios
166
+
167
+ ```jsx
168
+ // Error states with recovery
169
+ {error && (
170
+ <ErrorMessage>
171
+ <p>Failed to load data. {error.message}</p>
172
+ <button onClick={retry}>Try again</button>
173
+ </ErrorMessage>
174
+ )}
175
+ ```
176
+
177
+ **Form validation errors**:
178
+ - Inline errors near fields
179
+ - Clear, specific messages
180
+ - Suggest corrections
181
+ - Don't block submission unnecessarily
182
+ - Preserve user input on error
183
+
184
+ **API errors**:
185
+ - Handle each status code appropriately
186
+ - 400: Show validation errors
187
+ - 401: Redirect to login
188
+ - 403: Show permission error
189
+ - 404: Show not found state
190
+ - 429: Show rate limit message
191
+ - 500: Show generic error, offer support
192
+
193
+ **Graceful degradation**:
194
+ - Core functionality works without JavaScript
195
+ - Images have alt text
196
+ - Progressive enhancement
197
+ - Fallbacks for unsupported features
198
+
199
+ ### Edge Cases & Boundary Conditions
200
+
201
+ **Empty states**:
202
+ - No items in list
203
+ - No search results
204
+ - No notifications
205
+ - No data to display
206
+ - Provide clear next action
207
+
208
+ **Loading states**:
209
+ - Initial load
210
+ - Pagination load
211
+ - Refresh
212
+ - Show what's loading ("Loading your projects...")
213
+ - Time estimates for long operations
214
+
215
+ **Large datasets**:
216
+ - Pagination or virtual scrolling
217
+ - Search/filter capabilities
218
+ - Performance optimization
219
+ - Don't load all 10,000 items at once
220
+
221
+ **Concurrent operations**:
222
+ - Prevent double-submission (disable button while loading)
223
+ - Handle race conditions
224
+ - Optimistic updates with rollback
225
+ - Conflict resolution
226
+
227
+ **Interrupted gestures** (custom sliders, drag surfaces, scrollable control strips):
228
+ - A second finger or pointer lands mid-drag: the first drag keeps its pointer or ends cleanly, never jumps to the new one
229
+ - The browser cancels the gesture to scroll (`pointercancel`), capture is lost (`lostpointercapture`), the pointer is released outside the control, or the window loses focus (`blur`) mid-drag: clear the dragging state and release capture
230
+ - After each of these, the next tap or drag works without a reload
231
+
232
+ **Permission states**:
233
+ - No permission to view
234
+ - No permission to edit
235
+ - Read-only mode
236
+ - Clear explanation of why
237
+
238
+ **Browser compatibility**:
239
+ - Polyfills for modern features
240
+ - Fallbacks for unsupported CSS
241
+ - Feature detection (not browser detection)
242
+ - Test in target browsers
243
+
244
+ ### Input Validation & Sanitization
245
+
246
+ **Client-side validation**:
247
+ - Required fields
248
+ - Format validation (email, phone, URL)
249
+ - Length limits
250
+ - Pattern matching
251
+ - Custom validation rules
252
+
253
+ **Server-side validation** (always):
254
+ - Never trust client-side only
255
+ - Validate and sanitize all inputs
256
+ - Protect against injection attacks
257
+ - Rate limiting
258
+
259
+ **Constraint handling**:
260
+ ```html
261
+ <!-- Set clear constraints -->
262
+ <input
263
+ type="text"
264
+ maxlength="100"
265
+ pattern="[A-Za-z0-9]+"
266
+ required
267
+ aria-describedby="username-hint"
268
+ />
269
+ <small id="username-hint">
270
+ Letters and numbers only, up to 100 characters
271
+ </small>
272
+ ```
273
+
274
+ ### Accessibility Resilience
275
+
276
+ **Keyboard navigation**:
277
+ - All functionality accessible via keyboard
278
+ - Logical tab order
279
+ - Focus management in modals
280
+ - Skip links for long content
281
+
282
+ **Screen reader support**:
283
+ - Proper ARIA labels
284
+ - Announce dynamic changes (live regions)
285
+ - Descriptive alt text
286
+ - Semantic HTML
287
+
288
+ **High contrast mode**:
289
+ - Test in Windows high contrast mode
290
+ - Don't rely only on color
291
+ - Provide alternative visual cues
292
+
293
+ ### Performance Resilience
294
+
295
+ **Slow connections**:
296
+ - Progressive image loading
297
+ - Skeleton screens
298
+ - Optimistic UI updates
299
+ - Offline support (service workers)
300
+
301
+ **Memory leaks**:
302
+ - Clean up event listeners
303
+ - Cancel subscriptions
304
+ - Clear timers/intervals
305
+ - Abort pending requests on unmount
306
+
307
+ **Throttling & Debouncing**:
308
+ ```javascript
309
+ // Debounce search input
310
+ const debouncedSearch = debounce(handleSearch, 300);
311
+
312
+ // Throttle scroll handler
313
+ const throttledScroll = throttle(handleScroll, 100);
314
+ ```
315
+
316
+ ## Testing Strategies
317
+
318
+ **Manual testing**:
319
+ - Test with extreme data (very long, very short, empty)
320
+ - Test in different languages
321
+ - Test offline
322
+ - Test slow connection (throttle to 3G)
323
+ - Test with screen reader
324
+ - Test keyboard-only navigation
325
+ - Test on old browsers
326
+
327
+ **Automated testing**:
328
+ - Unit tests for edge cases
329
+ - Integration tests for error scenarios
330
+ - E2E tests for critical paths
331
+ - A behavioral regression for each confirmed gesture fix, when the project's test runner can drive input
332
+ - Visual regression tests
333
+ - Accessibility tests (axe, WAVE)
334
+
335
+ **Avoid**:
336
+ - Assume perfect input (validate everything)
337
+ - Ignore internationalization (design for global)
338
+ - Leave error messages generic ("Error occurred")
339
+ - Forget offline scenarios
340
+ - Trust client-side validation alone
341
+ - Use fixed widths for text
342
+ - Assume English-length text
343
+ - Block entire interface when one component errors
344
+
345
+ ## Verify Hardening
346
+
347
+ Test thoroughly with edge cases:
348
+
349
+ - **Long text**: Try names with 100+ characters
350
+ - **Emoji**: Use emoji in all text fields
351
+ - **RTL**: Test with Arabic or Hebrew
352
+ - **CJK**: Test with Chinese/Japanese/Korean
353
+ - **Network issues**: Disable internet, throttle connection
354
+ - **Large datasets**: Test with 1000+ items
355
+ - **Concurrent actions**: Click submit 10 times rapidly
356
+ - **Interrupted gestures**: Add a second finger mid-drag, scroll across the control, release outside it, switch windows mid-drag; then drag again
357
+ - **Errors**: Force API errors, test all error states
358
+ - **Empty**: Remove all data, test empty states
359
+
360
+ For gestures, say what produced the evidence (emulated viewport, synthesized touch, which engine, physical device) and name what stayed untested.
361
+
362
+ When edge cases are covered, hand off to `/impeccable polish` for the final pass.