@vista3d/mcp 0.0.0-stage → 0.1.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/LICENSE +12 -0
- package/README.md +73 -2
- package/README.zh-CN.md +74 -0
- package/data/.gitkeep +0 -0
- package/data/api-index.json +16116 -0
- package/data/search-index.json +71479 -0
- package/data/typedoc-md/core/README.md +359 -0
- package/data/typedoc-md/core/classes/AmbientLight.md +755 -0
- package/data/typedoc-md/core/classes/Animation.md +681 -0
- package/data/typedoc-md/core/classes/AnimationController.md +195 -0
- package/data/typedoc-md/core/classes/AnimationCurve.md +287 -0
- package/data/typedoc-md/core/classes/AnimationCurveKeyframe.md +148 -0
- package/data/typedoc-md/core/classes/Annotation.md +1466 -0
- package/data/typedoc-md/core/classes/AutoExposureNode.md +269 -0
- package/data/typedoc-md/core/classes/Background.md +77 -0
- package/data/typedoc-md/core/classes/BoolUpdateFlag.md +145 -0
- package/data/typedoc-md/core/classes/Camera.md +1264 -0
- package/data/typedoc-md/core/classes/ClipAnimationController.md +1192 -0
- package/data/typedoc-md/core/classes/ClipPlaneUpdater.md +1075 -0
- package/data/typedoc-md/core/classes/Color4.md +499 -0
- package/data/typedoc-md/core/classes/ColorGradingNode.md +157 -0
- package/data/typedoc-md/core/classes/Command.md +69 -0
- package/data/typedoc-md/core/classes/CommandGroup.md +122 -0
- package/data/typedoc-md/core/classes/CommandHistory.md +445 -0
- package/data/typedoc-md/core/classes/Component.md +592 -0
- package/data/typedoc-md/core/classes/ComponentsDependencies.md +174 -0
- package/data/typedoc-md/core/classes/ComponentsManager.md +820 -0
- package/data/typedoc-md/core/classes/Controls.md +1308 -0
- package/data/typedoc-md/core/classes/DirectionalLight.md +1073 -0
- package/data/typedoc-md/core/classes/DisorderedArray.md +394 -0
- package/data/typedoc-md/core/classes/DitherNode.md +141 -0
- package/data/typedoc-md/core/classes/Engine.md +997 -0
- package/data/typedoc-md/core/classes/EngineObject.md +264 -0
- package/data/typedoc-md/core/classes/Entity.md +1014 -0
- package/data/typedoc-md/core/classes/Environment.md +159 -0
- package/data/typedoc-md/core/classes/EventDispatcher.md +215 -0
- package/data/typedoc-md/core/classes/GLTFParser.md +278 -0
- package/data/typedoc-md/core/classes/GLTFResource.md +465 -0
- package/data/typedoc-md/core/classes/GeometryResource.md +355 -0
- package/data/typedoc-md/core/classes/GlyphAtlas.md +180 -0
- package/data/typedoc-md/core/classes/Gradient.md +702 -0
- package/data/typedoc-md/core/classes/GradientAlphaKey.md +70 -0
- package/data/typedoc-md/core/classes/GradientColorKey.md +74 -0
- package/data/typedoc-md/core/classes/GrainNode.md +155 -0
- package/data/typedoc-md/core/classes/HemisphereLight.md +795 -0
- package/data/typedoc-md/core/classes/InstancedModelRenderer.md +2720 -0
- package/data/typedoc-md/core/classes/KarisBloomNode.md +171 -0
- package/data/typedoc-md/core/classes/LUTResource.md +356 -0
- package/data/typedoc-md/core/classes/Label.md +3086 -0
- package/data/typedoc-md/core/classes/LensFlareNode.md +257 -0
- package/data/typedoc-md/core/classes/LightProbe.md +179 -0
- package/data/typedoc-md/core/classes/LightProbeGroup.md +271 -0
- package/data/typedoc-md/core/classes/LinearPicker.md +263 -0
- package/data/typedoc-md/core/classes/Logger.md +151 -0
- package/data/typedoc-md/core/classes/MaterialResource.md +397 -0
- package/data/typedoc-md/core/classes/MemoryEstimator.md +290 -0
- package/data/typedoc-md/core/classes/MeshRenderer.md +2581 -0
- package/data/typedoc-md/core/classes/MinMaxCurve.md +392 -0
- package/data/typedoc-md/core/classes/MinMaxGradient.md +385 -0
- package/data/typedoc-md/core/classes/ModelRenderer.md +2715 -0
- package/data/typedoc-md/core/classes/Module.md +269 -0
- package/data/typedoc-md/core/classes/OrbitControls.md +2015 -0
- package/data/typedoc-md/core/classes/OrthographicCamera.md +1505 -0
- package/data/typedoc-md/core/classes/ParallelLight.md +941 -0
- package/data/typedoc-md/core/classes/PerspectiveCamera.md +1525 -0
- package/data/typedoc-md/core/classes/Picker.md +209 -0
- package/data/typedoc-md/core/classes/PointLight.md +1108 -0
- package/data/typedoc-md/core/classes/Queue.md +159 -0
- package/data/typedoc-md/core/classes/Random.md +140 -0
- package/data/typedoc-md/core/classes/RectAreaLight.md +1048 -0
- package/data/typedoc-md/core/classes/RectangleCulling.md +310 -0
- package/data/typedoc-md/core/classes/RenderDebugInfo.md +144 -0
- package/data/typedoc-md/core/classes/Renderer.md +2324 -0
- package/data/typedoc-md/core/classes/Resource.md +313 -0
- package/data/typedoc-md/core/classes/ResourceManager.md +1214 -0
- package/data/typedoc-md/core/classes/ResourceRef.md +124 -0
- package/data/typedoc-md/core/classes/SDFGlyphGenerator.md +183 -0
- package/data/typedoc-md/core/classes/SSFNode.md +377 -0
- package/data/typedoc-md/core/classes/Scene.md +1089 -0
- package/data/typedoc-md/core/classes/SceneCoordinateSystem.md +442 -0
- package/data/typedoc-md/core/classes/SceneRenderer.md +409 -0
- package/data/typedoc-md/core/classes/Script.md +934 -0
- package/data/typedoc-md/core/classes/ScriptableSceneRenderer.md +540 -0
- package/data/typedoc-md/core/classes/ShaderChunk.md +93 -0
- package/data/typedoc-md/core/classes/SkyBackground.md +157 -0
- package/data/typedoc-md/core/classes/SolidColorBackground.md +117 -0
- package/data/typedoc-md/core/classes/SpotLight.md +1324 -0
- package/data/typedoc-md/core/classes/TaskController.md +249 -0
- package/data/typedoc-md/core/classes/TextureAtlas.md +173 -0
- package/data/typedoc-md/core/classes/TextureBackground.md +174 -0
- package/data/typedoc-md/core/classes/TextureResource.md +358 -0
- package/data/typedoc-md/core/classes/TiltedViewClipPlaneEstimator.md +591 -0
- package/data/typedoc-md/core/classes/TopDownClipPlaneEstimator.md +512 -0
- package/data/typedoc-md/core/classes/Transform.md +1893 -0
- package/data/typedoc-md/core/classes/UniformsLib.md +189 -0
- package/data/typedoc-md/core/classes/UpdateFlag.md +111 -0
- package/data/typedoc-md/core/classes/UpdateFlagManager.md +223 -0
- package/data/typedoc-md/core/classes/ValueNoise.md +164 -0
- package/data/typedoc-md/core/classes/WebGLEngine.md +1166 -0
- package/data/typedoc-md/core/classes/WebGPUEngine.md +1154 -0
- package/data/typedoc-md/core/classes/WorkerCrashedError.md +93 -0
- package/data/typedoc-md/core/classes/WorkerDefinitionNotFoundError.md +49 -0
- package/data/typedoc-md/core/classes/WorkerManager.md +266 -0
- package/data/typedoc-md/core/classes/WorkerPool.md +93 -0
- package/data/typedoc-md/core/classes/WorkerPoolDisposedError.md +49 -0
- package/data/typedoc-md/core/classes/WorkerRegistry.md +162 -0
- package/data/typedoc-md/core/classes/WorkerTaskAbortedError.md +55 -0
- package/data/typedoc-md/core/classes/WorkerTaskExecutionError.md +114 -0
- package/data/typedoc-md/core/classes/WorkerTaskTimeoutError.md +61 -0
- package/data/typedoc-md/core/enumerations/BackgroundType.md +45 -0
- package/data/typedoc-md/core/enumerations/CommandHistoryEventType.md +63 -0
- package/data/typedoc-md/core/enumerations/DependentMode.md +29 -0
- package/data/typedoc-md/core/enumerations/EasingName.md +632 -0
- package/data/typedoc-md/core/enumerations/EventType.md +153 -0
- package/data/typedoc-md/core/enumerations/GradientMode.md +48 -0
- package/data/typedoc-md/core/enumerations/HorizontalOrigin.md +39 -0
- package/data/typedoc-md/core/enumerations/InterpolationMode.md +67 -0
- package/data/typedoc-md/core/enumerations/LogLevel.md +63 -0
- package/data/typedoc-md/core/enumerations/MinMaxCurveMode.md +67 -0
- package/data/typedoc-md/core/enumerations/MinMaxGradientMode.md +101 -0
- package/data/typedoc-md/core/enumerations/Priority.md +45 -0
- package/data/typedoc-md/core/enumerations/QueryMask.md +360 -0
- package/data/typedoc-md/core/enumerations/RenderOrder.md +43 -0
- package/data/typedoc-md/core/enumerations/TextAlign.md +45 -0
- package/data/typedoc-md/core/enumerations/VerticalOrigin.md +39 -0
- package/data/typedoc-md/core/enumerations/WeightedMode.md +81 -0
- package/data/typedoc-md/core/enumerations/WrapMode.md +100 -0
- package/data/typedoc-md/core/functions/assert.md +37 -0
- package/data/typedoc-md/core/functions/autoExposure.md +40 -0
- package/data/typedoc-md/core/functions/backIn.md +33 -0
- package/data/typedoc-md/core/functions/backInOut.md +34 -0
- package/data/typedoc-md/core/functions/backOut.md +33 -0
- package/data/typedoc-md/core/functions/bounceIn.md +33 -0
- package/data/typedoc-md/core/functions/bounceInOut.md +33 -0
- package/data/typedoc-md/core/functions/bounceOut.md +32 -0
- package/data/typedoc-md/core/functions/circIn.md +33 -0
- package/data/typedoc-md/core/functions/circInOut.md +34 -0
- package/data/typedoc-md/core/functions/circOut.md +33 -0
- package/data/typedoc-md/core/functions/collectMaterialTextureBindings.md +40 -0
- package/data/typedoc-md/core/functions/collectTransferables.md +37 -0
- package/data/typedoc-md/core/functions/colorGrading.md +31 -0
- package/data/typedoc-md/core/functions/constant.md +24 -0
- package/data/typedoc-md/core/functions/createErrorEnvelope.md +41 -0
- package/data/typedoc-md/core/functions/createEventEnvelope.md +50 -0
- package/data/typedoc-md/core/functions/createRequestEnvelope.md +47 -0
- package/data/typedoc-md/core/functions/createResultEnvelope.md +47 -0
- package/data/typedoc-md/core/functions/createTextureLoader.md +29 -0
- package/data/typedoc-md/core/functions/createWorkerEndpoint.md +54 -0
- package/data/typedoc-md/core/functions/createWorkerTransferResult.md +41 -0
- package/data/typedoc-md/core/functions/cubicIn.md +32 -0
- package/data/typedoc-md/core/functions/cubicInOut.md +32 -0
- package/data/typedoc-md/core/functions/cubicOut.md +32 -0
- package/data/typedoc-md/core/functions/curlNoise2D.md +38 -0
- package/data/typedoc-md/core/functions/curlNoise3D.md +39 -0
- package/data/typedoc-md/core/functions/defaultValue.md +35 -0
- package/data/typedoc-md/core/functions/defined.md +35 -0
- package/data/typedoc-md/core/functions/dependentComponents.md +79 -0
- package/data/typedoc-md/core/functions/deserializeError.md +41 -0
- package/data/typedoc-md/core/functions/dither.md +34 -0
- package/data/typedoc-md/core/functions/elasticIn.md +34 -0
- package/data/typedoc-md/core/functions/elasticInOut.md +34 -0
- package/data/typedoc-md/core/functions/elasticOut.md +34 -0
- package/data/typedoc-md/core/functions/expoIn.md +32 -0
- package/data/typedoc-md/core/functions/expoInOut.md +33 -0
- package/data/typedoc-md/core/functions/expoOut.md +32 -0
- package/data/typedoc-md/core/functions/fade.md +33 -0
- package/data/typedoc-md/core/functions/fbm.md +39 -0
- package/data/typedoc-md/core/functions/getEasingFunction.md +39 -0
- package/data/typedoc-md/core/functions/grain.md +34 -0
- package/data/typedoc-md/core/functions/isWorkerMessageEnvelope.md +29 -0
- package/data/typedoc-md/core/functions/isWorkerTransferResult.md +35 -0
- package/data/typedoc-md/core/functions/karisBloom.md +33 -0
- package/data/typedoc-md/core/functions/lensFlare.md +52 -0
- package/data/typedoc-md/core/functions/linear.md +32 -0
- package/data/typedoc-md/core/functions/normalizePositiveNumber.md +33 -0
- package/data/typedoc-md/core/functions/packUnorm16.md +32 -0
- package/data/typedoc-md/core/functions/packUnorm8.md +32 -0
- package/data/typedoc-md/core/functions/pingPong.md +38 -0
- package/data/typedoc-md/core/functions/pixelHash.md +50 -0
- package/data/typedoc-md/core/functions/propertyChanged.md +29 -0
- package/data/typedoc-md/core/functions/pseudoRandom.md +29 -0
- package/data/typedoc-md/core/functions/pseudoRandomRange.md +41 -0
- package/data/typedoc-md/core/functions/pseudoRandomRangeInt.md +41 -0
- package/data/typedoc-md/core/functions/quadIn.md +32 -0
- package/data/typedoc-md/core/functions/quadInOut.md +32 -0
- package/data/typedoc-md/core/functions/quadOut.md +32 -0
- package/data/typedoc-md/core/functions/quartIn.md +32 -0
- package/data/typedoc-md/core/functions/quartInOut.md +32 -0
- package/data/typedoc-md/core/functions/quartOut.md +32 -0
- package/data/typedoc-md/core/functions/quickSort.md +51 -0
- package/data/typedoc-md/core/functions/quintIn.md +32 -0
- package/data/typedoc-md/core/functions/quintInOut.md +32 -0
- package/data/typedoc-md/core/functions/quintOut.md +32 -0
- package/data/typedoc-md/core/functions/random.md +21 -0
- package/data/typedoc-md/core/functions/randomRange.md +35 -0
- package/data/typedoc-md/core/functions/randomRangeInt.md +35 -0
- package/data/typedoc-md/core/functions/removeFromArray.md +35 -0
- package/data/typedoc-md/core/functions/repeat.md +38 -0
- package/data/typedoc-md/core/functions/ridgedNoise.md +38 -0
- package/data/typedoc-md/core/functions/serializeError.md +31 -0
- package/data/typedoc-md/core/functions/setRandomFunc.md +35 -0
- package/data/typedoc-md/core/functions/sineIn.md +32 -0
- package/data/typedoc-md/core/functions/sineInOut.md +32 -0
- package/data/typedoc-md/core/functions/sineOut.md +32 -0
- package/data/typedoc-md/core/functions/smooth.md +33 -0
- package/data/typedoc-md/core/functions/ssf.md +39 -0
- package/data/typedoc-md/core/interfaces/AmbientLightParams.md +79 -0
- package/data/typedoc-md/core/interfaces/AnimationParams.md +67 -0
- package/data/typedoc-md/core/interfaces/AnnotationParams.md +242 -0
- package/data/typedoc-md/core/interfaces/BackgroundParams.md +53 -0
- package/data/typedoc-md/core/interfaces/CameraParams.md +238 -0
- package/data/typedoc-md/core/interfaces/ClipPlaneRange.md +86 -0
- package/data/typedoc-md/core/interfaces/ClipPlaneUpdaterParams.md +95 -0
- package/data/typedoc-md/core/interfaces/CloudSample.md +94 -0
- package/data/typedoc-md/core/interfaces/CommandHistoryEvent.md +43 -0
- package/data/typedoc-md/core/interfaces/CommandHistoryParams.md +29 -0
- package/data/typedoc-md/core/interfaces/ComponentParams.md +60 -0
- package/data/typedoc-md/core/interfaces/ComputeInfo.md +43 -0
- package/data/typedoc-md/core/interfaces/ControlsParams.md +80 -0
- package/data/typedoc-md/core/interfaces/CreateTaskOptions.md +105 -0
- package/data/typedoc-md/core/interfaces/DebugInfo.md +71 -0
- package/data/typedoc-md/core/interfaces/DirectionalLightParams.md +135 -0
- package/data/typedoc-md/core/interfaces/EngineParams.md +71 -0
- package/data/typedoc-md/core/interfaces/EntityParams.md +75 -0
- package/data/typedoc-md/core/interfaces/EnvironmentParams.md +81 -0
- package/data/typedoc-md/core/interfaces/FogParams.md +118 -0
- package/data/typedoc-md/core/interfaces/FramebufferCaptureParams.md +73 -0
- package/data/typedoc-md/core/interfaces/GLTFParserParams.md +188 -0
- package/data/typedoc-md/core/interfaces/GlyphAtlasBlock.md +87 -0
- package/data/typedoc-md/core/interfaces/GlyphAtlasParams.md +89 -0
- package/data/typedoc-md/core/interfaces/HemisphereLightParams.md +93 -0
- package/data/typedoc-md/core/interfaces/IClipPlaneEstimator.md +93 -0
- package/data/typedoc-md/core/interfaces/InstancedGLTFParserParams.md +177 -0
- package/data/typedoc-md/core/interfaces/InstancedModelRendererParams.md +203 -0
- package/data/typedoc-md/core/interfaces/LabelImageParams.md +119 -0
- package/data/typedoc-md/core/interfaces/LabelParams.md +374 -0
- package/data/typedoc-md/core/interfaces/LabelTextOutlineParams.md +49 -0
- package/data/typedoc-md/core/interfaces/LabelTextParams.md +153 -0
- package/data/typedoc-md/core/interfaces/LightProbeGroupParams.md +200 -0
- package/data/typedoc-md/core/interfaces/LightProbeParams.md +72 -0
- package/data/typedoc-md/core/interfaces/LightShadowParams.md +137 -0
- package/data/typedoc-md/core/interfaces/MaterialTextureBinding.md +86 -0
- package/data/typedoc-md/core/interfaces/MemoryEstimateOptions.md +46 -0
- package/data/typedoc-md/core/interfaces/MemoryInfo.md +155 -0
- package/data/typedoc-md/core/interfaces/MemoryUsage.md +94 -0
- package/data/typedoc-md/core/interfaces/MemoryUsageBreakdown.md +59 -0
- package/data/typedoc-md/core/interfaces/MeshRendererParams.md +157 -0
- package/data/typedoc-md/core/interfaces/ModelRendererParams.md +188 -0
- package/data/typedoc-md/core/interfaces/ModuleParams.md +21 -0
- package/data/typedoc-md/core/interfaces/OrbitControlsParams.md +549 -0
- package/data/typedoc-md/core/interfaces/OrthographicCameraParams.md +299 -0
- package/data/typedoc-md/core/interfaces/ParallelLightParams.md +122 -0
- package/data/typedoc-md/core/interfaces/PendingWorkerTask.md +49 -0
- package/data/typedoc-md/core/interfaces/PerspectiveCameraParams.md +299 -0
- package/data/typedoc-md/core/interfaces/PickResult.md +53 -0
- package/data/typedoc-md/core/interfaces/PickerParams.md +27 -0
- package/data/typedoc-md/core/interfaces/PointLightParams.md +177 -0
- package/data/typedoc-md/core/interfaces/RectAreaLightParams.md +177 -0
- package/data/typedoc-md/core/interfaces/RectangleCullingItem.md +123 -0
- package/data/typedoc-md/core/interfaces/RectangleCullingParticipant.md +59 -0
- package/data/typedoc-md/core/interfaces/RectangleCullingRect.md +92 -0
- package/data/typedoc-md/core/interfaces/RenderInfo.md +99 -0
- package/data/typedoc-md/core/interfaces/RenderParams.md +117 -0
- package/data/typedoc-md/core/interfaces/RendererParams.md +120 -0
- package/data/typedoc-md/core/interfaces/ResourceManagerMemoryStats.md +141 -0
- package/data/typedoc-md/core/interfaces/ResourceManagerParams.md +85 -0
- package/data/typedoc-md/core/interfaces/SDFFont.md +85 -0
- package/data/typedoc-md/core/interfaces/SDFGlyph.md +130 -0
- package/data/typedoc-md/core/interfaces/SDFGlyphGeneratorParams.md +55 -0
- package/data/typedoc-md/core/interfaces/SRSDescriptor.md +50 -0
- package/data/typedoc-md/core/interfaces/SceneParams.md +145 -0
- package/data/typedoc-md/core/interfaces/ScriptableSceneRendererParams.md +105 -0
- package/data/typedoc-md/core/interfaces/SerializedWorkerError.md +74 -0
- package/data/typedoc-md/core/interfaces/SpotLightParams.md +219 -0
- package/data/typedoc-md/core/interfaces/TextureAtlasBlock.md +59 -0
- package/data/typedoc-md/core/interfaces/TextureAtlasParams.md +75 -0
- package/data/typedoc-md/core/interfaces/TextureBackgroundParams.md +81 -0
- package/data/typedoc-md/core/interfaces/TiltedViewClipPlaneEstimatorParams.md +231 -0
- package/data/typedoc-md/core/interfaces/TopDownClipPlaneEstimatorParams.md +180 -0
- package/data/typedoc-md/core/interfaces/TransformParams.md +135 -0
- package/data/typedoc-md/core/interfaces/Transformation.md +85 -0
- package/data/typedoc-md/core/interfaces/WebGLParams.md +161 -0
- package/data/typedoc-md/core/interfaces/WebGPUParams.md +181 -0
- package/data/typedoc-md/core/interfaces/WorkerDefinition.md +134 -0
- package/data/typedoc-md/core/interfaces/WorkerEndpointContext.md +88 -0
- package/data/typedoc-md/core/interfaces/WorkerLease.md +71 -0
- package/data/typedoc-md/core/interfaces/WorkerManagerLike.md +167 -0
- package/data/typedoc-md/core/interfaces/WorkerManagerOptions.md +73 -0
- package/data/typedoc-md/core/interfaces/WorkerMessageEnvelope.md +109 -0
- package/data/typedoc-md/core/interfaces/WorkerRunOptions.md +43 -0
- package/data/typedoc-md/core/interfaces/WorkerTaskRequest.md +80 -0
- package/data/typedoc-md/core/interfaces/WorkerTransferResult.md +69 -0
- package/data/typedoc-md/core/type-aliases/ComponentConstructor.md +37 -0
- package/data/typedoc-md/core/type-aliases/ComponentCtor.md +43 -0
- package/data/typedoc-md/core/type-aliases/IsOptional.md +25 -0
- package/data/typedoc-md/core/type-aliases/MaterialTextureBindingKind.md +15 -0
- package/data/typedoc-md/core/type-aliases/ModuleConstructor.md +40 -0
- package/data/typedoc-md/core/type-aliases/ModuleCtor.md +46 -0
- package/data/typedoc-md/core/type-aliases/PickerConstructor.md +37 -0
- package/data/typedoc-md/core/type-aliases/PickerCtor.md +45 -0
- package/data/typedoc-md/core/type-aliases/ScriptableRenderCallback.md +31 -0
- package/data/typedoc-md/core/type-aliases/SkyBackgroundParams.md +15 -0
- package/data/typedoc-md/core/type-aliases/SubscriberCallbackFn.md +28 -0
- package/data/typedoc-md/core/type-aliases/WorkerEndpointHandler.md +43 -0
- package/data/typedoc-md/core/type-aliases/WorkerFactory.md +23 -0
- package/data/typedoc-md/core/type-aliases/WorkerMessageKind.md +17 -0
- package/data/typedoc-md/core/type-aliases/WorkerStrategy.md +22 -0
- package/data/typedoc-md/core/variables/CORE_VERSION.md +11 -0
- package/data/typedoc-md/core/variables/DEV.md +13 -0
- package/data/typedoc-md/core/variables/EARTH_MAX_BUILDING_HEIGHT.md +17 -0
- package/data/typedoc-md/core/variables/EARTH_PERIMETER.md +19 -0
- package/data/typedoc-md/core/variables/EARTH_RADIUS.md +17 -0
- package/data/typedoc-md/core/variables/EPSILON.md +21 -0
- package/data/typedoc-md/core/variables/WORKER_TRANSFER_RESULT.md +18 -0
- package/data/typedoc-md/core/variables/backOutIn.md +34 -0
- package/data/typedoc-md/core/variables/bounceOutIn.md +34 -0
- package/data/typedoc-md/core/variables/circOutIn.md +34 -0
- package/data/typedoc-md/core/variables/cubicOutIn.md +34 -0
- package/data/typedoc-md/core/variables/elasticOutIn.md +34 -0
- package/data/typedoc-md/core/variables/expoOutIn.md +34 -0
- package/data/typedoc-md/core/variables/fbmValueNoise.md +27 -0
- package/data/typedoc-md/core/variables/hash2d.md +28 -0
- package/data/typedoc-md/core/variables/perlinNoise2D.md +28 -0
- package/data/typedoc-md/core/variables/perlinNoise3D.md +28 -0
- package/data/typedoc-md/core/variables/permute.md +27 -0
- package/data/typedoc-md/core/variables/quadOutIn.md +34 -0
- package/data/typedoc-md/core/variables/quartOutIn.md +34 -0
- package/data/typedoc-md/core/variables/quintOutIn.md +34 -0
- package/data/typedoc-md/core/variables/random01.md +25 -0
- package/data/typedoc-md/core/variables/randomGradient.md +25 -0
- package/data/typedoc-md/core/variables/randomGradient3D.md +27 -0
- package/data/typedoc-md/core/variables/randomRangeFn.md +37 -0
- package/data/typedoc-md/core/variables/randomVec2.md +25 -0
- package/data/typedoc-md/core/variables/randomVec3.md +25 -0
- package/data/typedoc-md/core/variables/simplexNoise2D.md +27 -0
- package/data/typedoc-md/core/variables/simplexNoise3D.md +27 -0
- package/data/typedoc-md/core/variables/sineOutIn.md +34 -0
- package/data/typedoc-md/core/variables/valueNoise2D.md +27 -0
- package/data/typedoc-md/core/variables/valueNoise3D.md +28 -0
- package/data/typedoc-md/core/variables/whiteNoise2D.md +27 -0
- package/data/typedoc-md/core/variables/whiteNoise3D.md +27 -0
- package/data/typedoc-md/core/variables/worleyNoise2D.md +27 -0
- package/data/typedoc-md/core/variables/worleyNoise3D.md +28 -0
- package/data/typedoc-md/particlesystem/README.md +271 -0
- package/data/typedoc-md/particlesystem/classes/BillboardParticleRenderer.md +1242 -0
- package/data/typedoc-md/particlesystem/classes/BuoyancyBlock.md +527 -0
- package/data/typedoc-md/particlesystem/classes/CollisionBoxBlock.md +824 -0
- package/data/typedoc-md/particlesystem/classes/CollisionCylinderBlock.md +908 -0
- package/data/typedoc-md/particlesystem/classes/CollisionModule.md +661 -0
- package/data/typedoc-md/particlesystem/classes/CollisionPlaneBlock.md +825 -0
- package/data/typedoc-md/particlesystem/classes/CollisionSphereBlock.md +825 -0
- package/data/typedoc-md/particlesystem/classes/ColorBySpeedModule.md +303 -0
- package/data/typedoc-md/particlesystem/classes/ColorOverLifetimeModule.md +288 -0
- package/data/typedoc-md/particlesystem/classes/ConformSphereBlock.md +652 -0
- package/data/typedoc-md/particlesystem/classes/EmissionModule.md +393 -0
- package/data/typedoc-md/particlesystem/classes/EmitContext.md +725 -0
- package/data/typedoc-md/particlesystem/classes/EventSpawnContext.md +367 -0
- package/data/typedoc-md/particlesystem/classes/FlipbookPlayerBlock.md +924 -0
- package/data/typedoc-md/particlesystem/classes/ForceBlock.md +568 -0
- package/data/typedoc-md/particlesystem/classes/ForceOverLifetimeModule.md +457 -0
- package/data/typedoc-md/particlesystem/classes/GravityBlock.md +414 -0
- package/data/typedoc-md/particlesystem/classes/InheritVelocityModule.md +348 -0
- package/data/typedoc-md/particlesystem/classes/KillByAgeBlock.md +402 -0
- package/data/typedoc-md/particlesystem/classes/KillByBoxBlock.md +526 -0
- package/data/typedoc-md/particlesystem/classes/KillByCylinderBlock.md +610 -0
- package/data/typedoc-md/particlesystem/classes/KillByPlaneBlock.md +526 -0
- package/data/typedoc-md/particlesystem/classes/KillBySphereBlock.md +525 -0
- package/data/typedoc-md/particlesystem/classes/LifetimeByEmitterSpeedModule.md +358 -0
- package/data/typedoc-md/particlesystem/classes/LightsModule.md +570 -0
- package/data/typedoc-md/particlesystem/classes/LimitVelocityOverLifetimeModule.md +657 -0
- package/data/typedoc-md/particlesystem/classes/LinearDragBlock.md +486 -0
- package/data/typedoc-md/particlesystem/classes/MainModule.md +1216 -0
- package/data/typedoc-md/particlesystem/classes/MeshOutputContext.md +691 -0
- package/data/typedoc-md/particlesystem/classes/MeshParticleRenderer.md +552 -0
- package/data/typedoc-md/particlesystem/classes/MultiplyAngle3DOverLifeBlock.md +441 -0
- package/data/typedoc-md/particlesystem/classes/MultiplyAngleOverLifeBlock.md +413 -0
- package/data/typedoc-md/particlesystem/classes/MultiplyAngularVelocity3DOverLifeBlock.md +441 -0
- package/data/typedoc-md/particlesystem/classes/MultiplyAngularVelocityOverLifeBlock.md +413 -0
- package/data/typedoc-md/particlesystem/classes/MultiplyColorOverLifeBlock.md +456 -0
- package/data/typedoc-md/particlesystem/classes/MultiplyScaleOverLifeBlock.md +441 -0
- package/data/typedoc-md/particlesystem/classes/MultiplySizeOverLifeBlock.md +413 -0
- package/data/typedoc-md/particlesystem/classes/NoiseModule.md +766 -0
- package/data/typedoc-md/particlesystem/classes/NoneParticleRenderer.md +501 -0
- package/data/typedoc-md/particlesystem/classes/OrientAlongVelocityBlock.md +401 -0
- package/data/typedoc-md/particlesystem/classes/OrientFaceCameraPlaneBlock.md +401 -0
- package/data/typedoc-md/particlesystem/classes/OrientFaceCameraPositionBlock.md +402 -0
- package/data/typedoc-md/particlesystem/classes/OrientFixedAxisBlock.md +442 -0
- package/data/typedoc-md/particlesystem/classes/OrientLookAtPositionBlock.md +441 -0
- package/data/typedoc-md/particlesystem/classes/OutputContext.md +489 -0
- package/data/typedoc-md/particlesystem/classes/ParticleModule.md +256 -0
- package/data/typedoc-md/particlesystem/classes/ParticleModuleRegistry.md +95 -0
- package/data/typedoc-md/particlesystem/classes/ParticleRenderer.md +415 -0
- package/data/typedoc-md/particlesystem/classes/ParticleRendererRegistry.md +103 -0
- package/data/typedoc-md/particlesystem/classes/ParticleSystem.md +1056 -0
- package/data/typedoc-md/particlesystem/classes/ParticleSystemFactory.md +98 -0
- package/data/typedoc-md/particlesystem/classes/PointAttractRepelBlock.md +568 -0
- package/data/typedoc-md/particlesystem/classes/QuadOutputContext.md +1524 -0
- package/data/typedoc-md/particlesystem/classes/RotationBySpeedModule.md +516 -0
- package/data/typedoc-md/particlesystem/classes/RotationOverLifetimeModule.md +460 -0
- package/data/typedoc-md/particlesystem/classes/SetAngle3DBlock.md +434 -0
- package/data/typedoc-md/particlesystem/classes/SetAngle3DOverLifeBlock.md +440 -0
- package/data/typedoc-md/particlesystem/classes/SetAngleBlock.md +449 -0
- package/data/typedoc-md/particlesystem/classes/SetAngleOverLifeBlock.md +412 -0
- package/data/typedoc-md/particlesystem/classes/SetAngularVelocity3DBlock.md +439 -0
- package/data/typedoc-md/particlesystem/classes/SetAngularVelocity3DOverLifeBlock.md +441 -0
- package/data/typedoc-md/particlesystem/classes/SetAngularVelocityBlock.md +407 -0
- package/data/typedoc-md/particlesystem/classes/SetAngularVelocityOverLifeBlock.md +413 -0
- package/data/typedoc-md/particlesystem/classes/SetColorBlock.md +404 -0
- package/data/typedoc-md/particlesystem/classes/SetColorBySpeedBlock.md +497 -0
- package/data/typedoc-md/particlesystem/classes/SetColorOverLifeBlock.md +454 -0
- package/data/typedoc-md/particlesystem/classes/SetLifetimeBlock.md +407 -0
- package/data/typedoc-md/particlesystem/classes/SetMassBlock.md +408 -0
- package/data/typedoc-md/particlesystem/classes/SetPositionBlock.md +435 -0
- package/data/typedoc-md/particlesystem/classes/SetSize3DBlock.md +434 -0
- package/data/typedoc-md/particlesystem/classes/SetSizeBlock.md +407 -0
- package/data/typedoc-md/particlesystem/classes/SetSizeBySpeedBlock.md +454 -0
- package/data/typedoc-md/particlesystem/classes/SetSizeOverLifeBlock.md +412 -0
- package/data/typedoc-md/particlesystem/classes/SetVelocityBlock.md +626 -0
- package/data/typedoc-md/particlesystem/classes/SetVelocityTangentBlock.md +628 -0
- package/data/typedoc-md/particlesystem/classes/ShapeModule.md +663 -0
- package/data/typedoc-md/particlesystem/classes/SizeBySpeedModule.md +556 -0
- package/data/typedoc-md/particlesystem/classes/SizeOverLifetimeModule.md +542 -0
- package/data/typedoc-md/particlesystem/classes/SoftBoundaryForceBlock.md +652 -0
- package/data/typedoc-md/particlesystem/classes/SpawnContext.md +355 -0
- package/data/typedoc-md/particlesystem/classes/StripQuadOutputContext.md +1309 -0
- package/data/typedoc-md/particlesystem/classes/SubEmitterBirthInstance.md +104 -0
- package/data/typedoc-md/particlesystem/classes/SubEmittersModule.md +661 -0
- package/data/typedoc-md/particlesystem/classes/TextureSheetAnimationModule.md +641 -0
- package/data/typedoc-md/particlesystem/classes/TrailsModule.md +842 -0
- package/data/typedoc-md/particlesystem/classes/TriggerEventOnCollideBlock.md +448 -0
- package/data/typedoc-md/particlesystem/classes/TriggerEventOnDieBlock.md +447 -0
- package/data/typedoc-md/particlesystem/classes/TurbulenceBlock.md +764 -0
- package/data/typedoc-md/particlesystem/classes/UpdateAngleBlock.md +400 -0
- package/data/typedoc-md/particlesystem/classes/UpdateContext.md +379 -0
- package/data/typedoc-md/particlesystem/classes/UpdatePositionBlock.md +401 -0
- package/data/typedoc-md/particlesystem/classes/VFXBlock.md +357 -0
- package/data/typedoc-md/particlesystem/classes/VFXBlockRegistry.md +177 -0
- package/data/typedoc-md/particlesystem/classes/VFXBlockTypeNotFoundError.md +47 -0
- package/data/typedoc-md/particlesystem/classes/VFXBoxShape.md +686 -0
- package/data/typedoc-md/particlesystem/classes/VFXCircleShape.md +853 -0
- package/data/typedoc-md/particlesystem/classes/VFXConeShape.md +1026 -0
- package/data/typedoc-md/particlesystem/classes/VFXContext.md +317 -0
- package/data/typedoc-md/particlesystem/classes/VFXCurveAtlas.md +142 -0
- package/data/typedoc-md/particlesystem/classes/VFXDynamicBlock.md +449 -0
- package/data/typedoc-md/particlesystem/classes/VFXEdgeShape.md +725 -0
- package/data/typedoc-md/particlesystem/classes/VFXOutputContextRegistry.md +177 -0
- package/data/typedoc-md/particlesystem/classes/VFXOutputContextTypeNotFoundError.md +47 -0
- package/data/typedoc-md/particlesystem/classes/VFXShape.md +551 -0
- package/data/typedoc-md/particlesystem/classes/VFXShapeFactory.md +126 -0
- package/data/typedoc-md/particlesystem/classes/VFXShapeTypeNotFoundError.md +47 -0
- package/data/typedoc-md/particlesystem/classes/VFXSphereShape.md +896 -0
- package/data/typedoc-md/particlesystem/classes/VFXStaticBlock.md +411 -0
- package/data/typedoc-md/particlesystem/classes/VFXSystem.md +793 -0
- package/data/typedoc-md/particlesystem/classes/VFXSystemFactory.md +139 -0
- package/data/typedoc-md/particlesystem/classes/VFXTorusShape.md +941 -0
- package/data/typedoc-md/particlesystem/classes/VectorFieldForceBlock.md +596 -0
- package/data/typedoc-md/particlesystem/classes/VelocityOverLifetimeModule.md +910 -0
- package/data/typedoc-md/particlesystem/classes/VortexForceBlock.md +654 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleBlendingMode.md +83 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleColorCombineMode.md +97 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemAnimationRowMode.md +41 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemAnimationTimeMode.md +55 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemAnimationType.md +41 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemBillboardMode.md +69 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemBoxShapeEmitFrom.md +55 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemConeShapeEmitFrom.md +55 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemInheritVelocityMode.md +43 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemMeshShapeType.md +55 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemNoiseQuality.md +55 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemRandomSeeds.md +392 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemRenderMode.md +56 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemScalingMode.md +44 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemShapeMultiModeValue.md +69 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemShapeType.md +139 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemSimulationSpace.md +44 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemSortMode.md +86 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemSubEmitterInheritFlags.md +114 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemSubEmitterType.md +69 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemTrailMode.md +41 -0
- package/data/typedoc-md/particlesystem/enumerations/ParticleSystemTrailTextureMode.md +69 -0
- package/data/typedoc-md/particlesystem/enumerations/QuadBlendingMode.md +83 -0
- package/data/typedoc-md/particlesystem/enumerations/QuadColorCombineMode.md +97 -0
- package/data/typedoc-md/particlesystem/enumerations/QuadUvMode.md +89 -0
- package/data/typedoc-md/particlesystem/enumerations/StripQuadUvMode.md +58 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXBlockMode.md +41 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXCollisionMode.md +41 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXCollisionRadiusMode.md +55 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXColorMode.md +57 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXConeShapeHeightMode.md +41 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXContextType.md +115 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXDataType.md +41 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXFlipbookAnimationRange.md +74 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXFlipbookCyclesMode.md +55 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXFlipbookFrameRateMode.md +69 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXFlipbookPlayMode.md +41 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXForceFalloff.md +41 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXForceMode.md +41 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXKillBoundsMode.md +41 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXNoiseType.md +55 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXShapePositionMode.md +69 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXShapeSpawnMode.md +41 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXSimulationSpace.md +44 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXSoftBoundaryShape.md +41 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXSortMode.md +87 -0
- package/data/typedoc-md/particlesystem/enumerations/VFXVelocityCompositionMode.md +69 -0
- package/data/typedoc-md/particlesystem/interfaces/Angle3DOverLifeBlockParams.md +88 -0
- package/data/typedoc-md/particlesystem/interfaces/AngleOverLifeBlockParams.md +60 -0
- package/data/typedoc-md/particlesystem/interfaces/AngularVelocity3DOverLifeBlockParams.md +88 -0
- package/data/typedoc-md/particlesystem/interfaces/AngularVelocityOverLifeBlockParams.md +60 -0
- package/data/typedoc-md/particlesystem/interfaces/BillboardParticleRendererParams.md +511 -0
- package/data/typedoc-md/particlesystem/interfaces/BuoyancyBlockParams.md +104 -0
- package/data/typedoc-md/particlesystem/interfaces/CollisionBoxBlockParams.md +278 -0
- package/data/typedoc-md/particlesystem/interfaces/CollisionCylinderBlockParams.md +318 -0
- package/data/typedoc-md/particlesystem/interfaces/CollisionPlaneBlockParams.md +278 -0
- package/data/typedoc-md/particlesystem/interfaces/CollisionSphereBlockParams.md +278 -0
- package/data/typedoc-md/particlesystem/interfaces/ColorOverLifeBlockParams.md +86 -0
- package/data/typedoc-md/particlesystem/interfaces/ConformSphereBlockParams.md +164 -0
- package/data/typedoc-md/particlesystem/interfaces/CustomParticleRendererParams.md +93 -0
- package/data/typedoc-md/particlesystem/interfaces/EmissionEmitContext.md +156 -0
- package/data/typedoc-md/particlesystem/interfaces/FlipbookPlayerBlockParams.md +307 -0
- package/data/typedoc-md/particlesystem/interfaces/ForceBlockParams.md +124 -0
- package/data/typedoc-md/particlesystem/interfaces/GravityBlockParams.md +64 -0
- package/data/typedoc-md/particlesystem/interfaces/KillByBoxBlockParams.md +104 -0
- package/data/typedoc-md/particlesystem/interfaces/KillByCylinderBlockParams.md +144 -0
- package/data/typedoc-md/particlesystem/interfaces/KillByPlaneBlockParams.md +104 -0
- package/data/typedoc-md/particlesystem/interfaces/KillBySphereBlockParams.md +104 -0
- package/data/typedoc-md/particlesystem/interfaces/LinearDragBlockParams.md +84 -0
- package/data/typedoc-md/particlesystem/interfaces/MeshOutputContextParams.md +129 -0
- package/data/typedoc-md/particlesystem/interfaces/MeshParticleRendererParams.md +139 -0
- package/data/typedoc-md/particlesystem/interfaces/MultiplyScaleOverLifeBlockParams.md +106 -0
- package/data/typedoc-md/particlesystem/interfaces/NoneParticleRendererParams.md +82 -0
- package/data/typedoc-md/particlesystem/interfaces/OrientFixedAxisBlockParams.md +64 -0
- package/data/typedoc-md/particlesystem/interfaces/OrientLookAtPositionBlockParams.md +64 -0
- package/data/typedoc-md/particlesystem/interfaces/ParticleBlendingOptions.md +127 -0
- package/data/typedoc-md/particlesystem/interfaces/ParticleLightParams.md +59 -0
- package/data/typedoc-md/particlesystem/interfaces/ParticleRendererParams.md +63 -0
- package/data/typedoc-md/particlesystem/interfaces/ParticleSystemModuleParams.md +375 -0
- package/data/typedoc-md/particlesystem/interfaces/ParticleSystemParams.md +137 -0
- package/data/typedoc-md/particlesystem/interfaces/PointAttractRepelBlockParams.md +124 -0
- package/data/typedoc-md/particlesystem/interfaces/QuadBlendingOptions.md +127 -0
- package/data/typedoc-md/particlesystem/interfaces/QuadOutputContextParams.md +496 -0
- package/data/typedoc-md/particlesystem/interfaces/SetAngle3DBlockParams.md +104 -0
- package/data/typedoc-md/particlesystem/interfaces/SetAngleBlockParams.md +84 -0
- package/data/typedoc-md/particlesystem/interfaces/SetAngularVelocity3DBlockParams.md +104 -0
- package/data/typedoc-md/particlesystem/interfaces/SetAngularVelocityBlockParams.md +64 -0
- package/data/typedoc-md/particlesystem/interfaces/SetColorBlockParams.md +58 -0
- package/data/typedoc-md/particlesystem/interfaces/SetColorBySpeedBlockParams.md +106 -0
- package/data/typedoc-md/particlesystem/interfaces/SetLifetimeBlockParams.md +64 -0
- package/data/typedoc-md/particlesystem/interfaces/SetMassBlockParams.md +64 -0
- package/data/typedoc-md/particlesystem/interfaces/SetPositionBlockParams.md +58 -0
- package/data/typedoc-md/particlesystem/interfaces/SetSize3DBlockParams.md +104 -0
- package/data/typedoc-md/particlesystem/interfaces/SetSizeBlockParams.md +64 -0
- package/data/typedoc-md/particlesystem/interfaces/SetSizeBySpeedBlockParams.md +86 -0
- package/data/typedoc-md/particlesystem/interfaces/SetVelocityBlockParams.md +164 -0
- package/data/typedoc-md/particlesystem/interfaces/SetVelocityTangentBlockParams.md +165 -0
- package/data/typedoc-md/particlesystem/interfaces/SizeOverLifeBlockParams.md +66 -0
- package/data/typedoc-md/particlesystem/interfaces/SoftBoundaryForceBlockParams.md +164 -0
- package/data/typedoc-md/particlesystem/interfaces/StripQuadOutputContextParams.md +395 -0
- package/data/typedoc-md/particlesystem/interfaces/SubEmitter.md +73 -0
- package/data/typedoc-md/particlesystem/interfaces/SubEmitterInheritProperties.md +167 -0
- package/data/typedoc-md/particlesystem/interfaces/TrailsModuleParams.md +313 -0
- package/data/typedoc-md/particlesystem/interfaces/TriggerEventOnCollideBlockParams.md +67 -0
- package/data/typedoc-md/particlesystem/interfaces/TriggerEventOnDieBlockParams.md +67 -0
- package/data/typedoc-md/particlesystem/interfaces/TurbulenceBlockParams.md +224 -0
- package/data/typedoc-md/particlesystem/interfaces/VFXBlockParams.md +79 -0
- package/data/typedoc-md/particlesystem/interfaces/VFXBoxShapeParams.md +214 -0
- package/data/typedoc-md/particlesystem/interfaces/VFXBurstRule.md +87 -0
- package/data/typedoc-md/particlesystem/interfaces/VFXCPUEvent.md +77 -0
- package/data/typedoc-md/particlesystem/interfaces/VFXCircleShapeParams.md +306 -0
- package/data/typedoc-md/particlesystem/interfaces/VFXConeShapeParams.md +387 -0
- package/data/typedoc-md/particlesystem/interfaces/VFXCurveSlot.md +59 -0
- package/data/typedoc-md/particlesystem/interfaces/VFXCurveSlots.md +37 -0
- package/data/typedoc-md/particlesystem/interfaces/VFXEdgeShapeParams.md +223 -0
- package/data/typedoc-md/particlesystem/interfaces/VFXOutputShade.md +145 -0
- package/data/typedoc-md/particlesystem/interfaces/VFXShapeArcParams.md +82 -0
- package/data/typedoc-md/particlesystem/interfaces/VFXShapeParams.md +140 -0
- package/data/typedoc-md/particlesystem/interfaces/VFXShapeVolumeParams.md +213 -0
- package/data/typedoc-md/particlesystem/interfaces/VFXSphereShapeParams.md +327 -0
- package/data/typedoc-md/particlesystem/interfaces/VFXSystemParams.md +335 -0
- package/data/typedoc-md/particlesystem/interfaces/VFXTorusShapeParams.md +346 -0
- package/data/typedoc-md/particlesystem/interfaces/VectorFieldForceBlockParams.md +147 -0
- package/data/typedoc-md/particlesystem/interfaces/VortexForceBlockParams.md +164 -0
- package/data/typedoc-md/particlesystem/type-aliases/ParticleModuleConstructor.md +33 -0
- package/data/typedoc-md/particlesystem/type-aliases/ParticleRendererConstructor.md +43 -0
- package/data/typedoc-md/particlesystem/type-aliases/ParticleRendererOptions.md +15 -0
- package/data/typedoc-md/particlesystem/type-aliases/VFXBlockCtor.md +53 -0
- package/data/typedoc-md/particlesystem/type-aliases/VFXOutputContextCtor.md +35 -0
- package/data/typedoc-md/particlesystem/type-aliases/VFXOutputContextFactory.md +35 -0
- package/data/typedoc-md/particlesystem/type-aliases/VFXShapeCtor.md +35 -0
- package/data/typedoc-md/particlesystem/type-aliases/VFXSystemTemplate.md +19 -0
- package/data/typedoc-md/particlesystem/variables/DEFAULT_PARTICLE_PER_STRIP_COUNT.md +20 -0
- package/data/typedoc-md/particlesystem/variables/DEFAULT_STRIP_MAX_PARTICLES.md +22 -0
- package/data/typedoc-md/particlesystem/variables/MAX_BURSTS.md +13 -0
- package/data/typedoc-md/particlesystem/variables/MAX_EVENTS.md +13 -0
- package/data/typedoc-md/particlesystem/variables/PARTICLESYSTEM_VERSION.md +13 -0
- package/data/typedoc-md/postprocessing/README.md +20 -0
- package/data/typedoc-md/postprocessing/classes/OffscreenPass.md +184 -0
- package/data/typedoc-md/postprocessing/classes/PostprocessingSceneRenderer.md +330 -0
- package/data/typedoc-md/postprocessing/classes/SSFEffect.md +584 -0
- package/data/typedoc-md/postprocessing/interfaces/PostprocessingSceneRendererParams.md +115 -0
- package/data/typedoc-md/postprocessing/interfaces/ScreenSpaceFogEffectParams.md +420 -0
- package/data/typedoc-md/postprocessing/variables/POSTPROCESSING_VERSION.md +11 -0
- package/dist/server.js +1301 -0
- package/package.json +46 -4
- package/resources/examples/.gitkeep +0 -0
- package/resources/examples/ambient-light.md +47 -0
- package/resources/examples/animation-curve.md +62 -0
- package/resources/examples/animation.md +56 -0
- package/resources/examples/annotation.md +68 -0
- package/resources/examples/auto-exposure-node.md +67 -0
- package/resources/examples/billboard-particle-renderer.md +85 -0
- package/resources/examples/bool-update-flag.md +61 -0
- package/resources/examples/clip-animation-controller.md +76 -0
- package/resources/examples/clip-plane-updater.md +63 -0
- package/resources/examples/color-grading-node.md +59 -0
- package/resources/examples/command-group.md +48 -0
- package/resources/examples/command-history.md +59 -0
- package/resources/examples/command.md +55 -0
- package/resources/examples/components-manager.md +43 -0
- package/resources/examples/controls.md +52 -0
- package/resources/examples/directional-light.md +49 -0
- package/resources/examples/dither-node.md +55 -0
- package/resources/examples/emit-context.md +71 -0
- package/resources/examples/entity.md +47 -0
- package/resources/examples/environment.md +51 -0
- package/resources/examples/event-dispatcher.md +62 -0
- package/resources/examples/event-spawn-context.md +67 -0
- package/resources/examples/geometry-resource.md +50 -0
- package/resources/examples/gltf-parser.md +78 -0
- package/resources/examples/gltf-resource.md +61 -0
- package/resources/examples/glyph-atlas.md +74 -0
- package/resources/examples/gradient.md +70 -0
- package/resources/examples/grain-node.md +57 -0
- package/resources/examples/hemisphere-light.md +49 -0
- package/resources/examples/instanced-model-renderer.md +99 -0
- package/resources/examples/karis-bloom-node.md +56 -0
- package/resources/examples/label.md +77 -0
- package/resources/examples/lens-flare-node.md +65 -0
- package/resources/examples/light-probe-group.md +53 -0
- package/resources/examples/light-probe.md +52 -0
- package/resources/examples/linear-picker.md +50 -0
- package/resources/examples/lut-resource.md +52 -0
- package/resources/examples/material-resource.md +63 -0
- package/resources/examples/memory-estimator.md +81 -0
- package/resources/examples/mesh-output-context.md +69 -0
- package/resources/examples/mesh-particle-renderer.md +71 -0
- package/resources/examples/mesh-renderer.md +49 -0
- package/resources/examples/min-max-curve.md +57 -0
- package/resources/examples/min-max-gradient.md +58 -0
- package/resources/examples/model-renderer.md +83 -0
- package/resources/examples/none-particle-renderer.md +59 -0
- package/resources/examples/offscreen-pass.md +46 -0
- package/resources/examples/orbit-controls.md +51 -0
- package/resources/examples/orthographic-camera.md +49 -0
- package/resources/examples/parallel-light.md +49 -0
- package/resources/examples/particle-module-registry.md +65 -0
- package/resources/examples/particle-renderer-registry.md +72 -0
- package/resources/examples/particle-system-factory.md +60 -0
- package/resources/examples/particle-system.md +85 -0
- package/resources/examples/perspective-camera.md +49 -0
- package/resources/examples/picker.md +58 -0
- package/resources/examples/point-light.md +50 -0
- package/resources/examples/postprocessing-scene-renderer.md +56 -0
- package/resources/examples/quad-output-context.md +75 -0
- package/resources/examples/random.md +57 -0
- package/resources/examples/rect-area-light.md +50 -0
- package/resources/examples/rectangle-culling.md +72 -0
- package/resources/examples/render-debug-info.md +67 -0
- package/resources/examples/renderer.md +53 -0
- package/resources/examples/resource-manager.md +61 -0
- package/resources/examples/resource-ref.md +55 -0
- package/resources/examples/scene-coordinate-system.md +66 -0
- package/resources/examples/scene-renderer.md +48 -0
- package/resources/examples/scene.md +49 -0
- package/resources/examples/script.md +54 -0
- package/resources/examples/scriptable-scene-renderer.md +58 -0
- package/resources/examples/sdf-glyph-generator.md +77 -0
- package/resources/examples/solid-color-background.md +45 -0
- package/resources/examples/spawn-context.md +58 -0
- package/resources/examples/spot-light.md +50 -0
- package/resources/examples/ssf-effect.md +66 -0
- package/resources/examples/ssf-node.md +78 -0
- package/resources/examples/strip-quad-output-context.md +69 -0
- package/resources/examples/sub-emitter-birth-instance.md +73 -0
- package/resources/examples/task-controller.md +66 -0
- package/resources/examples/texture-atlas.md +67 -0
- package/resources/examples/texture-background.md +53 -0
- package/resources/examples/texture-resource.md +53 -0
- package/resources/examples/tilted-view-clip-plane-estimator.md +66 -0
- package/resources/examples/top-down-clip-plane-estimator.md +67 -0
- package/resources/examples/transform.md +52 -0
- package/resources/examples/uniforms-lib.md +75 -0
- package/resources/examples/update-context.md +57 -0
- package/resources/examples/update-flag-manager.md +68 -0
- package/resources/examples/value-noise.md +60 -0
- package/resources/examples/vfx-block-registry.md +76 -0
- package/resources/examples/vfx-box-shape.md +60 -0
- package/resources/examples/vfx-circle-shape.md +62 -0
- package/resources/examples/vfx-cone-shape.md +67 -0
- package/resources/examples/vfx-curve-atlas.md +65 -0
- package/resources/examples/vfx-edge-shape.md +60 -0
- package/resources/examples/vfx-output-context-registry.md +84 -0
- package/resources/examples/vfx-shape-factory.md +63 -0
- package/resources/examples/vfx-sphere-shape.md +61 -0
- package/resources/examples/vfx-system-factory.md +67 -0
- package/resources/examples/vfx-system.md +88 -0
- package/resources/examples/vfx-torus-shape.md +61 -0
- package/resources/examples/webgl-engine.md +52 -0
- package/resources/examples/webgpu-engine.md +53 -0
- package/resources/examples/worker-manager.md +77 -0
- package/resources/examples/worker-pool.md +78 -0
- package/resources/examples/worker-registry.md +70 -0
- package/resources/guides/.gitkeep +0 -0
- package/resources/guides/animation.md +65 -0
- package/resources/guides/annotation.md +63 -0
- package/resources/guides/atlas.md +93 -0
- package/resources/guides/background.md +62 -0
- package/resources/guides/blocks.md +91 -0
- package/resources/guides/camera.md +67 -0
- package/resources/guides/clip-plane.md +60 -0
- package/resources/guides/command.md +81 -0
- package/resources/guides/component-renderer.md +64 -0
- package/resources/guides/component.md +64 -0
- package/resources/guides/contexts.md +100 -0
- package/resources/guides/controls.md +61 -0
- package/resources/guides/coordinate-systems.md +68 -0
- package/resources/guides/culling.md +82 -0
- package/resources/guides/data-structures.md +85 -0
- package/resources/guides/debug.md +76 -0
- package/resources/guides/effect-node.md +84 -0
- package/resources/guides/effect.md +69 -0
- package/resources/guides/engine.md +69 -0
- package/resources/guides/entity.md +57 -0
- package/resources/guides/environment.md +49 -0
- package/resources/guides/estimator.md +74 -0
- package/resources/guides/event.md +60 -0
- package/resources/guides/gltf.md +93 -0
- package/resources/guides/gradient.md +97 -0
- package/resources/guides/instanced-model-renderer.md +92 -0
- package/resources/guides/label.md +79 -0
- package/resources/guides/light-probe.md +81 -0
- package/resources/guides/light.md +82 -0
- package/resources/guides/logger.md +50 -0
- package/resources/guides/material.md +61 -0
- package/resources/guides/math.md +88 -0
- package/resources/guides/memory.md +84 -0
- package/resources/guides/mesh-renderer.md +59 -0
- package/resources/guides/model-renderer.md +78 -0
- package/resources/guides/module.md +97 -0
- package/resources/guides/pass.md +49 -0
- package/resources/guides/pick.md +65 -0
- package/resources/guides/postprocessing.md +56 -0
- package/resources/guides/registry.md +64 -0
- package/resources/guides/resource.md +83 -0
- package/resources/guides/scene.md +90 -0
- package/resources/guides/script.md +63 -0
- package/resources/guides/sdf.md +80 -0
- package/resources/guides/shapes.md +99 -0
- package/resources/guides/shuriken-factory.md +51 -0
- package/resources/guides/shuriken-renderer.md +82 -0
- package/resources/guides/shuriken.md +76 -0
- package/resources/guides/transform.md +60 -0
- package/resources/guides/update-flag.md +80 -0
- package/resources/guides/utils-curve.md +88 -0
- package/resources/guides/value.md +66 -0
- package/resources/guides/vfx-curve.md +74 -0
- package/resources/guides/vfx-factory.md +77 -0
- package/resources/guides/vfx.md +102 -0
- package/resources/guides/worker.md +127 -0
package/dist/server.js
ADDED
|
@@ -0,0 +1,1301 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
5
|
+
import { dirname, resolve } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import MiniSearch from "minisearch";
|
|
8
|
+
import { parse } from "yaml";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
// src/enrich-api.ts
|
|
11
|
+
function missingText(value) {
|
|
12
|
+
return value == null || value.trim().length === 0;
|
|
13
|
+
}
|
|
14
|
+
function pushUnique(list, slug) {
|
|
15
|
+
if (!list.includes(slug)) list.push(slug);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @param classes - api-index classes (same object refs as loader byId)
|
|
19
|
+
* @param guides - parsed guide metas
|
|
20
|
+
* @param examples - parsed example metas
|
|
21
|
+
*/
|
|
22
|
+
function enrichApi(classes, guides, examples) {
|
|
23
|
+
const byId = /* @__PURE__ */ new Map();
|
|
24
|
+
for (const cls of classes) byId.set(cls.id, cls);
|
|
25
|
+
const guideBySlug = /* @__PURE__ */ new Map();
|
|
26
|
+
for (const guide of guides) {
|
|
27
|
+
guideBySlug.set(guide.slug, guide);
|
|
28
|
+
for (const id of guide.relatedApiIds) {
|
|
29
|
+
const cls = byId.get(id);
|
|
30
|
+
if (cls) pushUnique(cls.relatedGuides, guide.slug);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
for (const example of examples) for (const id of example.relatedApiIds) {
|
|
34
|
+
const cls = byId.get(id);
|
|
35
|
+
if (cls) pushUnique(cls.relatedExamples, example.slug);
|
|
36
|
+
}
|
|
37
|
+
for (const cls of classes) {
|
|
38
|
+
if (missingText(cls.description)) {
|
|
39
|
+
let summary = null;
|
|
40
|
+
for (const slug of cls.relatedGuides) {
|
|
41
|
+
const guide = guideBySlug.get(slug);
|
|
42
|
+
if (guide?.summary && guide.summary.trim().length > 0) {
|
|
43
|
+
summary = guide.summary;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
cls.description = summary ?? `(无 JSDoc)详见 vista3d://api/id/${cls.id}`;
|
|
48
|
+
}
|
|
49
|
+
if (missingText(cls.example)) cls.example = `// 无独立 example。请用 get_component_api({ id: '${cls.id}', detail: 'full' }) 查看 TypeDoc 全文。`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// src/search-index.ts
|
|
53
|
+
/**
|
|
54
|
+
* Shared MiniSearch options: build-time `new MiniSearch` and runtime
|
|
55
|
+
* `MiniSearch.loadJSON` must use the same tokenize / fields / boost.
|
|
56
|
+
*/
|
|
57
|
+
/**
|
|
58
|
+
* Latin words, camelCase splits, and CJK unigrams/bigrams.
|
|
59
|
+
*
|
|
60
|
+
* @param text - Raw field text
|
|
61
|
+
* @returns Deduplicated tokens
|
|
62
|
+
*/
|
|
63
|
+
function tokenize(text) {
|
|
64
|
+
const tokens = [];
|
|
65
|
+
const seen = /* @__PURE__ */ new Set();
|
|
66
|
+
const add = (t) => {
|
|
67
|
+
if (t.length === 0 || seen.has(t)) return;
|
|
68
|
+
seen.add(t);
|
|
69
|
+
tokens.push(t);
|
|
70
|
+
};
|
|
71
|
+
const lower = text.toLowerCase();
|
|
72
|
+
for (const m of lower.matchAll(/[a-z0-9_]+/g)) add(m[0]);
|
|
73
|
+
for (const m of text.matchAll(/[A-Z]?[a-z]+|[A-Z]+(?![a-z])|[a-zA-Z][a-zA-Z0-9]*/g)) add(m[0].toLowerCase());
|
|
74
|
+
const chars = [...lower];
|
|
75
|
+
for (let i = 0; i < chars.length; i++) {
|
|
76
|
+
const ch = chars[i];
|
|
77
|
+
if (ch >= "一" && ch <= "鿿") {
|
|
78
|
+
add(ch);
|
|
79
|
+
const next = chars[i + 1];
|
|
80
|
+
if (next && next >= "一" && next <= "鿿") add(ch + next);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return tokens;
|
|
84
|
+
}
|
|
85
|
+
var SEARCH_FIELDS = [
|
|
86
|
+
"name",
|
|
87
|
+
"package",
|
|
88
|
+
"packageSlug",
|
|
89
|
+
"description",
|
|
90
|
+
"kind",
|
|
91
|
+
"tags",
|
|
92
|
+
"memberNames"
|
|
93
|
+
];
|
|
94
|
+
var SEARCH_STORE_FIELDS = [
|
|
95
|
+
"id",
|
|
96
|
+
"name",
|
|
97
|
+
"package",
|
|
98
|
+
"packageSlug",
|
|
99
|
+
"kind",
|
|
100
|
+
"description",
|
|
101
|
+
"mdRelativePath",
|
|
102
|
+
"memberNames"
|
|
103
|
+
];
|
|
104
|
+
var SEARCH_BOOST = {
|
|
105
|
+
name: 8,
|
|
106
|
+
memberNames: 6,
|
|
107
|
+
tags: 2,
|
|
108
|
+
description: .5
|
|
109
|
+
};
|
|
110
|
+
var DOC_SEARCH_FIELDS = [
|
|
111
|
+
"slug",
|
|
112
|
+
"title",
|
|
113
|
+
"aliases",
|
|
114
|
+
"keywords",
|
|
115
|
+
"summary"
|
|
116
|
+
];
|
|
117
|
+
var DOC_SEARCH_STORE_FIELDS = [
|
|
118
|
+
"id",
|
|
119
|
+
"kind",
|
|
120
|
+
"slug",
|
|
121
|
+
"title",
|
|
122
|
+
"summary"
|
|
123
|
+
];
|
|
124
|
+
var DOC_SEARCH_BOOST = {
|
|
125
|
+
aliases: 6,
|
|
126
|
+
keywords: 4,
|
|
127
|
+
title: 3,
|
|
128
|
+
slug: 2,
|
|
129
|
+
summary: 1
|
|
130
|
+
};
|
|
131
|
+
/** Options shared by index build and `MiniSearch.loadJSON`. */
|
|
132
|
+
function createSearchIndexOptions() {
|
|
133
|
+
return {
|
|
134
|
+
fields: [...SEARCH_FIELDS],
|
|
135
|
+
storeFields: [...SEARCH_STORE_FIELDS],
|
|
136
|
+
tokenize,
|
|
137
|
+
searchOptions: {
|
|
138
|
+
boost: SEARCH_BOOST,
|
|
139
|
+
prefix: true,
|
|
140
|
+
fuzzy: .2
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/** Runtime MiniSearch over guide / example front-matter. Not the API index. */
|
|
145
|
+
function createDocSearchIndexOptions() {
|
|
146
|
+
return {
|
|
147
|
+
fields: [...DOC_SEARCH_FIELDS],
|
|
148
|
+
storeFields: [...DOC_SEARCH_STORE_FIELDS],
|
|
149
|
+
tokenize,
|
|
150
|
+
searchOptions: {
|
|
151
|
+
boost: DOC_SEARCH_BOOST,
|
|
152
|
+
prefix: true,
|
|
153
|
+
fuzzy: .2,
|
|
154
|
+
combineWith: "OR"
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function createDocMiniSearch() {
|
|
159
|
+
return new MiniSearch(createDocSearchIndexOptions());
|
|
160
|
+
}
|
|
161
|
+
// src/loader.ts
|
|
162
|
+
/**
|
|
163
|
+
* Runtime loader: api-index, MiniSearch JSON, and optional guide/example markdown.
|
|
164
|
+
*/
|
|
165
|
+
var SCHEMA_VERSION = 3;
|
|
166
|
+
var SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
167
|
+
var TAG_WHITELIST_GUIDES = [
|
|
168
|
+
"core",
|
|
169
|
+
"particlesystem",
|
|
170
|
+
"postprocessing",
|
|
171
|
+
"general"
|
|
172
|
+
];
|
|
173
|
+
var TAG_WHITELIST_EXAMPLES = [
|
|
174
|
+
"scene",
|
|
175
|
+
"model",
|
|
176
|
+
"script",
|
|
177
|
+
"pick",
|
|
178
|
+
"animation",
|
|
179
|
+
"particle",
|
|
180
|
+
"worker",
|
|
181
|
+
"core",
|
|
182
|
+
"engine",
|
|
183
|
+
"postprocessing"
|
|
184
|
+
];
|
|
185
|
+
var loaderModuleUrl = import.meta.url;
|
|
186
|
+
var pkgRoot = resolve(dirname(fileURLToPath(loaderModuleUrl)), "..");
|
|
187
|
+
var dataDir = resolve(pkgRoot, "data");
|
|
188
|
+
var guidesDir = resolve(pkgRoot, "resources", "guides");
|
|
189
|
+
var examplesDir = resolve(pkgRoot, "resources", "examples");
|
|
190
|
+
function isString(v) {
|
|
191
|
+
return typeof v === "string";
|
|
192
|
+
}
|
|
193
|
+
function isStrArray(v) {
|
|
194
|
+
return Array.isArray(v) && v.every((x) => typeof x === "string");
|
|
195
|
+
}
|
|
196
|
+
function fatal(message) {
|
|
197
|
+
console.error(`[loader] FATAL: ${message}`);
|
|
198
|
+
process.exit(1);
|
|
199
|
+
}
|
|
200
|
+
function requireFile(label, absPath) {
|
|
201
|
+
if (!existsSync(absPath)) fatal(`${label} not found\n pkgRoot: ${pkgRoot}\n missing: ${absPath}\n run pnpm run build:docs in this package first`);
|
|
202
|
+
}
|
|
203
|
+
function scanFiles(dir, ext) {
|
|
204
|
+
const result = [];
|
|
205
|
+
if (!existsSync(dir)) return result;
|
|
206
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
207
|
+
const full = resolve(dir, entry.name);
|
|
208
|
+
if (entry.isDirectory()) result.push(...scanFiles(full, ext));
|
|
209
|
+
else if (entry.name.endsWith(ext)) result.push(full);
|
|
210
|
+
}
|
|
211
|
+
return result;
|
|
212
|
+
}
|
|
213
|
+
function parseYamlBlock(yamlBlock) {
|
|
214
|
+
const parsed = parse(yamlBlock);
|
|
215
|
+
if (typeof parsed !== "object" || parsed === null) return {};
|
|
216
|
+
return parsed;
|
|
217
|
+
}
|
|
218
|
+
function rawToMeta(raw, filePath, kind) {
|
|
219
|
+
if (!isString(raw.slug) || !SLUG_RE.test(raw.slug)) return null;
|
|
220
|
+
if (!isString(raw.title) || raw.title.length === 0) return null;
|
|
221
|
+
if (kind === "example" && (!isString(raw.summary) || raw.summary.trim().length === 0)) return null;
|
|
222
|
+
return {
|
|
223
|
+
slug: raw.slug,
|
|
224
|
+
title: raw.title,
|
|
225
|
+
aliases: isStrArray(raw.aliases) ? raw.aliases : [],
|
|
226
|
+
keywords: isStrArray(raw.keywords) ? raw.keywords : [],
|
|
227
|
+
tags: isStrArray(raw.tags) ? raw.tags : [],
|
|
228
|
+
summary: isString(raw.summary) ? raw.summary : null,
|
|
229
|
+
relatedApiIds: isStrArray(raw.relatedApiIds) ? raw.relatedApiIds : [],
|
|
230
|
+
filePath,
|
|
231
|
+
fileName: filePath.replace(/\\/g, "/").split("/").pop() ?? filePath
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
function parseMarkdownFrontMatter(content, filePath, kind) {
|
|
235
|
+
const text = content.replace(/^\uFEFF/, "");
|
|
236
|
+
const empty = {
|
|
237
|
+
meta: null,
|
|
238
|
+
body: text,
|
|
239
|
+
rawMeta: {}
|
|
240
|
+
};
|
|
241
|
+
if (!text.startsWith("---")) return empty;
|
|
242
|
+
const endIdx = text.indexOf("\n---", 3);
|
|
243
|
+
if (endIdx === -1) return empty;
|
|
244
|
+
const rawMeta = parseYamlBlock(text.slice(4, endIdx));
|
|
245
|
+
return {
|
|
246
|
+
meta: rawToMeta(rawMeta, filePath, kind),
|
|
247
|
+
body: text.slice(endIdx + 4).replace(/^\r?\n/, ""),
|
|
248
|
+
rawMeta
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
function validateMeta(meta, body, rawMeta, kind) {
|
|
252
|
+
const warnings = [];
|
|
253
|
+
const fp = meta.fileName;
|
|
254
|
+
for (const f of [
|
|
255
|
+
"aliases",
|
|
256
|
+
"keywords",
|
|
257
|
+
"tags",
|
|
258
|
+
"relatedGuides",
|
|
259
|
+
"relatedApiIds",
|
|
260
|
+
"relatedExamples"
|
|
261
|
+
]) if (rawMeta[f] !== void 0 && !Array.isArray(rawMeta[f])) warnings.push(`[V4] ${fp}: ${f} should be array, got ${typeof rawMeta[f]}`);
|
|
262
|
+
const whitelist = kind === "guide" ? TAG_WHITELIST_GUIDES : TAG_WHITELIST_EXAMPLES;
|
|
263
|
+
for (const t of meta.tags) if (!whitelist.includes(t)) warnings.push(`[V5] ${fp}: tag "${t}" not in whitelist (${kind})`);
|
|
264
|
+
if (!body.trimStart().startsWith("# ")) warnings.push(`[V7] ${fp}: body does not start with H1`);
|
|
265
|
+
if (meta.summary) {
|
|
266
|
+
const len = meta.summary.length;
|
|
267
|
+
if (len < 5 || len > 120) warnings.push(`[V8] ${fp}: summary length ${len} (should be 5~120)`);
|
|
268
|
+
}
|
|
269
|
+
return warnings;
|
|
270
|
+
}
|
|
271
|
+
function extractExampleCode(body, filePath) {
|
|
272
|
+
const mainMatch = /^## 主示例\s*$/m.exec(body);
|
|
273
|
+
if (!mainMatch) fatal(`example missing "## 主示例": ${filePath}`);
|
|
274
|
+
const afterMain = body.slice(mainMatch.index + mainMatch[0].length);
|
|
275
|
+
const nextH2 = afterMain.match(/^##\s/m);
|
|
276
|
+
const section = nextH2 ? afterMain.slice(0, nextH2.index) : afterMain;
|
|
277
|
+
const fenceMatch = /```(ts|typescript)\s*\n([\s\S]*?)```/.exec(section);
|
|
278
|
+
if (!fenceMatch?.[2] || fenceMatch[2].trim().length === 0) fatal(`example "## 主示例" has no non-empty ts fence: ${filePath}`);
|
|
279
|
+
const notes = [];
|
|
280
|
+
const notesMatch = /^## 备注\s*$/m.exec(body);
|
|
281
|
+
if (notesMatch) {
|
|
282
|
+
const afterNotes = body.slice(notesMatch.index + notesMatch[0].length);
|
|
283
|
+
const nextNotesH2 = afterNotes.match(/^##\s/m);
|
|
284
|
+
const notesSection = nextNotesH2 ? afterNotes.slice(0, nextNotesH2.index) : afterNotes;
|
|
285
|
+
for (const b of notesSection.matchAll(/^[-*]\s+(.+)$/gm)) if (b[1]) notes.push(b[1].trim());
|
|
286
|
+
}
|
|
287
|
+
return {
|
|
288
|
+
code: fenceMatch[2],
|
|
289
|
+
notes
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
function warnDeadCrossRefs(guideBySlug, exampleBySlug, guideRaws, exampleRaws, byId) {
|
|
293
|
+
const check = (file, raw) => {
|
|
294
|
+
const relatedExamples = isStrArray(raw.relatedExamples) ? raw.relatedExamples : [];
|
|
295
|
+
for (const slug of relatedExamples) if (!exampleBySlug.has(slug)) console.warn(` [loader] dead relatedExamples "${slug}" in ${file}`);
|
|
296
|
+
const relatedGuides = isStrArray(raw.relatedGuides) ? raw.relatedGuides : [];
|
|
297
|
+
for (const slug of relatedGuides) if (!guideBySlug.has(slug)) console.warn(` [loader] dead relatedGuides "${slug}" in ${file}`);
|
|
298
|
+
const relatedApiIds = isStrArray(raw.relatedApiIds) ? raw.relatedApiIds : [];
|
|
299
|
+
for (const id of relatedApiIds) if (!byId.has(id)) console.warn(` [loader] dead relatedApiIds "${id}" in ${file}`);
|
|
300
|
+
};
|
|
301
|
+
for (const [slug, raw] of guideRaws) check(`guide:${slug}`, raw);
|
|
302
|
+
for (const [slug, raw] of exampleRaws) check(`example:${slug}`, raw);
|
|
303
|
+
}
|
|
304
|
+
function toExampleResult(cached, examplesDirPosix) {
|
|
305
|
+
const posixFile = cached.meta.filePath.replace(/\\/g, "/");
|
|
306
|
+
const prefix = `${examplesDirPosix}/`;
|
|
307
|
+
const mdRelativePath = posixFile.startsWith(prefix) ? posixFile.slice(prefix.length) : posixFile;
|
|
308
|
+
return {
|
|
309
|
+
slug: cached.meta.slug,
|
|
310
|
+
title: cached.meta.title,
|
|
311
|
+
summary: cached.meta.summary ?? "",
|
|
312
|
+
language: "ts",
|
|
313
|
+
code: cached.code,
|
|
314
|
+
notes: cached.notes,
|
|
315
|
+
relatedGuides: isStrArray(cached.rawMeta.relatedGuides) ? cached.rawMeta.relatedGuides : [],
|
|
316
|
+
relatedApiIds: isStrArray(cached.rawMeta.relatedApiIds) ? cached.rawMeta.relatedApiIds : [],
|
|
317
|
+
tags: isStrArray(cached.rawMeta.tags) ? cached.rawMeta.tags : [],
|
|
318
|
+
source: {
|
|
319
|
+
mdRelativePath,
|
|
320
|
+
frontmatter: { ...cached.rawMeta }
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
async function loadData() {
|
|
325
|
+
requireFile("api-index.json", resolve(dataDir, "api-index.json"));
|
|
326
|
+
requireFile("search-index.json", resolve(dataDir, "search-index.json"));
|
|
327
|
+
const index = JSON.parse(readFileSync(resolve(dataDir, "api-index.json"), "utf8"));
|
|
328
|
+
if (index.schemaVersion !== SCHEMA_VERSION) fatal(`api-index schemaVersion ${String(index.schemaVersion)} !== ${String(SCHEMA_VERSION)}`);
|
|
329
|
+
const search = MiniSearch.loadJSON(readFileSync(resolve(dataDir, "search-index.json"), "utf8"), createSearchIndexOptions());
|
|
330
|
+
const byId = /* @__PURE__ */ new Map();
|
|
331
|
+
const byName = /* @__PURE__ */ new Map();
|
|
332
|
+
for (const cls of index.classes) {
|
|
333
|
+
byId.set(cls.id, cls);
|
|
334
|
+
const existing = byName.get(cls.name) ?? [];
|
|
335
|
+
existing.push(cls);
|
|
336
|
+
byName.set(cls.name, existing);
|
|
337
|
+
}
|
|
338
|
+
const guideBySlug = /* @__PURE__ */ new Map();
|
|
339
|
+
const guideSearchable = [];
|
|
340
|
+
const guideRaws = /* @__PURE__ */ new Map();
|
|
341
|
+
for (const fp of scanFiles(guidesDir, ".md")) {
|
|
342
|
+
let content;
|
|
343
|
+
try {
|
|
344
|
+
content = readFileSync(fp, "utf8");
|
|
345
|
+
} catch {
|
|
346
|
+
fatal(`failed to read guide: ${fp}`);
|
|
347
|
+
}
|
|
348
|
+
const { meta, body, rawMeta } = parseMarkdownFrontMatter(content, fp, "guide");
|
|
349
|
+
if (!meta) fatal(`guide missing slug/title in front-matter: ${fp}`);
|
|
350
|
+
if (guideBySlug.has(meta.slug)) fatal(`duplicate guide slug "${meta.slug}": ${fp}`);
|
|
351
|
+
guideBySlug.set(meta.slug, meta);
|
|
352
|
+
guideSearchable.push(meta);
|
|
353
|
+
guideRaws.set(meta.slug, rawMeta);
|
|
354
|
+
for (const w of validateMeta(meta, body, rawMeta, "guide")) console.warn(` [loader] ${w}`);
|
|
355
|
+
}
|
|
356
|
+
const exampleBySlug = /* @__PURE__ */ new Map();
|
|
357
|
+
const exampleSearchable = [];
|
|
358
|
+
const exampleAliasToSlug = /* @__PURE__ */ new Map();
|
|
359
|
+
const exampleCache = /* @__PURE__ */ new Map();
|
|
360
|
+
const exampleRaws = /* @__PURE__ */ new Map();
|
|
361
|
+
for (const fp of scanFiles(examplesDir, ".md")) {
|
|
362
|
+
let content;
|
|
363
|
+
try {
|
|
364
|
+
content = readFileSync(fp, "utf8");
|
|
365
|
+
} catch {
|
|
366
|
+
fatal(`failed to read example: ${fp}`);
|
|
367
|
+
}
|
|
368
|
+
const { meta, body, rawMeta } = parseMarkdownFrontMatter(content, fp, "example");
|
|
369
|
+
if (!meta) fatal(`example missing slug/title/summary in front-matter: ${fp}`);
|
|
370
|
+
if (exampleBySlug.has(meta.slug)) fatal(`duplicate example slug "${meta.slug}": ${fp}`);
|
|
371
|
+
const extracted = extractExampleCode(body, fp);
|
|
372
|
+
for (const alias of meta.aliases) {
|
|
373
|
+
if (exampleAliasToSlug.has(alias) || exampleAliasToSlug.has(alias.toLowerCase())) fatal(`duplicate example alias "${alias}": ${fp}`);
|
|
374
|
+
if (exampleBySlug.has(alias) || meta.slug === alias) fatal(`alias "${alias}" collides with a slug: ${fp}`);
|
|
375
|
+
exampleAliasToSlug.set(alias, meta.slug);
|
|
376
|
+
const aliasLower = alias.toLowerCase();
|
|
377
|
+
if (aliasLower !== alias && !exampleAliasToSlug.has(aliasLower)) exampleAliasToSlug.set(aliasLower, meta.slug);
|
|
378
|
+
}
|
|
379
|
+
exampleBySlug.set(meta.slug, meta);
|
|
380
|
+
exampleSearchable.push(meta);
|
|
381
|
+
exampleRaws.set(meta.slug, rawMeta);
|
|
382
|
+
exampleCache.set(meta.slug, {
|
|
383
|
+
meta,
|
|
384
|
+
rawMeta,
|
|
385
|
+
code: extracted.code,
|
|
386
|
+
notes: extracted.notes
|
|
387
|
+
});
|
|
388
|
+
for (const w of validateMeta(meta, body, rawMeta, "example")) console.warn(` [loader] ${w}`);
|
|
389
|
+
}
|
|
390
|
+
warnDeadCrossRefs(guideBySlug, exampleBySlug, guideRaws, exampleRaws, byId);
|
|
391
|
+
enrichApi(index.classes, guideSearchable, exampleSearchable);
|
|
392
|
+
const examplesDirPosix = examplesDir.replace(/\\/g, "/");
|
|
393
|
+
function getExampleResult(slug) {
|
|
394
|
+
let meta = exampleBySlug.get(slug) ?? exampleBySlug.get(slug.toLowerCase());
|
|
395
|
+
if (!meta) {
|
|
396
|
+
const resolved = exampleAliasToSlug.get(slug) ?? exampleAliasToSlug.get(slug.toLowerCase());
|
|
397
|
+
if (resolved) meta = exampleBySlug.get(resolved);
|
|
398
|
+
}
|
|
399
|
+
if (!meta) return null;
|
|
400
|
+
const cached = exampleCache.get(meta.slug);
|
|
401
|
+
if (!cached) return null;
|
|
402
|
+
return toExampleResult(cached, examplesDirPosix);
|
|
403
|
+
}
|
|
404
|
+
return {
|
|
405
|
+
pkgRoot,
|
|
406
|
+
dataDir,
|
|
407
|
+
guidesDir,
|
|
408
|
+
examplesDir,
|
|
409
|
+
index,
|
|
410
|
+
search,
|
|
411
|
+
byId,
|
|
412
|
+
byName,
|
|
413
|
+
guideSlugs: [...guideBySlug.keys()].sort(),
|
|
414
|
+
guideBySlug,
|
|
415
|
+
guideSearchable,
|
|
416
|
+
exampleSlugs: [...exampleBySlug.keys()].sort(),
|
|
417
|
+
exampleBySlug,
|
|
418
|
+
exampleAliasToSlug,
|
|
419
|
+
exampleSearchable,
|
|
420
|
+
getExampleResult
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
// src/md-utils.ts
|
|
424
|
+
var API_URI_PREFIX = "vista3d://api/id/";
|
|
425
|
+
var KIND_FROM_DIR = {
|
|
426
|
+
classes: "class",
|
|
427
|
+
interfaces: "interface",
|
|
428
|
+
"type-aliases": "type",
|
|
429
|
+
enumerations: "enum",
|
|
430
|
+
functions: "function",
|
|
431
|
+
variables: "variable"
|
|
432
|
+
};
|
|
433
|
+
/**
|
|
434
|
+
* Drop YAML front-matter and return the body.
|
|
435
|
+
*
|
|
436
|
+
* @param raw - Markdown that may start with --- YAML ---
|
|
437
|
+
* @returns Body text
|
|
438
|
+
*/
|
|
439
|
+
function stripYamlFrontMatter(raw) {
|
|
440
|
+
const text = raw.replace(/^\uFEFF/, "");
|
|
441
|
+
if (!text.startsWith("---")) return raw;
|
|
442
|
+
const match = text.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/);
|
|
443
|
+
if (!match) return raw;
|
|
444
|
+
return text.slice(match[0].length).replace(/^\s+/, "");
|
|
445
|
+
}
|
|
446
|
+
function unescapeTypedocName(raw) {
|
|
447
|
+
return raw.replace(/\\_/g, "_").replace(/\\</g, "<").replace(/\(\)\s*$/, "").trim();
|
|
448
|
+
}
|
|
449
|
+
function headingMemberName(heading) {
|
|
450
|
+
return unescapeTypedocName(heading).match(/^[A-Za-z_][A-Za-z0-9_]*/)?.[0] ?? null;
|
|
451
|
+
}
|
|
452
|
+
function dropPrivateH3Blocks(md) {
|
|
453
|
+
const lines = md.split("\n");
|
|
454
|
+
const out = [];
|
|
455
|
+
let i = 0;
|
|
456
|
+
while (i < lines.length) {
|
|
457
|
+
const line = lines[i];
|
|
458
|
+
const h3 = /^### (.+)$/.exec(line);
|
|
459
|
+
if (!h3) {
|
|
460
|
+
out.push(line);
|
|
461
|
+
i++;
|
|
462
|
+
continue;
|
|
463
|
+
}
|
|
464
|
+
const member = headingMemberName(h3[1]);
|
|
465
|
+
const block = [line];
|
|
466
|
+
i++;
|
|
467
|
+
while (i < lines.length && !/^#{1,3} /.test(lines[i])) {
|
|
468
|
+
block.push(lines[i]);
|
|
469
|
+
i++;
|
|
470
|
+
}
|
|
471
|
+
if (member && member.startsWith("_")) continue;
|
|
472
|
+
const joined = block.join("\n").replace(/\n#### (?:Inherited from|Overrides|Memberof)\n[\s\S]*?(?=\n#### |\n\*\*\*|$)/g, "");
|
|
473
|
+
out.push(...joined.split("\n"));
|
|
474
|
+
}
|
|
475
|
+
return out.join("\n").replace(/\n{3,}/g, "\n\n");
|
|
476
|
+
}
|
|
477
|
+
function resolveTypedocHref(href, packageSlug, currentKind, byId, byName) {
|
|
478
|
+
const [pathPart] = href.split("#");
|
|
479
|
+
if (!pathPart) return null;
|
|
480
|
+
const norm = pathPart.replace(/\\/g, "/");
|
|
481
|
+
if (!norm.endsWith(".md")) return null;
|
|
482
|
+
if (/(^|\/)(README|modules)\.md$/i.test(norm)) return null;
|
|
483
|
+
const file = unescapeTypedocName(norm.split("/").pop().replace(/\.md$/, ""));
|
|
484
|
+
let kind = currentKind;
|
|
485
|
+
for (const [dir, k] of Object.entries(KIND_FROM_DIR)) if (norm.includes(`/${dir}/`) || norm.startsWith(`${dir}/`) || norm.startsWith(`../${dir}/`)) {
|
|
486
|
+
kind = k;
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
489
|
+
const id = `${packageSlug}:${kind}:${file}`;
|
|
490
|
+
if (byId.has(id)) return `${API_URI_PREFIX}${id}`;
|
|
491
|
+
const matches = byName.get(file);
|
|
492
|
+
if (!matches || matches.length === 0) return null;
|
|
493
|
+
if (matches.length === 1) return `${API_URI_PREFIX}${matches[0].id}`;
|
|
494
|
+
const samePkg = matches.find((c) => c.packageSlug === packageSlug);
|
|
495
|
+
return samePkg ? `${API_URI_PREFIX}${samePkg.id}` : null;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Drop private TypeDoc members and rewrite relative `.md` links to stable URIs.
|
|
499
|
+
*
|
|
500
|
+
* @param raw - typedoc-plugin-markdown source
|
|
501
|
+
* @param cls - Current API symbol
|
|
502
|
+
* @param byId - Index by stable id
|
|
503
|
+
* @param byName - Index by symbol name
|
|
504
|
+
* @returns Agent-facing markdown
|
|
505
|
+
*/
|
|
506
|
+
function presentTypedocMarkdown(raw, cls, byId, byName) {
|
|
507
|
+
return dropPrivateH3Blocks(raw).replace(/\[([^\]]+)\]\(([^)]+)\)/g, (full, text, href) => {
|
|
508
|
+
if (/^(https?:|vista3d:|#)/i.test(href)) return full;
|
|
509
|
+
const uri = resolveTypedocHref(href, cls.packageSlug, cls.kind, byId, byName);
|
|
510
|
+
if (!uri) return full;
|
|
511
|
+
return `[${text}](${uri})`;
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
// src/resources/api.ts
|
|
515
|
+
function jsonError(uri, payload) {
|
|
516
|
+
return { contents: [{
|
|
517
|
+
uri,
|
|
518
|
+
text: JSON.stringify(payload, null, 2),
|
|
519
|
+
mimeType: "application/json"
|
|
520
|
+
}] };
|
|
521
|
+
}
|
|
522
|
+
function readApiMarkdown(data, mdRelativePath) {
|
|
523
|
+
return readFileSync(resolve(data.dataDir, mdRelativePath), "utf8");
|
|
524
|
+
}
|
|
525
|
+
function packageSlugs(data) {
|
|
526
|
+
return data.index.packages.map((p) => p.packageSlug);
|
|
527
|
+
}
|
|
528
|
+
function registerApiResource(server, data) {
|
|
529
|
+
const slugs = packageSlugs(data);
|
|
530
|
+
server.registerResource("vista3d-api-by-id", new ResourceTemplate("vista3d://api/id/{id}", {
|
|
531
|
+
list: void 0,
|
|
532
|
+
complete: { id: (value) => [...data.byId.keys()].filter((id) => id.includes(value)).slice(0, 20) }
|
|
533
|
+
}), {
|
|
534
|
+
description: "按稳定 id 返回单个 API 的 Markdown 文档",
|
|
535
|
+
mimeType: "text/markdown"
|
|
536
|
+
}, async (uri, variables) => {
|
|
537
|
+
const id = String(variables.id ?? uri.pathname.replace(/^\/api\/id\//, ""));
|
|
538
|
+
const cls = data.byId.get(id);
|
|
539
|
+
if (!cls) return jsonError(uri.href, {
|
|
540
|
+
error: {
|
|
541
|
+
code: "NOT_FOUND",
|
|
542
|
+
message: `未找到 API「${id}」`,
|
|
543
|
+
id
|
|
544
|
+
},
|
|
545
|
+
candidates: [...data.byId.keys()].filter((k) => k.includes(id)).slice(0, 8)
|
|
546
|
+
});
|
|
547
|
+
const md = presentTypedocMarkdown(readApiMarkdown(data, cls.mdRelativePath), cls, data.byId, data.byName);
|
|
548
|
+
return { contents: [{
|
|
549
|
+
uri: uri.href,
|
|
550
|
+
text: md,
|
|
551
|
+
mimeType: "text/markdown"
|
|
552
|
+
}] };
|
|
553
|
+
});
|
|
554
|
+
server.registerResource("vista3d-api-by-slug-name", new ResourceTemplate("vista3d://api/{packageSlug}/{className}", {
|
|
555
|
+
list: void 0,
|
|
556
|
+
complete: {
|
|
557
|
+
packageSlug: (value) => slugs.filter((s) => s.includes(value)),
|
|
558
|
+
className: (value) => {
|
|
559
|
+
return [...new Set(data.index.classes.map((c) => c.name))].filter((n) => n.toLowerCase().includes(value.toLowerCase())).slice(0, 20);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}), {
|
|
563
|
+
description: "按包 slug + 类名返回单个 API 的 Markdown 文档",
|
|
564
|
+
mimeType: "text/markdown"
|
|
565
|
+
}, async (uri, variables) => {
|
|
566
|
+
const slug = String(variables.packageSlug ?? "");
|
|
567
|
+
const className = String(variables.className ?? "");
|
|
568
|
+
if (!slug || !className) return jsonError(uri.href, { error: {
|
|
569
|
+
code: "INVALID_URI",
|
|
570
|
+
message: "需要 packageSlug 与 className",
|
|
571
|
+
validSlugs: slugs
|
|
572
|
+
} });
|
|
573
|
+
const matches = data.index.classes.filter((c) => c.packageSlug === slug && c.name === className);
|
|
574
|
+
if (matches.length === 0) return jsonError(uri.href, {
|
|
575
|
+
error: {
|
|
576
|
+
code: "NOT_FOUND",
|
|
577
|
+
message: `未找到 ${slug}/${className}`,
|
|
578
|
+
slug,
|
|
579
|
+
className
|
|
580
|
+
},
|
|
581
|
+
candidates: data.index.classes.filter((c) => c.packageSlug === slug).map((c) => c.name).slice(0, 8)
|
|
582
|
+
});
|
|
583
|
+
if (matches.length > 1) return jsonError(uri.href, {
|
|
584
|
+
error: {
|
|
585
|
+
code: "AMBIGUOUS_NAME",
|
|
586
|
+
message: `同名多条:${slug}/${className}`
|
|
587
|
+
},
|
|
588
|
+
candidates: matches.map((c) => ({
|
|
589
|
+
id: c.id,
|
|
590
|
+
name: c.name,
|
|
591
|
+
packageSlug: c.packageSlug
|
|
592
|
+
}))
|
|
593
|
+
});
|
|
594
|
+
const hit = matches[0];
|
|
595
|
+
const md = presentTypedocMarkdown(readApiMarkdown(data, hit.mdRelativePath), hit, data.byId, data.byName);
|
|
596
|
+
return { contents: [{
|
|
597
|
+
uri: uri.href,
|
|
598
|
+
text: md,
|
|
599
|
+
mimeType: "text/markdown"
|
|
600
|
+
}] };
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
// src/resources/guide.ts
|
|
604
|
+
function registerGuideResource(server, data) {
|
|
605
|
+
server.registerResource("vista3d-guide", new ResourceTemplate("vista3d://guide/{guideName}", {
|
|
606
|
+
list: async () => ({ resources: data.guideSlugs.map((slug) => {
|
|
607
|
+
const meta = data.guideBySlug.get(slug);
|
|
608
|
+
return {
|
|
609
|
+
uri: `vista3d://guide/${slug}`,
|
|
610
|
+
name: slug,
|
|
611
|
+
mimeType: "text/markdown",
|
|
612
|
+
description: meta?.title ?? slug
|
|
613
|
+
};
|
|
614
|
+
}) }),
|
|
615
|
+
complete: { guideName: (value) => data.guideSlugs.filter((slug) => slug.includes(value)) }
|
|
616
|
+
}), {
|
|
617
|
+
description: "按 slug 返回指南全文(Markdown)",
|
|
618
|
+
mimeType: "text/markdown"
|
|
619
|
+
}, async (uri, variables) => {
|
|
620
|
+
const guideName = String(variables.guideName ?? uri.pathname.split("/").pop() ?? "");
|
|
621
|
+
const meta = data.guideBySlug.get(guideName);
|
|
622
|
+
if (!meta) return { contents: [{
|
|
623
|
+
uri: uri.href,
|
|
624
|
+
text: JSON.stringify({
|
|
625
|
+
error: {
|
|
626
|
+
code: "NOT_FOUND",
|
|
627
|
+
message: `未找到指南「${guideName}」`
|
|
628
|
+
},
|
|
629
|
+
candidates: data.guideSlugs
|
|
630
|
+
}, null, 2),
|
|
631
|
+
mimeType: "application/json"
|
|
632
|
+
}] };
|
|
633
|
+
const body = stripYamlFrontMatter(readFileSync(meta.filePath, "utf8"));
|
|
634
|
+
return { contents: [{
|
|
635
|
+
uri: uri.href,
|
|
636
|
+
text: body,
|
|
637
|
+
mimeType: "text/markdown"
|
|
638
|
+
}] };
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
// src/resources/packages.ts
|
|
642
|
+
function registerPackagesResource(server, data) {
|
|
643
|
+
const lines = ["# vista3d SDK Packages", ""];
|
|
644
|
+
for (const pkg of data.index.packages) lines.push(`- **${pkg.package}** (\`${pkg.packageSlug}\`) — ${pkg.description ?? pkg.package}`);
|
|
645
|
+
lines.push("", `*Total: ${data.index.packages.length} packages*`);
|
|
646
|
+
const text = lines.join("\n");
|
|
647
|
+
server.registerResource("vista3d-packages", "vista3d://packages", {
|
|
648
|
+
description: "列出 vista3d 全部公开包及简要说明",
|
|
649
|
+
mimeType: "text/markdown"
|
|
650
|
+
}, async (uri) => ({ contents: [{
|
|
651
|
+
uri: uri.href,
|
|
652
|
+
text,
|
|
653
|
+
mimeType: "text/markdown"
|
|
654
|
+
}] }));
|
|
655
|
+
}
|
|
656
|
+
// src/tools/generate-setup.ts
|
|
657
|
+
var ALLOWED_FEATURES = [
|
|
658
|
+
"engine.webgl",
|
|
659
|
+
"engine.webgpu",
|
|
660
|
+
"scene.basic",
|
|
661
|
+
"render.mesh",
|
|
662
|
+
"asset.gltf",
|
|
663
|
+
"picking",
|
|
664
|
+
"worker",
|
|
665
|
+
"module.particlesystem",
|
|
666
|
+
"module.postprocessing"
|
|
667
|
+
];
|
|
668
|
+
var IMPORT_ORDER = [
|
|
669
|
+
"three",
|
|
670
|
+
"@vista3d/core",
|
|
671
|
+
"@vista3d/particlesystem",
|
|
672
|
+
"@vista3d/postprocessing"
|
|
673
|
+
];
|
|
674
|
+
function hasName(data, name) {
|
|
675
|
+
return data.index.classes.some((c) => c.name === name);
|
|
676
|
+
}
|
|
677
|
+
function addNamed(map, mod, names) {
|
|
678
|
+
let set = map.get(mod);
|
|
679
|
+
if (!set) {
|
|
680
|
+
set = /* @__PURE__ */ new Set();
|
|
681
|
+
map.set(mod, set);
|
|
682
|
+
}
|
|
683
|
+
for (const n of names) set.add(n);
|
|
684
|
+
}
|
|
685
|
+
function formatImports(named) {
|
|
686
|
+
const copy = new Map(named);
|
|
687
|
+
const lines = [];
|
|
688
|
+
for (const mod of IMPORT_ORDER) {
|
|
689
|
+
const names = copy.get(mod);
|
|
690
|
+
if (!names || names.size === 0) continue;
|
|
691
|
+
lines.push(`import { ${[...names].sort().join(", ")} } from '${mod}';`);
|
|
692
|
+
copy.delete(mod);
|
|
693
|
+
}
|
|
694
|
+
for (const [mod, names] of copy) {
|
|
695
|
+
if (names.size === 0) continue;
|
|
696
|
+
lines.push(`import { ${[...names].sort().join(", ")} } from '${mod}';`);
|
|
697
|
+
}
|
|
698
|
+
return lines;
|
|
699
|
+
}
|
|
700
|
+
function todo(message) {
|
|
701
|
+
return `// TODO: ${message}`;
|
|
702
|
+
}
|
|
703
|
+
function buildGenerateSetup(data, featuresInput) {
|
|
704
|
+
const features = featuresInput.filter((f) => f.trim().length > 0);
|
|
705
|
+
const warnings = [];
|
|
706
|
+
const allowed = ALLOWED_FEATURES;
|
|
707
|
+
for (const uf of features.filter((f) => !allowed.includes(f))) warnings.push(`// WARNING: 未识别 feature:${uf};已忽略。允许列表:${ALLOWED_FEATURES.join(", ")}`);
|
|
708
|
+
if (features.includes("module.postprocessing")) warnings.push("// WARNING: module.postprocessing 已识别但尚无独立最小模板,已忽略。");
|
|
709
|
+
const useWebgpu = features.includes("engine.webgpu") && !features.includes("engine.webgl");
|
|
710
|
+
const engineName = useWebgpu ? "WebGPUEngine" : "WebGLEngine";
|
|
711
|
+
const hasMesh = features.includes("render.mesh");
|
|
712
|
+
const hasGltf = features.includes("asset.gltf");
|
|
713
|
+
const hasPicking = features.includes("picking");
|
|
714
|
+
const hasWorker = features.includes("worker");
|
|
715
|
+
const hasParticles = features.includes("module.particlesystem");
|
|
716
|
+
const named = /* @__PURE__ */ new Map();
|
|
717
|
+
const bodies = [];
|
|
718
|
+
const related = /* @__PURE__ */ new Set([useWebgpu ? "webgpu-engine" : "webgl-engine"]);
|
|
719
|
+
const c1Ok = hasName(data, engineName) && hasName(data, "Scene") && hasName(data, "SceneRenderer") && hasName(data, "PerspectiveCamera");
|
|
720
|
+
if (c1Ok) {
|
|
721
|
+
addNamed(named, "@vista3d/core", [
|
|
722
|
+
engineName,
|
|
723
|
+
"Scene",
|
|
724
|
+
"SceneRenderer",
|
|
725
|
+
"PerspectiveCamera"
|
|
726
|
+
]);
|
|
727
|
+
bodies.push(`const engine = new ${engineName}({
|
|
728
|
+
renderer: {
|
|
729
|
+
clearColor: '#111111',
|
|
730
|
+
viewport: document.body
|
|
731
|
+
}
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
const scene = new Scene(engine, { name: 'main-scene' });
|
|
735
|
+
scene.sceneRenderer = new SceneRenderer(engine);
|
|
736
|
+
|
|
737
|
+
const cameraEntity = scene.rootEntity.createChild({ name: 'Camera' });
|
|
738
|
+
cameraEntity.addComponent(PerspectiveCamera);
|
|
739
|
+
cameraEntity.transform.position.set(0, 1, 8);`);
|
|
740
|
+
} else bodies.push(todo(`引擎/场景符号未在 api-index 中检出(需要 ${engineName}、Scene、SceneRenderer、PerspectiveCamera)`));
|
|
741
|
+
if (hasMesh) {
|
|
742
|
+
if (hasName(data, "MeshRenderer")) {
|
|
743
|
+
addNamed(named, "three", [
|
|
744
|
+
"BoxGeometry",
|
|
745
|
+
"Mesh",
|
|
746
|
+
"MeshBasicMaterial"
|
|
747
|
+
]);
|
|
748
|
+
addNamed(named, "@vista3d/core", ["MeshRenderer"]);
|
|
749
|
+
related.add("mesh-renderer");
|
|
750
|
+
bodies.push(`const meshEntity = scene.rootEntity.createChild({ name: 'Box' });
|
|
751
|
+
meshEntity.addComponent(MeshRenderer, {
|
|
752
|
+
mesh: new Mesh(new BoxGeometry(1, 1, 1), new MeshBasicMaterial({ color: '#6b7c85' }))
|
|
753
|
+
});
|
|
754
|
+
meshEntity.transform.position.set(0, 0.5, 0);`);
|
|
755
|
+
} else bodies.push(todo("render.mesh 关键符号 MeshRenderer 未检出,已降级"));
|
|
756
|
+
}
|
|
757
|
+
if (hasGltf) {
|
|
758
|
+
related.add("gltf-resource");
|
|
759
|
+
bodies.push("void scene.loadGLTF('<replace-with-glb>');");
|
|
760
|
+
}
|
|
761
|
+
if (hasPicking) {
|
|
762
|
+
if (hasName(data, "MeshRenderer") && hasName(data, "QueryMask")) {
|
|
763
|
+
addNamed(named, "three", [
|
|
764
|
+
"BoxGeometry",
|
|
765
|
+
"Mesh",
|
|
766
|
+
"MeshBasicMaterial",
|
|
767
|
+
"Vector2"
|
|
768
|
+
]);
|
|
769
|
+
addNamed(named, "@vista3d/core", ["MeshRenderer", "QueryMask"]);
|
|
770
|
+
bodies.push(`const pickEntity = scene.rootEntity.createChild({ name: 'PickBox' });
|
|
771
|
+
pickEntity.addComponent(MeshRenderer, {
|
|
772
|
+
mesh: new Mesh(new BoxGeometry(1, 1, 1), new MeshBasicMaterial({ color: '#6b7c85' })),
|
|
773
|
+
queryMask: QueryMask.MASK_0
|
|
774
|
+
});
|
|
775
|
+
const hits = scene.pick(new Vector2(400, 300));
|
|
776
|
+
void hits;`);
|
|
777
|
+
} else bodies.push(todo("picking 关键符号 MeshRenderer / QueryMask 未检出,已降级"));
|
|
778
|
+
}
|
|
779
|
+
if (hasParticles) {
|
|
780
|
+
if (hasName(data, "ParticleSystem")) {
|
|
781
|
+
addNamed(named, "@vista3d/particlesystem", ["ParticleSystem"]);
|
|
782
|
+
related.add("particle-system");
|
|
783
|
+
bodies.push(`const particleEntity = scene.rootEntity.createChild({ name: 'Particles' });
|
|
784
|
+
particleEntity.addComponent(ParticleSystem, { playOnAwake: true });`);
|
|
785
|
+
} else bodies.push(todo("module.particlesystem 关键符号 ParticleSystem 未检出,已降级"));
|
|
786
|
+
}
|
|
787
|
+
if (hasWorker) {
|
|
788
|
+
if (hasName(data, "WorkerManager")) {
|
|
789
|
+
addNamed(named, "@vista3d/core", ["WorkerManager"]);
|
|
790
|
+
bodies.push(`const workerManager = new WorkerManager({
|
|
791
|
+
maxWorkers: 2,
|
|
792
|
+
taskTimeoutMs: 30_000
|
|
793
|
+
});
|
|
794
|
+
void workerManager;`);
|
|
795
|
+
} else bodies.push(todo("worker 关键符号 WorkerManager 未检出,已降级"));
|
|
796
|
+
}
|
|
797
|
+
if (c1Ok) bodies.push("scene.setActive(true);");
|
|
798
|
+
const code = [
|
|
799
|
+
...[`// vista3d generate_setup — features: ${JSON.stringify(features)}`, `// relatedExamples: ${[...related].join(", ")}`],
|
|
800
|
+
...formatImports(named),
|
|
801
|
+
"",
|
|
802
|
+
bodies.join("\n\n")
|
|
803
|
+
].join("\n");
|
|
804
|
+
return { text: warnings.length > 0 ? `${warnings.join("\n")}\n\n${code}` : code };
|
|
805
|
+
}
|
|
806
|
+
function registerGenerateSetup(server, data) {
|
|
807
|
+
server.registerTool("generate_setup", {
|
|
808
|
+
description: "空白项目、从零开始时生成一份可运行的场景初始化样板。已经有引擎或场景时不要用,改用 get_example 或 search_api。符号以 api-index 公开导出为准,不对照 examples/。默认 engine.webgl + scene.basic。支持 engine.webgpu、render.mesh、asset.gltf、picking、worker、module.particlesystem。module.postprocessing 尚无独立最小模板。",
|
|
809
|
+
inputSchema: z.object({ features: z.array(z.string()).default([]).describe("功能列表,如 engine.webgl、engine.webgpu、scene.basic、render.mesh、asset.gltf、picking、worker、module.particlesystem") })
|
|
810
|
+
}, ({ features }) => {
|
|
811
|
+
const { text } = buildGenerateSetup(data, features ?? []);
|
|
812
|
+
return { content: [{
|
|
813
|
+
type: "text",
|
|
814
|
+
text
|
|
815
|
+
}] };
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
// src/tools/get-component.ts
|
|
819
|
+
/**
|
|
820
|
+
* Fetch one API symbol. Default detail=summary (no TypeDoc body).
|
|
821
|
+
*/
|
|
822
|
+
function jsonContent$3(payload) {
|
|
823
|
+
return { content: [{
|
|
824
|
+
type: "text",
|
|
825
|
+
text: JSON.stringify(payload, null, 2)
|
|
826
|
+
}] };
|
|
827
|
+
}
|
|
828
|
+
function presentEntry(data, cls, detail) {
|
|
829
|
+
const markdownUri = `vista3d://api/id/${cls.id}`;
|
|
830
|
+
if (detail !== "full") return {
|
|
831
|
+
...cls,
|
|
832
|
+
detail: "summary",
|
|
833
|
+
markdown: null,
|
|
834
|
+
markdownUri
|
|
835
|
+
};
|
|
836
|
+
const abs = resolve(data.dataDir, cls.mdRelativePath);
|
|
837
|
+
if (!existsSync(abs)) return {
|
|
838
|
+
...cls,
|
|
839
|
+
detail: "full",
|
|
840
|
+
markdown: null,
|
|
841
|
+
markdownUri
|
|
842
|
+
};
|
|
843
|
+
const raw = readFileSync(abs, "utf8");
|
|
844
|
+
return {
|
|
845
|
+
...cls,
|
|
846
|
+
detail: "full",
|
|
847
|
+
markdown: presentTypedocMarkdown(raw, cls, data.byId, data.byName),
|
|
848
|
+
markdownUri
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
function findByName(data, name) {
|
|
852
|
+
const exact = data.byName.get(name);
|
|
853
|
+
if (exact && exact.length > 0) return exact;
|
|
854
|
+
const lower = name.toLowerCase();
|
|
855
|
+
const hits = [];
|
|
856
|
+
for (const [key, items] of data.byName) if (key.toLowerCase() === lower) hits.push(...items);
|
|
857
|
+
return hits;
|
|
858
|
+
}
|
|
859
|
+
function nameCandidates(data, name) {
|
|
860
|
+
const lower = name.toLowerCase();
|
|
861
|
+
return data.index.classes.filter((c) => c.name.toLowerCase().includes(lower)).slice(0, 8).map((c) => ({
|
|
862
|
+
id: c.id,
|
|
863
|
+
name: c.name,
|
|
864
|
+
packageSlug: c.packageSlug
|
|
865
|
+
}));
|
|
866
|
+
}
|
|
867
|
+
function registerGetComponent(server, data) {
|
|
868
|
+
server.registerTool("get_component_api", {
|
|
869
|
+
description: "获取单个符号的 API。默认 detail=summary:含 ctor、memberNames,markdown 为 null,全文在 markdownUri。核对构造参数或方法签名时再设 detail=full。优先用 id。",
|
|
870
|
+
inputSchema: z.object({
|
|
871
|
+
id: z.string().optional().describe("稳定 id,如 core:class:MeshRenderer"),
|
|
872
|
+
name: z.string().optional().describe("符号名,如 MeshRenderer(可能歧义)"),
|
|
873
|
+
detail: z.enum(["summary", "full"]).default("summary").describe("summary=摘要(默认);full=附带 TypeDoc markdown")
|
|
874
|
+
})
|
|
875
|
+
}, ({ id, name, detail = "summary" }) => {
|
|
876
|
+
if (id) {
|
|
877
|
+
const cls = data.byId.get(id);
|
|
878
|
+
if (!cls) return jsonContent$3({
|
|
879
|
+
error: {
|
|
880
|
+
code: "NOT_FOUND",
|
|
881
|
+
message: `未找到 API「${id}」`,
|
|
882
|
+
hint: "先调 search_api 再用 id 获取"
|
|
883
|
+
},
|
|
884
|
+
candidates: nameCandidates(data, id.split(":").pop() ?? id)
|
|
885
|
+
});
|
|
886
|
+
return jsonContent$3(presentEntry(data, cls, detail));
|
|
887
|
+
}
|
|
888
|
+
if (!name || name.trim().length === 0) return jsonContent$3({ error: {
|
|
889
|
+
code: "INVALID_PARAM",
|
|
890
|
+
message: "必须提供 id 或 name"
|
|
891
|
+
} });
|
|
892
|
+
const trimmed = name.trim();
|
|
893
|
+
const matches = findByName(data, trimmed);
|
|
894
|
+
if (matches.length === 0) return jsonContent$3({
|
|
895
|
+
error: {
|
|
896
|
+
code: "NOT_FOUND",
|
|
897
|
+
message: `未找到「${trimmed}」`,
|
|
898
|
+
hint: "先调 search_api 再用 id 获取"
|
|
899
|
+
},
|
|
900
|
+
candidates: nameCandidates(data, trimmed)
|
|
901
|
+
});
|
|
902
|
+
if (matches.length > 1) return jsonContent$3({
|
|
903
|
+
error: {
|
|
904
|
+
code: "AMBIGUOUS_NAME",
|
|
905
|
+
message: `同名多条:${trimmed}`
|
|
906
|
+
},
|
|
907
|
+
candidates: matches.map((c) => ({
|
|
908
|
+
id: c.id,
|
|
909
|
+
name: c.name,
|
|
910
|
+
package: c.package,
|
|
911
|
+
packageSlug: c.packageSlug,
|
|
912
|
+
description: c.description
|
|
913
|
+
}))
|
|
914
|
+
});
|
|
915
|
+
return jsonContent$3(presentEntry(data, matches[0], detail));
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
// src/tools/get-coordinate-guide.ts
|
|
919
|
+
/**
|
|
920
|
+
* Return the coordinate-system guide body (YAML front-matter stripped).
|
|
921
|
+
*/
|
|
922
|
+
function registerGetCoordinateGuide(server, data) {
|
|
923
|
+
server.registerTool("get_coordinate_guide", {
|
|
924
|
+
description: "获取坐标系选型与转换指南正文。",
|
|
925
|
+
inputSchema: z.object({})
|
|
926
|
+
}, () => {
|
|
927
|
+
const meta = data.guideBySlug.get("coordinate-systems");
|
|
928
|
+
if (meta) return { content: [{
|
|
929
|
+
type: "text",
|
|
930
|
+
text: stripYamlFrontMatter(readFileSync(meta.filePath, "utf8"))
|
|
931
|
+
}] };
|
|
932
|
+
return { content: [{
|
|
933
|
+
type: "text",
|
|
934
|
+
text: JSON.stringify({
|
|
935
|
+
error: {
|
|
936
|
+
code: "NOT_FOUND",
|
|
937
|
+
message: "未找到指南 coordinate-systems"
|
|
938
|
+
},
|
|
939
|
+
candidates: data.guideSlugs,
|
|
940
|
+
hint: "在 resources/guides 下提供 slug 为 coordinate-systems 的 md"
|
|
941
|
+
}, null, 2)
|
|
942
|
+
}] };
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
// src/tools/get-example.ts
|
|
946
|
+
function jsonContent$2(payload) {
|
|
947
|
+
return { content: [{
|
|
948
|
+
type: "text",
|
|
949
|
+
text: JSON.stringify(payload, null, 2)
|
|
950
|
+
}] };
|
|
951
|
+
}
|
|
952
|
+
function normalize(s) {
|
|
953
|
+
return s.toLowerCase().replace(/[^a-z0-9\u4e00-\u9fff]+/g, "");
|
|
954
|
+
}
|
|
955
|
+
function similarity(a, b) {
|
|
956
|
+
const x = normalize(a);
|
|
957
|
+
const y = normalize(b);
|
|
958
|
+
if (!x || !y) return 0;
|
|
959
|
+
if (x === y) return 1;
|
|
960
|
+
if (x.includes(y) || y.includes(x)) return Math.min(x.length, y.length) / Math.max(x.length, y.length);
|
|
961
|
+
let i = 0;
|
|
962
|
+
while (i < x.length && i < y.length && x[i] === y[i]) i++;
|
|
963
|
+
if (i < 4) return 0;
|
|
964
|
+
const ratio = i / Math.max(x.length, y.length);
|
|
965
|
+
return ratio >= .5 ? ratio : 0;
|
|
966
|
+
}
|
|
967
|
+
var MIN_CANDIDATE_SCORE = 8;
|
|
968
|
+
function scoreMeta(topic, meta) {
|
|
969
|
+
const t = topic.trim().toLowerCase();
|
|
970
|
+
const tn = normalize(topic);
|
|
971
|
+
if (tn.length === 0) return 0;
|
|
972
|
+
let s = 0;
|
|
973
|
+
const sim = similarity(meta.slug, topic);
|
|
974
|
+
if (sim >= .6) s += 20;
|
|
975
|
+
else if (sim >= .5) s += 10;
|
|
976
|
+
const slug = meta.slug.toLowerCase();
|
|
977
|
+
if (slug === t) s += 100;
|
|
978
|
+
else if (slug.includes(t) || t.includes(slug)) s += 40;
|
|
979
|
+
else if (normalize(meta.slug).includes(tn) || tn.includes(normalize(meta.slug))) s += 25;
|
|
980
|
+
if (meta.aliases.some((a) => a.toLowerCase() === t)) s += 50;
|
|
981
|
+
else if (meta.aliases.some((a) => normalize(a).includes(tn) || tn.includes(normalize(a)))) s += 20;
|
|
982
|
+
if (meta.title.toLowerCase().includes(t) || normalize(meta.title).includes(tn)) s += 12;
|
|
983
|
+
if (meta.tags.some((tag) => tag.toLowerCase() === t)) s += 8;
|
|
984
|
+
if (meta.keywords.some((k) => k.toLowerCase() === t || normalize(k).includes(tn) || tn.includes(normalize(k)))) s += 6;
|
|
985
|
+
if (meta.summary && (meta.summary.toLowerCase().includes(t) || normalize(meta.summary).includes(tn))) s += 4;
|
|
986
|
+
return s;
|
|
987
|
+
}
|
|
988
|
+
function mentionsTopic(meta, topic) {
|
|
989
|
+
const tn = normalize(topic);
|
|
990
|
+
if (tn.length === 0) return false;
|
|
991
|
+
if (normalize(meta.slug).includes(tn)) return true;
|
|
992
|
+
if (meta.aliases.some((a) => normalize(a).includes(tn))) return true;
|
|
993
|
+
return meta.keywords.some((k) => normalize(k).includes(tn));
|
|
994
|
+
}
|
|
995
|
+
function directoryCandidates(data) {
|
|
996
|
+
return data.exampleSearchable.slice().sort((a, b) => a.slug.localeCompare(b.slug)).slice(0, 8).map((meta) => ({
|
|
997
|
+
slug: meta.slug,
|
|
998
|
+
title: meta.title,
|
|
999
|
+
score: 0
|
|
1000
|
+
}));
|
|
1001
|
+
}
|
|
1002
|
+
function topCandidates(items) {
|
|
1003
|
+
return items.slice(0, 8).map((s) => ({
|
|
1004
|
+
slug: s.meta.slug,
|
|
1005
|
+
title: s.meta.title,
|
|
1006
|
+
score: Math.round(s.score * 100) / 100
|
|
1007
|
+
}));
|
|
1008
|
+
}
|
|
1009
|
+
function resolveGuide(topic, guides) {
|
|
1010
|
+
const t = topic.trim().toLowerCase();
|
|
1011
|
+
const tn = normalize(topic);
|
|
1012
|
+
return guides.find((g) => {
|
|
1013
|
+
if (g.slug === t || g.slug.toLowerCase() === t) return true;
|
|
1014
|
+
return g.aliases.some((a) => a.toLowerCase() === t || normalize(a) === tn);
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
1017
|
+
function notFound(topic, candidates) {
|
|
1018
|
+
return jsonContent$2({
|
|
1019
|
+
error: {
|
|
1020
|
+
code: "EXAMPLE_NOT_FOUND",
|
|
1021
|
+
message: `未找到 example「${topic}」`
|
|
1022
|
+
},
|
|
1023
|
+
slug: topic,
|
|
1024
|
+
candidates
|
|
1025
|
+
});
|
|
1026
|
+
}
|
|
1027
|
+
function registerGetExample(server, data) {
|
|
1028
|
+
server.registerTool("get_example", {
|
|
1029
|
+
description: "按 example 的 slug 或别名取可运行代码。先精确匹配 example;找不到再看 topic 是否等于某篇 guide 的 slug 或 alias,是则返回 GUIDE_NOT_EXAMPLE 与 vista3d://guide/{slug}。guide 和 example 可以同名,同名时返回 example。不要把 guide 当 example 读。",
|
|
1030
|
+
inputSchema: z.object({
|
|
1031
|
+
topic: z.string().min(1).describe("example slug 或别名"),
|
|
1032
|
+
strict: z.boolean().default(false).describe("true 时只精确匹配 slug/alias,不自动采用模糊第一名")
|
|
1033
|
+
})
|
|
1034
|
+
}, ({ topic, strict }) => {
|
|
1035
|
+
const exact = data.getExampleResult(topic);
|
|
1036
|
+
if (exact) return jsonContent$2(exact);
|
|
1037
|
+
const guide = resolveGuide(topic, data.guideSearchable);
|
|
1038
|
+
if (guide) return jsonContent$2({
|
|
1039
|
+
error: {
|
|
1040
|
+
code: "GUIDE_NOT_EXAMPLE",
|
|
1041
|
+
message: "topic 是 guide,不是 example。请用 resources/read 读正文。"
|
|
1042
|
+
},
|
|
1043
|
+
slug: guide.slug,
|
|
1044
|
+
title: guide.title,
|
|
1045
|
+
uri: `vista3d://guide/${guide.slug}`
|
|
1046
|
+
});
|
|
1047
|
+
const fuzzy = data.exampleSearchable.map((meta) => ({
|
|
1048
|
+
meta,
|
|
1049
|
+
score: scoreMeta(topic, meta)
|
|
1050
|
+
})).filter((s) => s.score >= MIN_CANDIDATE_SCORE && mentionsTopic(s.meta, topic)).sort((a, b) => b.score - a.score);
|
|
1051
|
+
const candidates = fuzzy.length > 0 ? topCandidates(fuzzy) : directoryCandidates(data);
|
|
1052
|
+
if (strict || fuzzy.length === 0) return notFound(topic, candidates);
|
|
1053
|
+
const result = data.getExampleResult(fuzzy[0].meta.slug);
|
|
1054
|
+
if (!result) return notFound(topic, candidates);
|
|
1055
|
+
return jsonContent$2(result);
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
1058
|
+
// src/tools/list-components.ts
|
|
1059
|
+
var KINDS = [
|
|
1060
|
+
"class",
|
|
1061
|
+
"interface",
|
|
1062
|
+
"type",
|
|
1063
|
+
"enum",
|
|
1064
|
+
"function",
|
|
1065
|
+
"variable"
|
|
1066
|
+
];
|
|
1067
|
+
function jsonContent$1(payload) {
|
|
1068
|
+
return { content: [{
|
|
1069
|
+
type: "text",
|
|
1070
|
+
text: JSON.stringify(payload, null, 2)
|
|
1071
|
+
}] };
|
|
1072
|
+
}
|
|
1073
|
+
function toSlug(pkg) {
|
|
1074
|
+
return pkg.startsWith("@vista3d/") ? pkg.slice(9) : pkg;
|
|
1075
|
+
}
|
|
1076
|
+
function registerListComponents(server, data) {
|
|
1077
|
+
const validSlugs = new Set(data.index.packages.map((p) => p.packageSlug));
|
|
1078
|
+
server.registerTool("list_components", {
|
|
1079
|
+
description: "列出 vista3d 公开类/接口/类型/枚举/函数/变量。kind 可选。默认 50 条,用 limit/offset 翻页。",
|
|
1080
|
+
inputSchema: z.object({
|
|
1081
|
+
package: z.string().optional().describe("按包过滤,如 @vista3d/core 或 core"),
|
|
1082
|
+
kind: z.enum(KINDS).optional().describe("按类型过滤"),
|
|
1083
|
+
limit: z.number().int().min(1).max(200).optional().describe("返回条数,默认 50,最大 200"),
|
|
1084
|
+
offset: z.number().int().min(0).optional().describe("偏移,默认 0")
|
|
1085
|
+
})
|
|
1086
|
+
}, ({ package: pkg, kind, limit, offset }) => {
|
|
1087
|
+
let items = data.index.classes;
|
|
1088
|
+
if (pkg) {
|
|
1089
|
+
const slug = toSlug(pkg);
|
|
1090
|
+
if (!validSlugs.has(slug)) return jsonContent$1({ error: {
|
|
1091
|
+
code: "INVALID_PARAM",
|
|
1092
|
+
message: `无效的包名: ${pkg}`,
|
|
1093
|
+
validPackages: data.index.packages.map((p) => p.package)
|
|
1094
|
+
} });
|
|
1095
|
+
items = items.filter((c) => c.packageSlug === slug);
|
|
1096
|
+
}
|
|
1097
|
+
if (kind) items = items.filter((c) => c.kind === kind);
|
|
1098
|
+
const take = limit ?? 50;
|
|
1099
|
+
const skip = offset ?? 0;
|
|
1100
|
+
const page = items.slice(skip, skip + take);
|
|
1101
|
+
return jsonContent$1({
|
|
1102
|
+
results: page.map((c) => ({
|
|
1103
|
+
id: c.id,
|
|
1104
|
+
name: c.name,
|
|
1105
|
+
package: c.package,
|
|
1106
|
+
packageSlug: c.packageSlug,
|
|
1107
|
+
kind: c.kind,
|
|
1108
|
+
description: c.description
|
|
1109
|
+
})),
|
|
1110
|
+
total: items.length,
|
|
1111
|
+
limit: take,
|
|
1112
|
+
offset: skip,
|
|
1113
|
+
hasMore: skip + page.length < items.length
|
|
1114
|
+
});
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
// src/tools/search-api.ts
|
|
1118
|
+
function normalizeTerm(s) {
|
|
1119
|
+
return s.toLowerCase().replace(/[^a-z0-9\u4e00-\u9fff]+/g, "");
|
|
1120
|
+
}
|
|
1121
|
+
function packageSlug(pkg) {
|
|
1122
|
+
return pkg.startsWith("@vista3d/") ? pkg.slice(9) : pkg;
|
|
1123
|
+
}
|
|
1124
|
+
function jsonContent(payload) {
|
|
1125
|
+
return { content: [{
|
|
1126
|
+
type: "text",
|
|
1127
|
+
text: JSON.stringify(payload, null, 2)
|
|
1128
|
+
}] };
|
|
1129
|
+
}
|
|
1130
|
+
function stripQuestionWords(q) {
|
|
1131
|
+
return q.replace(/how\s+to/gi, " ").replace(/\b(how|to)\b/gi, " ").replace(/怎么|如何|怎样/g, " ").replace(/\s+/g, " ").trim();
|
|
1132
|
+
}
|
|
1133
|
+
function docMatches(meta, q, qLower, qNorm) {
|
|
1134
|
+
if (q.length === 0 || qNorm.length === 0) return false;
|
|
1135
|
+
if (meta.slug === qLower || normalizeTerm(meta.slug) === qNorm) return true;
|
|
1136
|
+
if (meta.title === q || normalizeTerm(meta.title) === qNorm) return true;
|
|
1137
|
+
if (meta.aliases.some((a) => a.toLowerCase() === qLower || normalizeTerm(a) === qNorm)) return true;
|
|
1138
|
+
return meta.keywords.some((k) => k.toLowerCase() === qLower || normalizeTerm(k) === qNorm);
|
|
1139
|
+
}
|
|
1140
|
+
function buildDocIndex(data) {
|
|
1141
|
+
const index = createDocMiniSearch();
|
|
1142
|
+
const add = (kind, items) => {
|
|
1143
|
+
for (const meta of items) index.add({
|
|
1144
|
+
id: `${kind}:${meta.slug}`,
|
|
1145
|
+
kind,
|
|
1146
|
+
slug: meta.slug,
|
|
1147
|
+
title: meta.title,
|
|
1148
|
+
aliases: meta.aliases.join(" "),
|
|
1149
|
+
keywords: meta.keywords.join(" "),
|
|
1150
|
+
summary: meta.summary ?? ""
|
|
1151
|
+
});
|
|
1152
|
+
};
|
|
1153
|
+
add("guide", data.guideSearchable);
|
|
1154
|
+
add("example", data.exampleSearchable);
|
|
1155
|
+
return index;
|
|
1156
|
+
}
|
|
1157
|
+
function registerSearchApi(server, data) {
|
|
1158
|
+
const docIndex = buildDocIndex(data);
|
|
1159
|
+
server.registerTool("search_api", {
|
|
1160
|
+
description: "检索 vista3d 公开 API(类/接口/类型/枚举/函数/变量及成员名),同时返回匹配的 guide / example。中英文均可。",
|
|
1161
|
+
inputSchema: z.object({
|
|
1162
|
+
query: z.string().min(1).describe("检索关键词:类名或短词,如 WebGLEngine、引擎。不要把用户原句原样传入"),
|
|
1163
|
+
limit: z.number().int().min(1).max(50).default(10).describe("返回条数上限,默认 10"),
|
|
1164
|
+
package: z.string().optional().describe("按包过滤,如 @vista3d/core 或 core")
|
|
1165
|
+
})
|
|
1166
|
+
}, ({ query, limit, package: pkg }) => executeSearchApi(data, docIndex, query, limit, pkg));
|
|
1167
|
+
}
|
|
1168
|
+
function executeSearchApi(data, docIndex, query, limit, pkg) {
|
|
1169
|
+
const take = limit ?? 10;
|
|
1170
|
+
const q = query.trim();
|
|
1171
|
+
if (q.length === 0) return jsonContent({ error: {
|
|
1172
|
+
code: "INVALID_PARAM",
|
|
1173
|
+
message: "query 不能为空"
|
|
1174
|
+
} });
|
|
1175
|
+
let slugFilter;
|
|
1176
|
+
if (pkg) {
|
|
1177
|
+
slugFilter = packageSlug(pkg);
|
|
1178
|
+
if (!data.index.packages.some((p) => p.packageSlug === slugFilter)) return jsonContent({ error: {
|
|
1179
|
+
code: "INVALID_PARAM",
|
|
1180
|
+
message: `无效的包名: ${pkg}`,
|
|
1181
|
+
validPackages: data.index.packages.map((p) => p.package)
|
|
1182
|
+
} });
|
|
1183
|
+
}
|
|
1184
|
+
const qLower = q.toLowerCase();
|
|
1185
|
+
const qNorm = normalizeTerm(q);
|
|
1186
|
+
const stripped = stripQuestionWords(q);
|
|
1187
|
+
const strippedLower = stripped.toLowerCase();
|
|
1188
|
+
const strippedNorm = normalizeTerm(stripped);
|
|
1189
|
+
const raw = data.search.search(q, {
|
|
1190
|
+
prefix: true,
|
|
1191
|
+
fuzzy: .2,
|
|
1192
|
+
boost: SEARCH_BOOST,
|
|
1193
|
+
...slugFilter ? { filter: (r) => r.packageSlug === slugFilter } : {}
|
|
1194
|
+
});
|
|
1195
|
+
const hits = [];
|
|
1196
|
+
const seenDocs = /* @__PURE__ */ new Set();
|
|
1197
|
+
for (const r of raw) {
|
|
1198
|
+
const rec = r;
|
|
1199
|
+
const members = String(rec.memberNames ?? "").split(/\s+/).filter(Boolean);
|
|
1200
|
+
const exactName = rec.name.toLowerCase() === qLower;
|
|
1201
|
+
const matched = members.find((m) => m.toLowerCase() === qLower) ?? null;
|
|
1202
|
+
let score = r.score;
|
|
1203
|
+
if (exactName) score *= 6;
|
|
1204
|
+
else if (rec.name.toLowerCase().includes(qLower)) score *= 2;
|
|
1205
|
+
if (matched) score *= 4;
|
|
1206
|
+
const cls = data.byId.get(rec.id);
|
|
1207
|
+
hits.push({
|
|
1208
|
+
kind: "api",
|
|
1209
|
+
id: rec.id,
|
|
1210
|
+
name: rec.name,
|
|
1211
|
+
title: null,
|
|
1212
|
+
package: rec.package,
|
|
1213
|
+
packageSlug: rec.packageSlug,
|
|
1214
|
+
description: cls?.description ?? rec.description ?? null,
|
|
1215
|
+
mdRelativePath: rec.mdRelativePath,
|
|
1216
|
+
matchedMember: matched,
|
|
1217
|
+
score: Math.round(score * 100) / 100
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
const pushDoc = (kind, meta, score) => {
|
|
1221
|
+
const key = `${kind}:${meta.slug}`;
|
|
1222
|
+
if (seenDocs.has(key)) {
|
|
1223
|
+
const existing = hits.find((h) => h.kind === kind && h.id === meta.slug);
|
|
1224
|
+
if (existing && score > existing.score) existing.score = score;
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
seenDocs.add(key);
|
|
1228
|
+
hits.push({
|
|
1229
|
+
kind,
|
|
1230
|
+
id: meta.slug,
|
|
1231
|
+
name: meta.slug,
|
|
1232
|
+
title: meta.title,
|
|
1233
|
+
package: null,
|
|
1234
|
+
packageSlug: null,
|
|
1235
|
+
description: meta.summary,
|
|
1236
|
+
mdRelativePath: null,
|
|
1237
|
+
matchedMember: null,
|
|
1238
|
+
score
|
|
1239
|
+
});
|
|
1240
|
+
};
|
|
1241
|
+
const addExactDocs = (queryText, queryLower, queryNorm) => {
|
|
1242
|
+
const addKind = (kind, items) => {
|
|
1243
|
+
for (const meta of items) {
|
|
1244
|
+
if (!docMatches(meta, queryText, queryLower, queryNorm)) continue;
|
|
1245
|
+
const exact = meta.slug === queryLower || meta.aliases.some((a) => a.toLowerCase() === queryLower);
|
|
1246
|
+
pushDoc(kind, meta, exact ? 3e3 : 800);
|
|
1247
|
+
}
|
|
1248
|
+
};
|
|
1249
|
+
addKind("guide", data.guideSearchable);
|
|
1250
|
+
addKind("example", data.exampleSearchable);
|
|
1251
|
+
};
|
|
1252
|
+
addExactDocs(q, qLower, qNorm);
|
|
1253
|
+
if (stripped.length > 0 && strippedNorm !== qNorm) addExactDocs(stripped, strippedLower, strippedNorm);
|
|
1254
|
+
if (stripped.length > 0 && tokenize(stripped).length > 0) {
|
|
1255
|
+
const docRaw = docIndex.search(stripped, {
|
|
1256
|
+
prefix: true,
|
|
1257
|
+
fuzzy: .2,
|
|
1258
|
+
boost: DOC_SEARCH_BOOST,
|
|
1259
|
+
combineWith: "OR"
|
|
1260
|
+
});
|
|
1261
|
+
for (const r of docRaw) {
|
|
1262
|
+
const rec = r;
|
|
1263
|
+
const meta = rec.kind === "guide" ? data.guideBySlug.get(rec.slug) : data.exampleBySlug.get(rec.slug);
|
|
1264
|
+
if (!meta) continue;
|
|
1265
|
+
pushDoc(rec.kind, meta, Math.min(700, Math.round(50 + r.score)));
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
hits.sort((a, b) => {
|
|
1269
|
+
const aExactName = a.kind === "api" && a.name.toLowerCase() === qLower;
|
|
1270
|
+
const bExactName = b.kind === "api" && b.name.toLowerCase() === qLower;
|
|
1271
|
+
if (aExactName !== bExactName) return aExactName ? -1 : 1;
|
|
1272
|
+
const aMember = a.kind === "api" && a.matchedMember !== null && !aExactName;
|
|
1273
|
+
if (aMember !== (b.kind === "api" && b.matchedMember !== null && !bExactName)) return aMember ? -1 : 1;
|
|
1274
|
+
return b.score - a.score;
|
|
1275
|
+
});
|
|
1276
|
+
return jsonContent({
|
|
1277
|
+
results: hits.slice(0, take),
|
|
1278
|
+
total: hits.length
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
// src/server.ts
|
|
1282
|
+
/**
|
|
1283
|
+
* MCP stdio entry. Runtime reads only data/ and resources/.
|
|
1284
|
+
*/
|
|
1285
|
+
var data = await loadData();
|
|
1286
|
+
var server = new McpServer({
|
|
1287
|
+
name: "vista3d",
|
|
1288
|
+
version: data.index.sdkVersion
|
|
1289
|
+
}, { instructions: "事实只信本服务的 Tool 与 Resource,不要猜构造参数。" });
|
|
1290
|
+
registerSearchApi(server, data);
|
|
1291
|
+
registerGetComponent(server, data);
|
|
1292
|
+
registerListComponents(server, data);
|
|
1293
|
+
registerGetExample(server, data);
|
|
1294
|
+
registerGenerateSetup(server, data);
|
|
1295
|
+
registerGetCoordinateGuide(server, data);
|
|
1296
|
+
registerPackagesResource(server, data);
|
|
1297
|
+
registerGuideResource(server, data);
|
|
1298
|
+
registerApiResource(server, data);
|
|
1299
|
+
var transport = new StdioServerTransport();
|
|
1300
|
+
await server.connect(transport);
|
|
1301
|
+
export { server };
|