bugfix : remove orphan
This commit is contained in:
@@ -44,6 +44,12 @@ export type ThermalSlipData = {
|
||||
logoUrl?: string;
|
||||
/** Optional tagline / address line under the café name. */
|
||||
tagline?: string;
|
||||
/** Optional custom header note (from branch print settings) shown under the name. */
|
||||
header?: string;
|
||||
/** Optional WiFi password line printed near the footer. */
|
||||
wifi?: string;
|
||||
/** Paper width in mm — 58 or 80 (default 80). Controls page width + scale. */
|
||||
paperWidthMm?: number;
|
||||
};
|
||||
|
||||
/** Absolute URL to the bundled Vazirmatn web-font (same origin). */
|
||||
@@ -104,9 +110,14 @@ export function buildThermalDocument(data: ThermalSlipData): string {
|
||||
`;
|
||||
}
|
||||
|
||||
const footerHtml = data.footer
|
||||
? `<hr class="dashed"><div class="center sm muted">${esc(data.footer)}</div>`
|
||||
: "";
|
||||
const wifiLabel = isRtl ? "وایفای" : "WiFi";
|
||||
const footerInner = [
|
||||
data.wifi ? `<div class="center sm">${wifiLabel}: ${esc(data.wifi)}</div>` : "",
|
||||
data.footer ? `<div class="center sm muted">${esc(data.footer)}</div>` : "",
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join("");
|
||||
const footerHtml = footerInner ? `<hr class="dashed">${footerInner}` : "";
|
||||
|
||||
const logoHtml = data.logoUrl
|
||||
? `<img class="logo" src="${esc(data.logoUrl)}" alt="">`
|
||||
@@ -114,6 +125,15 @@ export function buildThermalDocument(data: ThermalSlipData): string {
|
||||
const taglineHtml = data.tagline
|
||||
? `<div class="center tagline">${esc(data.tagline)}</div>`
|
||||
: "";
|
||||
const headerHtml = data.header
|
||||
? `<div class="center header-note">${esc(data.header)}</div>`
|
||||
: "";
|
||||
|
||||
// Paper width: 58 mm or 80 mm. Narrower paper gets a slightly smaller base
|
||||
// font so lines don't wrap awkwardly.
|
||||
const widthMm = data.paperWidthMm === 58 ? 58 : 80;
|
||||
const baseFontPt = widthMm === 58 ? 10 : 11.5;
|
||||
const wrapPadMm = widthMm === 58 ? "3mm 3mm 5mm" : "4mm 4.5mm 6mm";
|
||||
|
||||
const fontUrl = vazirmatnFontUrl();
|
||||
|
||||
@@ -132,18 +152,18 @@ export function buildThermalDocument(data: ThermalSlipData): string {
|
||||
}
|
||||
/* ── Page ─────────────────────────────────────────────────── */
|
||||
@page {
|
||||
/* 80 mm wide; height tracks the content — no blank tail */
|
||||
size: 80mm auto;
|
||||
/* width tracks the configured paper; height tracks content — no blank tail */
|
||||
size: ${widthMm}mm auto;
|
||||
margin: 0;
|
||||
}
|
||||
/* ── Reset ────────────────────────────────────────────────── */
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
/* ── Root ─────────────────────────────────────────────────── */
|
||||
html, body {
|
||||
width: 80mm;
|
||||
width: ${widthMm}mm;
|
||||
direction: ${dir};
|
||||
font-family: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
|
||||
font-size: 11.5pt;
|
||||
font-size: ${baseFontPt}pt;
|
||||
font-weight: 500;
|
||||
line-height: 1.55;
|
||||
color: #000;
|
||||
@@ -152,7 +172,7 @@ html, body {
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
/* ── Wrapper ──────────────────────────────────────────────── */
|
||||
.wrap { padding: 4mm 4.5mm 6mm; }
|
||||
.wrap { padding: ${wrapPadMm}; }
|
||||
/* ── Branding header ──────────────────────────────────────── */
|
||||
.logo {
|
||||
display: block;
|
||||
@@ -174,6 +194,13 @@ html, body {
|
||||
color: #444;
|
||||
margin-top: 0.5mm;
|
||||
}
|
||||
.header-note {
|
||||
font-size: 9pt;
|
||||
font-weight: 600;
|
||||
color: #222;
|
||||
margin-top: 1mm;
|
||||
white-space: pre-line;
|
||||
}
|
||||
.doc-title {
|
||||
text-align: center;
|
||||
font-size: 10pt;
|
||||
@@ -233,6 +260,7 @@ hr.solid { border: none; border-top: 1px solid #000; margin: 2.5mm 0; }
|
||||
${logoHtml}
|
||||
<div class="cafe-name">${esc(data.cafeName)}</div>
|
||||
${taglineHtml}
|
||||
${headerHtml}
|
||||
<div class="doc-title">${esc(data.title)}</div>
|
||||
<div class="date">${esc(data.date)}</div>
|
||||
${data.metaRow ? `<div class="meta">${esc(data.metaRow)}</div>` : ""}
|
||||
|
||||
Reference in New Issue
Block a user