import { useEffect, useState } from 'react' import { falcon } from 'falcon-neo/sdk' // Falcon's design system: real components, themed to the Falcon look. Check // the catalog (falcon_docs page:"catalog") before building any control. import { Button } from 'falcon-neo/ui' export function declareHue(value: number): void { falcon.param('hue', { label: 'Hue', type: 'range', value, min: 0, max: 360, step: 1, cssVar: '--poster-hue', hint: 'Slides the poster color around the color wheel.' }) } export function App(): React.JSX.Element { const [title, setTitle] = useState('Hello from __TOOL_NAME__') useEffect(() => { // falcon.store is the tool's document: save on change, restore on load. // Declaring is idempotent, so re-declaring the param with the restored // value keeps the inspector in sync with what the poster shows. const declareTitle = (value: string): void => { falcon.param('title', { label: 'Title', type: 'text', value, hint: 'The big words in the middle of the poster.', onChange: (next) => { const text = String(next) setTitle(text) falcon.store.set({ title: text }) // save on change (SDK debounces) } }) } declareTitle('Hello from __TOOL_NAME__') // Restore on load: get() resolves with the saved doc (null on first run). void falcon.store.get().then((doc) => { const saved = (doc as { title?: string } | null)?.title if (typeof saved === 'string') { setTitle(saved) declareTitle(saved) // re-declare so the inspector matches } }) // This effect only declares; declaring again on re-render would be fine too. // eslint-disable-next-line react-hooks/exhaustive-deps }, []) const shuffleHue = (): void => { const next = Math.floor(Math.random() * 360) // cssVar params live on :root; set it and re-declare so the inspector // slider follows (declarations are idempotent updates, never duplicates). document.documentElement.style.setProperty('--poster-hue', String(next)) declareHue(next) falcon.sound('tap') } return (