@ethlete/cli 3.0.0-next.27 → 3.0.0-next.28

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 (582) hide show
  1. package/CHANGELOG.md +153 -0
  2. package/build-info.json +1 -1
  3. package/design/arrow-anchor.ts +55 -0
  4. package/design/define-call.ts +3 -0
  5. package/design/define-part.ts +28 -1
  6. package/design/web/frame.ts +28 -0
  7. package/package.json +1 -1
  8. package/src/lib/api/compose.js +3 -2
  9. package/src/lib/api/compose.js.map +1 -1
  10. package/src/lib/api/git.js +2 -1
  11. package/src/lib/api/git.js.map +1 -1
  12. package/src/lib/api/setup.js +2 -2
  13. package/src/lib/api/setup.js.map +1 -1
  14. package/src/lib/design/asset-shot.js +2 -2
  15. package/src/lib/design/asset-shot.js.map +1 -1
  16. package/src/lib/design/blank-png.d.ts +2 -0
  17. package/src/lib/design/blank-png.js +28 -0
  18. package/src/lib/design/blank-png.js.map +1 -0
  19. package/src/lib/design/cache-entry.d.ts +8 -0
  20. package/src/lib/design/cache-entry.js +30 -0
  21. package/src/lib/design/cache-entry.js.map +1 -0
  22. package/src/lib/design/calls-tsconfig.js +20 -13
  23. package/src/lib/design/calls-tsconfig.js.map +1 -1
  24. package/src/lib/design/calls.js +3 -3
  25. package/src/lib/design/calls.js.map +1 -1
  26. package/src/lib/design/changed-parts.d.ts +1 -1
  27. package/src/lib/design/check.d.ts +2 -0
  28. package/src/lib/design/check.js +91 -24
  29. package/src/lib/design/check.js.map +1 -1
  30. package/src/lib/design/code-hash.d.ts +30 -0
  31. package/src/lib/design/code-hash.js +118 -0
  32. package/src/lib/design/code-hash.js.map +1 -0
  33. package/src/lib/design/commit-hunks.d.ts +2 -2
  34. package/src/lib/design/commit-hunks.js +2 -2
  35. package/src/lib/design/design-command.js +131 -36
  36. package/src/lib/design/design-command.js.map +1 -1
  37. package/src/lib/design/{paths.d.ts → design-config.d.ts} +6 -28
  38. package/src/lib/design/design-config.js +35 -0
  39. package/src/lib/design/design-config.js.map +1 -0
  40. package/src/lib/design/design-lint.d.ts +68 -0
  41. package/src/lib/design/design-lint.js +183 -0
  42. package/src/lib/design/design-lint.js.map +1 -0
  43. package/src/lib/design/draw-ledger.d.ts +6 -0
  44. package/src/lib/design/draw-ledger.js +10 -0
  45. package/src/lib/design/draw-ledger.js.map +1 -1
  46. package/src/lib/design/force-interactions.d.ts +2 -0
  47. package/src/lib/design/force-interactions.js +4 -2
  48. package/src/lib/design/force-interactions.js.map +1 -1
  49. package/src/lib/design/generated-stylesheets.d.ts +1 -1
  50. package/src/lib/design/generated-stylesheets.js +2 -2
  51. package/src/lib/design/generated-stylesheets.js.map +1 -1
  52. package/src/lib/design/git-top.d.ts +5 -0
  53. package/src/lib/design/git-top.js +16 -0
  54. package/src/lib/design/git-top.js.map +1 -0
  55. package/src/lib/design/hooks-problem.d.ts +2 -0
  56. package/src/lib/design/hooks-problem.js +23 -0
  57. package/src/lib/design/hooks-problem.js.map +1 -0
  58. package/src/lib/design/index.d.ts +4 -1
  59. package/src/lib/design/index.js +4 -1
  60. package/src/lib/design/index.js.map +1 -1
  61. package/src/lib/design/is-running.d.ts +1 -0
  62. package/src/lib/design/is-running.js +14 -0
  63. package/src/lib/design/is-running.js.map +1 -0
  64. package/src/lib/design/legacy.js +3 -3
  65. package/src/lib/design/legacy.js.map +1 -1
  66. package/src/lib/design/mcp-command.js +5 -12
  67. package/src/lib/design/mcp-command.js.map +1 -1
  68. package/src/lib/design/merge-compare.js +3 -3
  69. package/src/lib/design/merge-compare.js.map +1 -1
  70. package/src/lib/design/motion-command.js +3 -3
  71. package/src/lib/design/motion-command.js.map +1 -1
  72. package/src/lib/design/new-call.js +3 -3
  73. package/src/lib/design/new-call.js.map +1 -1
  74. package/src/lib/design/old-shot-folders.d.ts +2 -0
  75. package/src/lib/design/old-shot-folders.js +26 -0
  76. package/src/lib/design/old-shot-folders.js.map +1 -0
  77. package/src/lib/design/package-root.d.ts +21 -0
  78. package/src/lib/design/package-root.js +79 -0
  79. package/src/lib/design/package-root.js.map +1 -0
  80. package/src/lib/design/parent-watch.d.ts +7 -0
  81. package/src/lib/design/parent-watch.js +23 -0
  82. package/src/lib/design/parent-watch.js.map +1 -0
  83. package/src/lib/design/part-marks.js +2 -2
  84. package/src/lib/design/part-marks.js.map +1 -1
  85. package/src/lib/design/phase-timing.d.ts +5 -0
  86. package/src/lib/design/phase-timing.js +27 -0
  87. package/src/lib/design/phase-timing.js.map +1 -0
  88. package/src/lib/design/physical-cores.d.ts +12 -0
  89. package/src/lib/design/physical-cores.js +43 -0
  90. package/src/lib/design/physical-cores.js.map +1 -0
  91. package/src/lib/design/product-command.js +4 -4
  92. package/src/lib/design/product-command.js.map +1 -1
  93. package/src/lib/design/push-status.d.ts +30 -0
  94. package/src/lib/design/push-status.js +122 -0
  95. package/src/lib/design/push-status.js.map +1 -0
  96. package/src/lib/design/ready-shots.d.ts +18 -35
  97. package/src/lib/design/ready-shots.js +46 -111
  98. package/src/lib/design/ready-shots.js.map +1 -1
  99. package/src/lib/design/render-packages.d.ts +3 -1
  100. package/src/lib/design/render-packages.js +6 -2
  101. package/src/lib/design/render-packages.js.map +1 -1
  102. package/src/lib/design/render-worker.js +23 -3
  103. package/src/lib/design/render-worker.js.map +1 -1
  104. package/src/lib/design/render.d.ts +24 -3
  105. package/src/lib/design/render.js +23 -9
  106. package/src/lib/design/render.js.map +1 -1
  107. package/src/lib/design/resident/client.d.ts +52 -0
  108. package/src/lib/design/resident/client.js +263 -0
  109. package/src/lib/design/resident/client.js.map +1 -0
  110. package/src/lib/design/resident/discovery.d.ts +21 -0
  111. package/src/lib/design/resident/discovery.js +63 -0
  112. package/src/lib/design/resident/discovery.js.map +1 -0
  113. package/src/lib/design/resident/resident-process.d.ts +19 -0
  114. package/src/lib/design/resident/resident-process.js +189 -0
  115. package/src/lib/design/resident/resident-process.js.map +1 -0
  116. package/src/lib/design/resident/server.d.ts +52 -0
  117. package/src/lib/design/resident/server.js +212 -0
  118. package/src/lib/design/resident/server.js.map +1 -0
  119. package/src/lib/design/run-abort.d.ts +9 -0
  120. package/src/lib/design/run-abort.js +45 -0
  121. package/src/lib/design/run-abort.js.map +1 -0
  122. package/src/lib/design/run-deadline.d.ts +19 -0
  123. package/src/lib/design/run-deadline.js +104 -0
  124. package/src/lib/design/run-deadline.js.map +1 -0
  125. package/src/lib/design/run-yield.d.ts +8 -0
  126. package/src/lib/design/run-yield.js +43 -0
  127. package/src/lib/design/run-yield.js.map +1 -0
  128. package/src/lib/design/serve-state.d.ts +15 -0
  129. package/src/lib/design/serve-state.js +56 -0
  130. package/src/lib/design/serve-state.js.map +1 -0
  131. package/src/lib/design/serve.d.ts +20 -2
  132. package/src/lib/design/serve.js +147 -43
  133. package/src/lib/design/serve.js.map +1 -1
  134. package/src/lib/design/server-identity.d.ts +5 -1
  135. package/src/lib/design/server-identity.js +4 -1
  136. package/src/lib/design/server-identity.js.map +1 -1
  137. package/src/lib/design/shot-board.d.ts +26 -0
  138. package/src/lib/design/shot-board.js +80 -0
  139. package/src/lib/design/shot-board.js.map +1 -0
  140. package/src/lib/design/shot-command.d.ts +1 -1
  141. package/src/lib/design/shot-command.js +12 -5
  142. package/src/lib/design/shot-command.js.map +1 -1
  143. package/src/lib/design/shot-store.d.ts +29 -3
  144. package/src/lib/design/shot-store.js +206 -36
  145. package/src/lib/design/shot-store.js.map +1 -1
  146. package/src/lib/design/shot.d.ts +12 -4
  147. package/src/lib/design/shot.js +98 -14
  148. package/src/lib/design/shot.js.map +1 -1
  149. package/src/lib/design/sketch-at.js +2 -1
  150. package/src/lib/design/sketch-at.js.map +1 -1
  151. package/src/lib/design/sketch-command.d.ts +13 -0
  152. package/src/lib/design/sketch-command.js +346 -73
  153. package/src/lib/design/sketch-command.js.map +1 -1
  154. package/src/lib/design/ssr-shims.d.ts +1 -0
  155. package/src/lib/design/ssr-shims.js +3 -3
  156. package/src/lib/design/ssr-shims.js.map +1 -1
  157. package/src/lib/design/stamp.d.ts +5 -0
  158. package/src/lib/design/stamp.js +6 -5
  159. package/src/lib/design/stamp.js.map +1 -1
  160. package/src/lib/design/status.d.ts +1 -1
  161. package/src/lib/design/status.js +15 -4
  162. package/src/lib/design/status.js.map +1 -1
  163. package/src/lib/design/studio-api.d.ts +7 -15
  164. package/src/lib/design/studio-api.js +39 -140
  165. package/src/lib/design/studio-api.js.map +1 -1
  166. package/src/lib/design/system/accepted-pictures.d.ts +15 -29
  167. package/src/lib/design/system/accepted-pictures.js +156 -134
  168. package/src/lib/design/system/accepted-pictures.js.map +1 -1
  169. package/src/lib/design/system/action-cache.d.ts +45 -0
  170. package/src/lib/design/system/action-cache.js +72 -0
  171. package/src/lib/design/system/action-cache.js.map +1 -0
  172. package/src/lib/design/system/action-lost.d.ts +8 -6
  173. package/src/lib/design/system/action-lost.js +13 -17
  174. package/src/lib/design/system/action-lost.js.map +1 -1
  175. package/src/lib/design/system/action-press.d.ts +7 -1
  176. package/src/lib/design/system/action-press.js +16 -4
  177. package/src/lib/design/system/action-press.js.map +1 -1
  178. package/src/lib/design/system/actions-command.d.ts +12 -5
  179. package/src/lib/design/system/actions-command.js +187 -66
  180. package/src/lib/design/system/actions-command.js.map +1 -1
  181. package/src/lib/design/system/actions.d.ts +27 -4
  182. package/src/lib/design/system/actions.js +59 -21
  183. package/src/lib/design/system/actions.js.map +1 -1
  184. package/src/lib/design/system/anti-alias.d.ts +2 -0
  185. package/src/lib/design/system/anti-alias.js +11 -0
  186. package/src/lib/design/system/anti-alias.js.map +1 -0
  187. package/src/lib/design/system/app-files.js +19 -3
  188. package/src/lib/design/system/app-files.js.map +1 -1
  189. package/src/lib/design/system/arrow-anchor.d.ts +9 -0
  190. package/src/lib/design/system/arrow-anchor.js +40 -0
  191. package/src/lib/design/system/arrow-anchor.js.map +1 -0
  192. package/src/lib/design/system/base-issues.d.ts +28 -0
  193. package/src/lib/design/system/base-issues.js +80 -0
  194. package/src/lib/design/system/base-issues.js.map +1 -0
  195. package/src/lib/design/system/base.d.ts +1 -1
  196. package/src/lib/design/system/base.js +2 -2
  197. package/src/lib/design/system/base.js.map +1 -1
  198. package/src/lib/design/system/baseline-history.d.ts +13 -0
  199. package/src/lib/design/system/baseline-history.js +40 -0
  200. package/src/lib/design/system/baseline-history.js.map +1 -0
  201. package/src/lib/design/system/bespoke-controls.d.ts +4 -1
  202. package/src/lib/design/system/bespoke-controls.js +72 -70
  203. package/src/lib/design/system/bespoke-controls.js.map +1 -1
  204. package/src/lib/design/system/build-ready-contract.d.ts +7 -1
  205. package/src/lib/design/system/build-ready-contract.js +7 -1
  206. package/src/lib/design/system/build-ready-contract.js.map +1 -1
  207. package/src/lib/design/system/build-running.d.ts +13 -0
  208. package/src/lib/design/system/build-running.js +48 -0
  209. package/src/lib/design/system/build-running.js.map +1 -0
  210. package/src/lib/design/system/check-record.d.ts +18 -0
  211. package/src/lib/design/system/check-record.js +47 -0
  212. package/src/lib/design/system/check-record.js.map +1 -0
  213. package/src/lib/design/system/check-rules.d.ts +1 -1
  214. package/src/lib/design/system/check-rules.js +19 -1
  215. package/src/lib/design/system/check-rules.js.map +1 -1
  216. package/src/lib/design/system/check-system.d.ts +25 -4
  217. package/src/lib/design/system/check-system.js +289 -121
  218. package/src/lib/design/system/check-system.js.map +1 -1
  219. package/src/lib/design/system/comments/inbox.d.ts +1 -1
  220. package/src/lib/design/system/compare-cache.d.ts +20 -0
  221. package/src/lib/design/system/compare-cache.js +92 -0
  222. package/src/lib/design/system/compare-cache.js.map +1 -0
  223. package/src/lib/design/system/compare-command.d.ts +82 -51
  224. package/src/lib/design/system/compare-command.js +362 -340
  225. package/src/lib/design/system/compare-command.js.map +1 -1
  226. package/src/lib/design/system/complete.d.ts +31 -1
  227. package/src/lib/design/system/complete.js +141 -27
  228. package/src/lib/design/system/complete.js.map +1 -1
  229. package/src/lib/design/system/decision-refs.d.ts +5 -0
  230. package/src/lib/design/system/decision-refs.js +21 -0
  231. package/src/lib/design/system/decision-refs.js.map +1 -0
  232. package/src/lib/design/system/design-hash.d.ts +22 -1
  233. package/src/lib/design/system/design-hash.js +63 -4
  234. package/src/lib/design/system/design-hash.js.map +1 -1
  235. package/src/lib/design/system/dom-command.d.ts +1 -1
  236. package/src/lib/design/system/dom-command.js +8 -5
  237. package/src/lib/design/system/dom-command.js.map +1 -1
  238. package/src/lib/design/system/drawn-open-points.d.ts +1 -1
  239. package/src/lib/design/system/dropped-props.d.ts +19 -5
  240. package/src/lib/design/system/dropped-props.js +133 -21
  241. package/src/lib/design/system/dropped-props.js.map +1 -1
  242. package/src/lib/design/system/grid-report.d.ts +5 -0
  243. package/src/lib/design/system/grid-report.js +78 -0
  244. package/src/lib/design/system/grid-report.js.map +1 -0
  245. package/src/lib/design/system/harness-build-cache.d.ts +17 -3
  246. package/src/lib/design/system/harness-build-cache.js +23 -10
  247. package/src/lib/design/system/harness-build-cache.js.map +1 -1
  248. package/src/lib/design/system/harness-inputs.d.ts +17 -0
  249. package/src/lib/design/system/harness-inputs.js +160 -0
  250. package/src/lib/design/system/harness-inputs.js.map +1 -0
  251. package/src/lib/design/system/harness-map.d.ts +1 -1
  252. package/src/lib/design/system/harness-server.d.ts +12 -1
  253. package/src/lib/design/system/harness-server.js +29 -19
  254. package/src/lib/design/system/harness-server.js.map +1 -1
  255. package/src/lib/design/system/harness-shot.d.ts +78 -0
  256. package/src/lib/design/system/harness-shot.js +349 -0
  257. package/src/lib/design/system/harness-shot.js.map +1 -0
  258. package/src/lib/design/system/harness-watch.d.ts +79 -0
  259. package/src/lib/design/system/harness-watch.js +334 -0
  260. package/src/lib/design/system/harness-watch.js.map +1 -0
  261. package/src/lib/design/system/implementation-baseline.d.ts +20 -0
  262. package/src/lib/design/system/implementation-baseline.js +44 -0
  263. package/src/lib/design/system/implementation-baseline.js.map +1 -0
  264. package/src/lib/design/system/leftover-gate-files.d.ts +2 -0
  265. package/src/lib/design/system/leftover-gate-files.js +15 -0
  266. package/src/lib/design/system/leftover-gate-files.js.map +1 -0
  267. package/src/lib/design/system/lib-build-lock.d.ts +18 -0
  268. package/src/lib/design/system/lib-build-lock.js +111 -0
  269. package/src/lib/design/system/lib-build-lock.js.map +1 -0
  270. package/src/lib/design/system/link-free.d.ts +12 -0
  271. package/src/lib/design/system/link-free.js +125 -0
  272. package/src/lib/design/system/link-free.js.map +1 -0
  273. package/src/lib/design/system/list-system.d.ts +4 -8
  274. package/src/lib/design/system/list-system.js +8 -78
  275. package/src/lib/design/system/list-system.js.map +1 -1
  276. package/src/lib/design/system/live-actions.d.ts +1 -1
  277. package/src/lib/design/system/live-actions.js +17 -8
  278. package/src/lib/design/system/live-actions.js.map +1 -1
  279. package/src/lib/design/system/live-compare.js +1 -1
  280. package/src/lib/design/system/live-compare.js.map +1 -1
  281. package/src/lib/design/system/live-uncovered.d.ts +7 -2
  282. package/src/lib/design/system/live-uncovered.js +44 -9
  283. package/src/lib/design/system/live-uncovered.js.map +1 -1
  284. package/src/lib/design/system/no-verdict.d.ts +13 -0
  285. package/src/lib/design/system/no-verdict.js +17 -0
  286. package/src/lib/design/system/no-verdict.js.map +1 -0
  287. package/src/lib/design/system/off-centre.d.ts +11 -0
  288. package/src/lib/design/system/off-centre.js +74 -0
  289. package/src/lib/design/system/off-centre.js.map +1 -0
  290. package/src/lib/design/system/open-points-cache.d.ts +11 -0
  291. package/src/lib/design/system/open-points-cache.js +27 -0
  292. package/src/lib/design/system/open-points-cache.js.map +1 -0
  293. package/src/lib/design/system/open-points-runner.d.ts +43 -0
  294. package/src/lib/design/system/open-points-runner.js +119 -0
  295. package/src/lib/design/system/open-points-runner.js.map +1 -0
  296. package/src/lib/design/system/open-points-worker.d.ts +1 -0
  297. package/src/lib/design/system/open-points-worker.js +28 -0
  298. package/src/lib/design/system/open-points-worker.js.map +1 -0
  299. package/src/lib/design/system/open-points.js +1 -1
  300. package/src/lib/design/system/open-points.js.map +1 -1
  301. package/src/lib/design/system/part-build-ready.d.ts +13 -7
  302. package/src/lib/design/system/part-build-ready.js +43 -15
  303. package/src/lib/design/system/part-build-ready.js.map +1 -1
  304. package/src/lib/design/system/part-compare.d.ts +18 -2
  305. package/src/lib/design/system/part-compare.js +147 -42
  306. package/src/lib/design/system/part-compare.js.map +1 -1
  307. package/src/lib/design/system/part-picture-cache.d.ts +23 -0
  308. package/src/lib/design/system/part-picture-cache.js +68 -0
  309. package/src/lib/design/system/part-picture-cache.js.map +1 -0
  310. package/src/lib/design/system/part-ready.d.ts +33 -7
  311. package/src/lib/design/system/part-ready.js +55 -17
  312. package/src/lib/design/system/part-ready.js.map +1 -1
  313. package/src/lib/design/system/part-task.d.ts +20 -0
  314. package/src/lib/design/system/part-task.js +53 -7
  315. package/src/lib/design/system/part-task.js.map +1 -1
  316. package/src/lib/design/system/pixel-cache.d.ts +16 -0
  317. package/src/lib/design/system/pixel-cache.js +79 -0
  318. package/src/lib/design/system/pixel-cache.js.map +1 -0
  319. package/src/lib/design/system/pointer-focus.d.ts +10 -2
  320. package/src/lib/design/system/pointer-focus.js +32 -9
  321. package/src/lib/design/system/pointer-focus.js.map +1 -1
  322. package/src/lib/design/system/prettier.js +4 -3
  323. package/src/lib/design/system/prettier.js.map +1 -1
  324. package/src/lib/design/system/problem.d.ts +6 -0
  325. package/src/lib/design/system/product.js +2 -2
  326. package/src/lib/design/system/product.js.map +1 -1
  327. package/src/lib/design/system/ready-command.d.ts +1 -1
  328. package/src/lib/design/system/ready-command.js +24 -4
  329. package/src/lib/design/system/ready-command.js.map +1 -1
  330. package/src/lib/design/system/record-settled.d.ts +24 -0
  331. package/src/lib/design/system/record-settled.js +50 -0
  332. package/src/lib/design/system/record-settled.js.map +1 -0
  333. package/src/lib/design/system/render-check.d.ts +18 -1
  334. package/src/lib/design/system/render-check.js +164 -104
  335. package/src/lib/design/system/render-check.js.map +1 -1
  336. package/src/lib/design/system/render-issue-key.d.ts +9 -0
  337. package/src/lib/design/system/render-issue-key.js +27 -0
  338. package/src/lib/design/system/render-issue-key.js.map +1 -0
  339. package/src/lib/design/system/resolve-product.d.ts +4 -1
  340. package/src/lib/design/system/resolve-product.js +14 -3
  341. package/src/lib/design/system/resolve-product.js.map +1 -1
  342. package/src/lib/design/system/rule-baseline.d.ts +53 -0
  343. package/src/lib/design/system/rule-baseline.js +124 -0
  344. package/src/lib/design/system/rule-baseline.js.map +1 -0
  345. package/src/lib/design/system/rule-skips.d.ts +20 -0
  346. package/src/lib/design/system/rule-skips.js +36 -0
  347. package/src/lib/design/system/rule-skips.js.map +1 -0
  348. package/src/lib/design/system/rules/canonical-class.d.ts +4 -0
  349. package/src/lib/design/system/rules/canonical-class.js +66 -13
  350. package/src/lib/design/system/rules/canonical-class.js.map +1 -1
  351. package/src/lib/design/system/rules/capability-place.d.ts +4 -2
  352. package/src/lib/design/system/rules/capability-place.js +15 -2
  353. package/src/lib/design/system/rules/capability-place.js.map +1 -1
  354. package/src/lib/design/system/rules/command-text.d.ts +7 -0
  355. package/src/lib/design/system/rules/command-text.js +72 -0
  356. package/src/lib/design/system/rules/command-text.js.map +1 -0
  357. package/src/lib/design/system/rules/design-coverage.d.ts +30 -0
  358. package/src/lib/design/system/rules/design-coverage.js +205 -0
  359. package/src/lib/design/system/rules/design-coverage.js.map +1 -0
  360. package/src/lib/design/system/rules/glued-interpolation.js +17 -1
  361. package/src/lib/design/system/rules/glued-interpolation.js.map +1 -1
  362. package/src/lib/design/system/rules/implements-unrendered.d.ts +13 -0
  363. package/src/lib/design/system/rules/implements-unrendered.js +63 -0
  364. package/src/lib/design/system/rules/implements-unrendered.js.map +1 -0
  365. package/src/lib/design/system/rules/motion.js +6 -0
  366. package/src/lib/design/system/rules/motion.js.map +1 -1
  367. package/src/lib/design/system/rules/native-title.js +13 -3
  368. package/src/lib/design/system/rules/native-title.js.map +1 -1
  369. package/src/lib/design/system/rules/option-values.d.ts +1 -1
  370. package/src/lib/design/system/rules/pending-state.d.ts +39 -0
  371. package/src/lib/design/system/rules/pending-state.js +289 -0
  372. package/src/lib/design/system/rules/pending-state.js.map +1 -0
  373. package/src/lib/design/system/rules/sdk-attribute-value.d.ts +10 -0
  374. package/src/lib/design/system/rules/sdk-attribute-value.js +78 -0
  375. package/src/lib/design/system/rules/sdk-attribute-value.js.map +1 -0
  376. package/src/lib/design/system/rules/sdk-private-var.d.ts +9 -0
  377. package/src/lib/design/system/rules/sdk-private-var.js +54 -0
  378. package/src/lib/design/system/rules/sdk-private-var.js.map +1 -0
  379. package/src/lib/design/system/rules/skips.d.ts +4 -0
  380. package/src/lib/design/system/rules/skips.js +27 -0
  381. package/src/lib/design/system/rules/skips.js.map +1 -0
  382. package/src/lib/design/system/rules/stale-replace.js +1 -0
  383. package/src/lib/design/system/rules/stale-replace.js.map +1 -1
  384. package/src/lib/design/system/rules/tailwind-classes.d.ts +1 -0
  385. package/src/lib/design/system/rules/tailwind-classes.js +11 -6
  386. package/src/lib/design/system/rules/tailwind-classes.js.map +1 -1
  387. package/src/lib/design/system/rules/token-selectors.js +10 -3
  388. package/src/lib/design/system/rules/token-selectors.js.map +1 -1
  389. package/src/lib/design/system/rules/unbound-input-known.d.ts +2 -0
  390. package/src/lib/design/system/rules/unbound-input-known.js +3 -6
  391. package/src/lib/design/system/rules/unbound-input-known.js.map +1 -1
  392. package/src/lib/design/system/rules/unbound-input.d.ts +2 -0
  393. package/src/lib/design/system/rules/unbound-input.js +12 -6
  394. package/src/lib/design/system/rules/unbound-input.js.map +1 -1
  395. package/src/lib/design/system/rules/undefined-class.js +11 -2
  396. package/src/lib/design/system/rules/undefined-class.js.map +1 -1
  397. package/src/lib/design/system/rules/utility-css.js +13 -1
  398. package/src/lib/design/system/rules/utility-css.js.map +1 -1
  399. package/src/lib/design/system/rules/visible-change.d.ts +1 -2
  400. package/src/lib/design/system/rules/visible-change.js +3 -3
  401. package/src/lib/design/system/rules/visible-change.js.map +1 -1
  402. package/src/lib/design/system/sdk-declarations.d.ts +10 -0
  403. package/src/lib/design/system/sdk-declarations.js +177 -0
  404. package/src/lib/design/system/sdk-declarations.js.map +1 -0
  405. package/src/lib/design/system/sdk-selectors.d.ts +18 -0
  406. package/src/lib/design/system/sdk-selectors.js +131 -0
  407. package/src/lib/design/system/sdk-selectors.js.map +1 -0
  408. package/src/lib/design/system/served-cache.d.ts +99 -0
  409. package/src/lib/design/system/served-cache.js +202 -0
  410. package/src/lib/design/system/served-cache.js.map +1 -0
  411. package/src/lib/design/system/settled-panes.d.ts +8 -3
  412. package/src/lib/design/system/settled-panes.js +10 -9
  413. package/src/lib/design/system/settled-panes.js.map +1 -1
  414. package/src/lib/design/system/sketch/baseline.d.ts +17 -1
  415. package/src/lib/design/system/sketch/baseline.js +48 -7
  416. package/src/lib/design/system/sketch/baseline.js.map +1 -1
  417. package/src/lib/design/system/sketch/check-format.js +3 -9
  418. package/src/lib/design/system/sketch/check-format.js.map +1 -1
  419. package/src/lib/design/system/sketch/clean-copy.d.ts +18 -0
  420. package/src/lib/design/system/sketch/clean-copy.js +104 -0
  421. package/src/lib/design/system/sketch/clean-copy.js.map +1 -0
  422. package/src/lib/design/system/sketch/cli-args.d.ts +1 -1
  423. package/src/lib/design/system/sketch/cli-args.js +2 -2
  424. package/src/lib/design/system/sketch/cli-args.js.map +1 -1
  425. package/src/lib/design/system/sketch/covered-diffs.d.ts +40 -0
  426. package/src/lib/design/system/sketch/covered-diffs.js +106 -0
  427. package/src/lib/design/system/sketch/covered-diffs.js.map +1 -0
  428. package/src/lib/design/system/sketch/edit-sketch.d.ts +14 -6
  429. package/src/lib/design/system/sketch/edit-sketch.js +87 -35
  430. package/src/lib/design/system/sketch/edit-sketch.js.map +1 -1
  431. package/src/lib/design/system/sketch/identical-renders.js +20 -14
  432. package/src/lib/design/system/sketch/identical-renders.js.map +1 -1
  433. package/src/lib/design/system/sketch/merge-commit.d.ts +20 -0
  434. package/src/lib/design/system/sketch/merge-commit.js +72 -0
  435. package/src/lib/design/system/sketch/merge-commit.js.map +1 -0
  436. package/src/lib/design/system/sketch/merge-runner.d.ts +20 -0
  437. package/src/lib/design/system/sketch/merge-runner.js +73 -0
  438. package/src/lib/design/system/sketch/merge-runner.js.map +1 -0
  439. package/src/lib/design/system/sketch/merge-step.d.ts +14 -2
  440. package/src/lib/design/system/sketch/merge-step.js +24 -12
  441. package/src/lib/design/system/sketch/merge-step.js.map +1 -1
  442. package/src/lib/design/system/sketch/merge-worker.d.ts +1 -0
  443. package/src/lib/design/system/sketch/merge-worker.js +14 -0
  444. package/src/lib/design/system/sketch/merge-worker.js.map +1 -0
  445. package/src/lib/design/system/sketch/merge.d.ts +10 -3
  446. package/src/lib/design/system/sketch/merge.js +180 -90
  447. package/src/lib/design/system/sketch/merge.js.map +1 -1
  448. package/src/lib/design/system/sketch/merged-parts.d.ts +0 -29
  449. package/src/lib/design/system/sketch/merged-parts.js +8 -56
  450. package/src/lib/design/system/sketch/merged-parts.js.map +1 -1
  451. package/src/lib/design/system/sketch/note-language.d.ts +7 -0
  452. package/src/lib/design/system/sketch/note-language.js +83 -0
  453. package/src/lib/design/system/sketch/note-language.js.map +1 -0
  454. package/src/lib/design/system/sketch/part-definition.d.ts +6 -0
  455. package/src/lib/design/system/sketch/part-definition.js +31 -1
  456. package/src/lib/design/system/sketch/part-definition.js.map +1 -1
  457. package/src/lib/design/system/sketch/rebase-port.js +47 -2
  458. package/src/lib/design/system/sketch/rebase-port.js.map +1 -1
  459. package/src/lib/design/system/sketch/sketch-check-cache.d.ts +11 -0
  460. package/src/lib/design/system/sketch/sketch-check-cache.js +22 -0
  461. package/src/lib/design/system/sketch/sketch-check-cache.js.map +1 -0
  462. package/src/lib/design/system/sketch/sketch-check-worker.js +6 -1
  463. package/src/lib/design/system/sketch/sketch-check-worker.js.map +1 -1
  464. package/src/lib/design/system/sketch/sketch-checker.d.ts +14 -1
  465. package/src/lib/design/system/sketch/sketch-checker.js +16 -6
  466. package/src/lib/design/system/sketch/sketch-checker.js.map +1 -1
  467. package/src/lib/design/system/sketch/sketch.d.ts +37 -6
  468. package/src/lib/design/system/sketch/sketch.js +101 -13
  469. package/src/lib/design/system/sketch/sketch.js.map +1 -1
  470. package/src/lib/design/system/sketch/stale-base.js +1 -1
  471. package/src/lib/design/system/sketch/stale-base.js.map +1 -1
  472. package/src/lib/design/system/sketch/unchanged-states.d.ts +7 -3
  473. package/src/lib/design/system/sketch/unchanged-states.js +25 -12
  474. package/src/lib/design/system/sketch/unchanged-states.js.map +1 -1
  475. package/src/lib/design/system/sketch/viewed-shots.d.ts +10 -2
  476. package/src/lib/design/system/sketch/viewed-shots.js +15 -22
  477. package/src/lib/design/system/sketch/viewed-shots.js.map +1 -1
  478. package/src/lib/design/system/skip-classes.d.ts +3 -0
  479. package/src/lib/design/system/skip-classes.js +17 -0
  480. package/src/lib/design/system/skip-classes.js.map +1 -0
  481. package/src/lib/design/system/slot-hosts.d.ts +38 -0
  482. package/src/lib/design/system/slot-hosts.js +93 -0
  483. package/src/lib/design/system/slot-hosts.js.map +1 -0
  484. package/src/lib/design/system/slow-checks.d.ts +4 -0
  485. package/src/lib/design/system/slow-checks.js +77 -24
  486. package/src/lib/design/system/slow-checks.js.map +1 -1
  487. package/src/lib/design/system/slow-run.d.ts +15 -5
  488. package/src/lib/design/system/slow-run.js +143 -84
  489. package/src/lib/design/system/slow-run.js.map +1 -1
  490. package/src/lib/design/system/stale-dist.d.ts +37 -1
  491. package/src/lib/design/system/stale-dist.js +58 -8
  492. package/src/lib/design/system/stale-dist.js.map +1 -1
  493. package/src/lib/design/system/stale-parts.d.ts +15 -0
  494. package/src/lib/design/system/stale-parts.js +67 -5
  495. package/src/lib/design/system/stale-parts.js.map +1 -1
  496. package/src/lib/design/system/system-command.js +3 -3
  497. package/src/lib/design/system/system-command.js.map +1 -1
  498. package/src/lib/design/system/system-modules.d.ts +4 -4
  499. package/src/lib/design/system/system-tsconfig.d.ts +9 -2
  500. package/src/lib/design/system/system-tsconfig.js +73 -13
  501. package/src/lib/design/system/system-tsconfig.js.map +1 -1
  502. package/src/lib/design/system/task-command.d.ts +3 -2
  503. package/src/lib/design/system/task-command.js +111 -73
  504. package/src/lib/design/system/task-command.js.map +1 -1
  505. package/src/lib/design/system/touched-parts.d.ts +1 -1
  506. package/src/lib/design/system/touched-parts.js +4 -5
  507. package/src/lib/design/system/touched-parts.js.map +1 -1
  508. package/src/lib/design/system/tracked-reads.d.ts +27 -0
  509. package/src/lib/design/system/tracked-reads.js +100 -0
  510. package/src/lib/design/system/tracked-reads.js.map +1 -0
  511. package/src/lib/design/system/unchanged-rows.d.ts +17 -8
  512. package/src/lib/design/system/unchanged-rows.js +90 -12
  513. package/src/lib/design/system/unchanged-rows.js.map +1 -1
  514. package/src/lib/design/system/uncommitted-decisions.d.ts +0 -2
  515. package/src/lib/design/system/uncommitted-decisions.js +3 -6
  516. package/src/lib/design/system/uncommitted-decisions.js.map +1 -1
  517. package/src/lib/design/system/visible-change-command.d.ts +13 -1
  518. package/src/lib/design/system/visible-change-command.js +10 -8
  519. package/src/lib/design/system/visible-change-command.js.map +1 -1
  520. package/src/lib/design/system/visible-change-parts.d.ts +1 -1
  521. package/src/lib/design/system/write-origin.d.ts +12 -0
  522. package/src/lib/design/system/write-origin.js +18 -0
  523. package/src/lib/design/system/write-origin.js.map +1 -0
  524. package/src/lib/design/system-use.js +4 -4
  525. package/src/lib/design/system-use.js.map +1 -1
  526. package/src/lib/design/thumb.d.ts +19 -3
  527. package/src/lib/design/thumb.js +71 -9
  528. package/src/lib/design/thumb.js.map +1 -1
  529. package/src/lib/design/timings-command.d.ts +22 -0
  530. package/src/lib/design/timings-command.js +175 -0
  531. package/src/lib/design/timings-command.js.map +1 -0
  532. package/src/lib/design/timings.d.ts +117 -0
  533. package/src/lib/design/timings.js +296 -0
  534. package/src/lib/design/timings.js.map +1 -0
  535. package/src/lib/design/typecheck.js +2 -2
  536. package/src/lib/design/typecheck.js.map +1 -1
  537. package/src/lib/design/vite-cache.d.ts +11 -0
  538. package/src/lib/design/vite-cache.js +61 -0
  539. package/src/lib/design/vite-cache.js.map +1 -0
  540. package/src/lib/design/warm-draw.d.ts +33 -0
  541. package/src/lib/design/warm-draw.js +74 -0
  542. package/src/lib/design/warm-draw.js.map +1 -0
  543. package/src/lib/design/warm-pages.d.ts +10 -2
  544. package/src/lib/design/warm-pages.js +6 -2
  545. package/src/lib/design/warm-pages.js.map +1 -1
  546. package/src/lib/design/work-root.d.ts +2 -0
  547. package/src/lib/design/work-root.js +8 -0
  548. package/src/lib/design/work-root.js.map +1 -0
  549. package/src/lib/plain-output.d.ts +27 -0
  550. package/src/lib/plain-output.js +66 -0
  551. package/src/lib/plain-output.js.map +1 -0
  552. package/src/lib/release.js +11 -3
  553. package/src/lib/release.js.map +1 -1
  554. package/src/lib/update/commits.js +2 -2
  555. package/src/lib/update/commits.js.map +1 -1
  556. package/src/lib/update/packages.js +4 -2
  557. package/src/lib/update/packages.js.map +1 -1
  558. package/src/lib/update/scan.js +8 -2
  559. package/src/lib/update/scan.js.map +1 -1
  560. package/src/lib/design/paths.js +0 -138
  561. package/src/lib/design/paths.js.map +0 -1
  562. package/src/lib/design/system/accept-command.d.ts +0 -41
  563. package/src/lib/design/system/accept-command.js +0 -139
  564. package/src/lib/design/system/accept-command.js.map +0 -1
  565. package/src/lib/design/system/go-batch.d.ts +0 -24
  566. package/src/lib/design/system/go-batch.js +0 -110
  567. package/src/lib/design/system/go-batch.js.map +0 -1
  568. package/src/lib/design/system/go-command.d.ts +0 -4
  569. package/src/lib/design/system/go-command.js +0 -64
  570. package/src/lib/design/system/go-command.js.map +0 -1
  571. package/src/lib/design/system/go-guard.d.ts +0 -26
  572. package/src/lib/design/system/go-guard.js +0 -70
  573. package/src/lib/design/system/go-guard.js.map +0 -1
  574. package/src/lib/design/system/go-step.d.ts +0 -13
  575. package/src/lib/design/system/go-step.js +0 -84
  576. package/src/lib/design/system/go-step.js.map +0 -1
  577. package/src/lib/design/system/part-go.d.ts +0 -70
  578. package/src/lib/design/system/part-go.js +0 -94
  579. package/src/lib/design/system/part-go.js.map +0 -1
  580. package/src/lib/design/system/tom-confirm.d.ts +0 -40
  581. package/src/lib/design/system/tom-confirm.js +0 -55
  582. package/src/lib/design/system/tom-confirm.js.map +0 -1
