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