pdf-factory 0.8.11 → 0.8.13

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.
@@ -1720,7 +1720,7 @@ function Ct(e, t, n, r) {
1720
1720
  e.setDrawColor(0), e.setLineWidth(.5), e.line(10, o, i - 10, o), o += 4, z(e, L.SMALL, I.BOLD), e.text("Score:", 10, o);
1721
1721
  for (let t = 0; t < 5; t++) {
1722
1722
  let n = 28 + t * 15;
1723
- e.rect(n, o - 4, 12, 8), z(e, L.TINY, I.NORMAL), e.setTextColor(150), e.text(`Set ${t + 1}`, n + 12 / 2, o - 5, { align: "center" }), e.setTextColor(0);
1723
+ e.rect(n, o - 4, 12, 8), z(e, L.TINY, I.NORMAL), e.setTextColor(150), e.text(`Set ${t + 1}`, n + 6, o - 5, { align: "center" }), e.setTextColor(0);
1724
1724
  }
1725
1725
  o += 14, z(e, L.SMALL, I.NORMAL), e.text("Umpire:", 10, o), e.setDrawColor(150), e.setLineWidth(.3), e.line(30, o, 90, o), e.text("Signature:", i - 10 - 70, o), e.line(i - 10 - 40, o, i - 10, o);
1726
1726
  }
@@ -2595,13 +2595,13 @@ function Fn(e, t, n, r) {
2595
2595
  };
2596
2596
  J(e, t.losersBracket, n, d);
2597
2597
  let f = i.left + c + 8, p = r.contentY + a / 2;
