ENHANCEMENT: Core DOM utils does now support generic parameters
getComponentByDomNode, getComponentByDomNodeAsync and findComponents
ADDITION: Anchor attributes (_gondel_g or _gondelA_g) are now symbols (if supported) and can be generated with a new function called getGondelAttribute(ns: string = 'g', addition?: string)
Some functions are now even smaller because component class references are passed instead of the name so the reference must not be resolved manually via registry.
BREAKING: DOM attribute mappings are now defined inside the component class and not the decorator, so each component can be identified at any time to which attribute the class belongs (@Component('Button') does not work anymore). The new way to define the mapping value is to add the static class property public static componentName = 'Button'.
Other changes / notes
Updated React example (react-lazy) to show how to work with child components inside react.
More secure way to attach the component to DOM nodes (Symbols) inspired by bigger frameworks such as RXJS, Angular amm. The component annotation is now only used for the registration of the component, the mapping definition of the component is now located inside the class as static value. So in each core method where you had to pass a string with the name to it, you now simply pass the reference to the component and you'll have automatically the right type and the mapping name - which leads to the biggest benefit: all methods where components are passed (inside the core) now use this type as return type (before: GondelComponent). Other DOM utility methods now support (optional) generic arguments to automatically cast components (before: explicit casting with the as operator).
Important changes summarized:
getComponentByDomNode
,getComponentByDomNodeAsync
andfindComponents
_gondel_g
or_gondelA_g
) are now symbols (if supported) and can be generated with a new function calledgetGondelAttribute(ns: string = 'g', addition?: string)
@Component('Button')
does not work anymore). The new way to define the mapping value is to add the static class propertypublic static componentName = 'Button'
.Other changes / notes
react-lazy
) to show how to work with child components inside react.What are the benefits from this change?
More secure way to attach the component to DOM nodes (Symbols) inspired by bigger frameworks such as RXJS, Angular amm. The component annotation is now only used for the registration of the component, the mapping definition of the component is now located inside the class as static value. So in each core method where you had to pass a string with the name to it, you now simply pass the reference to the component and you'll have automatically the right type and the mapping name - which leads to the biggest benefit: all methods where components are passed (inside the core) now use this type as return type (before:
GondelComponent
). Other DOM utility methods now support (optional) generic arguments to automatically cast components (before: explicit casting with theas
operator).