@nodii/dev 0.6.140 → 0.6.141
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 +12 -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.141";
|
|
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
|
@@ -538,7 +538,7 @@ export function emitSurface(tree, row, ds) {
|
|
|
538
538
|
used.add(state);
|
|
539
539
|
const fn = `${pascal(state)}View`;
|
|
540
540
|
const note = (path, kind, detail) => unmapped.push({ variant: variant.name, path, kind, detail });
|
|
541
|
-
const emitted = emitNode(pageBody(variant, row), { depth: 2, parent: null, path: variant.name, ds, imports, note, root: true, scopes, layers, layer: "", state, lists: new Map(), shapes, handlers: new Map() }) ?? "";
|
|
541
|
+
const emitted = emitNode(pageBody(variant, row), { depth: 2, parent: null, path: variant.name, row, ds, imports, note, root: true, scopes, layers, layer: "", state, lists: new Map(), shapes, handlers: new Map() }) ?? "";
|
|
542
542
|
// A view the generator can't lay out is no page at all: generation fails rather than ship
|
|
543
543
|
// an empty view (NODII-DEV-CLI-81).
|
|
544
544
|
if (emitted.trimStart().startsWith("{/*")) {
|
|
@@ -1769,6 +1769,17 @@ function emitNode(node, ctx) {
|
|
|
1769
1769
|
let own = rendered.code.trim().replace(/=\{<>\{([a-z][A-Za-z0-9]*)\}<\/>\}/g, "={$1}");
|
|
1770
1770
|
// A tab strip the page controls (tabOf reads the template's own strip first, to gather a run).
|
|
1771
1771
|
if (!ctx.tabProbe) own = own.replace(/<Tabs panelless(?: defaultValue="[^"]*")?>/g, CONTROLLED_TABS("tab", "onTabChange"));
|
|
1772
|
+
// An Alert that shows its actions with nothing in the slot draws no AlertAction, never an
|
|
1773
|
+
// empty one (hub-467). A tree read before nested slots were kept holds no actions slot at
|
|
1774
|
+
// all: it is stale and refused, as pageBody refuses an App Frame with no mainContent.
|
|
1775
|
+
own = own.replace(/\n?[ \t]*<AlertAction>\s*<><\/>\s*<\/AlertAction>/g, () => {
|
|
1776
|
+
if (!(node.children ?? []).some((c) => c.type === "SLOT" && c.slot === "actions")) {
|
|
1777
|
+
const row = ctx.row ?? { id: "surface", componentSetKey: "<componentSetKey>" };
|
|
1778
|
+
throw new CliError("SURFACE_TREE_STALE", `${row.id}: ${path} shows its actions, but its committed tree holds no actions slot (it was read before nested slots were kept); refetch it with \`nodii-dev surface generate ${row.componentSetKey} --fetch --write\``, 1);
|
|
1779
|
+
}
|
|
1780
|
+
note(`${path} › actions`, "slot", "the Alert shows its actions, but its actions slot is empty: an Alert with no action hides them (showActions off)");
|
|
1781
|
+
return "";
|
|
1782
|
+
});
|
|
1772
1783
|
const control = /^<(?:Input|Textarea|SelectField)\b/.test(own.replace(/^<Field\b[^>]*>\s*/, ""));
|
|
1773
1784
|
const toggle = TOGGLE.test(own) ? textNextTo(node, ctx) : null;
|
|
1774
1785
|
const scope = control ? fieldScope(node, ctx, own) : toggle ? camelName(toggle) : scopeName(node, own, ctx);
|