@justai/core 0.24.0 → 0.26.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.d.ts +7 -0
- package/src/index.js +58 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justai/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.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.d.ts
CHANGED
|
@@ -136,5 +136,12 @@ export declare function toolbarMark(
|
|
|
136
136
|
* redrawn.
|
|
137
137
|
*/
|
|
138
138
|
fills?: number;
|
|
139
|
+
/**
|
|
140
|
+
* How many pixels of INK the surface wants, default 20 — the toolbar row's rule. The preroll
|
|
141
|
+
* asks for 300: the derivation is the same (take the tile's ground off, namespace the ids so two
|
|
142
|
+
* copies on one page do not fight over a gradient), only the measure differs, and a second copy
|
|
143
|
+
* of that logic under a second name is the O(N) debt this package exists to refuse.
|
|
144
|
+
*/
|
|
145
|
+
ink?: number;
|
|
139
146
|
},
|
|
140
147
|
): string;
|
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:
|
|
@@ -1336,8 +1362,20 @@ export function toolbarMark(iconSvg, options) {
|
|
|
1336
1362
|
// Written as an inline style because the cut's `.tb-nav svg { width: 20px }` would beat a width
|
|
1337
1363
|
// ATTRIBUTE. Left out, the mark takes the row's default and reads small — which is what shipped for
|
|
1338
1364
|
// one deploy and is exactly how the fleet's ratios came to be measured.
|
|
1365
|
+
// queries: the mark in the preroll is tiny · ink option · use the derived mark somewhere else ·
|
|
1366
|
+
// toolbarMark size
|
|
1367
|
+
//
|
|
1368
|
+
// `ink` IS THE MEASURE, AND THE ROW IS ONLY ITS FIRST CUSTOMER. The derivation here — take the
|
|
1369
|
+
// ground off, namespace the ids so two copies on one page do not fight over a gradient — is what
|
|
1370
|
+
// ANY surface needs that wants the mark without its tile. The preroll wants exactly that at 300px
|
|
1371
|
+
// rather than 20, and the alternative was a second copy of the stripping logic under a second
|
|
1372
|
+
// name, which is the O(N) debt this package exists to refuse.
|
|
1373
|
+
//
|
|
1374
|
+
// So the number is a parameter and the default is the row's. The function keeps its name because
|
|
1375
|
+
// the row is still what it is for nine times in ten; that the name is now narrower than the job is
|
|
1376
|
+
// worth one line of honesty rather than a rename across sixteen repos.
|
|
1339
1377
|
if (o.fills > 0) {
|
|
1340
|
-
const px = (20 / o.fills).toFixed(2);
|
|
1378
|
+
const px = ((o.ink || 20) / o.fills).toFixed(2);
|
|
1341
1379
|
s = s.replace(/<svg /, `<svg style="width:${px}px;height:${px}px" `);
|
|
1342
1380
|
}
|
|
1343
1381
|
return s.trim();
|