@333eco/brand 1.8.0 → 1.9.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
@@ -135,6 +135,12 @@ an H3QR names whom you thank, and a B-QR is how that code is drawn.
135
135
  draws the green byte for byte, so Shops moves nothing. ⛔ `"H3"` alone, an unknown owner, or `owner` with `hue` THROWS — a
136
136
  product inherits its body's color and cannot pick one. Semantics in `data/bodies.json` (no hexes); sources in `BQR_OWNER_HUES`;
137
137
  pre-registered and decoded before it shipped (`bqr.test.mjs` §body-palette). ⚠️ It says BELONGING, never authenticity.
138
+ - **Turned, with a small ™ (v1.9.0, founder 2026-11-24).** The code is drawn turned a quarter counterclockwise, so its middle position
139
+ marker stands at the heart's point and its three markers mirror about the heart's own line (`bqrTurned`; always, no option). It
140
+ shipped by the founder's override of a failed scan gate, kept on the record in `scripts/bqr.test.mjs` §turn. A small ™ stands in the
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
+ strokes, *Open* only, ⛔ throws in *Full*) are for a person's own picture. The other three positions mean nothing yet, so ⛔ nothing is
143
+ drawn in one, and the top lobe keeps its dots. Codes printed before keep working.
138
144
  - **The card's words are PLACED, never aligned (v1.6.1).** `paintQrCard` measures each line, shrinks its size until it fits,
139
145
  and draws it from the left at the center minus half its width. Safari on iOS 26 ignores `textAlign = "center"` and the
