super-three 0.184.0 → 0.185.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.
Files changed (366) hide show
  1. package/build/three.cjs +1260 -927
  2. package/build/three.core.js +1104 -829
  3. package/build/three.core.min.js +1 -1
  4. package/build/three.module.js +156 -98
  5. package/build/three.module.min.js +1 -1
  6. package/build/three.tsl.js +11 -4
  7. package/build/three.tsl.min.js +1 -1
  8. package/build/three.webgpu.js +7538 -3367
  9. package/build/three.webgpu.min.js +1 -1
  10. package/build/three.webgpu.nodes.js +7538 -3366
  11. package/build/three.webgpu.nodes.min.js +1 -1
  12. package/examples/jsm/Addons.js +3 -0
  13. package/examples/jsm/controls/ArcballControls.js +6 -2
  14. package/examples/jsm/controls/FirstPersonControls.js +79 -42
  15. package/examples/jsm/controls/TransformControls.js +68 -15
  16. package/examples/jsm/csm/CSMFrustum.js +31 -6
  17. package/examples/jsm/csm/CSMShadowNode.js +4 -1
  18. package/examples/jsm/effects/AsciiEffect.js +14 -1
  19. package/examples/jsm/exporters/DRACOExporter.js +27 -6
  20. package/examples/jsm/exporters/GLTFExporter.js +114 -12
  21. package/examples/jsm/exporters/PLYExporter.js +286 -73
  22. package/examples/jsm/exporters/USDZExporter.js +347 -112
  23. package/examples/jsm/generators/CityGenerator.js +346 -0
  24. package/examples/jsm/generators/ForestGenerator.js +347 -0
  25. package/examples/jsm/generators/TerrainGenerator.js +504 -0
  26. package/examples/jsm/generators/TreeGenerator.js +377 -0
  27. package/examples/jsm/generators/city/SidewalkGenerator.js +253 -0
  28. package/examples/jsm/generators/city/SkyscraperGenerator.js +1357 -0
  29. package/examples/jsm/geometries/LoftGeometry.js +355 -0
  30. package/examples/jsm/helpers/LightProbeGridHelper.js +1 -1
  31. package/examples/jsm/helpers/LightProbeHelper.js +5 -4
  32. package/examples/jsm/helpers/ViewHelper.js +16 -6
  33. package/examples/jsm/inspector/Inspector.js +53 -15
  34. package/examples/jsm/inspector/RendererInspector.js +152 -36
  35. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +1 -1
  36. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +1 -1
  37. package/examples/jsm/inspector/tabs/Console.js +200 -18
  38. package/examples/jsm/inspector/tabs/Memory.js +8 -0
  39. package/examples/jsm/inspector/tabs/Parameters.js +64 -4
  40. package/examples/jsm/inspector/tabs/Performance.js +21 -6
  41. package/examples/jsm/inspector/tabs/Settings.js +51 -9
  42. package/examples/jsm/inspector/tabs/Timeline.js +178 -93
  43. package/examples/jsm/inspector/tabs/Viewer.js +628 -16
  44. package/examples/jsm/inspector/ui/Graph.js +162 -25
  45. package/examples/jsm/inspector/ui/Item.js +92 -13
  46. package/examples/jsm/inspector/ui/List.js +1 -1
  47. package/examples/jsm/inspector/ui/Profiler.js +90 -45
  48. package/examples/jsm/inspector/ui/Style.js +1788 -1401
  49. package/examples/jsm/inspector/ui/Tab.js +5 -3
  50. package/examples/jsm/inspector/ui/Values.js +71 -6
  51. package/examples/jsm/inspector/ui/utils.js +130 -10
  52. package/examples/jsm/libs/basis/README.md +0 -1
  53. package/examples/jsm/libs/demuxer_mp4.js +3 -3
  54. package/examples/jsm/libs/draco/README.md +0 -1
  55. package/examples/jsm/libs/meshopt_clusterizer.module.js +421 -0
  56. package/examples/jsm/libs/meshopt_simplifier.module.js +627 -0
  57. package/examples/jsm/libs/mikktspace.module.js +34 -9
  58. package/examples/jsm/lighting/ClusteredLighting.js +55 -0
  59. package/examples/jsm/lighting/LightProbeGrid.js +106 -76
  60. package/examples/jsm/lines/LineMaterial.js +38 -15
  61. package/examples/jsm/lines/LineSegments2.js +8 -0
  62. package/examples/jsm/lines/webgpu/LineSegments2.js +8 -0
  63. package/examples/jsm/loaders/3DMLoader.js +1 -1
  64. package/examples/jsm/loaders/DRACOLoader.js +46 -13
  65. package/examples/jsm/loaders/EXRLoader.js +27 -55
  66. package/examples/jsm/loaders/HDRLoader.js +6 -28
  67. package/examples/jsm/loaders/KTX2Loader.js +31 -12
  68. package/examples/jsm/loaders/LDrawLoader.js +8 -8
  69. package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
  70. package/examples/jsm/loaders/LUTCubeLoader.js +2 -2
  71. package/examples/jsm/loaders/LWOLoader.js +4 -0
  72. package/examples/jsm/loaders/LottieLoader.js +1 -1
  73. package/examples/jsm/loaders/MaterialXLoader.js +31 -9
  74. package/examples/jsm/loaders/NRRDLoader.js +3 -3
  75. package/examples/jsm/loaders/PCDLoader.js +7 -7
  76. package/examples/jsm/loaders/PLYLoader.js +218 -55
  77. package/examples/jsm/loaders/SVGLoader.js +547 -495
  78. package/examples/jsm/loaders/TTFLoader.js +1 -1
  79. package/examples/jsm/loaders/USDLoader.js +33 -9
  80. package/examples/jsm/loaders/VRMLLoader.js +1 -1
  81. package/examples/jsm/loaders/usd/USDAParser.js +93 -20
  82. package/examples/jsm/loaders/usd/USDCParser.js +1 -1
  83. package/examples/jsm/loaders/usd/USDComposer.js +52 -19
  84. package/examples/jsm/misc/TileCreasedNormalsPlugin.js +270 -0
  85. package/examples/jsm/misc/Volume.js +2 -2
  86. package/examples/jsm/objects/GroundedSkybox.js +1 -1
  87. package/examples/jsm/objects/Reflector.js +2 -3
  88. package/examples/jsm/objects/Water2Mesh.js +1 -1
  89. package/examples/jsm/physics/AmmoPhysics.js +15 -8
  90. package/examples/jsm/physics/RapierPhysics.js +27 -2
  91. package/examples/jsm/shaders/VolumeShader.js +31 -44
  92. package/examples/jsm/transpiler/GLSLDecoder.js +6 -6
  93. package/examples/jsm/transpiler/Linker.js +1 -1
  94. package/examples/jsm/tsl/display/BloomNode.js +59 -19
  95. package/examples/jsm/tsl/display/DepthOfFieldNode.js +2 -2
  96. package/examples/jsm/tsl/display/FXAANode.js +11 -12
  97. package/examples/jsm/tsl/display/GTAONode.js +34 -13
  98. package/examples/jsm/tsl/display/GodraysNode.js +1 -1
  99. package/examples/jsm/tsl/display/ImportanceSampledEnvironment.js +560 -0
  100. package/examples/jsm/tsl/display/PixelationPassNode.js +2 -2
  101. package/examples/jsm/tsl/display/RecurrentDenoiseNode.js +912 -0
  102. package/examples/jsm/tsl/display/SSAAPassNode.js +13 -25
  103. package/examples/jsm/tsl/display/SSGINode.js +89 -39
  104. package/examples/jsm/tsl/display/SSRNode.js +829 -132
  105. package/examples/jsm/tsl/display/SSSNode.js +2 -2
  106. package/examples/jsm/tsl/display/TemporalReprojectNode.js +1023 -0
  107. package/examples/jsm/tsl/lighting/ClusteredLightsNode.js +622 -0
  108. package/examples/jsm/tsl/lighting/DynamicLightsNode.js +1 -1
  109. package/examples/jsm/tsl/math/curlNoise.js +107 -0
  110. package/examples/jsm/tsl/shadows/TileShadowNode.js +1 -1
  111. package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +3 -3
  112. package/examples/jsm/tsl/utils/GroundedSkybox.js +62 -0
  113. package/examples/jsm/tsl/utils/RNoise.js +51 -0
  114. package/examples/jsm/tsl/utils/SpecularHelpers.js +325 -0
  115. package/examples/jsm/utils/BufferGeometryUtils.js +126 -59
  116. package/examples/jsm/utils/GeometryCompressionUtils.js +1 -1
  117. package/examples/jsm/utils/SceneOptimizer.js +1 -1
  118. package/examples/jsm/webxr/ARButton.js +1 -1
  119. package/examples/jsm/webxr/WebGLXRFallback.js +89 -0
  120. package/examples/jsm/webxr/XRControllerModelFactory.js +2 -2
  121. package/package.json +7 -7
  122. package/src/Three.TSL.js +10 -3
  123. package/src/Three.WebGPU.js +4 -0
  124. package/src/animation/AnimationAction.js +15 -11
  125. package/src/animation/AnimationClip.js +0 -139
  126. package/src/animation/KeyframeTrack.js +2 -2
  127. package/src/animation/PropertyBinding.js +2 -2
  128. package/src/cameras/Camera.js +2 -2
  129. package/src/cameras/StereoCamera.js +5 -2
  130. package/src/constants.js +1 -1
  131. package/src/core/BufferGeometry.js +29 -7
  132. package/src/core/Object3D.js +17 -7
  133. package/src/core/Raycaster.js +1 -1
  134. package/src/core/RenderTarget.js +15 -2
  135. package/src/extras/PMREMGenerator.js +6 -4
  136. package/src/extras/TextureUtils.js +1 -1
  137. package/src/extras/core/ShapePath.js +149 -160
  138. package/src/geometries/SphereGeometry.js +8 -3
  139. package/src/helpers/DirectionalLightHelper.js +2 -0
  140. package/src/helpers/HemisphereLightHelper.js +2 -0
  141. package/src/helpers/PointLightHelper.js +2 -0
  142. package/src/helpers/SpotLightHelper.js +1 -1
  143. package/src/loaders/DataTextureLoader.js +69 -38
  144. package/src/loaders/LoadingManager.js +5 -0
  145. package/src/loaders/MaterialLoader.js +36 -266
  146. package/src/loaders/ObjectLoader.js +3 -1
  147. package/src/materials/LineBasicMaterial.js +4 -0
  148. package/src/materials/Material.js +196 -1
  149. package/src/materials/MeshBasicMaterial.js +24 -0
  150. package/src/materials/MeshDepthMaterial.js +10 -0
  151. package/src/materials/MeshDistanceMaterial.js +10 -0
  152. package/src/materials/MeshLambertMaterial.js +40 -1
  153. package/src/materials/MeshMatcapMaterial.js +25 -1
  154. package/src/materials/MeshNormalMaterial.js +9 -1
  155. package/src/materials/MeshPhongMaterial.js +40 -1
  156. package/src/materials/MeshPhysicalMaterial.js +38 -0
  157. package/src/materials/MeshStandardMaterial.js +42 -1
  158. package/src/materials/MeshToonMaterial.js +34 -1
  159. package/src/materials/PointsMaterial.js +7 -0
  160. package/src/materials/ShaderMaterial.js +86 -0
  161. package/src/materials/SpriteMaterial.js +7 -0
  162. package/src/materials/nodes/Line2NodeMaterial.js +378 -322
  163. package/src/materials/nodes/MeshBasicNodeMaterial.js +2 -2
  164. package/src/materials/nodes/MeshNormalNodeMaterial.js +2 -2
  165. package/src/materials/nodes/MeshPhongNodeMaterial.js +0 -9
  166. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +0 -30
  167. package/src/materials/nodes/MeshSSSNodeMaterial.js +0 -13
  168. package/src/materials/nodes/MeshStandardNodeMaterial.js +0 -11
  169. package/src/materials/nodes/NodeMaterial.js +115 -71
  170. package/src/materials/nodes/SpriteNodeMaterial.js +0 -10
  171. package/src/materials/nodes/manager/NodeMaterialObserver.js +49 -20
  172. package/src/math/Box3.js +5 -0
  173. package/src/math/FrustumArray.js +103 -133
  174. package/src/math/Interpolant.js +1 -1
  175. package/src/math/MathUtils.js +2 -2
  176. package/src/math/Matrix3.js +11 -0
  177. package/src/math/Matrix4.js +28 -3
  178. package/src/math/Vector2.js +2 -2
  179. package/src/math/Vector3.js +2 -2
  180. package/src/math/Vector4.js +2 -2
  181. package/src/math/interpolants/BezierInterpolant.js +4 -6
  182. package/src/nodes/Nodes.js +2 -5
  183. package/src/nodes/TSL.js +8 -6
  184. package/src/nodes/accessors/Arrays.js +4 -4
  185. package/src/nodes/accessors/Batch.js +108 -0
  186. package/src/nodes/accessors/Bitangent.js +2 -2
  187. package/src/nodes/accessors/BufferAttributeNode.js +13 -2
  188. package/src/nodes/accessors/Camera.js +7 -7
  189. package/src/nodes/accessors/ClippingNode.js +1 -1
  190. package/src/nodes/accessors/Instance.js +264 -0
  191. package/src/nodes/accessors/MaterialNode.js +18 -2
  192. package/src/nodes/accessors/MaterialProperties.js +4 -3
  193. package/src/nodes/accessors/{MorphNode.js → Morph.js} +99 -112
  194. package/src/nodes/accessors/Normal.js +13 -13
  195. package/src/nodes/accessors/Position.js +5 -1
  196. package/src/nodes/accessors/ReferenceNode.js +1 -0
  197. package/src/nodes/accessors/ReflectVector.js +3 -3
  198. package/src/nodes/accessors/SceneProperties.js +1 -1
  199. package/src/nodes/accessors/Skinning.js +263 -0
  200. package/src/nodes/accessors/StorageBufferNode.js +2 -2
  201. package/src/nodes/accessors/StorageTexture3DNode.js +100 -0
  202. package/src/nodes/accessors/StorageTextureNode.js +39 -7
  203. package/src/nodes/accessors/Tangent.js +4 -4
  204. package/src/nodes/accessors/TextureNode.js +60 -5
  205. package/src/nodes/code/FunctionNode.js +2 -16
  206. package/src/nodes/core/MRTNode.js +7 -2
  207. package/src/nodes/core/Node.js +39 -2
  208. package/src/nodes/core/NodeBuilder.js +201 -41
  209. package/src/nodes/core/NodeUtils.js +13 -13
  210. package/src/nodes/core/OutputStructNode.js +1 -1
  211. package/src/nodes/core/OverrideContextNode.js +153 -0
  212. package/src/nodes/core/PropertyNode.js +51 -5
  213. package/src/nodes/core/StackNode.js +56 -34
  214. package/src/nodes/core/StructNode.js +4 -6
  215. package/src/nodes/core/StructTypeNode.js +6 -6
  216. package/src/nodes/core/VarNode.js +8 -0
  217. package/src/nodes/core/VaryingNode.js +12 -2
  218. package/src/nodes/display/BlendModes.js +1 -41
  219. package/src/nodes/display/BumpMapNode.js +6 -1
  220. package/src/nodes/display/ColorAdjustment.js +10 -9
  221. package/src/nodes/display/FrontFacingNode.js +38 -9
  222. package/src/nodes/display/NormalMapNode.js +2 -2
  223. package/src/nodes/display/PassNode.js +35 -43
  224. package/src/nodes/display/PremultiplyAlphaFunctions.js +39 -0
  225. package/src/nodes/display/RenderOutputNode.js +12 -3
  226. package/src/nodes/functions/VolumetricLightingModel.js +40 -7
  227. package/src/nodes/gpgpu/WorkgroupInfoNode.js +1 -1
  228. package/src/nodes/lighting/EnvironmentNode.js +2 -2
  229. package/src/nodes/lighting/IESSpotLightNode.js +40 -2
  230. package/src/nodes/lighting/LightingContextNode.js +10 -2
  231. package/src/nodes/lighting/LightsNode.js +90 -37
  232. package/src/nodes/lighting/PointShadowNode.js +6 -1
  233. package/src/nodes/lighting/ShadowFilterNode.js +21 -52
  234. package/src/nodes/lighting/ShadowNode.js +34 -14
  235. package/src/nodes/materialx/lib/mx_noise.js +2 -2
  236. package/src/nodes/math/ConditionalNode.js +3 -3
  237. package/src/nodes/math/MathNode.js +39 -11
  238. package/src/nodes/math/OperatorNode.js +23 -23
  239. package/src/nodes/parsers/GLSLNodeFunction.js +1 -1
  240. package/src/nodes/pmrem/PMREMNode.js +33 -2
  241. package/src/nodes/tsl/TSLCore.js +63 -18
  242. package/src/nodes/utils/EquirectUV.js +30 -5
  243. package/src/nodes/utils/FunctionOverloadingNode.js +1 -1
  244. package/src/nodes/utils/Packing.js +35 -4
  245. package/src/nodes/utils/RTTNode.js +40 -24
  246. package/src/nodes/utils/ReflectorNode.js +1 -0
  247. package/src/nodes/utils/StorageArrayElementNode.js +1 -1
  248. package/src/objects/BatchedMesh.js +22 -14
  249. package/src/objects/InstancedMesh.js +0 -11
  250. package/src/objects/Skeleton.js +0 -9
  251. package/src/renderers/WebGLRenderer.js +19 -15
  252. package/src/renderers/common/Backend.js +49 -5
  253. package/src/renderers/common/Bindings.js +114 -45
  254. package/src/renderers/common/Buffer.js +9 -0
  255. package/src/renderers/common/ClippingContext.js +10 -2
  256. package/src/renderers/common/Info.js +63 -22
  257. package/src/renderers/common/Lighting.js +53 -5
  258. package/src/renderers/common/RenderList.js +41 -4
  259. package/src/renderers/common/RenderObject.js +73 -13
  260. package/src/renderers/common/Renderer.js +281 -108
  261. package/src/renderers/common/Sampler.js +16 -48
  262. package/src/renderers/common/Textures.js +32 -5
  263. package/src/renderers/common/TimestampQueryPool.js +1 -1
  264. package/src/renderers/common/UniformsGroup.js +31 -9
  265. package/src/renderers/common/XRManager.js +340 -22
  266. package/src/renderers/common/extras/PMREMGenerator.js +15 -38
  267. package/src/renderers/common/nodes/NodeBuilderState.js +9 -1
  268. package/src/renderers/common/nodes/NodeLibrary.js +4 -4
  269. package/src/renderers/common/nodes/NodeManager.js +63 -14
  270. package/src/renderers/common/nodes/NodeUniformBuffer.js +13 -0
  271. package/src/renderers/shaders/ShaderChunk/common.glsl.js +13 -4
  272. package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +0 -6
  273. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +1 -1
  274. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +2 -2
  275. package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +1 -1
  276. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +1 -1
  277. package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +1 -1
  278. package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +2 -2
  279. package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +6 -0
  280. package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +1 -1
  281. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
  282. package/src/renderers/shaders/ShaderLib/distance.glsl.js +1 -1
  283. package/src/renderers/webgl/WebGLOutput.js +2 -1
  284. package/src/renderers/webgl/WebGLProgram.js +5 -4
  285. package/src/renderers/webgl/WebGLPrograms.js +12 -5
  286. package/src/renderers/webgl/WebGLRenderLists.js +9 -1
  287. package/src/renderers/webgl/WebGLShaderCache.js +5 -11
  288. package/src/renderers/webgl/WebGLTextures.js +20 -7
  289. package/src/renderers/webgl/WebGLUniformsGroups.js +66 -38
  290. package/src/renderers/webgl-fallback/WebGLBackend.js +84 -25
  291. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +138 -8
  292. package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +1 -1
  293. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +52 -22
  294. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +4 -2
  295. package/src/renderers/webgpu/WebGPUBackend.js +480 -169
  296. package/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.js +48 -0
  297. package/src/renderers/webgpu/descriptors/GPUBufferDescriptor.js +57 -0
  298. package/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.js +30 -0
  299. package/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.js +38 -0
  300. package/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.js +48 -0
  301. package/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.js +47 -0
  302. package/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.js +50 -0
  303. package/src/renderers/webgpu/descriptors/GPUExtent3D.js +51 -0
  304. package/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.js +39 -0
  305. package/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.js +47 -0
  306. package/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.js +74 -0
  307. package/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.js +72 -0
  308. package/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.js +99 -0
  309. package/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.js +72 -0
  310. package/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.js +49 -0
  311. package/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.js +130 -0
  312. package/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.js +119 -0
  313. package/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.js +46 -0
  314. package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.js +57 -0
  315. package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.js +48 -0
  316. package/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.js +61 -0
  317. package/src/renderers/webgpu/descriptors/GPUTextureDescriptor.js +99 -0
  318. package/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.js +108 -0
  319. package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +0 -1
  320. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +164 -7
  321. package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +1 -1
  322. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +98 -38
  323. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +72 -68
  324. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +164 -69
  325. package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +158 -95
  326. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +297 -141
  327. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +33 -18
  328. package/src/renderers/webgpu/utils/WebGPUUtils.js +38 -3
  329. package/src/textures/DepthTexture.js +1 -1
  330. package/src/textures/ExternalTexture.js +0 -3
  331. package/examples/fonts/LICENSE +0 -13
  332. package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
  333. package/examples/fonts/MPLUSRounded1c/OFL.txt +0 -91
  334. package/examples/fonts/README.md +0 -11
  335. package/examples/fonts/droid/NOTICE +0 -190
  336. package/examples/fonts/droid/README.txt +0 -18
  337. package/examples/fonts/droid/droid_sans_bold.typeface.json +0 -1
  338. package/examples/fonts/droid/droid_sans_mono_regular.typeface.json +0 -1
  339. package/examples/fonts/droid/droid_sans_regular.typeface.json +0 -1
  340. package/examples/fonts/droid/droid_serif_bold.typeface.json +0 -1
  341. package/examples/fonts/droid/droid_serif_regular.typeface.json +0 -1
  342. package/examples/fonts/gentilis_bold.typeface.json +0 -1
  343. package/examples/fonts/gentilis_regular.typeface.json +0 -1
  344. package/examples/fonts/helvetiker_bold.typeface.json +0 -1
  345. package/examples/fonts/helvetiker_regular.typeface.json +0 -1
  346. package/examples/fonts/optimer_bold.typeface.json +0 -1
  347. package/examples/fonts/optimer_regular.typeface.json +0 -1
  348. package/examples/fonts/ttf/README.md +0 -9
  349. package/examples/fonts/ttf/kenpixel.ttf +0 -0
  350. package/examples/jsm/inspector/extensions/extensions.json +0 -6
  351. package/examples/jsm/libs/ammo.wasm.js +0 -822
  352. package/examples/jsm/libs/ammo.wasm.wasm +0 -0
  353. package/examples/jsm/libs/draco/draco_encoder.js +0 -33
  354. package/examples/jsm/libs/draco/gltf/draco_encoder.js +0 -33
  355. package/examples/jsm/libs/lottie_canvas.module.js +0 -14849
  356. package/examples/jsm/libs/opentype.module.js +0 -14506
  357. package/examples/jsm/libs/rhino3dm/rhino3dm.js +0 -21
  358. package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +0 -16
  359. package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
  360. package/examples/jsm/lighting/TiledLighting.js +0 -42
  361. package/examples/jsm/tsl/display/AnamorphicNode.js +0 -293
  362. package/examples/jsm/tsl/lighting/TiledLightsNode.js +0 -442
  363. package/src/nodes/accessors/BatchNode.js +0 -163
  364. package/src/nodes/accessors/InstanceNode.js +0 -349
  365. package/src/nodes/accessors/InstancedMeshNode.js +0 -50
  366. package/src/nodes/accessors/SkinningNode.js +0 -328
