three-live 1.2.0 → 1.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.
Files changed (44) hide show
  1. package/README.md +6 -1
  2. package/dist/index.d.ts +182 -6
  3. package/dist/three-author-engine.js +66 -41
  4. package/dist/three-author.cjs +63 -39
  5. package/dist/three-author.d.ts +182 -6
  6. package/dist/three-author.js +63 -39
  7. package/dist/three-convert.cjs +61 -37
  8. package/dist/three-convert.d.ts +182 -6
  9. package/dist/three-convert.js +61 -37
  10. package/dist/three-live-animation.cjs +7 -7
  11. package/dist/three-live-animation.d.ts +182 -6
  12. package/dist/three-live-animation.js +7 -7
  13. package/dist/three-live-animation.min.js +7 -7
  14. package/dist/three-live-cad.cjs +18 -0
  15. package/dist/{three-live-extras.d.ts → three-live-cad.d.ts} +182 -6
  16. package/dist/three-live-cad.js +18 -0
  17. package/dist/three-live-cad.min.js +18 -0
  18. package/dist/three-live-element.cjs +29 -5
  19. package/dist/three-live-element.d.ts +182 -6
  20. package/dist/three-live-element.js +29 -5
  21. package/dist/three-live-full.cjs +159 -56
  22. package/dist/three-live-full.js +159 -56
  23. package/dist/three-live-full.min.js +159 -56
  24. package/dist/three-live-studio.cjs +120 -0
  25. package/dist/three-live-studio.d.ts +509 -0
  26. package/dist/three-live-studio.js +120 -0
  27. package/dist/three-live-studio.min.js +120 -0
  28. package/dist/three-live-viewer.cjs +29 -5
  29. package/dist/three-live-viewer.d.ts +182 -6
  30. package/dist/three-live-viewer.js +29 -5
  31. package/dist/three-live-viewer.min.js +29 -5
  32. package/dist/three-live.cjs +66 -42
  33. package/dist/three-live.js +66 -42
  34. package/dist/three-live.min.js +66 -42
  35. package/dist/three-view.cjs +29 -5
  36. package/dist/three-view.d.ts +182 -6
  37. package/dist/three-view.js +29 -5
  38. package/dist/three-xr.cjs +65 -41
  39. package/dist/three-xr.d.ts +182 -6
  40. package/dist/three-xr.js +65 -41
  41. package/package.json +10 -5
  42. package/dist/three-live-extras.cjs +0 -42
  43. package/dist/three-live-extras.js +0 -42
  44. package/dist/three-live-extras.min.js +0 -42
@@ -30,12 +30,12 @@ import type {
30
30
  } from './three-live/src/three-view';
31
31
  import type {ARLaunchResult, ARMode} from './three-live/src/three-xr';
32
32
  import type {
33
+ Detection3D,
33
34
  DimensionUnit,
34
35
  ExplodeMode,
35
36
  RemotePeerState,
36
37
  SnapSurfaceMode,
37
38
  TranscriptEvent,
38
- Detection3D,
39
39
  } from './xr-live/src/plugins/index';
