synabun 1.3.0

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.
Files changed (187) hide show
  1. package/CHANGELOG.md +665 -0
  2. package/LICENSE +191 -0
  3. package/README.md +853 -0
  4. package/hooks/claude-code/post-plan.mjs +391 -0
  5. package/hooks/claude-code/post-remember.mjs +239 -0
  6. package/hooks/claude-code/pre-compact.mjs +241 -0
  7. package/hooks/claude-code/pre-websearch.mjs +90 -0
  8. package/hooks/claude-code/prompt-submit.mjs +861 -0
  9. package/hooks/claude-code/session-start.mjs +494 -0
  10. package/hooks/claude-code/shared.mjs +368 -0
  11. package/hooks/claude-code/stop.mjs +646 -0
  12. package/hooks/claude-code/test-user-learning.mjs +531 -0
  13. package/mcp-server/package.json +38 -0
  14. package/mcp-server/run.mjs +10 -0
  15. package/mcp-server/src/config.ts +70 -0
  16. package/mcp-server/src/http.ts +93 -0
  17. package/mcp-server/src/index.ts +203 -0
  18. package/mcp-server/src/preload-http.ts +25 -0
  19. package/mcp-server/src/preload.ts +29 -0
  20. package/mcp-server/src/scripts/migrate-qdrant-to-sqlite.ts +506 -0
  21. package/mcp-server/src/services/categories.ts +429 -0
  22. package/mcp-server/src/services/discord.ts +702 -0
  23. package/mcp-server/src/services/file-checksums.ts +33 -0
  24. package/mcp-server/src/services/local-embeddings.ts +77 -0
  25. package/mcp-server/src/services/neural-interface.ts +344 -0
  26. package/mcp-server/src/services/sqlite.ts +823 -0
  27. package/mcp-server/src/tools/browser-advanced.ts +123 -0
  28. package/mcp-server/src/tools/browser-interact.ts +255 -0
  29. package/mcp-server/src/tools/browser-navigate.ts +77 -0
  30. package/mcp-server/src/tools/browser-observe.ts +1330 -0
  31. package/mcp-server/src/tools/browser.ts +107 -0
  32. package/mcp-server/src/tools/card-tools.ts +193 -0
  33. package/mcp-server/src/tools/card.ts +22 -0
  34. package/mcp-server/src/tools/category.ts +379 -0
  35. package/mcp-server/src/tools/discord-channel.ts +274 -0
  36. package/mcp-server/src/tools/discord-guild.ts +188 -0
  37. package/mcp-server/src/tools/discord-member.ts +158 -0
  38. package/mcp-server/src/tools/discord-message.ts +231 -0
  39. package/mcp-server/src/tools/discord-onboarding.ts +228 -0
  40. package/mcp-server/src/tools/discord-role.ts +209 -0
  41. package/mcp-server/src/tools/discord-thread.ts +110 -0
  42. package/mcp-server/src/tools/discord-webhook.ts +176 -0
  43. package/mcp-server/src/tools/discord.ts +40 -0
  44. package/mcp-server/src/tools/forget.ts +38 -0
  45. package/mcp-server/src/tools/git-tools.ts +141 -0
  46. package/mcp-server/src/tools/git.ts +13 -0
  47. package/mcp-server/src/tools/image-tools.ts +98 -0
  48. package/mcp-server/src/tools/image.ts +17 -0
  49. package/mcp-server/src/tools/leonardo-browser-tools.ts +281 -0
  50. package/mcp-server/src/tools/leonardo.ts +28 -0
  51. package/mcp-server/src/tools/loop.ts +348 -0
  52. package/mcp-server/src/tools/memories.ts +118 -0
  53. package/mcp-server/src/tools/recall.ts +323 -0
  54. package/mcp-server/src/tools/reflect.ts +145 -0
  55. package/mcp-server/src/tools/remember.ts +115 -0
  56. package/mcp-server/src/tools/response.ts +26 -0
  57. package/mcp-server/src/tools/restore.ts +34 -0
  58. package/mcp-server/src/tools/sync.ts +114 -0
  59. package/mcp-server/src/tools/tictactoe-tools.ts +98 -0
  60. package/mcp-server/src/tools/tictactoe.ts +13 -0
  61. package/mcp-server/src/tools/utils.ts +25 -0
  62. package/mcp-server/src/tools/whiteboard-tools.ts +260 -0
  63. package/mcp-server/src/tools/whiteboard.ts +22 -0
  64. package/mcp-server/src/tui.ts +940 -0
  65. package/mcp-server/src/types.ts +85 -0
  66. package/mcp-server/tsconfig.json +19 -0
  67. package/neural-interface/package.json +27 -0
  68. package/neural-interface/public/apple-touch-icon.png +0 -0
  69. package/neural-interface/public/category-logos/claude.svg +1 -0
  70. package/neural-interface/public/category-logos/gemini-color.svg +1 -0
  71. package/neural-interface/public/category-logos/openai.svg +1 -0
  72. package/neural-interface/public/category-logos/synabun.png +0 -0
  73. package/neural-interface/public/claude-chat.css +878 -0
  74. package/neural-interface/public/claude-chat.html +92 -0
  75. package/neural-interface/public/claude-chat.js +1168 -0
  76. package/neural-interface/public/favicon-16x16.png +0 -0
  77. package/neural-interface/public/favicon-32x32.png +0 -0
  78. package/neural-interface/public/gallery.svg +6 -0
  79. package/neural-interface/public/icon-192.png +0 -0
  80. package/neural-interface/public/icon-512.png +0 -0
  81. package/neural-interface/public/index-legacy.html +14677 -0
  82. package/neural-interface/public/index.html +212 -0
  83. package/neural-interface/public/index2d-legacy.html +8193 -0
  84. package/neural-interface/public/index2d.html +127 -0
  85. package/neural-interface/public/invite.html +351 -0
  86. package/neural-interface/public/leonardoai.svg +1 -0
  87. package/neural-interface/public/logo-synabun.png +0 -0
  88. package/neural-interface/public/logoHD.png +0 -0
  89. package/neural-interface/public/manifest.json +14 -0
  90. package/neural-interface/public/offline.html +299 -0
  91. package/neural-interface/public/onboarding.html +2335 -0
  92. package/neural-interface/public/openclaw-logo-text.png +0 -0
  93. package/neural-interface/public/pin-svgrepo-com.svg +25 -0
  94. package/neural-interface/public/sessionicon.svg +8 -0
  95. package/neural-interface/public/shared/ansi-parser.js +305 -0
  96. package/neural-interface/public/shared/api.js +1043 -0
  97. package/neural-interface/public/shared/colors.js +153 -0
  98. package/neural-interface/public/shared/constants.js +141 -0
  99. package/neural-interface/public/shared/html-shell.js +777 -0
  100. package/neural-interface/public/shared/html-term-renderer.js +1022 -0
  101. package/neural-interface/public/shared/i18n.js +147 -0
  102. package/neural-interface/public/shared/registry.js +82 -0
  103. package/neural-interface/public/shared/state.js +86 -0
  104. package/neural-interface/public/shared/storage.js +150 -0
  105. package/neural-interface/public/shared/styles.css +21212 -0
  106. package/neural-interface/public/shared/ui-automation-studio.js +3573 -0
  107. package/neural-interface/public/shared/ui-bookmarks.js +231 -0
  108. package/neural-interface/public/shared/ui-claude-panel.js +6333 -0
  109. package/neural-interface/public/shared/ui-command-runner.js +534 -0
  110. package/neural-interface/public/shared/ui-cost-widget.js +602 -0
  111. package/neural-interface/public/shared/ui-detail.js +1454 -0
  112. package/neural-interface/public/shared/ui-explorer.js +1356 -0
  113. package/neural-interface/public/shared/ui-file-explorer.js +2750 -0
  114. package/neural-interface/public/shared/ui-games.js +411 -0
  115. package/neural-interface/public/shared/ui-help.js +107 -0
  116. package/neural-interface/public/shared/ui-image-gallery.js +461 -0
  117. package/neural-interface/public/shared/ui-invite.js +519 -0
  118. package/neural-interface/public/shared/ui-keybinds.js +452 -0
  119. package/neural-interface/public/shared/ui-layouts.js +297 -0
  120. package/neural-interface/public/shared/ui-link.js +731 -0
  121. package/neural-interface/public/shared/ui-loading.js +255 -0
  122. package/neural-interface/public/shared/ui-menubar.js +499 -0
  123. package/neural-interface/public/shared/ui-multiselect.js +93 -0
  124. package/neural-interface/public/shared/ui-navbar.js +222 -0
  125. package/neural-interface/public/shared/ui-notifications.js +287 -0
  126. package/neural-interface/public/shared/ui-panels.js +309 -0
  127. package/neural-interface/public/shared/ui-resume.js +653 -0
  128. package/neural-interface/public/shared/ui-search.js +145 -0
  129. package/neural-interface/public/shared/ui-sessions.js +531 -0
  130. package/neural-interface/public/shared/ui-settings.js +5987 -0
  131. package/neural-interface/public/shared/ui-sidebar.js +1905 -0
  132. package/neural-interface/public/shared/ui-skills.js +2805 -0
  133. package/neural-interface/public/shared/ui-stats.js +38 -0
  134. package/neural-interface/public/shared/ui-sync.js +201 -0
  135. package/neural-interface/public/shared/ui-terminal.js +6385 -0
  136. package/neural-interface/public/shared/ui-tooltip.js +123 -0
  137. package/neural-interface/public/shared/ui-trash.js +439 -0
  138. package/neural-interface/public/shared/ui-tutorial-draw.js +875 -0
  139. package/neural-interface/public/shared/ui-tutorial-steps.js +2276 -0
  140. package/neural-interface/public/shared/ui-tutorial.js +1117 -0
  141. package/neural-interface/public/shared/ui-update.js +244 -0
  142. package/neural-interface/public/shared/ui-whiteboard.js +3262 -0
  143. package/neural-interface/public/shared/ui-workspaces.js +722 -0
  144. package/neural-interface/public/shared/utils.js +360 -0
  145. package/neural-interface/public/shared/vterm-buffer.js +1102 -0
  146. package/neural-interface/public/sw.js +52 -0
  147. package/neural-interface/public/synabun.png +0 -0
  148. package/neural-interface/public/toolbar-album.svg +8 -0
  149. package/neural-interface/public/toolbar-question.svg +6 -0
  150. package/neural-interface/public/toolbar-sessions.svg +6 -0
  151. package/neural-interface/public/variant/2d/background.js +113 -0
  152. package/neural-interface/public/variant/2d/context-menu.js +133 -0
  153. package/neural-interface/public/variant/2d/gfx.js +45 -0
  154. package/neural-interface/public/variant/2d/graph.js +1635 -0
  155. package/neural-interface/public/variant/2d/hulls.js +207 -0
  156. package/neural-interface/public/variant/2d/lasso.js +135 -0
  157. package/neural-interface/public/variant/2d/layout.js +594 -0
  158. package/neural-interface/public/variant/2d/main.js +521 -0
  159. package/neural-interface/public/variant/2d/minimap.js +312 -0
  160. package/neural-interface/public/variant/2d/settings-gfx.js +98 -0
  161. package/neural-interface/public/variant/3d/background.js +884 -0
  162. package/neural-interface/public/variant/3d/camera.js +661 -0
  163. package/neural-interface/public/variant/3d/gfx.js +116 -0
  164. package/neural-interface/public/variant/3d/graph.js +2399 -0
  165. package/neural-interface/public/variant/3d/main.js +500 -0
  166. package/neural-interface/public/variant/3d/settings-gfx.js +228 -0
  167. package/neural-interface/scripts/rebuild-pty.js +100 -0
  168. package/neural-interface/server.js +15000 -0
  169. package/neural-interface/templates/CLAUDE-template.md +211 -0
  170. package/package.json +53 -0
  171. package/postinstall.js +135 -0
  172. package/setup.js +260 -0
  173. package/skills/leonardo/SKILL.md +159 -0
  174. package/skills/leonardo/icon.svg +1 -0
  175. package/skills/leonardo/modules/browser-guide.md +378 -0
  176. package/skills/leonardo/modules/image-prompter.md +277 -0
  177. package/skills/leonardo/modules/model-advisor.md +100 -0
  178. package/skills/leonardo/modules/prompt-library.md +110 -0
  179. package/skills/leonardo/modules/style-guide.md +186 -0
  180. package/skills/leonardo/modules/video-prompter.md +311 -0
  181. package/skills/synabun/SKILL.md +185 -0
  182. package/skills/synabun/icon.png +0 -0
  183. package/skills/synabun/modules/audit.md +374 -0
  184. package/skills/synabun/modules/changelog.md +194 -0
  185. package/skills/synabun/modules/idea.md +144 -0
  186. package/skills/synabun/modules/memorize.md +188 -0
  187. package/skills/synabun/synabunicon.png +0 -0
