@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 +207 -3
- package/dist/index.js +265 -52
- package/dist/lumio-runtime.global.js +8853 -74
- package/dist/server.d.ts +165 -1
- package/dist/server.js +26 -0
- package/package.json +7 -3
package/dist/index.js
CHANGED
|
@@ -242,8 +242,116 @@ function Slider({ label, value, onChange, min, max, step = 1 }) {
|
|
|
242
242
|
return React14.createElement("Slider", { label, value, onChange, min, max, step });
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
// src/
|
|
246
|
-
import
|
|
245
|
+
// src/components/IconPicker.tsx
|
|
246
|
+
import React15 from "react";
|
|
247
|
+
function IconPicker({
|
|
248
|
+
value,
|
|
249
|
+
onChange,
|
|
250
|
+
sources,
|
|
251
|
+
size,
|
|
252
|
+
placeholder
|
|
253
|
+
}) {
|
|
254
|
+
return React15.createElement("IconPicker", {
|
|
255
|
+
value,
|
|
256
|
+
onChange,
|
|
257
|
+
sources,
|
|
258
|
+
size,
|
|
259
|
+
placeholder
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// src/components/IconDisplay.tsx
|
|
264
|
+
import React16 from "react";
|
|
265
|
+
function IconDisplay({ icon, size, className }) {
|
|
266
|
+
return React16.createElement("IconDisplay", { icon, size, className });
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// src/components/EditorInput.tsx
|
|
270
|
+
import React17 from "react";
|
|
271
|
+
function EditorInput({ value, onChange, placeholder, type, min, max, step, unit, label, id }) {
|
|
272
|
+
return React17.createElement("EditorInput", { value, onChange, placeholder, type, min, max, step, unit, label, id });
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// src/components/EditorTextarea.tsx
|
|
276
|
+
import React18 from "react";
|
|
277
|
+
function EditorTextarea({ value, onChange, placeholder, rows, label, id }) {
|
|
278
|
+
return React18.createElement("EditorTextarea", { value, onChange, placeholder, rows, label, id });
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// src/components/EditorSelect.tsx
|
|
282
|
+
import React19 from "react";
|
|
283
|
+
function EditorSelect({ value, onChange, options, label, id }) {
|
|
284
|
+
return React19.createElement("EditorSelect", { value, onChange, options, label, id });
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// src/components/EditorCheckbox.tsx
|
|
288
|
+
import React20 from "react";
|
|
289
|
+
function EditorCheckbox({ checked, onChange, label, id }) {
|
|
290
|
+
return React20.createElement("EditorCheckbox", { checked, onChange, label, id });
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// src/components/EditorSlider.tsx
|
|
294
|
+
import React21 from "react";
|
|
295
|
+
function EditorSlider({ value, onChange, min, max, step, unit, label, id }) {
|
|
296
|
+
return React21.createElement("EditorSlider", { value, onChange, min, max, step, unit, label, id });
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// src/components/EditorColorPicker.tsx
|
|
300
|
+
import React22 from "react";
|
|
301
|
+
function EditorColorPicker(props) {
|
|
302
|
+
return React22.createElement("EditorColorPicker", props);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// src/components/EditorGroup.tsx
|
|
306
|
+
import React23 from "react";
|
|
307
|
+
function EditorGroup({ label, collapsed, children }) {
|
|
308
|
+
return React23.createElement("EditorGroup", { label, collapsed }, children);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// src/components/EditorLabel.tsx
|
|
312
|
+
import React24 from "react";
|
|
313
|
+
function EditorLabel({ text, htmlFor, required }) {
|
|
314
|
+
return React24.createElement("EditorLabel", { text, htmlFor, required });
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// src/components/EditorDivider.tsx
|
|
318
|
+
import React25 from "react";
|
|
319
|
+
function EditorDivider() {
|
|
320
|
+
return React25.createElement("EditorDivider", {});
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// src/components/EditorInfo.tsx
|
|
324
|
+
import React26 from "react";
|
|
325
|
+
function EditorInfo({ content }) {
|
|
326
|
+
return React26.createElement("EditorInfo", { content });
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// src/components/EditorFontRow.tsx
|
|
330
|
+
import React27 from "react";
|
|
331
|
+
function EditorFontRow(props) {
|
|
332
|
+
return React27.createElement("EditorFontRow", props);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// src/components/EditorButton.tsx
|
|
336
|
+
import React28 from "react";
|
|
337
|
+
function EditorButton(props) {
|
|
338
|
+
return React28.createElement("EditorButton", props);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// src/components/EditorFontPicker.tsx
|
|
342
|
+
import React29 from "react";
|
|
343
|
+
function EditorFontPicker(props) {
|
|
344
|
+
return React29.createElement("EditorFontPicker", props);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// src/components/EditorChannelRow.tsx
|
|
348
|
+
import React30 from "react";
|
|
349
|
+
function EditorChannelRow(props) {
|
|
350
|
+
return React30.createElement("EditorChannelRow", props);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// src/hooks/useEditorAction.ts
|
|
354
|
+
import { useCallback } from "react";
|
|
247
355
|
|
|
248
356
|
// src/renderer/bridge-context.ts
|
|
249
357
|
var bridgeInstance = null;
|
|
@@ -254,10 +362,44 @@ function getBridge() {
|
|
|
254
362
|
return bridgeInstance;
|
|
255
363
|
}
|
|
256
364
|
|
|
365
|
+
// src/hooks/useEditorAction.ts
|
|
366
|
+
function useEditorAction() {
|
|
367
|
+
const dispatch = useCallback((action, payload) => {
|
|
368
|
+
const bridge = getBridge();
|
|
369
|
+
bridge.notify("ui.action", { action, ...payload });
|
|
370
|
+
}, []);
|
|
371
|
+
return { dispatch };
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// src/hooks/useIconPicker.ts
|
|
375
|
+
import { useState, useCallback as useCallback2 } from "react";
|
|
376
|
+
var DEFAULT_SOURCES = ["lucide", "emoji", "emote", "upload"];
|
|
377
|
+
function useIconPicker(options) {
|
|
378
|
+
const sources = options?.sources ?? DEFAULT_SOURCES;
|
|
379
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
380
|
+
const [selected, setSelected] = useState(null);
|
|
381
|
+
const open = useCallback2(() => setIsOpen(true), []);
|
|
382
|
+
const close = useCallback2(() => setIsOpen(false), []);
|
|
383
|
+
const select = useCallback2(
|
|
384
|
+
(icon) => {
|
|
385
|
+
setSelected(icon);
|
|
386
|
+
setIsOpen(false);
|
|
387
|
+
options?.onSelect?.(icon);
|
|
388
|
+
},
|
|
389
|
+
[options?.onSelect]
|
|
390
|
+
);
|
|
391
|
+
const clear = useCallback2(() => {
|
|
392
|
+
setSelected(null);
|
|
393
|
+
options?.onSelect?.(null);
|
|
394
|
+
}, [options?.onSelect]);
|
|
395
|
+
return { isOpen, selected, open, close, select, clear, sources };
|
|
396
|
+
}
|
|
397
|
+
|
|
257
398
|
// src/hooks/useExtensionStorage.ts
|
|
399
|
+
import { useState as useState2, useEffect, useCallback as useCallback3 } from "react";
|
|
258
400
|
import { HOST_METHODS, WORKER_METHODS } from "@zaflun/lumio-protocol";
|
|
259
401
|
function useExtensionStorage(key, initialValue) {
|
|
260
|
-
const [storage, setStorageState] =
|
|
402
|
+
const [storage, setStorageState] = useState2(initialValue);
|
|
261
403
|
useEffect(() => {
|
|
262
404
|
const bridge = getBridge();
|
|
263
405
|
const unsub = bridge.onNotification(
|
|
@@ -278,7 +420,7 @@ function useExtensionStorage(key, initialValue) {
|
|
|
278
420
|
});
|
|
279
421
|
return unsub;
|
|
280
422
|
}, [key]);
|
|
281
|
-
const setStorage =
|
|
423
|
+
const setStorage = useCallback3(
|
|
282
424
|
(value) => {
|
|
283
425
|
setStorageState(value);
|
|
284
426
|
const bridge = getBridge();
|
|
@@ -290,10 +432,10 @@ function useExtensionStorage(key, initialValue) {
|
|
|
290
432
|
}
|
|
291
433
|
|
|
292
434
|
// src/hooks/useVisionState.ts
|
|
293
|
-
import { useState as
|
|
435
|
+
import { useState as useState3, useEffect as useEffect2, useCallback as useCallback4 } from "react";
|
|
294
436
|
import { HOST_METHODS as HOST_METHODS2, WORKER_METHODS as WORKER_METHODS2 } from "@zaflun/lumio-protocol";
|
|
295
437
|
function useVisionState(key, defaultValue) {
|
|
296
|
-
const [value, setValueState] =
|
|
438
|
+
const [value, setValueState] = useState3(defaultValue);
|
|
297
439
|
useEffect2(() => {
|
|
298
440
|
const bridge = getBridge();
|
|
299
441
|
const unsub = bridge.onNotification(
|
|
@@ -314,7 +456,7 @@ function useVisionState(key, defaultValue) {
|
|
|
314
456
|
});
|
|
315
457
|
return unsub;
|
|
316
458
|
}, [key]);
|
|
317
|
-
const setValue =
|
|
459
|
+
const setValue = useCallback4(
|
|
318
460
|
(newValue) => {
|
|
319
461
|
setValueState(newValue);
|
|
320
462
|
const bridge = getBridge();
|
|
@@ -326,7 +468,7 @@ function useVisionState(key, defaultValue) {
|
|
|
326
468
|
}
|
|
327
469
|
|
|
328
470
|
// src/hooks/useExtensionContext.ts
|
|
329
|
-
import { useState as
|
|
471
|
+
import { useState as useState4, useEffect as useEffect3 } from "react";
|
|
330
472
|
import { HOST_METHODS as HOST_METHODS3 } from "@zaflun/lumio-protocol";
|
|
331
473
|
var defaultContext = {
|
|
332
474
|
extensionId: null,
|
|
@@ -335,7 +477,7 @@ var defaultContext = {
|
|
|
335
477
|
interactiveUrl: null
|
|
336
478
|
};
|
|
337
479
|
function useExtensionContext() {
|
|
338
|
-
const [context, setContext] =
|
|
480
|
+
const [context, setContext] = useState4(defaultContext);
|
|
339
481
|
useEffect3(() => {
|
|
340
482
|
const bridge = getBridge();
|
|
341
483
|
const unsub = bridge.onNotification(
|
|
@@ -356,10 +498,10 @@ function useExtensionContext() {
|
|
|
356
498
|
}
|
|
357
499
|
|
|
358
500
|
// src/hooks/useLumioEvent.ts
|
|
359
|
-
import { useState as
|
|
501
|
+
import { useState as useState5, useEffect as useEffect4 } from "react";
|
|
360
502
|
import { HOST_METHODS as HOST_METHODS4 } from "@zaflun/lumio-protocol";
|
|
361
503
|
function useLumioEvent(eventType) {
|
|
362
|
-
const [eventData, setEventData] =
|
|
504
|
+
const [eventData, setEventData] = useState5(null);
|
|
363
505
|
useEffect4(() => {
|
|
364
506
|
const bridge = getBridge();
|
|
365
507
|
const unsub = bridge.onNotification(
|
|
@@ -377,11 +519,24 @@ function useLumioEvent(eventType) {
|
|
|
377
519
|
}
|
|
378
520
|
|
|
379
521
|
// src/hooks/useLumioConfig.ts
|
|
380
|
-
import { useState as
|
|
381
|
-
import { HOST_METHODS as HOST_METHODS5 } from "@zaflun/lumio-protocol";
|
|
522
|
+
import { useState as useState6, useEffect as useEffect5, useCallback as useCallback5 } from "react";
|
|
523
|
+
import { HOST_METHODS as HOST_METHODS5, WORKER_METHODS as WORKER_METHODS3 } from "@zaflun/lumio-protocol";
|
|
524
|
+
function hasShim() {
|
|
525
|
+
return typeof window !== "undefined" && typeof window.__lumio_config === "function";
|
|
526
|
+
}
|
|
382
527
|
function useLumioConfig() {
|
|
383
|
-
const [config, setConfigState] =
|
|
528
|
+
const [config, setConfigState] = useState6(() => {
|
|
529
|
+
if (hasShim()) return window.__lumio_config();
|
|
530
|
+
return {};
|
|
531
|
+
});
|
|
384
532
|
useEffect5(() => {
|
|
533
|
+
if (hasShim()) {
|
|
534
|
+
const unsub2 = window.__lumio_on_config((newConfig) => {
|
|
535
|
+
setConfigState(newConfig);
|
|
536
|
+
});
|
|
537
|
+
setConfigState(window.__lumio_config());
|
|
538
|
+
return unsub2;
|
|
539
|
+
}
|
|
385
540
|
const bridge = getBridge();
|
|
386
541
|
const unsub = bridge.onNotification(
|
|
387
542
|
HOST_METHODS5.LIFECYCLE_INIT,
|
|
@@ -397,11 +552,30 @@ function useLumioConfig() {
|
|
|
397
552
|
});
|
|
398
553
|
}
|
|
399
554
|
);
|
|
400
|
-
|
|
555
|
+
const unsubConfig = bridge.onNotification(
|
|
556
|
+
HOST_METHODS5.CONFIG_UPDATE,
|
|
557
|
+
(params) => {
|
|
558
|
+
const p = params;
|
|
559
|
+
setConfigState(p);
|
|
560
|
+
}
|
|
561
|
+
);
|
|
562
|
+
return () => {
|
|
563
|
+
unsub();
|
|
564
|
+
unsubConfig();
|
|
565
|
+
};
|
|
401
566
|
}, []);
|
|
402
|
-
const setConfig =
|
|
403
|
-
(
|
|
404
|
-
setConfigState(
|
|
567
|
+
const setConfig = useCallback5(
|
|
568
|
+
(newConfigOrUpdater) => {
|
|
569
|
+
setConfigState((prev) => {
|
|
570
|
+
const next = typeof newConfigOrUpdater === "function" ? newConfigOrUpdater(prev) : newConfigOrUpdater;
|
|
571
|
+
if (hasShim()) {
|
|
572
|
+
window.__lumio_set_config(next);
|
|
573
|
+
} else {
|
|
574
|
+
const bridge = getBridge();
|
|
575
|
+
bridge.notify(WORKER_METHODS3.CONFIG_UPDATE, next);
|
|
576
|
+
}
|
|
577
|
+
return next;
|
|
578
|
+
});
|
|
405
579
|
},
|
|
406
580
|
[]
|
|
407
581
|
);
|
|
@@ -409,7 +583,7 @@ function useLumioConfig() {
|
|
|
409
583
|
}
|
|
410
584
|
|
|
411
585
|
// src/hooks/useLumioTheme.ts
|
|
412
|
-
import { useState as
|
|
586
|
+
import { useState as useState7, useEffect as useEffect6 } from "react";
|
|
413
587
|
import { HOST_METHODS as HOST_METHODS6 } from "@zaflun/lumio-protocol";
|
|
414
588
|
var DEFAULT_THEME = {
|
|
415
589
|
colors: {
|
|
@@ -434,7 +608,7 @@ var DEFAULT_THEME = {
|
|
|
434
608
|
spacing: 8
|
|
435
609
|
};
|
|
436
610
|
function useLumioTheme() {
|
|
437
|
-
const [theme, setTheme] =
|
|
611
|
+
const [theme, setTheme] = useState7(DEFAULT_THEME);
|
|
438
612
|
useEffect6(() => {
|
|
439
613
|
const bridge = getBridge();
|
|
440
614
|
const unsubInit = bridge.onNotification(
|
|
@@ -464,7 +638,7 @@ function useLumioTheme() {
|
|
|
464
638
|
}
|
|
465
639
|
|
|
466
640
|
// src/hooks/useLumioIdentity.ts
|
|
467
|
-
import { useState as
|
|
641
|
+
import { useState as useState8, useEffect as useEffect7 } from "react";
|
|
468
642
|
import { HOST_METHODS as HOST_METHODS7 } from "@zaflun/lumio-protocol";
|
|
469
643
|
var defaultIdentity = {
|
|
470
644
|
userId: null,
|
|
@@ -472,7 +646,7 @@ var defaultIdentity = {
|
|
|
472
646
|
role: null
|
|
473
647
|
};
|
|
474
648
|
function useLumioIdentity() {
|
|
475
|
-
const [identity, setIdentity] =
|
|
649
|
+
const [identity, setIdentity] = useState8(defaultIdentity);
|
|
476
650
|
useEffect7(() => {
|
|
477
651
|
const bridge = getBridge();
|
|
478
652
|
const unsub = bridge.onNotification(
|
|
@@ -492,14 +666,14 @@ function useLumioIdentity() {
|
|
|
492
666
|
}
|
|
493
667
|
|
|
494
668
|
// src/hooks/useLumioAction.ts
|
|
495
|
-
import { useState as
|
|
669
|
+
import { useState as useState9, useCallback as useCallback6, useRef } from "react";
|
|
496
670
|
function useLumioAction(action) {
|
|
497
|
-
const [data, setData] =
|
|
498
|
-
const [isLoading, setIsLoading] =
|
|
499
|
-
const [error, setError] =
|
|
671
|
+
const [data, setData] = useState9(null);
|
|
672
|
+
const [isLoading, setIsLoading] = useState9(false);
|
|
673
|
+
const [error, setError] = useState9(null);
|
|
500
674
|
const actionRef = useRef(action);
|
|
501
675
|
actionRef.current = action;
|
|
502
|
-
const execute =
|
|
676
|
+
const execute = useCallback6(
|
|
503
677
|
(params = {}) => {
|
|
504
678
|
setIsLoading(true);
|
|
505
679
|
setError(null);
|
|
@@ -519,20 +693,40 @@ function useLumioAction(action) {
|
|
|
519
693
|
return { execute, data, isLoading, error };
|
|
520
694
|
}
|
|
521
695
|
|
|
696
|
+
// src/hooks/useLumioSound.ts
|
|
697
|
+
import { useCallback as useCallback7 } from "react";
|
|
698
|
+
import { WORKER_METHODS as WORKER_METHODS4 } from "@zaflun/lumio-protocol";
|
|
699
|
+
function useLumioSound() {
|
|
700
|
+
const playSound = useCallback7(async (soundId, volume) => {
|
|
701
|
+
const bridge = getBridge();
|
|
702
|
+
await bridge.request(WORKER_METHODS4.SOUND_PLAY, { sound_id: soundId, volume });
|
|
703
|
+
}, []);
|
|
704
|
+
const stopSound = useCallback7(async (soundId) => {
|
|
705
|
+
const bridge = getBridge();
|
|
706
|
+
await bridge.request(WORKER_METHODS4.SOUND_STOP, { sound_id: soundId });
|
|
707
|
+
}, []);
|
|
708
|
+
const getSounds = useCallback7(async () => {
|
|
709
|
+
const bridge = getBridge();
|
|
710
|
+
const result = await bridge.request(WORKER_METHODS4.SOUND_LIST, {});
|
|
711
|
+
return result ?? [];
|
|
712
|
+
}, []);
|
|
713
|
+
return { playSound, stopSound, getSounds };
|
|
714
|
+
}
|
|
715
|
+
|
|
522
716
|
// src/hooks/useQuery.ts
|
|
523
|
-
import { useState as
|
|
524
|
-
import { WORKER_METHODS as
|
|
717
|
+
import { useState as useState10, useEffect as useEffect8, useCallback as useCallback8, useRef as useRef2 } from "react";
|
|
718
|
+
import { WORKER_METHODS as WORKER_METHODS5 } from "@zaflun/lumio-protocol";
|
|
525
719
|
function useQuery(functionName, params) {
|
|
526
|
-
const [data, setData] =
|
|
527
|
-
const [isLoading, setIsLoading] =
|
|
528
|
-
const [error, setError] =
|
|
720
|
+
const [data, setData] = useState10(null);
|
|
721
|
+
const [isLoading, setIsLoading] = useState10(false);
|
|
722
|
+
const [error, setError] = useState10(null);
|
|
529
723
|
const fnRef = useRef2(functionName);
|
|
530
724
|
fnRef.current = functionName;
|
|
531
|
-
const sendQuery =
|
|
725
|
+
const sendQuery = useCallback8(() => {
|
|
532
726
|
setIsLoading(true);
|
|
533
727
|
setError(null);
|
|
534
728
|
const bridge = getBridge();
|
|
535
|
-
bridge.request(
|
|
729
|
+
bridge.request(WORKER_METHODS5.SERVER_QUERY, { fn: functionName, params: params ?? {} }).then((result) => {
|
|
536
730
|
setIsLoading(false);
|
|
537
731
|
setData(result ?? null);
|
|
538
732
|
setError(null);
|
|
@@ -549,18 +743,18 @@ function useQuery(functionName, params) {
|
|
|
549
743
|
}
|
|
550
744
|
|
|
551
745
|
// src/hooks/useMutation.ts
|
|
552
|
-
import { useState as
|
|
553
|
-
import { WORKER_METHODS as
|
|
746
|
+
import { useState as useState11, useCallback as useCallback9 } from "react";
|
|
747
|
+
import { WORKER_METHODS as WORKER_METHODS6 } from "@zaflun/lumio-protocol";
|
|
554
748
|
function useMutation(functionName) {
|
|
555
|
-
const [data, setData] =
|
|
556
|
-
const [isLoading, setIsLoading] =
|
|
557
|
-
const [error, setError] =
|
|
558
|
-
const sendMutation =
|
|
749
|
+
const [data, setData] = useState11(null);
|
|
750
|
+
const [isLoading, setIsLoading] = useState11(false);
|
|
751
|
+
const [error, setError] = useState11(null);
|
|
752
|
+
const sendMutation = useCallback9(
|
|
559
753
|
(params = {}) => {
|
|
560
754
|
setIsLoading(true);
|
|
561
755
|
setError(null);
|
|
562
756
|
const bridge = getBridge();
|
|
563
|
-
return bridge.request(
|
|
757
|
+
return bridge.request(WORKER_METHODS6.SERVER_MUTATION, { fn: functionName, params }).then((result) => {
|
|
564
758
|
setIsLoading(false);
|
|
565
759
|
setData(result ?? null);
|
|
566
760
|
setError(null);
|
|
@@ -575,11 +769,11 @@ function useMutation(functionName) {
|
|
|
575
769
|
},
|
|
576
770
|
[functionName]
|
|
577
771
|
);
|
|
578
|
-
const mutateAsync =
|
|
772
|
+
const mutateAsync = useCallback9(
|
|
579
773
|
(params) => sendMutation(params),
|
|
580
774
|
[sendMutation]
|
|
581
775
|
);
|
|
582
|
-
const mutate =
|
|
776
|
+
const mutate = useCallback9(
|
|
583
777
|
(params) => {
|
|
584
778
|
sendMutation(params).catch(() => {
|
|
585
779
|
});
|
|
@@ -675,7 +869,7 @@ function getPreset(name) {
|
|
|
675
869
|
}
|
|
676
870
|
|
|
677
871
|
// src/animation/Animated.tsx
|
|
678
|
-
import
|
|
872
|
+
import React31, { useEffect as useEffect9, useRef as useRef3, useState as useState12 } from "react";
|
|
679
873
|
function resolveAnimation(name) {
|
|
680
874
|
if (name === void 0) return void 0;
|
|
681
875
|
try {
|
|
@@ -696,7 +890,7 @@ function Animated({
|
|
|
696
890
|
visible = true,
|
|
697
891
|
onAnimationEnd
|
|
698
892
|
}) {
|
|
699
|
-
const [phase, setPhase] =
|
|
893
|
+
const [phase, setPhase] = useState12(() => visible ? "in" : "idle");
|
|
700
894
|
const prevVisibleRef = useRef3(visible);
|
|
701
895
|
const timerRef = useRef3(null);
|
|
702
896
|
function clearTimer() {
|
|
@@ -770,11 +964,11 @@ function Animated({
|
|
|
770
964
|
animationStyles.animationIterationCount = 1;
|
|
771
965
|
}
|
|
772
966
|
}
|
|
773
|
-
return
|
|
967
|
+
return React31.createElement("Box", { style: animationStyles }, children);
|
|
774
968
|
}
|
|
775
969
|
|
|
776
970
|
// src/animation/useAnimation.ts
|
|
777
|
-
import { useState as
|
|
971
|
+
import { useState as useState13, useCallback as useCallback10 } from "react";
|
|
778
972
|
function resolvePreset(name) {
|
|
779
973
|
try {
|
|
780
974
|
return getPreset(name);
|
|
@@ -783,10 +977,10 @@ function resolvePreset(name) {
|
|
|
783
977
|
}
|
|
784
978
|
}
|
|
785
979
|
function useAnimation() {
|
|
786
|
-
const [isAnimating, setIsAnimating] =
|
|
787
|
-
const [currentAnimation, setCurrentAnimation] =
|
|
788
|
-
const [style, setStyle] =
|
|
789
|
-
const trigger =
|
|
980
|
+
const [isAnimating, setIsAnimating] = useState13(false);
|
|
981
|
+
const [currentAnimation, setCurrentAnimation] = useState13(null);
|
|
982
|
+
const [style, setStyle] = useState13({});
|
|
983
|
+
const trigger = useCallback10((preset, duration = 300) => {
|
|
790
984
|
const animationName = resolvePreset(preset);
|
|
791
985
|
setIsAnimating(true);
|
|
792
986
|
setCurrentAnimation(preset);
|
|
@@ -797,7 +991,7 @@ function useAnimation() {
|
|
|
797
991
|
});
|
|
798
992
|
return animationName;
|
|
799
993
|
}, []);
|
|
800
|
-
const reset =
|
|
994
|
+
const reset = useCallback10(() => {
|
|
801
995
|
setIsAnimating(false);
|
|
802
996
|
setCurrentAnimation(null);
|
|
803
997
|
setStyle({});
|
|
@@ -866,7 +1060,23 @@ export {
|
|
|
866
1060
|
Button,
|
|
867
1061
|
CompactView,
|
|
868
1062
|
Dropdown,
|
|
1063
|
+
EditorButton,
|
|
1064
|
+
EditorChannelRow,
|
|
1065
|
+
EditorCheckbox,
|
|
1066
|
+
EditorColorPicker,
|
|
1067
|
+
EditorDivider,
|
|
1068
|
+
EditorFontPicker,
|
|
1069
|
+
EditorFontRow,
|
|
1070
|
+
EditorGroup,
|
|
1071
|
+
EditorInfo,
|
|
1072
|
+
EditorInput,
|
|
1073
|
+
EditorLabel,
|
|
1074
|
+
EditorSelect,
|
|
1075
|
+
EditorSlider,
|
|
1076
|
+
EditorTextarea,
|
|
869
1077
|
HStack,
|
|
1078
|
+
IconDisplay,
|
|
1079
|
+
IconPicker,
|
|
870
1080
|
Image,
|
|
871
1081
|
List,
|
|
872
1082
|
Lumio,
|
|
@@ -883,12 +1093,15 @@ export {
|
|
|
883
1093
|
getPreset,
|
|
884
1094
|
localFont,
|
|
885
1095
|
useAnimation,
|
|
1096
|
+
useEditorAction,
|
|
886
1097
|
useExtensionContext,
|
|
887
1098
|
useExtensionStorage,
|
|
1099
|
+
useIconPicker,
|
|
888
1100
|
useLumioAction,
|
|
889
1101
|
useLumioConfig,
|
|
890
1102
|
useLumioEvent,
|
|
891
1103
|
useLumioIdentity,
|
|
1104
|
+
useLumioSound,
|
|
892
1105
|
useLumioTheme,
|
|
893
1106
|
useMutation,
|
|
894
1107
|
useQuery,
|