1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.makeDefaultCSS = exports.injectCSS = void 0;
|
4 | const injected = {};
|
5 | const injectCSS = (css) => {
|
6 |
|
7 | if (typeof document === 'undefined') {
|
8 | return;
|
9 | }
|
10 | if (injected[css]) {
|
11 | return;
|
12 | }
|
13 | const head = document.head || document.getElementsByTagName('head')[0];
|
14 | const style = document.createElement('style');
|
15 | style.appendChild(document.createTextNode(css));
|
16 | head.appendChild(style);
|
17 | injected[css] = true;
|
18 | };
|
19 | exports.injectCSS = injectCSS;
|
20 | const makeDefaultCSS = (scope, backgroundColor) => {
|
21 | if (!scope) {
|
22 | return `
|
23 | * {
|
24 | box-sizing: border-box;
|
25 | }
|
26 | body {
|
27 | margin: 0;
|
28 | background-color: ${backgroundColor};
|
29 | }
|
30 | `;
|
31 | }
|
32 | return `
|
33 | ${scope} * {
|
34 | box-sizing: border-box;
|
35 | }
|
36 | ${scope} *:-webkit-full-screen {
|
37 | width: 100%;
|
38 | height: 100%;
|
39 | }
|
40 | `;
|
41 | };
|
42 | exports.makeDefaultCSS = makeDefaultCSS;
|