@volter/editor-game 0.5.65 → 0.5.67
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/contributions/audio-unlock.service.ts +2 -2
- package/contributions/autoplay.service.ts +1 -1
- package/contributions/bridge.command.ts +3 -3
- package/contributions/canvas/component-board.service.ts +16 -0
- package/contributions/canvas/design-time-mount.service.ts +45 -0
- package/contributions/canvas-story-capture.service.ts +12 -0
- package/contributions/edit-mode-audio.service.ts +2 -2
- package/contributions/edit-mode-networking.service.ts +1 -1
- package/contributions/gameplay.command.ts +4 -4
- package/contributions/generation.service.ts +3 -3
- package/contributions/generations.status.tsx +1 -1
- package/contributions/godot.palette.json +99 -0
- package/contributions/godot.style.ts +82 -0
- package/contributions/godot.view.ts +75 -0
- package/contributions/ingest.service.ts +4 -4
- package/contributions/instances.command.ts +1 -1
- package/contributions/navmesh.menu.ts +1 -1
- package/contributions/network-observer.service.ts +14 -0
- package/contributions/play.command.ts +11 -5
- package/contributions/react/component-board.service.ts +1 -1
- package/contributions/react/design-time-mount.service.ts +1 -1
- package/contributions/react/react-inspector.service.ts +2 -2
- package/contributions/scene-document.service.ts +5 -5
- package/contributions/state-watch.menu.ts +1 -1
- package/contributions/state-watch.utility.tsx +1 -1
- package/contributions/team-playtest.service.ts +4 -4
- package/contributions/three/component-board.service.ts +1 -1
- package/contributions/three/component-verbs.command.ts +8 -8
- package/contributions/three/three-authoring.service.ts +8 -5
- package/contributions/three-story-capture.service.ts +12 -0
- package/contributions/unity.palette.json +102 -0
- package/contributions/unity.style.ts +72 -0
- package/contributions/unity.view.ts +82 -0
- package/contributions/unreal.palette.json +105 -0
- package/contributions/unreal.style.ts +66 -0
- package/contributions/unreal.view.ts +93 -0
- package/dist-node/serving.mjs +16 -0
- package/package.json +33 -16
- package/serving/index.ts +27 -0
- package/src/asset-budget/AssetBudgetPanel.tsx +1 -1
- package/src/asset-budget/asset-budget-model.ts +4 -4
- package/src/asset-budget/optimize-apply.ts +7 -7
- package/src/audio/AudioDebuggerPanel.tsx +1 -1
- package/src/bridge/dispatch.ts +16 -16
- package/src/bridge/live-frames.ts +1 -1
- package/src/bridge/screenshot.ts +6 -6
- package/src/build/BuildProfilesPanel.tsx +3 -3
- package/src/canvas/canvas-board/CanvasBoardDocument.tsx +676 -0
- package/src/canvas/canvas-board/canvas-board-model.ts +407 -0
- package/src/canvas/canvas-board/canvas-component-board.ts +56 -0
- package/src/canvas/canvas-design-mount.ts +524 -0
- package/src/canvas/design-time-canvas-mount.ts +79 -0
- package/src/coverage/live-authoring-surface.ts +6 -6
- package/src/coverage/live-project-verbs.ts +2 -2
- package/src/coverage/native-system-coverage.ts +6 -6
- package/src/coverage/root-coverage.ts +1 -1
- package/src/coverage/session-coverage.ts +5 -5
- package/src/design-system-stories/ApplicationChrome.stories.tsx +5 -5
- package/src/design-system-stories/InspectorNarrowBodies.stories.tsx +13 -53
- package/src/edit-mode/edit-mode-audio.ts +4 -4
- package/src/edit-mode/edit-mode-networking.ts +2 -2
- package/src/game-document/GameCaptureFrameButton.tsx +2 -2
- package/src/game-document/GameDocument.tsx +2 -2
- package/src/game-document/GamePanel.tsx +8 -8
- package/src/game-document/InstanceInspectorPicker.tsx +2 -2
- package/src/game-document/crowd-debug.ts +1 -1
- package/src/game-document/device-preview.ts +10 -11
- package/src/game-document/physics-debug.ts +1 -1
- package/src/generation/GenerationActivity.tsx +6 -8
- package/src/generation/generation-documents.tsx +8 -8
- package/src/generation/generation-jobs.ts +2 -2
- package/src/generation/generation-presentation.ts +1 -1
- package/src/host/adapter-reach.ts +1 -1
- package/src/host/adapter-runtime-bindings.ts +97 -6
- package/src/host/api/configurations.ts +2 -2
- package/src/host/authoring/babylon-authoring-adapter.ts +8 -8
- package/src/host/authoring/contract-hierarchy-authoring.ts +1 -1
- package/src/host/authoring/contract-scenes-stories.ts +1 -1
- package/src/host/authoring/creation-site-related.ts +2 -2
- package/src/host/authoring/ephemeral-persistence.ts +1 -1
- package/src/host/authoring/gesture-persist.ts +2 -2
- package/src/host/authoring/ingest-data-writer.ts +1 -1
- package/src/host/authoring/ingest-source-persistence.ts +8 -8
- package/src/host/authoring/mount-isolated-pixi-screen.ts +1 -1
- package/src/host/authoring/mounted-authoring.ts +4 -4
- package/src/host/authoring/phaser-live-authoring-adapter.ts +4 -4
- package/src/host/authoring/pixi-authoring-adapter.ts +42 -17
- package/src/host/authoring/pixi-creation-site-write-target.ts +2 -2
- package/src/host/authoring/pixi-live-write-target.ts +7 -7
- package/src/host/authoring/pixi-source-identity.ts +3 -3
- package/src/host/authoring/pixi-source-write-target.ts +1614 -0
- package/src/host/authoring/pixi-still-presentation.ts +2 -2
- package/src/host/authoring/pixi-structure-history.ts +3 -3
- package/src/host/authoring/pixi-transform-channels.ts +16 -14
- package/src/host/authoring/source-persistence-backend.ts +6 -6
- package/src/host/authoring/struct-write-pipe.ts +3 -3
- package/src/host/binding-resolver.ts +8 -9
- package/src/host/browser-transpile.ts +2 -2
- package/src/host/canvas-entry-runtime.ts +59 -48
- package/src/host/canvas-preview-frames.ts +482 -0
- package/src/host/components/CameraAuthoringOverlay.tsx +1 -1
- package/src/host/components/HeaderTelemetry.tsx +9 -16
- package/src/host/components/PixiIsolationSceneContent.tsx +17 -16
- package/src/host/components/ThreeIsolationSceneContent.tsx +5 -5
- package/src/host/components/frame-debugger-model.ts +2 -2
- package/src/host/components/header-telemetry-model.ts +2 -2
- package/src/host/components/scene-document.tsx +29 -61
- package/src/host/components/utility-view-state.ts +1 -1
- package/src/host/components/world-root-stage-binding.tsx +17 -26
- package/src/host/components/world-root-stage.ts +130 -63
- package/src/host/coverage/capability-coverage.ts +13 -1
- package/src/host/coverage/game-contract-seam-evidence.ts +1 -1
- package/src/host/coverage/project-verb-coverage.ts +2 -17
- package/src/host/coverage/system-adapter-coverage.ts +4 -5
- package/src/host/design-system-stories/fixtures/editor-runtime.tsx +14 -8
- package/src/host/document-preview-three.ts +2 -2
- package/src/host/entry-adjudication.ts +6 -6
- package/src/host/game-css-scope-transform.ts +4 -0
- package/src/host/game-module-access.ts +1 -1
- package/src/host/game-realm-page.ts +16 -8
- package/src/host/game-realm-reclaim.ts +1 -1
- package/src/host/gameplay-export.ts +25 -14
- package/src/host/gameplay-recording.ts +5 -5
- package/src/host/gated-globals.ts +6 -6
- package/src/host/history/json-history-resource.ts +3 -3
- package/src/host/instance-extract-actions.ts +1 -1
- package/src/host/instance-fork-actions.ts +1 -1
- package/src/host/projection/dom.ts +2 -2
- package/src/host/projection/pixi.ts +25 -3
- package/src/host/r3f-entry-runtime.ts +65 -34
- package/src/host/react-mount-runtime.ts +8 -49
- package/src/host/realm-services.ts +2 -2
- package/src/host/roots/canvas-root.tsx +361 -0
- package/src/host/roots/module-root.ts +1 -1
- package/src/host/roots/r3f-root.tsx +473 -0
- package/src/host/roots/react-root.ts +9 -43
- package/src/host/scene-view-drawability.ts +2 -2
- package/src/host/served-bundle-runtime-modules.ts +1 -19
- package/src/host/server-log-bridge.ts +3 -3
- package/src/host/stories/mounted-story-viewport-source.ts +1 -1
- package/src/host/stories/pixi-story-model.ts +30 -0
- package/src/host/stories/story-media-captures.ts +46 -0
- package/src/host/stories/story-media-presence.ts +3 -3
- package/src/host/stories/story-pixi-preview.ts +408 -0
- package/src/host/stories/story-three-preview.ts +806 -0
- package/src/host/stories/three-story-captures.ts +35 -0
- package/src/host/story-three-preview-runtime.ts +56 -0
- package/src/host/three-ingest-runtime.ts +1 -1
- package/src/host/use-active-performance-source.ts +3 -3
- package/src/host/viewport-pose-memory.ts +1 -1
- package/src/host/viewport-root-presentation.ts +6 -5
- package/src/ingest/active-ingest.ts +2 -2
- package/src/ingest/authoring/ingest-dom-surface-authoring.ts +4 -4
- package/src/ingest/authoring/ingest-root-adapter.ts +13 -13
- package/src/ingest/capture-wait-report.ts +1 -1
- package/src/ingest/deferred-ingest-play.ts +11 -10
- package/src/ingest/discovery-public-ingest.ts +2 -2
- package/src/ingest/ingest-boot-viewport.ts +6 -8
- package/src/ingest/ingest-canvas-scene-document.tsx +17 -16
- package/src/ingest/ingest-canvas-scene.ts +5 -8
- package/src/ingest/ingest-evidence-hook.ts +1 -1
- package/src/ingest/ingest-frame-snapshot.ts +1 -1
- package/src/ingest/ingest-play-control.ts +4 -4
- package/src/ingest/ingest-render-debug.ts +11 -11
- package/src/ingest/ingest-siblings.ts +16 -28
- package/src/ingest/module-mode.ts +18 -19
- package/src/ingest/mount-canvas-ingest-root.ts +27 -27
- package/src/ingest/mount-coverage.ts +4 -4
- package/src/ingest/mount-dom-ingest-root.ts +16 -16
- package/src/ingest/mount-ingest-root.ts +14 -14
- package/src/ingest/mount-three-ingest-root.ts +12 -12
- package/src/ingest/resolve-canvas.ts +1 -1
- package/src/ingest/served-html-boot.ts +1 -1
- package/src/ingest/surface-canvas.ts +1 -1
- package/src/ingest/unmount-ingest-root.ts +7 -7
- package/src/navmesh/navmesh-handler.ts +24 -16
- package/src/network/NetworkInspectorPanel.tsx +449 -14
- package/src/network/network-inspector-model.ts +14 -2
- package/src/play/play-log-events.ts +1 -1
- package/src/play/play-mode.ts +99 -142
- package/src/play/play-recording.ts +2 -2
- package/src/play/react-play-live-authoring.ts +3 -3
- package/src/play/run-selection.ts +93 -0
- package/src/play-bar/PlayBar.tsx +20 -39
- package/src/profiler/FrameDebuggerPanel.tsx +1 -1
- package/src/profiler/PerformancePanel.tsx +4 -4
- package/src/react/design-time-react-mount.ts +37 -85
- package/src/react/dom-authoring-adapter.ts +11 -11
- package/src/react/react-inspector-section.tsx +13 -13
- package/src/react/react-world-authoring-adapter.ts +31 -143
- package/src/react/story-documents/story-documents.tsx +18 -22
- package/src/react/ui-board-document.tsx +10 -11
- package/src/react/ui-component-board.ts +5 -5
- package/src/runtime/adapter/audio-meter.ts +21 -0
- package/src/runtime/adapter/first-party-audio-system.ts +230 -0
- package/src/runtime/adapter/ingest/contract-debug-adapter.ts +114 -0
- package/src/runtime/adapter/ingest/contract-system-adapters.ts +256 -0
- package/src/runtime/adapter/ingest/merge-debug-adapters.ts +197 -0
- package/src/runtime/adapter/ingest/observation-debug-adapter.ts +162 -0
- package/src/runtime/adapter/ingest/upstream-pin.ts +51 -0
- package/src/runtime/adapter/native-debug-module.ts +498 -0
- package/src/runtime/audio/bus-mixer.ts +161 -0
- package/src/runtime/audio/pose-guard.ts +80 -0
- package/src/runtime/core/frame-pacing.ts +126 -0
- package/src/runtime/core/game-loop.ts +225 -0
- package/src/runtime/core/game-scoped-slot.ts +28 -0
- package/src/runtime/core/seeded-random.ts +162 -0
- package/src/runtime/core/sim-clock.ts +391 -0
- package/src/runtime/core/system-runner.ts +269 -0
- package/src/runtime/core/types.ts +104 -0
- package/src/runtime/create-runtime.ts +1128 -0
- package/src/runtime/debug-bridge.ts +570 -0
- package/src/runtime/debug-registry.ts +899 -0
- package/src/runtime/dev/chrome-trace.ts +153 -0
- package/src/runtime/dev/instruments.ts +403 -0
- package/src/runtime/dev/logger.ts +119 -0
- package/src/runtime/dev/performance-profiler.ts +367 -0
- package/src/runtime/dev/register-render-vitals.ts +276 -0
- package/src/runtime/dev/render-census.ts +354 -0
- package/src/runtime/dev/render-debug-adapter.ts +218 -0
- package/src/runtime/dev/render-memory.ts +226 -0
- package/src/runtime/dev/render-vitals.ts +338 -0
- package/src/runtime/dev/static-batch-advisor.ts +188 -0
- package/src/runtime/dev/webgl-frame-capture.ts +366 -0
- package/src/runtime/dev/webgl-gpu-timer.ts +53 -0
- package/src/runtime/dev-build.ts +47 -0
- package/src/runtime/game.ts +1636 -0
- package/src/runtime/gameplay-rng-trap.ts +135 -0
- package/src/runtime/host-context.ts +64 -0
- package/src/runtime/input-router.ts +169 -0
- package/src/runtime/mount-manifest.ts +480 -0
- package/src/runtime/pixi/authoring.ts +706 -0
- package/src/runtime/pixi/ingest.ts +116 -0
- package/src/runtime/pixi/physics-registry.ts +49 -0
- package/src/runtime/pixi/render-pass-bracket.ts +117 -0
- package/src/runtime/pixi/scene-capture.ts +179 -0
- package/src/runtime/pixi/system-adapters.ts +69 -0
- package/src/runtime/playtest.ts +22 -0
- package/src/runtime/presentation.ts +141 -0
- package/src/runtime/render-control.ts +642 -0
- package/src/runtime/render-seed.ts +77 -0
- package/src/runtime/run-ticks-settled.ts +73 -0
- package/src/runtime/setup/setup-audio.ts +72 -0
- package/src/services/audio-pose-guard.ts +2 -2
- package/src/services/game-audio.ts +152 -0
- package/src/services/game-network.ts +657 -0
- package/src/services/game-physics.ts +334 -0
- package/src/state-watch/StateWatchPanel.tsx +1 -1
- package/src/three/authoring/camera-runtime-inspector-section.tsx +4 -3
- package/src/three/authoring/constraint-inspector-section.tsx +8 -7
- package/src/three/authoring/model-asset-inspector-section.tsx +14 -17
- package/src/three/authoring/oid-source-persistence.ts +13 -13
- package/src/three/authoring/r3f-design-session.ts +79 -61
- package/src/three/authoring/r3f-source-authoring-adapter.ts +112 -108
- package/src/three/authoring/reflection-probe-inspector-section.tsx +5 -4
- package/src/three/authoring/spatial-joint-handles.ts +1 -1
- package/src/three/authoring/spatial-lod-handles.ts +1 -1
- package/src/three/authoring/spatial-particle-handles.ts +1 -1
- package/src/three/authoring/three-authoring-adapter.ts +33 -33
- package/src/three/component-verbs/extract-menu.ts +8 -7
- package/src/three/component-verbs/fork-menu.ts +8 -7
- package/src/three/component-verbs/internals-menu.ts +3 -3
- package/src/three/drei-asset-caches.ts +13 -0
- package/src/three/story-documents/three-story-documents.tsx +24 -34
- package/src/three/three-board/ThreeBoardDocument.tsx +25 -25
- package/src/three/three-board/board-scene.ts +7 -7
- package/src/three/three-board/three-component-board.ts +5 -5
- package/contributions/react/pasteboard.action.ts +0 -41
- package/contributions/xstate-behavior.action.ts +0 -42
- package/contributions/xstate-behavior.document.tsx +0 -73
- package/contributions/xstate-behavior.inspector.tsx +0 -28
- package/contributions/xstate-behavior.menu.ts +0 -23
- package/src/react/pasteboard-materialize.ts +0 -154
- package/src/services/game-audio-unlock.ts +0 -48
- package/src/xstate/XStateBehaviorSection.tsx +0 -130
- package/src/xstate/XStateMachineInspector.tsx +0 -566
- package/src/xstate/character-animation-machine.fixture.ts +0 -74
- package/src/xstate/live-behaviors.ts +0 -106
- package/src/xstate/use-live-actor-state.ts +0 -44
- package/src/xstate/xstate-graph.ts +0 -235
- package/src/xstate/xstate-layout.ts +0 -76
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
* whose camera pose) — handed in as `renderScene`.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { registerPresentedCanvasFrame } from '
|
|
16
|
-
import type { RootViewController } from '@volter/editor-
|
|
15
|
+
import { registerPresentedCanvasFrame } from '../canvas-preview-frames';
|
|
16
|
+
import type { RootViewController } from '@volter/editor-sdk/kit/world-pan-state';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Frame authored world bounds in the independent Scene camera. Unlike an
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
import type { Container } from 'pixi.js';
|
|
33
|
-
import { editorConsole } from '@volter/editor-
|
|
34
|
-
import type { EditorShellStore } from '@volter/editor-
|
|
33
|
+
import { editorConsole } from '@volter/editor-sdk/kit/editor-console';
|
|
34
|
+
import type { EditorShellStore } from '@volter/editor-threejs/kit/editor-shell-store';
|
|
35
35
|
import { type JournalSubject, JsonHistoryResource } from '../history/json-history-resource';
|
|
36
36
|
|
|
37
37
|
/** The stage root's stand-in uid: it is not one of the adapter's nodes, but it
|
|
@@ -113,7 +113,7 @@ export class CanvasStructureHistory {
|
|
|
113
113
|
/** Re-index + notify after a restore put objects back. */
|
|
114
114
|
private readonly onRestored: () => void,
|
|
115
115
|
) {
|
|
116
|
-
const history = store.projectHistory;
|
|
116
|
+
const history = store.shell.projectHistory;
|
|
117
117
|
this.resource = history
|
|
118
118
|
? new JsonHistoryResource<CanvasStructureState>({
|
|
119
119
|
history,
|
|
@@ -23,15 +23,16 @@
|
|
|
23
23
|
* `<pixiContainer scale={0.5}>` is the shipped idiom (see any prefab under an
|
|
24
24
|
* example project's `prefabs/`), and Pixi's own setter takes a number or a
|
|
25
25
|
* `PointData` — never an array. So a UNIFORM scale writes the scalar back, and
|
|
26
|
-
* a NON-UNIFORM one
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
26
|
+
* a NON-UNIFORM one writes the `{ x, y }` point the same setter takes. Not the
|
|
27
|
+
* dashed pair (`scale-x`/`scale-y`) as a new write: `@pixi/react` 8.0.5 hands
|
|
28
|
+
* every prop to the Pixi constructor, which copies `scale-x` onto the object as
|
|
29
|
+
* a plain property, so the pierce never runs when the node mounts (measured: a
|
|
30
|
+
* source with `scale-x={1.29}` mounts at scale 1). A tag that already authors
|
|
31
|
+
* the pair keeps it. Never a silently lossy uniform write, and never an array
|
|
32
|
+
* literal Pixi would reject at runtime.
|
|
32
33
|
*/
|
|
33
34
|
|
|
34
|
-
import type { Transform2DValue } from '
|
|
35
|
+
import type { Transform2DValue } from '../../runtime/pixi/authoring';
|
|
35
36
|
import type { Transform } from '@volter/editor-project/adapter';
|
|
36
37
|
|
|
37
38
|
/** Quaternion (xyzw) about Z ⇄ scalar radians — the one mapping both canvas
|
|
@@ -83,6 +84,8 @@ export type PixiChannelPlan =
|
|
|
83
84
|
| { readonly writable: false; readonly reason: string };
|
|
84
85
|
|
|
85
86
|
const NUMBER_RE = /^-?\d+(\.\d+)?$/;
|
|
87
|
+
/** A number-point literal, `{ x: 1.2, y: 0.8 }` (the JSX expression's inside). */
|
|
88
|
+
const POINT_RE = /^\{\s*x\s*:\s*-?\d*\.?\d+(e[+-]?\d+)?\s*,\s*y\s*:\s*-?\d*\.?\d+(e[+-]?\d+)?\s*,?\s*\}$/i;
|
|
86
89
|
const EPS = 1e-6;
|
|
87
90
|
|
|
88
91
|
/** ≤4 decimals, no trailing zeros, no negative zero — the same source-number
|
|
@@ -165,21 +168,20 @@ export function planChannelWrite(
|
|
|
165
168
|
const refusal = propRefusal(attrs, 'scale');
|
|
166
169
|
if (refusal) return { writable: false, reason: refusal };
|
|
167
170
|
const authored = attr(attrs, 'scale');
|
|
168
|
-
if (authored && !NUMBER_RE.test(authored.rawValue.trim())) {
|
|
171
|
+
if (authored && !NUMBER_RE.test(authored.rawValue.trim()) && !POINT_RE.test(authored.rawValue.trim())) {
|
|
169
172
|
return {
|
|
170
173
|
writable: false,
|
|
171
174
|
reason:
|
|
172
|
-
`scale is authored as {${authored.rawValue}} — this editor writes
|
|
173
|
-
'
|
|
175
|
+
`scale is authored as {${authored.rawValue}} — this editor writes a number or an ` +
|
|
176
|
+
'`{ x, y }` point, not an expression.',
|
|
174
177
|
};
|
|
175
178
|
}
|
|
176
179
|
const [sx, sy] = next.scale;
|
|
177
180
|
if (Math.abs(sx - sy) >= EPS) {
|
|
181
|
+
// Two values: the `PointData` Pixi's own setter takes, which applies when the node mounts.
|
|
178
182
|
return {
|
|
179
|
-
writable:
|
|
180
|
-
|
|
181
|
-
'A non-uniform scale needs the `scale-x`/`scale-y` props — this tag authors the ' +
|
|
182
|
-
'uniform `scale` shorthand, which cannot hold two values.',
|
|
183
|
+
writable: true,
|
|
184
|
+
writes: [{ prop: 'scale', value: `{ x: ${formatSourceNumber(sx)}, y: ${formatSourceNumber(sy)} }` }],
|
|
183
185
|
};
|
|
184
186
|
}
|
|
185
187
|
return { writable: true, writes: [{ prop: 'scale', value: formatSourceNumber(sx) }] };
|
|
@@ -46,18 +46,18 @@ import type {
|
|
|
46
46
|
CreationSiteLiteralReport,
|
|
47
47
|
CreationSiteSurface,
|
|
48
48
|
CreationSiteWriteScope,
|
|
49
|
-
} from '@volter/editor-
|
|
50
|
-
import { editorConsole } from '@volter/editor-
|
|
51
|
-
import { editorIsAuthoring } from '@volter/editor-
|
|
52
|
-
import type { HistoryService } from '@volter/editor-
|
|
53
|
-
import { ingestSourceWritesRecordedIfPrimed } from '@volter/editor-
|
|
49
|
+
} from '@volter/editor-sdk/kit/creation-site-edit';
|
|
50
|
+
import { editorConsole } from '@volter/editor-sdk/kit/editor-console';
|
|
51
|
+
import { editorIsAuthoring } from '@volter/editor-sdk/kit/editor-session-mode';
|
|
52
|
+
import type { HistoryService } from '@volter/editor-sdk/kit/history/history-service';
|
|
53
|
+
import { ingestSourceWritesRecordedIfPrimed } from '@volter/editor-sdk/kit/ui-source/tier-source-write-backend';
|
|
54
54
|
import type { IngestInspectRequest } from './ingest-source-persistence';
|
|
55
55
|
import {
|
|
56
56
|
IngestSourcePersistence,
|
|
57
57
|
ingestOwnershipNow,
|
|
58
58
|
reportIngestSourceRefusal,
|
|
59
59
|
} from './ingest-source-persistence';
|
|
60
|
-
import { LIVE_ONLY_DESTINATION } from '@volter/editor-
|
|
60
|
+
import { LIVE_ONLY_DESTINATION } from '@volter/editor-sdk/kit/write-pipe';
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* The adapter's own channel read/write, handed to a backend so the live half of
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
* those in; this module never guesses them.
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
-
import { showTransientHint } from '@volter/editor-
|
|
31
|
-
import type { SourceWriteBackend } from '@volter/editor-
|
|
32
|
-
import { resolvesLiveOnly, runWritePipe, type WriteAck, type WriteResolution } from '@volter/editor-
|
|
30
|
+
import { showTransientHint } from '@volter/editor-sdk/kit/transient-hint';
|
|
31
|
+
import type { SourceWriteBackend } from '@volter/editor-sdk/kit/ui-source/source-write-backend';
|
|
32
|
+
import { resolvesLiveOnly, runWritePipe, type WriteAck, type WriteResolution } from '@volter/editor-sdk/kit/write-pipe';
|
|
33
33
|
|
|
34
34
|
/** The `writeStruct` options bag, spelled once (the backend's own shape). */
|
|
35
35
|
export type StructOpOptions = Parameters<SourceWriteBackend['writeStruct']>[2];
|
|
@@ -41,9 +41,9 @@ import {
|
|
|
41
41
|
import {
|
|
42
42
|
nativeDebugBindingFromEntryModule,
|
|
43
43
|
nativeSystemsBindingFromEntryModule,
|
|
44
|
-
} from '
|
|
45
|
-
import type { RootMountSpec } from '
|
|
46
|
-
import type { MountEntry } from '
|
|
44
|
+
} from '../runtime/adapter/native-debug-module';
|
|
45
|
+
import type { RootMountSpec } from '../runtime/create-runtime';
|
|
46
|
+
import type { MountEntry } from '../runtime/mount-manifest';
|
|
47
47
|
import type { SurfaceAdapter } from '@volter/editor-project/adapter';
|
|
48
48
|
import type { AdapterDefinition } from '@volter/editor-project/adapter/adapter-module';
|
|
49
49
|
import { assertNever } from '@volter/editor-project/adapter/adapter-surface';
|
|
@@ -51,7 +51,7 @@ import type { RootDeclaration } from '@volter/editor-project/adapter/binding';
|
|
|
51
51
|
import { declaredRoots } from '@volter/editor-project/adapter/manifest-interpreter';
|
|
52
52
|
import type { ResolvedAdapterRoot, ResolvedGameManifest } from '@volter/editor-project/manifest/load';
|
|
53
53
|
import { adjudicateThreeEntry } from './entry-adjudication';
|
|
54
|
-
import { projectAdapterDefinition } from '@volter/editor-
|
|
54
|
+
import { projectAdapterDefinition } from '@volter/editor-sdk/kit/project-adapter';
|
|
55
55
|
import { activeRealmServices, type RealmServices } from './realm-services';
|
|
56
56
|
import { resolveModuleAdapter } from './roots/module-root';
|
|
57
57
|
import { resolveDomAdapter, resolveIngestReactAdapter } from './roots/react-root';
|
|
@@ -193,11 +193,10 @@ async function resolveThreeRoot(
|
|
|
193
193
|
/**
|
|
194
194
|
* A canvas root is source-as-truth exactly like a three root: its `entry` is a
|
|
195
195
|
* TSX world file, and what that file EXPORTS is adjudicated in ONE place —
|
|
196
|
-
* `resolveCanvasEntryAdapter` (
|
|
197
|
-
* realm so the packaged runtime
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
* disagreeing about what a world file means.
|
|
196
|
+
* `resolveCanvasEntryAdapter` (`roots/canvas-root.tsx`, reached through the
|
|
197
|
+
* realm so the packaged runtime mounts with the PROJECT's graph), shared by
|
|
198
|
+
* Play and the design-time layer so the two never disagree about what a world
|
|
199
|
+
* file means.
|
|
201
200
|
*/
|
|
202
201
|
async function resolveCanvasRoot(
|
|
203
202
|
root: ResolvedAdapterRoot,
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
* serves them.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
import { commandLine } from '@volter/editor-
|
|
27
|
+
import { commandLine } from '@volter/editor-sdk/kit/product-command';
|
|
28
28
|
import type { ImportSpecifier as EsModuleImport } from 'es-module-lexer';
|
|
29
29
|
import { init as esModuleLexerInit, parse as parseEsModule } from 'es-module-lexer';
|
|
30
30
|
import * as esbuild from 'esbuild-wasm';
|
|
31
31
|
// Vite serves the wasm binary as a static asset URL — fully local, no CDN.
|
|
32
32
|
import esbuildWasmUrl from 'esbuild-wasm/esbuild.wasm?url';
|
|
33
|
-
import { GAME_GLOBALS_PRELUDE } from '@volter/editor-
|
|
33
|
+
import { GAME_GLOBALS_PRELUDE } from '@volter/editor-sdk/kit/game-globals-prelude';
|
|
34
34
|
|
|
35
35
|
/** Live runtime modules, keyed by the bare specifier used to import them. */
|
|
36
36
|
type ModuleNamespace = Record<string, unknown>;
|
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* The React, `@pixi/react` and `pixi.js` a project's canvas world is mounted
|
|
3
|
+
* with — the sibling of `r3f-entry-runtime.ts`.
|
|
4
4
|
*
|
|
5
5
|
* The packaged editor's UI is prebuilt with its own React, `@pixi/react` and
|
|
6
6
|
* `pixi.js`, while project modules are transformed by a separate,
|
|
7
|
-
* project-rooted Vite server.
|
|
8
|
-
*
|
|
9
|
-
* component's hooks come from two Reacts, the tree never commits, and
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* project-rooted Vite server. Mounting a project component with the UI
|
|
8
|
+
* bundle's reconciler crosses those graphs: the reconciler's hooks and the
|
|
9
|
+
* component's hooks come from two Reacts, the tree never commits, and the
|
|
10
|
+
* canvas mount fails its own first-commit ceiling ten seconds later. See
|
|
11
|
+
* `vite-plugin-module-doorways.ts` for the measured failure.
|
|
12
12
|
*
|
|
13
|
-
* `@
|
|
14
|
-
* static import would put
|
|
15
|
-
* bundle, including one opening a three-only project
|
|
16
|
-
* call sites this replaces were already dynamic.
|
|
13
|
+
* `pixi.js` and `@pixi/react` are dynamic-imported on the checkout branch,
|
|
14
|
+
* deliberately: a static import would put the Pixi renderer and reconciler in
|
|
15
|
+
* every editor bundle, including one opening a three-only project.
|
|
17
16
|
*/
|
|
18
17
|
|
|
19
|
-
import type { resolveCanvasEntryAdapter } from '@volter/game-runtime/canvas-react';
|
|
20
18
|
import type { RootAdapter } from '@volter/editor-project/adapter';
|
|
21
|
-
import type * as PIXI from 'pixi.js';
|
|
22
19
|
import { CANVAS_RUNTIME_PATH } from '@volter/editor-sdk/host';
|
|
23
|
-
import { isPackagedRuntime } from '@volter/editor-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
import { isPackagedRuntime } from '@volter/editor-sdk/kit/packaged-runtime';
|
|
21
|
+
import type * as PIXI from 'pixi.js';
|
|
22
|
+
import { createElement, Fragment, useEffect, useLayoutEffect } from 'react';
|
|
23
|
+
import { type CanvasRuntime, resolveCanvasEntryAdapter } from './roots/canvas-root';
|
|
26
24
|
|
|
27
25
|
/**
|
|
28
26
|
* The `pixi.js` module namespace a canvas surface constructs and class-checks
|
|
@@ -32,36 +30,57 @@ type CanvasEntryResolver = typeof resolveCanvasEntryAdapter;
|
|
|
32
30
|
*/
|
|
33
31
|
export type CanvasPixiNamespace = typeof PIXI;
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
readonly resolve: CanvasEntryResolver;
|
|
37
|
-
readonly projectPixi: CanvasPixiNamespace;
|
|
38
|
-
}
|
|
33
|
+
let cachedRuntime: Promise<CanvasRuntime> | null = null;
|
|
39
34
|
|
|
40
|
-
|
|
35
|
+
const DOORWAY_MEMBERS = [
|
|
36
|
+
'createElement',
|
|
37
|
+
'Fragment',
|
|
38
|
+
'useEffect',
|
|
39
|
+
'useLayoutEffect',
|
|
40
|
+
'createPixiRoot',
|
|
41
|
+
'extendPixi',
|
|
42
|
+
'projectPixi',
|
|
43
|
+
] as const;
|
|
41
44
|
|
|
42
|
-
async function packagedRuntime(): Promise<
|
|
43
|
-
const mod = (await import(/* @vite-ignore */ CANVAS_RUNTIME_PATH)) as
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
47
|
-
if (typeof mod.resolveCanvasEntryAdapter !== 'function') {
|
|
48
|
-
throw new Error(
|
|
49
|
-
"The packaged runtime's synthetic canvas module did not export " +
|
|
50
|
-
'`resolveCanvasEntryAdapter` — see vite-plugin-module-doorways.ts.',
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
if (typeof mod.projectPixi !== 'object' || mod.projectPixi === null) {
|
|
45
|
+
async function packagedRuntime(): Promise<CanvasRuntime> {
|
|
46
|
+
const mod = (await import(/* @vite-ignore */ CANVAS_RUNTIME_PATH)) as Record<string, unknown>;
|
|
47
|
+
const missing = DOORWAY_MEMBERS.filter((name) => mod[name] === undefined || mod[name] === null);
|
|
48
|
+
if (missing.length > 0) {
|
|
54
49
|
throw new Error(
|
|
55
|
-
|
|
56
|
-
'
|
|
50
|
+
`The packaged runtime's synthetic canvas module did not export ${missing.join(', ')} — ` +
|
|
51
|
+
'see CANVAS_DOORWAY in vite-plugin-module-doorways.ts.',
|
|
57
52
|
);
|
|
58
53
|
}
|
|
59
54
|
return {
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
createElement: mod['createElement'] as CanvasRuntime['createElement'],
|
|
56
|
+
Fragment: mod['Fragment'] as CanvasRuntime['Fragment'],
|
|
57
|
+
useEffect: mod['useEffect'] as CanvasRuntime['useEffect'],
|
|
58
|
+
useLayoutEffect: mod['useLayoutEffect'] as CanvasRuntime['useLayoutEffect'],
|
|
59
|
+
createRoot: mod['createPixiRoot'] as CanvasRuntime['createRoot'],
|
|
60
|
+
extend: mod['extendPixi'] as CanvasRuntime['extend'],
|
|
61
|
+
pixi: mod['projectPixi'] as CanvasPixiNamespace,
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
async function checkoutRuntime(): Promise<CanvasRuntime> {
|
|
66
|
+
const [pixiReact, pixi] = await Promise.all([import('@pixi/react'), import('pixi.js')]);
|
|
67
|
+
return {
|
|
68
|
+
createElement,
|
|
69
|
+
Fragment,
|
|
70
|
+
useEffect,
|
|
71
|
+
useLayoutEffect,
|
|
72
|
+
createRoot: pixiReact.createRoot,
|
|
73
|
+
extend: pixiReact.extend,
|
|
74
|
+
pixi,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** The canvas runtime of the graph a canvas world mounts in, loaded once per session. */
|
|
79
|
+
async function canvasRuntime(): Promise<CanvasRuntime> {
|
|
80
|
+
cachedRuntime ??= (async () => ((await isPackagedRuntime()) ? packagedRuntime() : checkoutRuntime()))();
|
|
81
|
+
return cachedRuntime;
|
|
82
|
+
}
|
|
83
|
+
|
|
65
84
|
/**
|
|
66
85
|
* THE `pixi.js` OF THE GRAPH A CANVAS WORLD MOUNTS IN — the project's under the
|
|
67
86
|
* packaged runtime, this bundle's own copy otherwise.
|
|
@@ -75,21 +94,13 @@ async function packagedRuntime(): Promise<PackagedCanvasRuntime> {
|
|
|
75
94
|
* between two collaborators of the same surface is the bug, not the seam.
|
|
76
95
|
*/
|
|
77
96
|
export async function resolveCanvasPixiForEditor(): Promise<CanvasPixiNamespace> {
|
|
78
|
-
|
|
79
|
-
if (!cachedPackagedRuntime) cachedPackagedRuntime = packagedRuntime();
|
|
80
|
-
return (await cachedPackagedRuntime).projectPixi;
|
|
97
|
+
return (await canvasRuntime()).pixi;
|
|
81
98
|
}
|
|
82
99
|
|
|
83
|
-
/** The adjudicator
|
|
84
|
-
* under the packaged runtime, from this bundle's own engine copy otherwise. */
|
|
100
|
+
/** The canvas entry adjudicator, handed the runtime of the graph the world mounts in. */
|
|
85
101
|
export async function resolveCanvasEntryAdapterForEditor(
|
|
86
102
|
entryModule: unknown,
|
|
87
103
|
rootId: string,
|
|
88
104
|
): Promise<RootAdapter<'canvas'> | null> {
|
|
89
|
-
|
|
90
|
-
const { resolveCanvasEntryAdapter } = await import('@volter/game-runtime/canvas-react');
|
|
91
|
-
return resolveCanvasEntryAdapter(entryModule, rootId);
|
|
92
|
-
}
|
|
93
|
-
if (!cachedPackagedRuntime) cachedPackagedRuntime = packagedRuntime();
|
|
94
|
-
return (await cachedPackagedRuntime).resolve(entryModule, rootId);
|
|
105
|
+
return resolveCanvasEntryAdapter(entryModule, rootId, await canvasRuntime());
|
|
95
106
|
}
|