stellavault 0.1.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.
- package/.env.example +12 -0
- package/CLAUDE.md +39 -0
- package/CONTRIBUTING.md +65 -0
- package/LICENSE +21 -0
- package/README.md +182 -0
- package/memory/MEMORY.md +25 -0
- package/package.json +33 -0
- package/packages/cli/bin/ekh.js +2 -0
- package/packages/cli/bin/stellavault.js +2 -0
- package/packages/cli/dist/commands/brief-cmd.d.ts +2 -0
- package/packages/cli/dist/commands/brief-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/brief-cmd.js +82 -0
- package/packages/cli/dist/commands/brief-cmd.js.map +1 -0
- package/packages/cli/dist/commands/capture-cmd.d.ts +7 -0
- package/packages/cli/dist/commands/capture-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/capture-cmd.js +31 -0
- package/packages/cli/dist/commands/capture-cmd.js.map +1 -0
- package/packages/cli/dist/commands/card-cmd.d.ts +4 -0
- package/packages/cli/dist/commands/card-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/card-cmd.js +26 -0
- package/packages/cli/dist/commands/card-cmd.js.map +1 -0
- package/packages/cli/dist/commands/clip-cmd.d.ts +4 -0
- package/packages/cli/dist/commands/clip-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/clip-cmd.js +151 -0
- package/packages/cli/dist/commands/clip-cmd.js.map +1 -0
- package/packages/cli/dist/commands/cloud-cmd.d.ts +4 -0
- package/packages/cli/dist/commands/cloud-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/cloud-cmd.js +64 -0
- package/packages/cli/dist/commands/cloud-cmd.js.map +1 -0
- package/packages/cli/dist/commands/contradictions-cmd.d.ts +2 -0
- package/packages/cli/dist/commands/contradictions-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/contradictions-cmd.js +34 -0
- package/packages/cli/dist/commands/contradictions-cmd.js.map +1 -0
- package/packages/cli/dist/commands/decay-cmd.d.ts +2 -0
- package/packages/cli/dist/commands/decay-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/decay-cmd.js +48 -0
- package/packages/cli/dist/commands/decay-cmd.js.map +1 -0
- package/packages/cli/dist/commands/digest-cmd.d.ts +4 -0
- package/packages/cli/dist/commands/digest-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/digest-cmd.js +79 -0
- package/packages/cli/dist/commands/digest-cmd.js.map +1 -0
- package/packages/cli/dist/commands/duplicates-cmd.d.ts +4 -0
- package/packages/cli/dist/commands/duplicates-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/duplicates-cmd.js +30 -0
- package/packages/cli/dist/commands/duplicates-cmd.js.map +1 -0
- package/packages/cli/dist/commands/federate-cmd.d.ts +5 -0
- package/packages/cli/dist/commands/federate-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/federate-cmd.js +217 -0
- package/packages/cli/dist/commands/federate-cmd.js.map +1 -0
- package/packages/cli/dist/commands/gaps-cmd.d.ts +2 -0
- package/packages/cli/dist/commands/gaps-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/gaps-cmd.js +33 -0
- package/packages/cli/dist/commands/gaps-cmd.js.map +1 -0
- package/packages/cli/dist/commands/graph-cmd.d.ts +2 -0
- package/packages/cli/dist/commands/graph-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/graph-cmd.js +77 -0
- package/packages/cli/dist/commands/graph-cmd.js.map +1 -0
- package/packages/cli/dist/commands/index-cmd.d.ts +2 -0
- package/packages/cli/dist/commands/index-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/index-cmd.js +57 -0
- package/packages/cli/dist/commands/index-cmd.js.map +1 -0
- package/packages/cli/dist/commands/init-cmd.d.ts +2 -0
- package/packages/cli/dist/commands/init-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/init-cmd.js +123 -0
- package/packages/cli/dist/commands/init-cmd.js.map +1 -0
- package/packages/cli/dist/commands/learn-cmd.d.ts +2 -0
- package/packages/cli/dist/commands/learn-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/learn-cmd.js +48 -0
- package/packages/cli/dist/commands/learn-cmd.js.map +1 -0
- package/packages/cli/dist/commands/pack-cmd.d.ts +15 -0
- package/packages/cli/dist/commands/pack-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/pack-cmd.js +93 -0
- package/packages/cli/dist/commands/pack-cmd.js.map +1 -0
- package/packages/cli/dist/commands/review-cmd.d.ts +4 -0
- package/packages/cli/dist/commands/review-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/review-cmd.js +107 -0
- package/packages/cli/dist/commands/review-cmd.js.map +1 -0
- package/packages/cli/dist/commands/search-cmd.d.ts +4 -0
- package/packages/cli/dist/commands/search-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/search-cmd.js +38 -0
- package/packages/cli/dist/commands/search-cmd.js.map +1 -0
- package/packages/cli/dist/commands/serve-cmd.d.ts +2 -0
- package/packages/cli/dist/commands/serve-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/serve-cmd.js +14 -0
- package/packages/cli/dist/commands/serve-cmd.js.map +1 -0
- package/packages/cli/dist/commands/status-cmd.d.ts +2 -0
- package/packages/cli/dist/commands/status-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/status-cmd.js +33 -0
- package/packages/cli/dist/commands/status-cmd.js.map +1 -0
- package/packages/cli/dist/commands/sync-cmd.d.ts +5 -0
- package/packages/cli/dist/commands/sync-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/sync-cmd.js +62 -0
- package/packages/cli/dist/commands/sync-cmd.js.map +1 -0
- package/packages/cli/dist/commands/vault-cmd.d.ts +10 -0
- package/packages/cli/dist/commands/vault-cmd.d.ts.map +1 -0
- package/packages/cli/dist/commands/vault-cmd.js +54 -0
- package/packages/cli/dist/commands/vault-cmd.js.map +1 -0
- package/packages/cli/dist/index.d.ts +2 -0
- package/packages/cli/dist/index.d.ts.map +1 -0
- package/packages/cli/dist/index.js +156 -0
- package/packages/cli/dist/index.js.map +1 -0
- package/packages/cli/package.json +24 -0
- package/packages/cli/src/commands/brief-cmd.ts +87 -0
- package/packages/cli/src/commands/capture-cmd.ts +34 -0
- package/packages/cli/src/commands/card-cmd.ts +29 -0
- package/packages/cli/src/commands/clip-cmd.ts +172 -0
- package/packages/cli/src/commands/cloud-cmd.ts +75 -0
- package/packages/cli/src/commands/contradictions-cmd.ts +41 -0
- package/packages/cli/src/commands/decay-cmd.ts +57 -0
- package/packages/cli/src/commands/digest-cmd.ts +89 -0
- package/packages/cli/src/commands/duplicates-cmd.ts +38 -0
- package/packages/cli/src/commands/federate-cmd.ts +236 -0
- package/packages/cli/src/commands/gaps-cmd.ts +40 -0
- package/packages/cli/src/commands/graph-cmd.ts +88 -0
- package/packages/cli/src/commands/index-cmd.ts +65 -0
- package/packages/cli/src/commands/init-cmd.ts +145 -0
- package/packages/cli/src/commands/learn-cmd.ts +56 -0
- package/packages/cli/src/commands/pack-cmd.ts +121 -0
- package/packages/cli/src/commands/review-cmd.ts +125 -0
- package/packages/cli/src/commands/search-cmd.ts +45 -0
- package/packages/cli/src/commands/serve-cmd.ts +17 -0
- package/packages/cli/src/commands/status-cmd.ts +37 -0
- package/packages/cli/src/commands/sync-cmd.ts +68 -0
- package/packages/cli/src/commands/vault-cmd.ts +64 -0
- package/packages/cli/src/index.ts +187 -0
- package/packages/core/package.json +40 -0
- package/packages/core/src/api/dashboard.ts +138 -0
- package/packages/core/src/api/graph-data.ts +286 -0
- package/packages/core/src/api/pwa.ts +82 -0
- package/packages/core/src/api/server.ts +660 -0
- package/packages/core/src/capture/voice.ts +168 -0
- package/packages/core/src/cloud/index.ts +2 -0
- package/packages/core/src/cloud/sync.ts +167 -0
- package/packages/core/src/config.ts +82 -0
- package/packages/core/src/federation/credits.ts +80 -0
- package/packages/core/src/federation/hyperswarm.d.ts +19 -0
- package/packages/core/src/federation/identity.ts +90 -0
- package/packages/core/src/federation/index.ts +8 -0
- package/packages/core/src/federation/node.ts +235 -0
- package/packages/core/src/federation/privacy.ts +52 -0
- package/packages/core/src/federation/reputation.ts +202 -0
- package/packages/core/src/federation/search.ts +129 -0
- package/packages/core/src/federation/sharing.ts +165 -0
- package/packages/core/src/federation/trust.ts +76 -0
- package/packages/core/src/federation/types.ts +25 -0
- package/packages/core/src/i18n/index.ts +85 -0
- package/packages/core/src/index.ts +133 -0
- package/packages/core/src/indexer/chunker.ts +180 -0
- package/packages/core/src/indexer/embedder.ts +9 -0
- package/packages/core/src/indexer/index.ts +113 -0
- package/packages/core/src/indexer/local-embedder.ts +35 -0
- package/packages/core/src/indexer/scanner.ts +142 -0
- package/packages/core/src/indexer/watcher.ts +62 -0
- package/packages/core/src/intelligence/contradiction-detector.ts +134 -0
- package/packages/core/src/intelligence/decay-engine.ts +229 -0
- package/packages/core/src/intelligence/duplicate-detector.ts +71 -0
- package/packages/core/src/intelligence/fsrs.ts +79 -0
- package/packages/core/src/intelligence/gap-detector.ts +109 -0
- package/packages/core/src/intelligence/learning-path.ts +86 -0
- package/packages/core/src/intelligence/notifications.ts +106 -0
- package/packages/core/src/intelligence/predictive-gaps.ts +94 -0
- package/packages/core/src/intelligence/semantic-versioning.ts +97 -0
- package/packages/core/src/intelligence/types.ts +28 -0
- package/packages/core/src/mcp/custom-tools.ts +97 -0
- package/packages/core/src/mcp/index.ts +1 -0
- package/packages/core/src/mcp/server.ts +142 -0
- package/packages/core/src/mcp/tools/agentic-graph.ts +96 -0
- package/packages/core/src/mcp/tools/brief.ts +49 -0
- package/packages/core/src/mcp/tools/decay.ts +40 -0
- package/packages/core/src/mcp/tools/decision-journal.ts +95 -0
- package/packages/core/src/mcp/tools/export.ts +72 -0
- package/packages/core/src/mcp/tools/federated-search.ts +43 -0
- package/packages/core/src/mcp/tools/generate-claude-md.ts +130 -0
- package/packages/core/src/mcp/tools/get-document.ts +26 -0
- package/packages/core/src/mcp/tools/get-related.ts +41 -0
- package/packages/core/src/mcp/tools/learning-path.ts +52 -0
- package/packages/core/src/mcp/tools/list-topics.ts +20 -0
- package/packages/core/src/mcp/tools/search.ts +35 -0
- package/packages/core/src/mcp/tools/snapshot.ts +98 -0
- package/packages/core/src/multi-vault/index.ts +118 -0
- package/packages/core/src/pack/creator.ts +127 -0
- package/packages/core/src/pack/exporter.ts +21 -0
- package/packages/core/src/pack/importer.ts +82 -0
- package/packages/core/src/pack/index.ts +5 -0
- package/packages/core/src/pack/marketplace.ts +103 -0
- package/packages/core/src/pack/pii-masker.ts +38 -0
- package/packages/core/src/pack/types.ts +39 -0
- package/packages/core/src/plugins/index.ts +100 -0
- package/packages/core/src/plugins/webhooks.ts +110 -0
- package/packages/core/src/search/bm25.ts +16 -0
- package/packages/core/src/search/index.ts +83 -0
- package/packages/core/src/search/rrf.ts +31 -0
- package/packages/core/src/search/semantic.ts +15 -0
- package/packages/core/src/store/index.ts +2 -0
- package/packages/core/src/store/sqlite-vec.ts +290 -0
- package/packages/core/src/store/types.ts +22 -0
- package/packages/core/src/team/index.ts +126 -0
- package/packages/core/src/types/chunk.ts +25 -0
- package/packages/core/src/types/document.ts +24 -0
- package/packages/core/src/types/graph.ts +44 -0
- package/packages/core/src/types/index.ts +15 -0
- package/packages/core/src/types/search.ts +38 -0
- package/packages/core/src/utils/retry.ts +85 -0
- package/packages/core/tests/api-card.test.ts +60 -0
- package/packages/core/tests/api-routes.test.ts +98 -0
- package/packages/core/tests/bm25.test.ts +87 -0
- package/packages/core/tests/chunker.test.ts +48 -0
- package/packages/core/tests/cluster.test.ts +75 -0
- package/packages/core/tests/constellation.test.ts +77 -0
- package/packages/core/tests/export-utils.test.ts +97 -0
- package/packages/core/tests/fsrs.test.ts +96 -0
- package/packages/core/tests/gesture-detector.test.ts +45 -0
- package/packages/core/tests/graph-data.test.ts +87 -0
- package/packages/core/tests/layout.test.ts +83 -0
- package/packages/core/tests/mcp.test.ts +148 -0
- package/packages/core/tests/pack.test.ts +127 -0
- package/packages/core/tests/pii-masker.test.ts +42 -0
- package/packages/core/tests/profile-card.test.ts +62 -0
- package/packages/core/tests/rrf.test.ts +29 -0
- package/packages/core/tests/search-integration.test.ts +139 -0
- package/packages/core/tests/store.test.ts +80 -0
- package/packages/graph/click-result.png +0 -0
- package/packages/graph/index.html +17 -0
- package/packages/graph/package.json +32 -0
- package/packages/graph/src/App.tsx +7 -0
- package/packages/graph/src/api/client.ts +39 -0
- package/packages/graph/src/components/ClusterFilter.tsx +73 -0
- package/packages/graph/src/components/ConstellationView.tsx +232 -0
- package/packages/graph/src/components/ExportPanel.tsx +177 -0
- package/packages/graph/src/components/Graph3D.tsx +230 -0
- package/packages/graph/src/components/GraphEdges.tsx +100 -0
- package/packages/graph/src/components/GraphNodes.tsx +386 -0
- package/packages/graph/src/components/HealthDashboard.tsx +173 -0
- package/packages/graph/src/components/Layout.tsx +214 -0
- package/packages/graph/src/components/MotionOverlay.tsx +81 -0
- package/packages/graph/src/components/MotionToggle.tsx +33 -0
- package/packages/graph/src/components/MultiverseView.tsx +286 -0
- package/packages/graph/src/components/NodeDetail.tsx +232 -0
- package/packages/graph/src/components/PulseParticle.tsx +232 -0
- package/packages/graph/src/components/SearchBar.tsx +107 -0
- package/packages/graph/src/components/StarField.tsx +197 -0
- package/packages/graph/src/components/StatusBar.tsx +53 -0
- package/packages/graph/src/components/Timeline.tsx +148 -0
- package/packages/graph/src/components/ToolsPanel.tsx +512 -0
- package/packages/graph/src/components/Tooltip.tsx +100 -0
- package/packages/graph/src/components/TypeFilter.tsx +131 -0
- package/packages/graph/src/embed/EmbedGraph.tsx +144 -0
- package/packages/graph/src/hooks/useConstellationLOD.ts +76 -0
- package/packages/graph/src/hooks/useDecay.ts +37 -0
- package/packages/graph/src/hooks/useExport.ts +165 -0
- package/packages/graph/src/hooks/useGraph.ts +69 -0
- package/packages/graph/src/hooks/useKeyboardNav.ts +122 -0
- package/packages/graph/src/hooks/useLayout.ts +45 -0
- package/packages/graph/src/hooks/useMotion.ts +120 -0
- package/packages/graph/src/hooks/usePulse.ts +58 -0
- package/packages/graph/src/hooks/useSearch.ts +71 -0
- package/packages/graph/src/lib/constellation.ts +107 -0
- package/packages/graph/src/lib/export-utils.ts +48 -0
- package/packages/graph/src/lib/gesture-detector.ts +123 -0
- package/packages/graph/src/lib/layout.worker.ts +153 -0
- package/packages/graph/src/lib/motion-controller.ts +83 -0
- package/packages/graph/src/lib/profile-card.ts +122 -0
- package/packages/graph/src/main.tsx +4 -0
- package/packages/graph/src/stores/graph-store.ts +155 -0
- package/packages/graph/success.png +0 -0
- package/packages/graph/test-click.mjs +49 -0
- package/packages/graph/test-explore.mjs +102 -0
- package/packages/graph/test-final.mjs +61 -0
- package/packages/graph/test-graph.mjs +139 -0
- package/packages/graph/test-hover.mjs +48 -0
- package/packages/graph/test-pulse.mjs +68 -0
- package/packages/graph/test-screenshot.mjs +56 -0
- package/packages/graph/test-v2.mjs +97 -0
- package/packages/graph/vite.config.ts +15 -0
- package/packages/sync/.env.example +11 -0
- package/packages/sync/.sync-state.json +317 -0
- package/packages/sync/.upload-state.json +1009 -0
- package/packages/sync/create-stella-network-notion.mjs +151 -0
- package/packages/sync/create-stellavault-project-notion.mjs +322 -0
- package/packages/sync/logs/sync-2026-03-28.log +6 -0
- package/packages/sync/logs/sync-2026-03-29.log +12 -0
- package/packages/sync/logs/sync-2026-03-30.log +6 -0
- package/packages/sync/logs/sync-2026-03-31.log +6 -0
- package/packages/sync/logs/sync-2026-04-01.log +6 -0
- package/packages/sync/logs/sync-2026-04-02.log +6 -0
- package/packages/sync/package-lock.json +373 -0
- package/packages/sync/package.json +16 -0
- package/packages/sync/run-sync.bat +18 -0
- package/packages/sync/run-sync.mjs +46 -0
- package/packages/sync/setup-scheduler.mjs +119 -0
- package/packages/sync/structured-sync.mjs +187 -0
- package/packages/sync/sync-to-obsidian.mjs +264 -0
- package/packages/sync/upload-pdca-to-notion.mjs +495 -0
- package/tsconfig.base.json +18 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
// 사이드패널: 클릭된 노드의 문서 미리보기
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState, useRef, useMemo } from 'react';
|
|
4
|
+
import Markdown from 'react-markdown';
|
|
5
|
+
import { fetchDocument } from '../api/client.js';
|
|
6
|
+
import { useGraphStore } from '../stores/graph-store.js';
|
|
7
|
+
|
|
8
|
+
interface DocData {
|
|
9
|
+
id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
filePath: string;
|
|
12
|
+
content: string;
|
|
13
|
+
tags: string[];
|
|
14
|
+
lastModified: string;
|
|
15
|
+
related: Array<{ id: string; title: string; score: number }>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function NodeDetail() {
|
|
19
|
+
const selectedNodeId = useGraphStore((s) => s.selectedNodeId);
|
|
20
|
+
const selectNode = useGraphStore((s) => s.selectNode);
|
|
21
|
+
const theme = useGraphStore((s) => s.theme);
|
|
22
|
+
const isDark = theme === 'dark';
|
|
23
|
+
const [doc, setDoc] = useState<DocData | null>(null);
|
|
24
|
+
const [loading, setLoading] = useState(false);
|
|
25
|
+
const cacheRef = useRef<Map<string, DocData>>(new Map());
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!selectedNodeId) { setDoc(null); return; }
|
|
29
|
+
|
|
30
|
+
const cached = cacheRef.current.get(selectedNodeId);
|
|
31
|
+
if (cached) { setDoc(cached); return; }
|
|
32
|
+
|
|
33
|
+
let cancelled = false;
|
|
34
|
+
setLoading(true);
|
|
35
|
+
fetchDocument(selectedNodeId)
|
|
36
|
+
.then((data: any) => {
|
|
37
|
+
if (!cancelled) { setDoc(data); cacheRef.current.set(selectedNodeId, data); }
|
|
38
|
+
})
|
|
39
|
+
.catch(() => { if (!cancelled) setDoc(null); })
|
|
40
|
+
.finally(() => { if (!cancelled) setLoading(false); });
|
|
41
|
+
return () => { cancelled = true; };
|
|
42
|
+
}, [selectedNodeId]);
|
|
43
|
+
|
|
44
|
+
if (!selectedNodeId) return null;
|
|
45
|
+
|
|
46
|
+
// Theme colors
|
|
47
|
+
const bg = isDark ? '#0d0d18' : '#fafafa';
|
|
48
|
+
const border = isDark ? 'rgba(100, 120, 255, 0.15)' : 'rgba(0, 0, 0, 0.08)';
|
|
49
|
+
const textPrimary = isDark ? '#e0e0f0' : '#1a1a2e';
|
|
50
|
+
const textSecondary = isDark ? '#556' : '#888';
|
|
51
|
+
const textBody = isDark ? '#b0b0c0' : '#444';
|
|
52
|
+
const tagBg = isDark ? 'rgba(100, 120, 255, 0.1)' : 'rgba(80, 100, 200, 0.08)';
|
|
53
|
+
const tagColor = isDark ? '#88aaff' : '#4466aa';
|
|
54
|
+
const btnBg = isDark ? 'rgba(100, 120, 255, 0.1)' : 'rgba(80, 100, 200, 0.06)';
|
|
55
|
+
const btnBorder = isDark ? 'rgba(100, 120, 255, 0.2)' : 'rgba(80, 100, 200, 0.15)';
|
|
56
|
+
const btnColor = isDark ? '#88aaff' : '#4466aa';
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div style={{
|
|
60
|
+
width: '380px', background: bg,
|
|
61
|
+
borderLeft: `1px solid ${border}`,
|
|
62
|
+
display: 'flex', flexDirection: 'column', overflow: 'hidden',
|
|
63
|
+
}}>
|
|
64
|
+
<div style={{
|
|
65
|
+
padding: '10px 16px',
|
|
66
|
+
borderBottom: `1px solid ${border}`,
|
|
67
|
+
display: 'flex', justifyContent: 'space-between', alignItems: 'center',
|
|
68
|
+
}}>
|
|
69
|
+
<span style={{ fontSize: '11px', color: textSecondary, textTransform: 'uppercase', letterSpacing: '1px' }}>
|
|
70
|
+
Document Preview
|
|
71
|
+
</span>
|
|
72
|
+
<button
|
|
73
|
+
onClick={() => selectNode(null)}
|
|
74
|
+
style={{ background: 'none', border: 'none', color: textSecondary, cursor: 'pointer', fontSize: '14px', padding: '2px 6px' }}
|
|
75
|
+
>
|
|
76
|
+
x
|
|
77
|
+
</button>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
{loading ? (
|
|
81
|
+
<div style={{ padding: '24px 16px', color: textSecondary }}>Loading...</div>
|
|
82
|
+
) : doc ? (
|
|
83
|
+
<div style={{ flex: 1, overflowY: 'auto', padding: '16px' }}>
|
|
84
|
+
<h2 style={{ fontSize: '16px', fontWeight: 600, color: textPrimary, marginBottom: '6px', lineHeight: 1.3 }}>
|
|
85
|
+
{doc.title}
|
|
86
|
+
</h2>
|
|
87
|
+
{doc.tags.length > 0 && (
|
|
88
|
+
<div style={{ display: 'flex', gap: '5px', flexWrap: 'wrap', marginBottom: '10px' }}>
|
|
89
|
+
{doc.tags.map((tag) => (
|
|
90
|
+
<span key={tag} style={{ fontSize: '10px', color: tagColor, background: tagBg, padding: '1px 7px', borderRadius: '4px' }}>
|
|
91
|
+
#{tag}
|
|
92
|
+
</span>
|
|
93
|
+
))}
|
|
94
|
+
</div>
|
|
95
|
+
)}
|
|
96
|
+
<div style={{ fontSize: '10px', color: textSecondary, marginBottom: '12px' }}>
|
|
97
|
+
{new Date(doc.lastModified).toLocaleDateString('ko-KR')}
|
|
98
|
+
</div>
|
|
99
|
+
<button
|
|
100
|
+
onClick={() => {
|
|
101
|
+
setTimeout(() => (window as any).__sv_pulse?.(doc.id), 100);
|
|
102
|
+
}}
|
|
103
|
+
style={{
|
|
104
|
+
width: '100%', padding: '7px', marginBottom: '8px',
|
|
105
|
+
background: btnBg, border: `1px solid ${btnBorder}`,
|
|
106
|
+
borderRadius: '5px', color: btnColor, fontSize: '11px', cursor: 'pointer',
|
|
107
|
+
}}
|
|
108
|
+
>
|
|
109
|
+
Explore connections
|
|
110
|
+
</button>
|
|
111
|
+
<button
|
|
112
|
+
onClick={async () => {
|
|
113
|
+
const relFile = (doc.filePath ?? doc.title).replace(/\\/g, '/').replace(/\.md$/, '');
|
|
114
|
+
let vault = 'Evan';
|
|
115
|
+
try {
|
|
116
|
+
const res = await fetch('http://127.0.0.1:3333/api/stats');
|
|
117
|
+
const stats = await res.json();
|
|
118
|
+
if (stats.vaultName) vault = stats.vaultName;
|
|
119
|
+
} catch { /* fallback */ }
|
|
120
|
+
const uri = `obsidian://open?vault=${encodeURIComponent(vault)}&file=${encodeURIComponent(relFile)}`;
|
|
121
|
+
window.location.href = uri;
|
|
122
|
+
}}
|
|
123
|
+
style={{
|
|
124
|
+
width: '100%', padding: '7px', marginBottom: '14px',
|
|
125
|
+
background: isDark ? 'rgba(140, 100, 255, 0.08)' : 'rgba(120, 80, 200, 0.05)',
|
|
126
|
+
border: `1px solid ${isDark ? 'rgba(140, 100, 255, 0.15)' : 'rgba(120, 80, 200, 0.12)'}`,
|
|
127
|
+
borderRadius: '5px', color: isDark ? '#a088ff' : '#6644aa', fontSize: '11px', cursor: 'pointer',
|
|
128
|
+
}}
|
|
129
|
+
>
|
|
130
|
+
Open in Obsidian
|
|
131
|
+
</button>
|
|
132
|
+
<ContentAccordion content={doc.content} isDark={isDark} />
|
|
133
|
+
{doc.related.length > 0 && (
|
|
134
|
+
<div style={{ marginTop: '20px', paddingTop: '12px', borderTop: `1px solid ${border}` }}>
|
|
135
|
+
<div style={{ fontSize: '10px', color: textSecondary, textTransform: 'uppercase', letterSpacing: '1px', marginBottom: '6px' }}>
|
|
136
|
+
Related
|
|
137
|
+
</div>
|
|
138
|
+
{doc.related.map((r) => (
|
|
139
|
+
<div
|
|
140
|
+
key={r.id}
|
|
141
|
+
onClick={() => selectNode(r.id)}
|
|
142
|
+
style={{ padding: '4px 0', fontSize: '11px', color: isDark ? '#778' : '#555', cursor: 'pointer' }}
|
|
143
|
+
>
|
|
144
|
+
{r.title}
|
|
145
|
+
</div>
|
|
146
|
+
))}
|
|
147
|
+
</div>
|
|
148
|
+
)}
|
|
149
|
+
</div>
|
|
150
|
+
) : null}
|
|
151
|
+
</div>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function ContentAccordion({ content, isDark }: { content: string; isDark: boolean }) {
|
|
156
|
+
const sections = useMemo(() => {
|
|
157
|
+
const parts: Array<{ heading: string; body: string }> = [];
|
|
158
|
+
const lines = content.split('\n');
|
|
159
|
+
let currentHeading = 'Overview';
|
|
160
|
+
let currentBody: string[] = [];
|
|
161
|
+
|
|
162
|
+
for (const line of lines) {
|
|
163
|
+
const match = line.match(/^#{1,3}\s+(.+)$/);
|
|
164
|
+
if (match) {
|
|
165
|
+
if (currentBody.length > 0) {
|
|
166
|
+
parts.push({ heading: currentHeading, body: currentBody.join('\n') });
|
|
167
|
+
}
|
|
168
|
+
currentHeading = match[1];
|
|
169
|
+
currentBody = [];
|
|
170
|
+
} else {
|
|
171
|
+
currentBody.push(line);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (currentBody.length > 0) {
|
|
175
|
+
parts.push({ heading: currentHeading, body: currentBody.join('\n') });
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return parts;
|
|
179
|
+
}, [content]);
|
|
180
|
+
|
|
181
|
+
const bodyColor = isDark ? '#b0b0c0' : '#444';
|
|
182
|
+
|
|
183
|
+
if (content.length < 500 || sections.length <= 1) {
|
|
184
|
+
return (
|
|
185
|
+
<div style={{ fontSize: '13px', lineHeight: 1.7, color: bodyColor }}>
|
|
186
|
+
<Markdown>{content}</Markdown>
|
|
187
|
+
</div>
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
<div>
|
|
193
|
+
{sections.map((sec, i) => (
|
|
194
|
+
<AccordionSection key={i} heading={sec.heading} body={sec.body} defaultOpen={i === 0} isDark={isDark} />
|
|
195
|
+
))}
|
|
196
|
+
</div>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function AccordionSection({ heading, body, defaultOpen, isDark }: { heading: string; body: string; defaultOpen: boolean; isDark: boolean }) {
|
|
201
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
202
|
+
const trimmed = body.trim();
|
|
203
|
+
if (!trimmed) return null;
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<div style={{ borderBottom: `1px solid ${isDark ? 'rgba(100,120,255,0.06)' : 'rgba(0,0,0,0.05)'}`, marginBottom: '4px' }}>
|
|
207
|
+
<button
|
|
208
|
+
onClick={() => setOpen(!open)}
|
|
209
|
+
style={{
|
|
210
|
+
width: '100%', textAlign: 'left', background: 'none', border: 'none',
|
|
211
|
+
padding: '8px 0', cursor: 'pointer', display: 'flex', alignItems: 'center', gap: '6px',
|
|
212
|
+
}}
|
|
213
|
+
>
|
|
214
|
+
<span style={{
|
|
215
|
+
fontSize: '10px', color: isDark ? '#556' : '#999', transition: 'transform 0.2s',
|
|
216
|
+
transform: open ? 'rotate(90deg)' : 'rotate(0deg)',
|
|
217
|
+
display: 'inline-block',
|
|
218
|
+
}}>
|
|
219
|
+
▶
|
|
220
|
+
</span>
|
|
221
|
+
<span style={{ fontSize: '12px', fontWeight: 600, color: isDark ? '#99a' : '#555' }}>
|
|
222
|
+
{heading}
|
|
223
|
+
</span>
|
|
224
|
+
</button>
|
|
225
|
+
{open && (
|
|
226
|
+
<div style={{ fontSize: '13px', lineHeight: 1.7, color: isDark ? '#b0b0c0' : '#444', paddingBottom: '8px' }}>
|
|
227
|
+
<Markdown>{trimmed}</Markdown>
|
|
228
|
+
</div>
|
|
229
|
+
)}
|
|
230
|
+
</div>
|
|
231
|
+
);
|
|
232
|
+
}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
// 빛 입자 + 궤적 — 작고 화려한 입자가 부드럽게 이동, 지나간 경로 표시
|
|
2
|
+
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { useFrame } from '@react-three/fiber';
|
|
5
|
+
import * as THREE from 'three';
|
|
6
|
+
import { useGraphStore } from '../stores/graph-store.js';
|
|
7
|
+
import { pulseData } from '../hooks/usePulse.js';
|
|
8
|
+
|
|
9
|
+
const TRAIL_LENGTH = 60; // 궤적 점 개수
|
|
10
|
+
|
|
11
|
+
export function PulseAnimator() {
|
|
12
|
+
const coreRef = useRef<THREE.Points>(null);
|
|
13
|
+
const glowRef = useRef<THREE.Points>(null);
|
|
14
|
+
const trailRef = useRef<THREE.Line>(null);
|
|
15
|
+
const theme = useGraphStore((s) => s.theme);
|
|
16
|
+
const isLight = theme === 'light';
|
|
17
|
+
|
|
18
|
+
const stepRef = useRef(0);
|
|
19
|
+
const tRef = useRef(0);
|
|
20
|
+
const litRef = useRef<string[]>([]);
|
|
21
|
+
const flashRef = useRef(0);
|
|
22
|
+
|
|
23
|
+
// 궤적 위치 버퍼 (ring buffer)
|
|
24
|
+
const trailBuf = useRef(new Float32Array(TRAIL_LENGTH * 3));
|
|
25
|
+
const trailHead = useRef(0);
|
|
26
|
+
const trailCount = useRef(0);
|
|
27
|
+
|
|
28
|
+
// 원형 텍스처 (노드와 동일 스타일)
|
|
29
|
+
const texture = useRef<THREE.Texture | null>(null);
|
|
30
|
+
if (!texture.current) {
|
|
31
|
+
const sz = 64;
|
|
32
|
+
const cv = document.createElement('canvas');
|
|
33
|
+
cv.width = sz; cv.height = sz;
|
|
34
|
+
const ctx = cv.getContext('2d')!;
|
|
35
|
+
const g = ctx.createRadialGradient(sz/2, sz/2, 0, sz/2, sz/2, sz/2);
|
|
36
|
+
g.addColorStop(0, 'rgba(255,255,255,1)');
|
|
37
|
+
g.addColorStop(0.2, 'rgba(180,220,255,0.9)');
|
|
38
|
+
g.addColorStop(0.5, 'rgba(100,180,255,0.3)');
|
|
39
|
+
g.addColorStop(1, 'rgba(60,120,255,0)');
|
|
40
|
+
ctx.fillStyle = g;
|
|
41
|
+
ctx.fillRect(0, 0, sz, sz);
|
|
42
|
+
texture.current = new THREE.CanvasTexture(cv);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
useFrame(() => {
|
|
46
|
+
const core = coreRef.current;
|
|
47
|
+
const glow = glowRef.current;
|
|
48
|
+
const trail = trailRef.current;
|
|
49
|
+
if (!core || !glow || !trail) return;
|
|
50
|
+
|
|
51
|
+
if (!pulseData.running || pulseData.visitOrder.length === 0) {
|
|
52
|
+
core.visible = false;
|
|
53
|
+
glow.visible = false;
|
|
54
|
+
trail.visible = false;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
core.visible = true;
|
|
59
|
+
glow.visible = true;
|
|
60
|
+
trail.visible = true;
|
|
61
|
+
|
|
62
|
+
const { visitOrder, positions } = pulseData;
|
|
63
|
+
const step = stepRef.current;
|
|
64
|
+
|
|
65
|
+
if (step >= visitOrder.length - 1) {
|
|
66
|
+
pulseData.running = false;
|
|
67
|
+
core.visible = false;
|
|
68
|
+
glow.visible = false;
|
|
69
|
+
// 탐색 완료 — 하이라이트 3초간 유지 후 해제
|
|
70
|
+
const finalLit = [...litRef.current];
|
|
71
|
+
setTimeout(() => {
|
|
72
|
+
// 아직 같은 하이라이트 상태이면 해제
|
|
73
|
+
const current = useGraphStore.getState().highlightedNodeIds;
|
|
74
|
+
if (finalLit.length > 0 && finalLit.every(id => current.has(id))) {
|
|
75
|
+
useGraphStore.getState().setHighlightedNodes([]);
|
|
76
|
+
}
|
|
77
|
+
useGraphStore.getState().setPulseParticlePos(null);
|
|
78
|
+
stepRef.current = 0;
|
|
79
|
+
tRef.current = 0;
|
|
80
|
+
litRef.current = [];
|
|
81
|
+
trailCount.current = 0;
|
|
82
|
+
if (trail) trail.visible = false;
|
|
83
|
+
}, 3000);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const from = positions.get(visitOrder[step]) ?? [0, 0, 0];
|
|
88
|
+
const to = positions.get(visitOrder[step + 1]) ?? [0, 0, 0];
|
|
89
|
+
|
|
90
|
+
// 부드러운 이동
|
|
91
|
+
tRef.current += 0.03;
|
|
92
|
+
const t = tRef.current;
|
|
93
|
+
const ease = t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2;
|
|
94
|
+
|
|
95
|
+
const x = from[0] + (to[0] - from[0]) * ease;
|
|
96
|
+
const y = from[1] + (to[1] - from[1]) * ease;
|
|
97
|
+
const z = from[2] + (to[2] - from[2]) * ease;
|
|
98
|
+
|
|
99
|
+
// 코어 입자 위치
|
|
100
|
+
const corePos = core.geometry.getAttribute('position') as THREE.BufferAttribute;
|
|
101
|
+
corePos.setXYZ(0, x, y, z);
|
|
102
|
+
corePos.needsUpdate = true;
|
|
103
|
+
|
|
104
|
+
const glowPos = glow.geometry.getAttribute('position') as THREE.BufferAttribute;
|
|
105
|
+
glowPos.setXYZ(0, x, y, z);
|
|
106
|
+
glowPos.needsUpdate = true;
|
|
107
|
+
|
|
108
|
+
// 궤적 기록
|
|
109
|
+
const tb = trailBuf.current;
|
|
110
|
+
const hi = trailHead.current % TRAIL_LENGTH;
|
|
111
|
+
tb[hi * 3] = x;
|
|
112
|
+
tb[hi * 3 + 1] = y;
|
|
113
|
+
tb[hi * 3 + 2] = z;
|
|
114
|
+
trailHead.current++;
|
|
115
|
+
trailCount.current = Math.min(trailCount.current + 1, TRAIL_LENGTH);
|
|
116
|
+
|
|
117
|
+
// 궤적 라인 업데이트
|
|
118
|
+
const trailPos = trail.geometry.getAttribute('position') as THREE.BufferAttribute;
|
|
119
|
+
const count = trailCount.current;
|
|
120
|
+
for (let i = 0; i < TRAIL_LENGTH; i++) {
|
|
121
|
+
if (i < count) {
|
|
122
|
+
const idx = ((trailHead.current - count + i) % TRAIL_LENGTH + TRAIL_LENGTH) % TRAIL_LENGTH;
|
|
123
|
+
trailPos.setXYZ(i, tb[idx * 3], tb[idx * 3 + 1], tb[idx * 3 + 2]);
|
|
124
|
+
} else {
|
|
125
|
+
trailPos.setXYZ(i, x, y, z); // 아직 안 채워진 부분은 현재 위치
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
trailPos.needsUpdate = true;
|
|
129
|
+
trail.geometry.setDrawRange(0, count);
|
|
130
|
+
|
|
131
|
+
// 플래시 감쇠
|
|
132
|
+
flashRef.current *= 0.88;
|
|
133
|
+
|
|
134
|
+
// Light mode: 진한 색 + NormalBlending / Dark mode: 밝은 색 + AdditiveBlending
|
|
135
|
+
const currentIsLight = useGraphStore.getState().theme === 'light';
|
|
136
|
+
|
|
137
|
+
// 코어
|
|
138
|
+
const coreMat = core.material as THREE.PointsMaterial;
|
|
139
|
+
coreMat.size = (currentIsLight ? 12 : 8) + flashRef.current * 6;
|
|
140
|
+
coreMat.color.set(currentIsLight ? '#1144cc' : '#ffffff');
|
|
141
|
+
coreMat.blending = currentIsLight ? THREE.NormalBlending : THREE.AdditiveBlending;
|
|
142
|
+
coreMat.opacity = currentIsLight ? 1.0 : 0.95;
|
|
143
|
+
|
|
144
|
+
// 글로우
|
|
145
|
+
const glowMat = glow.material as THREE.PointsMaterial;
|
|
146
|
+
glowMat.size = (currentIsLight ? 28 : 20) + flashRef.current * 15;
|
|
147
|
+
glowMat.opacity = currentIsLight ? (0.3 + flashRef.current * 0.3) : (0.25 + flashRef.current * 0.2);
|
|
148
|
+
glowMat.color.set(currentIsLight ? '#2266dd' : '#66ddff');
|
|
149
|
+
glowMat.blending = currentIsLight ? THREE.NormalBlending : THREE.AdditiveBlending;
|
|
150
|
+
|
|
151
|
+
// 궤적
|
|
152
|
+
const trailMat = trail.material as THREE.LineBasicMaterial;
|
|
153
|
+
trailMat.color.set(currentIsLight ? '#2255bb' : '#44bbff');
|
|
154
|
+
trailMat.opacity = currentIsLight ? 0.5 : 0.25;
|
|
155
|
+
trailMat.blending = currentIsLight ? THREE.NormalBlending : THREE.AdditiveBlending;
|
|
156
|
+
|
|
157
|
+
// 노드 도착
|
|
158
|
+
if (t >= 1) {
|
|
159
|
+
tRef.current = 0;
|
|
160
|
+
stepRef.current++;
|
|
161
|
+
|
|
162
|
+
const arrivedId = visitOrder[Math.min(step + 1, visitOrder.length - 1)];
|
|
163
|
+
if (!litRef.current.includes(arrivedId)) {
|
|
164
|
+
litRef.current.push(arrivedId);
|
|
165
|
+
useGraphStore.getState().setHighlightedNodes([...litRef.current]);
|
|
166
|
+
}
|
|
167
|
+
flashRef.current = 1;
|
|
168
|
+
|
|
169
|
+
// 도착 노드 툴팁 표시 (0.8초 후 자동 해제)
|
|
170
|
+
useGraphStore.getState().hoverNode(arrivedId);
|
|
171
|
+
setTimeout(() => {
|
|
172
|
+
// 아직 같은 노드를 표시 중이면 해제
|
|
173
|
+
if (useGraphStore.getState().hoveredNodeId === arrivedId) {
|
|
174
|
+
useGraphStore.getState().hoverNode(null);
|
|
175
|
+
}
|
|
176
|
+
}, 800);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
return (
|
|
181
|
+
<group>
|
|
182
|
+
{/* 궤적 라인 — 시안 글로우 */}
|
|
183
|
+
<primitive
|
|
184
|
+
ref={trailRef}
|
|
185
|
+
object={(() => {
|
|
186
|
+
const geo = new THREE.BufferGeometry();
|
|
187
|
+
geo.setAttribute('position', new THREE.Float32BufferAttribute(new Float32Array(TRAIL_LENGTH * 3), 3));
|
|
188
|
+
const mat = new THREE.LineBasicMaterial({
|
|
189
|
+
color: '#44bbff', transparent: true, opacity: 0.25,
|
|
190
|
+
depthWrite: false, blending: THREE.AdditiveBlending,
|
|
191
|
+
});
|
|
192
|
+
return new THREE.Line(geo, mat);
|
|
193
|
+
})()}
|
|
194
|
+
visible={false}
|
|
195
|
+
/>
|
|
196
|
+
|
|
197
|
+
{/* 글로우 (부드러운 빛 번짐) */}
|
|
198
|
+
<points ref={glowRef} visible={false}>
|
|
199
|
+
<bufferGeometry>
|
|
200
|
+
<bufferAttribute attach="attributes-position" args={[new Float32Array(3), 3]} />
|
|
201
|
+
</bufferGeometry>
|
|
202
|
+
<pointsMaterial
|
|
203
|
+
color="#66ddff"
|
|
204
|
+
size={20}
|
|
205
|
+
transparent
|
|
206
|
+
opacity={0.25}
|
|
207
|
+
depthWrite={false}
|
|
208
|
+
blending={THREE.AdditiveBlending}
|
|
209
|
+
sizeAttenuation
|
|
210
|
+
map={texture.current}
|
|
211
|
+
/>
|
|
212
|
+
</points>
|
|
213
|
+
|
|
214
|
+
{/* 코어 (밝은 화이트 점) */}
|
|
215
|
+
<points ref={coreRef} visible={false}>
|
|
216
|
+
<bufferGeometry>
|
|
217
|
+
<bufferAttribute attach="attributes-position" args={[new Float32Array(3), 3]} />
|
|
218
|
+
</bufferGeometry>
|
|
219
|
+
<pointsMaterial
|
|
220
|
+
color="#ffffff"
|
|
221
|
+
size={8}
|
|
222
|
+
transparent
|
|
223
|
+
opacity={0.95}
|
|
224
|
+
depthWrite={false}
|
|
225
|
+
blending={THREE.AdditiveBlending}
|
|
226
|
+
sizeAttenuation
|
|
227
|
+
map={texture.current}
|
|
228
|
+
/>
|
|
229
|
+
</points>
|
|
230
|
+
</group>
|
|
231
|
+
);
|
|
232
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// 검색바 — 상단 헤더에 통합, 결과 수 표시, 검색 히스토리
|
|
2
|
+
|
|
3
|
+
import { useRef, useState } from 'react';
|
|
4
|
+
import { useSearch } from '../hooks/useSearch.js';
|
|
5
|
+
import { useGraphStore } from '../stores/graph-store.js';
|
|
6
|
+
|
|
7
|
+
export function SearchBar() {
|
|
8
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
9
|
+
const { search, clearSearch } = useSearch();
|
|
10
|
+
const query = useGraphStore((s) => s.searchQuery);
|
|
11
|
+
const highlightedCount = useGraphStore((s) => s.highlightedNodeIds.size);
|
|
12
|
+
const searchHistory = useGraphStore((s) => s.searchHistory);
|
|
13
|
+
const clearSearchHistory = useGraphStore((s) => s.clearSearchHistory);
|
|
14
|
+
const theme = useGraphStore((s) => s.theme);
|
|
15
|
+
const isDark = theme === 'dark';
|
|
16
|
+
const [showHistory, setShowHistory] = useState(false);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
20
|
+
<div style={{
|
|
21
|
+
position: 'relative',
|
|
22
|
+
display: 'flex', alignItems: 'center',
|
|
23
|
+
background: isDark ? 'rgba(100, 120, 255, 0.06)' : 'rgba(0, 0, 0, 0.03)',
|
|
24
|
+
border: `1px solid ${isDark ? 'rgba(100, 120, 255, 0.15)' : 'rgba(0, 0, 0, 0.1)'}`,
|
|
25
|
+
borderRadius: '6px', padding: '0 10px',
|
|
26
|
+
}}>
|
|
27
|
+
<span style={{ fontSize: '12px', color: isDark ? '#556' : '#999', marginRight: '6px' }}>
|
|
28
|
+
{'\u{1F50D}'}
|
|
29
|
+
</span>
|
|
30
|
+
<input
|
|
31
|
+
ref={inputRef}
|
|
32
|
+
type="text"
|
|
33
|
+
placeholder="Search knowledge..."
|
|
34
|
+
value={query}
|
|
35
|
+
onChange={(e) => search(e.target.value)}
|
|
36
|
+
onFocus={() => setShowHistory(true)}
|
|
37
|
+
onBlur={() => setTimeout(() => setShowHistory(false), 200)}
|
|
38
|
+
onKeyDown={(e) => { if (e.key === 'Escape') { clearSearch(); setShowHistory(false); inputRef.current?.blur(); } }}
|
|
39
|
+
style={{
|
|
40
|
+
background: 'transparent', border: 'none', outline: 'none',
|
|
41
|
+
color: isDark ? '#c0c0f0' : '#2a2a4a',
|
|
42
|
+
fontSize: '12px', padding: '5px 0',
|
|
43
|
+
width: '160px',
|
|
44
|
+
}}
|
|
45
|
+
/>
|
|
46
|
+
{query && (
|
|
47
|
+
<button
|
|
48
|
+
onClick={clearSearch}
|
|
49
|
+
style={{
|
|
50
|
+
background: 'none', border: 'none',
|
|
51
|
+
color: isDark ? '#556' : '#999',
|
|
52
|
+
cursor: 'pointer', fontSize: '12px', padding: '0 2px',
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
x
|
|
56
|
+
</button>
|
|
57
|
+
)}
|
|
58
|
+
|
|
59
|
+
{/* 검색 히스토리 드롭다운 */}
|
|
60
|
+
{showHistory && !query && searchHistory.length > 0 && (
|
|
61
|
+
<div style={{
|
|
62
|
+
position: 'absolute', top: '100%', left: 0, marginTop: '4px',
|
|
63
|
+
background: isDark ? 'rgba(10,10,20,0.95)' : 'rgba(255,255,255,0.97)',
|
|
64
|
+
border: `1px solid ${isDark ? 'rgba(100,120,255,0.15)' : 'rgba(0,0,0,0.1)'}`,
|
|
65
|
+
borderRadius: '8px', padding: '4px', minWidth: '220px',
|
|
66
|
+
backdropFilter: 'blur(8px)', zIndex: 100,
|
|
67
|
+
boxShadow: isDark ? 'none' : '0 4px 16px rgba(0,0,0,0.08)',
|
|
68
|
+
}}>
|
|
69
|
+
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '2px 6px', marginBottom: '2px' }}>
|
|
70
|
+
<span style={{ fontSize: '9px', color: isDark ? '#556' : '#999', textTransform: 'uppercase', letterSpacing: '0.5px' }}>
|
|
71
|
+
Recent
|
|
72
|
+
</span>
|
|
73
|
+
<button
|
|
74
|
+
onMouseDown={(e) => { e.preventDefault(); clearSearchHistory(); }}
|
|
75
|
+
style={{
|
|
76
|
+
fontSize: '9px', color: isDark ? '#556' : '#999', background: 'none', border: 'none',
|
|
77
|
+
cursor: 'pointer', textDecoration: 'underline',
|
|
78
|
+
}}
|
|
79
|
+
>
|
|
80
|
+
Clear
|
|
81
|
+
</button>
|
|
82
|
+
</div>
|
|
83
|
+
{searchHistory.slice(0, 10).map((q) => (
|
|
84
|
+
<div
|
|
85
|
+
key={q}
|
|
86
|
+
onMouseDown={(e) => { e.preventDefault(); search(q); setShowHistory(false); }}
|
|
87
|
+
style={{
|
|
88
|
+
padding: '4px 8px', fontSize: '11px', cursor: 'pointer', borderRadius: '4px',
|
|
89
|
+
color: isDark ? '#aab' : '#444',
|
|
90
|
+
}}
|
|
91
|
+
onMouseEnter={(e) => { (e.target as HTMLElement).style.background = isDark ? 'rgba(100,120,255,0.1)' : 'rgba(0,0,0,0.04)'; }}
|
|
92
|
+
onMouseLeave={(e) => { (e.target as HTMLElement).style.background = 'transparent'; }}
|
|
93
|
+
>
|
|
94
|
+
{q}
|
|
95
|
+
</div>
|
|
96
|
+
))}
|
|
97
|
+
</div>
|
|
98
|
+
)}
|
|
99
|
+
</div>
|
|
100
|
+
{query && highlightedCount > 0 && (
|
|
101
|
+
<span style={{ fontSize: '11px', color: isDark ? '#88aaff' : '#5577cc' }}>
|
|
102
|
+
{highlightedCount} found
|
|
103
|
+
</span>
|
|
104
|
+
)}
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
}
|