@astryxdesign/cli 0.7.17-canary.g4ea41ce → 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 (409) hide show
  1. package/README.md +7 -2
  2. package/api/build/_adapter.d.mts +7 -6
  3. package/api/build/_adapter.mjs +18 -11
  4. package/api/build/build.type.mjs +1 -1
  5. package/api/build/kit/kind.d.mts +6 -0
  6. package/api/build/kit/kind.mjs +1 -1
  7. package/api/build/kit/rank.d.mts +7 -1
  8. package/api/build/kit/rank.mjs +15 -5
  9. package/api/build/kit/signals.mjs +58 -57
  10. package/api/build/kit/start.d.mts +2 -1
  11. package/api/build/kit/start.mjs +62 -9
  12. package/api/build/kit/words.d.mts +6 -2
  13. package/api/build/kit/words.mjs +7 -3
  14. package/api/component/__fixtures__/resolutions/modules.txt +2 -2
  15. package/api/component/_adapter.d.mts +30 -24
  16. package/api/component/_adapter.mjs +72 -31
  17. package/api/component/component.mjs +4 -4
  18. package/api/component/detail/detail.d.mts +2 -2
  19. package/api/component/detail/detail.mjs +1 -1
  20. package/api/component/list/list.d.mts +2 -2
  21. package/api/component/list/list.mjs +4 -4
  22. package/api/discover/_adapter.mjs +15 -15
  23. package/api/docs/_adapter.d.mts +13 -5
  24. package/api/docs/_adapter.mjs +37 -10
  25. package/api/doctor/_adapter.d.mts +32 -0
  26. package/api/doctor/_adapter.mjs +56 -1
  27. package/api/doctor/doctor.mjs +28 -5
  28. package/api/doctor/theme-checks.mjs +165 -83
  29. package/api/error.d.mts +4 -3
  30. package/api/error.mjs +3 -2
  31. package/api/hook/_adapter.d.mts +5 -4
  32. package/api/hook/_adapter.mjs +6 -5
  33. package/api/icon/_options.d.mts +17 -0
  34. package/api/icon/_options.mjs +54 -0
  35. package/api/icon/exportIconIndex.doc.d.mts +10 -0
  36. package/api/icon/exportIconIndex.doc.mjs +59 -0
  37. package/api/icon/icon.mjs +11 -34
  38. package/api/icon/icon.type.d.mts +49 -0
  39. package/api/icon/icon.type.mjs +24 -0
  40. package/api/icon/rankIconIndex.doc.d.mts +10 -0
  41. package/api/icon/rankIconIndex.doc.mjs +79 -0
  42. package/api/icon/search/icon-index.d.mts +41 -0
  43. package/api/icon/search/icon-index.mjs +139 -0
  44. package/api/icon/search/search.d.mts +18 -0
  45. package/api/icon/search/search.mjs +13 -0
  46. package/api/index.d.mts +1 -0
  47. package/api/index.mjs +1 -0
  48. package/api/search/_adapter.d.mts +8 -5
  49. package/api/search/_adapter.mjs +14 -10
  50. package/api/search/_gather-components.d.mts +4 -4
  51. package/api/search/_gather-components.mjs +4 -3
  52. package/api/search/_gather-hooks.d.mts +2 -2
  53. package/api/search/_gather-hooks.mjs +1 -1
  54. package/api/search/_lexical.mjs +12 -2
  55. package/api/search/_priority.d.mts +10 -2
  56. package/api/search/_priority.mjs +37 -7
  57. package/api/search/_score.d.mts +12 -3
  58. package/api/search/_score.mjs +6 -3
  59. package/api/search/_words.mjs +12 -3
  60. package/api/search/search.d.mts +7 -1
  61. package/api/search/search.mjs +37 -4
  62. package/api/swizzle/_adapter.d.mts +7 -5
  63. package/api/swizzle/_adapter.mjs +7 -3
  64. package/api/swizzle/copy/copy.mjs +5 -4
  65. package/api/theme/build/build.d.mts +5 -0
  66. package/api/theme/build/build.mjs +400 -21
  67. package/api/theme/build/family.mjs +18 -7
  68. package/api/theme/build/font-warning.mjs +5 -4
  69. package/api/theme/build/input-fields.d.mts +21 -6
  70. package/api/theme/build/input-fields.mjs +104 -13
  71. package/api/theme/build/typography-values.d.mts +22 -0
  72. package/api/theme/build/typography-values.mjs +172 -22
  73. package/api/theme/build/written-values.d.mts +7 -0
  74. package/api/theme/build/written-values.mjs +57 -8
  75. package/api/theme/generateTonalPalette.doc.mjs +1 -1
  76. package/api/theme/palette/generate/generator.d.mts +14 -2
  77. package/api/theme/palette/generate/generator.mjs +94 -8
  78. package/api/theme/theme.type.d.mts +21 -4
  79. package/api/theme/theme.type.mjs +14 -5
  80. package/api/theme/themePaletteGenerate.doc.mjs +1 -1
  81. package/api/theme/themeTemplate.doc.mjs +18 -3
  82. package/api/theme-edit/_adapter.d.mts +1 -1
  83. package/api/theme-edit/_adapter.mjs +1 -1
  84. package/api/theme-edit/_catalog.d.mts +10 -4
  85. package/api/theme-edit/_catalog.mjs +81 -22
  86. package/api/theme-edit/_check.mjs +402 -88
  87. package/api/theme-edit/_color.d.mts +11 -2
  88. package/api/theme-edit/_color.mjs +23 -7
  89. package/api/theme-edit/_compiler.mjs +11 -3
  90. package/api/theme-edit/_context.d.mts +87 -6
  91. package/api/theme-edit/_context.mjs +224 -17
  92. package/api/theme-edit/_css.mjs +4 -0
  93. package/api/theme-edit/_edit.mjs +331 -58
  94. package/api/theme-edit/_how-question.d.mts +11 -0
  95. package/api/theme-edit/_how-question.mjs +2514 -234
  96. package/api/theme-edit/_how.mjs +79 -14
  97. package/api/theme-edit/_missed.mjs +294 -32
  98. package/api/theme-edit/_normal.d.mts +3 -1
  99. package/api/theme-edit/_normal.mjs +4 -1
  100. package/api/theme-edit/_palette.mjs +36 -5
  101. package/api/theme-edit/_part-words.mjs +20 -2
  102. package/api/theme-edit/_parts.d.mts +12 -1
  103. package/api/theme-edit/_parts.mjs +116 -11
  104. package/api/theme-edit/_preview-app.mjs +40 -2
  105. package/api/theme-edit/_preview.d.mts +45 -5
  106. package/api/theme-edit/_preview.mjs +173 -21
  107. package/api/theme-edit/_settings.d.mts +20 -0
  108. package/api/theme-edit/_settings.mjs +1033 -94
  109. package/api/theme-edit/_tables.mjs +2 -2
  110. package/api/theme-edit/theme-edit.type.d.mts +6 -5
  111. package/api/theme-edit/theme-edit.type.mjs +8 -8
  112. package/api/upgrade/_adapter.mjs +13 -2
  113. package/assets/component-list.generated.json +1 -1
  114. package/assets/docs/tree/authoring.doc.mjs +1 -0
  115. package/assets/docs/tree/cli.doc.mjs +1 -0
  116. package/assets/docs/tree/computer-agent-guide.doc.mjs +1 -1
  117. package/assets/docs/tree/generate-a-palette.doc.mjs +2 -2
  118. package/assets/docs/tree/global.doc.mjs +1 -0
  119. package/assets/docs/tree/single-component.doc.mjs +40 -2
  120. package/assets/docs/tree/updates.doc.mjs +1 -1
  121. package/assets/docs/tree/who-answers.doc.mjs +2 -2
  122. package/assets/docs-routes.generated.json +1 -1
  123. package/assets/docs.generated.json +2 -2
  124. package/assets/search-catalog.generated.json +2 -2
  125. package/assets/self-audit.generated.json +1 -1
  126. package/assets/templates/blocks/components/Blockquote/BlockquoteShowcase.tsx +1 -1
  127. package/assets/templates/blocks/components/BreadcrumbItem/BreadcrumbItemShowcase.tsx +4 -4
  128. package/assets/templates/blocks/components/Breadcrumbs/BreadcrumbsCustomSeparator.tsx +1 -0
  129. package/assets/templates/blocks/components/Breadcrumbs/BreadcrumbsSupportingVariant.tsx +2 -2
  130. package/assets/templates/blocks/components/Card/CardElevations.tsx +1 -1
  131. package/assets/templates/blocks/components/Card/CardWithInnerLayout.tsx +19 -3
  132. package/assets/templates/blocks/components/Card/ClickableCardWithNestedButton.tsx +11 -1
  133. package/assets/templates/blocks/components/Card/SelectableCardElevated.tsx +1 -1
  134. package/assets/templates/blocks/components/Card/SelectableCardMulti.tsx +1 -1
  135. package/assets/templates/blocks/components/Center/CenterHorizontal.tsx +1 -1
  136. package/assets/templates/blocks/components/Center/CenterInsideACard.tsx +1 -1
  137. package/assets/templates/blocks/components/ChatComposer/ChatComposerFullFeatured.tsx +8 -0
  138. package/assets/templates/blocks/components/ChatComposerDrawer/ChatComposerDrawerWithProgress.tsx +8 -2
  139. package/assets/templates/blocks/components/ChatLayout/ChatLayoutPanelChat.tsx +1 -0
  140. package/assets/templates/blocks/components/ChatLayout/ChatLayoutShowcase.tsx +1 -1
  141. package/assets/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleCustomContent.tsx +9 -1
  142. package/assets/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleMetadata.tsx +12 -2
  143. package/assets/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataFooter.tsx +28 -7
  144. package/assets/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataShowcase.tsx +35 -7
  145. package/assets/templates/blocks/components/Collapsible/CollapsibleShowcase.tsx +1 -1
  146. package/assets/templates/blocks/components/CommandPaletteGroup/CommandPaletteGroupBasic.tsx +20 -4
  147. package/assets/templates/blocks/components/CommandPaletteList/CommandPaletteListBasic.tsx +15 -3
  148. package/assets/templates/blocks/components/CommandPaletteList/CommandPaletteListShowcase.tsx +29 -6
  149. package/assets/templates/blocks/components/ContextMenu/ContextMenuBasic.tsx +2 -2
  150. package/assets/templates/blocks/components/ContextMenu/ContextMenuBottomSheet.tsx +1 -1
  151. package/assets/templates/blocks/components/ContextMenu/ContextMenuShowcase.tsx +2 -2
  152. package/assets/templates/blocks/components/Divider/DividerFullBleed.tsx +1 -1
  153. package/assets/templates/blocks/components/Divider/DividerShowcase.tsx +1 -1
  154. package/assets/templates/blocks/components/Divider/DividerVariants.tsx +1 -1
  155. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.tsx +23 -4
  156. package/assets/templates/blocks/components/EmptyState/EmptyStateActions.tsx +18 -2
  157. package/assets/templates/blocks/components/EmptyState/EmptyStateCompact.tsx +20 -2
  158. package/assets/templates/blocks/components/EmptyState/EmptyStateContainer.tsx +16 -2
  159. package/assets/templates/blocks/components/EmptyState/EmptyStateShowcase.tsx +11 -1
  160. package/assets/templates/blocks/components/Heading/HeadingTruncation.tsx +12 -2
  161. package/assets/templates/blocks/components/InternationalizationProvider/useDirectionHookUsage.tsx +1 -1
  162. package/assets/templates/blocks/components/LayoutContent/LayoutContentBasic.tsx +1 -1
  163. package/assets/templates/blocks/components/LayoutContent/LayoutContentShowcase.tsx +1 -1
  164. package/assets/templates/blocks/components/LayoutFooter/LayoutFooterActions.tsx +17 -3
  165. package/assets/templates/blocks/components/LayoutFooter/LayoutFooterShowcase.tsx +17 -3
  166. package/assets/templates/blocks/components/LayoutHeader/LayoutHeaderShowcase.tsx +15 -3
  167. package/assets/templates/blocks/components/LayoutHeader/LayoutHeaderWithActions.tsx +9 -2
  168. package/assets/templates/blocks/components/LayoutPanel/LayoutPanelNavigation.tsx +1 -1
  169. package/assets/templates/blocks/components/LayoutPanel/LayoutPanelShowcase.tsx +1 -1
  170. package/assets/templates/blocks/components/MoreMenu/MoreMenuBottomSheet.tsx +1 -1
  171. package/assets/templates/blocks/components/MultiSelector/MultiSelectorGhostToolbar.tsx +14 -2
  172. package/assets/templates/blocks/components/Outline/OutlineDensity.tsx +2 -0
  173. package/assets/templates/blocks/components/OverflowList/OverflowListShowcase.tsx +6 -1
  174. package/assets/templates/blocks/components/Pagination/PaginationVariants.tsx +4 -0
  175. package/assets/templates/blocks/components/Popover/PopoverHookUsage.tsx +17 -2
  176. package/assets/templates/blocks/components/SegmentedControl/SegmentedControlFillLayout.tsx +1 -1
  177. package/assets/templates/blocks/components/Selector/SelectorGhostToolbar.tsx +14 -2
  178. package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.tsx +8 -1
  179. package/assets/templates/blocks/components/SideNav/SideNavWithHeaderMenu.tsx +2 -2
  180. package/assets/templates/blocks/components/SideNavHeading/SideNavHeadingShowcase.tsx +2 -0
  181. package/assets/templates/blocks/components/Switch/SwitchWithStatus.tsx +1 -1
  182. package/assets/templates/blocks/components/TabList/TabListTabsFillLayout.tsx +1 -1
  183. package/assets/templates/blocks/components/TabList/TabListTabsWithActions.tsx +12 -1
  184. package/assets/templates/blocks/components/Table/TableBulkActionsTable.tsx +11 -1
  185. package/assets/templates/blocks/components/Table/TableInCard.tsx +2 -2
  186. package/assets/templates/blocks/components/Text/TextTruncation.tsx +1 -1
  187. package/assets/templates/blocks/components/Text/TextWordBreak.tsx +12 -2
  188. package/assets/templates/blocks/components/Text/TextWrap.tsx +19 -4
  189. package/assets/templates/blocks/components/TextArea/TextAreaCharacterCount.tsx +1 -1
  190. package/assets/templates/blocks/components/TextArea/TextAreaShowcase.tsx +1 -1
  191. package/assets/templates/blocks/components/TextArea/TextAreaStates.tsx +1 -1
  192. package/assets/templates/blocks/components/TextArea/TextAreaValidation.tsx +1 -1
  193. package/assets/templates/blocks/components/TextArea/TextAreaWithIcon.tsx +1 -1
  194. package/assets/templates/blocks/components/TextInput/TextInputStatusVariant.tsx +2 -2
  195. package/assets/templates/blocks/components/Timestamp/TimestampAutoFormat.tsx +15 -1
  196. package/assets/templates/blocks/components/Timestamp/TimestampRelativeFormat.tsx +15 -1
  197. package/assets/templates/blocks/components/Toolbar/ToolbarCardHeader.tsx +8 -0
  198. package/assets/templates/blocks/components/Toolbar/ToolbarSizes.tsx +12 -1
  199. package/assets/templates/blocks/components/Toolbar/ToolbarThreeSlot.tsx +18 -3
  200. package/assets/templates/blocks/components/TopNav/TopNavCenteredNavigation.tsx +6 -0
  201. package/assets/templates/blocks/components/TopNav/TopNavEnterpriseDashboard.tsx +7 -1
  202. package/assets/templates/blocks/components/TopNav/TopNavMegaMenu.tsx +2 -2
  203. package/assets/templates/blocks/components/TopNav/TopNavShowcase.tsx +9 -0
  204. package/assets/templates/components.generated.json +1 -1
  205. package/assets/templates/pages/ai-chat/page.tsx +102 -6
  206. package/assets/templates/pages/canvas-editor/page.tsx +73 -2
  207. package/assets/templates/pages/centered-hero/page.tsx +10 -4
  208. package/assets/templates/pages/course-detail/page.tsx +46 -2
  209. package/assets/templates/pages/dashboard/page.tsx +45 -16
  210. package/assets/templates/pages/dashboard-cohort-funnel/page.tsx +31 -20
  211. package/assets/templates/pages/dashboard-comparison/page.tsx +9 -0
  212. package/assets/templates/pages/dashboard-composition/page.tsx +22 -9
  213. package/assets/templates/pages/dashboard-progress/page.tsx +27 -15
  214. package/assets/templates/pages/dashboard-scorecard/page.tsx +9 -0
  215. package/assets/templates/pages/detail-page/page.tsx +105 -77
  216. package/assets/templates/pages/documentation/page.tsx +15 -2
  217. package/assets/templates/pages/documentation-design/page.tsx +7 -34
  218. package/assets/templates/pages/documentation-technical/page.tsx +76 -12
  219. package/assets/templates/pages/editor/page.tsx +26 -21
  220. package/assets/templates/pages/file-explorer/page.tsx +35 -1
  221. package/assets/templates/pages/form-two-column/page.tsx +2 -3
  222. package/assets/templates/pages/form-wizard/page.tsx +31 -3
  223. package/assets/templates/pages/form-wizard-vertical/page.tsx +32 -3
  224. package/assets/templates/pages/gallery-hero/page.tsx +2 -1
  225. package/assets/templates/pages/ide/page.tsx +15 -1
  226. package/assets/templates/pages/incident-console/page.tsx +2 -1
  227. package/assets/templates/pages/incident-console/template.doc.mjs +1 -1
  228. package/assets/templates/pages/kanban-board/page.tsx +39 -2
  229. package/assets/templates/pages/payment-form/page.tsx +77 -39
  230. package/assets/templates/pages/product-gallery/page.tsx +16 -14
  231. package/assets/templates/pages/settings/page.tsx +35 -3
  232. package/assets/templates/pages/settings-dialog/page.tsx +34 -5
  233. package/assets/templates/pages/settings-sidebar/page.tsx +23 -3
  234. package/assets/templates/pages/shell-nav/page.tsx +28 -12
  235. package/assets/templates/pages/shell-side-nav/page.tsx +16 -1
  236. package/assets/templates/pages/shell-top-nav/page.tsx +27 -1
  237. package/assets/templates/pages/side-gallery/page.tsx +1 -1
  238. package/assets/templates/pages/table/page.tsx +2 -1
  239. package/assets/templates/pages/table/template.doc.mjs +1 -1
  240. package/assets/templates/pages/table-collapsible/page.tsx +1 -1
  241. package/assets/templates/pages/table-comparison/page.tsx +1 -1
  242. package/assets/templates/pages/table-filter/page.tsx +9 -2
  243. package/assets/templates/pages/table-grouped/page.tsx +16 -6
  244. package/assets/templates/pages/table-inbox/page.tsx +60 -1
  245. package/assets/templates/pages/table-page/page.tsx +10 -2
  246. package/assets/templates/pages/table-tree/page.tsx +95 -13
  247. package/assets/templates/pages/theme-showcase/page.tsx +107 -11
  248. package/assets/templates/pages/work-item-detail/page.tsx +88 -74
  249. package/assets/templates/pages/work-item-detail/template.doc.mjs +0 -1
  250. package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +1 -1
  251. package/assets/templates/themes/gothic/gothicTheme.ts +5 -0
  252. package/assets/templates/themes/neutral/neutralTheme.ts +1 -1
  253. package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +1 -1
  254. package/assets/templates/themes/y2k/y2kTheme.ts +1 -1
  255. package/authoring/debug/parse.d.mts +1 -1
  256. package/authoring/doctypes/_schema.d.mts +22 -8
  257. package/authoring/doctypes/_schema.mjs +31 -0
  258. package/authoring/doctypes/command/command.doc.mjs +24 -0
  259. package/authoring/doctypes/command/type.ts +31 -0
  260. package/authoring/doctypes/component/component.doc.mjs +1 -1
  261. package/authoring/doctypes/component/type.ts +8 -5
  262. package/authoring/doctypes/namespace/namespace.doc.mjs +6 -0
  263. package/authoring/doctypes/namespace/type.ts +4 -0
  264. package/authoring/doctypes/template/type.ts +0 -7
  265. package/authoring/index.d.ts +6 -1
  266. package/authoring/integration/integration.doc.mjs +7 -0
  267. package/authoring/integration/schema.d.mts +6 -0
  268. package/authoring/integration/schema.mjs +3 -0
  269. package/authoring/integration/type.ts +34 -0
  270. package/clients/cli/build-id.generated.json +1 -1
  271. package/clients/cli/commands/component.doc.mjs +1 -0
  272. package/clients/cli/commands/component.mjs +5 -1
  273. package/clients/cli/commands/docs.doc.mjs +1 -1
  274. package/clients/cli/commands/experimental/index.mjs +4 -1
  275. package/clients/cli/commands/experimental/theme.mjs +139 -64
  276. package/clients/cli/commands/experimental-render.doc.mjs +2 -0
  277. package/clients/cli/commands/experimental-theme-add.doc.mjs +2 -0
  278. package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -0
  279. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +1 -0
  280. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +3 -1
  281. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +3 -2
  282. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +2 -1
  283. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +3 -2
  284. package/clients/cli/commands/experimental-theme-eject.doc.mjs +1 -0
  285. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +1 -0
  286. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -0
  287. package/clients/cli/commands/experimental-theme-remove.doc.mjs +2 -0
  288. package/clients/cli/commands/experimental-theme-targets.doc.mjs +1 -0
  289. package/clients/cli/commands/experimental-theme-template.doc.mjs +1 -0
  290. package/clients/cli/commands/experimental-theme-use.doc.mjs +2 -0
  291. package/clients/cli/commands/gap-report.doc.mjs +1 -0
  292. package/clients/cli/commands/hook.doc.mjs +1 -1
  293. package/clients/cli/commands/init.doc.mjs +1 -1
  294. package/clients/cli/commands/integration-add.doc.mjs +1 -0
  295. package/clients/cli/commands/manifest.mjs +10 -3
  296. package/clients/cli/commands/swizzle.doc.mjs +8 -1
  297. package/clients/cli/commands/swizzle.mjs +13 -6
  298. package/clients/cli/commands/template.doc.mjs +3 -0
  299. package/clients/cli/commands/theme-add.doc.mjs +2 -1
  300. package/clients/cli/commands/theme-build.doc.mjs +2 -1
  301. package/clients/cli/commands/theme-eject.doc.mjs +1 -1
  302. package/clients/cli/commands/theme-palette-generate.doc.mjs +3 -2
  303. package/clients/cli/commands/theme-remove.doc.mjs +2 -1
  304. package/clients/cli/commands/theme-targets.doc.mjs +1 -0
  305. package/clients/cli/commands/theme-template.doc.mjs +1 -0
  306. package/clients/cli/commands/theme-use.doc.mjs +2 -1
  307. package/clients/cli/commands/theme.doc.mjs +7 -2
  308. package/clients/cli/commands/theme.mjs +21 -5
  309. package/clients/cli/index.mjs +167 -59
  310. package/clients/cli/lib/base-gate.mjs +522 -0
  311. package/clients/cli/lib/command-path.mjs +26 -0
  312. package/clients/cli/lib/define-command.mjs +161 -12
  313. package/clients/cli/lib/json-shim.mjs +34 -31
  314. package/clients/cli/lib/manifest.d.ts +14 -0
  315. package/clients/cli/lib/manifest.mjs +78 -22
  316. package/clients/cli/lib/root-args.mjs +79 -0
  317. package/clients/cli/lib/stray-option.mjs +21 -8
  318. package/clients/cli/lib/unknown-command.mjs +27 -6
  319. package/clients/cli/manifest.generated.json +1 -1
  320. package/clients/cli/run.mjs +13 -1
  321. package/foundation/agent-docs/computer-agent-text.mjs +1 -1
  322. package/foundation/bases/core-docs.d.mts +10 -0
  323. package/foundation/bases/core-docs.mjs +42 -0
  324. package/foundation/bases/core.d.mts +11 -0
  325. package/foundation/bases/core.mjs +32 -0
  326. package/foundation/bases/requirements.d.mts +128 -0
  327. package/foundation/bases/requirements.mjs +193 -0
  328. package/foundation/bases/resolve.d.mts +134 -0
  329. package/foundation/bases/resolve.mjs +295 -0
  330. package/foundation/bases/state.d.mts +24 -0
  331. package/foundation/bases/state.mjs +46 -0
  332. package/foundation/bases/steps.d.mts +49 -0
  333. package/foundation/bases/steps.mjs +88 -0
  334. package/foundation/config/project.d.mts +14 -0
  335. package/foundation/config/project.mjs +68 -1
  336. package/foundation/discovery/cli-self-docs.mjs +9 -1
  337. package/foundation/discovery/command-pointers.d.mts +28 -0
  338. package/foundation/discovery/command-pointers.mjs +31 -0
  339. package/foundation/discovery/component-discovery.d.mts +9 -8
  340. package/foundation/discovery/component-discovery.mjs +9 -4
  341. package/foundation/discovery/docs-discovery.d.mts +13 -5
  342. package/foundation/discovery/docs-discovery.mjs +25 -6
  343. package/foundation/discovery/hook-discovery.d.mts +6 -6
  344. package/foundation/discovery/hook-discovery.mjs +6 -4
  345. package/foundation/discovery/template-adapter.mjs +5 -0
  346. package/foundation/discovery/template-ids.d.mts +1 -1
  347. package/foundation/discovery/template-ids.mjs +5 -1
  348. package/foundation/discovery/theme-discovery.mjs +3 -0
  349. package/foundation/discovery/theme-imports.mjs +19 -1
  350. package/foundation/doc-compiler/tree.d.mts +4 -2
  351. package/foundation/doc-compiler/tree.mjs +46 -1
  352. package/foundation/env/package-manager.d.mts +7 -0
  353. package/foundation/env/package-manager.mjs +21 -0
  354. package/foundation/fonts/font-stylesheet.d.mts +8 -0
  355. package/foundation/fonts/font-stylesheet.mjs +26 -2
  356. package/foundation/fs/gather-cache.mjs +44 -13
  357. package/foundation/fs/own-modules.d.mts +29 -0
  358. package/foundation/fs/own-modules.mjs +57 -0
  359. package/foundation/fs/paths.d.mts +30 -2
  360. package/foundation/fs/paths.mjs +49 -2
  361. package/foundation/integrations/integrations.d.mts +4 -0
  362. package/foundation/integrations/integrations.mjs +6 -1
  363. package/foundation/release/choose.d.mts +7 -0
  364. package/foundation/release/choose.mjs +16 -2
  365. package/foundation/release/notices.d.mts +26 -0
  366. package/foundation/release/notices.mjs +48 -19
  367. package/foundation/release/project.d.mts +3 -2
  368. package/foundation/release/project.mjs +4 -5
  369. package/foundation/release/run-context.d.mts +7 -2
  370. package/foundation/release/run-context.mjs +6 -2
  371. package/foundation/render/css-cut.mjs +86 -6
  372. package/foundation/render/cut-short.d.mts +35 -0
  373. package/foundation/render/cut-short.mjs +124 -0
  374. package/foundation/render/font-probe.d.mts +27 -0
  375. package/foundation/render/font-probe.mjs +77 -0
  376. package/foundation/render/layers.d.mts +1 -9
  377. package/foundation/render/layers.mjs +2 -111
  378. package/foundation/render/page-worker.mjs +83 -6
  379. package/foundation/render/picture-chrome.mjs +24 -2
  380. package/foundation/render/picture-playwright.mjs +22 -2
  381. package/foundation/render/picture-window.d.mts +20 -4
  382. package/foundation/render/picture-window.mjs +137 -4
  383. package/foundation/response/base.d.ts +25 -0
  384. package/foundation/response/error-codes.d.mts +4 -1
  385. package/foundation/response/error-codes.d.ts +4 -1
  386. package/foundation/response/error-codes.doc.mjs +17 -0
  387. package/foundation/response/error-codes.mjs +21 -0
  388. package/foundation/response/json.d.mts +3 -1
  389. package/foundation/response/json.mjs +7 -2
  390. package/foundation/response/response-types.doc.mjs +2 -2
  391. package/foundation/suggest/name-index.d.mts +2 -1
  392. package/foundation/suggest/name-index.mjs +1 -1
  393. package/foundation/suggest/other-command.d.mts +4 -1
  394. package/foundation/suggest/other-command.mjs +23 -6
  395. package/foundation/text/string-utils.d.mts +7 -2
  396. package/foundation/text/string-utils.mjs +24 -10
  397. package/package.json +6 -6
  398. package/assets/templates/pages/access-denied/page.tsx +0 -101
  399. package/assets/templates/pages/access-denied/template.doc.mjs +0 -24
  400. package/assets/templates/pages/error-page/page.tsx +0 -130
  401. package/assets/templates/pages/error-page/template.doc.mjs +0 -22
  402. package/assets/templates/pages/not-found/page.tsx +0 -124
  403. package/assets/templates/pages/not-found/template.doc.mjs +0 -30
  404. package/assets/templates/pages/review-workspace/page.tsx +0 -551
  405. package/assets/templates/pages/review-workspace/template.doc.mjs +0 -31
  406. package/assets/templates/pages/run-console/page.tsx +0 -945
  407. package/assets/templates/pages/run-console/template.doc.mjs +0 -27
  408. package/assets/templates/pages/welcome-portal/page.tsx +0 -538
  409. package/assets/templates/pages/welcome-portal/template.doc.mjs +0 -38
