From 3fedc705039930920cc24e28d179ee22f4ae8b82 Mon Sep 17 00:00:00 2001 From: grabowski Date: Tue, 7 Apr 2026 11:41:15 +0700 Subject: [PATCH] Fix empty print labels: apply dimensions in all media not just screen Label width/height was inside @media screen so print had no dimensions. Moved to base CSS so labels render in both screen preview and print. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../(app)/components/[id]/print/+page.svelte | 26 +++++++++---------- .../(app)/devices/[id]/print/+page.svelte | 26 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/routes/(app)/components/[id]/print/+page.svelte b/src/routes/(app)/components/[id]/print/+page.svelte index cee0cf5..23b9e01 100644 --- a/src/routes/(app)/components/[id]/print/+page.svelte +++ b/src/routes/(app)/components/[id]/print/+page.svelte @@ -23,25 +23,25 @@ size: 90.3mm 29mm; margin: 1mm; } - @media print { - .no-print { display: none !important; } - body { - margin: 0; - padding: 0; - background: white !important; - } - nav, header, aside { display: none !important; } - main { padding: 0 !important; overflow: visible !important; } - .print-container { break-inside: avoid; } + .label-preview { + width: 90.3mm; + height: 29mm; + background: white; + box-sizing: border-box; + overflow: hidden; } @media screen { .label-preview { border: 1px dashed #ccc; - width: 90.3mm; - height: 29mm; - background: white; } } + @media print { + .no-print { display: none !important; } + body { margin: 0; padding: 0; background: white !important; } + nav, header, aside { display: none !important; } + main { padding: 0 !important; overflow: visible !important; } + .print-container { break-inside: avoid; page-break-after: always; } + } diff --git a/src/routes/(app)/devices/[id]/print/+page.svelte b/src/routes/(app)/devices/[id]/print/+page.svelte index cc1440e..108f4ca 100644 --- a/src/routes/(app)/devices/[id]/print/+page.svelte +++ b/src/routes/(app)/devices/[id]/print/+page.svelte @@ -25,25 +25,25 @@ size: 90.3mm 29mm; margin: 1mm; } - @media print { - .no-print { display: none !important; } - body { - margin: 0; - padding: 0; - background: white !important; - } - nav, header, aside { display: none !important; } - main { padding: 0 !important; overflow: visible !important; } - .print-container { break-inside: avoid; } + .label-preview { + width: 90.3mm; + height: 29mm; + background: white; + box-sizing: border-box; + overflow: hidden; } @media screen { .label-preview { border: 1px dashed #ccc; - width: 90.3mm; - height: 29mm; - background: white; } } + @media print { + .no-print { display: none !important; } + body { margin: 0; padding: 0; background: white !important; } + nav, header, aside { display: none !important; } + main { padding: 0 !important; overflow: visible !important; } + .print-container { break-inside: avoid; page-break-after: always; } + }