@justai/core 0.40.0 → 0.42.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/dist/index.d.ts CHANGED
@@ -30,7 +30,7 @@
30
30
  * ./consent the question in thirteen languages, and the flow that asks it
31
31
  * ./chrome Cancel and Done, in thirteen languages
32
32
  * ./presentation standalone, or inside somebody else's sheet
33
- * ./scroll landing on the kernel, the spy, the title strip
33
+ * ./scroll landing on the kernel, and the spy
34
34
  * ./mark the persona's mark, and adopting a host's
35
35
  * ./face a host persona's face, for a child mounted on it
36
36
  *
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@
30
30
  * ./consent the question in thirteen languages, and the flow that asks it
31
31
  * ./chrome Cancel and Done, in thirteen languages
32
32
  * ./presentation standalone, or inside somebody else's sheet
33
- * ./scroll landing on the kernel, the spy, the title strip
33
+ * ./scroll landing on the kernel, and the spy
34
34
  * ./mark the persona's mark, and adopting a host's
35
35
  * ./face a host persona's face, for a child mounted on it
36
36
  *
package/dist/scroll.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @justai/core/scroll — the persona page's scroll behaviour — landing on the kernel, the spy, the toolbar's title strip. It knows a set of element ids and nothing about which framework drew them.
2
+ * @justai/core/scroll — the persona page's scroll behaviour — landing on the kernel and the spy. It knows a set of element ids and nothing about which framework drew them.
3
3
  *
4
4
  * Part of the framework-free heart of the persona shell. See `./index.js` for what this package is
5
5
  * and why its behaviour lives one level below @justai/cuts.
