local-knowledge-graph 1.6.0 → 1.6.1

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/HELP.md CHANGED
@@ -105,6 +105,7 @@ kg
105
105
 
106
106
  ## 版本历史摘要
107
107
 
108
+ - **v1.6.1**:修复浅色主题切换导致画布空白的问题;标题栏按钮防挤压(窄屏可横滑);修复3D样式主题刷新后不恢复的问题;新增脚本异常提示
108
109
  - **v1.6.0**:界面主题新增浅色配色(视图设置一键切换,本地记忆);GitHub 仓库与 npm 包通过 Actions 自动同步(打 tag 即测试+发布+Release)
109
110
 
110
111
  - **v1.5.0**:npm 包化(`npm i -g local-knowledge-graph` + `kg` 一键安装启动);数据目录迁至用户目录(升级无损);应用内更新支持 npm 与 git 双模式
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "local-knowledge-graph",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "本地知识图谱整合器:3D可视化 + AI对话建图 + 智能检索 + Git回溯 + RDF合规,全流程本地运行",
5
5
  "main": "server.js",
6
6
  "bin": {
package/public/app.js CHANGED
@@ -121,20 +121,25 @@ let UI_THEME = 'dark';
121
121
  try { if (localStorage.getItem(UI_THEME_KEY) === 'light') UI_THEME = 'light'; } catch (_) {}
122
122
  document.documentElement.dataset.theme = UI_THEME;
123
123
 
124
- function applyTheme(mode) {
124
+ function applyUiTheme(mode) {
125
125
  UI_THEME = UI_THEMES[mode] ? mode : 'dark';
126
126
  document.documentElement.dataset.theme = UI_THEME;
127
127
  try { localStorage.setItem(UI_THEME_KEY, UI_THEME); } catch (_) {}
128
128
  if (typeof scene !== 'undefined' && typeof grid !== 'undefined' && grid) {
129
129
  const t = UI_THEMES[UI_THEME];
130
130
  scene.remove(grid);
131
- grid.dispose();
131
+ if (typeof grid.dispose === 'function') grid.dispose(); // three r128 GridHelper 无 dispose
132
132
  grid = new THREE.GridHelper(480, 48, t.grid1, t.grid2);
133
133
  grid.position.y = -60;
134
134
  scene.add(grid);
135
135
  }
136
136
  }
137
137
 
138
+ /* 启动期兜底:任何未捕获异常立刻弹出提示,避免画布空白却无感知 */
139
+ window.addEventListener('error', (e) => {
140
+ try { toast('脚本异常: ' + (e.message || '未知错误'), 6000); } catch (_) {}
141
+ });
142
+
138
143
  /* ================= Three.js 场景 ================= */
139
144
  const wrap = $('canvas-wrap');
140
145
  const scene = new THREE.Scene();
@@ -156,7 +161,10 @@ scene.add(dirLight);
156
161
  let grid = new THREE.GridHelper(480, 48, 0x1c2a47, 0x141e35);
157
162
  grid.position.y = -60;
158
163
  scene.add(grid);
159
- applyTheme(UI_THEME); // 按存储的主题重建网格(CSS背景经 data-theme 生效)
164
+ applyUiTheme(UI_THEME); // 按存储的主题重建网格(CSS背景经 data-theme 生效)
165
+
166
+ const savedTheme = loadTheme();
167
+ if (savedTheme && applyTheme(savedTheme)) { /* 启动时恢复用户保存的3D样式主题 */ }
160
168
 
161
169
  let nodeGroup = new THREE.Group();
162
170
  let linkGroup = new THREE.Group();
@@ -1334,9 +1342,11 @@ function renderStylePanel() {
1334
1342
  $('style-close').addEventListener('click', () => $('style-panel').classList.remove('show'));
1335
1343
  const themeSel = $('ui-theme-select');
1336
1344
  themeSel.value = UI_THEME;
1337
- themeSel.addEventListener('change', () => { applyTheme(themeSel.value); toast(themeSel.value === 'light' ? '已切换浅色主题' : '已切换深色主题'); });
1345
+ themeSel.addEventListener('change', () => { applyUiTheme(themeSel.value); toast(themeSel.value === 'light' ? '已切换浅色主题' : '已切换深色主题'); });
1338
1346
  $('style-save').addEventListener('click', () => {
1339
- localStorage.setItem(THEME_KEY, JSON.stringify(currentThemeJson()));
1347
+ const t = currentThemeJson();
1348
+ localStorage.setItem(THEME_KEY, JSON.stringify(t));
1349
+ applyTheme(t);
1340
1350
  toast('主题已保存到本地');
1341
1351
  });
1342
1352
  $('style-reset').addEventListener('click', () => {
package/public/style.css CHANGED
@@ -12,9 +12,10 @@
12
12
  height: 50px; display: flex; align-items: center; gap: 10px; padding: 0 14px;
13
13
  background: #101728; border-bottom: 1px solid #1e2a44; flex-shrink: 0;
14
14
  }
15
- header h1 { font-size: 15px; font-weight: 600; color: #7fd1ff; letter-spacing: 1px; }
15
+ header h1 { font-size: 15px; font-weight: 600; color: #7fd1ff; letter-spacing: 1px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
16
16
  header .spacer { flex: 1; }
17
17
  header .badge { font-size: 11px; color: #8fa3c0; border: 1px solid #2a3a5c; border-radius: 10px; padding: 2px 9px; }
18
+ header button, header .badge { flex-shrink: 0; }
18
19
  header .badge.ok { color: #7ee787; border-color: #2ea04366; }
19
20
  header .badge.off { color: #f0883e; border-color: #f0883e66; }
20
21
 
@@ -277,13 +278,15 @@
277
278
  /* 主题设置移动端可达:按钮保留,面板收窄为屏幕内浮层 */
278
279
  #style-panel { max-width: calc(100vw - 16px); width: 288px; top: 8px; right: 8px; }
279
280
 
280
- /* 隐藏大标题,所有功能按钮单行排布,最大化画布显示范围 */
281
+ /* 隐藏大标题,所有功能按钮单行排布,最大化画布显示范围;
282
+ 按钮过多时允许横向滑动兜底(360px以下窄屏),滚动条隐藏 */
281
283
  header {
282
- flex-wrap: nowrap; height: 44px; padding: 0 6px; gap: 4px;
283
- overflow: hidden;
284
+ flex-wrap: nowrap; height: 44px; padding: 0 6px; gap: 3px;
285
+ overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
284
286
  }
287
+ header::-webkit-scrollbar { display: none; }
285
288
  header h1 { display: none; }
286
- header button { padding: 5px 7px; font-size: 11px; flex-shrink: 0; min-width: 0; }
289
+ header button { padding: 5px 6px; font-size: 11px; flex-shrink: 0; min-width: 0; }
287
290
  #btn-export { display: none; } /* 导出RDF移入文件菜单 */
288
291
  #stat-badge, #agent-badge { display: none; }
289
292