@lumiastream/lumia-types 3.3.7-alpha.5 → 3.3.7-alpha.6
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.
|
@@ -706,6 +706,18 @@ const myUserColor = '{{userSelectedColor}}';
|
|
|
706
706
|
|
|
707
707
|
---
|
|
708
708
|
|
|
709
|
+
## Module Flavors
|
|
710
|
+
|
|
711
|
+
Custom overlay modules carry an optional `content.flavor` field that tells the runtime which compatibility layer (if any) to load before executing your HTML/CSS/JS. Most overlays you write from scratch don't set this — the field is mainly used by automated import flows.
|
|
712
|
+
|
|
713
|
+
| `flavor` value | Set by | What the runtime does |
|
|
714
|
+
| ----------------------- | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
715
|
+
| _undefined_ / missing | Hand-authored Lumia custom overlays | Runs your JS directly with the Lumia `Overlay.*` API available on `window.Overlay`. Use this by default. |
|
|
716
|
+
| `'streamelements'` | StreamElements import wizard | Loads the SE compatibility shim before your JS runs: jQuery, Lodash, GSAP, a `SE_API` polyfill with `store`/`counters`, the `fieldData` object, the SE event reshape (`onWidgetLoad` / `onEventReceived` listeners), and listener-name aliasing so widgets coded against `subscriber-latest` etc. still fire. Useful for "I dragged in an SE widget and I want it to keep working as I tune it over." |
|
|
717
|
+
| `'ai-generated'` | The wizard's "Generate with AI" step | Plain Lumia runtime (same as undefined), tagged so the editor can label the layer as AI-authored in disclosures. No runtime difference from the default flavor — purely a provenance marker. |
|
|
718
|
+
|
|
719
|
+
If you're inspecting an imported overlay's JSON and see `"flavor": "streamelements"`, that's why it can call `SE_API.store.set(...)`, `jQuery`, etc. — none of those are part of the native Lumia overlay API, but the shim makes them available for that specific layer.
|
|
720
|
+
|
|
709
721
|
## Code ID
|
|
710
722
|
|
|
711
723
|
The codeId is primarily meant to be used when talking to Lumia Stream. It is used to store storage data, it is used when calling send overlay content that will only send to overlays with that specific code id. It can be retrieved within the overlay using `Overlay.on('overlaycontent', (data) => {...})`
|
|
@@ -42,6 +42,164 @@ export enum ConfigsFieldType {
|
|
|
42
42
|
SLIDER = 'slider',
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Conditional render rule for a config field.
|
|
47
|
+
* The field is shown only when `Overlay.data[key]` strictly equals one of `equals`
|
|
48
|
+
* (scalar) or intersects with `equals` (when either side is an array).
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* { key: 'mode', equals: 'advanced' }
|
|
52
|
+
* { key: 'platform', equals: ['twitch', 'kick'] }
|
|
53
|
+
*/
|
|
54
|
+
export interface ConfigVisibleIf {
|
|
55
|
+
/** Key of another config field to read from `Overlay.data`. */
|
|
56
|
+
key: string;
|
|
57
|
+
/** Value (or list of values) that triggers visibility. */
|
|
58
|
+
equals: string | number | boolean | Array<string | number | boolean>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Properties common to every config field, regardless of `type`. */
|
|
62
|
+
export interface BaseConfigField {
|
|
63
|
+
/** Human-readable name shown next to the control in the Configs sidebar. */
|
|
64
|
+
label: string;
|
|
65
|
+
/**
|
|
66
|
+
* Display order priority. Lower numbers appear first.
|
|
67
|
+
* Fields without `order` render after ordered fields, sorted alphabetically by key.
|
|
68
|
+
*/
|
|
69
|
+
order?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Conditional render rule. When set, the field renders only when
|
|
72
|
+
* `Overlay.data[visibleIf.key]` matches `visibleIf.equals`.
|
|
73
|
+
*/
|
|
74
|
+
visibleIf?: ConfigVisibleIf;
|
|
75
|
+
/**
|
|
76
|
+
* Hard-hide rule. When `true`, the field is never displayed in the Configs
|
|
77
|
+
* sidebar, but its `value` still flows into `Overlay.data` for internal use.
|
|
78
|
+
* Useful for locking event subscriptions or advanced settings.
|
|
79
|
+
*/
|
|
80
|
+
hidden?: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Single-line text input. Supports Lumia variable insertion. */
|
|
84
|
+
export interface InputConfigField extends BaseConfigField {
|
|
85
|
+
type: ConfigsFieldType.INPUT | 'input';
|
|
86
|
+
/** Default text value. Omit to leave blank on first load. */
|
|
87
|
+
value?: string;
|
|
88
|
+
/** Placeholder text shown when the input is empty. */
|
|
89
|
+
placeholder?: string;
|
|
90
|
+
/**
|
|
91
|
+
* When `true`, renders a variable-enabled input. Users can insert Lumia
|
|
92
|
+
* variables (e.g. `{{username}}`) via a picker triggered by a `{}` adornment.
|
|
93
|
+
*/
|
|
94
|
+
enableVariables?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Curated variable list to surface at the top of the picker.
|
|
97
|
+
* System/function variables remain available below. Has no effect unless
|
|
98
|
+
* `enableVariables` is also `true`.
|
|
99
|
+
*/
|
|
100
|
+
allowedVariables?: string[];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Numeric input spinner. */
|
|
104
|
+
export interface NumberConfigField extends BaseConfigField {
|
|
105
|
+
type: ConfigsFieldType.NUMBER | 'number';
|
|
106
|
+
/** Default numeric value. */
|
|
107
|
+
value?: number;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Checkbox toggle. */
|
|
111
|
+
export interface CheckboxConfigField extends BaseConfigField {
|
|
112
|
+
type: ConfigsFieldType.CHECKBOX | 'checkbox';
|
|
113
|
+
/** Default checked state. */
|
|
114
|
+
value?: boolean;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Single-select dropdown menu. */
|
|
118
|
+
export interface DropdownConfigField extends BaseConfigField {
|
|
119
|
+
type: ConfigsFieldType.DROPDOWN | 'dropdown';
|
|
120
|
+
/** Default selected option key. */
|
|
121
|
+
value?: string;
|
|
122
|
+
/** Map of option keys to display labels. */
|
|
123
|
+
options: Record<string, string>;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** Multi-select dropdown. */
|
|
127
|
+
export interface MultiselectConfigField extends BaseConfigField {
|
|
128
|
+
type: ConfigsFieldType.MULTISELECT | 'multiselect';
|
|
129
|
+
/** Default selected option keys. */
|
|
130
|
+
value?: string[];
|
|
131
|
+
/** Map of option keys to display labels. */
|
|
132
|
+
options: Record<string, string>;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** Color picker widget. Value is a hex/rgba string. */
|
|
136
|
+
export interface ColorpickerConfigField extends BaseConfigField {
|
|
137
|
+
type: ConfigsFieldType.COLORPICKER | 'colorpicker';
|
|
138
|
+
/** Default color (hex like `#ff4076` or rgba). */
|
|
139
|
+
value?: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** Font picker that loads Google fonts on demand. Value is the font family name. */
|
|
143
|
+
export interface FontpickerConfigField extends BaseConfigField {
|
|
144
|
+
type: ConfigsFieldType.FONTPICKER | 'fontpicker';
|
|
145
|
+
/** Default font family name (e.g. `Roboto`). */
|
|
146
|
+
value?: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** Slider numeric-range options. */
|
|
150
|
+
export interface SliderOptions {
|
|
151
|
+
/** Minimum value. */
|
|
152
|
+
min?: number;
|
|
153
|
+
/** Maximum value. */
|
|
154
|
+
max?: number;
|
|
155
|
+
/** Step increment between values. */
|
|
156
|
+
step?: number;
|
|
157
|
+
/** String prefixed to the displayed value (e.g. `$`). */
|
|
158
|
+
prefix?: string;
|
|
159
|
+
/** String suffixed to the displayed value (e.g. `px`). */
|
|
160
|
+
suffix?: string;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** Number slider with min/max/step and optional value adornments. */
|
|
164
|
+
export interface SliderConfigField extends BaseConfigField {
|
|
165
|
+
type: ConfigsFieldType.SLIDER | 'slider';
|
|
166
|
+
/** Default numeric value. */
|
|
167
|
+
value?: number;
|
|
168
|
+
/** Range and adornment options. */
|
|
169
|
+
options: SliderOptions;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Discriminated union of every config-field shape the renderer accepts.
|
|
174
|
+
* Use this when typing the `configs` map for a Lumia custom overlay.
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* const configs: ConfigsSchema = {
|
|
178
|
+
* font: { type: 'fontpicker', label: 'Font', value: 'Roboto' },
|
|
179
|
+
* size: {
|
|
180
|
+
* type: 'slider',
|
|
181
|
+
* label: 'Font size',
|
|
182
|
+
* value: 48,
|
|
183
|
+
* options: { min: 10, max: 120, step: 2, suffix: 'px' },
|
|
184
|
+
* },
|
|
185
|
+
* };
|
|
186
|
+
*/
|
|
187
|
+
export type ConfigField =
|
|
188
|
+
| InputConfigField
|
|
189
|
+
| NumberConfigField
|
|
190
|
+
| CheckboxConfigField
|
|
191
|
+
| DropdownConfigField
|
|
192
|
+
| MultiselectConfigField
|
|
193
|
+
| ColorpickerConfigField
|
|
194
|
+
| FontpickerConfigField
|
|
195
|
+
| SliderConfigField;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* The configs map a custom overlay declares in its Configs tab.
|
|
199
|
+
* Keys become accessible at runtime as `Overlay.data[key]`.
|
|
200
|
+
*/
|
|
201
|
+
export type ConfigsSchema = Record<string, ConfigField>;
|
|
202
|
+
|
|
45
203
|
/**
|
|
46
204
|
* Core event types that overlays can listen to.
|
|
47
205
|
* Used as discriminants for the overlay event system.
|
|
@@ -42,6 +42,164 @@ export enum ConfigsFieldType {
|
|
|
42
42
|
SLIDER = 'slider',
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Conditional render rule for a config field.
|
|
47
|
+
* The field is shown only when `Overlay.data[key]` strictly equals one of `equals`
|
|
48
|
+
* (scalar) or intersects with `equals` (when either side is an array).
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* { key: 'mode', equals: 'advanced' }
|
|
52
|
+
* { key: 'platform', equals: ['twitch', 'kick'] }
|
|
53
|
+
*/
|
|
54
|
+
export interface ConfigVisibleIf {
|
|
55
|
+
/** Key of another config field to read from `Overlay.data`. */
|
|
56
|
+
key: string;
|
|
57
|
+
/** Value (or list of values) that triggers visibility. */
|
|
58
|
+
equals: string | number | boolean | Array<string | number | boolean>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Properties common to every config field, regardless of `type`. */
|
|
62
|
+
export interface BaseConfigField {
|
|
63
|
+
/** Human-readable name shown next to the control in the Configs sidebar. */
|
|
64
|
+
label: string;
|
|
65
|
+
/**
|
|
66
|
+
* Display order priority. Lower numbers appear first.
|
|
67
|
+
* Fields without `order` render after ordered fields, sorted alphabetically by key.
|
|
68
|
+
*/
|
|
69
|
+
order?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Conditional render rule. When set, the field renders only when
|
|
72
|
+
* `Overlay.data[visibleIf.key]` matches `visibleIf.equals`.
|
|
73
|
+
*/
|
|
74
|
+
visibleIf?: ConfigVisibleIf;
|
|
75
|
+
/**
|
|
76
|
+
* Hard-hide rule. When `true`, the field is never displayed in the Configs
|
|
77
|
+
* sidebar, but its `value` still flows into `Overlay.data` for internal use.
|
|
78
|
+
* Useful for locking event subscriptions or advanced settings.
|
|
79
|
+
*/
|
|
80
|
+
hidden?: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Single-line text input. Supports Lumia variable insertion. */
|
|
84
|
+
export interface InputConfigField extends BaseConfigField {
|
|
85
|
+
type: ConfigsFieldType.INPUT | 'input';
|
|
86
|
+
/** Default text value. Omit to leave blank on first load. */
|
|
87
|
+
value?: string;
|
|
88
|
+
/** Placeholder text shown when the input is empty. */
|
|
89
|
+
placeholder?: string;
|
|
90
|
+
/**
|
|
91
|
+
* When `true`, renders a variable-enabled input. Users can insert Lumia
|
|
92
|
+
* variables (e.g. `{{username}}`) via a picker triggered by a `{}` adornment.
|
|
93
|
+
*/
|
|
94
|
+
enableVariables?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Curated variable list to surface at the top of the picker.
|
|
97
|
+
* System/function variables remain available below. Has no effect unless
|
|
98
|
+
* `enableVariables` is also `true`.
|
|
99
|
+
*/
|
|
100
|
+
allowedVariables?: string[];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Numeric input spinner. */
|
|
104
|
+
export interface NumberConfigField extends BaseConfigField {
|
|
105
|
+
type: ConfigsFieldType.NUMBER | 'number';
|
|
106
|
+
/** Default numeric value. */
|
|
107
|
+
value?: number;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Checkbox toggle. */
|
|
111
|
+
export interface CheckboxConfigField extends BaseConfigField {
|
|
112
|
+
type: ConfigsFieldType.CHECKBOX | 'checkbox';
|
|
113
|
+
/** Default checked state. */
|
|
114
|
+
value?: boolean;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Single-select dropdown menu. */
|
|
118
|
+
export interface DropdownConfigField extends BaseConfigField {
|
|
119
|
+
type: ConfigsFieldType.DROPDOWN | 'dropdown';
|
|
120
|
+
/** Default selected option key. */
|
|
121
|
+
value?: string;
|
|
122
|
+
/** Map of option keys to display labels. */
|
|
123
|
+
options: Record<string, string>;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** Multi-select dropdown. */
|
|
127
|
+
export interface MultiselectConfigField extends BaseConfigField {
|
|
128
|
+
type: ConfigsFieldType.MULTISELECT | 'multiselect';
|
|
129
|
+
/** Default selected option keys. */
|
|
130
|
+
value?: string[];
|
|
131
|
+
/** Map of option keys to display labels. */
|
|
132
|
+
options: Record<string, string>;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** Color picker widget. Value is a hex/rgba string. */
|
|
136
|
+
export interface ColorpickerConfigField extends BaseConfigField {
|
|
137
|
+
type: ConfigsFieldType.COLORPICKER | 'colorpicker';
|
|
138
|
+
/** Default color (hex like `#ff4076` or rgba). */
|
|
139
|
+
value?: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** Font picker that loads Google fonts on demand. Value is the font family name. */
|
|
143
|
+
export interface FontpickerConfigField extends BaseConfigField {
|
|
144
|
+
type: ConfigsFieldType.FONTPICKER | 'fontpicker';
|
|
145
|
+
/** Default font family name (e.g. `Roboto`). */
|
|
146
|
+
value?: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** Slider numeric-range options. */
|
|
150
|
+
export interface SliderOptions {
|
|
151
|
+
/** Minimum value. */
|
|
152
|
+
min?: number;
|
|
153
|
+
/** Maximum value. */
|
|
154
|
+
max?: number;
|
|
155
|
+
/** Step increment between values. */
|
|
156
|
+
step?: number;
|
|
157
|
+
/** String prefixed to the displayed value (e.g. `$`). */
|
|
158
|
+
prefix?: string;
|
|
159
|
+
/** String suffixed to the displayed value (e.g. `px`). */
|
|
160
|
+
suffix?: string;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** Number slider with min/max/step and optional value adornments. */
|
|
164
|
+
export interface SliderConfigField extends BaseConfigField {
|
|
165
|
+
type: ConfigsFieldType.SLIDER | 'slider';
|
|
166
|
+
/** Default numeric value. */
|
|
167
|
+
value?: number;
|
|
168
|
+
/** Range and adornment options. */
|
|
169
|
+
options: SliderOptions;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Discriminated union of every config-field shape the renderer accepts.
|
|
174
|
+
* Use this when typing the `configs` map for a Lumia custom overlay.
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* const configs: ConfigsSchema = {
|
|
178
|
+
* font: { type: 'fontpicker', label: 'Font', value: 'Roboto' },
|
|
179
|
+
* size: {
|
|
180
|
+
* type: 'slider',
|
|
181
|
+
* label: 'Font size',
|
|
182
|
+
* value: 48,
|
|
183
|
+
* options: { min: 10, max: 120, step: 2, suffix: 'px' },
|
|
184
|
+
* },
|
|
185
|
+
* };
|
|
186
|
+
*/
|
|
187
|
+
export type ConfigField =
|
|
188
|
+
| InputConfigField
|
|
189
|
+
| NumberConfigField
|
|
190
|
+
| CheckboxConfigField
|
|
191
|
+
| DropdownConfigField
|
|
192
|
+
| MultiselectConfigField
|
|
193
|
+
| ColorpickerConfigField
|
|
194
|
+
| FontpickerConfigField
|
|
195
|
+
| SliderConfigField;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* The configs map a custom overlay declares in its Configs tab.
|
|
199
|
+
* Keys become accessible at runtime as `Overlay.data[key]`.
|
|
200
|
+
*/
|
|
201
|
+
export type ConfigsSchema = Record<string, ConfigField>;
|
|
202
|
+
|
|
45
203
|
/**
|
|
46
204
|
* Core event types that overlays can listen to.
|
|
47
205
|
* Used as discriminants for the overlay event system.
|