@layoutit/polycss 0.2.7 → 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.
@@ -356,371 +356,4 @@ interface PolySceneHandle {
356
356
  findMeshByElement(element: Element | null): PolyMeshHandle | null;
357
357
  }
358
358
 
359
- /**
360
- * Shared types, constants, and utilities for orbit/map controls factories.
361
- * Not part of the public API surface — use createPolyOrbitControls or
362
- * createPolyMapControls.
363
- */
364
-
365
- interface PolyControlsAnimateOptions {
366
- /**
367
- * Rotation rate in degrees per 60 Hz-equivalent frame. The tick is
368
- * dt-clamped so 0.3 deg/frame ≈ 18 deg/sec on every refresh rate.
369
- * Default: 0.3.
370
- */
371
- speed?: number;
372
- /** Rotation axis. Default: "y" (yaw, rotates around vertical world Z). */
373
- axis?: "x" | "y";
374
- /** Halt the loop while a pointer drag is in progress. Default: true. */
375
- pauseOnInteraction?: boolean;
376
- }
377
- interface PolyControlsBaseOptions {
378
- /** Pointer-drag. Default: true. */
379
- drag?: boolean;
380
- /** Wheel / pinch zoom. Default: true. */
381
- wheel?: boolean;
382
- /**
383
- * When `true`, wheel events change `distance` (camera pull-back in CSS px)
384
- * instead of `zoom`. Mirrors Three.js OrbitControls dolly behaviour.
385
- * Default: false (zoom mode).
386
- */
387
- dolly?: boolean;
388
- /**
389
- * Drag-direction inversion. `false` = natural, `true` = invert (×-1),
390
- * a number multiplies sensitivity (negative inverts). Default: false.
391
- */
392
- invert?: boolean | number;
393
- /** Minimum CSS zoom. Default: 0.1. */
394
- minZoom?: number;
395
- /** Maximum CSS zoom. Default: 10. */
396
- maxZoom?: number;
397
- /** Minimum dolly distance in CSS pixels. Default: 0. Only used when `dolly: true`. */
398
- minDistance?: number;
399
- /** Maximum dolly distance in CSS pixels. Default: Infinity. Only used when `dolly: true`. */
400
- maxDistance?: number;
401
- /** Auto-rotate. Pass false (or omit) to disable. */
402
- animate?: false | PolyControlsAnimateOptions;
403
- }
404
- interface PolyControlsCamera {
405
- rotX: number;
406
- rotY: number;
407
- zoom: number;
408
- target: Vec3;
409
- distance: number;
410
- }
411
- interface PolyControlsChangeEvent {
412
- type: "change";
413
- camera: PolyControlsCamera;
414
- }
415
- interface PolyControlsInteractionEvent {
416
- type: "start" | "end";
417
- camera: PolyControlsCamera;
418
- }
419
- type PolyControlsEvent = PolyControlsChangeEvent | PolyControlsInteractionEvent;
420
- type PolyControlsListener<E extends PolyControlsEvent = PolyControlsEvent> = (event: E) => void;
421
- interface PolyControlsHandle {
422
- update(partial: PolyControlsBaseOptions): void;
423
- resume(): void;
424
- pause(): void;
425
- destroy(): void;
426
- addEventListener<T extends PolyControlsEvent["type"]>(type: T, listener: PolyControlsListener<Extract<PolyControlsEvent, {
427
- type: T;
428
- }>>): void;
429
- removeEventListener<T extends PolyControlsEvent["type"]>(type: T, listener: PolyControlsListener<Extract<PolyControlsEvent, {
430
- type: T;
431
- }>>): void;
432
- hasEventListener<T extends PolyControlsEvent["type"]>(type: T, listener: PolyControlsListener<Extract<PolyControlsEvent, {
433
- type: T;
434
- }>>): boolean;
435
- }
436
-
437
- /**
438
- * createPolyOrbitControls — orbit-mode camera input for a PolyScene.
439
- *
440
- * Left-drag rotates rotX / rotY around the target (orbit). Wheel zooms or
441
- * dollies. Mirrors Three.js OrbitControls semantics.
442
- *
443
- * For map/pan semantics (left-drag pans, right-drag orbits) use
444
- * `createPolyMapControls` instead.
445
- */
446
-
447
- type PolyOrbitControlsOptions = PolyControlsBaseOptions;
448
- type PolyOrbitControlsHandle = PolyControlsHandle;
449
- declare function createPolyOrbitControls(scene: PolySceneHandle, options?: PolyOrbitControlsOptions): PolyOrbitControlsHandle;
450
-
451
- declare const ELEMENT_BASE$b: typeof HTMLElement;
452
- declare class PolySceneElement extends ELEMENT_BASE$b {
453
- static get observedAttributes(): string[];
454
- private _scene;
455
- private _implicitCamera;
456
- /**
457
- * Returns the underlying PolySceneHandle. Children call this during their own
458
- * connectedCallback to register meshes.
459
- */
460
- getScene(): PolySceneHandle | null;
461
- private _findAncestorCamera;
462
- private _buildImplicitCamera;
463
- private _readNonCameraOptions;
464
- private _readDirectionalLight;
465
- private _readAmbientLight;
466
- connectedCallback(): void;
467
- disconnectedCallback(): void;
468
- attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
469
- }
470
-
471
- declare const ELEMENT_BASE$a: typeof HTMLElement;
472
- declare class PolyMeshElement extends ELEMENT_BASE$a {
473
- static get observedAttributes(): string[];
474
- private _handle;
475
- private _parseResult;
476
- private _loadToken;
477
- /** Returns the current mesh handle, or null if not yet loaded. */
478
- getMeshHandle(): PolyMeshHandle | null;
479
- connectedCallback(): void;
480
- disconnectedCallback(): void;
481
- attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
482
- private _tearDown;
483
- private _maybeLoad;
484
- }
485
-
486
- declare const ELEMENT_BASE$9: typeof HTMLElement;
487
- declare class PolyIframeElement extends ELEMENT_BASE$9 {
488
- static get observedAttributes(): string[];
489
- private _wrapper;
490
- private _iframe;
491
- /** The iframe element this <poly-iframe> mounted, or null when detached. */
492
- getIframeElement(): HTMLIFrameElement | null;
493
- connectedCallback(): void;
494
- disconnectedCallback(): void;
495
- attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
496
- private _mount;
497
- private _applyGeometry;
498
- private _teardown;
499
- }
500
-
501
- declare const ELEMENT_BASE$8: typeof HTMLElement;
502
- declare class PolyPolygonElement extends ELEMENT_BASE$8 {
503
- static get observedAttributes(): string[];
504
- private _handle;
505
- connectedCallback(): void;
506
- disconnectedCallback(): void;
507
- attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void;
508
- private _tearDown;
509
- private _mount;
510
- }
511
-
512
- declare const ELEMENT_BASE$7: typeof HTMLElement;
513
- declare class PolyOrbitControlsElement extends ELEMENT_BASE$7 {
514
- static get observedAttributes(): string[];
515
- private _controls;
516
- /** Returns the wrapped PolyOrbitControlsHandle once the element has
517
- * connected to its `<poly-scene>` ancestor. Lets external callers attach
518
- * `change` listeners (or call `update()` / `pause()`) the same way they
519
- * would on a vanilla `createPolyOrbitControls(scene, ...)` handle. */
520
- getControls(): PolyOrbitControlsHandle | null;
521
- private _readAnimate;
522
- private _readOptions;
523
- private _findScene;
524
- private _attach;
525
- connectedCallback(): void;
526
- disconnectedCallback(): void;
527
- attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void;
528
- }
529
-
530
- declare const ELEMENT_BASE$6: typeof HTMLElement;
531
- declare class PolyMapControlsElement extends ELEMENT_BASE$6 {
532
- static get observedAttributes(): string[];
533
- private _controls;
534
- private _readAnimate;
535
- private _readOptions;
536
- private _findScene;
537
- private _attach;
538
- connectedCallback(): void;
539
- disconnectedCallback(): void;
540
- attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void;
541
- }
542
-
543
- declare const ELEMENT_BASE$5: typeof HTMLElement;
544
- declare class PolyFirstPersonControlsElement extends ELEMENT_BASE$5 {
545
- static get observedAttributes(): string[];
546
- private _controls;
547
- private _readOptions;
548
- private _findScene;
549
- private _attach;
550
- connectedCallback(): void;
551
- disconnectedCallback(): void;
552
- attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void;
553
- }
554
-
555
- /**
556
- * <poly-perspective-camera> — standalone perspective camera element.
557
- *
558
- * Wraps `createPolyPerspectiveCamera`. Unlike <poly-scene> which owns the
559
- * scene DOM, this element provides a camera context that child controls can
560
- * read. It creates a `<div class="polycss-camera">` wrapper with the
561
- * CSS `perspective` property set.
562
- *
563
- * Attributes (all optional):
564
- * perspective — number, CSS perspective in pixels (default 32000)
565
- * zoom — number
566
- * rot-x — number, degrees (default 65)
567
- * rot-y — number, degrees (default 45)
568
- * target — "x,y,z" comma-separated world coordinates
569
- * distance — number, camera pull-back in CSS pixels
570
- */
571
-
572
- declare const ELEMENT_BASE$4: typeof HTMLElement;
573
- declare class PolyPerspectiveCameraElement extends ELEMENT_BASE$4 {
574
- static get observedAttributes(): string[];
575
- private _camera;
576
- private _wrapper;
577
- /** Returns the camera handle, or null if not yet connected. */
578
- getCamera(): PolyPerspectiveCameraHandle | null;
579
- private _readOptions;
580
- private _mount;
581
- private _teardown;
582
- connectedCallback(): void;
583
- disconnectedCallback(): void;
584
- attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
585
- }
586
-
587
- /**
588
- * <poly-orthographic-camera> — standalone orthographic camera element.
589
- *
590
- * Wraps `createPolyOrthographicCamera`. Sets CSS `perspective: none` on the
591
- * camera wrapper, disabling perspective projection.
592
- *
593
- * Attributes (all optional):
594
- * zoom — number
595
- * rot-x — number, degrees (default 65)
596
- * rot-y — number, degrees (default 45)
597
- * target — "x,y,z" comma-separated world coordinates
598
- * distance — number, camera pull-back in CSS pixels
599
- */
600
-
601
- declare const ELEMENT_BASE$3: typeof HTMLElement;
602
- declare class PolyOrthographicCameraElement extends ELEMENT_BASE$3 {
603
- static get observedAttributes(): string[];
604
- private _camera;
605
- private _wrapper;
606
- /** Returns the camera handle, or null if not yet connected. */
607
- getCamera(): PolyOrthographicCameraHandle | null;
608
- private _readOptions;
609
- private _mount;
610
- private _teardown;
611
- connectedCallback(): void;
612
- disconnectedCallback(): void;
613
- attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void;
614
- }
615
-
616
- /**
617
- * <poly-camera> — ergonomic alias for <poly-orthographic-camera>.
618
- *
619
- * The default camera in PolyCSS is orthographic. `<poly-camera>` maps to
620
- * `PolyOrthographicCameraElement` so the canonical tree shape works without
621
- * spelling out "orthographic" when it isn't relevant to the scene being built.
622
- *
623
- * Use <poly-perspective-camera> when depth foreshortening is needed.
624
- */
625
-
626
- declare class PolyCameraElement extends PolyOrthographicCameraElement {
627
- }
628
-
629
- declare const ELEMENT_BASE$2: typeof HTMLElement;
630
- declare class PolyTransformControlsElement extends ELEMENT_BASE$2 {
631
- static get observedAttributes(): string[];
632
- private _tc;
633
- private _findScene;
634
- private _findTargetMesh;
635
- private _readOptions;
636
- private _attach;
637
- connectedCallback(): void;
638
- disconnectedCallback(): void;
639
- attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
640
- }
641
-
642
- declare const ELEMENT_BASE$1: typeof HTMLElement;
643
- declare class PolySelectElement extends ELEMENT_BASE$1 {
644
- static get observedAttributes(): string[];
645
- private _selection;
646
- private _findScene;
647
- private _readOptions;
648
- private _attach;
649
- connectedCallback(): void;
650
- disconnectedCallback(): void;
651
- attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void;
652
- }
653
-
654
- /**
655
- * Primitive shape custom elements — <poly-box>, <poly-plane>, <poly-ring>,
656
- * <poly-octahedron>, <poly-tetrahedron>, <poly-icosahedron>, <poly-dodecahedron>,
657
- * <poly-cylinder>, <poly-cone>, <poly-torus>.
658
- *
659
- * Each element reads shape-specific attributes, calls the matching polygon
660
- * generator from @layoutit/polycss-core, then registers the result with the
661
- * nearest <poly-scene> ancestor using the same mechanism as <poly-mesh>.
662
- *
663
- * Attribute naming follows kebab-case conventions: `radial-segments`,
664
- * `tubular-segments`, `radius-top`, `half-thickness`, etc.
665
- */
666
-
667
- declare const ELEMENT_BASE: typeof HTMLElement;
668
- /**
669
- * Base class for all primitive shape elements. Subclasses implement
670
- * `buildPolygons()` which returns a Polygon[] from this element's attributes.
671
- */
672
- declare abstract class PolyShapeElement extends ELEMENT_BASE {
673
- private _handle;
674
- abstract buildPolygons(): Polygon[];
675
- connectedCallback(): void;
676
- disconnectedCallback(): void;
677
- attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
678
- private _tearDown;
679
- private _mount;
680
- }
681
- declare class PolyBoxElement extends PolyShapeElement {
682
- static get observedAttributes(): string[];
683
- buildPolygons(): Polygon[];
684
- }
685
- declare class PolyPlaneElement extends PolyShapeElement {
686
- static get observedAttributes(): string[];
687
- buildPolygons(): Polygon[];
688
- }
689
- declare class PolyRingElement extends PolyShapeElement {
690
- static get observedAttributes(): string[];
691
- buildPolygons(): Polygon[];
692
- }
693
- declare class PolyOctahedronElement extends PolyShapeElement {
694
- static get observedAttributes(): string[];
695
- buildPolygons(): Polygon[];
696
- }
697
- declare class PolyTetrahedronElement extends PolyShapeElement {
698
- static get observedAttributes(): string[];
699
- buildPolygons(): Polygon[];
700
- }
701
- declare class PolyIcosahedronElement extends PolyShapeElement {
702
- static get observedAttributes(): string[];
703
- buildPolygons(): Polygon[];
704
- }
705
- declare class PolyDodecahedronElement extends PolyShapeElement {
706
- static get observedAttributes(): string[];
707
- buildPolygons(): Polygon[];
708
- }
709
- declare class PolySphereElement extends PolyShapeElement {
710
- static get observedAttributes(): string[];
711
- buildPolygons(): Polygon[];
712
- }
713
- declare class PolyCylinderElement extends PolyShapeElement {
714
- static get observedAttributes(): string[];
715
- buildPolygons(): Polygon[];
716
- }
717
- declare class PolyConeElement extends PolyShapeElement {
718
- static get observedAttributes(): string[];
719
- buildPolygons(): Polygon[];
720
- }
721
- declare class PolyTorusElement extends PolyShapeElement {
722
- static get observedAttributes(): string[];
723
- buildPolygons(): Polygon[];
724
- }
725
-
726
- 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 };
359
+ export { type PolySceneHandle as P, type PolyMeshHandle as a, type PolyCameraOptions as b, type PolyMeshTransform as c, type PolyOrthographicCameraHandle as d, type PolyOrthographicCameraOptions as e, type PolyPerspectiveCameraHandle as f, type PolyPerspectiveCameraOptions as g, type PolySceneOptions as h, createPolyCamera as i, createPolyOrthographicCamera as j, createPolyPerspectiveCamera as k };