@iksnerd/blazon 0.3.3 → 0.5.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 (121) hide show
  1. package/CHANGELOG.md +375 -0
  2. package/dist/chunks/{site-builder-DlaZeZHi.js → site-builder-C8g2sfUv.js} +3471 -3650
  3. package/dist/cli/commands/approvals.d.ts +1 -1
  4. package/dist/cli/commands/approvals.d.ts.map +1 -1
  5. package/dist/cli/commands/mcp-check.d.ts +7 -4
  6. package/dist/cli/commands/mcp-check.d.ts.map +1 -1
  7. package/dist/cli/errors.d.ts +3 -1
  8. package/dist/cli/errors.d.ts.map +1 -1
  9. package/dist/cli/folder-first.d.ts +7 -0
  10. package/dist/cli/folder-first.d.ts.map +1 -0
  11. package/dist/cli/handlers/can.d.ts +1 -1
  12. package/dist/cli/handlers/can.d.ts.map +1 -1
  13. package/dist/cli/handlers/list.d.ts.map +1 -1
  14. package/dist/cli/index.js +1384 -1033
  15. package/dist/cli/json.d.ts +3 -2
  16. package/dist/cli/json.d.ts.map +1 -1
  17. package/dist/cli/operations.d.ts +1 -1
  18. package/dist/cli/operations.d.ts.map +1 -1
  19. package/dist/cli/read.d.ts +4 -1
  20. package/dist/cli/read.d.ts.map +1 -1
  21. package/dist/cli/where.d.ts +2 -0
  22. package/dist/cli/where.d.ts.map +1 -1
  23. package/dist/core/assets/representations.d.ts +44 -0
  24. package/dist/core/assets/representations.d.ts.map +1 -0
  25. package/dist/core/assets/scanner.d.ts.map +1 -1
  26. package/dist/core/assets/sidecar.d.ts.map +1 -1
  27. package/dist/core/blazon-pin.d.ts +19 -1
  28. package/dist/core/blazon-pin.d.ts.map +1 -1
  29. package/dist/core/brand/export.d.ts +13 -5
  30. package/dist/core/brand/export.d.ts.map +1 -1
  31. package/dist/core/brand/schema.d.ts +68 -0
  32. package/dist/core/brand/schema.d.ts.map +1 -1
  33. package/dist/core/checker/approvals.d.ts +5 -0
  34. package/dist/core/checker/approvals.d.ts.map +1 -1
  35. package/dist/core/checker/catalogue.d.ts +37 -7
  36. package/dist/core/checker/catalogue.d.ts.map +1 -1
  37. package/dist/core/checker/font-meta.d.ts.map +1 -1
  38. package/dist/core/checker/index.d.ts +5 -0
  39. package/dist/core/checker/index.d.ts.map +1 -1
  40. package/dist/core/checker/review.d.ts +19 -1
  41. package/dist/core/checker/review.d.ts.map +1 -1
  42. package/dist/core/docs/directives.d.ts +10 -0
  43. package/dist/core/docs/directives.d.ts.map +1 -1
  44. package/dist/core/docs/parser.d.ts.map +1 -1
  45. package/dist/core/font-roles.d.ts +11 -0
  46. package/dist/core/font-roles.d.ts.map +1 -0
  47. package/dist/core/index.d.ts.map +1 -1
  48. package/dist/core/init/from-site/fonts.d.ts.map +1 -1
  49. package/dist/core/logo/colorways.d.ts +29 -0
  50. package/dist/core/logo/colorways.d.ts.map +1 -0
  51. package/dist/core/logo/misuse.d.ts +18 -0
  52. package/dist/core/logo/misuse.d.ts.map +1 -0
  53. package/dist/core/mcp-config.d.ts +7 -0
  54. package/dist/core/mcp-config.d.ts.map +1 -1
  55. package/dist/core/operations/check.d.ts +1 -1
  56. package/dist/core/operations/check.d.ts.map +1 -1
  57. package/dist/core/operations/index.d.ts +1 -1
  58. package/dist/core/operations/index.d.ts.map +1 -1
  59. package/dist/core/operations/limits.d.ts +2 -0
  60. package/dist/core/operations/limits.d.ts.map +1 -1
  61. package/dist/core/operations/list.d.ts.map +1 -1
  62. package/dist/core/operations/types.d.ts +13 -0
  63. package/dist/core/operations/types.d.ts.map +1 -1
  64. package/dist/core/preflight.d.ts.map +1 -1
  65. package/dist/core/read/can.d.ts +14 -3
  66. package/dist/core/read/can.d.ts.map +1 -1
  67. package/dist/core/read/fonts.d.ts +2 -6
  68. package/dist/core/read/fonts.d.ts.map +1 -1
  69. package/dist/core/read/index.d.ts +3 -2
  70. package/dist/core/read/index.d.ts.map +1 -1
  71. package/dist/core/read/list.d.ts +15 -1
  72. package/dist/core/read/list.d.ts.map +1 -1
  73. package/dist/core/read/logo.d.ts +3 -3
  74. package/dist/core/read/logo.d.ts.map +1 -1
  75. package/dist/core/read/lookup.d.ts +2 -2
  76. package/dist/core/read/lookup.d.ts.map +1 -1
  77. package/dist/core/read/theme.d.ts +8 -0
  78. package/dist/core/read/theme.d.ts.map +1 -0
  79. package/dist/core/read/token.d.ts +6 -2
  80. package/dist/core/read/token.d.ts.map +1 -1
  81. package/dist/core/tokens/alias.d.ts +5 -3
  82. package/dist/core/tokens/alias.d.ts.map +1 -1
  83. package/dist/core/tokens/contexts.d.ts +11 -3
  84. package/dist/core/tokens/contexts.d.ts.map +1 -1
  85. package/dist/core/tokens/formatters/json.d.ts +4 -1
  86. package/dist/core/tokens/formatters/json.d.ts.map +1 -1
  87. package/dist/core/tokens/key-lines.d.ts.map +1 -1
  88. package/dist/core/tokens/merge.d.ts.map +1 -1
  89. package/dist/core/tokens/resolver/compile.d.ts.map +1 -1
  90. package/dist/core/tokens/resolver/parse.d.ts.map +1 -1
  91. package/dist/core/tokens/resolver/sources.d.ts.map +1 -1
  92. package/dist/core/tokens/walk.d.ts.map +1 -1
  93. package/dist/index.js +34 -34
  94. package/dist/plugins/host/call.d.ts.map +1 -1
  95. package/dist/plugins/roles/roles.d.ts.map +1 -1
  96. package/dist/server/plugin.d.ts.map +1 -1
  97. package/dist/types/assets.d.ts +19 -1
  98. package/dist/types/assets.d.ts.map +1 -1
  99. package/dist/types/parsed.d.ts +8 -0
  100. package/dist/types/parsed.d.ts.map +1 -1
  101. package/dist/types/tokens.d.ts +12 -0
  102. package/dist/types/tokens.d.ts.map +1 -1
  103. package/dist/ui/assets/index-b4HhGGrn.js +82 -0
  104. package/dist/ui/assets/index-pE1ku5gt.css +2 -0
  105. package/dist/ui/index.html +2 -2
  106. package/mcp/dist/index.js +358 -45
  107. package/package.json +3 -2
  108. package/plugins/blazon.brand-deck/README.md +1 -1
  109. package/plugins/blazon.brand-deck/bin/blazon-blazon.brand-deck./360/237/224/214 +106 -13
  110. package/plugins/blazon.favicons/bin/blazon-blazon.favicons./360/237/224/214 +120 -12
  111. package/plugins/blazon.logo-geometry/bin/blazon-blazon.logo-geometry./360/237/224/214 +45 -1
  112. package/plugins/blazon.logo-kit/bin/blazon-blazon.logo-kit./360/237/224/214 +45 -1
  113. package/plugins/blazon.office-template/bin/blazon-blazon.office-template./360/237/224/214 +66 -3
  114. package/plugins/blazon.platform-tokens/README.md +1 -1
  115. package/plugins/blazon.press-kit/README.md +17 -9
  116. package/plugins/blazon.press-kit/bin/blazon-blazon.press-kit./360/237/224/214 +621 -101
  117. package/plugins/blazon.print-book/README.md +16 -1
  118. package/plugins/blazon.social-cards/bin/blazon-blazon.social-cards./360/237/224/214 +59 -3
  119. package/plugins/shipped.lock +9 -9
  120. package/dist/ui/assets/index-Biy1hkeq.css +0 -2
  121. package/dist/ui/assets/index-dkJG6W9p.js +0 -82
