overlaify 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +123 -2
- package/assets/overlay-spec.md +196 -0
- package/assets/sdk/v1/overlaify.js +437 -0
- package/assets/templates/be-right-back.html +123 -0
- package/assets/templates/catalog.json +348 -0
- package/assets/templates/chat-stack.html +68 -0
- package/assets/templates/death-counter.html +94 -0
- package/assets/templates/emote-wall.html +125 -0
- package/assets/templates/goal-bar.html +89 -0
- package/assets/templates/hug-command.html +151 -0
- package/assets/templates/neon-alert.html +84 -0
- package/assets/templates/newsroom-ticker.html +136 -0
- package/assets/templates/starting-soon.html +145 -0
- package/assets/templates/subathon-timer.html +127 -0
- package/assets/templates/webcam-frame.html +93 -0
- package/bin/overlaify.js +114 -0
- package/lib/commands.js +67 -0
- package/lib/dev.html +328 -0
- package/lib/dev.js +181 -0
- package/lib/publish.js +272 -0
- package/lib/starter.html +51 -0
- package/lib/validate.js +362 -0
- package/lib/ws.js +79 -0
- package/package.json +35 -4
- package/skill/SKILL.md +88 -0
- package/skill/examples/chat-stack.html +68 -0
- package/skill/examples/goal-bar.html +89 -0
- package/skill/examples/neon-alert.html +84 -0
- package/skill/references/overlay-spec.md +196 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Overlaify
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,124 @@
|
|
|
1
|
-
#
|
|
1
|
+
# overlaify
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Build Twitch overlays for OBS as single HTML files that follow the **Overlaify Overlay Spec**, whether you,
|
|
4
|
+
Claude or another AI writes them. Then check them, preview them with simulated events, and control them live
|
|
5
|
+
from your own machine. Free and local; [overlaify.com](https://www.overlaify.com) hosts the same files.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx overlaify init my-alert.html # blank starter
|
|
9
|
+
npx overlaify init --list # library templates
|
|
10
|
+
npx overlaify init goal.html --template goal-bar
|
|
11
|
+
npx overlaify validate my-alert.html # check against the spec (exit 1 on errors)
|
|
12
|
+
npx overlaify dev my-alert.html # dev page + OBS URL
|
|
13
|
+
npx overlaify login # connect your overlaify.com account
|
|
14
|
+
npx overlaify publish my-alert.html # publish it to My overlays (asks public or private)
|
|
15
|
+
npx overlaify download alice/neon-alert # save someone's overlay from overlaify.com as a local file
|
|
16
|
+
npx overlaify spec # print the spec
|
|
17
|
+
npx overlaify skill # install the Claude skill
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## `overlaify dev`
|
|
21
|
+
|
|
22
|
+
The dev page at `http://localhost:4545/` has:
|
|
23
|
+
|
|
24
|
+
- a preview of the overlay at 1920×1080;
|
|
25
|
+
- buttons that fire follow, sub, gift, bits, raid and chat events;
|
|
26
|
+
- a settings panel built from the overlay's manifest, with your Twitch channel;
|
|
27
|
+
- the overlay's action keys (pause, add, reset…);
|
|
28
|
+
- the spec check.
|
|
29
|
+
|
|
30
|
+
Add `http://localhost:4545/overlay` to OBS as a Browser source (1920×1080). It gets real Twitch chat and
|
|
31
|
+
events from your channel, the action keys reach it live, and it reloads whenever you save the file.
|
|
32
|
+
Settings are saved in `.overlaify/<name>.json` next to the file.
|
|
33
|
+
|
|
34
|
+
Options: `--port`, `--channel <twitch name>`, and `--host 0.0.0.0` to reach it from a second streaming PC.
|
|
35
|
+
|
|
36
|
+
## `overlaify publish`
|
|
37
|
+
|
|
38
|
+
`overlaify login` opens overlaify.com in your browser; sign in and click Allow, and the CLI keeps a token in
|
|
39
|
+
`~/.overlaify/credentials.json`. Then:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx overlaify publish my-alert.html # first time: choose private (only you) or public
|
|
43
|
+
npx overlaify publish my-alert.html --public # or say it up front
|
|
44
|
+
npx overlaify publish my-alert.html # again: a new version of the same overlay
|
|
45
|
+
npx overlaify publish my-alert.html --new # a separate overlay instead
|
|
46
|
+
npx overlaify publish my-alert.html --name neon # its address: overlaify.com/<your username>/neon
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The overlay must pass the spec. It gets its own page at `overlaify.com/<your username>/<name>`. The first publish
|
|
50
|
+
names it after the file (`my-alert.html` → `my-alert`) and lets you change that at the prompt; `--name` sets it
|
|
51
|
+
up front, shows up in My overlays with its OBS URL, and the
|
|
52
|
+
settings you chose in `overlaify dev` come with it. Which overlay a file was published as is kept in
|
|
53
|
+
`.overlaify/<name>.publish.json`.
|
|
54
|
+
|
|
55
|
+
- **Private**: only you can open it on overlaify.com. Its OBS URL still works.
|
|
56
|
+
- **Public**: anyone with a link can open it and remix it. Public overlays can be picked for the
|
|
57
|
+
Overlaify Library.
|
|
58
|
+
|
|
59
|
+
Other options: `--title`, `--kind alert|chat|goal|ticker|frame|custom`, and `--site` for another copy of the
|
|
60
|
+
site. `OVERLAIFY_TOKEN` replaces the saved token, for CI. `overlaify whoami` and `overlaify logout` manage the
|
|
61
|
+
login.
|
|
62
|
+
|
|
63
|
+
## `overlaify download`
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx overlaify download alice/neon-alert # → neon-alert.html, the latest version
|
|
67
|
+
npx overlaify download https://www.overlaify.com/alice/neon-alert my.html
|
|
68
|
+
npx overlaify download alice/neon-alert --version 1 # an older version (1 is the first)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Saves the overlay at `overlaify.com/<user>/<name>` as a file that runs on its own (the SDK tag is put back),
|
|
72
|
+
ready for `overlaify dev`. It won't overwrite a file unless you pass `--force`. Anyone can download a public
|
|
73
|
+
overlay. A private one only downloads for its owner: log in first with `overlaify login`, or you get told to.
|
|
74
|
+
|
|
75
|
+
For your own overlay its saved settings come along in `.overlaify/<name>.json`, and the file is linked to the
|
|
76
|
+
overlay, so `overlaify publish` adds your changes to it as a new version.
|
|
77
|
+
|
|
78
|
+
## The spec in one minute
|
|
79
|
+
|
|
80
|
+
- One self-contained HTML file, at most 80 KB, with a transparent 1920×1080 canvas.
|
|
81
|
+
- It loads only `https://www.overlaify.com/sdk/v1/overlaify.js`.
|
|
82
|
+
- Events come from the SDK: `Overlaify.on('sub', fn)`, `Overlaify.queue(fn)` for alerts.
|
|
83
|
+
- A JSON manifest declares the overlay's settings (read them with `Overlaify.param`) and its live actions
|
|
84
|
+
(handle them with `Overlaify.action`):
|
|
85
|
+
|
|
86
|
+
```html
|
|
87
|
+
<script type="application/json" id="overlaify-manifest">
|
|
88
|
+
{ "spec": 1,
|
|
89
|
+
"settings": [{ "key": "color", "label": "Color", "type": "color", "default": "#c6ff3d" }],
|
|
90
|
+
"actions": [{ "name": "reset", "label": "Reset", "style": "danger", "confirm": true }] }
|
|
91
|
+
</script>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
`npx overlaify spec` prints the full spec.
|
|
95
|
+
|
|
96
|
+
## Claude skill
|
|
97
|
+
|
|
98
|
+
`npx overlaify skill` installs a skill in `~/.claude/skills/overlaify`. After that, Claude Code can be asked
|
|
99
|
+
for an overlay and will write it to the spec, validate it and preview it with this CLI.
|
|
100
|
+
|
|
101
|
+
## Repository layout
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
bin/overlaify.js the CLI entry
|
|
105
|
+
lib/ init / validate / dev / login / publish / download / skill commands, the dev page, a tiny WebSocket server
|
|
106
|
+
lib/validate.js the spec checker (synced from the site)
|
|
107
|
+
assets/ the SDK, the Library templates and the spec (synced)
|
|
108
|
+
skill/ the Claude skill: SKILL.md, plus the spec and three examples (synced)
|
|
109
|
+
scripts/sync.mjs refreshes the synced copies
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The spec, SDK, validator and templates are shared with [overlaify.com](https://www.overlaify.com), which is
|
|
113
|
+
where they change first. `npm run sync` fetches the templates from the Library on the site (`SITE=url` for
|
|
114
|
+
another copy) and copies the rest from a checkout of the site (`../overlaify_web` by default, or
|
|
115
|
+
`OVERLAIFY_WEB=path`). `SKILL.md` and everything else is edited here.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
node bin/overlaify.js dev assets/templates/goal-bar.html # run from the repo
|
|
119
|
+
npm publish # publish to npm
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
MIT
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Overlaify Overlay Spec — v1
|
|
2
|
+
|
|
3
|
+
An Overlaify overlay is one HTML document that runs as an OBS Browser Source. Anything that follows this spec
|
|
4
|
+
— written in Overlaify Studio, by another AI, or by hand — can be hosted on Overlaify, previewed with simulated
|
|
5
|
+
events, configured from a settings panel and controlled live from a control page.
|
|
6
|
+
|
|
7
|
+
The spec has three parts:
|
|
8
|
+
|
|
9
|
+
1. **The document**: what the HTML file may contain.
|
|
10
|
+
2. **The runtime**: the `Overlaify` SDK the overlay talks to, and the events it receives.
|
|
11
|
+
3. **The manifest**: a JSON block in which the overlay declares its settings and live actions.
|
|
12
|
+
|
|
13
|
+
`src/lib/validate.js` checks an overlay against this spec. Each rule below names the code it reports.
|
|
14
|
+
**Errors** break the overlay on Overlaify and must be fixed. **Warnings** are quality problems.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 1. The document
|
|
19
|
+
|
|
20
|
+
| Rule | Code |
|
|
21
|
+
|---|---|
|
|
22
|
+
| One complete HTML document (`<!doctype html><html>…</html>`). | `not_html` (warning) |
|
|
23
|
+
| A short overlay name in `<title>`. | `title_missing` (warning) |
|
|
24
|
+
| At most 80 KB (80,000 bytes), so that Studio can still edit it. | `too_large` |
|
|
25
|
+
| All CSS and JS inline. The one `<script src>` allowed is the SDK, `https://www.overlaify.com/sdk/v1/overlaify.js` (or `/sdk/v1/overlaify.js`), so the file also runs on its own; Overlaify replaces it with its own copy when hosting. | `external_script` |
|
|
26
|
+
| No external files: stylesheets, images, audio, video, iframes, CSS `url()`/`@import`. The only hosts allowed are Google Fonts (`fonts.googleapis.com`, `fonts.gstatic.com`) and Twitch emotes (`static-cdn.jtvnw.net`). Use `data:` URLs, inline SVG, canvas or emoji instead. | `external_resource` |
|
|
27
|
+
| No `<iframe>`, `<object>` or `<embed>`. | `embedded_frame` |
|
|
28
|
+
| Other URLs in the code (outside tags) point only at those hosts. | `external_url` (warning) |
|
|
29
|
+
| No network calls (`fetch`, `XMLHttpRequest`, `WebSocket`, `EventSource`): events come from the SDK. | `network_access` (warning) |
|
|
30
|
+
| No user interaction or dialogs (`alert`, `confirm`, `prompt`): the overlay just runs. | `blocking_dialog` (warning) |
|
|
31
|
+
|
|
32
|
+
Guidelines (not checked):
|
|
33
|
+
|
|
34
|
+
- The canvas is 1920×1080. `html` and `body`: `margin: 0; width: 1920px; height: 1080px; overflow: hidden; background: transparent`.
|
|
35
|
+
Paint a full-screen background only for full scenes (Starting soon, BRB).
|
|
36
|
+
- Never insert user text as raw HTML. Use `Overlaify.escape(str)` or `textContent`, and `Overlaify.renderMessage(text, emotes)` for chat with emotes.
|
|
37
|
+
- Wrap `localStorage`/`sessionStorage` in `try/catch`: the page runs in a sandboxed, opaque origin.
|
|
38
|
+
- Animate with `transform` and `opacity`. Keep text readable over gameplay (contrast, outline or shadow, large sizes).
|
|
39
|
+
|
|
40
|
+
## 2. The runtime
|
|
41
|
+
|
|
42
|
+
Overlaify injects the SDK before the overlay's own scripts, so a global `Overlaify` object is always there.
|
|
43
|
+
Each spec version has its own SDK URL, `/sdk/v1/overlaify.js` for this one, so overlays written for it keep
|
|
44
|
+
working when a later spec changes the runtime. `Overlaify.spec` is the version the loaded SDK implements.
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
Overlaify.on(type, handler) subscribe; returns an unsubscribe function. '*' receives every event once.
|
|
48
|
+
Overlaify.off(type, handler)
|
|
49
|
+
Overlaify.queue(handler, { gap }) returns enqueue(event); runs handler one event at a time. handler may be
|
|
50
|
+
async or return ms to wait. Use it for alerts so they never overlap.
|
|
51
|
+
Overlaify.param(key, fallback) a setting's value; number and boolean fallbacks coerce the type.
|
|
52
|
+
Overlaify.action(name, fn) handle a manifest action; fn(value, event) gets the action's input value.
|
|
53
|
+
Overlaify.dispatch(name, value?) run an action from the overlay's own code (e.g. a chat command).
|
|
54
|
+
Overlaify.escape(str) HTML-escape.
|
|
55
|
+
Overlaify.renderMessage(text, emotes) safe HTML with Twitch emote <img class="ov-emote">.
|
|
56
|
+
Overlaify.chime(kind, volume?) built-in sound: 'alert' | 'pop' | 'coin' | 'fanfare' | 'low'. Respects mute.
|
|
57
|
+
Overlaify.sleep(ms) Promise delay.
|
|
58
|
+
Overlaify.simulate(type, overrides?) emit a fake event (used by previews).
|
|
59
|
+
Overlaify.channel Twitch channel login ('' in previews).
|
|
60
|
+
Overlaify.sources the connected sources: [{ platform, channel, connected }].
|
|
61
|
+
Overlaify.isTest true when random test events are running.
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Events
|
|
65
|
+
|
|
66
|
+
Events have the same shape whatever platform they come from, so an overlay works on every platform
|
|
67
|
+
Overlaify connects to without knowing which one it is on. Today that is Twitch; more will follow without a new
|
|
68
|
+
spec version.
|
|
69
|
+
|
|
70
|
+
Every event has `type`, `id`, `timestamp`, `platform` (`'twitch'`), `user` (login), `userId` (`''` when
|
|
71
|
+
unknown), `name` (display name), `color` (hex or `null`) and `simulated` (boolean). Simulated events look like
|
|
72
|
+
Twitch events.
|
|
73
|
+
|
|
74
|
+
| Type | Extra fields |
|
|
75
|
+
|---|---|
|
|
76
|
+
| `chat` | `message`, `emotes`, `badges: string[]`, `isMod`, `isSub`, `isVip`, `isBroadcaster`, `bits`, `action` |
|
|
77
|
+
| `follow` | — |
|
|
78
|
+
| `sub` | `months`, `tier: 'prime' \| '1' \| '2' \| '3'`, `message` |
|
|
79
|
+
| `gift` | `recipient`, `recipientName`, `tier`, `anonymous` |
|
|
80
|
+
| `giftbomb` | `count`, `tier` (Twitch also sends one `gift` per recipient afterwards) |
|
|
81
|
+
| `tip` | `amount`, `currency`, `kind`, `usd`, `display`, `message`, `emotes` |
|
|
82
|
+
| `cheer` | `bits`, `message`, `emotes` (Twitch only) |
|
|
83
|
+
| `raid` | `viewers` |
|
|
84
|
+
|
|
85
|
+
`tip` is money from a viewer on any platform. `amount` is in `currency`, which is `'bits'` for Twitch bits or an
|
|
86
|
+
ISO code such as `'USD'`; `kind` names the platform's feature (`'bits'` on Twitch); `usd` is the approximate
|
|
87
|
+
value in US dollars, for thresholds and sizing; `display` is ready to show, such as `"500 bits"`. Twitch bits
|
|
88
|
+
fire both `cheer` and `tip`. Handle `tip` in new overlays so they also count tips from other platforms, and
|
|
89
|
+
never both, or bits count twice (`cheer_and_tip`, warning). `'*'` gets Twitch bits once, as the `cheer`.
|
|
90
|
+
|
|
91
|
+
Lifecycle events, not included in `'*'`: `connected`, `disconnected`, with `platform` and `channel`; they fire
|
|
92
|
+
for each source. Subscribing to any other name is reported as `unknown_event` (warning).
|
|
93
|
+
|
|
94
|
+
### Where values come from
|
|
95
|
+
|
|
96
|
+
- **Settings** saved by the streamer arrive as `window.OVERLAIFY_CONFIG`. URL query parameters override them.
|
|
97
|
+
Both are read with `Overlaify.param`.
|
|
98
|
+
- Reserved keys, always provided by the platform: `channel`, `sources`, `volume`, `mute`, `test`.
|
|
99
|
+
- **Sources** say where events come from: `OVERLAIFY_CONFIG.sources`, a list of `{ platform, channel }`,
|
|
100
|
+
plus `?channel=` as a Twitch source. One overlay can listen to several at once.
|
|
101
|
+
- **Actions** come from the control page (`/c/:id`), the preview's keys, or `Overlaify.dispatch`.
|
|
102
|
+
|
|
103
|
+
## 3. The manifest
|
|
104
|
+
|
|
105
|
+
The overlay declares itself in a JSON block in `<head>`, before its own scripts:
|
|
106
|
+
|
|
107
|
+
```html
|
|
108
|
+
<script type="application/json" id="overlaify-manifest">
|
|
109
|
+
{
|
|
110
|
+
"spec": 1,
|
|
111
|
+
"settings": [ ... ],
|
|
112
|
+
"actions": [ ... ]
|
|
113
|
+
}
|
|
114
|
+
</script>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
| Rule | Code |
|
|
118
|
+
|---|---|
|
|
119
|
+
| Overlays that read settings or handle actions have a manifest. Without one, the streamer gets no settings panel or keys. | `manifest_missing` (warning) |
|
|
120
|
+
| At most one manifest block. | `manifest_duplicate` |
|
|
121
|
+
| `type="application/json"`, so the browser does not run it. | `manifest_type` |
|
|
122
|
+
| Valid JSON object: double quotes, no comments, no trailing commas. | `manifest_json` |
|
|
123
|
+
| `"spec": 1`. | `spec_missing` (warning), `spec_version` |
|
|
124
|
+
| `settings` and `actions` are arrays when present. | `manifest_shape` |
|
|
125
|
+
| No other top-level keys. | `manifest_unknown_key` (warning) |
|
|
126
|
+
|
|
127
|
+
### Settings
|
|
128
|
+
|
|
129
|
+
Settings are the overlay's starting state. The streamer edits them in a panel; the overlay reads each one with
|
|
130
|
+
`Overlaify.param(key, fallback)`, using the manifest's default as the fallback.
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{ "key": "color", "label": "Fill color", "type": "color", "default": "#ff4f8b",
|
|
134
|
+
"swatches": ["#ff4f8b", "#ffb547", "#c6ff3d"], "group": "Look", "desc": "Bar and glow." }
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
| Field | Rule | Code |
|
|
138
|
+
|---|---|---|
|
|
139
|
+
| `key` | Required. Letters, digits, `_` or `-`, starting with a letter, at most 40 characters. Unique. | `setting_key`, `setting_duplicate` |
|
|
140
|
+
| | Not a reserved key (`channel`, `volume`, `mute`, `test`). | `setting_reserved` |
|
|
141
|
+
| `label` | Short name shown in the panel. | `setting_label` (warning) |
|
|
142
|
+
| `type` | `text`, `number`, `toggle`, `color`, `select`, `segmented` or `range`. | `setting_type` |
|
|
143
|
+
| `default` | Required, and matching the type (see below). | `setting_default_missing` (warning), `setting_default` |
|
|
144
|
+
| `desc`, `group` | Optional strings. `group` puts settings under a heading; use groups once there are more than about 4 settings. | `setting_field` (warning) |
|
|
145
|
+
|
|
146
|
+
By type:
|
|
147
|
+
|
|
148
|
+
| Type | Default | Other fields |
|
|
149
|
+
|---|---|---|
|
|
150
|
+
| `text` | string | — |
|
|
151
|
+
| `number` | number | — |
|
|
152
|
+
| `toggle` | boolean; read with a boolean fallback | — |
|
|
153
|
+
| `color` | `#rrggbb` | `swatches`: optional array of `#rrggbb` presets (`setting_swatches`) |
|
|
154
|
+
| `select` | one of the option values | `options`: non-empty array (`setting_options`) |
|
|
155
|
+
| `segmented` | one of the option values | `options`: 2–4 short choices (`setting_options`; more than 4 is a warning) |
|
|
156
|
+
| `range` | number within `min`–`max` | `min` and `max` required, `min < max`, `step > 0`, optional `unit` (`setting_range`) |
|
|
157
|
+
|
|
158
|
+
Options are plain values (`"subs"`) or `{ "value": "subs", "label": "Subs" }`.
|
|
159
|
+
|
|
160
|
+
Consistency with the code:
|
|
161
|
+
|
|
162
|
+
- Every setting is read with `Overlaify.param('key', …)`. → `setting_unused` (warning)
|
|
163
|
+
- Every `Overlaify.param('key', …)`, other than reserved keys, is declared as a setting. → `param_undeclared` (warning)
|
|
164
|
+
|
|
165
|
+
### Actions
|
|
166
|
+
|
|
167
|
+
Actions change the overlay while it runs (pause, add time, reset, show a message). They appear as keys on the
|
|
168
|
+
control page. Add them only when the overlay has state worth controlling live: timers, counters, goals, queues
|
|
169
|
+
or toggled scenes.
|
|
170
|
+
|
|
171
|
+
```json
|
|
172
|
+
{ "name": "add", "label": "Add", "input": { "type": "number", "label": "Amount", "default": 1, "step": 1, "min": 1 } }
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
| Field | Rule | Code |
|
|
176
|
+
|---|---|---|
|
|
177
|
+
| `name` | Required, same format as setting keys, unique. | `action_name`, `action_duplicate` |
|
|
178
|
+
| `label` | The key's text. | `action_label` (warning) |
|
|
179
|
+
| `group` | Optional heading. | `action_field` (warning) |
|
|
180
|
+
| `style` | `primary` (default), `secondary` (less used half of a pair) or `danger` (resets and clears). | `action_style` |
|
|
181
|
+
| `confirm` | `true` or a short question. The key asks for a second press. Use it on anything that throws away progress. | `action_confirm` |
|
|
182
|
+
| `wide` | `true` makes the key take a full row. | `action_field` (warning) |
|
|
183
|
+
| `input` | `{ type: number \| text \| select, label, default, min?, max?, step?, options? }`: a value sent with the action. `select` needs `options`, and a `number` default must be a number. | `action_input` |
|
|
184
|
+
|
|
185
|
+
Consistency with the code:
|
|
186
|
+
|
|
187
|
+
- Every action has a handler, `Overlaify.action('name', fn)`. Otherwise its key does nothing. → `action_unhandled`
|
|
188
|
+
- Every handler is declared in the manifest, unless it is only dispatched from the overlay's own code. → `action_undeclared` (warning)
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Versioning
|
|
193
|
+
|
|
194
|
+
This is spec version 1. Additions that old overlays can ignore (new event types, new setting types, new
|
|
195
|
+
optional fields) keep the version number. Changes that would break an existing overlay raise it and
|
|
196
|
+
get a new SDK URL (`/sdk/v2/…`); `/sdk/v1/overlaify.js` stays as it is for v1 overlays.
|