@nodii/dev 0.6.141 → 0.6.142

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/dist/core.js CHANGED
@@ -4,7 +4,7 @@ import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
4
4
  import { homedir, platform } from "node:os";
5
5
  import { dirname, join } from "node:path";
6
6
 
7
- export const VERSION = "0.6.141";
7
+ export const VERSION = "0.6.142";
8
8
  export const configPath = () =>
9
9
  process.env.NODII_DEV_CONFIG_PATH ??
10
10
  join(homedir(), ".config/nodii-dev/config.json");
package/dist/surface.js CHANGED
@@ -32,7 +32,7 @@ import { CliError, VERSION, devRequest, readConfig } from "./core.js";
32
32
  import { createRenderer } from "./vendor/render-templates.mjs";
33
33
 
34
34
  /** Bumped whenever the emitted code changes shape for the same inputs. */
35
- export const GENERATOR_FORMAT = 14;
35
+ export const GENERATOR_FORMAT = 15;
36
36
  export const TREE_DIR = "docs/figma-ux-ds/figma/surface-trees";
37
37
  export const GENERATED_SUFFIX = ".surface.generated.tsx";
38
38
  /** Where every generated product page lives, as a git glob (NODII-DEV-CLI-77). */
@@ -680,15 +680,29 @@ function scopeName(node, code = "", ctx = null) {
680
680
  };
681
681
  // A column's key is already an identifier (the lifted rows' own).
682
682
  if (tablePart(tag) === "head" && ctx?.column) return ctx.column;
683
- const text = [
684
- BESIDE_TAGS.has(tag) ? textBeside(node, ctx) : null,
685
- drawn("label"),
686
- drawn("title"),
687
- drawn("placeholder"),
688
- props.label,
689
- props.title,
690
- ].find(named) ?? node.name ?? "";
691
- return camelName(text);
683
+ const text = [BESIDE_TAGS.has(tag) ? textBeside(node, ctx) : null, drawn("label"), drawn("title"), drawn("placeholder")].find(named);
684
+ if (text) return nameOf(text, node.instance?.set ?? node.name);
685
+ // A part named only by its own title or label (a post card's "Diwali holiday calendar 2026")
686
+ // is a record: when its set repeats in the view, it is named by role and position (hub-468).
687
+ const own = [props.label, props.title].find(named);
688
+ const at = own ? placeInView(node, ctx) : null;
689
+ if (at) return camelName(`${node.instance.set} ${at}`);
690
+ return nameOf(own ?? node.name ?? "", node.instance?.set ?? node.name ?? "");
691
+ }
692
+
693
+ /** Where an instance stands among the instances of its set in its view (1, 2, …), when the view holds two or more; else null. */
694
+ function placeInView(node, ctx) {
695
+ const root = ctx?.chain?.[0];
696
+ const set = node.instance?.set;
697
+ if (!root || !set) return null;
698
+ const same = [];
699
+ const walk = (n) => {
700
+ if (n.visible === false) return;
701
+ if (n.instance?.set === set) same.push(n);
702
+ for (const c of n.children ?? []) walk(c);
703
+ };
704
+ walk(root);
705
+ return same.length > 1 && same.includes(node) ? same.indexOf(node) + 1 : null;
692
706
  }
693
707
 
694
708
  /**
@@ -752,16 +766,32 @@ function sectionHeading(target, chain) {
752
766
  * so one prop is never typed as two tables merged.
753
767
  */
754
768
  function listScope(target, ctx, fallback, shape = null) {
755
- const base = sectionHeading(target, ctx.chain ?? []) ?? fallback;
756
- let name = camelName(base);
769
+ const heading = sectionHeading(target, ctx.chain ?? []);
770
+ const base = (heading && nameText(heading)) || fallback;
771
+ let name = nameOf(base, "list");
757
772
  if (!ctx.lists) return name;
758
773
  const taken = (n) => (ctx.lists.has(n) && ctx.lists.get(n) !== target) || (shape !== null && ctx.shapes?.has(n) && ctx.shapes.get(n) !== shape);
759
- for (let n = 2; taken(name); n++) name = camelName(`${base} ${n}`);
774
+ for (let n = 2; taken(name); n++) name = camelName(`${nameText(base) || "list"} ${n}`);
760
775
  ctx.lists.set(name, target);
761
776
  if (shape !== null) ctx.shapes?.set(name, shape);
762
777
  return name;
763
778
  }
