@justai/core 0.17.0 → 0.18.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 +28 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justai/core",
3
- "version": "0.17.0",
3
+ "version": "0.18.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
@@ -1080,10 +1080,37 @@ export async function adoptMark(options) {
1080
1080
  if (!svg) return null;
1081
1081
  if (img) img.remove();
1082
1082
 
1083
+ // queries: the parent icon still has a background · app.zone mark has a black tile in the child
1084
+ // toolbar · the ground was not removed · a path ground · squircle path
1085
+ //
1086
+ // THE GROUND IS WHATEVER IS BEHIND EVERYTHING, AND HERE IT CAN BE MEASURED.
1087
+ //
1088
+ // `toolbarMark` finds a ground by matching a `<rect>` against the viewBox, because at build time a
1089
+ // string is all it has. Fourteen personas draw exactly that rect. The fifteenth is app.zone, whose
1090
+ // mark comes out of a design tool as a 1024 viewBox with the squircle as a hand-drawn `<path>` —
1091
+ // so its tile survived, and /me and /files on app.zone showed a black card in a row of inks while
1092
+ // every other host was correct.
1093
+ //
1094
+ // Chasing that with another string rule would be chasing the sixteenth drawing next. In the
1095
+ // browser the question is geometric and answerable: a ground is the BACKMOST painted shape that
1096
+ // covers the whole viewBox. Measure it and remove it, whatever it was drawn as.
1097
+ //
1098
+ // Only the first shape, and only a shape — a `<g>` may legitimately wrap the entire mark, and
1099
+ // removing that would remove the drawing rather than what is behind it.
1100
+ const vb = (svg.getAttribute("viewBox") || "").split(/[\s,]+/).map(Number);
1101
+ if (vb.length === 4 && vb[2] > 0 && vb[3] > 0) {
1102
+ const back = [...svg.children].find((n) => /^(path|rect|circle|ellipse|polygon|polyline)$/i.test(n.tagName));
1103
+ try {
1104
+ if (back) {
1105
+ const bb = back.getBBox();
1106
+ if (bb.width >= vb[2] * 0.97 && bb.height >= vb[3] * 0.97) back.remove();
1107
+ }
1108
+ } catch { /* not rendered — leave the drawing whole */ }
1109
+ }
1110
+
1083
1111
  // the measurement `fills` would have carried, taken from the drawing itself
1084
1112
  let box = 20;
1085
1113
  try {
1086
- const vb = (svg.getAttribute("viewBox") || "").split(/[\s,]+/).map(Number);
1087
1114
  const bb = svg.getBBox();
1088
1115
  if (vb.length === 4 && vb[2] > 0 && vb[3] > 0 && bb.width > 0) {
1089
1116
  const fills = Math.max(bb.width / vb[2], bb.height / vb[3]);