remote-webview-debugger 0.1.0 → 0.2.1

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 (55) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/CHANGELOG.zh-CN.md +33 -0
  3. package/README.ar.md +185 -0
  4. package/README.de.md +169 -0
  5. package/README.es.md +169 -0
  6. package/README.fr.md +169 -0
  7. package/README.ja.md +169 -0
  8. package/README.ko.md +169 -0
  9. package/README.md +69 -15
  10. package/README.pt-BR.md +169 -0
  11. package/README.ru.md +169 -0
  12. package/README.zh-CN.md +70 -15
  13. package/README.zh-TW.md +169 -0
  14. package/dist/index.d.ts +216 -8
  15. package/dist/index.mjs +2489 -2874
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/locales/ar.d.ts +4 -0
  18. package/dist/locales/ar.js +2 -0
  19. package/dist/locales/ar.mjs +150 -0
  20. package/dist/locales/ar.mjs.map +1 -0
  21. package/dist/locales/de.d.ts +4 -0
  22. package/dist/locales/de.js +2 -0
  23. package/dist/locales/de.mjs +150 -0
  24. package/dist/locales/de.mjs.map +1 -0
  25. package/dist/locales/es.d.ts +4 -0
  26. package/dist/locales/es.js +2 -0
  27. package/dist/locales/es.mjs +150 -0
  28. package/dist/locales/es.mjs.map +1 -0
  29. package/dist/locales/fr.d.ts +4 -0
  30. package/dist/locales/fr.js +2 -0
  31. package/dist/locales/fr.mjs +150 -0
  32. package/dist/locales/fr.mjs.map +1 -0
  33. package/dist/locales/ja.d.ts +4 -0
  34. package/dist/locales/ja.js +2 -0
  35. package/dist/locales/ja.mjs +150 -0
  36. package/dist/locales/ja.mjs.map +1 -0
  37. package/dist/locales/ko.d.ts +4 -0
  38. package/dist/locales/ko.js +2 -0
  39. package/dist/locales/ko.mjs +156 -0
  40. package/dist/locales/ko.mjs.map +1 -0
  41. package/dist/locales/pt.d.ts +4 -0
  42. package/dist/locales/pt.js +2 -0
  43. package/dist/locales/pt.mjs +150 -0
  44. package/dist/locales/pt.mjs.map +1 -0
  45. package/dist/locales/ru.d.ts +4 -0
  46. package/dist/locales/ru.js +2 -0
  47. package/dist/locales/ru.mjs +150 -0
  48. package/dist/locales/ru.mjs.map +1 -0
  49. package/dist/locales/zh-TW.d.ts +4 -0
  50. package/dist/locales/zh-TW.js +2 -0
  51. package/dist/locales/zh-TW.mjs +150 -0
  52. package/dist/locales/zh-TW.mjs.map +1 -0
  53. package/dist/sdk.js +24 -326
  54. package/dist/sdk.js.map +1 -1
  55. package/package.json +8 -2
package/dist/index.d.ts CHANGED
@@ -1,6 +1,195 @@
1
- type Lang = 'en' | 'zh';
1
+ declare const AGENT_EN: {
2
+ missingParam: (name: string) => string;
3
+ notString: (name: string) => string;
4
+ unknownMethod: (method: string) => string;
5
+ needLevel: (level: string) => string;
6
+ takenOver: string;
7
+ userDenied: string;
8
+ confirmBusy: string;
9
+ unknownModifier: (m: string) => string;
10
+ unknownKey: (key: string) => string;
11
+ refNotInSnapshot: (ref: string) => string;
12
+ refDetached: (ref: string) => string;
13
+ queryNeedsCriteria: string;
14
+ noSuchRecord: (seq: string) => string;
15
+ noSuchSession: (id: string) => string;
16
+ noSessionLog: string;
17
+ sessionLogUnavailable: string;
18
+ readOnly: (tag: string) => string;
19
+ isSelect: (tag: string) => string;
20
+ notFillable: (tag: string) => string;
21
+ notSelect: (tag: string) => string;
22
+ singleSelect: string;
23
+ noSuchOption: (value: string, choices: string[]) => string;
24
+ optionDisabled: (value: string) => string;
25
+ badUrl: (url: string) => string;
26
+ httpOnly: string;
27
+ textAppearTimeout: (text: string) => string;
28
+ textGoneTimeout: (text: string) => string;
29
+ badFunction: (message: string) => string;
30
+ notAFunction: string;
31
+ elementDetached: (tag: string) => string;
32
+ notActionable: (tag: string, reason: string) => string;
33
+ notVisible: (tag: string) => string;
34
+ reasonMoving: string;
35
+ reasonOffscreen: string;
36
+ reasonObscured: (tag: string, ref: string) => string;
37
+ overlayHeader: string;
38
+ overlayMask: (tag: string, coverage: number, ref: string) => string;
39
+ overlayLayer: (tag: string, text: string, coverage: number, ref: string) => string;
40
+ reasonHidden: string;
41
+ reasonDisabled: string;
42
+ storageUnavailable: (area: string) => string;
43
+ badStorageArea: string;
44
+ requestFailed: string;
45
+ noSuchRequest: (id: string) => string;
46
+ netFailed: (what: string, error: string) => string;
47
+ wsFailed: (url: string) => string;
48
+ tapped: (role: string, text: string) => string;
49
+ tappedTag: (role: string, tag: string) => string;
50
+ roles: {
51
+ [role: string]: string;
52
+ };
53
+ element: string;
54
+ };
55
+ type AgentText = typeof AGENT_EN;
56
+ declare const USER_EN: {
57
+ quote: (name: string) => string;
58
+ click: (target: string) => string;
59
+ enterActivate: (target: string) => string;
60
+ enterSubmit: (target: string) => string;
61
+ };
62
+ type UserText = typeof USER_EN;
2
63
  type Level = 'observe' | 'interact' | 'advanced';
