code-kg 0.1.7 → 0.1.9
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 +29 -14
- package/dist/server/ui.js.map +1 -1
- package/package.json +1 -1
package/dist/server/ui.js
CHANGED
|
@@ -580,6 +580,8 @@ function renderUiHtml() {
|
|
|
580
580
|
const EDGE_CHUNK_THRESHOLD = 20000;
|
|
581
581
|
const EDGE_CHUNK_SIZE = 7000;
|
|
582
582
|
const AUX_LOAD_DELAY_MS = 120;
|
|
583
|
+
const POINTER_INTERACTION_MAX_NODES = 9000;
|
|
584
|
+
const POINTER_INTERACTION_MAX_EDGES = 24000;
|
|
583
585
|
|
|
584
586
|
const state = {
|
|
585
587
|
view: 'moduleGraph',
|
|
@@ -1008,11 +1010,6 @@ function renderUiHtml() {
|
|
|
1008
1010
|
if (state.graphData.nodes.length === 0) {
|
|
1009
1011
|
return false;
|
|
1010
1012
|
}
|
|
1011
|
-
if (!(await ensureWasmLayout())) {
|
|
1012
|
-
return false;
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
const wasm = state.wasmLayout;
|
|
1016
1013
|
const nodeById = state.graphData.nodeById instanceof Map ? state.graphData.nodeById : new Map();
|
|
1017
1014
|
const nodeIndexById = new Map();
|
|
1018
1015
|
for (let index = 0; index < state.graphData.nodes.length; index += 1) {
|
|
@@ -1221,14 +1218,32 @@ function renderUiHtml() {
|
|
|
1221
1218
|
graph.d3VelocityDecay(usingWasmLayout ? 0.9 : mode === 'normal' ? 0.28 : mode === 'degraded' ? 0.4 : 0.58);
|
|
1222
1219
|
}
|
|
1223
1220
|
if (typeof graph.nodeResolution === 'function') {
|
|
1224
|
-
graph.nodeResolution(mode === 'normal' ?
|
|
1221
|
+
graph.nodeResolution(mode === 'normal' ? 6 : mode === 'degraded' ? 4 : 3);
|
|
1225
1222
|
}
|
|
1226
1223
|
if (typeof graph.linkResolution === 'function') {
|
|
1227
|
-
graph.linkResolution(mode === 'normal' ?
|
|
1224
|
+
graph.linkResolution(mode === 'normal' ? 3 : mode === 'degraded' ? 2 : 2);
|
|
1228
1225
|
}
|
|
1229
1226
|
|
|
1230
|
-
graph.linkOpacity(mode === 'normal' ? 0.
|
|
1231
|
-
graph.nodeRelSize(mode === 'normal' ? 1.
|
|
1227
|
+
graph.linkOpacity(mode === 'normal' ? 0.44 : mode === 'degraded' ? 0.34 : 0.26);
|
|
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
|
+
}
|
|
1232
1247
|
|
|
1233
1248
|
if (typeof graph.d3Force === 'function') {
|
|
1234
1249
|
const currentCharge = graph.d3Force('charge');
|
|
@@ -1255,10 +1270,10 @@ function renderUiHtml() {
|
|
|
1255
1270
|
if (renderer && typeof renderer.setPixelRatio === 'function') {
|
|
1256
1271
|
const deviceRatio = window.devicePixelRatio || 1;
|
|
1257
1272
|
const targetRatio = mode === 'normal'
|
|
1258
|
-
? Math.min(
|
|
1273
|
+
? Math.min(1.3, deviceRatio)
|
|
1259
1274
|
: mode === 'degraded'
|
|
1260
|
-
? Math.min(1.
|
|
1261
|
-
:
|
|
1275
|
+
? Math.min(1.0, deviceRatio)
|
|
1276
|
+
: 0.82;
|
|
1262
1277
|
renderer.setPixelRatio(targetRatio);
|
|
1263
1278
|
}
|
|
1264
1279
|
} catch (_error) {
|
|
@@ -1392,8 +1407,8 @@ function renderUiHtml() {
|
|
|
1392
1407
|
return link.__color || '#82cf34';
|
|
1393
1408
|
})
|
|
1394
1409
|
.linkWidth((link) => {
|
|
1395
|
-
const base = state.perfMode === 'normal' ? 0.
|
|
1396
|
-
const highlight = state.perfMode === 'normal' ?
|
|
1410
|
+
const base = state.perfMode === 'normal' ? 0.5 : state.perfMode === 'degraded' ? 0.36 : 0.28;
|
|
1411
|
+
const highlight = state.perfMode === 'normal' ? 1.4 : state.perfMode === 'degraded' ? 1.05 : 0.84;
|
|
1397
1412
|
return link.__highlight ? highlight : base;
|
|
1398
1413
|
})
|
|
1399
1414
|
.linkVisibility((link) => link.__renderVisible !== false)
|
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,oCAi8DC;AAn8DD,2DAAmE;AAEnE,SAAgB,YAAY;IAC1B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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