@iksnerd/blazon 0.0.0-stage → 0.1.1

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 (503) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +259 -2
  3. package/THIRD-PARTY-NOTICES.md +60 -0
  4. package/bin/blazon.js +4 -0
  5. package/dist/builder/site-builder.d.ts +10 -0
  6. package/dist/builder/site-builder.d.ts.map +1 -0
  7. package/dist/chunks/site-builder-CPfjBOmR.js +13804 -0
  8. package/dist/cli/commands/approvals.d.ts +8 -0
  9. package/dist/cli/commands/approvals.d.ts.map +1 -0
  10. package/dist/cli/commands/build.d.ts +8 -0
  11. package/dist/cli/commands/build.d.ts.map +1 -0
  12. package/dist/cli/commands/check.d.ts +33 -0
  13. package/dist/cli/commands/check.d.ts.map +1 -0
  14. package/dist/cli/commands/cwd.d.ts +14 -0
  15. package/dist/cli/commands/cwd.d.ts.map +1 -0
  16. package/dist/cli/commands/dev.d.ts +5 -0
  17. package/dist/cli/commands/dev.d.ts.map +1 -0
  18. package/dist/cli/commands/doctor.d.ts +34 -0
  19. package/dist/cli/commands/doctor.d.ts.map +1 -0
  20. package/dist/cli/commands/drift.d.ts +11 -0
  21. package/dist/cli/commands/drift.d.ts.map +1 -0
  22. package/dist/cli/commands/explain.d.ts +5 -0
  23. package/dist/cli/commands/explain.d.ts.map +1 -0
  24. package/dist/cli/commands/init.d.ts +46 -0
  25. package/dist/cli/commands/init.d.ts.map +1 -0
  26. package/dist/cli/commands/mcp-check.d.ts +57 -0
  27. package/dist/cli/commands/mcp-check.d.ts.map +1 -0
  28. package/dist/cli/commands/mcp.d.ts +13 -0
  29. package/dist/cli/commands/mcp.d.ts.map +1 -0
  30. package/dist/cli/commands/pin.d.ts +7 -0
  31. package/dist/cli/commands/pin.d.ts.map +1 -0
  32. package/dist/cli/commands/plugin.d.ts +32 -0
  33. package/dist/cli/commands/plugin.d.ts.map +1 -0
  34. package/dist/cli/commands/preview.d.ts +5 -0
  35. package/dist/cli/commands/preview.d.ts.map +1 -0
  36. package/dist/cli/commands/tokens.d.ts +5 -0
  37. package/dist/cli/commands/tokens.d.ts.map +1 -0
  38. package/dist/cli/errors.d.ts +53 -0
  39. package/dist/cli/errors.d.ts.map +1 -0
  40. package/dist/cli/handlers/brand.d.ts +7 -0
  41. package/dist/cli/handlers/brand.d.ts.map +1 -0
  42. package/dist/cli/handlers/can.d.ts +7 -0
  43. package/dist/cli/handlers/can.d.ts.map +1 -0
  44. package/dist/cli/handlers/fonts.d.ts +4 -0
  45. package/dist/cli/handlers/fonts.d.ts.map +1 -0
  46. package/dist/cli/handlers/get.d.ts +7 -0
  47. package/dist/cli/handlers/get.d.ts.map +1 -0
  48. package/dist/cli/handlers/index.d.ts +8 -0
  49. package/dist/cli/handlers/index.d.ts.map +1 -0
  50. package/dist/cli/handlers/list.d.ts +7 -0
  51. package/dist/cli/handlers/list.d.ts.map +1 -0
  52. package/dist/cli/handlers/logo.d.ts +4 -0
  53. package/dist/cli/handlers/logo.d.ts.map +1 -0
  54. package/dist/cli/handlers/rules.d.ts +10 -0
  55. package/dist/cli/handlers/rules.d.ts.map +1 -0
  56. package/dist/cli/handlers/types.d.ts +17 -0
  57. package/dist/cli/handlers/types.d.ts.map +1 -0
  58. package/dist/cli/help.d.ts +18 -0
  59. package/dist/cli/help.d.ts.map +1 -0
  60. package/dist/cli/index.d.ts +2 -0
  61. package/dist/cli/index.d.ts.map +1 -0
  62. package/dist/cli/index.js +3850 -0
  63. package/dist/cli/init-flow.d.ts +24 -0
  64. package/dist/cli/init-flow.d.ts.map +1 -0
  65. package/dist/cli/init-ui.d.ts +20 -0
  66. package/dist/cli/init-ui.d.ts.map +1 -0
  67. package/dist/cli/json.d.ts +18 -0
  68. package/dist/cli/json.d.ts.map +1 -0
  69. package/dist/cli/operations.d.ts +11 -0
  70. package/dist/cli/operations.d.ts.map +1 -0
  71. package/dist/cli/options.d.ts +8 -0
  72. package/dist/cli/options.d.ts.map +1 -0
  73. package/dist/cli/project.d.ts +8 -0
  74. package/dist/cli/project.d.ts.map +1 -0
  75. package/dist/cli/read.d.ts +13 -0
  76. package/dist/cli/read.d.ts.map +1 -0
  77. package/dist/cli/where.d.ts +10 -0
  78. package/dist/cli/where.d.ts.map +1 -0
  79. package/dist/core/assets/categories.d.ts +47 -0
  80. package/dist/core/assets/categories.d.ts.map +1 -0
  81. package/dist/core/assets/fields.d.ts +12 -0
  82. package/dist/core/assets/fields.d.ts.map +1 -0
  83. package/dist/core/assets/image-size.d.ts +10 -0
  84. package/dist/core/assets/image-size.d.ts.map +1 -0
  85. package/dist/core/assets/measure.d.ts +22 -0
  86. package/dist/core/assets/measure.d.ts.map +1 -0
  87. package/dist/core/assets/scanner.d.ts +26 -0
  88. package/dist/core/assets/scanner.d.ts.map +1 -0
  89. package/dist/core/assets/sidecar.d.ts +22 -0
  90. package/dist/core/assets/sidecar.d.ts.map +1 -0
  91. package/dist/core/blazon-pin.d.ts +36 -0
  92. package/dist/core/blazon-pin.d.ts.map +1 -0
  93. package/dist/core/brand/export.d.ts +128 -0
  94. package/dist/core/brand/export.d.ts.map +1 -0
  95. package/dist/core/brand/schema.d.ts +1000 -0
  96. package/dist/core/brand/schema.d.ts.map +1 -0
  97. package/dist/core/brand-theme.d.ts +16 -0
  98. package/dist/core/brand-theme.d.ts.map +1 -0
  99. package/dist/core/checker/approvals.d.ts +15 -0
  100. package/dist/core/checker/approvals.d.ts.map +1 -0
  101. package/dist/core/checker/cascade.d.ts +8 -0
  102. package/dist/core/checker/cascade.d.ts.map +1 -0
  103. package/dist/core/checker/catalogue.d.ts +609 -0
  104. package/dist/core/checker/catalogue.d.ts.map +1 -0
  105. package/dist/core/checker/contrast.d.ts +30 -0
  106. package/dist/core/checker/contrast.d.ts.map +1 -0
  107. package/dist/core/checker/duplicates.d.ts +3 -0
  108. package/dist/core/checker/duplicates.d.ts.map +1 -0
  109. package/dist/core/checker/fixes.d.ts +6 -0
  110. package/dist/core/checker/fixes.d.ts.map +1 -0
  111. package/dist/core/checker/font-meta.d.ts +8 -0
  112. package/dist/core/checker/font-meta.d.ts.map +1 -0
  113. package/dist/core/checker/index.d.ts +23 -0
  114. package/dist/core/checker/index.d.ts.map +1 -0
  115. package/dist/core/checker/location.d.ts +7 -0
  116. package/dist/core/checker/location.d.ts.map +1 -0
  117. package/dist/core/checker/logo-rules.d.ts +19 -0
  118. package/dist/core/checker/logo-rules.d.ts.map +1 -0
  119. package/dist/core/checker/logo-surfaces.d.ts +7 -0
  120. package/dist/core/checker/logo-surfaces.d.ts.map +1 -0
  121. package/dist/core/checker/page-tokens.d.ts +5 -0
  122. package/dist/core/checker/page-tokens.d.ts.map +1 -0
  123. package/dist/core/checker/print.d.ts +9 -0
  124. package/dist/core/checker/print.d.ts.map +1 -0
  125. package/dist/core/checker/proportion.d.ts +3 -0
  126. package/dist/core/checker/proportion.d.ts.map +1 -0
  127. package/dist/core/checker/review.d.ts +40 -0
  128. package/dist/core/checker/review.d.ts.map +1 -0
  129. package/dist/core/checker/source.d.ts +4 -0
  130. package/dist/core/checker/source.d.ts.map +1 -0
  131. package/dist/core/checker/spdx.d.ts +8 -0
  132. package/dist/core/checker/spdx.d.ts.map +1 -0
  133. package/dist/core/checker/tier.d.ts +3 -0
  134. package/dist/core/checker/tier.d.ts.map +1 -0
  135. package/dist/core/checker/usage.d.ts +4 -0
  136. package/dist/core/checker/usage.d.ts.map +1 -0
  137. package/dist/core/checker/variables.d.ts +8 -0
  138. package/dist/core/checker/variables.d.ts.map +1 -0
  139. package/dist/core/colors.d.ts +10 -0
  140. package/dist/core/colors.d.ts.map +1 -0
  141. package/dist/core/config/defaults.d.ts +3 -0
  142. package/dist/core/config/defaults.d.ts.map +1 -0
  143. package/dist/core/config/index.d.ts +15 -0
  144. package/dist/core/config/index.d.ts.map +1 -0
  145. package/dist/core/config/validate.d.ts +21 -0
  146. package/dist/core/config/validate.d.ts.map +1 -0
  147. package/dist/core/config/vocabulary.d.ts +10 -0
  148. package/dist/core/config/vocabulary.d.ts.map +1 -0
  149. package/dist/core/confine.d.ts +25 -0
  150. package/dist/core/confine.d.ts.map +1 -0
  151. package/dist/core/docs/directives.d.ts +161 -0
  152. package/dist/core/docs/directives.d.ts.map +1 -0
  153. package/dist/core/docs/parser.d.ts +7 -0
  154. package/dist/core/docs/parser.d.ts.map +1 -0
  155. package/dist/core/docs/sections.d.ts +11 -0
  156. package/dist/core/docs/sections.d.ts.map +1 -0
  157. package/dist/core/drift/compare.d.ts +30 -0
  158. package/dist/core/drift/compare.d.ts.map +1 -0
  159. package/dist/core/drift/read.d.ts +22 -0
  160. package/dist/core/drift/read.d.ts.map +1 -0
  161. package/dist/core/email-signature.d.ts +35 -0
  162. package/dist/core/email-signature.d.ts.map +1 -0
  163. package/dist/core/emit.d.ts +22 -0
  164. package/dist/core/emit.d.ts.map +1 -0
  165. package/dist/core/fonts.d.ts +43 -0
  166. package/dist/core/fonts.d.ts.map +1 -0
  167. package/dist/core/icons/icon-sets.d.ts +22 -0
  168. package/dist/core/icons/icon-sets.d.ts.map +1 -0
  169. package/dist/core/index.d.ts +9 -0
  170. package/dist/core/index.d.ts.map +1 -0
  171. package/dist/core/init/answers.d.ts +45 -0
  172. package/dist/core/init/answers.d.ts.map +1 -0
  173. package/dist/core/init/from-site/apply.d.ts +7 -0
  174. package/dist/core/init/from-site/apply.d.ts.map +1 -0
  175. package/dist/core/init/from-site/clean-colors.d.ts +21 -0
  176. package/dist/core/init/from-site/clean-colors.d.ts.map +1 -0
  177. package/dist/core/init/from-site/colors.d.ts +10 -0
  178. package/dist/core/init/from-site/colors.d.ts.map +1 -0
  179. package/dist/core/init/from-site/context.d.ts +24 -0
  180. package/dist/core/init/from-site/context.d.ts.map +1 -0
  181. package/dist/core/init/from-site/fonts.d.ts +10 -0
  182. package/dist/core/init/from-site/fonts.d.ts.map +1 -0
  183. package/dist/core/init/from-site/html.d.ts +10 -0
  184. package/dist/core/init/from-site/html.d.ts.map +1 -0
  185. package/dist/core/init/from-site/index.d.ts +6 -0
  186. package/dist/core/init/from-site/index.d.ts.map +1 -0
  187. package/dist/core/init/from-site/inspect.d.ts +4 -0
  188. package/dist/core/init/from-site/inspect.d.ts.map +1 -0
  189. package/dist/core/init/from-site/logo.d.ts +20 -0
  190. package/dist/core/init/from-site/logo.d.ts.map +1 -0
  191. package/dist/core/init/from-site/sections/colors.d.ts +4 -0
  192. package/dist/core/init/from-site/sections/colors.d.ts.map +1 -0
  193. package/dist/core/init/from-site/sections/config.d.ts +10 -0
  194. package/dist/core/init/from-site/sections/config.d.ts.map +1 -0
  195. package/dist/core/init/from-site/sections/directives.d.ts +3 -0
  196. package/dist/core/init/from-site/sections/directives.d.ts.map +1 -0
  197. package/dist/core/init/from-site/sections/fonts.d.ts +8 -0
  198. package/dist/core/init/from-site/sections/fonts.d.ts.map +1 -0
  199. package/dist/core/init/from-site/sections/intro.d.ts +4 -0
  200. package/dist/core/init/from-site/sections/intro.d.ts.map +1 -0
  201. package/dist/core/init/from-site/sections/logo.d.ts +9 -0
  202. package/dist/core/init/from-site/sections/logo.d.ts.map +1 -0
  203. package/dist/core/init/from-site/sections/placeholder.d.ts +5 -0
  204. package/dist/core/init/from-site/sections/placeholder.d.ts.map +1 -0
  205. package/dist/core/init/from-site/tree.d.ts +14 -0
  206. package/dist/core/init/from-site/tree.d.ts.map +1 -0
  207. package/dist/core/init/from-site/types.d.ts +37 -0
  208. package/dist/core/init/from-site/types.d.ts.map +1 -0
  209. package/dist/core/init/palette.d.ts +34 -0
  210. package/dist/core/init/palette.d.ts.map +1 -0
  211. package/dist/core/init/prompts.d.ts +78 -0
  212. package/dist/core/init/prompts.d.ts.map +1 -0
  213. package/dist/core/init/shared/google-fonts.d.ts +4 -0
  214. package/dist/core/init/shared/google-fonts.d.ts.map +1 -0
  215. package/dist/core/init/shared/hex.d.ts +6 -0
  216. package/dist/core/init/shared/hex.d.ts.map +1 -0
  217. package/dist/core/init/shared/svg.d.ts +3 -0
  218. package/dist/core/init/shared/svg.d.ts.map +1 -0
  219. package/dist/core/init/vocabulary.d.ts +42 -0
  220. package/dist/core/init/vocabulary.d.ts.map +1 -0
  221. package/dist/core/inputs.d.ts +25 -0
  222. package/dist/core/inputs.d.ts.map +1 -0
  223. package/dist/core/logo/lockup.d.ts +54 -0
  224. package/dist/core/logo/lockup.d.ts.map +1 -0
  225. package/dist/core/logo.d.ts +23 -0
  226. package/dist/core/logo.d.ts.map +1 -0
  227. package/dist/core/mcp-config.d.ts +65 -0
  228. package/dist/core/mcp-config.d.ts.map +1 -0
  229. package/dist/core/operations/check.d.ts +8 -0
  230. package/dist/core/operations/check.d.ts.map +1 -0
  231. package/dist/core/operations/index.d.ts +7 -0
  232. package/dist/core/operations/index.d.ts.map +1 -0
  233. package/dist/core/operations/limits.d.ts +6 -0
  234. package/dist/core/operations/limits.d.ts.map +1 -0
  235. package/dist/core/operations/list.d.ts +8 -0
  236. package/dist/core/operations/list.d.ts.map +1 -0
  237. package/dist/core/operations/project.d.ts +10 -0
  238. package/dist/core/operations/project.d.ts.map +1 -0
  239. package/dist/core/operations/types.d.ts +96 -0
  240. package/dist/core/operations/types.d.ts.map +1 -0
  241. package/dist/core/operations/validate.d.ts +4 -0
  242. package/dist/core/operations/validate.d.ts.map +1 -0
  243. package/dist/core/order.d.ts +9 -0
  244. package/dist/core/order.d.ts.map +1 -0
  245. package/dist/core/outputs.d.ts +22 -0
  246. package/dist/core/outputs.d.ts.map +1 -0
  247. package/dist/core/package-name.d.ts +3 -0
  248. package/dist/core/package-name.d.ts.map +1 -0
  249. package/dist/core/package-root.d.ts +3 -0
  250. package/dist/core/package-root.d.ts.map +1 -0
  251. package/dist/core/plugin-name.d.ts +27 -0
  252. package/dist/core/plugin-name.d.ts.map +1 -0
  253. package/dist/core/preflight.d.ts +10 -0
  254. package/dist/core/preflight.d.ts.map +1 -0
  255. package/dist/core/read/can.d.ts +44 -0
  256. package/dist/core/read/can.d.ts.map +1 -0
  257. package/dist/core/read/fonts.d.ts +47 -0
  258. package/dist/core/read/fonts.d.ts.map +1 -0
  259. package/dist/core/read/index.d.ts +8 -0
  260. package/dist/core/read/index.d.ts.map +1 -0
  261. package/dist/core/read/list.d.ts +28 -0
  262. package/dist/core/read/list.d.ts.map +1 -0
  263. package/dist/core/read/logo.d.ts +34 -0
  264. package/dist/core/read/logo.d.ts.map +1 -0
  265. package/dist/core/read/lookup.d.ts +9 -0
  266. package/dist/core/read/lookup.d.ts.map +1 -0
  267. package/dist/core/read/rules.d.ts +80 -0
  268. package/dist/core/read/rules.d.ts.map +1 -0
  269. package/dist/core/read/token.d.ts +46 -0
  270. package/dist/core/read/token.d.ts.map +1 -0
  271. package/dist/core/shipped-names.d.ts +9 -0
  272. package/dist/core/shipped-names.d.ts.map +1 -0
  273. package/dist/core/starter.d.ts +31 -0
  274. package/dist/core/starter.d.ts.map +1 -0
  275. package/dist/core/suggest.d.ts +7 -0
  276. package/dist/core/suggest.d.ts.map +1 -0
  277. package/dist/core/tokens/alias.d.ts +18 -0
  278. package/dist/core/tokens/alias.d.ts.map +1 -0
  279. package/dist/core/tokens/contexts.d.ts +10 -0
  280. package/dist/core/tokens/contexts.d.ts.map +1 -0
  281. package/dist/core/tokens/formatters/css.d.ts +15 -0
  282. package/dist/core/tokens/formatters/css.d.ts.map +1 -0
  283. package/dist/core/tokens/formatters/json.d.ts +4 -0
  284. package/dist/core/tokens/formatters/json.d.ts.map +1 -0
  285. package/dist/core/tokens/formatters/tailwind.d.ts +37 -0
  286. package/dist/core/tokens/formatters/tailwind.d.ts.map +1 -0
  287. package/dist/core/tokens/formatters/ts.d.ts +6 -0
  288. package/dist/core/tokens/formatters/ts.d.ts.map +1 -0
  289. package/dist/core/tokens/groups.d.ts +44 -0
  290. package/dist/core/tokens/groups.d.ts.map +1 -0
  291. package/dist/core/tokens/key-lines.d.ts +8 -0
  292. package/dist/core/tokens/key-lines.d.ts.map +1 -0
  293. package/dist/core/tokens/load.d.ts +12 -0
  294. package/dist/core/tokens/load.d.ts.map +1 -0
  295. package/dist/core/tokens/merge.d.ts +17 -0
  296. package/dist/core/tokens/merge.d.ts.map +1 -0
  297. package/dist/core/tokens/names.d.ts +5 -0
  298. package/dist/core/tokens/names.d.ts.map +1 -0
  299. package/dist/core/tokens/resolve.d.ts +8 -0
  300. package/dist/core/tokens/resolve.d.ts.map +1 -0
  301. package/dist/core/tokens/resolver/compile.d.ts +17 -0
  302. package/dist/core/tokens/resolver/compile.d.ts.map +1 -0
  303. package/dist/core/tokens/resolver/inputs.d.ts +7 -0
  304. package/dist/core/tokens/resolver/inputs.d.ts.map +1 -0
  305. package/dist/core/tokens/resolver/parse.d.ts +34 -0
  306. package/dist/core/tokens/resolver/parse.d.ts.map +1 -0
  307. package/dist/core/tokens/resolver/sources.d.ts +17 -0
  308. package/dist/core/tokens/resolver/sources.d.ts.map +1 -0
  309. package/dist/core/tokens/shadcn.d.ts +43 -0
  310. package/dist/core/tokens/shadcn.d.ts.map +1 -0
  311. package/dist/core/tokens/theme.d.ts +17 -0
  312. package/dist/core/tokens/theme.d.ts.map +1 -0
  313. package/dist/core/tokens/values/color.d.ts +2 -0
  314. package/dist/core/tokens/values/color.d.ts.map +1 -0
  315. package/dist/core/tokens/values/composite.d.ts +7 -0
  316. package/dist/core/tokens/values/composite.d.ts.map +1 -0
  317. package/dist/core/tokens/values/font.d.ts +3 -0
  318. package/dist/core/tokens/values/font.d.ts.map +1 -0
  319. package/dist/core/tokens/values/index.d.ts +9 -0
  320. package/dist/core/tokens/values/index.d.ts.map +1 -0
  321. package/dist/core/tokens/values/shared.d.ts +5 -0
  322. package/dist/core/tokens/values/shared.d.ts.map +1 -0
  323. package/dist/core/tokens/values/simple.d.ts +3 -0
  324. package/dist/core/tokens/values/simple.d.ts.map +1 -0
  325. package/dist/core/tokens/values/units.d.ts +3 -0
  326. package/dist/core/tokens/values/units.d.ts.map +1 -0
  327. package/dist/core/tokens/walk.d.ts +30 -0
  328. package/dist/core/tokens/walk.d.ts.map +1 -0
  329. package/dist/core/version.d.ts +3 -0
  330. package/dist/core/version.d.ts.map +1 -0
  331. package/dist/index.d.ts +27 -0
  332. package/dist/index.d.ts.map +1 -0
  333. package/dist/index.js +40 -0
  334. package/dist/plugins/host/admit.d.ts +35 -0
  335. package/dist/plugins/host/admit.d.ts.map +1 -0
  336. package/dist/plugins/host/call.d.ts +59 -0
  337. package/dist/plugins/host/call.d.ts.map +1 -0
  338. package/dist/plugins/host/check.d.ts +54 -0
  339. package/dist/plugins/host/check.d.ts.map +1 -0
  340. package/dist/plugins/host/scrub.d.ts +17 -0
  341. package/dist/plugins/host/scrub.d.ts.map +1 -0
  342. package/dist/plugins/index.d.ts +14 -0
  343. package/dist/plugins/index.d.ts.map +1 -0
  344. package/dist/plugins/pins/interpreter.d.ts +49 -0
  345. package/dist/plugins/pins/interpreter.d.ts.map +1 -0
  346. package/dist/plugins/pins/lock.d.ts +47 -0
  347. package/dist/plugins/pins/lock.d.ts.map +1 -0
  348. package/dist/plugins/pins/pin.d.ts +65 -0
  349. package/dist/plugins/pins/pin.d.ts.map +1 -0
  350. package/dist/plugins/pins/shipped.d.ts +40 -0
  351. package/dist/plugins/pins/shipped.d.ts.map +1 -0
  352. package/dist/plugins/roles/breaker.d.ts +18 -0
  353. package/dist/plugins/roles/breaker.d.ts.map +1 -0
  354. package/dist/plugins/roles/check-cases.d.ts +4 -0
  355. package/dist/plugins/roles/check-cases.d.ts.map +1 -0
  356. package/dist/plugins/roles/dev.d.ts +35 -0
  357. package/dist/plugins/roles/dev.d.ts.map +1 -0
  358. package/dist/plugins/roles/fixes.d.ts +24 -0
  359. package/dist/plugins/roles/fixes.d.ts.map +1 -0
  360. package/dist/plugins/roles/gate.d.ts +26 -0
  361. package/dist/plugins/roles/gate.d.ts.map +1 -0
  362. package/dist/plugins/roles/integrate.d.ts +12 -0
  363. package/dist/plugins/roles/integrate.d.ts.map +1 -0
  364. package/dist/plugins/roles/roles.d.ts +73 -0
  365. package/dist/plugins/roles/roles.d.ts.map +1 -0
  366. package/dist/plugins/wire/environment.d.ts +9 -0
  367. package/dist/plugins/wire/environment.d.ts.map +1 -0
  368. package/dist/plugins/wire/forms.d.ts +13 -0
  369. package/dist/plugins/wire/forms.d.ts.map +1 -0
  370. package/dist/plugins/wire/limits.d.ts +11 -0
  371. package/dist/plugins/wire/limits.d.ts.map +1 -0
  372. package/dist/plugins/wire/manifest.d.ts +31 -0
  373. package/dist/plugins/wire/manifest.d.ts.map +1 -0
  374. package/dist/plugins/wire/profile.d.ts +36 -0
  375. package/dist/plugins/wire/profile.d.ts.map +1 -0
  376. package/dist/plugins/wire/text.d.ts +14 -0
  377. package/dist/plugins/wire/text.d.ts.map +1 -0
  378. package/dist/server/assets.d.ts +13 -0
  379. package/dist/server/assets.d.ts.map +1 -0
  380. package/dist/server/coalesce.d.ts +12 -0
  381. package/dist/server/coalesce.d.ts.map +1 -0
  382. package/dist/server/data-script.d.ts +8 -0
  383. package/dist/server/data-script.d.ts.map +1 -0
  384. package/dist/server/dev-server.d.ts +34 -0
  385. package/dist/server/dev-server.d.ts.map +1 -0
  386. package/dist/server/editor-guard.d.ts +13 -0
  387. package/dist/server/editor-guard.d.ts.map +1 -0
  388. package/dist/server/error-reporter.d.ts +11 -0
  389. package/dist/server/error-reporter.d.ts.map +1 -0
  390. package/dist/server/icon-sets.d.ts +9 -0
  391. package/dist/server/icon-sets.d.ts.map +1 -0
  392. package/dist/server/plugin.d.ts +4 -0
  393. package/dist/server/plugin.d.ts.map +1 -0
  394. package/dist/server/preview-guard.d.ts +11 -0
  395. package/dist/server/preview-guard.d.ts.map +1 -0
  396. package/dist/types/assets.d.ts +130 -0
  397. package/dist/types/assets.d.ts.map +1 -0
  398. package/dist/types/catalog.d.ts +95 -0
  399. package/dist/types/catalog.d.ts.map +1 -0
  400. package/dist/types/config.d.ts +97 -0
  401. package/dist/types/config.d.ts.map +1 -0
  402. package/dist/types/data.d.ts +38 -0
  403. package/dist/types/data.d.ts.map +1 -0
  404. package/dist/types/docs.d.ts +47 -0
  405. package/dist/types/docs.d.ts.map +1 -0
  406. package/dist/types/findings.d.ts +18 -0
  407. package/dist/types/findings.d.ts.map +1 -0
  408. package/dist/types/index.d.ts +13 -0
  409. package/dist/types/index.d.ts.map +1 -0
  410. package/dist/types/parsed.d.ts +86 -0
  411. package/dist/types/parsed.d.ts.map +1 -0
  412. package/dist/types/theme.d.ts +19 -0
  413. package/dist/types/theme.d.ts.map +1 -0
  414. package/dist/types/tokens.d.ts +101 -0
  415. package/dist/types/tokens.d.ts.map +1 -0
  416. package/dist/ui/assets/geist-OFL.txt +93 -0
  417. package/dist/ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  418. package/dist/ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  419. package/dist/ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  420. package/dist/ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  421. package/dist/ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  422. package/dist/ui/assets/index-D0WCUmtA.css +2 -0
  423. package/dist/ui/assets/index-DhSc0Zxv.js +75 -0
  424. package/dist/ui/index.html +14 -0
  425. package/package.json +151 -4
  426. package/plugins/blazon.brand-deck/README.md +38 -0
  427. package/plugins/blazon.brand-deck/bin/blazon-blazon.brand-deck./360/237/224/214 +2695 -0
  428. package/plugins/blazon.brand-deck/package.json +3 -0
  429. package/plugins/blazon.copy/README.md +29 -0
  430. package/plugins/blazon.copy/bin/blazon-blazon.copy./360/237/224/214 +438 -0
  431. package/plugins/blazon.copy/package.json +3 -0
  432. package/plugins/blazon.favicons/README.md +13 -0
  433. package/plugins/blazon.favicons/bin/blazon-blazon.favicons./360/237/224/214 +8816 -0
  434. package/plugins/blazon.favicons/package.json +3 -0
  435. package/plugins/blazon.logo-geometry/README.md +5 -0
  436. package/plugins/blazon.logo-geometry/bin/blazon-blazon.logo-geometry./360/237/224/214 +1522 -0
  437. package/plugins/blazon.logo-geometry/package.json +3 -0
  438. package/plugins/blazon.logo-kit/README.md +5 -0
  439. package/plugins/blazon.logo-kit/bin/blazon-blazon.logo-kit./360/237/224/214 +617 -0
  440. package/plugins/blazon.logo-kit/package.json +3 -0
  441. package/plugins/blazon.office-template/README.md +29 -0
  442. package/plugins/blazon.office-template/bin/blazon-blazon.office-template./360/237/224/214 +1788 -0
  443. package/plugins/blazon.office-template/package.json +3 -0
  444. package/plugins/blazon.platform-tokens/README.md +22 -0
  445. package/plugins/blazon.platform-tokens/bin/blazon-blazon.platform-tokens./360/237/224/214 +8418 -0
  446. package/plugins/blazon.platform-tokens/package.json +3 -0
  447. package/plugins/blazon.press-kit/README.md +17 -0
  448. package/plugins/blazon.press-kit/bin/blazon-blazon.press-kit./360/237/224/214 +897 -0
  449. package/plugins/blazon.press-kit/package.json +3 -0
  450. package/plugins/blazon.print-book/README.md +40 -0
  451. package/plugins/blazon.print-book/bin/blazon-blazon.print-book./360/237/224/214 +9268 -0
  452. package/plugins/blazon.print-book/package.json +3 -0
  453. package/plugins/blazon.social-cards/README.md +5 -0
  454. package/plugins/blazon.social-cards/bin/blazon-blazon.social-cards./360/237/224/214 +1165 -0
  455. package/plugins/blazon.social-cards/package.json +3 -0
  456. package/plugins/shipped.lock +75 -0
  457. package/template/AGENTS.md +55 -0
  458. package/template/CLAUDE.md +1 -0
  459. package/template/assets/backgrounds/aurora.json +5 -0
  460. package/template/assets/backgrounds/aurora.svg +39 -0
  461. package/template/assets/construction/blazon-mark.json +9 -0
  462. package/template/assets/construction/blazon-mark.svg +54 -0
  463. package/template/assets/icons/arrow-right.json +5 -0
  464. package/template/assets/icons/arrow-right.svg +1 -0
  465. package/template/assets/icons/check.json +5 -0
  466. package/template/assets/icons/check.svg +1 -0
  467. package/template/assets/icons/download.json +5 -0
  468. package/template/assets/icons/download.svg +1 -0
  469. package/template/assets/icons/file.json +5 -0
  470. package/template/assets/icons/file.svg +1 -0
  471. package/template/assets/icons/token.json +5 -0
  472. package/template/assets/icons/token.svg +1 -0
  473. package/template/assets/icons/warning.json +5 -0
  474. package/template/assets/icons/warning.svg +1 -0
  475. package/template/assets/logos/blazon-bone.json +6 -0
  476. package/template/assets/logos/blazon-bone.svg +1 -0
  477. package/template/assets/logos/blazon-graphite.json +6 -0
  478. package/template/assets/logos/blazon-graphite.svg +1 -0
  479. package/template/assets/logos/blazon-mark.json +6 -0
  480. package/template/assets/logos/blazon-mark.svg +1 -0
  481. package/template/blazon.json +104 -0
  482. package/template/blazon.resolver.json +46 -0
  483. package/template/docs/01-principles.md +47 -0
  484. package/template/docs/02-logo.md +43 -0
  485. package/template/docs/03-color.md +79 -0
  486. package/template/docs/04-type.md +36 -0
  487. package/template/docs/05-form.md +80 -0
  488. package/template/docs/06-layout.md +28 -0
  489. package/template/docs/07-icons.md +22 -0
  490. package/template/docs/08-diagrams.md +20 -0
  491. package/template/docs/09-social.md +21 -0
  492. package/template/docs/10-applications.md +20 -0
  493. package/template/docs/11-voice.md +74 -0
  494. package/template/docs/12-web.md +167 -0
  495. package/template/fonts/IBMPlexMono-Regular-latin.woff2 +0 -0
  496. package/template/fonts/IBMPlexMono-SemiBold-latin.woff2 +0 -0
  497. package/template/fonts/OFL.txt +93 -0
  498. package/template/tokens/colors.json +257 -0
  499. package/template/tokens/form.json +199 -0
  500. package/template/tokens/social.json +26 -0
  501. package/template/tokens/spacing.json +65 -0
  502. package/template/tokens/theme/dark.json +121 -0
  503. package/template/tokens/typography.json +233 -0