764
779
 
780
+ /**
781
+ * The words of `text` that may name a prop: a part that carries a figure is
782
+ * Figma's sample (a date, a count, a version, a year) and never names one
783
+ * (hub-468): "Run readiness · August 2026" → "Run readiness", "Q3 2026
784
+ * Performance Review" → "Performance Review", "Last 30 days" → "Last days".
785
+ * Empty when nothing is left.
786
+ */
787
+ function nameText(text) {
788
+ const parts = String(text ?? "").split(/\s+[·•|—–-]\s+|:\s+/).filter((p) => !/\d/.test(p));
789
+ const kept = parts.length ? parts.join(" ") : String(text ?? "").split(/\s+/).filter((w) => !/\d/.test(w)).join(" ");
790
+ return /[A-Za-z]/.test(kept) ? kept : "";
791
+ }
792
+ /** A name from text, its figures left out (nameText), else `fallback`. */
793
+ const nameOf = (text, fallback = "") => camelName(nameText(text) || fallback);
794
+
765
795
  /** Text in camelCase as an identifier (`Subject kind` → `subjectKind`, `2FA` → `field2fa`). */
766
796
  function camelName(text) {
767
797
  const words = String(text ?? "").match(/[A-Za-z0-9]+/g) ?? [];
@@ -860,9 +890,10 @@ function liftRecordData(code, node, ctx, path, scope = scopeName(node)) {
860
890
  const lifted = [];
861
891
  const lift = (at, name) => (lifted.push(name), mark(ctx, at, name));
862
892
  let out = liftFieldControls(code, node, ctx, lift);
863
- // An Alert's title or description that names a record's value (a date, an amount, a code).
893
+ // An Alert's title or description that names a record's value: a date, an amount, a code,
894
+ // or any figure ("running at 4.2% this period", "3 lines still carry a flag"; hub-468).
864
895
  out = out.replace(/<(Alert(Title|Description))>(\{"(?:[^"\\\n]|\\.)*"\})<\/\1>/g, (all, tag, part, lit) =>
865
- SAMPLE_VALUE.test(literalText(lit)) ? `<${tag}>{${lift(camelName(ctx.state ?? "alert"), `alert${part}`)}}</${tag}>` : all,
896
+ RECORD_TEXT(literalText(lit)) ? `<${tag}>{${lift(camelName(ctx.state ?? "alert"), `alert${part}`)}}</${tag}>` : all,
866
897
  );
867
898
  // An Empty State's title, description and action label are the page's: its copy depends on
868
899
  // the list and the person ("No pay components yet" or "No custom components yet"), and
@@ -884,7 +915,7 @@ function liftRecordData(code, node, ctx, path, scope = scopeName(node)) {
884
915
  const value = new RegExp(String.raw`\bvalue=${LITERAL}`).exec(attrs);
885
916
  if (!value) return all;
886
917
  const label = new RegExp(String.raw`\blabel=(${LITERAL})`).exec(attrs);
887
- const scope = camelName(label ? literalText(label[1]) : node.name);
918
+ const scope = nameOf(label ? literalText(label[1]) : node.name, node.name);
888
919
  return `<DescriptionItem${attrs.replace(value[0], `value={${lift(scope, "value")}}`)}/>`;
889
920
  });
890
921
  out = out.replace(/<StatusPill\b([^>]*?)(\/?)>/g, (all, attrs, close) => {
@@ -923,7 +954,7 @@ function liftRecordData(code, node, ctx, path, scope = scopeName(node)) {
923
954
  // by its own setter (`onChange={setAmountMinor}` → `amountMinor`), so the two pair up.
924
955
  const place = () => {
925
956
  const same = (ctx.parent?.children ?? []).filter((c) => c.visible !== false && c.instance?.set === node.instance?.set);
926
- return camelName(`${ctx.parent?.name ?? node.name}${same.length > 1 ? ` ${same.indexOf(node) + 1}` : ""}`);
957
+ return camelName(`${nameText(ctx.parent?.name ?? node.name) || node.instance?.set || "part"}${same.length > 1 ? ` ${same.indexOf(node) + 1}` : ""}`);
927
958
  };
928
959
  out = rewriteTags(out, "Progress", (attrs) => attrs.replace(/(^|\s)value=\{-?\d+(?:\.\d+)?\}/, (a, sp) => `${sp}value={${lift(place(), joinName(place(), "value"))}}`));
929
960
  out = rewriteTags(out, "PriorityChip", (attrs) => attrs.replace(new RegExp(String.raw`(^|\s)priority=${LITERAL}`), (a, sp) => `${sp}priority={${lift(place(), joinName(place(), "priority"))}}`));
@@ -935,7 +966,7 @@ function liftRecordData(code, node, ctx, path, scope = scopeName(node)) {
935
966
  );
936
967
  out = rewriteTags(out, "Stepper", (attrs) =>
937
968
  attrs.replace(/(\btitle:\s*("(?:[^"\\\n]|\\.)*")\s*,\s*status:\s*)"[a-z_-]+"/g, (a, head, title) => {
938
- const step = camelName(JSON.parse(title));
969
+ const step = nameOf(JSON.parse(title), "step");
939
970
  return `${head}${lift(step, joinName(step, "status"))}`;
940
971
  }),
941
972
  );
@@ -944,7 +975,7 @@ function liftRecordData(code, node, ctx, path, scope = scopeName(node)) {
944
975
  }
945
976
  out = rewriteTags(out, String.raw`Metric(?!CardGroup\b)[A-Za-z]*`, (attrs, tag) => {
946
977
  const name = new RegExp(String.raw`\b(?:title|label)=(${LITERAL})`).exec(attrs);
947
- const at = name ? camelName(literalText(name[1])) : scope;
978
+ const at = name && nameText(literalText(name[1])) ? nameOf(literalText(name[1])) : scope;
948
979
  let next = attrs;
949
980
  for (const attr of METRIC_VALUES) {
950
981
  const value = new RegExp(String.raw`\b${attr}=${LITERAL}`).exec(next);
@@ -983,10 +1014,28 @@ function liftRecordData(code, node, ctx, path, scope = scopeName(node)) {
983
1014
  const hint = new RegExp(String.raw`\bmaskHint=${LITERAL}`).exec(attrs);
984
1015
  return hint ? attrs.replace(hint[0], `maskHint={${lift(scope, "maskHint")}}`) : attrs;
985
1016
  });
1017
+ // A title or label that dates or counts a record ("Headcount over time · 27 May 2026 to
1018
+ // 25 Aug 2026", "Q3 2026 Performance Review", "Pay events 2027") is the record's; fixed copy
1019
+ // with a figure ("Step 1 · Lines", "Due within 30 days") stays (hub-468). A DatePicker's
1020
+ // sample date is the page's too; its format hint ("dd/mm/yyyy") stays.
1021
+ out = rewriteTags(out, "[A-Z][A-Za-z]*", (attrs, tag) => {
1022
+ const flat = maskStrings(attrs);
1023
+ const topLevel = (at) => [...flat.slice(0, at)].reduce((d, c) => d + (c === "{") - (c === "}"), 0) === 0;
1024
+ return attrs.replace(new RegExp(String.raw`(^|\s)(title|label|description|placeholder)=(${LITERAL})`, "g"), (a, sp, k, lit, at) => {
1025
+ if (!topLevel(at)) return a;
1026
+ const text = literalText(lit);
1027
+ if (k === "placeholder" ? tag !== "DatePicker" || !SAMPLE_VALUE.test(text) : !DATED(text)) return a;
1028
+ const at2 = nameOf(text, `${tag} ${k}`);
1029
+ return `${sp}${k}={${lift(at2, joinName(at2, k))}}`;
1030
+ });
1031
+ });
986
1032
  if (lifted.length) ctx.note(path, LIFTED, `${[...new Set(lifted)].join(", ")} lifted from Figma's sample into the page's props (NODII-DEV-CLI-82)`);
987
1033
  return out;
988
1034
  }
989
1035
 
1036
+ /** Text that dates a record: a sample value (a date, an amount, a code), a year, a quarter or a day ("Tue 22") (hub-468). */
1037
+ const DATED = (text) => SAMPLE_VALUE.test(text) || /\b(?:19|20)\d\d\b|\bQ[1-4]\b|\b(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)\w* \d{1,2}\b/.test(text);
1038
+
990
1039
  /**
991
1040
  * Text that names a record's value, not copy: an amount (₹51,900), a date
992
1041
  * (31 Oct, 09 Oct 2026), an email, a domain or a record code (PAY-8821,
@@ -1004,7 +1053,7 @@ const RECORD_TEXT = (text) => SAMPLE_VALUE.test(text) || /\d/.test(text);
1004
1053
  /** A part named by where it sits: its parent's name, numbered when the parent holds several of the same set. */
1005
1054
  function positionScope(node, ctx, kind) {
1006
1055
  const siblings = (ctx.parent?.children ?? []).filter((c) => c.visible !== false && (node.instance ? c.instance?.set === node.instance.set : c.type === node.type));
1007
- return camelName(`${ctx.parent?.name ?? kind} ${kind}${siblings.length > 1 ? ` ${siblings.indexOf(node) + 1}` : ""}`);
1056
+ return camelName(`${nameText(ctx.parent?.name ?? "") || kind} ${kind}${siblings.length > 1 ? ` ${siblings.indexOf(node) + 1}` : ""}`);
1008
1057
  }
1009
1058
 
1010
1059
  /**
@@ -1206,16 +1255,17 @@ const kebab = (s) => s.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
1206
1255
  function fieldScope(node, ctx, code) {
1207
1256
  const props = node.instance?.props ?? {};
1208
1257
  const own = [props.label, props.title].find((v) => typeof v === "string" && /[A-Za-z]/.test(v) && code.includes(JSON.stringify(v)));
1209
- if (own) return camelName(own);
1258
+ // Each text it is named by leaves out its figures, Figma's sample (nameText; hub-468).
1259
+ if (own && nameText(own)) return nameOf(own);
1210
1260
  const placeholder = new RegExp(String.raw`\bplaceholder=(${LITERAL})`).exec(code);
1211
1261
  const hint = placeholder ? literalText(placeholder[1]) : "";
1212
- if (/^[^:]{1,32}:/.test(hint)) return camelName(hint.split(":")[0]);
1262
+ if (/^[^:]{1,32}:/.test(hint) && nameText(hint.split(":")[0])) return nameOf(hint.split(":")[0]);
1213
1263
  const shown = (ctx.parent?.children ?? []).filter((c) => c.visible !== false);
1214
1264
  const before = shown[shown.indexOf(node) - 1];
1215
- if (before?.type === "TEXT" && /[A-Za-z]/.test(before.text ?? "") && !/:\s*$/.test(before.text)) return camelName(before.text);
1265
+ if (before?.type === "TEXT" && nameText(before.text) && !/:\s*$/.test(before.text)) return nameOf(before.text);
1216
1266
  if (/^search\b/i.test(hint)) return "search";
1217
- const layer = camelName(node.name);
1218
- return layer === camelName(node.instance?.set ?? "") || !layer ? camelName(hint) || "field" : layer;
1267
+ const layer = nameOf(node.name);
1268
+ return layer === camelName(node.instance?.set ?? "") || !nameText(node.name) ? nameOf(hint, "field") : layer;
1219
1269
  }
1220
1270
 
1221
1271
  /**
@@ -1397,6 +1447,15 @@ function distinguish(list, together, layers) {
1397
1447
  }
1398
1448
  const order = list.map(() => null);
1399
1449
  for (const inView of together) inView.forEach((o, k) => (order[list.indexOf(o)] ??= ORDINALS[k] ?? `item${k + 1}`));
1450
+ // Two layers that were each third in a different view, drawn together in a later one, would
1451
+ // share "third": then each takes its place among all of them, first drawn first (hub-468).
1452
+ const clash = together.some((inView) => new Set(inView.map((o) => order[list.indexOf(o)])).size < inView.length);
1453
+ if (clash) {
1454
+ const seen = [];
1455
+ for (const inView of together) for (const o of inView) if (!seen.includes(o)) seen.push(o);
1456
+ for (const o of list) if (!seen.includes(o)) seen.push(o);
1457
+ return list.map((o) => ORDINALS[seen.indexOf(o)] ?? `item${seen.indexOf(o) + 1}`);
1458
+ }
1400
1459
  return order.map((x) => x ?? "");
1401
1460
  }
1402
1461
 
@@ -1458,10 +1517,14 @@ function dataProps(views, propsType) {
1458
1517
  // A value inside an object prop (`chip={{ label: chipLabel }}`, `points: series1Points`).
1459
1518
  // Strings go first, so a colon in text or a class name is never read as one.
1460
1519
  const noStrings = body.replace(/"(?:[^"\\\n]|\\.)*"|`[^`]*`/g, '""');
1461
- for (const m of noStrings.matchAll(/\b[A-Za-z_]\w*:\s*([a-z][A-Za-z0-9]*)(?=\s*[,}\]])/g)) {
1462
- if (JS_LITERALS.has(m[1])) continue;
1463
- entry(m[1]).nested = true;
1464
- view.uses.add(m[1]);
1520
+ for (const m of noStrings.matchAll(/\b([A-Za-z_]\w*):\s*([a-z][A-Za-z0-9]*)(?=\s*[,}\]])/g)) {
1521
+ if (JS_LITERALS.has(m[2])) continue;
1522
+ const d = entry(m[2]);
1523
+ d.nested = true;
1524
+ const type = nestedType(noStrings, m.index, m[1]);
1525
+ if (type) (d.nestedTypes ??= new Set()).add(type);
1526
+ else d.untyped = true;
1527
+ view.uses.add(m[2]);
1465
1528
  }
1466
1529
  }
1467
1530
  for (const d of data.values()) {
@@ -1600,9 +1663,59 @@ function tagAttributes(body, at) {
1600
1663
  return null;
1601
1664
  }
1602
1665
 
1666
+ /**
1667
+ * The type of a value nested in an object prop (`series={[{ points: series1Points }]}`):
1668
+ * its path from the DS component's prop, `NonNullable<ComponentProps<typeof
1669
+ * Chart>["series"]>[number]["points"]`, so it is never `any` (hub-468). `at` is
1670
+ * where its key starts in `body` (strings blanked). Null when the path runs
1671
+ * through anything but objects and arrays (a call, a function).
1672
+ */
1673
+ function nestedType(body, at, key) {
1674
+ const steps = [key];
1675
+ let depth = 0;
1676
+ for (let i = at - 1; i >= 0; i--) {
1677
+ const c = body[i];
1678
+ if (c === ")" || c === "}" || c === "]") depth++;
1679
+ else if (c === "(" ) {
1680
+ if (depth === 0) return null;
1681
+ depth--;
1682
+ } else if (c === "{" || c === "[") {
1683
+ if (depth > 0) {
1684
+ depth--;
1685
+ continue;
1686
+ }
1687
+ if (c === "[") {
1688
+ steps.unshift("[number]");
1689
+ continue;
1690
+ }
1691
+ let j = i - 1;
1692
+ while (j >= 0 && /\s/.test(body[j])) j--;
1693
+ if (body[j] === "{" || body[j] === "," || body[j] === "[") continue;
1694
+ if (body[j] === ":") {
1695
+ const k = /([A-Za-z_]\w*)\s*$/.exec(body.slice(0, j));
1696
+ if (!k) return null;
1697
+ steps.unshift(k[1]);
1698
+ i = j - k[0].length + 1;
1699
+ continue;
1700
+ }
1701
+ if (body[j] !== "=") return null;
1702
+ const attr = /([A-Za-z_][\w-]*)$/.exec(body.slice(0, j))?.[1];
1703
+ const start = attr ? openingTag(body, j - attr.length) : null;
1704
+ if (start === null) return null;
1705
+ const tag = /^<([A-Z][\w.]*)/.exec(body.slice(start))?.[1];
1706
+ if (!tag) return null;
1707
+ let type = `ComponentProps<typeof ${tag}>[${JSON.stringify(attr)}]`;
1708
+ for (const step of steps) type = `NonNullable<${type}>${step === "[number]" ? "[number]" : `[${JSON.stringify(step)}]`}`;
1709
+ return type;
1710
+ }
1711
+ }
1712
+ return null;
1713
+ }
1714
+
1603
1715
  const propType = (d) => {
1604
- // A value nested in an object prop has no ComponentProps path the generator can name.
1605
- const parts = [...[...d.attrs.values()].map(drawnRef), ...(d.child ? ["ReactNode"] : []), ...(d.nested ? ["any"] : [])];
1716
+ // A value nested in an object prop is typed by its path from the DS prop (nestedType); `any` only when it has none.
1717
+ const nested = d.nested ? (d.untyped || !d.nestedTypes?.size ? ["any"] : [...d.nestedTypes]) : [];
1718
+ const parts = [...[...d.attrs.values()].map(drawnRef), ...(d.child ? ["ReactNode"] : []), ...nested];
1606
1719
  const shape = `{ ${[...d.members.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([k, refs]) => `${k}: ${[...refs.values()].map(drawnRef).join(" & ")}`).join("; ")} }`;
1607
1720
  // A lifted list is an array of its items (NODII-DEV-CLI-82).
1608
1721
  if (d.list) parts.push(`Array<${shape}>`);
@@ -1946,12 +2059,22 @@ function tabStrip(run, ctx) {
1946
2059
  // Each tab's value is its label (`Pending revisions` → `pending-revisions`), so the page can
1947
2060
  // route by it; tab-<n> when it has none or shares it (NODII-DEV-CLI-83).
1948
2061
  const values = [];
2062
+ // A label with a count ("Cycles 3") is the page's, and its value is the label's words
2063
+ // (`cycles`): the count is Figma's sample (hub-468).
2064
+ const counted = [];
1949
2065
  for (const [i, t] of tabs.entries()) {
1950
2066
  const label = /\{("(?:[^"\\\n]|\\.)*")\}/.exec(t.trigger);
1951
- const value = label ? slug(JSON.parse(label[1])) : "";
2067
+ const text = label ? JSON.parse(label[1]) : "";
2068
+ counted.push(/\d/.test(text) && nameText(text) ? label[0] : null);
2069
+ const value = text ? slug(/\d/.test(text) ? nameText(text) : text) : "";
1952
2070
  values.push(value && !values.includes(value) ? value : `tab-${i + 1}`);
1953
2071
  }
1954
- const triggers = tabs.map((t, i) => indent(t.trigger.replace(/(<TabsTrigger\b[\s\S]*?)\bvalue="tab"/, `$1value="${values[i]}"`), 2));
2072
+ const stripScope = scopeName(ctx.parent ?? { name: "tabs" });
2073
+ const triggers = tabs.map((t, i) => {
2074
+ let trigger = t.trigger.replace(/(<TabsTrigger\b[\s\S]*?)\bvalue="tab"/, `$1value="${values[i]}"`);
2075
+ if (counted[i]) trigger = trigger.replace(counted[i], `{${mark(ctx, stripScope, joinName(camelName(values[i]), "tabLabel"), null)}}`);
2076
+ return indent(trigger, 2);
2077
+ });
1955
2078
  return [
1956
2079
  // The page controls which tab is shown (NODII-DEV-CLI-83); Figma's selected tab is only the drawn one.
1957
2080
  indent(CONTROLLED_TABS(mark(ctx, scopeName(ctx.parent ?? { name: "tabs" }), "tab", null), mark(ctx, scopeName(ctx.parent ?? { name: "tabs" }), "onTabChange", null)), depth),
@@ -2026,6 +2149,8 @@ function openTagEnd(code) {
2026
2149
  /** The copy a Table head shows until a Surface sets it: Figma's placeholder, never a column's name (hub-468). */
2027
2150
  const HEAD_PLACEHOLDER = /^\s*table heading\s*$/i;
2028
2151
  const HEAD_PLACEHOLDER_CHILD = /(<Table(?:Sort)?Head\b[^\n]*>\s*)\{"\s*[Tt]able heading\s*"\}/;
2152
+ /** A head whose copy is a figure (a year, "Zone 2"): the record's, lifted as its column's heading (hub-468). */
2153
+ const HEAD_FIGURE_CHILD = /(<Table(?:Sort)?Head\b[^\n]*>\s*)\{"(?:[^"\\\n]|\\.)*\d(?:[^"\\\n]|\\.)*"\}/;
2029
2154
 
2030
2155
  function tableOf(node, ctx) {
2031
2156
  const shown = (node.children ?? []).filter((c) => c.visible !== false);
@@ -2184,7 +2309,8 @@ function tableOf(node, ctx) {
2184
2309
  const head = headRow?.cells[i];
2185
2310
  const text = head?.code ? (/\{"((?:[^"\\\n]|\\.)*)"\}/.exec(head.code)?.[1] ?? /\blabel="([^"]*)"/.exec(head.code)?.[1] ?? "") : "";
2186
2311
  // Figma's placeholder copy ("Table heading") names no column: it is keyed by position.
2187
- let key = /[A-Za-z0-9]/.test(text) && !HEAD_PLACEHOLDER.test(text) ? camelName(text) : `column${i + 1}`;
2312
+ // A head that shows a figure ("2026", "Karnataka · 2027") names no column either.
2313
+ let key = /[A-Za-z0-9]/.test(text) && !HEAD_PLACEHOLDER.test(text) && !/\d/.test(text) ? camelName(text) : `column${i + 1}`;
2188
2314
  while (keys.includes(key) || key === "id") key = `${key}${i + 1}`;
2189
2315
  keys.push(key);
2190
2316
  }
@@ -2207,7 +2333,7 @@ function tableOf(node, ctx) {
2207
2333
  };
2208
2334
  // A head that still shows Figma's placeholder copy draws no header the page can read:
2209
2335
  // its copy is a prop, named by its column, in the list's scope (hub-468).
2210
- const liftHeading = (code, key) => (key ? code.replace(HEAD_PLACEHOLDER_CHILD, (_, open) => `${open}{${mark(ctx, listName, `${key}Heading`, null)}}`) : code);
2336
+ const liftHeading = (code, key) => (key ? code.replace(HEAD_PLACEHOLDER_CHILD, (_, open) => `${open}{${mark(ctx, listName, `${key}Heading`, null)}}`).replace(HEAD_FIGURE_CHILD, (_, open) => `${open}{${mark(ctx, listName, `${key}Heading`, null)}}`) : code);
2211
2337
  const liftable = !skeleton && dataRows.length > 0 && dataRows.every((p) => !p.unrecognised && !p.framesOnly && p.cells.length === dataRows[0].cells.length) && (!headRow || headRow.cells.length === dataRows[0].cells.length);
2212
2338
  const liftedRows = () => {
2213
2339
  const first = dataRows[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/dev",
3
- "version": "0.6.141",
3
+ "version": "0.6.142",
4
4
  "description": "Agent CLI for Nodii Dev, reached through the platform edge",
5
5
  "type": "module",
6
6
  "bin": {