Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
File size: 5,959 Bytes
52c6936 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | /* ---------------------------------------------------------------------------
customer-grid / route print sheet (W46-T20, instruction 10, ruling R6, C6)
Route export is the browser's own Save as PDF. No new dependency, no renderer:
a print stylesheet plus a body level portal, which is the pattern the catalog
export already proves in this codebase (catalogPrint.ts plus the print block
in index.css keyed off `cg-cat-printing`).
THREE THINGS THIS FILE OWES, and each one is load bearing:
1. ISOLATION. When a person prints a route, the app shell, the grid, the map
and every panel must not print. `body > *` is hidden and the one portal is
revealed, exactly as the catalog block does it. Its class names are NOT
reused: `cg-cat-printing` un-hides only `.cg-cat-print-portal`, so
borrowing it would print a blank page with no error anywhere.
2. THE HEIGHT RESET. index.css sets `html, body, #root { height: 100% }`, and
the shell above that scrolls inside its own panes. Left alone, a flowing
stop list is clipped to ONE page: the stops past the fold never lay out,
so they are absent from the PDF and Chromium emits no link annotation for
them either. The reset below is the whole reason the tail of a long route
reaches paper.
3. VISIBLE ANCHORS. A PDF link annotation is emitted by the print engine for
a real `<a href>` that is VISIBLE in the print layout. Nothing here may
hide, collapse or zero out a stop link, and `break-inside: avoid` keeps a
stop from being torn across a page boundary.
β NO `@page` RULE ON PURPOSE. `@page` is global to the document and cannot be
scoped to a class, so a margin declared here would also reach the catalog
export, which sets its own `@page { margin: 0 }` from generated CSS. The
browser's default page margin is honest and costs nothing. That also keeps
this sheet free of literal lengths in the type scale sense: every size below
is a `--lp-fs-*` token, per DESIGN.md and the R5 font gate.
Tokens come from the `:root` block in index.css, which is where they must be
read from here: this portal mounts on `document.body`, OUTSIDE the grid
surface, so any token declared on a wrapper element would be undefined in it.
--------------------------------------------------------------------------- */
/* Parked off screen rather than display:none while a print is in flight, so the
sheet has real layout the moment the dialog opens. It is mounted only for the
duration of a print, so on screen this rule is all it ever is. */
.cg-w46-route-print-portal {
position: fixed;
left: -20000px;
top: 0;
}
/* ββ the control itself, on screen ββββββββββββββββββββββββββββββββββββββββββ
It lives in the Route panel beside the Maps links, so it borrows that block's
vocabulary rather than inventing one. The button resets native chrome, which
is the house rule for every button in this app. */
.cg-w46-route-export {
display: flex;
flex-direction: column;
gap: 0.35rem;
padding: 0.5rem 0 0;
border-top: 1px solid var(--lp-line);
}
.cg-w46-route-export h3 {
margin: 0;
font-size: var(--lp-fs-2xs);
font-weight: 600;
color: var(--lp-ink);
}
.cg-w46-route-export p {
margin: 0;
font-size: var(--lp-fs-3xs);
color: var(--lp-muted);
}
.cg-w46-route-export-open {
align-self: flex-start;
border: 0;
padding: 4px 7px;
border-radius: var(--lp-r-sm);
background: var(--lp-primary);
color: var(--cg-white);
font-family: inherit;
font-size: var(--lp-fs-3xs);
font-weight: 600;
cursor: pointer;
}
.cg-w46-route-export-open:hover:enabled { opacity: 0.9; }
.cg-w46-route-export-open:disabled { opacity: 0.55; cursor: default; }
.cg-w46-route-export-open:focus-visible {
outline: 2px solid var(--lp-blue-deep);
outline-offset: 2px;
}
@media print {
html.cg-w46-route-printing,
html.cg-w46-route-printing body {
height: auto !important;
min-height: 0 !important;
max-height: none !important;
overflow: visible !important;
margin: 0;
padding: 0;
background: var(--cg-white);
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}
html.cg-w46-route-printing body > * {
display: none !important;
}
html.cg-w46-route-printing body > .cg-w46-route-print-portal {
display: block !important;
position: static !important;
left: auto !important;
top: auto !important;
}
.cg-w46-route-print-sheet {
color: var(--lp-ink);
font-size: var(--lp-fs-sm);
line-height: 1.45;
}
.cg-w46-route-print-title {
margin: 0;
font-size: var(--lp-fs-lg);
font-weight: 600;
color: var(--lp-primary);
}
.cg-w46-route-print-meta {
margin: 0.25rem 0 0.75rem;
font-size: var(--lp-fs-2xs);
color: var(--lp-muted);
}
.cg-w46-route-print-stops {
margin: 0;
padding: 0;
list-style: none;
}
/* A stop torn across a page boundary is how an anchor loses its annotation. */
.cg-w46-route-print-stop {
display: flex;
gap: 0.6rem;
padding: 0.4rem 0;
border-top: 1px solid var(--lp-line);
break-inside: avoid;
page-break-inside: avoid;
}
.cg-w46-print-pos {
flex: 0 0 auto;
min-width: 1.6rem;
font-weight: 600;
color: var(--lp-primary);
}
.cg-w46-print-body {
display: flex;
flex-direction: column;
gap: 0.1rem;
}
.cg-w46-print-name {
font-weight: 600;
}
.cg-w46-print-address,
.cg-w46-print-nolink {
font-size: var(--lp-fs-2xs);
color: var(--lp-muted);
}
/* The clickable half. Underlined and coloured so a reader can see on paper
that it was a link, and never hidden, so the engine emits the annotation. */
.cg-w46-print-link {
font-size: var(--lp-fs-2xs);
color: var(--lp-primary);
text-decoration: underline;
}
}
|