UNPKG

code-workshop-kit

Version:
25 lines 979 B
import { applyPolyfill } from 'custom-elements-hmr-polyfill'; import { setCustomCSSProps } from './setCustomCSSProps'; import { ParticipantFrontendCapsule } from './ParticipantFrontendCapsule'; import './cwk-participant-terminal-capsule'; import './cwk-participant-frontend-capsule'; export const setCapsule = (name, opts) => { const { module = true, target = 'frontend' } = opts; setCustomCSSProps(); if (target === 'frontend') { window.HMR_SKIP_DEEP_PATCH = true; applyPolyfill(); } if (target === 'terminal') { document.body.style.setProperty('margin', '20px'); } const capsule = document.createElement(`cwk-participant-${target}-capsule`); capsule.name = name; capsule.noHeader = true; capsule.noContainer = true; if (capsule instanceof ParticipantFrontendCapsule) { capsule.mode = module ? 'module' : 'iframe'; } document.body.appendChild(capsule); }; //# sourceMappingURL=setCapsule.js.map