mirror of
https://github.com/rio-labs/rio.git
synced 2026-01-06 05:09:43 -06:00
27 lines
790 B
TypeScript
27 lines
790 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 {
|
|
declare 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_);
|
|
}
|
|
}
|