MCPcopy
hub / github.com/CopilotKit/CopilotKit / createSlotRenderer

Function createSlotRenderer

packages/angular/src/lib/slots/slot.utils.ts:277–306  ·  view source on GitHub ↗
(
  defaultComponent: Type<T>,
  slotName?: string,
)

Source from the content-addressed store, hash-verified

275 * ```
276 */
277export function createSlotRenderer<T>(
278 defaultComponent: Type<T>,
279 slotName?: string,
280) {
281 // Get config in the injection context when the renderer is created
282 const config = slotName ? getSlotConfig() : null;
283
284 return (
285 viewContainer: ViewContainerRef,
286 slot?: SlotValue<T>,
287 props?: Partial<T>,
288 outputs?: Record<string, (event: any) => void>,
289 ) => {
290 // Check DI for overrides if slot name provided
291 if (slotName && !slot && config) {
292 const entry = config.get(slotName);
293 if (entry) {
294 if (entry.component) slot = entry.component;
295 else if (entry.template) slot = entry.template;
296 }
297 }
298
299 return renderSlot(viewContainer, {
300 slot,
301 defaultComponent,
302 props,
303 outputs,
304 });
305 };
306}

Callers 1

slot.utils.spec.tsFile · 0.90

Calls 3

getSlotConfigFunction · 0.85
renderSlotFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…