A fast, local-first "redirection engine" for !bang users with a few extra features ^-^

chore: prevent style flashes and add dark theme

+2 -1
index.html
···
media="print"
onload="this.media='all'"
/>
+
<link rel="stylesheet" href="/global.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Unduck</title>
<meta
···
content="A better default search engine (with bangs!)"
/>
</head>
-
<body style="background-color: transparent">
+
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
+17 -1
public/clipboard-check.svg
···
-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-clipboard-check"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><path d="m9 14 2 2 4-4"/></svg>
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-clipboard-check">
+
<style>
+
@media (prefers-color-scheme: light) {
+
.lucide-clipboard-check {
+
stroke: #1a1a1a;
+
}
+
}
+
@media (prefers-color-scheme: dark) {
+
.lucide-clipboard-check {
+
stroke: #e0e0e0;
+
}
+
}
+
</style>
+
<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/>
+
<path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>
+
<path d="m9 14 2 2 4-4"/>
+
</svg>
+16 -1
public/clipboard.svg
···
-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-clipboard"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/></svg>
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-clipboard">
+
<style>
+
@media (prefers-color-scheme: light) {
+
.lucide-clipboard {
+
stroke: #1a1a1a;
+
}
+
}
+
@media (prefers-color-scheme: dark) {
+
.lucide-clipboard {
+
stroke: #e0e0e0;
+
}
+
}
+
</style>
+
<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/>
+
<path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>
+
</svg>
+176
public/global.css
···
+
/* @import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"); */
+
+
/* Font fallback that closely matches Inter metrics */
+
@font-face {
+
font-family: "Inter Fallback";
+
size-adjust: 107%;
+
ascent-override: 90%;
+
src: local("Arial");
+
}
+
+
:root {
+
font-family:
+
Inter,
+
"Inter Fallback",
+
system-ui,
+
-apple-system,
+
BlinkMacSystemFont,
+
"Segoe UI",
+
Roboto,
+
Oxygen,
+
Ubuntu,
+
Cantarell,
+
"Open Sans",
+
"Helvetica Neue",
+
sans-serif;
+
font-synthesis: none;
+
text-rendering: optimizeLegibility;
+
-webkit-font-smoothing: antialiased;
+
-moz-osx-font-smoothing: grayscale;
+
+
/* Light mode colors */
+
--text-color: #1a1a1a;
+
--text-color-secondary: #666;
+
--text-color-hover: #333;
+
--bg-color: #fff;
+
--bg-color-secondary: #f5f5f5;
+
--bg-color-hover: #f0f0f0;
+
--bg-color-active: #e5e5e5;
+
--border-color: #ddd;
+
}
+
+
@media (prefers-color-scheme: dark) {
+
:root {
+
--text-color: #e0e0e0;
+
--text-color-secondary: #999;
+
--text-color-hover: #fff;
+
--bg-color: #121212;
+
--bg-color-secondary: #1e1e1e;
+
--bg-color-hover: #2a2a2a;
+
--bg-color-active: #333;
+
--border-color: #444;
+
}
+
}
+
+
* {
+
margin: 0;
+
padding: 0;
+
box-sizing: border-box;
+
}
+
+
html,
+
body {
+
height: 100%;
+
width: 100%;
+
}
+
+
body {
+
line-height: 1.5;
+
font-weight: 400;
+
font-size: 16px;
+
color: var(--text-color);
+
background-color: var(--bg-color);
+
}
+
+
h1,
+
h2,
+
h3,
+
h4,
+
h5,
+
h6 {
+
font-weight: 600;
+
line-height: 1.2;
+
padding: 0.75rem;
+
}
+
+
a {
+
color: var(--text-color-secondary);
+
}
+
a:hover {
+
color: var(--text-color-hover);
+
}
+
+
button {
+
font: inherit;
+
border: none;
+
background: none;
+
cursor: pointer;
+
}
+
+
input,
+
textarea {
+
font: inherit;
+
}
+
+
/* Add these new styles */
+
.url-container {
+
display: flex;
+
align-items: center;
+
gap: 8px;
+
margin-top: 16px;
+
}
+
+
/* Add this new style */
+
.content-container {
+
max-width: 37rem;
+
text-align: center;
+
padding: 0 8px;
+
}
+
+
/* Update url-input width to be 100% since container will control max width */
+
.url-input {
+
padding: 8px 12px;
+
border: 1px solid var(--border-color);
+
border-radius: 4px;
+
width: 100%;
+
background: var(--bg-color-secondary);
+
color: var(--text-color);
+
}
+
+
.copy-button {
+
padding: 8px;
+
color: var(--text-color-secondary);
+
border-radius: 4px;
+
transition: all 0.2s;
+
display: flex;
+
align-items: center;
+
justify-content: center;
+
}
+
+
.copy-button:hover {
+
background: var(--bg-color-hover);
+
}
+
+
.copy-button:active {
+
background: var(--bg-color-active);
+
}
+
+
.copy-button img {
+
width: 20px;
+
height: 20px;
+
}
+
+
.copy-button.copied {
+
background: #28a745;
+
}
+
+
/* Add footer styles */
+
.footer {
+
position: fixed;
+
bottom: 16px;
+
left: 0;
+
right: 0;
+
text-align: center;
+
font-size: 14px;
+
color: var(--text-color-secondary);
+
}
+
+
.footer a {
+
color: var(--text-color-secondary);
+
text-decoration: none;
+
font-weight: 500;
+
}
+
+
.footer a:hover {
+
color: var(--text-color-hover);
+
}
-1
public/search.svg
···
<?xml version="1.0" encoding="UTF-8"?>
<svg width="1200pt" height="1200pt" version="1.1" viewBox="0 0 1200 1200" xmlns="http://www.w3.org/2000/svg">
-
<rect width="1200" height="1200" fill="black"/>
<path fill="white" d="m980.48 905.76-198.84-199.08c89.203-125.34 77.953-300.14-34.406-412.64-125.26-125.44-328.03-125.44-453.32 0-125.26 125.44-125.26 328.45 0 453.84 112.36 112.5 286.97 123.74 412.18 34.406l198.84 199.08c53.25 53.297 132.05-19.078 75.562-75.609zm-610.87-233.58c-83.391-83.531-83.391-218.86 0-302.39s218.58-83.531 302.02 0c83.391 83.531 83.391 218.86 0 302.39-83.438 83.484-218.63 83.484-302.02 0z"/>
</svg>
-151
src/global.css
···
-
/* @import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"); */
-
-
/* Font fallback that closely matches Inter metrics */
-
@font-face {
-
font-family: "Inter Fallback";
-
size-adjust: 107%;
-
ascent-override: 90%;
-
src: local("Arial");
-
}
-
-
:root {
-
font-family:
-
Inter,
-
"Inter Fallback",
-
system-ui,
-
-apple-system,
-
BlinkMacSystemFont,
-
"Segoe UI",
-
Roboto,
-
Oxygen,
-
Ubuntu,
-
Cantarell,
-
"Open Sans",
-
"Helvetica Neue",
-
sans-serif;
-
font-synthesis: none;
-
text-rendering: optimizeLegibility;
-
-webkit-font-smoothing: antialiased;
-
-moz-osx-font-smoothing: grayscale;
-
}
-
-
* {
-
margin: 0;
-
padding: 0;
-
box-sizing: border-box;
-
}
-
-
html,
-
body {
-
height: 100%;
-
width: 100%;
-
}
-
-
body {
-
line-height: 1.5;
-
font-weight: 400;
-
font-size: 16px;
-
color: #1a1a1a;
-
}
-
-
h1,
-
h2,
-
h3,
-
h4,
-
h5,
-
h6 {
-
font-weight: 600;
-
line-height: 1.2;
-
padding: 0.75rem;
-
}
-
-
a {
-
color: #444444;
-
}
-
a:hover {
-
color: #888888;
-
}
-
-
button {
-
font: inherit;
-
border: none;
-
background: none;
-
cursor: pointer;
-
}
-
-
input,
-
textarea {
-
font: inherit;
-
}
-
-
/* Add these new styles */
-
.url-container {
-
display: flex;
-
align-items: center;
-
gap: 8px;
-
margin-top: 16px;
-
}
-
-
/* Add this new style */
-
.content-container {
-
max-width: 37rem;
-
text-align: center;
-
padding: 0 8px;
-
}
-
-
/* Update url-input width to be 100% since container will control max width */
-
.url-input {
-
padding: 8px 12px;
-
border: 1px solid #ddd;
-
border-radius: 4px;
-
width: 100%;
-
background: #f5f5f5;
-
}
-
-
.copy-button {
-
padding: 8px;
-
color: #666;
-
border-radius: 4px;
-
transition: all 0.2s;
-
display: flex;
-
align-items: center;
-
justify-content: center;
-
}
-
-
.copy-button:hover {
-
background: #f0f0f0;
-
}
-
-
.copy-button:active {
-
background: #e5e5e5;
-
}
-
-
.copy-button img {
-
width: 20px;
-
height: 20px;
-
}
-
-
.copy-button.copied {
-
background: #28a745;
-
}
-
-
/* Add footer styles */
-
.footer {
-
position: fixed;
-
bottom: 16px;
-
left: 0;
-
right: 0;
-
text-align: center;
-
font-size: 14px;
-
color: #666;
-
}
-
-
.footer a {
-
color: #666;
-
text-decoration: none;
-
font-weight: 500;
-
}
-
-
.footer a:hover {
-
color: #333;
-
}
-1
src/main.ts
···
import { bangs } from "./bang";
-
import "./global.css";
function noSearchDefaultPageRender() {
const app = document.querySelector<HTMLDivElement>("#app");