@iksnerd/blazon 0.4.0 → 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 (92) hide show
  1. package/CHANGELOG.md +375 -0
  2. package/dist/chunks/{site-builder-BOQjoDbM.js → site-builder-C8g2sfUv.js} +3519 -3712
  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/index.js +1098 -965
  12. package/dist/cli/operations.d.ts.map +1 -1
  13. package/dist/cli/where.d.ts +2 -0
  14. package/dist/cli/where.d.ts.map +1 -1
  15. package/dist/core/assets/representations.d.ts +44 -0
  16. package/dist/core/assets/representations.d.ts.map +1 -0
  17. package/dist/core/assets/scanner.d.ts.map +1 -1
  18. package/dist/core/assets/sidecar.d.ts.map +1 -1
  19. package/dist/core/brand/export.d.ts +13 -5
  20. package/dist/core/brand/export.d.ts.map +1 -1
  21. package/dist/core/brand/schema.d.ts +68 -0
  22. package/dist/core/brand/schema.d.ts.map +1 -1
  23. package/dist/core/checker/approvals.d.ts +5 -0
  24. package/dist/core/checker/approvals.d.ts.map +1 -1
  25. package/dist/core/checker/catalogue.d.ts +31 -7
  26. package/dist/core/checker/catalogue.d.ts.map +1 -1
  27. package/dist/core/checker/font-meta.d.ts.map +1 -1
  28. package/dist/core/checker/review.d.ts +19 -1
  29. package/dist/core/checker/review.d.ts.map +1 -1
  30. package/dist/core/docs/directives.d.ts +10 -0
  31. package/dist/core/docs/directives.d.ts.map +1 -1
  32. package/dist/core/docs/parser.d.ts.map +1 -1
  33. package/dist/core/font-roles.d.ts +11 -0
  34. package/dist/core/font-roles.d.ts.map +1 -0
  35. package/dist/core/index.d.ts.map +1 -1
  36. package/dist/core/init/from-site/fonts.d.ts.map +1 -1
  37. package/dist/core/logo/colorways.d.ts +29 -0
  38. package/dist/core/logo/colorways.d.ts.map +1 -0
  39. package/dist/core/logo/misuse.d.ts +18 -0
  40. package/dist/core/logo/misuse.d.ts.map +1 -0
  41. package/dist/core/mcp-config.d.ts +7 -0
  42. package/dist/core/mcp-config.d.ts.map +1 -1
  43. package/dist/core/read/can.d.ts +2 -1
  44. package/dist/core/read/can.d.ts.map +1 -1
  45. package/dist/core/read/fonts.d.ts +2 -6
  46. package/dist/core/read/fonts.d.ts.map +1 -1
  47. package/dist/core/read/logo.d.ts +3 -3
  48. package/dist/core/read/logo.d.ts.map +1 -1
  49. package/dist/core/read/lookup.d.ts +2 -2
  50. package/dist/core/read/lookup.d.ts.map +1 -1
  51. package/dist/core/read/theme.d.ts +1 -1
  52. package/dist/core/read/theme.d.ts.map +1 -1
  53. package/dist/core/tokens/alias.d.ts +5 -3
  54. package/dist/core/tokens/alias.d.ts.map +1 -1
  55. package/dist/core/tokens/contexts.d.ts +11 -3
  56. package/dist/core/tokens/contexts.d.ts.map +1 -1
  57. package/dist/core/tokens/formatters/json.d.ts +4 -1
  58. package/dist/core/tokens/formatters/json.d.ts.map +1 -1
  59. package/dist/core/tokens/key-lines.d.ts.map +1 -1
  60. package/dist/core/tokens/merge.d.ts.map +1 -1
  61. package/dist/core/tokens/resolver/compile.d.ts.map +1 -1
  62. package/dist/core/tokens/resolver/parse.d.ts.map +1 -1
  63. package/dist/core/tokens/resolver/sources.d.ts.map +1 -1
  64. package/dist/core/tokens/walk.d.ts.map +1 -1
  65. package/dist/index.js +34 -34
  66. package/dist/plugins/host/call.d.ts.map +1 -1
  67. package/dist/plugins/roles/roles.d.ts.map +1 -1
  68. package/dist/server/plugin.d.ts.map +1 -1
  69. package/dist/types/assets.d.ts +19 -1
  70. package/dist/types/assets.d.ts.map +1 -1
  71. package/dist/types/parsed.d.ts +8 -0
  72. package/dist/types/parsed.d.ts.map +1 -1
  73. package/dist/types/tokens.d.ts +12 -0
  74. package/dist/types/tokens.d.ts.map +1 -1
  75. package/dist/ui/assets/index-b4HhGGrn.js +82 -0
  76. package/dist/ui/assets/index-pE1ku5gt.css +2 -0
  77. package/dist/ui/index.html +2 -2
  78. package/mcp/dist/index.js +4 -4
  79. package/package.json +3 -2
  80. package/plugins/blazon.brand-deck/README.md +1 -1
  81. package/plugins/blazon.brand-deck/bin/blazon-blazon.brand-deck./360/237/224/214 +106 -13
  82. package/plugins/blazon.favicons/bin/blazon-blazon.favicons./360/237/224/214 +120 -12
  83. package/plugins/blazon.logo-geometry/bin/blazon-blazon.logo-geometry./360/237/224/214 +45 -1
  84. package/plugins/blazon.logo-kit/bin/blazon-blazon.logo-kit./360/237/224/214 +45 -1
  85. package/plugins/blazon.office-template/bin/blazon-blazon.office-template./360/237/224/214 +66 -3
  86. package/plugins/blazon.platform-tokens/README.md +1 -1
  87. package/plugins/blazon.press-kit/README.md +17 -9
  88. package/plugins/blazon.press-kit/bin/blazon-blazon.press-kit./360/237/224/214 +621 -101
  89. package/plugins/blazon.social-cards/bin/blazon-blazon.social-cards./360/237/224/214 +59 -3
  90. package/plugins/shipped.lock +8 -8
  91. package/dist/ui/assets/index-Biy1hkeq.css +0 -2
  92. package/dist/ui/assets/index-dkJG6W9p.js +0 -82
@@ -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,42 +19,42 @@
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": {
@@ -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": {