UNPKG

@pmndrs/uikit

Version:

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

87 lines (86 loc) 5.07 kB
import { Signal } from '@preact/signals-core'; import { Matrix4, Mesh, MeshBasicMaterial, Object3D, PlaneGeometry, Sphere, Texture, Vector2Tuple } from 'three'; import { EventHandlers, Listeners } from '../index.js'; import { ParentContext, RootContext } from '../context.js'; import { Inset, YogaProperties } from '../flex/index.js'; import { OrderInfo, ZIndexProperties } from '../order.js'; import { PanelGroupProperties, PanelProperties } from '../panel/index.js'; import { WithAllAliases } from '../properties/alias.js'; import { AllOptionalProperties, WithClasses, WithReactive } from '../properties/default.js'; import { ScrollbarProperties } from '../scroll.js'; import { TransformProperties } from '../transform.js'; import { UpdateMatrixWorldProperties, VisibilityProperties, WithConditionals } from './utils.js'; import { MergedProperties } from '../properties/merged.js'; import { PointerEventsProperties } from '../panel/interaction-panel-mesh.js'; import { AppearanceProperties } from './svg.js'; import { ThreeEventMap } from '../events.js'; export type ImageFit = 'cover' | 'fill'; export type InheritableImageProperties = WithClasses<WithConditionals<WithAllAliases<WithReactive<YogaProperties & ZIndexProperties & Omit<PanelProperties, 'backgroundColor' | 'backgroundOpacity'> & TransformProperties & AppearanceProperties & PanelGroupProperties & ScrollbarProperties & KeepAspectRatioProperties & ImageFitProperties & VisibilityProperties & UpdateMatrixWorldProperties & PointerEventsProperties>>>>; export type ImageFitProperties = { objectFit?: ImageFit; }; export type KeepAspectRatioProperties = { keepAspectRatio?: boolean; }; export type ImageProperties<EM extends ThreeEventMap = ThreeEventMap> = InheritableImageProperties & Listeners & WithReactive<{ src?: string | Texture; }> & EventHandlers<EM>; export declare function createImageState<EM extends ThreeEventMap = ThreeEventMap>(parentCtx: ParentContext, objectRef: { current?: Object3D | null; }, style: Signal<ImageProperties<EM> | undefined>, properties: Signal<ImageProperties<EM> | undefined>, defaultProperties: Signal<AllOptionalProperties | undefined>): { node: Signal<import("../internals.js").FlexNode | undefined>; size: Signal<Vector2Tuple | undefined>; relativeCenter: Signal<Vector2Tuple | undefined>; borderInset: Signal<Inset | undefined>; overflow: Signal<import("yoga-layout/load").Overflow>; displayed: Signal<boolean>; scrollable: Signal<[boolean, boolean]>; paddingInset: Signal<Inset | undefined>; maxScrollPosition: Signal<[(number | undefined)?, (number | undefined)?]>; } & { texture: Signal<Texture | undefined>; hoveredSignal: Signal<number[]>; activeSignal: Signal<number[]>; src: import("@preact/signals-core").ReadonlySignal<string | Texture | undefined>; mergedProperties: import("@preact/signals-core").ReadonlySignal<MergedProperties>; transformMatrix: Signal<Matrix4 | undefined>; globalMatrix: Signal<Matrix4 | undefined>; isClipped: Signal<boolean>; isHidden: import("@preact/signals-core").ReadonlySignal<boolean>; isVisible: import("@preact/signals-core").ReadonlySignal<boolean>; orderInfo: Signal<OrderInfo | undefined>; groupDeps: import("@preact/signals-core").ReadonlySignal<Required<PanelGroupProperties>>; scrollPosition: Signal<Vector2Tuple>; scrollbarWidth: Signal<number>; childrenMatrix: import("@preact/signals-core").ReadonlySignal<Matrix4 | undefined>; scrollState: { downPointerMap: Map<number, { type: "scroll-bar"; localPoint: import("three").Vector3; axisIndex: number; } | { type: "scroll-panel"; localPoint: import("three").Vector3; timestamp: number; }>; scrollVelocity: import("three").Vector2; }; defaultProperties: { pointerEvents: Signal<"auto" | "none" | "listener" | undefined>; pointerEventsOrder: Signal<number | undefined>; pointerEventsType: Signal<import("../internals.js").AllowedPointerEventsType | undefined>; renderOrder: Signal<number>; depthTest: Signal<boolean>; depthWrite: Signal<boolean>; }; anyAncestorScrollable: import("@preact/signals-core").ReadonlySignal<readonly [boolean, boolean]>; root: RootContext; } & { handlers: import("@preact/signals-core").ReadonlySignal<EventHandlers>; ancestorsHaveListeners: import("@preact/signals-core").ReadonlySignal<boolean>; interactionPanel: Mesh<PlaneGeometry, MeshBasicMaterial, import("three").Object3DEventMap> & { boundingSphere: Sphere; }; clippingRect: Signal<import("../clipping.js").ClippingRect | undefined>; }; export declare function setupImage<EM extends ThreeEventMap = ThreeEventMap>(state: ReturnType<typeof createImageState>, parentCtx: ParentContext, style: Signal<ImageProperties<EM> | undefined>, properties: Signal<ImageProperties<EM> | undefined>, object: Object3D, childrenContainer: Object3D, abortSignal: AbortSignal): void;