@skillbuilder/miniapp-simulator 0.2.7 → 0.2.9
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 +18 -1
- package/dist/sw/miniapp-simulator-service-worker.js +725 -375
- package/dist/sw/miniapp-simulator-service-worker.min.js +2 -1
- package/docs/assets/road-king-controls.png +0 -0
- package/docs/desktop-gesture-design.redoc.xml +96 -0
- package/lib/client-CX13jDtT.mjs +1371 -0
- package/lib/{index-CqClPZVv.mjs → index-DwepISqo.mjs} +1 -1
- package/lib/index.js +4228 -2791
- package/lib/remote-client.js +2 -2
- package/lib/types/core/simulator.d.ts +242 -2
- package/lib/types/gesture/host-bus.d.ts +27 -2
- package/lib/types/gesture/input-scheduler.d.ts +29 -0
- package/lib/types/gesture/keyboard-panel-view.d.ts +16 -0
- package/lib/types/gesture/keyboard-panel.d.ts +54 -0
- package/lib/types/gesture/plugins/index.d.ts +11 -14
- package/lib/types/gesture/plugins/keyboard-touch.d.ts +4 -0
- package/lib/types/gesture/plugins/multi-touch-hint.d.ts +1 -9
- package/lib/types/gesture/plugins/multi-touch-switch.d.ts +1 -1
- package/lib/types/gesture/plugins/touch-emitter.d.ts +1 -9
- package/lib/types/gesture/plugins/wheel-pinch.d.ts +3 -0
- package/lib/types/gesture/plugins/wheel-scroll.d.ts +1 -1
- package/lib/types/gesture/touch-cursor.d.ts +4 -0
- package/lib/types/gesture/touch-sequence.d.ts +12 -0
- package/lib/types/gesture/types.d.ts +33 -9
- package/lib/types/host/shadow-host.d.ts +19 -4
- package/lib/types/inspector/host-inspector.d.ts +1 -1
- package/lib/types/offload/manifest.d.ts +12 -0
- package/lib/types/offload/resource-session.d.ts +33 -0
- package/lib/types/remote/audit-controller.d.ts +2 -0
- package/lib/types/remote/audit-leave-monitor.d.ts +2 -0
- package/lib/types/remote/client.d.ts +4 -0
- package/lib/types/remote/keyboard-panel-host.d.ts +19 -0
- package/lib/types/remote/protocol.d.ts +30 -2
- package/lib/types/remote/runtime-entry.d.ts +2 -1
- package/lib/types/remote/runtime.d.ts +1 -1
- package/lib/types/sw/protocol.d.ts +2 -1
- package/lib/types/sw/service-worker-host.d.ts +1 -0
- package/lib/types/sw/worker/mount-store.d.ts +7 -4
- package/lib/types/sw/worker/offloaded.d.ts +3 -0
- package/lib/types/types/options.d.ts +4 -0
- package/lib/types/types/renderer.d.ts +8 -0
- package/lib/types/utils/screen-coordinates.d.ts +31 -0
- package/lib/types/utils/stage-fit.d.ts +7 -1
- package/lib/workbench.js +1 -1
- package/package.json +2 -1
- package/lib/client-BjYHK9LR.mjs +0 -1220
package/README.md
CHANGED
|
@@ -3,10 +3,27 @@
|
|
|
3
3
|
技术栈无关的小应用 PC 模拟器 SDK,支持 iframe 预览和 Electron webview 审核场景。
|
|
4
4
|
模拟器默认**无贴图外壳**(`phoneFrame: false`),保留创作发布标准深色圆角设备边框;需要 iPhone / Nexus 贴图壳时显式传 `phoneFrame`。默认开启 `stageFit` 自适应撑满挂载区域;手动拖拽缩放需传 `stageFit: { resizeHandle: true }`。
|
|
5
5
|
|
|
6
|
+
## Mars 桌面操作
|
|
7
|
+
|
|
8
|
+
Mars 的 Remote Runtime 在手机壳外提供「键位」「逆时针旋转 90°」与「顺时针旋转 90°」按钮。其他业务线不显示这些入口;SDK 的 `desktopControls` 默认关闭。
|
|
9
|
+
|
|
10
|
+
键位面板为可拖拽悬浮窗,打开和关闭均保持手机大小与位置不变。Remote 模式下挂在接入页面的 `document.body`,可拖出模拟器挂载区域,移动范围为浏览器可视区域;位置在当前实例中保留。面板界面、拖拽和键位编辑逻辑随现有 `runtime.js` 一起远程发布,薄 SDK 提供挂载和通信。服务清单负责选择 Runtime 页面;页面加载的 Runtime entry 将自身 `import.meta.url` 通过现有握手的 `runtimeModuleUrl` 返回,接入页面按需导入这一资源中的面板视图。
|
|
11
|
+
|
|
12
|
+
1. 打开「键位」,选择「添加映射」,在手机画面中点击一个位置或拖动框选区域。
|
|
13
|
+
2. 按下要绑定的字母、数字、方向键或空格。区域映射使用所选区域的中心作为触点。
|
|
14
|
+
3. 普通按钮选择「按住区域」;方向盘、摇杆选择「拖动并保持」,再点选拖动终点。
|
|
15
|
+
4. 勾选顶部「启用按键映射」,点击右上角「×」关闭面板。按住按键保持触点,松开只释放该键;鼠标和其他按键可同时操作。
|
|
16
|
+
|
|
17
|
+
例如,油门和刹车可分别绑定 W、S;左转和右转可分别绑定 A、D 的拖动路径。每组映射独立配置,不依赖游戏名称或元素 ID,最多支持 16 组。短按区域支持点击,拖动映射在约 120ms 内移动到终点并保持。输入框、组合输入和 Ctrl / Command / Alt / Shift 快捷键保留浏览器行为。
|
|
18
|
+
|
|
19
|
+
「逆时针旋转 90°」和「顺时针旋转 90°」每点击一次,将手机壳、内容和 iframe 一起按对应方向旋转 90°;同方向连续四次回到原位。iframe 的逻辑宽高保持不变,旋转时释放活动触点。竖直摆放时按钮位于手机左侧纵排,质量分位于右侧;横向摆放时按钮位于手机下方横排,质量分位于按钮下方,正文保持正向且可滚动。映射坐标相对于内容视口保存,旋转和缩放均保持区域位置;页面自身布局变化后需检查并重选区域。关闭映射、窗口失焦、页面隐藏、内容重载和销毁均清理活动触点。映射在当前模拟器实例中保留,重新创建实例需重新配置。
|
|
20
|
+
|
|
6
21
|
```bash
|
|
7
|
-
pnpm
|
|
22
|
+
pnpm run dev:simulator
|
|
8
23
|
```
|
|
9
24
|
|
|
25
|
+
在仓库根目录启动后访问 `http://localhost:5176/simulator`。区域映射、触点时序和远程部署方案见 [桌面手势与按键映射设计](./docs/desktop-gesture-design.redoc.xml)。
|
|
26
|
+
|
|
10
27
|
Smoke 联调:`testsuits/miniapp-simulator-sdk-smoke` 以 ESM `import` 引用本包 `lib/`;改源码后 `pnpm --filter @skillbuilder/miniapp-simulator run build:npm`,再 `pnpm --filter miniapp-simulator-sdk-smoke dev` 即可。
|
|
11
28
|
|
|
12
29
|
**设备能力封印**由本包自维护:封印 IIFE 以本地文件形式存放在
|