@zenk-agent/plugin-preview 0.0.24 → 0.0.26

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/app/src/App.tsx CHANGED
@@ -1,98 +1,59 @@
1
- import { useState } from 'react'
2
1
  import { HostedPluginCard, RemotePluginCardHost, renderDefaultPluginModal } from '@zenk-agent/plugin-host'
3
2
  import { decision, demoTheme, fetchFn, navigate, ontology } from './preview-host'
4
3
  import { previewPluginDir, previewPlugins } from 'virtual:tool-plugin-preview'
5
4
 
6
- function App() {
7
- const [collapsed, setCollapsed] = useState(false)
5
+ const previewBackgroundUrl = new URL('./assets/preview-background.png', import.meta.url).href
8
6
 
7
+ function App() {
9
8
  return (
10
- <main className="relative min-h-screen bg-[radial-gradient(circle_at_top,rgba(251,191,36,0.18),transparent_28%),linear-gradient(180deg,#111827_0%,#020617_100%)] text-slate-50">
11
- {/* Left content area */}
12
- <div className={`mx-auto flex w-full max-w-5xl flex-col gap-8 px-6 py-10 transition-[padding-right] duration-200 lg:px-10 ${collapsed ? 'pr-[72px]' : 'pr-[416px]'}`}>
13
- <header className="max-w-3xl">
14
- <p className="text-sm font-medium uppercase tracking-[0.24em] text-amber-300/80">Plugin Preview Service</p>
15
- <h1 className="mt-3 text-4xl font-semibold tracking-tight text-white sm:text-5xl">Tool plugin preview</h1>
16
- <p className="mt-4 text-base leading-7 text-slate-300">
17
- 这个页面由 `@zenk-agent/plugin-preview` 启动,只预览当前插件目录。
18
- </p>
19
- <p className="mt-3 rounded-2xl border border-white/10 bg-white/[0.04] px-4 py-3 text-sm text-slate-300">
20
- <span className="font-semibold text-white">Plugin dir</span>: {previewPluginDir}
21
- </p>
22
- </header>
23
-
9
+ <main className="relative min-h-screen overflow-hidden bg-[#020617] text-slate-50">
10
+ {/* Preview background */}
11
+ <section className="absolute inset-y-0 left-0 right-[400px] hidden lg:block" aria-label="背景图">
12
+ <div
13
+ className="h-full w-full bg-cover bg-center bg-no-repeat"
14
+ style={{
15
+ backgroundImage: `linear-gradient(90deg, rgba(2, 6, 23, 0.12), rgba(2, 6, 23, 0.04)), url(${previewBackgroundUrl})`,
16
+ }}
17
+ />
24
18
  {previewPlugins.length === 0 ? (
25
- <section className="rounded-[28px] border border-amber-300/20 bg-white/[0.04] px-6 py-6 shadow-[0_24px_60px_rgba(2,8,23,0.32)]">
19
+ <div className="absolute left-8 top-8 max-w-xl rounded-2xl border border-amber-300/20 bg-slate-950/75 px-6 py-6 shadow-[0_24px_60px_rgba(2,8,23,0.32)] backdrop-blur">
26
20
  <p className="text-lg font-semibold text-white">没有匹配到可预览的插件</p>
27
21
  <p className="mt-2 text-sm leading-6 text-slate-300">
28
22
  当前目录需要包含 `package.json`,并在 `zenk.publicPlugin` 或 `zenk.publicPlugins` 中声明 config 和 worker 导出。
29
23
  </p>
30
- </section>
24
+ <p className="mt-3 rounded-xl border border-white/10 bg-white/[0.04] px-4 py-3 text-sm text-slate-300">
25
+ <span className="font-semibold text-white">Plugin dir</span>: {previewPluginDir}
26
+ </p>
27
+ </div>
31
28
  ) : null}
32
- </div>
29
+ </section>
33
30
 
34
31
  {/* Right toolbar */}
35
- <aside
36
- className={`absolute right-0 top-0 z-20 h-full border-l border-white/10 bg-white/[0.05] backdrop-blur-sm transition-[width] duration-200 ${collapsed ? 'w-14 overflow-hidden' : 'w-[400px]'}`}
37
- >
38
- {/* Toolbar header */}
39
- <div
40
- className={`flex h-[54px] items-center border-b border-white/10 bg-white/[0.02] ${collapsed ? 'justify-center px-2' : 'justify-between gap-2 px-6'}`}
41
- >
42
- <div className="flex items-center gap-2">
43
- <svg className="h-4 w-4 text-amber-400" viewBox="0 0 16 16" fill="none" aria-hidden="true">
44
- <path
45
- d="M3 2.667h10v4.666H3V2.667Zm2 2H4.333V5.33H5V4.667Zm0 3.333h6.667v5.333H5V8Zm-2 0h1v5.333H3V8Zm10 0h-1v5.333h1V8Z"
46
- fill="currentColor"
32
+ <aside className="absolute inset-0 z-20 h-full w-full bg-white/[0.05] backdrop-blur-sm lg:inset-y-0 lg:left-auto lg:right-0 lg:w-[400px] lg:border-l lg:border-white/10">
33
+ {/* Toolbar content */}
34
+ <div className="h-full overflow-y-auto px-4 pb-6 pt-2 scrollbar-thin">
35
+ <div className="space-y-4">
36
+ {previewPlugins.map((plugin) => (
37
+ <HostedPluginCard
38
+ key={plugin.id}
39
+ plugin={plugin}
40
+ renderPluginContent={() => (
41
+ <RemotePluginCardHost
42
+ plugin={plugin}
43
+ navigate={navigate}
44
+ fetchFn={fetchFn}
45
+ getTheme={() => demoTheme}
46
+ storage={window.localStorage}
47
+ decision={decision}
48
+ ontology={ontology}
49
+ renderModal={renderDefaultPluginModal}
50
+ styleIsolation="shadow"
51
+ />
52
+ )}
47
53
  />
48
- </svg>
49
- {!collapsed ? <span className="text-[16px] font-medium text-white">插件预览</span> : null}
54
+ ))}
50
55
  </div>
51
- <button
52
- type="button"
53
- onClick={() => setCollapsed((prev) => !prev)}
54
- className="inline-flex h-7 w-7 items-center justify-center rounded-md text-[#d7dbe4] transition hover:bg-white/10 hover:text-white"
55
- aria-label={collapsed ? '展开工具栏' : '收起工具栏'}
56
- title={collapsed ? '展开工具栏' : '收起工具栏'}
57
- >
58
- <svg className="h-4 w-4" viewBox="0 0 16 16" fill="none" aria-hidden="true">
59
- <path
60
- d={collapsed ? 'M6 3.5L10 8L6 12.5' : 'M10 3.5L6 8L10 12.5'}
61
- stroke="currentColor"
62
- strokeWidth="1.4"
63
- strokeLinecap="round"
64
- strokeLinejoin="round"
65
- />
66
- </svg>
67
- </button>
68
56
  </div>
69
-
70
- {/* Toolbar content */}
71
- {!collapsed ? (
72
- <div className="h-[calc(100%-54px)] overflow-y-auto px-4 py-4 pb-6 scrollbar-thin">
73
- <div className="space-y-4">
74
- {previewPlugins.map((plugin) => (
75
- <HostedPluginCard
76
- key={plugin.id}
77
- plugin={plugin}
78
- renderPluginContent={() => (
79
- <RemotePluginCardHost
80
- plugin={plugin}
81
- navigate={navigate}
82
- fetchFn={fetchFn}
83
- getTheme={() => demoTheme}
84
- storage={window.localStorage}
85
- decision={decision}
86
- ontology={ontology}
87
- renderModal={renderDefaultPluginModal}
88
- styleIsolation="shadow"
89
- />
90
- )}
91
- />
92
- ))}
93
- </div>
94
- </div>
95
- ) : null}
96
57
  </aside>
97
58
  </main>
98
59
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenk-agent/plugin-preview",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/cli.mjs",
@@ -29,9 +29,9 @@
29
29
  "react-dom": "19.2.5",
30
30
  "tailwindcss": "^3.4.17",
31
31
  "vite": "^7.2.0",
32
- "@zenk-agent/plugin-host": "0.0.24",
33
- "@zenk-agent/plugin-sdk": "0.0.24",
34
- "@zenk-agent/plugin-types": "0.0.24"
32
+ "@zenk-agent/plugin-host": "0.0.26",
33
+ "@zenk-agent/plugin-sdk": "0.0.26",
34
+ "@zenk-agent/plugin-types": "0.0.26"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^24.10.1",