@@ -23,7 +23,22 @@ One more option, `layout`, is `"compact"` (the default) or `"roomy"`. `compact`
23
23
 
24
24
  ## Output size
25
25
 
26
- The PDF is Chrome's own output, with lossless images, so it is large: a book can be 3 to 4 times the size of a compressed one. The plugin has no option to compress it and does not call another program. To shrink it, run a post-processing step such as Ghostscript on the file. Ghostscript's `-dJPEGQ` is ignored by its `pdfwrite` device; image quality changes only through `setdistillerparams` (a `QFactor` in the color image dictionary). That recipe has not been run against this plugin's output here, so it is not given.
26
+ The PDF is Chrome's own output, with lossless images, so it is large. The plugin has no option to compress it and does not call another program. To shrink it, run Ghostscript on the file. Ghostscript's `-dJPEGQ` is ignored by its `pdfwrite` device: image quality changes only through `setdistillerparams` (a `QFactor` in the color image dictionary), and the `/ebook` preset resamples every image to 150 ppi at about JPEG quality 35.
27
+
28
+ A recipe that keeps images sharp, run with Ghostscript 10.08.0 on four books and a deck of 111 to 198 pages:
29
+
30
+ ```sh
31
+ gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook \
32
+ -dColorImageResolution=300 -dColorImageDownsampleThreshold=1.0 \
33
+ -dAutoFilterColorImages=false -dColorImageFilter=/DCTEncode \
34
+ -sOutputFile=out.pdf \
35
+ -c "<< /ColorImageDict << /QFactor 0.15 /Blend 1 /HSamples [1 1 1 1] /VSamples [1 1 1 1] >> >> setdistillerparams" \
36
+ -f in.pdf
37
+ ```
38
+
39
+ What it did on those files: about JPEG quality 91, and no image resampled below 300 ppi. Page counts did not change, and the exported text equaled the printed text in all five. File size grew compared with the `/ebook` default (one deck went from 2.3 to 16.1 MB). Most of that growth comes from the resolution cap; a `QFactor` of 0.3 saves about a quarter. On one test page the raw Chrome PDF was 2.97 MB and 1.28 MB with this recipe. It was checked by eye on one chart page, not on every page.
40
+
41
+ Chrome writes `fi` and `fl` ligature markers that Ghostscript can move out of the text object, so a reader may extract "ve surfaces" for "five surfaces". Add `-dPreserveMarkedContent=false` to stop that; the files above were made with it.
27
42
 
