design-brain-memory 0.8.2 → 0.9.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 (126) hide show
  1. package/dist/agentBrowser.d.ts +1 -0
  2. package/dist/agentBrowser.js +1 -0
  3. package/dist/agentBrowser.js.map +1 -1
  4. package/dist/classify.d.ts +21 -0
  5. package/dist/classify.js +205 -0
  6. package/dist/classify.js.map +1 -0
  7. package/dist/cli.js +216 -219
  8. package/dist/cli.js.map +1 -1
  9. package/dist/commands.d.ts +1 -60
  10. package/dist/commands.js +10 -322
  11. package/dist/commands.js.map +1 -1
  12. package/dist/extractFromUrl.d.ts +0 -7
  13. package/dist/extractFromUrl.js +353 -82
  14. package/dist/extractFromUrl.js.map +1 -1
  15. package/dist/index.d.ts +12 -24
  16. package/dist/index.js +11 -16
  17. package/dist/index.js.map +1 -1
  18. package/dist/llm.d.ts +6 -0
  19. package/dist/llm.js +12 -1
  20. package/dist/llm.js.map +1 -1
  21. package/dist/persona.d.ts +2 -0
  22. package/dist/persona.js +234 -0
  23. package/dist/persona.js.map +1 -0
  24. package/dist/query.js +6 -1
  25. package/dist/query.js.map +1 -1
  26. package/dist/render.d.ts +10 -2
  27. package/dist/render.js +175 -80
  28. package/dist/render.js.map +1 -1
  29. package/dist/scan.d.ts +10 -0
  30. package/dist/scan.js +393 -0
  31. package/dist/scan.js.map +1 -0
  32. package/dist/scanRenderer.d.ts +2 -0
  33. package/dist/scanRenderer.js +155 -0
  34. package/dist/scanRenderer.js.map +1 -0
  35. package/dist/skillPrompt.d.ts +3 -1
  36. package/dist/skillPrompt.js +148 -22
  37. package/dist/skillPrompt.js.map +1 -1
  38. package/dist/store.d.ts +5 -1
  39. package/dist/store.js +19 -0
  40. package/dist/store.js.map +1 -1
  41. package/dist/taste.d.ts +9 -0
  42. package/dist/taste.js +598 -0
  43. package/dist/taste.js.map +1 -0
  44. package/dist/tasteDiff.d.ts +19 -0
  45. package/dist/tasteDiff.js +340 -0
  46. package/dist/tasteDiff.js.map +1 -0
  47. package/dist/tasteGenerate.d.ts +12 -0
  48. package/dist/tasteGenerate.js +140 -0
  49. package/dist/tasteGenerate.js.map +1 -0
  50. package/dist/tasteRefine.d.ts +13 -0
  51. package/dist/tasteRefine.js +351 -0
  52. package/dist/tasteRefine.js.map +1 -0
  53. package/dist/tasteRenderer.d.ts +4 -0
  54. package/dist/tasteRenderer.js +133 -0
  55. package/dist/tasteRenderer.js.map +1 -0
  56. package/dist/theatrical.d.ts +5 -0
  57. package/dist/theatrical.js +258 -0
  58. package/dist/theatrical.js.map +1 -0
  59. package/dist/types.d.ts +196 -27
  60. package/package.json +4 -3
  61. package/skills/SKILL.md +36 -0
  62. package/skills/design-brain/SKILL.md +77 -0
  63. package/README.md +0 -242
  64. package/dist/aggregate.d.ts +0 -9
  65. package/dist/aggregate.js +0 -53
  66. package/dist/aggregate.js.map +0 -1
  67. package/dist/batch.d.ts +0 -16
  68. package/dist/batch.js +0 -44
  69. package/dist/batch.js.map +0 -1
  70. package/dist/compare.d.ts +0 -33
  71. package/dist/compare.js +0 -83
  72. package/dist/compare.js.map +0 -1
  73. package/dist/componentGraph.d.ts +0 -22
  74. package/dist/componentGraph.js +0 -106
  75. package/dist/componentGraph.js.map +0 -1
  76. package/dist/contextLayer.d.ts +0 -12
  77. package/dist/contextLayer.js +0 -263
  78. package/dist/contextLayer.js.map +0 -1
  79. package/dist/cssInJs.d.ts +0 -9
  80. package/dist/cssInJs.js +0 -124
  81. package/dist/cssInJs.js.map +0 -1
  82. package/dist/graphView.d.ts +0 -21
  83. package/dist/graphView.js +0 -492
  84. package/dist/graphView.js.map +0 -1
  85. package/dist/knowledge.d.ts +0 -20
  86. package/dist/knowledge.js +0 -208
  87. package/dist/knowledge.js.map +0 -1
  88. package/dist/liveView.d.ts +0 -15
  89. package/dist/liveView.js +0 -476
  90. package/dist/liveView.js.map +0 -1
  91. package/dist/moodboard.d.ts +0 -3
  92. package/dist/moodboard.js +0 -139
  93. package/dist/moodboard.js.map +0 -1
  94. package/dist/reviewChecklist.d.ts +0 -17
  95. package/dist/reviewChecklist.js +0 -126
  96. package/dist/reviewChecklist.js.map +0 -1
  97. package/dist/scorecard.d.ts +0 -48
  98. package/dist/scorecard.js +0 -201
  99. package/dist/scorecard.js.map +0 -1
  100. package/dist/styleDictionary.d.ts +0 -16
  101. package/dist/styleDictionary.js +0 -89
  102. package/dist/styleDictionary.js.map +0 -1
  103. package/dist/svg.d.ts +0 -5
  104. package/dist/svg.js +0 -162
  105. package/dist/svg.js.map +0 -1
  106. package/dist/systemDiff.d.ts +0 -28
  107. package/dist/systemDiff.js +0 -107
  108. package/dist/systemDiff.js.map +0 -1
  109. package/dist/tailwind.d.ts +0 -2
  110. package/dist/tailwind.js +0 -122
  111. package/dist/tailwind.js.map +0 -1
  112. package/dist/tokenNaming.d.ts +0 -5
  113. package/dist/tokenNaming.js +0 -229
  114. package/dist/tokenNaming.js.map +0 -1
  115. package/dist/tokens.d.ts +0 -17
  116. package/dist/tokens.js +0 -44
  117. package/dist/tokens.js.map +0 -1
  118. package/dist/trends.d.ts +0 -12
  119. package/dist/trends.js +0 -178
  120. package/dist/trends.js.map +0 -1
  121. package/dist/wiki.d.ts +0 -10
  122. package/dist/wiki.js +0 -346
  123. package/dist/wiki.js.map +0 -1
  124. package/dist/writingStyle.d.ts +0 -38
  125. package/dist/writingStyle.js +0 -224
  126. package/dist/writingStyle.js.map +0 -1