@@ -0,0 +1,52 @@
1
+ const CACHE_NAME = 'synabun-offline-v7';
2
+ const OFFLINE_URL = '/offline.html';
3
+
4
+ self.addEventListener('install', (event) => {
5
+ event.waitUntil(
6
+ caches.open(CACHE_NAME).then((cache) => cache.add(new Request(OFFLINE_URL, { cache: 'reload' })))
7
+ );
8
+ self.skipWaiting();
9
+ });
10
+
11
+ self.addEventListener('activate', (event) => {
12
+ event.waitUntil(
13
+ caches.keys().then((names) =>
14
+ Promise.all(names.filter((n) => n !== CACHE_NAME).map((n) => caches.delete(n)))
15
+ )
16
+ );
17
+ self.clients.claim();
18
+ });
19
+
20
+ self.addEventListener('fetch', (event) => {
21
+ if (event.request.mode !== 'navigate') return;
22
+ event.respondWith(
23
+ fetch(event.request).catch(() => caches.match(OFFLINE_URL))
24
+ );
25
+ });
26
+
27
+ // ── Notifications (required for Safari PWA) ──
28
+
29
+ self.addEventListener('message', (event) => {
30
+ if (event.data?.type === 'SHOW_NOTIFICATION') {
31
+ const { title, body, tag, routing } = event.data;
32
+ event.waitUntil(
33
+ self.registration.showNotification(title, { body, tag, silent: true, data: routing || null })
34
+ );
35
+ }
36
+ });
37
+
38
+ self.addEventListener('notificationclick', (event) => {
39
+ event.notification.close();
40
+ const routing = event.notification.data;
41
+ event.waitUntil(
42
+ clients.matchAll({ type: 'window', includeUncontrolled: true }).then((list) => {
43
+ const target = list.length > 0 ? list[0] : null;
44
+ if (target) {
45
+ target.focus();
46
+ if (routing) target.postMessage({ type: 'NOTIFICATION_CLICK', ...routing });
47
+ } else {
48
+ clients.openWindow('/');
49
+ }
50
+ })
51
+ );
52
+ });
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
2
+ <svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M21.1935 16.793C20.8437 19.2739 20.6689 20.5143 19.7717 21.2572C18.8745 22 17.5512 22 14.9046 22H9.09536C6.44881 22 5.12553 22 4.22834 21.2572C3.33115 20.5143 3.15626 19.2739 2.80648 16.793L2.38351 13.793C1.93748 10.6294 1.71447 9.04765 2.66232 8.02383C3.61017 7 5.29758 7 8.67239 7H15.3276C18.7024 7 20.3898 7 21.3377 8.02383C22.0865 8.83268 22.1045 9.98979 21.8592 12" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
4
+ <path d="M19.5617 7C19.7904 5.69523 18.7863 4.5 17.4617 4.5H6.53788C5.21323 4.5 4.20922 5.69523 4.43784 7" stroke="#1C274C" stroke-width="1.5"/>
5
+ <path d="M17.4999 4.5C17.5283 4.24092 17.5425 4.11135 17.5427 4.00435C17.545 2.98072 16.7739 2.12064 15.7561 2.01142C15.6497 2 15.5194 2 15.2588 2H8.74099C8.48035 2 8.35002 2 8.24362 2.01142C7.22584 2.12064 6.45481 2.98072 6.45704 4.00434C6.45727 4.11135 6.47146 4.2409 6.49983 4.5" stroke="#1C274C" stroke-width="1.5"/>
6
+ <circle cx="16.5" cy="11.5" r="1.5" stroke="#1C274C" stroke-width="1.5"/>
7
+ <path d="M19.9999 20L17.1157 17.8514C16.1856 17.1586 14.8004 17.0896 13.7766 17.6851L13.5098 17.8403C12.7984 18.2542 11.8304 18.1848 11.2156 17.6758L7.37738 14.4989C6.6113 13.8648 5.38245 13.8309 4.5671 14.4214L3.24316 15.3803" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
8
+ </svg>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
2
+ <svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M10.125 8.875C10.125 7.83947 10.9645 7 12 7C13.0355 7 13.875 7.83947 13.875 8.875C13.875 9.56245 13.505 10.1635 12.9534 10.4899C12.478 10.7711 12 11.1977 12 11.75V13" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
4
+ <circle cx="12" cy="16" r="1" fill="#1C274C"/>
5
+ <path d="M22 12C22 16.714 22 19.0711 20.5355 20.5355C19.0711 22 16.714 22 12 22C7.28595 22 4.92893 22 3.46447 20.5355C2 19.0711 2 16.714 2 12C2 7.28595 2 4.92893 3.46447 3.46447C4.92893 2 7.28595 2 12 2C16.714 2 19.0711 2 20.5355 3.46447C21.5093 4.43821 21.8356 5.80655 21.9449 8" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
6
+ </svg>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
2
+ <svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M2 12.0002C2 7.28611 2 4.92909 3.46447 3.46462C4.70529 2.2238 6.58687 2.03431 10 2.00537M22 12.0002C22 7.28611 22 4.92909 20.5355 3.46462C19.2947 2.2238 17.4131 2.03431 14 2.00537" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
4
+ <path d="M10 22C7.19974 22 5.79961 22 4.73005 21.455C3.78924 20.9757 3.02433 20.2108 2.54497 19.27C2 18.2004 2 16.8003 2 14C2 11.1997 2 9.79961 2.54497 8.73005C3.02433 7.78924 3.78924 7.02433 4.73005 6.54497C5.79961 6 7.19974 6 10 6H14C16.8003 6 18.2004 6 19.27 6.54497C20.2108 7.02433 20.9757 7.78924 21.455 8.73005C22 9.79961 22 11.1997 22 14C22 16.8003 22 18.2004 21.455 19.27C20.9757 20.2108 20.2108 20.9757 19.27 21.455C18.2004 22 16.8003 22 14 22" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
5
+ <path d="M12 11L12 17M12 17L14.5 14.5M12 17L9.5 14.5" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
6
+ </svg>
@@ -0,0 +1,113 @@
1
+ // ═══════════════════════════════════════════
2
+ // SynaBun Neural Interface — 2D Background
3
+ // Focus Mode aesthetic: dark radial gradient,
4
+ // SynaBun logo watermark, breathing animation
5
+ // Drawn as first layer in the main canvas render loop
6
+ // ═══════════════════════════════════════════
7
+
8
+ import { gfx } from './gfx.js';
9
+
10
+ // ── Private state ──
11
+ let _logoBitmap = null;
12
+ let _logoLoading = false;
13
+
14
+ // Cached background gradient (recreated only on resize)
15
+ let _bgGrad = null;
16
+ let _bgGradW = 0;
17
+ let _bgGradH = 0;
18
+
19
+ // ═══════════════════════════════════════════
20
+ // INIT
21
+ // ═══════════════════════════════════════════
22
+
23
+ /**
24
+ * Initialize the background — preload the SynaBun logo.
25
+ * Call once after DOM is ready.
26
+ */
27
+ export function initBackground() {
28
+ if (_logoLoading || _logoBitmap) return;
29
+ _logoLoading = true;
30
+
31
+ const img = new Image();
32
+ img.onload = () => {
33
+ _logoBitmap = img;
34
+ _logoLoading = false;
35
+ };
36
+ img.onerror = () => {
37
+ _logoLoading = false;
38
+ };
39
+ img.src = '/synabun.png?v=2';
40
+ }
41
+
42
+ // ═══════════════════════════════════════════
43
+ // DRAW (called each frame by graph.js)
44
+ // ═══════════════════════════════════════════
45
+
46
+ /**
47
+ * Draw the background onto the main canvas context.
48
+ * Called in screen-space (before any pan/zoom transforms).
49
+ *
50
+ * @param {CanvasRenderingContext2D} ctx The main canvas context
51
+ * @param {number} time requestAnimationFrame timestamp (ms)
52
+ * @param {number} w Canvas pixel width
53
+ * @param {number} h Canvas pixel height
54
+ */
55
+ export function drawBackground(ctx, time, w, h) {
56
+ // ── 1. Dark radial gradient (cached — recreated only on resize) ──
57
+ if (!_bgGrad || _bgGradW !== w || _bgGradH !== h) {
58
+ const maxDim = Math.max(w, h);
59
+ _bgGrad = ctx.createRadialGradient(w / 2, h / 2, 0, w / 2, h / 2, maxDim * 0.7);
60
+ _bgGrad.addColorStop(0, '#0e1218');
61
+ _bgGrad.addColorStop(1, '#070709');
62
+ _bgGradW = w;
63
+ _bgGradH = h;
64
+ }
65
+ ctx.fillStyle = _bgGrad;
66
+ ctx.fillRect(0, 0, w, h);
67
+
68
+ // ── 2. Breathing animation ──
69
+ if (gfx.bgBreathingEnabled) {
70
+ const phase = (Math.sin(time * 0.001 * (2 * Math.PI / 4)) + 1) / 2; // 4-second cycle
71
+ const breatheScale = 1 + phase * 0.15;
72
+ const breatheAlpha = 0.4 + phase * 0.3;
73
+ const breatheR = 150 * breatheScale;
74
+
75
+ const breatheGrad = ctx.createRadialGradient(w / 2, h / 2, 0, w / 2, h / 2, breatheR);
76
+ breatheGrad.addColorStop(0, `rgba(100, 140, 200, ${(0.06 * breatheAlpha).toFixed(4)})`);
77
+ breatheGrad.addColorStop(1, 'rgba(100, 140, 200, 0)');
78
+ ctx.fillStyle = breatheGrad;
79
+ ctx.beginPath();
80
+ ctx.arc(w / 2, h / 2, breatheR, 0, Math.PI * 2);
81
+ ctx.fill();
82
+ }
83
+
84
+ // ── 3. SynaBun logo watermark (disabled for 2D canvas view) ──
85
+ // if (gfx.bgLogoVisible && _logoBitmap) {
86
+ // const logoH = 80;
87
+ // const logoW = _logoBitmap.naturalWidth * (logoH / _logoBitmap.naturalHeight);
88
+ // ctx.save();
89
+ // ctx.globalAlpha = 0.18;
90
+ // ctx.filter = 'grayscale(0.3)';
91
+ // ctx.drawImage(_logoBitmap, w / 2 - logoW / 2, h / 2 - logoH / 2, logoW, logoH);
92
+ // ctx.restore();
93
+ // }
94
+ }
95
+
96
+ // ═══════════════════════════════════════════
97
+ // LIFECYCLE (compatibility with main.js)
98
+ // ═══════════════════════════════════════════
99
+
100
+ /**
101
+ * Stop background (no-op — background is drawn by graph.js render loop).
102
+ */
103
+ export function stopBackground() {
104
+ // No-op: background is drawn as part of the main render loop.
105
+ // When viz is toggled off, the render loop stops, stopping the background too.
106
+ }
107
+
108
+ /**
109
+ * Resume background animation (no-op — controlled by render loop).
110
+ */
111
+ export function animateBackground() {
112
+ // No-op
113
+ }
@@ -0,0 +1,133 @@
1
+ // ═══════════════════════════════════════════
2
+ // SynaBun Neural Interface — 2D Context Menu
3
+ // Right-click on a card shows a context menu with actions.
4
+ // Listens for 'node-context-menu' events from graph.js.
5
+ // Element: #context-menu
6
+ // ═══════════════════════════════════════════
7
+
8
+ import { state, emit, on } from '../../shared/state.js';
9
+ import { getAllCards } from './graph.js';
10
+
11
+ const $ = (id) => document.getElementById(id);
12
+
13
+ // ── Private state ──
14
+ let _contextMenuNode = null;
15
+ let _contextMenu = null;
16
+
17
+ // ═══════════════════════════════════════════
18
+ // INIT
19
+ // ═══════════════════════════════════════════
20
+
21
+ /**
22
+ * Initialize the context menu system.
23
+ * @param {object} _graphInstance Unused — kept for API compatibility
24
+ */
25
+ export function initContextMenu(_graphInstance) {
26
+ _contextMenu = $('context-menu');
27
+ if (!_contextMenu) return;
28
+
29
+ // ── Menu item clicks ──
30
+ _contextMenu.addEventListener('click', _onMenuClick);
31
+
32
+ // ── Close on outside click ──
33
+ document.addEventListener('click', _onDocumentClick);
34
+
35
+ // ── Listen for context menu events from the graph renderer ──
36
+ on('node-context-menu', ({ node, event }) => {
37
+ showContextMenu(node, event);
38
+ });
39
+ }
40
+
41
+ // ═══════════════════════════════════════════
42
+ // SHOW / HIDE
43
+ // ═══════════════════════════════════════════
44
+
45
+ /**
46
+ * Show the context menu at the given screen coordinates for a node.
47
+ * @param {object} node The graph node object
48
+ * @param {MouseEvent} event The triggering mouse event (for coordinates)
49
+ */
50
+ export function showContextMenu(node, event) {
51
+ if (!_contextMenu) return;
52
+
53
+ _contextMenuNode = node;
54
+ _contextMenu.style.left = event.clientX + 'px';
55
+ _contextMenu.style.top = event.clientY + 'px';
56
+ _contextMenu.classList.add('open');
57
+
58
+ // Update pin text based on card pinned state
59
+ const pinItem = _contextMenu.querySelector('[data-action="pin"]');
60
+ if (pinItem) {
61
+ const cards = getAllCards();
62
+ const card = cards.find(c => c.node.id === node.id);
63
+ pinItem.textContent = (card && card.pinned) ? 'Unpin' : 'Pin';
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Hide the context menu and clear the tracked node.
69
+ */
70
+ export function hideContextMenu() {
71
+ if (!_contextMenu) return;
72
+ _contextMenu.classList.remove('open');
73
+ _contextMenuNode = null;
74
+ }
75
+
76
+ // ═══════════════════════════════════════════
77
+ // EVENT HANDLERS
78
+ // ═══════════════════════════════════════════
79
+
80
+ function _onMenuClick(e) {
81
+ const action = e.target.closest('.ctx-item')?.dataset.action;
82
+ if (!action || !_contextMenuNode) return;
83
+ const node = _contextMenuNode;
84
+ hideContextMenu();
85
+
86
+ switch (action) {
87
+ case 'open':
88
+ emit('context-menu:open', { node });
89
+ break;
90
+ case 'edit':
91
+ emit('context-menu:edit', { node });
92
+ break;
93
+ case 'move':
94
+ emit('context-menu:move', { node });
95
+ break;
96
+ case 'pin': {
97
+ const cards = getAllCards();
98
+ const card = cards.find(c => c.node.id === node.id);
99
+ if (card) {
100
+ card.pinned = !card.pinned;
101
+ emit('context-menu:pin', { node, pinned: card.pinned });
102
+ }
103
+ break;
104
+ }
105
+ case 'focus':
106
+ emit('context-menu:focus', { node });
107
+ break;
108
+ case 'bookmark':
109
+ emit('context-menu:bookmark', { node });
110
+ break;
111
+ case 'trash':
112
+ emit('context-menu:trash', { node });
113
+ break;
114
+ }
115
+ }
116
+
117
+ function _onDocumentClick(e) {
118
+ if (_contextMenu && !_contextMenu.contains(e.target)) {
119
+ hideContextMenu();
120
+ }
121
+ }
122
+
123
+ // ═══════════════════════════════════════════
124
+ // UTILITIES
125
+ // ═══════════════════════════════════════════
126
+
127
+ export function setGraph(_graphInstance) {
128
+ // No-op — context menu is event-driven
129
+ }
130
+
131
+ export function getContextMenuNode() {
132
+ return _contextMenuNode;
133
+ }
@@ -0,0 +1,45 @@
1
+ // ═══════════════════════════════════════════
2
+ // SynaBun Neural Interface — 2D Graphics Config
3
+ // Orbital layout & visual defaults, load/save
4
+ // ═══════════════════════════════════════════
5
+
6
+ export const GFX_DEFAULTS_2D = {
7
+ // Layout
8
+ parentOrbitRadius: 600, // base radius for parent category ring
9
+ childOrbitGap: 200, // base radius for child category orbits
10
+ cardGap: 15, // spacing between cards in orbit rings
11
+
12
+ // Visual
13
+ cardOpacity: 0.88, // card background opacity
14
+ regionGlowOpacity: 0.05, // category region background glow intensity
15
+ linkOpacity: 0.15, // link line opacity
16
+
17
+ // Background
18
+ bgBreathingEnabled: true, // breathing animation circle
19
+ bgLogoVisible: true, // SynaBun logo watermark
20
+
21
+ // Minimap
22
+ minimapEnabled: true,
23
+ };
24
+
25
+ import { storage } from '../../shared/storage.js';
26
+
27
+ const STORAGE_KEY = 'neural-gfx-config-2d';
28
+
29
+ export function loadGfxConfig() {
30
+ try {
31
+ const saved = JSON.parse(storage.getItem(STORAGE_KEY) || '{}');
32
+ return { ...GFX_DEFAULTS_2D, ...saved };
33
+ } catch { return { ...GFX_DEFAULTS_2D }; }
34
+ }
35
+
36
+ export function saveGfxConfig(cfg) {
37
+ const diff = {};
38
+ for (const k in cfg) {
39
+ if (cfg[k] !== GFX_DEFAULTS_2D[k]) diff[k] = cfg[k];
40
+ }
41
+ storage.setItem(STORAGE_KEY, JSON.stringify(diff));
42
+ }
43
+
44
+ // Initialize and export the live config object
45
+ export const gfx = loadGfxConfig();