@volter/editor-core 0.5.57
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/BUNDLED_NOTICES +1527 -0
- package/LICENSE +686 -0
- package/LICENSE-APACHE +202 -0
- package/NOTICE +18 -0
- package/README.md +24 -0
- package/dist/build/chunk-JS4D4XZ3.js +175 -0
- package/dist/build/chunk-JS4D4XZ3.js.map +7 -0
- package/dist/build/vite-plugin-product-contributions.js +100 -0
- package/dist/build/vite-plugin-product-contributions.js.map +7 -0
- package/dist/build/vite-plugin-shared-react.js +25 -0
- package/dist/build/vite-plugin-shared-react.js.map +7 -0
- package/dist/build/vite-plugin-shared-three.js +86 -0
- package/dist/build/vite-plugin-shared-three.js.map +7 -0
- package/dist/server/chunk-KMJC7AGO.js +98 -0
- package/dist/server/chunk-KMJC7AGO.js.map +7 -0
- package/dist/server/chunk-PSILUMGS.js +46 -0
- package/dist/server/chunk-PSILUMGS.js.map +7 -0
- package/dist/server/frame-proxy.js +255 -0
- package/dist/server/frame-proxy.js.map +7 -0
- package/dist/server/open-browser.js +53 -0
- package/dist/server/open-browser.js.map +7 -0
- package/dist/server/process-shutdown.js +127 -0
- package/dist/server/process-shutdown.js.map +7 -0
- package/dist/server/session-registry.js +141 -0
- package/dist/server/session-registry.js.map +7 -0
- package/dist/server/spawn-opener.js +11 -0
- package/dist/server/spawn-opener.js.map +7 -0
- package/dist/server/worktree-identity.js +11 -0
- package/dist/server/worktree-identity.js.map +7 -0
- package/dist-server/packaged.mjs +88816 -0
- package/package.json +118 -0
- package/scripts/build-plugins.mjs +14 -0
- package/scripts/build-server.mjs +26 -0
- package/scripts/build-session.mjs +9 -0
- package/server/account-credentials.ts +60 -0
- package/server/account-service.ts +1434 -0
- package/server/adapter-region-includes.ts +47 -0
- package/server/asset-catalog-v2.ts +175 -0
- package/server/asset-history-snapshots.ts +196 -0
- package/server/asset-ledger-store.ts +195 -0
- package/server/asset-library-routes.ts +1595 -0
- package/server/blender-wasm-artifact.ts +430 -0
- package/server/boot-timings.ts +106 -0
- package/server/canonical-path.ts +50 -0
- package/server/checkout-workspace-preflight.ts +349 -0
- package/server/cloud-asset-catalog.ts +158 -0
- package/server/coding-inference-launch.ts +237 -0
- package/server/collaboration-account-client.ts +202 -0
- package/server/collaboration-attribution.ts +122 -0
- package/server/collaboration-session.ts +934 -0
- package/server/comfyui-bridge.ts +248 -0
- package/server/console-ledger.ts +499 -0
- package/server/creation-site-transform.ts +304 -0
- package/server/creation-site-write.ts +648 -0
- package/server/data-file-serialize.ts +158 -0
- package/server/editor-brand-html.ts +72 -0
- package/server/editor-control-socket.ts +366 -0
- package/server/editor-server-options.ts +190 -0
- package/server/editor-server.ts +1483 -0
- package/server/editor-sse.ts +352 -0
- package/server/engine-provenance.ts +169 -0
- package/server/engine-source-restart.ts +117 -0
- package/server/frame-bridge.ts +115 -0
- package/server/frame-proxy.ts +490 -0
- package/server/frame-workbench.ts +259 -0
- package/server/frontend-handoff.ts +229 -0
- package/server/game-globals-shadow.ts +113 -0
- package/server/gameplay-session-retention.ts +149 -0
- package/server/gameplay-sessions.ts +123 -0
- package/server/generation-jobs.ts +201 -0
- package/server/generation-reconciler.ts +137 -0
- package/server/generative-execution-context.ts +59 -0
- package/server/git-workflow.ts +612 -0
- package/server/harness-chat-caller.ts +36 -0
- package/server/harness-chat-service.ts +1681 -0
- package/server/idle-shutdown.ts +170 -0
- package/server/js-profiling-policy.ts +52 -0
- package/server/launcher-settings.ts +84 -0
- package/server/local-asset-catalog.ts +410 -0
- package/server/managed-account-defaults.ts +22 -0
- package/server/mock-control-plane.ts +540 -0
- package/server/model-import-conversion.ts +345 -0
- package/server/native-credential-store.ts +162 -0
- package/server/open-browser.ts +118 -0
- package/server/packaged.ts +1192 -0
- package/server/play-stall.ts +126 -0
- package/server/process-shutdown.ts +218 -0
- package/server/product-presets.ts +55 -0
- package/server/project-build-artifact.ts +95 -0
- package/server/project-components.ts +100 -0
- package/server/project-dependency-invalidation.ts +114 -0
- package/server/project-file-scan.ts +235 -0
- package/server/project-hmr-files.ts +215 -0
- package/server/project-install-roots.ts +210 -0
- package/server/project-kinds.ts +71 -0
- package/server/project-mcp-servers.ts +82 -0
- package/server/project-module-freshness.ts +109 -0
- package/server/project-module-instance.ts +375 -0
- package/server/project-optimize-deps-entries.ts +827 -0
- package/server/project-output-writer.ts +679 -0
- package/server/project-package-origin.ts +63 -0
- package/server/project-root-surface.ts +831 -0
- package/server/project-scratch-path.ts +47 -0
- package/server/project-script-hmr.ts +619 -0
- package/server/project-serving-plugins.ts +236 -0
- package/server/project-tools.ts +653 -0
- package/server/project-validation.ts +250 -0
- package/server/project-verbs.ts +127 -0
- package/server/project-view.ts +52 -0
- package/server/project-watch.ts +1134 -0
- package/server/project-work-coordinator.ts +288 -0
- package/server/provider-credentials.ts +331 -0
- package/server/recent-projects-store.ts +98 -0
- package/server/redact-secrets.ts +71 -0
- package/server/repository-presence.ts +267 -0
- package/server/routes/account.ts +357 -0
- package/server/routes/agents.ts +60 -0
- package/server/routes/assets.ts +154 -0
- package/server/routes/build.ts +13 -0
- package/server/routes/collaboration.ts +595 -0
- package/server/routes/configurations.ts +419 -0
- package/server/routes/context.ts +264 -0
- package/server/routes/control-plane.ts +1811 -0
- package/server/routes/logs.ts +272 -0
- package/server/routes/project-identity.ts +302 -0
- package/server/routes/project-open.ts +429 -0
- package/server/routes/project-source.ts +686 -0
- package/server/routes/project-state.ts +383 -0
- package/server/routes/relay.ts +1029 -0
- package/server/routes/route-helpers.ts +29 -0
- package/server/routes/served-modules.ts +138 -0
- package/server/routes/session-tabs.ts +196 -0
- package/server/routes/settings.ts +121 -0
- package/server/routes/share-control.ts +486 -0
- package/server/routes/themes.ts +116 -0
- package/server/routes/tools.ts +230 -0
- package/server/routes/worktrees.ts +595 -0
- package/server/scoped-game-css.ts +461 -0
- package/server/server-utils.ts +1194 -0
- package/server/session-product.ts +112 -0
- package/server/session-registry.ts +230 -0
- package/server/share-claims.ts +138 -0
- package/server/share-host.ts +526 -0
- package/server/share-session-gateway.ts +1362 -0
- package/server/share-tunnel.ts +123 -0
- package/server/spawn-opener.ts +74 -0
- package/server/support/play/log-format.ts +76 -0
- package/server/support/play/session-record.ts +199 -0
- package/server/support/project/build-discipline.ts +718 -0
- package/server/support/project/inspection-node.ts +119 -0
- package/server/support/project/log-naming.ts +54 -0
- package/server/support/project/provenance.ts +290 -0
- package/server/support/project/run-name.ts +18 -0
- package/server/support/project/session-journal.ts +830 -0
- package/server/support/project/shared.ts +327 -0
- package/server/tab-bootstrap.ts +62 -0
- package/server/tab-heartbeat.ts +477 -0
- package/server/tab-lifecycle.ts +550 -0
- package/server/tab-presence.ts +1508 -0
- package/server/team-agent-mirror.ts +95 -0
- package/server/twin-auth.ts +138 -0
- package/server/vendored-lock-recorder.ts +968 -0
- package/server/worktree-identity.ts +121 -0
- package/server/worktree-management.ts +398 -0
- package/server/worktree-retention.d.mts +13 -0
- package/server/worktree-retention.mjs +205 -0
- package/src/EditorContext.tsx +169 -0
- package/src/account.ts +333 -0
- package/src/action-registry.ts +532 -0
- package/src/active-product.ts +74 -0
- package/src/active-project.ts +155 -0
- package/src/adapter-editor-config.ts +25 -0
- package/src/adapter-observation.ts +49 -0
- package/src/animation/stage-transport.ts +379 -0
- package/src/animation/three-clips-subject.ts +172 -0
- package/src/api/asset-library-wire.ts +45 -0
- package/src/api/assets.ts +365 -0
- package/src/api/base.ts +10 -0
- package/src/api/build.ts +99 -0
- package/src/api/git-wire.ts +56 -0
- package/src/api/logs.ts +92 -0
- package/src/api/project-identity.ts +74 -0
- package/src/api/project-open.ts +355 -0
- package/src/api/project-source.ts +162 -0
- package/src/api/project-state.ts +107 -0
- package/src/api/relay.ts +268 -0
- package/src/api/settings.ts +36 -0
- package/src/api/themes.ts +45 -0
- package/src/api/worktrees.ts +257 -0
- package/src/asset-compare-core.ts +171 -0
- package/src/asset-compare.ts +294 -0
- package/src/asset-editor-context.tsx +100 -0
- package/src/asset-events.ts +97 -0
- package/src/asset-inspector-actions.ts +87 -0
- package/src/asset-preview-framing.ts +357 -0
- package/src/asset-preview.ts +2802 -0
- package/src/asset-selection-viewer-registry.ts +113 -0
- package/src/asset-selection.ts +133 -0
- package/src/asset-workflow/asset-capabilities.ts +344 -0
- package/src/asset-workflow/asset-import-jobs.ts +106 -0
- package/src/asset-workflow/asset-ledger-backend.ts +126 -0
- package/src/asset-workflow/asset-ledger.ts +156 -0
- package/src/asset-workflow/asset-materialization-report.ts +140 -0
- package/src/asset-workflow/asset-pack-manifest.ts +320 -0
- package/src/asset-workflow/asset-types.ts +142 -0
- package/src/asset-workflow/asset-workflow-quality.ts +61 -0
- package/src/asset-workflow/audio-preview-player.ts +193 -0
- package/src/asset-workflow/audio-waveform.ts +22 -0
- package/src/asset-workflow/cloud-asset-client.ts +263 -0
- package/src/asset-workflow/folder-preview.ts +345 -0
- package/src/asset-workflow/hosted-asset-materialization.ts +236 -0
- package/src/asset-workflow/image-view-scale.ts +32 -0
- package/src/asset-workflow/import-contract.ts +124 -0
- package/src/asset-workflow/ledger-write-lock.ts +244 -0
- package/src/asset-workflow/model-inspection.ts +818 -0
- package/src/asset-workflow/pixi-spritesheet.ts +197 -0
- package/src/asset-workflow/preview-resource-lifetime.ts +44 -0
- package/src/asset-workflow/project-asset-commands.ts +23 -0
- package/src/asset-workflow/project-asset-health.ts +139 -0
- package/src/asset-workflow/project-asset-operations.ts +154 -0
- package/src/asset-workflow/project-asset-roots.ts +68 -0
- package/src/asset-workflow/project-content.ts +288 -0
- package/src/asset-workflow/project-source-index.ts +550 -0
- package/src/asset-workflow/thumbnail-system.ts +256 -0
- package/src/authoring/active-adapter.ts +199 -0
- package/src/authoring/active-systems.ts +422 -0
- package/src/authoring/adapter-key.ts +18 -0
- package/src/authoring/authoring-asset-url.ts +27 -0
- package/src/authoring/bootstrap-state.ts +49 -0
- package/src/authoring/boundary-authoring-adapter.ts +184 -0
- package/src/authoring/breakpoint-state.ts +43 -0
- package/src/authoring/canvas-scene-guides.ts +76 -0
- package/src/authoring/component-instance-root.ts +171 -0
- package/src/authoring/composite-authoring-adapter.ts +2110 -0
- package/src/authoring/consumer-actions.ts +520 -0
- package/src/authoring/css-numeric-style.ts +97 -0
- package/src/authoring/design-time-layers.ts +849 -0
- package/src/authoring/design-time-mount-registry.ts +235 -0
- package/src/authoring/design-time-settle.ts +343 -0
- package/src/authoring/edit-mode-authoring.ts +619 -0
- package/src/authoring/eyedropper-session.ts +60 -0
- package/src/authoring/instance-source-menu-register.ts +13 -0
- package/src/authoring/instance-source-menu.ts +135 -0
- package/src/authoring/layered-pick.ts +183 -0
- package/src/authoring/live-gesture-lock.ts +50 -0
- package/src/authoring/live-object-transform.ts +62 -0
- package/src/authoring/mount-failure-report.ts +154 -0
- package/src/authoring/mounted-root-subjects.ts +144 -0
- package/src/authoring/no-authoring-adapter.ts +55 -0
- package/src/authoring/null-inspection-subjects.tsx +75 -0
- package/src/authoring/object3d-document-persistence.ts +106 -0
- package/src/authoring/object3d-document-session-registry.ts +120 -0
- package/src/authoring/object3d-document-session.ts +1326 -0
- package/src/authoring/object3d-gesture-controller.ts +113 -0
- package/src/authoring/panel-authoring.ts +121 -0
- package/src/authoring/prefab-instance-inspector-section.tsx +237 -0
- package/src/authoring/prefab-instance-section-model.ts +55 -0
- package/src/authoring/project-authoring-session.ts +105 -0
- package/src/authoring/provenance.ts +99 -0
- package/src/authoring/quarks-particle-systems.ts +19 -0
- package/src/authoring/react-canvas-navigation.ts +255 -0
- package/src/authoring/react-design-canvas-style.ts +20 -0
- package/src/authoring/react-story-board.ts +937 -0
- package/src/authoring/selection-scope.ts +195 -0
- package/src/authoring/shell-document-ops.ts +169 -0
- package/src/authoring/shell-object3d-document-write-policy.ts +108 -0
- package/src/authoring/shell-viewport-policy.ts +48 -0
- package/src/authoring/source-object3d-authoring-adapter.ts +526 -0
- package/src/authoring/stories-scope.ts +35 -0
- package/src/authoring/story-board-chrome-fit.ts +107 -0
- package/src/authoring/story-board-presentation.ts +111 -0
- package/src/authoring/three-projection-core.ts +226 -0
- package/src/authoring/viewport-pick-context.ts +40 -0
- package/src/authoring/viewport-raycast.ts +240 -0
- package/src/authoring/viewport-tool-context.ts +73 -0
- package/src/authoring/world-canvas-viewport-state.ts +35 -0
- package/src/authoring/world-hidden-viewport.ts +152 -0
- package/src/authoring/world-pan-state.ts +198 -0
- package/src/authoring/world-session-state.ts +101 -0
- package/src/authoring/write-pipe.ts +173 -0
- package/src/availability-tick.ts +66 -0
- package/src/bitmap-label.ts +120 -0
- package/src/blender-tab-metrics.ts +161 -0
- package/src/board-open-actions.ts +20 -0
- package/src/boot-routing.ts +391 -0
- package/src/build-identity.ts +15 -0
- package/src/bytes-codec.ts +62 -0
- package/src/camera-authoring.ts +175 -0
- package/src/cancellation-reason.ts +58 -0
- package/src/canvas-preview-frames.ts +482 -0
- package/src/capture-camera-pose.ts +77 -0
- package/src/chrome-registry.ts +159 -0
- package/src/chrome-slot-registry.ts +91 -0
- package/src/collaboration-client.ts +264 -0
- package/src/collaboration-presence.ts +41 -0
- package/src/command-dispatch.ts +19 -0
- package/src/command-listener.ts +2743 -0
- package/src/command-registry.ts +70 -0
- package/src/component-board-registry.ts +205 -0
- package/src/component-states-registry.ts +200 -0
- package/src/components/AgentPresentationNotice.tsx +75 -0
- package/src/components/AlignToolbar.tsx +204 -0
- package/src/components/AppRoot.tsx +394 -0
- package/src/components/ApplicationMenus.tsx +415 -0
- package/src/components/AssetBrowser.tsx +2843 -0
- package/src/components/AssetEditorShell.tsx +216 -0
- package/src/components/AssetInspectorToolSection.tsx +124 -0
- package/src/components/BoardRulers.tsx +354 -0
- package/src/components/CameraInfo.tsx +81 -0
- package/src/components/CanvasSceneViewport.tsx +556 -0
- package/src/components/CapabilityCoverageSection.tsx +185 -0
- package/src/components/CenterDocuments.tsx +22 -0
- package/src/components/ChromeSlot.tsx +20 -0
- package/src/components/CodeView.tsx +470 -0
- package/src/components/CollaborationHeaderControl.css +74 -0
- package/src/components/CompactInspectorCard.tsx +190 -0
- package/src/components/CompactInspectorShell.tsx +39 -0
- package/src/components/ConsolePanel.css +55 -0
- package/src/components/ConsolePanel.tsx +270 -0
- package/src/components/DefaultEditorLayout.tsx +106 -0
- package/src/components/DocumentHeaderStrip.tsx +96 -0
- package/src/components/DocumentShelfRail.tsx +45 -0
- package/src/components/DocumentThumbnail.tsx +345 -0
- package/src/components/EditorLeaseGuard.tsx +372 -0
- package/src/components/ErrorBanner.tsx +123 -0
- package/src/components/FolderPreviewTile.tsx +159 -0
- package/src/components/GameHierarchy.tsx +3842 -0
- package/src/components/GameplaySessionTimeline.tsx +295 -0
- package/src/components/InspectionProjection.tsx +968 -0
- package/src/components/Inspector.tsx +233 -0
- package/src/components/InspectorCanvasPreview.tsx +35 -0
- package/src/components/InspectorFieldsSection.tsx +290 -0
- package/src/components/InspectorObjectPreview.tsx +57 -0
- package/src/components/InspectorStoriesSection.tsx +92 -0
- package/src/components/InspectorToolSection.tsx +96 -0
- package/src/components/InspectorTransformSection.tsx +245 -0
- package/src/components/LightExplorerPanel.tsx +433 -0
- package/src/components/MediaProperties.tsx +145 -0
- package/src/components/NonThreeAuthoringBootstrap.tsx +19 -0
- package/src/components/Object3DDocumentToolbar.css +100 -0
- package/src/components/Object3DDocumentToolbar.tsx +454 -0
- package/src/components/Object3DDocumentViewport.tsx +58 -0
- package/src/components/ProjectHeader.css +617 -0
- package/src/components/ProjectHeader.tsx +328 -0
- package/src/components/ProjectLayout.tsx +249 -0
- package/src/components/ReactCanvasControls.tsx +284 -0
- package/src/components/RootSelectionOverlay.tsx +3162 -0
- package/src/components/RootTextEditor.tsx +79 -0
- package/src/components/SaveStatus.tsx +70 -0
- package/src/components/StageHost.tsx +1954 -0
- package/src/components/StageOverlays.tsx +21 -0
- package/src/components/StartupErrorScreen.tsx +76 -0
- package/src/components/StartupLoadingScreen.tsx +65 -0
- package/src/components/StatsOverlay.tsx +78 -0
- package/src/components/SurfaceStateOverlay.tsx +24 -0
- package/src/components/ToolContributionSurfaces.tsx +65 -0
- package/src/components/ToolHost.tsx +370 -0
- package/src/components/ToolObject3DPreview.tsx +39 -0
- package/src/components/Toolbar.tsx +595 -0
- package/src/components/TransientHint.tsx +44 -0
- package/src/components/TransportStrip.tsx +174 -0
- package/src/components/VersionControlSection.tsx +470 -0
- package/src/components/VgaiLogo.css +83 -0
- package/src/components/VgaiLogo.tsx +35 -0
- package/src/components/ViewportControlsHint.tsx +60 -0
- package/src/components/ViewportFurniture.tsx +401 -0
- package/src/components/ViewportOverlay.tsx +145 -0
- package/src/components/ViewportOverlaysMenu.tsx +153 -0
- package/src/components/ViewportShadingMenu.tsx +300 -0
- package/src/components/ViewportViewMenu.tsx +101 -0
- package/src/components/WorkspaceDocumentSurface.tsx +204 -0
- package/src/components/WorkspaceUtilitySurface.tsx +22 -0
- package/src/components/WorktreeSwitcher.css +239 -0
- package/src/components/WorktreeSwitcher.tsx +890 -0
- package/src/components/account-documents.tsx +1162 -0
- package/src/components/asset-documents.tsx +812 -0
- package/src/components/asset-editor-persistence.ts +216 -0
- package/src/components/asset-selection-section.tsx +535 -0
- package/src/components/asset-thumbnails.tsx +312 -0
- package/src/components/asset-viewers/AudioViewer.tsx +201 -0
- package/src/components/asset-viewers/EntityModelDocument.tsx +122 -0
- package/src/components/asset-viewers/EnvironmentAssetDocument.tsx +440 -0
- package/src/components/asset-viewers/GenericJsonViewer.tsx +102 -0
- package/src/components/asset-viewers/ImageViewer.tsx +300 -0
- package/src/components/asset-viewers/JsonAssetDocument.tsx +93 -0
- package/src/components/asset-viewers/LiveModuleDocument.tsx +417 -0
- package/src/components/asset-viewers/LutAssetDocument.tsx +444 -0
- package/src/components/asset-viewers/ModelAssetDocument.tsx +105 -0
- package/src/components/asset-viewers/Object3DPreview.tsx +359 -0
- package/src/components/asset-viewers/OnlineAssetDetail.tsx +421 -0
- package/src/components/asset-viewers/PasteboardModuleDocument.tsx +67 -0
- package/src/components/asset-viewers/QuarksAssetDocument.tsx +526 -0
- package/src/components/asset-viewers/ShaderAssetDocument.tsx +743 -0
- package/src/components/asset-viewers/SourceAssetViewer.tsx +281 -0
- package/src/components/asset-viewers/SpritesheetSpriteView.tsx +102 -0
- package/src/components/asset-viewers/VideoViewer.tsx +101 -0
- package/src/components/asset-viewers/shader-source.ts +144 -0
- package/src/components/asset-workflow.css +731 -0
- package/src/components/board-guides.ts +150 -0
- package/src/components/compact-inspector.css +539 -0
- package/src/components/core-utilities.tsx +90 -0
- package/src/components/editor-notifications.css +40 -0
- package/src/components/engine-workspace.css +274 -0
- package/src/components/inspector-preview-section.tsx +238 -0
- package/src/components/inspector-property-grouping.ts +64 -0
- package/src/components/inspector-revert-label.ts +20 -0
- package/src/components/inspector-selection.ts +42 -0
- package/src/components/inspector-stories-gating.ts +171 -0
- package/src/components/inspector-transform-subject.ts +11 -0
- package/src/components/inspector-transform.ts +75 -0
- package/src/components/kind-documents.tsx +500 -0
- package/src/components/palette-action-publisher.tsx +140 -0
- package/src/components/primitives/DraftColorInput.tsx +74 -0
- package/src/components/product-shell.css +1829 -0
- package/src/components/project-tool-documents.tsx +410 -0
- package/src/components/scene-documents.tsx +223 -0
- package/src/components/stage-keyboard.tsx +37 -0
- package/src/components/stage-overlay-set.tsx +107 -0
- package/src/components/stage-presence-markers.ts +478 -0
- package/src/components/standard-viewport-dressing.ts +417 -0
- package/src/components/status-contributions.tsx +403 -0
- package/src/components/tool-documents.tsx +309 -0
- package/src/components/tool-schema-form.tsx +262 -0
- package/src/components/use-after-paint.ts +41 -0
- package/src/components/use-project-image-assets.ts +86 -0
- package/src/components/viewport-header-controls.css +90 -0
- package/src/components/viewport-surface-status.tsx +55 -0
- package/src/components/workspace-history.ts +32 -0
- package/src/components/workspace-static-panel-registry.tsx +152 -0
- package/src/components/workspace-surfaces.css +621 -0
- package/src/components/world-documents.tsx +586 -0
- package/src/components/world-overlay-gestures.ts +1694 -0
- package/src/composite-screenshot.ts +1641 -0
- package/src/console-sync.ts +131 -0
- package/src/constraint-helper.ts +338 -0
- package/src/content-entry-source-registry.ts +184 -0
- package/src/coverage/authoring-seam-evidence.ts +300 -0
- package/src/coverage/canvas-reveal.ts +192 -0
- package/src/coverage/design-time-surfaces.ts +101 -0
- package/src/coverage/live-seam-evidence.ts +11 -0
- package/src/coverage/ontology-invariants.ts +466 -0
- package/src/coverage/session-vitals.ts +501 -0
- package/src/coverage/system-seam-evidence.ts +72 -0
- package/src/crash-null-boundary.ts +36 -0
- package/src/creation-site-edit.ts +1479 -0
- package/src/creation-site-registry.ts +160 -0
- package/src/delegate-harness-registry.ts +143 -0
- package/src/document-context-registry.ts +177 -0
- package/src/document-open-registry.ts +200 -0
- package/src/document-preview-source.ts +20 -0
- package/src/document-renderer-session.ts +138 -0
- package/src/editor-api.ts +46 -0
- package/src/editor-chrome-capture.ts +139 -0
- package/src/editor-commands.ts +164 -0
- package/src/editor-console.ts +563 -0
- package/src/editor-current-view.ts +82 -0
- package/src/editor-document-probe.ts +881 -0
- package/src/editor-git-client.ts +115 -0
- package/src/editor-host-door.ts +462 -0
- package/src/editor-hotkeys.ts +842 -0
- package/src/editor-lease-view.ts +39 -0
- package/src/editor-lease.ts +415 -0
- package/src/editor-mode.ts +19 -0
- package/src/editor-notifications.ts +140 -0
- package/src/editor-presence.ts +563 -0
- package/src/editor-presentation-activity.ts +50 -0
- package/src/editor-presentation-notice.ts +42 -0
- package/src/editor-runtime.tsx +145 -0
- package/src/editor-server-response.ts +86 -0
- package/src/editor-session-attribution.ts +75 -0
- package/src/editor-session-mode.ts +54 -0
- package/src/editor-shell-store.ts +1304 -0
- package/src/editor-state-facets.ts +74 -0
- package/src/editor-styles.css +33 -0
- package/src/editor-view-presentation.ts +810 -0
- package/src/editor-viewport.ts +5302 -0
- package/src/entity-lod.ts +31 -0
- package/src/entity-object.ts +91 -0
- package/src/files/file-provider.ts +62 -0
- package/src/files/project-files.ts +264 -0
- package/src/finders/index.ts +136 -0
- package/src/finders/scenes-from-entrypoint-selection.ts +387 -0
- package/src/frame/bridge.tsx +1408 -0
- package/src/frame/product.ts +77 -0
- package/src/gameplay-dom-recording.ts +319 -0
- package/src/gameplay-export-state.ts +14 -0
- package/src/gameplay-replay.ts +417 -0
- package/src/gameplay-session-time.ts +9 -0
- package/src/gameplay-sessions.ts +204 -0
- package/src/harness-chat-types.ts +253 -0
- package/src/hierarchy-component-marks.ts +298 -0
- package/src/hierarchy-drop.ts +91 -0
- package/src/hierarchy-expansion-state.ts +80 -0
- package/src/hierarchy-header-slot.ts +52 -0
- package/src/hierarchy-internals.ts +197 -0
- package/src/hierarchy-kind-icon.ts +217 -0
- package/src/hierarchy-mark-reader.ts +73 -0
- package/src/hierarchy-menu-registry.ts +67 -0
- package/src/hierarchy-node-rows.ts +307 -0
- package/src/hierarchy-panel-view.ts +280 -0
- package/src/hierarchy-projection.ts +76 -0
- package/src/hierarchy-row-cache.ts +243 -0
- package/src/hierarchy-row-model.ts +308 -0
- package/src/hierarchy-rows.ts +11 -0
- package/src/hierarchy-walk.ts +86 -0
- package/src/history/editor-session.ts +25 -0
- package/src/history/history-commands.ts +147 -0
- package/src/history/history-delegate.ts +163 -0
- package/src/history/history-limit-notices.ts +43 -0
- package/src/history/history-service.ts +1173 -0
- package/src/history/persistence-coordinator.ts +35 -0
- package/src/history/project-file-history.ts +386 -0
- package/src/history/project-root-history-backends.ts +139 -0
- package/src/history/resource-registry.ts +209 -0
- package/src/history/snapshot-store.ts +103 -0
- package/src/history/source-history-backend.ts +546 -0
- package/src/history/types.ts +124 -0
- package/src/hmr-registration-group.ts +67 -0
- package/src/hmr-stable-react-context.ts +23 -0
- package/src/hotkeys.ts +188 -0
- package/src/inference-diagnostics.ts +69 -0
- package/src/initial-project.ts +80 -0
- package/src/inspection/active-subject.ts +578 -0
- package/src/inspection/active-surface.ts +142 -0
- package/src/inspection/compose.ts +1064 -0
- package/src/inspection/display.ts +170 -0
- package/src/inspection/document-subject.ts +109 -0
- package/src/inspection/game-subject.ts +85 -0
- package/src/inspection/model.ts +542 -0
- package/src/inspection/null-subject.ts +115 -0
- package/src/inspection/serialize.ts +357 -0
- package/src/inspection/use-active-inspection.ts +180 -0
- package/src/inspector-presentation.ts +201 -0
- package/src/inspector-section-registry.ts +221 -0
- package/src/instance-source-actions.ts +163 -0
- package/src/instanced-presentation.ts +164 -0
- package/src/js-heap.ts +71 -0
- package/src/key-actions.ts +91 -0
- package/src/keymap-presets.ts +401 -0
- package/src/layout-policy.ts +31 -0
- package/src/learn-links.ts +73 -0
- package/src/light-explorer-model.ts +134 -0
- package/src/live-canvas-frame.ts +55 -0
- package/src/live-document.ts +279 -0
- package/src/live-module-source.ts +230 -0
- package/src/live-session-registry.ts +220 -0
- package/src/live-transition.ts +633 -0
- package/src/manifest-project.ts +107 -0
- package/src/model-thumbnail.ts +523 -0
- package/src/native-selection-style.ts +202 -0
- package/src/object3d-document-write-policy.ts +137 -0
- package/src/packaged-runtime.ts +108 -0
- package/src/palettes/maya.palette.json +57 -0
- package/src/palettes/substance.palette.json +57 -0
- package/src/pasteboard-module.ts +81 -0
- package/src/performance-profiler.ts +367 -0
- package/src/performance-sources.ts +69 -0
- package/src/play-boot-phase.ts +145 -0
- package/src/presentation-surface.ts +248 -0
- package/src/project-adapter.ts +1143 -0
- package/src/project-asset-refresh.ts +26 -0
- package/src/project-declaration-refresh.ts +31 -0
- package/src/project-local-state.ts +118 -0
- package/src/project-manager.ts +243 -0
- package/src/project-module-changes.ts +163 -0
- package/src/project-module-split.ts +266 -0
- package/src/project-provenance.ts +115 -0
- package/src/project-ready.ts +42 -0
- package/src/project-session-reset.ts +67 -0
- package/src/project-shape.ts +68 -0
- package/src/project-tool-discovery.ts +66 -0
- package/src/project-tools.ts +107 -0
- package/src/project-work-types.ts +149 -0
- package/src/projection/three.ts +898 -0
- package/src/projection/types.ts +44 -0
- package/src/readiness.ts +113 -0
- package/src/reflection-probe-helper.ts +142 -0
- package/src/reported-play-state.ts +90 -0
- package/src/resolve-relative-specifier.ts +33 -0
- package/src/scene-document-plan.ts +315 -0
- package/src/scene-framing.ts +315 -0
- package/src/scene-live-open.ts +210 -0
- package/src/scene-view-fog.ts +89 -0
- package/src/scoped-game-css.ts +152 -0
- package/src/session-orphan-record.ts +193 -0
- package/src/session-tombstone.ts +126 -0
- package/src/settings/settings-provider.ts +82 -0
- package/src/settings-store.ts +345 -0
- package/src/shared-view-restore.ts +42 -0
- package/src/shell-store-door.ts +45 -0
- package/src/source-conflict.ts +122 -0
- package/src/spatial-handle-visuals.ts +332 -0
- package/src/stage-context.ts +341 -0
- package/src/stage-store-registry.ts +63 -0
- package/src/stale-chunk-recovery.ts +34 -0
- package/src/state-report-deferral.ts +73 -0
- package/src/storage/host-files-storage.ts +97 -0
- package/src/storage/http-storage.ts +174 -0
- package/src/storage/index.ts +75 -0
- package/src/storage/mem-storage.ts +149 -0
- package/src/storage/path-lock.ts +44 -0
- package/src/storage/paths.ts +26 -0
- package/src/storage/types.ts +116 -0
- package/src/stories/StoryComponentThumbnail.tsx +184 -0
- package/src/stories/StoryPreviewMount.tsx +306 -0
- package/src/stories/component-content-source.tsx +106 -0
- package/src/stories/component-states-source.ts +78 -0
- package/src/stories/compose-project-stories.ts +255 -0
- package/src/stories/pixi-story-model.ts +30 -0
- package/src/stories/prefabs-finder.ts +54 -0
- package/src/stories/prefabs-from-stories.ts +182 -0
- package/src/stories/project-story-discovery.ts +78 -0
- package/src/stories/project-story-regions.ts +24 -0
- package/src/stories/story-actions.ts +54 -0
- package/src/stories/story-capture-command.ts +124 -0
- package/src/stories/story-capture.ts +584 -0
- package/src/stories/story-declared-medium.ts +126 -0
- package/src/stories/story-discovery.ts +176 -0
- package/src/stories/story-document-openers.ts +36 -0
- package/src/stories/story-dom-runtime.ts +78 -0
- package/src/stories/story-grouping.ts +111 -0
- package/src/stories/story-lane.ts +88 -0
- package/src/stories/story-mount-turn.ts +27 -0
- package/src/stories/story-opener.ts +260 -0
- package/src/stories/story-pixi-preview.ts +408 -0
- package/src/stories/story-presentation.ts +215 -0
- package/src/stories/story-registry.ts +517 -0
- package/src/stories/story-three-preview.ts +807 -0
- package/src/stories/three-story-model.ts +96 -0
- package/src/story-three-preview-runtime.ts +56 -0
- package/src/surface-keyboard.ts +112 -0
- package/src/surface-state.ts +124 -0
- package/src/tab-bootstrap.js +628 -0
- package/src/tab-census.ts +198 -0
- package/src/tab-lifecycle-client.ts +196 -0
- package/src/theme-library.ts +844 -0
- package/src/theme-preference.ts +378 -0
- package/src/theme.css +3437 -0
- package/src/three-viewport/bone-selection-highlight.ts +119 -0
- package/src/three-viewport/camera-fit.ts +41 -0
- package/src/three-viewport/interactive-renderer.ts +132 -0
- package/src/three-viewport/selection-brackets.ts +310 -0
- package/src/three-viewport/selection-outline.ts +183 -0
- package/src/three-viewport/skeleton-helper.ts +61 -0
- package/src/three-viewport/source-color.ts +167 -0
- package/src/three-viewport/studio-environment.ts +96 -0
- package/src/three-viewport-presentation.ts +23 -0
- package/src/tool-contribution-play.ts +74 -0
- package/src/tool-loader.ts +1798 -0
- package/src/transform-mode-request.ts +57 -0
- package/src/transient-hint.ts +78 -0
- package/src/trigger-volume-helper.ts +116 -0
- package/src/ui-source/adapter-region-includes.ts +241 -0
- package/src/ui-source/ensure-import.ts +132 -0
- package/src/ui-source/file-region-resolver.ts +302 -0
- package/src/ui-source/inspect.ts +775 -0
- package/src/ui-source/oid-transform.ts +1845 -0
- package/src/ui-source/plan-csf-story.ts +196 -0
- package/src/ui-source/plan-extract-component.ts +421 -0
- package/src/ui-source/plan-fork-component.ts +621 -0
- package/src/ui-source/plan-named-style.ts +95 -0
- package/src/ui-source/plan-source-edit.ts +353 -0
- package/src/ui-source/r3f-contract-resolver.ts +327 -0
- package/src/ui-source/r3f-diagnostic-index.ts +165 -0
- package/src/ui-source/r3f-environment-binding.ts +133 -0
- package/src/ui-source/r3f-joint-binding.ts +251 -0
- package/src/ui-source/r3f-lod-binding.ts +91 -0
- package/src/ui-source/r3f-particle-binding.ts +235 -0
- package/src/ui-source/r3f-physics-binding.ts +483 -0
- package/src/ui-source/r3f-project-contracts.ts +444 -0
- package/src/ui-source/relative-import-specifier.ts +34 -0
- package/src/ui-source/reparent-guard.ts +544 -0
- package/src/ui-source/source-edit-request.ts +97 -0
- package/src/ui-source/source-write-backend.ts +618 -0
- package/src/ui-source/syntactic-prop-specs.ts +296 -0
- package/src/ui-source/tier-source-write-backend.ts +279 -0
- package/src/ui-source/ts-ast.ts +171 -0
- package/src/ui-source/utility-class-support.ts +169 -0
- package/src/ui-source/write-component-default.ts +133 -0
- package/src/ui-source/writer.ts +1989 -0
- package/src/viewport-activation-timings.ts +840 -0
- package/src/viewport-authoring-policy.ts +186 -0
- package/src/viewport-controls-hint.ts +57 -0
- package/src/viewport-door.ts +237 -0
- package/src/viewport-shading-boundary.ts +12 -0
- package/src/vite-error-surface.ts +141 -0
- package/src/wait-until.ts +37 -0
- package/src/workspace-areas.ts +156 -0
- package/src/workspace-aux-commands.ts +11 -0
- package/src/workspace-available-documents.ts +127 -0
- package/src/workspace-core-utilities.ts +31 -0
- package/src/workspace-document-ids.ts +59 -0
- package/src/workspace-document-registry.ts +612 -0
- package/src/workspace-document-restore.ts +145 -0
- package/src/workspace-host-commands.ts +141 -0
- package/src/workspace-persistence-gate.ts +40 -0
- package/src/workspace-play-utilities.ts +44 -0
- package/src/workspace-presets.ts +425 -0
- package/src/workspace-regions.ts +294 -0
- package/src/workspace-state-persistence.ts +536 -0
- package/src/workspace-static-panels.ts +73 -0
- package/src/workspace-status-registry.ts +121 -0
- package/src/workspace-style.ts +239 -0
- package/src/workspace-utility-commands.ts +74 -0
- package/src/workspace-utility-registry.ts +263 -0
- package/src/workspace-viewport-rect.ts +97 -0
- package/src/world-adoption.ts +115 -0
- package/src/world-document-routing.ts +104 -0
- package/vite-plugin-creation-site-write.ts +184 -0
- package/vite-plugin-creation-site.ts +80 -0
- package/vite-plugin-game-static.ts +303 -0
- package/vite-plugin-module-doorways.ts +336 -0
- package/vite-plugin-product-contributions.ts +197 -0
- package/vite-plugin-project-game-static.ts +125 -0
- package/vite-plugin-project-jsx-js.ts +65 -0
- package/vite-plugin-project-root-absolute-assets.ts +359 -0
- package/vite-plugin-shared-react.ts +420 -0
- package/vite-plugin-shared-three.ts +203 -0
- package/vite-plugin-ui-oid.ts +2106 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portable-story mounting — C3 (spec §9). Wraps the REAL Storybook 9
|
|
3
|
+
* portable-stories API (`composeStories`/`setProjectAnnotations` from
|
|
4
|
+
* `@storybook/react`, confirmed against `node_modules/@storybook/react/dist/
|
|
5
|
+
* index.d.ts`) so a dynamically-imported CSF module (`*.stories.tsx`/
|
|
6
|
+
* `*.stories.ts`, found by `story-discovery.ts`) becomes a map of named,
|
|
7
|
+
* fully-composed React components — args/decorators/play all applied by
|
|
8
|
+
* Storybook itself, never re-implemented here. `loaders` are ALSO applied by
|
|
9
|
+
* Storybook itself, but only once the caller awaits the composed story's own
|
|
10
|
+
* `.load()` — Storybook 9's portable-story contract requires that explicit
|
|
11
|
+
* call before render (confirmed in `storybook/dist/preview-api/index.cjs`'s
|
|
12
|
+
* `composeStory`: loader data is populated inside `load()`, and the render
|
|
13
|
+
* function only picks it up if `load()` already ran). `mountIsolatedStory`
|
|
14
|
+
* (`StoryPreviewMount.tsx`) is the caller that does this, awaiting `.load()`
|
|
15
|
+
* before its first render.
|
|
16
|
+
*
|
|
17
|
+
* `setProjectAnnotations` "should be run a single time" (its own doc
|
|
18
|
+
* comment) — `ensureProjectAnnotations` below does that exactly once per
|
|
19
|
+
* editor session, from the project's `.storybook/preview.ts(x)` if the
|
|
20
|
+
* project has one, else an empty array (Storybook's own default). This is
|
|
21
|
+
* the ONLY place project annotations are threaded; no VGAI-specific
|
|
22
|
+
* override.
|
|
23
|
+
*
|
|
24
|
+
* No duplicate story format anywhere: `composeProjectStories` takes the
|
|
25
|
+
* loaded module namespace as-is (whatever `story-discovery.ts`'s `load()`
|
|
26
|
+
* returned from Vite's `/@fs/` dynamic import) and hands it straight to
|
|
27
|
+
* `composeStories` — the CSF module on disk is read directly and is the only
|
|
28
|
+
* story definition that ever exists.
|
|
29
|
+
*
|
|
30
|
+
* WHICH `@storybook/react` (and therefore which `react`) does the composing
|
|
31
|
+
* is `story-dom-runtime.ts`'s question, not this module's: under the
|
|
32
|
+
* packaged runtime the CSF module's own hooks resolve against the PROJECT's
|
|
33
|
+
* react, so the compose/mount machinery must come from that same graph or
|
|
34
|
+
* every story dies on "Invalid hook call" (see
|
|
35
|
+
* `vite-plugin-module-doorways.ts`). That seam is why both entry points below
|
|
36
|
+
* are async.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
import type { ComposedStoryFn } from 'storybook/internal/types';
|
|
40
|
+
import { resolveStoryDomRuntime } from './story-dom-runtime';
|
|
41
|
+
|
|
42
|
+
let projectAnnotationsApplied: Promise<void> | null = null;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Apply the project's `.storybook/preview` annotations to the portable-story
|
|
46
|
+
* runtime exactly once per session (repeat calls are no-ops — `composeStories`
|
|
47
|
+
* itself picks up whatever `setProjectAnnotations` last set, and re-calling
|
|
48
|
+
* with a DIFFERENT project mid-session would be a footgun, not a feature. A
|
|
49
|
+
* project switch reloads the whole editor page today, which resets this
|
|
50
|
+
* module-level flag along with everything else).
|
|
51
|
+
*
|
|
52
|
+
* `previewAnnotations` is `undefined` when the project has no
|
|
53
|
+
* `.storybook/preview.ts(x)` (this repo ships none — no `.storybook` folder
|
|
54
|
+
* anywhere, confirmed by search) — Storybook's own documented default is an
|
|
55
|
+
* empty project-annotations object, which `setProjectAnnotations([])`
|
|
56
|
+
* already models via `composeStories`'s own `?? []` fallback.
|
|
57
|
+
*/
|
|
58
|
+
export function ensureProjectAnnotations(previewAnnotations?: unknown): Promise<void> {
|
|
59
|
+
// The latch holds the IN-FLIGHT promise, not a boolean: a second caller
|
|
60
|
+
// arriving while the first is still resolving the story runtime must wait
|
|
61
|
+
// on the SAME application (compose-after-await ordering), not sail past a
|
|
62
|
+
// `true` flag and compose before any annotations landed.
|
|
63
|
+
projectAnnotationsApplied ??= resolveStoryDomRuntime().then((runtime) => {
|
|
64
|
+
// biome-ignore lint/suspicious/noExplicitAny: `setProjectAnnotations` accepts the project's raw preview module namespace, whose shape is Storybook's own (NamedOrDefaultProjectAnnotations) — not something this editor declares.
|
|
65
|
+
runtime.setProjectAnnotations((previewAnnotations ?? []) as any);
|
|
66
|
+
});
|
|
67
|
+
return projectAnnotationsApplied;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Test-only escape hatch: `ensureProjectAnnotations` is deliberately
|
|
71
|
+
* once-per-session: this resets that latch so each test file gets a clean
|
|
72
|
+
* slate rather than leaking a fixture's annotations into a later assertion. */
|
|
73
|
+
export function _resetProjectAnnotationsForTest(): void {
|
|
74
|
+
projectAnnotationsApplied = null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** One successfully composed named story, ready for the preview UI to mount. */
|
|
78
|
+
export interface ComposedProjectStory {
|
|
79
|
+
/** The CSF export name, e.g. `Primary`. */
|
|
80
|
+
name: string;
|
|
81
|
+
/** Storybook's stable composed id (title + export), when supplied. */
|
|
82
|
+
id: string;
|
|
83
|
+
/** Storybook's human-facing story name, falling back to the export name. */
|
|
84
|
+
label: string;
|
|
85
|
+
/** CSF meta title when explicitly authored (e.g. `Game/2048`). */
|
|
86
|
+
title?: string;
|
|
87
|
+
/** Name/display identity of CSF `meta.component`, when the module declared
|
|
88
|
+
* one. This is the ONLY join between a story and the component it renders —
|
|
89
|
+
* the asset browser matches a `three` prefab to its thumbnail story on it,
|
|
90
|
+
* and a React root matches its own entry component to its composed default
|
|
91
|
+
* preview (both via `story-registry.ts`'s `pickComponentPreviewStory`).
|
|
92
|
+
* Absent for a story whose meta names no component. */
|
|
93
|
+
componentName?: string;
|
|
94
|
+
/** Storybook's own composed CSF tags. The editor may use ordinary custom
|
|
95
|
+
* tags to project one project registry into distinct design boards; the
|
|
96
|
+
* story module remains the sole source of truth. */
|
|
97
|
+
tags?: readonly string[];
|
|
98
|
+
/** Fully-composed Storybook parameters. VGAI only reads the namespaced
|
|
99
|
+
* `parameters.vgai` association; every other parameter remains Storybook's. */
|
|
100
|
+
parameters: Record<string, unknown>;
|
|
101
|
+
/** Storybook's fully-composed globals. Viewport selection is read from
|
|
102
|
+
* here exactly as the viewport addon reads it; no editor-side story
|
|
103
|
+
* metadata is introduced. */
|
|
104
|
+
globals?: Record<string, unknown>;
|
|
105
|
+
/** Whether this CSF meta/story explicitly authors `globals.viewport`.
|
|
106
|
+
* Storybook treats that as a locked viewport for the story. Project
|
|
107
|
+
* `initialGlobals` still chooses a default without disabling the toolbar. */
|
|
108
|
+
viewportLocked?: boolean;
|
|
109
|
+
/** Fully composed initial args. Kept as Storybook produced them so the
|
|
110
|
+
* editor can render idiomatic Controls for an active story without
|
|
111
|
+
* inventing a second fixture/state format. */
|
|
112
|
+
args: Record<string, unknown>;
|
|
113
|
+
/** The real Storybook portable-story component — args/decorators/loaders
|
|
114
|
+
* already applied; `.play` present when the original story declared one. */
|
|
115
|
+
Component: ComposedStoryFn;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** The result of composing one loaded CSF module. */
|
|
119
|
+
export type ComposeResult =
|
|
120
|
+
| { ok: true; stories: ComposedProjectStory[] }
|
|
121
|
+
| { ok: false; error: string };
|
|
122
|
+
|
|
123
|
+
/** The display/name identity of a React component — a function/class (its
|
|
124
|
+
* `displayName` or `.name`); anything else names nothing. Exported because
|
|
125
|
+
* BOTH sides of the story↔component join must compute the identity the same
|
|
126
|
+
* way: this file reads it off a CSF `meta.component`, and
|
|
127
|
+
* `design-time-layers.ts` reads it off a root entry's default export before
|
|
128
|
+
* asking `story-registry.ts`'s `getComponentPreviewStory` for that
|
|
129
|
+
* component's story. */
|
|
130
|
+
export function componentIdentityName(component: unknown): string | undefined {
|
|
131
|
+
if (!component || (typeof component !== 'function' && typeof component !== 'object')) {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
const displayName = (component as Record<string, unknown>)['displayName'];
|
|
135
|
+
if (typeof displayName === 'string') return displayName;
|
|
136
|
+
return typeof component === 'function' && component.name ? component.name : undefined;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Compose a dynamically-imported CSF module (`story-discovery.ts`'s
|
|
141
|
+
* `load()` result) into its named, portable-story components via the real
|
|
142
|
+
* `composeStories` (spec §9 "mount through Storybook portable-story APIs").
|
|
143
|
+
*
|
|
144
|
+
* Error handling (spec §9 "Errors identify the source module and story
|
|
145
|
+
* export"): a module with no default export (no Meta — every CSF file needs
|
|
146
|
+
* one), or a `composeStories` call that throws (e.g. a story referencing a
|
|
147
|
+
* component that itself throws on import), surfaces an error naming
|
|
148
|
+
* `modulePath`. A per-story failure is narrower still — `composeStories`
|
|
149
|
+
* composes every export independently, so one bad story doesn't take the
|
|
150
|
+
* rest of the module down; a story whose export isn't a valid CSF
|
|
151
|
+
* annotation is simply not a function/object Storybook recognizes and is
|
|
152
|
+
* skipped rather than crashing the whole module (mirrors `composeStories`'s
|
|
153
|
+
* own `Store_CSFExports`-keyed-mapped-type contract, which already excludes
|
|
154
|
+
* anything that isn't shaped like a story).
|
|
155
|
+
*/
|
|
156
|
+
export async function composeProjectStories(
|
|
157
|
+
modulePath: string,
|
|
158
|
+
mod: unknown,
|
|
159
|
+
): Promise<ComposeResult> {
|
|
160
|
+
const record = (mod ?? {}) as Record<string, unknown>;
|
|
161
|
+
if (record['default'] === null || typeof record['default'] !== 'object') {
|
|
162
|
+
return {
|
|
163
|
+
ok: false,
|
|
164
|
+
error:
|
|
165
|
+
`[stories] ${modulePath} has no default export — every CSF file exports ` +
|
|
166
|
+
`\`export default { title, component, ... } satisfies Meta<...>\` ` +
|
|
167
|
+
'(see the template example: src/ui/Button.stories.tsx). Skipped.',
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
let composed: Record<string, unknown>;
|
|
172
|
+
try {
|
|
173
|
+
const runtime = await resolveStoryDomRuntime();
|
|
174
|
+
// biome-ignore lint/suspicious/noExplicitAny: `composeStories` is generically typed over the module's own CSF export shape (Store_CSFExports<ReactRenderer, TModule>), which we can't name statically for an arbitrary dynamically-imported project module.
|
|
175
|
+
composed = runtime.composeStories(record as any) as Record<string, unknown>;
|
|
176
|
+
} catch (err) {
|
|
177
|
+
return {
|
|
178
|
+
ok: false,
|
|
179
|
+
error: `[stories] ${modulePath} failed to compose — ${String(err instanceof Error ? err.message : err)}`,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const meta = record['default'] as Record<string, unknown>;
|
|
184
|
+
const title = typeof meta['title'] === 'string' ? meta['title'] : undefined;
|
|
185
|
+
const componentName = componentIdentityName(meta['component']);
|
|
186
|
+
const humanizeStoryName = (name: string): string =>
|
|
187
|
+
name
|
|
188
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
189
|
+
.replace(/[-_]+/g, ' ')
|
|
190
|
+
.trim();
|
|
191
|
+
|
|
192
|
+
const stories: ComposedProjectStory[] = Object.entries(composed)
|
|
193
|
+
.filter((entry): entry is [string, ComposedStoryFn] => typeof entry[1] === 'function')
|
|
194
|
+
.map(([name, Component]) => {
|
|
195
|
+
const portable = Component as unknown as Record<string, unknown>;
|
|
196
|
+
const authoredStory = record[name];
|
|
197
|
+
const authoredStoryRecord =
|
|
198
|
+
authoredStory && typeof authoredStory === 'object'
|
|
199
|
+
? (authoredStory as Record<string, unknown>)
|
|
200
|
+
: null;
|
|
201
|
+
const metaGlobals =
|
|
202
|
+
meta['globals'] && typeof meta['globals'] === 'object'
|
|
203
|
+
? (meta['globals'] as Record<string, unknown>)
|
|
204
|
+
: null;
|
|
205
|
+
const storyGlobals =
|
|
206
|
+
authoredStoryRecord?.['globals'] && typeof authoredStoryRecord['globals'] === 'object'
|
|
207
|
+
? (authoredStoryRecord['globals'] as Record<string, unknown>)
|
|
208
|
+
: null;
|
|
209
|
+
const explicitLabel = authoredStoryRecord?.['name'];
|
|
210
|
+
return {
|
|
211
|
+
name,
|
|
212
|
+
id: typeof portable['id'] === 'string' ? portable['id'] : name,
|
|
213
|
+
label:
|
|
214
|
+
typeof explicitLabel === 'string'
|
|
215
|
+
? explicitLabel
|
|
216
|
+
: humanizeStoryName(
|
|
217
|
+
typeof portable['storyName'] === 'string' ? portable['storyName'] : name,
|
|
218
|
+
),
|
|
219
|
+
...(title ? { title } : {}),
|
|
220
|
+
...(componentName ? { componentName } : {}),
|
|
221
|
+
tags: Array.isArray(portable['tags'])
|
|
222
|
+
? portable['tags'].filter((tag): tag is string => typeof tag === 'string')
|
|
223
|
+
: [],
|
|
224
|
+
parameters:
|
|
225
|
+
portable['parameters'] && typeof portable['parameters'] === 'object'
|
|
226
|
+
? (portable['parameters'] as Record<string, unknown>)
|
|
227
|
+
: {},
|
|
228
|
+
globals:
|
|
229
|
+
portable['globals'] && typeof portable['globals'] === 'object'
|
|
230
|
+
? { ...(portable['globals'] as Record<string, unknown>) }
|
|
231
|
+
: {},
|
|
232
|
+
viewportLocked:
|
|
233
|
+
Object.hasOwn(metaGlobals ?? {}, 'viewport') ||
|
|
234
|
+
Object.hasOwn(storyGlobals ?? {}, 'viewport'),
|
|
235
|
+
args:
|
|
236
|
+
portable['args'] && typeof portable['args'] === 'object'
|
|
237
|
+
? { ...(portable['args'] as Record<string, unknown>) }
|
|
238
|
+
: {},
|
|
239
|
+
// Object.entries() loses the predicate's value refinement under the
|
|
240
|
+
// root build tsconfig; the filter above is the runtime proof.
|
|
241
|
+
Component: Component as ComposedStoryFn,
|
|
242
|
+
};
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
if (stories.length === 0) {
|
|
246
|
+
return {
|
|
247
|
+
ok: false,
|
|
248
|
+
error:
|
|
249
|
+
`[stories] ${modulePath} exports no named stories — a CSF file needs at least one ` +
|
|
250
|
+
'named export alongside the default Meta export (see src/ui/Button.stories.tsx). Skipped.',
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return { ok: true, stories };
|
|
255
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared, headless facts about a CANVAS story: whether a mounted story holds
|
|
3
|
+
* Pixi content. The exact counterpart of `three-story-model.ts`'s
|
|
4
|
+
* `mountedStoryHasThreeContent`, kept pure and off the React tree.
|
|
5
|
+
*
|
|
6
|
+
* Membership is DECLARED (`story-declared-medium.ts`). This module does not
|
|
7
|
+
* classify a story by mounting it.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { Container } from 'pixi.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Whether a mounted story's stage actually holds Pixi content.
|
|
14
|
+
*
|
|
15
|
+
* A story can mount a `<Application>` successfully and render nothing into it —
|
|
16
|
+
* a gate whose condition never became true, a component that returns `null`.
|
|
17
|
+
* That is a successful mount with nothing in it, and a surface shows a story
|
|
18
|
+
* that rendered SOMETHING; "the mount succeeded" alone is not the test. Exactly
|
|
19
|
+
* the rule (and exactly the expression) `mountedStoryHasThreeContent` states
|
|
20
|
+
* for the three surface.
|
|
21
|
+
*/
|
|
22
|
+
export function mountedStoryHasPixiContent(stage: Container): boolean {
|
|
23
|
+
if (stage.children.length === 0) return false;
|
|
24
|
+
// An empty wrapper (`<pixiContainer>` around a still-loading piece) is
|
|
25
|
+
// a child and not content. Isolation and IsolatedPiece both land pixels
|
|
26
|
+
// after an async asset load; a 0×0 stage is the same "gate never true"
|
|
27
|
+
// case the header names.
|
|
28
|
+
const bounds = stage.getBounds();
|
|
29
|
+
return bounds.width > 1 && bounds.height > 1;
|
|
30
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `prefabsFromStories` FINDER — the name a project's `vgai.adapter.ts`
|
|
3
|
+
* selects, registered beside the story registry it reads.
|
|
4
|
+
*
|
|
5
|
+
* WHY IT READS ITS OWN LEDGER. The algorithm used to be an ENGINE finder
|
|
6
|
+
* (`packages/editor/src/finders/prefabs-from-stories.ts`) whose
|
|
7
|
+
* `input.stories` the editor's adapter loader filled, which is how the loader
|
|
8
|
+
* came to reach the story registry through a contract field nothing else ever
|
|
9
|
+
* filled. `FinderInput.stories` is gone; the finder gathers its own
|
|
10
|
+
* registrations here, and `input.components` is the only project fact it is
|
|
11
|
+
* handed.
|
|
12
|
+
*
|
|
13
|
+
* Registered by `project-adapter.ts`, the ONE sanctioned importer of the
|
|
14
|
+
* engine's finder namespace (that file's header states the rule).
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { z } from 'zod';
|
|
18
|
+
import { prefabsFromStories, type StoryRegistration } from './prefabs-from-stories';
|
|
19
|
+
import { getProjectStoryModules, isDeclaredDefaultStory } from './story-registry';
|
|
20
|
+
|
|
21
|
+
/** Every story the project's registry has composed, in the finder's
|
|
22
|
+
* vocabulary. */
|
|
23
|
+
function storyRegistrations(): StoryRegistration[] {
|
|
24
|
+
const out: StoryRegistration[] = [];
|
|
25
|
+
for (const module_ of getProjectStoryModules()) {
|
|
26
|
+
if (!module_.ok) continue;
|
|
27
|
+
for (const story of module_.stories) {
|
|
28
|
+
out.push({
|
|
29
|
+
modulePath: module_.modulePath,
|
|
30
|
+
storyId: story.id,
|
|
31
|
+
label: story.label,
|
|
32
|
+
...(story.componentName === undefined ? {} : { componentName: story.componentName }),
|
|
33
|
+
isDefault: isDeclaredDefaultStory(story),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const storyPrefabsFinder = {
|
|
41
|
+
name: 'prefabsFromStories',
|
|
42
|
+
schema: z.object({ finder: z.literal('prefabsFromStories') }).strict(),
|
|
43
|
+
run(
|
|
44
|
+
selection: { finder: 'prefabsFromStories' },
|
|
45
|
+
input: {
|
|
46
|
+
components?: readonly { name: string; path: string; region?: string | null }[];
|
|
47
|
+
},
|
|
48
|
+
) {
|
|
49
|
+
return prefabsFromStories(selection, {
|
|
50
|
+
stories: storyRegistrations(),
|
|
51
|
+
...(input.components === undefined ? {} : { components: input.components }),
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FINDER — prefabs from colocated portable-CSF story registrations.
|
|
3
|
+
*
|
|
4
|
+
* IT LIVES HERE, and not in the engine's finder namespace, since 2026-09-18
|
|
5
|
+
* (phase 1 unit 11, edge 8). It was `packages/project/src/adapter/finders/
|
|
6
|
+
* prefabs-from-stories.ts`, a host-owned discovery algorithm the engine
|
|
7
|
+
* registered and whose `input.stories` the editor's adapter loader FILLED from
|
|
8
|
+
* the story registry — which is how `project-adapter.ts` came to import the
|
|
9
|
+
* registry, and through it Storybook, into every editor boot. The finder
|
|
10
|
+
* CONTRIBUTION point (`.finder`, `tool-loader.ts`) already collects
|
|
11
|
+
* package-shipped modules, so the algorithm and its data now arrive together
|
|
12
|
+
* and the host fills nothing: `FinderInput.stories` is gone with it.
|
|
13
|
+
*
|
|
14
|
+
* The finder NAME is unchanged, because it is a project's own declaration
|
|
15
|
+
* (`{ finder: 'prefabsFromStories' }` in every `vgai.adapter.ts`). A build
|
|
16
|
+
* without this package leaves that selection unregistered, which the host
|
|
17
|
+
* already reports as a standing note rather than a throw.
|
|
18
|
+
*
|
|
19
|
+
* The function itself is untouched — pure over its inputs, structurally typed
|
|
20
|
+
* exactly as `@volter/editor-blender`'s `modelsFromBlendFiles` finder is, importing no
|
|
21
|
+
* engine module.
|
|
22
|
+
*
|
|
23
|
+
* ARCHITECTURE-CORE §Roots: "A prefab is an ordinary source component that a
|
|
24
|
+
* designer independently places, duplicates, or reuses, explicitly registered
|
|
25
|
+
* for Content by a colocated portable story whose `meta.component` names it."
|
|
26
|
+
* The registration is the load-bearing reference — delete the story and the
|
|
27
|
+
* declaration is gone — which is why source SHAPE alone never admits a prefab.
|
|
28
|
+
*
|
|
29
|
+
* EXTRACTION, not a new rule. The join implemented here is the one the editor
|
|
30
|
+
* already runs:
|
|
31
|
+
* - the match + same-source-directory tiebreak:
|
|
32
|
+
* `packages/editor/src/stories/story-registry.ts:162-186`
|
|
33
|
+
* (`componentPreviewStories`) and `:148-159` (`pickComponentPreviewStory`);
|
|
34
|
+
* - the default-story preference: `story-registry.ts:118-123`
|
|
35
|
+
* (`isDeclaredDefaultStory`);
|
|
36
|
+
* - the admission rule "a component with no story is not a Content entry at
|
|
37
|
+
* all": `packages/editor/src/components/AssetBrowser.tsx`, the
|
|
38
|
+
* `browserEntries` content scope (`if (!previewStory) return []`).
|
|
39
|
+
* `meta.component`'s identity NAME is read live by
|
|
40
|
+
* `packages/editor/src/stories/compose-project-stories.ts:130` /
|
|
41
|
+
* `:185` (`componentIdentityName`) — this finder consumes that answer rather
|
|
42
|
+
* than re-deriving it, so both sides of the join agree by construction.
|
|
43
|
+
*
|
|
44
|
+
* Pure over its inputs: the host hands in the registrations the story registry
|
|
45
|
+
* already produced and the component index it already has.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/** What a finder hands back, structurally (`@editor/finders`'s
|
|
49
|
+
* `FinderResult`): entries for the document table, plus notes the host
|
|
50
|
+
* surfaces. Spelled here rather than imported, the way every other
|
|
51
|
+
* package-shipped finder spells it — the engine's finder namespace has
|
|
52
|
+
* exactly ONE sanctioned importer and this is not it. */
|
|
53
|
+
interface DocumentEntry {
|
|
54
|
+
readonly id: string;
|
|
55
|
+
readonly label: string;
|
|
56
|
+
readonly kind: string;
|
|
57
|
+
readonly region?: string | null;
|
|
58
|
+
readonly authorable?: boolean;
|
|
59
|
+
readonly reach?: { readonly kind: 'story'; readonly storyId: string };
|
|
60
|
+
readonly source?: { readonly path: string; readonly export?: string };
|
|
61
|
+
readonly finder?: string;
|
|
62
|
+
}
|
|
63
|
+
interface FinderResult {
|
|
64
|
+
readonly entries: readonly DocumentEntry[];
|
|
65
|
+
readonly notes: readonly string[];
|
|
66
|
+
readonly defaultId?: string | null;
|
|
67
|
+
}
|
|
68
|
+
interface PrefabsFromStoriesParams {
|
|
69
|
+
readonly finder: 'prefabsFromStories';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** One composed portable-CSF story, as the host's story registry reports it. */
|
|
73
|
+
export interface StoryRegistration {
|
|
74
|
+
/** Project-relative path of the CSF module (`src/prefabs/HeroBox.stories.tsx`). */
|
|
75
|
+
readonly modulePath: string;
|
|
76
|
+
/** The composed story's stable id. */
|
|
77
|
+
readonly storyId: string;
|
|
78
|
+
/** Human label for the story. */
|
|
79
|
+
readonly label: string;
|
|
80
|
+
/**
|
|
81
|
+
* `meta.component`'s identity name. Absent ⇒ this story is joined to nothing
|
|
82
|
+
* and declares no prefab — an ordinary story document, not a defect.
|
|
83
|
+
*/
|
|
84
|
+
readonly componentName?: string;
|
|
85
|
+
/** Whether the module declares this story as its component's default. */
|
|
86
|
+
readonly isDefault?: boolean;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** One entry of the host's project component index. */
|
|
90
|
+
export interface ProjectComponentRef {
|
|
91
|
+
readonly name: string;
|
|
92
|
+
/** Project-relative source path of the component's own module. */
|
|
93
|
+
readonly path: string;
|
|
94
|
+
/** Region this component's surface belongs to, when the host knows it. */
|
|
95
|
+
readonly region?: string | null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface PrefabsFromStoriesInput {
|
|
99
|
+
readonly stories: readonly StoryRegistration[];
|
|
100
|
+
/**
|
|
101
|
+
* The project's component index. Supplies each prefab's own source path and
|
|
102
|
+
* region; absent, entries still exist (the story IS the declaration) and
|
|
103
|
+
* simply carry no `source`.
|
|
104
|
+
*/
|
|
105
|
+
readonly components?: readonly ProjectComponentRef[];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Directory portion of a project-relative path — `story-registry.ts:126`'s `sourceDir`. */
|
|
109
|
+
function sourceDir(path: string): string {
|
|
110
|
+
const normalized = path.replaceAll('\\', '/').replace(/^\.\//, '');
|
|
111
|
+
const slash = normalized.lastIndexOf('/');
|
|
112
|
+
return slash >= 0 ? normalized.slice(0, slash) : '';
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Group the registrations by the component their meta NAMES. A story naming
|
|
116
|
+
* none is joined to nothing and declares no prefab. */
|
|
117
|
+
function storiesByComponent(
|
|
118
|
+
stories: readonly StoryRegistration[],
|
|
119
|
+
): Map<string, StoryRegistration[]> {
|
|
120
|
+
const byComponent = new Map<string, StoryRegistration[]>();
|
|
121
|
+
for (const story of stories) {
|
|
122
|
+
const name = story.componentName;
|
|
123
|
+
if (name === undefined || name === '') continue;
|
|
124
|
+
const bucket = byComponent.get(name);
|
|
125
|
+
if (bucket) bucket.push(story);
|
|
126
|
+
else byComponent.set(name, [story]);
|
|
127
|
+
}
|
|
128
|
+
return byComponent;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The story that speaks for a component: colocated beats distant
|
|
133
|
+
* (story-registry.ts:177-180 — two files can export a same-named component),
|
|
134
|
+
* and within that set the module's own declared default wins
|
|
135
|
+
* (story-registry.ts:118-123).
|
|
136
|
+
*/
|
|
137
|
+
function chooseStory(
|
|
138
|
+
stories: readonly StoryRegistration[],
|
|
139
|
+
component: ProjectComponentRef | undefined,
|
|
140
|
+
): { chosen: StoryRegistration | undefined; colocated: boolean } {
|
|
141
|
+
const sameDir = component
|
|
142
|
+
? stories.filter((story) => sourceDir(story.modulePath) === sourceDir(component.path))
|
|
143
|
+
: [];
|
|
144
|
+
const pool = sameDir.length > 0 ? sameDir : stories;
|
|
145
|
+
return {
|
|
146
|
+
chosen: pool.find((story) => story.isDefault === true) ?? pool[0],
|
|
147
|
+
colocated: sameDir.length > 0,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function prefabsFromStories(
|
|
152
|
+
_params: PrefabsFromStoriesParams,
|
|
153
|
+
input: PrefabsFromStoriesInput,
|
|
154
|
+
): FinderResult {
|
|
155
|
+
const entries: DocumentEntry[] = [];
|
|
156
|
+
const notes: string[] = [];
|
|
157
|
+
for (const [componentName, stories] of storiesByComponent(input.stories)) {
|
|
158
|
+
const component = input.components?.find((candidate) => candidate.name === componentName);
|
|
159
|
+
const { chosen, colocated } = chooseStory(stories, component);
|
|
160
|
+
if (!chosen) continue;
|
|
161
|
+
if (component && !colocated) {
|
|
162
|
+
notes.push(
|
|
163
|
+
`prefabsFromStories: "${componentName}" is declared by ${chosen.modulePath}, which is not ` +
|
|
164
|
+
`colocated with ${component.path}. The join is by name; confirm it names this component.`,
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
entries.push({
|
|
168
|
+
id: componentName,
|
|
169
|
+
label: componentName,
|
|
170
|
+
kind: 'prefab',
|
|
171
|
+
region: component?.region ?? null,
|
|
172
|
+
authorable: true,
|
|
173
|
+
reach: { kind: 'story', storyId: chosen.storyId },
|
|
174
|
+
...(component ? { source: { path: component.path, export: component.name } } : {}),
|
|
175
|
+
finder: 'prefabsFromStories',
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Prefabs are sibling documents, never the default scene — a finder that
|
|
180
|
+
// cannot settle a default says nothing rather than nominating one.
|
|
181
|
+
return { entries, notes };
|
|
182
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project Storybook discovery lifecycle. Story navigation is a project
|
|
3
|
+
* capability, not a side effect of mounting a particular React world or
|
|
4
|
+
* opening a Story document.
|
|
5
|
+
*
|
|
6
|
+
* `story-lane.ts` starts it, as one piece of the kit's own CSF install, and
|
|
7
|
+
* never `EditorContext.tsx`: the editor's first render is not what decides
|
|
8
|
+
* whether a project's stories are scanned.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { connectStoryFileEvents } from '../asset-events';
|
|
12
|
+
import { getCurrentProject, onProjectChange } from '../project-manager';
|
|
13
|
+
import { subscribeProjectModuleChange } from '../project-module-changes';
|
|
14
|
+
import { waitForFirstViewportFrame } from '../viewport-activation-timings';
|
|
15
|
+
import { resetUndeclaredStoryMediumReports } from './story-declared-medium';
|
|
16
|
+
import { refreshProjectStories } from './story-registry';
|
|
17
|
+
|
|
18
|
+
/** Discover after the first authored frame, then re-discover on project
|
|
19
|
+
* switches, CSF file add/remove events, and CONTENT writes to `src/**`.
|
|
20
|
+
* The content trigger exists because a story renders the project's own
|
|
21
|
+
* components: Apply-to-Component rewrote a prefab's default and the board
|
|
22
|
+
* kept exhibiting the old one — the registry only ever heard about
|
|
23
|
+
* added/removed story FILES, never a changed module (runhuman pass 43).
|
|
24
|
+
* Dev tier: the HMR module-change channel. Browser tier: the storage
|
|
25
|
+
* backend's own watch. A newer refresh supersedes an in-flight older pass. */
|
|
26
|
+
export function startProjectStoryDiscovery(): () => void {
|
|
27
|
+
let refreshGeneration = 0;
|
|
28
|
+
let stopped = false;
|
|
29
|
+
const refresh = (changedPaths?: ReadonlySet<string>): void => {
|
|
30
|
+
const generation = ++refreshGeneration;
|
|
31
|
+
resetUndeclaredStoryMediumReports();
|
|
32
|
+
// Story discovery feeds the Content panel and design boards; none of those
|
|
33
|
+
// may hold the opening world behind evaluation of every prefab's CSF graph.
|
|
34
|
+
// Wait for the first honest authored frame. There is deliberately no timer:
|
|
35
|
+
// on a slow cold GPU, a five-second fallback fired while the Scene was still
|
|
36
|
+
// constructing and moved the entire story graph back onto its critical path.
|
|
37
|
+
// A genuinely broken viewport is not a reason to import every asset story in
|
|
38
|
+
// the background; explicitly opening a Story/board calls
|
|
39
|
+
// `refreshProjectStories` directly and remains its recovery door.
|
|
40
|
+
void waitForFirstViewportFrame().then(() => {
|
|
41
|
+
if (stopped || generation !== refreshGeneration) return;
|
|
42
|
+
return refreshProjectStories(getCurrentProject(), undefined, {
|
|
43
|
+
deferUndeclared: true,
|
|
44
|
+
...(changedPaths ? { changedPaths } : {}),
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
refresh();
|
|
49
|
+
// Content writes arrive per keystroke-ish (autosave); coalesce a burst into
|
|
50
|
+
// one rescan rather than re-importing every CSF module per write.
|
|
51
|
+
let contentTimer: ReturnType<typeof setTimeout> | null = null;
|
|
52
|
+
let pendingContentPaths = new Set<string>();
|
|
53
|
+
const refreshOnContentWrite = (path: string): void => {
|
|
54
|
+
// Dev reports absolute paths, storage reports project-relative ones; the
|
|
55
|
+
// filter is the same fact both ways: a source module under src/.
|
|
56
|
+
const match = /(?:^|\/)(src\/.+\.(?:[cm]?tsx?|jsx?))$/.exec(path);
|
|
57
|
+
if (!match) return;
|
|
58
|
+
pendingContentPaths.add(match[1] ?? path);
|
|
59
|
+
if (contentTimer !== null) clearTimeout(contentTimer);
|
|
60
|
+
contentTimer = setTimeout(() => {
|
|
61
|
+
contentTimer = null;
|
|
62
|
+
const changed = pendingContentPaths;
|
|
63
|
+
pendingContentPaths = new Set();
|
|
64
|
+
refresh(changed);
|
|
65
|
+
}, 1_000);
|
|
66
|
+
};
|
|
67
|
+
const stopModuleWatch = subscribeProjectModuleChange(refreshOnContentWrite);
|
|
68
|
+
const stopProjectWatch = onProjectChange(() => refresh());
|
|
69
|
+
const stopStoryFileWatch = connectStoryFileEvents(refresh);
|
|
70
|
+
return () => {
|
|
71
|
+
stopped = true;
|
|
72
|
+
refreshGeneration += 1;
|
|
73
|
+
if (contentTimer !== null) clearTimeout(contentTimer);
|
|
74
|
+
stopModuleWatch();
|
|
75
|
+
stopProjectWatch();
|
|
76
|
+
stopStoryFileWatch();
|
|
77
|
+
};
|
|
78
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The open project's regions, as story classification reads them.
|
|
3
|
+
*
|
|
4
|
+
* Filled from `/__editor/story-files` (the same fetch that lists CSF modules)
|
|
5
|
+
* so presence and board membership answer from the adapter + manifest the
|
|
6
|
+
* server already read, not from a second walk. Tests inject a table directly.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { ProjectRegionEntry } from '../asset-workflow/project-source-index';
|
|
10
|
+
|
|
11
|
+
let _regions: readonly ProjectRegionEntry[] = [];
|
|
12
|
+
|
|
13
|
+
export function getProjectStoryRegions(): readonly ProjectRegionEntry[] {
|
|
14
|
+
return _regions;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function setProjectStoryRegions(regions: readonly ProjectRegionEntry[]): void {
|
|
18
|
+
_regions = regions;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Test-only. */
|
|
22
|
+
export function __resetProjectStoryRegionsForTest(): void {
|
|
23
|
+
_regions = [];
|
|
24
|
+
}
|