@justai/core 0.24.0 → 0.25.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/package.json +1 -1
- package/src/index.js +45 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justai/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
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.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
package/src/index.js
CHANGED
|
@@ -682,38 +682,64 @@ export function personaScroll(options) {
|
|
|
682
682
|
.filter((c) => c[0] && c[1]);
|
|
683
683
|
if (!cuts.length) return;
|
|
684
684
|
|
|
685
|
-
// queries: --shell-top · the kernel is
|
|
686
|
-
//
|
|
685
|
+
// queries: --shell-top · the kernel is 26px short · the game frame does not reach the fold ·
|
|
686
|
+
// a strip of posts shows above the fold · opening at #kernel is different from #profile ·
|
|
687
|
+
// the toolbar changes height · title strip · the layout depends on when it was measured
|
|
687
688
|
//
|
|
688
|
-
// ──
|
|
689
|
+
// ── NEVER SAMPLE AN ANIMATION AND CALL IT A LAYOUT ─────────────────────────────────────────
|
|
689
690
|
//
|
|
690
691
|
// `--shell-top` is what the shell takes above the kernel, and everything downstream reads it: the
|
|
691
|
-
// landing offset, an app kernel's minimum height, a game kernel's exact one.
|
|
692
|
-
//
|
|
693
|
-
//
|
|
694
|
-
//
|
|
695
|
-
//
|
|
696
|
-
//
|
|
697
|
-
//
|
|
698
|
-
//
|
|
699
|
-
//
|
|
700
|
-
//
|
|
701
|
-
//
|
|
702
|
-
//
|
|
703
|
-
//
|
|
704
|
-
//
|
|
692
|
+
// landing offset, an app kernel's minimum height, a game kernel's exact one.
|
|
693
|
+
//
|
|
694
|
+
// It was the literal `82` for a long time and that was stable and slightly wrong. Reading the
|
|
695
|
+
// toolbar's height instead made it exact and UNSTABLE, which is far worse: the row carries a title
|
|
696
|
+
// strip that opens and closes over 0.35s, so its height is anywhere in a 26px range depending on
|
|
697
|
+
// the instant somebody looked. Measured on tpl-sunshine at 1864x999, the same persona, same build:
|
|
698
|
+
//
|
|
699
|
+
// opened at #profile strip shut when measured shell-top 80 frame 919 reaches the fold
|
|
700
|
+
// opened at #kernel strip open when measured shell-top 106 frame 893 33px SHORT
|
|
701
|
+
//
|
|
702
|
+
// and the second is what a visitor gets, because a game persona lands on its kernel. Thirty-three
|
|
703
|
+
// pixels of the next section showing above the fold, and the "correct" case was correct by
|
|
704
|
+
// coincidence — a shut row plus a gutter happened to equal an open one.
|
|
705
|
+
//
|
|
706
|
+
// THE FIX IS NOT A BETTER MOMENT TO MEASURE, IT IS NOT MEASURING THE MOVING PART. The row minus the
|
|
707
|
+
// strip is the row, and it is the same number at every frame of the transition; the strip's OPEN
|
|
708
|
+
// height is `--tb-strip`, which the Toolbar cut declares beside the rule that uses it. Their sum is
|
|
709
|
+
// what the bar is whenever anybody is looking at the kernel — which is the only time this number
|
|
710
|
+
// decides anything.
|
|
711
|
+
//
|
|
712
|
+
// AND NO GUTTER IS ADDED. The frame is the active view, so it begins where the shell ends; the air
|
|
713
|
+
// an app keeps under the bar is its own padding, and adding a gutter here would spend it twice.
|
|
714
|
+
//
|
|
715
|
+
// Re-measured on resize because a rotation, a narrowing past 640 and a reader's text size all
|
|
716
|
+
// change the ROW — none of which is the animation this is written to ignore.
|
|
705
717
|
const measureShell = () => {
|
|
706
718
|
if (!toolbar) return;
|
|
707
719
|
const app = toolbar.closest(".app") || document.querySelector(".app");
|
|
708
720
|
if (!app) return;
|
|
709
|
-
const
|
|
710
|
-
const
|
|
721
|
+
const strip = tbTitle ? tbTitle.getBoundingClientRect().height : 0;
|
|
722
|
+
const open = parseFloat(getComputedStyle(toolbar).getPropertyValue("--tb-strip")) || 26;
|
|
723
|
+
const h = Math.round(toolbar.getBoundingClientRect().height - strip + open);
|
|
711
724
|
if (h > 0) app.style.setProperty("--shell-top", h + "px");
|
|
712
725
|
};
|
|
713
726
|
measureShell();
|
|
714
727
|
addEventListener("resize", measureShell, { passive: true });
|
|
715
728
|
if (document.fonts && document.fonts.ready) document.fonts.ready.then(measureShell);
|
|
716
729
|
|
|
730
|
+
// queries: data-motion · the bar grows after load · animate only after interaction · first paint
|
|
731
|
+
// animation · the toolbar changes height on arrival
|
|
732
|
+
//
|
|
733
|
+
// ── THE SHELL'S TRANSITIONS BELONG TO A PAGE SOMEBODY IS USING ──────────────────────────────
|
|
734
|
+
//
|
|
735
|
+
// The founder's question, and it is the root of the whole class: *"why is this not activated only
|
|
736
|
+
// after the user's first interaction?"* A persona lands on its kernel, so the title strip's correct
|
|
737
|
+
// state on the first frame is OPEN — animating into it makes the bar grow 26px just after the page
|
|
738
|
+
// appears, and makes every measurement taken during that third of a second describe a state the
|
|
739
|
+
// page is never actually in.
|
|
740
|
+
//
|
|
741
|
+
// Nobody can see a transition they have not yet done anything to cause, so there is nothing to
|
|
742
|
+
// lose. `once: true` on each: the flag is set by whichever comes first and never again.
|
|
717
743
|
if ("scrollRestoration" in history) history.scrollRestoration = "manual";
|
|
718
744
|
|
|
719
745
|
// Only the FRAGMENT. `"#" + id` would clobber the path and the query, and both carry meaning here:
|