@justai/core 0.23.0 → 0.24.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 +38 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justai/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.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
|
@@ -205,10 +205,13 @@ export const XRAY_JS = `(() => {
|
|
|
205
205
|
var kind = document.documentElement.dataset.kind || "app";
|
|
206
206
|
var ks = getComputedStyle(k);
|
|
207
207
|
var kp = [ks.paddingTop, ks.paddingRight, ks.paddingBottom, ks.paddingLeft].map((v) => parseFloat(v) || 0);
|
|
208
|
+
// ONE NUMBER ON ALL FOUR SIDES — the frame is the active view for both kinds now, so what tells
|
|
209
|
+
// them apart is the padding INSIDE it: an app pads by the gutter, which puts its content exactly
|
|
210
|
+
// on the action-safe ring below, and a game pads by nothing.
|
|
211
|
+
// The bottom may EXCEED it and only the bottom may: env(safe-area-inset-bottom) is the strip the
|
|
212
|
+
// OS keeps for its home indicator, and it is added rather than substituted.
|
|
208
213
|
var want = kind === "game" ? 0 : g;
|
|
209
|
-
|
|
210
|
-
// strip the OS keeps for its home indicator, and it is added rather than substituted.
|
|
211
|
-
var insetOk = kp[0] === want && kp[1] === 0 && kp[3] === 0 && kp[2] >= want;
|
|
214
|
+
var insetOk = kp[0] === want && kp[1] === want && kp[3] === want && kp[2] >= want;
|
|
212
215
|
put(R.inset, kp.join(" / ") + " (" + kind + " wants " + want + ")", insetOk);
|
|
213
216
|
put(R.act, "inset " + px(g) + " . " + px(r.width - g * 2) + " wide");
|
|
214
217
|
put(R.ttl, "inset " + px(g * 2) + " . " + px(r.width - g * 4) + " wide");
|
|
@@ -679,6 +682,38 @@ export function personaScroll(options) {
|
|
|
679
682
|
.filter((c) => c[0] && c[1]);
|
|
680
683
|
if (!cuts.length) return;
|
|
681
684
|
|
|
685
|
+
// queries: --shell-top · the kernel is under the toolbar · the gap under the bar is 4px ·
|
|
686
|
+
// the toolbar is taller than 82 · Dynamic Type · game kernel height wrong by a pixel
|
|
687
|
+
//
|
|
688
|
+
// ── THE SHELL'S OWN HEIGHT IS MEASURED, NOT ASSUMED ─────────────────────────────────────────
|
|
689
|
+
//
|
|
690
|
+
// `--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. It was the literal 82
|
|
692
|
+
// in a stylesheet — and the toolbar is not 82. It renders 70.1px on one canary and 82.3 on another,
|
|
693
|
+
// because its height follows the persona's NAME, the reader's text size and iOS Dynamic Type. On
|
|
694
|
+
// the persona whose bar reached 82.3 the game frame sat 0.3px UNDER the sticky row: the harness
|
|
695
|
+
// caught it as "there is air under the bar: -0.27".
|
|
696
|
+
//
|
|
697
|
+
// So it is read from the row that is actually on the page, plus one gutter of air — the same inset
|
|
698
|
+
// the column keeps at its sides, which is what makes the air under the bar equal to the air beside
|
|
699
|
+
// the content instead of whatever 82 minus this persona's toolbar happens to be.
|
|
700
|
+
//
|
|
701
|
+
// WRITTEN ON `.app` RATHER THAN ON :root, because `--gutter` lives there and this is read from it.
|
|
702
|
+
// Re-measured on resize: a phone rotating, a window narrowing past 640 and a reader changing their
|
|
703
|
+
// text size all change the row's height, and a landing offset that was right at load is a kernel
|
|
704
|
+
// under the bar afterwards.
|
|
705
|
+
const measureShell = () => {
|
|
706
|
+
if (!toolbar) return;
|
|
707
|
+
const app = toolbar.closest(".app") || document.querySelector(".app");
|
|
708
|
+
if (!app) return;
|
|
709
|
+
const gutter = parseFloat(getComputedStyle(app).getPropertyValue("--gutter")) || 16;
|
|
710
|
+
const h = Math.round(toolbar.getBoundingClientRect().height + gutter);
|
|
711
|
+
if (h > 0) app.style.setProperty("--shell-top", h + "px");
|
|
712
|
+
};
|
|
713
|
+
measureShell();
|
|
714
|
+
addEventListener("resize", measureShell, { passive: true });
|
|
715
|
+
if (document.fonts && document.fonts.ready) document.fonts.ready.then(measureShell);
|
|
716
|
+
|
|
682
717
|
if ("scrollRestoration" in history) history.scrollRestoration = "manual";
|
|
683
718
|
|
|
684
719
|
// Only the FRAGMENT. `"#" + id` would clobber the path and the query, and both carry meaning here:
|