AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
feat(frontend): reusable confetti with enhanced particles and dual bursts (#12454)
Abhimanyu Yadav8153306384ba
diff --git a/autogpt_platform/frontend/package.json b/autogpt_platform/frontend/package.jsonindex 6112d8ecd9..0620c26062 100644--- a/autogpt_platform/frontend/package.json+++ b/autogpt_platform/frontend/package.json@@ -75,6 +75,7 @@"@xyflow/react": "12.9.2","ai": "6.0.59","boring-avatars": "1.11.2",+ "canvas-confetti": "1.9.4","class-variance-authority": "0.7.1","clsx": "2.1.1","cmdk": "1.1.1",@@ -96,7 +97,6 @@"next": "15.4.10","next-themes": "0.4.6","nuqs": "2.7.2",- "party-js": "2.2.0","posthog-js": "1.334.1","react": "18.3.1","react-currency-input-field": "4.0.3",diff --git a/autogpt_platform/frontend/pnpm-lock.yaml b/autogpt_platform/frontend/pnpm-lock.yamlindex 122c135f38..f3f8d7d355 100644--- a/autogpt_platform/frontend/pnpm-lock.yaml+++ b/autogpt_platform/frontend/pnpm-lock.yaml@@ -147,6 +147,9 @@ importers:boring-avatars:specifier: 1.11.2version: 1.11.2+ canvas-confetti:+ specifier: 1.9.4+ version: 1.9.4class-variance-authority:specifier: 0.7.1version: 0.7.1@@ -210,9 +213,6 @@ importers:nuqs:specifier: 2.7.2version: 2.7.2([email protected](@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])([email protected]([email protected]))([email protected]))([email protected])- party-js:- specifier: 2.2.0- version: 2.2.0posthog-js:specifier: 1.334.1version: 1.334.1@@ -4378,6 +4378,9 @@ packages:resolution: {integrity: sha512-PxZwGNvH7Ak8WX5iXzoK1KPZttBXNPuaOvI2ZYU7NrlM+d9Ov+TUvlLOBNGzVXAntMSMMlJPd+jY6ovrVjSmUw==}+ resolution: {integrity: sha512-yxQbJkAVrFXWNbTUjPqjF7G+g6pDotOUHGbkZq2NELZUMDpiJ85rIEazVb8GTaAptNW2miJAXbs1BtioA251Pw==}+resolution: {integrity: sha512-roIFONhcxog0JSSWbvVAh3OocukmSgpqOH6YpMkCvav/ySIV3JKg4Dc8vYtQjYi/UxpNE36r/9v+VqTQqgkYmw==}engines: {node: '>=4'}@@ -6862,9 +6865,6 @@ packages:resolution: {integrity: sha512-9m4m5GSgXjL4AjumKzq1Fgfp3Z8rsvjRNbnkVwfu2ImRqE5D0LnY2QfDen18FSY9C573YU5XxSapdHZTZ2WolA==}- resolution: {integrity: sha512-50hGuALCpvDTrQLPQ1fgUgxKIWAH28ShVkmeK/3zhO0YJyCqkhrZhQEkWPxDYLvbFJ7YAXyROmFEu35gKpZLtQ==}-resolution: {integrity: sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==}@@ -13165,6 +13165,8 @@ snapshots:+ [email protected]: {}+@@ -16295,8 +16297,6 @@ snapshots:entities: 6.0.1optional: true- [email protected]: {}-dependencies:no-case: 3.0.4diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/6-congrats/page.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/6-congrats/page.tsxindex b3b4e4f458..617df7a43f 100644--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/6-congrats/page.tsx+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/6-congrats/page.tsx@@ -2,12 +2,13 @@import { useBackendAPI } from "@/lib/autogpt-server-api/context";import { cn } from "@/lib/utils";import { useRouter } from "next/navigation";-import * as party from "party-js";import { useEffect, useRef, useState } from "react";import { useOnboarding } from "../../../../providers/onboarding/onboarding-provider";import { resolveResponse } from "@/app/api/helpers";import { getV1OnboardingState } from "@/app/api/__generated__/endpoints/onboarding/onboarding";import { postV2AddMarketplaceAgent } from "@/app/api/__generated__/endpoints/library/library";+import { Confetti } from "@/components/molecules/Confetti/Confetti";+import type { ConfettiRef } from "@/components/molecules/Confetti/Confetti";export default function Page() {const { completeStep } = useOnboarding(7, "AGENT_INPUT");@@ -15,19 +16,42 @@ export default function Page() {const api = useBackendAPI();const [showText, setShowText] = useState(false);const [showSubtext, setShowSubtext] = useState(false);- const divRef = useRef(null);+ const confettiRef = useRef<ConfettiRef>(null);useEffect(() => {- if (divRef.current) {- party.confetti(divRef.current, {- count: 100,- spread: 180,- shapes: ["square", "circle"],- size: party.variation.range(2, 2.5),- speed: party.variation.range(300, 1000),+ // Fire side cannons for a celebratory effect+ const duration = 1500;+ const end = Date.now() + duration;++ function frame() {+ confettiRef.current?.fire({+ particleCount: 4,+ angle: 60,+ spread: 70,+ origin: { x: 0, y: 0.6 },+ shapes: ["square"],+ scalar: 0.8,+ gravity: 0.6,+ decay: 0.93,+ });+ confettiRef.current?.fire({+ particleCount: 4,+ angle: 120,+ spread: 70,+ origin: { x: 1, y: 0.6 },+ shapes: ["square"],+ scalar: 0.8,+ gravity: 0.6,+ decay: 0.93,});++ if (Date.now() < end) {+ requestAnimationFrame(frame);+ }}+ frame();+const timer0 = setTimeout(() => {setShowText(true);}, 100);@@ -73,8 +97,8 @@ export default function Page() {return (<div className="flex h-screen w-screen flex-col items-center justify-center bg-violet-100">+ <Confetti ref={confettiRef} manualstart /><div- ref={divRef}className={cn("z-10 -mb-16 text-9xl duration-500",showText ? "opacity-100" : "opacity-0",diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsxindex 5a5bb514f3..b78933187a 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx@@ -18,7 +18,8 @@ import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";import { WalletIcon } from "@phosphor-icons/react";import { PopoverClose } from "@radix-ui/react-popover";import { X } from "lucide-react";-import * as party from "party-js";+import confetti, { type Options as ConfettiOptions } from "canvas-confetti";+import { AGPT_CONFETTI_COLORS } from "@/components/molecules/Confetti/Confetti";import { useCallback, useEffect, useMemo, useRef, useState } from "react";import { WalletRefill } from "./components/WalletRefill";import { TaskGroups } from "./components/WalletTaskGroups";@@ -206,16 +207,6 @@ export function Wallet() {fetchCredits();}, [state?.walletShown, updateState, fetchCredits]);- const fadeOut = useMemo(- () =>- new party.ModuleBuilder()- .drive("opacity")- .by((t) => 1 - t)- .through("lifetime")- .build(),- [],- );-// React to onboarding notifications emitted by the providerconst handleNotification = useCallback((notification: WebSocketNotification) => {@@ -245,16 +236,26 @@ export function Wallet() {return;}- party.confetti(walletRef.current, {- count: 30,- spread: 120,- shapes: ["square", "circle"],- size: party.variation.range(1, 2),- speed: party.variation.range(200, 300),- modules: [fadeOut],- });+ const origin = {+ x: (rect.left + rect.width / 2) / window.innerWidth,+ y: (rect.top + rect.height / 2) / window.innerHeight,+ };+ const shared: ConfettiOptions = {+ particleCount: 50,+ spread: 70,+ shapes: ["square"],+ scalar: 1.2,+ startVelocity: 20,+ gravity: 0.6,+ decay: 0.92,+ ticks: 100,+ colors: AGPT_CONFETTI_COLORS,+ origin,+ };+ confetti({ ...shared, angle: 45 });+ confetti({ ...shared, angle: 135 });},- [fetchCredits, fadeOut, groups],+ [fetchCredits, groups],);// WebSocket setup for onboarding notificationsdiff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsxindex 9b8471493b..418f86af02 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx@@ -1,7 +1,8 @@import { cn } from "@/lib/utils";import { useOnboarding } from "@/providers/onboarding/onboarding-provider";import { BadgeQuestionMark, Check, ChevronDown } from "lucide-react";-import * as party from "party-js";+import confetti, { type Options as ConfettiOptions } from "canvas-confetti";+import { AGPT_CONFETTI_COLORS } from "@/components/molecules/Confetti/Confetti";import { useCallback, useEffect, useRef, useState } from "react";import { Task, TaskGroup } from "../Wallet";@@ -84,20 +85,24 @@ export function TaskGroups({ groups }: Props) {const delayConfetti = useCallback((el: HTMLDivElement, count: number) => {setTimeout(() => {if (!el) return;- party.confetti(el, {- count,- spread: 90,- shapes: ["square", "circle"],- size: party.variation.range(1, 1.5),- speed: party.variation.range(250, 350),- modules: [- new party.ModuleBuilder()- .drive("opacity")- .by((t) => 1.4 - t)- .through("lifetime")- .build(),- ],- });+ const rect = el.getBoundingClientRect();+ const shared: ConfettiOptions = {+ particleCount: count,+ spread: 60,+ shapes: ["square"],+ scalar: 1.2,+ startVelocity: 22,+ gravity: 0.5,+ decay: 0.93,+ ticks: 120,+ colors: AGPT_CONFETTI_COLORS,+ origin: {+ x: (rect.left + rect.width / 2) / window.innerWidth,+ y: (rect.top + rect.height / 2) / window.innerHeight,+ },+ };+ confetti({ ...shared, angle: 45 });+ confetti({ ...shared, angle: 135 });}, 300);}, []);@@ -107,7 +112,7 @@ export function TaskGroups({ groups }: Props) {// Check if all tasks in the group were already celebrated// last task completed triggers group completionconst alreadyCelebrated = group.tasks.every((task) =>- state?.notified.includes(task.id),+ (state?.notified ?? []).includes(task.id),);if (groupCompleted) {@@ -127,7 +132,11 @@ export function TaskGroups({ groups }: Props) {group.tasks.forEach((task) => {const el = refs.current[task.id];- if (el && isTaskCompleted(task) && !state?.notified.includes(task.id)) {+ if (+ el &&+ isTaskCompleted(task) &&+ !(state?.notified ?? []).includes(task.id)+ ) {scrollIntoViewCentered(el);delayConfetti(el, 400);// Update the state to include the task as notifieddiff --git a/autogpt_platform/frontend/src/components/molecules/Confetti/Confetti.stories.tsx b/autogpt_platform/frontend/src/components/molecules/Confetti/Confetti.stories.tsxnew file mode 100644index 0000000000..d364228db1--- /dev/null+++ b/autogpt_platform/frontend/src/components/molecules/Confetti/Confetti.stories.tsx@@ -0,0 +1,354 @@+import type { Meta, StoryObj } from "@storybook/nextjs";+import { useEffect, useRef, useState } from "react";+import { Confetti } from "./Confetti";+import type { ConfettiRef } from "./Confetti";++const meta = {+ title: "Molecules/Confetti",+ component: Confetti,+ parameters: {+ layout: "fullscreen",+ },+ tags: ["autodocs"],+} satisfies Meta<typeof Confetti>;++export default meta;+type Story = StoryObj<typeof meta>;++function BasicCannonDemo() {+ const confettiRef = useRef<ConfettiRef>(null);++ function fire() {+ confettiRef.current?.fire({+ particleCount: 150,+ spread: 100,+ startVelocity: 40,+ scalar: 1.2,+ origin: { x: 0.5, y: 0.5 },+ });+ }++ return (+ <div className="flex h-screen flex-col items-center justify-center gap-6 bg-zinc-50">+ <Confetti ref={confettiRef} manualstart />+ <p className="text-sm text-zinc-500">+ Single burst from center of viewport+ </p>+ <button+ onClick={fire}+ className="rounded-lg bg-purple-500 px-8 py-3 text-base font-medium text-white shadow-md transition-colors hover:bg-purple-600 active:scale-95"+ >+ Fire Cannon+ </button>+ </div>+ );+}++export const BasicCannon: Story = {+ render: () => <BasicCannonDemo />,+};++function RandomDirectionDemo() {+ const confettiRef = useRef<ConfettiRef>(null);++ function fire() {+ confettiRef.current?.fire({+ particleCount: 120,+ angle: Math.random() * 360,+ spread: 80,+ startVelocity: 45,+ scalar: 1.3,+ origin: { x: Math.random(), y: Math.random() * 0.6 + 0.2 },+ });+ }++ return (+ <div className="flex h-screen flex-col items-center justify-center gap-6 bg-zinc-50">+ <Confetti ref={confettiRef} manualstart />+ <p className="text-sm text-zinc-500">+ Random position and angle each click+ </p>+ <button+ onClick={fire}+ className="rounded-lg bg-purple-500 px-8 py-3 text-base font-medium text-white shadow-md transition-colors hover:bg-purple-600 active:scale-95"+ >+ Random Burst+ </button>+ </div>+ );+}++export const RandomDirection: Story = {+ render: () => <RandomDirectionDemo />,+};++function SideCannonsDemo() {+ const confettiRef = useRef<ConfettiRef>(null);++ function fireSideCannons() {+ confettiRef.current?.fire({+ particleCount: 120,+ angle: 60,+ spread: 70,+ startVelocity: 50,+ scalar: 1.2,+ origin: { x: 0, y: 0.5 },+ });+ confettiRef.current?.fire({+ particleCount: 120,+ angle: 120,+ spread: 70,+ startVelocity: 50,+ scalar: 1.2,+ origin: { x: 1, y: 0.5 },+ });+ }++ return (+ <div className="flex h-screen flex-col items-center justify-center gap-6 bg-zinc-50">+ <Confetti ref={confettiRef} manualstart />+ <p className="text-sm text-zinc-500">Dual cannons from left and right</p>+ <button+ onClick={fireSideCannons}+ className="rounded-lg bg-purple-500 px-8 py-3 text-base font-medium text-white shadow-md transition-colors hover:bg-purple-600 active:scale-95"+ >+ Fire Side Cannons+ </button>+ </div>+ );+}++export const SideCannons: Story = {+ render: () => <SideCannonsDemo />,+};++function FireworksDemo() {+ const confettiRef = useRef<ConfettiRef>(null);+ const [active, setActive] = useState(false);+ const rafRef = useRef<number>(0);++ useEffect(() => {+ return () => cancelAnimationFrame(rafRef.current);+ }, []);++ function startFireworks() {+ setActive(true);+ const duration = 3000;+ const end = Date.now() + duration;++ function frame() {+ confettiRef.current?.fire({+ particleCount: 8,+ angle: 60,+ spread: 70,+ startVelocity: 55,+ scalar: 1.2,+ origin: { x: 0, y: Math.random() * 0.4 + 0.4 },+ });+ confettiRef.current?.fire({+ particleCount: 8,+ angle: 120,+ spread: 70,+ startVelocity: 55,+ scalar: 1.2,+ origin: { x: 1, y: Math.random() * 0.4 + 0.4 },+ });++ if (Date.now() < end) {+ rafRef.current = requestAnimationFrame(frame);+ } else {+ setActive(false);+ }+ }++ frame();+ }++ return (+ <div className="flex h-screen flex-col items-center justify-center gap-6 bg-zinc-900">+ <Confetti ref={confettiRef} manualstart />+ <p className="text-sm text-zinc-400">Continuous stream from both sides</p>+ <button+ onClick={startFireworks}+ disabled={active}+ className="rounded-lg bg-purple-500 px-8 py-3 text-base font-medium text-white shadow-md transition-colors hover:bg-purple-600 active:scale-95 disabled:opacity-50"+ >+ {active ? "Fireworks..." : "Launch Fireworks"}+ </button>+ </div>+ );+}++export const Fireworks: Story = {+ render: () => <FireworksDemo />,+};++function CelebrationDemo() {+ const confettiRef = useRef<ConfettiRef>(null);+ const [celebrating, setCelebrating] = useState(false);+ const rafRef = useRef<number>(0);++ useEffect(() => {+ return () => cancelAnimationFrame(rafRef.current);+ }, []);++ function celebrate() {+ setCelebrating(true);++ // Initial big burst from top+ confettiRef.current?.fire({+ particleCount: 200,+ spread: 160,+ startVelocity: 45,+ scalar: 1.4,+ gravity: 0.8,+ origin: { x: 0.5, y: 0.2 },+ });++ // Then continuous side cannons+ const duration = 2500;+ const end = Date.now() + duration;++ function frame() {+ confettiRef.current?.fire({+ particleCount: 5,+ angle: 60,+ spread: 60,+ startVelocity: 50,+ scalar: 1.2,+ origin: { x: 0, y: 0.5 },+ });+ confettiRef.current?.fire({+ particleCount: 5,+ angle: 120,+ spread: 60,+ startVelocity: 50,+ scalar: 1.2,+ origin: { x: 1, y: 0.5 },+ });++ if (Date.now() < end) {+ rafRef.current = requestAnimationFrame(frame);+ } else {+ setCelebrating(false);+ }+ }++ rafRef.current = requestAnimationFrame(frame);+ }++ return (+ <div className="flex h-screen flex-col items-center justify-center gap-4 bg-purple-50">+ <Confetti ref={confettiRef} manualstart />+ <h1 className="font-poppins text-7xl font-medium tracking-tighter text-purple-700">+ Congrats!+ </h1>+ <p className="text-lg text-purple-500">+ AutoGPT purple-themed celebration+ </p>+ <button+ onClick={celebrate}+ disabled={celebrating}+ className="mt-4 rounded-lg bg-purple-500 px-8 py-3 text-base font-medium text-white shadow-md transition-colors hover:bg-purple-600 active:scale-95 disabled:opacity-50"+ >+ {celebrating ? "Celebrating..." : "Celebrate!"}+ </button>+ </div>+ );+}++export const Celebration: Story = {+ render: () => <CelebrationDemo />,+};++function StarsDemo() {+ const confettiRef = useRef<ConfettiRef>(null);++ function fireStars() {+ confettiRef.current?.fire({+ particleCount: 100,+ spread: 180,+ shapes: ["star"],+ scalar: 2,+ startVelocity: 35,+ gravity: 0.6,+ ticks: 300,+ origin: { x: 0.5, y: 0.4 },+ });+ }++ return (+ <div className="flex h-screen flex-col items-center justify-center gap-6 bg-purple-100">+ <Confetti ref={confettiRef} manualstart />+ <p className="text-sm text-purple-400">Large star-shaped confetti</p>+ <button+ onClick={fireStars}+ className="rounded-lg bg-purple-600 px-8 py-3 text-base font-medium text-white shadow-md transition-colors hover:bg-purple-700 active:scale-95"+ >+ Purple Stars+ </button>+ </div>+ );+}++export const Stars: Story = {+ render: () => <StarsDemo />,+};++function FullScreenShowerDemo() {+ const confettiRef = useRef<ConfettiRef>(null);+ const [active, setActive] = useState(false);+ const rafRef = useRef<number>(0);++ useEffect(() => {+ return () => cancelAnimationFrame(rafRef.current);+ }, []);++ function startShower() {+ setActive(true);+ const duration = 4000;+ const end = Date.now() + duration;++ function frame() {+ // Rain from random positions across the top+ confettiRef.current?.fire({+ particleCount: 6,+ angle: 270,+ spread: 40,+ startVelocity: 20,+ scalar: 1.5,+ gravity: 1.2,+ ticks: 400,+ origin: { x: Math.random(), y: 0 },+ });++ if (Date.now() < end) {+ rafRef.current = requestAnimationFrame(frame);+ } else {+ setActive(false);+ }+ }++ frame();+ }++ return (+ <div className="flex h-screen flex-col items-center justify-center gap-6 bg-zinc-50">+ <Confetti ref={confettiRef} manualstart />+ <p className="text-sm text-zinc-500">+ Confetti rain across the full viewport+ </p>+ <button+ onClick={startShower}+ disabled={active}+ className="rounded-lg bg-purple-500 px-8 py-3 text-base font-medium text-white shadow-md transition-colors hover:bg-purple-600 active:scale-95 disabled:opacity-50"+ >+ {active ? "Raining..." : "Confetti Shower"}+ </button>+ </div>+ );+}++export const FullScreenShower: Story = {+ render: () => <FullScreenShowerDemo />,+};diff --git a/autogpt_platform/frontend/src/components/molecules/Confetti/Confetti.tsx b/autogpt_platform/frontend/src/components/molecules/Confetti/Confetti.tsxnew file mode 100644index 0000000000..14dea25d02--- /dev/null+++ b/autogpt_platform/frontend/src/components/molecules/Confetti/Confetti.tsx@@ -0,0 +1,131 @@+"use client";++import type { ReactNode } from "react";+import React, {+ createContext,+ forwardRef,+ useEffect,+ useImperativeHandle,+ useMemo,+ useRef,+} from "react";+import type {+ GlobalOptions as ConfettiGlobalOptions,+ CreateTypes as ConfettiInstance,+ Options as ConfettiOptions,+} from "canvas-confetti";+import confetti from "canvas-confetti";++import * as Sentry from "@sentry/nextjs";+import { cn } from "@/lib/utils";++/** AutoGPT design system purple palette for confetti */+const AGPT_CONFETTI_COLORS = [+ "#7733f5", // purple-500+ "#925cf7", // purple-400+ "#a476f8", // purple-300+ "#c0a1fa", // purple-200+ "#6c2edf", // purple-600+ "#5424ae", // purple-700+ "#efe8fe", // purple-100+];++type Api = {+ fire: (options?: ConfettiOptions) => void;+};++interface Props extends React.ComponentPropsWithRef<"canvas"> {+ options?: ConfettiOptions;+ globalOptions?: ConfettiGlobalOptions;+ manualstart?: boolean;+ children?: ReactNode;+}++export type ConfettiRef = Api | null;++export const ConfettiContext = createContext<Api>({} as Api);++const ConfettiComponent = forwardRef<ConfettiRef, Props>(+ function Confetti(props, ref) {+ const {+ options,+ globalOptions,+ manualstart = false,+ children,+ className,+ ...rest+ } = props;++ const canvasElRef = useRef<HTMLCanvasElement | null>(null);+ const instanceRef = useRef<ConfettiInstance | null>(null);+ const hasAutoStartedRef = useRef(false);++ // Create the confetti instance once after mount via useEffect,+ // so React never re-fires a callback ref on re-renders.+ useEffect(() => {+ const node = canvasElRef.current;+ if (!node || instanceRef.current) return;++ const dpr = window.devicePixelRatio || 1;+ node.width = node.offsetWidth * dpr;+ node.height = node.offsetHeight * dpr;++ instanceRef.current = confetti.create(node, {+ resize: true,+ useWorker: false,+ ...globalOptions,+ });++ return () => {+ instanceRef.current?.reset();+ instanceRef.current = null;+ };+ }, []); // eslint-disable-line react-hooks/exhaustive-deps++ const fire = useMemo(+ () =>+ async (opts: ConfettiOptions = {}) => {+ try {+ await instanceRef.current?.({+ colors: AGPT_CONFETTI_COLORS,+ ...options,+ ...opts,+ });+ } catch (error) {+ Sentry.captureException(error);+ }+ },+ [options],+ );++ const api = useMemo(() => ({ fire }), [fire]);++ useImperativeHandle(ref, () => api, [api]);++ useEffect(() => {+ if (manualstart || hasAutoStartedRef.current) return;+ hasAutoStartedRef.current = true;+ void fire();+ }, [manualstart, fire]);++ return (+ <ConfettiContext.Provider value={api}>+ <canvas+ ref={canvasElRef}+ style={{ width: "100%", height: "100%" }}+ className={cn(+ "pointer-events-none fixed inset-0 z-50 h-full w-full",+ className,+ )}+ {...rest}+ />+ {children}+ </ConfettiContext.Provider>+ );+ },+);++ConfettiComponent.displayName = "Confetti";++export { ConfettiComponent as Confetti, AGPT_CONFETTI_COLORS };+export type { Props as ConfettiProps, ConfettiOptions };