@dloizides/poster-render 0.5.0 → 0.7.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 +11 -0
- package/dist/index.d.mts +51 -4
- package/dist/index.d.ts +51 -4
- package/dist/index.js +369 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +369 -53
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,6 +3,7 @@ var BackgroundStyle = /* @__PURE__ */ ((BackgroundStyle2) => {
|
|
|
3
3
|
BackgroundStyle2["Solid"] = "solid";
|
|
4
4
|
BackgroundStyle2["Tint"] = "tint";
|
|
5
5
|
BackgroundStyle2["Horizon"] = "horizon";
|
|
6
|
+
BackgroundStyle2["Brush"] = "brush";
|
|
6
7
|
return BackgroundStyle2;
|
|
7
8
|
})(BackgroundStyle || {});
|
|
8
9
|
|
|
@@ -12,6 +13,7 @@ var FontSetId = /* @__PURE__ */ ((FontSetId2) => {
|
|
|
12
13
|
FontSetId2["Modern"] = "modern";
|
|
13
14
|
FontSetId2["Elegant"] = "elegant";
|
|
14
15
|
FontSetId2["Coastal"] = "coastal";
|
|
16
|
+
FontSetId2["KizombaSample"] = "kizomba-sample";
|
|
15
17
|
return FontSetId2;
|
|
16
18
|
})(FontSetId || {});
|
|
17
19
|
|
|
@@ -46,6 +48,7 @@ var PaletteId = /* @__PURE__ */ ((PaletteId2) => {
|
|
|
46
48
|
PaletteId2["Sea"] = "sea";
|
|
47
49
|
PaletteId2["Rose"] = "rose";
|
|
48
50
|
PaletteId2["GoldenHorizon"] = "golden-horizon";
|
|
51
|
+
PaletteId2["KizombaSample"] = "kizomba-sample";
|
|
49
52
|
return PaletteId2;
|
|
50
53
|
})(PaletteId || {});
|
|
51
54
|
|
|
@@ -72,6 +75,14 @@ var LineTieKind = /* @__PURE__ */ ((LineTieKind2) => {
|
|
|
72
75
|
return LineTieKind2;
|
|
73
76
|
})(LineTieKind || {});
|
|
74
77
|
|
|
78
|
+
// src/enums/RowIcon.ts
|
|
79
|
+
var RowIcon = /* @__PURE__ */ ((RowIcon2) => {
|
|
80
|
+
RowIcon2["Person"] = "person";
|
|
81
|
+
RowIcon2["People"] = "people";
|
|
82
|
+
RowIcon2["Ticket"] = "ticket";
|
|
83
|
+
return RowIcon2;
|
|
84
|
+
})(RowIcon || {});
|
|
85
|
+
|
|
75
86
|
// src/schema/lineStyleSchema.ts
|
|
76
87
|
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]))$";
|
|
77
88
|
var MAX_FONT = 40;
|
|
@@ -147,6 +158,20 @@ var PALETTES = {
|
|
|
147
158
|
arch: "#c7d4d6",
|
|
148
159
|
sky: [[0, "#bfd3d8"], [0.55, "#d4dddd"], [1, "#eadccb"]]
|
|
149
160
|
},
|
|
161
|
+
["kizomba-sample" /* KizombaSample */]: {
|
|
162
|
+
background: "#fefefe",
|
|
163
|
+
tint: "#f3eee9",
|
|
164
|
+
title: "#6d645d",
|
|
165
|
+
accent: "#ad8164",
|
|
166
|
+
ink: "#45372f",
|
|
167
|
+
soft: "#9c8f84",
|
|
168
|
+
card: "#ffffff",
|
|
169
|
+
arch: "#efe8e1",
|
|
170
|
+
script: "#e5bb97",
|
|
171
|
+
icon: "#cca383",
|
|
172
|
+
rule: "#d5bca8",
|
|
173
|
+
brush: ["#cdc3b9", "#96918b", "#daae81"]
|
|
174
|
+
},
|
|
150
175
|
["rose" /* Rose */]: { background: "#f8efec", tint: "#f1e2dd", title: "#9b6b63", accent: "#c9846f", ink: "#4a3934", soft: "#b39a92", card: "#ffffff", arch: "#f1e5e1" }
|
|
151
176
|
};
|
|
152
177
|
|
|
@@ -155,15 +180,68 @@ var FONT_SETS = {
|
|
|
155
180
|
["classic" /* Classic */]: { display: '"Oswald", "Arial Narrow", sans-serif', script: '"Sacramento", cursive', body: '"Fredoka", sans-serif' },
|
|
156
181
|
["modern" /* Modern */]: { display: '"Bebas Neue", "Arial Narrow", sans-serif', script: '"Great Vibes", cursive', body: '"Montserrat", sans-serif' },
|
|
157
182
|
["elegant" /* Elegant */]: { display: '"Playfair Display", serif', script: '"Allura", cursive', body: '"Lato", sans-serif' },
|
|
183
|
+
["kizomba-sample" /* KizombaSample */]: { display: '"Anton", "Oswald", "Arial Narrow", sans-serif', script: '"Sacramento", cursive', body: '"Barlow Semi Condensed", "Fredoka", sans-serif' },
|
|
158
184
|
["coastal" /* Coastal */]: { display: '"Fraunces", Georgia, serif', script: '"Allura", cursive', body: '"Jost", sans-serif' }
|
|
159
185
|
};
|
|
160
186
|
|
|
187
|
+
// src/schema/rowsSchema.ts
|
|
188
|
+
var MAX_ROWS = 6;
|
|
189
|
+
var MAX_PRICES = 4;
|
|
190
|
+
var MIN_ICON = 16;
|
|
191
|
+
var MAX_ICON = 300;
|
|
192
|
+
var MIN_THICKNESS = 0.5;
|
|
193
|
+
var MAX_THICKNESS = 20;
|
|
194
|
+
var MAX_GAP = 120;
|
|
195
|
+
var MAX_OVERLAP = 1.5;
|
|
196
|
+
var MAX_SHIFT = 0.5;
|
|
197
|
+
var MAX_TOP = 600;
|
|
198
|
+
var MAX_LINE_GAP = 200;
|
|
199
|
+
var MIN_TITLE_SCALE = 0.3;
|
|
200
|
+
var MAX_TITLE_SCALE = 2.5;
|
|
201
|
+
var MIN_LABEL_SCALE = 0.3;
|
|
202
|
+
var num = (minimum, maximum) => ({ type: "number", minimum, maximum });
|
|
203
|
+
var icons = (maxItems) => ({ type: "array", items: { type: "string", enum: Object.values(RowIcon) }, minItems: 1, maxItems });
|
|
204
|
+
var rowsSchema = {
|
|
205
|
+
type: "object",
|
|
206
|
+
additionalProperties: false,
|
|
207
|
+
properties: {
|
|
208
|
+
icons: { type: "object", additionalProperties: false, properties: { schedule: icons(MAX_ROWS), prices: icons(MAX_PRICES), size: num(MIN_ICON, MAX_ICON) } },
|
|
209
|
+
dividers: {
|
|
210
|
+
type: "object",
|
|
211
|
+
required: ["thickness"],
|
|
212
|
+
additionalProperties: false,
|
|
213
|
+
properties: {
|
|
214
|
+
thickness: num(MIN_THICKNESS, MAX_THICKNESS),
|
|
215
|
+
color: { type: "string", pattern: "^#[0-9a-fA-F]{6}$" },
|
|
216
|
+
gap: num(0, MAX_GAP),
|
|
217
|
+
toPicture: { type: "boolean" },
|
|
218
|
+
reach: num(0, 1)
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
priceLabelScale: num(MIN_LABEL_SCALE, 1),
|
|
222
|
+
venue: { type: "object", additionalProperties: false, properties: { body: { type: "boolean" }, bare: { type: "boolean" } } }
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
var overlapSchema = {
|
|
226
|
+
type: "object",
|
|
227
|
+
required: ["scale", "dx", "dy"],
|
|
228
|
+
additionalProperties: false,
|
|
229
|
+
properties: { scale: num(1, MAX_OVERLAP), dx: num(-MAX_SHIFT, MAX_SHIFT), dy: num(-MAX_SHIFT, MAX_SHIFT) }
|
|
230
|
+
};
|
|
231
|
+
var headerTuningSchema = {
|
|
232
|
+
headerTop: num(0, MAX_TOP),
|
|
233
|
+
titleScriptGap: num(-MAX_LINE_GAP, MAX_LINE_GAP),
|
|
234
|
+
scriptTitleGap: num(-MAX_LINE_GAP, MAX_LINE_GAP),
|
|
235
|
+
titleScale: num(MIN_TITLE_SCALE, MAX_TITLE_SCALE),
|
|
236
|
+
titleBottomScale: num(MIN_TITLE_SCALE, MAX_TITLE_SCALE)
|
|
237
|
+
};
|
|
238
|
+
|
|
161
239
|
// src/schema/flierDocSchema.ts
|
|
162
240
|
var SHORT = 60;
|
|
163
241
|
var LINE = 120;
|
|
164
|
-
var
|
|
242
|
+
var MAX_ROWS2 = 6;
|
|
165
243
|
var MAX_ITEMS = 8;
|
|
166
|
-
var
|
|
244
|
+
var MAX_PRICES2 = 4;
|
|
167
245
|
var MAX_VENUE = 3;
|
|
168
246
|
var MIN_SCALE = 0.3;
|
|
169
247
|
var MAX_HEADER_GAP = 200;
|
|
@@ -176,7 +254,7 @@ var scheduleRow = {
|
|
|
176
254
|
additionalProperties: false,
|
|
177
255
|
properties: { label: text(SHORT), time: text(SHORT) }
|
|
178
256
|
};
|
|
179
|
-
var scheduleList = { type: "array", items: scheduleRow, minItems: 1, maxItems:
|
|
257
|
+
var scheduleList = { type: "array", items: scheduleRow, minItems: 1, maxItems: MAX_ROWS2 };
|
|
180
258
|
var blocks = {
|
|
181
259
|
type: "object",
|
|
182
260
|
required: ["title"],
|
|
@@ -190,7 +268,7 @@ var blocks = {
|
|
|
190
268
|
prices: {
|
|
191
269
|
type: "array",
|
|
192
270
|
minItems: 1,
|
|
193
|
-
maxItems:
|
|
271
|
+
maxItems: MAX_PRICES2,
|
|
194
272
|
items: {
|
|
195
273
|
type: "object",
|
|
196
274
|
required: ["amount", "label"],
|
|
@@ -202,7 +280,7 @@ var blocks = {
|
|
|
202
280
|
type: "object",
|
|
203
281
|
required: ["heading", "items"],
|
|
204
282
|
additionalProperties: false,
|
|
205
|
-
properties: { heading: text(SHORT), items: { type: "array", items: text(LINE), minItems: 1, maxItems:
|
|
283
|
+
properties: { heading: text(SHORT), items: { type: "array", items: text(LINE), minItems: 1, maxItems: MAX_ROWS2 } }
|
|
206
284
|
},
|
|
207
285
|
footer: text(LINE)
|
|
208
286
|
}
|
|
@@ -229,7 +307,8 @@ var flierDocSchema = {
|
|
|
229
307
|
properties: {
|
|
230
308
|
imageId: text(SHORT),
|
|
231
309
|
anchor: { type: "string", enum: Object.values(PictureAnchor) },
|
|
232
|
-
scale: { type: "number", minimum: MIN_SCALE, maximum: 1 }
|
|
310
|
+
scale: { type: "number", minimum: MIN_SCALE, maximum: 1 },
|
|
311
|
+
overlap: overlapSchema
|
|
233
312
|
}
|
|
234
313
|
},
|
|
235
314
|
logo: { type: "object", required: ["imageId"], additionalProperties: false, properties: { imageId: text(SHORT) } },
|
|
@@ -239,11 +318,13 @@ var flierDocSchema = {
|
|
|
239
318
|
additionalProperties: false,
|
|
240
319
|
properties: {
|
|
241
320
|
headerGap: { type: "number", minimum: 0, maximum: MAX_HEADER_GAP },
|
|
242
|
-
itemDateScale: { type: "number", minimum: MIN_DATE_SCALE, maximum: MAX_DATE_SCALE }
|
|
321
|
+
itemDateScale: { type: "number", minimum: MIN_DATE_SCALE, maximum: MAX_DATE_SCALE },
|
|
322
|
+
...headerTuningSchema
|
|
243
323
|
}
|
|
244
324
|
},
|
|
245
325
|
lineStyles: lineStylesSchema,
|
|
246
326
|
lineTies: lineTiesSchema,
|
|
327
|
+
rows: rowsSchema,
|
|
247
328
|
items: {
|
|
248
329
|
type: "array",
|
|
249
330
|
minItems: 1,
|
|
@@ -403,6 +484,92 @@ function missingAssets(doc, assets) {
|
|
|
403
484
|
return errors;
|
|
404
485
|
}
|
|
405
486
|
|
|
487
|
+
// src/render/shapes.ts
|
|
488
|
+
function polygon(ctx, pts) {
|
|
489
|
+
const first = pts[0];
|
|
490
|
+
if (!first) {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
ctx.beginPath();
|
|
494
|
+
ctx.moveTo(first[0], first[1]);
|
|
495
|
+
pts.slice(1).forEach((p, i) => {
|
|
496
|
+
const next = pts[i + 2] ?? first;
|
|
497
|
+
ctx.arcTo(p[0], p[1], next[0], next[1], 0);
|
|
498
|
+
});
|
|
499
|
+
ctx.closePath();
|
|
500
|
+
ctx.fill();
|
|
501
|
+
}
|
|
502
|
+
function disc(ctx, c, r3, color) {
|
|
503
|
+
ctx.fillStyle = color;
|
|
504
|
+
ctx.beginPath();
|
|
505
|
+
ctx.arc(c[0], c[1], Math.max(0, r3), 0, Math.PI * 2);
|
|
506
|
+
ctx.fill();
|
|
507
|
+
}
|
|
508
|
+
function turnedRect(c, size, angle) {
|
|
509
|
+
const cos = Math.cos(angle);
|
|
510
|
+
const sin = Math.sin(angle);
|
|
511
|
+
const hw = size.w / 2;
|
|
512
|
+
const hh = size.h / 2;
|
|
513
|
+
const corners = [[-hw, -hh], [hw, -hh], [hw, hh], [-hw, hh]];
|
|
514
|
+
return corners.map(([px, py]) => [c[0] + px * cos - py * sin, c[1] + px * sin + py * cos]);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
// src/render/brush.ts
|
|
518
|
+
var CLUSTERS = [
|
|
519
|
+
{ x: -0.14, y: 0.13, w: 0.42, h: 0.35, tone: 0 },
|
|
520
|
+
{ x: -0.16, y: 0.78, w: 0.36, h: 0.22, tone: 1 },
|
|
521
|
+
{ x: 0.78, y: 0.63, w: 0.3, h: 0.3, tone: 2 }
|
|
522
|
+
];
|
|
523
|
+
var STROKES = 7;
|
|
524
|
+
var ALPHA = 0.55;
|
|
525
|
+
var SLANT = -0.3;
|
|
526
|
+
var TAPER = 0.3;
|
|
527
|
+
var SEED = 42;
|
|
528
|
+
var PM_A = 16807;
|
|
529
|
+
var PM_M = 2147483647;
|
|
530
|
+
var JITTER = 0.3;
|
|
531
|
+
var MIN_LENGTH = 0.7;
|
|
532
|
+
var MIN_THICK = 0.6;
|
|
533
|
+
var THICK_RANGE = 0.8;
|
|
534
|
+
var HALF = 0.5;
|
|
535
|
+
function random(seed) {
|
|
536
|
+
let s = seed;
|
|
537
|
+
return () => {
|
|
538
|
+
s = s * PM_A % PM_M;
|
|
539
|
+
return s / PM_M;
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
function stroke(ctx, c, length, thick) {
|
|
543
|
+
const dx = Math.cos(SLANT) * length / 2;
|
|
544
|
+
const dy = Math.sin(SLANT) * length / 2;
|
|
545
|
+
const nx = -Math.sin(SLANT);
|
|
546
|
+
const ny = Math.cos(SLANT);
|
|
547
|
+
const a = thick / 2;
|
|
548
|
+
const b = thick * TAPER / 2;
|
|
549
|
+
polygon(ctx, [
|
|
550
|
+
[c[0] - dx + nx * a, c[1] - dy + ny * a],
|
|
551
|
+
[c[0] + dx + nx * b, c[1] + dy + ny * b],
|
|
552
|
+
[c[0] + dx - nx * b, c[1] + dy - ny * b],
|
|
553
|
+
[c[0] - dx - nx * a, c[1] - dy - ny * a]
|
|
554
|
+
]);
|
|
555
|
+
}
|
|
556
|
+
function paintBrush(ctx, picture, colors) {
|
|
557
|
+
if (colors.length === 0) {
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
const next = random(SEED);
|
|
561
|
+
ctx.globalAlpha = ALPHA;
|
|
562
|
+
CLUSTERS.forEach((cl) => {
|
|
563
|
+
ctx.fillStyle = colors[cl.tone % colors.length] ?? colors[0] ?? "";
|
|
564
|
+
const box = { x: picture.x + picture.w * cl.x, y: picture.y + picture.h * cl.y, w: picture.w * cl.w, h: picture.h * cl.h };
|
|
565
|
+
for (let i = 0; i < STROKES; i++) {
|
|
566
|
+
const c = [box.x + box.w * (HALF + (next() - HALF) * JITTER), box.y + box.h * (i + HALF) / STROKES];
|
|
567
|
+
stroke(ctx, c, box.w * (MIN_LENGTH + (1 - MIN_LENGTH) * next()), box.h / STROKES * (MIN_THICK + THICK_RANGE * next()));
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
ctx.globalAlpha = 1;
|
|
571
|
+
}
|
|
572
|
+
|
|
406
573
|
// src/render/background.ts
|
|
407
574
|
function paintGround(ctx, style, palette, size) {
|
|
408
575
|
ctx.fillStyle = palette.background;
|
|
@@ -414,6 +581,17 @@ function paintGround(ctx, style, palette, size) {
|
|
|
414
581
|
}
|
|
415
582
|
ctx.fillRect(0, 0, size.width, size.height);
|
|
416
583
|
}
|
|
584
|
+
function paintPage(ctx, doc, palette, page) {
|
|
585
|
+
ctx.globalAlpha = 1;
|
|
586
|
+
paintGround(ctx, doc.background, palette, page);
|
|
587
|
+
if (doc.background === "tint" /* Tint */) {
|
|
588
|
+
ctx.fillStyle = palette.tint;
|
|
589
|
+
[page.geo.header, page.geo.body].forEach((r3) => ctx.fillRect(r3.x, r3.y, r3.w, r3.h));
|
|
590
|
+
}
|
|
591
|
+
if (doc.background === "brush" /* Brush */ && page.picture) {
|
|
592
|
+
paintBrush(ctx, page.picture, palette.brush ?? [palette.tint, palette.arch]);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
417
595
|
|
|
418
596
|
// src/layout/layoutSpecs.ts
|
|
419
597
|
var flanksBeside = (pic, top, bottom2, m) => [
|
|
@@ -636,12 +814,14 @@ var GAP = {
|
|
|
636
814
|
row: 30,
|
|
637
815
|
venue: 40,
|
|
638
816
|
includes: 24,
|
|
639
|
-
rule: 8
|
|
817
|
+
rule: 8,
|
|
818
|
+
divider: 24
|
|
640
819
|
};
|
|
641
820
|
var makers = (p, u, sc) => ({
|
|
642
821
|
display: (text2, size, key) => styled({ text: text2, role: "display", weight: BOLD, size: size * u, color: p.title }, key, sc),
|
|
643
822
|
venue: (text2, size, key) => styled({ text: text2, role: "display", weight: MEDIUM, size: size * u, color: p.ink }, key, sc),
|
|
644
|
-
|
|
823
|
+
bodyVenue: (text2, size, key) => styled({ text: text2, role: "body", weight: BOLD, size: size * u, color: p.ink }, key, sc),
|
|
824
|
+
script: (text2, size, key) => styled({ text: text2, role: "script", weight: SCRIPT, size: size * u, color: p.script ?? p.accent }, key, sc),
|
|
645
825
|
strong: (text2, size, key) => styled({ text: text2, role: "body", weight: BOLD, size: size * u, color: p.ink }, key, sc),
|
|
646
826
|
accent: (text2, size, key) => styled({ text: text2, role: "body", weight: SEMI, size: size * u, color: p.accent }, key, sc),
|
|
647
827
|
item: (text2, size, key) => styled({ text: text2, role: "body", weight: SEMI, size: size * u, color: p.ink, bullet: p.accent }, key, sc),
|
|
@@ -650,7 +830,11 @@ var makers = (p, u, sc) => ({
|
|
|
650
830
|
function headerGroups(doc, p, u) {
|
|
651
831
|
const l = makers(p, u, styleContext(doc));
|
|
652
832
|
const b = doc.blocks;
|
|
653
|
-
const
|
|
833
|
+
const t = doc.tuning;
|
|
834
|
+
const gap = (line, after) => after === void 0 ? line : { ...line, gapAfter: after * u };
|
|
835
|
+
const title = gap(l.display(b.title, SIZE.title * (t?.titleScale ?? 1), "title"), b.script ?? b.titleBottom ? t?.titleScriptGap : void 0);
|
|
836
|
+
const script = b.script ? gap(l.script(b.script, SIZE.headerScript, "script"), b.titleBottom ? t?.scriptTitleGap : void 0) : void 0;
|
|
837
|
+
const lines = [title, script, b.titleBottom ? l.display(b.titleBottom, SIZE.title * (t?.titleBottomScale ?? 1), "titleBottom") : void 0];
|
|
654
838
|
return [{ lines: lines.filter((x) => x !== void 0), gapAfter: 0 }];
|
|
655
839
|
}
|
|
656
840
|
function itemGroup(item, n, l, scale) {
|
|
@@ -663,6 +847,19 @@ function itemGroup(item, n, l, scale) {
|
|
|
663
847
|
return { lines, gapAfter: GAP.item * u };
|
|
664
848
|
}
|
|
665
849
|
var WRAP_FROM = 14;
|
|
850
|
+
function dividerOf(doc, p, u) {
|
|
851
|
+
const d = doc.rows?.dividers;
|
|
852
|
+
return d === void 0 ? void 0 : { color: d.color ?? p.rule ?? p.accent, height: d.thickness * u, gap: (d.gap ?? GAP.divider) * u };
|
|
853
|
+
}
|
|
854
|
+
function rowMarks(doc, p, u) {
|
|
855
|
+
const divider = dividerOf(doc, p, u);
|
|
856
|
+
const size = doc.rows?.icons?.size;
|
|
857
|
+
return (icons2, i, last) => {
|
|
858
|
+
const kind = icons2 === void 0 || icons2.length === 0 ? void 0 : icons2[Math.min(i, icons2.length - 1)];
|
|
859
|
+
const icon = kind === void 0 ? {} : { icon: { color: p.icon ?? p.accent, glyph: p.background, kind, size: size === void 0 ? void 0 : size * u } };
|
|
860
|
+
return { ...icon, ...divider === void 0 || last ? {} : { rule: divider, ruleBelow: true, ruleAbove: false } };
|
|
861
|
+
};
|
|
862
|
+
}
|
|
666
863
|
function halves(text2) {
|
|
667
864
|
const mid = text2.length / 2;
|
|
668
865
|
const spaces = [...text2].flatMap((c, i) => c === " " ? [i] : []);
|
|
@@ -680,14 +877,16 @@ function eventGroups(doc, l, u, options) {
|
|
|
680
877
|
const b = doc.blocks;
|
|
681
878
|
const groups = [];
|
|
682
879
|
const schedule2 = b.schedule ?? [];
|
|
880
|
+
const prices = (options.withPrices === false ? void 0 : b.prices) ?? [];
|
|
881
|
+
const lastRow = schedule2.length + prices.length - 1;
|
|
882
|
+
const icons2 = doc.rows?.icons;
|
|
683
883
|
schedule2.forEach((row, i) => {
|
|
684
884
|
const lines = options.compact ? [l.strong(`${row.label} ${row.time}`, SIZE.scheduleLabel, `schedule.${i}.label`)] : [l.strong(row.label, SIZE.scheduleLabel, `schedule.${i}.label`), l.accent(row.time, SIZE.scheduleTime, `schedule.${i}.time`)];
|
|
685
|
-
groups.push({ lines, gapAfter: GAP.row * u, keepWithNext: i < schedule2.length - 1 });
|
|
885
|
+
groups.push({ lines, gapAfter: GAP.row * u, keepWithNext: i < schedule2.length - 1, ...options.marks(icons2?.schedule, i, i === lastRow) });
|
|
686
886
|
});
|
|
687
|
-
const prices = (options.withPrices === false ? void 0 : b.prices) ?? [];
|
|
688
887
|
prices.forEach((row, i) => {
|
|
689
|
-
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, `prices.${i}.label`)];
|
|
690
|
-
groups.push({ lines, gapAfter: GAP.row * u, keepWithNext: i < prices.length - 1 });
|
|
888
|
+
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`)];
|
|
889
|
+
groups.push({ lines, gapAfter: GAP.row * u, keepWithNext: i < prices.length - 1, ...options.marks(icons2?.prices, i, schedule2.length + i === lastRow) });
|
|
691
890
|
});
|
|
692
891
|
return groups;
|
|
693
892
|
}
|
|
@@ -711,9 +910,11 @@ function bodyGroups(doc, p, u, options = {}) {
|
|
|
711
910
|
if (b.venue) {
|
|
712
911
|
const size = isList ? SIZE.listVenue : SIZE.venue;
|
|
713
912
|
const keepWithNext = !isList && (b.schedule?.length ?? 0) > 0;
|
|
714
|
-
|
|
913
|
+
const look = doc.rows?.venue;
|
|
914
|
+
const line = look?.body === true ? l.bodyVenue : l.venue;
|
|
915
|
+
groups.push({ lines: b.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 });
|
|
715
916
|
}
|
|
716
|
-
groups.push(...isList ? listGroups(doc, l, u, options.dateScale ?? 1) : eventGroups(doc, l, u, options));
|
|
917
|
+
groups.push(...isList ? listGroups(doc, l, u, options.dateScale ?? 1) : eventGroups(doc, l, u, { ...options, marks: rowMarks(doc, p, u) }));
|
|
717
918
|
if (b.includes) {
|
|
718
919
|
const lines = [l.accent(b.includes.heading, SIZE.small, "includes.heading"), ...b.includes.items.map((item, i) => l.item(item, SIZE.small, `includes.items.${i}`))].flatMap((line) => wrapped(line, options.wrap));
|
|
719
920
|
groups.push({ lines, gapAfter: GAP.includes * u, uniform: true, keepWithNext: b.footer !== void 0, attachNext: b.footer !== void 0 });
|
|
@@ -733,6 +934,9 @@ var indented = (line) => line.bullet !== void 0 || line.hang === true;
|
|
|
733
934
|
var bulletIndent = (line, k) => indented(line) ? line.size * k * BULLET_INDENT : 0;
|
|
734
935
|
var iconSize = (group, k) => {
|
|
735
936
|
const first = group.lines[0];
|
|
937
|
+
if (group.icon?.size !== void 0) {
|
|
938
|
+
return group.icon.size * k;
|
|
939
|
+
}
|
|
736
940
|
return group.icon && first ? first.size * k * LINE_HEIGHT * ICON_SCALE : 0;
|
|
737
941
|
};
|
|
738
942
|
function groupBox(group, k, colW) {
|
|
@@ -825,16 +1029,16 @@ function placeIcon(group, box, out) {
|
|
|
825
1029
|
return bottom2;
|
|
826
1030
|
}
|
|
827
1031
|
const textH = bottom2 - top;
|
|
828
|
-
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 });
|
|
1032
|
+
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 });
|
|
829
1033
|
return top + Math.max(textH, d);
|
|
830
1034
|
}
|
|
831
1035
|
function placeGroup(m, at, out) {
|
|
832
1036
|
const { k, col, y0, sizes } = at;
|
|
833
1037
|
const { group } = m;
|
|
834
1038
|
let y = y0;
|
|
835
|
-
if (group.rule) {
|
|
1039
|
+
if (group.rule && group.ruleAbove !== false) {
|
|
836
1040
|
out?.rules.push({ rect: { x: col.x, y, w: col.w * RULE_WIDTH, h: group.rule.height * k }, color: group.rule.color });
|
|
837
|
-
y += group.rule.height * k * RULE_GAP;
|
|
1041
|
+
y += group.rule.gap === void 0 ? group.rule.height * k * RULE_GAP : (group.rule.height + group.rule.gap) * k;
|
|
838
1042
|
}
|
|
839
1043
|
const { pad, d, iconIndent } = groupBox(group, k, col.w);
|
|
840
1044
|
const top = y;
|
|
@@ -848,12 +1052,12 @@ function placeGroup(m, at, out) {
|
|
|
848
1052
|
if (line.bullet && out) {
|
|
849
1053
|
out.bullets.push({ x: col.x + pad + size * BULLET_RADIUS, y: y + size * LINE_HEIGHT / 2, r: size * BULLET_RADIUS, color: line.bullet });
|
|
850
1054
|
}
|
|
851
|
-
y += size * LINE_HEIGHT;
|
|
1055
|
+
y += size * LINE_HEIGHT + (line.gapAfter ?? 0) * k;
|
|
852
1056
|
});
|
|
853
1057
|
y = placeIcon(group, { d, x: col.x + pad, top: top + pad, bottom: y }, out);
|
|
854
1058
|
y += pad;
|
|
855
1059
|
if (group.rule && group.ruleBelow) {
|
|
856
|
-
y += group.rule.height * k * (RULE_GAP - 1);
|
|
1060
|
+
y += group.rule.gap === void 0 ? group.rule.height * k * (RULE_GAP - 1) : group.rule.gap * k;
|
|
857
1061
|
out?.rules.push({ rect: { x: col.x, y, w: col.w * RULE_WIDTH, h: group.rule.height * k }, color: group.rule.color });
|
|
858
1062
|
y += group.rule.height * k;
|
|
859
1063
|
}
|
|
@@ -1031,6 +1235,13 @@ function splitHeader(header, hasLogo) {
|
|
|
1031
1235
|
const logoW = hasLogo ? Math.round(header.w * LOGO_SHARE) : 0;
|
|
1032
1236
|
return { text: { ...header, w: header.w - logoW * 1.1 }, logo: { ...header, x: header.x + header.w - logoW, w: logoW } };
|
|
1033
1237
|
}
|
|
1238
|
+
function headerAt(zones, top, u) {
|
|
1239
|
+
if (top === void 0) {
|
|
1240
|
+
return zones;
|
|
1241
|
+
}
|
|
1242
|
+
const y = Math.round(top * u);
|
|
1243
|
+
return { ...zones, text: { ...zones.text, y, h: Math.max(1, zones.text.y + zones.text.h - y) } };
|
|
1244
|
+
}
|
|
1034
1245
|
function closeHeaderGap(geo, head, gap, u) {
|
|
1035
1246
|
const { header, body } = geo;
|
|
1036
1247
|
const stacked = header.y + header.h <= body.y && header.x < body.x + body.w && body.x < header.x + header.w;
|
|
@@ -1043,7 +1254,7 @@ function closeHeaderGap(geo, head, gap, u) {
|
|
|
1043
1254
|
function flowAll(ctx, input, geo, reflow) {
|
|
1044
1255
|
const { doc, palette, fonts } = input;
|
|
1045
1256
|
const u = Math.min(input.width, input.height) / BASE;
|
|
1046
|
-
const zones = geo.logo ? { text: geo.header, logo: geo.logo } : splitHeader(geo.header, doc.logo !== void 0);
|
|
1257
|
+
const zones = headerAt(geo.logo ? { text: geo.header, logo: geo.logo } : splitHeader(geo.header, doc.logo !== void 0), doc.tuning?.headerTop, u);
|
|
1047
1258
|
const head = flow(ctx, headerGroups(doc, palette, u), zones.text, fonts);
|
|
1048
1259
|
const flanks = geo.flanks ?? [];
|
|
1049
1260
|
const tight = closeHeaderGap(geo, head, doc.tuning?.headerGap, u);
|
|
@@ -1117,6 +1328,87 @@ function fitToFloor(ctx, input) {
|
|
|
1117
1328
|
return best ?? flowAll(ctx, input, base2, { compact: false, wrap: false});
|
|
1118
1329
|
}
|
|
1119
1330
|
|
|
1331
|
+
// src/render/overlap.ts
|
|
1332
|
+
var clamp = (v, lo, hi) => Math.min(Math.max(v, lo), hi);
|
|
1333
|
+
function placePicture(image, region, slot, fit) {
|
|
1334
|
+
const base2 = placeContain(image, region, { anchor: slot.anchor, alignX: fit.alignX, scale: slot.scale });
|
|
1335
|
+
const o = slot.overlap;
|
|
1336
|
+
if (o === void 0) {
|
|
1337
|
+
return base2;
|
|
1338
|
+
}
|
|
1339
|
+
const { width, height } = fit.frame;
|
|
1340
|
+
const s = Math.min(o.scale, width / Math.max(base2.w, 1), height / Math.max(base2.h, 1));
|
|
1341
|
+
const w = Math.floor(base2.w * s);
|
|
1342
|
+
const h = Math.floor(base2.h * s);
|
|
1343
|
+
const x = base2.x + (base2.w - w) * fit.alignX + o.dx * width;
|
|
1344
|
+
const y = base2.y + (base2.h - h) * ANCHOR_Y[slot.anchor] + o.dy * height;
|
|
1345
|
+
return { x: Math.round(clamp(x, 0, width - w)), y: Math.round(clamp(y, 0, height - h)), w, h };
|
|
1346
|
+
}
|
|
1347
|
+
function reachPicture(rules, picture, reach) {
|
|
1348
|
+
const end = picture.x + picture.w * reach;
|
|
1349
|
+
rules.filter((r3) => r3.rect.y >= picture.y && r3.rect.y <= picture.y + picture.h).forEach((r3) => {
|
|
1350
|
+
r3.rect.w = Math.max(0, end - r3.rect.x);
|
|
1351
|
+
});
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
// src/render/rowIcons.ts
|
|
1355
|
+
var LINE2 = 0.03;
|
|
1356
|
+
var HEAD_Y = -0.15;
|
|
1357
|
+
var HEAD_R = 0.1;
|
|
1358
|
+
var BODY_Y = 0.25;
|
|
1359
|
+
var BODY_R = 0.2;
|
|
1360
|
+
var BACK_DX = 0.12;
|
|
1361
|
+
var BACK_DY = -0.04;
|
|
1362
|
+
var FRONT_DX = -0.08;
|
|
1363
|
+
var PAIR_SCALE = 0.85;
|
|
1364
|
+
var TICKET_W = 0.52;
|
|
1365
|
+
var TICKET_H = 0.3;
|
|
1366
|
+
var TICKET_TURN = -Math.PI / 4;
|
|
1367
|
+
var PERFORATION = 0.14;
|
|
1368
|
+
var DOTS = [-0.3, 0, 0.3];
|
|
1369
|
+
var DOT = 0.035;
|
|
1370
|
+
function halfDisc(ctx, c, r3, color) {
|
|
1371
|
+
ctx.fillStyle = color;
|
|
1372
|
+
ctx.beginPath();
|
|
1373
|
+
ctx.arc(c[0], c[1], Math.max(0, r3), Math.PI, Math.PI * 2);
|
|
1374
|
+
ctx.closePath();
|
|
1375
|
+
ctx.fill();
|
|
1376
|
+
}
|
|
1377
|
+
function person(ctx, c, d, colors) {
|
|
1378
|
+
const w = d * LINE2;
|
|
1379
|
+
const head = [c[0], c[1] + d * HEAD_Y];
|
|
1380
|
+
disc(ctx, head, d * HEAD_R, colors.glyph);
|
|
1381
|
+
disc(ctx, head, d * HEAD_R - w, colors.fill);
|
|
1382
|
+
halfDisc(ctx, [c[0], c[1] + d * BODY_Y], d * BODY_R, colors.glyph);
|
|
1383
|
+
halfDisc(ctx, [c[0], c[1] + d * BODY_Y - w], d * BODY_R - 2 * w, colors.fill);
|
|
1384
|
+
}
|
|
1385
|
+
function people(ctx, c, d, colors) {
|
|
1386
|
+
const s = d * PAIR_SCALE;
|
|
1387
|
+
person(ctx, [c[0] + d * BACK_DX, c[1] + d * BACK_DY], s, colors);
|
|
1388
|
+
person(ctx, [c[0] + d * FRONT_DX, c[1]], s, colors);
|
|
1389
|
+
}
|
|
1390
|
+
function ticket(ctx, c, d, colors) {
|
|
1391
|
+
const w = d * LINE2;
|
|
1392
|
+
ctx.fillStyle = colors.glyph;
|
|
1393
|
+
polygon(ctx, turnedRect(c, { w: d * TICKET_W, h: d * TICKET_H }, TICKET_TURN));
|
|
1394
|
+
ctx.fillStyle = colors.fill;
|
|
1395
|
+
polygon(ctx, turnedRect(c, { w: d * TICKET_W - 2 * w, h: d * TICKET_H - 2 * w }, TICKET_TURN));
|
|
1396
|
+
const along = [Math.cos(TICKET_TURN), Math.sin(TICKET_TURN)];
|
|
1397
|
+
const across = [-along[1], along[0]];
|
|
1398
|
+
const x = d * PERFORATION;
|
|
1399
|
+
DOTS.forEach((t) => disc(ctx, [c[0] + along[0] * x + across[0] * t * d * TICKET_H, c[1] + along[1] * x + across[1] * t * d * TICKET_H], d * DOT, colors.glyph));
|
|
1400
|
+
}
|
|
1401
|
+
var GLYPHS = {
|
|
1402
|
+
["person" /* Person */]: person,
|
|
1403
|
+
["people" /* People */]: people,
|
|
1404
|
+
["ticket" /* Ticket */]: ticket
|
|
1405
|
+
};
|
|
1406
|
+
function drawRowIcon(ctx, r3, kind, colors) {
|
|
1407
|
+
const c = [r3.x + r3.w / 2, r3.y + r3.h / 2];
|
|
1408
|
+
disc(ctx, c, r3.w / 2, colors.fill);
|
|
1409
|
+
GLYPHS[kind](ctx, c, r3.w, colors);
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1120
1412
|
// src/render/render.ts
|
|
1121
1413
|
var BASE2 = 1080;
|
|
1122
1414
|
var NO_SPACING2 = "0px";
|
|
@@ -1128,18 +1420,23 @@ var PIN_TIP_Y = 0.28;
|
|
|
1128
1420
|
var PIN_HOLE = 0.42;
|
|
1129
1421
|
var ARC_START = 0.75;
|
|
1130
1422
|
var ARC_END = 2.25;
|
|
1131
|
-
|
|
1423
|
+
var BARE_SCALE = 1.6;
|
|
1424
|
+
function drawPin(ctx, r3, colors, bare = false) {
|
|
1425
|
+
const { color, glyph } = bare ? { color: colors.glyph, glyph: colors.color } : colors;
|
|
1426
|
+
const w = bare ? r3.w * BARE_SCALE : r3.w;
|
|
1132
1427
|
const cx = r3.x + r3.w / 2;
|
|
1133
1428
|
const cy = r3.y + r3.h / 2;
|
|
1134
|
-
const hy = cy -
|
|
1135
|
-
const rad =
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1429
|
+
const hy = cy - w * PIN_HEAD_Y;
|
|
1430
|
+
const rad = w * PIN_HEAD_R;
|
|
1431
|
+
if (!bare) {
|
|
1432
|
+
ctx.fillStyle = color;
|
|
1433
|
+
ctx.beginPath();
|
|
1434
|
+
ctx.arc(cx, cy, r3.w / 2, 0, Math.PI * 2);
|
|
1435
|
+
ctx.fill();
|
|
1436
|
+
}
|
|
1140
1437
|
ctx.fillStyle = glyph;
|
|
1141
1438
|
ctx.beginPath();
|
|
1142
|
-
ctx.moveTo(cx, cy +
|
|
1439
|
+
ctx.moveTo(cx, cy + w * PIN_TIP_Y);
|
|
1143
1440
|
ctx.arc(cx, hy, rad, Math.PI * ARC_START, Math.PI * ARC_END);
|
|
1144
1441
|
ctx.closePath();
|
|
1145
1442
|
ctx.fill();
|
|
@@ -1159,11 +1456,13 @@ function roundRect(ctx, r3, radius) {
|
|
|
1159
1456
|
ctx.closePath();
|
|
1160
1457
|
ctx.fill();
|
|
1161
1458
|
}
|
|
1162
|
-
function
|
|
1459
|
+
function drawRules(ctx, f) {
|
|
1163
1460
|
f.rules.forEach((r3) => {
|
|
1164
1461
|
ctx.fillStyle = r3.color;
|
|
1165
1462
|
ctx.fillRect(r3.rect.x, r3.rect.y, r3.rect.w, r3.rect.h);
|
|
1166
1463
|
});
|
|
1464
|
+
}
|
|
1465
|
+
function drawMarks(ctx, f, radius) {
|
|
1167
1466
|
f.cards.forEach((c) => {
|
|
1168
1467
|
ctx.fillStyle = c.color;
|
|
1169
1468
|
roundRect(ctx, c.rect, radius);
|
|
@@ -1174,7 +1473,7 @@ function drawFlow(ctx, f, radius) {
|
|
|
1174
1473
|
ctx.arc(b.x, b.y, b.r, 0, Math.PI * 2);
|
|
1175
1474
|
ctx.fill();
|
|
1176
1475
|
});
|
|
1177
|
-
f.icons.forEach((i) => drawPin(ctx, i.rect, i.color, i.glyph));
|
|
1476
|
+
f.icons.forEach((i) => i.kind === void 0 ? drawPin(ctx, i.rect, { color: i.color, glyph: i.glyph }, i.bare) : drawRowIcon(ctx, i.rect, i.kind, { fill: i.color, glyph: i.glyph }));
|
|
1178
1477
|
ctx.textAlign = "left";
|
|
1179
1478
|
ctx.textBaseline = "top";
|
|
1180
1479
|
f.texts.forEach((t) => {
|
|
@@ -1189,6 +1488,10 @@ function drawFlow(ctx, f, radius) {
|
|
|
1189
1488
|
}
|
|
1190
1489
|
});
|
|
1191
1490
|
}
|
|
1491
|
+
function drawFlow(ctx, f, radius) {
|
|
1492
|
+
drawRules(ctx, f);
|
|
1493
|
+
drawMarks(ctx, f, radius);
|
|
1494
|
+
}
|
|
1192
1495
|
function checked(input, assets) {
|
|
1193
1496
|
const result = validateFlierDoc(input);
|
|
1194
1497
|
if (!result.ok) {
|
|
@@ -1220,6 +1523,25 @@ function capAligned(zone, head) {
|
|
|
1220
1523
|
const shift = first ? Math.min(Math.max(0, Math.round(first.y + first.h * CAP_TOP) - zone.y), Math.round(zone.h / 2)) : 0;
|
|
1221
1524
|
return { ...zone, y: zone.y + shift, h: zone.h - shift };
|
|
1222
1525
|
}
|
|
1526
|
+
function placeOnPage(doc, assets, fitted, frame) {
|
|
1527
|
+
const image = doc.picture ? assets[doc.picture.imageId] : void 0;
|
|
1528
|
+
const region = pictureRegion(doc.layout, fitted.geo, fitted.body, frame);
|
|
1529
|
+
const picture = image && doc.picture ? placePicture(image, region, doc.picture, { alignX: fitted.geo.alignX, frame }) : null;
|
|
1530
|
+
const dividers = doc.rows?.dividers;
|
|
1531
|
+
if (picture && dividers?.toPicture === true) {
|
|
1532
|
+
reachPicture(fitted.body.rules, picture, dividers.reach ?? 0);
|
|
1533
|
+
}
|
|
1534
|
+
return { image, region, picture };
|
|
1535
|
+
}
|
|
1536
|
+
function drawLogo(ctx, doc, assets, fitted) {
|
|
1537
|
+
const logoImage = doc.logo ? assets[doc.logo.imageId] : void 0;
|
|
1538
|
+
const zone = fitted.geo.logo ? fitted.zones.logo : capAligned(fitted.zones.logo, fitted.head);
|
|
1539
|
+
const logo = logoImage ? placeContain(logoImage, zone, { anchor: "top" /* Top */, alignX: 1, scale: 1 }) : null;
|
|
1540
|
+
if (logoImage && logo) {
|
|
1541
|
+
ctx.drawImage(logoImage, logo.x, logo.y, logo.w, logo.h);
|
|
1542
|
+
}
|
|
1543
|
+
return logo;
|
|
1544
|
+
}
|
|
1223
1545
|
function render(input, assets, canvas) {
|
|
1224
1546
|
const doc = checked(input, assets);
|
|
1225
1547
|
const { width, height } = FORMAT_SIZES[doc.format];
|
|
@@ -1230,40 +1552,34 @@ function render(input, assets, canvas) {
|
|
|
1230
1552
|
throw new Error("poster-render: the canvas has no 2d context");
|
|
1231
1553
|
}
|
|
1232
1554
|
const palette = PALETTES[doc.palette];
|
|
1233
|
-
const
|
|
1234
|
-
const
|
|
1235
|
-
const {
|
|
1236
|
-
ctx
|
|
1237
|
-
paintGround(ctx, doc.background, palette, { width, height });
|
|
1238
|
-
if (doc.background === "tint" /* Tint */) {
|
|
1239
|
-
ctx.fillStyle = palette.tint;
|
|
1240
|
-
[geo.header, geo.body].forEach((r3) => ctx.fillRect(r3.x, r3.y, r3.w, r3.h));
|
|
1241
|
-
}
|
|
1555
|
+
const fitted = fitToFloor(ctx, { doc, palette, fonts: FONT_SETS[doc.fonts], width, height });
|
|
1556
|
+
const { geo, head, body, sides } = fitted;
|
|
1557
|
+
const { image, region, picture } = placeOnPage(doc, assets, fitted, { width, height, u: Math.min(width, height) / BASE2 });
|
|
1558
|
+
paintPage(ctx, doc, palette, { geo, width, height, picture });
|
|
1242
1559
|
const radius = Math.min(width, height) * CARD_RADIUS;
|
|
1243
|
-
[head, body, ...sides]
|
|
1244
|
-
const
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
ctx.drawImage(logoImage, logo.x, logo.y, logo.w, logo.h);
|
|
1248
|
-
}
|
|
1249
|
-
const image = doc.picture ? assets[doc.picture.imageId] : void 0;
|
|
1560
|
+
const flows = [head, body, ...sides];
|
|
1561
|
+
const layered = doc.picture?.overlap !== void 0;
|
|
1562
|
+
flows.forEach((f) => layered ? drawRules(ctx, f) : drawFlow(ctx, f, radius));
|
|
1563
|
+
const logo = drawLogo(ctx, doc, assets, fitted);
|
|
1250
1564
|
const backdrop = image ? archRect(geo) : null;
|
|
1251
1565
|
if (backdrop) {
|
|
1252
1566
|
drawArch(ctx, backdrop, palette.arch);
|
|
1253
1567
|
}
|
|
1254
|
-
const region = pictureRegion(doc.layout, geo, body, { height, u });
|
|
1255
|
-
const picture = image && doc.picture ? placeContain(image, region, { anchor: doc.picture.anchor, alignX: geo.alignX, scale: doc.picture.scale }) : null;
|
|
1256
1568
|
if (image && picture) {
|
|
1257
1569
|
ctx.drawImage(image, picture.x, picture.y, picture.w, picture.h);
|
|
1258
1570
|
}
|
|
1571
|
+
if (layered) {
|
|
1572
|
+
flows.forEach((f) => drawMarks(ctx, f, radius));
|
|
1573
|
+
}
|
|
1259
1574
|
return {
|
|
1260
1575
|
width,
|
|
1261
1576
|
height,
|
|
1262
1577
|
picture,
|
|
1263
1578
|
pictureRegion: region,
|
|
1264
|
-
textBoxes:
|
|
1579
|
+
textBoxes: flows.flatMap((f) => f.texts.map((t) => t.box)),
|
|
1265
1580
|
cardBoxes: body.cards.map((c) => c.rect),
|
|
1266
|
-
iconBoxes:
|
|
1581
|
+
iconBoxes: flows.flatMap((f) => f.icons.map((i) => i.rect)),
|
|
1582
|
+
ruleBoxes: flows.flatMap((f) => f.rules.map((r3) => r3.rect)),
|
|
1267
1583
|
logo,
|
|
1268
1584
|
backdrop
|
|
1269
1585
|
};
|
|
@@ -1359,6 +1675,6 @@ var kizombaWorkshop = {
|
|
|
1359
1675
|
};
|
|
1360
1676
|
var kizombaWorkshopDocs = [...WORKSHOPS.map(workshopDoc), kizombaWorkshop];
|
|
1361
1677
|
|
|
1362
|
-
export { BackgroundStyle, FONT_SETS, FORMAT_SIZES, FlierDocError, FontSetId, FormatId, LAYOUT_CATALOGUE, LINE_KEY_PATTERN, LayoutId, LineAlign, LineTieKind, PALETTES, PaletteId, PictureAnchor, defaultLayoutFor, exportPng, flierDocSchema, kizombaWorkshop, kizombaWorkshopDocs, render, sameSize, sameWidth, validateFlierDoc };
|
|
1678
|
+
export { BackgroundStyle, FONT_SETS, FORMAT_SIZES, FlierDocError, FontSetId, FormatId, LAYOUT_CATALOGUE, LINE_KEY_PATTERN, LayoutId, LineAlign, LineTieKind, PALETTES, PaletteId, PictureAnchor, RowIcon, defaultLayoutFor, exportPng, flierDocSchema, kizombaWorkshop, kizombaWorkshopDocs, render, sameSize, sameWidth, validateFlierDoc };
|
|
1363
1679
|
//# sourceMappingURL=index.mjs.map
|
|
1364
1680
|
//# sourceMappingURL=index.mjs.map
|