@nodii/dev 0.6.143 → 0.6.144

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 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.143";
7
+ export const VERSION = "0.6.144";
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
@@ -1091,6 +1091,9 @@ function nameHandlers(code, node, ctx, path, scope) {
1091
1091
  });
1092
1092
  }
1093
1093
 
1094
+ /** A label that is only an arrow glyph names the step it takes ("‹" is Previous, "›" is Next; hub-464). */
1095
+ const GLYPH_WORDS = [[/^[‹«←⟨]+$/, "Previous"], [/^[›»→⟩]+$/, "Next"], [/^[↑]+$/, "Up"], [/^[↓]+$/, "Down"]];
1096
+
1094
1097
  /**
1095
1098
  * The prop that hides a button the page shows only sometimes (a permission, a
1096
1099
  * state): `show<what it does>`, the words and the place of its own handler
@@ -1120,7 +1123,8 @@ const shownWhen = (condition, drawn, depth) => [indent(`{${condition} && (`, dep
1120
1123
 
1121
1124
  /** Text as a handler's words: no figure, at most five words, in camelCase; null when nothing is left. */
1122
1125
  function handlerWords(text) {
1123
- const words = (String(text ?? "").match(/[A-Za-z0-9]+/g) ?? []).filter((w) => /[A-Za-z]/.test(w)).slice(0, 5);
1126
+ const glyph = GLYPH_WORDS.find(([re]) => re.test(String(text ?? "").trim()))?.[1];
1127
+ const words = (String(glyph ?? text ?? "").match(/[A-Za-z0-9]+/g) ?? []).filter((w) => /[A-Za-z]/.test(w)).slice(0, 5);
1124
1128
  return words.length ? camelName(words.join(" ")) : null;
1125
1129
  }
1126
1130
 
@@ -1149,7 +1153,8 @@ function handlerLabel(tag, attrs, after, node) {
1149
1153
  }
1150
1154
  if (/\/\s*$/.test(attrs)) return null;
1151
1155
  const close = after.indexOf(`</${tag}>`);
1152
- const inner = close === -1 ? "" : after.slice(0, close);
1156
+ // `after` starts with the `>` that closes the opening tag; it is not the button's text.
1157
+ const inner = close === -1 ? "" : after.slice(after.startsWith(">") ? 1 : 0, close);
1153
1158
  const strings = [...inner.matchAll(/\{("(?:[^"\\\n]|\\.)*")\}/g)].map((m) => JSON.parse(m[1]));
1154
1159
  const bare = inner.replace(/<[^>]*>/g, " ").replace(/\{[^{}]*\}/g, " ").trim();
1155
1160
  return handlerWords(strings.length ? strings.join(" ") : bare) ?? (node ? handlerWords(node.name.replace(/^\s*button\b[\s·:\-–]*/i, "")) : null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/dev",
3
- "version": "0.6.143",
3
+ "version": "0.6.144",
4
4
  "description": "Agent CLI for Nodii Dev, reached through the platform edge",
5
5
  "type": "module",
6
6
  "bin": {