@binblink/wasmnest-plugin-sdk-mobile 0.0.0-stage → 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.
Files changed (122) hide show
  1. package/README.md +439 -2
  2. package/README_en.md +415 -0
  3. package/bin/build.js +271 -0
  4. package/bin/cli.js +96 -0
  5. package/bin/lib.js +349 -0
  6. package/bin/manifest-gen.js +327 -0
  7. package/bin/package.js +151 -0
  8. package/bin/scaffold.js +299 -0
  9. package/dev-shell/README.md +151 -0
  10. package/dev-shell/index.html +27 -0
  11. package/dev-shell/package.json +27 -0
  12. package/dev-shell/pnpm-workspace.yaml +9 -0
  13. package/dev-shell/postcss.config.js +6 -0
  14. package/dev-shell/src/App.vue +90 -0
  15. package/dev-shell/src/apps/mock-terminal/MockTerminalSlotCard.vue +43 -0
  16. package/dev-shell/src/apps/mock-terminal/MockTerminalView.vue +168 -0
  17. package/dev-shell/src/apps/mock-terminal/index.ts +50 -0
  18. package/dev-shell/src/components/DevToolbar.vue +100 -0
  19. package/dev-shell/src/components/DialogHost.vue +119 -0
  20. package/dev-shell/src/components/LogPanel.vue +80 -0
  21. package/dev-shell/src/i18n.ts +22 -0
  22. package/dev-shell/src/loader.ts +239 -0
  23. package/dev-shell/src/locale.ts +29 -0
  24. package/dev-shell/src/locales/en-shell.ts +332 -0
  25. package/dev-shell/src/locales/index.ts +70 -0
  26. package/dev-shell/src/locales/shell.ts +331 -0
  27. package/dev-shell/src/main.ts +58 -0
  28. package/dev-shell/src/mock/dialog-service.ts +58 -0
  29. package/dev-shell/src/mock/file-transfer.ts +390 -0
  30. package/dev-shell/src/mock/mobile-api.ts +369 -0
  31. package/dev-shell/src/mock/preset-tasks.ts +186 -0
  32. package/dev-shell/src/mock/session.ts +121 -0
  33. package/dev-shell/src/mock-context.ts +374 -0
  34. package/dev-shell/src/registry.ts +151 -0
  35. package/dev-shell/src/shared-runtime.ts +44 -0
  36. package/dev-shell/src/shell/ShellView.vue +52 -0
  37. package/dev-shell/src/shell/adapters/devAppSource.ts +144 -0
  38. package/dev-shell/src/shell/components/PluginContextHost.vue +40 -0
  39. package/dev-shell/src/shell/components/ShellAppCell.vue +75 -0
  40. package/dev-shell/src/shell/components/ShellAppIcon.vue +111 -0
  41. package/dev-shell/src/shell/components/ShellAppSurface.vue +46 -0
  42. package/dev-shell/src/shell/components/ShellBrandTile.vue +27 -0
  43. package/dev-shell/src/shell/components/ShellCapsuleMenu.vue +123 -0
  44. package/dev-shell/src/shell/components/ShellChip.vue +49 -0
  45. package/dev-shell/src/shell/components/ShellGroupCard.vue +17 -0
  46. package/dev-shell/src/shell/components/ShellHost.vue +75 -0
  47. package/dev-shell/src/shell/components/ShellNotificationShade.vue +501 -0
  48. package/dev-shell/src/shell/components/ShellPermissionPrompt.vue +127 -0
  49. package/dev-shell/src/shell/components/ShellPlaceholderSurface.vue +33 -0
  50. package/dev-shell/src/shell/components/ShellSection.vue +27 -0
  51. package/dev-shell/src/shell/components/ShellSheet.vue +74 -0
  52. package/dev-shell/src/shell/components/ShellStatusbar.vue +84 -0
  53. package/dev-shell/src/shell/components/screens/PluginRoutePage.vue +98 -0
  54. package/dev-shell/src/shell/components/screens/ShellAppDetailScreen.vue +359 -0
  55. package/dev-shell/src/shell/components/screens/ShellAppRunScreen.vue +90 -0
  56. package/dev-shell/src/shell/components/screens/ShellAppsScreen.vue +195 -0
  57. package/dev-shell/src/shell/components/screens/ShellHomeScreen.vue +357 -0
  58. package/dev-shell/src/shell/components/screens/ShellPermissionsScreen.vue +376 -0
  59. package/dev-shell/src/shell/components/screens/ShellSettingsScreen.vue +240 -0
  60. package/dev-shell/src/shell/components/screens/ShellSwitcherScreen.vue +559 -0
  61. package/dev-shell/src/shell/components/ui/ConfirmDialog.vue +137 -0
  62. package/dev-shell/src/shell/components/ui/Toggle.vue +53 -0
  63. package/dev-shell/src/shell/composables/useShellApps.ts +417 -0
  64. package/dev-shell/src/shell/composables/useShellNavigation.ts +197 -0
  65. package/dev-shell/src/shell/composables/useShellNotifications.ts +115 -0
  66. package/dev-shell/src/shell/composables/useShellOpen.ts +44 -0
  67. package/dev-shell/src/shell/composables/useShellOverlays.ts +101 -0
  68. package/dev-shell/src/shell/composables/useShellPreferences.ts +143 -0
  69. package/dev-shell/src/shell/composables/useShellRecent.ts +84 -0
  70. package/dev-shell/src/shell/composables/useSlotCarousel.ts +238 -0
  71. package/dev-shell/src/shell/composables/useToast.ts +33 -0
  72. package/dev-shell/src/shell/index.ts +88 -0
  73. package/dev-shell/src/shell/logger.ts +45 -0
  74. package/dev-shell/src/shell/permissions.ts +145 -0
  75. package/dev-shell/src/shell/registry.ts +220 -0
  76. package/dev-shell/src/shell/slotCards.ts +47 -0
  77. package/dev-shell/src/shell/styles/shell.css +1155 -0
  78. package/dev-shell/src/shell/surfaceIntent.ts +107 -0
  79. package/dev-shell/src/shell/types.ts +152 -0
  80. package/dev-shell/src/shell/utils.ts +54 -0
  81. package/dev-shell/src/styles/main.css +153 -0
  82. package/dev-shell/src/styles/mobile.css +981 -0
  83. package/dev-shell/src/styles/wallpaper.css +130 -0
  84. package/dev-shell/src/theme.ts +71 -0
  85. package/dev-shell/src/vite-env.d.ts +20 -0
  86. package/dev-shell/tailwind.config.js +101 -0
  87. package/dev-shell/tsconfig.json +16 -0
  88. package/dev-shell/vite.config.ts +130 -0
  89. package/dist/index.d.ts +124 -0
  90. package/dist/index.js +229 -0
  91. package/dist/types.d.ts +738 -0
  92. package/dist/types.js +0 -0
  93. package/dist/vite-plugin.d.ts +16 -0
  94. package/dist/vite-plugin.js +95 -0
  95. package/package.json +88 -3
  96. package/src/constants.ts +6 -0
  97. package/src/global-dialog.ts +168 -0
  98. package/src/index.ts +96 -0
  99. package/src/runtime.ts +44 -0
  100. package/src/types.ts +822 -0
  101. package/src/ui/AppUpdateSection.d.ts +44 -0
  102. package/src/ui/AppUpdateSection.vue +253 -0
  103. package/src/ui/PluginGlobalDialog.vue +388 -0
  104. package/src/ui/QuickCard.d.ts +33 -0
  105. package/src/ui/QuickCard.vue +167 -0
  106. package/src/ui/Select.d.ts +37 -0
  107. package/src/ui/Select.vue +307 -0
  108. package/src/ui/plugin-global-dialog.d.ts +11 -0
  109. package/src/ui/useSwipeTabs.d.ts +20 -0
  110. package/src/ui/useSwipeTabs.ts +53 -0
  111. package/src/update.ts +123 -0
  112. package/src/vite-plugin.ts +132 -0
  113. package/template/.gitignore +4 -0
  114. package/template/README.md +46 -0
  115. package/template/package.json +23 -0
  116. package/template/plugin.json +13 -0
  117. package/template/rust/Cargo.toml +19 -0
  118. package/template/rust/src/lib.rs +33 -0
  119. package/template/src/env.d.ts +24 -0
  120. package/template/src/index.ts +37 -0
  121. package/template/tsconfig.json +17 -0
  122. package/template/vite.config.ts +21 -0
