@thanhnguyxn/pixelcraft 0.0.0-stage → 0.1.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 (297) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/.claude-plugin/marketplace.json +20 -0
  3. package/.claude-plugin/plugin.json +11 -0
  4. package/LICENSE +21 -0
  5. package/README.md +407 -2
  6. package/assets/README.md +28 -0
  7. package/assets/pixelcraft-logo-512.png +0 -0
  8. package/bin/pixelcraft.mjs +444 -0
  9. package/docs/ARCHITECTURE.md +102 -0
  10. package/docs/DESIGN-RATIONALE.md +143 -0
  11. package/evals/README.md +27 -0
  12. package/evals/fixtures/README.md +36 -0
  13. package/evals/fixtures/direction-prototype-complexity.json +29 -0
  14. package/evals/fixtures/finish-gate-anti-slop.json +30 -0
  15. package/evals/fixtures/forms-accessibility-negative.json +29 -0
  16. package/evals/fixtures/handoff-fidelity-tolerance.json +29 -0
  17. package/evals/fixtures/plan-brownfield-evidence.json +28 -0
  18. package/evals/fixtures/visual-qa-task-evidence.json +29 -0
  19. package/evals/fixtures/workflow-checkpoints.json +30 -0
  20. package/evals/pixelcraft-accessibility.md +57 -0
  21. package/evals/pixelcraft-brandkit.md +58 -0
  22. package/evals/pixelcraft-chat-ui.md +55 -0
  23. package/evals/pixelcraft-constrained.md +55 -0
  24. package/evals/pixelcraft-craft.md +60 -0
  25. package/evals/pixelcraft-data-apps.md +55 -0
  26. package/evals/pixelcraft-dataviz.md +59 -0
  27. package/evals/pixelcraft-desktop.md +55 -0
  28. package/evals/pixelcraft-direction.md +60 -0
  29. package/evals/pixelcraft-document.md +55 -0
  30. package/evals/pixelcraft-email.md +55 -0
  31. package/evals/pixelcraft-extensions.md +55 -0
  32. package/evals/pixelcraft-game-ui.md +59 -0
  33. package/evals/pixelcraft-handoff.md +57 -0
  34. package/evals/pixelcraft-media.md +55 -0
  35. package/evals/pixelcraft-mobile.md +59 -0
  36. package/evals/pixelcraft-patterns.md +57 -0
  37. package/evals/pixelcraft-plan.md +65 -0
  38. package/evals/pixelcraft-review.md +63 -0
  39. package/evals/pixelcraft-spatial.md +55 -0
  40. package/evals/pixelcraft-tokens.md +57 -0
  41. package/evals/pixelcraft-tui.md +55 -0
  42. package/evals/pixelcraft-ux.md +59 -0
  43. package/evals/pixelcraft-visual-qa.md +80 -0
  44. package/evals/pixelcraft-web.md +71 -0
  45. package/evals/pixelcraft.md +70 -0
  46. package/gemini-extension.json +5 -0
  47. package/install.ps1 +295 -0
  48. package/install.sh +437 -0
  49. package/package.json +63 -4
  50. package/plugin.json +24 -0
  51. package/scripts/build-adapters.mjs +290 -0
  52. package/scripts/build-release-archives.mjs +61 -0
  53. package/scripts/build-skill-zips.mjs +94 -0
  54. package/scripts/test-build-adapters.mjs +48 -0
  55. package/scripts/test-distribution.mjs +124 -0
  56. package/scripts/test-export-tokens.mjs +105 -0
  57. package/scripts/test-finish-gate.mjs +148 -0
  58. package/scripts/test-installers.mjs +67 -0
  59. package/scripts/test-release-archives.mjs +42 -0
  60. package/scripts/test-shoot.mjs +65 -0
  61. package/scripts/test-slop-scan.mjs +29 -0
  62. package/scripts/test-style-inventory.mjs +211 -0
  63. package/scripts/test-validate-skills.mjs +117 -0
  64. package/scripts/validate-skills.mjs +512 -0
  65. package/skills/pixelcraft/SKILL.md +135 -0
  66. package/skills/pixelcraft/references/design-brief.md +75 -0
  67. package/skills/pixelcraft/references/floor.md +73 -0
  68. package/skills/pixelcraft/references/report-template.md +35 -0
  69. package/skills/pixelcraft/references/stack-detection.md +155 -0
  70. package/skills/pixelcraft/references/surface-acceptance.md +40 -0
  71. package/skills/pixelcraft/references/workflow-checkpoints.md +29 -0
  72. package/skills/pixelcraft-accessibility/SKILL.md +33 -0
  73. package/skills/pixelcraft-accessibility/references/apg-patterns.md +51 -0
  74. package/skills/pixelcraft-accessibility/references/platforms.md +58 -0
  75. package/skills/pixelcraft-accessibility/references/verification.md +59 -0
  76. package/skills/pixelcraft-accessibility/references/wcag22-checks.md +66 -0
  77. package/skills/pixelcraft-brandkit/SKILL.md +115 -0
  78. package/skills/pixelcraft-brandkit/references/asset-pipeline.md +125 -0
  79. package/skills/pixelcraft-brandkit/references/brand-governance.md +80 -0
  80. package/skills/pixelcraft-brandkit/references/layouts.md +88 -0
  81. package/skills/pixelcraft-brandkit/references/logo-concepting.md +83 -0
  82. package/skills/pixelcraft-brandkit/references/logo-methods.md +98 -0
  83. package/skills/pixelcraft-brandkit/references/pixel-art-logos.md +82 -0
  84. package/skills/pixelcraft-brandkit/references/prompt-template.md +85 -0
  85. package/skills/pixelcraft-brandkit/references/qa-checklist.md +88 -0
  86. package/skills/pixelcraft-brandkit/references/visual-modes.md +123 -0
  87. package/skills/pixelcraft-chat-ui/SKILL.md +53 -0
  88. package/skills/pixelcraft-chat-ui/references/conversation-design.md +78 -0
  89. package/skills/pixelcraft-chat-ui/references/mobile-business-platforms.md +87 -0
  90. package/skills/pixelcraft-chat-ui/references/slack-discord.md +96 -0
  91. package/skills/pixelcraft-constrained/SKILL.md +51 -0
  92. package/skills/pixelcraft-constrained/references/specialized-hardware.md +66 -0
  93. package/skills/pixelcraft-constrained/references/tv-wearables.md +84 -0
  94. package/skills/pixelcraft-constrained/references/voice-ui.md +63 -0
  95. package/skills/pixelcraft-craft/SKILL.md +44 -0
  96. package/skills/pixelcraft-craft/references/color.md +69 -0
  97. package/skills/pixelcraft-craft/references/imagery-icons.md +37 -0
  98. package/skills/pixelcraft-craft/references/layout-quality.md +65 -0
  99. package/skills/pixelcraft-craft/references/layout.md +41 -0
  100. package/skills/pixelcraft-craft/references/motion.md +76 -0
  101. package/skills/pixelcraft-craft/references/typography.md +71 -0
  102. package/skills/pixelcraft-data-apps/SKILL.md +67 -0
  103. package/skills/pixelcraft-data-apps/references/dash.md +53 -0
  104. package/skills/pixelcraft-data-apps/references/evidence.md +75 -0
  105. package/skills/pixelcraft-data-apps/references/gradio.md +65 -0
  106. package/skills/pixelcraft-data-apps/references/julia-genie.md +54 -0
  107. package/skills/pixelcraft-data-apps/references/jupyter-widgets.md +53 -0
  108. package/skills/pixelcraft-data-apps/references/nicegui.md +63 -0
  109. package/skills/pixelcraft-data-apps/references/observable-framework.md +67 -0
  110. package/skills/pixelcraft-data-apps/references/panel.md +53 -0
  111. package/skills/pixelcraft-data-apps/references/r-shiny.md +54 -0
  112. package/skills/pixelcraft-data-apps/references/reflex.md +62 -0
  113. package/skills/pixelcraft-data-apps/references/shiny.md +53 -0
  114. package/skills/pixelcraft-data-apps/references/streamlit.md +65 -0
  115. package/skills/pixelcraft-dataviz/SKILL.md +63 -0
  116. package/skills/pixelcraft-dataviz/references/chart-choice.md +55 -0
  117. package/skills/pixelcraft-dataviz/references/color-accessibility.md +112 -0
  118. package/skills/pixelcraft-dataviz/references/encoding-tables-dashboards.md +97 -0
  119. package/skills/pixelcraft-dataviz/references/libraries.md +57 -0
  120. package/skills/pixelcraft-dataviz/references/realtime-graphs-maps-scale.md +99 -0
  121. package/skills/pixelcraft-desktop/SKILL.md +71 -0
  122. package/skills/pixelcraft-desktop/references/appkit.md +58 -0
  123. package/skills/pixelcraft-desktop/references/avalonia.md +59 -0
  124. package/skills/pixelcraft-desktop/references/cpp-gui.md +52 -0
  125. package/skills/pixelcraft-desktop/references/electron.md +54 -0
  126. package/skills/pixelcraft-desktop/references/go-gui.md +54 -0
  127. package/skills/pixelcraft-desktop/references/gtk.md +54 -0
  128. package/skills/pixelcraft-desktop/references/javafx-swing.md +52 -0
  129. package/skills/pixelcraft-desktop/references/qt-pyside-qml.md +61 -0
  130. package/skills/pixelcraft-desktop/references/rust-gui.md +65 -0
  131. package/skills/pixelcraft-desktop/references/tauri.md +54 -0
  132. package/skills/pixelcraft-desktop/references/uno-platform.md +52 -0
  133. package/skills/pixelcraft-desktop/references/winui-wpf.md +58 -0
  134. package/skills/pixelcraft-desktop/references/working-context.md +5 -0
  135. package/skills/pixelcraft-direction/SKILL.md +154 -0
  136. package/skills/pixelcraft-direction/references/composition-library.md +84 -0
  137. package/skills/pixelcraft-direction/references/direction-card.md +54 -0
  138. package/skills/pixelcraft-direction/references/direction-scoring.md +72 -0
  139. package/skills/pixelcraft-direction/references/movements.md +68 -0
  140. package/skills/pixelcraft-direction/references/repetition-history.md +75 -0
  141. package/skills/pixelcraft-direction/references/slop-fingerprints.md +58 -0
  142. package/skills/pixelcraft-direction/references/wildcards.md +47 -0
  143. package/skills/pixelcraft-document/SKILL.md +54 -0
  144. package/skills/pixelcraft-document/references/archetypes.md +83 -0
  145. package/skills/pixelcraft-document/references/pdf-tools.md +154 -0
  146. package/skills/pixelcraft-document/references/print-css.md +134 -0
  147. package/skills/pixelcraft-document/references/slides.md +102 -0
  148. package/skills/pixelcraft-email/SKILL.md +58 -0
  149. package/skills/pixelcraft-email/references/client-quirks.md +45 -0
  150. package/skills/pixelcraft-email/references/html-tables.md +53 -0
  151. package/skills/pixelcraft-email/references/mjml.md +52 -0
  152. package/skills/pixelcraft-email/references/react-email.md +53 -0
  153. package/skills/pixelcraft-extensions/SKILL.md +51 -0
  154. package/skills/pixelcraft-extensions/references/browser-extensions.md +31 -0
  155. package/skills/pixelcraft-extensions/references/figma-office.md +23 -0
  156. package/skills/pixelcraft-extensions/references/raycast.md +19 -0
  157. package/skills/pixelcraft-extensions/references/vscode-webviews.md +26 -0
  158. package/skills/pixelcraft-game-ui/SKILL.md +61 -0
  159. package/skills/pixelcraft-game-ui/references/bevy.md +52 -0
  160. package/skills/pixelcraft-game-ui/references/godot.md +57 -0
  161. package/skills/pixelcraft-game-ui/references/hud-principles.md +38 -0
  162. package/skills/pixelcraft-game-ui/references/love2d.md +51 -0
  163. package/skills/pixelcraft-game-ui/references/monogame.md +52 -0
  164. package/skills/pixelcraft-game-ui/references/unity-ui-toolkit.md +65 -0
  165. package/skills/pixelcraft-game-ui/references/unreal-umg.md +53 -0
  166. package/skills/pixelcraft-handoff/SKILL.md +49 -0
  167. package/skills/pixelcraft-handoff/references/design-translation.md +104 -0
  168. package/skills/pixelcraft-handoff/references/fidelity-tolerance.md +78 -0
  169. package/skills/pixelcraft-media/SKILL.md +52 -0
  170. package/skills/pixelcraft-media/references/banners-video.md +112 -0
  171. package/skills/pixelcraft-media/references/og-generation.md +107 -0
  172. package/skills/pixelcraft-media/references/social-cards.md +72 -0
  173. package/skills/pixelcraft-mobile/SKILL.md +69 -0
  174. package/skills/pixelcraft-mobile/references/dotnet-maui.md +63 -0
  175. package/skills/pixelcraft-mobile/references/flet.md +53 -0
  176. package/skills/pixelcraft-mobile/references/flutter.md +69 -0
  177. package/skills/pixelcraft-mobile/references/ionic-capacitor.md +65 -0
  178. package/skills/pixelcraft-mobile/references/jetpack-compose.md +61 -0
  179. package/skills/pixelcraft-mobile/references/kivy.md +59 -0
  180. package/skills/pixelcraft-mobile/references/kotlin-multiplatform.md +60 -0
  181. package/skills/pixelcraft-mobile/references/react-native-expo.md +71 -0
  182. package/skills/pixelcraft-mobile/references/swiftui.md +70 -0
  183. package/skills/pixelcraft-mobile/references/task-state-composition.md +5 -0
  184. package/skills/pixelcraft-mobile/references/uikit.md +58 -0
  185. package/skills/pixelcraft-patterns/SKILL.md +58 -0
  186. package/skills/pixelcraft-patterns/references/auth-onboarding.md +25 -0
  187. package/skills/pixelcraft-patterns/references/commerce.md +28 -0
  188. package/skills/pixelcraft-patterns/references/communication.md +26 -0
  189. package/skills/pixelcraft-patterns/references/creative-tools.md +29 -0
  190. package/skills/pixelcraft-patterns/references/dashboard-admin.md +31 -0
  191. package/skills/pixelcraft-patterns/references/marketing.md +32 -0
  192. package/skills/pixelcraft-patterns/references/pattern-selection.md +74 -0
  193. package/skills/pixelcraft-patterns/references/search-filtering.md +42 -0
  194. package/skills/pixelcraft-patterns/references/settings.md +23 -0
  195. package/skills/pixelcraft-patterns/references/tables-crud.md +43 -0
  196. package/skills/pixelcraft-plan/SKILL.md +67 -0
  197. package/skills/pixelcraft-plan/references/design-input.md +69 -0
  198. package/skills/pixelcraft-plan/references/plan-template.md +99 -0
  199. package/skills/pixelcraft-plan/references/repo-discovery.md +42 -0
  200. package/skills/pixelcraft-plan/references/stack-freshness.md +50 -0
  201. package/skills/pixelcraft-plan/references/stack-selection.md +42 -0
  202. package/skills/pixelcraft-review/SKILL.md +64 -0
  203. package/skills/pixelcraft-review/references/audit-report.md +50 -0
  204. package/skills/pixelcraft-review/references/critique-protocol.md +89 -0
  205. package/skills/pixelcraft-review/references/heuristics.md +18 -0
  206. package/skills/pixelcraft-review/references/personas.md +26 -0
  207. package/skills/pixelcraft-review/references/polish.md +38 -0
  208. package/skills/pixelcraft-review/scripts/fixtures/brand-critique-waivers.json +14 -0
  209. package/skills/pixelcraft-review/scripts/fixtures/brand-critique.css +18 -0
  210. package/skills/pixelcraft-review/scripts/fixtures/clean.html +43 -0
  211. package/skills/pixelcraft-review/scripts/fixtures/focus-after-block.css +4 -0
  212. package/skills/pixelcraft-review/scripts/fixtures/focus-at-rules.css +17 -0
  213. package/skills/pixelcraft-review/scripts/fixtures/focus-comments.css +10 -0
  214. package/skills/pixelcraft-review/scripts/fixtures/focus-html-quote-leak.html +12 -0
  215. package/skills/pixelcraft-review/scripts/fixtures/focus-invalid-replacements.css +27 -0
  216. package/skills/pixelcraft-review/scripts/fixtures/focus-nested-rules.css +19 -0
  217. package/skills/pixelcraft-review/scripts/fixtures/focus-not-visible-skip.css +8 -0
  218. package/skills/pixelcraft-review/scripts/fixtures/focus-outline-shorthands.css +11 -0
  219. package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-and-border.css +15 -0
  220. package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-last-wins.css +19 -0
  221. package/skills/pixelcraft-review/scripts/fixtures/focus-valid-replacements-extended.css +29 -0
  222. package/skills/pixelcraft-review/scripts/fixtures/focus-visible-no-replacement.css +3 -0
  223. package/skills/pixelcraft-review/scripts/fixtures/focus-visible-valid-replacements.css +9 -0
  224. package/skills/pixelcraft-review/scripts/fixtures/slop.html +28 -0
  225. package/skills/pixelcraft-review/scripts/slop-scan.mjs +586 -0
  226. package/skills/pixelcraft-spatial/SKILL.md +52 -0
  227. package/skills/pixelcraft-spatial/references/comfort-accessibility.md +98 -0
  228. package/skills/pixelcraft-spatial/references/platforms.md +77 -0
  229. package/skills/pixelcraft-tokens/SKILL.md +56 -0
  230. package/skills/pixelcraft-tokens/assets/tokens.example.json +71 -0
  231. package/skills/pixelcraft-tokens/assets/tokens.modes.example.json +47 -0
  232. package/skills/pixelcraft-tokens/references/adoption.md +55 -0
  233. package/skills/pixelcraft-tokens/references/format.md +54 -0
  234. package/skills/pixelcraft-tokens/references/governance.md +80 -0
  235. package/skills/pixelcraft-tokens/references/state-tokens.md +62 -0
  236. package/skills/pixelcraft-tokens/references/theme-presets.md +94 -0
  237. package/skills/pixelcraft-tokens/scripts/export-tokens.mjs +285 -0
  238. package/skills/pixelcraft-tui/SKILL.md +60 -0
  239. package/skills/pixelcraft-tui/references/bubbletea-lipgloss.md +60 -0
  240. package/skills/pixelcraft-tui/references/ink.md +60 -0
  241. package/skills/pixelcraft-tui/references/ratatui.md +62 -0
  242. package/skills/pixelcraft-tui/references/rich.md +62 -0
  243. package/skills/pixelcraft-tui/references/textual.md +67 -0
  244. package/skills/pixelcraft-ux/SKILL.md +46 -0
  245. package/skills/pixelcraft-ux/references/cognitive-walkthrough.md +70 -0
  246. package/skills/pixelcraft-ux/references/feedback-performance.md +30 -0
  247. package/skills/pixelcraft-ux/references/flows-ia.md +44 -0
  248. package/skills/pixelcraft-ux/references/forms.md +97 -0
  249. package/skills/pixelcraft-ux/references/i18n.md +183 -0
  250. package/skills/pixelcraft-ux/references/laws.md +18 -0
  251. package/skills/pixelcraft-ux/references/locale-test-matrix.md +60 -0
  252. package/skills/pixelcraft-ux/references/state-matrix.md +39 -0
  253. package/skills/pixelcraft-ux/references/usability-testing.md +84 -0
  254. package/skills/pixelcraft-ux/references/ux-writing.md +43 -0
  255. package/skills/pixelcraft-visual-qa/SKILL.md +82 -0
  256. package/skills/pixelcraft-visual-qa/references/baseline-governance.md +70 -0
  257. package/skills/pixelcraft-visual-qa/references/capture-desktop-game.md +38 -0
  258. package/skills/pixelcraft-visual-qa/references/capture-email.md +34 -0
  259. package/skills/pixelcraft-visual-qa/references/capture-mobile.md +35 -0
  260. package/skills/pixelcraft-visual-qa/references/capture-terminal.md +31 -0
  261. package/skills/pixelcraft-visual-qa/references/critique-rubric.md +71 -0
  262. package/skills/pixelcraft-visual-qa/references/finish-gate.md +35 -0
  263. package/skills/pixelcraft-visual-qa/references/measured-craft.md +30 -0
  264. package/skills/pixelcraft-visual-qa/references/performance-budgets.md +65 -0
  265. package/skills/pixelcraft-visual-qa/references/task-verification.md +81 -0
  266. package/skills/pixelcraft-visual-qa/scripts/finish-gate.mjs +135 -0
  267. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-aria-modal.html +19 -0
  268. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-audit.html +34 -0
  269. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-modal.html +17 -0
  270. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-deferred.js +1 -0
  271. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-edge.html +52 -0
  272. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.html +80 -0
  273. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.js +8 -0
  274. package/skills/pixelcraft-visual-qa/scripts/shoot.mjs +513 -0
  275. package/skills/pixelcraft-visual-qa/scripts/style-inventory.mjs +1154 -0
  276. package/skills/pixelcraft-web/SKILL.md +76 -0
  277. package/skills/pixelcraft-web/references/adaptive-layout.md +25 -0
  278. package/skills/pixelcraft-web/references/angular.md +61 -0
  279. package/skills/pixelcraft-web/references/astro.md +62 -0
  280. package/skills/pixelcraft-web/references/clojurescript.md +53 -0
  281. package/skills/pixelcraft-web/references/elm.md +53 -0
  282. package/skills/pixelcraft-web/references/fsharp-fable.md +53 -0
  283. package/skills/pixelcraft-web/references/html-css.md +88 -0
  284. package/skills/pixelcraft-web/references/htmx-alpine.md +53 -0
  285. package/skills/pixelcraft-web/references/java-web.md +52 -0
  286. package/skills/pixelcraft-web/references/kotlin-web.md +53 -0
  287. package/skills/pixelcraft-web/references/leptos-yew.md +54 -0
  288. package/skills/pixelcraft-web/references/lit-web-components.md +61 -0
  289. package/skills/pixelcraft-web/references/pwa.md +225 -0
  290. package/skills/pixelcraft-web/references/qwik.md +54 -0
  291. package/skills/pixelcraft-web/references/react-next.md +69 -0
  292. package/skills/pixelcraft-web/references/scala-laminar.md +53 -0
  293. package/skills/pixelcraft-web/references/server-rendered.md +71 -0
  294. package/skills/pixelcraft-web/references/solid.md +60 -0
  295. package/skills/pixelcraft-web/references/svelte.md +61 -0
  296. package/skills/pixelcraft-web/references/tailwind.md +73 -0
  297. package/skills/pixelcraft-web/references/vue-nuxt.md +62 -0