28
43
  A Markdown task list (`- [ ]`, `- [x]`) prints without a bullet, as a box with a border in the text color; a checked box is filled.
29
44
 
@@ -247,6 +247,58 @@ function buildJob(text) {
247
247
  options: request.options ?? {}
248
248
  };
249
249
  }
250
+ /** Compares two strings by UTF-16 code unit. It gives the same answer on every host, which a locale-aware compare does not. */
251
+ function compareText(a, b) {
252
+ return a < b ? -1 : a > b ? 1 : 0;
253
+ }
254
+ /** The order a reader follows when it has no preference of its own: vector first, then the rasters, then any other format by name. */
255
+ var DEFAULT_FORMAT_ORDER = [
256
+ "svg",
257
+ "png",
258
+ "webp",
259
+ "jpg",
260
+ "gif"
261
+ ];
262
+ var pathOf = (record) => record.filePath ?? record.file ?? "";
263
+ /** The file name of a representation, the last segment of its path. */
264
+ function fileNameOf(record) {
265
+ const path = pathOf(record);
266
+ return path.slice(path.lastIndexOf("/") + 1);
267
+ }
268
+ var defaultRank = (format) => {
269
+ const at = DEFAULT_FORMAT_ORDER.indexOf(format === "jpeg" ? "jpg" : format);
270
+ return at === -1 ? DEFAULT_FORMAT_ORDER.length : at;
271
+ };
272
+ /** The order of two representations of one id: the caller's formats first, then the default order, then the file name. */
273
+ function compareRepresentations(a, b, options = {}) {
274
+ const preferred = options.formats;
275
+ if (preferred) {
276
+ const rank = (r) => {
277
+ const at = preferred.indexOf(r.format);
278
+ return at === -1 ? preferred.length : at;
279
+ };
280
+ const byWish = rank(a) - rank(b);
281
+ if (byWish !== 0) return byWish;
282
+ }
283
+ return defaultRank(a.format) - defaultRank(b.format) || compareText(a.format, b.format) || compareText(fileNameOf(a), fileNameOf(b)) || compareText(pathOf(a), pathOf(b));
284
+ }
285
+ /**
286
+ * For a reader that keys a map by id while it reads the records: puts `record` in the map unless the map already holds a better
287
+ * representation of that id. A record in a format the caller does not list is kept only when the id has no other, so the caller
288
+ * can say what is wrong with it. The map ends the same whatever order the records come in.
289
+ */
290
+ function keepRepresentation(map, record, options = {}) {
291
+ const held = map.get(record.id);
292
+ if (!held || compareRepresentations(record, held, options) < 0) map.set(record.id, record);
293
+ }
294
+ /**
295
+ * The record of one named file among all the records, for a logo or other setting that names a FILE and not an id: the file is that
296
+ * one, whatever else its id has, so the lookup runs over every record and never over the one a reader kept for the id. `file` is a
297
+ * path as brand.json writes it (`file`) or as the catalog does (`filePath`).
298
+ */
299
+ function findByFile(records, file) {
300
+ return records.find((record) => record.file === file || record.filePath === file);
301
+ }
250
302
  /** A non-empty string (not only whitespace), or undefined. */