@@ -87,8 +87,10 @@ export function withoutCssEscapes(v: string): string;
87
87
  /**
88
88
  * Whether a value can sit in a CSS declaration as it is: no `<>`, control
89
89
  * character, comment or `!important` anywhere; outside a quoted string or a
90
- * `url(data:…)`, no `;{}`; brackets and quotes closed. So `content: "a;b"`
91
- * and a base64 data URL are values, and nothing can end the declaration.
90
+ * `url(data:…)`, no `;{}`; brackets and quotes closed; no old browser hack's
91
+ * escape at its end (`8px\9`: a browser reads it as part of the last word
92
+ * and drops the value). So `content: "a;b"` and a base64 data URL are
93
+ * values, and nothing can end the declaration.
92
94
  * @param {string} v
93
95
  */
94
96
  export function isSafeValue(v: string): boolean;
@@ -99,9 +101,16 @@ export function namedColorHex(name: string): string | null;
99
101
  /** One color written inside a value: a hex color or a color function. */
100
102
  export const COLOR_IN_VALUE: RegExp;
101
103
  export function hex(rgb: number[]): string;
104
+ /**
105
+ * A value that is one var() of a custom property and nothing else, with
106
+ * any spaces inside its brackets as CSS reads them (`var( --x )`).
107
+ */
108
+ export const LONE_VAR: RegExp;
102
109
  export function isColorValue(v: unknown): boolean;