@@ -1,4 +1,3 @@
1
-
2
1
  export class Graph {
3
2
 
4
3
  constructor( maxPoints = 512 ) {
@@ -8,20 +7,37 @@ export class Graph {
8
7
  this.limit = 0;
9
8
  this.limitIndex = 0;
10
9
 
11
- this.domElement = document.createElementNS( 'http://www.w3.org/2000/svg', 'svg' );
12
- this.domElement.setAttribute( 'class', 'graph-svg' );
10
+ this.domElement = document.createElement( 'canvas' );
11
+ this.domElement.setAttribute( 'class', 'graph-canvas' );
12
+
13
+ this.ctx = this.domElement.getContext( '2d' );
14
+
15
+ this.width = 0;
16
+ this.height = 0;
17
+ this.devicePixelRatio = window.devicePixelRatio || 1;
13
18
 
14
19
  }
15
20
 
16
- addLine( id, color ) {
21
+ resize( width, height ) {
22
+
23
+ this.width = width;
24
+ this.height = height;
17
25
 
18
- const path = document.createElementNS( 'http://www.w3.org/2000/svg', 'path' );
19
- path.setAttribute( 'class', 'graph-path' );
20
- path.style.stroke = color;
21
- path.style.fill = color;
22
- this.domElement.appendChild( path );
26
+ this.devicePixelRatio = window.devicePixelRatio || 1;
27
+ this.domElement.width = width * this.devicePixelRatio;
28
+ this.domElement.height = height * this.devicePixelRatio;
29
+
30
+ this.draw();
31
+
32
+ }
33
+
34
+ addLine( id, color ) {
23
35
 
24
- this.lines[ id ] = { path, color, points: [] };
36
+ this.lines[ id ] = {
37
+ color: color,
38
+ resolved: null,
39
+ points: []
40
+ };
25
41
 
26
42
  }
27
43
 
@@ -55,41 +71,162 @@ export class Graph {
55
71
 
56
72
  update() {
57
73
 
58
- const svgWidth = this.domElement.clientWidth;
59
- const svgHeight = this.domElement.clientHeight;
60
- if ( svgWidth === 0 ) return;
74
+ const width = this.domElement.clientWidth;
75
+ const height = this.domElement.clientHeight;
61
76
 
62
- const pointStep = svgWidth / ( this.maxPoints - 1 );
77
+ if ( width === 0 || height === 0 ) return;
78
+
79
+ if ( width !== this.width || height !== this.height ) {
80
+
81
+ this.resize( width, height );
82
+
83
+ } else {
84
+
85
+ this.draw();
86
+
87
+ }
88
+
89
+ if ( this.limitIndex ++ > this.maxPoints ) {
90
+
91
+ this.resetLimit();
92
+
93
+ }
94
+
95
+ }
96
+
97
+ draw() {
98
+
99
+ const ctx = this.ctx;
100
+ const dpr = this.devicePixelRatio;
101
+ const width = this.width;
102
+ const height = this.height;
103
+
104
+ ctx.clearRect( 0, 0, width * dpr, height * dpr );
105
+
106
+ if ( width === 0 || height === 0 ) return;
107
+
108
+ ctx.save();
109
+ ctx.scale( dpr, dpr );
110
+
111
+ const pointStep = width / ( this.maxPoints - 1 );
63
112
 
64
113
  for ( const id in this.lines ) {
65
114
 
66
115
  const line = this.lines[ id ];
116
+ if ( line.points.length === 0 ) continue;
117
+
118
+ if ( ! line.resolved ) {
119
+
120
+ line.resolved = this._resolveColor( line.color );
121
+
122
+ }
123
+
124
+ const resolved = line.resolved;
125
+ const drawColor = resolved ? resolved.color : '#ffffff';
126
+ const offset = width - ( ( line.points.length - 1 ) * pointStep );
127
+
128
+ // 1. Draw fill (with opacity)
129
+ let fillStyle = drawColor;
130
+
131
+ if ( height > 0 ) {
67
132
 
68
- let pathString = `M 0,${ svgHeight }`;
133
+ const gradient = ctx.createLinearGradient( 0, 0, 0, height );
134
+ gradient.addColorStop( 0, drawColor );
135
+ gradient.addColorStop( 1, ( resolved && resolved.transparent ) || 'rgba(0,0,0,0)' );
136
+ fillStyle = gradient;
137
+
138
+ }
139
+
140
+ ctx.fillStyle = fillStyle;
141
+ ctx.globalAlpha = 0.4;
142
+ ctx.beginPath();
143
+ ctx.moveTo( offset, height );
69
144
  for ( let i = 0; i < line.points.length; i ++ ) {
70
145
 
71
- const x = i * pointStep;
72
- const y = svgHeight - ( line.points[ i ] / this.limit ) * svgHeight;
73
- pathString += ` L ${ x },${ y }`;
146
+ const x = offset + i * pointStep;
147
+ const y = this.limit === 0 ? height : height - ( line.points[ i ] / this.limit ) * height;
148
+ ctx.lineTo( x, y );
74
149
 
75
150
  }
76
151
 
77
- pathString += ` L ${( line.points.length - 1 ) * pointStep},${ svgHeight } Z`;
152
+ ctx.lineTo( offset + ( line.points.length - 1 ) * pointStep, height );
153
+ ctx.closePath();
154
+ ctx.fill();
155
+
156
+ // 2. Draw stroke (full opacity)
157
+ ctx.strokeStyle = drawColor;
158
+ ctx.lineWidth = 2;
159
+ ctx.globalAlpha = 1.0;
160
+ ctx.beginPath();
161
+ for ( let i = 0; i < line.points.length; i ++ ) {
162
+
163
+ const x = offset + i * pointStep;
164
+ const y = this.limit === 0 ? height : height - ( line.points[ i ] / this.limit ) * height;
165
+ if ( i === 0 ) {
166
+
167
+ ctx.moveTo( x, y );
168
+
169
+ } else {
78
170
 
79
- const offset = svgWidth - ( ( line.points.length - 1 ) * pointStep );
80
- line.path.setAttribute( 'transform', `translate(${ offset }, 0)` );
81
- line.path.setAttribute( 'd', pathString );
171
+ ctx.lineTo( x, y );
172
+
173
+ }
174
+
175
+ }
176
+
177
+ ctx.stroke();
82
178
 
83
179
  }
84
180
 
85
- //
181
+ ctx.restore();
86
182
 
87
- if ( this.limitIndex ++ > this.maxPoints ) {
183
+ }
88
184
 
89
- this.resetLimit();
185
+ _resolveColor( color ) {
186
+
187
+ let resolved = color;
188
+
189
+ if ( color.startsWith( 'var(' ) ) {
190
+
191
+ const varName = color.slice( 4, - 1 ).trim();
192
+ resolved = getComputedStyle( this.domElement ).getPropertyValue( varName ).trim();
193
+
194
+ if ( ! resolved ) {
195
+
196
+ return null;
197
+
198
+ }
199
+
200
+ }
201
+
202
+ let transparentColor = 'rgba(0,0,0,0)';
203
+
204
+ if ( resolved.startsWith( '#' ) ) {
205
+
206
+ const hex = resolved.substring( 0, 7 );
207
+ transparentColor = hex + '00';
208
+
209
+ } else if ( resolved.startsWith( 'rgb' ) ) {
210
+
211
+ const match = resolved.match( /^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)$/ );
212
+
213
+ if ( match ) {
214
+
215
+ transparentColor = `rgba(${match[ 1 ]}, ${match[ 2 ]}, ${match[ 3 ]}, 0)`;
216
+
217
+ }
90
218
 
91
219
  }
92
220
 
221
+ return {
222
+ color: resolved,
223
+ transparent: transparentColor
224
+ };
225
+
226
+ }
227
+
228
+ dispose() {
229
+
93
230
  }
94
231
 
95
232
  }
@@ -4,6 +4,7 @@ export class Item {
4
4
 
5
5
  this.children = [];
6
6
  this.isOpen = true;
7
+ this.isCollapsible = false;
7
8
  this.childrenContainer = null;
8
9
  this.parent = null;
9
10
  this.domElement = document.createElement( 'div' );
@@ -13,23 +14,15 @@ export class Item {
13
14
 
14
15
  this.userData = {};
15
16
 
16
- this.data = data;
17
- this.data.forEach( ( cellData ) => {
17
+ this.data = [];
18
+ data.forEach( ( cellData, index ) => {
18
19
 
19
20
  const cell = document.createElement( 'div' );
20
21
  cell.className = 'list-item-cell';
21
- if ( cellData instanceof HTMLElement ) {
22
-
23
- cell.appendChild( cellData );
24
-
25
- } else {
26
-
27
- cell.append( String( cellData ) );
28
-
29
- }
30
-
31
22
  this.itemRow.appendChild( cell );
32
23
 
24
+ this.setValue( index, cellData );
25
+
33
26
  } );
34
27
 
35
28
  this.domElement.appendChild( this.itemRow );
@@ -116,7 +109,7 @@ export class Item {
116
109
  const firstCell = this.itemRow.querySelector( '.list-item-cell:first-child' );
117
110
  let toggler = this.itemRow.querySelector( '.item-toggler' );
118
111
 
119
- if ( this.children.length > 0 ) {
112
+ if ( this.children.length > 0 || this.isCollapsible ) {
120
113
 
121
114
  if ( ! toggler ) {
122
115
 
@@ -140,6 +133,36 @@ export class Item {
140
133
 
141
134
  }
142
135
 
136
+ setCollapsible( collapsible ) {
137
+
138
+ this.isCollapsible = collapsible;
139
+
140
+ if ( collapsible ) {
141
+
142
+ this.itemRow.classList.add( 'collapsible' );
143
+
144
+ if ( ! this.childrenContainer ) {
145
+
146
+ this.childrenContainer = document.createElement( 'div' );
147
+ this.childrenContainer.className = 'list-children-container';
148
+ this.childrenContainer.classList.toggle( 'closed', ! this.isOpen );
149
+ this.domElement.appendChild( this.childrenContainer );
150
+ this.itemRow.addEventListener( 'click', this.onItemClick );
151
+
152
+ }
153
+
154
+ } else {
155
+
156
+ this.itemRow.classList.remove( 'collapsible' );
157
+
158
+ }
159
+
160
+ this.updateToggler();
161
+
162
+ return this;
163
+
164
+ }
165
+
143
166
  toggle() {
144
167
 
145
168
  this.isOpen = ! this.isOpen;
@@ -167,4 +190,60 @@ export class Item {
167
190
 
168
191
  }
169
192
 
193
+ show() {
194
+
195
+ this.domElement.style.display = '';
196
+
197
+ return this;
198
+
199
+ }
200
+
201
+ hide() {
202
+
203
+ this.domElement.style.display = 'none';
204
+
205
+ return this;
206
+
207
+ }
208
+
209
+ setValue( index, value ) {
210
+
211
+ this.data[ index ] = value;
212
+
213
+ const cell = this.itemRow.children[ index ];
214
+
215
+ if ( cell ) {
216
+
217
+ const toggler = cell.querySelector( '.item-toggler' );
218
+
219
+ cell.innerHTML = '';
220
+
221
+ if ( toggler ) {
222
+
223
+ cell.appendChild( toggler );
224
+
225
+ }
226
+
227
+ if ( value instanceof HTMLElement ) {
228
+
229
+ cell.appendChild( value );
230
+
231
+ } else {
232
+
233
+ cell.append( String( value ) );
234
+
235
+ }
236
+
237
+ }
238
+
239
+ return this;
240
+
241
+ }
242
+
243
+ getValue( index ) {
244
+
245
+ return this.data[ index ];
246
+
247
+ }
248
+
170
249
  }
@@ -7,7 +7,7 @@ export class List {
7
7
  this.children = [];
8
8
  this.domElement = document.createElement( 'div' );
9
9
  this.domElement.className = 'list-container';
10
- this.domElement.style.padding = '10px';
10
+ this.domElement.style.padding = '5px 10px 10px 10px';
11
11
  this.id = `list-${Math.random().toString( 36 ).slice( 2, 11 )}`;
12
12
  this.domElement.dataset.listId = this.id;
13
13
 
@@ -1,5 +1,6 @@
1
1
  import { EventDispatcher } from 'three';
2
2
  import { Style } from './Style.js';
3
+ import { Graph } from './Graph.js';
3
4
  import { getItem, setItem } from '../Inspector.js';
4
5
 
5
6
  export class Profiler extends EventDispatcher {
@@ -19,17 +20,29 @@ export class Profiler extends EventDispatcher {
19
20
  this.maxZIndex = 1002; // Track the highest z-index for detached windows (starts at base z-index from CSS)
20
21
  this.nextTabOriginalIndex = 0; // Track the original order of tabs as they are added
21
22
 
22
- Style.init();
23
-
24
23
  this.setupShell();
25
24
  this.setupResizing();
26
25
 
26
+ Style.init( this.domElement );
27
+
27
28
  // Setup window resize listener and update mobile status
28
29
  this.setupWindowResizeListener();
29
30
 
30
31
  // Setup orientation change listener for mobile devices
31
32
  this.setupOrientationListener();
32
33
 
34
+ this.checkHeaderScroll();
35
+
36
+ this.panel.addEventListener( 'transitionend', ( e ) => {
37
+
38
+ if ( e.target === this.panel && ( e.propertyName === 'width' || e.propertyName === 'height' || e.propertyName === 'transform' ) ) {
39
+
40
+ this.checkHeaderScroll();
41
+
42
+ }
43
+
44
+ } );
45
+
33
46
  }
34
47
 
35
48
  getSize() {
@@ -180,6 +193,7 @@ export class Profiler extends EventDispatcher {
180
193
 
181
194
  constrainDetachedWindows();
182
195
  constrainMainPanel();
196
+ this.checkHeaderScroll();
183
197
 
184
198
  } );
185
199
 
@@ -237,31 +251,36 @@ export class Profiler extends EventDispatcher {
237
251
  setupShell() {
238
252
 
239
253
  this.domElement = document.createElement( 'div' );
240
- this.domElement.id = 'profiler-shell';
254
+
255
+ this.domElement.classList.add( 'three-inspector' );
241
256
 
242
257
  this.toggleButton = document.createElement( 'button' );
243
- this.toggleButton.id = 'profiler-toggle';
258
+ this.toggleButton.classList.add( 'profiler-toggle' );
244
259
  this.toggleButton.innerHTML = `
245
- <span id="builtin-tabs-container"></span>
246
- <span id="toggle-text">
247
- <span id="fps-counter">-</span>
260
+ <span class="builtin-tabs-container"></span>
261
+ <span class="toggle-text">
262
+ <span class="fps-counter">-</span>
248
263
  <span class="fps-label">FPS</span>
249
264
  </span>
250
- <span id="toggle-icon">
265
+ <span class="toggle-icon">
251
266
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-device-ipad-horizontal-search"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M11.5 20h-6.5a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v5.5" /><path d="M9 17h2" /><path d="M18 18m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" /><path d="M20.2 20.2l1.8 1.8" /></svg>
267
+ <span class="console-badge-container">
268
+ <span class="console-badge error" style="display: none;">0</span>
269
+ <span class="console-badge warn" style="display: none;">0</span>
270
+ </span>
252
271
  </span>
253
272
  `;
254
273
  this.toggleButton.onclick = () => this.togglePanel();
255
274
 
256
- this.builtinTabsContainer = this.toggleButton.querySelector( '#builtin-tabs-container' );
275
+ this.builtinTabsContainer = this.toggleButton.querySelector( '.builtin-tabs-container' );
257
276
 
258
277
  // Create mini-panel for builtin tabs (shown when panel is hidden)
259
278
  this.miniPanel = document.createElement( 'div' );
260
- this.miniPanel.id = 'profiler-mini-panel';
279
+ this.miniPanel.classList.add( 'profiler-mini-panel' );
261
280
  this.miniPanel.className = 'profiler-mini-panel';
262
281
 
263
282
  this.panel = document.createElement( 'div' );
264
- this.panel.id = 'profiler-panel';
283
+ this.panel.classList.add( 'profiler-panel' );
265
284
 
266
285
  const header = document.createElement( 'div' );
267
286
  header.className = 'profiler-header';
@@ -285,7 +304,7 @@ export class Profiler extends EventDispatcher {
285
304
  controls.className = 'profiler-controls';
286
305
 
287
306
  this.floatingBtn = document.createElement( 'button' );
288
- this.floatingBtn.id = 'floating-btn';
307
+ this.floatingBtn.classList.add( 'floating-btn' );
289
308
  this.floatingBtn.title = 'Switch to Right Side';
290
309
  this.floatingBtn.innerHTML = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="15" y1="3" x2="15" y2="21"></line></svg>';
291
310
  this.floatingBtn.onclick = () => this.togglePosition();
@@ -305,12 +324,12 @@ export class Profiler extends EventDispatcher {
305
324
  }
306
325
 
307
326
  this.maximizeBtn = document.createElement( 'button' );
308
- this.maximizeBtn.id = 'maximize-btn';
327
+ this.maximizeBtn.classList.add( 'maximize-btn' );
309
328
  this.maximizeBtn.innerHTML = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"/></svg>';
310
329
  this.maximizeBtn.onclick = () => this.toggleMaximize();
311
330
 
312
331
  const hideBtn = document.createElement( 'button' );
313
- hideBtn.id = 'hide-panel-btn';
332
+ hideBtn.classList.add( 'hide-panel-btn' );
314
333
  hideBtn.textContent = '-';
315
334
  hideBtn.onclick = () => this.togglePanel();
316
335
 
@@ -337,6 +356,12 @@ export class Profiler extends EventDispatcher {
337
356
 
338
357
  }
339
358
 
359
+ // Create a background performance graph for the toggle button
360
+ this.toggleGraph = new Graph( 80 );
361
+ this.toggleGraph.addLine( 'fps', '#4c4c6bff' );
362
+ this.toggleGraph.domElement.className = 'profiler-toggle-graph';
363
+ this.toggleButton.appendChild( this.toggleGraph.domElement );
364
+
340
365
  }
341
366
 
342
367
  setupResizing() {
@@ -385,6 +410,7 @@ export class Profiler extends EventDispatcher {
385
410
  }
386
411
 
387
412
  this.dispatchEvent( { type: 'resize' } );
413
+ this.checkHeaderScroll();
388
414
 
389
415
  };
390
416
 
@@ -430,6 +456,7 @@ export class Profiler extends EventDispatcher {
430
456
  if ( this.panel.classList.contains( 'maximized' ) ) {
431
457
 
432
458
  this.panel.classList.remove( 'maximized' );
459
+ this.domElement.classList.remove( 'maximized' );
433
460
 
434
461
  // Restore size based on current position
435
462
  if ( this.position === 'bottom' ) {
@@ -460,6 +487,7 @@ export class Profiler extends EventDispatcher {
460
487
  }
461
488
 
462
489
  this.panel.classList.add( 'maximized' );
490
+ this.domElement.classList.add( 'maximized' );
463
491
 
464
492
  // Maximize based on current position
465
493
  if ( this.position === 'bottom' ) {
@@ -752,6 +780,7 @@ export class Profiler extends EventDispatcher {
752
780
  if ( this.panel.classList.contains( 'maximized' ) ) {
753
781
 
754
782
  this.panel.classList.remove( 'maximized' );
783
+ this.domElement.classList.remove( 'maximized' );
755
784
  this.maximizeBtn.innerHTML = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"/></svg>';
756
785
 
757
786
  }
@@ -759,7 +788,7 @@ export class Profiler extends EventDispatcher {
759
788
  // No tabs visible - set to minimum size
760
789
  if ( this.position === 'bottom' ) {
761
790
 
762
- this.panel.style.height = '38px';
791
+ this.panel.style.height = '32px';
763
792
 
764
793
  } else if ( this.position === 'right' ) {
765
794
 
@@ -778,7 +807,7 @@ export class Profiler extends EventDispatcher {
778
807
  if ( this.position === 'bottom' ) {
779
808
 
780
809
  const currentHeight = parseInt( this.panel.style.height );
781
- if ( currentHeight === 38 ) {
810
+ if ( currentHeight === 32 || currentHeight === 38 ) {
782
811
 
783
812
  this.panel.style.height = `${ this.lastHeightBottom }px`;
784
813
 
@@ -800,6 +829,29 @@ export class Profiler extends EventDispatcher {
800
829
  }
801
830
 
802
831
  this.dispatchEvent( { type: 'resize' } );
832
+ this.checkHeaderScroll();
833
+
834
+ }
835
+
836
+ checkHeaderScroll() {
837
+
838
+ const header = this.panel.querySelector( '.profiler-header' );
839
+
840
+ if ( header ) {
841
+
842
+ const hasScroll = header.scrollWidth > header.clientWidth + 1;
843
+
844
+ if ( hasScroll ) {
845
+
846
+ this.panel.classList.add( 'has-horizontal-scroll' );
847
+
848
+ } else {
849
+
850
+ this.panel.classList.remove( 'has-horizontal-scroll' );
851
+
852
+ }
853
+
854
+ }
803
855
 
804
856
  }
805
857
 
@@ -877,15 +929,15 @@ export class Profiler extends EventDispatcher {
877
929
 
878
930
  if ( isDragging && hasMoved && previewWindow ) {
879
931
 
932
+ const finalX = parseInt( previewWindow.style.left ) + 200;
933
+ const finalY = parseInt( previewWindow.style.top ) + 20;
934
+
880
935
  if ( previewWindow.parentNode ) {
881
936
 
882
937
  previewWindow.parentNode.removeChild( previewWindow );
883
938
 
884
939
  }
885
940
 
886
- const finalX = parseInt( previewWindow.style.left ) + 200;
887
- const finalY = parseInt( previewWindow.style.top ) + 20;
888
-
889
941
  this.detachTab( tab, finalX, finalY );
890
942
 
891
943
  } else if ( ! hasMoved ) {
@@ -975,7 +1027,7 @@ export class Profiler extends EventDispatcher {
975
1027
  windowPanel.appendChild( windowHeader );
976
1028
  windowPanel.appendChild( windowContent );
977
1029
 
978
- document.body.appendChild( windowPanel );
1030
+ this.domElement.appendChild( windowPanel );
979
1031
 
980
1032
  return windowPanel;
981
1033
 
@@ -1123,13 +1175,7 @@ export class Profiler extends EventDispatcher {
1123
1175
  windowPanel.style.left = `${ constrainedX }px`;
1124
1176
  windowPanel.style.top = `${ constrainedY }px`;
1125
1177
 
1126
- if ( ! this.panel.classList.contains( 'visible' ) ) {
1127
1178
 
1128
- windowPanel.style.opacity = '0';
1129
- windowPanel.style.visibility = 'hidden';
1130
- windowPanel.style.pointerEvents = 'none';
1131
-
1132
- }
1133
1179
 
1134
1180
  // Hide detached window if tab is not visible
1135
1181
  if ( ! tab.isVisible ) {
@@ -1189,7 +1235,7 @@ export class Profiler extends EventDispatcher {
1189
1235
  windowPanel.appendChild( windowHeader );
1190
1236
  windowPanel.appendChild( windowContent );
1191
1237
 
1192
- document.body.appendChild( windowPanel );
1238
+ this.domElement.appendChild( windowPanel );
1193
1239
 
1194
1240
  // Setup window dragging
1195
1241
  this.setupDetachedWindowDrag( windowPanel, windowHeader, tab );
@@ -1484,6 +1530,8 @@ export class Profiler extends EventDispatcher {
1484
1530
 
1485
1531
  }
1486
1532
 
1533
+ this.dispatchEvent( { type: 'resize' } );
1534
+
1487
1535
  };
1488
1536
 
1489
1537
  const onResizeEnd = () => {
@@ -1564,8 +1612,8 @@ export class Profiler extends EventDispatcher {
1564
1612
 
1565
1613
  }
1566
1614
 
1567
- // Count only non-detached tabs that come before this one
1568
- if ( ! t.isDetached ) {
1615
+ // Count only non-detached, non-builtin tabs that come before this one
1616
+ if ( ! t.isDetached && ! t.builtin ) {
1569
1617
 
1570
1618
  insertIndex ++;
1571
1619
 
@@ -1609,11 +1657,20 @@ export class Profiler extends EventDispatcher {
1609
1657
 
1610
1658
  if ( this.tabs[ id ] ) {
1611
1659
 
1612
- this.tabs[ id ].setActive( true );
1660
+ const tab = this.tabs[ id ];
1661
+
1662
+ if ( ! tab.isVisible ) {
1663
+
1664
+ tab.show();
1665
+
1666
+ }
1667
+
1668
+ tab.setActive( true );
1613
1669
 
1614
1670
  }
1615
1671
 
1616
1672
  this.saveLayout();
1673
+ this.checkHeaderScroll();
1617
1674
 
1618
1675
  }
1619
1676
 
@@ -1625,23 +1682,11 @@ export class Profiler extends EventDispatcher {
1625
1682
 
1626
1683
  const isVisible = this.panel.classList.contains( 'visible' );
1627
1684
 
1628
- this.detachedWindows.forEach( detachedWindow => {
1629
-
1630
- if ( isVisible ) {
1631
-
1632
- detachedWindow.panel.style.opacity = '';
1633
- detachedWindow.panel.style.visibility = '';
1634
- detachedWindow.panel.style.pointerEvents = '';
1685
+ if ( isVisible && this.activeTabId && this.tabs[ this.activeTabId ] ) {
1635
1686
 
1636
- } else {
1637
-
1638
- detachedWindow.panel.style.opacity = '0';
1639
- detachedWindow.panel.style.visibility = 'hidden';
1640
- detachedWindow.panel.style.pointerEvents = 'none';
1641
-
1642
- }
1687
+ this.tabs[ this.activeTabId ].setActive( true );
1643
1688
 
1644
- } );
1689
+ }
1645
1690
 
1646
1691
  this.dispatchEvent( { type: 'resize' } );
1647
1692