140
146
  `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.8.0",
2
+ "version": "1.9.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": "af1b66b7cffc1683a48f85c9ad4417acfbbedfbaa61e775672399e7c8c0a04d3"
14
+ "qr/bqr.ts": "82ae72c931f3e5453038625c2a37a4ff1928bcf5274891de3c68d53c0d477512"
15
15
  }
16
16
  }
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.8.0",
11
+ "version": "1.9.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.8.0"
21
+ const val VERSION = "1.9.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.8.0"
17
+ public static let version = "1.9.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.8.0",
3
+ "version": "1.9.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.8.0",
3
+ "version": "1.9.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
@@ -35,6 +35,9 @@
35
35
  * chosen by a rule written into the test BEFORE its sweep ran: the LIGHTEST candidate that prints at ISO/IEC 15415
36
36
  * symbol-contrast grade A (Rpaper 0.85 − Rink ≥ 0.70) and decodes no worse than the old near-black by more than 2 of 90 cases on two
37
37
  * independent decoders. The prediction (#106430) was wrong and the rule's pick was kept — ⛔ never move the rule to a preferred shade.
38
+ * ⭐ ONE MIRROR LINE (v1.9.0, founder 2026-11-23): the code is drawn turned a quarter counterclockwise (`bqrTurned`), so its middle
39
+ * position marker stands at the heart's point and its three markers mirror about the heart's own line. Measured in §turn; nothing
40
+ * printed before is reprinted (a code reads at any angle).
38
41
  * ⭐ DETERMINISTIC: the decoration is seeded from a hash of the text, so the same address always draws the same picture and the preview
39
42
  * a person sees is the card they download.
40
43
  *
@@ -55,6 +58,34 @@ export const BQR_BODY = { x: 4.0588, y: 8.5913, s: 11.35 } as const;
55
58
  export const BQR_QUIET = 4;
56
59
  /** ⭐ §4Z — `pixels`: clear modules left between the code and the decoration. ⛔ Never 0 (the measured failure). */
57
60
  export const BQR_FILL_RING = 1;
61
+ /**
62
+ * ⭐ v1.9.0 (founder 2026-11-24) — the BOTTOM LOBE. Every B-QR of ours carries a small ™ there: it names the B-Emblem™, this drawing (⛔ never
63
+ * "B-QR", which stays unmarked), and shows which way is up. `none` leaves the lobe as it was; `autograph` (below) draws a person's own
64
+ * hand instead. Both are for a person's OWN picture, where a ™ would read as a claim on their work. The TOP lobe keeps its dots.
65
+ */
66
+ export type BqrLobe = "tm" | "none";
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;
70
+ 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;
75
+ /** 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
+ export interface BqrAutograph { strokes: readonly (readonly (readonly [number, number])[])[] }
77
+ export const BQR_PAD_W = 100, BQR_PAD_H = 60, BQR_AUTOGRAPH_PEN = 3, BQR_AUTOGRAPH_POINTS = 4000;
78
+ /** True for something that can be drawn as an autograph. */
79
+ export function isAutograph(a: unknown): a is BqrAutograph {
80
+ const s = (a as BqrAutograph | null)?.strokes;
81
+ if (!Array.isArray(s) || !s.length || s.length > 200) return false;
82
+ let n = 0;
83
+ for (const k of s) {
84
+ if (!Array.isArray(k) || !k.length) return false;
85
+ for (const p of k) { if (!Array.isArray(p) || p.length !== 2 || !Number.isFinite(p[0]) || !Number.isFinite(p[1]) || ++n > BQR_AUTOGRAPH_POINTS) return false; }
86
+ }
87
+ return true;
88
+ }
58
89
 
59
90
  /** ⭐ §4Z — the two versions, by internal name. ⛔ Neither name is ever shown: a person sees two pictures and two plain words. */
60
91
  export type BqrStyle = "pixels" | "outline";
@@ -211,6 +242,14 @@ export interface BqrOptions {
211
242
  quiet?: number;
212
243
  /** ⛔ TEST ONLY — the code's colour, for the ink sweep that chose `BQR_INK`. ⛔ Never a theme's colour. */
213
244
  ink?: string;
245
+ /** ⭐ v1.9.0 — the bottom lobe: the ™ (default), or nothing in a person's own picture. */
246
+ lobe?: BqrLobe;
247
+ /** ⭐ v1.9.0 — a person's autograph in the bottom lobe, in the `outline` version only (⛔ throws in `pixels`); it replaces the ™. */
248
+ autograph?: BqrAutograph;
249
+ /** ⛔ TEST ONLY — `false` lets an autograph leave its box, for the check that must see it. */
250
+ clipAutograph?: boolean;
251
+ /** ⛔ TEST ONLY — `false` draws the code upright, the drawing before v1.9.0 (`scripts/bqr.test.mjs` §turn, the baseline). */
252
+ turn?: boolean;
214
253
  /** ⭐ v1.6.0 — the drawing's color family, drawn at `BQR_INK`'s darkness (`bqrInkFor`). Default: `BQR_INK` itself.
215
254
  * ⛔ Products pass `owner`, never `hue`; `hue` is for the brand page following a visitor's `--emblem`. */
216
255
  hue?: string;
@@ -298,12 +337,53 @@ function stream(seed: string): () => number {
298
337
  };
299
338
  }
300
339
 
340
+ /** 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;
344
+ return (nx / rx) ** 2 + (ny / ry) ** 2 < 1;
345
+ }
346
+ /** 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;
349
+ g.fillRect(b.x, y, w, t); g.fillRect(b.x + w / 2 - t / 2, y, t, h);
350
+ 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
+ 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
+ g.closePath(); g.fill();
353
+ }
354
+ /** 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;
357
+ 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";
361
+ 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; }
363
+ g.beginPath(); g.moveTo(s[0][0], s[0][1]);
364
+ 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
+ g.lineTo(s[s.length - 1][0], s[s.length - 1][1]); g.stroke();
366
+ }
367
+ g.restore();
368
+ }
369
+
370
+ /**
371
+ * ⭐ v1.9.0 (founder 2026-11-23) — the code turned a quarter COUNTERCLOCKWISE, so its middle position marker stands at the heart's point.
372
+ * The emblem mirrors about one line, point to notch; a code's three markers mirror about one line too, through the middle one. Upright
373
+ * the two lines cross; turned, they are the same line. Decoders read a code at any angle, so nothing printed before stops working.
374
+ */
375
+ export function bqrTurned(mat: BqrMatrix): BqrMatrix {
376
+ const n = mat.size, data = new Uint8Array(n * n);
377
+ for (let r = 0; r < n; r++) for (let c = 0; c < n; c++) data[r * n + c] = mat.data[c * n + (n - 1 - r)] ? 1 : 0;
378
+ return { size: n, data };
379
+ }
380
+
301
381
  /**
302
382
  * Where everything goes, in viewBox units. The module grid is the code's own, extended over the whole emblem; a decorative cell
303
383
  * is a candidate when it lies outside the code's quiet box AND its dot clears the outline; it is dark by the seeded stream unless
304
384
  * that would make a third dark cell in a row or a column.
305
385
  */
306
- export function bqrLayout(mat: BqrMatrix, seed: string, o: { style?: BqrStyle; quiet?: number } = {}): BqrLayout {
386
+ export function bqrLayout(mat: BqrMatrix, seed: string, o: { style?: BqrStyle; quiet?: number; lobe?: BqrLobe } = {}): BqrLayout {
307
387
  const style = bqrStyleOf(o.style), G = BQR_GEOMETRY[style];
308
388
  const quiet = o.quiet ?? G.ring;
309
389
  const n = mat.size;
@@ -315,7 +395,7 @@ export function bqrLayout(mat: BqrMatrix, seed: string, o: { style?: BqrStyle; q
315
395
  const c0 = Math.floor((EMBLEM_BOX.x - ox) / m) - 1, c1 = Math.ceil((EMBLEM_BOX.x + EMBLEM_BOX.w - ox) / m) + 1;
316
396
  const r0 = Math.floor((EMBLEM_BOX.y - oy) / m) - 1, r1 = Math.ceil((EMBLEM_BOX.y + EMBLEM_BOX.h - oy) / m) + 1;
317
397
  const clear = (DOT / 2) * m * Math.SQRT2 + G.outline / 2 + 0.15 * m;
318
- const rand = stream(seed);
398
+ const rand = stream(seed), sign = (o.lobe ?? BQR_LOBE_DEFAULT) === "tm";
319
399
  const dark = new Set<string>();
320
400
  const deco: [number, number][] = [];
321
401
  const on = (c: number, r: number) => dark.has(`${c},${r}`);
@@ -326,7 +406,10 @@ export function bqrLayout(mat: BqrMatrix, seed: string, o: { style?: BqrStyle; q
326
406
  if (!insideEmblem(cx, cy) || edgeDistance(cx, cy) < clear) continue;
327
407
  if (p >= DENSITY) continue;
328
408
  if ((on(c - 1, r) && on(c - 2, r)) || (on(c, r - 1) && on(c, r - 2))) continue; // ⛔ never three in a run
329
- dark.add(`${c},${r}`); deco.push([c, r]);
409
+ dark.add(`${c},${r}`);
410
+ // ⭐ 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;
412
+ deco.push([c, r]);
330
413
  }
331
414
  return { n, m, ox, oy, deco, style, outline: G.outline };
332
415
  }
@@ -340,14 +423,18 @@ export function bqrPlacement(size: number, x = 0, y = 0): { k: number; tx: numbe
340
423
  }
341
424
 
342
425
  /** Paint a B-QR from a module matrix into a 2D context. Synchronous; `drawBqr` makes the matrix. */
343
- export function paintBqr(g: CanvasRenderingContext2D, mat: BqrMatrix, seed: string, o: BqrOptions): void {
426
+ export function paintBqr(g: CanvasRenderingContext2D, upright: BqrMatrix, seed: string, o: BqrOptions): void {
427
+ // ⭐ v1.9.0 — always turned: one drawing, whoever asks. The layout is the grid's, so the decoration and the outline do not move.
428
+ const mat = o.turn === false ? upright : bqrTurned(upright);
344
429
  // ⭐ §4AA — one green for the whole drawing: the decoration and the outline default to the code's own ink.
345
430
  // ⭐ v1.6.0 — `hue` sets the code, the decoration and the outline at once, darkened by `bqrInkFor`; none = `BQR_INK`, verbatim.
346
431
  // ⭐ v1.7.0 — `owner` sets it from the body palette instead; ⛔ both at once throws (a product cannot pick its own color).
347
432
  if (o.owner !== undefined && o.hue !== undefined) throw new Error("B-QR: pass `owner` or `hue`, never both — a product's code takes its body's color.");
348
433
  const inkOfHue = o.owner !== undefined ? bqrOwnerInk(o.owner) : o.hue ? bqrInkFor(o.hue) : BQR_INK;
349
434
  const X = o.x ?? 0, Y = o.y ?? 0, size = o.size, accent = o.accent || inkOfHue;
350
- const L = bqrLayout(mat, seed, { style: o.style, quiet: o.quiet });
435
+ 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.");
436
+ const lobe: BqrLobe = o.autograph ? "none" : o.lobe ?? BQR_LOBE_DEFAULT;
437
+ const L = bqrLayout(mat, seed, { style: o.style, quiet: o.quiet, lobe });
351
438
  const { k, tx, ty } = bqrPlacement(size, X, Y);
352
439
  const path = new Path2D(EMBLEM_D);
353
440
  const ground = bqrGroundOf(o.ground);
@@ -367,6 +454,9 @@ export function paintBqr(g: CanvasRenderingContext2D, mat: BqrMatrix, seed: stri
367
454
  // The outline.
368
455
  // ⭐ §4Z — `outline` (Version 2) draws this wider, over a heart left white (§4AA: six times as wide).
369
456
  g.strokeStyle = accent; g.lineWidth = L.outline; g.lineJoin = "round"; g.stroke(path);
457
+ // ⭐ 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); }
370
460
  g.restore();
371
461
 
372
462
  // ⭐ The code, in DEVICE pixels with every edge rounded, one rect per run — scaled sub-pixel rects leave hairline seams
@@ -394,11 +484,11 @@ export async function drawBqr(g: CanvasRenderingContext2D, text: string, o: BqrO
394
484
  }
395
485
 
396
486
  /** A B-QR as a PNG data URL — the on-screen preview of a code a person may also download, so what they see is what they print. */
397
- export async function bqrDataUrl(text: string, o: { size?: number; accent?: string; ecc?: "L" | "M" | "Q" | "H"; style?: BqrStyle; ground?: BqrGround; hue?: string; owner?: BqrOwner } = {}): Promise<string> {
487
+ export async function bqrDataUrl(text: string, o: { size?: number; accent?: string; ecc?: "L" | "M" | "Q" | "H"; style?: BqrStyle; ground?: BqrGround; hue?: string; owner?: BqrOwner; lobe?: BqrLobe; autograph?: BqrAutograph } = {}): Promise<string> {
398
488
  const size = o.size ?? 640;
399
489
  const canvas = document.createElement("canvas");
400
490
  canvas.width = size; canvas.height = size;
401
491
  // ⛔ v1.5.0 — `ground: "heart"` only for a picture that stays on screen; a URL handed to a download takes the default `paper`.
402
- await drawBqr(canvas.getContext("2d")!, text, { size, accent: o.accent, ecc: o.ecc, style: o.style, ground: o.ground, hue: o.hue, owner: o.owner });
492
+ await drawBqr(canvas.getContext("2d")!, text, { size, accent: o.accent, ecc: o.ecc, style: o.style, ground: o.ground, hue: o.hue, owner: o.owner, lobe: o.lobe, autograph: o.autograph });
403
493
  return canvas.toDataURL("image/png");
404
494
  }