UNPKG

@web3auth/no-modal

Version:
19 lines (15 loc) 613 B
'use strict'; var auth = require('@web3auth/auth'); const htmlToElement = html => { const template = window.document.createElement("template"); const trimmedHtml = html.trim(); // Never return a text node of whitespace as the result template.innerHTML = trimmedHtml; return template.content.firstChild; }; const getTheme = theme => { if (theme === auth.THEME_MODES.light) return "light"; if (theme === auth.THEME_MODES.dark) return "dark"; return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; }; exports.getTheme = getTheme; exports.htmlToElement = htmlToElement;