@333eco/brand 1.9.0 → 1.10.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/README.md CHANGED
@@ -141,6 +141,11 @@ an H3QR names whom you thank, and a B-QR is how that code is drawn.
141
141
  bottom lobe: it names the **B-Emblem™**, never *B-QR* (unmarked), and shows which way is up. `lobe: "none"` or `autograph` (a person's own
142
142
  strokes, *Open* only, ⛔ throws in *Full*) are for a person's own picture. The other three positions mean nothing yet, so ⛔ nothing is
143
143
  drawn in one, and the top lobe keeps its dots. Codes printed before keep working.
144
+ - **Centered, and a coded top lobe (v1.10.0, founder 2026-11-24).** The ™, and an autograph in its place, stand at the bottom lobe's center, each
145
+ version's own (`BQR_LOBE_CENTER`, solved from the silhouette by the test). An autograph is FITTED to its box: its own shape kept, wherever on
146
+ the pad it was drawn. `coded` puts 96 bits in the TOP lobe (Open only, ⛔ throws in Full): for a mark in a person's picture, where its caller
147
+ writes a short fingerprint of that picture, so a heart pasted on another is caught with no network. ⛔ Never a person, a serial, a claim or a
148
+ key; nothing about it is secret. Our own codes keep their dots.
144
149
  - **The card's words are PLACED, never aligned (v1.6.1).** `paintQrCard` measures each line, shrinks its size until it fits,
145
150
  and draws it from the left at the center minus half its width. Safari on iOS 26 ignores `textAlign = "center"` and the
146
151
  `maxWidth` argument for a complex script: a Khmer caption printed starting at the center line. Measured on the Simulator
package/brand.lock CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.9.0",
2
+ "version": "1.10.0",
3
3
  "files": {
4
4
  "css/metta.css": "9bfe986c46c303bf9a48be85322d68e3d626571a424ef3a8aa81faaf5c866692",
5
5
  "css/motion.css": "9bfbe39c0de6a9dfaf9fdc2c61e327b3c8e70221c34dff9befd85da448b9e0c2",
@@ -11,6 +11,6 @@
11
11
  "emblem/emblem.svg": "368f520ad2d2f9db50d83ca9cd7aee9475948dc8e38c61b7afa13f7717fef903",
12
12
  "emblem/emblem.ts": "6e150389eed576c392ff6231c0b38b8fea5d4c11f7a5b21936bb25afab069890",
13
13
  "qr/bqr-card.ts": "55b4cf3d742bb758f789fd18f91737e8da1169610b6b953ad71e95d8bb713168",
14
- "qr/bqr.ts": "82ae72c931f3e5453038625c2a37a4ff1928bcf5274891de3c68d53c0d477512"
14
+ "qr/bqr.ts": "076a838d8268da318e59c85e9ceed7ad58b8b0c7cd9c15f7882c6ece361a5846"
15
15
  }
16
16
  }
package/data/bodies.json CHANGED
@@ -18,7 +18,7 @@
18
18
  ],
19
19
  "bodies": [
20
20
  { "body": "H3", "name": "HeartBank®", "color": "rainbow — each code in its domain's hue", "owners": ["heartbank.us", "heartbank.me", "heartbank.org", "heartbank.ceo", "heartbank.net", "heartbank.com"], "why": "a rainbow is sunlight through water; H3 is the Water body" },
21
- { "body": "SW", "name": "Silicon Wat℠", "color": "orange robe", "owners": ["SW"], "prints": "deep ochre", "why": "the robe's kāsāya; SW is the Fire body" },
21
+ { "body": "SW", "name": "Silicon Wat ℠", "color": "orange robe", "owners": ["SW"], "prints": "deep ochre", "why": "the robe's kāsāya; SW is the Fire body" },
22
22
  { "body": "TH", "name": "THonly™", "color": "sky blue", "owners": ["TH"], "why": "Mind is the Air body; the sky" },
23
23
  { "body": "F333", "name": "Factory 333™", "color": "crimson moon", "owners": ["F333"], "why": "the workshop on the far side of the Moon; a red moon is lit by Earth's sunrises and sunsets, and F333 is the Earth body" },
24
24
  { "body": "MA", "name": "Miss Aquarius℠", "color": "clear sparkle", "owners": ["MA"], "prints": "graphite", "motion": "on screen the glint moves only when the viewer moves (tilt, pointer, scroll) — never by itself; still under reduced motion and in print", "why": "space holds the four colors and has none of its own; the light that crosses it sparkles" }
package/data/brand.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "into brand.lock, which is vendored byte-identical into every consumer,",
9
9
  "so 'which sites are on which brand version' is answerable by grep."
10
10
  ],
