@@ -31,38 +31,54 @@ Represent IPv4 address including prefix notation
3131 $ : addresses = calcHosts (prefix ) + 2 ;
3232 </script >
3333
34- <div class =" flex lt-sm:overflow-x-auto" >
34+ <!-- for xs only -->
35+ <div class =" sm:hidden items-end mb-2 flex" >
3536 <div class =" grow" />
36- <div >
37- <slot name =" extra-bits" />
38- <div class =" relative" >
39- <div class =" absolute w-full h-full rounded-b overflow-clip z--10" >
40- <div class ="h-full bg-gray-200" style:width ={` ${(prefix / 32 ) * 100 }% ` } />
41- </div >
42- <div class =" mix-blend-multiply" >
43- <div class =" text-gray-600" >
44- <BitHex
45- bind:integer ={address }
46- colReverse ={true }
47- minLength ={length }
48- maxLength ={length }
49- borderOctal ={false }
50- borderHex ={true }
51- compact ={true }
52- octetBorder ={true }
53- />
54- </div >
37+ <div class =" flex text-2xl lt-xs:text-lg mr-2 items-center" >
38+ <div >
39+ <div class =" flex" >
40+ {#each octets as octet , idx }
41+ <div class =" flex-1 flex group mt-1" >
42+ <div class =" group-first:hidden font-bold z-10" >.</div >
43+ <InputNumberLocaled
44+ {min }
45+ {max }
46+ strictRangeOnInput ={true }
47+ class =" text-center w-12 lt-xs:w-8 input-number-hide-arrows bg-gray-100 rounded font-mono"
48+ value ={octet }
49+ on:change ={(e ) => onChange (idx , e )}
50+ />
51+ </div >
52+ {/each }
5553 </div >
5654 </div >
55+ <div class =" mx-3 lt-xs:mx-1 text-base" >/</div >
56+ <div >
57+ <InputNumberLocaled
58+ min ={0 }
59+ max ={31 }
60+ strictRangeOnInput ={true }
61+ class =" text-center w-8 mt-1 bg-gray-100 rounded input-number-hide-arrows font-mono"
62+ bind:value ={prefix }
63+ />
64+ </div >
65+ </div >
66+ <IPv4Prefix bind:integer ={prefix } hideHeader ={false } />
67+ <div class =" grow" />
68+ </div >
69+ <!-- main -->
70+ <div class =" flex lt-sm:overflow-x-auto px-2 mx--2" >
71+ <div class =" grow" />
72+ <div >
5773 <div class =" flex lt-sm:hidden" >
5874 {#each octets as octet , idx }
59- <div class =" flex-1 flex group text-2xl mt-1 relative" >
75+ <div class =" flex-1 flex group text-2xl mb-2 relative" >
6076 <!-- adding max-w-[[n]rem] for Firefox -->
6177 <InputNumberLocaled
6278 {min }
6379 {max }
6480 strictRangeOnInput ={true }
65- class =" text-center w-full max-w-[7.4rem] input-number-hide-arrows bg-gray-50 rounded mx-1"
81+ class =" text-center w-full max-w-[7.4rem] input-number-hide-arrows bg-gray-50 rounded mx-1 font-mono "
6682 value ={octet }
6783 on:change ={(e ) => onChange (idx , e )}
6884 />
@@ -72,18 +88,47 @@ Represent IPv4 address including prefix notation
7288 </div >
7389 {/each }
7490 </div >
91+ <div class =" relative" >
92+ <div class =" absolute w-full h-full rounded-t overflow-clip z--10" >
93+ <div class ="h-full bg-gray-200" style:width ={` ${(prefix / 32 ) * 100 }% ` } />
94+ </div >
95+ <div class =" mix-blend-multiply" >
96+ <div class =" text-gray-600" >
97+ <BitHex
98+ bind:integer ={address }
99+ noMargin ={true }
100+ minLength ={length }
101+ maxLength ={length }
102+ borderOctal ={false }
103+ borderHex ={true }
104+ compact ={true }
105+ octetBorder ={true }
106+ />
107+ </div >
108+ </div >
109+ </div >
110+ <slot name =" extra-bits" />
75111 </div >
76- <div class =" flex flex-col mx-2 text-2xl" >
77- <div class =" grow" />
112+ <div class =" flex flex-col mx-2 text-2xl lt-sm:hidden" >
78113 <div class =" lt-sm:text-base sm:translate-x--0.8 lt-sm:mb-1 lt-sm:font-bold" >/</div >
114+ <div class =" grow" />
79115 </div >
80- <div class =" flex flex-col" >
81- <div class =" py-0.5 flex flex-col grow text-gray-600" >
116+ <div class =" flex flex-col lt-sm:hidden" >
117+ <div class =" lt-sm:hidden mb-2" >
118+ <InputNumberLocaled
119+ min ={0 }
120+ max ={31 }
121+ strictRangeOnInput ={true }
122+ class =" text-center text-2xl w-20 bg-gray-50 rounded input-number-hide-arrows font-mono"
123+ bind:value ={prefix }
124+ />
125+ </div >
126+ <div class =" flex flex-col grow text-gray-600" >
82127 <div class =" grow text-center flex flex-col" >
83- <div class = " grow " />
128+ <IPv4Prefix bind:integer ={ prefix } />
84129 <!-- safe list class="text-sm text-xs ![font-size:0.6rem]" -->
85130 <div
86- class =" leading-3"
131+ class =" leading-3 mt-1.5 "
87132 class:text-sm ={addresses > 99999 }
88133 class:text-xs ={addresses > 99999999 }
89134 class: ![font-size: 0.6rem]={addresses > 999999999}
@@ -92,51 +137,7 @@ Represent IPv4 address including prefix notation
92137 </div >
93138 <div ><small >addresses</small ></div >
94139 </div >
95- <div >
96- <IPv4Prefix bind:integer ={prefix } />
97- </div >
98140 </div >
99- <div class =" lt-sm:hidden" >
100- <InputNumberLocaled
101- min ={0 }
102- max ={31 }
103- strictRangeOnInput ={true }
104- class =" text-center text-2xl w-20 mt-1 bg-gray-50 rounded input-number-hide-arrows"
105- bind:value ={prefix }
106- />
107- </div >
108- </div >
109- <div class =" grow" />
110- </div >
111- <!-- for xs only -->
112- <div class =" flex text-2xl lt-xs:text-lg sm:hidden items-center" >
113- <div class =" grow" />
114- <div >
115- <div class =" flex" >
116- {#each octets as octet , idx }
117- <div class =" flex-1 flex group mt-1" >
118- <div class =" group-first:hidden font-bold z-10" >.</div >
119- <InputNumberLocaled
120- {min }
121- {max }
122- strictRangeOnInput ={true }
123- class =" text-center w-12 lt-xs:w-8 input-number-hide-arrows bg-gray-100 rounded"
124- value ={octet }
125- on:change ={(e ) => onChange (idx , e )}
126- />
127- </div >
128- {/each }
129- </div >
130- </div >
131- <div class =" mx-3 lt-xs:mx-1 text-base" >/</div >
132- <div >
133- <InputNumberLocaled
134- min ={0 }
135- max ={31 }
136- strictRangeOnInput ={true }
137- class =" text-center w-8 mt-1 bg-gray-100 rounded"
138- bind:value ={prefix }
139- />
140141 </div >
141142 <div class =" grow" />
142143</div >
0 commit comments