@nodii/dev 0.6.163 → 0.6.164
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 +27 -5
- 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.164";
|
|
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 = 33;
|
|
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). */
|
|
@@ -989,6 +989,17 @@ function liftRecordData(code, node, ctx, path, scope = scopeName(node)) {
|
|
|
989
989
|
const scope = nameOf(label ? literalText(label[1]) : node.name, node.name);
|
|
990
990
|
return `<DescriptionItem${attrs.replace(value[0], `value={${lift(scope, "value")}}`)}/>`;
|
|
991
991
|
});
|
|
992
|
+
out = rewriteTags(out, "DetailFact", (attrs) => {
|
|
993
|
+
const parsed = tagAttributes(`${attrs}>`, 0);
|
|
994
|
+
if (!parsed?.literals.has("value")) return attrs;
|
|
995
|
+
const label = parsed.literals.get("label");
|
|
996
|
+
const factScope = nameOf(label ? literalText(label) : node.name, node.name);
|
|
997
|
+
const flat = maskStrings(attrs);
|
|
998
|
+
return attrs.replace(new RegExp(String.raw`\bvalue=${LITERAL}`, "g"), (value, at) => {
|
|
999
|
+
const depth = [...flat.slice(0, at)].reduce((d, c) => d + (c === "{") - (c === "}"), 0);
|
|
1000
|
+
return depth === 0 ? `value={${lift(factScope, "value")}}` : value;
|
|
1001
|
+
});
|
|
1002
|
+
});
|
|
992
1003
|
out = out.replace(/<StatusPill\b([^>]*?)(\/?)>/g, (all, attrs, close) => {
|
|
993
1004
|
const label = new RegExp(String.raw`\blabel=${LITERAL}`).exec(attrs);
|
|
994
1005
|
if (!label) return all;
|
|
@@ -1091,7 +1102,14 @@ function liftRecordData(code, node, ctx, path, scope = scopeName(node)) {
|
|
|
1091
1102
|
out = rewriteTags(out, "PageSizeSelect", (attrs) => attrs.replace(/\bvalue=\{(?:\d+|Number\("(?:[^"\\\n]|\\.)*"\))\}/, () => `value={${lift(scope, "pageSize")}}`));
|
|
1092
1103
|
out = rewriteTags(out, "CopyField", (attrs) => {
|
|
1093
1104
|
const value = new RegExp(String.raw`\bvalue=${LITERAL}`).exec(attrs);
|
|
1094
|
-
|
|
1105
|
+
let next = value ? attrs.replace(value[0], `value={${lift(scope, "value")}}`) : attrs;
|
|
1106
|
+
const label = new RegExp(String.raw`\blabel=(${LITERAL})`).exec(next);
|
|
1107
|
+
if (label) {
|
|
1108
|
+
lifted.push("label");
|
|
1109
|
+
const name = optionalMark(ctx, scope, "label");
|
|
1110
|
+
next = next.replace(label[0], `label={${name} ?? ${JSON.stringify(literalText(label[1]))}}`);
|
|
1111
|
+
}
|
|
1112
|
+
return next;
|
|
1095
1113
|
});
|
|
1096
1114
|
out = rewriteTags(out, "PiiText", (attrs) => {
|
|
1097
1115
|
const hint = new RegExp(String.raw`\bmaskHint=${LITERAL}`).exec(attrs);
|
|
@@ -1873,7 +1891,7 @@ function dataProps(views, propsType) {
|
|
|
1873
1891
|
(entry(m[1]).tabValues ??= new Set()).add(JSON.parse(m[2]));
|
|
1874
1892
|
view.uses.add(m[1]);
|
|
1875
1893
|
}
|
|
1876
|
-
for (const m of body.matchAll(/([A-Za-z][\w-]*)=\{([a-z][A-Za-z0-9]*)(?:\.([A-Za-z][A-Za-z0-9]*))?(?: \?\? (?:true|false))?\}/g)) {
|
|
1894
|
+
for (const m of body.matchAll(/([A-Za-z][\w-]*)=\{([a-z][A-Za-z0-9]*)(?:\.([A-Za-z][A-Za-z0-9]*))?(?: \?\? (?:true|false|"(?:[^"\\]|\\.)*"))?\}/g)) {
|
|
1877
1895
|
if (JS_LITERALS.has(m[2]) || data.get(m[2])?.raw) continue;
|
|
1878
1896
|
const list = m[3] ? itemList(m.index, m[2]) : null;
|
|
1879
1897
|
// A list item's React key is its own: a string, never a DS prop.
|
|
@@ -2275,7 +2293,9 @@ function emitNode(node, ctx) {
|
|
|
2275
2293
|
return indent(comment(`unmapped: ${describe(node)} (${why})`), depth);
|
|
2276
2294
|
}
|
|
2277
2295
|
ctx.imports.push(...rendered.imports);
|
|
2278
|
-
|
|
2296
|
+
// Detail Section owns its grid. The Row template emits sibling facts,
|
|
2297
|
+
// not a layout box: a wrapper would turn the entire row into one grid cell.
|
|
2298
|
+
const sizing = ctx.bare || node.instance.set === "Detail Section / Row" ? [] : sizeClasses(node, parent, false);
|
|
2279
2299
|
// A data slot passed straight to a prop is that prop (`trailing={<>{trailing}</>}` → `trailing={trailing}`).
|
|
2280
2300
|
let own = rendered.code.trim().replace(/=\{<>\{([a-z][A-Za-z0-9]*)\}<\/>\}/g, "={$1}");
|
|
2281
2301
|
// The toolbar builds rows itself, so its template never renders the table slot.
|
|
@@ -2674,7 +2694,9 @@ function piiCellText({ cell, code }, ref) {
|
|
|
2674
2694
|
const { attrs = "", before = "", after = "" } = piiCellParts({ code }) ?? {};
|
|
2675
2695
|
const kind = piiTreeKind(cell);
|
|
2676
2696
|
const size = /\ssize="\w+"/.exec(attrs)?.[0] ?? "";
|
|
2677
|
-
|
|
2697
|
+
// Repeated people are a bulk disclosure surface even inside a record page or
|
|
2698
|
+
// a permissive ambient provider. Keep the served self relation unchanged.
|
|
2699
|
+
return `${before}<PiiText value={${ref}.value} kind="${kind}" model={${ref}.model} relation={${ref}.relation} maskHint={${ref}.maskHint} surface="bulk"${size} />${after}`;
|
|
2678
2700
|
}
|
|
2679
2701
|
|
|
2680
2702
|
/** Only a plain literal empty cell is compatible with a nullable person. */
|