@astryxdesign/cli 0.7.17-canary.gffd1fc0 → 0.7.17

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 (1160) hide show
  1. package/CHANGELOG.md +1877 -0
  2. package/README.md +90 -84
  3. package/api/build/_adapter.d.mts +51 -0
  4. package/api/build/_adapter.mjs +133 -7
  5. package/api/build/build.doc.mjs +3 -3
  6. package/api/build/build.mjs +23 -14
  7. package/api/build/build.type.d.mts +1 -1
  8. package/api/build/build.type.mjs +2 -2
  9. package/api/build/help/help.d.mts +15 -14
  10. package/api/build/help/help.mjs +65 -6
  11. package/api/build/kit/kit.mjs +1 -1
  12. package/api/build/kit/start.mjs +1 -1
  13. package/api/component/_adapter.d.mts +28 -4
  14. package/api/component/_adapter.mjs +79 -45
  15. package/api/component/component.d.mts +1 -1
  16. package/api/component/component.mjs +18 -7
  17. package/api/component/detail/showcase/showcase.mjs +19 -8
  18. package/api/discover/_adapter.d.mts +71 -8
  19. package/api/discover/_adapter.mjs +320 -69
  20. package/api/discover/_catalog-view.d.mts +22 -0
  21. package/api/discover/_catalog-view.mjs +30 -1
  22. package/api/discover/_icon-set-coverage.d.mts +22 -0
  23. package/api/discover/_icon-set-coverage.mjs +32 -0
  24. package/api/discover/detail/detail.d.mts +6 -3
  25. package/api/discover/detail/detail.mjs +14 -6
  26. package/api/discover/detail/doc/doc.mjs +1 -1
  27. package/api/discover/detail/item/item.d.mts +11 -1
  28. package/api/discover/detail/item/item.mjs +29 -8
  29. package/api/discover/discover.d.mts +36 -0
  30. package/api/discover/discover.doc.mjs +1 -1
  31. package/api/discover/discover.mjs +206 -29
  32. package/api/discover/discover.type.d.mts +33 -7
  33. package/api/discover/discover.type.mjs +21 -7
  34. package/api/discover/search/search.d.mts +22 -0
  35. package/api/discover/search/search.mjs +293 -70
  36. package/api/docs/_adapter.d.mts +92 -1
  37. package/api/docs/_adapter.mjs +264 -14
  38. package/api/docs/_entry-names.mjs +4 -3
  39. package/api/docs/docs.d.mts +4 -2
  40. package/api/docs/docs.doc.mjs +10 -0
  41. package/api/docs/docs.mjs +25 -5
  42. package/api/docs/docs.type.d.mts +48 -0
  43. package/api/docs/docs.type.mjs +26 -0
  44. package/api/docs/skills/skills.d.mts +51 -0
  45. package/api/docs/skills/skills.mjs +216 -0
  46. package/api/doctor/_adapter.d.mts +256 -10
  47. package/api/doctor/_adapter.mjs +1233 -51
  48. package/api/doctor/built-checks.d.mts +39 -3
  49. package/api/doctor/built-checks.mjs +203 -7
  50. package/api/doctor/doctor.d.mts +222 -10
  51. package/api/doctor/doctor.doc.mjs +4 -4
  52. package/api/doctor/doctor.mjs +1005 -43
  53. package/api/doctor/doctor.type.d.mts +6 -1
  54. package/api/doctor/doctor.type.mjs +3 -1
  55. package/api/doctor/theme-checks.d.mts +20 -1
  56. package/api/doctor/theme-checks.mjs +307 -7
  57. package/api/error.d.mts +12 -1
  58. package/api/error.mjs +18 -6
  59. package/api/icon/_adapter.d.mts +13 -2
  60. package/api/icon/_adapter.mjs +32 -16
  61. package/api/icon/_authoring.mjs +21 -7
  62. package/api/icon/_records.d.mts +3 -1
  63. package/api/icon/_records.mjs +30 -3
  64. package/api/icon/add/add.mjs +1 -1
  65. package/api/icon/definitions/definitions.mjs +19 -8
  66. package/api/icon/exportIconIndex.doc.mjs +1 -1
  67. package/api/icon/icon.doc.mjs +4 -4
  68. package/api/icon/icon.type.d.mts +80 -2
  69. package/api/icon/icon.type.mjs +40 -5
  70. package/api/icon/iconMap.doc.mjs +2 -2
  71. package/api/icon/list/list.mjs +7 -5
  72. package/api/icon/map/map.mjs +13 -4
  73. package/api/icon/rankIconIndex.doc.mjs +1 -1
  74. package/api/icon/search/icon-index.mjs +22 -9
  75. package/api/icon/search/search.d.mts +47 -3
  76. package/api/icon/search/search.mjs +306 -9
  77. package/api/init/_adapter.d.mts +97 -0
  78. package/api/init/_adapter.mjs +284 -15
  79. package/api/init/init.d.mts +3 -3
  80. package/api/init/init.doc.mjs +30 -6
  81. package/api/init/init.mjs +150 -11
  82. package/api/init/init.type.d.mts +102 -8
  83. package/api/init/init.type.mjs +44 -3
  84. package/api/init/remove/remove.d.mts +7 -4
  85. package/api/init/remove/remove.mjs +124 -26
  86. package/api/init/run/run.d.mts +48 -3
  87. package/api/init/run/run.mjs +444 -37
  88. package/api/integration/_adapter.d.mts +21 -4
  89. package/api/integration/_adapter.mjs +52 -6
  90. package/api/integration/integrationCheck.doc.mjs +1 -1
  91. package/api/integration/pack-check.d.mts +2 -1
  92. package/api/integration/pack-check.mjs +10 -18
  93. package/api/integration/validate-integration.d.mts +6 -3
  94. package/api/integration/validate-integration.mjs +86 -15
  95. package/api/integration/validate-integration.type.d.mts +12 -5
  96. package/api/integration/validate-integration.type.mjs +12 -5
  97. package/api/integration/validateIntegration.doc.mjs +4 -2
  98. package/api/render/_adapter.d.mts +6 -2
  99. package/api/render/_adapter.mjs +301 -51
  100. package/api/render/render.doc.d.mts +1 -1
  101. package/api/render/render.doc.mjs +20 -10
  102. package/api/render/render.mjs +16 -13
  103. package/api/render/render.type.d.mts +57 -10
  104. package/api/render/render.type.mjs +26 -13
  105. package/api/search/ORDERING.md +3 -3
  106. package/api/search/_adapter.d.mts +31 -0
  107. package/api/search/_adapter.mjs +107 -15
  108. package/api/search/_candidate-score.d.mts +12 -4
  109. package/api/search/_candidate-score.mjs +94 -16
  110. package/api/search/_cards.json +4 -1
  111. package/api/search/_entries.d.mts +8 -3
  112. package/api/search/_entries.mjs +109 -12
  113. package/api/search/_fit-order.d.mts +8 -4
  114. package/api/search/_fit-order.mjs +35 -7
  115. package/api/search/_gather-docs.mjs +85 -15
  116. package/api/search/_gather-templates.mjs +6 -0
  117. package/api/search/_icons.d.mts +50 -0
  118. package/api/search/_icons.mjs +85 -0
  119. package/api/search/_lexical.d.mts +14 -1
  120. package/api/search/_lexical.mjs +240 -12
  121. package/api/search/_main-searcher.mjs +13 -0
  122. package/api/search/_named-keywords.d.mts +6 -3
  123. package/api/search/_named-keywords.mjs +70 -19
  124. package/api/search/_order.d.mts +34 -1
  125. package/api/search/_order.mjs +156 -13
  126. package/api/search/_result.d.mts +30 -0
  127. package/api/search/_result.mjs +38 -0
  128. package/api/search/_score.d.mts +20 -6
  129. package/api/search/_score.mjs +96 -16
  130. package/api/search/_titles.d.mts +14 -0
  131. package/api/search/_titles.mjs +16 -3
  132. package/api/search/_words.d.mts +8 -0
  133. package/api/search/_words.mjs +26 -1
  134. package/api/search/search-index.mjs +23 -12
  135. package/api/search/search.d.mts +3 -1
  136. package/api/search/search.doc.mjs +5 -4
  137. package/api/search/search.mjs +69 -26
  138. package/api/search/search.type.d.mts +55 -1
  139. package/api/search/search.type.mjs +35 -1
  140. package/api/swizzle/_adapter.d.mts +1 -1
  141. package/api/swizzle/_adapter.mjs +1 -5
  142. package/api/swizzle/_moduleGraph.d.mts +0 -6
  143. package/api/swizzle/_moduleGraph.mjs +0 -12
  144. package/api/swizzle/copy/copy.mjs +1 -1
  145. package/api/template/_adapter.d.mts +46 -0
  146. package/api/template/_adapter.mjs +198 -2
  147. package/api/template/cdn/cdn.mjs +5 -3
  148. package/api/template/copy/copy.d.mts +12 -2
  149. package/api/template/copy/copy.mjs +95 -21
  150. package/api/template/show/show.d.mts +10 -3
  151. package/api/template/show/show.mjs +16 -4
  152. package/api/template/template.doc.mjs +3 -3
  153. package/api/template/template.mjs +55 -7
  154. package/api/template/template.type.d.mts +3 -0
  155. package/api/template/template.type.mjs +5 -2
  156. package/api/theme/_adapter.d.mts +28 -2
  157. package/api/theme/_adapter.mjs +675 -17
  158. package/api/theme/_app-provider.d.mts +42 -0
  159. package/api/theme/_app-provider.mjs +61 -27
  160. package/api/theme/_shared-source.d.mts +33 -0
  161. package/api/theme/_shared-source.mjs +348 -0
  162. package/api/theme/add/add.d.mts +3 -0
  163. package/api/theme/add/add.mjs +21 -4
  164. package/api/theme/build/build.d.mts +61 -30
  165. package/api/theme/build/build.mjs +552 -489
  166. package/api/theme/build/core-interception.d.mts +10 -0
  167. package/api/theme/build/core-interception.mjs +24 -0
  168. package/api/theme/build/family.mjs +4 -2
  169. package/api/theme/build/import-specifier.d.mts +14 -0
  170. package/api/theme/build/import-specifier.mjs +36 -0
  171. package/api/theme/build/input-fields.d.mts +9 -0
  172. package/api/theme/build/input-fields.mjs +155 -16
  173. package/api/theme/build/null-values.d.mts +22 -0
  174. package/api/theme/build/null-values.mjs +110 -21
  175. package/api/theme/build/radius-values.d.mts +18 -0
  176. package/api/theme/build/radius-values.mjs +76 -0
  177. package/api/theme/build/self-contained.mjs +32 -11
  178. package/api/theme/build/setting-effects.d.mts +254 -0
  179. package/api/theme/build/setting-effects.mjs +1065 -0
  180. package/api/theme/build/style-keys.d.mts +33 -0
  181. package/api/theme/build/style-keys.mjs +154 -0
  182. package/api/theme/build/theme-object.d.mts +47 -0
  183. package/api/theme/build/theme-object.mjs +144 -0
  184. package/api/theme/build/typography-values.mjs +7 -23
  185. package/api/theme/build/written-values.d.mts +18 -0
  186. package/api/theme/build/written-values.mjs +107 -31
  187. package/api/theme/eject/eject.mjs +6 -1
  188. package/api/theme/palette/generate/color.d.mts +41 -9
  189. package/api/theme/palette/generate/color.mjs +108 -39
  190. package/api/theme/palette/generate/generate.mjs +10 -0
  191. package/api/theme/palette/generate/generator.d.mts +45 -27
  192. package/api/theme/palette/generate/generator.mjs +347 -149
  193. package/api/theme/palette/generate/mapping.d.mts +456 -0
  194. package/api/theme/palette/generate/mapping.mjs +1903 -0
  195. package/api/theme/palette/generate/newer-recipe.d.mts +28 -0
  196. package/api/theme/palette/generate/newer-recipe.mjs +87 -0
  197. package/api/theme/palette/generate/types.d.mts +270 -0
  198. package/api/theme/palette/generate/types.mjs +123 -0
  199. package/api/theme/theme.d.mts +25 -4
  200. package/api/theme/theme.mjs +55 -5
  201. package/api/theme/theme.type.d.mts +71 -2
  202. package/api/theme/theme.type.mjs +37 -5
  203. package/api/theme/themeAdd.doc.mjs +3 -2
  204. package/api/theme/themeBuild.doc.mjs +4 -4
  205. package/api/theme/themeEject.doc.mjs +1 -1
  206. package/api/theme/themeRemove.doc.mjs +1 -1
  207. package/api/theme/themeTargets.doc.mjs +1 -1
  208. package/api/theme-edit/_catalog.d.mts +40 -0
  209. package/api/theme-edit/_catalog.mjs +101 -23
  210. package/api/theme-edit/_check.mjs +333 -79
  211. package/api/theme-edit/_color.d.mts +2 -60
  212. package/api/theme-edit/_color.mjs +33 -847
  213. package/api/theme-edit/_compiler.mjs +52 -0
  214. package/api/theme-edit/_context.d.mts +23 -3
  215. package/api/theme-edit/_context.mjs +173 -32
  216. package/api/theme-edit/_css.d.mts +4 -35
  217. package/api/theme-edit/_css.mjs +10 -91
  218. package/api/theme-edit/_edit.mjs +667 -87
  219. package/api/theme-edit/_how-question.d.mts +15 -0
  220. package/api/theme-edit/_how-question.mjs +2729 -179
  221. package/api/theme-edit/_how.mjs +62 -3
  222. package/api/theme-edit/_missed.d.mts +2 -1
  223. package/api/theme-edit/_missed.mjs +128 -29
  224. package/api/theme-edit/_normal.d.mts +22 -5
  225. package/api/theme-edit/_normal.mjs +95 -4
  226. package/api/theme-edit/_palette.d.mts +34 -74
  227. package/api/theme-edit/_palette.mjs +261 -1278
  228. package/api/theme-edit/_part-words.mjs +29 -6
  229. package/api/theme-edit/_parts.d.mts +16 -2
  230. package/api/theme-edit/_parts.mjs +161 -41
  231. package/api/theme-edit/_png.d.mts +24 -0
  232. package/api/theme-edit/_png.mjs +99 -0
  233. package/api/theme-edit/_preview-app.d.mts +16 -0
  234. package/api/theme-edit/_preview-app.mjs +52 -18
  235. package/api/theme-edit/_preview.d.mts +44 -26
  236. package/api/theme-edit/_preview.mjs +304 -89
  237. package/api/theme-edit/_project.d.mts +18 -2
  238. package/api/theme-edit/_project.mjs +27 -3
  239. package/api/theme-edit/_settings.d.mts +118 -1
  240. package/api/theme-edit/_settings.mjs +1336 -76
  241. package/api/theme-edit/_tables.d.mts +19 -11
  242. package/api/theme-edit/_tables.mjs +55 -37
  243. package/api/theme-edit/theme-edit.type.d.mts +20 -2
  244. package/api/theme-edit/theme-edit.type.mjs +9 -6
  245. package/api/upgrade/_adapter.d.mts +43 -4
  246. package/api/upgrade/_adapter.mjs +281 -8
  247. package/api/upgrade/run/run.mjs +4 -0
  248. package/api/upgrade/upgrade.mjs +1 -1
  249. package/api/upgrade/upgrade.type.d.mts +46 -7
  250. package/api/upgrade/upgrade.type.mjs +24 -9
  251. package/assets/codemods/registry.mjs +1 -0
  252. package/assets/codemods/transforms/next/index.mjs +1 -11
  253. package/assets/codemods/transforms/v0.7.17/index.mjs +28 -0
  254. package/assets/codemods/transforms/v0.7.17/migrate-item-swipe-actions-to-swipe.mjs +2160 -0
  255. package/assets/codemods/transforms/v0.7.17/preserve-chat-radius.mjs +515 -0
  256. package/assets/component-list.generated.json +1 -1
  257. package/assets/discover/official-packages.json +72 -0
  258. package/assets/docs/author-a-theme.doc.mjs +7 -4
  259. package/assets/docs/getting-started.doc.mjs +1 -1
  260. package/assets/docs/principles.doc.dense.mjs +1 -1
  261. package/assets/docs/principles.doc.mjs +1 -1
  262. package/assets/docs/principles.doc.zh.mjs +1 -1
  263. package/assets/docs/styling-overview.doc.mjs +5 -1
  264. package/assets/docs/tree/agent-guidance.doc.mjs +34 -3
  265. package/assets/docs/tree/check-the-props.doc.mjs +1 -1
  266. package/assets/docs/tree/checks.doc.mjs +2 -2
  267. package/assets/docs/tree/computer-integrations.doc.mjs +1 -1
  268. package/assets/docs/tree/doc-syntax.doc.mjs +1 -1
  269. package/assets/docs/tree/export-pages.doc.mjs +164 -0
  270. package/assets/docs/tree/fonts-and-assets.doc.mjs +1 -1
  271. package/assets/docs/tree/host-entry.doc.mjs +4 -0
  272. package/assets/docs/tree/i18n-library-integration.doc.mjs +7 -3
  273. package/assets/docs/tree/icon-definitions.doc.mjs +3 -3
  274. package/assets/docs/tree/icon-sets.doc.mjs +87 -11
  275. package/assets/docs/tree/layout.doc.mjs +16 -5
  276. package/assets/docs/tree/problems.doc.mjs +2 -2
  277. package/assets/docs/tree/responsive.doc.mjs +2 -2
  278. package/assets/docs/tree/scaffold.doc.mjs +1 -0
  279. package/assets/docs/tree/share-a-page.doc.mjs +14 -16
  280. package/assets/docs/tree/short-and-findable.doc.mjs +3 -3
  281. package/assets/docs/tree/skill-places.doc.mjs +91 -0
  282. package/assets/docs/tree/styling.doc.mjs +41 -3
  283. package/assets/docs/tree/template-grading-rubric.doc.mjs +1 -1
  284. package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
  285. package/assets/docs/tree/tokens-and-setup.doc.mjs +2 -4
  286. package/assets/docs/tree/tokens-color.doc.mjs +2 -2
  287. package/assets/docs/tree/tokens-radius.doc.mjs +1 -1
  288. package/assets/docs/tree/tokens.doc.mjs +32 -0
  289. package/assets/docs/tree/troubleshooting.doc.mjs +8 -0
  290. package/assets/docs/tree/typography.doc.mjs +31 -2
  291. package/assets/docs/tree/updates.doc.mjs +1 -1
  292. package/assets/docs/tree/versioning.doc.mjs +1 -1
  293. package/assets/docs/use-a-theme.doc.mjs +4 -0
  294. package/assets/docs/working-with-ai.doc.mjs +44 -9
  295. package/assets/docs-routes.generated.json +1 -1
  296. package/assets/docs.generated.json +2 -2
  297. package/assets/icons/definitions/alert.doc.mjs +9 -0
  298. package/assets/icons/definitions/alignBottom.doc.mjs +1 -0
  299. package/assets/icons/definitions/alignCenter.doc.mjs +1 -0
  300. package/assets/icons/definitions/alignEnd.doc.mjs +1 -0
  301. package/assets/icons/definitions/alignJustify.doc.mjs +1 -0
  302. package/assets/icons/definitions/alignMiddle.doc.mjs +1 -0
  303. package/assets/icons/definitions/alignStart.doc.mjs +1 -0
  304. package/assets/icons/definitions/alignTop.doc.mjs +1 -0
  305. package/assets/icons/definitions/arrowDown.doc.mjs +1 -0
  306. package/assets/icons/definitions/arrowLeft.doc.mjs +1 -0
  307. package/assets/icons/definitions/arrowRight.doc.mjs +1 -0
  308. package/assets/icons/definitions/arrowUp.doc.mjs +1 -0
  309. package/assets/icons/definitions/arrowsUpDown.doc.mjs +1 -0
  310. package/assets/icons/definitions/bank.doc.mjs +1 -0
  311. package/assets/icons/definitions/block.doc.mjs +9 -0
  312. package/assets/icons/definitions/bold.doc.mjs +1 -0
  313. package/assets/icons/definitions/bookmark.doc.mjs +1 -0
  314. package/assets/icons/definitions/bookmarkAdd.doc.mjs +1 -0
  315. package/assets/icons/definitions/cart.doc.mjs +1 -0
  316. package/assets/icons/definitions/channel.doc.mjs +9 -0
  317. package/assets/icons/definitions/check.doc.mjs +1 -0
  318. package/assets/icons/definitions/checkDouble.doc.mjs +1 -0
  319. package/assets/icons/definitions/checklist.doc.mjs +9 -0
  320. package/assets/icons/definitions/chevronDown.doc.mjs +1 -0
  321. package/assets/icons/definitions/chevronLeft.doc.mjs +1 -0
  322. package/assets/icons/definitions/chevronRight.doc.mjs +1 -0
  323. package/assets/icons/definitions/chevronUp.doc.mjs +1 -0
  324. package/assets/icons/definitions/chevronsLeft.doc.mjs +1 -0
  325. package/assets/icons/definitions/chevronsRight.doc.mjs +1 -0
  326. package/assets/icons/definitions/clipboard.doc.mjs +1 -0
  327. package/assets/icons/definitions/cloud.doc.mjs +1 -1
  328. package/assets/icons/definitions/collapse.doc.mjs +1 -0
  329. package/assets/icons/definitions/columnSettings.doc.mjs +9 -0
  330. package/assets/icons/definitions/compose.doc.mjs +1 -0
  331. package/assets/icons/definitions/conversation.doc.mjs +1 -0
  332. package/assets/icons/definitions/copy.doc.mjs +1 -0
  333. package/assets/icons/definitions/copyText.doc.mjs +9 -0
  334. package/assets/icons/definitions/cornerRadius.doc.mjs +1 -0
  335. package/assets/icons/definitions/create.doc.mjs +9 -0
  336. package/assets/icons/definitions/creditCard.doc.mjs +1 -0
  337. package/assets/icons/definitions/currency.doc.mjs +9 -0
  338. package/assets/icons/definitions/cut.doc.mjs +1 -0
  339. package/assets/icons/definitions/desktop.doc.mjs +1 -0
  340. package/assets/icons/definitions/discount.doc.mjs +1 -0
  341. package/assets/icons/definitions/document.doc.mjs +1 -0
  342. package/assets/icons/definitions/documentSearch.doc.mjs +1 -0
  343. package/assets/icons/definitions/download.doc.mjs +1 -0
  344. package/assets/icons/definitions/error.doc.mjs +1 -0
  345. package/assets/icons/definitions/exitFullScreen.doc.mjs +16 -0
  346. package/assets/icons/definitions/expand.doc.mjs +1 -0
  347. package/assets/icons/definitions/eye.doc.mjs +1 -0
  348. package/assets/icons/definitions/eyeSlash.doc.mjs +1 -0
  349. package/assets/icons/definitions/file.doc.mjs +1 -0
  350. package/assets/icons/definitions/flipHorizontal.doc.mjs +1 -0
  351. package/assets/icons/definitions/flipVertical.doc.mjs +1 -0
  352. package/assets/icons/definitions/folder.doc.mjs +1 -0
  353. package/assets/icons/definitions/folderAdd.doc.mjs +1 -0
  354. package/assets/icons/definitions/fullScreen.doc.mjs +16 -0
  355. package/assets/icons/definitions/globe.doc.mjs +1 -1
  356. package/assets/icons/definitions/groupRows.doc.mjs +9 -0
  357. package/assets/icons/definitions/halftone.doc.mjs +9 -0
  358. package/assets/icons/definitions/help.doc.mjs +9 -0
  359. package/assets/icons/definitions/house.doc.mjs +9 -0
  360. package/assets/icons/definitions/info.doc.mjs +1 -0
  361. package/assets/icons/definitions/italic.doc.mjs +1 -0
  362. package/assets/icons/definitions/listView.doc.mjs +9 -0
  363. package/assets/icons/definitions/lock.doc.mjs +1 -0
  364. package/assets/icons/definitions/lowercase.doc.mjs +1 -0
  365. package/assets/icons/definitions/mail.doc.mjs +1 -1
  366. package/assets/icons/definitions/media.doc.mjs +9 -0
  367. package/assets/icons/definitions/message.doc.mjs +2 -1
  368. package/assets/icons/definitions/mobile.doc.mjs +1 -0
  369. package/assets/icons/definitions/money.doc.mjs +1 -0
  370. package/assets/icons/definitions/moon.doc.mjs +1 -0
  371. package/assets/icons/definitions/moveToFolder.doc.mjs +9 -0
  372. package/assets/icons/definitions/notification.doc.mjs +1 -0
  373. package/assets/icons/definitions/notificationActive.doc.mjs +1 -0
  374. package/assets/icons/definitions/notificationOff.doc.mjs +1 -0
  375. package/assets/icons/definitions/paddingHorizontal.doc.mjs +1 -0
  376. package/assets/icons/definitions/paddingPerSide.doc.mjs +1 -0
  377. package/assets/icons/definitions/paddingVertical.doc.mjs +1 -0
  378. package/assets/icons/definitions/panelBottom.doc.mjs +1 -0
  379. package/assets/icons/definitions/panelLeft.doc.mjs +1 -0
  380. package/assets/icons/definitions/panelRight.doc.mjs +1 -0
  381. package/assets/icons/definitions/paste.doc.mjs +9 -0
  382. package/assets/icons/definitions/pause.doc.mjs +1 -0
  383. package/assets/icons/definitions/play.doc.mjs +1 -0
  384. package/assets/icons/definitions/radiusPerCorner.doc.mjs +1 -0
  385. package/assets/icons/definitions/redo.doc.mjs +1 -0
  386. package/assets/icons/definitions/review.doc.mjs +9 -0
  387. package/assets/icons/definitions/rotate.doc.mjs +1 -0
  388. package/assets/icons/definitions/rotateCounterclockwise.doc.mjs +1 -0
  389. package/assets/icons/definitions/scale.doc.mjs +1 -2
  390. package/assets/icons/definitions/schedule.doc.mjs +9 -0
  391. package/assets/icons/definitions/search.doc.mjs +1 -0
  392. package/assets/icons/definitions/send.doc.mjs +1 -0
  393. package/assets/icons/definitions/shoppingBag.doc.mjs +1 -0
  394. package/assets/icons/definitions/signal.doc.mjs +9 -0
  395. package/assets/icons/definitions/stop.doc.mjs +1 -0
  396. package/assets/icons/definitions/strikethrough.doc.mjs +1 -0
  397. package/assets/icons/definitions/success.doc.mjs +1 -0
  398. package/assets/icons/definitions/sun.doc.mjs +1 -0
  399. package/assets/icons/definitions/tablet.doc.mjs +1 -0
  400. package/assets/icons/definitions/team.doc.mjs +9 -0
  401. package/assets/icons/definitions/textCase.doc.mjs +2 -1
  402. package/assets/icons/definitions/textRegular.doc.mjs +1 -0
  403. package/assets/icons/definitions/thumbsDown.doc.mjs +1 -0
  404. package/assets/icons/definitions/thumbsUp.doc.mjs +1 -0
  405. package/assets/icons/definitions/transfer.doc.mjs +1 -0
  406. package/assets/icons/definitions/trendDown.doc.mjs +1 -0
  407. package/assets/icons/definitions/trendUp.doc.mjs +1 -0
  408. package/assets/icons/definitions/underline.doc.mjs +1 -0
  409. package/assets/icons/definitions/undo.doc.mjs +1 -0
  410. package/assets/icons/definitions/unlock.doc.mjs +1 -0
  411. package/assets/icons/definitions/upload.doc.mjs +1 -0
  412. package/assets/icons/definitions/uppercase.doc.mjs +1 -0
  413. package/assets/icons/definitions/user.doc.mjs +1 -0
  414. package/assets/icons/definitions/userAdd.doc.mjs +1 -0
  415. package/assets/icons/definitions/userCircle.doc.mjs +1 -0
  416. package/assets/icons/definitions/userRemove.doc.mjs +1 -0
  417. package/assets/icons/definitions/users.doc.mjs +1 -0
  418. package/assets/icons/definitions/verified.doc.mjs +9 -0
  419. package/assets/icons/definitions/wallet.doc.mjs +1 -0
  420. package/assets/icons/definitions/warning.doc.mjs +1 -0
  421. package/assets/icons/definitions/wrench.doc.mjs +1 -1
  422. package/assets/icons/installed-icon-set.doc.mjs +30 -0
  423. package/assets/icons/template-icons.json +661 -0
  424. package/assets/search-catalog.generated.json +2 -2
  425. package/assets/self-audit.generated.json +1 -1
  426. package/assets/templates/blocks/components/AppShell/AppShellShowcase.doc.mjs +0 -7
  427. package/assets/templates/blocks/components/AppShell/AppShellShowcase.tsx +8 -10
  428. package/assets/templates/blocks/components/AppShell/AppShellSideNavOnly.doc.mjs +0 -8
  429. package/assets/templates/blocks/components/AppShell/AppShellSideNavOnly.tsx +10 -8
  430. package/assets/templates/blocks/components/AppShell/AppShellTopNavOnly.doc.mjs +0 -1
  431. package/assets/templates/blocks/components/AppShell/AppShellTopNavOnly.tsx +4 -2
  432. package/assets/templates/blocks/components/AppShell/AppShellTopNavWithSideNav.doc.mjs +0 -8
  433. package/assets/templates/blocks/components/AppShell/AppShellTopNavWithSideNav.tsx +10 -8
  434. package/assets/templates/blocks/components/AppShell/AppShellWithBanner.doc.mjs +0 -8
  435. package/assets/templates/blocks/components/AppShell/AppShellWithBanner.tsx +10 -8
  436. package/assets/templates/blocks/components/AspectRatio/AspectRatioImageGallery.tsx +1 -1
  437. package/assets/templates/blocks/components/AspectRatio/AspectRatioWidescreen.tsx +1 -1
  438. package/assets/templates/blocks/components/AspectRatio/AspectRatioWithSkeleton.tsx +1 -1
  439. package/assets/templates/blocks/components/Avatar/AvatarInteractive.tsx +6 -1
  440. package/assets/templates/blocks/components/Avatar/AvatarShowcase.tsx +1 -1
  441. package/assets/templates/blocks/components/Avatar/AvatarTooltip.tsx +1 -1
  442. package/assets/templates/blocks/components/Avatar/AvatarWithStatus.tsx +1 -1
  443. package/assets/templates/blocks/components/AvatarStatusDot/AvatarStatusDotShowcase.tsx +1 -1
  444. package/assets/templates/blocks/components/AvatarStatusDot/AvatarStatusDotVariants.tsx +1 -1
  445. package/assets/templates/blocks/components/Badge/BadgeShowcase.tsx +2 -2
  446. package/assets/templates/blocks/components/Banner/BannerCollapsibleContent.tsx +14 -1
  447. package/assets/templates/blocks/components/Banner/BannerSectionVariant.tsx +10 -1
  448. package/assets/templates/blocks/components/Banner/BannerWithActionButton.tsx +25 -3
  449. package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.doc.mjs +0 -1
  450. package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.tsx +2 -2
  451. package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadMenu.doc.mjs +0 -1
  452. package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadMenu.tsx +1 -1
  453. package/assets/templates/blocks/components/BottomSheet/BottomSheetSnapPoints.doc.mjs +0 -8
  454. package/assets/templates/blocks/components/BottomSheet/BottomSheetSnapPoints.tsx +5 -5
  455. package/assets/templates/blocks/components/BreadcrumbItem/BreadcrumbItemShowcase.doc.mjs +0 -1
  456. package/assets/templates/blocks/components/BreadcrumbItem/BreadcrumbItemShowcase.tsx +1 -1
  457. package/assets/templates/blocks/components/Breadcrumbs/BreadcrumbsDeepHierarchy.doc.mjs +0 -1
  458. package/assets/templates/blocks/components/Breadcrumbs/BreadcrumbsDeepHierarchy.tsx +1 -1
  459. package/assets/templates/blocks/components/Breadcrumbs/BreadcrumbsWithIcons.doc.mjs +0 -1
  460. package/assets/templates/blocks/components/Breadcrumbs/BreadcrumbsWithIcons.tsx +2 -2
  461. package/assets/templates/blocks/components/Button/ButtonFloating.doc.mjs +0 -1
  462. package/assets/templates/blocks/components/Button/ButtonFloating.tsx +25 -2
  463. package/assets/templates/blocks/components/Button/ButtonShowcase.tsx +42 -4
  464. package/assets/templates/blocks/components/Button/ButtonSizeVariants.tsx +24 -2
  465. package/assets/templates/blocks/components/Button/ButtonVariants.tsx +28 -1
  466. package/assets/templates/blocks/components/Button/ButtonWithEndSlot.tsx +9 -0
  467. package/assets/templates/blocks/components/Button/ButtonWithIcon.doc.mjs +0 -6
  468. package/assets/templates/blocks/components/Button/ButtonWithIcon.tsx +35 -9
  469. package/assets/templates/blocks/components/ButtonGroup/ButtonGroupBasic.tsx +20 -3
  470. package/assets/templates/blocks/components/ButtonGroup/ButtonGroupFloating.tsx +16 -3
  471. package/assets/templates/blocks/components/ButtonGroup/ButtonGroupShowcase.doc.mjs +0 -6
  472. package/assets/templates/blocks/components/ButtonGroup/ButtonGroupShowcase.tsx +37 -8
  473. package/assets/templates/blocks/components/Center/CenterHorizontal.doc.mjs +0 -8
  474. package/assets/templates/blocks/components/Center/CenterHorizontal.tsx +23 -5
  475. package/assets/templates/blocks/components/Center/CenterInsideACard.doc.mjs +0 -1
  476. package/assets/templates/blocks/components/Center/CenterInsideACard.tsx +1 -1
  477. package/assets/templates/blocks/components/ChatComposer/ChatComposerFlat.doc.mjs +0 -5
  478. package/assets/templates/blocks/components/ChatComposer/ChatComposerFlat.tsx +8 -3
  479. package/assets/templates/blocks/components/ChatComposer/ChatComposerFooterActions.doc.mjs +0 -5
  480. package/assets/templates/blocks/components/ChatComposer/ChatComposerFooterActions.tsx +8 -3
  481. package/assets/templates/blocks/components/ChatComposer/ChatComposerFullFeatured.doc.mjs +0 -7
  482. package/assets/templates/blocks/components/ChatComposer/ChatComposerFullFeatured.tsx +10 -7
  483. package/assets/templates/blocks/components/ChatComposerDrawer/ChatComposerDrawerShowcase.doc.mjs +0 -1
  484. package/assets/templates/blocks/components/ChatComposerDrawer/ChatComposerDrawerShowcase.tsx +2 -2
  485. package/assets/templates/blocks/components/ChatComposerDrawer/ChatComposerDrawerWithProgress.doc.mjs +0 -1
  486. package/assets/templates/blocks/components/ChatComposerDrawer/ChatComposerDrawerWithProgress.tsx +3 -3
  487. package/assets/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataFooter.doc.mjs +0 -6
  488. package/assets/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataFooter.tsx +9 -9
  489. package/assets/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataShowcase.doc.mjs +0 -6
  490. package/assets/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataShowcase.tsx +10 -10
  491. package/assets/templates/blocks/components/ChatSendButton/ChatSendButtonCustomIcon.doc.mjs +0 -6
  492. package/assets/templates/blocks/components/ChatSendButton/ChatSendButtonCustomIcon.tsx +8 -5
  493. package/assets/templates/blocks/components/ChatSendButton/ChatSendButtonShowcase.doc.mjs +0 -1
  494. package/assets/templates/blocks/components/ChatSendButton/ChatSendButtonShowcase.tsx +1 -1
  495. package/assets/templates/blocks/components/ChatSystemMessage/ChatSystemMessageStatusUpdates.doc.mjs +0 -5
  496. package/assets/templates/blocks/components/ChatSystemMessage/ChatSystemMessageStatusUpdates.tsx +7 -7
  497. package/assets/templates/blocks/components/ChatSystemMessage/ChatSystemMessageWithIcon.doc.mjs +0 -6
  498. package/assets/templates/blocks/components/ChatSystemMessage/ChatSystemMessageWithIcon.tsx +7 -7
  499. package/assets/templates/blocks/components/CodeBlock/CodeBlockTerminal.tsx +1 -1
  500. package/assets/templates/blocks/components/ContextMenu/ContextMenuBottomSheet.doc.mjs +0 -6
  501. package/assets/templates/blocks/components/ContextMenu/ContextMenuBottomSheet.tsx +7 -7
  502. package/assets/templates/blocks/components/DropdownMenu/DropdownMenuBottomSheet.doc.mjs +0 -6
  503. package/assets/templates/blocks/components/DropdownMenu/DropdownMenuBottomSheet.tsx +7 -7
  504. package/assets/templates/blocks/components/DropdownMenu/DropdownMenuNoChevron.doc.mjs +0 -1
  505. package/assets/templates/blocks/components/DropdownMenu/DropdownMenuNoChevron.tsx +2 -2
  506. package/assets/templates/blocks/components/EmptyState/EmptyStateActions.doc.mjs +0 -1
  507. package/assets/templates/blocks/components/EmptyState/EmptyStateActions.tsx +2 -2
  508. package/assets/templates/blocks/components/EmptyState/EmptyStateCompact.doc.mjs +0 -1
  509. package/assets/templates/blocks/components/EmptyState/EmptyStateCompact.tsx +1 -1
  510. package/assets/templates/blocks/components/EmptyState/EmptyStateContainer.doc.mjs +0 -1
  511. package/assets/templates/blocks/components/EmptyState/EmptyStateContainer.tsx +2 -2
  512. package/assets/templates/blocks/components/EmptyState/EmptyStateShowcase.doc.mjs +0 -1
  513. package/assets/templates/blocks/components/EmptyState/EmptyStateShowcase.tsx +2 -2
  514. package/assets/templates/blocks/components/Grid/GridShowcase.tsx +1 -1
  515. package/assets/templates/blocks/components/GridSpan/GridSpanColumns.tsx +1 -1
  516. package/assets/templates/blocks/components/GridSpan/GridSpanShowcase.tsx +1 -1
  517. package/assets/templates/blocks/components/Heading/HeadingTruncation.tsx +3 -2
  518. package/assets/templates/blocks/components/Hooks/useClipboardHookUsage.tsx +1 -1
  519. package/assets/templates/blocks/components/Hooks/useContainerRevealHookUsage.doc.mjs +0 -1
  520. package/assets/templates/blocks/components/Hooks/useContainerRevealHookUsage.tsx +38 -19
  521. package/assets/templates/blocks/components/Hooks/useGridFocusHookUsage.tsx +6 -6
  522. package/assets/templates/blocks/components/Hooks/useHotkeysHookUsage.tsx +1 -1
  523. package/assets/templates/blocks/components/Hooks/useInputContainerHookUsage.doc.mjs +0 -1
  524. package/assets/templates/blocks/components/Hooks/useInputContainerHookUsage.tsx +2 -2
  525. package/assets/templates/blocks/components/Hooks/useKeyboardHintHookUsage.doc.mjs +0 -1
  526. package/assets/templates/blocks/components/Hooks/useKeyboardHintHookUsage.tsx +2 -2
  527. package/assets/templates/blocks/components/Hooks/useListFocusHookUsage.tsx +8 -1
  528. package/assets/templates/blocks/components/Hooks/useOverflowHookUsage.tsx +17 -6
  529. package/assets/templates/blocks/components/Hooks/useStreamingTextHookUsage.tsx +1 -1
  530. package/assets/templates/blocks/components/Hooks/useTreeFocusHookUsage.doc.mjs +0 -1
  531. package/assets/templates/blocks/components/Hooks/useTreeFocusHookUsage.tsx +1 -1
  532. package/assets/templates/blocks/components/HoverCard/HoverCardInteractiveContent.doc.mjs +0 -1
  533. package/assets/templates/blocks/components/HoverCard/HoverCardInteractiveContent.tsx +1 -1
  534. package/assets/templates/blocks/components/HoverCard/HoverCardProfileHoverCard.doc.mjs +0 -1
  535. package/assets/templates/blocks/components/HoverCard/HoverCardProfileHoverCard.tsx +1 -1
  536. package/assets/templates/blocks/components/Icon/useIconHookUsage.doc.mjs +0 -5
  537. package/assets/templates/blocks/components/Icon/useIconHookUsage.tsx +7 -7
  538. package/assets/templates/blocks/components/IconButton/IconButtonActionBar.tsx +11 -0
  539. package/assets/templates/blocks/components/IconButton/IconButtonFloating.doc.mjs +0 -1
  540. package/assets/templates/blocks/components/IconButton/IconButtonFloating.tsx +25 -2
  541. package/assets/templates/blocks/components/IconButton/IconButtonShowcase.tsx +3 -0
  542. package/assets/templates/blocks/components/IconButton/IconButtonTooltipIconButton.tsx +5 -0
  543. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.doc.mjs +3 -3
  544. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +36 -13
  545. package/assets/templates/blocks/components/Item/ItemDocumentTabs.doc.mjs +0 -1
  546. package/assets/templates/blocks/components/Item/ItemDocumentTabs.tsx +4 -4
  547. package/assets/templates/blocks/components/Item/ItemShowcase.doc.mjs +0 -1
  548. package/assets/templates/blocks/components/Item/ItemShowcase.tsx +7 -3
  549. package/assets/templates/blocks/components/Layout/LayoutBasicCardLayout.tsx +14 -2
  550. package/assets/templates/blocks/components/Layout/LayoutContentWidth.tsx +14 -2
  551. package/assets/templates/blocks/components/Layout/LayoutFullBleedContent.tsx +8 -1
  552. package/assets/templates/blocks/components/Layout/LayoutShowcase.tsx +8 -1
  553. package/assets/templates/blocks/components/Layout/LayoutSidebarLayout.tsx +14 -2
  554. package/assets/templates/blocks/components/LinkProvider/LinkProviderCustomLink.tsx +3 -1
  555. package/assets/templates/blocks/components/Markdown/MarkdownShowcase.tsx +1 -1
  556. package/assets/templates/blocks/components/MediaTheme/MediaThemeImageOverlay.tsx +18 -4
  557. package/assets/templates/blocks/components/MediaTheme/MediaThemeLightScrim.tsx +11 -3
  558. package/assets/templates/blocks/components/MediaTheme/MediaThemeShowcase.tsx +27 -5
  559. package/assets/templates/blocks/components/MobileNav/MobileNavBasicMobileNav.doc.mjs +0 -7
  560. package/assets/templates/blocks/components/MobileNav/MobileNavBasicMobileNav.tsx +5 -9
  561. package/assets/templates/blocks/components/MobileNav/MobileNavEndSideMobileNav.doc.mjs +0 -1
  562. package/assets/templates/blocks/components/MobileNav/MobileNavEndSideMobileNav.tsx +2 -2
  563. package/assets/templates/blocks/components/MobileNav/MobileNavWithoutTitleMobileNav.doc.mjs +0 -1
  564. package/assets/templates/blocks/components/MobileNav/MobileNavWithoutTitleMobileNav.tsx +1 -1
  565. package/assets/templates/blocks/components/MoreMenu/MoreMenuBottomSheet.doc.mjs +0 -6
  566. package/assets/templates/blocks/components/MoreMenu/MoreMenuBottomSheet.tsx +15 -15
  567. package/assets/templates/blocks/components/MoreMenu/MoreMenuWithDividers.doc.mjs +0 -5
  568. package/assets/templates/blocks/components/MoreMenu/MoreMenuWithDividers.tsx +4 -8
  569. package/assets/templates/blocks/components/MoreMenu/MoreMenuWithSections.doc.mjs +0 -5
  570. package/assets/templates/blocks/components/MoreMenu/MoreMenuWithSections.tsx +4 -8
  571. package/assets/templates/blocks/components/MultiSelector/useMultiComboboxHookUsage.doc.mjs +0 -1
  572. package/assets/templates/blocks/components/MultiSelector/useMultiComboboxHookUsage.tsx +1 -1
  573. package/assets/templates/blocks/components/OverflowList/OverflowListCappedToolbar.tsx +38 -2
  574. package/assets/templates/blocks/components/OverflowList/OverflowListCollapseFromStartList.tsx +17 -5
  575. package/assets/templates/blocks/components/OverflowList/OverflowListOverflowDropdownActions.tsx +46 -7
  576. package/assets/templates/blocks/components/OverflowList/OverflowListShowcase.tsx +45 -5
  577. package/assets/templates/blocks/components/Overlay/OverlayHoverReveal.tsx +14 -1
  578. package/assets/templates/blocks/components/Overlay/OverlayShowcase.tsx +10 -1
  579. package/assets/templates/blocks/components/Overlay/useOverlayHookUsage.tsx +12 -1
  580. package/assets/templates/blocks/components/Pagination/PaginationDotsCarousel.doc.mjs +0 -1
  581. package/assets/templates/blocks/components/Pagination/PaginationDotsCarousel.tsx +1 -1
  582. package/assets/templates/blocks/components/Popover/PopoverBottomSheetAlternative.doc.mjs +0 -1
  583. package/assets/templates/blocks/components/Popover/PopoverBottomSheetAlternative.tsx +1 -1
  584. package/assets/templates/blocks/components/Resizable/ResizableShowcase.tsx +12 -2
  585. package/assets/templates/blocks/components/Resizable/ResizableSidebar.tsx +1 -1
  586. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.tsx +1 -1
  587. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.tsx +1 -1
  588. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.tsx +1 -1
  589. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.tsx +1 -1
  590. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.tsx +1 -1
  591. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.tsx +1 -1
  592. package/assets/templates/blocks/components/Section/SectionWashHighlight.doc.mjs +0 -1
  593. package/assets/templates/blocks/components/Section/SectionWashHighlight.tsx +10 -2
  594. package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.doc.mjs +0 -1
  595. package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.tsx +3 -3
  596. package/assets/templates/blocks/components/SelectorOption/SelectorOptionShowcase.doc.mjs +0 -1
  597. package/assets/templates/blocks/components/SelectorOption/SelectorOptionShowcase.tsx +1 -1
  598. package/assets/templates/blocks/components/Stack/StackAlignment.tsx +50 -6
  599. package/assets/templates/blocks/components/Stack/StackDirections.tsx +1 -1
  600. package/assets/templates/blocks/components/Stack/StackFillItem.tsx +10 -1
  601. package/assets/templates/blocks/components/Step/StepContent.tsx +13 -4
  602. package/assets/templates/blocks/components/Step/StepIndicator.tsx +3 -2
  603. package/assets/templates/blocks/components/Step/StepShowcase.tsx +1 -1
  604. package/assets/templates/blocks/components/Step/StepStates.tsx +3 -2
  605. package/assets/templates/blocks/components/Stepper/StepperCustomContent.tsx +18 -14
  606. package/assets/templates/blocks/components/Stepper/StepperOnTrackHorizontal.tsx +1 -1
  607. package/assets/templates/blocks/components/Table/TableInCard.tsx +1 -1
  608. package/assets/templates/blocks/components/Table/TableShowcase.tsx +1 -1
  609. package/assets/templates/blocks/components/TextArea/TextAreaWithIcon.doc.mjs +0 -1
  610. package/assets/templates/blocks/components/TextArea/TextAreaWithIcon.tsx +2 -2
  611. package/assets/templates/blocks/components/TextInput/TextInputIcon.doc.mjs +0 -1
  612. package/assets/templates/blocks/components/TextInput/TextInputIcon.tsx +3 -7
  613. package/assets/templates/blocks/components/TextInput/TextInputSearch.doc.mjs +0 -1
  614. package/assets/templates/blocks/components/TextInput/TextInputSearch.tsx +3 -3
  615. package/assets/templates/blocks/components/Theme/ThemeApply.tsx +8 -1
  616. package/assets/templates/blocks/components/Theme/ThemeNested.tsx +11 -1
  617. package/assets/templates/blocks/components/Theme/ThemeShowcase.tsx +26 -3
  618. package/assets/templates/blocks/components/Theme/ThemeSwitcher.tsx +8 -1
  619. package/assets/templates/blocks/components/ToggleButton/ToggleButtonColor.doc.mjs +0 -11
  620. package/assets/templates/blocks/components/ToggleButton/ToggleButtonColor.tsx +5 -5
  621. package/assets/templates/blocks/components/ToggleButton/ToggleButtonGroup.doc.mjs +0 -9
  622. package/assets/templates/blocks/components/ToggleButton/ToggleButtonGroup.tsx +5 -9
  623. package/assets/templates/blocks/components/ToggleButton/ToggleButtonIconSwap.doc.mjs +0 -6
  624. package/assets/templates/blocks/components/ToggleButton/ToggleButtonIconSwap.tsx +6 -6
  625. package/assets/templates/blocks/components/ToggleButton/ToggleButtonLabel.doc.mjs +0 -6
  626. package/assets/templates/blocks/components/ToggleButton/ToggleButtonLabel.tsx +3 -3
  627. package/assets/templates/blocks/components/ToggleButton/ToggleButtonShowcase.doc.mjs +0 -6
  628. package/assets/templates/blocks/components/ToggleButton/ToggleButtonShowcase.tsx +6 -6
  629. package/assets/templates/blocks/components/ToggleButton/ToggleButtonStates.doc.mjs +0 -1
  630. package/assets/templates/blocks/components/ToggleButton/ToggleButtonStates.tsx +2 -2
  631. package/assets/templates/blocks/components/Token/TokenIcon.doc.mjs +0 -6
  632. package/assets/templates/blocks/components/Token/TokenIcon.tsx +3 -3
  633. package/assets/templates/blocks/components/Token/TokenShowcase.doc.mjs +0 -1
  634. package/assets/templates/blocks/components/Token/TokenShowcase.tsx +1 -1
  635. package/assets/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx +14 -1
  636. package/assets/templates/blocks/components/Tokenizer/TokenizerIcon.doc.mjs +0 -1
  637. package/assets/templates/blocks/components/Tokenizer/TokenizerIcon.tsx +2 -2
  638. package/assets/templates/blocks/components/Toolbar/ToolbarBulkActions.doc.mjs +0 -1
  639. package/assets/templates/blocks/components/Toolbar/ToolbarBulkActions.tsx +36 -3
  640. package/assets/templates/blocks/components/Toolbar/ToolbarCardHeader.doc.mjs +0 -1
  641. package/assets/templates/blocks/components/Toolbar/ToolbarCardHeader.tsx +4 -3
  642. package/assets/templates/blocks/components/Toolbar/ToolbarSizes.doc.mjs +0 -1
  643. package/assets/templates/blocks/components/Toolbar/ToolbarSizes.tsx +3 -3
  644. package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.doc.mjs +0 -1
  645. package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +8 -3
  646. package/assets/templates/blocks/components/Toolbar/ToolbarThreeSlot.doc.mjs +0 -1
  647. package/assets/templates/blocks/components/Toolbar/ToolbarThreeSlot.tsx +6 -2
  648. package/assets/templates/blocks/components/Toolbar/ToolbarWithTabs.doc.mjs +0 -1
  649. package/assets/templates/blocks/components/Toolbar/ToolbarWithTabs.tsx +11 -2
  650. package/assets/templates/blocks/components/Tooltip/TooltipActionBarTooltips.tsx +33 -3
  651. package/assets/templates/blocks/components/TopNav/TopNavCenteredNavigation.doc.mjs +0 -1
  652. package/assets/templates/blocks/components/TopNav/TopNavCenteredNavigation.tsx +2 -2
  653. package/assets/templates/blocks/components/TopNav/TopNavEnterpriseDashboard.doc.mjs +0 -6
  654. package/assets/templates/blocks/components/TopNav/TopNavEnterpriseDashboard.tsx +7 -7
  655. package/assets/templates/blocks/components/TopNav/TopNavHoverMenu.doc.mjs +0 -8
  656. package/assets/templates/blocks/components/TopNav/TopNavHoverMenu.tsx +14 -9
  657. package/assets/templates/blocks/components/TopNav/TopNavMegaMenu.doc.mjs +0 -8
  658. package/assets/templates/blocks/components/TopNav/TopNavMegaMenu.tsx +11 -11
  659. package/assets/templates/blocks/components/TopNav/TopNavMultipleDropdowns.doc.mjs +0 -5
  660. package/assets/templates/blocks/components/TopNav/TopNavMultipleDropdowns.tsx +4 -8
  661. package/assets/templates/blocks/components/TopNav/TopNavShowcase.doc.mjs +0 -5
  662. package/assets/templates/blocks/components/TopNav/TopNavShowcase.tsx +8 -4
  663. package/assets/templates/blocks/components/TopNav/TopNavWithLogo.doc.mjs +0 -1
  664. package/assets/templates/blocks/components/TopNav/TopNavWithLogo.tsx +7 -2
  665. package/assets/templates/blocks/components/TopNavItem/TopNavItemShowcase.tsx +1 -1
  666. package/assets/templates/blocks/components/TopNavMegaMenu/TopNavMegaMenuBasic.doc.mjs +0 -1
  667. package/assets/templates/blocks/components/TopNavMegaMenu/TopNavMegaMenuBasic.tsx +4 -4
  668. package/assets/templates/blocks/components/TopNavMegaMenu/TopNavMegaMenuShowcase.doc.mjs +0 -7
  669. package/assets/templates/blocks/components/TopNavMegaMenu/TopNavMegaMenuShowcase.tsx +12 -12
  670. package/assets/templates/blocks/components/TopNavMegaMenuItem/TopNavMegaMenuItemBasic.doc.mjs +0 -1
  671. package/assets/templates/blocks/components/TopNavMegaMenuItem/TopNavMegaMenuItemBasic.tsx +2 -2
  672. package/assets/templates/blocks/components/TopNavMenu/TopNavMenuBasic.doc.mjs +0 -1
  673. package/assets/templates/blocks/components/TopNavMenu/TopNavMenuBasic.tsx +4 -4
  674. package/assets/templates/blocks/components/TopNavMenu/TopNavMenuShowcase.doc.mjs +0 -6
  675. package/assets/templates/blocks/components/TopNavMenu/TopNavMenuShowcase.tsx +11 -8
  676. package/assets/templates/blocks/components/TreeList/TreeListFileTreeWithIcons.doc.mjs +0 -1
  677. package/assets/templates/blocks/components/TreeList/TreeListFileTreeWithIcons.tsx +4 -4
  678. package/assets/templates/blocks/components/TreeList/TreeListInteractiveSettings.doc.mjs +0 -1
  679. package/assets/templates/blocks/components/TreeList/TreeListInteractiveSettings.tsx +6 -3
  680. package/assets/templates/blocks/components/Typeahead/TypeaheadSearchField.doc.mjs +0 -1
  681. package/assets/templates/blocks/components/Typeahead/TypeaheadSearchField.tsx +2 -2
  682. package/assets/templates/blocks/components/VisuallyHidden/VisuallyHiddenShowcase.doc.mjs +0 -6
  683. package/assets/templates/blocks/components/VisuallyHidden/VisuallyHiddenShowcase.tsx +30 -7
  684. package/assets/templates/blocks/components/VisuallyHidden/VisuallyHiddenSupplementaryContext.doc.mjs +0 -1
  685. package/assets/templates/blocks/components/VisuallyHidden/VisuallyHiddenSupplementaryContext.tsx +4 -1
  686. package/assets/templates/components.generated.json +1 -1
  687. package/assets/templates/pages/ai-chat/page.tsx +19 -15
  688. package/assets/templates/pages/ai-chat/template.doc.mjs +0 -9
  689. package/assets/templates/pages/ai-chat-landing/page.tsx +16 -16
  690. package/assets/templates/pages/ai-chat-landing/template.doc.mjs +0 -11
  691. package/assets/templates/pages/blank/page.tsx +4 -2
  692. package/assets/templates/pages/canvas-editor/page.tsx +200 -110
  693. package/assets/templates/pages/canvas-editor/template.doc.mjs +0 -46
  694. package/assets/templates/pages/centered-hero/page.tsx +2 -2
  695. package/assets/templates/pages/centered-hero/template.doc.mjs +0 -1
  696. package/assets/templates/pages/checkout-wizard/page.tsx +31 -18
  697. package/assets/templates/pages/checkout-wizard/template.doc.mjs +0 -7
  698. package/assets/templates/pages/classic-gallery/page.tsx +1 -1
  699. package/assets/templates/pages/contact-form/page.tsx +15 -10
  700. package/assets/templates/pages/contact-form/template.doc.mjs +0 -5
  701. package/assets/templates/pages/course-detail/page.tsx +10 -10
  702. package/assets/templates/pages/course-detail/template.doc.mjs +0 -11
  703. package/assets/templates/pages/dashboard/page.tsx +37 -19
  704. package/assets/templates/pages/dashboard/template.doc.mjs +0 -6
  705. package/assets/templates/pages/dashboard-alert-rail/page.tsx +16 -14
  706. package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +0 -8
  707. package/assets/templates/pages/dashboard-cohort-funnel/page.tsx +14 -16
  708. package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +0 -7
  709. package/assets/templates/pages/dashboard-comparison/page.tsx +17 -12
  710. package/assets/templates/pages/dashboard-comparison/template.doc.mjs +0 -8
  711. package/assets/templates/pages/dashboard-composition/page.tsx +40 -23
  712. package/assets/templates/pages/dashboard-composition/template.doc.mjs +0 -1
  713. package/assets/templates/pages/dashboard-progress/page.tsx +105 -109
  714. package/assets/templates/pages/dashboard-progress/template.doc.mjs +0 -7
  715. package/assets/templates/pages/dashboard-scorecard/page.tsx +74 -37
  716. package/assets/templates/pages/dashboard-scorecard/template.doc.mjs +0 -7
  717. package/assets/templates/pages/detail-page/page.tsx +28 -11
  718. package/assets/templates/pages/detail-page/template.doc.mjs +0 -10
  719. package/assets/templates/pages/documentation/page.tsx +11 -4
  720. package/assets/templates/pages/documentation-design/page.tsx +39 -12
  721. package/assets/templates/pages/documentation-design/template.doc.mjs +0 -5
  722. package/assets/templates/pages/documentation-technical/page.tsx +8 -6
  723. package/assets/templates/pages/documentation-technical/template.doc.mjs +0 -5
  724. package/assets/templates/pages/editor/page.tsx +70 -48
  725. package/assets/templates/pages/editor/template.doc.mjs +0 -26
  726. package/assets/templates/pages/file-explorer/page.tsx +19 -19
  727. package/assets/templates/pages/file-explorer/template.doc.mjs +0 -15
  728. package/assets/templates/pages/form-two-column/page.tsx +1 -1
  729. package/assets/templates/pages/form-wizard/page.tsx +12 -5
  730. package/assets/templates/pages/form-wizard-dialog/page.tsx +6 -2
  731. package/assets/templates/pages/form-wizard-inline/page.tsx +16 -12
  732. package/assets/templates/pages/form-wizard-inline/template.doc.mjs +0 -6
  733. package/assets/templates/pages/form-wizard-vertical/page.tsx +21 -24
  734. package/assets/templates/pages/form-wizard-vertical/template.doc.mjs +0 -13
  735. package/assets/templates/pages/gallery-hero/page.tsx +2 -2
  736. package/assets/templates/pages/gallery-hero/template.doc.mjs +0 -1
  737. package/assets/templates/pages/ide/page.tsx +12 -7
  738. package/assets/templates/pages/ide/template.doc.mjs +0 -5
  739. package/assets/templates/pages/incident-console/page.tsx +4 -4
  740. package/assets/templates/pages/incident-console/template.doc.mjs +0 -1
  741. package/assets/templates/pages/kanban-board/page.tsx +128 -47
  742. package/assets/templates/pages/kanban-board/template.doc.mjs +0 -11
  743. package/assets/templates/pages/library/page.tsx +34 -64
  744. package/assets/templates/pages/library/template.doc.mjs +0 -1
  745. package/assets/templates/pages/login/page.tsx +6 -4
  746. package/assets/templates/pages/login/template.doc.mjs +0 -1
  747. package/assets/templates/pages/login-card/page.tsx +6 -4
  748. package/assets/templates/pages/login-card/template.doc.mjs +0 -1
  749. package/assets/templates/pages/login-split/page.tsx +6 -5
  750. package/assets/templates/pages/login-split/template.doc.mjs +0 -1
  751. package/assets/templates/pages/login-sso/page.tsx +6 -6
  752. package/assets/templates/pages/login-sso/template.doc.mjs +0 -1
  753. package/assets/templates/pages/messaging-shell/page.tsx +14 -14
  754. package/assets/templates/pages/messaging-shell/template.doc.mjs +0 -9
  755. package/assets/templates/pages/mixed-gallery/page.tsx +1 -1
  756. package/assets/templates/pages/payment-form/page.tsx +50 -29
  757. package/assets/templates/pages/payment-form/template.doc.mjs +0 -6
  758. package/assets/templates/pages/product-detail/page.tsx +21 -9
  759. package/assets/templates/pages/product-detail/template.doc.mjs +0 -1
  760. package/assets/templates/pages/product-gallery/page.tsx +3 -3
  761. package/assets/templates/pages/product-gallery/template.doc.mjs +0 -1
  762. package/assets/templates/pages/settings/page.tsx +35 -14
  763. package/assets/templates/pages/settings/template.doc.mjs +0 -1
  764. package/assets/templates/pages/settings-dialog/page.tsx +96 -93
  765. package/assets/templates/pages/settings-dialog/template.doc.mjs +0 -53
  766. package/assets/templates/pages/settings-sidebar/page.tsx +74 -36
  767. package/assets/templates/pages/settings-sidebar/template.doc.mjs +0 -16
  768. package/assets/templates/pages/shell-nav/page.tsx +32 -20
  769. package/assets/templates/pages/shell-nav/template.doc.mjs +0 -6
  770. package/assets/templates/pages/shell-side-nav/page.tsx +23 -22
  771. package/assets/templates/pages/shell-side-nav/template.doc.mjs +0 -11
  772. package/assets/templates/pages/shell-top-nav/page.tsx +13 -13
  773. package/assets/templates/pages/shell-top-nav/template.doc.mjs +0 -19
  774. package/assets/templates/pages/side-gallery/page.tsx +5 -2
  775. package/assets/templates/pages/table/page.tsx +21 -21
  776. package/assets/templates/pages/table/template.doc.mjs +0 -10
  777. package/assets/templates/pages/table-collapsible/page.tsx +8 -8
  778. package/assets/templates/pages/table-collapsible/template.doc.mjs +0 -6
  779. package/assets/templates/pages/table-comparison/page.tsx +23 -23
  780. package/assets/templates/pages/table-comparison/template.doc.mjs +0 -14
  781. package/assets/templates/pages/table-filter/page.tsx +75 -47
  782. package/assets/templates/pages/table-filter/template.doc.mjs +0 -19
  783. package/assets/templates/pages/table-grouped/page.tsx +39 -17
  784. package/assets/templates/pages/table-grouped/template.doc.mjs +0 -11
  785. package/assets/templates/pages/table-inbox/page.tsx +147 -65
  786. package/assets/templates/pages/table-inbox/template.doc.mjs +0 -17
  787. package/assets/templates/pages/table-page/page.tsx +3 -6
  788. package/assets/templates/pages/table-page/template.doc.mjs +0 -1
  789. package/assets/templates/pages/table-tree/page.tsx +35 -35
  790. package/assets/templates/pages/table-tree/template.doc.mjs +0 -15
  791. package/assets/templates/pages/theme-showcase/page.tsx +48 -43
  792. package/assets/templates/pages/theme-showcase/template.doc.mjs +0 -19
  793. package/assets/templates/pages/work-item-detail/page.tsx +60 -33
  794. package/assets/templates/pages/work-item-detail/template.doc.mjs +0 -12
  795. package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +12 -12
  796. package/assets/templates/themes/butter/butterTheme.ts +244 -10
  797. package/assets/templates/themes/chocolate/chocolateTheme.ts +81 -10
  798. package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +3 -3
  799. package/assets/templates/themes/gothic/gothicTheme.ts +126 -4
  800. package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +8 -8
  801. package/assets/templates/themes/matcha/matchaTheme.ts +58 -14
  802. package/assets/templates/themes/neutral/neutralTheme.ts +45 -0
  803. package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +3 -3
  804. package/assets/templates/themes/stone/stoneTheme.ts +101 -10
  805. package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +9 -9
  806. package/assets/templates/themes/y2k/y2kTheme.ts +257 -14
  807. package/assets/theme.template.ts +17 -7
  808. package/authoring/config/config.doc.mjs +8 -1
  809. package/authoring/config/parse.mjs +15 -0
  810. package/authoring/config/skill-places.d.mts +23 -0
  811. package/authoring/config/skill-places.mjs +35 -0
  812. package/authoring/config/type.ts +20 -3
  813. package/authoring/debug/parse.d.mts +1 -1
  814. package/authoring/debug/type.ts +4 -0
  815. package/authoring/discover/parse.d.mts +4 -3
  816. package/authoring/discover/parse.mjs +76 -41
  817. package/authoring/discover/type.ts +9 -1
  818. package/authoring/doctypes/_schema.d.mts +36 -16
  819. package/authoring/doctypes/_schema.mjs +29 -0
  820. package/authoring/doctypes/base/type.ts +19 -0
  821. package/authoring/doctypes/command/command.doc.mjs +6 -0
  822. package/authoring/doctypes/command/type.ts +7 -0
  823. package/authoring/doctypes/component/component.doc.mjs +1 -1
  824. package/authoring/doctypes/icon-definition/icon-definition.doc.mjs +17 -1
  825. package/authoring/doctypes/icon-definition/parse.mjs +12 -0
  826. package/authoring/doctypes/icon-definition/type.ts +18 -0
  827. package/authoring/doctypes/reference/reference.doc.mjs +13 -0
  828. package/authoring/doctypes/reference/skill.d.mts +29 -0
  829. package/authoring/doctypes/reference/skill.mjs +56 -0
  830. package/authoring/doctypes/reference/type.ts +19 -0
  831. package/authoring/gap-report/parse.d.mts +1 -1
  832. package/authoring/integration/integration.doc.mjs +8 -0
  833. package/authoring/integration/schema.d.mts +21 -3
  834. package/authoring/integration/schema.mjs +25 -5
  835. package/authoring/integration/type.ts +14 -0
  836. package/clients/cli/build-id.generated.json +1 -1
  837. package/clients/cli/commands/build.doc.mjs +1 -1
  838. package/clients/cli/commands/build.mjs +20 -14
  839. package/clients/cli/commands/component.doc.mjs +3 -1
  840. package/clients/cli/commands/component.mjs +21 -6
  841. package/clients/cli/commands/discover.doc.mjs +2 -2
  842. package/clients/cli/commands/discover.mjs +112 -9
  843. package/clients/cli/commands/docs.doc.mjs +17 -10
  844. package/clients/cli/commands/docs.mjs +112 -191
  845. package/clients/cli/commands/doctor-integration-validate.doc.mjs +4 -2
  846. package/clients/cli/commands/doctor.doc.mjs +3 -1
  847. package/clients/cli/commands/doctor.mjs +16 -3
  848. package/clients/cli/commands/experimental/export.mjs +64 -0
  849. package/clients/cli/commands/experimental/icon.mjs +387 -229
  850. package/clients/cli/commands/experimental/import.mjs +70 -0
  851. package/clients/cli/commands/experimental/index.mjs +152 -13
  852. package/clients/cli/commands/experimental/render-output.mjs +242 -0
  853. package/clients/cli/commands/experimental/theme.mjs +69 -23
  854. package/clients/cli/commands/experimental-export.doc.mjs +73 -0
  855. package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
  856. package/clients/cli/commands/experimental-icon-map.doc.mjs +4 -1
  857. package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +4 -1
  858. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +4 -1
  859. package/clients/cli/commands/experimental-icon-use.doc.mjs +1 -1
  860. package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
  861. package/clients/cli/commands/experimental-import.doc.mjs +53 -0
  862. package/clients/cli/commands/experimental-theme-add.doc.mjs +1 -1
  863. package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -1
  864. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +1 -1
  865. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +7 -2
  866. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
  867. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
  868. package/clients/cli/commands/experimental-theme.doc.mjs +1 -1
  869. package/clients/cli/commands/experimental.doc.mjs +4 -4
  870. package/clients/cli/commands/init.doc.mjs +63 -31
  871. package/clients/cli/commands/integration-check.doc.mjs +1 -1
  872. package/clients/cli/commands/mcp.doc.mjs +57 -0
  873. package/clients/cli/commands/mcp.mjs +51 -0
  874. package/clients/cli/commands/search.mjs +78 -9
  875. package/clients/cli/commands/template.doc.mjs +14 -5
  876. package/clients/cli/commands/template.mjs +21 -2
  877. package/clients/cli/commands/theme-add.doc.mjs +6 -2
  878. package/clients/cli/commands/theme-build.doc.mjs +1 -1
  879. package/clients/cli/commands/theme-remove.doc.mjs +1 -1
  880. package/clients/cli/commands/theme-targets.doc.mjs +1 -1
  881. package/clients/cli/commands/theme.mjs +86 -5
  882. package/clients/cli/commands/upgrade.doc.mjs +2 -1
  883. package/clients/cli/commands.generated.json +1 -1
  884. package/clients/cli/formatters/index.mjs +52 -6
  885. package/clients/cli/index.mjs +44 -37
  886. package/clients/cli/lib/cli-error.mjs +20 -10
  887. package/clients/cli/lib/component-format.mjs +167 -74
  888. package/clients/cli/lib/define-command.mjs +92 -4
  889. package/clients/cli/lib/hook-format.mjs +28 -24
  890. package/clients/cli/lib/json-shim.mjs +61 -4
  891. package/clients/cli/lib/manifest.mjs +9 -1
  892. package/clients/cli/lib/mcp-server.mjs +286 -0
  893. package/clients/cli/lib/mcp-tools.mjs +405 -0
  894. package/clients/cli/lib/other-cli-words.mjs +99 -0
  895. package/clients/cli/lib/renamed-commands.mjs +21 -0
  896. package/clients/cli/lib/root-args.mjs +10 -3
  897. package/clients/cli/lib/stray-option.mjs +79 -1
  898. package/clients/cli/lib/unknown-command.mjs +406 -13
  899. package/clients/cli/manifest.generated.json +1 -1
  900. package/clients/cli/run.mjs +27 -0
  901. package/foundation/agent-docs/agent-doc-state.d.mts +20 -2
  902. package/foundation/agent-docs/agent-doc-state.mjs +71 -4
  903. package/foundation/agent-docs/agent-docs.d.mts +79 -5
  904. package/foundation/agent-docs/agent-docs.mjs +137 -10
  905. package/foundation/agent-docs/computer-agent-text.d.mts +28 -14
  906. package/foundation/agent-docs/computer-agent-text.mjs +85 -172
  907. package/foundation/agent-docs/folder-scope.d.mts +51 -0
  908. package/foundation/agent-docs/folder-scope.mjs +86 -0
  909. package/foundation/agent-docs/managed-skill-file.d.mts +115 -0
  910. package/foundation/agent-docs/managed-skill-file.mjs +224 -0
  911. package/foundation/agent-docs/skill-place-files.d.mts +119 -0
  912. package/foundation/agent-docs/skill-place-files.mjs +374 -0
  913. package/foundation/agent-docs/skill-places.d.mts +139 -0
  914. package/foundation/agent-docs/skill-places.mjs +321 -0
  915. package/foundation/color/css-color.d.mts +150 -0
  916. package/foundation/color/css-color.mjs +960 -0
  917. package/foundation/config/config-path.d.mts +2 -2
  918. package/foundation/config/config-path.mjs +5 -6
  919. package/foundation/config/config-writer.d.mts +5 -1
  920. package/foundation/config/config-writer.mjs +20 -4
  921. package/foundation/config/project.d.mts +8 -5
  922. package/foundation/config/project.mjs +35 -17
  923. package/foundation/config/theme-state.d.mts +13 -0
  924. package/foundation/config/theme-state.mjs +28 -0
  925. package/foundation/debug/event.d.mts +2 -1
  926. package/foundation/debug/event.mjs +2 -1
  927. package/foundation/discovery/button-actions.d.mts +220 -0
  928. package/foundation/discovery/button-actions.mjs +1527 -0
  929. package/foundation/discovery/cli-self-docs.d.mts +7 -0
  930. package/foundation/discovery/cli-self-docs.mjs +67 -6
  931. package/foundation/discovery/color-modes.d.mts +14 -0
  932. package/foundation/discovery/color-modes.mjs +53 -0
  933. package/foundation/discovery/command-pointers.d.mts +21 -4
  934. package/foundation/discovery/command-pointers.mjs +25 -4
  935. package/foundation/discovery/component-discovery.d.mts +10 -0
  936. package/foundation/discovery/component-discovery.mjs +99 -43
  937. package/foundation/discovery/component-replacement.d.mts +8 -0
  938. package/foundation/discovery/component-replacement.mjs +13 -0
  939. package/foundation/discovery/core-augmentation-points.d.mts +90 -0
  940. package/foundation/discovery/core-augmentation-points.mjs +1030 -0
  941. package/foundation/discovery/core-component-views.d.mts +15 -0
  942. package/foundation/discovery/core-component-views.mjs +176 -0
  943. package/foundation/discovery/core-elements.d.mts +29 -0
  944. package/foundation/discovery/core-elements.mjs +57 -0
  945. package/foundation/discovery/core-prop-types.d.mts +65 -0
  946. package/foundation/discovery/core-prop-types.mjs +221 -0
  947. package/foundation/discovery/core-props.d.mts +33 -0
  948. package/foundation/discovery/core-props.mjs +64 -0
  949. package/foundation/discovery/doc-types.d.mts +10 -42
  950. package/foundation/discovery/doc-types.mjs +26 -7
  951. package/foundation/discovery/docs-discovery.d.mts +33 -2
  952. package/foundation/discovery/docs-discovery.mjs +149 -72
  953. package/foundation/discovery/docs-section-key.d.mts +21 -1
  954. package/foundation/discovery/docs-section-key.mjs +57 -19
  955. package/foundation/discovery/hook-discovery.d.mts +2 -0
  956. package/foundation/discovery/hook-discovery.mjs +6 -5
  957. package/foundation/discovery/icon-definition-discovery.d.mts +155 -3
  958. package/foundation/discovery/icon-definition-discovery.mjs +197 -5
  959. package/foundation/discovery/icon-imports.d.mts +66 -0
  960. package/foundation/discovery/icon-imports.mjs +225 -0
  961. package/foundation/discovery/icon-ranking.d.mts +118 -4
  962. package/foundation/discovery/icon-ranking.mjs +453 -59
  963. package/foundation/discovery/icon-set-checks.d.mts +2 -0
  964. package/foundation/discovery/icon-set-checks.mjs +16 -2
  965. package/foundation/discovery/icon-set-discovery.d.mts +68 -2
  966. package/foundation/discovery/icon-set-discovery.mjs +124 -23
  967. package/foundation/discovery/icon-set-writer.d.mts +9 -13
  968. package/foundation/discovery/icon-set-writer.mjs +89 -36
  969. package/foundation/discovery/integration-skills.d.mts +62 -0
  970. package/foundation/discovery/integration-skills.mjs +116 -0
  971. package/foundation/discovery/module-exports.d.mts +8 -0
  972. package/foundation/discovery/module-exports.mjs +20 -21
  973. package/foundation/discovery/name-roots.d.mts +5 -0
  974. package/foundation/discovery/name-roots.mjs +11 -0
  975. package/foundation/discovery/package-exports.d.mts +22 -0
  976. package/foundation/discovery/package-exports.mjs +44 -3
  977. package/foundation/discovery/project-typescript.d.mts +5 -1
  978. package/foundation/discovery/project-typescript.mjs +8 -2
  979. package/foundation/discovery/prop-drift.d.mts +16 -0
  980. package/foundation/discovery/prop-drift.mjs +154 -3
  981. package/foundation/discovery/replacement-aliases.d.mts +51 -0
  982. package/foundation/discovery/replacement-aliases.mjs +95 -0
  983. package/foundation/discovery/runner-allowlist.d.mts +2 -1
  984. package/foundation/discovery/runner-allowlist.mjs +3 -1
  985. package/foundation/discovery/runner-commands.mjs +1 -0
  986. package/foundation/discovery/stored-component-list.mjs +34 -2
  987. package/foundation/discovery/template-adapter.d.mts +27 -1
  988. package/foundation/discovery/template-adapter.mjs +221 -10
  989. package/foundation/discovery/template-destination.d.mts +14 -6
  990. package/foundation/discovery/template-destination.mjs +42 -8
  991. package/foundation/discovery/template-icon-meanings.d.mts +7 -2
  992. package/foundation/discovery/template-icon-meanings.mjs +52 -12
  993. package/foundation/discovery/template-icons.d.mts +46 -3
  994. package/foundation/discovery/template-icons.mjs +72 -109
  995. package/foundation/discovery/template-needs.d.mts +34 -5
  996. package/foundation/discovery/template-needs.mjs +164 -22
  997. package/foundation/discovery/template-placeholders.d.mts +149 -0
  998. package/foundation/discovery/template-placeholders.mjs +463 -0
  999. package/foundation/discovery/template-source-tree.d.mts +6 -3
  1000. package/foundation/discovery/template-source-tree.mjs +8 -5
  1001. package/foundation/discovery/theme-discovery.d.mts +8 -0
  1002. package/foundation/discovery/theme-discovery.mjs +23 -6
  1003. package/foundation/discovery/theme-imports.d.mts +1 -3
  1004. package/foundation/discovery/theme-imports.mjs +5 -30
  1005. package/foundation/doc-compiler/compile.mjs +6 -8
  1006. package/foundation/doc-compiler/doc-syntax.d.mts +25 -1
  1007. package/foundation/doc-compiler/doc-syntax.mjs +85 -10
  1008. package/foundation/doc-compiler/doc-text.d.mts +52 -0
  1009. package/foundation/doc-compiler/doc-text.mjs +176 -0
  1010. package/foundation/doc-compiler/links.d.mts +8 -2
  1011. package/foundation/doc-compiler/links.mjs +27 -6
  1012. package/foundation/doc-compiler/read.d.mts +1 -1
  1013. package/foundation/doc-compiler/stored-docs.d.mts +14 -3
  1014. package/foundation/doc-compiler/stored-docs.mjs +12 -6
  1015. package/foundation/env/cli-command.d.mts +68 -10
  1016. package/foundation/env/cli-command.mjs +116 -22
  1017. package/foundation/env/package-manager.d.mts +33 -2
  1018. package/foundation/env/package-manager.mjs +68 -6
  1019. package/foundation/env/project-scope.d.mts +9 -0
  1020. package/foundation/env/project-scope.mjs +28 -2
  1021. package/foundation/env/user-dirs.d.mts +14 -0
  1022. package/foundation/env/user-dirs.mjs +34 -1
  1023. package/foundation/env/user-settings.d.mts +15 -0
  1024. package/foundation/env/user-settings.mjs +56 -2
  1025. package/foundation/fonts/font-stylesheet.d.mts +11 -0
  1026. package/foundation/fonts/font-stylesheet.mjs +62 -7
  1027. package/foundation/fs/cache-eviction.d.mts +7 -5
  1028. package/foundation/fs/cache-eviction.mjs +20 -13
  1029. package/foundation/fs/empty-folder.d.mts +12 -0
  1030. package/foundation/fs/empty-folder.mjs +30 -0
  1031. package/foundation/fs/file-protection.d.mts +11 -0
  1032. package/foundation/fs/file-protection.mjs +49 -3
  1033. package/foundation/fs/gather-cache.d.mts +14 -7
  1034. package/foundation/fs/gather-cache.mjs +163 -67
  1035. package/foundation/fs/import-url.d.mts +7 -5
  1036. package/foundation/fs/import-url.mjs +7 -5
  1037. package/foundation/fs/jiti-cache.d.mts +47 -26
  1038. package/foundation/fs/jiti-cache.mjs +222 -130
  1039. package/foundation/fs/loaded-files.d.mts +15 -1
  1040. package/foundation/fs/loaded-files.mjs +40 -3
  1041. package/foundation/fs/module-loader.d.mts +3 -1
  1042. package/foundation/fs/module-loader.mjs +85 -5
  1043. package/foundation/fs/path-safety.d.mts +1 -0
  1044. package/foundation/fs/path-safety.mjs +2 -0
  1045. package/foundation/fs/read-record.mjs +9 -5
  1046. package/foundation/fs/relative-specifier.d.mts +10 -0
  1047. package/foundation/fs/relative-specifier.mjs +28 -0
  1048. package/foundation/integrations/computer-integrations.mjs +11 -10
  1049. package/foundation/integrations/icon-features.d.mts +63 -0
  1050. package/foundation/integrations/icon-features.mjs +54 -0
  1051. package/foundation/integrations/integration-warnings.d.mts +10 -0
  1052. package/foundation/integrations/integration-warnings.mjs +12 -3
  1053. package/foundation/integrations/integrations.d.mts +16 -2
  1054. package/foundation/integrations/integrations.mjs +50 -8
  1055. package/foundation/integrations/may-have-integrations.mjs +7 -6
  1056. package/foundation/integrations/provider-resolution.mjs +19 -2
  1057. package/foundation/integrations/validate-contributions.d.mts +13 -3
  1058. package/foundation/integrations/validate-contributions.mjs +64 -13
  1059. package/foundation/release/agent-text-worker.mjs +33 -1
  1060. package/foundation/release/cache.d.mts +48 -3
  1061. package/foundation/release/cache.mjs +196 -20
  1062. package/foundation/release/choose.d.mts +5 -2
  1063. package/foundation/release/choose.mjs +54 -4
  1064. package/foundation/release/global-state.mjs +10 -2
  1065. package/foundation/release/handoff.mjs +7 -1
  1066. package/foundation/release/notices.d.mts +97 -9
  1067. package/foundation/release/notices.mjs +421 -59
  1068. package/foundation/release/project.d.mts +21 -4
  1069. package/foundation/release/project.mjs +74 -42
  1070. package/foundation/release/run-context.d.mts +6 -0
  1071. package/foundation/release/run-context.mjs +9 -0
  1072. package/foundation/render/assets.d.mts +7 -0
  1073. package/foundation/render/assets.mjs +30 -17
  1074. package/foundation/render/charts.d.mts +11 -10
  1075. package/foundation/render/charts.mjs +112 -1
  1076. package/foundation/render/class-alias.d.mts +23 -0
  1077. package/foundation/render/class-alias.mjs +333 -0
  1078. package/foundation/render/client-bundle.d.mts +183 -0
  1079. package/foundation/render/client-bundle.mjs +1026 -0
  1080. package/foundation/render/component-map.mjs +1 -1
  1081. package/foundation/render/css-cut.d.mts +26 -0
  1082. package/foundation/render/css-cut.mjs +344 -2
  1083. package/foundation/render/cut-short.d.mts +7 -1
  1084. package/foundation/render/cut-short.mjs +46 -6
  1085. package/foundation/render/dropped-text.d.mts +43 -0
  1086. package/foundation/render/dropped-text.mjs +90 -0
  1087. package/foundation/render/embedded-files.d.mts +24 -1
  1088. package/foundation/render/embedded-files.mjs +41 -4
  1089. package/foundation/render/embedded-imports.d.mts +72 -12
  1090. package/foundation/render/embedded-imports.mjs +206 -70
  1091. package/foundation/render/esbuild-dependency.d.mts +14 -0
  1092. package/foundation/render/esbuild-dependency.mjs +41 -0
  1093. package/foundation/render/file-header.d.mts +7 -2
  1094. package/foundation/render/file-header.mjs +19 -10
  1095. package/foundation/render/html-reader.d.mts +36 -17
  1096. package/foundation/render/html-reader.mjs +239 -32
  1097. package/foundation/render/image-attributes.d.mts +25 -0
  1098. package/foundation/render/image-attributes.mjs +33 -0
  1099. package/foundation/render/markup-edits.mjs +1 -1
  1100. package/foundation/render/package-resolve-hooks.d.mts +54 -0
  1101. package/foundation/render/package-resolve-hooks.mjs +144 -0
  1102. package/foundation/render/page-host.mjs +1 -1
  1103. package/foundation/render/page-worker.mjs +1307 -107
  1104. package/foundation/render/picture-chrome.mjs +54 -29
  1105. package/foundation/render/picture-playwright.mjs +78 -42
  1106. package/foundation/render/picture-window.d.mts +44 -5
  1107. package/foundation/render/picture-window.mjs +265 -19
  1108. package/foundation/render/rebuild.mjs +2 -2
  1109. package/foundation/render/remote-images.d.mts +83 -0
  1110. package/foundation/render/remote-images.mjs +384 -0
  1111. package/foundation/render/render-page.d.mts +219 -8
  1112. package/foundation/render/render-page.mjs +1702 -165
  1113. package/foundation/render/restore-folder.d.mts +13 -0
  1114. package/foundation/render/restore-folder.mjs +30 -0
  1115. package/foundation/render/served-packages.d.mts +14 -1
  1116. package/foundation/render/served-packages.mjs +50 -6
  1117. package/foundation/render/share-checks.d.mts +35 -0
  1118. package/foundation/render/share-checks.mjs +95 -0
  1119. package/foundation/render/source-block.d.mts +14 -3
  1120. package/foundation/render/source-block.mjs +44 -9
  1121. package/foundation/render/srcset.d.mts +32 -0
  1122. package/foundation/render/srcset.mjs +64 -0
  1123. package/foundation/render/ts-paths.d.mts +52 -1
  1124. package/foundation/render/ts-paths.mjs +114 -4
  1125. package/foundation/render/value-uses.d.mts +43 -0
  1126. package/foundation/render/value-uses.mjs +110 -0
  1127. package/foundation/response/error-codes.d.mts +2 -1
  1128. package/foundation/response/error-codes.doc.mjs +16 -10
  1129. package/foundation/response/error-codes.mjs +19 -8
  1130. package/foundation/response/json.d.mts +0 -15
  1131. package/foundation/response/json.mjs +1 -51
  1132. package/foundation/response/response-types.doc.mjs +28 -17
  1133. package/foundation/runtime/css-tree.d.mts +16 -0
  1134. package/foundation/runtime/css-tree.mjs +46 -3
  1135. package/foundation/runtime/lazy-dependencies.d.mts +7 -0
  1136. package/foundation/runtime/lazy-dependencies.mjs +25 -3
  1137. package/foundation/runtime/locked-versions.d.mts +4 -2
  1138. package/foundation/runtime/locked-versions.mjs +18 -10
  1139. package/foundation/runtime/package-root.d.mts +25 -0
  1140. package/foundation/runtime/package-root.mjs +48 -0
  1141. package/foundation/runtime/word-table.d.mts +18 -0
  1142. package/foundation/runtime/word-table.mjs +33 -0
  1143. package/foundation/suggest/other-command.d.mts +23 -0
  1144. package/foundation/suggest/other-command.mjs +49 -5
  1145. package/foundation/text/default-variant.d.mts +20 -0
  1146. package/foundation/text/default-variant.mjs +24 -0
  1147. package/foundation/text/definition-coverage.d.mts +21 -0
  1148. package/foundation/text/definition-coverage.mjs +20 -0
  1149. package/foundation/text/icon-id.d.mts +20 -0
  1150. package/foundation/text/icon-id.mjs +40 -0
  1151. package/foundation/text/icon-set-next.d.mts +26 -0
  1152. package/foundation/text/icon-set-next.mjs +37 -0
  1153. package/foundation/text/string-utils.mjs +14 -41
  1154. package/foundation/text/suggest-order.d.mts +10 -4
  1155. package/foundation/text/suggest-order.mjs +20 -13
  1156. package/package.json +8 -6
  1157. package/assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs +0 -394
  1158. package/assets/docs/tree/render-pages.doc.mjs +0 -135
  1159. package/clients/cli/commands/experimental/render.mjs +0 -154
  1160. package/clients/cli/commands/experimental-render.doc.mjs +0 -73
