@thanhnguyxn/pixelcraft 0.0.0-stage → 0.2.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 (455) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/.antigravity-plugin/plugin.json +32 -0
  3. package/.claude-plugin/marketplace.json +20 -0
  4. package/.claude-plugin/plugin.json +22 -0
  5. package/.codex-plugin/plugin.json +45 -0
  6. package/.cursor-plugin/marketplace.json +17 -0
  7. package/.cursor-plugin/plugin.json +27 -0
  8. package/.devin-plugin/plugin.json +21 -0
  9. package/.github/plugin/marketplace.json +34 -0
  10. package/CHANGELOG.md +159 -0
  11. package/GEMINI.md +1 -0
  12. package/LICENSE +21 -0
  13. package/README.md +264 -2
  14. package/SECURITY.md +28 -0
  15. package/assets/README.md +28 -0
  16. package/assets/pixelcraft-logo-128.png +0 -0
  17. package/assets/pixelcraft-logo-256.png +0 -0
  18. package/assets/pixelcraft-logo-512.png +0 -0
  19. package/bin/pixelcraft.mjs +852 -0
  20. package/docs/ARCHITECTURE.md +105 -0
  21. package/docs/DESIGN-RATIONALE.md +191 -0
  22. package/docs/INSTALL.md +221 -0
  23. package/evals/README.md +37 -0
  24. package/evals/fixtures/3d-web-engineering.json +69 -0
  25. package/evals/fixtures/README.md +36 -0
  26. package/evals/fixtures/acceptance-checklist-rule03-gate.json +43 -0
  27. package/evals/fixtures/ai-ui-libraries.json +53 -0
  28. package/evals/fixtures/audio-visual-accessibility.json +69 -0
  29. package/evals/fixtures/auth-and-checkout-ui.json +53 -0
  30. package/evals/fixtures/brandkit-identity-governance.json +48 -0
  31. package/evals/fixtures/build-and-architecture.json +53 -0
  32. package/evals/fixtures/canvas-and-node-editors.json +53 -0
  33. package/evals/fixtures/chat-ai-exfiltration-ime-hitl-gate.json +43 -0
  34. package/evals/fixtures/completion-gate-scan-until-clean.json +44 -0
  35. package/evals/fixtures/component-systems.json +53 -0
  36. package/evals/fixtures/component-testing.json +53 -0
  37. package/evals/fixtures/constrained-voice-and-tv.json +43 -0
  38. package/evals/fixtures/creative-code-rendering.json +69 -0
  39. package/evals/fixtures/creative-reference-evidence.json +67 -0
  40. package/evals/fixtures/data-app-python-marimo.json +49 -0
  41. package/evals/fixtures/desktop-cpp-juce-audio.json +49 -0
  42. package/evals/fixtures/desktop-csharp-avalonia.json +49 -0
  43. package/evals/fixtures/desktop-native-workspace.json +48 -0
  44. package/evals/fixtures/desktop-python-anti-tkinter.json +49 -0
  45. package/evals/fixtures/direction-prototype-complexity.json +29 -0
  46. package/evals/fixtures/document-prepress-pdfx4-tounicode.json +43 -0
  47. package/evals/fixtures/document-rust-typst-invoice.json +49 -0
  48. package/evals/fixtures/document-typst-and-print-css.json +43 -0
  49. package/evals/fixtures/email-mjml-dark-mode.json +49 -0
  50. package/evals/fixtures/email-outlook-and-plaintext.json +43 -0
  51. package/evals/fixtures/enterprise-data-ui.json +53 -0
  52. package/evals/fixtures/extended-tui-toolkits.json +53 -0
  53. package/evals/fixtures/extensions-mv3-and-vscode.json +43 -0
  54. package/evals/fixtures/file-upload-media-ui.json +53 -0
  55. package/evals/fixtures/finish-gate-anti-slop.json +30 -0
  56. package/evals/fixtures/forms-accessibility-negative.json +29 -0
  57. package/evals/fixtures/forms-validation.json +53 -0
  58. package/evals/fixtures/game-go-ebitengine.json +49 -0
  59. package/evals/fixtures/game-godot-gdscript.json +49 -0
  60. package/evals/fixtures/game-ui-hud-and-engines.json +43 -0
  61. package/evals/fixtures/handoff-fidelity-tolerance.json +29 -0
  62. package/evals/fixtures/i18n-engineering.json +53 -0
  63. package/evals/fixtures/local-first-sync.json +53 -0
  64. package/evals/fixtures/lynxjs.json +53 -0
  65. package/evals/fixtures/maizzle-email.json +53 -0
  66. package/evals/fixtures/maps-geospatial.json +53 -0
  67. package/evals/fixtures/media-og-and-video-export.json +43 -0
  68. package/evals/fixtures/media-players.json +53 -0
  69. package/evals/fixtures/mobile-compose-16kb-foldable-store-gate.json +44 -0
  70. package/evals/fixtures/mobile-elixir-liveview-native.json +49 -0
  71. package/evals/fixtures/mobile-flutter-dynamic-type.json +49 -0
  72. package/evals/fixtures/mobile-harmonyos-arkui.json +49 -0
  73. package/evals/fixtures/mobile-jetpack-compose.json +49 -0
  74. package/evals/fixtures/mobile-swiftui-ios.json +49 -0
  75. package/evals/fixtures/motion-engineering.json +69 -0
  76. package/evals/fixtures/pdfjs-and-pptx.json +53 -0
  77. package/evals/fixtures/plan-brownfield-evidence.json +28 -0
  78. package/evals/fixtures/plan-discovery-interview.json +31 -0
  79. package/evals/fixtures/plan-grill-me-brainstorm-gate.json +49 -0
  80. package/evals/fixtures/reactive-data-apps.json +53 -0
  81. package/evals/fixtures/review-evidence-audit.json +43 -0
  82. package/evals/fixtures/rich-text-and-code-editors.json +53 -0
  83. package/evals/fixtures/scrollytelling-resilience.json +70 -0
  84. package/evals/fixtures/spatial-xr-comfort-and-platforms.json +43 -0
  85. package/evals/fixtures/state-architecture.json +53 -0
  86. package/evals/fixtures/styling-ecosystem.json +53 -0
  87. package/evals/fixtures/token-tooling.json +53 -0
  88. package/evals/fixtures/tui-go-bubbletea.json +49 -0
  89. package/evals/fixtures/tui-rust-ratatui-grapheme-paste-teardown.json +44 -0
  90. package/evals/fixtures/tui-rust-ratatui.json +49 -0
  91. package/evals/fixtures/ux-state-matrix-and-i18n.json +43 -0
  92. package/evals/fixtures/visual-qa-task-evidence.json +29 -0
  93. package/evals/fixtures/web-3d-engines.json +53 -0
  94. package/evals/fixtures/web-php-laravel-filament.json +49 -0
  95. package/evals/fixtures/web-ruby-viewcomponent-phlex.json +49 -0
  96. package/evals/fixtures/workflow-checkpoints.json +30 -0
  97. package/evals/pixelcraft-accessibility.md +74 -0
  98. package/evals/pixelcraft-brandkit.md +58 -0
  99. package/evals/pixelcraft-chat-ui.md +55 -0
  100. package/evals/pixelcraft-constrained.md +55 -0
  101. package/evals/pixelcraft-craft.md +76 -0
  102. package/evals/pixelcraft-data-apps.md +55 -0
  103. package/evals/pixelcraft-dataviz.md +59 -0
  104. package/evals/pixelcraft-desktop.md +55 -0
  105. package/evals/pixelcraft-direction.md +77 -0
  106. package/evals/pixelcraft-document.md +55 -0
  107. package/evals/pixelcraft-email.md +55 -0
  108. package/evals/pixelcraft-extensions.md +55 -0
  109. package/evals/pixelcraft-game-ui.md +59 -0
  110. package/evals/pixelcraft-handoff.md +57 -0
  111. package/evals/pixelcraft-media.md +55 -0
  112. package/evals/pixelcraft-mobile.md +59 -0
  113. package/evals/pixelcraft-patterns.md +73 -0
  114. package/evals/pixelcraft-plan.md +127 -0
  115. package/evals/pixelcraft-review.md +63 -0
  116. package/evals/pixelcraft-spatial.md +55 -0
  117. package/evals/pixelcraft-tokens.md +57 -0
  118. package/evals/pixelcraft-tui.md +55 -0
  119. package/evals/pixelcraft-ux.md +59 -0
  120. package/evals/pixelcraft-visual-qa.md +86 -0
  121. package/evals/pixelcraft-web.md +89 -0
  122. package/evals/pixelcraft.md +70 -0
  123. package/gemini-extension.json +6 -0
  124. package/install.ps1 +341 -0
  125. package/install.sh +512 -0
  126. package/package.json +91 -4
  127. package/plugin.json +29 -0
  128. package/scripts/build-adapters.mjs +288 -0
  129. package/scripts/build-release-archives.mjs +61 -0
  130. package/scripts/build-skill-zips.mjs +94 -0
  131. package/scripts/run-evals.mjs +397 -0
  132. package/scripts/sync-docs.mjs +381 -0
  133. package/scripts/test-build-adapters.mjs +61 -0
  134. package/scripts/test-cross-platform-qa.mjs +359 -0
  135. package/scripts/test-distribution.mjs +203 -0
  136. package/scripts/test-export-tokens.mjs +361 -0
  137. package/scripts/test-finish-gate.mjs +271 -0
  138. package/scripts/test-installers.mjs +216 -0
  139. package/scripts/test-release-archives.mjs +42 -0
  140. package/scripts/test-shoot.mjs +87 -0
  141. package/scripts/test-slop-scan.mjs +416 -0
  142. package/scripts/test-style-inventory.mjs +234 -0
  143. package/scripts/test-sync-docs.mjs +140 -0
  144. package/scripts/test-validate-skills.mjs +195 -0
  145. package/scripts/validate-skills.mjs +658 -0
  146. package/skills/pixelcraft/SKILL.md +155 -0
  147. package/skills/pixelcraft/references/design-brief.md +75 -0
  148. package/skills/pixelcraft/references/floor.md +90 -0
  149. package/skills/pixelcraft/references/report-template.md +49 -0
  150. package/skills/pixelcraft/references/stack-detection.md +226 -0
  151. package/skills/pixelcraft/references/surface-acceptance.md +52 -0
  152. package/skills/pixelcraft/references/workflow-checkpoints.md +71 -0
  153. package/skills/pixelcraft-accessibility/SKILL.md +54 -0
  154. package/skills/pixelcraft-accessibility/references/apg-patterns.md +64 -0
  155. package/skills/pixelcraft-accessibility/references/motion-canvas.md +57 -0
  156. package/skills/pixelcraft-accessibility/references/platforms.md +86 -0
  157. package/skills/pixelcraft-accessibility/references/verification.md +64 -0
  158. package/skills/pixelcraft-accessibility/references/wcag22-checks.md +99 -0
  159. package/skills/pixelcraft-brandkit/SKILL.md +127 -0
  160. package/skills/pixelcraft-brandkit/references/asset-pipeline.md +165 -0
  161. package/skills/pixelcraft-brandkit/references/brand-governance.md +82 -0
  162. package/skills/pixelcraft-brandkit/references/layouts.md +88 -0
  163. package/skills/pixelcraft-brandkit/references/logo-concepting.md +83 -0
  164. package/skills/pixelcraft-brandkit/references/logo-methods.md +97 -0
  165. package/skills/pixelcraft-brandkit/references/pixel-art-logos.md +82 -0
  166. package/skills/pixelcraft-brandkit/references/prompt-template.md +87 -0
  167. package/skills/pixelcraft-brandkit/references/qa-checklist.md +93 -0
  168. package/skills/pixelcraft-brandkit/references/visual-modes.md +123 -0
  169. package/skills/pixelcraft-chat-ui/SKILL.md +57 -0
  170. package/skills/pixelcraft-chat-ui/references/agentic-workspace.md +66 -0
  171. package/skills/pixelcraft-chat-ui/references/ai-ui-libraries.md +259 -0
  172. package/skills/pixelcraft-chat-ui/references/conversation-design.md +84 -0
  173. package/skills/pixelcraft-chat-ui/references/mobile-business-platforms.md +77 -0
  174. package/skills/pixelcraft-chat-ui/references/slack-discord.md +80 -0
  175. package/skills/pixelcraft-constrained/SKILL.md +52 -0
  176. package/skills/pixelcraft-constrained/references/specialized-hardware.md +90 -0
  177. package/skills/pixelcraft-constrained/references/tv-wearables.md +134 -0
  178. package/skills/pixelcraft-constrained/references/voice-ui.md +104 -0
  179. package/skills/pixelcraft-craft/SKILL.md +58 -0
  180. package/skills/pixelcraft-craft/references/color.md +125 -0
  181. package/skills/pixelcraft-craft/references/imagery-icons.md +37 -0
  182. package/skills/pixelcraft-craft/references/layout-quality.md +65 -0
  183. package/skills/pixelcraft-craft/references/layout.md +73 -0
  184. package/skills/pixelcraft-craft/references/motion.md +163 -0
  185. package/skills/pixelcraft-craft/references/typography.md +110 -0
  186. package/skills/pixelcraft-data-apps/SKILL.md +86 -0
  187. package/skills/pixelcraft-data-apps/references/ai-and-internal-data-apps.md +147 -0
  188. package/skills/pixelcraft-data-apps/references/dash.md +109 -0
  189. package/skills/pixelcraft-data-apps/references/evidence.md +90 -0
  190. package/skills/pixelcraft-data-apps/references/gradio.md +103 -0
  191. package/skills/pixelcraft-data-apps/references/julia-genie.md +89 -0
  192. package/skills/pixelcraft-data-apps/references/jupyter-widgets.md +91 -0
  193. package/skills/pixelcraft-data-apps/references/nicegui.md +102 -0
  194. package/skills/pixelcraft-data-apps/references/observable-framework.md +105 -0
  195. package/skills/pixelcraft-data-apps/references/panel.md +99 -0
  196. package/skills/pixelcraft-data-apps/references/r-shiny.md +124 -0
  197. package/skills/pixelcraft-data-apps/references/reactive-data-apps.md +186 -0
  198. package/skills/pixelcraft-data-apps/references/reflex.md +116 -0
  199. package/skills/pixelcraft-data-apps/references/shiny.md +110 -0
  200. package/skills/pixelcraft-data-apps/references/streamlit.md +113 -0
  201. package/skills/pixelcraft-dataviz/SKILL.md +60 -0
  202. package/skills/pixelcraft-dataviz/references/chart-choice.md +55 -0
  203. package/skills/pixelcraft-dataviz/references/color-accessibility.md +112 -0
  204. package/skills/pixelcraft-dataviz/references/encoding-tables-dashboards.md +107 -0
  205. package/skills/pixelcraft-dataviz/references/libraries.md +176 -0
  206. package/skills/pixelcraft-dataviz/references/maps-geospatial.md +159 -0
  207. package/skills/pixelcraft-dataviz/references/realtime-graphs-maps-scale.md +92 -0
  208. package/skills/pixelcraft-desktop/SKILL.md +93 -0
  209. package/skills/pixelcraft-desktop/references/appkit.md +92 -0
  210. package/skills/pixelcraft-desktop/references/avalonia.md +95 -0
  211. package/skills/pixelcraft-desktop/references/cpp-gui.md +129 -0
  212. package/skills/pixelcraft-desktop/references/electron.md +96 -0
  213. package/skills/pixelcraft-desktop/references/go-gui.md +83 -0
  214. package/skills/pixelcraft-desktop/references/gtk.md +97 -0
  215. package/skills/pixelcraft-desktop/references/javafx-swing.md +81 -0
  216. package/skills/pixelcraft-desktop/references/qt-pyside-qml.md +88 -0
  217. package/skills/pixelcraft-desktop/references/rust-gui.md +83 -0
  218. package/skills/pixelcraft-desktop/references/tauri.md +110 -0
  219. package/skills/pixelcraft-desktop/references/uno-platform.md +71 -0
  220. package/skills/pixelcraft-desktop/references/winui-wpf.md +98 -0
  221. package/skills/pixelcraft-desktop/references/working-context.md +84 -0
  222. package/skills/pixelcraft-direction/SKILL.md +120 -0
  223. package/skills/pixelcraft-direction/references/composition-library.md +84 -0
  224. package/skills/pixelcraft-direction/references/creative-brainstorming.md +72 -0
  225. package/skills/pixelcraft-direction/references/direction-card.md +64 -0
  226. package/skills/pixelcraft-direction/references/direction-scoring.md +76 -0
  227. package/skills/pixelcraft-direction/references/motion-identity.md +67 -0
  228. package/skills/pixelcraft-direction/references/movements.md +71 -0
  229. package/skills/pixelcraft-direction/references/reference-analysis.md +37 -0
  230. package/skills/pixelcraft-direction/references/repetition-history.md +75 -0
  231. package/skills/pixelcraft-direction/references/slop-fingerprints.md +83 -0
  232. package/skills/pixelcraft-direction/references/wildcards.md +47 -0
  233. package/skills/pixelcraft-document/SKILL.md +58 -0
  234. package/skills/pixelcraft-document/references/archetypes.md +106 -0
  235. package/skills/pixelcraft-document/references/pdf-tools.md +314 -0
  236. package/skills/pixelcraft-document/references/pdfjs-and-pptx.md +114 -0
  237. package/skills/pixelcraft-document/references/print-css.md +187 -0
  238. package/skills/pixelcraft-document/references/slides.md +198 -0
  239. package/skills/pixelcraft-email/SKILL.md +80 -0
  240. package/skills/pixelcraft-email/references/client-quirks.md +113 -0
  241. package/skills/pixelcraft-email/references/html-tables.md +114 -0
  242. package/skills/pixelcraft-email/references/maizzle.md +54 -0
  243. package/skills/pixelcraft-email/references/mjml.md +54 -0
  244. package/skills/pixelcraft-email/references/react-email.md +95 -0
  245. package/skills/pixelcraft-extensions/SKILL.md +56 -0
  246. package/skills/pixelcraft-extensions/references/browser-extensions.md +105 -0
  247. package/skills/pixelcraft-extensions/references/figma-office.md +106 -0
  248. package/skills/pixelcraft-extensions/references/ide-and-saas-plugins.md +125 -0
  249. package/skills/pixelcraft-extensions/references/raycast.md +98 -0
  250. package/skills/pixelcraft-extensions/references/vscode-webviews.md +100 -0
  251. package/skills/pixelcraft-game-ui/SKILL.md +80 -0
  252. package/skills/pixelcraft-game-ui/references/bevy.md +90 -0
  253. package/skills/pixelcraft-game-ui/references/godot.md +130 -0
  254. package/skills/pixelcraft-game-ui/references/hud-principles.md +67 -0
  255. package/skills/pixelcraft-game-ui/references/love2d.md +77 -0
  256. package/skills/pixelcraft-game-ui/references/monogame.md +68 -0
  257. package/skills/pixelcraft-game-ui/references/unity-ugui.md +109 -0
  258. package/skills/pixelcraft-game-ui/references/unity-ui-toolkit.md +107 -0
  259. package/skills/pixelcraft-game-ui/references/unreal-umg.md +80 -0
  260. package/skills/pixelcraft-game-ui/references/web-and-middleware-game-ui.md +122 -0
  261. package/skills/pixelcraft-handoff/SKILL.md +50 -0
  262. package/skills/pixelcraft-handoff/references/design-translation.md +134 -0
  263. package/skills/pixelcraft-handoff/references/fidelity-tolerance.md +78 -0
  264. package/skills/pixelcraft-handoff/references/motion-handoff.md +54 -0
  265. package/skills/pixelcraft-media/SKILL.md +49 -0
  266. package/skills/pixelcraft-media/references/banners-video.md +130 -0
  267. package/skills/pixelcraft-media/references/og-generation.md +154 -0
  268. package/skills/pixelcraft-media/references/social-cards.md +71 -0
  269. package/skills/pixelcraft-mobile/SKILL.md +86 -0
  270. package/skills/pixelcraft-mobile/references/dotnet-maui.md +91 -0
  271. package/skills/pixelcraft-mobile/references/flet.md +80 -0
  272. package/skills/pixelcraft-mobile/references/flutter.md +113 -0
  273. package/skills/pixelcraft-mobile/references/harmonyos-and-emerging-mobile.md +121 -0
  274. package/skills/pixelcraft-mobile/references/ionic-capacitor.md +87 -0
  275. package/skills/pixelcraft-mobile/references/jetpack-compose.md +129 -0
  276. package/skills/pixelcraft-mobile/references/kivy.md +82 -0
  277. package/skills/pixelcraft-mobile/references/kotlin-multiplatform.md +86 -0
  278. package/skills/pixelcraft-mobile/references/lynxjs.md +110 -0
  279. package/skills/pixelcraft-mobile/references/nativescript-and-skip.md +91 -0
  280. package/skills/pixelcraft-mobile/references/react-native-expo.md +106 -0
  281. package/skills/pixelcraft-mobile/references/swiftui.md +200 -0
  282. package/skills/pixelcraft-mobile/references/tactile-interactions.md +55 -0
  283. package/skills/pixelcraft-mobile/references/task-state-composition.md +85 -0
  284. package/skills/pixelcraft-mobile/references/uikit.md +92 -0
  285. package/skills/pixelcraft-patterns/SKILL.md +75 -0
  286. package/skills/pixelcraft-patterns/references/accessibility-resilience.md +29 -0
  287. package/skills/pixelcraft-patterns/references/ai-and-offline-patterns.md +54 -0
  288. package/skills/pixelcraft-patterns/references/auth-onboarding.md +44 -0
  289. package/skills/pixelcraft-patterns/references/billing-paywalls.md +40 -0
  290. package/skills/pixelcraft-patterns/references/command-workspace.md +56 -0
  291. package/skills/pixelcraft-patterns/references/commerce.md +47 -0
  292. package/skills/pixelcraft-patterns/references/communication.md +45 -0
  293. package/skills/pixelcraft-patterns/references/creative-tools.md +42 -0
  294. package/skills/pixelcraft-patterns/references/creative-web-composition.md +38 -0
  295. package/skills/pixelcraft-patterns/references/dashboard-admin.md +35 -0
  296. package/skills/pixelcraft-patterns/references/history-diff-undo.md +50 -0
  297. package/skills/pixelcraft-patterns/references/marketing.md +44 -0
  298. package/skills/pixelcraft-patterns/references/multi-tenant-rbac.md +47 -0
  299. package/skills/pixelcraft-patterns/references/narrative-systems.md +42 -0
  300. package/skills/pixelcraft-patterns/references/notifications-activity.md +57 -0
  301. package/skills/pixelcraft-patterns/references/pattern-selection.md +80 -0
  302. package/skills/pixelcraft-patterns/references/scheduling-kanban.md +47 -0
  303. package/skills/pixelcraft-patterns/references/scroll-implementation.md +37 -0
  304. package/skills/pixelcraft-patterns/references/search-filtering.md +42 -0
  305. package/skills/pixelcraft-patterns/references/settings.md +51 -0
  306. package/skills/pixelcraft-patterns/references/tables-crud.md +43 -0
  307. package/skills/pixelcraft-plan/SKILL.md +103 -0
  308. package/skills/pixelcraft-plan/references/design-input.md +69 -0
  309. package/skills/pixelcraft-plan/references/discovery-interview.md +110 -0
  310. package/skills/pixelcraft-plan/references/grill-me-protocol.md +63 -0
  311. package/skills/pixelcraft-plan/references/plan-template.md +134 -0
  312. package/skills/pixelcraft-plan/references/repo-discovery.md +49 -0
  313. package/skills/pixelcraft-plan/references/stack-freshness.md +67 -0
  314. package/skills/pixelcraft-plan/references/stack-selection.md +98 -0
  315. package/skills/pixelcraft-review/SKILL.md +86 -0
  316. package/skills/pixelcraft-review/references/audit-report.md +69 -0
  317. package/skills/pixelcraft-review/references/critique-protocol.md +89 -0
  318. package/skills/pixelcraft-review/references/heuristics.md +63 -0
  319. package/skills/pixelcraft-review/references/personas.md +53 -0
  320. package/skills/pixelcraft-review/references/polish.md +78 -0
  321. package/skills/pixelcraft-review/scripts/check-acceptance.mjs +619 -0
  322. package/skills/pixelcraft-review/scripts/fixtures/brand-critique-waivers.json +14 -0
  323. package/skills/pixelcraft-review/scripts/fixtures/brand-critique.css +18 -0
  324. package/skills/pixelcraft-review/scripts/fixtures/clean.html +43 -0
  325. package/skills/pixelcraft-review/scripts/fixtures/focus-after-block.css +4 -0
  326. package/skills/pixelcraft-review/scripts/fixtures/focus-at-rules.css +17 -0
  327. package/skills/pixelcraft-review/scripts/fixtures/focus-comments.css +10 -0
  328. package/skills/pixelcraft-review/scripts/fixtures/focus-html-quote-leak.html +12 -0
  329. package/skills/pixelcraft-review/scripts/fixtures/focus-invalid-replacements.css +27 -0
  330. package/skills/pixelcraft-review/scripts/fixtures/focus-longhand-removal.css +34 -0
  331. package/skills/pixelcraft-review/scripts/fixtures/focus-nested-rules.css +19 -0
  332. package/skills/pixelcraft-review/scripts/fixtures/focus-not-visible-skip.css +8 -0
  333. package/skills/pixelcraft-review/scripts/fixtures/focus-outline-shorthands.css +11 -0
  334. package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-and-border.css +15 -0
  335. package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-last-wins.css +19 -0
  336. package/skills/pixelcraft-review/scripts/fixtures/focus-valid-replacements-extended.css +29 -0
  337. package/skills/pixelcraft-review/scripts/fixtures/focus-visible-no-replacement.css +3 -0
  338. package/skills/pixelcraft-review/scripts/fixtures/focus-visible-valid-replacements.css +9 -0
  339. package/skills/pixelcraft-review/scripts/fixtures/slop.html +28 -0
  340. package/skills/pixelcraft-review/scripts/slop-scan.mjs +1233 -0
  341. package/skills/pixelcraft-spatial/SKILL.md +51 -0
  342. package/skills/pixelcraft-spatial/references/comfort-accessibility.md +39 -0
  343. package/skills/pixelcraft-spatial/references/platforms.md +147 -0
  344. package/skills/pixelcraft-tokens/SKILL.md +60 -0
  345. package/skills/pixelcraft-tokens/assets/tokens.example.json +71 -0
  346. package/skills/pixelcraft-tokens/assets/tokens.modes.example.json +47 -0
  347. package/skills/pixelcraft-tokens/references/adoption.md +55 -0
  348. package/skills/pixelcraft-tokens/references/format.md +84 -0
  349. package/skills/pixelcraft-tokens/references/governance.md +80 -0
  350. package/skills/pixelcraft-tokens/references/state-tokens.md +62 -0
  351. package/skills/pixelcraft-tokens/references/theme-presets.md +122 -0
  352. package/skills/pixelcraft-tokens/references/token-tooling.md +119 -0
  353. package/skills/pixelcraft-tokens/scripts/export-tokens.mjs +847 -0
  354. package/skills/pixelcraft-tui/SKILL.md +76 -0
  355. package/skills/pixelcraft-tui/references/bubbletea-lipgloss.md +79 -0
  356. package/skills/pixelcraft-tui/references/extended-tui-toolkits.md +127 -0
  357. package/skills/pixelcraft-tui/references/ink.md +109 -0
  358. package/skills/pixelcraft-tui/references/ratatui.md +102 -0
  359. package/skills/pixelcraft-tui/references/rich.md +82 -0
  360. package/skills/pixelcraft-tui/references/terminal-protocols.md +80 -0
  361. package/skills/pixelcraft-tui/references/textual.md +108 -0
  362. package/skills/pixelcraft-ux/SKILL.md +56 -0
  363. package/skills/pixelcraft-ux/references/cognitive-walkthrough.md +70 -0
  364. package/skills/pixelcraft-ux/references/feedback-performance.md +50 -0
  365. package/skills/pixelcraft-ux/references/flows-ia.md +44 -0
  366. package/skills/pixelcraft-ux/references/forms.md +151 -0
  367. package/skills/pixelcraft-ux/references/i18n.md +221 -0
  368. package/skills/pixelcraft-ux/references/laws.md +39 -0
  369. package/skills/pixelcraft-ux/references/locale-test-matrix.md +60 -0
  370. package/skills/pixelcraft-ux/references/state-matrix.md +53 -0
  371. package/skills/pixelcraft-ux/references/usability-testing.md +84 -0
  372. package/skills/pixelcraft-ux/references/ux-writing.md +44 -0
  373. package/skills/pixelcraft-visual-qa/SKILL.md +96 -0
  374. package/skills/pixelcraft-visual-qa/references/baseline-governance.md +70 -0
  375. package/skills/pixelcraft-visual-qa/references/capture-desktop-game.md +59 -0
  376. package/skills/pixelcraft-visual-qa/references/capture-document.md +70 -0
  377. package/skills/pixelcraft-visual-qa/references/capture-email.md +38 -0
  378. package/skills/pixelcraft-visual-qa/references/capture-mobile.md +50 -0
  379. package/skills/pixelcraft-visual-qa/references/capture-terminal.md +35 -0
  380. package/skills/pixelcraft-visual-qa/references/critique-rubric.md +71 -0
  381. package/skills/pixelcraft-visual-qa/references/finish-gate.md +35 -0
  382. package/skills/pixelcraft-visual-qa/references/measured-craft.md +30 -0
  383. package/skills/pixelcraft-visual-qa/references/motion-capture.md +63 -0
  384. package/skills/pixelcraft-visual-qa/references/performance-budgets.md +78 -0
  385. package/skills/pixelcraft-visual-qa/references/realtime-graphics.md +55 -0
  386. package/skills/pixelcraft-visual-qa/references/task-verification.md +81 -0
  387. package/skills/pixelcraft-visual-qa/scripts/check-contrast.mjs +442 -0
  388. package/skills/pixelcraft-visual-qa/scripts/check-email.mjs +397 -0
  389. package/skills/pixelcraft-visual-qa/scripts/check-pdf.mjs +189 -0
  390. package/skills/pixelcraft-visual-qa/scripts/check-tui.mjs +321 -0
  391. package/skills/pixelcraft-visual-qa/scripts/finish-gate.mjs +174 -0
  392. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-aria-modal.html +19 -0
  393. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-audit.html +34 -0
  394. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-modal.html +17 -0
  395. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-deferred.js +1 -0
  396. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-edge.html +52 -0
  397. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.html +80 -0
  398. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.js +8 -0
  399. package/skills/pixelcraft-visual-qa/scripts/shoot.mjs +668 -0
  400. package/skills/pixelcraft-visual-qa/scripts/style-inventory.mjs +1226 -0
  401. package/skills/pixelcraft-web/SKILL.md +132 -0
  402. package/skills/pixelcraft-web/references/accessibility-performance.md +42 -0
  403. package/skills/pixelcraft-web/references/adaptive-layout.md +69 -0
  404. package/skills/pixelcraft-web/references/angular.md +108 -0
  405. package/skills/pixelcraft-web/references/assets-pipeline.md +67 -0
  406. package/skills/pixelcraft-web/references/astro.md +113 -0
  407. package/skills/pixelcraft-web/references/audio-reactive.md +61 -0
  408. package/skills/pixelcraft-web/references/auth-and-checkout-ui.md +115 -0
  409. package/skills/pixelcraft-web/references/build-and-architecture.md +215 -0
  410. package/skills/pixelcraft-web/references/canvas-and-node-editors.md +157 -0
  411. package/skills/pixelcraft-web/references/clojurescript.md +88 -0
  412. package/skills/pixelcraft-web/references/component-systems.md +102 -0
  413. package/skills/pixelcraft-web/references/component-testing.md +170 -0
  414. package/skills/pixelcraft-web/references/creative-effects.md +59 -0
  415. package/skills/pixelcraft-web/references/creative-runtime.md +34 -0
  416. package/skills/pixelcraft-web/references/elm.md +53 -0
  417. package/skills/pixelcraft-web/references/enterprise-data-ui.md +138 -0
  418. package/skills/pixelcraft-web/references/file-upload-media-ui.md +82 -0
  419. package/skills/pixelcraft-web/references/forms-validation.md +123 -0
  420. package/skills/pixelcraft-web/references/fsharp-fable.md +54 -0
  421. package/skills/pixelcraft-web/references/gsap.md +102 -0
  422. package/skills/pixelcraft-web/references/html-css.md +220 -0
  423. package/skills/pixelcraft-web/references/htmx-alpine.md +103 -0
  424. package/skills/pixelcraft-web/references/i18n-engineering.md +106 -0
  425. package/skills/pixelcraft-web/references/interaction-and-search-primitives.md +196 -0
  426. package/skills/pixelcraft-web/references/java-web.md +61 -0
  427. package/skills/pixelcraft-web/references/kotlin-web.md +57 -0
  428. package/skills/pixelcraft-web/references/leptos-yew.md +97 -0
  429. package/skills/pixelcraft-web/references/lit-web-components.md +63 -0
  430. package/skills/pixelcraft-web/references/local-first-sync.md +105 -0
  431. package/skills/pixelcraft-web/references/media-players.md +104 -0
  432. package/skills/pixelcraft-web/references/motion-react.md +96 -0
  433. package/skills/pixelcraft-web/references/motion-recipes.md +82 -0
  434. package/skills/pixelcraft-web/references/preact-fresh-hono.md +111 -0
  435. package/skills/pixelcraft-web/references/pwa.md +230 -0
  436. package/skills/pixelcraft-web/references/qwik.md +94 -0
  437. package/skills/pixelcraft-web/references/r3f-integration.md +69 -0
  438. package/skills/pixelcraft-web/references/react-next.md +168 -0
  439. package/skills/pixelcraft-web/references/rendering-choice.md +63 -0
  440. package/skills/pixelcraft-web/references/rendering-performance.md +80 -0
  441. package/skills/pixelcraft-web/references/rich-text-and-code-editors.md +220 -0
  442. package/skills/pixelcraft-web/references/rive-lottie.md +73 -0
  443. package/skills/pixelcraft-web/references/scala-laminar.md +53 -0
  444. package/skills/pixelcraft-web/references/scene-architecture.md +132 -0
  445. package/skills/pixelcraft-web/references/server-rendered.md +114 -0
  446. package/skills/pixelcraft-web/references/shader-workflow.md +77 -0
  447. package/skills/pixelcraft-web/references/smooth-scroll.md +58 -0
  448. package/skills/pixelcraft-web/references/solid.md +111 -0
  449. package/skills/pixelcraft-web/references/state-architecture.md +107 -0
  450. package/skills/pixelcraft-web/references/styling-ecosystem.md +273 -0
  451. package/skills/pixelcraft-web/references/svelte.md +111 -0
  452. package/skills/pixelcraft-web/references/tailwind.md +99 -0
  453. package/skills/pixelcraft-web/references/video-media.md +69 -0
  454. package/skills/pixelcraft-web/references/vue-nuxt.md +86 -0
  455. package/skills/pixelcraft-web/references/web-3d-engines.md +97 -0
