@layoutit/polycss-react 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,9 +1,10 @@
1
1
  import * as React$1 from 'react';
2
- import React__default, { ReactNode, CSSProperties, MouseEventHandler, PointerEventHandler, FocusEventHandler, KeyboardEventHandler, IframeHTMLAttributes, RefObject, MouseEvent as MouseEvent$1 } from 'react';
2
+ import React__default, { ReactNode, CSSProperties, IframeHTMLAttributes, RefObject, MouseEvent } from 'react';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import * as _layoutit_polycss_core from '@layoutit/polycss-core';
5
- import { Vec3, CameraState, CameraHandle, PolyCameraProjection, PolyTextureImageSource, PolyTexturePresentation, Vec2, PolyMaterial, PolyDirectionalLight, PolyTextureLightingMode, TextureQuality, PolyTextureLeafSizing, PolyTextureImageRendering, PolyTextureBackend, PolyTextureProjection, Polygon, PolyAmbientLight, PolySeamBleed, PolyRenderStrategiesOption, LoadMeshOptions, ParseResult, MeshResolution, BoxPolygonsOptions, ConePolygonsOptions, CylinderPolygonsOptions, DodecahedronPolygonsOptions, IcosahedronPolygonsOptions, OctahedronPolygonsOptions, PlanePolygonsOptions, RingPolygonsOptions, SpherePolygonsOptions, TetrahedronPolygonsOptions, TorusPolygonsOptions, PolyAnimationTarget, PolyAnimationMixer, PolyAnimationClip, PolyAnimationAction, ParseAnimationController } from '@layoutit/polycss-core';
4
+ import { Vec3, CameraState, CameraHandle, PolyCameraProjection, Polygon, PolyDirectionalLight, PolyPointLight, PolyAmbientLight, PolyTextureLightingMode, TextureQuality, PolyTextureLeafSizing, PolyTextureImageRendering, PolyTextureBackend, PolyTextureProjection, PolySeamBleed, PolyRenderStrategiesOption, PolyMaterial, BoxPolygonsOptions, ConePolygonsOptions, CylinderPolygonsOptions, DodecahedronPolygonsOptions, IcosahedronPolygonsOptions, OctahedronPolygonsOptions, PlanePolygonsOptions, RingPolygonsOptions, SpherePolygonsOptions, TetrahedronPolygonsOptions, TorusPolygonsOptions, PolyAnimationTarget, PolyAnimationMixer, PolyAnimationClip, PolyAnimationAction, ParseAnimationController } from '@layoutit/polycss-core';
6
5
  export { ArrowPolygonsOptions, AutoRotateConfig, AutoRotateOption, AxesHelperOptions, BASE_TILE, BoxFace, BoxFaceOptions, BoxPolygonsOptions, CAMERA_BACKFACE_CULL_EPS, CameraCullNormalGroup, CameraCullRotation, CameraHandle, CameraState, CameraStyleInput, ConePolygonsOptions, CoverPlanarPolygonsOptions, CullInteriorOptions, CylinderPolygonsOptions, DEFAULT_CAMERA_STATE, DEFAULT_PROJECTION, DEFAULT_SEAM_FACET_SPLIT_OPTIONS, DEFAULT_SEAM_OVERLAP_OPTIONS, DodecahedronPolygonsOptions, GltfParseOptions, IcosahedronPolygonsOptions, LoadMeshOptions, LoopMode, LoopOnce, LoopPingPong, LoopRepeat, MeshResolution, MtlParseResult, NormalizeResult, ObjParseOptions, OctahedronPolygonsOptions, OptimizeAnimatedMeshPolygonsOptions, OptimizeMeshParseResultOptions, OptimizeMeshPolygonsOptions, ParseAnimationClip, ParseAnimationController, ParseResult, ParseStlColor, ParseStlSolid, ParseStlTopology, ParsedColor, PlanePolygonsOptions, PolyAmbientLight, PolyAnimationAction, PolyAnimationClip, PolyAnimationMixer, PolyAnimationTarget, PolyCameraProjection, PolyCameraSnapshot, PolyCameraSnapshotOptions, PolyCameraSnapshotSource, PolyDirectionalLight, PolyMaterial, PolyMeshTransformInput, PolyRenderStrategiesOption, PolyRenderStrategy, PolySceneTransformInput, PolyTextureBackend, PolyTextureImageLighting, PolyTextureImageRendering, PolyTextureImageSource, PolyTextureLeafSizing, PolyTextureLightingMode, PolyTexturePresentation, PolyTextureProjection, Polygon, PolygonFace, RingPolygonsOptions, SceneBbox, SceneContext, SceneContextBuildArgs, SceneContextBuildResult, SeamFacetSplitCandidate, SeamFacetSplitCandidateReason, SeamFacetSplitOptions, SeamFacetSplitReport, SeamOverlapCandidate, SeamOverlapCandidateKind, SeamOverlapDiagnostics, SeamOverlapOptions, SimplifyTriangleMeshPolygonsOptions, SolidTextureSampleOptions, StlParseOptions, TetrahedronPolygonsOptions, TexturePaintMetrics, TexturePaintMetricsOptions, TextureTriangle, TorusPolygonsOptions, VOXEL_CAMERA_CULL_AXIS_EPS, VOXEL_CAMERA_CULL_NORMAL_LIMIT, Vec2, Vec3, VoxParseOptions, arrowPolygons, axesHelperPolygons, bakeSolidTextureSampledPolygons, bakeSolidTextureSamples, boxPolygons, buildPolyCameraSceneTransform, buildPolyMeshTransform, buildPolySceneTransform, buildSceneContext, cameraCullNormalGroups, cameraCullNormalGroupsFromPolygons, cameraCullNormalKey, cameraCullVisibleSignature, cameraFacingDepth, capturePolyCameraSnapshot, clampChannel, computeSceneBbox, computeShapeLighting, computeTexturePaintMetrics, conePolygons, coverPlanarPolygons, createIsometricCamera, createPolyAnimationMixer, cssDistanceToWorld, cssPositionToWorld, cullInteriorPolygons, cylinderPolygons, dodecahedronPolygons, formatColor, icosahedronPolygons, inverseRotateVec3, isAxisAlignedSurfaceNormal, isVoxelCameraCullableNormalGroups, loadMesh, mergePolygons, normalFacesCamera, normalizeInvertMultiplier, normalizePolygons, octahedronPolygons, optimizeAnimatedMeshPolygons, optimizeMeshParseResult, optimizeMeshPolygons, parseColor, parseGltf, parseHexColor, parseMtl, parseObj, parsePureColor, parseRgbColor, parseStl, parseVox, planePolygons, polyCameraTargetToCss, polyCssDistanceToWorld, polyCssPositionToWorld, polygonCssSurfaceNormal, polygonFaces, polygonFacesCamera, repairMeshSeams, resolvePolyCameraAppliedPerspectiveStyle, ringPolygons, rotateVec3, seamFacetSplitPolygons, seamFacetSplitReport, seamOverlapDiagnostics, seamOverlapPolygons, seamOverlapReport, shadeColor, simplifyTriangleMeshPolygons, tetrahedronPolygons, torusPolygons, worldDirectionToCss, worldDirectionToPolyCss, worldDirectionalLightToCss, worldDirectionalLightToPolyCss, worldDistanceToCss, worldDistanceToPolyCss, worldPositionToCss, worldPositionToPolyCss } from '@layoutit/polycss-core';