251
303
  var text = (value) => typeof value === "string" && value.trim() !== "" ? value : void 0;
252
304
  /** The files brand.json names as the logo for a light and for a dark surface. */
@@ -327,9 +379,10 @@ function readBrand(brand) {
327
379
  };
328
380
  if (display.floor >= display.start) display.floor = Math.max(20, Math.round(display.start / 2));
329
381
  const assets = /* @__PURE__ */ new Map();
382
+ const files = [];
330
383
  for (const item of list(root.assets)) {
331
384
  if (!isObject$1(item) || typeof item.id !== "string" || typeof item.file !== "string") continue;
332
- assets.set(item.id, {
385
+ const read = {
333
386
  id: item.id,
334
387
  category: text(item.category) ?? "",
335
388
  file: item.file,
@@ -337,7 +390,9 @@ function readBrand(brand) {
337
390
  ...typeof item.width === "number" && { width: item.width },
338
391
  ...typeof item.height === "number" && { height: item.height },
339
392
  ...isObject$1(item.meta) && { meta: item.meta }
340
- });
393
+ };
394
+ files.push(read);
395
+ keepRepresentation(assets, read);
341
396
  }
342
397
  return {
343
398
  formats,
@@ -352,6 +407,7 @@ function readBrand(brand) {
352
407
  fonts: list(theme.fonts).filter((url) => typeof url === "string" && /^(https?:\/\/|data:text\/css[;,])/.test(url)),
353
408
  tokens,
354
409
  assets,
410
+ files,
355
411
  logo: readLogo(root)
356
412
  };
357
413
  }
@@ -823,7 +879,7 @@ var logoOf = (brand, which) => {
823
879
  const src = brand.logo[which];
824
880
  return src === void 0 ? void 0 : {
825
881
  src,
826
- asset: [...brand.assets.values()].find((asset) => asset.file === src)
882
+ asset: findByFile(brand.files, src)
827
883
  };
828
884
  };
829
885
  var dark = "#1E1F21";
@@ -5,7 +5,7 @@
5
5
  "kind": "tree",
6
6
  "path": "blazon.brand-deck",
7
7
  "entry": "bin/blazon-blazon.brand-deck.🔌",
8
- "digest": "t1:32cacf690499507ed1c54bd3a92641df96ced3a9322b3ffc18872e553dbba2ce",
8
+ "digest": "t1:65e64906b42675d049f2d12ffcb142c5b431b77b07d6574f43d3b7201c5cf1a5",
9
9
  "source": "computed"
10
10
  },
