@layoutit/polycss 0.2.1 → 0.2.3
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/README.md +17 -13
- package/dist/{PolyShapeElements-prI_DBZX.d.cts → PolyShapeElements-CoKhApyN.d.cts} +141 -31
- package/dist/{PolyShapeElements-prI_DBZX.d.ts → PolyShapeElements-CoKhApyN.d.ts} +141 -31
- package/dist/elements.cjs +128 -53
- package/dist/elements.d.cts +1 -1
- package/dist/elements.d.ts +1 -1
- package/dist/elements.js +128 -53
- package/dist/index.cjs +407 -52
- package/dist/index.d.cts +35 -95
- package/dist/index.d.ts +35 -95
- package/dist/index.js +407 -52
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { P as
|
|
2
|
-
export {
|
|
1
|
+
import { P as PolySceneOptions, a as PolySceneHandle, b as PolyControlsHandle, c as PolyControlsBaseOptions, d as PolyControlsEvent, e as PolyControlsListener, f as PolyMeshHandle } from './PolyShapeElements-CoKhApyN.cjs';
|
|
2
|
+
export { g as PolyBoxElement, h as PolyCameraElement, i as PolyCameraOptions, j as PolyConeElement, k as PolyControlsAnimateOptions, l as PolyControlsCamera, m as PolyControlsChangeEvent, n as PolyControlsInteractionEvent, o as PolyCylinderElement, p as PolyDodecahedronElement, q as PolyFirstPersonControlsElement, r as PolyIcosahedronElement, s as PolyIframeElement, t as PolyMapControlsElement, u as PolyMeshElement, v as PolyMeshTransform, w as PolyOctahedronElement, x as PolyOrbitControlsElement, y as PolyOrbitControlsHandle, z as PolyOrbitControlsOptions, A as PolyOrthographicCameraElement, B as PolyOrthographicCameraHandle, C as PolyOrthographicCameraOptions, D as PolyPerspectiveCameraElement, E as PolyPerspectiveCameraHandle, F as PolyPerspectiveCameraOptions, G as PolyPlaneElement, H as PolyPolygonElement, I as PolyRingElement, J as PolySceneElement, K as PolySelectElement, L as PolySphereElement, M as PolyTetrahedronElement, N as PolyTorusElement, O as PolyTransformControlsElement, Q as createPolyCamera, R as createPolyOrbitControls, S as createPolyOrthographicCamera, T as createPolyPerspectiveCamera } from './PolyShapeElements-CoKhApyN.cjs';
|
|
3
3
|
import * as _layoutit_polycss_core from '@layoutit/polycss-core';
|
|
4
4
|
import { PolyDirectionalLight, PolyAmbientLight, PolyTextureLightingMode, TextureAtlasPlan, TextureQuality, PackedAtlas, PackedPage, TextureAtlasPage, PolyRenderStrategy, SolidPaintDefaults, Polygon, SolidTriangleFrame, Vec3, BoxPolygonsOptions, ParseResult, ConePolygonsOptions, CylinderPolygonsOptions, DodecahedronPolygonsOptions, IcosahedronPolygonsOptions, OctahedronPolygonsOptions, PlanePolygonsOptions, RingPolygonsOptions, SpherePolygonsOptions, TetrahedronPolygonsOptions, TorusPolygonsOptions } from '@layoutit/polycss-core';
|
|
5
5
|
export * from '@layoutit/polycss-core';
|
|
6
|
-
export { ComputeTextureAtlasPlanOptions, PackedAtlas, PackedPage, PackedTextureAtlasEntry, PolyRenderStrategiesOption, PolyRenderStrategy, ParseResult as PolyShapeResult, SolidPaintDefaults, SolidTriangleFrame, TextureAtlasPage, TextureAtlasPlan, TextureQuality, buildTextureEdgeRepairSets, computeTextureAtlasPlanPublic, cssBorderShapeForPlan, formatBorderShapeEntryMatrix, formatCssLengthPx, formatMatrix3d, formatSolidQuadEntryMatrix, isFullRectSolid, isProjectiveQuadPlan, isSolidTrianglePlan } from '@layoutit/polycss-core';
|
|
6
|
+
export { ComputeTextureAtlasPlanOptions, PackedAtlas, PackedPage, PackedTextureAtlasEntry, PolyRenderStrategiesOption, PolyRenderStrategy, ParseResult as PolyShapeResult, SolidPaintDefaults, SolidTriangleFrame, TextureAtlasPage, TextureAtlasPlan, TextureQuality, buildPolyMeshTransform, buildTextureEdgeRepairSets, computeTextureAtlasPlanPublic, cssBorderShapeForPlan, formatBorderShapeEntryMatrix, formatCssLengthPx, formatMatrix3d, formatSolidQuadEntryMatrix, isFullRectSolid, isProjectiveQuadPlan, isSolidTrianglePlan, worldDirectionToPolyCss, worldPositionToPolyCss } from '@layoutit/polycss-core';
|
|
7
7
|
|
|
8
8
|
interface RenderTextureAtlasOptions {
|
|
9
9
|
doc?: Document;
|
|
@@ -22,6 +22,13 @@ interface RenderTextureAtlasOptions {
|
|
|
22
22
|
textureQuality?: _layoutit_polycss_core.TextureQuality;
|
|
23
23
|
solidPaintDefaults?: _layoutit_polycss_core.SolidPaintDefaults;
|
|
24
24
|
strategies?: _layoutit_polycss_core.PolyRenderStrategiesOption;
|
|
25
|
+
/**
|
|
26
|
+
* Indices of polygons that the directional light cannot reach (precomputed
|
|
27
|
+
* by createPolyScene via {@link computeLightVisibility}). Atlas + solid
|
|
28
|
+
* planning forces directScale to 0 for these polys so they render with
|
|
29
|
+
* ambient-only color, matching what a shadow-map pass would output.
|
|
30
|
+
*/
|
|
31
|
+
lightOccludedPolyIndices?: ReadonlySet<number>;
|
|
25
32
|
}
|
|
26
33
|
interface RenderedPoly {
|
|
27
34
|
polygonIndex: number;
|
|
@@ -33,6 +40,16 @@ interface RenderedPoly {
|
|
|
33
40
|
interface RenderTextureAtlasResult {
|
|
34
41
|
rendered: RenderedPoly[];
|
|
35
42
|
dispose(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Resolves once every textured `<s>` leaf has its `background-image`
|
|
45
|
+
* applied (i.e. the atlas canvas → Blob → URL chain has completed and
|
|
46
|
+
* the apply-bg pass has run). For meshes with no textured leaves this
|
|
47
|
+
* resolves immediately. Callers doing stale-while-revalidate swaps
|
|
48
|
+
* await this before disposing the previous render — without it, the
|
|
49
|
+
* fresh leaves mount with empty backgrounds and the prior frame's
|
|
50
|
+
* bitmaps would be needed underneath to avoid a transparent flash.
|
|
51
|
+
*/
|
|
52
|
+
pagesReady?: Promise<void>;
|
|
36
53
|
}
|
|
37
54
|
interface RenderTextureAtlasAsyncResult extends RenderTextureAtlasResult {
|
|
38
55
|
solidPaintDefaults: _layoutit_polycss_core.SolidPaintDefaults;
|
|
@@ -83,97 +100,7 @@ declare function updatePolygonsWithStableTopology(rendered: RenderedPoly[], poly
|
|
|
83
100
|
declare function renderPolygonsWithStableTriangles(polygons: Polygon[], options?: RenderTextureAtlasOptions): RenderTextureAtlasResult | null;
|
|
84
101
|
declare function updatePolygonsWithStableTriangles(rendered: RenderedPoly[], polygons: Polygon[], options?: RenderTextureAtlasOptions): RenderTextureAtlasResult | null;
|
|
85
102
|
|
|
86
|
-
|
|
87
|
-
* Shared types, constants, and utilities for orbit/map controls factories.
|
|
88
|
-
* Not part of the public API surface — use createPolyOrbitControls or
|
|
89
|
-
* createPolyMapControls.
|
|
90
|
-
*/
|
|
91
|
-
|
|
92
|
-
interface PolyControlsAnimateOptions {
|
|
93
|
-
/**
|
|
94
|
-
* Rotation rate in degrees per 60 Hz-equivalent frame. The tick is
|
|
95
|
-
* dt-clamped so 0.3 deg/frame ≈ 18 deg/sec on every refresh rate.
|
|
96
|
-
* Default: 0.3.
|
|
97
|
-
*/
|
|
98
|
-
speed?: number;
|
|
99
|
-
/** Rotation axis. Default: "y" (yaw, rotates around vertical world Z). */
|
|
100
|
-
axis?: "x" | "y";
|
|
101
|
-
/** Halt the loop while a pointer drag is in progress. Default: true. */
|
|
102
|
-
pauseOnInteraction?: boolean;
|
|
103
|
-
}
|
|
104
|
-
interface PolyControlsBaseOptions {
|
|
105
|
-
/** Pointer-drag. Default: true. */
|
|
106
|
-
drag?: boolean;
|
|
107
|
-
/** Wheel / pinch zoom. Default: true. */
|
|
108
|
-
wheel?: boolean;
|
|
109
|
-
/**
|
|
110
|
-
* When `true`, wheel events change `distance` (camera pull-back in CSS px)
|
|
111
|
-
* instead of `zoom`. Mirrors Three.js OrbitControls dolly behaviour.
|
|
112
|
-
* Default: false (zoom mode).
|
|
113
|
-
*/
|
|
114
|
-
dolly?: boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Drag-direction inversion. `false` = natural, `true` = invert (×-1),
|
|
117
|
-
* a number multiplies sensitivity (negative inverts). Default: false.
|
|
118
|
-
*/
|
|
119
|
-
invert?: boolean | number;
|
|
120
|
-
/** Minimum CSS zoom. Default: 0.1. */
|
|
121
|
-
minZoom?: number;
|
|
122
|
-
/** Maximum CSS zoom. Default: 10. */
|
|
123
|
-
maxZoom?: number;
|
|
124
|
-
/** Minimum dolly distance in CSS pixels. Default: 0. Only used when `dolly: true`. */
|
|
125
|
-
minDistance?: number;
|
|
126
|
-
/** Maximum dolly distance in CSS pixels. Default: Infinity. Only used when `dolly: true`. */
|
|
127
|
-
maxDistance?: number;
|
|
128
|
-
/** Auto-rotate. Pass false (or omit) to disable. */
|
|
129
|
-
animate?: false | PolyControlsAnimateOptions;
|
|
130
|
-
}
|
|
131
|
-
interface PolyControlsCamera {
|
|
132
|
-
rotX: number;
|
|
133
|
-
rotY: number;
|
|
134
|
-
zoom: number;
|
|
135
|
-
target: Vec3;
|
|
136
|
-
distance: number;
|
|
137
|
-
}
|
|
138
|
-
interface PolyControlsChangeEvent {
|
|
139
|
-
type: "change";
|
|
140
|
-
camera: PolyControlsCamera;
|
|
141
|
-
}
|
|
142
|
-
interface PolyControlsInteractionEvent {
|
|
143
|
-
type: "start" | "end";
|
|
144
|
-
camera: PolyControlsCamera;
|
|
145
|
-
}
|
|
146
|
-
type PolyControlsEvent = PolyControlsChangeEvent | PolyControlsInteractionEvent;
|
|
147
|
-
type PolyControlsListener<E extends PolyControlsEvent = PolyControlsEvent> = (event: E) => void;
|
|
148
|
-
interface PolyControlsHandle {
|
|
149
|
-
update(partial: PolyControlsBaseOptions): void;
|
|
150
|
-
resume(): void;
|
|
151
|
-
pause(): void;
|
|
152
|
-
destroy(): void;
|
|
153
|
-
addEventListener<T extends PolyControlsEvent["type"]>(type: T, listener: PolyControlsListener<Extract<PolyControlsEvent, {
|
|
154
|
-
type: T;
|
|
155
|
-
}>>): void;
|
|
156
|
-
removeEventListener<T extends PolyControlsEvent["type"]>(type: T, listener: PolyControlsListener<Extract<PolyControlsEvent, {
|
|
157
|
-
type: T;
|
|
158
|
-
}>>): void;
|
|
159
|
-
hasEventListener<T extends PolyControlsEvent["type"]>(type: T, listener: PolyControlsListener<Extract<PolyControlsEvent, {
|
|
160
|
-
type: T;
|
|
161
|
-
}>>): boolean;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* createPolyOrbitControls — orbit-mode camera input for a PolyScene.
|
|
166
|
-
*
|
|
167
|
-
* Left-drag rotates rotX / rotY around the target (orbit). Wheel zooms or
|
|
168
|
-
* dollies. Mirrors Three.js OrbitControls semantics.
|
|
169
|
-
*
|
|
170
|
-
* For map/pan semantics (left-drag pans, right-drag orbits) use
|
|
171
|
-
* `createPolyMapControls` instead.
|
|
172
|
-
*/
|
|
173
|
-
|
|
174
|
-
type PolyOrbitControlsOptions = PolyControlsBaseOptions;
|
|
175
|
-
type PolyOrbitControlsHandle = PolyControlsHandle;
|
|
176
|
-
declare function createPolyOrbitControls(scene: PolySceneHandle, options?: PolyOrbitControlsOptions): PolyOrbitControlsHandle;
|
|
103
|
+
declare function createPolyScene(host: HTMLElement, options: PolySceneOptions): PolySceneHandle;
|
|
177
104
|
|
|
178
105
|
/**
|
|
179
106
|
* createPolyMapControls — map/pan-mode camera input for a PolyScene.
|
|
@@ -398,6 +325,19 @@ interface PolyRenderStatsOptions {
|
|
|
398
325
|
}
|
|
399
326
|
declare function collectPolyRenderStats(root: ParentNode | null | undefined, optionsOrPolygonCount?: number | PolyRenderStatsOptions): PolyRenderStats;
|
|
400
327
|
|
|
328
|
+
type PolySceneSnapshotErrorCode = "INVALID_TARGET" | "SCENE_NOT_FOUND" | "ASSET_INLINE_FAILED";
|
|
329
|
+
declare class PolySceneSnapshotError extends Error {
|
|
330
|
+
readonly code: PolySceneSnapshotErrorCode;
|
|
331
|
+
readonly url?: string;
|
|
332
|
+
constructor(code: PolySceneSnapshotErrorCode, message: string, url?: string);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Serialize the current rendered PolyCSS DOM into a standalone HTML document.
|
|
336
|
+
* The snapshot is intentionally static: it preserves the scene's current DOM,
|
|
337
|
+
* inlines CSS image assets, and emits no scripts or PolyCSS runtime imports.
|
|
338
|
+
*/
|
|
339
|
+
declare function exportPolySceneSnapshot(target: Element): Promise<string>;
|
|
340
|
+
|
|
401
341
|
/**
|
|
402
342
|
* Primitive shape factories — thin wrappers over the polygon generators in
|
|
403
343
|
* @layoutit/polycss-core. Each returns a `ParseResult`-compatible object so
|
|
@@ -418,4 +358,4 @@ declare function createPolyTorus(options?: TorusPolygonsOptions): ParseResult;
|
|
|
418
358
|
|
|
419
359
|
declare function injectPolyBaseStyles(doc?: Document): void;
|
|
420
360
|
|
|
421
|
-
export {
|
|
361
|
+
export { PolyControlsBaseOptions, PolyControlsEvent, PolyControlsHandle, PolyControlsListener, type PolyFirstPersonControlsHandle, type PolyFirstPersonControlsOptions, type PolyMapControlsHandle, type PolyMapControlsOptions, PolyMeshHandle, type PolyRenderStats, type PolyRenderStatsOptions, type PolyRenderSurfaceLeafCounts, PolySceneHandle, PolySceneOptions, PolySceneSnapshotError, type PolySceneSnapshotErrorCode, type PolySelectOptions, type PolySelectionHandle, type PolyTransformControlsHandle, type PolyTransformControlsObjectChangeEvent, type PolyTransformControlsOptions, type RenderTextureAtlasAsyncResult, type RenderTextureAtlasOptions, type RenderTextureAtlasResult, type RenderedPoly, buildAtlasPages, collectPolyRenderStats, createPolyBox, createPolyCone, createPolyCylinder, createPolyDodecahedron, createPolyFirstPersonControls, createPolyIcosahedron, createPolyMapControls, createPolyOctahedron, createPolyPlane, createPolyRing, createPolyScene, createPolySphere, createPolyTetrahedron, createPolyTorus, createSelect, createTransformControls, exportPolySceneSnapshot, filterAtlasPlans, getSolidPaintDefaults, getSolidPaintDefaultsFromPlans, injectPolyBaseStyles, isBorderShapeSupported, isSolidTriangleSupported, packTextureAtlasPlansWithScale, renderPolygonsWithStableTriangles, renderPolygonsWithTextureAtlas, renderPolygonsWithTextureAtlasAsync, updatePolygonsWithStableTopology, updatePolygonsWithStableTriangles, updateStableTriangleFrame };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { P as
|
|
2
|
-
export {
|
|
1
|
+
import { P as PolySceneOptions, a as PolySceneHandle, b as PolyControlsHandle, c as PolyControlsBaseOptions, d as PolyControlsEvent, e as PolyControlsListener, f as PolyMeshHandle } from './PolyShapeElements-CoKhApyN.js';
|
|
2
|
+
export { g as PolyBoxElement, h as PolyCameraElement, i as PolyCameraOptions, j as PolyConeElement, k as PolyControlsAnimateOptions, l as PolyControlsCamera, m as PolyControlsChangeEvent, n as PolyControlsInteractionEvent, o as PolyCylinderElement, p as PolyDodecahedronElement, q as PolyFirstPersonControlsElement, r as PolyIcosahedronElement, s as PolyIframeElement, t as PolyMapControlsElement, u as PolyMeshElement, v as PolyMeshTransform, w as PolyOctahedronElement, x as PolyOrbitControlsElement, y as PolyOrbitControlsHandle, z as PolyOrbitControlsOptions, A as PolyOrthographicCameraElement, B as PolyOrthographicCameraHandle, C as PolyOrthographicCameraOptions, D as PolyPerspectiveCameraElement, E as PolyPerspectiveCameraHandle, F as PolyPerspectiveCameraOptions, G as PolyPlaneElement, H as PolyPolygonElement, I as PolyRingElement, J as PolySceneElement, K as PolySelectElement, L as PolySphereElement, M as PolyTetrahedronElement, N as PolyTorusElement, O as PolyTransformControlsElement, Q as createPolyCamera, R as createPolyOrbitControls, S as createPolyOrthographicCamera, T as createPolyPerspectiveCamera } from './PolyShapeElements-CoKhApyN.js';
|
|
3
3
|
import * as _layoutit_polycss_core from '@layoutit/polycss-core';
|
|
4
4
|
import { PolyDirectionalLight, PolyAmbientLight, PolyTextureLightingMode, TextureAtlasPlan, TextureQuality, PackedAtlas, PackedPage, TextureAtlasPage, PolyRenderStrategy, SolidPaintDefaults, Polygon, SolidTriangleFrame, Vec3, BoxPolygonsOptions, ParseResult, ConePolygonsOptions, CylinderPolygonsOptions, DodecahedronPolygonsOptions, IcosahedronPolygonsOptions, OctahedronPolygonsOptions, PlanePolygonsOptions, RingPolygonsOptions, SpherePolygonsOptions, TetrahedronPolygonsOptions, TorusPolygonsOptions } from '@layoutit/polycss-core';
|
|
5
5
|
export * from '@layoutit/polycss-core';
|
|
6
|
-
export { ComputeTextureAtlasPlanOptions, PackedAtlas, PackedPage, PackedTextureAtlasEntry, PolyRenderStrategiesOption, PolyRenderStrategy, ParseResult as PolyShapeResult, SolidPaintDefaults, SolidTriangleFrame, TextureAtlasPage, TextureAtlasPlan, TextureQuality, buildTextureEdgeRepairSets, computeTextureAtlasPlanPublic, cssBorderShapeForPlan, formatBorderShapeEntryMatrix, formatCssLengthPx, formatMatrix3d, formatSolidQuadEntryMatrix, isFullRectSolid, isProjectiveQuadPlan, isSolidTrianglePlan } from '@layoutit/polycss-core';
|
|
6
|
+
export { ComputeTextureAtlasPlanOptions, PackedAtlas, PackedPage, PackedTextureAtlasEntry, PolyRenderStrategiesOption, PolyRenderStrategy, ParseResult as PolyShapeResult, SolidPaintDefaults, SolidTriangleFrame, TextureAtlasPage, TextureAtlasPlan, TextureQuality, buildPolyMeshTransform, buildTextureEdgeRepairSets, computeTextureAtlasPlanPublic, cssBorderShapeForPlan, formatBorderShapeEntryMatrix, formatCssLengthPx, formatMatrix3d, formatSolidQuadEntryMatrix, isFullRectSolid, isProjectiveQuadPlan, isSolidTrianglePlan, worldDirectionToPolyCss, worldPositionToPolyCss } from '@layoutit/polycss-core';
|
|
7
7
|
|
|
8
8
|
interface RenderTextureAtlasOptions {
|
|
9
9
|
doc?: Document;
|
|
@@ -22,6 +22,13 @@ interface RenderTextureAtlasOptions {
|
|
|
22
22
|
textureQuality?: _layoutit_polycss_core.TextureQuality;
|
|
23
23
|
solidPaintDefaults?: _layoutit_polycss_core.SolidPaintDefaults;
|
|
24
24
|
strategies?: _layoutit_polycss_core.PolyRenderStrategiesOption;
|
|
25
|
+
/**
|
|
26
|
+
* Indices of polygons that the directional light cannot reach (precomputed
|
|
27
|
+
* by createPolyScene via {@link computeLightVisibility}). Atlas + solid
|
|
28
|
+
* planning forces directScale to 0 for these polys so they render with
|
|
29
|
+
* ambient-only color, matching what a shadow-map pass would output.
|
|
30
|
+
*/
|
|
31
|
+
lightOccludedPolyIndices?: ReadonlySet<number>;
|
|
25
32
|
}
|
|
26
33
|
interface RenderedPoly {
|
|
27
34
|
polygonIndex: number;
|
|
@@ -33,6 +40,16 @@ interface RenderedPoly {
|
|
|
33
40
|
interface RenderTextureAtlasResult {
|
|
34
41
|
rendered: RenderedPoly[];
|
|
35
42
|
dispose(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Resolves once every textured `<s>` leaf has its `background-image`
|
|
45
|
+
* applied (i.e. the atlas canvas → Blob → URL chain has completed and
|
|
46
|
+
* the apply-bg pass has run). For meshes with no textured leaves this
|
|
47
|
+
* resolves immediately. Callers doing stale-while-revalidate swaps
|
|
48
|
+
* await this before disposing the previous render — without it, the
|
|
49
|
+
* fresh leaves mount with empty backgrounds and the prior frame's
|
|
50
|
+
* bitmaps would be needed underneath to avoid a transparent flash.
|
|
51
|
+
*/
|
|
52
|
+
pagesReady?: Promise<void>;
|
|
36
53
|
}
|
|
37
54
|
interface RenderTextureAtlasAsyncResult extends RenderTextureAtlasResult {
|
|
38
55
|
solidPaintDefaults: _layoutit_polycss_core.SolidPaintDefaults;
|
|
@@ -83,97 +100,7 @@ declare function updatePolygonsWithStableTopology(rendered: RenderedPoly[], poly
|
|
|
83
100
|
declare function renderPolygonsWithStableTriangles(polygons: Polygon[], options?: RenderTextureAtlasOptions): RenderTextureAtlasResult | null;
|
|
84
101
|
declare function updatePolygonsWithStableTriangles(rendered: RenderedPoly[], polygons: Polygon[], options?: RenderTextureAtlasOptions): RenderTextureAtlasResult | null;
|
|
85
102
|
|
|
86
|
-
|
|
87
|
-
* Shared types, constants, and utilities for orbit/map controls factories.
|
|
88
|
-
* Not part of the public API surface — use createPolyOrbitControls or
|
|
89
|
-
* createPolyMapControls.
|
|
90
|
-
*/
|
|
91
|
-
|
|
92
|
-
interface PolyControlsAnimateOptions {
|
|
93
|
-
/**
|
|
94
|
-
* Rotation rate in degrees per 60 Hz-equivalent frame. The tick is
|
|
95
|
-
* dt-clamped so 0.3 deg/frame ≈ 18 deg/sec on every refresh rate.
|
|
96
|
-
* Default: 0.3.
|
|
97
|
-
*/
|
|
98
|
-
speed?: number;
|
|
99
|
-
/** Rotation axis. Default: "y" (yaw, rotates around vertical world Z). */
|
|
100
|
-
axis?: "x" | "y";
|
|
101
|
-
/** Halt the loop while a pointer drag is in progress. Default: true. */
|
|
102
|
-
pauseOnInteraction?: boolean;
|
|
103
|
-
}
|
|
104
|
-
interface PolyControlsBaseOptions {
|
|
105
|
-
/** Pointer-drag. Default: true. */
|
|
106
|
-
drag?: boolean;
|
|
107
|
-
/** Wheel / pinch zoom. Default: true. */
|
|
108
|
-
wheel?: boolean;
|
|
109
|
-
/**
|
|
110
|
-
* When `true`, wheel events change `distance` (camera pull-back in CSS px)
|
|
111
|
-
* instead of `zoom`. Mirrors Three.js OrbitControls dolly behaviour.
|
|
112
|
-
* Default: false (zoom mode).
|
|
113
|
-
*/
|
|
114
|
-
dolly?: boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Drag-direction inversion. `false` = natural, `true` = invert (×-1),
|
|
117
|
-
* a number multiplies sensitivity (negative inverts). Default: false.
|
|
118
|
-
*/
|
|
119
|
-
invert?: boolean | number;
|
|
120
|
-
/** Minimum CSS zoom. Default: 0.1. */
|
|
121
|
-
minZoom?: number;
|
|
122
|
-
/** Maximum CSS zoom. Default: 10. */
|
|
123
|
-
maxZoom?: number;
|
|
124
|
-
/** Minimum dolly distance in CSS pixels. Default: 0. Only used when `dolly: true`. */
|
|
125
|
-
minDistance?: number;
|
|
126
|
-
/** Maximum dolly distance in CSS pixels. Default: Infinity. Only used when `dolly: true`. */
|
|
127
|
-
maxDistance?: number;
|
|
128
|
-
/** Auto-rotate. Pass false (or omit) to disable. */
|
|
129
|
-
animate?: false | PolyControlsAnimateOptions;
|
|
130
|
-
}
|
|
131
|
-
interface PolyControlsCamera {
|
|
132
|
-
rotX: number;
|
|
133
|
-
rotY: number;
|
|
134
|
-
zoom: number;
|
|
135
|
-
target: Vec3;
|
|
136
|
-
distance: number;
|
|
137
|
-
}
|
|
138
|
-
interface PolyControlsChangeEvent {
|
|
139
|
-
type: "change";
|
|
140
|
-
camera: PolyControlsCamera;
|
|
141
|
-
}
|
|
142
|
-
interface PolyControlsInteractionEvent {
|
|
143
|
-
type: "start" | "end";
|
|
144
|
-
camera: PolyControlsCamera;
|
|
145
|
-
}
|
|
146
|
-
type PolyControlsEvent = PolyControlsChangeEvent | PolyControlsInteractionEvent;
|
|
147
|
-
type PolyControlsListener<E extends PolyControlsEvent = PolyControlsEvent> = (event: E) => void;
|
|
148
|
-
interface PolyControlsHandle {
|
|
149
|
-
update(partial: PolyControlsBaseOptions): void;
|
|
150
|
-
resume(): void;
|
|
151
|
-
pause(): void;
|
|
152
|
-
destroy(): void;
|
|
153
|
-
addEventListener<T extends PolyControlsEvent["type"]>(type: T, listener: PolyControlsListener<Extract<PolyControlsEvent, {
|
|
154
|
-
type: T;
|
|
155
|
-
}>>): void;
|
|
156
|
-
removeEventListener<T extends PolyControlsEvent["type"]>(type: T, listener: PolyControlsListener<Extract<PolyControlsEvent, {
|
|
157
|
-
type: T;
|
|
158
|
-
}>>): void;
|
|
159
|
-
hasEventListener<T extends PolyControlsEvent["type"]>(type: T, listener: PolyControlsListener<Extract<PolyControlsEvent, {
|
|
160
|
-
type: T;
|
|
161
|
-
}>>): boolean;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* createPolyOrbitControls — orbit-mode camera input for a PolyScene.
|
|
166
|
-
*
|
|
167
|
-
* Left-drag rotates rotX / rotY around the target (orbit). Wheel zooms or
|
|
168
|
-
* dollies. Mirrors Three.js OrbitControls semantics.
|
|
169
|
-
*
|
|
170
|
-
* For map/pan semantics (left-drag pans, right-drag orbits) use
|
|
171
|
-
* `createPolyMapControls` instead.
|
|
172
|
-
*/
|
|
173
|
-
|
|
174
|
-
type PolyOrbitControlsOptions = PolyControlsBaseOptions;
|
|
175
|
-
type PolyOrbitControlsHandle = PolyControlsHandle;
|
|
176
|
-
declare function createPolyOrbitControls(scene: PolySceneHandle, options?: PolyOrbitControlsOptions): PolyOrbitControlsHandle;
|
|
103
|
+
declare function createPolyScene(host: HTMLElement, options: PolySceneOptions): PolySceneHandle;
|
|
177
104
|
|
|
178
105
|
/**
|
|
179
106
|
* createPolyMapControls — map/pan-mode camera input for a PolyScene.
|
|
@@ -398,6 +325,19 @@ interface PolyRenderStatsOptions {
|
|
|
398
325
|
}
|
|
399
326
|
declare function collectPolyRenderStats(root: ParentNode | null | undefined, optionsOrPolygonCount?: number | PolyRenderStatsOptions): PolyRenderStats;
|
|
400
327
|
|
|
328
|
+
type PolySceneSnapshotErrorCode = "INVALID_TARGET" | "SCENE_NOT_FOUND" | "ASSET_INLINE_FAILED";
|
|
329
|
+
declare class PolySceneSnapshotError extends Error {
|
|
330
|
+
readonly code: PolySceneSnapshotErrorCode;
|
|
331
|
+
readonly url?: string;
|
|
332
|
+
constructor(code: PolySceneSnapshotErrorCode, message: string, url?: string);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Serialize the current rendered PolyCSS DOM into a standalone HTML document.
|
|
336
|
+
* The snapshot is intentionally static: it preserves the scene's current DOM,
|
|
337
|
+
* inlines CSS image assets, and emits no scripts or PolyCSS runtime imports.
|
|
338
|
+
*/
|
|
339
|
+
declare function exportPolySceneSnapshot(target: Element): Promise<string>;
|
|
340
|
+
|
|
401
341
|
/**
|
|
402
342
|
* Primitive shape factories — thin wrappers over the polygon generators in
|
|
403
343
|
* @layoutit/polycss-core. Each returns a `ParseResult`-compatible object so
|
|
@@ -418,4 +358,4 @@ declare function createPolyTorus(options?: TorusPolygonsOptions): ParseResult;
|
|
|
418
358
|
|
|
419
359
|
declare function injectPolyBaseStyles(doc?: Document): void;
|
|
420
360
|
|
|
421
|
-
export {
|
|
361
|
+
export { PolyControlsBaseOptions, PolyControlsEvent, PolyControlsHandle, PolyControlsListener, type PolyFirstPersonControlsHandle, type PolyFirstPersonControlsOptions, type PolyMapControlsHandle, type PolyMapControlsOptions, PolyMeshHandle, type PolyRenderStats, type PolyRenderStatsOptions, type PolyRenderSurfaceLeafCounts, PolySceneHandle, PolySceneOptions, PolySceneSnapshotError, type PolySceneSnapshotErrorCode, type PolySelectOptions, type PolySelectionHandle, type PolyTransformControlsHandle, type PolyTransformControlsObjectChangeEvent, type PolyTransformControlsOptions, type RenderTextureAtlasAsyncResult, type RenderTextureAtlasOptions, type RenderTextureAtlasResult, type RenderedPoly, buildAtlasPages, collectPolyRenderStats, createPolyBox, createPolyCone, createPolyCylinder, createPolyDodecahedron, createPolyFirstPersonControls, createPolyIcosahedron, createPolyMapControls, createPolyOctahedron, createPolyPlane, createPolyRing, createPolyScene, createPolySphere, createPolyTetrahedron, createPolyTorus, createSelect, createTransformControls, exportPolySceneSnapshot, filterAtlasPlans, getSolidPaintDefaults, getSolidPaintDefaultsFromPlans, injectPolyBaseStyles, isBorderShapeSupported, isSolidTriangleSupported, packTextureAtlasPlansWithScale, renderPolygonsWithStableTriangles, renderPolygonsWithTextureAtlas, renderPolygonsWithTextureAtlasAsync, updatePolygonsWithStableTopology, updatePolygonsWithStableTriangles, updateStableTriangleFrame };
|