64
+ type LevelText = {
65
+ observe: string;
66
+ interact: string;
67
+ advanced: string;
68
+ };
69
+ declare const ui: {
70
+ /** Levels in the floating window (auto-allow). */
71
+ levels: LevelText;
72
+ /** Levels in the attach dialog: what each choice adds. */
73
+ attachLevels: LevelText;
74
+ state: {
75
+ none: string;
76
+ observe: string;
77
+ agent: string;
78
+ user: string;
79
+ };
80
+ link: {
81
+ connecting: string;
82
+ online: string;
83
+ offline: string;
84
+ };
85
+ connecting: string;
86
+ helpPending: string;
87
+ copy: string;
88
+ copied: string;
89
+ noteHelp: string;
90
+ noteAuto: string;
91
+ noteShare: string;
92
+ help: string;
93
+ cancelHelp: string;
94
+ collapse: string;
95
+ deviceCode: string;
96
+ barViewing: string;
97
+ barAgent: string;
98
+ barUser: string;
99
+ connectedFor: (time: string) => string;
100
+ takeover: string;
101
+ handback: string;
102
+ end: string;
103
+ autoTitle: string;
104
+ autoOn: (level: string) => string;
105
+ autoOff: string;
106
+ lockTitle: string;
107
+ lockOn: string;
108
+ lockOff: string;
109
+ lockedToast: string;
110
+ unlockedToast: string;
111
+ autoOffToast: string;
112
+ autoDialogTitle: string;
113
+ autoDialogText: string;
114
+ turnOn: string;
115
+ cancel: string;
116
+ autoOnToast: (level: string) => string;
117
+ countdown: (seconds: number) => string;
118
+ agentName: string;
119
+ autoAllowedToast: (agent: string, level: string) => string;
120
+ attachTitle: string;
121
+ attachText: (agent: string) => string;
122
+ confirmTitle: string;
123
+ confirmText: (action: string) => string;
124
+ allow: string;
125
+ deny: string;
126
+ };
127
+ type UiMessages = typeof ui;
128
+ type AgentMessages = AgentText;
129
+ type ActionMessages = UserText;
130
+ interface Messages {
131
+ ui: UiMessages;
132
+ action: ActionMessages;
133
+ agent: AgentMessages;
134
+ }
135
+ /** Optional at every level; functions stay whole. */
136
+ type DeepPartial<T> = T extends ((...args: never[]) => unknown) ? T : T extends object ? { [K in keyof T]?: DeepPartial<T[K]>; } : T;
137
+ /** A complete language pack, like the built-in ones. */
138
+ interface Locale extends Messages {
139
+ /** BCP 47 tag: 'en', 'zh-TW', 'pt'… */
140
+ id: string;
141
+ /** The language's own name: 'Deutsch', '日本語'. */
142
+ name: string;
143
+ dir?: 'ltr' | 'rtl';
144
+ }
145
+ /** A pack for registerLocale(): anything left out comes from its fallback languages. */
146
+ interface LocalePack extends DeepPartial<Messages> {
147
+ id: string;
148
+ name?: string;
149
+ dir?: 'ltr' | 'rtl';
150
+ }
151
+ /** Messages to override, per language tag: { en: { ui: { help: 'Contact support' } } }. */
152
+ type MessageOverrides = {
153
+ [lang: string]: DeepPartial<Messages>;
154
+ };
155
+ /** Add language packs (or replace one with the same id). Pages that already chose that language switch to it. */
156
+ export declare function registerLocale(pack: LocalePack | LocalePack[]): void;
3
157
  type ControlState = 'none' | 'observe' | 'agent' | 'user';