@@ -8,68 +8,92 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
11
22
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.designCompare = exports.comparePart = exports.shootStates = exports.harnessShotOf = exports.drawnPaneCountOf = exports.compareWidthOf = exports.compareFrameOf = exports.COMPARE_USAGE = void 0;
23
+ exports.designCompare = exports.ACTIONS_NOT_CHECKED = exports.comparePart = exports.shootStates = exports.shootStatesWith = exports.cachedAppShotOf = exports.compareCachesOf = exports.appShotKeyOf = exports.compareWidthOf = exports.appShotsOf = exports.appShotProblemOf = exports.COMPARE_SHOTS_AT_ONCE = exports.COMPARE_USAGE = void 0;
24
+ const crypto_1 = require("crypto");
25
+ const no_verdict_1 = require("./no-verdict");
13
26
  const fs_1 = require("fs");
14
27
  const os_1 = require("os");
15
28
  const path_1 = require("path");
16
29
  const browser_1 = require("../browser");
30
+ const vite_cache_1 = require("../vite-cache");
17
31
  const serve_1 = require("../serve");
32
+ const phase_timing_1 = require("../phase-timing");
33
+ const code_hash_1 = require("../code-hash");
34
+ const timings_1 = require("../timings");
18
35
  const shot_1 = require("../shot");
