@craft_eco/craft-mcp 0.1.18 → 0.1.21
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/README.md +45 -8
- package/bin/craft-mcp.mjs +14 -1
- package/dist-server/core/connector-auth.mjs +3 -3
- package/dist-server/game-workflow/asset-formats.mjs +25 -64
- package/dist-server/game-workflow/asset-import.mjs +83 -67
- package/dist-server/game-workflow/assets.mjs +81 -9
- package/dist-server/game-workflow/capture-worker.mjs +1 -1
- package/dist-server/game-workflow/check.mjs +1 -1
- package/dist-server/game-workflow/draft-archive.mjs +53 -53
- package/dist-server/game-workflow/draft-bindings.mjs +35 -35
- package/dist-server/game-workflow/draft-uploads.mjs +207 -207
- package/dist-server/game-workflow/engines.mjs +2 -2
- package/dist-server/game-workflow/library-assets.mjs +16 -5
- package/dist-server/game-workflow/library-candidates.mjs +2 -1
- package/dist-server/game-workflow/library-catalog.mjs +2 -2
- package/dist-server/game-workflow/publication-materials.mjs +67 -67
- package/dist-server/game-workflow/publications.mjs +148 -148
- package/dist-server/game-workflow/publish-capture-worker.mjs +57 -57
- package/dist-server/game-workflow/publish-capture.mjs +75 -75
- package/dist-server/game-workflow/resource-catalog.mjs +16 -13
- package/dist-server/mcp/control-panel.html +2 -2
- package/dist-server/mcp/control-panel.mjs +59 -59
- package/dist-server/mcp/publication-page.html +85 -86
- package/dist-server/mcp/publication-page.mjs +346 -347
- package/dist-server/mcp/publication-preview.mjs +62 -48
- package/dist-server/mcp/publication-tools.mjs +22 -22
- package/dist-server/mcp/publish-panel.mjs +191 -191
- package/dist-server/mcp/server.mjs +312 -312
- package/dist-server/upstream/craft-aigc.mjs +182 -169
- package/dist-server/upstream/library-url.mjs +3 -5
- package/dist-server/upstream/publication-transport.mjs +81 -81
- package/dist-server/upstream/resource-path.mjs +17 -0
- package/package.json +2 -2
- package/resources/craft-game-maker/SKILL.md +71 -69
- package/resources/craft-game-maker/js.md +6 -5
- package/resources/craft-game-maker/js3d.md +6 -5
- package/resources/game_visual_qa.mjs +9 -3
- package/resources/js/context/.role/AGENTS_DESIGN.md +9 -0
- package/resources/js/context/AGENTS.md +112 -0
- package/resources/js/context/agents/aigc-asset.md +168 -0
- package/resources/js/context/hooks/hooks.json +14 -20
- package/resources/js/context/knowledge/AigcEnabled.md +49 -41
- package/resources/js/context/knowledge/AigcWiring.md +200 -200
- package/resources/js/context/knowledge/AssetUrl.md +24 -24
- package/resources/js/context/knowledge/FrontendComponents.md +17 -23
- package/resources/js/context/knowledge/Lifecycle.md +32 -27
- package/resources/js/context/knowledge/MobileAdaptation.md +73 -0
- package/resources/js/context/knowledge/MobileAdapted.md +36 -0
- package/resources/js/context/knowledge/Multiplayer/GameplaySystemKnowledge.md +114 -114
- package/resources/js/context/knowledge/Multiplayer/OverviewKnowledge.md +115 -115
- package/resources/js/context/knowledge/Multiplayer/StateSyncKnowledge.md +392 -392
- package/resources/js/context/knowledge/PlatformServices.md +190 -184
- package/resources/js/context/knowledge/ProjectDisplayConfig.md +35 -0
- package/resources/js/context/knowledge/Subsystems/Optional/MultiplayerManagerKnowledge.md +242 -242
- package/resources/js/context/knowledge/Ui.md +11 -11
- package/resources/js/context/knowledge/UiEditorCompat.md +21 -21
- package/resources/js/context/rules/MultiplayerCapability.md +23 -23
- package/resources/js/context/rules/MultiplayerRoomEntryUX.md +63 -63
- package/resources/js/context/rules/PlatformBoundaryModules.md +44 -43
- package/resources/js/context/rules/preview_ready.md +8 -0
- package/resources/js/context/skills/aigc-generate/SKILL.md +149 -301
- package/resources/js/context/skills/aigc-generate/knowledge/audio.md +39 -39
- package/resources/js/context/skills/aigc-generate/knowledge/batch-replace.md +26 -14
- package/resources/js/context/skills/aigc-generate/knowledge/character2d.md +132 -129
- package/resources/js/context/skills/aigc-generate/knowledge/non-stepwise-aigc.md +53 -54
- package/resources/js/context/skills/aigc-generate/knowledge/texture-prop.md +52 -50
- package/resources/js/context/skills/aigc-generate/knowledge/texture-scene.md +191 -201
- package/resources/js/context/skills/aigc-generate/knowledge/texture-ui.md +55 -53
- package/resources/js/context/skills/asset-search/SKILL.md +69 -73
- package/resources/js/context/skills/asset-search/scripts/asset_display.mjs +62 -62
- package/resources/js/context/skills/asset-search/scripts/config.json +5 -5
- package/resources/js/context/skills/asset-search/scripts/provided_assets.mjs +125 -125
- package/resources/js/context/skills/asset-search/scripts/search.mjs +760 -749
- package/resources/js/context/skills/asset-search/scripts/sprite_source_materializer.mjs +657 -723
- package/resources/js/context/skills/asset-search/strategies/anim2d.md +42 -0
- package/resources/js/context/skills/asset-search/strategies/audio.md +34 -34
- package/resources/js/context/skills/asset-search/strategies/effect2d.md +31 -31
- package/resources/js/context/skills/asset-search/strategies/texture-prop.md +22 -22
- package/resources/js/context/skills/asset-search/strategies/ui-common.md +40 -40
- package/resources/js/context/skills/asset-search/strategies/ui-style.md +28 -28
- package/resources/js/context/skills/export-config/SKILL.md +28 -20
- package/resources/js/context/skills/export-config/assets/tooling/cli.mjs +20 -0
- package/resources/js/context/skills/{lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/platform → export-config/assets/tooling}/config.d.mts +19 -19
- package/resources/js/context/skills/{lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/platform → export-config/assets/tooling}/config.mjs +1 -1
- package/resources/js/context/skills/export-config/assets/tooling/project.d.mts +6 -0
- package/resources/js/context/skills/export-config/assets/tooling/project.mjs +77 -0
- package/resources/js/context/skills/export-config/assets/tooling/vite.d.mts +2 -0
- package/resources/js/context/skills/export-config/assets/tooling/vite.mjs +34 -0
- package/resources/js/context/skills/export-config/scripts/assert-asset-wiring.mjs +72 -72
- package/resources/js/context/skills/export-config/scripts/export-config.mjs +46 -43
- package/resources/js/context/skills/export-config/scripts/install.mjs +89 -0
- package/resources/js/context/skills/export-config/scripts/panel-resource-path.mjs +106 -106
- package/resources/js/context/skills/export-config/scripts/sync-asset-controls.mjs +352 -351
- package/resources/js/context/skills/export-config/scripts/translate-asset-titles.mjs +161 -163
- package/resources/js/context/skills/lightgame-runtime-adapt/SKILL.md +93 -92
- package/resources/js/context/skills/lightgame-runtime-adapt/project/game-runtime.json +7 -7
- package/resources/js/context/skills/lightgame-runtime-adapt/project/package.json +22 -22
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/identity/qq-ai-game-sdk.min.js +5 -0
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/identity/qq-session.mjs +208 -0
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/identity/shared.mjs +37 -0
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/{1.0.0 → 1.1.0}/platform/platform-capture-video.mjs +227 -227
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/{1.0.0 → 1.1.0}/platform/platform-service.d.mts +31 -25
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform-service.mjs +272 -0
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/{1.0.0 → 1.1.0}/platform/platform.d.mts +79 -79
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/{1.0.0 → 1.1.0}/platform/platform.mjs +29 -29
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/release.json +22 -0
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/cli.mjs +16 -0
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/project.d.mts +4 -0
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/project.mjs +50 -0
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/vite.d.mts +3 -0
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/vite.mjs +72 -0
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/{1.0.0 → 1.1.0}/tools/assets.d.mts +24 -24
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/{1.0.0 → 1.1.0}/tools/assets.mjs +2 -2
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/{1.0.0 → 1.1.0}/tools/astc.d.mts +10 -10
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/{1.0.0 → 1.1.0}/tools/astc.mjs +1 -1
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/config-export.mjs +37 -32
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/refresh-runtime.mjs +50 -50
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/cli.mjs +20 -0
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/config.d.mts +19 -0
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/config.mjs +1 -0
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/installed.json +6 -0
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/project.d.mts +6 -0
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/project.mjs +77 -0
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/vite.d.mts +2 -0
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/vite.mjs +34 -0
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/display/ui-stage.ts +156 -121
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/display/viewport.ts +249 -254
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/main.ts +87 -99
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/platform.ts +2 -14
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/screenUi.ts +185 -172
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/style.css +294 -165
- package/resources/js/context/skills/lightgame-runtime-adapt/project/tsconfig.json +20 -20
- package/resources/js/context/skills/lightgame-runtime-adapt/project/vite.config.ts +5 -4
- package/resources/js/context/skills/lightgame-runtime-adapt/scripts/install-template.mjs +159 -109
- package/resources/js/context/skills/mobile-adaptation/SKILL.md +277 -260
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-config.json +50 -50
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-layer.ts +862 -881
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-platform.ts +92 -92
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-primitives.ts +254 -0
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/look-pad.ts +245 -245
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/ui/touch-controls.css +135 -134
- package/resources/js/context/skills/mobile-adaptation/references/input-config.md +342 -311
- package/resources/js/context/skills/mobile-adaptation/references/verification.md +140 -106
- package/resources/js/context/skills/mobile-adaptation/references/web-audio.md +11 -0
- package/resources/js/context/skills/mobile-compat-qa/SKILL.md +53 -0
- package/resources/js/context/skills/mobile-compat-qa/references/startup-diagnosis.md +23 -0
- package/resources/js/context/skills/mobile-compat-qa/references/web-lifecycle.md +20 -0
- package/resources/js/context/skills/mobile-compat-qa/references/web-performance.md +19 -0
- package/resources/js/context/skills/optimization-suggestions/SKILL.md +89 -89
- package/resources/js/context/skills/platform-services/SKILL.md +101 -94
- package/resources/js/context/skills/platform-services/assets/modules/MultiplayerManager.ts +465 -783
- package/resources/js/context/skills/platform-services/assets/modules/eventBus.ts +57 -57
- package/resources/js/context/skills/platform-services/assets/modules/identity/qq-ai-game-sdk.min.js +5 -0
- package/resources/js/context/skills/platform-services/assets/modules/identity/qq-session.mjs +208 -0
- package/resources/js/context/skills/platform-services/assets/modules/identity/shared.mjs +37 -0
- package/resources/js/context/skills/platform-services/assets/modules/leaderboard.d.mts +39 -39
- package/resources/js/context/skills/platform-services/assets/modules/leaderboard.mjs +1 -1
- package/resources/js/context/skills/platform-services/assets/modules/log.ts +35 -35
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/clockSync.ts +61 -0
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/dsClient.ts +52 -0
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/payloadCodec.ts +30 -0
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/roomHttp.ts +89 -0
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/types.ts +47 -0
- package/resources/js/context/skills/platform-services/assets/modules/platform-service.d.mts +31 -25
- package/resources/js/context/skills/platform-services/assets/modules/platform-service.mjs +272 -1
- package/resources/js/context/skills/platform-services/assets/modules/save.d.mts +49 -49
- package/resources/js/context/skills/platform-services/assets/modules/save.mjs +1 -1
- package/resources/js/context/skills/platform-services/assets/scaffold/ds/main.mjs +7 -7
- package/resources/js/context/skills/platform-services/assets/scaffold/ds/rooms/SyncRoom.mjs +264 -264
- package/resources/js/context/skills/platform-services/assets/scaffold/ds/rooms/syncSchema.mjs +39 -39
- package/resources/js/context/skills/platform-services/references/SERVER_GUIDE.md +139 -139
- package/resources/js/context/skills/platform-services/references/api_reference.md +18 -18
- package/resources/js/context/skills/platform-services/references/leaderboard_playbook.md +96 -0
- package/resources/js/context/skills/platform-services/scripts/install.mjs +148 -134
- package/resources/js/context/skills/resolution-adaptation/SKILL.md +47 -202
- package/resources/js/context/skills/resolution-adaptation/assets/display/ui-stage.ts +156 -121
- package/resources/js/context/skills/resolution-adaptation/assets/display/viewport.ts +249 -254
- package/resources/js/context/skills/resolution-adaptation/assets/example/main.ts +98 -98
- package/resources/js/context/skills/resolution-adaptation/assets/example/ui-tokens.css +200 -200
- package/resources/js/context/skills/resolution-adaptation/references/audit.md +31 -0
- package/resources/js/context/skills/resolution-adaptation/references/device-safe-area.md +40 -0
- package/resources/js/context/skills/resolution-adaptation/references/game-ui-occlusion.md +18 -0
- package/resources/js/context/skills/resolution-adaptation/references/layout-rules.md +15 -134
- package/resources/js/context/skills/resolution-adaptation/references/troubleshooting.md +34 -0
- package/resources/js/context/skills/resolution-adaptation/references/viewport-api.md +38 -119
- package/resources/js/context/skills/resolution-adaptation/references/world-resize.md +55 -0
- package/resources/js/context/skills/resolution-adaptation/scripts/aspect_audit.mjs +448 -338
- package/resources/js/context/skills/scene-editor-compat/SKILL.md +94 -94
- package/resources/js/context/skills/scene-editor-compat/assets/example/localcraft.assets.json +13 -13
- package/resources/js/context/skills/scene-editor-compat/assets/example/localcraft.scene-editor.json +6 -6
- package/resources/js/context/skills/scene-editor-compat/assets/example/src/game/sceneAdapter.ts +25 -25
- package/resources/js/context/skills/scene-editor-compat/assets/example/src/scenes/main.scene.json +18 -18
- package/resources/js/context/skills/scene-editor-compat/assets/runtime/release.json +7 -7
- package/resources/js/context/skills/scene-editor-compat/assets/runtime/scene.d.mts +42 -42
- package/resources/js/context/skills/scene-editor-compat/assets/runtime/scene.mjs +144 -144
- package/resources/js/context/skills/scene-editor-compat/docs/contract.md +330 -330
- package/resources/js/context/skills/scene-editor-compat/docs/resource-sync.md +64 -64
- package/resources/js/context/skills/scene-editor-compat/docs/runtime-state.md +28 -28
- package/resources/js/context/skills/scene-editor-compat/docs/terrain-contract.md +47 -47
- package/resources/js/context/skills/scene-editor-compat/docs/visual-contract.md +64 -64
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/localcraft.assets.json +38 -38
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/localcraft.scene-editor.json +9 -9
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/game/sceneAdapter.ts +59 -59
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/game/sceneBlockers.ts +30 -30
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/game/sceneFileAssets.ts +66 -66
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/scenes/Main.Scene.ts +20 -20
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/scenes/SceneTypes.ts +26 -26
- package/resources/js/context/skills/scene-editor-compat/references/contract.md +73 -73
- package/resources/js/context/skills/scene-editor-compat/scripts/apply_scene_marker.py +162 -162
- package/resources/js/context/skills/scene-editor-compat/scripts/check_scene_contract.py +853 -853
- package/resources/js/context/skills/scene-editor-compat/scripts/check_scene_resource_urls.py +173 -173
- package/resources/js/context/skills/scene-editor-compat/scripts/scene-editor.mjs +427 -427
- package/resources/js/context/skills/scene-editor-compat/version.json +1 -1
- package/resources/js/context/skills/ui-editor-compat/SKILL.md +48 -48
- package/resources/js/context/skills/ui-editor-compat/assets/example/hud/WidgetLayout_Hud.ts +35 -35
- package/resources/js/context/skills/ui-editor-compat/assets/example/hud/WidgetLogic_Hud.ts +74 -74
- package/resources/js/context/skills/ui-editor-compat/assets/example/hud/hud.css +60 -60
- package/resources/js/context/skills/ui-editor-compat/assets/runtime/dom-ui.d.mts +45 -45
- package/resources/js/context/skills/ui-editor-compat/assets/runtime/dom-ui.mjs +265 -265
- package/resources/js/context/skills/ui-editor-compat/assets/runtime/release.json +7 -7
- package/resources/js/context/skills/ui-editor-compat/references/contract.md +132 -132
- package/resources/js/context/skills/ui-editor-compat/scripts/editor-contract.mjs +327 -327
- package/resources/js/context/skills/ui-editor-compat/scripts/project-files.mjs +80 -80
- package/resources/js/context/skills/ui-editor-compat/scripts/ui-editor.mjs +84 -84
- package/resources/js/context/skills/version-update/SKILL.md +192 -192
- package/resources/js/context/skills/version-update/scripts/check_runtime_refs.mjs +129 -129
- package/resources/js/context/skills/version-update/scripts/feature_snapshot.mjs +159 -159
- package/resources/js/context/skills/version-update/scripts/update_feature_version.mjs +157 -157
- package/resources/js/context/skills/visual-qa/SKILL.md +36 -36
- package/resources/js/context/version/version.json +1 -1
- package/resources/js/project/README.md +99 -99
- package/resources/js/project/SPEC/readme.md +6 -6
- package/resources/js/project/configs/assets.json +1 -1
- package/resources/js/project/configs/game.controls.json +3 -3
- package/resources/js/project/configs/game.json +3 -3
- package/resources/js/project/game-runtime.json +2 -2
- package/resources/js/project/{projectDisplayInfo.json → game.config.json} +7 -7
- package/resources/js/project/index.html +20 -20
- package/resources/js/project/package.json +23 -23
- package/resources/js/project/runtime/lightgame/1.1.0/platform/identity/qq-ai-game-sdk.min.js +5 -0
- package/resources/js/project/runtime/lightgame/1.1.0/platform/identity/qq-session.mjs +208 -0
- package/resources/js/project/runtime/lightgame/1.1.0/platform/identity/shared.mjs +37 -0
- package/resources/js/project/runtime/lightgame/1.1.0/platform/platform-capture-video.mjs +227 -0
- package/resources/js/project/runtime/lightgame/1.1.0/platform/platform-service.d.mts +31 -0
- package/resources/js/project/runtime/lightgame/1.1.0/platform/platform-service.mjs +272 -0
- package/resources/js/project/runtime/lightgame/1.1.0/platform/platform.d.mts +79 -0
- package/resources/js/project/runtime/lightgame/1.1.0/platform/platform.mjs +29 -0
- package/resources/js/project/runtime/lightgame/1.1.0/release.json +22 -0
- package/resources/js/project/runtime/lightgame/1.1.0/tooling/cli.mjs +16 -0
- package/resources/js/project/runtime/lightgame/1.1.0/tooling/project.d.mts +4 -0
- package/resources/js/project/runtime/lightgame/1.1.0/tooling/project.mjs +50 -0
- package/resources/js/project/runtime/lightgame/1.1.0/tooling/vite.d.mts +3 -0
- package/resources/js/project/runtime/lightgame/1.1.0/tooling/vite.mjs +72 -0
- package/resources/js/project/runtime/lightgame/1.1.0/tools/assets.d.mts +24 -0
- package/resources/js/project/runtime/lightgame/1.1.0/tools/assets.mjs +2 -0
- package/resources/js/project/runtime/lightgame/1.1.0/tools/astc.d.mts +10 -0
- package/resources/js/project/runtime/lightgame/1.1.0/tools/astc.mjs +1 -0
- package/resources/js/project/scripts/config-export.mjs +37 -32
- package/resources/js/project/scripts/refresh-runtime.mjs +50 -50
- package/resources/js/project/scripts/skill-modules/export-config/cli.mjs +20 -0
- package/resources/js/project/scripts/skill-modules/export-config/config.d.mts +19 -0
- package/resources/js/project/scripts/skill-modules/export-config/config.mjs +1 -0
- package/resources/js/project/scripts/skill-modules/export-config/installed.json +6 -0
- package/resources/js/project/scripts/skill-modules/export-config/project.d.mts +6 -0
- package/resources/js/project/scripts/skill-modules/export-config/project.mjs +77 -0
- package/resources/js/project/scripts/skill-modules/export-config/vite.d.mts +2 -0
- package/resources/js/project/scripts/skill-modules/export-config/vite.mjs +34 -0
- package/resources/js/project/scripts/write-preview-ready.mjs +22 -0
- package/resources/js/project/src/display/ui-stage.ts +156 -121
- package/resources/js/project/src/display/viewport.ts +249 -254
- package/resources/js/project/src/main.ts +87 -99
- package/resources/js/project/src/platform.ts +2 -14
- package/resources/js/project/src/scenes/LoadScene.ts +89 -89
- package/resources/js/project/src/scenes/PlayScene.ts +17 -17
- package/resources/js/project/src/screenUi.ts +185 -172
- package/resources/js/project/src/style.css +294 -165
- package/resources/js/project/tsconfig.json +20 -20
- package/resources/js/project/unified_data_control_config.json +20 -20
- package/resources/js/project/vendor/core-manager-js/src/.versions.json +42 -42
- package/resources/js/project/vendor/core-manager-js/src/CoreManagerPlugin.ts +41 -41
- package/resources/js/project/vendor/core-manager-js/src/assetManager/AssetRef.ts +93 -90
- package/resources/js/project/vendor/core-manager-js/src/assetManager/AstcFirstImageFile.ts +203 -203
- package/resources/js/project/vendor/core-manager-js/src/assetManager/AstcTextureLoader.ts +106 -106
- package/resources/js/project/vendor/core-manager-js/src/assetManager/resolveAssetUrl.test.ts +25 -25
- package/resources/js/project/vendor/core-manager-js/src/assetManager/resolveAssetUrl.ts +21 -21
- package/resources/js/project/vendor/core-manager-js/src/audioManager/AudioManager.test.ts +65 -65
- package/resources/js/project/vendor/core-manager-js/src/audioManager/AudioManager.ts +340 -340
- package/resources/js/project/vendor/core-manager-js/src/configManager/FeatureConfig.ts +87 -87
- package/resources/js/project/vendor/core-manager-js/src/configManager/tuneRuntime.d.mts +92 -92
- package/resources/js/project/vendor/core-manager-js/src/configManager/tuneRuntime.mjs +271 -271
- package/resources/js/project/vendor/core-manager-js/src/index.ts +31 -31
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputConfig.ts +81 -81
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputManager.test.ts +43 -43
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputManager.ts +32 -32
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputRuntime.test.ts +141 -141
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputRuntime.ts +20 -20
- package/resources/js/project/vendor/core-manager-js/src/inputManager/KeyboardProvider.ts +183 -183
- package/resources/js/project/vendor/core-manager-js/src/inputManager/TouchProvider.ts +304 -304
- package/resources/js/project/vendor/core-manager-js/src/inputManager/VirtualJoystick.ts +351 -351
- package/resources/js/project/vendor/core-manager-js/src/inputManager/_internal/InputManagerImpl.ts +180 -180
- package/resources/js/project/vendor/core-manager-js/src/inputManager/icons.b64 +13 -13
- package/resources/js/project/vendor/core-manager-js/src/inputManager/icons.b64.d.ts +14 -14
- package/resources/js/project/vendor/core-manager-js/src/inputManager/input_config.example.json +68 -68
- package/resources/js/project/vendor/core-manager-js/src/logManager/DebugConsole.ts +433 -433
- package/resources/js/project/vendor/core-manager-js/src/logManager/LogCapture.ts +118 -118
- package/resources/js/project/vendor/core-manager-js/src/logManager/LogManager.ts +444 -444
- package/resources/js/project/vendor/core-manager-js/src/logManager/ScreenCapture.ts +485 -485
- package/resources/js/project/vendor/core-manager-js/src/logManager/ScreenCaptureVideo.test.ts +66 -66
- package/resources/js/project/vendor/core-manager-js/src/logManager/ScreenCaptureVideo.ts +149 -149
- package/resources/js/project/vendor/core-manager-js/src/logManager/icons.b64 +9 -9
- package/resources/js/project/vendor/core-manager-js/src/resourceManager/AssetUrlResolver.ts +29 -29
- package/resources/js/project/vendor/core-manager-js/src/resourceManager/ResourceManager.test.ts +88 -88
- package/resources/js/project/vendor/core-manager-js/src/resourceManager/ResourceManager.ts +122 -122
- package/resources/js/project/vendor/core-manager-js/src/runtime.ts +24 -24
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/CharacterEntity.ts +318 -318
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/CharacterPhysicsBinding.test.ts +151 -151
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/CharacterPhysicsBinding.ts +235 -235
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/EffectComposite.test.ts +98 -98
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/EffectComposite.ts +94 -94
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/EffectEntity.ts +209 -209
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxManager.test.ts +106 -106
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxManager.ts +341 -341
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxRecipe.test.ts +68 -68
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxRecipe.ts +236 -236
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/SpriteAnimManager.test.ts +22 -22
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/SpriteAnimManager.ts +29 -29
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/SpriteEntity.test.ts +197 -197
- package/resources/js/project/vendor/core-manager-js/src/uiManager/DomUiContracts.ts +9 -9
- package/resources/js/project/vendor/core-manager-js/src/uiManager/DomUiKit.ts +555 -555
- package/resources/js/project/vendor/core-manager-js/src/uiManager/UIFacadePlugin.test.ts +112 -112
- package/resources/js/project/vendor/core-manager-js/src/uiManager/UIFacadePlugin.ts +178 -178
- package/resources/js/project/vendor/core-manager-js/src/uiManager/ui-base.css +246 -246
- package/resources/js/project/vendor/core-manager-js/src/videoManager/VideoManager.ts +139 -139
- package/resources/js/project/vendor/core-manager-js/tsconfig.json +15 -15
- package/resources/js/project/vendor/run.sh +4 -107
- package/resources/js/project/version/craft_feature_version.json +42 -42
- package/resources/js/project/version/project_feature_version.json +11 -11
- package/resources/js/project/vite.config.ts +5 -4
- package/resources/js3d/context/.role/AGENTS_DESIGN.md +9 -0
- package/resources/js3d/context/AGENTS.md +95 -0
- package/resources/js3d/context/hooks/hooks.json +14 -20
- package/resources/js3d/context/knowledge/3D/PoseInterpolationKnowledge.md +75 -87
- package/resources/js3d/context/knowledge/CodingGuide/Pitfalls.md +69 -69
- package/resources/js3d/context/knowledge/CodingGuide/SceneEditableGuide.md +42 -42
- package/resources/js3d/context/knowledge/FrontendComponents.md +19 -23
- package/resources/js3d/context/knowledge/MobileAdaptation.md +73 -0
- package/resources/js3d/context/knowledge/MobileAdapted.md +36 -0
- package/resources/js3d/context/knowledge/Multiplayer/GameplaySystemKnowledge.md +114 -114
- package/resources/js3d/context/knowledge/Multiplayer/OverviewKnowledge.md +117 -117
- package/resources/js3d/context/knowledge/Multiplayer/StateSyncKnowledge.md +430 -430
- package/resources/js3d/context/knowledge/PlatformServices.md +190 -162
- package/resources/js3d/context/knowledge/ProjectDisplayConfig.md +35 -0
- package/resources/js3d/context/knowledge/Runtime.md +34 -30
- package/resources/js3d/context/knowledge/SceneEditorCompat.md +35 -34
- package/resources/js3d/context/knowledge/StepByStep.md +21 -21
- package/resources/js3d/context/knowledge/Subsystems/Optional/MultiplayerManagerKnowledge.md +242 -242
- package/resources/js3d/context/knowledge/UiEditorCompat.md +21 -21
- package/resources/js3d/context/rules/MultiplayerCapability.md +27 -27
- package/resources/js3d/context/rules/MultiplayerRoomEntryUX.md +63 -63
- package/resources/js3d/context/rules/PlatformBoundaryModules.md +44 -43
- package/resources/js3d/context/rules/preview_ready.md +8 -0
- package/resources/js3d/context/skills/aigc-integration/SKILL.md +172 -176
- package/resources/js3d/context/skills/aigc-integration/assets/sprite-sheet-player.mjs +70 -0
- package/resources/js3d/context/skills/aigc-integration/callback.md +77 -56
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/README.md +23 -22
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/audio-aigc-knowledge.md +38 -38
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/character2d-aigc-knowledge.md +72 -0
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/staticmesh-aigc-knowledge.md +33 -33
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/texture-prop-aigc-knowledge.md +36 -36
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/texture-scene-aigc-knowledge.md +37 -37
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/texture-ui-aigc-knowledge.md +35 -35
- package/resources/js3d/context/skills/asset-search/SKILL.md +178 -159
- package/resources/js3d/context/skills/asset-search/references/resource-config.md +99 -56
- package/resources/js3d/context/skills/asset-search/references/sprite-sheets.md +58 -0
- package/resources/js3d/context/skills/asset-search/scripts/asset_display.mjs +62 -62
- package/resources/js3d/context/skills/asset-search/scripts/config.json +235 -213
- package/resources/js3d/context/skills/asset-search/scripts/manifest_pipeline.mjs +905 -885
- package/resources/js3d/context/skills/asset-search/scripts/preflight.mjs +79 -79
- package/resources/js3d/context/skills/asset-search/scripts/provided_assets.mjs +74 -74
- package/resources/js3d/context/skills/asset-search/scripts/search.mjs +637 -597
- package/resources/js3d/context/skills/asset-search/scripts/sprite_source_materializer.mjs +667 -0
- package/resources/js3d/context/skills/asset-search/strategies/anim2d.md +42 -0
- package/resources/js3d/context/skills/asset-search/strategies/effect2d.md +31 -0
- package/resources/js3d/context/skills/asset-usage-audit/SKILL.md +92 -0
- package/resources/js3d/context/skills/asset-usage-audit/references/case-tidewater-zoo.md +89 -0
- package/resources/js3d/context/skills/asset-usage-audit/references/optimization-playbook.md +143 -0
- package/resources/js3d/context/skills/asset-usage-audit/references/usage-model.md +90 -0
- package/resources/js3d/context/skills/asset-usage-audit/scripts/compare-animations.mjs +48 -0
- package/resources/js3d/context/skills/asset-usage-audit/scripts/lib/anim.mjs +266 -0
- package/resources/js3d/context/skills/asset-usage-audit/scripts/lib/glb.mjs +241 -0
- package/resources/js3d/context/skills/asset-usage-audit/scripts/lib/scan.mjs +455 -0
- package/resources/js3d/context/skills/asset-usage-audit/scripts/scan-assets.mjs +77 -0
- package/resources/js3d/context/skills/export-config/SKILL.md +20 -0
- package/resources/js3d/context/skills/export-config/assets/tooling/cli.mjs +20 -0
- package/resources/js3d/context/skills/export-config/assets/tooling/config.d.mts +19 -0
- package/resources/js3d/context/skills/export-config/assets/tooling/config.mjs +1 -0
- package/resources/js3d/context/skills/export-config/assets/tooling/project.d.mts +6 -0
- package/resources/js3d/context/skills/export-config/assets/tooling/project.mjs +77 -0
- package/resources/js3d/context/skills/export-config/assets/tooling/vite.d.mts +2 -0
- package/resources/js3d/context/skills/export-config/assets/tooling/vite.mjs +34 -0
- package/resources/js3d/context/skills/export-config/scripts/assert-asset-wiring.mjs +97 -83
- package/resources/js3d/context/skills/export-config/scripts/export-config.mjs +56 -53
- package/resources/js3d/context/skills/export-config/scripts/install.mjs +89 -0
- package/resources/js3d/context/skills/export-config/scripts/panel-resource-path.mjs +106 -106
- package/resources/js3d/context/skills/export-config/scripts/sync-asset-controls.mjs +327 -325
- package/resources/js3d/context/skills/export-config/scripts/sync-scene-assets.mjs +216 -181
- package/resources/js3d/context/skills/export-config/scripts/translate-asset-titles.mjs +161 -163
- package/resources/js3d/context/skills/game-art-style/SKILL.md +60 -60
- package/resources/js3d/context/skills/game-art-style/references/art-parameters-lite.md +38 -38
- package/resources/js3d/context/skills/game-art-style/references/construction.md +111 -111
- package/resources/js3d/context/skills/game-art-style/references/materials-textures.md +105 -105
- package/resources/js3d/context/skills/game-art-style/references/sources.md +25 -25
- package/resources/js3d/context/skills/game-art-style/references/styles/cartoon.md +175 -175
- package/resources/js3d/context/skills/game-art-style/references/styles/comic.md +168 -168
- package/resources/js3d/context/skills/game-art-style/references/styles/cozy.md +191 -191
- package/resources/js3d/context/skills/game-art-style/references/styles/cyber.md +165 -165
- package/resources/js3d/context/skills/game-art-style/references/styles/horror.md +173 -173
- package/resources/js3d/context/skills/game-art-style/references/styles/lowpoly.md +185 -185
- package/resources/js3d/context/skills/game-art-style/references/styles/paper.md +181 -181
- package/resources/js3d/context/skills/game-art-style/references/styles/voxel.md +189 -189
- package/resources/js3d/context/skills/game-art-style/references/user-style-document.md +88 -88
- package/resources/js3d/context/skills/mobile-adaptation/SKILL.md +301 -284
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-config.json +104 -104
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-layer.ts +933 -952
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-platform.ts +92 -92
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-primitives.ts +254 -0
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/look-pad.ts +245 -245
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/ui/touch-controls.css +257 -256
- package/resources/js3d/context/skills/mobile-adaptation/references/input-config.md +342 -311
- package/resources/js3d/context/skills/mobile-adaptation/references/verification.md +140 -106
- package/resources/js3d/context/skills/mobile-adaptation/references/web-audio.md +11 -0
- package/resources/js3d/context/skills/mobile-compat-qa/SKILL.md +53 -0
- package/resources/js3d/context/skills/mobile-compat-qa/references/startup-diagnosis.md +23 -0
- package/resources/js3d/context/skills/mobile-compat-qa/references/web-form-input.md +10 -0
- package/resources/js3d/context/skills/mobile-compat-qa/references/web-lifecycle.md +20 -0
- package/resources/js3d/context/skills/mobile-compat-qa/references/web-performance.md +19 -0
- package/resources/js3d/context/skills/optimization-suggestions/SKILL.md +74 -74
- package/resources/js3d/context/skills/performance-audit/SKILL.md +166 -0
- package/resources/js3d/context/skills/performance-audit/references/case-notes.md +93 -0
- package/resources/js3d/context/skills/performance-audit/references/rules.md +183 -0
- package/resources/js3d/context/skills/performance-audit/scripts/lib/rules.mjs +470 -0
- package/resources/js3d/context/skills/performance-audit/scripts/lib/scan.mjs +387 -0
- package/resources/js3d/context/skills/performance-audit/scripts/lib/source.mjs +398 -0
- package/resources/js3d/context/skills/performance-audit/scripts/scan-perf.mjs +130 -0
- package/resources/js3d/context/skills/platform-services/SKILL.md +101 -94
- package/resources/js3d/context/skills/platform-services/assets/modules/MultiplayerManager.ts +465 -783
- package/resources/js3d/context/skills/platform-services/assets/modules/eventBus.ts +57 -57
- package/resources/js3d/context/skills/platform-services/assets/modules/identity/qq-ai-game-sdk.min.js +5 -0
- package/resources/js3d/context/skills/platform-services/assets/modules/identity/qq-session.mjs +208 -0
- package/resources/js3d/context/skills/platform-services/assets/modules/identity/shared.mjs +37 -0
- package/resources/js3d/context/skills/platform-services/assets/modules/leaderboard.d.mts +39 -39
- package/resources/js3d/context/skills/platform-services/assets/modules/leaderboard.mjs +1 -1
- package/resources/js3d/context/skills/platform-services/assets/modules/log.ts +35 -35
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/clockSync.ts +61 -0
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/dsClient.ts +52 -0
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/payloadCodec.ts +30 -0
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/roomHttp.ts +89 -0
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/types.ts +47 -0
- package/resources/js3d/context/skills/platform-services/assets/modules/platform-service.d.mts +31 -25
- package/resources/js3d/context/skills/platform-services/assets/modules/platform-service.mjs +272 -1
- package/resources/js3d/context/skills/platform-services/assets/modules/save.d.mts +49 -49
- package/resources/js3d/context/skills/platform-services/assets/modules/save.mjs +1 -1
- package/resources/js3d/context/skills/platform-services/assets/scaffold/ds/main.mjs +7 -7
- package/resources/js3d/context/skills/platform-services/assets/scaffold/ds/rooms/SyncRoom.mjs +264 -264
- package/resources/js3d/context/skills/platform-services/assets/scaffold/ds/rooms/syncSchema.mjs +39 -39
- package/resources/js3d/context/skills/platform-services/references/SERVER_GUIDE.md +139 -139
- package/resources/js3d/context/skills/platform-services/references/api_reference.md +18 -18
- package/resources/js3d/context/skills/platform-services/references/leaderboard_playbook.md +96 -0
- package/resources/js3d/context/skills/platform-services/scripts/install.mjs +148 -134
- package/resources/js3d/context/skills/resolution-adaptation/SKILL.md +46 -170
- package/resources/js3d/context/skills/resolution-adaptation/assets/display/ui-stage.ts +156 -121
- package/resources/js3d/context/skills/resolution-adaptation/assets/display/viewport.ts +239 -244
- package/resources/js3d/context/skills/resolution-adaptation/assets/example/main.ts +129 -127
- package/resources/js3d/context/skills/resolution-adaptation/assets/example/ui-tokens.css +188 -188
- package/resources/js3d/context/skills/resolution-adaptation/references/audit.md +31 -0
- package/resources/js3d/context/skills/resolution-adaptation/references/device-safe-area.md +40 -0
- package/resources/js3d/context/skills/resolution-adaptation/references/game-ui-occlusion.md +18 -0
- package/resources/js3d/context/skills/resolution-adaptation/references/layout-rules.md +15 -124
- package/resources/js3d/context/skills/resolution-adaptation/references/troubleshooting.md +34 -0
- package/resources/js3d/context/skills/resolution-adaptation/references/viewport-api.md +38 -117
- package/resources/js3d/context/skills/resolution-adaptation/scripts/aspect_audit.mjs +448 -338
- package/resources/js3d/context/skills/scene-editor-compat/SKILL.md +599 -599
- package/resources/js3d/context/skills/scene-editor-compat/references/bundle-contract.md +141 -141
- package/resources/js3d/context/skills/scene-editor-compat/references/editor-integration.md +92 -92
- package/resources/js3d/context/skills/scene-editor-compat/references/scene-data-format.md +125 -125
- package/resources/js3d/context/skills/scene-editor-compat/references/slots-rules.md +113 -113
- package/resources/js3d/context/skills/scene-editor-compat/scripts/scene-editor.mjs +1187 -1187
- package/resources/js3d/context/skills/threejs-game-quality/SKILL.md +53 -52
- package/resources/js3d/context/skills/threejs-game-quality/agents/openai.yaml +4 -4
- package/resources/js3d/context/skills/threejs-game-quality/references/01-build.md +94 -94
- package/resources/js3d/context/skills/threejs-game-quality/references/02-avoid.md +50 -50
- package/resources/js3d/context/skills/threejs-game-quality/references/03-detect.md +105 -105
- package/resources/js3d/context/skills/threejs-game-quality/references/camera-by-genre.md +147 -147
- package/resources/js3d/context/skills/threejs-game-quality/references/camera-distance.md +79 -79
- package/resources/js3d/context/skills/threejs-game-quality/references/camera-sources.md +56 -56
- package/resources/js3d/context/skills/threejs-game-quality/references/character-motion-face.md +51 -51
- package/resources/js3d/context/skills/threejs-game-quality/references/parameter-contract.md +55 -55
- package/resources/js3d/context/skills/threejs-game-quality/references/refine-existing.md +78 -78
- package/resources/js3d/context/skills/threejs-game-quality/references/rendering-stability.md +84 -84
- package/resources/js3d/context/skills/threejs-game-quality/references/runtime-tools.md +117 -117
- package/resources/js3d/context/skills/threejs-game-quality/scripts/package.json +4 -4
- package/resources/js3d/context/skills/threejs-game-quality/scripts/runtime-audit.js +238 -238
- package/resources/js3d/context/skills/ui-editor-compat/SKILL.md +59 -59
- package/resources/js3d/context/skills/ui-editor-compat/assets/example/hud/WidgetLayout_Hud.ts +35 -35
- package/resources/js3d/context/skills/ui-editor-compat/assets/example/hud/WidgetLogic_Hud.ts +61 -61
- package/resources/js3d/context/skills/ui-editor-compat/assets/example/hud/hud.css +60 -60
- package/resources/js3d/context/skills/ui-editor-compat/assets/runtime/dom-ui.d.mts +45 -45
- package/resources/js3d/context/skills/ui-editor-compat/assets/runtime/dom-ui.mjs +265 -265
- package/resources/js3d/context/skills/ui-editor-compat/assets/runtime/release.json +7 -7
- package/resources/js3d/context/skills/ui-editor-compat/references/contract.md +110 -110
- package/resources/js3d/context/skills/ui-editor-compat/scripts/editor-contract.mjs +327 -327
- package/resources/js3d/context/skills/ui-editor-compat/scripts/project-files.mjs +80 -80
- package/resources/js3d/context/skills/ui-editor-compat/scripts/ui-editor.mjs +84 -84
- package/resources/js3d/context/skills/version-update/SKILL.md +191 -191
- package/resources/js3d/context/skills/version-update/scripts/check_runtime_refs.mjs +129 -129
- package/resources/js3d/context/skills/version-update/scripts/feature_snapshot.mjs +159 -159
- package/resources/js3d/context/skills/version-update/scripts/update_feature_version.mjs +157 -157
- package/resources/js3d/context/version/version.json +1 -1
- package/resources/js3d/project/README.md +106 -100
- package/resources/js3d/project/configs/game.controls.json +3 -3
- package/resources/js3d/project/configs/game.json +3 -3
- package/resources/js3d/project/game-runtime.json +2 -2
- package/resources/js3d/project/{projectDisplayInfo.json → game.config.json} +7 -7
- package/resources/js3d/project/index.html +12 -12
- package/resources/js3d/project/package.json +24 -24
- package/resources/js3d/project/runtime/lightgame/1.0.0/release.json +2 -2
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/glb.d.mts +2 -12
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/glb.mjs +21 -29
- package/resources/js3d/project/runtime/lightgame/1.1.0/platform/identity/qq-ai-game-sdk.min.js +5 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/platform/identity/qq-session.mjs +208 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/platform/identity/shared.mjs +37 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/platform/platform-capture-video.mjs +227 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/platform/platform-service.d.mts +31 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/platform/platform-service.mjs +272 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/platform/platform.d.mts +79 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/platform/platform.mjs +30 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/release.json +24 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/tooling/cli.mjs +16 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/tooling/project.d.mts +4 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/tooling/project.mjs +50 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/tooling/vite.d.mts +3 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/tooling/vite.mjs +72 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/tools/assets.d.mts +24 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/tools/assets.mjs +2 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/tools/astc.d.mts +10 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/tools/astc.mjs +1 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/tools/glb.d.mts +26 -0
- package/resources/js3d/project/runtime/lightgame/1.1.0/tools/glb.mjs +351 -0
- package/resources/js3d/project/scripts/config-export.mjs +37 -32
- package/resources/js3d/project/scripts/refresh-runtime.mjs +50 -50
- package/resources/js3d/project/scripts/skill-modules/export-config/cli.mjs +20 -0
- package/resources/js3d/project/scripts/skill-modules/export-config/config.d.mts +19 -0
- package/resources/js3d/project/scripts/skill-modules/export-config/config.mjs +1 -0
- package/resources/js3d/project/scripts/skill-modules/export-config/installed.json +6 -0
- package/resources/js3d/project/scripts/skill-modules/export-config/project.d.mts +6 -0
- package/resources/js3d/project/scripts/skill-modules/export-config/project.mjs +77 -0
- package/resources/js3d/project/scripts/skill-modules/export-config/vite.d.mts +2 -0
- package/resources/js3d/project/scripts/skill-modules/export-config/vite.mjs +34 -0
- package/resources/js3d/project/scripts/write-preview-ready.mjs +22 -0
- package/resources/js3d/project/src/display/ui-stage.ts +156 -121
- package/resources/js3d/project/src/display/viewport.ts +239 -244
- package/resources/js3d/project/src/main.ts +85 -83
- package/resources/js3d/project/src/platform.ts +2 -14
- package/resources/js3d/project/src/style.css +83 -17
- package/resources/js3d/project/tsconfig.json +20 -20
- package/resources/js3d/project/unified_data_control_config.json +20 -20
- package/resources/js3d/project/vendor/core-manager-three/package.json +12 -12
- package/resources/js3d/project/vendor/core-manager-three/src/index.ts +2 -2
- package/resources/js3d/project/vendor/run.sh +4 -4
- package/resources/js3d/project/version/craft_feature_version.json +42 -42
- package/resources/js3d/project/version/project_feature_version.json +11 -11
- package/resources/js3d/project/vite.config.ts +5 -4
- package/vendor/agent-cli/dist/runtime-tools/ue/blender-cook-assets.cjs +19 -19
- package/vendor/agent-cli/dist/runtime-tools/ue/tool-manifest.json +1 -1
- package/vendor/agent-cli/dist/src/artifacts/context-finalize.d.ts +1 -1
- package/vendor/agent-cli/dist/src/artifacts/context-finalize.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/context-finalize.js +15 -6
- package/vendor/agent-cli/dist/src/artifacts/context-finalize.js.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/native-source.d.ts +3 -0
- package/vendor/agent-cli/dist/src/artifacts/native-source.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/native-source.js +13 -0
- package/vendor/agent-cli/dist/src/artifacts/native-source.js.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.d.ts +13 -0
- package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.js +300 -0
- package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.js.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/prepare.d.ts +4 -0
- package/vendor/agent-cli/dist/src/artifacts/prepare.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/prepare.js +20 -7
- package/vendor/agent-cli/dist/src/artifacts/prepare.js.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.d.ts +8 -1
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.js +59 -37
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.js.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/restore-permissions.d.ts +27 -0
- package/vendor/agent-cli/dist/src/artifacts/restore-permissions.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/restore-permissions.js +112 -0
- package/vendor/agent-cli/dist/src/artifacts/restore-permissions.js.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/restore.d.ts +9 -0
- package/vendor/agent-cli/dist/src/artifacts/restore.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/restore.js +137 -57
- package/vendor/agent-cli/dist/src/artifacts/restore.js.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/static.d.ts +6 -2
- package/vendor/agent-cli/dist/src/artifacts/static.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/static.js +100 -28
- package/vendor/agent-cli/dist/src/artifacts/static.js.map +1 -1
- package/vendor/agent-cli/dist/src/cli/process-protocol.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/cli/process-protocol.js +6 -3
- package/vendor/agent-cli/dist/src/cli/process-protocol.js.map +1 -1
- package/vendor/agent-cli/dist/src/component/browser-queue.d.ts +55 -0
- package/vendor/agent-cli/dist/src/component/browser-queue.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/component/browser-queue.js +63 -0
- package/vendor/agent-cli/dist/src/component/browser-queue.js.map +1 -0
- package/vendor/agent-cli/dist/src/component/execution.d.ts +4 -0
- package/vendor/agent-cli/dist/src/component/execution.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/component/execution.js +16 -4
- package/vendor/agent-cli/dist/src/component/execution.js.map +1 -1
- package/vendor/agent-cli/dist/src/component/isolated-launcher.d.ts +2 -0
- package/vendor/agent-cli/dist/src/component/isolated-launcher.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/component/isolated-launcher.js +76 -0
- package/vendor/agent-cli/dist/src/component/isolated-launcher.js.map +1 -0
- package/vendor/agent-cli/dist/src/component/isolated-preload.d.ts +2 -0
- package/vendor/agent-cli/dist/src/component/isolated-preload.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/component/isolated-preload.js +27 -0
- package/vendor/agent-cli/dist/src/component/isolated-preload.js.map +1 -0
- package/vendor/agent-cli/dist/src/component/platform-access/server.d.ts +0 -5
- package/vendor/agent-cli/dist/src/component/platform-access/server.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/component/platform-access/server.js +9 -3
- package/vendor/agent-cli/dist/src/component/platform-access/server.js.map +1 -1
- package/vendor/agent-cli/dist/src/component/preparation-diagnostics.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/component/preparation-diagnostics.js +5 -0
- package/vendor/agent-cli/dist/src/component/preparation-diagnostics.js.map +1 -1
- package/vendor/agent-cli/dist/src/component/process-diagnostics.d.ts +25 -0
- package/vendor/agent-cli/dist/src/component/process-diagnostics.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/component/process-diagnostics.js +137 -0
- package/vendor/agent-cli/dist/src/component/process-diagnostics.js.map +1 -0
- package/vendor/agent-cli/dist/src/component/process-isolation.d.ts +10 -0
- package/vendor/agent-cli/dist/src/component/process-isolation.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/component/process-isolation.js +59 -0
- package/vendor/agent-cli/dist/src/component/process-isolation.js.map +1 -0
- package/vendor/agent-cli/dist/src/component/proxied-fetch.d.ts +2 -0
- package/vendor/agent-cli/dist/src/component/proxied-fetch.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/component/proxied-fetch.js +46 -0
- package/vendor/agent-cli/dist/src/component/proxied-fetch.js.map +1 -0
- package/vendor/agent-cli/dist/src/component/public-egress.d.ts +17 -0
- package/vendor/agent-cli/dist/src/component/public-egress.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/component/public-egress.js +246 -0
- package/vendor/agent-cli/dist/src/component/public-egress.js.map +1 -0
- package/vendor/agent-cli/dist/src/context/cache-publication-lock.d.ts +3 -0
- package/vendor/agent-cli/dist/src/context/cache-publication-lock.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/context/cache-publication-lock.js +68 -0
- package/vendor/agent-cli/dist/src/context/cache-publication-lock.js.map +1 -0
- package/vendor/agent-cli/dist/src/context/cache-publication.d.ts +1 -1
- package/vendor/agent-cli/dist/src/context/cache-publication.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/context/cache-publication.js +8 -4
- package/vendor/agent-cli/dist/src/context/cache-publication.js.map +1 -1
- package/vendor/agent-cli/dist/src/context/context-cache.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/context/context-cache.js +5 -2
- package/vendor/agent-cli/dist/src/context/context-cache.js.map +1 -1
- package/vendor/agent-cli/dist/src/context/context-project.d.ts +45 -4
- package/vendor/agent-cli/dist/src/context/context-project.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/context/context-project.js +157 -16
- package/vendor/agent-cli/dist/src/context/context-project.js.map +1 -1
- package/vendor/agent-cli/dist/src/context/context-scoped-source.d.ts +13 -0
- package/vendor/agent-cli/dist/src/context/context-scoped-source.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/context/context-scoped-source.js +78 -0
- package/vendor/agent-cli/dist/src/context/context-scoped-source.js.map +1 -0
- package/vendor/agent-cli/dist/src/context/context-snapshot-cache.d.ts +14 -0
- package/vendor/agent-cli/dist/src/context/context-snapshot-cache.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/context/context-snapshot-cache.js +110 -44
- package/vendor/agent-cli/dist/src/context/context-snapshot-cache.js.map +1 -1
- package/vendor/agent-cli/dist/src/context/local-skills.d.ts +2 -0
- package/vendor/agent-cli/dist/src/context/local-skills.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/context/local-skills.js +36 -19
- package/vendor/agent-cli/dist/src/context/local-skills.js.map +1 -1
- package/vendor/agent-cli/dist/src/context/member-context.d.ts +2 -1
- package/vendor/agent-cli/dist/src/context/member-context.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/context/member-context.js +17 -9
- package/vendor/agent-cli/dist/src/context/member-context.js.map +1 -1
- package/vendor/agent-cli/dist/src/context/script-dependencies.d.ts +9 -1
- package/vendor/agent-cli/dist/src/context/script-dependencies.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/context/script-dependencies.js +22 -6
- package/vendor/agent-cli/dist/src/context/script-dependencies.js.map +1 -1
- package/vendor/agent-cli/dist/src/context/shared-cache-build.d.ts +1 -1
- package/vendor/agent-cli/dist/src/context/shared-cache-build.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/context/shared-cache-build.js +1 -0
- package/vendor/agent-cli/dist/src/context/shared-cache-build.js.map +1 -1
- package/vendor/agent-cli/dist/src/context/team-knowledge.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/context/team-knowledge.js +11 -2
- package/vendor/agent-cli/dist/src/context/team-knowledge.js.map +1 -1
- package/vendor/agent-cli/dist/src/context/template-cache.js +2 -2
- package/vendor/agent-cli/dist/src/context/template-cache.js.map +1 -1
- package/vendor/agent-cli/dist/src/context/template-seed.d.ts +3 -0
- package/vendor/agent-cli/dist/src/context/template-seed.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/context/template-seed.js +50 -16
- package/vendor/agent-cli/dist/src/context/template-seed.js.map +1 -1
- package/vendor/agent-cli/dist/src/context/user-skill-context.d.ts +3 -1
- package/vendor/agent-cli/dist/src/context/user-skill-context.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/context/user-skill-context.js +41 -2
- package/vendor/agent-cli/dist/src/context/user-skill-context.js.map +1 -1
- package/vendor/agent-cli/dist/src/index.d.ts +4 -1
- package/vendor/agent-cli/dist/src/index.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/index.js +4 -1
- package/vendor/agent-cli/dist/src/index.js.map +1 -1
- package/vendor/agent-cli/dist/src/lifecycle/engine-hooks.d.ts +2 -2
- package/vendor/agent-cli/dist/src/lifecycle/engine-hooks.js +4 -2
- package/vendor/agent-cli/dist/src/lifecycle/engine-hooks.js.map +1 -1
- package/vendor/agent-cli/dist/src/lifecycle/hook-command.js +1 -1
- package/vendor/agent-cli/dist/src/lifecycle/hook-command.js.map +1 -1
- package/vendor/agent-cli/dist/src/protocol/messages/errors.gen.d.ts +24 -0
- package/vendor/agent-cli/dist/src/protocol/messages/errors.gen.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/protocol/messages/errors.gen.js +6 -0
- package/vendor/agent-cli/dist/src/protocol/messages/errors.gen.js.map +1 -1
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.d.ts +71 -4
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.js +13 -1
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.js.map +1 -1
- package/vendor/agent-cli/dist/src/security/command-translate.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/security/command-translate.js +4 -0
- package/vendor/agent-cli/dist/src/security/command-translate.js.map +1 -1
- package/vendor/agent-cli/dist/src/security/guard.d.ts +4 -0
- package/vendor/agent-cli/dist/src/security/guard.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/security/guard.js +17 -5
- package/vendor/agent-cli/dist/src/security/guard.js.map +1 -1
- package/vendor/agent-cli/dist/src/security/mount-table.d.ts +11 -2
- package/vendor/agent-cli/dist/src/security/mount-table.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/security/mount-table.js +92 -5
- package/vendor/agent-cli/dist/src/security/mount-table.js.map +1 -1
- package/vendor/agent-cli/dist/src/security/tool-scope.d.ts +4 -1
- package/vendor/agent-cli/dist/src/security/tool-scope.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/security/tool-scope.js +38 -4
- package/vendor/agent-cli/dist/src/security/tool-scope.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/client.d.ts +20 -0
- package/vendor/agent-cli/dist/src/session/client.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/client.js +26 -4
- package/vendor/agent-cli/dist/src/session/client.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/custom-context.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/custom-context.js +12 -6
- package/vendor/agent-cli/dist/src/session/custom-context.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/execution-recovery.d.ts +9 -0
- package/vendor/agent-cli/dist/src/session/execution-recovery.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/session/execution-recovery.js +49 -0
- package/vendor/agent-cli/dist/src/session/execution-recovery.js.map +1 -0
- package/vendor/agent-cli/dist/src/session/expert-definition.d.ts +4 -0
- package/vendor/agent-cli/dist/src/session/expert-definition.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/session/expert-definition.js +20 -0
- package/vendor/agent-cli/dist/src/session/expert-definition.js.map +1 -0
- package/vendor/agent-cli/dist/src/session/link-config.js +1 -1
- package/vendor/agent-cli/dist/src/session/link-config.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/link-session.d.ts +1 -0
- package/vendor/agent-cli/dist/src/session/link-session.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/link-session.js +19 -2
- package/vendor/agent-cli/dist/src/session/link-session.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-lifecycle.d.ts +5 -0
- package/vendor/agent-cli/dist/src/session/process-lifecycle.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/session/process-lifecycle.js +18 -0
- package/vendor/agent-cli/dist/src/session/process-lifecycle.js.map +1 -0
- package/vendor/agent-cli/dist/src/session/process-observability.d.ts +4 -0
- package/vendor/agent-cli/dist/src/session/process-observability.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/session/process-observability.js +14 -0
- package/vendor/agent-cli/dist/src/session/process-observability.js.map +1 -0
- package/vendor/agent-cli/dist/src/session/process-request.d.ts +6 -6
- package/vendor/agent-cli/dist/src/session/process-request.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-request.js +55 -60
- package/vendor/agent-cli/dist/src/session/process-request.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-restore.d.ts +4 -0
- package/vendor/agent-cli/dist/src/session/process-restore.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/session/process-restore.js +21 -0
- package/vendor/agent-cli/dist/src/session/process-restore.js.map +1 -0
- package/vendor/agent-cli/dist/src/session/process-workspace.d.ts +3 -0
- package/vendor/agent-cli/dist/src/session/process-workspace.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/session/process-workspace.js +21 -0
- package/vendor/agent-cli/dist/src/session/process-workspace.js.map +1 -0
- package/vendor/agent-cli/dist/src/session/reference-tools.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/reference-tools.js +3 -2
- package/vendor/agent-cli/dist/src/session/reference-tools.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/run-setup.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/run-setup.js +33 -14
- package/vendor/agent-cli/dist/src/session/run-setup.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/run-start-body.d.ts +5 -0
- package/vendor/agent-cli/dist/src/session/run-start-body.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/run-start-body.js +13 -1
- package/vendor/agent-cli/dist/src/session/run-start-body.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/team-persistence.js +1 -1
- package/vendor/agent-cli/dist/src/session/team-persistence.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/tool-scheduler.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/tool-scheduler.js +32 -23
- package/vendor/agent-cli/dist/src/session/tool-scheduler.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/user-skill-compatibility.d.ts +4 -0
- package/vendor/agent-cli/dist/src/session/user-skill-compatibility.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/session/user-skill-compatibility.js +25 -0
- package/vendor/agent-cli/dist/src/session/user-skill-compatibility.js.map +1 -0
- package/vendor/agent-cli/dist/src/session/user-skill-loaded.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/user-skill-loaded.js +2 -1
- package/vendor/agent-cli/dist/src/session/user-skill-loaded.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/user-skill-prompt.d.ts +4 -0
- package/vendor/agent-cli/dist/src/session/user-skill-prompt.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/session/user-skill-prompt.js +15 -0
- package/vendor/agent-cli/dist/src/session/user-skill-prompt.js.map +1 -0
- package/vendor/agent-cli/dist/src/shared/types.d.ts +50 -3
- package/vendor/agent-cli/dist/src/shared/types.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/tools/command-executor.d.ts +3 -0
- package/vendor/agent-cli/dist/src/tools/command-executor.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/tools/command-executor.js +42 -5
- package/vendor/agent-cli/dist/src/tools/command-executor.js.map +1 -1
- package/vendor/agent-cli/dist/src/tools/context-program.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/tools/context-program.js +46 -20
- package/vendor/agent-cli/dist/src/tools/context-program.js.map +1 -1
- package/vendor/agent-cli/dist/src/tools/file-ops.d.ts +10 -19
- package/vendor/agent-cli/dist/src/tools/file-ops.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/tools/file-ops.js +11 -85
- package/vendor/agent-cli/dist/src/tools/file-ops.js.map +1 -1
- package/vendor/agent-cli/dist/src/tools/file-search.d.ts +29 -0
- package/vendor/agent-cli/dist/src/tools/file-search.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/tools/file-search.js +98 -0
- package/vendor/agent-cli/dist/src/tools/file-search.js.map +1 -0
- package/vendor/agent-cli/dist/src/tools/file-stat.d.ts +9 -0
- package/vendor/agent-cli/dist/src/tools/file-stat.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/tools/file-stat.js +29 -0
- package/vendor/agent-cli/dist/src/tools/file-stat.js.map +1 -0
- package/vendor/agent-cli/dist/src/tools/local-hands.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/tools/local-hands.js +10 -2
- package/vendor/agent-cli/dist/src/tools/local-hands.js.map +1 -1
- package/vendor/agent-cli/dist/src/tools/tool-contract.gen.d.ts +3 -0
- package/vendor/agent-cli/dist/src/tools/tool-contract.gen.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/tools/tool-contract.gen.js +3 -0
- package/vendor/agent-cli/dist/src/tools/tool-contract.gen.js.map +1 -1
- package/resources/js/context/CLAUDE.md +0 -54
- package/resources/js/context/agents/aigc-manager.md +0 -91
- package/resources/js/context/knowledge/GameProbe.md +0 -74
- package/resources/js/context/skills/aigc-generate/scripts/apply-results.mjs +0 -83
- package/resources/js/context/skills/aigc-generate/scripts/config.json +0 -29
- package/resources/js/context/skills/aigc-generate/scripts/generate.mjs +0 -1016
- package/resources/js/context/skills/aigc-generate/scripts/lib/client.mjs +0 -228
- package/resources/js/context/skills/aigc-generate/scripts/lib/ledger.mjs +0 -119
- package/resources/js/context/skills/aigc-generate/scripts/lib/nstep-handoff.mjs +0 -100
- package/resources/js/context/skills/aigc-generate/scripts/lib/pipelines.mjs +0 -441
- package/resources/js/context/skills/aigc-generate/scripts/lib/queue.mjs +0 -283
- package/resources/js/context/skills/aigc-generate/scripts/lib/submit.mjs +0 -122
- package/resources/js/context/skills/aigc-generate/scripts/worker.mjs +0 -171
- package/resources/js/context/skills/asset-search/scripts/recalled_sprite_paths.mjs +0 -47
- package/resources/js/context/skills/asset-search/strategies/character2d.md +0 -33
- package/resources/js/context/skills/asset-search/strategies/texture-ui.md +0 -35
- package/resources/js/context/skills/display-info-setup/SKILL.md +0 -32
- package/resources/js/context/skills/display-info-setup/scripts/init_project.mjs +0 -38
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/platform/leaderboard.d.mts +0 -39
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/platform/leaderboard.mjs +0 -1
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/platform/platform-service.mjs +0 -1
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/platform/save.d.mts +0 -49
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/platform/save.mjs +0 -1
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/release.json +0 -37
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/tooling/cli.mjs +0 -2
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/tooling/project.d.mts +0 -8
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/tooling/project.mjs +0 -2
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/tooling/vite.d.mts +0 -3
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/tooling/vite.mjs +0 -8
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/tools/audio.d.mts +0 -20
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/tools/audio.mjs +0 -1
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/tools/canvas.d.mts +0 -21
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/tools/canvas.mjs +0 -1
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/tools/input.d.mts +0 -17
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/tools/input.mjs +0 -1
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/tools/three.d.mts +0 -40
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/tools/three.mjs +0 -1
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/tools/ui.d.mts +0 -10
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/tools/ui.mjs +0 -1
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/tools/video.d.mts +0 -8
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.0.0/tools/video.mjs +0 -1
- package/resources/js/context/skills/platform-services/assets/release.json +0 -44
- package/resources/js/project/.gitattributes +0 -2
- package/resources/js/project/gameplay-probe.json +0 -37
- package/resources/js/project/package-lock.json +0 -1155
- package/resources/js3d/context/CLAUDE.md +0 -50
- package/resources/js3d/context/skills/aigc-integration/scripts/config.json +0 -3
- package/resources/js3d/context/skills/aigc-integration/scripts/lib/submit.mjs +0 -344
- package/resources/js3d/context/skills/aigc-integration/scripts/query-music.mjs +0 -53
- package/resources/js3d/context/skills/aigc-integration/scripts/query-results.mjs +0 -53
- package/resources/js3d/context/skills/aigc-integration/scripts/submit-cover.mjs +0 -44
- package/resources/js3d/context/skills/aigc-integration/scripts/submit-image.mjs +0 -48
- package/resources/js3d/context/skills/aigc-integration/scripts/submit-music.mjs +0 -34
- package/resources/js3d/context/skills/aigc-integration/scripts/submit-staticmesh.mjs +0 -39
- package/resources/js3d/context/skills/platform-services/assets/release.json +0 -44
- package/resources/js3d/project/.gitattributes +0 -2
- package/resources/js3d/project/gameplay-probe.json +0 -38
- package/resources/js3d/project/package-lock.json +0 -1204
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/glb.test.mjs +0 -25
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { paintVideos, unionCaptureRect, collectPaintVideos, finishCanvasOverlays } from './platform-capture-video.mjs';
|
|
2
|
-
var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:true});var DEBUG_ICONS={"close":"iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAACUBJREFUeAG9WWtsXNURnvvYXWe9fuLFcXHIOnGjxFZaVU6QElWqVYSUPqWqMVIqJPpwKrVV/5SqVCXKgyLEI+QvSMkPEAEkDAICCIRAxH8wD/tHBDYgBbzBhoisZTuJvY5374OZs+ccz969u951HEYa3+u95/HNnJlz5swArDP5vm8oxn8N9sngbYLtYY1Uc0eaDMmX74VBDKPiWLKd6Kh+gnUis5pGSkNMU0K7CrjStgRqMDZlO5OY3o8cOWIE2vAx9XzXsyolwBkVCSABEluSbckRzn19ffx/+m4NDAxQe1POYUJgBddFgLABpZY5cAU4ihzr7u6O4bNO8gb+TKVS9B7r6emJcmEkm+VAV1qRqkwImLkoU6C+CMRCwEKIzs5O8bx8+bICFmlra7MZUHtxcdFub2+3JyYmqL0AT2PAiqmRianxDTa5r/xuVSpn73ISq7+/nyYW2oaCduPJZDKBz0bkJuSWpqamFny2It9E3NjY2EpM35CoTQNyoqO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VRB2YtxjPSJs96ThO/IgTP/5mNNKdTnvf7u1+dwKOAA/9srpwBAgHgB99Xz7tMsPXXTOK+Ja+BwEKojCBaOJ3CDTYboxbVA9+oAAKERDPK8z01+qa63u6DIw5vfMVtYO5o0l4KASva9EJaCGTySWNWdJFKMeX3gAF4ByBde+TydtBmLwbyruS9S7imms+uEeA6clMAL5bTp605Vn1maEX6DpadSPAY7/FQFU3QyxwvzFogT5MTpDPP1WlnIoAkfGIOOu96ZfEI6JVFDxyyoW9BJT3cqvoZkiN4H7n4LdYvUujQKhGD34He5CbhDrxpksCdp2rd9IzVLWHN3xZll6yXKT64VSWuRGIY68F2/usyDSVEgpBHyV8Mh41gpHcAu1eGZe4yZtjJwHlIRGv1t7DZzhCyrBv7MTUydsvciKwEh1mHtHX6R+4Ekg1IEgbEoWS1y1EIF17bplB7+ijIKRabo09cEdyo+pMIE0u/bHyfkvZ7SXQCGYZcSIMnAgkWbzaZsNDvDdwEKdNAlnROch78/26OG2R6AyBLaKz23uC25Zri5OKwsRvbiWQJJ7tPbiXa/gflCYEMvJZQv2ya5iKAsdWWTLd2WVplDAaX/esug+9+vQKJ0Q8qf2G3tBknh59S6ObENjY6wGf6tOXPIOpFKMbSxA9xH0xGOaOlwTki0TWMxKtl2BNdPZMno6jJ7lakqiqaob7xu8SJ+8I0alY5p2O5hmJVuIkc3sb3juWnZ1YEoVnl29UFFRpr4zghiQ5XqFPtfY5z4mEzuYip+DkZ6ZEr7oZKgK8bJw683fBmhMeqTNeiko09ns4I5T3qtytrhnx47X8Yu0RnTMhOWGph+ihNpIDRxMfCGIaUeNX2yihPsspEhWcFSz/EBgV/Yc8G/4DVxF6DgaK+k4AAAAASUVORK5CYII="};var iconUrl=__name(key=>DEBUG_ICONS[key]?`data:image/png;base64,${DEBUG_ICONS[key]}`:"","iconUrl");function copyWithTextarea(doc,text){const textarea=doc.createElement("textarea");textarea.value=text;textarea.setAttribute("readonly","true");textarea.style.cssText="position:fixed;left:-9999px;top:0";doc.body.appendChild(textarea);textarea.focus();textarea.select();let ok=false;try{ok=doc.execCommand("copy")}catch{ok=false}textarea.remove();return ok}__name(copyWithTextarea,"copyWithTextarea");function mountDebugConsole({doc,win,listen,ignoreAttribute,history,bridge}){const panel=doc.createElement("div");panel.setAttribute(ignoreAttribute,"");panel.style.cssText="position:fixed;left:8px;bottom:20px;z-index:2147483647";const root=panel.attachShadow({mode:"open"});root.innerHTML=`<style>
|
|
3
|
-
.debug-console{position:relative;box-sizing:border-box;display:inline-flex;align-items:center;min-width:205px;min-height:36px;padding:5px 8px;border-radius:12px;background:rgba(31,15,20,.92);border:1px solid rgba(128,46,56,.85);color:rgb(242,242,242);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif;font-size:17px;line-height:1;user-select:none;-webkit-user-select:none;cursor:grab}
|
|
4
|
-
.debug-console__row{display:inline-flex;align-items:center;gap:9px}
|
|
5
|
-
.debug-console__counter{display:inline-flex;align-items:center;gap:2px}
|
|
6
|
-
.debug-console__count-icon{display:block;width:16px;height:16px;object-fit:contain}
|
|
7
|
-
.debug-console__count-label{min-width:14px;color:rgb(242,242,242);font-size:17px;font-variant-numeric:tabular-nums}
|
|
8
|
-
.debug-console__icon-button{display:inline-flex;align-items:center;justify-content:center;margin:0;padding:0;border:none;cursor:pointer;-webkit-tap-highlight-color:transparent}
|
|
9
|
-
.debug-console__repair-button{position:relative;box-sizing:border-box;width:64px;height:28px;gap:2px;padding:0;overflow:hidden;color:rgb(242,242,242);font:inherit;font-size:16px;line-height:1;white-space:nowrap;flex-wrap:nowrap;background:transparent}
|
|
10
|
-
.debug-console__repair-button::before{content:'';position:absolute;inset:0;box-sizing:border-box;border:12px solid transparent;border-image-source:url("${iconUrl("repairButtonNormal")}");border-image-slice:12 fill;border-image-width:12px;border-image-repeat:stretch;pointer-events:none}
|
|
11
|
-
.debug-console__repair-button:hover::before{border-image-source:url("${iconUrl("repairButtonHover")}")}
|
|
12
|
-
.debug-console__repair-button:active::before{border-image-source:url("${iconUrl("repairButtonPressed")}")}
|
|
13
|
-
.debug-console__repair-button img{position:relative;z-index:1;display:block;width:20px;height:20px;flex:0 0 auto}
|
|
14
|
-
.debug-console__repair-button span{position:relative;z-index:1;display:block;color:rgb(242,242,242);font-size:16px;line-height:1;white-space:nowrap;flex:0 0 auto}
|
|
15
|
-
.debug-console__close-button{position:absolute;top:-16px;right:-18px;width:24px;height:24px;background:transparent}
|
|
16
|
-
.debug-console__close-button img{display:block;width:24px;height:24px}
|
|
17
|
-
.debug-console__repair-button.is-copy-ok{filter:drop-shadow(0 0 4px rgba(77,219,117,.9))}
|
|
18
|
-
.debug-console__repair-button.is-copy-fail{filter:drop-shadow(0 0 4px rgba(255,89,102,.9))}
|
|
19
|
-
</style>
|
|
20
|
-
<div class="debug-console" title="\u6309\u4F4F\u5E76\u79FB\u52A8\u53EF\u62D6\u52A8\u8C03\u8BD5\u9762\u677F" style="touch-action:none">
|
|
21
|
-
<div class="debug-console__row">
|
|
22
|
-
<span class="debug-console__counter" title="\u65E5\u5FD7" data-count="log"><img class="debug-console__count-icon" alt="\u65E5\u5FD7" width="16" height="16" src="${iconUrl("log")}"><span class="debug-console__count-label">0</span></span>
|
|
23
|
-
<span class="debug-console__counter" title="\u8B66\u544A" data-count="warn"><img class="debug-console__count-icon" alt="\u8B66\u544A" width="16" height="16" src="${iconUrl("warning")}"><span class="debug-console__count-label">0</span></span>
|
|
24
|
-
<span class="debug-console__counter" title="\u9519\u8BEF" data-count="error"><img class="debug-console__count-icon" alt="\u9519\u8BEF" width="16" height="16" src="${iconUrl("error")}"><span class="debug-console__count-label">0</span></span>
|
|
25
|
-
<button class="debug-console__icon-button debug-console__repair-button" type="button" title="\u4FEE\u590D\uFF1A\u63D2\u5165\u8C03\u8BD5\u65E5\u5FD7\u5230\u5BF9\u8BDD" aria-label="\u4FEE\u590D\uFF1A\u63D2\u5165\u8C03\u8BD5\u65E5\u5FD7\u5230\u5BF9\u8BDD"><img alt="" width="20" height="20" src="${iconUrl("copy")}"><span>\u4FEE\u590D</span></button>
|
|
26
|
-
</div>
|
|
27
|
-
<button class="debug-console__icon-button debug-console__close-button" type="button" title="\u5173\u95ED\u8C03\u8BD5\u9762\u677F" aria-label="\u5173\u95ED\u8C03\u8BD5\u9762\u677F"><img alt="" width="24" height="24" src="${iconUrl("close")}"></button>
|
|
28
|
-
</div>`;const bar=root.querySelector(".debug-console");const logCount=root.querySelector('[data-count="log"] .debug-console__count-label');const warnCount=root.querySelector('[data-count="warn"] .debug-console__count-label');const errorCount=root.querySelector('[data-count="error"] .debug-console__count-label');const send=root.querySelector(".debug-console__repair-button");const close=root.querySelector(".debug-console__close-button");let dragPointerId=null;let dragging=false;let suppressClickUntil=0;let dragStartX=0;let dragStartY=0;let dragOffsetX=0;let dragOffsetY=0;let dismissed=false;const flashCopy=__name((ok,title)=>{const oldTitle=send.title;send.title=title;send.classList.remove("is-copy-ok","is-copy-fail");void send.offsetWidth;send.classList.add(ok?"is-copy-ok":"is-copy-fail");win.setTimeout(()=>{send.classList.remove("is-copy-ok","is-copy-fail");send.title=oldTitle},260)},"flashCopy");const copyLogs=__name(async()=>{if(history.length===0){flashCopy(false,"\u6CA1\u6709\u53EF\u590D\u5236\u7684\u65E5\u5FD7");return}const text=bridge.exportLogs();let ok=bridge.sendLogsToParent();try{if(win.navigator?.clipboard?.writeText&&win.isSecureContext){await win.navigator.clipboard.writeText(text);ok=true}else ok=copyWithTextarea(doc,text)||ok}catch{ok=copyWithTextarea(doc,text)||ok}flashCopy(ok,ok?"\u5DF2\u590D\u5236/\u5DF2\u53D1\u9001\u65E5\u5FD7":"\u590D\u5236\u5931\u8D25")},"copyLogs");const updatePanel=__name(()=>{const warn=history.filter(entry=>entry.level==="warn").length;const error=history.filter(entry=>entry.level==="error").length;const log=history.length-warn-error;logCount.textContent=String(log);warnCount.textContent=String(warn);errorCount.textContent=String(error);if(log+warn+error>0)dismissed=false;panel.style.visibility=dismissed?"hidden":"visible"},"updatePanel");send.addEventListener("click",()=>{if(Date.now()>=suppressClickUntil)void copyLogs()});close.addEventListener("click",event=>{event.stopPropagation();dismissed=true;bridge.clearLogs()});bar.addEventListener("pointerdown",event=>{if(event.button!==0||dragPointerId!==null)return;if(event.target?.closest?.(".debug-console__close-button"))return;dragPointerId=event.pointerId;dragStartX=event.clientX;dragStartY=event.clientY;const rect=panel.getBoundingClientRect();dragOffsetX=event.clientX-rect.left;dragOffsetY=event.clientY-rect.top});listen(win,"pointermove",event=>{if(event.pointerId!==dragPointerId)return;const dx=event.clientX-dragStartX;const dy=event.clientY-dragStartY;if(!dragging){if(Math.hypot(dx,dy)<=2)return;dragging=true;suppressClickUntil=Date.now()+350;bar.setPointerCapture?.(event.pointerId)}event.preventDefault();const rect=panel.getBoundingClientRect();const maxLeft=Math.max(0,win.innerWidth-rect.width);const maxTop=Math.max(0,win.innerHeight-rect.height);panel.style.left=`${Math.min(Math.max(0,event.clientX-dragOffsetX),maxLeft)}px`;panel.style.top=`${Math.min(Math.max(0,event.clientY-dragOffsetY),maxTop)}px`;panel.style.right="auto";panel.style.bottom="auto"});const endDrag=__name(event=>{if(event.pointerId!==dragPointerId)return;if(dragging){suppressClickUntil=Date.now()+350;bar.releasePointerCapture?.(event.pointerId)}dragPointerId=null;dragging=false},"endDrag");listen(win,"pointerup",endDrag);listen(win,"pointercancel",endDrag);doc.body.append(panel);updatePanel();return{panel,updatePanel}}__name(mountDebugConsole,"mountDebugConsole");var BRIDGE_KEY=Symbol.for("@game-runtime/platform/v1");var CONSOLE_METHODS=["log","info","debug","warn","error"];var IGNORE_ATTRIBUTE="data-game-runtime-ignore";var bounded=__name((value,fallback,min,max)=>Number.isFinite(value)?Math.max(min,Math.min(max,value)):fallback,"bounded");var messageOf=__name(error=>{try{return error?.stack||error?.message||String(error)}catch{return"[unreadable error]"}},"messageOf");var serialize=__name(value=>{if(typeof value==="string")return value;if(value instanceof Error)return messageOf(value);const seen=new WeakSet;try{return JSON.stringify(value,(_key,item)=>{if(typeof item==="bigint")return`${item}n`;if(typeof item==="object"&&item!==null){if(seen.has(item))return"[Circular]";seen.add(item)}return item})??String(value)}catch{return"[unserializable value]"}},"serialize");function startPlatform(options={}){const win=typeof window==="undefined"?void 0:window;if(!win?.document)throw new Error("startPlatform requires a browser window");if(win[BRIDGE_KEY]&&!win[BRIDGE_KEY].disposed)return win[BRIDGE_KEY];const doc=win.document;const settings={preview:options.preview??new URLSearchParams(win.location?.search||"").has("preview"),targetOrigin:options.targetOrigin||"*",resultDelayMs:bounded(options.resultDelayMs,3e3,0,6e4),captureTimeoutMs:bounded(options.captureTimeoutMs,4e3,1,3e4),maxLogs:bounded(options.maxLogs,500,1,5e3),maxLogChars:bounded(options.maxLogChars,2e5,1e3,2e6),showLogPanel:options.showLogPanel!==false};const history=[];const connections=new Map;const cleanups=[];const pending=new Set;const assetCache=new Map;let historyChars=0;let disposed=false;let result=1;let resultReported=false;let resultTimer;let notifiedReady=false;let active;let panel;let updatePanel=__name(()=>{},"updatePanel");const listen=__name((target,type,callback,capture=false)=>{target.addEventListener(type,callback,capture);cleanups.push(()=>target.removeEventListener(type,callback,capture))},"listen");const post=__name((payload,target=win.parent,origin=settings.targetOrigin)=>{if(disposed||!target||target===win)return;try{target.postMessage(payload,origin)}catch{}},"post");const armResult=__name(()=>{if(resultReported||resultTimer!==void 0||disposed)return;resultTimer=win.setTimeout(()=>{resultTimer=void 0;if(disposed||resultReported)return;resultReported=true;post({type:"runtime-result",data:result});record("info",`postMessage runtime-result result=${result}`,"platform")},settings.resultDelayMs)},"armResult");const signalError=__name((crash=false)=>{if(!resultReported){if(crash)result=2;else if(result!==2)result=0;armResult()}},"signalError");const record=__name((level,message,source="console")=>{if(disposed)return;const entry={time:Date.now(),level,message:String(message).slice(0,8e3),source};history.push(entry);historyChars+=entry.message.length;while(history.length>settings.maxLogs||historyChars>settings.maxLogChars){historyChars-=history.shift().message.length}updatePanel()},"record");const consoleObject=win.console;for(const method of CONSOLE_METHODS){const original=consoleObject?.[method];if(typeof original!=="function")continue;const wrapped=__name(function(...args){if(!disposed){record(method==="log"?"info":method,args.map(serialize).join(" "));if(method==="error")signalError()}return Reflect.apply(original,consoleObject,args)},"wrapped");try{consoleObject[method]=wrapped;cleanups.push(()=>{if(consoleObject[method]===wrapped)consoleObject[method]=original})}catch{}}listen(win,"error",event=>{const target=event.target;const detail=event.error?messageOf(event.error):event.message||`Resource failed: ${target?.src||target?.href||target?.tagName||"unknown"}`;record("error",detail,"window.error");signalError()},true);listen(win,"unhandledrejection",event=>{record("error",serialize(event.reason),"unhandledrejection");signalError()});const seenWebglEvents=new WeakSet;const handleWebgl=__name(event=>{if(seenWebglEvents.has(event))return;seenWebglEvents.add(event);const restored=event.type==="webglcontextrestored";record(restored?"warn":"error",`${event.type}: ${event.statusMessage||"no details"}`,"webgl");if(!restored)signalError(true)},"handleWebgl");for(const type of["webglcontextlost","webglcontextcreationerror","webglcontextrestored"]){listen(doc,type,handleWebgl,true)}const finishCapture=__name((ticket,response)=>{if(!pending.has(ticket))return;pending.delete(ticket);ticket.connection?.requests.delete(ticket);win.clearTimeout(ticket.timer);ticket.abort.abort();if(!disposed)post({type:"screenshot-response",...ticket.id,...response},ticket.source,ticket.origin);ticket.resolve?.(response)},"finishCapture");const cancelCapture=__name(ticket=>{pending.delete(ticket);ticket.connection?.requests.delete(ticket);win.clearTimeout(ticket.timer);ticket.abort.abort();ticket.resolve?.({ok:false,error:"Preview disposed"})},"cancelCapture");const captureFrame=__name(connection=>{for(const ticket of[...connection.requests]){connection.requests.delete(ticket);if(!pending.has(ticket))continue;try{const canvas=connection.canvas;if(!(canvas.width>0&&canvas.height>0))throw new Error("Canvas has no drawable size");const canvasRect=canvas.getBoundingClientRect();const snapshotNotes=[];let roots=[];try{roots=findUiRoots(canvas,connection.options.uiRoot,win)}catch(error){snapshotNotes.push(`UI roots unavailable: ${messageOf(error)}`)}const videos=collectPaintVideos(canvas,roots);const frameRect=unionCaptureRect(canvasRect,[...roots,...videos]);const scaleX=canvas.width/(canvasRect.width||canvas.width);const scaleY=canvas.height/(canvasRect.height||canvas.height);const canvasCopy=doc.createElement("canvas");canvasCopy.width=canvas.width;canvasCopy.height=canvas.height;const canvasContext=canvasCopy.getContext("2d");if(!canvasContext)throw new Error("Screenshot 2D context unavailable");canvasContext.drawImage(canvas,0,0);const base=canvasCopy.toDataURL("image/png");if(!base.startsWith("data:image/"))throw new Error("Canvas snapshot is empty");const copy=doc.createElement("canvas");copy.width=Math.max(1,Math.round(frameRect.width*scaleX));copy.height=Math.max(1,Math.round(frameRect.height*scaleY));const context=copy.getContext("2d");if(!context)throw new Error("Screenshot 2D context unavailable");const fill=captureBackground(canvas,win);if(fill){context.fillStyle=fill;context.fillRect(0,0,copy.width,copy.height)}context.drawImage(canvas,(canvasRect.left-frameRect.left)*scaleX,(canvasRect.top-frameRect.top)*scaleY);try{paintVideos(copy,canvas,roots,win,snapshotNotes)}catch(error){snapshotNotes.push(`video overlay omitted: ${messageOf(error)}`)}let uiTree=null;try{uiTree=captureTree(canvas,roots,win)}catch(error){record("warn",messageOf(error),"ui-tree")}ticket.baseResponse={data:base,composited:false,uiTree};const layers=[];for(const root of roots){if(root.tagName==="VIDEO")continue;try{layers.push(snapshotLayer(root,canvas,win,frameRect))}catch(error){snapshotNotes.push(`UI snapshot unavailable: ${messageOf(error)}`)}}void composeSnapshot(copy,base,layers,win,ticket.abort.signal,assetCache).then(composite=>finishCapture(ticket,{ok:true,...finishCanvasOverlays(copy,canvas,roots,win,snapshotNotes,composite),uiTree,...snapshotNotes.length?{note:[...snapshotNotes,composite.note].filter(Boolean).join("; ").slice(0,2e3)}:{}}),error=>finishCapture(ticket,{ok:false,error:messageOf(error)}))}catch(error){record("warn",messageOf(error),"screenshot");finishCapture(ticket,{ok:false,error:messageOf(error)})}}},"captureFrame");const requestCapture=__name((source,origin,requestId,resolve)=>{const id=typeof requestId==="string"||typeof requestId==="number"?{requestId}:{};if(!active||active.disposed||pending.size>=4){const response={ok:false,error:!active?"No canvas registered":"Screenshot queue is full"};post({type:"screenshot-response",...id,...response},source,origin);resolve?.(response);return}const connection=active;const ticket={id,source,origin,connection,abort:new AbortController,resolve};ticket.timer=win.setTimeout(()=>{finishCapture(ticket,ticket.baseResponse?{ok:true,...ticket.baseResponse,note:"DOM composition timed out; returned the captured canvas frame"}:{ok:false,error:"Screenshot timed out waiting for a rendered frame"})},settings.captureTimeoutMs);pending.add(ticket);connection.requests.add(ticket);if(connection.options.renderForCapture){try{const returned=connection.options.renderForCapture();if(returned&&typeof returned.then==="function"){Promise.resolve(returned).catch(()=>{});throw new Error("renderForCapture must render synchronously; call afterRender for asynchronous rendering")}connection.handle.afterRender()}catch(error){finishCapture(ticket,{ok:false,error:messageOf(error)})}}},"requestCapture");listen(win,"message",event=>{if(event.source!==win.parent||event.data?.type!=="screenshot-request")return;if(settings.targetOrigin!=="*"&&event.origin!==settings.targetOrigin)return;requestCapture(event.source,settings.targetOrigin==="*"?"*":event.origin,event.data.requestId)});const bridge={get disposed(){return disposed},getLogs:__name(()=>history.map(entry=>({...entry})),"getLogs"),exportLogs:__name(()=>history.map(entry=>`[${new Date(entry.time).toISOString()}] [${entry.level}] [${entry.source}] ${entry.message}`).join("\n"),"exportLogs"),clearLogs(){history.length=0;historyChars=0;updatePanel()},sendLogsToParent(){if(disposed||win.parent===win||history.length===0)return false;post({type:"runtime-log",data:{message:bridge.exportLogs(),count:history.length}});return true},capture(){if(disposed)return Promise.resolve({ok:false,error:"Preview disposed"});return new Promise(resolve=>requestCapture(win,"*",void 0,resolve))},captureUiTree(){if(!active||disposed)return null;return captureTree(active.canvas,findUiRoots(active.canvas,active.options.uiRoot,win),win)},connect(canvas,connectionOptions={}){if(disposed)throw new Error("Platform bridge is disposed; call startPlatform again");if(canvas?.tagName!=="CANVAS"||typeof canvas.getContext!=="function"){throw new TypeError("connectPreview expects an HTMLCanvasElement")}if(canvas.ownerDocument!==doc)throw new Error("Canvas must belong to the platform window");if(connections.has(canvas))return connections.get(canvas).handle;const connection={canvas,options:connectionOptions,requests:new Set,rendered:false,ready:false,disposed:false};const notifyReady=__name(()=>{if(disposed||connection.disposed||!connection.ready||!connection.rendered||notifiedReady)return;notifiedReady=true;post({type:"onloadend"});post({type:"ready"});record("info","postMessage onloadend (canvas ready)","platform")},"notifyReady");const types=["webglcontextlost","webglcontextcreationerror","webglcontextrestored"];for(const type of types)canvas.addEventListener(type,handleWebgl);connection.handle={afterRender(){if(disposed||connection.disposed)return;connection.rendered=true;armResult();notifyReady();captureFrame(connection)},markReady(){if(disposed||connection.disposed)return;connection.ready=true;notifyReady()},dispose(){if(connection.disposed)return;connection.disposed=true;for(const type of types)canvas.removeEventListener(type,handleWebgl);for(const ticket of[...pending])if(ticket.connection===connection)cancelCapture(ticket);connections.delete(canvas);if(active===connection)active=[...connections.values()].at(-1);if(connections.size===0)bridge.dispose()}};connections.set(canvas,connection);active=connection;return connection.handle},dispose(){if(disposed)return;disposed=true;if(resultTimer!==void 0)win.clearTimeout(resultTimer);for(const ticket of[...pending])cancelCapture(ticket);for(const connection of[...connections.values()])connection.handle.dispose();for(const cleanup of cleanups.reverse())cleanup();panel?.remove();assetCache.clear();updatePanel=__name(()=>{},"updatePanel");if(win[BRIDGE_KEY]===bridge)delete win[BRIDGE_KEY]}};win[BRIDGE_KEY]=bridge;listen(win,"pagehide",()=>bridge.dispose());const mountPanel=__name(()=>{if(disposed||panel||!doc.body||!settings.preview||!settings.showLogPanel)return;const mounted=mountDebugConsole({doc,win,listen,ignoreAttribute:IGNORE_ATTRIBUTE,history,bridge});panel=mounted.panel;updatePanel=mounted.updatePanel},"mountPanel");if(doc.body)mountPanel();else listen(doc,"DOMContentLoaded",mountPanel);return bridge}__name(startPlatform,"startPlatform");function connectPreview(canvas,options={}){return startPlatform(options).connect(canvas,options)}__name(connectPreview,"connectPreview");function captureBackground(canvas,win){const node=canvas.parentElement||canvas.ownerDocument.body;if(!node)return"";const color=win.getComputedStyle(node).backgroundColor;if(color&&color!=="transparent"&&color!=="rgba(0, 0, 0, 0)")return color;const body=canvas.ownerDocument.body;if(!body||body===node)return color||"";return win.getComputedStyle(body).backgroundColor||""}__name(captureBackground,"captureBackground");function findUiRoots(canvas,configured,win){if(configured===null||configured===false)return[];const doc=canvas.ownerDocument;const candidates=configured!==void 0?Array.isArray(configured)?configured:[configured]:[doc.getElementById("ui-root"),...Array.from(canvas.parentElement?.children||[])];const roots=[];for(const candidate of candidates){const root=typeof candidate==="string"?doc.querySelector(candidate):candidate;if(!root||root===canvas||root.nodeType!==1||root.hasAttribute(IGNORE_ATTRIBUTE))continue;if(["SCRIPT","STYLE","LINK","CANVAS","VIDEO"].includes(root.tagName))continue;if(roots.some(existing=>existing===root||existing.contains(root)))continue;const style=win.getComputedStyle(root);const rect=root.getBoundingClientRect();if(style.display==="none"||style.visibility==="hidden"||Number(style.opacity)===0||!rect.width||!rect.height)continue;for(let index=roots.length-1;index>=0;index--)if(root.contains(roots[index]))roots.splice(index,1);roots.push(root)}return roots}__name(findUiRoots,"findUiRoots");function snapshotLayer(root,canvas,win,frameRect){const rect=root.getBoundingClientRect();const canvasRect=canvas.getBoundingClientRect();frameRect=frameRect||unionCaptureRect(canvasRect,[root]);const clone=root.cloneNode(true);const originals=[root,...root.querySelectorAll("*")];const copies=[clone,...clone.querySelectorAll("*")];const resources=[];const notes=[];for(let index=0;index<originals.length;index++){const src=originals[index];const dst=copies[index];if(!dst?.style)continue;if(src===canvas||src.hasAttribute(IGNORE_ATTRIBUTE)||["SCRIPT","STYLE","LINK","IFRAME","VIDEO","CANVAS"].includes(src.tagName)){if(["IFRAME","VIDEO"].includes(src.tagName)&&src!==canvas)notes.push(`${src.tagName.toLowerCase()} overlay omitted`);dst.remove();continue}const style=win.getComputedStyle(src);for(let i=0;i<style.length;i++){const property=style[i];dst.style.setProperty(property,style.getPropertyValue(property),"important")}dst.style.setProperty("animation","none","important");dst.style.setProperty("transition","none","important");for(const attr of[...dst.attributes])if(/^on/i.test(attr.name))dst.removeAttribute(attr.name);if(src.tagName==="IMG"){dst.removeAttribute("srcset");resources.push({node:dst,attr:"src",value:src.currentSrc||src.src})}if(src.tagName==="INPUT")dst.setAttribute("value",src.value);if(src.tagName==="TEXTAREA")dst.textContent=src.value;if(src.tagName==="OPTION")src.selected?dst.setAttribute("selected",""):dst.removeAttribute("selected");for(const property of["background-image","border-image-source","mask-image","-webkit-mask-image"]){const value=style.getPropertyValue(property);if(value?.includes("url("))resources.push({node:dst,property,value})}}const scaleX=rect.width/(root.offsetWidth||rect.width);const scaleY=rect.height/(root.offsetHeight||rect.height);for(const[property,value]of Object.entries({position:"absolute",left:"0px",top:"0px",right:"auto",bottom:"auto",margin:"0px",transform:"none","transform-origin":"0 0"})){clone.style.setProperty(property,value,"important")}let css="";for(const sheet of[...root.ownerDocument.styleSheets]){try{css+=[...sheet.cssRules].map(rule=>rule.cssText).join("\n")}catch{notes.push("cross-origin stylesheet unavailable")}}return{clone,resources,notes,css,width:frameRect.width||canvasRect.width||canvas.width,height:frameRect.height||canvasRect.height||canvas.height,left:rect.left-frameRect.left,top:rect.top-frameRect.top,scaleX,scaleY}}__name(snapshotLayer,"snapshotLayer");async function composeSnapshot(copy,base,layers,win,signal,cache){if(!layers.length)return{data:base,composited:false,note:"No DOM UI overlay"};let composited=false;const notes=[];for(const layer of layers){if(signal.aborted)throw new Error("Screenshot cancelled");try{const image=await rasterizeLayer(layer,win,signal,cache);copy.getContext("2d").drawImage(image,0,0,copy.width,copy.height);composited=true;notes.push(...layer.notes)}catch(error){if(signal.aborted)throw error;notes.push(messageOf(error))}}try{return{data:composited?copy.toDataURL("image/png"):base,composited,...notes.length?{note:notes.join("; ").slice(0,2e3)}:{}}}catch(error){return{data:base,composited:false,note:`DOM composite unavailable: ${messageOf(error)}`}}}__name(composeSnapshot,"composeSnapshot");async function rasterizeLayer(layer,win,signal,cache){for(const resource of layer.resources){if(signal.aborted)throw new Error("Screenshot cancelled");if(resource.attr){try{resource.node.setAttribute(resource.attr,await inlineAsset(resource.value,win,signal,cache))}catch(error){resource.node.removeAttribute(resource.attr);layer.notes.push(`UI image omitted: ${messageOf(error)}`)}}else{let value=resource.value;for(const match of resource.value.matchAll(/url\(\s*(['"]?)(.*?)\1\s*\)/g)){try{value=value.replace(match[0],`url("${await inlineAsset(match[2],win,signal,cache)}")`)}catch(error){value=value.replace(match[0],"none");layer.notes.push(`UI background omitted: ${messageOf(error)}`)}}resource.node.style.setProperty(resource.property,value,"important")}}layer.clone.setAttribute("xmlns","http://www.w3.org/1999/xhtml");const serialized=new win.XMLSerializer().serializeToString(layer.clone);const css=`${layer.css}
|
|
29
|
-
*,*::before,*::after{animation:none!important;transition:none!important}`.replace(/]]>/g,"]]]]><![CDATA[>");const svg=`<svg xmlns="http://www.w3.org/2000/svg" width="${layer.width}" height="${layer.height}"><foreignObject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml" style="position:relative;width:${layer.width}px;height:${layer.height}px;overflow:hidden"><style><![CDATA[${css}]]></style><div style="position:absolute;left:${layer.left}px;top:${layer.top}px;transform:scale(${layer.scaleX},${layer.scaleY});transform-origin:0 0">${serialized}</div></div></foreignObject></svg>`;return new Promise((resolve,reject)=>{const image=new win.Image;const cleanup=__name(()=>{signal.removeEventListener("abort",abort);image.onload=null;image.onerror=null},"cleanup");const abort=__name(()=>{cleanup();image.src="";reject(new Error("Screenshot cancelled"))},"abort");signal.addEventListener("abort",abort,{once:true});image.onload=()=>{cleanup();resolve(image)};image.onerror=()=>{cleanup();reject(new Error("DOM UI rasterization failed"))};if(signal.aborted)abort();else image.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`})}__name(rasterizeLayer,"rasterizeLayer");async function inlineAsset(source,win,signal,cache){if(!source)throw new Error("empty URL");if(source.startsWith("data:"))return source;const url=new URL(source,win.document.baseURI).href;if(cache.has(url))return cache.get(url);const response=await win.fetch(url,{signal,credentials:"same-origin",cache:"force-cache"});if(!response.ok)throw new Error(`asset HTTP ${response.status}`);const blob=await response.blob();if(blob.size>5*1024*1024)throw new Error("UI asset exceeds 5 MiB");const data=await new Promise((resolve,reject)=>{const reader=new win.FileReader;const abort=__name(()=>{reader.abort();reject(new Error("Screenshot cancelled"))},"abort");const cleanup=__name(()=>signal.removeEventListener("abort",abort),"cleanup");reader.onload=()=>{cleanup();resolve(String(reader.result))};reader.onerror=()=>{cleanup();reject(new Error("UI asset read failed"))};reader.onabort=()=>{cleanup();reject(new Error("Screenshot cancelled"))};signal.addEventListener("abort",abort,{once:true});if(signal.aborted)abort();else reader.readAsDataURL(blob)});if(data.length<2e5&&cache.size<32)cache.set(url,data);return data}__name(inlineAsset,"inlineAsset");function captureTree(canvas,roots,win){if(!roots.length)return null;const canvasRect=canvas.getBoundingClientRect();const rect=unionCaptureRect(canvasRect,roots);const scaleX=canvas.width/(canvasRect.width||canvas.width);const scaleY=canvas.height/(canvasRect.height||canvas.height);const round=__name(value=>Math.round(value*100)/100,"round");const tree={design:{width:Math.max(1,Math.round(rect.width*scaleX)),height:Math.max(1,Math.round(rect.height*scaleY))},scale:round(1/scaleX),nodeCount:0,truncated:false,hiddenSkipped:0,issues:[],layers:[]};const walk=__name((element,depth,parent)=>{if(element===canvas||element.hasAttribute(IGNORE_ATTRIBUTE))return null;const style=win.getComputedStyle(element);if(style.display==="none"||style.visibility==="hidden"||Number(style.opacity)===0){tree.hiddenSkipped++;return null}if(tree.nodeCount>=300){tree.truncated=true;return null}tree.nodeCount++;const bounds=element.getBoundingClientRect();const node={desc:`${element.tagName.toLowerCase()}${element.id?`#${element.id}`:""}${[...element.classList].map(name=>`.${name}`).join("")}`,rect:{x:round((bounds.left-rect.left)*scaleX),y:round((bounds.top-rect.top)*scaleY),w:round(bounds.width*scaleX),h:round(bounds.height*scaleY)}};const text=[...element.childNodes].filter(child=>child.nodeType===3).map(child=>child.textContent).join("").trim();if(text)node.text=text.slice(0,256);if(style.overflowX!=="visible"||style.overflowY!=="visible")node.overflow=`${style.overflowX} ${style.overflowY}`;const layer=Number.parseInt(element.dataset?.layer,10);if(Number.isFinite(layer))node.layer=layer;if(parent&&!parent.overflow&&tree.issues.length<20){const a=parent.rect;const b=node.rect;if(a.w>0&&a.h>0&&(b.x<a.x-1||b.y<a.y-1||b.x+b.w>a.x+a.w+1||b.y+b.h>a.y+a.h+1)){tree.issues.push(`overflow: ${node.desc} exceeds ${parent.desc}`)}}if(depth>=12){if(element.children.length)tree.truncated=true}else{const children=[...element.children].map(child=>walk(child,depth+1,node)).filter(Boolean);if(children.length)node.children=children}return node},"walk");tree.layers=roots.map(root=>walk(root,0,null)).filter(Boolean);return tree}__name(captureTree,"captureTree");export{connectPreview,startPlatform};
|
|
1
|
+
import { paintVideos, unionCaptureRect, collectPaintVideos, finishCanvasOverlays } from './platform-capture-video.mjs';
|
|
2
|
+
var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:true});var DEBUG_ICONS={"close":"iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAACUBJREFUeAG9WWtsXNURnvvYXWe9fuLFcXHIOnGjxFZaVU6QElWqVYSUPqWqMVIqJPpwKrVV/5SqVCXKgyLEI+QvSMkPEAEkDAICCIRAxH8wD/tHBDYgBbzBhoisZTuJvY5374OZs+ccz969u951HEYa3+u95/HNnJlz5swArDP5vm8oxn8N9sngbYLtYY1Uc0eaDMmX74VBDKPiWLKd6Kh+gnUis5pGSkNMU0K7CrjStgRqMDZlO5OY3o8cOWIE2vAx9XzXsyolwBkVCSABEluSbckRzn19ffx/+m4NDAxQe1POYUJgBddFgLABpZY5cAU4ihzr7u6O4bNO8gb+TKVS9B7r6emJcmEkm+VAV1qRqkwImLkoU6C+CMRCwEKIzs5O8bx8+bICFmlra7MZUHtxcdFub2+3JyYmqL0AT2PAiqmRianxDTa5r/xuVSpn73ISq7+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2kAQ/lZ+wI+UgDugBOEGkrwlMBmgAuMKgAqwK4BMDH60KwhyBSEVRB2YtxjPSJs96ThO/IgTP/5mNNKdTnvf7u1+dwKOAA/9srpwBAgHgB99Xz7tMsPXXTOK+Ja+BwEKojCBaOJ3CDTYboxbVA9+oAAKERDPK8z01+qa63u6DIw5vfMVtYO5o0l4KASva9EJaCGTySWNWdJFKMeX3gAF4ByBde+TydtBmLwbyruS9S7imms+uEeA6clMAL5bTp605Vn1maEX6DpadSPAY7/FQFU3QyxwvzFogT5MTpDPP1WlnIoAkfGIOOu96ZfEI6JVFDxyyoW9BJT3cqvoZkiN4H7n4LdYvUujQKhGD34He5CbhDrxpksCdp2rd9IzVLWHN3xZll6yXKT64VSWuRGIY68F2/usyDSVEgpBHyV8Mh41gpHcAu1eGZe4yZtjJwHlIRGv1t7DZzhCyrBv7MTUydsvciKwEh1mHtHX6R+4Ekg1IEgbEoWS1y1EIF17bplB7+ijIKRabo09cEdyo+pMIE0u/bHyfkvZ7SXQCGYZcSIMnAgkWbzaZsNDvDdwEKdNAlnROch78/26OG2R6AyBLaKz23uC25Zri5OKwsRvbiWQJJ7tPbiXa/gflCYEMvJZQv2ya5iKAsdWWTLd2WVplDAaX/esug+9+vQKJ0Q8qf2G3tBknh59S6ObENjY6wGf6tOXPIOpFKMbSxA9xH0xGOaOlwTki0TWMxKtl2BNdPZMno6jJ7lakqiqaob7xu8SJ+8I0alY5p2O5hmJVuIkc3sb3juWnZ1YEoVnl29UFFRpr4zghiQ5XqFPtfY5z4mEzuYip+DkZ6ZEr7oZKgK8bJw683fBmhMeqTNeiko09ns4I5T3qtytrhnx47X8Yu0RnTMhOWGph+ihNpIDRxMfCGIaUeNX2yihPsspEhWcFSz/EBgV/Yc8G/4DVxF6DgaK+k4AAAAASUVORK5CYII="};var iconUrl=__name(key=>DEBUG_ICONS[key]?`data:image/png;base64,${DEBUG_ICONS[key]}`:"","iconUrl");function copyWithTextarea(doc,text){const textarea=doc.createElement("textarea");textarea.value=text;textarea.setAttribute("readonly","true");textarea.style.cssText="position:fixed;left:-9999px;top:0";doc.body.appendChild(textarea);textarea.focus();textarea.select();let ok=false;try{ok=doc.execCommand("copy")}catch{ok=false}textarea.remove();return ok}__name(copyWithTextarea,"copyWithTextarea");function mountDebugConsole({doc,win,listen,ignoreAttribute,history,bridge}){const panel=doc.createElement("div");panel.setAttribute(ignoreAttribute,"");panel.style.cssText="position:fixed;left:8px;bottom:20px;z-index:2147483647";const root=panel.attachShadow({mode:"open"});root.innerHTML=`<style>
|
|
3
|
+
.debug-console{position:relative;box-sizing:border-box;display:inline-flex;align-items:center;min-width:205px;min-height:36px;padding:5px 8px;border-radius:12px;background:rgba(31,15,20,.92);border:1px solid rgba(128,46,56,.85);color:rgb(242,242,242);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif;font-size:17px;line-height:1;user-select:none;-webkit-user-select:none;cursor:grab}
|
|
4
|
+
.debug-console__row{display:inline-flex;align-items:center;gap:9px}
|
|
5
|
+
.debug-console__counter{display:inline-flex;align-items:center;gap:2px}
|
|
6
|
+
.debug-console__count-icon{display:block;width:16px;height:16px;object-fit:contain}
|
|
7
|
+
.debug-console__count-label{min-width:14px;color:rgb(242,242,242);font-size:17px;font-variant-numeric:tabular-nums}
|
|
8
|
+
.debug-console__icon-button{display:inline-flex;align-items:center;justify-content:center;margin:0;padding:0;border:none;cursor:pointer;-webkit-tap-highlight-color:transparent}
|
|
9
|
+
.debug-console__repair-button{position:relative;box-sizing:border-box;width:64px;height:28px;gap:2px;padding:0;overflow:hidden;color:rgb(242,242,242);font:inherit;font-size:16px;line-height:1;white-space:nowrap;flex-wrap:nowrap;background:transparent}
|
|
10
|
+
.debug-console__repair-button::before{content:'';position:absolute;inset:0;box-sizing:border-box;border:12px solid transparent;border-image-source:url("${iconUrl("repairButtonNormal")}");border-image-slice:12 fill;border-image-width:12px;border-image-repeat:stretch;pointer-events:none}
|
|
11
|
+
.debug-console__repair-button:hover::before{border-image-source:url("${iconUrl("repairButtonHover")}")}
|
|
12
|
+
.debug-console__repair-button:active::before{border-image-source:url("${iconUrl("repairButtonPressed")}")}
|
|
13
|
+
.debug-console__repair-button img{position:relative;z-index:1;display:block;width:20px;height:20px;flex:0 0 auto}
|
|
14
|
+
.debug-console__repair-button span{position:relative;z-index:1;display:block;color:rgb(242,242,242);font-size:16px;line-height:1;white-space:nowrap;flex:0 0 auto}
|
|
15
|
+
.debug-console__close-button{position:absolute;top:-16px;right:-18px;width:24px;height:24px;background:transparent}
|
|
16
|
+
.debug-console__close-button img{display:block;width:24px;height:24px}
|
|
17
|
+
.debug-console__repair-button.is-copy-ok{filter:drop-shadow(0 0 4px rgba(77,219,117,.9))}
|
|
18
|
+
.debug-console__repair-button.is-copy-fail{filter:drop-shadow(0 0 4px rgba(255,89,102,.9))}
|
|
19
|
+
</style>
|
|
20
|
+
<div class="debug-console" title="\u6309\u4F4F\u5E76\u79FB\u52A8\u53EF\u62D6\u52A8\u8C03\u8BD5\u9762\u677F" style="touch-action:none">
|
|
21
|
+
<div class="debug-console__row">
|
|
22
|
+
<span class="debug-console__counter" title="\u65E5\u5FD7" data-count="log"><img class="debug-console__count-icon" alt="\u65E5\u5FD7" width="16" height="16" src="${iconUrl("log")}"><span class="debug-console__count-label">0</span></span>
|
|
23
|
+
<span class="debug-console__counter" title="\u8B66\u544A" data-count="warn"><img class="debug-console__count-icon" alt="\u8B66\u544A" width="16" height="16" src="${iconUrl("warning")}"><span class="debug-console__count-label">0</span></span>
|
|
24
|
+
<span class="debug-console__counter" title="\u9519\u8BEF" data-count="error"><img class="debug-console__count-icon" alt="\u9519\u8BEF" width="16" height="16" src="${iconUrl("error")}"><span class="debug-console__count-label">0</span></span>
|
|
25
|
+
<button class="debug-console__icon-button debug-console__repair-button" type="button" title="\u4FEE\u590D\uFF1A\u63D2\u5165\u8C03\u8BD5\u65E5\u5FD7\u5230\u5BF9\u8BDD" aria-label="\u4FEE\u590D\uFF1A\u63D2\u5165\u8C03\u8BD5\u65E5\u5FD7\u5230\u5BF9\u8BDD"><img alt="" width="20" height="20" src="${iconUrl("copy")}"><span>\u4FEE\u590D</span></button>
|
|
26
|
+
</div>
|
|
27
|
+
<button class="debug-console__icon-button debug-console__close-button" type="button" title="\u5173\u95ED\u8C03\u8BD5\u9762\u677F" aria-label="\u5173\u95ED\u8C03\u8BD5\u9762\u677F"><img alt="" width="24" height="24" src="${iconUrl("close")}"></button>
|
|
28
|
+
</div>`;const bar=root.querySelector(".debug-console");const logCount=root.querySelector('[data-count="log"] .debug-console__count-label');const warnCount=root.querySelector('[data-count="warn"] .debug-console__count-label');const errorCount=root.querySelector('[data-count="error"] .debug-console__count-label');const send=root.querySelector(".debug-console__repair-button");const close=root.querySelector(".debug-console__close-button");let dragPointerId=null;let dragging=false;let suppressClickUntil=0;let dragStartX=0;let dragStartY=0;let dragOffsetX=0;let dragOffsetY=0;let dismissed=false;const flashCopy=__name((ok,title)=>{const oldTitle=send.title;send.title=title;send.classList.remove("is-copy-ok","is-copy-fail");void send.offsetWidth;send.classList.add(ok?"is-copy-ok":"is-copy-fail");win.setTimeout(()=>{send.classList.remove("is-copy-ok","is-copy-fail");send.title=oldTitle},260)},"flashCopy");const copyLogs=__name(async()=>{if(history.length===0){flashCopy(false,"\u6CA1\u6709\u53EF\u590D\u5236\u7684\u65E5\u5FD7");return}const text=bridge.exportLogs();let ok=bridge.sendLogsToParent();try{if(win.navigator?.clipboard?.writeText&&win.isSecureContext){await win.navigator.clipboard.writeText(text);ok=true}else ok=copyWithTextarea(doc,text)||ok}catch{ok=copyWithTextarea(doc,text)||ok}flashCopy(ok,ok?"\u5DF2\u590D\u5236/\u5DF2\u53D1\u9001\u65E5\u5FD7":"\u590D\u5236\u5931\u8D25")},"copyLogs");const updatePanel=__name(()=>{const warn=history.filter(entry=>entry.level==="warn").length;const error=history.filter(entry=>entry.level==="error").length;const log=history.length-warn-error;logCount.textContent=String(log);warnCount.textContent=String(warn);errorCount.textContent=String(error);if(log+warn+error>0)dismissed=false;panel.style.visibility=dismissed?"hidden":"visible"},"updatePanel");send.addEventListener("click",()=>{if(Date.now()>=suppressClickUntil)void copyLogs()});close.addEventListener("click",event=>{event.stopPropagation();dismissed=true;bridge.clearLogs()});bar.addEventListener("pointerdown",event=>{if(event.button!==0||dragPointerId!==null)return;if(event.target?.closest?.(".debug-console__close-button"))return;dragPointerId=event.pointerId;dragStartX=event.clientX;dragStartY=event.clientY;const rect=panel.getBoundingClientRect();dragOffsetX=event.clientX-rect.left;dragOffsetY=event.clientY-rect.top});listen(win,"pointermove",event=>{if(event.pointerId!==dragPointerId)return;const dx=event.clientX-dragStartX;const dy=event.clientY-dragStartY;if(!dragging){if(Math.hypot(dx,dy)<=2)return;dragging=true;suppressClickUntil=Date.now()+350;bar.setPointerCapture?.(event.pointerId)}event.preventDefault();const rect=panel.getBoundingClientRect();const maxLeft=Math.max(0,win.innerWidth-rect.width);const maxTop=Math.max(0,win.innerHeight-rect.height);panel.style.left=`${Math.min(Math.max(0,event.clientX-dragOffsetX),maxLeft)}px`;panel.style.top=`${Math.min(Math.max(0,event.clientY-dragOffsetY),maxTop)}px`;panel.style.right="auto";panel.style.bottom="auto"});const endDrag=__name(event=>{if(event.pointerId!==dragPointerId)return;if(dragging){suppressClickUntil=Date.now()+350;bar.releasePointerCapture?.(event.pointerId)}dragPointerId=null;dragging=false},"endDrag");listen(win,"pointerup",endDrag);listen(win,"pointercancel",endDrag);doc.body.append(panel);updatePanel();return{panel,updatePanel}}__name(mountDebugConsole,"mountDebugConsole");var BRIDGE_KEY=Symbol.for("@game-runtime/platform/v1");var CONSOLE_METHODS=["log","info","debug","warn","error"];var IGNORE_ATTRIBUTE="data-game-runtime-ignore";var bounded=__name((value,fallback,min,max)=>Number.isFinite(value)?Math.max(min,Math.min(max,value)):fallback,"bounded");var messageOf=__name(error=>{try{return error?.stack||error?.message||String(error)}catch{return"[unreadable error]"}},"messageOf");var serialize=__name(value=>{if(typeof value==="string")return value;if(value instanceof Error)return messageOf(value);const seen=new WeakSet;try{return JSON.stringify(value,(_key,item)=>{if(typeof item==="bigint")return`${item}n`;if(typeof item==="object"&&item!==null){if(seen.has(item))return"[Circular]";seen.add(item)}return item})??String(value)}catch{return"[unserializable value]"}},"serialize");function startPlatform(options={}){const win=typeof window==="undefined"?void 0:window;if(!win?.document)throw new Error("startPlatform requires a browser window");if(win[BRIDGE_KEY]&&!win[BRIDGE_KEY].disposed)return win[BRIDGE_KEY];const doc=win.document;const settings={preview:options.preview??new URLSearchParams(win.location?.search||"").has("preview"),targetOrigin:options.targetOrigin||"*",resultDelayMs:bounded(options.resultDelayMs,3e3,0,6e4),captureTimeoutMs:bounded(options.captureTimeoutMs,4e3,1,3e4),maxLogs:bounded(options.maxLogs,500,1,5e3),maxLogChars:bounded(options.maxLogChars,2e5,1e3,2e6),showLogPanel:options.showLogPanel!==false};const history=[];const connections=new Map;const cleanups=[];const pending=new Set;const assetCache=new Map;let historyChars=0;let disposed=false;let result=1;let resultReported=false;let resultTimer;let notifiedReady=false;let active;let panel;let updatePanel=__name(()=>{},"updatePanel");const listen=__name((target,type,callback,capture=false)=>{target.addEventListener(type,callback,capture);cleanups.push(()=>target.removeEventListener(type,callback,capture))},"listen");const post=__name((payload,target=win.parent,origin=settings.targetOrigin)=>{if(disposed||!target||target===win)return;try{target.postMessage(payload,origin)}catch{}},"post");const armResult=__name(()=>{if(resultReported||resultTimer!==void 0||disposed)return;resultTimer=win.setTimeout(()=>{resultTimer=void 0;if(disposed||resultReported)return;resultReported=true;post({type:"runtime-result",data:result});record("info",`postMessage runtime-result result=${result}`,"platform")},settings.resultDelayMs)},"armResult");const signalError=__name((crash=false)=>{if(!resultReported){if(crash)result=2;else if(result!==2)result=0;armResult()}},"signalError");const record=__name((level,message,source="console")=>{if(disposed)return;const entry={time:Date.now(),level,message:String(message).slice(0,8e3),source};history.push(entry);historyChars+=entry.message.length;while(history.length>settings.maxLogs||historyChars>settings.maxLogChars){historyChars-=history.shift().message.length}updatePanel()},"record");const consoleObject=win.console;for(const method of CONSOLE_METHODS){const original=consoleObject?.[method];if(typeof original!=="function")continue;const wrapped=__name(function(...args){if(!disposed){record(method==="log"?"info":method,args.map(serialize).join(" "));if(method==="error")signalError()}return Reflect.apply(original,consoleObject,args)},"wrapped");try{consoleObject[method]=wrapped;cleanups.push(()=>{if(consoleObject[method]===wrapped)consoleObject[method]=original})}catch{}}listen(win,"error",event=>{const target=event.target;const detail=event.error?messageOf(event.error):event.message||`Resource failed: ${target?.src||target?.href||target?.tagName||"unknown"}`;record("error",detail,"window.error");signalError()},true);listen(win,"unhandledrejection",event=>{record("error",serialize(event.reason),"unhandledrejection");signalError()});const seenWebglEvents=new WeakSet;const handleWebgl=__name(event=>{if(seenWebglEvents.has(event))return;seenWebglEvents.add(event);const restored=event.type==="webglcontextrestored";record(restored?"warn":"error",`${event.type}: ${event.statusMessage||"no details"}`,"webgl");if(!restored)signalError(true)},"handleWebgl");for(const type of["webglcontextlost","webglcontextcreationerror","webglcontextrestored"]){listen(doc,type,handleWebgl,true)}const finishCapture=__name((ticket,response)=>{if(!pending.has(ticket))return;pending.delete(ticket);ticket.connection?.requests.delete(ticket);win.clearTimeout(ticket.timer);ticket.abort.abort();if(!disposed)post({type:"screenshot-response",...ticket.id,...response},ticket.source,ticket.origin);ticket.resolve?.(response)},"finishCapture");const cancelCapture=__name(ticket=>{pending.delete(ticket);ticket.connection?.requests.delete(ticket);win.clearTimeout(ticket.timer);ticket.abort.abort();ticket.resolve?.({ok:false,error:"Preview disposed"})},"cancelCapture");const captureFrame=__name(connection=>{for(const ticket of[...connection.requests]){connection.requests.delete(ticket);if(!pending.has(ticket))continue;try{const canvas=connection.canvas;if(!(canvas.width>0&&canvas.height>0))throw new Error("Canvas has no drawable size");const canvasRect=canvas.getBoundingClientRect();const snapshotNotes=[];let roots=[];try{roots=findUiRoots(canvas,connection.options.uiRoot,win)}catch(error){snapshotNotes.push(`UI roots unavailable: ${messageOf(error)}`)}const videos=collectPaintVideos(canvas,roots);const frameRect=unionCaptureRect(canvasRect,[...roots,...videos]);const scaleX=canvas.width/(canvasRect.width||canvas.width);const scaleY=canvas.height/(canvasRect.height||canvas.height);const canvasCopy=doc.createElement("canvas");canvasCopy.width=canvas.width;canvasCopy.height=canvas.height;const canvasContext=canvasCopy.getContext("2d");if(!canvasContext)throw new Error("Screenshot 2D context unavailable");canvasContext.drawImage(canvas,0,0);const base=canvasCopy.toDataURL("image/png");if(!base.startsWith("data:image/"))throw new Error("Canvas snapshot is empty");const copy=doc.createElement("canvas");copy.width=Math.max(1,Math.round(frameRect.width*scaleX));copy.height=Math.max(1,Math.round(frameRect.height*scaleY));const context=copy.getContext("2d");if(!context)throw new Error("Screenshot 2D context unavailable");const fill=captureBackground(canvas,win);if(fill){context.fillStyle=fill;context.fillRect(0,0,copy.width,copy.height)}context.drawImage(canvas,(canvasRect.left-frameRect.left)*scaleX,(canvasRect.top-frameRect.top)*scaleY);try{paintVideos(copy,canvas,roots,win,snapshotNotes)}catch(error){snapshotNotes.push(`video overlay omitted: ${messageOf(error)}`)}let uiTree=null;try{uiTree=captureTree(canvas,roots,win)}catch(error){record("warn",messageOf(error),"ui-tree")}ticket.baseResponse={data:base,composited:false,uiTree};const layers=[];for(const root of roots){if(root.tagName==="VIDEO")continue;try{layers.push(snapshotLayer(root,canvas,win,frameRect))}catch(error){snapshotNotes.push(`UI snapshot unavailable: ${messageOf(error)}`)}}void composeSnapshot(copy,base,layers,win,ticket.abort.signal,assetCache).then(composite=>finishCapture(ticket,{ok:true,...finishCanvasOverlays(copy,canvas,roots,win,snapshotNotes,composite),uiTree,...snapshotNotes.length?{note:[...snapshotNotes,composite.note].filter(Boolean).join("; ").slice(0,2e3)}:{}}),error=>finishCapture(ticket,{ok:false,error:messageOf(error)}))}catch(error){record("warn",messageOf(error),"screenshot");finishCapture(ticket,{ok:false,error:messageOf(error)})}}},"captureFrame");const requestCapture=__name((source,origin,requestId,resolve)=>{const id=typeof requestId==="string"||typeof requestId==="number"?{requestId}:{};if(!active||active.disposed||pending.size>=4){const response={ok:false,error:!active?"No canvas registered":"Screenshot queue is full"};post({type:"screenshot-response",...id,...response},source,origin);resolve?.(response);return}const connection=active;const ticket={id,source,origin,connection,abort:new AbortController,resolve};ticket.timer=win.setTimeout(()=>{finishCapture(ticket,ticket.baseResponse?{ok:true,...ticket.baseResponse,note:"DOM composition timed out; returned the captured canvas frame"}:{ok:false,error:"Screenshot timed out waiting for a rendered frame"})},settings.captureTimeoutMs);pending.add(ticket);connection.requests.add(ticket);if(connection.options.renderForCapture){try{const returned=connection.options.renderForCapture();if(returned&&typeof returned.then==="function"){Promise.resolve(returned).catch(()=>{});throw new Error("renderForCapture must render synchronously; call afterRender for asynchronous rendering")}connection.handle.afterRender()}catch(error){finishCapture(ticket,{ok:false,error:messageOf(error)})}}},"requestCapture");listen(win,"message",event=>{if(event.source!==win.parent||event.data?.type!=="screenshot-request")return;if(settings.targetOrigin!=="*"&&event.origin!==settings.targetOrigin)return;requestCapture(event.source,settings.targetOrigin==="*"?"*":event.origin,event.data.requestId)});const bridge={get disposed(){return disposed},getLogs:__name(()=>history.map(entry=>({...entry})),"getLogs"),exportLogs:__name(()=>history.map(entry=>`[${new Date(entry.time).toISOString()}] [${entry.level}] [${entry.source}] ${entry.message}`).join("\n"),"exportLogs"),clearLogs(){history.length=0;historyChars=0;updatePanel()},sendLogsToParent(){if(disposed||win.parent===win||history.length===0)return false;post({type:"runtime-log",data:{message:bridge.exportLogs(),count:history.length}});return true},capture(){if(disposed)return Promise.resolve({ok:false,error:"Preview disposed"});return new Promise(resolve=>requestCapture(win,"*",void 0,resolve))},captureUiTree(){if(!active||disposed)return null;return captureTree(active.canvas,findUiRoots(active.canvas,active.options.uiRoot,win),win)},connect(canvas,connectionOptions={}){if(disposed)throw new Error("Platform bridge is disposed; call startPlatform again");if(canvas?.tagName!=="CANVAS"||typeof canvas.getContext!=="function"){throw new TypeError("connectPreview expects an HTMLCanvasElement")}if(canvas.ownerDocument!==doc)throw new Error("Canvas must belong to the platform window");if(connections.has(canvas))return connections.get(canvas).handle;const connection={canvas,options:connectionOptions,requests:new Set,rendered:false,ready:false,disposed:false};const notifyReady=__name(()=>{if(disposed||connection.disposed||!connection.ready||!connection.rendered||notifiedReady)return;notifiedReady=true;post({type:"onloadend"});post({type:"ready"});record("info","postMessage onloadend (canvas ready)","platform")},"notifyReady");const types=["webglcontextlost","webglcontextcreationerror","webglcontextrestored"];for(const type of types)canvas.addEventListener(type,handleWebgl);connection.handle={afterRender(){if(disposed||connection.disposed)return;connection.rendered=true;armResult();notifyReady();captureFrame(connection)},markReady(){if(disposed||connection.disposed)return;connection.ready=true;notifyReady()},dispose(){if(connection.disposed)return;connection.disposed=true;for(const type of types)canvas.removeEventListener(type,handleWebgl);for(const ticket of[...pending])if(ticket.connection===connection)cancelCapture(ticket);connections.delete(canvas);if(active===connection)active=[...connections.values()].at(-1);if(connections.size===0)bridge.dispose()}};connections.set(canvas,connection);active=connection;return connection.handle},dispose(){if(disposed)return;disposed=true;if(resultTimer!==void 0)win.clearTimeout(resultTimer);for(const ticket of[...pending])cancelCapture(ticket);for(const connection of[...connections.values()])connection.handle.dispose();for(const cleanup of cleanups.reverse())cleanup();panel?.remove();assetCache.clear();updatePanel=__name(()=>{},"updatePanel");if(win[BRIDGE_KEY]===bridge)delete win[BRIDGE_KEY]}};win[BRIDGE_KEY]=bridge;listen(win,"pagehide",()=>bridge.dispose());const mountPanel=__name(()=>{if(disposed||panel||!doc.body||!settings.preview||!settings.showLogPanel)return;const mounted=mountDebugConsole({doc,win,listen,ignoreAttribute:IGNORE_ATTRIBUTE,history,bridge});panel=mounted.panel;updatePanel=mounted.updatePanel},"mountPanel");if(doc.body)mountPanel();else listen(doc,"DOMContentLoaded",mountPanel);return bridge}__name(startPlatform,"startPlatform");function connectPreview(canvas,options={}){return startPlatform(options).connect(canvas,options)}__name(connectPreview,"connectPreview");function captureBackground(canvas,win){const node=canvas.parentElement||canvas.ownerDocument.body;if(!node)return"";const color=win.getComputedStyle(node).backgroundColor;if(color&&color!=="transparent"&&color!=="rgba(0, 0, 0, 0)")return color;const body=canvas.ownerDocument.body;if(!body||body===node)return color||"";return win.getComputedStyle(body).backgroundColor||""}__name(captureBackground,"captureBackground");function findUiRoots(canvas,configured,win){if(configured===null||configured===false)return[];const doc=canvas.ownerDocument;const candidates=configured!==void 0?Array.isArray(configured)?configured:[configured]:[doc.getElementById("ui-root"),...Array.from(canvas.parentElement?.children||[])];const roots=[];for(const candidate of candidates){const root=typeof candidate==="string"?doc.querySelector(candidate):candidate;if(!root||root===canvas||root.nodeType!==1||root.hasAttribute(IGNORE_ATTRIBUTE))continue;if(["SCRIPT","STYLE","LINK","CANVAS","VIDEO"].includes(root.tagName))continue;if(roots.some(existing=>existing===root||existing.contains(root)))continue;const style=win.getComputedStyle(root);const rect=root.getBoundingClientRect();if(style.display==="none"||style.visibility==="hidden"||Number(style.opacity)===0||!rect.width||!rect.height)continue;for(let index=roots.length-1;index>=0;index--)if(root.contains(roots[index]))roots.splice(index,1);roots.push(root)}return roots}__name(findUiRoots,"findUiRoots");function snapshotLayer(root,canvas,win,frameRect){const rect=root.getBoundingClientRect();const canvasRect=canvas.getBoundingClientRect();frameRect=frameRect||unionCaptureRect(canvasRect,[root]);const clone=root.cloneNode(true);const originals=[root,...root.querySelectorAll("*")];const copies=[clone,...clone.querySelectorAll("*")];const resources=[];const notes=[];for(let index=0;index<originals.length;index++){const src=originals[index];const dst=copies[index];if(!dst?.style)continue;if(src===canvas||src.hasAttribute(IGNORE_ATTRIBUTE)||["SCRIPT","STYLE","LINK","IFRAME","VIDEO","CANVAS"].includes(src.tagName)){if(["IFRAME","VIDEO"].includes(src.tagName)&&src!==canvas)notes.push(`${src.tagName.toLowerCase()} overlay omitted`);dst.remove();continue}const style=win.getComputedStyle(src);for(let i=0;i<style.length;i++){const property=style[i];dst.style.setProperty(property,style.getPropertyValue(property),"important")}dst.style.setProperty("animation","none","important");dst.style.setProperty("transition","none","important");for(const attr of[...dst.attributes])if(/^on/i.test(attr.name))dst.removeAttribute(attr.name);if(src.tagName==="IMG"){dst.removeAttribute("srcset");resources.push({node:dst,attr:"src",value:src.currentSrc||src.src})}if(src.tagName==="INPUT")dst.setAttribute("value",src.value);if(src.tagName==="TEXTAREA")dst.textContent=src.value;if(src.tagName==="OPTION")src.selected?dst.setAttribute("selected",""):dst.removeAttribute("selected");for(const property of["background-image","border-image-source","mask-image","-webkit-mask-image"]){const value=style.getPropertyValue(property);if(value?.includes("url("))resources.push({node:dst,property,value})}}const scaleX=rect.width/(root.offsetWidth||rect.width);const scaleY=rect.height/(root.offsetHeight||rect.height);for(const[property,value]of Object.entries({position:"absolute",left:"0px",top:"0px",right:"auto",bottom:"auto",margin:"0px",transform:"none","transform-origin":"0 0"})){clone.style.setProperty(property,value,"important")}let css="";for(const sheet of[...root.ownerDocument.styleSheets]){try{css+=[...sheet.cssRules].map(rule=>rule.cssText).join("\n")}catch{notes.push("cross-origin stylesheet unavailable")}}return{clone,resources,notes,css,width:frameRect.width||canvasRect.width||canvas.width,height:frameRect.height||canvasRect.height||canvas.height,left:rect.left-frameRect.left,top:rect.top-frameRect.top,scaleX,scaleY}}__name(snapshotLayer,"snapshotLayer");async function composeSnapshot(copy,base,layers,win,signal,cache){if(!layers.length)return{data:base,composited:false,note:"No DOM UI overlay"};let composited=false;const notes=[];for(const layer of layers){if(signal.aborted)throw new Error("Screenshot cancelled");try{const image=await rasterizeLayer(layer,win,signal,cache);copy.getContext("2d").drawImage(image,0,0,copy.width,copy.height);composited=true;notes.push(...layer.notes)}catch(error){if(signal.aborted)throw error;notes.push(messageOf(error))}}try{return{data:composited?copy.toDataURL("image/png"):base,composited,...notes.length?{note:notes.join("; ").slice(0,2e3)}:{}}}catch(error){return{data:base,composited:false,note:`DOM composite unavailable: ${messageOf(error)}`}}}__name(composeSnapshot,"composeSnapshot");async function rasterizeLayer(layer,win,signal,cache){for(const resource of layer.resources){if(signal.aborted)throw new Error("Screenshot cancelled");if(resource.attr){try{resource.node.setAttribute(resource.attr,await inlineAsset(resource.value,win,signal,cache))}catch(error){resource.node.removeAttribute(resource.attr);layer.notes.push(`UI image omitted: ${messageOf(error)}`)}}else{let value=resource.value;for(const match of resource.value.matchAll(/url\(\s*(['"]?)(.*?)\1\s*\)/g)){try{value=value.replace(match[0],`url("${await inlineAsset(match[2],win,signal,cache)}")`)}catch(error){value=value.replace(match[0],"none");layer.notes.push(`UI background omitted: ${messageOf(error)}`)}}resource.node.style.setProperty(resource.property,value,"important")}}layer.clone.setAttribute("xmlns","http://www.w3.org/1999/xhtml");const serialized=new win.XMLSerializer().serializeToString(layer.clone);const css=`${layer.css}
|
|
29
|
+
*,*::before,*::after{animation:none!important;transition:none!important}`.replace(/]]>/g,"]]]]><![CDATA[>");const svg=`<svg xmlns="http://www.w3.org/2000/svg" width="${layer.width}" height="${layer.height}"><foreignObject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml" style="position:relative;width:${layer.width}px;height:${layer.height}px;overflow:hidden"><style><![CDATA[${css}]]></style><div style="position:absolute;left:${layer.left}px;top:${layer.top}px;transform:scale(${layer.scaleX},${layer.scaleY});transform-origin:0 0">${serialized}</div></div></foreignObject></svg>`;return new Promise((resolve,reject)=>{const image=new win.Image;const cleanup=__name(()=>{signal.removeEventListener("abort",abort);image.onload=null;image.onerror=null},"cleanup");const abort=__name(()=>{cleanup();image.src="";reject(new Error("Screenshot cancelled"))},"abort");signal.addEventListener("abort",abort,{once:true});image.onload=()=>{cleanup();resolve(image)};image.onerror=()=>{cleanup();reject(new Error("DOM UI rasterization failed"))};if(signal.aborted)abort();else image.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`})}__name(rasterizeLayer,"rasterizeLayer");async function inlineAsset(source,win,signal,cache){if(!source)throw new Error("empty URL");if(source.startsWith("data:"))return source;const url=new URL(source,win.document.baseURI).href;if(cache.has(url))return cache.get(url);const response=await win.fetch(url,{signal,credentials:"same-origin",cache:"force-cache"});if(!response.ok)throw new Error(`asset HTTP ${response.status}`);const blob=await response.blob();if(blob.size>5*1024*1024)throw new Error("UI asset exceeds 5 MiB");const data=await new Promise((resolve,reject)=>{const reader=new win.FileReader;const abort=__name(()=>{reader.abort();reject(new Error("Screenshot cancelled"))},"abort");const cleanup=__name(()=>signal.removeEventListener("abort",abort),"cleanup");reader.onload=()=>{cleanup();resolve(String(reader.result))};reader.onerror=()=>{cleanup();reject(new Error("UI asset read failed"))};reader.onabort=()=>{cleanup();reject(new Error("Screenshot cancelled"))};signal.addEventListener("abort",abort,{once:true});if(signal.aborted)abort();else reader.readAsDataURL(blob)});if(data.length<2e5&&cache.size<32)cache.set(url,data);return data}__name(inlineAsset,"inlineAsset");function captureTree(canvas,roots,win){if(!roots.length)return null;const canvasRect=canvas.getBoundingClientRect();const rect=unionCaptureRect(canvasRect,roots);const scaleX=canvas.width/(canvasRect.width||canvas.width);const scaleY=canvas.height/(canvasRect.height||canvas.height);const round=__name(value=>Math.round(value*100)/100,"round");const tree={design:{width:Math.max(1,Math.round(rect.width*scaleX)),height:Math.max(1,Math.round(rect.height*scaleY))},scale:round(1/scaleX),nodeCount:0,truncated:false,hiddenSkipped:0,issues:[],layers:[]};const walk=__name((element,depth,parent)=>{if(element===canvas||element.hasAttribute(IGNORE_ATTRIBUTE))return null;const style=win.getComputedStyle(element);if(style.display==="none"||style.visibility==="hidden"||Number(style.opacity)===0){tree.hiddenSkipped++;return null}if(tree.nodeCount>=300){tree.truncated=true;return null}tree.nodeCount++;const bounds=element.getBoundingClientRect();const node={desc:`${element.tagName.toLowerCase()}${element.id?`#${element.id}`:""}${[...element.classList].map(name=>`.${name}`).join("")}`,rect:{x:round((bounds.left-rect.left)*scaleX),y:round((bounds.top-rect.top)*scaleY),w:round(bounds.width*scaleX),h:round(bounds.height*scaleY)}};const text=[...element.childNodes].filter(child=>child.nodeType===3).map(child=>child.textContent).join("").trim();if(text)node.text=text.slice(0,256);if(style.overflowX!=="visible"||style.overflowY!=="visible")node.overflow=`${style.overflowX} ${style.overflowY}`;const layer=Number.parseInt(element.dataset?.layer,10);if(Number.isFinite(layer))node.layer=layer;if(parent&&!parent.overflow&&tree.issues.length<20){const a=parent.rect;const b=node.rect;if(a.w>0&&a.h>0&&(b.x<a.x-1||b.y<a.y-1||b.x+b.w>a.x+a.w+1||b.y+b.h>a.y+a.h+1)){tree.issues.push(`overflow: ${node.desc} exceeds ${parent.desc}`)}}if(depth>=12){if(element.children.length)tree.truncated=true}else{const children=[...element.children].map(child=>walk(child,depth+1,node)).filter(Boolean);if(children.length)node.children=children}return node},"walk");tree.layers=roots.map(root=>walk(root,0,null)).filter(Boolean);return tree}__name(captureTree,"captureTree");export{connectPreview,startPlatform};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.1.0",
|
|
3
|
+
"files": {
|
|
4
|
+
"platform/identity/qq-ai-game-sdk.min.js": "2a2ad154f1f300f188e202100d35d866e81cba0ff603cb9abea8ab1b4f2b909a",
|
|
5
|
+
"platform/identity/qq-session.mjs": "6a2716cdb7393cac0b0b231bf1b5f9886e2c876917c7af17913c57a683df2a8a",
|
|
6
|
+
"platform/identity/shared.mjs": "58855d261455d390e66b8dbfccd6384a3daddcf77615490c744014c695e611b3",
|
|
7
|
+
"platform/platform-capture-video.mjs": "5137bfd403c8500e1e5b5305ac7f3ca55ee68daaade624333a7c85786077713d",
|
|
8
|
+
"platform/platform-service.d.mts": "1215d08eaa70c412628e6d160e10f3d1b211be8ff66da5d312684d6fe6905f11",
|
|
9
|
+
"platform/platform-service.mjs": "4c80bd843775d687d6015dcde78c3ea2a354923860d1c5d443a6035fcfce5653",
|
|
10
|
+
"platform/platform.d.mts": "27819e8b8730a6af9c84aa4b540fef010e51299f32a76739621d340046e12f11",
|
|
11
|
+
"platform/platform.mjs": "d4848e892f4863003d4022178817cf3c796975f5304bd59530b6574971b4e9c9",
|
|
12
|
+
"tooling/cli.mjs": "ff2a614679a8b2fc3847efe6d0d7194e8c87d8100eaff6b9168e4e3d050465c0",
|
|
13
|
+
"tooling/project.d.mts": "d8272a81789094fed7090ae0cd07f597f62b2dca16834fd6b6e9ccea81968ec8",
|
|
14
|
+
"tooling/project.mjs": "d1600f6a294fe0399d9d45d20cffb7416318b2bbff497c08142ce1a568c59db2",
|
|
15
|
+
"tooling/vite.d.mts": "667e46bd016ef8ba368e53564b49b3fd571786c1672b3dbb14dc24833e0c293c",
|
|
16
|
+
"tooling/vite.mjs": "58edccd64f94c442a313ce51f0698c081fa829ce18ed3173a6694c2a8619cd65",
|
|
17
|
+
"tools/assets.d.mts": "50111c87e3c639383df7900c88540e91b564e560c4411b9d0292712de3712628",
|
|
18
|
+
"tools/assets.mjs": "7608d8e7f0e7491bdd5b32581db77d7a622e08ee32a5cfb9ff992be252b32eda",
|
|
19
|
+
"tools/astc.d.mts": "24416261df0bbfc9a22ec010eb6857bea6ee39703e6e62caf183c2adbe45cd86",
|
|
20
|
+
"tools/astc.mjs": "661576a1d5e65d6079328c0e00348d2eeeae123b0310a8110edac4de92745a2f"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
3
|
+
import { verifyRuntime } from './project.mjs';
|
|
4
|
+
|
|
5
|
+
export async function runCli(args = process.argv.slice(2)) {
|
|
6
|
+
const command = args[0] ?? 'verify';
|
|
7
|
+
if (command !== 'verify' || (args.length > 1 && (args.length !== 3 || args[1] !== '--project' || !args[2] || args[2].startsWith('--')))) {
|
|
8
|
+
throw new Error('Usage: cli.mjs verify [--project <directory>]. Configuration export is provided by the export-config skill.');
|
|
9
|
+
}
|
|
10
|
+
const { release } = await verifyRuntime(resolve(args[2] ?? process.cwd()));
|
|
11
|
+
console.log(`[LightGame] runtime ${release.version} verified`);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) {
|
|
15
|
+
runCli().catch(error => { console.error(`[LightGame] ${error.message}`); process.exitCode = 1; });
|
|
16
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export interface ProjectManifest { version: string; root: string; projectRoot: string; cli: string }
|
|
2
|
+
export function projectPath(root: string, path: string): string;
|
|
3
|
+
export function readProjectManifest(root: string): Promise<ProjectManifest>;
|
|
4
|
+
export function verifyRuntime(root: string): Promise<{ manifest: ProjectManifest; release: { version: string; files: Record<string, string> } }>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { readFile, lstat } from 'node:fs/promises';
|
|
2
|
+
import { resolve, relative, isAbsolute, join } from 'node:path';
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
|
|
5
|
+
export function projectPath(root, path) {
|
|
6
|
+
const target = resolve(root, path);
|
|
7
|
+
const rel = relative(resolve(root), target);
|
|
8
|
+
if (rel === '..' || rel.startsWith('../') || rel.startsWith('..\\') || isAbsolute(rel)) {
|
|
9
|
+
throw new Error(`Path escapes project: ${path}`);
|
|
10
|
+
}
|
|
11
|
+
return target;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function readProjectManifest(projectRoot) {
|
|
15
|
+
const root = resolve(projectRoot);
|
|
16
|
+
const manifest = JSON.parse(await readFile(join(root, 'game-runtime.json'), 'utf8'));
|
|
17
|
+
if (typeof manifest.version !== 'string' || !/^\d+\.\d+\.\d+(?:-[\w.-]+)?$/.test(manifest.version)
|
|
18
|
+
|| typeof manifest.root !== 'string' || !manifest.root.startsWith('runtime/') || isAbsolute(manifest.root)) {
|
|
19
|
+
throw new Error('game-runtime.json requires a fixed version and relative root under runtime/');
|
|
20
|
+
}
|
|
21
|
+
projectPath(root, manifest.root);
|
|
22
|
+
return { version: manifest.version, root: manifest.root, cli: manifest.cli ?? 'tooling/cli.mjs', projectRoot: root };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function verifyRuntime(projectRoot) {
|
|
26
|
+
const manifest = await readProjectManifest(projectRoot);
|
|
27
|
+
const sdkRoot = projectPath(manifest.projectRoot, manifest.root);
|
|
28
|
+
const release = JSON.parse(await readFile(join(sdkRoot, 'release.json'), 'utf8'));
|
|
29
|
+
if (release.version !== manifest.version || !release.files || typeof release.files !== 'object'
|
|
30
|
+
|| Array.isArray(release.files) || !Object.keys(release.files).length) {
|
|
31
|
+
throw new Error('Runtime release does not match game-runtime.json');
|
|
32
|
+
}
|
|
33
|
+
for (const [name, expected] of Object.entries(release.files)) {
|
|
34
|
+
if (name === 'release.json' || name.split('/').some(part => !/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(part))) {
|
|
35
|
+
throw new Error(`Invalid runtime filename: ${name}`);
|
|
36
|
+
}
|
|
37
|
+
let path = manifest.projectRoot;
|
|
38
|
+
const parts = [...manifest.root.split('/'), ...name.split('/')];
|
|
39
|
+
for (const [index, part] of parts.entries()) {
|
|
40
|
+
path = join(path, part);
|
|
41
|
+
const info = await lstat(path);
|
|
42
|
+
if (info.isSymbolicLink() || (index === parts.length - 1 ? !info.isFile() : !info.isDirectory())) {
|
|
43
|
+
throw new Error(`Runtime must contain regular files and directories without links: ${name}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const actual = createHash('sha256').update(await readFile(projectPath(sdkRoot, name))).digest('hex');
|
|
47
|
+
if (actual !== expected) throw new Error(`Runtime ${release.version} integrity mismatch: ${name}. Restore this release or explicitly upgrade the project.`);
|
|
48
|
+
}
|
|
49
|
+
return { manifest, release };
|
|
50
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { resolve, relative, join } from 'node:path';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { verifyRuntime } from './project.mjs';
|
|
5
|
+
|
|
6
|
+
export function lightgame(options = {}) {
|
|
7
|
+
const virtualId = 'virtual:lightgame/bootstrap';
|
|
8
|
+
const resolvedId = `\0${virtualId}`;
|
|
9
|
+
const entry = options.entry ?? '/src/main.ts';
|
|
10
|
+
let root, outDir, manifest;
|
|
11
|
+
return {
|
|
12
|
+
name: 'lightgame-platform',
|
|
13
|
+
enforce: 'pre',
|
|
14
|
+
async configResolved(config) {
|
|
15
|
+
root = config.root;
|
|
16
|
+
outDir = resolve(root, config.build.outDir);
|
|
17
|
+
({ manifest } = await verifyRuntime(root));
|
|
18
|
+
const packageJson = JSON.parse(await readFile(join(root, 'package.json'), 'utf8'));
|
|
19
|
+
const require = createRequire(join(root, 'package.json'));
|
|
20
|
+
for (const dependency of ['vite', 'three', 'phaser']) {
|
|
21
|
+
const expected = packageJson.dependencies?.[dependency] ?? packageJson.devDependencies?.[dependency];
|
|
22
|
+
if (!expected) continue;
|
|
23
|
+
const packagePath = dependency === 'three'
|
|
24
|
+
? resolve(require.resolve('three'), '..', '..', 'package.json')
|
|
25
|
+
: require.resolve(`${dependency}/package.json`);
|
|
26
|
+
const actual = JSON.parse(await readFile(packagePath, 'utf8')).version;
|
|
27
|
+
if (actual !== expected) throw new Error(`[LightGame] ${dependency} version mismatch: project requires ${expected}, toolchain provides ${actual}. Align the toolchain; do not silently fall back.`);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
resolveId(id) {
|
|
31
|
+
if (id === virtualId || id === `/${virtualId}`) return resolvedId;
|
|
32
|
+
},
|
|
33
|
+
load(id) {
|
|
34
|
+
if (id !== resolvedId) return;
|
|
35
|
+
const runtimeUrl = `/${relative(root, resolve(root, manifest.root, 'platform/platform.mjs')).replaceAll('\\', '/')}`;
|
|
36
|
+
const identityUrl = `/${relative(root, resolve(root, manifest.root, 'platform/platform-service.mjs')).replaceAll('\\', '/')}`;
|
|
37
|
+
return `let bridge;
|
|
38
|
+
try { const sdk = await import(${JSON.stringify(runtimeUrl)}); bridge = sdk.startPlatform(); } catch (error) { console.error('[LightGame] platform startup failed', error); }
|
|
39
|
+
if (new URLSearchParams(window.location.search).has('qq_test')) {
|
|
40
|
+
try {
|
|
41
|
+
const { getPlatformService } = await import(${JSON.stringify(identityUrl)});
|
|
42
|
+
void getPlatformService({ initTimeoutMs: 20000 }).init();
|
|
43
|
+
} catch (error) { console.error('[LightGame] QQ identity startup failed', error); }
|
|
44
|
+
}
|
|
45
|
+
try { await import(${JSON.stringify(entry)}); } catch (error) { console.error('[LightGame] game startup failed', error); throw error; }
|
|
46
|
+
if (import.meta.hot) import.meta.hot.dispose(() => bridge?.dispose());
|
|
47
|
+
`;
|
|
48
|
+
},
|
|
49
|
+
transformIndexHtml: {
|
|
50
|
+
order: 'pre',
|
|
51
|
+
handler(html) {
|
|
52
|
+
let matched = 0;
|
|
53
|
+
const target = entry.replace(/^\.?\//, '');
|
|
54
|
+
const transformed = html.replace(/<script\b([^>]*?)\bsrc\s*=\s*(["'])([^"']+)\2([^>]*)>\s*<\/script>/gi, (tag, before, quote, source) => {
|
|
55
|
+
if (source.replace(/^\.?\//, '') !== target) return tag;
|
|
56
|
+
matched++;
|
|
57
|
+
return `<script type="module" src="/${virtualId}"></script>`;
|
|
58
|
+
});
|
|
59
|
+
if (matched !== 1) throw new Error(`[LightGame] expected exactly one ${entry} module script in index.html, found ${matched}`);
|
|
60
|
+
return transformed;
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
async closeBundle() {
|
|
64
|
+
if (options.profile === false || !outDir) return;
|
|
65
|
+
let html;
|
|
66
|
+
try { html = await readFile(join(outDir, 'index.html'), 'utf8'); }
|
|
67
|
+
catch (error) { if (error.code === 'ENOENT') return; throw error; }
|
|
68
|
+
const tag = '<script src="https://file.craft.qq.com/QA/profile_toolbox.js"></script>';
|
|
69
|
+
await writeFile(join(outDir, 'index_profile.html'), html.replace('</head>', ` ${tag}\n</head>`), 'utf8');
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
export interface AssetUrlOptions { cdnBaseUrl?: string; baseUrl?: string }
|
|
2
|
-
export function resolveAssetUrl(path: string, options?: AssetUrlOptions): string;
|
|
3
|
-
export function decodeImage(blob: Blob, options?: { signal?: AbortSignal }): Promise<ImageBitmap | HTMLImageElement>;
|
|
4
|
-
export interface AssetProgress { active: number; queued: number; completed: number; total: number; ratio: number }
|
|
5
|
-
export interface AssetLoadOptions { type?: string; signal?: AbortSignal }
|
|
6
|
-
export interface AssetLoaderOptions extends AssetUrlOptions {
|
|
7
|
-
concurrency?: number;
|
|
8
|
-
fetch?: typeof fetch;
|
|
9
|
-
decodeImage?: (blob: Blob, options: { signal: AbortSignal }) => Promise<unknown>;
|
|
10
|
-
loaders?: Record<string, (url: string, options: { signal: AbortSignal }) => Promise<unknown>>;
|
|
11
|
-
disposeResource?: (value: unknown, type: string) => void;
|
|
12
|
-
onProgress?: (progress: AssetProgress) => void;
|
|
13
|
-
}
|
|
14
|
-
export interface AssetLoader {
|
|
15
|
-
load<T = ImageBitmap | HTMLImageElement>(path: string, options?: AssetLoadOptions): Promise<T>;
|
|
16
|
-
loadAll<T = unknown>(items: readonly (string | ({ path: string } & AssetLoadOptions))[], options?: { signal?: AbortSignal }): Promise<T[]>;
|
|
17
|
-
get<T = unknown>(path: string, type?: string): T | undefined;
|
|
18
|
-
has(path: string, type?: string): boolean;
|
|
19
|
-
progress(): AssetProgress;
|
|
20
|
-
release(path: string, type?: string): boolean;
|
|
21
|
-
clear(): void;
|
|
22
|
-
dispose(): void;
|
|
23
|
-
}
|
|
24
|
-
export function createAssetLoader(options?: AssetLoaderOptions): AssetLoader;
|
|
1
|
+
export interface AssetUrlOptions { cdnBaseUrl?: string; baseUrl?: string }
|
|
2
|
+
export function resolveAssetUrl(path: string, options?: AssetUrlOptions): string;
|
|
3
|
+
export function decodeImage(blob: Blob, options?: { signal?: AbortSignal }): Promise<ImageBitmap | HTMLImageElement>;
|
|
4
|
+
export interface AssetProgress { active: number; queued: number; completed: number; total: number; ratio: number }
|
|
5
|
+
export interface AssetLoadOptions { type?: string; signal?: AbortSignal }
|
|
6
|
+
export interface AssetLoaderOptions extends AssetUrlOptions {
|
|
7
|
+
concurrency?: number;
|
|
8
|
+
fetch?: typeof fetch;
|
|
9
|
+
decodeImage?: (blob: Blob, options: { signal: AbortSignal }) => Promise<unknown>;
|
|
10
|
+
loaders?: Record<string, (url: string, options: { signal: AbortSignal }) => Promise<unknown>>;
|
|
11
|
+
disposeResource?: (value: unknown, type: string) => void;
|
|
12
|
+
onProgress?: (progress: AssetProgress) => void;
|
|
13
|
+
}
|
|
14
|
+
export interface AssetLoader {
|
|
15
|
+
load<T = ImageBitmap | HTMLImageElement>(path: string, options?: AssetLoadOptions): Promise<T>;
|
|
16
|
+
loadAll<T = unknown>(items: readonly (string | ({ path: string } & AssetLoadOptions))[], options?: { signal?: AbortSignal }): Promise<T[]>;
|
|
17
|
+
get<T = unknown>(path: string, type?: string): T | undefined;
|
|
18
|
+
has(path: string, type?: string): boolean;
|
|
19
|
+
progress(): AssetProgress;
|
|
20
|
+
release(path: string, type?: string): boolean;
|
|
21
|
+
clear(): void;
|
|
22
|
+
dispose(): void;
|
|
23
|
+
}
|
|
24
|
+
export function createAssetLoader(options?: AssetLoaderOptions): AssetLoader;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:true});function resolveAssetUrl(path,{cdnBaseUrl="",baseUrl}={}){const value=String(path??"").trim();if(!value)throw new TypeError("Asset path must not be empty");if(/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(value))return value;const encoded=encodeURI(value).replace(/%25([\da-f]{2})/gi,"%$1");const localPrefix=/^(?:assets|game|res|cfg|fonts)\//.test(value);if(cdnBaseUrl&&!localPrefix&&(value.startsWith("/Game/")||!/^(?:\/|\.\.?\/)/.test(value))){return`${cdnBaseUrl.replace(/\/+$/,"")}/${encoded.replace(/^\/+/,"")}`}return baseUrl?new URL(encoded,baseUrl).href:encoded}__name(resolveAssetUrl,"resolveAssetUrl");function abortError(){return new DOMException("Asset load cancelled","AbortError")}__name(abortError,"abortError");function disposeValue(value){value?.close?.()}__name(disposeValue,"disposeValue");async function decodeImage(blob,{signal}={}){if(signal?.aborted)throw signal.reason??abortError();if(typeof globalThis.createImageBitmap==="function"){const bitmap=await globalThis.createImageBitmap(blob);if(signal?.aborted){bitmap.close();throw signal.reason??abortError()}return bitmap}if(typeof globalThis.Image!=="function")throw new Error("Image decoding requires createImageBitmap or a browser Image");return new Promise((resolve,reject)=>{const image=new globalThis.Image;const url=URL.createObjectURL(blob);const cleanup=__name(()=>{image.onload=image.onerror=null;signal?.removeEventListener("abort",cancel);URL.revokeObjectURL(url)},"cleanup");const cancel=__name(()=>{cleanup();image.removeAttribute("src");reject(signal.reason??abortError())},"cancel");image.onload=()=>{cleanup();resolve(image)};image.onerror=()=>{cleanup();reject(new Error("Image decode failed"))};signal?.addEventListener("abort",cancel,{once:true});image.src=url})}__name(decodeImage,"decodeImage");function createAssetLoader(options={}){const concurrency=options.concurrency??4;if(!Number.isInteger(concurrency)||concurrency<1)throw new RangeError("concurrency must be a positive integer");const fetcher=options.fetch??globalThis.fetch;const imageDecoder=options.decodeImage??decodeImage;const cache=new Map;const pending=new Map;const queue=[];let active=0,total=0,completed=0,disposed=false;const keyFor=__name((path,type)=>`${type}
|
|
2
|
-
${resolveAssetUrl(path,options)}`,"keyFor");const progress=__name(()=>({active,queued:queue.filter(j=>!j.controller.signal.aborted).length,completed,total,ratio:total?completed/total:1}),"progress");const report=__name(()=>{try{options.onProgress?.(progress())}catch{}},"report");const free=__name(entry=>{(options.disposeResource??disposeValue)(entry.value,entry.type)},"free");async function fetchValue(job){const{signal}=job.controller;if(options.loaders?.[job.type])return options.loaders[job.type](job.url,{signal});if(typeof fetcher!=="function")throw new Error("Provide fetch to load assets in this environment");const response=await fetcher(job.url,{signal});if(!response.ok)throw new Error(`HTTP ${response.status} loading ${job.url}`);switch(job.type){case"json":return response.json();case"text":return response.text();case"binary":return response.arrayBuffer();case"blob":return response.blob();case"image":return imageDecoder(await response.blob(),{signal});default:throw new TypeError(`Unknown asset type '${job.type}'; provide a loader for it`)}}__name(fetchValue,"fetchValue");function pump(){while(active<concurrency&&queue.length){const job=queue.shift();if(job.controller.signal.aborted){finish(job,void 0,job.controller.signal.reason??abortError());continue}active++;job.started=true;report();Promise.resolve().then(()=>fetchValue(job)).then(value=>{if(job.controller.signal.aborted||disposed){let cleanupError;try{free({value,type:job.type})}catch(error){cleanupError=error}finish(job,void 0,cleanupError??job.controller.signal.reason??abortError())}else finish(job,value)},error=>finish(job,void 0,error))}}__name(pump,"pump");function finish(job,value,error){if(job.started)active--;if(pending.get(job.key)===job)pending.delete(job.key);completed++;if(!error)cache.set(job.key,{value,type:job.type});else if(!job.controller.signal.aborted&&error?.name!=="AbortError")error=new Error(`Failed to load ${job.type} asset '${job.url}': ${error?.message??String(error)}`,{cause:error});for(const subscriber of job.subscribers){subscriber.cleanup();if(error)subscriber.reject(error);else subscriber.resolve(value)}job.subscribers.clear();report();queueMicrotask(pump)}__name(finish,"finish");function load(path,{type="image",signal}={}){if(disposed)return Promise.reject(new Error("Asset loader is disposed"));if(signal?.aborted)return Promise.reject(signal.reason??abortError());const url=resolveAssetUrl(path,options);const key=keyFor(path,type);if(cache.has(key))return Promise.resolve(cache.get(key).value);let job=pending.get(key);if(!job||job.controller.signal.aborted){job={key,url,type,controller:new AbortController,subscribers:new Set,started:false};pending.set(key,job);queue.push(job);total++}return new Promise((resolve,reject)=>{const cancel=__name(()=>{subscriber.cleanup();job.subscribers.delete(subscriber);reject(signal.reason??abortError());if(!job.subscribers.size)job.controller.abort(abortError())},"cancel");const subscriber={resolve,reject,cleanup:__name(()=>signal?.removeEventListener("abort",cancel),"cleanup")};job.subscribers.add(subscriber);signal?.addEventListener("abort",cancel,{once:true});pump()})}__name(load,"load");function release(path,type="image"){const key=keyFor(path,type);const job=pending.get(key);if(job){job.controller.abort(abortError());for(const sub of job.subscribers){sub.cleanup();sub.reject(job.controller.signal.reason)}job.subscribers.clear()}const entry=cache.get(key);if(entry){cache.delete(key);free(entry)}return Boolean(job||entry)}__name(release,"release");function clear(){for(const job of pending.values()){job.controller.abort(abortError());for(const sub of job.subscribers){sub.cleanup();sub.reject(job.controller.signal.reason)}job.subscribers.clear()}const entries=[...cache.values()];cache.clear();const errors=[];for(const entry of entries){try{free(entry)}catch(error){errors.push(error)}}if(errors.length)throw new AggregateError(errors,"Asset resource cleanup failed")}__name(clear,"clear");return{load,loadAll:__name((items,{signal}={})=>Promise.all(items.map(item=>typeof item==="string"?load(item,{signal}):load(item.path,{...item,signal:item.signal??signal}))),"loadAll"),get:__name((path,type="image")=>cache.get(keyFor(path,type))?.value,"get"),has:__name((path,type="image")=>cache.has(keyFor(path,type)),"has"),progress,release,clear,dispose(){if(!disposed){disposed=true;clear()}}}}__name(createAssetLoader,"createAssetLoader");export{createAssetLoader,decodeImage,resolveAssetUrl};
|
|
1
|
+
var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:true});function resolveAssetUrl(path,{cdnBaseUrl="",baseUrl}={}){const value=String(path??"").trim();if(!value)throw new TypeError("Asset path must not be empty");if(/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(value))return value;const encoded=encodeURI(value).replace(/%25([\da-f]{2})/gi,"%$1");const localPrefix=/^(?:assets|game|res|cfg|fonts)\//.test(value);if(cdnBaseUrl&&!localPrefix&&(value.startsWith("/Game/")||!/^(?:\/|\.\.?\/)/.test(value))){return`${cdnBaseUrl.replace(/\/+$/,"")}/${encoded.replace(/^\/+/,"")}`}return baseUrl?new URL(encoded,baseUrl).href:encoded}__name(resolveAssetUrl,"resolveAssetUrl");function abortError(){return new DOMException("Asset load cancelled","AbortError")}__name(abortError,"abortError");function disposeValue(value){value?.close?.()}__name(disposeValue,"disposeValue");async function decodeImage(blob,{signal}={}){if(signal?.aborted)throw signal.reason??abortError();if(typeof globalThis.createImageBitmap==="function"){const bitmap=await globalThis.createImageBitmap(blob);if(signal?.aborted){bitmap.close();throw signal.reason??abortError()}return bitmap}if(typeof globalThis.Image!=="function")throw new Error("Image decoding requires createImageBitmap or a browser Image");return new Promise((resolve,reject)=>{const image=new globalThis.Image;const url=URL.createObjectURL(blob);const cleanup=__name(()=>{image.onload=image.onerror=null;signal?.removeEventListener("abort",cancel);URL.revokeObjectURL(url)},"cleanup");const cancel=__name(()=>{cleanup();image.removeAttribute("src");reject(signal.reason??abortError())},"cancel");image.onload=()=>{cleanup();resolve(image)};image.onerror=()=>{cleanup();reject(new Error("Image decode failed"))};signal?.addEventListener("abort",cancel,{once:true});image.src=url})}__name(decodeImage,"decodeImage");function createAssetLoader(options={}){const concurrency=options.concurrency??4;if(!Number.isInteger(concurrency)||concurrency<1)throw new RangeError("concurrency must be a positive integer");const fetcher=options.fetch??globalThis.fetch;const imageDecoder=options.decodeImage??decodeImage;const cache=new Map;const pending=new Map;const queue=[];let active=0,total=0,completed=0,disposed=false;const keyFor=__name((path,type)=>`${type}
|
|
2
|
+
${resolveAssetUrl(path,options)}`,"keyFor");const progress=__name(()=>({active,queued:queue.filter(j=>!j.controller.signal.aborted).length,completed,total,ratio:total?completed/total:1}),"progress");const report=__name(()=>{try{options.onProgress?.(progress())}catch{}},"report");const free=__name(entry=>{(options.disposeResource??disposeValue)(entry.value,entry.type)},"free");async function fetchValue(job){const{signal}=job.controller;if(options.loaders?.[job.type])return options.loaders[job.type](job.url,{signal});if(typeof fetcher!=="function")throw new Error("Provide fetch to load assets in this environment");const response=await fetcher(job.url,{signal});if(!response.ok)throw new Error(`HTTP ${response.status} loading ${job.url}`);switch(job.type){case"json":return response.json();case"text":return response.text();case"binary":return response.arrayBuffer();case"blob":return response.blob();case"image":return imageDecoder(await response.blob(),{signal});default:throw new TypeError(`Unknown asset type '${job.type}'; provide a loader for it`)}}__name(fetchValue,"fetchValue");function pump(){while(active<concurrency&&queue.length){const job=queue.shift();if(job.controller.signal.aborted){finish(job,void 0,job.controller.signal.reason??abortError());continue}active++;job.started=true;report();Promise.resolve().then(()=>fetchValue(job)).then(value=>{if(job.controller.signal.aborted||disposed){let cleanupError;try{free({value,type:job.type})}catch(error){cleanupError=error}finish(job,void 0,cleanupError??job.controller.signal.reason??abortError())}else finish(job,value)},error=>finish(job,void 0,error))}}__name(pump,"pump");function finish(job,value,error){if(job.started)active--;if(pending.get(job.key)===job)pending.delete(job.key);completed++;if(!error)cache.set(job.key,{value,type:job.type});else if(!job.controller.signal.aborted&&error?.name!=="AbortError")error=new Error(`Failed to load ${job.type} asset '${job.url}': ${error?.message??String(error)}`,{cause:error});for(const subscriber of job.subscribers){subscriber.cleanup();if(error)subscriber.reject(error);else subscriber.resolve(value)}job.subscribers.clear();report();queueMicrotask(pump)}__name(finish,"finish");function load(path,{type="image",signal}={}){if(disposed)return Promise.reject(new Error("Asset loader is disposed"));if(signal?.aborted)return Promise.reject(signal.reason??abortError());const url=resolveAssetUrl(path,options);const key=keyFor(path,type);if(cache.has(key))return Promise.resolve(cache.get(key).value);let job=pending.get(key);if(!job||job.controller.signal.aborted){job={key,url,type,controller:new AbortController,subscribers:new Set,started:false};pending.set(key,job);queue.push(job);total++}return new Promise((resolve,reject)=>{const cancel=__name(()=>{subscriber.cleanup();job.subscribers.delete(subscriber);reject(signal.reason??abortError());if(!job.subscribers.size)job.controller.abort(abortError())},"cancel");const subscriber={resolve,reject,cleanup:__name(()=>signal?.removeEventListener("abort",cancel),"cleanup")};job.subscribers.add(subscriber);signal?.addEventListener("abort",cancel,{once:true});pump()})}__name(load,"load");function release(path,type="image"){const key=keyFor(path,type);const job=pending.get(key);if(job){job.controller.abort(abortError());for(const sub of job.subscribers){sub.cleanup();sub.reject(job.controller.signal.reason)}job.subscribers.clear()}const entry=cache.get(key);if(entry){cache.delete(key);free(entry)}return Boolean(job||entry)}__name(release,"release");function clear(){for(const job of pending.values()){job.controller.abort(abortError());for(const sub of job.subscribers){sub.cleanup();sub.reject(job.controller.signal.reason)}job.subscribers.clear()}const entries=[...cache.values()];cache.clear();const errors=[];for(const entry of entries){try{free(entry)}catch(error){errors.push(error)}}if(errors.length)throw new AggregateError(errors,"Asset resource cleanup failed")}__name(clear,"clear");return{load,loadAll:__name((items,{signal}={})=>Promise.all(items.map(item=>typeof item==="string"?load(item,{signal}):load(item.path,{...item,signal:item.signal??signal}))),"loadAll"),get:__name((path,type="image")=>cache.get(keyFor(path,type))?.value,"get"),has:__name((path,type="image")=>cache.has(keyFor(path,type)),"has"),progress,release,clear,dispose(){if(!disposed){disposed=true;clear()}}}}__name(createAssetLoader,"createAssetLoader");export{createAssetLoader,decodeImage,resolveAssetUrl};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { AssetUrlOptions } from './assets.mjs';
|
|
2
|
-
export function supportsAstc(gl: WebGLRenderingContext | WebGL2RenderingContext): boolean;
|
|
3
|
-
export function toAstcKtxUrl(url: string): string | null;
|
|
4
|
-
export interface AstcTextureData { width: number; height: number; internalFormat: number; mipmaps: { width: number; height: number; data: Uint8Array }[] }
|
|
5
|
-
export function parseAstcKtx(buffer: ArrayBuffer): AstcTextureData;
|
|
6
|
-
export function loadAstcTexture(gl: WebGLRenderingContext | WebGL2RenderingContext, url: string, options?: AssetUrlOptions & {
|
|
7
|
-
fallbackUrl?: string; fetch?: typeof fetch; signal?: AbortSignal;
|
|
8
|
-
decodeImage?: (blob: Blob, options: { signal?: AbortSignal }) => Promise<ImageBitmap | HTMLImageElement>;
|
|
9
|
-
onFallback?: (error: unknown) => void;
|
|
10
|
-
}): Promise<{ texture: WebGLTexture; width: number; height: number; format: 'astc' | 'image'; dispose(): void }>;
|
|
1
|
+
import type { AssetUrlOptions } from './assets.mjs';
|
|
2
|
+
export function supportsAstc(gl: WebGLRenderingContext | WebGL2RenderingContext): boolean;
|
|
3
|
+
export function toAstcKtxUrl(url: string): string | null;
|
|
4
|
+
export interface AstcTextureData { width: number; height: number; internalFormat: number; mipmaps: { width: number; height: number; data: Uint8Array }[] }
|
|
5
|
+
export function parseAstcKtx(buffer: ArrayBuffer): AstcTextureData;
|
|
6
|
+
export function loadAstcTexture(gl: WebGLRenderingContext | WebGL2RenderingContext, url: string, options?: AssetUrlOptions & {
|
|
7
|
+
fallbackUrl?: string; fetch?: typeof fetch; signal?: AbortSignal;
|
|
8
|
+
decodeImage?: (blob: Blob, options: { signal?: AbortSignal }) => Promise<ImageBitmap | HTMLImageElement>;
|
|
9
|
+
onFallback?: (error: unknown) => void;
|
|
10
|
+
}): Promise<{ texture: WebGLTexture; width: number; height: number; format: 'astc' | 'image'; dispose(): void }>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:true});function resolveAssetUrl(path,{cdnBaseUrl="",baseUrl}={}){const value=String(path??"").trim();if(!value)throw new TypeError("Asset path must not be empty");if(/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(value))return value;const encoded=encodeURI(value).replace(/%25([\da-f]{2})/gi,"%$1");const localPrefix=/^(?:assets|game|res|cfg|fonts)\//.test(value);if(cdnBaseUrl&&!localPrefix&&(value.startsWith("/Game/")||!/^(?:\/|\.\.?\/)/.test(value))){return`${cdnBaseUrl.replace(/\/+$/,"")}/${encoded.replace(/^\/+/,"")}`}return baseUrl?new URL(encoded,baseUrl).href:encoded}__name(resolveAssetUrl,"resolveAssetUrl");function abortError(){return new DOMException("Asset load cancelled","AbortError")}__name(abortError,"abortError");async function decodeImage(blob,{signal}={}){if(signal?.aborted)throw signal.reason??abortError();if(typeof globalThis.createImageBitmap==="function"){const bitmap=await globalThis.createImageBitmap(blob);if(signal?.aborted){bitmap.close();throw signal.reason??abortError()}return bitmap}if(typeof globalThis.Image!=="function")throw new Error("Image decoding requires createImageBitmap or a browser Image");return new Promise((resolve,reject)=>{const image=new globalThis.Image;const url=URL.createObjectURL(blob);const cleanup=__name(()=>{image.onload=image.onerror=null;signal?.removeEventListener("abort",cancel);URL.revokeObjectURL(url)},"cleanup");const cancel=__name(()=>{cleanup();image.removeAttribute("src");reject(signal.reason??abortError())},"cancel");image.onload=()=>{cleanup();resolve(image)};image.onerror=()=>{cleanup();reject(new Error("Image decode failed"))};signal?.addEventListener("abort",cancel,{once:true});image.src=url})}__name(decodeImage,"decodeImage");function supportsAstc(gl){return Boolean(gl&&!gl.isContextLost?.()&&(gl.getExtension("WEBGL_compressed_texture_astc")||gl.getExtension("WEBKIT_WEBGL_compressed_texture_astc")))}__name(supportsAstc,"supportsAstc");function toAstcKtxUrl(url){if(/^(?:data:|blob:)/i.test(url))return null;const match=String(url).match(/^([^?#]*)([?#].*)?$/);return match&&/\.(?:png|jpe?g)$/i.test(match[1])?`${match[1].replace(/\.(?:png|jpe?g)$/i,".ktx")}${match[2]??""}`:null}__name(toAstcKtxUrl,"toAstcKtxUrl");function parseAstcKtx(buffer){if(!(buffer instanceof ArrayBuffer)||buffer.byteLength<64)throw new TypeError("KTX v1 requires at least 64 bytes");const bytes=new Uint8Array(buffer),magic=[171,75,84,88,32,49,49,187,13,10,26,10];if(!magic.every((value,i)=>bytes[i]===value))throw new Error("Invalid KTX v1 identifier");const view=new DataView(buffer),marker=view.getUint32(12,true);if(marker!==67305985&&marker!==16909060)throw new Error("Invalid KTX byte order");const littleEndian=marker===67305985,read=__name(offset2=>view.getUint32(offset2,littleEndian),"read");const internalFormat=read(28),width=read(36),height=read(40),levels=read(56)||1;const formatIndex=internalFormat>=37808&&internalFormat<=37821?internalFormat-37808:internalFormat>=37840&&internalFormat<=37853?internalFormat-37840:-1;if(formatIndex<0||read(16)!==0||read(20)!==1||read(24)!==0||read(32)!==6408)throw new Error("KTX is not an ASTC RGBA compressed texture");if(!width||!height||read(44)!==0||read(48)!==0||read(52)!==1)throw new Error("Only nonempty 2D, nonarray KTX textures are supported");if(levels>Math.floor(Math.log2(Math.max(width,height)))+1)throw new Error("Invalid KTX mip count");const blockSizes=[[4,4],[5,4],[5,5],[6,5],[6,6],[8,5],[8,6],[8,8],[10,5],[10,6],[10,8],[10,10],[12,10],[12,12]];const[blockWidth,blockHeight]=blockSizes[formatIndex],mipmaps=[];let offset=64+read(60);if(offset%4!==0||offset>buffer.byteLength)throw new Error("Invalid KTX metadata size");for(let level=0;level<levels;level++){if(offset+4>buffer.byteLength)throw new Error("Truncated KTX mip header");const size=read(offset);offset+=4;const mipWidth=Math.max(1,Math.floor(width/2**level)),mipHeight=Math.max(1,Math.floor(height/2**level));const expected=Math.ceil(mipWidth/blockWidth)*Math.ceil(mipHeight/blockHeight)*16;if(size!==expected||offset+size>buffer.byteLength)throw new Error("Invalid or truncated ASTC mip data");mipmaps.push({width:mipWidth,height:mipHeight,data:new Uint8Array(buffer,offset,size)});offset+=size+(4-size%4)%4}return{width,height,internalFormat,mipmaps}}__name(parseAstcKtx,"parseAstcKtx");function checkSignal(signal){if(signal?.aborted)throw signal.reason??new DOMException("Texture load cancelled","AbortError")}__name(checkSignal,"checkSignal");async function loadAstcTexture(gl,url,options={}){if(!gl||typeof gl.createTexture!=="function")throw new TypeError("A WebGL rendering context is required; Canvas 2D is unsupported");if(gl.isContextLost?.())throw new Error("WebGL context is lost");const fetcher=options.fetch??globalThis.fetch,decodeImage2=options.decodeImage??decodeImage;const fetchChecked=__name(async path=>{checkSignal(options.signal);const response=await fetcher(resolveAssetUrl(path,options),{signal:options.signal});if(!response.ok)throw new Error(`HTTP ${response.status} loading ${path}`);return response},"fetchChecked");function upload(data,compressed){checkSignal(options.signal);if(gl.isContextLost?.())throw new Error("WebGL context is lost");const previousBinding=gl.getParameter(gl.TEXTURE_BINDING_2D),texture=gl.createTexture();if(!texture)throw new Error("WebGL could not allocate a texture");try{gl.bindTexture(gl.TEXTURE_2D,texture);if(compressed)data.mipmaps.forEach((mip,level)=>gl.compressedTexImage2D(gl.TEXTURE_2D,level,data.internalFormat,mip.width,mip.height,0,mip.data));else gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,gl.RGBA,gl.UNSIGNED_BYTE,data);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR);const error=gl.getError();if(error!==gl.NO_ERROR)throw new Error(`WebGL texture upload error 0x${error.toString(16)}`)}catch(error){gl.deleteTexture(texture);throw error}finally{gl.bindTexture(gl.TEXTURE_2D,previousBinding)}let disposed=false;return{texture,width:data.width||data.naturalWidth,height:data.height||data.naturalHeight,format:compressed?"astc":"image",dispose(){if(!disposed){disposed=true;gl.deleteTexture(texture)}}}}__name(upload,"upload");try{checkSignal(options.signal);if(!supportsAstc(gl))throw new Error("ASTC is not supported by this WebGL context");const data=parseAstcKtx(await(await fetchChecked(url)).arrayBuffer());const supportedFormats=gl.getParameter(gl.COMPRESSED_TEXTURE_FORMATS);if(!Array.from(supportedFormats??[]).includes(data.internalFormat))throw new Error("This ASTC internal format is unsupported");return upload(data,true)}catch(error){checkSignal(options.signal);if(!options.fallbackUrl||error?.name==="AbortError"||gl.isContextLost?.())throw error;options.onFallback?.(error);const image=await decodeImage2(await(await fetchChecked(options.fallbackUrl)).blob(),{signal:options.signal});try{return upload(image,false)}finally{image.close?.()}}}__name(loadAstcTexture,"loadAstcTexture");export{loadAstcTexture,parseAstcKtx,supportsAstc,toAstcKtxUrl};
|
|
1
|
+
var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:true});function resolveAssetUrl(path,{cdnBaseUrl="",baseUrl}={}){const value=String(path??"").trim();if(!value)throw new TypeError("Asset path must not be empty");if(/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(value))return value;const encoded=encodeURI(value).replace(/%25([\da-f]{2})/gi,"%$1");const localPrefix=/^(?:assets|game|res|cfg|fonts)\//.test(value);if(cdnBaseUrl&&!localPrefix&&(value.startsWith("/Game/")||!/^(?:\/|\.\.?\/)/.test(value))){return`${cdnBaseUrl.replace(/\/+$/,"")}/${encoded.replace(/^\/+/,"")}`}return baseUrl?new URL(encoded,baseUrl).href:encoded}__name(resolveAssetUrl,"resolveAssetUrl");function abortError(){return new DOMException("Asset load cancelled","AbortError")}__name(abortError,"abortError");async function decodeImage(blob,{signal}={}){if(signal?.aborted)throw signal.reason??abortError();if(typeof globalThis.createImageBitmap==="function"){const bitmap=await globalThis.createImageBitmap(blob);if(signal?.aborted){bitmap.close();throw signal.reason??abortError()}return bitmap}if(typeof globalThis.Image!=="function")throw new Error("Image decoding requires createImageBitmap or a browser Image");return new Promise((resolve,reject)=>{const image=new globalThis.Image;const url=URL.createObjectURL(blob);const cleanup=__name(()=>{image.onload=image.onerror=null;signal?.removeEventListener("abort",cancel);URL.revokeObjectURL(url)},"cleanup");const cancel=__name(()=>{cleanup();image.removeAttribute("src");reject(signal.reason??abortError())},"cancel");image.onload=()=>{cleanup();resolve(image)};image.onerror=()=>{cleanup();reject(new Error("Image decode failed"))};signal?.addEventListener("abort",cancel,{once:true});image.src=url})}__name(decodeImage,"decodeImage");function supportsAstc(gl){return Boolean(gl&&!gl.isContextLost?.()&&(gl.getExtension("WEBGL_compressed_texture_astc")||gl.getExtension("WEBKIT_WEBGL_compressed_texture_astc")))}__name(supportsAstc,"supportsAstc");function toAstcKtxUrl(url){if(/^(?:data:|blob:)/i.test(url))return null;const match=String(url).match(/^([^?#]*)([?#].*)?$/);return match&&/\.(?:png|jpe?g)$/i.test(match[1])?`${match[1].replace(/\.(?:png|jpe?g)$/i,".ktx")}${match[2]??""}`:null}__name(toAstcKtxUrl,"toAstcKtxUrl");function parseAstcKtx(buffer){if(!(buffer instanceof ArrayBuffer)||buffer.byteLength<64)throw new TypeError("KTX v1 requires at least 64 bytes");const bytes=new Uint8Array(buffer),magic=[171,75,84,88,32,49,49,187,13,10,26,10];if(!magic.every((value,i)=>bytes[i]===value))throw new Error("Invalid KTX v1 identifier");const view=new DataView(buffer),marker=view.getUint32(12,true);if(marker!==67305985&&marker!==16909060)throw new Error("Invalid KTX byte order");const littleEndian=marker===67305985,read=__name(offset2=>view.getUint32(offset2,littleEndian),"read");const internalFormat=read(28),width=read(36),height=read(40),levels=read(56)||1;const formatIndex=internalFormat>=37808&&internalFormat<=37821?internalFormat-37808:internalFormat>=37840&&internalFormat<=37853?internalFormat-37840:-1;if(formatIndex<0||read(16)!==0||read(20)!==1||read(24)!==0||read(32)!==6408)throw new Error("KTX is not an ASTC RGBA compressed texture");if(!width||!height||read(44)!==0||read(48)!==0||read(52)!==1)throw new Error("Only nonempty 2D, nonarray KTX textures are supported");if(levels>Math.floor(Math.log2(Math.max(width,height)))+1)throw new Error("Invalid KTX mip count");const blockSizes=[[4,4],[5,4],[5,5],[6,5],[6,6],[8,5],[8,6],[8,8],[10,5],[10,6],[10,8],[10,10],[12,10],[12,12]];const[blockWidth,blockHeight]=blockSizes[formatIndex],mipmaps=[];let offset=64+read(60);if(offset%4!==0||offset>buffer.byteLength)throw new Error("Invalid KTX metadata size");for(let level=0;level<levels;level++){if(offset+4>buffer.byteLength)throw new Error("Truncated KTX mip header");const size=read(offset);offset+=4;const mipWidth=Math.max(1,Math.floor(width/2**level)),mipHeight=Math.max(1,Math.floor(height/2**level));const expected=Math.ceil(mipWidth/blockWidth)*Math.ceil(mipHeight/blockHeight)*16;if(size!==expected||offset+size>buffer.byteLength)throw new Error("Invalid or truncated ASTC mip data");mipmaps.push({width:mipWidth,height:mipHeight,data:new Uint8Array(buffer,offset,size)});offset+=size+(4-size%4)%4}return{width,height,internalFormat,mipmaps}}__name(parseAstcKtx,"parseAstcKtx");function checkSignal(signal){if(signal?.aborted)throw signal.reason??new DOMException("Texture load cancelled","AbortError")}__name(checkSignal,"checkSignal");async function loadAstcTexture(gl,url,options={}){if(!gl||typeof gl.createTexture!=="function")throw new TypeError("A WebGL rendering context is required; Canvas 2D is unsupported");if(gl.isContextLost?.())throw new Error("WebGL context is lost");const fetcher=options.fetch??globalThis.fetch,decodeImage2=options.decodeImage??decodeImage;const fetchChecked=__name(async path=>{checkSignal(options.signal);const response=await fetcher(resolveAssetUrl(path,options),{signal:options.signal});if(!response.ok)throw new Error(`HTTP ${response.status} loading ${path}`);return response},"fetchChecked");function upload(data,compressed){checkSignal(options.signal);if(gl.isContextLost?.())throw new Error("WebGL context is lost");const previousBinding=gl.getParameter(gl.TEXTURE_BINDING_2D),texture=gl.createTexture();if(!texture)throw new Error("WebGL could not allocate a texture");try{gl.bindTexture(gl.TEXTURE_2D,texture);if(compressed)data.mipmaps.forEach((mip,level)=>gl.compressedTexImage2D(gl.TEXTURE_2D,level,data.internalFormat,mip.width,mip.height,0,mip.data));else gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,gl.RGBA,gl.UNSIGNED_BYTE,data);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR);const error=gl.getError();if(error!==gl.NO_ERROR)throw new Error(`WebGL texture upload error 0x${error.toString(16)}`)}catch(error){gl.deleteTexture(texture);throw error}finally{gl.bindTexture(gl.TEXTURE_2D,previousBinding)}let disposed=false;return{texture,width:data.width||data.naturalWidth,height:data.height||data.naturalHeight,format:compressed?"astc":"image",dispose(){if(!disposed){disposed=true;gl.deleteTexture(texture)}}}}__name(upload,"upload");try{checkSignal(options.signal);if(!supportsAstc(gl))throw new Error("ASTC is not supported by this WebGL context");const data=parseAstcKtx(await(await fetchChecked(url)).arrayBuffer());const supportedFormats=gl.getParameter(gl.COMPRESSED_TEXTURE_FORMATS);if(!Array.from(supportedFormats??[]).includes(data.internalFormat))throw new Error("This ASTC internal format is unsupported");return upload(data,true)}catch(error){checkSignal(options.signal);if(!options.fallbackUrl||error?.name==="AbortError"||gl.isContextLost?.())throw error;options.onFallback?.(error);const image=await decodeImage2(await(await fetchChecked(options.fallbackUrl)).blob(),{signal:options.signal});try{return upload(image,false)}finally{image.close?.()}}}__name(loadAstcTexture,"loadAstcTexture");export{loadAstcTexture,parseAstcKtx,supportsAstc,toAstcKtxUrl};
|