@andespindola/brainlink 0.1.0-beta.55 → 0.1.0-beta.56
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.
|
@@ -7,7 +7,7 @@ const renderNodeBudget = 900
|
|
|
7
7
|
const renderEdgeBudget = 2400
|
|
8
8
|
const clusterActivationNodeThreshold = 600
|
|
9
9
|
const clusterZoomThreshold = 0.18
|
|
10
|
-
const macroGalaxyZoomThreshold = 0.
|
|
10
|
+
const macroGalaxyZoomThreshold = 0.0012
|
|
11
11
|
const massiveAutoFitMacroScale = 0.006
|
|
12
12
|
const defaultMacroScale = 0.006
|
|
13
13
|
const clusterCellPixelSize = 64
|
|
@@ -235,6 +235,7 @@ const normalizeQuery = value => value.trim().toLowerCase()
|
|
|
235
235
|
const hubNodeRetentionLimit = 2
|
|
236
236
|
const hubNodePattern = /\b(memory\s*hub|knowledge\s*hub|hub|moc|map|memory\s*map|mapa)\b/i
|
|
237
237
|
const memoryHubPathPattern = /\bmemory[-_\s]*hub\b/i
|
|
238
|
+
const isMemoryHubNode = node => node.title.trim().toLowerCase() === 'memory hub'
|
|
238
239
|
|
|
239
240
|
const hubNodeScore = node => {
|
|
240
241
|
const title = node.title.trim().toLowerCase()
|
|
@@ -309,14 +310,13 @@ const resolveMacroRepresentative = (nodes) => {
|
|
|
309
310
|
return null
|
|
310
311
|
}
|
|
311
312
|
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
let best = hubCandidate ?? nodes[0]
|
|
313
|
+
const nonHubNodes = nodes.filter(node => !isMemoryHubNode(node))
|
|
314
|
+
const pool = nonHubNodes.length > 0 ? nonHubNodes : nodes
|
|
315
|
+
let best = pool[0]
|
|
316
316
|
let bestDegree = state.nodeDegrees.get(best.id) ?? 0
|
|
317
317
|
|
|
318
|
-
for (let index = 1; index <
|
|
319
|
-
const node =
|
|
318
|
+
for (let index = 1; index < pool.length; index += 1) {
|
|
319
|
+
const node = pool[index]
|
|
320
320
|
const degree = state.nodeDegrees.get(node.id) ?? 0
|
|
321
321
|
if (degree > bestDegree) {
|
|
322
322
|
best = node
|
|
@@ -826,9 +826,7 @@ const fitView = (options = { useFiltered: true, macro: false, preferHubCenter: t
|
|
|
826
826
|
const macroScale = nodes.length > massiveGraphNodeThreshold ? massiveAutoFitMacroScale : defaultMacroScale
|
|
827
827
|
const scale = options.macro && nodes.length > 1
|
|
828
828
|
? clampScale(Math.min(baselineScale, macroScale))
|
|
829
|
-
:
|
|
830
|
-
? clampScale(Math.min(baselineScale, massiveAutoFitMacroScale))
|
|
831
|
-
: baselineScale
|
|
829
|
+
: baselineScale
|
|
832
830
|
const hubCenter =
|
|
833
831
|
options.preferHubCenter && state.primaryHub && nodes.some((node) => node.id === state.primaryHub.id)
|
|
834
832
|
? state.primaryHub
|
|
@@ -846,7 +844,7 @@ const fitView = (options = { useFiltered: true, macro: false, preferHubCenter: t
|
|
|
846
844
|
markRenderDirty()
|
|
847
845
|
}
|
|
848
846
|
|
|
849
|
-
const resetView = () => fitView({ useFiltered: false, macro:
|
|
847
|
+
const resetView = () => fitView({ useFiltered: false, macro: false, preferHubCenter: true })
|
|
850
848
|
|
|
851
849
|
const createLayout = graph => {
|
|
852
850
|
const nodeRows = Array.isArray(graph.nodes) ? graph.nodes : []
|
|
@@ -1201,7 +1199,7 @@ const computeRenderVisibility = () => {
|
|
|
1201
1199
|
if (shouldRenderMacroGalaxy) {
|
|
1202
1200
|
const viewportNodes = viewportNodesFromSpatialIndex(viewport)
|
|
1203
1201
|
const sourceNodes = viewportNodes.length > 0 ? viewportNodes : state.visibleNodes
|
|
1204
|
-
const representative = state.
|
|
1202
|
+
const representative = state.macroRepresentative ?? sourceNodes[0] ?? null
|
|
1205
1203
|
if (representative) {
|
|
1206
1204
|
state.renderClusters = [
|
|
1207
1205
|
{
|
|
@@ -1449,13 +1447,6 @@ const render = now => {
|
|
|
1449
1447
|
ctx.lineWidth = 1.4 / safeScale
|
|
1450
1448
|
ctx.strokeStyle = isMacro ? '#ffffff' : graphTheme.nodeStroke
|
|
1451
1449
|
ctx.stroke()
|
|
1452
|
-
if (isMacro && cluster.representative?.title) {
|
|
1453
|
-
ctx.fillStyle = '#edf2f7'
|
|
1454
|
-
ctx.font = 12 / safeScale + 'px Inter, system-ui, sans-serif'
|
|
1455
|
-
ctx.textAlign = 'center'
|
|
1456
|
-
ctx.textBaseline = 'top'
|
|
1457
|
-
ctx.fillText(cluster.representative.title.slice(0, 28), cluster.x, cluster.y + (radiusPx + 9) / safeScale)
|
|
1458
|
-
}
|
|
1459
1450
|
// Keep cluster markers minimal and faster to draw on large graphs.
|
|
1460
1451
|
})
|
|
1461
1452
|
} else {
|
package/package.json
CHANGED