103
110
  export function isSize(v: unknown, name?: string): boolean;
104
111
  export function isNumber(v: unknown, name?: string): boolean;
112
+ /** What a value isSafeValue refuses holds, for the refusal's words. */
113
+ export const UNSAFE_VALUE: "it has a ; { } < > or a newline, a comment, !important, an unclosed bracket or quote, or an old browser hack (\\9, \\0) at its end";
105
114
  export type Num = {
106
115
  n: number;
107
116
  unit: string;
@@ -984,6 +984,15 @@ export function ratio(a, b) {
984
984
  return (x + 0.05) / (y + 0.05);
985
985
  }
986
986
 
987
+ /**
988
+ * A value that is one var() of a custom property and nothing else, with
989
+ * any spaces inside its brackets as CSS reads them (`var( --x )`).
990
+ */
991
+ export const LONE_VAR = /^var\(\s*--[a-z0-9-]+\s*\)$/i;
992
+
993
+ /** A var() of a custom property with a fallback: the fallback, captured. */
994
+ const VAR_FALLBACK = /^var\(\s*--[a-z0-9-]+\s*,\s*(.+)\)$/i;
995
+
987
996
  /**
988
997
  * Whether a value is one CSS color: a hex, a color function, a named or
989
998
  * system color, a color keyword, or a variable. A function with plain
@@ -1007,10 +1016,10 @@ export const isColorValue = v => {
1007
1016
  return (
1008
1017
  /^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(s) ||
1009
1018
  FUNCTIONS.test(s) ||
1010
- /^var\(--[a-z0-9-]+\)$/i.test(s) ||
1019
+ LONE_VAR.test(s) ||
1011
1020
  // A variable with a color to fall back to.
1012
- (/^var\(--[a-z0-9-]+\s*,\s*(.+)\)$/i.test(s) &&
1013
- isColorValue(/^var\(--[a-z0-9-]+\s*,\s*(.+)\)$/i.exec(s)?.[1] ?? '')) ||
1021
+ (VAR_FALLBACK.test(s) &&
1022
+ isColorValue(/** @type {string} */ (VAR_FALLBACK.exec(s)?.[1]))) ||
1014
1023
  Object.hasOwn(NAMED, s.toLowerCase()) ||
