@zaflun/lumio-sdk 0.3.0 → 0.6.3

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/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import React, { CSSProperties } from 'react';
2
- import { LumioEventType, LumioActionType } from '@zaflun/lumio-protocol';
2
+ import { LumioEventType, LumioActionType, Sound } from '@zaflun/lumio-protocol';
3
+ export { Sound } from '@zaflun/lumio-protocol';
3
4
 
4
5
  interface RenderOptions {
5
6
  target: "editor" | "layer" | "interactive";
@@ -142,6 +143,195 @@ interface SliderProps {
142
143
  }
143
144
  declare function Slider({ label, value, onChange, min, max, step }: SliderProps): React.ReactElement;
144
145
 
146
+ /**
147
+ * Icon sources supported by the IconPicker.
148
+ */
149
+ type IconSource = "lucide" | "emoji" | "emote" | "upload";
150
+ /**
151
+ * Universal icon value stored in extension config.
152
+ *
153
+ * - `lucide` — `value` is the icon name (e.g. `"heart"`), rendered as inline SVG
154
+ * - `emoji` — `value` is the Unicode character (e.g. `"😀"`), rendered as text
155
+ * - `emote` — `value` is the CDN URL, rendered as `<img>`, `platform` identifies provider
156
+ * - `upload` — `value` is the storage upload URL, rendered as `<img>`
157
+ */
158
+ interface IconValue {
159
+ type: IconSource;
160
+ value: string;
161
+ label?: string;
162
+ platform?: string;
163
+ }
164
+
165
+ type IconPickerSize = "sm" | "md" | "lg";
166
+ interface IconPickerProps {
167
+ value: IconValue | null;
168
+ onChange: (icon: IconValue | null) => void;
169
+ sources?: IconSource[];
170
+ size?: IconPickerSize;
171
+ placeholder?: string;
172
+ }
173
+ declare function IconPicker({ value, onChange, sources, size, placeholder, }: IconPickerProps): React.ReactElement;
174
+
175
+ interface IconDisplayProps {
176
+ icon: IconValue | null;
177
+ size?: number;
178
+ className?: string;
179
+ }
180
+ declare function IconDisplay({ icon, size, className }: IconDisplayProps): React.ReactElement;
181
+
182
+ interface EditorInputProps {
183
+ value: string;
184
+ onChange: (value: string) => void;
185
+ placeholder?: string;
186
+ type?: "text" | "number" | "color";
187
+ min?: number;
188
+ max?: number;
189
+ step?: number;
190
+ unit?: string;
191
+ label?: string;
192
+ id?: string;
193
+ }
194
+ declare function EditorInput({ value, onChange, placeholder, type, min, max, step, unit, label, id }: EditorInputProps): React.ReactElement;
195
+
196
+ interface EditorTextareaProps {
197
+ value: string;
198
+ onChange: (value: string) => void;
199
+ placeholder?: string;
200
+ rows?: number;
201
+ label?: string;
202
+ id?: string;
203
+ }
204
+ declare function EditorTextarea({ value, onChange, placeholder, rows, label, id }: EditorTextareaProps): React.ReactElement;
205
+
206
+ interface EditorSelectOption {
207
+ value: string;
208
+ label: string;
209
+ }
210
+ interface EditorSelectProps {
211
+ value: string;
212
+ onChange: (value: string) => void;
213
+ options: EditorSelectOption[];
214
+ label?: string;
215
+ id?: string;
216
+ }
217
+ declare function EditorSelect({ value, onChange, options, label, id }: EditorSelectProps): React.ReactElement;
218
+
219
+ interface EditorCheckboxProps {
220
+ checked: boolean;
221
+ onChange: (checked: boolean) => void;
222
+ label: string;
223
+ id?: string;
224
+ }
225
+ declare function EditorCheckbox({ checked, onChange, label, id }: EditorCheckboxProps): React.ReactElement;
226
+
227
+ interface EditorSliderProps {
228
+ value: number;
229
+ onChange: (value: number) => void;
230
+ min?: number;
231
+ max?: number;
232
+ step?: number;
233
+ unit?: string;
234
+ label?: string;
235
+ id?: string;
236
+ }
237
+ declare function EditorSlider({ value, onChange, min, max, step, unit, label, id }: EditorSliderProps): React.ReactElement;
238
+
239
+ interface EditorColorPickerProps {
240
+ value: string;
241
+ onChange: (value: string) => void;
242
+ label?: string;
243
+ showAlpha?: boolean;
244
+ id?: string;
245
+ }
246
+ declare function EditorColorPicker(props: EditorColorPickerProps): React.ReactElement;
247
+
248
+ interface EditorGroupProps {
249
+ label: string;
250
+ collapsed?: boolean;
251
+ children: React.ReactNode;
252
+ }
253
+ declare function EditorGroup({ label, collapsed, children }: EditorGroupProps): React.ReactElement;
254
+
255
+ interface EditorLabelProps {
256
+ text: string;
257
+ htmlFor?: string;
258
+ required?: boolean;
259
+ }
260
+ declare function EditorLabel({ text, htmlFor, required }: EditorLabelProps): React.ReactElement;
261
+
262
+ declare function EditorDivider(): React.ReactElement;
263
+
264
+ interface EditorInfoProps {
265
+ content: string;
266
+ }
267
+ declare function EditorInfo({ content }: EditorInfoProps): React.ReactElement;
268
+
269
+ interface EditorFontRowProps {
270
+ fontWeight: string;
271
+ onFontWeightChange: (weight: string) => void;
272
+ italic: boolean;
273
+ onItalicChange: (italic: boolean) => void;
274
+ fontSize: number;
275
+ onFontSizeChange: (size: number) => void;
276
+ fontColor: string;
277
+ onFontColorChange: (color: string) => void;
278
+ }
279
+ declare function EditorFontRow(props: EditorFontRowProps): React.ReactElement<EditorFontRowProps, string | React.JSXElementConstructor<any>>;
280
+
281
+ interface EditorButtonProps {
282
+ label: string;
283
+ onClick: () => void;
284
+ variant?: "default" | "primary" | "destructive";
285
+ fullWidth?: boolean;
286
+ disabled?: boolean;
287
+ }
288
+ declare function EditorButton(props: EditorButtonProps): React.DOMElement<EditorButtonProps, Element>;
289
+
290
+ interface EditorFontPickerProps {
291
+ value: string;
292
+ onChange: (family: string) => void;
293
+ onWeightChange?: (weight: string) => void;
294
+ onItalicChange?: (italic: boolean) => void;
295
+ label?: string;
296
+ weight?: string;
297
+ italic?: boolean;
298
+ }
299
+ declare function EditorFontPicker(props: EditorFontPickerProps): React.ReactElement<EditorFontPickerProps, string | React.JSXElementConstructor<any>>;
300
+
301
+ interface EditorChannelRowProps {
302
+ platform: string;
303
+ onPlatformChange: (platform: string) => void;
304
+ channel: string;
305
+ onChannelChange: (channel: string) => void;
306
+ color: string;
307
+ onColorChange: (color: string) => void;
308
+ onRemove: () => void;
309
+ platforms?: {
310
+ value: string;
311
+ label: string;
312
+ }[];
313
+ }
314
+ declare function EditorChannelRow(props: EditorChannelRowProps): React.ReactElement<EditorChannelRowProps, string | React.JSXElementConstructor<any>>;
315
+
316
+ declare function useEditorAction(): {
317
+ dispatch: (action: string, payload?: Record<string, unknown>) => void;
318
+ };
319
+
320
+ interface UseIconPickerOptions {
321
+ sources?: IconSource[];
322
+ onSelect?: (icon: IconValue | null) => void;
323
+ }
324
+ interface UseIconPickerResult {
325
+ isOpen: boolean;
326
+ selected: IconValue | null;
327
+ open: () => void;
328
+ close: () => void;
329
+ select: (icon: IconValue | null) => void;
330
+ clear: () => void;
331
+ sources: IconSource[];
332
+ }
333
+ declare function useIconPicker(options?: UseIconPickerOptions): UseIconPickerResult;
334
+
145
335
  declare function useExtensionStorage<T = Record<string, unknown>>(key: string, initialValue: T): [T, (value: T) => void];
146
336
 
147
337
  declare function useVisionState<T>(key: string, defaultValue: T): [T, (value: T) => void];
@@ -164,7 +354,14 @@ interface LumioConfig {
164
354
  permissions?: string[];
165
355
  settings?: Record<string, unknown>;
166
356
  }
167
- declare function useLumioConfig(): [LumioConfig, (config: LumioConfig) => void];
357
+ declare global {
358
+ interface Window {
359
+ __lumio_config?: () => LumioConfig;
360
+ __lumio_set_config?: (config: LumioConfig) => void;
361
+ __lumio_on_config?: (fn: (config: LumioConfig) => void) => () => void;
362
+ }
363
+ }
364
+ declare function useLumioConfig(): [LumioConfig, (configOrUpdater: LumioConfig | ((prev: LumioConfig) => LumioConfig)) => void];
168
365
 
169
366
  interface OverlayTheme {
170
367
  colors: {
@@ -215,6 +412,13 @@ interface UseLumioActionResult {
215
412
  }
216
413
  declare function useLumioAction(action: LumioActionType): UseLumioActionResult;
217
414
 
415
+ interface UseLumioSoundResult {
416
+ playSound: (soundId: string, volume?: number) => Promise<void>;
417
+ stopSound: (soundId: string) => Promise<void>;
418
+ getSounds: () => Promise<Sound[]>;
419
+ }
420
+ declare function useLumioSound(): UseLumioSoundResult;
421
+
218
422
  interface UseQueryResult {
219
423
  data: unknown | null;
220
424
  isLoading: boolean;
@@ -486,4 +690,4 @@ interface LocalFontDefinition {
486
690
  }
487
691
  declare function localFont(options: LocalFontOptions): LocalFontDefinition;
488
692
 
489
- export { ANIMATION_PRESETS, Animated, type AnimatedProps, type AnimationPresetName, Box, type BoxProps, Button, type ButtonProps, CompactView, type CompactViewProps, Dropdown, type DropdownOption, type DropdownProps, type ExtensionContext, type FontDisplay, type FontSource, HStack, type HStackProps, Image, type ImageProps, type KeyframeBlock, type KeyframeDefinition, List, type ListProps, type LocalFontDefinition, type LocalFontOptions, Lumio, type LumioConfig, type LumioIdentity, NumberField, type NumberFieldProps, type OverlayTheme, type RenderOptions, Slider, type SliderProps, Text, TextArea, type TextAreaProps, TextField, type TextFieldProps, type TextProps, Toggle, type ToggleProps, type UseAnimationResult, type UseLumioActionResult, type UseMutationResult, type UseQueryResult, VStack, type VStackProps, type VisionStyle, WorkerBridge, defineKeyframes, flushKeyframes, getPreset, localFont, useAnimation, useExtensionContext, useExtensionStorage, useLumioAction, useLumioConfig, useLumioEvent, useLumioIdentity, useLumioTheme, useMutation, useQuery, useVisionState };
693
+ export { ANIMATION_PRESETS, Animated, type AnimatedProps, type AnimationPresetName, Box, type BoxProps, Button, type ButtonProps, CompactView, type CompactViewProps, Dropdown, type DropdownOption, type DropdownProps, EditorButton, type EditorButtonProps, EditorChannelRow, type EditorChannelRowProps, EditorCheckbox, type EditorCheckboxProps, EditorColorPicker, type EditorColorPickerProps, EditorDivider, EditorFontPicker, type EditorFontPickerProps, EditorFontRow, type EditorFontRowProps, EditorGroup, type EditorGroupProps, EditorInfo, type EditorInfoProps, EditorInput, type EditorInputProps, EditorLabel, type EditorLabelProps, EditorSelect, type EditorSelectOption, type EditorSelectProps, EditorSlider, type EditorSliderProps, EditorTextarea, type EditorTextareaProps, type ExtensionContext, type FontDisplay, type FontSource, HStack, type HStackProps, IconDisplay, type IconDisplayProps, IconPicker, type IconPickerProps, type IconPickerSize, type IconSource, type IconValue, Image, type ImageProps, type KeyframeBlock, type KeyframeDefinition, List, type ListProps, type LocalFontDefinition, type LocalFontOptions, Lumio, type LumioConfig, type LumioIdentity, NumberField, type NumberFieldProps, type OverlayTheme, type RenderOptions, Slider, type SliderProps, Text, TextArea, type TextAreaProps, TextField, type TextFieldProps, type TextProps, Toggle, type ToggleProps, type UseAnimationResult, type UseIconPickerOptions, type UseIconPickerResult, type UseLumioActionResult, type UseLumioSoundResult, type UseMutationResult, type UseQueryResult, VStack, type VStackProps, type VisionStyle, WorkerBridge, defineKeyframes, flushKeyframes, getPreset, localFont, useAnimation, useEditorAction, useExtensionContext, useExtensionStorage, useIconPicker, useLumioAction, useLumioConfig, useLumioEvent, useLumioIdentity, useLumioSound, useLumioTheme, useMutation, useQuery, useVisionState };