@justai/core 0.32.0 → 0.34.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 +87 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justai/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
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": {
|
package/src/index.js
CHANGED
|
@@ -935,6 +935,49 @@ export function personaScroll(options) {
|
|
|
935
935
|
for (const ev of ["wheel", "touchmove", "keydown", "click"]) {
|
|
936
936
|
window.addEventListener(ev, settle, { passive: true, once: true });
|
|
937
937
|
}
|
|
938
|
+
|
|
939
|
+
// queries: the child persona lands short · /me lands a bit off · unstable landing · async content
|
|
940
|
+
// moves the page after it lands · vault read shifts the layout · below.top -18 · the
|
|
941
|
+
// landing is fine in one browser and off in another · ResizeObserver landing
|
|
942
|
+
//
|
|
943
|
+
// ── THE LANDING IS KEPT AGAINST LAYOUT — NEVER AGAINST SCROLLS ─────────────────────────────────
|
|
944
|
+
//
|
|
945
|
+
// A landing is a promise about a document that may not have finished becoming itself. The children
|
|
946
|
+
// proved it: /me lands exactly, the vault's async read completes, the profile grows and settles,
|
|
947
|
+
// and the page rests 18px from where it was put — with NOBODY having scrolled. Chromium's scroll
|
|
948
|
+
// anchoring sometimes absorbs this and sometimes does not, and WebKit has no anchoring at all,
|
|
949
|
+
// which is why the founder's phone showed what a laptop's headless run happened to hide. "Stable
|
|
950
|
+
// olmayan bir durum" is half-applied compensation seen from the outside.
|
|
951
|
+
//
|
|
952
|
+
// A repair against ANY movement was tried once and fought a page that scrolls itself — that is the
|
|
953
|
+
// workaround this file keeps warning about. The line is drawn elsewhere, and it is sharp: LAYOUT
|
|
954
|
+
// is the page still under construction, so the promise holds; a SCROLL is an intent, and intents
|
|
955
|
+
// are never fought. A ResizeObserver on the body sees exactly the first kind and cannot see the
|
|
956
|
+
// second — a consumer calling scrollTo() resizes nothing. The first gesture ends it: after a
|
|
957
|
+
// wheel, a finger, a key or a pointer the page belongs to the person, whatever the layout does.
|
|
958
|
+
let touched = false;
|
|
959
|
+
const takeBack = () => { touched = true; };
|
|
960
|
+
for (const ev of ["wheel", "touchmove", "keydown", "pointerdown"]) {
|
|
961
|
+
window.addEventListener(ev, takeBack, { passive: true, once: true, capture: true });
|
|
962
|
+
}
|
|
963
|
+
if (typeof ResizeObserver === "function") {
|
|
964
|
+
const keeper = new ResizeObserver(() => {
|
|
965
|
+
if (touched || document.body.dataset.present) { keeper.disconnect(); return; }
|
|
966
|
+
const want = landingY(sentTo);
|
|
967
|
+
// A pixel of slack: browsers land sub-pixel scrolls a hair off the number they were handed,
|
|
968
|
+
// and re-asserting over a rounding error would run on every breath the page takes.
|
|
969
|
+
if (Math.abs(window.scrollY - want) > 1) goTo(sentTo, "instant");
|
|
970
|
+
});
|
|
971
|
+
// NOT (only) the body: the fleet's ground gives `body { height: 100% }`, so the body's border
|
|
972
|
+
// box is the viewport and never resizes when content grows — an observer there watched the one
|
|
973
|
+
// box guaranteed to stay still. Caught by the spec modelling the vault's growth: 18px arrived,
|
|
974
|
+
// the observer never fired. The boxes that actually change are the sections themselves, so the
|
|
975
|
+
// keeper watches every cut and the below-boundary; body rides along for a consumer whose ground
|
|
976
|
+
// differs.
|
|
977
|
+
keeper.observe(document.body);
|
|
978
|
+
keeper.observe(below);
|
|
979
|
+
for (const c of cuts) keeper.observe(c[0]);
|
|
980
|
+
}
|
|
938
981
|
// The landing is attempted again when the page comes to rest, because `scrollTo` past a document
|
|
939
982
|
// that has not sized itself yet is a silent no-op — cause 1, and the only cause left here. The
|
|
940
983
|
// drift this used to repair as well was the secondary title strip moving the page after it landed,
|
|
@@ -1143,6 +1186,9 @@ export function personaScroll(options) {
|
|
|
1143
1186
|
// A hash that arrives without a click — the back button, or a link from another page to this one.
|
|
1144
1187
|
// `setHash` uses replaceState and fires nothing, so this can only be somebody else's navigation.
|
|
1145
1188
|
window.addEventListener("hashchange", () => {
|
|
1189
|
+
// The back button or a link from outside — a person navigated, so the load-landing promise ends
|
|
1190
|
+
// here too: the layout keeper must not snap a page somebody just steered somewhere else.
|
|
1191
|
+
touched = true;
|
|
1146
1192
|
const t = cuts.find((c) => "#" + c[0].id === location.hash);
|
|
1147
1193
|
if (t) {
|
|
1148
1194
|
navTo = t;
|
|
@@ -1502,6 +1548,47 @@ export async function adoptMark(options) {
|
|
|
1502
1548
|
if (fills > 0.05 && fills < 1) box = 20 / fills;
|
|
1503
1549
|
}
|
|
1504
1550
|
} catch { /* not rendered — the row's default stands */ }
|
|
1551
|
+
|
|
1552
|
+
// queries: the parent icon is bigger than the other icons · the parent mark overflows the row ·
|
|
1553
|
+
// navParent looks shifted · the child toolbar mark is twice the size · adoptMark overflow
|
|
1554
|
+
//
|
|
1555
|
+
// A CEILING, BECAUSE NORMALISING INK CANNOT BE ALLOWED TO BREAK THE ROW.
|
|
1556
|
+
//
|
|
1557
|
+
// The scale above equalises INK: whatever the drawing, its ink lands at 20px, so a mark with
|
|
1558
|
+
// generous padding is scaled up until it reads like its neighbours. That is right, and it is
|
|
1559
|
+
// unbounded — the more padding a drawing carries, the larger the box it asks for, with nothing
|
|
1560
|
+
// stopping it at the size of the slot it lives in.
|
|
1561
|
+
//
|
|
1562
|
+
// Measured on the fleet, 2026-08-06, after the founder reported the parent mark looking shifted on
|
|
1563
|
+
// pin.games' children and nowhere else:
|
|
1564
|
+
//
|
|
1565
|
+
// app.zone/icon.svg ink fills 73% → 27.3px, inside a 38×36 slot
|
|
1566
|
+
// pin.games/icon.svg ink fills 37% → 53.8px, half again the slot's height
|
|
1567
|
+
//
|
|
1568
|
+
// pin.games draws its glyph with an app icon's padding — an iOS tile, correct on a home screen and
|
|
1569
|
+
// twice the fleet's inset. Nothing was wrong with the file and nothing was wrong with the scale;
|
|
1570
|
+
// what was missing is that a row icon belongs to the ROW, so the row's box is the limit. Clamped
|
|
1571
|
+
// rather than skipped, so the mark still grows as far as it usefully can.
|
|
1572
|
+
//
|
|
1573
|
+
// The remaining half is the persona's: a mark clamped to the slot reads smaller than its
|
|
1574
|
+
// neighbours, because the drawing genuinely carries less ink. That is a drawing to redraw, not a
|
|
1575
|
+
// number to fudge here.
|
|
1576
|
+
//
|
|
1577
|
+
// THE CEILING IS THE SLOT AND NOT A PIXEL LESS, because the founder asked the right question —
|
|
1578
|
+
// *"sadece pin games için böyle oldu, şimdi diğer tüm personalar bundan olumsuz etkilenir mi?"* —
|
|
1579
|
+
// and the first answer was yes. A ceiling of `slot − 4` was measured against all twenty-one live
|
|
1580
|
+
// personas and would have shrunk THIRTEEN of them, from 33–35px down to 32, none of which was
|
|
1581
|
+
// overflowing anything. Computed across the fleet, 2026-08-06:
|
|
1582
|
+
//
|
|
1583
|
+
// under the slot, untouched app.zone 27.3 · justai.pro 29.4 · lendcam 30.8 · qr 34.2 ·
|
|
1584
|
+
// time 34.5 · sudoku 34.6 · whatismyip 35.7 · fourteen more
|
|
1585
|
+
// over it, clamped pin.games 53.8 · auth 38.5 · password-generator 38.5
|
|
1586
|
+
//
|
|
1587
|
+
// A rail that changes anything already inside its limit is not a rail, it is a redesign — so the
|
|
1588
|
+
// limit is exactly the box the mark has to live in, and a mark that fits is left alone to the pixel.
|
|
1589
|
+
const ceiling = Math.max(20, el.clientHeight || 36);
|
|
1590
|
+
if (box > ceiling) box = ceiling;
|
|
1591
|
+
|
|
1505
1592
|
svg.style.width = box.toFixed(2) + "px";
|
|
1506
1593
|
svg.style.height = box.toFixed(2) + "px";
|
|
1507
1594
|
return svg;
|