@rocketman-streamkit/types 1.0.0 → 1.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 (3) hide show
  1. package/README.md +31 -0
  2. package/addon.d.ts +44 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -8,6 +8,18 @@ Use this package when developing worker addons outside the StreamKit+ repository
8
8
 
9
9
  ---
10
10
 
11
+ ## Documentation
12
+
13
+ API reference, manifest format, permissions, and addon categories are published in a separate repository — one branch per StreamKit+ version:
14
+
15
+ **[github.com/RocketMan-StreamKit/types](https://github.com/RocketMan-StreamKit/types)**
16
+
17
+ Open the branch that matches your target app version (for example `1.0.0`) and start from [`index.md`](https://github.com/RocketMan-StreamKit/types/blob/1.0.0/index.md).
18
+
19
+ This npm package provides **TypeScript typings only**; the docs repo is the full written guide.
20
+
21
+ ---
22
+
11
23
  ## Installation
12
24
 
13
25
  ```bash
@@ -102,6 +114,25 @@ await GenerateConfig([
102
114
  const params = await api.config.getParams<{ channel_id: string; enabled: boolean }>();
103
115
  ```
104
116
 
117
+ ### App UI locale (`LANG`)
118
+
119
+ Read-only bridge to the user's language setting in StreamKit+ (`en`, `ru`, `uk`). No permission required:
120
+
121
+ ```typescript
122
+ const labels = {
123
+ en: 'Connected',
124
+ ru: 'Подключено',
125
+ uk: 'Підключено',
126
+ };
127
+
128
+ status.Update({ current: 'online', message: { [LANG.current]: labels[LANG.current] } });
129
+
130
+ const sub = LANG.onChangeLanguage((lang) => {
131
+ console.log('UI locale changed:', lang);
132
+ });
133
+ // later: sub.Destroy();
134
+ ```
135
+
105
136
  ### Outbound HTTP request
106
137
 
107
138
  Requires `NETWORK_REQUEST` permission in `manifest.json`:
package/addon.d.ts CHANGED
@@ -27,6 +27,25 @@ declare global {
27
27
  size: number;
28
28
  }
29
29
 
30
+ declare class URLSearchParams {
31
+ constructor(init?: URLSearchParamsInit);
32
+ static from(native: URLSearchParams): URLSearchParams;
33
+ append(name: string, value: string): void;
34
+ delete(name: string, value?: string): void;
35
+ get(name: string): string | null;
36
+ getAll(name: string): string[];
37
+ has(name: string, value?: string): boolean;
38
+ set(name: string, value: string): void;
39
+ sort(): void;
40
+ toString(): string;
41
+ keys(): IterableIterator<string>;
42
+ values(): IterableIterator<string>;
43
+ entries(): IterableIterator<[string, string]>;
44
+ forEach(callback: (value: string, key: string, parent: URLSearchParams) => void, thisArg: unknown): void;
45
+ [Symbol.iterator](): IterableIterator<[string, string]>;
46
+ size: number;
47
+ }
48
+
30
49
  declare class UrlCustom {
31
50
  constructor(url: string | UrlCustom, base?: string | UrlCustom);
32
51
  static canParse(url: string, base?: string | UrlCustom): boolean;
@@ -60,6 +79,10 @@ declare global {
60
79
  Record<Exclude<AddonConfigLang, 'en'>, string>
61
80
  >;
62
81
 
82
+ type DashboardLocalizedString = | string
83
+ | [LangData, ...(string | number)[]]
84
+ | DashboardLocalizedText;
85
+
63
86
  type DashboardLocalizedString = | string
64
87
  | [LangData, ...(string | number)[]]
65
88
  | DashboardLocalizedText;
@@ -185,6 +208,27 @@ declare global {
185
208
 
186
209
  type AddonConfigSchema = AddonConfigSchemaEntry[];
187
210
 
211
+ /**
212
+ * Read-only bridge to the app UI locale (`en`, `ru`, or `uk`).
213
+ Use to pick strings from per-locale objects; does not expose app translation keys.
214
+ * @example const label = { en: 'Connected', ru: 'Подключено', uk: 'Підключено' };
215
+ status.Update({ current: 'online', message: { [LANG.current]: label[LANG.current] } });
216
+ * @example const sub = LANG.onChangeLanguage((lang) => {
217
+ console.log('UI locale changed to', lang);
218
+ });
219
+ // later: sub.Destroy();
220
+ */
221
+ var LANG: {
222
+ /**
223
+ * Current app UI locale key. Updated when the user changes language in settings.
224
+ */
225
+ current: "en" | "ru" | "uk";
226
+ /**
227
+ * Subscribe to app UI locale changes. Returns `{ Destroy }` to unsubscribe.
228
+ * @param cb - Called with the new locale key (`en`, `ru`, or `uk`).
229
+ */
230
+ onChangeLanguage: (cb: (lang: "en" | "ru" | "uk") => void) => { Destroy: () => void; };
231
+ };
188
232
  /**
189
233
  * The port of the local web server.
190
234
  * @example const port = WEB_SERVER_PORT;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rocketman-streamkit/types",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "TypeScript declarations for the StreamKit+ integration addon sandbox API",
5
5
  "types": "addon.d.ts",
6
6
  "files": [