@layoutit/polycss 0.0.1 → 0.2.0

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,5 +1,5 @@
1
- import { P as PolySceneHandle, a as PolyMeshHandle } from './PolySelectElement-DCuYJb5J.cjs';
2
- export { b as PolyCameraOptions, c as PolyMapControlsElement, d as PolyMeshElement, e as PolyMeshTransform, f as PolyOrbitControlsElement, g as PolyOrthographicCameraElement, h as PolyOrthographicCameraHandle, i as PolyOrthographicCameraOptions, j as PolyPerspectiveCameraElement, k as PolyPerspectiveCameraHandle, l as PolyPerspectiveCameraOptions, m as PolyPolygonElement, n as PolySceneElement, o as PolySceneOptions, p as PolySelectElement, q as PolyTransformControlsElement, r as createPolyOrthographicCamera, s as createPolyPerspectiveCamera, t as createPolyScene } from './PolySelectElement-DCuYJb5J.cjs';
1
+ import { P as PolySceneHandle, a as PolyMeshHandle } from './PolySelectElement-Tvsmhx2m.cjs';
2
+ export { b as PolyCameraOptions, c as PolyMapControlsElement, d as PolyMeshElement, e as PolyMeshTransform, f as PolyOrbitControlsElement, g as PolyOrthographicCameraElement, h as PolyOrthographicCameraHandle, i as PolyOrthographicCameraOptions, j as PolyPerspectiveCameraElement, k as PolyPerspectiveCameraHandle, l as PolyPerspectiveCameraOptions, m as PolyPolygonElement, n as PolyRenderStrategiesOption, o as PolyRenderStrategy, p as PolySceneElement, q as PolySceneOptions, r as PolySelectElement, s as PolyTransformControlsElement, T as TextureQuality, t as createPolyOrthographicCamera, u as createPolyPerspectiveCamera, v as createPolyScene } from './PolySelectElement-Tvsmhx2m.cjs';
3
3
  import { Vec3 } from '@layoutit/polycss-core';
4
4
  export * from '@layoutit/polycss-core';
5
5
 
@@ -110,6 +110,86 @@ type PolyMapControlsOptions = PolyControlsBaseOptions;
110
110
  type PolyMapControlsHandle = PolyControlsHandle;
111
111
  declare function createPolyMapControls(scene: PolySceneHandle, options?: PolyMapControlsOptions): PolyMapControlsHandle;
112
112
 
