quiver-cli 1.3.0 → 2.0.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 (384) hide show
  1. package/README.md +197 -239
  2. package/dist/cli.js +3163 -2040
  3. package/package.json +10 -11
  4. package/template/.agents/AGENTS.md +0 -26
  5. package/template/.agents/commands/cp.md +0 -108
  6. package/template/.agents/commands/next-setup.md +0 -1064
  7. package/template/.agents/commands/review.md +0 -68
  8. package/template/.agents/commands/terraform-readme.md +0 -38
  9. package/template/.agents/config.json +0 -80
  10. package/template/.agents/plugins/opencode/rtk.ts +0 -34
  11. package/template/.agents/skills/agent-browser/SKILL.md +0 -51
  12. package/template/.agents/skills/apps/skybridge/SKILL.md +0 -50
  13. package/template/.agents/skills/code/cleanup/SKILL.md +0 -26
  14. package/template/.agents/skills/code/improve/SKILL.md +0 -122
  15. package/template/.agents/skills/code/improve/references/audit-playbook.md +0 -130
  16. package/template/.agents/skills/code/improve/references/closing-the-loop.md +0 -96
  17. package/template/.agents/skills/code/improve/references/plan-template.md +0 -197
  18. package/template/.agents/skills/code/vercel-react-best-practices/AGENTS.md +0 -3810
  19. package/template/.agents/skills/code/vercel-react-best-practices/README.md +0 -123
  20. package/template/.agents/skills/code/vercel-react-best-practices/SKILL.md +0 -149
  21. package/template/.agents/skills/code/vercel-react-best-practices/metadata.json +0 -15
  22. package/template/.agents/skills/code/vercel-react-best-practices/rules/_sections.md +0 -46
  23. package/template/.agents/skills/code/vercel-react-best-practices/rules/_template.md +0 -28
  24. package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-effect-event-deps.md +0 -56
  25. package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-event-handler-refs.md +0 -55
  26. package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-init-once.md +0 -42
  27. package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-use-latest.md +0 -39
  28. package/template/.agents/skills/code/vercel-react-best-practices/rules/async-api-routes.md +0 -38
  29. package/template/.agents/skills/code/vercel-react-best-practices/rules/async-cheap-condition-before-await.md +0 -37
  30. package/template/.agents/skills/code/vercel-react-best-practices/rules/async-defer-await.md +0 -82
  31. package/template/.agents/skills/code/vercel-react-best-practices/rules/async-dependencies.md +0 -51
  32. package/template/.agents/skills/code/vercel-react-best-practices/rules/async-parallel.md +0 -28
  33. package/template/.agents/skills/code/vercel-react-best-practices/rules/async-suspense-boundaries.md +0 -99
  34. package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-analyzable-paths.md +0 -63
  35. package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-barrel-imports.md +0 -60
  36. package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-conditional.md +0 -31
  37. package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-defer-third-party.md +0 -49
  38. package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-dynamic-imports.md +0 -35
  39. package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-preload.md +0 -50
  40. package/template/.agents/skills/code/vercel-react-best-practices/rules/client-event-listeners.md +0 -74
  41. package/template/.agents/skills/code/vercel-react-best-practices/rules/client-localstorage-schema.md +0 -71
  42. package/template/.agents/skills/code/vercel-react-best-practices/rules/client-passive-event-listeners.md +0 -48
  43. package/template/.agents/skills/code/vercel-react-best-practices/rules/client-swr-dedup.md +0 -56
  44. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-batch-dom-css.md +0 -107
  45. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-cache-function-results.md +0 -80
  46. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-cache-property-access.md +0 -28
  47. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-cache-storage.md +0 -70
  48. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-combine-iterations.md +0 -32
  49. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-early-exit.md +0 -50
  50. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-flatmap-filter.md +0 -60
  51. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-hoist-regexp.md +0 -45
  52. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-index-maps.md +0 -37
  53. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-length-check-first.md +0 -49
  54. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-min-max-loop.md +0 -82
  55. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-request-idle-callback.md +0 -105
  56. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-set-map-lookups.md +0 -24
  57. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-tosorted-immutable.md +0 -57
  58. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-activity.md +0 -26
  59. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -47
  60. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-conditional-render.md +0 -40
  61. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-content-visibility.md +0 -38
  62. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-hoist-jsx.md +0 -46
  63. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +0 -82
  64. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +0 -30
  65. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-resource-hints.md +0 -85
  66. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-script-defer-async.md +0 -68
  67. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-svg-precision.md +0 -28
  68. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-usetransition-loading.md +0 -75
  69. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-defer-reads.md +0 -39
  70. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-dependencies.md +0 -45
  71. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +0 -40
  72. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-derived-state.md +0 -29
  73. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-functional-setstate.md +0 -74
  74. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-lazy-state-init.md +0 -58
  75. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +0 -38
  76. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-memo.md +0 -44
  77. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +0 -45
  78. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-no-inline-components.md +0 -82
  79. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +0 -35
  80. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-split-combined-hooks.md +0 -64
  81. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-transitions.md +0 -40
  82. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-use-deferred-value.md +0 -59
  83. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +0 -73
  84. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-after-nonblocking.md +0 -73
  85. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-auth-actions.md +0 -96
  86. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-cache-lru.md +0 -41
  87. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-cache-react.md +0 -76
  88. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-dedup-props.md +0 -65
  89. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-hoist-static-io.md +0 -149
  90. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-no-shared-module-state.md +0 -50
  91. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-parallel-fetching.md +0 -83
  92. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-parallel-nested-fetching.md +0 -34
  93. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-serialization.md +0 -38
  94. package/template/.agents/skills/data/prisma-cli/SKILL.md +0 -247
  95. package/template/.agents/skills/data/prisma-cli/references/db-execute.md +0 -78
  96. package/template/.agents/skills/data/prisma-cli/references/db-pull.md +0 -185
  97. package/template/.agents/skills/data/prisma-cli/references/db-push.md +0 -148
  98. package/template/.agents/skills/data/prisma-cli/references/db-seed.md +0 -188
  99. package/template/.agents/skills/data/prisma-cli/references/debug.md +0 -46
  100. package/template/.agents/skills/data/prisma-cli/references/dev.md +0 -157
  101. package/template/.agents/skills/data/prisma-cli/references/format.md +0 -48
  102. package/template/.agents/skills/data/prisma-cli/references/generate.md +0 -173
  103. package/template/.agents/skills/data/prisma-cli/references/init.md +0 -136
  104. package/template/.agents/skills/data/prisma-cli/references/mcp.md +0 -38
  105. package/template/.agents/skills/data/prisma-cli/references/migrate-deploy.md +0 -127
  106. package/template/.agents/skills/data/prisma-cli/references/migrate-dev.md +0 -145
  107. package/template/.agents/skills/data/prisma-cli/references/migrate-diff.md +0 -89
  108. package/template/.agents/skills/data/prisma-cli/references/migrate-reset.md +0 -78
  109. package/template/.agents/skills/data/prisma-cli/references/migrate-resolve.md +0 -57
  110. package/template/.agents/skills/data/prisma-cli/references/migrate-status.md +0 -65
  111. package/template/.agents/skills/data/prisma-cli/references/studio.md +0 -137
  112. package/template/.agents/skills/data/prisma-cli/references/validate.md +0 -53
  113. package/template/.agents/skills/data/prisma-client-api/SKILL.md +0 -216
  114. package/template/.agents/skills/data/prisma-client-api/references/client-methods.md +0 -223
  115. package/template/.agents/skills/data/prisma-client-api/references/constructor.md +0 -208
  116. package/template/.agents/skills/data/prisma-client-api/references/filters.md +0 -256
  117. package/template/.agents/skills/data/prisma-client-api/references/model-queries.md +0 -281
  118. package/template/.agents/skills/data/prisma-client-api/references/query-options.md +0 -276
  119. package/template/.agents/skills/data/prisma-client-api/references/raw-queries.md +0 -194
  120. package/template/.agents/skills/data/prisma-client-api/references/relations.md +0 -308
  121. package/template/.agents/skills/data/prisma-client-api/references/transactions.md +0 -184
  122. package/template/.agents/skills/design/impeccable/SKILL.md +0 -84
  123. package/template/.agents/skills/design/impeccable/reference/adapt.md +0 -312
  124. package/template/.agents/skills/design/impeccable/reference/adapt.native.md +0 -58
  125. package/template/.agents/skills/design/impeccable/reference/android.md +0 -40
  126. package/template/.agents/skills/design/impeccable/reference/animate.md +0 -86
  127. package/template/.agents/skills/design/impeccable/reference/audit.md +0 -136
  128. package/template/.agents/skills/design/impeccable/reference/audit.native.md +0 -139
  129. package/template/.agents/skills/design/impeccable/reference/bolder.md +0 -31
  130. package/template/.agents/skills/design/impeccable/reference/clarify.md +0 -94
  131. package/template/.agents/skills/design/impeccable/reference/colorize.md +0 -86
  132. package/template/.agents/skills/design/impeccable/reference/craft-floor.md +0 -42
  133. package/template/.agents/skills/design/impeccable/reference/craft.md +0 -5
  134. package/template/.agents/skills/design/impeccable/reference/critique.md +0 -788
  135. package/template/.agents/skills/design/impeccable/reference/degraded/asset-producer.md +0 -90
  136. package/template/.agents/skills/design/impeccable/reference/degraded/documenter.md +0 -24
  137. package/template/.agents/skills/design/impeccable/reference/degraded/finish-reviewer.md +0 -37
  138. package/template/.agents/skills/design/impeccable/reference/degraded/manual-edit-applier.md +0 -92
  139. package/template/.agents/skills/design/impeccable/reference/delight.md +0 -70
  140. package/template/.agents/skills/design/impeccable/reference/distill.md +0 -111
  141. package/template/.agents/skills/design/impeccable/reference/doctor.md +0 -53
  142. package/template/.agents/skills/design/impeccable/reference/document.md +0 -416
  143. package/template/.agents/skills/design/impeccable/reference/extract.md +0 -69
  144. package/template/.agents/skills/design/impeccable/reference/harden.md +0 -336
  145. package/template/.agents/skills/design/impeccable/reference/hooks.md +0 -105
  146. package/template/.agents/skills/design/impeccable/reference/init.md +0 -125
  147. package/template/.agents/skills/design/impeccable/reference/ios.md +0 -45
  148. package/template/.agents/skills/design/impeccable/reference/layout.md +0 -84
  149. package/template/.agents/skills/design/impeccable/reference/live-setup.md +0 -102
  150. package/template/.agents/skills/design/impeccable/reference/live.md +0 -323
  151. package/template/.agents/skills/design/impeccable/reference/new-work.md +0 -105
  152. package/template/.agents/skills/design/impeccable/reference/onboard.md +0 -234
  153. package/template/.agents/skills/design/impeccable/reference/operate.md +0 -61
  154. package/template/.agents/skills/design/impeccable/reference/optimize.md +0 -258
  155. package/template/.agents/skills/design/impeccable/reference/overdrive.md +0 -127
  156. package/template/.agents/skills/design/impeccable/reference/polish.md +0 -97
  157. package/template/.agents/skills/design/impeccable/reference/quieter.md +0 -99
  158. package/template/.agents/skills/design/impeccable/reference/routing.md +0 -18
  159. package/template/.agents/skills/design/impeccable/reference/shape.md +0 -59
  160. package/template/.agents/skills/design/impeccable/reference/typeset.md +0 -80
  161. package/template/.agents/skills/design/impeccable/reference/visualize.md +0 -47
  162. package/template/.agents/skills/design/impeccable/scripts/command-metadata.json +0 -94
  163. package/template/.agents/skills/design/impeccable/scripts/concept-seed.mjs +0 -558
  164. package/template/.agents/skills/design/impeccable/scripts/context-signals.mjs +0 -334
  165. package/template/.agents/skills/design/impeccable/scripts/context.mjs +0 -1450
  166. package/template/.agents/skills/design/impeccable/scripts/critique-storage.mjs +0 -213
  167. package/template/.agents/skills/design/impeccable/scripts/detect-csp.mjs +0 -198
  168. package/template/.agents/skills/design/impeccable/scripts/detect.mjs +0 -21
  169. package/template/.agents/skills/design/impeccable/scripts/detector/browser/injected/index.mjs +0 -2023
  170. package/template/.agents/skills/design/impeccable/scripts/detector/cli/main.mjs +0 -438
  171. package/template/.agents/skills/design/impeccable/scripts/detector/design-system.mjs +0 -983
  172. package/template/.agents/skills/design/impeccable/scripts/detector/detect-antipatterns-browser.js +0 -8283
  173. package/template/.agents/skills/design/impeccable/scripts/detector/detect-antipatterns.mjs +0 -50
  174. package/template/.agents/skills/design/impeccable/scripts/detector/engines/browser/detect-url.mjs +0 -372
  175. package/template/.agents/skills/design/impeccable/scripts/detector/engines/regex/detect-text.mjs +0 -768
  176. package/template/.agents/skills/design/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +0 -1186
  177. package/template/.agents/skills/design/impeccable/scripts/detector/engines/static-html/detect-html.mjs +0 -264
  178. package/template/.agents/skills/design/impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +0 -189
  179. package/template/.agents/skills/design/impeccable/scripts/detector/findings.mjs +0 -18
  180. package/template/.agents/skills/design/impeccable/scripts/detector/node/file-system.mjs +0 -212
  181. package/template/.agents/skills/design/impeccable/scripts/detector/profile/profiler.mjs +0 -166
  182. package/template/.agents/skills/design/impeccable/scripts/detector/registry/antipatterns.mjs +0 -617
  183. package/template/.agents/skills/design/impeccable/scripts/detector/rules/checks.mjs +0 -5580
  184. package/template/.agents/skills/design/impeccable/scripts/detector/shared/color.mjs +0 -124
  185. package/template/.agents/skills/design/impeccable/scripts/detector/shared/constants.mjs +0 -112
  186. package/template/.agents/skills/design/impeccable/scripts/detector/shared/fonts.mjs +0 -30
  187. package/template/.agents/skills/design/impeccable/scripts/detector/shared/inline-ignores.mjs +0 -148
  188. package/template/.agents/skills/design/impeccable/scripts/detector/shared/page.mjs +0 -7
  189. package/template/.agents/skills/design/impeccable/scripts/doctor.mjs +0 -336
  190. package/template/.agents/skills/design/impeccable/scripts/embed-prompt.mjs +0 -133
  191. package/template/.agents/skills/design/impeccable/scripts/generate-image.mjs +0 -240
  192. package/template/.agents/skills/design/impeccable/scripts/hook-admin.mjs +0 -741
  193. package/template/.agents/skills/design/impeccable/scripts/hook-before-edit.mjs +0 -516
  194. package/template/.agents/skills/design/impeccable/scripts/hook-lib.mjs +0 -2100
  195. package/template/.agents/skills/design/impeccable/scripts/hook.mjs +0 -78
  196. package/template/.agents/skills/design/impeccable/scripts/lib/artifact-schema.mjs +0 -93
  197. package/template/.agents/skills/design/impeccable/scripts/lib/composition-catalog.mjs +0 -200
  198. package/template/.agents/skills/design/impeccable/scripts/lib/concept-catalog.mjs +0 -357
  199. package/template/.agents/skills/design/impeccable/scripts/lib/design-parser.mjs +0 -842
  200. package/template/.agents/skills/design/impeccable/scripts/lib/impeccable-config.mjs +0 -658
  201. package/template/.agents/skills/design/impeccable/scripts/lib/impeccable-paths.mjs +0 -137
  202. package/template/.agents/skills/design/impeccable/scripts/lib/is-generated.mjs +0 -69
  203. package/template/.agents/skills/design/impeccable/scripts/lib/provider.mjs +0 -5
  204. package/template/.agents/skills/design/impeccable/scripts/lib/roll-selection.mjs +0 -362
  205. package/template/.agents/skills/design/impeccable/scripts/lib/staleness-deep.mjs +0 -457
  206. package/template/.agents/skills/design/impeccable/scripts/lib/staleness-notice.mjs +0 -169
  207. package/template/.agents/skills/design/impeccable/scripts/lib/staleness.mjs +0 -457
  208. package/template/.agents/skills/design/impeccable/scripts/lib/surface-briefs.mjs +0 -151
  209. package/template/.agents/skills/design/impeccable/scripts/lib/target-args.mjs +0 -42
  210. package/template/.agents/skills/design/impeccable/scripts/lib/target-slug.mjs +0 -33
  211. package/template/.agents/skills/design/impeccable/scripts/lib/template-extensions.mjs +0 -146
  212. package/template/.agents/skills/design/impeccable/scripts/live/accept-css.mjs +0 -617
  213. package/template/.agents/skills/design/impeccable/scripts/live/accept-verify.mjs +0 -60
  214. package/template/.agents/skills/design/impeccable/scripts/live/browser-script-parts.mjs +0 -55
  215. package/template/.agents/skills/design/impeccable/scripts/live/completion.mjs +0 -28
  216. package/template/.agents/skills/design/impeccable/scripts/live/event-validation.mjs +0 -199
  217. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/astro.mjs +0 -47
  218. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/detect-utils.mjs +0 -73
  219. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/index.mjs +0 -143
  220. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/journal.mjs +0 -197
  221. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/nextjs.mjs +0 -49
  222. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/nuxt.mjs +0 -161
  223. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/script-src.mjs +0 -17
  224. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/static-html.mjs +0 -26
  225. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/sveltekit.mjs +0 -71
  226. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/tag-strategy.mjs +0 -247
  227. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/tanstack-start.mjs +0 -70
  228. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/vite-generic.mjs +0 -42
  229. package/template/.agents/skills/design/impeccable/scripts/live/generation-preflight.mjs +0 -149
  230. package/template/.agents/skills/design/impeccable/scripts/live/insert-ui.mjs +0 -458
  231. package/template/.agents/skills/design/impeccable/scripts/live/instructions.mjs +0 -142
  232. package/template/.agents/skills/design/impeccable/scripts/live/manual-apply.mjs +0 -939
  233. package/template/.agents/skills/design/impeccable/scripts/live/manual-edit-routes.mjs +0 -357
  234. package/template/.agents/skills/design/impeccable/scripts/live/manual-edits-buffer.mjs +0 -152
  235. package/template/.agents/skills/design/impeccable/scripts/live/poll-lanes.mjs +0 -14
  236. package/template/.agents/skills/design/impeccable/scripts/live/roots.mjs +0 -508
  237. package/template/.agents/skills/design/impeccable/scripts/live/session-store.mjs +0 -563
  238. package/template/.agents/skills/design/impeccable/scripts/live/source-lock.mjs +0 -105
  239. package/template/.agents/skills/design/impeccable/scripts/live/source-search.mjs +0 -105
  240. package/template/.agents/skills/design/impeccable/scripts/live/svelte-ast.mjs +0 -961
  241. package/template/.agents/skills/design/impeccable/scripts/live/svelte-component.mjs +0 -1342
  242. package/template/.agents/skills/design/impeccable/scripts/live/sveltekit-adapter.mjs +0 -316
  243. package/template/.agents/skills/design/impeccable/scripts/live/tanstack-adapter.mjs +0 -280
  244. package/template/.agents/skills/design/impeccable/scripts/live/ui-core.mjs +0 -180
  245. package/template/.agents/skills/design/impeccable/scripts/live/vocabulary.mjs +0 -171
  246. package/template/.agents/skills/design/impeccable/scripts/live-accept.mjs +0 -954
  247. package/template/.agents/skills/design/impeccable/scripts/live-browser-dom.js +0 -146
  248. package/template/.agents/skills/design/impeccable/scripts/live-browser-session.js +0 -123
  249. package/template/.agents/skills/design/impeccable/scripts/live-browser.js +0 -12512
  250. package/template/.agents/skills/design/impeccable/scripts/live-commit-manual-edits.mjs +0 -1244
  251. package/template/.agents/skills/design/impeccable/scripts/live-complete.mjs +0 -107
  252. package/template/.agents/skills/design/impeccable/scripts/live-copy-edit-agent.mjs +0 -683
  253. package/template/.agents/skills/design/impeccable/scripts/live-discard-manual-edits.mjs +0 -51
  254. package/template/.agents/skills/design/impeccable/scripts/live-inject.mjs +0 -503
  255. package/template/.agents/skills/design/impeccable/scripts/live-insert.mjs +0 -292
  256. package/template/.agents/skills/design/impeccable/scripts/live-manual-edit-evidence.mjs +0 -368
  257. package/template/.agents/skills/design/impeccable/scripts/live-poll.mjs +0 -429
  258. package/template/.agents/skills/design/impeccable/scripts/live-resume.mjs +0 -123
  259. package/template/.agents/skills/design/impeccable/scripts/live-server.mjs +0 -1661
  260. package/template/.agents/skills/design/impeccable/scripts/live-status.mjs +0 -71
  261. package/template/.agents/skills/design/impeccable/scripts/live-target.mjs +0 -30
  262. package/template/.agents/skills/design/impeccable/scripts/live-wrap.mjs +0 -927
  263. package/template/.agents/skills/design/impeccable/scripts/live.mjs +0 -359
  264. package/template/.agents/skills/design/impeccable/scripts/modern-screenshot.umd.js +0 -14
  265. package/template/.agents/skills/design/impeccable/scripts/palette.mjs +0 -628
  266. package/template/.agents/skills/design/impeccable/scripts/pin.mjs +0 -221
  267. package/template/.agents/skills/design/impeccable/scripts/serve-question.mjs +0 -932
  268. package/template/.agents/skills/design/impeccable/scripts/surface-brief.mjs +0 -74
  269. package/template/.agents/skills/design/shadcn/SKILL.md +0 -277
  270. package/template/.agents/skills/design/shadcn/agents/openai.yml +0 -5
  271. package/template/.agents/skills/design/shadcn/assets/shadcn-small.png +0 -0
  272. package/template/.agents/skills/design/shadcn/assets/shadcn.png +0 -0
  273. package/template/.agents/skills/design/shadcn/cli.md +0 -290
  274. package/template/.agents/skills/design/shadcn/customization.md +0 -209
  275. package/template/.agents/skills/design/shadcn/evals/evals.json +0 -77
  276. package/template/.agents/skills/design/shadcn/mcp.md +0 -105
  277. package/template/.agents/skills/design/shadcn/registry.md +0 -277
  278. package/template/.agents/skills/design/shadcn/rules/base-vs-radix.md +0 -306
  279. package/template/.agents/skills/design/shadcn/rules/chat.md +0 -224
  280. package/template/.agents/skills/design/shadcn/rules/composition.md +0 -213
  281. package/template/.agents/skills/design/shadcn/rules/forms.md +0 -192
  282. package/template/.agents/skills/design/shadcn/rules/icons.md +0 -101
  283. package/template/.agents/skills/design/shadcn/rules/styling.md +0 -185
  284. package/template/.agents/skills/find-skills/SKILL.md +0 -141
  285. package/template/.agents/skills/hono/SKILL.md +0 -579
  286. package/template/.agents/skills/integrations/langfuse/SKILL.md +0 -146
  287. package/template/.agents/skills/integrations/langfuse/references/ci-cd.md +0 -41
  288. package/template/.agents/skills/integrations/langfuse/references/cli.md +0 -60
  289. package/template/.agents/skills/integrations/langfuse/references/error-analysis.md +0 -88
  290. package/template/.agents/skills/integrations/langfuse/references/instrumentation.md +0 -121
  291. package/template/.agents/skills/integrations/langfuse/references/judge-calibration.md +0 -291
  292. package/template/.agents/skills/integrations/langfuse/references/prompt-engineering.md +0 -35
  293. package/template/.agents/skills/integrations/langfuse/references/prompt-migration.md +0 -79
  294. package/template/.agents/skills/integrations/langfuse/references/skill-feedback.md +0 -55
  295. package/template/.agents/skills/integrations/langfuse/references/trace-evaluator-upgrade.md +0 -76
  296. package/template/.agents/skills/integrations/langfuse/references/user-feedback.md +0 -92
  297. package/template/.agents/skills/integrations/langfuse/references/v4-project-migration.md +0 -73
  298. package/template/.agents/skills/integrations/posthog/SKILL.md +0 -102
  299. package/template/.agents/skills/integrations/posthog/references/error-tracking-alerts.md +0 -63
  300. package/template/.agents/skills/integrations/posthog/references/error-tracking-assigning-issues.md +0 -77
  301. package/template/.agents/skills/integrations/posthog/references/error-tracking-fingerprints.md +0 -57
  302. package/template/.agents/skills/integrations/posthog/references/error-tracking-monitoring.md +0 -140
  303. package/template/.agents/skills/integrations/posthog/references/error-tracking-nextjs.md +0 -490
  304. package/template/.agents/skills/integrations/posthog/references/error-tracking-source-maps.md +0 -45
  305. package/template/.agents/skills/integrations/posthog/references/feature-flags-best-practices.md +0 -139
  306. package/template/.agents/skills/integrations/posthog/references/feature-flags-react.md +0 -302
  307. package/template/.agents/skills/integrations/posthog/references/identify-users.md +0 -202
  308. package/template/.agents/skills/integrations/posthog/references/integration-example.md +0 -706
  309. package/template/.agents/skills/integrations/posthog/references/integration-nextjs.md +0 -385
  310. package/template/.agents/skills/integrations/posthog/references/integration-step-1-begin.md +0 -43
  311. package/template/.agents/skills/integrations/posthog/references/integration-step-2-edit.md +0 -37
  312. package/template/.agents/skills/integrations/posthog/references/integration-step-3-revise.md +0 -22
  313. package/template/.agents/skills/integrations/posthog/references/integration-step-4-conclude.md +0 -38
  314. package/template/.agents/skills/integrations/posthog/references/llm-analytics-anthropic.md +0 -200
  315. package/template/.agents/skills/integrations/posthog/references/llm-analytics-basics.md +0 -62
  316. package/template/.agents/skills/integrations/posthog/references/llm-analytics-costs.md +0 -197
  317. package/template/.agents/skills/integrations/posthog/references/llm-analytics-manual-capture.md +0 -397
  318. package/template/.agents/skills/integrations/posthog/references/llm-analytics-traces.md +0 -98
  319. package/template/.agents/skills/integrations/posthog/references/llm-analytics-vercel-ai.md +0 -120
  320. package/template/.agents/skills/repo/repo-ci/SKILL.md +0 -265
  321. package/template/.agents/skills/repo/repo-init-next-js/SKILL.md +0 -129
  322. package/template/.agents/skills/repo/repo-init-next-js/references/file-contents.md +0 -800
  323. package/template/.agents/skills/repo/repo-init-next-js/scripts/setup.sh +0 -47
  324. package/template/.agents/skills/repo/repo-init-node/SKILL.md +0 -196
  325. package/template/.agents/skills/skill-creator/LICENSE.txt +0 -202
  326. package/template/.agents/skills/skill-creator/SKILL.md +0 -485
  327. package/template/.agents/skills/skill-creator/agents/analyzer.md +0 -274
  328. package/template/.agents/skills/skill-creator/agents/comparator.md +0 -202
  329. package/template/.agents/skills/skill-creator/agents/grader.md +0 -223
  330. package/template/.agents/skills/skill-creator/assets/eval_review.html +0 -146
  331. package/template/.agents/skills/skill-creator/eval-viewer/generate_review.py +0 -471
  332. package/template/.agents/skills/skill-creator/eval-viewer/viewer.html +0 -1325
  333. package/template/.agents/skills/skill-creator/references/schemas.md +0 -430
  334. package/template/.agents/skills/skill-creator/scripts/__init__.py +0 -0
  335. package/template/.agents/skills/skill-creator/scripts/aggregate_benchmark.py +0 -401
  336. package/template/.agents/skills/skill-creator/scripts/generate_report.py +0 -326
  337. package/template/.agents/skills/skill-creator/scripts/improve_description.py +0 -247
  338. package/template/.agents/skills/skill-creator/scripts/package_skill.py +0 -136
  339. package/template/.agents/skills/skill-creator/scripts/quick_validate.py +0 -103
  340. package/template/.agents/skills/skill-creator/scripts/run_eval.py +0 -310
  341. package/template/.agents/skills/skill-creator/scripts/run_loop.py +0 -328
  342. package/template/.agents/skills/skill-creator/scripts/utils.py +0 -47
  343. package/template/.agents/skills/supabase/CHANGELOG.md +0 -71
  344. package/template/.agents/skills/supabase/SKILL.md +0 -145
  345. package/template/.agents/skills/supabase/assets/feedback-issue-template.md +0 -17
  346. package/template/.agents/skills/supabase/references/skill-feedback.md +0 -17
  347. package/template/.agents/skills/supabase-postgres-best-practices/CHANGELOG.md +0 -73
  348. package/template/.agents/skills/supabase-postgres-best-practices/SKILL.md +0 -64
  349. package/template/.agents/skills/supabase-postgres-best-practices/references/_contributing.md +0 -170
  350. package/template/.agents/skills/supabase-postgres-best-practices/references/_sections.md +0 -39
  351. package/template/.agents/skills/supabase-postgres-best-practices/references/_template.md +0 -34
  352. package/template/.agents/skills/supabase-postgres-best-practices/references/advanced-full-text-search.md +0 -55
  353. package/template/.agents/skills/supabase-postgres-best-practices/references/advanced-jsonb-indexing.md +0 -49
  354. package/template/.agents/skills/supabase-postgres-best-practices/references/conn-idle-timeout.md +0 -46
  355. package/template/.agents/skills/supabase-postgres-best-practices/references/conn-limits.md +0 -44
  356. package/template/.agents/skills/supabase-postgres-best-practices/references/conn-pooling.md +0 -41
  357. package/template/.agents/skills/supabase-postgres-best-practices/references/conn-prepared-statements.md +0 -46
  358. package/template/.agents/skills/supabase-postgres-best-practices/references/data-batch-inserts.md +0 -54
  359. package/template/.agents/skills/supabase-postgres-best-practices/references/data-n-plus-one.md +0 -53
  360. package/template/.agents/skills/supabase-postgres-best-practices/references/data-pagination.md +0 -50
  361. package/template/.agents/skills/supabase-postgres-best-practices/references/data-upsert.md +0 -50
  362. package/template/.agents/skills/supabase-postgres-best-practices/references/lock-advisory.md +0 -56
  363. package/template/.agents/skills/supabase-postgres-best-practices/references/lock-deadlock-prevention.md +0 -68
  364. package/template/.agents/skills/supabase-postgres-best-practices/references/lock-short-transactions.md +0 -50
  365. package/template/.agents/skills/supabase-postgres-best-practices/references/lock-skip-locked.md +0 -54
  366. package/template/.agents/skills/supabase-postgres-best-practices/references/monitor-explain-analyze.md +0 -45
  367. package/template/.agents/skills/supabase-postgres-best-practices/references/monitor-pg-stat-statements.md +0 -55
  368. package/template/.agents/skills/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md +0 -55
  369. package/template/.agents/skills/supabase-postgres-best-practices/references/query-composite-indexes.md +0 -44
  370. package/template/.agents/skills/supabase-postgres-best-practices/references/query-covering-indexes.md +0 -40
  371. package/template/.agents/skills/supabase-postgres-best-practices/references/query-index-types.md +0 -48
  372. package/template/.agents/skills/supabase-postgres-best-practices/references/query-missing-indexes.md +0 -43
  373. package/template/.agents/skills/supabase-postgres-best-practices/references/query-partial-indexes.md +0 -45
  374. package/template/.agents/skills/supabase-postgres-best-practices/references/schema-constraints.md +0 -80
  375. package/template/.agents/skills/supabase-postgres-best-practices/references/schema-data-types.md +0 -46
  376. package/template/.agents/skills/supabase-postgres-best-practices/references/schema-foreign-key-indexes.md +0 -59
  377. package/template/.agents/skills/supabase-postgres-best-practices/references/schema-lowercase-identifiers.md +0 -55
  378. package/template/.agents/skills/supabase-postgres-best-practices/references/schema-partitioning.md +0 -55
  379. package/template/.agents/skills/supabase-postgres-best-practices/references/schema-primary-keys.md +0 -61
  380. package/template/.agents/skills/supabase-postgres-best-practices/references/security-privileges.md +0 -54
  381. package/template/.agents/skills/supabase-postgres-best-practices/references/security-rls-basics.md +0 -50
  382. package/template/.agents/skills/supabase-postgres-best-practices/references/security-rls-performance.md +0 -63
  383. package/template/.agents/skills/writing/humanizer/SKILL.md +0 -621
  384. package/template/.agents/upstreams.json +0 -116
