@dloizides/poster-render 0.10.0 → 0.11.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 +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -88,6 +88,8 @@ var LINE_KEY_PATTERN = "^(title|titleBottom|script|footer|includes[.]heading|inc
|
|
|
88
88
|
var MAX_FONT = 40;
|
|
89
89
|
var MIN_SIZE_SCALE = 0.25;
|
|
90
90
|
var MAX_SIZE_SCALE = 3;
|
|
91
|
+
var MIN_WIDTH_SCALE = 0.5;
|
|
92
|
+
var MAX_WIDTH_SCALE = 1.5;
|
|
91
93
|
var MIN_SPACING = -0.1;
|
|
92
94
|
var MAX_SPACING = 0.5;
|
|
93
95
|
var MAX_TIES = 12;
|
|
@@ -99,6 +101,7 @@ var lineStyle = {
|
|
|
99
101
|
properties: {
|
|
100
102
|
font: { type: "string", minLength: 1, maxLength: MAX_FONT, pattern: "^[A-Za-z0-9 ]+$" },
|
|
101
103
|
sizeScale: { type: "number", minimum: MIN_SIZE_SCALE, maximum: MAX_SIZE_SCALE },
|
|
104
|
+
widthScale: { type: "number", minimum: MIN_WIDTH_SCALE, maximum: MAX_WIDTH_SCALE },
|
|
102
105
|
color: { type: "string", pattern: "^#[0-9a-fA-F]{6}$" },
|
|
103
106
|
weight: { type: "integer", enum: WEIGHTS },
|
|
104
107
|
italic: { type: "boolean" },
|
|
@@ -803,6 +806,7 @@ function styled(line, key, sc) {
|
|
|
803
806
|
family: style?.font,
|
|
804
807
|
italic: style?.italic,
|
|
805
808
|
spacing: style?.letterSpacing,
|
|
809
|
+
widthScale: style?.widthScale,
|
|
806
810
|
align: style?.align,
|
|
807
811
|
widthTie,
|
|
808
812
|
sizeTie
|
|
@@ -983,7 +987,7 @@ function groupBox(group, k, colW) {
|
|
|
983
987
|
}
|
|
984
988
|
function lineSize(line, width, k, avail) {
|
|
985
989
|
const indent = bulletIndent(line, k);
|
|
986
|
-
return Math.max(0, Math.min(line.size * k, line.size * (avail - indent) / Math.max(width, 1)));
|
|
990
|
+
return Math.max(0, Math.min(line.size * k, line.size * (avail * (line.widthScale ?? 1) - indent) / Math.max(width, 1)));
|
|
987
991
|
}
|
|
988
992
|
function groupSizes(m, k, avail) {
|
|
989
993
|
const own = m.group.lines.map((line, i) => lineSize(line, m.widths[i] ?? 1, k, avail));
|
|
@@ -1001,7 +1005,7 @@ function tieMembers(all, k, colW, table, pick) {
|
|
|
1001
1005
|
m.group.lines.forEach((line, i) => {
|
|
1002
1006
|
const id = pick(line);
|
|
1003
1007
|
if (id !== void 0) {
|
|
1004
|
-
const member = { line, width: Math.max(m.widths[i] ?? 1, 1), cap: Math.max(0, avail - bulletIndent(line, k)), sizes, i };
|
|
1008
|
+
const member = { line, width: Math.max(m.widths[i] ?? 1, 1), cap: Math.max(0, avail * (line.widthScale ?? 1) - bulletIndent(line, k)), sizes, i };
|
|
1005
1009
|
byId.set(id, [...byId.get(id) ?? [], member]);
|
|
1006
1010
|
}
|
|
1007
1011
|
});
|