@layoutit/polycss 0.2.0 → 0.2.2

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.
@@ -0,0 +1,654 @@
1
+ import { CameraHandle, Vec3, Polygon, MeshResolution, ParseResult, PolyDirectionalLight, PolyAmbientLight, PolyTextureLightingMode, TextureQuality, PolySeamBleed, PolyRenderStrategiesOption } from '@layoutit/polycss-core';
2
+
3
+ interface PolyCameraOptions {
4
+ zoom?: number;
5
+ target?: Vec3;
6
+ rotX?: number;
7
+ rotY?: number;
8
+ /** Camera pull-back in CSS pixels (dolly). Default 0. */
9
+ distance?: number;
10
+ }
11
+ interface PolyPerspectiveCameraOptions extends PolyCameraOptions {
12
+ /** CSS perspective distance in pixels. Default 32000. */
13
+ perspective?: number;
14
+ }
15
+ interface PolyOrthographicCameraOptions extends PolyCameraOptions {
16
+ }
17
+ /** Extends CameraHandle with projection info for the container element. */
18
+ interface PolyPerspectiveCameraHandle extends CameraHandle {
19
+ readonly type: "perspective";
20
+ /** CSS `perspective` value to set on the camera container element. */
21
+ readonly perspectiveStyle: string;
22
+ }
23
+ interface PolyOrthographicCameraHandle extends CameraHandle {
24
+ readonly type: "orthographic";
25
+ /** CSS `perspective` value to set on the camera container element ("none"). */
26
+ readonly perspectiveStyle: "none";
27
+ }
28
+ /**
29
+ * Creates a perspective camera handle. The `perspectiveStyle` property
30
+ * returns the CSS value to apply to the camera container's `perspective`
31
+ * property (default `"32000px"`).
32
+ */
33
+ declare function createPolyPerspectiveCamera(options?: PolyPerspectiveCameraOptions): PolyPerspectiveCameraHandle;
34
+ /**
35
+ * Creates an orthographic camera handle. The `perspectiveStyle` property
36
+ * returns `"none"` — pass it to the container element's CSS `perspective`
37
+ * to disable perspective projection.
38
+ */
39
+ declare function createPolyOrthographicCamera(options?: PolyOrthographicCameraOptions): PolyOrthographicCameraHandle;
40
+ /**
41
+ * Ergonomic alias for `createPolyOrthographicCamera`. The default camera in
42
+ * PolyCSS is orthographic because the engine's structural advantages
43
+ * (integer-pixel atlas slicing, DOM-as-render-tree) are most visible in
44
+ * iso/voxel/diagrammatic scenes. Use `createPolyPerspectiveCamera` explicitly
45
+ * when depth foreshortening is needed.
46
+ */
47
+ declare const createPolyCamera: typeof createPolyOrthographicCamera;
48
+
49
+ /**
50
+ * Public + internal types for the scene module, extracted from
51
+ * createPolyScene.ts so other scene/* helpers can import them without
52
+ * pulling in the whole factory body. createPolyScene.ts re-exports the
53
+ * public ones so the polycss package public surface is unchanged.
54
+ */
55
+
56
+ interface PolySceneOptions {
57
+ /**
58
+ * Camera handle created by `createPolyCamera`, `createPolyOrthographicCamera`,
59
+ * or `createPolyPerspectiveCamera`. Required — `createPolyScene` will throw if
60
+ * this field is missing.
61
+ */
62
+ camera: PolyPerspectiveCameraHandle | PolyOrthographicCameraHandle;
63
+ directionalLight?: PolyDirectionalLight;
64
+ ambientLight?: PolyAmbientLight;
65
+ /** Textured polygon lighting mode. Defaults to "baked". */
66
+ textureLighting?: PolyTextureLightingMode;
67
+ /** Atlas bitmap budget and CSS sprite size. `"auto"` uses a
68
+ * device-appropriate memory budget (~4 MB mobile / ~16 MB desktop) and
69
+ * desktop/mobile sprite sizing. Numeric values 0.1..1 force an explicit
70
+ * raster scale and the 64px sprite. */
71
+ textureQuality?: TextureQuality;
72
+ /** Solid seam overscan. `"auto"` computes a fitted per-edge amount from the polygon plan. */
73
+ seamBleed?: PolySeamBleed;
74
+ /**
75
+ * Skip specific render-strategy tags. Polygons that would normally use a
76
+ * disabled tag fall through the chain (b → i → s, u → i → s, i → s).
77
+ * `<s>` is the universal fallback and cannot be disabled.
78
+ */
79
+ strategies?: PolyRenderStrategiesOption;
80
+ /**
81
+ * When `true`, rotation pivots around the union bbox of all added meshes
82
+ * instead of world (0,0,0). The scene wraps polygons in an inner div
83
+ * translated by `-bboxCenter`. Updates whenever a mesh is added/removed
84
+ * or `setOptions` is called. Mirrors React's `<PolyScene autoCenter>`.
85
+ */
86
+ autoCenter?: boolean;
87
+ /**
88
+ * Shadow appearance for meshes with `castShadow: true`. Works in both
89
+ * lighting modes — dynamic mode projects via CSS vars so shadows
90
+ * follow a moving light, baked mode CPU-bakes the projection into
91
+ * each leaf's inline `matrix3d` and drops back-facing polys from the
92
+ * DOM entirely. Defaults: `{ color: "#000000", opacity: 0.25, lift: 0.05, maxExtend: 2000 }`.
93
+ */
94
+ shadow?: {
95
+ /** Shadow color as a CSS hex string. Default: `"#000000"`. */
96
+ color?: string;
97
+ /** Shadow opacity 0..1. Default: `0.25`. */
98
+ opacity?: number;
99
+ /**
100
+ * Raises the shadow plane slightly above the model bbox floor along
101
+ * +Z (Z up) so it sits on top of a receiver mesh placed at the bbox
102
+ * bottom, rather than below it where the receiver would occlude the
103
+ * shadow. In world units. Default: `0.05`.
104
+ */
105
+ lift?: number;
106
+ /**
107
+ * Maximum CSS pixels the shadow may extend beyond the mesh's
108
+ * footprint (the no-shear silhouette directly under the mesh). The
109
+ * footprint area is always preserved; only the sheared tail at low
110
+ * light elevations is truncated. Default: `2000`.
111
+ *
112
+ * **Trade-off:** larger values give longer shadows but the SVG
113
+ * backing store grows quadratically with this value, which can
114
+ * cause repaint flicker at extreme low-elevation angles. Pass a
115
+ * very large number (e.g. `Infinity`) to disable the cap entirely.
116
+ */
117
+ maxExtend?: number;
118
+ };
119
+ /**
120
+ * When `true`, emit `data-poly-shadow-*` attribution attributes on every
121
+ * shadow SVG and path (type, receiver mesh id, receiver face index,
122
+ * member poly indices, caster ids, caster poly indices). Useful for
123
+ * DevTools inspection and per-poly attribution in debug benches. When
124
+ * `false` (default), these attributes are suppressed entirely — production
125
+ * scenes ship a cleaner DOM and avoid serializing per-frame JSON.
126
+ */
127
+ debugShadowAttrs?: boolean;
128
+ }
129
+ interface PolyMeshTransform {
130
+ /** Stable identifier — exposed on the handle and reflected on the
131
+ * wrapper as `data-poly-mesh-id`. Used by selection helpers to
132
+ * resolve clicks back to the mesh and to dedupe selection state. */
133
+ id?: string;
134
+ position?: Vec3;
135
+ scale?: number | Vec3;
136
+ rotation?: Vec3;
137
+ /**
138
+ * Whether `scene.add()` should merge coplanar polygons before rendering.
139
+ * Defaults to `true`. Set `false` for animated/deforming meshes whose
140
+ * triangle topology must remain stable from frame to frame.
141
+ */
142
+ merge?: boolean;
143
+ /**
144
+ * Mesh optimization intent. Defaults to `"lossy"` (bounded geometric
145
+ * approximation when it reduces polygon count). Set `"lossless"` to preserve
146
+ * the authored surface — only exact coplanar merges are applied.
147
+ */
148
+ meshResolution?: MeshResolution;
149
+ /**
150
+ * Keep polygon leaf DOM nodes stable across setPolygons() calls when the
151
+ * mesh topology is unchanged. Intended for animated/deforming meshes.
152
+ */
153
+ stableDom?: boolean;
154
+ /**
155
+ * When `true`, this mesh's polygons are NOT included in the scene's
156
+ * auto-center bbox. Use for debug overlays / helpers that shouldn't
157
+ * shift the camera target when toggled. Defaults to `false`.
158
+ */
159
+ excludeFromAutoCenter?: boolean;
160
+ /**
161
+ * When `true`, this mesh casts a shadow onto the scene's shadow ground
162
+ * plane (and onto any meshes marked `receiveShadow: true`). The shadow
163
+ * emits as one per-mesh `<svg>` whose path is the union of every
164
+ * casting polygon's projection. Works in both lighting modes.
165
+ * Defaults to `false`.
166
+ */
167
+ castShadow?: boolean;
168
+ /**
169
+ * **(experimental)** When `true`, this mesh acts as a shadow receiver:
170
+ * each of its polygon faces becomes a target plane that casting meshes'
171
+ * shadows project onto and get clipped to. Useful for "shadow on table"
172
+ * scenarios. Currently only convex face outlines clip cleanly. When no
173
+ * receivers are present the global ground plane is used as today.
174
+ * Defaults to `false`.
175
+ */
176
+ receiveShadow?: boolean;
177
+ }
178
+ interface PolyMeshHandle {
179
+ /** The polygons that were loaded after normalization and automatic merge. */
180
+ polygons: Polygon[];
181
+ /** The `.polycss-mesh` wrapper div for this mesh. Exposed so layered
182
+ * helpers (selection, transform controls) can resolve a click target
183
+ * back to its owning mesh, attach event listeners, or measure the
184
+ * mesh's screen position via `getBoundingClientRect`. */
185
+ readonly element: HTMLElement;
186
+ /** Identifier passed via `PolyMeshTransform.id` (if any). Reflected on
187
+ * the wrapper as `data-poly-mesh-id`. */
188
+ readonly id?: string;
189
+ /** Current transform snapshot (position / rotation / scale). Returned
190
+ * by reference — treat as read-only and use `setTransform` to mutate. */
191
+ readonly transform: PolyMeshTransform;
192
+ /** Remove the mesh from the scene. */
193
+ remove(): void;
194
+ /** Replace polygon geometry without tearing down the scene or controls. */
195
+ setPolygons(polygons: Polygon[], options?: {
196
+ merge?: boolean;
197
+ stableDom?: boolean;
198
+ recomputeAutoCenter?: boolean;
199
+ }): void;
200
+ /**
201
+ * Update a single polygon in place. `target` is either a polygon
202
+ * reference (as returned by `getPolygons()`) or its index. `partial`
203
+ * fields are merged onto the polygon; the mesh is then re-rendered.
204
+ * Skips the merge pass, so this is cheaper than `setPolygons` for
205
+ * targeted edits like color picker updates from an inspector UI.
206
+ * Silently no-ops if `target` isn't found.
207
+ */
208
+ updatePolygon(target: Polygon | number, partial: Partial<Polygon>): void;
209
+ /** Update transform without re-parsing. */
210
+ setTransform(t: Partial<PolyMeshTransform>): void;
211
+ /** Revoke any blob URLs the parse created. Idempotent. */
212
+ dispose(): void;
213
+ /**
214
+ * Re-rasterize the atlas using the directional light inverse-rotated into
215
+ * the mesh's local frame. Call this after a mesh rotation has been
216
+ * committed (e.g., on pointer release in rotate-mode transform controls) to
217
+ * correct stale baked shading.
218
+ *
219
+ * **Background:** Baked atlas tiles encode `baseColor × Lambert(worldNormal,
220
+ * worldLight)`. When the mesh wrapper rotates via CSS, the polygon's normal
221
+ * in world space changes but the baked color doesn't — faces stay lit/unlit
222
+ * incorrectly. `rebakeAtlas()` inverse-rotates the world light into the
223
+ * mesh's local frame and re-runs the rasterizer; because
224
+ * `dot(localNormal, localLight) === dot(worldNormal, worldLight)` the
225
+ * output is correct for any rotation.
226
+ *
227
+ * **Performance note:** This does NOT run on every `setTransform` call —
228
+ * only when explicitly invoked, so dragging remains smooth. Call it on
229
+ * pointer release (or any point where you want to commit the new shading).
230
+ */
231
+ rebakeAtlas(): void;
232
+ /** Current `position` from the transform (matches framework API). */
233
+ getPosition(): Vec3 | undefined;
234
+ /** Current `rotation` from the transform (matches framework API). */
235
+ getRotation(): Vec3 | undefined;
236
+ /** Current `scale` from the transform (matches framework API). */
237
+ getScale(): number | Vec3 | undefined;
238
+ /** Polygons currently being rendered (matches framework API). */
239
+ getPolygons(): Polygon[];
240
+ }
241
+ interface PolySceneHandle {
242
+ /** Add a mesh to the scene. Returns a handle for later removal. */
243
+ add(mesh: ParseResult, opts?: PolyMeshTransform): PolyMeshHandle;
244
+ /** Update scene-level config (lighting, autoCenter, strategies, etc.). Camera state is on `scene.camera`. */
245
+ setOptions(partial: Partial<Omit<PolySceneOptions, "camera">>): void;
246
+ /** Tear down the scene; revokes all blob URLs of registered meshes. */
247
+ destroy(): void;
248
+ /**
249
+ * The host element passed to `createPolyScene`. Exposed for layered
250
+ * helpers like `createPolyOrbitControls` that need to attach event listeners
251
+ * without tracking the host separately.
252
+ */
253
+ readonly host: HTMLElement;
254
+ /**
255
+ * The `.polycss-camera` wrapper element created by `createPolyScene` between
256
+ * the host and the `.polycss-scene` element. Carries the CSS `perspective`
257
+ * that matches React/Vue's `<div class="polycss-camera">` wrapper shape.
258
+ * FPV controls toggle `.polycss-fpv-host` on this element.
259
+ */
260
+ readonly cameraEl: HTMLElement;
261
+ /**
262
+ * The camera handle this scene is bound to. Controls update camera state
263
+ * via `scene.camera.update({...})` then call `scene.applyCamera()` to
264
+ * re-apply the transform.
265
+ */
266
+ readonly camera: PolyPerspectiveCameraHandle | PolyOrthographicCameraHandle;
267
+ /**
268
+ * Re-applies the scene transform from the current camera state. Call this
269
+ * after mutating `scene.camera.update({...})` to make the change visible.
270
+ * Controls call this once per interaction event after updating camera state.
271
+ */
272
+ applyCamera(): void;
273
+ /**
274
+ * Snapshot of the current non-camera scene options (lighting, autoCenter,
275
+ * textureQuality, strategies, shadow). Returned by reference — treat as
276
+ * read-only; use `setOptions` to update.
277
+ */
278
+ getOptions(): Readonly<Omit<PolySceneOptions, "camera">>;
279
+ /** Snapshot of mesh handles currently in the scene (insertion order).
280
+ * Used by selection helpers to enumerate hit-test candidates. */
281
+ meshes(): readonly PolyMeshHandle[];
282
+ /** Resolve a `.polycss-mesh` element back to its handle, or `null` if
283
+ * the element doesn't belong to this scene. */
284
+ findMeshByElement(element: Element | null): PolyMeshHandle | null;
285
+ }
286
+
287
+ /**
288
+ * Shared types, constants, and utilities for orbit/map controls factories.
289
+ * Not part of the public API surface — use createPolyOrbitControls or
290
+ * createPolyMapControls.
291
+ */
292
+
293
+ interface PolyControlsAnimateOptions {
294
+ /**
295
+ * Rotation rate in degrees per 60 Hz-equivalent frame. The tick is
296
+ * dt-clamped so 0.3 deg/frame ≈ 18 deg/sec on every refresh rate.
297
+ * Default: 0.3.
298
+ */
299
+ speed?: number;
300
+ /** Rotation axis. Default: "y" (yaw, rotates around vertical world Z). */
301
+ axis?: "x" | "y";
302
+ /** Halt the loop while a pointer drag is in progress. Default: true. */
303
+ pauseOnInteraction?: boolean;
304
+ }
305
+ interface PolyControlsBaseOptions {
306
+ /** Pointer-drag. Default: true. */
307
+ drag?: boolean;
308
+ /** Wheel / pinch zoom. Default: true. */
309
+ wheel?: boolean;
310
+ /**
311
+ * When `true`, wheel events change `distance` (camera pull-back in CSS px)
312
+ * instead of `zoom`. Mirrors Three.js OrbitControls dolly behaviour.
313
+ * Default: false (zoom mode).
314
+ */
315
+ dolly?: boolean;
316
+ /**
317
+ * Drag-direction inversion. `false` = natural, `true` = invert (×-1),
318
+ * a number multiplies sensitivity (negative inverts). Default: false.
319
+ */
320
+ invert?: boolean | number;
321
+ /** Minimum CSS zoom. Default: 0.1. */
322
+ minZoom?: number;
323
+ /** Maximum CSS zoom. Default: 10. */
324
+ maxZoom?: number;
325
+ /** Minimum dolly distance in CSS pixels. Default: 0. Only used when `dolly: true`. */
326
+ minDistance?: number;
327
+ /** Maximum dolly distance in CSS pixels. Default: Infinity. Only used when `dolly: true`. */
328
+ maxDistance?: number;
329
+ /** Auto-rotate. Pass false (or omit) to disable. */
330
+ animate?: false | PolyControlsAnimateOptions;
331
+ }
332
+ interface PolyControlsCamera {
333
+ rotX: number;
334
+ rotY: number;
335
+ zoom: number;
336
+ target: Vec3;
337
+ distance: number;
338
+ }
339
+ interface PolyControlsChangeEvent {
340
+ type: "change";
341
+ camera: PolyControlsCamera;
342
+ }
343
+ interface PolyControlsInteractionEvent {
344
+ type: "start" | "end";
345
+ camera: PolyControlsCamera;
346
+ }
347
+ type PolyControlsEvent = PolyControlsChangeEvent | PolyControlsInteractionEvent;
348
+ type PolyControlsListener<E extends PolyControlsEvent = PolyControlsEvent> = (event: E) => void;
349
+ interface PolyControlsHandle {
350
+ update(partial: PolyControlsBaseOptions): void;
351
+ resume(): void;
352
+ pause(): void;
353
+ destroy(): void;
354
+ addEventListener<T extends PolyControlsEvent["type"]>(type: T, listener: PolyControlsListener<Extract<PolyControlsEvent, {
355
+ type: T;
356
+ }>>): void;
357
+ removeEventListener<T extends PolyControlsEvent["type"]>(type: T, listener: PolyControlsListener<Extract<PolyControlsEvent, {
358
+ type: T;
359
+ }>>): void;
360
+ hasEventListener<T extends PolyControlsEvent["type"]>(type: T, listener: PolyControlsListener<Extract<PolyControlsEvent, {
361
+ type: T;
362
+ }>>): boolean;
363
+ }
364
+
365
+ /**
366
+ * createPolyOrbitControls — orbit-mode camera input for a PolyScene.
367
+ *
368
+ * Left-drag rotates rotX / rotY around the target (orbit). Wheel zooms or
369
+ * dollies. Mirrors Three.js OrbitControls semantics.
370
+ *
371
+ * For map/pan semantics (left-drag pans, right-drag orbits) use
372
+ * `createPolyMapControls` instead.
373
+ */
374
+
375
+ type PolyOrbitControlsOptions = PolyControlsBaseOptions;
376
+ type PolyOrbitControlsHandle = PolyControlsHandle;
377
+ declare function createPolyOrbitControls(scene: PolySceneHandle, options?: PolyOrbitControlsOptions): PolyOrbitControlsHandle;
378
+
379
+ declare const ELEMENT_BASE$b: typeof HTMLElement;
380
+ declare class PolySceneElement extends ELEMENT_BASE$b {
381
+ static get observedAttributes(): string[];
382
+ private _scene;
383
+ private _implicitCamera;
384
+ /**
385
+ * Returns the underlying PolySceneHandle. Children call this during their own
386
+ * connectedCallback to register meshes.
387
+ */
388
+ getScene(): PolySceneHandle | null;
389
+ private _findAncestorCamera;
390
+ private _buildImplicitCamera;
391
+ private _readNonCameraOptions;
392
+ private _readDirectionalLight;
393
+ private _readAmbientLight;
394
+ connectedCallback(): void;
395
+ disconnectedCallback(): void;
396
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
397
+ }
398
+
399
+ declare const ELEMENT_BASE$a: typeof HTMLElement;
400
+ declare class PolyMeshElement extends ELEMENT_BASE$a {
401
+ static get observedAttributes(): string[];
402
+ private _handle;
403
+ private _parseResult;
404
+ private _loadToken;
405
+ /** Returns the current mesh handle, or null if not yet loaded. */
406
+ getMeshHandle(): PolyMeshHandle | null;
407
+ connectedCallback(): void;
408
+ disconnectedCallback(): void;
409
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
410
+ private _tearDown;
411
+ private _maybeLoad;
412
+ }
413
+
414
+ declare const ELEMENT_BASE$9: typeof HTMLElement;
415
+ declare class PolyIframeElement extends ELEMENT_BASE$9 {
416
+ static get observedAttributes(): string[];
417
+ private _wrapper;
418
+ private _iframe;
419
+ /** The iframe element this <poly-iframe> mounted, or null when detached. */
420
+ getIframeElement(): HTMLIFrameElement | null;
421
+ connectedCallback(): void;
422
+ disconnectedCallback(): void;
423
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
424
+ private _mount;
425
+ private _applyGeometry;
426
+ private _teardown;
427
+ }
428
+
429
+ declare const ELEMENT_BASE$8: typeof HTMLElement;
430
+ declare class PolyPolygonElement extends ELEMENT_BASE$8 {
431
+ static get observedAttributes(): string[];
432
+ private _handle;
433
+ connectedCallback(): void;
434
+ disconnectedCallback(): void;
435
+ attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void;
436
+ private _tearDown;
437
+ private _mount;
438
+ }
439
+
440
+ declare const ELEMENT_BASE$7: typeof HTMLElement;
441
+ declare class PolyOrbitControlsElement extends ELEMENT_BASE$7 {
442
+ static get observedAttributes(): string[];
443
+ private _controls;
444
+ /** Returns the wrapped PolyOrbitControlsHandle once the element has
445
+ * connected to its `<poly-scene>` ancestor. Lets external callers attach
446
+ * `change` listeners (or call `update()` / `pause()`) the same way they
447
+ * would on a vanilla `createPolyOrbitControls(scene, ...)` handle. */
448
+ getControls(): PolyOrbitControlsHandle | null;
449
+ private _readAnimate;
450
+ private _readOptions;
451
+ private _findScene;
452
+ private _attach;
453
+ connectedCallback(): void;
454
+ disconnectedCallback(): void;
455
+ attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void;
456
+ }
457
+
458
+ declare const ELEMENT_BASE$6: typeof HTMLElement;
459
+ declare class PolyMapControlsElement extends ELEMENT_BASE$6 {
460
+ static get observedAttributes(): string[];
461
+ private _controls;
462
+ private _readAnimate;
463
+ private _readOptions;
464
+ private _findScene;
465
+ private _attach;
466
+ connectedCallback(): void;
467
+ disconnectedCallback(): void;
468
+ attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void;
469
+ }
470
+
471
+ declare const ELEMENT_BASE$5: typeof HTMLElement;
472
+ declare class PolyFirstPersonControlsElement extends ELEMENT_BASE$5 {
473
+ static get observedAttributes(): string[];
474
+ private _controls;
475
+ private _readOptions;
476
+ private _findScene;
477
+ private _attach;
478
+ connectedCallback(): void;
479
+ disconnectedCallback(): void;
480
+ attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void;
481
+ }
482
+
483
+ /**
484
+ * <poly-perspective-camera> — standalone perspective camera element.
485
+ *
486
+ * Wraps `createPolyPerspectiveCamera`. Unlike <poly-scene> which owns the
487
+ * scene DOM, this element provides a camera context that child controls can
488
+ * read. It creates a `<div class="polycss-camera">` wrapper with the
489
+ * CSS `perspective` property set.
490
+ *
491
+ * Attributes (all optional):
492
+ * perspective — number, CSS perspective in pixels (default 32000)
493
+ * zoom — number
494
+ * rot-x — number, degrees (default 65)
495
+ * rot-y — number, degrees (default 45)
496
+ * target — "x,y,z" comma-separated world coordinates
497
+ * distance — number, camera pull-back in CSS pixels
498
+ */
499
+
500
+ declare const ELEMENT_BASE$4: typeof HTMLElement;
501
+ declare class PolyPerspectiveCameraElement extends ELEMENT_BASE$4 {
502
+ static get observedAttributes(): string[];
503
+ private _camera;
504
+ private _wrapper;
505
+ /** Returns the camera handle, or null if not yet connected. */
506
+ getCamera(): PolyPerspectiveCameraHandle | null;
507
+ private _readOptions;
508
+ private _mount;
509
+ private _teardown;
510
+ connectedCallback(): void;
511
+ disconnectedCallback(): void;
512
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
513
+ }
514
+
515
+ /**
516
+ * <poly-orthographic-camera> — standalone orthographic camera element.
517
+ *
518
+ * Wraps `createPolyOrthographicCamera`. Sets CSS `perspective: none` on the
519
+ * camera wrapper, disabling perspective projection.
520
+ *
521
+ * Attributes (all optional):
522
+ * zoom — number
523
+ * rot-x — number, degrees (default 65)
524
+ * rot-y — number, degrees (default 45)
525
+ * target — "x,y,z" comma-separated world coordinates
526
+ * distance — number, camera pull-back in CSS pixels
527
+ */
528
+
529
+ declare const ELEMENT_BASE$3: typeof HTMLElement;
530
+ declare class PolyOrthographicCameraElement extends ELEMENT_BASE$3 {
531
+ static get observedAttributes(): string[];
532
+ private _camera;
533
+ private _wrapper;
534
+ /** Returns the camera handle, or null if not yet connected. */
535
+ getCamera(): PolyOrthographicCameraHandle | null;
536
+ private _readOptions;
537
+ private _mount;
538
+ private _teardown;
539
+ connectedCallback(): void;
540
+ disconnectedCallback(): void;
541
+ attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void;
542
+ }
543
+
544
+ /**
545
+ * <poly-camera> — ergonomic alias for <poly-orthographic-camera>.
546
+ *
547
+ * The default camera in PolyCSS is orthographic. `<poly-camera>` maps to
548
+ * `PolyOrthographicCameraElement` so the canonical tree shape works without
549
+ * spelling out "orthographic" when it isn't relevant to the scene being built.
550
+ *
551
+ * Use <poly-perspective-camera> when depth foreshortening is needed.
552
+ */
553
+
554
+ declare class PolyCameraElement extends PolyOrthographicCameraElement {
555
+ }
556
+
557
+ declare const ELEMENT_BASE$2: typeof HTMLElement;
558
+ declare class PolyTransformControlsElement extends ELEMENT_BASE$2 {
559
+ static get observedAttributes(): string[];
560
+ private _tc;
561
+ private _findScene;
562
+ private _findTargetMesh;
563
+ private _readOptions;
564
+ private _attach;
565
+ connectedCallback(): void;
566
+ disconnectedCallback(): void;
567
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
568
+ }
569
+
570
+ declare const ELEMENT_BASE$1: typeof HTMLElement;
571
+ declare class PolySelectElement extends ELEMENT_BASE$1 {
572
+ static get observedAttributes(): string[];
573
+ private _selection;
574
+ private _findScene;
575
+ private _readOptions;
576
+ private _attach;
577
+ connectedCallback(): void;
578
+ disconnectedCallback(): void;
579
+ attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void;
580
+ }
581
+
582
+ /**
583
+ * Primitive shape custom elements — <poly-box>, <poly-plane>, <poly-ring>,
584
+ * <poly-octahedron>, <poly-tetrahedron>, <poly-icosahedron>, <poly-dodecahedron>,
585
+ * <poly-cylinder>, <poly-cone>, <poly-torus>.
586
+ *
587
+ * Each element reads shape-specific attributes, calls the matching polygon
588
+ * generator from @layoutit/polycss-core, then registers the result with the
589
+ * nearest <poly-scene> ancestor using the same mechanism as <poly-mesh>.
590
+ *
591
+ * Attribute naming follows kebab-case conventions: `radial-segments`,
592
+ * `tubular-segments`, `radius-top`, `half-thickness`, etc.
593
+ */
594
+
595
+ declare const ELEMENT_BASE: typeof HTMLElement;
596
+ /**
597
+ * Base class for all primitive shape elements. Subclasses implement
598
+ * `buildPolygons()` which returns a Polygon[] from this element's attributes.
599
+ */
600
+ declare abstract class PolyShapeElement extends ELEMENT_BASE {
601
+ private _handle;
602
+ abstract buildPolygons(): Polygon[];
603
+ connectedCallback(): void;
604
+ disconnectedCallback(): void;
605
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
606
+ private _tearDown;
607
+ private _mount;
608
+ }
609
+ declare class PolyBoxElement extends PolyShapeElement {
610
+ static get observedAttributes(): string[];
611
+ buildPolygons(): Polygon[];
612
+ }
613
+ declare class PolyPlaneElement extends PolyShapeElement {
614
+ static get observedAttributes(): string[];
615
+ buildPolygons(): Polygon[];
616
+ }
617
+ declare class PolyRingElement extends PolyShapeElement {
618
+ static get observedAttributes(): string[];
619
+ buildPolygons(): Polygon[];
620
+ }
621
+ declare class PolyOctahedronElement extends PolyShapeElement {
622
+ static get observedAttributes(): string[];
623
+ buildPolygons(): Polygon[];
624
+ }
625
+ declare class PolyTetrahedronElement extends PolyShapeElement {
626
+ static get observedAttributes(): string[];
627
+ buildPolygons(): Polygon[];
628
+ }
629
+ declare class PolyIcosahedronElement extends PolyShapeElement {
630
+ static get observedAttributes(): string[];
631
+ buildPolygons(): Polygon[];
632
+ }
633
+ declare class PolyDodecahedronElement extends PolyShapeElement {
634
+ static get observedAttributes(): string[];
635
+ buildPolygons(): Polygon[];
636
+ }
637
+ declare class PolySphereElement extends PolyShapeElement {
638
+ static get observedAttributes(): string[];
639
+ buildPolygons(): Polygon[];
640
+ }
641
+ declare class PolyCylinderElement extends PolyShapeElement {
642
+ static get observedAttributes(): string[];
643
+ buildPolygons(): Polygon[];
644
+ }
645
+ declare class PolyConeElement extends PolyShapeElement {
646
+ static get observedAttributes(): string[];
647
+ buildPolygons(): Polygon[];
648
+ }
649
+ declare class PolyTorusElement extends PolyShapeElement {
650
+ static get observedAttributes(): string[];
651
+ buildPolygons(): Polygon[];
652
+ }
653
+
654
+ export { PolyOrthographicCameraElement as A, type PolyOrthographicCameraHandle as B, type PolyOrthographicCameraOptions as C, PolyPerspectiveCameraElement as D, type PolyPerspectiveCameraHandle as E, type PolyPerspectiveCameraOptions as F, PolyPlaneElement as G, PolyPolygonElement as H, PolyRingElement as I, PolySceneElement as J, PolySelectElement as K, PolySphereElement as L, PolyTetrahedronElement as M, PolyTorusElement as N, PolyTransformControlsElement as O, type PolySceneOptions as P, createPolyCamera as Q, createPolyOrbitControls as R, createPolyOrthographicCamera as S, createPolyPerspectiveCamera as T, type PolySceneHandle as a, type PolyControlsHandle as b, type PolyControlsBaseOptions as c, type PolyControlsEvent as d, type PolyControlsListener as e, type PolyMeshHandle as f, PolyBoxElement as g, PolyCameraElement as h, type PolyCameraOptions as i, PolyConeElement as j, type PolyControlsAnimateOptions as k, type PolyControlsCamera as l, type PolyControlsChangeEvent as m, type PolyControlsInteractionEvent as n, PolyCylinderElement as o, PolyDodecahedronElement as p, PolyFirstPersonControlsElement as q, PolyIcosahedronElement as r, PolyIframeElement as s, PolyMapControlsElement as t, PolyMeshElement as u, type PolyMeshTransform as v, PolyOctahedronElement as w, PolyOrbitControlsElement as x, type PolyOrbitControlsHandle as y, type PolyOrbitControlsOptions as z };