@basic-genomics/hivtrace-viz 1.4.0 → 1.5.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/README.md +45 -32
- package/dist/embed/hivtrace.js +1 -1
- package/dist/embed/hivtrace.js.map +1 -1
- package/dist/embed/index.html +214 -34
- package/dist/hivtrace.js +1 -1
- package/dist/hivtrace.js.map +1 -1
- package/dist/react/HivtraceViz.d.ts +1 -1
- package/dist/react/HivtraceViz.d.ts.map +1 -1
- package/dist/react/HivtraceViz.js +4 -2
- package/dist/react/types.d.ts +12 -0
- package/dist/react/types.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -23,22 +23,25 @@ yarn add @basic-genomics/hivtrace-viz
|
|
|
23
23
|
### React 组件
|
|
24
24
|
|
|
25
25
|
```tsx
|
|
26
|
-
import { HivtraceViz } from
|
|
27
|
-
import type {
|
|
26
|
+
import { HivtraceViz } from "@basic-genomics/hivtrace-viz/react";
|
|
27
|
+
import type {
|
|
28
|
+
CustomContextMenuItem,
|
|
29
|
+
ClusterInfo,
|
|
30
|
+
} from "@basic-genomics/hivtrace-viz/react";
|
|
28
31
|
|
|
29
32
|
function App() {
|
|
30
33
|
// 自定义上下文菜单项
|
|
31
34
|
const customMenuItems: CustomContextMenuItem[] = [
|
|
32
35
|
{
|
|
33
|
-
id:
|
|
34
|
-
label:
|
|
35
|
-
icon:
|
|
36
|
+
id: "track-cluster",
|
|
37
|
+
label: "追踪此簇",
|
|
38
|
+
icon: "fa-crosshairs",
|
|
36
39
|
},
|
|
37
40
|
];
|
|
38
41
|
|
|
39
42
|
const handleMenuClick = (itemId: string, clusterInfo: ClusterInfo) => {
|
|
40
|
-
if (itemId ===
|
|
41
|
-
console.log(
|
|
43
|
+
if (itemId === "track-cluster") {
|
|
44
|
+
console.log("追踪簇:", clusterInfo);
|
|
42
45
|
}
|
|
43
46
|
};
|
|
44
47
|
|
|
@@ -47,11 +50,11 @@ function App() {
|
|
|
47
50
|
data={analysisData}
|
|
48
51
|
options={{
|
|
49
52
|
threshold: 0.015,
|
|
50
|
-
expand: [
|
|
53
|
+
expand: ["cluster_1"],
|
|
51
54
|
}}
|
|
52
55
|
customContextMenuItems={customMenuItems}
|
|
53
56
|
onCustomMenuItemClick={handleMenuClick}
|
|
54
|
-
onReady={() => console.log(
|
|
57
|
+
onReady={() => console.log("可视化已就绪")}
|
|
55
58
|
error={fetchError?.message}
|
|
56
59
|
/>
|
|
57
60
|
);
|
|
@@ -62,23 +65,24 @@ function App() {
|
|
|
62
65
|
|
|
63
66
|
```ts
|
|
64
67
|
// vite.config.ts
|
|
65
|
-
import { hivtraceVizPlugin } from
|
|
68
|
+
import { hivtraceVizPlugin } from "@basic-genomics/hivtrace-viz/vite";
|
|
66
69
|
|
|
67
70
|
export default defineConfig({
|
|
68
71
|
plugins: [
|
|
69
72
|
hivtraceVizPlugin({
|
|
70
|
-
base:
|
|
71
|
-
})
|
|
72
|
-
]
|
|
73
|
+
base: "/hivtrace-viz", // 可选,默认 '/hivtrace-viz'
|
|
74
|
+
}),
|
|
75
|
+
],
|
|
73
76
|
});
|
|
74
77
|
```
|
|
75
78
|
|
|
76
79
|
### iframe 嵌入
|
|
77
80
|
|
|
78
81
|
```html
|
|
79
|
-
<iframe
|
|
80
|
-
src="/hivtrace-viz/index.html"
|
|
81
|
-
style="width: 100%; height: 600px; border: none;"
|
|
82
|
+
<iframe
|
|
83
|
+
src="/hivtrace-viz/index.html"
|
|
84
|
+
style="width: 100%; height: 600px; border: none;"
|
|
85
|
+
>
|
|
82
86
|
</iframe>
|
|
83
87
|
```
|
|
84
88
|
|
|
@@ -100,6 +104,7 @@ yarn dev
|
|
|
100
104
|
```
|
|
101
105
|
|
|
102
106
|
开发服务器启动后:
|
|
107
|
+
|
|
103
108
|
- 自动打开 `http://localhost:8080/preview.html`
|
|
104
109
|
- 支持核心库热更新
|
|
105
110
|
- 支持 embed 模板热更新
|
|
@@ -132,11 +137,13 @@ npm link @basic-genomics/hivtrace-viz
|
|
|
132
137
|
**开发流程:**
|
|
133
138
|
|
|
134
139
|
1. 修改 hivtrace-viz 代码后,运行相应的构建命令:
|
|
140
|
+
|
|
135
141
|
- 修改 `src/react/*.tsx` → `npm run build:react`
|
|
136
142
|
- 修改 `template/embed.html` → `npm run build:embed`
|
|
137
143
|
- 修改 `src/*.js` → `npm run build:core`
|
|
138
144
|
|
|
139
145
|
2. 清除宿主应用的 Vite 缓存并重启:
|
|
146
|
+
|
|
140
147
|
```bash
|
|
141
148
|
rm -rf node_modules/.vite
|
|
142
149
|
yarn dev
|
|
@@ -145,11 +152,13 @@ npm link @basic-genomics/hivtrace-viz
|
|
|
145
152
|
3. 刷新浏览器
|
|
146
153
|
|
|
147
154
|
**重要提示:**
|
|
155
|
+
|
|
148
156
|
- npm link 创建的是 symlink,但 Vite 会缓存模块
|
|
149
157
|
- 每次修改 hivtrace-viz 代码后需要**重新构建**对应部分
|
|
150
158
|
- 需要**删除 Vite 缓存**或**重启 dev server**才能看到更新
|
|
151
159
|
|
|
152
160
|
**验证 npm link 状态:**
|
|
161
|
+
|
|
153
162
|
```bash
|
|
154
163
|
ls -la node_modules/@basic-genomics/hivtrace-viz
|
|
155
164
|
# 应显示:xxx -> ../../../hivtrace-viz
|
|
@@ -202,12 +211,12 @@ release-please 自动创建 Release PR
|
|
|
202
211
|
|
|
203
212
|
### Commit 规范
|
|
204
213
|
|
|
205
|
-
| 格式
|
|
206
|
-
|
|
207
|
-
| `feat: xxx`
|
|
208
|
-
| `fix: xxx`
|
|
209
|
-
| `feat!: xxx`
|
|
210
|
-
| `chore/docs/style` | 不触发发布
|
|
214
|
+
| 格式 | 版本变更 | 示例 |
|
|
215
|
+
| ------------------ | --------------------- | ------------------------- |
|
|
216
|
+
| `feat: xxx` | Minor (1.2.0 → 1.3.0) | `feat: 添加簇追踪功能` |
|
|
217
|
+
| `fix: xxx` | Patch (1.2.0 → 1.2.1) | `fix: 修复上下文菜单定位` |
|
|
218
|
+
| `feat!: xxx` | Major (1.2.0 → 2.0.0) | `feat!: 重构 API 接口` |
|
|
219
|
+
| `chore/docs/style` | 不触发发布 | `docs: 更新 README` |
|
|
211
220
|
|
|
212
221
|
### 手动测试发布
|
|
213
222
|
|
|
@@ -239,16 +248,20 @@ hivtrace-viz/
|
|
|
239
248
|
|
|
240
249
|
## Props API
|
|
241
250
|
|
|
242
|
-
| 属性
|
|
243
|
-
|
|
244
|
-
| `data`
|
|
245
|
-
| `options`
|
|
246
|
-
| `error`
|
|
247
|
-
| `loadingState`
|
|
248
|
-
| `customContextMenuItems` | `CustomContextMenuItem[]`
|
|
249
|
-
| `onCustomMenuItemClick`
|
|
250
|
-
| `onReady`
|
|
251
|
-
| `onRetry`
|
|
251
|
+
| 属性 | 类型 | 说明 |
|
|
252
|
+
| ------------------------ | ------------------------------- | --------------------------------------- |
|
|
253
|
+
| `data` | `HivtraceVizData` | 分析数据 |
|
|
254
|
+
| `options` | `HivtraceVizOptions` | 配置选项 |
|
|
255
|
+
| `error` | `string` | 错误信息(API 错误时传入) |
|
|
256
|
+
| `loadingState` | `ReactNode \| null` | 自定义加载态,`null` 禁用 |
|
|
257
|
+
| `customContextMenuItems` | `CustomContextMenuItem[]` | 自定义上下文菜单项 |
|
|
258
|
+
| `onCustomMenuItemClick` | `(itemId, clusterInfo) => void` | 自定义菜单项点击回调 |
|
|
259
|
+
| `onReady` | `() => void` | 渲染完成回调 |
|
|
260
|
+
| `onRetry` | `() => void` | 重试回调 |
|
|
261
|
+
| `treeData` | `TreeData` | 进化树数据,传入时显示进化树 Tab |
|
|
262
|
+
| `treeDefaultClusterId` | `string \| number` | 进化树默认高亮的簇 ID |
|
|
263
|
+
| `showTreeTab` | `boolean` | 是否显示进化树 Tab(即使没有 treeData) |
|
|
264
|
+
| `treeLoading` | `boolean` | 进化树正在加载中,显示加载状态 |
|
|
252
265
|
|
|
253
266
|
## 国际化
|
|
254
267
|
|