11---
2- sidebar_position : 999
32title : Key-Value (KV) Storage
43---
54
@@ -58,7 +57,11 @@ export default class KvDebugger extends UIBehavior {
5857 const css = `
5958div.container {
6059 width: 100%;
61- height: 100%;
60+ position: absolute;
61+ bottom: 0px;
62+ min-height: 300px;
63+ max-height: 500px;
64+ overflow-y: auto;
6265 display: flex;
6366 flex-direction: column;
6467 gap: 1rem;
@@ -72,32 +75,106 @@ div.container {
7275 & div.selector {
7376 display: flex;
7477 gap: 1rem;
78+ align-items: center;
79+
80+ & label {
81+ color: #e6e8ee;
82+ font-weight: 600;
83+ }
84+
85+ & select {
86+ background: #1f2330;
87+ color: #e6e8ee;
88+ border: 1px solid rgba(255,255,255,0.2);
89+ border-radius: 8px;
90+ padding: 0.35rem 0.5rem;
91+ }
7592 }
7693
7794 & div.data {
7895 flex-grow: 1;
79- overflow-y: scroll ;
96+ overflow-y: auto ;
8097 padding-bottom: 2rem;
98+ padding-right: 2rem;
99+
81100
82101 & > span {
83102 font-style: italic;
103+ color: #c8ccdb;
104+ }
105+
106+ & table {
107+ width: 100%;
108+ border-collapse: collapse;
109+ table-layout: fixed;
110+ background: #1f2330;
111+ border-radius: 8px;
112+ overflow: hidden;
113+ }
114+
115+ & thead {
116+ position: sticky;
117+ top: 0;
118+ background: #2b3040;
119+ z-index: 1;
120+ }
121+
122+ & th, & td {
123+ text-align: left;
124+ vertical-align: top;
125+ padding: 0.6rem 0.8rem;
126+ border-bottom: 1px solid rgba(255,255,255,0.08);
127+ color: #e6e8ee;
128+ }
129+
130+ & th:nth-child(1), & td:nth-child(1) {
131+ width: 25%;
132+ font-weight: 700;
133+ word-break: break-all;
134+ }
135+
136+ & th:nth-child(2), & td:nth-child(2) {
137+ width: 45%;
138+ }
139+
140+ & th:nth-child(3), & th:nth-child(4),
141+ & td:nth-child(3), & td:nth-child(4) {
142+ width: 15%;
143+ text-align: center;
144+ }
145+
146+ & code, & pre {
147+ margin: 0;
148+ padding: 0;
149+ font-family: var(--font-mono), monospace;
150+ font-size: 0.9rem;
151+ color: #e6e8ee;
152+ white-space: pre-wrap;
153+ word-break: break-word;
154+ }
155+
156+ & pre {
157+ background: transparent;
158+ }
159+
160+ & button {
161+ padding: 0.25rem 0.6rem;
162+ border-radius: 6px;
163+ border: 1px solid rgba(255,255,255,0.2);
164+ background: #2f3545;
165+ color: #fff;
166+ font-size: 0.8rem;
167+ cursor: pointer;
168+ transition: background 0.15s ease, opacity 0.15s ease;
169+ }
170+
171+ & button:hover {
172+ background: #3f465a;
173+ opacity: 1;
84174 }
85175
86- & > div {
87- display: grid;
88- grid-template-columns: max-content auto;
89- gap: 0.4rem 1rem;
90-
91- & > *:nth-child(1), & > *:nth-child(2) {
92- font-weight: bold;
93- }
94-
95- & code, & pre {
96- margin: 0;
97- padding: 0;
98- font-family: var(--font-mono), monospace;
99- font-size: 0.9rem;
100- }
176+ & button:active {
177+ transform: scale(0.95);
101178 }
102179 }
103180}
@@ -152,25 +229,45 @@ button.kv-toggle:active { transform: scale(0.96); }
152229 this .#player = ev .target .value ;
153230 this .#update ();
154231 }}
232+ value = { this .#player }
155233 >
156234 <option value = " " >[server]</option >
157- { [... this .#players ].map ((player ) => <option value = { player } >{ player } </option >)}
235+ { [... this .#players ].map ((player ) => (
236+ <option id = { player } value = { player } >{ player } </option >
237+ ))}
158238 </select >
159239 </div >
160240
161241 <div className = " data" >
162242 { entries .length === 0 ? <span >No data stored.</span > : (
163- <div >
164- <span >Key</span >
165- <span >Value</span >
166-
167- { entries .map (([key , value ]) => (
168- <div style = { { display: " contents" }} >
169- <code >{ key } </code >
170- <pre >{ JSON .stringify (value )} </pre >
171- </div >
172- ))}
173- </div >
243+ <table >
244+ <thead >
245+ <tr >
246+ <th >Key</th >
247+ <th >Value</th >
248+ <th >Edit</th >
249+ <th >Delete</th >
250+ </tr >
251+ </thead >
252+ <tbody >
253+ { entries .map (([key , value ]) => (
254+ <tr id = { key } >
255+ <td >
256+ <code >{ key } </code >
257+ </td >
258+ <td >
259+ <pre >{ JSON .stringify (value , null , 2 )} </pre >
260+ </td >
261+ <td >
262+ <button >Edit</button >
263+ </td >
264+ <td >
265+ <button >Delete</button >
266+ </td >
267+ </tr >
268+ ))}
269+ </tbody >
270+ </table >
174271 )}
175272 </div >
176273 </div >
0 commit comments