Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

blog scene kit: long compare cells shrink to fit instead of being cut

chaitanyagirie1f88276f0fc
diff --git a/blog/MG_KIT.md b/blog/MG_KIT.md
index e2552591..286a5a05 100644
--- a/blog/MG_KIT.md
+++ b/blog/MG_KIT.md
@@ -51,7 +51,7 @@ Every scene takes `kicker` (the yellow chip) and `title`. `host` is a cast name;
| `title` | `title` (up to 3 lines of 27 characters), `sub`, `cast: [names]` (2 or 3, default Michael and Jim), `say` (first cast member, under 40 characters) | Nothing to tap, no hint |
| `stage` | `script: [{ who, say, point, carry }]`, optional `board: { label, lines }`. Up to 5 script lines. A board holds 4 lines of 43 characters; with a board, keep each `say` under 68 characters (two bubble lines) so it stays below the board. `point`: left, right, up-left, up-right, raise. `carry`: a short sign held at the chest | Tap a character to hear the line again |
| `price-ladder` | `prefix`, `suffix`, `items: [{ label, value, display, note, highlight }]`, up to 6 | Tap or hover a step for its note |
-| `compare` | `cols: [a, b]`, `pick` (0 or 1), `rows: [{ label, a, b, win, note }]`, up to 5. `win` is "a", "b" or "" | Tap a row for its note |
+| `compare` | `cols: [a, b]`, `pick` (0 or 1), `rows: [{ label, a, b, win, note }]`, up to 5. `win` is "a", "b" or "". A cell fits about 17 characters at full size (15 with a tick); longer cells shrink to fit and are cut at 30 | Tap a row for its note |
| `timeline` | `events: [{ when, label, note }]`, up to 6 | Tap a date; the host walks to it |
| `flow` | `nodes: [{ label, note }]`, up to 8 (5 or more wrap to two rows), `labels: [text on arrow i]`, each up to 16 characters, drawn as a tag above the arrow | Tap a step or use arrow keys |
| `before-after` | `before: { label, lines }`, `after: { label, lines }` | Tap the card to flip it |
diff --git a/blog/src/assets/mg/demo.html b/blog/src/assets/mg/demo.html
index 8ab5f421..02e9d9ec 100644
--- a/blog/src/assets/mg/demo.html
+++ b/blog/src/assets/mg/demo.html
@@ -30,7 +30,7 @@
<figure class="mg" data-scene="price-ladder"><img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" width="1600" height="900" alt="Animation. Four price steps rise from Free to Team while Kevin points at them."><script type="application/json">{"kicker":"Sample prices","title":"What each plan costs a month","prefix":"$","items":[{"label":"Free","value":0,"display":"Free","note":"Free covers one agent."},{"label":"Solo","value":12,"note":"Solo adds five agents."},{"label":"Pro","value":20,"highlight":true,"note":"Pro is the one most people pick."},{"label":"Team","value":45,"note":"Team is per seat."}],"host":"kevin","say":"Pro is the sweet spot."}</script><figcaption>price-ladder: tap a step for its note.</figcaption></figure>
<h2>compare</h2>
-<figure class="mg" data-scene="compare"><img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" width="1600" height="900" alt="Animation. A table compares Tool A and Tool B on four rows and Oscar gives the verdict."><script type="application/json">{"kicker":"Sample compare","title":"Tool A against Tool B","cols":["Tool A","Tool B"],"pick":1,"rows":[{"label":"Price","a":"$20 a month","b":"Free","win":"b","note":"Checked on both pricing pages."},{"label":"Open source","a":"No","b":"Yes","win":"b"},{"label":"Runs offline","a":"Yes","b":"Yes","win":"","note":"A tie. Both run on your machine."},{"label":"Setup time","a":"2 minutes","b":"10 minutes","win":"a"}],"host":"oscar","say":"Tool B wins three of four."}</script><figcaption>compare: tap a row and Oscar checks it.</figcaption></figure>
+<figure class="mg" data-scene="compare"><img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" width="1600" height="900" alt="Animation. A table compares Tool A and Tool B on four rows and Oscar gives the verdict."><script type="application/json">{"kicker":"Sample compare","title":"Tool A against Tool B","cols":["Tool A","Tool B"],"pick":1,"rows":[{"label":"Price","a":"$20 a month","b":"Free","win":"b","note":"Checked on both pricing pages."},{"label":"Import your setup","a":"By hand","b":"hermes claw migrate","win":"b"},{"label":"Runs offline","a":"Yes","b":"Yes","win":"","note":"A tie. Both run on your machine."},{"label":"Setup time","a":"2 minutes","b":"10 minutes","win":"a"}],"host":"oscar","say":"Tool B wins three of four."}</script><figcaption>compare: tap a row and Oscar checks it.</figcaption></figure>
<h2>timeline</h2>
<figure class="mg" data-scene="timeline"><img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" width="1600" height="900" alt="Animation. Jim walks along a timeline of four dates and says what happened at each."><script type="application/json">{"kicker":"Sample timeline","title":"How the release went","events":[{"when":"May","label":"First build","note":"One agent, one desk."},{"when":"July","label":"Open source","note":"The repo went public."},{"when":"Sept","label":"Pro","note":"The paid plan shipped."},{"when":"Oct","label":"Halloween","note":"Everyone got a costume."}],"host":"jim"}</script><figcaption>timeline: tap a date and Jim walks to it.</figcaption></figure>
diff --git a/blog/src/assets/mg/kit.js b/blog/src/assets/mg/kit.js
index 4d4c6e32..6d6a8809 100644
--- a/blog/src/assets/mg/kit.js
+++ b/blog/src/assets/mg/kit.js
@@ -277,9 +277,10 @@
const lab = wrap(r.label, Math.floor((lw - 6) / (f * 0.54))).slice(0, 2);
lines(g, cx[0] + 4, y + rh / 2 + 6 - (lab.length - 1) * f * 0.6, lab, f, C.soft, { "font-weight": 600 }, f * 1.2);
const ticks = ["a", "b"].map((k, j) => {
- const won = r.win === k, s = cut(r[k], won ? mc - 2 : mc), mid = cx[j + 1] + cw / 2;
- txt(g, mid + (won ? 10 : 0), y + rh / 2 + 6, s, f, won ? C.y : C.paper, { "text-anchor": "middle", "font-weight": won ? 700 : 500 });
- return won ? el("path", { d: `M${mid - s.length * f * 0.29 - 20} ${y + rh / 2}l6 6 11-12`, fill: "none", stroke: C.y, "stroke-width": 3.5, "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-dasharray": 26 }, g) : null;
+ // a long cell shrinks to fit its column (down to 11 px) before it is cut
+ const won = r.win === k, s = cut(r[k], 30), mid = cx[j + 1] + cw / 2, fs = Math.max(11, Math.min(f, (cw - (won ? 50 : 20)) / (Math.max(1, s.length) * 0.56)));
+ txt(g, mid + (won ? 10 : 0), y + rh / 2 + fs * 0.35, s, fs, won ? C.y : C.paper, { "text-anchor": "middle", "font-weight": won ? 700 : 500 });
+ return won ? el("path", { d: `M${mid - s.length * fs * 0.29 - 20} ${y + rh / 2}l6 6 11-12`, fill: "none", stroke: C.y, "stroke-width": 3.5, "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-dasharray": 26 }, g) : null;
});
ring(g, L.x0 - 8, y + 3, L.x1 - L.x0 + 16, rh - 6, 10);
return { g, bg, ticks };
diff --git a/docs/blog/assets/mg/demo.html b/docs/blog/assets/mg/demo.html
index 8ab5f421..02e9d9ec 100644
--- a/docs/blog/assets/mg/demo.html
+++ b/docs/blog/assets/mg/demo.html
@@ -30,7 +30,7 @@
<figure class="mg" data-scene="price-ladder"><img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" width="1600" height="900" alt="Animation. Four price steps rise from Free to Team while Kevin points at them."><script type="application/json">{"kicker":"Sample prices","title":"What each plan costs a month","prefix":"$","items":[{"label":"Free","value":0,"display":"Free","note":"Free covers one agent."},{"label":"Solo","value":12,"note":"Solo adds five agents."},{"label":"Pro","value":20,"highlight":true,"note":"Pro is the one most people pick."},{"label":"Team","value":45,"note":"Team is per seat."}],"host":"kevin","say":"Pro is the sweet spot."}</script><figcaption>price-ladder: tap a step for its note.</figcaption></figure>
<h2>compare</h2>
-<figure class="mg" data-scene="compare"><img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" width="1600" height="900" alt="Animation. A table compares Tool A and Tool B on four rows and Oscar gives the verdict."><script type="application/json">{"kicker":"Sample compare","title":"Tool A against Tool B","cols":["Tool A","Tool B"],"pick":1,"rows":[{"label":"Price","a":"$20 a month","b":"Free","win":"b","note":"Checked on both pricing pages."},{"label":"Open source","a":"No","b":"Yes","win":"b"},{"label":"Runs offline","a":"Yes","b":"Yes","win":"","note":"A tie. Both run on your machine."},{"label":"Setup time","a":"2 minutes","b":"10 minutes","win":"a"}],"host":"oscar","say":"Tool B wins three of four."}</script><figcaption>compare: tap a row and Oscar checks it.</figcaption></figure>
+<figure class="mg" data-scene="compare"><img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" width="1600" height="900" alt="Animation. A table compares Tool A and Tool B on four rows and Oscar gives the verdict."><script type="application/json">{"kicker":"Sample compare","title":"Tool A against Tool B","cols":["Tool A","Tool B"],"pick":1,"rows":[{"label":"Price","a":"$20 a month","b":"Free","win":"b","note":"Checked on both pricing pages."},{"label":"Import your setup","a":"By hand","b":"hermes claw migrate","win":"b"},{"label":"Runs offline","a":"Yes","b":"Yes","win":"","note":"A tie. Both run on your machine."},{"label":"Setup time","a":"2 minutes","b":"10 minutes","win":"a"}],"host":"oscar","say":"Tool B wins three of four."}</script><figcaption>compare: tap a row and Oscar checks it.</figcaption></figure>
<h2>timeline</h2>
<figure class="mg" data-scene="timeline"><img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" width="1600" height="900" alt="Animation. Jim walks along a timeline of four dates and says what happened at each."><script type="application/json">{"kicker":"Sample timeline","title":"How the release went","events":[{"when":"May","label":"First build","note":"One agent, one desk."},{"when":"July","label":"Open source","note":"The repo went public."},{"when":"Sept","label":"Pro","note":"The paid plan shipped."},{"when":"Oct","label":"Halloween","note":"Everyone got a costume."}],"host":"jim"}</script><figcaption>timeline: tap a date and Jim walks to it.</figcaption></figure>
diff --git a/docs/blog/assets/mg/kit.js b/docs/blog/assets/mg/kit.js
index 4d4c6e32..6d6a8809 100644
--- a/docs/blog/assets/mg/kit.js
+++ b/docs/blog/assets/mg/kit.js
@@ -277,9 +277,10 @@
const lab = wrap(r.label, Math.floor((lw - 6) / (f * 0.54))).slice(0, 2);
lines(g, cx[0] + 4, y + rh / 2 + 6 - (lab.length - 1) * f * 0.6, lab, f, C.soft, { "font-weight": 600 }, f * 1.2);
const ticks = ["a", "b"].map((k, j) => {
- const won = r.win === k, s = cut(r[k], won ? mc - 2 : mc), mid = cx[j + 1] + cw / 2;
- txt(g, mid + (won ? 10 : 0), y + rh / 2 + 6, s, f, won ? C.y : C.paper, { "text-anchor": "middle", "font-weight": won ? 700 : 500 });
- return won ? el("path", { d: `M${mid - s.length * f * 0.29 - 20} ${y + rh / 2}l6 6 11-12`, fill: "none", stroke: C.y, "stroke-width": 3.5, "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-dasharray": 26 }, g) : null;
+ // a long cell shrinks to fit its column (down to 11 px) before it is cut
+ const won = r.win === k, s = cut(r[k], 30), mid = cx[j + 1] + cw / 2, fs = Math.max(11, Math.min(f, (cw - (won ? 50 : 20)) / (Math.max(1, s.length) * 0.56)));
+ txt(g, mid + (won ? 10 : 0), y + rh / 2 + fs * 0.35, s, fs, won ? C.y : C.paper, { "text-anchor": "middle", "font-weight": won ? 700 : 500 });
+ return won ? el("path", { d: `M${mid - s.length * fs * 0.29 - 20} ${y + rh / 2}l6 6 11-12`, fill: "none", stroke: C.y, "stroke-width": 3.5, "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-dasharray": 26 }, g) : null;
});
ring(g, L.x0 - 8, y + 3, L.x1 - L.x0 + 16, rh - 6, 10);
return { g, bg, ticks };