@@ -0,0 +1,98 @@
1
+ # XR comfort, ergonomics, and accessibility
2
+
3
+ ## Locomotion and frame-rate comfort
4
+
5
+ Motion sickness usually comes from sensory conflict: visual motion without matching vestibular motion, unexpected camera acceleration/rotation, latency, or unstable frames.
6
+
7
+ Rules:
8
+
9
+ - never move/rotate/tilt the camera involuntarily for cutscenes, transitions, impacts, or UI emphasis;
10
+ - prefer physical movement or teleport for high-comfort defaults;
11
+ - offer snap turn and smooth turn as explicit settings; do not decide one is universally correct;
12
+ - use acceleration sparingly; constant velocity is usually easier than rubbery acceleration;
13
+ - use tunneling/vignette during artificial locomotion, configurable in angular size/feather/color where supported;
14
+ - avoid forced bobbing/head shake/peripheral motion particles;
15
+ - maintain orientation landmarks and provide recentering/pause/exit at all times;
16
+ - preserve user control during loading/network stalls.
17
+
18
+ There is no universal “correct FPS” across devices. The hard rule is to meet the target headset/runtime frame rate with worst-case scenes and thermal state. Design scenes with measured headroom rather than average frame rate; frame-time spikes matter. Test density, lighting/shadows, transparency/overdraw, postprocessing, physics, GC churn, asset streaming, and both eyes.
19
+
20
+ ## Ergonomic distances, field of view, and angular sizing
21
+
22
+ These are working spatial-design heuristics, not regulatory constants. Validate target headset optics/body size/app scale. Use angular measures because physical pixel size at one distance is meaningless in XR.
23
+
24
+ Angular conversion:
25
+
26
+ ```text
27
+ physical size ≈ 2 × distance × tan(angle / 2)
28
+ ```
29
+
30
+ At 1 meter, a 0.5° object is about 8.7 mm tall and a 1° object about 17.5 mm tall. At 2 meters those values double.
31
+
32
+ Practical starting envelope:
33
+
34
+ | Concern | Initial heuristic |
35
+ |---|---|
36
+ | frequent direct interaction | roughly 0.5–1.5 m from user, within reachable/comfortable arm/torso posture |
37
+ | primary read/watch content | roughly 1–3 m depending scale/session; avoid forcing prolonged neck flexion |
38
+ | near boundary | be cautious below ~0.5 m because stereo convergence/focus and physical collision discomfort increase |
39
+ | frequent attention zone | around eye height within approximately ±15° vertical/horizontal of neutral forward gaze |
40
+ | secondary scan zone | up to roughly ±30°, not dense permanent controls |
41
+ | periphery | ambient/wayfinding only; no critical persistent text or tiny targets |
42
+ | critical short text | start around 0.5° visual angle or larger and validate in headset |
43
+ | ordinary readable body text | often needs ~0.7–1°+ depending duration/contrast/typeface/user |
44
+ | minimum target visual size | start around 1–1.5° plus input-error tolerance; increase for gaze/hand/controller imprecision |
45
+
46
+ Do not copy phone point sizes into 3D. Compute physical size from intended distance using the formula above. Validate seated/standing heights, wheelchair reach, shorter/taller users, and recentering behavior.
47
+
48
+ ## Depth and layering
49
+
50
+ Depth should encode spatial meaning:
51
+
52
+ - near objects invite direct manipulation;
53
+ - mid-distance surfaces support reading/selection;
54
+ - distant content supports scale/context/ambience;
55
+ - foreground occlusion must never hide critical controls unexpectedly;
56
+ - shadows/contact cues/lighting establish grounding better than arbitrary float height;
57
+ - parallax is evidence of depth—test while moving, not only from a fixed camera screenshot.
58
+
59
+ Avoid z-fighting, intersecting panels, clipping through walls/users, duplicate curved screens at slightly different depths, and eye-level content that blocks passthrough/safety awareness. In mixed reality, respect real surfaces/occlusion rather than treating the room as empty.
60
+
61
+ ## Gaze-and-pinch input and privacy
62
+
63
+ Gaze direction, dwell time, hand/body pose, room scans, passthrough imagery, voice, and behavioral biometrics are sensitive even when no raw camera frame is stored.
64
+
65
+ Rules:
66
+
67
+ - prefer system-mediated hover/selection feedback;
68
+ - collect the minimum spatial/eye/hand telemetry necessary and define retention;
69
+ - do not use covert dwell/attention scoring for manipulation or advertising;
70
+ - explain permission purpose in plain language before system prompts;
71
+ - provide controller/indirect/touch alternatives where gaze/hand tracking is unavailable or denied;
72
+ - never require precise pinch/rapid gestures as the only completion path.
73
+
74
+ Input feedback sequence: target/hover → confirmation of acquisition → manipulation/state change → release/commit. Missing intermediate feedback makes spatial controls feel unreliable.
75
+
76
+ ## Text legibility in XR
77
+
78
+ - use high contrast, sturdy weight, generous line spacing, and controlled measure;
79
+ - avoid thin/light fonts, subpixel-dependent detail, dense tables, and long paragraphs;
80
+ - keep text surfaces perpendicular enough to view direction or provide billboard/reorientation behavior deliberately;
81
+ - account for chromatic aberration at lens edges, mura/compression, passthrough lighting, and accommodation distance;
82
+ - localize expansion/CJK/RTL/Indic scripts and test glyph rasterization at physical scale;
83
+ - use semantic UI/text objects rather than baking critical text into textures where possible.
84
+
85
+ ## Accessibility in XR
86
+
87
+ Provide meaningful alternatives rather than declaring XR inherently exempt:
88
+
89
+ - seated mode, height scaling, recentering, one-handed mode, controller-only mode;
90
+ - captions/subtitles and visual alerts for spatial audio cues;
91
+ - audio/haptic cues for visual state and visual cues for audio/haptic state;
92
+ - adjustable text scale/contrast/brightness and color-independent encoding;
93
+ - reduced motion/comfort presets and locomotion speed/turn-angle controls;
94
+ - remappable input and dwell/activation alternatives;
95
+ - screen reader/voice access where platform supports it, semantic object labels otherwise;
96
+ - safe exit/pause accessible without precise gesture or visual search.
97
+
98
+ Test with real target users/devices where possible. Simulator compliance checklists do not capture fatigue, nausea, reach, tracking failure, or sensory overload.
@@ -0,0 +1,77 @@
1
+ # XR platform notes
2
+
3
+ ## visionOS
4
+
5
+ Core surface model:
6
+
7
+ | Surface | Use |
8
+ |---|---|
9
+ | window | ordinary 2D UI floating in Shared Space; resize/adaptation are standard expectations |
10
+ | volume | bounded 3D content people can view from multiple angles without taking over the whole space |
11
+ | immersive space | content controls the scene; use when presence/world interaction is the point, not for ordinary forms |
12
+
13
+ Apple guidance warns that supplemental content generally belongs in an adjacent window rather than ornaments. Use ornaments for controls/tooling closely tied to a window, keep them reachable at resize extremes, and avoid duplicate navigation chrome. Use system glass/material behavior for the control layer; do not apply translucent material indiscriminately to content where it harms legibility. Inset meaningful inline 3D objects so they do not collide with edges/controls.
14
+
15
+ Input/privacy facts from Apple's guidance:
16
+
17
+ - gaze-and-pinch input is private by design: hover feedback lets people know what is targeted without exposing gaze before selection;
18
+ - use system/SwiftUI/RealityKit hover effects rather than logging gaze merely to recreate feedback;
19
+ - ARKit world/hand/scene data may require a Full Space and explicit permission depending on feature;
20
+ - do not infer emotion/identity/attention beyond the user's explicit input;
21
+ - support indirect input, direct touch equivalents, keyboard/gamepad/accessibility paths where relevant.
22
+
23
+ RealityKit/SwiftUI rules:
24
+
25
+ - choose `WindowGroup`, `Volume`, or `ImmersiveSpace` deliberately rather than mixing all three by default;
26
+ - keep entity hierarchy/scale in meters and account for resize/reposition;
27
+ - use attachments/ornaments for UI connected to 3D entities only when alignment and collision behavior are tested;
28
+ - test Shared Space behavior with other apps/windows and Full Space permission boundaries separately.
29
+
30
+ ## WebXR, Three.js, React Three Fiber, and A-Frame
31
+
32
+ The WebXR Device API is a W3C browser standard surface. Core concepts:
33
+
34
+ - feature-detect `navigator.xr` and `isSessionSupported(mode)`;
35
+ - common modes are `inline`, `immersive-vr`, and `immersive-ar`;
36
+ - request sessions with required/optional features explicitly (`local-floor`, `bounded-floor`, `hand-tracking`, `layers`, plane/mesh features where supported);
37
+ - input sources expose handedness/target ray/grip semantics depending on device;
38
+ - browser/session support is fragmented; provide non-XR fallback and do not use user-agent detection.
39
+
40
+ Three.js baseline:
41
+
42
+ ```js
43
+ renderer.xr.enabled = true;
44
+ renderer.setAnimationLoop(render);
45
+ ```
46
+
47
+ Use `setAnimationLoop`, not a normal animation-frame loop, for XR presentation. Manage reference-space scale, camera rig movement rather than camera-only hacks, controller events, resize/session end, color space, tone mapping, and frame budget. Do not import desktop postprocessing chains without measuring stereo cost.
48
+
49
+ React Three Fiber/XR packages wrap Three.js rather than removing XR constraints. Keep immutable scene state outside per-frame render paths, dispose GPU resources, memoize geometry/materials, and profile both eyes. Use the current `@react-three/xr` API/version rather than copying older examples.
50
+
51
+ A-Frame is entity-component HTML-like composition over Three.js. It is appropriate for declarative prototypes/scenes, but component lifecycle, asset loading, occlusion, input abstraction, and version compatibility still require real-device verification.
52
+
53
+ ## Meta Quest / Interaction SDK
54
+
55
+ Use native interaction primitives instead of custom rays/colliders where possible:
56
+
57
+ - ray/distance interaction for sparse distant targets;
58
+ - poke/direct touch for near panels;
59
+ - grab/hand interaction for physical manipulation;
60
+ - controller and hand-tracking parity or explicit alternatives;
61
+ - visual/audio/haptic feedback for hover/select/grab/release;
62
+ - hand tracking loss/false-positive recovery.
63
+
64
+ Meta's locomotion tunneling implementation defines the vignette angularly rather than assuming a fixed device FOV. That principle matters generally: express comfort occlusion in visual-angle terms, not screen UV alone.
65
+
66
+ ## Unity XR Interaction Toolkit
67
+
68
+ Useful architecture:
69
+
70
+ - XR Origin/XR rig as the movable player reference;
71
+ - interactors/interactables rather than ad hoc raycast input;
72
+ - locomotion mediator/providers for move/turn/teleport;
73
+ - snap turn and continuous turn as distinct user options;
74
+ - tunneling vignette as a configurable comfort mode;
75
+ - input action abstraction across controller profiles.
76
+
77
+ Measure frame timing in Unity Profiler/device capture, not editor playback. Quest/Android XR builds have different thermal/GC/rendering constraints than desktop editor runs.
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: pixelcraft-tokens
3
+ description: Creates and exports cross-platform design tokens in the W3C Design Tokens Community Group 2025.10 format. Use when defining color, type, spacing, radius, motion, elevation, theme, dark-mode, semantic, component, or multi-platform design-token systems; converting a direction card into reusable tokens; or exporting tokens for CSS, Tailwind, SwiftUI, Compose, Flutter, Python, Qt, or Textual.
4
+ license: MIT
5
+ metadata:
6
+ version: 0.1.0
7
+ ---
8
+
9
+ # Pixelcraft tokens
10
+
11
+ Tokens are design decisions in portable form. They encode hierarchy and semantic intent; they are not a dump of raw constants.
12
+
13
+ ## Reference and tools
14
+
15
+ - Read [references/format.md](references/format.md) when authoring DTCG structure, references, modes, themes, or token tiers.
16
+ - Read [references/theme-presets.md](references/theme-presets.md) when designing light/dark/high-contrast modes, dark elevation/accent behavior, forced-colors behavior, or exporter-supported DTCG mode overrides.
17
+ - Read [references/state-tokens.md](references/state-tokens.md) whenever defining interactive control states or validating state coverage across modes.
18
+ - Read [references/governance.md](references/governance.md) before renaming, removing, versioning, deprecating, or meaningfully redefining tokens.
19
+ - Read [references/adoption.md](references/adoption.md) when migrating consumers, inventorying hardcoded values, or improving documentation/usage of an existing system.
20
+ - Use [assets/tokens.example.json](assets/tokens.example.json) as the canonical small example and [assets/tokens.modes.example.json](assets/tokens.modes.example.json) for mode overrides.
21
+ - Run `node scripts/export-tokens.mjs --help` for exporter usage. The exporter supports `css`, `tailwind`, `swift`, `kotlin`, `dart`, `python`, `qt`, and `textual`.
22
+
23
+ ## Token tiers
24
+
25
+ 1. **Primitive** — raw scales: hue ramps, spacing base, font families, durations. Names describe measurement (`color.blue.500`), not use.
26
+ 2. **Semantic** — intent: `color.surface`, `color.ink.muted`, `color.action.primary`, `space.control.inline`, `motion.feedback.fast`. Product logic consumes these.
27
+ 3. **Component** — scoped overrides only when a component truly needs them: `component.button.primary.background`. Do not duplicate every semantic token.
28
+
29
+ Consumers should use the highest meaningful tier. Component code should almost never consume primitives directly.
30
+
31
+ ## Authoring rules
32
+
33
+ - Inherit the existing project token system when present. Extend semantic gaps rather than replacing names impulsively.
34
+ - Use DTCG `$type`, `$value`, `$description`, and `$extensions` deliberately; avoid tool-specific fields outside `$extensions`.
35
+ - Use references such as `{color.brand}` so semantic and component tokens preserve relationships.
36
+ - Encode mode/theme as explicit alternate semantic values or files. Do not implement dark mode by global inversion.
37
+ - Include state roles: hover, active, focus, selected, disabled, destructive, success, warning, info.
38
+ - Include density-aware spacing only when the product actually supports density modes; otherwise prefer one coherent rhythm.
39
+ - Tokenize motion intent (`duration.feedback-fast`, `easing.standard`) rather than implementation property names.
40
+ - Keep platform units out of semantic meaning. Exporters translate dimension units; `px` in DTCG input does not mean every platform should use pixels conceptually.
41
+
42
+ ## Validation checklist
43
+
44
+ Before implementation or export:
45
+
46
+ - every reference resolves and has no cycle;
47
+ - contrast pairs are defined by role, not guessed later;
48
+ - focus/selection/disabled states exist and realistic combinations such as invalid+focus or selected+disabled are considered;
49
+ - state behavior is validated across supported modes rather than only in the base theme;
50
+ - ownership, deprecation, rollback, and consumer-impact notes exist for breaking or behavioral changes;
51
+ - dark/high-contrast behavior is explicit or marked absent;
52
+ - type roles cover display/body/UI/data/caption and required script fallbacks;
53
+ - localization expansion and directionality do not depend on fixed widths;
54
+ - every generated platform artifact is treated as output, not edited by hand.
55
+
56
+ The bundled exporter is intentionally small and zero-dependency. It validates the subset it emits; use a dedicated DTCG compiler for advanced spec features or production edge cases.
@@ -0,0 +1,71 @@
1
+ {
2
+ "$schema": "https://www.designtokens.org/TR/2025.10/format/",
3
+ "color": {
4
+ "$type": "color",
5
+ "brand": {
6
+ "$value": { "colorSpace": "oklch", "components": [0.55, 0.16, 250], "alpha": 1 },
7
+ "$description": "Primary subject accent"
8
+ },
9
+ "surface": {
10
+ "$value": { "colorSpace": "oklch", "components": [0.98, 0.01, 95], "alpha": 1 }
11
+ },
12
+ "ink": {
13
+ "$value": { "colorSpace": "oklch", "components": [0.22, 0.02, 265], "alpha": 1 }
14
+ },
15
+ "danger": {
16
+ "$value": { "colorSpace": "oklch", "components": [0.55, 0.2, 28], "alpha": 1 }
17
+ }
18
+ },
19
+ "space": {
20
+ "$type": "dimension",
21
+ "base": { "$value": { "value": 4, "unit": "px" } },
22
+ "control": {
23
+ "inline": { "$value": "{space.base}" }
24
+ }
25
+ },
26
+ "radius": {
27
+ "$type": "dimension",
28
+ "medium": { "$value": { "value": 10, "unit": "px" } }
29
+ },
30
+ "font": {
31
+ "family": {
32
+ "$type": "fontFamily",
33
+ "body": { "$value": ["System UI", "Arial", "sans-serif"] }
34
+ },
35
+ "size": {
36
+ "$type": "dimension",
37
+ "body": { "$value": { "value": 16, "unit": "px" } }
38
+ }
39
+ },
40
+ "motion": {
41
+ "duration": {
42
+ "$type": "duration",
43
+ "fast": { "$value": { "value": 120, "unit": "ms" } }
44
+ }
45
+ },
46
+ "semantic": {
47
+ "color": {
48
+ "$type": "color",
49
+ "action": { "$value": "{color.brand}" },
50
+ "background": { "$value": "{color.surface}" },
51
+ "foreground": { "$value": "{color.ink}" },
52
+ "error": { "$value": "{color.danger}" }
53
+ },
54
+ "space": {
55
+ "$type": "dimension",
56
+ "controlInline": { "$value": "{space.control.inline}" }
57
+ }
58
+ },
59
+ "component": {
60
+ "button": {
61
+ "background": {
62
+ "$type": "color",
63
+ "$value": "{semantic.color.action}"
64
+ },
65
+ "radius": {
66
+ "$type": "dimension",
67
+ "$value": "{radius.medium}"
68
+ }
69
+ }
70
+ }
71
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ "$schema": "https://www.designtokens.org/TR/2025.10/format/",
3
+ "color": {
4
+ "$type": "color",
5
+ "brand": {
6
+ "$value": { "colorSpace": "oklch", "components": [0.55, 0.16, 250], "alpha": 1 },
7
+ "$extensions": {
8
+ "pixelcraft": {
9
+ "modes": {
10
+ "dark": { "$value": { "colorSpace": "oklch", "components": [0.68, 0.11, 250], "alpha": 1 } },
11
+ "high-contrast": { "$value": { "colorSpace": "oklch", "components": [0.45, 0.2, 250], "alpha": 1 } }
12
+ }
13
+ }
14
+ }
15
+ },
16
+ "surface": {
17
+ "$value": { "colorSpace": "oklch", "components": [0.98, 0.005, 95], "alpha": 1 },
18
+ "$extensions": {
19
+ "pixelcraft": {
20
+ "modes": {
21
+ "dark": { "$value": { "colorSpace": "oklch", "components": [0.2, 0.01, 265], "alpha": 1 } },
22
+ "high-contrast": { "$value": { "colorSpace": "oklch", "components": [1, 0, 0], "alpha": 1 } }
23
+ }
24
+ }
25
+ }
26
+ },
27
+ "ink": {
28
+ "$value": { "colorSpace": "oklch", "components": [0.22, 0.02, 265], "alpha": 1 },
29
+ "$extensions": {
30
+ "pixelcraft": {
31
+ "modes": {
32
+ "dark": { "$value": { "colorSpace": "oklch", "components": [0.93, 0.01, 95], "alpha": 1 } },
33
+ "high-contrast": { "$value": { "colorSpace": "oklch", "components": [0, 0, 0], "alpha": 1 } }
34
+ }
35
+ }
36
+ }
37
+ }
38
+ },
39
+ "semantic": {
40
+ "color": {
41
+ "$type": "color",
42
+ "action": { "$value": "{color.brand}" },
43
+ "background": { "$value": "{color.surface}" },
44
+ "foreground": { "$value": "{color.ink}" }
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,55 @@
1
+ # Design-token adoption and migration
2
+
3
+ Token systems fail when teams cannot discover, trust, or migrate them. Adoption work is part of the design system, not optional documentation polish.
4
+
5
+ ## Consumer inventory
6
+
7
+ Before changing or promoting tokens, inventory:
8
+
9
+ - applications/packages/screens using token source or generated artifacts;
10
+ - direct primitive usage that should be semantic;
11
+ - local copies or hardcoded values duplicating token meaning;
12
+ - platform-specific generated outputs and their generation date/version;
13
+ - exceptions/waivers and why they exist;
14
+ - documentation/examples that teach obsolete names.
15
+
16
+ A narrow search in one frontend folder is not an inventory. Include server-rendered templates, mobile/native code, data-app Python, email/document generation, tests, snapshots, and story/example files where relevant.
17
+
18
+ ## Adoption path
19
+
20
+ Use a staged path rather than a big-bang rewrite:
21
+
22
+ 1. **Name the contract.** Document semantic tiers and forbidden direct-primitive cases.
23
+ 2. **Generate once.** Ensure every platform artifact comes from the same source/version.
24
+ 3. **Start with high-leverage surfaces.** Migrate shared shell/components before leaf screens.
25
+ 4. **Bridge, then remove.** Temporary aliases reduce breakage but need an owner and removal condition.
26
+ 5. **Measure exception density.** Count hardcoded values/direct primitive use in representative surfaces; do not claim adoption from file existence.
27
+ 6. **Validate behavior.** Run state/theme/contrast/export tests and inspect rendered critical screens.
28
+ 7. **Record migration state.** `not started / bridging / migrated / waived` with scope and consequence.
29
+
30
+ ## Documentation minimum
31
+
32
+ Every maintained token system needs enough documentation for a new contributor/agent to answer:
33
+
34
+ - which file is source and which files are generated;
35
+ - how to choose semantic vs component vs primitive;
36
+ - how themes/modes are represented;
37
+ - how to regenerate platform artifacts;
38
+ - which validation commands/tests exist;
39
+ - how to deprecate or request a token;
40
+ - who owns breaking changes;
41
+ - which exceptions are deliberate.
42
+
43
+ Keep examples close to usage. A long conceptual document without copyable correct examples increases misuse.
44
+
45
+ ## Migration warning signs
46
+
47
+ - same semantic meaning exists under multiple names;
48
+ - generated artifacts disagree across platforms with no version note;
49
+ - consumers bypass semantic tokens because required states are missing;
50
+ - component tokens replicate entire semantic sets;
51
+ - no one can explain whether a change is breaking;
52
+ - visual regressions are discovered only after broad rollout;
53
+ - teams fork tokens because review latency is too high.
54
+
55
+ Treat these as system design problems. Do not solve them by adding more constants or stricter lectures.
@@ -0,0 +1,54 @@
1
+ # DTCG 2025.10 token format
2
+
3
+ Evidence base: DTCG format/color specifications; stable Community Group status caveat; exporter ecosystem caveats.
4
+
5
+ DTCG 2025.10 is a stable Final Community Group Report, not a W3C Standard. Treat it as a versioned interchange format and validate implementation support before relying on advanced behavior.
6
+
7
+ ## Shape
8
+
9
+ Token files are JSON. Groups are nested objects; token leaves contain `$value`. `$type` may be declared on a token or inherited from a containing group.
10
+
11
+ ```json
12
+ {
13
+ "color": {
14
+ "$type": "color",
15
+ "brand": {
16
+ "$value": { "colorSpace": "oklch", "components": [0.55, 0.16, 250], "alpha": 1 },
17
+ "$description": "Primary brand accent"
18
+ }
19
+ }
20
+ }
21
+ ```
22
+
23
+ Common types include `color`, `dimension`, `fontFamily`, `fontWeight`, `duration`, `number`, `strokeStyle`, `border`, `transition`, `shadow`, `gradient`, and `typography`. Use exact spec definitions before adding complex composite types.
24
+
25
+ ## References
26
+
27
+ Use curly references such as `{color.brand}` to preserve relationships. Pixelcraft's bundled exporter resolves this common form. Some secondary guides describe additional reference syntax in 2025.10; verify the primary specification before implementing advanced `$ref`/JSON Pointer behavior.
28
+
29
+ ## Modes and themes
30
+
31
+ The format does not force one universal theme architecture. Use one explicit approach:
32
+
33
+ 1. separate files per mode (`tokens.base.json`, `tokens.dark.json`) with identical semantic paths;
34
+ 2. `$extensions` metadata declaring mode-specific values for a compiler you control;
35
+ 3. parallel groups such as `theme.light` and `theme.dark` when tooling is simple.
36
+
37
+ Rules:
38
+
39
+ - keep primitive scales mostly stable across modes;
40
+ - change semantic roles deliberately;
41
+ - verify contrast and state visibility per mode;
42
+ - never implement dark mode as automatic inversion;
43
+ - record whether high contrast is a theme, accessibility mode, or platform-mediated behavior.
44
+
45
+ ## Naming
46
+
47
+ - lowercase dot paths in documentation and camel/kebab conversion only at export time;
48
+ - use intent before appearance for semantic names (`surface-warning`, not `yellow-100`);
49
+ - reserve component tier for true overrides;
50
+ - avoid encoding platform names in universal semantic tokens.
51
+
52
+ ## Validation
53
+
54
+ Minimum checks: JSON parses; groups/tokens do not conflict; `$type` known/inherited; `$value` shape valid; references resolve; no cycles; units explicit for dimensions; alpha in range; required semantic roles exist. The bundled exporter performs a practical subset and intentionally fails unknown malformed tokens rather than guessing.
@@ -0,0 +1,80 @@
1
+ # Token governance and lifecycle
2
+
3
+ Tokens are a public contract. Once components consume them, renaming or redefining a token is a product migration, not a cosmetic edit. Governance can be lightweight, but ownership and rollback must be explicit before a system grows beyond one screen.
4
+
5
+ ## Ownership model
6
+
7
+ Assign one accountable owner for each area:
8
+
9
+ | Area | Owner responsibility |
10
+ |---|---|
11
+ | primitives | scale generation, naming consistency, licensing/provenance of assets/fonts |
12
+ | semantic tokens | meaning, contrast pairs, mode behavior, accessibility floor |
13
+ | component tokens | necessity review, component API alignment, removal when no longer justified |
14
+ | exporters/build outputs | generation correctness, version compatibility, consumer notification |
15
+ | documentation | usage examples, deprecation notices, migration guides |
16
+
17
+ In a solo project the same person may hold every role; still record the role so future agents know who must approve breaking changes. “Everyone owns tokens” means no one does.
18
+
19
+ ## Change classes
20
+
21
+ | Class | Examples | Required action |
22
+ |---|---|---|
23
+ | additive | new semantic token, new mode, new optional component token | document intent; no consumer migration |
24
+ | corrective | fix wrong contrast/value while preserving meaning | validate consumers; record bugfix scope |
25
+ | behavioral | dark elevation model changes, focus-ring posture changes | visual review across affected states/modes |
26
+ | breaking | rename, removal, type change, changed alias target, altered semantic meaning | deprecation window or explicit migration; version bump; rollback plan |
27
+ | emergency | security/legal/accessibility defect | expedite, but still record affected consumers and validation evidence |
28
+
29
+ Do not silently change the meaning of an existing name. If `color.action.primary` moves from brand-blue to warning-red in meaning, create a new semantic token and migrate intentionally.
30
+
31
+ ## Version and release record
32
+
33
+ Keep a `TOKENS.md`, changelog section, or equivalent release note near the token source when the project supports it:
34
+
35
+ ```markdown
36
+ ## <version/date>
37
+ - Added: <tokens + intended consumers>
38
+ - Changed: <token + behavioral effect + evidence>
39
+ - Deprecated: <token + replacement + removal date/version>
40
+ - Removed: <token + migration completed>
41
+ - Validation: <contrast matrix/modes/platforms/exporter tests>
42
+ ```
43
+
44
+ Semantic-version the token package when it is versioned as a package. Treat generated CSS/native artifacts as build output; never patch them manually because that hides source drift.
45
+
46
+ ## Deprecation procedure
47
+
48
+ 1. Mark the old token deprecated in `$description` or `$extensions` without changing its value.
49
+ 2. Add the replacement and migration example.
50
+ 3. Inventory consumers before removal; search generated artifacts and platform code, not only web CSS.
51
+ 4. Announce the removal window in the project’s normal change channel.
52
+ 5. Migrate or shim consumers; keep aliases temporary when they reduce risk.
53
+ 6. Remove only after consumer inventory is clean or the break is explicitly approved.
54
+ 7. Record rollback: restore old source token and regenerate artifacts rather than hand-editing outputs.
55
+
56
+ ## Rollback and recovery
57
+
58
+ Rollback must be cheap enough to use. Preserve the prior token source/version, generated artifacts, exporter version, validation matrix, and consumer compatibility notes. If rollback requires manually reverse-engineering generated files, the release process is incomplete.
59
+
60
+ ## Contribution gate
61
+
62
+ Before accepting a token change, require:
63
+
64
+ - semantic purpose in user terms, not only a value;
65
+ - consuming surface/component example;
66
+ - contrast and state validation where color is involved;
67
+ - behavior across supported modes/themes;
68
+ - text scaling/localization implication where size/spacing/type is involved;
69
+ - platform export implication;
70
+ - migration/deprecation note for existing consumers;
71
+ - reviewer or owner decision recorded when behavior changes.
72
+
73
+ ## Anti-patterns
74
+
75
+ - publishing every primitive as equally semantic API;
76
+ - creating component tokens for every property “just in case”;
77
+ - changing generated artifacts without changing source;
78
+ - copying a theme object into each platform and letting values drift;
79
+ - deprecating by deletion with no inventory;
80
+ - treating a token rename as safe because search finds no usage in one framework folder.
@@ -0,0 +1,62 @@
1
+ # Component state token matrix
2
+
3
+ State tokens define how interface controls communicate interaction. They are semantic contracts, not decorative hover colors. Define them once at the highest useful tier and consume them consistently across platforms.
4
+
5
+ ## Required state set
6
+
7
+ Cover these states where the control type supports them:
8
+
9
+ | State | Meaning | Required token categories |
10
+ |---|---|---|
11
+ | rest/default | stable baseline | background/surface, ink/icon, border, elevation |
12
+ | hover | pointer is over control; never required for operation | background/ink/border shift; avoid layout movement |
13
+ | focus-visible / focused | current keyboard/controller/remote input target | ring/outline, background/border contrast, invariant geometry |
14
+ | pressed/active | pointer or activation key currently down | immediate feedback; stronger but temporary contrast/depth |
15
+ | selected/checked/current | persistent selection or location | non-color cue plus semantic background/icon/text treatment |
16
+ | disabled/unavailable | visible but cannot be activated now | reduced contrast without becoming invisible; explanatory copy where needed |
17
+ | invalid/error | user input or process state failed validation | error border/icon/text/status token; do not rely on red alone |
18
+ | loading/busy/progress | action or content is pending | progress indication, disabled/interaction semantics, stable geometry |
19
+ | readonly | value visible but intentionally immutable | distinguish from editable and disabled without ambiguity |
20
+ | destructive | action causes irreversible/high-cost consequence | danger semantics, confirmation/undo behavior, restrained persistent emphasis |
21
+ | dragged/placeholder/target | object moving or valid drop target | position/order/affordance cues beyond color |
22
+ | expanded/collapsed/open | disclosure state | icon/chevron semantics, aria/state exposure, motion-safe transition |
23
+
24
+ Do not create every token for every atom. Define shared semantic roles first (`state.focus.ring`, `control.disabled.ink`, `feedback.error.surface`) and add component overrides only when behavior genuinely differs.
25
+
26
+ ## Matrix template
27
+
28
+ ```markdown
29
+ | Component/region | Mode | State | Background/surface | Ink/icon | Border/ring | Elevation/overlay | Motion | Validation |
30
+ |---|---|---|---|---|---|---|---|---|
31
+ | button.primary | light | rest | | | | | | contrast/focus/target checked? |
32
+ | button.primary | dark | focus-visible | | | | | | |
33
+ | input.text | high-contrast | invalid+focus | | | | | | |
34
+ ```
35
+
36
+ Fill combinations that can actually occur. Invalid+focus, selected+disabled, loading+pressed, and hover+selected are common omissions. Mark impossible combinations `not applicable` instead of inventing decorative values.
37
+
38
+ ## Interaction rules
39
+
40
+ 1. **Hover is enhancement.** Never put essential meaning or access only in hover.
41
+ 2. **Focus must beat theme decoration.** Focus indication needs contrast against adjacent colors in every mode and must not be clipped by overflow/rounded clipping.
42
+ 3. **Pressed feedback is immediate.** Target acknowledgment within normal input latency; do not wait for network completion.
43
+ 4. **Disabled does not mean invisible.** Preserve enough legibility for orientation, and explain missing permission/prerequisite when it affects the user.
44
+ 5. **Selection is redundant.** Pair color with check/icon/text/position/weight or geometry.
45
+ 6. **Loading preserves layout.** Avoid jumping controls; make cancellation/retry semantics explicit.
46
+ 7. **Errors persist until corrected.** Do not clear them merely because focus moved away.
47
+ 8. **Forced colors/high contrast may replace color tokens.** Preserve meaning through system colors, outlines, icons, and text rather than fighting the platform.
48
+
49
+ ## Validation procedure
50
+
51
+ For each interactive component family:
52
+
53
+ - enumerate the realistic state combinations before implementation;
54
+ - verify foreground/background and border/ring contrast in all supported modes;
55
+ - inspect reduced-motion equivalents where state is animated;
56
+ - test keyboard/controller focus order and focus restoration;
57
+ - test touch/pointer target size outside hover-dependent behavior;
58
+ - inspect dark/high-contrast/forced-color rendering;
59
+ - validate localized/disabled/error text clipping;
60
+ - verify platform accessibility state (`selected`, `disabled`, `busy`, `invalid`, `expanded`) is exposed rather than only visually implied.
61
+
62
+ Exporter tests cover syntax only. They do not prove state usability; rendered or manual evidence remains necessary.