6
+ import { T as TransformProps, P as PolyProps, a as PolyMeshProps, b as PolyMeshHandle } from './PolyMesh-7fLCYk5L.cjs';
7
+ export { D as DOMPassthroughProps, I as InteractionProps, c as PolyEventHandler, d as PolyMesh, e as PolyMouseEvent, f as PolyPointerEvent, g as PolyWheelEvent, U as UseMeshOptions, h as UseMeshResult, i as findMeshUnderPoint, j as findPolyMeshHandle, p as pointInMeshElement, u as usePolyMesh } from './PolyMesh-7fLCYk5L.cjs';
7
8
 
8
9
  interface PolyPerspectiveCameraProps {
9
10
  zoom?: number;
@@ -118,91 +119,32 @@ interface ShadowOptions {
118
119
  * disable the cap entirely.
119
120
  */
120
121
  maxExtend?: number;
121
- }
122
-
123
- /** Three.js-style transform props accepted by every PolyCSS component. */
124
- interface TransformProps {
125
- position?: Vec3;
126
- scale?: number | Vec3;
127
- rotation?: Vec3;
128
- }
129
- /**
130
- * DOM event handlers, ARIA, and style props forwarded to the rendered
131
- * element by every Poly component.
132
- *
133
- * This is the DOM-native pitch: polygons are real DOM nodes you can
134
- * target with CSS, attach event handlers to, and inspect in DevTools.
135
- */
136
- interface DOMPassthroughProps {
137
- className?: string;
138
- style?: CSSProperties;
139
- id?: string;
140
- onClick?: MouseEventHandler<HTMLElement>;
141
- onDoubleClick?: MouseEventHandler<HTMLElement>;
142
- onMouseEnter?: MouseEventHandler<HTMLElement>;
143
- onMouseLeave?: MouseEventHandler<HTMLElement>;
144
- onMouseMove?: MouseEventHandler<HTMLElement>;
145
- onPointerDown?: PointerEventHandler<HTMLElement>;
146
- onPointerUp?: PointerEventHandler<HTMLElement>;
147
- onPointerEnter?: PointerEventHandler<HTMLElement>;
148
- onPointerLeave?: PointerEventHandler<HTMLElement>;
149
- onFocus?: FocusEventHandler<HTMLElement>;
150
- onBlur?: FocusEventHandler<HTMLElement>;
151
- onKeyDown?: KeyboardEventHandler<HTMLElement>;
152
- tabIndex?: number;
153
- role?: string;
154
- "aria-label"?: string;
155
- "aria-hidden"?: boolean;
156
- pointerEvents?: "auto" | "none";
157
- [dataAttr: `data-${string}`]: string | number | boolean | undefined;
158
- }
159
- /**
160
- * Props for the `<Poly>` component — the atomic polygon primitive.
161
- *
162
- * Extends TransformProps + DOMPassthroughProps with the polygon's own fields.
163
- * This is the canonical Poly component API.
164
- */
165
- interface PolyProps extends TransformProps, DOMPassthroughProps {
166
- vertices: Vec3[];
167
- color?: string;
168
- texture?: string;
169
- textureImageSource?: PolyTextureImageSource;
170
- texturePresentation?: PolyTexturePresentation;
171
- uvs?: Vec2[];
172
- data?: Record<string, string | number | boolean>;
173
- doubleSided?: boolean;
174
- /** Shared material. When set AND the polygon's UVs form an axis-aligned
175
- * rectangle, renders via `background-image` directly — no per-polygon
176
- * canvas rasterization. Falls back to the atlas path otherwise. */
177
- material?: PolyMaterial;
178
- context?: {
179
- tileSize?: number;
180
- layerElevation?: number;
181
- directionalLight?: PolyDirectionalLight;
182
- textureLighting?: PolyTextureLightingMode;
183
- textureQuality?: TextureQuality;
184
- textureLeafSizing?: PolyTextureLeafSizing;
185
- textureImageRendering?: PolyTextureImageRendering;
186
- textureBackend?: PolyTextureBackend;
187
- textureProjection?: PolyTextureProjection;
188
- debugShowBackfaces?: boolean;
189
- [key: string]: unknown;
190
- };
191
- /** Textured polygon lighting mode. Defaults to scene context, then "baked". */
192
- textureLighting?: PolyTextureLightingMode;
193
- /** Atlas bitmap budget and CSS sprite size. `"auto"` (default) uses a
194
- * device-appropriate memory budget and desktop/mobile sprite sizing. */
195
- textureQuality?: TextureQuality;
196
- /** Atlas leaf CSS primitive sizing. Defaults to scene context, then canonical. */
197
- textureLeafSizing?: PolyTextureLeafSizing;
198
- /** Default image filtering for atlas and direct image texture leaves. */
199
- textureImageRendering?: PolyTextureImageRendering;
200
- /** Default texture backend request. Defaults to scene context, then "auto". */
201
- textureBackend?: PolyTextureBackend;
202
- /** Default texture projection request. Defaults to scene context, then "affine". */
203
- textureProjection?: PolyTextureProjection;
204
- /** Pre-computed shaded base color from the parent (optional override). */
205
- baseColor?: string;
122
+ /**
123
+ * Cast a low-resolution parametric silhouette per caster instead of its full
124
+ * geometry lighter DOM + cheaper projection at the cost of an approximate
125
+ * outline. Casts onto every receiver through the normal pipeline. Default:
126
+ * `false`. (Directional + point lights; the exact path stays the default.)
127
+ */
128
+ parametric?: boolean;
129
+ /**
130
+ * Parametric-shadow detail (max silhouette points / pixel-grid resolution).
131
+ * Only used when `parametric` is true. Default: `16`. Override per mesh via
132
+ * `<PolyMesh shadowDefinition>`.
133
+ */
134
+ definition?: number;
135
+ /**
136
+ * Parametric render style: `"vector"` (smooth contour, default) or `"pixel"`
137
+ * (greedy-meshed voxel blocks; `definition` becomes the grid resolution).
138
+ */
139
+ style?: "vector" | "pixel";
140
+ /**
141
+ * Re-emit a caster's shadow while it animates (deforms) so the shadow follows
142
+ * the pose instead of freezing. Default `false`: a same-topology deform keeps
143
+ * the last shadow pose (re-emitting every frame is expensive). Best with
144
+ * `parametric` — a low-res silhouette is cheap to reproject. Topology changes
145
+ * (different polygon count) always re-emit regardless.
146
+ */
147
+ followAnimation?: boolean;
206
148
  }
207
149
 
208
150
  interface PolySceneProps extends TransformProps {
@@ -227,6 +169,9 @@ interface PolySceneProps extends TransformProps {
227
169
  rotY?: number;
228
170
  zoom?: number;
229
171
  directionalLight?: PolyDirectionalLight;
172
+ /** Point lights (world-space positions). Direction-only per-face Lambert,
173
+ * baked-mode only. */
174
+ pointLights?: PolyPointLight[];
230
175
  ambientLight?: PolyAmbientLight;
231
176
  /** Textured polygon lighting mode. Defaults to "baked". */
232
177
  textureLighting?: PolyTextureLightingMode;
@@ -275,255 +220,9 @@ interface PolySceneProps extends TransformProps {
275
220
  debugShowLabels?: boolean;
276
221
  debugShowBackfaces?: boolean;
277
222
  }
278
- declare function PolySceneInner({ polygons: polygonsProp, centerPolygons: centerPolygonsProp, perspective: _perspective, rotX: _rotX, rotY: _rotY, zoom: _zoom, directionalLight, ambientLight, textureLighting, textureQuality, textureLeafSizing, textureImageRendering, textureBackend, textureProjection, seamBleed, strategies, autoCenter, shadow, className, style, children, position: _position, scale: _scale, rotation: _rotation, debugShowLabels: _debugShowLabels, debugShowBackfaces, }: PolySceneProps): react_jsx_runtime.JSX.Element;
223
+ declare function PolySceneInner({ polygons: polygonsProp, centerPolygons: centerPolygonsProp, perspective: _perspective, rotX: _rotX, rotY: _rotY, zoom: _zoom, directionalLight, pointLights, ambientLight, textureLighting, textureQuality, textureLeafSizing, textureImageRendering, textureBackend, textureProjection, seamBleed, strategies, autoCenter, shadow, className, style, children, position: _position, scale: _scale, rotation: _rotation, debugShowLabels: _debugShowLabels, debugShowBackfaces, }: PolySceneProps): react_jsx_runtime.JSX.Element;
279
224
  declare const PolyScene: React$1.MemoExoticComponent<typeof PolySceneInner>;
280
225
 
281
- type UseMeshOptions = LoadMeshOptions;
282
- interface UseMeshResult {
283
- polygons: Polygon[];
284
- voxelSource: ParseResult["voxelSource"];
285
- loading: boolean;
286
- error: Error | null;
287
- warnings: string[];
288
- /** Manually trigger cleanup (also called on unmount automatically). */
289
- dispose: () => void;
290
- }
291
- declare function usePolyMesh(src: string, options?: UseMeshOptions): UseMeshResult;
292
-
293
- /**
294
- * Pointer event API for <PolyMesh>. Mirrors @react-three/fiber's mesh
295
- * event surface (handler names + payload shape) so devs migrating from
296
- * three.js use the same mental model. PolyCSS is DOM-native so we get
297
- * native pointer events for free — no raycaster, no canvas event
298
- * synthesis.
299
- *
300
- * Diverges from r3f in two intentional ways:
301
- * 1. Bubbling matches DOM (pointer hits the front element only). r3f
302
- * replays events to occluded objects behind the front hit; doing
303
- * that here would require running our own raycaster, which defeats
304
- * the point of being DOM-native.
305
- * 2. `face`, `uv`, `uv1`, `instanceId` are omitted — they're three.js
306
- * BufferGeometry / InstancedMesh concepts with no polycss analogue.
307
- * The polycss-native equivalent of `face` is the hit polygon's
308
- * index, exposed via `polygon` (set when the underlying DOM target
309
- * is an `<i>` polygon element).
310
- */
311
-
312
- /**
313
- * Imperative handle exposed by `<PolyMesh ref>`. Read-only view of the
314
- * mesh's element + current transform + polygons. Mutation flows through
315
- * controlled props (parent owns transform state) — matches three.js
316
- * editor's pattern of keeping `selected` external to the object.
317
- */
318
- interface PolyMeshHandle {
319
- /** The `.polycss-mesh` wrapper div (null until mounted). */
320
- readonly element: HTMLDivElement | null;
321
- /** Identifier passed via the `id` prop, if any. */
322
- readonly id?: string;
323
- /** Current `position` prop value. */
324
- getPosition(): Vec3 | undefined;
325
- /** Current `rotation` prop value (Euler degrees). */
326
- getRotation(): Vec3 | undefined;
327
- /** Current `scale` prop value. */
328
- getScale(): number | Vec3 | undefined;
329
- /** Polygons currently being rendered (post-autoCenter). */
330
- getPolygons(): Polygon[];
331
- /**
332
- * Replace the mesh polygons imperatively. Animated solid-triangle meshes use
333
- * a stable DOM update path that mutates mounted leaves directly; unsupported
334
- * topology falls back to the normal framework render path.
335
- */
336
- setPolygons(polygons: Polygon[]): void;
337
- /**
338
- * Snapshot the current `rotation` prop as the new "baked rotation" and
339
- * trigger an atlas re-rasterization with the directional light
340
- * inverse-rotated into the mesh's local frame.
341
- *
342
- * Call this after a rotate-mode drag ends (i.e. on pointer release) —
343
- * **not** on every pointermove during the drag. The visual wrapper already
344
- * follows the live `rotation` prop smoothly; the atlas only needs to
345
- * update once per committed rotation so it doesn't re-bake every frame.
346
- *
347
- * Math rationale: baked atlas tiles encode `baseColor × Lambert(worldNormal,
348
- * worldLight)`. When the mesh wrapper rotates via CSS the world-space normal
349
- * changes but the baked color does not, causing stale shading. Calling
350
- * `rebakeAtlas()` inverse-rotates the world light into the mesh-local frame
351
- * before re-running the atlas baker, so `dot(localNormal, localLight) ===
352
- * dot(worldNormal, worldLight)` and the shading is correct again.
353
- *
354
- * In dynamic (`textureLighting="dynamic"`) mode this call is a no-op for
355
- * shading purposes (dynamic mode re-evaluates per frame), but it is still
356
- * safe to call.
357
- */
358
- rebakeAtlas(): void;
359
- /** Resolves when this mesh's current texture generation has usable backgrounds. */
360
- whenTexturesReady(): Promise<void>;
361
- /**
362
- * Mutate a single polygon in place and re-render the mesh. `target` is
363
- * either a polygon reference (as returned by `getPolygons()`) or its index.
364
- * `partial` fields are merged onto the polygon via `Object.assign`. Skips
365
- * the merge pass — cheaper than a full prop change for targeted edits like
366
- * color picker updates from an inspector UI. Silently no-ops when `target`
367
- * is not found or the index is out of range.
368
- */
369
- updatePolygon(target: Polygon | number, partial: Partial<Polygon>): void;
370
- }
371
- /**
372
- * Pointer event payload delivered to <PolyMesh> handlers. Mirrors r3f's
373
- * shape, minus raycaster-specific fields. See module docstring for the
374
- * intentional divergences.
375
- */
376
- interface PolyPointerEvent<E extends Event = PointerEvent> {
377
- /** The mesh originally under the pointer (deepest hit). */
378
- object: PolyMeshHandle;
379
- /** The mesh whose handler is being invoked. Equal to `object` until
380
- * ancestor bubbling is added (out of scope for v1). */
381
- eventObject: PolyMeshHandle;
382
- /** All meshes stacked under the pointer this moment, front-to-back.
383
- * Computed via `document.elementsFromPoint` then filtered to
384
- * registered `.polycss-mesh` ancestors. */
385
- intersections: Array<{
386
- object: PolyMeshHandle;
387
- }>;
388
- /** Pointer position in normalized device coords [-1, 1] relative to
389
- * the camera viewport. (0,0) = viewport center. Falls back to (0,0)
390
- * when the mesh is rendered outside a `<PolyCamera>`. */
391
- pointer: {
392
- x: number;
393
- y: number;
394
- };
395
- /** Pixel distance from the most recent `pointerdown` to this event.
396
- * 0 on pointerdown itself. Use to discriminate click-vs-drag. */
397
- delta: number;
398
- /** The underlying DOM event. */
399
- nativeEvent: E;
400
- /** Stops native bubbling. (Equivalent to `nativeEvent.stopPropagation()`
401
- * today; reserved for future r3f-style bubbling above the wrapper.) */
402
- stopPropagation(): void;
403
- }
404
- type PolyMouseEvent = PolyPointerEvent<MouseEvent>;
405
- type PolyWheelEvent = PolyPointerEvent<WheelEvent>;
406
- type PolyEventHandler<E extends Event = PointerEvent> = (event: PolyPointerEvent<E>) => void;
407
- /**
408
- * Pointer / mouse / wheel handlers accepted by `<PolyMesh>`. Names mirror
409
- * r3f exactly. Provide any handler to opt the mesh into receiving events;
410
- * absent handlers add zero overhead.
411
- */
412
- interface InteractionProps {
413
- onClick?: PolyEventHandler<MouseEvent>;
414
- onContextMenu?: PolyEventHandler<MouseEvent>;
415
- onDoubleClick?: PolyEventHandler<MouseEvent>;
416
- onWheel?: PolyEventHandler<WheelEvent>;
417
- onPointerDown?: PolyEventHandler<PointerEvent>;
418
- onPointerUp?: PolyEventHandler<PointerEvent>;
419
- onPointerMove?: PolyEventHandler<PointerEvent>;
420
- onPointerOver?: PolyEventHandler<PointerEvent>;
421
- onPointerOut?: PolyEventHandler<PointerEvent>;
422
- onPointerEnter?: PolyEventHandler<PointerEvent>;
423
- onPointerLeave?: PolyEventHandler<PointerEvent>;
424
- onPointerCancel?: PolyEventHandler<PointerEvent>;
425
- }
426
- /** Walk up from `el` looking for the nearest registered mesh wrapper. */
427
- declare function findPolyMeshHandle(el: Element | null): PolyMeshHandle | null;
428
- /** Test whether `(clientX, clientY)` falls inside any polygon leaf
429
- * child of `meshEl`'s post-3D bounding rect. Skips zero-area rects
430
- * (happy-dom and pre-layout SSR return those). */
431
- declare function pointInMeshElement(meshEl: HTMLElement, clientX: number, clientY: number): boolean;
432
- /** Walk every registered `.polycss-mesh` in the document and return
433
- * the first whose polygon bounding-rects contain `(clientX, clientY)`.
434
- * An optional `filter` skips matched mesh elements (e.g. gizmos). */
435
- declare function findMeshUnderPoint(clientX: number, clientY: number, filter?: (meshEl: HTMLElement) => boolean): PolyMeshHandle | null;
436
-
437
- interface PolyMeshProps extends TransformProps, InteractionProps {
438
- /** Stable identifier — exposed on the mesh handle and reflected as
439
- * `data-poly-mesh-id` on the wrapper div. Use for selection lookups. */
440
- id?: string;
441
- /** URL to .obj / .glb / .gltf. Mutually exclusive with `polygons`. */
442
- src?: string;
443
- /**
444
- * Companion `.mtl` URL for OBJ models. When set, materials defined in
445
- * the mtl (Kd colors, map_Kd textures) are applied to the loaded mesh.
446
- * Ignored for GLB/GLTF (they carry materials inline).
447
- */
448
- mtl?: string;
449
- /** Pre-parsed polygons. Mutually exclusive with `src`. */
450
- polygons?: Polygon[];
451
- /** Optional `parseResult.voxelSource` companion for `.vox` meshes. When
452
- * set alongside `polygons`, the direct voxel renderer fast path activates
453
- * — emitting one `<b>` per visible voxel quad inside `.polycss-voxel-face`
454
- * wrappers (matches vanilla's `scene.add(parseResult)` behaviour).
455
- * Callers fetching via core's `loadMesh()` pass `parseResult.voxelSource`
456
- * here so the fast path engages; callers fetching via PolyMesh's `src`
457
- * prop get the same data wired through `useMesh` automatically. */
458
- voxelSource?: _layoutit_polycss_core.ParseResult["voxelSource"];
459
- /** Translate so mesh's bbox center is at local origin before applying `position`. */
460
- autoCenter?: boolean;
461
- /** Textured polygon lighting mode. Defaults to "baked". */
462
- textureLighting?: PolyTextureLightingMode;
463
- /** Atlas bitmap budget and CSS sprite size. `"auto"` (default) uses a
464
- * device-appropriate memory budget (~4 MB mobile / ~16 MB desktop) and
465
- * desktop/mobile sprite sizing. Numeric values 0.1..1 force an explicit
466
- * raster scale and the 64px sprite. */
467
- textureQuality?: TextureQuality;
468
- /** Atlas leaf CSS primitive sizing. Defaults to scene context, then canonical. */
469
- textureLeafSizing?: PolyTextureLeafSizing;
470
- /** Default image filtering for atlas and direct image texture leaves. */
471
- textureImageRendering?: PolyTextureImageRendering;
472
- /** Default texture backend request. Defaults to scene context, then "auto". */
473
- textureBackend?: PolyTextureBackend;
474
- /** Default texture projection request. Defaults to scene context, then "affine". */
475
- textureProjection?: PolyTextureProjection;
476
- /** Solid seam overscan. `"auto"` computes a fitted per-edge amount from the polygon plan. */
477
- seamBleed?: PolySeamBleed;
478
- /**
479
- * Hold the whole previous frame (geometry + texture) until the next atlas is
480
- * decoded, then swap atomically — so a geometry edit never shows geometry
481
- * before its texture. Best when edits arrive as discrete commits (no
482
- * continuous drag). Defaults to false (bitmap streams in over live geometry).
483
- */
484
- atomicAtlas?: boolean;
485
- /** Fires when the displayed atlas frame swaps to a ready one (atomic mode). */
486
- onFrameReady?: () => void;
487
- /** Per-polygon override render, or static children mounted inside the mesh wrapper. */
488
- children?: ((polygon: Polygon, index: number) => ReactNode) | ReactNode;
489
- /** Loading slot — rendered while `src` is being fetched/parsed. */
490
- fallback?: ReactNode;
491
- /** Error slot — rendered if parse fails. Receives the Error. */
492
- errorFallback?: (error: Error) => ReactNode;
493
- /** Parser options forwarded to parseObj/parseGltf. */
494
- parseOptions?: UseMeshOptions;
495
- /** Mesh optimization intent. Defaults to "lossy"; set "lossless" to keep
496
- * authored surface fidelity. Top-level prop wins over `parseOptions.meshResolution`
497
- * when both are present. */
498
- meshResolution?: MeshResolution;
499
- /**
500
- * When `true`, emits a per-mesh SVG shadow path in both lighting modes.
501
- * Each casting polygon projects onto the scene ground plane along the
502
- * directional light; overlapping outlines are merged into one silhouette.
503
- * Defaults to `false`.
504
- */
505
- castShadow?: boolean;
506
- /**
507
- * When `true`, this mesh acts as a shadow receiver. The scene's caster
508
- * meshes (those with `castShadow=true`) project per-coplanar-face SVG
509
- * shadows onto each visible surface of this mesh, matching Three.js's
510
- * `mesh.receiveShadow` semantics. Disables the ground-shadow fallback
511
- * for caster meshes — receivers handle shadow display. Defaults to `false`.
512
- */
513
- receiveShadow?: boolean;
514
- /**
515
- * Apply mesh optimization (coplanar merge + interior cull) before
516
- * rendering. Defaults to `true` — matches vanilla `scene.add`'s default.
517
- * Set `false` for helper meshes (axes, light markers) whose geometry
518
- * shouldn't be merged, or when the imperative `updatePolygon` API needs
519
- * polygon refs to survive across updates.
520
- */
521
- merge?: boolean;
522
- className?: string;
523
- style?: CSSProperties;
524
- }
525
- declare const PolyMesh: React$1.ForwardRefExoticComponent<PolyMeshProps & React$1.RefAttributes<PolyMeshHandle>>;
526
-
527
226
  interface PolyIframeProps {
528
227
  /** Iframe URL — forwarded to the underlying <iframe>'s `src` attribute. */
529
228
  src: string;
@@ -851,7 +550,7 @@ interface PolySelectProps {
851
550
  onChange?: (meshes: PolyMeshHandle[]) => void;
852
551
  /** Fires when a click lands inside the Select wrapper but resolves to
853
552
  * no mesh ancestor (i.e. the background). Receives the click event. */
854
- onPointerMissed?: (event: MouseEvent$1<HTMLDivElement>) => void;
553
+ onPointerMissed?: (event: MouseEvent<HTMLDivElement>) => void;
855
554
  /** When true (default), clicking the background clears selection. */
856
555
  clearOnMiss?: boolean;
857
556
  children?: ReactNode;
@@ -1047,4 +746,4 @@ interface UsePolyAnimationResult {
1047
746
  }
1048
747
  declare function usePolyAnimation(clips: PolyAnimationClip[] | undefined, controller: ParseAnimationController | undefined, root?: RefObject<PolyAnimationTarget | null> | PolyAnimationTarget | null): UsePolyAnimationResult;
1049
748
 
1050
- export { type DOMPassthroughProps, type InteractionProps, Poly, PolyAxesHelper, type PolyAxesHelperProps, PolyBox, type PolyBoxProps, PolyOrthographicCamera as PolyCamera, PolyCameraContext, type PolyCameraContextValue, type PolyOrthographicCameraProps as PolyCameraProps, type PolyCameraSnapshotStats, PolyCone, type PolyConeProps, type PolyControlsAnimateOptions, type PolyControlsCamera, PolyCylinder, type PolyCylinderProps, PolyDirectionalLightHelper, type PolyDirectionalLightHelperProps, PolyDodecahedron, type PolyDodecahedronProps, type PolyEventHandler, PolyFirstPersonControls, type PolyFirstPersonControlsHandle, type PolyFirstPersonControlsOptions, type PolyFirstPersonControlsProps, PolyGround, type PolyGroundProps, PolyIcosahedron, type PolyIcosahedronProps, PolyIframe, type PolyIframeProps, type PolyLeafInfo, PolyMapControls, type PolyControlsCamera as PolyMapControlsCamera, type PolyMapControlsProps, PolyMesh, type PolyMeshHandle, type PolyMeshProps, type PolyMouseEvent, PolyOctahedron, type PolyOctahedronProps, PolyOrbitControls, type PolyControlsCamera as PolyOrbitControlsCamera, type PolyOrbitControlsProps, PolyOrthographicCamera, type PolyOrthographicCameraProps, PolyPerspectiveCamera, type PolyPerspectiveCameraProps, PolyPlane, type PolyPlaneProps, type PolyPointerEvent, type PolyProps, type PolyRenderLeafStrategy, type PolyRenderStats, type PolyRenderStatsOptions, type PolyRenderSurfaceLeafCounts, PolyRing, type PolyRingProps, PolyScene, type PolySceneProps, PolySelect, type PolySelectProps, type PolySelectionApi, type PolySnapshotRenderStats, PolySphere, type PolySphereProps, PolyTetrahedron, type PolyTetrahedronProps, type PolyTextureReadiness, type PolyTextureRenderStats, PolyTorus, type PolyTorusProps, PolyTransformControls, type PolyTransformControlsObject, type PolyTransformControlsObjectChangeEvent, type PolyTransformControlsProps, type PolyWheelEvent, type SharedControlsProps, type TransformProps, type UseCameraOptions, type UseCameraResult, type UseMeshOptions, type UseMeshResult, type UsePolyAnimationResult, type UseSceneContextOptions, type UseSceneContextResult, collectPolyRenderStats, collectPolyTextureReadiness, findMeshUnderPoint, findPolyMeshHandle, injectPolyBaseStyles, pointInMeshElement, queryPolyLeaves, useCameraContext, usePolyAnimation, usePolyCamera, usePolyMaterial, usePolyMesh, usePolySceneContext, usePolySelect, usePolySelectionApi };
749
+ export { Poly, PolyAxesHelper, type PolyAxesHelperProps, PolyBox, type PolyBoxProps, PolyOrthographicCamera as PolyCamera, PolyCameraContext, type PolyCameraContextValue, type PolyOrthographicCameraProps as PolyCameraProps, type PolyCameraSnapshotStats, PolyCone, type PolyConeProps, type PolyControlsAnimateOptions, type PolyControlsCamera, PolyCylinder, type PolyCylinderProps, PolyDirectionalLightHelper, type PolyDirectionalLightHelperProps, PolyDodecahedron, type PolyDodecahedronProps, PolyFirstPersonControls, type PolyFirstPersonControlsHandle, type PolyFirstPersonControlsOptions, type PolyFirstPersonControlsProps, PolyGround, type PolyGroundProps, PolyIcosahedron, type PolyIcosahedronProps, PolyIframe, type PolyIframeProps, type PolyLeafInfo, PolyMapControls, type PolyControlsCamera as PolyMapControlsCamera, type PolyMapControlsProps, PolyMeshHandle, PolyMeshProps, PolyOctahedron, type PolyOctahedronProps, PolyOrbitControls, type PolyControlsCamera as PolyOrbitControlsCamera, type PolyOrbitControlsProps, PolyOrthographicCamera, type PolyOrthographicCameraProps, PolyPerspectiveCamera, type PolyPerspectiveCameraProps, PolyPlane, type PolyPlaneProps, PolyProps, type PolyRenderLeafStrategy, type PolyRenderStats, type PolyRenderStatsOptions, type PolyRenderSurfaceLeafCounts, PolyRing, type PolyRingProps, PolyScene, type PolySceneProps, PolySelect, type PolySelectProps, type PolySelectionApi, type PolySnapshotRenderStats, PolySphere, type PolySphereProps, PolyTetrahedron, type PolyTetrahedronProps, type PolyTextureReadiness, type PolyTextureRenderStats, PolyTorus, type PolyTorusProps, PolyTransformControls, type PolyTransformControlsObject, type PolyTransformControlsObjectChangeEvent, type PolyTransformControlsProps, type SharedControlsProps, TransformProps, type UseCameraOptions, type UseCameraResult, type UsePolyAnimationResult, type UseSceneContextOptions, type UseSceneContextResult, collectPolyRenderStats, collectPolyTextureReadiness, injectPolyBaseStyles, queryPolyLeaves, useCameraContext, usePolyAnimation, usePolyCamera, usePolyMaterial, usePolySceneContext, usePolySelect, usePolySelectionApi };