@skillbuilder/miniapp-simulator 0.2.0 → 0.2.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.
@@ -1,6 +1,6 @@
1
- import { R as r, a as O, c as e } from "./client-CO-UjIY3.mjs";
2
- import { B as s, M as _ } from "./business-line-CMb3ehRn.mjs";
3
- import { M } from "./index-B5oixYXr.mjs";
1
+ import { R as r, a as O, c as e } from "./client-_vNHVHSm.mjs";
2
+ import { B as s, M as _ } from "./options-B34ipLmF.mjs";
3
+ import { M } from "./index-D5AYVv8s.mjs";
4
4
  export {
5
5
  s as BusinessLine,
6
6
  _ as MINIAPP_SCREENSHOT_ERROR_CODE,
@@ -0,0 +1,10 @@
1
+ export type PhoneVibrationType = "long" | "light" | "medium" | "heavy";
2
+ /** PC 用整台模拟手机的横向抖动表现触感反馈。 */
3
+ export declare class PhoneVibrationHost {
4
+ private readonly stage;
5
+ private animation;
6
+ private lastStartedAt;
7
+ constructor(stage: HTMLElement);
8
+ vibrate(type: PhoneVibrationType): void;
9
+ stop(): void;
10
+ }
@@ -1,9 +1,13 @@
1
1
  import type { MiniAppHostApiEntry, MiniAppUnsupportedJsApiBehavior } from "../types";
2
2
  type RemoteJsApiNotice = MiniAppUnsupportedJsApiBehavior;
3
- export type RemoteJsApiConfig = Record<string, RemoteJsApiNotice>;
4
- /** Server 透传通用 JSON;具体 JSAPI 提示语义只在 Runtime 解析。 */
3
+ type RemoteJsApiEntry = RemoteJsApiNotice | {
4
+ type: "mock";
5
+ data: Record<string, unknown>;
6
+ };
7
+ export type RemoteJsApiConfig = Record<string, RemoteJsApiEntry>;
8
+ /** Server 透传通用 JSON;具体 JSAPI 提示和 mock 语义只在 Runtime 解析。 */
5
9
  export declare function parseRemoteJsApiConfig(input: unknown): RemoteJsApiConfig | undefined;
6
10
  export declare function getUnsupportedJsApiBehavior(config?: RemoteJsApiConfig): MiniAppUnsupportedJsApiBehavior | undefined;
7
11
  /** `unsupported` 是统一兜底,其余 key 是可覆盖任意 API 的精确配置。 */
8
- export declare function createConfiguredJsApiHostApi(config?: RemoteJsApiConfig): Record<string, MiniAppHostApiEntry>;
12
+ export declare function createConfiguredJsApiHostApi(config?: RemoteJsApiConfig, businessLine?: string): Record<string, MiniAppHostApiEntry>;
9
13
  export {};
@@ -0,0 +1,3 @@
1
+ import type { BridgeRequest } from "../transport/bridge-protocol";
2
+ /** 仅 MARS 按实例、API 和参数限频;关闭弹窗后才开始冷却。 */
3
+ export declare function createJsApiAlert(businessLine?: string): (request: BridgeRequest, message: string) => void;
@@ -1,4 +1,5 @@
1
1
  import type { NotePublishResult, NotePublishViewData } from "../../native-ui/note-publish";
2
+ import type { PhoneVibrationType } from "../../native-ui/phone-vibration";
2
3
  import type { ServiceWorkerHostLike } from "../../sw";
3
4
  import type { MiniAppViewport } from "../../types";
4
5
  import type { RequestRuntime } from "../request/request-runtime";
@@ -16,4 +17,5 @@ export interface SimulatorJsapiContext {
16
17
  readonly requestRuntime: RequestRuntime;
17
18
  readonly overlayRoot: ShadowRoot | HTMLElement;
18
19
  showNotePublish(data: NotePublishViewData): Promise<NotePublishResult> | undefined;
20
+ vibrate(type: PhoneVibrationType): void;
19
21
  }
@@ -1,4 +1,4 @@
1
1
  import type { SimulatorJsapiContext } from "./context";
2
2
  import type { SimulatorJsapiModule } from "./types";
3
- export type InteractionJsapiModuleContext = Pick<SimulatorJsapiContext, "overlayRoot" | "showNotePublish">;
3
+ export type InteractionJsapiModuleContext = Pick<SimulatorJsapiContext, "overlayRoot" | "showNotePublish" | "vibrate">;
4
4
  export declare function createInteractionJsapiModule(context: InteractionJsapiModuleContext): SimulatorJsapiModule;
package/lib/workbench.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as Mn } from "./client-CO-UjIY3.mjs";
1
+ import { c as Mn } from "./client-_vNHVHSm.mjs";
2
2
  function Sn(a, i) {
3
3
  const e = /* @__PURE__ */ new Map();
4
4
  let v = 0, l = !1, w, b, L, m, u;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skillbuilder/miniapp-simulator",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Designable Miniapp Simulator - 技术栈无关的小应用 PC 预览与审核模拟器 SDK",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.js",
@@ -1,3 +1,4 @@
1
+ var r = /* @__PURE__ */ ((e) => (e.skillDesignable = "skill-designable", e.creator = "creator", e.mars = "mars", e.dev = "dev", e))(r || {});
1
2
  const a = {
2
3
  /** 小工具尚未加载(含占位态 / 不在小工具页) */
3
4
  notLoaded: "not-loaded",
@@ -8,7 +9,6 @@ const a = {
8
9
  /** 当前环境不支持截图 */
9
10
  unsupported: "unsupported"
10
11
  };
11
- var r = /* @__PURE__ */ ((e) => (e.skillDesignable = "skill-designable", e.creator = "creator", e.mars = "mars", e.dev = "dev", e))(r || {});
12
12
  export {
13
13
  r as B,
14
14
  a as M