softbox 4.3.2 → 4.4.1

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
@@ -2,6 +2,7 @@ import { default as default_2 } from 'react';
2
2
  import * as React_2 from 'react';
3
3
  import * as THREE from 'three';
4
4
 
5
+ /** Uniform fill from every direction; lifts shadows, adds no shading. */
5
6
  export declare interface AmbientLightOptions {
6
7
  color?: string | number;
7
8
  intensity?: number;
@@ -21,12 +22,25 @@ export declare interface AxesHelperOptions {
21
22
  size?: number;
22
23
  }
23
24
 
25
+ /** Perspective camera setup. World units are meters (see `units`). */
24
26
  export declare interface CameraOptions {
27
+ /** Starting camera position as `[x, y, z]`. */
25
28
  position?: [number, number, number];
29
+ /** Point the camera looks at and the controls orbit around. */
26
30
  target?: [number, number, number];
31
+ /** Vertical field of view in degrees. */
27
32
  fov?: number;
33
+ /** Near clipping plane distance. */
28
34
  near?: number;
35
+ /** Far clipping plane distance. */
29
36
  far?: number;
37
+ /**
38
+ * Frame the loaded model automatically (default `true`): the camera moves
39
+ * to a standard product-shot view — left-front, slightly elevated — around
40
+ * the model's center, at a distance computed from its bounds, and the
41
+ * controls re-target the center. This OVERRIDES `position`/`target`;
42
+ * disable it to keep your configured view exactly.
43
+ */
30
44
  autoFitToObject?: boolean;
31
45
  }
32
46
 
@@ -63,19 +77,40 @@ export declare type ControlsInstance = {
63
77
  getThreeControls?(): unknown;
64
78
  };
65
79
 
80
+ /** Mouse/touch camera controls (three.js OrbitControls semantics). */
66
81
  export declare interface ControlsOptions {
82
+ /**
83
+ * `OrbitControls` (default) orbits around the model like a turntable;
84
+ * `MapControls` pans on drag instead — the map/floor-plan idiom.
85
+ */
67
86
  type?: ControlType;
87
+ /** Master switch: `false` freezes all user camera input. */
68
88
  enabled?: boolean;
89
+ /** Inertial easing after a drag ends, instead of an instant stop. */
69
90
  enableDamping?: boolean;
91
+ /** Damping strength: lower = longer glide (softbox default 0.25). */
70
92
  dampingFactor?: number;
93
+ /** Allow dolly/zoom (wheel, pinch). */
71
94
  enableZoom?: boolean;
95
+ /** Allow orbiting (primary-button drag). */
72
96
  enableRotate?: boolean;
97
+ /** Allow panning (secondary-button or two-finger drag). */
73
98
  enablePan?: boolean;
99
+ /**
100
+ * Turntable mode: the camera orbits the model on its own. Runtime-tunable
101
+ * via `updateOptions`. While spinning, a path-traced `captureStill()`
102
+ * rejects — the accumulation resets every frame and can never converge.
103
+ */
74
104
  autoRotate?: boolean;
105
+ /** Turntable speed: 2.0 ≈ one full orbit in 30 s at 60 fps. */
75
106
  autoRotateSpeed?: number;
107
+ /** Closest dolly distance to the target. */
76
108
  minDistance?: number;
109
+ /** Farthest dolly distance from the target. */
77
110
  maxDistance?: number;
111
+ /** Lowest vertical orbit angle in radians (0 = looking straight down from above). */
78
112
  minPolarAngle?: number;
113
+ /** Highest vertical orbit angle in radians (π = from below; π/2 stops at the horizon). */
79
114
  maxPolarAngle?: number;
80
115
  }
81
116
 
@@ -89,16 +124,29 @@ export declare enum ControlType {
89
124
  */
90
125
  export declare const defaultOptions: SimpleViewerOptions;
91
126
 
127
+ /**
128
+ * The key light: parallel rays from `position` toward the origin. The only
129
+ * light that casts shadows — the contact-shadow bake samples it as an area
130
+ * light, so its direction sets where the floor shadow falls.
131
+ */
92
132
  export declare interface DirectionalLightOptions {
93
133
  color?: string | number;
94
134
  intensity?: number;
135
+ /** Direction is position → origin; distance does not attenuate. */
95
136
  position?: Vec3Like | [number, number, number];
137
+ /** Cast real-time shadows (and feed the baked contact shadow). */
96
138
  castShadow?: boolean;
139
+ /** three.js DirectionalLight.shadow tuning; the shadow camera is auto-fitted to the model on load. */
97
140
  shadow?: {
141
+ /** Shadow map resolution — higher is crisper and costs GPU memory. */
98
142
  mapSize?: {
99
143
  width: number;
100
144
  height: number;
101
145
  };
146
+ /**
147
+ * Orthographic frustum: left/right/top/bottom are overridden by the
148
+ * auto-fit on load; near/far keep their configured values.
149
+ */
102
150
  camera?: {
103
151
  near?: number;
104
152
  far?: number;
@@ -107,15 +155,32 @@ export declare interface DirectionalLightOptions {
107
155
  top?: number;
108
156
  bottom?: number;
109
157
  };
158
+ /** Depth offset against shadow acne (self-shadowing stripes). */
110
159
  bias?: number;
160
+ /** Shadow edge blur in shadow-map texels. */
111
161
  radius?: number;
112
162
  };
113
163
  }
114
164
 
165
+ /**
166
+ * Image-based lighting and background. Without a `url` the viewer lights the
167
+ * scene with its built-in procedural studio environment — zero network
168
+ * requests.
169
+ */
115
170
  export declare interface EnvironmentOptions {
171
+ /**
172
+ * Equirectangular environment map (`.hdr`, `.exr`, or an LDR image) used
173
+ * for both lighting and the background.
174
+ */
116
175
  url?: string;
176
+ /** Blurs the background rendering only (0–1); lighting stays sharp. */
117
177
  backgroundBlurriness?: number;
178
+ /** Brightness multiplier for the background rendering only. */
118
179
  backgroundIntensity?: number;
180
+ /**
181
+ * Lighting intensity multiplier the environment applies to materials.
182
+ * Runtime-tunable via `updateOptions` — presets drive this live.
183
+ */
119
184
  environmentIntensity?: number;
120
185
  }
121
186
 
@@ -185,8 +250,15 @@ export declare interface HelperOptions {
185
250
  darkStudioMode?: boolean;
186
251
  }
187
252
 
253
+ /**
254
+ * Two-tone gradient fill: one color arriving from above, another bouncing up
255
+ * from below. The default rig uses a warm pale-yellow sky over a dark navy
256
+ * ground.
257
+ */
188
258
  export declare interface HemisphereLightOptions {
259
+ /** Color arriving from above. */
189
260
  skyColor?: string | number;
261
+ /** Color bouncing up from below. */
190
262
  groundColor?: string | number;
191
263
  intensity?: number;
192
264
  }
@@ -213,6 +285,10 @@ export declare interface HotspotProps {
213
285
  children?: default_2.ReactNode;
214
286
  }
215
287
 
288
+ /**
289
+ * The three-light studio rig. Every light is optional; the defaults are a
290
+ * balanced product-shot setup (see `defaultOptions.lighting`).
291
+ */
216
292
  export declare interface LightingOptions {
217
293
  ambientLight?: AmbientLightOptions;
218
294
  hemisphereLight?: HemisphereLightOptions;
@@ -278,13 +354,32 @@ export declare interface LoadingIndicatorOptions {
278
354
  /** Length unit the model's geometry is authored in. */
279
355
  export declare type ModelUnits = 'meters' | 'centimeters' | 'millimeters' | 'feet' | 'inches';
280
356
 
357
+ /**
358
+ * Progressive path tracing for photoreal stills (three-gpu-pathtracer). The
359
+ * tracer accumulates samples whenever the camera rests and presents the
360
+ * converged frame; it ships in a lazy chunk that loads only when enabled.
361
+ *
362
+ * The whole object is structural in `<SimpleViewer>`: changing ANY field
363
+ * rebuilds the viewer (and reloads the model).
364
+ */
281
365
  export declare interface PathTracingOptions {
366
+ /** Builds the tracer at viewer construction. */
282
367
  enabled?: boolean;
368
+ /**
369
+ * Samples to accumulate before the frame counts as converged
370
+ * (`pathtracing:complete`, and what a path-traced `captureStill()` awaits).
371
+ * More samples = cleaner image, linearly more GPU time.
372
+ */
283
373
  maxSamples?: number;
374
+ /** Light-path depth: how many surface bounces each ray may take. */
284
375
  bounces?: number;
376
+ /** Extra ray depth through transmissive (glass-like) materials. */
285
377
  transmissiveBounces?: number;
378
+ /** Accumulation resolution as a fraction of canvas size (0.5 = quarter pixels, 4× faster). */
286
379
  renderScale?: number;
380
+ /** Resolution fraction of the fast preview shown while the camera moves. */
287
381
  lowResScale?: number;
382
+ /** Drop to the low-res preview during interaction instead of stalling. */
288
383
  dynamicLowRes?: boolean;
289
384
  }
290
385
 
@@ -435,6 +530,15 @@ export declare interface SimpleViewerOptions {
435
530
  */
436
531
  animationLoop?: ((time: number) => void) | null;
437
532
  replaceWithScreenshotOnComplete?: boolean;
533
+ /**
534
+ * When to boot the WebGL engine and fetch the model (default `'eager'`).
535
+ * `'lazy'` defers everything until the viewer first approaches the
536
+ * viewport (like `<img loading="lazy">`) — on pages with many viewers
537
+ * only the visible ones pay for a GL context and a model download. Once
538
+ * booted a viewer stays booted; where IntersectionObserver is unavailable
539
+ * the option gracefully degrades to eager.
540
+ */
541
+ loading?: 'eager' | 'lazy';
438
542
  /**
439
543
  * Built-in loading overlay shown while a model loads. `true`/omitted shows the
440
544
  * default spinner; `false` hides it (render your own via the loading events);
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import { default as default_2 } from 'react';
2
2
  import * as React_2 from 'react';
3
3
  import * as THREE from 'three';
4
4
 
5
+ /** Uniform fill from every direction; lifts shadows, adds no shading. */
5
6
  export declare interface AmbientLightOptions {
6
7
  color?: string | number;
7
8
  intensity?: number;
@@ -21,12 +22,25 @@ export declare interface AxesHelperOptions {
21
22
  size?: number;
22
23
  }
23
24
 
25
+ /** Perspective camera setup. World units are meters (see `units`). */
24
26
  export declare interface CameraOptions {
27
+ /** Starting camera position as `[x, y, z]`. */
25
28
  position?: [number, number, number];
29
+ /** Point the camera looks at and the controls orbit around. */
26
30
  target?: [number, number, number];
31
+ /** Vertical field of view in degrees. */
27
32
  fov?: number;
33
+ /** Near clipping plane distance. */
28
34
  near?: number;
35
+ /** Far clipping plane distance. */
29
36
  far?: number;
37
+ /**
38
+ * Frame the loaded model automatically (default `true`): the camera moves
39
+ * to a standard product-shot view — left-front, slightly elevated — around
40
+ * the model's center, at a distance computed from its bounds, and the
41
+ * controls re-target the center. This OVERRIDES `position`/`target`;
42
+ * disable it to keep your configured view exactly.
43
+ */
30
44
  autoFitToObject?: boolean;
31
45
  }
32
46
 
@@ -63,19 +77,40 @@ export declare type ControlsInstance = {
63
77
  getThreeControls?(): unknown;
64
78
  };
65
79
 
80
+ /** Mouse/touch camera controls (three.js OrbitControls semantics). */
66
81
  export declare interface ControlsOptions {
82
+ /**
83
+ * `OrbitControls` (default) orbits around the model like a turntable;
84
+ * `MapControls` pans on drag instead — the map/floor-plan idiom.
85
+ */
67
86
  type?: ControlType;
87
+ /** Master switch: `false` freezes all user camera input. */
68
88
  enabled?: boolean;
89
+ /** Inertial easing after a drag ends, instead of an instant stop. */
69
90
  enableDamping?: boolean;
91
+ /** Damping strength: lower = longer glide (softbox default 0.25). */
70
92
  dampingFactor?: number;
93
+ /** Allow dolly/zoom (wheel, pinch). */
71
94
  enableZoom?: boolean;
95
+ /** Allow orbiting (primary-button drag). */
72
96
  enableRotate?: boolean;
97
+ /** Allow panning (secondary-button or two-finger drag). */
73
98
  enablePan?: boolean;
99
+ /**
100
+ * Turntable mode: the camera orbits the model on its own. Runtime-tunable
101
+ * via `updateOptions`. While spinning, a path-traced `captureStill()`
102
+ * rejects — the accumulation resets every frame and can never converge.
103
+ */
74
104
  autoRotate?: boolean;
105
+ /** Turntable speed: 2.0 ≈ one full orbit in 30 s at 60 fps. */
75
106
  autoRotateSpeed?: number;
107
+ /** Closest dolly distance to the target. */
76
108
  minDistance?: number;
109
+ /** Farthest dolly distance from the target. */
77
110
  maxDistance?: number;
111
+ /** Lowest vertical orbit angle in radians (0 = looking straight down from above). */
78
112
  minPolarAngle?: number;
113
+ /** Highest vertical orbit angle in radians (π = from below; π/2 stops at the horizon). */
79
114
  maxPolarAngle?: number;
80
115
  }
81
116
 
@@ -89,16 +124,29 @@ export declare enum ControlType {
89
124
  */
90
125
  export declare const defaultOptions: SimpleViewerOptions;
91
126
 
127
+ /**
128
+ * The key light: parallel rays from `position` toward the origin. The only
129
+ * light that casts shadows — the contact-shadow bake samples it as an area
130
+ * light, so its direction sets where the floor shadow falls.
131
+ */
92
132
  export declare interface DirectionalLightOptions {
93
133
  color?: string | number;
94
134
  intensity?: number;
135
+ /** Direction is position → origin; distance does not attenuate. */
95
136
  position?: Vec3Like | [number, number, number];
137
+ /** Cast real-time shadows (and feed the baked contact shadow). */
96
138
  castShadow?: boolean;
139
+ /** three.js DirectionalLight.shadow tuning; the shadow camera is auto-fitted to the model on load. */
97
140
  shadow?: {
141
+ /** Shadow map resolution — higher is crisper and costs GPU memory. */
98
142
  mapSize?: {
99
143
  width: number;
100
144
  height: number;
101
145
  };
146
+ /**
147
+ * Orthographic frustum: left/right/top/bottom are overridden by the
148
+ * auto-fit on load; near/far keep their configured values.
149
+ */
102
150
  camera?: {
103
151
  near?: number;
104
152
  far?: number;
@@ -107,15 +155,32 @@ export declare interface DirectionalLightOptions {
107
155
  top?: number;
108
156
  bottom?: number;
109
157
  };
158
+ /** Depth offset against shadow acne (self-shadowing stripes). */
110
159
  bias?: number;
160
+ /** Shadow edge blur in shadow-map texels. */
111
161
  radius?: number;
112
162
  };
113
163
  }
114
164
 
165
+ /**
166
+ * Image-based lighting and background. Without a `url` the viewer lights the
167
+ * scene with its built-in procedural studio environment — zero network
168
+ * requests.
169
+ */
115
170
  export declare interface EnvironmentOptions {
171
+ /**
172
+ * Equirectangular environment map (`.hdr`, `.exr`, or an LDR image) used
173
+ * for both lighting and the background.
174
+ */
116
175
  url?: string;
176
+ /** Blurs the background rendering only (0–1); lighting stays sharp. */
117
177
  backgroundBlurriness?: number;
178
+ /** Brightness multiplier for the background rendering only. */
118
179
  backgroundIntensity?: number;
180
+ /**
181
+ * Lighting intensity multiplier the environment applies to materials.
182
+ * Runtime-tunable via `updateOptions` — presets drive this live.
183
+ */
119
184
  environmentIntensity?: number;
120
185
  }
121
186
 
@@ -185,8 +250,15 @@ export declare interface HelperOptions {
185
250
  darkStudioMode?: boolean;
186
251
  }
187
252
 
253
+ /**
254
+ * Two-tone gradient fill: one color arriving from above, another bouncing up
255
+ * from below. The default rig uses a warm pale-yellow sky over a dark navy
256
+ * ground.
257
+ */
188
258
  export declare interface HemisphereLightOptions {
259
+ /** Color arriving from above. */
189
260
  skyColor?: string | number;
261
+ /** Color bouncing up from below. */
190
262
  groundColor?: string | number;
191
263
  intensity?: number;
192
264
  }
@@ -213,6 +285,10 @@ export declare interface HotspotProps {
213
285
  children?: default_2.ReactNode;
214
286
  }
215
287
 
288
+ /**
289
+ * The three-light studio rig. Every light is optional; the defaults are a
290
+ * balanced product-shot setup (see `defaultOptions.lighting`).
291
+ */
216
292
  export declare interface LightingOptions {
217
293
  ambientLight?: AmbientLightOptions;
218
294
  hemisphereLight?: HemisphereLightOptions;
@@ -278,13 +354,32 @@ export declare interface LoadingIndicatorOptions {
278
354
  /** Length unit the model's geometry is authored in. */
279
355
  export declare type ModelUnits = 'meters' | 'centimeters' | 'millimeters' | 'feet' | 'inches';
280
356
 
357
+ /**
358
+ * Progressive path tracing for photoreal stills (three-gpu-pathtracer). The
359
+ * tracer accumulates samples whenever the camera rests and presents the
360
+ * converged frame; it ships in a lazy chunk that loads only when enabled.
361
+ *
362
+ * The whole object is structural in `<SimpleViewer>`: changing ANY field
363
+ * rebuilds the viewer (and reloads the model).
364
+ */
281
365
  export declare interface PathTracingOptions {
366
+ /** Builds the tracer at viewer construction. */
282
367
  enabled?: boolean;
368
+ /**
369
+ * Samples to accumulate before the frame counts as converged
370
+ * (`pathtracing:complete`, and what a path-traced `captureStill()` awaits).
371
+ * More samples = cleaner image, linearly more GPU time.
372
+ */
283
373
  maxSamples?: number;
374
+ /** Light-path depth: how many surface bounces each ray may take. */
284
375
  bounces?: number;
376
+ /** Extra ray depth through transmissive (glass-like) materials. */
285
377
  transmissiveBounces?: number;
378
+ /** Accumulation resolution as a fraction of canvas size (0.5 = quarter pixels, 4× faster). */
286
379
  renderScale?: number;
380
+ /** Resolution fraction of the fast preview shown while the camera moves. */
287
381
  lowResScale?: number;
382
+ /** Drop to the low-res preview during interaction instead of stalling. */
288
383
  dynamicLowRes?: boolean;
289
384
  }
290
385
 
@@ -435,6 +530,15 @@ export declare interface SimpleViewerOptions {
435
530
  */
436
531
  animationLoop?: ((time: number) => void) | null;
437
532
  replaceWithScreenshotOnComplete?: boolean;
533
+ /**
534
+ * When to boot the WebGL engine and fetch the model (default `'eager'`).
535
+ * `'lazy'` defers everything until the viewer first approaches the
536
+ * viewport (like `<img loading="lazy">`) — on pages with many viewers
537
+ * only the visible ones pay for a GL context and a model download. Once
538
+ * booted a viewer stays booted; where IntersectionObserver is unavailable
539
+ * the option gracefully degrades to eager.
540
+ */
541
+ loading?: 'eager' | 'lazy';
438
542
  /**
439
543
  * Built-in loading overlay shown while a model loads. `true`/omitted shows the
440
544
  * default spinner; `false` hides it (render your own via the loading events);
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-QkQEREfW.cjs");exports.ControlType=e.ControlType;exports.ErrorCode=e.ErrorCode;exports.Hotspot=e.Hotspot;exports.SimpleViewer=e.SimpleViewerWrapper;exports.ThreeViewerError=e.ThreeViewerError;exports.TypedEventEmitter=e.TypedEventEmitter;exports.VIEWER_PRESETS=e.VIEWER_PRESETS;exports.defaultOptions=e.defaultOptions;exports.resolvePreset=e.resolvePreset;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BiSXFVUP.cjs");exports.ControlType=e.ControlType;exports.ErrorCode=e.ErrorCode;exports.Hotspot=e.Hotspot;exports.SimpleViewer=e.SimpleViewerWrapper;exports.ThreeViewerError=e.ThreeViewerError;exports.TypedEventEmitter=e.TypedEventEmitter;exports.VIEWER_PRESETS=e.VIEWER_PRESETS;exports.defaultOptions=e.defaultOptions;exports.resolvePreset=e.resolvePreset;
@@ -1,4 +1,4 @@
1
- import { f as s, E as o, H as a, i as t, e as E, T as i, V as p, j as T, r as l } from "./index-BdrQXlCy.js";
1
+ import { f as s, E as o, H as a, i as t, e as E, T as i, V as p, j as T, r as l } from "./index-uh2exMyt.js";
2
2
  export {
3
3
  s as ControlType,
4
4
  o as ErrorCode,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "softbox",
3
3
  "private": false,
4
- "version": "4.3.2",
4
+ "version": "4.4.1",
5
5
  "homepage": "https://leming.github.io/softbox/",
6
6
  "type": "module",
7
7
  "description": "Batteries-included React 3D viewer — any GLB looks studio-shot in one line",