@gemboss/ui 0.63.0 → 0.64.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.
@@ -67,8 +67,15 @@ export interface GemActivity {
67
67
  /** draft: a section this turn is adding (an `add` op), not on the page yet. Optional, so a v1 reader that never says it still
68
68
  * reads as v1; a page built from scratch stacks these one below the other. */
69
69
  created?: true;
70
+ /** Where the work is, by trade: how much of what this step touched or found is words, layout, pictures, buttons, the look, or a
71
+ * check (the reader's count of an edit's fields or a check's findings). The crew follows it: the trades with the most work walk
72
+ * beside Gem and say what they fix. Optional, so a v1 reader that never says it still reads as v1. */
73
+ trades?: Partial<Record<GemTrade, number>>;
70
74
  }
71
75
 
76
+ /** The crew's trades, as an activity names them (`trades`). */
77
+ export type GemTrade = "copy" | "layout" | "image" | "cro" | "check" | "style";
78
+
72
79
  /** Where a target was drawn: the block it names, its section, the place after a section (a section on its way), or the page. */
73
80
  export type GemAtWorkLevel = "element" | "section" | "after" | "page";
74
81
 
@@ -140,6 +147,12 @@ const ALONGSIDE: Record<Role, Role[]> = {
140
147
  lead: ["copy", "layout"], copy: ["layout", "check"], layout: ["style", "check"], image: ["style", "layout"], cro: ["copy", "check"], check: ["layout", "style"], style: ["layout", "image"],
141
148
  };
142
149
  const BESIDE: Record<Role, string> = { lead: "working", copy: "reading", layout: "arranging", image: "looking", cro: "optimizing", check: "auto-checking", style: "tuning" };
150
+ /** WHERE THE WORK IS, THE CREW IS (Chris 06/11: "vấn đề ở đâu nhiều thì con trỏ liên quan hoạt động nhiều hơn"). Each trade an
151
+ * activity names (`trades`) warms up by its count and cools by half every HEAT_HALF_MS; one at least HEAT_MIN warm comes beside
152
+ * the work ahead of the usual pair, walks more often, and says what it fixes. */
153
+ const HEAT_HALF_MS = 45_000;
154
+ const HEAT_MIN = 0.75;
155
+ const FIXING: Record<Role, string> = { lead: "working", copy: "fixing the words", layout: "fixing the layout", image: "fixing the pictures", cro: "fixing the buttons", check: "checking again", style: "fixing the look" };
143
156
  /** The crew walks this long after Gem last said anything; past it a turn has gone silent (a tab left open), and it stands. */
144
157
  const STROLL_MS = 360_000;
145
158
  /** Quiet this long and Gem's tag counts the step's seconds. */
@@ -289,6 +302,8 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
289
302
  let beside: Member[] = [];
290
303
  let beat = 0;
291
304
  const walked = new Map<Member, number>();
305
+ /** How much work each trade has had lately (activities' `trades`), cooling by half every HEAT_HALF_MS. */
306
+ const heat = new Map<Role, { v: number; at: number }>();
292
307
  /** The one at work on the stage now, and QA while it rides a sweep to its end. */
293
308
  let atWork: Member | undefined;
294
309
  let riding: Member | null = null;
@@ -409,6 +424,26 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
409
424
  return crew;
410
425
  }
411
426
  function say(m: Member, doing?: string) { m.tag.textContent = m.role === "lead" && !doing ? m.name : `${m.name} · ${doing ?? m.doing}`; }
