@vgai/editor 0.2.0 → 0.4.0-canary.20260715.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/assets/axe-C7YBtOuM.js +30 -0
- package/dist/assets/browserAll-DDtGGE48.js +1 -0
- package/dist/assets/create-runtime-DbTlBlKG.js +1 -0
- package/dist/assets/{game-BI111o5f.js → game-BE0r7DMI.js} +3 -3
- package/dist/assets/game-BdTHR2_X.js +1 -0
- package/dist/assets/{game-pt_1lQLv.js → game-C3iQGSqo.js} +1 -1
- package/dist/assets/game-CcHfYxjP.js +1 -0
- package/dist/assets/game-Cqzj_lpD.js +1 -0
- package/dist/assets/game-DSZdeCHu.js +1 -0
- package/dist/assets/game-Dch9sAPc.js +1 -0
- package/dist/assets/{game-xsOho_wg.js → game-SAFn90pA.js} +3 -3
- package/dist/assets/game-loop-DMIgSMV-.js +1 -0
- package/dist/assets/{game-source-CvidN7AB.js → game-source-Dk83w26t.js} +1 -1
- package/dist/assets/{index-Bp5cecD6.js → index-4idIsHHJ.js} +2 -2
- package/dist/assets/{index-DL7RcQ0n.js → index-C-LhOTBN.js} +1 -1
- package/dist/assets/{index-Cs8xwv3e.js → index-CDkxceqE.js} +1 -1
- package/dist/assets/index-CQEfi217.js +15412 -0
- package/dist/assets/index-Dvi-V0NE.css +1 -0
- package/dist/assets/ingest-siblings-s0P5I1Ub.js +1 -0
- package/dist/assets/mount-manifest-DXMOlF79.js +1 -0
- package/dist/assets/react-18-C9eHn8x1.js +1 -0
- package/dist/assets/webworkerAll-Fn0e-ouF.js +1 -0
- package/dist/assets/world-documents-GM0a9Kv7.js +1 -0
- package/dist/index.html +15 -13
- package/dist/ingest/racing-game/vgai.game.json +5 -4
- package/dist/ingest/simcity/vgai.game.json +5 -4
- package/dist/ingest/tanks/vgai.game.json +5 -4
- package/dist/project-scripts.bundle.js +3917 -0
- package/dist/scenes/untitled.vscn.json +2 -0
- package/dist-server/packaged.mjs +7697 -3435
- package/package.json +31 -4
- package/scripts/probe-reporter.ts +349 -0
- package/scripts/run-probe.ts +2260 -0
- package/server/asset-catalog-audit.ts +268 -0
- package/server/asset-catalog-v2.ts +146 -0
- package/server/asset-library-routes.ts +276 -58
- package/server/canonical-path.ts +1 -1
- package/server/dev.ts +148 -44
- package/server/editor-server.ts +888 -61
- package/server/editor-sse.ts +115 -4
- package/server/harness-chat-service.ts +796 -0
- package/server/local-asset-catalog.ts +157 -22
- package/server/packaged.ts +51 -21
- package/server/process-shutdown.ts +136 -0
- package/server/prod.ts +9 -6
- package/server/project-hmr-files.ts +41 -0
- package/server/project-operations.ts +343 -0
- package/server/project-optimize-deps-entries.ts +4 -4
- package/server/project-output-writer.ts +156 -0
- package/server/project-validation.ts +140 -0
- package/server/project-view.ts +8 -50
- package/server/server-utils.ts +75 -10
- package/server/session-registry.ts +12 -0
- package/src/EditorContext.tsx +107 -3
- package/src/action-registry.ts +115 -17
- package/src/adapter-resolver.ts +213 -478
- package/src/asset-events.ts +64 -1
- package/src/asset-preview.ts +906 -0
- package/src/asset-selection.ts +121 -0
- package/src/asset-workflow/asset-capabilities.ts +259 -0
- package/src/asset-workflow/asset-editor-errors.ts +46 -0
- package/src/asset-workflow/asset-import-pipeline.ts +176 -0
- package/src/asset-workflow/asset-library-query.ts +107 -0
- package/src/asset-workflow/asset-types.ts +192 -0
- package/src/asset-workflow/asset-workflow-quality.ts +65 -0
- package/src/asset-workflow/import-contract.ts +113 -0
- package/src/asset-workflow/model-conversion.ts +126 -0
- package/src/asset-workflow/model-inspection.ts +185 -0
- package/src/asset-workflow/project-asset-commands.ts +23 -0
- package/src/asset-workflow/project-asset-health.ts +153 -0
- package/src/asset-workflow/project-asset-operations.ts +119 -0
- package/src/asset-workflow/thumbnail-system.ts +172 -0
- package/src/authoring/active-systems.ts +15 -0
- package/src/authoring/boundary-authoring-adapter.ts +16 -5
- package/src/authoring/composite-authoring-adapter.ts +305 -124
- package/src/authoring/design-time-layers.ts +300 -117
- package/src/authoring/edit-mode-authoring.ts +278 -293
- package/src/authoring/embed-only-adapter.ts +4 -2
- package/src/authoring/first-party-hierarchy-menu.ts +7 -2
- package/src/authoring/first-party-inspector/AddSectionMenu.tsx +5 -12
- package/src/authoring/first-party-inspector/EnvironmentSection.tsx +53 -126
- package/src/authoring/first-party-inspector/HeaderSection.tsx +54 -65
- package/src/authoring/first-party-inspector/is-first-party-selection.ts +30 -11
- package/src/authoring/first-party-inspector/register.tsx +13 -2
- package/src/authoring/ingest-authoring-adapter.ts +142 -45
- package/src/authoring/mount-failure-report.ts +5 -5
- package/src/authoring/provenance.ts +41 -0
- package/src/authoring/react-dom-authoring-adapter.ts +92 -92
- package/src/authoring/react-inspector-section.tsx +489 -51
- package/src/authoring/react-world-authoring-adapter.ts +541 -306
- package/src/authoring/story-overlay.ts +1 -1
- package/src/authoring/story-types.ts +11 -0
- package/src/authoring/vgai-scene-authoring-adapter.ts +54 -25
- package/src/authoring/viewport-tool-context.ts +78 -0
- package/src/authoring/world-canvas-viewport-state.ts +35 -0
- package/src/authoring/world-hidden-viewport.ts +186 -0
- package/src/authoring/world-pan-state.ts +33 -17
- package/src/authoring/world-session-state.ts +1 -1
- package/src/authoring/world2d-authoring-adapter.ts +109 -52
- package/src/availability-tick.ts +56 -0
- package/src/browser-play-entry.ts +5 -5
- package/src/browser-project-scripts.ts +1 -0
- package/src/build-identity.ts +15 -0
- package/src/command-listener.ts +893 -19
- package/src/components/AlignToolbar.tsx +74 -63
- package/src/components/AppRoot.tsx +193 -26
- package/src/components/ApplicationMenus.tsx +272 -0
- package/src/components/AssetBrowser.tsx +1450 -293
- package/src/components/AssetEditorShell.tsx +141 -0
- package/src/components/AssetImportDetails.tsx +218 -0
- package/src/components/AssetLibraryPanel.tsx +14 -0
- package/src/components/CameraInfo.tsx +11 -20
- package/src/components/CenterDocuments.tsx +585 -0
- package/src/components/CommandPalette.tsx +75 -30
- package/src/components/ConsolePanel.css +55 -0
- package/src/components/ConsolePanel.tsx +57 -112
- package/src/components/DebugConsolePanel.tsx +461 -0
- package/src/components/DebuggerPanel.tsx +165 -0
- package/src/components/DefaultEditorLayout.tsx +167 -231
- package/src/components/GameHierarchy.tsx +873 -290
- package/src/components/GamePerformanceOverlay.tsx +46 -0
- package/src/components/HarnessChatPanel.tsx +2352 -0
- package/src/components/HistoryPanel.tsx +226 -0
- package/src/components/Inspector.tsx +153 -99
- package/src/components/InspectorToolSection.tsx +6 -4
- package/src/components/MountFailureBanner.tsx +31 -48
- package/src/components/NetworkSection.tsx +25 -14
- package/src/components/OnlineAssetBrowser.tsx +794 -343
- package/src/components/OverlayReportBanner.tsx +38 -64
- package/src/components/PerformancePanel.tsx +206 -0
- package/src/components/PlayBar.tsx +93 -263
- package/src/components/PrefabSaveDialog.tsx +55 -127
- package/src/components/ProjectHeader.css +60 -0
- package/src/components/ProjectHeader.tsx +170 -105
- package/src/components/ProjectScreen.tsx +246 -184
- package/src/components/ReactCanvasControls.tsx +185 -0
- package/src/components/ResolutionPicker.tsx +85 -0
- package/src/components/RootActivateDialog.tsx +39 -68
- package/src/components/SaveDialog.tsx +55 -127
- package/src/components/SaveStatus.tsx +11 -29
- package/src/components/StartupLoadingScreen.tsx +96 -0
- package/src/components/StateWatchPanel.tsx +302 -0
- package/src/components/StatsOverlay.tsx +12 -5
- package/src/components/StatusBar.tsx +64 -0
- package/src/components/ThemeManagerDialog.css +89 -0
- package/src/components/ThemeManagerDialog.tsx +371 -0
- package/src/components/ToolHost.tsx +26 -15
- package/src/components/Toolbar.tsx +117 -214
- package/src/components/VgaiVoxelLogo.tsx +89 -0
- package/src/components/ViewportOverlay.tsx +97 -172
- package/src/components/ViewportPanel.tsx +130 -31
- package/src/components/WorkspaceDock.tsx +891 -0
- package/src/components/WorldSelectionOverlay.tsx +51 -63
- package/src/components/WorldTextEditor.tsx +9 -5
- package/src/components/asset-documents.tsx +390 -0
- package/src/components/asset-editor-persistence.ts +44 -0
- package/src/components/asset-selection-section.tsx +338 -0
- package/src/components/asset-viewers/AudioViewer.tsx +73 -21
- package/src/components/asset-viewers/GenericJsonViewer.tsx +26 -11
- package/src/components/asset-viewers/ImageViewer.tsx +43 -11
- package/src/components/asset-viewers/InputMapViewer.tsx +512 -134
- package/src/components/asset-viewers/MaterialAssetEditor.tsx +540 -0
- package/src/components/asset-viewers/ModelViewer.tsx +805 -121
- package/src/components/asset-viewers/OnlineAssetDetail.tsx +177 -60
- package/src/components/asset-viewers/SourceAssetViewer.tsx +121 -0
- package/src/components/asset-workflow.css +506 -0
- package/src/components/build-documents.tsx +696 -0
- package/src/components/core-utilities.tsx +75 -0
- package/src/components/data-documents.tsx +364 -0
- package/src/components/{DataPanel.tsx → data-editor.tsx} +138 -288
- package/src/components/debugger-panel-state.ts +57 -0
- package/src/components/inspector-widgets/AlignmentGrid.tsx +8 -14
- package/src/components/inspector-widgets/BorderEditor.tsx +41 -33
- package/src/components/inspector-widgets/ColorPicker.tsx +39 -39
- package/src/components/inspector-widgets/FontPicker.tsx +13 -21
- package/src/components/inspector-widgets/GradientEditor.tsx +11 -19
- package/src/components/inspector-widgets/ScrubbableInput.tsx +6 -3
- package/src/components/inspector-widgets/ShadowEditor.tsx +20 -33
- package/src/components/inspector-widgets/shared.tsx +90 -49
- package/src/components/inspectors/AnimationSection.tsx +39 -40
- package/src/components/inspectors/AudioSection.tsx +28 -39
- package/src/components/inspectors/BoneAttachmentSection.tsx +19 -24
- package/src/components/inspectors/CameraSection.tsx +14 -23
- package/src/components/inspectors/ComponentsSection.tsx +39 -43
- package/src/components/inspectors/JointsSection.tsx +34 -43
- package/src/components/inspectors/LightSection.tsx +90 -35
- package/src/components/inspectors/MaterialSection.tsx +137 -174
- package/src/components/inspectors/MeshSection.tsx +9 -17
- package/src/components/inspectors/NavigationSection.tsx +8 -15
- package/src/components/inspectors/ParticleSection.tsx +91 -76
- package/src/components/inspectors/PhysicsSection.tsx +42 -46
- package/src/components/inspectors/PostProcessingSection.tsx +28 -36
- package/src/components/inspectors/RenderingSection.tsx +12 -20
- package/src/components/inspectors/ShadowSection.tsx +7 -8
- package/src/components/inspectors/SplineSection.tsx +31 -42
- package/src/components/inspectors/TransformSection.tsx +14 -22
- package/src/components/patterns/Dialog.tsx +95 -0
- package/src/components/patterns/Fields.tsx +44 -0
- package/src/components/patterns/List.tsx +25 -0
- package/src/components/patterns/StateSurface.tsx +40 -0
- package/src/components/patterns/Surfaces.tsx +115 -0
- package/src/components/patterns/Tabs.tsx +80 -0
- package/src/components/patterns/Toolbar.tsx +51 -0
- package/src/components/patterns/Tree.tsx +72 -0
- package/src/components/primitives/Button.tsx +46 -0
- package/src/components/primitives/ColorInput.tsx +11 -47
- package/src/components/primitives/EditorIcon.tsx +99 -0
- package/src/components/primitives/FormControls.tsx +71 -0
- package/src/components/primitives/JsonInput.tsx +15 -2
- package/src/components/primitives/Layout.tsx +100 -0
- package/src/components/primitives/Menu.tsx +105 -0
- package/src/components/primitives/NumberInput.tsx +8 -35
- package/src/components/primitives/Panel.tsx +49 -44
- package/src/components/primitives/SectionHeader.tsx +10 -28
- package/src/components/primitives/Text.tsx +46 -0
- package/src/components/primitives/Tooltip.tsx +20 -12
- package/src/components/primitives/Vec3Input.tsx +3 -0
- package/src/components/primitives/banner-tones.ts +33 -0
- package/src/components/primitives/editor-icons.ts +102 -0
- package/src/components/primitives/panel-header-styles.ts +30 -0
- package/src/components/project-operation-documents.tsx +226 -0
- package/src/components/status-contributions.tsx +175 -0
- package/src/components/story-documents-register.ts +15 -0
- package/src/components/story-documents.tsx +1185 -0
- package/src/components/tool-documents.tsx +110 -0
- package/src/components/workspace-dock.css +293 -0
- package/src/components/workspace-history.ts +33 -0
- package/src/components/world-documents.tsx +145 -0
- package/src/components/xstate-documents.tsx +209 -0
- package/src/composite-screenshot.ts +248 -0
- package/src/design-system/index.ts +70 -0
- package/src/design-system-stories/Foundation.stories.tsx +183 -0
- package/src/design-system-stories/Patterns.stories.tsx +251 -0
- package/src/design-system-stories/Workspace.stories.tsx +538 -0
- package/src/doctor/report.ts +57 -13
- package/src/editor-api.ts +295 -31
- package/src/editor-compatibility.ts +200 -0
- package/src/editor-console.ts +35 -17
- package/src/editor-hotkeys.ts +85 -33
- package/src/editor-store.ts +538 -233
- package/src/editor-viewport.ts +160 -34
- package/src/entity-factory.ts +14 -3
- package/src/gizmo-registry.ts +21 -5
- package/src/harness-chat-editor-context.ts +37 -0
- package/src/harness-chat-indicator.ts +68 -0
- package/src/harness-chat-layout.ts +53 -0
- package/src/harness-chat-lifecycle.ts +170 -0
- package/src/harness-chat-reconnect.ts +85 -0
- package/src/harness-chat-types.ts +409 -0
- package/src/hierarchy-drop.ts +50 -0
- package/src/hierarchy-expansion-state.ts +100 -0
- package/src/hierarchy-menu-registry.ts +1 -1
- package/src/hierarchy-projection.ts +76 -0
- package/src/history/editor-session.ts +21 -0
- package/src/history/history-commands.ts +147 -0
- package/src/history/history-service.ts +904 -0
- package/src/history/json-history-resource.ts +165 -0
- package/src/history/persistence-coordinator.ts +35 -0
- package/src/history/project-file-history.ts +266 -0
- package/src/history/project-root-history-backends.ts +53 -0
- package/src/history/resource-registry.ts +209 -0
- package/src/history/snapshot-store.ts +108 -0
- package/src/history/source-history-backend.ts +374 -0
- package/src/history/types.ts +100 -0
- package/src/hmr-registration-group.ts +67 -0
- package/src/hmr-stable-react-context.ts +23 -0
- package/src/hosted-example.ts +12 -2
- package/src/hotkeys.ts +89 -18
- package/src/ingest/discovery-react.ts +9 -10
- package/src/ingest/discovery.ts +4 -4
- package/src/ingest/discovery2d.ts +5 -5
- package/src/ingest/games/bloom-composer/vgai.game.json +3 -3
- package/src/ingest/games/embed-bundle/vgai.game.json +3 -3
- package/src/ingest/games/games-fps/vgai.game.json +3 -3
- package/src/ingest/games/iframe-reachable/vgai.game.json +3 -3
- package/src/ingest/games/interactive-cubes/vgai.game.json +3 -3
- package/src/ingest/games/mismatched-three/vgai.game.json +3 -3
- package/src/ingest/games/own-three-bundled/vgai.game.json +3 -3
- package/src/ingest/games/pointerlock-maze/vgai.game.json +7 -4
- package/src/ingest/games-2d/bubbo-bubbo/vgai.game.json +3 -3
- package/src/ingest/games-2d/bunnymark/vgai.game.json +3 -3
- package/src/ingest/games-2d/flappy/vgai.game.json +3 -3
- package/src/ingest/games-2d/flappy-pixi/vgai.game.json +3 -3
- package/src/ingest/games-2d/puzzling-potions/vgai.game.json +3 -3
- package/src/ingest/games-2d/tilemap-camera/vgai.game.json +3 -3
- package/src/ingest/games-react/react-rpg/vgai.game.json +3 -3
- package/src/ingest/types.ts +1 -1
- package/src/ingest-mode.ts +47 -52
- package/src/ingest-siblings.ts +23 -33
- package/src/initial-scene.ts +1 -2
- package/src/main.tsx +16 -8
- package/src/manifest-project.ts +10 -12
- package/src/model-thumbnail.ts +261 -26
- package/src/module-mode.ts +44 -50
- package/src/play-log-events.ts +26 -0
- package/src/play-mode.ts +495 -401
- package/src/play-scene-adoption.ts +23 -0
- package/src/playground/main.ts +68 -24
- package/src/playwright-shim.ts +473 -0
- package/src/project-manager.ts +90 -10
- package/src/project-operations.ts +112 -0
- package/src/project-story-discovery.ts +25 -0
- package/src/project-tool-discovery.ts +43 -0
- package/src/scene-serializer.ts +0 -6
- package/src/scene-sync.ts +7 -2
- package/src/script-loader.ts +3 -3
- package/src/skeleton-helper.ts +57 -0
- package/src/storage/seed.ts +68 -8
- package/src/stories/StoryPreviewMount.tsx +265 -0
- package/src/stories/action-stories.fixture.tsx +44 -0
- package/src/stories/button-stories.fixture.tsx +50 -0
- package/src/stories/compose-project-stories.ts +182 -0
- package/src/stories/loader-stories.fixture.tsx +53 -0
- package/src/stories/story-discovery.ts +130 -0
- package/src/stories/story-registry.ts +146 -0
- package/src/theme-css.ts +1049 -0
- package/src/theme-library.ts +238 -0
- package/src/theme-preference.ts +130 -0
- package/src/theme.ts +527 -0
- package/src/tool-loader.ts +80 -24
- package/src/ui-source/inspect.ts +27 -4
- package/src/ui-source/source-write-backend.ts +83 -22
- package/src/widgets/index.ts +9 -18
- package/src/workspace-aux-commands.ts +11 -0
- package/src/workspace-dock-controller.ts +64 -0
- package/src/workspace-document-ids.ts +5 -0
- package/src/workspace-document-registry.ts +367 -0
- package/src/workspace-state-persistence.ts +455 -0
- package/src/workspace-status-registry.ts +110 -0
- package/src/workspace-utility-commands.ts +49 -0
- package/src/workspace-utility-registry.ts +161 -0
- package/src/world-document-routing.ts +16 -0
- package/src/xstate-inspect/XStateMachineInspector.tsx +544 -0
- package/src/xstate-inspect/character-animation-machine.fixture.ts +74 -0
- package/src/xstate-inspect/use-live-actor-state.ts +39 -0
- package/src/xstate-inspect/xstate-graph.ts +265 -0
- package/src/xstate-inspect/xstate-layout.ts +76 -0
- package/src/z-index.ts +26 -0
- package/template/.claude/skills/editor/SKILL.md +129 -90
- package/template/AGENTS.md +1110 -0
- package/template/CLAUDE.md +1 -512
- package/template/IDIOMS.md +50 -0
- package/template/check-idioms.ts +706 -0
- package/template/manifest-entry-modules-plugin.ts +53 -0
- package/template/package.json +13 -4
- package/template/public/scenes/default.scn2d.json +6 -0
- package/template/public/scenes/default.vscn.json +7 -1
- package/template/public/scenes/untitled.vscn.json +10 -0
- package/template/scripts/playtest.ts +40 -0
- package/template/server/loopback.ts +75 -0
- package/template/server/rooms/arena-room.ts +69 -1
- package/template/server/rooms/game-room.ts +68 -1
- package/template/src/data/README.md +9 -4
- package/template/src/data/data-ref.ts +35 -0
- package/template/src/data/tuning.schema.ts +1 -1
- package/template/src/main.ts +41 -62
- package/template/src/manifest-entry-modules.d.ts +3 -0
- package/template/src/operations/README.md +88 -0
- package/template/src/runtime/pixi-adapter.ts +24 -0
- package/template/src/scripts/components/data-spinner.ts +43 -2
- package/template/src/scripts/components/spin-lap-math.ts +27 -0
- package/template/src/tools/README.md +5 -3
- package/template/src/tools/example.tool.tsx +13 -7
- package/template/src/ui/Button.stories.tsx +66 -0
- package/template/src/ui/RebindPanel.tsx +2 -6
- package/template/src/ui/game.tsx +17 -0
- package/template/tests/acceptance/example.spec.ts +64 -0
- package/template/tests/logic/example.test.ts +31 -0
- package/template/tests/logic/room.test.ts +100 -0
- package/template/tests/tsconfig.json +30 -0
- package/template/validate-manifest.ts +5 -5
- package/template/validate-scenes.ts +50 -18
- package/template/vgai.game.json +20 -13
- package/template/vite.config.ts +77 -16
- package/vite-plugin-ui-oid.ts +261 -17
- package/dist/assets/CCDIKSolver-Dz-ysxZF.js +0 -1
- package/dist/assets/SelectionBox-BXsv_6aH.js +0 -1
- package/dist/assets/browser-project-scripts-DOru4L1x.js +0 -2
- package/dist/assets/browserAll-CEkWYlFk.js +0 -1
- package/dist/assets/create-runtime-DYIWr3va.js +0 -1
- package/dist/assets/data-asset-Bb9sIM7i.js +0 -5
- package/dist/assets/game-8SDZPPgH.js +0 -1
- package/dist/assets/game-CevorxyV.js +0 -1
- package/dist/assets/game-Di7XlywD.js +0 -1
- package/dist/assets/game-DjnCaw8R.js +0 -1
- package/dist/assets/game-Q9A0aXSV.js +0 -1
- package/dist/assets/index-CPVV6pjw.js +0 -1
- package/dist/assets/index-CpOnYyeD.js +0 -213
- package/dist/assets/index-Dr8H_6Rl.js +0 -1
- package/dist/assets/index-_bCaipUk.js +0 -13650
- package/dist/assets/ingest-siblings-Dz8eEqrV.js +0 -1
- package/dist/assets/mount-manifest-Bhk0ohsl.js +0 -1
- package/dist/assets/scene-query-BivAHhJu.js +0 -1
- package/dist/assets/webworkerAll-BLrH0F6F.js +0 -1
- package/dist/assets/xstate-animation-binding-1NGLmw6y.js +0 -1
- package/dist/assets/xstate.esm-BgUD33nl.js +0 -3
- package/src/authoring/scene-ui-layer.ts +0 -485
- package/src/authoring/ui-authoring-adapter.ts +0 -325
- package/src/authoring/ui-hierarchy-menu.ts +0 -40
- package/src/authoring/ui-inspector-sections.tsx +0 -156
- package/src/authoring/undo-timeline.ts +0 -145
- package/src/components/BottomPanel.tsx +0 -326
- package/src/components/BuildPanel.tsx +0 -455
- package/src/components/FolderTree.tsx +0 -179
- package/src/components/RightPanel.tsx +0 -166
- package/src/components/WorldContextMenu.tsx +0 -257
- package/src/components/asset-viewers/AssetViewer.tsx +0 -38
- package/src/ingest/games-react/react-rpg/src/ui/game-state.tsx +0 -129
- package/src/scene-ui-mode/active-scene-ui.ts +0 -58
- package/src/scene-ui-mode/scene-ui-palette-panel.tsx +0 -152
- package/src/scene-ui-mode/scene-ui-timeline-tab.tsx +0 -29
- package/src/scene-ui-mode/ui-prefab-dialog-host.tsx +0 -74
- package/src/scene-ui-mode/ui-prefab-hierarchy-menu.ts +0 -49
- package/src/scene-ui-mode/ui-prefab-io.ts +0 -76
- package/src/ui-editor/inspector.tsx +0 -563
- package/src/ui-editor/node-ops.ts +0 -266
- package/src/ui-editor/overlay.tsx +0 -380
- package/src/ui-editor/palette.tsx +0 -114
- package/src/ui-editor/react-store.ts +0 -78
- package/src/ui-editor/timeline-panel.tsx +0 -443
- package/src/ui-editor/ui-edit-store.ts +0 -552
- package/src/ui-editor/ui-prefab.ts +0 -95
- package/template/project.json +0 -9
- package/template/src/scripts/main.ts +0 -94
- package/template/src/ui/DefaultHud.tsx +0 -40
- package/template/src/ui/game-state.tsx +0 -37
- package/template/src/ui/mount-default-hud.tsx +0 -19
- package/template/src/ui/mount-ui.ts +0 -15
- package/vite-plugin-react-world-provider.ts +0 -81
package/vite-plugin-ui-oid.ts
CHANGED
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
|
|
68
68
|
import { createHash } from 'node:crypto';
|
|
69
69
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
70
|
-
import { dirname, join } from 'node:path';
|
|
70
|
+
import { basename, dirname, isAbsolute, join, relative } from 'node:path';
|
|
71
71
|
import type { Plugin } from 'vite';
|
|
72
72
|
import { lineColToOffset, OidStore, transformSource } from './src/ui-source/oid-transform';
|
|
73
73
|
import {
|
|
@@ -97,7 +97,7 @@ const EDITABLE_COMPONENTS_RE = /\/ui-editor\/editable-components\/.*\.tsx$/;
|
|
|
97
97
|
const VENDOR_RE = /\/vendor\//;
|
|
98
98
|
|
|
99
99
|
/** True if a parsed `vgai.game.json` body declares at least one
|
|
100
|
-
*
|
|
100
|
+
* React root with an `{ ingest }` adapter (strategy-agnostic;
|
|
101
101
|
* `strategy` — every ingest-react strategy is D-N8 no-authoring today, and
|
|
102
102
|
* a future strategy should not silently reopen the hole). Defensive against
|
|
103
103
|
* any shape (never trusts the manifest is even an object) — this is a
|
|
@@ -106,14 +106,18 @@ const VENDOR_RE = /\/vendor\//;
|
|
|
106
106
|
* from this vite-config-time, dependency-light file by design). */
|
|
107
107
|
function manifestDeclaresIngestReactWorld(parsed: unknown): boolean {
|
|
108
108
|
if (!parsed || typeof parsed !== 'object') return false;
|
|
109
|
-
const
|
|
110
|
-
if (!Array.isArray(
|
|
111
|
-
return
|
|
109
|
+
const roots = (parsed as { roots?: unknown }).roots;
|
|
110
|
+
if (!Array.isArray(roots)) return false;
|
|
111
|
+
return roots.some((entry) => {
|
|
112
112
|
if (!entry || typeof entry !== 'object') return false;
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
const root = entry as { adapter?: unknown };
|
|
114
|
+
const { adapter } = root;
|
|
115
|
+
return (
|
|
116
|
+
!!adapter &&
|
|
117
|
+
typeof adapter === 'object' &&
|
|
118
|
+
(adapter as { surface?: unknown }).surface === 'react' &&
|
|
119
|
+
'ingest' in adapter
|
|
120
|
+
);
|
|
117
121
|
});
|
|
118
122
|
}
|
|
119
123
|
|
|
@@ -182,17 +186,32 @@ function sha256(text: string): string {
|
|
|
182
186
|
return createHash('sha256').update(text, 'utf8').digest('hex');
|
|
183
187
|
}
|
|
184
188
|
|
|
189
|
+
/** Stable, registry-safe identity for a source file. Project files retain their
|
|
190
|
+
* human-readable relative path. An explicitly allowed file outside the Vite
|
|
191
|
+
* root gets a non-leaking synthetic path instead of an invalid `../…` key. */
|
|
192
|
+
function sourceResourcePath(file: string, projectRoot: string): string {
|
|
193
|
+
const path = relative(projectRoot, file).replace(/\\/g, '/');
|
|
194
|
+
if (path && path !== '..' && !path.startsWith('../') && !isAbsolute(path)) return path;
|
|
195
|
+
const identity = createHash('sha256').update(file).digest('hex').slice(0, 16);
|
|
196
|
+
return `.vgai/external-source/${identity}/${basename(file)}`;
|
|
197
|
+
}
|
|
198
|
+
|
|
185
199
|
/** Default `include` predicate (see the module doc comment above for the reasoning). */
|
|
186
200
|
export function defaultProjectScopeInclude(id: string): boolean {
|
|
187
|
-
|
|
188
|
-
if (
|
|
189
|
-
if (
|
|
190
|
-
if (
|
|
191
|
-
if (
|
|
192
|
-
if (
|
|
201
|
+
const clean = (id.split('?')[0] ?? id).replace(/\\/g, '/');
|
|
202
|
+
if (!clean.endsWith('.tsx')) return false;
|
|
203
|
+
if (NODE_MODULES_RE.test(clean)) return false;
|
|
204
|
+
if (VENDOR_RE.test(clean)) return false;
|
|
205
|
+
if (TOOLING_SRC_RE.test(clean)) return false;
|
|
206
|
+
if (EDITOR_SRC_RE.test(clean) && !EDITABLE_COMPONENTS_RE.test(clean)) return false;
|
|
207
|
+
if (nearestManifestExcludesIngestReact(dirname(clean))) return false;
|
|
193
208
|
return true;
|
|
194
209
|
}
|
|
195
210
|
|
|
211
|
+
function isEditableSourceFile(id: string): boolean {
|
|
212
|
+
return defaultProjectScopeInclude(id) || isEditableCssFile(id);
|
|
213
|
+
}
|
|
214
|
+
|
|
196
215
|
/**
|
|
197
216
|
* D-A3 (wave 13, `docs/WAVE13-JSX-SPREAD-UNDO-DESIGN.md`): route a
|
|
198
217
|
* `/__ui-source/write` body to the write-or-remove writer call — a `value: null`
|
|
@@ -219,6 +238,229 @@ export interface HandlerResult {
|
|
|
219
238
|
body: unknown;
|
|
220
239
|
}
|
|
221
240
|
|
|
241
|
+
function preparedSource(
|
|
242
|
+
file: string,
|
|
243
|
+
prevSource: string,
|
|
244
|
+
newSource: string,
|
|
245
|
+
result: Record<string, unknown>,
|
|
246
|
+
projectRoot: string,
|
|
247
|
+
): HandlerResult {
|
|
248
|
+
const changed = prevSource !== newSource && result['changed'] !== false;
|
|
249
|
+
return {
|
|
250
|
+
body: {
|
|
251
|
+
changed,
|
|
252
|
+
file,
|
|
253
|
+
resourcePath: sourceResourcePath(file, projectRoot),
|
|
254
|
+
...(changed
|
|
255
|
+
? {
|
|
256
|
+
prevSource,
|
|
257
|
+
newSource,
|
|
258
|
+
prevSha: sha256(prevSource),
|
|
259
|
+
newSha: sha256(newSource),
|
|
260
|
+
}
|
|
261
|
+
: {}),
|
|
262
|
+
result: { ...result, changed, file },
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/** Pure source edit preparation: computes exact bytes and hashes, never writes. */
|
|
268
|
+
export function handlePrepare(
|
|
269
|
+
store: OidStore,
|
|
270
|
+
body: Record<string, unknown>,
|
|
271
|
+
projectRoot = process.cwd(),
|
|
272
|
+
): HandlerResult {
|
|
273
|
+
const kind = body['kind'];
|
|
274
|
+
if (kind === 'css') {
|
|
275
|
+
const { file, selector, prop, value } = body as {
|
|
276
|
+
file: string;
|
|
277
|
+
selector: string;
|
|
278
|
+
prop: string;
|
|
279
|
+
value: string;
|
|
280
|
+
};
|
|
281
|
+
if (!file || !isEditableCssFile(file)) {
|
|
282
|
+
return {
|
|
283
|
+
status: 403,
|
|
284
|
+
body: { changed: false, result: { error: 'css file out of editable scope' } },
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
const cleanFile = file.split('?')[0] ?? file;
|
|
288
|
+
const src = readFileSync(cleanFile, 'utf8');
|
|
289
|
+
const edited = surgicalCssEdit(src, selector, prop, value);
|
|
290
|
+
if (edited === null) {
|
|
291
|
+
return preparedSource(cleanFile, src, src, { changed: false, generated: true }, projectRoot);
|
|
292
|
+
}
|
|
293
|
+
return preparedSource(cleanFile, src, edited, { changed: edited !== src }, projectRoot);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (kind === 'struct-many') {
|
|
297
|
+
const { oids, op } = body as { oids?: unknown; op?: string };
|
|
298
|
+
if (op !== 'delete' || !Array.isArray(oids) || oids.length === 0) {
|
|
299
|
+
return { body: { changed: false, result: { error: 'invalid struct-many request' } } };
|
|
300
|
+
}
|
|
301
|
+
const entries = [...new Set(oids as string[])].map((oid) => ({
|
|
302
|
+
oid,
|
|
303
|
+
entry: store.index.get(oid),
|
|
304
|
+
}));
|
|
305
|
+
const missing = entries.find((item) => !item.entry);
|
|
306
|
+
if (missing)
|
|
307
|
+
return { body: { changed: false, result: { error: `unknown oid: ${missing.oid}` } } };
|
|
308
|
+
const file = entries[0]!.entry!.file;
|
|
309
|
+
if (entries.some((item) => item.entry!.file !== file)) {
|
|
310
|
+
return { body: { changed: false, result: { error: 'cannot batch-delete across files' } } };
|
|
311
|
+
}
|
|
312
|
+
const src = readFileSync(file, 'utf8');
|
|
313
|
+
const offsets = entries.map((item) => lineColToOffset(src, item.entry!.line, item.entry!.col));
|
|
314
|
+
const result = deleteElements(src, offsets);
|
|
315
|
+
return preparedSource(file, src, result.code, { changed: result.changed }, projectRoot);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
const oid = body['oid'];
|
|
319
|
+
if (typeof oid !== 'string') {
|
|
320
|
+
return { body: { changed: false, result: { error: 'oid is required' } } };
|
|
321
|
+
}
|
|
322
|
+
const entry = store.index.get(oid);
|
|
323
|
+
if (!entry) return { body: { changed: false, result: { error: 'unknown oid' } } };
|
|
324
|
+
const src = readFileSync(entry.file, 'utf8');
|
|
325
|
+
const off = lineColToOffset(src, entry.line, entry.col);
|
|
326
|
+
|
|
327
|
+
if (kind === 'style') {
|
|
328
|
+
const result = applyStyleWriteRequest(
|
|
329
|
+
src,
|
|
330
|
+
off,
|
|
331
|
+
String(body['prop']),
|
|
332
|
+
body['value'] === null ? null : String(body['value']),
|
|
333
|
+
);
|
|
334
|
+
return preparedSource(
|
|
335
|
+
entry.file,
|
|
336
|
+
src,
|
|
337
|
+
result.code,
|
|
338
|
+
{
|
|
339
|
+
changed: result.changed,
|
|
340
|
+
dynamic: result.dynamic,
|
|
341
|
+
route: result.route,
|
|
342
|
+
appended: result.appended,
|
|
343
|
+
},
|
|
344
|
+
projectRoot,
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
if (kind === 'text') {
|
|
348
|
+
const prevText = getEditableText(src, off);
|
|
349
|
+
const result = editTextContent(src, off, String(body['text']));
|
|
350
|
+
return preparedSource(
|
|
351
|
+
entry.file,
|
|
352
|
+
src,
|
|
353
|
+
result.code,
|
|
354
|
+
{
|
|
355
|
+
changed: result.changed,
|
|
356
|
+
dynamic: result.dynamic,
|
|
357
|
+
prevText,
|
|
358
|
+
},
|
|
359
|
+
projectRoot,
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
if (kind === 'prop') {
|
|
363
|
+
const result = writePropChange(src, off, String(body['prop']), String(body['value']));
|
|
364
|
+
return preparedSource(
|
|
365
|
+
entry.file,
|
|
366
|
+
src,
|
|
367
|
+
result.code,
|
|
368
|
+
{
|
|
369
|
+
changed: result.changed,
|
|
370
|
+
dynamic: result.dynamic,
|
|
371
|
+
},
|
|
372
|
+
projectRoot,
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
if (kind === 'struct') {
|
|
376
|
+
const resolve = (id: unknown): number | null | 'cross-file' => {
|
|
377
|
+
if (typeof id !== 'string') return null;
|
|
378
|
+
const companion = store.index.get(id);
|
|
379
|
+
if (!companion) return null;
|
|
380
|
+
if (companion.file !== entry.file) return 'cross-file';
|
|
381
|
+
return lineColToOffset(src, companion.line, companion.col);
|
|
382
|
+
};
|
|
383
|
+
const target = resolve(body['targetOid']);
|
|
384
|
+
const parent = resolve(body['parentOid']);
|
|
385
|
+
if (target === 'cross-file' || parent === 'cross-file') {
|
|
386
|
+
return preparedSource(
|
|
387
|
+
entry.file,
|
|
388
|
+
src,
|
|
389
|
+
src,
|
|
390
|
+
{
|
|
391
|
+
changed: false,
|
|
392
|
+
error: 'cannot move across files',
|
|
393
|
+
},
|
|
394
|
+
projectRoot,
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
let result: StructEditResult;
|
|
398
|
+
switch (body['op']) {
|
|
399
|
+
case 'delete':
|
|
400
|
+
result = deleteElement(src, off);
|
|
401
|
+
break;
|
|
402
|
+
case 'duplicate':
|
|
403
|
+
result = duplicateElement(src, off);
|
|
404
|
+
break;
|
|
405
|
+
case 'wrap':
|
|
406
|
+
result = wrapElement(src, off, String(body['wrapperTag'] ?? 'div'));
|
|
407
|
+
break;
|
|
408
|
+
case 'unwrap':
|
|
409
|
+
result = unwrapElement(src, off);
|
|
410
|
+
break;
|
|
411
|
+
case 'create':
|
|
412
|
+
result = insertChildElement(src, off, String(body['wrapperTag'] ?? 'div'));
|
|
413
|
+
break;
|
|
414
|
+
case 'reorder':
|
|
415
|
+
result = reorderChild(src, off, target, parent);
|
|
416
|
+
break;
|
|
417
|
+
case 'reparent':
|
|
418
|
+
result = parent == null ? { code: src, changed: false } : reparentElement(src, off, parent);
|
|
419
|
+
break;
|
|
420
|
+
default:
|
|
421
|
+
return preparedSource(
|
|
422
|
+
entry.file,
|
|
423
|
+
src,
|
|
424
|
+
src,
|
|
425
|
+
{
|
|
426
|
+
changed: false,
|
|
427
|
+
error: `unknown struct op: ${String(body['op'])}`,
|
|
428
|
+
},
|
|
429
|
+
projectRoot,
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
return preparedSource(entry.file, src, result.code, { changed: result.changed }, projectRoot);
|
|
433
|
+
}
|
|
434
|
+
return { body: { changed: false, result: { error: `unknown prepare kind: ${String(kind)}` } } };
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
export function handleSourceRead(
|
|
438
|
+
body: Record<string, unknown>,
|
|
439
|
+
projectRoot = process.cwd(),
|
|
440
|
+
): HandlerResult {
|
|
441
|
+
const file = body['file'];
|
|
442
|
+
if (typeof file !== 'string' || !isEditableSourceFile(file)) {
|
|
443
|
+
return { status: 403, body: { error: 'file out of editable scope' } };
|
|
444
|
+
}
|
|
445
|
+
const source = readFileSync(file, 'utf8');
|
|
446
|
+
return {
|
|
447
|
+
body: {
|
|
448
|
+
source,
|
|
449
|
+
sha: sha256(source),
|
|
450
|
+
resourcePath: sourceResourcePath(file, projectRoot),
|
|
451
|
+
},
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export function handleSourceApply(body: Record<string, unknown>): HandlerResult {
|
|
456
|
+
const restored = handleRestore(body);
|
|
457
|
+
const value = restored.body as { restored: boolean; sha?: string; error?: string };
|
|
458
|
+
return {
|
|
459
|
+
...(restored.status ? { status: restored.status } : {}),
|
|
460
|
+
body: { applied: value.restored, sha: value.sha, error: value.error },
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
|
|
222
464
|
/** POST `/__ui-source/write` — surgical inline-style/className edit (F5 routing).
|
|
223
465
|
* D-A3 (wave 13): a `value: null` body is the REMOVAL sentinel — routed via
|
|
224
466
|
* `applyStyleWriteRequest` to `removeInlineStyle` (append-aware undo); `appended`
|
|
@@ -468,7 +710,7 @@ export function handleRestore(body: Record<string, unknown>): HandlerResult {
|
|
|
468
710
|
source: string;
|
|
469
711
|
ifMatchSha: string;
|
|
470
712
|
};
|
|
471
|
-
if (!file || !
|
|
713
|
+
if (!file || !isEditableSourceFile(file)) {
|
|
472
714
|
return { status: 403, body: { restored: false, error: 'file out of editable scope' } };
|
|
473
715
|
}
|
|
474
716
|
let current: string;
|
|
@@ -541,13 +783,15 @@ export function uiOidPlugin(
|
|
|
541
783
|
};
|
|
542
784
|
// POST route table — keeps the dispatcher flat (one lookup, no per-endpoint branch).
|
|
543
785
|
const postRoutes: Record<string, (body: Record<string, unknown>) => HandlerResult> = {
|
|
786
|
+
'/__ui-source/prepare': (b) => handlePrepare(store, b, server.config.root),
|
|
787
|
+
'/__ui-source/read': (b) => handleSourceRead(b, server.config.root),
|
|
788
|
+
'/__ui-source/apply': handleSourceApply,
|
|
544
789
|
'/__ui-source/write': (b) => handleWrite(store, b),
|
|
545
790
|
'/__ui-source/css': handleCss,
|
|
546
791
|
'/__ui-source/text': (b) => handleText(store, b),
|
|
547
792
|
'/__ui-source/prop': (b) => handleProp(store, b),
|
|
548
793
|
'/__ui-source/struct': (b) => handleStruct(store, b),
|
|
549
794
|
'/__ui-source/struct-many': (b) => handleStructMany(store, b),
|
|
550
|
-
'/__ui-source/restore': handleRestore,
|
|
551
795
|
};
|
|
552
796
|
server.middlewares.use(async (req, res, next) => {
|
|
553
797
|
const url = (req.url ?? '').split('?')[0] ?? '';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ad as T,U as q,ae as S,L as _,af as z,ab as E,a9 as m,ac as C,N as j,ag as D,ah as O,ai as Q}from"./index-_bCaipUk.js";const L=new C,P=new m,y=new m,V=new m,b=new m,v=new m,A=new C,H=new m,B=new m,G=new m,k=new E;class N{constructor(e,t=[]){this.mesh=e,this.iks=t,this._valid()}update(){const e=this.iks;for(let t=0,n=e.length;t<n;t++)this.updateOne(e[t]);return this}updateOne(e){const t=this.mesh.skeleton.bones,n=Math,c=t[e.effector],h=t[e.target];P.setFromMatrixPosition(h.matrixWorld);const a=e.links,p=e.iteration!==void 0?e.iteration:1;for(let i=0;i<p;i++){let r=!1;for(let s=0,u=a.length;s<u;s++){const l=t[a[s].index];if(a[s].enabled===!1)break;const g=a[s].limitation,w=a[s].rotationMin,f=a[s].rotationMax;l.matrixWorld.decompose(v,A,H),A.invert(),V.setFromMatrixPosition(c.matrixWorld),b.subVectors(V,v),b.applyQuaternion(A),b.normalize(),y.subVectors(P,v),y.applyQuaternion(A),y.normalize();let o=y.dot(b);if(o>1?o=1:o<-1&&(o=-1),o=n.acos(o),!(o<1e-5)){if(e.minAngle!==void 0&&o<e.minAngle&&(o=e.minAngle),e.maxAngle!==void 0&&o>e.maxAngle&&(o=e.maxAngle),B.crossVectors(b,y),B.normalize(),L.setFromAxisAngle(B,o),l.quaternion.multiply(L),g!==void 0){let d=l.quaternion.w;d>1&&(d=1);const M=n.sqrt(1-d*d);l.quaternion.set(g.x*M,g.y*M,g.z*M,d)}w!==void 0&&l.rotation.setFromVector3(G.setFromEuler(l.rotation).max(w)),f!==void 0&&l.rotation.setFromVector3(G.setFromEuler(l.rotation).min(f)),l.updateMatrixWorld(!0),r=!0}}if(!r)break}return this}createHelper(e){return new I(this.mesh,this.iks,e)}_valid(){const e=this.iks,t=this.mesh.skeleton.bones;for(let n=0,c=e.length;n<c;n++){const h=e[n],a=t[h.effector],p=h.links;let i,r;i=a;for(let s=0,u=p.length;s<u;s++)r=t[p[s].index],i.parent!==r&&console.warn("THREE.CCDIKSolver: bone "+i.name+" is not the child of bone "+r.name),i=r}}}function W(x,e){return G.setFromMatrixPosition(x.matrixWorld).applyMatrix4(e)}function F(x,e,t,n){const c=W(t,n);x[e*3+0]=c.x,x[e*3+1]=c.y,x[e*3+2]=c.z}class I extends T{constructor(e,t=[],n=.25){super(),this.root=e,this.iks=t,this.matrix.copy(e.matrixWorld),this.matrixAutoUpdate=!1,this.sphereGeometry=new q(n,16,8),this.targetSphereMaterial=new S({color:new _(16746632),depthTest:!1,depthWrite:!1,transparent:!0}),this.effectorSphereMaterial=new S({color:new _(8978312),depthTest:!1,depthWrite:!1,transparent:!0}),this.linkSphereMaterial=new S({color:new _(8947967),depthTest:!1,depthWrite:!1,transparent:!0}),this.lineMaterial=new z({color:new _(16711680),depthTest:!1,depthWrite:!1,transparent:!0}),this._init()}updateMatrixWorld(e){const t=this.root;if(this.visible){let n=0;const c=this.iks,h=t.skeleton.bones;k.copy(t.matrixWorld).invert();for(let a=0,p=c.length;a<p;a++){const i=c[a],r=h[i.target],s=h[i.effector],u=this.children[n++],l=this.children[n++];u.position.copy(W(r,k)),l.position.copy(W(s,k));for(let f=0,o=i.links.length;f<o;f++){const d=i.links[f],M=h[d.index];this.children[n++].position.copy(W(M,k))}const g=this.children[n++],w=g.geometry.attributes.position.array;F(w,0,r,k),F(w,1,s,k);for(let f=0,o=i.links.length;f<o;f++){const d=i.links[f],M=h[d.index];F(w,f+2,M,k)}g.geometry.attributes.position.needsUpdate=!0}}this.matrix.copy(t.matrixWorld),super.updateMatrixWorld(e)}dispose(){this.sphereGeometry.dispose(),this.targetSphereMaterial.dispose(),this.effectorSphereMaterial.dispose(),this.linkSphereMaterial.dispose(),this.lineMaterial.dispose();const e=this.children;for(let t=0;t<e.length;t++){const n=e[t];n.isLine&&n.geometry.dispose()}}_init(){const e=this,t=this.iks;function n(i){const r=new O,s=new Float32Array((2+i.links.length)*3);return r.setAttribute("position",new Q(s,3)),r}function c(){return new j(e.sphereGeometry,e.targetSphereMaterial)}function h(){return new j(e.sphereGeometry,e.effectorSphereMaterial)}function a(){return new j(e.sphereGeometry,e.linkSphereMaterial)}function p(i){return new D(n(i),e.lineMaterial)}for(let i=0,r=t.length;i<r;i++){const s=t[i];this.add(c()),this.add(h());for(let u=0,l=s.links.length;u<l;u++)this.add(a());this.add(p(s))}}}export{I as CCDIKHelper,N as CCDIKSolver};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a9 as a,aa as v,ab as S,ac as L}from"./index-_bCaipUk.js";const C=new v,m=new a,p=new a,r=new a,i=new a,n=new a,o=new a,c=new a,l=new a,u=new a,x=new a,f=new a,y=new a,w=new a,F=new a,g=new S,I=new L,N=new a;class T{constructor(s,e,t=Number.MAX_VALUE){this.camera=s,this.scene=e,this.startPoint=new a,this.endPoint=new a,this.collection=[],this.instances={},this.deep=t}select(s,e){return this.startPoint=s||this.startPoint,this.endPoint=e||this.endPoint,this.collection=[],this.updateFrustum(this.startPoint,this.endPoint),this.searchChildInFrustum(C,this.scene),this.collection}updateFrustum(s,e){if(s=s||this.startPoint,e=e||this.endPoint,s.x===e.x&&(e.x+=Number.EPSILON),s.y===e.y&&(e.y+=Number.EPSILON),this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(),this.camera.isPerspectiveCamera){p.copy(s),p.x=Math.min(s.x,e.x),p.y=Math.max(s.y,e.y),e.x=Math.max(s.x,e.x),e.y=Math.min(s.y,e.y),r.setFromMatrixPosition(this.camera.matrixWorld),i.copy(p),n.set(e.x,p.y,0),o.copy(e),c.set(p.x,e.y,0),i.unproject(this.camera),n.unproject(this.camera),o.unproject(this.camera),c.unproject(this.camera),y.copy(i).sub(r),w.copy(n).sub(r),F.copy(o).sub(r),y.normalize(),w.normalize(),F.normalize(),y.multiplyScalar(this.deep),w.multiplyScalar(this.deep),F.multiplyScalar(this.deep),y.add(r),w.add(r),F.add(r);const t=C.planes;t[0].setFromCoplanarPoints(r,i,n),t[1].setFromCoplanarPoints(r,n,o),t[2].setFromCoplanarPoints(o,c,r),t[3].setFromCoplanarPoints(c,i,r),t[4].setFromCoplanarPoints(n,o,c),t[5].setFromCoplanarPoints(F,w,y),t[5].normal.multiplyScalar(-1)}else if(this.camera.isOrthographicCamera){const t=Math.min(s.x,e.x),d=Math.max(s.y,e.y),_=Math.max(s.x,e.x),M=Math.min(s.y,e.y);i.set(t,d,-1),n.set(_,d,-1),o.set(_,M,-1),c.set(t,M,-1),l.set(t,d,1),u.set(_,d,1),x.set(_,M,1),f.set(t,M,1),i.unproject(this.camera),n.unproject(this.camera),o.unproject(this.camera),c.unproject(this.camera),l.unproject(this.camera),u.unproject(this.camera),x.unproject(this.camera),f.unproject(this.camera);const h=C.planes;h[0].setFromCoplanarPoints(i,l,u),h[1].setFromCoplanarPoints(n,u,x),h[2].setFromCoplanarPoints(x,f,c),h[3].setFromCoplanarPoints(f,l,i),h[4].setFromCoplanarPoints(n,o,c),h[5].setFromCoplanarPoints(x,u,l),h[5].normal.multiplyScalar(-1)}else console.error("THREE.SelectionBox: Unsupported camera type.")}searchChildInFrustum(s,e){if(e.isMesh||e.isLine||e.isPoints)if(e.isInstancedMesh){this.instances[e.uuid]=[];for(let t=0;t<e.count;t++)e.getMatrixAt(t,g),g.decompose(m,I,N),m.applyMatrix4(e.matrixWorld),s.containsPoint(m)&&this.instances[e.uuid].push(t)}else e.geometry.boundingSphere===null&&e.geometry.computeBoundingSphere(),m.copy(e.geometry.boundingSphere.center),m.applyMatrix4(e.matrixWorld),s.containsPoint(m)&&this.collection.push(e);if(e.children.length>0)for(let t=0;t<e.children.length;t++)this.searchChildInFrustum(s,e.children[t])}}export{T as SelectionBox};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SelectionBox-BXsv_6aH.js","assets/index-_bCaipUk.js","assets/CCDIKSolver-Dz-ysxZF.js","assets/index-CPVV6pjw.js","assets/index-Dr8H_6Rl.js","assets/xstate-animation-binding-1NGLmw6y.js","assets/data-asset-Bb9sIM7i.js","assets/scene-query-BivAHhJu.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as E,p as a,_ as t,r as d}from"./index-_bCaipUk.js";let n=!1;const s={three:()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.T),[]),"three/addons/controls/OrbitControls.js":()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.j0),[]),"three/addons/interactive/SelectionBox.js":()=>t(()=>import("./SelectionBox-BXsv_6aH.js"),__vite__mapDeps([0,1])),"three/addons/loaders/RGBELoader.js":()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.iU),[]),"three/addons/utils/BufferGeometryUtils.js":()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.iO),[]),"three/addons/utils/SkeletonUtils.js":()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.iW),[]),"three/examples/jsm/animation/CCDIKSolver.js":()=>t(()=>import("./CCDIKSolver-Dz-ysxZF.js"),__vite__mapDeps([2,1])),"three.quarks":()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.iY),[]),"quarks.core":()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.iX),[]),postprocessing:()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.i_),[]),gsap:()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.iT),[]),zod:()=>t(()=>import("./index-CPVV6pjw.js"),__vite__mapDeps([3,1])),react:()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.i),[]),"react/jsx-runtime":()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.j),[]),"react-dom/client":()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.c),[]),"@engine/adapter":()=>t(()=>import("./index-Dr8H_6Rl.js"),__vite__mapDeps([4,1])),"@engine/ai/navigation":()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.iV),[]),"@engine/animation/xstate-animation-binding":()=>t(()=>import("./xstate-animation-binding-1NGLmw6y.js"),__vite__mapDeps([5,1])),"@engine/audio":()=>t(()=>import("./index-CpOnYyeD.js"),[]),"@engine/data/data-asset":()=>t(()=>import("./data-asset-Bb9sIM7i.js"),__vite__mapDeps([6,1])),"@engine/ecs/game-component":()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.iS),[]),"@engine/scene/scene-loader":()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.iZ),[]),"@engine/scene/scene-query":()=>t(()=>import("./scene-query-BivAHhJu.js"),__vite__mapDeps([7,1])),"@engine/scene/user-data":()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.iQ),[]),"@engine/setup/setup-renderer":()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.i$),[]),"@engine/loader":()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.iP),[]),"@engine/scene/parse":()=>t(()=>import("./index-_bCaipUk.js").then(e=>e.iR),[]),xstate:()=>t(()=>import("./xstate.esm-BgUD33nl.js"),[])},c=Object.keys(s);async function u(){if(n)return;const e=await Promise.all(Object.entries(s).map(async([o,i])=>[o,await i()])),_=Object.fromEntries(e);d(_),n=!0}async function m(){await u();const e="/project-scripts.bundle.js",_=await fetch(e);if(!_.ok)throw new Error(`Failed to fetch ${e} (${_.status}) — is the project-scripts bundle built?`);const o=await _.text(),i=await E(o,"project-scripts.bundle.js");if(typeof i.setup!="function")throw new Error("project-scripts bundle does not export a setup() function");const r=i.components;return a(r??{}),{setup:i.setup,components:r}}export{c as REGISTERED_BUNDLE_SPECIFIERS,m as loadBrowserProjectScripts};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ax as a,ay as s,a4 as i,az as e,aA as t,aB as n,aC as d}from"./index-_bCaipUk.js";import"./webworkerAll-BLrH0F6F.js";a.add(s);a.mixin(i,e);a.add(t);a.add(n);a.mixin(i,d);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as M,d as P,V as F,T as B,e as H,g as O,s as L,h as I,k as U,m as j,a as A}from"./index-_bCaipUk.js";import{n as ae}from"./index-_bCaipUk.js";function q(e){return O(e)?{physics:e.ctx.physics,collisions:e.ctx.collisions,camera:e.ctx.camera,frame:e.frame}:{}}function G(e,n,t,r){const o=H({id:r?.id??"main",kind:"threejs",pausable:r?.pausable??!0,adapter:n,mounted:t,scene:t.scene,...q(t)});return O(t)&&t.ctx.components.adoptWorld(o),e.registerWorld(o),o}function V(e,n,t){return G(e,n,t)}function $(e){return e.firstParty!==!0?{}:{physics2d:e.ctx.physics2d,collisions2d:e.ctx.collisions2d,frame:e.frame}}function N(e,n,t,r){const o=r?.id??"main",a=t.firstParty===!0,c=H({id:o,kind:"pixijs",pausable:r?.pausable??!0,adapter:n,mounted:t,stage:t.stage,...$(t)});return a&&t.ctx.components.adoptWorld(c),e.registerWorld(c),c}function J(e,n,t,r,o){const a=H({id:o?.id??"main",kind:"react",pausable:o?.pausable??!0,adapter:n,mounted:t,container:r});return e.registerWorld(a),a}function K(e){return"worlds"in e}async function se(e){if(K(e))return ne(e);const{canvas:n,width:t,height:r,adapter:o,...a}=e,c=Math.max(1,t??n.width),i=Math.max(1,r??n.height),l=M(n,c,i),y=j();let d;const x=document.getElementById("example-ui");x instanceof HTMLDivElement?d=x:(d=document.createElement("div"),d.id="example-ui",d.style.cssText="position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:2;",(n.parentElement??document.getElementById("ui-overlay")??document.body).appendChild(d));const u=new Set,w={onUpdate(g){return u.add(g),()=>u.delete(g)}};let p=null;const E=I({fixedTimestep:1/60,maxSubSteps:8,update:g=>{p&&m.runFrame(g);for(const C of u)C(g)}}),m=P({loop:E,assets:y}),R={three:B,surface:{canvas:n,width:c,height:i},renderer:l,loop:w,assets:y,ui:d,game:m,requestSystem:()=>null},b=o??new F(a),h=await b.mount(R);p=h,V(m,b,h),E.start();function f(){E.stop(),h.dispose(),l.dispose(),l.forceContextLoss()}return{stop:f,pause(){m.play.pause()},resume(){m.play.resume()},step(){m.play.step()},resize(g,C){const S=Math.max(1,g),k=Math.max(1,C);l.setSize(S,k),h.resize?.(S,k)},get scene(){return h.scene},get camera(){return h.camera},get mounted(){return h},game:m}}function Q(){return{setPixelRatio(){},setClearColor(){},setSize(){},dispose(){},forceContextLoss(){}}}function X(e){if(e.firstParty!==!0)return;const t=e.ctx.app?.renderer?.events?.rootBoundary;if(!(!t||typeof t.hitTest!="function"))return(r,o)=>t.hitTest(r,o)!=null}async function Y(e,n){const{game:t,canvas:r,w:o,h:a,dpr:c,isBottom:i,headless:l,uiContainer:y,loopHandle:d,assets:x}=n,u=l?Q():M(r,o,a,void 0,{alpha:!i,preserveDrawingBuffer:!0});u.setSize(o,a,!1),r.style.width="100%",r.style.height="100%",u.setPixelRatio(c),i||u.setClearColor(0,0);const w={three:B,surface:{canvas:r,width:o,height:a},renderer:u,loop:d,assets:x,ui:y,headless:l,game:t,requestSystem:()=>null},p=await e.adapter.mount(w);return G(t,e.adapter,p,{id:e.id,pausable:e.pausable}),{mountedEntry:{id:e.id,kind:"threejs",element:r,mounted:p,renderer:u},routerEntry:{id:e.id,zOrder:e.zOrder??0,canvas:r,hitTest:e.hitTest}}}async function Z(e,n){const{game:t,canvas:r,w:o,h:a,dpr:c,isBottom:i,uiContainer:l}=n,y={canvas:r,width:o,height:a,ui:l,dpr:c,transparent:!i,preserveDrawingBuffer:!0},d=await e.adapter.mount(y);return N(t,e.adapter,d,{id:e.id,pausable:e.pausable}),{mountedEntry:{id:e.id,kind:"pixijs",element:r,mounted:d,renderer:void 0},routerEntry:{id:e.id,zOrder:e.zOrder??0,canvas:r,hitTest:e.hitTest??X(d)}}}async function _(e,n,t){t.style.pointerEvents="none",t.style.width="100%",t.style.height="100%";const r={container:t,game:n},o=await e.adapter.mount(r);return J(n,e.adapter,o,t,{id:e.id,pausable:e.pausable}),{mountedEntry:{id:e.id,kind:"react",element:t,mounted:o,renderer:void 0}}}function ee(e){return()=>{}}async function te(e,n,t){const{surfacesById:r,...o}=t,a=[],c=[];for(const i of e){const l=i.id===n;if(i.kind==="react"){const w=r.get(i.id),{mountedEntry:p}=await _(i,o.game,w);a.push(p);continue}const y=r.get(i.id),d={...o,canvas:y,isBottom:l};let x,u;i.kind==="threejs"?{mountedEntry:x,routerEntry:u}=await Y(i,d):i.kind==="pixijs"?{mountedEntry:x,routerEntry:u}=await Z(i,d):A(i,"create-runtime mount loop"),a.push(x),c.push(u)}return{mountedEntries:a,routerEntries:c}}async function ne(e){const{container:n,worlds:t,width:r,height:o,headless:a=!1}=e;if(t.length===0)throw new Error("createGameRuntime: `worlds` must contain at least one world.");const c=t,i=Math.max(1,r??n.clientWidth??0),l=Math.max(1,o??n.clientHeight??0),y=a?1:Math.min(typeof window<"u"&&window.devicePixelRatio||1,2);n.style.position||(n.style.position="relative");const d=L(c.map(s=>({id:s.id,zOrder:s.zOrder??0,hitTest:s.hitTest}))),x=d[0]?.id,u=new Map(c.map(s=>[s.id,s.kind])),w=new Map;d.forEach((s,W)=>{const T=u.get(s.id)==="react",v=document.createElement(T?"div":"canvas");if(!T){const z=v;z.width=i,z.height=l}v.style.cssText=`position:absolute;top:0;left:0;width:100%;height:100%;z-index:${W+1};`,n.appendChild(v),w.set(s.id,v)});const p=document.createElement("div");p.id="vgai-ui-overlay",p.style.cssText=`position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:${d.length+1};`,n.appendChild(p);const E=j(),m=new Set,R={onUpdate(s){return m.add(s),()=>m.delete(s)}};let b=!1;const h=I({fixedTimestep:1/60,maxSubSteps:8,update:s=>{b&&f.runFrame(s);for(const W of m)W(s)}}),f=P({loop:h,assets:E}),{mountedEntries:g,routerEntries:C}=await te(c,x,{game:f,surfacesById:w,w:i,h:l,dpr:y,headless:a,uiContainer:p,loopHandle:R,assets:E}),S=U(n,C);b=!0,h.start();const k=ee();function D(){h.stop(),S.dispose();for(const s of g)s.mounted.dispose(),s.renderer?.dispose(),s.renderer?.forceContextLoss(),n.removeChild(s.element);n.removeChild(p),k()}return{stop:D,pause(){f.play.pause()},resume(){f.play.resume()},step(){f.play.step()},resize(s,W){const T=Math.max(1,s),v=Math.max(1,W);for(const z of g)z.renderer?.setSize(T,v,!1),z.mounted.resize?.(T,v)},get scene(){const s=f.defaultWorld.mounted;return s.kind==="threejs"?s.scene:void 0},get camera(){const s=f.defaultWorld.mounted;return s.kind==="threejs"?s.camera:void 0},get mounted(){return f.defaultWorld.mounted},game:f}}export{ae as adoptSceneCamera,se as createGameRuntime,V as registerDefaultThreeWorld,N as registerPixiWorld,J as registerReactWorld,G as registerThreeWorld};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{an as p}from"./index-_bCaipUk.js";function h(n,e,t){let o=c(n,e,t);const s=new Set;return{get:()=>o,sourcePath:t,subscribe(r){return s.add(r),()=>s.delete(r)},hotSwap(r){let i;try{i=c(n,r,t)}catch(a){console.error(`[data] hot edit rejected, keeping previous values.
|
|
2
|
-
${String(a)}`);return}o=i;for(const a of s)a(o)}}}function u(n){const e=p(n,{io:"input"});if(e.type==="object"){const t=e.properties??{};t.$schema??={type:"string"},e.properties=t}return e}function c(n,e,t){const o=e!==null&&typeof e=="object"&&!Array.isArray(e)&&"$schema"in e?Object.fromEntries(Object.entries(e).filter(([r])=>r!=="$schema")):e,s=n.safeParse(o);if(!s.success){const r=s.error.issues.map(i=>` - ${i.path.join(".")||"(root)"}: ${i.message}`).join(`
|
|
3
|
-
`);throw new Error(`Data asset "${t}" failed its schema:
|
|
4
|
-
${r}
|
|
5
|
-
Fix the JSON to match the Zod schema (its emitted twin, "${t.replace(/\.data\.json$/,".schema.json")}", documents every field — re-emit with \`npm run emit-schemas\` if the schema changed). Worked example: the template's src/data/.`)}return s.data}export{h as defineData,c as parseDataJson,u as toDataJsonSchema};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a2 as C,a4 as w,a7 as T,a3 as v,a8 as _}from"./index-_bCaipUk.js";const y=globalThis.__vgaiGameWindow||globalThis.window,m=globalThis.__vgaiGameDocument||globalThis.document;function k(){return globalThis.__world2dGameContainer??m.body}function h(l,a,e){const d=m.createElement("canvas");d.width=e,d.height=e;const n=d.getContext("2d");return n.fillStyle=l,n.fillRect(0,0,e,e),n.fillStyle=a,n.fillRect(2,2,e-4,3),n.fillRect(2,e-5,e-4,3),_.from(d)}A();async function A(){const l=new C;await l.init({width:640,height:480,background:"#0c1a12",antialias:!1}),k().appendChild(l.canvas);const a=32,e=60,d=40,n=new w;l.stage.addChild(n);const g=h("#3a7d44","#2f6638",a),p=h("#6b6b7b","#54545f",a),x=h("#2f6db0","#255a93",a),f=new T;n.addChild(f);let c=99;const u=()=>(c=c*1103515245+12345&2147483647,c/2147483647);for(let i=0;i<d;i++)for(let r=0;r<e;r++){const s=u(),b=s<.12?x:s<.24?p:g;f.tile(b,r*a,i*a)}const t=new w;t.addChild(new v().roundRect(-12,-12,24,24,5).fill("#ffd23f").stroke({width:2,color:"#c98a00"})),t.x=e*a/2,t.y=d*a/2,n.addChild(t);const o={};y.addEventListener("keydown",i=>{o[i.code]=!0}),y.addEventListener("keyup",i=>{o[i.code]=!1}),l.ticker.add(i=>{const s=5*i.deltaTime;(o.ArrowLeft||o.KeyA)&&(t.x-=s),(o.ArrowRight||o.KeyD)&&(t.x+=s),(o.ArrowUp||o.KeyW)&&(t.y-=s),(o.ArrowDown||o.KeyS)&&(t.y+=s),t.x=Math.max(0,Math.min(e*a,t.x)),t.y=Math.max(0,Math.min(d*a,t.y)),n.x=l.screen.width/2-t.x,n.y=l.screen.height/2-t.y}),globalThis.__tilemapCamera={app:l,tiles:e*d,playerPos:()=>({x:t.x,y:t.y}),press:(i,r)=>{o[i]=r}}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Z as x,P as g,S as u,L as w,X as b,O as H,N as v,$ as y,a0 as z,M as P,a1 as d}from"./index-_bCaipUk.js";import{S as R}from"./stats.module--VATS4Kh.js";const t=globalThis.__vgaiGameWindow||globalThis.window,c=globalThis.__vgaiGameDocument||globalThis.document;let m,n,r,h,o,e,s=0;const f=new x,l=5;T();function T(){n=new g(70,t.innerWidth/t.innerHeight,.1,100),r=new u,r.background=new w(15790320);const a=new b(16777215,3);a.position.set(1,1,1).normalize(),r.add(a);const p=new H;for(let M=0;M<2e3;M++){const i=new v(p,new y({color:Math.random()*16777215}));i.position.x=Math.random()*40-20,i.position.y=Math.random()*40-20,i.position.z=Math.random()*40-20,i.rotation.x=Math.random()*2*Math.PI,i.rotation.y=Math.random()*2*Math.PI,i.rotation.z=Math.random()*2*Math.PI,i.scale.x=Math.random()+.5,i.scale.y=Math.random()+.5,i.scale.z=Math.random()+.5,r.add(i)}h=new z,o=new P({antialias:!0}),o.setPixelRatio(t.devicePixelRatio),o.setSize(t.innerWidth,t.innerHeight),o.setAnimationLoop(S),c.body.appendChild(o.domElement),m=new R,c.body.appendChild(m.dom),c.addEventListener("mousemove",L),t.addEventListener("resize",W)}function W(){n.aspect=t.innerWidth/t.innerHeight,n.updateProjectionMatrix(),o.setSize(t.innerWidth,t.innerHeight)}function L(a){f.x=a.clientX/t.innerWidth*2-1,f.y=-(a.clientY/t.innerHeight)*2+1}function S(){C(),m.update()}function C(){s+=.1,n.position.x=l*Math.sin(d.degToRad(s)),n.position.y=l*Math.sin(d.degToRad(s)),n.position.z=l*Math.cos(d.degToRad(s)),n.lookAt(r.position),n.updateMatrixWorld(),h.setFromCamera(f,n);const a=h.intersectObjects(r.children,!1);a.length>0?e!=a[0].object&&(e&&e.material.emissive.setHex(e.currentHex),e=a[0].object,e.currentHex=e.material.emissive.getHex(),e.material.emissive.setHex(16711680)):(e&&e.material.emissive.setHex(e.currentHex),e=null),o.render(r,n)}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a2 as M,a4 as _,a3 as p,a6 as W}from"./index-_bCaipUk.js";const E=globalThis.__vgaiGameWindow||globalThis.window,L=globalThis.__vgaiGameDocument||globalThis.document;function H(){return globalThis.__world2dGameContainer??L.body}R();async function R(){const a=new M;await a.init({width:480,height:640,background:"#4ec0ca",antialias:!0}),H().appendChild(a.canvas);const w=480,c=640,b=new _;a.stage.addChild(b);const e=new _,C=new p().roundRect(-14,-12,28,24,8).fill("#ffd23f").stroke({width:2,color:"#c98a00"}),u=new p().ellipse(-2,2,9,6).fill("#fff3b0");e.addChild(C,u),e.x=w*.3,e.y=c*.5,b.addChild(e);const d=[],x=170,l=64;let y=7;const T=()=>(y=y*1103515245+12345&2147483647,y/2147483647);function k(o){const n=120+T()*(c-240-x),t=new p().rect(0,0,l,n).fill("#5dbb46").stroke({width:3,color:"#3f8a30"}),i=new p().rect(0,0,l,c-n-x).fill("#5dbb46").stroke({width:3,color:"#3f8a30"});t.x=o,t.y=0,i.x=o,i.y=n+x,b.addChild(t,i),d.push({top:t,bot:i,x:o,scored:!1})}for(let o=0;o<4;o++)k(w+o*220);const r=new W({text:"Score: 0",style:{fontSize:28,fill:"#fff",fontWeight:"bold"}});r.x=16,r.y=16,a.stage.addChild(r);let f=0,h=0,s=!1,g=0;const G=.5,A=-8.5;function m(){if(s){e.y=c*.5,f=0,h=0,s=!1;for(let o=0;o<d.length;o++)d[o].x=w+o*220;return}f=A}E.addEventListener("keydown",o=>{(o.code==="Space"||o.code==="ArrowUp")&&m()}),a.canvas.addEventListener("pointerdown",m),a.ticker.add(o=>{const n=o.deltaTime;if(g+=n,u.scale.y=.6+Math.abs(Math.sin(g*.3))*.8,!s){f+=G*n,e.y+=f*n,e.rotation=Math.max(-.5,Math.min(1.2,f*.05));for(const t of d){t.x-=2.2*n,t.top.x=t.x,t.bot.x=t.x,t.x+l<0&&(t.x+=d.length*220,t.scored=!1),!t.scored&&t.x+l<e.x&&(t.scored=!0,h++,r.text=`Score: ${h}`);const i=e.x-14,v=e.y-12;if(i+28>t.x&&i<t.x+l){const P=t.top.height,S=t.bot.y;(v<P||v+24>S)&&(s=!0)}}(e.y>c-12||e.y<0)&&(s=!0),s&&(r.text=`Score: ${h} — tap to retry`)}}),globalThis.__flappy={app:a,score:()=>h}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ap as G,a9 as k,aq as N,L as H,P as T,S as X,ar as Y,as as q,a0 as O,at as U,au as S,av as C,ae as V,N as D,O as Q,aw as Z,M as J}from"./index-_bCaipUk.js";const p=new N(0,0,0,"YXZ"),b=new k,$={type:"change"},ee={type:"lock"},te={type:"unlock"},R=Math.PI/2;class oe extends G{constructor(r,t=null){super(r,t),this.isLocked=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.pointerSpeed=1,this._onMouseMove=ne.bind(this),this._onPointerlockChange=re.bind(this),this._onPointerlockError=se.bind(this),this.domElement!==null&&this.connect()}connect(){this.domElement.ownerDocument.addEventListener("mousemove",this._onMouseMove),this.domElement.ownerDocument.addEventListener("pointerlockchange",this._onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this._onPointerlockError)}disconnect(){this.domElement.ownerDocument.removeEventListener("mousemove",this._onMouseMove),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this._onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this._onPointerlockError)}dispose(){this.disconnect()}getObject(){return console.warn("THREE.PointerLockControls: getObject() has been deprecated. Use controls.object instead."),this.object}getDirection(r){return r.set(0,0,-1).applyQuaternion(this.object.quaternion)}moveForward(r){if(this.enabled===!1)return;const t=this.object;b.setFromMatrixColumn(t.matrix,0),b.crossVectors(t.up,b),t.position.addScaledVector(b,r)}moveRight(r){if(this.enabled===!1)return;const t=this.object;b.setFromMatrixColumn(t.matrix,0),t.position.addScaledVector(b,r)}lock(){this.domElement.requestPointerLock()}unlock(){this.domElement.ownerDocument.exitPointerLock()}}function ne(n){if(this.enabled===!1||this.isLocked===!1)return;const r=n.movementX||n.mozMovementX||n.webkitMovementX||0,t=n.movementY||n.mozMovementY||n.webkitMovementY||0,s=this.object;p.setFromQuaternion(s.quaternion),p.y-=r*.002*this.pointerSpeed,p.x-=t*.002*this.pointerSpeed,p.x=Math.max(R-this.maxPolarAngle,Math.min(R-this.minPolarAngle,p.x)),s.quaternion.setFromEuler(p),this.dispatchEvent($)}function re(){this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(ee),this.isLocked=!0):(this.dispatchEvent(te),this.isLocked=!1)}function se(){console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}const a=globalThis.__vgaiGameWindow||globalThis.window,w=globalThis.__vgaiGameDocument||globalThis.document;let y,m,f,i;const K=[];let M,E=!1,x=!1,L=!1,P=!1,A=!1,F=performance.now();const o=new k,g=new k,u=new k,l=new H;ie();function ie(){y=new T(75,a.innerWidth/a.innerHeight,1,1e3),y.position.y=10,m=new X,m.background=new H(16777215),m.fog=new Y(16777215,0,750);const n=new q(15658751,7829384,2.5);n.position.set(.5,1,.75),m.add(n),i=new oe(y,w.body);const r=w.getElementById("blocker"),t=w.getElementById("instructions");t.addEventListener("click",function(){i.lock()}),i.addEventListener("lock",function(){t.style.display="none",r.style.display="none"}),i.addEventListener("unlock",function(){r.style.display="block",t.style.display=""}),m.add(i.object);const s=function(e){switch(e.code){case"ArrowUp":case"KeyW":E=!0;break;case"ArrowLeft":case"KeyA":L=!0;break;case"ArrowDown":case"KeyS":x=!0;break;case"ArrowRight":case"KeyD":P=!0;break;case"Space":A===!0&&(o.y+=350),A=!1;break}},B=function(e){switch(e.code){case"ArrowUp":case"KeyW":E=!1;break;case"ArrowLeft":case"KeyA":L=!1;break;case"ArrowDown":case"KeyS":x=!1;break;case"ArrowRight":case"KeyD":P=!1;break}};w.addEventListener("keydown",s),w.addEventListener("keyup",B),M=new O(new k,new k(0,-1,0),0,10);let d=new U(2e3,2e3,100,100);d.rotateX(-Math.PI/2);let h=d.attributes.position;for(let e=0,c=h.count;e<c;e++)u.fromBufferAttribute(h,e),u.x+=Math.random()*20-10,u.y+=Math.random()*2,u.z+=Math.random()*20-10,h.setXYZ(e,u.x,u.y,u.z);d=d.toNonIndexed(),h=d.attributes.position;const j=[];for(let e=0,c=h.count;e<c;e++)l.setHSL(Math.random()*.3+.5,.75,Math.random()*.25+.75,S),j.push(l.r,l.g,l.b);d.setAttribute("color",new C(j,3));const I=new V({vertexColors:!0}),W=new D(d,I);m.add(W);const _=new Q(20,20,20).toNonIndexed();h=_.attributes.position;const z=[];for(let e=0,c=h.count;e<c;e++)l.setHSL(Math.random()*.3+.5,.75,Math.random()*.25+.75,S),z.push(l.r,l.g,l.b);_.setAttribute("color",new C(z,3));for(let e=0;e<500;e++){const c=new Z({specular:16777215,flatShading:!0,vertexColors:!0});c.color.setHSL(Math.random()*.2+.5,.75,Math.random()*.25+.75,S);const v=new D(_,c);v.position.x=Math.floor(Math.random()*20-10)*20,v.position.y=Math.floor(Math.random()*20)*20+10,v.position.z=Math.floor(Math.random()*20-10)*20,m.add(v),K.push(v)}f=new J({antialias:!0}),f.setPixelRatio(a.devicePixelRatio),f.setSize(a.innerWidth,a.innerHeight),f.setAnimationLoop(ce),w.body.appendChild(f.domElement),a.addEventListener("resize",ae)}function ae(){y.aspect=a.innerWidth/a.innerHeight,y.updateProjectionMatrix(),f.setSize(a.innerWidth,a.innerHeight)}function ce(){const n=performance.now();if(i.isLocked===!0){M.ray.origin.copy(i.object.position),M.ray.origin.y-=10;const t=M.intersectObjects(K,!1).length>0,s=(n-F)/1e3;o.x-=o.x*10*s,o.z-=o.z*10*s,o.y-=9.8*100*s,g.z=Number(E)-Number(x),g.x=Number(P)-Number(L),g.normalize(),(E||x)&&(o.z-=g.z*400*s),(L||P)&&(o.x-=g.x*400*s),t===!0&&(o.y=Math.max(0,o.y),A=!0),i.moveRight(-o.x*s),i.moveForward(-o.z*s),i.object.position.y+=o.y*s,i.object.position.y<10&&(o.y=0,i.object.position.y=10,A=!0)}F=n,f.render(m,y)}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a2 as u,a3 as h,a4 as v,a5 as y}from"./index-_bCaipUk.js";const x=globalThis.__vgaiGameDocument||globalThis.document;function g(){return globalThis.__world2dGameContainer??x.body}p();async function p(){const t=new u;await t.init({width:800,height:600,background:"#1a1a2e",antialias:!1}),g().appendChild(t.canvas);const r=new h().roundRect(0,0,26,32,6).fill("#ffd166").circle(8,10,3).fill("#222").circle(18,10,3).fill("#222"),d=t.renderer.generateTexture(r),a=[],s=new v;t.stage.addChild(s);const e=800,c=600,f=.5;let i=12345;const o=()=>(i=i*1103515245+12345&2147483647,i/2147483647);function l(){const n=new y(d);n.anchor.set(.5),n.x=e/2,n.y=0,n.tint=o()*16777215|0,s.addChild(n),a.push({s:n,vx:(o()-.5)*12,vy:o()*6})}for(let n=0;n<250;n++)l();t.ticker.add(()=>{if(a.length<1500)for(let n=0;n<4;n++)l();for(const n of a)n.s.x+=n.vx,n.s.y+=n.vy,n.vy+=f,n.s.x>e?(n.s.x=e,n.vx=-n.vx):n.s.x<0&&(n.s.x=0,n.vx=-n.vx),n.s.y>c&&(n.s.y=c,n.vy=-n.vy*.85)}),globalThis.__bunnymark={app:t,count:()=>a.length}}
|