@astryxdesign/cli 0.7.17-canary.g49a475f → 0.7.17-canary.g5a3fd39

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 (653) hide show
  1. package/README.md +14 -9
  2. package/api/build/_adapter.d.mts +33 -4
  3. package/api/build/_adapter.mjs +43 -8
  4. package/api/build/blocks/blocks.d.mts +1 -0
  5. package/api/build/blocks/blocks.mjs +2 -1
  6. package/api/build/blocks/blocks.weights.json +1 -1
  7. package/api/build/build.doc.mjs +2 -2
  8. package/api/build/build.type.d.mts +13 -1
  9. package/api/build/build.type.mjs +6 -3
  10. package/api/build/kit/kind.d.mts +6 -0
  11. package/api/build/kit/kind.mjs +1 -1
  12. package/api/build/kit/kit.mjs +3 -3
  13. package/api/build/kit/rank.d.mts +9 -3
  14. package/api/build/kit/rank.mjs +21 -8
  15. package/api/build/kit/signals.d.mts +7 -1
  16. package/api/build/kit/signals.mjs +124 -41
  17. package/api/build/kit/start.d.mts +20 -5
  18. package/api/build/kit/start.mjs +103 -23
  19. package/api/build/kit/weights.d.mts +20 -4
  20. package/api/build/kit/weights.json +1 -1
  21. package/api/build/kit/weights.mjs +68 -18
  22. package/api/build/kit/words.d.mts +44 -2
  23. package/api/build/kit/words.mjs +159 -4
  24. package/api/build/tree.mjs +1 -1
  25. package/api/component/__fixtures__/resolutions/modules.txt +4 -4
  26. package/api/component/_adapter.d.mts +51 -20
  27. package/api/component/_adapter.mjs +198 -29
  28. package/api/component/component.mjs +18 -5
  29. package/api/component/component.type.d.mts +4 -0
  30. package/api/component/component.type.mjs +1 -0
  31. package/api/component/detail/blocks/blocks.mjs +1 -0
  32. package/api/component/detail/detail.d.mts +2 -2
  33. package/api/component/detail/detail.mjs +1 -1
  34. package/api/component/list/list.d.mts +2 -2
  35. package/api/component/list/list.mjs +4 -4
  36. package/api/discover/_adapter.d.mts +10 -0
  37. package/api/discover/_adapter.mjs +110 -16
  38. package/api/discover/detail/item/item.mjs +5 -0
  39. package/api/discover/discover.mjs +12 -3
  40. package/api/discover/discover.type.d.mts +16 -3
  41. package/api/discover/discover.type.mjs +13 -3
  42. package/api/docs/_adapter.d.mts +74 -30
  43. package/api/docs/_adapter.mjs +488 -234
  44. package/api/docs/_entry-names-lazily.d.mts +22 -0
  45. package/api/docs/_entry-names-lazily.mjs +25 -0
  46. package/api/docs/_entry-names.d.mts +23 -0
  47. package/api/docs/_entry-names.mjs +105 -0
  48. package/api/doctor/_adapter.d.mts +63 -2
  49. package/api/doctor/_adapter.mjs +141 -5
  50. package/api/doctor/doctor.d.mts +11 -0
  51. package/api/doctor/doctor.doc.mjs +1 -1
  52. package/api/doctor/doctor.mjs +81 -30
  53. package/api/doctor/theme-checks.d.mts +35 -3
  54. package/api/doctor/theme-checks.mjs +449 -99
  55. package/api/error.d.mts +4 -3
  56. package/api/error.mjs +3 -2
  57. package/api/hook/_adapter.d.mts +14 -7
  58. package/api/hook/_adapter.mjs +46 -9
  59. package/api/hook/detail/detail.mjs +5 -2
  60. package/api/hook/detail/params/params.mjs +10 -3
  61. package/api/icon/_options.d.mts +17 -0
  62. package/api/icon/_options.mjs +54 -0
  63. package/api/icon/exportIconIndex.doc.d.mts +10 -0
  64. package/api/icon/exportIconIndex.doc.mjs +59 -0
  65. package/api/icon/icon.mjs +11 -34
  66. package/api/icon/icon.type.d.mts +49 -0
  67. package/api/icon/icon.type.mjs +24 -0
  68. package/api/icon/rankIconIndex.doc.d.mts +10 -0
  69. package/api/icon/rankIconIndex.doc.mjs +79 -0
  70. package/api/icon/search/icon-index.d.mts +41 -0
  71. package/api/icon/search/icon-index.mjs +139 -0
  72. package/api/icon/search/search.d.mts +18 -0
  73. package/api/icon/search/search.mjs +13 -0
  74. package/api/index.d.mts +1 -0
  75. package/api/index.mjs +1 -0
  76. package/api/integration/add-helpers.mjs +10 -0
  77. package/api/integration/authoring-checks.mjs +5 -2
  78. package/api/integration/check/check.mjs +6 -1
  79. package/api/integration/pack-check.mjs +50 -3
  80. package/api/integration/validate-integration.d.mts +18 -6
  81. package/api/integration/validate-integration.mjs +110 -14
  82. package/api/integration/validate-integration.type.d.mts +13 -0
  83. package/api/integration/validate-integration.type.mjs +2 -1
  84. package/api/integration/validateIntegration.doc.mjs +1 -1
  85. package/api/render/render.type.d.mts +1 -1
  86. package/api/render/render.type.mjs +1 -1
  87. package/api/search/ORDERING.md +1 -1
  88. package/api/search/_adapter.d.mts +8 -5
  89. package/api/search/_adapter.mjs +14 -10
  90. package/api/search/_candidate-score.d.mts +9 -4
  91. package/api/search/_candidate-score.mjs +82 -14
  92. package/api/search/_gather-components.d.mts +4 -4
  93. package/api/search/_gather-components.mjs +4 -3
  94. package/api/search/_gather-hooks.d.mts +2 -2
  95. package/api/search/_gather-hooks.mjs +1 -1
  96. package/api/search/_gather-templates.mjs +1 -0
  97. package/api/search/_lexical.d.mts +16 -0
  98. package/api/search/_lexical.mjs +98 -10
  99. package/api/search/_priority.d.mts +10 -2
  100. package/api/search/_priority.mjs +37 -7
  101. package/api/search/_result.d.mts +1 -0
  102. package/api/search/_result.mjs +1 -0
  103. package/api/search/_score.d.mts +12 -3
  104. package/api/search/_score.mjs +6 -3
  105. package/api/search/_words.mjs +12 -3
  106. package/api/search/search.d.mts +7 -1
  107. package/api/search/search.doc.mjs +1 -1
  108. package/api/search/search.mjs +37 -4
  109. package/api/search/search.type.d.mts +4 -0
  110. package/api/search/search.type.mjs +1 -0
  111. package/api/swizzle/_adapter.d.mts +7 -5
  112. package/api/swizzle/_adapter.mjs +22 -6
  113. package/api/swizzle/copy/copy.mjs +5 -4
  114. package/api/template/_adapter.d.mts +16 -0
  115. package/api/template/_adapter.mjs +39 -2
  116. package/api/template/cdn/cdn.mjs +37 -8
  117. package/api/template/copy/copy.d.mts +6 -3
  118. package/api/template/copy/copy.mjs +83 -8
  119. package/api/template/show/show.mjs +1 -0
  120. package/api/template/skeleton/skeleton.mjs +1 -0
  121. package/api/template/template.doc.mjs +5 -5
  122. package/api/template/template.mjs +63 -11
  123. package/api/template/template.type.d.mts +4 -0
  124. package/api/template/template.type.mjs +5 -1
  125. package/api/theme/_adapter.d.mts +20 -1
  126. package/api/theme/_adapter.mjs +149 -12
  127. package/api/theme/_app-provider.d.mts +31 -0
  128. package/api/theme/_app-provider.mjs +135 -0
  129. package/api/theme/add/add.mjs +3 -1
  130. package/api/theme/build/build.d.mts +127 -11
  131. package/api/theme/build/build.mjs +2047 -352
  132. package/api/theme/build/core-interception.d.mts +10 -0
  133. package/api/theme/build/core-interception.mjs +10 -0
  134. package/api/theme/build/family.mjs +61 -21
  135. package/api/theme/build/font-warning.d.mts +99 -5
  136. package/api/theme/build/font-warning.mjs +379 -61
  137. package/api/theme/build/icon-imports.mjs +83 -15
  138. package/api/theme/build/input-fields.d.mts +110 -0
  139. package/api/theme/build/input-fields.mjs +667 -0
  140. package/api/theme/build/null-values.d.mts +42 -0
  141. package/api/theme/build/null-values.mjs +283 -0
  142. package/api/theme/build/self-contained.d.mts +90 -0
  143. package/api/theme/build/self-contained.mjs +380 -0
  144. package/api/theme/build/source-syntax.d.mts +11 -0
  145. package/api/theme/build/source-syntax.mjs +28 -0
  146. package/api/theme/build/style-keys.d.mts +72 -0
  147. package/api/theme/build/style-keys.mjs +589 -0
  148. package/api/theme/build/typography-values.d.mts +61 -0
  149. package/api/theme/build/typography-values.mjs +408 -0
  150. package/api/theme/build/written-values.d.mts +78 -0
  151. package/api/theme/build/written-values.mjs +482 -0
  152. package/api/theme/generateTonalPalette.doc.mjs +1 -1
  153. package/api/theme/list/list.mjs +17 -1
  154. package/api/theme/palette/generate/generator.d.mts +14 -2
  155. package/api/theme/palette/generate/generator.mjs +94 -8
  156. package/api/theme/remove/remove.d.mts +2 -1
  157. package/api/theme/remove/remove.mjs +7 -3
  158. package/api/theme/theme.type.d.mts +89 -5
  159. package/api/theme/theme.type.mjs +46 -7
  160. package/api/theme/themeAdd.doc.mjs +1 -1
  161. package/api/theme/themeBuild.doc.mjs +1 -1
  162. package/api/theme/themeListAvailable.doc.mjs +1 -1
  163. package/api/theme/themePaletteGenerate.doc.mjs +1 -1
  164. package/api/theme/themeRemove.doc.mjs +8 -5
  165. package/api/theme/themeTemplate.doc.mjs +18 -3
  166. package/api/theme-edit/_adapter.d.mts +57 -4
  167. package/api/theme-edit/_adapter.mjs +380 -73
  168. package/api/theme-edit/_catalog.d.mts +82 -4
  169. package/api/theme-edit/_catalog.mjs +397 -24
  170. package/api/theme-edit/_check.d.mts +153 -2
  171. package/api/theme-edit/_check.mjs +3028 -563
  172. package/api/theme-edit/_color.d.mts +27 -2
  173. package/api/theme-edit/_color.mjs +66 -8
  174. package/api/theme-edit/_compiler.d.mts +7 -2
  175. package/api/theme-edit/_compiler.mjs +335 -21
  176. package/api/theme-edit/_context.d.mts +192 -7
  177. package/api/theme-edit/_context.mjs +750 -70
  178. package/api/theme-edit/_css.d.mts +32 -0
  179. package/api/theme-edit/_css.mjs +121 -34
  180. package/api/theme-edit/_edit.d.mts +68 -5
  181. package/api/theme-edit/_edit.mjs +5119 -667
  182. package/api/theme-edit/_how-commands.d.mts +28 -1
  183. package/api/theme-edit/_how-commands.mjs +621 -17
  184. package/api/theme-edit/_how-question.d.mts +101 -9
  185. package/api/theme-edit/_how-question.mjs +13901 -1282
  186. package/api/theme-edit/_how.d.mts +13 -2
  187. package/api/theme-edit/_how.mjs +389 -32
  188. package/api/theme-edit/_importers.d.mts +38 -0
  189. package/api/theme-edit/_importers.mjs +188 -0
  190. package/api/theme-edit/_missed.d.mts +54 -0
  191. package/api/theme-edit/_missed.mjs +917 -0
  192. package/api/theme-edit/_normal.d.mts +110 -21
  193. package/api/theme-edit/_normal.mjs +700 -105
  194. package/api/theme-edit/_palette.d.mts +77 -0
  195. package/api/theme-edit/_palette.mjs +364 -73
  196. package/api/theme-edit/_part-words.d.mts +39 -0
  197. package/api/theme-edit/_part-words.mjs +191 -0
  198. package/api/theme-edit/_parts.d.mts +74 -4
  199. package/api/theme-edit/_parts.mjs +677 -73
  200. package/api/theme-edit/_preview-app.d.mts +8 -13
  201. package/api/theme-edit/_preview-app.mjs +1189 -559
  202. package/api/theme-edit/_preview.d.mts +151 -10
  203. package/api/theme-edit/_preview.mjs +785 -98
  204. package/api/theme-edit/_project.d.mts +38 -3
  205. package/api/theme-edit/_project.mjs +135 -8
  206. package/api/theme-edit/_settings.d.mts +678 -83
  207. package/api/theme-edit/_settings.mjs +6037 -1051
  208. package/api/theme-edit/_tables.d.mts +43 -3
  209. package/api/theme-edit/_tables.mjs +244 -59
  210. package/api/theme-edit/_vet.d.mts +14 -1
  211. package/api/theme-edit/_vet.mjs +86 -12
  212. package/api/theme-edit/theme-edit.type.d.mts +53 -3
  213. package/api/theme-edit/theme-edit.type.mjs +23 -5
  214. package/api/theme-edit/themeEditPreviewApp.doc.mjs +1 -1
  215. package/api/upgrade/_adapter.mjs +13 -2
  216. package/api/upgrade/upgrade.mjs +16 -1
  217. package/assets/codemods/integration-runner.mjs +1 -1
  218. package/assets/codemods/jscodeshift.d.ts +1 -1
  219. package/assets/codemods/parse.mjs +2 -2
  220. package/assets/codemods/run-codemod.mjs +71 -18
  221. package/assets/codemods/runner.mjs +1 -4
  222. package/assets/component-list.generated.json +1 -1
  223. package/assets/docs/author-a-theme.doc.mjs +1 -0
  224. package/assets/docs/theme.doc.dense.mjs +86 -7
  225. package/assets/docs/theme.doc.mjs +76 -2
  226. package/assets/docs/theme.doc.zh.mjs +61 -1
  227. package/assets/docs/tree/authoring.doc.mjs +1 -0
  228. package/assets/docs/tree/checks.doc.mjs +2 -2
  229. package/assets/docs/tree/cli.doc.mjs +1 -0
  230. package/assets/docs/tree/computer-agent-guide.doc.mjs +1 -1
  231. package/assets/docs/tree/document-the-theme.doc.mjs +1 -1
  232. package/assets/docs/tree/font-setup.doc.mjs +1 -1
  233. package/assets/docs/tree/fonts-and-assets.doc.mjs +1 -1
  234. package/assets/docs/tree/generate-a-palette.doc.mjs +2 -2
  235. package/assets/docs/tree/global.doc.mjs +1 -0
  236. package/assets/docs/tree/install-once.doc.mjs +1 -1
  237. package/assets/docs/tree/problems.doc.mjs +1 -1
  238. package/assets/docs/tree/render-pages.doc.mjs +2 -2
  239. package/assets/docs/tree/share-a-page.doc.mjs +162 -0
  240. package/assets/docs/tree/single-component.doc.mjs +40 -2
  241. package/assets/docs/tree/updates.doc.mjs +1 -1
  242. package/assets/docs/tree/who-answers.doc.mjs +3 -3
  243. package/assets/docs/tree/write-good-templates.doc.mjs +1 -1
  244. package/assets/docs/use-a-theme.doc.mjs +1 -1
  245. package/assets/docs-routes.generated.json +1 -0
  246. package/assets/docs.generated.json +2 -2
  247. package/assets/search-catalog.generated.json +2 -2
  248. package/assets/self-audit.generated.json +1 -1
  249. package/assets/templates/blocks/components/Blockquote/BlockquoteShowcase.tsx +1 -1
  250. package/assets/templates/blocks/components/BreadcrumbItem/BreadcrumbItemShowcase.tsx +4 -4
  251. package/assets/templates/blocks/components/Breadcrumbs/BreadcrumbsCustomSeparator.tsx +1 -0
  252. package/assets/templates/blocks/components/Breadcrumbs/BreadcrumbsSupportingVariant.tsx +2 -2
  253. package/assets/templates/blocks/components/Card/CardElevations.tsx +1 -1
  254. package/assets/templates/blocks/components/Card/CardWithInnerLayout.tsx +19 -3
  255. package/assets/templates/blocks/components/Card/ClickableCardWithNestedButton.tsx +11 -1
  256. package/assets/templates/blocks/components/Card/SelectableCardElevated.tsx +1 -1
  257. package/assets/templates/blocks/components/Card/SelectableCardMulti.tsx +1 -1
  258. package/assets/templates/blocks/components/Center/CenterHorizontal.tsx +1 -1
  259. package/assets/templates/blocks/components/Center/CenterInsideACard.tsx +1 -1
  260. package/assets/templates/blocks/components/ChatComposer/ChatComposerFullFeatured.tsx +8 -0
  261. package/assets/templates/blocks/components/ChatComposerDrawer/ChatComposerDrawerWithProgress.tsx +8 -2
  262. package/assets/templates/blocks/components/ChatComposerInput/useChatPasteAsTokenHookUsage.doc.mjs +14 -0
  263. package/assets/templates/blocks/components/ChatComposerInput/useChatPasteAsTokenHookUsage.tsx +32 -0
  264. package/assets/templates/blocks/components/ChatComposerInput/useSpeechRecognitionHookUsage.doc.mjs +14 -0
  265. package/assets/templates/blocks/components/ChatComposerInput/useSpeechRecognitionHookUsage.tsx +43 -0
  266. package/assets/templates/blocks/components/ChatLayout/ChatLayoutPanelChat.tsx +1 -0
  267. package/assets/templates/blocks/components/ChatLayout/ChatLayoutShowcase.tsx +1 -1
  268. package/assets/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleCustomContent.tsx +9 -1
  269. package/assets/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleMetadata.tsx +12 -2
  270. package/assets/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataFooter.tsx +28 -7
  271. package/assets/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataShowcase.tsx +35 -7
  272. package/assets/templates/blocks/components/Collapsible/CollapsibleShowcase.tsx +1 -1
  273. package/assets/templates/blocks/components/CommandPaletteGroup/CommandPaletteGroupBasic.tsx +20 -4
  274. package/assets/templates/blocks/components/CommandPaletteList/CommandPaletteListBasic.tsx +15 -3
  275. package/assets/templates/blocks/components/CommandPaletteList/CommandPaletteListShowcase.tsx +29 -6
  276. package/assets/templates/blocks/components/ContextMenu/ContextMenuBasic.tsx +2 -2
  277. package/assets/templates/blocks/components/ContextMenu/ContextMenuBottomSheet.tsx +1 -1
  278. package/assets/templates/blocks/components/ContextMenu/ContextMenuShowcase.tsx +2 -2
  279. package/assets/templates/blocks/components/Divider/DividerFullBleed.tsx +1 -1
  280. package/assets/templates/blocks/components/Divider/DividerShowcase.tsx +1 -1
  281. package/assets/templates/blocks/components/Divider/DividerVariants.tsx +1 -1
  282. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.tsx +23 -4
  283. package/assets/templates/blocks/components/EmptyState/EmptyStateActions.tsx +18 -2
  284. package/assets/templates/blocks/components/EmptyState/EmptyStateCompact.tsx +20 -2
  285. package/assets/templates/blocks/components/EmptyState/EmptyStateContainer.tsx +16 -2
  286. package/assets/templates/blocks/components/EmptyState/EmptyStateShowcase.tsx +11 -1
  287. package/assets/templates/blocks/components/Heading/HeadingTruncation.tsx +12 -2
  288. package/assets/templates/blocks/components/InternationalizationProvider/useDirectionHookUsage.tsx +1 -1
  289. package/assets/templates/blocks/components/LayoutContent/LayoutContentBasic.tsx +1 -1
  290. package/assets/templates/blocks/components/LayoutContent/LayoutContentShowcase.tsx +1 -1
  291. package/assets/templates/blocks/components/LayoutFooter/LayoutFooterActions.tsx +17 -3
  292. package/assets/templates/blocks/components/LayoutFooter/LayoutFooterShowcase.tsx +17 -3
  293. package/assets/templates/blocks/components/LayoutHeader/LayoutHeaderShowcase.tsx +15 -3
  294. package/assets/templates/blocks/components/LayoutHeader/LayoutHeaderWithActions.tsx +9 -2
  295. package/assets/templates/blocks/components/LayoutPanel/LayoutPanelNavigation.tsx +1 -1
  296. package/assets/templates/blocks/components/LayoutPanel/LayoutPanelShowcase.tsx +1 -1
  297. package/assets/templates/blocks/components/MoreMenu/MoreMenuBottomSheet.tsx +1 -1
  298. package/assets/templates/blocks/components/MultiSelector/MultiSelectorGhostToolbar.tsx +14 -2
  299. package/assets/templates/blocks/components/Outline/OutlineDensity.tsx +2 -0
  300. package/assets/templates/blocks/components/OverflowList/OverflowListShowcase.tsx +6 -1
  301. package/assets/templates/blocks/components/Pagination/PaginationVariants.tsx +4 -0
  302. package/assets/templates/blocks/components/Popover/PopoverHookUsage.tsx +17 -2
  303. package/assets/templates/blocks/components/SegmentedControl/SegmentedControlFillLayout.tsx +1 -1
  304. package/assets/templates/blocks/components/Selector/SelectorGhostToolbar.tsx +14 -2
  305. package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.tsx +8 -1
  306. package/assets/templates/blocks/components/SideNav/SideNavWithHeaderMenu.tsx +2 -2
  307. package/assets/templates/blocks/components/SideNavHeading/SideNavHeadingShowcase.tsx +2 -0
  308. package/assets/templates/blocks/components/Switch/SwitchWithStatus.tsx +1 -1
  309. package/assets/templates/blocks/components/TabList/TabListTabsFillLayout.tsx +1 -1
  310. package/assets/templates/blocks/components/TabList/TabListTabsWithActions.tsx +12 -1
  311. package/assets/templates/blocks/components/Table/TableBulkActionsTable.tsx +11 -1
  312. package/assets/templates/blocks/components/Table/TableInCard.tsx +2 -2
  313. package/assets/templates/blocks/components/Text/TextTruncation.tsx +1 -1
  314. package/assets/templates/blocks/components/Text/TextWordBreak.tsx +12 -2
  315. package/assets/templates/blocks/components/Text/TextWrap.tsx +19 -4
  316. package/assets/templates/blocks/components/TextArea/TextAreaCharacterCount.tsx +1 -1
  317. package/assets/templates/blocks/components/TextArea/TextAreaShowcase.tsx +1 -1
  318. package/assets/templates/blocks/components/TextArea/TextAreaStates.tsx +1 -1
  319. package/assets/templates/blocks/components/TextArea/TextAreaValidation.tsx +1 -1
  320. package/assets/templates/blocks/components/TextArea/TextAreaWithIcon.tsx +1 -1
  321. package/assets/templates/blocks/components/TextInput/TextInputStatusVariant.tsx +2 -2
  322. package/assets/templates/blocks/components/Timestamp/TimestampAutoFormat.tsx +15 -1
  323. package/assets/templates/blocks/components/Timestamp/TimestampRelativeFormat.tsx +15 -1
  324. package/assets/templates/blocks/components/Toolbar/ToolbarCardHeader.tsx +8 -0
  325. package/assets/templates/blocks/components/Toolbar/ToolbarSizes.tsx +12 -1
  326. package/assets/templates/blocks/components/Toolbar/ToolbarThreeSlot.tsx +18 -3
  327. package/assets/templates/blocks/components/TopNav/TopNavCenteredNavigation.tsx +6 -0
  328. package/assets/templates/blocks/components/TopNav/TopNavEnterpriseDashboard.tsx +7 -1
  329. package/assets/templates/blocks/components/TopNav/TopNavMegaMenu.tsx +2 -2
  330. package/assets/templates/blocks/components/TopNav/TopNavShowcase.tsx +9 -0
  331. package/assets/templates/components.generated.json +1 -1
  332. package/assets/templates/pages/ai-chat/page.tsx +102 -6
  333. package/assets/templates/pages/ai-chat-landing/page.tsx +31 -4
  334. package/assets/templates/pages/ai-chat-landing/template.doc.mjs +3 -0
  335. package/assets/templates/pages/canvas-editor/page.tsx +73 -2
  336. package/assets/templates/pages/centered-hero/page.tsx +10 -4
  337. package/assets/templates/pages/course-detail/page.tsx +46 -2
  338. package/assets/templates/pages/dashboard/page.tsx +45 -16
  339. package/assets/templates/pages/dashboard-alert-rail/page.tsx +1 -1
  340. package/assets/templates/pages/dashboard-cohort-funnel/page.tsx +32 -21
  341. package/assets/templates/pages/dashboard-comparison/page.tsx +11 -2
  342. package/assets/templates/pages/dashboard-composition/page.tsx +22 -9
  343. package/assets/templates/pages/dashboard-progress/page.tsx +28 -16
  344. package/assets/templates/pages/dashboard-scorecard/page.tsx +9 -0
  345. package/assets/templates/pages/detail-page/page.tsx +157 -76
  346. package/assets/templates/pages/documentation/page.tsx +15 -2
  347. package/assets/templates/pages/documentation-design/page.tsx +7 -34
  348. package/assets/templates/pages/documentation-technical/page.tsx +122 -65
  349. package/assets/templates/pages/editor/page.tsx +41 -24
  350. package/assets/templates/pages/file-explorer/page.tsx +44 -1
  351. package/assets/templates/pages/form-two-column/page.tsx +2 -3
  352. package/assets/templates/pages/form-wizard/page.tsx +31 -3
  353. package/assets/templates/pages/form-wizard-vertical/page.tsx +55 -6
  354. package/assets/templates/pages/gallery-hero/page.tsx +2 -1
  355. package/assets/templates/pages/ide/page.tsx +23 -0
  356. package/assets/templates/pages/ide/template.doc.mjs +1 -1
  357. package/assets/templates/pages/incident-console/page.tsx +130 -30
  358. package/assets/templates/pages/incident-console/template.doc.mjs +2 -2
  359. package/assets/templates/pages/kanban-board/page.tsx +50 -3
  360. package/assets/templates/pages/login-card/page.tsx +16 -0
  361. package/assets/templates/pages/login-split/page.tsx +19 -6
  362. package/assets/templates/pages/messaging-shell/page.tsx +409 -419
  363. package/assets/templates/pages/messaging-shell/template.doc.mjs +6 -6
  364. package/assets/templates/pages/payment-form/page.tsx +107 -43
  365. package/assets/templates/pages/product-detail/page.tsx +26 -2
  366. package/assets/templates/pages/product-gallery/page.tsx +16 -14
  367. package/assets/templates/pages/settings/page.tsx +35 -3
  368. package/assets/templates/pages/settings-dialog/page.tsx +196 -17
  369. package/assets/templates/pages/settings-sidebar/page.tsx +23 -3
  370. package/assets/templates/pages/shell-nav/page.tsx +28 -12
  371. package/assets/templates/pages/shell-side-nav/page.tsx +27 -4
  372. package/assets/templates/pages/shell-top-nav/page.tsx +27 -1
  373. package/assets/templates/pages/side-gallery/page.tsx +1 -1
  374. package/assets/templates/pages/table/page.tsx +575 -61
  375. package/assets/templates/pages/table/template.doc.mjs +11 -1
  376. package/assets/templates/pages/table-collapsible/page.tsx +1 -1
  377. package/assets/templates/pages/table-comparison/page.tsx +1 -1
  378. package/assets/templates/pages/table-filter/page.tsx +17 -1
  379. package/assets/templates/pages/table-grouped/page.tsx +171 -133
  380. package/assets/templates/pages/table-inbox/page.tsx +60 -1
  381. package/assets/templates/pages/table-page/page.tsx +23 -2
  382. package/assets/templates/pages/table-tree/page.tsx +95 -13
  383. package/assets/templates/pages/theme-showcase/page.tsx +107 -11
  384. package/assets/templates/pages/work-item-detail/page.tsx +134 -80
  385. package/assets/templates/pages/work-item-detail/template.doc.mjs +0 -1
  386. package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +1 -1
  387. package/assets/templates/themes/gothic/gothicTheme.ts +5 -0
  388. package/assets/templates/themes/neutral/neutralTheme.ts +1 -1
  389. package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +1 -1
  390. package/assets/templates/themes/y2k/y2kTheme.ts +1 -1
  391. package/assets/theme.template.ts +3 -2
  392. package/authoring/debug/parse.d.mts +1 -1
  393. package/authoring/doctypes/_schema.d.mts +28 -14
  394. package/authoring/doctypes/_schema.mjs +31 -0
  395. package/authoring/doctypes/command/command.doc.mjs +24 -0
  396. package/authoring/doctypes/command/type.ts +31 -0
  397. package/authoring/doctypes/component/component.doc.mjs +1 -1
  398. package/authoring/doctypes/component/type.ts +8 -5
  399. package/authoring/doctypes/namespace/namespace.doc.mjs +6 -0
  400. package/authoring/doctypes/namespace/type.ts +4 -0
  401. package/authoring/doctypes/template/template.doc.mjs +1 -1
  402. package/authoring/doctypes/template/type.ts +1 -1
  403. package/authoring/index.d.ts +6 -1
  404. package/authoring/integration/integration.doc.mjs +15 -0
  405. package/authoring/integration/schema.d.mts +30 -1
  406. package/authoring/integration/schema.mjs +129 -4
  407. package/authoring/integration/type.ts +48 -0
  408. package/clients/cli/bin/astryx.mjs +9 -3
  409. package/clients/cli/build-id.generated.json +1 -1
  410. package/clients/cli/commands/build.mjs +17 -5
  411. package/clients/cli/commands/component.doc.mjs +1 -0
  412. package/clients/cli/commands/component.mjs +107 -42
  413. package/clients/cli/commands/discover.mjs +70 -3
  414. package/clients/cli/commands/docs.doc.mjs +1 -1
  415. package/clients/cli/commands/docs.mjs +41 -5
  416. package/clients/cli/commands/doctor.mjs +52 -2
  417. package/clients/cli/commands/experimental/index.mjs +4 -1
  418. package/clients/cli/commands/experimental/theme.mjs +1504 -186
  419. package/clients/cli/commands/experimental-render.doc.mjs +18 -5
  420. package/clients/cli/commands/experimental-theme-add.doc.mjs +2 -0
  421. package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -2
  422. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +1 -0
  423. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +3 -1
  424. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +4 -3
  425. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +3 -2
  426. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +5 -4
  427. package/clients/cli/commands/experimental-theme-eject.doc.mjs +1 -0
  428. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +1 -0
  429. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +3 -2
  430. package/clients/cli/commands/experimental-theme-remove.doc.mjs +6 -4
  431. package/clients/cli/commands/experimental-theme-targets.doc.mjs +1 -0
  432. package/clients/cli/commands/experimental-theme-template.doc.mjs +1 -0
  433. package/clients/cli/commands/experimental-theme-use.doc.mjs +2 -0
  434. package/clients/cli/commands/gap-report.doc.mjs +1 -0
  435. package/clients/cli/commands/hook.doc.mjs +1 -1
  436. package/clients/cli/commands/init.doc.mjs +1 -1
  437. package/clients/cli/commands/init.mjs +14 -6
  438. package/clients/cli/commands/integration-add.doc.mjs +1 -0
  439. package/clients/cli/commands/manifest.mjs +10 -3
  440. package/clients/cli/commands/search.mjs +13 -1
  441. package/clients/cli/commands/swizzle.doc.mjs +9 -2
  442. package/clients/cli/commands/swizzle.mjs +13 -6
  443. package/clients/cli/commands/template.doc.mjs +4 -1
  444. package/clients/cli/commands/template.mjs +34 -7
  445. package/clients/cli/commands/theme-add.doc.mjs +3 -2
  446. package/clients/cli/commands/theme-build.doc.mjs +11 -2
  447. package/clients/cli/commands/theme-eject.doc.mjs +1 -1
  448. package/clients/cli/commands/theme-list.doc.mjs +1 -1
  449. package/clients/cli/commands/theme-palette-generate.doc.mjs +3 -2
  450. package/clients/cli/commands/theme-remove.doc.mjs +15 -6
  451. package/clients/cli/commands/theme-targets.doc.mjs +1 -0
  452. package/clients/cli/commands/theme-template.doc.mjs +1 -0
  453. package/clients/cli/commands/theme-use.doc.mjs +2 -1
  454. package/clients/cli/commands/theme.doc.mjs +7 -2
  455. package/clients/cli/commands/theme.mjs +824 -576
  456. package/clients/cli/commands/upgrade.mjs +7 -3
  457. package/clients/cli/index.mjs +177 -78
  458. package/clients/cli/lib/base-gate.mjs +522 -0
  459. package/clients/cli/lib/cli-error.mjs +21 -0
  460. package/clients/cli/lib/command-path.mjs +26 -0
  461. package/clients/cli/lib/define-command.mjs +161 -12
  462. package/clients/cli/lib/json-shim.mjs +679 -40
  463. package/clients/cli/lib/manifest.d.ts +14 -0
  464. package/clients/cli/lib/manifest.mjs +78 -22
  465. package/clients/cli/lib/not-ready.mjs +22 -0
  466. package/clients/cli/lib/root-args.mjs +79 -0
  467. package/clients/cli/lib/stray-option.mjs +491 -0
  468. package/clients/cli/lib/unknown-command.mjs +374 -0
  469. package/clients/cli/manifest.generated.json +1 -1
  470. package/clients/cli/run.mjs +39 -3
  471. package/foundation/agent-docs/agent-docs.mjs +1 -1
  472. package/foundation/agent-docs/computer-agent-text.mjs +1 -1
  473. package/foundation/bases/core-docs.d.mts +10 -0
  474. package/foundation/bases/core-docs.mjs +42 -0
  475. package/foundation/bases/core.d.mts +11 -0
  476. package/foundation/bases/core.mjs +32 -0
  477. package/foundation/bases/requirements.d.mts +128 -0
  478. package/foundation/bases/requirements.mjs +193 -0
  479. package/foundation/bases/resolve.d.mts +134 -0
  480. package/foundation/bases/resolve.mjs +295 -0
  481. package/foundation/bases/state.d.mts +24 -0
  482. package/foundation/bases/state.mjs +46 -0
  483. package/foundation/bases/steps.d.mts +49 -0
  484. package/foundation/bases/steps.mjs +88 -0
  485. package/foundation/config/project.d.mts +22 -0
  486. package/foundation/config/project.mjs +94 -30
  487. package/foundation/config/theme-build-header.d.mts +14 -0
  488. package/foundation/config/theme-build-header.mjs +14 -0
  489. package/foundation/config/theme-private-vars.d.mts +26 -2
  490. package/foundation/config/theme-private-vars.mjs +65 -5
  491. package/foundation/config/theme-state.d.mts +19 -2
  492. package/foundation/config/theme-state.mjs +93 -1
  493. package/foundation/debug/event.d.mts +8 -2
  494. package/foundation/debug/event.mjs +6 -7
  495. package/foundation/debug/recorder.d.mts +8 -1
  496. package/foundation/debug/recorder.mjs +8 -2
  497. package/foundation/discovery/cli-self-doc-names.d.mts +13 -0
  498. package/foundation/discovery/cli-self-doc-names.mjs +51 -0
  499. package/foundation/discovery/cli-self-docs.d.mts +0 -2
  500. package/foundation/discovery/cli-self-docs.mjs +11 -16
  501. package/foundation/discovery/command-pointers.d.mts +28 -0
  502. package/foundation/discovery/command-pointers.mjs +31 -0
  503. package/foundation/discovery/component-discovery.d.mts +9 -8
  504. package/foundation/discovery/component-discovery.mjs +12 -6
  505. package/foundation/discovery/core-component-docs.d.mts +29 -0
  506. package/foundation/discovery/core-component-docs.mjs +83 -0
  507. package/foundation/discovery/core-theme-facts.d.mts +70 -0
  508. package/foundation/discovery/core-theme-facts.mjs +384 -0
  509. package/foundation/discovery/docs-discovery.d.mts +84 -9
  510. package/foundation/discovery/docs-discovery.mjs +151 -60
  511. package/foundation/discovery/entry-name-files.d.mts +72 -9
  512. package/foundation/discovery/entry-name-files.mjs +193 -103
  513. package/foundation/discovery/hook-discovery.d.mts +16 -6
  514. package/foundation/discovery/hook-discovery.mjs +82 -43
  515. package/foundation/discovery/integration-component-views.d.mts +15 -0
  516. package/foundation/discovery/integration-component-views.mjs +91 -0
  517. package/foundation/discovery/module-exports.d.mts +26 -1
  518. package/foundation/discovery/module-exports.mjs +114 -40
  519. package/foundation/discovery/name-roots.d.mts +38 -0
  520. package/foundation/discovery/name-roots.mjs +108 -0
  521. package/foundation/discovery/next-routes.d.mts +48 -0
  522. package/foundation/discovery/next-routes.mjs +197 -0
  523. package/foundation/discovery/stored-self-audit.mjs +2 -0
  524. package/foundation/discovery/template-adapter.d.mts +31 -63
  525. package/foundation/discovery/template-adapter.mjs +38 -207
  526. package/foundation/discovery/template-destination.d.mts +28 -0
  527. package/foundation/discovery/template-destination.mjs +106 -0
  528. package/foundation/discovery/template-ids.d.mts +69 -0
  529. package/foundation/discovery/template-ids.mjs +203 -0
  530. package/foundation/discovery/template-needs.mjs +3 -1
  531. package/foundation/discovery/theme-discovery.d.mts +12 -0
  532. package/foundation/discovery/theme-discovery.mjs +34 -2
  533. package/foundation/discovery/theme-imports.d.mts +10 -0
  534. package/foundation/discovery/theme-imports.mjs +37 -4
  535. package/foundation/discovery/theming-targets.d.mts +13 -5
  536. package/foundation/discovery/theming-targets.mjs +38 -45
  537. package/foundation/doc-compiler/generated-levels.d.mts +43 -0
  538. package/foundation/doc-compiler/generated-levels.mjs +72 -0
  539. package/foundation/doc-compiler/literal-doc.d.mts +12 -0
  540. package/foundation/doc-compiler/literal-doc.mjs +322 -0
  541. package/foundation/doc-compiler/stored-docs.d.mts +7 -0
  542. package/foundation/doc-compiler/stored-docs.mjs +14 -1
  543. package/foundation/doc-compiler/tree.d.mts +18 -87
  544. package/foundation/doc-compiler/tree.mjs +57 -64
  545. package/foundation/env/intl-defaults.d.mts +39 -0
  546. package/foundation/env/intl-defaults.mjs +150 -0
  547. package/foundation/env/intl-now.d.mts +21 -0
  548. package/foundation/env/intl-now.mjs +25 -0
  549. package/foundation/env/package-manager.d.mts +11 -2
  550. package/foundation/env/package-manager.mjs +28 -4
  551. package/foundation/fonts/font-stylesheet.d.mts +38 -0
  552. package/foundation/fonts/font-stylesheet.mjs +128 -12
  553. package/foundation/fs/cache-eviction.d.mts +3 -1
  554. package/foundation/fs/cache-eviction.mjs +7 -1
  555. package/foundation/fs/exact-codec.d.mts +12 -2
  556. package/foundation/fs/exact-codec.mjs +23 -6
  557. package/foundation/fs/file-protection.mjs +12 -2
  558. package/foundation/fs/gather-cache.d.mts +81 -2
  559. package/foundation/fs/gather-cache.mjs +615 -97
  560. package/foundation/fs/glob.d.mts +16 -0
  561. package/foundation/fs/glob.mjs +105 -0
  562. package/foundation/fs/jiti-cache.mjs +14 -6
  563. package/foundation/fs/kept-tree.d.mts +39 -15
  564. package/foundation/fs/kept-tree.mjs +155 -46
  565. package/foundation/fs/loaded-files.d.mts +30 -0
  566. package/foundation/fs/loaded-files.mjs +148 -0
  567. package/foundation/fs/module-loader.d.mts +53 -8
  568. package/foundation/fs/module-loader.mjs +559 -39
  569. package/foundation/fs/own-modules.d.mts +29 -0
  570. package/foundation/fs/own-modules.mjs +57 -0
  571. package/foundation/fs/path-safety.d.mts +34 -2
  572. package/foundation/fs/path-safety.mjs +170 -18
  573. package/foundation/fs/paths.d.mts +41 -2
  574. package/foundation/fs/paths.mjs +95 -5
  575. package/foundation/fs/read-record.d.mts +84 -7
  576. package/foundation/fs/read-record.mjs +333 -56
  577. package/foundation/fs/regular-file.d.mts +29 -0
  578. package/foundation/fs/regular-file.mjs +77 -0
  579. package/foundation/fs/stop-cleanup.d.mts +12 -0
  580. package/foundation/fs/stop-cleanup.mjs +66 -0
  581. package/foundation/fs/stylesheet-file.d.mts +37 -0
  582. package/foundation/fs/stylesheet-file.mjs +48 -0
  583. package/foundation/fs/theme-module-rejections.d.mts +32 -0
  584. package/foundation/fs/theme-module-rejections.mjs +82 -0
  585. package/foundation/integrations/integrations.d.mts +27 -1
  586. package/foundation/integrations/integrations.mjs +24 -2
  587. package/foundation/integrations/pack-state.d.mts +85 -0
  588. package/foundation/integrations/pack-state.mjs +509 -0
  589. package/foundation/integrations/shipped-imports.d.mts +125 -0
  590. package/foundation/integrations/shipped-imports.mjs +530 -0
  591. package/foundation/integrations/validate-contributions.d.mts +0 -17
  592. package/foundation/integrations/validate-contributions.mjs +81 -290
  593. package/foundation/release/choose.d.mts +7 -0
  594. package/foundation/release/choose.mjs +16 -2
  595. package/foundation/release/handoff.mjs +68 -13
  596. package/foundation/release/notices.d.mts +46 -9
  597. package/foundation/release/notices.mjs +78 -20
  598. package/foundation/release/pnp-runtime.d.mts +66 -0
  599. package/foundation/release/pnp-runtime.mjs +139 -0
  600. package/foundation/release/project.d.mts +11 -0
  601. package/foundation/release/project.mjs +23 -7
  602. package/foundation/release/run-context.d.mts +7 -2
  603. package/foundation/release/run-context.mjs +6 -2
  604. package/foundation/render/assets.mjs +52 -7
  605. package/foundation/render/charts.d.mts +78 -27
  606. package/foundation/render/charts.mjs +319 -90
  607. package/foundation/render/css-cut.d.mts +14 -1
  608. package/foundation/render/css-cut.mjs +117 -4
  609. package/foundation/render/cut-short.d.mts +35 -0
  610. package/foundation/render/cut-short.mjs +124 -0
  611. package/foundation/render/embedded-imports.d.mts +31 -0
  612. package/foundation/render/embedded-imports.mjs +169 -39
  613. package/foundation/render/font-probe.d.mts +27 -0
  614. package/foundation/render/font-probe.mjs +77 -0
  615. package/foundation/render/layers.d.mts +49 -0
  616. package/foundation/render/layers.mjs +347 -0
  617. package/foundation/render/offline.d.mts +32 -0
  618. package/foundation/render/offline.mjs +56 -0
  619. package/foundation/render/page-worker.mjs +374 -15
  620. package/foundation/render/picture-chrome.mjs +46 -4
  621. package/foundation/render/picture-playwright.mjs +41 -5
  622. package/foundation/render/picture-window.d.mts +32 -0
  623. package/foundation/render/picture-window.mjs +146 -0
  624. package/foundation/render/render-page.d.mts +46 -4
  625. package/foundation/render/render-page.mjs +453 -98
  626. package/foundation/response/base.d.ts +25 -0
  627. package/foundation/response/error-codes.d.mts +4 -1
  628. package/foundation/response/error-codes.d.ts +4 -1
  629. package/foundation/response/error-codes.doc.mjs +17 -0
  630. package/foundation/response/error-codes.mjs +21 -0
  631. package/foundation/response/json.d.mts +3 -1
  632. package/foundation/response/json.mjs +7 -2
  633. package/foundation/response/response-types.doc.mjs +12 -12
  634. package/foundation/runtime/css-tree.d.mts +24 -0
  635. package/foundation/runtime/css-tree.mjs +103 -0
  636. package/foundation/runtime/lazy-dependencies.d.mts +3 -1
  637. package/foundation/runtime/lazy-dependencies.mjs +20 -5
  638. package/foundation/suggest/name-index.d.mts +149 -0
  639. package/foundation/suggest/name-index.mjs +317 -0
  640. package/foundation/suggest/other-command.d.mts +146 -0
  641. package/foundation/suggest/other-command.mjs +783 -0
  642. package/foundation/text/css-escape.d.mts +18 -0
  643. package/foundation/text/css-escape.mjs +35 -0
  644. package/foundation/text/entry-names.d.mts +14 -0
  645. package/foundation/text/entry-names.mjs +14 -0
  646. package/foundation/text/string-utils.d.mts +49 -5
  647. package/foundation/text/string-utils.mjs +124 -26
  648. package/foundation/text/suggest-order.d.mts +75 -4
  649. package/foundation/text/suggest-order.mjs +285 -9
  650. package/foundation/text/written-string.d.mts +17 -0
  651. package/foundation/text/written-string.mjs +22 -0
  652. package/foundation/xle/browser.d.mts +2 -2
  653. package/package.json +8 -7
