@justai/core 0.22.0 → 0.23.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 +67 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justai/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "The framework-free heart of the persona shell \u2014 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
|
@@ -88,13 +88,53 @@ export const XRAY_JS = `(() => {
|
|
|
88
88
|
var css = document.createElement("style");
|
|
89
89
|
css.textContent = [
|
|
90
90
|
".xr{position:fixed;pointer-events:none;z-index:2147483000}",
|
|
91
|
-
|
|
91
|
+
// ── THE RHYTHM IS DOT PAPER, THE SAME DOT PAPER THE FLEET ALREADY PAINTS ──────────────────
|
|
92
|
+
// It was ruled horizontal lines, which is notebook paper: it reads as a THING to look at, it
|
|
93
|
+
// fights every horizontal edge in the design, and it says nothing at all about the horizontal
|
|
94
|
+
// axis it does not draw. Dots say both axes at once and disappear behind the content, which is
|
|
95
|
+
// what a grid under a design is for.
|
|
96
|
+
// Same construction as the page background @justai/ui paints on html — a radial-gradient dot on
|
|
97
|
+
// a square tile — so the instrument speaks the fleet's own visual language rather than inventing
|
|
98
|
+
// a second one. The tile is 8px here rather than the page's 16: this is the 8pt rhythm the
|
|
99
|
+
// padding and the margins are actually built on.
|
|
100
|
+
//
|
|
101
|
+
// NO BACKTICKS ANYWHERE INSIDE THIS STRING. It is a template literal, so one in a COMMENT ends
|
|
102
|
+
// it — the file still parses, the script it produces is truncated garbage, and the build fails
|
|
103
|
+
// somewhere else entirely. Written here twice tonight before the fixture refused to build.
|
|
104
|
+
".xr-rhythm{background-image:radial-gradient(circle,rgba(128,128,128,.34) 1px,transparent 1.4px);background-size:8px 8px}",
|
|
92
105
|
".xr-f{position:fixed;pointer-events:none;z-index:2147483000}",
|
|
93
|
-
|
|
106
|
+
// THREE CORNERS, BECAUSE THE ZONES ARE 16px APART AND A LABEL IS 11px TALL. Stacked at one
|
|
107
|
+
// corner the way a broadcast overlay does it, they collided the moment the gutter was a
|
|
108
|
+
// phone gutter rather than a television one: EDGE OF FRAME sat on ACTION SAFE and the amber
|
|
109
|
+
// line ran through both. Broadcast can stack them because its safe margins are 5% and 10% of
|
|
110
|
+
// the frame; ours are 16px and 32px. So each zone takes a corner of its own and they cannot
|
|
111
|
+
// meet at any width. The colours already say which is which — the words are the confirmation.
|
|
112
|
+
".xr-f>i{position:absolute;font-size:.68rem;font-style:normal;letter-spacing:.07em;text-transform:uppercase;font-weight:700;white-space:nowrap}",
|
|
113
|
+
// THEY DIFFER IN BOTH AXES, and the second axis is what makes it work at any gutter: each label
|
|
114
|
+
// sits at its own box's top — 16px apart on a phone — AND at a different corner of it. Two of
|
|
115
|
+
// them could be one pixel apart vertically and still not touch.
|
|
116
|
+
// ALL THREE AT THE TOP, and that is not symmetry. An app kernel is at least a viewport tall, so
|
|
117
|
+
// its box ends below the fold: a label anchored to the bottom of the action-safe frame was simply
|
|
118
|
+
// not on the screen. Measured, after being written that way first.
|
|
119
|
+
".xr-edge>i{top:3px;right:7px}",
|
|
120
|
+
".xr-act>i{top:3px;left:50%;transform:translateX(-50%)}",
|
|
121
|
+
".xr-ttl>i{top:3px;left:7px}",
|
|
122
|
+
// ── THREE ZONES, THREE COLOURS, AND THE ORDER MEANS SOMETHING ─────────────────────────────
|
|
123
|
+
// Red, amber, green — outward to inward, danger to safe. Everyone already reads that gradient
|
|
124
|
+
// without being taught it, and it is exactly what the three zones say: the edge is where things
|
|
125
|
+
// get cut, action-safe is where a control may sit, title-safe is where a word is certain to be
|
|
126
|
+
// read. Three greys distinguished only by their dash pattern made the reader count borders.
|
|
94
127
|
".xr-edge{border:3px solid #E8503A}",
|
|
95
|
-
".xr-
|
|
96
|
-
".xr-
|
|
97
|
-
".xr-
|
|
128
|
+
".xr-edge>i{color:#E8503A}",
|
|
129
|
+
".xr-act{border:1.5px solid #F5A623}",
|
|
130
|
+
".xr-act>i{color:#C97F0B}",
|
|
131
|
+
".xr-ttl{border:1.5px dashed #2E9E5B}",
|
|
132
|
+
".xr-ttl>i{color:#2E9E5B}",
|
|
133
|
+
// The centre cross runs the WHOLE frame, in both axes. Ticks at the four edges said where the
|
|
134
|
+
// middle of each side was and left the reader to imagine the intersection; two full lines put
|
|
135
|
+
// the kernel's centre on the screen as a point you can hold something against. Blue, because it
|
|
136
|
+
// is the one thing on this overlay that is not a boundary — it is a reference.
|
|
137
|
+
".xr-c{position:fixed;background:rgba(61,111,217,.55);pointer-events:none;z-index:2147483000}",
|
|
98
138
|
".xr-read{position:fixed;left:12px;bottom:12px;pointer-events:none;z-index:2147483001;",
|
|
99
139
|
"display:grid;grid-template-columns:auto 1fr;gap:2px 12px;padding:10px 12px;border-radius:10px;",
|
|
100
140
|
"background:rgba(20,22,28,.92);color:#f2f4f8;font:400 .78rem/1.35 ui-monospace,SFMono-Regular,Menlo,monospace}",
|
|
@@ -110,7 +150,7 @@ export const XRAY_JS = `(() => {
|
|
|
110
150
|
var edge = mk("xr-f xr-edge", "<i>edge of frame</i>");
|
|
111
151
|
var act = mk("xr-f xr-act", "<i>action safe</i>");
|
|
112
152
|
var ttl = mk("xr-f xr-ttl", "<i>title safe</i>");
|
|
113
|
-
var
|
|
153
|
+
var cross = [0,1].map(() => mk("xr-c"));
|
|
114
154
|
var read = mk("xr-read");
|
|
115
155
|
|
|
116
156
|
var row = (label) => {
|
|
@@ -120,7 +160,7 @@ export const XRAY_JS = `(() => {
|
|
|
120
160
|
return s;
|
|
121
161
|
};
|
|
122
162
|
var R = { viewport: row("viewport"), column: row("column"), gutter: row("gutter L/R"),
|
|
123
|
-
frame: row("frame"), act: row("action safe"), ttl: row("title safe"),
|
|
163
|
+
frame: row("frame"), inset: row("kernel inset"), act: row("action safe"), ttl: row("title safe"),
|
|
124
164
|
bar: row("toolbar"), clear: row("clears bar"), safe: row("safe area L/R"),
|
|
125
165
|
bleed: row("bleed") };
|
|
126
166
|
var put = (el, text, ok) => { el.textContent = text; if (ok !== undefined) el.dataset.ok = ok ? "yes" : "no"; };
|
|
@@ -142,13 +182,13 @@ export const XRAY_JS = `(() => {
|
|
|
142
182
|
|
|
143
183
|
box(edge, r, 0); box(act, r, g); box(ttl, r, g * 2); box(rhythm, r, 0);
|
|
144
184
|
|
|
145
|
-
//
|
|
146
|
-
//
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
[r.left
|
|
151
|
-
|
|
185
|
+
// THE CENTRE CROSS, EDGE TO EDGE. Their intersection IS the kernel's centre — the one point a
|
|
186
|
+
// design gets measured against and the one an eye cannot find on its own. Drawn across the whole
|
|
187
|
+
// frame rather than as ticks, so anything meant to be centred can be held against a line instead
|
|
188
|
+
// of against a guess about where two marks would have met.
|
|
189
|
+
var t = [[r.left + r.width / 2, r.top, 1, r.height],
|
|
190
|
+
[r.left, r.top + r.height / 2, r.width, 1]];
|
|
191
|
+
cross.forEach((el, i) => { el.style.left = t[i][0] + "px"; el.style.top = t[i][1] + "px";
|
|
152
192
|
el.style.width = t[i][2] + "px"; el.style.height = t[i][3] + "px"; });
|
|
153
193
|
|
|
154
194
|
var aw = app ? app.getBoundingClientRect().width : r.width;
|
|
@@ -157,6 +197,19 @@ export const XRAY_JS = `(() => {
|
|
|
157
197
|
var even = Math.abs(padL - padR) < 0.5;
|
|
158
198
|
put(R.gutter, px(padL) + " / " + px(padR) + (even ? "" : " <- the two sides differ"), even);
|
|
159
199
|
put(R.frame, px(r.width) + " x " + px(r.height));
|
|
200
|
+
// THE KERNEL'S OWN INSET, WITH THE LAW IT IS JUDGED AGAINST. Two laws, and which one applies is
|
|
201
|
+
// read from the document rather than guessed: an APP kernel is inset by the gutter on all four
|
|
202
|
+
// sides, a GAME kernel by nothing at all. This row is the reason the second law stopped being
|
|
203
|
+
// sixteen copies — 8px sat at the bottom of every persona in the fleet, matching neither the top
|
|
204
|
+
// nor the sides, and there was nowhere it was ever printed next to what it should have been.
|
|
205
|
+
var kind = document.documentElement.dataset.kind || "app";
|
|
206
|
+
var ks = getComputedStyle(k);
|
|
207
|
+
var kp = [ks.paddingTop, ks.paddingRight, ks.paddingBottom, ks.paddingLeft].map((v) => parseFloat(v) || 0);
|
|
208
|
+
var want = kind === "game" ? 0 : g;
|
|
209
|
+
// The bottom may EXCEED the gutter and only the bottom may: env(safe-area-inset-bottom) is the
|
|
210
|
+
// strip the OS keeps for its home indicator, and it is added rather than substituted.
|
|
211
|
+
var insetOk = kp[0] === want && kp[1] === 0 && kp[3] === 0 && kp[2] >= want;
|
|
212
|
+
put(R.inset, kp.join(" / ") + " (" + kind + " wants " + want + ")", insetOk);
|
|
160
213
|
put(R.act, "inset " + px(g) + " . " + px(r.width - g * 2) + " wide");
|
|
161
214
|
put(R.ttl, "inset " + px(g * 2) + " . " + px(r.width - g * 4) + " wide");
|
|
162
215
|
|