158
+ /**
159
+ * run({ style }): each field sets one --rwd-* custom property on #__rwd (see
160
+ * VARS). Colors take any CSS color; lengths a number of px or a CSS length.
161
+ */
162
+ interface StyleOptions {
163
+ /** --rwd-accent-rgb: buttons, switches, the agent's pointer and the edge glow. */
164
+ accent?: string;
165
+ /** --rwd-danger-rgb: the End button. */
166
+ danger?: string;
167
+ /** --rwd-warning-rgb: help, the user-in-control state. */
168
+ warning?: string;
169
+ /** --rwd-success-rgb: online dot, copied. */
170
+ success?: string;
171
+ /** --rwd-font */
172
+ font?: string;
173
+ /** --rwd-font-mono: device code, tags. */
174
+ monoFont?: string;
175
+ /** --rwd-radius: floating window (dialog +2px, task card −2px, smaller parts follow). */
176
+ radius?: number | string;
177
+ /** --rwd-button-radius: pill-shaped buttons and toasts. */
178
+ buttonRadius?: number | string;
179
+ /** --rwd-z-index of the whole UI (default 2147483647). */
180
+ zIndex?: number;
181
+ /** --rwd-bar-bottom: bottom bar distance from the bottom safe area (default 14px). */
182
+ barBottom?: number | string;
183
+ /** --rwd-task-top: task card distance from the top safe area (default 10px). */
184
+ taskTop?: number | string;
185
+ /** --rwd-toast-bottom: toast distance from the bottom safe area (default 84px). */
186
+ toastBottom?: number | string;
187
+ /** Where the idle pill starts until the user drags it: the screen edge and the height (0 top … 1 bottom). */
188
+ pill?: {
189
+ side?: 'left' | 'right';
190
+ top?: number;
191
+ };
192
+ }
4
193
  interface AttachPending {
5
194
  kind: 'attach';
6
195
  requestId: string;
@@ -72,11 +261,23 @@ export interface RunOptions {
72
261
  /** Our UI's look: 'auto' (default) follows the page background, 'system' the OS, or fixed 'light' / 'dark'. */
73
262
  theme?: 'auto' | 'system' | 'light' | 'dark';
74
263
  /**
75
- * Language of the UI the phone user sees (pill, bottom bar, dialogs…):
76
- * 'en' or 'zh'. Default: 'zh' when navigator.language starts with "zh",
77
- * else 'en'. What the agent reads follows the gateway (welcome.agentLang).
264
+ * Colors, fonts, radii, z-index and positions of our UI, as --rwd-* CSS
265
+ * custom properties (pages can also set those in their own CSS).
266
+ */
267
+ style?: StyleOptions;
268
+ /**
269
+ * Language of the UI the phone user sees (pill, bottom bar, dialogs…): a
270
+ * language tag such as 'ja' or 'pt-BR'. Default: the browser's languages.
271
+ * Either way the first one with a pack wins, falling back tag by tag
272
+ * (zh-HK → zh-TW → zh) and finally to English. Built in: en, zh, zh-TW,
273
+ * fr, es, ru, ar, ja, ko, de, pt. What the agent reads follows the gateway
274
+ * (welcome.agentLang).
78
275
  */
79
- lang?: Lang;
276
+ lang?: string;
277
+ /** Extra language packs, registered before the language is picked (see registerLocale). */
278
+ locales?: LocalePack[];
279
+ /** Messages to override per language: { en: { ui: { help: 'Contact support' } } }. */
280
+ messages?: MessageOverrides;
80
281
  /**
81
282
  * Requests left out of what the agent sees in the network list and the
82
283
  * timeline (still recorded): URL substrings, `*` wildcards or /regex/,
@@ -131,7 +332,7 @@ export declare function getStatus(): {
131
332
  deviceId: string | null;
132
333
  pageId: string | null;
133
334
  version: string;
134
- lang: Lang | null;
335
+ lang: string | null;
135
336
  deviceToken: string | null;
136
337
  level: Level | null;
137
338
  config: RemoteConfig | null;
@@ -141,9 +342,16 @@ export declare function getStatus(): {
141
342
  };
142
343
  /** Disconnect and remove the UI. Console / network collection continues (bounded). */
143
344
  export declare function stop(): void;
345
+ /**
346
+ * Change the UI language at runtime (an app's own language switch): a tag
347
+ * like run({ lang }), or nothing to follow the browser again.
348
+ */
349
+ export declare function setLang(lang?: string | null): void;
350
+ /** The languages that ship with the SDK (all but en and zh load on demand). */
351
+ export declare const builtinLocales: string[];
144
352
  /** Set or change the signed-in user. The gateway learns it through a new hello. */
145
353
  export declare function setUser(userId: string | null): void;
146
- /** Ask for help (the pill shows it; the console and agents see the device asking), or cancel. */
354
+ /** Request assistance (the pill shows it; the console and agents see the device as assisting), or cancel the request. */
147
355
  export declare function help(on?: boolean): void;
148
356
  /**
149
357
  * Take over, hand back or end from the native host's own UI. Requires the
@@ -157,4 +365,4 @@ export declare function nativeControl(key: string, action: 'takeover' | 'handbac
157
365
  * nativeKey, like nativeControl(). False when the key, request or value is wrong.
158
366
  */
159
367
  export declare function nativeDecide(key: string, requestId: string, value: string | null): boolean;
160
- export { getStatus as status };
368
+ export { type ActionMessages, type AgentMessages, type DeepPartial, type Locale, type LocalePack, type MessageOverrides, type Messages, type StyleOptions, type UiMessages, getStatus as status };