mirror of
https://github.com/lissy93/networking-toolbox.git
synced 2026-11-27 07:58:56 +03:00
IP regex and validator
This commit is contained in:
1 parent
af291f47b2
commit
b471e32ecb
11 files changed
+3242
-2343
No files matched your search
@@ -8,9 +8,10 @@
|
||||
name: IconName;
|
||||
size?: 'xs' | 'sm' | 'md' | 'lg';
|
||||
animate?: 'spin' | 'pulse' | 'pulse-once' | 'bounce' | 'fade' | null;
|
||||
rotate?: 0 | 90 | 180 | 270;
|
||||
}
|
||||
|
||||
let { name, size = 'md', animate = null }: Props = $props();
|
||||
let { name, size = 'md', animate = null, rotate = 0 }: Props = $props();
|
||||
|
||||
const sizeClasses = {
|
||||
xs: 'w-2 h-2',
|
||||
@@ -258,6 +259,8 @@
|
||||
'email-dmarc': `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M80 336L336 336L336 358.8L210.9 431.2C210 431.7 209 432 208 432C207 432 206 431.7 205.1 431.2L80 358.8L80 336zM80 414.3L181.1 472.8C189.3 477.5 198.6 480 208 480C217.4 480 226.8 477.5 234.9 472.8L336 414.3L336 528L80 528L80 414.3zM240 208L560 208L560 432L432 432L432 336C432 283 389 240 336 240L240 240L240 208zM432 280L432 328C432 341.3 442.7 352 456 352L504 352C517.3 352 528 341.3 528 328L528 280C528 266.7 517.3 256 504 256L456 256C442.7 256 432 266.7 432 280z"/><path d="M144 112L448 112C448 85.5 426.5 64 400 64L144 64C117.5 64 96 85.5 96 112L96 240L144 240L144 112zM240 240L240 208L560 208L560 432L432 432L432 480L560 480C586.5 480 608 458.5 608 432L608 208C608 181.5 586.5 160 560 160L240 160C213.5 160 192 181.5 192 208L192 240L240 240zM336 336L336 358.8L210.9 431.2C210 431.7 209 432 208 432C207 432 206 431.7 205.1 431.2L80 358.8L80 336L336 336zM80 528L80 414.3L181.1 472.8C189.3 477.5 198.6 480 208 480C217.4 480 226.8 477.5 234.9 472.8L336 414.3L336 528L80 528zM80 288C53.5 288 32 309.5 32 336L32 528C32 554.5 53.5 576 80 576L336 576C362.5 576 384 554.5 384 528L384 336C384 309.5 362.5 288 336 288L80 288zM456 256C442.7 256 432 266.7 432 280L432 328C432 341.3 442.7 352 456 352L504 352C517.3 352 528 341.3 528 328L528 280C528 266.7 517.3 256 504 256L456 256z"/></svg>`,
|
||||
'rdap-ip': `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M40 368C40 381.3 50.7 392 64 392C77.3 392 88 381.3 88 368C88 354.7 77.3 344 64 344C50.7 344 40 354.7 40 368zM200 128C200 141.3 210.7 152 224 152C237.3 152 248 141.3 248 128C248 114.7 237.3 104 224 104C210.7 104 200 114.7 200 128zM240 368C240 421 283 464 336 464C389 464 432 421 432 368C432 315 389 272 336 272C283 272 240 315 240 368zM552 192C552 205.3 562.7 216 576 216C589.3 216 600 205.3 600 192C600 178.7 589.3 168 576 168C562.7 168 552 178.7 552 192zM552 512C552 525.3 562.7 536 576 536C589.3 536 600 525.3 600 512C600 498.7 589.3 488 576 488C562.7 488 552 498.7 552 512z"/><path d="M224 104C237.3 104 248 114.7 248 128C248 141.3 237.3 152 224 152C210.7 152 200 141.3 200 128C200 114.7 210.7 104 224 104zM224 192C225.1 192 226.2 192 227.3 191.9L254.2 249.5C222.9 271.2 200.5 304.9 194 344L123.4 344C113.9 320.5 90.9 304 64.1 304C28.8 304 .1 332.7 .1 368C.1 403.3 28.8 432 64.1 432C91 432 114 415.5 123.4 392L194 392C205.4 460.1 264.7 512 336 512C379.8 512 419 492.5 445.4 461.6L512.8 502C512.3 505.2 512 508.6 512 511.9C512 547.2 540.7 575.9 576 575.9C611.3 575.9 640 547.2 640 511.9C640 476.6 611.3 447.9 576 447.9C561.5 447.9 548.2 452.7 537.5 460.8L470.2 420.4C476.6 404.1 480.1 386.4 480.1 367.9C480.1 344.7 474.6 322.7 464.8 303.3L542.4 246.4C552.2 252.5 563.7 256 576.1 256C611.4 256 640.1 227.3 640.1 192C640.1 156.7 611.4 128 576.1 128C540.8 128 512.1 156.7 512.1 192C512.1 197.4 512.8 202.7 514 207.7L436.4 264.6C410.5 239.4 375.1 223.9 336.1 223.9C322.8 223.9 310 225.7 297.8 229.1L270.9 171.6C281.5 160.2 288 144.9 288 128C288 92.7 259.3 64 224 64C188.7 64 160 92.7 160 128C160 163.3 188.7 192 224 192zM576 168C589.3 168 600 178.7 600 192C600 205.3 589.3 216 576 216C562.7 216 552 205.3 552 192C552 178.7 562.7 168 576 168zM552 512C552 498.7 562.7 488 576 488C589.3 488 600 498.7 600 512C600 525.3 589.3 536 576 536C562.7 536 552 525.3 552 512zM64 344C77.3 344 88 354.7 88 368C88 381.3 77.3 392 64 392C50.7 392 40 381.3 40 368C40 354.7 50.7 344 64 344zM336 272C389 272 432 315 432 368C432 421 389 464 336 464C283 464 240 421 240 368C240 315 283 272 336 272z"/></svg>`,
|
||||
'rdap-asn': `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M139.2 212C132.6 223.5 136.5 238.2 148 244.8C159.5 251.4 174.2 247.5 180.8 236C187.4 224.5 183.5 209.8 172 203.2C160.5 196.6 145.8 200.5 139.2 212zM139.2 428C145.8 439.5 160.5 443.4 172 436.8C183.5 430.2 187.4 415.5 180.8 404C174.2 392.5 159.5 388.6 148 395.2C136.5 401.8 132.6 416.5 139.2 428zM296 128C296 141.3 306.7 152 320 152C333.3 152 344 141.3 344 128C344 114.7 333.3 104 320 104C306.7 104 296 114.7 296 128zM296 320C296 333.3 306.7 344 320 344C333.3 344 344 333.3 344 320C344 306.7 333.3 296 320 296C306.7 296 296 306.7 296 320zM296 512C296 525.3 306.7 536 320 536C333.3 536 344 525.3 344 512C344 498.7 333.3 488 320 488C306.7 488 296 498.7 296 512zM459.2 236C465.8 247.5 480.5 251.4 492 244.8C503.5 238.2 507.4 223.5 500.8 212C494.2 200.5 479.5 196.6 468 203.2C456.5 209.8 452.6 224.5 459.2 236zM459.2 404C452.6 415.5 456.5 430.2 468 436.8C479.5 443.4 494.2 439.5 500.8 428C507.4 416.5 503.5 401.8 492 395.2C480.5 388.6 465.8 392.5 459.2 404z"/><path d="M320 152C333.3 152 344 141.3 344 128C344 114.7 333.3 104 320 104C306.7 104 296 114.7 296 128C296 141.3 306.7 152 320 152zM384 128C384 154.9 367.5 177.9 344 187.3L344 260.6C367.5 270.1 384 293.1 384 319.9C384 323.3 383.7 326.6 383.2 329.9L441.4 364.8C445.9 361.4 450.8 358.7 455.9 356.6L455.9 283.3C450.7 281.2 445.9 278.5 441.4 275.1L412 292.7C407.3 276.9 398.7 262.8 387.3 251.6L416.7 234C412.7 208.6 424.4 182.3 447.9 168.6C478.5 150.9 517.7 161.4 535.3 192C552.9 222.6 542.5 261.8 511.9 279.4C509.3 280.9 506.6 282.2 503.9 283.3L503.9 356.6C506.6 357.7 509.3 359 511.9 360.5C542.5 378.2 553 417.3 535.3 447.9C517.6 478.5 478.5 489 447.9 471.3C424.3 457.7 412.7 431.3 416.7 405.9L358.5 371C354.1 374.3 349.2 377.1 344 379.2L344 452.5C367.5 462 384 485 384 511.8C384 547.1 355.3 575.8 320 575.8C284.7 575.8 256 547.1 256 511.8C256 484.9 272.5 461.9 296 452.5L296 379.2C272.5 369.7 256 346.7 256 319.9C256 316.5 256.3 313.2 256.8 309.9L198.6 275C194.1 278.4 189.2 281.1 184 283.2L184 356.5C189.1 358.6 194 361.3 198.5 364.7L227.9 347.1C232.6 362.9 241.2 377 252.6 388.2L223.2 406C227.2 431.4 215.6 457.8 192 471.4C161.4 489.1 122.3 478.6 104.6 448C86.9 417.4 97.4 378.3 128 360.6C130.6 359.1 133.3 357.8 136 356.7L136 283.4C133.3 282.3 130.6 281 128 279.5C97.4 261.8 86.9 222.6 104.6 192C122.3 161.4 161.4 150.9 192 168.6C215.6 182.2 227.2 208.6 223.2 234L281.4 268.9C285.8 265.6 290.7 262.8 295.9 260.7L295.9 187.4C272.4 177.9 255.9 154.9 255.9 128.1C255.9 92.8 284.6 64.1 319.9 64.1C355.2 64.1 383.9 92.8 383.9 128.1zM320 344C333.3 344 344 333.3 344 320C344 306.7 333.3 296 320 296C306.7 296 296 306.7 296 320C296 333.3 306.7 344 320 344zM492 244.8C503.5 238.2 507.4 223.5 500.8 212C494.2 200.5 479.5 196.6 468 203.2C456.5 209.8 452.6 224.5 459.2 236C465.8 247.5 480.5 251.4 492 244.8zM180.8 236C187.4 224.5 183.5 209.8 172 203.2C160.5 196.6 145.8 200.5 139.2 212C132.6 223.5 136.5 238.2 148 244.8C159.5 251.4 174.2 247.5 180.8 236zM344 512C344 498.7 333.3 488 320 488C306.7 488 296 498.7 296 512C296 525.3 306.7 536 320 536C333.3 536 344 525.3 344 512zM139.2 428C145.8 439.5 160.5 443.4 172 436.8C183.5 430.2 187.4 415.5 180.8 404C174.2 392.5 159.5 388.6 148 395.2C136.5 401.8 132.6 416.5 139.2 428zM492 395.2C480.5 388.6 465.8 392.5 459.2 404C452.6 415.5 456.5 430.2 468 436.8C479.5 443.4 494.2 439.5 500.8 428C507.4 416.5 503.5 401.8 492 395.2z"/></svg>`,
|
||||
// Brands
|
||||
'regexr': `<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" viewBox="0 0 64 64" fill="none"><path fill="currentColor" d="M0 0v64h64V0H0zm23.799 52.045H11.783V40.029h12.016v12.016zm29.957-22.401l-5.396 5.235-6.765-11.033L34.67 35.12l-5.396-5.235 9.744-7.328-13.046-4.188 3.785-6.604 10.711 8.617L37.65 7.739h7.57l-2.899 12.643 10.791-8.617 3.785 6.604-12.804 4.027 9.663 7.248z"></path></svg>`,
|
||||
};
|
||||
|
||||
type IconName = keyof typeof iconMap;
|
||||
@@ -275,7 +278,7 @@
|
||||
const svgContent = $derived(getSvgContent(name));
|
||||
</script>
|
||||
|
||||
<div class="icon {sizeClasses[size]} {animate ? `animate-${animate}` : ''}">
|
||||
<div class="icon {sizeClasses[size]} {animate ? `animate-${animate}` : ''} {rotate ? `rotate rotate-${rotate}` : ''} ">
|
||||
{#if svgContent}
|
||||
{@html svgContent}
|
||||
{:else}
|
||||
@@ -312,6 +315,14 @@
|
||||
.w-8 { width: 1.75rem; height: 1.75rem; }
|
||||
.h-8 { height: 1.75rem; }
|
||||
|
||||
.rotate {
|
||||
transition: transform 0.3s ease;
|
||||
&.rotate-0 { transform: rotate(0deg); }
|
||||
&.rotate-90 { transform: rotate(90deg); }
|
||||
&.rotate-180 { transform: rotate(180deg); }
|
||||
&.rotate-270 { transform: rotate(270deg); }
|
||||
}
|
||||
|
||||
.animate-spin {
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
import { validateIPv4 } from '$lib/utils/ip-validation.js';
|
||||
import IPInput from './IPInput.svelte';
|
||||
import Tooltip from '$lib/components/global/Tooltip.svelte';
|
||||
import SvgIcon from '$lib/components/global/SvgIcon.svelte';
|
||||
import Icon from '../global/Icon.svelte';
|
||||
import Icon from '../global/Icon.svelte';
|
||||
|
||||
let ipAddress = $state('192.168.1.1');
|
||||
let formats = $state({
|
||||
@@ -483,7 +482,7 @@
|
||||
<div class="explainer-content">
|
||||
<div class="usage-scenarios">
|
||||
<div class="usage-scenario">
|
||||
<h4>🔧 Network Administration</h4>
|
||||
<h4>Network Administration</h4>
|
||||
<ul>
|
||||
<li><strong>Dotted Decimal:</strong> Daily configuration and documentation</li>
|
||||
<li><strong>Binary:</strong> Subnet calculations and VLSM planning</li>
|
||||
@@ -492,7 +491,7 @@
|
||||
</div>
|
||||
|
||||
<div class="usage-scenario">
|
||||
<h4>💻 Programming & Development</h4>
|
||||
<h4>Programming & Development</h4>
|
||||
<ul>
|
||||
<li><strong>Decimal:</strong> Database storage and IP range operations</li>
|
||||
<li><strong>Hexadecimal:</strong> Low-level socket programming</li>
|
||||
@@ -501,7 +500,7 @@
|
||||
</div>
|
||||
|
||||
<div class="usage-scenario">
|
||||
<h4>🔍 Troubleshooting & Analysis</h4>
|
||||
<h4>Troubleshooting & Analysis</h4>
|
||||
<ul>
|
||||
<li><strong>Binary:</strong> Understanding subnet boundaries</li>
|
||||
<li><strong>Hexadecimal:</strong> Reading network packet captures</li>
|
||||
@@ -515,6 +514,12 @@
|
||||
|
||||
|
||||
<style>
|
||||
h3 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.results-section {
|
||||
margin-top: var(--spacing-lg);
|
||||
}
|
||||
@@ -757,7 +762,7 @@
|
||||
}
|
||||
|
||||
.explainer-content h4 {
|
||||
color: var(--text-primary);
|
||||
color: var(--color-primary);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,146 @@
|
||||
export const ipAddressValidationContent = {
|
||||
title: "IP Address Format & RegEx Validation",
|
||||
description: "Understanding IPv4 and IPv6 address formats and how to validate them properly using regular expressions.",
|
||||
|
||||
sections: {
|
||||
overview: {
|
||||
title: "Understanding IP Address Formats",
|
||||
content: `IP addresses come in two versions: IPv4 (32-bit) and IPv6 (128-bit). Each has specific formatting rules that programmers need to understand for proper validation.
|
||||
|
||||
The key to validation is understanding the structure, not just pattern matching. RegEx can help with basic format checking, but proper IP validation often requires additional logic.`
|
||||
},
|
||||
|
||||
ipv4: {
|
||||
title: "IPv4 Address Format",
|
||||
content: `IPv4 addresses consist of four decimal numbers (0-255) separated by dots.
|
||||
|
||||
**Structure:** X.X.X.X where each X is 0-255
|
||||
**Examples:** 192.168.1.1, 10.0.0.1, 127.0.0.1
|
||||
|
||||
**Key Rules:**
|
||||
• Each octet ranges from 0 to 255
|
||||
• Leading zeros are typically not allowed (001.002.003.004)
|
||||
• All four octets are required
|
||||
|
||||
**Common Validation Mistakes:**
|
||||
• Allowing values > 255 (like 256.1.1.1)
|
||||
• Missing boundary checks
|
||||
• Not handling edge cases like 0.0.0.0`
|
||||
},
|
||||
|
||||
ipv6: {
|
||||
title: "IPv6 Address Format",
|
||||
content: `IPv6 addresses are 128-bit addresses written as eight groups of four hexadecimal digits, separated by colons.
|
||||
|
||||
**Full Format:** 2001:0db8:85a3:0000:0000:8a2e:0370:7334
|
||||
**Compressed:** 2001:db8:85a3::8a2e:370:7334 (:: replaces consecutive zeros)
|
||||
|
||||
**Key Rules:**
|
||||
• Eight groups of 1-4 hex digits (0-9, a-f, A-F)
|
||||
• Leading zeros can be omitted in each group
|
||||
• Consecutive zero groups can be replaced with :: (only once per address)
|
||||
• Case insensitive
|
||||
|
||||
**Special Cases:**
|
||||
• :: (all zeros address)
|
||||
• ::1 (loopback)
|
||||
• IPv4-mapped: ::ffff:192.168.1.1`
|
||||
},
|
||||
|
||||
regexValidation: {
|
||||
title: "RegEx Validation Approach",
|
||||
content: `Regular expressions can handle basic format validation, but IP validation has nuances that make pure RegEx challenging.
|
||||
|
||||
**IPv4 RegEx Challenges:**
|
||||
• Simple patterns like \\d+\\.\\d+\\.\\d+\\.\\d+ don't check ranges
|
||||
• Proper range validation (0-255) requires complex patterns
|
||||
• Leading zero handling varies by use case
|
||||
|
||||
**IPv6 RegEx Challenges:**
|
||||
• Multiple valid representations of the same address
|
||||
• Compression rules (:: usage)
|
||||
• Mixed IPv4/IPv6 notation support
|
||||
|
||||
**Best Practice:**
|
||||
Use RegEx for initial format checking, then validate with programming logic for range checks and special cases. Most languages have built-in IP parsing functions that handle edge cases correctly.`
|
||||
},
|
||||
|
||||
practicalTips: {
|
||||
title: "Practical Validation Tips",
|
||||
content: `**For Production Code:**
|
||||
1. Use language built-ins (inet_aton, IPAddress.parse, etc.)
|
||||
2. RegEx for quick format checks only
|
||||
3. Always validate ranges programmatically
|
||||
4. Consider your use case (strict vs lenient parsing)
|
||||
|
||||
**For Learning/Testing:**
|
||||
1. Start with basic patterns
|
||||
2. Add complexity gradually
|
||||
3. Test edge cases thoroughly
|
||||
4. Compare with known-good implementations
|
||||
|
||||
**Common Gotchas:**
|
||||
• 192.168.1.01 (leading zeros)
|
||||
• 192.168.1 (missing octets)
|
||||
• 192.168.1.1.1 (extra octets)
|
||||
• Case sensitivity in IPv6
|
||||
• Multiple :: in IPv6`
|
||||
}
|
||||
},
|
||||
|
||||
examples: {
|
||||
ipv4Basic: {
|
||||
title: "Basic IPv4 Pattern",
|
||||
pattern: "^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$",
|
||||
description: "Matches basic dot-decimal format, but doesn't validate ranges",
|
||||
matches: ["192.168.1.1", "10.0.0.1"],
|
||||
fails: ["192.168.1", "192.168.1.1.1"],
|
||||
limitation: "Allows invalid ranges like 999.999.999.999"
|
||||
},
|
||||
|
||||
ipv4Proper: {
|
||||
title: "Range-Validated IPv4",
|
||||
pattern: "^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)$",
|
||||
description: "Validates each octet is 0-255",
|
||||
matches: ["192.168.1.1", "255.255.255.255", "0.0.0.0"],
|
||||
fails: ["256.1.1.1", "192.168.1", "192.168.01.1"],
|
||||
limitation: "Complex and hard to maintain"
|
||||
},
|
||||
|
||||
ipv6Basic: {
|
||||
title: "Basic IPv6 Pattern",
|
||||
pattern: "^[0-9a-fA-F:]+$",
|
||||
description: "Very basic check for hex digits and colons",
|
||||
matches: ["2001:db8::1", "::1"],
|
||||
fails: ["192.168.1.1", "hello"],
|
||||
limitation: "Doesn't validate structure or compression rules"
|
||||
}
|
||||
},
|
||||
|
||||
recommendations: [
|
||||
{
|
||||
icon: "code",
|
||||
title: "Use Built-in Functions",
|
||||
description: "Most languages have reliable IP parsing libraries. Use them instead of rolling your own RegEx.",
|
||||
color: "var(--color-success)"
|
||||
},
|
||||
{
|
||||
icon: "test",
|
||||
title: "Test Edge Cases",
|
||||
description: "Test boundary values, malformed inputs, and different valid representations.",
|
||||
color: "var(--color-info)"
|
||||
},
|
||||
{
|
||||
icon: "performance",
|
||||
title: "Consider Performance",
|
||||
description: "Complex RegEx patterns can be slow. Profile your validation code with realistic data.",
|
||||
color: "var(--color-warning)"
|
||||
},
|
||||
{
|
||||
icon: "security",
|
||||
title: "Validate Context",
|
||||
description: "Consider what you're doing with the IP. Some contexts require stricter validation than others.",
|
||||
color: "var(--color-primary)"
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -5,19 +5,23 @@
|
||||
import '../styles/components.scss';
|
||||
import '../styles/ref-pages.scss';
|
||||
import '../styles/diagnostics-pages.scss';
|
||||
import favicon from '$lib/assets/favicon.svg';
|
||||
import '../styles/pages.scss';
|
||||
|
||||
import favicon from '$lib/assets/favicon.svg';
|
||||
|
||||
import Header from '$lib/components/furniture/Header.svelte';
|
||||
import SubHeader from '$lib/components/furniture/SubHeader.svelte';
|
||||
import Footer from '$lib/components/furniture/Footer.svelte';
|
||||
|
||||
let { data, children } = $props(); // Gets data from the server load function
|
||||
|
||||
let { data, children } = $props();
|
||||
let darkMode = $state(true); // Stores the theme mode
|
||||
|
||||
import '../styles/pages.scss';
|
||||
|
||||
let darkMode = $state(true);
|
||||
onMount(() => {
|
||||
initializeTheme();
|
||||
});
|
||||
|
||||
/* Reads and applies user's theme from localstorage on initial load */
|
||||
function initializeTheme() {
|
||||
if (typeof window === 'undefined') return;
|
||||
const saved = localStorage.getItem('theme');
|
||||
@@ -27,6 +31,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* Toggles between dark and light themes, saving preference to localstorage */
|
||||
function toggleTheme() {
|
||||
darkMode = !darkMode;
|
||||
if (typeof window !== 'undefined') {
|
||||
@@ -39,10 +44,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
initializeTheme();
|
||||
});
|
||||
|
||||
/* Uses the server-generated breadcrumb data, to build a JSON-LD breadcrumb object */
|
||||
function jsonLdTag(data: unknown, type = 'application/ld+json', nonce?: string) {
|
||||
if (!data) return '';
|
||||
const json = JSON.stringify(data)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300;400;500;600;700&display=swap');
|
||||
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&display=swap');
|
||||
|
||||
/* Reset */
|
||||
*, *::before, *::after {
|
||||
|
||||
@@ -308,6 +308,8 @@ hr {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-sm);
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.ip-value, .binary-value {
|
||||
@@ -316,12 +318,16 @@ hr {
|
||||
font-weight: 500;
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
border-radius: var(--radius-sm);
|
||||
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 100%;
|
||||
|
||||
&.success {
|
||||
color: var(--color-success-light);
|
||||
background-color: rgba(35, 134, 54, 0.1);
|
||||
}
|
||||
|
||||
|
||||
&.error {
|
||||
color: var(--color-error-light);
|
||||
background-color: rgba(218, 54, 51, 0.1);
|
||||
@@ -365,7 +371,7 @@ hr {
|
||||
// Checkbox styles
|
||||
.checkbox-label {
|
||||
display: flex;
|
||||
align-items: canter;
|
||||
align-items: center;
|
||||
gap: var(--spacing-sm);
|
||||
cursor: pointer;
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
--radius-lg: 8px;
|
||||
|
||||
/* Spacing */
|
||||
--spacing-2xs: 0.125rem;
|
||||
--spacing-xs: 0.25rem;
|
||||
--spacing-sm: 0.5rem;
|
||||
--spacing-md: 1rem;
|
||||
@@ -56,7 +57,7 @@
|
||||
--spacing-2xl: 3rem;
|
||||
|
||||
/* Font */
|
||||
--font-mono: 'Roboto Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
|
||||
--font-mono: 'Noto Sans Mono', 'Roboto Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
|
||||
--font-size-2xs: 0.6rem;
|
||||
--font-size-xs: 0.75rem;
|
||||
--font-size-sm: 0.875rem;
|
||||
|
||||
Reference in new issue
Block a user