mirror of
https://github.com/rio-labs/rio.git
synced 2026-01-01 18:59:53 -06:00
29 lines
828 B
TypeScript
29 lines
828 B
TypeScript
import { devToolsConnector } from '../app';
|
|
import { applyIcon } from '../designApplication';
|
|
import { ComponentBase, ComponentState } from './componentBase';
|
|
|
|
export type ComponentPickerState = ComponentState & {
|
|
_type_: 'ComponentPicker-builtin';
|
|
};
|
|
|
|
export class ComponentPickerComponent extends ComponentBase {
|
|
protected createElement(): HTMLElement {
|
|
let element = document.createElement('div');
|
|
element.classList.add('rio-component-picker');
|
|
|
|
applyIcon(element, 'material/arrow_selector_tool:fill');
|
|
|
|
element.addEventListener('click', this.pickComponent.bind(this));
|
|
|
|
return element;
|
|
}
|
|
|
|
async pickComponent() {
|
|
this.element.classList.add('active');
|
|
|
|
await devToolsConnector!.pickComponent();
|
|
|
|
this.element.classList.remove('active');
|
|
}
|
|
}
|