</header>
<main>
- <input value="🏴☠️"></input>
+ <input></input>
<div id="visualizations"></div>
</main>
padding: 4px;
animation: 800ms fadeIn both;
transition: filter 800ms;
+ position: relative;
}
:host(:hover),
filter: drop-shadow(0 0 4px hsl(222deg 50% 50%));
transition: filter 400ms;
}
+
+ :host::before {
+ content: "\a Unicode code point \a Code point in binary \a UTF-8";
+ position: absolute;
+ top: 0;
+ left: 0;
+ transform: translateX(calc(-100% - 8px));
+ white-space: pre;
+ display: none;
+ }
+
+ :is(:host(:hover), :host(:focus-within))::before {
+ display: block;
+ }
::slotted(*) {
animation-name: slideIn, fadeIn;
}
function handleChange(value) {
+ // Update URL with the input but do not spam the history
+ const url = new URL(`?q=${value}`, window.location.origin);
+ window.history.replaceState({}, '', url);
+
const output = calculateOutput(value);
render(output);
}
input.addEventListener('input', e => handleChange(e.target.value));
+input.value = new URL(document.location).searchParams.get('q') ?? '🏴☠️';
handleChange(input.value); // Render the default value on first load