@dloizides/poster-render 0.13.0 → 0.14.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
@@ -95,7 +95,7 @@ var RowIcon = /* @__PURE__ */ ((RowIcon2) => {
95
95
  })(RowIcon || {});
96
96
 
97
97
  // src/schema/lineStyleSchema.ts
98
- var LINE_KEY_PATTERN = "^(title|titleBottom|script|footer|includes[.]heading|includes[.]items[.][0-5]|venue[.][0-2]|schedule[.][0-5][.](label|time)|prices[.][0-3][.](amount|label)|items[.][0-7][.](date|price|schedule[.][0-5]))$";
98
+ var LINE_KEY_PATTERN = "^(title|titleBottom|script|footer|lines[.][0-5]|includes[.]heading|includes[.]items[.][0-5]|venue[.][0-2]|schedule[.][0-5][.](label|time)|prices[.][0-3][.](amount|label)|items[.][0-7][.](date|price|schedule[.][0-5]))$";
99
99
  var MAX_FONT = 40;
100
100
  var MIN_SPACING = -0.1;
101
101
  var MAX_SPACING = 0.5;
@@ -272,6 +272,7 @@ var headerTuningSchema = {
272
272
  // src/schema/flierDocSchema.ts
273
273
  var SHORT = 60;
274
274
  var LINE = 120;
275
+ var MAX_LINES = 6;
275
276
  var MAX_ROWS2 = 6;
276
277
  var MAX_ITEMS = 8;
277
278
  var MAX_PRICES2 = 4;
@@ -316,7 +317,8 @@ var blocks = {
316
317
  additionalProperties: false,
317
318
  properties: { heading: text(SHORT), items: { type: "array", items: text(LINE), minItems: 1, maxItems: MAX_ROWS2 } }
318
319
  },
319
- footer: text(LINE)
320
+ footer: text(LINE),
321
+ lines: { type: "array", items: { type: "string", maxLength: LINE }, maxItems: MAX_LINES }
320
322
  }
321
323
  };
322
324
  var flierDocSchema = {
@@ -928,7 +930,9 @@ function halves(text2) {
928
930
  }
929
931
  function wrapped(line, wrap) {
930
932
  const parts = wrap ? halves(line.text) : [line.text];
931
- return parts.length === 1 ? [line] : parts.map((text2, i) => i === 0 ? { ...line, text: text2, tail: void 0 } : { ...line, text: text2, tail: void 0, bullet: void 0, hang: line.bullet !== void 0 });
933
+ const last = parts.length - 1;
934
+ const edges = (i) => ({ spaceAbove: i === 0 ? line.spaceAbove : void 0, spaceBelow: i === last ? line.spaceBelow : void 0 });
935
+ return parts.length === 1 ? [line] : parts.map((text2, i) => i === 0 ? { ...line, ...edges(i), text: text2, tail: void 0 } : { ...line, ...edges(i), text: text2, tail: void 0, bullet: void 0, hang: line.bullet !== void 0 });
932
936
  }
933
937
  function scheduleLines(doc, l, row, i) {
934
938
  const r3 = doc.rows;
@@ -999,14 +1003,16 @@ function bodyGroups(doc, p, u, options = {}) {
999
1003
  const includeLines = b.includes ? [l.accent(b.includes.heading, SIZE.small, "includes.heading"), ...b.includes.items.map((item, i) => l.item(item, SIZE.small, `includes.items.${i}`))] : [];
1000
1004
  const includes = includeLines.length > 0 ? [{ lines: includeLines.flatMap((line) => wrapped(line, options.wrap)), gapAfter: GAP.includes * u, uniform: true }] : [];
1001
1005
  const footerLines = (b.footer ?? "").split("\n").filter((text2) => text2.trim() !== "");
1006
+ const free = (b.lines ?? []).flatMap((text2, i) => text2.trim() === "" ? [] : wrapped(l.strong(text2, SIZE.small, `lines.${i}`), options.wrap));
1002
1007
  const footer = footerLines.length > 0 ? [{ lines: footerLines.flatMap((text2) => wrapped(l.soft(text2, SIZE.small, "footer"), options.wrap)), gapAfter: 0 }] : [];
1008
+ const freeGroup = free.length > 0 ? [{ lines: free, gapAfter: GAP.includes * u }] : [];
1003
1009
  const parts = {
1004
1010
  ["venue" /* Venue */]: venueGroups(doc, p, u, l),
1005
1011
  ["schedule" /* Schedule */]: isList ? [] : rows,
1006
1012
  ["items" /* Items */]: isList ? rows : [],
1007
1013
  ["prices" /* Prices */]: prices,
1008
1014
  ["includes" /* Includes */]: includes,
1009
- ["footer" /* Footer */]: footer
1015
+ ["footer" /* Footer */]: [...freeGroup, ...footer]
1010
1016
  };
1011
1017
  return joined(sectionOrderOf(doc), parts);
1012
1018
  }