@nodii/dev 0.6.159 → 0.6.160
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 +9 -1
- 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.160";
|
|
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
|
@@ -1132,6 +1132,14 @@ export const SAMPLE_VALUE = /₹\s?\d|\b\d{1,2} (?:Jan|Feb|Mar|Apr|May|Jun|Jul|A
|
|
|
1132
1132
|
const RELATIVE_PERIOD = /^(?:(?:this|last|previous|current|next) (?:day|week|month|quarter|year)|today|yesterday|tomorrow)$/i;
|
|
1133
1133
|
const RECORD_TEXT = (text) => SAMPLE_VALUE.test(text) || /\d/.test(text) || RELATIVE_PERIOD.test(text.trim());
|
|
1134
1134
|
|
|
1135
|
+
// A named fact frame is a label/value pair even when its value has no digits
|
|
1136
|
+
// (for example Status / Active). Keep the label and lift only the value.
|
|
1137
|
+
function isFactValue(node, parent) {
|
|
1138
|
+
if (parent?.type !== "FRAME" || !/^Fact\s*·\s*\S/.test(parent.name ?? "")) return false;
|
|
1139
|
+
const children = (parent.children ?? []).filter((child) => child.visible !== false);
|
|
1140
|
+
return children.length === 2 && children.every((child) => child.type === "TEXT") && children[1] === node;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1135
1143
|
/** A part named by where it sits: its parent's name, numbered when the parent holds several of the same set. */
|
|
1136
1144
|
function positionScope(node, ctx, kind) {
|
|
1137
1145
|
const siblings = (ctx.parent?.children ?? []).filter((c) => c.visible !== false && (node.instance ? c.instance?.set === node.instance.set : c.type === node.type));
|
|
@@ -2309,7 +2317,7 @@ function emitNode(node, ctx) {
|
|
|
2309
2317
|
]);
|
|
2310
2318
|
// Text naming a record's value (a date, an amount, a code) is Figma's sample: the page's own (NODII-DEV-CLI-82).
|
|
2311
2319
|
let content = JSON.stringify(node.text);
|
|
2312
|
-
if (RECORD_TEXT(node.text) && !ctx.textOwner) {
|
|
2320
|
+
if ((RECORD_TEXT(node.text) || isFactValue(node, parent)) && !ctx.textOwner) {
|
|
2313
2321
|
const scope = positionScope(node, ctx, "text");
|
|
2314
2322
|
const name = mark(ctx, scope, scope);
|
|
2315
2323
|
note(path, LIFTED, `text ${shown} names a record's value: lifted from Figma's sample into the page's props (NODII-DEV-CLI-82)`);
|