ant-design-x-vue-next
Version:
Ant Design X for Vue — community continuation aligned with @ant-design/x
2 lines (1 loc) • 1.04 kB
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=new Map;function s(e){const t=e.$id||e.catalogId;t&&r.set(t,e)}async function l(e,t){if(r.has(e))return r.get(e);if(e.startsWith("local://"))return console.warn(`Local catalog "${e}" not registered. Use registerCatalog() to register it.`),{$id:e,components:{}};if(!(!t||t.length===0||t.includes(e)))throw new Error(`[XCard] Catalog "${e}" is not in allowedCatalogIds. Rejecting remote fetch for security.`);const o=await fetch(e);if(!o.ok)throw new Error(`Failed to load catalog from ${e}: ${o.statusText}`);const n=await o.json();return r.set(e,n),n}function c(e,t,i){var n;const o=(n=e.components)==null?void 0:n[t];if(!o)return console.warn(`Component "${t}" not found in catalog`),!1;if(o.required){for(const a of o.required)if(!(a in i))return console.warn(`Missing required field "${a}" for component "${t}"`),!1}return!0}function f(){r.clear()}exports.clearCatalogCache=f;exports.loadCatalog=l;exports.registerCatalog=s;exports.validateComponent=c;