@binaryandthread/cli 0.4.12 → 0.4.13

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.
@@ -632,8 +632,8 @@ function supplierOf(p) {
632
632
  var PRINTFUL_BLANK_COLOURS = {
633
633
  "ascolour-5082": ["black", "white", "coal", "eucalyptus", "bone", "grey", "khaki", "indigo"],
634
634
  // TB124, TB126
635
- "bellacanvas-4711": ["asphalt", "dust", "navy", "maroon", "forest"]
636
- // TB128: the sweatshirt
635
+ "bellacanvas-4711": ["asphalt", "dust", "navy", "maroon", "forest", "jet"]
636
+ // TB128: the sweatshirt; TB129: + jet (its Black)
637
637
  };
638
638
  var PRINTFUL_BLANK_SIZES = {
639
639
  "ascolour-5082": ["s", "m", "l", "xl", "2xl"],
@@ -777,7 +777,7 @@ function resolveVariant(p, opts) {
777
777
  const supplier = supplierOf(p);
778
778
  const pb = printfulBlankOf(p);
779
779
  const colours = coloursFor(p, fit, opts.countryCode);
780
- const colour = colourKey(opts.colour ?? "") || (colours[0] ?? null);
780
+ const colour = colourKey(opts.colour ?? "", productColours(p)) || (colours[0] ?? null);
781
781
  if (gate && colour && opts.countryCode !== void 0 && !colourBuyable(gate, colour, opts.countryCode, supplier, pb)) {
782
782
  return { ok: false, reason: "fit_unavailable", fit: gate, colour };
783
783
  }
@@ -815,15 +815,22 @@ var COLOUR_LABELS = {
815
815
  bone: "Faded Bone",
816
816
  grey: "Faded Grey",
817
817
  khaki: "Faded Khaki",
818
- indigo: "Faded Indigo"
818
+ indigo: "Faded Indigo",
819
+ jet: "Black"
819
820
  };
820
821
  function colourLabel(colour) {
821
822
  const c = colour.trim();
822
823
  if (!c) return c;
823
824
  return COLOUR_LABELS[c.toLowerCase()] ?? c.charAt(0).toUpperCase() + c.slice(1).toLowerCase();
824
825
  }
825
- function colourKey(colour) {
826
+ function colourKey(colour, available) {
826
827
  const c = colour.trim().toLowerCase();
828
+ if (available) {
829
+ const keys = available.map((k) => k.trim().toLowerCase());
830
+ if (keys.includes(c)) return c;
831
+ return keys.find((k) => colourLabel(k).toLowerCase() === c) ?? c;
832
+ }
833
+ if (Object.prototype.hasOwnProperty.call(COLOUR_LABELS, c)) return c;
827
834
  const key = Object.entries(COLOUR_LABELS).find(([, label]) => label.toLowerCase() === c)?.[0];
828
835
  return key ?? c;
829
836
  }
@@ -884,7 +891,7 @@ function findVariant(p, opts = {}) {
884
891
  }
885
892
  const variants = (p.variants ?? []).filter((v) => fit === null || variantFit(v) === fit);
886
893
  const size = opts.size?.trim().toLowerCase();
887
- const colour = opts.colour ? colourKey(opts.colour) : void 0;
894
+ const colour = opts.colour ? colourKey(opts.colour, productColours(p)) : void 0;
888
895
  const sizeMatches = (v) => {
889
896
  if (!size) return true;
890
897
  return (sizeOfVariant(v) ?? "").toLowerCase() === size || (v.title ?? "").toLowerCase() === size;
@@ -1311,7 +1318,7 @@ function contributionBar(style, commits, cap = 20) {
1311
1318
  function colourSwatch(colour) {
1312
1319
  const c = colour.trim().toLowerCase();
1313
1320
  if (c === "white") return "\u2B1C";
1314
- if (c === "black") return "\u2B1B";
1321
+ if (c === "black" || c === "jet") return "\u2B1B";
1315
1322
  if (c === "khaki") return "\u{1F7EB}";
1316
1323
  return "\u25FC";
1317
1324
  }
@@ -1658,7 +1665,7 @@ async function runView(client, config, args) {
1658
1665
  }
1659
1666
  let imageUrl = product.thumbnail ?? null;
1660
1667
  let blackNote = null;
1661
- const wanted = (args.colour ? colourKey(args.colour) : "") || (fit ? colours[0] : void 0);
1668
+ const wanted = (args.colour ? colourKey(args.colour, [...colours, ...unavailable]) : "") || (fit ? colours[0] : void 0);
1662
1669
  if (wanted) {
1663
1670
  const resolved = imageFor(product, { fit, colour: wanted }) ?? (fit === null ? imageForColour(product, wanted) : null);
1664
1671
  if (resolved) {
@@ -2052,4 +2059,4 @@ export {
2052
2059
  oneDesignPerCommand,
2053
2060
  registerStage
2054
2061
  };
2055
- //# sourceMappingURL=chunk-YNBNKCCN.js.map
2062
+ //# sourceMappingURL=chunk-ZRHSCMBQ.js.map