mirror of
https://github.com/rio-labs/rio.git
synced 2025-12-30 17:59:51 -06:00
27 lines
782 B
TypeScript
27 lines
782 B
TypeScript
import { ComponentBase, ComponentState } from './componentBase';
|
|
import { ComponentId } from '../dataModels';
|
|
|
|
export type HighLevelComponentState = ComponentState & {
|
|
_type_: 'HighLevelComponent-builtin';
|
|
_child_?: ComponentId;
|
|
};
|
|
|
|
export class HighLevelComponent extends ComponentBase {
|
|
state: Required<HighLevelComponentState>;
|
|
|
|
createElement(): HTMLElement {
|
|
let element = document.createElement('div');
|
|
element.classList.add('rio-high-level-component');
|
|
return element;
|
|
}
|
|
|
|
updateElement(
|
|
deltaState: HighLevelComponentState,
|
|
latentComponents: Set<ComponentBase>
|
|
): void {
|
|
super.updateElement(deltaState, latentComponents);
|
|
|
|
this.replaceOnlyChild(latentComponents, deltaState._child_);
|
|
}
|
|
}
|