@@ -0,0 +1,897 @@
1
+ #!/usr/bin/env node
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ let node_fs = require("node:fs");
23
+ node_fs = __toESM(node_fs, 1);
24
+ let node_path = require("node:path");
25
+ node_path = __toESM(node_path, 1);
26
+ let pdf_lib = require("pdf-lib");
27
+ let playwright_core = require("playwright-core");
28
+ /** What the findings may take on the wire, in bytes. The limit is 65,536; the rest is the envelope, the summary finding and a newline, with room to spare. */
29
+ var FINDINGS_BUDGET = 6e4;
30
+ var RANK = {
31
+ error: 0,
32
+ warning: 1,
33
+ info: 2
34
+ };
35
+ var rank = (severity) => RANK[severity] ?? 3;
36
+ var wire = (finding) => Buffer.byteLength(JSON.stringify(finding), "utf-8") + 1;
37
+ /**
38
+ * The findings as they are when they fit. When they do not, the first ones that fit, errors before warnings before notes and each
39
+ * group in the order it was found, then one `<name>/findings-left-out` warning that says how many are not shown. The summary is a
40
+ * warning so that it never hides that there were errors: the errors come first, and a run with any error is already failed.
41
+ */
42
+ function boundFindings(findings, name) {
43
+ let size = 0;
44
+ for (const finding of findings) size += wire(finding);
45
+ if (size <= 6e4) return findings;
46
+ const ordered = [...findings].sort((a, b) => rank(a.severity) - rank(b.severity));
47
+ const kept = [];
48
+ size = 0;
49
+ for (const finding of ordered) {
50
+ if (size + wire(finding) > 6e4) break;
51
+ size += wire(finding);
52
+ kept.push(finding);
53
+ }
54
+ const left = ordered.length - kept.length;
55
+ kept.push({
56
+ code: `${name}/findings-left-out`,
57
+ severity: "warning",
58
+ path: "findings",
59
+ message: `${left} more findings are not shown, because the answer would not fit the ${FINDINGS_BUDGET.toLocaleString("en-US")} bytes a plugin may print; fix the ones above and run again`
60
+ });
61
+ return kept;
62
+ }
63
+ /** The plugin cannot do what it was asked; the message is the reason blazon shows. */
64
+ var Cannot = class extends Error {};
65
+ /** The builder of a plugin's findings: `findingFor(NAME)('code', severity, path, message)` is a finding coded `NAME/code`. */
66
+ var findingFor = (name) => (code, severity, path, message) => ({
67
+ code: `${name}/${code}`,
68
+ severity,
69
+ path,
70
+ message
71
+ });
72
+ var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
73
+ /** The brand.json a plugin reads: the object when its format and version are the ones this reader understands, Cannot otherwise (RFC 0001: a reader checks both before it interprets anything). */
74
+ function requireBrand(raw) {
75
+ const shown = (value) => JSON.stringify(value) ?? "nothing";
76
+ if (!isObject(raw) || raw.format !== "blazon-brand") throw new Cannot(`the brand in the request is not a blazon brand: its format is ${shown(isObject(raw) ? raw.format : void 0)}, not "blazon-brand"`);
77
+ if (raw.version !== 1) throw new Cannot(`the brand in the request is version ${shown(raw.version)}; this reader understands version 1`);
78
+ return raw;
79
+ }
80
+ /** The request as an object of version 1, or Cannot with the reason. Its role and folders are for the plugin to check. */
81
+ function readRequest(text) {
82
+ let request;
83
+ try {
84
+ request = JSON.parse(text);
85
+ } catch {
86
+ throw new Cannot("the request is not JSON");
87
+ }
88
+ if (!isObject(request)) throw new Cannot("the request is not a JSON object");
89
+ if (request.v !== 1) throw new Cannot(`the request is version ${JSON.stringify(request.v)}; this plugin speaks version 1`);
90
+ return request;
91
+ }
92
+ /** The build request in `text`, or Cannot with the reason: version 1, the build role, a site_dir with an index.html and an out_dir that is a folder. The brand and options are not checked here. */
93
+ function buildJob(text) {
94
+ const request = readRequest(text);
95
+ if (request.type !== "build") throw new Cannot(`the request is for the ${String(request.type)} role; this plugin is a build plugin`);
96
+ const { site_dir: siteDir, out_dir: outDir } = request;
97
+ if (typeof siteDir !== "string" || !node_fs.default.existsSync(node_path.default.join(siteDir, "index.html"))) throw new Cannot("site_dir has no index.html");
98
+ if (typeof outDir !== "string" || !node_fs.default.statSync(outDir, { throwIfNoEntry: false })?.isDirectory()) throw new Cannot("out_dir is not a folder");
99
+ return {
100
+ siteDir,
101
+ outDir,
102
+ brand: request.brand ?? {},
103
+ options: request.options ?? {}
104
+ };
105
+ }
106
+ /**
107
+ * The entry: `--blazon-manifest` prints the manifest; otherwise one request on standard input gets the answer of `build` as
108
+ * JSON, or exit 2 with the reason as the first line of standard output. `failure` starts the reason for an error that is
109
+ * not a Cannot. `name` is the plugin's, for the summary when the findings are bounded to what a call may print (bound.ts). Returns the exit status.
110
+ */
111
+ async function runPlugin(argv, manifest, build, failure, name) {
112
+ if (argv[0] === "--blazon-manifest") {
113
+ process.stdout.write(`${JSON.stringify(manifest)}\n`);
114
+ return 0;
115
+ }
116
+ try {
117
+ const answer = await build(node_fs.default.readFileSync(0, "utf-8"));
118
+ const bounded = isObject(answer) && Array.isArray(answer.findings) ? {
119
+ ...answer,
120
+ findings: boundFindings(answer.findings, name)
121
+ } : answer;
122
+ process.stdout.write(`${JSON.stringify(bounded)}\n`);
123
+ return 0;
124
+ } catch (error) {
125
+ const reason = error instanceof Cannot ? error.message : `${failure}: ${String(error.message ?? error).split("\n")[0].slice(0, 500)}`;
126
+ process.stdout.write(`${reason}\n`);
127
+ return 2;
128
+ }
129
+ }
130
+ var CRC_TABLE = Uint32Array.from({ length: 256 }, (_, n) => {
131
+ let c = n;
132
+ for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
133
+ return c >>> 0;
134
+ });
135
+ function crc32(data) {
136
+ let c = 4294967295;
137
+ for (const byte of data) c = CRC_TABLE[(c ^ byte) & 255] ^ c >>> 8;
138
+ return (c ^ 4294967295) >>> 0;
139
+ }
140
+ /** 2000-01-01 00:00:00 as a DOS date: years since 1980 in the top seven bits, then month, then day */
141
+ var DOS_DATE = 10273;
142
+ /** The entries as a zip file, in the order given. A name is plain ASCII: the callers make theirs so. */
143
+ function zipOf(entries) {
144
+ const parts = [];
145
+ const central = [];
146
+ let offset = 0;
147
+ for (const [name, data] of entries) {
148
+ const body = Buffer.isBuffer(data) ? data : Buffer.from(data, "utf-8");
149
+ const label = Buffer.from(name, "ascii");
150
+ const crc = crc32(body);
151
+ const local = Buffer.alloc(30);
152
+ local.writeUInt32LE(67324752, 0);
153
+ local.writeUInt16LE(20, 4);
154
+ local.writeUInt16LE(0, 6);
155
+ local.writeUInt16LE(0, 8);
156
+ local.writeUInt16LE(0, 10);
157
+ local.writeUInt16LE(DOS_DATE, 12);
158
+ local.writeUInt32LE(crc, 14);
159
+ local.writeUInt32LE(body.length, 18);
160
+ local.writeUInt32LE(body.length, 22);
161
+ local.writeUInt16LE(label.length, 26);
162
+ parts.push(local, label, body);
163
+ const entry = Buffer.alloc(46);
164
+ entry.writeUInt32LE(33639248, 0);
165
+ entry.writeUInt16LE(20, 4);
166
+ local.copy(entry, 6, 4, 30);
167
+ entry.writeUInt32LE(offset, 42);
168
+ central.push(entry, label);
169
+ offset += local.length + label.length + body.length;
170
+ }
171
+ const directory = Buffer.concat(central);
172
+ const end = Buffer.alloc(22);
173
+ end.writeUInt32LE(101010256, 0);
174
+ end.writeUInt16LE(entries.length, 8);
175
+ end.writeUInt16LE(entries.length, 10);
176
+ end.writeUInt32LE(directory.length, 12);
177
+ end.writeUInt32LE(offset, 16);
178
+ return Buffer.concat([
179
+ ...parts,
180
+ directory,
181
+ end
182
+ ]);
183
+ }
184
+ /** A non-empty string (not only whitespace), or undefined. */
185
+ var text = (value) => typeof value === "string" && value.trim() !== "" ? value : void 0;
186
+ /** An asset's id, file, format and category (the first segment of the id when the entry has none); undefined when the entry lacks one of the first three. */
187
+ function readBaseAsset(raw) {
188
+ if (!isObject(raw)) return void 0;
189
+ const [id, file, format] = [
190
+ text(raw.id),
191
+ text(raw.file),
192
+ text(raw.format)
193
+ ];
194
+ if (!id || !file || !format) return void 0;
195
+ return {
196
+ id,
197
+ file,
198
+ format,
199
+ category: text(raw.category) ?? id.split("/")[0]
200
+ };
201
+ }
202
+ /** An asset's sidecar rules: its `meta` object, or an empty one. */
203
+ var readMeta = (raw) => isObject(raw.meta) ? raw.meta : {};
204
+ /** The theme roles that are non-empty strings, by role name. */
205
+ function readRoles(root) {
206
+ const theme = isObject(root.theme) ? root.theme : {};
207
+ const roles = {};
208
+ for (const [name, value] of Object.entries(isObject(theme.roles) ? theme.roles : {})) if (text(value)) roles[name] = value;
209
+ return roles;
210
+ }
211
+ /** The files brand.json names as the logo for a light and for a dark surface. */
212
+ function readLogo(root) {
213
+ const logo = isObject(root.logo) ? root.logo : {};
214
+ return {
215
+ onLight: text(logo.onLight),
216
+ onDark: text(logo.onDark)
217
+ };
218
+ }
219
+ /** The license a token's extensions state: a `license` or `licence` text in any extension's object */
220
+ function licenseOf(extensions) {
221
+ if (!isObject(extensions)) return void 0;
222
+ for (const value of Object.values(extensions)) if (isObject(value)) return text(value.license) ?? text(value.licence);
223
+ }
224
+ function readBrand(brand) {
225
+ const root = requireBrand(brand);
226
+ const theme = isObject(root.theme) ? root.theme : {};
227
+ const roles = readRoles(root);
228
+ const colors = [];
229
+ const fontTokens = [];
230
+ for (const item of Array.isArray(root.tokens) ? root.tokens : []) {
231
+ if (!isObject(item) || typeof item.path !== "string") continue;
232
+ const blazon = isObject(item.blazon) ? item.blazon : {};
233
+ if (item.type === "color") {
234
+ const value = text(item.resolvedValue) ?? text(item.value);
235
+ if (!value) continue;
236
+ const review = isObject(blazon.review) && typeof blazon.review.status === "string" ? {
237
+ status: blazon.review.status,
238
+ note: text(blazon.review.note)
239
+ } : void 0;
240
+ colors.push({
241
+ path: item.path,
242
+ value,
243
+ ...text(item.cssVariable) && { cssVariable: item.cssVariable },
244
+ ...text(item.description) && { description: item.description },
245
+ ...text(item.aliasOf) && { aliasOf: item.aliasOf },
246
+ ...review && { review },
247
+ ...isObject(blazon.print) && { print: blazon.print }
248
+ });
249
+ } else if (item.type === "fontFamily" && !item.aliasOf) {
250
+ const stack = Array.isArray(item.resolvedValue) ? item.resolvedValue.map(String).join(", ") : text(item.value) ?? text(item.resolvedValue);
251
+ const font = isObject(blazon.font) ? blazon.font : {};
252
+ const license = text(font.license) ?? licenseOf(item.extensions);
253
+ if (stack) fontTokens.push({
254
+ path: item.path,
255
+ stack,
256
+ ...license && { license },
257
+ ...text(font.licenseUrl) && { licenseUrl: font.licenseUrl },
258
+ ...text(font.source) && { source: font.source }
259
+ });
260
+ }
261
+ }
262
+ const assets = /* @__PURE__ */ new Map();
263
+ for (const raw of Array.isArray(root.assets) ? root.assets : []) {
264
+ const base = readBaseAsset(raw);
265
+ if (base && isObject(raw)) assets.set(base.id, {
266
+ ...base,
267
+ meta: readMeta(raw)
268
+ });
269
+ }
270
+ const about = isObject(root.brand) ? root.brand : {};
271
+ return {
272
+ title: text(about.title) ?? "Brand",
273
+ named: text(about.title) !== void 0,
274
+ description: text(about.description)?.trim(),
275
+ roles,
276
+ colors,
277
+ fontTokens,
278
+ stylesheets: (Array.isArray(theme.fonts) ? theme.fonts : []).filter((sheet) => typeof sheet === "string"),
279
+ assets,
280
+ logo: readLogo(root)
281
+ };
282
+ }
283
+ var channel = (text, scale) => Math.max(0, Math.min(255, Math.round(text.endsWith("%") ? parseFloat(text) / 100 * 255 : parseFloat(text) * scale)));
284
+ /** A hex or rgb() color as `[r, g, b]`; undefined for anything else (a named color, oklch, a var()). Any alpha is dropped. */
285
+ function parseColor(value) {
286
+ if (typeof value !== "string") return void 0;
287
+ const text = value.trim();
288
+ const hex = /^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(text)?.[1];
289
+ if (hex) {
290
+ const full = hex.length <= 4 ? [...hex].map((c) => c + c).join("") : hex;
291
+ return [
292
+ 0,
293
+ 2,
294
+ 4
295
+ ].map((at) => parseInt(full.slice(at, at + 2), 16));
296
+ }
297
+ const rgb = /^rgba?\(\s*([\d.]+%?)[\s,]+([\d.]+%?)[\s,]+([\d.]+%?)\s*(?:[,/]\s*[\d.]+%?\s*)?\)$/i.exec(text);
298
+ if (rgb) return [
299
+ channel(rgb[1], 1),
300
+ channel(rgb[2], 1),
301
+ channel(rgb[3], 1)
302
+ ];
303
+ }
304
+ var toHex = ([r, g, b]) => [
305
+ r,
306
+ g,
307
+ b
308
+ ].map((part) => part.toString(16).padStart(2, "0")).join("").toUpperCase();
309
+ /** WCAG relative luminance, 0 (black) to 1 (white) */
310
+ function luminance([r, g, b]) {
311
+ const [lr, lg, lb] = [
312
+ r,
313
+ g,
314
+ b
315
+ ].map((part) => {
316
+ const v = part / 255;
317
+ return v <= .03928 ? v / 12.92 : ((v + .055) / 1.055) ** 2.4;
318
+ });
319
+ return .2126 * lr + .7152 * lg + .0722 * lb;
320
+ }
321
+ /** The plugin's name, which blazon's config names it by, and the prefix of its finding codes */
322
+ var NAME = "blazon.press-kit";
323
+ var MANIFEST = {
324
+ v: 2,
325
+ roles: ["build"],
326
+ title: "Press kit",
327
+ description: "Packs the brand's logos, colors, fonts and boilerplate for outsiders into one folder and one zip, with an optional one-page PDF.",
328
+ version: "1.0.0",
329
+ timeout_ms: 6e4,
330
+ env: [
331
+ "BLAZON_CHROME",
332
+ "HOME",
333
+ "TMPDIR"
334
+ ]
335
+ };
336
+ /** The job a build request asks for, or Cannot with the reason. The options are checked later, and wrong ones are findings. */
337
+ function jobFor(text) {
338
+ return buildJob(text);
339
+ }
340
+ var KEYS = [
341
+ "name",
342
+ "pdf",
343
+ "unreviewed",
344
+ "logos"
345
+ ];
346
+ var finding = findingFor(NAME);
347
+ var invalid = (message) => finding("option-invalid", "error", "options", message);
348
+ /** A text as a file name: letters, digits, dots, hyphens and underscores, so it is plain ASCII and cannot leave the folder. */
349
+ var fileName = (text) => text.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^[-.]+/, "") || "file";
350
+ /**
351
+ * The options as the kit uses them, and an `option-invalid` finding for each thing wrong. Nothing here throws: the options are the
352
+ * person's, not the request's. A wrong option is left at its default and the rest is written. `logoIds` are the assets that are logos.
353
+ */
354
+ function parseOptions(raw, logoIds) {
355
+ const findings = [];
356
+ const options = {
357
+ name: "press-kit",
358
+ pdf: true,
359
+ unreviewed: false
360
+ };
361
+ if (!isObject(raw)) return {
362
+ options,
363
+ findings: [invalid("options must be an object")]
364
+ };
365
+ for (const key of Object.keys(raw)) if (!KEYS.includes(key)) findings.push(invalid(`unknown option "${key}"; the options are ${KEYS.join(", ")}`));
366
+ if (raw.name !== void 0) {
367
+ if (typeof raw.name !== "string" || !/^[A-Za-z0-9_-][A-Za-z0-9._-]{0,63}$/.test(raw.name)) findings.push(invalid("name must be a file name of letters, digits, dots, hyphens and underscores, not starting with a dot, up to 64 characters, with no extension"));
368
+ else options.name = raw.name;
369
+ }
370
+ if (raw.pdf !== void 0) {
371
+ if (typeof raw.pdf !== "boolean") findings.push(invalid("pdf must be true or false"));
372
+ else options.pdf = raw.pdf;
373
+ }
374
+ if (raw.unreviewed !== void 0) {
375
+ if (typeof raw.unreviewed !== "boolean") findings.push(invalid("unreviewed must be true or false"));
376
+ else options.unreviewed = raw.unreviewed;
377
+ }
378
+ if (raw.logos !== void 0) {
379
+ if (!Array.isArray(raw.logos) || raw.logos.length === 0 || raw.logos.some((id) => typeof id !== "string")) findings.push(invalid("logos must be a non-empty list of asset ids"));
380
+ else {
381
+ const ids = raw.logos;
382
+ const bad = ids.filter((id) => !logoIds.has(id));
383
+ for (const id of bad) findings.push(invalid(`logos names ${JSON.stringify(id)}, which the brand has no logo for`));
384
+ const known = ids.filter((id) => logoIds.has(id));
385
+ if (known.length > 0) options.logos = known;
386
+ }
387
+ }
388
+ return {
389
+ options,
390
+ findings
391
+ };
392
+ }
393
+ var PLAIN = /^(#([0-9a-f]{3}|[0-9a-f]{6})|rgb\(\s*[\d.]+%?[\s,]+[\d.]+%?[\s,]+[\d.]+%?\s*\))$/i;
394
+ var cssName = (path) => `--${path.replace(/[^A-Za-z0-9_-]+/g, "-").toLowerCase()}`;
395
+ function planColors(brand, options = {}) {
396
+ const findings = [];
397
+ const byPath = new Map(brand.colors.map((token) => [token.path, token]));
398
+ /** The color a token is, following its aliases to the one that has a value of its own */
399
+ const rootOf = (token) => {
400
+ const seen = /* @__PURE__ */ new Set();
401
+ let at = token;
402
+ while (at.aliasOf && byPath.has(at.aliasOf) && !seen.has(at.path)) {
403
+ seen.add(at.path);
404
+ at = byPath.get(at.aliasOf);
405
+ }
406
+ return at;
407
+ };
408
+ const colors = /* @__PURE__ */ new Map();
409
+ for (const token of brand.colors) {
410
+ if (token.aliasOf) continue;
411
+ const unreviewed = token.review?.status === "needs-review";
412
+ if (unreviewed && !options.unreviewed) {
413
+ findings.push(finding("color-left-out", "warning", token.path, `${token.path} is left out of the kit because its token marks it needs-review${token.review.note ? `: ${token.review.note}` : ""}; set the unreviewed option to true to include it, labelled as unreviewed`));
414
+ continue;
415
+ }
416
+ const rgb = PLAIN.test(token.value.trim()) ? parseColor(token.value) : void 0;
417
+ if (!rgb) findings.push(finding("color-not-hex", "info", token.path, `${token.path} is written as ${token.value}, which is not a hex or rgb() color, so the kit gives it as written and states no hex or RGB`));
418
+ colors.set(token.path, {
419
+ path: token.path,
420
+ ...token.description && { description: token.description },
421
+ value: token.value,
422
+ ...rgb && {
423
+ hex: `#${toHex(rgb)}`,
424
+ rgb
425
+ },
426
+ cssVariable: token.cssVariable?.startsWith("--") ? token.cssVariable : cssName(token.path),
427
+ usedAs: [],
428
+ ...unreviewed && { review: "needs-review" },
429
+ ...token.print && (token.print.cmyk || token.print.pms || token.print.ral) && { print: token.print }
430
+ });
431
+ }
432
+ for (const token of brand.colors) {
433
+ if (!token.aliasOf) continue;
434
+ const root = rootOf(token);
435
+ if (!root.aliasOf) colors.get(root.path)?.usedAs.push(token.path);
436
+ }
437
+ const list = [...colors.values()];
438
+ if (list.length === 0) findings.push(finding("color-none", "warning", "tokens", "the brand has no color token to put in the kit, so it carries no colors"));
439
+ return {
440
+ colors: list,
441
+ findings
442
+ };
443
+ }
444
+ var colorsJson = (colors) => `${JSON.stringify({ colors }, null, 2)}\n`;
445
+ function colorsCss(colors) {
446
+ const lines = [":root {"];
447
+ for (const color of colors) lines.push(` ${color.cssVariable}: ${color.value};`);
448
+ lines.push("}");
449
+ return `${lines.join("\n")}\n`;
450
+ }
451
+ function colorsText(colors) {
452
+ const lines = ["Colors", ""];
453
+ for (const color of colors) {
454
+ const name = color.description && color.description.length <= 60 ? `${color.description} (${color.path})` : color.path;
455
+ lines.push(color.review ? `${name} (unreviewed)` : name);
456
+ if (color.hex) lines.push(` HEX ${color.hex}`, ` RGB ${color.rgb.join(", ")}`);
457
+ else lines.push(` As written ${color.value}`);
458
+ if (color.print?.cmyk) lines.push(` CMYK ${color.print.cmyk.join(", ")}`);
459
+ if (color.print?.pms) lines.push(` Pantone ${color.print.pms}`);
460
+ if (color.print?.ral) lines.push(` RAL ${color.print.ral}`);
461
+ if (color.usedAs.length > 0) lines.push(` Also named ${color.usedAs.join(", ")}`);
462
+ lines.push("");
463
+ }
464
+ return `${lines.join("\n").trimEnd()}\n`;
465
+ }
466
+ var GENERIC = /* @__PURE__ */ new Set([
467
+ "serif",
468
+ "sans-serif",
469
+ "monospace",
470
+ "cursive",
471
+ "fantasy",
472
+ "system-ui",
473
+ "ui-sans-serif",
474
+ "ui-serif",
475
+ "ui-monospace",
476
+ "ui-rounded",
477
+ "emoji",
478
+ "math",
479
+ "fangsong"
480
+ ]);
481
+ /** The families of a CSS font stack, unquoted, in order */
482
+ function families(stack) {
483
+ return [...stack.matchAll(/"([^"]+)"|'([^']+)'|([^,]+)/g)].map((match) => (match[1] ?? match[2] ?? match[3]).trim()).filter((name) => name !== "");
484
+ }
485
+ /** The first family of the stack that names a font: not a generic, not a var(). */
486
+ var fontOf = (stack) => stack ? families(stack).find((name) => !GENERIC.has(name.toLowerCase()) && !/[()]/.test(name)) : void 0;
487
+ var NOT_STATED = "not stated";
488
+ var ROLES = [["fontDisplay", "headings (the fontDisplay role)"], ["fontBody", "running text (the fontBody role)"]];
489
+ /** The families a stylesheet loads and where it is from: Google Fonts names them in the URL; a data: stylesheet in its @font-face rules */
490
+ function stylesheetFamilies(sheet) {
491
+ if (sheet.startsWith("data:")) {
492
+ const body = sheet.slice(sheet.indexOf(",") + 1);
493
+ let css;
494
+ try {
495
+ css = /;base64,/.test(sheet.slice(0, sheet.indexOf(",") + 1)) ? Buffer.from(body, "base64").toString("utf-8") : decodeURIComponent(body);
496
+ } catch {
497
+ return;
498
+ }
499
+ return {
500
+ names: [...css.matchAll(/font-family:\s*(?:"([^"]+)"|'([^']+)'|([^;}"']+))/g)].map((match) => (match[1] ?? match[2] ?? match[3]).trim()),
501
+ source: () => "a font file the brand embeds in its brand book; the file is not in this kit"
502
+ };
503
+ }
504
+ try {
505
+ const url = new URL(sheet);
506
+ if (url.hostname !== "fonts.googleapis.com") return void 0;
507
+ return {
508
+ names: url.searchParams.getAll("family").map((family) => family.split(":")[0].replace(/\+/g, " ").trim()),
509
+ source: (name) => `Google Fonts, https://fonts.googleapis.com/css2?family=${encodeURIComponent(name).replace(/%20/g, "+")}`
510
+ };
511
+ } catch {
512
+ return;
513
+ }
514
+ }
515
+ function planFonts(brand) {
516
+ const families = /* @__PURE__ */ new Map();
517
+ const add = (name, usedFor, stated) => {
518
+ const family = families.get(name.toLowerCase()) ?? {
519
+ name,
520
+ usedFor: []
521
+ };
522
+ if (usedFor && !family.usedFor.includes(usedFor)) family.usedFor.push(usedFor);
523
+ family.license ??= stated?.license;
524
+ family.licenseUrl ??= stated?.licenseUrl;
525
+ family.source ??= stated?.source;
526
+ families.set(name.toLowerCase(), family);
527
+ };
528
+ for (const [role, label] of ROLES) {
529
+ const name = fontOf(brand.roles[role]);
530
+ if (name) add(name, label);
531
+ }
532
+ for (const token of brand.fontTokens) {
533
+ const name = fontOf(token.stack);
534
+ if (name) add(name, token.path, token);
535
+ }
536
+ const sources = /* @__PURE__ */ new Map();
537
+ for (const sheet of brand.stylesheets) {
538
+ const read = stylesheetFamilies(sheet);
539
+ if (!read) continue;
540
+ for (const name of read.names) {
541
+ add(name);
542
+ sources.set(name.toLowerCase(), read.source(name));
543
+ }
544
+ }
545
+ const findings = [];
546
+ if (families.size === 0) {
547
+ findings.push(finding("font-none", "warning", "theme.roles", "the brand names no font, so the kit has no fonts.txt"));
548
+ return { findings };
549
+ }
550
+ const lines = ["Fonts", ""];
551
+ const unlicensed = [];
552
+ for (const family of families.values()) {
553
+ lines.push(family.name);
554
+ if (family.usedFor.length > 0) lines.push(` Used for: ${family.usedFor.join(", ")}`);
555
+ lines.push(` Source: ${family.source ?? sources.get(family.name.toLowerCase()) ?? NOT_STATED}`);
556
+ if (family.license) {
557
+ lines.push(" License:", ...family.license.split("\n").map((line) => ` ${line}`.trimEnd()));
558
+ if (family.licenseUrl) lines.push(` License text: ${family.licenseUrl}`);
559
+ } else if (family.licenseUrl) lines.push(` License: see ${family.licenseUrl}`);
560
+ else {
561
+ lines.push(` License: ${NOT_STATED}`);
562
+ unlicensed.push(family.name);
563
+ }
564
+ lines.push("");
565
+ }
566
+ if (unlicensed.length > 0) findings.push(finding("font-license-unstated", "warning", "fonts", `${unlicensed.length} ${unlicensed.length === 1 ? "font has" : "fonts have"} no license stated: ${unlicensed.join(", ")}; fonts.txt says "license not stated" for each`));
567
+ return {
568
+ text: `${lines.join("\n").trimEnd()}\n`,
569
+ findings
570
+ };
571
+ }
572
+ /** The families the brand embeds as font files, lower case: the only ones the PDF is certain to set text in */
573
+ function embeddedFamilies(stylesheets) {
574
+ return new Set(stylesheets.filter((sheet) => sheet.startsWith("data:")).flatMap((sheet) => stylesheetFamilies(sheet)?.names ?? []).map((name) => name.toLowerCase()));
575
+ }
576
+ /** The display and body families the brand names that the PDF cannot count on: it fetches nothing, so any not embedded falls back */
577
+ function pdfFallbacks(brand) {
578
+ const embedded = embeddedFamilies(brand.stylesheets);
579
+ const named = [fontOf(brand.roles.fontDisplay), fontOf(brand.roles.fontBody)].filter((name) => name !== void 0);
580
+ return [...new Set(named)].filter((name) => !embedded.has(name.toLowerCase()));
581
+ }
582
+ /** A rem is read as 16px: a sidecar states no root size, and the browser default is the only honest guess. */
583
+ var REM_PX = 16;
584
+ var dimensionToPx = (d) => d.unit === "rem" ? d.value * REM_PX : d.value;
585
+ /** The folder of the kit for each kind of background; the names say it to a person who has read nothing else */
586
+ var FOLDERS = {
587
+ light: "on-light-backgrounds",
588
+ dark: "on-dark-backgrounds",
589
+ unstated: "background-not-stated"
590
+ };
591
+ var isLogo = (brand, asset) => asset.category === "logos" || asset.file === brand.logo.onLight || asset.file === brand.logo.onDark;
592
+ /** The ids of the brand's logos */
593
+ var logoIds = (brand) => new Set([...brand.assets.values()].filter((asset) => isLogo(brand, asset)).map((asset) => asset.id));
594
+ /** The surface a logo is made for: its sidecar says; without that, brand.json's own pairing; else not stated. */
595
+ function surfaceOf(asset, brand) {
596
+ if (asset.meta.background) return asset.meta.background;
597
+ if (asset.file === brand.logo.onDark) return "dark";
598
+ return asset.file === brand.logo.onLight ? "light" : "unstated";
599
+ }
600
+ /** Why a logo must not go out, or undefined when it may */
601
+ function holdBack(asset) {
602
+ const { review, generated } = asset.meta;
603
+ if (review?.status === "needs-review") return `its sidecar marks it needs-review${review.note ? `: ${review.note}` : ""}`;
604
+ if (generated && !review) return `it was generated by ${generated.by} and nobody has confirmed it: set review.status to ok once a person has checked it`;
605
+ }
606
+ function chooseLogos(brand, options) {
607
+ const findings = [];
608
+ const pool = [...brand.assets.values()].filter((asset) => isLogo(brand, asset) && (!options.logos || options.logos.includes(asset.id)));
609
+ pool.sort((a, b) => (a.meta.order ?? Infinity) - (b.meta.order ?? Infinity) || a.id.localeCompare(b.id));
610
+ const chosen = [];
611
+ const taken = /* @__PURE__ */ new Set();
612
+ for (const asset of pool) {
613
+ const why = holdBack(asset);
614
+ if (why) {
615
+ findings.push(finding("logo-left-out", "warning", asset.id, `${asset.id} is left out of the kit because ${why}`));
616
+ continue;
617
+ }
618
+ const surface = surfaceOf(asset, brand);
619
+ const base = fileName(asset.file.split("/").pop());
620
+ let kitPath = `logos/${FOLDERS[surface]}/${base}`;
621
+ if (taken.has(kitPath)) kitPath = `logos/${FOLDERS[surface]}/${fileName(asset.id)}-${base}`;
622
+ taken.add(kitPath);
623
+ chosen.push({
624
+ asset,
625
+ surface,
626
+ kitPath
627
+ });
628
+ }
629
+ if (chosen.length === 0) findings.push(finding("logo-none", "warning", "assets", "no logo is ready to go in the kit, so it carries none"));
630
+ else {
631
+ for (const surface of ["light", "dark"]) if (!chosen.some((item) => item.surface === surface)) findings.push(finding("logo-no-variant", "warning", "logo", `no logo in the kit is made for ${surface} backgrounds, so its ${FOLDERS[surface]} folder is not there`));
632
+ const unstated = chosen.filter((item) => item.surface === "unstated");
633
+ if (unstated.length > 0) findings.push(finding("logo-background-unstated", "info", unstated[0].asset.id, `${unstated.map((item) => item.asset.id).join(", ")} state no background in a sidecar, so they sit in ${FOLDERS.unstated} and a reader must choose`));
634
+ }
635
+ return {
636
+ chosen,
637
+ findings
638
+ };
639
+ }
640
+ function measureText(measure, meta) {
641
+ if ("units" in measure) return `${measure.units} unit${measure.units === 1 ? "" : "s"}${meta.unit ? ` (one unit is ${dimensionToPx(meta.unit)} px)` : ""}`;
642
+ return `${measure.value} ${measure.unit}`;
643
+ }
644
+ var dimensionsText = (size) => [size.width && `${dimensionToPx(size.width)} px wide`, size.height && `${dimensionToPx(size.height)} px high`].filter(Boolean).join(" and ");
645
+ /** The logos as a page of plain text: which file is for which background, and the rules its sidecar states. Only what a sidecar says. */
646
+ function logosText(chosen) {
647
+ const lines = [
648
+ "Logos",
649
+ "",
650
+ "Each logo is the original file. Use the file in the folder named for the background it goes on.",
651
+ ""
652
+ ];
653
+ for (const surface of [
654
+ "light",
655
+ "dark",
656
+ "unstated"
657
+ ]) {
658
+ const items = chosen.filter((item) => item.surface === surface);
659
+ if (items.length === 0) continue;
660
+ const heading = surface === "unstated" ? `Background not stated (${FOLDERS[surface]}/)` : `For ${surface} backgrounds (${FOLDERS[surface]}/)`;
661
+ lines.push(heading, "-".repeat(heading.length), "");
662
+ for (const { asset, kitPath } of items) {
663
+ const { meta } = asset;
664
+ lines.push(kitPath.split("/").pop());
665
+ if (meta.description) lines.push(` ${meta.description}`);
666
+ if (meta.lockup) lines.push(` Lockup: ${meta.lockup}`);
667
+ if (meta.clearSpace) lines.push(` Clear space on every side: ${measureText(meta.clearSpace, meta)}`);
668
+ if (meta.minSize) lines.push(` Smallest size: ${dimensionsText(meta.minSize)}`);
669
+ if (meta.maxSize) lines.push(` Largest size: ${dimensionsText(meta.maxSize)}`);
670
+ if (meta.ink) lines.push(` Main color: ${meta.ink}`);
671
+ lines.push("");
672
+ }
673
+ }
674
+ return `${lines.join("\n").trimEnd()}\n`;
675
+ }
676
+ var INSTALL_HINT = "install Google Chrome, or set BLAZON_CHROME to a Chrome or Chromium program";
677
+ /**
678
+ * The browser: the program BLAZON_CHROME names, else the Google Chrome installed on this computer. It never downloads one.
679
+ * `what` completes "no browser to ...", such as "print with".
680
+ */
681
+ async function launchChrome(env, what) {
682
+ const named = env.BLAZON_CHROME;
683
+ if (named) {
684
+ if (!isProgram(named)) throw new Cannot(`no browser to ${what}: BLAZON_CHROME names ${named}, which is not a program; ${INSTALL_HINT}`);
685
+ return playwright_core.chromium.launch({ executablePath: named });
686
+ }
687
+ try {
688
+ return await playwright_core.chromium.launch({ channel: "chrome" });
689
+ } catch {
690
+ throw new Cannot(`no browser to ${what}: ${INSTALL_HINT}`);
691
+ }
692
+ }
693
+ function isProgram(file) {
694
+ try {
695
+ node_fs.default.accessSync(file, node_fs.default.constants.X_OK);
696
+ return node_fs.default.statSync(file).isFile();
697
+ } catch {
698
+ return false;
699
+ }
700
+ }
701
+ var PAGE = {
702
+ width: 1123,
703
+ height: 794
704
+ };
705
+ var MAX_SWATCHES = 10;
706
+ var MEDIA = {
707
+ svg: "image/svg+xml",
708
+ png: "image/png",
709
+ jpg: "image/jpeg",
710
+ gif: "image/gif",
711
+ webp: "image/webp",
712
+ avif: "image/avif"
713
+ };
714
+ var escape = (text) => text.replace(/[&<>"']/g, (char) => `&#${char.charCodeAt(0)};`);
715
+ /** A family name as a CSS string: nothing in a name can end it */
716
+ var quoted = (name) => `"${name.replace(/[^A-Za-z0-9 _.-]+/g, "")}"`;
717
+ function pageHtml({ brand, colors, logo }) {
718
+ const display = fontOf(brand.roles.fontDisplay);
719
+ const body = fontOf(brand.roles.fontBody);
720
+ const stack = (name, generic) => [name && quoted(name), generic].filter(Boolean).join(", ");
721
+ const swatches = colors.filter((color) => color.hex).slice(0, MAX_SWATCHES);
722
+ const more = colors.length - swatches.length;
723
+ const sheets = brand.stylesheets.filter((sheet) => sheet.startsWith("data:text/css")).map((sheet) => `<link rel="stylesheet" href="${escape(sheet)}">`);
724
+ const dark = logo?.surface === "dark";
725
+ const image = logo ? `<img alt="" src="data:${MEDIA[logo.format] ?? "application/octet-stream"};base64,${logo.data.toString("base64")}">` : "";
726
+ const chips = swatches.map((color) => {
727
+ const ink = luminance(parseColor(color.hex)) > .4 ? "#111" : "#fff";
728
+ return `<li style="background:${color.hex};color:${ink}"><b>${escape(color.description && color.description.length <= 30 ? color.description : color.path.split(".").pop() ?? color.path)}</b><span>${color.hex}</span></li>`;
729
+ });
730
+ return `<!doctype html><meta charset="utf-8"><title>${escape(brand.title)}</title>${sheets.join("")}<style>
731
+ @page{size:${PAGE.width}px ${PAGE.height}px;margin:0}
732
+ *{box-sizing:border-box}html,body{margin:0}
733
+ body{width:${PAGE.width}px;height:${PAGE.height}px;display:grid;grid-template-columns:40% 60%;font:18px/1.5 ${stack(body, "sans-serif")};color:#161616;background:#fff}
734
+ .logo{display:flex;align-items:center;justify-content:center;padding:64px;background:${dark ? "#161616" : "#f4f4f2"}}
735
+ .logo img{max-width:100%;max-height:280px}
736
+ main{display:flex;flex-direction:column;justify-content:space-between;padding:64px}
737
+ h1{margin:0 0 16px;font:700 56px/1.05 ${stack(display, "sans-serif")}}
738
+ p{margin:0;max-width:34em;color:#444}
739
+ ul{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(5,1fr);gap:10px}
740
+ li{height:96px;padding:10px 12px;display:flex;flex-direction:column;justify-content:flex-end;font-size:13px;line-height:1.3;border:1px solid #0002}
741
+ li b{font-weight:600}
742
+ small{display:block;margin-top:12px;color:#666;font-size:13px}
743
+ </style><body><section class="logo">${image}</section><main><div><h1>${escape(brand.title)}</h1>${brand.description ? `<p>${escape(brand.description)}</p>` : ""}</div><div><ul>${chips.join("")}</ul>${more > 0 ? `<small>${more} more in colors/colors.txt</small>` : ""}</div></main>`;
744
+ }
745
+ /** The page as a PDF, with the dates and the producer fixed so the same brand gives the same bytes */
746
+ async function drawPdf(input, env) {
747
+ const browser = await launchChrome(env, "draw the PDF with");
748
+ try {
749
+ const page = await browser.newPage({ viewport: PAGE });
750
+ await page.route("**/*", (route) => route.abort());
751
+ await page.setContent(pageHtml(input));
752
+ await page.evaluate(async () => {
753
+ await document.fonts.ready;
754
+ await Promise.all([...document.images].map((image) => image.decode().catch(() => void 0)));
755
+ });
756
+ const printed = await page.pdf({
757
+ width: `${PAGE.width}px`,
758
+ height: `${PAGE.height}px`,
759
+ printBackground: true,
760
+ preferCSSPageSize: true
761
+ });
762
+ const pdf = await pdf_lib.PDFDocument.load(printed);
763
+ pdf.setTitle(`${input.brand.title}: press kit`);
764
+ pdf.setCreator("blazon.press-kit");
765
+ pdf.setProducer("blazon.press-kit");
766
+ pdf.setCreationDate(/* @__PURE__ */ new Date(0));
767
+ pdf.setModificationDate(/* @__PURE__ */ new Date(0));
768
+ return Buffer.from(await pdf.save({ useObjectStreams: false }));
769
+ } finally {
770
+ await browser.close();
771
+ }
772
+ }
773
+ /** The file at `file` in the built site, or undefined when it is not there or leaves the site by a path or a link */
774
+ function siteFile(siteDir, file) {
775
+ const root = node_fs.default.realpathSync(siteDir);
776
+ const full = node_path.default.resolve(root, file);
777
+ if (!full.startsWith(root + node_path.default.sep) || !node_fs.default.existsSync(full) || !node_fs.default.statSync(full).isFile()) return void 0;
778
+ const real = node_fs.default.realpathSync(full);
779
+ return real.startsWith(root + node_path.default.sep) ? node_fs.default.readFileSync(real) : void 0;
780
+ }
781
+ /** about.txt: the name and the description, as the boilerplate to quote. Without a description it says so in one line, and a brand with no name has no file. */
782
+ function aboutText(brand) {
783
+ if (!brand.named) return { findings: [] };
784
+ if (!brand.description) return {
785
+ text: `${brand.title}\n\nNo description is set in blazon.json.\n`,
786
+ findings: [finding("about-no-description", "warning", "brand.description", "the brand has no description, so about.txt says none is set")]
787
+ };
788
+ return {
789
+ text: `${brand.title}\n\n${brand.description}\n`,
790
+ findings: []
791
+ };
792
+ }
793
+ /** What each part of the kit is for, in the order the README lists them; a part is listed when a file of the kit starts or ends as `match` says */
794
+ var PARTS = [
795
+ {
796
+ match: (path) => path.startsWith("logos/"),
797
+ says: "The logo files as they are. Use the ones in on-light-backgrounds/ on a light background and the ones in on-dark-backgrounds/ on a dark one. logos.txt says what the brand states about each."
798
+ },
799
+ {
800
+ match: (path) => path.startsWith("colors/"),
801
+ says: "The brand colors: colors.txt to read, colors.css for a web page, colors.json for a program."
802
+ },
803
+ {
804
+ match: (path) => path === "fonts.txt",
805
+ says: "The fonts the brand uses, where each comes from, and under what license, where the brand states one."
806
+ },
807
+ {
808
+ match: (path) => path === "about.txt",
809
+ says: "The brand name and a short description, to quote."
810
+ },
811
+ {
812
+ match: (path) => path.endsWith(".pdf"),
813
+ says: "One page with the name, the description, the colors and a logo."
814
+ }
815
+ ];
816
+ /** README.txt: what is in the kit, in plain words. It names only the parts that are there, and holds no date. */
817
+ function readmeText(title, paths, name) {
818
+ const lines = [
819
+ `${title}: press kit`,
820
+ "",
821
+ "What is in this folder",
822
+ ""
823
+ ];
824
+ for (const { match, says } of PARTS) {
825
+ const hit = paths.find(match);
826
+ if (hit) lines.push(` ${(hit.startsWith("logos/") || hit.startsWith("colors/") ? `${hit.split("/")[0]}/` : hit).padEnd(16)}${says}`);
827
+ }
828
+ lines.push("", `${name}.zip holds the same files.`, "", "The logos are the brand's own files, not redrawn.");
829
+ return `${lines.join("\n")}\n`;
830
+ }
831
+ async function build(text) {
832
+ const job = jobFor(text);
833
+ const brand = readBrand(job.brand);
834
+ const { options, findings } = parseOptions(job.options, logoIds(brand));
835
+ /** The kit's files by their path inside it */
836
+ const files = /* @__PURE__ */ new Map();
837
+ const logos = chooseLogos(brand, options);
838
+ findings.push(...logos.findings);
839
+ const data = /* @__PURE__ */ new Map();
840
+ const present = logos.chosen.filter((item) => {
841
+ const file = siteFile(job.siteDir, item.asset.file);
842
+ if (!file) findings.push(finding("file-missing", "error", item.asset.id, `${item.asset.id} is not in the built site at ${item.asset.file}`));
843
+ else data.set(item.asset.id, file);
844
+ return file;
845
+ });
846
+ for (const item of present) files.set(item.kitPath, data.get(item.asset.id));
847
+ if (present.length > 0) files.set("logos/logos.txt", logosText(present));
848
+ const colors = planColors(brand, options);
849
+ findings.push(...colors.findings);
850
+ if (colors.colors.length > 0) {
851
+ files.set("colors/colors.json", colorsJson(colors.colors));
852
+ files.set("colors/colors.css", colorsCss(colors.colors));
853
+ files.set("colors/colors.txt", colorsText(colors.colors));
854
+ }
855
+ const fonts = planFonts(brand);
856
+ findings.push(...fonts.findings);
857
+ if (fonts.text) files.set("fonts.txt", fonts.text);
858
+ const about = aboutText(brand);
859
+ findings.push(...about.findings);
860
+ if (about.text) files.set("about.txt", about.text);
861
+ if (options.pdf) {
862
+ const shown = present.find((item) => item.surface === "light") ?? present[0];
863
+ try {
864
+ const pdf = await drawPdf({
865
+ brand,
866
+ colors: colors.colors,
867
+ logo: shown && {
868
+ data: data.get(shown.asset.id),
869
+ format: shown.asset.format,
870
+ surface: shown.surface
871
+ }
872
+ }, process.env);
873
+ files.set(`${options.name}.pdf`, pdf);
874
+ const fallen = pdfFallbacks(brand);
875
+ if (fallen.length > 0) findings.push(finding("pdf-font-fallback", "info", "theme.roles", `the PDF is not set in ${fallen.join(" or ")}: the brand names ${fallen.length === 1 ? "it" : "them"} but does not embed a font file, and the plugin fetches none, so Chrome sets the text in a font it has. To embed ${fallen.length === 1 ? "it" : "one"}, list its file in \`fonts\` of blazon.json as {"family": name, "file": path} (only if its license allows embedding)`));
876
+ } catch (error) {
877
+ const reason = String(error.message ?? error).split("\n")[0].slice(0, 300);
878
+ findings.push(finding("pdf-skipped", "warning", "options.pdf", `${options.name}.pdf is not in the kit: ${reason}`));
879
+ }
880
+ }
881
+ files.set("README.txt", readmeText(brand.title, [...files.keys()], options.name));
882
+ const entries = [...files].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
883
+ const folder = node_path.default.join(job.outDir, options.name);
884
+ node_fs.default.rmSync(folder, {
885
+ recursive: true,
886
+ force: true
887
+ });
888
+ for (const [file, content] of entries) {
889
+ node_fs.default.mkdirSync(node_path.default.dirname(node_path.default.join(folder, file)), { recursive: true });
890
+ node_fs.default.writeFileSync(node_path.default.join(folder, file), content);
891
+ }
892
+ node_fs.default.writeFileSync(node_path.default.join(job.outDir, `${options.name}.zip`), zipOf(entries.map(([file, content]) => [`${options.name}/${file}`, content])));
893
+ return { findings };
894
+ }
895
+ runPlugin(process.argv.slice(2), MANIFEST, build, "the press kit could not be written", NAME).then((code) => {
896
+ process.exitCode = code;
897
+ });