import { type Env, type Schema } from 'hono' import { routes as devRoutes } from './dev/routes.js' import { FarcBase, type FrameHandlerReturnType, type FrameOptions, } from './farc-base.js' import { type FrameContext } from './types.js' /** * A Farc instance. * * @param parameters - {@link FarcConstructorParameters} * @returns instance. {@link FarcBase} * * @example * ``` * import { Farc } from 'farc' * * const app = new Farc() * * app.frame('/', (context) => { * const { buttonValue, inputText, status } = context * const fruit = inputText || buttonValue * return { * image: ( *
* {fruit ? `You selected: ${fruit}` : 'Welcome!'} *
* ), * intents: [ * , * , * , * ] * } * }) * ``` */ export class Farc< state = undefined, env extends Env = Env, schema extends Schema = {}, basePath extends string = '/', > extends FarcBase { override frame( path: path, handler: ( context: FrameContext, ) => FrameHandlerReturnType | Promise, options: FrameOptions = {}, ) { super.frame(path, handler, options) devRoutes(this, path) } }