@@ -0,0 +1,239 @@
1
+ /**
2
+ * 调试对象加载器(dev-shell 版)
3
+ * -----------------------------------------------------------------------------
4
+ * 加载两类调试对象,**同一条路径**:
5
+ * ① 内置应用「模拟终端」(`src/apps/mock-terminal/`)——自带 manifest + activate
6
+ * ② 被调试插件(`virtual:dev-plugins`,vite 已解析入口与 plugin.json)
7
+ *
8
+ * 之所以统一:新宿主壳的核心形态是「应用自持运行面,壳只挂载」,预览环境里若内置页
9
+ * 走另一条路(壳自己的一页),开发者就无法在 dev-shell 里验证壳的挂载路径是否成立。
10
+ *
11
+ * 加载流程:登记记录 → 建 mock context(先于 activate)→ activate() → 置状态;
12
+ * 失败置 Error 并记日志(错误留在应用列表上可见,不静默吞掉)。
13
+ * 全部加载完成后发射 appStartup 生命周期事件(与宿主一致)。
14
+ */
15
+ import { reactive, ref } from 'vue'
16
+ import type { PluginContext, PluginModule } from '../../src/types'
17
+ import { createMockContext } from './mock-context'
18
+ import { emitDevEvent } from './mock/session'
19
+ import { registerFileTransferMock, disposeFileTransferMock } from './mock/file-transfer'
20
+ import {
21
+ getDevMock,
22
+ getPluginRecord,
23
+ plugins,
24
+ pushLog,
25
+ registerDevMock,
26
+ type DevPluginRecord,
27
+ } from './registry'
28
+ import * as mockTerminal from './apps/mock-terminal'
29
+
30
+ export const ready = ref(false)
31
+
32
+ /** 在给定记录上跑一遍激活(建 context → 登记领域数据 → 调 activate) */
33
+ function runActivate(record: DevPluginRecord, module: PluginModule | null): void {
34
+ const context: PluginContext = createMockContext(record.id)
35
+ record.context = context
36
+ try {
37
+ if (module?.devMock) {
38
+ record.devMockDisposable = registerDevMock(record.id, module.devMock)
39
+ pushLog('info', record.id, '已注册 devMock(领域种子数据)')
40
+ }
41
+ // 对等/传输域 mock(纯通用接线:仅当 devMock 含对应种子子域才注入,不感知插件身份)
42
+ const devMockSeed = module?.devMock
43
+ if (devMockSeed?.peer || devMockSeed?.transfer) {
44
+ registerFileTransferMock(context, devMockSeed, record.id)
45
+ pushLog('info', record.id, '已注册领域命令 mock(通用接线,种子来自 devMock)')
46
+ }
47
+ record.entry = module
48
+ if (module && typeof module.activate === 'function') {
49
+ void module.activate(context)
50
+ } else if (!module) {
51
+ // 内置应用:activate 同步执行(无 WASM 后端,无异步初始化)
52
+ mockTerminal.activate(context)
53
+ }
54
+ record.state = 'activated'
55
+ record.error = undefined
56
+ pushLog('info', record.id, 'activate() 成功')
57
+ } catch (e: any) {
58
+ record.state = 'error'
59
+ record.error = e?.message || String(e)
60
+ pushLog('error', record.id, `activate() 失败: ${record.error}`)
61
+ }
62
+ }
63
+
64
+ /** 新建记录并激活(首屏加载调试对象时用) */
65
+ function activateRecord(record: DevPluginRecord, module: PluginModule | null): void {
66
+ plugins.value.push(record)
67
+ runActivate(record, module)
68
+ }
69
+
70
+ /**
71
+ * 复用已有记录重新激活(停用后再启动走这里)
72
+ *
73
+ * 刻意**不新建记录**:同 id 出现两条记录后,`getPluginRecord` 会命中先注册的那条
74
+ * (停用态、持有已释放的 context),插件组件 inject 到过期上下文,且应用列表里
75
+ * 同一个应用会显示两行。复用是最小改动,也与「记录即该应用的持有者」一致。
76
+ */
77
+ function reviveRecord(
78
+ existing: DevPluginRecord,
79
+ fresh: DevPluginRecord,
80
+ module: PluginModule | null,
81
+ ): void {
82
+ existing.name = fresh.name
83
+ existing.manifest = fresh.manifest
84
+ runActivate(existing, module)
85
+ }
86
+
87
+ /** 内置应用记录(与应用记录同构,只多了 builtin 标记) */
88
+ function makeBuiltinRecord(): DevPluginRecord {
89
+ return reactive({
90
+ id: mockTerminal.MOCK_TERMINAL_ID,
91
+ name: mockTerminal.MOCK_TERMINAL_MANIFEST.name,
92
+ manifest: mockTerminal.MOCK_TERMINAL_MANIFEST,
93
+ entry: null,
94
+ state: 'loaded' as const,
95
+ context: null,
96
+ builtin: true,
97
+ })
98
+ }
99
+
100
+ /**
101
+ * 启动单个调试对象(幂等:已激活的跳过)
102
+ *
103
+ * 壳的「启动应用」动作经 `shell/adapters/devAppSource.ts` 落到这里——停用后再启动
104
+ * 就是重新跑一次 activate,与被调试插件的行为一致。
105
+ */
106
+ export async function activatePlugin(pluginId: string): Promise<void> {
107
+ const existing = getPluginRecord(pluginId)
108
+ if (existing?.state === 'activated') return
109
+ // 非「已停用」态先走一遍对称拆解(释放旧订阅与监听);「已停用」态已拆过,
110
+ // 再拆一次是空转——deactivatePlugin 对它直接早退
111
+ if (existing && existing.state !== 'deactivated') {
112
+ await deactivatePlugin(pluginId)
113
+ }
114
+ if (pluginId === mockTerminal.MOCK_TERMINAL_ID) {
115
+ const fresh = makeBuiltinRecord()
116
+ if (existing) reviveRecord(existing, fresh, null)
117
+ else activateRecord(fresh, null)
118
+ return
119
+ }
120
+ const specs = await loadSpecs()
121
+ const spec = specs.find((s) => s.id === pluginId)
122
+ if (!spec) {
123
+ pushLog('error', pluginId, 'activatePlugin: 未找到该调试对象(可能已从工程中移除)')
124
+ return
125
+ }
126
+ const fresh = makeRecord(spec)
127
+ if (existing) reviveRecord(existing, fresh, spec.module)
128
+ else activateRecord(fresh, spec.module)
129
+ }
130
+
131
+ /** 载入被调试插件清单(vite 虚拟模块,缓存以免重复 import) */
132
+ let specsPromise: Promise<DevSpec[]> | null = null
133
+
134
+ interface DevSpec {
135
+ id: string
136
+ name: string
137
+ manifest: Record<string, unknown>
138
+ module: PluginModule
139
+ }
140
+
141
+ function loadSpecs(): Promise<DevSpec[]> {
142
+ if (!specsPromise) {
143
+ specsPromise = (async () => {
144
+ const records = (await import('virtual:dev-plugins')).default as Array<{
145
+ dir: string
146
+ manifest: Record<string, unknown>
147
+ entry: any
148
+ }>
149
+ return records.map((spec, index) => {
150
+ const manifest = (spec.manifest && spec.manifest.id ? spec.manifest : {}) as Record<string, unknown>
151
+ const id = typeof manifest.id === 'string' ? manifest.id : `dev-plugin-${index}`
152
+ const name = typeof manifest.name === 'string' ? manifest.name : id
153
+ pushLog('info', id, `发现被调试插件(${spec.dir})`)
154
+ return { id, name, manifest, module: spec.entry as PluginModule }
155
+ })
156
+ })()
157
+ }
158
+ return specsPromise
159
+ }
160
+
161
+ function makeRecord(spec: DevSpec): DevPluginRecord {
162
+ return reactive({
163
+ id: spec.id,
164
+ name: spec.name,
165
+ manifest: spec.manifest,
166
+ entry: spec.module,
167
+ state: 'loaded' as const,
168
+ context: null,
169
+ })
170
+ }
171
+
172
+ /** 激活全部调试对象(内置应用先行,被调试插件随后) */
173
+ export async function loadPlugins(): Promise<void> {
174
+ if (ready.value) return
175
+ try {
176
+ // ① 内置应用:保证壳在任何插件都未加载时也有一个形态正确的应用可渲染
177
+ activateRecord(makeBuiltinRecord(), null)
178
+
179
+ // ② 被调试插件
180
+ for (const spec of await loadSpecs()) {
181
+ if (plugins.value.some((p) => p.id === spec.id)) continue
182
+ activateRecord(makeRecord(spec), spec.module)
183
+ }
184
+ } catch (e: any) {
185
+ pushLog('error', 'dev-shell', `加载调试对象失败: ${e?.message || e}`)
186
+ }
187
+
188
+ // 与宿主一致:应用启动完成后再触发 onStartup 生命周期;
189
+ // 队列种子注入(mobileApi 无 pluginId,需等全部 devMock 注册完成后播种)
190
+ emitDevEvent('plugin:lifecycle:appStartup', {})
191
+ syncQueueSeedNow()
192
+ ready.value = true
193
+ }
194
+
195
+ /** 全部插件加载完成后同步队列种子(mobileApi 无 pluginId,惰性播种入口) */
196
+ export function syncQueueSeedNow(): void {
197
+ // 动态 import 避免 loader ↔ mock 循环依赖
198
+ void import('./mock/mobile-api').then((m) => m.syncQueueSeed())
199
+ }
200
+
201
+ /** 停用单个调试对象(dispose 全部资源 + 调用 deactivate) */
202
+ export async function deactivatePlugin(pluginId: string): Promise<void> {
203
+ const record = getPluginRecord(pluginId)
204
+ if (!record || record.state === 'deactivated') return
205
+ record.devMockDisposable?.dispose()
206
+ record.devMockDisposable = undefined
207
+ if (getDevMock(pluginId)?.peer || getDevMock(pluginId)?.transfer) disposeFileTransferMock()
208
+ const context = record.context as PluginContext | null
209
+ if (context) {
210
+ for (const d of [...context._disposables]) {
211
+ try {
212
+ d.dispose()
213
+ } catch (e) {
214
+ pushLog('warn', pluginId, `dispose 资源失败: ${e}`)
215
+ }
216
+ }
217
+ context._disposables.length = 0
218
+ }
219
+ const module = record.entry as PluginModule | null
220
+ try {
221
+ if (module && typeof module.deactivate === 'function') {
222
+ await module.deactivate()
223
+ } else if (!module && record.builtin) {
224
+ mockTerminal.deactivate()
225
+ }
226
+ } catch (e) {
227
+ pushLog('warn', pluginId, `deactivate() 失败: ${e}`)
228
+ }
229
+ record.state = 'deactivated'
230
+ pushLog('info', pluginId, '已停用')
231
+ }
232
+
233
+ /** 停用全部调试对象(页面卸载前调用) */
234
+ export async function deactivateAll(): Promise<void> {
235
+ for (const record of [...plugins.value]) {
236
+ await deactivatePlugin(record.id)
237
+ }
238
+ emitDevEvent('plugin:lifecycle:appShutdown', {})
239
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * 语言管理(与 theme.ts 同语义)
3
+ *
4
+ * - 支持 zh-CN / en,持久化到 localStorage
5
+ * - main.ts 创建 i18n 时读取持久化值,组件切换时写回
6
+ */
7
+ export type DevLocale = 'zh-CN' | 'en'
8
+
9
+ const LOCALE_KEY = 'wasmnest-dev-shell:locale'
10
+
11
+ /** 读取持久化语言(非法值回退默认 zh-CN) */
12
+ export function readSavedLocale(): DevLocale {
13
+ try {
14
+ const saved = localStorage.getItem(LOCALE_KEY)
15
+ if (saved === 'en' || saved === 'zh-CN') return saved
16
+ } catch {
17
+ // 隐私模式等场景使用默认 zh-CN
18
+ }
19
+ return 'zh-CN'
20
+ }
21
+
22
+ /** 保存语言选择(持久化失败静默忽略) */
23
+ export function saveLocale(next: DevLocale): void {
24
+ try {
25
+ localStorage.setItem(LOCALE_KEY, next)
26
+ } catch {
27
+ // 忽略持久化失败
28
+ }
29
+ }
@@ -0,0 +1,332 @@
1
+ /**
2
+ * Dev Shell 宿主壳文案 —— English
3
+ * -----------------------------------------------------------------------------
4
+ * 与宿主 `wasmnest-mobile/src/locales/en/shell.ts` 同键同义(措辞沿用宿主,
5
+ * 避免预览与真机两套说法)。宿主新增 key 时按 `dev-shell/__tests__/visualParity.test.ts`
6
+ * 之外的这份副本同步(本文件是 dev-shell 自有命名空间,不做逐字比对)。
7
+ *
8
+ * dev-shell 独有的 key 保留在既有段内并注明理由(主题档位 / 调试数据等浏览器环境专有面)。
9
+ *
10
+ * 新增 / 修改 key 必须同步 en/shell.ts(i18n 双语纪律)。
11
+ */
12
+ export const enShell = {
13
+ shell: {
14
+ common: {
15
+ loading: 'Loading…',
16
+ retry: 'Retry',
17
+ na: '—',
18
+ running: 'Running',
19
+ stopped: 'Stopped',
20
+ disabled: 'Disabled',
21
+ approval: 'Pending approval',
22
+ error: 'Failed to start',
23
+ cancel: 'Cancel',
24
+ active: 'Current',
25
+ back: 'Back'
26
+ },
27
+ home: {
28
+ localDevice: 'This device',
29
+ appCount: '{count} apps',
30
+ runningTitle: 'Running',
31
+ switchTo: 'Switch to {name}',
32
+ stopInstance: 'Stop',
33
+ slotsTitle: 'Quick cards',
34
+ slotOpen: 'Open {name}',
35
+ slotPause: 'Pause carousel',
36
+ slotPlay: 'Play carousel',
37
+ appsTitle: 'My WASM apps',
38
+ appsNote: '{count} installed',
39
+ manageApps: 'Manage apps',
40
+ appAria: '{name}, {state}',
41
+ emptyApps: 'No WASM app installed',
42
+ emptyAppsHint: 'Install or enable an app in "App manager" and its entry shows up here',
43
+ sysTitle: 'System',
44
+ sysApps: 'App manager',
45
+ sysPermissions: 'Permissions',
46
+ sysSettings: 'Settings'
47
+ },
48
+ apps: {
49
+ title: 'WASM apps',
50
+ subtitle: '{installed} installed · {running} running',
51
+ statInstalled: 'Installed',
52
+ statRunning: 'Running',
53
+ statSize: 'Total size',
54
+ installedTitle: 'Installed apps',
55
+ addTitle: 'Add app',
56
+ installLocal: 'Install local package (.wasm)',
57
+ installLocalHint: 'Approval required',
58
+ empty: 'No apps',
59
+ permissionCount: '{count} permissions',
60
+ installSuccess: 'Installed — approve and start it from the list',
61
+ installFailed: 'Install failed: {error}',
62
+ uninstallConfirm: 'Uninstall "{name}" and delete its data? This cannot be undone.',
63
+ uninstallSuccess: 'Uninstalled {name}',
64
+ uninstallFailed: 'Uninstall failed: {error}'
65
+ },
66
+ detail: {
67
+ title: 'App details',
68
+ back: 'Back',
69
+ official: 'Official',
70
+ approvalDesc: 'This app requests {count} permissions. Approve it before it can start — approving also pins the current file hashes.',
71
+ approveStart: 'Approve and start',
72
+ state: 'Runtime state',
73
+ permissions: 'Permissions',
74
+ permissionsNote: '{granted} granted · {locked} by default',
75
+ permissionsReadonly:
76
+ 'Permissions are declared by the app package and decided as a whole by the host; read-only here, cannot be changed per item.',
77
+ permissionLocked: 'Granted by default · cannot be changed',
78
+ permissionUnsupported: 'Per-permission toggles are not supported by the current backend',
79
+ storage: 'Storage',
80
+ appData: 'App data',
81
+ grants: 'Grant log',
82
+ grantsNote: 'Last 7 days',
83
+ grantsEmpty: 'No grant records',
84
+ disable: 'Disable app',
85
+ uninstall: 'Uninstall and delete data',
86
+ version: 'v{version}'
87
+ },
88
+ run: {
89
+ menu: 'App menu',
90
+ recents: 'Recents',
91
+ home: 'Back home',
92
+ noSurface: 'No interface available',
93
+ noSurfaceHint: 'This app does not provide a run surface yet',
94
+ notFound: 'App not found or uninstalled'
95
+ },
96
+ switcher: {
97
+ title: 'Recents',
98
+ back: 'Back',
99
+ countUnit: 'apps',
100
+ closeAll: 'Close all',
101
+ closeCard: 'Close the card for {name}',
102
+ dormant: 'Not running',
103
+ enterApp: 'Open {name}',
104
+ launchApp: 'Start {name}',
105
+ goHome: 'Back to home',
106
+ empty: 'Nothing to switch to',
107
+ emptyHint: 'Open an app from the home screen and it will show up here'
108
+ },
109
+ notify: {
110
+ title: 'Notifications',
111
+ count: '{count} items',
112
+ open: 'Open notifications ({count} items)',
113
+ close: 'Collapse notifications',
114
+ pending: 'Pending',
115
+ pendingNote: 'Waiting for your decision',
116
+ pendingBody: '{count} permissions awaiting approval',
117
+ pendingAction: 'Review',
118
+ list: 'Notifications',
119
+ listNote: '{count} items',
120
+ empty: 'No notifications',
121
+ emptyHint: 'App launches, connection state and pending approvals show up here',
122
+ clearAll: 'Clear all',
123
+ dismissOne: 'Dismiss notification: {title}',
124
+ openByTap: 'Tap to open {title}',
125
+ justNow: 'Just now',
126
+ minutesAgo: '{count} min ago',
127
+ hoursAgo: '{count} h ago',
128
+ daysAgo: '{count} d ago',
129
+ source: {
130
+ shell: 'Platform',
131
+ host: 'Connection'
132
+ },
133
+ connected: {
134
+ title: 'Connected to desktop',
135
+ body: 'Connection established and authenticated'
136
+ },
137
+ reconnected: {
138
+ title: 'Connection restored',
139
+ body: 'Automatic reconnect succeeded'
140
+ },
141
+ disconnected: {
142
+ title: 'Connection lost',
143
+ body: 'The link to the desktop was interrupted'
144
+ },
145
+ reauthRejected: {
146
+ title: 'Re-pairing required',
147
+ body: 'Credentials were rejected; pair again to reconnect'
148
+ },
149
+ app: {
150
+ started: {
151
+ title: '{name} started',
152
+ body: 'The app is running in the background'
153
+ },
154
+ stopped: {
155
+ title: '{name} stopped',
156
+ body: 'The app stopped; its data is kept'
157
+ },
158
+ approved: {
159
+ title: '{name} approved',
160
+ body: 'Permissions approved and content hash pinned'
161
+ },
162
+ installed: {
163
+ title: '{name} installed',
164
+ body: 'Approve it to start'
165
+ },
166
+ uninstalled: {
167
+ title: '{name} uninstalled',
168
+ body: 'The app and its data were deleted'
169
+ },
170
+ failed: {
171
+ title: '{name} failed to start',
172
+ body: 'Check the app details and retry'
173
+ }
174
+ }
175
+ },
176
+ settings: {
177
+ title: 'Settings',
178
+ platform: 'Platform',
179
+ appearance: 'Appearance',
180
+ appearanceHint: 'Theme and palette',
181
+ permissions: 'Permission overview',
182
+ permissionsHint: 'Group apps by permission',
183
+ about: 'About WasmApp',
184
+ runtime: 'WasmApp Mobile {version}',
185
+ devShellHint: 'Browser debug environment · WASM backend does not run here',
186
+ language: 'Language',
187
+ debugObjects: 'Debug objects',
188
+ debugObjectsHint: '{count} objects · {running} running',
189
+ devData: 'Debug data',
190
+ clearDevData: 'Clear debug data',
191
+ clearDevDataHint: 'Clears dev-shell localStorage keys (plugin storage, recents, language) and reloads. This cannot be undone.',
192
+ clearDevDataDone: 'Cleared {count} debug entries, reloading…'
193
+ },
194
+ permissions: {
195
+ pending: 'Pending approval',
196
+ pendingNote: 'Waiting for your decision',
197
+ pendingBody: '{count} permissions awaiting approval',
198
+ approveStart: 'Approve and start',
199
+ approveFailed: 'Approval failed; check the app details',
200
+ viewSwitch: 'Permission overview view',
201
+ viewApps: 'By app',
202
+ viewGroups: 'By permission',
203
+ appSection: 'App permissions',
204
+ appSummary: '{granted} granted',
205
+ appSummaryLocked: '{granted} granted · {locked} default',
206
+ appNone: 'No permissions',
207
+ granted: 'Granted',
208
+ locked: 'Default',
209
+ ungranted: 'Not granted'
210
+ },
211
+ capsule: {
212
+ title: 'App',
213
+ permissions: 'Permission settings',
214
+ about: 'About this app',
215
+ disable: 'Disable this app'
216
+ },
217
+ permissionPrompt: {
218
+ title: '{name} requests permissions',
219
+ purpose: 'Purpose: {reason}',
220
+ purposeUnknown: 'Purpose: not declared by the app',
221
+ deny: 'Deny',
222
+ allow: 'Allow',
223
+ fineprint: 'Denying disables the related feature; you can change it anytime in "Apps → {name} → Permissions".'
224
+ },
225
+ permission: {
226
+ group: {
227
+ terminal: 'Terminal & sessions',
228
+ data: 'Files & network',
229
+ device: 'Device & link',
230
+ system: 'System & monitoring',
231
+ interface: 'Interface & messaging',
232
+ other: 'Other'
233
+ },
234
+ perm: {
235
+ storage: {
236
+ title: 'Local Storage'
237
+ },
238
+ terminalOutput: {
239
+ title: 'Terminal Output Stream'
240
+ },
241
+ sessionRead: {
242
+ title: 'Session Read'
243
+ },
244
+ sessionWrite: {
245
+ title: 'Session Write'
246
+ },
247
+ uiToolbox: {
248
+ title: 'Toolbox UI'
249
+ },
250
+ uiNavtab: {
251
+ title: 'Nav Tab'
252
+ },
253
+ uiSettings: {
254
+ title: 'Settings Section'
255
+ },
256
+ uiInput: {
257
+ title: 'Input Assistant'
258
+ },
259
+ networkHttp: {
260
+ title: 'Network Requests'
261
+ },
262
+ fsRead: {
263
+ title: 'File Read'
264
+ },
265
+ fsWrite: {
266
+ title: 'File Write'
267
+ },
268
+ fsPick: {
269
+ title: 'File Picker'
270
+ },
271
+ fileservice: {
272
+ title: 'File Service'
273
+ },
274
+ transfer: {
275
+ title: 'File Transfer'
276
+ },
277
+ systemOpen: {
278
+ title: 'System Open'
279
+ },
280
+ bus: {
281
+ title: 'Message Bus'
282
+ },
283
+ broadcast: {
284
+ title: 'Broadcast'
285
+ },
286
+ mdns: {
287
+ title: 'LAN Discovery'
288
+ },
289
+ peer: {
290
+ title: 'Peer Connection'
291
+ },
292
+ wsClient: {
293
+ title: 'WebSocket Client'
294
+ },
295
+ auth: {
296
+ title: 'Authentication'
297
+ },
298
+ notify: {
299
+ title: 'Notifications'
300
+ },
301
+ uiRoute: {
302
+ title: 'Page Routing'
303
+ },
304
+ uiDialog: {
305
+ title: 'Dialogs'
306
+ },
307
+ uiBack: {
308
+ title: 'Back Key'
309
+ },
310
+ metricsRead: {
311
+ title: 'Runtime Metrics',
312
+ desc: 'Read-only metrics (counts and resource usage) for every loaded plugin; one grant covers all apps and can reveal activity patterns (side channel).'
313
+ }
314
+ }
315
+ },
316
+ mobile: {
317
+ plugin: {
318
+ noPermissions: 'No permissions requested'
319
+ }
320
+ }
321
+ }
322
+ };
323
+
324
+
325
+ /** dev-shell 专有文案(工具条 / 日志面板 / 内置应用 / 插件路由页) */
326
+ export const enDevShell = {
327
+ 'devshell.plugin.loadFailed': 'Plugin component not registered',
328
+ 'devshell.plugin.routeLoading': 'Loading',
329
+ 'devshell.terminal.queueMock': 'Queue(mock):',
330
+ 'devshell.terminal.queueEmpty': 'Empty',
331
+ 'devshell.terminal.queueClear': 'Clear',
332
+ }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Dev Shell 界面文案(zh-CN / en)
3
+ * -----------------------------------------------------------------------------
4
+ * 分三块聚合,职责各归各家:
5
+ * · `devshell.*` —— 工作台自身(工具条 / 日志面板 / 内置应用)
6
+ * · `shell.*` —— 宿主壳 UI(与宿主 `wasmnest-mobile/src/locales` 下的 shell 文案同键同义)
7
+ * · 内置应用的文案仍走 `devshell.terminal.*`(它是 dev-shell 的一部分,不是被调试插件)
8
+ *
9
+ * 已随宿主壳改造迁走的 key(旧三页签骨架:nav.terminal / nav.toolbox / nav.plugins /
10
+ * toolbox.* / plugins.* / back)整面删除——它们描述的界面已不存在,留着会让文案表
11
+ * 与实现脱节。
12
+ */
13
+ import { zhCNShell, zhCNDevShell } from './shell'
14
+ import { enShell, enDevShell } from './en-shell'
15
+
16
+ export const zhCN = {
17
+ 'devshell.logs.title': 'Dev Shell 日志',
18
+ 'devshell.logs.clear': '清空',
19
+ 'devshell.logs.empty': '暂无日志',
20
+ 'devshell.frame.toggle': '手机框',
21
+ 'devshell.frame.on': '手机框:开',
22
+ 'devshell.frame.off': '手机框:关',
23
+ 'devshell.theme.dark': '深色模式',
24
+ 'devshell.theme.light': '浅色模式',
25
+ 'devshell.theme.system': '跟随系统',
26
+ 'devshell.toolbar.noPlugins': '未加载插件',
27
+ 'devshell.terminal.title': '模拟终端',
28
+ 'devshell.terminal.sessions': '会话',
29
+ 'devshell.terminal.output': '输出',
30
+ 'devshell.terminal.inputPlaceholder': '输入命令(记录到模拟会话输入行)',
31
+ 'devshell.terminal.send': '发送',
32
+ 'devshell.terminal.simulateOutput': '模拟输出',
33
+ 'devshell.terminal.createSession': '新建会话',
34
+ 'devshell.terminal.stopSession': '停止会话',
35
+ 'devshell.terminal.connect': '连接',
36
+ 'devshell.terminal.disconnect': '断开',
37
+ 'devshell.terminal.authSuccess': '认证成功',
38
+ 'devshell.terminal.connected': '已连接',
39
+ 'devshell.terminal.disconnected': '未连接',
40
+ ...zhCNDevShell,
41
+ ...zhCNShell,
42
+ }
43
+
44
+ export const en = {
45
+ 'devshell.logs.title': 'Dev Shell Logs',
46
+ 'devshell.logs.clear': 'Clear',
47
+ 'devshell.logs.empty': 'No logs',
48
+ 'devshell.frame.toggle': 'Phone frame',
49
+ 'devshell.frame.on': 'Phone frame: on',
50
+ 'devshell.frame.off': 'Phone frame: off',
51
+ 'devshell.theme.dark': 'Dark Mode',
52
+ 'devshell.theme.light': 'Light Mode',
53
+ 'devshell.theme.system': 'Follow System',
54
+ 'devshell.toolbar.noPlugins': 'No plugin loaded',
55
+ 'devshell.terminal.title': 'Mock Terminal',
56
+ 'devshell.terminal.sessions': 'Sessions',
57
+ 'devshell.terminal.output': 'Output',
58
+ 'devshell.terminal.inputPlaceholder': 'Type a command (recorded in the mock session input log)',
59
+ 'devshell.terminal.send': 'Send',
60
+ 'devshell.terminal.simulateOutput': 'Simulate output',
61
+ 'devshell.terminal.createSession': 'New session',
62
+ 'devshell.terminal.stopSession': 'Stop session',
63
+ 'devshell.terminal.connect': 'Connect',
64
+ 'devshell.terminal.disconnect': 'Disconnect',
65
+ 'devshell.terminal.authSuccess': 'Auth success',
66
+ 'devshell.terminal.connected': 'Connected',
67
+ 'devshell.terminal.disconnected': 'Disconnected',
68
+ ...enDevShell,
69
+ ...enShell,
70
+ }