427
+ /** How much work a trade has had lately, as of now. */
428
+ function heatOf(role: Role, t = now()): number {
429
+ const h = heat.get(role);
430
+ return h ? h.v * 0.5 ** ((t - h.at) / HEAT_HALF_MS) : 0;
431
+ }
432
+ /** The trades warm enough to come beside the work, the warmest first. */
433
+ function hottest(): Role[] {
434
+ const t = now();
435
+ return CREW.map((c) => c.role).filter((r) => r !== "lead" && heatOf(r, t) >= HEAT_MIN).sort((a, b) => heatOf(b, t) - heatOf(a, t));
436
+ }
437
+ /** What a step says of where its work is (`trades`), counted as it is drawn: at most 5 a step, so one long edit does not hold it. */
438
+ function warm(a: GemActivity) {
439
+ if (!a.trades || typeof a.trades !== "object") return;
440
+ const t = now();
441
+ for (const [trade, n] of Object.entries(a.trades)) {
442
+ const role = trade as Role;
443
+ if (role === "lead" || !(role in BESIDE) || typeof n !== "number" || !(n > 0)) continue;
444
+ heat.set(role, { v: heatOf(role, t) + Math.min(5, n), at: t });
445
+ }
446
+ }
412
447
  /** The one whose trade this is, now at work (named, at full strength); Gem with a crew of one. */
