@dloizides/poster-render 0.2.7 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2,6 +2,7 @@
2
2
  var BackgroundStyle = /* @__PURE__ */ ((BackgroundStyle2) => {
3
3
  BackgroundStyle2["Solid"] = "solid";
4
4
  BackgroundStyle2["Tint"] = "tint";
5
+ BackgroundStyle2["Horizon"] = "horizon";
5
6
  return BackgroundStyle2;
6
7
  })(BackgroundStyle || {});
7
8
 
@@ -10,6 +11,7 @@ var FontSetId = /* @__PURE__ */ ((FontSetId2) => {
10
11
  FontSetId2["Classic"] = "classic";
11
12
  FontSetId2["Modern"] = "modern";
12
13
  FontSetId2["Elegant"] = "elegant";
14
+ FontSetId2["Coastal"] = "coastal";
13
15
  return FontSetId2;
14
16
  })(FontSetId || {});
15
17
 
@@ -43,6 +45,7 @@ var PaletteId = /* @__PURE__ */ ((PaletteId2) => {
43
45
  PaletteId2["Night"] = "night";
44
46
  PaletteId2["Sea"] = "sea";
45
47
  PaletteId2["Rose"] = "rose";
48
+ PaletteId2["GoldenHorizon"] = "golden-horizon";
46
49
  return PaletteId2;
47
50
  })(PaletteId || {});
48
51
 
@@ -68,6 +71,17 @@ var PALETTES = {
68
71
  ["sand" /* Sand */]: { background: "#f5f4f2", tint: "#ece8e3", title: "#958a80", accent: "#e9b47f", ink: "#5f564f", soft: "#b3a89e", card: "#ffffff", arch: "#ede8e2" },
69
72
  ["night" /* Night */]: { background: "#1c1a17", tint: "#25221e", title: "#e8dccb", accent: "#e9b47f", ink: "#f4efe8", soft: "#9c9284", card: "#2c2824", arch: "#25221f" },
70
73
  ["sea" /* Sea */]: { background: "#eef4f3", tint: "#e1ecea", title: "#4f7d7a", accent: "#e07a5f", ink: "#2f3e46", soft: "#8aa3a1", card: "#ffffff", arch: "#e4ecea" },
74
+ ["golden-horizon" /* GoldenHorizon */]: {
75
+ background: "#dce5e7",
76
+ tint: "#d3dee1",
77
+ title: "#2f566f",
78
+ accent: "#8a4325",
79
+ ink: "#1f2d36",
80
+ soft: "#46606f",
81
+ card: "#f4f1ec",
82
+ arch: "#c7d4d6",
83
+ sky: [[0, "#bfd3d8"], [0.55, "#d4dddd"], [1, "#eadccb"]]
84
+ },
71
85
  ["rose" /* Rose */]: { background: "#f8efec", tint: "#f1e2dd", title: "#9b6b63", accent: "#c9846f", ink: "#4a3934", soft: "#b39a92", card: "#ffffff", arch: "#f1e5e1" }
72
86
  };
73
87
 
@@ -75,7 +89,8 @@ var PALETTES = {
75
89
  var FONT_SETS = {
76
90
  ["classic" /* Classic */]: { display: '"Oswald", "Arial Narrow", sans-serif', script: '"Sacramento", cursive', body: '"Fredoka", sans-serif' },
77
91
  ["modern" /* Modern */]: { display: '"Bebas Neue", "Arial Narrow", sans-serif', script: '"Great Vibes", cursive', body: '"Montserrat", sans-serif' },
78
- ["elegant" /* Elegant */]: { display: '"Playfair Display", serif', script: '"Allura", cursive', body: '"Lato", sans-serif' }
92
+ ["elegant" /* Elegant */]: { display: '"Playfair Display", serif', script: '"Allura", cursive', body: '"Lato", sans-serif' },
93
+ ["coastal" /* Coastal */]: { display: '"Fraunces", Georgia, serif', script: '"Allura", cursive', body: '"Jost", sans-serif' }
79
94
  };
80
95
 
81
96
  // src/schema/flierDocSchema.ts
@@ -291,6 +306,18 @@ function missingAssets(doc, assets) {
291
306
  return errors;
292
307
  }
293
308
 
309
+ // src/render/background.ts
310
+ function paintGround(ctx, style, palette, size) {
311
+ ctx.fillStyle = palette.background;
312
+ if (style === "horizon" /* Horizon */) {
313
+ const stops = palette.sky ?? [[0, palette.background], [1, palette.tint]];
314
+ const sky = ctx.createLinearGradient(0, 0, 0, size.height);
315
+ stops.forEach(([offset, color]) => sky.addColorStop(offset, color));
316
+ ctx.fillStyle = sky;
317
+ }
318
+ ctx.fillRect(0, 0, size.width, size.height);
319
+ }
320
+
294
321
  // src/layout/layoutSpecs.ts
295
322
  var flanksBeside = (pic, top, bottom2, m) => [
296
323
  [m, top, pic[0] - 2 * m, bottom2 - top],
@@ -975,8 +1002,7 @@ function render(input, assets, canvas) {
975
1002
  const u = Math.min(width, height) / BASE2;
976
1003
  const { geo, zones, head, body, sides } = fitToFloor(ctx, { doc, palette, fonts, width, height });
977
1004
  ctx.globalAlpha = 1;
978
- ctx.fillStyle = palette.background;
979
- ctx.fillRect(0, 0, width, height);
1005
+ paintGround(ctx, doc.background, palette, { width, height });
980
1006
  if (doc.background === "tint" /* Tint */) {
981
1007
  ctx.fillStyle = palette.tint;
982
1008
  [geo.header, geo.body].forEach((r3) => ctx.fillRect(r3.x, r3.y, r3.w, r3.h));