code-kg 0.1.8 → 0.1.10
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/server/ui.js +52 -30
- package/dist/server/ui.js.map +1 -1
- package/package.json +1 -1
package/dist/server/ui.js
CHANGED
|
@@ -577,12 +577,14 @@ function renderUiHtml() {
|
|
|
577
577
|
const WASM_LAYOUT_ASSET = '/assets/vendor/graph-layout.wasm';
|
|
578
578
|
const WASM_LAYOUT_ITERATIONS = 56;
|
|
579
579
|
const WASM_WORKER_TIMEOUT_MS = 9000;
|
|
580
|
-
const EDGE_CHUNK_THRESHOLD =
|
|
581
|
-
const EDGE_CHUNK_SIZE =
|
|
580
|
+
const EDGE_CHUNK_THRESHOLD = 50000;
|
|
581
|
+
const EDGE_CHUNK_SIZE = 15000;
|
|
582
582
|
const AUX_LOAD_DELAY_MS = 120;
|
|
583
|
+
const POINTER_INTERACTION_MAX_NODES = 6000;
|
|
584
|
+
const POINTER_INTERACTION_MAX_EDGES = 15000;
|
|
583
585
|
|
|
584
586
|
const state = {
|
|
585
|
-
view: '
|
|
587
|
+
view: 'all',
|
|
586
588
|
graph: null,
|
|
587
589
|
graphData: { nodes: [], links: [], nodeById: new Map() },
|
|
588
590
|
graphMeta: null,
|
|
@@ -1216,14 +1218,32 @@ function renderUiHtml() {
|
|
|
1216
1218
|
graph.d3VelocityDecay(usingWasmLayout ? 0.9 : mode === 'normal' ? 0.28 : mode === 'degraded' ? 0.4 : 0.58);
|
|
1217
1219
|
}
|
|
1218
1220
|
if (typeof graph.nodeResolution === 'function') {
|
|
1219
|
-
graph.nodeResolution(mode === 'normal' ?
|
|
1221
|
+
graph.nodeResolution(mode === 'normal' ? 6 : mode === 'degraded' ? 4 : 3);
|
|
1220
1222
|
}
|
|
1221
1223
|
if (typeof graph.linkResolution === 'function') {
|
|
1222
|
-
graph.linkResolution(mode === 'normal' ?
|
|
1224
|
+
graph.linkResolution(mode === 'normal' ? 2 : 1);
|
|
1223
1225
|
}
|
|
1224
1226
|
|
|
1225
|
-
graph.linkOpacity(mode === 'normal' ? 0.
|
|
1226
|
-
graph.nodeRelSize(mode === 'normal' ? 1.
|
|
1227
|
+
graph.linkOpacity(mode === 'normal' ? 0.62 : mode === 'degraded' ? 0.5 : 0.38);
|
|
1228
|
+
graph.nodeRelSize(mode === 'normal' ? 1.1 : mode === 'degraded' ? 0.95 : 0.82);
|
|
1229
|
+
|
|
1230
|
+
const totalNodes = state.graphMeta && typeof state.graphMeta.totalNodes === 'number'
|
|
1231
|
+
? state.graphMeta.totalNodes
|
|
1232
|
+
: state.graphData.nodes.length;
|
|
1233
|
+
const totalEdges = state.graphMeta && typeof state.graphMeta.totalEdges === 'number'
|
|
1234
|
+
? state.graphMeta.totalEdges
|
|
1235
|
+
: state.graphData.links.length;
|
|
1236
|
+
const allowPointerInteraction =
|
|
1237
|
+
totalNodes <= POINTER_INTERACTION_MAX_NODES &&
|
|
1238
|
+
totalEdges <= POINTER_INTERACTION_MAX_EDGES &&
|
|
1239
|
+
mode === 'normal';
|
|
1240
|
+
|
|
1241
|
+
if (typeof graph.enablePointerInteraction === 'function') {
|
|
1242
|
+
graph.enablePointerInteraction(allowPointerInteraction);
|
|
1243
|
+
}
|
|
1244
|
+
if (typeof graph.enableNodeDrag === 'function') {
|
|
1245
|
+
graph.enableNodeDrag(false);
|
|
1246
|
+
}
|
|
1227
1247
|
|
|
1228
1248
|
if (typeof graph.d3Force === 'function') {
|
|
1229
1249
|
const currentCharge = graph.d3Force('charge');
|
|
@@ -1250,10 +1270,10 @@ function renderUiHtml() {
|
|
|
1250
1270
|
if (renderer && typeof renderer.setPixelRatio === 'function') {
|
|
1251
1271
|
const deviceRatio = window.devicePixelRatio || 1;
|
|
1252
1272
|
const targetRatio = mode === 'normal'
|
|
1253
|
-
? Math.min(
|
|
1273
|
+
? Math.min(1.6, deviceRatio)
|
|
1254
1274
|
: mode === 'degraded'
|
|
1255
|
-
? Math.min(1.
|
|
1256
|
-
:
|
|
1275
|
+
? Math.min(1.2, deviceRatio)
|
|
1276
|
+
: Math.min(0.9, deviceRatio);
|
|
1257
1277
|
renderer.setPixelRatio(targetRatio);
|
|
1258
1278
|
}
|
|
1259
1279
|
} catch (_error) {
|
|
@@ -1356,7 +1376,12 @@ function renderUiHtml() {
|
|
|
1356
1376
|
return false;
|
|
1357
1377
|
}
|
|
1358
1378
|
|
|
1359
|
-
const graph = window.ForceGraph3D(
|
|
1379
|
+
const graph = window.ForceGraph3D({
|
|
1380
|
+
rendererConfig: {
|
|
1381
|
+
antialias: false,
|
|
1382
|
+
powerPreference: 'high-performance'
|
|
1383
|
+
}
|
|
1384
|
+
})(els.graphCanvas)
|
|
1360
1385
|
.backgroundColor('#01040f')
|
|
1361
1386
|
.showNavInfo(false)
|
|
1362
1387
|
.nodeOpacity(0.92)
|
|
@@ -1387,10 +1412,10 @@ function renderUiHtml() {
|
|
|
1387
1412
|
return link.__color || '#82cf34';
|
|
1388
1413
|
})
|
|
1389
1414
|
.linkWidth((link) => {
|
|
1390
|
-
const base = state.perfMode === 'normal' ? 0.
|
|
1391
|
-
const highlight = state.perfMode === 'normal' ?
|
|
1392
|
-
|
|
1393
|
-
|
|
1415
|
+
const base = state.perfMode === 'normal' ? 0.95 : state.perfMode === 'degraded' ? 0.72 : 0.52;
|
|
1416
|
+
const highlight = state.perfMode === 'normal' ? 1.9 : state.perfMode === 'degraded' ? 1.45 : 1.1;
|
|
1417
|
+
return link.__highlight ? highlight : base;
|
|
1418
|
+
})
|
|
1394
1419
|
.linkVisibility((link) => link.__renderVisible !== false)
|
|
1395
1420
|
.linkDirectionalParticles((link) => {
|
|
1396
1421
|
return link.__highlight ? (state.perfMode === 'normal' ? 2 : 1) : 0;
|
|
@@ -1537,6 +1562,17 @@ function renderUiHtml() {
|
|
|
1537
1562
|
if (view === 'moduleGraph' || view === 'symbolGraph') {
|
|
1538
1563
|
return 0;
|
|
1539
1564
|
}
|
|
1565
|
+
if (view === 'all' || view === 'fileDeps') {
|
|
1566
|
+
const counts = state.lastMeta && state.lastMeta.counts ? state.lastMeta.counts : null;
|
|
1567
|
+
const totalNodes = counts && typeof counts.nodes === 'number' ? counts.nodes : 0;
|
|
1568
|
+
if (totalNodes >= 260000) {
|
|
1569
|
+
return 52000;
|
|
1570
|
+
}
|
|
1571
|
+
if (totalNodes >= 180000) {
|
|
1572
|
+
return 76000;
|
|
1573
|
+
}
|
|
1574
|
+
return 0;
|
|
1575
|
+
}
|
|
1540
1576
|
const counts = state.lastMeta && state.lastMeta.counts ? state.lastMeta.counts : null;
|
|
1541
1577
|
const totalNodes = counts && typeof counts.nodes === 'number' ? counts.nodes : 0;
|
|
1542
1578
|
if (totalNodes >= 120000) {
|
|
@@ -1565,21 +1601,7 @@ function renderUiHtml() {
|
|
|
1565
1601
|
state.graphData.nodes.length,
|
|
1566
1602
|
state.graphData.links.length
|
|
1567
1603
|
);
|
|
1568
|
-
|
|
1569
|
-
? state.lastMeta.counts.nodes
|
|
1570
|
-
: normalizedMeta.totalNodes;
|
|
1571
|
-
const totalEdges = state.lastMeta && state.lastMeta.counts && typeof state.lastMeta.counts.edges === 'number'
|
|
1572
|
-
? state.lastMeta.counts.edges
|
|
1573
|
-
: normalizedMeta.totalEdges;
|
|
1574
|
-
state.graphMeta = {
|
|
1575
|
-
totalNodes: Math.max(normalizedMeta.totalNodes, totalNodes),
|
|
1576
|
-
totalEdges: Math.max(normalizedMeta.totalEdges, totalEdges),
|
|
1577
|
-
queryMs: normalizedMeta.queryMs,
|
|
1578
|
-
recommendedQualityMode: inferQualityMode(
|
|
1579
|
-
Math.max(normalizedMeta.totalNodes, totalNodes),
|
|
1580
|
-
Math.max(normalizedMeta.totalEdges, totalEdges)
|
|
1581
|
-
)
|
|
1582
|
-
};
|
|
1604
|
+
state.graphMeta = normalizedMeta;
|
|
1583
1605
|
const usedWasm = await applyWasmLayout(
|
|
1584
1606
|
view + ':' + state.graphData.nodes.length + ':' + state.graphData.links.length
|
|
1585
1607
|
);
|
package/dist/server/ui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/server/ui.ts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/server/ui.ts"],"names":[],"mappings":";;AAEA,oCAm8DC;AAr8DD,2DAAmE;AAEnE,SAAgB,YAAY;IAC1B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAqjBkB,gDAA4B,CAAC,aAAa;2BAC1C,gDAA4B,CAAC,aAAa;0BAC3C,gDAA4B,CAAC,YAAY;0BACzC,gDAA4B,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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