@nodii/dev 0.6.202 → 0.6.203
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 +3 -1
- package/dist/core.js +1 -1
- package/dist/surface.js +27 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1410,7 +1410,9 @@ product-page catalog names the Surface by its published component-set key
|
|
|
1410
1410
|
only (a loading row) is a body row of that table when it has as many cells as
|
|
1411
1411
|
the rows of Table parts; rows of frames alone are never a table. A row with
|
|
1412
1412
|
any head part is a header row, and a body part in it (a select-all Rich Cell)
|
|
1413
|
-
keeps its own code.
|
|
1413
|
+
keeps its own code. A bare `Checkbox` in a header row, which has no text to
|
|
1414
|
+
name it, takes `aria-label="Select all rows"`, the name the DS gives its own
|
|
1415
|
+
header `TableSelectionCell`; a name the frame gives it stays. What follows the rows (an Empty or Error State, bare, in
|
|
1414
1416
|
its own frame, or as a last row holding one DS instance) follows the Table.
|
|
1415
1417
|
- **A Table's loading state (U07-34.15.3).** The Table cell template emits
|
|
1416
1418
|
`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.203";
|
|
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 = 56;
|
|
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
|
|
@@ -1329,9 +1329,17 @@ function liftRecordData(code, node, ctx, path, scope = scopeName(node)) {
|
|
|
1329
1329
|
if (!ctx.inTable) {
|
|
1330
1330
|
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
1331
|
}
|
|
1332
|
-
//
|
|
1333
|
-
//
|
|
1334
|
-
|
|
1332
|
+
// Figma's Metric Card preset=status draws its description row as the chip, an exposed Badge
|
|
1333
|
+
// with its own label, and has no caption layer at all: `showCaption` shows or hides that chip,
|
|
1334
|
+
// and the set's `caption` text rides on the instance unseen. MetricStatus draws its chip in
|
|
1335
|
+
// place of the caption too. So a card whose frame shows the row keeps its chip and drops the
|
|
1336
|
+
// caption, and one whose frame hides it (showCaption off) draws neither, never an empty chip
|
|
1337
|
+
// (cli-282; NODII-DEV-CLI-244 had read the hidden caption as the drawn line).
|
|
1338
|
+
out = rewriteTags(out, "MetricStatus", (attrs) => {
|
|
1339
|
+
const chip = /\n?[ \t]*\bchip=\{\{[^{}]*\}\}/;
|
|
1340
|
+
if (node.instance?.props?.showCaption === false) return attrs.replace(chip, "");
|
|
1341
|
+
return chip.test(attrs) ? attrs.replace(/\n?[ \t]*\bcaption=(?:"(?:[^"\\\n]|\\.)*"|\{[^{}]*\})/, "") : attrs;
|
|
1342
|
+
});
|
|
1335
1343
|
out = rewriteTags(out, String.raw`Metric(?!CardGroup\b)[A-Za-z]*`, (attrs, tag) => {
|
|
1336
1344
|
const name = new RegExp(String.raw`\b(?:title|label)=(${LITERAL})`).exec(attrs);
|
|
1337
1345
|
const at = name && nameText(literalText(name[1])) ? nameOf(literalText(name[1])) : scope;
|
|
@@ -1345,6 +1353,9 @@ function liftRecordData(code, node, ctx, path, scope = scopeName(node)) {
|
|
|
1345
1353
|
// the frame's green (NODII-DEV-CLI-239).
|
|
1346
1354
|
const chipTone = /(\bchip=\{\{[^{}]*?\btone:\s*)"(?:[^"\\\n]|\\.)*"/.exec(next);
|
|
1347
1355
|
if (chipTone) next = next.replace(chipTone[0], `${chipTone[1]}${lift(at, "chipTone")}`);
|
|
1356
|
+
// Its label too, named by the card as its tone is, never by its place (`metricCard1ChipLabel`; cli-282).
|
|
1357
|
+
const chipLabel = /(\bchip=\{\{\s*label:\s*)chipLabel\b/.exec(next);
|
|
1358
|
+
if (chipLabel) next = next.replace(chipLabel[0], `${chipLabel[1]}${lift(at, "chipLabel")}`);
|
|
1348
1359
|
if (tag !== "MetricFilterCard") return next;
|
|
1349
1360
|
// A card already lifted (content two slots deep passes through here twice) keeps its
|
|
1350
1361
|
// one selected: a second would fail jsx-no-duplicate-props (tic-page-queues-c, 19 Nov).
|
|
@@ -4140,6 +4151,17 @@ function tableOf(node, ctx) {
|
|
|
4140
4151
|
indent("))}", depth + 2),
|
|
4141
4152
|
];
|
|
4142
4153
|
};
|
|
4154
|
+
// A header's select-all drawn as a bare Checkbox (a Table Rich Cell holding one, where the DS's
|
|
4155
|
+
// header selection cell is TableSelectionCell) has no text beside it to name it, so axe fails
|
|
4156
|
+
// button-name on every list state. It takes the name the DS gives its own header selection
|
|
4157
|
+
// cell, through the Checkbox's own aria-label; a name the frame gives it stays (cli-282).
|
|
4158
|
+
const nameSelectAll = (code) =>
|
|
4159
|
+
/<Checkbox\b/.test(code ?? "")
|
|
4160
|
+
? rewriteTags(code, "Checkbox", (attrs) => {
|
|
4161
|
+
const parsed = tagAttributes(`${attrs}>`, 0);
|
|
4162
|
+
return !parsed || parsed.names.some((name) => name === "aria-label" || name === "aria-labelledby") ? attrs : ` aria-label="Select all rows"${attrs}`;
|
|
4163
|
+
})
|
|
4164
|
+
: code;
|
|
4143
4165
|
const section = (kind, tag) => {
|
|
4144
4166
|
const list = parsed.filter((p) => p.kind === kind || (kind === "body" && p.kind === GROUP));
|
|
4145
4167
|
if (!list.length) return [];
|
|
@@ -4149,7 +4171,7 @@ function tableOf(node, ctx) {
|
|
|
4149
4171
|
? [skeletonRows()]
|
|
4150
4172
|
: kind === "body" && liftable
|
|
4151
4173
|
? 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)]))),
|
|
4174
|
+
: 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
4175
|
indent(`</${tag}>`, depth + 1),
|
|
4154
4176
|
];
|
|
4155
4177
|
};
|