@nodii/dev 0.6.160 → 0.6.161

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.160";
7
+ export const VERSION = "0.6.161";
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 = 25;
35
+ export const GENERATOR_FORMAT = 27;
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). */
@@ -1017,12 +1017,17 @@ function liftRecordData(code, node, ctx, path, scope = scopeName(node)) {
1017
1017
  // Every Checkbox and Switch is controlled by the page and named by the text beside it
1018
1018
  // (`pfChecked`, `onPfCheckedChange`): Figma's tick is the sample, never a default, and the
1019
1019
  // template's own `checked` / `onCheckedChange` (DESIGN-SYSTEM-508) never shared (hub-468).
1020
- if (TOGGLE.test(out)) {
1020
+ const fieldToggle = /^<Field\b/.test(out) && /<(?:Checkbox|Switch)\b/.test(out);
1021
+ if (TOGGLE.test(out) || fieldToggle) {
1021
1022
  out = rewriteTags(out, "Checkbox|Switch", (attrs) => {
1022
1023
  const rest = attrs
1023
1024
  .replace(new RegExp(String.raw`\s+(?:checked|onCheckedChange)=(?:${LITERAL}|\{[^{}]*\})`, "g"), "")
1024
1025
  .replace(/\s+defaultChecked(?:=\{(?:true|false)\})?(?=[\s/>]|$)/g, "");
1025
- return ` checked={${lift(scope, joinName(scope, "checked"))}} onCheckedChange={${lift(scope, `on${cap(joinName(scope, "checkedChange"))}`)}}${rest}`;
1026
+ // A Field's swapped control still belongs to its caller, including pending
1027
+ // and permission state. Keep the Field's own id, error and hint bindings.
1028
+ const controlled = fieldToggle ? rest.replace(/\s+disabled(?:=(?:\{[^{}]*\}|"[^"]*"))?(?=[\s/>]|$)/g, "") : rest;
1029
+ const disabled = fieldToggle ? ` disabled={${lift(scope, joinName(scope, "disabled"))}}` : "";
1030
+ return ` checked={${lift(scope, joinName(scope, "checked"))}} onCheckedChange={${lift(scope, `on${cap(joinName(scope, "checkedChange"))}`)}}${disabled}${controlled}`;
1026
1031
  });
1027
1032
  }
1028
1033
  // A record's progress, priority and amount, a chip's label and a step's status are the
@@ -1867,6 +1872,12 @@ function dataProps(views, propsType) {
1867
1872
  entry(m[2]).child = true;
1868
1873
  view.uses.add(m[2]);
1869
1874
  }
1875
+ // An overridable table heading retains the drawing's copy when omitted.
1876
+ for (const m of body.matchAll(/\{([a-z][A-Za-z0-9]*Heading) \?\? "(?:[^"\\\n]|\\.)*"\}/g)) {
1877
+ entry(m[1]).child = true;
1878
+ entry(m[1]).optional = true;
1879
+ view.uses.add(m[1]);
1880
+ }
1870
1881
  // A value inside an object prop (`chip={{ label: chipLabel }}`, `points: series1Points`).
1871
1882
  // Strings go first, so a colon in text or a class name is never read as one.
1872
1883
  const noStrings = body.replace(/"(?:[^"\\\n]|\\.)*"|`[^`]*`/g, '""');
@@ -2952,7 +2963,13 @@ function tableOf(node, ctx) {
2952
2963
  };
2953
2964
  // A head that still shows Figma's placeholder copy draws no header the page can read:
2954
2965
  // its copy is a prop, named by its column, in the list's scope (hub-468).
2955
- 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);
2966
+ const liftHeading = (code, key) => {
2967
+ if (!key) return code;
2968
+ const lifted = 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)}}`);
2969
+ // Display copy may follow a selected dimension; row and sort keys still come
2970
+ // from the drawing. Existing consumers keep the drawn label (hub-507).
2971
+ return lifted.replace(/(<Table(?:Sort)?Head\b[^\n]*>\s*)\{("(?:[^"\\\n]|\\.)*")\}/, (_, open, label) => `${open}{${optionalMark(ctx, listName, `${key}Heading`, null)} ?? ${label}}`);
2972
+ };
2956
2973
  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);
2957
2974
  const liftedRows = () => {
2958
2975
  const first = dataRows[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/dev",
3
- "version": "0.6.160",
3
+ "version": "0.6.161",
4
4
  "description": "Agent CLI for Nodii Dev, reached through the platform edge",
5
5
  "type": "module",
6
6
  "bin": {