-
Couldn't load subscription status.
- Fork 452
Handle Properties in kdl #2088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle Properties in kdl #2088
Changes from 1 commit
f7c15b7
4c5d916
7570cf8
0156114
23965c3
a263457
e707e51
de05586
9dce3c9
8cfd4dc
812b211
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,16 +75,10 @@ function handleMixin(node: Node, mixins: Record<string, any>) { | |
| const name = child.values[0] as string; | ||
| switch (child.name) { | ||
| case "event": | ||
| event.push({ | ||
| name, | ||
| type: child.properties.type as string, | ||
| }); | ||
| handleEventChild(child, event, name); | ||
| break; | ||
| case "property": | ||
| property[name] = { | ||
| name, | ||
| exposed: child.properties?.exposed as string, | ||
| }; | ||
| handlePropertyChild(child, property, name); | ||
| break; | ||
| default: | ||
| throw new Error(`Unknown node name: ${child.name}`); | ||
|
|
@@ -94,6 +88,30 @@ function handleMixin(node: Node, mixins: Record<string, any>) { | |
| mixins[name] = { name, events: { event }, properties: { property } }; | ||
| } | ||
|
|
||
| /** | ||
| * Handles a child node of type "event" and adds it to the event array. | ||
| * @param child The child node to handle. | ||
| * @param event The event array to update. | ||
| */ | ||
| function handleEventChild(child: Node, event: Event[], name: string) { | ||
|
||
| event.push({ | ||
|
||
| name, | ||
| type: child.properties.type as string, | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * Handles a child node of type "property" and adds it to the property object. | ||
| * @param child The child node to handle. | ||
| * @param property The property object to update. | ||
| */ | ||
| function handlePropertyChild(child: Node, property: Properties, name: string) { | ||
| property[name] = { | ||
| name, | ||
| exposed: child.properties?.exposed as string, | ||
| }; | ||
| } | ||
|
|
||
| /** | ||
| * Collect all file URLs in a directory. | ||
| */ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to return a value as handleProperty now does. But as handleEnum already does this, this can be done in a separate PR.