@maggioli-design-system/magma 2.10.0 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (502) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +21 -0
  3. package/README.md +7 -3
  4. package/agents/assets.md +1 -1
  5. package/agents/color.md +2 -2
  6. package/agents/mcp.md +1 -1
  7. package/agents/patterns/previews/actions/banner.dark.webp +0 -0
  8. package/agents/patterns/previews/actions/banner.light.webp +0 -0
  9. package/agents/patterns/previews/actions/confirm.dark.webp +0 -0
  10. package/agents/patterns/previews/actions/confirm.light.webp +0 -0
  11. package/agents/patterns/previews/actions/danger-zone.dark.webp +0 -0
  12. package/agents/patterns/previews/actions/danger-zone.light.webp +0 -0
  13. package/agents/patterns/previews/actions/destructive-in-menu.dark.webp +0 -0
  14. package/agents/patterns/previews/actions/destructive-in-menu.light.webp +0 -0
  15. package/agents/patterns/previews/actions/dismiss-message.dark.webp +0 -0
  16. package/agents/patterns/previews/actions/dismiss-message.light.webp +0 -0
  17. package/agents/patterns/previews/actions/dismiss.dark.webp +0 -0
  18. package/agents/patterns/previews/actions/dismiss.light.webp +0 -0
  19. package/agents/patterns/previews/actions/more-in-menu.dark.webp +0 -0
  20. package/agents/patterns/previews/actions/more-in-menu.light.webp +0 -0
  21. package/agents/patterns/previews/actions/part-primary.dark.webp +0 -0
  22. package/agents/patterns/previews/actions/part-primary.light.webp +0 -0
  23. package/agents/patterns/previews/actions/primary.dark.webp +0 -0
  24. package/agents/patterns/previews/actions/primary.light.webp +0 -0
  25. package/agents/patterns/previews/actions/remove.dark.webp +0 -0
  26. package/agents/patterns/previews/actions/remove.light.webp +0 -0
  27. package/agents/patterns/previews/actions/secondary.dark.webp +0 -0
  28. package/agents/patterns/previews/actions/secondary.light.webp +0 -0
  29. package/agents/patterns/previews/actions/stacked.dark.webp +0 -0
  30. package/agents/patterns/previews/actions/stacked.light.webp +0 -0
  31. package/agents/patterns/previews/actions/toast.dark.webp +0 -0
  32. package/agents/patterns/previews/actions/toast.light.webp +0 -0
  33. package/agents/patterns/previews/app-shell/back-office.dark.webp +0 -0
  34. package/agents/patterns/previews/app-shell/back-office.light.webp +0 -0
  35. package/agents/patterns/previews/app-shell/many-sections.dark.webp +0 -0
  36. package/agents/patterns/previews/app-shell/many-sections.light.webp +0 -0
  37. package/agents/patterns/previews/app-shell/public-service.dark.webp +0 -0
  38. package/agents/patterns/previews/app-shell/public-service.light.webp +0 -0
  39. package/agents/patterns/previews/confirm-action/act-then-undo.dark.webp +0 -0
  40. package/agents/patterns/previews/confirm-action/act-then-undo.light.webp +0 -0
  41. package/agents/patterns/previews/confirm-action/ask-before-sending.dark.webp +0 -0
  42. package/agents/patterns/previews/confirm-action/ask-before-sending.light.webp +0 -0
  43. package/agents/patterns/previews/confirm-action/ask-first-many.dark.webp +0 -0
  44. package/agents/patterns/previews/confirm-action/ask-first-many.light.webp +0 -0
  45. package/agents/patterns/previews/confirm-action/ask-first.dark.webp +0 -0
  46. package/agents/patterns/previews/confirm-action/ask-first.light.webp +0 -0
  47. package/agents/patterns/previews/confirm-action/make-reversible.dark.webp +0 -0
  48. package/agents/patterns/previews/confirm-action/make-reversible.light.webp +0 -0
  49. package/agents/patterns/previews/confirm-action/send-as-shown.dark.webp +0 -0
  50. package/agents/patterns/previews/confirm-action/send-as-shown.light.webp +0 -0
  51. package/agents/patterns/previews/empty-state/add-the-first.dark.webp +0 -0
  52. package/agents/patterns/previews/empty-state/add-the-first.light.webp +0 -0
  53. package/agents/patterns/previews/empty-state/all-done.dark.webp +0 -0
  54. package/agents/patterns/previews/empty-state/all-done.light.webp +0 -0
  55. package/agents/patterns/previews/empty-state/clear-filters.dark.webp +0 -0
  56. package/agents/patterns/previews/empty-state/clear-filters.light.webp +0 -0
  57. package/agents/patterns/previews/empty-state/filled-by-others.dark.webp +0 -0
  58. package/agents/patterns/previews/empty-state/filled-by-others.light.webp +0 -0
  59. package/agents/patterns/previews/empty-state/not-found.dark.webp +0 -0
  60. package/agents/patterns/previews/empty-state/not-found.light.webp +0 -0
  61. package/agents/patterns/previews/empty-state/one-line.dark.webp +0 -0
  62. package/agents/patterns/previews/empty-state/one-line.light.webp +0 -0
  63. package/agents/patterns/previews/error-recovery/action-another-way.dark.webp +0 -0
  64. package/agents/patterns/previews/error-recovery/action-another-way.light.webp +0 -0
  65. package/agents/patterns/previews/error-recovery/changed-meanwhile.dark.webp +0 -0
  66. package/agents/patterns/previews/error-recovery/changed-meanwhile.light.webp +0 -0
  67. package/agents/patterns/previews/error-recovery/check-or-repeat.dark.webp +0 -0
  68. package/agents/patterns/previews/error-recovery/check-or-repeat.light.webp +0 -0
  69. package/agents/patterns/previews/error-recovery/content-another-way.dark.webp +0 -0
  70. package/agents/patterns/previews/error-recovery/content-another-way.light.webp +0 -0
  71. package/agents/patterns/previews/error-recovery/partial.dark.webp +0 -0
  72. package/agents/patterns/previews/error-recovery/partial.light.webp +0 -0
  73. package/agents/patterns/previews/error-recovery/retry-action.dark.webp +0 -0
  74. package/agents/patterns/previews/error-recovery/retry-action.light.webp +0 -0
  75. package/agents/patterns/previews/error-recovery/retry-content.dark.webp +0 -0
  76. package/agents/patterns/previews/error-recovery/retry-content.light.webp +0 -0
  77. package/agents/patterns/previews/error-recovery/sign-in-again.dark.webp +0 -0
  78. package/agents/patterns/previews/error-recovery/sign-in-again.light.webp +0 -0
  79. package/agents/patterns/previews/item-list/documents-of-a-request.dark.webp +0 -0
  80. package/agents/patterns/previews/item-list/documents-of-a-request.light.webp +0 -0
  81. package/agents/patterns/previews/item-list/queue-of-a-desk.dark.webp +0 -0
  82. package/agents/patterns/previews/item-list/queue-of-a-desk.light.webp +0 -0
  83. package/agents/patterns/previews/item-list/requests-of-an-office.dark.webp +0 -0
  84. package/agents/patterns/previews/item-list/requests-of-an-office.light.webp +0 -0
  85. package/agents/patterns/previews/item-list/requests-to-assign.dark.webp +0 -0
  86. package/agents/patterns/previews/item-list/requests-to-assign.light.webp +0 -0
  87. package/agents/patterns/previews/labels-and-values/data-of-a-contact.dark.webp +0 -0
  88. package/agents/patterns/previews/labels-and-values/data-of-a-contact.light.webp +0 -0
  89. package/agents/patterns/previews/labels-and-values/payment-before-paying.dark.webp +0 -0
  90. package/agents/patterns/previews/labels-and-values/payment-before-paying.light.webp +0 -0
  91. package/agents/patterns/previews/labels-and-values/what-is-sent.dark.webp +0 -0
  92. package/agents/patterns/previews/labels-and-values/what-is-sent.light.webp +0 -0
  93. package/agents/patterns/previews/list-with-filters/act-on-many.dark.webp +0 -0
  94. package/agents/patterns/previews/list-with-filters/act-on-many.light.webp +0 -0
  95. package/agents/patterns/previews/list-with-filters/find-and-open.dark.webp +0 -0
  96. package/agents/patterns/previews/list-with-filters/find-and-open.light.webp +0 -0
  97. package/agents/patterns/previews/list-with-filters/show-new-items.dark.webp +0 -0
  98. package/agents/patterns/previews/list-with-filters/show-new-items.light.webp +0 -0
  99. package/agents/patterns/previews/loading/await-and-say.dark.webp +0 -0
  100. package/agents/patterns/previews/loading/await-and-say.light.webp +0 -0
  101. package/agents/patterns/previews/loading/await-the-control.dark.webp +0 -0
  102. package/agents/patterns/previews/loading/await-the-control.light.webp +0 -0
  103. package/agents/patterns/previews/loading/first-load.dark.webp +0 -0
  104. package/agents/patterns/previews/loading/first-load.light.webp +0 -0
  105. package/agents/patterns/previews/loading/keep-while-reloading.dark.webp +0 -0
  106. package/agents/patterns/previews/loading/keep-while-reloading.light.webp +0 -0
  107. package/agents/patterns/previews/loading/long-load-measured.dark.webp +0 -0
  108. package/agents/patterns/previews/loading/long-load-measured.light.webp +0 -0
  109. package/agents/patterns/previews/loading/long-load.dark.webp +0 -0
  110. package/agents/patterns/previews/loading/long-load.light.webp +0 -0
  111. package/agents/patterns/previews/loading/progress-in-place.dark.webp +0 -0
  112. package/agents/patterns/previews/loading/progress-in-place.light.webp +0 -0
  113. package/agents/patterns/previews/loading/run-in-background.dark.webp +0 -0
  114. package/agents/patterns/previews/loading/run-in-background.light.webp +0 -0
  115. package/agents/patterns/previews/message-placement/action-done-elsewhere.dark.webp +0 -0
  116. package/agents/patterns/previews/message-placement/action-done-elsewhere.light.webp +0 -0
  117. package/agents/patterns/previews/message-placement/action-done-in-page.dark.webp +0 -0
  118. package/agents/patterns/previews/message-placement/action-done-in-page.light.webp +0 -0
  119. package/agents/patterns/previews/message-placement/action-done-in-part.dark.webp +0 -0
  120. package/agents/patterns/previews/message-placement/action-done-in-part.light.webp +0 -0
  121. package/agents/patterns/previews/message-placement/action-failed-elsewhere.dark.webp +0 -0
  122. package/agents/patterns/previews/message-placement/action-failed-elsewhere.light.webp +0 -0
  123. package/agents/patterns/previews/message-placement/action-failed-in-place.dark.webp +0 -0
  124. package/agents/patterns/previews/message-placement/action-failed-in-place.light.webp +0 -0
  125. package/agents/patterns/previews/message-placement/action-later.dark.webp +0 -0
  126. package/agents/patterns/previews/message-placement/action-later.light.webp +0 -0
  127. package/agents/patterns/previews/message-placement/action-partial-elsewhere.dark.webp +0 -0
  128. package/agents/patterns/previews/message-placement/action-partial-elsewhere.light.webp +0 -0
  129. package/agents/patterns/previews/message-placement/action-partial-in-place.dark.webp +0 -0
  130. package/agents/patterns/previews/message-placement/action-partial-in-place.light.webp +0 -0
  131. package/agents/patterns/previews/message-placement/action-taken.dark.webp +0 -0
  132. package/agents/patterns/previews/message-placement/action-taken.light.webp +0 -0
  133. package/agents/patterns/previews/message-placement/app-deadline.dark.webp +0 -0
  134. package/agents/patterns/previews/message-placement/app-deadline.light.webp +0 -0
  135. package/agents/patterns/previews/message-placement/app-failed.dark.webp +0 -0
  136. package/agents/patterns/previews/message-placement/app-failed.light.webp +0 -0
  137. package/agents/patterns/previews/message-placement/app-info.dark.webp +0 -0
  138. package/agents/patterns/previews/message-placement/app-info.light.webp +0 -0
  139. package/agents/patterns/previews/message-placement/decision.dark.webp +0 -0
  140. package/agents/patterns/previews/message-placement/decision.light.webp +0 -0
  141. package/agents/patterns/previews/message-placement/field-error.dark.webp +0 -0
  142. package/agents/patterns/previews/message-placement/field-error.light.webp +0 -0
  143. package/agents/patterns/previews/message-placement/field-hint.dark.webp +0 -0
  144. package/agents/patterns/previews/message-placement/field-hint.light.webp +0 -0
  145. package/agents/patterns/previews/message-placement/field-valid.dark.webp +0 -0
  146. package/agents/patterns/previews/message-placement/field-valid.light.webp +0 -0
  147. package/agents/patterns/previews/message-placement/region-failed.dark.webp +0 -0
  148. package/agents/patterns/previews/message-placement/region-failed.light.webp +0 -0
  149. package/agents/patterns/previews/message-placement/region-info.dark.webp +0 -0
  150. package/agents/patterns/previews/message-placement/region-info.light.webp +0 -0
  151. package/agents/patterns/previews/page-header/contact-being-edited.dark.webp +0 -0
  152. package/agents/patterns/previews/page-header/contact-being-edited.light.webp +0 -0
  153. package/agents/patterns/previews/page-header/members-of-a-group.dark.webp +0 -0
  154. package/agents/patterns/previews/page-header/members-of-a-group.light.webp +0 -0
  155. package/agents/patterns/previews/page-header/own-profile.dark.webp +0 -0
  156. package/agents/patterns/previews/page-header/own-profile.light.webp +0 -0
  157. package/agents/patterns/previews/page-header/request-from-the-list.dark.webp +0 -0
  158. package/agents/patterns/previews/page-header/request-from-the-list.light.webp +0 -0
  159. package/agents/patterns/previews/page-header/requests-of-an-office.dark.webp +0 -0
  160. package/agents/patterns/previews/page-header/requests-of-an-office.light.webp +0 -0
  161. package/agents/patterns/previews/record-detail/ask-for-words.dark.webp +0 -0
  162. package/agents/patterns/previews/record-detail/ask-for-words.light.webp +0 -0
  163. package/agents/patterns/previews/record-detail/edit-data.dark.webp +0 -0
  164. package/agents/patterns/previews/record-detail/edit-data.light.webp +0 -0
  165. package/agents/patterns/previews/record-detail/read-the-data.dark.webp +0 -0
  166. package/agents/patterns/previews/record-detail/read-the-data.light.webp +0 -0
  167. package/agents/patterns/previews/record-detail/record-changed.dark.webp +0 -0
  168. package/agents/patterns/previews/record-detail/record-changed.light.webp +0 -0
  169. package/agents/patterns/previews/record-detail/run-at-once.dark.webp +0 -0
  170. package/agents/patterns/previews/record-detail/run-at-once.light.webp +0 -0
  171. package/agents/patterns/previews/record-detail/work-on-it.dark.webp +0 -0
  172. package/agents/patterns/previews/record-detail/work-on-it.light.webp +0 -0
  173. package/agents/patterns/previews/rhythm/between-containers.dark.webp +0 -0
  174. package/agents/patterns/previews/rhythm/between-containers.light.webp +0 -0
  175. package/agents/patterns/previews/rhythm/between-fields.dark.webp +0 -0
  176. package/agents/patterns/previews/rhythm/between-fields.light.webp +0 -0
  177. package/agents/patterns/previews/rhythm/between-groups.dark.webp +0 -0
  178. package/agents/patterns/previews/rhythm/between-groups.light.webp +0 -0
  179. package/agents/patterns/previews/rhythm/between-sections.dark.webp +0 -0
  180. package/agents/patterns/previews/rhythm/between-sections.light.webp +0 -0
  181. package/agents/patterns/previews/rhythm/content-actions.dark.webp +0 -0
  182. package/agents/patterns/previews/rhythm/content-actions.light.webp +0 -0
  183. package/agents/patterns/previews/rhythm/inline.dark.webp +0 -0
  184. package/agents/patterns/previews/rhythm/inline.light.webp +0 -0
  185. package/agents/patterns/previews/rhythm/inset.dark.webp +0 -0
  186. package/agents/patterns/previews/rhythm/inset.light.webp +0 -0
  187. package/agents/patterns/previews/rhythm/label-control.dark.webp +0 -0
  188. package/agents/patterns/previews/rhythm/label-control.light.webp +0 -0
  189. package/agents/patterns/previews/rhythm/title-content.dark.webp +0 -0
  190. package/agents/patterns/previews/rhythm/title-content.light.webp +0 -0
  191. package/agents/patterns/previews/surfaces/band.dark.webp +0 -0
  192. package/agents/patterns/previews/surfaces/band.light.webp +0 -0
  193. package/agents/patterns/previews/surfaces/canvas.dark.webp +0 -0
  194. package/agents/patterns/previews/surfaces/canvas.light.webp +0 -0
  195. package/agents/patterns/previews/surfaces/card.dark.webp +0 -0
  196. package/agents/patterns/previews/surfaces/card.light.webp +0 -0
  197. package/agents/patterns/previews/surfaces/dialog.dark.webp +0 -0
  198. package/agents/patterns/previews/surfaces/dialog.light.webp +0 -0
  199. package/agents/patterns/previews/surfaces/edit-actions.dark.webp +0 -0
  200. package/agents/patterns/previews/surfaces/edit-actions.light.webp +0 -0
  201. package/agents/patterns/previews/surfaces/section.dark.webp +0 -0
  202. package/agents/patterns/previews/surfaces/section.light.webp +0 -0
  203. package/agents/patterns/previews/titles/dialog.dark.webp +0 -0
  204. package/agents/patterns/previews/titles/dialog.light.webp +0 -0
  205. package/agents/patterns/previews/titles/group.dark.webp +0 -0
  206. package/agents/patterns/previews/titles/group.light.webp +0 -0
  207. package/agents/patterns/previews/titles/page.dark.webp +0 -0
  208. package/agents/patterns/previews/titles/page.light.webp +0 -0
  209. package/agents/patterns/previews/titles/part.dark.webp +0 -0
  210. package/agents/patterns/previews/titles/part.light.webp +0 -0
  211. package/agents/patterns/previews/titles/section.dark.webp +0 -0
  212. package/agents/patterns/previews/titles/section.light.webp +0 -0
  213. package/agents/patterns/previews/widths/dialog.dark.webp +0 -0
  214. package/agents/patterns/previews/widths/dialog.light.webp +0 -0
  215. package/agents/patterns/previews/widths/field.dark.webp +0 -0
  216. package/agents/patterns/previews/widths/field.light.webp +0 -0
  217. package/agents/patterns/previews/widths/form.dark.webp +0 -0
  218. package/agents/patterns/previews/widths/form.light.webp +0 -0
  219. package/agents/patterns/previews/widths/page.dark.webp +0 -0
  220. package/agents/patterns/previews/widths/page.light.webp +0 -0
  221. package/agents/patterns/previews/widths/reading.dark.webp +0 -0
  222. package/agents/patterns/previews/widths/reading.light.webp +0 -0
  223. package/agents/theming.md +14 -9
  224. package/dist/cjs/mds-emoji.cjs.entry.js +39 -10
  225. package/dist/cjs/mds-pref-theme-item.cjs.entry.js +18 -4
  226. package/dist/cjs/mds-pref-theme.cjs.entry.js +12 -3
  227. package/dist/collection/components/mds-accordion/AGENTS.md +1 -1
  228. package/dist/collection/components/mds-accordion/documentation.json +1 -1
  229. package/dist/collection/components/mds-accordion-item/AGENTS.md +1 -1
  230. package/dist/collection/components/mds-accordion-item/documentation.json +1 -1
  231. package/dist/collection/components/mds-accordion-timer/AGENTS.md +1 -1
  232. package/dist/collection/components/mds-accordion-timer/documentation.json +1 -1
  233. package/dist/collection/components/mds-accordion-timer-item/AGENTS.md +1 -1
  234. package/dist/collection/components/mds-accordion-timer-item/documentation.json +1 -1
  235. package/dist/collection/components/mds-author/AGENTS.md +1 -1
  236. package/dist/collection/components/mds-author/documentation.json +1 -1
  237. package/dist/collection/components/mds-avatar/AGENTS.md +1 -1
  238. package/dist/collection/components/mds-avatar/documentation.json +1 -1
  239. package/dist/collection/components/mds-avatar-stack/AGENTS.md +1 -1
  240. package/dist/collection/components/mds-avatar-stack/documentation.json +1 -1
  241. package/dist/collection/components/mds-avatar-stack-item/AGENTS.md +1 -1
  242. package/dist/collection/components/mds-avatar-stack-item/documentation.json +1 -1
  243. package/dist/collection/components/mds-badge/AGENTS.md +1 -1
  244. package/dist/collection/components/mds-badge/documentation.json +1 -1
  245. package/dist/collection/components/mds-banner/AGENTS.md +1 -1
  246. package/dist/collection/components/mds-banner/documentation.json +1 -1
  247. package/dist/collection/components/mds-benchmark-bar/AGENTS.md +1 -1
  248. package/dist/collection/components/mds-benchmark-bar/documentation.json +1 -1
  249. package/dist/collection/components/mds-bibliography/AGENTS.md +1 -1
  250. package/dist/collection/components/mds-bibliography/documentation.json +1 -1
  251. package/dist/collection/components/mds-book/AGENTS.md +1 -1
  252. package/dist/collection/components/mds-book/documentation.json +1 -1
  253. package/dist/collection/components/mds-breadcrumb/AGENTS.md +1 -1
  254. package/dist/collection/components/mds-breadcrumb/documentation.json +1 -1
  255. package/dist/collection/components/mds-breadcrumb-item/AGENTS.md +1 -1
  256. package/dist/collection/components/mds-breadcrumb-item/documentation.json +1 -1
  257. package/dist/collection/components/mds-button/AGENTS.md +1 -1
  258. package/dist/collection/components/mds-button/documentation.json +1 -1
  259. package/dist/collection/components/mds-button-dropdown/AGENTS.md +1 -1
  260. package/dist/collection/components/mds-button-dropdown/documentation.json +1 -1
  261. package/dist/collection/components/mds-button-group/AGENTS.md +1 -1
  262. package/dist/collection/components/mds-button-group/documentation.json +1 -1
  263. package/dist/collection/components/mds-calendar/AGENTS.md +1 -1
  264. package/dist/collection/components/mds-calendar/documentation.json +1 -1
  265. package/dist/collection/components/mds-calendar-cell/AGENTS.md +1 -1
  266. package/dist/collection/components/mds-calendar-cell/documentation.json +1 -1
  267. package/dist/collection/components/mds-card/AGENTS.md +1 -1
  268. package/dist/collection/components/mds-card/documentation.json +1 -1
  269. package/dist/collection/components/mds-card-content/AGENTS.md +1 -1
  270. package/dist/collection/components/mds-card-content/documentation.json +1 -1
  271. package/dist/collection/components/mds-card-footer/AGENTS.md +1 -1
  272. package/dist/collection/components/mds-card-footer/documentation.json +1 -1
  273. package/dist/collection/components/mds-card-header/AGENTS.md +1 -1
  274. package/dist/collection/components/mds-card-header/documentation.json +1 -1
  275. package/dist/collection/components/mds-card-media/AGENTS.md +1 -1
  276. package/dist/collection/components/mds-card-media/documentation.json +1 -1
  277. package/dist/collection/components/mds-chip/AGENTS.md +1 -1
  278. package/dist/collection/components/mds-chip/documentation.json +1 -1
  279. package/dist/collection/components/mds-details/AGENTS.md +1 -1
  280. package/dist/collection/components/mds-details/documentation.json +1 -1
  281. package/dist/collection/components/mds-dropdown/AGENTS.md +1 -1
  282. package/dist/collection/components/mds-dropdown/documentation.json +1 -1
  283. package/dist/collection/components/mds-emoji/AGENTS.md +1 -1
  284. package/dist/collection/components/mds-emoji/documentation.json +1 -1
  285. package/dist/collection/components/mds-entity/AGENTS.md +1 -1
  286. package/dist/collection/components/mds-entity/documentation.json +1 -1
  287. package/dist/collection/components/mds-file/AGENTS.md +1 -1
  288. package/dist/collection/components/mds-file/documentation.json +1 -1
  289. package/dist/collection/components/mds-file-preview/AGENTS.md +1 -1
  290. package/dist/collection/components/mds-file-preview/documentation.json +1 -1
  291. package/dist/collection/components/mds-filter/AGENTS.md +1 -1
  292. package/dist/collection/components/mds-filter/documentation.json +1 -1
  293. package/dist/collection/components/mds-filter-item/AGENTS.md +1 -1
  294. package/dist/collection/components/mds-filter-item/documentation.json +1 -1
  295. package/dist/collection/components/mds-header/AGENTS.md +1 -1
  296. package/dist/collection/components/mds-header/documentation.json +1 -1
  297. package/dist/collection/components/mds-header-bar/AGENTS.md +1 -1
  298. package/dist/collection/components/mds-header-bar/documentation.json +1 -1
  299. package/dist/collection/components/mds-help/AGENTS.md +1 -1
  300. package/dist/collection/components/mds-help/documentation.json +1 -1
  301. package/dist/collection/components/mds-horizontal-scroll/AGENTS.md +1 -1
  302. package/dist/collection/components/mds-horizontal-scroll/documentation.json +1 -1
  303. package/dist/collection/components/mds-hr/AGENTS.md +1 -1
  304. package/dist/collection/components/mds-hr/documentation.json +1 -1
  305. package/dist/collection/components/mds-icon/AGENTS.md +1 -1
  306. package/dist/collection/components/mds-icon/documentation.json +1 -1
  307. package/dist/collection/components/mds-img/AGENTS.md +1 -1
  308. package/dist/collection/components/mds-img/documentation.json +1 -1
  309. package/dist/collection/components/mds-input/AGENTS.md +1 -1
  310. package/dist/collection/components/mds-input/documentation.json +1 -1
  311. package/dist/collection/components/mds-input-date/AGENTS.md +1 -1
  312. package/dist/collection/components/mds-input-date/documentation.json +1 -1
  313. package/dist/collection/components/mds-input-date-range/AGENTS.md +1 -1
  314. package/dist/collection/components/mds-input-date-range/documentation.json +1 -1
  315. package/dist/collection/components/mds-input-date-range-preselection/AGENTS.md +1 -1
  316. package/dist/collection/components/mds-input-date-range-preselection/documentation.json +1 -1
  317. package/dist/collection/components/mds-input-field/AGENTS.md +1 -1
  318. package/dist/collection/components/mds-input-field/documentation.json +1 -1
  319. package/dist/collection/components/mds-input-otp/AGENTS.md +1 -1
  320. package/dist/collection/components/mds-input-otp/documentation.json +1 -1
  321. package/dist/collection/components/mds-input-range/AGENTS.md +1 -1
  322. package/dist/collection/components/mds-input-range/documentation.json +1 -1
  323. package/dist/collection/components/mds-input-select/AGENTS.md +1 -1
  324. package/dist/collection/components/mds-input-select/documentation.json +1 -1
  325. package/dist/collection/components/mds-input-switch/AGENTS.md +1 -1
  326. package/dist/collection/components/mds-input-switch/documentation.json +1 -1
  327. package/dist/collection/components/mds-input-tip/AGENTS.md +1 -1
  328. package/dist/collection/components/mds-input-tip/documentation.json +1 -1
  329. package/dist/collection/components/mds-input-tip-item/AGENTS.md +1 -1
  330. package/dist/collection/components/mds-input-tip-item/documentation.json +1 -1
  331. package/dist/collection/components/mds-input-upload/AGENTS.md +1 -1
  332. package/dist/collection/components/mds-input-upload/documentation.json +1 -1
  333. package/dist/collection/components/mds-keyboard/AGENTS.md +1 -1
  334. package/dist/collection/components/mds-keyboard/documentation.json +1 -1
  335. package/dist/collection/components/mds-keyboard-key/AGENTS.md +1 -1
  336. package/dist/collection/components/mds-keyboard-key/documentation.json +1 -1
  337. package/dist/collection/components/mds-kpi/AGENTS.md +1 -1
  338. package/dist/collection/components/mds-kpi/documentation.json +1 -1
  339. package/dist/collection/components/mds-kpi-item/AGENTS.md +1 -1
  340. package/dist/collection/components/mds-kpi-item/documentation.json +1 -1
  341. package/dist/collection/components/mds-label/AGENTS.md +1 -1
  342. package/dist/collection/components/mds-label/documentation.json +1 -1
  343. package/dist/collection/components/mds-link/AGENTS.md +1 -1
  344. package/dist/collection/components/mds-link/documentation.json +1 -1
  345. package/dist/collection/components/mds-list/AGENTS.md +1 -1
  346. package/dist/collection/components/mds-list/documentation.json +1 -1
  347. package/dist/collection/components/mds-list-item/AGENTS.md +1 -1
  348. package/dist/collection/components/mds-list-item/documentation.json +1 -1
  349. package/dist/collection/components/mds-mention/AGENTS.md +1 -1
  350. package/dist/collection/components/mds-mention/documentation.json +1 -1
  351. package/dist/collection/components/mds-modal/AGENTS.md +1 -1
  352. package/dist/collection/components/mds-modal/documentation.json +1 -1
  353. package/dist/collection/components/mds-note/AGENTS.md +1 -1
  354. package/dist/collection/components/mds-note/documentation.json +1 -1
  355. package/dist/collection/components/mds-notification/AGENTS.md +1 -1
  356. package/dist/collection/components/mds-notification/documentation.json +1 -1
  357. package/dist/collection/components/mds-paginator/AGENTS.md +1 -1
  358. package/dist/collection/components/mds-paginator/documentation.json +1 -1
  359. package/dist/collection/components/mds-paginator-item/AGENTS.md +1 -1
  360. package/dist/collection/components/mds-paginator-item/documentation.json +1 -1
  361. package/dist/collection/components/mds-policy-ai/AGENTS.md +1 -1
  362. package/dist/collection/components/mds-policy-ai/documentation.json +1 -1
  363. package/dist/collection/components/mds-pref/AGENTS.md +1 -1
  364. package/dist/collection/components/mds-pref/documentation.json +1 -1
  365. package/dist/collection/components/mds-pref-animation/AGENTS.md +1 -1
  366. package/dist/collection/components/mds-pref-animation/documentation.json +1 -1
  367. package/dist/collection/components/mds-pref-consumption/AGENTS.md +1 -1
  368. package/dist/collection/components/mds-pref-consumption/documentation.json +1 -1
  369. package/dist/collection/components/mds-pref-contrast/AGENTS.md +1 -1
  370. package/dist/collection/components/mds-pref-contrast/documentation.json +1 -1
  371. package/dist/collection/components/mds-pref-language/AGENTS.md +1 -1
  372. package/dist/collection/components/mds-pref-language/documentation.json +1 -1
  373. package/dist/collection/components/mds-pref-language-item/AGENTS.md +1 -1
  374. package/dist/collection/components/mds-pref-language-item/documentation.json +1 -1
  375. package/dist/collection/components/mds-pref-mode/AGENTS.md +1 -1
  376. package/dist/collection/components/mds-pref-mode/documentation.json +1 -1
  377. package/dist/collection/components/mds-pref-theme/AGENTS.md +2 -2
  378. package/dist/collection/components/mds-pref-theme/documentation.json +4 -4
  379. package/dist/collection/components/mds-pref-theme/examples.md +17 -20
  380. package/dist/collection/components/mds-pref-theme/mds-pref-theme.js +12 -3
  381. package/dist/collection/components/mds-pref-theme/mistakes.md +14 -14
  382. package/dist/collection/components/mds-pref-theme-item/AGENTS.md +5 -5
  383. package/dist/collection/components/mds-pref-theme-item/documentation.json +8 -8
  384. package/dist/collection/components/mds-pref-theme-item/examples.md +18 -24
  385. package/dist/collection/components/mds-pref-theme-item/mds-pref-theme-item.css +13 -7
  386. package/dist/collection/components/mds-pref-theme-item/mds-pref-theme-item.js +19 -5
  387. package/dist/collection/components/mds-pref-theme-item/mistakes.md +14 -16
  388. package/dist/collection/components/mds-price-table/AGENTS.md +1 -1
  389. package/dist/collection/components/mds-price-table/documentation.json +1 -1
  390. package/dist/collection/components/mds-price-table-features/AGENTS.md +1 -1
  391. package/dist/collection/components/mds-price-table-features/documentation.json +1 -1
  392. package/dist/collection/components/mds-price-table-features-cell/AGENTS.md +1 -1
  393. package/dist/collection/components/mds-price-table-features-cell/documentation.json +1 -1
  394. package/dist/collection/components/mds-price-table-features-row/AGENTS.md +1 -1
  395. package/dist/collection/components/mds-price-table-features-row/documentation.json +1 -1
  396. package/dist/collection/components/mds-price-table-header/AGENTS.md +1 -1
  397. package/dist/collection/components/mds-price-table-header/documentation.json +1 -1
  398. package/dist/collection/components/mds-price-table-list/AGENTS.md +1 -1
  399. package/dist/collection/components/mds-price-table-list/documentation.json +1 -1
  400. package/dist/collection/components/mds-price-table-list-item/AGENTS.md +1 -1
  401. package/dist/collection/components/mds-price-table-list-item/documentation.json +1 -1
  402. package/dist/collection/components/mds-progress/AGENTS.md +1 -1
  403. package/dist/collection/components/mds-progress/documentation.json +1 -1
  404. package/dist/collection/components/mds-push-notification/AGENTS.md +1 -1
  405. package/dist/collection/components/mds-push-notification/documentation.json +1 -1
  406. package/dist/collection/components/mds-push-notification-item/AGENTS.md +1 -1
  407. package/dist/collection/components/mds-push-notification-item/documentation.json +1 -1
  408. package/dist/collection/components/mds-quote/AGENTS.md +1 -1
  409. package/dist/collection/components/mds-quote/documentation.json +1 -1
  410. package/dist/collection/components/mds-radial-menu/AGENTS.md +1 -1
  411. package/dist/collection/components/mds-radial-menu/documentation.json +1 -1
  412. package/dist/collection/components/mds-radial-menu-item/AGENTS.md +1 -1
  413. package/dist/collection/components/mds-radial-menu-item/documentation.json +1 -1
  414. package/dist/collection/components/mds-radial-progress/AGENTS.md +1 -1
  415. package/dist/collection/components/mds-radial-progress/documentation.json +1 -1
  416. package/dist/collection/components/mds-separator/AGENTS.md +1 -1
  417. package/dist/collection/components/mds-separator/documentation.json +1 -1
  418. package/dist/collection/components/mds-spinner/AGENTS.md +1 -1
  419. package/dist/collection/components/mds-spinner/documentation.json +1 -1
  420. package/dist/collection/components/mds-status-bar/AGENTS.md +1 -1
  421. package/dist/collection/components/mds-status-bar/documentation.json +1 -1
  422. package/dist/collection/components/mds-stepper-bar/AGENTS.md +1 -1
  423. package/dist/collection/components/mds-stepper-bar/documentation.json +1 -1
  424. package/dist/collection/components/mds-stepper-bar-item/AGENTS.md +1 -1
  425. package/dist/collection/components/mds-stepper-bar-item/documentation.json +1 -1
  426. package/dist/collection/components/mds-tab/AGENTS.md +1 -1
  427. package/dist/collection/components/mds-tab/documentation.json +1 -1
  428. package/dist/collection/components/mds-tab-bar/AGENTS.md +1 -1
  429. package/dist/collection/components/mds-tab-bar/documentation.json +1 -1
  430. package/dist/collection/components/mds-tab-bar-item/AGENTS.md +1 -1
  431. package/dist/collection/components/mds-tab-bar-item/documentation.json +1 -1
  432. package/dist/collection/components/mds-tab-item/AGENTS.md +1 -1
  433. package/dist/collection/components/mds-tab-item/documentation.json +1 -1
  434. package/dist/collection/components/mds-table/AGENTS.md +1 -1
  435. package/dist/collection/components/mds-table/documentation.json +1 -1
  436. package/dist/collection/components/mds-table-body/AGENTS.md +1 -1
  437. package/dist/collection/components/mds-table-body/documentation.json +1 -1
  438. package/dist/collection/components/mds-table-cell/AGENTS.md +1 -1
  439. package/dist/collection/components/mds-table-cell/documentation.json +1 -1
  440. package/dist/collection/components/mds-table-footer/AGENTS.md +1 -1
  441. package/dist/collection/components/mds-table-footer/documentation.json +1 -1
  442. package/dist/collection/components/mds-table-header/AGENTS.md +1 -1
  443. package/dist/collection/components/mds-table-header/documentation.json +1 -1
  444. package/dist/collection/components/mds-table-header-cell/AGENTS.md +1 -1
  445. package/dist/collection/components/mds-table-header-cell/documentation.json +1 -1
  446. package/dist/collection/components/mds-table-row/AGENTS.md +1 -1
  447. package/dist/collection/components/mds-table-row/documentation.json +1 -1
  448. package/dist/collection/components/mds-text/AGENTS.md +1 -1
  449. package/dist/collection/components/mds-text/documentation.json +1 -1
  450. package/dist/collection/components/mds-toast/AGENTS.md +1 -1
  451. package/dist/collection/components/mds-toast/documentation.json +1 -1
  452. package/dist/collection/components/mds-toast-region/AGENTS.md +1 -1
  453. package/dist/collection/components/mds-toast-region/documentation.json +1 -1
  454. package/dist/collection/components/mds-tooltip/AGENTS.md +1 -1
  455. package/dist/collection/components/mds-tooltip/documentation.json +1 -1
  456. package/dist/collection/components/mds-tree/AGENTS.md +1 -1
  457. package/dist/collection/components/mds-tree/documentation.json +1 -1
  458. package/dist/collection/components/mds-tree-item/AGENTS.md +1 -1
  459. package/dist/collection/components/mds-tree-item/documentation.json +1 -1
  460. package/dist/collection/components/mds-url-view/AGENTS.md +1 -1
  461. package/dist/collection/components/mds-url-view/documentation.json +1 -1
  462. package/dist/collection/components/mds-usage/AGENTS.md +1 -1
  463. package/dist/collection/components/mds-usage/documentation.json +1 -1
  464. package/dist/collection/components/mds-video-wall/AGENTS.md +1 -1
  465. package/dist/collection/components/mds-video-wall/documentation.json +1 -1
  466. package/dist/collection/components/mds-zero/AGENTS.md +1 -1
  467. package/dist/collection/components/mds-zero/documentation.json +1 -1
  468. package/dist/components/mds-emoji.js +3 -3
  469. package/dist/components/mds-pref-theme-item.js +1 -1
  470. package/dist/components/mds-pref-theme.js +1 -1
  471. package/dist/documentation.json +11 -11
  472. package/dist/esm/mds-emoji.entry.js +39 -10
  473. package/dist/esm/mds-pref-theme-item.entry.js +18 -4
  474. package/dist/esm/mds-pref-theme.entry.js +12 -3
  475. package/dist/esm-es5/mds-emoji.entry.js +109 -107
  476. package/dist/esm-es5/mds-pref-theme-item.entry.js +12 -5
  477. package/dist/esm-es5/mds-pref-theme.entry.js +9 -4
  478. package/dist/hydrate/index.js +69 -17
  479. package/dist/hydrate/index.mjs +69 -17
  480. package/dist/lint/core/patterns.d.ts +30 -0
  481. package/dist/lint/core/patterns.js +90 -0
  482. package/dist/lint/mcp/patterns.js +21 -11
  483. package/dist/lint/mcp/render-page.d.ts +5 -1
  484. package/dist/lint/mcp/render-page.js +17 -0
  485. package/dist/lint/mcp/render.d.ts +22 -1
  486. package/dist/lint/mcp/render.js +101 -20
  487. package/dist/lint/mcp/tools.json +2 -2
  488. package/dist/magma-components/magma-components.esm.js +1 -1
  489. package/dist/magma-components/{p-0dcde20a.system.entry.js → p-2a445b98.system.entry.js} +15 -13
  490. package/dist/magma-components/p-97c6e10a.entry.js +1 -0
  491. package/dist/magma-components/{p-4e072e24.system.entry.js → p-9e07535e.system.entry.js} +10 -5
  492. package/dist/magma-components/{p-77001a72.entry.js → p-9ef64212.entry.js} +3 -3
  493. package/dist/magma-components/p-B8zYiZQY.system.js +1 -1
  494. package/dist/magma-components/p-c915fba5.system.entry.js +21 -0
  495. package/dist/magma-components/p-cd6dd836.entry.js +1 -0
  496. package/dist/stats.json +48 -47
  497. package/dist/types/components/mds-pref-theme-item/mds-pref-theme-item.d.ts +9 -2
  498. package/dist/types/components.d.ts +4 -4
  499. package/package.json +6 -5
  500. package/dist/magma-components/p-34d58345.entry.js +0 -1
  501. package/dist/magma-components/p-52e2b0d4.system.entry.js +0 -14
  502. package/dist/magma-components/p-f3708d1a.entry.js +0 -1