19
36
  const thumb_1 = require("../thumb");
20
37
  const actions_command_1 = require("./actions-command");
38
+ const compare_cache_1 = require("./compare-cache");
21
39
  const harness_map_1 = require("./harness-map");
22
40
  const harness_samples_1 = require("./harness-samples");
23
41
  const live_compare_1 = require("./live-compare");
24
42
  const harness_server_1 = require("./harness-server");
43
+ const harness_shot_1 = require("./harness-shot");
25
44
  const part_compare_1 = require("./part-compare");
26
45
  const part_task_1 = require("./part-task");
46
+ const app_files_1 = require("./app-files");
47
+ const reachable_files_1 = require("./reachable-files");
27
48
  const resolve_product_1 = require("./resolve-product");
28
- const sdk_errors_1 = require("./sdk-errors");
29
- const settled_panes_1 = require("./settled-panes");
49
+ const in_order_at_once_1 = require("./in-order-at-once");
30
50
  const frozen_animations_1 = require("./frozen-animations");
31
51
  const cli_args_1 = require("./sketch/cli-args");
52
+ const covered_diffs_1 = require("./sketch/covered-diffs");
32
53
  const sketch_1 = require("./sketch/sketch");
54
+ const pixel_cache_1 = require("./pixel-cache");
33
55
  const system_modules_1 = require("./system-modules");
