@justai/core 0.29.1 → 0.30.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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/index.js +39 -3
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justai/core",
3
- "version": "0.29.1",
4
- "description": "The framework-free heart of the persona shell \u2014 the load-bearing behaviour (auth capture, reveal, ready) as plain strings, so Astro and Next inject the SAME logic instead of each re-writing it.",
3
+ "version": "0.30.0",
4
+ "description": "The framework-free heart of the persona shell — the load-bearing behaviour (auth capture, reveal, ready) as plain strings, so Astro and Next inject the SAME logic instead of each re-writing it.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
7
7
  "type": "git",
package/src/index.js CHANGED
@@ -693,10 +693,39 @@ export function personaScroll(options) {
693
693
  // row, and a landing offset that was right at load is a kernel under the bar afterwards.
694
694
  const measureShell = () => {
695
695
  if (!toolbar) return;
696
- const app = toolbar.closest(".app") || document.querySelector(".app");
697
- if (!app) return;
698
696
  const h = Math.ceil(toolbar.getBoundingClientRect().height);
699
- if (h > 0) app.style.setProperty("--shell-top", h + "px");
697
+ // ON THE ROOT, because the kernel's `scroll-margin-top` reads it and THE BROWSER reads that when
698
+ // it scrolls to the fragment on its own. Written on `.app` this reached the kernel only when the
699
+ // kernel happened to sit inside one, and a surface where it did not is a surface where the
700
+ // browser's landing and the script's disagree — which is the whole bug this measurement exists
701
+ // to prevent. The root is the one element every consumer is inside.
702
+ if (h <= 0) return;
703
+ document.documentElement.style.setProperty("--shell-top", h + "px");
704
+ // queries: a persona overrides the landing offset · scroll-margin-top 82px in my own component ·
705
+ // the page lands 30px short · duplicate landing offset · my persona has its own #kernel
706
+ // rule · the framework does not reach my css
707
+ //
708
+ // AND ENFORCED, NOT MERELY DECLARED.
709
+ //
710
+ // The framework exists so that a number like this lives in ONE place. It cannot: CSS has no way
711
+ // to refuse an override, and on 2026-08-06 EIGHT personas — both apexes and justai.pro among them
712
+ // — still carried `#kernel { scroll-margin-top: 82px }` from before the shell was shared, a
713
+ // constant that stopped being true the day the secondary title strip was removed. Every one of
714
+ // them lands the page by measurement and is then overruled by the browser's own scroll to the
715
+ // fragment, which reads the persona's stale copy. Thirty pixels, on every bare load.
716
+ //
717
+ // Deleting the eight copies is the honest fix and it is being done. This is what makes the ninth
718
+ // impossible: whoever measures the bar owns what clearing it means, so a section that says it
719
+ // clears the bar clears it by the bar — inline, which outranks any stylesheet. A section that
720
+ // asks for NO offset is left alone; it is not claiming to clear anything.
721
+ for (const [sec] of cuts) {
722
+ const declared = parseFloat(getComputedStyle(sec).scrollMarginTop) || 0;
723
+ if (declared > 0 && Math.abs(declared - h) > 0.5) {
724
+ sec.style.scrollMarginTop = h + "px";
725
+ // Said out loud, because a healed page is a page nobody goes and fixes.
726
+ console.warn("[justai] #" + sec.id + " declares scroll-margin-top " + declared + "px; the shell measures " + h + "px. The landing offset belongs to @justai/ui — delete the local rule.");
727
+ }
728
+ }
700
729
  };
701
730
  measureShell();
702
731
  addEventListener("resize", measureShell, { passive: true });
@@ -858,6 +887,13 @@ export function personaScroll(options) {
858
887
  for (const ev of ["wheel", "touchmove", "keydown", "click"]) {
859
888
  window.addEventListener(ev, settle, { passive: true, once: true });
860
889
  }
890
+ // The landing is attempted again when the page comes to rest, because `scrollTo` past a document
891
+ // that has not sized itself yet is a silent no-op — cause 1, and the only cause left here. The
892
+ // drift this used to repair as well was the secondary title strip moving the page after it landed,
893
+ // and the strip is gone; the thirty-pixel glide that looked like drift afterwards was not one
894
+ // either — it was the browser scrolling to the fragment with a number the persona still owned, and
895
+ // that is fixed where the number lives rather than chased from here. A repair that re-asserts
896
+ // against ANY movement fights a page that scrolls itself, which is a workaround growing back.
861
897
  const landIfRefused = () => {
862
898
  if (landed) return;
863
899
  // Anywhere but the very top means the scroll was accepted. A landing that IS the top has nothing