@binblink/wasmnest-plugin-sdk-mobile 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 +78 -2
- package/README_en.md +64 -2
- package/bin/build.js +4 -2
- package/bin/manifest-gen.js +3 -0
- package/bin/package.js +2 -1
- package/bin/scaffold.js +22 -8
- package/dev-shell/README.md +1 -1
- package/dev-shell/src/apps/mock-terminal/MockTerminalSlotCard.vue +13 -21
- package/dev-shell/src/locales/en-shell.ts +6 -2
- package/dev-shell/src/locales/shell.ts +5 -2
- package/dev-shell/src/mock-context.ts +28 -5
- package/dev-shell/src/shell/adapters/devAppSource.ts +2 -13
- package/dev-shell/src/shell/components/ShellNotificationShade.vue +22 -17
- package/dev-shell/src/shell/components/screens/ShellAppDetailScreen.vue +16 -35
- package/dev-shell/src/shell/components/screens/ShellHomeScreen.vue +58 -17
- package/dev-shell/src/shell/composables/useShellApps.ts +5 -3
- package/dev-shell/src/shell/composables/useShellOpen.ts +12 -3
- package/dev-shell/src/shell/composables/useSlotCarousel.ts +238 -0
- package/dev-shell/src/shell/slotCards.ts +47 -0
- package/dev-shell/src/shell/styles/shell.css +340 -26
- package/dev-shell/src/shell/surfaceIntent.ts +107 -0
- package/dev-shell/src/shell/types.ts +17 -2
- package/dev-shell/src/styles/mobile.css +981 -884
- package/dist/index.d.ts +44 -4
- package/dist/index.js +69 -1
- package/dist/types.d.ts +107 -6
- package/package.json +9 -1
- package/src/index.ts +9 -0
- package/src/types.ts +822 -715
- package/src/ui/AppUpdateSection.d.ts +44 -0
- package/src/ui/AppUpdateSection.vue +253 -0
- package/src/ui/QuickCard.d.ts +33 -0
- package/src/ui/QuickCard.vue +167 -0
- package/src/update.ts +123 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MobileHostApi, PluginContext, PluginDialogOptions } from './types.js';
|
|
2
|
-
export { CommandContribution, CommandRegistry, ConfigProperty, DialogAPI, DialogOptions, DialogResult, Disposable, EventAPI, I18nAPI, LifecycleAPI, LifecycleContribution, LoggerAPI, MobileHostSessionEvent, MobileHttpRequestOptions, MobileHttpResult, MobilePluginContributes, MonitorPanelContribution, MonitorPanelEnv, MonitorPanelHandle, MountMonitorPanel, NavTabContribution, NotificationAPI, PluginConfiguration, PluginDevMock, PluginDialogAction, PluginDialogHandle, PluginManifest, PluginModule, PluginRouteDescriptor, PluginState, PluginType, RouteContribution, SessionAPI, SettingsContribution, ShellCapsuleItem, ShellSlotContribution, ShellSurfaceContribution, StatusAPI, StorageAPI, SystemAPI, TerminalContribution, TerminalStreamHandle, TerminalToolbarItemContribution, UIRegistry, ViewContribution } from './types.js';
|
|
3
|
-
import 'vue';
|
|
1
|
+
import { MobileHostApi, PluginContext, PluginDialogOptions, AppUpdateReason, AppUpdateCheckResult } from './types.js';
|
|
2
|
+
export { AppUpdateAPI, CommandContribution, CommandRegistry, ConfigProperty, DialogAPI, DialogOptions, DialogResult, Disposable, EventAPI, I18nAPI, LifecycleAPI, LifecycleContribution, LoggerAPI, MobileHostSessionEvent, MobileHttpRequestOptions, MobileHttpResult, MobilePluginContributes, MonitorPanelContribution, MonitorPanelEnv, MonitorPanelHandle, MountMonitorPanel, NavTabContribution, NotificationAPI, PluginConfiguration, PluginDevMock, PluginDialogAction, PluginDialogHandle, PluginManifest, PluginModule, PluginRouteDescriptor, PluginState, PluginType, PluginUpdateDecl, RouteContribution, SessionAPI, SettingsContribution, ShellCapsuleItem, ShellSlotContribution, ShellSurfaceContribution, ShellSurfaceIntent, StatusAPI, StorageAPI, SystemAPI, TerminalContribution, TerminalStreamHandle, TerminalToolbarItemContribution, UIRegistry, ViewContribution } from './types.js';
|
|
3
|
+
import { Ref, ComputedRef } from 'vue';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @binblink/wasmnest-plugin-sdk-mobile 运行时代理
|
|
@@ -81,4 +81,44 @@ declare function updateGlobalDialog(id: number, options: Partial<PluginDialogOpt
|
|
|
81
81
|
*/
|
|
82
82
|
declare function openGlobalDialog(input: OpenGlobalDialogInput): GlobalDialogHandleOutput;
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
/**
|
|
85
|
+
* 应用更新检查(SDK 默认实现;宿主统一提供 GitHub Release 判定)
|
|
86
|
+
*
|
|
87
|
+
* 数据面由宿主给出(`PluginContext.appUpdate.check`):宿主负责查 Release、校验
|
|
88
|
+
* 身份 / 完整性、做平台兼容裁决;本模块只做状态机与展示口径,供应用设置页复用。
|
|
89
|
+
*
|
|
90
|
+
* 应用可以选择:
|
|
91
|
+
* - **默认实现**:`useAppUpdate()` / `<AppUpdateSection />`(宿主能力 + 本模块状态);
|
|
92
|
+
* - **自实现**:自己查更新 / 自己画界面,不消费本模块。
|
|
93
|
+
*
|
|
94
|
+
* 失败口径:检查是被动动作,不向用户抛技术错误——状态落 `error`,技术详情由宿主
|
|
95
|
+
* 日志承载(应用可自行决定是否提示)。
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
/** 状态机的展示态(与宿主返回的 status 子集一致) */
|
|
99
|
+
type AppUpdateStatus = 'idle' | 'checking' | 'up-to-date' | 'available' | 'incompatible' | 'error';
|
|
100
|
+
interface UseAppUpdateOptions {
|
|
101
|
+
/**
|
|
102
|
+
* 自定义检查器(缺省 = 宿主 `PluginContext.appUpdate.check`)
|
|
103
|
+
*
|
|
104
|
+
* 应用自实现更新检查时传入;返回形状与宿主默认实现一致,SDK 默认卡片即可复用。
|
|
105
|
+
*/
|
|
106
|
+
check?: () => Promise<AppUpdateCheckResult>;
|
|
107
|
+
}
|
|
108
|
+
interface UseAppUpdate {
|
|
109
|
+
status: Ref<AppUpdateStatus>;
|
|
110
|
+
latestVersion: Ref<string | undefined>;
|
|
111
|
+
currentVersion: Ref<string | undefined>;
|
|
112
|
+
reason: Ref<AppUpdateReason | undefined>;
|
|
113
|
+
checking: ComputedRef<boolean>;
|
|
114
|
+
/** 当前平台是否提供更新检查能力(旧宿主 / dev-shell 可能没有) */
|
|
115
|
+
supported: ComputedRef<boolean>;
|
|
116
|
+
/** 执行一次检查;并发调用复用同一在途请求 */
|
|
117
|
+
check: () => Promise<void>;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* 应用更新状态机(模块内无全局单例:每个设置页实例各自持状态,避免跨应用串状态)
|
|
121
|
+
*/
|
|
122
|
+
declare function useAppUpdate(options?: UseAppUpdateOptions): UseAppUpdate;
|
|
123
|
+
|
|
124
|
+
export { AppUpdateCheckResult, AppUpdateReason, type AppUpdateStatus, type GlobalDialogEntry, type GlobalDialogHandleOutput, type GlobalDialogListener, MOCK_SESSION_ID, MobileHostApi, type OpenGlobalDialogInput, PluginContext, PluginDialogOptions, type UseAppUpdate, type UseAppUpdateOptions, closeGlobalDialog, getGlobalDialog, getI18n, getMobileApi, getPinia, getPluginContext, getPresetTasks, getRouter, getSharedModule, getVue, getVueI18n, openGlobalDialog, resolveDialogDeadline, subscribeGlobalDialog, updateGlobalDialog, useAppUpdate };
|
package/dist/index.js
CHANGED
|
@@ -141,6 +141,73 @@ function openGlobalDialog(input) {
|
|
|
141
141
|
update: (options) => updateGlobalDialog(entry._id, options)
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
+
|
|
145
|
+
// src/update.ts
|
|
146
|
+
import { computed, getCurrentInstance, inject, ref } from "vue";
|
|
147
|
+
function resolveHostApi() {
|
|
148
|
+
if (!getCurrentInstance()) return void 0;
|
|
149
|
+
return inject("pluginContext", void 0)?.appUpdate;
|
|
150
|
+
}
|
|
151
|
+
function useAppUpdate(options = {}) {
|
|
152
|
+
const hostApi = options.check ? void 0 : resolveHostApi();
|
|
153
|
+
const checker = options.check ?? (() => {
|
|
154
|
+
if (!hostApi) {
|
|
155
|
+
return Promise.reject(
|
|
156
|
+
new Error("[PluginSDK] app update capability is not provided by this host")
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
return hostApi.check();
|
|
160
|
+
});
|
|
161
|
+
const status = ref("idle");
|
|
162
|
+
const latestVersion = ref();
|
|
163
|
+
const currentVersion = ref();
|
|
164
|
+
const reason = ref();
|
|
165
|
+
let inFlight = null;
|
|
166
|
+
const supported = computed(() => Boolean(options.check || hostApi));
|
|
167
|
+
async function run() {
|
|
168
|
+
status.value = "checking";
|
|
169
|
+
reason.value = void 0;
|
|
170
|
+
try {
|
|
171
|
+
const result = await checker();
|
|
172
|
+
currentVersion.value = result.currentVersion;
|
|
173
|
+
latestVersion.value = result.latestVersion;
|
|
174
|
+
reason.value = result.reason;
|
|
175
|
+
switch (result.status) {
|
|
176
|
+
case "up-to-date":
|
|
177
|
+
case "available":
|
|
178
|
+
case "incompatible":
|
|
179
|
+
status.value = result.status;
|
|
180
|
+
break;
|
|
181
|
+
case "idle":
|
|
182
|
+
case "checking":
|
|
183
|
+
status.value = "error";
|
|
184
|
+
break;
|
|
185
|
+
default:
|
|
186
|
+
status.value = "error";
|
|
187
|
+
}
|
|
188
|
+
} catch {
|
|
189
|
+
status.value = "error";
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function check() {
|
|
193
|
+
if (!inFlight) {
|
|
194
|
+
const pending = run().finally(() => {
|
|
195
|
+
if (inFlight === pending) inFlight = null;
|
|
196
|
+
});
|
|
197
|
+
inFlight = pending;
|
|
198
|
+
}
|
|
199
|
+
return inFlight;
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
status,
|
|
203
|
+
latestVersion,
|
|
204
|
+
currentVersion,
|
|
205
|
+
reason,
|
|
206
|
+
checking: computed(() => status.value === "checking"),
|
|
207
|
+
supported,
|
|
208
|
+
check
|
|
209
|
+
};
|
|
210
|
+
}
|
|
144
211
|
export {
|
|
145
212
|
MOCK_SESSION_ID,
|
|
146
213
|
closeGlobalDialog,
|
|
@@ -157,5 +224,6 @@ export {
|
|
|
157
224
|
openGlobalDialog,
|
|
158
225
|
resolveDialogDeadline,
|
|
159
226
|
subscribeGlobalDialog,
|
|
160
|
-
updateGlobalDialog
|
|
227
|
+
updateGlobalDialog,
|
|
228
|
+
useAppUpdate
|
|
161
229
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -10,7 +10,13 @@ interface Disposable {
|
|
|
10
10
|
dispose(): void;
|
|
11
11
|
}
|
|
12
12
|
/** 插件类型 */
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* 插件产物形态(语言无关三形态,2026-10-26 语义重定义,wasmnest-apps#21)
|
|
15
|
+
*
|
|
16
|
+
* 词汇只表达形态(是否携带 wasm 后端 / 前端产物),不表达后端语言。
|
|
17
|
+
* 旧值 rust / rust-ts / ts-only / wasm 已退役:scaffold 校验点名拒绝并给出迁移出路。
|
|
18
|
+
*/
|
|
19
|
+
type PluginType = 'frontend' | 'backend' | 'full';
|
|
14
20
|
/** 插件运行时状态
|
|
15
21
|
*
|
|
16
22
|
* 取值口径(2026-10-14 对齐):真源 = 共享 crate `wasmnest-wasm-core/src/manifest.rs` 的
|
|
@@ -44,6 +50,17 @@ type PluginState = {
|
|
|
44
50
|
* `both` 两端均可装载(真源 SDK `rust/src/types.rs::PluginPlatform`)。
|
|
45
51
|
*/
|
|
46
52
|
type PluginPlatform = 'desktop' | 'mobile' | 'both';
|
|
53
|
+
/** manifest `update` 段:应用更新源声明(缺省 = 不参与更新检查) */
|
|
54
|
+
interface PluginUpdateDecl {
|
|
55
|
+
/** 更新来源类型;当前只支持 `github-release` */
|
|
56
|
+
provider?: 'github-release';
|
|
57
|
+
/** GitHub 仓库 `owner/name`;缺省 = 官方应用仓 `7ZAI/wasmnest-apps` */
|
|
58
|
+
repo?: string;
|
|
59
|
+
/** Release tag 前缀(完整形态 `<tagPrefix>v<X.Y.Z>`);缺省 `<slug>-` */
|
|
60
|
+
tagPrefix?: string;
|
|
61
|
+
/** Release 资产前缀(`<slug>-<end>-v<version>.zip`);缺省 = 插件 id 末段 */
|
|
62
|
+
slug?: string;
|
|
63
|
+
}
|
|
47
64
|
/** 插件描述文件结构 */
|
|
48
65
|
interface PluginManifest {
|
|
49
66
|
id: string;
|
|
@@ -70,6 +87,13 @@ interface PluginManifest {
|
|
|
70
87
|
preauthDirs?: string[];
|
|
71
88
|
/** 外网访问预授权 URL 声明(Egress L2 glob:`[scheme://][*.]host[:port][/path-prefix]`) */
|
|
72
89
|
preauthUrls?: string[];
|
|
90
|
+
/**
|
|
91
|
+
* 应用更新源声明(manifest `update`;缺省 = 不参与更新检查)
|
|
92
|
+
*
|
|
93
|
+
* 宿主按本段解析 GitHub 发布仓 / tag 前缀 / 资产 slug;缺省字段收敛到官方
|
|
94
|
+
* 应用仓命名约定。第三方应用可声明自己的 repo / tagPrefix / slug。
|
|
95
|
+
*/
|
|
96
|
+
update?: PluginUpdateDecl;
|
|
73
97
|
}
|
|
74
98
|
/** 移动端扩展点声明 */
|
|
75
99
|
interface MobilePluginContributes {
|
|
@@ -172,13 +196,41 @@ interface ShellSurfaceContribution {
|
|
|
172
196
|
/** 应用自带主题色(仅作用于应用内部,绝不写回平台 token) */
|
|
173
197
|
accent?: string;
|
|
174
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* 应用内入口意图(宿主 → 本应用运行面)
|
|
201
|
+
*
|
|
202
|
+
* 宿主**不解释** `key` / `payload`:只负责把应用给的意图原样投递给同一应用的
|
|
203
|
+
* 运行面(`context.ui.onSurfaceIntent`)。载荷留在同进程,不做序列化,可传任意
|
|
204
|
+
* 对象;形状与含义全归应用自持(宿主判据 B1–B6 均不命中)。
|
|
205
|
+
*/
|
|
206
|
+
interface ShellSurfaceIntent {
|
|
207
|
+
/** 应用自定义入口键(如 'session' / 'settings') */
|
|
208
|
+
key: string;
|
|
209
|
+
/** 应用自定义载荷(宿主不读取、不复制) */
|
|
210
|
+
payload?: unknown;
|
|
211
|
+
}
|
|
175
212
|
/** 宿主壳首页快捷卡片(应用自持内容,如「N 个活跃会话」) */
|
|
176
213
|
interface ShellSlotContribution {
|
|
177
214
|
id: string;
|
|
178
|
-
/**
|
|
215
|
+
/**
|
|
216
|
+
* 卡片组件;壳透传 { app } prop。
|
|
217
|
+
*
|
|
218
|
+
* 卡片外观建议用 `@binblink/wasmnest-plugin-sdk-mobile/ui/quick-card` 的
|
|
219
|
+
* QuickCard(与宿主 token / 字号 / 明暗一致)。壳把整张卡渲染成按钮并负责
|
|
220
|
+
* 点击打开本应用——卡片内不得再放按钮 / 链接(嵌套交互会抢点击)。
|
|
221
|
+
* 宿主按自身展示上限截断(当前取注册顺序前若干张并自动轮播)。
|
|
222
|
+
*/
|
|
179
223
|
component: any;
|
|
180
224
|
/** 排序权重,小者靠前;缺省 100 */
|
|
181
225
|
order?: number;
|
|
226
|
+
/**
|
|
227
|
+
* 点击卡片时应用要进入的内部位置(按**点击时刻**现算,可随数据变化)。
|
|
228
|
+
*
|
|
229
|
+
* 宿主照常「启动并打开本应用」,再把返回值经 `context.ui.onSurfaceIntent`
|
|
230
|
+
* 投递给运行面;返回 null / undefined = 只打开应用(旧行为)。卡片内仍不得
|
|
231
|
+
* 自带交互——本回调就是卡片点击的唯一出口,宿主按钮才是点击落点。
|
|
232
|
+
*/
|
|
233
|
+
onPress?: () => ShellSurfaceIntent | null | undefined;
|
|
182
234
|
}
|
|
183
235
|
/** 宿主壳胶囊菜单附加项(平台项 order:权限 10 / 停用 30,应用用中间值插入) */
|
|
184
236
|
interface ShellCapsuleItem {
|
|
@@ -204,6 +256,17 @@ interface MobileDeviceTarget {
|
|
|
204
256
|
port: number;
|
|
205
257
|
name?: string;
|
|
206
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* `connectDevice` 行为选项。
|
|
261
|
+
*
|
|
262
|
+
* `pairingOnly`:只把目标写入连接引擎 / 设好 HTTP base(供后续 `/api/auth/*`
|
|
263
|
+
* 配对请求使用),**不**先探测 `/api/health`。首次经隧道配对时探测会消费掉
|
|
264
|
+
* 一次性配对票据(隧道准入先放行再判 403),随后真正的认证请求反而无票可用;
|
|
265
|
+
* 因此配对流程必须用本模式,认证成功后再走普通 `connectDevice`。
|
|
266
|
+
*/
|
|
267
|
+
interface MobileConnectOptions {
|
|
268
|
+
pairingOnly?: boolean;
|
|
269
|
+
}
|
|
207
270
|
/** 连接历史条目(宿主连接域引擎事实) */
|
|
208
271
|
interface MobileConnectionHistoryItem {
|
|
209
272
|
address: string;
|
|
@@ -257,7 +320,10 @@ interface MobileHttpRequestOptions {
|
|
|
257
320
|
body?: any;
|
|
258
321
|
headers?: Record<string, string>;
|
|
259
322
|
}
|
|
260
|
-
/** 终端输出流句柄(openTerminalStream 返回;dispose =
|
|
323
|
+
/** 终端输出流句柄(openTerminalStream 返回;dispose = 注销本代页面通道)
|
|
324
|
+
*
|
|
325
|
+
* 注销携带登记时拿到的页面令牌:同一会话重复 open 时,旧句柄的 dispose 不会
|
|
326
|
+
* 摘掉新通道(宿主按令牌只摘当前代)。 */
|
|
261
327
|
interface TerminalStreamHandle {
|
|
262
328
|
dispose(): void;
|
|
263
329
|
}
|
|
@@ -326,8 +392,11 @@ interface MobileHostApi {
|
|
|
326
392
|
currentDevice: vue.Ref<MobileDeviceTarget | null>;
|
|
327
393
|
/** 连接历史(此前尝试连接过的桌面端端点;宿主连接域引擎事实) */
|
|
328
394
|
connectionHistory: vue.Ref<MobileConnectionHistoryItem[]>;
|
|
329
|
-
/** 建立到目标桌面的连接(HTTP base url 探测 + WS 事件通道建链;宿主引擎动作)
|
|
330
|
-
|
|
395
|
+
/** 建立到目标桌面的连接(HTTP base url 探测 + WS 事件通道建链;宿主引擎动作)
|
|
396
|
+
*
|
|
397
|
+
* `pairingOnly=true`:仅设置目标(不探测),供首次配对/扫码先走 `/api/auth/*`;
|
|
398
|
+
* 认证成功后再调用默认模式建立事件通道。 */
|
|
399
|
+
connectDevice(device: MobileDeviceTarget, options?: MobileConnectOptions): Promise<void>;
|
|
331
400
|
/** 取消进行中的连接 */
|
|
332
401
|
cancelConnection(): Promise<void>;
|
|
333
402
|
/** 用宿主持有的凭据静默换新 JWT(返回用户免配对;凭据零过境,插件拿不到 token)
|
|
@@ -516,6 +585,14 @@ interface UIRegistry {
|
|
|
516
585
|
registerSurface(surface: ShellSurfaceContribution): Disposable;
|
|
517
586
|
/** 宿主壳首页快捷卡片(应用自持内容;壳 Home 屏渲染,appId 由宿主代填) */
|
|
518
587
|
registerSlot(slot: ShellSlotContribution): Disposable;
|
|
588
|
+
/**
|
|
589
|
+
* 订阅宿主投递的应用内入口意图(快捷卡片点击等;载荷由应用自持)。
|
|
590
|
+
*
|
|
591
|
+
* 订阅**之前**到达的意图由宿主按 appId 排队,订阅时按序补投(运行面晚于
|
|
592
|
+
* 点击创建时不会丢);应用停用 / 卸载 / 运行面销毁时队列清空,旧意图不会在
|
|
593
|
+
* 下一次打开时突然生效。Disposable.dispose = 取消订阅。
|
|
594
|
+
*/
|
|
595
|
+
onSurfaceIntent(handler: (intent: ShellSurfaceIntent) => void): Disposable;
|
|
519
596
|
/** 宿主壳胶囊菜单附加项(appId 由宿主代填) */
|
|
520
597
|
registerCapsuleItem(item: ShellCapsuleItem): Disposable;
|
|
521
598
|
/** 动态注册插件路由(宿主 addRoute 至 /mobile/plugins/{pluginId}/{id};Disposable.dispose = removeRoute 撤销) */
|
|
@@ -600,6 +677,28 @@ interface LifecycleAPI {
|
|
|
600
677
|
onSessionCreated(handler: (sessionId: string) => void): Disposable;
|
|
601
678
|
onSessionStopped(handler: (sessionId: string) => void): Disposable;
|
|
602
679
|
}
|
|
680
|
+
/** 应用更新检查的拒绝 / 失败原因(展示层按 key 翻译;params 只承载版本号等非技术值) */
|
|
681
|
+
interface AppUpdateReason {
|
|
682
|
+
key: string;
|
|
683
|
+
params?: Record<string, string>;
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* 应用更新检查结果(宿主默认实现返回;SDK 默认设置卡直接展示)
|
|
687
|
+
*
|
|
688
|
+
* 宿主侧已经完成「取 Release → 校验身份/完整性 → 兼容性判定」,插件只消费状态。
|
|
689
|
+
* `available` 表示有新版本且兼容;`incompatible` 只给原因,绝不提供更新动作。
|
|
690
|
+
*/
|
|
691
|
+
interface AppUpdateCheckResult {
|
|
692
|
+
status: 'idle' | 'checking' | 'up-to-date' | 'available' | 'incompatible' | 'error';
|
|
693
|
+
latestVersion?: string;
|
|
694
|
+
currentVersion?: string;
|
|
695
|
+
reason?: AppUpdateReason;
|
|
696
|
+
}
|
|
697
|
+
/** 应用更新能力(宿主默认实现;appId 与凭据已由宿主绑定) */
|
|
698
|
+
interface AppUpdateAPI {
|
|
699
|
+
/** 检查本应用更新;失败已由宿主归一化为 `status: 'error'`,不抛技术错误 */
|
|
700
|
+
check(): Promise<AppUpdateCheckResult>;
|
|
701
|
+
}
|
|
603
702
|
/** 插件上下文 */
|
|
604
703
|
interface PluginContext {
|
|
605
704
|
readonly id: string;
|
|
@@ -619,6 +718,8 @@ interface PluginContext {
|
|
|
619
718
|
readonly system: SystemAPI;
|
|
620
719
|
/** 生命周期状态上报(启用成功/失败) */
|
|
621
720
|
readonly status: StatusAPI;
|
|
721
|
+
/** 应用更新检查(宿主统一默认实现;可选——旧宿主 / dev-shell 可不提供) */
|
|
722
|
+
readonly appUpdate?: AppUpdateAPI;
|
|
622
723
|
readonly _disposables: Disposable[];
|
|
623
724
|
}
|
|
624
725
|
/** 插件入口模块约定 */
|
|
@@ -634,4 +735,4 @@ interface PluginModule {
|
|
|
634
735
|
devMock?: PluginDevMock;
|
|
635
736
|
}
|
|
636
737
|
|
|
637
|
-
export type { CommandContribution, CommandRegistry, ConfigProperty, DialogAPI, DialogOptions, DialogResult, Disposable, EventAPI, I18nAPI, LifecycleAPI, LifecycleContribution, LoggerAPI, MobileBiometricKeyStatus, MobileConnectionHistoryItem, MobileConnectionStatus, MobileDeviceTarget, MobileHostApi, MobileHostConnectionEvent, MobileHostSessionEvent, MobileHttpRequestOptions, MobileHttpResult, MobileMdnsService, MobilePluginContributes, MonitorPanelContribution, MonitorPanelEnv, MonitorPanelHandle, MountMonitorPanel, NavTabContribution, NotificationAPI, PluginConfiguration, PluginContext, PluginDevMock, PluginDialogAction, PluginDialogHandle, PluginDialogOptions, PluginManifest, PluginModule, PluginPlatform, PluginRouteDescriptor, PluginState, PluginType, RouteContribution, SessionAPI, SettingsContribution, ShellCapsuleItem, ShellSlotContribution, ShellSurfaceContribution, StatusAPI, StorageAPI, SystemAPI, TerminalContribution, TerminalStreamHandle, TerminalToolbarItemContribution, UIRegistry, ViewContribution };
|
|
738
|
+
export type { AppUpdateAPI, AppUpdateCheckResult, AppUpdateReason, CommandContribution, CommandRegistry, ConfigProperty, DialogAPI, DialogOptions, DialogResult, Disposable, EventAPI, I18nAPI, LifecycleAPI, LifecycleContribution, LoggerAPI, MobileBiometricKeyStatus, MobileConnectOptions, MobileConnectionHistoryItem, MobileConnectionStatus, MobileDeviceTarget, MobileHostApi, MobileHostConnectionEvent, MobileHostSessionEvent, MobileHttpRequestOptions, MobileHttpResult, MobileMdnsService, MobilePluginContributes, MonitorPanelContribution, MonitorPanelEnv, MonitorPanelHandle, MountMonitorPanel, NavTabContribution, NotificationAPI, PluginConfiguration, PluginContext, PluginDevMock, PluginDialogAction, PluginDialogHandle, PluginDialogOptions, PluginManifest, PluginModule, PluginPlatform, PluginRouteDescriptor, PluginState, PluginType, PluginUpdateDecl, RouteContribution, SessionAPI, SettingsContribution, ShellCapsuleItem, ShellSlotContribution, ShellSurfaceContribution, ShellSurfaceIntent, StatusAPI, StorageAPI, SystemAPI, TerminalContribution, TerminalStreamHandle, TerminalToolbarItemContribution, UIRegistry, ViewContribution };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@binblink/wasmnest-plugin-sdk-mobile",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -42,6 +42,14 @@
|
|
|
42
42
|
"types": "./src/ui/Select.d.ts",
|
|
43
43
|
"import": "./src/ui/Select.vue"
|
|
44
44
|
},
|
|
45
|
+
"./ui/quick-card": {
|
|
46
|
+
"types": "./src/ui/QuickCard.d.ts",
|
|
47
|
+
"import": "./src/ui/QuickCard.vue"
|
|
48
|
+
},
|
|
49
|
+
"./ui/app-update": {
|
|
50
|
+
"types": "./src/ui/AppUpdateSection.d.ts",
|
|
51
|
+
"import": "./src/ui/AppUpdateSection.vue"
|
|
52
|
+
},
|
|
45
53
|
"./ui/plugin-global-dialog": {
|
|
46
54
|
"types": "./src/ui/plugin-global-dialog.d.ts",
|
|
47
55
|
"import": "./src/ui/PluginGlobalDialog.vue"
|
package/src/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ export type {
|
|
|
9
9
|
PluginType,
|
|
10
10
|
PluginState,
|
|
11
11
|
PluginManifest,
|
|
12
|
+
PluginUpdateDecl,
|
|
12
13
|
PluginConfiguration,
|
|
13
14
|
ConfigProperty,
|
|
14
15
|
MobilePluginContributes,
|
|
@@ -25,6 +26,7 @@ export type {
|
|
|
25
26
|
PluginRouteDescriptor,
|
|
26
27
|
ShellSurfaceContribution,
|
|
27
28
|
ShellSlotContribution,
|
|
29
|
+
ShellSurfaceIntent,
|
|
28
30
|
ShellCapsuleItem,
|
|
29
31
|
PluginDialogAction,
|
|
30
32
|
PluginDialogOptions,
|
|
@@ -46,6 +48,9 @@ export type {
|
|
|
46
48
|
PluginDevMock,
|
|
47
49
|
PluginContext,
|
|
48
50
|
PluginModule,
|
|
51
|
+
AppUpdateReason,
|
|
52
|
+
AppUpdateCheckResult,
|
|
53
|
+
AppUpdateAPI,
|
|
49
54
|
MobileHttpResult,
|
|
50
55
|
MobileHttpRequestOptions,
|
|
51
56
|
MobileHostApi,
|
|
@@ -85,3 +90,7 @@ export type {
|
|
|
85
90
|
OpenGlobalDialogInput,
|
|
86
91
|
GlobalDialogHandleOutput,
|
|
87
92
|
} from './global-dialog'
|
|
93
|
+
|
|
94
|
+
// 应用更新检查(SDK 默认实现;宿主统一 GitHub Release 判定)
|
|
95
|
+
export { useAppUpdate } from './update'
|
|
96
|
+
export type { AppUpdateStatus, UseAppUpdate, UseAppUpdateOptions } from './update'
|