34
56
  const unchanged_rows_1 = require("./unchanged-rows");
35
- exports.COMPARE_USAGE = 'compare <layer>/<name> | --all --product <name> [--url <app dev server url>] [--state <name>] [--preset <name>] [--live [--sketch <variant>]]';
36
- const ROOM_PX = 1024;
57
+ exports.COMPARE_USAGE = 'compare <layer>/<name> | --all --product <name> | --affected --product <name> [--url <app dev server url>] [--state <name>] [--preset <name>] [--live [--sketch <variant>]]';
58
+ /** @internal How many states compare shoots at once, design and app pictures alike. */
59
+ exports.COMPARE_SHOTS_AT_ONCE = 8;
37
60
  const messageOf = (error) => (error instanceof Error ? error.message : String(error));
38
- class HarnessError extends Error {
39
- }
40
- class UndrivableError extends HarnessError {
41
- }
42
- class DroppedPropsError extends Error {
43
- }
44
- const MOUNTED_INPUTS_SCRIPT = `(() => {
45
- const mounted = document.querySelector(${JSON.stringify(part_compare_1.HARNESS_HOST_SELECTOR)})?.firstElementChild;
46
- const ng = window.ng;
47
-
48
- if (!mounted || !ng?.getComponent || !ng.getDirectiveMetadata) return null;
49
-
50
- const component = ng.getComponent(mounted);
51
- const inputs = component ? ng.getDirectiveMetadata(component)?.inputs : null;
52
-
53
- return inputs ? Object.keys(inputs) : null;
54
- })()`;
61
+ /** @internal The failed state a harness shot's error stands for; rethrows any error that fails the whole compare. */
62
+ const appShotProblemOf = (error) => {
63
+ if (error instanceof harness_shot_1.DroppedPropsError || error instanceof harness_shot_1.MissingPanesError || error instanceof harness_shot_1.LookMissError)
64
+ return { problem: error.message };
65
+ if (error instanceof harness_shot_1.UndrivableError)
66
+ return { problem: error.message, undrivable: true };
67
+ throw error;
68
+ };
69
+ exports.appShotProblemOf = appShotProblemOf;
55
70
  /**
56
- * How compare draws a part: a page at a product preset, the asked one or the first, with the harness host filling
57
- * its viewport; any other part fitted to its content.
71
+ * @internal Shoots the app picture of each state that has a design, at most `COMPARE_SHOTS_AT_ONCE` at once, and returns
72
+ * the shots in state order; a state whose pointer open is a string aborts with it before any shot.
58
73
  */
59
- const compareFrameOf = (options) => {
60
- var _a, _b;
61
- const { presets, part } = options;
62
- if (!part.startsWith('pages/'))
63
- return options.preset === null
64
- ? { preset: null, size: null, layout: null }
65
- : `--preset applies to a pages part only, ${part} is fitted to its content`;
66
- const preset = (_b = (_a = options.preset) !== null && _a !== void 0 ? _a : Object.keys(presets)[0]) !== null && _b !== void 0 ? _b : '';
67
- const size = Object.keys(presets).includes(preset) ? presets[preset] : undefined;
68
- return size
69
- ? { preset, size, layout: 'page' }
70
- : `the product has no preset "${preset}" - its presets: ${Object.keys(presets).join(', ')}`;
71
- };
72
- exports.compareFrameOf = compareFrameOf;
74
+ const appShotsOf = (options) => __awaiter(void 0, void 0, void 0, function* () {
75
+ const { designs, opens, slotOnly } = options;
76
+ const states = options.states.filter((state) => designs.get(state));
77
+ const aborting = states.map((state) => opens[state]).find((open) => typeof open === 'string');
78
+ if (typeof aborting === 'string')
79
+ return aborting;
80
+ return (0, in_order_at_once_1.inOrderAtOnce)({
81
+ items: states,
82
+ limit: exports.COMPARE_SHOTS_AT_ONCE,
83
+ run: (state) => __awaiter(void 0, void 0, void 0, function* () {
84
+ const design = designs.get(state);
85
+ const base = slotOnly.get(state);
86
+ if (base !== undefined)
87
+ return {
88
+ state,
89
+ problem: `draws like ${base} once compare empties its slots - it differs from ${base} only inside slot() regions, so compare cannot check it`,
90
+ };
91
+ const app = yield options.shoot({ state, design, open: opens[state] });
92
+ return 'app' in app ? Object.assign({ state, design: design.png }, app) : Object.assign({ state }, app);
93
+ }),
94
+ });
95
+ });
96
+ exports.appShotsOf = appShotsOf;
73
97
  /** The width a non-page part is compared at: the first of the `widths` its design declares, `null` to fit its content. */
