@danieldeusing/design 0.1.5 → 0.2.0

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/src/print.css ADDED
@@ -0,0 +1,359 @@
1
+ /*
2
+ * danieldeusing-design — print layer.
3
+ *
4
+ * Paper is a different device, not a narrow screen. This layer strips the parts
5
+ * of the terminal look that only exist to sell "a CRT is running" — scanlines,
6
+ * phosphor glow, sticky chrome, the reveal animation — and lays the content out
7
+ * as a document: black on white, 12px body text, sane page breaks.
8
+ *
9
+ * Load LAST (index.css imports it after every other layer) so its token
10
+ * overrides win on source order without needing !important on each one.
11
+ *
12
+ * Three things here are load-bearing and easy to lose in a refactor:
13
+ *
14
+ * 1. The terminal reveal is forced open. runtime/terminal.js only reveals a
15
+ * [data-term-out] once its section scrolls into view, so a long page that
16
+ * is printed straight after load has most of its content sitting at
17
+ * visibility:hidden. Printing it would silently produce blank pages — the
18
+ * reader only finds out on paper. Everything is forced visible here
19
+ * regardless of animation state.
20
+ * 2. `zoom` is reset. Pages that use the resolution-independent zoom trick
21
+ * (html.style.zoom = innerWidth / 1920) carry that multiplier into the
22
+ * print box, which is what makes a printout come out oversized.
23
+ * 3. Mermaid bakes the ACTIVE theme's colours into the SVG at render time, so
24
+ * a diagram rendered under `green`/`mono` is dark-on-dark on paper no
25
+ * matter what the page tokens say. The SVG parts are repainted below.
26
+ */
27
+
28
+ @media print {
29
+ @page {
30
+ margin: 14mm 12mm;
31
+ }
32
+
33
+ /* ── ink-frugal palette, whatever theme is on screen ────────────────────
34
+ `html[data-theme]` matches the specificity of the themed token blocks in
35
+ tokens.css and comes later in the bundle, so it wins for every theme. */
36
+ :root,
37
+ html,
38
+ html[data-theme] {
39
+ --background: #ffffff;
40
+ --foreground: #111111;
41
+ --card: #ffffff;
42
+ --card-foreground: #111111;
43
+ --popover: #ffffff;
44
+ --popover-foreground: #111111;
45
+ --primary: #000000;
46
+ --primary-foreground: #ffffff;
47
+ --secondary: #ffffff;
48
+ --secondary-foreground: #111111;
49
+ --muted: #ffffff;
50
+ --muted-foreground: #444444;
51
+ --accent: #000000;
52
+ --accent-foreground: #ffffff;
53
+ --destructive: #7a1c1c;
54
+ --border: #9a9a9a;
55
+ --input: #9a9a9a;
56
+ --ring: #000000;
57
+ --glow: transparent;
58
+ --glow-soft: transparent;
59
+ --scanline-opacity: 0;
60
+ }
61
+
62
+ /* ── document metrics ──────────────────────────────────────────────────
63
+ The rem baseline is pinned so the design's rem scale lands where it was
64
+ drawn, and the body size is stated in px so it is 12px on paper whatever
65
+ the browser's default font size is. `zoom` is a screen-only device. */
66
+ html {
67
+ zoom: 1 !important;
68
+ font-size: 16px;
69
+ scroll-behavior: auto;
70
+ }
71
+
72
+ body {
73
+ background: #ffffff;
74
+ color: var(--foreground);
75
+ font-size: 12px;
76
+ line-height: 1.45;
77
+ overflow: visible;
78
+ }
79
+
80
+ /* CRT scanline overlay: a fixed, full-viewport gradient — on paper it is a
81
+ grey wash over the page. */
82
+ body::after {
83
+ display: none !important;
84
+ }
85
+
86
+ /* ── nothing animates on paper ─────────────────────────────────────────
87
+ Also the mechanism that un-hides the terminal reveal: the keyframes use
88
+ `both`, so killing the animation restores the element's own opacity. */
89
+ *,
90
+ *::before,
91
+ *::after {
92
+ animation: none !important;
93
+ transition: none !important;
94
+ text-shadow: none !important;
95
+ box-shadow: none !important;
96
+ }
97
+
98
+ /* ── the reveal must never decide what lands on paper ──────────────────
99
+ See note 1 at the top of this file. */
100
+ html.term-anim [data-term] [data-term-out],
101
+ html.term-anim [data-term] [data-term-out]:not(.term-show),
102
+ html.term-anim [data-term] [data-term-out] > * {
103
+ visibility: visible !important;
104
+ opacity: 1 !important;
105
+ }
106
+ html.term-anim [data-term] .prompt:not(.term-live) {
107
+ color: var(--muted-foreground) !important;
108
+ }
109
+ html.term-anim [data-term] .prompt:not(.term-live)::before {
110
+ color: var(--primary) !important;
111
+ }
112
+
113
+ /* ── screen-only chrome ────────────────────────────────────────────────
114
+ .toc is the "On this page" navigator: a screen affordance with no meaning
115
+ on paper, and the first thing that makes a printout look broken. */
116
+ header.bar,
117
+ footer.status,
118
+ .site-nav,
119
+ .nav-burger,
120
+ .mobile-nav,
121
+ .mobile-footer,
122
+ .skip-link,
123
+ .dropdown,
124
+ .dropdown-panel,
125
+ .anim-toggle,
126
+ .cursor-block,
127
+ .term-caret,
128
+ .ascii-rule,
129
+ .toc,
130
+ #ddtip {
131
+ display: none !important;
132
+ }
133
+
134
+ /* The `ls -l` rail sits inside .site-nav, so the rule above already hides it —
135
+ but the room it reserved is padding on the BODY, and that would print as a
136
+ 17rem gutter down the right of every page. Hiding a fixed element does not
137
+ reclaim the space something else was told to leave for it. */
138
+ body {
139
+ padding-right: 0 !important;
140
+ }
141
+
142
+ [data-tip] {
143
+ cursor: auto;
144
+ }
145
+ span[data-tip],
146
+ th[data-tip] {
147
+ border-bottom: 0;
148
+ }
149
+
150
+ /* ── layout: the page is the column ────────────────────────────────────
151
+ .wrap/.layout/.content are the documentation-template vocabulary shipped
152
+ in templates/documentation.html. */
153
+ .wrap {
154
+ max-width: none !important;
155
+ margin: 0 !important;
156
+ padding: 0 !important;
157
+ }
158
+ .layout {
159
+ display: block !important;
160
+ }
161
+ .content {
162
+ min-width: 0;
163
+ }
164
+
165
+ /* ── heading hierarchy against a 12px body ─────────────────────────────
166
+ 24 / 18 / 16 / 14 px. !important because page-level rules give these
167
+ classes a higher specificity than a bare element selector. */
168
+ h1,
169
+ .title {
170
+ font-size: 1.5rem !important;
171
+ }
172
+ h2 {
173
+ font-size: 1.15rem !important;
174
+ }
175
+ h3,
176
+ .sub {
177
+ font-size: 1rem !important;
178
+ }
179
+ h4 {
180
+ font-size: 0.9rem !important;
181
+ }
182
+
183
+ .prompt {
184
+ font-size: 0.7rem;
185
+ }
186
+
187
+ /* ── page breaks ───────────────────────────────────────────────────────
188
+ A heading (or a `$ command` section header) must never be the last thing
189
+ on a page. Tables break between rows and repeat their header; everything
190
+ that reads as one unit stays together. */
191
+ h1,
192
+ h2,
193
+ h3,
194
+ h4,
195
+ .prompt,
196
+ .toc-label {
197
+ break-after: avoid-page;
198
+ break-inside: avoid;
199
+ }
200
+ p,
201
+ li,
202
+ blockquote {
203
+ orphans: 3;
204
+ widows: 3;
205
+ }
206
+ pre,
207
+ figure,
208
+ blockquote,
209
+ tr,
210
+ img,
211
+ .eli5,
212
+ .card-terminal {
213
+ break-inside: avoid;
214
+ }
215
+ /* NOT svg. A mermaid flowchart is routinely taller than a printed page;
216
+ `break-inside: avoid` on the SVG pushes it past the page boundary while its
217
+ wrapper stays behind, which prints an entire page as an empty bordered box.
218
+ Let the SVG break where the wrapper breaks. */
219
+ svg {
220
+ break-inside: auto;
221
+ }
222
+ thead {
223
+ display: table-header-group;
224
+ }
225
+
226
+ /* ── nothing scrolls on paper ──────────────────────────────────────────
227
+ An overflow-x container has no scrollbar in print: whatever sits past the
228
+ right edge is simply gone. Let it wrap instead. */
229
+ .table-scroll,
230
+ pre,
231
+ .diagram {
232
+ overflow: visible !important;
233
+ max-width: 100% !important;
234
+ }
235
+ pre {
236
+ white-space: pre-wrap !important;
237
+ overflow-wrap: anywhere;
238
+ font-size: 0.75rem !important;
239
+ background: transparent !important;
240
+ }
241
+ pre.mermaid[data-processed] {
242
+ white-space: normal !important;
243
+ }
244
+ code {
245
+ background: transparent !important;
246
+ overflow-wrap: anywhere;
247
+ }
248
+
249
+ table {
250
+ width: 100% !important;
251
+ table-layout: auto;
252
+ border-collapse: collapse;
253
+ font-size: 0.75rem !important;
254
+ }
255
+ /* `overflow-wrap: break-word` and NOT `anywhere`: `anywhere` also shrinks a
256
+ cell's min-content width to one character, and the auto table layout then
257
+ collapses a short column to nothing ("Orchestrator" set as "Orche/strat/or"
258
+ down a 6-character column). Only the elements that actually hold
259
+ unbreakable strings — paths, URLs, identifiers — get to break anywhere. */
260
+ th,
261
+ td {
262
+ overflow-wrap: break-word;
263
+ white-space: normal !important;
264
+ }
265
+ td code,
266
+ th code,
267
+ td a,
268
+ th a {
269
+ overflow-wrap: anywhere;
270
+ }
271
+
272
+ /* ── links read as text ────────────────────────────────────────────────
273
+ The URL is deliberately NOT printed after the link. These are internal
274
+ documents whose links are mostly in-page anchors and hosts already named
275
+ in the prose; appending every href would add noise and pages without
276
+ adding information. To turn it on, add:
277
+ a[href^="http"]::after { content: " (" attr(href) ")"; } */
278
+ a {
279
+ color: inherit;
280
+ text-decoration: underline;
281
+ text-underline-offset: 2px;
282
+ }
283
+ a.card-terminal,
284
+ a[class*="card"] {
285
+ text-decoration: none;
286
+ }
287
+
288
+ .glow,
289
+ .glow-lg {
290
+ color: inherit;
291
+ }
292
+ .btn-terminal {
293
+ border: 1px solid var(--border);
294
+ background: transparent;
295
+ color: var(--foreground);
296
+ }
297
+
298
+ /* ── mermaid diagrams ──────────────────────────────────────────────────
299
+ See note 3 at the top of this file: the palette is baked into the SVG at
300
+ render time, so a diagram rendered under a dark theme prints as dark
301
+ boxes with invisible labels. Repaint the standard mermaid parts. */
302
+ /* Every diagram is scaled to fit ONE page. Not cosmetic: Chromium will not
303
+ start an over-tall diagram in the space left on the current page, so an
304
+ uncapped flowchart (they run to 2500px in a narrow column) prints a blank
305
+ page, then an empty bordered box, then the diagram — six such pages in the
306
+ executor design doc alone. `width/height: auto` with both max-* set is what
307
+ makes the browser scale it proportionally instead of squashing it.
308
+ A diagram that ends up too small to read is a diagram that is too tall for
309
+ paper: split it, or lay it out left-to-right. */
310
+ .mermaid svg {
311
+ display: block;
312
+ margin-inline: auto;
313
+ width: auto !important;
314
+ height: auto !important;
315
+ max-width: 100% !important;
316
+ max-height: 235mm !important;
317
+ }
318
+ .mermaid svg .node rect,
319
+ .mermaid svg .node polygon,
320
+ .mermaid svg .node circle,
321
+ .mermaid svg .node path,
322
+ .mermaid svg .label-container,
323
+ .mermaid svg .cluster rect,
324
+ .mermaid svg .actor,
325
+ .mermaid svg .note {
326
+ fill: #ffffff !important;
327
+ stroke: #333333 !important;
328
+ }
329
+ .mermaid svg .edgePath path,
330
+ .mermaid svg .flowchart-link,
331
+ .mermaid svg line,
332
+ .mermaid svg .messageLine0,
333
+ .mermaid svg .messageLine1 {
334
+ stroke: #333333 !important;
335
+ }
336
+ .mermaid svg .arrowheadPath,
337
+ .mermaid svg marker path,
338
+ .mermaid svg marker polygon {
339
+ fill: #333333 !important;
340
+ stroke: #333333 !important;
341
+ }
342
+ .mermaid svg text,
343
+ .mermaid svg .nodeLabel,
344
+ .mermaid svg .edgeLabel,
345
+ .mermaid svg .cluster-label,
346
+ .mermaid svg .messageText,
347
+ .mermaid svg foreignObject div,
348
+ .mermaid svg foreignObject span,
349
+ .mermaid svg p {
350
+ fill: #111111 !important;
351
+ color: #111111 !important;
352
+ background: transparent !important;
353
+ }
354
+ .mermaid svg .edgeLabel rect,
355
+ .mermaid svg .edgeLabel foreignObject > div {
356
+ fill: #ffffff !important;
357
+ background: #ffffff !important;
358
+ }
359
+ }
package/src/tailwind.css CHANGED
@@ -19,6 +19,7 @@
19
19
  @import "./components.css";
20
20
  @import "./chrome.css";
21
21
  @import "./tooltip.css";
22
+ @import "./print.css";
22
23
 
23
24
  @theme inline {
24
25
  --color-background: var(--background);