UNPKG

@pmndrs/uikit

Version:

Build performant 3D user interfaces with Three.js and yoga.

76 lines (75 loc) 3.82 kB
import { ReadonlySignal, Signal } from '@preact/signals-core'; import { EventHandlersProperties } from '../events.js'; import { BufferGeometry, Intersection, Material, Matrix4, Mesh, Object3D, Raycaster, Sphere, Vector2Tuple } from 'three'; import { Overflow } from 'yoga-layout/load'; import { FlexNode, Inset } from '../flex/node.js'; import { OrderInfo } from '../order.js'; import { BaseOutProperties, InProperties, Properties, WithSignal } from '../properties/index.js'; import { ClassList } from './classes.js'; import { RenderContext, RootContext } from '../context.js'; import type { Container } from './container.js'; export declare function resetGlobalProperties(properties: InProperties<BaseOutProperties> | undefined): void; export declare function setGlobalProperties(properties: InProperties<BaseOutProperties> | undefined): void; export declare class Component<OutProperties extends BaseOutProperties = BaseOutProperties> extends Mesh<BufferGeometry, Material> { private inputProperties?; private abortController; readonly handlers: ReadonlySignal<EventHandlersProperties>; readonly orderInfo: Signal<OrderInfo | undefined>; readonly isVisible: Signal<boolean>; readonly isClipped: Signal<boolean>; readonly boundingSphere: Sphere; /** * the properties of the this component * e.g. get the final computed backgroundColor using `component.properties.value.backgroundColor` */ readonly properties: Properties<OutProperties>; readonly starProperties: Properties<OutProperties>; readonly node: FlexNode; readonly size: Signal<Vector2Tuple | undefined>; readonly relativeCenter: Signal<Vector2Tuple | undefined>; readonly borderInset: Signal<Inset | undefined>; readonly overflow: Signal<Overflow>; readonly displayed: Signal<boolean>; readonly scrollable: Signal<[boolean, boolean]>; readonly paddingInset: Signal<Inset | undefined>; readonly maxScrollPosition: Signal<[x?: number | undefined, y?: number | undefined]>; readonly root: Signal<RootContext>; readonly parentContainer: Signal<Container<BaseOutProperties> | undefined>; readonly hoveredList: Signal<number[]>; readonly activeList: Signal<number[]>; readonly ancestorsHaveListenersSignal: Signal<boolean>; readonly globalMatrix: Signal<Matrix4 | undefined>; readonly globalPanelMatrix: Signal<Matrix4 | undefined>; readonly abortSignal: AbortSignal; readonly classList: ClassList; constructor(inputProperties?: InProperties<OutProperties> | undefined, initialClasses?: Array<InProperties<BaseOutProperties> | string>, config?: { material?: Material; renderContext?: RenderContext; dynamicHandlers?: Signal<EventHandlersProperties | undefined>; hasFocus?: Signal<boolean>; isPlaceholder?: Signal<boolean>; defaultOverrides?: InProperties<OutProperties>; hasNonUikitChildren?: boolean; defaults?: WithSignal<OutProperties>; }); raycast(raycaster: Raycaster, intersects: Intersection[]): unknown; updateMatrixWorld(): void; updateWorldMatrix(updateParents: boolean, updateChildren: boolean): void; /** * allows to extending the existing properties */ setProperties(inputProperties: InProperties<OutProperties>): void; /** * allows to overwrite the properties */ resetProperties(inputProperties?: InProperties<OutProperties>): void; /** * must only be called for the root component; the component that has a non-uikit component as a parent */ update(delta: number): void; dispose(): void; /** * only used for internally adding instanced panel group and instanced gylph group in case this component is a root component */ addUnsafe(...object: Object3D[]): this; }