@@ -5,22 +5,36 @@ To apply partial fade transition currently for IPv4 Addresses
55 import type { TransitionConfig } from ' svelte/transition' ;
66 import { fade } from ' svelte/transition' ;
77
8+ export let fstDelimiter = ' /' ;
9+ export let sndDelimiter = ' .' ;
10+
11+ // this is a bit of involved workaround to show wrapped spaces properly in the fstDelimiter
12+ $ : isFstDelimiterWrappedBySpaces =
13+ fstDelimiter .at (0 ) === fstDelimiter .at (- 1 ) && fstDelimiter .at (0 ) === ' ' ;
14+
815 // eslint-disable-next-line @typescript-eslint/no-explicit-any
916 export let transition: (... args : any []) => TransitionConfig = fade ;
1017 export let mono = true ;
1118
1219 export let notation = ' 0.0.0.0/0' ;
13- $ : splits = notation .split (' / ' );
20+ $ : splits = notation .split (fstDelimiter );
1421 $ : address = splits [0 ];
15- $ : chunks = address .split (' . ' );
22+ $ : chunks = address .split (sndDelimiter );
1623 $ : prefix = splits [1 ];
1724 $ : texts = prefix ? [... chunks , prefix ] : chunks ;
1825 </script >
1926
20- <!-- safe list class="font-mono" -->
27+ <!-- \00A0 = - https://github.com/sveltejs/svelte/issues/3014#issuecomment-501143936 -->
28+ <!-- safe list class="font-mono first:hidden before:content-['\00A0'] after:content-['\00A0']" -->
2129<div class ="flex" class:font-mono ={mono }>
2230 {#each texts as text , idx }
23- <div class ="first:hidden" >{idx < 4 ? ' .' : ' /' }</div >
31+ <div
32+ class ={[" before:content-['\\ 00A0'] after:content-['\\ 00A0']" , ' first:hidden' ]
33+ .slice (idx > 3 && isFstDelimiterWrappedBySpaces ? 0 : 1 )
34+ .join (' ' )}
35+ >
36+ {idx < 4 ? sndDelimiter : fstDelimiter .trim ()}
37+ </div >
2438 <div class =" relative" >
2539 <div class =" opacity-0" >
2640 {text }
0 commit comments