@nodii/dev 0.6.161 → 0.6.162
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 +11 -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.162";
|
|
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 = 28;
|
|
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). */
|
|
@@ -1587,7 +1587,16 @@ function liftFieldControls(code, node, ctx, lift, scope) {
|
|
|
1587
1587
|
const changeName = `on${cap(withWord ? joinName(at, word) : at)}Change`;
|
|
1588
1588
|
const value = `${valueAttr}={${lift(at, valueName)}}`;
|
|
1589
1589
|
let next = attrs.replace(change[0], `${change[1]}${handler}={${lift(at, changeName)}}`);
|
|
1590
|
-
|
|
1590
|
+
// Empty values in interactive templates are samples too. An option-only
|
|
1591
|
+
// MultiSelect snippet is an example option, not the editable trigger.
|
|
1592
|
+
const part = node.instance?.props?.control?.props?.part ?? node.instance?.props?.part;
|
|
1593
|
+
const empty = tag === "CurrencyInput" ? String.raw`|\{null\}`
|
|
1594
|
+
: tag === "MultiSelect" && part !== "option" ? String.raw`|\{\[\]\}` : "";
|
|
1595
|
+
const sample = INPUT_FAMILY.test(tag) ? "" : `|${SAMPLE_LITERAL}${empty}`;
|
|
1596
|
+
if (tag === "CurrencyInput") {
|
|
1597
|
+
next = next.replace(new RegExp(String.raw`(^|\s)currency=${LITERAL}`),
|
|
1598
|
+
(_, sp) => `${sp}currency={${lift(at, joinName(at, "currency"))}}`);
|
|
1599
|
+
}
|
|
1591
1600
|
const drawn = new RegExp(String.raw`(^|\s)(?:${valueAttr}=(?:${GENERIC_VALUE}${sample})|defaultValue=${LITERAL})`).exec(next);
|
|
1592
1601
|
if (drawn) return next.replace(drawn[0], `${drawn[1]}${value}`);
|
|
1593
1602
|
if (new RegExp(String.raw`(^|\s)${valueAttr}=`).test(next)) return next;
|