UNPKG

dap-design-system

Version:

Official design system for the DÁP (dap.gov.hu)

115 lines (114 loc) 2.99 kB
var S = (o, u, l) => new Promise((m, c) => { var d = (t) => { try { p(l.next(t)); } catch (r) { c(r); } }, a = (t) => { try { p(l.throw(t)); } catch (r) { c(r); } }, p = (t) => t.done ? m(t.value) : Promise.resolve(t.value).then(d, a); p((l = l.apply(o, u)).next()); }); let f; function $(o) { var u, l; return typeof o == "function" && !((u = o.prototype) != null && u.$$set) && !((l = o.prototype) != null && l.$destroy); } function w(o) { if (o) return o instanceof Map ? o : new Map(Object.entries(o)); } function C(o, u) { const m = ((e) => typeof e == "object" && e !== null && "component" in e && typeof e.component != "undefined")(o) ? o : { component: o, props: u }, { component: c, props: d, on: a, context: p } = m; let t = null, r = !1; const b = (e, n) => { const i = { target: e, props: d || {} }; n && (i.context = n), t = new c(i), a && t && Object.entries(a).forEach(([s, E]) => { typeof t.$on == "function" && t.$on(s, E); }); }, v = () => f !== void 0 ? f : null, h = () => S(null, null, function* () { if (f !== void 0) return f; try { const n = yield new Function( "moduleName", "return import(moduleName)" )("svelte"); if (n && typeof n.mount == "function" && typeof n.unmount == "function") return f = n, n; } catch (e) { } return f = null, null; }), y = (e, n) => { const i = w(p); if (r = $(c), r && n) { const s = { target: e, props: d || {} }; i && (s.context = i), t = n.mount(c, s); } else if (!r) b(e, i); else throw new Error( "Svelte 5 component detected but svelte module not available" ); }; return { render: (e) => { try { if (r = $(c), r) { const n = v(); n ? y(e, n) : h().then((i) => { try { y(e, i); } catch (s) { console.error( "Error mounting Svelte component in datatable cell:", s ), e.textContent = "Error rendering cell"; } }); } else y(e, null); } catch (n) { console.error( "Error mounting Svelte component in datatable cell:", n ), e.textContent = "Error rendering cell"; } }, cleanup: () => { if (t !== null) try { if (r) { const e = v(); e && typeof e.unmount == "function" ? e.unmount(t) : typeof t.$destroy == "function" && t.$destroy(); } else typeof t.$destroy == "function" && t.$destroy(); } catch (e) { console.error( "Error unmounting Svelte component in datatable cell:", e ); } finally { t = null; } } }; } export { C as createSvelteCell }; //# sourceMappingURL=svelte.js.map