@parhelia/core 0.1.12895 → 0.1.12901
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/dist/agents-view/AgentCard.js +1 -1
- package/dist/agents-view/AgentCard.js.map +1 -1
- package/dist/agents-view/AgentProfileIcon.d.ts +1 -1
- package/dist/agents-view/AgentProfileIcon.js +4 -0
- package/dist/agents-view/AgentProfileIcon.js.map +1 -1
- package/dist/agents-view/AgentsWorkspaceView.js +10 -24
- package/dist/agents-view/AgentsWorkspaceView.js.map +1 -1
- package/dist/agents-view/ProfileAgentsGroup.js +2 -3
- package/dist/agents-view/ProfileAgentsGroup.js.map +1 -1
- package/dist/components/MarkdownDisplay.js +1 -1
- package/dist/components/MarkdownDisplay.js.map +1 -1
- package/dist/components/SearchInput.d.ts +1 -0
- package/dist/components/SearchInput.js +2 -2
- package/dist/components/SearchInput.js.map +1 -1
- package/dist/components/ui/LanguageSelectionGrid.js +2 -1
- package/dist/components/ui/LanguageSelectionGrid.js.map +1 -1
- package/dist/components/ui/LanguageSelector.d.ts +2 -1
- package/dist/components/ui/LanguageSelector.js +3 -3
- package/dist/components/ui/LanguageSelector.js.map +1 -1
- package/dist/components/ui/badge.d.ts +5 -1
- package/dist/components/ui/badge.js +8 -3
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/button.js +4 -5
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/command.js +1 -1
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/context-menu.d.ts +13 -0
- package/dist/components/ui/context-menu.js +61 -57
- package/dist/components/ui/context-menu.js.map +1 -1
- package/dist/components/ui/dropdown-menu.js +4 -4
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/input.js +2 -2
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/textarea.js +1 -1
- package/dist/components/ui/textarea.js.map +1 -1
- package/dist/config/config.js +40 -15
- package/dist/config/config.js.map +1 -1
- package/dist/config/notificationRoutes.js +2 -2
- package/dist/config/notificationRoutes.js.map +1 -1
- package/dist/editor/ContentTree.js +13 -5
- package/dist/editor/ContentTree.js.map +1 -1
- package/dist/editor/ContextMenu.js +4 -6
- package/dist/editor/ContextMenu.js.map +1 -1
- package/dist/editor/FieldListField.js +14 -7
- package/dist/editor/FieldListField.js.map +1 -1
- package/dist/editor/GlobalMenuBar.js +1 -2
- package/dist/editor/GlobalMenuBar.js.map +1 -1
- package/dist/editor/ImageEditor.js +1 -1
- package/dist/editor/ImageEditor.js.map +1 -1
- package/dist/editor/LinkEditorDialog.js +13 -0
- package/dist/editor/LinkEditorDialog.js.map +1 -1
- package/dist/editor/MainLayout.js +66 -9
- package/dist/editor/MainLayout.js.map +1 -1
- package/dist/editor/Titlebar.js +1 -1
- package/dist/editor/Titlebar.js.map +1 -1
- package/dist/editor/WorkspaceTitleSwitcher.js +12 -31
- package/dist/editor/WorkspaceTitleSwitcher.js.map +1 -1
- package/dist/editor/ai/AgentProfileSelector.js +2 -2
- package/dist/editor/ai/AgentProfileSelector.js.map +1 -1
- package/dist/editor/ai/AgentStatusBadge.js +3 -11
- package/dist/editor/ai/AgentStatusBadge.js.map +1 -1
- package/dist/editor/ai/Agents.js +46 -41
- package/dist/editor/ai/Agents.js.map +1 -1
- package/dist/editor/ai/InlineAiDialog.js +24 -26
- package/dist/editor/ai/InlineAiDialog.js.map +1 -1
- package/dist/editor/ai/InlineAiTrigger.js +30 -1
- package/dist/editor/ai/InlineAiTrigger.js.map +1 -1
- package/dist/editor/ai/agentActivitySummary.d.ts +108 -0
- package/dist/editor/ai/agentActivitySummary.js +390 -0
- package/dist/editor/ai/agentActivitySummary.js.map +1 -0
- package/dist/editor/ai/terminal/agentContextMerge.d.ts +19 -0
- package/dist/editor/ai/terminal/agentContextMerge.js +88 -0
- package/dist/editor/ai/terminal/agentContextMerge.js.map +1 -0
- package/dist/editor/ai/terminal/components/ActivitySummaryCell.d.ts +21 -0
- package/dist/editor/ai/terminal/components/ActivitySummaryCell.js +133 -0
- package/dist/editor/ai/terminal/components/ActivitySummaryCell.js.map +1 -0
- package/dist/editor/ai/terminal/components/AgentActivityOverviewPanel.d.ts +7 -0
- package/dist/editor/ai/terminal/components/AgentActivityOverviewPanel.js +145 -0
- package/dist/editor/ai/terminal/components/AgentActivityOverviewPanel.js.map +1 -0
- package/dist/editor/ai/terminal/components/AgentEditHistoryButton.js +1 -1
- package/dist/editor/ai/terminal/components/AgentEditHistoryButton.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentFullPromptControls.d.ts +2 -1
- package/dist/editor/ai/terminal/components/AgentFullPromptControls.js +13 -13
- package/dist/editor/ai/terminal/components/AgentFullPromptControls.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentGreeting.js +2 -2
- package/dist/editor/ai/terminal/components/AgentGreeting.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentMobileStatusPopover.js +1 -1
- package/dist/editor/ai/terminal/components/AgentMobileStatusPopover.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentModeSelector.d.ts +1 -1
- package/dist/editor/ai/terminal/components/AgentModeSelector.js +86 -9
- package/dist/editor/ai/terminal/components/AgentModeSelector.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentPredefinedPromptsButton.js +1 -1
- package/dist/editor/ai/terminal/components/AgentPredefinedPromptsButton.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentPromptActionButtons.js +2 -2
- package/dist/editor/ai/terminal/components/AgentPromptActionButtons.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentPromptInputArea.d.ts +2 -2
- package/dist/editor/ai/terminal/components/AgentPromptInputArea.js +4 -27
- package/dist/editor/ai/terminal/components/AgentPromptInputArea.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentPromptTrayPopovers.d.ts +2 -2
- package/dist/editor/ai/terminal/components/AgentPromptTrayPopovers.js +15 -12
- package/dist/editor/ai/terminal/components/AgentPromptTrayPopovers.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentSettingsPopover.js +1 -1
- package/dist/editor/ai/terminal/components/AgentSettingsPopover.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentSummaryAssistantResponse.d.ts +2 -0
- package/dist/editor/ai/terminal/components/AgentSummaryAssistantResponse.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentTerminalContextChrome.d.ts +1 -3
- package/dist/editor/ai/terminal/components/AgentTerminalContextChrome.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentTerminalFullLayout.d.ts +10 -10
- package/dist/editor/ai/terminal/components/AgentTerminalFullLayout.js +17 -3
- package/dist/editor/ai/terminal/components/AgentTerminalFullLayout.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentTerminalFullUpperContent.d.ts +2 -1
- package/dist/editor/ai/terminal/components/AgentTerminalFullUpperContent.js +59 -5
- package/dist/editor/ai/terminal/components/AgentTerminalFullUpperContent.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentTerminalView.d.ts +3 -2
- package/dist/editor/ai/terminal/components/AgentTerminalView.js +5 -4
- package/dist/editor/ai/terminal/components/AgentTerminalView.js.map +1 -1
- package/dist/editor/ai/terminal/components/AiResponseMessage.d.ts +2 -0
- package/dist/editor/ai/terminal/components/AiResponseMessage.js +84 -28
- package/dist/editor/ai/terminal/components/AiResponseMessage.js.map +1 -1
- package/dist/editor/ai/terminal/components/ContextInfoBar.d.ts +2 -4
- package/dist/editor/ai/terminal/components/ContextInfoBar.js +93 -223
- package/dist/editor/ai/terminal/components/ContextInfoBar.js.map +1 -1
- package/dist/editor/ai/terminal/useAgentDraftInitializer.js +7 -45
- package/dist/editor/ai/terminal/useAgentDraftInitializer.js.map +1 -1
- package/dist/editor/ai/terminal/useAgentEditorContextPipeline.d.ts +0 -4
- package/dist/editor/ai/terminal/useAgentEditorContextPipeline.js +1 -7
- package/dist/editor/ai/terminal/useAgentEditorContextPipeline.js.map +1 -1
- package/dist/editor/ai/terminal/useAgentPromptComposerSurface.d.ts +2 -2
- package/dist/editor/ai/terminal/useAgentQuickActions.d.ts +2 -2
- package/dist/editor/ai/terminal/useAgentQuickActions.js +61 -3
- package/dist/editor/ai/terminal/useAgentQuickActions.js.map +1 -1
- package/dist/editor/ai/terminal/useAgentSettingsPanel.js +0 -2
- package/dist/editor/ai/terminal/useAgentSettingsPanel.js.map +1 -1
- package/dist/editor/ai/terminal/useAgentSettingsSelectOptions.js +3 -3
- package/dist/editor/ai/terminal/useAgentSettingsSelectOptions.js.map +1 -1
- package/dist/editor/ai/terminal/useAgentSkillActions.d.ts +0 -3
- package/dist/editor/ai/terminal/useAgentSkillActions.js +8 -26
- package/dist/editor/ai/terminal/useAgentSkillActions.js.map +1 -1
- package/dist/editor/ai/terminal/useAgentSubmitContextBuilder.d.ts +1 -5
- package/dist/editor/ai/terminal/useAgentSubmitContextBuilder.js +6 -19
- package/dist/editor/ai/terminal/useAgentSubmitContextBuilder.js.map +1 -1
- package/dist/editor/ai/terminal/useAgentTerminalChrome.d.ts +1 -3
- package/dist/editor/ai/terminal/useAgentTerminalChrome.js +2 -2
- package/dist/editor/ai/terminal/useAgentTerminalChrome.js.map +1 -1
- package/dist/editor/ai/terminal/useAgentTerminalController.js +18 -22
- package/dist/editor/ai/terminal/useAgentTerminalController.js.map +1 -1
- package/dist/editor/ai/terminal/useAgentTerminalViewProps.d.ts +1 -1
- package/dist/editor/ai/terminal/useAgentTerminalViewProps.js +2 -2
- package/dist/editor/ai/terminal/useAgentTerminalViewProps.js.map +1 -1
- package/dist/editor/ai/terminal/useAgentTerminalViewState.d.ts +0 -6
- package/dist/editor/ai/terminal/useAgentTerminalViewState.js +2 -16
- package/dist/editor/ai/terminal/useAgentTerminalViewState.js.map +1 -1
- package/dist/editor/ai/useActiveAgentConversation.d.ts +2 -0
- package/dist/editor/ai/useActiveAgentConversation.js +20 -0
- package/dist/editor/ai/useActiveAgentConversation.js.map +1 -1
- package/dist/editor/bridge/protocol.d.ts +48 -0
- package/dist/editor/bridge/protocol.js +13 -1
- package/dist/editor/bridge/protocol.js.map +1 -1
- package/dist/editor/client/EditorShell.d.ts +2 -0
- package/dist/editor/client/EditorShell.js +129 -29
- package/dist/editor/client/EditorShell.js.map +1 -1
- package/dist/editor/client/editContext.d.ts +30 -4
- package/dist/editor/client/editContext.js.map +1 -1
- package/dist/editor/client/hooks/useReducedMotion.d.ts +8 -0
- package/dist/editor/client/hooks/useReducedMotion.js +12 -0
- package/dist/editor/client/hooks/useReducedMotion.js.map +1 -0
- package/dist/editor/client/manualShowMeFocus.d.ts +17 -0
- package/dist/editor/client/manualShowMeFocus.js +32 -0
- package/dist/editor/client/manualShowMeFocus.js.map +1 -0
- package/dist/editor/client/ui/FullscreenControls.js +5 -5
- package/dist/editor/client/ui/FullscreenControls.js.map +1 -1
- package/dist/editor/commands/componentCommands.js +30 -1
- package/dist/editor/commands/componentCommands.js.map +1 -1
- package/dist/editor/commands/keyboardCommands.d.ts +6 -0
- package/dist/editor/commands/keyboardCommands.js +74 -0
- package/dist/editor/commands/keyboardCommands.js.map +1 -1
- package/dist/editor/commands/reorderComponent.d.ts +20 -0
- package/dist/editor/commands/reorderComponent.js +40 -0
- package/dist/editor/commands/reorderComponent.js.map +1 -0
- package/dist/editor/commands/undo.js +3 -3
- package/dist/editor/commands/undo.js.map +1 -1
- package/dist/editor/componentFrameColors.d.ts +11 -0
- package/dist/editor/componentFrameColors.js +47 -0
- package/dist/editor/componentFrameColors.js.map +1 -0
- package/dist/editor/field-types/RichTextEditor.js +25 -6
- package/dist/editor/field-types/RichTextEditor.js.map +1 -1
- package/dist/editor/field-types/RichTextEditorComponent.js +14 -1
- package/dist/editor/field-types/RichTextEditorComponent.js.map +1 -1
- package/dist/editor/field-types/richtext/hooks/useRichTextProfile.d.ts +4 -1
- package/dist/editor/field-types/richtext/hooks/useRichTextProfile.js +33 -5
- package/dist/editor/field-types/richtext/hooks/useRichTextProfile.js.map +1 -1
- package/dist/editor/insertMenuItems.d.ts +11 -0
- package/dist/editor/insertMenuItems.js +9 -0
- package/dist/editor/insertMenuItems.js.map +1 -1
- package/dist/editor/menubar/ActiveUsers.js +3 -3
- package/dist/editor/menubar/ActiveUsers.js.map +1 -1
- package/dist/editor/menubar/FavoritesControls.js +46 -27
- package/dist/editor/menubar/FavoritesControls.js.map +1 -1
- package/dist/editor/menubar/GenericToolbar.js +2 -1
- package/dist/editor/menubar/GenericToolbar.js.map +1 -1
- package/dist/editor/menubar/ItemLanguageVersion.js +7 -5
- package/dist/editor/menubar/ItemLanguageVersion.js.map +1 -1
- package/dist/editor/menubar/PageSelector.js +1 -1
- package/dist/editor/menubar/PageSelector.js.map +1 -1
- package/dist/editor/menubar/PreviewDatePicker.js +40 -21
- package/dist/editor/menubar/PreviewDatePicker.js.map +1 -1
- package/dist/editor/menubar/Separator.d.ts +2 -1
- package/dist/editor/menubar/Separator.js +2 -2
- package/dist/editor/menubar/Separator.js.map +1 -1
- package/dist/editor/menubar/ToolbarFactory.js +24 -17
- package/dist/editor/menubar/ToolbarFactory.js.map +1 -1
- package/dist/editor/menubar/VersionSelector.d.ts +2 -1
- package/dist/editor/menubar/VersionSelector.js +3 -3
- package/dist/editor/menubar/VersionSelector.js.map +1 -1
- package/dist/editor/menubar/WorkflowButton.js +17 -25
- package/dist/editor/menubar/WorkflowButton.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/ContentTreeToggle.d.ts +1 -0
- package/dist/editor/menubar/toolbar-sections/ContentTreeToggle.js +13 -0
- package/dist/editor/menubar/toolbar-sections/ContentTreeToggle.js.map +1 -0
- package/dist/editor/menubar/toolbar-sections/CustomCommandsToolbar.js +1 -1
- package/dist/editor/menubar/toolbar-sections/CustomCommandsToolbar.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/DeviceSwitchToolbar.js +104 -9
- package/dist/editor/menubar/toolbar-sections/DeviceSwitchToolbar.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/EditControls.d.ts +4 -2
- package/dist/editor/menubar/toolbar-sections/EditControls.js +78 -11
- package/dist/editor/menubar/toolbar-sections/EditControls.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/FullscreenControl.d.ts +1 -0
- package/dist/editor/menubar/toolbar-sections/FullscreenControl.js +15 -0
- package/dist/editor/menubar/toolbar-sections/FullscreenControl.js.map +1 -0
- package/dist/editor/menubar/toolbar-sections/InsertControls.js +1 -1
- package/dist/editor/menubar/toolbar-sections/InsertControls.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/ManualBrowser.d.ts +12 -0
- package/dist/editor/menubar/toolbar-sections/ManualBrowser.js +169 -26
- package/dist/editor/menubar/toolbar-sections/ManualBrowser.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/ReviewCommands.js +2 -1
- package/dist/editor/menubar/toolbar-sections/ReviewCommands.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/UtilityControls.d.ts +3 -1
- package/dist/editor/menubar/toolbar-sections/UtilityControls.js +11 -3
- package/dist/editor/menubar/toolbar-sections/UtilityControls.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/ViewportControls.d.ts +1 -0
- package/dist/editor/menubar/toolbar-sections/ViewportControls.js +48 -29
- package/dist/editor/menubar/toolbar-sections/ViewportControls.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/index.d.ts +2 -1
- package/dist/editor/menubar/toolbar-sections/index.js +2 -1
- package/dist/editor/menubar/toolbar-sections/index.js.map +1 -1
- package/dist/editor/notifications/NotificationCenter.d.ts +4 -1
- package/dist/editor/notifications/NotificationCenter.js +13 -4
- package/dist/editor/notifications/NotificationCenter.js.map +1 -1
- package/dist/editor/notifications/WatchButton.d.ts +4 -2
- package/dist/editor/notifications/WatchButton.js +78 -20
- package/dist/editor/notifications/WatchButton.js.map +1 -1
- package/dist/editor/page-editor-chrome/BridgeInlineFormatOverlay.js +71 -6
- package/dist/editor/page-editor-chrome/BridgeInlineFormatOverlay.js.map +1 -1
- package/dist/editor/page-editor-chrome/CommentHighlightings.js +36 -40
- package/dist/editor/page-editor-chrome/CommentHighlightings.js.map +1 -1
- package/dist/editor/page-editor-chrome/DragInsertionOverlay.d.ts +36 -0
- package/dist/editor/page-editor-chrome/DragInsertionOverlay.js +879 -0
- package/dist/editor/page-editor-chrome/DragInsertionOverlay.js.map +1 -0
- package/dist/editor/page-editor-chrome/FeedbackHighlightBadge.d.ts +1 -0
- package/dist/editor/page-editor-chrome/FeedbackHighlightBadge.js +3 -3
- package/dist/editor/page-editor-chrome/FeedbackHighlightBadge.js.map +1 -1
- package/dist/editor/page-editor-chrome/FrameMenu.d.ts +3 -2
- package/dist/editor/page-editor-chrome/FrameMenu.js +49 -119
- package/dist/editor/page-editor-chrome/FrameMenu.js.map +1 -1
- package/dist/editor/page-editor-chrome/FrameMenus.d.ts +1 -1
- package/dist/editor/page-editor-chrome/FrameMenus.js +65 -15
- package/dist/editor/page-editor-chrome/FrameMenus.js.map +1 -1
- package/dist/editor/page-editor-chrome/InsertComponentMenu.d.ts +25 -0
- package/dist/editor/page-editor-chrome/InsertComponentMenu.js +30 -0
- package/dist/editor/page-editor-chrome/InsertComponentMenu.js.map +1 -0
- package/dist/editor/page-editor-chrome/PageEditorChrome.js +14 -2
- package/dist/editor/page-editor-chrome/PageEditorChrome.js.map +1 -1
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.d.ts +33 -2
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +94 -71
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js.map +1 -1
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.d.ts +13 -2
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js +105 -203
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js.map +1 -1
- package/dist/editor/page-editor-chrome/SuggestionHighlightings.js +51 -88
- package/dist/editor/page-editor-chrome/SuggestionHighlightings.js.map +1 -1
- package/dist/editor/page-editor-chrome/bridgeInlineFormatToolbarLayout.js +2 -1
- package/dist/editor/page-editor-chrome/bridgeInlineFormatToolbarLayout.js.map +1 -1
- package/dist/editor/page-editor-chrome/componentDragObject.d.ts +10 -0
- package/dist/editor/page-editor-chrome/componentDragObject.js +22 -0
- package/dist/editor/page-editor-chrome/componentDragObject.js.map +1 -0
- package/dist/editor/page-editor-chrome/overlay/IframeOverlayProvider.d.ts +32 -0
- package/dist/editor/page-editor-chrome/overlay/IframeOverlayProvider.js +8 -0
- package/dist/editor/page-editor-chrome/overlay/IframeOverlayProvider.js.map +1 -1
- package/dist/editor/page-editor-chrome/overlay/InsertionLine.d.ts +44 -0
- package/dist/editor/page-editor-chrome/overlay/InsertionLine.js +160 -0
- package/dist/editor/page-editor-chrome/overlay/InsertionLine.js.map +1 -0
- package/dist/editor/page-editor-chrome/overlay/geometry.d.ts +39 -0
- package/dist/editor/page-editor-chrome/overlay/geometry.js +67 -10
- package/dist/editor/page-editor-chrome/overlay/geometry.js.map +1 -1
- package/dist/editor/page-editor-chrome/overlay/placeholderZones.d.ts +66 -0
- package/dist/editor/page-editor-chrome/overlay/placeholderZones.js +274 -0
- package/dist/editor/page-editor-chrome/overlay/placeholderZones.js.map +1 -0
- package/dist/editor/page-editor-chrome/useComponentDragHandle.d.ts +23 -0
- package/dist/editor/page-editor-chrome/useComponentDragHandle.js +41 -0
- package/dist/editor/page-editor-chrome/useComponentDragHandle.js.map +1 -0
- package/dist/editor/page-editor-chrome/useDragInsertionGesture.d.ts +23 -0
- package/dist/editor/page-editor-chrome/useDragInsertionGesture.js +207 -0
- package/dist/editor/page-editor-chrome/useDragInsertionGesture.js.map +1 -0
- package/dist/editor/page-editor-chrome/usePinnedHoveredComponentId.d.ts +2 -0
- package/dist/editor/page-editor-chrome/usePinnedHoveredComponentId.js +18 -0
- package/dist/editor/page-editor-chrome/usePinnedHoveredComponentId.js.map +1 -0
- package/dist/editor/page-viewer/EditorForm.js +14 -12
- package/dist/editor/page-viewer/EditorForm.js.map +1 -1
- package/dist/editor/page-viewer/EditorFormHintPopover.d.ts +2 -2
- package/dist/editor/page-viewer/EditorFormHintPopover.js +4 -4
- package/dist/editor/page-viewer/EditorFormHintPopover.js.map +1 -1
- package/dist/editor/page-viewer/MiniMap.d.ts +6 -0
- package/dist/editor/page-viewer/MiniMap.js +97 -12
- package/dist/editor/page-viewer/MiniMap.js.map +1 -1
- package/dist/editor/page-viewer/MinimapDropTargets.d.ts +13 -0
- package/dist/editor/page-viewer/MinimapDropTargets.js +140 -0
- package/dist/editor/page-viewer/MinimapDropTargets.js.map +1 -0
- package/dist/editor/page-viewer/PageViewer.js +96 -10
- package/dist/editor/page-viewer/PageViewer.js.map +1 -1
- package/dist/editor/page-viewer/PageViewerFrame.js +263 -6
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
- package/dist/editor/page-viewer/pageViewContext.d.ts +4 -1
- package/dist/editor/page-viewer/pageViewContext.js.map +1 -1
- package/dist/editor/reviews/Comment.js +2 -0
- package/dist/editor/reviews/Comment.js.map +1 -1
- package/dist/editor/reviews/CommentDisplayPopover.js +5 -2
- package/dist/editor/reviews/CommentDisplayPopover.js.map +1 -1
- package/dist/editor/reviews/CommentPopover.d.ts +4 -0
- package/dist/editor/reviews/CommentPopover.js +15 -1
- package/dist/editor/reviews/CommentPopover.js.map +1 -1
- package/dist/editor/reviews/Comments.js +61 -44
- package/dist/editor/reviews/Comments.js.map +1 -1
- package/dist/editor/reviews/DecisionsMatrix.js +3 -3
- package/dist/editor/reviews/DecisionsMatrix.js.map +1 -1
- package/dist/editor/reviews/FeedbackModeIntro.d.ts +15 -0
- package/dist/editor/reviews/FeedbackModeIntro.js +22 -0
- package/dist/editor/reviews/FeedbackModeIntro.js.map +1 -0
- package/dist/editor/reviews/LatestFeedback.js +8 -2
- package/dist/editor/reviews/LatestFeedback.js.map +1 -1
- package/dist/editor/reviews/ReviewersPanel.js +2 -1
- package/dist/editor/reviews/ReviewersPanel.js.map +1 -1
- package/dist/editor/reviews/SuggestedEdit.js +9 -7
- package/dist/editor/reviews/SuggestedEdit.js.map +1 -1
- package/dist/editor/reviews/SuggestionDisplayPopover.js +3 -3
- package/dist/editor/reviews/SuggestionDisplayPopover.js.map +1 -1
- package/dist/editor/reviews/feedbackScrollTarget.d.ts +19 -0
- package/dist/editor/reviews/feedbackScrollTarget.js +171 -0
- package/dist/editor/reviews/feedbackScrollTarget.js.map +1 -0
- package/dist/editor/reviews/feedbackSelection.js +4 -4
- package/dist/editor/reviews/feedbackSelection.js.map +1 -1
- package/dist/editor/reviews/latestFeedbackData.js +1 -1
- package/dist/editor/reviews/openCommentsFeedback.d.ts +35 -0
- package/dist/editor/reviews/openCommentsFeedback.js +89 -0
- package/dist/editor/reviews/openCommentsFeedback.js.map +1 -0
- package/dist/editor/services/agentService.d.ts +5 -0
- package/dist/editor/services/agentService.js.map +1 -1
- package/dist/editor/services/aiService.d.ts +0 -2
- package/dist/editor/services/aiService.js.map +1 -1
- package/dist/editor/services/editService.d.ts +1 -0
- package/dist/editor/services/editService.js +4 -0
- package/dist/editor/services/editService.js.map +1 -1
- package/dist/editor/settings/IndexOverview.js +2 -2
- package/dist/editor/settings/IndexOverview.js.map +1 -1
- package/dist/editor/settings/QuotaInfo.js +2 -2
- package/dist/editor/settings/QuotaInfo.js.map +1 -1
- package/dist/editor/settings/SettingsBreadcrumb.js +8 -2
- package/dist/editor/settings/SettingsBreadcrumb.js.map +1 -1
- package/dist/editor/settings/SettingsPanelLayout.js +1 -1
- package/dist/editor/settings/SettingsPanelLayout.js.map +1 -1
- package/dist/editor/settings/SettingsView.js +7 -9
- package/dist/editor/settings/SettingsView.js.map +1 -1
- package/dist/editor/settings/StatusSummary.js +7 -17
- package/dist/editor/settings/StatusSummary.js.map +1 -1
- package/dist/editor/settings/panels/AgentToolsPanel.js +2 -1
- package/dist/editor/settings/panels/AgentToolsPanel.js.map +1 -1
- package/dist/editor/settings/panels/ClusterInstancesPanel.js +2 -1
- package/dist/editor/settings/panels/ClusterInstancesPanel.js.map +1 -1
- package/dist/editor/settings/panels/FieldTypeSerializersPanel.js +2 -1
- package/dist/editor/settings/panels/FieldTypeSerializersPanel.js.map +1 -1
- package/dist/editor/settings/panels/GroupedFieldConfigPanel.js +3 -2
- package/dist/editor/settings/panels/GroupedFieldConfigPanel.js.map +1 -1
- package/dist/editor/settings/panels/ItemConfigPanel.js +3 -2
- package/dist/editor/settings/panels/ItemConfigPanel.js.map +1 -1
- package/dist/editor/settings/panels/JavaScriptToolAgentPanel.js +2 -1
- package/dist/editor/settings/panels/JavaScriptToolAgentPanel.js.map +1 -1
- package/dist/editor/settings/panels/NotificationSubscriptionsPanel.js +2 -1
- package/dist/editor/settings/panels/NotificationSubscriptionsPanel.js.map +1 -1
- package/dist/editor/settings/panels/PersistentLogsPanel.js +3 -2
- package/dist/editor/settings/panels/PersistentLogsPanel.js.map +1 -1
- package/dist/editor/settings/panels/ProjectTemplateAgentPanel.js +2 -1
- package/dist/editor/settings/panels/ProjectTemplateAgentPanel.js.map +1 -1
- package/dist/editor/settings/panels/ProjectTemplateSelectorList.js +3 -2
- package/dist/editor/settings/panels/ProjectTemplateSelectorList.js.map +1 -1
- package/dist/editor/settings/panels/ProjectTemplatesPanel.js +3 -3
- package/dist/editor/settings/panels/ProjectTemplatesPanel.js.map +1 -1
- package/dist/editor/settings/panels/SearchConfigPanel.js +3 -2
- package/dist/editor/settings/panels/SearchConfigPanel.js.map +1 -1
- package/dist/editor/settings/panels/StatusPanel.js +3 -2
- package/dist/editor/settings/panels/StatusPanel.js.map +1 -1
- package/dist/editor/sidebar/ComponentPalette.d.ts +1 -1
- package/dist/editor/sidebar/ComponentPalette.js +58 -25
- package/dist/editor/sidebar/ComponentPalette.js.map +1 -1
- package/dist/editor/sidebar/ComponentTree.js +91 -7
- package/dist/editor/sidebar/ComponentTree.js.map +1 -1
- package/dist/editor/sidebar/ContentTreePanel.d.ts +3 -0
- package/dist/editor/sidebar/ContentTreePanel.js +14 -0
- package/dist/editor/sidebar/ContentTreePanel.js.map +1 -0
- package/dist/editor/sidebar/Favorites.js +2 -2
- package/dist/editor/sidebar/Favorites.js.map +1 -1
- package/dist/editor/sidebar/NavigationPanelItem.js +2 -1
- package/dist/editor/sidebar/NavigationPanelItem.js.map +1 -1
- package/dist/editor/sidebar/OperationItem.js +98 -17
- package/dist/editor/sidebar/OperationItem.js.map +1 -1
- package/dist/editor/sidebar/Workbox.js +14 -133
- package/dist/editor/sidebar/Workbox.js.map +1 -1
- package/dist/editor/sidebar/WorkspaceButton.js +1 -1
- package/dist/editor/sidebar/WorkspaceButton.js.map +1 -1
- package/dist/editor/sidebar/WorkspaceRail.js +12 -9
- package/dist/editor/sidebar/WorkspaceRail.js.map +1 -1
- package/dist/editor/sidebar/contentTreeConstants.d.ts +2 -0
- package/dist/editor/sidebar/contentTreeConstants.js +3 -0
- package/dist/editor/sidebar/contentTreeConstants.js.map +1 -0
- package/dist/editor/tree-indicators/GutterColumns.js +4 -14
- package/dist/editor/tree-indicators/GutterColumns.js.map +1 -1
- package/dist/editor/ui/ItemCollectionEditor.js +3 -2
- package/dist/editor/ui/ItemCollectionEditor.js.map +1 -1
- package/dist/editor/ui/LoadingState.d.ts +11 -0
- package/dist/editor/ui/LoadingState.js +27 -0
- package/dist/editor/ui/LoadingState.js.map +1 -0
- package/dist/editor/ui/PerfectTree.d.ts +22 -1
- package/dist/editor/ui/PerfectTree.js +17 -11
- package/dist/editor/ui/PerfectTree.js.map +1 -1
- package/dist/editor/ui/PublishDialog.d.ts +11 -0
- package/dist/editor/ui/PublishDialog.js +101 -0
- package/dist/editor/ui/PublishDialog.js.map +1 -0
- package/dist/editor/ui/PublishItemDialog.js +2 -1
- package/dist/editor/ui/PublishItemDialog.js.map +1 -1
- package/dist/editor/ui/PublishRestrictionsDialog.js +3 -2
- package/dist/editor/ui/PublishRestrictionsDialog.js.map +1 -1
- package/dist/editor/ui/SimpleIconButton.d.ts +6 -0
- package/dist/editor/ui/SimpleIconButton.js +13 -4
- package/dist/editor/ui/SimpleIconButton.js.map +1 -1
- package/dist/editor/ui/SimpleMenu.js +4 -4
- package/dist/editor/ui/SimpleMenu.js.map +1 -1
- package/dist/editor/ui/SimpleTabs.js +1 -1
- package/dist/editor/ui/Spinner.d.ts +14 -1
- package/dist/editor/ui/Spinner.js.map +1 -1
- package/dist/editor/ui/WorkboxItemsTable.d.ts +15 -0
- package/dist/editor/ui/WorkboxItemsTable.js +142 -0
- package/dist/editor/ui/WorkboxItemsTable.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/pointerDrag.d.ts +20 -0
- package/dist/lib/pointerDrag.js +57 -0
- package/dist/lib/pointerDrag.js.map +1 -0
- package/dist/logging/consolePrefix.d.ts +2 -0
- package/dist/logging/consolePrefix.js +49 -0
- package/dist/logging/consolePrefix.js.map +1 -0
- package/dist/logging/index.d.ts +1 -0
- package/dist/logging/index.js +2 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/logging/install-browser-console.d.ts +1 -0
- package/dist/logging/install-browser-console.js +3 -0
- package/dist/logging/install-browser-console.js.map +1 -0
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/splash-screen/ModernSplashScreen.js +2 -1
- package/dist/splash-screen/ModernSplashScreen.js.map +1 -1
- package/dist/task-board/TaskBoardWorkspace.js +181 -35
- package/dist/task-board/TaskBoardWorkspace.js.map +1 -1
- package/dist/task-board/components/CommentsList.js +20 -9
- package/dist/task-board/components/CommentsList.js.map +1 -1
- package/dist/task-board/components/FinishedProjectCard.d.ts +5 -0
- package/dist/task-board/components/FinishedProjectCard.js +8 -0
- package/dist/task-board/components/FinishedProjectCard.js.map +1 -0
- package/dist/task-board/components/ProjectDashboard.d.ts +10 -1
- package/dist/task-board/components/ProjectDashboard.js +90 -6
- package/dist/task-board/components/ProjectDashboard.js.map +1 -1
- package/dist/task-board/components/ProjectListContent.js +2 -1
- package/dist/task-board/components/ProjectListContent.js.map +1 -1
- package/dist/task-board/components/ProjectOverviewContent.js +2 -1
- package/dist/task-board/components/ProjectOverviewContent.js.map +1 -1
- package/dist/task-board/components/TaskAgentPanel.d.ts +4 -0
- package/dist/task-board/components/TaskAgentPanel.js +12 -6
- package/dist/task-board/components/TaskAgentPanel.js.map +1 -1
- package/dist/task-board/components/TaskAssigneeBadge.d.ts +16 -0
- package/dist/task-board/components/TaskAssigneeBadge.js +21 -0
- package/dist/task-board/components/TaskAssigneeBadge.js.map +1 -0
- package/dist/task-board/components/TaskAssigneePicker.js +12 -10
- package/dist/task-board/components/TaskAssigneePicker.js.map +1 -1
- package/dist/task-board/components/TaskAttachmentDropZone.d.ts +11 -0
- package/dist/task-board/components/TaskAttachmentDropZone.js +100 -0
- package/dist/task-board/components/TaskAttachmentDropZone.js.map +1 -0
- package/dist/task-board/components/TaskAttachmentsSection.d.ts +1 -0
- package/dist/task-board/components/TaskAttachmentsSection.js +15 -41
- package/dist/task-board/components/TaskAttachmentsSection.js.map +1 -1
- package/dist/task-board/components/TaskBoardFilterBox.d.ts +4 -0
- package/dist/task-board/components/TaskBoardFilterBox.js +7 -0
- package/dist/task-board/components/TaskBoardFilterBox.js.map +1 -0
- package/dist/task-board/components/TaskBoardProjectListSidebar.js +4 -5
- package/dist/task-board/components/TaskBoardProjectListSidebar.js.map +1 -1
- package/dist/task-board/components/TaskCard.js +26 -15
- package/dist/task-board/components/TaskCard.js.map +1 -1
- package/dist/task-board/components/TaskDetailPanel.d.ts +1 -0
- package/dist/task-board/components/TaskDetailPanel.js +15 -12
- package/dist/task-board/components/TaskDetailPanel.js.map +1 -1
- package/dist/task-board/components/TaskReviewActions.d.ts +1 -0
- package/dist/task-board/components/TaskReviewActions.js +4 -2
- package/dist/task-board/components/TaskReviewActions.js.map +1 -1
- package/dist/task-board/components/TaskRow.js +6 -12
- package/dist/task-board/components/TaskRow.js.map +1 -1
- package/dist/task-board/components/TaskboardPersistentLogPanel.js +3 -3
- package/dist/task-board/components/TaskboardPersistentLogPanel.js.map +1 -1
- package/dist/task-board/components/WizardCommunicationCards.js +1 -1
- package/dist/task-board/components/WizardCommunicationCards.js.map +1 -1
- package/dist/task-board/components/WizardCommunicationCenter.d.ts +7 -1
- package/dist/task-board/components/WizardCommunicationCenter.js +10 -6
- package/dist/task-board/components/WizardCommunicationCenter.js.map +1 -1
- package/dist/task-board/components/WizardCommunicationShared.js +5 -5
- package/dist/task-board/components/WizardCommunicationShared.js.map +1 -1
- package/dist/task-board/components/WizardTask.d.ts +5 -1
- package/dist/task-board/components/WizardTask.js +14 -30
- package/dist/task-board/components/WizardTask.js.map +1 -1
- package/dist/task-board/components/WizardTaskDetailsPanel.d.ts +10 -2
- package/dist/task-board/components/WizardTaskDetailsPanel.js +56 -11
- package/dist/task-board/components/WizardTaskDetailsPanel.js.map +1 -1
- package/dist/task-board/taskBoardNavStore.d.ts +3 -0
- package/dist/task-board/taskBoardNavStore.js +44 -0
- package/dist/task-board/taskBoardNavStore.js.map +1 -1
- package/dist/task-board/taskPriority.d.ts +4 -0
- package/dist/task-board/taskPriority.js +19 -0
- package/dist/task-board/taskPriority.js.map +1 -0
- package/dist/task-board/views/DependencyGraphView.js +48 -36
- package/dist/task-board/views/DependencyGraphView.js.map +1 -1
- package/dist/task-board/views/KanbanView.js +130 -96
- package/dist/task-board/views/KanbanView.js.map +1 -1
- package/dist/task-board/views/ListView.js +3 -3
- package/dist/task-board/views/ListView.js.map +1 -1
- package/dist/task-board/views/WizardView.js +7 -6
- package/dist/task-board/views/WizardView.js.map +1 -1
- package/dist/tour/default-tour.js +5 -5
- package/dist/tour/default-tour.js.map +1 -1
- package/package.json +11 -1
- package/styles.css +144 -0
- package/dist/editor/ai/terminal/useAgentEditorContextSync.d.ts +0 -19
- package/dist/editor/ai/terminal/useAgentEditorContextSync.js +0 -142
- package/dist/editor/ai/terminal/useAgentEditorContextSync.js.map +0 -1
|
@@ -0,0 +1,879 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import { GripVertical } from "lucide-react";
|
|
6
|
+
import { useEditContext } from "../client/editContext";
|
|
7
|
+
import { useSlotContext } from "../views/editorSlotContext";
|
|
8
|
+
import { getAllPlaceholders, getComponentById } from "../componentTreeHelper";
|
|
9
|
+
import { cn } from "../../lib/utils";
|
|
10
|
+
import { useReducedMotion } from "../client/hooks/useReducedMotion";
|
|
11
|
+
import { clientToOverlay, findBridgeComponentTarget, hostViewportToOverlay, measureBridgeComponentRect, measureBridgePlaceholderRect, rectEquals, } from "./overlay/geometry";
|
|
12
|
+
import { IFRAME_OVERLAY_BRIDGE_DRAG_GESTURE_EVENT, useIframeOverlay, } from "./overlay/IframeOverlayProvider";
|
|
13
|
+
import { useOverlayMeasurement } from "./overlay/useOverlayMeasurement";
|
|
14
|
+
import { getAutoScrollStep } from "../../lib/pointerDrag";
|
|
15
|
+
import { computePlaceholderZones, layoutAwareIndex, placeholderZonesEqual, resolveNearestGap, } from "./overlay/placeholderZones";
|
|
16
|
+
import { getBetweenInsertionZoneRect, getDirectionalInsertionHitZoneRect, getDirectionalInsertionZoneRect, getEmptyPlaceholderNeutralZoneRect, InsertionLine, } from "./overlay/InsertionLine";
|
|
17
|
+
import { buildComponentDragObject } from "./componentDragObject";
|
|
18
|
+
import { getPlaceholderDropZoneColor, } from "../componentFrameColors";
|
|
19
|
+
// Toggle to re-enable the sibling "make room" shift preview (host previewGap).
|
|
20
|
+
const DRAG_PREVIEW_SHIFT_ENABLED = false;
|
|
21
|
+
const COMPONENT_EDGE_DROP_ZONE_RATIO = 0.25;
|
|
22
|
+
const COMPONENT_EDGE_DROP_ZONE_MIN_PX = 16;
|
|
23
|
+
const COMPONENT_EDGE_DROP_ZONE_MAX_PX = 48;
|
|
24
|
+
// Matches the parhelia-drop-zone-overlay-exit CSS keyframe (120ms): keep the JS
|
|
25
|
+
// unmount timer in lockstep so no transparent residue lingers after the fade.
|
|
26
|
+
const DROP_ZONE_EXIT_ANIMATION_MS = 120;
|
|
27
|
+
/**
|
|
28
|
+
* Full-canvas drop affordance shown while a component/template is being dragged.
|
|
29
|
+
* It drives the continuous {@link InsertionLine} from two sources:
|
|
30
|
+
*
|
|
31
|
+
* - native HTML5 drags (legacy sidebar/tree sources) via the surface's
|
|
32
|
+
* dragover/drop, with the surface `pointer-events-auto`; and
|
|
33
|
+
* - host/parent-driven pointer gestures (whole-component grab, palette cards)
|
|
34
|
+
* via forwarded `dragGesture*` events, with the surface `pointer-events-none`
|
|
35
|
+
* so it never competes with the host's in-iframe pointer capture.
|
|
36
|
+
*
|
|
37
|
+
* Both paths resolve the nearest gap and commit through the same
|
|
38
|
+
* `droppedInPlaceholder` the discrete "+" dots use.
|
|
39
|
+
*/
|
|
40
|
+
export function DragInsertionOverlay({ pageViewContext, onActiveTargetChange, }) {
|
|
41
|
+
const editContext = useEditContext();
|
|
42
|
+
const slotContext = useSlotContext();
|
|
43
|
+
const reducedMotion = useReducedMotion();
|
|
44
|
+
const overlay = useIframeOverlay();
|
|
45
|
+
const surfaceRef = useRef(null);
|
|
46
|
+
const [placeholders, setPlaceholders] = useState([]);
|
|
47
|
+
const [active, setActive] = useState(null);
|
|
48
|
+
const [exitingActive, setExitingActive] = useState(null);
|
|
49
|
+
const [gestureActive, setGestureActive] = useState(false);
|
|
50
|
+
const gestureActiveRef = useRef(false);
|
|
51
|
+
// Cursor position in PARENT viewport coords during a pointer gesture. The chip
|
|
52
|
+
// and snapshot render position:fixed at this point (portaled out of the
|
|
53
|
+
// scrolling overlay layer) so they track the cursor regardless of page scroll.
|
|
54
|
+
const [cursorClient, setCursorClient] = useState(null);
|
|
55
|
+
// Live raster of the dragged component (host-captured), shown at the cursor
|
|
56
|
+
// instead of the chip once it arrives.
|
|
57
|
+
const [snapshot, setSnapshot] = useState(null);
|
|
58
|
+
const nativeDragPointRef = useRef(null);
|
|
59
|
+
const nativeAutoScrollRafRef = useRef(null);
|
|
60
|
+
const activeRef = useRef(null);
|
|
61
|
+
const exitTimerRef = useRef(null);
|
|
62
|
+
const setGestureActiveValue = useCallback((next) => {
|
|
63
|
+
gestureActiveRef.current = next;
|
|
64
|
+
setGestureActive(next);
|
|
65
|
+
}, []);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (!pageViewContext?.page) {
|
|
68
|
+
setPlaceholders([]);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
setPlaceholders(getAllPlaceholders(pageViewContext.page));
|
|
72
|
+
}, [pageViewContext?.page]);
|
|
73
|
+
const isDragging = !!editContext?.dragObject &&
|
|
74
|
+
!!slotContext?.isActive &&
|
|
75
|
+
editContext.mode === "edit" &&
|
|
76
|
+
!editContext.readonly;
|
|
77
|
+
const zones = useOverlayMeasurement((metrics) => {
|
|
78
|
+
if (!isDragging || !pageViewContext)
|
|
79
|
+
return [];
|
|
80
|
+
return computePlaceholderZones({
|
|
81
|
+
placeholders,
|
|
82
|
+
geometry: pageViewContext.bridgeGeometry,
|
|
83
|
+
metrics,
|
|
84
|
+
dragObject: editContext?.dragObject,
|
|
85
|
+
selectedForInsertion: editContext?.selectedForInsertion,
|
|
86
|
+
insertMode: editContext?.insertMode,
|
|
87
|
+
showLayoutComponents: editContext?.showLayoutComponents,
|
|
88
|
+
});
|
|
89
|
+
}, [
|
|
90
|
+
isDragging,
|
|
91
|
+
pageViewContext,
|
|
92
|
+
pageViewContext?.bridgeGeometry,
|
|
93
|
+
placeholders,
|
|
94
|
+
editContext?.dragObject,
|
|
95
|
+
editContext?.selectedForInsertion,
|
|
96
|
+
editContext?.insertMode,
|
|
97
|
+
editContext?.showLayoutComponents,
|
|
98
|
+
], {
|
|
99
|
+
initialValue: [],
|
|
100
|
+
equals: placeholderZonesEqual,
|
|
101
|
+
interests: ["viewport", "layout", "adornment-data"],
|
|
102
|
+
});
|
|
103
|
+
// Refs so the imperative gesture handler always reads current values.
|
|
104
|
+
const zonesRef = useRef(zones);
|
|
105
|
+
zonesRef.current = zones;
|
|
106
|
+
const editContextRef = useRef(editContext);
|
|
107
|
+
editContextRef.current = editContext;
|
|
108
|
+
const pageViewContextRef = useRef(pageViewContext);
|
|
109
|
+
pageViewContextRef.current = pageViewContext;
|
|
110
|
+
const overlayRef = useRef(overlay);
|
|
111
|
+
overlayRef.current = overlay;
|
|
112
|
+
// Sibling-shift preview bookkeeping (gesture drags only).
|
|
113
|
+
const movingRef = useRef(null);
|
|
114
|
+
const lastPreviewKeyRef = useRef(null);
|
|
115
|
+
const lastZoneKeyRef = useRef(null);
|
|
116
|
+
const ownedInsertionZoneRef = useRef(null);
|
|
117
|
+
const reducedMotionRef = useRef(reducedMotion);
|
|
118
|
+
reducedMotionRef.current = reducedMotion;
|
|
119
|
+
const clearExitTimer = useCallback(() => {
|
|
120
|
+
if (exitTimerRef.current !== null) {
|
|
121
|
+
window.clearTimeout(exitTimerRef.current);
|
|
122
|
+
exitTimerRef.current = null;
|
|
123
|
+
}
|
|
124
|
+
}, []);
|
|
125
|
+
const clearExitAnimation = useCallback(() => {
|
|
126
|
+
clearExitTimer();
|
|
127
|
+
setExitingActive(null);
|
|
128
|
+
}, [clearExitTimer]);
|
|
129
|
+
const startExitAnimation = useCallback((previous) => {
|
|
130
|
+
if (reducedMotionRef.current || previous.visualMode === "none") {
|
|
131
|
+
clearExitAnimation();
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
clearExitTimer();
|
|
135
|
+
setExitingActive(previous);
|
|
136
|
+
exitTimerRef.current = window.setTimeout(() => {
|
|
137
|
+
exitTimerRef.current = null;
|
|
138
|
+
setExitingActive(null);
|
|
139
|
+
}, DROP_ZONE_EXIT_ANIMATION_MS);
|
|
140
|
+
}, [clearExitAnimation, clearExitTimer]);
|
|
141
|
+
const setActiveInsertion = useCallback((next, { animateExit = true } = {}) => {
|
|
142
|
+
const previous = activeRef.current;
|
|
143
|
+
const previousKey = formatActiveInsertionKey(previous);
|
|
144
|
+
const nextKey = formatActiveInsertionKey(next);
|
|
145
|
+
const nextIsVisible = !!next && next.visualMode !== "none";
|
|
146
|
+
if (nextIsVisible) {
|
|
147
|
+
clearExitAnimation();
|
|
148
|
+
}
|
|
149
|
+
else if (animateExit &&
|
|
150
|
+
previous &&
|
|
151
|
+
previous.visualMode !== "none" &&
|
|
152
|
+
previousKey !== nextKey) {
|
|
153
|
+
startExitAnimation(previous);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
clearExitAnimation();
|
|
157
|
+
}
|
|
158
|
+
activeRef.current = next;
|
|
159
|
+
setActive(next);
|
|
160
|
+
}, [clearExitAnimation, startExitAnimation]);
|
|
161
|
+
const resolveZoneAtOverlayPoint = useCallback((point) => {
|
|
162
|
+
const geometry = pageViewContextRef.current?.bridgeGeometry;
|
|
163
|
+
if (!geometry)
|
|
164
|
+
return null;
|
|
165
|
+
const zone = resolveNearestGap(point, zonesRef.current);
|
|
166
|
+
if (!zone)
|
|
167
|
+
return null;
|
|
168
|
+
const metrics = overlayRef.current.getMetrics();
|
|
169
|
+
const placeholderRect = measureBridgePlaceholderRect(geometry, zone.placeholder.key, metrics)?.rect;
|
|
170
|
+
if (!placeholderRect)
|
|
171
|
+
return null;
|
|
172
|
+
const visualTarget = resolveInsertionZoneVisualTarget(zone, point, placeholderRect, geometry, metrics, ownedInsertionZoneRef.current);
|
|
173
|
+
return {
|
|
174
|
+
zone,
|
|
175
|
+
placeholderRect,
|
|
176
|
+
visualMode: visualTarget.mode,
|
|
177
|
+
visualAnchor: visualTarget.anchor,
|
|
178
|
+
visualTargetRect: visualTarget.rect,
|
|
179
|
+
visualOwnerComponentId: visualTarget.ownerComponentId,
|
|
180
|
+
zoneHovered: visualTarget.zoneHovered ?? false,
|
|
181
|
+
color: computeDropZoneColor(zone),
|
|
182
|
+
adjustedIndex: layoutAwareIndex(zone.placeholder.components, zone.index),
|
|
183
|
+
};
|
|
184
|
+
}, []);
|
|
185
|
+
const announce = useCallback((target) => {
|
|
186
|
+
editContextRef.current?.setStatusMessage(_jsxs("div", { children: ["Drop into placeholder", " ", _jsx("span", { className: "font-bold", children: target.zone.placeholder.parentComponent?.name }), " ", "/", " ", _jsx("span", { className: "font-bold", children: target.zone.description || target.zone.placeholder.name }), " ", "at position", " ", _jsx("span", { className: "font-bold", children: target.adjustedIndex + 1 })] }));
|
|
187
|
+
}, []);
|
|
188
|
+
// Ask the host to open a gap (shift siblings) at the resolved zone. Only for
|
|
189
|
+
// pointer gestures, where we know the moving element + its size.
|
|
190
|
+
const sendPreviewGap = useCallback((target) => {
|
|
191
|
+
// Sibling-shift preview is off: per-element transforms don't hold up across
|
|
192
|
+
// Sitecore's varied component rendering. The live snapshot is the preview
|
|
193
|
+
// now; the protocol/host wiring stays for a possible future revisit.
|
|
194
|
+
if (!DRAG_PREVIEW_SHIFT_ENABLED || reducedMotionRef.current)
|
|
195
|
+
return;
|
|
196
|
+
const pvc = pageViewContextRef.current;
|
|
197
|
+
const moving = movingRef.current;
|
|
198
|
+
const geometry = pvc?.bridgeGeometry;
|
|
199
|
+
if (!pvc?.requestBridgePreviewGap || !geometry || !moving)
|
|
200
|
+
return;
|
|
201
|
+
const previewKey = `${target.zone.placeholder.key}#${target.zone.index}`;
|
|
202
|
+
if (previewKey === lastPreviewKeyRef.current)
|
|
203
|
+
return;
|
|
204
|
+
const movingRect = findBridgeComponentTarget(geometry, moving.component)?.rect;
|
|
205
|
+
const gapPx = movingRect
|
|
206
|
+
? target.zone.orientation === "horizontal"
|
|
207
|
+
? movingRect.width
|
|
208
|
+
: movingRect.height
|
|
209
|
+
: 0;
|
|
210
|
+
if (!gapPx)
|
|
211
|
+
return;
|
|
212
|
+
lastPreviewKeyRef.current = previewKey;
|
|
213
|
+
pvc.requestBridgePreviewGap({
|
|
214
|
+
siblingElementKeys: target.zone.placeholder.components.map((c) => findBridgeComponentTarget(geometry, c)?.elementKey ?? null),
|
|
215
|
+
fromDomIndex: target.zone.index,
|
|
216
|
+
gapPx,
|
|
217
|
+
axis: target.zone.orientation === "horizontal" ? "x" : "y",
|
|
218
|
+
movingElementKey: moving.elementKey,
|
|
219
|
+
});
|
|
220
|
+
}, []);
|
|
221
|
+
const clearPreviewGap = useCallback(() => {
|
|
222
|
+
if (lastPreviewKeyRef.current === null)
|
|
223
|
+
return;
|
|
224
|
+
lastPreviewKeyRef.current = null;
|
|
225
|
+
pageViewContextRef.current?.requestBridgePreviewGap?.({ clear: true });
|
|
226
|
+
}, []);
|
|
227
|
+
// Update line/highlight/status/preview only when the target gap changes - not
|
|
228
|
+
// on every pointer move - so dragging stays smooth (the cursor chip still
|
|
229
|
+
// tracks every move via setCursorPoint).
|
|
230
|
+
const applyResolvedZone = useCallback((next) => {
|
|
231
|
+
const nextKey = formatActiveInsertionKey(next);
|
|
232
|
+
if (nextKey === lastZoneKeyRef.current)
|
|
233
|
+
return;
|
|
234
|
+
lastZoneKeyRef.current = nextKey;
|
|
235
|
+
setActiveInsertion(next);
|
|
236
|
+
if (next) {
|
|
237
|
+
ownedInsertionZoneRef.current =
|
|
238
|
+
next.visualMode === "directional" &&
|
|
239
|
+
next.visualTargetRect &&
|
|
240
|
+
next.visualOwnerComponentId
|
|
241
|
+
? {
|
|
242
|
+
zoneKey: formatPlaceholderZoneKey(next.zone),
|
|
243
|
+
anchor: next.visualAnchor,
|
|
244
|
+
targetRect: next.visualTargetRect,
|
|
245
|
+
dropZoneRect: getDirectionalInsertionHitZoneRect({
|
|
246
|
+
zone: next.zone,
|
|
247
|
+
targetRect: next.visualTargetRect,
|
|
248
|
+
anchor: next.visualAnchor,
|
|
249
|
+
}),
|
|
250
|
+
ownerComponentId: next.visualOwnerComponentId,
|
|
251
|
+
}
|
|
252
|
+
: null;
|
|
253
|
+
announce(next);
|
|
254
|
+
sendPreviewGap(next);
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
ownedInsertionZoneRef.current = null;
|
|
258
|
+
editContextRef.current?.setStatusMessage("");
|
|
259
|
+
clearPreviewGap();
|
|
260
|
+
}
|
|
261
|
+
}, [announce, sendPreviewGap, clearPreviewGap, setActiveInsertion]);
|
|
262
|
+
const resolveNativeDragPoint = useCallback((point) => {
|
|
263
|
+
const surface = surfaceRef.current;
|
|
264
|
+
if (!surface)
|
|
265
|
+
return;
|
|
266
|
+
const overlayPoint = clientToOverlay(point.x, point.y, surface.getBoundingClientRect());
|
|
267
|
+
applyResolvedZone(resolveZoneAtOverlayPoint(overlayPoint));
|
|
268
|
+
}, [applyResolvedZone, resolveZoneAtOverlayPoint]);
|
|
269
|
+
const getNativeAutoScrollStep = useCallback((point) => {
|
|
270
|
+
const iframe = overlayRef.current.iframe;
|
|
271
|
+
if (!iframe)
|
|
272
|
+
return 0;
|
|
273
|
+
const rect = iframe.getBoundingClientRect();
|
|
274
|
+
if (point.x < rect.left || point.x > rect.right)
|
|
275
|
+
return 0;
|
|
276
|
+
return getAutoScrollStep(point.y, rect.top, rect.bottom);
|
|
277
|
+
}, []);
|
|
278
|
+
const stopNativeAutoScroll = useCallback(() => {
|
|
279
|
+
if (nativeAutoScrollRafRef.current !== null) {
|
|
280
|
+
window.cancelAnimationFrame(nativeAutoScrollRafRef.current);
|
|
281
|
+
nativeAutoScrollRafRef.current = null;
|
|
282
|
+
}
|
|
283
|
+
}, []);
|
|
284
|
+
const scrollNativeDragAtEdge = useCallback(() => {
|
|
285
|
+
const point = nativeDragPointRef.current;
|
|
286
|
+
if (!point)
|
|
287
|
+
return false;
|
|
288
|
+
const step = getNativeAutoScrollStep(point);
|
|
289
|
+
if (step === 0)
|
|
290
|
+
return false;
|
|
291
|
+
pageViewContextRef.current?.requestBridgeScrollBy?.({
|
|
292
|
+
y: step,
|
|
293
|
+
behavior: "auto",
|
|
294
|
+
});
|
|
295
|
+
resolveNativeDragPoint(point);
|
|
296
|
+
return true;
|
|
297
|
+
}, [getNativeAutoScrollStep, resolveNativeDragPoint]);
|
|
298
|
+
const runNativeAutoScroll = useCallback(() => {
|
|
299
|
+
nativeAutoScrollRafRef.current = null;
|
|
300
|
+
if (scrollNativeDragAtEdge()) {
|
|
301
|
+
nativeAutoScrollRafRef.current =
|
|
302
|
+
window.requestAnimationFrame(runNativeAutoScroll);
|
|
303
|
+
}
|
|
304
|
+
}, [scrollNativeDragAtEdge]);
|
|
305
|
+
const updateNativeAutoScroll = useCallback(() => {
|
|
306
|
+
const point = nativeDragPointRef.current;
|
|
307
|
+
if (!point || getNativeAutoScrollStep(point) === 0) {
|
|
308
|
+
stopNativeAutoScroll();
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
if (nativeAutoScrollRafRef.current !== null)
|
|
312
|
+
return;
|
|
313
|
+
if (scrollNativeDragAtEdge()) {
|
|
314
|
+
nativeAutoScrollRafRef.current =
|
|
315
|
+
window.requestAnimationFrame(runNativeAutoScroll);
|
|
316
|
+
}
|
|
317
|
+
}, [
|
|
318
|
+
getNativeAutoScrollStep,
|
|
319
|
+
runNativeAutoScroll,
|
|
320
|
+
scrollNativeDragAtEdge,
|
|
321
|
+
stopNativeAutoScroll,
|
|
322
|
+
]);
|
|
323
|
+
const clearDragPresentation = useCallback(() => {
|
|
324
|
+
setActiveInsertion(null, { animateExit: false });
|
|
325
|
+
setGestureActiveValue(false);
|
|
326
|
+
setCursorClient(null);
|
|
327
|
+
setSnapshot(null);
|
|
328
|
+
nativeDragPointRef.current = null;
|
|
329
|
+
stopNativeAutoScroll();
|
|
330
|
+
clearPreviewGap();
|
|
331
|
+
lastZoneKeyRef.current = null;
|
|
332
|
+
ownedInsertionZoneRef.current = null;
|
|
333
|
+
movingRef.current = null;
|
|
334
|
+
editContextRef.current?.setStatusMessage("");
|
|
335
|
+
}, [
|
|
336
|
+
clearPreviewGap,
|
|
337
|
+
setActiveInsertion,
|
|
338
|
+
setGestureActiveValue,
|
|
339
|
+
stopNativeAutoScroll,
|
|
340
|
+
]);
|
|
341
|
+
const cancelActiveGesture = useCallback(() => {
|
|
342
|
+
if (!gestureActiveRef.current)
|
|
343
|
+
return;
|
|
344
|
+
clearDragPresentation();
|
|
345
|
+
editContextRef.current?.dragEnd();
|
|
346
|
+
}, [clearDragPresentation]);
|
|
347
|
+
useEffect(() => {
|
|
348
|
+
if (!gestureActive)
|
|
349
|
+
return;
|
|
350
|
+
const cancel = () => cancelActiveGesture();
|
|
351
|
+
const cancelWhenHidden = () => {
|
|
352
|
+
if (document.visibilityState === "hidden")
|
|
353
|
+
cancelActiveGesture();
|
|
354
|
+
};
|
|
355
|
+
window.addEventListener("blur", cancel);
|
|
356
|
+
window.addEventListener("pagehide", cancel);
|
|
357
|
+
document.addEventListener("visibilitychange", cancelWhenHidden);
|
|
358
|
+
return () => {
|
|
359
|
+
window.removeEventListener("blur", cancel);
|
|
360
|
+
window.removeEventListener("pagehide", cancel);
|
|
361
|
+
document.removeEventListener("visibilitychange", cancelWhenHidden);
|
|
362
|
+
};
|
|
363
|
+
}, [cancelActiveGesture, gestureActive]);
|
|
364
|
+
// Tell the "+" dots which gap is currently targeted so the matching dot can
|
|
365
|
+
// light up - but only while the insertion LINE is actually visible at that gap,
|
|
366
|
+
// so the dot highlight and the line appear together. (The resolved gap is set
|
|
367
|
+
// even when the cursor is far from any edge, with the line hidden.)
|
|
368
|
+
const activeGapKey = active && isInsertionLineVisibleFor(active)
|
|
369
|
+
? formatPlaceholderZoneKey(active.zone)
|
|
370
|
+
: null;
|
|
371
|
+
useEffect(() => {
|
|
372
|
+
onActiveTargetChange?.(activeGapKey);
|
|
373
|
+
}, [activeGapKey, onActiveTargetChange]);
|
|
374
|
+
useEffect(() => () => onActiveTargetChange?.(null), [onActiveTargetChange]);
|
|
375
|
+
// Host-driven pointer gesture path (whole-component grab).
|
|
376
|
+
useEffect(() => {
|
|
377
|
+
const iframe = overlay.iframe;
|
|
378
|
+
if (!iframe)
|
|
379
|
+
return;
|
|
380
|
+
const onGesture = (e) => {
|
|
381
|
+
const detail = e
|
|
382
|
+
.detail;
|
|
383
|
+
if (detail.phase === "snapshot") {
|
|
384
|
+
setSnapshot({
|
|
385
|
+
dataUrl: detail.dataUrl,
|
|
386
|
+
width: detail.width,
|
|
387
|
+
height: detail.height,
|
|
388
|
+
});
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
const ec = editContextRef.current;
|
|
392
|
+
const pvc = pageViewContextRef.current;
|
|
393
|
+
if (!ec || !pvc?.page)
|
|
394
|
+
return;
|
|
395
|
+
// "host" gestures report in-iframe (host-viewport) coords; "client"
|
|
396
|
+
// gestures (frame-menu grip, parent-driven) report PARENT-client coords.
|
|
397
|
+
const space = detail.space ?? "host";
|
|
398
|
+
const toOverlay = (clientX, clientY) => {
|
|
399
|
+
if (space === "client") {
|
|
400
|
+
const surface = surfaceRef.current;
|
|
401
|
+
if (!surface)
|
|
402
|
+
return null;
|
|
403
|
+
return clientToOverlay(clientX, clientY, surface.getBoundingClientRect());
|
|
404
|
+
}
|
|
405
|
+
const geometry = pvc.bridgeGeometry;
|
|
406
|
+
if (!geometry)
|
|
407
|
+
return null;
|
|
408
|
+
return hostViewportToOverlay({ x: clientX, y: clientY }, geometry, overlayRef.current.getMetrics());
|
|
409
|
+
};
|
|
410
|
+
// Position for the fixed (viewport-anchored) chip/snapshot, in PARENT
|
|
411
|
+
// viewport coords so it follows the cursor on screen and never scrolls away
|
|
412
|
+
// with the page. Client-space coords are already parent-client; host-space
|
|
413
|
+
// coords are mapped through the iframe's on-screen rect vs. its content
|
|
414
|
+
// viewport size (absorbs any editor scaling).
|
|
415
|
+
const toClient = (clientX, clientY) => {
|
|
416
|
+
if (space === "client")
|
|
417
|
+
return { x: clientX, y: clientY };
|
|
418
|
+
const iframe = overlayRef.current.iframe;
|
|
419
|
+
if (!iframe)
|
|
420
|
+
return null;
|
|
421
|
+
const rect = iframe.getBoundingClientRect();
|
|
422
|
+
const metrics = overlayRef.current.getMetrics();
|
|
423
|
+
const sx = metrics.viewportWidth
|
|
424
|
+
? rect.width / metrics.viewportWidth
|
|
425
|
+
: 1;
|
|
426
|
+
const sy = metrics.viewportHeight
|
|
427
|
+
? rect.height / metrics.viewportHeight
|
|
428
|
+
: 1;
|
|
429
|
+
return { x: rect.left + clientX * sx, y: rect.top + clientY * sy };
|
|
430
|
+
};
|
|
431
|
+
if (detail.phase === "start") {
|
|
432
|
+
let component;
|
|
433
|
+
let dragObject = detail.dragObject;
|
|
434
|
+
let inMulti = false;
|
|
435
|
+
if (!dragObject) {
|
|
436
|
+
component = detail.componentId
|
|
437
|
+
? getComponentById(detail.componentId, pvc.page)
|
|
438
|
+
: undefined;
|
|
439
|
+
if (!component)
|
|
440
|
+
return;
|
|
441
|
+
const selection = ec.selection ?? [];
|
|
442
|
+
inMulti = selection.length > 1 && selection.includes(component.id);
|
|
443
|
+
const selectedIds = inMulti ? selection : [component.id];
|
|
444
|
+
dragObject = buildComponentDragObject(component, selectedIds, pvc.page);
|
|
445
|
+
}
|
|
446
|
+
if (!dragObject)
|
|
447
|
+
return;
|
|
448
|
+
movingRef.current =
|
|
449
|
+
component && detail.elementKey
|
|
450
|
+
? { elementKey: detail.elementKey, component }
|
|
451
|
+
: null;
|
|
452
|
+
setSnapshot(null);
|
|
453
|
+
setGestureActiveValue(true);
|
|
454
|
+
ec.dragStart(dragObject);
|
|
455
|
+
// Select the grabbed component AFTER dragStart so the selection-scroll
|
|
456
|
+
// effect (PageViewerFrame) sees the active drag and skips scrolling it
|
|
457
|
+
// back into view, which would yank the page away from the drag.
|
|
458
|
+
if (component && !inMulti)
|
|
459
|
+
ec.select([component.id]);
|
|
460
|
+
// Host gestures self-capture the snapshot on threshold-cross. Parent-
|
|
461
|
+
// driven (client-space) drags must ask the host to rasterize the source.
|
|
462
|
+
if (space === "client" && detail.elementKey) {
|
|
463
|
+
pvc.requestBridgeCaptureSnapshot?.({ elementKey: detail.elementKey });
|
|
464
|
+
}
|
|
465
|
+
setCursorClient(toClient(detail.clientX, detail.clientY));
|
|
466
|
+
const point = toOverlay(detail.clientX, detail.clientY);
|
|
467
|
+
applyResolvedZone(point ? resolveZoneAtOverlayPoint(point) : null);
|
|
468
|
+
}
|
|
469
|
+
else if (detail.phase === "move") {
|
|
470
|
+
const client = toClient(detail.clientX, detail.clientY);
|
|
471
|
+
setCursorClient(client);
|
|
472
|
+
// Hovering the minimap mid-drag scrolls the canvas to that region so
|
|
473
|
+
// off-screen drop targets become reachable. Works for both grab modes:
|
|
474
|
+
// the pointer is captured, so the host keeps reporting moves (which we
|
|
475
|
+
// map to parent coords) even after the cursor leaves the iframe for the
|
|
476
|
+
// minimap. When the minimap owns the scroll this frame, skip the canvas
|
|
477
|
+
// zone re-resolve (the cursor is off-canvas).
|
|
478
|
+
if (client && pvc.scrollViaMinimapPoint?.(client.x, client.y)) {
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
const point = toOverlay(detail.clientX, detail.clientY);
|
|
482
|
+
if (!point)
|
|
483
|
+
return;
|
|
484
|
+
applyResolvedZone(resolveZoneAtOverlayPoint(point));
|
|
485
|
+
}
|
|
486
|
+
else if (detail.phase === "end") {
|
|
487
|
+
const point = !detail.canceled
|
|
488
|
+
? toOverlay(detail.clientX, detail.clientY)
|
|
489
|
+
: null;
|
|
490
|
+
const target = point ? resolveZoneAtOverlayPoint(point) : null;
|
|
491
|
+
const commitTarget = !detail.canceled && isDropCommitTarget(target) ? target : null;
|
|
492
|
+
clearDragPresentation();
|
|
493
|
+
if (commitTarget) {
|
|
494
|
+
ec.droppedInPlaceholder(commitTarget.zone.placeholder.key, commitTarget.adjustedIndex, undefined, commitTarget.zone.anchor, undefined, commitTarget.zone.position, commitTarget.color);
|
|
495
|
+
}
|
|
496
|
+
ec.dragEnd();
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
iframe.addEventListener(IFRAME_OVERLAY_BRIDGE_DRAG_GESTURE_EVENT, onGesture);
|
|
500
|
+
return () => iframe.removeEventListener(IFRAME_OVERLAY_BRIDGE_DRAG_GESTURE_EVENT, onGesture);
|
|
501
|
+
}, [
|
|
502
|
+
overlay.iframe,
|
|
503
|
+
resolveZoneAtOverlayPoint,
|
|
504
|
+
applyResolvedZone,
|
|
505
|
+
clearDragPresentation,
|
|
506
|
+
]);
|
|
507
|
+
// Reset when a drag ends.
|
|
508
|
+
useEffect(() => {
|
|
509
|
+
if (!isDragging) {
|
|
510
|
+
clearDragPresentation();
|
|
511
|
+
}
|
|
512
|
+
}, [isDragging, clearDragPresentation]);
|
|
513
|
+
// Never leave a status message lingering after unmount.
|
|
514
|
+
useEffect(() => {
|
|
515
|
+
return () => {
|
|
516
|
+
stopNativeAutoScroll();
|
|
517
|
+
clearExitTimer();
|
|
518
|
+
editContextRef.current?.setStatusMessage("");
|
|
519
|
+
};
|
|
520
|
+
}, [clearExitTimer, stopNativeAutoScroll]);
|
|
521
|
+
if (!isDragging || !pageViewContext || !editContext)
|
|
522
|
+
return null;
|
|
523
|
+
const handleDragOver = (e) => {
|
|
524
|
+
if (editContext.mode !== "edit" || editContext.readonly) {
|
|
525
|
+
e.dataTransfer.dropEffect = "none";
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
e.preventDefault();
|
|
529
|
+
e.dataTransfer.dropEffect =
|
|
530
|
+
editContext.dragObject?.type === "template" ? "copy" : "move";
|
|
531
|
+
const surface = surfaceRef.current;
|
|
532
|
+
if (!surface)
|
|
533
|
+
return;
|
|
534
|
+
const point = { x: e.clientX, y: e.clientY };
|
|
535
|
+
nativeDragPointRef.current = point;
|
|
536
|
+
resolveNativeDragPoint(point);
|
|
537
|
+
updateNativeAutoScroll();
|
|
538
|
+
};
|
|
539
|
+
const handleDrop = (e) => {
|
|
540
|
+
e.preventDefault();
|
|
541
|
+
nativeDragPointRef.current = null;
|
|
542
|
+
stopNativeAutoScroll();
|
|
543
|
+
editContext.setStatusMessage("");
|
|
544
|
+
if (editContext.mode !== "edit" || editContext.readonly) {
|
|
545
|
+
setActiveInsertion(null, { animateExit: false });
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
const surface = surfaceRef.current;
|
|
549
|
+
const point = surface
|
|
550
|
+
? clientToOverlay(e.clientX, e.clientY, surface.getBoundingClientRect())
|
|
551
|
+
: null;
|
|
552
|
+
const target = point ? resolveZoneAtOverlayPoint(point) : null;
|
|
553
|
+
const commitTarget = isDropCommitTarget(target) ? target : null;
|
|
554
|
+
setActiveInsertion(null, { animateExit: false });
|
|
555
|
+
ownedInsertionZoneRef.current = null;
|
|
556
|
+
if (!commitTarget)
|
|
557
|
+
return;
|
|
558
|
+
editContext.droppedInPlaceholder(commitTarget.zone.placeholder.key, commitTarget.adjustedIndex, undefined, commitTarget.zone.anchor, undefined, commitTarget.zone.position, commitTarget.color);
|
|
559
|
+
};
|
|
560
|
+
const handleDragLeave = (e) => {
|
|
561
|
+
const surface = surfaceRef.current;
|
|
562
|
+
const related = e.relatedTarget;
|
|
563
|
+
if (surface && related && surface.contains(related))
|
|
564
|
+
return;
|
|
565
|
+
nativeDragPointRef.current = null;
|
|
566
|
+
stopNativeAutoScroll();
|
|
567
|
+
applyResolvedZone(null);
|
|
568
|
+
};
|
|
569
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { ref: surfaceRef, "data-testid": "drag-insertion-surface", className: cn("absolute inset-0", gestureActive ? "pointer-events-none" : "pointer-events-auto"), style: { zIndex: 850 }, onDragOver: gestureActive ? undefined : handleDragOver, onDrop: gestureActive ? undefined : handleDrop, onDragLeave: gestureActive ? undefined : handleDragLeave, children: [active && active.zone.placeholder.parentComponent?.id && (_jsx(ParentComponentOutline, { component: active.zone.placeholder.parentComponent, pageViewContext: pageViewContext, color: active.color, animate: !reducedMotion })), exitingActive && (_jsx(InsertionLine
|
|
570
|
+
// Constant key: only one exit copy is ever in flight, so reuse the
|
|
571
|
+
// same node across successive disappearances instead of remounting
|
|
572
|
+
// (and replaying the exit fade) per gap.
|
|
573
|
+
, { zone: exitingActive.zone, placeholderRect: exitingActive.placeholderRect, visualMode: exitingActive.visualMode, visualAnchor: exitingActive.visualAnchor, visualTargetRect: exitingActive.visualTargetRect, color: exitingActive.color, label: insertionLabel(exitingActive), animate: !reducedMotion, phase: "exit" }, "exit-active")), active && (_jsx(InsertionLine
|
|
574
|
+
// Constant key: the bar is a single persistent element that GLIDES
|
|
575
|
+
// to each new gap (via its left/top/width/height transition) instead
|
|
576
|
+
// of remounting and replaying the fade-in at every gap - that per-gap
|
|
577
|
+
// re-fade is the "spots quickly flashing" as the cursor sweeps. The
|
|
578
|
+
// enter fade now plays once when the bar first appears.
|
|
579
|
+
, { zone: active.zone, placeholderRect: active.placeholderRect, visualMode: active.visualMode, visualAnchor: active.visualAnchor, visualTargetRect: active.visualTargetRect, color: active.color, label: insertionLabel(active), animate: !reducedMotion, phase: "enter" }, "active-bar"))] }), gestureActive &&
|
|
580
|
+
cursorClient &&
|
|
581
|
+
editContext.dragObject &&
|
|
582
|
+
createPortal(
|
|
583
|
+
// Cursor-anchored: the dragged thing (live snapshot, else a chip). The
|
|
584
|
+
// insertion bar names the target placeholder, so the cursor stays clean.
|
|
585
|
+
_jsx("div", { className: "pointer-events-none fixed flex flex-col items-start gap-1.5", style: {
|
|
586
|
+
left: cursorClient.x + 14,
|
|
587
|
+
top: cursorClient.y + 14,
|
|
588
|
+
zIndex: 99999,
|
|
589
|
+
}, children: snapshot ? (
|
|
590
|
+
// Card wrapper: padding + near-opaque white backing so the dragged
|
|
591
|
+
// component reads as a solid floating card rather than a ghost.
|
|
592
|
+
_jsx("div", { "data-testid": "drag-cursor-snapshot", className: "rounded-md shadow-lg ring-1 ring-black/10", style: {
|
|
593
|
+
padding: 6,
|
|
594
|
+
backgroundColor: "rgba(255, 255, 255, 0.97)",
|
|
595
|
+
opacity: 0.96,
|
|
596
|
+
}, children: _jsx("img", { src: snapshot.dataUrl, alt: "", className: "block rounded-sm", style: {
|
|
597
|
+
...snapshotDisplaySize(snapshot),
|
|
598
|
+
height: "auto",
|
|
599
|
+
objectFit: "contain",
|
|
600
|
+
} }) })) : (_jsxs("div", { "data-testid": "drag-cursor-chip", className: "bg-component-default flex items-center gap-1 rounded px-2 py-1 text-sm whitespace-nowrap text-white shadow-md", children: [_jsx(GripVertical, { className: "h-3.5 w-3.5", strokeWidth: 1.5 }), (editContext.dragObject.components?.length ?? 0) > 1
|
|
601
|
+
? `${editContext.dragObject.components.length} components`
|
|
602
|
+
: editContext.dragObject.name] })) }), document.body)] }));
|
|
603
|
+
}
|
|
604
|
+
// The single drag indicator's label, shown on the insertion bar: the path of
|
|
605
|
+
// ANCESTOR COMPONENTS from the page root down to the target placeholder, then
|
|
606
|
+
// the 1-based insert position. Walks up the component/placeholder
|
|
607
|
+
// back-references (wired by pageModelBuilder) but names only the components -
|
|
608
|
+
// the parent components' own placeholders are intermediate plumbing, not shown.
|
|
609
|
+
// E.g. "Page ▸ Section 4 ▸ CENTER · 3" or "Page ▸ Main · 2" for a top-level
|
|
610
|
+
// placeholder.
|
|
611
|
+
function insertionLabel(target) {
|
|
612
|
+
const position = target.adjustedIndex + 1;
|
|
613
|
+
const segments = [
|
|
614
|
+
target.zone.description || target.zone.placeholder.name,
|
|
615
|
+
];
|
|
616
|
+
let component = target.zone.placeholder.parentComponent;
|
|
617
|
+
while (component) {
|
|
618
|
+
const placeholder = component.parentPlaceholder;
|
|
619
|
+
if (!placeholder)
|
|
620
|
+
break;
|
|
621
|
+
segments.unshift(component.name);
|
|
622
|
+
component = placeholder.parentComponent;
|
|
623
|
+
}
|
|
624
|
+
segments.unshift("Page");
|
|
625
|
+
return `${segments.join(" ▸ ")} · ${position}`;
|
|
626
|
+
}
|
|
627
|
+
const insertAccentVar = {
|
|
628
|
+
default: "var(--color-component-default)",
|
|
629
|
+
shared: "var(--color-component-shared)",
|
|
630
|
+
layout: "var(--color-highlight-100)",
|
|
631
|
+
};
|
|
632
|
+
// A subtle dotted outline around the component that owns the target placeholder,
|
|
633
|
+
// so a nested drop reads as "into this component's slot". Renders only when the
|
|
634
|
+
// placeholder sits inside a measurable component; top-level placeholders have no
|
|
635
|
+
// parent component to outline, so nothing is drawn.
|
|
636
|
+
function ParentComponentOutline({ component, pageViewContext, color, animate, }) {
|
|
637
|
+
const measuredRect = useOverlayMeasurement((metrics) => measureBridgeComponentRect(pageViewContext.bridgeGeometry, component, metrics)?.rect ?? null, [component, pageViewContext.bridgeGeometry], {
|
|
638
|
+
initialValue: null,
|
|
639
|
+
equals: rectEquals,
|
|
640
|
+
interests: ["viewport", "layout", "adornment-data"],
|
|
641
|
+
validateBeforePaint: true,
|
|
642
|
+
});
|
|
643
|
+
// Hold the last good rect so a single transient-null measurement frame (mid
|
|
644
|
+
// drag auto-scroll / reflow) doesn't unmount the outline and replay its
|
|
645
|
+
// fade-in - a one-frame blink at the component. Reset when the outlined
|
|
646
|
+
// component changes so we never paint a stale box at the wrong place.
|
|
647
|
+
const lastRectRef = useRef(null);
|
|
648
|
+
const lastComponentIdRef = useRef(component.id);
|
|
649
|
+
if (lastComponentIdRef.current !== component.id) {
|
|
650
|
+
lastComponentIdRef.current = component.id;
|
|
651
|
+
lastRectRef.current = null;
|
|
652
|
+
}
|
|
653
|
+
if (measuredRect)
|
|
654
|
+
lastRectRef.current = measuredRect;
|
|
655
|
+
const rect = measuredRect ?? lastRectRef.current;
|
|
656
|
+
if (!rect)
|
|
657
|
+
return null;
|
|
658
|
+
const accent = insertAccentVar[color];
|
|
659
|
+
return (_jsx("div", { "data-testid": "drag-parent-outline", "data-component-id": component.id, className: cn("pointer-events-none absolute rounded-[6px] border border-dotted", animate && "parhelia-drop-zone-overlay-enter"), style: {
|
|
660
|
+
left: rect.x - 2,
|
|
661
|
+
top: rect.y - 2,
|
|
662
|
+
width: rect.width + 4,
|
|
663
|
+
height: rect.height + 4,
|
|
664
|
+
borderColor: `color-mix(in srgb, ${accent} 45%, transparent)`,
|
|
665
|
+
zIndex: 851,
|
|
666
|
+
} }));
|
|
667
|
+
}
|
|
668
|
+
// Size the floating snapshot by WIDTH only (75% of the component's real width,
|
|
669
|
+
// capped to the viewport). Height is left to the image's natural captured aspect
|
|
670
|
+
// ratio (the caller sets height:auto + objectFit:contain), so the preview never
|
|
671
|
+
// distorts even when html2canvas reflowed the component to a different aspect
|
|
672
|
+
// than its on-screen box. maxHeight caps very tall captures without stretching.
|
|
673
|
+
function snapshotDisplaySize(s) {
|
|
674
|
+
const viewportWidth = typeof window !== "undefined" ? window.innerWidth : 1280;
|
|
675
|
+
const viewportHeight = typeof window !== "undefined" ? window.innerHeight : 800;
|
|
676
|
+
return {
|
|
677
|
+
width: Math.round(Math.min(Math.max(1, s.width * 0.75), viewportWidth * 0.9)),
|
|
678
|
+
maxHeight: Math.round(viewportHeight * 0.9),
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
function formatOverlayRectKey(rect) {
|
|
682
|
+
if (!rect)
|
|
683
|
+
return "none";
|
|
684
|
+
return `${Math.round(rect.x)}:${Math.round(rect.y)}:${Math.round(rect.width)}:${Math.round(rect.height)}`;
|
|
685
|
+
}
|
|
686
|
+
// GRANULAR identity: the full state signature, including transient hover state
|
|
687
|
+
// and the rounded target rect. Use this for the applyResolvedZone dedup and the
|
|
688
|
+
// setActiveInsertion comparison so a hover-only change (zoneHovered) or a 1px
|
|
689
|
+
// rect tick still flows through to setActive(next) - that keeps active.zoneHovered
|
|
690
|
+
// fresh for isDropCommitTarget and lets the bar reposition. MUST stay granular;
|
|
691
|
+
// do NOT reuse it for the React key (see formatActiveInsertionVisualKey).
|
|
692
|
+
export function formatActiveInsertionKey(target) {
|
|
693
|
+
if (!target)
|
|
694
|
+
return "none";
|
|
695
|
+
return `${target.zone.placeholder.key}#${target.zone.index}#${target.visualMode}#${target.visualAnchor}#${target.zoneHovered ? "hovered" : "resting"}#${formatOverlayRectKey(target.visualTargetRect)}`;
|
|
696
|
+
}
|
|
697
|
+
// COARSE identity: the targeted gap + its visual orientation only. This is the
|
|
698
|
+
// animation/React-key identity for <InsertionLine>. It deliberately DROPS
|
|
699
|
+
// zoneHovered and visualTargetRect so that merely hovering onto the line's hit
|
|
700
|
+
// band, or a sub-pixel rect drift, re-renders the SAME node in place (the inner
|
|
701
|
+
// transition glides it) instead of remounting it - a remount would replay the
|
|
702
|
+
// fade-in enter keyframe = a visible blink/flicker. The key changes only when
|
|
703
|
+
// the real insertion target changes, which is exactly when a fresh fade is wanted.
|
|
704
|
+
export function formatActiveInsertionVisualKey(target) {
|
|
705
|
+
if (!target)
|
|
706
|
+
return "none";
|
|
707
|
+
return `${target.zone.placeholder.key}#${target.zone.index}#${target.visualMode}#${target.visualAnchor}`;
|
|
708
|
+
}
|
|
709
|
+
function isDropCommitTarget(target) {
|
|
710
|
+
return !!target && target.zoneHovered;
|
|
711
|
+
}
|
|
712
|
+
function formatPlaceholderZoneKey(zone) {
|
|
713
|
+
return `${zone.placeholder.key}#${zone.index}`;
|
|
714
|
+
}
|
|
715
|
+
// Mirrors InsertionLine's own visibility gate: the bar renders unless the mode
|
|
716
|
+
// is "none" (cursor not near an edge) or a non-empty "neutral" zone. Used to
|
|
717
|
+
// keep the "+" dot highlight in lockstep with the line - the resolved gap is set
|
|
718
|
+
// even when the cursor is far from any edge, and the dot must not light up then.
|
|
719
|
+
function isInsertionLineVisibleFor(target) {
|
|
720
|
+
if (target.visualMode === "none")
|
|
721
|
+
return false;
|
|
722
|
+
const isEmptyPlaceholder = target.zone.placeholder.components.length === 0;
|
|
723
|
+
if (target.visualMode === "neutral" && !isEmptyPlaceholder)
|
|
724
|
+
return false;
|
|
725
|
+
return true;
|
|
726
|
+
}
|
|
727
|
+
function computeDropZoneColor(zone) {
|
|
728
|
+
const components = zone.placeholder.components;
|
|
729
|
+
const prev = zone.index >= 1 ? components[zone.index - 1] : null;
|
|
730
|
+
const next = zone.index < components.length ? components[zone.index] : null;
|
|
731
|
+
return getPlaceholderDropZoneColor({
|
|
732
|
+
parentComponent: zone.placeholder.parentComponent,
|
|
733
|
+
prevComponent: prev,
|
|
734
|
+
nextComponent: next,
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
function resolveInsertionZoneVisualTarget(zone, point, placeholderRect, geometry, metrics, ownedZone) {
|
|
738
|
+
const components = zone.placeholder.components;
|
|
739
|
+
const zoneKey = formatPlaceholderZoneKey(zone);
|
|
740
|
+
if (ownedZone?.zoneKey === zoneKey &&
|
|
741
|
+
pointInOverlayRect(point, ownedZone.dropZoneRect)) {
|
|
742
|
+
const visualDropZoneRect = getDirectionalInsertionZoneRect({
|
|
743
|
+
zone,
|
|
744
|
+
targetRect: ownedZone.targetRect,
|
|
745
|
+
anchor: ownedZone.anchor,
|
|
746
|
+
});
|
|
747
|
+
return {
|
|
748
|
+
mode: "directional",
|
|
749
|
+
anchor: ownedZone.anchor,
|
|
750
|
+
rect: ownedZone.targetRect,
|
|
751
|
+
ownerComponentId: ownedZone.ownerComponentId,
|
|
752
|
+
zoneHovered: pointInOverlayRect(point, visualDropZoneRect),
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
const previousComponent = zone.index > 0 ? components[zone.index - 1] : null;
|
|
756
|
+
const nextComponent = zone.index < components.length ? components[zone.index] : null;
|
|
757
|
+
const previousRect = previousComponent
|
|
758
|
+
? measureBridgeComponentRect(geometry, previousComponent, metrics)?.rect
|
|
759
|
+
: null;
|
|
760
|
+
const nextRect = nextComponent
|
|
761
|
+
? measureBridgeComponentRect(geometry, nextComponent, metrics)?.rect
|
|
762
|
+
: null;
|
|
763
|
+
const afterPrevious = previousRect
|
|
764
|
+
? {
|
|
765
|
+
anchor: zone.orientation === "horizontal"
|
|
766
|
+
? "right"
|
|
767
|
+
: "bottom",
|
|
768
|
+
rect: previousRect,
|
|
769
|
+
ownerComponentId: previousComponent?.id,
|
|
770
|
+
}
|
|
771
|
+
: null;
|
|
772
|
+
const beforeNext = nextRect
|
|
773
|
+
? {
|
|
774
|
+
anchor: zone.orientation === "horizontal"
|
|
775
|
+
? "left"
|
|
776
|
+
: "top",
|
|
777
|
+
rect: nextRect,
|
|
778
|
+
ownerComponentId: nextComponent?.id,
|
|
779
|
+
}
|
|
780
|
+
: null;
|
|
781
|
+
if (!previousComponent && beforeNext) {
|
|
782
|
+
if (pointInOverlayRect(point, beforeNext.rect)) {
|
|
783
|
+
return pointInDirectionalEdgeBand(point, beforeNext.rect, beforeNext.anchor)
|
|
784
|
+
? { ...beforeNext, mode: "directional" }
|
|
785
|
+
: {
|
|
786
|
+
...resolveHiddenInsertionVisual(zone),
|
|
787
|
+
ownerComponentId: beforeNext.ownerComponentId,
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
return resolveNeutralInsertionVisual(zone, placeholderRect, point);
|
|
791
|
+
}
|
|
792
|
+
if (!nextComponent && afterPrevious) {
|
|
793
|
+
if (pointInOverlayRect(point, afterPrevious.rect)) {
|
|
794
|
+
return pointInDirectionalEdgeBand(point, afterPrevious.rect, afterPrevious.anchor)
|
|
795
|
+
? { ...afterPrevious, mode: "directional" }
|
|
796
|
+
: {
|
|
797
|
+
...resolveHiddenInsertionVisual(zone),
|
|
798
|
+
ownerComponentId: afterPrevious.ownerComponentId,
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
return resolveNeutralInsertionVisual(zone, placeholderRect, point);
|
|
802
|
+
}
|
|
803
|
+
if (afterPrevious && beforeNext) {
|
|
804
|
+
const betweenRect = getBetweenInsertionZoneRect({
|
|
805
|
+
zone,
|
|
806
|
+
previousRect: afterPrevious.rect,
|
|
807
|
+
nextRect: beforeNext.rect,
|
|
808
|
+
});
|
|
809
|
+
if (pointInOverlayRect(point, betweenRect)) {
|
|
810
|
+
return {
|
|
811
|
+
mode: "between",
|
|
812
|
+
anchor: zone.anchor,
|
|
813
|
+
rect: betweenRect,
|
|
814
|
+
zoneHovered: true,
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
if (pointInOverlayRect(point, afterPrevious.rect)) {
|
|
818
|
+
return pointInDirectionalEdgeBand(point, afterPrevious.rect, afterPrevious.anchor)
|
|
819
|
+
? { ...afterPrevious, mode: "directional" }
|
|
820
|
+
: {
|
|
821
|
+
...resolveHiddenInsertionVisual(zone),
|
|
822
|
+
ownerComponentId: afterPrevious.ownerComponentId,
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
if (pointInOverlayRect(point, beforeNext.rect)) {
|
|
826
|
+
return pointInDirectionalEdgeBand(point, beforeNext.rect, beforeNext.anchor)
|
|
827
|
+
? { ...beforeNext, mode: "directional" }
|
|
828
|
+
: {
|
|
829
|
+
...resolveHiddenInsertionVisual(zone),
|
|
830
|
+
ownerComponentId: beforeNext.ownerComponentId,
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
return resolveNeutralInsertionVisual(zone, placeholderRect, point);
|
|
834
|
+
}
|
|
835
|
+
return resolveNeutralInsertionVisual(zone, placeholderRect, point);
|
|
836
|
+
}
|
|
837
|
+
function resolveNeutralInsertionVisual(zone, placeholderRect, point) {
|
|
838
|
+
const targetRect = zone.targetRect ?? placeholderRect;
|
|
839
|
+
const isEmptyPlaceholder = zone.placeholder.components.length === 0;
|
|
840
|
+
return {
|
|
841
|
+
anchor: zone.anchor,
|
|
842
|
+
rect: targetRect,
|
|
843
|
+
mode: "neutral",
|
|
844
|
+
zoneHovered: isEmptyPlaceholder &&
|
|
845
|
+
pointInOverlayRect(point, getEmptyPlaceholderNeutralZoneRect({ zone, targetRect })),
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
function resolveHiddenInsertionVisual(zone) {
|
|
849
|
+
return {
|
|
850
|
+
anchor: zone.anchor,
|
|
851
|
+
rect: null,
|
|
852
|
+
mode: "none",
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
function pointInOverlayRect(point, rect) {
|
|
856
|
+
return (point.x >= rect.x &&
|
|
857
|
+
point.x <= rect.x + rect.width &&
|
|
858
|
+
point.y >= rect.y &&
|
|
859
|
+
point.y <= rect.y + rect.height);
|
|
860
|
+
}
|
|
861
|
+
function pointInDirectionalEdgeBand(point, rect, anchor) {
|
|
862
|
+
const length = anchor === "left" || anchor === "right" ? rect.width : rect.height;
|
|
863
|
+
const edgeSize = resolveComponentEdgeDropZoneSize(length);
|
|
864
|
+
switch (anchor) {
|
|
865
|
+
case "top":
|
|
866
|
+
return point.y - rect.y <= edgeSize;
|
|
867
|
+
case "bottom":
|
|
868
|
+
return rect.y + rect.height - point.y <= edgeSize;
|
|
869
|
+
case "left":
|
|
870
|
+
return point.x - rect.x <= edgeSize;
|
|
871
|
+
case "right":
|
|
872
|
+
return rect.x + rect.width - point.x <= edgeSize;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
function resolveComponentEdgeDropZoneSize(length) {
|
|
876
|
+
const desired = Math.min(COMPONENT_EDGE_DROP_ZONE_MAX_PX, Math.max(COMPONENT_EDGE_DROP_ZONE_MIN_PX, length * COMPONENT_EDGE_DROP_ZONE_RATIO));
|
|
877
|
+
return Math.max(1, Math.min(desired, length / 3));
|
|
878
|
+
}
|
|
879
|
+
//# sourceMappingURL=DragInsertionOverlay.js.map
|