@andespindola/brainlink 0.1.0-beta.132 → 0.1.0-beta.133

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.
@@ -16,8 +16,10 @@ const hierarchyMicroEnterCoverage = 0.58
16
16
  const hierarchyMicroExitCoverage = 0.38
17
17
  const hierarchyMicroEnterScale = 0.18
18
18
  const hierarchyMicroExitScale = 0.12
19
- const hierarchyFocusedOnlyProgress = 0.5
20
- const hierarchyFocusedOnlyCoverage = 0.4
19
+ const hierarchyFocusAcquireCoverage = 0.52
20
+ const hierarchyFocusAcquireScale = 0.16
21
+ const hierarchyChildRevealPower = 4
22
+ const hierarchyFocusedOnlyProgress = 0.64
21
23
  const hierarchyChildGraphFitMargin = 1.28
22
24
  const minNodePixelRadius = 2.3
23
25
  const viewportPaddingPx = 280
@@ -1461,6 +1463,16 @@ const updateHierarchyFocusGroup = (groups, viewport) => {
1461
1463
  ? groups.find(group => group.id === state.hierarchyFocusGroupId) ?? null
1462
1464
  : null
1463
1465
  const currentCoverage = current ? groupViewportCoverage(current, viewport) : 0
1466
+ const hasActiveFocusedTransition =
1467
+ Boolean(current) &&
1468
+ state.zoomTransition.active &&
1469
+ state.zoomTransition.source === 'group' &&
1470
+ state.selected?.isGroupNode &&
1471
+ state.selected.groupId === current.id
1472
+
1473
+ if (hasActiveFocusedTransition) {
1474
+ return current
1475
+ }
1464
1476
 
1465
1477
  if (
1466
1478
  current &&
@@ -1479,8 +1491,8 @@ const updateHierarchyFocusGroup = (groups, viewport) => {
1479
1491
 
1480
1492
  if (
1481
1493
  candidate &&
1482
- state.transform.scale >= hierarchyMicroExitScale &&
1483
- candidate.coverage >= hierarchyMicroExitCoverage
1494
+ state.transform.scale >= hierarchyFocusAcquireScale &&
1495
+ candidate.coverage >= hierarchyFocusAcquireCoverage
1484
1496
  ) {
1485
1497
  state.hierarchyFocusGroupId = candidate.group.id
1486
1498
  if (candidate.group.childGroupIds.length > 0 && state.hierarchyFocusStack.at(-1) !== candidate.group.id) {
@@ -1498,9 +1510,23 @@ const updateHierarchyFocusGroup = (groups, viewport) => {
1498
1510
 
1499
1511
  const hierarchyViewportProgress = (group, viewport) => {
1500
1512
  const coverage = groupViewportCoverage(group, viewport)
1501
- const coverageProgress = (coverage - hierarchyMicroExitCoverage) / (hierarchyMicroEnterCoverage - hierarchyMicroExitCoverage)
1502
- const scaleProgress = (state.transform.scale - hierarchyMicroExitScale) / (hierarchyMicroEnterScale - hierarchyMicroExitScale)
1503
- return smoothProgress(Math.min(coverageProgress, scaleProgress))
1513
+ const coverageProgress = (coverage - hierarchyFocusAcquireCoverage) / (hierarchyMicroEnterCoverage - hierarchyFocusAcquireCoverage)
1514
+ const scaleProgress = (state.transform.scale - hierarchyFocusAcquireScale) / (hierarchyMicroEnterScale - hierarchyFocusAcquireScale)
1515
+ const viewportProgress = smoothProgress(Math.min(coverageProgress, scaleProgress))
1516
+ const hasActiveFocusedTransition =
1517
+ state.zoomTransition.active &&
1518
+ state.zoomTransition.source === 'group' &&
1519
+ state.selected?.isGroupNode &&
1520
+ state.selected.groupId === group.id
1521
+
1522
+ if (!hasActiveFocusedTransition) {
1523
+ return viewportProgress
1524
+ }
1525
+
1526
+ const targetSpan = Math.max(state.zoomTransition.targetScale - hierarchyFocusAcquireScale, 0.0001)
1527
+ const transitionScaleProgress = (state.transform.scale - hierarchyFocusAcquireScale) / targetSpan
1528
+ const transitionProgress = Math.pow(Math.max(0, Math.min(1, transitionScaleProgress)), 2.8)
1529
+ return Math.max(viewportProgress, transitionProgress)
1504
1530
  }
1505
1531
 
1506
1532
  const groupEdgesForRenderedGroups = (groupNodes) => {
@@ -1575,7 +1601,8 @@ const computeHierarchyRenderVisibility = (viewport) => {
1575
1601
  const focusChildGroups = focus.childGroupIds
1576
1602
  .map(groupId => state.groupById.get(groupId))
1577
1603
  .filter(Boolean)
1578
- const childLimit = Math.min(renderNodeBudget, Math.max(1, Math.floor(renderNodeBudget * progress)))
1604
+ const childRevealProgress = Math.pow(Math.max(0, Math.min(1, progress)), hierarchyChildRevealPower)
1605
+ const childLimit = Math.min(renderNodeBudget, Math.max(1, Math.floor(renderNodeBudget * childRevealProgress)))
1579
1606
  const focusRenderNode = groupNodes.find(node => node.groupId === focus.id) ?? createGroupRenderNode(focus)
1580
1607
  const arrangedChildren = focusChildGroups.length > 0
1581
1608
  ? arrangeChildGroupNodes(focusChildGroups, focus, focusRenderNode)
@@ -1584,9 +1611,7 @@ const computeHierarchyRenderVisibility = (viewport) => {
1584
1611
  .map(node => interpolateNodeFromGroup(node, focusRenderNode, progress))
1585
1612
  const childIds = new Set(childNodes.map(node => node.id))
1586
1613
  const childById = new Map(childNodes.map(node => [node.id, node]))
1587
- const isMicroView =
1588
- progress >= hierarchyFocusedOnlyProgress ||
1589
- groupViewportCoverage(focus, viewport) >= hierarchyFocusedOnlyCoverage
1614
+ const isMicroView = progress >= hierarchyFocusedOnlyProgress
1590
1615
  const visibleGroupNodes = isMicroView
1591
1616
  ? []
1592
1617
  : groupNodes.filter(node => node.groupId !== focus.id || progress < 0.92)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andespindola/brainlink",
3
- "version": "0.1.0-beta.132",
3
+ "version": "0.1.0-beta.133",
4
4
  "description": "Local-first knowledge memory for agents with Markdown, backlinks, indexing and context retrieval.",
5
5
  "type": "module",
6
6
  "license": "MIT",