11
- "version": "1.9.0",
11
+ "version": "1.10.0",
12
12
  "wordmark": {
13
13
  "$comment": [
14
14
  "The composition has an internal short-name as of 2026-09-20: B-Wordmark",
package/dist/Brand.kt CHANGED
@@ -18,7 +18,7 @@ import androidx.compose.ui.graphics.lerp
18
18
  import androidx.compose.ui.unit.dp
19
19
 
20
20
  object Brand {
21
- const val VERSION = "1.9.0"
21
+ const val VERSION = "1.10.0"
22
22
 
23
23
  /** The B-Gem media-type palette. A colour here MEANS a medium.
24
24
  * Not a site palette, and not the six-TLD rainbow. */
package/dist/Brand.swift CHANGED
@@ -14,7 +14,7 @@
14
14
  import SwiftUI
15
15
 
16
16
  public enum Brand {
17
- public static let version = "1.9.0"
17
+ public static let version = "1.10.0"
18
18
 
19
19
  /// The B-Gem media-type palette. A colour here MEANS a medium.
20
20
  /// ⚠️ Not a site palette, and not the six-TLD rainbow. Using a gem as an
package/dist/tokens.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$comment": "GENERATED by scripts/generate.mjs. Do not edit. Values are parsed from css/tokens.css, which is canonical; semantics come from data/. Run `node scripts/generate.mjs --check` to prove this file is current.",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "gems": [
5
5
  {
6
6
  "name": "ruby",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@333eco/brand",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "The canonical brand layer for the institution — design tokens, themes, motion, and the B-Emblem. A READ-ONLY MIRROR; institution repos vendor this layer, they do not install it.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Thon Ly",
package/qr/bqr.ts CHANGED
@@ -65,13 +65,19 @@ export const BQR_FILL_RING = 1;
65
65
  */
66
66
  export type BqrLobe = "tm" | "none";
67
67
  export const BQR_LOBE_DEFAULT: BqrLobe = "tm";
68
- /** The ™: its centre, its cap height, and the quiet space around it, in viewBox units. Drawn as bars, so it needs no font. */
69
- export const BQR_TM = { cx: 18.25, cy: 14.12, h: 1.05, pad: 0.5 } as const;
68
+ /**
69
+ * ⭐ v1.10.0 (founder 2026-11-24: *"horizontally and vertically center the ™ and the [autograph] within the bottom lobe"*) — the lobe's CENTER,
70
+ * each version's own: midway between the code's last column and the outline's inner edge on its row, and midway between the outline's
71
+ * inner edges on its column. Solved from the silhouette; `scripts/bqr.test.mjs` §center solves it again and holds these.
72
+ */
73
+ export const BQR_LOBE_CENTER = { pixels: { x: 17.86, y: 14.15 }, outline: { x: 17.62, y: 14.16 } } as const;
74
+ /** The ™: its cap height and the quiet space around it, in viewBox units. Drawn as bars, so it needs no font. */
75
+ export const BQR_TM = { h: 1.05, pad: 0.5 } as const;
70
76
  const TM = { t: 0.2, w: 0.84, gap: 0.13, m: 1.06 } as const; // stroke · T's width · the gap · M's width, as parts of the cap height
71
- export const bqrTmBox = () => { const w = BQR_TM.h * (TM.w + TM.gap + TM.m); return { x: BQR_TM.cx - w / 2, y: BQR_TM.cy - BQR_TM.h / 2, w, h: BQR_TM.h }; };
72
- /** The autograph's box in the bottom lobe, 5 : 3. ⭐ Not the largest that fits (5.2 × 3.12 at 15.65): that one stood so near the code that one
73
- * decoder lost 10 of 1,080 cards; this one, set further out, loses none (measured 2026-11-24, `scripts/bqr.test.mjs` §tm S5). */
74
- export const BQR_AUTOGRAPH = { x: 16.38, y: 12.86, w: 4.47, h: 2.68 } as const;
77
+ export const bqrTmBox = (style: keyof typeof BQR_LOBE_CENTER = "pixels") => { const w = BQR_TM.h * (TM.w + TM.gap + TM.m), c = BQR_LOBE_CENTER[style]; return { x: c.x - w / 2, y: c.y - BQR_TM.h / 2, w, h: BQR_TM.h }; };
78
+ /** The autograph's box, 5 : 3, centered in the Open version's bottom lobe. Its width is the largest that loses no reading (§center C3). */
79
+ const AUTOGRAPH_W = 4.27;
80
+ export const BQR_AUTOGRAPH = { x: BQR_LOBE_CENTER.outline.x - AUTOGRAPH_W / 2, y: BQR_LOBE_CENTER.outline.y - AUTOGRAPH_W * 0.3, w: AUTOGRAPH_W, h: AUTOGRAPH_W * 0.6 } as const;
75
81
  /** A person's B-Autograph℠, as points on a 100 × 60 pad: numbers only, ⛔ never a path's text (nothing here is ever parsed or injected). */
76
82
  export interface BqrAutograph { strokes: readonly (readonly (readonly [number, number])[])[] }
77
83
  export const BQR_PAD_W = 100, BQR_PAD_H = 60, BQR_AUTOGRAPH_PEN = 3, BQR_AUTOGRAPH_POINTS = 4000;
@@ -246,8 +252,10 @@ export interface BqrOptions {
246
252
  lobe?: BqrLobe;
247
253
  /** ⭐ v1.9.0 — a person's autograph in the bottom lobe, in the `outline` version only (⛔ throws in `pixels`); it replaces the ™. */
248
254
  autograph?: BqrAutograph;
249
- /** ⛔ TEST ONLY — `false` lets an autograph leave its box, for the check that must see it. */
250
- clipAutograph?: boolean;
255
+ /** ⛔ TEST ONLY — `false` draws an autograph where it was drawn on the pad, not fitted and centered, for the checks that must see it. */
256
+ fitAutograph?: boolean;
257
+ /** ⭐ v1.10.0 — 96 bits in the TOP lobe, for a mark in a person's picture, in the `outline` version only (⛔ throws in `pixels`). */
258
+ coded?: readonly number[];
251
259
  /** ⛔ TEST ONLY — `false` draws the code upright, the drawing before v1.9.0 (`scripts/bqr.test.mjs` §turn, the baseline). */
252
260
  turn?: boolean;
253
261
  /** ⭐ v1.6.0 — the drawing's color family, drawn at `BQR_INK`'s darkness (`bqrInkFor`). Default: `BQR_INK` itself.
@@ -338,28 +346,33 @@ function stream(seed: string): () => number {
338
346
  }
339
347
 
340
348
  /** Does a cell (its top left, its side) touch the sign's rounded quiet space? */
341
- function touchesSign(x: number, y: number, m: number): boolean {
342
- const b = bqrTmBox(), rx = b.w / 2 + BQR_TM.pad, ry = b.h / 2 + BQR_TM.pad;
343
- const nx = Math.max(x, Math.min(BQR_TM.cx, x + m)) - BQR_TM.cx, ny = Math.max(y, Math.min(BQR_TM.cy, y + m)) - BQR_TM.cy;
349
+ function touchesSign(x: number, y: number, m: number, style: BqrStyle): boolean {
350
+ const b = bqrTmBox(style), c = BQR_LOBE_CENTER[style], rx = b.w / 2 + BQR_TM.pad, ry = b.h / 2 + BQR_TM.pad;
351
+ const nx = Math.max(x, Math.min(c.x, x + m)) - c.x, ny = Math.max(y, Math.min(c.y, y + m)) - c.y;
344
352
  return (nx / rx) ** 2 + (ny / ry) ** 2 < 1;
345
353
  }
346
354
  /** The ™ as bars, in viewBox units. */
347
- function drawTm(g: CanvasRenderingContext2D): void {
348
- const b = bqrTmBox(), h = b.h, t = TM.t * h, w = TM.w * h, x1 = b.x + w + TM.gap * h, mw = TM.m * h, y = b.y;
355
+ function drawTm(g: CanvasRenderingContext2D, style: BqrStyle): void {
356
+ const b = bqrTmBox(style), h = b.h, t = TM.t * h, w = TM.w * h, x1 = b.x + w + TM.gap * h, mw = TM.m * h, y = b.y;
349
357
  g.fillRect(b.x, y, w, t); g.fillRect(b.x + w / 2 - t / 2, y, t, h);
350
358
  g.beginPath(); g.moveTo(x1, y + h); g.lineTo(x1, y); g.lineTo(x1 + t * 1.05, y); g.lineTo(x1 + mw / 2, y + h * 0.56); g.lineTo(x1 + mw - t * 1.05, y); g.lineTo(x1 + mw, y);
351
359
  g.lineTo(x1 + mw, y + h); g.lineTo(x1 + mw - t, y + h); g.lineTo(x1 + mw - t, y + h * 0.42); g.lineTo(x1 + mw / 2, y + h * 0.86); g.lineTo(x1 + t, y + h * 0.42); g.lineTo(x1 + t, y + h);
352
360
  g.closePath(); g.fill();
353
361
  }
354
362
  /** A person's autograph in its box: each stroke through the middles of its points, so a finger's corners come out round. */
355
- function drawAutograph(g: CanvasRenderingContext2D, a: BqrAutograph, ink: string, clip: boolean): void {
356
- const B = BQR_AUTOGRAPH, k = B.w / BQR_PAD_W;
363
+ /** ⭐ v1.10.0 — FITTED: the drawing keeps its own shape, grows to fill its box (at most twice the pad's own scale) and stands at the lobe's center,
364
+ * wherever on the pad it was drawn. It cannot leave its box, so it can never reach the code. */
365
+ function drawAutograph(g: CanvasRenderingContext2D, a: BqrAutograph, ink: string, fit: boolean): void {
366
+ const B = BQR_AUTOGRAPH, pad = B.w / BQR_PAD_W, pen = BQR_AUTOGRAPH_PEN * pad;
367
+ let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
368
+ for (const s of a.strokes) for (const [x, y] of s) { x0 = Math.min(x0, x); x1 = Math.max(x1, x); y0 = Math.min(y0, y); y1 = Math.max(y1, y); }
369
+ const k = fit ? Math.min(2 * pad, (B.w - pen) / Math.max(x1 - x0, 1e-6), (B.h - pen) / Math.max(y1 - y0, 1e-6)) : pad;
357
370
  g.save();
358
- if (clip) { g.beginPath(); g.rect(B.x, B.y, B.w, B.h); g.clip(); }
359
- g.translate(B.x, B.y); g.scale(k, k);
360
- g.strokeStyle = ink; g.fillStyle = ink; g.lineWidth = BQR_AUTOGRAPH_PEN; g.lineCap = "round"; g.lineJoin = "round";
371
+ if (fit) { g.translate(B.x + B.w / 2, B.y + B.h / 2); g.scale(k, k); g.translate(-(x0 + x1) / 2, -(y0 + y1) / 2); }
372
+ else { g.translate(B.x, B.y); g.scale(k, k); }
373
+ g.strokeStyle = ink; g.fillStyle = ink; g.lineWidth = pen / k; g.lineCap = "round"; g.lineJoin = "round";
361
374
  for (const s of a.strokes) {
362
- if (s.length === 1) { g.beginPath(); g.arc(s[0][0], s[0][1], BQR_AUTOGRAPH_PEN / 2, 0, Math.PI * 2); g.fill(); continue; }
375
+ if (s.length === 1) { g.beginPath(); g.arc(s[0][0], s[0][1], pen / k / 2, 0, Math.PI * 2); g.fill(); continue; }
363
376
  g.beginPath(); g.moveTo(s[0][0], s[0][1]);
364
377
  for (let i = 1; i < s.length - 1; i++) g.quadraticCurveTo(s[i][0], s[i][1], (s[i][0] + s[i + 1][0]) / 2, (s[i][1] + s[i + 1][1]) / 2);
365
378
  g.lineTo(s[s.length - 1][0], s[s.length - 1][1]); g.stroke();
@@ -408,12 +421,29 @@ export function bqrLayout(mat: BqrMatrix, seed: string, o: { style?: BqrStyle; q
408
421
  if ((on(c - 1, r) && on(c - 2, r)) || (on(c, r - 1) && on(c, r - 2))) continue; // ⛔ never three in a run
409
422
  dark.add(`${c},${r}`);
410
423
  // ⭐ A whole dot or none: the sign never cuts one. It is dropped AFTER it counted for the run rule, so no other dot moves (§tm S3).
411
- if (sign && touchesSign(ox + c * m, oy + r * m, m)) continue;
424
+ if (sign && touchesSign(ox + c * m, oy + r * m, m, style)) continue;
412
425
  deco.push([c, r]);
413
426
  }
414
427
  return { n, m, ox, oy, deco, style, outline: G.outline };
415
428
  }
416
429
 
430
+ /** ⭐ v1.10.0 — the top lobe's coded cells, as [column, row] on the DRAWN (turned) code's grid, nearest the code first; bit i is in cells i and
431
+ * i + 96. A checkerboard, so no two stand side by side. ⛔ Throws when a code is too coarse for them (a mark's 12 characters never is). */
432
+ export const BQR_CODED_BITS = 96;
433
+ export function bqrLobeCells(mat: BqrMatrix, o: { style?: BqrStyle } = {}): [number, number][] {
434
+ const L = bqrLayout(mat, "", { style: o.style ?? "outline", lobe: "none" }), clear = (DOT / 2) * L.m * Math.SQRT2 + L.outline / 2 + 0.15 * L.m, out: [number, number][] = [];
435
+ const r0 = Math.floor((EMBLEM_BOX.y - L.oy) / L.m) - 1, c0 = Math.floor((EMBLEM_BOX.x - L.ox) / L.m) - 1, c1 = Math.ceil((EMBLEM_BOX.x + EMBLEM_BOX.w - L.ox) / L.m) + 1;
436
+ for (let r = -BQR_QUIET - 1; r >= r0; r--) for (let c = c0; c <= c1; c++) {
437
+ if ((c + r) & 1) continue;
438
+ const cx = L.ox + (c + 0.5) * L.m, cy = L.oy + (r + 0.5) * L.m;
439
+ if (insideEmblem(cx, cy) && edgeDistance(cx, cy) >= clear) out.push([c, r]);
440
+ }
441
+ if (out.length < 2 * BQR_CODED_BITS) throw new Error("B-QR: this code is too coarse for coded modules.");
442
+ return out.slice(0, 2 * BQR_CODED_BITS);
443
+ }
444
+ /** A drawn cell as the DECODER sees it (the code's own upright grid), for reading coded modules back from a photo of the drawing. */
445
+ export const bqrUpright = (n: number, [c, r]: readonly [number, number]): [number, number] => [n - 1 - r, c];
446
+
417
447
  // ---- drawing ------------------------------------------------------------------------------------------------------------------------
418
448
 
419
449
  /** Where the emblem lands in a `size` square at (x, y): canvas px = t + k · viewBox units. ⭐ Centres the PAINTED bbox, never the viewBox. */
@@ -433,6 +463,7 @@ export function paintBqr(g: CanvasRenderingContext2D, upright: BqrMatrix, seed:
433
463
  const inkOfHue = o.owner !== undefined ? bqrOwnerInk(o.owner) : o.hue ? bqrInkFor(o.hue) : BQR_INK;
434
464
  const X = o.x ?? 0, Y = o.y ?? 0, size = o.size, accent = o.accent || inkOfHue;
435
465
  if (o.autograph !== undefined && (bqrStyleOf(o.style) !== "outline" || !isAutograph(o.autograph))) throw new Error("B-QR: an autograph is drawn in the `outline` version (the Open B-QR) only, from a person's own strokes.");
466
+ if (o.coded !== undefined && (bqrStyleOf(o.style) !== "outline" || o.coded.length !== BQR_CODED_BITS || !o.coded.every((b) => b === 0 || b === 1))) throw new Error("B-QR: coded modules are 96 bits in the `outline` version (the Open B-QR) only.");
436
467
  const lobe: BqrLobe = o.autograph ? "none" : o.lobe ?? BQR_LOBE_DEFAULT;
437
468
  const L = bqrLayout(mat, seed, { style: o.style, quiet: o.quiet, lobe });
438
469
  const { k, tx, ty } = bqrPlacement(size, X, Y);
@@ -454,9 +485,11 @@ export function paintBqr(g: CanvasRenderingContext2D, upright: BqrMatrix, seed:
454
485
  // The outline.
455
486
  // ⭐ §4Z — `outline` (Version 2) draws this wider, over a heart left white (§4AA: six times as wide).
456
487
  g.strokeStyle = accent; g.lineWidth = L.outline; g.lineJoin = "round"; g.stroke(path);
488
+ // ⭐ v1.10.0 — the top lobe's coded modules, each bit twice, dots as the decoration's own.
489
+ if (o.coded) { g.fillStyle = accent; bqrLobeCells(mat, { style: "outline" }).forEach(([c, r], i) => { if (o.coded![i % BQR_CODED_BITS]) g.fillRect(L.ox + c * L.m + inset, L.oy + r * L.m + inset, d, d); }); }
457
490
  // ⭐ v1.9.0 — the bottom lobe, in the code's own ink.
458
- if (o.autograph) drawAutograph(g, o.autograph, accent, o.clipAutograph !== false);
459
- else if (lobe === "tm") { g.fillStyle = accent; drawTm(g); }
491
+ if (o.autograph) drawAutograph(g, o.autograph, accent, o.fitAutograph !== false);
492
+ else if (lobe === "tm") { g.fillStyle = accent; drawTm(g, bqrStyleOf(o.style)); }
460
493
  g.restore();
461
494
 
462
495
  // ⭐ The code, in DEVICE pixels with every edge rounded, one rect per run — scaled sub-pixel rects leave hairline seams