import { cloneBinding } from './componentBindingHelpers' import { templateComponentBindings } from './componentBindingCatalog' import type { BioTemplateComponentPropsBinding, } from './componentBindings' import type { TemplateId } from './types' export function propsBinding( templateId: TemplateId, component: string, propsObject: Record ): BioTemplateComponentPropsBinding { const matched = templateComponentBindings[templateId].find(binding => binding.component === component) if (!matched) { throw new Error(`No component binding registered for '${templateId}' and '${component}'.`) } return { ...cloneBinding(matched), propsObject, } }