@@ -5,7 +5,7 @@ export type WikiFunctionType = 'panelfunc' | 'classfunc' | 'libraryfunc' | 'hook
55export type Realm = 'Menu' | 'Client' | 'Server' | 'Shared' | 'Client and menu' ;
66
77export type CommonWikiProperties = {
8- type : WikiFunctionType | 'enum' | 'struct' ;
8+ type : WikiFunctionType | 'enum' | 'struct' | 'panel' ;
99 address : string ;
1010 name : string ;
1111 description : string ;
@@ -43,7 +43,7 @@ export type HookFunction = Function & {
4343
4444export type PanelFunction = Function & {
4545 type : 'panelfunc' ;
46- isPanel : 'yes' ;
46+ isPanelFunction : 'yes' ;
4747} ;
4848
4949export type EnumValue = {
@@ -69,7 +69,12 @@ export type Struct = CommonWikiProperties & {
6969 fields : StructField [ ] ;
7070} ;
7171
72- export type WikiPage = ClassFunction | LibraryFunction | HookFunction | PanelFunction | Enum | Struct ;
72+ export type Panel = CommonWikiProperties & {
73+ type : 'panel' ;
74+ parent : string ;
75+ } ;
76+
77+ export type WikiPage = ClassFunction | LibraryFunction | HookFunction | PanelFunction | Panel | Enum | Struct ;
7378
7479/**
7580 * Guards
@@ -90,6 +95,10 @@ export function isPanelFunction(page: WikiPage): page is PanelFunction {
9095 return page . type === 'panelfunc' ;
9196}
9297
98+ export function isPanel ( page : WikiPage ) : page is Panel {
99+ return page . type === 'panel' ;
100+ }
101+
93102export function isEnum ( page : WikiPage ) : page is Enum {
94103 return page . type === 'enum' ;
95104}
@@ -114,13 +123,14 @@ export class WikiPageMarkupScraper extends Scraper<WikiPage> {
114123 const isEnum = $ ( 'enum' ) . length > 0 ;
115124 const isStruct = $ ( 'structure' ) . length > 0 ;
116125 const isFunction = $ ( 'function' ) . length > 0 ;
117- const mainElement = $ ( isEnum ? 'enum' : isStruct ? 'struct' : 'function' ) . first ( ) ;
126+ const isPanel = $ ( 'panel' ) . length > 0 ;
127+ const mainElement = $ ( isEnum ? 'enum' : isStruct ? 'struct' : isPanel ? 'panel' : 'function' ) ;
118128 const address = response . url . split ( '/' ) . pop ( ) ! . split ( '?' ) [ 0 ] ;
119129
120130 if ( isEnum ) {
121- const items = $ ( 'items item' ) . map ( function ( ) {
131+ const items = $ ( 'items item' ) . map ( function ( ) {
122132 const $el = $ ( this ) ;
123- return < EnumValue > {
133+ return < EnumValue > {
124134 key : $el . attr ( 'key' ) ! ,
125135 value : $el . attr ( 'value' ) ! ,
126136 description : $el . text ( )
@@ -136,9 +146,9 @@ export class WikiPageMarkupScraper extends Scraper<WikiPage> {
136146 items
137147 } ;
138148 } else if ( isStruct ) {
139- const fields = $ ( 'fields item' ) . map ( function ( ) {
149+ const fields = $ ( 'fields item' ) . map ( function ( ) {
140150 const $el = $ ( this ) ;
141- return < StructField > {
151+ return < StructField > {
142152 name : $el . attr ( 'name' ) ! ,
143153 type : $el . attr ( 'type' ) ! ,
144154 default : $el . attr ( 'default' ) ,
@@ -154,6 +164,15 @@ export class WikiPageMarkupScraper extends Scraper<WikiPage> {
154164 realm : $ ( 'realm' ) . text ( ) as Realm ,
155165 fields
156166 } ;
167+ } else if ( isPanel ) {
168+ return < Panel > {
169+ type : 'panel' ,
170+ name : address ,
171+ address : address ,
172+ description : $ ( 'description' ) . text ( ) ,
173+ realm : $ ( 'realm' ) . text ( ) as Realm ,
174+ parent : $ ( 'parent' ) . text ( )
175+ } ;
157176 } else if ( isFunction ) {
158177 const isClassFunction = mainElement . attr ( 'type' ) === 'classfunc' ;
159178 const isLibraryFunction = mainElement . attr ( 'type' ) === 'libraryfunc' ;
@@ -219,7 +238,7 @@ export class WikiPageMarkupScraper extends Scraper<WikiPage> {
219238 return < PanelFunction > {
220239 ...base ,
221240 type : 'panelfunc' ,
222- isPanel : 'yes'
241+ isPanelFunction : 'yes'
223242 } ;
224243 }
225244 }
0 commit comments