declare-cc 0.5.7 → 0.5.8
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/declare-tools.cjs +31 -9
- package/dist/public/app.js +11 -1
- package/package.json +1 -1
package/dist/declare-tools.cjs
CHANGED
|
@@ -1329,7 +1329,7 @@ var require_help = __commonJS({
|
|
|
1329
1329
|
usage: "/declare:help"
|
|
1330
1330
|
}
|
|
1331
1331
|
],
|
|
1332
|
-
version: "0.5.
|
|
1332
|
+
version: "0.5.8"
|
|
1333
1333
|
};
|
|
1334
1334
|
}
|
|
1335
1335
|
module2.exports = { runHelp: runHelp2 };
|
|
@@ -3831,6 +3831,7 @@ var require_server = __commonJS({
|
|
|
3831
3831
|
"use strict";
|
|
3832
3832
|
var http = require("node:http");
|
|
3833
3833
|
var fs = require("node:fs");
|
|
3834
|
+
var net = require("node:net");
|
|
3834
3835
|
var path = require("node:path");
|
|
3835
3836
|
var { runLoadGraph: runLoadGraph2 } = require_load_graph();
|
|
3836
3837
|
var { runStatus: runStatus2 } = require_status();
|
|
@@ -4068,11 +4069,28 @@ var require_server = __commonJS({
|
|
|
4068
4069
|
});
|
|
4069
4070
|
return server;
|
|
4070
4071
|
}
|
|
4071
|
-
function
|
|
4072
|
-
|
|
4072
|
+
function findFreePort(startPort) {
|
|
4073
|
+
return new Promise((resolve) => {
|
|
4074
|
+
const probe = net.createServer();
|
|
4075
|
+
probe.listen(startPort, "127.0.0.1", () => {
|
|
4076
|
+
const { port } = (
|
|
4077
|
+
/** @type {import('net').AddressInfo} */
|
|
4078
|
+
probe.address()
|
|
4079
|
+
);
|
|
4080
|
+
probe.close(() => resolve(port));
|
|
4081
|
+
});
|
|
4082
|
+
probe.on("error", () => resolve(findFreePort(startPort + 1)));
|
|
4083
|
+
});
|
|
4084
|
+
}
|
|
4085
|
+
async function startServer(cwd, port) {
|
|
4086
|
+
const preferredPort = port || parseInt(process.env.PORT || "", 10) || 3847;
|
|
4087
|
+
const resolvedPort = await findFreePort(preferredPort);
|
|
4073
4088
|
const server = createServer(cwd, resolvedPort);
|
|
4074
|
-
|
|
4075
|
-
|
|
4089
|
+
await new Promise((resolve) => {
|
|
4090
|
+
server.listen(resolvedPort, "127.0.0.1", () => {
|
|
4091
|
+
watchPlanning(cwd);
|
|
4092
|
+
resolve(void 0);
|
|
4093
|
+
});
|
|
4076
4094
|
});
|
|
4077
4095
|
const url = `http://localhost:${resolvedPort}`;
|
|
4078
4096
|
return { server, port: resolvedPort, url };
|
|
@@ -4092,9 +4110,9 @@ var require_serve = __commonJS({
|
|
|
4092
4110
|
const value = parseInt(args[idx + 1], 10);
|
|
4093
4111
|
return Number.isNaN(value) ? void 0 : value;
|
|
4094
4112
|
}
|
|
4095
|
-
function runServe2(cwd, args) {
|
|
4113
|
+
async function runServe2(cwd, args) {
|
|
4096
4114
|
const port = parsePortFlag(args) || parseInt(process.env.PORT || "", 10) || 3847;
|
|
4097
|
-
const { server, port: resolvedPort, url } = startServer(cwd, port);
|
|
4115
|
+
const { server, port: resolvedPort, url } = await startServer(cwd, port);
|
|
4098
4116
|
process.on("SIGINT", () => {
|
|
4099
4117
|
server.close(() => process.exit(0));
|
|
4100
4118
|
});
|
|
@@ -4368,8 +4386,12 @@ function main() {
|
|
|
4368
4386
|
}
|
|
4369
4387
|
case "serve": {
|
|
4370
4388
|
const cwdServe = parseCwdFlag(args) || process.cwd();
|
|
4371
|
-
|
|
4372
|
-
|
|
4389
|
+
runServe(cwdServe, args.slice(1)).then((result) => {
|
|
4390
|
+
console.log(JSON.stringify(result));
|
|
4391
|
+
}).catch((err) => {
|
|
4392
|
+
console.log(JSON.stringify({ error: err.message || String(err) }));
|
|
4393
|
+
process.exit(1);
|
|
4394
|
+
});
|
|
4373
4395
|
break;
|
|
4374
4396
|
}
|
|
4375
4397
|
case "record-session": {
|
package/dist/public/app.js
CHANGED
|
@@ -1274,7 +1274,7 @@ $refreshBtn.addEventListener('click', () => {
|
|
|
1274
1274
|
loadData();
|
|
1275
1275
|
});
|
|
1276
1276
|
|
|
1277
|
-
// ESC to exit focus mode
|
|
1277
|
+
// ESC to exit focus mode; arrow keys to navigate between declarations
|
|
1278
1278
|
document.addEventListener('keydown', (e) => {
|
|
1279
1279
|
if (e.key === 'Escape' && focusNodeId) {
|
|
1280
1280
|
document.querySelectorAll('.node.selected').forEach(el => el.classList.remove('selected'));
|
|
@@ -1282,6 +1282,16 @@ document.addEventListener('keydown', (e) => {
|
|
|
1282
1282
|
exitFocusMode();
|
|
1283
1283
|
if ($panelEmpty) $panelEmpty.style.display = '';
|
|
1284
1284
|
}
|
|
1285
|
+
|
|
1286
|
+
if ((e.key === 'ArrowLeft' || e.key === 'ArrowRight') && selectedNodeId && graphData) {
|
|
1287
|
+
const declarations = graphData.declarations;
|
|
1288
|
+
const idx = declarations.findIndex(d => d.id === selectedNodeId);
|
|
1289
|
+
if (idx === -1) return; // selected node is not a declaration
|
|
1290
|
+
const next = e.key === 'ArrowRight'
|
|
1291
|
+
? (idx + 1) % declarations.length
|
|
1292
|
+
: (idx - 1 + declarations.length) % declarations.length;
|
|
1293
|
+
selectNode(declarations[next].id, 'declaration');
|
|
1294
|
+
}
|
|
1285
1295
|
});
|
|
1286
1296
|
|
|
1287
1297
|
// Click on canvas background to exit focus mode
|
package/package.json
CHANGED