Svelte deployment adapters, new nav, new light theme, and adds robots

This commit is contained in:
Alicia Sykes committed 2025-09-14 21:50:09 +01:00
1 parent 24485a43ea
commit 08fc6d670d
8 files changed
+3648 -425

No files matched your search

+3029 -387
View File
File diff suppressed because it is too large. Load diff
+21 -2
View File
@@ -9,19 +9,38 @@
"preview": "vite preview",
"prepare": "svelte-kit sync || echo ''",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"test": "NODE_OPTIONS='--max_old_space_size=8192' vitest",
"test:ui": "NODE_OPTIONS='--max_old_space_size=8192' vitest --ui",
"test:coverage": "NODE_OPTIONS='--max_old_space_size=8192' vitest --coverage",
"test:e2e": "NODE_OPTIONS='--max_old_space_size=8192' playwright test",
"test:e2e:ui": "NODE_OPTIONS='--max_old_space_size=8192' playwright test --ui"
},
"devDependencies": {
"@axe-core/playwright": "^4.10.2",
"@playwright/test": "^1.55.0",
"@sveltejs/adapter-auto": "^6.0.0",
"@sveltejs/adapter-netlify": "^5.2.3",
"@sveltejs/adapter-node": "^5.3.2",
"@sveltejs/adapter-static": "^3.0.9",
"@sveltejs/adapter-vercel": "^5.10.2",
"@sveltejs/kit": "^2.22.0",
"@sveltejs/vite-plugin-svelte": "^6.0.0",
"@testing-library/jest-dom": "^6.8.0",
"@testing-library/svelte": "^5.2.8",
"@testing-library/user-event": "^14.6.1",
"@vitest/coverage-v8": "^3.2.4",
"@vitest/ui": "^3.2.4",
"autoprefixer": "^10.4.21",
"jsdom": "^26.1.0",
"lucide-svelte": "^0.542.0",
"msw": "^2.11.2",
"sass-embedded": "^1.91.0",
"svelte": "^5.0.0",
"svelte-check": "^4.0.0",
"typescript": "^5.0.0",
"vite": "^7.0.4"
"vite": "^7.0.4",
"vitest": "^3.2.4"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
+66 -14
View File
@@ -1,16 +1,14 @@
<script lang="ts">
import { page } from '$app/stores';
import { TOP_NAV, isActive } from '$lib/constants/nav';
import { site } from '$lib/constants/site';
import favicon from '$lib/assets/favicon.svg';
import Icon from '$lib/components/global/Icon.svelte';
import GlobalSearch from '$lib/components/global/GlobalSearch.svelte';
import BurgerMenu from '$lib/components/furniture/BurgerMenu.svelte';
import TopNav from '$lib/components/furniture/TopNav.svelte';
// Props from +layout for theme state & toggler
export let darkMode: boolean;
export let toggleTheme: () => void;
$: currentPath = $page.url.pathname;
</script>
<svelte:head>
@@ -33,17 +31,7 @@
</div>
<div class="header-actions">
<nav class="nav-links" aria-label="Primary">
{#each TOP_NAV as item}
<a
href={item.href}
class="nav-link {isActive(currentPath, item.href) ? 'active' : ''}"
aria-current={isActive(currentPath, item.href) ? 'page' : undefined}
>
{item.label}
</a>
{/each}
</nav>
<TopNav />
<div class="header-buttons">
<GlobalSearch />
@@ -74,3 +62,67 @@
</div>
</div>
</header>
<style lang="scss">
.header-actions {
display: flex;
align-items: center;
gap: var(--spacing-md);
}
.header-buttons {
display: flex;
align-items: center;
gap: var(--spacing-sm);
}
.theme-toggle {
position: relative;
width: 3rem;
height: 1.5rem;
background: var(--bg-tertiary);
border: 1px solid var(--border-primary);
border-radius: 1rem;
cursor: pointer;
transition: all 0.2s ease;
&:hover {
background: var(--surface-hover);
}
&.dark {
background: var(--color-primary);
border-color: var(--color-primary);
}
}
.toggle-slider {
position: absolute;
top: 1px;
left: 1px;
width: 1.25rem;
height: 1.25rem;
background: var(--bg-primary);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
transition: transform 0.2s ease;
box-shadow: var(--shadow-sm);
svg {
width: 0.75rem;
height: 0.75rem;
color: var(--text-secondary);
}
.dark & {
transform: translateX(1.5rem);
background: var(--bg-primary);
svg {
color: var(--color-primary);
}
}
}
</style>
+404
View File
@@ -0,0 +1,404 @@
<script lang="ts">
import { page } from '$app/stores';
import { TOP_NAV, SUB_NAV, isActive, type NavItem, type NavGroup } from '$lib/constants/nav';
import Icon from '$lib/components/global/Icon.svelte';
$: currentPath = $page.url.pathname;
let activeDropdown: string | null = null;
let activeSubDropdown: string | null = null;
let timeoutId: number | null = null;
let subTimeoutId: number | null = null;
function showDropdown(href: string) {
if (timeoutId) clearTimeout(timeoutId);
timeoutId = window.setTimeout(() => {
activeDropdown = href;
}, 800);
}
function hideDropdown() {
if (timeoutId) clearTimeout(timeoutId);
timeoutId = window.setTimeout(() => {
activeDropdown = null;
activeSubDropdown = null;
}, 200);
}
function keepDropdown() {
if (timeoutId) clearTimeout(timeoutId);
}
function showSubDropdown(groupTitle: string) {
if (subTimeoutId) clearTimeout(subTimeoutId);
subTimeoutId = window.setTimeout(() => {
activeSubDropdown = groupTitle;
}, 300);
}
function hideSubDropdown() {
if (subTimeoutId) clearTimeout(subTimeoutId);
subTimeoutId = window.setTimeout(() => {
activeSubDropdown = null;
}, 200);
}
function keepSubDropdown() {
if (subTimeoutId) clearTimeout(subTimeoutId);
}
function hasSubPages(href: string): boolean {
return href in SUB_NAV;
}
function getSubPages(href: string): (NavItem | NavGroup)[] {
return SUB_NAV[href] || [];
}
function isNavGroup(item: NavItem | NavGroup): item is NavGroup {
return 'title' in item && 'items' in item;
}
</script>
<nav class="top-nav" aria-label="Primary navigation">
{#each TOP_NAV as item}
<div
class="nav-item"
class:has-dropdown={hasSubPages(item.href)}
role="presentation"
on:mouseenter={() => showDropdown(item.href)}
on:mouseleave={hideDropdown}
>
<a
href={item.href}
class="nav-link {isActive(currentPath, item.href) ? 'active' : ''}"
aria-current={isActive(currentPath, item.href) ? 'page' : undefined}
aria-expanded={activeDropdown === item.href}
aria-haspopup={hasSubPages(item.href)}
>
{item.label}
{#if hasSubPages(item.href)}
<svg class="dropdown-icon" width="12" height="12" viewBox="0 0 12 12" fill="none">
<path d="M3 4.5L6 7.5L9 4.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
{/if}
</a>
{#if hasSubPages(item.href) && activeDropdown === item.href}
<div
class="dropdown-container"
role="menu"
tabindex="-1"
on:mouseenter={keepDropdown}
on:mouseleave={hideDropdown}
>
<div class="primary-dropdown">
<div class="primary-content">
{#each getSubPages(item.href) as subItem}
{#if 'href' in subItem}
<!-- Direct nav item -->
<a
href={subItem.href}
class="dropdown-link {isActive(currentPath, subItem.href) ? 'active' : ''}"
aria-current={isActive(currentPath, subItem.href) ? 'page' : undefined}
>
<div class="link-content">
{#if subItem.icon}<Icon name={subItem.icon} size="sm" />{/if}
<span class="link-title">{subItem.label}</span>
</div>
{#if subItem.description}
<span class="link-description">{subItem.description}</span>
{/if}
</a>
{:else if 'title' in subItem}
<!-- Nav group with secondary dropdown -->
<div
class="nav-group"
class:has-secondary={subItem.items.length > 0}
role="menuitem"
on:mouseenter={() => showSubDropdown(subItem.title)}
on:mouseleave={hideSubDropdown}
>
<div class="group-title">
{subItem.title}
{#if subItem.items.length > 0}
<svg class="secondary-icon" width="12" height="12" viewBox="0 0 12 12" fill="none">
<path d="M4.5 3L7.5 6L4.5 9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
{/if}
</div>
</div>
{/if}
{/each}
</div>
</div>
<!-- Secondary dropdowns positioned outside primary container -->
{#each getSubPages(item.href) as subItem}
{#if 'title' in subItem && activeSubDropdown === subItem.title && subItem.items.length > 0}
<div
class="secondary-dropdown"
role="menu"
tabindex="-1"
on:mouseenter={keepSubDropdown}
on:mouseleave={hideSubDropdown}
>
<div class="secondary-content">
{#each subItem.items as groupItem}
<a
href={groupItem.href}
class="dropdown-link {isActive(currentPath, groupItem.href) ? 'active' : ''}"
aria-current={isActive(currentPath, groupItem.href) ? 'page' : undefined}
>
<div class="link-content">
{#if groupItem.icon}<Icon name={groupItem.icon} size="sm" />{/if}
<span class="link-title">{groupItem.label}</span>
</div>
{#if groupItem.description}
<span class="link-description">{groupItem.description}</span>
{/if}
</a>
{/each}
</div>
</div>
{/if}
{/each}
</div>
{/if}
</div>
{/each}
</nav>
<style lang="scss">
.top-nav {
display: flex;
align-items: center;
gap: var(--spacing-sm);
}
.nav-item {
position: relative;
}
.nav-link {
display: flex;
align-items: center;
gap: 0.25rem;
padding: var(--spacing-sm) var(--spacing-sm) var(--spacing-sm) 0.75rem;
font-weight: 500;
color: var(--text-secondary);
text-decoration: none;
border-radius: var(--radius-md);
transition: all 0.2s ease;
.dropdown-icon {
opacity: 0.4;
}
&:hover {
color: var(--text-primary);
background: var(--surface-hover);
.dropdown-icon {
opacity: 1;
}
}
&.active {
color: var(--color-primary);
background: color-mix(in srgb, var(--color-primary), transparent 90%);
}
}
.dropdown-icon {
transition: transform 0.2s ease;
}
.has-dropdown .nav-link[aria-expanded="true"] .dropdown-icon {
transform: rotate(180deg);
opacity: 1;
}
.dropdown-container {
position: absolute;
top: 100%;
left: 0;
z-index: 5;
overflow: visible;
}
.primary-dropdown {
min-width: 20rem;
max-width: 24rem;
background: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-lg);
animation: dropdown-enter 0.15s ease-out;
transform-origin: top left;
overflow: visible;
}
@keyframes dropdown-enter {
from {
opacity: 0;
transform: scale(0.95) translateY(-0.5rem);
}
to {
opacity: 1;
transform: scale(1) translateY(0);
}
}
.primary-content {
padding: 0.5rem;
max-height: 80vh;
overflow-y: auto;
overflow-x: visible;
}
.dropdown-link {
display: flex;
align-items: flex-start;
flex-direction: column;
gap: 0.5rem;
padding: 0.5rem;
color: var(--text-primary);
text-decoration: none;
border-radius: var(--radius-md);
transition: background-color 0.15s ease;
:global(svg) {
flex-shrink: 0;
opacity: 0.7;
transition: all 0.2s ease;
}
&:hover {
background: var(--surface-hover);
:global(svg) {
opacity: 1;
transform: scale(1.05);
color: var(--color-primary);
}
}
&.active {
background: color-mix(in srgb, var(--color-primary), transparent 90%);
.link-title {
color: var(--color-primary);
}
:global(svg) {
opacity: 1;
color: var(--color-primary);
}
}
}
.link-content {
display: flex;
align-items: center;
gap: var(--spacing-sm);
}
.link-title {
font-weight: 500;
font-size: 0.875rem;
line-height: 1.25;
}
.link-description {
font-size: 0.75rem;
line-height: 1.25;
color: var(--text-secondary);
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.nav-group {
overflow: visible;
& + .nav-group {
margin-top: 0.75rem;
padding-top: 0.75rem;
border-top: 1px solid var(--border-secondary);
}
&.has-secondary {
cursor: pointer;
.group-title {
border-radius: var(--radius-md);
transition: background-color 0.15s ease;
&:hover {
background: var(--surface-hover);
}
}
}
}
.group-title {
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--text-secondary);
padding: 0.25rem 0.5rem 0.5rem;
display: flex;
align-items: center;
justify-content: space-between;
}
.secondary-icon {
transition: transform 0.2s ease;
opacity: 0.7;
}
.has-secondary:hover .secondary-icon {
transform: translateX(0.125rem);
opacity: 1;
}
.secondary-dropdown {
position: absolute;
top: 0;
left: calc(100% + 0.5rem);
min-width: 18rem;
max-width: 28rem;
background: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-lg);
z-index: 6;
animation: secondary-enter 0.15s ease-out;
transform-origin: left center;
pointer-events: auto;
white-space: normal;
}
@keyframes secondary-enter {
from {
opacity: 0;
transform: scale(0.95) translateX(-0.5rem);
}
to {
opacity: 1;
transform: scale(1) translateX(0);
}
}
.secondary-content {
padding: 0.5rem;
}
/* Mobile adjustments */
@media (max-width: 768px) {
.top-nav {
display: none;
}
}
</style>
+3 -3
View File
@@ -355,7 +355,7 @@ export const SUB_NAV: Record<string, (NavItem | NavGroup)[]> = {
label: 'A/AAAA Bulk Generator',
description: 'Bulk create A and AAAA record sets from IP lists with TTL and RRset controls',
icon: 'dns-a-records',
keywords: ['dns', 'a', 'aaaa', 'records', 'bulk', 'generator', 'ttl', 'rrset']
keywords: ['dns', 'A record', 'AAAA', 'records', 'bulk', 'generator', 'ttl', 'rrset']
},
{
href: '/dns/generators/cname-builder',
@@ -472,7 +472,7 @@ export const SUB_NAV: Record<string, (NavItem | NavGroup)[]> = {
label: 'DNS Record Validator',
description: 'Validate individual DNS resource record syntax (A/AAAA/CNAME/MX/TXT/SRV/CAA) with error detection',
icon: 'dns-record-validator',
keywords: ['dns', 'record', 'validator', 'syntax', 'a', 'aaaa', 'cname', 'mx', 'txt', 'srv', 'caa', 'validation']
keywords: ['dns', 'record', 'validator', 'syntax', 'A record', 'AAAA', 'CNAME', 'MX', 'TXT', 'SRV', 'CAA', 'validation']
},
{
href: '/dns/ttl-calculator',
@@ -580,7 +580,7 @@ export const SUB_NAV: Record<string, (NavItem | NavGroup)[]> = {
label: 'DNS Lookup',
description: 'Resolve DNS records (A, AAAA, CNAME, MX, TXT, NS, SOA, CAA) using various public resolvers or custom DNS servers',
icon: 'dns-lookup',
keywords: ['dns', 'lookup', 'resolver', 'a', 'aaaa', 'cname', 'mx', 'txt', 'ns', 'soa', 'caa', 'query']
keywords: ['dns', 'lookup', 'resolver', 'A record', 'AAAA', 'CNAME', 'MX', 'TXT', 'NS', 'SOA', 'CAA', 'query']
},
{
href: '/diagnostics/dns/reverse-lookup',
+9 -9
View File
@@ -75,8 +75,8 @@
/* Light theme */
.theme-light, html[data-theme="light"] {
/* Background colors */
--bg-primary: #ffffff;
--bg-secondary: #f6f8fa; /* cards */
--bg-primary: #f9f9f9;
--bg-secondary: #fff; /* cards */
--bg-tertiary: #eef2f6; /* subtle panels / code blocks */
/* Text colors (AA on light backgrounds) */
@@ -85,19 +85,19 @@
--text-tertiary: #6b7280; /* ~12:1 on white */
/* Primary brand (use *-dark for filled buttons) */
--color-primary: #0bd112; /* brand accent on light bg */
--color-primary-hover: #2cfa33; /* accent hover on light bg */
--color-primary-dark: #3f6212; /* button bg; 13.9:1 with white */
--color-primary: #267bff;
--color-primary-hover: #1164e4;
--color-primary-dark: #0f336b;
/* Action colors (chosen so white label text is AA) */
--color-success: #15803d; /* white text ≥ 13:1 */
--color-success-light: #e8f7ee; /* light tint for subtle states */
--color-success-light: #40DC6C;
--color-warning: #a16207; /* white text ≥ 7:1 */
--color-warning-light: #fff7d6; /* soft warning bg */
--color-warning-light: #BCBC1C;
--color-error: #b91c1c; /* white text ≥ 6.5:1 */
--color-error-light: #ffe3e3; /* soft error bg */
--color-error-light: #FF6E6E;
--color-info: #0369a1; /* white text ≥ 10.6:1 */
--color-info-light: #e1f3ff; /* soft info bg */
--color-info-light: #2CB5B5;
--color-purple: #7c3aed; /* works on white with white text in fills */
--color-pink: #db2777;
+51 -2
View File
@@ -1,3 +1,52 @@
# allow crawling everything by default
User-agent: *
Disallow:
Allow: /
# Sitemap
Sitemap: https://ip-calc.as93.net/sitemap.xml
# Crawl-delay for respectful crawling
Crawl-delay: 1
# Allow all common search engine bots
User-agent: Googlebot
Allow: /
User-agent: Bingbot
Allow: /
User-agent: Slurp
Allow: /
User-agent: DuckDuckBot
Allow: /
User-agent: Baiduspider
Allow: /
User-agent: YandexBot
Allow: /
User-agent: facebookexternalhit
Allow: /
User-agent: Twitterbot
Allow: /
User-agent: LinkedInBot
Allow: /
# Block AI training crawlers (optional - uncomment if desired)
# User-agent: GPTBot
# Disallow: /
#
# User-agent: ChatGPT-User
# Disallow: /
#
# User-agent: CCBot
# Disallow: /
#
# User-agent: Claude-Web
# Disallow: /
#
# User-agent: anthropic-ai
# Disallow: /
+65 -8
View File
@@ -1,17 +1,74 @@
import adapter from '@sveltejs/adapter-auto';
// Import plugins
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
// Import adapters (only 1 gets used tho)
import adapterAuto from '@sveltejs/adapter-auto';
import adapterVercel from '@sveltejs/adapter-vercel';
import adapterNode from '@sveltejs/adapter-node';
import adapterNetlify from '@sveltejs/adapter-netlify';
import adapterStatic from '@sveltejs/adapter-static';
/**
* Determines the appropriate adapter for given deployment context
* You can manually set the DEPLOY_ENV env var to override auto-detection.
* Supported values: 'vercel', 'node', 'docker', 'netlify', 'static', 'auto'
* Or, we will try to auto-detect based on common environment variables
* Always falls back to 'auto' if can't determine and not set manually
* @returns {import('@sveltejs/kit').Adapter}
*/
function getAdapter() {
// Manual override via DEPLOY_ENV environment variable
const deployEnv = process.env.DEPLOY_ENV?.toLowerCase();
if (deployEnv) {
switch (deployEnv.toLowerCase()) {
case 'vercel':
return adapterVercel();
case 'node':
case 'docker':
return adapterNode();
case 'netlify':
return adapterNetlify();
case 'static':
return adapterStatic();
case 'auto':
return adapterAuto();
default:
console.warn(`Unknown DEPLOY_ENV: '${deployEnv}', falling back to auto adapter`);
return adapterAuto();
}
}
// Auto-detection based on environment variables
const isVercel = !!(process.env.VERCEL || process.env.VERCEL_ENV);
const isNetlify = !!(process.env.NETLIFY || process.env.NETLIFY_SITE_ID);
const isDocker = !!(process.env.DOCKER_CONTAINER || process.env.KUBERNETES_SERVICE_HOST ||
process.env.HOSTNAME?.includes('docker') || process.env.container === 'docker');
const isNodeServer = !!(process.env.NODE_ENV === 'production' &&
(process.env.PORT || process.env.HOST || process.env.SERVER_HOST));
const isStatic = !!(process.env.CI && (process.env.GITHUB_ACTIONS || process.env.GITLAB_CI) &&
process.env.BUILD_STATIC === 'true');
if (isVercel) {
return adapterVercel();
} else if (isNetlify) {
return adapterNetlify();
} else if (isDocker) {
return adapterNode();
} else if (isNodeServer) {
return adapterNode();
} else if (isStatic) {
return adapterStatic();
}
console.log('No specific deployment environment detected, using auto adapter');
return adapterAuto();
}
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://svelte.dev/docs/kit/integrations
// for more information about preprocessors
preprocess: vitePreprocess(),
kit: {
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
adapter: adapter()
adapter: getAdapter()
}
};