@binblink/wasmnest-plugin-sdk-desktop 0.0.1 → 0.0.2
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 +24 -4
- package/README_en.md +1 -1
- package/bin/cli.js +5 -5
- package/bin/manifest-gen.js +4 -0
- package/bin/manifest-validate.js +68 -6
- package/bin/permission-vocabulary.json +2 -2
- package/dev-shell/README.md +6 -5
- package/dev-shell/src/loader.ts +0 -5
- package/dev-shell/src/mock/commands.ts +1 -1
- package/dev-shell/src/mock/domain-context.ts +1 -1
- package/dev-shell/src/shell/types.ts +21 -32
- package/dev-shell/src/styles/shell.css +208 -2
- package/dev-shell/src/styles/style.css +72 -26
- package/dist/index.d.ts +44 -3
- package/dist/index.js +69 -1
- package/dist/types.d.ts +52 -5
- package/go/.gitignore +5 -0
- package/go/README.md +80 -0
- package/go/gen/wasmnest/api-call/host-api-call/empty.s +3 -0
- package/go/gen/wasmnest/api-call/host-api-call/host-api-call.wasm.go +13 -0
- package/go/gen/wasmnest/api-call/host-api-call/host-api-call.wit.go +34 -0
- package/go/gen/wasmnest/app/host-app/empty.s +3 -0
- package/go/gen/wasmnest/app/host-app/host-app.wasm.go +29 -0
- package/go/gen/wasmnest/app/host-app/host-app.wit.go +108 -0
- package/go/gen/wasmnest/auth-center/host-auth-center/abi.go +14 -0
- package/go/gen/wasmnest/auth-center/host-auth-center/empty.s +3 -0
- package/go/gen/wasmnest/auth-center/host-auth-center/host-auth-center.wasm.go +49 -0
- package/go/gen/wasmnest/auth-center/host-auth-center/host-auth-center.wit.go +225 -0
- package/go/gen/wasmnest/clipboard/host-clipboard/abi.go +14 -0
- package/go/gen/wasmnest/clipboard/host-clipboard/empty.s +3 -0
- package/go/gen/wasmnest/clipboard/host-clipboard/host-clipboard.wasm.go +17 -0
- package/go/gen/wasmnest/clipboard/host-clipboard/host-clipboard.wit.go +68 -0
- package/go/gen/wasmnest/connection-registry/host-connection-registry/empty.s +3 -0
- package/go/gen/wasmnest/connection-registry/host-connection-registry/host-connection-registry.wasm.go +13 -0
- package/go/gen/wasmnest/connection-registry/host-connection-registry/host-connection-registry.wit.go +50 -0
- package/go/gen/wasmnest/crypto/host-crypto/abi.go +18 -0
- package/go/gen/wasmnest/crypto/host-crypto/empty.s +3 -0
- package/go/gen/wasmnest/crypto/host-crypto/host-crypto.wasm.go +37 -0
- package/go/gen/wasmnest/crypto/host-crypto/host-crypto.wit.go +139 -0
- package/go/gen/wasmnest/fs-desktop/host-fs-desktop/abi.go +14 -0
- package/go/gen/wasmnest/fs-desktop/host-fs-desktop/empty.s +3 -0
- package/go/gen/wasmnest/fs-desktop/host-fs-desktop/host-fs-desktop.wasm.go +21 -0
- package/go/gen/wasmnest/fs-desktop/host-fs-desktop/host-fs-desktop.wit.go +62 -0
- package/go/gen/wasmnest/http/host-http/abi.go +14 -0
- package/go/gen/wasmnest/http/host-http/empty.s +3 -0
- package/go/gen/wasmnest/http/host-http/host-http.wasm.go +13 -0
- package/go/gen/wasmnest/http/host-http/host-http.wit.go +40 -0
- package/go/gen/wasmnest/http-endpoint/host-http-endpoint/empty.s +3 -0
- package/go/gen/wasmnest/http-endpoint/host-http-endpoint/host-http-endpoint.wasm.go +17 -0
- package/go/gen/wasmnest/http-endpoint/host-http-endpoint/host-http-endpoint.wit.go +69 -0
- package/go/gen/wasmnest/mdns/host-mdns/empty.s +3 -0
- package/go/gen/wasmnest/mdns/host-mdns/host-mdns.wasm.go +29 -0
- package/go/gen/wasmnest/mdns/host-mdns/host-mdns.wit.go +101 -0
- package/go/gen/wasmnest/notify/host-notify/empty.s +3 -0
- package/go/gen/wasmnest/notify/host-notify/host-notify.wasm.go +13 -0
- package/go/gen/wasmnest/notify/host-notify/host-notify.wit.go +64 -0
- package/go/gen/wasmnest/peer/host-peer/abi.go +14 -0
- package/go/gen/wasmnest/peer/host-peer/empty.s +3 -0
- package/go/gen/wasmnest/peer/host-peer/host-peer.wasm.go +85 -0
- package/go/gen/wasmnest/peer/host-peer/host-peer.wit.go +357 -0
- package/go/gen/wasmnest/platform-desktop/host-platform-desktop/empty.s +3 -0
- package/go/gen/wasmnest/platform-desktop/host-platform-desktop/host-platform-desktop.wasm.go +21 -0
- package/go/gen/wasmnest/platform-desktop/host-platform-desktop/host-platform-desktop.wit.go +70 -0
- package/go/gen/wasmnest/plugin/abi-form/abi-form.exports.go +11 -0
- package/go/gen/wasmnest/plugin/abi-form/abi-form.wasm.go +13 -0
- package/go/gen/wasmnest/plugin/abi-form/abi-form.wit.go +7 -0
- package/go/gen/wasmnest/plugin/abi-form/empty.s +3 -0
- package/go/gen/wasmnest/plugin/command/command.exports.go +11 -0
- package/go/gen/wasmnest/plugin/command/command.wasm.go +19 -0
- package/go/gen/wasmnest/plugin/command/command.wit.go +6 -0
- package/go/gen/wasmnest/plugin/command/empty.s +3 -0
- package/go/gen/wasmnest/plugin/events/empty.s +3 -0
- package/go/gen/wasmnest/plugin/events/events.exports.go +52 -0
- package/go/gen/wasmnest/plugin/events/events.wasm.go +74 -0
- package/go/gen/wasmnest/plugin/events/events.wit.go +195 -0
- package/go/gen/wasmnest/plugin/host-bus/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-bus/host-bus.wasm.go +29 -0
- package/go/gen/wasmnest/plugin/host-bus/host-bus.wit.go +94 -0
- package/go/gen/wasmnest/plugin/host-config/abi.go +14 -0
- package/go/gen/wasmnest/plugin/host-config/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-config/host-config.wasm.go +13 -0
- package/go/gen/wasmnest/plugin/host-config/host-config.wit.go +21 -0
- package/go/gen/wasmnest/plugin/host-events/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-events/host-events.wasm.go +9 -0
- package/go/gen/wasmnest/plugin/host-events/host-events.wit.go +27 -0
- package/go/gen/wasmnest/plugin/host-fs/abi.go +14 -0
- package/go/gen/wasmnest/plugin/host-fs/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-fs/host-fs.wasm.go +33 -0
- package/go/gen/wasmnest/plugin/host-fs/host-fs.wit.go +86 -0
- package/go/gen/wasmnest/plugin/host-log/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-log/host-log.wasm.go +25 -0
- package/go/gen/wasmnest/plugin/host-log/host-log.wit.go +65 -0
- package/go/gen/wasmnest/plugin/host-metrics/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-metrics/host-metrics.wasm.go +13 -0
- package/go/gen/wasmnest/plugin/host-metrics/host-metrics.wit.go +34 -0
- package/go/gen/wasmnest/plugin/host-platform/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-platform/host-platform.wasm.go +21 -0
- package/go/gen/wasmnest/plugin/host-platform/host-platform.wit.go +85 -0
- package/go/gen/wasmnest/plugin/host-plugin-database/abi.go +14 -0
- package/go/gen/wasmnest/plugin/host-plugin-database/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-plugin-database/host-plugin-database.wasm.go +29 -0
- package/go/gen/wasmnest/plugin/host-plugin-database/host-plugin-database.wit.go +70 -0
- package/go/gen/wasmnest/plugin/host-storage/abi.go +14 -0
- package/go/gen/wasmnest/plugin/host-storage/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-storage/host-storage.wasm.go +21 -0
- package/go/gen/wasmnest/plugin/host-storage/host-storage.wit.go +44 -0
- package/go/gen/wasmnest/plugin/host-worker/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-worker/host-worker.wasm.go +17 -0
- package/go/gen/wasmnest/plugin/host-worker/host-worker.wit.go +50 -0
- package/go/gen/wasmnest/plugin/lifecycle/empty.s +3 -0
- package/go/gen/wasmnest/plugin/lifecycle/lifecycle.exports.go +32 -0
- package/go/gen/wasmnest/plugin/lifecycle/lifecycle.wasm.go +41 -0
- package/go/gen/wasmnest/plugin/lifecycle/lifecycle.wit.go +9 -0
- package/go/gen/wasmnest/plugin/manifest/empty.s +3 -0
- package/go/gen/wasmnest/plugin/manifest/manifest.exports.go +11 -0
- package/go/gen/wasmnest/plugin/manifest/manifest.wasm.go +13 -0
- package/go/gen/wasmnest/plugin/manifest/manifest.wit.go +6 -0
- package/go/gen/wasmnest/plugin/plugin/plugin.wit.go +4 -0
- package/go/gen/wasmnest/process/host-process/empty.s +3 -0
- package/go/gen/wasmnest/process/host-process/host-process.wasm.go +21 -0
- package/go/gen/wasmnest/process/host-process/host-process.wit.go +56 -0
- package/go/gen/wasmnest/pty/host-pty/abi.go +14 -0
- package/go/gen/wasmnest/pty/host-pty/empty.s +3 -0
- package/go/gen/wasmnest/pty/host-pty/host-pty.wasm.go +33 -0
- package/go/gen/wasmnest/pty/host-pty/host-pty.wit.go +164 -0
- package/go/gen/wasmnest/task/host-task/abi.go +14 -0
- package/go/gen/wasmnest/task/host-task/empty.s +3 -0
- package/go/gen/wasmnest/task/host-task/host-task.wasm.go +29 -0
- package/go/gen/wasmnest/task/host-task/host-task.wit.go +110 -0
- package/go/gen/wasmnest/timer/host-timer/empty.s +3 -0
- package/go/gen/wasmnest/timer/host-timer/host-timer.wasm.go +13 -0
- package/go/gen/wasmnest/timer/host-timer/host-timer.wit.go +25 -0
- package/go/gen/wasmnest/ws/host-websocket/empty.s +3 -0
- package/go/gen/wasmnest/ws/host-websocket/host-websocket.wasm.go +29 -0
- package/go/gen/wasmnest/ws/host-websocket/host-websocket.wit.go +109 -0
- package/go/gen/wasmnest/ws-server/host-websocket-server/empty.s +3 -0
- package/go/gen/wasmnest/ws-server/host-websocket-server/host-websocket-server.wasm.go +49 -0
- package/go/gen/wasmnest/ws-server/host-websocket-server/host-websocket-server.wit.go +220 -0
- package/go/go.mod +14 -0
- package/go/go.sum +2 -0
- package/go/sdk/dispatch.go +49 -0
- package/go/sdk/dispatch_test.go +81 -0
- package/go/sdk/entry_native.go +13 -0
- package/go/sdk/entry_wasip2.go +188 -0
- package/go/sdk/host_http_wasip2.go +42 -0
- package/go/sdk/host_wasip2.go +251 -0
- package/go/sdk/plugin.go +103 -0
- package/go/testplugin/index.js +1 -0
- package/go/testplugin/main.go +67 -0
- package/go/testplugin/plugin.json +24 -0
- package/go/tools/assemble-wit.mjs +152 -0
- package/go/tools/gen-bindings.mjs +51 -0
- package/go/wit/core.wit +273 -0
- package/go/wit/deps/api-call/cap-api-call.wit +20 -0
- package/go/wit/deps/app/cap-app.wit +54 -0
- package/go/wit/deps/auth-center/cap-auth-center.wit +124 -0
- package/go/wit/deps/clipboard/clipboard.wit +48 -0
- package/go/wit/deps/clocks/monotonic-clock.wit +45 -0
- package/go/wit/deps/clocks/wall-clock.wit +42 -0
- package/go/wit/deps/clocks/world.wit +6 -0
- package/go/wit/deps/connection-registry/cap-connection-registry.wit +40 -0
- package/go/wit/deps/crypto/cap-crypto.wit +68 -0
- package/go/wit/deps/filesystem/preopens.wit +8 -0
- package/go/wit/deps/filesystem/types.wit +634 -0
- package/go/wit/deps/filesystem/world.wit +6 -0
- package/go/wit/deps/fs-desktop/cap-fs-desktop.wit +29 -0
- package/go/wit/deps/http/http.wit +28 -0
- package/go/wit/deps/http-endpoint/cap-http.wit +44 -0
- package/go/wit/deps/io/error.wit +34 -0
- package/go/wit/deps/io/poll.wit +41 -0
- package/go/wit/deps/io/streams.wit +262 -0
- package/go/wit/deps/io/world.wit +6 -0
- package/go/wit/deps/mdns/mdns.wit +45 -0
- package/go/wit/deps/notify/notify.wit +51 -0
- package/go/wit/deps/peer/peer.wit +126 -0
- package/go/wit/deps/platform-desktop/cap-platform-desktop.wit +38 -0
- package/go/wit/deps/process/cap-process.wit +25 -0
- package/go/wit/deps/pty/pty.wit +80 -0
- package/go/wit/deps/random/insecure-seed.wit +25 -0
- package/go/wit/deps/random/insecure.wit +22 -0
- package/go/wit/deps/random/random.wit +26 -0
- package/go/wit/deps/random/world.wit +7 -0
- package/go/wit/deps/sockets/instance-network.wit +9 -0
- package/go/wit/deps/sockets/ip-name-lookup.wit +51 -0
- package/go/wit/deps/sockets/network.wit +145 -0
- package/go/wit/deps/sockets/tcp-create-socket.wit +27 -0
- package/go/wit/deps/sockets/tcp.wit +353 -0
- package/go/wit/deps/sockets/udp-create-socket.wit +27 -0
- package/go/wit/deps/sockets/udp.wit +266 -0
- package/go/wit/deps/sockets/world.wit +11 -0
- package/go/wit/deps/task/cap-task.wit +56 -0
- package/go/wit/deps/timer/cap-timer.wit +14 -0
- package/go/wit/deps/wasi-cli/command.wit +7 -0
- package/go/wit/deps/wasi-cli/environment.wit +18 -0
- package/go/wit/deps/wasi-cli/exit.wit +4 -0
- package/go/wit/deps/wasi-cli/imports.wit +20 -0
- package/go/wit/deps/wasi-cli/run.wit +4 -0
- package/go/wit/deps/wasi-cli/stdio.wit +17 -0
- package/go/wit/deps/wasi-cli/terminal.wit +49 -0
- package/go/wit/deps/ws/ws.wit +50 -0
- package/go/wit/deps/ws-server/cap-ws.wit +99 -0
- package/go/wit/go-plugin.wit +28 -0
- package/go/wit/plugin-face.wit +355 -0
- package/go/wit/wasmnest.wit +25 -0
- package/package.json +12 -1
- package/src/index.ts +8 -0
- package/src/types.ts +681 -630
- package/src/ui/AppUpdateSection.d.ts +44 -0
- package/src/ui/AppUpdateSection.vue +253 -0
- package/src/ui/NumberField.d.ts +49 -0
- package/src/ui/NumberField.vue +390 -0
- package/src/ui/Select.vue +4 -4
- package/src/update.ts +123 -0
- package/template/README.md +39 -39
- package/tools/componentize/Cargo.lock +30 -1
- package/tools/componentize/Cargo.toml +3 -0
- package/tools/componentize/src/main.rs +197 -94
- package/dev-shell/src/mock/agent-hub-commands.ts +0 -1065
- package/dev-shell/src/mock/agent-hub.ts +0 -42
|
@@ -189,6 +189,8 @@
|
|
|
189
189
|
height: 16px;
|
|
190
190
|
border-radius: 50%;
|
|
191
191
|
background: var(--bg-card);
|
|
192
|
+
/* 轻投影让旋钮「浮」在轨道上(材质深度),色自 text-primary 派生,双主题自适应 */
|
|
193
|
+
box-shadow: 0 1px 2px color-mix(in srgb, var(--text-primary) 28%, transparent);
|
|
192
194
|
transition: transform var(--motion-duration-base) var(--motion-ease);
|
|
193
195
|
pointer-events: none;
|
|
194
196
|
}
|
|
@@ -231,7 +233,9 @@
|
|
|
231
233
|
background-color var(--motion-duration-fast) var(--motion-ease),
|
|
232
234
|
color var(--motion-duration-fast) var(--motion-ease);
|
|
233
235
|
}
|
|
234
|
-
|
|
236
|
+
/* 悬停 = 文字升一档 + 面色轻染(只染未选中项;选中项是实色药丸,不再叠底) */
|
|
237
|
+
.shell-seg button:hover:not(.on) {
|
|
238
|
+
background: color-mix(in srgb, var(--text-primary) 7%, transparent);
|
|
235
239
|
color: var(--text-primary);
|
|
236
240
|
}
|
|
237
241
|
/* 选中用固定黑底 + 反白文字:不用白色药丸,也不加勾章,不随明暗主题反转
|
|
@@ -247,6 +251,44 @@
|
|
|
247
251
|
box-shadow: none;
|
|
248
252
|
}
|
|
249
253
|
|
|
254
|
+
/* ==================== 分组卡面(无卡头的裸面板) ====================
|
|
255
|
+
与 `.shell-card` 同一档「内容面」,差别只在标题:`.shell-card` 的标题在卡内
|
|
256
|
+
(ShellCard 组件);`.shell-panel` 没有卡头,供不需要分组标题的整块面板用。
|
|
257
|
+
设置页分组 2026-11-09 起统一走 ShellCard(图标 + 卡内标题),不再用「卡外
|
|
258
|
+
平铺标题 + `.shell-panel`」这套写法——同一页两种头型是用户点名的不一致。
|
|
259
|
+
`overflow: hidden` 让 `divide-y` 行分隔线跟随圆角裁切(10px 硬编码圆角正是裁不齐
|
|
260
|
+
的根源之一,圆角统一走 `--radius-card`)。 */
|
|
261
|
+
.shell-panel {
|
|
262
|
+
background: var(--bg-card);
|
|
263
|
+
border: 1px solid var(--border);
|
|
264
|
+
border-radius: var(--radius-card);
|
|
265
|
+
overflow: hidden;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/* ==================== 文本框(壳内设置项输入) ====================
|
|
269
|
+
壳里唯一的文本输入控件:原生 `input[type=number]` 的步进器不可 token 化、
|
|
270
|
+
属禁止的系统原生 UI,数字输入用 `type=text` + `inputmode=numeric` + 这个类。
|
|
271
|
+
颜色全走 token(`--bg-input` / `--border-input` / `--radius-input`),
|
|
272
|
+
玻璃主题的 `--bg-input` 已是 84% 半透明体色,无需额外规则。 */
|
|
273
|
+
.shell-input {
|
|
274
|
+
height: 28px;
|
|
275
|
+
padding: 0 10px;
|
|
276
|
+
border-radius: var(--radius-input);
|
|
277
|
+
background: var(--bg-input);
|
|
278
|
+
border: 1px solid var(--border-input);
|
|
279
|
+
color: var(--text-primary);
|
|
280
|
+
font-size: calc(12.5px * var(--ui-scale));
|
|
281
|
+
outline: none;
|
|
282
|
+
transition: border-color var(--motion-duration-fast) var(--motion-ease);
|
|
283
|
+
}
|
|
284
|
+
.shell-input:focus {
|
|
285
|
+
border-color: var(--color-primary);
|
|
286
|
+
}
|
|
287
|
+
.shell-input:disabled {
|
|
288
|
+
opacity: 0.5;
|
|
289
|
+
cursor: not-allowed;
|
|
290
|
+
}
|
|
291
|
+
|
|
250
292
|
/* ==================== 按钮(壳内 mini / ghost / danger 形态) ==================== */
|
|
251
293
|
.shell-btn {
|
|
252
294
|
height: 28px;
|
|
@@ -318,12 +360,20 @@
|
|
|
318
360
|
white-space: nowrap;
|
|
319
361
|
transition:
|
|
320
362
|
background-color var(--motion-duration-fast) var(--motion-ease),
|
|
321
|
-
color var(--motion-duration-fast) var(--motion-ease)
|
|
363
|
+
color var(--motion-duration-fast) var(--motion-ease),
|
|
364
|
+
transform var(--motion-duration-fast) var(--motion-ease);
|
|
322
365
|
}
|
|
323
366
|
.shell-mini:hover {
|
|
324
367
|
background: var(--bg-hover);
|
|
325
368
|
color: var(--text-primary);
|
|
326
369
|
}
|
|
370
|
+
/* 按压反馈:只缩视觉、不改布局(与 .shell-btn 的 1px 下沉同一档即时反馈) */
|
|
371
|
+
.shell-mini:active {
|
|
372
|
+
transform: scale(0.97);
|
|
373
|
+
}
|
|
374
|
+
.shell-mini:disabled:active {
|
|
375
|
+
transform: none;
|
|
376
|
+
}
|
|
327
377
|
.shell-mini.danger {
|
|
328
378
|
color: var(--color-danger-ink);
|
|
329
379
|
border-color: color-mix(in srgb, var(--color-danger) 35%, transparent);
|
|
@@ -361,6 +411,30 @@
|
|
|
361
411
|
border: 1px solid color-mix(in srgb, var(--color-danger) 30%, transparent);
|
|
362
412
|
}
|
|
363
413
|
|
|
414
|
+
/* ==================== 行控件行(label 左 / 控件右) ====================
|
|
415
|
+
设置卡内「一行一设置项」的骨架(SysSettingsView / SysAppearanceView /
|
|
416
|
+
SysShortcutsView 三处消费,达 3+ 门槛上提;2026-10-28)。 */
|
|
417
|
+
.row-sw {
|
|
418
|
+
display: flex;
|
|
419
|
+
align-items: center;
|
|
420
|
+
gap: 12px;
|
|
421
|
+
padding: 9px 2px;
|
|
422
|
+
}
|
|
423
|
+
.row-sw + .row-sw {
|
|
424
|
+
border-top: 1px solid var(--border);
|
|
425
|
+
}
|
|
426
|
+
.row-sw .lb {
|
|
427
|
+
flex: 1;
|
|
428
|
+
min-width: 0;
|
|
429
|
+
}
|
|
430
|
+
.row-sw .lb b {
|
|
431
|
+
display: block;
|
|
432
|
+
font-size: calc(12.5px * var(--ui-scale));
|
|
433
|
+
font-weight: 600;
|
|
434
|
+
letter-spacing: -0.005em;
|
|
435
|
+
color: var(--text-primary);
|
|
436
|
+
}
|
|
437
|
+
|
|
364
438
|
/* ==================== kv / 记录行 ==================== */
|
|
365
439
|
.shell-kv {
|
|
366
440
|
display: flex;
|
|
@@ -485,6 +559,138 @@
|
|
|
485
559
|
}
|
|
486
560
|
}
|
|
487
561
|
|
|
562
|
+
/* ==================== 悬浮导航(回主屏 / 多任务胶囊,Liquid Glass) ====================
|
|
563
|
+
与移动端 ShellFloatingNav 同款材质(blur 26px + saturate 200% + 斜向高光面 +
|
|
564
|
+
内缘折射),色值全部走桌面主题 token(--bg-card / --text-primary),随主题与
|
|
565
|
+
明暗档联动。它是悬浮**控件**不是阅读面板:只有图标没有文字,底色取 72%——
|
|
566
|
+
比浮层面板(--bg-glass 96%)更透才是「液体」;图标笔画对合成底色仍 ≥3:1
|
|
567
|
+
(非文本对比下限),边界由 1px 亮边 + 内缘高光承担,不靠底色。
|
|
568
|
+
不用 @supports 分支做模糊本身(同 .shell-glass 口径),但底色必须在
|
|
569
|
+
完全不支持 backdrop-filter 时回实心——72% 无模糊压不住下层内容。 */
|
|
570
|
+
.shell-floatnav {
|
|
571
|
+
position: fixed;
|
|
572
|
+
left: 0;
|
|
573
|
+
top: 0;
|
|
574
|
+
/* 宿主弹层(多任务 44 / 面板 45 / 弹窗 50 / 右键 60 / 启动 100)都在之上:
|
|
575
|
+
弹层打开时由遮罩自然盖住;工具栏(30)/ 状态栏(20)在之下 */
|
|
576
|
+
z-index: 40;
|
|
577
|
+
display: flex;
|
|
578
|
+
align-items: center;
|
|
579
|
+
gap: 10px;
|
|
580
|
+
padding: 5px;
|
|
581
|
+
border-radius: 999px;
|
|
582
|
+
border: 1px solid color-mix(in srgb, var(--text-primary) 16%, transparent);
|
|
583
|
+
background: color-mix(in srgb, var(--bg-card) 72%, transparent);
|
|
584
|
+
-webkit-backdrop-filter: blur(26px) saturate(200%);
|
|
585
|
+
backdrop-filter: blur(26px) saturate(200%);
|
|
586
|
+
box-shadow:
|
|
587
|
+
0 10px 28px rgba(0, 0, 0, 0.28),
|
|
588
|
+
0 1px 3px rgba(0, 0, 0, 0.18),
|
|
589
|
+
inset 0 1px 0 color-mix(in srgb, var(--text-primary) 22%, transparent),
|
|
590
|
+
inset 0 -1px 0 rgba(0, 0, 0, 0.22);
|
|
591
|
+
opacity: 0;
|
|
592
|
+
touch-action: none;
|
|
593
|
+
user-select: none;
|
|
594
|
+
cursor: grab;
|
|
595
|
+
transition:
|
|
596
|
+
opacity var(--motion-duration-fast) var(--motion-ease),
|
|
597
|
+
box-shadow var(--motion-duration-fast) var(--motion-ease);
|
|
598
|
+
animation: shell-floatnav-in var(--motion-duration-base) var(--motion-ease);
|
|
599
|
+
}
|
|
600
|
+
/* 斜向高光面:液体玻璃的「光从左上来」读感(pointer-events 关掉,纯视觉层) */
|
|
601
|
+
.shell-floatnav::before {
|
|
602
|
+
content: '';
|
|
603
|
+
position: absolute;
|
|
604
|
+
inset: 1px;
|
|
605
|
+
border-radius: inherit;
|
|
606
|
+
background: linear-gradient(
|
|
607
|
+
155deg,
|
|
608
|
+
color-mix(in srgb, var(--text-primary) 13%, transparent) 0%,
|
|
609
|
+
color-mix(in srgb, var(--text-primary) 4%, transparent) 42%,
|
|
610
|
+
transparent 72%
|
|
611
|
+
);
|
|
612
|
+
pointer-events: none;
|
|
613
|
+
}
|
|
614
|
+
.shell-floatnav.is-ready {
|
|
615
|
+
opacity: 1;
|
|
616
|
+
}
|
|
617
|
+
.shell-floatnav:not(.is-ready) {
|
|
618
|
+
/* 尺寸未量到前不接收点击:避免首帧位置未定时被误触 */
|
|
619
|
+
pointer-events: none;
|
|
620
|
+
}
|
|
621
|
+
.shell-floatnav.is-dragging {
|
|
622
|
+
cursor: grabbing;
|
|
623
|
+
box-shadow:
|
|
624
|
+
0 18px 42px rgba(0, 0, 0, 0.34),
|
|
625
|
+
0 3px 8px rgba(0, 0, 0, 0.22),
|
|
626
|
+
inset 0 1px 0 color-mix(in srgb, var(--text-primary) 28%, transparent),
|
|
627
|
+
inset 0 -1px 0 rgba(0, 0, 0, 0.26);
|
|
628
|
+
}
|
|
629
|
+
.shell-floatnav:focus-visible {
|
|
630
|
+
outline: 2px solid var(--color-primary);
|
|
631
|
+
outline-offset: 3px;
|
|
632
|
+
}
|
|
633
|
+
.shell-floatnav-btn {
|
|
634
|
+
position: relative;
|
|
635
|
+
z-index: 1;
|
|
636
|
+
display: flex;
|
|
637
|
+
align-items: center;
|
|
638
|
+
justify-content: center;
|
|
639
|
+
/* 横向略宽于正方形:胶囊因此读作「拉长的按钮」而不是两个圆点 */
|
|
640
|
+
width: 42px;
|
|
641
|
+
height: 34px;
|
|
642
|
+
border-radius: 999px;
|
|
643
|
+
color: var(--text-primary);
|
|
644
|
+
transition:
|
|
645
|
+
background-color var(--motion-duration-fast) var(--motion-ease),
|
|
646
|
+
transform var(--motion-duration-fast) var(--motion-ease);
|
|
647
|
+
}
|
|
648
|
+
.shell-floatnav-btn:hover {
|
|
649
|
+
background: color-mix(in srgb, var(--text-primary) 12%, transparent);
|
|
650
|
+
}
|
|
651
|
+
.shell-floatnav-btn:active {
|
|
652
|
+
background: color-mix(in srgb, var(--color-primary) 22%, transparent);
|
|
653
|
+
/* 只缩放图标按钮的视觉,不改胶囊位置(transform 由外层承担) */
|
|
654
|
+
transform: scale(0.94);
|
|
655
|
+
}
|
|
656
|
+
/* 无可返回目标(已在主屏且无覆层):置灰但保留占位——胶囊宽度不随面态跳,
|
|
657
|
+
也不给「能点」的假象;悬停 / 按压反馈一并撤掉 */
|
|
658
|
+
.shell-floatnav-btn:disabled,
|
|
659
|
+
.shell-floatnav-btn:disabled:hover,
|
|
660
|
+
.shell-floatnav-btn:disabled:active {
|
|
661
|
+
color: color-mix(in srgb, var(--text-primary) 34%, transparent);
|
|
662
|
+
background: none;
|
|
663
|
+
transform: none;
|
|
664
|
+
cursor: default;
|
|
665
|
+
}
|
|
666
|
+
.shell-floatnav-divider {
|
|
667
|
+
position: relative;
|
|
668
|
+
z-index: 1;
|
|
669
|
+
width: 1px;
|
|
670
|
+
height: 16px;
|
|
671
|
+
background: color-mix(in srgb, var(--text-primary) 24%, transparent);
|
|
672
|
+
}
|
|
673
|
+
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
|
|
674
|
+
.shell-floatnav {
|
|
675
|
+
background: var(--bg-card);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
@media (prefers-reduced-transparency: reduce) {
|
|
679
|
+
.shell-floatnav {
|
|
680
|
+
background: var(--bg-card);
|
|
681
|
+
-webkit-backdrop-filter: none;
|
|
682
|
+
backdrop-filter: none;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
@keyframes shell-floatnav-in {
|
|
686
|
+
from {
|
|
687
|
+
opacity: 0;
|
|
688
|
+
}
|
|
689
|
+
to {
|
|
690
|
+
opacity: 1;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
|
|
488
694
|
/* ==================== 屏幕切换动效(减速到达,只动 transform/opacity,spec-c §1) ==================== */
|
|
489
695
|
.screen-entering {
|
|
490
696
|
animation: shell-scr-in var(--motion-duration-base) var(--motion-ease);
|
|
@@ -29,8 +29,12 @@ html.platform-linux {
|
|
|
29
29
|
* 新增色板 = 加一组 [data-palette='xxx'] 变量覆盖 + 设置页选项,无需改其他代码。
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
|
-
/* 浅色模式 · 默认色板 warm(暖调工作台)
|
|
33
|
-
|
|
32
|
+
/* 浅色模式 · 默认色板 warm(暖调工作台)
|
|
33
|
+
`.theme-base` 与 `:root` 共用这一份基础档:设置页「默认主题」的预览块挂这个类,
|
|
34
|
+
以免它继承当前主题(<html data-theme>)的 token——否则「默认」那张预览会长成
|
|
35
|
+
当前主题的样子,用户看不见默认长什么样。 */
|
|
36
|
+
:root,
|
|
37
|
+
.theme-base {
|
|
34
38
|
color-scheme: light;
|
|
35
39
|
|
|
36
40
|
/* 基础排版:拉丁字形在前、CJK 字形在后(逐字回退)——不写 CJK 家族时,
|
|
@@ -75,8 +79,8 @@ html.platform-linux {
|
|
|
75
79
|
--font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
|
|
76
80
|
|
|
77
81
|
/* 动态字体大小:各档以"正常"档位实际像素为基准,随 --ui-scale 等比缩放 */
|
|
78
|
-
--font-size-xs: calc(
|
|
79
|
-
--font-size-sm: calc(
|
|
82
|
+
--font-size-xs: calc(10px * var(--ui-scale));
|
|
83
|
+
--font-size-sm: calc(11px * var(--ui-scale));
|
|
80
84
|
--font-size-base: calc(12px * var(--ui-scale));
|
|
81
85
|
--font-size-lg: calc(14px * var(--ui-scale));
|
|
82
86
|
--font-size-xl: calc(16px * var(--ui-scale));
|
|
@@ -239,11 +243,15 @@ html.platform-linux {
|
|
|
239
243
|
|
|
240
244
|
/* 交互动效:壳与挂载面共用同一组节奏(时长按距离 / 复杂度分档,缓动统一减速到达)。
|
|
241
245
|
组件 scoped 样式里不再各写一份 0.15s/0.2s —— 见 ui-ux-pro-max ux 域
|
|
242
|
-
Duration Timing:用共享 token,别把同一组数字抄进每个过渡。
|
|
246
|
+
Duration Timing:用共享 token,别把同一组数字抄进每个过渡。
|
|
247
|
+
曲线取「强减速」档(Emil Kowalski 动效技能 animate / AUDIT.md):入场用
|
|
248
|
+
cubic-bezier(0.23, 1, 0.32, 1) 而不是内置 ease-out —— 内置曲线前段太软,
|
|
249
|
+
用户盯着看的那一下会显得迟滞。退场仍保留加速曲线(ui-ux-pro-max Easing:
|
|
250
|
+
到达减速、离开加速)。 */
|
|
243
251
|
--motion-duration-fast: 130ms;
|
|
244
252
|
--motion-duration-base: 200ms;
|
|
245
253
|
--motion-duration-slow: 320ms;
|
|
246
|
-
--motion-ease: cubic-bezier(0.
|
|
254
|
+
--motion-ease: cubic-bezier(0.23, 1, 0.32, 1);
|
|
247
255
|
--motion-ease-in: cubic-bezier(0.4, 0, 1, 1);
|
|
248
256
|
|
|
249
257
|
/* 键盘焦点环(所有自绘控件共用):实色 2px + 2px 间隙,任何底色上都可辨 */
|
|
@@ -269,8 +277,11 @@ html.platform-linux {
|
|
|
269
277
|
--action-button-size: 32px;
|
|
270
278
|
}
|
|
271
279
|
|
|
272
|
-
/* 深色模式 · 默认色板 warm
|
|
273
|
-
|
|
280
|
+
/* 深色模式 · 默认色板 warm
|
|
281
|
+
深色预览块也走这份基础档:`:root.dark .theme-base` 让默认主题的预览跟着壳的明暗走
|
|
282
|
+
(比让 JS 给预览块另挂一个 dark 类更稳——<html> 上的 dark 类是明暗的唯一真源)。 */
|
|
283
|
+
:root.dark,
|
|
284
|
+
:root.dark .theme-base {
|
|
274
285
|
color-scheme: dark;
|
|
275
286
|
|
|
276
287
|
--bg-page: #15130f;
|
|
@@ -354,6 +365,36 @@ html.platform-linux {
|
|
|
354
365
|
);
|
|
355
366
|
}
|
|
356
367
|
|
|
368
|
+
/* 默认档的中性化:主题专属的三枚 token(环境光 / 图标外框 / 图标投影)不属于默认档,
|
|
369
|
+
显式归零——否则它们会从当前主题的 <html> 继承下来,默认预览就带上了别人的语汇。 */
|
|
370
|
+
.theme-base {
|
|
371
|
+
--theme-ambient: none;
|
|
372
|
+
--theme-icon-shadow: none;
|
|
373
|
+
--theme-icon-radius: var(--radius-app-icon);
|
|
374
|
+
/* 玻璃材质 token 也归零:默认预览不挂 data-theme,若这些值从当前主题
|
|
375
|
+
继承下来,任何引用它们的预览规则都会偷偷长成玻璃。 */
|
|
376
|
+
--theme-glass-tint: var(--bg-card);
|
|
377
|
+
--theme-glass-fill-top: var(--bg-card);
|
|
378
|
+
--theme-glass-fill-bottom: var(--bg-card);
|
|
379
|
+
--theme-glass-control: var(--bg-card);
|
|
380
|
+
--theme-glass-control-hover: var(--bg-card);
|
|
381
|
+
--theme-glass-rim-hi: transparent;
|
|
382
|
+
--theme-glass-rim-lo: transparent;
|
|
383
|
+
--theme-glass-inner: transparent;
|
|
384
|
+
--theme-glass-edge: var(--border);
|
|
385
|
+
--theme-glass-sheen: transparent;
|
|
386
|
+
--theme-glass-caustic: transparent;
|
|
387
|
+
--theme-glass-glow: transparent;
|
|
388
|
+
--theme-glass-blur: 0px;
|
|
389
|
+
--theme-glass-sat: 100%;
|
|
390
|
+
--theme-glass-brightness: 1;
|
|
391
|
+
--theme-glass-grain: none;
|
|
392
|
+
--theme-glass-grain-opacity: 0;
|
|
393
|
+
--theme-glass-selected: var(--bg-card);
|
|
394
|
+
--theme-glass-radius-card: var(--radius-card);
|
|
395
|
+
--theme-glass-radius-control: var(--radius-button);
|
|
396
|
+
}
|
|
397
|
+
|
|
357
398
|
/* ==================== 色板:cool(冷灰调) ==================== */
|
|
358
399
|
/* 新增色板 = 在此加一组 [data-palette='xxx'] 变量覆盖 + 设置页调色台选项 */
|
|
359
400
|
|
|
@@ -721,9 +762,17 @@ body {
|
|
|
721
762
|
box-shadow: var(--shadow-input-focus);
|
|
722
763
|
}
|
|
723
764
|
|
|
765
|
+
/* 只过渡真正会变的属性:`transition: all` 会把 width/height 等布局属性也纳入
|
|
766
|
+
过渡(按钮文字变化时整页重排),并且无法被合成器单独优化。 */
|
|
724
767
|
.desktop-ui button,
|
|
725
768
|
.desktop-ui a {
|
|
726
|
-
transition:
|
|
769
|
+
transition:
|
|
770
|
+
background-color var(--motion-duration-base) var(--motion-ease),
|
|
771
|
+
border-color var(--motion-duration-base) var(--motion-ease),
|
|
772
|
+
color var(--motion-duration-base) var(--motion-ease),
|
|
773
|
+
box-shadow var(--motion-duration-base) var(--motion-ease),
|
|
774
|
+
opacity var(--motion-duration-base) var(--motion-ease),
|
|
775
|
+
transform var(--motion-duration-base) var(--motion-ease);
|
|
727
776
|
}
|
|
728
777
|
|
|
729
778
|
/* ==================== Scrollbar ==================== */
|
|
@@ -768,22 +817,20 @@ body {
|
|
|
768
817
|
flex-shrink: 0;
|
|
769
818
|
}
|
|
770
819
|
|
|
771
|
-
/*
|
|
820
|
+
/* 小号 section 标题(ENABLED · 2 等):sentence case,靠字号/颜色分层,不靠全大写 */
|
|
772
821
|
.wb-section-title {
|
|
773
822
|
font-size: calc(11px * var(--ui-scale));
|
|
774
|
-
font-weight:
|
|
775
|
-
letter-spacing: 0.
|
|
776
|
-
text-transform: uppercase;
|
|
823
|
+
font-weight: 500;
|
|
824
|
+
letter-spacing: 0.01em;
|
|
777
825
|
color: var(--text-secondary);
|
|
778
826
|
margin-bottom: 8px;
|
|
779
827
|
}
|
|
780
828
|
|
|
781
|
-
/* 侧边栏分组标签(Navigation / Plugins / Status
|
|
829
|
+
/* 侧边栏分组标签(Navigation / Plugins / Status):sentence case;技术 token 才保留大写 */
|
|
782
830
|
.wb-sidebar-section {
|
|
783
|
-
font-size: calc(
|
|
784
|
-
font-weight:
|
|
785
|
-
|
|
786
|
-
letter-spacing: 0.14em;
|
|
831
|
+
font-size: calc(11px * var(--ui-scale));
|
|
832
|
+
font-weight: 500;
|
|
833
|
+
letter-spacing: 0;
|
|
787
834
|
color: var(--text-tertiary);
|
|
788
835
|
white-space: nowrap;
|
|
789
836
|
}
|
|
@@ -897,7 +944,9 @@ html.anim-disabled *::after {
|
|
|
897
944
|
:root {
|
|
898
945
|
--motion-page-duration-in: 220ms;
|
|
899
946
|
--motion-page-duration-out: 160ms;
|
|
900
|
-
--motion-
|
|
947
|
+
/* 与 --motion-ease 同一档强减速曲线:页面入场是最常被注视的动效,
|
|
948
|
+
缓动强度不能比壳内小组件弱。 */
|
|
949
|
+
--motion-page-ease: cubic-bezier(0.23, 1, 0.32, 1);
|
|
901
950
|
--motion-page-shift: 10px;
|
|
902
951
|
--motion-page-scale: 0.985;
|
|
903
952
|
}
|
|
@@ -1076,16 +1125,13 @@ html[data-page-fx='zoom'] .page-leave-to {
|
|
|
1076
1125
|
--normal-border-hover: var(--border-strong) !important;
|
|
1077
1126
|
}
|
|
1078
1127
|
|
|
1079
|
-
/* 覆盖 vue-sonner 自带的 prefers-reduced-motion 禁用规则:保留 toast
|
|
1080
|
-
|
|
1128
|
+
/* 覆盖 vue-sonner 自带的 prefers-reduced-motion 禁用规则:保留 toast 的淡入淡出
|
|
1129
|
+
(可见性反馈是必要的),但去掉位移动画与 height 等布局属性过渡,时长压到
|
|
1130
|
+
200ms —— 减弱动态是「更轻」,不是「照旧播」。 */
|
|
1081
1131
|
@media (prefers-reduced-motion: reduce) {
|
|
1082
1132
|
[data-sonner-toast],
|
|
1083
1133
|
[data-sonner-toast] > * {
|
|
1084
|
-
transition:
|
|
1085
|
-
transform 400ms,
|
|
1086
|
-
opacity 400ms,
|
|
1087
|
-
height 400ms,
|
|
1088
|
-
box-shadow 200ms !important;
|
|
1134
|
+
transition: opacity 200ms !important;
|
|
1089
1135
|
}
|
|
1090
1136
|
}
|
|
1091
1137
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { PluginContext, PluginDialogOptions, ConfigProperty, PluginConfiguration } from './types.js';
|
|
2
|
-
export { CommandContribution, CommandRegistry, Disposable, EndpointAuthTier, EventAPI, FileHandlerContribution, FileHandlerDescriptor, HttpAPI, HttpEndpointContribution, I18nAPI, InputExtensionDescriptor, LifecycleContribution, MonitorPanelContribution, PageToolbarItemDescriptor, PluginContributes, PluginDevMock, PluginDialogAction, PluginDialogHandle, PluginInfo, PluginManifest, PluginModule, PluginState, PluginType, RequestHandler, SessionAPI, SidebarPanelDescriptor, StatusBarItemDescriptor, StorageAPI, TerminalAPI, TerminalContribution, TerminalToolbarItemDescriptor, TitleBarItemDescriptor, ToolProviderContribution, ToolboxPageDescriptor, UIRegistry, ViewContribution, WsEndpointContribution } from './types.js';
|
|
1
|
+
import { PluginContext, PluginDialogOptions, ConfigProperty, PluginConfiguration, AppUpdateReason, AppUpdateCheckResult } from './types.js';
|
|
2
|
+
export { AppUpdateAPI, CommandContribution, CommandRegistry, Disposable, EndpointAuthTier, EventAPI, FileHandlerContribution, FileHandlerDescriptor, HttpAPI, HttpEndpointContribution, I18nAPI, InputExtensionDescriptor, LifecycleContribution, MonitorPanelContribution, PageToolbarItemDescriptor, PluginContributes, PluginDevMock, PluginDialogAction, PluginDialogHandle, PluginInfo, PluginManifest, PluginModule, PluginState, PluginType, PluginUpdateDecl, RequestHandler, SessionAPI, SidebarPanelDescriptor, StatusBarItemDescriptor, StorageAPI, TerminalAPI, TerminalContribution, TerminalToolbarItemDescriptor, TitleBarItemDescriptor, ToolProviderContribution, ToolboxPageDescriptor, UIRegistry, ViewContribution, WsEndpointContribution } from './types.js';
|
|
3
|
+
import { Ref, ComputedRef } from 'vue';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* @binblink/wasmnest-plugin-sdk-desktop 运行时代理
|
|
@@ -106,4 +107,44 @@ declare function defineConfiguration(title: string, properties: Record<string, O
|
|
|
106
107
|
title?: string;
|
|
107
108
|
}>): PluginConfiguration;
|
|
108
109
|
|
|
109
|
-
|
|
110
|
+
/**
|
|
111
|
+
* 应用更新检查(SDK 默认实现;宿主统一提供 GitHub Release 判定)
|
|
112
|
+
*
|
|
113
|
+
* 数据面由宿主给出(`PluginContext.appUpdate.check`):宿主负责查 Release、校验
|
|
114
|
+
* 身份 / 完整性、做平台兼容裁决;本模块只做状态机与展示口径,供应用设置页复用。
|
|
115
|
+
*
|
|
116
|
+
* 应用可以选择:
|
|
117
|
+
* - **默认实现**:`useAppUpdate()` / `<AppUpdateSection />`(宿主能力 + 本模块状态);
|
|
118
|
+
* - **自实现**:自己查更新 / 自己画界面,不消费本模块。
|
|
119
|
+
*
|
|
120
|
+
* 失败口径:检查是被动动作,不向用户抛技术错误——状态落 `error`,技术详情由宿主
|
|
121
|
+
* 日志承载(应用可自行决定是否提示)。
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
/** 状态机的展示态(与宿主返回的 status 子集一致) */
|
|
125
|
+
type AppUpdateStatus = 'idle' | 'checking' | 'up-to-date' | 'available' | 'incompatible' | 'error';
|
|
126
|
+
interface UseAppUpdateOptions {
|
|
127
|
+
/**
|
|
128
|
+
* 自定义检查器(缺省 = 宿主 `PluginContext.appUpdate.check`)
|
|
129
|
+
*
|
|
130
|
+
* 应用自实现更新检查时传入;返回形状与宿主默认实现一致,SDK 默认卡片即可复用。
|
|
131
|
+
*/
|
|
132
|
+
check?: () => Promise<AppUpdateCheckResult>;
|
|
133
|
+
}
|
|
134
|
+
interface UseAppUpdate {
|
|
135
|
+
status: Ref<AppUpdateStatus>;
|
|
136
|
+
latestVersion: Ref<string | undefined>;
|
|
137
|
+
currentVersion: Ref<string | undefined>;
|
|
138
|
+
reason: Ref<AppUpdateReason | undefined>;
|
|
139
|
+
checking: ComputedRef<boolean>;
|
|
140
|
+
/** 当前平台是否提供更新检查能力(旧宿主 / dev-shell 可能没有) */
|
|
141
|
+
supported: ComputedRef<boolean>;
|
|
142
|
+
/** 执行一次检查;并发调用复用同一在途请求 */
|
|
143
|
+
check: () => Promise<void>;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* 应用更新状态机(模块内无全局单例:每个设置页实例各自持状态,避免跨应用串状态)
|
|
147
|
+
*/
|
|
148
|
+
declare function useAppUpdate(options?: UseAppUpdateOptions): UseAppUpdate;
|
|
149
|
+
|
|
150
|
+
export { AppUpdateCheckResult, AppUpdateReason, type AppUpdateStatus, ConfigProperty, type GlobalDialogEntry, type GlobalDialogHandleOutput, type GlobalDialogListener, type OpenGlobalDialogInput, PLUGIN_CONFIG_STORAGE_KEY, PluginConfiguration, PluginContext, PluginDialogOptions, type UseAppUpdate, type UseAppUpdateOptions, closeGlobalDialog, defineConfiguration, getGlobalDialog, getI18n, getPinia, getPluginContext, getRouter, getSharedModule, getVue, getVueI18n, openGlobalDialog, resolveDialogDeadline, subscribeGlobalDialog, updateGlobalDialog, useAppUpdate };
|
package/dist/index.js
CHANGED
|
@@ -151,6 +151,73 @@ function defineConfiguration(title, properties) {
|
|
|
151
151
|
}
|
|
152
152
|
return { title, properties: props };
|
|
153
153
|
}
|
|
154
|
+
|
|
155
|
+
// src/update.ts
|
|
156
|
+
import { computed, getCurrentInstance, inject, ref } from "vue";
|
|
157
|
+
function resolveHostApi() {
|
|
158
|
+
if (!getCurrentInstance()) return void 0;
|
|
159
|
+
return inject("pluginContext", void 0)?.appUpdate;
|
|
160
|
+
}
|
|
161
|
+
function useAppUpdate(options = {}) {
|
|
162
|
+
const hostApi = options.check ? void 0 : resolveHostApi();
|
|
163
|
+
const checker = options.check ?? (() => {
|
|
164
|
+
if (!hostApi) {
|
|
165
|
+
return Promise.reject(
|
|
166
|
+
new Error("[PluginSDK] app update capability is not provided by this host")
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
return hostApi.check();
|
|
170
|
+
});
|
|
171
|
+
const status = ref("idle");
|
|
172
|
+
const latestVersion = ref();
|
|
173
|
+
const currentVersion = ref();
|
|
174
|
+
const reason = ref();
|
|
175
|
+
let inFlight = null;
|
|
176
|
+
const supported = computed(() => Boolean(options.check || hostApi));
|
|
177
|
+
async function run() {
|
|
178
|
+
status.value = "checking";
|
|
179
|
+
reason.value = void 0;
|
|
180
|
+
try {
|
|
181
|
+
const result = await checker();
|
|
182
|
+
currentVersion.value = result.currentVersion;
|
|
183
|
+
latestVersion.value = result.latestVersion;
|
|
184
|
+
reason.value = result.reason;
|
|
185
|
+
switch (result.status) {
|
|
186
|
+
case "up-to-date":
|
|
187
|
+
case "available":
|
|
188
|
+
case "incompatible":
|
|
189
|
+
status.value = result.status;
|
|
190
|
+
break;
|
|
191
|
+
case "idle":
|
|
192
|
+
case "checking":
|
|
193
|
+
status.value = "error";
|
|
194
|
+
break;
|
|
195
|
+
default:
|
|
196
|
+
status.value = "error";
|
|
197
|
+
}
|
|
198
|
+
} catch {
|
|
199
|
+
status.value = "error";
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function check() {
|
|
203
|
+
if (!inFlight) {
|
|
204
|
+
const pending = run().finally(() => {
|
|
205
|
+
if (inFlight === pending) inFlight = null;
|
|
206
|
+
});
|
|
207
|
+
inFlight = pending;
|
|
208
|
+
}
|
|
209
|
+
return inFlight;
|
|
210
|
+
}
|
|
211
|
+
return {
|
|
212
|
+
status,
|
|
213
|
+
latestVersion,
|
|
214
|
+
currentVersion,
|
|
215
|
+
reason,
|
|
216
|
+
checking: computed(() => status.value === "checking"),
|
|
217
|
+
supported,
|
|
218
|
+
check
|
|
219
|
+
};
|
|
220
|
+
}
|
|
154
221
|
export {
|
|
155
222
|
PLUGIN_CONFIG_STORAGE_KEY,
|
|
156
223
|
closeGlobalDialog,
|
|
@@ -166,5 +233,6 @@ export {
|
|
|
166
233
|
openGlobalDialog,
|
|
167
234
|
resolveDialogDeadline,
|
|
168
235
|
subscribeGlobalDialog,
|
|
169
|
-
updateGlobalDialog
|
|
236
|
+
updateGlobalDialog,
|
|
237
|
+
useAppUpdate
|
|
170
238
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -10,8 +10,13 @@
|
|
|
10
10
|
interface Disposable {
|
|
11
11
|
dispose(): void;
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/**
|
|
14
|
+
* 插件产物形态(语言无关三形态,2026-10-26 语义重定义,wasmnest-apps#21)
|
|
15
|
+
*
|
|
16
|
+
* 词汇只表达形态(是否携带 wasm 后端 / 前端产物),不表达后端语言。
|
|
17
|
+
* 旧值 rust / rust-ts / ts-only 已退役:manifest-validate 点名拒绝并给出迁移出路。
|
|
18
|
+
*/
|
|
19
|
+
type PluginType = 'frontend' | 'backend' | 'full';
|
|
15
20
|
/**
|
|
16
21
|
* 组件装配角色(manifest `type` 字段,core-plugin-manager · ADR 0032)
|
|
17
22
|
*
|
|
@@ -40,6 +45,17 @@ type InstanceLifecycle = 'persistent' | 'ephemeral';
|
|
|
40
45
|
* `both` 两端均可装载(真源 SDK `rust/src/types.rs::PluginPlatform`)。
|
|
41
46
|
*/
|
|
42
47
|
type PluginPlatform = 'desktop' | 'mobile' | 'both';
|
|
48
|
+
/** manifest `update` 段:应用更新源声明(缺省 = 不参与更新检查) */
|
|
49
|
+
interface PluginUpdateDecl {
|
|
50
|
+
/** 更新来源类型;当前只支持 `github-release` */
|
|
51
|
+
provider?: 'github-release';
|
|
52
|
+
/** GitHub 仓库 `owner/name`;缺省 = 官方应用仓 `7ZAI/wasmnest-apps` */
|
|
53
|
+
repo?: string;
|
|
54
|
+
/** Release tag 前缀(完整形态 `<tagPrefix>v<X.Y.Z>`);缺省 `<slug>-` */
|
|
55
|
+
tagPrefix?: string;
|
|
56
|
+
/** Release 资产前缀(`<slug>-<end>-v<version>.zip`);缺省 = 插件 id 末段 */
|
|
57
|
+
slug?: string;
|
|
58
|
+
}
|
|
43
59
|
/** 插件描述文件 (plugin.json) 结构 */
|
|
44
60
|
interface PluginManifest {
|
|
45
61
|
id: string;
|
|
@@ -56,7 +72,7 @@ interface PluginManifest {
|
|
|
56
72
|
author: string;
|
|
57
73
|
main: string;
|
|
58
74
|
pluginType: PluginType;
|
|
59
|
-
/** WASM
|
|
75
|
+
/** WASM 库文件名(携带 wasm 后端的形态使用:backend / full;键名暂保留历史拼写,见 wasmnest-apps#21 键位子决策) */
|
|
60
76
|
rustLibrary?: string;
|
|
61
77
|
/** 插件图标:图片路径(相对插件目录)或内联 SVG 标记 */
|
|
62
78
|
icon?: string;
|
|
@@ -86,6 +102,13 @@ interface PluginManifest {
|
|
|
86
102
|
* 缺省 `false` = 既有行为:界面打开才 acquire,关闭最后一个界面即停播。
|
|
87
103
|
*/
|
|
88
104
|
backgroundTransport?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* 应用更新源声明(manifest `update`;缺省 = 不参与更新检查)
|
|
107
|
+
*
|
|
108
|
+
* 宿主按本段解析 GitHub 发布仓 / tag 前缀 / 资产 slug;缺省字段收敛到官方
|
|
109
|
+
* 应用仓命名约定。第三方应用可声明自己的 repo / tagPrefix / slug。
|
|
110
|
+
*/
|
|
111
|
+
update?: PluginUpdateDecl;
|
|
89
112
|
/**
|
|
90
113
|
* 能力依赖声明(应用插件消费的能力名,WIT host-* 接口名)
|
|
91
114
|
*
|
|
@@ -508,6 +531,28 @@ interface I18nAPI {
|
|
|
508
531
|
/** 翻译快捷方法(自动添加插件 ID 前缀) */
|
|
509
532
|
t(key: string, params?: Record<string, unknown>): string;
|
|
510
533
|
}
|
|
534
|
+
/** 应用更新检查的拒绝 / 失败原因(展示层按 key 翻译;params 只承载版本号等非技术值) */
|
|
535
|
+
interface AppUpdateReason {
|
|
536
|
+
key: string;
|
|
537
|
+
params?: Record<string, string>;
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* 应用更新检查结果(宿主默认实现返回;SDK 默认设置卡直接展示)
|
|
541
|
+
*
|
|
542
|
+
* 宿主侧已经完成「取 Release → 校验身份/完整性 → 兼容性判定」,插件只消费状态。
|
|
543
|
+
* `available` 表示有新版本且兼容;`incompatible` 只给原因,绝不提供更新动作。
|
|
544
|
+
*/
|
|
545
|
+
interface AppUpdateCheckResult {
|
|
546
|
+
status: 'idle' | 'checking' | 'up-to-date' | 'available' | 'incompatible' | 'error';
|
|
547
|
+
latestVersion?: string;
|
|
548
|
+
currentVersion?: string;
|
|
549
|
+
reason?: AppUpdateReason;
|
|
550
|
+
}
|
|
551
|
+
/** 应用更新能力(宿主默认实现;appId 与凭据已由宿主绑定) */
|
|
552
|
+
interface AppUpdateAPI {
|
|
553
|
+
/** 检查本应用更新;失败已由宿主归一化为 `status: 'error'`,不抛技术错误 */
|
|
554
|
+
check(): Promise<AppUpdateCheckResult>;
|
|
555
|
+
}
|
|
511
556
|
/** 插件上下文 — 插件访问宿主能力的唯一通道 */
|
|
512
557
|
interface PluginContext {
|
|
513
558
|
readonly id: string;
|
|
@@ -521,6 +566,8 @@ interface PluginContext {
|
|
|
521
566
|
readonly http: HttpAPI;
|
|
522
567
|
/** 国际化 API */
|
|
523
568
|
readonly i18n: I18nAPI;
|
|
569
|
+
/** 应用更新检查(宿主统一默认实现;可选——旧宿主 / dev-shell 可不提供) */
|
|
570
|
+
readonly appUpdate?: AppUpdateAPI;
|
|
524
571
|
/** 内部:所有 Disposable 收集器 */
|
|
525
572
|
readonly _disposables: Disposable[];
|
|
526
573
|
}
|
|
@@ -566,7 +613,7 @@ interface PluginInfo {
|
|
|
566
613
|
author: string;
|
|
567
614
|
main: string;
|
|
568
615
|
pluginType: PluginType;
|
|
569
|
-
/** WASM
|
|
616
|
+
/** WASM 库文件名(携带 wasm 后端的形态使用:backend / full;键名暂保留历史拼写,见 wasmnest-apps#21 键位子决策) */
|
|
570
617
|
rustLibrary?: string;
|
|
571
618
|
permissions: string[];
|
|
572
619
|
state: PluginState;
|
|
@@ -582,4 +629,4 @@ interface PluginInfo {
|
|
|
582
629
|
installedAt?: number;
|
|
583
630
|
}
|
|
584
631
|
|
|
585
|
-
export type { CommandContribution, CommandRegistry, ConfigProperty, Disposable, EndpointAuthTier, EventAPI, FileHandlerContribution, FileHandlerDescriptor, HttpAPI, HttpEndpointContribution, I18nAPI, InputExtensionDescriptor, InstanceLifecycle, LifecycleContribution, MonitorPanelContribution, PageToolbarItemDescriptor, PluginConfiguration, PluginContext, PluginContributes, PluginDevMock, PluginDialogAction, PluginDialogHandle, PluginDialogOptions, PluginInfo, PluginKind, PluginManifest, PluginModule, PluginPlatform, PluginState, PluginType, RequestHandler, ResourceOverrides, SessionAPI, SettingsSectionDescriptor, SidebarPanelDescriptor, StatusBarItemDescriptor, StorageAPI, TerminalAPI, TerminalContribution, TerminalToolbarItemDescriptor, TitleBarItemDescriptor, ToolProviderContribution, ToolboxPageDescriptor, UIRegistry, ViewContribution, WasiPreopenDir, WasiPreopenDirDecl, WsEndpointContribution };
|
|
632
|
+
export type { AppUpdateAPI, AppUpdateCheckResult, AppUpdateReason, CommandContribution, CommandRegistry, ConfigProperty, Disposable, EndpointAuthTier, EventAPI, FileHandlerContribution, FileHandlerDescriptor, HttpAPI, HttpEndpointContribution, I18nAPI, InputExtensionDescriptor, InstanceLifecycle, LifecycleContribution, MonitorPanelContribution, PageToolbarItemDescriptor, PluginConfiguration, PluginContext, PluginContributes, PluginDevMock, PluginDialogAction, PluginDialogHandle, PluginDialogOptions, PluginInfo, PluginKind, PluginManifest, PluginModule, PluginPlatform, PluginState, PluginType, PluginUpdateDecl, RequestHandler, ResourceOverrides, SessionAPI, SettingsSectionDescriptor, SidebarPanelDescriptor, StatusBarItemDescriptor, StorageAPI, TerminalAPI, TerminalContribution, TerminalToolbarItemDescriptor, TitleBarItemDescriptor, ToolProviderContribution, ToolboxPageDescriptor, UIRegistry, ViewContribution, WasiPreopenDir, WasiPreopenDirDecl, WsEndpointContribution };
|