@@ -1,1186 +0,0 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
-
4
- import { profileStep, recordProfileEvent } from '../../profile/profiler.mjs';
5
- import { CSS_NAMED_COLORS, collectCssCustomProps, cssLengthToPx, parseAnyColor, resolveLengthPx, resolveVarRefs } from '../../rules/checks.mjs';
6
-
7
- // ---------------------------------------------------------------------------
8
- // jsdom CSS-variable border override map
9
- // ---------------------------------------------------------------------------
10
- //
11
- // jsdom's CSSOM silently drops any border shorthand that contains a var()
12
- // reference — the computed style for the element then shows empty width,
13
- // empty style, and a default black color. That's enough to hide the most
14
- // common real-world side-tab pattern in AI-generated pages:
15
- //
16
- // :root { --brand: #87a8ff; }
17
- // .card { border-left: 5px solid var(--brand); border-radius: 4px; }
18
- //
19
- // Real browsers (and therefore the browser detector path) resolve var()
20
- // natively, so this only affects the Node jsdom path.
21
- //
22
- // This pre-pass walks the stylesheets, finds any rule whose per-side or
23
- // all-sides border property contains var(), resolves the var() against
24
- // :root-level custom properties (read from the documentElement's computed
25
- // style, which jsdom DOES handle correctly), and attaches the resolved
26
- // width+color to every element that matches the rule's selector. The
27
- // Node-side `checkElementBorders` adapter consumes that map as a fallback
28
- // whenever jsdom's computed style came back empty.
29
- //
30
- // Limitations (intentional, to keep the pass simple):
31
- // * Only :root-level custom properties are resolved. Scoped overrides on
32
- // descendants are not tracked — uncommon in practice and would require
33
- // a per-element cascade walk.
34
- // * @media / @supports wrapped rules are ignored (jsdom often mishandles
35
- // these anyway).
36
- // * The fallback only fills sides that jsdom left empty, so any rule
37
- // whose border parses normally still wins via the computed style.
38
-
39
- const BORDER_SHORTHAND_RE = /^(\d+(?:\.\d+)?)px\s+(solid|dashed|dotted|double|groove|ridge|inset|outset)\s+(.+)$/i;
40
-
41
- // isNeutralColor only understands rgba()/oklch()/lch()/lab()/hsl()/hwb().
42
- // CSS variables typically hold hex or named colors, so normalize those to
43
- // rgb() before handing the value off to the shared check. Anything we don't
44
- // recognise is passed through unchanged — isNeutralColor then treats it as
45
- // non-neutral, which is the safer default (matches the oklch-era bugfix).
46
- const NAMED_COLORS = {
47
- white: [255, 255, 255], black: [0, 0, 0], gray: [128, 128, 128],
48
- grey: [128, 128, 128], silver: [192, 192, 192], red: [255, 0, 0],
49
- green: [0, 128, 0], blue: [0, 0, 255], yellow: [255, 255, 0],
50
- };
51
-
52
- function normalizeColorForCheck(value) {
53
- if (!value) return value;
54
- const v = value.trim();
55
- const hex6 = v.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);
56
- if (hex6) {
57
- const [r, g, b] = [parseInt(hex6[1], 16), parseInt(hex6[2], 16), parseInt(hex6[3], 16)];
58
- return `rgb(${r}, ${g}, ${b})`;
59
- }
60
- const hex3 = v.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i);
61
- if (hex3) {
62
- const [r, g, b] = [
63
- parseInt(hex3[1] + hex3[1], 16),
64
- parseInt(hex3[2] + hex3[2], 16),
65
- parseInt(hex3[3] + hex3[3], 16),
66
- ];
67
- return `rgb(${r}, ${g}, ${b})`;
68
- }
69
- const named = NAMED_COLORS[v.toLowerCase()];
70
- if (named) return `rgb(${named[0]}, ${named[1]}, ${named[2]})`;
71
- return v;
72
- }
73
-
74
- function buildBorderOverrideMap(document, window) {
75
- const map = new Map();
76
- const rootStyle = window.getComputedStyle(document.documentElement);
77
-
78
- function resolveVar(value, depth = 0) {
79
- if (!value || depth > 10 || !value.includes('var(')) return value;
80
- return value.replace(
81
- /var\(\s*(--[\w-]+)\s*(?:,\s*([^)]+))?\s*\)/g,
82
- (_, name, fallback) => {
83
- const v = rootStyle.getPropertyValue(name).trim();
84
- if (v) return resolveVar(v, depth + 1);
85
- if (fallback) return resolveVar(fallback.trim(), depth + 1);
86
- return '';
87
- }
88
- );
89
- }
90
-
91
- function parseShorthand(text) {
92
- const m = text.trim().match(BORDER_SHORTHAND_RE);
93
- if (!m) return null;
94
- return { width: parseFloat(m[1]), color: normalizeColorForCheck(m[3]) };
95
- }
96
-
97
- // Read from the per-property accessors on rule.style. jsdom preserves
98
- // each border-* shorthand it parsed, even when the overall cssText has
99
- // been truncated (e.g. a `border: 1px solid var(...)` followed by a
100
- // `border-left: ...` loses the first declaration but keeps the second).
101
- const SIDE_PROPS = [
102
- ['borderLeft', 'Left'],
103
- ['borderRight', 'Right'],
104
- ['borderTop', 'Top'],
105
- ['borderBottom', 'Bottom'],
106
- ['borderInlineStart', 'Left'],
107
- ['borderInlineEnd', 'Right'],
108
- ];
109
-
110
- for (const sheet of document.styleSheets) {
111
- let rules;
112
- try { rules = sheet.cssRules || []; } catch { continue; }
113
- for (const rule of rules) {
114
- // CSSStyleRule only; skip @media / @keyframes / @supports wrappers.
115
- if (rule.type !== 1 || !rule.style || !rule.selectorText) continue;
116
-
117
- const perSide = {};
118
-
119
- for (const [prop, side] of SIDE_PROPS) {
120
- const val = rule.style[prop];
121
- if (!val || !val.includes('var(')) continue;
122
- const parsed = parseShorthand(resolveVar(val));
123
- if (parsed && parsed.color) perSide[side] = parsed;
124
- }
125
-
126
- // Uniform `border: <w> <style> var(...)` applies to every side the
127
- // per-side map didn't already claim.
128
- const borderAll = rule.style.border;
129
- if (borderAll && borderAll.includes('var(')) {
130
- const parsed = parseShorthand(resolveVar(borderAll));
131
- if (parsed && parsed.color) {
132
- for (const s of ['Top', 'Right', 'Bottom', 'Left']) {
133
- if (!perSide[s]) perSide[s] = parsed;
134
- }
135
- }
136
- }
137
-
138
- // Longhand `border-*-color: var(...)` with width/style in separate
139
- // declarations. Rare in AI-generated pages, but cheap to cover.
140
- for (const [prop, side] of [
141
- ['borderLeftColor', 'Left'],
142
- ['borderRightColor', 'Right'],
143
- ['borderTopColor', 'Top'],
144
- ['borderBottomColor', 'Bottom'],
145
- ]) {
146
- const val = rule.style[prop];
147
- if (!val || !val.includes('var(')) continue;
148
- const resolved = resolveVar(val).trim();
149
- if (!resolved) continue;
150
- // Width may or may not come from this rule — that's fine; the
151
- // adapter only substitutes the color when jsdom left it as a
152
- // literal var() string.
153
- if (!perSide[side]) perSide[side] = { width: 0, color: normalizeColorForCheck(resolved) };
154
- }
155
-
156
- if (Object.keys(perSide).length === 0) continue;
157
-
158
- let matched;
159
- try { matched = document.querySelectorAll(rule.selectorText); }
160
- catch { continue; }
161
-
162
- for (const el of matched) {
163
- const existing = map.get(el);
164
- if (existing) {
165
- // Later rules overwrite earlier ones — approximates source-order
166
- // cascade for equal-specificity rules and is good enough for the
167
- // uncontested var()-dropped sides we're trying to recover.
168
- Object.assign(existing, perSide);
169
- } else {
170
- map.set(el, { ...perSide });
171
- }
172
- }
173
- }
174
- }
175
-
176
- return map;
177
- }
178
-
179
- // Strip `@layer NAME { … }` wrappers from a CSS / HTML source, leaving
180
- // the inner rules as flat CSS. jsdom doesn't implement CSS @layer, so
181
- // any rule inside a layer block becomes invisible to getComputedStyle.
182
- // Tailwind v4 makes this ubiquitous: every utility class lives in
183
- // `@layer utilities`, and Preflight lives in `@layer base`. Without
184
- // unwrapping, every Tailwind-styled element returns empty computed
185
- // styles. We walk the source character-by-character, balancing braces
186
- // so we correctly handle nested style rules inside the layer block.
187
- function unwrapCssAtLayer(source) {
188
- if (!source || !source.includes('@layer')) return source;
189
- // Find `@layer <name>? {` openers. The match starts at the @, and
190
- // we then balance braces from the opening { onward.
191
- const re = /@layer\b[^{;]*\{/g;
192
- let out = '';
193
- let lastIdx = 0;
194
- let m;
195
- while ((m = re.exec(source)) !== null) {
196
- const openStart = m.index;
197
- const openEnd = m.index + m[0].length; // position right after `{`
198
- let depth = 1;
199
- let i = openEnd;
200
- while (i < source.length && depth > 0) {
201
- const c = source.charCodeAt(i);
202
- if (c === 0x7b /* { */) depth++;
203
- else if (c === 0x7d /* } */) depth--;
204
- i++;
205
- }
206
- if (depth !== 0) {
207
- // Unbalanced — bail and return source unchanged.
208
- return source;
209
- }
210
- // Emit everything before the @layer, then the inner contents
211
- // (between the opening { and the matched closing }), then advance.
212
- out += source.slice(lastIdx, openStart);
213
- out += source.slice(openEnd, i - 1); // i-1 = position of the closing }
214
- lastIdx = i;
215
- re.lastIndex = i;
216
- }
217
- out += source.slice(lastIdx);
218
- return out;
219
- }
220
-
221
- // ---------------------------------------------------------------------------
222
- // Static HTML/CSS detection (default for local HTML files)
223
- // ---------------------------------------------------------------------------
224
-
225
- const STATIC_INHERITED_PROPS = new Set([
226
- 'color', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'fontVariant',
227
- 'lineHeight', 'letterSpacing', 'textTransform', 'textAlign', 'hyphens',
228
- 'webkitHyphens',
229
- ]);
230
-
231
- const STATIC_DEFAULT_STYLE = {
232
- color: 'rgb(0, 0, 0)',
233
- backgroundColor: 'rgba(0, 0, 0, 0)',
234
- backgroundImage: 'none',
235
- borderTopWidth: '0px',
236
- borderRightWidth: '0px',
237
- borderBottomWidth: '0px',
238
- borderLeftWidth: '0px',
239
- borderTopColor: 'rgb(0, 0, 0)',
240
- borderRightColor: 'rgb(0, 0, 0)',
241
- borderBottomColor: 'rgb(0, 0, 0)',
242
- borderLeftColor: 'rgb(0, 0, 0)',
243
- borderRadius: '0px',
244
- outlineWidth: '0px',
245
- outlineColor: 'rgb(0, 0, 0)',
246
- outlineStyle: 'none',
247
- boxShadow: 'none',
248
- // NOT in STATIC_INHERITED_PROPS even though text-shadow inherits in real
249
- // CSS: the glow check only needs to fire once, on the element that
250
- // declares the shadow, not on every descendant.
251
- textShadow: 'none',
252
- fontFamily: '',
253
- fontSize: '16px',
254
- fontStyle: 'normal',
255
- fontVariant: 'normal',
256
- fontWeight: '400',
257
- lineHeight: 'normal',
258
- letterSpacing: 'normal',
259
- textTransform: 'none',
260
- textAlign: 'start',
261
- hyphens: 'manual',
262
- webkitHyphens: 'manual',
263
- transitionProperty: '',
264
- transitionTimingFunction: '',
265
- animationName: '',
266
- animationTimingFunction: '',
267
- webkitBackgroundClip: '',
268
- backgroundClip: '',
269
- width: '',
270
- height: '',
271
- paddingTop: '0px',
272
- paddingRight: '0px',
273
- paddingBottom: '0px',
274
- paddingLeft: '0px',
275
- marginTop: '0px',
276
- marginRight: '0px',
277
- marginBottom: '0px',
278
- marginLeft: '0px',
279
- position: 'static',
280
- visibility: 'visible',
281
- top: 'auto',
282
- right: 'auto',
283
- bottom: 'auto',
284
- left: 'auto',
285
- inset: '',
286
- display: '',
287
- overflow: 'visible',
288
- overflowX: 'visible',
289
- overflowY: 'visible',
290
- };
291
-
292
- const STATIC_PROP_MAP = {
293
- 'background-color': 'backgroundColor',
294
- 'background-image': 'backgroundImage',
295
- 'background-clip': 'backgroundClip',
296
- '-webkit-background-clip': 'webkitBackgroundClip',
297
- 'border-radius': 'borderRadius',
298
- 'border-top-width': 'borderTopWidth',
299
- 'border-right-width': 'borderRightWidth',
300
- 'border-bottom-width': 'borderBottomWidth',
301
- 'border-left-width': 'borderLeftWidth',
302
- 'border-top-color': 'borderTopColor',
303
- 'border-right-color': 'borderRightColor',
304
- 'border-bottom-color': 'borderBottomColor',
305
- 'border-left-color': 'borderLeftColor',
306
- 'outline-width': 'outlineWidth',
307
- 'outline-color': 'outlineColor',
308
- 'outline-style': 'outlineStyle',
309
- 'box-shadow': 'boxShadow',
310
- 'text-shadow': 'textShadow',
311
- 'font-family': 'fontFamily',
312
- 'font-size': 'fontSize',
313
- 'font-style': 'fontStyle',
314
- 'font-weight': 'fontWeight',
315
- 'line-height': 'lineHeight',
316
- 'letter-spacing': 'letterSpacing',
317
- 'text-transform': 'textTransform',
318
- 'text-align': 'textAlign',
319
- 'hyphens': 'hyphens',
320
- '-webkit-hyphens': 'webkitHyphens',
321
- 'transition-property': 'transitionProperty',
322
- 'transition-timing-function': 'transitionTimingFunction',
323
- 'animation-name': 'animationName',
324
- 'animation-timing-function': 'animationTimingFunction',
325
- 'width': 'width',
326
- 'height': 'height',
327
- 'padding-top': 'paddingTop',
328
- 'padding-right': 'paddingRight',
329
- 'padding-bottom': 'paddingBottom',
330
- 'padding-left': 'paddingLeft',
331
- 'margin-top': 'marginTop',
332
- 'margin-right': 'marginRight',
333
- 'margin-bottom': 'marginBottom',
334
- 'margin-left': 'marginLeft',
335
- 'position': 'position',
336
- 'visibility': 'visibility',
337
- 'top': 'top',
338
- 'right': 'right',
339
- 'bottom': 'bottom',
340
- 'left': 'left',
341
- 'inset': 'inset',
342
- 'display': 'display',
343
- 'overflow': 'overflow',
344
- 'overflow-x': 'overflowX',
345
- 'overflow-y': 'overflowY',
346
- };
347
-
348
- // parseStaticColor tries parseAnyColor first, which already resolves every
349
- // name in the shared CSS_NAMED_COLORS table. This fallback only carries the
350
- // keywords parseAnyColor deliberately returns null for: the cascade needs
351
- // `transparent` to read as an actual zero-alpha color.
352
- const STATIC_NAMED_COLORS = {
353
- transparent: { r: 0, g: 0, b: 0, a: 0 },
354
- };
355
-
356
- // Named-color alternation for plucking a color token out of shorthand values
357
- // (issue #359: a hardcoded 9-name list here silently dropped `purple`,
358
- // `crimson`, `teal`, ... from border shorthands, so the side defaulted to
359
- // neutral black and side-tab never fired on .html files). Derived from the
360
- // same table parseAnyColor resolves against, so extraction and parsing can't
361
- // drift apart. Longest-first so names containing other names as substrings
362
- // (rebeccapurple) are matched whole.
363
- const NAMED_COLOR_TOKENS = [...Object.keys(CSS_NAMED_COLORS), ...Object.keys(STATIC_NAMED_COLORS)]
364
- .sort((a, b) => b.length - a.length)
365
- .join('|');
366
- const STATIC_COLOR_TOKEN_RE = new RegExp(
367
- `(?:rgba?\\([^)]+\\)|oklch\\([^)]+\\)|oklab\\([^)]+\\)|lch\\([^)]+\\)|lab\\([^)]+\\)|hsla?\\([^)]+\\)|hwb\\([^)]+\\)|#[0-9a-f]{3,8}\\b|\\b(?:${NAMED_COLOR_TOKENS})\\b)`,
368
- 'i'
369
- );
370
-
371
- function splitCssList(value) {
372
- const parts = [];
373
- let depth = 0, quote = '', start = 0;
374
- for (let i = 0; i < value.length; i++) {
375
- const ch = value[i];
376
- if (quote) {
377
- if (ch === quote && value[i - 1] !== '\\') quote = '';
378
- continue;
379
- }
380
- if (ch === '"' || ch === "'") { quote = ch; continue; }
381
- if (ch === '(' || ch === '[') depth++;
382
- else if (ch === ')' || ch === ']') depth = Math.max(0, depth - 1);
383
- else if (ch === ',' && depth === 0) {
384
- parts.push(value.slice(start, i).trim());
385
- start = i + 1;
386
- }
387
- }
388
- const tail = value.slice(start).trim();
389
- if (tail) parts.push(tail);
390
- return parts;
391
- }
392
-
393
- function splitCssTokens(value) {
394
- const tokens = [];
395
- let depth = 0, quote = '', current = '';
396
- for (let i = 0; i < value.length; i++) {
397
- const ch = value[i];
398
- if (quote) {
399
- current += ch;
400
- if (ch === quote && value[i - 1] !== '\\') quote = '';
401
- continue;
402
- }
403
- if (ch === '"' || ch === "'") { quote = ch; current += ch; continue; }
404
- if (ch === '(') { depth++; current += ch; continue; }
405
- if (ch === ')') { depth = Math.max(0, depth - 1); current += ch; continue; }
406
- if (/\s/.test(ch) && depth === 0) {
407
- if (current) { tokens.push(current); current = ''; }
408
- continue;
409
- }
410
- current += ch;
411
- }
412
- if (current) tokens.push(current);
413
- return tokens;
414
- }
415
-
416
- function cssPropToCamel(prop) {
417
- if (!prop) return prop;
418
- const mapped = STATIC_PROP_MAP[prop];
419
- if (mapped) return mapped;
420
- return prop.replace(/-([a-z])/g, (_m, ch) => ch.toUpperCase());
421
- }
422
-
423
- function staticColorToCss(c) {
424
- if (!c) return '';
425
- if (c.a != null && c.a < 1) return `rgba(${c.r}, ${c.g}, ${c.b}, ${Number(c.a.toFixed(3))})`;
426
- return `rgb(${c.r}, ${c.g}, ${c.b})`;
427
- }
428
-
429
- function parseStaticColor(value) {
430
- const parsed = parseAnyColor(value);
431
- if (parsed) return parsed;
432
- const named = STATIC_NAMED_COLORS[String(value || '').trim().toLowerCase()];
433
- return named ? { ...named } : null;
434
- }
435
-
436
- function extractStaticColor(value) {
437
- if (!value) return '';
438
- const raw = String(value).trim();
439
- if (/^var\(/i.test(raw)) return raw;
440
- // color-mix(...) needs balanced-paren capture (its arguments regularly
441
- // contain nested var()/oklch() calls AND the keyword `transparent`, which
442
- // the flat regex below would otherwise pluck out of the middle of the
443
- // expression and report as the whole color).
444
- const mixStart = raw.search(/color-mix\(/i);
445
- if (mixStart !== -1) {
446
- let depth = 0;
447
- for (let i = raw.indexOf('(', mixStart); i < raw.length; i++) {
448
- if (raw[i] === '(') depth++;
449
- else if (raw[i] === ')') {
450
- depth--;
451
- if (depth === 0) return raw.slice(mixStart, i + 1);
452
- }
453
- }
454
- return '';
455
- }
456
- const colorLike = raw.match(STATIC_COLOR_TOKEN_RE);
457
- if (!colorLike) return '';
458
- return colorLike[0];
459
- }
460
-
461
- function normalizeStaticCssValue(prop, value, customProps, parentStyle, currentStyle = null) {
462
- let resolved = resolveVarRefs(String(value || '').trim(), customProps);
463
- if (resolved === 'inherit') return parentStyle?.[prop] || STATIC_DEFAULT_STYLE[prop] || '';
464
- const isModernBorderColor = /^border[A-Z][a-z]+Color$/.test(prop) && /^(?:oklch|oklab|lch|lab|hsl|hwb)\(/i.test(resolved);
465
- if (!isModernBorderColor && (/color$/i.test(prop) || prop === 'color' || prop === 'backgroundColor')) {
466
- const parsed = parseStaticColor(resolved);
467
- if (parsed) resolved = staticColorToCss(parsed);
468
- }
469
- if (prop === 'fontSize') {
470
- const base = parseFloat(parentStyle?.fontSize) || 16;
471
- const px = resolveLengthPx(resolved, base);
472
- if (px != null) resolved = `${px}px`;
473
- }
474
- if (prop === 'letterSpacing') {
475
- const base = parseFloat(currentStyle?.fontSize || parentStyle?.fontSize) || 16;
476
- const px = resolveLengthPx(resolved, base);
477
- if (px != null) resolved = `${px}px`;
478
- }
479
- if (prop === 'lineHeight' && resolved !== 'normal') {
480
- const base = parseFloat(currentStyle?.fontSize || parentStyle?.fontSize) || 16;
481
- const px = resolveLengthPx(resolved, base);
482
- if (px != null) resolved = `${px}px`;
483
- }
484
- return resolved;
485
- }
486
-
487
- function expandStaticBoxValues(tokens) {
488
- if (tokens.length === 0) return ['0px', '0px', '0px', '0px'];
489
- if (tokens.length === 1) return [tokens[0], tokens[0], tokens[0], tokens[0]];
490
- if (tokens.length === 2) return [tokens[0], tokens[1], tokens[0], tokens[1]];
491
- if (tokens.length === 3) return [tokens[0], tokens[1], tokens[2], tokens[1]];
492
- return [tokens[0], tokens[1], tokens[2], tokens[3]];
493
- }
494
-
495
- function parseStaticBorder(value) {
496
- const tokens = splitCssTokens(value);
497
- let width = '', color = '';
498
- for (const token of tokens) {
499
- if (!width && /^-?[\d.]+(?:px|rem|em|%)$/.test(token)) width = token;
500
- if (!color) color = extractStaticColor(token);
501
- }
502
- return { width, color };
503
- }
504
-
505
- function parseStaticFont(value) {
506
- const out = [];
507
- const slashParts = value.match(/(?:^|\s)([\d.]+(?:px|rem|em|%))(?:\/([^\s]+))?/);
508
- if (/\bitalic\b/i.test(value)) out.push(['fontStyle', 'italic']);
509
- const weight = value.match(/\b([1-9]00|bold|normal|lighter|bolder)\b/i);
510
- if (weight) out.push(['fontWeight', weight[1]]);
511
- if (slashParts) {
512
- out.push(['fontSize', slashParts[1]]);
513
- if (slashParts[2]) out.push(['lineHeight', slashParts[2]]);
514
- const familyStart = value.indexOf(slashParts[0]) + slashParts[0].length;
515
- const family = value.slice(familyStart).trim();
516
- if (family) out.push(['fontFamily', family]);
517
- }
518
- return out;
519
- }
520
-
521
- function parseStaticTransition(value) {
522
- const props = [];
523
- const timings = [];
524
- for (const item of splitCssList(value)) {
525
- const tokens = splitCssTokens(item);
526
- const timing = tokens.find(token => /^(?:ease|linear|step-|cubic-bezier\()/i.test(token));
527
- if (timing) timings.push(timing);
528
- const prop = tokens.find(token => /^[a-z-]+$/i.test(token) && !/^(?:ease|linear|infinite|alternate|forwards|backwards|both|normal|none)$/.test(token) && !/s$/.test(token));
529
- if (prop) props.push(prop);
530
- }
531
- return {
532
- property: props.join(', '),
533
- timing: timings.join(', '),
534
- };
535
- }
536
-
537
- function parseStaticAnimation(value) {
538
- const names = [];
539
- const timings = [];
540
- for (const item of splitCssList(value)) {
541
- const tokens = splitCssTokens(item);
542
- const timing = tokens.find(token => /^(?:ease|linear|step-|cubic-bezier\()/i.test(token));
543
- if (timing) timings.push(timing);
544
- const name = tokens.find(token =>
545
- /^[a-z_-][\w-]*$/i.test(token) &&
546
- !/^(?:ease|linear|infinite|alternate|forwards|backwards|both|normal|none|running|paused)$/.test(token)
547
- );
548
- if (name) names.push(name);
549
- }
550
- return {
551
- name: names.join(', '),
552
- timing: timings.join(', '),
553
- };
554
- }
555
-
556
- function expandStaticDeclaration(prop, value) {
557
- const p = prop.toLowerCase();
558
- const v = String(value || '').trim();
559
- if (!v) return [];
560
- if (p.startsWith('--')) return [[p, v]];
561
- if (p === 'background') {
562
- const out = [];
563
- const hasImage = /gradient|url\(/i.test(v);
564
- if (hasImage) out.push(['backgroundImage', v]);
565
- const beforeImage = hasImage ? v.split(/(?:repeating-)?(?:linear|radial|conic)-gradient\(|url\(/i)[0] : v;
566
- const color = extractStaticColor(hasImage ? beforeImage : v);
567
- if (color) out.push(['backgroundColor', color]);
568
- // The `background` shorthand resets every longhand it does not set.
569
- // Without this, `pre code { background: none }` leaves an earlier
570
- // `background: var(--surface)` color standing and the contrast checks
571
- // measure text against a surface the browser never paints. var() values
572
- // stay untouched: they may resolve to a color later in the pipeline.
573
- if (!color && !hasImage && !/var\(/i.test(v)) {
574
- out.push(['backgroundColor', 'rgba(0, 0, 0, 0)']);
575
- out.push(['backgroundImage', 'none']);
576
- }
577
- return out;
578
- }
579
- if (p === 'border') {
580
- const parsed = parseStaticBorder(v);
581
- const out = [];
582
- for (const side of ['Top', 'Right', 'Bottom', 'Left']) {
583
- if (parsed.width) out.push([`border${side}Width`, parsed.width]);
584
- if (parsed.color) out.push([`border${side}Color`, parsed.color]);
585
- }
586
- return out;
587
- }
588
- if (p === 'outline') {
589
- // `outline` shorthand: width | style | color, in any order. Reuse the
590
- // border parser for width + color, then sniff a style keyword from the
591
- // tokens (solid|dashed|...). `outline: 0` (single-token zero) zeros
592
- // the width and effectively hides the outline.
593
- const tokens = splitCssTokens(v);
594
- const parsed = parseStaticBorder(v);
595
- const styleToken = tokens.find(t =>
596
- /^(none|hidden|solid|dashed|dotted|double|groove|ridge|inset|outset)$/i.test(t)
597
- );
598
- const out = [];
599
- if (parsed.width) out.push(['outlineWidth', parsed.width]);
600
- if (parsed.color) out.push(['outlineColor', parsed.color]);
601
- if (styleToken) out.push(['outlineStyle', styleToken.toLowerCase()]);
602
- // `outline: 0` with no other tokens: explicit zero width.
603
- if (!parsed.width && /^0(?:px|rem|em|%)?$/.test(v.trim())) {
604
- out.push(['outlineWidth', '0px']);
605
- }
606
- return out;
607
- }
608
- const sideMatch = p.match(/^border-(top|right|bottom|left)$/);
609
- if (sideMatch) {
610
- const parsed = parseStaticBorder(v);
611
- const side = sideMatch[1][0].toUpperCase() + sideMatch[1].slice(1);
612
- return [
613
- ...(parsed.width ? [[`border${side}Width`, parsed.width]] : []),
614
- ...(parsed.color ? [[`border${side}Color`, parsed.color]] : []),
615
- ];
616
- }
617
- if (p === 'border-width') {
618
- const vals = expandStaticBoxValues(splitCssTokens(v));
619
- return [
620
- ['borderTopWidth', vals[0]],
621
- ['borderRightWidth', vals[1]],
622
- ['borderBottomWidth', vals[2]],
623
- ['borderLeftWidth', vals[3]],
624
- ];
625
- }
626
- if (p === 'border-color') {
627
- const vals = expandStaticBoxValues(splitCssTokens(v));
628
- return [
629
- ['borderTopColor', vals[0]],
630
- ['borderRightColor', vals[1]],
631
- ['borderBottomColor', vals[2]],
632
- ['borderLeftColor', vals[3]],
633
- ];
634
- }
635
- if (p === 'padding') {
636
- const vals = expandStaticBoxValues(splitCssTokens(v));
637
- return [
638
- ['paddingTop', vals[0]],
639
- ['paddingRight', vals[1]],
640
- ['paddingBottom', vals[2]],
641
- ['paddingLeft', vals[3]],
642
- ];
643
- }
644
- if (p === 'margin') {
645
- const vals = expandStaticBoxValues(splitCssTokens(v));
646
- return [
647
- ['marginTop', vals[0]],
648
- ['marginRight', vals[1]],
649
- ['marginBottom', vals[2]],
650
- ['marginLeft', vals[3]],
651
- ];
652
- }
653
- if (p === 'font') return parseStaticFont(v);
654
- if (p === 'transition') {
655
- const parsed = parseStaticTransition(v);
656
- return [
657
- ...(parsed.property ? [['transitionProperty', parsed.property]] : []),
658
- ...(parsed.timing ? [['transitionTimingFunction', parsed.timing]] : []),
659
- ];
660
- }
661
- if (p === 'animation') {
662
- const parsed = parseStaticAnimation(v);
663
- return [
664
- ...(parsed.name ? [['animationName', parsed.name]] : []),
665
- ...(parsed.timing ? [['animationTimingFunction', parsed.timing]] : []),
666
- ];
667
- }
668
- const mapped = cssPropToCamel(p);
669
- if (STATIC_DEFAULT_STYLE[mapped] != null || STATIC_INHERITED_PROPS.has(mapped)) {
670
- return [[mapped, v]];
671
- }
672
- return [];
673
- }
674
-
675
- function compareStaticPriority(a, b) {
676
- if (!a) return true;
677
- if (!!b.important !== !!a.important) return !!b.important;
678
- if (!!b.inline !== !!a.inline) return !!b.inline;
679
- for (let i = 0; i < 3; i++) {
680
- if ((b.specificity[i] || 0) !== (a.specificity[i] || 0)) {
681
- return (b.specificity[i] || 0) > (a.specificity[i] || 0);
682
- }
683
- }
684
- return b.order >= a.order;
685
- }
686
-
687
- function staticSpecificity(selector) {
688
- const noWhere = selector.replace(/:where\([^)]*\)/g, '');
689
- const ids = (noWhere.match(/#[\w-]+/g) || []).length;
690
- const classes = (noWhere.match(/\.[\w-]+|\[[^\]]+\]|:(?!:)[\w-]+(?:\([^)]*\))?/g) || []).length;
691
- const stripped = noWhere
692
- .replace(/#[\w-]+/g, ' ')
693
- .replace(/\.[\w-]+|\[[^\]]+\]|:{1,2}[\w-]+(?:\([^)]*\))?/g, ' ')
694
- .replace(/[*>+~(),]/g, ' ');
695
- const types = (stripped.match(/\b[a-zA-Z][\w-]*\b/g) || []).length;
696
- return [ids, classes, types];
697
- }
698
-
699
- function applyStaticDeclaration(specified, node, prop, value, meta) {
700
- let map = specified.get(node);
701
- if (!map) { map = new Map(); specified.set(node, map); }
702
- for (const [expandedProp, expandedValue] of expandStaticDeclaration(prop, value)) {
703
- const existing = map.get(expandedProp);
704
- const next = { ...meta, prop: expandedProp, value: expandedValue };
705
- if (compareStaticPriority(existing, next)) map.set(expandedProp, next);
706
- }
707
- }
708
-
709
- function parseStaticStyleAttribute(styleText, orderBase = 0) {
710
- const decls = [];
711
- for (const part of String(styleText || '').split(';')) {
712
- const idx = part.indexOf(':');
713
- if (idx <= 0) continue;
714
- const prop = part.slice(0, idx).trim();
715
- let value = part.slice(idx + 1).trim();
716
- const important = /!important\s*$/i.test(value);
717
- value = value.replace(/\s*!important\s*$/i, '').trim();
718
- decls.push({ prop, value, important, order: orderBase + decls.length });
719
- }
720
- return decls;
721
- }
722
-
723
- function collectStaticCssRules(cssText, csstree) {
724
- const rules = [];
725
- let ast;
726
- try {
727
- ast = csstree.parse(cssText, { positions: false, parseValue: true, parseCustomProperty: false });
728
- } catch {
729
- return rules;
730
- }
731
- let order = 0;
732
- const walkList = (list, atRuleStack = []) => {
733
- list?.forEach?.(node => {
734
- if (node.type === 'Rule' && node.block) {
735
- if (atRuleStack.some(name => /keyframes$/i.test(name))) return;
736
- const selectorText = csstree.generate(node.prelude).trim();
737
- const declarations = [];
738
- node.block.children?.forEach?.(child => {
739
- if (child.type !== 'Declaration') return;
740
- declarations.push({
741
- prop: child.property,
742
- value: csstree.generate(child.value).trim(),
743
- important: !!child.important,
744
- });
745
- });
746
- for (const selector of splitCssList(selectorText)) {
747
- if (!selector) continue;
748
- // :hover rules can't be matched statically as-is (no interaction
749
- // state), but they carry real cascade weight while hovered. Tag
750
- // them and record a state-stripped selector so the hover pass can
751
- // find their targets; specificity stays computed from the ORIGINAL
752
- // selector (per CSS, :hover counts as a class).
753
- const isHover = /:hover\b/i.test(selector);
754
- let matchSelector = null;
755
- if (isHover) {
756
- matchSelector = selector.replace(/:hover\b/gi, '').trim();
757
- if (!matchSelector || /[>+~]\s*$/.test(matchSelector)) matchSelector = null;
758
- else matchSelector = matchSelector.replace(/(^|[\s>+~])(?=$|[\s>+~])/g, '$1*');
759
- }
760
- rules.push({ selector, declarations, specificity: staticSpecificity(selector), order: order++, isHover, matchSelector });
761
- }
762
- return;
763
- }
764
- if (node.type === 'Atrule' && node.block) {
765
- const name = String(node.name || '').toLowerCase();
766
- if (name === 'media' || name === 'supports' || name === 'layer') {
767
- walkList(node.block.children, [...atRuleStack, name]);
768
- }
769
- }
770
- });
771
- };
772
- walkList(ast.children);
773
- return rules;
774
- }
775
-
776
- class StaticElement {
777
- constructor(node, doc) {
778
- this.node = node;
779
- this._doc = doc;
780
- this.nodeType = 1;
781
- this.tagName = String(node.name || '').toUpperCase();
782
- this.nodeName = this.tagName;
783
- }
784
- get parentElement() {
785
- let cur = this.node.parent;
786
- while (cur && cur.type !== 'tag') cur = cur.parent;
787
- return cur ? this._doc.wrap(cur) : null;
788
- }
789
- get previousElementSibling() {
790
- let cur = this.node.prev;
791
- while (cur && cur.type !== 'tag') cur = cur.prev;
792
- return cur ? this._doc.wrap(cur) : null;
793
- }
794
- get children() {
795
- return (this.node.children || []).filter(child => child.type === 'tag').map(child => this._doc.wrap(child));
796
- }
797
- get childNodes() {
798
- return (this.node.children || []).map(child => {
799
- if (child.type === 'text') return { nodeType: 3, textContent: child.data || '' };
800
- if (child.type === 'tag') return this._doc.wrap(child);
801
- return { nodeType: 8, textContent: child.data || '' };
802
- });
803
- }
804
- get textContent() {
805
- return this._doc.domutils.textContent(this.node);
806
- }
807
- get className() {
808
- return this.getAttribute('class') || '';
809
- }
810
- get id() {
811
- return this.getAttribute('id') || '';
812
- }
813
- getAttribute(name) {
814
- return this.node.attribs?.[name] ?? null;
815
- }
816
- querySelector(selector) {
817
- try {
818
- const found = this._doc.selectOne(selector, this.node.children || []);
819
- return found ? this._doc.wrap(found) : null;
820
- } catch {
821
- return null;
822
- }
823
- }
824
- querySelectorAll(selector) {
825
- try {
826
- return this._doc.selectAll(selector, this.node.children || []).map(node => this._doc.wrap(node));
827
- } catch {
828
- return [];
829
- }
830
- }
831
- closest(selector) {
832
- let cur = this.node;
833
- while (cur && cur.type === 'tag') {
834
- try {
835
- if (this._doc.is(cur, selector)) return this._doc.wrap(cur);
836
- } catch {
837
- return null;
838
- }
839
- cur = cur.parent;
840
- while (cur && cur.type !== 'tag') cur = cur.parent;
841
- }
842
- return null;
843
- }
844
- contains(other) {
845
- let cur = other?.node || null;
846
- while (cur) {
847
- if (cur === this.node) return true;
848
- cur = cur.parent;
849
- }
850
- return false;
851
- }
852
- }
853
-
854
- class StaticDocument {
855
- constructor(root, modules) {
856
- this.root = root;
857
- this.selectAll = modules.selectAll;
858
- this.selectOne = modules.selectOne;
859
- this.is = modules.is;
860
- this.domutils = modules.domutils;
861
- this._wrappers = new WeakMap();
862
- this._styleMap = new WeakMap();
863
- this._hoverStyleMap = new WeakMap();
864
- this._accentDashPseudo = new WeakSet();
865
- // Elements whose ::before/::after paints a full-cover opaque surface
866
- // (position absolute/fixed + inset 0 + solid background). The pseudo is
867
- // the element's visible background for contrast purposes even though it
868
- // never joins the element cascade.
869
- this._pseudoSurface = new WeakMap();
870
- }
871
- wrap(node) {
872
- let wrapped = this._wrappers.get(node);
873
- if (!wrapped) {
874
- wrapped = new StaticElement(node, this);
875
- this._wrappers.set(node, wrapped);
876
- }
877
- return wrapped;
878
- }
879
- querySelectorAll(selector) {
880
- try {
881
- return this.selectAll(selector, this.root.children || []).map(node => this.wrap(node));
882
- } catch {
883
- return [];
884
- }
885
- }
886
- querySelector(selector) {
887
- try {
888
- const found = this.selectOne(selector, this.root.children || []);
889
- return found ? this.wrap(found) : null;
890
- } catch {
891
- return null;
892
- }
893
- }
894
- get documentElement() {
895
- return this.querySelector('html');
896
- }
897
- get body() {
898
- return this.querySelector('body');
899
- }
900
- setStyle(node, style) {
901
- this._styleMap.set(node, style);
902
- }
903
- getStyle(el) {
904
- return this._styleMap.get(el.node) || makeStaticStyle();
905
- }
906
- setHoverStyle(node, style) {
907
- this._hoverStyleMap.set(node, style);
908
- }
909
- getHoverStyle(el) {
910
- return this._hoverStyleMap.get(el.node) || null;
911
- }
912
- setAccentDashPseudo(node) {
913
- this._accentDashPseudo.add(node);
914
- }
915
- hasAccentDashPseudo(el) {
916
- return this._accentDashPseudo.has(el.node);
917
- }
918
- setPseudoSurface(node, color) {
919
- this._pseudoSurface.set(node, color);
920
- }
921
- getPseudoSurface(el) {
922
- return this._pseudoSurface.get(el.node) || null;
923
- }
924
- }
925
-
926
- function makeStaticStyle(values = {}) {
927
- const style = { ...STATIC_DEFAULT_STYLE, ...values };
928
- style.getPropertyValue = (prop) => {
929
- const key = cssPropToCamel(prop);
930
- return style[key] || style[prop] || '';
931
- };
932
- return style;
933
- }
934
-
935
- function buildStaticWindow(staticDoc) {
936
- return {
937
- document: staticDoc,
938
- getComputedStyle: (el) => staticDoc.getStyle(el),
939
- getHoverStyle: (el) => staticDoc.getHoverStyle(el),
940
- hasAccentDashPseudo: (el) => staticDoc.hasAccentDashPseudo(el),
941
- getPseudoSurface: (el) => staticDoc.getPseudoSurface(el),
942
- };
943
- }
944
-
945
- function collectStaticCssText(root, fileDir, profile, filePath, modules) {
946
- const styleTexts = [];
947
- for (const styleEl of modules.selectAll('style', root.children || [])) {
948
- styleTexts.push(modules.domutils.textContent(styleEl));
949
- }
950
- const links = modules.selectAll('link', root.children || []);
951
- for (const link of links) {
952
- const rel = link.attribs?.rel || '';
953
- const href = link.attribs?.href || '';
954
- if (!/\bstylesheet\b/i.test(rel) || !href || /^(https?:)?\/\//i.test(href)) continue;
955
- // Cache-busting hrefs (styles.css?v=3) resolve to the file, not to a
956
- // literal path with the query in it; a versioned link otherwise made the
957
- // whole stylesheet invisible to every element-level check.
958
- const cssPath = path.resolve(fileDir, href.split(/[?#]/)[0]);
959
- try {
960
- const css = profileStep(profile, {
961
- engine: 'static-html',
962
- phase: 'preprocess',
963
- ruleId: 'inline-linked-stylesheet',
964
- target: filePath,
965
- detail: href,
966
- }, () => fs.readFileSync(cssPath, 'utf-8'));
967
- styleTexts.push(css);
968
- } catch { /* skip unreadable */ }
969
- }
970
- return styleTexts.join('\n');
971
- }
972
-
973
- function buildStaticStyleMap(root, staticDoc, cssText, modules, profile, filePath) {
974
- const specified = new Map();
975
- // Declarations from :hover rules, matched via their state-stripped
976
- // selectors. Merged per-property against the resting cascade in
977
- // computeNode — a hover declaration only takes effect if it would win
978
- // the cascade while the element is hovered (all resting rules still
979
- // apply in that state).
980
- const hoverSpecified = new Map();
981
- const rootCustomProps = collectCssCustomProps(cssText);
982
- const allNodes = modules.selectAll('*', root.children || []);
983
- const rules = profileStep(profile, {
984
- engine: 'static-html',
985
- phase: 'parse-css',
986
- ruleId: 'css-rules',
987
- target: filePath,
988
- }, () => collectStaticCssRules(cssText, modules.csstree));
989
-
990
- profileStep(profile, {
991
- engine: 'static-html',
992
- phase: 'selector-match',
993
- ruleId: 'css-selectors',
994
- target: filePath,
995
- }, () => {
996
- for (const rule of rules) {
997
- // ::before/::after rules can't join the element cascade (pseudo
998
- // elements aren't DOM nodes), but one shape matters to the eyebrow
999
- // check: the short chromatic "kicker dash" (content box 8-80px wide,
1000
- // 1-6px tall, accent-colored fill). Mark the base-selector matches
1001
- // so checkElementHeroEyebrow can see the dash.
1002
- if (!rule.isHover) {
1003
- const pm = rule.selector.match(/^(.+?)\s*::?(?:before|after)$/i);
1004
- if (pm) {
1005
- const decls = new Map();
1006
- for (const d of rule.declarations) decls.set(d.prop.toLowerCase(), d.value);
1007
- const w = cssLengthToPx(resolveVarRefs(decls.get('width') || decls.get('inline-size') || '', rootCustomProps));
1008
- const h = cssLengthToPx(resolveVarRefs(decls.get('height') || decls.get('block-size') || '', rootCustomProps));
1009
- if (w != null && h != null && w >= 8 && w <= 80 && h >= 1 && h <= 6) {
1010
- const bgRaw = String(resolveVarRefs(decls.get('background-color') || decls.get('background') || '', rootCustomProps));
1011
- const token = bgRaw.match(/(?:rgba?|hsla?|oklch|oklab|lab|lch|hwb|color-mix)\([^)]*(?:\([^)]*\))?[^)]*\)|#[0-9a-f]{3,8}\b/i);
1012
- const c = parseAnyColor(token ? token[0] : bgRaw);
1013
- if (c && (c.a ?? 1) >= 0.1 && Math.max(c.r, c.g, c.b) - Math.min(c.r, c.g, c.b) >= 30) {
1014
- try {
1015
- for (const node of modules.selectAll(pm[1], root.children || [])) {
1016
- staticDoc.setAccentDashPseudo(node);
1017
- }
1018
- } catch { /* unsupported base selector */ }
1019
- }
1020
- }
1021
- // Full-cover surface pseudo: the CTA construction where the
1022
- // element itself stays transparent and a ::before/::after with
1023
- // position absolute/fixed + inset 0 (or all four sides 0, or
1024
- // 100% width and height) plus an opaque background paints the
1025
- // visible surface. Mark base-selector matches so the contrast
1026
- // checks measure text against the surface the browser renders.
1027
- const pseudoPos = String(decls.get('position') || '').toLowerCase();
1028
- if (pseudoPos === 'absolute' || pseudoPos === 'fixed') {
1029
- const zeroLen = v => v != null && /^0(?:px)?$/.test(String(v).trim());
1030
- const insetRaw = String(decls.get('inset') || '').trim();
1031
- const coversBox = (insetRaw !== '' && insetRaw.split(/\s+/).every(t => /^0(?:px)?$/.test(t)))
1032
- || ['top', 'right', 'bottom', 'left'].every(side => zeroLen(decls.get(side)))
1033
- || (String(decls.get('width') || '').trim() === '100%'
1034
- && String(decls.get('height') || '').trim() === '100%');
1035
- if (coversBox && decls.has('content')) {
1036
- const surfRaw = String(resolveVarRefs(decls.get('background-color') || decls.get('background') || '', rootCustomProps));
1037
- const surfToken = surfRaw.match(/(?:rgba?|hsla?|oklch|oklab|lab|lch|hwb|color-mix)\([^)]*(?:\([^)]*\))?[^)]*\)|#[0-9a-f]{3,8}\b/i);
1038
- const surf = parseAnyColor(surfToken ? surfToken[0] : surfRaw);
1039
- if (surf && (surf.a ?? 1) >= 0.9 && !/gradient/i.test(surfRaw)) {
1040
- try {
1041
- for (const node of modules.selectAll(pm[1], root.children || [])) {
1042
- staticDoc.setPseudoSurface(node, surf);
1043
- }
1044
- } catch { /* unsupported base selector */ }
1045
- }
1046
- }
1047
- }
1048
- continue;
1049
- }
1050
- }
1051
- const matchSelector = rule.isHover ? rule.matchSelector : rule.selector;
1052
- if (!matchSelector) continue;
1053
- let matched;
1054
- try {
1055
- matched = modules.selectAll(matchSelector, root.children || []);
1056
- } catch {
1057
- recordProfileEvent(profile, {
1058
- engine: 'static-html',
1059
- phase: 'selector-match',
1060
- ruleId: 'unsupported-selector',
1061
- target: filePath,
1062
- ms: 0,
1063
- findings: 0,
1064
- detail: matchSelector,
1065
- });
1066
- continue;
1067
- }
1068
- for (const node of matched) {
1069
- for (const decl of rule.declarations) {
1070
- applyStaticDeclaration(rule.isHover ? hoverSpecified : specified, node, decl.prop, decl.value, {
1071
- important: decl.important,
1072
- specificity: rule.specificity,
1073
- order: rule.order,
1074
- inline: false,
1075
- });
1076
- }
1077
- }
1078
- }
1079
-
1080
- let inlineOrder = rules.length + 1;
1081
- for (const node of allNodes) {
1082
- const styleText = node.attribs?.style;
1083
- if (!styleText) continue;
1084
- for (const decl of parseStaticStyleAttribute(styleText, inlineOrder)) {
1085
- applyStaticDeclaration(specified, node, decl.prop, decl.value, {
1086
- important: decl.important,
1087
- specificity: [1, 0, 0],
1088
- order: decl.order,
1089
- inline: true,
1090
- });
1091
- }
1092
- inlineOrder += 1000;
1093
- }
1094
- });
1095
-
1096
- const computeNode = (node, parentStyle = null, parentCustom = new Map()) => {
1097
- const specifiedMap = specified.get(node) || new Map();
1098
- const customProps = new Map(parentCustom);
1099
- for (const [prop, decl] of specifiedMap) {
1100
- if (prop.startsWith('--')) customProps.set(prop, resolveVarRefs(decl.value, customProps));
1101
- }
1102
- const values = {};
1103
- for (const prop of Object.keys(STATIC_DEFAULT_STYLE)) {
1104
- if (STATIC_INHERITED_PROPS.has(prop) && parentStyle?.[prop] != null) values[prop] = parentStyle[prop];
1105
- else values[prop] = STATIC_DEFAULT_STYLE[prop];
1106
- }
1107
- for (const [prop, decl] of specifiedMap) {
1108
- if (prop.startsWith('--')) continue;
1109
- values[prop] = normalizeStaticCssValue(prop, decl.value, customProps, parentStyle, values);
1110
- }
1111
- const style = makeStaticStyle(values);
1112
- staticDoc.setStyle(node, style);
1113
-
1114
- // Hover pass: limited to the two properties the hover-contrast check
1115
- // consumes. A hover declaration wins only if it beats the resting
1116
- // winner for that property under normal cascade rules (specificity /
1117
- // order / importance) — exactly what a browser computes while the
1118
- // element is hovered.
1119
- const hoverMap = hoverSpecified.get(node);
1120
- if (hoverMap) {
1121
- let hoverValues = null;
1122
- for (const prop of ['color', 'backgroundColor']) {
1123
- const hoverDecl = hoverMap.get(prop);
1124
- if (!hoverDecl) continue;
1125
- const restingDecl = specifiedMap.get(prop);
1126
- if (!compareStaticPriority(restingDecl, hoverDecl)) continue;
1127
- const next = normalizeStaticCssValue(prop, hoverDecl.value, customProps, parentStyle, values);
1128
- if (next === values[prop]) continue;
1129
- if (!hoverValues) hoverValues = { ...values };
1130
- hoverValues[prop] = next;
1131
- }
1132
- if (hoverValues) staticDoc.setHoverStyle(node, makeStaticStyle(hoverValues));
1133
- }
1134
-
1135
- for (const child of node.children || []) {
1136
- if (child.type === 'tag') computeNode(child, style, customProps);
1137
- }
1138
- };
1139
-
1140
- profileStep(profile, {
1141
- engine: 'static-html',
1142
- phase: 'cascade',
1143
- ruleId: 'compute-styles',
1144
- target: filePath,
1145
- }, () => {
1146
- for (const child of root.children || []) {
1147
- if (child.type === 'tag') computeNode(child);
1148
- }
1149
- });
1150
- }
1151
-
1152
- export {
1153
- BORDER_SHORTHAND_RE,
1154
- NAMED_COLORS,
1155
- normalizeColorForCheck,
1156
- buildBorderOverrideMap,
1157
- unwrapCssAtLayer,
1158
- STATIC_INHERITED_PROPS,
1159
- STATIC_DEFAULT_STYLE,
1160
- STATIC_PROP_MAP,
1161
- STATIC_NAMED_COLORS,
1162
- splitCssList,
1163
- splitCssTokens,
1164
- cssPropToCamel,
1165
- staticColorToCss,
1166
- parseStaticColor,
1167
- extractStaticColor,
1168
- normalizeStaticCssValue,
1169
- expandStaticBoxValues,
1170
- parseStaticBorder,
1171
- parseStaticFont,
1172
- parseStaticTransition,
1173
- parseStaticAnimation,
1174
- expandStaticDeclaration,
1175
- compareStaticPriority,
1176
- staticSpecificity,
1177
- applyStaticDeclaration,
1178
- parseStaticStyleAttribute,
1179
- collectStaticCssRules,
1180
- StaticElement,
1181
- StaticDocument,
1182
- makeStaticStyle,
1183
- buildStaticWindow,
1184
- collectStaticCssText,
1185
- buildStaticStyleMap,
1186
- };