@nextclaw/ui 0.4.0 → 0.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/dist/index.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <link rel="icon" type="image/svg+xml" href="/logo.svg" />
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
8
  <title>NextClaw - 系统配置</title>
9
- <script type="module" crossorigin src="/assets/index-D16PLMLv.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-1h_LfFkZ.js"></script>
10
10
  <link rel="stylesheet" crossorigin href="/assets/index-Wn63frSd.css">
11
11
  </head>
12
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/ui",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -246,6 +246,7 @@ export function DocBrowser() {
246
246
  {/* Iframe Content */}
247
247
  <div className="flex-1 relative overflow-hidden">
248
248
  <iframe
249
+ key={currentUrl}
249
250
  src={currentUrl}
250
251
  className="absolute inset-0 w-full h-full border-0"
251
252
  title="NextClaw Documentation"
@@ -86,12 +86,20 @@ export function DocBrowserProvider({ children }: { children: ReactNode }) {
86
86
  }, []);
87
87
 
88
88
  const navigate = useCallback((url: string) => {
89
- setState(prev => ({
90
- ...prev,
91
- currentUrl: url,
92
- history: [...prev.history.slice(0, prev.historyIndex + 1), url],
93
- historyIndex: prev.historyIndex + 1,
94
- }));
89
+ setState(prev => {
90
+ // Normalize URLs for comparison (strip trailing slash, .html suffix)
91
+ const normalize = (u: string) => {
92
+ try { return new URL(u).pathname.replace(/\.html$/, '').replace(/\/$/, ''); } catch { return u; }
93
+ };
94
+ // Skip if same as current URL (prevents loop from postMessage echo)
95
+ if (normalize(url) === normalize(prev.currentUrl)) return prev;
96
+ return {
97
+ ...prev,
98
+ currentUrl: url,
99
+ history: [...prev.history.slice(0, prev.historyIndex + 1), url],
100
+ historyIndex: prev.historyIndex + 1,
101
+ };
102
+ });
95
103
  }, []);
96
104
 
97
105
  const goBack = useCallback(() => {
@@ -18,6 +18,9 @@ export function useDocLinkInterceptor() {
18
18
  const href = anchor.getAttribute('href') || '';
19
19
  if (!isDocsUrl(href)) return;
20
20
 
21
+ // Don't intercept links explicitly marked for external opening
22
+ if (anchor.hasAttribute('data-doc-external')) return;
23
+
21
24
  // Don't intercept if modifier keys are held (user wants new tab behavior)
22
25
  if (e.ctrlKey || e.metaKey || e.shiftKey) return;
23
26
 
package/src/lib/i18n.ts CHANGED
@@ -164,6 +164,7 @@ export const LABELS: Record<string, { zh: string; en: string }> = {
164
164
  // Doc Browser
165
165
  docBrowserTitle: { zh: '帮助文档', en: 'Help Docs' },
166
166
  docBrowserSearchPlaceholder: { zh: '搜索,也可以输入文档地址直接打开', en: 'Search, or enter a doc URL to open' },
167
+ docBrowserUrlPlaceholder: { zh: '输入文档路径,如 /guide/channels', en: 'Enter a doc path, e.g. /guide/channels' },
167
168
  docBrowserOpenExternal: { zh: '文档中心打开', en: 'Open in Docs' },
168
169
  docBrowserFloatMode: { zh: '悬浮窗口', en: 'Float Window' },
169
170
  docBrowserDockMode: { zh: '固定到侧栏', en: 'Dock to Sidebar' },