@justai/core 0.11.0 → 0.12.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 +19 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justai/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.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
|
@@ -877,9 +877,27 @@ export async function childFace(options) {
|
|
|
877
877
|
return null;
|
|
878
878
|
}
|
|
879
879
|
if (!face) return null;
|
|
880
|
-
if (
|
|
880
|
+
if (typeof document === "undefined") return face;
|
|
881
|
+
if (face.accent) {
|
|
881
882
|
document.documentElement.style.setProperty("--accent", face.accent);
|
|
882
883
|
if (root) root.style.setProperty("--accent", face.accent);
|
|
883
884
|
}
|
|
885
|
+
// queries: pnName pnHandle pnMeta · the child persona shows its own name instead of the host's
|
|
886
|
+
//
|
|
887
|
+
// THE HOST'S IDENTITY, WRITTEN INTO THE SHELL'S IDS. <ChildPersona> renders name, handle and the
|
|
888
|
+
// small print as spans with these ids precisely so one function can fill them: the page is built
|
|
889
|
+
// once and mounted on every persona's host, so none of it is knowable at build time.
|
|
890
|
+
//
|
|
891
|
+
// Each write is guarded because a MISSING value must leave the server's fallback standing — the
|
|
892
|
+
// child's own words, which are correct when the lookup never returns. Blanking them on a failed
|
|
893
|
+
// fetch would turn "we could not reach the registry" into "this persona has no name".
|
|
894
|
+
const put = (id, text) => { const el = document.getElementById(id); if (el && text) el.textContent = text; };
|
|
895
|
+
put("pnName", face.name);
|
|
896
|
+
put("pnHandle", face.handle ? "@" + face.handle : null);
|
|
897
|
+
put("pnMeta", face.meta);
|
|
898
|
+
if (face.avatar) {
|
|
899
|
+
const slot = document.getElementById("hostGlyph");
|
|
900
|
+
if (slot) slot.innerHTML = '<img class="mk" src="' + face.avatar + '" alt="">';
|
|
901
|
+
}
|
|
884
902
|
return face;
|
|
885
903
|
}
|