113
+ /**
114
+ * createPolyFirstPersonControls — first-person camera input for a PolyScene.
115
+ *
116
+ * Mouselook on pointer-lock, WASD/arrow planar move in the yaw-aligned XY
117
+ * plane, Space jump (parametric arc, no collision), Ctrl crouch. Each input
118
+ * axis is independently toggleable so callers can mix-and-match (e.g.
119
+ * mouselook-only on a model viewer, or move-only on a tour rail).
120
+ *
121
+ * For orbit semantics use `createPolyOrbitControls`. For pan/orbit map
122
+ * semantics use `createPolyMapControls`.
123
+ */
124
+
125
+ interface PolyFirstPersonControlsOptions {
126
+ /** Master switch. When `false`, all sub-controls are inert. Default: `true`. */
127
+ enabled?: boolean;
128
+ /** Pointer-lock mouselook (rotX = pitch, rotY = yaw). Default: `true`. */
129
+ lookEnabled?: boolean;
130
+ /** WASD / arrow-key planar movement on world XY. Default: `true`. */
131
+ moveEnabled?: boolean;
132
+ /** Space-bar parametric jump arc on world Z. Default: `true`. */
133
+ jumpEnabled?: boolean;
134
+ /** Ctrl crouch (lowers eye height while held). Default: `true`. */
135
+ crouchEnabled?: boolean;
136
+ /** Mouselook sensitivity in degrees per pixel. Default: `0.15`. */
137
+ lookSensitivity?: number;
138
+ /** Invert vertical mouselook. Default: `false`. */
139
+ invertY?: boolean;
140
+ /** Movement speed in world units per second. Default: `5`. */
141
+ moveSpeed?: number;
142
+ /** Initial vertical velocity for a jump, world units per second. Default: `7`. */
143
+ jumpVelocity?: number;
144
+ /** Gravity acceleration in world units per second squared. Default: `18`. */
145
+ gravity?: number;
146
+ /** Standing eye height above the ground plane (target.z). Default: `1.7`. */
147
+ eyeHeight?: number;
148
+ /** Eye height while crouching. Default: `1`. */
149
+ crouchHeight?: number;
150
+ /** World Z of the ground plane the player walks on. Default: `0`. */
151
+ groundZ?: number;
152
+ /** Min pitch (rotX) angle. Default: `5`. */
153
+ minPitch?: number;
154
+ /** Max pitch (rotX) angle. Default: `175`. */
155
+ maxPitch?: number;
156
+ }
157
+ interface PolyFirstPersonControlsHandle {
158
+ update(partial: PolyFirstPersonControlsOptions): void;
159
+ resume(): void;
160
+ pause(): void;
161
+ destroy(): void;
162
+ /** Request pointer-lock now. Call from a user gesture (click). */
163
+ lock(): void;
164
+ /** Release pointer-lock. */
165
+ unlock(): void;
166
+ /** Whether pointer-lock is currently held. */
167
+ isLocked(): boolean;
168
+ /**
169
+ * The camera's WORLD position (the eye). FPV maintains this separately
170
+ * from the scene's `target` so mouselook rotates around it (in-place)
171
+ * instead of orbiting around target. Snapshot — mutate via WASD / jump /
172
+ * crouch, or by calling `setOrigin`.
173
+ */
174
+ getOrigin(): [number, number, number];
175
+ /**
176
+ * Move the camera origin to a specific world position. Re-derives the
177
+ * scene's target so the perspective viewer follows. Use this to teleport,
178
+ * spawn at a chosen spot, etc.
179
+ */
180
+ setOrigin(origin: [number, number, number]): void;
181
+ addEventListener<T extends PolyControlsEvent["type"]>(type: T, listener: PolyControlsListener<Extract<PolyControlsEvent, {
182
+ type: T;
183
+ }>>): void;
184
+ removeEventListener<T extends PolyControlsEvent["type"]>(type: T, listener: PolyControlsListener<Extract<PolyControlsEvent, {
185
+ type: T;
186
+ }>>): void;
187
+ hasEventListener<T extends PolyControlsEvent["type"]>(type: T, listener: PolyControlsListener<Extract<PolyControlsEvent, {
188
+ type: T;
189
+ }>>): boolean;
190
+ }
191
+ declare function createPolyFirstPersonControls(scene: PolySceneHandle, options?: PolyFirstPersonControlsOptions): PolyFirstPersonControlsHandle;
192
+
113
193
  /**
114
194
  * createSelect — additive selection layer for vanilla polycss scenes.
115
195
  * Mirrors the React `<Select>` API: tracks one or more selected
@@ -217,4 +297,4 @@ declare function createTransformControls(scene: PolySceneHandle, options?: PolyT
217
297
 
218
298
  declare function injectPolyBaseStyles(doc?: Document): void;
219
299
 
220
- export { type PolyControlsAnimateOptions, type PolyControlsBaseOptions, type PolyControlsCamera, type PolyControlsChangeEvent, type PolyControlsEvent, type PolyControlsHandle, type PolyControlsInteractionEvent, type PolyControlsListener, type PolyMapControlsHandle, type PolyMapControlsOptions, PolyMeshHandle, type PolyOrbitControlsHandle, type PolyOrbitControlsOptions, PolySceneHandle, type PolySelectOptions, type PolySelectionHandle, type PolyTransformControlsHandle, type PolyTransformControlsObjectChangeEvent, type PolyTransformControlsOptions, createPolyMapControls, createPolyOrbitControls, createSelect, createTransformControls, injectPolyBaseStyles };
300
+ export { type PolyControlsAnimateOptions, type PolyControlsBaseOptions, type PolyControlsCamera, type PolyControlsChangeEvent, type PolyControlsEvent, type PolyControlsHandle, type PolyControlsInteractionEvent, type PolyControlsListener, type PolyFirstPersonControlsHandle, type PolyFirstPersonControlsOptions, type PolyMapControlsHandle, type PolyMapControlsOptions, PolyMeshHandle, type PolyOrbitControlsHandle, type PolyOrbitControlsOptions, PolySceneHandle, type PolySelectOptions, type PolySelectionHandle, type PolyTransformControlsHandle, type PolyTransformControlsObjectChangeEvent, type PolyTransformControlsOptions, createPolyFirstPersonControls, createPolyMapControls, createPolyOrbitControls, createSelect, createTransformControls, injectPolyBaseStyles };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PolySceneHandle, a as PolyMeshHandle } from './PolySelectElement-DCuYJb5J.js';
2
- export { b as PolyCameraOptions, c as PolyMapControlsElement, d as PolyMeshElement, e as PolyMeshTransform, f as PolyOrbitControlsElement, g as PolyOrthographicCameraElement, h as PolyOrthographicCameraHandle, i as PolyOrthographicCameraOptions, j as PolyPerspectiveCameraElement, k as PolyPerspectiveCameraHandle, l as PolyPerspectiveCameraOptions, m as PolyPolygonElement, n as PolySceneElement, o as PolySceneOptions, p as PolySelectElement, q as PolyTransformControlsElement, r as createPolyOrthographicCamera, s as createPolyPerspectiveCamera, t as createPolyScene } from './PolySelectElement-DCuYJb5J.js';
1
+ import { P as PolySceneHandle, a as PolyMeshHandle } from './PolySelectElement-Tvsmhx2m.js';
2
+ export { b as PolyCameraOptions, c as PolyMapControlsElement, d as PolyMeshElement, e as PolyMeshTransform, f as PolyOrbitControlsElement, g as PolyOrthographicCameraElement, h as PolyOrthographicCameraHandle, i as PolyOrthographicCameraOptions, j as PolyPerspectiveCameraElement, k as PolyPerspectiveCameraHandle, l as PolyPerspectiveCameraOptions, m as PolyPolygonElement, n as PolyRenderStrategiesOption, o as PolyRenderStrategy, p as PolySceneElement, q as PolySceneOptions, r as PolySelectElement, s as PolyTransformControlsElement, T as TextureQuality, t as createPolyOrthographicCamera, u as createPolyPerspectiveCamera, v as createPolyScene } from './PolySelectElement-Tvsmhx2m.js';
3
3
  import { Vec3 } from '@layoutit/polycss-core';
4
4
  export * from '@layoutit/polycss-core';
5
5
 
@@ -110,6 +110,86 @@ type PolyMapControlsOptions = PolyControlsBaseOptions;
110
110
  type PolyMapControlsHandle = PolyControlsHandle;
111
111
  declare function createPolyMapControls(scene: PolySceneHandle, options?: PolyMapControlsOptions): PolyMapControlsHandle;
112
112
 
113
+ /**
114
+ * createPolyFirstPersonControls — first-person camera input for a PolyScene.
115
+ *
116
+ * Mouselook on pointer-lock, WASD/arrow planar move in the yaw-aligned XY
117
+ * plane, Space jump (parametric arc, no collision), Ctrl crouch. Each input
118
+ * axis is independently toggleable so callers can mix-and-match (e.g.
119
+ * mouselook-only on a model viewer, or move-only on a tour rail).
120
+ *
121
+ * For orbit semantics use `createPolyOrbitControls`. For pan/orbit map
122
+ * semantics use `createPolyMapControls`.
123
+ */
124
+
125
+ interface PolyFirstPersonControlsOptions {
126
+ /** Master switch. When `false`, all sub-controls are inert. Default: `true`. */
127
+ enabled?: boolean;
128
+ /** Pointer-lock mouselook (rotX = pitch, rotY = yaw). Default: `true`. */
129
+ lookEnabled?: boolean;
130
+ /** WASD / arrow-key planar movement on world XY. Default: `true`. */
131
+ moveEnabled?: boolean;
132
+ /** Space-bar parametric jump arc on world Z. Default: `true`. */
133
+ jumpEnabled?: boolean;
134
+ /** Ctrl crouch (lowers eye height while held). Default: `true`. */
135
+ crouchEnabled?: boolean;
136
+ /** Mouselook sensitivity in degrees per pixel. Default: `0.15`. */
137
+ lookSensitivity?: number;
138
+ /** Invert vertical mouselook. Default: `false`. */
139
+ invertY?: boolean;
140
+ /** Movement speed in world units per second. Default: `5`. */
141
+ moveSpeed?: number;
142
+ /** Initial vertical velocity for a jump, world units per second. Default: `7`. */
143
+ jumpVelocity?: number;
144
+ /** Gravity acceleration in world units per second squared. Default: `18`. */
145
+ gravity?: number;
146
+ /** Standing eye height above the ground plane (target.z). Default: `1.7`. */
147
+ eyeHeight?: number;
148
+ /** Eye height while crouching. Default: `1`. */
149
+ crouchHeight?: number;
150
+ /** World Z of the ground plane the player walks on. Default: `0`. */
151
+ groundZ?: number;
152
+ /** Min pitch (rotX) angle. Default: `5`. */
153
+ minPitch?: number;
154
+ /** Max pitch (rotX) angle. Default: `175`. */
155
+ maxPitch?: number;
156
+ }
157
+ interface PolyFirstPersonControlsHandle {
158
+ update(partial: PolyFirstPersonControlsOptions): void;
159
+ resume(): void;
160
+ pause(): void;
161
+ destroy(): void;
162
+ /** Request pointer-lock now. Call from a user gesture (click). */
163
+ lock(): void;
164
+ /** Release pointer-lock. */
165
+ unlock(): void;
166
+ /** Whether pointer-lock is currently held. */
167
+ isLocked(): boolean;
168
+ /**
169
+ * The camera's WORLD position (the eye). FPV maintains this separately
170
+ * from the scene's `target` so mouselook rotates around it (in-place)
171
+ * instead of orbiting around target. Snapshot — mutate via WASD / jump /
172
+ * crouch, or by calling `setOrigin`.
173
+ */
174
+ getOrigin(): [number, number, number];
175
+ /**
176
+ * Move the camera origin to a specific world position. Re-derives the
177
+ * scene's target so the perspective viewer follows. Use this to teleport,
178
+ * spawn at a chosen spot, etc.
179
+ */
180
+ setOrigin(origin: [number, number, number]): void;
181
+ addEventListener<T extends PolyControlsEvent["type"]>(type: T, listener: PolyControlsListener<Extract<PolyControlsEvent, {
182
+ type: T;
183
+ }>>): void;
184
+ removeEventListener<T extends PolyControlsEvent["type"]>(type: T, listener: PolyControlsListener<Extract<PolyControlsEvent, {
185
+ type: T;
186
+ }>>): void;
187
+ hasEventListener<T extends PolyControlsEvent["type"]>(type: T, listener: PolyControlsListener<Extract<PolyControlsEvent, {
188
+ type: T;
189
+ }>>): boolean;
190
+ }
191
+ declare function createPolyFirstPersonControls(scene: PolySceneHandle, options?: PolyFirstPersonControlsOptions): PolyFirstPersonControlsHandle;
192
+
113
193
  /**
114
194
  * createSelect — additive selection layer for vanilla polycss scenes.
115
195
  * Mirrors the React `<Select>` API: tracks one or more selected
@@ -217,4 +297,4 @@ declare function createTransformControls(scene: PolySceneHandle, options?: PolyT
217
297
 
218
298
  declare function injectPolyBaseStyles(doc?: Document): void;
219
299
 
220
- export { type PolyControlsAnimateOptions, type PolyControlsBaseOptions, type PolyControlsCamera, type PolyControlsChangeEvent, type PolyControlsEvent, type PolyControlsHandle, type PolyControlsInteractionEvent, type PolyControlsListener, type PolyMapControlsHandle, type PolyMapControlsOptions, PolyMeshHandle, type PolyOrbitControlsHandle, type PolyOrbitControlsOptions, PolySceneHandle, type PolySelectOptions, type PolySelectionHandle, type PolyTransformControlsHandle, type PolyTransformControlsObjectChangeEvent, type PolyTransformControlsOptions, createPolyMapControls, createPolyOrbitControls, createSelect, createTransformControls, injectPolyBaseStyles };
300
+ export { type PolyControlsAnimateOptions, type PolyControlsBaseOptions, type PolyControlsCamera, type PolyControlsChangeEvent, type PolyControlsEvent, type PolyControlsHandle, type PolyControlsInteractionEvent, type PolyControlsListener, type PolyFirstPersonControlsHandle, type PolyFirstPersonControlsOptions, type PolyMapControlsHandle, type PolyMapControlsOptions, PolyMeshHandle, type PolyOrbitControlsHandle, type PolyOrbitControlsOptions, PolySceneHandle, type PolySelectOptions, type PolySelectionHandle, type PolyTransformControlsHandle, type PolyTransformControlsObjectChangeEvent, type PolyTransformControlsOptions, createPolyFirstPersonControls, createPolyMapControls, createPolyOrbitControls, createSelect, createTransformControls, injectPolyBaseStyles };