@@ -10,12 +10,8 @@ export interface PersonaScrollOptions {
10
10
  /** Id of the element the toolbar sits at the top of. Default `"below"`. */
11
11
  below?: string | HTMLElement | null;
12
12
  toolbar?: string | HTMLElement | null;
13
- title?: string | HTMLElement | null;
14
- titleText?: string | HTMLElement | null;
15
13
  /** Maps a section id to its nav's id. Default `profile` → `navProfile`. */
16
14
  navFor?: (id: string) => string;
17
- /** What the title strip says for a section. Default: kernel → `.pname`, posts → `.handle`. */
18
- titleFor?: (id: string) => string;
19
15
  /** Whether this owns `body.ready`. Pass `false` on a page that renders asynchronously. */
20
16
  reveal?: boolean;
21
17
  /**
package/dist/scroll.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @justai/core/scroll — the persona page's scroll behaviour — landing on the kernel, the spy, the toolbar's title strip. It knows a set of element ids and nothing about which framework drew them.
2
+ * @justai/core/scroll — the persona page's scroll behaviour — landing on the kernel and the spy. It knows a set of element ids and nothing about which framework drew them.
3
3
  *
4
4
  * Part of the framework-free heart of the persona shell. See `./index.js` for what this package is
5
5
  * and why its behaviour lives one level below @justai/cuts.
@@ -13,10 +13,6 @@ export function personaScroll(options) {
13
13
  if (!below || !kernel)
14
14
  return;
15
15
  const toolbar = typeof o.toolbar === "string" ? document.querySelector(o.toolbar) : o.toolbar || document.querySelector(".toolbar");
16
- const tbTitle = el(o.title || "tbTitle");
17
- const tbTitleText = (typeof o.titleText === "string" ? document.getElementById(o.titleText) : o.titleText) ||
18
- document.getElementById("tbTitleText") ||
19
- (tbTitle && tbTitle.querySelector(".tb-title-text"));
20
16
  // A cut is a section AND the nav that points at it; anything missing either half is simply not one.
21
17
  // That is how a page with extra toolbar links — /me's vault, /files' host link — needs no
22
18
  // configuration: they are links, not cuts, and they fall out of this list on their own.
@@ -28,53 +24,27 @@ export function personaScroll(options) {
28
24
  .filter((c) => Boolean(c[0] && c[1]));
29
25
  if (!cuts.length)
30
26
  return;
31
- // queries: --shell-top · the kernel is 26px short · the game frame does not reach the fold ·
32
- // a strip of posts shows above the fold · opening at #kernel is different from #profile ·
33
- // the toolbar changes height · title strip · the layout depends on when it was measured
27
+ // queries: --shell-top · the gap under the toolbar · what the shell takes above the kernel
34
28
  //
35
- // ── NEVER SAMPLE AN ANIMATION AND CALL IT A LAYOUT ─────────────────────────────────────────
29
+ // ── WHAT THE SHELL TAKES ABOVE THE KERNEL IS THE BAR, MEASURED ─────────────────────────────
36
30
  //
37
- // `--shell-top` is what the shell takes above the kernel, and everything downstream reads it: the
38
- // landing offset, an app kernel's minimum height, a game kernel's exact one.
31
+ // `--shell-top` is read by the landing offset, an app kernel's minimum height and a game kernel's
32
+ // exact one. It is the toolbar's height, and since the title strip went (2026-10-12) that height
33
+ // does not move: one row, so whatever is measured is what the bar is at every instant.
39
34
  //
40
- // It was the literal `82` for a long time and that was stable and slightly wrong. Reading the
41
- // toolbar's height instead made it exact and UNSTABLE, which is far worse: the row carries a title
42
- // strip that opens and closes over 0.35s, so its height is anywhere in a 26px range depending on
43
- // the instant somebody looked. Measured on tpl-sunshine at 1864x999, the same persona, same build:
35
+ // It was the strip that made this hard. While a second line opened and closed over 0.35s, the
36
+ // number had to be "the row plus the strip's OPEN height, whatever it is doing now", and that sum
37
+ // was also the slot's reserved box — which is why a shut strip left 26px of empty bar under the
38
+ // row on every persona. Measured here, nothing is added: the bar is the number.
44
39
  //
45
- // opened at #profile strip shut when measured shell-top 80 frame 919 reaches the fold
46
- // opened at #kernel strip open when measured shell-top 106 frame 893 33px SHORT
47
- //
48
- // and the second is what a visitor gets, because a game persona lands on its kernel. Thirty-three
49
- // pixels of the next section showing above the fold, and the "correct" case was correct by
50
- // coincidence — a shut row plus a gutter happened to equal an open one.
51
- //
52
- // THE FIX IS NOT A BETTER MOMENT TO MEASURE, IT IS NOT MEASURING THE MOVING PART. The row minus the
53
- // strip is the row, and it is the same number at every frame of the transition; the strip's OPEN
54
- // height is `--tb-strip`, which the Toolbar cut declares beside the rule that uses it. Their sum is
55
- // what the bar is whenever anybody is looking at the kernel — which is the only time this number
56
- // decides anything.
57
- //
58
- // AND NO GUTTER IS ADDED. The frame is the active view, so it begins where the shell ends; the air
59
- // an app keeps under the bar is its own padding, and adding a gutter here would spend it twice.
60
- //
61
- // Re-measured on resize because a rotation, a narrowing past 640 and a reader's text size all
62
- // change the ROW — none of which is the animation this is written to ignore.
40
+ // CEIL, NOT ROUND: this is the landing offset, and a bar under Dynamic Type is not an integer —
41
+ // 82.3 has been recorded — so rounding down would put the kernel's first line half a pixel under
42
+ // the bar. Re-measured on resize because a rotation, a narrowing past 640 and a reader's text size
43
+ // all change the row.
63
44
  const measureShell = () => {
64
45
  if (!toolbar)
65
46
  return;
66
- // THE BAR'S EXPANDED HEIGHT, WITHOUT WAITING FOR OR RACING THE STRIP'S 0.35s. The row is the bar
67
- // minus whatever the strip currently is — the same number at every frame of the transition — and
68
- // the bar-to-be is that row plus the strip's declared open height. Nothing samples the animation,
69
- // so nothing depends on when it was sampled.
70
- //
71
- // CEIL, NOT ROUND, AND LOAD-BEARING: this is the slot's reserved box as well as the landing
72
- // offset, so it must never be LESS than the bar's tallest state or the slot starts following the
73
- // bar again and the 26px returns as a fraction. A bar under Dynamic Type is not an integer —
74
- // 82.3 is recorded in this file — and rounding down is half a CSS pixel of permanent error.
75
- const strip = tbTitle ? tbTitle.getBoundingClientRect().height : 0;
76
- const open = parseFloat(getComputedStyle(toolbar).getPropertyValue("--tb-strip")) || 26;
77
- const h = Math.ceil(toolbar.getBoundingClientRect().height - strip + open);
47
+ const h = Math.ceil(toolbar.getBoundingClientRect().height);
78
48
  // ON THE ROOT, because the kernel's `scroll-margin-top` reads it and THE BROWSER reads that when
79
49
  // it scrolls to the fragment on its own. Written on `.app` this reached the kernel only when the
80
50
  // kernel happened to sit inside one, and a surface where it did not is a surface where the
@@ -92,7 +62,7 @@ export function personaScroll(options) {
92
62
  // The framework exists so that a number like this lives in ONE place. It cannot: CSS has no way
93
63
  // to refuse an override, and on 2026-08-06 EIGHT personas — both apexes and justai.pro among them
94
64
  // — still carried `#kernel { scroll-margin-top: 82px }` from before the shell was shared, a
95
- // constant that stopped being true the day the secondary title strip was removed. Every one of
65
+ // constant that stopped being true the first time the title strip was removed (2026-08-06). Every one of
96
66
  // them lands the page by measurement and is then overruled by the browser's own scroll to the
97
67
  // fragment, which reads the persona's stale copy. Thirty pixels, on every bare load.
98
68
  //
@@ -129,19 +99,6 @@ export function personaScroll(options) {
129
99
  addEventListener("resize", measureShell, { passive: true });
130
100
  if (document.fonts && document.fonts.ready)
131
101
  document.fonts.ready.then(measureShell);
132
- // queries: data-motion · the bar grows after load · animate only after interaction · first paint
133
- // animation · the toolbar changes height on arrival
134
- //
135
- // ── THE SHELL'S TRANSITIONS BELONG TO A PAGE SOMEBODY IS USING ──────────────────────────────
136
- //
137
- // The founder's question, and it is the root of the whole class: *"why is this not activated only
138
- // after the user's first interaction?"* A persona lands on its kernel, so the title strip's correct
139
- // state on the first frame is OPEN — animating into it makes the bar grow 26px just after the page
140
- // appears, and makes every measurement taken during that third of a second describe a state the
141
- // page is never actually in.
142
- //
143
- // Nobody can see a transition they have not yet done anything to cause, so there is nothing to
144
- // lose. `once: true` on each: the flag is set by whichever comes first and never again.
145
102
  if ("scrollRestoration" in history)
146
103
  history.scrollRestoration = "manual";
147
104
  // Only the FRAGMENT. `"#" + id` would clobber the path and the query, and both carry meaning here:
@@ -169,22 +126,12 @@ export function personaScroll(options) {
169
126
  // CSS that already declares it (`scroll-margin-top`) rather than from a constant that has to be
170
127
  // kept in sync by hand.
171
128
  //
172
- // THE KERNEL IS THE ONE EXCEPTION, and it is what kills an oscillation rather than papering over
173
- // it. The kernel begins at the top of `#below` — above the sticky toolbar — not at its own box.
174
- // The toolbar's title strip lives INSIDE `#below` and is in flow, so opening it pushes every
175
- // section under it down by its own height (26px, measured). While the spy compared the kernel's own
176
- // box against a fixed line, that 26px carried the kernel from 82 (inside the line) to 108 (outside
177
- // it) — and the kernel being current is what opened the strip. Measured on app.zone by dispatching
178
- // scroll events at a page that never moved:
179
- //
180
- // rest hash #profile kernelTop 82 strip 0 active profile
181
- // spy run 1 hash #kernel kernelTop 108 strip 26 active kernel
182
- // spy run 2 hash #profile kernelTop 82 strip 0 active profile
183
- // spy run 3 hash #kernel kernelTop 108 strip 26 active kernel
184
- //
185
- // A bistable oscillator: the spy was measuring its own output. Anchoring the kernel to `#below`
186
- // removes the coupling at the source, because the strip is inside that boundary and cannot move it.
187
- // Widening the line would only have moved the tipping point.
129
+ // THE KERNEL IS THE ONE EXCEPTION: it begins at the top of `#below`, above the sticky toolbar,
130
+ // rather than at its own box. The toolbar lives inside `#below`, so landing there is landing with
131
+ // the bar pinned flush and the kernel directly under it. (It was written to kill an oscillation the
132
+ // old title strip caused — the strip was in flow and moved the kernel's own box by 26px each time
133
+ // it opened, and the spy then measured its own output. With the strip gone the anchor stays,
134
+ // because it is simply the right place: where the toolbar sticks.)
188
135
  const landingY = (sec) => {
189
136
  if (sec === kernel)
190
137
  return below.getBoundingClientRect().top + window.scrollY;
@@ -262,7 +209,8 @@ export function personaScroll(options) {
262
209
  // time it opened or closed the browser moved the scroll position to keep the content under it
263
210
  // steady, and the page came to rest three pixels short of where the kernel began — close enough to
264
211
  // look landed, far enough that the spy answered "profile", which closed the strip, which is what
265
- // moved it. The founder removed the strip on 2026-08-06, and this went with it: measured after, the
212
+ // moved it. The founder removed the strip on 2026-08-06 — it came back that night, and went for good on
213
+ // 2026-10-12 — and this mechanism went with the first removal and never returned: measured after, the
266
214
  // page scrolls exactly ONCE to its landing and never moves again, at 402x710 and at 1440x900.
267
215
  //
268
216
  // A workaround outlives its cause silently. This one would have kept re-asserting a landing nobody
@@ -382,56 +330,7 @@ export function personaScroll(options) {
382
330
  requestAnimationFrame(reveal);
383
331
  setTimeout(reveal, 500);
384
332
  }
385
- const text = (sel) => (document.querySelector(sel)?.textContent || "").trim();
386
- // Kernel names the persona, Posts names its handle, Profile stays collapsed — its big header IS
387
- // the title, and repeating it in the bar above would say the same thing twice.
388
- const titleFor = o.titleFor ||
389
- ((id) => (id === "kernel" ? text(".pname") : id === "posts" ? text(".handle") : ""));
390
- // queries: the title strip jumps · the page jolts after tapping a cut · content shifts while
391
- // scrolling · toolbar title animation causes a layout shift · landing lands 26px off ·
392
- // landingAfterStrip · why is there no strip compensation any more · tb-slot min-height
393
- //
394
- // ── THERE IS NOTHING LEFT TO COMPENSATE FOR, AND THAT IS THE WHOLE POINT OF THE SLOT ──────────
395
- //
396
- // Two functions used to live here: one probed the strip's open height before it opened, the other
397
- // aimed a scroll at where the page WOULD rest once the strip had finished moving. They existed
398
- // because the strip was in flow above every section, so opening it pushed the whole page down by
399
- // its own 26px and a landing computed before it opened was wrong by exactly that much. A person
400
- // felt it as three motions for one tap.
401
- //
402
- // `.tb-slot` ends that at the source: the SLOT is what flow sees and its box is `--shell-top`, a
403
- // constant; the BAR is static inside it and may be any height it likes. Opening the strip moves
404
- // nothing outside the slot, so a landing computed before it opens is simply correct.
405
- //
406
- // The compensation is therefore not merely dead — it would be WRONG, adding a strip's height to
407
- // the posts landing for a shift that no longer happens. When the strip came back on 2026-08-06 the
408
- // reserved box came back with it FOR EVERY KIND, not only for games, and these two went for good.
409
- // If they are ever missed, the thing to check is whether the slot still reserves its box.
410
- const setStrip = (id, animate) => {
411
- if (!tbTitle)
412
- return;
413
- const t = titleFor(id);
414
- if (animate) {
415
- tbTitle.classList.toggle("show", !!t);
416
- if (t && tbTitleText && tbTitleText.textContent !== t) {
417
- tbTitleText.classList.add("fade");
418
- setTimeout(() => { tbTitleText.textContent = t; tbTitleText.classList.remove("fade"); }, 150);
419
- }
420
- return;
421
- }
422
- // Instant: the height must be final before this function returns, so the caller can measure. The
423
- // text goes with it — a settled height showing the previous words would be its own small lie.
424
- tbTitle.style.transition = "none";
425
- tbTitle.classList.toggle("show", !!t);
426
- if (t && tbTitleText) {
427
- tbTitleText.classList.remove("fade");
428
- tbTitleText.textContent = t;
429
- }
430
- void tbTitle.offsetHeight;
431
- tbTitle.style.transition = "";
432
- };
433
333
  let lastCut = null;
434
- let first = true;
435
334
  // queries: the toolbar icon changes late · nav icon lags the tap · active state waits for the scroll
436
335
  //
437
336
  // THE DESTINATION, HELD FOR THE LENGTH OF THE TRIP.
@@ -469,11 +368,6 @@ export function personaScroll(options) {
469
368
  lastCut = current;
470
369
  if (current[0].id && "#" + current[0].id !== location.hash)
471
370
  setHash(current[0].id);
472
- // First paint is not a transition: the page opens at the kernel, so the title is already true when
473
- // it arrives. Animating it in tells a person something changed when nothing did.
474
- const wasFirst = first;
475
- first = false;
476
- setStrip(current[0].id, !wasFirst);
477
371
  };
478
372
  // queries: scroll janks while the toolbar updates · scroll handler runs too often · the spy reads a
479
373
  // stale position · the section is right but the toolbar is one behind · scrollend
@@ -542,16 +436,6 @@ export function personaScroll(options) {
542
436
  if (!t)
543
437
  return;
544
438
  e.preventDefault();
545
- // A NEW LANDING RE-ARMS THE PROMISE. Somebody asking for a cut is asking to arrive at it, and the
546
- // arrival needs the same protection the page's first one had: the title strip opens as the kernel
547
- // becomes current, which drags the scroll ~18px past the mark and tucks the kernel's first line
548
- // under the sticky bar. Without this the toolbar's own icon landed flush and the avatar did not,
549
- // for no reason a person could see.
550
- // THE STRIP AND THE SCROLL RUN TOGETHER. The strip keeps its own transition — it is meant to be
551
- // seen growing, and snapping it open instead just moves the jolt to the moment of the tap. What
552
- // changes is the AIM: the scroll is sent to where the page will rest once the strip has finished,
553
- // so the growing band and the moving page arrive at the same place at the same time and nothing
554
- // has to be corrected afterwards.
555
439
  // The icon answers the tap NOW, not when the scroll lands. `navTo` keeps it answered for the trip.
556
440
  navTo = t;
557
441
  for (const c of cuts)
@@ -571,9 +455,9 @@ export function personaScroll(options) {
571
455
  // spent after that, and from the SECOND tap onward the page snapped back every time — which is
572
456
  // exactly how the founder found it: "profile · kernel · profile · kernel … 2. cycle'da başlıyor."
573
457
  //
574
- // The strip still follows the tap — it is the row saying which cut you are on, which is the one
575
- // thing about it the founder said he could not give up.
576
- setStrip(t[0].id, true);
458
+ // The row says which cut you are on through the icon that answered the tap above — that was the
459
+ // one thing about the old title strip the founder said he could not give up, and it is the
460
+ // icon's job now, not a second line's.
577
461
  window.scrollTo({ top: landingY(t[0]), behavior: "smooth" });
578
462
  setHash(t[0].id);
579
463
  });
@@ -588,8 +472,6 @@ export function personaScroll(options) {
588
472
  navTo = t;
589
473
  for (const c of cuts)
590
474
  c[1].classList.toggle("active", c === t);
591
- // Nor here — same reason as the click above.
592
- setStrip(t[0].id, true);
593
475
  window.scrollTo({ top: landingY(t[0]), behavior: "smooth" });
594
476
  }
595
477
  });
package/dist/xray.js CHANGED
@@ -258,7 +258,8 @@ export function xray() {
258
258
  armRab.setAttribute("d", rab.join(""));
259
259
  var aw = app ? app.getBoundingClientRect().width : r.width;
260
260
  put(R.viewport, Math.round(innerWidth) + " x " + Math.round(innerHeight));
261
- put(R.column, px(aw), aw <= 640);
261
+ // the column's law: never wider than 1280 (@justai/ui --column, 2026-10-14; 640 before)
262
+ put(R.column, px(aw), aw <= 1280);
262
263
  var even = Math.abs(padL - padR) < 0.5;
263
264
  put(R.gutter, px(padL) + " / " + px(padR) + (even ? "" : " <- the two sides differ"), even);
264
265
  put(R.frame, px(r.width) + " x " + px(r.height));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justai/core",
3
- "version": "0.40.0",
3
+ "version": "0.42.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": {