@justai/core 0.13.0 → 0.14.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.d.ts +12 -1
- package/src/index.js +21 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justai/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.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.d.ts
CHANGED
|
@@ -125,5 +125,16 @@ export declare function childFace(options?: {
|
|
|
125
125
|
*/
|
|
126
126
|
export declare function toolbarMark(
|
|
127
127
|
iconSvg: string,
|
|
128
|
-
options?: {
|
|
128
|
+
options?: {
|
|
129
|
+
id?: string;
|
|
130
|
+
class?: string;
|
|
131
|
+
/**
|
|
132
|
+
* How much of its viewBox this persona's drawing actually fills, 0–1. The row shows 20px of INK,
|
|
133
|
+
* so the box becomes `20 / fills` — a mark drawn inside a tile keeps the tile's padding and would
|
|
134
|
+
* otherwise read at 9–13px. Measure it once (`getBBox().width / viewBox width`, longer side) and
|
|
135
|
+
* write it down; it is this persona's own number, like its accent, and it moves when the mark is
|
|
136
|
+
* redrawn.
|
|
137
|
+
*/
|
|
138
|
+
fills?: number;
|
|
139
|
+
},
|
|
129
140
|
): string;
|
package/src/index.js
CHANGED
|
@@ -964,5 +964,26 @@ export function toolbarMark(iconSvg, options) {
|
|
|
964
964
|
s = s.replace(/\srole="img"/, "").replace(/\saria-label="[^"]*"/, "");
|
|
965
965
|
if (!/aria-hidden/.test(s)) s = s.replace(/<svg /, '<svg aria-hidden="true" ');
|
|
966
966
|
if (o.class) s = s.replace(/<svg /, `<svg class="${o.class}" `);
|
|
967
|
+
|
|
968
|
+
// queries: the derived mark is too small · fills · the mark shrank when the ground came off ·
|
|
969
|
+
// box for 20 ink
|
|
970
|
+
//
|
|
971
|
+
// TAKING THE GROUND OFF DOES NOT MAKE THE DRAWING BIGGER — it only removes what was behind it. A
|
|
972
|
+
// mark drawn to sit inside a tile keeps the tile's padding: measured across the fleet, the marks
|
|
973
|
+
// occupy between 0.46 and 0.68 of their viewBox, so in a 20px box they put 9 to 13 on screen. The
|
|
974
|
+
// row's rule is 20 of INK, so the box has to be 20 divided by that fraction.
|
|
975
|
+
//
|
|
976
|
+
// `fills` is the persona's own measurement, the way its accent is — a property of ITS drawing, not
|
|
977
|
+
// a rule copied between repos. That distinction is the whole reason it is a number passed in
|
|
978
|
+
// rather than a stylesheet each persona keeps: copying a rule is O(N) debt, carrying your own
|
|
979
|
+
// measurement is data. Redraw the mark and this moves; nothing else does.
|
|
980
|
+
//
|
|
981
|
+
// Written as an inline style because the cut's `.tb-nav svg { width: 20px }` would beat a width
|
|
982
|
+
// ATTRIBUTE. Left out, the mark takes the row's default and reads small — which is what shipped for
|
|
983
|
+
// one deploy and is exactly how the fleet's ratios came to be measured.
|
|
984
|
+
if (o.fills > 0) {
|
|
985
|
+
const px = (20 / o.fills).toFixed(2);
|
|
986
|
+
s = s.replace(/<svg /, `<svg style="width:${px}px;height:${px}px" `);
|
|
987
|
+
}
|
|
967
988
|
return s.trim();
|
|
968
989
|
}
|