@nodii/dev 0.6.202 → 0.6.204
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 +10 -1
- package/dist/core.js +1 -1
- package/dist/surface.js +53 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1355,6 +1355,13 @@ product-page catalog names the Surface by its published component-set key
|
|
|
1355
1355
|
whole, `value={loading ? <Skeleton shape="text" /> : <PiiText value={emailValue} … />}`,
|
|
1356
1356
|
so PiiText's `value` stays `string | null`. A value that reads nothing (fixed
|
|
1357
1357
|
copy) is left as it is.
|
|
1358
|
+
- **A person in a fact row is the served pair (DESIGN-SYSTEM-993).** A PiiText in
|
|
1359
|
+
a fact row's value slot (a Description List's `value`, a Right Pane / Row's or
|
|
1360
|
+
a Detail Section / Row's `valueSlot`) takes `value`, `model` and `relation`
|
|
1361
|
+
from its template and also the server's `maskHint` and `disposition`, both
|
|
1362
|
+
optional, as a lifted table's person cell takes `{ value, model, relation,
|
|
1363
|
+
maskHint? }`. The page passes them through as served: the relation keeps a
|
|
1364
|
+
self value revealed, and the generator never sets a mask (P-10).
|
|
1358
1365
|
- **Error and Empty views a route drives (NODII-DEV-CLI-260).** The Surface takes
|
|
1359
1366
|
`<Id>SurfaceInput`: a `state` with the full props, as before, or a literal
|
|
1360
1367
|
`state` with only the props its view reads (`{ state: "read-error" } &
|
|
@@ -1410,7 +1417,9 @@ product-page catalog names the Surface by its published component-set key
|
|
|
1410
1417
|
only (a loading row) is a body row of that table when it has as many cells as
|
|
1411
1418
|
the rows of Table parts; rows of frames alone are never a table. A row with
|
|
1412
1419
|
any head part is a header row, and a body part in it (a select-all Rich Cell)
|
|
1413
|
-
keeps its own code.
|
|
1420
|
+
keeps its own code. A bare `Checkbox` in a header row, which has no text to
|
|
1421
|
+
name it, takes `aria-label="Select all rows"`, the name the DS gives its own
|
|
1422
|
+
header `TableSelectionCell`; a name the frame gives it stays. What follows the rows (an Empty or Error State, bare, in
|
|
1414
1423
|
its own frame, or as a last row holding one DS instance) follows the Table.
|
|
1415
1424
|
- **A Table's loading state (U07-34.15.3).** The Table cell template emits
|
|
1416
1425
|
`TableSkeletonRows` for `State=Loading`. When every body row is a row of
|
package/dist/core.js
CHANGED
|
@@ -4,7 +4,7 @@ import { chmod, lstat, mkdir, readFile, rename, rm, writeFile } from "node:fs/pr
|
|
|
4
4
|
import { homedir, platform } from "node:os";
|
|
5
5
|
import { basename, dirname, join } from "node:path";
|
|
6
6
|
|
|
7
|
-
export const VERSION = "0.6.
|
|
7
|
+
export const VERSION = "0.6.204";
|
|
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
|
@@ -34,7 +34,7 @@ import { MIN_FIGMA_INTERVAL_MS, figmaRest } from "./figma-rest.js";
|
|
|
34
34
|
import { createRenderer } from "./vendor/render-templates.mjs";
|
|
35
35
|
|
|
36
36
|
/** Bumped whenever the emitted code changes shape for the same inputs. */
|
|
37
|
-
export const GENERATOR_FORMAT =
|
|
37
|
+
export const GENERATOR_FORMAT = 57;
|
|
38
38
|
/**
|
|
39
39
|
* DS parts that are an item of their parent's own list or grid, so they take no sizing
|
|
40
40
|
* wrapper: a Detail Section / Row's facts are the section grid's cells, a Right Pane / Row
|
|
@@ -1183,6 +1183,13 @@ const literalText = (lit) => JSON.parse(lit.startsWith("{") ? lit.slice(1, -1) :
|
|
|
1183
1183
|
* A run of sibling DescriptionLists and a table's body rows are lifted as lists
|
|
1184
1184
|
* (liftedDescriptionList, tableOf). Real copy (headings, labels, buttons) stays.
|
|
1185
1185
|
*/
|
|
1186
|
+
/**
|
|
1187
|
+
* The fact rows whose value is a slot, by Figma set, and that slot: a PiiText there takes the
|
|
1188
|
+
* server's `maskHint` and `disposition` as optional props (DESIGN-SYSTEM-993). A Detail Section /
|
|
1189
|
+
* Row's facts are its exposed Detail Section / Fact parts, read through the Row's own slots.
|
|
1190
|
+
*/
|
|
1191
|
+
const FACT_VALUE_SLOTS = new Map([["Description List", "value"], ["Right Pane / Row", "valueSlot"], ["Detail Section / Row", "valueSlot"]]);
|
|
1192
|
+
const FACT_PII_PROPS = ["maskHint", "disposition"];
|
|
1186
1193
|
function liftRecordData(code, node, ctx, path, scope = scopeName(node)) {
|
|
1187
1194
|
const lifted = [];
|
|
1188
1195
|
const lift = (at, name) => (lifted.push(name), mark(ctx, at, name));
|
|
@@ -1329,9 +1336,17 @@ function liftRecordData(code, node, ctx, path, scope = scopeName(node)) {
|
|
|
1329
1336
|
if (!ctx.inTable) {
|
|
1330
1337
|
out = out.replace(/^<Chip\b((?:[^>{"]|"(?:[^"\\\n]|\\.)*"|\{[^{}]*\})*)>\s*([^<>{}\n]*[A-Za-z0-9][^<>{}\n]*?)\s*<\/Chip>$/, (all, attrs) => `<Chip${attrs}>{${lift(place(), joinName(place(), "label"))}}</Chip>`);
|
|
1331
1338
|
}
|
|
1332
|
-
//
|
|
1333
|
-
//
|
|
1334
|
-
|
|
1339
|
+
// Figma's Metric Card preset=status draws its description row as the chip, an exposed Badge
|
|
1340
|
+
// with its own label, and has no caption layer at all: `showCaption` shows or hides that chip,
|
|
1341
|
+
// and the set's `caption` text rides on the instance unseen. MetricStatus draws its chip in
|
|
1342
|
+
// place of the caption too. So a card whose frame shows the row keeps its chip and drops the
|
|
1343
|
+
// caption, and one whose frame hides it (showCaption off) draws neither, never an empty chip
|
|
1344
|
+
// (cli-282; NODII-DEV-CLI-244 had read the hidden caption as the drawn line).
|
|
1345
|
+
out = rewriteTags(out, "MetricStatus", (attrs) => {
|
|
1346
|
+
const chip = /\n?[ \t]*\bchip=\{\{[^{}]*\}\}/;
|
|
1347
|
+
if (node.instance?.props?.showCaption === false) return attrs.replace(chip, "");
|
|
1348
|
+
return chip.test(attrs) ? attrs.replace(/\n?[ \t]*\bcaption=(?:"(?:[^"\\\n]|\\.)*"|\{[^{}]*\})/, "") : attrs;
|
|
1349
|
+
});
|
|
1335
1350
|
out = rewriteTags(out, String.raw`Metric(?!CardGroup\b)[A-Za-z]*`, (attrs, tag) => {
|
|
1336
1351
|
const name = new RegExp(String.raw`\b(?:title|label)=(${LITERAL})`).exec(attrs);
|
|
1337
1352
|
const at = name && nameText(literalText(name[1])) ? nameOf(literalText(name[1])) : scope;
|
|
@@ -1345,6 +1360,9 @@ function liftRecordData(code, node, ctx, path, scope = scopeName(node)) {
|
|
|
1345
1360
|
// the frame's green (NODII-DEV-CLI-239).
|
|
1346
1361
|
const chipTone = /(\bchip=\{\{[^{}]*?\btone:\s*)"(?:[^"\\\n]|\\.)*"/.exec(next);
|
|
1347
1362
|
if (chipTone) next = next.replace(chipTone[0], `${chipTone[1]}${lift(at, "chipTone")}`);
|
|
1363
|
+
// Its label too, named by the card as its tone is, never by its place (`metricCard1ChipLabel`; cli-282).
|
|
1364
|
+
const chipLabel = /(\bchip=\{\{\s*label:\s*)chipLabel\b/.exec(next);
|
|
1365
|
+
if (chipLabel) next = next.replace(chipLabel[0], `${chipLabel[1]}${lift(at, "chipLabel")}`);
|
|
1348
1366
|
if (tag !== "MetricFilterCard") return next;
|
|
1349
1367
|
// A card already lifted (content two slots deep passes through here twice) keeps its
|
|
1350
1368
|
// one selected: a second would fail jsx-no-duplicate-props (tic-page-queues-c, 19 Nov).
|
|
@@ -1407,7 +1425,23 @@ function liftRecordData(code, node, ctx, path, scope = scopeName(node)) {
|
|
|
1407
1425
|
});
|
|
1408
1426
|
out = rewriteTags(out, "PiiText", (attrs) => {
|
|
1409
1427
|
const hint = new RegExp(String.raw`\bmaskHint=${LITERAL}`).exec(attrs);
|
|
1410
|
-
|
|
1428
|
+
// A person in a fact row's value is the served pair, as a table's person cell is: the page
|
|
1429
|
+
// passes the server's hint and disposition with its value, model and relation, so a
|
|
1430
|
+
// colleague HR withholds reads HR's hint, not "Restricted". Both are optional, the hint
|
|
1431
|
+
// too where Figma drew one (the server may send none), and the relation still decides
|
|
1432
|
+
// self, so nothing here can force a mask (P-10; DESIGN-SYSTEM-993).
|
|
1433
|
+
const hintProp = () => (ctx.factValue ? (lifted.push("maskHint"), optionalMark(ctx, scope, "maskHint")) : lift(scope, "maskHint"));
|
|
1434
|
+
let next = hint ? attrs.replace(hint[0], `maskHint={${hintProp()}}`) : attrs;
|
|
1435
|
+
if (ctx.factValue) {
|
|
1436
|
+
for (const prop of FACT_PII_PROPS) {
|
|
1437
|
+
if (new RegExp(String.raw`\b${prop}=`).test(next)) continue;
|
|
1438
|
+
lifted.push(prop);
|
|
1439
|
+
const attr = ` ${prop}={${optionalMark(ctx, scope, prop)}}`;
|
|
1440
|
+
const after = topLevelAttr(next, prop === "disposition" ? "maskHint" : "relation") ?? topLevelAttr(next, "relation");
|
|
1441
|
+
next = after ? `${next.slice(0, after.to)}${attr}${next.slice(after.to)}` : next.replace(/(\s*\/?\s*)$/, `${attr}$1`);
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
return next;
|
|
1411
1445
|
});
|
|
1412
1446
|
// A title or label that dates or counts a record ("Headcount over time · 27 May 2026 to
|
|
1413
1447
|
// 25 Aug 2026", "Q3 2026 Performance Review", "Pay events 2027") is the record's; fixed copy
|
|
@@ -2831,7 +2865,8 @@ function emitNode(node, ctx) {
|
|
|
2831
2865
|
return comment(`unmapped: slot ${JSON.stringify(prop)} has no auto layout`);
|
|
2832
2866
|
}
|
|
2833
2867
|
const textOwner = TEXT_PROPERTY_PARTS.has(node.instance.set) ? node.instance.set : ctx.textOwner;
|
|
2834
|
-
const
|
|
2868
|
+
const factValue = FACT_VALUE_SLOTS.get(node.instance.set) === prop;
|
|
2869
|
+
const slotCtx = { ...ctx, depth: 0, parent: slotNode, grand: null, path: `${path} › ${prop}`, root: false, textOwner, slotOwner: owner, factValue, inTable: false, inSlot: true, chain: slotNode ? [...chain, slotNode] : chain, layer: `${ctx.layer}${nestedPath.map(part => ` › ${part}`).join("")} › ${prop}` };
|
|
2835
2870
|
const inner = emitChildren(slotNode?.children ?? [], (c) => emitNode(c, slotCtx), slotCtx);
|
|
2836
2871
|
return inner.length === 0 ? "<></>" : inner.length === 1 ? inner[0] : `<>\n${inner.map((x) => indent(x, 1)).join("\n")}\n</>`;
|
|
2837
2872
|
};
|
|
@@ -4140,6 +4175,17 @@ function tableOf(node, ctx) {
|
|
|
4140
4175
|
indent("))}", depth + 2),
|
|
4141
4176
|
];
|
|
4142
4177
|
};
|
|
4178
|
+
// A header's select-all drawn as a bare Checkbox (a Table Rich Cell holding one, where the DS's
|
|
4179
|
+
// header selection cell is TableSelectionCell) has no text beside it to name it, so axe fails
|
|
4180
|
+
// button-name on every list state. It takes the name the DS gives its own header selection
|
|
4181
|
+
// cell, through the Checkbox's own aria-label; a name the frame gives it stays (cli-282).
|
|
4182
|
+
const nameSelectAll = (code) =>
|
|
4183
|
+
/<Checkbox\b/.test(code ?? "")
|
|
4184
|
+
? rewriteTags(code, "Checkbox", (attrs) => {
|
|
4185
|
+
const parsed = tagAttributes(`${attrs}>`, 0);
|
|
4186
|
+
return !parsed || parsed.names.some((name) => name === "aria-label" || name === "aria-labelledby") ? attrs : ` aria-label="Select all rows"${attrs}`;
|
|
4187
|
+
})
|
|
4188
|
+
: code;
|
|
4143
4189
|
const section = (kind, tag) => {
|
|
4144
4190
|
const list = parsed.filter((p) => p.kind === kind || (kind === "body" && p.kind === GROUP));
|
|
4145
4191
|
if (!list.length) return [];
|
|
@@ -4149,7 +4195,7 @@ function tableOf(node, ctx) {
|
|
|
4149
4195
|
? [skeletonRows()]
|
|
4150
4196
|
: kind === "body" && liftable
|
|
4151
4197
|
? liftedRows()
|
|
4152
|
-
: list.flatMap((p) => (p.unrecognised ? [indent(comment(p.unrecognised), depth + 2)] : [indent("<TableRow>", depth + 2), ...p.cells.map((c, i) => (p === headRow ? liftHeading(controlSort(cellCode(c, p.row, depth + 3, headKeys[i]), headKeys[i]), headKeys[i]) : p.kind === GROUP && columnCount ? cellCode(c, p.row, depth + 3, null).replace(/^(\s*<\w+)(?:\s+width=(?:\{[^}]*\}|"[^"]*"))?/, `$1 colSpan={${columnCount}} scope="colgroup"`) : withAlign(cellCode(c, p.row, depth + 3, null), i))), indent("</TableRow>", depth + 2)]))),
|
|
4198
|
+
: list.flatMap((p) => (p.unrecognised ? [indent(comment(p.unrecognised), depth + 2)] : [indent("<TableRow>", depth + 2), ...p.cells.map((c, i) => (p === headRow ? nameSelectAll(liftHeading(controlSort(cellCode(c, p.row, depth + 3, headKeys[i]), headKeys[i]), headKeys[i])) : p.kind === GROUP && columnCount ? cellCode(c, p.row, depth + 3, null).replace(/^(\s*<\w+)(?:\s+width=(?:\{[^}]*\}|"[^"]*"))?/, `$1 colSpan={${columnCount}} scope="colgroup"`) : withAlign(cellCode(c, p.row, depth + 3, null), i))), indent("</TableRow>", depth + 2)]))),
|
|
4153
4199
|
indent(`</${tag}>`, depth + 1),
|
|
4154
4200
|
];
|
|
4155
4201
|
};
|