@@ -75,16 +75,10 @@ function handleMixin(node: Node, mixins: Record<string, any>) {
75
75
const name = child . values [ 0 ] as string ;
76
76
switch ( child . name ) {
77
77
case "event" :
78
- event . push ( {
79
- name,
80
- type : child . properties . type as string ,
81
- } ) ;
78
+ handleEventChild ( child , event , name ) ;
82
79
break ;
83
80
case "property" :
84
- property [ name ] = {
85
- name,
86
- exposed : child . properties ?. exposed as string ,
87
- } ;
81
+ handlePropertyChild ( child , property , name ) ;
88
82
break ;
89
83
default :
90
84
throw new Error ( `Unknown node name: ${ child . name } ` ) ;
@@ -94,6 +88,30 @@ function handleMixin(node: Node, mixins: Record<string, any>) {
94
88
mixins [ name ] = { name, events : { event } , properties : { property } } ;
95
89
}
96
90
91
+ /**
92
+ * Handles a child node of type "event" and adds it to the event array.
93
+ * @param child The child node to handle.
94
+ * @param event The event array to update.
95
+ */
96
+ function handleEventChild ( child : Node , event : Event [ ] , name : string ) {
97
+ event . push ( {
98
+ name,
99
+ type : child . properties . type as string ,
100
+ } ) ;
101
+ }
102
+
103
+ /**
104
+ * Handles a child node of type "property" and adds it to the property object.
105
+ * @param child The child node to handle.
106
+ * @param property The property object to update.
107
+ */
108
+ function handlePropertyChild ( child : Node , property : Properties , name : string ) {
109
+ property [ name ] = {
110
+ name,
111
+ exposed : child . properties ?. exposed as string ,
112
+ } ;
113
+ }
114
+
97
115
/**
98
116
* Collect all file URLs in a directory.
99
117
*/
0 commit comments