mirror of
https://github.com/rio-labs/rio.git
synced 2026-01-01 10:49:58 -06:00
25 lines
774 B
TypeScript
25 lines
774 B
TypeScript
import { ComponentBase, ComponentState, DeltaState } from "./componentBase";
|
|
import { ComponentId } from "../dataModels";
|
|
|
|
export type HighLevelComponentState = ComponentState & {
|
|
_type_: "HighLevelComponent-builtin";
|
|
_child_: ComponentId;
|
|
};
|
|
|
|
export class HighLevelComponent extends ComponentBase<HighLevelState> {
|
|
createElement(): HTMLElement {
|
|
let element = document.createElement("div");
|
|
element.classList.add("rio-high-level-component");
|
|
return element;
|
|
}
|
|
|
|
updateElement(
|
|
deltaState: DeltaState<HighLevelComponentState>,
|
|
latentComponents: Set<ComponentBase>
|
|
): void {
|
|
super.updateElement(deltaState, latentComponents);
|
|
|
|
this.replaceOnlyChild(latentComponents, deltaState._child_);
|
|
}
|
|
}
|