@lipme/vue-blast-viewer 1.0.2 → 1.0.3

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 (39) hide show
  1. package/.vscode/extensions.json +3 -0
  2. package/index.html +13 -0
  3. package/lipme-vue-blast-viewer-1.0.0.tgz +0 -0
  4. package/lipme-vue-blast-viewer-1.0.1.tgz +0 -0
  5. package/lipme-vue-blast-viewer-1.0.2.tgz +0 -0
  6. package/lipme-vue-blast-viewer-1.0.3.tgz +0 -0
  7. package/package.json +5 -5
  8. package/src/App.vue +548 -0
  9. package/src/assets/hero.png +0 -0
  10. package/src/assets/vite.svg +1 -0
  11. package/src/assets/vue.svg +1 -0
  12. package/src/components/BlastAlignmentDetails.vue +581 -0
  13. package/src/components/BlastGraphicViewer.vue +477 -0
  14. package/src/components/BlastHeader.vue +259 -0
  15. package/src/components/BlastHitTable.vue +669 -0
  16. package/src/components/BlastViewer.vue +232 -0
  17. package/src/main.ts +5 -0
  18. package/src/mockData.ts +457 -0
  19. package/src/style.css +258 -0
  20. package/src/types.ts +59 -0
  21. package/tsconfig.app.json +14 -0
  22. package/tsconfig.json +28 -0
  23. package/vite.config.ts +24 -0
  24. package/vue-blast-viewer-1.0.0.tgz +0 -0
  25. package/dist/src/App.vue.d.ts +0 -3
  26. package/dist/src/components/BlastAlignmentDetails.vue.d.ts +0 -10
  27. package/dist/src/components/BlastGraphicViewer.vue.d.ts +0 -12
  28. package/dist/src/components/BlastHeader.vue.d.ts +0 -11
  29. package/dist/src/components/BlastHitTable.vue.d.ts +0 -13
  30. package/dist/src/components/BlastViewer.vue.d.ts +0 -10
  31. package/dist/src/main.d.ts +0 -0
  32. package/dist/src/mockData.d.ts +0 -3
  33. package/dist/src/types.d.ts +0 -53
  34. package/dist/vue-blast-viewer.css +0 -2
  35. package/dist/vue-blast-viewer.js +0 -670
  36. package/dist/vue-blast-viewer.umd.cjs +0 -2
  37. /package/{dist → public}/favicon.svg +0 -0
  38. /package/{dist → public}/icons.svg +0 -0
  39. /package/{dist/src/index.d.ts → src/index.ts} +0 -0
