From 26e0c2be60f06927bd76af1210786c7dee48bb66 Mon Sep 17 00:00:00 2001 From: David Montero Crespo Date: Tue, 5 May 2026 10:34:43 -0300 Subject: [PATCH] feat(components): add mergeComponents API to ComponentRegistry Forgotten in the prior commit (case-mismatch on Windows tracked the wrong filename). Adds the public method overlays use to splice extra components into the picker after default-metadata load. Components with an existing id are replaced; new ones are appended. --- frontend/src/services/ComponentRegistry.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/frontend/src/services/ComponentRegistry.ts b/frontend/src/services/ComponentRegistry.ts index 1c7800e8..b4097699 100644 --- a/frontend/src/services/ComponentRegistry.ts +++ b/frontend/src/services/ComponentRegistry.ts @@ -176,6 +176,23 @@ export class ComponentRegistry { return [...this.allComponents]; } + /** + * Merge additional components into the registry from an external source. + * + * Used by private overlays (e.g. the velxio.dev pro overlay) to add + * premium components after the default `/components-metadata.json` has + * loaded. Components with an existing `id` are replaced; new ones are + * appended. Categories and search index are rebuilt. + */ + mergeComponents(extras: ComponentMetadata[]): void { + if (!extras || extras.length === 0) return; + const byId = new Map(this.allComponents.map((c) => [c.id, c])); + for (const extra of extras) { + byId.set(extra.id, extra); + } + this.processMetadata(Array.from(byId.values())); + } + /** * Get components by category */