@patterkit/cli 0.2.3 → 0.2.5
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/cli.js +30 -14
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -196971,6 +196971,7 @@ async function runReportXlsx(data) {
|
|
|
196971
196971
|
const totalRow = scenes.addRow(sceneRow("TOTAL", totals));
|
|
196972
196972
|
totalRow.font = { bold: true };
|
|
196973
196973
|
scenes.getRow(1).font = { bold: true };
|
|
196974
|
+
scenes.views = [{ state: "frozen", ySplit: 1 }];
|
|
196974
196975
|
const chars = wb.addWorksheet("Characters");
|
|
196975
196976
|
chars.columns = [
|
|
196976
196977
|
{ header: "Character", key: "character", width: 20 },
|
|
@@ -196989,6 +196990,7 @@ async function runReportXlsx(data) {
|
|
|
196989
196990
|
});
|
|
196990
196991
|
}
|
|
196991
196992
|
chars.getRow(1).font = { bold: true };
|
|
196993
|
+
chars.views = [{ state: "frozen", ySplit: 1 }];
|
|
196992
196994
|
if (data.locales.length > 0) {
|
|
196993
196995
|
const loc = wb.addWorksheet("Localisation");
|
|
196994
196996
|
loc.columns = [
|
|
@@ -197000,6 +197002,7 @@ async function runReportXlsx(data) {
|
|
|
197000
197002
|
];
|
|
197001
197003
|
for (const l2 of data.locales) loc.addRow(l2);
|
|
197002
197004
|
loc.getRow(1).font = { bold: true };
|
|
197005
|
+
loc.views = [{ state: "frozen", ySplit: 1 }];
|
|
197003
197006
|
}
|
|
197004
197007
|
if (data.estimating && data.coverage.estimated > 0) {
|
|
197005
197008
|
const plan = wb.addWorksheet("Estimates");
|
|
@@ -197012,6 +197015,7 @@ async function runReportXlsx(data) {
|
|
|
197012
197015
|
const coverageRow = plan.addRow({ name: `coverage: ${data.coverage.estimated}/${data.coverage.totalScenes} scenes estimated` });
|
|
197013
197016
|
coverageRow.font = { italic: true };
|
|
197014
197017
|
plan.getRow(1).font = { bold: true };
|
|
197018
|
+
plan.views = [{ state: "frozen", ySplit: 1 }];
|
|
197015
197019
|
}
|
|
197016
197020
|
return Buffer.from(await wb.xlsx.writeBuffer());
|
|
197017
197021
|
}
|
|
@@ -197343,6 +197347,7 @@ async function catalogToXlsx(catalog) {
|
|
|
197343
197347
|
{ header: "Gender", key: "gender", width: 12 }
|
|
197344
197348
|
];
|
|
197345
197349
|
ws.getRow(1).font = { bold: true };
|
|
197350
|
+
ws.views = [{ state: "frozen", ySplit: 1 }];
|
|
197346
197351
|
for (const e of entries) {
|
|
197347
197352
|
ws.addRow({
|
|
197348
197353
|
id: e.id,
|
|
@@ -197472,6 +197477,7 @@ async function voiceScriptToXlsx(data) {
|
|
|
197472
197477
|
{ header: "Status", key: "status", width: 12 }
|
|
197473
197478
|
];
|
|
197474
197479
|
ws.getRow(1).font = { bold: true };
|
|
197480
|
+
ws.views = [{ state: "frozen", ySplit: 1 }];
|
|
197475
197481
|
for (const l2 of data.lines) {
|
|
197476
197482
|
const row = ws.addRow({
|
|
197477
197483
|
scope: l2.scope,
|
|
@@ -197573,7 +197579,7 @@ function targetLabel(to, sceneOf, blockTrail) {
|
|
|
197573
197579
|
function gameEventLabel(beat) {
|
|
197574
197580
|
const gd = beat.gameData;
|
|
197575
197581
|
if (gd && typeof gd === "object") {
|
|
197576
|
-
const parts = Object.entries(gd).
|
|
197582
|
+
const parts = Object.entries(gd).map(([k, v]) => {
|
|
197577
197583
|
const val = v == null ? "" : typeof v === "object" ? JSON.stringify(v) : String(v);
|
|
197578
197584
|
return val === "" ? k : `${k}: ${val}`;
|
|
197579
197585
|
});
|
|
@@ -237370,7 +237376,7 @@ var isEmoji = (cp) => cp >= 126976 || cp >= 9728 && cp <= 10175;
|
|
|
237370
237376
|
async function scriptToPdf(doc) {
|
|
237371
237377
|
const { scriptFont: scriptFont2 } = await Promise.resolve().then(() => (init_script_fonts(), script_fonts_exports));
|
|
237372
237378
|
return new Promise((resolve6, reject2) => {
|
|
237373
|
-
const pdf = new PDFDocument({ size: "A4", margins: { top: MARGIN, bottom: MARGIN, left: MARGIN, right: MARGIN }, info: { Title: doc.project, Author: "Patter" } });
|
|
237379
|
+
const pdf = new PDFDocument({ size: "A4", margins: { top: MARGIN, bottom: MARGIN, left: MARGIN, right: MARGIN }, info: { Title: doc.project, Author: "Patter" }, font: null });
|
|
237374
237380
|
pdf.registerFont("Serif", scriptFont2("serif"));
|
|
237375
237381
|
pdf.registerFont("Serif-Bold", scriptFont2("serifBold"));
|
|
237376
237382
|
pdf.registerFont("Serif-Italic", scriptFont2("serifItalic"));
|
|
@@ -237467,13 +237473,12 @@ async function scriptToPdf(doc) {
|
|
|
237467
237473
|
bodyX = cueX + pdf.widthOfString(el.character.toUpperCase()) + CUE_GAP;
|
|
237468
237474
|
}
|
|
237469
237475
|
const yTop = pdf.y;
|
|
237470
|
-
pdf.fontSize(BODY);
|
|
237471
|
-
draw([...el.direction ? split(`(${el.direction}) `, "Serif-Italic", MUTED) : [], ...bodyPieces(el.runs, INK_READ)], bodyX, { width: Math.max(120, pageRight - bodyX), lineGap: LEAD });
|
|
237472
|
-
const yEnd = pdf.y;
|
|
237473
237476
|
if (el.character) {
|
|
237474
237477
|
pdf.font("Sans-Bold").fontSize(CUE).fillColor(hex(characterColour(el.character))).text(el.character.toUpperCase(), cueX, yTop + ascentPt("Serif", BODY) - ascentPt("Sans-Bold", CUE), { lineBreak: false });
|
|
237478
|
+
pdf.y = yTop;
|
|
237475
237479
|
}
|
|
237476
|
-
pdf.
|
|
237480
|
+
pdf.fontSize(BODY);
|
|
237481
|
+
draw([...el.direction ? split(`(${el.direction}) `, "Serif-Italic", MUTED) : [], ...bodyPieces(el.runs, INK_READ)], bodyX, { width: Math.max(120, pageRight - bodyX), lineGap: LEAD });
|
|
237477
237482
|
break;
|
|
237478
237483
|
}
|
|
237479
237484
|
case "narration":
|
|
@@ -237497,21 +237502,29 @@ async function scriptToPdf(doc) {
|
|
|
237497
237502
|
const tag = el.tag ? el.tag.toUpperCase() : "";
|
|
237498
237503
|
const tagW = tag ? pdf.font("Sans").fontSize(7.5).widthOfString(tag) + 8 : 0;
|
|
237499
237504
|
const yStart = pdf.y;
|
|
237500
|
-
|
|
237501
|
-
draw([...split("\u25C7 ", "Serif", ACCENT), ...bodyPieces(el.runs, INK)], ox, { width: Math.max(80, pageRight - ox - tagW), indent: -HANG2, lineGap: LEAD });
|
|
237502
|
-
const yEnd = pdf.y;
|
|
237503
|
-
if (tag && yEnd >= yStart) {
|
|
237505
|
+
if (tag) {
|
|
237504
237506
|
pdf.font("Sans").fontSize(7.5).fillColor(MUTED).text(tag, pageRight - tagW, yStart, { width: tagW, align: "right", lineBreak: false });
|
|
237505
|
-
pdf.y =
|
|
237507
|
+
pdf.y = yStart;
|
|
237506
237508
|
}
|
|
237509
|
+
pdf.fontSize(BODY);
|
|
237510
|
+
draw([...split("\u25C7 ", "Serif", ACCENT), ...bodyPieces(el.runs, INK)], ox, { width: Math.max(80, pageRight - ox - tagW), indent: -HANG2, lineGap: LEAD });
|
|
237507
237511
|
break;
|
|
237508
237512
|
}
|
|
237509
237513
|
case "jump":
|
|
237510
237514
|
drawRight(split(`\u21AA ${el.text}`, "Sans-Bold", ACCENT), 9.5);
|
|
237511
237515
|
break;
|
|
237512
|
-
case "gameEvent":
|
|
237513
|
-
|
|
237516
|
+
case "gameEvent": {
|
|
237517
|
+
const pieces = split(`\u2699 ${el.text}`, "Mono", ACCENT);
|
|
237518
|
+
pdf.fontSize(9);
|
|
237519
|
+
let total = 0;
|
|
237520
|
+
for (const p of pieces) {
|
|
237521
|
+
pdf.font(p.font);
|
|
237522
|
+
total += pdf.widthOfString(p.text);
|
|
237523
|
+
}
|
|
237524
|
+
if (total <= pageRight - cx2) drawRight(pieces, 9);
|
|
237525
|
+
else draw(pieces, cx2, { width: pageRight - cx2 });
|
|
237514
237526
|
break;
|
|
237527
|
+
}
|
|
237515
237528
|
}
|
|
237516
237529
|
};
|
|
237517
237530
|
const leadOf = (k) => k === "scene" ? 24 : k === "block" ? 16 : k === "group" ? 13 : k === "else" ? 9 : 0;
|
|
@@ -237525,10 +237538,12 @@ async function scriptToPdf(doc) {
|
|
|
237525
237538
|
const sameNext = sid !== void 0 && next !== void 0 && "snippet" in next && next.snippet === sid;
|
|
237526
237539
|
if (el.kind === "scene") ensure2(90);
|
|
237527
237540
|
else if (el.kind === "block") ensure2(70);
|
|
237541
|
+
else ensure2(leadOf(el.kind) + BODY + LEAD + 14);
|
|
237528
237542
|
pdf.y += leadOf(el.kind);
|
|
237529
237543
|
const base = "indent" in el ? MARGIN + el.indent * INDENT_STEP : MARGIN;
|
|
237530
237544
|
const cx2 = base + (sid !== void 0 ? EDGE_INSET : 0);
|
|
237531
237545
|
const yTop = pdf.y;
|
|
237546
|
+
const pageBefore = pdf.page;
|
|
237532
237547
|
drawContent(el, cx2);
|
|
237533
237548
|
const bottom = pdf.y;
|
|
237534
237549
|
const trail = el.kind === "condition" ? TIGHT : el.kind === "scene" ? 12 : el.kind === "block" ? 11 : el.kind === "group" ? 7 : el.kind === "else" ? 4 : sid !== void 0 ? sameNext ? WITHIN2 : BETWEEN : BEAT;
|
|
@@ -237538,7 +237553,8 @@ async function scriptToPdf(doc) {
|
|
|
237538
237553
|
curBase = "indent" in el ? el.indent : 0;
|
|
237539
237554
|
}
|
|
237540
237555
|
const ex = MARGIN + curBase * INDENT_STEP + EDGE_OFF;
|
|
237541
|
-
pdf.
|
|
237556
|
+
const top = pdf.page === pageBefore ? yTop : MARGIN;
|
|
237557
|
+
pdf.strokeColor(EDGE).lineWidth(0.75).moveTo(ex, top).lineTo(ex, bottom + (sameNext ? trail : 0)).stroke();
|
|
237542
237558
|
}
|
|
237543
237559
|
pdf.y = bottom + trail;
|
|
237544
237560
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patterkit/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "The `patter` CLI: validate, format, export, and play a Patter project.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@patterkit/core": "0.2.0",
|
|
33
|
-
"@patterkit/ops": "0.3.
|
|
33
|
+
"@patterkit/ops": "0.3.5",
|
|
34
34
|
"@wildwinter/simple-vc-lib": "^0.4.1"
|
|
35
35
|
}
|
|
36
36
|
}
|