1015
1024
  KEYWORDS.includes(s.toLowerCase()) ||
1016
1025
  SYSTEM.includes(s.toLowerCase())
@@ -1033,7 +1042,7 @@ export const isSize = (v, name = '') => {
1033
1042
  const n = cssNumber(s);
1034
1043
  if (n && n.unit && matchType('length-percentage', s) != null)
1035
1044
  return n.value >= 0 || /offset|tracking|letter-spacing|indent/.test(name);
1036
- if (/^var\(--[a-z0-9-]+\)$/i.test(s)) return true;
1045
+ if (LONE_VAR.test(s)) return true;
1037
1046
  if (/^env\([a-z-]+(,.*)?\)$/i.test(s)) return true;
1038
1047
  return MATH_FUNCTION.test(s) && matchType('length-percentage', s) != null;
1039
1048
  };
@@ -1047,7 +1056,7 @@ export const isSize = (v, name = '') => {
1047
1056
  */
1048
1057
  export const isNumber = (v, name = '') => {
1049
1058
  const s = String(v).trim();
1050
- if (/^var\(--[a-z0-9-]+\)$/i.test(s)) return true;
1059
+ if (LONE_VAR.test(s)) return true;
1051
1060
  const n = cssNumber(s);
1052
1061
  // A weight: a font-weight keyword, or a number from 1 to 1000.
1053
1062
  if (/weight/.test(name))
@@ -1079,14 +1088,21 @@ export function withoutCssEscapes(v) {
1079
1088
  return v.replace(/\\(?:[0-9a-fA-F]{1,6}[ \t]?|[^\n\r\f0-9a-fA-F])/g, 'x');
1080
1089
  }
1081
1090
 
1091
+ /** What a value isSafeValue refuses holds, for the refusal's words. */
1092
+ export const UNSAFE_VALUE =
1093
+ 'it has a ; { } < > or a newline, a comment, !important, an unclosed bracket or quote, or an old browser hack (\\9, \\0) at its end';
1094
+
1082
1095
  /**
1083
1096
  * Whether a value can sit in a CSS declaration as it is: no `<>`, control
1084
1097
  * character, comment or `!important` anywhere; outside a quoted string or a
1085
- * `url(data:…)`, no `;{}`; brackets and quotes closed. So `content: "a;b"`
1086
- * and a base64 data URL are values, and nothing can end the declaration.
1098
+ * `url(data:…)`, no `;{}`; brackets and quotes closed; no old browser hack's
1099
+ * escape at its end (`8px\9`: a browser reads it as part of the last word
1100
+ * and drops the value). So `content: "a;b"` and a base64 data URL are
1101
+ * values, and nothing can end the declaration.
1087
1102
  * @param {string} v
1088
1103
  */
1089
1104
  export function isSafeValue(v) {
1105
+ if (/\\[09]\s*$/.test(v)) return false;
1090
1106
  // A shell comment ("# direct"), as a command run without a shell passes
1091
1107
  // it, is a comment too.
1092
1108
  // `</` (a closing tag), control characters, comments and !important are
@@ -341,7 +341,13 @@ export function makeCompiler(project, parts) {
341
341
  const g = groupOfToken(token);
342
342
  // Under a variant: only what the part reads in that variant's rules (or
343
343
  // rules that name no variant) counts.
344
- const [wProp, wVal] = String(when ?? '').split(':');
344
+ // (Several conditions, `variant:ghost+size:sm`: a rule counts when it
345
+ // names none of them otherwise; the message names the first.)
346
+ const whens = String(when ?? '')
347
+ .split('+')
348
+ .map(w => w.split(':'))
349
+ .filter(([p, v]) => p && v);
350
+ const [wProp, wVal] = whens[0] ?? [];
345
351
  if (wProp && wVal && allReads(target).has(token)) {
346
352
  const conds = [
347
353
  ...Object.values(MAP[target]?.own ?? {}).flatMap(
@@ -350,8 +356,10 @@ export function makeCompiler(project, parts) {
350
356
  ];
351
357
  const inVariant = (/** @type {string} */ c) => {
352
358
  const attrs = c.split(' ')[0].split(',');
353
- const own = attrs.find(a => a.startsWith(`${wProp}=`));
354
- return !own || own === `${wProp}=${wVal}`;
359
+ return whens.every(([p, v]) => {
360
+ const own = attrs.find(a => a.startsWith(`${p}=`));
361
+ return !own || own === `${p}=${v}`;
362
+ });
355
363
  };
356
364
  // (What a line inside the part declares is recorded as the part's
357
365
  // own already; any other part inside it that reads the token takes
@@ -110,18 +110,45 @@ export function reactCopies(project: import("./_project.mjs").ThemeProject): {
110
110
  core: string;
111
111
  } | null;
112
112
  /**
113
- * Pictures of HTML files, on request.
113
+ * The note for text a page's pictures draw cut short.
114
+ * @param {CutShort} c
115
+ */
116
+ export function cutShortNote(c: CutShort): string;
117
+ /**
118
+ * The problem for text a page's pictures draw cut short, with the line that
119
+ * keeps it whole: the part keeps its width (`flex-shrink 0` on it), offered
120
+ * only when the browser measured every text whole with it; else no line,
121
+ * and that the line was measured and does not.
122
+ * @param {import('./_settings.mjs').Ctx} ctx
123
+ * @param {string} slug
124
+ * @param {CutShort} c
125
+ * @returns {{problem: string, fix: string | null}}
126
+ */
127
+ export function cutShortProblem(ctx: import("./_settings.mjs").Ctx, slug: string, c: CutShort): {
128
+ problem: string;
129
+ fix: string | null;
130
+ };
131
+ /**
132
+ * Pictures of HTML files, on request. A shot with a `name` is a page laid
133
+ * out so its text fits in the base theme (the sample page): the text its
134
+ * pictures draw cut short, as the browser measured it, comes back in
135
+ * `cutShort`, one entry for each part on each page ({@link cutShortNote},
136
+ * {@link cutShortProblem}). The sheets (the open
137
+ * states among them) have no name: their cells are narrow, and the full
138
+ * sheet cuts long labels short in every theme.
114
139
  * @param {import('./_project.mjs').ThemeProject} project
115
- * @param {Array<{html: string, png: string}>} shots
140
+ * @param {Array<{html: string, png: string, name?: string}>} shots
116
141
  * @param {Array<'light' | 'dark'>} modes
117
- * @returns {Promise<{files: string[], problem: string | null}>}
142
+ * @returns {Promise<{files: string[], problem: string | null, cutShort: CutShort[]}>}
118
143
  */
119
144
  export function pictures(project: import("./_project.mjs").ThemeProject, shots: Array<{
120
145
  html: string;
121
146
  png: string;
147
+ name?: string;
122
148
  }>, modes: Array<"light" | "dark">): Promise<{
123
149
  files: string[];
124
150
  problem: string | null;
151
+ cutShort: CutShort[];
125
152
  }>;
126
153
  /**
127
154
  * The families the theme's build writes that no package loads: not a
@@ -191,9 +218,10 @@ export function baseWeightNotes(ctx: import("./_settings.mjs").Ctx, data: import
191
218
  export function styledChanges(before: any, after: any, base?: any): string[];
192
219
  /**
193
220
  * The line that says which pictures to open after a run that took them:
194
- * the sample page's and the open states' (every menu, tooltip, popover and
195
- * list drawn open), of the mode shown first (light when the theme has
196
- * both). Null when this run took neither.
221
+ * each family of components' first ({@link familyPages}), then the sample
222
+ * page's and the open states' (every menu, tooltip, popover and list drawn
223
+ * open), of the mode shown first (light when the theme has both). Null when
224
+ * this run took none of them.
197
225
  * @param {string[]} files the pictures taken, as shown (`themes/t/preview.png`)
198
226
  * @returns {string | null}
199
227
  */
@@ -218,6 +246,28 @@ export function openStatesPage(ctx: import("./_settings.mjs").Ctx, slug: string,
218
246
  } | {
219
247
  problem: string;
220
248
  }>;
249
+ /**
250
+ * One page for each family of components ({@link FAMILY_SECTIONS}), cut
251
+ * from the full sheet just made, so each shows its family as the sheet
252
+ * does, with no render of its own: the sheet's head and bar, then that
253
+ * family's section. Each is written where `show --section <family>` writes
254
+ * that family's sheet, and stamped with the build it shows. Something of
255
+ * yours at a family page's name is never written over: that page is left
256
+ * out and named.
257
+ * @param {string} sheet the full sheet, as written
258
+ * @param {string} slug
259
+ * @param {string} cwd
260
+ * @param {readonly string[]} [only] the families to make; every one by default
261
+ * @returns {{pages: Array<{html: string, png: string, family: string}>, problems: string[]}}
262
+ */
263
+ export function familyPages(sheet: string, slug: string, cwd: string, only?: readonly string[]): {
264
+ pages: Array<{
265
+ html: string;
266
+ png: string;
267
+ family: string;
268
+ }>;
269
+ problems: string[];
270
+ };
221
271
  /**
222
272
  * Previews after a change: the sample page always; on request, pictures of
223
273
  * it and of the open states ({@link openStatesPage}).
@@ -230,6 +280,7 @@ export function previewAfter(ctx: import("./_settings.mjs").Ctx, slug: string, d
230
280
  sheetStale?: string | undefined;
231
281
  preview: string | null;
232
282
  pictures: string[];
283
+ cutShort: CutShort[];
233
284
  pictureProblem: string | null;
234
285
  notChecked: {
235
286
  code: import("../../foundation/response/error-codes.mjs").ErrorCode;
@@ -253,3 +304,33 @@ export function stampSheet(file: string, slug: string, cwd: string): void;
253
304
  * @returns {string | undefined}
254
305
  */
255
306
  export function checkSection(section: string | undefined, theme?: string, rest?: string): string | undefined;
307
+ /** The sample page, as a note about its pictures names it. */
308
+ export const SAMPLE_PAGE_NAME: "the sample page";
309
+ /**
310
+ * The family `show --png` pictures when the theme's settings set no part of
311
+ * its own (a fresh theme, or only theme-wide settings): the buttons, an
312
+ * overview of the theme's controls beside the sample page.
313
+ */
314
+ export const FAMILY_OVERVIEW: "actions";
315
+ /**
316
+ * The families of components with a picture of their own beside the full
317
+ * sheet, which is too tall to read whole: each section of the sheet but the
318
+ * overlays (the open states page shows them) and the pages (the sample page
319
+ * is preview.png).
320
+ */
321
+ export const FAMILY_SECTIONS: readonly string[];
322
+ /**
323
+ * Text one page's pictures draw cut short in one part, as the browser
324
+ * measured it: the page and its picture, the part (null when the text sits
325
+ * in none), its texts, the one mode it was cut in when only one was, and
326
+ * whether every text is drawn whole once the part keeps its width
327
+ * (`flex-shrink: 0`, applied in the page and measured).
328
+ */
329
+ export type CutShort = {
330
+ page: string;
331
+ file: string;
332
+ part: string | null;
333
+ texts: string[];
334
+ only: "light" | "dark" | null;
335
+ whole: boolean;
336
+ };
@@ -144,7 +144,7 @@ export async function context(cwd) {
144
144
  unchecked = renderCause(project, /** @type {Error} */ (e).message);
145
145
  uncheckedCode = /** @type {any} */ (e).code ?? null;
146
146
  parts = {
147
- version: 0,
147
+ censusKey: '',
148
148
  coreKey: project.coreKey,
149
149
  map: {},
150
150
  pairs: [],
@@ -426,16 +426,99 @@ export function reactCopies(project) {
426
426
  const notChecked = cause =>
427
427
  cause ? {code: E.ERR_THEME_NOT_CHECKED, cause} : null;
428
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
+
460
+ /**
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
+
429
483
  /**
430
- * Pictures of HTML files, on request.
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.
431
491
  * @param {import('./_project.mjs').ThemeProject} project
432
- * @param {Array<{html: string, png: string}>} shots
492
+ * @param {Array<{html: string, png: string, name?: string}>} shots
433
493
  * @param {Array<'light' | 'dark'>} modes
434
- * @returns {Promise<{files: string[], problem: string | null}>}
494
+ * @returns {Promise<{files: string[], problem: string | null, cutShort: CutShort[]}>}
435
495
  */
436
496
  export async function pictures(project, shots, modes) {
437
497
  /** @type {string[]} */
438
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
+ );
439
522
  /** What a later browser's success says of an earlier one. @type {string[]} */
440
523
  const notes = [];
441
524
  /** One run for every picture: a browser that failed is not tried again. */
@@ -485,10 +568,11 @@ export async function pictures(project, shots, modes) {
485
568
  if (!slug) continue;
486
569
  const record = themeFiles(project.cwd, slug).pictures;
487
570
  const st = fs.lstatSync(record, {throwIfNoEntry: false});
488
- if (st && !st.isFile() && !st.isSymbolicLink())
571
+ if (st && !st.isFile())
489
572
  return {
490
573
  files,
491
- problem: `${inTheWayPhrase(path.relative(project.cwd, record), st.isDirectory() ? 'folder' : 'other', "the record of the editor's pictures")}, so no picture was taken and it is left as it is; move it, then run the command again`,
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`,
492
576
  };
493
577
  }
494
578
  /** Pictures skipped for a link at their name. @type {string[]} */
@@ -496,9 +580,10 @@ export async function pictures(project, shots, modes) {
496
580
  if (blocked.length)
497
581
  return {
498
582
  files,
583
+ cutShort: [],
499
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'}`,
500
585
  };
501
- for (const {html, png} of shots) {
586
+ for (const {html, png, name} of shots) {
502
587
  for (const m of modes) {
503
588
  const out = outOf(png, m);
504
589
  if (isLink(out)) {
@@ -530,6 +615,7 @@ export async function pictures(project, shots, modes) {
530
615
  if (fs.existsSync(part) && !fs.lstatSync(part).isFile())
531
616
  return {
532
617
  files,
618
+ cutShort: cutShortNotes(),
533
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))}/`,
534
620
  };
535
621
  // A folder it cannot write gets no picture: named before the browser
@@ -539,6 +625,7 @@ export async function pictures(project, shots, modes) {
539
625
  } catch (e) {
540
626
  return {
541
627
  files,
628
+ cutShort: cutShortNotes(),
542
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`,
543
630
  };
544
631
  }
@@ -553,6 +640,7 @@ export async function pictures(project, shots, modes) {
553
640
  .map(f => path.relative(project.cwd, f).split(path.sep).join('/'));
554
641
  return {
555
642
  files,
643
+ cutShort: cutShortNotes(),
556
644
  problem: files.length
557
645
  ? `${files.join(', ')} ${files.length === 1 ? 'was' : 'were'} taken, but ${missed.join(', ')} ${missed.length === 1 ? 'was' : 'were'} not: ${r.reason}`
558
646
  : `No picture was taken: ${r.reason}`,
@@ -564,6 +652,7 @@ export async function pictures(project, shots, modes) {
564
652
  fs.rmSync(part, {force: true});
565
653
  return {
566
654
  files,
655
+ cutShort: cutShortNotes(),
567
656
  problem: `the picture could not be moved into ${path.relative(project.cwd, out)} (${/** @type {any} */ (e)?.code ?? e})`,
568
657
  };
569
658
  }
@@ -584,7 +673,24 @@ export async function pictures(project, shots, modes) {
584
673
  }
585
674
  recordWritten(project.cwd, slug, [out]);
586
675
  }
587
- 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
+ }
588
694
  }
589
695
  }
590
696
  if (linked.length) {
@@ -610,6 +716,7 @@ export async function pictures(project, shots, modes) {
610
716
  // Pictures were taken; a note says why an earlier browser did not, and
611
717
  // which pictures a link at their name kept out.
612
718
  problem: notes.join('; ') || null,
719
+ cutShort: cutShortNotes(),
613
720
  };
614
721
  }
615
722
 
@@ -781,7 +888,12 @@ export function fontNotes(ctx, data) {
781
888
  // Apple systems reach their interface faces only by a generic.
782
889
  const {fallbacks} = fontOf(s.value);
783
890
  const next = fallbacks.split(',')[0]?.trim() || 'system-ui';
784
- const value = [generic, fallbacks.trim()].filter(Boolean).join(', ');
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(', ');
785
897
  notes.push(
786
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}`,
787
899
  );
@@ -1078,9 +1190,10 @@ export function styledChanges(before, after, base) {
1078
1190
 
1079
1191
  /**
1080
1192
  * The line that says which pictures to open after a run that took them:
1081
- * the sample page's and the open states' (every menu, tooltip, popover and
1082
- * list drawn open), of the mode shown first (light when the theme has
1083
- * both). Null when this run took neither.
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.
1084
1197
  * @param {string[]} files the pictures taken, as shown (`themes/t/preview.png`)
1085
1198
  * @returns {string | null}
1086
1199
  */
@@ -1091,18 +1204,27 @@ export function lookAtPictures(files) {
1091
1204
  files.find(f => path.basename(f) === `${name}-dark.png`);
1092
1205
  const preview = one('preview');
1093
1206
  const open = one(`sheet-${OPEN_SECTION}`);
1094
- if (!preview && !open) return null;
1207
+ const families = FAMILY_SECTIONS.map(g => one(`sheet-${g}`)).filter(
1208
+ f => f != null,
1209
+ );
1210
+ if (!preview && !open && !families.length) return null;
1095
1211
  const dark =
1096
1212
  files.some(f => /-dark\.png$/.test(f)) &&
1097
1213
  files.some(f => /(?<!-dark)\.png$/.test(f));
1098
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
+ : []),
1099
1219
  ...(preview
1100
1220
  ? [
1101
1221
  `${preview} (the sample page, a tooltip, a menu and a list drawn open below it)`,
1102
1222
  ]
1103
1223
  : []),
1104
1224
  ...(open
1105
- ? [`${open} (every menu, tooltip, popover and list, drawn 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
+ ]
1106
1228
  : []),
1107
1229
  ].join(' and ')}${dark ? '; the -dark pictures show the dark mode' : ''}`;
1108
1230
  }
@@ -1137,6 +1259,83 @@ export async function openStatesPage(ctx, slug, data) {
1137
1259
  return {html, png};
1138
1260
  }
1139
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
+
1140
1339
  /**
1141
1340
  * Previews after a change: the sample page always; on request, pictures of
1142
1341
  * it and of the open states ({@link openStatesPage}).
@@ -1177,8 +1376,13 @@ export async function previewAfter(ctx, slug, data, png) {
1177
1376
  : `checking it failed: ${e instanceof Error ? e.message : String(e)}`;
1178
1377
  }
1179
1378
  const f = themeFiles(ctx.project.cwd, slug);
1180
- /** The pages photographed: the sample page, and with it the open states. */
1181
- const shotPages = [{html: f.preview, png: f.previewPng}];
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
+ ];
1182
1386
  /** Why the open states were not taken, said with the pictures. @type {string | null} */
1183
1387
  let openProblem = null;
1184
1388
  // Made before the sections are judged, so it is current, never marked.
@@ -1206,10 +1410,13 @@ export async function previewAfter(ctx, slug, data, png) {
1206
1410
  const shots =
1207
1411
  png && preview
1208
1412
  ? await pictures(ctx.project, shotPages, modesOf(data))
1209
- : {files: [], problem: null};
1413
+ : {files: [], problem: null, cutShort: []};
1210
1414
  return {
1211
1415
  preview,
1212
1416
  pictures: shots.files,
1417
+ // Text the sample page's pictures draw cut short: a note and a problem
1418
+ // of the change.
1419
+ cutShort: shots.cutShort,
1213
1420
  pictureProblem:
1214
1421
  [openProblem, shots.problem].filter(Boolean).join('; ') || null,
1215
1422
  notChecked: notChecked(cause),
@@ -247,6 +247,10 @@ export function matchType(type, value) {
247
247
  */
248
248
  function matchWith(value, match) {
249
249
  const {lexer, parse} = csstree();
250
+ // css-tree's lexer forgives a last word ending in an old browser hack's
251
+ // escape (`8px\9`, `none\0`); a browser reads the escape as part of the
252
+ // word (a unit `px` and a tab), so it drops the value.
253
+ if (/\\[09]\s*$/.test(value)) return null;
250
254
  // A color function holding a variable (color-mix(…, var(--x))) is a
251
255
  // color whatever the variable holds: it is matched as one, so a value
252
256
  // with many of them is read like the same value with plain colors.