@justai/core 0.15.0 → 0.17.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +48 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justai/core",
3
- "version": "0.15.0",
3
+ "version": "0.17.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
@@ -894,7 +894,38 @@ export async function childFace(options) {
894
894
  const put = (id, text) => { const el = document.getElementById(id); if (el && text) el.textContent = text; };
895
895
  put("pnName", face.name);
896
896
  put("pnHandle", face.handle ? "@" + face.handle : null);
897
- put("pnMeta", face.meta);
897
+
898
+ // queries: the child persona shows raw HTML · <span class="mtag"> printed as text · the meta line
899
+ // shows markup · unrendered html in the profile · pnMeta
900
+ //
901
+ // THE META LINE IS MARKUP, AND IT ARRIVES FROM A REGISTRY. A persona's `meta` is a row of chips —
902
+ // `<span class="mtag">Fast</span>…` — and the Profile cut renders the persona's OWN with `set:html`
903
+ // because it is that persona's file. This is the same string coming back over the network, and
904
+ // `textContent` printed it verbatim: three child personas on every host showed a paragraph of angle
905
+ // brackets under the bio.
906
+ //
907
+ // `innerHTML` IS THE OBVIOUS FIX AND IT IS THE WRONG ONE. That would put remote markup into the
908
+ // document on every host in the fleet, and `meta` is written by each persona's own manifest — an
909
+ // `onerror=` in one persona's registry entry would then run inside /me, /files and the feed
910
+ // wherever they are mounted. A child persona is the LAST place to be permissive: it is the surface
911
+ // that shows a person their own vault.
912
+ //
913
+ // So the markup is parsed but never adopted. DOMParser builds an inert document — no scripts, no
914
+ // network — the TEXT of each chip is read out of it, and this file creates the elements itself.
915
+ // Whatever arrives, what reaches the page is spans this code made.
916
+ const meta = document.getElementById("pnMeta");
917
+ if (meta && face.meta) {
918
+ const inert = new DOMParser().parseFromString("<body>" + face.meta + "</body>", "text/html");
919
+ const chips = [...inert.body.querySelectorAll("span, li")].filter((n) => n.textContent.trim());
920
+ meta.textContent = "";
921
+ if (!chips.length) meta.textContent = inert.body.textContent.trim();
922
+ else for (const c of chips) {
923
+ const span = document.createElement("span");
924
+ span.className = "mtag";
925
+ span.textContent = c.textContent.trim();
926
+ meta.append(span);
927
+ }
928
+ }
898
929
  if (face.avatar) {
899
930
  const slot = document.getElementById("hostGlyph");
900
931
  if (slot) slot.innerHTML = '<img class="mk" src="' + face.avatar + '" alt="">';
@@ -960,7 +991,22 @@ export function toolbarMark(iconSvg, options) {
960
991
  .replace(new RegExp(`(href|xlink:href)="#${safe}"`, "g"), `$1="#${id}-${ns}"`);
961
992
  }
962
993
 
963
- // 4. it is decoration in the row — the link around it carries the name
994
+ // queries: the track ring disappears in the toolbar · white on white · the dial is missing in light
995
+ // mode · rgba(255,255,255,0.16) · half the mark vanished when the ground came off
996
+ //
997
+ // 4. WHAT ONLY MADE SENSE ON THE TILE. Five marks in the fleet draw an unlit "track" — a dial, the
998
+ // ring a progress arc runs on — as `rgba(255,255,255,0.16)`. White at 16% is a correct choice
999
+ // ON the near-black tile and a meaningless one off it: in a light toolbar it is white on white,
1000
+ // so the mark arrives with a piece silently missing, and only in one colour scheme. time's dial
1001
+ // vanished exactly this way the day it was drawn, leaving the two hands reading as an L.
1002
+ //
1003
+ // It becomes the row's own ink at the same weight. This is not recolouring the mark — the rule
1004
+ // above still stands, and the FIGURE is left alone. It is the same act as removing the ground:
1005
+ // the tile is gone, so what was drawn against the tile has to be told what it is against now.
1006
+ s = s.replace(/(stroke|fill)="rgba\(\s*255\s*,\s*255\s*,\s*255\s*,\s*([\d.]+)\s*\)"/g,
1007
+ (_, prop, a) => `${prop}="currentColor" ${prop}-opacity="${a}"`);
1008
+
1009
+ // 5. it is decoration in the row — the link around it carries the name
964
1010
  s = s.replace(/\srole="img"/, "").replace(/\saria-label="[^"]*"/, "");
965
1011
  if (!/aria-hidden/.test(s)) s = s.replace(/<svg /, '<svg aria-hidden="true" ');
966
1012
  if (o.class) s = s.replace(/<svg /, `<svg class="${o.class}" `);