@@ -29,6 +29,7 @@ import {
29
29
  FONT_ROLES,
30
30
  FONTS,
31
31
  OPEN_FONTS,
32
+ appleFaceGeneric,
32
33
  isDesktopFamily,
33
34
  oneSystemOf,
34
35
  P,
@@ -38,27 +39,53 @@ import {makeCompiler} from './_compiler.mjs';
38
39
  import {openProject, installLine} from './_project.mjs';
39
40
  import {partData} from './_parts.mjs';
40
41
  import {writeWhole} from './_palette.mjs';
42
+ import {
43
+ assetRef,
44
+ CSS_URL,
45
+ cssUrlRef,
46
+ } from '../../foundation/render/render-page.mjs';
47
+ import {MAX_ASSET_BYTES} from '../../foundation/render/assets.mjs';
48
+ import {typoNear} from './_normal.mjs';
41
49
  import {
42
50
  fontOf,
51
+ ownTokenEntries,
43
52
  builtFontFamilies,
53
+ builtFontWeights,
44
54
  fontPackages,
45
- fontsourcePackageOf,
55
+ fontsourceSuggestion,
46
56
  modesOf,
47
- nearest,
48
57
  refuse,
49
58
  editorWrote,
50
59
  recordWritten,
51
60
  themeFiles,
52
61
  refuseThemesNotFolder,
53
62
  shown,
63
+ OPEN_SECTION,
54
64
  } from './_settings.mjs';
55
65
  import {
56
66
  SHOWCASE_GROUPS,
67
+ copyFontsCss,
68
+ fontPackageSheets,
69
+ fontPackageWeights,
70
+ shownWeight,
71
+ baseFontsSheet,
57
72
  newPictureRun,
58
73
  renderPreview,
74
+ renderSheet,
59
75
  screenshot,
76
+ pageInTheWay,
77
+ inTheWayPhrase,
60
78
  } from './_preview.mjs';
61
79
  import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
80
+ import {
81
+ customPropertyValues,
82
+ fontKey,
83
+ importedFontFamilies,
84
+ } from '../../foundation/fonts/font-stylesheet.mjs';
85
+ import {
86
+ hasGenericFamily,
87
+ namedFontFamilies,
88
+ } from '../theme/build/font-warning.mjs';
62
89
 
63
90
  const E = ERROR_CODES;
64
91
 
@@ -117,7 +144,7 @@ export async function context(cwd) {
117
144
  unchecked = renderCause(project, /** @type {Error} */ (e).message);
118
145
  uncheckedCode = /** @type {any} */ (e).code ?? null;
119
146
  parts = {
120
- version: 0,
147
+ censusKey: '',
121
148
  coreKey: project.coreKey,
122
149
  map: {},
123
150
  pairs: [],
@@ -132,6 +159,12 @@ export async function context(cwd) {
132
159
  unchecked,
133
160
  uncheckedCode,
134
161
  derived: await derivedVars(project.coreDir),
162
+ /**
163
+ * The pictures the running command takes after its build (its --png),
164
+ * so the build names as removed only the ones it does not take again.
165
+ * @type {{sheet: string | null} | null}
166
+ */
167
+ takesPictures: null,
135
168
  };
136
169
  }
137
170
 
@@ -156,7 +189,8 @@ async function derivedVars(coreDir) {
156
189
  const isRenderFailure = e =>
157
190
  e instanceof AstryxError &&
158
191
  (e.code === E.ERR_RENDER_FAILED ||
159
- e.code === E.ERR_RENDER_MISSING_DEPENDENCY);
192
+ e.code === E.ERR_RENDER_MISSING_DEPENDENCY ||
193
+ e.code === E.ERR_RENDER_ASSET_TOO_LARGE);
160
194
 
161
195
  /**
162
196
  * The app a folder belongs to: the nearest folder at or above it whose
@@ -346,6 +380,19 @@ function usesCore(/** @type {any} */ json) {
346
380
  * @param {string} message
347
381
  */
348
382
  export function renderCause(project, message) {
383
+ const two = reactCopies(project);
384
+ return two
385
+ ? `${message} The likely cause: two copies of React, the app's (${two.app}) and the one Core resolves (${two.core}). Make Core resolve the app's React.`
386
+ : message;
387
+ }
388
+
389
+ /**
390
+ * The two copies of React a render saw, when the app's and the one Core
391
+ * resolves differ; else null.
392
+ * @param {import('./_project.mjs').ThemeProject} project
393
+ * @returns {{app: string, core: string} | null}
394
+ */
395
+ export function reactCopies(project) {
349
396
  /** @param {(id: string) => string} resolve */
350
397
  const reactOf = resolve => {
351
398
  try {
@@ -369,9 +416,7 @@ export function renderCause(project, message) {
369
416
  } catch {
370
417
  // No Core package file: nothing to compare.
371
418
  }
372
- return app && core && app !== core
373
- ? `${message} The likely cause: two copies of React, the app's (${app}) and the one Core resolves (${core}). Make Core resolve the app's React.`
374
- : message;
419
+ return app && core && app !== core ? {app, core} : null;
375
420
  }
376
421
 
377
422
  /**
@@ -381,16 +426,99 @@ export function renderCause(project, message) {
381
426
  const notChecked = cause =>
382
427
  cause ? {code: E.ERR_THEME_NOT_CHECKED, cause} : null;
383
428
 
429
+ /** The sample page, as a note about its pictures names it. */
430
+ export const SAMPLE_PAGE_NAME = 'the sample page';
431
+
432
+ /**
433
+ * Text one page's pictures draw cut short in one part, as the browser
434
+ * measured it: the page and its picture, the part (null when the text sits
435
+ * in none), its texts, the one mode it was cut in when only one was, and
436
+ * whether every text is drawn whole once the part keeps its width
437
+ * (`flex-shrink: 0`, applied in the page and measured).
438
+ * @typedef {{page: string, file: string, part: string | null, texts: string[], only: 'light' | 'dark' | null, whole: boolean}} CutShort
439
+ */
440
+
441
+ /** The texts named, the first six and how many more. @param {string[]} texts */
442
+ const someTexts = texts =>
443
+ `${texts
444
+ .slice(0, 6)
445
+ .map(t => JSON.stringify(t))
446
+ .join(', ')}${texts.length > 6 ? `, and ${texts.length - 6} more` : ''}`;
447
+
448
+ /**
449
+ * The note for text a page's pictures draw cut short.
450
+ * @param {CutShort} c
451
+ */
452
+ export function cutShortNote(c) {
453
+ const n = c.texts.length;
454
+ const what = c.part
455
+ ? `${c.part} label${n === 1 ? '' : 's'}`
456
+ : `text${n === 1 ? '' : 's'}`;
457
+ return `${c.page} (${c.file}) draws ${n} ${what} cut short${c.only ? ` in ${c.only} mode only` : ''} (${someTexts(c.texts)}); the text no longer fits ${c.part ? `the ${c.part}` : 'its box'}`;
458
+ }
459
+
384
460
  /**
385
- * Pictures of HTML files, on request.
461
+ * The problem for text a page's pictures draw cut short, with the line that
462
+ * keeps it whole: the part keeps its width (`flex-shrink 0` on it), offered
463
+ * only when the browser measured every text whole with it; else no line,
464
+ * and that the line was measured and does not.
465
+ * @param {import('./_settings.mjs').Ctx} ctx
466
+ * @param {string} slug
467
+ * @param {CutShort} c
468
+ * @returns {{problem: string, fix: string | null}}
469
+ */
470
+ export function cutShortProblem(ctx, slug, c) {
471
+ const label = c.part ? `${c.part} labels` : 'text';
472
+ const problem = `${label} cut short in ${c.page}'s pictures (${c.file}${c.only ? `, ${c.only} mode` : ''}): ${someTexts(c.texts)}`;
473
+ if (c.part && c.whole && ctx.project.target.has(c.part))
474
+ return {problem, fix: `${P} set ${slug} flex-shrink 0 --on ${c.part}`};
475
+ return {
476
+ problem: c.part
477
+ ? `${problem}; keeping the ${c.part}'s width (flex-shrink 0) was measured and does not draw them whole there, so no one line fixes it`
478
+ : problem,
479
+ fix: null,
480
+ };
481
+ }
482
+
483
+ /**
484
+ * Pictures of HTML files, on request. A shot with a `name` is a page laid
485
+ * out so its text fits in the base theme (the sample page): the text its
486
+ * pictures draw cut short, as the browser measured it, comes back in
487
+ * `cutShort`, one entry for each part on each page ({@link cutShortNote},
488
+ * {@link cutShortProblem}). The sheets (the open
489
+ * states among them) have no name: their cells are narrow, and the full
490
+ * sheet cuts long labels short in every theme.
386
491
  * @param {import('./_project.mjs').ThemeProject} project
387
- * @param {Array<{html: string, png: string}>} shots
492
+ * @param {Array<{html: string, png: string, name?: string}>} shots
388
493
  * @param {Array<'light' | 'dark'>} modes
389
- * @returns {Promise<{files: string[], problem: string | null}>}
494
+ * @returns {Promise<{files: string[], problem: string | null, cutShort: CutShort[]}>}
390
495
  */
391
496
  export async function pictures(project, shots, modes) {
392
497
  /** @type {string[]} */
393
498
  const files = [];
499
+ /**
500
+ * The text drawn cut short, by page, then by part: its texts, the modes
501
+ * it was drawn so in, whether keeping the part's width draws every one
502
+ * whole, and the page's picture.
503
+ * @type {Map<string, {file: string, parts: Map<string, {texts: Set<string>, modes: Set<'light' | 'dark'>, whole: boolean}>}>}
504
+ */
505
+ const cut = new Map();
506
+ /** One entry for each part on each page, from what was measured. */
507
+ const cutShortNotes = () =>
508
+ [...cut].flatMap(([name, page]) =>
509
+ [...page.parts].map(
510
+ ([part, {texts, modes: drawnIn, whole}]) =>
511
+ /** @type {CutShort} */ ({
512
+ page: name,
513
+ file: page.file,
514
+ part: part || null,
515
+ texts: [...texts],
516
+ only:
517
+ modes.length > 1 && drawnIn.size === 1 ? [...drawnIn][0] : null,
518
+ whole,
519
+ }),
520
+ ),
521
+ );
394
522
  /** What a later browser's success says of an earlier one. @type {string[]} */
395
523
  const notes = [];
396
524
  /** One run for every picture: a browser that failed is not tried again. */
@@ -406,27 +534,62 @@ export async function pictures(project, shots, modes) {
406
534
  ? slug
407
535
  : null;
408
536
  };
537
+ /** A link at a path, whether or not what it points to is there. @param {string} p */
538
+ const isLink = p => {
539
+ try {
540
+ return Boolean(
541
+ fs.lstatSync(p, {throwIfNoEntry: false})?.isSymbolicLink(),
542
+ );
543
+ } catch {
544
+ return false;
545
+ }
546
+ };
409
547
  // A picture is written only over a picture the editor took, unchanged
410
548
  // since: a file of the user's by that name (a screenshot of the same
411
- // size included) blocks every picture, and is named.
549
+ // size included) blocks every picture, and is named. A link at a
550
+ // picture's name (to a file or to nothing) is never written through or
551
+ // replaced: that one picture is skipped and named, the others are taken.
412
552
  const blocked = shots
413
553
  .flatMap(({png}) => modes.map(m => outOf(png, m)))
414
554
  .filter(out => {
415
555
  const slug = themeOf(out);
416
556
  return (
417
557
  Boolean(slug) &&
558
+ !isLink(out) &&
418
559
  fs.existsSync(out) &&
419
560
  !editorWrote(project.cwd, /** @type {string} */ (slug), out)
420
561
  );
421
562
  });
563
+ // The record of the editor's pictures is a plain file, or none yet.
564
+ // Something else at its name (a pipe, a folder) is left as it is and
565
+ // named, and no picture is taken: a picture the record cannot hold would
566
+ // read as a file of yours on the next run.
567
+ for (const slug of new Set(shots.map(s => themeOf(s.png)))) {
568
+ if (!slug) continue;
569
+ const record = themeFiles(project.cwd, slug).pictures;
570
+ const st = fs.lstatSync(record, {throwIfNoEntry: false});
571
+ if (st && !st.isFile())
572
+ return {
573
+ files,
574
+ cutShort: [],
575
+ problem: `${inTheWayPhrase(path.relative(project.cwd, record), st.isSymbolicLink() ? 'link' : st.isDirectory() ? 'folder' : 'other', "the record of the editor's pictures")}, so no picture was taken and it is left as it is; move ${st.isSymbolicLink() ? 'the link' : 'it'}, then run the command again`,
576
+ };
577
+ }
578
+ /** Pictures skipped for a link at their name. @type {string[]} */
579
+ const linked = [];
422
580
  if (blocked.length)
423
581
  return {
424
582
  files,
583
+ cutShort: [],
425
584
  problem: `${blocked.map(f => path.relative(project.cwd, f)).join(', ')} ${blocked.length === 1 ? 'is a file' : 'are files'} the editor did not write (or changed since it did), so no picture was taken and ${blocked.length === 1 ? 'it is' : 'they are'} left as ${blocked.length === 1 ? 'it is' : 'they are'}`,
426
585
  };
427
- for (const {html, png} of shots) {
586
+ for (const {html, png, name} of shots) {
428
587
  for (const m of modes) {
429
588
  const out = outOf(png, m);
589
+ if (isLink(out)) {
590
+ linked.push(out);
591
+ continue;
592
+ }
430
593
  // Taken under a name of its own and moved into place once whole: a
431
594
  // run stopped while the browser runs leaves no picture at the real
432
595
  // name (one the next run would read as a file of yours). A part left
@@ -452,6 +615,7 @@ export async function pictures(project, shots, modes) {
452
615
  if (fs.existsSync(part) && !fs.lstatSync(part).isFile())
453
616
  return {
454
617
  files,
618
+ cutShort: cutShortNotes(),
455
619
  problem: `${path.relative(project.cwd, part)} is a folder, where --png writes a picture before moving it into place, so no picture was taken; move it out of ${path.relative(project.cwd, path.dirname(out))}/`,
456
620
  };
457
621
  // A folder it cannot write gets no picture: named before the browser
@@ -461,13 +625,26 @@ export async function pictures(project, shots, modes) {
461
625
  } catch (e) {
462
626
  return {
463
627
  files,
628
+ cutShort: cutShortNotes(),
464
629
  problem: `${path.relative(project.cwd, path.dirname(out))}/ cannot be written (${/** @type {any} */ (e)?.code ?? 'no access'}), so no picture was taken; fix its permissions, then run the command again`,
465
630
  };
466
631
  }
467
632
  const r = await screenshot(project, html, part, m, run);
468
633
  if (!r.ok) {
469
634
  fs.rmSync(part, {force: true});
470
- return {files, problem: r.reason};
635
+ // Said for the whole run: the pictures taken before this one stand,
636
+ // and this one and every one after it were not taken.
637
+ const all = shots.flatMap(s => modes.map(mm => outOf(s.png, mm)));
638
+ const missed = all
639
+ .slice(all.indexOf(out))
640
+ .map(f => path.relative(project.cwd, f).split(path.sep).join('/'));
641
+ return {
642
+ files,
643
+ cutShort: cutShortNotes(),
644
+ problem: files.length
645
+ ? `${files.join(', ')} ${files.length === 1 ? 'was' : 'were'} taken, but ${missed.join(', ')} ${missed.length === 1 ? 'was' : 'were'} not: ${r.reason}`
646
+ : `No picture was taken: ${r.reason}`,
647
+ };
471
648
  }
472
649
  try {
473
650
  fs.renameSync(part, out);
@@ -475,6 +652,7 @@ export async function pictures(project, shots, modes) {
475
652
  fs.rmSync(part, {force: true});
476
653
  return {
477
654
  files,
655
+ cutShort: cutShortNotes(),
478
656
  problem: `the picture could not be moved into ${path.relative(project.cwd, out)} (${/** @type {any} */ (e)?.code ?? e})`,
479
657
  };
480
658
  }
@@ -495,16 +673,140 @@ export async function pictures(project, shots, modes) {
495
673
  }
496
674
  recordWritten(project.cwd, slug, [out]);
497
675
  }
498
- if (r.note && !notes.includes(r.note)) notes.push(r.note);
676
+ for (const n of r.notes ?? []) if (!notes.includes(n)) notes.push(n);
677
+ // What the browser measured on a page laid out to fit, kept by page
678
+ // and part; nothing when its script measured nothing.
679
+ if (name && r.cutShort?.length) {
680
+ const page = cut.get(name) ?? {file: r.file, parts: new Map()};
681
+ cut.set(name, page);
682
+ for (const {part, text, whole} of r.cutShort) {
683
+ const at = page.parts.get(part ?? '') ?? {
684
+ texts: new Set(),
685
+ modes: new Set(),
686
+ whole: true,
687
+ };
688
+ page.parts.set(part ?? '', at);
689
+ at.texts.add(text);
690
+ at.modes.add(m);
691
+ at.whole &&= whole;
692
+ }
693
+ }
499
694
  }
500
695
  }
696
+ if (linked.length) {
697
+ const rels = linked.map(f =>
698
+ path.relative(project.cwd, f).split(path.sep).join('/'),
699
+ );
700
+ const target = (/** @type {string} */ f) => {
701
+ try {
702
+ const to = fs.readlinkSync(f);
703
+ return fs.existsSync(f)
704
+ ? ` (to ${to})`
705
+ : ` (to ${to}, which does not exist)`;
706
+ } catch {
707
+ return '';
708
+ }
709
+ };
710
+ notes.unshift(
711
+ `${linked.map((f, i) => `${rels[i]}${target(f)}`).join(', ')} ${linked.length === 1 ? 'is a link' : 'are links'}, and a picture is never written through or over a link, so ${linked.length === 1 ? 'that picture was' : 'those pictures were'} not taken${files.length ? `; ${files.join(', ')} ${files.length === 1 ? 'was' : 'were'} taken` : ''}`,
712
+ );
713
+ }
501
714
  return {
502
715
  files,
503
- // Pictures were taken; a note says why an earlier browser did not.
716
+ // Pictures were taken; a note says why an earlier browser did not, and
717
+ // which pictures a link at their name kept out.
504
718
  problem: notes.join('; ') || null,
719
+ cutShort: cutShortNotes(),
505
720
  };
506
721
  }
507
722
 
723
+ /**
724
+ * The families the theme's build writes that no package loads: not a
725
+ * system or desktop font, not loaded by a font stylesheet the app copy
726
+ * imports (the base's fonts included), and none of `packages` (the font
727
+ * packages that load it where the fonts go: the project's, or a new app's).
728
+ * @param {import('./_settings.mjs').Ctx} ctx
729
+ * @param {import('./_settings.mjs').ThemeData} data
730
+ * @param {Array<{family: string}>} packages
731
+ * @returns {string[]}
732
+ */
733
+ export function familiesNothingLoads(ctx, data, packages) {
734
+ const built = builtFontFamilies(ctx, data.name);
735
+ /** @type {Set<string>} */
736
+ const loaded = new Set();
737
+ for (const spec of copyFontsCss(ctx, data.name, data))
738
+ for (const f of importedFontFamilies(spec, ctx.project.cwd)) loaded.add(f);
739
+ return [...(built?.values() ?? [])].filter(family => {
740
+ const key = fontKey(family);
741
+ return !(
742
+ loaded.has(key) ||
743
+ packages.some(x => fontKey(x.family) === key) ||
744
+ isDesktopFamily(family) ||
745
+ oneSystemOf(family) ||
746
+ appleFaceGeneric(family)
747
+ );
748
+ });
749
+ }
750
+
751
+ /**
752
+ * What the previews (preview.html, sheet.html and their pictures) cannot
753
+ * show of the images and files the theme's built stylesheet names: a
754
+ * remote file (a page opened from disk loads no network), a file that is
755
+ * not there, one that is not a regular file, and one too large to carry.
756
+ * Read from the built stylesheet with the renderer's own reader, so a
757
+ * preview rendered before says it too.
758
+ * @param {import('./_settings.mjs').Ctx} ctx
759
+ * @param {string} slug
760
+ * @returns {string[]}
761
+ */
762
+ export function themeImageNotes(ctx, slug) {
763
+ const file = themeFiles(ctx.project.cwd, slug).css;
764
+ /** @type {string} */
765
+ let css;
766
+ try {
767
+ css = fs.readFileSync(file, 'utf8');
768
+ } catch {
769
+ return [];
770
+ }
771
+ const at = {dir: path.dirname(file), root: ctx.project.cwd};
772
+ const where = shown(ctx.project.cwd, at.dir);
773
+ /** @type {Map<string, string>} */
774
+ const notes = new Map();
775
+ for (const m of css.matchAll(new RegExp(CSS_URL.source, 'g'))) {
776
+ const named = assetRef(cssUrlRef(m), at);
777
+ if (!named || notes.has(named.ref)) continue;
778
+ if (named.kind === 'remote')
779
+ notes.set(
780
+ named.ref,
781
+ `${named.ref} is loaded from the network: the app loads it, but the previews (preview.html, sheet.html and their pictures) cannot, and show the theme without it.`,
782
+ );
783
+ else if (named.kind === 'missing')
784
+ notes.set(
785
+ named.ref,
786
+ `${named.ref} was not found beside the theme (${where}/), so neither the previews nor the app show it.`,
787
+ );
788
+ else if (named.kind === 'not-file')
789
+ notes.set(
790
+ named.ref,
791
+ `${named.ref} is not a regular file (a pipe, a device or a folder), so the previews do not read it and show the theme without it.`,
792
+ );
793
+ else if (named.kind === 'unreadable')
794
+ notes.set(
795
+ named.ref,
796
+ `${shown(ctx.project.cwd, named.file)} cannot be read (no permission), so the previews show the theme without it; make it readable (chmod u+r) to show it.`,
797
+ );
798
+ else {
799
+ const bytes = fs.statSync(named.file).size;
800
+ if (bytes > MAX_ASSET_BYTES)
801
+ notes.set(
802
+ named.ref,
803
+ `${shown(ctx.project.cwd, named.file)} is ${(bytes / 1048576).toFixed(1)} MB, more than the ${MAX_ASSET_BYTES / 1048576} MB a preview page carries per file; a smaller copy shows in the previews too.`,
804
+ );
805
+ }
806
+ }
807
+ return [...notes.values()];
808
+ }
809
+
508
810
  /**
509
811
  * Font notes for the families the theme builds: the import line for an
510
812
  * open font, the install line when its package is missing, and a warning
@@ -517,6 +819,13 @@ export function fontNotes(ctx, data) {
517
819
  /** @type {string[]} */
518
820
  const notes = [];
519
821
  const packages = fontPackages(ctx, data);
822
+ // A family nothing loads, with the Fontsource package that would load
823
+ // it, when Fontsource's naming gives one.
824
+ /** @param {string} family */
825
+ const unloadedNote = family => {
826
+ const s = fontsourceSuggestion(family);
827
+ return `"${family}" is not a system font and no package loads it: the app must load it, or it falls back.${s ? ` ${s.known ? '' : 'If Fontsource publishes it, '}${installLine(ctx.project.cwd, [s.pkg])} installs its package, which the previews and the app copy then load.` : ''}`;
828
+ };
520
829
  for (const {pkg, family, installed} of packages) {
521
830
  const fallbacks =
522
831
  Object.values(OPEN_FONTS).find(f => f.pkg === pkg)?.fallbacks ?? '';
@@ -527,7 +836,13 @@ export function fontNotes(ctx, data) {
527
836
  : 'system';
528
837
  notes.push(
529
838
  installed
530
- ? `${family} is installed (${pkg}), so the previews load it; the app loads it with one import: import '${pkg}';`
839
+ ? `${family} is installed (${pkg}), so the previews and the app copy load it, a stylesheet for each face the theme's weights show: ${fontPackageSheets(
840
+ ctx,
841
+ data.name,
842
+ pkg,
843
+ )
844
+ .map(x => `import '${x}';`)
845
+ .join(' ')}`
531
846
  : `${family} is not installed, so it does not load: the previews and the app show the next font in the stack. Install it: ${installLine(ctx.project.cwd, [pkg])}. Then the preview imports it on the next set or show, and the app imports it once: import '${pkg}'; Until then, the closest font that needs no install is ${near}: ${P} set ${data.name} font ${near}`,
532
847
  );
533
848
  }
@@ -568,21 +883,182 @@ export function fontNotes(ctx, data) {
568
883
  const named = fontOf(s.value).family.replace(/^["']|["']$/g, '');
569
884
  const system = oneSystemOf(named);
570
885
  const on = s.on ? ` --on ${s.on}` : '';
886
+ const generic = appleFaceGeneric(named);
887
+ if (generic) {
888
+ // Apple systems reach their interface faces only by a generic.
889
+ const {fallbacks} = fontOf(s.value);
890
+ const next = fallbacks.split(',')[0]?.trim() || 'system-ui';
891
+ // The generic once: a stack that already holds it keeps one.
892
+ const value = [
893
+ ...new Set(
894
+ [generic, ...fallbacks.split(',')].map(f => f.trim()).filter(Boolean),
895
+ ),
896
+ ].join(', ');
897
+ notes.push(
898
+ `"${named}" is an Apple interface face, which browsers do not reach by its name, so every system shows the next font in the stack (${next}). Apple systems show it for ${generic}: ${P} set ${data.name} font ${quoteCommandArgument(value)}${on}`,
899
+ );
900
+ continue;
901
+ }
571
902
  if (system) {
572
903
  // A system font, on one system: the others show the next font.
573
904
  const next =
574
905
  fontOf(s.value).fallbacks.split(',')[0]?.trim() || 'system-ui';
575
906
  notes.push(
576
907
  /^(-apple-system|blinkmacsystemfont)$/.test(family)
577
- ? `"${named}" names the macOS interface font, which only macOS has: other systems show the next font in the stack (${next}). The system preset gives each system its own interface font: ${P} set ${data.name} font system${on}`
908
+ ? `"${named}" names the interface font of ${system}, and only there: other systems show the next font in the stack (${next}). The system preset gives each system its own interface font: ${P} set ${data.name} font system${on}`
578
909
  : `"${named}" ships only on ${system}: other systems show the next font in the stack (${next}).${near ? ` The closest open font, which loads everywhere, is ${near}: ${P} set ${data.name} font ${near}${on}` : ''}`,
579
910
  );
580
911
  continue;
581
912
  }
582
913
  notes.push(
583
- `"${named}" is not a system font and no package loads it: the app must load it, or it falls back. If Fontsource publishes it, ${installLine(ctx.project.cwd, [fontsourcePackageOf(named)])} installs its package, which the previews and the app copy then load.${near ? ` The closest open font is ${near}: ${P} set ${data.name} font ${near}${s.on ? ` --on ${s.on}` : ''}` : ''}`,
914
+ `${unloadedNote(named)}${near ? ` The closest open font is ${near}: ${P} set ${data.name} font ${near}${s.on ? ` --on ${s.on}` : ''}` : ''}`,
584
915
  );
585
916
  }
917
+ // Every other family the build writes that nothing loads (a part's own
918
+ // font, a font token, a family the theme's own source sets) is named
919
+ // once, with the package that would load it: the same built families
920
+ // the app copy and the previews load fonts for.
921
+ const dialFamilies = new Set(
922
+ data.settings
923
+ .filter(s => s.thing === 'font')
924
+ .map(s => fontKey(fontOf(s.value).family)),
925
+ );
926
+ // A base family the app loads from a remote stylesheet (a Google Fonts
927
+ // import in the base's fonts.css) is not in the static previews: a page
928
+ // opened from disk cannot load a remote stylesheet. Unless an installed
929
+ // package loads it, the previews and pictures show the next font.
930
+ const base = baseFontsSheet(ctx, data);
931
+ if (base?.remote.length)
932
+ for (const family of base.families) {
933
+ if (built && !built.has(family.toLowerCase())) continue;
934
+ if (
935
+ packages.some(x => x.installed && fontKey(x.family) === fontKey(family))
936
+ )
937
+ continue;
938
+ const s = fontsourceSuggestion(family);
939
+ notes.push(
940
+ `"${family}" comes from ${base.spec}, which loads it from ${new URL(base.remote[0], 'https://x').host}: the app shows it, but the previews (preview.html, sheet.html and their pictures) cannot load a remote stylesheet and show the next font in the stack.${s ? ` ${installLine(ctx.project.cwd, [s.pkg])} installs a copy the previews load too.` : ''}`,
941
+ );
942
+ }
943
+ notes.push(...baseWeightNotes(ctx, data));
944
+ for (const family of familiesNothingLoads(ctx, data, packages)) {
945
+ if (dialFamilies.has(fontKey(family))) continue;
946
+ notes.push(unloadedNote(family));
947
+ }
948
+ notes.push(...loneFamilyNotes(ctx, data));
949
+ return notes;
950
+ }
951
+
952
+ /** What each font role's family token sets, for a note. */
953
+ const ROLE_TEXT = /** @type {Record<string, string>} */ ({
954
+ body: 'body text uses',
955
+ heading: 'headings use',
956
+ code: 'code uses',
957
+ });
958
+
959
+ /**
960
+ * A note for each font role the theme's build gives one family and no
961
+ * fallback at all (`--font-family-heading: Lora`, as Core builds a heading
962
+ * family given no fallbacks of its own, or an exact token set so): text in
963
+ * it has no font while that one loads, or if it is missing. The way to a
964
+ * list is named where the family came from: the setting, run with a list
965
+ * (the family's own open-font fallbacks, else the font dial's), or the
966
+ * theme's own source.
967
+ * @param {import('./_settings.mjs').Ctx} ctx
968
+ * @param {import('./_settings.mjs').ThemeData} data
969
+ * @returns {string[]}
970
+ */
971
+ export function loneFamilyNotes(ctx, data) {
972
+ /** @type {string} */
973
+ let css;
974
+ try {
975
+ css = fs.readFileSync(themeFiles(ctx.project.cwd, data.name).css, 'utf8');
976
+ } catch {
977
+ return [];
978
+ }
979
+ /** @type {string[]} */
980
+ const notes = [];
981
+ const own = customPropertyValues(css);
982
+ for (const role of Object.keys(ROLE_TEXT)) {
983
+ const token = `--font-family-${role}`;
984
+ const value = own.get(token)?.at(-1);
985
+ if (!value || /var\(/i.test(value) || hasGenericFamily(value)) continue;
986
+ const named = namedFontFamilies(value);
987
+ if (named.length !== 1) continue;
988
+ const family = named[0].replace(/^["']|["']$/g, '');
989
+ const fallbacks =
990
+ Object.values(OPEN_FONTS).find(f => fontKey(f.family) === fontKey(family))
991
+ ?.fallbacks ?? fontOf(family).fallbacks;
992
+ const list = `${value.trim()}, ${fallbacks}`;
993
+ const setting = data.settings.find(
994
+ s => s.source === 'token' && s.thing === token && !s.on && !s.when,
995
+ );
996
+ const typography = ownTokenEntries(ctx.project.cwd, data.name).some(
997
+ e => e.kind === 'typography' && e.key === `${role}.family`,
998
+ );
999
+ const fix = setting
1000
+ ? `give a list: ${P} set ${data.name} ${token} ${quoteCommandArgument(list)}`
1001
+ : typography
1002
+ ? `give typography.${role} its fallbacks in themes/${data.name}/${data.name}.theme.ts (such as fallbacks: '${fallbacks}')`
1003
+ : `give ${token} a list in themes/${data.name}/${data.name}.theme.ts (such as '${list}')`;
1004
+ notes.push(
1005
+ `${ROLE_TEXT[role]} only ${family}, with no fallback while it loads or if it is missing; to fall back, ${fix}`,
1006
+ );
1007
+ }
1008
+ return notes;
1009
+ }
1010
+
1011
+ /**
1012
+ * A note for each weight the theme uses that a stylesheet loading one of
1013
+ * its families has no face for (it shows as the face CSS font matching
1014
+ * picks): the base theme's font stylesheet, unless an installed package
1015
+ * loads that family, and each installed font package with a stylesheet per
1016
+ * weight.
1017
+ * @param {import('./_settings.mjs').Ctx} ctx
1018
+ * @param {import('./_settings.mjs').ThemeData} data
1019
+ * @returns {string[]}
1020
+ */
1021
+ export function baseWeightNotes(ctx, data) {
1022
+ /** @type {string[]} */
1023
+ const notes = [];
1024
+ const built = builtFontFamilies(ctx, data.name);
1025
+ const packages = fontPackages(ctx, data);
1026
+ /**
1027
+ * @param {string} family @param {string} by what loads it
1028
+ * @param {number[]} faces the weights it loads @param {string} fix
1029
+ */
1030
+ const gap = (family, by, faces, fix) => {
1031
+ // The weights text in this family uses: those set beside it, and the
1032
+ // ones every text reads (never a weight only another family uses).
1033
+ const used = builtFontWeights(ctx, data.name, family) ?? [];
1034
+ const missing = used.filter(w => !faces.includes(w));
1035
+ if (missing.length)
1036
+ notes.push(
1037
+ `${family} is loaded by ${by} at ${faces.join(', ')} only, so ${missing.map(w => `${w} shows as ${shownWeight(w, faces)}`).join(', ')}${fix}`,
1038
+ );
1039
+ };
1040
+ const base = baseFontsSheet(ctx, data);
1041
+ for (const [family, faces] of base?.weights ?? []) {
1042
+ if (built && !built.has(family.toLowerCase())) continue;
1043
+ if (
1044
+ packages.some(x => x.installed && fontKey(x.family) === fontKey(family))
1045
+ )
1046
+ continue;
1047
+ const s = fontsourceSuggestion(family);
1048
+ gap(
1049
+ family,
1050
+ /** @type {{spec: string}} */ (base).spec,
1051
+ faces,
1052
+ s
1053
+ ? `; ${installLine(ctx.project.cwd, [s.pkg])} loads every weight of it`
1054
+ : '',
1055
+ );
1056
+ }
1057
+ for (const {pkg, family, installed} of packages) {
1058
+ if (!installed || (built && !built.has(family.toLowerCase()))) continue;
1059
+ const faces = fontPackageWeights(ctx, pkg);
1060
+ if (faces) gap(family, pkg, faces, '');
1061
+ }
586
1062
  return notes;
587
1063
  }
588
1064
 
@@ -633,21 +1109,37 @@ export function styledChanges(before, after, base) {
633
1109
  typeof baseValue !== 'object' &&
634
1110
  plain(baseValue) === plain(now);
635
1111
  const where = `${target}${key === 'base' ? '' : ` ${key}`}`;
636
- // A block (a state, `:hover`) lists each property it changes.
1112
+ // A block (a state, `:hover`, a mode block, a state inside a mode
1113
+ // block) lists each property it changes, under its path.
1114
+ /**
1115
+ * @param {string} path @param {any} xs @param {any} ys @param {any} shownIn
1116
+ */
1117
+ const blockLines = (path, xs, ys, shownIn) => {
1118
+ for (const p of new Set([
1119
+ ...Object.keys(xs ?? {}),
1120
+ ...Object.keys(ys ?? {}),
1121
+ ])) {
1122
+ const was = xs?.[p];
1123
+ const now = ys?.[p];
1124
+ if (JSON.stringify(was) === JSON.stringify(now)) continue;
1125
+ if (
1126
+ (now && typeof now === 'object') ||
1127
+ (was && typeof was === 'object')
1128
+ ) {
1129
+ blockLines(`${path} ${p}`, was ?? {}, now ?? {}, shownIn?.[p]);
1130
+ continue;
1131
+ }
1132
+ if (repeatsBase(was, now, shownIn?.[p])) continue;
1133
+ out.push(
1134
+ `${where} ${path}: ${cssName(p)} ${now === undefined ? '(removed)' : String(now)}`,
1135
+ );
1136
+ }
1137
+ };
637
1138
  if (
638
1139
  (y[prop] && typeof y[prop] === 'object') ||
639
1140
  (x[prop] && typeof x[prop] === 'object')
640
1141
  ) {
641
- const xs = x[prop] ?? {};
642
- const ys = y[prop] ?? {};
643
- for (const p of new Set([...Object.keys(xs), ...Object.keys(ys)]))
644
- if (
645
- JSON.stringify(xs[p]) !== JSON.stringify(ys[p]) &&
646
- !repeatsBase(xs[p], ys[p], shown?.[p])
647
- )
648
- out.push(
649
- `${where} ${prop}: ${cssName(p)} ${ys[p] === undefined ? '(removed)' : String(ys[p])}`,
650
- );
1142
+ blockLines(prop, x[prop] ?? {}, y[prop] ?? {}, shown);
651
1143
  continue;
652
1144
  }
653
1145
  if (repeatsBase(x[prop], y[prop], shown)) continue;
@@ -697,7 +1189,156 @@ export function styledChanges(before, after, base) {
697
1189
  }
698
1190
 
699
1191
  /**
700
- * Previews after a change: the sample page always, pictures on request.
1192
+ * The line that says which pictures to open after a run that took them:
1193
+ * each family of components' first ({@link familyPages}), then the sample
1194
+ * page's and the open states' (every menu, tooltip, popover and list drawn
1195
+ * open), of the mode shown first (light when the theme has both). Null when
1196
+ * this run took none of them.
1197
+ * @param {string[]} files the pictures taken, as shown (`themes/t/preview.png`)
1198
+ * @returns {string | null}
1199
+ */
1200
+ export function lookAtPictures(files) {
1201
+ /** @param {string} name */
1202
+ const one = name =>
1203
+ files.find(f => path.basename(f) === `${name}.png`) ??
1204
+ files.find(f => path.basename(f) === `${name}-dark.png`);
1205
+ const preview = one('preview');
1206
+ const open = one(`sheet-${OPEN_SECTION}`);
1207
+ const families = FAMILY_SECTIONS.map(g => one(`sheet-${g}`)).filter(
1208
+ f => f != null,
1209
+ );
1210
+ if (!preview && !open && !families.length) return null;
1211
+ const dark =
1212
+ files.some(f => /-dark\.png$/.test(f)) &&
1213
+ files.some(f => /(?<!-dark)\.png$/.test(f));
1214
+ return `open ${[
1215
+ // A family's own picture reads whole; the full sheet does not.
1216
+ ...(families.length
1217
+ ? [`${families.join(', ')} (one family of components each)`]
1218
+ : []),
1219
+ ...(preview
1220
+ ? [
1221
+ `${preview} (the sample page, a tooltip, a menu and a list drawn open below it)`,
1222
+ ]
1223
+ : []),
1224
+ ...(open
1225
+ ? [
1226
+ `${open} (each control at rest, hovered, focused and pressed at its top, then every menu, tooltip, popover and list, drawn open)`,
1227
+ ]
1228
+ : []),
1229
+ ].join(' and ')}${dark ? '; the -dark pictures show the dark mode' : ''}`;
1230
+ }
1231
+
1232
+ /**
1233
+ * The page of the theme's open states (every menu, tooltip, popover and
1234
+ * list drawn open: the overlays section of the sheet), made and stamped
1235
+ * with the build it shows, and where its picture goes. The sample page
1236
+ * (preview.png) has no overlay open, and the full sheet is too tall to
1237
+ * read whole, so `--png` takes this picture beside the sample page's.
1238
+ * @param {import('./_settings.mjs').Ctx} ctx
1239
+ * @param {string} slug
1240
+ * @param {import('./_settings.mjs').ThemeData} data
1241
+ * @returns {Promise<{html: string, png: string} | {problem: string}>} the
1242
+ * page and its picture, or why neither is made: something of yours at the
1243
+ * page's name (a file the editor did not write, a link, a folder) is never
1244
+ * written over, as a picture of yours is not
1245
+ */
1246
+ export async function openStatesPage(ctx, slug, data) {
1247
+ const f = themeFiles(ctx.project.cwd, slug);
1248
+ const html = path.join(f.dir, `sheet-${OPEN_SECTION}.html`);
1249
+ const png = path.join(f.dir, `sheet-${OPEN_SECTION}.png`);
1250
+ const shownHtml = shown(ctx.project.cwd, html);
1251
+ const skipped = `so ${shown(ctx.project.cwd, png)} (the open states) was not taken`;
1252
+ const inWay = pageInTheWay(html);
1253
+ if (inWay)
1254
+ return {
1255
+ problem: `${inTheWayPhrase(shownHtml, inWay, 'the open states page')}, ${skipped}; move ${inWay === 'link' ? 'the link' : 'it'}, then run ${P} show ${slug} --png`,
1256
+ };
1257
+ await renderSheet(ctx, slug, data, {group: OPEN_SECTION});
1258
+ stampSheet(html, slug, ctx.project.cwd);
1259
+ return {html, png};
1260
+ }
1261
+
1262
+ /**
1263
+ * The family `show --png` pictures when the theme's settings set no part of
1264
+ * its own (a fresh theme, or only theme-wide settings): the buttons, an
1265
+ * overview of the theme's controls beside the sample page.
1266
+ */
1267
+ export const FAMILY_OVERVIEW = 'actions';
1268
+
1269
+ /**
1270
+ * The families of components with a picture of their own beside the full
1271
+ * sheet, which is too tall to read whole: each section of the sheet but the
1272
+ * overlays (the open states page shows them) and the pages (the sample page
1273
+ * is preview.png).
1274
+ */
1275
+ export const FAMILY_SECTIONS = Object.freeze(
1276
+ SHOWCASE_GROUPS.filter(g => g !== OPEN_SECTION && g !== 'pages'),
1277
+ );
1278
+
1279
+ /**
1280
+ * One page for each family of components ({@link FAMILY_SECTIONS}), cut
1281
+ * from the full sheet just made, so each shows its family as the sheet
1282
+ * does, with no render of its own: the sheet's head and bar, then that
1283
+ * family's section. Each is written where `show --section <family>` writes
1284
+ * that family's sheet, and stamped with the build it shows. Something of
1285
+ * yours at a family page's name is never written over: that page is left
1286
+ * out and named.
1287
+ * @param {string} sheet the full sheet, as written
1288
+ * @param {string} slug
1289
+ * @param {string} cwd
1290
+ * @param {readonly string[]} [only] the families to make; every one by default
1291
+ * @returns {{pages: Array<{html: string, png: string, family: string}>, problems: string[]}}
1292
+ */
1293
+ export function familyPages(sheet, slug, cwd, only = FAMILY_SECTIONS) {
1294
+ /** @type {Array<{html: string, png: string, family: string}>} */
1295
+ const pages = [];
1296
+ /** @type {string[]} */
1297
+ const problems = [];
1298
+ const text = fs.readFileSync(sheet, 'utf8').replace(SHEET_STAMP, '');
1299
+ // Each section of the sheet starts with its own marker, in order, and
1300
+ // holds no section of its own: one ends where the next starts, and the
1301
+ // last at the last section close.
1302
+ const starts = [
1303
+ ...text.matchAll(
1304
+ /<section\b[^>]*\sclass="[^"]*\bcs-family-([a-z-]+)\b[^"]*"[^>]*>/g,
1305
+ ),
1306
+ ].map(m => ({family: m[1], at: /** @type {number} */ (m.index)}));
1307
+ const close = text.lastIndexOf('</section>');
1308
+ if (!starts.length || close < 0) return {pages, problems};
1309
+ const end = close + '</section>'.length;
1310
+ const before = text.slice(0, starts[0].at);
1311
+ const after = text.slice(end);
1312
+ for (const [i, {family, at}] of starts.entries()) {
1313
+ if (!FAMILY_SECTIONS.includes(family) || !only.includes(family)) continue;
1314
+ const html = path.join(path.dirname(sheet), `sheet-${family}.html`);
1315
+ const png = path.join(path.dirname(sheet), `sheet-${family}.png`);
1316
+ const inWay = pageInTheWay(html);
1317
+ if (inWay) {
1318
+ problems.push(
1319
+ `${inTheWayPhrase(shown(cwd, html), inWay, `the ${family} sheet`)}, so ${shown(cwd, png)} was not taken; move ${inWay === 'link' ? 'the link' : 'it'}, then run ${P} show ${slug} --png`,
1320
+ );
1321
+ continue;
1322
+ }
1323
+ const head = before
1324
+ .replace('class="cs-page"', `class="cs-page cs-section-${family}"`)
1325
+ .replace(
1326
+ `<strong>${slug}: every component</strong>`,
1327
+ `<strong>${slug}: every component (${family})</strong>`,
1328
+ );
1329
+ writeWhole(
1330
+ html,
1331
+ `${head}${text.slice(at, starts[i + 1]?.at ?? end)}${after}`,
1332
+ );
1333
+ stampSheet(html, slug, cwd);
1334
+ pages.push({html, png, family});
1335
+ }
1336
+ return {pages, problems};
1337
+ }
1338
+
1339
+ /**
1340
+ * Previews after a change: the sample page always; on request, pictures of
1341
+ * it and of the open states ({@link openStatesPage}).
701
1342
  * @param {import('./_settings.mjs').Ctx} ctx
702
1343
  * @param {string} slug
703
1344
  * @param {import('./_settings.mjs').ThemeData} data
@@ -708,23 +1349,53 @@ export async function previewAfter(ctx, slug, data, png) {
708
1349
  let preview = null;
709
1350
  let cause = ctx.unchecked ?? null;
710
1351
  const f0 = themeFiles(ctx.project.cwd, slug);
711
- try {
712
- preview = await renderPreview(ctx, slug, data);
713
- } catch (e) {
714
- // The change is already saved: any failure here leaves it unchecked.
715
- const code = /** @type {any} */ (e)?.code;
716
- cause ??= isRenderFailure(e)
717
- ? renderCause(ctx.project, /** @type {Error} */ (e).message)
718
- : ['ENOSPC', 'EACCES', 'EPERM', 'EROFS', 'EIO'].includes(code)
719
- ? `preview.html could not be written (${code === 'ENOSPC' ? 'the disk is full' : code}), so it still shows the theme as it was`
720
- : // A folder (or another thing) where preview.html goes: the page
721
- // was rendered, and could not be written there.
722
- code === ERROR_CODES.ERR_WRITE_FAILED ||
723
- (fs.existsSync(f0.preview) && !fs.statSync(f0.preview).isFile())
724
- ? `preview.html could not be written (${shown(ctx.project.cwd, f0.preview)} is ${fs.existsSync(f0.preview) && fs.statSync(f0.preview).isDirectory() ? 'a folder' : 'in the way'}; move it, then run ${P} show ${slug}), so it still shows the theme as it was`
725
- : `checking it failed: ${e instanceof Error ? e.message : String(e)}`;
726
- }
1352
+ // Something of yours at preview.html (a file, a link, a pipe) is left as
1353
+ // it is: the sample page is not made, so the change is not rendered,
1354
+ // which the result says. (A folder there is named by the write that
1355
+ // fails, below.)
1356
+ const inWay = pageInTheWay(f0.preview);
1357
+ const previewInWay =
1358
+ inWay === 'file' || inWay === 'link' || inWay === 'other' ? inWay : null;
1359
+ if (previewInWay)
1360
+ cause ??= `${inTheWayPhrase(shown(ctx.project.cwd, f0.preview), previewInWay, 'the sample page')}, so the sample page was not made and the change was not rendered; move ${previewInWay === 'link' ? 'the link' : 'it'}, then run ${P} show ${slug}`;
1361
+ else
1362
+ try {
1363
+ preview = await renderPreview(ctx, slug, data);
1364
+ } catch (e) {
1365
+ // The change is already saved: any failure here leaves it unchecked.
1366
+ const code = /** @type {any} */ (e)?.code;
1367
+ cause ??= isRenderFailure(e)
1368
+ ? renderCause(ctx.project, /** @type {Error} */ (e).message)
1369
+ : ['ENOSPC', 'EACCES', 'EPERM', 'EROFS', 'EIO'].includes(code)
1370
+ ? `preview.html could not be written (${code === 'ENOSPC' ? 'the disk is full' : code}), so it still shows the theme as it was`
1371
+ : // A folder (or another thing) where preview.html goes: the page
1372
+ // was rendered, and could not be written there.
1373
+ code === ERROR_CODES.ERR_WRITE_FAILED ||
1374
+ (fs.existsSync(f0.preview) && !fs.statSync(f0.preview).isFile())
1375
+ ? `preview.html could not be written (${shown(ctx.project.cwd, f0.preview)} is ${fs.existsSync(f0.preview) && fs.statSync(f0.preview).isDirectory() ? 'a folder' : 'in the way'}; move it, then run ${P} show ${slug}), so it still shows the theme as it was`
1376
+ : `checking it failed: ${e instanceof Error ? e.message : String(e)}`;
1377
+ }
727
1378
  const f = themeFiles(ctx.project.cwd, slug);
1379
+ /**
1380
+ * The pages photographed: the sample page, and with it the open states.
1381
+ * @type {Array<{html: string, png: string, name?: string}>}
1382
+ */
1383
+ const shotPages = [
1384
+ {html: f.preview, png: f.previewPng, name: SAMPLE_PAGE_NAME},
1385
+ ];
1386
+ /** Why the open states were not taken, said with the pictures. @type {string | null} */
1387
+ let openProblem = null;
1388
+ // Made before the sections are judged, so it is current, never marked.
1389
+ if (png && preview) {
1390
+ const open = await openStatesPage(ctx, slug, data).catch(e => {
1391
+ if (/** @type {any} */ (e)?.lockLost) throw e;
1392
+ return {
1393
+ problem: `the open states page could not be made (${e instanceof Error ? e.message.split('\n')[0] : String(e)}), so ${shown(ctx.project.cwd, path.join(f.dir, `sheet-${OPEN_SECTION}.png`))} was not taken`,
1394
+ };
1395
+ });
1396
+ if ('problem' in open) openProblem = open.problem;
1397
+ else shotPages.push(open);
1398
+ }
728
1399
  // The sheet of every component is made by show only: after a change it
729
1400
  // says, at its top, that it shows the theme as it was.
730
1401
  const sheetStale = markSheetStale(f.sheet, slug, ctx.project.cwd);
@@ -734,26 +1405,20 @@ export async function previewAfter(ctx, slug, data, png) {
734
1405
  fs.existsSync(f.dir) ? fs.readdirSync(f.dir) : []
735
1406
  ).filter(n => {
736
1407
  if (!/^sheet-[a-z-]+\.html$/.test(n)) return false;
737
- const file = path.join(f.dir, n);
738
- try {
739
- if (!SHEET_STAMP.test(fs.readFileSync(file, 'utf8'))) return false;
740
- } catch {
741
- return false;
742
- }
743
- return markSheetStale(file, slug, ctx.project.cwd);
1408
+ return markSheetStale(path.join(f.dir, n), slug, ctx.project.cwd);
744
1409
  });
745
1410
  const shots =
746
1411
  png && preview
747
- ? await pictures(
748
- ctx.project,
749
- [{html: f.preview, png: f.previewPng}],
750
- modesOf(data),
751
- )
752
- : {files: [], problem: null};
1412
+ ? await pictures(ctx.project, shotPages, modesOf(data))
1413
+ : {files: [], problem: null, cutShort: []};
753
1414
  return {
754
1415
  preview,
755
1416
  pictures: shots.files,
756
- pictureProblem: shots.problem,
1417
+ // Text the sample page's pictures draw cut short: a note and a problem
1418
+ // of the change.
1419
+ cutShort: shots.cutShort,
1420
+ pictureProblem:
1421
+ [openProblem, shots.problem].filter(Boolean).join('; ') || null,
757
1422
  notChecked: notChecked(cause),
758
1423
  ...(sheetStale && !sectionsStale.length
759
1424
  ? {
@@ -834,6 +1499,8 @@ export function stampSheet(file, slug, cwd) {
834
1499
  * @param {string} cwd
835
1500
  */
836
1501
  function markSheetStale(file, slug, cwd) {
1502
+ // Only the editor's own sheet: a file of yours there is never written.
1503
+ if (pageInTheWay(file) != null) return false;
837
1504
  let html;
838
1505
  try {
839
1506
  html = fs.readFileSync(file, 'utf8');
@@ -880,24 +1547,37 @@ function markSheetStale(file, slug, cwd) {
880
1547
  * that is not a section.
881
1548
  * @param {string | undefined} section
882
1549
  * @param {string} [theme] the theme the suggestions name
1550
+ * @param {string} [rest] the command's other options as typed (` --png`):
1551
+ * the offered command keeps them, with only the section fixed
883
1552
  * @returns {string | undefined}
884
1553
  */
885
- export function checkSection(section, theme = 'my') {
1554
+ export function checkSection(section, theme = 'my', rest = '') {
1555
+ // A section is offered only when one is within a typo of what was typed;
1556
+ // otherwise the way on is the whole sheet (show with no --section), with
1557
+ // the sections listed in the message. An option where the section
1558
+ // belongs (`--section --png`) was read as its value: it stays an option.
1559
+ const eaten =
1560
+ typeof section === 'string' && /^--[a-z][a-z-]*$/.test(section.trim())
1561
+ ? ` ${section.trim()}`
1562
+ : '';
1563
+ const show = `${P} show ${theme}${rest}${rest.includes(eaten) ? '' : eaten}`;
886
1564
  if (section === '')
887
- refuse(E.ERR_MISSING_ARGUMENT, '--section was given no value.', {
888
- run: [`${P} show ${theme} --section ${SHOWCASE_GROUPS[0]}`],
889
- });
1565
+ refuse(
1566
+ E.ERR_MISSING_ARGUMENT,
1567
+ `--section was given no value; it takes ${SHOWCASE_GROUPS.join(', ')}, and show with no --section makes the whole sheet.`,
1568
+ {run: [show]},
1569
+ );
890
1570
  const s = section?.toLowerCase();
891
- if (s != null && !SHOWCASE_GROUPS.includes(s))
1571
+ if (s != null && !SHOWCASE_GROUPS.includes(s)) {
1572
+ const near = SHOWCASE_GROUPS.filter(g => typoNear(s, g));
892
1573
  refuse(
893
1574
  E.ERR_INVALID_ARGUMENT,
894
- `--section takes ${SHOWCASE_GROUPS.join(', ')}, not "${section}".`,
1575
+ `--section takes ${SHOWCASE_GROUPS.join(', ')}, not "${section}"${near.length ? '' : '; show with no --section makes the whole sheet'}.`,
895
1576
  {
896
- didYouMean: nearest(s, SHOWCASE_GROUPS),
897
- run: [
898
- `${P} show ${theme} --section ${nearest(s, SHOWCASE_GROUPS)[0] ?? SHOWCASE_GROUPS[0]}`,
899
- ],
1577
+ didYouMean: near,
1578
+ run: [near.length === 1 ? `${show} --section ${near[0]}` : show],
900
1579
  },
901
1580
  );
1581
+ }
902
1582
  return s;
903
1583
  }