413
448
  function who(role: Role): Member | undefined {
414
449
  const c = arrive(), m = c.find((x) => x.role === role) ?? c[0];
@@ -444,14 +479,19 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
444
479
  function onStage(r: Box, doer: Member | undefined, alongside = true) {
445
480
  stage = r;
446
481
  atWork = doer;
447
- const key = `${Math.round(r.x)}|${Math.round(r.y)}|${Math.round(r.w)}|${doer?.role ?? ""}|${alongside}`;
482
+ // The trades with the most work lately come first; the usual pair beside the one at work fills the rest.
483
+ const hot = hottest();
484
+ // Four on the page at most: QA riding a sweep is one of the two.
485
+ const pair = riding && riding !== doer ? 1 : 2;
486
+ const key = `${Math.round(r.x)}|${Math.round(r.y)}|${Math.round(r.w)}|${doer?.role ?? ""}|${alongside}|${hot.slice(0, 2).join(",")}|${pair}`;
448
487
  if (key === stageKey || !crew.length) return;
449
488
  stageKey = key;
450
- beside = alongside ? ALONGSIDE[doer?.role ?? "lead"].map((role) => crew.find((m) => m.role === role)).filter((m): m is Member => !!m && m !== doer && m.role !== "lead" && !onBlock.has(m)) : [];
489
+ beside = alongside ? [...new Set([...hot, ...ALONGSIDE[doer?.role ?? "lead"]])].map((role) => crew.find((m) => m.role === role))
490
+ .filter((m): m is Member => !!m && m !== doer && m !== riding && m.role !== "lead" && !onBlock.has(m)).slice(0, pair) : [];
451
491
  for (const m of crew) if (m.role !== "lead" && m !== doer && m !== riding && !onBlock.has(m) && !beside.includes(m)) rest(m);
452
492
  beside.forEach((m, i) => {
453
493
  const p = waypoint(i, walked.get(m) ?? 0);
454
- say(m, BESIDE[m.role]);
494
+ say(m, heatOf(m.role) >= HEAT_MIN ? FIXING[m.role] : BESIDE[m.role]);
455
495
  if (m.resting) { m.anim?.cancel(); m.x = p.x; m.y = p.y; m.el.style.transform = `translate(${p.x}px,${p.y}px)`; wake(m); } else travel(m, p.x, p.y, 600);
456
496
  });
457
497
  const lead = crew.find((m) => m.role === "lead");
@@ -473,7 +513,9 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
473
513
  function strollNext() {
474
514
  if (!stage) return;
475
515
  const lead = crew.find((m) => m.role === "lead");
476
- const walkers = [...beside.filter((m) => !m.resting && !onBlock.has(m)), ...(lead ? [lead] : [])];
516
+ // A trade with more work lately takes more of the beats (up to three turns to Gem's one).
517
+ const walkers = [...beside.filter((m) => !m.resting && !onBlock.has(m)), ...(lead ? [lead] : [])]
518
+ .flatMap((w) => Array<Member>(1 + Math.min(2, Math.floor(heatOf(w.role)))).fill(w));
477
519
  beat += 1;
478
520
  const m = walkers[beat % Math.max(1, walkers.length)];
479
521
  if (!m || onBlock.has(m)) return;
@@ -1030,6 +1072,7 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
1030
1072
 
1031
1073
  function play(a: GemActivity) {
1032
1074
  try {
1075
+ warm(a);
1033
1076
  cut();
1034
1077
  if (a.kind !== "land") showSkip();
1035
1078
  switch (a.kind) {
@@ -1046,6 +1089,9 @@ export function createGemAtWork(options: GemAtWorkOptions = {}): GemAtWork {
1046
1089
  case "fail": settle(a, "is-failed"); options.onStatus?.(a.text ?? a.label); break;
1047
1090
  case "land": land(a); break;
1048
1091
  }
1092
+ // A check, a save or a refusal that says where the work is changes who walks beside it now (the others move the stage
1093
+ // themselves; while a section is built its blocks have their own hands).
1094
+ if (a.trades && stage && !revealing && (a.kind === "check" || a.kind === "apply" || a.kind === "fail")) onStage(stage, atWork);
1049
1095
  } catch {
1050
1096
  // The bottom of the ladder: the page as it is.
1051
1097
  options.onFallback?.("page", a);
package/src/index.ts CHANGED
@@ -74,11 +74,12 @@ export { SaveBar, type SaveBarProps } from "./save-bar";
74
74
  export { RangeBar, rangeBarGeometry, type RangeBarGeometry, type RangeBarProps } from "./range-bar";
75
75
  export { ProgressRing, progressRingGeometry, RING_BOX, type ProgressRingGeometry, type ProgressRingProps } from "./progress-ring";
76
76
  export { ProgressBar, progressBarValue, type ProgressBarProps, type ProgressBarTone } from "./progress-bar";
77
+ export { AudiencesTable, AudienceSourceChip, AUDIENCES_TABLE_LABELS, audienceCount, audienceDeltaTone, audiencesTableColumns, audiencesTableRows, type AudienceDeltaTone, type AudienceSource, type AudiencesTableLabels, type AudiencesTableProps, type AudiencesTableRow } from "./audiences-table";
77
78
  export { SpotArt, SPOT_ART_NAMES, type SpotArtName, type SpotArtProps } from "./spot-art";
78
79
  // 04/11/2026 (UI book OF-2): the drawn strip across the top of a "pick a kind" card, the New offer picker's first.
79
80
  export { KindArt, KIND_GLYPHS, type KindArtProps, type KindGlyph } from "./kind-art";
80
81
  // 05/11/2026 (ADR 0013): Gem at work, what Gem is doing drawn on the page it is doing it to; it reads only the activity contract.
81
- export { createGemAtWork, GEM_ACTIVITY_VERSION, type GemActivity, type GemActivityKind, type GemActivityScope, type GemActivityTarget, type GemAtWork, type GemAtWorkLevel, type GemAtWorkOptions } from "./gem-at-work";
82
+ export { createGemAtWork, GEM_ACTIVITY_VERSION, type GemActivity, type GemActivityKind, type GemActivityScope, type GemActivityTarget, type GemAtWork, type GemAtWorkLevel, type GemAtWorkOptions, type GemTrade } from "./gem-at-work";
82
83
  export { Stage, StageBubble, StageLine, StageTile, StageWindow, type StageTone } from "./stage";
83
84
  export { GemHolo } from "./gem-holo";
84
85
  export { StartingPoint, type StartingArt, type StartingDoor } from "./starting-point";
@@ -1 +1 @@
1
- .ui-skillfb__bar{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.ui-skillfb__act{margin-left:auto}.ui-skillfb__head{display:flex;flex-wrap:wrap;align-items:baseline;gap:8px;margin:8px 0 0;font-size:13px;font-weight:600}.ui-skillfb__list{list-style:none;margin:0;padding:0;display:grid;gap:8px}.ui-skillfb__row{display:grid;gap:4px;padding:12px;border:1px solid var(--gemboss-divider, #e3e3e3);border-radius:12px}.ui-skillfb__meta{display:flex;flex-wrap:wrap;align-items:center;gap:6px;font-size:13px}.ui-skillfb__aside{margin-left:auto;display:inline-flex;flex-wrap:wrap;align-items:center;gap:6px}.ui-skillfb__quote{margin:0;padding-left:8px;border-left:3px solid var(--gemboss-warning-border, #f5d569);font-size:12px;color:var(--gemboss-text-muted, #686b71)}.ui-skillfb__body{margin:0;font-size:13px;line-height:20px;white-space:pre-wrap;overflow-wrap:anywhere}.ui-skillfb__fine{margin:0;font-size:12px;color:var(--gemboss-text-muted, #686b71)}
1
+ .ui-skillfb__bar{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.ui-skillfb__act{margin-left:auto}.ui-skillfb__head{display:flex;flex-wrap:wrap;align-items:baseline;gap:8px;margin:8px 0 0;font-size:13px;font-weight:600}.ui-skillfb__list{list-style:none;margin:0;padding:0;display:grid;gap:8px}.ui-skillfb__row{display:grid;gap:4px;padding:12px;border:1px solid var(--gemboss-divider, #e3e3e3);border-radius:12px}.ui-skillfb__meta{display:flex;flex-wrap:wrap;align-items:center;gap:6px;font-size:13px}.ui-skillfb__when{display:inline-flex;flex-wrap:wrap;align-items:center;gap:6px;font-size:12px;color:var(--gemboss-text-muted, #686b71)}.ui-skillfb__aside{margin-left:auto;display:inline-flex;flex-wrap:wrap;align-items:center;gap:6px}.ui-skillfb__quote{margin:0;padding-left:8px;border-left:3px solid var(--gemboss-warning-border, #f5d569);font-size:12px;color:var(--gemboss-text-muted, #686b71)}.ui-skillfb__body{margin:0;font-size:13px;line-height:20px;white-space:pre-wrap;overflow-wrap:anywhere}.ui-skillfb__fine{margin:0;font-size:12px;color:var(--gemboss-text-muted, #686b71)}
@@ -4,7 +4,7 @@
4
4
  * on and marked Used once a version took it in) and GemBoss's runs to look at (Assistant › Skills › History, S3: a run that was blocked,
5
5
  * stopped or failed, the team's note on it, "Used in v4" once a published proposal answered it) are the same row:
6
6
  *
7
- * badges + who ........................................ aside (Used · Undo, or Improve with Gem)
7
+ * badges + who + when ................................. aside (Used · Undo, or Improve with Gem)
8
8
  * a quote (the words the comment is about)
9
9
  * the body (the comment, the note)
10
10
  * fine print (the article, the store · when · engine)
@@ -22,6 +22,9 @@ export interface SkillFeedbackRow {
22
22
  badges?: ReactNode;
23
23
  /** Who or what it is from, in bold after the chips ("Lily", "by H1 · Nothing the store cannot prove"). */
24
24
  who?: ReactNode;
25
+ /** Right after who, in the quiet small type: when it was left, and its state (Fixed, Resolved). Not bold, unlike who (0.64.0;
26
+ * content-radar had put them inside the name). */
27
+ when?: ReactNode;
25
28
  /** At the row's end: Used and its Undo, or the act that answers it. */
26
29
  aside?: ReactNode;
27
30
  quote?: ReactNode;
@@ -40,6 +43,7 @@ export function SkillFeedbackList({ rows, label }: { rows: readonly SkillFeedbac
40
43
  <div className="ui-skillfb__meta">
41
44
  {r.badges}
42
45
  {r.who ? <b>{r.who}</b> : null}
46
+ {r.when ? <span className="ui-skillfb__when">{r.when}</span> : null}
43
47
  {r.aside ? <span className="ui-skillfb__aside">{r.aside}</span> : null}
44
48
  </div>
45
49
  {r.quote ? <p className="ui-skillfb__quote">{r.quote}</p> : null}
@@ -60,7 +60,8 @@ export interface SkillVersionRow {
60
60
  * not record it, content-radar's shared files): no badge. */
61
61
  source?: string;
62
62
  meta?: string;
63
- note?: string | null;
63
+ /** Its note, phrasing content (text, or a <span> per line: content-radar adds what the version changed). 0.64.0: a node. */
64
+ note?: ReactNode;
64
65
  actions?: ReactNode;
65
66
  /** An opened View or Compare under the row. */
66
67
  children?: ReactNode;