@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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.13.1
4
+
5
+ - D-SPACE-1 "Space above/below applies per item": a wrapped line keeps `spaceAbove` on its first part and `spaceBelow` on its last, so a wrapped includes item's own lines stay tight.
6
+
3
7
  ## 0.13.0
4
8
 
5
9
  - FLIER-2 "Bullets on/off and line spacing": `FlierDoc.bullets` (default true; false drops the includes bullet dot and its indent), `LineStyle.spaceAbove` / `spaceBelow` (em of the line size, 0-2) added above / below a line, and a footer holding line breaks sets one footer line per text line. Docs without the new fields render pixel-identical (45 snapshots unchanged).
package/dist/index.d.mts CHANGED
@@ -97,7 +97,7 @@ interface JsonSchema {
97
97
  }
98
98
 
99
99
  /** Every text line a style or tie can name: block fields by path, list items by index. */
100
- declare const 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]))$";
100
+ declare const 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]))$";
101
101
 
102
102
  interface ScheduleRow {
103
103
  label: string;
@@ -120,6 +120,7 @@ interface FlierBlocks {
120
120
  prices?: PriceRow[];
121
121
  includes?: IncludesBlock;
122
122
  footer?: string;
123
+ lines?: string[];
123
124
  }
124
125
  interface ListItem {
125
126
  date: string;
package/dist/index.d.ts CHANGED
@@ -97,7 +97,7 @@ interface JsonSchema {
97
97
  }
98
98
 
99
99
  /** Every text line a style or tie can name: block fields by path, list items by index. */
100
- declare const 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]))$";
100
+ declare const 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]))$";
101
101
 
102
102
  interface ScheduleRow {
103
103
  label: string;
@@ -120,6 +120,7 @@ interface FlierBlocks {
120
120
  prices?: PriceRow[];
121
121
  includes?: IncludesBlock;
122
122
  footer?: string;
123
+ lines?: string[];
123
124
  }
124
125
  interface ListItem {
125
126
  date: string;
package/dist/index.js CHANGED
@@ -97,7 +97,7 @@ var RowIcon = /* @__PURE__ */ ((RowIcon2) => {
97
97
  })(RowIcon || {});
98
98
 
99
99
  // src/schema/lineStyleSchema.ts
100
- 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]))$";
100
+ 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]))$";
101
101
  var MAX_FONT = 40;
102
102
  var MIN_SPACING = -0.1;
103
103
  var MAX_SPACING = 0.5;
@@ -274,6 +274,7 @@ var headerTuningSchema = {
274
274
  // src/schema/flierDocSchema.ts
275
275
  var SHORT = 60;
276
276
  var LINE = 120;
277
+ var MAX_LINES = 6;
277
278
  var MAX_ROWS2 = 6;
278
279
  var MAX_ITEMS = 8;
279
280
  var MAX_PRICES2 = 4;
@@ -318,7 +319,8 @@ var blocks = {
318
319
  additionalProperties: false,
319
320
  properties: { heading: text(SHORT), items: { type: "array", items: text(LINE), minItems: 1, maxItems: MAX_ROWS2 } }
320
321
  },
321
- footer: text(LINE)
322
+ footer: text(LINE),
323
+ lines: { type: "array", items: { type: "string", maxLength: LINE }, maxItems: MAX_LINES }
322
324
  }
323
325
  };
324
326
  var flierDocSchema = {
@@ -930,7 +932,9 @@ function halves(text2) {
930
932
  }
931
933
  function wrapped(line, wrap) {
932
934
  const parts = wrap ? halves(line.text) : [line.text];
933
- 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 });
935
+ const last = parts.length - 1;
936
+ const edges = (i) => ({ spaceAbove: i === 0 ? line.spaceAbove : void 0, spaceBelow: i === last ? line.spaceBelow : void 0 });
937
+ 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 });
934
938
  }
935
939
  function scheduleLines(doc, l, row, i) {
936
940
  const r3 = doc.rows;
@@ -1001,14 +1005,16 @@ function bodyGroups(doc, p, u, options = {}) {
1001
1005
  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}`))] : [];
1002
1006
  const includes = includeLines.length > 0 ? [{ lines: includeLines.flatMap((line) => wrapped(line, options.wrap)), gapAfter: GAP.includes * u, uniform: true }] : [];
1003
1007
  const footerLines = (b.footer ?? "").split("\n").filter((text2) => text2.trim() !== "");
1008
+ const free = (b.lines ?? []).flatMap((text2, i) => text2.trim() === "" ? [] : wrapped(l.strong(text2, SIZE.small, `lines.${i}`), options.wrap));
1004
1009
  const footer = footerLines.length > 0 ? [{ lines: footerLines.flatMap((text2) => wrapped(l.soft(text2, SIZE.small, "footer"), options.wrap)), gapAfter: 0 }] : [];
1010
+ const freeGroup = free.length > 0 ? [{ lines: free, gapAfter: GAP.includes * u }] : [];
1005
1011
  const parts = {
1006
1012
  ["venue" /* Venue */]: venueGroups(doc, p, u, l),
1007
1013
  ["schedule" /* Schedule */]: isList ? [] : rows,
1008
1014
  ["items" /* Items */]: isList ? rows : [],
1009
1015
  ["prices" /* Prices */]: prices,
1010
1016
  ["includes" /* Includes */]: includes,
1011
- ["footer" /* Footer */]: footer
1017
+ ["footer" /* Footer */]: [...freeGroup, ...footer]
1012
1018
  };
1013
1019
  return joined(sectionOrderOf(doc), parts);
1014
1020
  }