package/dist/graphView.js DELETED
@@ -1,492 +0,0 @@
1
- import { aggregateColors, aggregateTypography, aggregateComponents, } from './aggregate.js';
2
- import { nameColor } from './tokenNaming.js';
3
- export function buildKnowledgeGraph(db) {
4
- const nodes = [];
5
- const edges = [];
6
- const nodeIds = new Set();
7
- function addNode(node) {
8
- if (nodeIds.has(node.id))
9
- return;
10
- nodeIds.add(node.id);
11
- nodes.push(node);
12
- }
13
- // Track which projects use which tokens for shared edges
14
- const colorProjects = new Map();
15
- const fontProjects = new Map();
16
- const componentProjects = new Map();
17
- for (const project of db.projects) {
18
- // Project node
19
- addNode({
20
- id: `p:${project.id}`,
21
- label: project.name,
22
- type: 'project',
23
- color: '#6366f1',
24
- size: 28,
25
- meta: {
26
- captures: String(project.inspirations.length),
27
- outcomes: String(project.outcomes.length),
28
- updated: project.updatedAt.slice(0, 10),
29
- },
30
- });
31
- // Colors (top 8 per project)
32
- const colors = aggregateColors(project.inspirations);
33
- for (const c of colors.slice(0, 8)) {
34
- const hex = c.hex.toUpperCase();
35
- const nodeId = `c:${hex}`;
36
- addNode({
37
- id: nodeId,
38
- label: `${nameColor(c.hex)} ${hex}`,
39
- type: 'color',
40
- color: hex,
41
- size: 12,
42
- meta: { hex, count: String(c.count), name: nameColor(c.hex) },
43
- });
44
- edges.push({ source: `p:${project.id}`, target: nodeId, type: 'has_color', weight: c.count });
45
- const list = colorProjects.get(nodeId) ?? [];
46
- list.push(project.id);
47
- colorProjects.set(nodeId, list);
48
- }
49
- // Fonts (unique families)
50
- const typo = aggregateTypography(project.inspirations);
51
- const seenFonts = new Set();
52
- for (const t of typo) {
53
- const family = t.fontFamily.split(',')[0].trim().replace(/['"]/g, '');
54
- if (seenFonts.has(family))
55
- continue;
56
- seenFonts.add(family);
57
- const nodeId = `f:${family.toLowerCase()}`;
58
- addNode({
59
- id: nodeId,
60
- label: family,
61
- type: 'font',
62
- color: '#f59e0b',
63
- size: 14,
64
- meta: { family, count: String(t.count) },
65
- });
66
- edges.push({ source: `p:${project.id}`, target: nodeId, type: 'has_font', weight: t.count });
67
- const list = fontProjects.get(nodeId) ?? [];
68
- list.push(project.id);
69
- fontProjects.set(nodeId, list);
70
- }
71
- // Components (unique kinds, top 10)
72
- const components = aggregateComponents(project.inspirations);
73
- const seenKinds = new Set();
74
- for (const comp of components) {
75
- if (seenKinds.has(comp.kind))
76
- continue;
77
- seenKinds.add(comp.kind);
78
- if (seenKinds.size > 10)
79
- break;
80
- const nodeId = `k:${comp.kind}`;
81
- addNode({
82
- id: nodeId,
83
- label: comp.kind,
84
- type: 'component',
85
- color: '#10b981',
86
- size: 16,
87
- meta: { kind: comp.kind, count: String(comp.count) },
88
- });
89
- edges.push({ source: `p:${project.id}`, target: nodeId, type: 'has_component', weight: comp.count });
90
- const list = componentProjects.get(nodeId) ?? [];
91
- list.push(project.id);
92
- componentProjects.set(nodeId, list);
93
- }
94
- // Inspirations (as smaller nodes)
95
- for (const inspo of project.inspirations.slice(0, 6)) {
96
- const nodeId = `i:${inspo.id}`;
97
- addNode({
98
- id: nodeId,
99
- label: inspo.name.slice(0, 30),
100
- type: 'inspiration',
101
- color: '#8b5cf6',
102
- size: 8,
103
- meta: {
104
- url: inspo.url || '',
105
- captured: inspo.capturedAt.slice(0, 10),
106
- colors: String(inspo.analysis.colors.length),
107
- components: String(inspo.analysis.components.length),
108
- },
109
- });
110
- edges.push({ source: `p:${project.id}`, target: nodeId, type: 'has_inspiration', weight: 1 });
111
- }
112
- }
113
- // Add shared_token edges between projects that share colors/fonts/components
114
- const allShared = [colorProjects, fontProjects, componentProjects];
115
- const sharedPairs = new Map();
116
- for (const tokenMap of allShared) {
117
- for (const [, projectIds] of tokenMap) {
118
- if (projectIds.length < 2)
119
- continue;
120
- const unique = [...new Set(projectIds)].sort();
121
- for (let i = 0; i < unique.length; i++) {
122
- for (let j = i + 1; j < unique.length; j++) {
123
- const key = `${unique[i]}|${unique[j]}`;
124
- sharedPairs.set(key, (sharedPairs.get(key) ?? 0) + 1);
125
- }
126
- }
127
- }
128
- }
129
- for (const [key, count] of sharedPairs) {
130
- const [a, b] = key.split('|');
131
- edges.push({ source: `p:${a}`, target: `p:${b}`, type: 'shared_token', weight: count });
132
- }
133
- return { nodes, edges };
134
- }
135
- // ── HTML generation ───────────────────────────────────────────────────
136
- export function generateGraphHtml(graph) {
137
- const graphJson = JSON.stringify(graph);
138
- return `<!DOCTYPE html>
139
- <html lang="en">
140
- <head>
141
- <meta charset="utf-8">
142
- <meta name="viewport" content="width=device-width, initial-scale=1">
143
- <title>Design Brain — Knowledge Graph</title>
144
- <style>
145
- * { margin: 0; padding: 0; box-sizing: border-box; }
146
- body { background: #0f0f17; color: #e2e8f0; font-family: system-ui, -apple-system, sans-serif; overflow: hidden; }
147
- canvas { display: block; cursor: grab; }
148
- canvas:active { cursor: grabbing; }
149
-
150
- #ui { position: fixed; top: 0; left: 0; right: 0; padding: 16px 20px; display: flex; gap: 12px; align-items: center; z-index: 10; background: linear-gradient(to bottom, rgba(15,15,23,0.95), rgba(15,15,23,0)); pointer-events: none; }
151
- #ui > * { pointer-events: auto; }
152
- h1 { font-size: 16px; font-weight: 600; white-space: nowrap; }
153
-
154
- #search { background: #1e1e2e; border: 1px solid #333; border-radius: 6px; padding: 6px 12px; color: #e2e8f0; font-size: 13px; width: 220px; outline: none; }
155
- #search:focus { border-color: #6366f1; }
156
- #search::placeholder { color: #555; }
157
-
158
- .legend { display: flex; gap: 14px; margin-left: auto; font-size: 12px; }
159
- .legend-item { display: flex; align-items: center; gap: 5px; }
160
- .legend-dot { width: 10px; height: 10px; border-radius: 50%; }
161
-
162
- #tooltip { position: fixed; background: #1e1e2e; border: 1px solid #444; border-radius: 8px; padding: 10px 14px; font-size: 12px; pointer-events: none; display: none; z-index: 20; max-width: 280px; box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
163
- #tooltip .tt-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
164
- #tooltip .tt-type { color: #888; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
165
- #tooltip .tt-meta { color: #aaa; line-height: 1.5; }
166
-
167
- #stats { position: fixed; bottom: 16px; left: 20px; font-size: 11px; color: #555; z-index: 10; }
168
-
169
- .filter-btns { display: flex; gap: 4px; }
170
- .filter-btn { background: #1e1e2e; border: 1px solid #333; border-radius: 4px; padding: 3px 8px; font-size: 11px; color: #aaa; cursor: pointer; }
171
- .filter-btn.active { border-color: #6366f1; color: #e2e8f0; }
172
- </style>
173
- </head>
174
- <body>
175
- <div id="ui">
176
- <h1>Design Brain</h1>
177
- <input type="text" id="search" placeholder="Search nodes..." autocomplete="off">
178
- <div class="filter-btns">
179
- <button class="filter-btn active" data-type="all">All</button>
180
- <button class="filter-btn active" data-type="project">Projects</button>
181
- <button class="filter-btn active" data-type="color">Colors</button>
182
- <button class="filter-btn active" data-type="font">Fonts</button>
183
- <button class="filter-btn active" data-type="component">Components</button>
184
- <button class="filter-btn active" data-type="inspiration">Captures</button>
185
- </div>
186
- <div class="legend">
187
- <div class="legend-item"><div class="legend-dot" style="background:#6366f1"></div> Project</div>
188
- <div class="legend-item"><div class="legend-dot" style="background:#f59e0b"></div> Font</div>
189
- <div class="legend-item"><div class="legend-dot" style="background:#10b981"></div> Component</div>
190
- <div class="legend-item"><div class="legend-dot" style="background:#8b5cf6"></div> Capture</div>
191
- </div>
192
- </div>
193
- <div id="tooltip"><div class="tt-title"></div><div class="tt-type"></div><div class="tt-meta"></div></div>
194
- <div id="stats"></div>
195
- <canvas id="canvas"></canvas>
196
-
197
- <script>
198
- const DATA = ${graphJson};
199
-
200
- const canvas = document.getElementById('canvas');
201
- const ctx = canvas.getContext('2d');
202
- const tooltip = document.getElementById('tooltip');
203
- const searchInput = document.getElementById('search');
204
- const statsEl = document.getElementById('stats');
205
-
206
- let W, H, dpr;
207
- function resize() {
208
- dpr = window.devicePixelRatio || 1;
209
- W = window.innerWidth;
210
- H = window.innerHeight;
211
- canvas.width = W * dpr;
212
- canvas.height = H * dpr;
213
- canvas.style.width = W + 'px';
214
- canvas.style.height = H + 'px';
215
- ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
216
- }
217
- resize();
218
- window.addEventListener('resize', resize);
219
-
220
- // Build simulation data
221
- const nodes = DATA.nodes.map((n, i) => ({
222
- ...n,
223
- x: W/2 + (Math.random() - 0.5) * W * 0.6,
224
- y: H/2 + (Math.random() - 0.5) * H * 0.6,
225
- vx: 0, vy: 0,
226
- visible: true,
227
- highlighted: false,
228
- idx: i,
229
- }));
230
-
231
- const nodeMap = new Map();
232
- nodes.forEach(n => nodeMap.set(n.id, n));
233
-
234
- const edges = DATA.edges.map(e => ({
235
- ...e,
236
- sourceNode: nodeMap.get(e.source),
237
- targetNode: nodeMap.get(e.target),
238
- })).filter(e => e.sourceNode && e.targetNode);
239
-
240
- // Filter state
241
- const activeTypes = new Set(['project', 'color', 'font', 'component', 'inspiration']);
242
- let searchTerm = '';
243
-
244
- function updateVisibility() {
245
- for (const n of nodes) {
246
- const typeMatch = activeTypes.has(n.type);
247
- const searchMatch = !searchTerm || n.label.toLowerCase().includes(searchTerm) || n.id.toLowerCase().includes(searchTerm);
248
- n.visible = typeMatch && searchMatch;
249
- n.highlighted = searchTerm && searchMatch;
250
- }
251
- }
252
-
253
- // Filter buttons
254
- document.querySelectorAll('.filter-btn').forEach(btn => {
255
- btn.addEventListener('click', () => {
256
- const type = btn.dataset.type;
257
- if (type === 'all') {
258
- const allActive = activeTypes.size === 5;
259
- ['project','color','font','component','inspiration'].forEach(t => allActive ? activeTypes.delete(t) : activeTypes.add(t));
260
- document.querySelectorAll('.filter-btn').forEach(b => b.classList.toggle('active', !allActive));
261
- } else {
262
- if (activeTypes.has(type)) activeTypes.delete(type); else activeTypes.add(type);
263
- btn.classList.toggle('active');
264
- }
265
- document.querySelector('[data-type="all"]').classList.toggle('active', activeTypes.size === 5);
266
- updateVisibility();
267
- });
268
- });
269
-
270
- searchInput.addEventListener('input', () => {
271
- searchTerm = searchInput.value.trim().toLowerCase();
272
- updateVisibility();
273
- });
274
-
275
- // Camera
276
- let camX = 0, camY = 0, camZoom = 1;
277
- function screenToWorld(sx, sy) {
278
- return { x: (sx - W/2) / camZoom + W/2 - camX, y: (sy - H/2) / camZoom + H/2 - camY };
279
- }
280
- function worldToScreen(wx, wy) {
281
- return { x: (wx - W/2 + camX) * camZoom + W/2, y: (wy - H/2 + camY) * camZoom + H/2 };
282
- }
283
-
284
- // Physics
285
- const REPULSION = 800;
286
- const ATTRACTION = 0.003;
287
- const DAMPING = 0.85;
288
- const CENTER_GRAVITY = 0.0003;
289
- const EDGE_LENGTH = 120;
290
-
291
- function simulate() {
292
- // Repulsion between visible nodes
293
- for (let i = 0; i < nodes.length; i++) {
294
- if (!nodes[i].visible) continue;
295
- for (let j = i + 1; j < nodes.length; j++) {
296
- if (!nodes[j].visible) continue;
297
- let dx = nodes[j].x - nodes[i].x;
298
- let dy = nodes[j].y - nodes[i].y;
299
- let dist = Math.sqrt(dx*dx + dy*dy) || 1;
300
- let force = REPULSION / (dist * dist);
301
- let fx = dx / dist * force;
302
- let fy = dy / dist * force;
303
- nodes[i].vx -= fx;
304
- nodes[i].vy -= fy;
305
- nodes[j].vx += fx;
306
- nodes[j].vy += fy;
307
- }
308
- }
309
-
310
- // Attraction along edges
311
- for (const e of edges) {
312
- if (!e.sourceNode.visible || !e.targetNode.visible) continue;
313
- let dx = e.targetNode.x - e.sourceNode.x;
314
- let dy = e.targetNode.y - e.sourceNode.y;
315
- let dist = Math.sqrt(dx*dx + dy*dy) || 1;
316
- let force = (dist - EDGE_LENGTH) * ATTRACTION;
317
- let fx = dx / dist * force;
318
- let fy = dy / dist * force;
319
- e.sourceNode.vx += fx;
320
- e.sourceNode.vy += fy;
321
- e.targetNode.vx -= fx;
322
- e.targetNode.vy -= fy;
323
- }
324
-
325
- // Center gravity + integration
326
- for (const n of nodes) {
327
- if (!n.visible) continue;
328
- if (n === dragNode) continue;
329
- n.vx += (W/2 - n.x) * CENTER_GRAVITY;
330
- n.vy += (H/2 - n.y) * CENTER_GRAVITY;
331
- n.vx *= DAMPING;
332
- n.vy *= DAMPING;
333
- n.x += n.vx;
334
- n.y += n.vy;
335
- }
336
- }
337
-
338
- // Rendering
339
- function draw() {
340
- ctx.clearRect(0, 0, W, H);
341
- ctx.save();
342
- ctx.translate(W/2, H/2);
343
- ctx.scale(camZoom, camZoom);
344
- ctx.translate(-W/2 + camX, -H/2 + camY);
345
-
346
- // Edges
347
- for (const e of edges) {
348
- if (!e.sourceNode.visible || !e.targetNode.visible) continue;
349
- ctx.beginPath();
350
- ctx.moveTo(e.sourceNode.x, e.sourceNode.y);
351
- ctx.lineTo(e.targetNode.x, e.targetNode.y);
352
- const isShared = e.type === 'shared_token';
353
- ctx.strokeStyle = isShared ? 'rgba(251,191,36,0.3)' : 'rgba(100,100,140,0.15)';
354
- ctx.lineWidth = isShared ? 2 : 0.8;
355
- if (isShared) ctx.setLineDash([4, 4]); else ctx.setLineDash([]);
356
- ctx.stroke();
357
- }
358
- ctx.setLineDash([]);
359
-
360
- // Nodes
361
- for (const n of nodes) {
362
- if (!n.visible) continue;
363
- const r = n.size * (n.highlighted ? 1.3 : 1);
364
-
365
- // Glow for highlighted
366
- if (n.highlighted) {
367
- ctx.beginPath();
368
- ctx.arc(n.x, n.y, r + 6, 0, Math.PI * 2);
369
- ctx.fillStyle = 'rgba(99,102,241,0.2)';
370
- ctx.fill();
371
- }
372
-
373
- ctx.beginPath();
374
- ctx.arc(n.x, n.y, r, 0, Math.PI * 2);
375
-
376
- if (n.type === 'color') {
377
- ctx.fillStyle = n.color;
378
- ctx.strokeStyle = '#fff';
379
- ctx.lineWidth = 1.5;
380
- ctx.fill();
381
- ctx.stroke();
382
- } else {
383
- ctx.fillStyle = n.color;
384
- ctx.fill();
385
- }
386
-
387
- // Label
388
- const fontSize = n.type === 'project' ? 12 : n.type === 'inspiration' ? 8 : 10;
389
- ctx.font = (n.type === 'project' ? '600 ' : '') + fontSize + 'px system-ui';
390
- ctx.fillStyle = n.highlighted ? '#fff' : 'rgba(226,232,240,0.8)';
391
- ctx.textAlign = 'center';
392
- ctx.textBaseline = 'top';
393
- ctx.fillText(n.label, n.x, n.y + r + 4);
394
- }
395
-
396
- ctx.restore();
397
- }
398
-
399
- // Interaction
400
- let dragNode = null;
401
- let isPanning = false;
402
- let lastMouse = { x: 0, y: 0 };
403
- let hoverNode = null;
404
-
405
- function findNode(mx, my) {
406
- const w = screenToWorld(mx, my);
407
- for (let i = nodes.length - 1; i >= 0; i--) {
408
- if (!nodes[i].visible) continue;
409
- const dx = w.x - nodes[i].x;
410
- const dy = w.y - nodes[i].y;
411
- if (dx*dx + dy*dy < (nodes[i].size + 4) ** 2) return nodes[i];
412
- }
413
- return null;
414
- }
415
-
416
- canvas.addEventListener('mousedown', e => {
417
- const node = findNode(e.clientX, e.clientY);
418
- if (node) {
419
- dragNode = node;
420
- canvas.style.cursor = 'grabbing';
421
- } else {
422
- isPanning = true;
423
- canvas.style.cursor = 'grabbing';
424
- }
425
- lastMouse = { x: e.clientX, y: e.clientY };
426
- });
427
-
428
- canvas.addEventListener('mousemove', e => {
429
- if (dragNode) {
430
- const w = screenToWorld(e.clientX, e.clientY);
431
- dragNode.x = w.x;
432
- dragNode.y = w.y;
433
- dragNode.vx = 0;
434
- dragNode.vy = 0;
435
- } else if (isPanning) {
436
- camX += (e.clientX - lastMouse.x) / camZoom;
437
- camY += (e.clientY - lastMouse.y) / camZoom;
438
- } else {
439
- const node = findNode(e.clientX, e.clientY);
440
- if (node !== hoverNode) {
441
- hoverNode = node;
442
- if (node) {
443
- canvas.style.cursor = 'pointer';
444
- const tt = tooltip;
445
- tt.style.display = 'block';
446
- tt.style.left = (e.clientX + 14) + 'px';
447
- tt.style.top = (e.clientY + 14) + 'px';
448
- tt.querySelector('.tt-title').textContent = node.label;
449
- tt.querySelector('.tt-type').textContent = node.type;
450
- const metaLines = Object.entries(node.meta).map(([k,v]) => v ? k + ': ' + v : '').filter(Boolean).join('\\n');
451
- tt.querySelector('.tt-meta').textContent = metaLines;
452
- } else {
453
- canvas.style.cursor = 'grab';
454
- tooltip.style.display = 'none';
455
- }
456
- }
457
- if (hoverNode) {
458
- tooltip.style.left = (e.clientX + 14) + 'px';
459
- tooltip.style.top = (e.clientY + 14) + 'px';
460
- }
461
- }
462
- lastMouse = { x: e.clientX, y: e.clientY };
463
- });
464
-
465
- canvas.addEventListener('mouseup', () => {
466
- dragNode = null;
467
- isPanning = false;
468
- canvas.style.cursor = hoverNode ? 'pointer' : 'grab';
469
- });
470
-
471
- canvas.addEventListener('wheel', e => {
472
- e.preventDefault();
473
- const factor = e.deltaY > 0 ? 0.92 : 1.08;
474
- camZoom = Math.max(0.1, Math.min(5, camZoom * factor));
475
- }, { passive: false });
476
-
477
- // Animation loop
478
- function loop() {
479
- simulate();
480
- draw();
481
- const visibleNodes = nodes.filter(n => n.visible).length;
482
- const visibleEdges = edges.filter(e => e.sourceNode.visible && e.targetNode.visible).length;
483
- statsEl.textContent = visibleNodes + ' nodes · ' + visibleEdges + ' edges';
484
- requestAnimationFrame(loop);
485
- }
486
- updateVisibility();
487
- loop();
488
- </script>
489
- </body>
490
- </html>`;
491
- }
492
- //# sourceMappingURL=graphView.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphView.js","sourceRoot":"","sources":["../src/graphView.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAyB7C,MAAM,UAAU,mBAAmB,CAAC,EAAuB;IACzD,MAAM,KAAK,GAAgB,EAAE,CAAC;IAC9B,MAAM,KAAK,GAAgB,EAAE,CAAC;IAC9B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAElC,SAAS,OAAO,CAAC,IAAe;QAC9B,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAAE,OAAO;QACjC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACrB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IAED,yDAAyD;IACzD,MAAM,aAAa,GAAG,IAAI,GAAG,EAAoB,CAAC;IAClD,MAAM,YAAY,GAAG,IAAI,GAAG,EAAoB,CAAC;IACjD,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAoB,CAAC;IAEtD,KAAK,MAAM,OAAO,IAAI,EAAE,CAAC,Q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;;;;;;;;;eA4DM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAoShB,CAAC;AACT,CAAC"}
@@ -1,20 +0,0 @@
1
- import type { DesignBrainDatabase } from './types.js';
2
- export interface DesignProfile {
3
- domains: string[];
4
- focus: string;
5
- philosophy?: string;
6
- tools?: string[];
7
- team?: string;
8
- }
9
- declare const DOMAIN_MOCS: {
10
- id: string;
11
- title: string;
12
- description: string;
13
- }[];
14
- export declare function generateIdentity(profile: DesignProfile): string;
15
- export declare function generateMethodology(): string;
16
- export declare function generateMocHub(db: DesignBrainDatabase): string;
17
- export declare function generateDomainMoc(domain: typeof DOMAIN_MOCS[number], db: DesignBrainDatabase): string;
18
- export declare function generateMaintenance(): string;
19
- export declare function ensureKnowledgeFiles(rootDir: string, db: DesignBrainDatabase, profile?: DesignProfile): Promise<void>;
20
- export {};