@luhtech/site-template 0.6.0 → 0.6.2
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/README.md
CHANGED
|
@@ -249,6 +249,40 @@ own printed reference output at several points, not assumed-correct.
|
|
|
249
249
|
strip-types`) to import `.ts` test subjects directly -- no build step, no
|
|
250
250
|
`ts-node`.
|
|
251
251
|
|
|
252
|
+
## RingComparison: a loss reads at a glance (0.6.1)
|
|
253
|
+
|
|
254
|
+
Found in real local review (LuhTech-Business's "The Shape of a Strategy",
|
|
255
|
+
the real three-company example where C's cost genuinely exceeds its
|
|
256
|
+
revenue): the component computed correct, area-proportional radii from
|
|
257
|
+
day one, but with no dollar labels and no color distinction, a real loss
|
|
258
|
+
case was easy to miss at a glance -- exactly the finding the source essay
|
|
259
|
+
exists to make legible. `RingComparison.astro` now renders each ring's
|
|
260
|
+
real revenue/cost values as text, and a ring where `cost > revenue`
|
|
261
|
+
switches to a red dashed stroke with an explicit "at a loss" label --
|
|
262
|
+
computed from the same real props, not a second data path to keep in
|
|
263
|
+
sync.
|
|
264
|
+
|
|
265
|
+
## data-reveal: on-screen content never waits on a scroll (0.6.2)
|
|
266
|
+
|
|
267
|
+
Real user report: a page's `/insights/` index looked genuinely blank on
|
|
268
|
+
first load at common laptop viewport heights. Root cause: `[data-reveal]`
|
|
269
|
+
sections default to `opacity:0` and only reveal once
|
|
270
|
+
`SiteLayout.astro`'s `IntersectionObserver` fires -- but that callback is
|
|
271
|
+
async (next frame, not synchronous with paint), and any section whose top
|
|
272
|
+
sits close to the fold could read as "just never revealed" rather than
|
|
273
|
+
"will reveal in a moment." `fullPage` Playwright screenshots (used during
|
|
274
|
+
this session's own local review) scroll through the whole page and
|
|
275
|
+
mask this exact failure mode -- a real gap in that verification, not
|
|
276
|
+
just the bug itself.
|
|
277
|
+
|
|
278
|
+
The reveal script now checks each `[data-reveal]` element's real bounding
|
|
279
|
+
rect at setup time: anything already on screen (or within 10% of the
|
|
280
|
+
viewport height below it) reveals immediately, synchronously, no observer
|
|
281
|
+
round-trip. Only genuinely below-the-fold sections keep the scroll-
|
|
282
|
+
triggered fade-in. Same visual result for content that was always meant
|
|
283
|
+
to animate in on scroll; content already visible at load is now
|
|
284
|
+
guaranteed visible at load.
|
|
285
|
+
|
|
252
286
|
## Migrating a venture site
|
|
253
287
|
|
|
254
288
|
A migration is: author `content/site.<venture>.json` + `content/pages/*.json`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luhtech/site-template",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Shared Astro component library + content-instance contract for LuhTech venture marketing sites -- one template renders every site from content/page.schema.json + content/site.schema.json instances.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -25,28 +25,49 @@ const maxRevenue = Math.max(...rings.map((r) => r.revenue), 1);
|
|
|
25
25
|
const scale = MAX_R / Math.sqrt(maxRevenue);
|
|
26
26
|
|
|
27
27
|
const width = rings.length * CELL_W;
|
|
28
|
-
const height = CELL_W +
|
|
28
|
+
const height = CELL_W + 76;
|
|
29
|
+
|
|
30
|
+
const fmtUSD = (n: number) => `$${n.toLocaleString('en-US')}M`;
|
|
29
31
|
|
|
30
32
|
const cells = rings.map((r, i) => {
|
|
31
33
|
const cx = i * CELL_W + CELL_W / 2;
|
|
32
34
|
const cy = CELL_W / 2 + 20;
|
|
33
35
|
const revenueR = Math.max(Math.sqrt(r.revenue) * scale, 4);
|
|
34
36
|
const costR = Math.max(Math.sqrt(r.cost) * scale, 2);
|
|
35
|
-
|
|
37
|
+
// Real signal, not decoration: cost exceeding revenue means the ring
|
|
38
|
+
// between them has vanished -- the company is running at a loss (the
|
|
39
|
+
// real source essay's own "cost circle has grown past its revenue"
|
|
40
|
+
// case). Flagged, not just left to a same-color radius difference a
|
|
41
|
+
// reader could easily miss.
|
|
42
|
+
const atLoss = r.cost > r.revenue;
|
|
43
|
+
return { ...r, cx, cy, revenueR, costR, atLoss };
|
|
36
44
|
});
|
|
45
|
+
const maxR = Math.max(...cells.map((c) => Math.max(c.revenueR, c.costR)));
|
|
37
46
|
---
|
|
38
47
|
<svg
|
|
39
48
|
xmlns="http://www.w3.org/2000/svg"
|
|
40
49
|
viewBox={`0 0 ${width} ${height}`}
|
|
41
50
|
class={className}
|
|
42
51
|
role="img"
|
|
43
|
-
aria-label={`Revenue and cost ring comparison across ${rings.length} companies`}
|
|
52
|
+
aria-label={`Revenue and cost ring comparison across ${rings.length} companies: ${rings.map((r) => `${r.label} revenue ${fmtUSD(r.revenue)}, cost ${fmtUSD(r.cost)}`).join('; ')}`}
|
|
44
53
|
>
|
|
45
54
|
{cells.map((c) => (
|
|
46
55
|
<g>
|
|
47
56
|
<circle cx={c.cx} cy={c.cy} r={c.revenueR} fill="currentColor" fill-opacity="0.06" stroke="currentColor" stroke-width="1.5" />
|
|
48
|
-
<circle
|
|
49
|
-
|
|
57
|
+
<circle
|
|
58
|
+
cx={c.cx}
|
|
59
|
+
cy={c.cy}
|
|
60
|
+
r={c.costR}
|
|
61
|
+
class={c.atLoss ? 'text-red-600' : highlightClass}
|
|
62
|
+
fill="currentColor"
|
|
63
|
+
fill-opacity="0.18"
|
|
64
|
+
stroke="currentColor"
|
|
65
|
+
stroke-width={c.atLoss ? 2 : 1.5}
|
|
66
|
+
stroke-dasharray={c.atLoss ? '4 3' : undefined}
|
|
67
|
+
/>
|
|
68
|
+
<text x={c.cx} y={c.cy + maxR + 20} text-anchor="middle" font-family="Inter, sans-serif" font-weight="600" font-size="13" fill="currentColor">{c.label}</text>
|
|
69
|
+
<text x={c.cx} y={c.cy + maxR + 36} text-anchor="middle" font-family="JetBrains Mono, monospace" font-size="10" fill="currentColor" fill-opacity="0.6">rev {fmtUSD(c.revenue)}</text>
|
|
70
|
+
<text x={c.cx} y={c.cy + maxR + 50} text-anchor="middle" font-family="JetBrains Mono, monospace" font-size="10" class={c.atLoss ? 'text-red-600' : undefined} fill="currentColor" fill-opacity={c.atLoss ? 1 : 0.6}>cost {fmtUSD(c.cost)}{c.atLoss ? ' -- at a loss' : ''}</text>
|
|
50
71
|
</g>
|
|
51
72
|
))}
|
|
52
73
|
</svg>
|
|
@@ -86,6 +86,19 @@ const nav =
|
|
|
86
86
|
</div>
|
|
87
87
|
</footer>
|
|
88
88
|
<script>
|
|
89
|
+
// Content already on screen at load must never depend on a scroll
|
|
90
|
+
// event or an async observer callback to become visible -- real
|
|
91
|
+
// user report (2026-09-09): the insights index's card grid sits
|
|
92
|
+
// close enough to the fold on common viewport heights that it
|
|
93
|
+
// read as a genuinely blank page until scrolled, because
|
|
94
|
+
// IntersectionObserver's own first callback is asynchronous
|
|
95
|
+
// (next frame/microtask), not synchronous with page paint, and a
|
|
96
|
+
// slow first frame or a borderline-in-view element could leave
|
|
97
|
+
// data-reveal's default opacity:0 as the visible, unrevealed
|
|
98
|
+
// state. Elements already in (or near) the viewport at setup
|
|
99
|
+
// time reveal immediately, synchronously, no observer round-trip
|
|
100
|
+
// required; only genuinely below-the-fold elements keep the
|
|
101
|
+
// scroll-triggered animation.
|
|
89
102
|
const revealTargets = document.querySelectorAll('[data-reveal]');
|
|
90
103
|
if ('IntersectionObserver' in window && revealTargets.length) {
|
|
91
104
|
const observer = new IntersectionObserver(
|
|
@@ -99,7 +112,15 @@ const nav =
|
|
|
99
112
|
},
|
|
100
113
|
{ threshold: 0.2, rootMargin: '0px 0px -10% 0px' }
|
|
101
114
|
);
|
|
102
|
-
revealTargets.forEach((el) =>
|
|
115
|
+
revealTargets.forEach((el) => {
|
|
116
|
+
const rect = el.getBoundingClientRect();
|
|
117
|
+
const nearViewport = rect.top < window.innerHeight * 1.1 && rect.bottom > 0;
|
|
118
|
+
if (nearViewport) {
|
|
119
|
+
el.classList.add('is-visible');
|
|
120
|
+
} else {
|
|
121
|
+
observer.observe(el);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
103
124
|
} else {
|
|
104
125
|
revealTargets.forEach((el) => el.classList.add('is-visible'));
|
|
105
126
|
}
|