@@ -44,6 +44,7 @@ import {
44
44
  nearestShade,
45
45
  paletteDialOf,
46
46
  seedOf,
47
+ seedsInEffect,
47
48
  vibrancyMoves,
48
49
  } from './_palette.mjs';
49
50
  import {isColorToken} from './_compiler.mjs';
@@ -59,6 +60,9 @@ import {
59
60
  positionalCornerToken,
60
61
  radiusAt,
61
62
  partState,
63
+ baseBlocksFor,
64
+ partsOf,
65
+ MOMENT_STATES,
62
66
  } from './_settings.mjs';
63
67
  import {
64
68
  borderlessSurfaces,
@@ -73,10 +77,11 @@ import {
73
77
  stateSynonym,
74
78
  } from './_check.mjs';
75
79
  import {coreKeyframes} from './_parts.mjs';
76
- import {NUMBER_WORDS, commaNumbers, modeNear} from './_normal.mjs';
80
+ import {NUMBER_WORDS, commaNumbers, modeNear, pluralOf} from './_normal.mjs';
77
81
  import {levenshteinDistance} from '../../foundation/text/levenshtein.mjs';
78
82
  import {cssProperties, keywordsOf, matchValue, splitTop} from './_css.mjs';
79
83
 
84
+ import {render as renderStep} from './_how-commands.mjs';
80
85
  /** @typedef {import('./_how-commands.mjs').Step} Step */
81
86
  /** @typedef {import('./_how-commands.mjs').MeasureIntent} MeasureIntent */
82
87
 
@@ -85,7 +90,7 @@ import {cssProperties, keywordsOf, matchValue, splitTop} from './_css.mjs';
85
90
  * steps run in order; most options are one step. `smallest`: the options
86
91
  * are one change in growing amounts, and the answer is the first the
87
92
  * measured check keeps.
88
- * @typedef {{text: string, options: Step[][], sequence?: boolean, lookup?: string, intent?: MeasureIntent, smallest?: boolean, modeInValue?: boolean}} Draft
93
+ * @typedef {{text: string, options: Step[][], sequence?: boolean, lookup?: string, intent?: MeasureIntent, smallest?: boolean, modeInValue?: boolean, unmet?: string}} Draft
89
94
  */
90
95
 
91
96
  /**
@@ -223,6 +228,8 @@ const TEXT_WORDS =
223
228
 
224
229
  /** Plain words that are never corrected, though one letter off a VOCAB word. */
225
230
  const KEEP = new Set([
231
+ // A range (a calendar's range band, a date range) is no color.
232
+ 'range',
226
233
  // A reader (a book reader, a feed reader) is no header.
227
234
  'reader',
228
235
  'readers',
@@ -320,7 +327,11 @@ function corrected(w, vocab) {
320
327
  const limit = w.length >= 8 ? 2 : 1;
321
328
  let best = w;
322
329
  let bestD = limit + 1;
330
+ // (A near miss keeps its first letter, as typing slips do: "buton",
331
+ // "bordr". A word that differs at its start is another word, "stable"
332
+ // no "table".)
323
333
  for (const v of vocab) {
334
+ if (v[0] !== w[0]) continue;
324
335
  const d = levenshteinDistance(w, v, 2, {swaps: true});
325
336
  if (d < bestD) [best, bestD] = [v, d];
326
337
  }
@@ -423,6 +434,15 @@ const HUES = wordTable(
423
434
  gold: '#ca8a04',
424
435
  bronze: '#a16207',
425
436
  mauve: '#b784a7',
437
+ tan: '#d2b48c',
438
+ paper: '#f7f3e9',
439
+ // (Names said in two words, joined by the reader into one: "off-white",
440
+ // "ink blue", "grass green", "safety orange", "blue-gray".)
441
+ offwhite: '#faf8f3',
442
+ inkblue: '#1e3a5f',
443
+ grassgreen: '#4caf50',
444
+ safetyorange: '#ff6700',
445
+ bluegray: '#64748b',
426
446
  }),
427
447
  );
428
448
  /**
@@ -430,6 +450,13 @@ const HUES = wordTable(
430
450
  * said whole, never a word a typo is corrected to ("state" is no slate).
431
451
  */
432
452
  const PALETTE_NAMES = new Set([
453
+ 'tan',
454
+ 'paper',
455
+ 'offwhite',
456
+ 'inkblue',
457
+ 'grassgreen',
458
+ 'safetyorange',
459
+ 'bluegray',
433
460
  'terracotta',
434
461
  'sage',
435
462
  'rust',
@@ -625,7 +652,7 @@ function colorsFound(c) {
625
652
  c.slice((m.index ?? 0) + m[0].length);
626
653
  }
627
654
  const re =
628
- /#[0-9a-f]{3,8}\b|\b(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color-mix)\([^)]*\)|\b(?:(lighter|light|pale|darker|dark|deep|rich|subtle|soft)\s+)?([a-z]+)\b/g;
655
+ /#[0-9a-f]{3,8}\b|\b(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color-mix)\([^)]*\)|\b(?:(lighter|light|pale|pastel|darker|dark|deeper|deep|rich|subtle|soft)\s+)?([a-z]+)\b/g;
629
656
  for (const m of c
630
657
  .replace(GRAY_STOP, s => ' '.repeat(s.length))
631
658
  .matchAll(re)) {
@@ -650,6 +677,7 @@ function colorsFound(c) {
650
677
  lighter: 'light',
651
678
  darker: 'dark',
652
679
  deep: 'dark',
680
+ deeper: 'dark',
653
681
  rich: 'dark',
654
682
  })[m[1] ?? ''] ?? m[1];
655
683
  const word = m[2];
@@ -665,10 +693,19 @@ function colorsFound(c) {
665
693
  base &&
666
694
  (shade === 'light' ||
667
695
  shade === 'pale' ||
696
+ shade === 'pastel' ||
668
697
  (shade === 'dark' && Math.max(...base.slice(0, 3)) > 150))
669
698
  ) {
670
699
  const to = shade === 'dark' ? 0 : 255;
671
- const k = shade === 'dark' ? 0.4 : shade === 'light' ? 0.75 : 0.88;
700
+ // (A pastel is a hue well toward white, keeping some of its color.)
701
+ const k =
702
+ shade === 'dark'
703
+ ? 0.4
704
+ : shade === 'pastel'
705
+ ? 0.6
706
+ : shade === 'light'
707
+ ? 0.75
708
+ : 0.88;
672
709
  found.push([
673
710
  m.index ?? 0,
674
711
  hex(base.slice(0, 3).map(v => Math.round(v + (to - v) * k))),
@@ -686,6 +723,72 @@ function colorsFound(c) {
686
723
  return found.sort((a, b) => a[0] - b[0]);
687
724
  }
688
725
 
726
+ /**
727
+ * The words that name a part by its own last word: a calendar day is
728
+ * also its date, a list item its option.
729
+ * @param {string} k
730
+ */
731
+ function ownWords(k) {
732
+ const last = String(k.split('-').at(-1));
733
+ return (
734
+ /** @type {Record<string, string>} */ ({
735
+ day: 'day|date',
736
+ item: 'item|option|entry',
737
+ row: 'row|line',
738
+ })[last] ?? last
739
+ );
740
+ }
741
+
742
+ /**
743
+ * A typed value no page could show, for the properties whose range is
744
+ * plain: a line height that draws lines over each other (under 0.8) or
745
+ * far apart (over 4), a padding, margin or gap wider than any screen
746
+ * (over 512px), a font size under 6px or over 256px, a border over 64px.
747
+ * The reason, or null for a value in range (and for any other property).
748
+ * @param {{thing: string, value?: unknown}} st
749
+ * @returns {string | null}
750
+ */
751
+ function outOfBounds(st) {
752
+ const v = String(st.value ?? '').trim();
753
+ const m = /^(-?\d*\.?\d+)(px|rem|em|%)?$/.exec(v);
754
+ if (!m) return null;
755
+ const n = Number(m[1]);
756
+ const unit = m[2] ?? '';
757
+ const px =
758
+ unit === 'rem' || unit === 'em' ? n * 16 : unit === 'px' ? n : null;
759
+ const thing = st.thing;
760
+ if (/^line-height$|^--text-[a-z0-9-]+-leading$/.test(thing)) {
761
+ const ratio = unit === '' ? n : unit === '%' ? n / 100 : null;
762
+ if (ratio != null && (ratio < 0.5 || ratio > 4))
763
+ return `a line height of ${v} ${ratio < 0.5 ? 'draws each line over the one before it' : 'leaves lines far apart'}; a line height reads between 0.5 and 4`;
764
+ return null;
765
+ }
766
+ if (
767
+ /^(?:padding|margin|gap|row-gap|column-gap)(?:-[a-z-]+)?$|^--spacing-/.test(
768
+ thing,
769
+ )
770
+ ) {
771
+ const each = v.split(/\s+/);
772
+ if (px != null && Math.abs(px) > 512)
773
+ return `${thing} ${v} is wider than any screen; a ${thing.replace(/^--/, '')} reads up to 512px`;
774
+ void each;
775
+ return null;
776
+ }
777
+ if (
778
+ /^font-size$|^--text-[a-z0-9-]+-size$/.test(thing) &&
779
+ px != null &&
780
+ (px < 6 || px > 256)
781
+ )
782
+ return `a font size of ${v} ${px < 6 ? 'cannot be read' : 'is wider than the screen for a word'}; a font size reads between 6px and 256px`;
783
+ if (
784
+ /^border(?:-[a-z]+)?-width$|^--border-width$/.test(thing) &&
785
+ px != null &&
786
+ px > 64
787
+ )
788
+ return `a border of ${v} covers the part; a border reads up to 64px`;
789
+ return null;
790
+ }
791
+
689
792
  /**
690
793
  * A hex color written with the wrong number of digits ("#12345").
691
794
  * @param {string} c
@@ -1197,7 +1300,20 @@ function sharedAsk(q, partWords) {
1197
1300
  const m2 = new RegExp(
1198
1301
  `^\\s*([a-z]+)\\s+(?:${re2.source})`,
1199
1302
  ).exec(right);
1200
- return m2 && stateWord(m2[1]) != null ? m2 : null;
1303
+ // (A word that describes the part, "the draft badge", "the
1304
+ // hovered card", goes with it, as on the left; a word that
1305
+ // is an ask of its own, a color, an aspect or a verb, never.)
1306
+ const w = m2 ? m2[1].toLowerCase() : '';
1307
+ const describes =
1308
+ m2 != null &&
1309
+ (stateWord(w) != null ||
1310
+ (!colorsIn(w).length &&
1311
+ !aspectsOf(w).length &&
1312
+ !partWords.some(([p]) => p.test(` ${w} `)) &&
1313
+ !/^(?:make|set|give|turn|change|add|remove|keep|use|put|round|square|no|not|without|except|than)$/.test(
1314
+ w,
1315
+ )));
1316
+ return describes ? m2 : null;
1201
1317
  })();
1202
1318
  if (!r) continue;
1203
1319
  const lead = left.slice(0, l.index);
@@ -1600,13 +1716,54 @@ function shadowWay(text) {
1600
1716
  return null;
1601
1717
  }
1602
1718
 
1719
+ /**
1720
+ * A clause's colors without one said as what something is now, which is
1721
+ * the color the ask moves away from, never the one it asks for: "too
1722
+ * bright blue" (the way, "too bright", stays an ask).
1723
+ * @param {string} text
1724
+ */
1725
+ function withoutColorNow(text) {
1726
+ return String(text).replace(
1727
+ /\btoo\s+(?:[a-z]+\s+)?(?=[a-z#])((?:[a-z]+|#[0-9a-f]{3,8})\b)/gi,
1728
+ (m, w) => (colorsIn(w).length ? m.replace(w, ' ') : m),
1729
+ );
1730
+ }
1731
+
1732
+ /**
1733
+ * A question without a report of how something looks now ("is still
1734
+ * gray", "it's blue now"): what it is now is no value to write, so the rest
1735
+ * reads as the ask it is (the part, and what to look at).
1736
+ * @param {string} text
1737
+ */
1738
+ function withoutLooksNow(text) {
1739
+ return (
1740
+ String(text)
1741
+ .replace(
1742
+ /\b(?:(?:is|are|it'?s|looks?|stays?)\s+)?(?:still|currently|right now)\s+((?:[a-z]+|#[0-9a-f]{3,8})\b)/gi,
1743
+ (m, w) => (colorsIn(w).length ? ' ' : m),
1744
+ )
1745
+ .replace(
1746
+ /\b(?:is|are|it'?s)\s+((?:[a-z]+|#[0-9a-f]{3,8}))\s+now\b/gi,
1747
+ (m, w) => (colorsIn(w).length ? ' ' : m),
1748
+ )
1749
+ // (Spaces only: a line break between asks stays a break.)
1750
+ .replace(/[ \t]{2,}/g, ' ')
1751
+ );
1752
+ }
1753
+
1603
1754
  /**
1604
1755
  * The near color a "never use pure <color>" ask moves a color to: a
1605
- * near-black for a dark color, a near-white for a light one.
1756
+ * near-black for a dark color, a near-white for a light one, tinted with
1757
+ * the theme's own neutral in that mode (a purple theme's off-white is a
1758
+ * pale lavender), so it reads as the theme's and is visibly off the color.
1606
1759
  * @param {number[]} avoid the RGB to stay off
1760
+ * @param {number[] | null} [tint] the theme's neutral there, as RGB
1607
1761
  */
1608
- function nearOff(avoid) {
1609
- return avoid.reduce((x, y) => x + y, 0) < 384 ? '#1f2937' : '#f9fafb';
1762
+ function nearOff(avoid, tint) {
1763
+ const dark = avoid.reduce((x, y) => x + y, 0) < 384;
1764
+ if (!tint) return dark ? '#1f2937' : '#f9fafb';
1765
+ const share = dark ? 0.25 : 0.1;
1766
+ return hex(avoid.map((x, i) => Math.round(x + (tint[i] - x) * share)));
1610
1767
  }
1611
1768
 
1612
1769
  /**
@@ -1683,7 +1840,9 @@ function keepsAsExcept(question) {
1683
1840
  // up to the ask's own verb, is a keep too.
1684
1841
  .replace(
1685
1842
  new RegExp(
1686
- String.raw`^\s*(?:please\s+)?(?:keep|leave)\s+(?:the\s+|my\s+)?([a-z0-9][a-z0-9 -]*?)\s*(?:,\s*)?(?:and\s+|then\s+)?(?=(?:please\s+)?(?:make|set|give|turn|change|round|add|remove)\b)`,
1843
+ // (The ask's verb is a whole word: the "round" inside "background"
1844
+ // is no verb, so the keep never ends mid-word.)
1845
+ String.raw`^\s*(?:please\s+)?(?:keep|leave)\s+(?:the\s+|my\s+)?([a-z0-9][a-z0-9 -]*?)\s*(?:,\s*)?(?:and\s+|then\s+)?(?=(?:please\s+)?\b(?:make|set|give|turn|change|round|add|remove)\b)`,
1687
1846
  'i',
1688
1847
  ),
1689
1848
  (_m, x) => {
@@ -1736,6 +1895,20 @@ function stateWord(t) {
1736
1895
  return null;
1737
1896
  }
1738
1897
 
1898
+ /**
1899
+ * Whether states said together are the part in all of them at once: a
1900
+ * list with a condition in it (checked, selected, disabled); never moment
1901
+ * states alone (hovered and pressed are each one).
1902
+ * @param {string[]} words
1903
+ */
1904
+ function atOnce(words) {
1905
+ const states = words.map(stateWord);
1906
+ return (
1907
+ states.every(st => st != null) &&
1908
+ states.some(st => !MOMENT_STATES.includes(String(st)))
1909
+ );
1910
+ }
1911
+
1739
1912
  /**
1740
1913
  * A clause's words with its mode phrases taken out ("in light mode", "dark
1741
1914
  * theme", "in light"), so "darker … in light mode" reads as darker.
@@ -1777,6 +1950,55 @@ const BY_SCREEN = /** @type {const} */ ('by-screen');
1777
1950
  */
1778
1951
  const compared = new WeakMap();
1779
1952
 
1953
+ /**
1954
+ * How visible an ask makes a line or a tint: `stronger` (more of it) or
1955
+ * fainter, by the factor said when one is (`half as visible` 0.5 of its
1956
+ * strength). Words of transparency count the other way: more transparent
1957
+ * or see-through is fainter, and `half as transparent` is twice as strong.
1958
+ * Null when the ask says nothing of visibility. The one reader the border
1959
+ * answers share.
1960
+ * @param {string} text
1961
+ * @returns {{stronger: boolean, by: number | null} | null}
1962
+ */
1963
+ export function visibilityAsk(text) {
1964
+ const t = text.toLowerCase();
1965
+ const SEE = '(?:transparent|translucent|see-through|see through)';
1966
+ const SHOW = '(?:visible|noticeable|prominent|obvious|pronounced|strong)';
1967
+ const by = exactFactor(t);
1968
+ if (new RegExp(`\\b${SEE}\\b`).test(t)) {
1969
+ // "less transparent", "half as transparent": stronger; "more
1970
+ // transparent", "twice as transparent": fainter.
1971
+ const less = new RegExp(
1972
+ `\\bless ${SEE}\\b|\\bhalf as ${SEE}\\b|\\bnot as ${SEE}\\b`,
1973
+ ).test(t);
1974
+ const factor =
1975
+ by != null && by > 0
1976
+ ? less
1977
+ ? by < 1
1978
+ ? 1 / by
1979
+ : by
1980
+ : by > 1
1981
+ ? 1 / by
1982
+ : by
1983
+ : null;
1984
+ return {stronger: less, by: factor};
1985
+ }
1986
+ if (/\bmore opaque\b|\bopaquer\b/.test(t)) return {stronger: true, by};
1987
+ if (/\bless opaque\b/.test(t)) return {stronger: false, by};
1988
+ if (
1989
+ new RegExp(
1990
+ `\\b${SHOW}\\b|\\binvisible\\b|\\bfaint(?:er)?\\b|\\bsubtler\\b|\\bweaker\\b`,
1991
+ ).test(t)
1992
+ ) {
1993
+ const fainter =
1994
+ new RegExp(
1995
+ `\\b(?:less|half as|barely|hardly|not as|a lot less|much less) ${SHOW}\\b|\\binvisible\\b|\\bfaint(?:er)?\\b|\\bsubtler\\b|\\bweaker\\b`,
1996
+ ).test(t) && !new RegExp(`\\b(?:twice|\\d+ times) as ${SHOW}\\b`).test(t);
1997
+ return {stronger: !fainter, by};
1998
+ }
1999
+ return null;
2000
+ }
2001
+
1780
2002
  /**
1781
2003
  * An exact relative amount the words give ("half", "double", "twice",
1782
2004
  * "triple", "a third", "a quarter", "50%", "x0.8"), as a factor of the
@@ -2010,7 +2232,7 @@ export function partLexicon(ctx) {
2010
2232
  ...Object.keys(HUES).filter(w => w.length >= 5 && !PALETTE_NAMES.has(w)),
2011
2233
  ...[...project.target.keys()]
2012
2234
  .filter(key => !key.includes('-'))
2013
- .flatMap(key => [key, `${key}s`]),
2235
+ .flatMap(key => [key, pluralOf(key)]),
2014
2236
  ]),
2015
2237
  ];
2016
2238
  // Every group the editor knows, by its own name ("checks", "inputs"),
@@ -2210,7 +2432,11 @@ const STATE_WORDS = /** @type {Array<[RegExp, string]>} */ ([
2210
2432
  [/\b(hover(ed|ing)?|mouse ?over)\b/, 'hover'],
2211
2433
  [/\b(focus(ed|ing)?|on focus)\b/, 'focus'],
2212
2434
  [/\b(disabled|inactive)\b/, 'disabled'],
2213
- [/\b(checked|ticked|when on|turned on|toggled on|is on)\b/, 'checked'],
2435
+ // (A switch's "on color", "on state": its checked look.)
2436
+ [
2437
+ /\b(checked|ticked|when on|turned on|toggled on|is on|on[- ](?:colou?r|state|look))\b/,
2438
+ 'checked',
2439
+ ],
2214
2440
  [
2215
2441
  /\b(selected|active (tab|nav|item|link|page))\b|\bactive\b(?=.*\b(nav|tab|item)\b)/,
2216
2442
  'selected',
@@ -2225,7 +2451,11 @@ const STATE_WORDS = /** @type {Array<[RegExp, string]>} */ ([
2225
2451
  [/\b(after i check|once checked|i check)\b/, 'checked'],
2226
2452
  [/\b(picked|chosen|choose|pick)\b/, 'selected'],
2227
2453
  [/\b(invalid|errors? state|has an error|with an error)\b/, 'invalid'],
2228
- [/\bvisited\b/, 'visited'],
2454
+ // ("after visiting", "once you've been there": the visited look.)
2455
+ [
2456
+ /\b(visited|(?:after|once|when) (?:i'?ve |you'?ve |they'?ve )?(?:visiting|visited|been (?:there|clicked)))\b/,
2457
+ 'visited',
2458
+ ],
2229
2459
  // ("The open select", "when open": a part shown open.)
2230
2460
  [
2231
2461
  /\bopened\b|\b(?:when|while|once|if) (?:it'?s |they'?re |it is |they are )?open\b|\bthe open\b/,
@@ -2247,6 +2477,7 @@ const STATE_WORDS = /** @type {Array<[RegExp, string]>} */ ([
2247
2477
  /\b(unchecked|not checked|unticked|when off|turned off|toggled off|switched off|is off)\b/,
2248
2478
  'unchecked',
2249
2479
  ],
2480
+ [/\b(unselected|not selected|non-selected)\b/, 'unselected'],
2250
2481
  ]);
2251
2482
 
2252
2483
  /**
@@ -2365,7 +2596,11 @@ function aspectsOf(text) {
2365
2596
  add('case');
2366
2597
  if (/\bitalics?\b/.test(c)) add('italic');
2367
2598
  if (
2368
- /\b(bold(er)?|unbold\w*|weight|heav(y|ier)|semibold)\b/.test(c) ||
2599
+ // ("heavy shadows", "a heavy border": how strong a shadow or line
2600
+ // is, never a font weight.)
2601
+ /\b(bold(er)?|unbold\w*|weight|heav(y|ier)(?!\s+(?:drop\s+|box\s+)?(?:shadows?|borders?|lines?|outlines?))|semibold)\b/.test(
2602
+ c,
2603
+ ) ||
2369
2604
  // "body 16px regular": a weight word after a size.
2370
2605
  /\b\d+(\.\d+)?(px|rem|em|pt) (regular|normal|medium)\b|\b(body|text|headings?) (regular|normal)$/.test(
2371
2606
  c,
@@ -2627,10 +2862,9 @@ function namedLists(q, partWords, isVariant) {
2627
2862
  // ("the checked and disabled checkbox": two states said of one
2628
2863
  // part, both at once, never each.)
2629
2864
  (items.length === 2 &&
2630
- items.every(w => stateWord(w) != null) &&
2865
+ atOnce(items) &&
2631
2866
  /\sand\s/i.test(String(list)) &&
2632
- !/,|\bor\b/i.test(String(list)) &&
2633
- !/s$/i.test(String(noun)))
2867
+ !/,|\bor\b/i.test(String(list)))
2634
2868
  )
2635
2869
  continue;
2636
2870
  // The asks said of the list: up to a full stop or semicolon, an
@@ -2706,11 +2940,10 @@ function namedLists(q, partWords, isVariant) {
2706
2940
  // part, both at once, never each.)
2707
2941
  const bothAtOnce =
2708
2942
  items.length === 2 &&
2709
- items.every(w => stateWord(w) != null) &&
2943
+ atOnce(items) &&
2710
2944
  !/,|\bor\b/i.test(String(list)) &&
2711
2945
  !ones &&
2712
- nounPart != null &&
2713
- !/s$/i.test(next);
2946
+ nounPart != null;
2714
2947
  if (bothAtOnce) return m;
2715
2948
  if (items.every(modifies))
2716
2949
  // (The noun said after the list stays after its last item.)
@@ -2806,9 +3039,7 @@ function clausesOf(q, partWords) {
2806
3039
  const bothStates = tokenLists.replace(
2807
3040
  /\b([a-z]+)\s+and\s+([a-z]+)\s+([a-z][a-z-]*)\b/gi,
2808
3041
  (m, a, b, noun) =>
2809
- stateWord(String(a).toLowerCase()) != null &&
2810
- stateWord(String(b).toLowerCase()) != null &&
2811
- !/s$/i.test(String(noun)) &&
3042
+ atOnce([String(a).toLowerCase(), String(b).toLowerCase()]) &&
2812
3043
  partWords.some(([re]) => re.test(` ${String(noun).toLowerCase()} `))
2813
3044
  ? `${a} & ${b} ${noun}`
2814
3045
  : m,
@@ -2818,14 +3049,22 @@ function clausesOf(q, partWords) {
2818
3049
  /** @type {Array<{text: string, joint: string}>} */
2819
3050
  const pieces = [];
2820
3051
  {
3052
+ // (A generic family after a color, "on black, monospace", starts an
3053
+ // ask of its own: a font stack starts with a family's name, never a
3054
+ // color.)
2821
3055
  const split = (
2822
3056
  /\bswap\b/.test(bothStates)
2823
3057
  ? bothStates.replace(/\band\b/g, '&')
2824
3058
  : sharedAsk(bothStates, partWords)
2825
- ).split(
2826
- // A font stack ("Georgia, serif") is one value, not two asks.
2827
- /(;|\.(?=\s|$)|,(?![^(]*\))(?!\s*(?:serif|sans-serif|monospace|system-ui|cursive|fantasy|ui-[a-z-]+)\b)|\b(?:and|but|then|plus|also|y|et|und|и)\b|(?<!\b(?:tint(?:ed|s)?|paint(?:ed|s)?|wash(?:ed|es)?)(?:\s+[a-z-]+){0,3}\s+)\bwith\b(?!\s+(?:an?\s+)?\d{1,3}(?:\.\d+)?\s?%\s+(?:alpha|opacity|transparency)\b)|\bwhile\b|(?=\bexcept\b))/,
2828
- );
3059
+ )
3060
+ .replace(
3061
+ /([a-z#0-9]+)(\s*),(?=\s*(?:serif|sans-serif|monospace|system-ui|cursive|fantasy)\b)/gi,
3062
+ (m, prev, sp) => (colorsIn(String(prev)).length ? `${prev}${sp};` : m),
3063
+ )
3064
+ .split(
3065
+ // A font stack ("Georgia, serif") is one value, not two asks.
3066
+ /(;|\.(?=\s|$)|,(?![^(]*\))(?!\s*(?:serif|sans-serif|monospace|system-ui|cursive|fantasy|ui-[a-z-]+)\b)|\b(?:and|but|then|plus|also|y|et|und|и)\b|(?<!\b(?:tint(?:ed|s)?|paint(?:ed|s)?|wash(?:ed|es)?)(?:\s+[a-z-]+){0,3}\s+)\bwith\b(?!\s+(?:an?\s+)?\d{1,3}(?:\.\d+)?\s?%\s+(?:alpha|opacity|transparency)\b)|\bwhile\b|(?=\bexcept\b))/,
3067
+ );
2829
3068
  let joint = '';
2830
3069
  for (let k = 0; k < split.length; k++) {
2831
3070
  const piece = split[k] ?? '';
@@ -2862,8 +3101,37 @@ function clausesOf(q, partWords) {
2862
3101
  );
2863
3102
  const cornerWords = /\b(round|corner|radius|shape|circular)/.test(text);
2864
3103
  for (const [re, part] of partWords) {
2865
- const m = re.exec(rest);
3104
+ // (A part word is a word of its own, never one half of a hyphenated
3105
+ // compound, "field-service", "card-like": a match with a letter
3106
+ // joined to it by a hyphen names no part. A part's own name written
3107
+ // with a hyphen, "date-picker", is one match and counts whole.)
3108
+ const all = new RegExp(
3109
+ re.source,
3110
+ re.flags.includes('g') ? re.flags : `${re.flags}g`,
3111
+ );
3112
+ /** @type {RegExpExecArray | null} */
3113
+ let m = null;
3114
+ for (const x of rest.matchAll(all)) {
3115
+ const at = /** @type {number} */ (x.index);
3116
+ if (
3117
+ /[a-z]-$/i.test(rest.slice(0, at)) ||
3118
+ /^-[a-z]/i.test(rest.slice(at + x[0].length))
3119
+ )
3120
+ continue;
3121
+ m = x;
3122
+ break;
3123
+ }
2866
3124
  if (!m) continue;
3125
+ // ("a medical records table view", "the card page": a screen named
3126
+ // by what it shows, never that part.)
3127
+ if (
3128
+ /^\s+(?:views?|pages?|screens?|apps?|dashboards?|layouts?)\b/.test(
3129
+ rest.slice((m.index ?? 0) + m[0].length),
3130
+ )
3131
+ ) {
3132
+ rest = rest.replace(re, ' ');
3133
+ continue;
3134
+ }
2867
3135
  const p = {...part};
2868
3136
  if (p.on === 'heading' && /^h[1-6]$/.test(m[0])) p.level = m[1];
2869
3137
  // "the error banner": one status of the banner.
@@ -2874,7 +3142,7 @@ function clausesOf(q, partWords) {
2874
3142
  if (p.on === 'banner' && status)
2875
3143
  p.when = `status:${status === 'danger' ? 'error' : status}`;
2876
3144
  parts.push(p);
2877
- rest = rest.replace(re, ' ');
3145
+ rest = `${rest.slice(0, m.index)} ${rest.slice(/** @type {number} */ (m.index) + m[0].length)}`;
2878
3146
  }
2879
3147
  // "the sidebar the page color", "the header the card color", "cards
2880
3148
  // the color of the page": a part named as its color after another part
@@ -3112,6 +3380,12 @@ function clausesOf(q, partWords) {
3112
3380
  // "transparent" inside color-mix() asks for no see-through fill.
3113
3381
  const aspects0 = aspectsOf(
3114
3382
  (groundSaid ? text.replace(groundSaid, ' ') : text)
3383
+ // ("the text on the gradient": where the text sits, never what
3384
+ // changes.)
3385
+ .replace(
3386
+ /\b(text|labels?|writing|words)\s+on\s+(?:the\s+|a\s+|an\s+)?[a-z-]+\b/g,
3387
+ '$1',
3388
+ )
3115
3389
  .replace(
3116
3390
  refSaid ? new RegExp(`\\b${refSaid}\\b(?=\\S*\\s+colou?r)`) : /$^/,
3117
3391
  ' ',
@@ -3358,7 +3632,7 @@ function clausesOf(q, partWords) {
3358
3632
  named: namedProperty(text),
3359
3633
  neg,
3360
3634
  dir,
3361
- colors: colorsIn(text),
3635
+ colors: colorsIn(withoutColorNow(text)),
3362
3636
  bad: badHex(text),
3363
3637
  // A typed clamp() or calc() is a length, kept whole.
3364
3638
  lengths: [
@@ -3391,13 +3665,26 @@ export function namedProperty(text) {
3391
3665
  for (const m of flat.matchAll(
3392
3666
  /\b((?:border|outline)(?: (?:top|right|bottom|left))? (?:colou?r|width|style)|(?:min|max) (?:height|width)|line height|letter spacing|font (?:size|weight)|radius|[a-z]+(?:-[a-z]+)+|[a-z]+)(\s*:)?\s*/g,
3393
3667
  )) {
3394
- const prop =
3668
+ const prop0 =
3395
3669
  PROPERTY_WORDS[m[1]] ??
3396
3670
  (/^(border|outline)( (top|right|bottom|left))? (colou?r|width|style)$/.test(
3397
3671
  m[1],
3398
3672
  )
3399
3673
  ? m[1].replace(/colour/, 'color').replace(/ /g, '-')
3400
3674
  : m[1]);
3675
+ // ("bottom border 1px #49454f": the side said before it is the side's.)
3676
+ const sideBefore = /\b(top|right|bottom|left)\s+$/.exec(
3677
+ flat.slice(0, m.index ?? 0),
3678
+ )?.[1];
3679
+ const prop =
3680
+ sideBefore && /^(border|outline)$/.test(prop0)
3681
+ ? `${prop0}-${sideBefore}`
3682
+ : prop0;
3683
+ // ("1px border rgba(0 0 0 / 0.2)": a width said before it is its own.)
3684
+ const lenBefore =
3685
+ /(?:^|\s)(\d*\.?\d+(?:px|rem|em))\s+(?:(?:top|right|bottom|left)\s+)?$/.exec(
3686
+ flat.slice(0, m.index ?? 0),
3687
+ )?.[1];
3401
3688
  // A property word right after another one ("border width") is part of
3402
3689
  // it, never a property of its own.
3403
3690
  if (
@@ -3467,7 +3754,16 @@ export function namedProperty(text) {
3467
3754
  // A value that drops typed words is not the one asked for: "border
3468
3755
  // 0 0 2px" is not "border 0".
3469
3756
  if (n < tokens.length && /^[-.\d#]/.test(tokens[n] ?? '')) break;
3470
- return completeShorthand(prop, value);
3757
+ const done = completeShorthand(prop, value);
3758
+ if (
3759
+ lenBefore &&
3760
+ /^(border|outline)(-(top|right|bottom|left))?-color$/.test(done.prop)
3761
+ )
3762
+ return {
3763
+ prop: done.prop.replace(/-color$/, ''),
3764
+ value: `${lenBefore} solid ${done.value}`,
3765
+ };
3766
+ return done;
3471
3767
  }
3472
3768
  }
3473
3769
  return null;
@@ -3727,6 +4023,59 @@ function oneModeLine(C, TARGET, part, width, color, mode, state) {
3727
4023
  return {value: `inset 0 0 0 ${width} ${half}${own}`, when: flat};
3728
4024
  }
3729
4025
 
4026
+ /** @type {WeakMap<object, (text: string) => boolean>} */
4027
+ const STRIPE_NAMES = new WeakMap();
4028
+ /**
4029
+ * Whether words name a table's stripes, read from the doc of the prop that
4030
+ * turns them on: the prop whose description names the `parity` a row's
4031
+ * stripe is, whose description leads with the stripes' plain names
4032
+ * ("Stripes alternate rows (every other row, zebra striping): …"). A name
4033
+ * matches by its words no other prop of that component uses, or, when all its
4034
+ * words are common ("every other row"), as the whole phrase.
4035
+ * @param {{components?: Record<string, any>}} project
4036
+ * @returns {(text: string) => boolean}
4037
+ */
4038
+ function stripeNamesOf(project) {
4039
+ const known = STRIPE_NAMES.get(project);
4040
+ if (known) return known;
4041
+ /** @param {string} t */
4042
+ const wordsOf = t =>
4043
+ String(t)
4044
+ .toLowerCase()
4045
+ .match(/[a-z][a-z-]*/g) ?? [];
4046
+ /** @type {RegExp[]} */
4047
+ const names = [];
4048
+ for (const info of Object.values(project.components ?? {})) {
4049
+ const props = Object.values(info?.props ?? {});
4050
+ const flag = props.find(pr =>
4051
+ /`parity`/.test(String(pr?.description ?? '')),
4052
+ );
4053
+ if (!flag) continue;
4054
+ const others = new Set(
4055
+ props.filter(pr => pr !== flag).flatMap(pr => wordsOf(pr?.description)),
4056
+ );
4057
+ const lead = String(flag.description).split(':')[0];
4058
+ for (const phrase of lead
4059
+ .split(/[(),]/)
4060
+ .map(x => x.trim())
4061
+ .filter(Boolean)) {
4062
+ const words = wordsOf(phrase);
4063
+ const own = words.filter(w => !others.has(w));
4064
+ names.push(
4065
+ own.length
4066
+ ? new RegExp(`\\b(?:${own.join('|')})\\b`)
4067
+ : new RegExp(
4068
+ `\\b${words.map(w => w.replace(/s$/, '')).join('s?\\s+')}s?\\b`,
4069
+ ),
4070
+ );
4071
+ }
4072
+ }
4073
+ /** @param {string} text */
4074
+ const test = text => names.some(re => re.test(String(text).toLowerCase()));
4075
+ STRIPE_NAMES.set(project, test);
4076
+ return test;
4077
+ }
4078
+
3730
4079
  /**
3731
4080
  * Answer a plain-words question with drafts of commands.
3732
4081
  * @param {import('./_settings.mjs').Ctx} ctx
@@ -3735,8 +4084,22 @@ function oneModeLine(C, TARGET, part, width, color, mode, state) {
3735
4084
  * @returns {{parts: string[], aspects: string[], drafts: Draft[]}}
3736
4085
  */
3737
4086
  export function draftAnswer(ctx, env, question) {
3738
- // (The words as asked, for the readers that hold the whole question.)
3739
- const asked0 = String(question).toLowerCase();
4087
+ // The theme's own neutral, as its seed is set: what a near color off a
4088
+ // pure one is tinted with, so it reads as the theme's (none: a plain
4089
+ // near-black or near-white).
4090
+ const themeNeutral = parseColor(
4091
+ String(
4092
+ (env.data?.settings ?? []).find(
4093
+ (/** @type {any} */ x) =>
4094
+ x.source === 'dial' && x.thing === 'neutral' && !x.on && !x.mode,
4095
+ )?.value ?? '',
4096
+ ),
4097
+ );
4098
+ // (The words as asked, for the readers that hold the whole question;
4099
+ // their case too, which carries tone: an emphatic "SO" in a lowercase
4100
+ // line.)
4101
+ const raw0 = String(question);
4102
+ const asked0 = raw0.toLowerCase();
3740
4103
  // "darkmode", "dark-mode": one spelling of a mode before any clause is
3741
4104
  // read, so every reader that names a mode sees it.
3742
4105
  // One mode grammar: every way of naming a mode is read here as "dark
@@ -3780,6 +4143,17 @@ export function draftAnswer(ctx, env, question) {
3780
4143
  // color the answer writes is held to (after the answers are made), never
3781
4144
  // the color asked for nor a clause of its own, so it is read out of the
3782
4145
  // words here.
4146
+ // "navy, not bright blue": a color said against the one it replaces is
4147
+ // the first color alone, never a prohibition of its own.
4148
+ question = question.replace(
4149
+ /(\S+)\s*,?\s*(?:and\s+|but\s+)?not\s+((?:[a-z]+\s+)?(?:[a-z]+|#[0-9a-f]{3,8}))(?=\s*(?:[,;.!?]|$))/gi,
4150
+ (m, first, second) =>
4151
+ colorsIn(first).length &&
4152
+ colorsIn(String(second).split(/\s+/).pop() ?? '').length
4153
+ ? first
4154
+ : m,
4155
+ );
4156
+ question = withoutLooksNow(question);
3783
4157
  const colorBound = colorBoundOf(question);
3784
4158
  if (colorBound)
3785
4159
  question = question
@@ -3892,6 +4266,241 @@ export function draftAnswer(ctx, env, question) {
3892
4266
  /\b(?:that\s+|which\s+)?(?:works|looks good|holds up|also works|is usable|works well)\s+in\s+(?:both\s+)?(?:dark|light)(?:\s+(?:and|&)\s+(?:dark|light))?\s+modes?\b/gi,
3893
4267
  ' ',
3894
4268
  )
4269
+ // ("green text on a black page": the text's color and the page's, each
4270
+ // its own, as "a black page with green text" says it. "green text on
4271
+ // black", with the ground's noun left out at the end of its clause, is
4272
+ // the same: the color under text is the page's.)
4273
+ .replace(
4274
+ /\b((?:[a-z]+\s+)?(?:[a-z]+|#[0-9a-f]{3,8}))\s+(text|writing|type)\s+on\s+(?:(?:a|an|the)\s+((?:[a-z]+\s+)?(?:[a-z]+|#[0-9a-f]{3,8}))\s+(page|background|surface)\b|((?:[a-z]+|#[0-9a-f]{3,8}))(?=\s*(?:[,;.!?]|$)))/gi,
4275
+ (m, ink, _t, under, ground, bare) =>
4276
+ colorsIn(String(ink).toLowerCase()).length &&
4277
+ colorsIn(String(under ?? bare).toLowerCase()).length
4278
+ ? `${under ?? bare} ${ground ?? 'page'} background, ${ink} text`
4279
+ : m,
4280
+ )
4281
+ // ("a frosted glass look", "glass cards", "translucent with a blur":
4282
+ // the glass rung of the surfaces dial.)
4283
+ .replace(
4284
+ /\b(?:frosted(?:\s+glass)?|glassy|glass(?:morphism)?)(?:\s+(?:look|effect|style|surfaces?|cards?|panels?))?\b|\btranslucent\s+with\s+(?:a\s+)?blur\b/gi,
4285
+ 'make the surfaces glass',
4286
+ )
4287
+ .replace(
4288
+ /\b(?:make\s+)?(?:the\s+)?(?:cards?|panels?|surfaces?)\s+make the surfaces glass\b/gi,
4289
+ 'make the surfaces glass',
4290
+ )
4291
+ // ("tight dense spacing": the rung said wins over the way.)
4292
+ .replace(
4293
+ /\b(tight|compact|roomy|spacious)\s+(?:and\s+)?(?:dense|denser|airy|airier|loose|looser)\b|\b(?:dense|denser|airy|airier|loose|looser)\s+(?:and\s+)?(tight|compact|roomy|spacious)\b/gi,
4294
+ (_m, a, b) => a ?? b,
4295
+ )
4296
+ // ("gridlines": a table's cell borders.)
4297
+ .replace(
4298
+ /\b(?:show\s+)?grid\s?lines?(?:\s+(?:between|on|in)\s+(?:the\s+)?table\s+cells)?\b/gi,
4299
+ '1px border on table cells',
4300
+ )
4301
+ // ("big buttons" said alone: bigger; "the large buttons 4px taller"
4302
+ // names their size.)
4303
+ .replace(
4304
+ /(^|[,;:]\s*|\band\s+)(?:make\s+(?:the\s+)?)?(big|large|huge)\s+(buttons?|inputs?|controls?)\s*(?=$|[,;.]|\band\b)/gi,
4305
+ '$1bigger $3',
4306
+ )
4307
+ // ("luxury fashion brand: black and ivory": a lead naming what the
4308
+ // theme is for, never the brand color itself.)
4309
+ .replace(/\b(?:brand|company|startup|business)\s*:/gi, 'theme:')
4310
+ // ("headings semibold, not bold": the rung said, and the one it is
4311
+ // set against; never a second ask.)
4312
+ .replace(
4313
+ /\b(thin|light|regular|normal|medium|semibold|semi-bold|bold|heavy|black|extra-?bold)\b([^,;.]*?)[,;]?\s*(?:(?:but\s+)?not|instead\s+of|rather\s+than)\s+(?:too\s+)?(?:thin|light|regular|normal|medium|semibold|semi-bold|bold|heavy|black|extra-?bold)\b/gi,
4314
+ '$1$2',
4315
+ )
4316
+ // ("lots of data on screen", "information-dense": the theme denser.)
4317
+ .replace(
4318
+ /\b(?:lots|a lot|plenty) of (?:data|information|info|content|rows|things) (?:on|per) (?:the )?(?:screen|page)\b|\binformation[- ]dense\b|\bdata[- ]dense\b|\bfit more (?:on|per) (?:the )?(?:screen|page)\b/gi,
4319
+ 'more compact',
4320
+ )
4321
+ // ("red only for alerts", "red reserved for errors": the danger color,
4322
+ // every error, alert and destructive look; never every banner.)
4323
+ .replace(
4324
+ /\b((?:[a-z]+\s+)?[a-z]+|#[0-9a-f]{3,8})\s+(?:only|just|reserved)\s+for\s+(?:the\s+)?(?:alerts?|errors?|danger|destructive(?:\s+actions?)?|warnings? and errors?)\b/gi,
4325
+ (m, color) =>
4326
+ colorsIn(String(color).toLowerCase()).length
4327
+ ? `danger color ${color}`
4328
+ : m,
4329
+ )
4330
+ // ("bigger, bolder headings": ways listed before one part are all its.)
4331
+ .replace(
4332
+ /\b(bigger|larger|smaller|bolder|lighter|darker|rounder|wider|taller|softer|brighter)\s*,\s*(?:and\s+)?(bigger|larger|smaller|bolder|lighter|darker|rounder|wider|taller|softer|brighter)\s+(?=[a-z])/gi,
4333
+ '$1 $2 ',
4334
+ )
4335
+ // ("dark purple theme", "moody dark purple": dark said of a whole look
4336
+ // with a hue is the dark mode and that hue as the accent; "dark purple
4337
+ // buttons" stays a shade.)
4338
+ .replace(
4339
+ /\b(dark|light)\s+([a-z]+)(?=\s+(?:theme|look|vibe|aesthetic|palette)\b|\s*(?:[,;:]|$))/gi,
4340
+ (m, mode, hue, at, whole) =>
4341
+ Object.hasOwn(HUES, String(hue).toLowerCase()) &&
4342
+ // (A whole look: no part named anywhere in the ask.)
4343
+ !partLexicon(ctx).parts.some(([re]) =>
4344
+ re.test(` ${String(whole).toLowerCase()} `),
4345
+ ) &&
4346
+ !/\b(?:text|backgrounds?|borders?|fills?|colou?r of)\b/i.test(
4347
+ String(whole),
4348
+ )
4349
+ ? `${mode} theme with ${hue} accent`
4350
+ : m,
4351
+ )
4352
+ // ("deeper blue": a dark shade of the hue.)
4353
+ .replace(/\b(?:deeper|richer)\s+(?=([a-z]+)\b)/gi, (m, hue) =>
4354
+ Object.hasOwn(HUES, String(hue).toLowerCase()) ? 'dark ' : m,
4355
+ )
4356
+ // ("easy to read at night", "for reading at night": a dark mode by
4357
+ // default, and larger text for "easy to read".)
4358
+ .replace(
4359
+ /\b(?:at|for|during the)\s+night(?:time)?\b/gi,
4360
+ ', dark by default',
4361
+ )
4362
+ .replace(/\b(?:easy|easier|comfortable)\s+to\s+read\b/gi, 'larger text')
4363
+ // ("off-white", "ink blue", "grass green", "safety orange", "slate
4364
+ // blue-gray": a color named in two words is one name in the table.)
4365
+ .replace(/\boff[- ]white\b/gi, 'offwhite')
4366
+ .replace(/\bink[- ]blue\b/gi, 'inkblue')
4367
+ .replace(/\bgrass[- ]green\b/gi, 'grassgreen')
4368
+ .replace(/\bsafety[- ]orange\b/gi, 'safetyorange')
4369
+ .replace(/\b(?:slate\s+)?blue[- ]gr[ae]y\b/gi, 'bluegray')
4370
+ // ("pure white", "true black": that exact color, never a shade.)
4371
+ .replace(
4372
+ /(?<!\bnot\s)\b(?:pure|true|plain|solid)\s+(white|black)\b/gi,
4373
+ (_m, w) => (String(w).toLowerCase() === 'white' ? '#ffffff' : '#000000'),
4374
+ )
4375
+ // ("amber for warnings", "red only for alerts": the role color.)
4376
+ .replace(
4377
+ /\b((?:[a-z]+\s+)?[a-z]+|#[0-9a-f]{3,8})\s+(?:only\s+|just\s+)?(?:for|reserved for|on)\s+(?:the\s+|all\s+)?(warnings?|success(?:es)?|info(?:rmation)?|notices?)\b/gi,
4378
+ (m, color, role, at, whole) => {
4379
+ // (Only a color said alone for the role, "amber for warnings":
4380
+ // "red text on the info banner" is the banner's text, in its info
4381
+ // look, never the info color.)
4382
+ const words = String(color).toLowerCase().split(/\s+/);
4383
+ const colorAlone = words.every(
4384
+ w =>
4385
+ colorsIn(w).length ||
4386
+ /^(?:light|dark|pale|deep|soft|bright|warm|cool|muted|vivid|rich|pastel)$/.test(
4387
+ w,
4388
+ ),
4389
+ );
4390
+ const next = String(whole)
4391
+ .slice(Number(at) + m.length)
4392
+ .toLowerCase();
4393
+ const partFollows = partLexicon(ctx).parts.some(([re]) =>
4394
+ re.test(
4395
+ ` ${next
4396
+ .split(/[,;.:]/)[0]
4397
+ .trim()
4398
+ .split(/\s+/)
4399
+ .slice(0, 3)
4400
+ .join(' ')} `,
4401
+ ),
4402
+ );
4403
+ if (
4404
+ !colorAlone ||
4405
+ partFollows ||
4406
+ !colorsIn(String(color).toLowerCase()).length
4407
+ )
4408
+ return m;
4409
+ return `${/^warn/i.test(role) ? 'warning' : /^succ/i.test(role) ? 'success' : 'info'} color ${color}`;
4410
+ },
4411
+ )
4412
+ // ("make it brighter and more cheerful": a livelier, more colorful
4413
+ // theme.)
4414
+ .replace(
4415
+ /\bmore\s+(?:cheerful|lively|vibrant|joyful|fun)\b|\b(?:cheerful|lively|joyful)\b/gi,
4416
+ 'more colorful',
4417
+ )
4418
+ // ("tailwind shadow-sm"): the shadow sizes by their class names.
4419
+ .replace(/\bshadow-(?:xs|sm)\b/gi, 'small shadow')
4420
+ .replace(/\bshadow-(?:lg|xl|2xl)\b/gi, 'large shadow')
4421
+ .replace(/\bshadow-md\b/gi, 'medium shadow')
4422
+ // ("divided by 1px lines", "separated by thin lines": lines between,
4423
+ // never an amount.)
4424
+ .replace(/\b(?:divided|separated)\s+by\s+/gi, 'with ')
4425
+ // ("be a #e8def8 pill": a fill of that color, pill-shaped.)
4426
+ .replace(
4427
+ /\b(?:(?:should|must|to)\s+)?(?:be\s+)?an?\s+(#[0-9a-f]{3,8}|[a-z]+)\s+(pill|capsule)\b/gi,
4428
+ (m, color) =>
4429
+ colorsIn(String(color).toLowerCase()).length
4430
+ ? `with a ${color} background and pill corners`
4431
+ : m,
4432
+ )
4433
+ // ("big touch targets": the controls a finger presses.)
4434
+ .replace(
4435
+ /\b(?:big|bigger|large|larger)\s+touch\s+targets?\b/gi,
4436
+ 'more spacing on buttons and inputs',
4437
+ )
4438
+ .replace(/\btouch\s+targets?\b/gi, 'buttons and inputs')
4439
+ .replace(
4440
+ /\brows?\s+(?:in|of)\s+(?:the\s+|a\s+)?(menus?|dropdowns?|lists?|selects?)\b/gi,
4441
+ '$1 items',
4442
+ )
4443
+ // ("an off-white paper background": the page, in that color; "a paper
4444
+ // background": the page, paper-colored.)
4445
+ .replace(
4446
+ /\b(#[0-9a-f]{3,8}|[a-z]+)\s+paper\s+(?=background|page)/gi,
4447
+ (m, color) =>
4448
+ colorsIn(String(color).toLowerCase()).length ? `${color} page ` : m,
4449
+ )
4450
+ .replace(/\bpaper\s+(?=background\b)/gi, 'paper page ')
4451
+ // ("32px menu items", "40px rows": a length before an item noun is its
4452
+ // height.)
4453
+ .replace(
4454
+ /\b(\d+(?:\.\d+)?px)\s+((?:menu |list |table )?(?:items?|rows?))\b(?!\s+(?:tall|high|height|padding|gap|spacing))/gi,
4455
+ '$2 $1 tall',
4456
+ )
4457
+ // ("dividers between list items", "table rows with 1px lines": a line
4458
+ // between items is each one's bottom border.)
4459
+ .replace(
4460
+ /\b(?:dividers?|lines?|rules?|separators?)\s+between\s+(?:the\s+)?((?:[a-z]+\s+)?(?:items?|rows?))\b/gi,
4461
+ '1px bottom border on $1',
4462
+ )
4463
+ .replace(
4464
+ /\b((?:[a-z]+\s+)?(?:items?|rows?))\s+with\s+(?:an?\s+)?(\d+px\s+)?(?:thin\s+)?(?:lines?|dividers?|rules?|separators?)\b/gi,
4465
+ (_m, what, w) =>
4466
+ `${w ? String(w).trim() : '1px'} bottom border on ${what}`,
4467
+ )
4468
+ // ("32px rows in the menu", "dividers between list rows": a menu's or a
4469
+ // list's rows are its items.)
4470
+ .replace(
4471
+ /\brows?\s+(?:in|of)\s+(?:the\s+|a\s+)?(menus?|dropdowns?|lists?|selects?)\b/gi,
4472
+ '$1 items',
4473
+ )
4474
+ .replace(/\b(menu|dropdown|list)\s+rows?\b/gi, '$1 items')
4475
+ // ("make it calmer", "a calm dark mode": with no part named, the theme
4476
+ // less vivid.)
4477
+ // ("make it calmer", "calmer colors", "a calm dark mode": the theme's
4478
+ // colors less vivid. Vibrancy has no mode of its own, so a mode said
4479
+ // with it is the theme's.)
4480
+ .replace(
4481
+ /\bmake\s+(?:it|everything|the\s+(?:theme|colou?rs|palette|app))\s+(?:a\s+(?:bit|little)\s+|slightly\s+|much\s+)?(?:calm|calmer|quieter)\b|\b(?:calm|calmer|quieter)\s+(?:(?:dark|light)\s+mode|colou?rs|palette)\b/gi,
4482
+ 'less saturated',
4483
+ )
4484
+ // ("bold safety orange #ea580c accent": a word about the color itself,
4485
+ // said before the color an accent is.)
4486
+ .replace(
4487
+ /\b(?:bold|bright|vivid|strong|punchy)\s+(?=(?:[a-z]+\s+)?(?:[a-z]+|#[0-9a-f]{3,8})\s+(?:#[0-9a-f]{3,8}\s+)?accent\b)/gi,
4488
+ '',
4489
+ )
4490
+ // ("a 2px dark border": the theme's stronger line color, its emphasized
4491
+ // border, at that width; "darker" is a way, read by the way readers.)
4492
+ .replace(
4493
+ /\b(?:(\d+(?:\.\d+)?px)\s+)?(?:dark|strong)\s+(borders?|outlines?)\b/gi,
4494
+ (_m, w, what) =>
4495
+ `${String(what).replace(/s$/, '')} ${w ?? '1px'} solid var(--color-border-emphasized)`,
4496
+ )
4497
+ // ("use the system font": the font named, never a part called so.)
4498
+ .replace(
4499
+ /\b(?:use|using|with|switch to|go with)\s+(?:the|a)\s+(system|serif|sans-serif|sans|monospace|mono|rounded|display)\s+(font|typeface|type)\b/gi,
4500
+ '$1 $2',
4501
+ )
4502
+ // ("dark mode first", "dark first": the mode the app opens in.)
4503
+ .replace(/\b(dark|light)(?:\s+mode)?\s+first\b/gi, '$1 mode by default')
3895
4504
  // ("almost square", "nearly square": a rung short of square, the
3896
4505
  // small corners.)
3897
4506
  .replace(
@@ -3936,9 +4545,90 @@ export function draftAnswer(ctx, env, question) {
3936
4545
  const {C} = ctx;
3937
4546
  const TARGET = ctx.project.target;
3938
4547
  const TOKENS = ctx.project.core.tokenDefaults;
4548
+ // "--brand-primary: #4f46e5; --brand-bg: #f9fafb": a custom property of
4549
+ // the app's own (no token of the editor's) is read by its last word, the
4550
+ // role it names, never by every word of its name.
4551
+ question = question.replace(
4552
+ /--([a-z][a-z0-9]*(?:-[a-z0-9]+)*?)-(primary|accent|brand|bg|background|surface|page|text|fg|foreground|radius|border|muted|secondary)(?![\w-])\s*:?\s*/gi,
4553
+ (m, pre, role) => {
4554
+ if (Object.hasOwn(TOKENS, `--${pre}-${role}`.toLowerCase())) return m;
4555
+ const said = /** @type {Record<string, string>} */ ({
4556
+ primary: 'accent ',
4557
+ accent: 'accent ',
4558
+ brand: 'accent ',
4559
+ bg: 'page background ',
4560
+ background: 'page background ',
4561
+ page: 'page background ',
4562
+ surface: 'card background ',
4563
+ text: 'text ',
4564
+ fg: 'text ',
4565
+ foreground: 'text ',
4566
+ radius: 'corners ',
4567
+ border: 'border color ',
4568
+ muted: 'secondary text ',
4569
+ secondary: 'secondary text ',
4570
+ })[String(role).toLowerCase()];
4571
+ return said ?? m;
4572
+ },
4573
+ );
3939
4574
  /** A part's rest color read, with the project's tokens. @param {Array<{token: string, when: string[]}>} reads @param {string} [when] */
3940
4575
  const restRead = (reads, when) => restColorRead(reads, when, TOKENS);
3941
4576
  const lex = partLexicon(ctx);
4577
+ // "make the blue a bit darker": a color named as the theme's own, with a
4578
+ // way, is the theme color whose hue it is (the accent when the accent is
4579
+ // blue), never a part.
4580
+ {
4581
+ /** @param {string} tok @returns {string} */
4582
+ const roleNow = tok => {
4583
+ let v = String(
4584
+ env.own?.light?.[tok] ?? env.base.light?.[tok] ?? TOKENS[tok] ?? '',
4585
+ );
4586
+ for (let i = 0; i < 4; i++) {
4587
+ const ref = /^var\(\s*(--[a-z0-9-]+)\s*\)$/i.exec(v.trim())?.[1];
4588
+ if (!ref) break;
4589
+ v = String(
4590
+ env.own?.light?.[ref] ?? env.base.light?.[ref] ?? TOKENS[ref] ?? '',
4591
+ );
4592
+ }
4593
+ return v;
4594
+ };
4595
+ const ROLES = /** @type {Array<[string, string]>} */ ([
4596
+ ['--color-accent', 'accent color'],
4597
+ ['--color-error', 'danger color'],
4598
+ ['--color-success', 'success color'],
4599
+ ['--color-warning', 'warning color'],
4600
+ ['--color-info', 'info color'],
4601
+ ]);
4602
+ question = question.replace(
4603
+ /\bthe\s+([a-z]+)\b(?=\s+(?:color\s+)?(?:a\s+(?:bit|little|touch)\s+|slightly\s+|much\s+|way\s+)?(?:darker|lighter|brighter|deeper|softer|warmer|cooler|calmer|duller|bolder|more\s+[a-z]+|less\s+[a-z]+)\b)/gi,
4604
+ (m, name) => {
4605
+ const word = String(name).toLowerCase();
4606
+ if (lex.parts.some(([re]) => re.test(` ${word} `))) return m;
4607
+ const said = colorsIn(word)[0];
4608
+ const h = said ? hueOf(said) : null;
4609
+ if (h == null) return m;
4610
+ const near = ROLES.map(([tok, label]) => {
4611
+ const hr = hueOf(roleNow(tok));
4612
+ const d =
4613
+ hr == null
4614
+ ? 999
4615
+ : Math.min(Math.abs(hr - h), 360 - Math.abs(hr - h));
4616
+ return {label, d};
4617
+ }).sort((a, b) => a.d - b.d)[0];
4618
+ return near && near.d <= 30 ? `the ${near.label}` : m;
4619
+ },
4620
+ );
4621
+ }
4622
+ // "17px like iOS": a value said with where it comes from; a name after
4623
+ // "like" that is no part of the editor's is the source, never words to
4624
+ // read.
4625
+ question = question.replace(
4626
+ /(\d(?:px|rem|em|pt)?)\s+(?:just\s+)?like\s+(?:on\s+|in\s+)?([a-z][a-z0-9.]*)\b/gi,
4627
+ (m, v, name) =>
4628
+ lex.parts.some(([re]) => re.test(` ${String(name).toLowerCase()} `))
4629
+ ? m
4630
+ : v,
4631
+ );
3942
4632
 
3943
4633
  // "focus-ring", "table_row": a word of the editor's vocabulary written
3944
4634
  // with hyphens or underscores reads as the same words with spaces, for
@@ -4446,6 +5136,61 @@ export function draftAnswer(ctx, env, question) {
4446
5136
  : `${level} font size calc(${Number(f.toFixed(3))} * var(${tok}))`;
4447
5137
  },
4448
5138
  )
5139
+ // "the hovered item of menus blue and the disabled one gray": "the
5140
+ // disabled one" is the element named, in its place, never the place.
5141
+ .replace(
5142
+ /\b([a-z]+)\s+((?:of|in|inside|within)\s+(?:the\s+)?[a-z]+)\b([^,;.\n]*?)\band the (active|selected|current|disabled|hovered|focused|checked|open) ones?\b/gi,
5143
+ (m, noun, place, mid, st) => {
5144
+ const w = String(noun).toLowerCase().replace(/s$/, '');
5145
+ // (A part's own word, or the last word of a part's name: a menu's
5146
+ // item.)
5147
+ const isPart =
5148
+ lex.parts.some(([re]) => re.test(` ${w} `)) ||
5149
+ [...ctx.project.target.keys()].some(k => k.endsWith(`-${w}`));
5150
+ return isPart
5151
+ ? `${noun} ${place}${mid}and the ${st} ${noun} ${place}`
5152
+ : m;
5153
+ },
5154
+ )
5155
+ // "the selected tab text white and the others gray", "primary buttons
5156
+ // blue and the others gray": the others are the same parts but that
5157
+ // state or variant, read as an except, its own ask.
5158
+ .replace(
5159
+ /^(.*?)\band\s+(?:all\s+)?the\s+(?:others?|rest)\b([^,;.\n]*)/gim,
5160
+ (m, before, after) => {
5161
+ const pairs = [
5162
+ ...String(before).matchAll(
5163
+ /(?=\b([a-z]+)\s+([a-z]+?)(s?)((?:\s+(?:text|background|border|fill|icons?|labels?))?)\b)/gi,
5164
+ ),
5165
+ ].reverse();
5166
+ for (const [, qual, noun, , aspect] of pairs) {
5167
+ const q = String(qual).toLowerCase();
5168
+ const part = lex.parts.find(([re]) =>
5169
+ re.test(` ${String(noun).toLowerCase()} `),
5170
+ )?.[1];
5171
+ if (!part || part.missing) continue;
5172
+ const base = FAMILIES[part.on] ? FAMILIES[part.on][0] : part.on;
5173
+ // (A variant: the part's other values on that axis, each named,
5174
+ // as a list of variants is. A state: the part not in it.)
5175
+ const axis = Object.values(ctx.C.variantValues(base) ?? {}).find(
5176
+ vals => /** @type {string[]} */ (vals).map(String).includes(q),
5177
+ );
5178
+ if (axis) {
5179
+ const rest = /** @type {string[]} */ (axis)
5180
+ .map(String)
5181
+ .filter(v => v !== q && !/^(?:default|md)$/.test(v));
5182
+ if (!rest.length) continue;
5183
+ return [
5184
+ String(before).replace(/[\s,]+$/, ''),
5185
+ ...rest.map(v => `the ${v} ${noun}s${aspect}${after}`),
5186
+ ].join('; ');
5187
+ }
5188
+ if (stateWord(q) == null) continue;
5189
+ return `${String(before).replace(/[\s,]+$/, '')}; the un${q} ${noun}s${aspect}${after}`;
5190
+ }
5191
+ return m;
5192
+ },
5193
+ )
4449
5194
  // "the nav links bolder and the active one blue": "the active one" is
4450
5195
  // the same parts in that state.
4451
5196
  .replace(
@@ -4457,6 +5202,14 @@ export function draftAnswer(ctx, env, question) {
4457
5202
  /\b(overlay|backdrop|scrim)\s+(?:behind|under|beneath|below|for|of|around)\s+(?:the\s+|a\s+)?(?:dialogs?|modals?|drawers?|sheets?)\b/gi,
4458
5203
  '$1',
4459
5204
  )
5205
+ // ("dialogs with a dark overlay behind them": the same overlay, said
5206
+ // after the dialog.)
5207
+ .replace(
5208
+ /\b(?:dialogs?|modals?|drawers?|sheets?)\s+with\s+(?:an?\s+)?((?:[a-z]+\s+)?)(overlay|backdrop|scrim)\s+(?:behind|under|beneath|below|around)\s+(?:them|it)\b/gi,
5209
+ // (Its look said as an adjective, "dark", is the way: darker.)
5210
+ (_m, adj, noun) =>
5211
+ `${String(adj).replace(/^(dark|light)\s+$/i, '$1er ')}${noun}`,
5212
+ )
4460
5213
  // "the shadow sharper": less blur on the shadow, never sharper corners.
4461
5214
  .replace(
4462
5215
  /\b((?:drop |box )?shadows?)\s+((?:a (?:bit|little|touch) |slightly |much )?)sharper\b/gi,
@@ -4613,8 +5366,13 @@ export function draftAnswer(ctx, env, question) {
4613
5366
  // request, or a thing with a value or a direction; a condition, an
4614
5367
  // indirect question, a double negative or a statement of fact gets the
4615
5368
  // lookup instead. A wrong write is worse than no command.
5369
+ // (A past conditional said inverted, "had we gone with …", is a
5370
+ // hypothetical; a clause timed to an event, "after the review",
5371
+ // "until legal approves", is a later ask, held: never a state word,
5372
+ // "after hovering"; "after that, make headings bold" is the next step of
5373
+ // the ask, as "then" is.)
4616
5374
  const CONDITION =
4617
- /^\s*(?:if|unless|in case|provided|providing|only if|assuming|suppose|supposing|as long as|whenever|as soon as|once|given|in the event|should (?:the|it|they)|were (?:the|it|they)|otherwise|on condition)\b|\b(?:except if|on condition that|in the event)\b/i;
5375
+ /^\s*(?:if|unless|in case|provided|providing|only if|assuming|suppose|supposing|as long as|whenever|as soon as|once|given|in the event|should (?:the|it|they)|were (?:the|it|they|we|i|you)|had (?:the|it|they|we|i|you)|otherwise|on condition)\b|\b(?:except if|on condition that|in the event|(?:would|could|should) have (?:been|gone|used|had|looked|made|picked|chosen|kept))\b|^\s*(?:after|until|till|before)\s+(?!(?:hover|hovering|focus|focusing|click|clicking|press|pressing|visiting|being)\b)(?!(?:this|that)\b\s*(?:,|$|(?:make|set|change|use|give|turn|add|remove|put)\b))(?:the|a|an|my|our|their|your|this|that|[a-z]+\s+(?:approves?|reviews?|signs?\s+off|ships?|launch(?:es)?|is\s+done|finish(?:es)?))\b/i;
4618
5376
  const NOT_ASK =
4619
5377
  /\b(i wonder|wondering|curious|would like to know|let me see|help me understand|any idea|just checking|just asking|check if|check whether|can you check|look at|double check|idk|quick q|do you think)\b|\b(don'?t not|not without|not un-?(?:bold|round|rounded|flat|square|styled)\w*|never no|no lighter|no darker|not at all|isn'?t it time|weren'?t)\b|^\s*(?!(?:can|could|would|will) (?:you|i|we)\b|can (?:the|my|our|all) [\w -]+ be\b|is it possible\b|is there a way\b)(?:do|does|did|will|would|can(?!'t|not)|could|should|is|are)\b(?!n'?t)|^\s*checking\b|\bno less (?!than)|^\s*(would|could|should|does|do|is|are|will)\b[^.]*\b(work|look|be (?:a )?(?:good|better|too much|ok|okay)|good|better|accessible|clash|too much)\b[^.]*\??$|\bor\b[^.]*\?\s*$|^\s*how (?:would|round|big|dark|light|thick)\b|\b(right now|rn)\b(?!.*\b(make|set|change)\b)/i;
4620
5378
  const ASK_START =
@@ -4846,11 +5604,70 @@ export function draftAnswer(ctx, env, question) {
4846
5604
  /\b(imagine|picture|pretend|hypothetically|in theory|toying with)\b/i;
4847
5605
  // A tag question ("corners are 10px, eh", "cards have a shadow, right?")
4848
5606
  // asks back about the whole line.
5607
+ // (Any auxiliary with its pronoun, "isn't that so", "doesn't it",
5608
+ // "aren't they right".)
4849
5609
  const TAG =
4850
- /^(?:eh|right|correct|yeah|huh|no|isn'?t it|aren'?t they|are they|is it|are we|do they|does it|ok|okay|(?:or )?am i (?:wrong|right|mistaken))\s*[?!.]*$/i;
5610
+ /^(?:eh|right|correct|yeah|huh|no|ok|okay|(?:or )?am i (?:wrong|right|mistaken)|(?:is|are|was|were|does|do|did|has|have|isn'?t|aren'?t|wasn'?t|weren'?t|doesn'?t|don'?t|didn'?t|hasn'?t|haven'?t|won'?t|wouldn'?t)\s+(?:it|that|they|this|there|we|those|these)(?:\s+(?:so|right|true))?)\s*[?!.]*$/i;
5611
+ // Tone the case carries: an all-caps intensifier before a judgment
5612
+ // ("SO professional", "TOTALLY readable") in a line otherwise written
5613
+ // in lowercase; and a reply that agrees with a reason ("yes because …").
5614
+ // (Never an emphasis inside an ask, "make it SO much rounder": only a
5615
+ // line with no ask verb, and a judgment, not an amount.)
5616
+ const shouted =
5617
+ /\b(?:SO|SOOO+|TOTALLY|REALLY|VERY|SUPER|SUCH)\s+(?!(?:much|many|more|less|far|way)\b)(?![a-z]+er\b)[a-z]{3,}/.test(
5618
+ raw0,
5619
+ ) &&
5620
+ !segments.some(
5621
+ x =>
5622
+ ASK_START.test(x.toLowerCase()) ||
5623
+ VERB.test(x.toLowerCase().replace(POLITE, '')),
5624
+ ) &&
5625
+ !/\b(?:please|pls)\b/i.test(raw0) &&
5626
+ (raw0.match(/[A-Z]/g) ?? []).length <= 12 &&
5627
+ raw0.replace(/\b[A-Z]{2,}\b/g, '').toLowerCase() ===
5628
+ raw0.replace(/\b[A-Z]{2,}\b/g, '').replace(/^./, ch => ch.toLowerCase());
5629
+ const SARCASTIC_REPLY = /^\s*(?:yes|yeah|yep|sure|oh yes)\b[\s,]+because\b/i;
5630
+ // A question about how the theme is now ("is the shadow still there?"),
5631
+ // with the rest only naming looks, no verb, no request ("cards no
5632
+ // border."): the rest says what the person sees; nothing is asked.
5633
+ const stateQuestion =
5634
+ segments.length > 1 &&
5635
+ segments.some(
5636
+ x =>
5637
+ /\?\s*$/.test(x) &&
5638
+ /^\s*(?:is|are|was|were|does|do|did|has|have)\s+(?!(?:that|it|this|these|those)\b)(?:the|my|our|any|a|an)\b/i.test(
5639
+ x,
5640
+ ),
5641
+ ) &&
5642
+ segments
5643
+ .filter(x => !/\?\s*$/.test(x))
5644
+ .every(
5645
+ x =>
5646
+ !ASK_START.test(x.toLowerCase()) &&
5647
+ !VERB.test(x.toLowerCase().replace(POLITE, '')) &&
5648
+ !/\b(?:please|pls|want|need|would like|make|set|give)\b/i.test(x),
5649
+ );
5650
+ // (A tag that also reads as an ask's own words, "just do it", "have it",
5651
+ // asks back only with a question mark or after a line that asks for
5652
+ // nothing.)
5653
+ const ASK_TAG =
5654
+ /^(?:just\s+)?(?:do|did|have|has)\s+(?:it|that|this)\s*[!.]*$/i;
5655
+ const asksElsewhere = (/** @type {string} */ x) =>
5656
+ segments.some(
5657
+ y =>
5658
+ y !== x &&
5659
+ (ASK_START.test(y.toLowerCase()) ||
5660
+ VERB.test(y.toLowerCase().replace(POLITE, ''))),
5661
+ );
5662
+ const tagged = segments.some(
5663
+ x => TAG.test(x.trim()) && !(ASK_TAG.test(x.trim()) && asksElsewhere(x)),
5664
+ );
4851
5665
  const gateAll =
4852
- segments.some(x => TAG.test(x.trim())) ||
5666
+ tagged ||
4853
5667
  SARCASM.test(question) ||
5668
+ shouted ||
5669
+ SARCASTIC_REPLY.test(question) ||
5670
+ stateQuestion ||
4854
5671
  HYPOTHETICAL.test(question) ||
4855
5672
  (gated.length > 0 && gated.length === segments.length) ||
4856
5673
  segments.some(x => CONDITION.test(x.replace(/^[^:]*:\s*/, '')));
@@ -4942,7 +5759,16 @@ export function draftAnswer(ctx, env, question) {
4942
5759
  // "muted ones", "the muted card", "the muted background": the muted
4943
5760
  // variant or token it names, not a color ask.
4944
5761
  /(?<![-\w])(?:more )?(?:muted|pastel|duller|subdued|desaturated)(?![-\w])(?! (?:ones?|cards?|buttons?|badges?|variant|backgrounds?|surfaces?|bg|text)\b)/gi,
4945
- 'less saturated',
5762
+ // ("pastel pink": a shade of the hue named, read by the color reader.)
5763
+ (m, at, whole) =>
5764
+ /^pastel$/i.test(m) &&
5765
+ colorsIn(
5766
+ (
5767
+ /^\s+([a-z]+)/i.exec(String(whole).slice(at + m.length))?.[1] ?? ''
5768
+ ).toLowerCase(),
5769
+ ).length
5770
+ ? m
5771
+ : 'less saturated',
4946
5772
  )
4947
5773
  // "less sharp", "less thick", "less round": the opposite word.
4948
5774
  .replace(/\bless (?:sharp|square|angular|boxy)\b/gi, 'rounder')
@@ -5086,6 +5912,13 @@ export function draftAnswer(ctx, env, question) {
5086
5912
  (_, /** @type {string} */ r) =>
5087
5913
  `corners ${/** @type {Record<string, string>} */ ({xs: '4px', sm: '8px', md: '10px', lg: '12px', xl: '16px'})[r.toLowerCase()]}`,
5088
5914
  )
5915
+ // ("shadow-sm", "shadow lg": the shadow rungs by their short names,
5916
+ // as the radius ones above.)
5917
+ .replace(
5918
+ /\b(?:drop[- ])?shadow[- ](xs|sm|md|lg|xl|2xl)\b/gi,
5919
+ (_, /** @type {string} */ r) =>
5920
+ `${/** @type {Record<string, string>} */ ({xs: 'small', sm: 'small', md: 'medium', lg: 'large', xl: 'large', '2xl': 'large'})[r.toLowerCase()]} shadow`,
5921
+ )
5089
5922
  // "midnight blue": the CSS named color.
5090
5923
  .replace(/\b([a-z]+) ([a-z]+)\b/gi, (m, a, b) =>
5091
5924
  COLOR_NAMES.includes(`${a}${b}`.toLowerCase()) &&
@@ -5164,7 +5997,7 @@ export function draftAnswer(ctx, env, question) {
5164
5997
  .replace(/\boff[- ]?white\b/gi, (m, _at, whole) =>
5165
5998
  /#[0-9a-f]{3,8}\b|\b(?:rgba?|hsla?|oklch)\(/i.test(String(whole))
5166
5999
  ? ' '
5167
- : '#fafafa',
6000
+ : '#faf8f3',
5168
6001
  )
5169
6002
  .replace(/\boff[- ]?black\b/gi, '#111111')
5170
6003
  // "match the header color to the sidebar": the first part is the one to
@@ -5222,10 +6055,12 @@ export function draftAnswer(ctx, env, question) {
5222
6055
  /\b(\d+(?:\.\d+)?)pt\b/gi,
5223
6056
  (_, n) => `${Math.round((Number(n) * 4) / 3)}px`,
5224
6057
  )
5225
- // "a 1px border instead of a shadow": no shadow, and the border.
6058
+ // "a 1px border instead of a shadow": the border, and no shadow (on
6059
+ // the part the ask names: "inputs filled gray instead of outlined"
6060
+ // takes the inputs' outline away, never every border).
5226
6061
  .replace(
5227
6062
  /^(.*?)\binstead of (?:a |an |the )?([a-z]+(?: [a-z]+)?)\b/gim,
5228
- (m, a, b) => (a.trim() ? `no ${b} ; ${a}` : m),
6063
+ (m, a, b) => (a.trim() ? `${a.trim()} ; no ${b}` : m),
5229
6064
  )
5230
6065
  // "why are my headings not bold": the complaint asks for bold.
5231
6066
  .replace(/\bwhy (?:is|are|isn'?t|aren'?t)\b(.*?)\bnot\s+/gi, 'make$1 ')
@@ -5671,6 +6506,29 @@ export function draftAnswer(ctx, env, question) {
5671
6506
  );
5672
6507
  const media = MEDIA_RE.test(q);
5673
6508
  if (media) q = q.replace(MEDIA_RE, ' ').replace(/\s+/g, ' ').trim();
6509
+ // Two colors of the whole theme joined by "and" before one way ("the
6510
+ // accent and danger darker", "--color-accent and --color-danger
6511
+ // darker"): each takes that way, as two parts joined by "and" do.
6512
+ {
6513
+ const COLOR = `(?:--[a-z][a-z0-9-]*|${PALETTE_DIALS.join('|')})`;
6514
+ q = q.replace(
6515
+ new RegExp(
6516
+ `\\b(?:the\\s+)?(${COLOR})((?:\\s*,\\s*(?:the\\s+)?${COLOR})*)\\s*,?\\s+and\\s+(?:the\\s+)?(${COLOR})\\s+(?!and\\b)([^,;.]+)`,
6517
+ 'g',
6518
+ ),
6519
+ (all, first, more, last, ask) =>
6520
+ [
6521
+ first,
6522
+ ...String(more)
6523
+ .split(',')
6524
+ .map(x => x.replace(/^\s*(?:the\s+)?/, '').trim())
6525
+ .filter(Boolean),
6526
+ last,
6527
+ ]
6528
+ .map(x => `${x} ${ask.trim()}`)
6529
+ .join(' and '),
6530
+ );
6531
+ }
5674
6532
  const clauses0 = clausesOf(q, lex.parts);
5675
6533
  // "cream background, terracotta accent, serif headings": a list whose
5676
6534
  // items each ask their own thing is each of them, never the first one's
@@ -5772,7 +6630,15 @@ export function draftAnswer(ctx, env, question) {
5772
6630
  });
5773
6631
  // ("cards: …": the part's own list, after its colon; the part named
5774
6632
  // before the colon, never "Notion look: serif headings".)
5775
- const head = /^([^:]+):\s*\S/.exec(c.text)?.[1];
6633
+ // (Its head as asked, too: a reader may have moved words of the
6634
+ // clause, "dialogs: no border" read as "no dialogs border".)
6635
+ const head =
6636
+ /^([^:]+):\s*\S/.exec(c.text)?.[1] ??
6637
+ [...asked0.matchAll(/(?:^|[.;!?\n]\s*)([a-z][a-z' -]{1,40}):\s*\S/g)]
6638
+ .map(m => m[1])
6639
+ .find(h =>
6640
+ h.split(/\s+/).every(w => new RegExp(`\\b${w}\\b`).test(c.text)),
6641
+ );
5776
6642
  if (
5777
6643
  head &&
5778
6644
  c.parts.length &&
@@ -5869,7 +6735,29 @@ export function draftAnswer(ctx, env, question) {
5869
6735
  // A look taken away from the part before ("rounded buttons, no
5870
6736
  // shadow"; never "serif headings, no shadows": a text part's look is
5871
6737
  // its type).
5872
- if (c.neg && own.length && !before.parts.every(p => textOnlyPart(p.on)))
6738
+ // (Only a look the part draws: a focus ring draws no shadow, so
6739
+ // "visible focus ring, no shadows" is the theme's.)
6740
+ if (
6741
+ c.neg &&
6742
+ own.length &&
6743
+ !own.includes('text') &&
6744
+ !before.parts.every(p => textOnlyPart(p.on)) &&
6745
+ before.parts.every(p => {
6746
+ const props = Object.keys(C.MAP[first(p.on)]?.at ?? {});
6747
+ const PROP = /** @type {Record<string, RegExp>} */ ({
6748
+ shadow: /^box-shadow$/,
6749
+ border: /^border(?:-(?:width|style|color))?$/,
6750
+ corners: /radius$/,
6751
+ background: /^background/,
6752
+ });
6753
+ return own.every(
6754
+ a =>
6755
+ !PROP[a] ||
6756
+ props.some(x => PROP[a].test(x)) ||
6757
+ (C.partReads(first(p.on), a) ?? []).length > 0,
6758
+ );
6759
+ })
6760
+ )
5873
6761
  return 'inherit';
5874
6762
  // A CSS property named with its value ("card padding-block 20px,
5875
6763
  // padding-inline 16px"): a declaration list, the part's.
@@ -5889,8 +6777,18 @@ export function draftAnswer(ctx, env, question) {
5889
6777
  if (own.length && own.every(a => a === 'text') && pageBefore)
5890
6778
  return 'theme';
5891
6779
  if (j.sep === 'with' || j.list === 'colon') return 'inherit';
5892
- // Only a way, a value or a color: the same part.
5893
- if (!own.length) return 'inherit';
6780
+ // (The part's text in its with-list: "badges with a subtle background
6781
+ // and dark text".)
6782
+ if (j.list === 'with' && own.length && own.every(a => a === 'text'))
6783
+ return 'inherit';
6784
+ // Only a way, a value or a color, said with "and" or as a bare
6785
+ // fragment ("rounder and darker", ", red"): the same part. A comma
6786
+ // item with words of its own ("magenta #ff00e6 for highlights") is not
6787
+ // the part before's.
6788
+ if (!own.length)
6789
+ return j.sep === 'and' || c.text.trim().split(/\s+/).length <= 2
6790
+ ? 'inherit'
6791
+ : 'theme';
5894
6792
  // (The theme's spacing said as a dial, never a part's padding or gap.)
5895
6793
  if (
5896
6794
  own.some(a => THEME_ASPECTS.includes(a)) ||
@@ -5898,7 +6796,16 @@ export function draftAnswer(ctx, env, question) {
5898
6796
  !/\b(?:padding|gaps?|margins?|inset)\b|\bpadding-/.test(c.text))
5899
6797
  )
5900
6798
  return 'theme';
5901
- // A text color: the part's, when it holds text.
6799
+ // A list item said subject first, "text #111827", "border #e5e7eb",
6800
+ // in a comma list of tokens: its own item, the theme's.
6801
+ if (
6802
+ j.sep === 'comma' &&
6803
+ /^(?:text|muted text|secondary text|borders?|background|links?|accent)\s+(?:#|rgb|hsl|oklch|var\()/.test(
6804
+ c.text.trim(),
6805
+ )
6806
+ )
6807
+ return 'theme';
6808
+ // A text color: the part's, when it holds text.
5902
6809
  if (own.every(a => a === 'text'))
5903
6810
  return c.colors.length && !before.parts.every(p => textOnlyPart(p.on))
5904
6811
  ? 'inherit'
@@ -5948,8 +6855,14 @@ export function draftAnswer(ctx, env, question) {
5948
6855
  // (Only for a look said as a look, "a theme in navy", or a color said
5949
6856
  // alone; never a statement, "I set the accent to red by mistake", nor a
5950
6857
  // color another dial names, "a more muted success green".)
6858
+ // (Or a look said as a list, "clean and trustworthy like a bank: blue
6859
+ // and gray, lots of data": several pieces and no part named.)
6860
+ const lookList =
6861
+ !clauses.some(c => c.parts.length > 0) &&
6862
+ q.split(/[,;:]|\band\b/).filter(x => x.trim()).length >= 3;
5951
6863
  const lookSaid =
5952
- /\b(?:theme|look|feel|vibe|style|palette|brand|branding)\b/.test(q);
6864
+ /\b(?:theme|look|feel|vibe|style|palette|brand|branding)\b/.test(q) ||
6865
+ lookList;
5953
6866
  const namesAPart = clauses.some(c => c.parts.length > 0);
5954
6867
  for (let i = clauses.length - 1; i >= 0 && !paintsAPart && !namesAPart; i--) {
5955
6868
  const c = clauses[i];
@@ -6080,7 +6993,10 @@ export function draftAnswer(ctx, env, question) {
6080
6993
  for (const [ci, c] of [...clauses.entries()].reverse())
6081
6994
  if (
6082
6995
  c.lengths.some(l => /^\d*\.?\d+(?:px|rem|em)$/.test(l)) &&
6083
- /\b(?:text|labels?|font|type|letters)\b/.test(c.text) &&
6996
+ // (Uppercase or italic is the text's look whatever the words: "table
6997
+ // headers uppercase 11px".)
6998
+ (/\b(?:text|labels?|font|type|letters)\b/.test(c.text) ||
6999
+ c.aspects.some(a => a === 'case' || a === 'italic')) &&
6084
7000
  c.aspects.some(a =>
6085
7001
  ['case', 'weight', 'italic', 'tracking', 'family'].includes(a),
6086
7002
  ) &&
@@ -6105,6 +7021,92 @@ export function draftAnswer(ctx, env, question) {
6105
7021
  });
6106
7022
  c.lengths = [];
6107
7023
  }
7024
+ // ("selected tab with a 2px #635bff underline": the tab before a clause
7025
+ // that names its underline is the tab indicator.)
7026
+ for (const [ci, c] of clauses.entries()) {
7027
+ const prev = clauses[ci - 1];
7028
+ if (
7029
+ !c.parts.length &&
7030
+ /\bunderline/.test(c.text) &&
7031
+ prev?.parts.some(p => p.on === 'tab') &&
7032
+ !prev.aspects.length
7033
+ ) {
7034
+ c.parts = [{on: 'tab-indicator'}];
7035
+ prev.parts = prev.parts.filter(p => p.on !== 'tab');
7036
+ if (!prev.parts.length) prev.text = '';
7037
+ }
7038
+ for (const p of c.parts)
7039
+ if (p.on === 'tab' && /\bunderline/.test(c.text)) p.on = 'tab-indicator';
7040
+ }
7041
+ // ("list items more spacing between them": the room between items is
7042
+ // the gap of the part that holds them, never each item's padding.)
7043
+ for (const c of clauses)
7044
+ if (
7045
+ c.aspects.includes('spacing') &&
7046
+ /\bbetween\b/.test(c.text) &&
7047
+ c.parts.length
7048
+ )
7049
+ c.parts = c.parts.map(p => {
7050
+ const item = String(p.on);
7051
+ const holder = item.replace(/-(?:items?|rows?|cells?|options?)$/, '');
7052
+ return holder !== item &&
7053
+ TARGET.has(holder) &&
7054
+ (C.MAP[holder]?.contains ?? []).includes(item)
7055
+ ? {...p, on: holder, between: item}
7056
+ : p;
7057
+ });
7058
+ // ("badges uppercase bold": two looks of a part's text said together are
7059
+ // each an ask of their own, run in turn.)
7060
+ const TEXT_LOOKS = ['case', 'weight', 'italic', 'tracking', 'fontsize'];
7061
+ for (const [ci, c] of [...clauses.entries()].reverse()) {
7062
+ // ("large bold headings", "bigger, bolder headings": a heading's size
7063
+ // word beside its weight is its text size.)
7064
+ if (
7065
+ c.parts.length &&
7066
+ c.parts.every(p =>
7067
+ /(?:^|-)(?:heading|title)s?$/.test(String(p.on).split('|')[0]),
7068
+ ) &&
7069
+ c.aspects.some(
7070
+ a => a === 'size' || (TEXT_LOOKS.includes(a) && a !== 'fontsize'),
7071
+ ) &&
7072
+ !c.aspects.includes('fontsize') &&
7073
+ /\b(?:large|larger|big|bigger|huge|giant|small|smaller|tiny)\b(?![\s-]*caps\b)/.test(
7074
+ c.text,
7075
+ )
7076
+ )
7077
+ c.aspects = [...c.aspects.filter(a => a !== 'size'), 'fontsize'];
7078
+ const looks = c.aspects.filter(a => TEXT_LOOKS.includes(a));
7079
+ if (
7080
+ !c.parts.length ||
7081
+ looks.length < 2 ||
7082
+ looks.length !== c.aspects.length ||
7083
+ c.except ||
7084
+ c.neg
7085
+ )
7086
+ continue;
7087
+ c.aspects = [looks[0]];
7088
+ clauses.splice(
7089
+ ci + 1,
7090
+ 0,
7091
+ ...looks.slice(1).map(a => ({
7092
+ ...c,
7093
+ parts: c.parts.map(x => ({...x})),
7094
+ aspects: [a],
7095
+ })),
7096
+ );
7097
+ }
7098
+ // ("a #e8def8 pill", "a blue rounded box": a color said with a shape is
7099
+ // the shape's fill, beside its corners.)
7100
+ for (const c of clauses)
7101
+ if (
7102
+ c.parts.length &&
7103
+ c.colors.length &&
7104
+ !c.except &&
7105
+ !c.neg &&
7106
+ c.aspects.length &&
7107
+ c.aspects.every(a => a === 'corners')
7108
+ )
7109
+ c.aspects = [...c.aspects, 'background'];
6108
7110
  // ("make it calmer", "the error toast calmer": its color, the fill it
6109
7111
  // shows.)
6110
7112
  for (const c of clauses)
@@ -6115,16 +7117,67 @@ export function draftAnswer(ctx, env, question) {
6115
7117
  // too, never dropped.
6116
7118
  for (let i = 1; i < clauses.length; i++) {
6117
7119
  const [a, b] = [clauses[i - 1], clauses[i]];
7120
+ // (One color said once or as a word and its value, "gray #6b7280".)
7121
+ const oneColor =
7122
+ b.colors.length === 1 ||
7123
+ (b.colors.length === 2 &&
7124
+ /^\s*(?:and\s+)?[a-z-]+\s+#[0-9a-f]{3,8}\s*$/i.test(b.text) &&
7125
+ colorsIn(b.text.trim().split(/\s+/).slice(-2)[0]).length > 0);
7126
+ /** The color said, its typed value when a word comes with it. */
7127
+ const typedOnly = () => {
7128
+ const typed = /#[0-9a-f]{3,8}\b/i.exec(b.text)?.[0];
7129
+ if (b.colors.length === 2 && typed) b.colors = [typed.toLowerCase()];
7130
+ };
7131
+ // ("inputs: 1px border #79747e, 2px #6750a4 when focused": a length and
7132
+ // a color, or a color, with no look of its own, after the part's line
7133
+ // in the same list, is that line, in its own state.)
7134
+ if (
7135
+ (!b.parts.length ||
7136
+ b.parts.every(x => a.parts.some(y => y.on === x.on))) &&
7137
+ !b.aspects.length &&
7138
+ b.colors.length >= 1 &&
7139
+ // (A line is a width and a color: a bare color, "pink #DB2777",
7140
+ // is read by the readers after.)
7141
+ b.lengths.length > 0 &&
7142
+ oneColor &&
7143
+ a.parts.length &&
7144
+ a.aspects.length === 1 &&
7145
+ a.aspects[0] === 'border' &&
7146
+ !/[;\n.]/.test(b.joint ?? '') &&
7147
+ b.text
7148
+ .trim()
7149
+ .split(/\s+/)
7150
+ .every(
7151
+ w =>
7152
+ colorsIn(w).length > 0 ||
7153
+ /^-?\d*\.?\d+(?:px|rem|em)$/.test(w) ||
7154
+ /^(?:and|when|while|on|if|in|is|are|it'?s|the|focus(?:ed)?|hover(?:ed)?|press(?:ed)?|active|selected|checked|disabled|open)$/i.test(
7155
+ w,
7156
+ ),
7157
+ )
7158
+ ) {
7159
+ typedOnly();
7160
+ b.parts = a.parts.map(x => ({...x}));
7161
+ b.aspects = ['border'];
7162
+ continue;
7163
+ }
6118
7164
  if (
6119
7165
  !b.parts.length &&
6120
7166
  !b.aspects.length &&
6121
- b.colors.length === 1 &&
6122
- /^\s*(?:and\s+)?(?:make\s+(?:it|them)\s+)?[a-z#0-9-]+\s*$/i.test(
7167
+ oneColor &&
7168
+ (b.colors.length === 1 ||
7169
+ /^\s*(?:and\s+)?[a-z-]+\s+#[0-9a-f]{3,8}\s*$/i.test(b.text)) &&
7170
+ /^\s*(?:and\s+)?(?:make\s+(?:it|them)\s+)?(?:[a-z-]+\s+)?[a-z#0-9-]+\s*$/i.test(
6123
7171
  b.text,
6124
7172
  ) &&
6125
7173
  a.parts.length &&
6126
- /\b(?:text|labels?|copy|writing)\b/.test(a.text)
7174
+ /\b(?:text|labels?|copy|writing)\b/.test(a.text) &&
7175
+ // (A word with its value only after a look of the text itself, never
7176
+ // a part named with "text", "text inputs".)
7177
+ (b.colors.length === 1 ||
7178
+ a.aspects.some(x => x === 'text' || TEXT_LOOKS.includes(x)))
6127
7179
  ) {
7180
+ typedOnly();
6128
7181
  b.parts = a.parts.map(x => ({...x}));
6129
7182
  b.aspects = ['text'];
6130
7183
  b.text = `${a.text.replace(/\b(?:bigger|smaller|larger|bolder|fainter|subtler|lighter|darker|\d+(?:\.\d+)?\s?%\s+\w+)\b/g, '').trim()} ${b.text.trim()}`;
@@ -6162,6 +7215,7 @@ export function draftAnswer(ctx, env, question) {
6162
7215
  !a.except &&
6163
7216
  b.state &&
6164
7217
  b.state !== a.state &&
7218
+ [a.state, b.state].some(st => !MOMENT_STATES.includes(String(st))) &&
6165
7219
  !b.alsoState &&
6166
7220
  (!b.parts.length ||
6167
7221
  b.parts.every(x => a.parts.some(y => y.on === x.on))) &&
@@ -6282,6 +7336,8 @@ export function draftAnswer(ctx, env, question) {
6282
7336
  const symDone = new Set();
6283
7337
  /** Places the question names that the editor cannot keep apart. @type {Array<{c: any, text: string}>} */
6284
7338
  const placeNotes = [];
7339
+ /** The other reading of two states said together, as a line. @type {Draft[]} */
7340
+ const otherReadings = [];
6285
7341
  /** Clauses whose every step was kept to their container. @type {Set<any>} */
6286
7342
  const keptInPlace = new Set();
6287
7343
  // "checkboxes green": the color a checked box fills with (the checks
@@ -6878,6 +7934,17 @@ export function draftAnswer(ctx, env, question) {
6878
7934
  // ("The icon after the button text": beside a part's text is in it.)
6879
7935
  const preps =
6880
7936
  /\b(inside|within|of|after|before|next to|in(?! (?:dark|light)\b))\s+(?:the\s+|a\s+|an\s+|my\s+)?/g;
7937
+ // ("date picker: today's date circled": a label is the place the
7938
+ // words after it are in.)
7939
+ const label = /^\s*([a-z][a-z' -]{1,40}?)\s*:\s*(\S.*)$/i.exec(text);
7940
+ // (Never a screen named by what it shows, "a records table view:".)
7941
+ if (
7942
+ label &&
7943
+ !/\b(?:views?|pages?|screens?|apps?|dashboards?|layouts?)\s*$/i.test(
7944
+ label[1],
7945
+ )
7946
+ )
7947
+ places.push({holderText: label[1], elementText: label[2], by: 'in'});
6881
7948
  for (const m of text.matchAll(preps)) {
6882
7949
  const after = text.slice(/** @type {number} */ (m.index) + m[0].length);
6883
7950
  // (The place runs to the next place said.)
@@ -6986,6 +8053,34 @@ export function draftAnswer(ctx, env, question) {
6986
8053
  );
6987
8054
  // (Names test the element's own words; states, the whole.)
6988
8055
  const nameText = said;
8056
+ // Spacing asked between the parts a holder lays out ("more space
8057
+ // between the keys in the shortcut", "between the buttons in the
8058
+ // button group") is the holder's gap, when the census shows the
8059
+ // holder draws a gap and holds those parts side by side.
8060
+ if (
8061
+ c.aspects.includes('spacing') &&
8062
+ said &&
8063
+ ((by === 'possessive' &&
8064
+ /\bbetween\s+(?:the\s+)?[a-z]/i.test(holderText)) ||
8065
+ new RegExp(
8066
+ `\\bbetween\\s+(?:the\\s+)?${said.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\s*$`,
8067
+ 'i',
8068
+ ).test(elementText))
8069
+ ) {
8070
+ const rec = ctx.C.MAP[holder];
8071
+ const laidOut = (rec?.repeats ?? []).filter(
8072
+ k =>
8073
+ partIn(said) === k ||
8074
+ words(k).test(said) ||
8075
+ (k.startsWith(`${holder}-`) &&
8076
+ words(k.slice(holder.length + 1)).test(said)),
8077
+ );
8078
+ if (
8079
+ laidOut.length > 0 &&
8080
+ ['gap', 'row-gap', 'column-gap'].some(x => rec?.own?.[x])
8081
+ )
8082
+ return {part: {on: holder}, holder};
8083
+ }
6989
8084
  /** @type {Array<{k: string, score: number}>} */
6990
8085
  const found = [];
6991
8086
  for (const h of members) {
@@ -7047,6 +8142,30 @@ export function draftAnswer(ctx, env, question) {
7047
8142
  if (/-label$/.test(k) && stems.has(k.split('-')[0]))
7048
8143
  found.push({k, score: 60 - k.split('-').length});
7049
8144
  }
8145
+ // A group part holds the parts it is the group of (a toggle button
8146
+ // group's buttons are its toggle buttons): the part named by the
8147
+ // group's name without its last word, by that part's last word.
8148
+ for (const h of members)
8149
+ if (/-group$/.test(h)) {
8150
+ const stem = h.replace(/-group$/, '');
8151
+ if (
8152
+ keys.includes(stem) &&
8153
+ words(stem.split('-').at(-1) ?? '').test(nameText)
8154
+ )
8155
+ found.push({k: stem, score: 45});
8156
+ }
8157
+ // A thing the place does not draw itself whose name only one part of
8158
+ // the catalog ends with ("the date picker's days": the calendar's
8159
+ // day, the one day there is), said as that part.
8160
+ if (!found.length && by === 'possessive') {
8161
+ const last = String(said).trim().split(/\s+/).at(-1) ?? '';
8162
+ const ending = keys.filter(
8163
+ k =>
8164
+ k.split('-').length > 1 &&
8165
+ words(k.split('-').at(-1) ?? '').test(last),
8166
+ );
8167
+ if (ending.length === 1) found.push({k: ending[0], score: 5});
8168
+ }
7050
8169
  // A group of parts the place holds, named ("the buttons' icons").
7051
8170
  const group = Object.keys(FAMILIES).find(
7052
8171
  g =>
@@ -7175,9 +8294,17 @@ export function draftAnswer(ctx, env, question) {
7175
8294
  : (ctx.project.target.get(k)?.states ?? [])
7176
8295
  .filter(
7177
8296
  (/** @type {string} */ st) =>
7178
- !/^(hover|active|focus|focus-visible|focus-within|disabled|selected|checked|open|expanded|pressed|current)$/.test(
8297
+ !/^(hover|active|focus|focus-visible|focus-within|disabled)$/.test(
8298
+ st,
8299
+ ) &&
8300
+ words(st).test(elementText) &&
8301
+ // (A state many parts take, selected or checked,
8302
+ // only with the part's own word said: "the
8303
+ // selected day" is a calendar's day.)
8304
+ (!/^(selected|checked|open|expanded|pressed|current)$/.test(
7179
8305
  st,
7180
- ) && words(st).test(elementText),
8306
+ ) ||
8307
+ words(String(k.split('-').at(-1))).test(elementText)),
7181
8308
  )
7182
8309
  .map((/** @type {string} */ st) => ({k, st})),
7183
8310
  )
@@ -7881,6 +9008,16 @@ export function draftAnswer(ctx, env, question) {
7881
9008
  c.lengths.length
7882
9009
  )
7883
9010
  c.aspects = ['size'];
9011
+ // "alternate row shading": the stripes the doc names, a fill ask when
9012
+ // the clause asks nothing else ("alternate table row text color red" is
9013
+ // the text's).
9014
+ for (const c of clauses)
9015
+ if (
9016
+ !c.aspects.length &&
9017
+ c.parts.some(p => p.on === 'table-row') &&
9018
+ stripeNamesOf(ctx.project)(c.text)
9019
+ )
9020
+ c.aspects = ['background'];
7884
9021
  // "shadow opacity 0.2", "card shadows with 30% alpha", "dialog shadows
7885
9022
  // 50% transparent": the layer's alpha is the ask, not the layer.
7886
9023
  for (const c of clauses)
@@ -8104,6 +9241,24 @@ export function draftAnswer(ctx, env, question) {
8104
9241
  ?.find(t => /title/.test(t) && t !== ts0(owner.on));
8105
9242
  if (title && C.MAP[title]) c.parts = [{on: title}];
8106
9243
  }
9244
+ // "selected tab text white, unselected tabs gray": a clause naming the
9245
+ // same part in another state, with only its color, says the same thing
9246
+ // of it as the clause before.
9247
+ for (let i = 1; i < clauses.length; i++) {
9248
+ const [b, c] = [clauses[i - 1], clauses[i]];
9249
+ if (
9250
+ c.except ||
9251
+ b.except ||
9252
+ !c.parts.length ||
9253
+ (ownAspects.get(c) ?? c.aspects).length ||
9254
+ !c.colors.length ||
9255
+ !b.aspects.length ||
9256
+ (b.state ?? '') === (c.state ?? '') ||
9257
+ !c.parts.every(p => b.parts.some(x => x.on === p.on))
9258
+ )
9259
+ continue;
9260
+ c.aspects = [...b.aspects];
9261
+ }
8107
9262
  fillAspect();
8108
9263
  for (let i = 0; i < clauses.length; i++) {
8109
9264
  const c = clauses[i];
@@ -8234,12 +9389,18 @@ export function draftAnswer(ctx, env, question) {
8234
9389
  // "on focus, inputs get a 2px outline": a clause that only names a state
8235
9390
  // gives it to the clause after it.
8236
9391
  // (Never an except's state: "except when focused, and rounder".)
9392
+ // (Only from a clause that names nothing but the state: "primary hover
9393
+ // #4338ca" asks for a value of its own, and gives the next clause
9394
+ // nothing.)
8237
9395
  if (
8238
9396
  !c.state &&
8239
9397
  prev?.state &&
8240
9398
  !prev.except &&
8241
9399
  !prev.parts.length &&
8242
9400
  !prev.aspects.length &&
9401
+ !prev.colors.length &&
9402
+ !prev.lengths.length &&
9403
+ !prev.dir &&
8243
9404
  c.parts.length
8244
9405
  )
8245
9406
  c.state = prev.state;
@@ -8258,6 +9419,8 @@ export function draftAnswer(ctx, env, question) {
8258
9419
  !c.state &&
8259
9420
  // (An except's mode is what it keeps: "except primary in dark mode".)
8260
9421
  !c.except &&
9422
+ // (The mode the app opens in is the theme's, scoping nothing.)
9423
+ !/\bby default\b|\bopens? in\b|\bstarts? in\b/.test(c.text) &&
8261
9424
  !prev.mode &&
8262
9425
  (prev.parts.length || prev.aspects.length)
8263
9426
  ) {
@@ -8393,7 +9556,10 @@ export function draftAnswer(ctx, env, question) {
8393
9556
  !modal ||
8394
9557
  /\b(?:(?:in\s+)?(?:both|all)\s+modes|every\s+mode|everywhere|light\s+and\s+dark|dark\s+and\s+light)\b/i.test(
8395
9558
  `${c.text} ${question}`,
8396
- )
9559
+ ) ||
9560
+ // (Said with a one-mode theme, "dark only … page #x", the theme
9561
+ // has one mode: its page needs none.)
9562
+ /\b(?:dark|light)[- ](?:mode[- ])?only\b/.test(q)
8397
9563
  )
8398
9564
  return null;
8399
9565
  const rgb = parseColor(String(color));
@@ -8405,6 +9571,55 @@ export function draftAnswer(ctx, env, question) {
8405
9571
  ? 'dark'
8406
9572
  : null;
8407
9573
  };
9574
+ /**
9575
+ * A color at another color's lightness: the amount toward white or black
9576
+ * whose luminance is that color's (a color word's tone for a mode's page
9577
+ * or surface).
9578
+ * @param {string} color
9579
+ * @param {string} like
9580
+ */
9581
+ const toneLike = (color, like) => {
9582
+ const target = parseColor(like);
9583
+ if (!target || !parseColor(color)) return null;
9584
+ const want = ratio(target, [0, 0, 0]);
9585
+ let lo = -1;
9586
+ let hi = 1;
9587
+ for (let k = 0; k < 24; k++) {
9588
+ const mid = (lo + hi) / 2;
9589
+ const v = parseColor(shift(color, mid) ?? '');
9590
+ if (!v) return null;
9591
+ if (ratio(v, [0, 0, 0]) < want) lo = mid;
9592
+ else hi = mid;
9593
+ }
9594
+ return shift(color, (lo + hi) / 2);
9595
+ };
9596
+ /**
9597
+ * A page color said as a word ("make it gray") that is neither clearly
9598
+ * light nor clearly dark, on a theme that draws both modes: each mode's
9599
+ * page takes the word's color at that page's own lightness, so neither
9600
+ * mode gets a mid-tone page under its text. Null when the color was
9601
+ * typed, a mode or both modes were said, or the theme draws one mode.
9602
+ * @param {Clause} c
9603
+ * @param {string} color
9604
+ * @returns {{light: string, dark: string} | null}
9605
+ */
9606
+ const pageTones = (c, color) => {
9607
+ if (!modal || c.mode || pageModeOf(c, color)) return null;
9608
+ if (
9609
+ /\b(?:(?:in\s+)?(?:both|all)\s+modes|every\s+mode|everywhere|light\s+and\s+dark|dark\s+and\s+light)\b/i.test(
9610
+ `${c.text} ${question}`,
9611
+ ) ||
9612
+ question.toLowerCase().includes(String(color).toLowerCase())
9613
+ )
9614
+ return null;
9615
+ if (!parseColor(color)) return null;
9616
+ /** @param {'light' | 'dark'} m */
9617
+ const tone = m =>
9618
+ toneLike(color, String(current('--color-background-body', m) ?? ''));
9619
+ const light = tone('light');
9620
+ const dark = tone('dark');
9621
+ return light && dark ? {light, dark} : null;
9622
+ };
8408
9623
  /** How a page color's mode reads. @param {Clause} c @param {'light' | 'dark' | null} m */
8409
9624
  const pageModeSaid = (c, m) => {
8410
9625
  if (!m || !modal) return '';
@@ -8792,7 +10007,11 @@ export function draftAnswer(ctx, env, question) {
8792
10007
  // on inputs", "large padding on buttons", it is the amount.)
8793
10008
  const besidePart = (/** @type {string} */ w) =>
8794
10009
  !new RegExp(
8795
- String.raw`\b(?:${w})\s+(?:shadows?|padding|radius|corners?|borders?|gaps?|spacing|text|fonts?|type|outlines?|rings?|margins?)\b`,
10010
+ String.raw`\b(?:${w})\s+(?:shadows?|padding|radius|corners?|borders?|gaps?|spacing|text|fonts?|type|outlines?|rings?|margins?|weight|bold|letters?|headings?)\b`,
10011
+ ).test(c.text) &&
10012
+ // ("buttons medium weight": a weight, never a size.)
10013
+ !new RegExp(
10014
+ String.raw`\b(?:${w})\s*(?:-\s*)?(?:weight|bold)\b|\b(?:weight|bold)\s+(?:${w})\b`,
8796
10015
  ).test(c.text);
8797
10016
  const size =
8798
10017
  /\b(small|sm)\b/.test(c.text) && besidePart('small|sm')
@@ -9119,7 +10338,8 @@ export function draftAnswer(ctx, env, question) {
9119
10338
  // that mode (its width and style are the part's own).
9120
10339
  const color =
9121
10340
  new RegExp(COLOR_IN_VALUE.source, 'i').exec(value)?.[0] ??
9122
- colorsIn(value)[0];
10341
+ colorsIn(value)[0] ??
10342
+ /var\(--color-[a-z0-9-]+\)/.exec(value)?.[0];
9123
10343
  // (A state's look keeps the border the part draws at rest: a focused
9124
10344
  // input's line is its resting one, recolored.)
9125
10345
  const shows =
@@ -9157,6 +10377,15 @@ export function draftAnswer(ctx, env, question) {
9157
10377
  value: ring.value,
9158
10378
  ...(ring.when ? {when: ring.when} : {}),
9159
10379
  });
10380
+ // (No ring where the part draws its own shadow: the border itself,
10381
+ // its color see-through in the other mode, so that mode keeps the
10382
+ // look with an edge of the same width it cannot see.)
10383
+ if (!st.state)
10384
+ return held({
10385
+ ...st,
10386
+ mode: undefined,
10387
+ value: `${w} solid light-dark(${c.mode === 'light' ? `${color}, transparent` : `transparent, ${color}`})`,
10388
+ });
9160
10389
  shadowWhy = `${one(st.on)} draws no border now, so a border in ${c.mode} mode would take its width in the other mode too, and it draws a shadow of its own, so a ring in its box-shadow would take that away`;
9161
10390
  }
9162
10391
  return st;
@@ -9740,10 +10969,25 @@ export function draftAnswer(ctx, env, question) {
9740
10969
  clauseNow && !clauseNow.except && d1.options.some(o => o.length)
9741
10970
  ? unreadWords(clauseNow, d1.options)
9742
10971
  : [];
9743
- const d0 = unread.length
10972
+ // (A color the clause gives to a look of its own that takes a color,
10973
+ // its fill, its text or its line, is read there, whichever answer of
10974
+ // the clause comes first: "a #e8def8 pill".)
10975
+ const unreadHere = unread.filter(
10976
+ w =>
10977
+ !(
10978
+ colorsIn(w.toLowerCase()).length &&
10979
+ clauseNow?.aspects.some(a =>
10980
+ ['background', 'text', 'border'].includes(a),
10981
+ ) &&
10982
+ !d1.options.some(o =>
10983
+ o.some(st => /colou?r|background|border/.test(st.thing)),
10984
+ )
10985
+ ),
10986
+ );
10987
+ const d0 = unreadHere.length
9744
10988
  ? {
9745
10989
  ...d1,
9746
- text: `read "${clauseNow?.text}" but not ${unread.map(w => `"${w}"`).join(', ')}, so nothing is written: say it in words how reads (a part, what to change, and a value or a way such as darker or more)`,
10990
+ text: `read "${clauseNow?.text}" but not ${unreadHere.map(w => `"${w}"`).join(', ')}, so nothing is written: say it in words how reads (a part, what to change, and a value or a way such as darker or more)`,
9747
10991
  options: [],
9748
10992
  ...(clauseNow?.parts[0]
9749
10993
  ? {lookup: `${HOW} ${clauseNow.parts[0].on}`}
@@ -9788,8 +11032,8 @@ export function draftAnswer(ctx, env, question) {
9788
11032
  const missing = clauseNow?.parts.find(x => x.missing);
9789
11033
  // A title Core draws as a heading inside the part, with no part of its
9790
11034
  // own: no setting reaches it alone, so nothing is written for it.
9791
- // (A part that draws its title as its own text, a banner's, is answered
9792
- // for the whole part, said so.)
11035
+ // (A part that draws its title as its own text, a citation's, is
11036
+ // answered for the whole part, said so.)
9793
11037
  if (
9794
11038
  missing &&
9795
11039
  /\btitle$/.test(String(missing.missing)) &&
@@ -9879,6 +11123,7 @@ export function draftAnswer(ctx, env, question) {
9879
11123
  ? {modeInValue: true}
9880
11124
  : {}
9881
11125
  ),
11126
+ ...(input.unmet ? {unmet: input.unmet} : {}),
9882
11127
  };
9883
11128
  drafts.push(pushed);
9884
11129
  if (clauseNow) draftClause.set(pushed, clauseNow);
@@ -9953,7 +11198,7 @@ export function draftAnswer(ctx, env, question) {
9953
11198
  * @param {Clause} c @param {string} chosen
9954
11199
  * @returns {string}
9955
11200
  */
9956
- const themeShade = (c, chosen) => {
11201
+ const themeShade = (c, chosen, mirror = false) => {
9957
11202
  for (const m of c.text.matchAll(/\b([a-z]+)\b/g)) {
9958
11203
  const word = m[1];
9959
11204
  if (!Object.hasOwn(HUES, word) || HUES[word] !== chosen) continue;
@@ -9984,13 +11229,32 @@ export function draftAnswer(ctx, env, question) {
9984
11229
  const light = nearestShade(ramp.light, chosen);
9985
11230
  const dark = nearestShade(ramp.dark, chosen);
9986
11231
  if (light == null || dark == null) return chosen;
9987
- const [l, d] = [ramp.light[light], ramp.dark[dark]];
11232
+ // (A gray on a surface: the light mode's step and its mirror in the
11233
+ // dark mode, so the surface stays as far from its page, and its text
11234
+ // as readable, in both.)
11235
+ const mirrored =
11236
+ mirror && family === 'neutral'
11237
+ ? ramp.dark[String(100 - Number(light))]
11238
+ : undefined;
11239
+ const [l, d] = [ramp.light[light], mirrored ?? ramp.dark[dark]];
9988
11240
  return String(l).toLowerCase() === String(d).toLowerCase()
9989
11241
  ? l
9990
11242
  : `light-dark(${l}, ${d})`;
9991
11243
  }
9992
11244
  return chosen;
9993
11245
  };
11246
+ /**
11247
+ * Whether every part a clause names is a surface: its resting fill a
11248
+ * background token, or no fill of its own (a header cell, an input).
11249
+ * @param {Clause} c
11250
+ */
11251
+ const onSurfaces = c =>
11252
+ c.parts.length > 0 &&
11253
+ c.parts.every(p => {
11254
+ const reads = C.partReads(one(p.on), 'background') ?? [];
11255
+ const tok = restRead(reads, '');
11256
+ return !reads.length || (!!tok && /^--color-background-/.test(tok));
11257
+ });
9994
11258
  /** A color for the clause, for a fill, a text or a border color. @param {Clause} c @param {'fill' | 'text' | 'border'} use */
9995
11259
  const colorFor = (c, use) => {
9996
11260
  // (A border's color is read as a fill's, but takes its own palette
@@ -10053,7 +11317,8 @@ export function draftAnswer(ctx, env, question) {
10053
11317
  c.text,
10054
11318
  );
10055
11319
  const said = fillWord ? colorsIn(fillWord[0]) : [];
10056
- if (said.length) return themeShade(c, said[0]);
11320
+ if (said.length)
11321
+ return themeShade(c, said[0], use === 'fill' && onSurfaces(c));
10057
11322
  // (Else never the color said before "text".)
10058
11323
  const textWord =
10059
11324
  /(?:(?:light|dark|pale|deep)\s+)?(?:#[0-9a-f]{3,8}|[a-z]+)\s+(?:text|labels?|writing|words|letters)\b/i.exec(
@@ -10061,14 +11326,15 @@ export function draftAnswer(ctx, env, question) {
10061
11326
  );
10062
11327
  const ink = textWord ? colorsIn(textWord[0])[0] : undefined;
10063
11328
  const other = c.colors.find(x => x !== ink);
10064
- if (ink && other) return themeShade(c, other);
11329
+ if (ink && other)
11330
+ return themeShade(c, other, use === 'fill' && onSurfaces(c));
10065
11331
  }
10066
11332
  if (
10067
11333
  kind === 'fill' &&
10068
11334
  c.colors.length &&
10069
11335
  !THEME_COLOR_WORDS.some(([re]) => re.test(c.text))
10070
11336
  )
10071
- return themeShade(c, c.colors[0]);
11337
+ return themeShade(c, c.colors[0], use === 'fill' && onSurfaces(c));
10072
11338
  for (const [re, fill, text] of THEME_COLOR_WORDS)
10073
11339
  if (re.test(ownText)) return kind === 'fill' ? fill : text;
10074
11340
  // "the color of the text", "the same color as the danger": a theme
@@ -10169,40 +11435,87 @@ export function draftAnswer(ctx, env, question) {
10169
11435
  if (steps.length) tops.push({clause: c, steps});
10170
11436
  };
10171
11437
 
11438
+ // "the pink page background is a bit much, make the page a warm cream":
11439
+ // a clause that says how a part looks now (its color before it, a
11440
+ // complaint after) is the reason for the ask after it on the same part,
11441
+ // never a value: it writes nothing of its own.
11442
+ for (let i = 0; i < clauses.length - 1; i++) {
11443
+ const c = clauses[i];
11444
+ const verb =
11445
+ /\b(?:is|are|looks?|feels?|seems?)\s+(?:a\s+bit\s+|a\s+little\s+|way\s+|kind\s+of\s+|far\s+|just\s+)?(?:too\s+\w+|much|too\s+much|overwhelming|loud|harsh|garish)\b/.exec(
11446
+ c.text,
11447
+ );
11448
+ if (!verb || c.except || !c.parts.length || !c.colors.length) continue;
11449
+ // (Its color said before the complaint: what the part is now.)
11450
+ if (!colorsIn(c.text.slice(0, verb.index)).length) continue;
11451
+ const later = clauses
11452
+ .slice(i + 1)
11453
+ .find(
11454
+ o =>
11455
+ !o.except &&
11456
+ (o.colors.length || o.dir) &&
11457
+ (!o.parts.length ||
11458
+ o.parts.some(p => c.parts.some(x => x.on === p.on))),
11459
+ );
11460
+ if (!later) continue;
11461
+ if (!later.parts.length) later.parts = c.parts.map(p => ({...p}));
11462
+ c.parts = [];
11463
+ c.colors = [];
11464
+ c.dir = null;
11465
+ c.text = '';
11466
+ }
10172
11467
  // "switches: track #e5e7eb when off": a part whose only selection
10173
11468
  // state is checked draws its unchecked look at rest, so the clause is
10174
11469
  // its resting look with the checked one kept, never every state.
10175
11470
  for (let i = clauses.length - 1; i >= 0; i--) {
10176
11471
  const c = clauses[i];
11472
+ // (The same for "unselected": the resting look, selected kept.)
11473
+ const on = /** @type {Record<string, string>} */ ({
11474
+ unchecked: 'checked',
11475
+ unselected: 'selected',
11476
+ })[c.state ?? ''];
10177
11477
  if (
10178
- c.state !== 'unchecked' ||
11478
+ !on ||
10179
11479
  c.except ||
10180
11480
  !c.parts.length ||
10181
11481
  !c.parts.every(
10182
11482
  p =>
10183
- statesOf(p.on).includes('checked') &&
10184
- !statesOf(p.on).includes('unchecked'),
11483
+ statesOf(p.on).includes(on) &&
11484
+ !statesOf(p.on).includes(String(c.state)),
10185
11485
  )
10186
11486
  )
10187
11487
  continue;
10188
11488
  c.state = null;
11489
+ // (When the ask says the kept state's own look too, "selected tab text
11490
+ // white, unselected tabs gray", that clause writes it: nothing more to
11491
+ // keep.)
11492
+ const said = clauses.some(
11493
+ o =>
11494
+ o !== c &&
11495
+ !o.except &&
11496
+ o.state === on &&
11497
+ o.parts.some(p => c.parts.some(x => x.on === p.on)),
11498
+ );
10189
11499
  // (Its state words are read: the resting look, checked kept.)
11500
+ // (The whole state phrase goes, the "when it is" before it included,
11501
+ // so the words the answer repeats never end on a bare "when".)
10190
11502
  c.text = c.text
10191
11503
  .replace(
10192
- /\b(?:unchecked|not checked|unticked|when off|turned off|toggled off|switched off|is off)\b/g,
11504
+ /(?:\bwhen\s+(?:(?:it|they)\s+(?:is|are)\s+|it'?s\s+|they'?re\s+)?|\b(?:is|are)\s+)?\b(?:unchecked|not checked|unticked|off|turned off|toggled off|switched off|unselected|not selected|non-selected)\b/g,
10193
11505
  ' ',
10194
11506
  )
10195
11507
  .replace(/\s+/g, ' ')
10196
11508
  .trim();
11509
+ if (said) continue;
10197
11510
  clauses.splice(i + 1, 0, {
10198
11511
  ...c,
10199
- text: `except checked ${c.parts.map(p => p.on).join(' and ')}`,
11512
+ text: `except ${on} ${c.parts.map(p => p.on).join(' and ')}`,
10200
11513
  aspects: [],
10201
11514
  colors: [],
10202
11515
  lengths: [],
10203
11516
  dir: null,
10204
11517
  decl: {},
10205
- state: 'checked',
11518
+ state: on,
10206
11519
  except: true,
10207
11520
  });
10208
11521
  }
@@ -10257,8 +11570,107 @@ export function draftAnswer(ctx, env, question) {
10257
11570
  }
10258
11571
  }
10259
11572
  }
11573
+ // A subject how does not know ("lozenges: subtle gray background",
11574
+ // "flurbles bold"): a plural noun leading the clause, or its label, that
11575
+ // names no part, look, setting or color. That clause, and the clauses of
11576
+ // its list after it that name no part of their own, write nothing and
11577
+ // name the word: never the whole theme in its place.
11578
+ const subjectKnown = (/** @type {string} */ w) =>
11579
+ lex.vocab.includes(w) ||
11580
+ lex.vocab.includes(singular(w)) ||
11581
+ corrected(w, lex.vocab) !== w ||
11582
+ KEEP.has(w) ||
11583
+ Object.hasOwn(HUES, w) ||
11584
+ aspectsOf(w).length > 0 ||
11585
+ stateWord(w) != null ||
11586
+ colorsIn(w).length > 0 ||
11587
+ lex.parts.some(([re]) => re.test(` ${w} `)) ||
11588
+ /^(?:themes?|everything|everywhere|sites?|apps?|ui|pages?|modes?|colou?rs?|palettes?|brands?|looks?|vibes?|styles?|defaults?|things?|details?|elements?|components?|controls?|surfaces?|items?|words?|letters?|numbers?)$/.test(
11589
+ w,
11590
+ );
11591
+ const unknownSubject = (/** @type {Clause} */ c) => {
11592
+ if (c.parts.length || c.except || c.refused) return null;
11593
+ const t = c.text.toLowerCase().trim();
11594
+ const label = /^([a-z][a-z' -]{1,40}?)\s*:\s*\S/.exec(t)?.[1];
11595
+ const lead =
11596
+ label ??
11597
+ /^(?:the |my |our |all (?:the )?)?([a-z]{3,}s)\b(?=\s+\S)/.exec(t)?.[1];
11598
+ if (!lead) return null;
11599
+ const words = lead
11600
+ .split(/\s+/)
11601
+ .filter(
11602
+ w =>
11603
+ w &&
11604
+ !/^(?:the|my|our|all|every|its|their|this|that|these|those|a|an|and|of|for|in|on)$/.test(
11605
+ w,
11606
+ ),
11607
+ );
11608
+ // (A brand or product as the label, "Airbnb: accent …", is the theme's
11609
+ // look said after it; only a plural noun names things on the page. A
11610
+ // noun followed by what it does, "users complained …", tells; and
11611
+ // people and exclamations name nothing on the page.)
11612
+ const noun = words[words.length - 1] ?? '';
11613
+ const next = label
11614
+ ? ''
11615
+ : (t
11616
+ .slice(t.indexOf(lead) + lead.length)
11617
+ .trim()
11618
+ .split(/\s+/)[0] ?? '');
11619
+ if (
11620
+ /^(?:is|are|was|were|seems?|looks?|feels?|said|says|say|think|thinks|want|wants|need|needs|hate|hates|love|loves|like|likes|keep|keeps|[a-z]+ed)$/.test(
11621
+ next,
11622
+ ) ||
11623
+ /^(?:oops|whoops|yikes|thanks|users?|people|customers?|folks|clients?|guys|devs|designers?|friends?|readers?|visitors?)$/.test(
11624
+ noun,
11625
+ )
11626
+ )
11627
+ return null;
11628
+ if (!/[a-z]{2}[^su]s$/.test(noun) || words.some(subjectKnown)) return null;
11629
+ return lead;
11630
+ };
11631
+ // ("filled blue with white text on hover": a state said at the end of
11632
+ // a with-item is the state of the look it is with, so the fill and its
11633
+ // text are the hover look together, never a resting fill.)
11634
+ for (let i = clauses.length - 1; i >= 1; i--) {
11635
+ const [a, b] = [clauses[i - 1], clauses[i]];
11636
+ if (
11637
+ joinOf.get(b)?.sep === 'with' &&
11638
+ b.state &&
11639
+ !a.state &&
11640
+ !a.except &&
11641
+ a.parts.length &&
11642
+ b.parts.length &&
11643
+ b.parts.every(x => a.parts.some(y => y.on === x.on)) &&
11644
+ (a.colors.length || a.aspects.length) &&
11645
+ new RegExp(`\\b(?:on|when|while)\\s+${b.state}\\w*\\s*$`).test(b.text)
11646
+ )
11647
+ a.state = b.state;
11648
+ }
11649
+ /** The unknown subject a list is held under, until a clause leaves it. */
11650
+ let heldUnder = '';
10260
11651
  for (const c of clauses) {
10261
11652
  clauseNow = c;
11653
+ {
11654
+ const unknown = unknownSubject(c);
11655
+ if (
11656
+ heldUnder &&
11657
+ (unknown ||
11658
+ c.parts.length ||
11659
+ /[;\n.]|\bthen\b/.test(c.joint ?? '') ||
11660
+ /^[a-z][a-z' -]{1,40}:/.test(c.text.trim()))
11661
+ )
11662
+ heldUnder = '';
11663
+ if (unknown) heldUnder = unknown;
11664
+ if (heldUnder) {
11665
+ if (unknown)
11666
+ push({
11667
+ text: `no part is called "${unknown}" here, so nothing is written for "${c.text.trim()}"${clauses.some(x => x !== c && !x.parts.length && x.joint && !/[;\n.]/.test(x.joint)) ? ' or the list after it' : ''}; how --list parts names every part (a part's own name, "badges", "toasts", writes on it)`,
11668
+ options: [],
11669
+ lookup: `${HOW} --list parts`,
11670
+ });
11671
+ continue;
11672
+ }
11673
+ }
10262
11674
  // An element its place has no part of its own for: nothing is written,
10263
11675
  // and the answer says why.
10264
11676
  if (c.refused) {
@@ -11216,6 +12628,10 @@ export function draftAnswer(ctx, env, question) {
11216
12628
  continue;
11217
12629
  }
11218
12630
  if (!members || !k.when) continue;
12631
+ // A shadow kept in a state (a status's focus ring): the step it is
12632
+ // kept from writes that state on every member, so every member
12633
+ // keeps it, whether or not it draws a look of its own there.
12634
+ if (k.thing === 'box-shadow' && k.state) continue;
11219
12635
  // Any other property: a member with no look of its own under the
11220
12636
  // condition (a date input's error look, which its field draws)
11221
12637
  // keeps by inheriting, so it takes no pin.
@@ -11601,7 +13017,7 @@ export function draftAnswer(ctx, env, question) {
11601
13017
  now => {
11602
13018
  const n = parseColor(now);
11603
13019
  return n && n.every((x, i) => Math.abs(x - avoid[i]) <= 2)
11604
- ? nearOff(avoid)
13020
+ ? nearOff(avoid, themeNeutral)
11605
13021
  : null;
11606
13022
  },
11607
13023
  c,
@@ -12777,10 +14193,12 @@ export function draftAnswer(ctx, env, question) {
12777
14193
  const delta = new RegExp(
12778
14194
  `\\b(?:by|add(?:ing)?|plus|minus|subtract(?:ing)?)\\s+(\\d*\\.?\\d+)(px|rem|em)\\b|\\b(\\d*\\.?\\d+)(px|rem|em) (?:${COMPARATIVE})\\b`,
12779
14195
  ).exec(c.text);
14196
+ // ("divided by 1px lines": "by" alone names what does the dividing;
14197
+ // an amount needs a word that changes, "bigger by 2px".)
12780
14198
  if (
12781
14199
  delta &&
12782
14200
  new RegExp(
12783
- `\\b(by|add|adding|plus|minus|subtract|subtracting|increase|decrease|reduce|${COMPARATIVE})\\b`,
14201
+ `\\b(add|adding|plus|minus|subtract|subtracting|increase|decrease|reduce|${COMPARATIVE})\\b`,
12784
14202
  ).test(c.text)
12785
14203
  ) {
12786
14204
  const unit = delta[2] ?? delta[4];
@@ -13555,6 +14973,43 @@ export function draftAnswer(ctx, env, question) {
13555
14973
  for (const p of targets.slice(0, 3)) {
13556
14974
  for (const a of c.aspects.slice(0, 3)) {
13557
14975
  let d = answerFor(c, p, a);
14976
+ // The other reading of two states said together, as a second line:
14977
+ // each one alone for a condition list read at once ("the checked
14978
+ // and disabled checkboxes"), both at once for moment states read
14979
+ // as each ("hovered and pressed buttons").
14980
+ if (d?.options[0]?.length && p) {
14981
+ /** @param {Partial<Clause>} over */
14982
+ const reread = over => {
14983
+ const r = answerFor({...c, ...over}, p, a);
14984
+ const o = r?.options[0] ?? [];
14985
+ return o.length && env.check(o).ok ? o : null;
14986
+ };
14987
+ const prev = clauses[clauses.indexOf(c) - 1];
14988
+ /** @param {string} what @param {Step[]} steps */
14989
+ const other = (what, steps) =>
14990
+ otherReadings.push({
14991
+ text: `or ${what}: ${steps.map(st => renderStep(st, env.slug)).join(' && ')}`,
14992
+ options: [],
14993
+ });
14994
+ if (c.alsoState) {
14995
+ const one1 = reread({alsoState: null});
14996
+ const one2 = reread({state: c.alsoState, alsoState: null});
14997
+ if (one1 && one2) other('each state alone', [...one2, ...one1]);
14998
+ } else if (
14999
+ c.state &&
15000
+ prev?.state &&
15001
+ prev.state !== c.state &&
15002
+ !prev.alsoState &&
15003
+ MOMENT_STATES.includes(String(c.state)) &&
15004
+ MOMENT_STATES.includes(String(prev.state)) &&
15005
+ JSON.stringify(prev.parts) === JSON.stringify(c.parts) &&
15006
+ JSON.stringify(prev.colors) === JSON.stringify(c.colors) &&
15007
+ JSON.stringify(prev.aspects) === JSON.stringify(c.aspects)
15008
+ ) {
15009
+ const both = reread({state: prev.state, alsoState: c.state});
15010
+ if (both) other(`${prev.state} and ${c.state} at once`, both);
15011
+ }
15012
+ }
13558
15013
  // A part kept to its container ("buttons inside cards", "headings
13559
15014
  // in cards"): only a token the part reads, set on the container
13560
15015
  // (which the parts inside it read, and the container's own element
@@ -13752,6 +15207,9 @@ export function draftAnswer(ctx, env, question) {
13752
15207
  return {
13753
15208
  text: `${env.slug} sets nothing for ${what}${on ? ` on ${on}` : ''}, so it already uses the base value`,
13754
15209
  options: [],
15210
+ // (What the ask takes for granted, a setting to take back, that the
15211
+ // theme does not have.)
15212
+ unmet: `${what}${on ? ` on ${on}` : ''}`,
13755
15213
  };
13756
15214
  return {
13757
15215
  text: `take back what ${env.slug} sets for ${what}${on ? ` on ${on}` : ''}: undo restores the base value`,
@@ -14409,6 +15867,28 @@ export function draftAnswer(ctx, env, question) {
14409
15867
  const tokenNow = resolvedValue(st.thing) || current(st.thing);
14410
15868
  if (tokenNow) return set(st.thing, tokenNow, {...flags, on: p.on});
14411
15869
  }
15870
+ // A shadow asked in a state ("the focus ring on inputs, but keep the
15871
+ // invalid ones"): the kept part's shadow in that state, under its
15872
+ // kept status or variant, from what Core draws for it there; the
15873
+ // part's plain shadow in that state when the status draws none of
15874
+ // its own.
15875
+ if (st.thing === 'box-shadow' && st.state && !p.state) {
15876
+ const inState = Object.entries(
15877
+ C.MAP[one(p.on)]?.at?.['box-shadow'] ?? {},
15878
+ ).filter(([k]) =>
15879
+ new RegExp(`(?:^|\\s):${st.state}(?![\\w-])`).test(k),
15880
+ );
15881
+ const [axisName, axisValue] = String(p.when ?? '').split(':');
15882
+ const scoped = p.when
15883
+ ? inState.find(([k]) =>
15884
+ new RegExp(`\\b${axisName}=${axisValue}\\b`).test(k),
15885
+ )
15886
+ : undefined;
15887
+ const plain = inState.find(([k]) => !/\bstatus=/.test(k));
15888
+ const value = (scoped ?? plain)?.[1];
15889
+ if (value != null)
15890
+ return set('box-shadow', String(value), {...flags, state: st.state});
15891
+ }
14412
15892
  // The shadow it has now, written out (the tokens it reads may be set
14413
15893
  // to none in the same answer).
14414
15894
  // Its shadow at rest; none when it has none.
@@ -14520,12 +16000,21 @@ export function draftAnswer(ctx, env, question) {
14520
16000
  : ['background-color', 'background'];
14521
16001
  // (The variant's or status's own read in that state first: an error
14522
16002
  // input keeps its red when focused.)
16003
+ // (A state the part data records by its attribute, "checked=checked",
16004
+ // is that state too, as the pseudo-class ":checked" is.)
14523
16005
  const stateRead = (/** @type {string | null} */ need) =>
14524
16006
  C.partReads(one(p.on), group).find(
14525
16007
  r =>
14526
16008
  r.when.some(
14527
16009
  w =>
14528
- w.includes(`:${p.state}`) &&
16010
+ (w.includes(`:${p.state}`) ||
16011
+ w
16012
+ .split(/[ ,]/)
16013
+ .some(
16014
+ x =>
16015
+ x === `${p.state}=${p.state}` ||
16016
+ x === `${p.state}=true`,
16017
+ )) &&
14529
16018
  !/::before/.test(w) &&
14530
16019
  (!need || w.split(/[ ,]/).includes(need)),
14531
16020
  ) &&
@@ -14692,6 +16181,62 @@ export function draftAnswer(ctx, env, question) {
14692
16181
  : toks
14693
16182
  : toks;
14694
16183
  }
16184
+ /**
16185
+ * The part's own pieces inside it, by the census, that draw an aspect
16186
+ * the part itself draws none of: empty when the part draws it, or holds
16187
+ * no such piece of its own.
16188
+ * @param {string} on
16189
+ * @param {string} a
16190
+ * @returns {string[]}
16191
+ */
16192
+ function innerDrawing(on, a) {
16193
+ const props = GROUPS[a] ?? [];
16194
+ const rec = C.MAP[one(on)];
16195
+ if (!rec || props.length === 0) return [];
16196
+ /** @param {any} r */
16197
+ const draws = r =>
16198
+ props.some(x => r?.own?.[x] || r?.at?.[x]) ||
16199
+ Object.values(r?.inside ?? {}).some(ps =>
16200
+ /** @type {string[]} */ (ps).some(x => props.includes(x)),
16201
+ );
16202
+ if (draws(rec)) return [];
16203
+ // A piece whose own resting paint draws it, never one that paints it
16204
+ // only to mark a state (a nav item's selected fill, an option's
16205
+ // highlight) or through a hover or press layer inside it.
16206
+ /**
16207
+ * Whether a census condition is a resting look: always, or only the
16208
+ * piece's visual props (its size, its orientation), never a runtime
16209
+ * state, a pseudo-class or a layer.
16210
+ * @param {string} cond
16211
+ * @param {string} k
16212
+ */
16213
+ const resting = (cond, k) => {
16214
+ if (cond === 'always') return true;
16215
+ if (/[\s:[]/.test(cond)) return false;
16216
+ const visual = ctx.project.target.get(k)?.props ?? [];
16217
+ return cond
16218
+ .split(',')
16219
+ .every(pair => visual.includes(pair.split('=')[0] ?? ''));
16220
+ };
16221
+ /** @param {string} k */
16222
+ const drawsAtRest = k =>
16223
+ props.some(x =>
16224
+ Object.entries(C.MAP[k]?.at?.[x] ?? {}).some(
16225
+ ([cond, value]) =>
16226
+ resting(cond, k) &&
16227
+ !/^(transparent|none|)$/.test(String(value).trim()),
16228
+ ),
16229
+ );
16230
+ // Only the part's own pieces: a shared component inside it (an empty
16231
+ // state's Button) is never handed a change meant for the part.
16232
+ const owner = ctx.project.target.get(one(on))?.component;
16233
+ return (rec.contains ?? []).filter(
16234
+ k =>
16235
+ drawsAtRest(k) &&
16236
+ owner !== undefined &&
16237
+ ctx.project.target.get(k)?.component === owner,
16238
+ );
16239
+ }
14695
16240
  /**
14696
16241
  * The commands for one part (or the whole theme) and one aspect.
14697
16242
  * @param {Clause} c
@@ -14708,6 +16253,25 @@ export function draftAnswer(ctx, env, question) {
14708
16253
  const on = p?.on;
14709
16254
  const {noState, ...f} = p ? flagsFor(c, p) : {};
14710
16255
  if (noState && on) {
16256
+ // (The state is another part's, named by its own word in the ask,
16257
+ // "the date picker's selected day": the calendar day's, a part of the
16258
+ // plain component the place draws. Said, with its line, never
16259
+ // written: it reaches every one.)
16260
+ const other = [...ctx.project.target.keys()].filter(
16261
+ k =>
16262
+ k !== one(on) &&
16263
+ (ctx.project.target.get(k)?.states ?? []).includes(noState) &&
16264
+ new RegExp(`\\b(?:${ownWords(k)})s?\\b`).test(c.text),
16265
+ );
16266
+ if (other.length === 1) {
16267
+ const k = other[0];
16268
+ const comp = ctx.project.target.get(k)?.component ?? k;
16269
+ return {
16270
+ text: `${on} has no ${noState} state: the ${noState} ${k.split('-').at(-1)} is ${k}'s, a part of the plain ${comp}, so a change there reaches every ${comp.toLowerCase()}; nothing is written. To change every ${comp.toLowerCase()}'s ${noState} ${k.split('-').at(-1)} instead, set it --on ${k} --state ${noState}`,
16271
+ options: [],
16272
+ lookup: `${HOW} ${k}`,
16273
+ };
16274
+ }
14711
16275
  return {
14712
16276
  text: `${on} has no ${noState} state that set can name (its states: ${statesOf(on).join(', ') || 'none'}), so a change would reach every ${on}`,
14713
16277
  options: [],
@@ -14727,14 +16291,29 @@ export function draftAnswer(ctx, env, question) {
14727
16291
  ? ['box-shadow']
14728
16292
  : ['border', 'border-color', 'border-width', 'border-style'];
14729
16293
  const rec = C.MAP[one(on)];
16294
+ // (Only a part its component draws inside the overlay, never one
16295
+ // that stands alone, a divider, nor one that draws a line of its
16296
+ // own.)
16297
+ const comp = ctx.project.target.get(one(on))?.component;
16298
+ const standalone =
16299
+ !comp ||
16300
+ ctx.project.components[String(comp)]?.targets?.[0]?.className ===
16301
+ `astryx-${one(on)}`;
14730
16302
  const holder =
14731
- rec && !props.some(x => rec.own?.[x] || rec.at?.[x])
16303
+ rec &&
16304
+ !standalone &&
16305
+ !(rec.line ?? []).length &&
16306
+ !props.some(x => rec.own?.[x] || rec.at?.[x])
14732
16307
  ? Object.keys(C.MAP)
14733
16308
  .filter(
14734
16309
  k =>
14735
16310
  k !== one(on) &&
14736
16311
  (C.MAP[k].contains ?? []).includes(one(on)) &&
14737
- props.some(x => C.MAP[k].own?.[x]) &&
16312
+ // (Its edge: the overlay's own shadow; for a border, the
16313
+ // surface it paints, whose edge the list sits inside.)
16314
+ (a === 'shadow'
16315
+ ? props.some(x => C.MAP[k].own?.[x])
16316
+ : Boolean(C.MAP[k].own?.['background-color'])) &&
14738
16317
  ctx.project.components[
14739
16318
  String(ctx.project.target.get(k)?.component ?? '')
14740
16319
  ]?.category === 'Overlay',
@@ -14747,7 +16326,7 @@ export function draftAnswer(ctx, env, question) {
14747
16326
  : undefined;
14748
16327
  if (holder)
14749
16328
  return {
14750
- text: `${on} draws no ${a} of its own: the ${holder} it opens in draws it, and a change on ${holder} reaches every ${holder}; nothing is written. To change every ${holder}'s ${a}, set it --on ${holder}`,
16329
+ text: `${on} draws no ${a} of its own: the ${holder} it opens in ${a === 'shadow' ? 'draws it' : 'is the surface whose edge it is'}, and a change on ${holder} reaches every ${holder}; nothing is written. To change every ${holder}'s ${a}, set it --on ${holder}`,
14751
16330
  options: [],
14752
16331
  lookup: `${HOW} ${holder}`,
14753
16332
  };
@@ -15360,6 +16939,20 @@ export function draftAnswer(ctx, env, question) {
15360
16939
  ],
15361
16940
  sequence: true,
15362
16941
  };
16942
+ // (A color word in neither mode's lightness, with no text said with
16943
+ // it: each mode's page takes it at its own.)
16944
+ const tones = pageTones(c, String(color));
16945
+ if (tones)
16946
+ return {
16947
+ text: `the page background: --color-background-body, ${color}'s color at each mode's own page lightness (${tones.light} in light mode, ${tones.dark} in dark mode), so both pages keep their text readable`,
16948
+ options: [
16949
+ [
16950
+ set('--color-background-body', tones.light, {mode: 'light'}),
16951
+ set('--color-background-body', tones.dark, {mode: 'dark'}),
16952
+ ],
16953
+ ],
16954
+ sequence: true,
16955
+ };
15363
16956
  return {
15364
16957
  text: `the page background: --color-background-body${pageModeSaid(c, pageMode)}${panel ? `; the main panel (layout-content) draws ${panel} over it, so the second line paints the frame and the main panel too` : ''}`,
15365
16958
  options: [
@@ -15743,12 +17336,33 @@ export function draftAnswer(ctx, env, question) {
15743
17336
  ),
15744
17337
  ) &&
15745
17338
  !/\b(background|bg|fill(ed)?|gradient)\b/.test(c.text)
15746
- )
17339
+ ) {
17340
+ // A part that draws none of what is asked hands it to the one part
17341
+ // inside it that draws it (a keyboard shortcut's fill, drawn by its
17342
+ // key badges); with several such parts, nothing is written and the
17343
+ // answer names them.
17344
+ const inner = innerDrawing(on, a);
17345
+ if (inner.length === 1) {
17346
+ /** @type {Draft | null} */
17347
+ const d = answerFor(c, {on: inner[0]}, a);
17348
+ if (d)
17349
+ return {
17350
+ ...d,
17351
+ text: `${on} draws no fill of its own: the ${inner[0]} inside it draws it, so on ${inner[0]}. ${d.text}`,
17352
+ };
17353
+ }
17354
+ if (inner.length > 1)
17355
+ return {
17356
+ text: `${on} draws no fill of its own; the parts inside it that draw it: ${inner.join(', ')}. Name one with --on; nothing is written`,
17357
+ options: [],
17358
+ lookup: `${HOW} ${on}`,
17359
+ };
15747
17360
  return {
15748
17361
  text: `${on} reads no fill or text color token that set can change; its color comes from its own props`,
15749
17362
  options: [],
15750
17363
  lookup: `${HOW} ${on}`,
15751
17364
  };
17365
+ }
15752
17366
  if (p?.role === 'body' && a === 'weight') {
15753
17367
  const v =
15754
17368
  weightIn(c) ??
@@ -16080,6 +17694,48 @@ export function draftAnswer(ctx, env, question) {
16080
17694
  };
16081
17695
  }
16082
17696
  case 'corners': {
17697
+ // ("4px top corners", "square bottom corners", "round the left
17698
+ // corners 8px": the corners on those sides only, each its own
17699
+ // longhand, start and end in the writing direction.)
17700
+ {
17701
+ const sides = [
17702
+ ...new Set(
17703
+ [
17704
+ ...c.text.matchAll(
17705
+ /\b(top|bottom|left|right)\b(?=[\w\s-]*\bcorners?\b)|\bcorners?\b[\w\s-]*?\b(?:on|at|along) (?:the )?(top|bottom|left|right)\b/g,
17706
+ ),
17707
+ ].map(m => m[1] ?? m[2]),
17708
+ ),
17709
+ ];
17710
+ const sidePx = /\b(square|sharp)\b/.test(c.text)
17711
+ ? '0'
17712
+ : (c.lengths.find(l => /^\d*\.?\d+(?:px|rem|em)$/.test(l)) ?? null);
17713
+ // (A step rounder moves every corner: for some only, a size.)
17714
+ if (on && sides.length && c.dir && !sidePx)
17715
+ return {
17716
+ text: `a step ${c.dir === 'more' ? 'rounder' : 'sharper'} moves every corner of ${on}; for the ${sides.join(' and ')} corners only, give a size ("8px ${sides[0]} corners")`,
17717
+ options: [],
17718
+ lookup: `${HOW} ${on}`,
17719
+ };
17720
+ if (on && sides.length && sidePx && !c.dir) {
17721
+ const LONG = /** @type {Record<string, string[]>} */ ({
17722
+ top: ['start-start', 'start-end'],
17723
+ bottom: ['end-start', 'end-end'],
17724
+ left: ['start-start', 'end-start'],
17725
+ right: ['start-end', 'end-end'],
17726
+ });
17727
+ const corners = [...new Set(sides.flatMap(x => LONG[x]))];
17728
+ return {
17729
+ text: `the ${sides.join(' and ')} corners on ${on}: ${sidePx === '0' ? 'square' : sidePx}, the other corners as they are`,
17730
+ options: [
17731
+ corners.map(k =>
17732
+ set(`border-${k}-radius`, sidePx, {...f, ...modeOf(c)}),
17733
+ ),
17734
+ ],
17735
+ sequence: corners.length > 1,
17736
+ };
17737
+ }
17738
+ }
16083
17739
  const tall = tallIn(c.text);
16084
17740
  const tied = radiusIn(c.text);
16085
17741
  // "1.5 times bigger": an amount, never a radius.
@@ -16884,28 +18540,25 @@ export function draftAnswer(ctx, env, question) {
16884
18540
  sequence: steps.length > 1,
16885
18541
  };
16886
18542
  }
16887
- // Darker, lighter, subtler or more contrast asks for the color.
18543
+ // Darker, lighter, subtler, more contrast or how visible (or
18544
+ // transparent) asks for the color.
18545
+ const seen = visibilityAsk(c.text);
16888
18546
  if (
16889
- /\b(darker|lighter|subtle\w*|contrast|stronger|fainter|softer|visible|invisible|too (dark|light|faint|strong|harsh|heavy))\b/.test(
18547
+ seen ||
18548
+ /\b(darker|lighter|subtle\w*|contrast|stronger|fainter|softer|too (dark|light|faint|strong|harsh|heavy))\b/.test(
16890
18549
  c.text,
16891
18550
  )
16892
18551
  ) {
16893
18552
  // "too light" asks for stronger borders, "too dark" for fainter.
16894
18553
  // Visibility is the border's strength: "less visible", "half as
16895
- // visible", "barely visible" are fainter, by the share named.
16896
- const lessVisible =
16897
- /\b(?:less|half as|barely|hardly|not as|a lot less|much less)\s+visible\b|\binvisible\b/.test(
16898
- c.text,
16899
- );
16900
- const more =
16901
- (/\b(darker|stronger|more contrast|visible|too (light|faint|subtle))\b/.test(
16902
- c.text,
16903
- ) &&
16904
- !lessVisible) ||
16905
- false;
16906
- const visibleBy = /\bvisible\b/.test(c.text)
16907
- ? exactFactor(c.text)
16908
- : null;
18554
+ // visible", "more transparent" are fainter, "half as
18555
+ // transparent" stronger, by the share named (visibilityAsk).
18556
+ const more = seen
18557
+ ? seen.stronger
18558
+ : /\b(darker|stronger|more contrast|too (light|faint|subtle))\b/.test(
18559
+ c.text,
18560
+ );
18561
+ const visibleBy = seen?.by ?? null;
16909
18562
  // A named mode with darker or lighter moves the border that way
16910
18563
  // as it paints on that mode's page ("lighter in dark mode" is
16911
18564
  // more of a light ink); otherwise darker is more contrast.
@@ -16988,15 +18641,68 @@ export function draftAnswer(ctx, env, question) {
16988
18641
  return null;
16989
18642
  const color = colorFor(c, 'border');
16990
18643
  const w = c.lengths[0];
16991
- const fl = {...f, state: f.state ?? 'focus-visible'};
16992
- /** @type {Step[]} */
16993
- const steps = [
16994
- ...(color ? [set('outline-color', color, fl)] : []),
16995
- ...(w ? [set('outline-width', w, fl)] : []),
16996
- ...(c.neg ? [set('outline', 'none', fl)] : []),
16997
- ];
16998
- return steps.length
16999
- ? {
18644
+ // A ring said with no focus ("cards: 1px ring #e5e7eb", as a
18645
+ // ring is written in CSS utilities) is a ring at rest: a
18646
+ // box-shadow of that width and color; the focus ring only when
18647
+ // focus is said.
18648
+ const focusSaid =
18649
+ Boolean(f.state && /focus/.test(f.state)) ||
18650
+ /\bfocus(?:ed|ing|-visible|-within)?\b/.test(c.text);
18651
+ if (on && !focusSaid && !c.neg && color) {
18652
+ // The ring goes in front of the shadow the part shows now (the
18653
+ // theme's own, else the shadow token Core draws it with), so
18654
+ // its own shadow stays, as an input's ring sits beside its
18655
+ // bevel.
18656
+ const ring = `0 0 0 ${w ?? '1px'} ${color}`;
18657
+ const rests = C.partReads(one(on), 'shadow') ?? [];
18658
+ const coreShadow = (
18659
+ rests.find(
18660
+ r =>
18661
+ r.props.includes('box-shadow') &&
18662
+ r.when.includes(f.when ?? '') &&
18663
+ /^--shadow-/.test(r.token),
18664
+ ) ??
18665
+ rests.find(
18666
+ r =>
18667
+ r.props.includes('box-shadow') &&
18668
+ r.when.includes('') &&
18669
+ /^--shadow-/.test(r.token),
18670
+ )
18671
+ )?.token;
18672
+ // (What Core draws there at rest, as the census read it: the
18673
+ // render asked for, else its first render with no state; a
18674
+ // card's ring and elevation layers stay in it.)
18675
+ const drawn = Object.entries(
18676
+ C.MAP[one(on)]?.at?.['box-shadow'] ?? {},
18677
+ ).filter(([k]) => !/:/.test(k));
18678
+ const coreDrawn = ((f.when
18679
+ ? drawn.find(([k]) =>
18680
+ k.split(',').includes(String(f.when).replace(':', '=')),
18681
+ )
18682
+ : undefined) ?? drawn[0])?.[1];
18683
+ const shows =
18684
+ (f.state || c.mode || f.when
18685
+ ? null
18686
+ : partValue(on, 'box-shadow')) ??
18687
+ coreDrawn ??
18688
+ (coreShadow ? `var(${coreShadow})` : null);
18689
+ const keep = shows && !/^\s*none\s*$/i.test(shows) ? shows : null;
18690
+ return {
18691
+ text: `a ring at rest${where}: box-shadow ${ring}${keep ? `, in front of the shadow it shows now (${keep})` : ''}, shown always (for the ring shown while focused, say "focus ring")`,
18692
+ options: [
18693
+ [set('box-shadow', keep ? `${ring}, ${keep}` : ring, f)],
18694
+ ],
18695
+ };
18696
+ }
18697
+ const fl = {...f, state: f.state ?? 'focus-visible'};
18698
+ /** @type {Step[]} */
18699
+ const steps = [
18700
+ ...(color ? [set('outline-color', color, fl)] : []),
18701
+ ...(w ? [set('outline-width', w, fl)] : []),
18702
+ ...(c.neg ? [set('outline', 'none', fl)] : []),
18703
+ ];
18704
+ return steps.length
18705
+ ? {
17000
18706
  text: `the focus ring${where}: the outline`,
17001
18707
  options: [steps],
17002
18708
  sequence: steps.length > 1,
@@ -17169,9 +18875,7 @@ export function draftAnswer(ctx, env, question) {
17169
18875
  // at a lower alpha, on the part (the looks that draw no border
17170
18876
  // stay without one); a part that draws none has none to fade.
17171
18877
  if (
17172
- /\b(?:less (?:visible|noticeable|prominent|obvious)|half as (?:visible|noticeable|strong)|fainter|subtler|more (?:transparent|see-through)|weaker)\b/.test(
17173
- c.text,
17174
- ) &&
18878
+ visibilityAsk(c.text)?.stronger === false &&
17175
18879
  !/\b(?:thin|thick|width|wide|px)\w*/.test(c.text)
17176
18880
  ) {
17177
18881
  const read = restRead(C.partReads(one(on), 'border'), f.when);
@@ -17404,7 +19108,9 @@ export function draftAnswer(ctx, env, question) {
17404
19108
  };
17405
19109
  }
17406
19110
  }
17407
- if (!hasBorder && color && !style && !side) {
19111
+ // ("dialogs with a 1px border #23252a": a width said asks for the
19112
+ // part's own edge, never only its inner lines' color.)
19113
+ if (!hasBorder && color && !style && !side && !c.lengths.length) {
17408
19114
  const lineRead = (/** @type {{props: string[]}} */ r) =>
17409
19115
  r.props.some(x =>
17410
19116
  /^border(-(top|bottom|left|right))?(-color)?$/.test(x),
@@ -17566,8 +19272,20 @@ export function draftAnswer(ctx, env, question) {
17566
19272
  })(),
17567
19273
  }
17568
19274
  : {
17569
- text: `${on} draws no border now: a border in ${c.mode} mode only would take its width in the other mode too, and ${on} draws a shadow of its own, so a ring in its box-shadow would take that away`,
17570
- options: [],
19275
+ // (No ring where the part draws its own shadow: the border
19276
+ // itself, its color see-through in the other mode, where it
19277
+ // keeps an edge of that width it does not show.)
19278
+ text: `a border${where}, in ${c.mode} mode only: ${on} draws a shadow of its own, so no ring inside its edge; the border's color is see-through in the ${c.mode === 'light' ? 'dark' : 'light'} mode, which keeps an unseen ${width ?? '1px'} edge`,
19279
+ options: [
19280
+ [
19281
+ set(
19282
+ prop,
19283
+ `${width ?? '1px'} solid light-dark(${c.mode === 'light' ? `${lineColor}, transparent` : `transparent, ${lineColor}`})`,
19284
+ f,
19285
+ ),
19286
+ ],
19287
+ ],
19288
+ ...(c.mode ? {modeInValue: true} : {}),
17571
19289
  };
17572
19290
  }
17573
19291
  return {
@@ -17595,6 +19313,23 @@ export function draftAnswer(ctx, env, question) {
17595
19313
  ? null
17596
19314
  : c.lengths.find(l => !/%$/.test(l));
17597
19315
  const gap = /\b(gaps?|between)\b/.test(c.text);
19316
+ // ("list items more spacing between them": the room between the
19317
+ // items is the gap of the part that holds them. A way with no
19318
+ // amount is no step of the holder's whole room, which also pads
19319
+ // it: its gap is named, for a value.)
19320
+ const between = /** @type {{between?: string}} */ (
19321
+ c.parts.find(x => x.on === on) ?? {}
19322
+ ).between;
19323
+ if (between && !px && !pctLength) {
19324
+ const gapRead = (C.partReads(one(String(on)), 'spacing') ?? []).find(
19325
+ r => r.props.some(x => /^(?:row-)?gap$/.test(x)),
19326
+ );
19327
+ return {
19328
+ text: `the room between ${between}s is ${on}'s gap${gapRead ? ` (${gapRead.token}, now ${current(gapRead.token)})` : ''}, not ${between}'s padding: give it a value, such as gap 8px --on ${on}`,
19329
+ options: [],
19330
+ lookup: `${HOW} ${on}`,
19331
+ };
19332
+ }
17598
19333
  // The way the words give, if any.
17599
19334
  const way =
17600
19335
  new RegExp(`\\b(?:${densityWords('roomy', 'crowded')})\\b`).test(
@@ -17898,6 +19633,69 @@ export function draftAnswer(ctx, env, question) {
17898
19633
  options: [[set(gap ? 'gap' : 'padding', stepped, f)]],
17899
19634
  };
17900
19635
  }
19636
+ // A part whose rows are as tall as the parts inside it pad them (a
19637
+ // table row, its cells): tighter is those parts' block padding one
19638
+ // spacing step down, which shows; the spacing dial's step scales
19639
+ // everything inside and barely moves a row.
19640
+ const rowPad =
19641
+ value === 'less' && on && !FAMILIES[on] && !f.state && !f.when
19642
+ ? (() => {
19643
+ const own = ctx.project.target.get(one(on))?.component;
19644
+ const inner = [one(on), ...(C.MAP[one(on)]?.contains ?? [])]
19645
+ .filter(
19646
+ k =>
19647
+ ctx.project.target.get(k)?.component === own &&
19648
+ C.MAP[k]?.at?.['padding-block'],
19649
+ )
19650
+ .map(k => {
19651
+ const v = Object.values(
19652
+ C.MAP[k]?.at?.['padding-block'] ?? {},
19653
+ )[0];
19654
+ return {
19655
+ k,
19656
+ tok: /var\((--spacing-[\w-]+)\)/.exec(String(v))?.[1],
19657
+ };
19658
+ })
19659
+ .filter(x => x.tok);
19660
+ if (!inner.length || inner.some(x => x.tok !== inner[0].tok))
19661
+ return null;
19662
+ const px = (/** @type {string} */ t) =>
19663
+ lengthPx(String(resolvedValue(t) || current(t) || ''));
19664
+ const now = px(/** @type {string} */ (inner[0].tok));
19665
+ if (now == null) return null;
19666
+ const down = Object.keys(TOKENS)
19667
+ .filter(t => /^--spacing-[\d-]+$/.test(t))
19668
+ .map(t => ({t, v: px(t)}))
19669
+ .filter(x => x.v != null && x.v < now && x.v > 0)
19670
+ .sort((a, b) => Number(b.v) - Number(a.v))[0];
19671
+ return down
19672
+ ? {
19673
+ parts: inner.map(x => x.k),
19674
+ from: inner[0].tok,
19675
+ to: down.t,
19676
+ by: 2 * (now - Number(down.v)),
19677
+ }
19678
+ : null;
19679
+ })()
19680
+ : null;
19681
+ // (The spacing dial's step on the part leads: it reaches every row.
19682
+ // The block padding of the cells that set a row's height, one
19683
+ // spacing step down, is the second line: it shows more, the body
19684
+ // cells first, never the header alone.)
19685
+ if (rowPad) {
19686
+ const cells = [...rowPad.parts].sort(
19687
+ (x, y) => Number(/header/.test(x)) - Number(/header/.test(y)),
19688
+ );
19689
+ return {
19690
+ text: `${on} tighter: spacing ${value} on ${on} (one step of the room inside it); for more, the second line sets the block padding of ${cells.join(' and ')}, which set its height, one spacing step down (${rowPad.from} to ${rowPad.to}), ${rowPad.by}px less per row`,
19691
+ options: [
19692
+ [set('spacing', value, stepOk ? stepFlags : {on})],
19693
+ cells.map(k =>
19694
+ set('padding-block', `var(${rowPad.to})`, {on: k}),
19695
+ ),
19696
+ ],
19697
+ };
19698
+ }
17901
19699
  return {
17902
19700
  text: `room inside ${on}: spacing ${value} (padding, gaps and heights inside it; one step${padFactor ? ', not an exact amount: give a value, such as 24px, for one' : ''})`,
17903
19701
  options: [[set('spacing', value, stepOk ? stepFlags : {on})]],
@@ -18945,28 +20743,38 @@ export function draftAnswer(ctx, env, question) {
18945
20743
  };
18946
20744
  }
18947
20745
  }
18948
- if (tall)
18949
- return {
18950
- text: `the height${where}: min-height ${tall}${rowsSized && FAMILIES[on] ? ` (never one fixed height: ${(FAMILIES[on] ?? []).filter(m => !(C.partReads(m, 'size') ?? []).some(r => /^--size-/.test(r.token))).join(', ')} take their height from their content or rows)` : ''}`,
18951
- options: [
18952
- [set('min-height', tall, f)],
18953
- ...(rowsSized && FAMILIES[on] ? [] : [[set('height', tall, f)]]),
18954
- ],
18955
- };
18956
- if (on === 'progress-bar-fill' || on === 'progress-bar-track')
20746
+ // A progress bar's height is its track's, a height said in px or a
20747
+ // way ("4px tall", "thinner"): the fill runs the track's height, so
20748
+ // a height on the fill draws a strip over the unchanged track. Only
20749
+ // the fill named as the fill ("the progress fill 4px") is the fill.
20750
+ if (
20751
+ (on === 'progress-bar-track' ||
20752
+ (on === 'progress-bar-fill' &&
20753
+ !/\b(fill|filled|indicator)\b/.test(c.text))) &&
20754
+ !f.state
20755
+ )
18957
20756
  return {
18958
20757
  text: 'the progress bar thickness: the height of its track',
18959
20758
  options: [
18960
20759
  [
18961
20760
  set(
18962
20761
  'height',
18963
- c.lengths[0] ??
20762
+ tall ??
20763
+ c.lengths[0] ??
18964
20764
  (c.dir === 'less' || /\bthin/.test(c.text) ? '2px' : '8px'),
18965
20765
  {on: 'progress-bar-track'},
18966
20766
  ),
18967
20767
  ],
18968
20768
  ],
18969
20769
  };
20770
+ if (tall)
20771
+ return {
20772
+ text: `the height${where}: min-height ${tall}${rowsSized && FAMILIES[on] ? ` (never one fixed height: ${(FAMILIES[on] ?? []).filter(m => !(C.partReads(m, 'size') ?? []).some(r => /^--size-/.test(r.token))).join(', ')} take their height from their content or rows)` : ''}`,
20773
+ options: [
20774
+ [set('min-height', tall, f)],
20775
+ ...(rowsSized && FAMILIES[on] ? [] : [[set('height', tall, f)]]),
20776
+ ],
20777
+ };
18970
20778
  if (
18971
20779
  /\b(wider|narrower|width|wide)\b/.test(c.text) &&
18972
20780
  !/\bborder[- ]width\b/.test(c.text)
@@ -19302,7 +21110,7 @@ export function draftAnswer(ctx, env, question) {
19302
21110
  const n = parseColor(now);
19303
21111
  if (!avoid || !n || n.some((x, i) => Math.abs(x - avoid[i]) > 2))
19304
21112
  return null;
19305
- return nearOff(avoid);
21113
+ return nearOff(avoid, themeNeutral);
19306
21114
  };
19307
21115
  const own = restRead(C.partReads(one(on), 'text'), f.when);
19308
21116
  const steps =
@@ -19337,7 +21145,7 @@ export function draftAnswer(ctx, env, question) {
19337
21145
  n.some((x, i) => Math.abs(x - avoid[i]) > 2)
19338
21146
  )
19339
21147
  return null;
19340
- return nearOff(avoid);
21148
+ return nearOff(avoid, themeNeutral);
19341
21149
  },
19342
21150
  c,
19343
21151
  );
@@ -19457,7 +21265,7 @@ export function draftAnswer(ctx, env, question) {
19457
21265
  };
19458
21266
  if (on === 'link' && color) {
19459
21267
  // (A link color one mode's page would make unreadable, a dark
19460
- // blue on the dark page under 2:1, is set for the other mode
21268
+ // blue on the dark page under 2.5:1, is set for the other mode
19461
21269
  // only, as the text color is; said.)
19462
21270
  const rgb = parseColor(color);
19463
21271
  const readable = /** @type {Array<'light' | 'dark'>} */ ([
@@ -19465,7 +21273,7 @@ export function draftAnswer(ctx, env, question) {
19465
21273
  'dark',
19466
21274
  ]).filter(m => {
19467
21275
  const page = parseColor(current('--color-background-body', m));
19468
- return !rgb || !page || ratio(rgb, page) >= 2;
21276
+ return !rgb || !page || ratio(rgb, page) >= 2.5;
19469
21277
  });
19470
21278
  const oneMode =
19471
21279
  !c.mode &&
@@ -19635,8 +21443,15 @@ export function draftAnswer(ctx, env, question) {
19635
21443
  };
19636
21444
  }
19637
21445
  // A part that takes its color from a prop (a heading): the text
19638
- // token, on that part only.
19639
- if (!env.check([set('color', color, f)]).ok)
21446
+ // token, on that part only. (A color it already has is said so,
21447
+ // never read as a prop.)
21448
+ const colorCheck = env.check([set('color', color, f)]);
21449
+ if (!colorCheck.ok && /^it changes nothing/.test(colorCheck.why ?? ''))
21450
+ return {
21451
+ text: `the text color${where} is ${color} already, so nothing changes`,
21452
+ options: [],
21453
+ };
21454
+ if (!colorCheck.ok)
19640
21455
  return {
19641
21456
  text: `the text color${where}: --color-text-primary on ${on} only (${on} takes its color from a prop, so a color property never shows)`,
19642
21457
  options: [
@@ -19674,11 +21489,39 @@ export function draftAnswer(ctx, env, question) {
19674
21489
  // A state Core paints with an inline style from a token (a selected
19675
21490
  // table row's wash): that token, on the part in that state.
19676
21491
  const inlinePart = on ? one(on) : null;
21492
+ // (In two states at once where one is the inline one, a selected
21493
+ // row hovered: that token, in the other state; the wash is the
21494
+ // token's value there, so only the rows in the inline state show
21495
+ // it.)
21496
+ const pieces = String(f.state ?? '').split('+');
21497
+ const inlineState =
21498
+ inlinePart && pieces.length === 2
21499
+ ? pieces.find(
21500
+ p => C.MAP[inlinePart]?.inline?.[p]?.['background-color'],
21501
+ )
21502
+ : undefined;
19677
21503
  const inlineToken =
19678
21504
  inlinePart && f.state
19679
- ? C.MAP[inlinePart]?.inline?.[f.state]?.['background-color']
21505
+ ? (C.MAP[inlinePart]?.inline?.[inlineState ?? f.state]?.[
21506
+ 'background-color'
21507
+ ] ?? null)
19680
21508
  : null;
19681
21509
  const inlineColor = inlineToken ? colorFor(c, 'fill') : null;
21510
+ if (inlinePart && inlineToken && inlineColor && inlineState) {
21511
+ const other = pieces.find(p => p !== inlineState);
21512
+ return {
21513
+ text: `the background${where}: ${inlineToken}, which Core paints ${inlinePart} with when ${inlineState}, set for ${other}, so a ${inlineState} ${inlinePart} shows it when ${other}`,
21514
+ options: [
21515
+ [
21516
+ set(inlineToken, inlineColor, {
21517
+ on: inlinePart,
21518
+ state: other,
21519
+ ...modeOf(c),
21520
+ }),
21521
+ ],
21522
+ ],
21523
+ };
21524
+ }
19682
21525
  if (inlinePart && inlineToken && inlineColor)
19683
21526
  return {
19684
21527
  text: `the background${where}: ${inlineToken}, which Core paints ${inlinePart} with when ${f.state}`,
@@ -19732,7 +21575,40 @@ export function draftAnswer(ctx, env, question) {
19732
21575
  [set(innerOnly, innerColor, {on: innerPart, ...modeOf(c)})],
19733
21576
  ],
19734
21577
  };
19735
- if (/\bstripe[sd]?\b|\bstriped\b|\bzebra\b/.test(c.text)) {
21578
+ // The stripe a table row carries (its `parity`, odd or even, as
21579
+ // Core marks body rows), when the installed Core marks it and the
21580
+ // clause's own part is that row: the values are the part data's, so
21581
+ // an ask naming one as a row qualifier ("odd rows", "the even ones")
21582
+ // is a stripe ask too. A part with no stripe ("card background even
21583
+ // lighter", "alternate button background") never is. A stripe ask
21584
+ // that names no part ("zebra stripes") is a table row's.
21585
+ const ownPart = on ? one(on) : null;
21586
+ /** @param {string} p */
21587
+ const striping = p => (C.variantValues(p)?.parity ?? []).length > 0;
21588
+ const rowParity = striping('table-row') ? 'table-row' : null;
21589
+ const parityOn = ownPart
21590
+ ? striping(ownPart)
21591
+ ? ownPart
21592
+ : null
21593
+ : /\bstripe[sd]?\b|\bstriped\b|\bzebra\b/.test(c.text)
21594
+ ? rowParity
21595
+ : null;
21596
+ const parities = parityOn
21597
+ ? /** @type {string[]} */ (C.variantValues(parityOn).parity)
21598
+ : [];
21599
+ /** @param {string} text */
21600
+ const paritiesSaid = text =>
21601
+ parities.filter(v =>
21602
+ new RegExp(
21603
+ `\\b${v}(?:-numbered)?\\s+(?:table\\s+)?(?:rows?|ones?)\\b`,
21604
+ ).test(noMode(text)),
21605
+ );
21606
+ const paritySaid = paritiesSaid(c.text);
21607
+ if (
21608
+ /\bstripe[sd]?\b|\bstriped\b|\bzebra\b/.test(c.text) ||
21609
+ (parityOn &&
21610
+ (stripeNamesOf(ctx.project)(c.text) || paritySaid.length === 1))
21611
+ ) {
19736
21612
  // The token Core paints every other row with, read from the part
19737
21613
  // data (a row's fill under an nth-child condition): set on the part,
19738
21614
  // it colors the stripes alone, and transparent takes them away.
@@ -19744,12 +21620,50 @@ export function draftAnswer(ctx, env, question) {
19744
21620
  r.when.some(w => /:nth-child\(/.test(w)),
19745
21621
  ),
19746
21622
  ) ?? null;
19747
- const stripe = stripeOn
21623
+ const stripeRead = stripeOn
19748
21624
  ? C.partReads(stripeOn, 'background').find(r =>
19749
21625
  r.when.some(w => /:nth-child\(/.test(w)),
19750
- )?.token
21626
+ )
19751
21627
  : null;
21628
+ const stripe = stripeRead?.token ?? null;
21629
+ // The rows Core's own stripe is on, read from its condition.
21630
+ const coreParity =
21631
+ stripeRead?.when
21632
+ .map(w => /:nth-child\((odd|even)\b/.exec(w)?.[1])
21633
+ .find(Boolean) ?? null;
19752
21634
  const value = c.neg ? 'transparent' : colorFor(c, 'fill');
21635
+ // One stripe named ("odd rows #f9f9f9", "zebra rows, odd ones
21636
+ // shaded"): that stripe's fill on the row, in every table, and the
21637
+ // other stripe of a striped table cleared, where Core draws its
21638
+ // own. A theme with no stripe of its own and no color keeps Core's.
21639
+ if (parityOn && paritySaid.length === 1 && value) {
21640
+ const p = paritySaid[0];
21641
+ const other = parities.find(v => v !== p);
21642
+ const steps = [
21643
+ set('background-color', value, {
21644
+ on: parityOn,
21645
+ when: `parity:${p}`,
21646
+ ...modeOf(c),
21647
+ }),
21648
+ ...(!c.neg && coreParity && other === coreParity
21649
+ ? [
21650
+ set('background-color', 'transparent', {
21651
+ on: parityOn,
21652
+ when: `parity:${other}`,
21653
+ state: 'striped',
21654
+ ...modeOf(c),
21655
+ }),
21656
+ ]
21657
+ : []),
21658
+ ];
21659
+ return {
21660
+ text: c.neg
21661
+ ? `no stripe on the ${p} rows of ${parityOn}. On a table with hover those rows lose Core's hover color too`
21662
+ : `a stripe on the ${p} rows of ${parityOn} (the first body row is odd), in every data-driven table${steps.length > 1 ? `; the ${other} rows of a striped table, where Core paints its own stripe, are cleared` : ''}. On a table with hover the stripe${steps.length > 1 ? ' and the cleared rows' : ''} cover Core's hover color; add --state striped to stripe only the tables the app marks isStriped`,
21663
+ options: [steps],
21664
+ sequence: steps.length > 1,
21665
+ };
21666
+ }
19753
21667
  if (stripeOn && stripe && value)
19754
21668
  return {
19755
21669
  text: `${c.neg ? 'no stripes' : 'the stripe color'} on ${stripeOn}: ${stripe}, which Core paints every other row with`,
@@ -19764,6 +21678,18 @@ export function draftAnswer(ctx, env, question) {
19764
21678
  : /\b(dark(?:er|en)?|deeper)\b/.test(noMode(c.text))
19765
21679
  ? -1
19766
21680
  : 0;
21681
+ // "odd rows darker" on a Core that stripes the even rows: the odd
21682
+ // rows have no stripe to shift, so they need a color of their own.
21683
+ if (
21684
+ parityOn &&
21685
+ paritySaid.length === 1 &&
21686
+ paritySaid[0] !== coreParity &&
21687
+ way
21688
+ )
21689
+ return {
21690
+ text: `the ${paritySaid[0]} rows of ${parityOn} carry no stripe of Core's to make ${way > 0 ? 'lighter' : 'darker'}; give them a color: background-color <color> --on ${parityOn} --when parity:${paritySaid[0]}`,
21691
+ options: [],
21692
+ };
19767
21693
  if (stripeOn && stripe && way) {
19768
21694
  const steps = perMode(
19769
21695
  stripe,
@@ -19784,8 +21710,34 @@ export function draftAnswer(ctx, env, question) {
19784
21710
  sequence: steps.length > 1,
19785
21711
  };
19786
21712
  }
21713
+ // "zebra rows" with no color: the stripe Core already draws, in
21714
+ // every table, with the theme's own stripe color.
21715
+ // (Only when no clause of the ask names a stripe: "zebra rows,
21716
+ // odd rows #f9f9f9" is that one stripe.)
21717
+ if (
21718
+ parityOn &&
21719
+ coreParity &&
21720
+ stripe &&
21721
+ !c.neg &&
21722
+ !paritiesSaid(q).length
21723
+ )
21724
+ return {
21725
+ text: `stripes on every data-driven table: the ${coreParity} rows of ${parityOn} in ${stripe}, the color Core stripes a table marked isStriped with (the first body row is odd; for the odd rows, name them). On a table with hover the stripe covers Core's hover color; add --state striped to stripe only the tables the app marks isStriped`,
21726
+ options: [
21727
+ [
21728
+ set('background-color', `var(${stripe})`, {
21729
+ on: parityOn,
21730
+ when: `parity:${coreParity}`,
21731
+ ...modeOf(c),
21732
+ }),
21733
+ ],
21734
+ ],
21735
+ };
19787
21736
  return {
19788
- text: 'striped rows need a style on every other row, and set has no condition for that; a row background colors every row',
21737
+ text:
21738
+ (parityOn ?? rowParity)
21739
+ ? `a stripe on table rows is set on the stripe: background-color <color> --on ${parityOn ?? rowParity} --when parity:odd (or parity:even)`
21740
+ : 'striped rows need a style on every other row, and this Core marks no stripe on its rows (a newer Core does: then --when parity:odd); a row background colors every row',
19789
21741
  options: [],
19790
21742
  };
19791
21743
  }
@@ -19794,7 +21746,11 @@ export function draftAnswer(ctx, env, question) {
19794
21746
  : /\bgradient\b/.test(c.text)
19795
21747
  ? 'gradient'
19796
21748
  : null;
19797
- if (c.neg && on) {
21749
+ // "no gradient on buttons": the design this theme added, taken
21750
+ // back. "no fill", "no background": see-through, on the part and on
21751
+ // every variant or state of it the theme fills itself (taking a
21752
+ // fill back would bring the base's fill back, the opposite).
21753
+ if (c.neg && on && design) {
19798
21754
  const undos = undo([
19799
21755
  'background',
19800
21756
  'background-image',
@@ -19802,21 +21758,51 @@ export function draftAnswer(ctx, env, question) {
19802
21758
  ]);
19803
21759
  return undos.length
19804
21760
  ? {
19805
- text: `take back the ${design ?? 'background'} this theme sets${where}`,
21761
+ text: `take back the ${design} this theme sets${where}`,
19806
21762
  options: undos,
19807
21763
  }
19808
- : design
19809
- ? {
19810
- text: `${on} has no ${design} this theme sets, so there is nothing to remove`,
19811
- options: [],
19812
- lookup: `${HOW} ${on}`,
19813
- }
19814
- : // "remove the card background": the fill it shows comes from
19815
- // the base theme; no fill means see-through.
19816
- {
19817
- text: `no background${where || ` on ${on}`}: transparent, so what is behind it shows`,
19818
- options: [[set('background-color', 'transparent', f)]],
19819
- };
21764
+ : {
21765
+ text: `${on} has no ${design} this theme sets, so there is nothing to remove`,
21766
+ options: [],
21767
+ lookup: `${HOW} ${on}`,
21768
+ };
21769
+ }
21770
+ if (c.neg && on) {
21771
+ const ownScoped = env.data.settings.filter(
21772
+ x =>
21773
+ x.on === on &&
21774
+ /^background(?:-color|-image)?$/.test(x.thing) &&
21775
+ (x.when || x.state) &&
21776
+ (!f.when || x.when === f.when) &&
21777
+ (!f.state || x.state === f.state) &&
21778
+ !/^(?:transparent|none)$/i.test(String(x.value).trim()),
21779
+ );
21780
+ const steps = [
21781
+ set('background-color', 'transparent', f),
21782
+ ...ownScoped
21783
+ .filter(
21784
+ (x, i, all) =>
21785
+ all.findIndex(
21786
+ y =>
21787
+ y.when === x.when &&
21788
+ y.state === x.state &&
21789
+ y.mode === x.mode,
21790
+ ) === i,
21791
+ )
21792
+ .map(x =>
21793
+ set('background-color', 'transparent', {
21794
+ on,
21795
+ ...(x.when ? {when: x.when} : {}),
21796
+ ...(x.state ? {state: x.state} : {}),
21797
+ ...(x.mode ? {mode: x.mode} : {}),
21798
+ }),
21799
+ ),
21800
+ ];
21801
+ return {
21802
+ text: `no background${where || ` on ${on}`}: transparent, so what is behind it shows${ownScoped.length ? `; also where ${env.slug} fills it itself (${[...new Set(ownScoped.map(x => [x.when, x.state].filter(Boolean).join(' ')))].join(', ')})` : ''}`,
21803
+ options: [steps],
21804
+ sequence: steps.length > 1,
21805
+ };
19820
21806
  }
19821
21807
  // "the button gradient darker": the part's own gradient, each color
19822
21808
  // stop stepped that way (angle, stops and positions kept).
@@ -19931,6 +21917,20 @@ export function draftAnswer(ctx, env, question) {
19931
21917
  const color = colorFor(c, 'fill');
19932
21918
  if (color) {
19933
21919
  const pageMode = pageModeOf(c, color);
21920
+ const tones = pageTones(c, color);
21921
+ if (tones)
21922
+ return {
21923
+ text: `the page background: --color-background-body, ${color}'s color at each mode's own page lightness (${tones.light} in light mode, ${tones.dark} in dark mode), so both pages keep their text readable`,
21924
+ options: [
21925
+ [
21926
+ set('--color-background-body', tones.light, {
21927
+ mode: 'light',
21928
+ }),
21929
+ set('--color-background-body', tones.dark, {mode: 'dark'}),
21930
+ ],
21931
+ ],
21932
+ sequence: true,
21933
+ };
19934
21934
  return {
19935
21935
  text: `the page background: --color-background-body${pageModeSaid(c, pageMode)}`,
19936
21936
  options: [
@@ -20671,10 +22671,8 @@ export function draftAnswer(ctx, env, question) {
20671
22671
  const colored = (/** @type {string} */ v) => !isGraySeed(seedOf(v));
20672
22672
  // A color dial counts when the step changes the shades made from it
20673
22673
  // (a warm gray has a little hue to take out), as set measures it.
20674
- const hasColor = env.data.settings.some(
20675
- x =>
20676
- PALETTE_DIALS.includes(x.thing) &&
20677
- vibrancyMoves(x.thing, seedOf(x.value), 0, 100),
22674
+ const hasColor = seedsInEffect(ctx.project.cwd, env.slug, env.data).some(
22675
+ f => vibrancyMoves(f.dial, f.seed, 0, 100),
20678
22676
  );
20679
22677
  const help =
20680
22678
  'vibrancy sets how saturated every generated color is (0 is gray, 100 the most vivid, 50 the default)';
@@ -20965,6 +22963,23 @@ export function draftAnswer(ctx, env, question) {
20965
22963
  : {text: 'no setting is a second brand color', options: []};
20966
22964
  /** @type {Step | null} */
20967
22965
  let darkStep = null;
22966
+ /**
22967
+ * Whether a fill stands out on the dark page (3:1) with text that reads
22968
+ * on it (4.5:1, white or black).
22969
+ * @param {string} x
22970
+ */
22971
+ const standsInDark = x => {
22972
+ const rgb = parseColor(x);
22973
+ const page = parseColor(
22974
+ String(current('--color-background-body', 'dark') ?? ''),
22975
+ );
22976
+ return Boolean(
22977
+ rgb &&
22978
+ page &&
22979
+ ratio(rgb, page) >= 3 &&
22980
+ Math.max(ratio(rgb, [255, 255, 255]), ratio(rgb, [0, 0, 0])) >= 4.5,
22981
+ );
22982
+ };
20968
22983
  // A theme whose modes show this color in different hues (butter's blue
20969
22984
  // light accent, yellow dark one), or that shows only its dark mode: the
20970
22985
  // editor's one seed would make every mode's shades from one hue. A step
@@ -21202,8 +23217,39 @@ export function draftAnswer(ctx, env, question) {
21202
23217
  tokenAlpha,
21203
23218
  )
21204
23219
  : color;
23220
+ let nearDark = false;
23221
+ // A deeper or darker role color asked for, too dark to stand out on
23222
+ // the dark page: the editor's dark half falls back to its paler
23223
+ // official shade, so the dark token is set in the same answer to the
23224
+ // color nearest it that stands out there (3:1) with text that reads on
23225
+ // it (4.5:1): dark mode goes the way the ask goes, not paler.
23226
+ if (
23227
+ modal &&
23228
+ !darkStep &&
23229
+ // ("deeper blue" reads as "dark blue" here.)
23230
+ /\b(?:darker|darken|deeper|dark)\b(?!\s+(?:mode|theme|scheme)\b)/i.test(
23231
+ c.text,
23232
+ ) &&
23233
+ color &&
23234
+ dial !== 'neutral' &&
23235
+ dial !== 'secondary' &&
23236
+ parseColor(color) &&
23237
+ alphaOf(color) >= 1
23238
+ ) {
23239
+ if (!standsInDark(color)) {
23240
+ let near = null;
23241
+ for (let k = 0.02; k <= 0.6 && !near; k += 0.02) {
23242
+ const next = shift(color, k);
23243
+ if (next && standsInDark(next)) near = next;
23244
+ }
23245
+ if (near) {
23246
+ darkStep = set(token, near, {mode: 'dark'});
23247
+ nearDark = true;
23248
+ }
23249
+ }
23250
+ }
21205
23251
  return {
21206
- text: `${dial}: the editor makes its light and dark shades from ${color}${darkStep ? `, and the dark ${token} steps from its own value the same way` : `; or, the second line, only ${token} itself${tokenAlpha < 1 ? `, kept at its own ${Math.round(tokenAlpha * 100)}% strength (a wash)` : ''}, leaving the other ${dial} shades as they are`}`,
23252
+ text: `${dial}: the editor makes its light and dark shades from ${color}${darkStep ? `, and the dark ${token} ${nearDark ? 'is the color nearest it that stands out on the dark page, so dark mode follows it instead of turning paler' : 'steps from its own value the same way'}` : `; or, the second line, only ${token} itself${tokenAlpha < 1 ? `, kept at its own ${Math.round(tokenAlpha * 100)}% strength (a wash)` : ''}, leaving the other ${dial} shades as they are`}`,
21207
23253
  options: darkStep
21208
23254
  ? [[set(dial, color), darkStep]]
21209
23255
  : [[set(dial, color)], [set(token, exactToken)]],
@@ -21274,9 +23320,48 @@ export function draftAnswer(ctx, env, question) {
21274
23320
  ? m[1]
21275
23321
  : undefined;
21276
23322
  })();
23323
+ // (Right before a part, "the zorp card rounder", or between a part's
23324
+ // possessive and its element, "the button's foo icon": a word there
23325
+ // that is no part's own word names nothing the part has.)
23326
+ // (A word some part's own name holds, "the close button", names a
23327
+ // piece of a part, which the place reader reads: never unknown.)
23328
+ const inPartName = (/** @type {string} */ w) =>
23329
+ [...TARGET.keys()].some(k => k.split('-').includes(singular(w)));
23330
+ const beforePartWord = (() => {
23331
+ const m = new RegExp(String.raw`\b${DET}([a-z]{3,})\s+([a-z]+)\b`).exec(
23332
+ text,
23333
+ );
23334
+ return m &&
23335
+ !inPartName(m[1]) &&
23336
+ lex.parts.some(([re]) => re.test(` ${m[2]} `)) &&
23337
+ !lex.parts.some(([re]) => {
23338
+ const x = re.exec(` ${m[1]} ${m[2]} `);
23339
+ return x != null && x[0].includes(m[1]);
23340
+ })
23341
+ ? m[1]
23342
+ : undefined;
23343
+ })();
23344
+ const possessiveWord = (() => {
23345
+ const m = /\b([a-z]+)(?:'s|s'|’s|s’)\s+([a-z]{3,})\s+([a-z]+)\b/.exec(
23346
+ text,
23347
+ );
23348
+ return m &&
23349
+ !inPartName(m[2]) &&
23350
+ lex.parts.some(([re]) => re.test(` ${m[1]} `)) &&
23351
+ (lex.parts.some(([re]) => re.test(` ${m[3]} `)) ||
23352
+ new RegExp(String.raw`^${THING}$|^icons?$`).test(m[3])) &&
23353
+ !lex.parts.some(([re]) => {
23354
+ const x = re.exec(` ${m[2]} ${m[3]} `);
23355
+ return x != null && x[0].includes(m[2]);
23356
+ })
23357
+ ? m[2]
23358
+ : undefined;
23359
+ })();
21277
23360
  const slots = between
21278
- ? [betweenWord, placedWord]
23361
+ ? [betweenWord, placedWord, beforePartWord, possessiveWord]
21279
23362
  : [
23363
+ beforePartWord,
23364
+ possessiveWord,
21280
23365
  new RegExp(
21281
23366
  String.raw`\b(?:from|on)\s+${DET}([a-z]{3,})\b(?!\s+(?:mode|theme)\b)`,
21282
23367
  ).exec(text)?.[1],
@@ -21334,7 +23419,7 @@ export function draftAnswer(ctx, env, question) {
21334
23419
  ),
21335
23420
  ))) ||
21336
23421
  parseColor(w) ||
21337
- /^(?:dark|light|darker|lighter|bigger|smaller|more|less|least|most|much|very|bit|lot|whole|entire|whole|entire|overall|main|page|app|site|everything|everywhere|default|global|general|base|theme|themes|screen|screens|current|other|same|top|bottom|left|right|inner|outer|side|sides|plus|thus|always|sometimes|its|this|that|these|those|them|they|was|has|does|yes|minus|options|things|thing|ones|one|edges|tokens|settings|variables|parts|part|modes|mode|pixels|steps|step|levels|level|times|default|normal|regular|primary|secondary|small|large|medium|subtle|strong|soft|hard|new|old|nice|good|bad|ugly|pretty|heavy|thin|thick|bold|round|rounded|square|flat|clean|modern|fancy|simple|minimal|same|their|your|mine|ours|any|some|every|each|first|last|second|third|letter|letters|word|words|line|lines|link|links|title|titles|label|labels|heading|headings|body|copy|content|everything)$/.test(
23422
+ /^(?:dark|light|darker|lighter|bigger|smaller|more|less|least|most|much|very|bit|lot|whole|entire|whole|entire|overall|main|page|app|site|everything|everywhere|default|global|general|base|theme|themes|screen|screens|current|other|same|top|bottom|left|right|inner|outer|side|sides|plus|thus|always|sometimes|its|this|that|these|those|them|they|was|has|does|yes|minus|options|things|thing|ones|one|edges|tokens|settings|variables|parts|part|modes|mode|pixels|steps|step|levels|level|times|default|normal|regular|primary|secondary|small|large|medium|big|tiny|huge|little|subtle|strong|soft|hard|new|old|nice|good|bad|ugly|pretty|heavy|thin|thick|bold|round|rounded|square|flat|clean|modern|fancy|simple|minimal|same|their|your|mine|ours|any|some|every|each|first|last|second|third|letter|letters|word|words|line|lines|link|links|title|titles|label|labels|heading|headings|body|copy|content|everything)$/.test(
21338
23423
  w,
21339
23424
  )
21340
23425
  )
@@ -21433,6 +23518,12 @@ export function draftAnswer(ctx, env, question) {
21433
23518
  const clashes = [];
21434
23519
  /** (A step toward a rung said beside the rung.) @type {Step[]} */
21435
23520
  const relDropped = [];
23521
+ /**
23522
+ * Steps a later clause of a sequence replaces ("make it compact, then
23523
+ * make it roomy": the last says where it ends).
23524
+ * @type {Step[]}
23525
+ */
23526
+ const superseded = [];
21436
23527
  for (const {clause, steps} of tops)
21437
23528
  for (const [k, st] of steps.entries()) {
21438
23529
  // A step one clause repeats ("2 steps rounder": the dial stepped
@@ -21449,10 +23540,16 @@ export function draftAnswer(ctx, env, question) {
21449
23540
  // (A rung by name; a length said beside a step is an example. The
21450
23541
  // step goes the rung's way: "sharper … almost square", never
21451
23542
  // "rounder but square", which contradicts.)
21452
- const rung = (/** @type {Step} */ x) => /^[a-z]+$/.test(String(x.value));
23543
+ // (A size said beside the way, "bigger, 17px", is how much: it wins
23544
+ // as a rung does.)
23545
+ const sized = (/** @type {Step} */ x) =>
23546
+ /^\d*\.?\d+(?:px|rem|em)?$/.test(String(x.value));
23547
+ const rung = (/** @type {Step} */ x) =>
23548
+ /^[a-z]+$/.test(String(x.value)) || sized(x);
21453
23549
  const LOW = /^(?:square|small|tight|compact|light|thin|regular)$/;
21454
23550
  const HIGH = /^(?:large|round|pill|roomy|spacious|bold|heavy)$/;
21455
23551
  const sameWay = (/** @type {Step} */ r, /** @type {Step} */ a) =>
23552
+ sized(a) ||
21456
23553
  (r.value === 'less' && LOW.test(String(a.value))) ||
21457
23554
  (r.value === 'more' && HIGH.test(String(a.value)));
21458
23555
  if (
@@ -21465,6 +23562,24 @@ export function draftAnswer(ctx, env, question) {
21465
23562
  (rel(st) ? sameWay(st, prior.step) : sameWay(prior.step, st)) &&
21466
23563
  (prior.clause.mode ?? '') === (clause.mode ?? '')
21467
23564
  ) {
23565
+ // ("like 1 or 2 px": a size given as an example keeps the way.)
23566
+ const sizedStep = rel(st) ? prior.step : st;
23567
+ const sizedClause = rel(st) ? prior.clause : clause;
23568
+ if (
23569
+ sized(sizedStep) &&
23570
+ /^\s*(?:like|say|e\.?g\.?|about|around|maybe|roughly)\b/.test(
23571
+ sizedClause.text,
23572
+ )
23573
+ ) {
23574
+ relDropped.push(sizedStep);
23575
+ if (!rel(st)) {
23576
+ steps.splice(k, 1, prior.step);
23577
+ continue;
23578
+ }
23579
+ last.delete(key);
23580
+ last.set(key, {step: st, clause});
23581
+ continue;
23582
+ }
21468
23583
  relDropped.push(rel(st) ? st : prior.step);
21469
23584
  if (rel(st)) {
21470
23585
  steps.splice(k, 1, prior.step);
@@ -21479,8 +23594,12 @@ export function draftAnswer(ctx, env, question) {
21479
23594
  prior.clause !== clause &&
21480
23595
  prior.step.value !== st.value &&
21481
23596
  (prior.clause.mode ?? '') === (clause.mode ?? '')
21482
- )
21483
- clashes.push([prior.step, st]);
23597
+ ) {
23598
+ // (A later clause said after "then" is the next step of a
23599
+ // sequence: it replaces the earlier value, never contradicts it.)
23600
+ if (/\bthen\b/i.test(clause.joint ?? '')) superseded.push(prior.step);
23601
+ else clashes.push([prior.step, st]);
23602
+ }
21484
23603
  last.delete(key);
21485
23604
  last.set(key, {step: st, clause});
21486
23605
  }
@@ -21495,6 +23614,21 @@ export function draftAnswer(ctx, env, question) {
21495
23614
  // The page never takes the color the text takes in the same mode.
21496
23615
  const all = [...last.values()]
21497
23616
  .map(x => x.step)
23617
+ // (The page joins as it shows: with the frame and main panel lines
23618
+ // its own answer gives, so the main panel takes the color too.)
23619
+ .flatMap(st => {
23620
+ if (st.thing !== '--color-background-body' || st.on) return [st];
23621
+ const page = drafts.find(
23622
+ d =>
23623
+ d.options.length === 2 &&
23624
+ d.options[0].length === 1 &&
23625
+ d.options[0][0].thing === st.thing &&
23626
+ String(d.options[0][0].value) === String(st.value) &&
23627
+ (d.options[0][0].mode ?? '') === (st.mode ?? '') &&
23628
+ d.options[1].some(x => x.on === 'app-shell'),
23629
+ );
23630
+ return page ? [st, ...page.options[1]] : [st];
23631
+ })
21498
23632
  .filter(
21499
23633
  (st, i, list) =>
21500
23634
  !(
@@ -21594,7 +23728,39 @@ export function draftAnswer(ctx, env, question) {
21594
23728
  }),
21595
23729
  );
21596
23730
  }
21597
- result.push(...drafts.slice(0, clashes.length ? 0 : undefined));
23731
+ // (A draft whose every step a later "then" clause replaces is not
23732
+ // offered: the sequence ends at the later value.)
23733
+ const replaced = new Set(superseded.map(st => JSON.stringify(st)));
23734
+ const kept = replaced.size
23735
+ ? drafts.filter(
23736
+ d =>
23737
+ !d.options.length ||
23738
+ !d.options.every(o =>
23739
+ o.every(st => replaced.has(JSON.stringify(st))),
23740
+ ),
23741
+ )
23742
+ : drafts;
23743
+ if (replaced.size)
23744
+ for (const d of kept)
23745
+ if (d.options.length && !/replaces the earlier/.test(d.text))
23746
+ d.text += ` (said after "then", this replaces the earlier ${superseded.map(st => `${st.thing} ${st.value}`).join(', ')})`;
23747
+ result.push(...kept.slice(0, clashes.length ? 0 : undefined));
23748
+ // An ask that takes for granted a setting the theme does not have ("…;
23749
+ // also undo the corners" with no corners set) reads a theme other than
23750
+ // this one: the rest of it is said, never written, until the person
23751
+ // sees what the theme has.
23752
+ {
23753
+ const unmet = result.find(d => d.unmet);
23754
+ if (unmet && result.some(d => d !== unmet && d.options.length)) {
23755
+ for (const d of result)
23756
+ if (d !== unmet && d.options.length) {
23757
+ d.text = `${d.text} (held back: the same ask takes back ${unmet.unmet}, which ${env.slug} does not set, so the theme is not as the ask expects; ask for this alone to get it)`;
23758
+ d.options = [];
23759
+ }
23760
+ result.splice(result.indexOf(unmet), 1);
23761
+ result.unshift(unmet);
23762
+ }
23763
+ }
21598
23764
  // A confidence gate: a question, a "tell me", a "but not too" or a typo
21599
23765
  // read as a direction leaves how unsure which way to go; a wrong write is
21600
23766
  // worse than none, so it gives the lookup and asks for the ask.
@@ -22283,7 +24449,19 @@ export function draftAnswer(ctx, env, question) {
22283
24449
  (state ? state.test(cond) && !/:hover|:not\(/.test(cond) : !cond)
22284
24450
  );
22285
24451
  });
22286
- const value = keys.map(k => at[k])[0];
24452
+ // The base theme's own rule for the part draws the property where it
24453
+ // sets one (neutral's neutral badge fills with its gray), over what
24454
+ // Core reads there.
24455
+ const key = keys[0];
24456
+ const camel = prop.replace(/-([a-z])/g, (_m, x) => x.toUpperCase());
24457
+ const baseRule =
24458
+ key && !key.split(' ')[1]
24459
+ ? baseBlocksFor(
24460
+ /** @type {any} */ (env.base).components?.[one(named)],
24461
+ key.split(' ')[0],
24462
+ ).find(({block}) => typeof block[camel] === 'string')
24463
+ : null;
24464
+ const value = baseRule ? baseRule.block[camel] : keys.map(k => at[k])[0];
22287
24465
  if (value == null) return null;
22288
24466
  const mode = inMode ?? readMode ?? 'light';
22289
24467
  const read = String(value)
@@ -22466,7 +24644,36 @@ export function draftAnswer(ctx, env, question) {
22466
24644
  const tok = /var\(\s*(--[a-z0-9-]+)\s*\)/.exec(v)?.[1];
22467
24645
  return tok ? `${partNow(tok, mode)}${named ? ` (${tok})` : ''}` : v;
22468
24646
  };
22469
- const rest = at['background-color'][base];
24647
+ // (A fill the theme sets on the part there, for the mode asked, wins;
24648
+ // else the base theme's own rule for the part draws its fill where it
24649
+ // sets one: neutral's neutral badge fills with its gray.)
24650
+ const set = [...env.data.settings]
24651
+ .reverse()
24652
+ .find(
24653
+ x =>
24654
+ x.source === 'property' &&
24655
+ /^background(?:-color)?$/.test(x.thing) &&
24656
+ !x.state &&
24657
+ (!x.mode || x.mode === mode) &&
24658
+ (!x.when || (vWord && x.when === `${vAxis}:${vWord}`)) &&
24659
+ partsOf(ctx, x).includes(one(named)),
24660
+ );
24661
+ const setValue = set
24662
+ ? (() => {
24663
+ const pair = /^light-dark\(\s*([^,]+?)\s*,\s*([^)]+?)\s*\)$/.exec(
24664
+ String(set.value).trim(),
24665
+ );
24666
+ return pair ? pair[mode === 'dark' ? 2 : 1] : String(set.value);
24667
+ })()
24668
+ : null;
24669
+ const rest =
24670
+ setValue ??
24671
+ baseBlocksFor(
24672
+ /** @type {any} */ (env.base).components?.[one(named)],
24673
+ base,
24674
+ ).find(({block}) => typeof block.backgroundColor === 'string')?.block
24675
+ .backgroundColor ??
24676
+ at['background-color'][base];
22470
24677
  const suffix = `${qMode ? ` in ${qMode} mode` : ''}${vWord ? ` (${vWord})` : ''}`;
22471
24678
  // (At rest, the reading the value answer gives: the value now.)
22472
24679
  if (!sel) return `${shown(rest, false)}${suffix}`;
@@ -22953,7 +25160,13 @@ export function draftAnswer(ctx, env, question) {
22953
25160
  st.on &&
22954
25161
  st.mode === 'dark' &&
22955
25162
  kind === 'light' &&
22956
- !typed(v)
25163
+ !typed(v) &&
25164
+ // (A color word the ask says, never a color a direction made:
25165
+ // "the card background darker" keeps each card's own dark
25166
+ // tone, whatever text it draws.)
25167
+ colorsIn(question).some(
25168
+ x => String(x).toLowerCase() === v.toLowerCase(),
25169
+ )
22957
25170
  ) {
22958
25171
  const ink = inkOf(st.on, st.when, 'dark');
22959
25172
  const rgb = parseColor(v);
@@ -22971,14 +25184,19 @@ export function draftAnswer(ctx, env, question) {
22971
25184
  if (kind !== 'light' || /light-dark\(/.test(String(st.value)))
22972
25185
  continue;
22973
25186
  // (A border shorthand keeps its width in both modes: only its
22974
- // color is the light mode's, the dark mode keeping the theme's
22975
- // border color.)
22976
- if (st.thing === 'border')
25187
+ // color is the light mode's, the dark mode keeping the border
25188
+ // color the part draws now, an input's emphasized one, else the
25189
+ // theme's.)
25190
+ if (st.thing === 'border') {
25191
+ const own =
25192
+ st.on && restRead(C.partReads(one(st.on), 'border') ?? [], '');
25193
+ const keep =
25194
+ own && /^--color-/.test(own) ? own : '--color-border';
22977
25195
  st.value = String(st.value).replace(
22978
25196
  v,
22979
- `light-dark(${v}, var(--color-border))`,
25197
+ `light-dark(${v}, var(${keep}))`,
22980
25198
  );
22981
- else st.mode = 'light';
25199
+ } else st.mode = 'light';
22982
25200
  notes.add(
22983
25201
  `(a light ${st.on ? 'border' : 'border color'}, in light mode only: on the dark page it would be a glaring edge, so the dark mode keeps its own; for the dark mode too, set a dark color with --mode dark, or say "in both modes")`,
22984
25202
  );
@@ -23012,9 +25230,102 @@ export function draftAnswer(ctx, env, question) {
23012
25230
  `(in ${kind} mode only: a ${kind} fill, and the ${other} mode keeps its own so its text stays readable; for the ${other} mode too, set a ${other} color with --mode ${other}, or say "in both modes")`,
23013
25231
  );
23014
25232
  }
25233
+ // The other stripe the stripe answer clears (on striped tables) holds
25234
+ // in the mode the stripe took, so the other mode keeps Core's stripe
25235
+ // too. A clear the ask says itself keeps every mode.
25236
+ for (const o of d.options) {
25237
+ const stripe = o.find(
25238
+ x =>
25239
+ x.mode &&
25240
+ x.on &&
25241
+ /^background(?:-color)?$/.test(x.thing) &&
25242
+ /^parity:/.test(String(x.when ?? '')),
25243
+ );
25244
+ if (!stripe) continue;
25245
+ for (const st of o)
25246
+ if (
25247
+ !st.mode &&
25248
+ st.on === stripe.on &&
25249
+ /^background(?:-color)?$/.test(st.thing) &&
25250
+ st.value === 'transparent' &&
25251
+ st.state === 'striped' &&
25252
+ /^parity:/.test(String(st.when ?? '')) &&
25253
+ st.when !== stripe.when
25254
+ )
25255
+ st.mode = stripe.mode;
25256
+ }
23015
25257
  for (const n of notes) if (!d.text.includes(n)) d.text += ` ${n}`;
23016
25258
  }
23017
25259
  }
25260
+ // A plain fill on a part whose variants are colors or statuses besides
25261
+ // its neutral ones ("white cards": default, muted, transparent beside
25262
+ // blue, green …; "blue tags": neutral beside success, error …): the
25263
+ // neutral variants take it; each colored or status variant keeps its
25264
+ // own, named, with a line for each to change it too.
25265
+ /** @type {Draft[]} */
25266
+ const keptLines = [];
25267
+ for (const d of result)
25268
+ for (const o of /contradict/.test(d.text) ? [] : d.options) {
25269
+ // (Parts the answer keeps a variant or state of apart, as asked.)
25270
+ const apart = new Set(
25271
+ o
25272
+ .filter(x => /^background/.test(x.thing) && (x.when || x.state))
25273
+ .map(x => String(x.on)),
25274
+ );
25275
+ for (let i = o.length - 1; i >= 0; i--) {
25276
+ const st = o[i];
25277
+ if (
25278
+ !st.on ||
25279
+ st.when ||
25280
+ st.state ||
25281
+ st.only ||
25282
+ !/^background(?:-color)?$/.test(st.thing) ||
25283
+ FAMILIES[st.on]
25284
+ )
25285
+ continue;
25286
+ // (A plain color only: a token, a gradient, a see-through or a
25287
+ // removed fill is what each variant does with it as asked.)
25288
+ const v0 = String(st.value ?? '').trim();
25289
+ if (!/^#[0-9a-f]{3,8}$/i.test(v0) || !parseColor(v0) || alphaOf(v0) < 1)
25290
+ continue;
25291
+ // (A color the ask says, typed or as a word: never one worked out
25292
+ // from another, "the accent but lighter"; nor an answer that
25293
+ // already keeps a variant or state apart, an except.)
25294
+ const said = new Set(
25295
+ clauses.flatMap(x => x.colors).map(x => String(x).toLowerCase()),
25296
+ );
25297
+ if (
25298
+ !said.has(v0.toLowerCase()) &&
25299
+ !question.toLowerCase().includes(v0.toLowerCase())
25300
+ )
25301
+ continue;
25302
+ if (apart.has(String(st.on))) continue;
25303
+ const variants = C.variantValues(one(st.on)).variant ?? [];
25304
+ // (A part with a main variant, a button's primary, is read by the
25305
+ // pass below: its variants are roles, not colors.)
25306
+ if (variants.includes('primary')) continue;
25307
+
25308
+ const colored = variants.filter(
25309
+ v =>
25310
+ Object.hasOwn(HUES, v) ||
25311
+ /^(?:success|warning|error|danger|info|destructive|critical|positive|negative|caution|attention)$/.test(
25312
+ v,
25313
+ ),
25314
+ );
25315
+ const plain = variants.filter(v => !colored.includes(v));
25316
+ if (!colored.length || !plain.length) continue;
25317
+ o.splice(i, 1, ...plain.map(v => ({...st, when: `variant:${v}`})));
25318
+ const name = one(st.on);
25319
+ if (!/keeps? (?:their|its) own color/.test(d.text))
25320
+ d.text += ` (the ${colored.join(', ')} ${name} ${colored.length > 1 ? 'variants keep their' : 'variant keeps its'} own color; the next lines change ${colored.length > 1 ? 'them' : 'it'} too)`;
25321
+ if (!keptLines.some(k => k.text.includes(`${name} variants`)))
25322
+ keptLines.push({
25323
+ text: `to change the ${colored.join(', ')} ${name} variants too: one line for each`,
25324
+ options: colored.map(v => [{...st, when: `variant:${v}`}]),
25325
+ });
25326
+ }
25327
+ }
25328
+ result.push(...keptLines);
23018
25329
  // A fill given to every variant of a part ("navy buttons"): a variant
23019
25330
  // whose own text would barely show on it (a secondary button's dark
23020
25331
  // label on navy, under 3:1) keeps its fill; the others take it, each by
@@ -23034,21 +25345,21 @@ export function draftAnswer(ctx, env, question) {
23034
25345
  continue;
23035
25346
  const fill = parseColor(String(st.value ?? ''));
23036
25347
  if (!fill || alphaOf(String(st.value)) < 1) continue;
23037
- // (Its text given in the same answer: the ask's own look.)
23038
- if (
23039
- o.some(
23040
- x =>
23041
- x !== st &&
23042
- x.on === st.on &&
23043
- (x.thing === 'color' || /^--color-(?:text|on)-/.test(x.thing)),
23044
- )
23045
- )
23046
- continue;
23047
25348
  const variants = C.variantValues(one(st.on)).variant ?? [];
23048
25349
  // (Role variants only, a part with a main variant, a button's
23049
25350
  // primary: a tone family, a badge's statuses, each pairs its text
23050
25351
  // with its own fill and is recolored as a whole.)
23051
25352
  if (variants.length < 2 || !variants.includes('primary')) continue;
25353
+ // (Its text given in the same answer: the ask's own look, so no
25354
+ // variant loses its text.)
25355
+ const ownInk = o.some(
25356
+ x =>
25357
+ x !== st &&
25358
+ x.on === st.on &&
25359
+ !x.when &&
25360
+ !x.state &&
25361
+ (x.thing === 'color' || /^--color-(?:text|on)-/.test(x.thing)),
25362
+ );
23052
25363
  /** @type {Map<string, string>} */
23053
25364
  const ink = new Map();
23054
25365
  for (const r of C.partReads(one(st.on), 'text') ?? []) {
@@ -23059,10 +25370,96 @@ export function draftAnswer(ctx, env, question) {
23059
25370
  }
23060
25371
  }
23061
25372
  const mode = /** @type {'light' | 'dark'} */ (st.mode ?? 'light');
25373
+ const lost = ownInk
25374
+ ? []
25375
+ : variants.filter(v => {
25376
+ const t = ink.get(v);
25377
+ const rgb = t ? parseColor(String(current(t, mode) ?? '')) : null;
25378
+ return rgb != null && ratio(fill, rgb) < 3;
25379
+ });
25380
+ if (lost.length === variants.length) continue;
25381
+ // (Once the color goes to some variants only, a variant drawn in a
25382
+ // status color, the destructive button's red, keeps its meaning
25383
+ // too, unless the color asked is that status color already.)
25384
+ const fills = C.partReads(one(String(st.on)), 'background') ?? [];
25385
+ const status = variants.filter(v => {
25386
+ if (lost.includes(v)) return false;
25387
+ const r = fills.find(
25388
+ x =>
25389
+ x.when.some(w => w.trim() === `variant=${v}`) &&
25390
+ /^--color-(?:error|danger|warning|success)\b/.test(x.token),
25391
+ );
25392
+ if (!r) return false;
25393
+ const now = parseColor(String(current(r.token, mode) ?? ''));
25394
+ const near =
25395
+ !!now && Math.hypot(...now.map((x, k) => x - (fill[k] ?? 0))) < 80;
25396
+ return !near;
25397
+ });
25398
+ // (Only once the color goes to some variants anyway, or when the
25399
+ // ask gives the whole look, its fill and its text ("gold buttons
25400
+ // with black text"): a bare color every button's text reads on
25401
+ // stays every button's.)
25402
+ if (!lost.length && !(ownInk && status.length)) continue;
25403
+ const kept = variants.filter(
25404
+ v => !lost.includes(v) && !status.includes(v),
25405
+ );
25406
+ if (!kept.length) continue;
25407
+ o.splice(i, 1, ...kept.map(v => ({...st, when: `variant:${v}`})));
25408
+ if (
25409
+ !/keep their own fill|keeps its own fill|status color/.test(d.text)
25410
+ ) {
25411
+ if (lost.length)
25412
+ d.text += ` (${lost.join(', ')} ${lost.length > 1 ? 'keep their own fill' : 'keeps its own fill'}: ${lost.length > 1 ? 'their' : 'its'} text would barely show on ${st.value}; give ${lost.length > 1 ? 'them' : 'it'} a text color too to change ${lost.length > 1 ? 'them' : 'it'})`;
25413
+ if (status.length)
25414
+ d.text += ` (${status.join(', ')} ${status.length > 1 ? 'keep their' : 'keeps its'} status color; name ${status.length > 1 ? 'them' : 'it'} to change ${status.length > 1 ? 'them' : 'it'} too)`;
25415
+ }
25416
+ }
25417
+ }
25418
+ // A text color given to every variant of a part ("buttons with white
25419
+ // text"), with no fill of its own in the answer: a variant whose own
25420
+ // fill would hide it (a ghost button's page, a secondary button's light
25421
+ // fill, under 3:1) keeps its text; said.
25422
+ for (const d of result)
25423
+ for (const o of d.options) {
25424
+ for (let i = o.length - 1; i >= 0; i--) {
25425
+ const st = o[i];
25426
+ if (
25427
+ !st.on ||
25428
+ st.when ||
25429
+ st.state ||
25430
+ st.only ||
25431
+ st.thing !== 'color' ||
25432
+ FAMILIES[st.on]
25433
+ )
25434
+ continue;
25435
+ const ink = parseColor(String(st.value ?? ''));
25436
+ if (!ink || alphaOf(String(st.value)) < 1) continue;
25437
+ // (A resting fill in the same answer is the look the text sits on;
25438
+ // a fill in another state, "filled blue on hover", is not.)
25439
+ if (
25440
+ o.some(
25441
+ x =>
25442
+ x !== st &&
25443
+ x.on === st.on &&
25444
+ !x.state &&
25445
+ /^background/.test(x.thing),
25446
+ )
25447
+ )
25448
+ continue;
25449
+ const variants = C.variantValues(one(st.on)).variant ?? [];
25450
+ if (variants.length < 2 || !variants.includes('primary')) continue;
25451
+ const fills = (C.partReads(one(st.on), 'background') ?? []).filter(
25452
+ r => /^--color-/.test(r.token) && !/overlay|tint/.test(r.token),
25453
+ );
25454
+ const mode = /** @type {'light' | 'dark'} */ (st.mode ?? 'light');
23062
25455
  const lost = variants.filter(v => {
23063
- const t = ink.get(v);
23064
- const rgb = t ? parseColor(String(current(t, mode) ?? '')) : null;
23065
- return rgb != null && ratio(fill, rgb) < 3;
25456
+ const r = fills.find(x =>
25457
+ x.when.some(w => w.trim() === `variant=${v}`),
25458
+ );
25459
+ const f = parseColor(
25460
+ String(current(r?.token ?? '--color-background-body', mode) ?? ''),
25461
+ );
25462
+ return !!f && ratio(ink, f) < 3;
23066
25463
  });
23067
25464
  if (!lost.length || lost.length === variants.length) continue;
23068
25465
  o.splice(
@@ -23072,8 +25469,8 @@ export function draftAnswer(ctx, env, question) {
23072
25469
  .filter(v => !lost.includes(v))
23073
25470
  .map(v => ({...st, when: `variant:${v}`})),
23074
25471
  );
23075
- if (!/keep their own fill|keeps its own fill/.test(d.text))
23076
- d.text += ` (${lost.join(', ')} ${lost.length > 1 ? 'keep their own fill' : 'keeps its own fill'}: ${lost.length > 1 ? 'their' : 'its'} text would barely show on ${st.value}; give ${lost.length > 1 ? 'them' : 'it'} a text color too to change ${lost.length > 1 ? 'them' : 'it'})`;
25472
+ if (!/keep their own text|keeps its own text/.test(d.text))
25473
+ d.text += ` (${lost.join(', ')} ${lost.length > 1 ? 'keep their own text' : 'keeps its own text'}: ${st.value} would barely show on ${lost.length > 1 ? 'their' : 'its'} fill; give ${lost.length > 1 ? 'them' : 'it'} a fill too to change ${lost.length > 1 ? 'them' : 'it'})`;
23077
25474
  }
23078
25475
  }
23079
25476
  // A fill given to a part that holds others ("a navy header"): a part
@@ -23122,6 +25519,8 @@ export function draftAnswer(ctx, env, question) {
23122
25519
  }
23123
25520
  for (const n of placeNotes)
23124
25521
  if (!keptInPlace.has(n.c)) result.push({text: n.text, options: []});
25522
+ // (The other reading of states said together, said last.)
25523
+ result.push(...otherReadings);
23125
25524
  // A panel's look written for every one (a card's) reaches the panels an
23126
25525
  // app places in a layout too (cards in a carousel, a grid or a stack, as
23127
25526
  // tiles): said once, with the place to ask for to keep them apart.
@@ -23211,6 +25610,156 @@ export function draftAnswer(ctx, env, question) {
23211
25610
  ),
23212
25611
  ),
23213
25612
  );
25613
+ // "line height 0", "padding 99999px on buttons": a typed value no
25614
+ // page could show (lines drawn on top of each other, a box wider than
25615
+ // any screen) is not written; the answer says what it would do and the
25616
+ // range that reads.
25617
+ for (const d of result) {
25618
+ /** @type {string[]} */
25619
+ const why = [];
25620
+ const kept = d.options.filter(o => {
25621
+ const bad = o.map(st => outOfBounds(st)).find(Boolean);
25622
+ if (bad) why.push(bad);
25623
+ return !bad;
25624
+ });
25625
+ if (!why.length) continue;
25626
+ d.options = kept;
25627
+ d.text = kept.length
25628
+ ? `${d.text} (left out: ${[...new Set(why)].join('; ')})`
25629
+ : `${d.text}: nothing is written: ${[...new Set(why)].join('; ')}`;
25630
+ if (!kept.length) delete d.sequence;
25631
+ }
25632
+ // "bold white text in the header": a text color typed for a region of
25633
+ // the page (a part filled with the page or surface color, which flips
25634
+ // with the mode), with no fill asked for it, is measured on that fill;
25635
+ // where it would not read (under 3:1) in one mode only, it is set for
25636
+ // the mode it reads in, and the answer says how to have it in both.
25637
+ {
25638
+ const filled = new Set(
25639
+ result.flatMap(d =>
25640
+ d.options
25641
+ .flat()
25642
+ .filter(
25643
+ st =>
25644
+ st.on &&
25645
+ (/^background(?:-color)?$/.test(st.thing) ||
25646
+ /^--color-background-/.test(st.thing)),
25647
+ )
25648
+ .map(st => String(st.on)),
25649
+ ),
25650
+ );
25651
+ for (const d of result) {
25652
+ if (d.options.length !== 1 || !modal) continue;
25653
+ const o = d.options[0];
25654
+ const inks = o.filter(
25655
+ st =>
25656
+ st.on &&
25657
+ !st.mode &&
25658
+ !st.state &&
25659
+ !st.when &&
25660
+ (st.thing === 'color' ||
25661
+ /^--color-text-(?:primary|secondary)$/.test(st.thing)),
25662
+ );
25663
+ if (!inks.length || inks.length !== o.length) continue;
25664
+ const on = String(inks[0].on);
25665
+ if (filled.has(on) || !C.MAP[one(on)] || C.MAP[one(on)]?.media) continue;
25666
+ if (inks.some(st => st.value !== inks[0].value)) continue;
25667
+ const ink = parseColor(String(inks[0].value ?? ''));
25668
+ const bgTok = restRead(C.partReads(one(on), 'background') ?? []);
25669
+ if (
25670
+ !ink ||
25671
+ (bgTok !== '--color-background-body' &&
25672
+ bgTok !== '--color-background-surface')
25673
+ )
25674
+ continue;
25675
+ /** @param {'light' | 'dark'} m */
25676
+ const ground = m => parseColor(String(current(bgTok, m) ?? ''));
25677
+ const reads = /** @type {Array<'light' | 'dark'>} */ ([
25678
+ 'light',
25679
+ 'dark',
25680
+ ]).filter(m => {
25681
+ const g = ground(m);
25682
+ return !g || ratio(ink, g) >= 3;
25683
+ });
25684
+ if (reads.length !== 1) continue;
25685
+ const other = reads[0] === 'light' ? 'dark' : 'light';
25686
+ const g = ground(other);
25687
+ for (const st of inks) st.mode = reads[0];
25688
+ d.text = `${d.text}, in ${reads[0]} mode only: ${on} is ${g ? hex(g.slice(0, 3)) : 'light'} in ${other} mode, where ${inks[0].value} would not read; for both modes, give ${on} a background too`;
25689
+ }
25690
+ }
25691
+ // "make the primary button #0064E0", "pumpkin orange buttons": a fill
25692
+ // typed on a part is measured against the text each of its looks draws
25693
+ // on it, as set measures it after; a look whose text would not read
25694
+ // (under 4.5:1) in a mode takes a text color that does there, white or
25695
+ // black, beside the fill. A text that reads keeps the fill line alone.
25696
+ for (const [di, d] of [...result.entries()].reverse()) {
25697
+ const o = d.options[0];
25698
+ if (!o || o.length !== 1) continue;
25699
+ const st = o[0];
25700
+ const fill = parseColor(String(st.value ?? ''));
25701
+ if (
25702
+ !st.on ||
25703
+ !/^background(?:-color)?$/.test(st.thing) ||
25704
+ !fill ||
25705
+ alphaOf(String(st.value)) < 1 ||
25706
+ !C.MAP[one(st.on)] ||
25707
+ textOnlyPart(one(st.on)) ||
25708
+ FAMILIES[st.on]
25709
+ )
25710
+ continue;
25711
+ const textReads = C.partReads(one(st.on), 'text') ?? [];
25712
+ // (Each look the fill reaches: the one named, else each variant.)
25713
+ const variants = st.when
25714
+ ? [String(st.when)]
25715
+ : (C.variantValues(one(st.on))?.variant ?? []).map(v => `variant:${v}`);
25716
+ const looks = variants.length ? variants : [''];
25717
+ const modes = /** @type {Array<'light' | 'dark'>} */ (
25718
+ st.mode
25719
+ ? [st.mode]
25720
+ : modal
25721
+ ? ['light', 'dark']
25722
+ : [env.data.mode === 'dark-only' ? 'dark' : 'light']
25723
+ );
25724
+ /** @type {Step[]} */
25725
+ const fixes = [];
25726
+ for (const look of looks) {
25727
+ const tok = restRead(textReads, look);
25728
+ if (!tok) continue;
25729
+ for (const m of modes) {
25730
+ const ink = parseColor(String(current(tok, m) ?? ''));
25731
+ if (!ink || alphaOf(String(current(tok, m))) < 1) continue;
25732
+ if (ratio(ink, fill) >= 4.5) continue;
25733
+ const white = ratio([255, 255, 255], fill);
25734
+ const black = ratio([0, 0, 0], fill);
25735
+ fixes.push(
25736
+ set('color', white >= black ? '#ffffff' : '#000000', {
25737
+ on: st.on,
25738
+ ...(look ? {when: look} : {}),
25739
+ ...(st.state ? {state: st.state} : {}),
25740
+ ...(modes.length > 1 || st.mode ? {mode: m} : {}),
25741
+ }),
25742
+ );
25743
+ }
25744
+ }
25745
+ if (!fixes.length || !env.check([st, ...fixes]).ok) continue;
25746
+ // (Its own line beside the fill's, so the fill reads as asked and the
25747
+ // text as measured.)
25748
+ const where = fixes
25749
+ .map(x =>
25750
+ `${x.when ? `${x.when.replace(':', ' ')} ` : ''}${x.mode ? `in ${x.mode} mode` : ''}`.trim(),
25751
+ )
25752
+ .filter(Boolean)
25753
+ .join(', ');
25754
+ // (A one-mode theme's line names no mode: nothing to put in brackets.)
25755
+ const at = where ? ` (${where})` : '';
25756
+ d.text = `${d.text}; its text would not read on that fill${at}: the next line keeps it readable`;
25757
+ result.splice(di + 1, 0, {
25758
+ text: `readable text on that fill: ${st.on}'s text measures under 4.5:1 on ${st.value}${at}, so ${[...new Set(fixes.map(x => x.value))].join(' or ')}`,
25759
+ options: [fixes],
25760
+ ...(fixes.length > 1 ? {sequence: true} : {}),
25761
+ });
25762
+ }
23214
25763
  // "make the info banner navy": one status's fill on one part, or that
23215
25764
  // status's color for the whole theme (its banners, badges and toasts
23216
25765
  // together), the dial; both are offered, the part's first.
@@ -23245,8 +25794,9 @@ export function draftAnswer(ctx, env, question) {
23245
25794
  // are named, never dropped without a word.
23246
25795
  if (
23247
25796
  !gateAll &&
23248
- /\b(?:theme|vibe|palette|aesthetic|branding)\b/.test(q) &&
23249
- result.some(d => d.options.some(o => o.length))
25797
+ (/\b(?:theme|vibe|palette|aesthetic|branding|feel)\b/.test(q) ||
25798
+ (!partsSeen.length &&
25799
+ q.split(/[,;:]|\band\b/).filter(x => x.trim()).length >= 3))
23250
25800
  ) {
23251
25801
  const STOP =
23252
25802
  /^(?:theme|themes|look|looks|feel|vibe|style|palette|with|give|make|want|need|have|this|that|those|these|their|ours?|your|for|and|but|the|very|really|quite|some|more|less|less|like|into|from|only|both|mode|modes|site|sites|apps?|page|pages|product|website|please|also|plus|something|kind|sort|ish|using|uses|feeling|overall|while|keep|kept|just|still|then|than|colou?rs?|them|they|those|these|what|when|where|which|lighten|darken|soften|brighten|sharpen|tone|default|brand|color|deep|rich)$/;