@nodii/dev 0.6.168 → 0.6.171
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 +1 -1
- package/dist/surface.js +23 -2
- package/package.json +1 -1
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.
|
|
7
|
+
export const VERSION = "0.6.171";
|
|
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 =
|
|
35
|
+
export const GENERATOR_FORMAT = 38;
|
|
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). */
|
|
@@ -1016,6 +1016,15 @@ function liftRecordData(code, node, ctx, path, scope = scopeName(node)) {
|
|
|
1016
1016
|
const scope = nameOf(label ? literalText(label[1]) : node.name, node.name);
|
|
1017
1017
|
return `<DescriptionItem${attrs.replace(value[0], `value={${lift(scope, "value")}}`)}/>`;
|
|
1018
1018
|
});
|
|
1019
|
+
out = rewriteTags(out, "RightPaneIdentity", (attrs) => {
|
|
1020
|
+
const parsed = tagAttributes(`${attrs}>`, 0);
|
|
1021
|
+
if (!parsed) return attrs;
|
|
1022
|
+
const flat = maskStrings(attrs);
|
|
1023
|
+
return attrs.replace(new RegExp(String.raw`\b(number|name)=${LITERAL}`, "g"), (value, prop, at) => {
|
|
1024
|
+
const depth = [...flat.slice(0, at)].reduce((d, c) => d + (c === "{") - (c === "}"), 0);
|
|
1025
|
+
return depth === 0 && parsed.literals.has(prop) ? `${prop}={${lift(scope, prop)}}` : value;
|
|
1026
|
+
});
|
|
1027
|
+
});
|
|
1019
1028
|
out = rewriteTags(out, "DetailFact|RightPaneRow", (attrs) => {
|
|
1020
1029
|
const parsed = tagAttributes(`${attrs}>`, 0);
|
|
1021
1030
|
if (!parsed?.literals.has("value")) return attrs;
|
|
@@ -1892,6 +1901,10 @@ function dataProps(views, propsType) {
|
|
|
1892
1901
|
if (list) member(entry(list), "kind").set("\u0000kind", { raw: '"branch" | "leaf"' });
|
|
1893
1902
|
}
|
|
1894
1903
|
const itemList = (at, name) => (openers.some((o) => o.param === name) ? listAt(openers, at, name) : null);
|
|
1904
|
+
for (const m of body.matchAll(/onCheckedChange=\{([a-z][A-Za-z0-9]*) && \(\(checked\) => \1\(row\.id, checked\)\)\}/g)) {
|
|
1905
|
+
own(m[1], '(id: string, checked: Parameters<NonNullable<ComponentProps<typeof TableSelectionCell>["onCheckedChange"]>>[0]) => void');
|
|
1906
|
+
view.uses.add(m[1]);
|
|
1907
|
+
}
|
|
1895
1908
|
// hub-492: absence of a handler keeps an inert row noninteractive.
|
|
1896
1909
|
for (const m of body.matchAll(/onClick=\{([a-z][A-Za-z0-9]*)\?\.\(row\) \? undefined : ([a-z][A-Za-z0-9]*) \? \2\(row\) : ([a-z][A-Za-z0-9]*) && /g)) {
|
|
1897
1910
|
const list = listAt(openers, m.index, "row");
|
|
@@ -3200,7 +3213,8 @@ function tableOf(node, ctx) {
|
|
|
3200
3213
|
const rowsName = mark(ctx, listName, "rows", null);
|
|
3201
3214
|
let selectedKey = "isSelected";
|
|
3202
3215
|
while (keys.includes(selectedKey)) selectedKey += "Row";
|
|
3203
|
-
const
|
|
3216
|
+
const selectable = dataRows.some(p => p.cells.some(c => /<TableSelectionCell\b/.test(c.code ?? "")));
|
|
3217
|
+
const selection = selectable || dataRows.some(p => p.cells.some(c => c.selected)) ? ` selected={row.${selectedKey}}` : "";
|
|
3204
3218
|
// A row is a door to its record when the page passes a handler (U03-7; NODII-DEV-CLI-83).
|
|
3205
3219
|
const rowClick = mark(ctx, listName, "onRowClick", null);
|
|
3206
3220
|
const inert = mark(ctx, listName, "isRowInert", null);
|
|
@@ -3264,6 +3278,13 @@ function tableOf(node, ctx) {
|
|
|
3264
3278
|
open = own.slice(0, end + 1).replace(/\s*\/>$/, ">");
|
|
3265
3279
|
close = `</${tag}>`;
|
|
3266
3280
|
}
|
|
3281
|
+
// Selection is record data even when the drawing shows every row unchecked.
|
|
3282
|
+
if (/^<TableSelectionCell\b/.test(open)) {
|
|
3283
|
+
const change = mark(ctx, listName, "onRowSelectionChange", null);
|
|
3284
|
+
open = open.replace(/\bchecked=\{(?:true|false)\}/, `checked={row.${selectedKey}}`)
|
|
3285
|
+
.replace(/\bonCheckedChange=\{(?:__s\d+_)?onSelect\}/, `onCheckedChange={${change} && ((checked) => ${change}(row.id, checked))}`);
|
|
3286
|
+
return indent(`${open.slice(0, -1)} />`, depth + 4);
|
|
3287
|
+
}
|
|
3267
3288
|
// Two-line templates own the presentation; both lines belong to each row.
|
|
3268
3289
|
// Reserve every header key before naming secondary fields, so a column
|
|
3269
3290
|
// called "Environment secondary" cannot alias Environment's second line.
|