@@ -1561,6 +1561,96 @@ export const previewOf = (previews, pattern, id, example = 1) => previews.find((
1561
1561
  export const examplesOf = (previews, pattern, id) => previews
1562
1562
  .filter((one) => one.pattern === pattern && one.id === id)
1563
1563
  .sort((a, b) => a.example - b.example);
1564
+ /*
1565
+ The images of the previews (#1243): in the entry package each preview has two beside it,
1566
+ <id>.light.webp and <id>.dark.webp (<id>.<n>.light.webp for an example), for the readers that
1567
+ cannot run the stage: the cards of the docs site, an agent whose client has no browser, a
1568
+ decision that cannot run live. The build of magma makes them with the render that checks the
1569
+ preview (projects/stencil/scripts/preview-images.ts), so an image never differs from its stage
1570
+ in that version; the repository keeps the stages only.
1571
+
1572
+ The maintainer's choices on #1243 (2026-11-04), from three frames rendered side by side: one
1573
+ frame for every image, a whole page included, so a gallery lines them up without cropping
1574
+ each one; 8:5, the ratio of the cards of the docs site; a layout 960 CSS pixels wide, in the
1575
+ tablet range of the Magma breakpoints (768-1023), where the bar of an app shell keeps its items
1576
+ (at 720 they collapse into the menu) and the words still read in a card 320 pixels wide (at
1577
+ 1440 they do not); 1.5 device pixels per CSS pixel, 1440 x 900 pixels, enough for a card of
1578
+ 720 CSS pixels on a screen of 2; every preview, not only the first of each pattern, since an
1579
+ agent and a decision show the case they are about; the default theme, light and dark, as the
1580
+ page around them is. The quality, 0.8 of the WebP encoder of Chrome, is measured on the same
1581
+ captures: the text at twice its size shows no difference from 0.9, and the 216 images of 2.10.0
1582
+ weigh a fifth less (about 15 KB each).
1583
+ */
1584
+ /** The frame of every image: the viewport, in CSS pixels, the device pixels per CSS pixel and the WebP quality. */
1585
+ export const PREVIEW_IMAGE = { width: 960, height: 600, scale: 1.5, quality: 0.8 };
1586
+ /** The modes an image is made in, each the mode the browser emulates. */
1587
+ export const PREVIEW_IMAGE_MODES = ['light', 'dark'];
1588
+ /**
1589
+ * The image of a preview in a mode, beside it: <id>.html -> <id>.<mode>.webp; with the folder
1590
+ * of the patterns of a package, the one in that package.
1591
+ */
1592
+ export const previewImageFile = (file, mode, patternsDir) => {
1593
+ const image = file.replace(/\.html$/, `.${mode}.webp`);
1594
+ return patternsDir
1595
+ ? path.join(patternsDir, PREVIEWS_DIR, path.basename(path.dirname(image)), path.basename(image))
1596
+ : image;
1597
+ };
1598
+ /**
1599
+ * The size of a WebP image in pixels, from the header of its first chunk (RFC 9649: the lossy
1600
+ * VP8 frame, the lossless VP8L bitstream or the extended VP8X canvas), or undefined when the
1601
+ * bytes are not WebP.
1602
+ */
1603
+ export const webpSize = (bytes) => {
1604
+ if (bytes.length < 30 ||
1605
+ bytes.toString('latin1', 0, 4) !== 'RIFF' ||
1606
+ bytes.toString('latin1', 8, 12) !== 'WEBP')
1607
+ return undefined;
1608
+ const chunk = bytes.toString('latin1', 12, 16);
1609
+ if (chunk === 'VP8 ')
1610
+ return { width: bytes.readUInt16LE(26) & 0x3fff, height: bytes.readUInt16LE(28) & 0x3fff };
1611
+ if (chunk === 'VP8L') {
1612
+ const bits = bytes.readUInt32LE(21);
1613
+ return { width: (bits & 0x3fff) + 1, height: ((bits >>> 14) & 0x3fff) + 1 };
1614
+ }
1615
+ if (chunk === 'VP8X')
1616
+ return { width: bytes.readUIntLE(24, 3) + 1, height: bytes.readUIntLE(27, 3) + 1 };
1617
+ return undefined;
1618
+ };
1619
+ /**
1620
+ * What is wrong in the images of the previews in the folder of the patterns of a package, by
1621
+ * file: a preview without its image in a mode (the preview, by its file), an image that is not
1622
+ * WebP or not of the frame, an image of no preview.
1623
+ */
1624
+ export const previewImageErrors = (previews, patternsDir) => {
1625
+ const found = new Map();
1626
+ const add = (file, error) => found.set(file, [...(found.get(file) ?? []), error]);
1627
+ const width = PREVIEW_IMAGE.width * PREVIEW_IMAGE.scale;
1628
+ const height = PREVIEW_IMAGE.height * PREVIEW_IMAGE.scale;
1629
+ const expected = new Set();
1630
+ for (const preview of previews)
1631
+ for (const mode of PREVIEW_IMAGE_MODES) {
1632
+ const file = previewImageFile(preview.file, mode, patternsDir);
1633
+ expected.add(file);
1634
+ if (!existsSync(file)) {
1635
+ add(preview.file, `no ${mode} image in ${file}: build magma`);
1636
+ continue;
1637
+ }
1638
+ const size = webpSize(readFileSync(file));
1639
+ if (!size)
1640
+ add(file, 'it is not WebP');
1641
+ else if (size.width !== width || size.height !== height)
1642
+ add(file, `it is ${size.width}x${size.height}, the frame is ${width}x${height}`);
1643
+ }
1644
+ const root = path.join(patternsDir, PREVIEWS_DIR);
1645
+ if (existsSync(root))
1646
+ for (const folder of readdirSync(root, { withFileTypes: true }).filter((one) => one.isDirectory()))
1647
+ for (const name of readdirSync(path.join(root, folder.name)).filter((one) => one.endsWith('.webp'))) {
1648
+ const file = path.join(root, folder.name, name);
1649
+ if (!expected.has(file))
1650
+ add(file, 'it is the image of no preview');
1651
+ }
1652
+ return found;
1653
+ };
1564
1654
  /** The rules of a domain of Foundation that may have a preview: its own, never one it cites (#1221). */
1565
1655
  export const ownRules = (pattern) => pattern.kind === FOUNDATION
1566
1656
  ? (pattern['always-true'] ?? []).filter((one) => !one.from).map((one) => one.id)
@@ -13,11 +13,14 @@
13
13
  building block (#1210) answers a situation with its regions, in the order of the page, and
14
14
  has a preview per situation, named after its id (previews/<block>/<situation>.html, the
15
15
  maintainer's choice on 2026-11-03): when the values match a situation exactly, every variable
16
- given, the answer carries its preview as a case answer does.
16
+ given, the answer carries its preview as a case answer does. The preview of an answer names its
17
+ images too (<case>.light.webp and <case>.dark.webp beside it, #1243), the path and not the
18
+ bytes, for a client that cannot run the stage; a magma before them has none, and names none.
17
19
  */
20
+ import { existsSync } from 'node:fs';
18
21
  import path from 'node:path';
19
22
  import { loadComponents, magmaRoot } from '../core/data.js';
20
- import { BLOCK, FOUNDATION, MAGMA_LAYER, answer, examplesOf, extendedId, indexPatterns, isLayer, listPatterns, previewOf, projectErrors, rulesOfCase, readPatternDir, readPreviews, readProjectDir, regionsFor, resolveLayer, situationsMatching, splitBody, } from '../core/patterns.js';
23
+ import { BLOCK, FOUNDATION, MAGMA_LAYER, answer, examplesOf, extendedId, indexPatterns, isLayer, listPatterns, PREVIEW_IMAGE_MODES, previewImageFile, previewOf, projectErrors, rulesOfCase, readPatternDir, readPreviews, readProjectDir, regionsFor, resolveLayer, situationsMatching, splitBody, } from '../core/patterns.js';
21
24
  import { ToolError } from './protocol.js';
22
25
  import { GAP, GAP_SCHEMA, wordsOf } from './context.js';
23
26
  /** Where a product keeps its layer, in its own repository (#1174, "The code: the plan"). */
@@ -72,14 +75,21 @@ const read = (context) => {
72
75
  problems.set(file, [error]);
73
76
  return { patterns, layers, own, problems, previews: readPreviews(shipped) };
74
77
  };
75
- /** A preview as the answer for a situation gives it: where it is, what to try, the stage. */
76
- const previewIn = (context, preview) => ({
77
- file: path.relative(context.root, preview.file),
78
- try: preview.try,
79
- ...(preview.height ? { height: preview.height } : {}),
80
- ...(preview.wholePage ? { wholePage: true } : {}),
81
- markup: preview.markup,
82
- });
78
+ /** A preview as the answer for a situation gives it: where it is, its images, what to try, the stage. */
79
+ const previewIn = (context, preview) => {
80
+ const images = Object.fromEntries(PREVIEW_IMAGE_MODES.flatMap((mode) => {
81
+ const file = previewImageFile(preview.file, mode);
82
+ return existsSync(file) ? [[mode, path.relative(context.root, file)]] : [];
83
+ }));
84
+ return {
85
+ file: path.relative(context.root, preview.file),
86
+ ...(Object.keys(images).length ? { images } : {}),
87
+ try: preview.try,
88
+ ...(preview.height ? { height: preview.height } : {}),
89
+ ...(preview.wholePage ? { wholePage: true } : {}),
90
+ markup: preview.markup,
91
+ };
92
+ };
83
93
  /**
84
94
  * The paths of the previews of a case or a rule, as the pattern names them: `preview` the first
85
95
  * example, `examples` the others in order (<id>.2.html, ...), render_preview's `example` 2 on.
@@ -107,7 +117,7 @@ export const CANDIDATE = 'A candidate: Magma knows this need and has no default
107
117
  export const getPattern = (context) => ({
108
118
  name: 'get_pattern',
109
119
  title: 'Read a Magma pattern',
110
- description: 'The patterns Magma ships: the solution to a task across components (where a message goes, confirming an action, an empty, a loading or a failed part), the same in every product; first the domains of Foundation (kind foundation), the rules of composition every pattern stands on (the space between elements, ...), then the building blocks (kind block), the sections of a page that come back in several patterns (the page header). Without arguments the list, and in layerErrors what is wrong in the layer this project keeps in magma/patterns/; with need the patterns for it; with id the pattern (its variables, cases, always-true rules and open choices, with the layer of this project applied); with id and situation, the values of its variables you know, the one case to follow (with its preview when Magma has one: the stage, as markup, and what to try in it, and in rules the rules of the domains it relies on, each with its domain, its text and the path of its preview; the other examples of the case in examples), or which variables are still to settle; for a block, the regions that show, in the order of the page, and when the values match one of its situations, every variable given, the preview of that situation as for a case (the stage, what to try, the other examples); with id and section the text of that section. Ask before building a flow or the head of a page, and follow the case or the regions it gives and its rules.',
120
+ description: 'The patterns Magma ships: the solution to a task across components (where a message goes, confirming an action, an empty, a loading or a failed part), the same in every product; first the domains of Foundation (kind foundation), the rules of composition every pattern stands on (the space between elements, ...), then the building blocks (kind block), the sections of a page that come back in several patterns (the page header). Without arguments the list, and in layerErrors what is wrong in the layer this project keeps in magma/patterns/; with need the patterns for it; with id the pattern (its variables, cases, always-true rules and open choices, with the layer of this project applied); with id and situation, the values of its variables you know, the one case to follow (with its preview when Magma has one: the stage, as markup, what to try in it and the paths of its images, light and dark, to show where the stage cannot run, and in rules the rules of the domains it relies on, each with its domain, its text and the path of its preview; the other examples of the case in examples), or which variables are still to settle; for a block, the regions that show, in the order of the page, and when the values match one of its situations, every variable given, the preview of that situation as for a case (the stage, what to try, the other examples); with id and section the text of that section. Ask before building a flow or the head of a page, and follow the case or the regions it gives and its rules.',
111
121
  inputSchema: {
112
122
  type: 'object',
113
123
  properties: {
@@ -23,6 +23,10 @@ export type Step = {
23
23
  png: string;
24
24
  scale: number;
25
25
  regions: Region[];
26
+ } | {
27
+ step: 'encode';
28
+ png: string;
29
+ quality: number;
26
30
  };
27
31
  export interface Inspection {
28
32
  problems: PageProblem[];
@@ -33,4 +37,4 @@ export interface Inspection {
33
37
  }
34
38
  /** The id of the element the markup is written into. */
35
39
  export declare const PREVIEW_ID = "magma-preview";
36
- export declare const inPage: (args: Step) => Promise<void | Inspection | PageProblem[]>;
40
+ export declare const inPage: (args: Step) => Promise<void | Inspection | PageProblem[] | string>;
@@ -286,6 +286,23 @@ export const inPage = async (args) => {
286
286
  const content = preview.getBoundingClientRect();
287
287
  return { problems, regions, height: Math.ceil(content.bottom + window.scrollY) };
288
288
  }
289
+ // the image as WebP, base64, for the images Magma ships of its previews (#1243): encoded from
290
+ // the capture the pixels are judged on, so the image shipped is the image checked
291
+ if (args.step === 'encode') {
292
+ const decoded = await createImageBitmap(await (await fetch(`data:image/png;base64,${args.png}`)).blob());
293
+ const canvas = new OffscreenCanvas(decoded.width, decoded.height);
294
+ canvas.getContext('2d').drawImage(decoded, 0, 0);
295
+ const blob = await canvas.convertToBlob({ type: 'image/webp', quality: args.quality });
296
+ // a browser that cannot encode WebP gives PNG instead (HTML, "serialising bitmaps")
297
+ if (blob.type !== 'image/webp')
298
+ throw new Error(`The browser encodes no WebP: ${blob.type}`);
299
+ const url = await new Promise((done) => {
300
+ const reader = new FileReader();
301
+ reader.onload = () => done(String(reader.result));
302
+ reader.readAsDataURL(blob);
303
+ });
304
+ return url.slice(url.indexOf(',') + 1);
305
+ }
289
306
  // the image, region by region: one colour from edge to edge means nothing of it rendered
290
307
  const bitmap = await createImageBitmap(await (await fetch(`data:image/png;base64,${args.png}`)).blob());
291
308
  const canvas = new OffscreenCanvas(bitmap.width, bitmap.height);
@@ -1,3 +1,4 @@
1
+ import { type Preview, type PreviewImageMode } from '../core/patterns.js';
1
2
  import { type ToolContext } from './context.js';
2
3
  import { type Tool } from './protocol.js';
3
4
  import { type PageProblem } from './render-page.js';
@@ -47,7 +48,12 @@ export declare const MODES: readonly ["light", "dark"];
47
48
  export declare const MAX_SIDE = 2000;
48
49
  export declare const MAX_IMAGES = 4;
49
50
  export declare const MIN_WIDTH = 320;
50
- /** The named themes of the installed styles: the values of `data-theme-name` themes.css styles. */
51
+ /**
52
+ * The named themes of the installed styles, as themes.css names them: first every theme it
53
+ * publishes a preview of (`--magma-preview-<name>-wash`, since #692), in the order of the config,
54
+ * which includes the base theme (business emits no rule of its own); then the values of
55
+ * `data-theme-name` it styles, the only names an older themes.css has.
56
+ */
51
57
  export declare const themesOf: (context: ToolContext) => string[];
52
58
  /** The Magma breakpoints, by name: the `--breakpoint-*` of the installed typography.css. */
53
59
  export declare const breakpointsOf: (context: ToolContext) => Record<string, number>;
@@ -97,6 +103,21 @@ export interface Image {
97
103
  export declare const render: (context: ToolContext, options: Options) => Promise<Array<Image & {
98
104
  png: Buffer;
99
105
  }>>;
106
+ /** The image of a preview Magma ships in one mode, as WebP, and what is wrong in it. */
107
+ export interface PreviewImage {
108
+ preview: Preview;
109
+ mode: PreviewImageMode;
110
+ webp: Buffer;
111
+ problems: PageProblem[];
112
+ }
113
+ /**
114
+ * The images of the previews Magma ships (#1243): each preview in each mode, in the frame of
115
+ * PREVIEW_IMAGE of the core, checked as render_preview checks an image and encoded as WebP from
116
+ * the capture it checked; its words in the language of the previews and a whole page without
117
+ * the inset, as render_preview renders a preview. One browser, a few previews at a time (a page
118
+ * waits mostly for its components and its fonts); the images in the order of the previews.
119
+ */
120
+ export declare const renderPreviewImages: (context: ToolContext, previews: Preview[], concurrency?: number) => Promise<PreviewImage[]>;
100
121
  /**
101
122
  * The preview Magma ships of a case of a pattern, of a situation of a building block (asked as
102
123
  * its case: a block has no cases), or of a rule of a domain (#1221), by the id of its pattern (an
@@ -14,6 +14,10 @@
14
14
  building block (previews/<block>/<situation>.html, asked as its case), or of a rule of a
15
15
  domain, and another example of any (<id>.<n>.html, #1221), with the height of its page and
16
16
  the language of its words, so the check of the image runs on every preview.
17
+
18
+ The same render makes the images magma ships of its previews (#1243, renderPreviewImages):
19
+ the build of magma renders every preview in the frame of PREVIEW_IMAGE of the core, light and
20
+ dark, and fails on an image with a problem, so no image ships that the check did not pass.
17
21
  */
18
22
  import { createHash } from 'node:crypto';
19
23
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
@@ -21,7 +25,7 @@ import { createRequire } from 'node:module';
21
25
  import path from 'node:path';
22
26
  import { pathToFileURL } from 'node:url';
23
27
  import { magmaRoot } from '../core/data.js';
24
- import { BLOCK, examplesOf, indexPatterns, ownRules, previewOf, readPatternDir, readPreviews, situationIds, } from '../core/patterns.js';
28
+ import { BLOCK, examplesOf, indexPatterns, ownRules, PREVIEW_IMAGE, PREVIEW_IMAGE_MODES, previewOf, readPatternDir, readPreviews, situationIds, } from '../core/patterns.js';
25
29
  import { packageDir, readJsonFile, resolvePackage } from './context.js';
26
30
  import { folderOf, slugFile } from './icons.js';
27
31
  import { ToolError, withImages } from './protocol.js';
@@ -144,10 +148,21 @@ const stylesOf = (context, name) => {
144
148
  const file = dir && path.join(dir, 'dist/css', name);
145
149
  return file && existsSync(file) ? readFileSync(file, 'utf8') : undefined;
146
150
  };
147
- /** The named themes of the installed styles: the values of `data-theme-name` themes.css styles. */
148
- export const themesOf = (context) => [
149
- ...new Set([...(stylesOf(context, 'themes.css') ?? '').matchAll(/\[data-theme-name=['"]?([\w-]+)/g)].map((one) => one[1])),
150
- ];
151
+ /**
152
+ * The named themes of the installed styles, as themes.css names them: first every theme it
153
+ * publishes a preview of (`--magma-preview-<name>-wash`, since #692), in the order of the config,
154
+ * which includes the base theme (business emits no rule of its own); then the values of
155
+ * `data-theme-name` it styles, the only names an older themes.css has.
156
+ */
157
+ export const themesOf = (context) => {
158
+ const css = stylesOf(context, 'themes.css') ?? '';
159
+ return [
160
+ ...new Set([
161
+ ...[...css.matchAll(/--magma-preview-([a-z]+(?:-[a-z]+)*)-wash\s*:/g)].map((one) => one[1]),
162
+ ...[...css.matchAll(/\[data-theme-name=['"]?([\w-]+)/g)].map((one) => one[1]),
163
+ ]),
164
+ ];
165
+ };
151
166
  /** The Magma breakpoints, by name: the `--breakpoint-*` of the installed typography.css. */
152
167
  export const breakpointsOf = (context) => Object.fromEntries([
153
168
  ...(stylesOf(context, 'typography.css') ?? '').matchAll(/--breakpoint-([\w-]+):\s*(\d+)px/g),
@@ -267,10 +282,10 @@ export const PREVIEW_DIR = 'node_modules/.cache/magma/previews';
267
282
  /** How long a page may take to load and settle. */
268
283
  const TIMEOUT = 15_000;
269
284
  /** One page at one width: the image and what is wrong in it. */
270
- const capture = async (context, browser, html, width, options) => {
285
+ const capture = async (context, browser, html, width, options, frame) => {
271
286
  const session = await browser.newContext({
272
- viewport: { width, height: options.height ?? 600 },
273
- deviceScaleFactor: 1,
287
+ viewport: { width, height: frame?.height ?? options.height ?? 600 },
288
+ deviceScaleFactor: frame?.scale ?? 1,
274
289
  colorScheme: options.mode,
275
290
  });
276
291
  try {
@@ -312,25 +327,39 @@ const capture = async (context, browser, html, width, options) => {
312
327
  await page.goto(`${ORIGIN}/`, { waitUntil: 'networkidle', timeout });
313
328
  await page.evaluate(inPage, { step: 'settle', timeout: timeout / 2 });
314
329
  let inspection = (await page.evaluate(inPage, { step: 'inspect' }));
315
- const height = options.height ?? Math.min(inspection.height, MAX_SIDE);
316
- if (!options.height) {
330
+ const height = frame?.height ?? options.height ?? Math.min(inspection.height, MAX_SIDE);
331
+ // a frame shows what fits in it, by its choice: the rest of the content is no cut
332
+ const sized = frame !== undefined || options.height !== undefined;
333
+ if (!sized) {
317
334
  // the viewport as tall as the content: a layout that depends on the height settles again
318
335
  await page.setViewportSize({ width, height });
319
336
  await page.evaluate(inPage, { step: 'settle', timeout: Math.min(2000, timeout / 2) });
320
337
  inspection = (await page.evaluate(inPage, { step: 'inspect' }));
321
338
  }
322
- if (!options.height && inspection.height > MAX_SIDE)
339
+ if (!sized && inspection.height > MAX_SIDE)
323
340
  problems.push({
324
341
  kind: 'cut',
325
342
  detail: `The content is ${inspection.height} px tall and the image shows its first ${MAX_SIDE}: render a part of it, or each part on its own.`,
326
343
  });
327
344
  const png = await page.screenshot({ type: 'png' });
345
+ // in a frame, a component its edge cuts shows a part of itself, which may be all one colour
346
+ // (the top of a card): the frame judges the components it shows whole
347
+ const regions = frame
348
+ ? inspection.regions.filter((one) => one.x + one.width <= width && one.y + one.height <= frame.height)
349
+ : inspection.regions;
328
350
  const flat = (await page.evaluate(inPage, {
329
351
  step: 'pixels',
330
352
  png: png.toString('base64'),
331
- scale: 1,
332
- regions: inspection.regions,
353
+ scale: frame?.scale ?? 1,
354
+ regions,
333
355
  }));
356
+ const webp = frame
357
+ ? Buffer.from((await page.evaluate(inPage, {
358
+ step: 'encode',
359
+ png: png.toString('base64'),
360
+ quality: frame.quality,
361
+ })), 'base64')
362
+ : undefined;
334
363
  const all = [...problems, ...inspection.problems, ...flat];
335
364
  // one problem once: a component asks for a missing icon on each render
336
365
  const seen = new Set();
@@ -338,21 +367,23 @@ const capture = async (context, browser, html, width, options) => {
338
367
  const key = JSON.stringify(one);
339
368
  return !seen.has(key) && seen.add(key);
340
369
  });
341
- return { png, height, problems: unique };
370
+ return { png, ...(webp ? { webp } : {}), height, problems: unique };
342
371
  }
343
372
  finally {
344
373
  await session.close();
345
374
  }
346
375
  };
347
- /** Render the markup at each width: the image, the file it is written to and what is wrong in it. */
348
- export const render = async (context, options) => {
376
+ /** The browser the images are made in, once the project has a driver and its magma can load its components. */
377
+ const browserFor = async (context) => {
349
378
  const chromium = await chromiumOf(context);
350
379
  if (!chromium)
351
380
  throw new ToolError('render_preview needs playwright-core in the project: npm i -D playwright-core. It drives the Google Chrome or Microsoft Edge of the machine and downloads no browser (agents/mcp.md, "Show the person what you mean").');
352
381
  if (!existsSync(loaderOf(context)))
353
382
  throw new ToolError(`The installed magma has no ${LOADER}: the components cannot load.`);
354
- const version = readJsonFile(path.join(magmaRoot(context.settings), 'package.json'))
355
- ?.version ?? '';
383
+ return launch(chromium);
384
+ };
385
+ /** The page of the markup, and the problem every image of it has when its Tailwind classes cannot compile. */
386
+ const pageFor = async (context, options) => {
356
387
  const utilities = await tailwindOf(context, options.markup);
357
388
  const html = pageOf(context, { ...options, ...(utilities ? { utilities } : {}) });
358
389
  // classes with no style element of the markup to give them rules are Tailwind classes, which
@@ -367,6 +398,13 @@ export const render = async (context, options) => {
367
398
  },
368
399
  ]
369
400
  : [];
401
+ return { html, untailwinded };
402
+ };
403
+ /** Render the markup at each width: the image, the file it is written to and what is wrong in it. */
404
+ export const render = async (context, options) => {
405
+ const version = readJsonFile(path.join(magmaRoot(context.settings), 'package.json'))
406
+ ?.version ?? '';
407
+ const { html, untailwinded } = await pageFor(context, options);
370
408
  const out = path.join(context.root, PREVIEW_DIR);
371
409
  mkdirSync(out, { recursive: true });
372
410
  // the same markup, options and magma give the same file, written again: the time a page
@@ -375,7 +413,7 @@ export const render = async (context, options) => {
375
413
  .update(JSON.stringify({ ...options, timeout: undefined, version }))
376
414
  .digest('hex')
377
415
  .slice(0, 12);
378
- const browser = await launch(chromium);
416
+ const browser = await browserFor(context);
379
417
  try {
380
418
  const images = [];
381
419
  for (const width of options.widths) {
@@ -392,6 +430,49 @@ export const render = async (context, options) => {
392
430
  await browser.close();
393
431
  }
394
432
  };
433
+ /**
434
+ * The images of the previews Magma ships (#1243): each preview in each mode, in the frame of
435
+ * PREVIEW_IMAGE of the core, checked as render_preview checks an image and encoded as WebP from
436
+ * the capture it checked; its words in the language of the previews and a whole page without
437
+ * the inset, as render_preview renders a preview. One browser, a few previews at a time (a page
438
+ * waits mostly for its components and its fonts); the images in the order of the previews.
439
+ */
440
+ export const renderPreviewImages = async (context, previews, concurrency = 2) => {
441
+ const browser = await browserFor(context);
442
+ const images = [];
443
+ let next = 0;
444
+ const work = async () => {
445
+ while (next < previews.length) {
446
+ const at = next++;
447
+ const preview = previews[at];
448
+ const options = {
449
+ markup: preview.markup,
450
+ lang: PREVIEW_LANG,
451
+ ...(preview.wholePage ? { wholePage: true } : {}),
452
+ };
453
+ const made = [];
454
+ try {
455
+ const { html, untailwinded } = await pageFor(context, options);
456
+ for (const mode of PREVIEW_IMAGE_MODES) {
457
+ const { webp, problems } = await capture(context, browser, html, PREVIEW_IMAGE.width, { ...options, widths: [PREVIEW_IMAGE.width], mode }, PREVIEW_IMAGE);
458
+ made.push({ preview, mode, webp: webp, problems: [...untailwinded, ...problems] });
459
+ }
460
+ }
461
+ catch (error) {
462
+ // a page that does not load (a timeout): the preview it is, not only the driver's words
463
+ throw new Error(`${path.relative(context.root, preview.file)}: ${error instanceof Error ? error.message : String(error)}`);
464
+ }
465
+ images[at] = made;
466
+ }
467
+ };
468
+ try {
469
+ await Promise.all(Array.from({ length: Math.max(1, concurrency) }, work));
470
+ return images.flat();
471
+ }
472
+ finally {
473
+ await browser.close();
474
+ }
475
+ };
395
476
  const string = { type: 'string' };
396
477
  /**
397
478
  * The preview Magma ships of a case of a pattern, of a situation of a building block (asked as
@@ -477,7 +558,7 @@ export const renderPreview = (context) => ({
477
558
  mode: { type: 'string', enum: [...MODES], description: 'light (default) or dark.' },
478
559
  theme: {
479
560
  type: 'string',
480
- description: 'A named theme of the installed styles (data-theme-name). Default: the default theme.',
561
+ description: 'A named theme of the installed styles (data-theme-name). Default: the base theme, the page with no data-theme-name.',
481
562
  },
482
563
  lang: {
483
564
  type: 'string',
@@ -916,7 +916,7 @@
916
916
  {
917
917
  "name": "get_pattern",
918
918
  "title": "Read a Magma pattern",
919
- "description": "The patterns Magma ships: the solution to a task across components (where a message goes, confirming an action, an empty, a loading or a failed part), the same in every product; first the domains of Foundation (kind foundation), the rules of composition every pattern stands on (the space between elements, ...), then the building blocks (kind block), the sections of a page that come back in several patterns (the page header). Without arguments the list, and in layerErrors what is wrong in the layer this project keeps in magma/patterns/; with need the patterns for it; with id the pattern (its variables, cases, always-true rules and open choices, with the layer of this project applied); with id and situation, the values of its variables you know, the one case to follow (with its preview when Magma has one: the stage, as markup, and what to try in it, and in rules the rules of the domains it relies on, each with its domain, its text and the path of its preview; the other examples of the case in examples), or which variables are still to settle; for a block, the regions that show, in the order of the page, and when the values match one of its situations, every variable given, the preview of that situation as for a case (the stage, what to try, the other examples); with id and section the text of that section. Ask before building a flow or the head of a page, and follow the case or the regions it gives and its rules.",
919
+ "description": "The patterns Magma ships: the solution to a task across components (where a message goes, confirming an action, an empty, a loading or a failed part), the same in every product; first the domains of Foundation (kind foundation), the rules of composition every pattern stands on (the space between elements, ...), then the building blocks (kind block), the sections of a page that come back in several patterns (the page header). Without arguments the list, and in layerErrors what is wrong in the layer this project keeps in magma/patterns/; with need the patterns for it; with id the pattern (its variables, cases, always-true rules and open choices, with the layer of this project applied); with id and situation, the values of its variables you know, the one case to follow (with its preview when Magma has one: the stage, as markup, what to try in it and the paths of its images, light and dark, to show where the stage cannot run, and in rules the rules of the domains it relies on, each with its domain, its text and the path of its preview; the other examples of the case in examples), or which variables are still to settle; for a block, the regions that show, in the order of the page, and when the values match one of its situations, every variable given, the preview of that situation as for a case (the stage, what to try, the other examples); with id and section the text of that section. Ask before building a flow or the head of a page, and follow the case or the regions it gives and its rules.",
920
920
  "inputSchema": {
921
921
  "type": "object",
922
922
  "properties": {
@@ -1257,7 +1257,7 @@
1257
1257
  },
1258
1258
  "theme": {
1259
1259
  "type": "string",
1260
- "description": "A named theme of the installed styles (data-theme-name). Default: the default theme."
1260
+ "description": "A named theme of the installed styles (data-theme-name). Default: the base theme, the page with no data-theme-name."
1261
1261
  },
1262
1262
  "lang": {
1263
1263
  "type": "string",