74
98
  const compareWidthOf = (options) => {
75
99
  const first = Array.isArray(options.widths) ? options.widths[0] : undefined;
@@ -78,216 +102,103 @@ const compareWidthOf = (options) => {
78
102
  : null;
79
103
  };
80
104
  exports.compareWidthOf = compareWidthOf;
81
- const clickOpen = (options) => __awaiter(void 0, void 0, void 0, function* () {
82
- var _a, _b;
83
- const { page, host, url, control, timeout } = options;
84
- const scratch = yield page.context().newPage();
85
- let name;
86
- try {
87
- yield scratch.setContent(options.markup);
88
- const trigger = scratch.locator(`[data-et-control=${JSON.stringify(control)}]`).first();
89
- name =
90
- (yield trigger.count()) === 0
91
- ? null
92
- : {
93
- label: yield trigger.getAttribute('aria-label'),
94
- text: ((_a = (yield trigger.textContent())) !== null && _a !== void 0 ? _a : '').replace(/\s+/g, ' ').trim(),
95
- };
96
- }
97
- finally {
98
- yield scratch.close();
99
- }
100
- if (name === null)
101
- throw new HarnessError(`the design picture has no [data-et-control="${control}"] trigger to click open`);
102
- const triggerIn = (scope) => {
103
- const triggers = scope.locator('[aria-expanded]');
104
- return name.label === null
105
- ? triggers.filter({ hasText: name.text })
106
- : triggers.and(scope.locator(`[aria-label=${JSON.stringify(name.label)}]`));
107
- };
108
- const trigger = triggerIn(host)
109
- .or(triggerIn(page.locator(OVERLAY_ROOTS)))
110
- .first();
111
- const named = (_b = name.label) !== null && _b !== void 0 ? _b : name.text;
112
- yield trigger.waitFor({ state: 'visible', timeout }).catch(() => {
113
- throw new HarnessError(`the harness page ${url} has no [aria-expanded] trigger named "${named}" to click control ${control} open`);
114
- });
115
- yield trigger.click({ timeout });
116
- yield page.mouse.move(-1, -1);
117
- yield trigger
118
- .and(page.locator('[aria-expanded="true"]'))
119
- .waitFor({ timeout })
120
- .catch(() => {
121
- throw new HarnessError(`a click on "${named}" in ${url} did not open control ${control}`);
122
- });
123
- });
124
- const OVERLAY_ROOTS = '.et-overlay-runtime-root, .cdk-overlay-container';
105
+ const sha256Of = (text) => (0, crypto_1.createHash)('sha256').update(text).digest('hex');
125
106
  /**
126
- * The number of overlay panes a design picture draws: each `<et-overlay-container>`, `.et-overlay-runtime-pane`,
127
- * `<et-menu>` and `<et-select-panel>` mock, as the app renders each of them in a pane of its own.
107
+ * @internal The disk cache key of an app picture: `salt` (the app picture code and the browser version), the hash of the built app,
108
+ * and every option the shot is drawn with but the harness origin, whose port changes from run to run.
128
109
  */
129
- const drawnPaneCountOf = (markup) => [...markup.matchAll(/<([a-z][\w-]*)(\s[^>]*)?>/g)].filter(([, tag = '', attributes = '']) => ['et-overlay-container', 'et-menu', 'et-select-panel'].includes(tag) ||
130
- /\sclass="(?:[^"]*\s)?et-overlay-runtime-pane[\s"]/.test(attributes)).length;
131
- exports.drawnPaneCountOf = drawnPaneCountOf;
132
- const FORCED_POLL_MS = 50;
133
- const escapedForRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
134
- /**
135
- * The one visible app element named as the design's `forced` element: by `aria-label`, else by role or tag and whole
136
- * text. It looks in the harness host first and in the overlay roots only when the host has none.
137
- */
138
- const forcedTargetOf = (options) => __awaiter(void 0, void 0, void 0, function* () {
139
- const { page, host, forced, url, timeout } = options;
140
- const { interaction, label, role, text } = forced;
141
- if (label === null && text === '')
142
- throw new UndrivableError(`the design forces ${interaction} on a <${role}> without an aria-label or text - compare cannot find it in the app`);
143
- const named = label === null ? `the ${role} "${text}"` : `the aria-label "${label}"`;
144
- const matchesIn = (scope) => (label === null
145
- ? scope
146
- .locator(`[role=${JSON.stringify(role)}]${/^[a-z][\w-]*$/i.test(role) ? `, ${role}:not([role])` : ''}`)
147
- .filter({
148
- hasText: new RegExp(`^\\s*${[...text.replace(/\s+/g, '')].map(escapedForRegExp).join('\\s*')}\\s*$`),
149
- })
150
- : scope.locator(`[aria-label=${JSON.stringify(label)}]`)).filter({ visible: true });
151
- const deadline = Date.now() + timeout;
152
- for (;;) {
153
- for (const scope of [host, page.locator(OVERLAY_ROOTS)]) {
154
- const matches = matchesIn(scope);
155
- const count = yield matches.count();
156
- if (count === 1)
157
- return matches;
158
- if (count > 1)
159
- throw new UndrivableError(`the harness page ${url} has ${count} elements with ${named} to force ${interaction} on`);
160
- }
161
- if (Date.now() > deadline)
162
- throw new UndrivableError(`the harness page ${url} has no element with ${named} to force ${interaction} on`);
163
- yield page.waitForTimeout(FORCED_POLL_MS);
164
- }
110
+ const appShotKeyOf = (options) => {
111
+ var _a;
112
+ const _b = options.shot, { url, opened, props } = _b, rest = __rest(_b, ["url", "opened", "props"]);
113
+ const { pathname, search } = new URL(url);
114
+ return (0, compare_cache_1.cacheKeyOf)([
115
+ options.salt,
116
+ options.app,
117
+ `${pathname}${search}`,
118
+ opened ? { control: opened.control, markup: sha256Of(opened.markup) } : null,
119
+ props ? { sent: (_a = props.sent) !== null && _a !== void 0 ? _a : null, designOnly: [...props.designOnly].sort() } : null,
120
+ rest,
121
+ ]);
122
+ };
123
+ exports.appShotKeyOf = appShotKeyOf;
124
+ /** @internal The disk caches of one compare: design pictures by the files they are drawn from, app pictures by `appShotKeyOf`. */
125
+ const compareCachesOf = (options) => {
126
+ const { target, server, appRoot } = options;
127
+ const salt = `${(0, code_hash_1.appPictureCodeOf)()} ${options.browser}`;
128
+ return {
129
+ design: server.shotStore((0, vite_cache_1.viteCacheOf)(target, compare_cache_1.COMPARE_DESIGN_SHOTS), options.browser),
130
+ app: appRoot
131
+ ? {
132
+ salt,
133
+ built: (0, phase_timing_1.timedPhase)('compare-app-hash', () => (0, compare_cache_1.builtAppHashOf)(appRoot)),
134
+ cache: (0, compare_cache_1.createAppShotCache)((0, vite_cache_1.viteCacheOf)(target, compare_cache_1.COMPARE_APP_SHOTS)),
135
+ }
136
+ : null,
137
+ };
138
+ };
139
+ exports.compareCachesOf = compareCachesOf;
140
+ /** @internal The app picture of `shot` from `cache`, or drawn by `draw` and kept there; without a cache always drawn. */
141
+ const cachedAppShotOf = (options) => __awaiter(void 0, void 0, void 0, function* () {
142
+ const { cache } = options;
143
+ const key = cache ? (0, exports.appShotKeyOf)({ salt: cache.salt, app: cache.built, shot: options.shot }) : null;
144
+ const kept = key && cache ? cache.cache.read(key) : null;
145
+ (0, timings_1.recordCache)(!!kept);
146
+ if (kept)
147
+ return kept;
148
+ const drawn = yield options.draw();
149
+ if (key)
150
+ cache === null || cache === void 0 ? void 0 : cache.cache.write(key, drawn);
151
+ return drawn;
165
152
  });
166
- /**
167
- * A PNG of the harness host element at `url`, in the viewport of `size` at device scale 1, or without `size` fitted
168
- * as a design frame fits its root, with its overflowing positioned descendants and rounded to whole pixels, with the
169
- * pointer off the page, after a pointer click on the app trigger of the design `markup`'s `[data-et-control]` named
170
- * `opened`, and with each `forced` element hovered, pressed or keyboard-focused as the design picture forces it.
171
- * With `roomAbove`, for a design picture drawn above its part root, the fitted host gets room above and before it, so
172
- * an overlay that opens above neither flips below nor shifts off the viewport edge, and the shot grows up as well.
173
- * Without `size`, a `width` sets the viewport and the host to that width, as a design frame draws a part with `widths`.
174
- */
175
- const harnessShotOf = (options) => __awaiter(void 0, void 0, void 0, function* () {
176
- var _a, _b, _c, _d, _e, _f, _g;
177
- const { browser, url } = options;
178
- const timeout = (_a = options.timeout) !== null && _a !== void 0 ? _a : thumb_1.DRAW_TIMEOUT_MS;
179
- const room = !options.size && !!options.roomAbove;
180
- const width = options.size ? null : ((_b = options.width) !== null && _b !== void 0 ? _b : null);
181
- const viewport = Object.assign(Object.assign({}, (0, shot_1.viewportOf)((_c = options.size) !== null && _c !== void 0 ? _c : null)), (width ? { width } : {}));
182
- const context = yield browser.newContext({
183
- viewport: room ? { width: viewport.width + ROOM_PX, height: viewport.height + ROOM_PX } : viewport,
184
- deviceScaleFactor: 1,
185
- });
153
+ exports.cachedAppShotOf = cachedAppShotOf;
154
+ /** A listening design server and a draw queue that outlive one compare; the owner closes them. */
155
+ const ownDraw = (target, config) => __awaiter(void 0, void 0, void 0, function* () {
156
+ const server = yield (0, serve_1.createDesignServer)({ target, config, listen: true, port: 0 });
186
157
  try {
187
- const page = yield context.newPage();
188
- const sdkErrors = (0, sdk_errors_1.watchSdkErrors)(page);
189
- yield page.goto(url, { timeout }).catch((error) => {
190
- var _a;
191
- throw new HarnessError(`the harness page ${url} did not load: ${(_a = messageOf(error).split('\n')[0]) !== null && _a !== void 0 ? _a : ''}`);
192
- });
193
- const host = page.locator(part_compare_1.HARNESS_HOST_SELECTOR).first();
194
- yield host.waitFor({ state: 'visible', timeout }).catch(() => {
195
- throw new HarnessError(`the harness page ${url} showed no ${part_compare_1.HARNESS_HOST_SELECTOR} element within ${timeout} ms - does the app serve the design harness route?`);
196
- });
197
- if (width)
198
- yield page.evaluate(`document.querySelector(${JSON.stringify(part_compare_1.HARNESS_HOST_SELECTOR)}).style.width = '${width}px'`);
199
- if (options.ambient)
200
- yield page.evaluate(`Object.assign(document.querySelector(${JSON.stringify(part_compare_1.HARNESS_HOST_SELECTOR)}).style, ${JSON.stringify(options.ambient)})`);
201
- yield (0, thumb_1.awaitFonts)(page);
202
- if (options.props) {
203
- const inputs = (yield page.evaluate(MOUNTED_INPUTS_SCRIPT));
204
- const dropped = inputs ? (0, part_compare_1.droppedPropsOf)(Object.assign({ props: options.props.sent, inputs }, options.props)) : [];
205
- if (dropped.length > 0)
206
- throw new DroppedPropsError(`the design prop${dropped.length > 1 ? 's' : ''} ${dropped.join(', ')} ${dropped.length > 1 ? 'have' : 'has'} no input on the app component - the harness drops ${dropped.length > 1 ? 'them' : 'it'}, so compare cannot check this state`);
207
- }
208
- if (room)
209
- yield page.evaluate(`document.documentElement.style.padding = '${ROOM_PX}px 0 0 ${ROOM_PX}px'`);
210
- yield page.mouse.move(-1, -1);
211
- if (options.opened)
212
- yield clickOpen(Object.assign({ page, host, url, timeout }, options.opened));
213
- for (const forced of (_d = options.forced) !== null && _d !== void 0 ? _d : []) {
214
- const { interaction } = forced;
215
- const element = yield forcedTargetOf({ page, host, forced, url, timeout });
216
- if (interaction === 'hover')
217
- yield element.hover({ timeout });
218
- else if (interaction === 'active') {
219
- yield element.hover({ timeout });
220
- yield page.mouse.down();
221
- }
222
- else if (interaction === 'focus-visible') {
223
- yield page.keyboard.press('Shift');
224
- yield element.focus({ timeout });
225
- }
226
- else
227
- throw new UndrivableError(`compare cannot force ${interaction} on "${(_e = forced.label) !== null && _e !== void 0 ? _e : forced.text}" in the app`);
228
- }
229
- if (!(yield (0, settled_panes_1.settledPanesOf)({ page, count: (_f = options.panes) !== null && _f !== void 0 ? _f : 0, timeout })))
230
- throw new HarnessError(`the harness page ${url} did not settle its overlay panes within ${timeout} ms`);
231
- if ((_g = options.frozen) === null || _g === void 0 ? void 0 : _g.length)
232
- yield page.evaluate((0, frozen_animations_1.freezeAnimationsScriptOf)(options.frozen));
233
- if (options.size && (yield page.locator(part_compare_1.OVERLAY_PANES).count()) === 0) {
234
- const hostBox = yield host.evaluate((element) => {
235
- const { x, y } = element.getBoundingClientRect();
236
- return { x: Math.round(x + scrollX), y: Math.round(y + scrollY) };
237
- });
238
- yield page.evaluate((0, shot_1.checkerScriptOf)(hostBox));
239
- const png = yield host.screenshot({ type: 'png', animations: 'disabled', timeout });
240
- const sdkProblem = sdkErrors(`the harness page ${url}`);
241
- if (sdkProblem)
242
- throw new HarnessError(sdkProblem);
243
- return png;
244
- }
245
- // Waits for a stable host as an element screenshot does; without it an overlay a click opened is not drawn yet.
246
- yield host.scrollIntoViewIfNeeded({ timeout });
247
- const box = (yield page.evaluate((0, part_compare_1.hostBoxScriptOf)({ up: room })));
248
- const clip = (0, shot_1.pixelBoxOf)(box);
249
- yield page.evaluate((0, shot_1.checkerScriptOf)(clip));
250
- const png = yield page.screenshot({
251
- type: 'png',
252
- fullPage: true,
253
- animations: 'disabled',
254
- clip,
255
- timeout,
256
- });
257
- const sdkProblem = sdkErrors(`the harness page ${url}`);
258
- if (sdkProblem)
259
- throw new HarnessError(sdkProblem);
260
- return png;
158
+ yield (0, phase_timing_1.timedPhase)('compare-design-server', () => server.listen());
261
159
  }
262
- finally {
263
- yield context.close();
160
+ catch (error) {
161
+ yield server.close();
162
+ throw error;
264
163
  }
164
+ return server;
265
165
  });
266
- exports.harnessShotOf = harnessShotOf;
267
- /** Draws each state of a part, or the `only` one, as its design frame and as the app's harness page, in one Chromium. */
268
- const shootStates = (_a) => __awaiter(void 0, [_a], void 0, function* ({ target, config, product, part, url, only, preset, appOnly }) {
269
- var _b, _c, _d, _e, _f, _g, _h, _j, _k;
270
- const frame = (0, exports.compareFrameOf)({ presets: product.presets, part, preset: preset !== null && preset !== void 0 ? preset : null });
166
+ /** `shootStates` drawing on `warm`, or on a design server and Chromium of its own when there is none. */
167
+ const shootStatesWith = (warm) => (_a) => __awaiter(void 0, [_a], void 0, function* ({ target, config, product, part, url, only, preset, appOnly, appRoot, onDesignShots }) {
168
+ var _b, _c, _d, _e, _f, _g;
169
+ const frame = (0, harness_shot_1.compareFrameOf)({ presets: product.presets, part, preset: preset !== null && preset !== void 0 ? preset : null });
271
170
  if (typeof frame === 'string')
272
171
  return frame;
273
- if (!(yield (0, browser_1.chromiumOf)(target)))
172
+ const browser = yield (0, browser_1.chromiumOf)(target);
173
+ if (!browser)
274
174
  return 'compare needs playwright or playwright-core in the checkout';
275
- const queue = (0, thumb_1.createDrawQueue)({ target });
276
- const server = yield (0, serve_1.createDesignServer)({ target, config, listen: true, port: 0 });
175
+ const queue = warm ? warm.queue() : (0, thumb_1.createDrawQueue)({ target });
176
+ let server;
277
177
  let shooter;
278
178
  try {
279
- yield server.listen();
179
+ server = warm
180
+ ? yield (0, phase_timing_1.timedPhase)('compare-design-server', () => warm.server(config))
181
+ : yield ownDraw(target, config);
280
182
  const { port } = (_b = server.httpServer) === null || _b === void 0 ? void 0 : _b.address();
281
183
  const system = (0, system_modules_1.createSystemModules)({ target, config });
282
- shooter = (0, shot_1.createPartShooter)({ target, base: `http://localhost:${port}`, system, queue });
283
- const file = (_d = (_c = product.parts.find((candidate) => (0, resolve_product_1.partKeyOf)(candidate) === part)) === null || _c === void 0 ? void 0 : _c.file) !== null && _d !== void 0 ? _d : '';
184
+ const caches = (0, exports.compareCachesOf)({
185
+ target,
186
+ server,
187
+ browser: (0, compare_cache_1.browserVersionOf)(browser.from),
188
+ appRoot: appRoot !== null && appRoot !== void 0 ? appRoot : null,
189
+ });
190
+ shooter = (0, shot_1.createPartShooter)({ target, base: `http://localhost:${port}`, system, queue, store: caches.design });
191
+ const resolved = product.parts.find((candidate) => (0, resolve_product_1.partKeyOf)(candidate) === part);
192
+ const file = (_c = resolved === null || resolved === void 0 ? void 0 : resolved.file) !== null && _c !== void 0 ? _c : '';
284
193
  const module = (yield server.ssrLoadModule((0, system_modules_1.productModuleIdOf)({ file, product: product.name })));
285
- const width = (0, exports.compareWidthOf)({ part, widths: (_e = module.default) === null || _e === void 0 ? void 0 : _e.widths });
286
- const loaded = (_f = module.default) === null || _f === void 0 ? void 0 : _f.states;
287
- const drawn = new Set(yield (0, unchanged_rows_1.drawnStateNamesOf)(module.default));
288
- const states = loaded && typeof loaded === 'object' && !Array.isArray(loaded)
289
- ? Object.fromEntries(Object.entries(loaded).filter(([state]) => drawn.has(state)))
290
- : {};
194
+ const width = (0, exports.compareWidthOf)({ part, widths: (_d = module.default) === null || _d === void 0 ? void 0 : _d.widths });
195
+ const loaded = (_e = module.default) === null || _e === void 0 ? void 0 : _e.states;
196
+ const drawn = new Set(yield (0, unchanged_rows_1.drawnStateNamesOf)(module.default, (_f = resolved === null || resolved === void 0 ? void 0 : resolved.cssSource) !== null && _f !== void 0 ? _f : null));
197
+ const declared = loaded && typeof loaded === 'object' && !Array.isArray(loaded) ? Object.entries(loaded) : [];
198
+ const states = Object.fromEntries(declared.filter(([state]) => drawn.has(state)));
199
+ const skipped = declared.flatMap(([state]) => (drawn.has(state) ? [] : [state]));
200
+ if (only !== null && skipped.includes(only))
201
+ return `${part} does not draw "${only}": it is an interaction state of a row of unchanged SDK controls`;
291
202
  if (only !== null && !(only in states))
292
203
  return `${part} has no state "${only}" - its states: ${Object.keys(states).join(', ')}`;
293
204
  const controls = (_g = module.default) === null || _g === void 0 ? void 0 : _g.controls;
@@ -306,52 +217,48 @@ const shootStates = (_a) => __awaiter(void 0, [_a], void 0, function* ({ target,
306
217
  checker: true,
307
218
  params: new URLSearchParams(),
308
219
  });
309
- const draw = (state) => __awaiter(void 0, void 0, void 0, function* () { var _a; return (_a = designs.get(state)) !== null && _a !== void 0 ? _a : designs.set(state, yield pictureOf(state, true)).get(state); });
310
- for (const state of Object.keys(states))
311
- yield draw(state);
312
- const slotted = [...designs.values()].some((design) => { var _a; return (_a = design === null || design === void 0 ? void 0 : design.markup) === null || _a === void 0 ? void 0 : _a.includes('data-et-projected'); });
313
- const slotOnly = slotted
314
- ? yield (0, part_compare_1.slotOnlyStatesOf)({
315
- states: Object.keys(states),
316
- emptied: new Map([...designs].flatMap(([state, design]) => (design ? [[state, design.png]] : []))),
317
- full: (state) => __awaiter(void 0, void 0, void 0, function* () { var _a, _b; return (_b = (_a = (yield pictureOf(state, false))) === null || _a === void 0 ? void 0 : _a.png) !== null && _b !== void 0 ? _b : null; }),
318
- })
319
- : new Map();
220
+ const slotOnly = yield (0, phase_timing_1.timedPhase)('compare-design-shots', () => __awaiter(void 0, void 0, void 0, function* () {
221
+ const drawn = yield (0, in_order_at_once_1.inOrderAtOnce)({
222
+ items: Object.keys(states),
223
+ limit: exports.COMPARE_SHOTS_AT_ONCE,
224
+ run: (state) => pictureOf(state, true),
225
+ });
226
+ drawn.forEach((design, at) => { var _a; return designs.set((_a = Object.keys(states)[at]) !== null && _a !== void 0 ? _a : '', design); });
227
+ const slotted = [...designs.values()].some((design) => { var _a; return (_a = design === null || design === void 0 ? void 0 : design.markup) === null || _a === void 0 ? void 0 : _a.includes('data-et-projected'); });
228
+ return slotted
229
+ ? yield (0, part_compare_1.slotOnlyStatesOf)({
230
+ states: Object.keys(states),
231
+ emptied: new Map([...designs].flatMap(([state, design]) => (design ? [[state, design.png]] : []))),
232
+ full: (state) => __awaiter(void 0, void 0, void 0, function* () { var _a, _b; return (_b = (_a = (yield pictureOf(state, false))) === null || _a === void 0 ? void 0 : _a.png) !== null && _b !== void 0 ? _b : null; }),
233
+ })
234
+ : new Map();
235
+ }));
236
+ onDesignShots === null || onDesignShots === void 0 ? void 0 : onDesignShots();
320
237
  const opens = (0, part_compare_1.pointerOpensOf)({
321
238
  states,
322
239
  controls,
323
240
  drawn: Object.fromEntries([...designs].map(([state, design]) => { var _a; return [state, (0, part_compare_1.drawnSurfacesOf)((_a = design.markup) !== null && _a !== void 0 ? _a : '')]; })),
324
241
  });
325
- const shots = [];
326
242
  const sampled = (0, harness_samples_1.productSampledPropsOf)({ target, product, part });
327
243
  const forcing = new Set([...designs].flatMap(([state, design]) => { var _a; return ((0, part_compare_1.forcedElementsOf)((_a = design === null || design === void 0 ? void 0 : design.markup) !== null && _a !== void 0 ? _a : '').length > 0 ? [state] : []); }));
328
- for (const state of only === null ? Object.keys(states) : [only]) {
329
- const design = designs.get(state);
330
- const open = opens[state];
331
- if (!design)
332
- continue;
333
- if (typeof open === 'string')
334
- return open;
335
- const base = slotOnly.get(state);
336
- if (base !== undefined && !appOnly) {
337
- shots.push({
338
- state,
339
- problem: `draws like ${base} once compare empties its slots - it differs from ${base} only inside slot() regions, so compare cannot check it`,
340
- });
341
- continue;
342
- }
343
- const sent = (_h = open === null || open === void 0 ? void 0 : open.props) !== null && _h !== void 0 ? _h : states[(_j = open === null || open === void 0 ? void 0 : open.from) !== null && _j !== void 0 ? _j : state];
344
- const forced = (0, part_compare_1.forcedElementsOf)((_k = design.markup) !== null && _k !== void 0 ? _k : '');
345
- const app = yield queue.run((browser) => {
346
- var _a, _b, _c, _d, _e, _f;
347
- return (0, exports.harnessShotOf)(Object.assign(Object.assign(Object.assign(Object.assign({ browser, url: (0, part_compare_1.harnessUrlOf)({
244
+ const unshot = yield (0, phase_timing_1.timedPhase)('compare-app-shots', () => (0, exports.appShotsOf)({
245
+ states: only === null ? Object.keys(states) : [only],
246
+ designs,
247
+ opens,
248
+ slotOnly: appOnly ? new Map() : slotOnly,
249
+ shoot: ({ state, design, open }) => {
250
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
251
+ const sent = (_a = open === null || open === void 0 ? void 0 : open.props) !== null && _a !== void 0 ? _a : states[(_b = open === null || open === void 0 ? void 0 : open.from) !== null && _b !== void 0 ? _b : state];
252
+ const forced = (0, part_compare_1.forcedElementsOf)((_c = design.markup) !== null && _c !== void 0 ? _c : '');
253
+ const looks = (0, part_compare_1.frameLooksOf)((_d = design.markup) !== null && _d !== void 0 ? _d : '');
254
+ const shot = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ url: (0, part_compare_1.harnessUrlOf)({
348
255
  url,
349
256
  part,
350
257
  state,
351
258
  props: sent,
352
259
  layout: frame.layout,
353
260
  }), size: frame.size, width,
354
- forced }, (appOnly
261
+ forced }, ((0, part_compare_1.forcesInFramesOf)((_e = design.markup) !== null && _e !== void 0 ? _e : '') ? { forcesInFrames: true } : {})), (looks.length > 0 ? { looks } : {})), (appOnly
355
262
  ? {}
356
263
  : {
357
264
  props: {
@@ -363,85 +270,147 @@ const shootStates = (_a) => __awaiter(void 0, [_a], void 0, function* ({ target,
363
270
  state,
364
271
  forced: forced.map(({ interaction }) => interaction),
365
272
  forcing,
366
- selected: (0, part_compare_1.drawsSelectedOf)((_a = design.markup) !== null && _a !== void 0 ? _a : ''),
273
+ selected: (0, part_compare_1.drawsSelectedOf)((_f = design.markup) !== null && _f !== void 0 ? _f : ''),
367
274
  }),
368
275
  ...sampled,
369
276
  ]),
370
277
  },
371
- })), { roomAbove: ((_c = (_b = design.marks.find((mark) => mark.parts.includes(part))) === null || _b === void 0 ? void 0 : _b.y) !== null && _c !== void 0 ? _c : 0) > 0, panes: (0, exports.drawnPaneCountOf)((_d = design.markup) !== null && _d !== void 0 ? _d : ''), frozen: (0, frozen_animations_1.frozenAnimationsOf)((_e = design.markup) !== null && _e !== void 0 ? _e : '') }), (design.ambient ? { ambient: design.ambient } : {})), (open ? { opened: { control: open.control, markup: (_f = design.markup) !== null && _f !== void 0 ? _f : '' } } : {}))).catch((error) => {
372
- if (error instanceof DroppedPropsError)
373
- return { problem: error.message };
374
- if (error instanceof UndrivableError)
375
- return { problem: error.message, undrivable: true };
376
- throw error;
377
- });
378
- });
379
- shots.push(Buffer.isBuffer(app) ? { state, design: design.png, app } : Object.assign({ state }, app));
380
- }
381
- return { states, shots };
278
+ })), { roomAbove: ((_h = (_g = design.marks.find((mark) => mark.parts.includes(part))) === null || _g === void 0 ? void 0 : _g.y) !== null && _h !== void 0 ? _h : 0) > 0, panes: (0, harness_shot_1.drawnPaneCountOf)((_j = design.markup) !== null && _j !== void 0 ? _j : ''), frozen: (0, frozen_animations_1.frozenAnimationsOf)((_k = design.markup) !== null && _k !== void 0 ? _k : '') }), (design.ambient ? { ambient: design.ambient } : {})), (open ? { opened: { control: open.control, markup: (_l = design.markup) !== null && _l !== void 0 ? _l : '' } } : {}));
279
+ return (0, exports.cachedAppShotOf)({
280
+ cache: caches.app,
281
+ shot,
282
+ draw: () => (0, phase_timing_1.timedPhase)(`compare-app-shot ${state}`, () => queue.run((browser) => (0, harness_shot_1.harnessShotOf)(Object.assign(Object.assign({}, shot), { browser, phase: `compare-app-shot ${state}` })).then((app) => ({ app })))),
283
+ }).catch(exports.appShotProblemOf);
284
+ },
285
+ }));
286
+ if (typeof unshot === 'string')
287
+ return unshot;
288
+ return { states, shots: unshot, skipped };
382
289
  }
383
290
  catch (error) {
384
291
  return messageOf(error);
385
292
  }
386
293
  finally {
387
- yield (shooter === null || shooter === void 0 ? void 0 : shooter.close());
388
- yield queue.close();
389
- yield server.close();
294
+ if (!warm)
295
+ yield (0, phase_timing_1.timedPhase)('compare-close', () => __awaiter(void 0, void 0, void 0, function* () {
296
+ yield (shooter === null || shooter === void 0 ? void 0 : shooter.close());
297
+ yield queue.close();
298
+ yield (server === null || server === void 0 ? void 0 : server.close());
299
+ }));
390
300
  }
391
301
  });
392
- exports.shootStates = shootStates;
302
+ exports.shootStatesWith = shootStatesWith;
303
+ /** Draws each state of a part, or the `only` one, as its design frame and as the app's harness page, in one Chromium. */
304
+ exports.shootStates = (0, exports.shootStatesWith)();
393
305
  const fileNameOf = (state) => state.replace(/[^\w.-]/g, '-');
394
306
  /** Compares the design and app pictures of each state at 0 px, prints a line per state, and keeps the pictures of each failing one in a temp folder. */
395
307
  const comparePart = (options) => __awaiter(void 0, void 0, void 0, function* () {
396
- var _a;
397
- const shot = yield ((_a = options.shoot) !== null && _a !== void 0 ? _a : exports.shootStates)(options);
308
+ var _a, _b;
309
+ const shot = yield (0, phase_timing_1.timedPhase)('compare-states', () => { var _a; return ((_a = options.shoot) !== null && _a !== void 0 ? _a : exports.shootStates)(options); });
398
310
  if (typeof shot === 'string')
399
311
  return shot;
400
312
  if (shot.shots.length === 0)
401
313
  return `${options.part} has no states to compare`;
402
- let dir = null;
403
- let failed = false;
404
- for (const stateShot of shot.shots) {
405
- const { state } = stateShot;
406
- if ('problem' in stateShot) {
407
- console.log(`${state} FAILED ${stateShot.problem}`);
408
- failed = true;
409
- continue;
410
- }
411
- const { design, app } = stateShot;
412
- let result;
413
- try {
414
- result = (0, part_compare_1.comparePngs)({ design, app });
415
- }
416
- catch (error) {
417
- return `the pictures of ${state} cannot be compared: ${messageOf(error)}`;
314
+ const { states, shots } = shot;
315
+ const skippedLine = (0, unchanged_rows_1.skippedStatesLineOf)((_a = shot.skipped) !== null && _a !== void 0 ? _a : []);
316
+ if (skippedLine !== null)
317
+ console.log(skippedLine);
318
+ const sketches = (_b = options.sketches) !== null && _b !== void 0 ? _b : (0, sketch_1.listSketches)({ productDir: options.product.dir, product: options.product.name }).filter((sketch) => typeof sketch !== 'string');
319
+ return (0, phase_timing_1.timedPhase)('compare-pixels', () => {
320
+ let dir = null;
321
+ const cache = { dir: (0, vite_cache_1.viteCacheOf)(options.target, pixel_cache_1.COMPARE_PIXELS), salt: (0, code_hash_1.pixelCompareCodeOf)() };
322
+ let failed = false;
323
+ for (const stateShot of shots) {
324
+ const { state } = stateShot;
325
+ if ('problem' in stateShot) {
326
+ console.log(`${state} FAILED ${stateShot.problem}`);
327
+ failed = true;
328
+ continue;
329
+ }
330
+ const { design, app } = stateShot;
331
+ let result;
332
+ try {
333
+ const compared = (0, pixel_cache_1.cachedComparePngs)(Object.assign(Object.assign({}, cache), { design, app }));
334
+ (0, timings_1.recordCache)(compared.hit);
335
+ result = compared.result;
336
+ }
337
+ catch (error) {
338
+ return `the pictures of ${state} cannot be compared: ${messageOf(error)}`;
339
+ }
340
+ const line = (0, part_compare_1.compareLineOf)(state, result);
341
+ if (result.kind === 'ok') {
342
+ console.log(line);
343
+ continue;
344
+ }
345
+ const covering = (0, covered_diffs_1.coveringSketchOf)({ sketches, part: options.part, state, result });
346
+ if (covering !== null) {
347
+ console.log((0, covered_diffs_1.coveredLineOf)(line, covering));
348
+ continue;
349
+ }
350
+ console.log(line);
351
+ dir !== null && dir !== void 0 ? dir : (dir = (0, fs_1.mkdtempSync)((0, path_1.join)((0, os_1.tmpdir)(), 'et-design-compare-')));
352
+ (0, fs_1.writeFileSync)((0, path_1.join)(dir, `${fileNameOf(state)}.design.png`), design);
353
+ (0, fs_1.writeFileSync)((0, path_1.join)(dir, `${fileNameOf(state)}.app.png`), app);
354
+ (0, fs_1.writeFileSync)((0, path_1.join)(dir, `${fileNameOf(state)}.diff.png`), result.diff);
418
355
  }
419
- console.log((0, part_compare_1.compareLineOf)(state, result));
420
- if (result.kind === 'ok')
421
- continue;
422
- dir !== null && dir !== void 0 ? dir : (dir = (0, fs_1.mkdtempSync)((0, path_1.join)((0, os_1.tmpdir)(), 'et-design-compare-')));
423
- (0, fs_1.writeFileSync)((0, path_1.join)(dir, `${fileNameOf(state)}.design.png`), design);
424
- (0, fs_1.writeFileSync)((0, path_1.join)(dir, `${fileNameOf(state)}.app.png`), app);
425
- (0, fs_1.writeFileSync)((0, path_1.join)(dir, `${fileNameOf(state)}.diff.png`), result.diff);
426
- }
427
- if (dir !== null)
428
- console.log(`pictures: ${dir}`);
429
- return { green: dir === null && !failed, states: shot.states };
356
+ if (dir !== null)
357
+ console.log(`pictures: ${dir}`);
358
+ return { green: dir === null && !failed, states };
359
+ });
430
360
  });
431
361
  exports.comparePart = comparePart;
362
+ /**
363
+ * Runs the action check of an affected part whose compare is green, on the same harness, and records the part as
364
+ * implemented again when every action works; a part whose design moved since its record needs `task --verify`.
365
+ */
366
+ const recordAffected = (options) => __awaiter(void 0, void 0, void 0, function* () {
367
+ var _a;
368
+ const { product, task } = options;
369
+ if (!(0, part_task_1.implementedHolds)((_a = (0, part_task_1.readImplemented)(task.dir)[task.part]) === null || _a === void 0 ? void 0 : _a.hash, task))
370
+ return { ok: false, line: `${task.part}: its design changed since it was implemented - run task --verify` };
371
+ const missed = yield (0, phase_timing_1.timedPhase)('compare-actions', () => options.actions({
372
+ target: options.target,
373
+ config: options.config,
374
+ product,
375
+ part: task.part,
376
+ url: options.url,
377
+ harness: options.harness,
378
+ appRoot: options.appRoot,
379
+ onNote: (line) => console.log(line),
380
+ }));
381
+ if (!Array.isArray(missed))
382
+ return { ok: false, line: `${task.part} not recorded - ${(0, no_verdict_1.noVerdictLineOf)('actions', missed)}` };
383
+ if (missed.length > 0) {
384
+ missed.forEach((line) => console.error(line));
385
+ return { ok: false, line: `${task.part}: ${missed.length} action(s) missed, so nothing was recorded` };
386
+ }
387
+ const implemented = (0, part_task_1.markImplemented)({
388
+ product,
389
+ part: task.part,
390
+ states: options.states,
391
+ app: (0, app_files_1.appFilesOf)({ root: (0, reachable_files_1.repoRootOf)(product), component: task.component }),
392
+ });
393
+ return typeof implemented === 'string'
394
+ ? { ok: false, line: implemented }
395
+ : { ok: true, line: `recorded ${task.part} as compared (${implemented.at})` };
396
+ });
397
+ /** The summary line of a compare whose action check could not run: a skipped check never passes. */
398
+ exports.ACTIONS_NOT_CHECKED = 'FAILED actions: not checked, so no action counts as working';
432
399
  /**
433
400
  * `et design compare --all` compares every done part and fails on any deviation or part it cannot compare; a foundation has nothing to compare.
401
+ * `et design compare --affected` compares, on one harness, every implemented part whose app files changed since its
402
+ * record, runs its action check and records each part that passes both.
434
403
  * `et design compare <layer>/<name> …` compares each state of a part with the app's harness page of its component;
435
404
  * with `--live` each live state of a page with the app's real page on the fixed sample of `harness.live`.
436
405
  */
437
406
  const designCompare = (options) => __awaiter(void 0, void 0, void 0, function* () {
438
- var _a, _b;
439
407
  const { target, invocation } = options;
440
408
  const args = (0, cli_args_1.argsOf)(options.argv, {
441
409
  values: ['--product', '--url', '--state', '--preset', '--sketch'],
442
- switches: ['--all', '--live'],
410
+ switches: ['--all', '--affected', '--live'],
443
411
  });
444
- if (typeof args === 'string' || args.positional.length !== (args.flags.has('--all') ? 0 : 1)) {
412
+ const many = typeof args !== 'string' && (args.flags.has('--all') || args.flags.has('--affected'));
413
+ if (typeof args === 'string' || args.positional.length !== (many ? 0 : 1)) {
445
414
  if (typeof args === 'string')
446
415
  console.error(args);
447
416
  console.error(`usage: ${invocation} ${exports.COMPARE_USAGE}`);
@@ -449,7 +418,8 @@ const designCompare = (options) => __awaiter(void 0, void 0, void 0, function* (
449
418
  }
450
419
  const config = (0, cli_args_1.configOf)(target);
451
420
  const all = args.flags.has('--all');
452
- const parsed = all ? null : (0, sketch_1.parseTarget)(args.positional[0]);
421
+ const affected = args.flags.has('--affected');
422
+ const parsed = many ? null : (0, sketch_1.parseTarget)(args.positional[0]);
453
423
  if (typeof config === 'string' || typeof parsed === 'string') {
454
424
  console.error(typeof config === 'string' ? config : parsed);
455
425
  return 1;
@@ -464,17 +434,30 @@ const designCompare = (options) => __awaiter(void 0, void 0, void 0, function* (
464
434
  console.error('--sketch compares live states only: pass --live');
465
435
  return 2;
466
436
  }
467
- if (all && (live || args.values['--state'] !== undefined || args.values['--preset'] !== undefined)) {
468
- console.error('--all compares every state of every done part: pass no part, --state, --preset or --live');
437
+ if (all && affected) {
438
+ console.error('pass --all or --affected, not both');
439
+ return 2;
440
+ }
441
+ if (many && (live || args.values['--state'] !== undefined || args.values['--preset'] !== undefined)) {
442
+ console.error(`${all ? '--all' : '--affected'} compares every state of each part: pass no part, --state, --preset or --live`);
469
443
  return 2;
470
444
  }
445
+ const changedFiles = new Map(affected ? (0, part_task_1.affectedPartsOf)(product).map(({ part, files }) => [part, files]) : []);
471
446
  const keys = all
472
447
  ? (0, part_task_1.doneParts)({
473
448
  product,
474
449
  parts: product.parts.filter((part) => part.layer !== 'foundations').map(resolve_product_1.partKeyOf),
475
450
  })
476
- : [(0, resolve_product_1.partKeyOf)(parsed)];
477
- if (!all && (parsed === null || parsed === void 0 ? void 0 : parsed.layer) === 'foundations' && product.parts.some((part) => (0, resolve_product_1.partKeyOf)(part) === keys[0])) {
451
+ : affected
452
+ ? [...changedFiles.keys()]
453
+ : [(0, resolve_product_1.partKeyOf)(parsed)];
454
+ if (affected && keys.length === 0) {
455
+ console.log(`${product.name}: no implemented part changed since its compare`);
456
+ return 0;
457
+ }
458
+ if (affected)
459
+ console.log(`affected: ${keys.join(', ')}`);
460
+ if (!many && (parsed === null || parsed === void 0 ? void 0 : parsed.layer) === 'foundations' && product.parts.some((part) => (0, resolve_product_1.partKeyOf)(part) === keys[0])) {
478
461
  console.log(`${keys[0]}: foundation, nothing to compare`);
479
462
  return 0;
480
463
  }
@@ -493,7 +476,7 @@ const designCompare = (options) => __awaiter(void 0, void 0, void 0, function* (
493
476
  for (const task of tasks) {
494
477
  if (typeof task !== 'string')
495
478
  continue;
496
- console.error(all ? `${task} - cannot be compared` : task);
479
+ console.error(many ? `${task} - cannot be compared` : task);
497
480
  failed++;
498
481
  }
499
482
  if (pending.length === 0)
@@ -503,56 +486,95 @@ const designCompare = (options) => __awaiter(void 0, void 0, void 0, function* (
503
486
  product,
504
487
  url: args.values['--url'],
505
488
  start: options.start,
506
- run: (url) => __awaiter(void 0, void 0, void 0, function* () {
507
- var _a, _b, _c, _d;
489
+ run: (url, root) => __awaiter(void 0, void 0, void 0, function* () {
490
+ var _a, _b, _c, _d, _e, _f;
491
+ const notes = [];
492
+ let designsShot = () => undefined;
493
+ const designsDrawn = new Promise((resolve) => (designsShot = resolve));
494
+ const actions = many || live
495
+ ? null
496
+ : (0, phase_timing_1.timedPhase)('compare-actions', () => {
497
+ var _a, _b;
498
+ return ((_a = options.actions) !== null && _a !== void 0 ? _a : actions_command_1.partActionFailuresOf)({
499
+ target,
500
+ config,
501
+ product,
502
+ part: (_b = keys[0]) !== null && _b !== void 0 ? _b : '',
503
+ url: args.values['--url'],
504
+ harness: url,
505
+ appRoot: root,
506
+ designsDrawn,
507
+ onNote: (line) => notes.push(line),
508
+ });
509
+ }).then((missed) => ({ missed }), (error) => ({ error }));
508
510
  for (const task of pending) {
509
511
  if (all)
510
512
  console.log(`== ${task.part}`);
513
+ if (affected)
514
+ console.log(`== ${task.part} (changed: ${((_a = changedFiles.get(task.part)) !== null && _a !== void 0 ? _a : []).join(', ')})`);
511
515
  const result = yield (0, exports.comparePart)({
512
516
  target,
513
517
  config,
514
518
  product,
515
519
  part: task.part,
516
520
  url,
517
- only: (_a = args.values['--state']) !== null && _a !== void 0 ? _a : null,
518
- preset: (_b = args.values['--preset']) !== null && _b !== void 0 ? _b : null,
519
- sketch: (_c = args.values['--sketch']) !== null && _c !== void 0 ? _c : null,
520
- shoot: (_d = options.shoot) !== null && _d !== void 0 ? _d : (live ? live_compare_1.shootLiveStates : undefined),
521
+ only: (_b = args.values['--state']) !== null && _b !== void 0 ? _b : null,
522
+ preset: (_c = args.values['--preset']) !== null && _c !== void 0 ? _c : null,
523
+ sketch: (_d = args.values['--sketch']) !== null && _d !== void 0 ? _d : null,
524
+ appRoot: root,
525
+ shoot: (_e = options.shoot) !== null && _e !== void 0 ? _e : (live ? live_compare_1.shootLiveStates : undefined),
526
+ onDesignShots: designsShot,
521
527
  });
528
+ designsShot();
522
529
  if (typeof result === 'string') {
523
530
  console.error(result);
524
531
  failed++;
525
532
  }
526
533
  else if (!result.green)
527
534
  failed++;
535
+ else if (affected) {
536
+ const recorded = yield recordAffected({
537
+ target,
538
+ config,
539
+ product,
540
+ task,
541
+ states: result.states,
542
+ url: args.values['--url'],
543
+ harness: url,
544
+ appRoot: root,
545
+ actions: (_f = options.actions) !== null && _f !== void 0 ? _f : actions_command_1.partActionFailuresOf,
546
+ });
547
+ console[recorded.ok ? 'log' : 'error'](recorded.line);
548
+ if (!recorded.ok)
549
+ failed++;
550
+ }
528
551
  }
529
- return failed;
552
+ if (actions === null)
553
+ return { failed, missed: null };
554
+ const settled = yield actions;
555
+ notes.forEach((line) => console.log(line));
556
+ if ('error' in settled)
557
+ throw settled.error;
558
+ return { failed, missed: settled.missed };
530
559
  }),
531
560
  });
532
561
  if (typeof compared === 'string') {
533
562
  console.error(compared);
534
563
  return 1;
535
564
  }
536
- if (all || live)
537
- return compared === 0 ? 0 : 1;
538
- const missed = yield ((_a = options.actions) !== null && _a !== void 0 ? _a : actions_command_1.partActionFailuresOf)({
539
- target,
540
- config,
541
- product,
542
- part: (_b = keys[0]) !== null && _b !== void 0 ? _b : '',
543
- url: args.values['--url'],
544
- start: options.start,
545
- onNote: (line) => console.log(line),
546
- });
565
+ const { missed } = compared;
566
+ if (missed === null)
567
+ return compared.failed === 0 ? 0 : 1;
547
568
  if (!Array.isArray(missed)) {
548
- console.error(`actions not checked: ${missed.unavailable}`);
569
+ console.error((0, no_verdict_1.noVerdictLineOf)('actions', missed));
570
+ console.log(exports.ACTIONS_NOT_CHECKED);
549
571
  return 1;
550
572
  }
551
573
  missed.forEach((line) => console.error(line));
552
574
  console.log(missed.length === 0
553
575
  ? 'every declared action works'
554
576
  : `${missed.length} action${missed.length === 1 ? '' : 's'} missed`);
555
- return compared === 0 && missed.length === 0 ? 0 : 1;
577
+ return compared.failed === 0 && missed.length === 0 ? 0 : 1;
556
578
  });
557
579
  exports.designCompare = designCompare;
558
580
  //# sourceMappingURL=compare-command.js.map