@rocketman-streamkit/types 1.0.7 → 1.0.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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/addon.d.ts +63 -6
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -14,7 +14,7 @@ API reference, manifest format, permissions, and addon categories are published
14
14
 
15
15
  **[github.com/RocketMan-StreamKit/types](https://github.com/RocketMan-StreamKit/types)**
16
16
 
17
- Open the branch that matches your target app version (for example `1.0.7`) and start from [`index.md`](https://github.com/RocketMan-StreamKit/types/blob/1.0.7/index.md).
17
+ Open the branch that matches your target app version (for example `1.0.9`) and start from [`index.md`](https://github.com/RocketMan-StreamKit/types/blob/1.0.9/index.md).
18
18
 
19
19
  This npm package provides **TypeScript typings only**; the docs repo is the full written guide.
20
20
 
package/addon.d.ts CHANGED
@@ -65,6 +65,37 @@ declare global {
65
65
  | [LangData, ...(string | number)[]]
66
66
  | DashboardLocalizedText;
67
67
 
68
+ type AddonLocalizedString = Partial<Record<AddonConfigLang, string>>;
69
+
70
+ /**
71
+ * Predefined icon names for chat message style headers.
72
+ */
73
+ type DashboardChatMessageStyleIcon = | 'exclamation'
74
+ | 'question'
75
+ | 'megaphone'
76
+ | 'list';
77
+
78
+ /**
79
+ * Addon-facing style (no app `LangData` tuple in `header`).
80
+ */
81
+ type AddonDashboardChatMessageStyle = {
82
+ color: string;
83
+ header?: AddonLocalizedString | string;
84
+ icon?: DashboardChatMessageStyleIcon;
85
+ };
86
+
87
+ /**
88
+ * Optional visual frame around a chat message (border + optional header).
89
+ */
90
+ type DashboardChatMessageStyle = {
91
+ /** Border and header background color (CSS color, e.g. hex). */
92
+ color: string;
93
+ /** Header text; when omitted only the border is shown. */
94
+ header?: DashboardLocalizedString;
95
+ /** Icon displayed next to the header text. */
96
+ icon?: DashboardChatMessageStyleIcon;
97
+ };
98
+
68
99
  type DashboardChatEmote = {
69
100
  /** Exact text token as it appears in chat (case-sensitive). */
70
101
  word: string;
@@ -75,13 +106,28 @@ declare global {
75
106
  type DashboardChatMessageValue = {
76
107
  id: string;
77
108
  content: DashboardLocalizedString;
78
- platform: string;
109
+ /** Optional visual frame (border + optional header). */
110
+ style?: DashboardChatMessageStyle;
111
+ /**
112
+ * When `true`, the message is a system line (not from a platform user).
113
+ * System messages use `addonId` / `sender` instead of `platform` / `from`.
114
+ */
115
+ system?: boolean;
116
+ /** User message: platform registered via `dashboard.registerPlatform`. */
117
+ platform?: string;
118
+ /** User message: author user id (details in `DashboardRecordUsers`). */
79
119
  from?: string;
80
120
  /**
81
121
  * Emotes extracted from message payload (e.g. Twitch fragments).
82
122
  * Used by the chat UI to render emote images even without registration.
83
123
  */
84
124
  emotes?: DashboardChatEmote[];
125
+ /**
126
+ * System message: addon id when sent by an addon; omitted = app system message.
127
+ */
128
+ addonId?: string;
129
+ /** System message: optional sender display name. */
130
+ sender?: DashboardLocalizedString;
85
131
  };
86
132
 
87
133
  /**
@@ -168,8 +214,6 @@ declare global {
168
214
  | 'folder'
169
215
  | 'file';
170
216
 
171
- type AddonLocalizedString = Partial<Record<AddonConfigLang, string>>;
172
-
173
217
  /**
174
218
  * Options for folder/file picker fields in `GenerateConfig`.
175
219
  */
@@ -1050,11 +1094,24 @@ declare global {
1050
1094
  addRecord: (record: { id?: string | undefined; type: "donation" | "subscribe" | "follow" | "custom" | "timer"; amount?: [number, string] | undefined; platform: string; message?: DashboardLocalizedString | undefined; from?: string | undefined; attach?: { type: string; value: string; }[] | undefined; }, user: { id: string; name: string; avatar?: string | undefined; platform: string; color?: string | undefined; icons?: string[] | undefined; } | undefined, options: { trigger?: { type: "donation" | "subscribe" | "subgift" | "follow" | "custom"; key?: string | undefined; value?: string | number | boolean | undefined; } | undefined; triggers?: { type: "donation" | "subscribe" | "subgift" | "follow" | "custom"; key?: string | undefined; value?: string | number | boolean | undefined; }[] | undefined; } | undefined) => Promise<unknown>;
1051
1095
  /**
1052
1096
  * Pushes a chat line into the chat dashboard window.
1053
- `content` accepts the same formats as `addRecord` `message`: plain
1054
- string, `[LangData, ...args]` tuple, or `{ en, ru?, uk? }` object.
1097
+ `content` accepts plain string or `{ en, ru?, uk? }` object.
1098
+ Optional `style` adds a colored border and optional header bar.
1099
+ * @requires AddonsPermission.DASHBOARD_CHAT
1100
+ */
1101
+ addChatMessage: (message: { id?: string | undefined; content: string | Partial<Record<AddonConfigLang, string>>; platform: string; from?: string | undefined; emotes?: { word: string; url: string; }[] | undefined; style?: AddonDashboardChatMessageStyle | undefined; }, user: { id: string; name: string; avatar?: string | undefined; platform: string; color?: string | undefined; icons?: string[] | undefined; } | undefined) => Promise<unknown>;
1102
+ /**
1103
+ * Pushes a system chat line (not from a platform user) into the chat window.
1104
+ The message is attributed to this addon (addon icon in the UI).
1105
+ `content` and optional `sender` accept plain string or `{ en, ru?, uk? }`.
1106
+ Optional `style` adds a colored border and optional header bar.
1055
1107
  * @requires AddonsPermission.DASHBOARD_CHAT
1108
+ * @example await dashboard.addSystemChatMessage({
1109
+ content: { en: 'Connected to chat', ru: 'Подключено к чату' },
1110
+ sender: { en: 'Twitch addon' },
1111
+ style: { color: '#4caf50', header: { en: 'Notice' }, icon: 'megaphone' },
1112
+ });
1056
1113
  */
1057
- addChatMessage: (message: { id?: string | undefined; content: DashboardLocalizedString; platform: string; from?: string | undefined; emotes?: { word: string; url: string; }[] | undefined; }, user: { id: string; name: string; avatar?: string | undefined; platform: string; color?: string | undefined; icons?: string[] | undefined; } | undefined) => Promise<unknown>;
1114
+ addSystemChatMessage: (message: { id?: string | undefined; content: string | Partial<Record<AddonConfigLang, string>>; sender?: string | Partial<Record<AddonConfigLang, string>> | undefined; style?: AddonDashboardChatMessageStyle | undefined; }) => Promise<unknown>;
1058
1115
  /**
1059
1116
  * Subscribes to outgoing messages from the chat window input.
1060
1117
  The handler receives `{ text }` when the user sends a message and this
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rocketman-streamkit/types",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "TypeScript declarations for the StreamKit+ integration addon sandbox API",
5
5
  "types": "addon.d.ts",
6
6
  "files": [