Three.js integration types
Import these contracts with type from @pibbl/three.
PibblThreeInputBridge
Section titled “PibblThreeInputBridge”Its connect() method supplies the input element expected by controls such as
OrbitControls.
PibblThreeLayerContext
Section titled “PibblThreeLayerContext”Extends the core render-layer context with the owned THREE.WebGLRenderer and
input bridge.
PibblThreeLayerDefinition
Section titled “PibblThreeLayerDefinition”Defines the synchronous create, update, resize, render, targets,
pick, and dispose callbacks used by defineThreeLayer().
PibblThreeLayerResources
Section titled “PibblThreeLayerResources”Requires the application resource value to expose a Three scene and
camera.
PibblThreePicker
Section titled “PibblThreePicker”A custom layer-local point picker that can replace default raycasting.
PibblThreePickResult
Section titled “PibblThreePickResult”The miss, block, or Three-object target result returned by a picker.
PibblThreeRendererOptions
Section titled “PibblThreeRendererOptions”Normal Three renderer parameters except canvas and alpha; the adapter owns
the OffscreenCanvas and always enables a transparent compositing surface.
PibblThreeTarget
Section titled “PibblThreeTarget”Associates an ordinary THREE.Object3D with Pibbl event handlers, cursor, pointer
policy, focusability, and optional keyboard-navigation bounds.
API details from source
Section titled “API details from source”
PibblThreeInputBridge
Section titled “PibblThreeInputBridge”Connects Three controls to Pibbl-routed input through an element-compatible bridge.
interface PibblThreeInputBridgeRelated API: PibblThreeInputBridge.
See also
Section titled “See also”View source — packages/three/src/lib/types.ts:78
Properties and methods
Section titled “Properties and methods”
connect
connect: <Control>(create: (element: HTMLElement) => Control) => ControlCreates controls against the Pibbl input bridge and returns the created control instance. See PibblThreeInputBridge.
Parameters
Section titled “Parameters”create— Factory that constructs controls using Pibbl’s routed-input element.
Returns
Section titled “Returns”The control object returned by the factory.
PibblThreeLayerContext
Section titled “PibblThreeLayerContext”Pibbl surface context extended with the adapter-owned renderer and controls-input bridge.
interface PibblThreeLayerContext extends PibblRenderLayerContextRelated API: PibblThreeLayerContext, PibblRenderLayerContext.
See also
Section titled “See also”THREE.WebGLRenderer
View source — packages/three/src/lib/types.ts:120
Properties and methods
Section titled “Properties and methods”
renderer
readonly renderer: THREE.WebGLRendererThe transparent renderer owned by this mounted adapter. See PibblThreeLayerContext.
input
readonly input: PibblThreeInputBridgeRelated API: PibblThreeInputBridge.
Bridge used to connect Three controls to Pibbl-routed events. See PibblThreeInputBridge.
canvas
readonly canvas: OffscreenCanvasCanvas surface associated with this resource or mount. See PibblRenderLayerContext.
View source — packages/core/src/lib/render-layer/types.ts:74
size
readonly size: PibblRenderLayerSizeRelated API: PibblRenderLayerSize.
Current logical dimensions, backing-store dimensions, and effective pixel ratios. See PibblRenderLayerSize.
View source — packages/core/src/lib/render-layer/types.ts:76
invalidate
invalidate: () => voidRequests another Pibbl render through the shared scheduler. See PibblRenderLayerContext.
View source — packages/core/src/lib/render-layer/types.ts:80
PibblThreeLayerDefinition
Section titled “PibblThreeLayerDefinition”Three scene resource lifecycle, optional rendering overrides, and Pibbl interaction integration.
interface PibblThreeLayerDefinition<Props, Resources extends PibblThreeLayerResources>Related API: PibblThreeLayerDefinition, PibblThreeLayerResources.
See also
Section titled “See also”View source — packages/three/src/lib/types.ts:141
Properties and methods
Section titled “Properties and methods”
renderer (optional)
readonly renderer?: PibblThreeRendererOptions | undefinedRelated API: PibblThreeRendererOptions.
Three renderer construction options; Pibbl supplies the canvas and enables transparency. See PibblThreeRendererOptions.
create
create: (context: PibblThreeLayerContext, initialProps: Readonly<Props>) => ResourcesRelated API: PibblThreeLayerContext.
Creates the application’s scene, camera, and other explicitly owned resources. See PibblThreeLayerDefinition.
Parameters
Section titled “Parameters”-
context— Adapter-owned renderer, surface, input bridge, and invalidation services. See PibblThreeLayerContext . -
initialProps— Props from the first mounted render.
Returns
Section titled “Returns”Application-owned scene, camera, and additional resources retained for this mount.
update (optional)
update?: ((resources: Resources, props: Readonly<Props>, context: PibblThreeLayerContext) => void) | undefinedRelated API: PibblThreeLayerContext.
Applies current props to the persistent Three resources. See PibblThreeLayerDefinition.
Parameters
Section titled “Parameters”-
resources— Resources returned by create. -
props— Latest layer props. -
context— Adapter-owned renderer, surface, input bridge, and invalidation services. See PibblThreeLayerContext .
resize (optional)
resize?: ((resources: Resources, size: PibblRenderLayerSize, context: PibblThreeLayerContext) => void) | undefinedRelated API: PibblRenderLayerSize, PibblThreeLayerContext.
Updates camera or application render targets after the layer size changes. See PibblThreeLayerDefinition.
Parameters
Section titled “Parameters”-
resources— Resources returned by create. -
size— New logical and backing dimensions. See PibblRenderLayerSize. -
context— Adapter-owned renderer, surface, input bridge, and invalidation services. See PibblThreeLayerContext .
render (optional)
render?: ((resources: Resources, frame: PibblRenderLayerFrame, context: PibblThreeLayerContext) => void) | undefinedRelated API: PibblRenderLayerFrame, PibblThreeLayerContext.
Overrides rendering for custom effects; omitted callbacks use ordinary scene/camera rendering. See PibblThreeLayerDefinition.
Parameters
Section titled “Parameters”-
resources— Resources returned by create. -
frame— Shared Pibbl frame timing and invalidation service. See PibblRenderLayerFrame . -
context— Adapter-owned renderer, surface, input bridge, and invalidation services. See PibblThreeLayerContext .
targets (optional)
targets?: ((resources: Resources, props: Readonly<Props>) => Iterable<PibblThreeTarget>) | undefinedRelated API: PibblThreeTarget.
Returns the Three objects exposed as Pibbl interaction and focus targets. See PibblThreeTarget.
Parameters
Section titled “Parameters”-
resources— Resources returned by create. -
props— Props used by this interaction generation.
Returns
Section titled “Returns”Object targets and their Pibbl event/focus metadata. See PibblThreeTarget.
pick (optional)
pick?: ((resources: Resources, context: PibblThreeLayerContext) => PibblThreePicker) | undefinedRelated API: PibblThreeLayerContext, PibblThreePicker.
Creates a custom picker for the settled generation; omission uses the adapter’s raycasting. See PibblThreePicker.
Parameters
Section titled “Parameters”-
resources— Resources returned by create. -
context— Adapter-owned renderer, surface, input bridge, and invalidation services. See PibblThreeLayerContext .
Returns
Section titled “Returns”A picker for the current scene resources. See PibblThreePicker.
dispose (optional)
dispose?: ((resources: Resources, context: PibblThreeLayerContext) => void) | undefinedRelated API: PibblThreeLayerContext.
Disposes application-created Three resources; the adapter disposes its own renderer. See PibblThreeLayerDefinition.
Parameters
Section titled “Parameters”-
resources— Application-owned resources returned by create; release geometries, materials, and other owned resources here. -
context— Adapter context; the adapter releases its renderer and bridge after this callback. See PibblThreeLayerContext .
PibblThreeLayerResources
Section titled “PibblThreeLayerResources”Application-owned scene and camera required by a Three layer; additional resources may be stored alongside them.
interface PibblThreeLayerResourcesRelated API: PibblThreeLayerResources.
See also
Section titled “See also”THREE.Scene
THREE.Camera
View source — packages/three/src/lib/types.ts:22
Properties and methods
Section titled “Properties and methods”
scene
readonly scene: THREE.Scene<THREE.Object3DEventMap>Application-owned scene rendered by the layer. See THREE.Scene.
camera
readonly camera: THREE.CameraApplication-owned camera used for rendering and picking. See THREE.Camera.
PibblThreePicker
Section titled “PibblThreePicker”Hit-tests a layer-local logical point against a settled Three scene.
type PibblThreePicker = ( point: Readonly<{ /** * Horizontal coordinate or displacement in the containing coordinate system. See * {@link PibblThreePicker}. */ x: number; /** * Vertical coordinate or displacement in the containing coordinate system. See * {@link PibblThreePicker}. */ y: number; }>,) => PibblThreePickResultRelated API: PibblThreePicker, displacement, PibblThreePickResult.
Parameters
Section titled “Parameters”point— Pointer position in layer-local logical coordinates.
Returns
Section titled “Returns”A Three object target, a blocking hit, or a miss. See PibblThreePickResult.
See also
Section titled “See also”View source — packages/three/src/lib/types.ts:97
PibblThreePickResult
Section titled “PibblThreePickResult”The target, block, or miss result of picking in a Three layer.
type PibblThreePickResult = PibblRenderLayerHit<THREE.Object3D>Related API: PibblThreePickResult, PibblRenderLayerHit.
See also
Section titled “See also”THREE.Object3D
View source — packages/three/src/lib/types.ts:60
Properties and methods
Section titled “Properties and methods”
kind
readonly kind: "block" | "miss" | "target"Selects the kind of geometry, material, or result. See PibblRenderLayerHit.
View source — packages/core/src/lib/render-layer/types.ts:103
PibblThreeRendererOptions
Section titled “PibblThreeRendererOptions”Three renderer construction options, excluding the canvas and transparency owned by the adapter.
type PibblThreeRendererOptions = Omit< THREE.WebGLRendererParameters, "canvas" | "alpha">Related API: PibblThreeRendererOptions.
See also
Section titled “See also”THREE.WebGLRendererParameters
View source — packages/three/src/lib/types.ts:68
PibblThreeTarget
Section titled “PibblThreeTarget”A Three object registered as a Pibbl logical event and keyboard-focus target.
interface PibblThreeTargetRelated API: PibblThreeTarget.
See also
Section titled “See also”THREE.Object3D
View source — packages/three/src/lib/types.ts:38
Properties and methods
Section titled “Properties and methods”
object
readonly object: THREE.Object3D<THREE.Object3DEventMap>Three object registered as a Pibbl logical target. See THREE.Object3D.
handlers (optional)
Full type declaration
readonly handlers?: Partial<{ onAuxClick: PibblEventHandler<"auxclick">; onBeforeInput: PibblEventHandler<"beforeinput">; onBlur: PibblEventHandler<"blur">; onChange: PibblEventHandler<"change">; onClick: PibblEventHandler<"click">; onCompositionEnd: PibblEventHandler<"compositionend">; onCompositionStart: PibblEventHandler<"compositionstart">; onCompositionUpdate: PibblEventHandler<"compositionupdate">; onContextMenu: PibblEventHandler<"contextmenu">; onCopy: PibblEventHandler<"copy">; onCut: PibblEventHandler<"cut">; onDblClick: PibblEventHandler<"dblclick">; onDrag: PibblEventHandler<"drag">; onDragEnd: PibblEventHandler<"dragend">; onDragEnter: PibblEventHandler<"dragenter">; onDragLeave: PibblEventHandler<"dragleave">; onDragOver: PibblEventHandler<"dragover">; onDragStart: PibblEventHandler<"dragstart">; onDrop: PibblEventHandler<"drop">; onFocus: PibblEventHandler<"focus">; onFocusIn: PibblEventHandler<"focusin">; onFocusOut: PibblEventHandler<"focusout">; onGotPointerCapture: PibblEventHandler<"gotpointercapture">; onInput: PibblEventHandler<"input">; onKeyDown: PibblEventHandler<"keydown">; onKeyUp: PibblEventHandler<"keyup">; onLostPointerCapture: PibblEventHandler<"lostpointercapture">; onMouseDown: PibblEventHandler<"mousedown">; onMouseEnter: PibblEventHandler<"mouseenter">; onMouseLeave: PibblEventHandler<"mouseleave">; onMouseMove: PibblEventHandler<"mousemove">; onMouseOut: PibblEventHandler<"mouseout">; onMouseOver: PibblEventHandler<"mouseover">; onMouseUp: PibblEventHandler<"mouseup">; onPaste: PibblEventHandler<"paste">; onPointerCancel: PibblEventHandler<"pointercancel">; onPointerDown: PibblEventHandler<"pointerdown">; onPointerEnter: PibblEventHandler<"pointerenter">; onPointerLeave: PibblEventHandler<"pointerleave">; onPointerMove: PibblEventHandler<"pointermove">; onPointerOut: PibblEventHandler<"pointerout">; onPointerOver: PibblEventHandler<"pointerover">; onPointerRawUpdate: PibblEventHandler<"pointerrawupdate">; onPointerUp: PibblEventHandler<"pointerup">; onSelect: PibblEventHandler<"select">; onSelectionChange: PibblEventHandler<"selectionchange">; onTouchCancel: PibblEventHandler<"touchcancel">; onTouchEnd: PibblEventHandler<"touchend">; onTouchMove: PibblEventHandler<"touchmove">; onTouchStart: PibblEventHandler<"touchstart">; onWheel: PibblEventHandler<"wheel">; } & { onAuxClickCapture: PibblEventHandler<"auxclick">; onBeforeInputCapture: PibblEventHandler<"beforeinput">; onBlurCapture: PibblEventHandler<"blur">; onChangeCapture: PibblEventHandler<"change">; onClickCapture: PibblEventHandler<"click">; onCompositionEndCapture: PibblEventHandler<"compositionend">; onCompositionStartCapture: PibblEventHandler<"compositionstart">; onCompositionUpdateCapture: PibblEventHandler<"compositionupdate">; onContextMenuCapture: PibblEventHandler<"contextmenu">; onCopyCapture: PibblEventHandler<"copy">; onCutCapture: PibblEventHandler<"cut">; onDblClickCapture: PibblEventHandler<"dblclick">; onDragCapture: PibblEventHandler<"drag">; onDragEndCapture: PibblEventHandler<"dragend">; onDragEnterCapture: PibblEventHandler<"dragenter">; onDragLeaveCapture: PibblEventHandler<"dragleave">; onDragOverCapture: PibblEventHandler<"dragover">; onDragStartCapture: PibblEventHandler<"dragstart">; onDropCapture: PibblEventHandler<"drop">; onFocusCapture: PibblEventHandler<"focus">; onFocusInCapture: PibblEventHandler<"focusin">; onFocusOutCapture: PibblEventHandler<"focusout">; onGotPointerCaptureCapture: PibblEventHandler<"gotpointercapture">; onInputCapture: PibblEventHandler<"input">; onKeyDownCapture: PibblEventHandler<"keydown">; onKeyUpCapture: PibblEventHandler<"keyup">; onLostPointerCaptureCapture: PibblEventHandler<"lostpointercapture">; onMouseDownCapture: PibblEventHandler<"mousedown">; onMouseEnterCapture: PibblEventHandler<"mouseenter">; onMouseLeaveCapture: PibblEventHandler<"mouseleave">; onMouseMoveCapture: PibblEventHandler<"mousemove">; onMouseOutCapture: PibblEventHandler<"mouseout">; onMouseOverCapture: PibblEventHandler<"mouseover">; onMouseUpCapture: PibblEventHandler<"mouseup">; onPasteCapture: PibblEventHandler<"paste">; onPointerCancelCapture: PibblEventHandler<"pointercancel">; onPointerDownCapture: PibblEventHandler<"pointerdown">; onPointerEnterCapture: PibblEventHandler<"pointerenter">; onPointerLeaveCapture: PibblEventHandler<"pointerleave">; onPointerMoveCapture: PibblEventHandler<"pointermove">; onPointerOutCapture: PibblEventHandler<"pointerout">; onPointerOverCapture: PibblEventHandler<"pointerover">; onPointerRawUpdateCapture: PibblEventHandler<"pointerrawupdate">; onPointerUpCapture: PibblEventHandler<"pointerup">; onSelectCapture: PibblEventHandler<"select">; onSelectionChangeCapture: PibblEventHandler<"selectionchange">; onTouchCancelCapture: PibblEventHandler<"touchcancel">; onTouchEndCapture: PibblEventHandler<"touchend">; onTouchMoveCapture: PibblEventHandler<"touchmove">; onTouchStartCapture: PibblEventHandler<"touchstart">; onWheelCapture: PibblEventHandler<"wheel">; }> | undefinedRelated API: PibblEventHandler, blur.
Event handlers dispatched for this logical target. See PibblEventHandlers.
pointerEvents (optional)
readonly pointerEvents?: PibblPointerEvents | undefinedRelated API: PibblPointerEvents.
Whether this content participates in pointer targeting. See PibblPointerEvents.
cursor (optional)
readonly cursor?: string | undefinedCursor shown while this target owns pointer presentation. See PibblThreeTarget.
keyboardFocusable (optional)
readonly keyboardFocusable?: boolean | undefinedWhether the target may receive keyboard focus. See PibblThreeTarget.
keyboardNavigationBounds (optional)
readonly keyboardNavigationBounds?: Readonly<LayoutBox> | undefinedRelated API: LayoutBox.
Logical rectangle used for directional keyboard navigation. See LayoutBox.
Implementation guidance for agents
Section titled “Implementation guidance for agents”Read the External renderers and Three.js companion for ownership, adaptation, failure modes, and verification. Agent start provides the version-selection workflow.
Complete minimal examples
Section titled “Complete minimal examples”- Three.js orbit controls: Drag a cube using OrbitControls connected to Pibbl-routed input. Plain source
- Three.js scene layer: Mount a lit Three.js cube with Pibbl target clicks and raycast picking. Plain source
Documentation version
Section titled “Documentation version”Documentation built with @pibbl/core 0.0.2, revision 380919b. ALPHA — NOT FOR PRODUCTION USE.