@tonyclaw/agent-inspector 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/backend/nitro.json +1 -1
- package/.output/cli.js +192 -109
- package/.output/server/_ssr/index.mjs +1 -1
- package/.output/server/_ssr/{router-CTHqmroT.mjs → router-BBY_zWRK.mjs} +91 -3
- package/.output/server/index.mjs +1 -1
- package/.output/ui/assets/{CompareDrawer-L3n4J-Or.js → CompareDrawer-rtNElN-B.js} +1 -1
- package/.output/ui/assets/{InspectorPet-D5o_3OZS.js → InspectorPet-QaAiuF3d.js} +1 -1
- package/.output/ui/assets/{ProxyViewerContainer-Ocagx75S.js → ProxyViewerContainer-6twNZHwl.js} +4 -4
- package/.output/ui/assets/{ReplayDialog-Bk7x1h-y.js → ReplayDialog-B7KlziO2.js} +1 -1
- package/.output/ui/assets/{RequestAnatomy-U4lzL7Sc.js → RequestAnatomy-2XVFBrW4.js} +1 -1
- package/.output/ui/assets/{ResponseView-LOWfvBLK.js → ResponseView-BULgzLVB.js} +1 -1
- package/.output/ui/assets/{StreamingChunkSequence-DPfsrrXQ.js → StreamingChunkSequence-DSkvkbns.js} +1 -1
- package/.output/ui/assets/{_sessionId-OdX2Jvt1.js → _sessionId-D2dmJi3G.js} +1 -1
- package/.output/ui/assets/{_sessionId-0MlWS-CO.js → _sessionId-DcS0s1Mr.js} +1 -1
- package/.output/ui/assets/{index-Du4qNOOt.js → index-B0TN1KKO.js} +2 -2
- package/.output/ui/assets/{index-gvFj_9K6.js → index-Bva1zHEs.js} +1 -1
- package/.output/ui/assets/{index-Ea-c8hPg.js → index-BzBExOxu.js} +1 -1
- package/.output/ui/assets/{index-zVVS53Hd.js → index-k6sRQz55.js} +1 -1
- package/.output/ui/assets/{json-viewer-C1WAMzg3.js → json-viewer-CWM4tY-j.js} +1 -1
- package/.output/ui/assets/{jszip.min-B8AKu2zm.js → jszip.min-BkWvRFlo.js} +1 -1
- package/.output/ui/index.html +1 -1
- package/package.json +5 -10
- package/src/assets/IDE/claudecode-color.svg +0 -1
- package/src/assets/IDE/codex-color.svg +0 -1
- package/src/assets/IDE/opencode.svg +0 -1
- package/src/assets/IDE/xiaomimimo.svg +0 -1
- package/src/assets/favicon.svg +0 -21
- package/src/assets/logos/alibaba.svg +0 -1
- package/src/assets/logos/anthropic.svg +0 -1
- package/src/assets/logos/claude-code.svg +0 -4
- package/src/assets/logos/deepseek.svg +0 -1
- package/src/assets/logos/minimax.jpeg +0 -0
- package/src/assets/logos/openai.svg +0 -1
- package/src/assets/logos/opencode.svg +0 -4
- package/src/assets/logos/qwen.webp +0 -0
- package/src/assets/logos/zhipuai.svg +0 -219
- package/src/backend/router.tsx +0 -36
- package/src/backend/routes/$.ts +0 -26
- package/src/backend/routes/__root.ts +0 -4
- package/src/backend/routes/api/-instances.ts +0 -7
- package/src/backend/routes/api/alerts.summary.ts +0 -28
- package/src/backend/routes/api/alerts.ts +0 -70
- package/src/backend/routes/api/config.paths.ts +0 -14
- package/src/backend/routes/api/config.ts +0 -73
- package/src/backend/routes/api/ecosystem.packages.$packageId.help.ts +0 -11
- package/src/backend/routes/api/ecosystem.packages.$packageId.install.ts +0 -11
- package/src/backend/routes/api/ecosystem.packages.$packageId.runner-presets.ts +0 -11
- package/src/backend/routes/api/ecosystem.packages.$packageId.upgrade.ts +0 -11
- package/src/backend/routes/api/ecosystem.packages.ts +0 -21
- package/src/backend/routes/api/ecosystem.recipes.$recipeId.run.ts +0 -11
- package/src/backend/routes/api/ecosystem.tasks.$taskId.ts +0 -16
- package/src/backend/routes/api/ecosystem.tasks.ts +0 -12
- package/src/backend/routes/api/groups.$groupId.evidence.ts +0 -55
- package/src/backend/routes/api/groups.$groupId.sessions.ts +0 -50
- package/src/backend/routes/api/groups.$groupId.ts +0 -93
- package/src/backend/routes/api/groups.ts +0 -79
- package/src/backend/routes/api/health.ts +0 -22
- package/src/backend/routes/api/instances.$name.connection.ts +0 -12
- package/src/backend/routes/api/instances.$name.restart.ts +0 -23
- package/src/backend/routes/api/instances.$name.start.ts +0 -18
- package/src/backend/routes/api/instances.$name.stop.ts +0 -23
- package/src/backend/routes/api/instances.$name.ts +0 -12
- package/src/backend/routes/api/instances.ts +0 -16
- package/src/backend/routes/api/knowledge.candidates.$candidateId.promote.ts +0 -32
- package/src/backend/routes/api/knowledge.candidates.$candidateId.ts +0 -50
- package/src/backend/routes/api/knowledge.candidates.ts +0 -10
- package/src/backend/routes/api/knowledge.project-context.ts +0 -29
- package/src/backend/routes/api/knowledge.search.ts +0 -62
- package/src/backend/routes/api/knowledge.sessions.$sessionId.candidates.ts +0 -26
- package/src/backend/routes/api/logs.$id.body.ts +0 -58
- package/src/backend/routes/api/logs.$id.chunks.ts +0 -37
- package/src/backend/routes/api/logs.$id.replay.ts +0 -297
- package/src/backend/routes/api/logs.$id.ts +0 -23
- package/src/backend/routes/api/logs.import.ts +0 -39
- package/src/backend/routes/api/logs.stream.ts +0 -174
- package/src/backend/routes/api/logs.ts +0 -214
- package/src/backend/routes/api/mcp.ts +0 -25
- package/src/backend/routes/api/models.ts +0 -10
- package/src/backend/routes/api/pi-agent.ts +0 -29
- package/src/backend/routes/api/providers.$providerId.model-metadata.ts +0 -173
- package/src/backend/routes/api/providers.$providerId.test.log.ts +0 -342
- package/src/backend/routes/api/providers.$providerId.ts +0 -111
- package/src/backend/routes/api/providers.export.ts +0 -44
- package/src/backend/routes/api/providers.import.ts +0 -81
- package/src/backend/routes/api/providers.scan.ts +0 -28
- package/src/backend/routes/api/providers.ts +0 -102
- package/src/backend/routes/api/runs.$runId.evidence.ts +0 -55
- package/src/backend/routes/api/runs.$runId.ts +0 -50
- package/src/backend/routes/api/runs.ts +0 -62
- package/src/backend/routes/api/runtime.ts +0 -46
- package/src/backend/routes/api/sessions.ts +0 -51
- package/src/backend/routes/api/storage.ts +0 -56
- package/src/backend/routes/livez.ts +0 -13
- package/src/backend/routes/metrics.ts +0 -14
- package/src/backend/routes/proxy/$.ts +0 -15
- package/src/backend/routes/readyz.ts +0 -18
- package/src/backend/start.ts +0 -10
- package/src/cli/alias.ts +0 -431
- package/src/cli/detect-tools.ts +0 -123
- package/src/cli/doctor.ts +0 -836
- package/src/cli/instance.ts +0 -1071
- package/src/cli/instanceApi.ts +0 -213
- package/src/cli/instanceArgs.ts +0 -301
- package/src/cli/instanceControl.ts +0 -191
- package/src/cli/instanceModel.ts +0 -276
- package/src/cli/instanceRegistry.ts +0 -731
- package/src/cli/networkHints.ts +0 -170
- package/src/cli/onboard.ts +0 -1668
- package/src/cli/onboardTarget.ts +0 -228
- package/src/cli/rustBackendPackage.ts +0 -458
- package/src/cli/startupOutput.ts +0 -16
- package/src/cli/templates/codex-skill-onboard.ts +0 -320
- package/src/cli/templates/command-onboard.ts +0 -25
- package/src/cli/templates/skill-onboard.ts +0 -625
- package/src/cli.ts +0 -1433
- package/src/components/OnboardingBanner.tsx +0 -115
- package/src/components/ProxyViewer.tsx +0 -2259
- package/src/components/ProxyViewerContainer.tsx +0 -1076
- package/src/components/alerts/AlertsDialog.tsx +0 -615
- package/src/components/clients/ClientLogo.tsx +0 -175
- package/src/components/ecosystem/AgentLabDialog.tsx +0 -947
- package/src/components/errors/SafeErrorBoundary.tsx +0 -201
- package/src/components/groups/GroupsDialog.tsx +0 -1304
- package/src/components/inspector-pet/InspectorPet.tsx +0 -398
- package/src/components/inspector-pet/InspectorPetCrab3D.tsx +0 -455
- package/src/components/inspector-pet/inspectorPetLogic.ts +0 -272
- package/src/components/pi-agent/PiAgentPanel.tsx +0 -446
- package/src/components/pi-agent/piAgentChatLogic.ts +0 -273
- package/src/components/providers/ImportWizardDialog.tsx +0 -281
- package/src/components/providers/ProviderCard.tsx +0 -347
- package/src/components/providers/ProviderForm.tsx +0 -1183
- package/src/components/providers/ProviderLogo.tsx +0 -122
- package/src/components/providers/ProviderTestResultsView.tsx +0 -734
- package/src/components/providers/ProvidersPanel.tsx +0 -714
- package/src/components/providers/SettingsDialog.tsx +0 -1042
- package/src/components/providers/providerFormCapabilities.ts +0 -36
- package/src/components/proxy-viewer/AgentTraceSummary.tsx +0 -902
- package/src/components/proxy-viewer/AnswerMarkdown.tsx +0 -51
- package/src/components/proxy-viewer/ApplicationBar.tsx +0 -123
- package/src/components/proxy-viewer/CompareDrawer.tsx +0 -984
- package/src/components/proxy-viewer/ConversationGroup.tsx +0 -208
- package/src/components/proxy-viewer/ConversationGroupList.tsx +0 -652
- package/src/components/proxy-viewer/ConversationHeader.tsx +0 -429
- package/src/components/proxy-viewer/LiveConnectionStatus.tsx +0 -186
- package/src/components/proxy-viewer/LogEntry.tsx +0 -1419
- package/src/components/proxy-viewer/LogEntryHeader.tsx +0 -596
- package/src/components/proxy-viewer/ProviderLogoStack.tsx +0 -57
- package/src/components/proxy-viewer/RawExportWarning.tsx +0 -77
- package/src/components/proxy-viewer/ReplayDialog.tsx +0 -636
- package/src/components/proxy-viewer/RequestToolsPanel.tsx +0 -299
- package/src/components/proxy-viewer/ResponseView.tsx +0 -202
- package/src/components/proxy-viewer/SessionLoadProgressBar.tsx +0 -61
- package/src/components/proxy-viewer/StreamingChunkSequence.tsx +0 -265
- package/src/components/proxy-viewer/ThreadConnector.tsx +0 -165
- package/src/components/proxy-viewer/ToolTraceEvents.tsx +0 -64
- package/src/components/proxy-viewer/TurnGroup.tsx +0 -383
- package/src/components/proxy-viewer/TurnGroupList.tsx +0 -156
- package/src/components/proxy-viewer/accessibility.ts +0 -8
- package/src/components/proxy-viewer/anatomy/RequestAnatomy.tsx +0 -887
- package/src/components/proxy-viewer/anatomy/SegmentBar.tsx +0 -222
- package/src/components/proxy-viewer/anatomy/contextIntelligence.ts +0 -737
- package/src/components/proxy-viewer/anatomy/sessionContextSummary.ts +0 -268
- package/src/components/proxy-viewer/anatomy/tokenEstimate.ts +0 -53
- package/src/components/proxy-viewer/anatomy/types.ts +0 -41
- package/src/components/proxy-viewer/anatomy/useAnatomyJump.ts +0 -114
- package/src/components/proxy-viewer/bodyHydration.ts +0 -123
- package/src/components/proxy-viewer/cacheTrend.ts +0 -50
- package/src/components/proxy-viewer/diff/DiffView.tsx +0 -321
- package/src/components/proxy-viewer/diff/computeDiff.ts +0 -178
- package/src/components/proxy-viewer/diff/index.ts +0 -3
- package/src/components/proxy-viewer/formats/anthropic/ContentBlocks.tsx +0 -194
- package/src/components/proxy-viewer/formats/anthropic/ResponseView.tsx +0 -81
- package/src/components/proxy-viewer/formats/anthropic/thinkingExtract.ts +0 -21
- package/src/components/proxy-viewer/formats/index.tsx +0 -47
- package/src/components/proxy-viewer/formats/openai/ResponseView.tsx +0 -442
- package/src/components/proxy-viewer/index.ts +0 -9
- package/src/components/proxy-viewer/lazy.ts +0 -41
- package/src/components/proxy-viewer/liveConnectionState.ts +0 -158
- package/src/components/proxy-viewer/log-formats/anthropic.ts +0 -191
- package/src/components/proxy-viewer/log-formats/index.ts +0 -23
- package/src/components/proxy-viewer/log-formats/openai.ts +0 -256
- package/src/components/proxy-viewer/log-formats/types.ts +0 -40
- package/src/components/proxy-viewer/log-formats/unknown.ts +0 -18
- package/src/components/proxy-viewer/logEntryVisibility.ts +0 -73
- package/src/components/proxy-viewer/logFocus.ts +0 -54
- package/src/components/proxy-viewer/proxyViewerContainerLogic.ts +0 -124
- package/src/components/proxy-viewer/proxyViewerLogic.ts +0 -488
- package/src/components/proxy-viewer/replayComparison.ts +0 -131
- package/src/components/proxy-viewer/requestDiff.ts +0 -277
- package/src/components/proxy-viewer/requestTools.ts +0 -220
- package/src/components/proxy-viewer/useCopyFeedback.ts +0 -38
- package/src/components/proxy-viewer/useKeyboardNavigation.ts +0 -232
- package/src/components/proxy-viewer/viewerState.ts +0 -176
- package/src/components/ui/badge.tsx +0 -47
- package/src/components/ui/button.tsx +0 -47
- package/src/components/ui/collapsible.tsx +0 -21
- package/src/components/ui/confirm-dialog.tsx +0 -51
- package/src/components/ui/crab-logo.tsx +0 -45
- package/src/components/ui/crab-variants.tsx +0 -467
- package/src/components/ui/dialog.tsx +0 -130
- package/src/components/ui/icon-trigger.ts +0 -2
- package/src/components/ui/json-viewer-bulk.ts +0 -132
- package/src/components/ui/json-viewer.tsx +0 -508
- package/src/components/ui/scroll-area.tsx +0 -54
- package/src/components/ui/select.tsx +0 -178
- package/src/components/ui/separator.tsx +0 -28
- package/src/components/ui/tabs.tsx +0 -88
- package/src/components/ui/tooltip.tsx +0 -51
- package/src/components/ui/transient-toast.tsx +0 -105
- package/src/contracts/anthropic.ts +0 -230
- package/src/contracts/index.ts +0 -59
- package/src/contracts/json.ts +0 -37
- package/src/contracts/log.ts +0 -139
- package/src/contracts/openai.ts +0 -267
- package/src/index.css +0 -11
- package/src/knowledge/candidateStore.ts +0 -94
- package/src/knowledge/distiller.ts +0 -98
- package/src/knowledge/openclawClient.ts +0 -161
- package/src/knowledge/openclawGatewayClient.ts +0 -249
- package/src/knowledge/openclawMarkdown.ts +0 -146
- package/src/knowledge/redactor.ts +0 -80
- package/src/knowledge/types.ts +0 -83
- package/src/lib/alertContract.ts +0 -76
- package/src/lib/apiClient.ts +0 -166
- package/src/lib/apiFormat.ts +0 -29
- package/src/lib/backendImplementation.ts +0 -16
- package/src/lib/basePath.ts +0 -107
- package/src/lib/browserRuntimeContract.ts +0 -124
- package/src/lib/browserRuntimeResolver.ts +0 -333
- package/src/lib/chunkLoadRecovery.ts +0 -83
- package/src/lib/claudeCodeStrip.ts +0 -98
- package/src/lib/clipboard.ts +0 -67
- package/src/lib/codingAgentEndpoints.ts +0 -54
- package/src/lib/ecosystemContract.ts +0 -130
- package/src/lib/export-logs.ts +0 -287
- package/src/lib/groupContract.ts +0 -166
- package/src/lib/instanceContract.ts +0 -239
- package/src/lib/jsonFile.ts +0 -46
- package/src/lib/logImportContract.ts +0 -12
- package/src/lib/managedInstance.ts +0 -112
- package/src/lib/mask.ts +0 -4
- package/src/lib/objectUtils.ts +0 -22
- package/src/lib/piAgentContract.ts +0 -102
- package/src/lib/providerContract.ts +0 -125
- package/src/lib/providerImportContract.ts +0 -27
- package/src/lib/providerModelMetadata.ts +0 -458
- package/src/lib/providerTestContract.ts +0 -170
- package/src/lib/providerTestPrompt.ts +0 -100
- package/src/lib/publicBasePathContext.ts +0 -137
- package/src/lib/resourceLimits.ts +0 -345
- package/src/lib/runContract.ts +0 -164
- package/src/lib/runtimeConfig.ts +0 -43
- package/src/lib/safeDiagnostic.ts +0 -38
- package/src/lib/safeFetch.ts +0 -508
- package/src/lib/serverPort.ts +0 -47
- package/src/lib/sessionInfoContract.ts +0 -78
- package/src/lib/sessionUrl.ts +0 -46
- package/src/lib/ssrfGuard.ts +0 -133
- package/src/lib/stopReason.ts +0 -130
- package/src/lib/themeMode.ts +0 -41
- package/src/lib/timeDisplay.ts +0 -22
- package/src/lib/toolTrace.ts +0 -290
- package/src/lib/uiScale.ts +0 -117
- package/src/lib/unknown.ts +0 -27
- package/src/lib/upstreamUrl.ts +0 -150
- package/src/lib/useAlerts.ts +0 -82
- package/src/lib/useGroupEvidence.ts +0 -37
- package/src/lib/useGroups.ts +0 -32
- package/src/lib/useOnboarding.ts +0 -93
- package/src/lib/useProviders.ts +0 -30
- package/src/lib/useStripConfig.ts +0 -154
- package/src/lib/useThemeMode.ts +0 -40
- package/src/lib/useUiScale.ts +0 -52
- package/src/lib/utils.ts +0 -78
- package/src/mcp/currentContext.ts +0 -65
- package/src/mcp/instanceHandlers.ts +0 -151
- package/src/mcp/loopback.ts +0 -88
- package/src/mcp/mode.ts +0 -75
- package/src/mcp/previewExtractor.ts +0 -233
- package/src/mcp/server.ts +0 -2274
- package/src/mcp/toolHandlers.ts +0 -1533
- package/src/proxy/alerts.ts +0 -664
- package/src/proxy/chunkStorage.ts +0 -123
- package/src/proxy/config.ts +0 -218
- package/src/proxy/constants.ts +0 -66
- package/src/proxy/dataDir.ts +0 -147
- package/src/proxy/ecosystemExecutionConfirmation.ts +0 -114
- package/src/proxy/ecosystemExecutionRoute.ts +0 -116
- package/src/proxy/ecosystemRegistry.ts +0 -296
- package/src/proxy/ecosystemTasks.ts +0 -415
- package/src/proxy/evidenceAnalysis.ts +0 -526
- package/src/proxy/evidenceExporter.ts +0 -235
- package/src/proxy/formats/anthropic/anthropicProvider.ts +0 -75
- package/src/proxy/formats/anthropic/handler.ts +0 -75
- package/src/proxy/formats/anthropic/index.ts +0 -13
- package/src/proxy/formats/anthropic/register.ts +0 -4
- package/src/proxy/formats/anthropic/schemas.ts +0 -6
- package/src/proxy/formats/anthropic/stream.ts +0 -205
- package/src/proxy/formats/handler.ts +0 -46
- package/src/proxy/formats/index.ts +0 -13
- package/src/proxy/formats/jsonSchema.ts +0 -2
- package/src/proxy/formats/openai/alibabaProvider.ts +0 -34
- package/src/proxy/formats/openai/codexMetadata.ts +0 -61
- package/src/proxy/formats/openai/handler.ts +0 -133
- package/src/proxy/formats/openai/index.ts +0 -33
- package/src/proxy/formats/openai/provider.ts +0 -50
- package/src/proxy/formats/openai/register.ts +0 -4
- package/src/proxy/formats/openai/schemas.ts +0 -25
- package/src/proxy/formats/openai/stream.ts +0 -600
- package/src/proxy/formats/openai/zhipuProvider.ts +0 -31
- package/src/proxy/formats/providerAdapter.ts +0 -50
- package/src/proxy/formats/providerRegistry.ts +0 -51
- package/src/proxy/formats/providers/index.ts +0 -3
- package/src/proxy/formats/registry.ts +0 -65
- package/src/proxy/groupEvidenceExporter.ts +0 -371
- package/src/proxy/groupStore.ts +0 -336
- package/src/proxy/handler.ts +0 -729
- package/src/proxy/identityProxy.ts +0 -1842
- package/src/proxy/jsonlRecovery.ts +0 -554
- package/src/proxy/logBodyChunks.ts +0 -91
- package/src/proxy/logFinalizer.ts +0 -777
- package/src/proxy/logFinalizer.worker.ts +0 -24
- package/src/proxy/logImportUpload.ts +0 -128
- package/src/proxy/logImporter.ts +0 -813
- package/src/proxy/logIndex.ts +0 -663
- package/src/proxy/logSearch.ts +0 -122
- package/src/proxy/logger.ts +0 -537
- package/src/proxy/openaiOrphanToolStrip.ts +0 -142
- package/src/proxy/platformCommands.ts +0 -258
- package/src/proxy/privateDataPath.ts +0 -419
- package/src/proxy/providerImporters.ts +0 -578
- package/src/proxy/providerScanStore.ts +0 -87
- package/src/proxy/providerSecretStore.ts +0 -216
- package/src/proxy/providers.ts +0 -998
- package/src/proxy/rawStreamCapture.ts +0 -342
- package/src/proxy/runFailures.ts +0 -94
- package/src/proxy/runStore.ts +0 -214
- package/src/proxy/runtimeAdmission.ts +0 -55
- package/src/proxy/runtimeHealth.ts +0 -221
- package/src/proxy/runtimeMetrics.ts +0 -149
- package/src/proxy/runtimeShutdown.ts +0 -157
- package/src/proxy/schemas.ts +0 -112
- package/src/proxy/sessionArchive.ts +0 -479
- package/src/proxy/sessionInfo.ts +0 -266
- package/src/proxy/sessionProcess.ts +0 -194
- package/src/proxy/sessionRuntime.ts +0 -121
- package/src/proxy/sessionSupervisor.ts +0 -305
- package/src/proxy/sessionWorkerEntry.ts +0 -26
- package/src/proxy/shutdownCoordinator.ts +0 -90
- package/src/proxy/socketTracker.ts +0 -639
- package/src/proxy/sqliteLogIndex.ts +0 -733
- package/src/proxy/storageLifecycle.ts +0 -432
- package/src/proxy/store.ts +0 -1773
- package/src/proxy/streamTiming.ts +0 -31
- package/src/proxy/toolSchemaWarnings.ts +0 -529
- package/src/proxy/uiAssetServer.ts +0 -106
- package/src/proxy/upstream.ts +0 -127
- package/src/services/alerts.ts +0 -12
- package/src/services/groups.ts +0 -119
- package/src/services/piAgent.ts +0 -421
- package/src/services/piAgentRetrieval.ts +0 -1180
- package/src/services/result.ts +0 -17
- package/src/services/runs.ts +0 -76
- package/src/ui/bootstrap.ts +0 -167
- package/src/ui/index.html +0 -38
- package/src/ui/logsStreamClient.ts +0 -20
- package/src/ui/main.tsx +0 -13
- package/src/ui/public/runtime-config.js +0 -2
- package/src/ui/router.tsx +0 -13
- package/src/ui/routes/__root.tsx +0 -69
- package/src/ui/routes/index.tsx +0 -35
- package/src/ui/routes/session/$sessionId.tsx +0 -50
- package/src/ui/runtimeDiscovery.ts +0 -50
|
@@ -1,455 +0,0 @@
|
|
|
1
|
-
import { type JSX, useEffect, useRef, useState } from "react";
|
|
2
|
-
import {
|
|
3
|
-
ACESFilmicToneMapping,
|
|
4
|
-
AmbientLight,
|
|
5
|
-
type BufferGeometry,
|
|
6
|
-
CircleGeometry,
|
|
7
|
-
Color,
|
|
8
|
-
CylinderGeometry,
|
|
9
|
-
DirectionalLight,
|
|
10
|
-
Group,
|
|
11
|
-
HemisphereLight,
|
|
12
|
-
type Material,
|
|
13
|
-
Mesh,
|
|
14
|
-
MeshBasicMaterial,
|
|
15
|
-
MeshPhysicalMaterial,
|
|
16
|
-
type Object3D,
|
|
17
|
-
OrthographicCamera,
|
|
18
|
-
PointLight,
|
|
19
|
-
Scene,
|
|
20
|
-
SphereGeometry,
|
|
21
|
-
SRGBColorSpace,
|
|
22
|
-
Vector3,
|
|
23
|
-
WebGLRenderer,
|
|
24
|
-
} from "three";
|
|
25
|
-
import { CrabLogo } from "../ui/crab-logo";
|
|
26
|
-
import type { InspectorPetMood } from "./inspectorPetLogic";
|
|
27
|
-
|
|
28
|
-
type InspectorPetCrab3DProps = {
|
|
29
|
-
mood: InspectorPetMood;
|
|
30
|
-
moving: boolean;
|
|
31
|
-
reduceMotion: boolean;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
type AnimatedLeg = {
|
|
35
|
-
group: Group;
|
|
36
|
-
phase: number;
|
|
37
|
-
side: number;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
type AnimatedEye = {
|
|
41
|
-
group: Group;
|
|
42
|
-
phase: number;
|
|
43
|
-
pupil: Mesh;
|
|
44
|
-
pupilRest: Vector3;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
type AnimatedPincer = {
|
|
48
|
-
direction: number;
|
|
49
|
-
mesh: Mesh;
|
|
50
|
-
restRotationZ: number;
|
|
51
|
-
restY: number;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
type AnimatedClaw = {
|
|
55
|
-
group: Group;
|
|
56
|
-
pincers: AnimatedPincer[];
|
|
57
|
-
scale: number;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
type CrabSceneParts = {
|
|
61
|
-
bodyMaterial: MeshPhysicalMaterial;
|
|
62
|
-
dominantClaw: AnimatedClaw;
|
|
63
|
-
eyes: AnimatedEye[];
|
|
64
|
-
legs: AnimatedLeg[];
|
|
65
|
-
rimLight: PointLight;
|
|
66
|
-
root: Group;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
function createRod(
|
|
70
|
-
start: Vector3,
|
|
71
|
-
end: Vector3,
|
|
72
|
-
radius: number,
|
|
73
|
-
material: MeshPhysicalMaterial,
|
|
74
|
-
): Mesh {
|
|
75
|
-
const direction = end.clone().sub(start);
|
|
76
|
-
const length = direction.length();
|
|
77
|
-
const rod = new Mesh(new CylinderGeometry(radius, radius * 0.9, length, 12), material);
|
|
78
|
-
rod.position.copy(start.clone().add(end).multiplyScalar(0.5));
|
|
79
|
-
rod.quaternion.setFromUnitVectors(new Vector3(0, 1, 0), direction.normalize());
|
|
80
|
-
return rod;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function addClaw(
|
|
84
|
-
root: Group,
|
|
85
|
-
side: number,
|
|
86
|
-
shellMaterial: MeshPhysicalMaterial,
|
|
87
|
-
accentMaterial: MeshPhysicalMaterial,
|
|
88
|
-
): AnimatedClaw {
|
|
89
|
-
const clawScale = side < 0 ? 1.5 : 0.68;
|
|
90
|
-
const clawGroup = new Group();
|
|
91
|
-
const pincers: AnimatedPincer[] = [];
|
|
92
|
-
root.add(clawGroup);
|
|
93
|
-
|
|
94
|
-
const shoulder = new Vector3(side * 1.2, 0.25, -0.05);
|
|
95
|
-
const wrist = new Vector3(side * (1.65 + clawScale * 0.18), 0.5, 0);
|
|
96
|
-
const arm = createRod(shoulder, wrist, 0.16 * clawScale, accentMaterial);
|
|
97
|
-
clawGroup.add(arm);
|
|
98
|
-
|
|
99
|
-
const palm = new Mesh(new SphereGeometry(0.55, 24, 16), shellMaterial);
|
|
100
|
-
palm.position.set(side * (1.95 + clawScale * 0.16), 0.62, 0.05);
|
|
101
|
-
palm.scale.set(1.05 * clawScale, 0.72 * clawScale, 0.55 * clawScale);
|
|
102
|
-
clawGroup.add(palm);
|
|
103
|
-
|
|
104
|
-
for (const pincerDirection of [-1, 1]) {
|
|
105
|
-
const pincer = new Mesh(new SphereGeometry(0.36, 20, 14), accentMaterial);
|
|
106
|
-
pincer.position.set(
|
|
107
|
-
side * (2.22 + clawScale * 0.26),
|
|
108
|
-
0.62 + pincerDirection * 0.24 * clawScale,
|
|
109
|
-
0.08,
|
|
110
|
-
);
|
|
111
|
-
pincer.scale.set(1.05 * clawScale, 0.34 * clawScale, 0.42 * clawScale);
|
|
112
|
-
pincer.rotation.z = pincerDirection * side * 0.42;
|
|
113
|
-
clawGroup.add(pincer);
|
|
114
|
-
pincers.push({
|
|
115
|
-
direction: pincerDirection,
|
|
116
|
-
mesh: pincer,
|
|
117
|
-
restRotationZ: pincer.rotation.z,
|
|
118
|
-
restY: pincer.position.y,
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return { group: clawGroup, pincers, scale: clawScale };
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function pinchPulse(cycleTime: number, start: number, duration: number): number {
|
|
126
|
-
const progress = (cycleTime - start) / duration;
|
|
127
|
-
if (progress <= 0 || progress >= 1) return 0;
|
|
128
|
-
return Math.sin(progress * Math.PI);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function dominantClawGrip(elapsed: number): number {
|
|
132
|
-
const cycleTime = elapsed % 6.8;
|
|
133
|
-
return Math.max(pinchPulse(cycleTime, 0.72, 0.82), pinchPulse(cycleTime, 1.72, 0.68));
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function addEyes(
|
|
137
|
-
root: Group,
|
|
138
|
-
shellMaterial: MeshPhysicalMaterial,
|
|
139
|
-
eyeMaterial: MeshPhysicalMaterial,
|
|
140
|
-
): AnimatedEye[] {
|
|
141
|
-
const eyes: AnimatedEye[] = [];
|
|
142
|
-
for (const side of [-1, 1]) {
|
|
143
|
-
const stalkStart = new Vector3(side * 0.48, 0.68, 0.05);
|
|
144
|
-
const stalkEnd = new Vector3(side * 0.1, 0.82, 0.07);
|
|
145
|
-
const eyeGroup = new Group();
|
|
146
|
-
eyeGroup.position.copy(stalkStart);
|
|
147
|
-
eyeGroup.add(createRod(new Vector3(0, 0, 0), stalkEnd, 0.1, shellMaterial));
|
|
148
|
-
|
|
149
|
-
const eye = new Mesh(new SphereGeometry(0.24, 20, 16), eyeMaterial);
|
|
150
|
-
eye.position.copy(stalkEnd);
|
|
151
|
-
eye.scale.set(1, 1, 0.85);
|
|
152
|
-
eyeGroup.add(eye);
|
|
153
|
-
|
|
154
|
-
const pupil = new Mesh(
|
|
155
|
-
new SphereGeometry(0.105, 16, 12),
|
|
156
|
-
new MeshPhysicalMaterial({ color: 0x111827, roughness: 0.25 }),
|
|
157
|
-
);
|
|
158
|
-
const pupilRest = new Vector3(stalkEnd.x, stalkEnd.y, stalkEnd.z + 0.2);
|
|
159
|
-
pupil.position.copy(pupilRest);
|
|
160
|
-
eyeGroup.add(pupil);
|
|
161
|
-
root.add(eyeGroup);
|
|
162
|
-
eyes.push({
|
|
163
|
-
group: eyeGroup,
|
|
164
|
-
phase: side < 0 ? 0 : Math.PI / 3,
|
|
165
|
-
pupil,
|
|
166
|
-
pupilRest,
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
return eyes;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function addLegs(root: Group, legMaterial: MeshPhysicalMaterial): AnimatedLeg[] {
|
|
173
|
-
const legs: AnimatedLeg[] = [];
|
|
174
|
-
for (const side of [-1, 1]) {
|
|
175
|
-
for (let index = 0; index < 4; index += 1) {
|
|
176
|
-
const leg = new Group();
|
|
177
|
-
const baseY = -0.3 - index * 0.22;
|
|
178
|
-
leg.position.set(side * (0.8 + index * 0.12), baseY, -0.18);
|
|
179
|
-
leg.add(
|
|
180
|
-
createRod(
|
|
181
|
-
new Vector3(0, 0, 0),
|
|
182
|
-
new Vector3(side * (0.62 + index * 0.06), -0.34, 0),
|
|
183
|
-
0.095,
|
|
184
|
-
legMaterial,
|
|
185
|
-
),
|
|
186
|
-
);
|
|
187
|
-
leg.add(
|
|
188
|
-
createRod(
|
|
189
|
-
new Vector3(side * (0.58 + index * 0.06), -0.31, 0),
|
|
190
|
-
new Vector3(side * (1.02 + index * 0.08), -0.88 + index * 0.07, 0.04),
|
|
191
|
-
0.075,
|
|
192
|
-
legMaterial,
|
|
193
|
-
),
|
|
194
|
-
);
|
|
195
|
-
root.add(leg);
|
|
196
|
-
legs.push({ group: leg, phase: index * Math.PI + (side > 0 ? Math.PI / 2 : 0), side });
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
return legs;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
function createCrabScene(scene: Scene): CrabSceneParts {
|
|
203
|
-
const shellMaterial = new MeshPhysicalMaterial({
|
|
204
|
-
color: 0xf59e0b,
|
|
205
|
-
roughness: 0.34,
|
|
206
|
-
metalness: 0.04,
|
|
207
|
-
clearcoat: 0.78,
|
|
208
|
-
clearcoatRoughness: 0.18,
|
|
209
|
-
emissive: new Color(0x000000),
|
|
210
|
-
emissiveIntensity: 0,
|
|
211
|
-
});
|
|
212
|
-
const accentMaterial = new MeshPhysicalMaterial({
|
|
213
|
-
color: 0xfb923c,
|
|
214
|
-
roughness: 0.42,
|
|
215
|
-
metalness: 0.02,
|
|
216
|
-
clearcoat: 0.52,
|
|
217
|
-
clearcoatRoughness: 0.28,
|
|
218
|
-
});
|
|
219
|
-
const legMaterial = new MeshPhysicalMaterial({
|
|
220
|
-
color: 0xd97706,
|
|
221
|
-
roughness: 0.48,
|
|
222
|
-
clearcoat: 0.35,
|
|
223
|
-
clearcoatRoughness: 0.35,
|
|
224
|
-
});
|
|
225
|
-
const eyeMaterial = new MeshPhysicalMaterial({
|
|
226
|
-
color: 0xfffbeb,
|
|
227
|
-
roughness: 0.22,
|
|
228
|
-
clearcoat: 0.8,
|
|
229
|
-
clearcoatRoughness: 0.12,
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
const root = new Group();
|
|
233
|
-
root.rotation.x = -0.12;
|
|
234
|
-
root.rotation.y = -0.08;
|
|
235
|
-
root.scale.setScalar(1.08);
|
|
236
|
-
scene.add(root);
|
|
237
|
-
|
|
238
|
-
const shadow = new Mesh(
|
|
239
|
-
new CircleGeometry(1.65, 40),
|
|
240
|
-
new MeshBasicMaterial({ color: 0x111827, transparent: true, opacity: 0.16, depthWrite: false }),
|
|
241
|
-
);
|
|
242
|
-
shadow.position.set(0, -1.33, -0.65);
|
|
243
|
-
shadow.scale.set(1.4, 0.34, 1);
|
|
244
|
-
root.add(shadow);
|
|
245
|
-
|
|
246
|
-
const body = new Mesh(new SphereGeometry(1, 36, 24), shellMaterial);
|
|
247
|
-
body.position.set(0, 0.02, 0);
|
|
248
|
-
body.scale.set(1.58, 0.92, 0.68);
|
|
249
|
-
root.add(body);
|
|
250
|
-
|
|
251
|
-
const lowerShell = new Mesh(new SphereGeometry(0.92, 28, 20), accentMaterial);
|
|
252
|
-
lowerShell.position.set(0, -0.48, 0.22);
|
|
253
|
-
lowerShell.scale.set(1.28, 0.42, 0.56);
|
|
254
|
-
root.add(lowerShell);
|
|
255
|
-
|
|
256
|
-
const dominantClaw = addClaw(root, -1, shellMaterial, accentMaterial);
|
|
257
|
-
addClaw(root, 1, shellMaterial, accentMaterial);
|
|
258
|
-
const eyes = addEyes(root, shellMaterial, eyeMaterial);
|
|
259
|
-
const legs = addLegs(root, legMaterial);
|
|
260
|
-
|
|
261
|
-
scene.add(new AmbientLight(0xfff7ed, 1.65));
|
|
262
|
-
scene.add(new HemisphereLight(0xfff7ed, 0x172033, 2.15));
|
|
263
|
-
const keyLight = new DirectionalLight(0xffffff, 3.6);
|
|
264
|
-
keyLight.position.set(3.5, 4.5, 6);
|
|
265
|
-
scene.add(keyLight);
|
|
266
|
-
const fillLight = new DirectionalLight(0xfbbf24, 1.35);
|
|
267
|
-
fillLight.position.set(-4, 1.5, 4);
|
|
268
|
-
scene.add(fillLight);
|
|
269
|
-
const rimLight = new PointLight(0xf59e0b, 1.8, 12, 2);
|
|
270
|
-
rimLight.position.set(0, 1.8, 4.5);
|
|
271
|
-
scene.add(rimLight);
|
|
272
|
-
|
|
273
|
-
return { bodyMaterial: shellMaterial, dominantClaw, eyes, legs, rimLight, root };
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
function moodColor(mood: InspectorPetMood): number {
|
|
277
|
-
switch (mood) {
|
|
278
|
-
case "active":
|
|
279
|
-
return 0x22d3ee;
|
|
280
|
-
case "attention":
|
|
281
|
-
return 0xef4444;
|
|
282
|
-
case "idle":
|
|
283
|
-
return 0xf59e0b;
|
|
284
|
-
case "sleeping":
|
|
285
|
-
return 0x94a3b8;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
function isDisposableMesh(object: Object3D): object is Mesh<BufferGeometry, Material | Material[]> {
|
|
290
|
-
return object instanceof Mesh;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
function disposeScene(scene: Scene): void {
|
|
294
|
-
const materials = new Set<Material>();
|
|
295
|
-
scene.traverse((object: Object3D) => {
|
|
296
|
-
if (!isDisposableMesh(object)) return;
|
|
297
|
-
object.geometry.dispose();
|
|
298
|
-
const material = object.material;
|
|
299
|
-
if (Array.isArray(material)) {
|
|
300
|
-
for (const item of material) materials.add(item);
|
|
301
|
-
return;
|
|
302
|
-
}
|
|
303
|
-
materials.add(material);
|
|
304
|
-
});
|
|
305
|
-
for (const material of materials) material.dispose();
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
export function InspectorPetCrab3D({
|
|
309
|
-
mood,
|
|
310
|
-
moving,
|
|
311
|
-
reduceMotion,
|
|
312
|
-
}: InspectorPetCrab3DProps): JSX.Element {
|
|
313
|
-
const canvasRef = useRef<HTMLCanvasElement | null>(null);
|
|
314
|
-
const moodRef = useRef(mood);
|
|
315
|
-
const movingRef = useRef(moving);
|
|
316
|
-
const reduceMotionRef = useRef(reduceMotion);
|
|
317
|
-
const [renderFailed, setRenderFailed] = useState(false);
|
|
318
|
-
|
|
319
|
-
useEffect(() => {
|
|
320
|
-
moodRef.current = mood;
|
|
321
|
-
}, [mood]);
|
|
322
|
-
|
|
323
|
-
useEffect(() => {
|
|
324
|
-
movingRef.current = moving;
|
|
325
|
-
}, [moving]);
|
|
326
|
-
|
|
327
|
-
useEffect(() => {
|
|
328
|
-
reduceMotionRef.current = reduceMotion;
|
|
329
|
-
}, [reduceMotion]);
|
|
330
|
-
|
|
331
|
-
useEffect(() => {
|
|
332
|
-
const canvas = canvasRef.current;
|
|
333
|
-
if (canvas === null) return undefined;
|
|
334
|
-
|
|
335
|
-
let renderer: WebGLRenderer;
|
|
336
|
-
try {
|
|
337
|
-
renderer = new WebGLRenderer({
|
|
338
|
-
alpha: true,
|
|
339
|
-
antialias: true,
|
|
340
|
-
canvas,
|
|
341
|
-
powerPreference: "low-power",
|
|
342
|
-
preserveDrawingBuffer: true,
|
|
343
|
-
});
|
|
344
|
-
} catch {
|
|
345
|
-
setRenderFailed(true);
|
|
346
|
-
return undefined;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
renderer.setClearColor(0x000000, 0);
|
|
350
|
-
renderer.outputColorSpace = SRGBColorSpace;
|
|
351
|
-
renderer.toneMapping = ACESFilmicToneMapping;
|
|
352
|
-
renderer.toneMappingExposure = 1.18;
|
|
353
|
-
|
|
354
|
-
const scene = new Scene();
|
|
355
|
-
const camera = new OrthographicCamera(-3.65, 3.65, 3.65, -3.65, 0.1, 20);
|
|
356
|
-
camera.position.set(0, 0.05, 8);
|
|
357
|
-
camera.lookAt(0, 0, 0);
|
|
358
|
-
const parts = createCrabScene(scene);
|
|
359
|
-
const startedAt = window.performance.now();
|
|
360
|
-
let lastFrameAt = 0;
|
|
361
|
-
|
|
362
|
-
const renderFrame = (timestamp: number): void => {
|
|
363
|
-
if (timestamp - lastFrameAt < 32) return;
|
|
364
|
-
lastFrameAt = timestamp;
|
|
365
|
-
const elapsed = (timestamp - startedAt) / 1000;
|
|
366
|
-
const motionAllowed = !reduceMotionRef.current;
|
|
367
|
-
const gait = movingRef.current ? 1 : moodRef.current === "active" ? 0.42 : 0;
|
|
368
|
-
const idleMotion = motionAllowed ? Math.sin(elapsed * 0.85) : 0;
|
|
369
|
-
const stepMotion = motionAllowed ? Math.sin(elapsed * 3.4) : 0;
|
|
370
|
-
const clawGrip = motionAllowed ? dominantClawGrip(elapsed) : 0;
|
|
371
|
-
|
|
372
|
-
parts.root.position.y = idleMotion * 0.035 + Math.abs(stepMotion) * 0.055 * gait;
|
|
373
|
-
parts.root.rotation.y = -0.08 + idleMotion * 0.055;
|
|
374
|
-
parts.root.rotation.z = stepMotion * 0.028 * gait;
|
|
375
|
-
parts.dominantClaw.group.rotation.z = -clawGrip * 0.035;
|
|
376
|
-
for (const pincer of parts.dominantClaw.pincers) {
|
|
377
|
-
pincer.mesh.position.y =
|
|
378
|
-
pincer.restY - pincer.direction * parts.dominantClaw.scale * 0.16 * clawGrip;
|
|
379
|
-
pincer.mesh.rotation.z = pincer.restRotationZ * (1 - clawGrip * 0.72);
|
|
380
|
-
}
|
|
381
|
-
for (const leg of parts.legs) {
|
|
382
|
-
leg.group.rotation.z =
|
|
383
|
-
motionAllowed && gait > 0
|
|
384
|
-
? Math.sin(elapsed * 4.25 + leg.phase) * 0.2 * leg.side * gait
|
|
385
|
-
: 0;
|
|
386
|
-
leg.group.rotation.x = motionAllowed && gait > 0 ? stepMotion * 0.045 * gait : 0;
|
|
387
|
-
}
|
|
388
|
-
for (const eye of parts.eyes) {
|
|
389
|
-
const gaze = motionAllowed ? Math.sin(elapsed * 0.72 + eye.phase) : 0;
|
|
390
|
-
const lift = motionAllowed ? Math.cos(elapsed * 0.9 + eye.phase) : 0;
|
|
391
|
-
eye.group.rotation.z = gaze * 0.075;
|
|
392
|
-
eye.group.rotation.x = lift * 0.025;
|
|
393
|
-
eye.pupil.position.set(
|
|
394
|
-
eye.pupilRest.x + gaze * 0.055,
|
|
395
|
-
eye.pupilRest.y + lift * 0.025,
|
|
396
|
-
eye.pupilRest.z,
|
|
397
|
-
);
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
const color = moodColor(moodRef.current);
|
|
401
|
-
parts.rimLight.color.setHex(color);
|
|
402
|
-
parts.rimLight.intensity = moodRef.current === "attention" ? 3.2 : 1.8;
|
|
403
|
-
parts.bodyMaterial.emissive.setHex(color);
|
|
404
|
-
parts.bodyMaterial.emissiveIntensity = moodRef.current === "active" ? 0.12 : 0.035;
|
|
405
|
-
renderer.render(scene, camera);
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
const resize = (): void => {
|
|
409
|
-
const width = Math.max(canvas.clientWidth, 1);
|
|
410
|
-
const height = Math.max(canvas.clientHeight, 1);
|
|
411
|
-
renderer.setDrawingBufferSize(width, height, Math.min(window.devicePixelRatio, 2));
|
|
412
|
-
renderer.render(scene, camera);
|
|
413
|
-
};
|
|
414
|
-
const resizeObserver =
|
|
415
|
-
typeof ResizeObserver === "undefined" ? null : new ResizeObserver(resize);
|
|
416
|
-
if (resizeObserver === null) {
|
|
417
|
-
window.addEventListener("resize", resize);
|
|
418
|
-
} else {
|
|
419
|
-
resizeObserver.observe(canvas);
|
|
420
|
-
}
|
|
421
|
-
resize();
|
|
422
|
-
|
|
423
|
-
const handleContextLost = (event: Event): void => {
|
|
424
|
-
event.preventDefault();
|
|
425
|
-
setRenderFailed(true);
|
|
426
|
-
};
|
|
427
|
-
canvas.addEventListener("webglcontextlost", handleContextLost);
|
|
428
|
-
renderer.setAnimationLoop(renderFrame);
|
|
429
|
-
|
|
430
|
-
return () => {
|
|
431
|
-
renderer.setAnimationLoop(null);
|
|
432
|
-
if (resizeObserver === null) {
|
|
433
|
-
window.removeEventListener("resize", resize);
|
|
434
|
-
} else {
|
|
435
|
-
resizeObserver.disconnect();
|
|
436
|
-
}
|
|
437
|
-
canvas.removeEventListener("webglcontextlost", handleContextLost);
|
|
438
|
-
disposeScene(scene);
|
|
439
|
-
renderer.dispose();
|
|
440
|
-
};
|
|
441
|
-
}, []);
|
|
442
|
-
|
|
443
|
-
return (
|
|
444
|
-
<span className="relative flex size-24 items-center justify-center" aria-hidden="true">
|
|
445
|
-
<canvas
|
|
446
|
-
ref={canvasRef}
|
|
447
|
-
className={renderFailed ? "hidden" : "block size-full bg-transparent"}
|
|
448
|
-
data-inspector-pet-canvas="true"
|
|
449
|
-
/>
|
|
450
|
-
{renderFailed && (
|
|
451
|
-
<CrabLogo className="size-22 text-amber-500 drop-shadow-[0_0_18px_rgba(245,158,11,0.28)]" />
|
|
452
|
-
)}
|
|
453
|
-
</span>
|
|
454
|
-
);
|
|
455
|
-
}
|