@luhtech/site-template 0.6.1 → 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 +21 -0
- package/package.json +1 -1
- package/src/layouts/SiteLayout.astro +22 -1
package/README.md
CHANGED
|
@@ -262,6 +262,27 @@ switches to a red dashed stroke with an explicit "at a loss" label --
|
|
|
262
262
|
computed from the same real props, not a second data path to keep in
|
|
263
263
|
sync.
|
|
264
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
|
+
|
|
265
286
|
## Migrating a venture site
|
|
266
287
|
|
|
267
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",
|
|
@@ -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
|
}
|