@dloizides/poster-render 0.8.0 → 0.9.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.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -149,7 +149,12 @@ interface RowTheme {
|
|
|
149
149
|
body?: boolean;
|
|
150
150
|
bare?: boolean;
|
|
151
151
|
oneLine?: boolean;
|
|
152
|
+
pinSize?: number;
|
|
153
|
+
pinGap?: number;
|
|
154
|
+
pinShift?: number;
|
|
155
|
+
centred?: boolean;
|
|
152
156
|
};
|
|
157
|
+
priceGap?: number;
|
|
153
158
|
labelScale?: number;
|
|
154
159
|
timeScale?: number;
|
|
155
160
|
timeWeight?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -149,7 +149,12 @@ interface RowTheme {
|
|
|
149
149
|
body?: boolean;
|
|
150
150
|
bare?: boolean;
|
|
151
151
|
oneLine?: boolean;
|
|
152
|
+
pinSize?: number;
|
|
153
|
+
pinGap?: number;
|
|
154
|
+
pinShift?: number;
|
|
155
|
+
centred?: boolean;
|
|
152
156
|
};
|
|
157
|
+
priceGap?: number;
|
|
153
158
|
labelScale?: number;
|
|
154
159
|
timeScale?: number;
|
|
155
160
|
timeWeight?: number;
|
package/dist/index.js
CHANGED
|
@@ -182,7 +182,7 @@ var FONT_SETS = {
|
|
|
182
182
|
["classic" /* Classic */]: { display: '"Oswald", "Arial Narrow", sans-serif', script: '"Sacramento", cursive', body: '"Fredoka", sans-serif' },
|
|
183
183
|
["modern" /* Modern */]: { display: '"Bebas Neue", "Arial Narrow", sans-serif', script: '"Great Vibes", cursive', body: '"Montserrat", sans-serif' },
|
|
184
184
|
["elegant" /* Elegant */]: { display: '"Playfair Display", serif', script: '"Allura", cursive', body: '"Lato", sans-serif' },
|
|
185
|
-
["kizomba-sample" /* KizombaSample */]: { display: '"Anton", "Oswald", "Arial Narrow", sans-serif', script: '"
|
|
185
|
+
["kizomba-sample" /* KizombaSample */]: { display: '"Anton", "Oswald", "Arial Narrow", sans-serif', script: '"Style Script", "Dancing Script", cursive', body: '"Barlow Semi Condensed", "Fredoka", sans-serif' },
|
|
186
186
|
["coastal" /* Coastal */]: { display: '"Fraunces", Georgia, serif', script: '"Allura", cursive', body: '"Jost", sans-serif' }
|
|
187
187
|
};
|
|
188
188
|
|
|
@@ -231,7 +231,8 @@ var rowsSchema = {
|
|
|
231
231
|
}
|
|
232
232
|
},
|
|
233
233
|
priceLabelScale: num(MIN_LABEL_SCALE, 1),
|
|
234
|
-
venue: { type: "object", additionalProperties: false, properties: { body: { type: "boolean" }, bare: { type: "boolean" }, oneLine: { type: "boolean" } } },
|
|
234
|
+
venue: { type: "object", additionalProperties: false, properties: { body: { type: "boolean" }, bare: { type: "boolean" }, oneLine: { type: "boolean" }, pinSize: num(0, MAX_LENGTH), pinGap: num(0, MAX_GAP), pinShift: num(-MAX_GAP, MAX_GAP), centred: { type: "boolean" } } },
|
|
235
|
+
priceGap: num(-MAX_GAP, MAX_GAP),
|
|
235
236
|
labelScale: num(MIN_LABEL_SCALE, MAX_ROW_SCALE),
|
|
236
237
|
timeScale: num(MIN_LABEL_SCALE, MAX_ROW_SCALE),
|
|
237
238
|
timeWeight: num(MIN_WEIGHT, MAX_WEIGHT),
|
|
@@ -903,6 +904,7 @@ function scheduleLines(doc, l, row, i) {
|
|
|
903
904
|
const tied = r3?.labelScale === void 0 ? label : { ...label, sizeTie: label.sizeTie ?? LABEL_TIE };
|
|
904
905
|
return [tied, l.time(row.time, SIZE.scheduleTime * (r3?.timeScale ?? 1), `schedule.${i}.time`)];
|
|
905
906
|
}
|
|
907
|
+
var priceAmount = (doc, line) => doc.rows?.priceGap === void 0 ? line : { ...line, gapAfter: doc.rows.priceGap };
|
|
906
908
|
function eventGroups(doc, l, u, options) {
|
|
907
909
|
const b = doc.blocks;
|
|
908
910
|
const groups = [];
|
|
@@ -915,7 +917,7 @@ function eventGroups(doc, l, u, options) {
|
|
|
915
917
|
groups.push({ lines, gapAfter: GAP.row * u, keepWithNext: i < schedule2.length - 1, ...options.marks(icons2?.schedule, i, i === lastRow) });
|
|
916
918
|
});
|
|
917
919
|
prices.forEach((row, i) => {
|
|
918
|
-
const lines = options.compact ? [l.strong(`${row.amount} ${row.label}`, SIZE.priceAmount, `prices.${i}.amount`)] : [l.strong(row.amount, SIZE.priceAmount, `prices.${i}.amount`), l.accent(row.label, SIZE.priceLabel * (doc.rows?.priceLabelScale ?? 1), `prices.${i}.label`)];
|
|
920
|
+
const lines = options.compact ? [l.strong(`${row.amount} ${row.label}`, SIZE.priceAmount, `prices.${i}.amount`)] : [priceAmount(doc, l.strong(row.amount, SIZE.priceAmount, `prices.${i}.amount`)), l.accent(row.label, SIZE.priceLabel * (doc.rows?.priceLabelScale ?? 1), `prices.${i}.label`)];
|
|
919
921
|
groups.push({ lines, gapAfter: GAP.row * u, keepWithNext: i < prices.length - 1, ...options.marks(icons2?.prices, i, schedule2.length + i === lastRow) });
|
|
920
922
|
});
|
|
921
923
|
return groups;
|
|
@@ -932,6 +934,9 @@ function flankPriceGroups(doc, p, u) {
|
|
|
932
934
|
const l = makers(p, u, styleContext(doc));
|
|
933
935
|
return (doc.blocks.prices ?? []).map((row, i) => ({ lines: [l.strong(row.amount, SIZE.flankAmount, `prices.${i}.amount`), l.accent(row.label, SIZE.flankLabel, `prices.${i}.label`)], gapAfter: GAP.row * u }));
|
|
934
936
|
}
|
|
937
|
+
function pinOf(look, u) {
|
|
938
|
+
return { size: look?.pinSize === void 0 ? void 0 : look.pinSize * u, gap: look?.pinGap === void 0 ? void 0 : look.pinGap * u, shift: look?.pinShift === void 0 ? void 0 : look.pinShift * u, centre: look?.centred };
|
|
939
|
+
}
|
|
935
940
|
function bodyGroups(doc, p, u, options = {}) {
|
|
936
941
|
const l = makers(p, u, styleContext(doc), doc.rows?.timeWeight);
|
|
937
942
|
const b = doc.blocks;
|
|
@@ -943,7 +948,7 @@ function bodyGroups(doc, p, u, options = {}) {
|
|
|
943
948
|
const look = doc.rows?.venue;
|
|
944
949
|
const line = look?.body === true ? l.bodyVenue : l.venue;
|
|
945
950
|
const venue = look?.oneLine === true ? [b.venue.join(" ")] : b.venue;
|
|
946
|
-
groups.push({ lines: venue.map((v, i) => line(v, size, `venue.${i}`)), gapAfter: GAP.venue * u, rule: dividerOf(doc, p, u) ?? { color: p.accent, height: GAP.rule * u }, ruleBelow: true, icon: { color: p.icon ?? p.accent, glyph: p.background, bare: look?.bare }, keepWithNext });
|
|
951
|
+
groups.push({ lines: venue.map((v, i) => line(v, size, `venue.${i}`)), gapAfter: GAP.venue * u, rule: dividerOf(doc, p, u) ?? { color: p.accent, height: GAP.rule * u }, ruleBelow: true, icon: { color: p.icon ?? p.accent, glyph: p.background, bare: look?.bare, ...pinOf(look, u) }, keepWithNext });
|
|
947
952
|
}
|
|
948
953
|
groups.push(...isList ? listGroups(doc, l, u, options.dateScale ?? 1) : eventGroups(doc, l, u, { ...options, marks: rowMarks(doc, p, u) }));
|
|
949
954
|
if (b.includes) {
|
|
@@ -973,7 +978,8 @@ var iconSize = (group, k) => {
|
|
|
973
978
|
function groupBox(group, k, colW) {
|
|
974
979
|
const pad = group.card ? group.card.pad * k : 0;
|
|
975
980
|
const d = iconSize(group, k);
|
|
976
|
-
const
|
|
981
|
+
const gap = group.icon?.gap === void 0 ? d * ICON_GAP : group.icon.gap * k;
|
|
982
|
+
const iconIndent = d > 0 ? d + gap : 0;
|
|
977
983
|
return { pad, d, iconIndent, avail: colW - 2 * pad - iconIndent };
|
|
978
984
|
}
|
|
979
985
|
function lineSize(line, width, k, avail) {
|
|
@@ -1060,7 +1066,7 @@ function placeIcon(group, box, out) {
|
|
|
1060
1066
|
return bottom2;
|
|
1061
1067
|
}
|
|
1062
1068
|
const textH = bottom2 - top;
|
|
1063
|
-
out?.icons.push({ rect: { x, y: top + Math.max(0, (textH - d) / 2), w: d, h: d }, color: group.icon.color, glyph: group.icon.glyph, kind: group.icon.kind, bare: group.icon.bare });
|
|
1069
|
+
out?.icons.push({ rect: { x, y: top + Math.max(0, (textH - d) / 2) + (group.icon.shift ?? 0), w: d, h: d }, color: group.icon.color, glyph: group.icon.glyph, kind: group.icon.kind, bare: group.icon.bare });
|
|
1064
1070
|
return top + Math.max(textH, d);
|
|
1065
1071
|
}
|
|
1066
1072
|
function placeGroup(m, at, out) {
|
|
@@ -1074,6 +1080,10 @@ function placeGroup(m, at, out) {
|
|
|
1074
1080
|
const { pad, d, iconIndent } = groupBox(group, k, col.w);
|
|
1075
1081
|
const top = y;
|
|
1076
1082
|
y += pad;
|
|
1083
|
+
if (group.icon?.centre === true) {
|
|
1084
|
+
const textH = group.lines.reduce((h, line, i) => h + (sizes[i] ?? 0) * LINE_HEIGHT + (i < group.lines.length - 1 ? (line.gapAfter ?? 0) * k : 0), 0);
|
|
1085
|
+
y += Math.max(0, (d - textH) / 2);
|
|
1086
|
+
}
|
|
1077
1087
|
group.lines.forEach((line, i) => {
|
|
1078
1088
|
const size = sizes[i] ?? 0;
|
|
1079
1089
|
const indent = (indented(line) ? line.size * k * BULLET_INDENT : 0) + iconIndent;
|