@konitif/workbench 0.284.1
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/LICENSE.md +21 -0
- package/README.md +54 -0
- package/dist/application/boot/applicationBoot.d.ts +48 -0
- package/dist/application/boot/applicationBoot.js +174 -0
- package/dist/application/experiment/ControlledExperimentCampaign.d.ts +12 -0
- package/dist/application/experiment/ControlledExperimentCampaign.js +159 -0
- package/dist/application/experiment/ControlledExperimentRecorder.d.ts +17 -0
- package/dist/application/experiment/ControlledExperimentRecorder.js +215 -0
- package/dist/application/i18n/WorkbenchTranslationRegistry.d.ts +19 -0
- package/dist/application/i18n/WorkbenchTranslationRegistry.js +179 -0
- package/dist/application/layout/surfaceCommandRouter.d.ts +18 -0
- package/dist/application/layout/surfaceCommandRouter.js +247 -0
- package/dist/application/physics/NoopPhysicsBackend.d.ts +2 -0
- package/dist/application/physics/NoopPhysicsBackend.js +2 -0
- package/dist/application/physics/PhysicsService.d.ts +2 -0
- package/dist/application/physics/PhysicsService.js +2 -0
- package/dist/application/project/ProjectManifest.d.ts +15 -0
- package/dist/application/project/ProjectManifest.js +107 -0
- package/dist/application/repository/RepositoryPreflightEngine.d.ts +6 -0
- package/dist/application/repository/RepositoryPreflightEngine.js +301 -0
- package/dist/application/runtime/RuntimeBackendConnection.d.ts +9 -0
- package/dist/application/runtime/RuntimeBackendConnection.js +34 -0
- package/dist/application/runtime/RuntimeBackendSubscription.d.ts +8 -0
- package/dist/application/runtime/RuntimeBackendSubscription.js +52 -0
- package/dist/application/runtime/RuntimeCheckpointStore.d.ts +20 -0
- package/dist/application/runtime/RuntimeCheckpointStore.js +65 -0
- package/dist/application/runtime/RuntimeLaunchProgress.d.ts +3 -0
- package/dist/application/runtime/RuntimeLaunchProgress.js +38 -0
- package/dist/application/runtime/RuntimeLaunchStateSnapshot.d.ts +48 -0
- package/dist/application/runtime/RuntimeLaunchStateSnapshot.js +73 -0
- package/dist/application/runtime/RuntimeObservabilityHub.d.ts +28 -0
- package/dist/application/runtime/RuntimeObservabilityHub.js +262 -0
- package/dist/application/runtime/RuntimeObservationEvents.d.ts +15 -0
- package/dist/application/runtime/RuntimeObservationEvents.js +18 -0
- package/dist/application/runtime/RuntimeOffloadManager.d.ts +24 -0
- package/dist/application/runtime/RuntimeOffloadManager.js +96 -0
- package/dist/application/runtime/RuntimePlanEngine.d.ts +11 -0
- package/dist/application/runtime/RuntimePlanEngine.js +67 -0
- package/dist/application/runtime/RuntimeProjectionCatalog.d.ts +5 -0
- package/dist/application/runtime/RuntimeProjectionCatalog.js +48 -0
- package/dist/application/runtime/RuntimeProjectionSession.d.ts +5 -0
- package/dist/application/runtime/RuntimeProjectionSession.js +4 -0
- package/dist/application/runtime/RuntimeProjectionSessionKeys.d.ts +5 -0
- package/dist/application/runtime/RuntimeProjectionSessionKeys.js +10 -0
- package/dist/application/runtime/RuntimeProjectionSessionReducers.d.ts +7 -0
- package/dist/application/runtime/RuntimeProjectionSessionReducers.js +101 -0
- package/dist/application/runtime/RuntimeProjectionSessionSerialization.d.ts +5 -0
- package/dist/application/runtime/RuntimeProjectionSessionSerialization.js +89 -0
- package/dist/application/runtime/RuntimeProjectionSessionSharedState.d.ts +3 -0
- package/dist/application/runtime/RuntimeProjectionSessionSharedState.js +53 -0
- package/dist/application/runtime/RuntimeProjectionSessionTypes.d.ts +38 -0
- package/dist/application/runtime/RuntimeProjectionSessionTypes.js +1 -0
- package/dist/application/runtime/RuntimeProjectionViewerSessionSync.d.ts +29 -0
- package/dist/application/runtime/RuntimeProjectionViewerSessionSync.js +39 -0
- package/dist/application/runtime/RuntimeProjectionViewerSessionUpdates.d.ts +27 -0
- package/dist/application/runtime/RuntimeProjectionViewerSessionUpdates.js +38 -0
- package/dist/application/runtime/RuntimeRegistryOwner.d.ts +20 -0
- package/dist/application/runtime/RuntimeRegistryOwner.js +71 -0
- package/dist/application/runtime/RuntimeRegistrySnapshots.d.ts +6 -0
- package/dist/application/runtime/RuntimeRegistrySnapshots.js +51 -0
- package/dist/application/runtime/RuntimeRegistryTypes.d.ts +29 -0
- package/dist/application/runtime/RuntimeRegistryTypes.js +1 -0
- package/dist/application/runtime/RuntimeSharedState.d.ts +6 -0
- package/dist/application/runtime/RuntimeSharedState.js +47 -0
- package/dist/application/runtime/WorkbenchRuntimeCore.d.ts +82 -0
- package/dist/application/runtime/WorkbenchRuntimeCore.js +463 -0
- package/dist/application/runtime/WorkbenchRuntimeSanitizers.d.ts +9 -0
- package/dist/application/runtime/WorkbenchRuntimeSanitizers.js +62 -0
- package/dist/application/shell/state.d.ts +22 -0
- package/dist/application/shell/state.js +308 -0
- package/dist/application/widgets/createWorkbenchWidgetAdapter.d.ts +9 -0
- package/dist/application/widgets/createWorkbenchWidgetAdapter.js +30 -0
- package/dist/application/workspace/canonicalizeLayout.d.ts +2 -0
- package/dist/application/workspace/canonicalizeLayout.js +91 -0
- package/dist/application/workspace/closePanel.d.ts +6 -0
- package/dist/application/workspace/closePanel.js +43 -0
- package/dist/application/workspace/collapseSplit.d.ts +7 -0
- package/dist/application/workspace/collapseSplit.js +45 -0
- package/dist/application/workspace/collapseSplitBoundary.d.ts +8 -0
- package/dist/application/workspace/collapseSplitBoundary.js +106 -0
- package/dist/application/workspace/commands.d.ts +71 -0
- package/dist/application/workspace/commands.js +216 -0
- package/dist/application/workspace/createPeripheralBands.d.ts +14 -0
- package/dist/application/workspace/createPeripheralBands.js +62 -0
- package/dist/application/workspace/createWorkspace.d.ts +7 -0
- package/dist/application/workspace/createWorkspace.js +12 -0
- package/dist/application/workspace/detachPanelToWindow.d.ts +12 -0
- package/dist/application/workspace/detachPanelToWindow.js +57 -0
- package/dist/application/workspace/dockPanel.d.ts +10 -0
- package/dist/application/workspace/dockPanel.js +399 -0
- package/dist/application/workspace/finalizeWorkspace.d.ts +4 -0
- package/dist/application/workspace/finalizeWorkspace.js +23 -0
- package/dist/application/workspace/focusPanel.d.ts +2 -0
- package/dist/application/workspace/focusPanel.js +19 -0
- package/dist/application/workspace/joinPanelArea.d.ts +13 -0
- package/dist/application/workspace/joinPanelArea.js +281 -0
- package/dist/application/workspace/layoutInteraction.d.ts +176 -0
- package/dist/application/workspace/layoutInteraction.js +852 -0
- package/dist/application/workspace/layoutTree.d.ts +34 -0
- package/dist/application/workspace/layoutTree.js +135 -0
- package/dist/application/workspace/openTool.d.ts +15 -0
- package/dist/application/workspace/openTool.js +89 -0
- package/dist/application/workspace/presetArtifacts.d.ts +60 -0
- package/dist/application/workspace/presetArtifacts.js +231 -0
- package/dist/application/workspace/presets.d.ts +5 -0
- package/dist/application/workspace/presets.js +12 -0
- package/dist/application/workspace/reattachWorkspaceWindow.d.ts +7 -0
- package/dist/application/workspace/reattachWorkspaceWindow.js +24 -0
- package/dist/application/workspace/resizeSplit.d.ts +7 -0
- package/dist/application/workspace/resizeSplit.js +12 -0
- package/dist/application/workspace/resizeSplitBoundary.d.ts +10 -0
- package/dist/application/workspace/resizeSplitBoundary.js +115 -0
- package/dist/application/workspace/runToolShellCommand.d.ts +11 -0
- package/dist/application/workspace/runToolShellCommand.js +133 -0
- package/dist/application/workspace/session.d.ts +9 -0
- package/dist/application/workspace/session.js +36 -0
- package/dist/application/workspace/setActiveStackChild.d.ts +7 -0
- package/dist/application/workspace/setActiveStackChild.js +12 -0
- package/dist/application/workspace/setDesignSystemThemeSession.d.ts +3 -0
- package/dist/application/workspace/setDesignSystemThemeSession.js +12 -0
- package/dist/application/workspace/setPanelFullscreenToggleVisibility.d.ts +7 -0
- package/dist/application/workspace/setPanelFullscreenToggleVisibility.js +7 -0
- package/dist/application/workspace/setStackHeaderVisibility.d.ts +7 -0
- package/dist/application/workspace/setStackHeaderVisibility.js +7 -0
- package/dist/application/workspace/setToolPanelTitleOverride.d.ts +9 -0
- package/dist/application/workspace/setToolPanelTitleOverride.js +33 -0
- package/dist/application/workspace/setToolShellStatus.d.ts +8 -0
- package/dist/application/workspace/setToolShellStatus.js +32 -0
- package/dist/application/workspace/setWorkspaceFullscreenPanel.d.ts +3 -0
- package/dist/application/workspace/setWorkspaceFullscreenPanel.js +26 -0
- package/dist/application/workspace/snapshots.d.ts +10 -0
- package/dist/application/workspace/snapshots.js +34 -0
- package/dist/application/workspace/splitPanel.d.ts +10 -0
- package/dist/application/workspace/splitPanel.js +21 -0
- package/dist/application/workspace/subdividePanel.d.ts +39 -0
- package/dist/application/workspace/subdividePanel.js +128 -0
- package/dist/application/workspace/swapPanelArea.d.ts +11 -0
- package/dist/application/workspace/swapPanelArea.js +163 -0
- package/dist/application/workspace/targetWindow.d.ts +4 -0
- package/dist/application/workspace/targetWindow.js +22 -0
- package/dist/application/workspace/toolCapabilities.d.ts +11 -0
- package/dist/application/workspace/toolCapabilities.js +59 -0
- package/dist/application/workspace/toolRuntime.d.ts +32 -0
- package/dist/application/workspace/toolRuntime.js +65 -0
- package/dist/application/workspace/updateToolState.d.ts +8 -0
- package/dist/application/workspace/updateToolState.js +20 -0
- package/dist/boot/applicationBoot.d.ts +1 -0
- package/dist/boot/applicationBoot.js +2 -0
- package/dist/boot/events.d.ts +43 -0
- package/dist/boot/events.js +16 -0
- package/dist/boot/executor.d.ts +13 -0
- package/dist/boot/executor.js +210 -0
- package/dist/boot/graph.d.ts +16 -0
- package/dist/boot/graph.js +126 -0
- package/dist/boot/index.d.ts +2 -0
- package/dist/boot/index.js +3 -0
- package/dist/boot/mechanism.d.ts +5 -0
- package/dist/boot/mechanism.js +6 -0
- package/dist/boot/projection.d.ts +72 -0
- package/dist/boot/projection.js +398 -0
- package/dist/boot/types.d.ts +80 -0
- package/dist/boot/types.js +46 -0
- package/dist/domain/composition/dockArrangement.d.ts +57 -0
- package/dist/domain/composition/dockArrangement.js +304 -0
- package/dist/domain/composition/docking.d.ts +68 -0
- package/dist/domain/composition/docking.js +187 -0
- package/dist/domain/design-system/themeSession.d.ts +12 -0
- package/dist/domain/design-system/themeSession.js +42 -0
- package/dist/domain/experiment/model.d.ts +149 -0
- package/dist/domain/experiment/model.js +1 -0
- package/dist/domain/i18n/languageRegistry.d.ts +57 -0
- package/dist/domain/i18n/languageRegistry.js +1 -0
- package/dist/domain/i18n/model.d.ts +31 -0
- package/dist/domain/i18n/model.js +1 -0
- package/dist/domain/icon/model.d.ts +8 -0
- package/dist/domain/icon/model.js +1 -0
- package/dist/domain/input/interactionBindings.d.ts +2 -0
- package/dist/domain/input/interactionBindings.js +2 -0
- package/dist/domain/launch/model.d.ts +58 -0
- package/dist/domain/launch/model.js +109 -0
- package/dist/domain/layout/interaction.d.ts +90 -0
- package/dist/domain/layout/interaction.js +1 -0
- package/dist/domain/layout/model.d.ts +28 -0
- package/dist/domain/layout/model.js +1 -0
- package/dist/domain/layout/selectors.d.ts +12 -0
- package/dist/domain/layout/selectors.js +84 -0
- package/dist/domain/layout/surfaceProjection.d.ts +56 -0
- package/dist/domain/layout/surfaceProjection.js +249 -0
- package/dist/domain/layout/validation.d.ts +9 -0
- package/dist/domain/layout/validation.js +71 -0
- package/dist/domain/panel/model.d.ts +9 -0
- package/dist/domain/panel/model.js +1 -0
- package/dist/domain/physics/colliderGeometry.d.ts +2 -0
- package/dist/domain/physics/colliderGeometry.js +1 -0
- package/dist/domain/physics/contracts.d.ts +2 -0
- package/dist/domain/physics/contracts.js +1 -0
- package/dist/domain/physics/kinematicBinding.d.ts +22 -0
- package/dist/domain/physics/kinematicBinding.js +1 -0
- package/dist/domain/physics/model.d.ts +4 -0
- package/dist/domain/physics/model.js +1 -0
- package/dist/domain/physics/mujoco.d.ts +5 -0
- package/dist/domain/physics/mujoco.js +1 -0
- package/dist/domain/physics/observationProfile.d.ts +2 -0
- package/dist/domain/physics/observationProfile.js +1 -0
- package/dist/domain/physics/presentationBinding.d.ts +6 -0
- package/dist/domain/physics/presentationBinding.js +1 -0
- package/dist/domain/physics/simulationProfile.d.ts +2 -0
- package/dist/domain/physics/simulationProfile.js +1 -0
- package/dist/domain/physics/visualAlignment.d.ts +17 -0
- package/dist/domain/physics/visualAlignment.js +1 -0
- package/dist/domain/presentation/readingLevel.d.ts +12 -0
- package/dist/domain/presentation/readingLevel.js +29 -0
- package/dist/domain/project/model.d.ts +55 -0
- package/dist/domain/project/model.js +1 -0
- package/dist/domain/repo-quality/model.d.ts +111 -0
- package/dist/domain/repo-quality/model.js +1 -0
- package/dist/domain/repository/model.d.ts +110 -0
- package/dist/domain/repository/model.js +1 -0
- package/dist/domain/runtime/checkpoint.d.ts +37 -0
- package/dist/domain/runtime/checkpoint.js +87 -0
- package/dist/domain/runtime/hydration.d.ts +26 -0
- package/dist/domain/runtime/hydration.js +92 -0
- package/dist/domain/runtime/initialization.d.ts +25 -0
- package/dist/domain/runtime/initialization.js +87 -0
- package/dist/domain/runtime/lifecycle.d.ts +51 -0
- package/dist/domain/runtime/lifecycle.js +118 -0
- package/dist/domain/runtime/model.d.ts +252 -0
- package/dist/domain/runtime/model.js +13 -0
- package/dist/domain/runtime/observability.d.ts +142 -0
- package/dist/domain/runtime/observability.js +1 -0
- package/dist/domain/runtime/offload.d.ts +56 -0
- package/dist/domain/runtime/offload.js +129 -0
- package/dist/domain/runtime/plan.d.ts +26 -0
- package/dist/domain/runtime/plan.js +1 -0
- package/dist/domain/runtime/qualityPolicy.d.ts +28 -0
- package/dist/domain/runtime/qualityPolicy.js +97 -0
- package/dist/domain/runtime/recovery.d.ts +61 -0
- package/dist/domain/runtime/recovery.js +129 -0
- package/dist/domain/runtime/suspension.d.ts +32 -0
- package/dist/domain/runtime/suspension.js +107 -0
- package/dist/domain/runtime/teardown.d.ts +33 -0
- package/dist/domain/runtime/teardown.js +109 -0
- package/dist/domain/shared/id.d.ts +1 -0
- package/dist/domain/shared/id.js +5 -0
- package/dist/domain/shared/json.d.ts +9 -0
- package/dist/domain/shared/json.js +24 -0
- package/dist/domain/shell/model.d.ts +40 -0
- package/dist/domain/shell/model.js +1 -0
- package/dist/domain/shell/runtime.d.ts +76 -0
- package/dist/domain/shell/runtime.js +40 -0
- package/dist/domain/surface/model.d.ts +97 -0
- package/dist/domain/surface/model.js +71 -0
- package/dist/domain/temporal/model.d.ts +95 -0
- package/dist/domain/temporal/model.js +45 -0
- package/dist/domain/tool/internalTab.d.ts +11 -0
- package/dist/domain/tool/internalTab.js +20 -0
- package/dist/domain/tool/model.d.ts +207 -0
- package/dist/domain/tool/model.js +1 -0
- package/dist/domain/tool/runtime.d.ts +122 -0
- package/dist/domain/tool/runtime.js +2 -0
- package/dist/domain/tool/shell.d.ts +38 -0
- package/dist/domain/tool/shell.js +175 -0
- package/dist/domain/widget/composition.d.ts +79 -0
- package/dist/domain/widget/composition.js +250 -0
- package/dist/domain/widget/model.d.ts +35 -0
- package/dist/domain/widget/model.js +8 -0
- package/dist/domain/widget/toolDock.d.ts +30 -0
- package/dist/domain/widget/toolDock.js +52 -0
- package/dist/domain/workbench/model.d.ts +35 -0
- package/dist/domain/workbench/model.js +1 -0
- package/dist/domain/workbench/routing.d.ts +17 -0
- package/dist/domain/workbench/routing.js +72 -0
- package/dist/domain/workspace/factories.d.ts +9 -0
- package/dist/domain/workspace/factories.js +47 -0
- package/dist/domain/workspace/model.d.ts +23 -0
- package/dist/domain/workspace/model.js +1 -0
- package/dist/domain/workspace/persistence.d.ts +5 -0
- package/dist/domain/workspace/persistence.js +1 -0
- package/dist/domain/workspace/selectors.d.ts +19 -0
- package/dist/domain/workspace/selectors.js +90 -0
- package/dist/domain/workspace/session.d.ts +9 -0
- package/dist/domain/workspace/session.js +1 -0
- package/dist/domain/workspace/validation.d.ts +10 -0
- package/dist/domain/workspace/validation.js +231 -0
- package/dist/hosting.d.ts +15 -0
- package/dist/hosting.js +12 -0
- package/dist/index.d.ts +111 -0
- package/dist/index.js +111 -0
- package/dist/infrastructure/audio/WorkbenchAudioManager.d.ts +36 -0
- package/dist/infrastructure/audio/WorkbenchAudioManager.js +100 -0
- package/dist/infrastructure/backend/HttpWorkbenchBackendClient.d.ts +30 -0
- package/dist/infrastructure/backend/HttpWorkbenchBackendClient.js +314 -0
- package/dist/infrastructure/persistence/LocalWorkspacePersistence.d.ts +8 -0
- package/dist/infrastructure/persistence/LocalWorkspacePersistence.js +29 -0
- package/dist/infrastructure/surfaces/InMemorySurfaceViewerRegistry.d.ts +58 -0
- package/dist/infrastructure/surfaces/InMemorySurfaceViewerRegistry.js +121 -0
- package/dist/infrastructure/temporal/InMemoryTemporalDialectRegistry.d.ts +8 -0
- package/dist/infrastructure/temporal/InMemoryTemporalDialectRegistry.js +38 -0
- package/dist/infrastructure/tools/InMemoryToolRegistry.d.ts +46 -0
- package/dist/infrastructure/tools/InMemoryToolRegistry.js +82 -0
- package/dist/infrastructure/widgets/InMemoryShellWidgetRegistry.d.ts +42 -0
- package/dist/infrastructure/widgets/InMemoryShellWidgetRegistry.js +66 -0
- package/dist/infrastructure/widgets/InMemoryWorkbenchWidgetRegistry.d.ts +20 -0
- package/dist/infrastructure/widgets/InMemoryWorkbenchWidgetRegistry.js +35 -0
- package/dist/infrastructure/workbenches/InMemoryWorkbenchRegistry.d.ts +7 -0
- package/dist/infrastructure/workbenches/InMemoryWorkbenchRegistry.js +28 -0
- package/dist/physics-runtime.d.ts +4 -0
- package/dist/physics-runtime.js +2 -0
- package/dist/stage/easing.d.ts +5 -0
- package/dist/stage/easing.js +15 -0
- package/dist/stage/index.d.ts +6 -0
- package/dist/stage/index.js +6 -0
- package/dist/stage/projection.d.ts +4 -0
- package/dist/stage/projection.js +74 -0
- package/dist/stage/stageRuntime.d.ts +2 -0
- package/dist/stage/stageRuntime.js +32 -0
- package/dist/stage/timeline.d.ts +3 -0
- package/dist/stage/timeline.js +69 -0
- package/dist/stage/tween.d.ts +3 -0
- package/dist/stage/tween.js +104 -0
- package/dist/stage/types.d.ts +104 -0
- package/dist/stage/types.js +30 -0
- package/dist/temporal/clock/audioClock.d.ts +1 -0
- package/dist/temporal/clock/audioClock.js +1 -0
- package/dist/temporal/clock/clockGraph.d.ts +1 -0
- package/dist/temporal/clock/clockGraph.js +1 -0
- package/dist/temporal/clock/clockTypes.d.ts +1 -0
- package/dist/temporal/clock/clockTypes.js +1 -0
- package/dist/temporal/clock/fixedStepClock.d.ts +1 -0
- package/dist/temporal/clock/fixedStepClock.js +1 -0
- package/dist/temporal/clock/musicalClock.d.ts +7 -0
- package/dist/temporal/clock/musicalClock.js +35 -0
- package/dist/temporal/clock/rootClock.d.ts +1 -0
- package/dist/temporal/clock/rootClock.js +1 -0
- package/dist/temporal/clock/videoClock.d.ts +1 -0
- package/dist/temporal/clock/videoClock.js +1 -0
- package/dist/temporal/easing/easingFunctions.d.ts +2 -0
- package/dist/temporal/easing/easingFunctions.js +19 -0
- package/dist/temporal/easing/easingRegistry.d.ts +10 -0
- package/dist/temporal/easing/easingRegistry.js +32 -0
- package/dist/temporal/easing/easingShaderSource.d.ts +2 -0
- package/dist/temporal/easing/easingShaderSource.js +16 -0
- package/dist/temporal/easing/easingTypes.d.ts +9 -0
- package/dist/temporal/easing/easingTypes.js +1 -0
- package/dist/temporal/history/runtimeHistory.d.ts +77 -0
- package/dist/temporal/history/runtimeHistory.js +5 -0
- package/dist/temporal/history/temporalHistoryCore.d.ts +1 -0
- package/dist/temporal/history/temporalHistoryCore.js +1 -0
- package/dist/temporal/index.d.ts +20 -0
- package/dist/temporal/index.js +20 -0
- package/dist/temporal/invalidation/invalidationController.d.ts +1 -0
- package/dist/temporal/invalidation/invalidationController.js +1 -0
- package/dist/temporal/scheduler/browserSchedulerHost.d.ts +3 -0
- package/dist/temporal/scheduler/browserSchedulerHost.js +19 -0
- package/dist/temporal/scheduler/frameBudget.d.ts +1 -0
- package/dist/temporal/scheduler/frameBudget.js +1 -0
- package/dist/temporal/scheduler/temporalScheduler.d.ts +4 -0
- package/dist/temporal/scheduler/temporalScheduler.js +6 -0
- package/dist/temporal/scheduler/temporalSchedulerCore.d.ts +1 -0
- package/dist/temporal/scheduler/temporalSchedulerCore.js +1 -0
- package/dist/temporal/scheduler/visibilityPolicy.d.ts +2 -0
- package/dist/temporal/scheduler/visibilityPolicy.js +1 -0
- package/dist/temporal/transport/temporalTransport.d.ts +1 -0
- package/dist/temporal/transport/temporalTransport.js +1 -0
- package/dist/temporal/transport/transportScope.d.ts +7 -0
- package/dist/temporal/transport/transportScope.js +3 -0
- package/dist/temporal/transport/transportTimeline.d.ts +22 -0
- package/dist/temporal/transport/transportTimeline.js +36 -0
- package/dist/temporal/transport/transportTypes.d.ts +1 -0
- package/dist/temporal/transport/transportTypes.js +1 -0
- package/dist/workspace-contracts.d.ts +36 -0
- package/dist/workspace-contracts.js +28 -0
- package/package.json +57 -0
|
@@ -0,0 +1,852 @@
|
|
|
1
|
+
import { containsPanel, listPanels } from "../../domain/layout/selectors.js";
|
|
2
|
+
import { normalizeSplitSizes } from "../../domain/layout/validation.js";
|
|
3
|
+
export function createLayoutInteractionState() {
|
|
4
|
+
return { mode: 'idle' };
|
|
5
|
+
}
|
|
6
|
+
export function openLayoutSplitMenu(panelId, edge, anchor, targets = [], options = {}) {
|
|
7
|
+
return {
|
|
8
|
+
mode: 'split-menu',
|
|
9
|
+
source: options.source ?? (targets.length > 0 ? 'split-boundary' : panelId ? 'panel-menu' : 'workspace-edge'),
|
|
10
|
+
panelId,
|
|
11
|
+
edge,
|
|
12
|
+
anchor,
|
|
13
|
+
targets,
|
|
14
|
+
initialActionId: options.initialActionId ?? null
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function dismissLayoutInteraction() {
|
|
18
|
+
return createLayoutInteractionState();
|
|
19
|
+
}
|
|
20
|
+
export function startPanelDrag(panelId, sourceStackId, anchor) {
|
|
21
|
+
return {
|
|
22
|
+
mode: 'drag-panel',
|
|
23
|
+
panelId,
|
|
24
|
+
sourceStackId,
|
|
25
|
+
anchor,
|
|
26
|
+
pointer: anchor,
|
|
27
|
+
hoveredTarget: null
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export function updatePanelDrag(state, pointer, hoveredTarget) {
|
|
31
|
+
if (state.mode !== 'drag-panel') {
|
|
32
|
+
return state;
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
...state,
|
|
36
|
+
pointer,
|
|
37
|
+
hoveredTarget
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function commitPanelDock(state) {
|
|
41
|
+
if (state.mode !== 'drag-panel' || !state.hoveredTarget) {
|
|
42
|
+
return {
|
|
43
|
+
kind: 'state',
|
|
44
|
+
state
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
kind: 'commit-dock',
|
|
49
|
+
state: dismissLayoutInteraction(),
|
|
50
|
+
dock: {
|
|
51
|
+
panelId: state.panelId,
|
|
52
|
+
target: state.hoveredTarget
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export function resolveSplitHandleMenuTarget(split, activePanelId) {
|
|
57
|
+
const [firstChild, secondChild] = split.children;
|
|
58
|
+
const activeInFirst = activePanelId ? containsPanel(firstChild, activePanelId) : false;
|
|
59
|
+
const activeInSecond = activePanelId ? containsPanel(secondChild, activePanelId) : false;
|
|
60
|
+
if (split.orientation === 'horizontal') {
|
|
61
|
+
if (activeInFirst) {
|
|
62
|
+
const panelId = getPreferredPanelIdInNode(firstChild, activePanelId);
|
|
63
|
+
return panelId ? { panelId, edge: 'right' } : null;
|
|
64
|
+
}
|
|
65
|
+
if (activeInSecond) {
|
|
66
|
+
const panelId = getPreferredPanelIdInNode(secondChild, activePanelId);
|
|
67
|
+
return panelId ? { panelId, edge: 'left' } : null;
|
|
68
|
+
}
|
|
69
|
+
const fallbackPanelId = getPreferredPanelIdInNode(firstChild);
|
|
70
|
+
return fallbackPanelId ? { panelId: fallbackPanelId, edge: 'right' } : null;
|
|
71
|
+
}
|
|
72
|
+
if (activeInFirst) {
|
|
73
|
+
const panelId = getPreferredPanelIdInNode(firstChild, activePanelId);
|
|
74
|
+
return panelId ? { panelId, edge: 'bottom' } : null;
|
|
75
|
+
}
|
|
76
|
+
if (activeInSecond) {
|
|
77
|
+
const panelId = getPreferredPanelIdInNode(secondChild, activePanelId);
|
|
78
|
+
return panelId ? { panelId, edge: 'top' } : null;
|
|
79
|
+
}
|
|
80
|
+
const fallbackPanelId = getPreferredPanelIdInNode(firstChild);
|
|
81
|
+
return fallbackPanelId ? { panelId: fallbackPanelId, edge: 'bottom' } : null;
|
|
82
|
+
}
|
|
83
|
+
export function resolveSplitHandleMenuTargets(split) {
|
|
84
|
+
const [firstChild, secondChild] = split.children;
|
|
85
|
+
if (split.orientation === 'horizontal') {
|
|
86
|
+
const firstBoundaryTargets = collectWorkspaceEdgeMenuTargets(firstChild, 'right');
|
|
87
|
+
const secondBoundaryTargets = collectWorkspaceEdgeMenuTargets(secondChild, 'left');
|
|
88
|
+
const firstAreaId = `${split.id}:child:0:boundary:right`;
|
|
89
|
+
const secondAreaId = `${split.id}:child:1:boundary:left`;
|
|
90
|
+
const firstAreaPanelIds = collectBoundaryPanelIds(firstBoundaryTargets);
|
|
91
|
+
const secondAreaPanelIds = collectBoundaryPanelIds(secondBoundaryTargets);
|
|
92
|
+
return [
|
|
93
|
+
...firstBoundaryTargets.map((target) => ({
|
|
94
|
+
...target,
|
|
95
|
+
areaId: firstAreaId,
|
|
96
|
+
areaPanelIds: firstAreaPanelIds,
|
|
97
|
+
label: 'Left',
|
|
98
|
+
joinSide: 'right',
|
|
99
|
+
joinSiblingPanelIds: secondAreaPanelIds,
|
|
100
|
+
swapSiblingPanelIds: secondAreaPanelIds
|
|
101
|
+
})),
|
|
102
|
+
...secondBoundaryTargets.map((target) => ({
|
|
103
|
+
...target,
|
|
104
|
+
areaId: secondAreaId,
|
|
105
|
+
areaPanelIds: secondAreaPanelIds,
|
|
106
|
+
label: 'Right',
|
|
107
|
+
joinSide: 'left',
|
|
108
|
+
joinSiblingPanelIds: firstAreaPanelIds,
|
|
109
|
+
swapSiblingPanelIds: firstAreaPanelIds
|
|
110
|
+
}))
|
|
111
|
+
];
|
|
112
|
+
}
|
|
113
|
+
const firstBoundaryTargets = collectWorkspaceEdgeMenuTargets(firstChild, 'bottom');
|
|
114
|
+
const secondBoundaryTargets = collectWorkspaceEdgeMenuTargets(secondChild, 'top');
|
|
115
|
+
const firstAreaId = `${split.id}:child:0:boundary:bottom`;
|
|
116
|
+
const secondAreaId = `${split.id}:child:1:boundary:top`;
|
|
117
|
+
const firstAreaPanelIds = collectBoundaryPanelIds(firstBoundaryTargets);
|
|
118
|
+
const secondAreaPanelIds = collectBoundaryPanelIds(secondBoundaryTargets);
|
|
119
|
+
return [
|
|
120
|
+
...firstBoundaryTargets.map((target) => ({
|
|
121
|
+
...target,
|
|
122
|
+
areaId: firstAreaId,
|
|
123
|
+
areaPanelIds: firstAreaPanelIds,
|
|
124
|
+
label: 'Up',
|
|
125
|
+
joinSide: 'bottom',
|
|
126
|
+
joinSiblingPanelIds: secondAreaPanelIds,
|
|
127
|
+
swapSiblingPanelIds: secondAreaPanelIds
|
|
128
|
+
})),
|
|
129
|
+
...secondBoundaryTargets.map((target) => ({
|
|
130
|
+
...target,
|
|
131
|
+
areaId: secondAreaId,
|
|
132
|
+
areaPanelIds: secondAreaPanelIds,
|
|
133
|
+
label: 'Down',
|
|
134
|
+
joinSide: 'top',
|
|
135
|
+
joinSiblingPanelIds: firstAreaPanelIds,
|
|
136
|
+
swapSiblingPanelIds: firstAreaPanelIds
|
|
137
|
+
}))
|
|
138
|
+
];
|
|
139
|
+
}
|
|
140
|
+
export function resolveWorkspaceEdgeMenuTargets(root, edge) {
|
|
141
|
+
return collectWorkspaceEdgeMenuTargets(root, edge).map((target) => ({
|
|
142
|
+
...target,
|
|
143
|
+
areaId: resolveImmediateSwapAreaId(root, target.panelId, target.edge),
|
|
144
|
+
areaPanelIds: resolveImmediateSwapAreaPanelIds(root, target.panelId, target.edge),
|
|
145
|
+
joinSiblingPanelIds: resolveImmediateJoinSiblingPanelIds(root, target.panelId, target.edge),
|
|
146
|
+
swapSiblingPanelIds: resolveImmediateSwapSiblingPanelIds(root, target.panelId, target.edge)
|
|
147
|
+
}));
|
|
148
|
+
}
|
|
149
|
+
export function resolvePanelMenuTargets(root, panelId) {
|
|
150
|
+
const edges = ['left', 'right', 'top', 'bottom'];
|
|
151
|
+
return edges
|
|
152
|
+
.map((edge) => {
|
|
153
|
+
const areaPanelIds = resolveNearestSwapAreaPanelIds(root, panelId, edge);
|
|
154
|
+
const joinSiblingPanelIds = resolveNearestSwapSiblingPanelIds(root, panelId, edge);
|
|
155
|
+
const swapSiblingPanelIds = resolveNearestSwapSiblingPanelIds(root, panelId, edge);
|
|
156
|
+
if (joinSiblingPanelIds.length === 0 && swapSiblingPanelIds.length === 0) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
id: `panel:${panelId}:edge:${edge}`,
|
|
161
|
+
panelId,
|
|
162
|
+
areaId: `panel:${panelId}:edge:${edge}`,
|
|
163
|
+
areaPanelIds,
|
|
164
|
+
edge,
|
|
165
|
+
label: edge,
|
|
166
|
+
joinSide: edge,
|
|
167
|
+
joinSiblingPanelIds,
|
|
168
|
+
swapSiblingPanelIds
|
|
169
|
+
};
|
|
170
|
+
})
|
|
171
|
+
.filter(isLayoutMenuTarget);
|
|
172
|
+
}
|
|
173
|
+
export function resolvePanelMenuJoinTargets(root, panelId) {
|
|
174
|
+
const edges = ['left', 'right', 'top', 'bottom'];
|
|
175
|
+
return edges.flatMap((edge) => {
|
|
176
|
+
const area = findNearestSwapArea(root, panelId, edge);
|
|
177
|
+
if (!area) {
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
const siblingEdge = resolveOppositeEdge(edge);
|
|
181
|
+
// Panel-menu joins are anchored to the panel that opened the menu, not the
|
|
182
|
+
// larger structural branch that may contain it. This keeps preview + commit
|
|
183
|
+
// semantics aligned with the user-visible origin panel.
|
|
184
|
+
const sourcePanelIds = [panelId];
|
|
185
|
+
const boundaryNodes = collectBoundaryNodes(area.siblingNode, siblingEdge);
|
|
186
|
+
const boundaryPanelSets = boundaryNodes.map((node) => listPanels(node).map((panel) => panel.id));
|
|
187
|
+
const combinedBoundaryPanels = boundaryNodes.length > 1
|
|
188
|
+
? normalizePanelIdSet(boundaryPanelSets.flat())
|
|
189
|
+
: null;
|
|
190
|
+
const boundaryTargets = boundaryPanelSets.map((panelIds, index) => ({
|
|
191
|
+
id: `panel:${panelId}:join:${edge}:${index}`,
|
|
192
|
+
panelId,
|
|
193
|
+
areaId: `panel:${panelId}:join:${edge}:${index}`,
|
|
194
|
+
areaPanelIds: sourcePanelIds,
|
|
195
|
+
edge,
|
|
196
|
+
label: edge,
|
|
197
|
+
joinSide: edge,
|
|
198
|
+
joinSiblingPanelIds: panelIds,
|
|
199
|
+
swapSiblingPanelIds: []
|
|
200
|
+
}));
|
|
201
|
+
if (combinedBoundaryPanels && combinedBoundaryPanels.length > 0) {
|
|
202
|
+
boundaryTargets.unshift({
|
|
203
|
+
id: `panel:${panelId}:join:${edge}:group`,
|
|
204
|
+
panelId,
|
|
205
|
+
areaId: `panel:${panelId}:join:${edge}:group`,
|
|
206
|
+
areaPanelIds: sourcePanelIds,
|
|
207
|
+
edge,
|
|
208
|
+
label: edge,
|
|
209
|
+
joinSide: edge,
|
|
210
|
+
joinSiblingPanelIds: combinedBoundaryPanels,
|
|
211
|
+
swapSiblingPanelIds: []
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
return boundaryTargets;
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
export function resolvePanelMenuSwapTargets(root, panelId) {
|
|
218
|
+
const edges = ['left', 'right', 'top', 'bottom'];
|
|
219
|
+
return edges.flatMap((edge) => {
|
|
220
|
+
const area = findNearestSwapArea(root, panelId, edge);
|
|
221
|
+
if (!area) {
|
|
222
|
+
return [];
|
|
223
|
+
}
|
|
224
|
+
const siblingEdge = resolveOppositeEdge(edge);
|
|
225
|
+
const sourcePanelIds = listPanels(area.sourceNode).map((panel) => panel.id);
|
|
226
|
+
const boundaryNodes = collectBoundaryNodes(area.siblingNode, siblingEdge);
|
|
227
|
+
const boundaryPanelSets = boundaryNodes.map((node) => listPanels(node).map((panel) => panel.id));
|
|
228
|
+
const combinedBoundaryPanels = boundaryNodes.length > 1
|
|
229
|
+
? normalizePanelIdSet(boundaryPanelSets.flat())
|
|
230
|
+
: null;
|
|
231
|
+
const boundaryTargets = boundaryPanelSets.map((panelIds, index) => ({
|
|
232
|
+
id: `panel:${panelId}:swap:${edge}:${index}`,
|
|
233
|
+
panelId,
|
|
234
|
+
areaId: `panel:${panelId}:swap:${edge}:${index}`,
|
|
235
|
+
areaPanelIds: sourcePanelIds,
|
|
236
|
+
edge,
|
|
237
|
+
label: edge,
|
|
238
|
+
joinSide: edge,
|
|
239
|
+
joinSiblingPanelIds: [],
|
|
240
|
+
swapSiblingPanelIds: panelIds
|
|
241
|
+
}));
|
|
242
|
+
if (combinedBoundaryPanels && combinedBoundaryPanels.length > 0) {
|
|
243
|
+
boundaryTargets.unshift({
|
|
244
|
+
id: `panel:${panelId}:swap:${edge}:group`,
|
|
245
|
+
panelId,
|
|
246
|
+
areaId: `panel:${panelId}:swap:${edge}:group`,
|
|
247
|
+
areaPanelIds: sourcePanelIds,
|
|
248
|
+
edge,
|
|
249
|
+
label: edge,
|
|
250
|
+
joinSide: edge,
|
|
251
|
+
joinSiblingPanelIds: [],
|
|
252
|
+
swapSiblingPanelIds: combinedBoundaryPanels
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
return boundaryTargets;
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
export function getLayoutMenuActions(options = {}) {
|
|
259
|
+
const { edge = 'top', panelId = null, target = null, targets = [], joinEnabled = false, swapAreasEnabled = false } = options;
|
|
260
|
+
const activeTarget = target ??
|
|
261
|
+
(targets.length > 0
|
|
262
|
+
? targets[0]
|
|
263
|
+
: panelId
|
|
264
|
+
? {
|
|
265
|
+
id: `panel:${panelId}`,
|
|
266
|
+
panelId,
|
|
267
|
+
areaId: `panel:${panelId}`,
|
|
268
|
+
areaPanelIds: [panelId],
|
|
269
|
+
edge,
|
|
270
|
+
label: '',
|
|
271
|
+
joinSide: edge,
|
|
272
|
+
joinSiblingPanelIds: [],
|
|
273
|
+
swapSiblingPanelIds: []
|
|
274
|
+
}
|
|
275
|
+
: null);
|
|
276
|
+
return [
|
|
277
|
+
{
|
|
278
|
+
id: 'split:vertical',
|
|
279
|
+
label: 'Vertical Split',
|
|
280
|
+
group: 'split',
|
|
281
|
+
enabled: true,
|
|
282
|
+
selection: activeTarget?.panelId
|
|
283
|
+
? {
|
|
284
|
+
kind: 'split',
|
|
285
|
+
orientation: 'vertical',
|
|
286
|
+
panelId: activeTarget.panelId,
|
|
287
|
+
edge: activeTarget.edge
|
|
288
|
+
}
|
|
289
|
+
: null
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
id: 'split:horizontal',
|
|
293
|
+
label: 'Horizontal Split',
|
|
294
|
+
group: 'split',
|
|
295
|
+
enabled: true,
|
|
296
|
+
selection: activeTarget?.panelId
|
|
297
|
+
? {
|
|
298
|
+
kind: 'split',
|
|
299
|
+
orientation: 'horizontal',
|
|
300
|
+
panelId: activeTarget.panelId,
|
|
301
|
+
edge: activeTarget.edge
|
|
302
|
+
}
|
|
303
|
+
: null
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
id: 'join-areas',
|
|
307
|
+
label: 'Join Areas',
|
|
308
|
+
group: 'transform',
|
|
309
|
+
enabled: joinEnabled,
|
|
310
|
+
selection: joinEnabled && activeTarget?.panelId
|
|
311
|
+
? {
|
|
312
|
+
kind: 'join',
|
|
313
|
+
panelId: activeTarget.panelId,
|
|
314
|
+
edge: activeTarget.edge,
|
|
315
|
+
side: activeTarget.joinSide,
|
|
316
|
+
sourceAreaPanelIds: activeTarget.areaPanelIds,
|
|
317
|
+
siblingAreaPanelIds: activeTarget.joinSiblingPanelIds
|
|
318
|
+
}
|
|
319
|
+
: null
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
id: 'swap-areas',
|
|
323
|
+
label: 'Swap Areas',
|
|
324
|
+
group: 'transform',
|
|
325
|
+
enabled: swapAreasEnabled,
|
|
326
|
+
selection: swapAreasEnabled && activeTarget?.panelId
|
|
327
|
+
? {
|
|
328
|
+
kind: 'swap',
|
|
329
|
+
panelId: activeTarget.panelId,
|
|
330
|
+
edge: activeTarget.edge,
|
|
331
|
+
sourceAreaPanelIds: activeTarget.areaPanelIds,
|
|
332
|
+
siblingAreaPanelIds: activeTarget.swapSiblingPanelIds
|
|
333
|
+
}
|
|
334
|
+
: null
|
|
335
|
+
}
|
|
336
|
+
];
|
|
337
|
+
}
|
|
338
|
+
export function selectLayoutMenuAction(state, selection) {
|
|
339
|
+
if (state.mode !== 'split-menu' || !selection) {
|
|
340
|
+
return {
|
|
341
|
+
kind: 'state',
|
|
342
|
+
state
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
if (selection.kind === 'split') {
|
|
346
|
+
return selectLayoutSplitOrientation({
|
|
347
|
+
...state,
|
|
348
|
+
panelId: selection.panelId,
|
|
349
|
+
edge: selection.edge
|
|
350
|
+
}, selection.orientation);
|
|
351
|
+
}
|
|
352
|
+
if (selection.kind === 'swap') {
|
|
353
|
+
return {
|
|
354
|
+
kind: 'commit-swap',
|
|
355
|
+
state: dismissLayoutInteraction(),
|
|
356
|
+
swap: {
|
|
357
|
+
panelId: selection.panelId,
|
|
358
|
+
edge: selection.edge,
|
|
359
|
+
sourceAreaPanelIds: selection.sourceAreaPanelIds,
|
|
360
|
+
siblingAreaPanelIds: selection.siblingAreaPanelIds
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
if (selection.kind === 'join') {
|
|
365
|
+
return {
|
|
366
|
+
kind: 'commit-join',
|
|
367
|
+
state: dismissLayoutInteraction(),
|
|
368
|
+
join: {
|
|
369
|
+
panelId: selection.panelId,
|
|
370
|
+
edge: selection.edge,
|
|
371
|
+
side: selection.side,
|
|
372
|
+
sourceAreaPanelIds: selection.sourceAreaPanelIds,
|
|
373
|
+
siblingAreaPanelIds: selection.siblingAreaPanelIds
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
return {
|
|
378
|
+
kind: 'state',
|
|
379
|
+
state
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
export function getEdgeSemanticOrientation(edge) {
|
|
383
|
+
return edge === 'left' || edge === 'right' ? 'vertical' : 'horizontal';
|
|
384
|
+
}
|
|
385
|
+
export function isAlignedEdgePreview(edge, orientation) {
|
|
386
|
+
return (((edge === 'left' || edge === 'right') && orientation === 'vertical') ||
|
|
387
|
+
((edge === 'top' || edge === 'bottom') && orientation === 'horizontal'));
|
|
388
|
+
}
|
|
389
|
+
export function getDockSidesForOrientation(orientation) {
|
|
390
|
+
return orientation === 'vertical' ? ['left', 'right'] : ['top', 'bottom'];
|
|
391
|
+
}
|
|
392
|
+
export function selectLayoutSplitOrientation(state, orientation) {
|
|
393
|
+
if (state.mode !== 'split-menu') {
|
|
394
|
+
return {
|
|
395
|
+
kind: 'state',
|
|
396
|
+
state
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
return {
|
|
400
|
+
kind: 'state',
|
|
401
|
+
state: {
|
|
402
|
+
mode: 'split-preview',
|
|
403
|
+
panelId: state.panelId,
|
|
404
|
+
edge: state.edge,
|
|
405
|
+
orientation,
|
|
406
|
+
cuts: 1,
|
|
407
|
+
pointerRatio: 0.5
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
export function updateLayoutSplitPreview(state, panelId, pointerRatio) {
|
|
412
|
+
if (state.mode !== 'split-preview') {
|
|
413
|
+
return state;
|
|
414
|
+
}
|
|
415
|
+
return {
|
|
416
|
+
...state,
|
|
417
|
+
panelId,
|
|
418
|
+
pointerRatio: Math.max(0.12, Math.min(0.88, Number(pointerRatio.toFixed(4))))
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
export function startLayoutSplitPreview(input) {
|
|
422
|
+
return {
|
|
423
|
+
mode: 'split-preview',
|
|
424
|
+
panelId: input.panelId,
|
|
425
|
+
edge: input.edge,
|
|
426
|
+
orientation: input.orientation,
|
|
427
|
+
cuts: Math.max(1, Math.min(5, input.cuts ?? 1)),
|
|
428
|
+
pointerRatio: Math.max(0.12, Math.min(0.88, Number((input.pointerRatio ?? 0.5).toFixed(4))))
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
const MIN_BOUNDARY_BAND_RATIO = 0.14;
|
|
432
|
+
const MAX_BOUNDARY_BAND_RATIO = 0.42;
|
|
433
|
+
function clampBoundaryBandRatio(value) {
|
|
434
|
+
return Math.max(MIN_BOUNDARY_BAND_RATIO, Math.min(MAX_BOUNDARY_BAND_RATIO, Number(value.toFixed(4))));
|
|
435
|
+
}
|
|
436
|
+
export function startBoundaryPull(input) {
|
|
437
|
+
return {
|
|
438
|
+
mode: 'boundary-pull',
|
|
439
|
+
...(input.windowId !== undefined ? { windowId: input.windowId } : {}),
|
|
440
|
+
source: input.source ?? ((input.horizontalEdge && input.verticalEdge) ? 'corner' : 'edge'),
|
|
441
|
+
anchor: input.anchor,
|
|
442
|
+
pointer: input.anchor,
|
|
443
|
+
horizontalEdge: input.horizontalEdge ?? null,
|
|
444
|
+
verticalEdge: input.verticalEdge ?? null,
|
|
445
|
+
neutralThreshold: input.neutralThreshold ?? 20,
|
|
446
|
+
creationThreshold: input.creationThreshold ?? 72,
|
|
447
|
+
horizontalDistance: 0,
|
|
448
|
+
verticalDistance: 0,
|
|
449
|
+
horizontalBandRatio: null,
|
|
450
|
+
verticalBandRatio: null
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
export function updateBoundaryPull(state, pointer, viewport) {
|
|
454
|
+
if (state.mode !== 'boundary-pull') {
|
|
455
|
+
return state;
|
|
456
|
+
}
|
|
457
|
+
const rawHorizontalDistance = state.horizontalEdge === 'left'
|
|
458
|
+
? pointer.x - state.anchor.x
|
|
459
|
+
: state.horizontalEdge === 'right'
|
|
460
|
+
? state.anchor.x - pointer.x
|
|
461
|
+
: 0;
|
|
462
|
+
const rawVerticalDistance = state.verticalEdge === 'top'
|
|
463
|
+
? pointer.y - state.anchor.y
|
|
464
|
+
: state.verticalEdge === 'bottom'
|
|
465
|
+
? state.anchor.y - pointer.y
|
|
466
|
+
: 0;
|
|
467
|
+
const horizontalDistance = Math.max(0, rawHorizontalDistance);
|
|
468
|
+
const verticalDistance = Math.max(0, rawVerticalDistance);
|
|
469
|
+
return {
|
|
470
|
+
...state,
|
|
471
|
+
pointer,
|
|
472
|
+
horizontalDistance,
|
|
473
|
+
verticalDistance,
|
|
474
|
+
horizontalBandRatio: state.horizontalEdge && horizontalDistance >= state.creationThreshold && viewport.width > 0
|
|
475
|
+
? clampBoundaryBandRatio(horizontalDistance / viewport.width)
|
|
476
|
+
: null,
|
|
477
|
+
verticalBandRatio: state.verticalEdge && verticalDistance >= state.creationThreshold && viewport.height > 0
|
|
478
|
+
? clampBoundaryBandRatio(verticalDistance / viewport.height)
|
|
479
|
+
: null
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
export function commitBoundaryPull(state) {
|
|
483
|
+
if (state.mode !== 'boundary-pull') {
|
|
484
|
+
return {
|
|
485
|
+
kind: 'state',
|
|
486
|
+
state
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
const boundaryPull = {};
|
|
490
|
+
if (state.horizontalEdge && state.horizontalBandRatio !== null) {
|
|
491
|
+
boundaryPull[state.horizontalEdge] = state.horizontalBandRatio;
|
|
492
|
+
}
|
|
493
|
+
if (state.verticalEdge && state.verticalBandRatio !== null) {
|
|
494
|
+
boundaryPull[state.verticalEdge] = state.verticalBandRatio;
|
|
495
|
+
}
|
|
496
|
+
if (Object.keys(boundaryPull).length === 0) {
|
|
497
|
+
return {
|
|
498
|
+
kind: 'state',
|
|
499
|
+
state: dismissLayoutInteraction()
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
return {
|
|
503
|
+
kind: 'commit-boundary-pull',
|
|
504
|
+
state: dismissLayoutInteraction(),
|
|
505
|
+
boundaryPull: { ...boundaryPull, ...(state.windowId !== undefined ? { windowId: state.windowId } : {}) }
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
export function startIntersectionResize(input) {
|
|
509
|
+
return {
|
|
510
|
+
mode: 'intersection-resize',
|
|
511
|
+
anchor: input.anchor,
|
|
512
|
+
pointer: input.anchor,
|
|
513
|
+
columnSplitId: input.columnSplitId,
|
|
514
|
+
rowSplitId: input.rowSplitId,
|
|
515
|
+
columnBaseSizes: input.columnBaseSizes,
|
|
516
|
+
rowBaseSizes: input.rowBaseSizes,
|
|
517
|
+
columnPreviewSizes: input.columnBaseSizes,
|
|
518
|
+
rowPreviewSizes: input.rowBaseSizes
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
export function updateIntersectionResize(state, pointer, dimensions) {
|
|
522
|
+
if (state.mode !== 'intersection-resize') {
|
|
523
|
+
return state;
|
|
524
|
+
}
|
|
525
|
+
const deltaX = pointer.x - state.anchor.x;
|
|
526
|
+
const deltaY = pointer.y - state.anchor.y;
|
|
527
|
+
const columnRatioDelta = dimensions.width > 0 ? deltaX / dimensions.width : 0;
|
|
528
|
+
const rowRatioDelta = dimensions.height > 0 ? deltaY / dimensions.height : 0;
|
|
529
|
+
return {
|
|
530
|
+
...state,
|
|
531
|
+
pointer,
|
|
532
|
+
columnPreviewSizes: normalizeSplitSizes([
|
|
533
|
+
state.columnBaseSizes[0] + columnRatioDelta,
|
|
534
|
+
state.columnBaseSizes[1] - columnRatioDelta
|
|
535
|
+
]),
|
|
536
|
+
rowPreviewSizes: normalizeSplitSizes([
|
|
537
|
+
state.rowBaseSizes[0] + rowRatioDelta,
|
|
538
|
+
state.rowBaseSizes[1] - rowRatioDelta
|
|
539
|
+
])
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
export function commitIntersectionResize(state) {
|
|
543
|
+
if (state.mode !== 'intersection-resize') {
|
|
544
|
+
return {
|
|
545
|
+
kind: 'state',
|
|
546
|
+
state
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
return {
|
|
550
|
+
kind: 'commit-intersection-resize',
|
|
551
|
+
state: dismissLayoutInteraction(),
|
|
552
|
+
intersectionResize: {
|
|
553
|
+
columnSplitId: state.columnSplitId,
|
|
554
|
+
rowSplitId: state.rowSplitId,
|
|
555
|
+
columnSizes: state.columnPreviewSizes,
|
|
556
|
+
rowSizes: state.rowPreviewSizes
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
function getPreferredPanelIdInNode(node, preferredPanelId) {
|
|
561
|
+
if (node.kind === 'stack') {
|
|
562
|
+
if (preferredPanelId && node.children.some((panel) => panel.id === preferredPanelId)) {
|
|
563
|
+
return preferredPanelId;
|
|
564
|
+
}
|
|
565
|
+
return node.activeChildId;
|
|
566
|
+
}
|
|
567
|
+
return getPreferredPanelIdInNode(node.children[0], preferredPanelId) ?? getPreferredPanelIdInNode(node.children[1], preferredPanelId);
|
|
568
|
+
}
|
|
569
|
+
function isLayoutMenuTarget(value) {
|
|
570
|
+
return !!value;
|
|
571
|
+
}
|
|
572
|
+
function collectBoundaryPanelIds(targets) {
|
|
573
|
+
return Array.from(new Set(targets.map((target) => target.panelId)));
|
|
574
|
+
}
|
|
575
|
+
function collectBoundaryNodes(node, edge) {
|
|
576
|
+
if (node.kind === 'stack') {
|
|
577
|
+
return [node];
|
|
578
|
+
}
|
|
579
|
+
if (edge === 'left') {
|
|
580
|
+
return node.orientation === 'horizontal'
|
|
581
|
+
? collectBoundaryNodes(node.children[0], edge)
|
|
582
|
+
: [...collectBoundaryNodes(node.children[0], edge), ...collectBoundaryNodes(node.children[1], edge)];
|
|
583
|
+
}
|
|
584
|
+
if (edge === 'right') {
|
|
585
|
+
return node.orientation === 'horizontal'
|
|
586
|
+
? collectBoundaryNodes(node.children[1], edge)
|
|
587
|
+
: [...collectBoundaryNodes(node.children[0], edge), ...collectBoundaryNodes(node.children[1], edge)];
|
|
588
|
+
}
|
|
589
|
+
if (edge === 'top') {
|
|
590
|
+
return node.orientation === 'vertical'
|
|
591
|
+
? collectBoundaryNodes(node.children[0], edge)
|
|
592
|
+
: [...collectBoundaryNodes(node.children[0], edge), ...collectBoundaryNodes(node.children[1], edge)];
|
|
593
|
+
}
|
|
594
|
+
return node.orientation === 'vertical'
|
|
595
|
+
? collectBoundaryNodes(node.children[1], edge)
|
|
596
|
+
: [...collectBoundaryNodes(node.children[0], edge), ...collectBoundaryNodes(node.children[1], edge)];
|
|
597
|
+
}
|
|
598
|
+
function resolveOppositeEdge(edge) {
|
|
599
|
+
switch (edge) {
|
|
600
|
+
case 'left':
|
|
601
|
+
return 'right';
|
|
602
|
+
case 'right':
|
|
603
|
+
return 'left';
|
|
604
|
+
case 'top':
|
|
605
|
+
return 'bottom';
|
|
606
|
+
case 'bottom':
|
|
607
|
+
return 'top';
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
function collectWorkspaceEdgeMenuTargets(node, edge) {
|
|
611
|
+
if (node.kind === 'stack') {
|
|
612
|
+
const panelId = getPreferredPanelIdInNode(node);
|
|
613
|
+
return panelId
|
|
614
|
+
? [
|
|
615
|
+
{
|
|
616
|
+
id: `panel:${panelId}`,
|
|
617
|
+
panelId,
|
|
618
|
+
areaId: `panel:${panelId}`,
|
|
619
|
+
areaPanelIds: [panelId],
|
|
620
|
+
edge,
|
|
621
|
+
label: '',
|
|
622
|
+
joinSide: edge,
|
|
623
|
+
joinSiblingPanelIds: [],
|
|
624
|
+
swapSiblingPanelIds: []
|
|
625
|
+
}
|
|
626
|
+
]
|
|
627
|
+
: [];
|
|
628
|
+
}
|
|
629
|
+
if (edge === 'left') {
|
|
630
|
+
return node.orientation === 'horizontal'
|
|
631
|
+
? collectWorkspaceEdgeMenuTargets(node.children[0], edge)
|
|
632
|
+
: [
|
|
633
|
+
...collectWorkspaceEdgeMenuTargets(node.children[0], edge),
|
|
634
|
+
...collectWorkspaceEdgeMenuTargets(node.children[1], edge)
|
|
635
|
+
];
|
|
636
|
+
}
|
|
637
|
+
if (edge === 'right') {
|
|
638
|
+
return node.orientation === 'horizontal'
|
|
639
|
+
? collectWorkspaceEdgeMenuTargets(node.children[1], edge)
|
|
640
|
+
: [
|
|
641
|
+
...collectWorkspaceEdgeMenuTargets(node.children[0], edge),
|
|
642
|
+
...collectWorkspaceEdgeMenuTargets(node.children[1], edge)
|
|
643
|
+
];
|
|
644
|
+
}
|
|
645
|
+
if (edge === 'top') {
|
|
646
|
+
return node.orientation === 'vertical'
|
|
647
|
+
? collectWorkspaceEdgeMenuTargets(node.children[0], edge)
|
|
648
|
+
: [
|
|
649
|
+
...collectWorkspaceEdgeMenuTargets(node.children[0], edge),
|
|
650
|
+
...collectWorkspaceEdgeMenuTargets(node.children[1], edge)
|
|
651
|
+
];
|
|
652
|
+
}
|
|
653
|
+
return node.orientation === 'vertical'
|
|
654
|
+
? collectWorkspaceEdgeMenuTargets(node.children[1], edge)
|
|
655
|
+
: [
|
|
656
|
+
...collectWorkspaceEdgeMenuTargets(node.children[0], edge),
|
|
657
|
+
...collectWorkspaceEdgeMenuTargets(node.children[1], edge)
|
|
658
|
+
];
|
|
659
|
+
}
|
|
660
|
+
export function resolveImmediateJoinSiblingPanelIds(root, panelId, edge) {
|
|
661
|
+
const siblingNode = findImmediateJoinSiblingNode(root, panelId, edge);
|
|
662
|
+
return siblingNode ? listPanels(siblingNode).map((panel) => panel.id) : [];
|
|
663
|
+
}
|
|
664
|
+
export function resolveImmediateSwapAreaPanelIds(root, panelId, edge) {
|
|
665
|
+
const area = findImmediateSwapArea(root, panelId, edge);
|
|
666
|
+
return area ? listPanels(area.sourceNode).map((panel) => panel.id) : [panelId];
|
|
667
|
+
}
|
|
668
|
+
export function resolveImmediateSwapSiblingPanelIds(root, panelId, edge) {
|
|
669
|
+
const area = findImmediateSwapArea(root, panelId, edge);
|
|
670
|
+
return area ? listPanels(area.siblingNode).map((panel) => panel.id) : [];
|
|
671
|
+
}
|
|
672
|
+
function resolveNearestSwapAreaPanelIds(root, panelId, edge) {
|
|
673
|
+
const area = findNearestSwapArea(root, panelId, edge);
|
|
674
|
+
return area ? listPanels(area.sourceNode).map((panel) => panel.id) : [panelId];
|
|
675
|
+
}
|
|
676
|
+
function resolveNearestSwapSiblingPanelIds(root, panelId, edge) {
|
|
677
|
+
const area = findNearestSwapArea(root, panelId, edge);
|
|
678
|
+
return area ? listPanels(area.siblingNode).map((panel) => panel.id) : [];
|
|
679
|
+
}
|
|
680
|
+
function resolveImmediateSwapAreaId(root, panelId, edge) {
|
|
681
|
+
const area = findImmediateSwapArea(root, panelId, edge);
|
|
682
|
+
if (!area) {
|
|
683
|
+
return `panel:${panelId}`;
|
|
684
|
+
}
|
|
685
|
+
return `${area.splitId}:child:${area.childIndex}`;
|
|
686
|
+
}
|
|
687
|
+
function findImmediateSwapArea(root, panelId, edge) {
|
|
688
|
+
const ancestors = findLayoutBranchAncestors(root, panelId);
|
|
689
|
+
const targetOrientation = edge === 'left' || edge === 'right' ? 'horizontal' : 'vertical';
|
|
690
|
+
const expectedChildIndex = edge === 'left' || edge === 'top' ? 1 : 0;
|
|
691
|
+
let current = root;
|
|
692
|
+
for (let index = 0; index < ancestors.length; index += 1) {
|
|
693
|
+
const ancestor = ancestors[index];
|
|
694
|
+
if (current.kind === 'stack') {
|
|
695
|
+
return null;
|
|
696
|
+
}
|
|
697
|
+
if (ancestor.orientation === targetOrientation && ancestor.childIndex === expectedChildIndex) {
|
|
698
|
+
return {
|
|
699
|
+
splitId: ancestor.splitId,
|
|
700
|
+
childIndex: ancestor.childIndex,
|
|
701
|
+
sourceNode: current.children[ancestor.childIndex],
|
|
702
|
+
siblingNode: ancestor.sibling
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
current = current.children[ancestor.childIndex];
|
|
706
|
+
}
|
|
707
|
+
return null;
|
|
708
|
+
}
|
|
709
|
+
function findNearestSwapArea(root, panelId, edge) {
|
|
710
|
+
const ancestors = findLayoutBranchAncestors(root, panelId);
|
|
711
|
+
const targetOrientation = edge === 'left' || edge === 'right' ? 'horizontal' : 'vertical';
|
|
712
|
+
const expectedChildIndex = edge === 'left' || edge === 'top' ? 1 : 0;
|
|
713
|
+
if (ancestors.length === 0) {
|
|
714
|
+
return null;
|
|
715
|
+
}
|
|
716
|
+
const pathNodes = [];
|
|
717
|
+
let current = root;
|
|
718
|
+
for (const ancestor of ancestors) {
|
|
719
|
+
if (current.kind === 'stack') {
|
|
720
|
+
return null;
|
|
721
|
+
}
|
|
722
|
+
pathNodes.push(current);
|
|
723
|
+
current = current.children[ancestor.childIndex];
|
|
724
|
+
}
|
|
725
|
+
for (let index = ancestors.length - 1; index >= 0; index -= 1) {
|
|
726
|
+
const ancestor = ancestors[index];
|
|
727
|
+
if (ancestor.orientation !== targetOrientation || ancestor.childIndex !== expectedChildIndex) {
|
|
728
|
+
continue;
|
|
729
|
+
}
|
|
730
|
+
const splitNode = pathNodes[index];
|
|
731
|
+
return {
|
|
732
|
+
splitId: ancestor.splitId,
|
|
733
|
+
childIndex: ancestor.childIndex,
|
|
734
|
+
sourceNode: splitNode.children[ancestor.childIndex],
|
|
735
|
+
siblingNode: ancestor.sibling
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
return null;
|
|
739
|
+
}
|
|
740
|
+
function normalizePanelIdSet(panelIds) {
|
|
741
|
+
return Array.from(new Set(panelIds)).sort();
|
|
742
|
+
}
|
|
743
|
+
function findImmediateJoinSiblingNode(root, panelId, edge) {
|
|
744
|
+
const ancestors = findLayoutBranchAncestors(root, panelId);
|
|
745
|
+
const targetOrientation = edge === 'left' || edge === 'right' ? 'horizontal' : 'vertical';
|
|
746
|
+
const expectedChildIndex = edge === 'left' || edge === 'top' ? 1 : 0;
|
|
747
|
+
for (let index = ancestors.length - 1; index >= 0; index -= 1) {
|
|
748
|
+
const ancestor = ancestors[index];
|
|
749
|
+
if (ancestor.orientation === targetOrientation && ancestor.childIndex === expectedChildIndex) {
|
|
750
|
+
return ancestor.sibling;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
return null;
|
|
754
|
+
}
|
|
755
|
+
function findLayoutBranchAncestors(node, panelId, trail = []) {
|
|
756
|
+
if (node.kind === 'stack') {
|
|
757
|
+
return node.children.some((panel) => panel.id === panelId) ? trail : [];
|
|
758
|
+
}
|
|
759
|
+
for (let childIndex = 0; childIndex < node.children.length; childIndex = (childIndex + 1)) {
|
|
760
|
+
const child = node.children[childIndex];
|
|
761
|
+
if (!containsPanel(child, panelId)) {
|
|
762
|
+
continue;
|
|
763
|
+
}
|
|
764
|
+
return findLayoutBranchAncestors(child, panelId, [
|
|
765
|
+
...trail,
|
|
766
|
+
{
|
|
767
|
+
splitId: node.id,
|
|
768
|
+
orientation: node.orientation,
|
|
769
|
+
childIndex,
|
|
770
|
+
sibling: node.children[childIndex === 0 ? 1 : 0]
|
|
771
|
+
}
|
|
772
|
+
]);
|
|
773
|
+
}
|
|
774
|
+
return [];
|
|
775
|
+
}
|
|
776
|
+
export function adjustLayoutSplitPreviewCuts(state, delta) {
|
|
777
|
+
if (state.mode !== 'split-preview') {
|
|
778
|
+
return state;
|
|
779
|
+
}
|
|
780
|
+
return {
|
|
781
|
+
...state,
|
|
782
|
+
cuts: Math.max(1, Math.min(5, state.cuts + delta))
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
export function commitLayoutSplitPreview(state) {
|
|
786
|
+
if (state.mode !== 'split-preview' || !state.panelId) {
|
|
787
|
+
return {
|
|
788
|
+
kind: 'state',
|
|
789
|
+
state
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
return {
|
|
793
|
+
kind: 'commit-subdivide',
|
|
794
|
+
state: dismissLayoutInteraction(),
|
|
795
|
+
subdivide: {
|
|
796
|
+
panelId: state.panelId,
|
|
797
|
+
orientation: state.orientation,
|
|
798
|
+
edge: state.edge,
|
|
799
|
+
cuts: state.cuts,
|
|
800
|
+
pointerRatio: state.pointerRatio
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
export function commitLayoutSubdivideSelection(input) {
|
|
805
|
+
return {
|
|
806
|
+
kind: 'commit-subdivide',
|
|
807
|
+
state: dismissLayoutInteraction(),
|
|
808
|
+
subdivide: {
|
|
809
|
+
panelId: input.panelId,
|
|
810
|
+
edge: input.edge,
|
|
811
|
+
orientation: input.orientation,
|
|
812
|
+
cuts: Math.max(1, Math.min(5, Math.round(input.cuts))),
|
|
813
|
+
pointerRatio: Math.max(0.12, Math.min(0.88, Number(input.pointerRatio.toFixed(4))))
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
export function previewLayoutSplitSide(state, side) {
|
|
818
|
+
if (state.mode !== 'split-side-pick') {
|
|
819
|
+
return state;
|
|
820
|
+
}
|
|
821
|
+
return {
|
|
822
|
+
...state,
|
|
823
|
+
hoveredSide: side
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
export function confirmLayoutSplitSide(state, side) {
|
|
827
|
+
if (state.mode !== 'split-side-pick') {
|
|
828
|
+
return {
|
|
829
|
+
kind: 'state',
|
|
830
|
+
state
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
const allowedSides = getDockSidesForOrientation(state.orientation);
|
|
834
|
+
if (!allowedSides.includes(side)) {
|
|
835
|
+
return {
|
|
836
|
+
kind: 'state',
|
|
837
|
+
state
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
return {
|
|
841
|
+
kind: 'commit-split',
|
|
842
|
+
state: dismissLayoutInteraction(),
|
|
843
|
+
split: {
|
|
844
|
+
panelId: state.panelId,
|
|
845
|
+
orientation: toDomainSplitOrientation(state.orientation),
|
|
846
|
+
side
|
|
847
|
+
}
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
function toDomainSplitOrientation(orientation) {
|
|
851
|
+
return orientation === 'vertical' ? 'horizontal' : 'vertical';
|
|
852
|
+
}
|