@@ -0,0 +1,232 @@
1
+ <script setup lang="ts">
2
+ import { ref, computed } from 'vue';
3
+ import type { BlastRoot } from '../types';
4
+ import BlastHeader from './BlastHeader.vue';
5
+ import BlastGraphicViewer from './BlastGraphicViewer.vue';
6
+ import BlastHitTable from './BlastHitTable.vue';
7
+ import BlastAlignmentDetails from './BlastAlignmentDetails.vue';
8
+
9
+ const props = defineProps<{
10
+ blastData: BlastRoot | null;
11
+ queryLink?: string;
12
+ subjectLink?: string;
13
+ theme?: 'light' | 'dark';
14
+ }>();
15
+
16
+ // Active tab state
17
+ const activeTab = ref<'table' | 'alignments'>('table');
18
+
19
+ // Selected hit number for scrolling and focus in alignments tab
20
+ const selectedHitNum = ref<number | null>(null);
21
+
22
+ // Validate and parse the incoming BLAST data
23
+ const report = computed(() => {
24
+ if (!props.blastData?.BlastOutput2?.[0]?.report) return null;
25
+ return props.blastData.BlastOutput2[0].report;
26
+ });
27
+
28
+ const searchData = computed(() => {
29
+ return report.value?.results?.search || null;
30
+ });
31
+
32
+ const program = computed(() => report.value?.program || '');
33
+ const version = computed(() => report.value?.version || '');
34
+ const db = computed(() => report.value?.search_target?.db || '');
35
+
36
+ const isProtein = computed(() => {
37
+ const prog = program.value.toLowerCase();
38
+ return prog.includes('p') || prog.includes('x') || prog.includes('tblast');
39
+ });
40
+
41
+ // Event handler: user selected a hit (from SVG map or hit table)
42
+ const handleHitSelect = (hitNum: number) => {
43
+ selectedHitNum.value = hitNum;
44
+ activeTab.value = 'alignments';
45
+ };
46
+ </script>
47
+
48
+ <template>
49
+ <div class="blast-viewer" :data-theme="theme">
50
+ <!-- Invalid Data State -->
51
+ <div v-if="!report || !searchData" class="error-panel glass-panel fade-in">
52
+ <div class="error-icon">⚠️</div>
53
+ <h3>Invalid BLAST JSON Format</h3>
54
+ <p>
55
+ The provided data structure does not match standard BLAST JSON format (BlastOutput2 structure).
56
+ Please upload or paste a valid BLAST output file in JSON format.
57
+ </p>
58
+ </div>
59
+
60
+ <!-- Valid Data Dashboard -->
61
+ <template v-else>
62
+ <!-- Summary Metadata Header -->
63
+ <BlastHeader
64
+ :search-data="searchData"
65
+ :program="program"
66
+ :version="version"
67
+ :db="db"
68
+ :query-link="queryLink"
69
+ />
70
+
71
+ <!-- SVG Graphic Map Alignment (Always visible, serves as visual nav) -->
72
+ <BlastGraphicViewer
73
+ :search-data="searchData"
74
+ :is-protein="isProtein"
75
+ @select-hit="handleHitSelect"
76
+ />
77
+
78
+ <!-- Tab View Section -->
79
+ <div class="tabs-container glass-panel fade-in">
80
+ <div class="tabs-header">
81
+ <button
82
+ class="tab-btn"
83
+ :class="{ 'active': activeTab === 'table' }"
84
+ @click="activeTab = 'table'"
85
+ >
86
+ 📋 Descriptions Table
87
+ </button>
88
+ <button
89
+ class="tab-btn"
90
+ :class="{ 'active': activeTab === 'alignments' }"
91
+ @click="activeTab = 'alignments'"
92
+ >
93
+ 🔍 Pairwise Alignments
94
+ </button>
95
+ </div>
96
+
97
+ <div class="tabs-content">
98
+ <!-- Tab 1: Table -->
99
+ <div v-show="activeTab === 'table'" class="tab-panel">
100
+ <BlastHitTable
101
+ :search-data="searchData"
102
+ :is-protein="isProtein"
103
+ :subject-link="subjectLink"
104
+ @select-hit="handleHitSelect"
105
+ />
106
+ </div>
107
+
108
+ <!-- Tab 2: Alignment Details -->
109
+ <div v-show="activeTab === 'alignments'" class="tab-panel">
110
+ <BlastAlignmentDetails
111
+ :search-data="searchData"
112
+ :is-protein="isProtein"
113
+ :selected-hit-num="selectedHitNum"
114
+ :subject-link="subjectLink"
115
+ />
116
+ </div>
117
+ </div>
118
+ </div>
119
+ </template>
120
+ </div>
121
+ </template>
122
+
123
+ <style scoped>
124
+ .blast-viewer {
125
+ display: flex;
126
+ flex-direction: column;
127
+ gap: 1.5rem;
128
+ width: 100%;
129
+ }
130
+
131
+ .error-panel {
132
+ display: flex;
133
+ flex-direction: column;
134
+ align-items: center;
135
+ text-align: center;
136
+ padding: 3rem 2rem;
137
+ gap: 1rem;
138
+ max-width: 600px;
139
+ margin: 2rem auto;
140
+ border-color: var(--color-danger);
141
+ }
142
+
143
+ .error-icon {
144
+ font-size: 3rem;
145
+ }
146
+
147
+ .error-panel h3 {
148
+ font-size: 1.25rem;
149
+ font-weight: 700;
150
+ color: var(--color-danger);
151
+ }
152
+
153
+ .error-panel p {
154
+ color: var(--text-secondary);
155
+ font-size: 0.9rem;
156
+ }
157
+
158
+ .tabs-container {
159
+ overflow: hidden;
160
+ border-radius: var(--radius-md);
161
+ margin-bottom: 2rem;
162
+ }
163
+
164
+ .tabs-header {
165
+ display: flex;
166
+ background: var(--bg-depth);
167
+ border-bottom: 1px solid var(--border-color);
168
+ }
169
+
170
+ .tab-btn {
171
+ background: transparent;
172
+ border: none;
173
+ color: var(--text-secondary);
174
+ padding: 1.25rem 2rem;
175
+ font-family: var(--font-sans);
176
+ font-weight: 600;
177
+ font-size: 0.9rem;
178
+ cursor: pointer;
179
+ transition: all var(--transition-fast);
180
+ border-bottom: 2px solid transparent;
181
+ display: flex;
182
+ align-items: center;
183
+ gap: 0.5rem;
184
+ }
185
+
186
+ .tab-btn:hover {
187
+ color: var(--text-primary);
188
+ background: var(--bg-overlay-1);
189
+ }
190
+
191
+ .tab-btn.active {
192
+ color: var(--color-primary);
193
+ border-bottom-color: var(--color-primary);
194
+ background: var(--bg-overlay-1);
195
+ }
196
+
197
+ .tabs-content {
198
+ padding: 0;
199
+ }
200
+
201
+ .tab-panel {
202
+ animation: fadeIn var(--transition-normal);
203
+ }
204
+
205
+ /* Remove default card styles from nested components to avoid double borders */
206
+ :deep(.blast-hit-table),
207
+ :deep(.blast-alignments) {
208
+ border: none !important;
209
+ background: transparent !important;
210
+ box-shadow: none !important;
211
+ backdrop-filter: none !important;
212
+ -webkit-backdrop-filter: none !important;
213
+ }
214
+
215
+ @media (max-width: 600px) {
216
+ .tabs-header {
217
+ flex-direction: column;
218
+ }
219
+
220
+ .tab-btn {
221
+ width: 100%;
222
+ text-align: left;
223
+ padding: 1rem;
224
+ border-bottom: none;
225
+ border-left: 2px solid transparent;
226
+ }
227
+
228
+ .tab-btn.active {
229
+ border-left-color: var(--color-primary);
230
+ }
231
+ }
232
+ </style>
package/src/main.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { createApp } from 'vue'
2
+ import './style.css'
3
+ import App from './App.vue'
4
+
5
+ createApp(App).mount('#app')