File tree Expand file tree Collapse file tree 10 files changed +19
-14
lines changed
Expand file tree Collapse file tree 10 files changed +19
-14
lines changed Original file line number Diff line number Diff line change 44 "scripts" : {
55 "dev" : " vite" ,
66 "build" : " vite build" ,
7+ "preview" : " vite preview" ,
78 "lint" : " eslint ." ,
89 "test" : " tsc --noEmit && npm run lint"
910 },
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -7,18 +7,20 @@ import { DeclarationsContext } from "~components/Docs/DeclarationsContext";
77import { NAVBAR_HEIGHT } from "./constants" ;
88
99const SidebarLink = styled ( NavLink ) `
10- display: block;
10+ display: flex;
11+ align-items: center;
12+ gap: 4px;
1113 background: transparent;
1214 border-left: 2px solid transparent;
13- padding: 4px 8px;
15+ padding: 0 8px;
16+ height: 28px;
1417 text-decoration: none;
1518 color: ${ ( props ) => props . theme . text } ;
1619 overflow: hidden;
1720 text-overflow: ellipsis;
1821 white-space: nowrap;
1922 box-sizing: border-box;
2023 font-size: 14px;
21- line-height: 20px;
2224 transition: background 0.1s, color 0.1s;
2325
2426 &:hover {
@@ -33,17 +35,13 @@ const SidebarLink = styled(NavLink)`
3335 }
3436` ;
3537
36- const SidebarKindIcon = styled ( KindIcon ) `
37- vertical-align: ${ ( { kind } ) => ( kind === "interface" ? "middle" : "baseline" ) } ;
38- ` ;
39-
4038export const SidebarElement : React . FC < {
4139 to : string ;
4240 icon : IconKind ;
4341 text : string ;
4442} > = React . memo ( ( { to, icon, text } ) => (
4543 < SidebarLink to = { to } >
46- < SidebarKindIcon kind = { icon } size = "small" /> { text }
44+ < KindIcon kind = { icon } size = "small" /> { text }
4745 </ SidebarLink >
4846) ) ;
4947
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ function groupByModule(declarations: Declaration[]): ModuleGroup[] {
3737
3838const HEADER_HEIGHT = 28 ;
3939const HEADER_GAP = 8 ;
40- const ITEM_HEIGHT = 24 ;
40+ const ITEM_HEIGHT = 28 ;
4141
4242export const DeclarationsSidebar = ( ) => {
4343 const { declarations } = useContext ( DeclarationsContext ) ;
Original file line number Diff line number Diff line change @@ -29,9 +29,18 @@ export async function loadGameSchemas(gameId: GameId): Promise<Declaration[]> {
2929 const cached = cache . get ( gameId ) ;
3030 if ( cached ) return cached ;
3131
32- const response = await fetch ( `${ import . meta. env . BASE_URL } ${ gameId } .json` ) ;
32+ const response = await fetch ( `${ import . meta. env . BASE_URL } ${ gameId } .json.gz ` ) ;
3333 if ( ! response . ok ) throw new Error ( `Failed to load ${ gameId } schemas: ${ response . status } ` ) ;
34- const data : SchemasJson = await response . json ( ) ;
34+
35+ let data : SchemasJson ;
36+ if ( response . headers . get ( "Content-Type" ) ?. includes ( "application/json" ) ) {
37+ // Vite dev server: already decompressed via Content-Encoding
38+ data = await response . json ( ) ;
39+ } else {
40+ // GitHub Pages / static hosting: raw gzip bytes
41+ const decompressed = response . body ! . pipeThrough ( new DecompressionStream ( "gzip" ) ) ;
42+ data = await new Response ( decompressed ) . json ( ) ;
43+ }
3544
3645 const result = parseSchemas ( data ) ;
3746 cache . set ( gameId , result ) ;
You can’t perform that action at this time.
0 commit comments