11
11
  "blazon.copy": {
@@ -19,49 +19,49 @@
19
19
  "kind": "tree",
20
20
  "path": "blazon.favicons",
21
21
  "entry": "bin/blazon-blazon.favicons.🔌",
22
- "digest": "t1:7c3e99fa5a5f9ecbeb9a638907b4224a7a7cecbe1e1c05d37a81b82ff7f9e76c",
22
+ "digest": "t1:15610b28ca64ac62ac73ffcd8a7f8a23f94f61b99f9b0de969ec4995e9d09e06",
23
23
  "source": "computed"
24
24
  },
25
25
  "blazon.logo-geometry": {
26
26
  "kind": "tree",
27
27
  "path": "blazon.logo-geometry",
28
28
  "entry": "bin/blazon-blazon.logo-geometry.🔌",
29
- "digest": "t1:95a7f7eac05b4f0619694c4fe5fc13c95bda0a6d52725401af231bad528b5986",
29
+ "digest": "t1:24c918582b3273e3ff638afdc82dc1893448fdeea899c54285663310668752d0",
30
30
  "source": "computed"
31
31
  },
32
32
  "blazon.logo-kit": {
33
33
  "kind": "tree",
34
34
  "path": "blazon.logo-kit",
35
35
  "entry": "bin/blazon-blazon.logo-kit.🔌",
36
- "digest": "t1:c89a4bf9bac5403cfbdb533d01f5efc7e54714e4d8a45dbf79763e55f6585585",
36
+ "digest": "t1:01b39109b5a4c722ef999253259ed9484d1fc4514a8219eae9fcb4b927b9aea7",
37
37
  "source": "computed"
38
38
  },
39
39
  "blazon.office-template": {
40
40
  "kind": "tree",
41
41
  "path": "blazon.office-template",
42
42
  "entry": "bin/blazon-blazon.office-template.🔌",
43
- "digest": "t1:d8174375af029263fb97505b81edb140b664d0cc0727db0adc3f32a954c91e63",
43
+ "digest": "t1:655a5553b386903b97fd5748b8d582555741aee56e1e3e35b35285b2b8a88870",
44
44
  "source": "computed"
45
45
  },
46
46
  "blazon.platform-tokens": {
47
47
  "kind": "tree",
48
48
  "path": "blazon.platform-tokens",
49
49
  "entry": "bin/blazon-blazon.platform-tokens.🔌",
50
- "digest": "t1:e2c6623136ffafa7e2b17cf0439c7eb10633f13e2d45490644931994b514712e",
50
+ "digest": "t1:6062bfaa70e9769c6bef3212b4aa47bd270b344db441ab1b91c2fc6dd7e4497f",
51
51
  "source": "computed"
52
52
  },
53
53
  "blazon.press-kit": {
54
54
  "kind": "tree",
55
55
  "path": "blazon.press-kit",
56
56
  "entry": "bin/blazon-blazon.press-kit.🔌",
57
- "digest": "t1:a55097bb498706cf35e2d1ebffa5d225f8171874a82c1ecbc11dac51f6e5ec6b",
57
+ "digest": "t1:817364b2596a161531defef2b0472c0993228991f6e38c992284fbd9bed5ed0e",
58
58
  "source": "computed"
59
59
  },
60
60
  "blazon.print-book": {
61
61
  "kind": "tree",
62
62
  "path": "blazon.print-book",
63
63
  "entry": "bin/blazon-blazon.print-book.🔌",
64
- "digest": "t1:a1b5ca8bc80c8b202cf67268f65f4e10a65ddfb5eb32a0df9f527c165e764dd5",
64
+ "digest": "t1:5f91501728476eaf75a91c97409bc13900c128dd1c68ef2f49a84c54cc8e37f1",
65
65
  "source": "computed"
66
66
  },
67
67
  "blazon.shadcn": {
@@ -75,7 +75,7 @@
75
75
  "kind": "tree",
76
76
  "path": "blazon.social-cards",
77
77
  "entry": "bin/blazon-blazon.social-cards.🔌",
78
- "digest": "t1:874ba79e0e0c2ed8d761d320df0203ca4bf39deba7bdb84672de2631460576ec",
78
+ "digest": "t1:bafdcdc3099c9cc7710920f55a3077f7037be1230bb0b4e602a0bdcd6b4e8c50",
79
79
  "source": "computed"
80
80
  },
81
81
  "blazon.tailwind": {