2598
- if (z(e, L.SMALL, I.BOLD), e.text("Decider", f + 28 / 2, p - 14 - 4, { align: "center" }), e.setDrawColor(60), e.setLineWidth(.5), e.rect(f, p - 14 - 1, 28, 14), e.setLineWidth(.2), e.line(f, p - 14 / 2 - 1, f + 28, p - 14 / 2 - 1), t.deciderMatch?.matchUps?.length) {
2598
+ if (z(e, L.SMALL, I.BOLD), e.text("Decider", f + 14, p - 14 - 4, { align: "center" }), e.setDrawColor(60), e.setLineWidth(.5), e.rect(f, p - 14 - 1, 28, 14), e.setLineWidth(.2), e.line(f, p - 7 - 1, f + 28, p - 7 - 1), t.deciderMatch?.matchUps?.length) {
2599
2599
  let n = t.deciderMatch.matchUps[0], r = new Map(t.deciderMatch.slots.map((e) => [e.drawPosition, e]));
2600
2600
  if (n.drawPositions[0]) {
2601
2601
  let t = r.get(n.drawPositions[0]);
2602
2602
  if (t?.participantName) {
2603
2603
  let r = n.winningSide === 1;
2604
- z(e, L.TINY, r ? I.BOLD : I.NORMAL), e.text(t.participantName, f + 1, p - 14 / 2 - 3, { maxWidth: 26 });
2604
+ z(e, L.TINY, r ? I.BOLD : I.NORMAL), e.text(t.participantName, f + 1, p - 7 - 3, { maxWidth: 26 });
2605
2605
  }
2606
2606
  }
2607
2607
  if (n.drawPositions[1]) {
@@ -2651,12 +2651,12 @@ function Vn(e, t, n, r, i, a, o, s) {
2651
2651
  let u = t.drawPositions[0] ? n.get(t.drawPositions[0]) : void 0;
2652
2652
  if (u) {
2653
2653
  let n = Ot(u, r);
2654
- z(e, c, t.winningSide === 1 ? I.BOLD : I.NORMAL), e.text(n, i + Ln, l - c * .15, { maxWidth: o - 2 * Ln });
2654
+ z(e, c, t.winningSide === 1 ? I.BOLD : I.NORMAL), e.text(n, i + Ln, l - c * .15, { maxWidth: o - 2 });
2655
2655
  }
2656
2656
  let d = t.drawPositions[1] ? n.get(t.drawPositions[1]) : void 0;
2657
2657
  if (d) {
2658
2658
  let n = Ot(d, r);
2659
- z(e, c, t.winningSide === 2 ? I.BOLD : I.NORMAL), e.text(n, i + Ln, l + c * .55, { maxWidth: o - 2 * Ln });
2659
+ z(e, c, t.winningSide === 2 ? I.BOLD : I.NORMAL), e.text(n, i + Ln, l + c * .55, { maxWidth: o - 2 });
2660
2660
  }
2661
2661
  if (t.score) {
2662
2662
  let n = q(t.score, r);
@@ -3796,20 +3796,20 @@ function Kr(e, t, n, r) {
3796
3796
  //#endregion
3797
3797
  //#region src/generators/drawSheet.ts
3798
3798
  function qr(t, n = {}) {
3799
- let { header: r, includeSeedings: i = !0, includeScores: a = !0 } = n, o = new e({
3800
- orientation: t.drawSize >= 32 ? "landscape" : "portrait",
3799
+ let { header: r, includeSeedings: i = !0, includeScores: a = !0 } = n, o = t.drawSize >= 32, s = new e({
3800
+ orientation: o ? "landscape" : "portrait",
3801
3801
  format: "a4"
3802
3802
  });
3803
- R(o);
3804
- let s = 15;
3803
+ R(s);
3804
+ let c = 15;
3805
3805
  if (r) {
3806
3806
  let e = `${t.drawName} - ${t.drawType.replace(/_/g, " ")} (${t.drawSize})`;
3807
- s = gt(o, {
3807
+ c = gt(s, {
3808
3808
  ...r,
3809
3809
  subtitle: e
3810
3810
  });
3811
3811
  }
3812
- return s = t.drawSize <= 64 && t.drawSize > 0 ? Jr(o, t, s, a) : Yr(o, t, s), i && t.seedAssignments.length > 0 && Xr(o, t, s + 8), G(o, `Generated ${(/* @__PURE__ */ new Date()).toLocaleDateString()}`), o;
3812
+ return c = t.drawSize <= 64 && t.drawSize > 0 ? Jr(s, t, c, a) : Yr(s, t, c), i && t.seedAssignments.length > 0 && Xr(s, t, c + 8), G(s, `Generated ${(/* @__PURE__ */ new Date()).toLocaleDateString()}`), s;
3813
3813
  }
3814
3814
  function Jr(e, t, n, r) {
3815
3815
  let i = e.internal.pageSize.getWidth(), a = e.internal.pageSize.getHeight(), o = i - 30, s = a - n - 30, c = t.totalRounds, l = Math.min(90, (o - c * 10) / c), u = Math.min(14, s / t.drawSize), d = {
@@ -3943,56 +3943,56 @@ function Xr(e, n, r) {
3943
3943
  //#endregion
3944
3944
  //#region src/generators/schedule.ts
3945
3945
  function Zr(n, r = {}) {
3946
- let { header: i, fullCourtNames: a = !0, notes: o } = r, s = new e({
3947
- orientation: (r.landscape === "auto" ? n.courts.length >= 5 : r.landscape) ? "landscape" : "portrait",
3946
+ let { header: i, fullCourtNames: a = !0, notes: o } = r, s = (r.landscape === "auto" ? n.courts.length >= 5 : r.landscape) ? "landscape" : "portrait", c = new e({
3947
+ orientation: s,
3948
3948
  format: "a4"
3949
3949
  });
3950
- R(s);
3951
- let c = 15;
3950
+ R(c);
3951
+ let l = 15;
3952
3952
  if (i) {
3953
3953
  let e = n.scheduledDate ? `Order of Play - ${n.scheduledDate}` : "Order of Play";
3954
- c = gt(s, {
3954
+ l = gt(c, {
3955
3955
  ...i,
3956
3956
  subtitle: e
3957
3957
  });
3958
3958
  }
3959
- let l = n.courts, u = a ? l : l.map($r);
3959
+ let u = n.courts, d = a ? u : u.map($r);
3960
3960
  for (let e of n.timeSlots) {
3961
- z(s, L.BODY, I.BOLD), s.setTextColor(30, 60, 120), s.text(e.label, 15, c), s.setTextColor(0), c += 4;
3962
- let n = u.map((e) => ({
3961
+ z(c, L.BODY, I.BOLD), c.setTextColor(30, 60, 120), c.text(e.label, 15, l), c.setTextColor(0), l += 4;
3962
+ let n = d.map((e) => ({
3963
3963
  header: e,
3964
3964
  dataKey: e
3965
3965
  })), r = /* @__PURE__ */ new Map();
3966
- l.forEach((e) => r.set(e, []));
3966
+ u.forEach((e) => r.set(e, []));
3967
3967
  for (let t of e.matches) {
3968
3968
  let e = Qr(t), n = r.get(t.courtName) || [];
3969
3969
  n.push(e), r.set(t.courtName, n);
3970
3970
  }
3971
- let o = Math.max(1, ...Array.from(r.values()).map((e) => e.length)), d = [];
3971
+ let o = Math.max(1, ...Array.from(r.values()).map((e) => e.length)), s = [];
3972
3972
  for (let e = 0; e < o; e++) {
3973
3973
  let t = {};
3974
- l.forEach((n, i) => {
3975
- let o = r.get(n) || [], s = a ? n : u[i];
3974
+ u.forEach((n, i) => {
3975
+ let o = r.get(n) || [], s = a ? n : d[i];
3976
3976
  t[s] = o[e] || "";
3977
- }), d.push(t);
3977
+ }), s.push(t);
3978
3978
  }
3979
- t(s, {
3979
+ t(c, {
3980
3980
  ..._t.schedule,
3981
- startY: c,
3981
+ startY: l,
3982
3982
  columns: n,
3983
- body: d,
3983
+ body: s,
3984
3984
  tableWidth: "auto",
3985
3985
  didDrawPage: (e) => {
3986
- G(s, i?.tournamentName || "", e.pageNumber);
3986
+ G(c, i?.tournamentName || "", e.pageNumber);
3987
3987
  }
3988
- }), c = s.lastAutoTable?.finalY + 6 || c + 20;
3988
+ }), l = c.lastAutoTable?.finalY + 6 || l + 20;
3989
3989
  }
3990
3990
  if (o?.length) {
3991
- c += 4, z(s, L.SMALL, I.ITALIC), s.setTextColor(80);
3992
- for (let e of o) s.text(e, 15, c), c += 4;
3993
- s.setTextColor(0);
3991
+ l += 4, z(c, L.SMALL, I.ITALIC), c.setTextColor(80);
3992
+ for (let e of o) c.text(e, 15, l), l += 4;
3993
+ c.setTextColor(0);
3994
3994
  }
3995
- return s;
3995
+ return c;
3996
3996
  }
3997
3997
  function Qr(e) {
3998
3998
  let t = [];
@@ -4014,7 +4014,7 @@ function ni(e, t) {
4014
4014
  let r = t[e];
4015
4015
  if (r === void 0) continue;
4016
4016
  let i = n[e];
4017
- ri(i) && ri(r) ? n[e] = ni(i, r) : n[e] = r;
4017
+ n[e] = ri(i) && ri(r) ? ni(i, r) : r;
4018
4018
  }
4019
4019
  return n;
4020
4020
  }
@@ -4105,37 +4105,37 @@ function pi(e) {
4105
4105
  return t;
4106
4106
  }
4107
4107
  function mi(n, r, i = {}) {
4108
- let a = new e({
4109
- orientation: i.orientation || "landscape",
4108
+ let a = i.orientation || "landscape", o = new e({
4109
+ orientation: a,
4110
4110
  format: "a4"
4111
4111
  });
4112
- R(a);
4113
- let o = 15;
4114
- if (i.header ? o = gt(a, {
4112
+ R(o);
4113
+ let s = 15;
4114
+ if (i.header ? s = gt(o, {
4115
4115
  ...i.header,
4116
4116
  subtitle: i.header.subtitle || i.title
4117
- }) : i.title && (z(a, L.SUBTITLE, I.BOLD), a.text(i.title, 15, o), o += 8), n.length === 0) return z(a, L.BODY, I.ITALIC), a.text("No columns defined", 15, o), G(a, `Generated ${(/* @__PURE__ */ new Date()).toLocaleDateString()}`, 1), a;
4118
- let s = n.map((e) => ({
4117
+ }) : i.title && (z(o, L.SUBTITLE, I.BOLD), o.text(i.title, 15, s), s += 8), n.length === 0) return z(o, L.BODY, I.ITALIC), o.text("No columns defined", 15, s), G(o, `Generated ${(/* @__PURE__ */ new Date()).toLocaleDateString()}`, 1), o;
4118
+ let c = n.map((e) => ({
4119
4119
  header: e.title,
4120
4120
  dataKey: e.key
4121
- })), c = r.map((e) => {
4121
+ })), l = r.map((e) => {
4122
4122
  let t = {};
4123
4123
  for (let r of n) {
4124
4124
  let n = e[r.key];
4125
4125
  t[r.key] = n == null ? "" : String(n);
4126
4126
  }
4127
4127
  return t;
4128
- }), l = pi(n);
4129
- return t(a, {
4128
+ }), u = pi(n);
4129
+ return t(o, {
4130
4130
  ..._t.report,
4131
- startY: o,
4132
- columns: s,
4133
- body: c,
4134
- columnStyles: l,
4131
+ startY: s,
4132
+ columns: c,
4133
+ body: l,
4134
+ columnStyles: u,
4135
4135
  didDrawPage: (e) => {
4136
- G(a, `Generated ${(/* @__PURE__ */ new Date()).toLocaleDateString()}`, e.pageNumber);
4136
+ G(o, `Generated ${(/* @__PURE__ */ new Date()).toLocaleDateString()}`, e.pageNumber);
4137
4137
  }
4138
- }), a;
4138
+ }), o;
4139
4139
  }
4140
4140
  //#endregion
4141
4141
  //#region src/generators/factSheet.ts
@@ -4164,7 +4164,7 @@ function Q(e, t, n) {
4164
4164
  }
4165
4165
  function gi(e, t, n, r) {
4166
4166
  z(e, L.BODY, I.NORMAL);
4167
- let i = r || e.internal.pageSize.getWidth() - Z * 2, a = e.splitTextToSize(t, i);
4167
+ let i = r || e.internal.pageSize.getWidth() - 30, a = e.splitTextToSize(t, i);
4168
4168
  return e.text(a, Z, n), n + a.length * 3.2;
4169
4169
  }
4170
4170
  function $(e, t, n) {