UNPKG

@descope/sdk-mixins

Version:
35 lines (32 loc) 1.24 kB
import { createSingletonMixin, compose } from '@descope/sdk-helpers'; import { injectStyleMixin } from './injectStyleMixin.js'; const CONTENT_ROOT_ID = 'content-root'; const ROOT_ID = 'root'; const initElementMixin = createSingletonMixin((superclass) => { const BaseClass = compose(injectStyleMixin)(superclass); return class InitElementMixinClass extends BaseClass { constructor(...rest) { var _a, _b; super(...rest); this.attachShadow({ mode: 'open' }).innerHTML = ` <div id="${ROOT_ID}"> <div id="${CONTENT_ROOT_ID}"></div> </div> `; this.injectStyle(` #${ROOT_ID}, #${CONTENT_ROOT_ID} { height: 100%; } #${ROOT_ID} { position: relative; height: fit-content; } `); this.contentRootElement = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById(CONTENT_ROOT_ID); this.rootElement = (_b = this.shadowRoot) === null || _b === void 0 ? void 0 : _b.getElementById(ROOT_ID); } }; }); export { initElementMixin }; //# sourceMappingURL=initElementMixin.js.map