@@ -0,0 +1,1226 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs';
3
+ import http from 'node:http';
4
+ import path from 'node:path';
5
+ import { createRequire } from 'node:module';
6
+
7
+ function help() {
8
+ return `Usage: node style-inventory.mjs <url-or-html-file> [options]
9
+
10
+ Measure rendered style and implementation signals in a browser. Playwright is
11
+ used only when already installed in the target dependency context; otherwise
12
+ installation guidance is printed and no browser is launched.
13
+
14
+ Options:
15
+ --out FILE Write JSON report to FILE instead of stdout
16
+ --breakpoints LIST Width x height list (default: 390x900,1440x900)
17
+ --project DIR Dependency resolution root (default: current directory)
18
+ --root DIR Static server root for local targets (default: target directory)
19
+ --executable-path FILE Use a specific Chromium/Chrome executable
20
+ --color-scheme MODE Emulate prefers-color-scheme: light or dark
21
+ --reduced-motion MODE Emulate prefers-reduced-motion: no-preference or reduce
22
+ --allow-http-error Measure HTTP 4xx/5xx pages without failing the run
23
+ --timeout MS Navigation timeout in milliseconds (default: 30000)
24
+ --wait-until EVENT Navigation lifecycle event: load or domcontentloaded (default: load)
25
+ --wait-for SELECTOR Wait for a selector after page load
26
+ --wait-ms MS Post-load settle time in milliseconds (default: 2000)
27
+ --compact Emit compact JSON
28
+ --help Show this help
29
+
30
+ The output is heuristic evidence, not an accessibility or quality certification.
31
+ Cross-origin CSS may be unreadable, canvas/WebGL painting can hide text and color,
32
+ network transfer reflects the browser session/cache state, and geometry estimates
33
+ cannot judge semantic intent. Inspect screenshots/tasks alongside this report.
34
+
35
+ Install Playwright in the target project when measurement is desired, for example:
36
+ npm install --save-dev playwright
37
+ npx playwright install chromium
38
+ `;
39
+ }
40
+
41
+ function optionValue(args, index, name) {
42
+ const value = args[index + 1];
43
+ if (value === undefined || value === '') throw new Error(`${name} requires a value`);
44
+ return value;
45
+ }
46
+
47
+ function inlineValue(arg, prefix, name) {
48
+ const value = arg.slice(prefix.length);
49
+ if (value === '') throw new Error(`${name} requires a value`);
50
+ return value;
51
+ }
52
+
53
+ function parse(args) {
54
+ const options = {
55
+ out: null,
56
+ breakpoints: '390x900,1440x900',
57
+ project: process.cwd(),
58
+ root: null,
59
+ timeout: 30000,
60
+ waitUntil: 'load',
61
+ waitFor: null,
62
+ waitMs: 2000,
63
+ compact: false,
64
+ executablePath: null,
65
+ colorScheme: null,
66
+ reducedMotion: null,
67
+ allowHttpError: false,
68
+ help: false,
69
+ };
70
+ const positional = [];
71
+ for (let index = 0; index < args.length; index += 1) {
72
+ const arg = args[index];
73
+ if (arg === '--help' || arg === '-h') options.help = true;
74
+ else if (arg === '--compact') options.compact = true;
75
+ else if (arg === '--allow-http-error') options.allowHttpError = true;
76
+ else if (arg === '--out') {
77
+ options.out = optionValue(args, index, '--out');
78
+ index += 1;
79
+ } else if (arg.startsWith('--out=')) options.out = inlineValue(arg, '--out=', '--out');
80
+ else if (arg === '--breakpoints') {
81
+ options.breakpoints = optionValue(args, index, '--breakpoints');
82
+ index += 1;
83
+ } else if (arg.startsWith('--breakpoints=')) options.breakpoints = inlineValue(arg, '--breakpoints=', '--breakpoints');
84
+ else if (arg === '--project') {
85
+ options.project = optionValue(args, index, '--project');
86
+ index += 1;
87
+ } else if (arg.startsWith('--project=')) options.project = inlineValue(arg, '--project=', '--project');
88
+ else if (arg === '--root') {
89
+ options.root = optionValue(args, index, '--root');
90
+ index += 1;
91
+ } else if (arg.startsWith('--root=')) options.root = inlineValue(arg, '--root=', '--root');
92
+ else if (arg === '--executable-path') {
93
+ options.executablePath = optionValue(args, index, '--executable-path');
94
+ index += 1;
95
+ } else if (arg.startsWith('--executable-path=')) options.executablePath = inlineValue(arg, '--executable-path=', '--executable-path');
96
+ else if (arg === '--color-scheme') {
97
+ options.colorScheme = optionValue(args, index, '--color-scheme');
98
+ index += 1;
99
+ } else if (arg.startsWith('--color-scheme=')) options.colorScheme = inlineValue(arg, '--color-scheme=', '--color-scheme');
100
+ else if (arg === '--reduced-motion') {
101
+ options.reducedMotion = optionValue(args, index, '--reduced-motion');
102
+ index += 1;
103
+ } else if (arg.startsWith('--reduced-motion=')) options.reducedMotion = inlineValue(arg, '--reduced-motion=', '--reduced-motion');
104
+ else if (arg === '--timeout') {
105
+ options.timeout = Number(optionValue(args, index, '--timeout'));
106
+ index += 1;
107
+ } else if (arg.startsWith('--timeout=')) options.timeout = Number(inlineValue(arg, '--timeout=', '--timeout'));
108
+ else if (arg === '--wait-until') {
109
+ options.waitUntil = optionValue(args, index, '--wait-until');
110
+ index += 1;
111
+ } else if (arg.startsWith('--wait-until=')) options.waitUntil = inlineValue(arg, '--wait-until=', '--wait-until');
112
+ else if (arg === '--wait-for') {
113
+ options.waitFor = optionValue(args, index, '--wait-for');
114
+ index += 1;
115
+ } else if (arg.startsWith('--wait-for=')) options.waitFor = inlineValue(arg, '--wait-for=', '--wait-for');
116
+ else if (arg === '--wait-ms') {
117
+ options.waitMs = Number(optionValue(args, index, '--wait-ms'));
118
+ index += 1;
119
+ } else if (arg.startsWith('--wait-ms=')) options.waitMs = Number(inlineValue(arg, '--wait-ms=', '--wait-ms'));
120
+ else if (arg.startsWith('-')) throw new Error(`unknown option: ${arg}`);
121
+ else positional.push(arg);
122
+ }
123
+ if (!Number.isFinite(options.timeout) || options.timeout <= 0) throw new Error('--timeout must be a positive number');
124
+ if (!Number.isFinite(options.waitMs) || options.waitMs < 0) throw new Error('--wait-ms must be a non-negative number');
125
+ if (options.waitUntil !== 'load' && options.waitUntil !== 'domcontentloaded') throw new Error(`--wait-until must be 'load' or 'domcontentloaded', got '${options.waitUntil}'`);
126
+ if (options.colorScheme !== null && options.colorScheme !== 'light' && options.colorScheme !== 'dark') {
127
+ throw new Error(`--color-scheme must be 'light' or 'dark', got '${options.colorScheme}'`);
128
+ }
129
+ if (options.reducedMotion !== null && options.reducedMotion !== 'no-preference' && options.reducedMotion !== 'reduce') {
130
+ throw new Error(`--reduced-motion must be 'no-preference' or 'reduce', got '${options.reducedMotion}'`);
131
+ }
132
+ return { positional, options };
133
+ }
134
+
135
+ function parseBreakpoints(value) {
136
+ return value.split(',').map((part) => {
137
+ const match = /^(\d{3,5})x(\d{3,5})$/.exec(part.trim());
138
+ if (!match) throw new Error(`invalid breakpoint '${part}'; expected WIDTHxHEIGHT`);
139
+ return { width: Number(match[1]), height: Number(match[2]) };
140
+ });
141
+ }
142
+
143
+ async function loadChromium(project) {
144
+ try {
145
+ const projectRequire = createRequire(path.join(path.resolve(project), 'pixelcraft-style-require.cjs'));
146
+ return projectRequire('playwright').chromium;
147
+ } catch {
148
+ try {
149
+ return (await import('playwright')).chromium;
150
+ } catch {
151
+ return null;
152
+ }
153
+ }
154
+ }
155
+
156
+ const mimeTypes = new Map(Object.entries({
157
+ '.html': 'text/html; charset=utf-8',
158
+ '.htm': 'text/html; charset=utf-8',
159
+ '.css': 'text/css; charset=utf-8',
160
+ '.js': 'text/javascript; charset=utf-8',
161
+ '.mjs': 'text/javascript; charset=utf-8',
162
+ '.json': 'application/json; charset=utf-8',
163
+ '.svg': 'image/svg+xml',
164
+ '.png': 'image/png',
165
+ '.jpg': 'image/jpeg',
166
+ '.jpeg': 'image/jpeg',
167
+ '.gif': 'image/gif',
168
+ '.webp': 'image/webp',
169
+ '.avif': 'image/avif',
170
+ '.ico': 'image/x-icon',
171
+ '.woff': 'font/woff',
172
+ '.woff2': 'font/woff2',
173
+ '.txt': 'text/plain; charset=utf-8',
174
+ '.wasm': 'application/wasm',
175
+ }));
176
+
177
+ async function createStaticTarget(input, options) {
178
+ if (/^https?:\/\//i.test(input)) return { url: input, local: false, async close() {} };
179
+ const resolved = path.resolve(input);
180
+ if (!fs.existsSync(resolved)) throw new Error(`target is neither an http(s) URL nor an existing HTML file: ${input}`);
181
+ const stat = fs.statSync(resolved);
182
+ const targetFile = stat.isDirectory() ? path.join(resolved, 'index.html') : resolved;
183
+ if (!fs.existsSync(targetFile) || !fs.statSync(targetFile).isFile()) throw new Error(`target is not a readable HTML file: ${input}`);
184
+ const fallbackRoot = stat.isDirectory() ? resolved : path.dirname(resolved);
185
+ const configuredRoot = path.resolve(options.root || fallbackRoot);
186
+ if (!fs.existsSync(configuredRoot) || !fs.statSync(configuredRoot).isDirectory()) throw new Error(`static server root is not a directory: ${configuredRoot}`);
187
+ const lexicalRoot = configuredRoot;
188
+ const root = fs.realpathSync(configuredRoot);
189
+ const rootPrefix = root.endsWith(path.sep) ? root : `${root}${path.sep}`;
190
+ const lexicalTarget = path.relative(lexicalRoot, resolved);
191
+ if (lexicalTarget.startsWith('..') || path.isAbsolute(lexicalTarget)) throw new Error(`local target is outside the static server root: target=${resolved}; root=${lexicalRoot}`);
192
+ const realTarget = fs.realpathSync(targetFile);
193
+ const realRelativeTarget = path.relative(root, realTarget);
194
+ if (realRelativeTarget.startsWith('..') || path.isAbsolute(realRelativeTarget)) throw new Error(`local target resolves outside the static server root: target=${realTarget}; root=${root}`);
195
+ const encodedTarget = lexicalTarget.split(path.sep).filter(Boolean).map(encodeURIComponent).join('/');
196
+ let initialPath = encodedTarget ? `/${encodedTarget}` : '/';
197
+ if (stat.isDirectory() && !initialPath.endsWith('/')) initialPath += '/';
198
+ const server = http.createServer((request, response) => {
199
+ let pathname;
200
+ try {
201
+ pathname = decodeURIComponent(new URL(request.url, 'http://127.0.0.1').pathname);
202
+ } catch {
203
+ response.writeHead(400).end('bad request');
204
+ return;
205
+ }
206
+ if (pathname.endsWith('/')) pathname += 'index.html';
207
+ if (pathname.split('/').some((part) => part.startsWith('.'))) {
208
+ response.writeHead(404).end('not found');
209
+ return;
210
+ }
211
+ const file = path.resolve(root, `.${pathname}`);
212
+ if (file !== root && !file.startsWith(rootPrefix)) {
213
+ response.writeHead(403).end('forbidden');
214
+ return;
215
+ }
216
+ let fileStat;
217
+ let realFile;
218
+ try {
219
+ realFile = fs.realpathSync(file);
220
+ fileStat = fs.statSync(realFile);
221
+ } catch {
222
+ response.writeHead(404).end('not found');
223
+ return;
224
+ }
225
+ if (realFile !== root && !realFile.startsWith(rootPrefix)) {
226
+ response.writeHead(403).end('forbidden');
227
+ return;
228
+ }
229
+ if (!fileStat.isFile()) {
230
+ response.writeHead(404).end('not found');
231
+ return;
232
+ }
233
+ response.writeHead(200, {
234
+ 'content-type': mimeTypes.get(path.extname(file).toLowerCase()) || 'application/octet-stream',
235
+ 'cache-control': 'no-store',
236
+ });
237
+ fs.createReadStream(realFile).pipe(response);
238
+ });
239
+ await new Promise((resolve, reject) => {
240
+ server.once('error', reject);
241
+ server.listen(0, '127.0.0.1', resolve);
242
+ });
243
+ const { port } = server.address();
244
+ return {
245
+ url: `http://127.0.0.1:${port}${initialPath}`,
246
+ local: true,
247
+ close: () => new Promise((resolve) => server.close(resolve)),
248
+ };
249
+ }
250
+
251
+ function emptyNetworkPhase() {
252
+ return { requests: 0, transferBytes: 0, jsBytes: 0 };
253
+ }
254
+
255
+ function observeNetwork(session, mainFrameId = null, waitUntil = 'load') {
256
+ let phaseBoundarySeen = false;
257
+ const active = new Map();
258
+ const network = {
259
+ status: 0,
260
+ requests: 0,
261
+ failedRequests: 0,
262
+ pendingRequests: 0,
263
+ redirects: 0,
264
+ transferBytes: 0,
265
+ jsBytes: 0,
266
+ initial: emptyNetworkPhase(),
267
+ deferred: emptyNetworkPhase(),
268
+ resourceTypes: {},
269
+ };
270
+
271
+ function resourceBucket(type) {
272
+ const key = (type || 'Other').toLowerCase();
273
+ if (!network.resourceTypes[key]) network.resourceTypes[key] = { requests: 0, transferBytes: 0 };
274
+ return network.resourceTypes[key];
275
+ }
276
+
277
+ function addBytes(type, phase, bytes) {
278
+ if (!bytes) return;
279
+ const bucket = network[phase];
280
+ network.transferBytes += bytes;
281
+ bucket.transferBytes += bytes;
282
+ resourceBucket(type).transferBytes += bytes;
283
+ if ((type || '').toLowerCase() === 'script') {
284
+ network.jsBytes += bytes;
285
+ bucket.jsBytes += bytes;
286
+ }
287
+ }
288
+
289
+ const boundaryEvent = waitUntil === 'domcontentloaded' ? 'Page.domContentEventFired' : 'Page.loadEventFired';
290
+ session.on(boundaryEvent, () => {
291
+ phaseBoundarySeen = true;
292
+ });
293
+ session.on('Network.requestWillBeSent', (event) => {
294
+ const existing = active.get(event.requestId);
295
+ const redirectBytes = event.redirectResponse ? (event.redirectResponse.encodedDataLength || 0) : 0;
296
+ if (event.redirectResponse) network.redirects += 1;
297
+ if (existing) {
298
+ if (redirectBytes) addBytes(existing.type, existing.phase, redirectBytes);
299
+ return;
300
+ }
301
+ const type = event.type || 'Other';
302
+ const phase = phaseBoundarySeen ? 'deferred' : 'initial';
303
+ active.set(event.requestId, { type, phase });
304
+ network.requests += 1;
305
+ network[phase].requests += 1;
306
+ resourceBucket(type).requests += 1;
307
+ if (redirectBytes) addBytes(type, phase, redirectBytes);
308
+ });
309
+ session.on('Network.responseReceived', (event) => {
310
+ if (event.type === 'Document' && (!mainFrameId || event.frameId === mainFrameId)) {
311
+ network.status = event.response.status;
312
+ }
313
+ });
314
+ session.on('Network.loadingFinished', (event) => {
315
+ const record = active.get(event.requestId);
316
+ const type = record?.type || 'Other';
317
+ const phase = record?.phase || (phaseBoundarySeen ? 'deferred' : 'initial');
318
+ addBytes(type, phase, event.encodedDataLength || 0);
319
+ active.delete(event.requestId);
320
+ });
321
+ session.on('Network.loadingFailed', (event) => {
322
+ const record = active.get(event.requestId);
323
+ const type = record?.type || 'Other';
324
+ const phase = record?.phase || (phaseBoundarySeen ? 'deferred' : 'initial');
325
+ network.failedRequests += 1;
326
+ addBytes(type, phase, event.encodedDataLength || 0);
327
+ active.delete(event.requestId);
328
+ });
329
+
330
+ return {
331
+ network,
332
+ snapshot() {
333
+ network.pendingRequests = active.size;
334
+ return network;
335
+ },
336
+ };
337
+ }
338
+
339
+ const extract = String.raw`((extractOptions = {}) => {
340
+ const viewportWidth = window.innerWidth;
341
+ const viewportHeight = window.innerHeight;
342
+ const navigation = performance.getEntriesByType('navigation')[0] || {};
343
+ const state = window.__pixelcraftInventory || { lcp: null, cls: 0 };
344
+
345
+ function clamp(value, minimum, maximum) {
346
+ return Math.max(minimum, Math.min(maximum, value));
347
+ }
348
+
349
+ function round(value, digits = 2) {
350
+ if (!Number.isFinite(value)) return null;
351
+ const scale = 10 ** digits;
352
+ return Math.round(value * scale) / scale;
353
+ }
354
+
355
+ function parseSerializedColor(value) {
356
+ if (typeof value !== 'string') return null;
357
+ const text = value.trim().toLowerCase();
358
+ if (!text) return null;
359
+ if (text === 'transparent') return { r: 0, g: 0, b: 0, a: 0 };
360
+ const hex = /^#([0-9a-f]{3,8})$/.exec(text);
361
+ if (hex) {
362
+ const digits = hex[1];
363
+ const expand = (part) => Number.parseInt(part.length === 1 ? part + part : part, 16);
364
+ if (digits.length === 3 || digits.length === 4) {
365
+ return { r: expand(digits[0]), g: expand(digits[1]), b: expand(digits[2]), a: digits.length === 4 ? expand(digits[3]) / 255 : 1 };
366
+ }
367
+ if (digits.length === 6 || digits.length === 8) {
368
+ return { r: expand(digits.slice(0, 2)), g: expand(digits.slice(2, 4)), b: expand(digits.slice(4, 6)), a: digits.length === 8 ? expand(digits.slice(6, 8)) / 255 : 1 };
369
+ }
370
+ return null;
371
+ }
372
+ const functional = /^rgba?\((.*)\)$/.exec(text);
373
+ if (!functional) return null;
374
+ const body = functional[1].trim();
375
+ const channel = (part) => {
376
+ const number = Number.parseFloat(part);
377
+ if (!Number.isFinite(number)) return null;
378
+ return clamp(part.trim().endsWith('%') ? number * 2.55 : number, 0, 255);
379
+ };
380
+ const alphaValue = (part) => {
381
+ if (part === undefined || part === '') return 1;
382
+ const number = Number.parseFloat(part);
383
+ if (!Number.isFinite(number)) return null;
384
+ return clamp(part.trim().endsWith('%') ? number / 100 : number, 0, 1);
385
+ };
386
+ let parts;
387
+ let alpha;
388
+ if (body.includes(',')) {
389
+ parts = body.split(',').map((part) => part.trim()).slice(0, 3);
390
+ alpha = alphaValue(body.split(',')[3]);
391
+ } else {
392
+ const pieces = body.split('/').map((part) => part.trim());
393
+ parts = pieces[0].split(/\s+/).filter(Boolean).slice(0, 3);
394
+ alpha = alphaValue(pieces[1]);
395
+ }
396
+ if (parts.length !== 3 || alpha === null) return null;
397
+ const channels = parts.map(channel);
398
+ if (channels.some((part) => part === null)) return null;
399
+ return { r: channels[0], g: channels[1], b: channels[2], a: alpha };
400
+ }
401
+
402
+ function parseColor(value) {
403
+ const direct = parseSerializedColor(value);
404
+ if (direct) return direct;
405
+ if (!value) return null;
406
+ try {
407
+ if (!parseColor.context) parseColor.context = document.createElement('canvas').getContext('2d');
408
+ const context = parseColor.context;
409
+ if (!context) return null;
410
+ for (const sentinel of ['#010203', '#040506']) {
411
+ context.fillStyle = sentinel;
412
+ const before = context.fillStyle;
413
+ context.fillStyle = value;
414
+ if (context.fillStyle !== before) return parseSerializedColor(context.fillStyle);
415
+ }
416
+ } catch {}
417
+ return null;
418
+ }
419
+
420
+ function luminance(color) {
421
+ const convert = (channel) => {
422
+ const value = channel / 255;
423
+ return value <= 0.04045 ? value / 12.92 : Math.pow((value + 0.055) / 1.055, 2.4);
424
+ };
425
+ return 0.2126 * convert(color.r) + 0.7152 * convert(color.g) + 0.0722 * convert(color.b);
426
+ }
427
+
428
+ function contrastRatio(first, second) {
429
+ const one = luminance(first);
430
+ const two = luminance(second);
431
+ return (Math.max(one, two) + 0.05) / (Math.min(one, two) + 0.05);
432
+ }
433
+
434
+ function alphaBlend(source, destination) {
435
+ const alpha = source.a + destination.a * (1 - source.a);
436
+ if (alpha === 0) return { r: 0, g: 0, b: 0, a: 0 };
437
+ return {
438
+ r: (source.r * source.a + destination.r * destination.a * (1 - source.a)) / alpha,
439
+ g: (source.g * source.a + destination.g * destination.a * (1 - source.a)) / alpha,
440
+ b: (source.b * source.a + destination.b * destination.a * (1 - source.a)) / alpha,
441
+ a: alpha,
442
+ };
443
+ }
444
+
445
+ function colorKey(color) {
446
+ if (!color) return null;
447
+ const quantize = (channel) => clamp(Math.round(channel / 8) * 8, 0, 255);
448
+ return [quantize(color.r), quantize(color.g), quantize(color.b)].join(',');
449
+ }
450
+
451
+ function hexColor(key) {
452
+ const parts = key.split(',').map(Number);
453
+ return '#' + parts.map((part) => clamp(part, 0, 255).toString(16).padStart(2, '0')).join('');
454
+ }
455
+
456
+ function addArea(map, key, area) {
457
+ if (!key || !Number.isFinite(area) || area <= 0) return;
458
+ map.set(key, (map.get(key) || 0) + area);
459
+ }
460
+
461
+ function isZeroClip(style) {
462
+ return /^rect\(\s*0(?:px)?\s*,\s*0(?:px)?\s*,\s*0(?:px)?\s*,\s*0(?:px)?\s*\)$/i.test(style.clip || '')
463
+ || /^inset\(\s*(?:50%|100%)\s*\)$/i.test((style.clipPath || '').trim());
464
+ }
465
+
466
+ function establishesFixedContainingBlock(style) {
467
+ return (style.transform && style.transform !== 'none')
468
+ || (style.filter && style.filter !== 'none')
469
+ || (style.perspective && style.perspective !== 'none')
470
+ || /paint|layout|strict|content/.test(style.contain || '')
471
+ || /transform|filter|perspective/.test(style.willChange || '');
472
+ }
473
+
474
+ function clippedRect(element) {
475
+ const rect = element.getBoundingClientRect();
476
+ let left = Math.max(0, rect.left);
477
+ let top = Math.max(0, rect.top);
478
+ let right = Math.min(viewportWidth, rect.right);
479
+ let bottom = Math.min(viewportHeight, rect.bottom);
480
+ const ownStyle = styleOf(element);
481
+ if (isZeroClip(ownStyle)) {
482
+ return { left: 0, top: 0, right: 0, bottom: 0, width: 0, height: 0, elementWidth: rect.width, elementHeight: rect.height, area: 0 };
483
+ }
484
+ let positioned = ownStyle.position;
485
+ let node = element.parentElement;
486
+ while (node && node.nodeType === 1 && node !== document.documentElement && right > left && bottom > top) {
487
+ const ancStyle = styleOf(node);
488
+ const fixedCB = establishesFixedContainingBlock(ancStyle);
489
+ if (positioned === 'fixed') {
490
+ if (!fixedCB) {
491
+ node = node.parentElement;
492
+ continue;
493
+ }
494
+ positioned = ancStyle.position;
495
+ } else if (positioned === 'absolute') {
496
+ if (ancStyle.position === 'static' && !fixedCB) {
497
+ node = node.parentElement;
498
+ continue;
499
+ }
500
+ positioned = ancStyle.position;
501
+ } else {
502
+ positioned = ancStyle.position;
503
+ }
504
+ if (isZeroClip(ancStyle)) {
505
+ left = 0;
506
+ top = 0;
507
+ right = 0;
508
+ bottom = 0;
509
+ break;
510
+ }
511
+ const clipsX = /^(hidden|clip|scroll|auto)$/.test(ancStyle.overflowX);
512
+ const clipsY = /^(hidden|clip|scroll|auto)$/.test(ancStyle.overflowY);
513
+ if (clipsX || clipsY) {
514
+ const ancRect = node.getBoundingClientRect();
515
+ if (clipsX) {
516
+ left = Math.max(left, ancRect.left);
517
+ right = Math.min(right, ancRect.right);
518
+ }
519
+ if (clipsY) {
520
+ top = Math.max(top, ancRect.top);
521
+ bottom = Math.min(bottom, ancRect.bottom);
522
+ }
523
+ }
524
+ node = node.parentElement;
525
+ }
526
+ const width = Math.max(0, right - left);
527
+ const height = Math.max(0, bottom - top);
528
+ return { left, top, right, bottom, width, height, elementWidth: rect.width, elementHeight: rect.height, area: width * height };
529
+ }
530
+
531
+ function hasDirectText(element) {
532
+ for (const node of element.childNodes) {
533
+ if (node.nodeType === 3 && node.textContent.trim()) return true;
534
+ }
535
+ return false;
536
+ }
537
+
538
+ function splitCssList(value) {
539
+ const parts = [];
540
+ let current = '';
541
+ let quote = '';
542
+ let depth = 0;
543
+ let escaped = false;
544
+ for (const char of value) {
545
+ if (escaped) {
546
+ current += char;
547
+ escaped = false;
548
+ continue;
549
+ }
550
+ if (char === '\\') {
551
+ current += char;
552
+ escaped = true;
553
+ continue;
554
+ }
555
+ if (quote) {
556
+ current += char;
557
+ if (char === quote) quote = '';
558
+ continue;
559
+ }
560
+ if (char === '"' || char === "'") {
561
+ quote = char;
562
+ current += char;
563
+ continue;
564
+ }
565
+ if (char === '(') depth += 1;
566
+ if (char === ')') depth = Math.max(0, depth - 1);
567
+ if (char === ',' && depth === 0) {
568
+ parts.push(current.trim());
569
+ current = '';
570
+ } else {
571
+ current += char;
572
+ }
573
+ }
574
+ parts.push(current.trim());
575
+ return parts.filter(Boolean);
576
+ }
577
+
578
+ function splitWhitespaceOutsideParens(value) {
579
+ const parts = [];
580
+ let current = '';
581
+ let depth = 0;
582
+ for (const char of value.trim()) {
583
+ if (char === '(') depth += 1;
584
+ if (char === ')') depth = Math.max(0, depth - 1);
585
+ if (/\s/.test(char) && depth === 0) {
586
+ if (current) parts.push(current);
587
+ current = '';
588
+ } else {
589
+ current += char;
590
+ }
591
+ }
592
+ if (current) parts.push(current);
593
+ return parts;
594
+ }
595
+
596
+ function cleanFontName(value) {
597
+ let name = value.trim().replace(/\s+/g, ' ');
598
+ if (name.length >= 2) {
599
+ const first = name[0];
600
+ const last = name[name.length - 1];
601
+ if ((first === '"' && last === '"') || (first === "'" && last === "'")) name = name.slice(1, -1);
602
+ }
603
+ return name.toLowerCase();
604
+ }
605
+
606
+ const genericFamilies = new Set(['serif', 'sans-serif', 'monospace', 'cursive', 'fantasy', 'system-ui', 'ui-serif', 'ui-sans-serif', 'ui-monospace', 'ui-rounded', 'emoji', 'math', 'fangsong']);
607
+ const fontStackCache = new Map();
608
+
609
+ function analyzeFontStack(stack) {
610
+ if (fontStackCache.has(stack)) return fontStackCache.get(stack);
611
+ const names = splitCssList(stack).map(cleanFontName).filter(Boolean);
612
+ const primaryIndex = names.length ? 0 : -1;
613
+ const result = {
614
+ names,
615
+ primary: primaryIndex >= 0 ? names[primaryIndex] : null,
616
+ fallbacks: primaryIndex >= 0 ? names.slice(primaryIndex + 1) : [],
617
+ declared: [...new Set(names.filter((name) => !genericFamilies.has(name)))],
618
+ };
619
+ fontStackCache.set(stack, result);
620
+ return result;
621
+ }
622
+
623
+ function median(values) {
624
+ if (!values.length) return null;
625
+ const sorted = [...values].sort((a, b) => a - b);
626
+ const middle = Math.floor(sorted.length / 2);
627
+ if (sorted.length % 2) return sorted[middle];
628
+ return (sorted[middle - 1] + sorted[middle]) / 2;
629
+ }
630
+
631
+ function unionArea(rects) {
632
+ if (!rects.length) return 0;
633
+ const xs = [...new Set(rects.flatMap((rect) => [rect.left, rect.right]))].sort((a, b) => a - b);
634
+ let area = 0;
635
+ for (let index = 0; index < xs.length - 1; index += 1) {
636
+ const x0 = xs[index];
637
+ const x1 = xs[index + 1];
638
+ if (x1 <= x0) continue;
639
+ const intervals = [];
640
+ for (const rect of rects) {
641
+ if (rect.left < x1 && rect.right > x0) intervals.push([rect.top, rect.bottom]);
642
+ }
643
+ if (!intervals.length) continue;
644
+ intervals.sort((a, b) => a[0] - b[0]);
645
+ let covered = 0;
646
+ let start = null;
647
+ let end = null;
648
+ for (const interval of intervals) {
649
+ if (start === null || interval[0] > end) {
650
+ if (start !== null) covered += end - start;
651
+ start = interval[0];
652
+ end = interval[1];
653
+ } else {
654
+ end = Math.max(end, interval[1]);
655
+ }
656
+ }
657
+ if (start !== null) covered += end - start;
658
+ area += (x1 - x0) * covered;
659
+ }
660
+ return area;
661
+ }
662
+
663
+ const scanLimit = 6000;
664
+ const roots = [document.documentElement];
665
+ if (document.body) roots.push(document.body, ...document.body.querySelectorAll('*'));
666
+ const visible = [];
667
+ const styleCache = new WeakMap();
668
+ function styleOf(element) {
669
+ let style = styleCache.get(element);
670
+ if (!style) {
671
+ style = getComputedStyle(element);
672
+ styleCache.set(element, style);
673
+ }
674
+ return style;
675
+ }
676
+
677
+ function hasTransparentAncestor(element) {
678
+ let node = element;
679
+ while (node && node.nodeType === 1) {
680
+ if (Number.parseFloat(styleOf(node).opacity) <= 0) return true;
681
+ node = node.parentElement;
682
+ }
683
+ return false;
684
+ }
685
+
686
+ for (const element of roots.slice(0, scanLimit)) {
687
+ const style = styleOf(element);
688
+ const rect = clippedRect(element);
689
+ if (rect.area <= 0.5) continue;
690
+ if (style.visibility === 'hidden' || style.visibility === 'collapse') continue;
691
+ if (hasTransparentAncestor(element)) continue;
692
+ visible.push({ element, style, rect, area: rect.area });
693
+ }
694
+
695
+ const fontFaces = new Map();
696
+ const fontAreas = new Map();
697
+ const declaredNames = new Set();
698
+ const fallbackNames = new Set();
699
+ const fontSizes = new Map();
700
+ const lineHeights = new Map();
701
+ const inkColors = new Map();
702
+ const backgroundColors = new Map();
703
+ const displayLetterSpacing = new Set();
704
+ const grids = [];
705
+ const contentWidths = [];
706
+ const leaf = [];
707
+ const textLeaf = [];
708
+ const cursorValues = new Set();
709
+ let animationCount = 0;
710
+ let transitionCount = 0;
711
+
712
+ function positiveDuration(value) {
713
+ return value.split(',').some((part) => Number.parseFloat(part) > 0);
714
+ }
715
+
716
+ for (const item of visible) {
717
+ const { element, style, rect, area } = item;
718
+ const directText = hasDirectText(element);
719
+ const mediaOrControl = /^(IMG|VIDEO|CANVAS|SVG|PICTURE|IFRAME|AUDIO|INPUT|TEXTAREA|SELECT|BUTTON|OBJECT|EMBED)$/.test(element.tagName);
720
+ const background = parseColor(style.backgroundColor);
721
+ if (background && background.a > 0.05) addArea(backgroundColors, colorKey(background), area * clamp(background.a, 0, 1));
722
+ if (style.cursor) cursorValues.add(style.cursor);
723
+
724
+ if (style.display.includes('grid') && rect.width > viewportWidth * 0.3 && style.gridTemplateColumns !== 'none') {
725
+ grids.push({
726
+ columns: splitWhitespaceOutsideParens(style.gridTemplateColumns).length,
727
+ template: style.gridTemplateColumns.slice(0, 120),
728
+ gap: style.columnGap,
729
+ width: Math.round(rect.width),
730
+ });
731
+ }
732
+
733
+ const animationNamed = style.animationName.split(',').some((name) => name.trim() !== 'none');
734
+ if (animationNamed && positiveDuration(style.animationDuration)) animationCount += 1;
735
+ const transitionNamed = style.transitionProperty.split(',').some((name) => name.trim() !== 'none');
736
+ if (transitionNamed && positiveDuration(style.transitionDuration)) transitionCount += 1;
737
+
738
+ if (!directText && !mediaOrControl) continue;
739
+ leaf.push(item);
740
+
741
+ if (!directText) continue;
742
+ contentWidths.push(rect.elementWidth);
743
+ textLeaf.push(item);
744
+ const font = analyzeFontStack(style.fontFamily);
745
+ for (const name of font.declared) declaredNames.add(name);
746
+ for (const name of font.fallbacks) fallbackNames.add(name);
747
+ if (font.primary) {
748
+ addArea(fontAreas, font.primary, area);
749
+ const faceKey = JSON.stringify([font.primary, style.fontWeight, style.fontStyle]);
750
+ addArea(fontFaces, faceKey, area);
751
+ }
752
+ const size = Number.parseFloat(style.fontSize);
753
+ if (Number.isFinite(size)) addArea(fontSizes, String(round(size, 1)), area);
754
+ addArea(lineHeights, style.lineHeight, area);
755
+ const ink = parseColor(style.color);
756
+ if (ink && ink.a > 0.05) addArea(inkColors, colorKey(ink), area * clamp(ink.a, 0, 1));
757
+ if (size >= 28 || /^H[12]$/.test(element.tagName)) displayLetterSpacing.add(style.letterSpacing);
758
+ }
759
+
760
+ const documentFontFaces = [];
761
+ let fontFaceCount = 0;
762
+ try {
763
+ if (document.fonts && typeof document.fonts.forEach === 'function') {
764
+ document.fonts.forEach((face) => {
765
+ fontFaceCount += 1;
766
+ if (documentFontFaces.length < 24) {
767
+ documentFontFaces.push({ family: String(face.family).replace(/^["']|["']$/g, '').toLowerCase(), weight: String(face.weight), style: face.style, status: face.status });
768
+ }
769
+ });
770
+ }
771
+ } catch {}
772
+
773
+ const sizeValues = [...fontSizes.keys()].map(Number).filter((value) => Number.isFinite(value) && value >= 8);
774
+ const maxSize = sizeValues.length ? Math.max(...sizeValues) : null;
775
+ const minSize = sizeValues.length ? Math.min(...sizeValues) : null;
776
+ const typeRatio = maxSize !== null && minSize ? round(maxSize / minSize, 2) : null;
777
+
778
+ const backgroundEntries = [...backgroundColors.entries()].sort((a, b) => b[1] - a[1]);
779
+ const inkEntries = [...inkColors.entries()].sort((a, b) => b[1] - a[1]);
780
+ const distinctColors = new Set([...backgroundColors.keys(), ...inkColors.keys()]);
781
+ const isDarkEmulation = extractOptions.colorScheme === 'dark';
782
+ const dominantFallback = isDarkEmulation ? '18,18,18' : '255,255,255';
783
+ const dominantKey = backgroundEntries[0]?.[0] || dominantFallback;
784
+ const dominantParts = dominantKey.split(',').map(Number);
785
+ const dominantDefaultChannel = isDarkEmulation ? 18 : 255;
786
+ const dominantColor = {
787
+ r: Number.isFinite(dominantParts[0]) ? dominantParts[0] : dominantDefaultChannel,
788
+ g: Number.isFinite(dominantParts[1]) ? dominantParts[1] : dominantDefaultChannel,
789
+ b: Number.isFinite(dominantParts[2]) ? dominantParts[2] : dominantDefaultChannel,
790
+ a: 1,
791
+ };
792
+
793
+ const geometryLeaf = leaf.slice(0, 1000);
794
+ const occupiedArea = unionArea(geometryLeaf.map((item) => item.rect));
795
+ let weightedCenter = 0;
796
+ let totalLeafArea = 0;
797
+ for (const item of geometryLeaf) {
798
+ weightedCenter += item.area * (item.rect.left + item.rect.width / 2);
799
+ totalLeafArea += item.area;
800
+ }
801
+ const centroid = totalLeafArea ? weightedCenter / totalLeafArea : viewportWidth / 2;
802
+
803
+ let overlapCount = 0;
804
+ const overlapLimit = Math.min(geometryLeaf.length, 180);
805
+ for (let first = 0; first < overlapLimit; first += 1) {
806
+ for (let second = first + 1; second < overlapLimit; second += 1) {
807
+ const a = geometryLeaf[first];
808
+ const b = geometryLeaf[second];
809
+ if (a.element.contains(b.element) || b.element.contains(a.element)) continue;
810
+ const width = Math.min(a.rect.right, b.rect.right) - Math.max(a.rect.left, b.rect.left);
811
+ const height = Math.min(a.rect.bottom, b.rect.bottom) - Math.max(a.rect.top, b.rect.top);
812
+ if (width > 8 && height > 8 && width * height > Math.min(a.rect.width * a.rect.height, b.rect.width * b.rect.height) * 0.28) overlapCount += 1;
813
+ }
814
+ }
815
+
816
+ let cssText = '';
817
+ for (const sheet of document.styleSheets) {
818
+ try {
819
+ for (const rule of sheet.cssRules) {
820
+ if (cssText.length >= 250000) break;
821
+ cssText += rule.cssText + '\n';
822
+ }
823
+ } catch {}
824
+ }
825
+ const inlineStyles = [...document.querySelectorAll('[style]')].slice(0, 1000).map((element) => element.getAttribute('style') || '').join('\n');
826
+ const cssLower = (cssText + '\n' + inlineStyles).toLowerCase();
827
+
828
+ const scriptUrls = [];
829
+ let inlineScripts = '';
830
+ for (const script of document.scripts) {
831
+ if (script.src) scriptUrls.push(script.src);
832
+ const inline = script.textContent || '';
833
+ if (inline && inlineScripts.length < 250000) inlineScripts += inline.slice(0, 10000) + '\n';
834
+ }
835
+ const scriptHaystack = (scriptUrls.join('\n') + '\n' + inlineScripts).toLowerCase();
836
+
837
+ const libraries = {
838
+ gsap: Boolean(window.gsap) || /\bgsap\b/.test(scriptHaystack),
839
+ scrollTrigger: Boolean(window.ScrollTrigger) || /\bscrolltrigger\b/.test(scriptHaystack),
840
+ lenis: Boolean(window.Lenis) || /\blenis\b/.test(scriptHaystack),
841
+ locomotive: Boolean(window.LocomotiveScroll) || /\blocomotive(?:-scroll)?\b/.test(scriptHaystack),
842
+ three: Boolean(window.THREE) || /\bthree(?:\.min|\.module)?\.js\b|@react-three/.test(scriptHaystack),
843
+ barba: Boolean(window.barba) || /\bbarba\b/.test(scriptHaystack),
844
+ swup: Boolean(window.Swup) || /\bswup\b/.test(scriptHaystack),
845
+ framerMotion: /framer-motion|motion\/react|motionone|motion\.one/.test(scriptHaystack),
846
+ motion: /motion\/react|motion-dom|motionone|motion\.one/.test(scriptHaystack),
847
+ rive: Boolean(window.rive) || /\brive(?:\.min)?\.js\b|@rive-app\//.test(scriptHaystack),
848
+ lottie: Boolean(window.lottie) || /\blottie(?:\.min)?\.js\b|\blottie-web\b/.test(scriptHaystack),
849
+ pixi: Boolean(window.PIXI) || /\bpixi(?:\.min|\.mjs)?\.js\b|pixi\.js/.test(scriptHaystack),
850
+ babylon: Boolean(window.BABYLON) || /\bbabylon(?:\.min)?\.js\b|@babylonjs\//.test(scriptHaystack),
851
+ spline: Boolean(document.querySelector('spline-viewer')) || /@splinetool\/|spline-viewer/.test(scriptHaystack),
852
+ playcanvas: Boolean(window.pc) || /\bplaycanvas\b/.test(scriptHaystack),
853
+ };
854
+ const browserTechniques = {
855
+ cssScrollTimeline: /scroll-timeline|animation-timeline|view-timeline/.test(cssLower),
856
+ viewTransitions: /@view-transition|view-transition|startviewtransition\s*\(/.test(cssLower + '\n' + scriptHaystack),
857
+ webgpu: /navigator\.gpu|\brequestadapter\b/.test(scriptHaystack),
858
+ anchorPositioning: /anchor-name|position-anchor/.test(cssLower),
859
+ startingStyle: /@starting-style/.test(cssLower),
860
+ popover: Boolean(document.querySelector('[popover]')) || /:popover-open/.test(cssLower),
861
+ containerQueries: /@container\b/.test(cssLower),
862
+ lightDark: /light-dark\s*\(/.test(cssLower),
863
+ oklch: /oklch\s*\(/.test(cssLower),
864
+ reducedTransparencyCSS: /prefers-reduced-transparency/.test(cssLower),
865
+ };
866
+
867
+ const bodyStyle = document.body ? styleOf(document.body) : null;
868
+ const rootStyle = styleOf(document.documentElement);
869
+ const hiddenBodyOverflow = Boolean(
870
+ (bodyStyle && /hidden|clip/.test(bodyStyle.overflow + ' ' + bodyStyle.overflowX + ' ' + bodyStyle.overflowY))
871
+ || /hidden|clip/.test(rootStyle.overflow + ' ' + rootStyle.overflowX + ' ' + rootStyle.overflowY),
872
+ );
873
+ const wheelOrTouchHandlerHint = /addeventlistener\(\s*['"](?:wheel|mousewheel|touchmove)|\bon(?:wheel|mousewheel|touchmove)\s*=/.test(scriptHaystack) || Boolean(document.querySelector('[onwheel],[onmousewheel],[ontouchmove]'));
874
+ const sectionIdList = [...document.querySelectorAll('section[id]')].map((element) => element.id);
875
+ const sectionIds = new Set(sectionIdList);
876
+ let directHashLinks = 0;
877
+ for (const anchor of document.querySelectorAll('a[href^="#"]')) {
878
+ const href = anchor.getAttribute('href') || '';
879
+ if (href.length > 1 && sectionIds.has(href.slice(1))) directHashLinks += 1;
880
+ }
881
+
882
+ const standardCursorKeywords = new Set(['auto', 'default', 'none', 'context-menu', 'help', 'pointer', 'progress', 'wait', 'cell', 'crosshair', 'text', 'vertical-text', 'alias', 'copy', 'move', 'no-drop', 'not-allowed', 'grab', 'grabbing', 'all-scroll', 'col-resize', 'row-resize', 'n-resize', 'e-resize', 's-resize', 'w-resize', 'ne-resize', 'nw-resize', 'se-resize', 'sw-resize', 'ew-resize', 'ns-resize', 'nesw-resize', 'nwse-resize', 'zoom-in', 'zoom-out']);
883
+ const cursorList = [...cursorValues].filter(Boolean).slice(0, 20);
884
+ const customImageCursors = cursorList.filter((value) => value.includes('url('));
885
+
886
+ const canvasBackdrop = isDarkEmulation ? { r: 18, g: 18, b: 18, a: 1 } : { r: 255, g: 255, b: 255, a: 1 };
887
+ function effectiveContrastColors(element, foregroundColor) {
888
+ const chain = [];
889
+ let node = element;
890
+ while (node && node.nodeType === 1) {
891
+ chain.push(node);
892
+ node = node.parentElement;
893
+ }
894
+ let bg = { r: 0, g: 0, b: 0, a: 0 };
895
+ let fg = foregroundColor;
896
+ for (const current of chain) {
897
+ const style = styleOf(current);
898
+ const layerBg = parseColor(style.backgroundColor) || { r: 0, g: 0, b: 0, a: 0 };
899
+ const parsedOpacity = Number.parseFloat(style.opacity);
900
+ const opacity = Number.isFinite(parsedOpacity) ? clamp(parsedOpacity, 0, 1) : 1;
901
+ const innerBg = layerBg.a > 0 ? alphaBlend(bg, layerBg) : bg;
902
+ const innerFg = layerBg.a > 0 ? alphaBlend(fg, layerBg) : fg;
903
+ bg = opacity < 1 ? { ...innerBg, a: innerBg.a * opacity } : innerBg;
904
+ fg = opacity < 1 ? { ...innerFg, a: innerFg.a * opacity } : innerFg;
905
+ }
906
+ return {
907
+ background: alphaBlend(bg, canvasBackdrop),
908
+ foreground: alphaBlend(fg, canvasBackdrop),
909
+ };
910
+ }
911
+
912
+ let contrastChecked = 0;
913
+ let contrastFailures = 0;
914
+ let contrastUnparsed = 0;
915
+ const contrastRatios = [];
916
+ for (const item of textLeaf.slice(0, 1000)) {
917
+ const foregroundColor = parseColor(item.style.color);
918
+ if (!foregroundColor) {
919
+ contrastUnparsed += 1;
920
+ continue;
921
+ }
922
+ const { background, foreground } = effectiveContrastColors(item.element, foregroundColor);
923
+ const ratio = contrastRatio(foreground, background);
924
+ if (!Number.isFinite(ratio)) continue;
925
+ contrastChecked += 1;
926
+ contrastRatios.push(ratio);
927
+ const fontSize = Number.parseFloat(item.style.fontSize) || 16;
928
+ const fontWeight = Number.parseInt(item.style.fontWeight, 10) || 400;
929
+ const largeText = fontSize >= 24 || (fontSize >= 18.66 && fontWeight >= 700);
930
+ const required = largeText ? 3 : 4.5;
931
+ if (ratio + 0.05 < required) contrastFailures += 1;
932
+ }
933
+
934
+ function isAccessibilityExposed(element) {
935
+ let node = element;
936
+ while (node && node.nodeType === 1) {
937
+ if (node.hasAttribute('hidden') || node.getAttribute('aria-hidden') === 'true' || node.hasAttribute('inert')) return false;
938
+ const st = styleOf(node);
939
+ if (st.display === 'none') return false;
940
+ node = node.parentElement;
941
+ }
942
+ const ownStyle = styleOf(element);
943
+ if (ownStyle.visibility === 'hidden' || ownStyle.visibility === 'collapse') return false;
944
+ return true;
945
+ }
946
+
947
+ const landmarkRoles = { MAIN: 'main', NAV: 'navigation', HEADER: 'banner', FOOTER: 'contentinfo', ASIDE: 'complementary', SEARCH: 'search' };
948
+ const validLandmarkRoles = new Set(['main', 'navigation', 'banner', 'contentinfo', 'complementary', 'search']);
949
+ const sectioningSelector = 'article, aside, main, nav, section, [role="article"], [role="complementary"], [role="main"], [role="navigation"], [role="region"]';
950
+ const landmarks = {};
951
+ for (const element of document.querySelectorAll('main,nav,header,footer,aside,search,[role]')) {
952
+ if (!isAccessibilityExposed(element)) continue;
953
+ const roleAttr = (element.getAttribute('role') || '').trim().toLowerCase();
954
+ let role = null;
955
+ if (roleAttr) {
956
+ const firstToken = roleAttr.split(/\s+/)[0];
957
+ if (validLandmarkRoles.has(firstToken)) role = firstToken;
958
+ } else {
959
+ const implicit = landmarkRoles[element.tagName] || null;
960
+ if (implicit === 'banner' || implicit === 'contentinfo') {
961
+ if (!element.parentElement?.closest(sectioningSelector)) role = implicit;
962
+ } else {
963
+ role = implicit;
964
+ }
965
+ }
966
+ if (role) landmarks[role] = (landmarks[role] || 0) + 1;
967
+ }
968
+
969
+ const headings = [...document.querySelectorAll('h1,h2,h3,h4,h5,h6')].filter((element) => {
970
+ const rect = element.getBoundingClientRect();
971
+ const style = styleOf(element);
972
+ return rect.width > 0 && rect.height > 0 && style.visibility !== 'hidden' && style.visibility !== 'collapse';
973
+ });
974
+ let headingJumps = 0;
975
+ let previousHeading = 0;
976
+ for (const heading of headings) {
977
+ const level = Number(heading.tagName[1]);
978
+ if (previousHeading && level > previousHeading + 1) headingJumps += 1;
979
+ previousHeading = level;
980
+ }
981
+
982
+ const images = [...document.images];
983
+ const fontDisplay = [];
984
+ const fontDisplayPattern = /font-display\s*:\s*([a-z]+)/g;
985
+ let displayMatch;
986
+ while ((displayMatch = fontDisplayPattern.exec(cssLower)) && fontDisplay.length < 8) {
987
+ if (!fontDisplay.includes(displayMatch[1])) fontDisplay.push(displayMatch[1]);
988
+ }
989
+
990
+ const maxContentWidth = Math.round(Math.max(0, ...contentWidths.filter((width) => width > 100)));
991
+ const sortedFontAreas = [...fontAreas.entries()].sort((a, b) => b[1] - a[1]);
992
+
993
+ return {
994
+ title: document.title,
995
+ textLength: (document.body ? document.body.innerText : '').trim().length,
996
+ url: location.href,
997
+ viewport: { width: viewportWidth, height: viewportHeight },
998
+ fonts: {
999
+ count: sortedFontAreas.length,
1000
+ families: sortedFontAreas.slice(0, 12).map(([name]) => name),
1001
+ faceCount: fontFaces.size,
1002
+ entries: [...fontFaces.entries()].sort((a, b) => b[1] - a[1]).slice(0, 12).map(([key, area]) => {
1003
+ const parts = JSON.parse(key);
1004
+ return { family: parts[0], weight: parts[1], style: parts[2], area: Math.round(area) };
1005
+ }),
1006
+ declaredCount: declaredNames.size,
1007
+ declaredFamilies: [...declaredNames].slice(0, 16),
1008
+ fallbackFamilies: [...fallbackNames].slice(0, 8),
1009
+ fontFaces: documentFontFaces,
1010
+ },
1011
+ type: {
1012
+ distinctSizes: fontSizes.size,
1013
+ sizes: [...fontSizes.entries()].sort((a, b) => b[1] - a[1]).slice(0, 18).map(([size, area]) => ({ size: Number(size), area: Math.round(area) })),
1014
+ lineHeights: [...lineHeights.entries()].sort((a, b) => b[1] - a[1]).slice(0, 12).map(([value, area]) => ({ value, area: Math.round(area) })),
1015
+ ratio: typeRatio,
1016
+ displayLetterSpacing: [...displayLetterSpacing].slice(0, 12),
1017
+ },
1018
+ color: {
1019
+ dominant: hexColor(dominantKey),
1020
+ mode: luminance(dominantColor) > 0.5 ? 'light' : 'dark',
1021
+ distinct: distinctColors.size,
1022
+ backgrounds: backgroundEntries.slice(0, 10).map(([color, area]) => ({ color: hexColor(color), area: Math.round(area) })),
1023
+ inks: inkEntries.slice(0, 8).map(([color, area]) => ({ color: hexColor(color), area: Math.round(area) })),
1024
+ },
1025
+ layout: {
1026
+ sections: document.querySelectorAll('section').length,
1027
+ grids: grids.slice(0, 10),
1028
+ gridCount: grids.length,
1029
+ maxContentWidth,
1030
+ whitespaceRatio: round(1 - clamp(occupiedArea / (viewportWidth * viewportHeight), 0, 1), 3),
1031
+ asymmetry: round(Math.abs(centroid - viewportWidth / 2) / (viewportWidth / 2), 3),
1032
+ overlapCount,
1033
+ scrollHeight: document.documentElement.scrollHeight,
1034
+ },
1035
+ motion: {
1036
+ libraries,
1037
+ browserTechniques,
1038
+ animatedCount: animationCount,
1039
+ transitionCount,
1040
+ canvases: document.querySelectorAll('canvas').length,
1041
+ reducedMotionCSS: /prefers-reduced-motion/.test(cssLower),
1042
+ scroll: {
1043
+ manipulationLikely: libraries.lenis || libraries.locomotive || hiddenBodyOverflow || wheelOrTouchHandlerHint,
1044
+ hiddenBodyOverflow,
1045
+ wheelOrTouchHandlerHint,
1046
+ directHashLinks,
1047
+ sectionsWithIds: sectionIdList.length,
1048
+ },
1049
+ },
1050
+ cursor: {
1051
+ values: cursorList,
1052
+ imageCursors: customImageCursors,
1053
+ hidden: cursorList.includes('none'),
1054
+ nonStandardKeywords: cursorList.filter((value) => !standardCursorKeywords.has(value) && !value.includes('url(')),
1055
+ },
1056
+ accessibility: {
1057
+ landmarks,
1058
+ headingCount: headings.length,
1059
+ headingJumps,
1060
+ contrastChecked,
1061
+ contrastFailures,
1062
+ contrastUnparsed,
1063
+ contrastMedian: round(median(contrastRatios), 2),
1064
+ contrastMinimum: contrastRatios.length ? round(Math.min(...contrastRatios), 2) : null,
1065
+ images: images.length,
1066
+ missingAlt: images.filter((image) => !image.hasAttribute('alt')).length,
1067
+ focusVisibleCSS: /:focus-visible|focus-visible/.test(cssLower),
1068
+ },
1069
+ fontLoading: {
1070
+ preloadFonts: document.querySelectorAll('link[rel=preload][as=font]').length,
1071
+ fontDisplay,
1072
+ fontFaceCount,
1073
+ fontSetStatus: document.fonts ? document.fonts.status : 'unsupported',
1074
+ },
1075
+ timing: {
1076
+ domContentLoaded: round(navigation.domContentLoadedEventEnd || 0, 1),
1077
+ load: round(navigation.loadEventEnd || 0, 1),
1078
+ },
1079
+ lcp: typeof state.lcp === 'number' ? round(state.lcp, 1) : null,
1080
+ cls: round(state.cls || 0, 4),
1081
+ };
1082
+ })`;
1083
+
1084
+ const initObserver = String.raw`(() => {
1085
+ const state = { lcp: null, cls: 0 };
1086
+ let hasSession = false;
1087
+ let sessionValue = 0;
1088
+ let sessionFirst = 0;
1089
+ let sessionLast = 0;
1090
+ window.__pixelcraftInventory = state;
1091
+ try {
1092
+ new PerformanceObserver((list) => {
1093
+ for (const entry of list.getEntries()) state.lcp = entry.startTime;
1094
+ }).observe({ type: 'largest-contentful-paint', buffered: true });
1095
+ new PerformanceObserver((list) => {
1096
+ for (const entry of list.getEntries()) {
1097
+ if (entry.hadRecentInput) continue;
1098
+ const start = entry.startTime;
1099
+ if (hasSession && start - sessionLast < 1000 && start - sessionFirst < 5000) {
1100
+ sessionValue += entry.value;
1101
+ sessionLast = start;
1102
+ } else {
1103
+ hasSession = true;
1104
+ sessionValue = entry.value;
1105
+ sessionFirst = start;
1106
+ sessionLast = start;
1107
+ }
1108
+ if (sessionValue > state.cls) state.cls = sessionValue;
1109
+ }
1110
+ }).observe({ type: 'layout-shift', buffered: true });
1111
+ } catch {}
1112
+ })();`;
1113
+
1114
+ async function measurePage(page, target, viewport, options) {
1115
+ await page.setViewportSize(viewport);
1116
+ await page.addInitScript(initObserver);
1117
+ const session = await page.context().newCDPSession(page);
1118
+ await session.send('Page.enable');
1119
+ await session.send('Network.enable');
1120
+ const { frameTree } = await session.send('Page.getFrameTree');
1121
+ const mainFrameId = frameTree?.frame?.id || null;
1122
+ const tracker = observeNetwork(session, mainFrameId, options.waitUntil);
1123
+ const response = await page.goto(target, { waitUntil: options.waitUntil, timeout: options.timeout });
1124
+ if (options.waitFor) await page.waitForSelector(options.waitFor, { timeout: options.timeout });
1125
+ if (options.waitMs > 0) await page.waitForTimeout(options.waitMs);
1126
+ if (options.waitMs > 0) {
1127
+ await Promise.race([
1128
+ page.evaluate(() => (document.fonts ? document.fonts.ready : Promise.resolve())).catch(() => {}),
1129
+ new Promise((resolve) => setTimeout(resolve, Math.min(1000, options.waitMs))),
1130
+ ]);
1131
+ }
1132
+ const measured = await page.evaluate(`${extract}(${JSON.stringify({ colorScheme: options.colorScheme || 'light' })})`);
1133
+ const network = tracker.snapshot();
1134
+ if (response && network.status === 0) network.status = response.status();
1135
+ return { width: viewport.width, height: viewport.height, ...measured, network };
1136
+ }
1137
+
1138
+ async function main() {
1139
+ const { positional, options } = parse(process.argv.slice(2));
1140
+ if (options.help) {
1141
+ console.log(help());
1142
+ return;
1143
+ }
1144
+ const input = positional[0];
1145
+ if (!input) throw new Error('missing URL or HTML file; run with --help');
1146
+ if (positional.length > 1) throw new Error(`unexpected extra argument: ${positional[1]}`);
1147
+ const breakpoints = parseBreakpoints(options.breakpoints);
1148
+ const chromium = await loadChromium(options.project);
1149
+ if (!chromium) {
1150
+ console.error('Playwright is not installed in this dependency context. Install it explicitly in the target project, for example: npm install --save-dev playwright && npx playwright install chromium');
1151
+ process.exitCode = 2;
1152
+ return;
1153
+ }
1154
+ const target = await createStaticTarget(input, options);
1155
+ let browser;
1156
+ const phaseLabel = options.waitUntil === 'domcontentloaded'
1157
+ ? 'initial means request initiated before the document domcontentloaded event; deferred means after it'
1158
+ : 'initial means request initiated before the document load event; deferred means after it';
1159
+ const report = {
1160
+ schemaVersion: 1,
1161
+ target: input,
1162
+ generatedAt: new Date().toISOString(),
1163
+ heuristic: true,
1164
+ units: { timing: 'milliseconds', transfer: 'bytes', geometry: 'CSS pixels', area: 'square CSS pixels', whitespaceRatio: '0-1 estimate', cls: 'unitless' },
1165
+ measurement: {
1166
+ cache: 'fresh browser context per viewport; HTTP cache left enabled',
1167
+ throttling: 'none',
1168
+ emulation: 'headless Chromium viewport emulation',
1169
+ ...(options.colorScheme ? { colorScheme: options.colorScheme } : {}),
1170
+ ...(options.reducedMotion ? { reducedMotion: options.reducedMotion } : {}),
1171
+ payloadPhase: phaseLabel,
1172
+ },
1173
+ limitations: [
1174
+ 'cross-origin stylesheets may be unreadable',
1175
+ 'canvas/WebGL-painted content is invisible to DOM text extraction',
1176
+ 'font inventory reflects computed family stacks and font-face metadata rather than per-glyph fallback resolution',
1177
+ 'palette weights are computed-style approximations rather than a pixel histogram; images, gradients, shadows, and blend modes can dominate the real pixels',
1178
+ 'network transfer uses browser-reported encoded body bytes; redirects, headers, pending requests, and cache state can affect totals',
1179
+ 'whitespace, overlap, and asymmetry are geometric estimates rather than quality scores',
1180
+ 'contrast sampling does not account for background images, gradients, filters, or occluding overlays',
1181
+ 'basic accessibility extraction is not a keyboard, screen-reader, or task-completion audit',
1182
+ 'measurements reflect the initial viewport after the configured settle time rather than scrolled or interaction-dependent states',
1183
+ 'motion-library detection uses globals and script metadata; bundlers can hide libraries and ordinary prose is not evidence',
1184
+ ],
1185
+ viewports: [],
1186
+ };
1187
+ let sawHttpError = false;
1188
+ try {
1189
+ browser = await chromium.launch({ headless: true, ...(options.executablePath ? { executablePath: options.executablePath } : {}) });
1190
+ for (const viewport of breakpoints) {
1191
+ const page = await browser.newPage({
1192
+ viewport,
1193
+ ...(options.colorScheme ? { colorScheme: options.colorScheme } : {}),
1194
+ ...(options.reducedMotion ? { reducedMotion: options.reducedMotion } : {}),
1195
+ });
1196
+ try {
1197
+ const result = await measurePage(page, target.url, viewport, options);
1198
+ if (result.network.status >= 400) sawHttpError = true;
1199
+ report.viewports.push(result);
1200
+ } finally {
1201
+ await page.close();
1202
+ }
1203
+ }
1204
+ } finally {
1205
+ if (browser) await browser.close();
1206
+ await target.close();
1207
+ }
1208
+ const json = options.compact ? JSON.stringify(report) : JSON.stringify(report, null, 2);
1209
+ if (options.out) {
1210
+ const out = path.resolve(options.out);
1211
+ fs.mkdirSync(path.dirname(out), { recursive: true });
1212
+ fs.writeFileSync(out, `${json}\n`);
1213
+ console.log(`wrote ${path.relative(process.cwd(), out) || out}`);
1214
+ } else {
1215
+ console.log(json);
1216
+ }
1217
+ if (sawHttpError && !options.allowHttpError) {
1218
+ console.error('style-inventory: target returned HTTP 4xx/5xx; use --allow-http-error only when intentionally measuring error pages');
1219
+ process.exitCode = 1;
1220
+ }
1221
+ }
1222
+
1223
+ main().catch((error) => {
1224
+ console.error(`style-inventory: ${error.message || error}`);
1225
+ process.exit(1);
1226
+ });