Skip to content

Commit 743f856

Browse files
docs: update spectrum-ts documentation for v1.7.0 (#21)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent b87f4de commit 743f856

3 files changed

Lines changed: 38 additions & 3 deletions

File tree

docs-src/spectrum-ts/custom-platforms.mdx.vel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export const myPlatform = definePlatform("my-platform", {
9696
| `space.resolve` | Yes | Resolves or creates a conversation. Receives an array of users plus optional params. |
9797
| `space.schema` | No | Optional Zod schema for the resolved space. |
9898
| `space.params` | No | Zod schema for additional space creation parameters — surfaces as the second arg to `platform(app).space()`. |
99+
| `space.actions` | No | A map of content-builder factories that become sugar methods on the resolved space. Each `space.<name>(...args)` delegates to `space.send(factory(...args))`. Names that collide with built-in `Space` methods (`send`, `edit`, `startTyping`, `stopTyping`, `responding`, `getMessage`) are skipped at runtime with a warning. |
99100
| `lifecycle.createClient` | Yes | Creates the platform client. Receives `config`, `projectId`, `projectSecret` (both may be `undefined`), and `store`. |
100101
| `lifecycle.destroyClient` | No | Tears down the client on shutdown. Omit if no cleanup is needed. |
101102
| `messages` | Yes | Async generator that yields incoming messages. |

docs-src/spectrum-ts/providers/imessage.mdx.vel

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ The iMessage provider supports three connection modes — local, cloud, and dedi
3737
```
3838

3939
<Note>
40-
Local mode only supports sending text and attachments. Reactions, typing indicators, threaded replies, and group creation are not available.
40+
Local mode only supports sending text and attachments. Reactions, typing indicators, threaded replies, group creation, and chat backgrounds are not available.
4141
</Note>
4242
</Tab>
4343
<Tab title="Dedicated">
@@ -170,6 +170,40 @@ The wrapped content can be a string or any `attachment(...)`. Effects only apply
170170
</Accordion>
171171
</AccordionGroup>
172172

173+
## Chat backgrounds
174+
175+
Set or clear the chat background image. Import `background` from the iMessage provider and use the sugar method on a narrowed space:
176+
177+
```ts
178+
import { background, imessage } from "spectrum-ts/providers/imessage";
179+
180+
const im = imessage(space);
181+
182+
// Set from a file path — MIME type inferred from the extension
183+
await im.background("./wallpaper.jpg");
184+
185+
// Set from a buffer — mimeType is required
186+
await im.background(buffer, { mimeType: "image/jpeg" });
187+
188+
// Clear the current background
189+
await im.background("clear");
190+
```
191+
192+
`space.background(...)` is sugar for `space.send(background(...))`. The canonical form works on any space reference:
193+
194+
```ts
195+
await space.send(background("./wallpaper.jpg"));
196+
await space.send(background("clear"));
197+
```
198+
199+
<Note>
200+
Chat backgrounds require cloud or dedicated mode. In local mode, `background()` throws an `UnsupportedError`.
201+
</Note>
202+
203+
<Note>
204+
The string `"clear"` is a reserved sentinel. If you have a file literally named `clear` with no extension, pass `"./clear"` or load it as a `Buffer`.
205+
</Note>
206+
173207
## Tapback constants
174208

175209
iMessage uses a fixed set of tapback reactions. The `imessage` object exposes them as constants:

pnpm-lock.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)