-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRow.jsx
More file actions
69 lines (63 loc) · 2.06 KB
/
Copy pathRow.jsx
File metadata and controls
69 lines (63 loc) · 2.06 KB
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
import { For } from "solid-js";
import { LH, GUT } from "./frame.js";
import { C_BAR, C_GREEN } from "./theme.js";
import { GUTTER, QUIET } from "./output.js";
/* ── row ─────────────────────────────────────────────────────────────────── */
export function Row(props) {
const g = () => props.gutter;
return (
<div style={`height:${props.row.h}px;display:flex;align-items:flex-start;`}>
<span
style={{
width: `${GUT}px`,
"flex-shrink": "0",
"line-height": `${LH}px`,
color: QUIET[props.row.k] ? C_BAR : C_GREEN,
opacity: String(g().o),
transform: `translateY(${g().y.toFixed(2)}px)`,
}}
>
{GUTTER[props.row.k]}
</span>
<div style={{ flex: "1", "line-height": `${LH}px`, "white-space": "pre" }}>
{props.children}
</div>
</div>
);
}
// Each word rides up through its own clip: the box is the word's advance and
// one line tall, so nothing shows until the glyphs clear the mask.
export function Words(props) {
const lh = () => props.lh ?? LH;
return (
<For each={props.body.lines}>
{(line) => (
<div style={{ height: `${lh()}px`, "line-height": `${lh()}px`, "white-space": "pre" }}>
<For each={line}>
{(w) => (
<span
style={{
display: "inline-block",
overflow: "hidden",
"vertical-align": "top",
height: `${lh()}px`,
"line-height": `${lh()}px`,
}}
>
<span
style={{
display: "inline-block",
...w.css,
transform: `translateY(${props.words[w.i].y.toFixed(2)}%)`,
}}
>
{w.text}
</span>
</span>
)}
</For>
</div>
)}
</For>
);
}