ghost-paper 0.3.3 → 0.3.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.
@@ -2,7 +2,7 @@ import {
2
2
  build,
3
3
  buildPdf,
4
4
  buildPrintHtml
5
- } from "./chunk-BYWWJNGV.js";
5
+ } from "./chunk-6PJNYUG6.js";
6
6
  export {
7
7
  build,
8
8
  buildPdf,
@@ -971,6 +971,24 @@ var CSS = `
971
971
  color: var(--text-primary);
972
972
  }
973
973
 
974
+ /* Row-level tinting: charcoal = confirmed, chartreuse = forward-looking */
975
+ .tab-content tbody tr.row-actual td {
976
+ background: #E8E7E3;
977
+ }
978
+ .tab-content tbody tr.row-baseline td {
979
+ background: #F1F3E4;
980
+ }
981
+ .tab-content tbody tr.row-forecast td {
982
+ background: #ECF0DA;
983
+ }
984
+ .tab-content tbody tr.row-stretch td {
985
+ background: #E8EDCF;
986
+ }
987
+ .tab-content tbody tr.row-total td {
988
+ border-top: 2px solid var(--charcoal);
989
+ font-weight: 600;
990
+ }
991
+
974
992
  hr.pagebreak {
975
993
  border: none;
976
994
  border-top: 1px solid var(--border);
@@ -1268,6 +1286,23 @@ var PRINT_CSS = `
1268
1286
  .tab-content tbody td { padding: 8px 10px; font-weight: 400; border-bottom: 1px solid #E8E8E4; }
1269
1287
  .tab-content tbody tr:last-child td { border-bottom: none; }
1270
1288
 
1289
+ .tab-content tbody tr.row-actual td {
1290
+ background: #E5E4E0;
1291
+ }
1292
+ .tab-content tbody tr.row-baseline td {
1293
+ background: #EFF1E1;
1294
+ }
1295
+ .tab-content tbody tr.row-forecast td {
1296
+ background: #E9EDD7;
1297
+ }
1298
+ .tab-content tbody tr.row-stretch td {
1299
+ background: #E5EACC;
1300
+ }
1301
+ .tab-content tbody tr.row-total td {
1302
+ border-top: 2px solid #2A2A28;
1303
+ font-weight: 600;
1304
+ }
1305
+
1271
1306
  /* KPIs: compact grid for column width */
1272
1307
  .kpi-strip {
1273
1308
  margin: 12px 0; padding: 8px 0;
@@ -1363,12 +1398,32 @@ ${kpis}
1363
1398
  </div>`;
1364
1399
  }
1365
1400
  function renderTable(table, wide) {
1366
- const thead = table.headers.map((h) => `<th>${escapeHtml3(h)}</th>`).join("");
1401
+ const colCount = table.headers.length;
1402
+ const totalParts = 1.15 + (colCount - 1);
1403
+ const firstPct = (1.15 / totalParts * 100).toFixed(1);
1404
+ const otherPct = (1 / totalParts * 100).toFixed(1);
1405
+ const thead = table.headers.map((h, i) => {
1406
+ const w = i === 0 ? firstPct : otherPct;
1407
+ return `<th style="width:${w}%">${escapeHtml3(h)}</th>`;
1408
+ }).join("");
1367
1409
  const tbody = table.rows.map((row) => {
1410
+ const firstCell = (row[0] || "").toLowerCase();
1411
+ let rowClass = "";
1412
+ if (/baseline/.test(firstCell)) {
1413
+ rowClass = ' class="row-baseline"';
1414
+ } else if (/stretch|\btarget\b/.test(firstCell)) {
1415
+ rowClass = ' class="row-stretch"';
1416
+ } else if (/forecast|projected|plan|budget|estimate/.test(firstCell)) {
1417
+ rowClass = ' class="row-forecast"';
1418
+ } else if (/actual/.test(firstCell)) {
1419
+ rowClass = ' class="row-actual"';
1420
+ } else if (/^(grand\s+)?total$|^sub\s*total$|^sum$/.test(firstCell.trim())) {
1421
+ rowClass = ' class="row-total"';
1422
+ }
1368
1423
  const cells = row.map((cell) => {
1369
1424
  return `<td>${escapeHtml3(cell)}</td>`;
1370
1425
  }).join("");
1371
- return `<tr>${cells}</tr>`;
1426
+ return `<tr${rowClass}>${cells}</tr>`;
1372
1427
  }).join("\n ");
1373
1428
  const wideClass = wide || table.headers.length >= 5 ? " table-wide" : "";
1374
1429
  return ` <div class="table-wrap${wideClass}"><table>
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  build
4
- } from "./chunk-BYWWJNGV.js";
4
+ } from "./chunk-6PJNYUG6.js";
5
5
 
6
6
  // src/cli.ts
7
7
  import { Command } from "commander";
@@ -90,7 +90,7 @@ buildCmd.command("pdf").description("Convert a markdown file to a PDF report").a
90
90
  const inputPath = resolve(input);
91
91
  const markdown = readFileSync(inputPath, "utf-8");
92
92
  const outputPath = opts.output ? resolve(opts.output) : inputPath.replace(/\.md$/, ".pdf");
93
- const { buildPdf } = await import("./-EDFCYK7D.js");
93
+ const { buildPdf } = await import("./-TBUK2SY6.js");
94
94
  await buildPdf(markdown, outputPath, {
95
95
  pageSize: opts.pageSize ?? "A4",
96
96
  landscape: opts.landscape ?? false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ghost-paper",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "Turn markdown into beautiful HTML reports",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",