40
40
  import type {
41
41
  XRAnchorElement,
@@ -48,6 +48,29 @@ import type {
48
48
  } from './xr-live/src/xr-live-element';
49
49
 
50
50
  export * from './three-live/src/core';
51
+ export {
52
+ cadPlugin,
53
+ installCadExtension,
54
+ MAX_BSP_DEPTH,
55
+ MAX_CSG_TRIANGLES,
56
+ MAX_TEXT_GEOMETRY_CHARS,
57
+ type ExtrudeGeometryOptions,
58
+ type TextGeometryOptions,
59
+ } from './three-live/src/plugins/cad';
60
+ export {
61
+ ikPlugin,
62
+ IKSolver,
63
+ quatFromUnitVectors,
64
+ solveFABRIK,
65
+ solveTwoBoneIK,
66
+ type FABRIKSolution,
67
+ type IKQuat,
68
+ type TwoBoneIKSolution,
69
+ } from './three-live/src/plugins/ik';
70
+ export {
71
+ extractNodeInstancing,
72
+ instancingPlugin,
73
+ } from './three-live/src/plugins/instancing';
51
74
  export {
52
75
  getInteractivityVM,
53
76
  interactivityPlugin,
@@ -63,6 +86,30 @@ export {
63
86
  type InteractivityValueSocket,
64
87
  type InteractivityVariableDef,
65
88
  } from './three-live/src/plugins/interactivity';
89
+ export {
90
+ applyMeshoptFilter,
91
+ decodeMeshoptBuffer,
92
+ decodeMeshoptGLB,
93
+ encodeMeshoptBuffer,
94
+ meshoptDecoder,
95
+ meshoptPlugin,
96
+ type MeshoptFilter,
97
+ type MeshoptMode,
98
+ } from './three-live/src/plugins/meshopt';
99
+ export {
100
+ computeOutlineClipOffset,
101
+ evaluateKawaseBloom,
102
+ parseHexRgb,
103
+ postprocessingPlugin,
104
+ resolveViewerBloom,
105
+ } from './three-live/src/plugins/postprocessing';
106
+ export {
107
+ extractMaterialVariants,
108
+ extractPrimitiveVariantMappings,
109
+ selectMaterialVariant,
110
+ variantsPlugin,
111
+ type VariantMapping,
112
+ } from './three-live/src/plugins/variants';
66
113
  export {
67
114
  ThreeLiveElement,
68
115
  type ARLaunchOptions,
@@ -80,7 +127,7 @@ export {
80
127
  type XRProfile,
81
128
  type XRSimulatorRoom,
82
129
  } from './xr-live/src/xr-live-element';
83
- /** Optional spatial plugins (`xr-live/plugins`, `xr-live-plugins.min.js`). */
130
+ /** Optional spatial plugins (`xr-live/spatial`, `xr-live-spatial.min.js`). */
84
131
  export * from './xr-live/src/plugins/index';
85
132
 
86
133
  /**
@@ -119,7 +166,7 @@ export interface ThreeLiveAttributes {
119
166
  'shadow-intensity'?: number | string;
120
167
  /** Radial Gaussian blur falloff of contact shadow (0.0 to 1.0). */
121
168
  'shadow-softness'?: number | string;
122
- /** Tone mapping mode ("neutral", "reinhard", "none"). */
169
+ /** Tone mapping mode ("neutral", "aces", "agx", "reinhard", "none"). */
123
170
  'tone-mapping'?: string;
124
171
  /** Enable or disable interactive camera orbit/pan/zoom controls (default: true). */
125
172
  'camera-controls'?: boolean | string;
@@ -127,6 +174,8 @@ export interface ThreeLiveAttributes {
127
174
  'autoplay'?: boolean | string;
128
175
  /** Name of specific glTF animation clip to play. */
129
176
  'animation-name'?: string;
177
+ /** Name of the active KHR_materials_variants material variant. */
178
+ 'variant-name'?: string;
130
179
  /** Automatically rotate scene around the Y-axis when user is idle. */
131
180
  'auto-rotate'?: boolean | string;
132
181
  /** Delay in milliseconds before auto-rotation resumes after user interaction (default: 3000). */
@@ -162,6 +211,7 @@ export interface ThreeLiveAttributes {
162
211
  onerror?: (e: CustomEvent<{error: any}>) => void;
163
212
  onmeshclick?: (e: CustomEvent<HitDetail>) => void;
164
213
  'oncamera-change'?: (e: CustomEvent<CameraDetail>) => void;
214
+ 'onvariant-applied'?: (e: CustomEvent<{variantName: string | null}>) => void;
165
215
  'onar-status'?: (
166
216
  e: CustomEvent<{
167
217
  status: 'session-started' | 'not-presenting' | 'failed';
@@ -193,7 +243,7 @@ export interface XRLiveAttributes extends ThreeLiveAttributes {
193
243
  'xr-depth'?: XRDepthMode;
194
244
  /** 25-joint hand tracking and gesture recognition mode ("gestures", "joints", "pinch", "none"). */
195
245
  'xr-hands'?: XRHandsMode;
196
- /** Desktop room simulator environment ("living-room", "office", "tabletop", "none"). */
246
+ /** Desktop 3D room preview environment, unrelated to `xr-live-sim` ("living-room", "office", "tabletop", "none"). */
197
247
  'xr-simulator'?: XRSimulatorRoom;
198
248
  /** Spatial UI profile ("quest3", "android-xr", "visionos", "auto"). */
199
249
  'xr-profile'?: XRProfile;
@@ -208,7 +258,14 @@ export interface XRLiveAttributes extends ThreeLiveAttributes {
208
258
  /** Default display unit for `spatial-measure` ("auto", "m", "cm", "mm", "in", "ft-in"). */
209
259
  'measure-unit'?: DimensionUnit;
210
260
  /** Spatial plugin: socket, grid, surface, and angle snapping ("grid", "surface", "sockets", "all", "none"). */
211
- 'magnetic-snap'?: boolean | 'grid' | 'surface' | 'sockets' | 'all' | 'none' | string;
261
+ 'magnetic-snap'?:
262
+ | boolean
263
+ | 'grid'
264
+ | 'surface'
265
+ | 'sockets'
266
+ | 'all'
267
+ | 'none'
268
+ | string;
212
269
  /** Cartesian snap grid step in meters ("0.05" or "0.05 0.05 0.05"). */
213
270
  'snap-grid'?: number | string;
214
271
  /** Rotational yaw snap increment in degrees (0 to 180). */
@@ -241,6 +298,47 @@ export interface XRLiveAttributes extends ThreeLiveAttributes {
241
298
  'peer-name'?: string;
242
299
  /** Local avatar visor & laser color (`#rrggbb`) in `shared-room`. */
243
300
  'peer-color'?: string;
301
+ /** Opt-in WebRTC spatial voice chat signaling and HRTF distance attenuation in `shared-room`. */
302
+ 'shared-room-voice'?: boolean | string;
303
+ /** xr-live-sim: character camera mode, or `none` to disable the character. */
304
+ 'character-controller'?:
305
+ | 'third-person'
306
+ | 'first-person'
307
+ | 'top-down'
308
+ | 'fixed-camera'
309
+ | 'none';
310
+ /** xr-live-sim: character speed override (m/s). */
311
+ 'character-speed'?: number | string;
312
+ /** xr-live-sim: character jump velocity override (m/s). */
313
+ 'character-jump'?: number | string;
314
+ /** xr-live-sim: on-screen joystick (`auto` shows it on touch screens). */
315
+ 'touch-joystick'?: 'auto' | 'always' | 'none';
316
+ /** xr-live-sim: `false` or `none` pauses steering agents. */
317
+ 'steering-agents'?: boolean | string;
318
+ /** xr-live-sim: firing mode (empty means `projectile`). */
319
+ 'hit-zones'?: '' | 'projectile' | 'hitscan' | 'contact' | 'off';
320
+ /** xr-live-sim: shots per second (default: 4). */
321
+ 'fire-rate'?: number | string;
322
+ /** xr-live-sim: projectile speed in m/s (default: 14). */
323
+ 'projectile-speed'?: number | string;
324
+ /** xr-live-sim: projectile gravity in m/s² (default: 0). */
325
+ 'projectile-gravity'?: number | string;
326
+ /** xr-live-sim: integrity removed per hit (default: 25). */
327
+ 'hit-amount'?: number | string;
328
+ /** xr-live-sim: enables objectives and scoring (`none` disables). */
329
+ 'objectives'?: boolean | string;
330
+ /** xr-live-sim: scenario countdown in seconds. */
331
+ 'scenario-timer'?: number | string;
332
+ /** xr-live-sim: score that passes the scenario. */
333
+ 'target-score'?: number | string;
334
+ /** xr-live-sim: attempts before the scenario fails. */
335
+ 'attempts'?: number | string;
336
+ /** xr-live-sim: score HUD style. */
337
+ 'sim-hud'?: 'auto' | 'minimal' | 'none';
338
+ /** xr-live-sim: plays procedural audio cues (`muted` disables). */
339
+ 'synth-audio'?: boolean | string;
340
+ /** xr-live-sim: cue volume from 0 to 1 (default: 0.7). */
341
+ 'synth-volume'?: number | string;
244
342
  /** Register WebMCP browser AI tools on `navigator.modelContext`. */
245
343
  'webmcp'?: boolean | string;
246
344
  /** Opt-in gate allowing WebMCP `capture_xr_view` to include the 8x8 depth grid. */
@@ -314,7 +412,85 @@ export interface XRLiveAttributes extends ThreeLiveAttributes {
314
412
  e: CustomEvent<Pick<RemotePeerState, 'peerId' | 'name' | 'color'>>,
315
413
  ) => void;
316
414
  onpeersync?: (e: CustomEvent<{peerId: string; nodeId: string}>) => void;
317
- onpeergrabconflict?: (e: CustomEvent<{peerId: string; nodeId: string}>) => void;
415
+ onpeergrabconflict?: (
416
+ e: CustomEvent<{peerId: string; nodeId: string}>,
417
+ ) => void;
418
+ onpeerrtcsignal?: (
419
+ e: CustomEvent<{
420
+ peerId: string;
421
+ targetPeerId: string;
422
+ signalType: 'offer' | 'answer' | 'ice';
423
+ sdp: string | null;
424
+ candidate: string | null;
425
+ sdpMid: string | null;
426
+ sdpMLineIndex: number | null;
427
+ }>,
428
+ ) => void;
429
+ /** xr-live-sim events. */
430
+ oncharacterjump?: (
431
+ e: CustomEvent<{nodeId: string; position: [number, number, number]}>,
432
+ ) => void;
433
+ oncharacterland?: (
434
+ e: CustomEvent<{nodeId: string; fallSpeed: number}>,
435
+ ) => void;
436
+ onagentstatechange?: (
437
+ e: CustomEvent<{nodeId: string; state: string; targetId: string | null}>,
438
+ ) => void;
439
+ onagentreach?: (
440
+ e: CustomEvent<{
441
+ agentId: string;
442
+ targetId: string;
443
+ position: [number, number, number];
444
+ }>,
445
+ ) => void;
446
+ onxrhit?: (
447
+ e: CustomEvent<{
448
+ targetId: string;
449
+ /** Shooter node name, or `'user'`. */
450
+ sourceId: string;
451
+ amount: number;
452
+ remaining: number;
453
+ point: [number, number, number];
454
+ }>,
455
+ ) => void;
456
+ onxrdepleted?: (
457
+ e: CustomEvent<{targetId: string; group: string; scoreValue: number}>,
458
+ ) => void;
459
+ onxrzoneenter?: (
460
+ e: CustomEvent<{zoneId: string; nodeId: string; group: string}>,
461
+ ) => void;
462
+ onxrzoneexit?: (
463
+ e: CustomEvent<{zoneId: string; nodeId: string; group: string}>,
464
+ ) => void;
465
+ onxrspawn?: (
466
+ e: CustomEvent<{spawnerId: string; instanceId: string; index: number}>,
467
+ ) => void;
468
+ onxrobjective?: (
469
+ e: CustomEvent<{
470
+ nodeId: string;
471
+ tag: string;
472
+ type: string;
473
+ amount: number;
474
+ totalScore: number;
475
+ remainingRequired: number;
476
+ outOfOrder: boolean;
477
+ }>,
478
+ ) => void;
479
+ onxrscorechange?: (
480
+ e: CustomEvent<{
481
+ score: number;
482
+ delta: number;
483
+ attemptsLeft: number | null;
484
+ timeRemaining: number | null;
485
+ }>,
486
+ ) => void;
487
+ onxrscenarioend?: (
488
+ e: CustomEvent<{
489
+ outcome: 'pass' | 'fail' | 'timeout';
490
+ finalScore: number;
491
+ elapsedSec: number;
492
+ }>,
493
+ ) => void;
318
494
  }
319
495
 
320
496
  declare global {