@it-compiles/anima 0.1.1 → 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/dist/react.js +299 -131
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -1391,15 +1391,15 @@ function usePresence(present) {
|
|
|
1391
1391
|
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
1392
1392
|
}, [state]);
|
|
1393
1393
|
useLayoutEffect2(() => {
|
|
1394
|
-
const
|
|
1394
|
+
const styles2 = stylesRef.current;
|
|
1395
1395
|
const wasPresent = prevPresentRef.current;
|
|
1396
1396
|
const hasPresentChanged = wasPresent !== present;
|
|
1397
1397
|
if (hasPresentChanged) {
|
|
1398
1398
|
const prevAnimationName = prevAnimationNameRef.current;
|
|
1399
|
-
const currentAnimationName = getAnimationName(
|
|
1399
|
+
const currentAnimationName = getAnimationName(styles2);
|
|
1400
1400
|
if (present) {
|
|
1401
1401
|
send("MOUNT");
|
|
1402
|
-
} else if (currentAnimationName === "none" ||
|
|
1402
|
+
} else if (currentAnimationName === "none" || styles2?.display === "none") {
|
|
1403
1403
|
send("UNMOUNT");
|
|
1404
1404
|
} else {
|
|
1405
1405
|
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
@@ -1458,8 +1458,8 @@ function usePresence(present) {
|
|
|
1458
1458
|
}, [])
|
|
1459
1459
|
};
|
|
1460
1460
|
}
|
|
1461
|
-
function getAnimationName(
|
|
1462
|
-
return
|
|
1461
|
+
function getAnimationName(styles2) {
|
|
1462
|
+
return styles2?.animationName || "none";
|
|
1463
1463
|
}
|
|
1464
1464
|
function getElementRef(element) {
|
|
1465
1465
|
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
@@ -1782,20 +1782,20 @@ var stylesheetSingleton = function() {
|
|
|
1782
1782
|
};
|
|
1783
1783
|
var styleHookSingleton = function() {
|
|
1784
1784
|
var sheet = stylesheetSingleton();
|
|
1785
|
-
return function(
|
|
1785
|
+
return function(styles2, isDynamic) {
|
|
1786
1786
|
React.useEffect(function() {
|
|
1787
|
-
sheet.add(
|
|
1787
|
+
sheet.add(styles2);
|
|
1788
1788
|
return function() {
|
|
1789
1789
|
sheet.remove();
|
|
1790
1790
|
};
|
|
1791
|
-
}, [
|
|
1791
|
+
}, [styles2 && isDynamic]);
|
|
1792
1792
|
};
|
|
1793
1793
|
};
|
|
1794
1794
|
var styleSingleton = function() {
|
|
1795
1795
|
var useStyle = styleHookSingleton();
|
|
1796
1796
|
var Sheet = function(_a) {
|
|
1797
|
-
var
|
|
1798
|
-
useStyle(
|
|
1797
|
+
var styles2 = _a.styles, dynamic = _a.dynamic;
|
|
1798
|
+
useStyle(styles2, dynamic);
|
|
1799
1799
|
return null;
|
|
1800
1800
|
};
|
|
1801
1801
|
return Sheet;
|
|
@@ -1894,11 +1894,11 @@ var elementCanBeScrolled = function(node, overflow) {
|
|
|
1894
1894
|
if (!(node instanceof Element)) {
|
|
1895
1895
|
return false;
|
|
1896
1896
|
}
|
|
1897
|
-
var
|
|
1897
|
+
var styles2 = window.getComputedStyle(node);
|
|
1898
1898
|
return (
|
|
1899
1899
|
// not-not-scrollable
|
|
1900
|
-
|
|
1901
|
-
!(
|
|
1900
|
+
styles2[overflow] !== "hidden" && // contains scroll inside self
|
|
1901
|
+
!(styles2.overflowY === styles2.overflowX && !alwaysContainsScroll(node) && styles2[overflow] === "visible")
|
|
1902
1902
|
);
|
|
1903
1903
|
};
|
|
1904
1904
|
var elementCouldBeVScrolled = function(node) {
|
|
@@ -2590,6 +2590,220 @@ const BITRATE_OPTIONS = [
|
|
|
2590
2590
|
{ label: "10 Mbps (Large)", value: 1e7 },
|
|
2591
2591
|
{ label: "20 Mbps (High Quality)", value: 2e7 }
|
|
2592
2592
|
];
|
|
2593
|
+
const styles = {
|
|
2594
|
+
overlay: {
|
|
2595
|
+
position: "fixed",
|
|
2596
|
+
inset: 0,
|
|
2597
|
+
backgroundColor: "rgba(0, 0, 0, 0.6)",
|
|
2598
|
+
zIndex: 40
|
|
2599
|
+
},
|
|
2600
|
+
content: {
|
|
2601
|
+
position: "fixed",
|
|
2602
|
+
left: "50%",
|
|
2603
|
+
top: "50%",
|
|
2604
|
+
transform: "translate(-50%, -50%)",
|
|
2605
|
+
backgroundColor: "#262626",
|
|
2606
|
+
borderRadius: "8px",
|
|
2607
|
+
boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.5)",
|
|
2608
|
+
border: "1px solid #404040",
|
|
2609
|
+
width: "420px",
|
|
2610
|
+
zIndex: 50,
|
|
2611
|
+
outline: "none"
|
|
2612
|
+
},
|
|
2613
|
+
header: {
|
|
2614
|
+
display: "flex",
|
|
2615
|
+
alignItems: "center",
|
|
2616
|
+
justifyContent: "space-between",
|
|
2617
|
+
padding: "16px",
|
|
2618
|
+
borderBottom: "1px solid #404040"
|
|
2619
|
+
},
|
|
2620
|
+
title: {
|
|
2621
|
+
fontSize: "18px",
|
|
2622
|
+
fontWeight: 500,
|
|
2623
|
+
color: "#fff",
|
|
2624
|
+
margin: 0
|
|
2625
|
+
},
|
|
2626
|
+
closeButton: {
|
|
2627
|
+
color: "#a3a3a3",
|
|
2628
|
+
padding: "4px",
|
|
2629
|
+
borderRadius: "4px",
|
|
2630
|
+
border: "none",
|
|
2631
|
+
background: "transparent",
|
|
2632
|
+
cursor: "pointer"
|
|
2633
|
+
},
|
|
2634
|
+
body: {
|
|
2635
|
+
padding: "16px"
|
|
2636
|
+
},
|
|
2637
|
+
label: {
|
|
2638
|
+
display: "block",
|
|
2639
|
+
fontSize: "14px",
|
|
2640
|
+
color: "#d4d4d4",
|
|
2641
|
+
marginBottom: "8px"
|
|
2642
|
+
},
|
|
2643
|
+
buttonGroup: {
|
|
2644
|
+
display: "flex",
|
|
2645
|
+
gap: "8px",
|
|
2646
|
+
marginBottom: "16px"
|
|
2647
|
+
},
|
|
2648
|
+
optionButton: (selected) => ({
|
|
2649
|
+
padding: "8px 16px",
|
|
2650
|
+
borderRadius: "4px",
|
|
2651
|
+
fontSize: "14px",
|
|
2652
|
+
fontWeight: 500,
|
|
2653
|
+
border: "none",
|
|
2654
|
+
cursor: "pointer",
|
|
2655
|
+
transition: "background-color 0.15s",
|
|
2656
|
+
backgroundColor: selected ? "#2563eb" : "#404040",
|
|
2657
|
+
color: selected ? "#fff" : "#d4d4d4"
|
|
2658
|
+
}),
|
|
2659
|
+
select: {
|
|
2660
|
+
width: "100%",
|
|
2661
|
+
padding: "8px 12px",
|
|
2662
|
+
backgroundColor: "#404040",
|
|
2663
|
+
border: "1px solid #525252",
|
|
2664
|
+
borderRadius: "4px",
|
|
2665
|
+
color: "#e5e5e5",
|
|
2666
|
+
fontSize: "14px",
|
|
2667
|
+
outline: "none",
|
|
2668
|
+
marginBottom: "16px"
|
|
2669
|
+
},
|
|
2670
|
+
info: {
|
|
2671
|
+
fontSize: "14px",
|
|
2672
|
+
color: "#a3a3a3",
|
|
2673
|
+
marginBottom: "16px"
|
|
2674
|
+
},
|
|
2675
|
+
infoLine: {
|
|
2676
|
+
margin: "4px 0"
|
|
2677
|
+
},
|
|
2678
|
+
primaryButton: (disabled) => ({
|
|
2679
|
+
width: "100%",
|
|
2680
|
+
padding: "10px 16px",
|
|
2681
|
+
backgroundColor: disabled ? "#525252" : "#2563eb",
|
|
2682
|
+
color: "#fff",
|
|
2683
|
+
fontWeight: 500,
|
|
2684
|
+
borderRadius: "4px",
|
|
2685
|
+
border: "none",
|
|
2686
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
2687
|
+
transition: "background-color 0.15s",
|
|
2688
|
+
display: "flex",
|
|
2689
|
+
alignItems: "center",
|
|
2690
|
+
justifyContent: "center",
|
|
2691
|
+
gap: "8px"
|
|
2692
|
+
}),
|
|
2693
|
+
secondaryButton: {
|
|
2694
|
+
width: "100%",
|
|
2695
|
+
padding: "10px 16px",
|
|
2696
|
+
backgroundColor: "#404040",
|
|
2697
|
+
color: "#fff",
|
|
2698
|
+
fontWeight: 500,
|
|
2699
|
+
borderRadius: "4px",
|
|
2700
|
+
border: "none",
|
|
2701
|
+
cursor: "pointer",
|
|
2702
|
+
transition: "background-color 0.15s",
|
|
2703
|
+
marginTop: "8px",
|
|
2704
|
+
display: "flex",
|
|
2705
|
+
alignItems: "center",
|
|
2706
|
+
justifyContent: "center",
|
|
2707
|
+
gap: "8px"
|
|
2708
|
+
},
|
|
2709
|
+
warning: {
|
|
2710
|
+
display: "flex",
|
|
2711
|
+
alignItems: "flex-start",
|
|
2712
|
+
gap: "12px",
|
|
2713
|
+
padding: "12px",
|
|
2714
|
+
backgroundColor: "rgba(180, 83, 9, 0.2)",
|
|
2715
|
+
border: "1px solid rgba(180, 83, 9, 0.5)",
|
|
2716
|
+
borderRadius: "8px",
|
|
2717
|
+
marginBottom: "16px"
|
|
2718
|
+
},
|
|
2719
|
+
warningIcon: {
|
|
2720
|
+
color: "#f59e0b",
|
|
2721
|
+
marginTop: "2px",
|
|
2722
|
+
flexShrink: 0
|
|
2723
|
+
},
|
|
2724
|
+
warningText: {
|
|
2725
|
+
fontSize: "14px",
|
|
2726
|
+
color: "#fcd34d"
|
|
2727
|
+
},
|
|
2728
|
+
error: {
|
|
2729
|
+
display: "flex",
|
|
2730
|
+
alignItems: "flex-start",
|
|
2731
|
+
gap: "12px",
|
|
2732
|
+
padding: "12px",
|
|
2733
|
+
backgroundColor: "rgba(127, 29, 29, 0.3)",
|
|
2734
|
+
border: "1px solid rgba(185, 28, 28, 0.5)",
|
|
2735
|
+
borderRadius: "8px",
|
|
2736
|
+
marginBottom: "16px"
|
|
2737
|
+
},
|
|
2738
|
+
errorIcon: {
|
|
2739
|
+
color: "#ef4444",
|
|
2740
|
+
marginTop: "2px",
|
|
2741
|
+
flexShrink: 0
|
|
2742
|
+
},
|
|
2743
|
+
errorText: {
|
|
2744
|
+
fontSize: "14px",
|
|
2745
|
+
color: "#fecaca"
|
|
2746
|
+
},
|
|
2747
|
+
progressContainer: {
|
|
2748
|
+
marginBottom: "16px"
|
|
2749
|
+
},
|
|
2750
|
+
progressHeader: {
|
|
2751
|
+
display: "flex",
|
|
2752
|
+
alignItems: "center",
|
|
2753
|
+
justifyContent: "space-between",
|
|
2754
|
+
marginBottom: "8px"
|
|
2755
|
+
},
|
|
2756
|
+
progressLabel: {
|
|
2757
|
+
fontSize: "14px",
|
|
2758
|
+
color: "#d4d4d4"
|
|
2759
|
+
},
|
|
2760
|
+
progressPercent: {
|
|
2761
|
+
fontSize: "14px",
|
|
2762
|
+
color: "#a3a3a3"
|
|
2763
|
+
},
|
|
2764
|
+
progressBar: {
|
|
2765
|
+
width: "100%",
|
|
2766
|
+
height: "8px",
|
|
2767
|
+
backgroundColor: "#404040",
|
|
2768
|
+
borderRadius: "4px",
|
|
2769
|
+
overflow: "hidden"
|
|
2770
|
+
},
|
|
2771
|
+
progressFill: (progress) => ({
|
|
2772
|
+
height: "100%",
|
|
2773
|
+
backgroundColor: "#3b82f6",
|
|
2774
|
+
transition: "width 0.1s",
|
|
2775
|
+
width: `${progress * 100}%`
|
|
2776
|
+
}),
|
|
2777
|
+
progressFrame: {
|
|
2778
|
+
fontSize: "12px",
|
|
2779
|
+
color: "#737373",
|
|
2780
|
+
marginTop: "8px"
|
|
2781
|
+
},
|
|
2782
|
+
successContainer: {
|
|
2783
|
+
textAlign: "center",
|
|
2784
|
+
marginBottom: "16px"
|
|
2785
|
+
},
|
|
2786
|
+
successIcon: {
|
|
2787
|
+
width: "48px",
|
|
2788
|
+
height: "48px",
|
|
2789
|
+
backgroundColor: "rgba(37, 99, 235, 0.2)",
|
|
2790
|
+
borderRadius: "50%",
|
|
2791
|
+
display: "flex",
|
|
2792
|
+
alignItems: "center",
|
|
2793
|
+
justifyContent: "center",
|
|
2794
|
+
margin: "0 auto 12px"
|
|
2795
|
+
},
|
|
2796
|
+
successTitle: {
|
|
2797
|
+
color: "#fff",
|
|
2798
|
+
fontWeight: 500,
|
|
2799
|
+
margin: "0 0 4px"
|
|
2800
|
+
},
|
|
2801
|
+
successInfo: {
|
|
2802
|
+
fontSize: "14px",
|
|
2803
|
+
color: "#a3a3a3",
|
|
2804
|
+
margin: "4px 0"
|
|
2805
|
+
}
|
|
2806
|
+
};
|
|
2593
2807
|
function RenderDialog({ open, onOpenChange, animation }) {
|
|
2594
2808
|
const [state, setState] = useState("idle");
|
|
2595
2809
|
const [fps, setFps] = useState(30);
|
|
@@ -2662,75 +2876,62 @@ function RenderDialog({ open, onOpenChange, animation }) {
|
|
|
2662
2876
|
}, [state, handleCancel, onOpenChange]);
|
|
2663
2877
|
const estimatedDuration = animation ? Math.ceil(animation.timeline.duration / 1e3 * fps) : 0;
|
|
2664
2878
|
return /* @__PURE__ */ jsx(Root, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(Portal, { children: [
|
|
2665
|
-
/* @__PURE__ */ jsx(Overlay, {
|
|
2666
|
-
/* @__PURE__ */ jsxs(Content, {
|
|
2667
|
-
/* @__PURE__ */ jsxs("div", {
|
|
2668
|
-
/* @__PURE__ */ jsx(Title, {
|
|
2669
|
-
/* @__PURE__ */ jsx(Close, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
2670
|
-
"button",
|
|
2671
|
-
{
|
|
2672
|
-
className: "text-neutral-400 hover:text-white p-1 rounded hover:bg-neutral-700",
|
|
2673
|
-
"aria-label": "Close",
|
|
2674
|
-
children: /* @__PURE__ */ jsx(X, { size: 18 })
|
|
2675
|
-
}
|
|
2676
|
-
) })
|
|
2879
|
+
/* @__PURE__ */ jsx(Overlay, { style: styles.overlay }),
|
|
2880
|
+
/* @__PURE__ */ jsxs(Content, { style: styles.content, children: [
|
|
2881
|
+
/* @__PURE__ */ jsxs("div", { style: styles.header, children: [
|
|
2882
|
+
/* @__PURE__ */ jsx(Title, { style: styles.title, children: "Render Video" }),
|
|
2883
|
+
/* @__PURE__ */ jsx(Close, { asChild: true, children: /* @__PURE__ */ jsx("button", { style: styles.closeButton, "aria-label": "Close", children: /* @__PURE__ */ jsx(X, { size: 18 }) }) })
|
|
2677
2884
|
] }),
|
|
2678
|
-
/* @__PURE__ */ jsxs("div", {
|
|
2679
|
-
!webCodecsSupported && /* @__PURE__ */ jsxs("div", {
|
|
2680
|
-
/* @__PURE__ */ jsx(CircleAlert, { size: 18,
|
|
2681
|
-
/* @__PURE__ */ jsx("div", {
|
|
2885
|
+
/* @__PURE__ */ jsxs("div", { style: styles.body, children: [
|
|
2886
|
+
!webCodecsSupported && /* @__PURE__ */ jsxs("div", { style: styles.warning, children: [
|
|
2887
|
+
/* @__PURE__ */ jsx(CircleAlert, { size: 18, style: styles.warningIcon }),
|
|
2888
|
+
/* @__PURE__ */ jsx("div", { style: styles.warningText, children: "WebCodecs is not supported in this browser. Please use Chrome, Edge, or Opera to render videos." })
|
|
2682
2889
|
] }),
|
|
2683
2890
|
state === "idle" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2684
|
-
/* @__PURE__ */
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
"
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
children: BITRATE_OPTIONS.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value))
|
|
2720
|
-
}
|
|
2721
|
-
)
|
|
2722
|
-
] }),
|
|
2723
|
-
/* @__PURE__ */ jsxs("div", { className: "text-sm text-neutral-400 mb-4", children: [
|
|
2724
|
-
/* @__PURE__ */ jsxs("p", { children: [
|
|
2891
|
+
/* @__PURE__ */ jsx("label", { style: styles.label, children: "Resolution" }),
|
|
2892
|
+
/* @__PURE__ */ jsx("div", { style: styles.buttonGroup, children: SCALE_OPTIONS.map((option) => /* @__PURE__ */ jsx(
|
|
2893
|
+
"button",
|
|
2894
|
+
{
|
|
2895
|
+
onClick: () => setScale(option.value),
|
|
2896
|
+
style: styles.optionButton(scale === option.value),
|
|
2897
|
+
children: option.label
|
|
2898
|
+
},
|
|
2899
|
+
option.value
|
|
2900
|
+
)) }),
|
|
2901
|
+
/* @__PURE__ */ jsx("label", { style: styles.label, children: "Frame Rate" }),
|
|
2902
|
+
/* @__PURE__ */ jsx("div", { style: styles.buttonGroup, children: FPS_OPTIONS.map((option) => /* @__PURE__ */ jsxs(
|
|
2903
|
+
"button",
|
|
2904
|
+
{
|
|
2905
|
+
onClick: () => setFps(option),
|
|
2906
|
+
style: styles.optionButton(fps === option),
|
|
2907
|
+
children: [
|
|
2908
|
+
option,
|
|
2909
|
+
" fps"
|
|
2910
|
+
]
|
|
2911
|
+
},
|
|
2912
|
+
option
|
|
2913
|
+
)) }),
|
|
2914
|
+
/* @__PURE__ */ jsx("label", { style: styles.label, children: "Quality / Bitrate" }),
|
|
2915
|
+
/* @__PURE__ */ jsx(
|
|
2916
|
+
"select",
|
|
2917
|
+
{
|
|
2918
|
+
value: bitrate,
|
|
2919
|
+
onChange: (e) => setBitrate(Number(e.target.value)),
|
|
2920
|
+
style: styles.select,
|
|
2921
|
+
children: BITRATE_OPTIONS.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value))
|
|
2922
|
+
}
|
|
2923
|
+
),
|
|
2924
|
+
/* @__PURE__ */ jsxs("div", { style: styles.info, children: [
|
|
2925
|
+
/* @__PURE__ */ jsxs("p", { style: styles.infoLine, children: [
|
|
2725
2926
|
"Resolution: ",
|
|
2726
2927
|
SCALE_OPTIONS.find((o) => o.value === scale)?.resolution
|
|
2727
2928
|
] }),
|
|
2728
|
-
/* @__PURE__ */ jsxs("p", { children: [
|
|
2929
|
+
/* @__PURE__ */ jsxs("p", { style: styles.infoLine, children: [
|
|
2729
2930
|
"Duration: ",
|
|
2730
2931
|
(animation?.timeline.duration ?? 0) / 1e3,
|
|
2731
2932
|
"s"
|
|
2732
2933
|
] }),
|
|
2733
|
-
/* @__PURE__ */ jsxs("p", { children: [
|
|
2934
|
+
/* @__PURE__ */ jsxs("p", { style: styles.infoLine, children: [
|
|
2734
2935
|
"Estimated frames: ",
|
|
2735
2936
|
estimatedDuration
|
|
2736
2937
|
] })
|
|
@@ -2740,93 +2941,60 @@ function RenderDialog({ open, onOpenChange, animation }) {
|
|
|
2740
2941
|
{
|
|
2741
2942
|
onClick: handleStartRender,
|
|
2742
2943
|
disabled: !animation || !webCodecsSupported,
|
|
2743
|
-
|
|
2944
|
+
style: styles.primaryButton(!animation || !webCodecsSupported),
|
|
2744
2945
|
children: "Start Render"
|
|
2745
2946
|
}
|
|
2746
2947
|
)
|
|
2747
2948
|
] }),
|
|
2748
2949
|
state === "rendering" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2749
|
-
/* @__PURE__ */ jsxs("div", {
|
|
2750
|
-
/* @__PURE__ */ jsxs("div", {
|
|
2751
|
-
/* @__PURE__ */ jsx("span", {
|
|
2752
|
-
/* @__PURE__ */ jsxs("span", {
|
|
2950
|
+
/* @__PURE__ */ jsxs("div", { style: styles.progressContainer, children: [
|
|
2951
|
+
/* @__PURE__ */ jsxs("div", { style: styles.progressHeader, children: [
|
|
2952
|
+
/* @__PURE__ */ jsx("span", { style: styles.progressLabel, children: "Rendering..." }),
|
|
2953
|
+
/* @__PURE__ */ jsxs("span", { style: styles.progressPercent, children: [
|
|
2753
2954
|
Math.round(progress * 100),
|
|
2754
2955
|
"%"
|
|
2755
2956
|
] })
|
|
2756
2957
|
] }),
|
|
2757
|
-
/* @__PURE__ */ jsx("div", {
|
|
2758
|
-
|
|
2759
|
-
{
|
|
2760
|
-
className: "h-full bg-blue-500 transition-[width] duration-100",
|
|
2761
|
-
style: { width: `${progress * 100}%` }
|
|
2762
|
-
}
|
|
2763
|
-
) }),
|
|
2764
|
-
/* @__PURE__ */ jsxs("p", { className: "text-xs text-neutral-500 mt-2", children: [
|
|
2958
|
+
/* @__PURE__ */ jsx("div", { style: styles.progressBar, children: /* @__PURE__ */ jsx("div", { style: styles.progressFill(progress) }) }),
|
|
2959
|
+
/* @__PURE__ */ jsxs("p", { style: styles.progressFrame, children: [
|
|
2765
2960
|
"Frame ",
|
|
2766
2961
|
currentFrame,
|
|
2767
2962
|
" of ",
|
|
2768
2963
|
totalFrames
|
|
2769
2964
|
] })
|
|
2770
2965
|
] }),
|
|
2771
|
-
/* @__PURE__ */ jsxs(
|
|
2772
|
-
"
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
children: [
|
|
2777
|
-
/* @__PURE__ */ jsx(LoaderCircle, { size: 16, className: "animate-spin" }),
|
|
2778
|
-
"Cancel"
|
|
2779
|
-
]
|
|
2780
|
-
}
|
|
2781
|
-
)
|
|
2966
|
+
/* @__PURE__ */ jsxs("button", { onClick: handleCancel, style: styles.secondaryButton, children: [
|
|
2967
|
+
/* @__PURE__ */ jsx(LoaderCircle, { size: 16, style: { animation: "spin 1s linear infinite" } }),
|
|
2968
|
+
"Cancel"
|
|
2969
|
+
] }),
|
|
2970
|
+
/* @__PURE__ */ jsx("style", { children: `@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }` })
|
|
2782
2971
|
] }),
|
|
2783
2972
|
state === "complete" && result && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2784
|
-
/* @__PURE__ */ jsxs("div", {
|
|
2785
|
-
/* @__PURE__ */ jsx("div", {
|
|
2786
|
-
/* @__PURE__ */ jsx("p", {
|
|
2787
|
-
/* @__PURE__ */ jsxs("p", {
|
|
2973
|
+
/* @__PURE__ */ jsxs("div", { style: styles.successContainer, children: [
|
|
2974
|
+
/* @__PURE__ */ jsx("div", { style: styles.successIcon, children: /* @__PURE__ */ jsx(Download, { size: 24, style: { color: "#3b82f6" } }) }),
|
|
2975
|
+
/* @__PURE__ */ jsx("p", { style: styles.successTitle, children: "Render Complete!" }),
|
|
2976
|
+
/* @__PURE__ */ jsxs("p", { style: styles.successInfo, children: [
|
|
2788
2977
|
result.frames,
|
|
2789
2978
|
" frames rendered"
|
|
2790
2979
|
] }),
|
|
2791
|
-
/* @__PURE__ */ jsxs("p", {
|
|
2980
|
+
/* @__PURE__ */ jsxs("p", { style: styles.successInfo, children: [
|
|
2792
2981
|
"File size: ",
|
|
2793
2982
|
(result.blob.size / 1024 / 1024).toFixed(2),
|
|
2794
2983
|
" MB"
|
|
2795
2984
|
] })
|
|
2796
2985
|
] }),
|
|
2797
|
-
/* @__PURE__ */ jsxs(
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
children: [
|
|
2803
|
-
/* @__PURE__ */ jsx(Download, { size: 16 }),
|
|
2804
|
-
"Download MP4"
|
|
2805
|
-
]
|
|
2806
|
-
}
|
|
2807
|
-
),
|
|
2808
|
-
/* @__PURE__ */ jsx(
|
|
2809
|
-
"button",
|
|
2810
|
-
{
|
|
2811
|
-
onClick: () => setState("idle"),
|
|
2812
|
-
className: "w-full py-2.5 mt-2 bg-neutral-700 hover:bg-neutral-600 text-white font-medium rounded transition-colors",
|
|
2813
|
-
children: "Render Another"
|
|
2814
|
-
}
|
|
2815
|
-
)
|
|
2986
|
+
/* @__PURE__ */ jsxs("button", { onClick: handleDownload, style: styles.primaryButton(false), children: [
|
|
2987
|
+
/* @__PURE__ */ jsx(Download, { size: 16 }),
|
|
2988
|
+
"Download MP4"
|
|
2989
|
+
] }),
|
|
2990
|
+
/* @__PURE__ */ jsx("button", { onClick: () => setState("idle"), style: styles.secondaryButton, children: "Render Another" })
|
|
2816
2991
|
] }),
|
|
2817
2992
|
state === "error" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2818
|
-
/* @__PURE__ */ jsxs("div", {
|
|
2819
|
-
/* @__PURE__ */ jsx(CircleAlert, { size: 18,
|
|
2820
|
-
/* @__PURE__ */ jsx("div", {
|
|
2993
|
+
/* @__PURE__ */ jsxs("div", { style: styles.error, children: [
|
|
2994
|
+
/* @__PURE__ */ jsx(CircleAlert, { size: 18, style: styles.errorIcon }),
|
|
2995
|
+
/* @__PURE__ */ jsx("div", { style: styles.errorText, children: errorMessage })
|
|
2821
2996
|
] }),
|
|
2822
|
-
/* @__PURE__ */ jsx(
|
|
2823
|
-
"button",
|
|
2824
|
-
{
|
|
2825
|
-
onClick: () => setState("idle"),
|
|
2826
|
-
className: "w-full py-2.5 bg-neutral-700 hover:bg-neutral-600 text-white font-medium rounded transition-colors",
|
|
2827
|
-
children: "Try Again"
|
|
2828
|
-
}
|
|
2829
|
-
)
|
|
2997
|
+
/* @__PURE__ */ jsx("button", { onClick: () => setState("idle"), style: styles.secondaryButton, children: "Try Again" })
|
|
2830
2998
|
] })
|
|
2831
2999
|
] })
|
|
2832
3000
|
] })
|