@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.
Files changed (552) hide show
  1. package/dist/agents-view/AgentCard.js +1 -1
  2. package/dist/agents-view/AgentCard.js.map +1 -1
  3. package/dist/agents-view/AgentProfileIcon.d.ts +1 -1
  4. package/dist/agents-view/AgentProfileIcon.js +4 -0
  5. package/dist/agents-view/AgentProfileIcon.js.map +1 -1
  6. package/dist/agents-view/AgentsWorkspaceView.js +10 -24
  7. package/dist/agents-view/AgentsWorkspaceView.js.map +1 -1
  8. package/dist/agents-view/ProfileAgentsGroup.js +2 -3
  9. package/dist/agents-view/ProfileAgentsGroup.js.map +1 -1
  10. package/dist/components/MarkdownDisplay.js +1 -1
  11. package/dist/components/MarkdownDisplay.js.map +1 -1
  12. package/dist/components/SearchInput.d.ts +1 -0
  13. package/dist/components/SearchInput.js +2 -2
  14. package/dist/components/SearchInput.js.map +1 -1
  15. package/dist/components/ui/LanguageSelectionGrid.js +2 -1
  16. package/dist/components/ui/LanguageSelectionGrid.js.map +1 -1
  17. package/dist/components/ui/LanguageSelector.d.ts +2 -1
  18. package/dist/components/ui/LanguageSelector.js +3 -3
  19. package/dist/components/ui/LanguageSelector.js.map +1 -1
  20. package/dist/components/ui/badge.d.ts +5 -1
  21. package/dist/components/ui/badge.js +8 -3
  22. package/dist/components/ui/badge.js.map +1 -1
  23. package/dist/components/ui/button.js +4 -5
  24. package/dist/components/ui/button.js.map +1 -1
  25. package/dist/components/ui/checkbox.js +1 -1
  26. package/dist/components/ui/checkbox.js.map +1 -1
  27. package/dist/components/ui/command.js +1 -1
  28. package/dist/components/ui/command.js.map +1 -1
  29. package/dist/components/ui/context-menu.d.ts +13 -0
  30. package/dist/components/ui/context-menu.js +61 -57
  31. package/dist/components/ui/context-menu.js.map +1 -1
  32. package/dist/components/ui/dropdown-menu.js +4 -4
  33. package/dist/components/ui/dropdown-menu.js.map +1 -1
  34. package/dist/components/ui/input.js +2 -2
  35. package/dist/components/ui/input.js.map +1 -1
  36. package/dist/components/ui/switch.js +1 -1
  37. package/dist/components/ui/switch.js.map +1 -1
  38. package/dist/components/ui/textarea.js +1 -1
  39. package/dist/components/ui/textarea.js.map +1 -1
  40. package/dist/config/config.js +40 -15
  41. package/dist/config/config.js.map +1 -1
  42. package/dist/config/notificationRoutes.js +2 -2
  43. package/dist/config/notificationRoutes.js.map +1 -1
  44. package/dist/editor/ContentTree.js +13 -5
  45. package/dist/editor/ContentTree.js.map +1 -1
  46. package/dist/editor/ContextMenu.js +4 -6
  47. package/dist/editor/ContextMenu.js.map +1 -1
  48. package/dist/editor/FieldListField.js +14 -7
  49. package/dist/editor/FieldListField.js.map +1 -1
  50. package/dist/editor/GlobalMenuBar.js +1 -2
  51. package/dist/editor/GlobalMenuBar.js.map +1 -1
  52. package/dist/editor/ImageEditor.js +1 -1
  53. package/dist/editor/ImageEditor.js.map +1 -1
  54. package/dist/editor/LinkEditorDialog.js +13 -0
  55. package/dist/editor/LinkEditorDialog.js.map +1 -1
  56. package/dist/editor/MainLayout.js +66 -9
  57. package/dist/editor/MainLayout.js.map +1 -1
  58. package/dist/editor/Titlebar.js +1 -1
  59. package/dist/editor/Titlebar.js.map +1 -1
  60. package/dist/editor/WorkspaceTitleSwitcher.js +12 -31
  61. package/dist/editor/WorkspaceTitleSwitcher.js.map +1 -1
  62. package/dist/editor/ai/AgentProfileSelector.js +2 -2
  63. package/dist/editor/ai/AgentProfileSelector.js.map +1 -1
  64. package/dist/editor/ai/AgentStatusBadge.js +3 -11
  65. package/dist/editor/ai/AgentStatusBadge.js.map +1 -1
  66. package/dist/editor/ai/Agents.js +46 -41
  67. package/dist/editor/ai/Agents.js.map +1 -1
  68. package/dist/editor/ai/InlineAiDialog.js +24 -26
  69. package/dist/editor/ai/InlineAiDialog.js.map +1 -1
  70. package/dist/editor/ai/InlineAiTrigger.js +30 -1
  71. package/dist/editor/ai/InlineAiTrigger.js.map +1 -1
  72. package/dist/editor/ai/agentActivitySummary.d.ts +108 -0
  73. package/dist/editor/ai/agentActivitySummary.js +390 -0
  74. package/dist/editor/ai/agentActivitySummary.js.map +1 -0
  75. package/dist/editor/ai/terminal/agentContextMerge.d.ts +19 -0
  76. package/dist/editor/ai/terminal/agentContextMerge.js +88 -0
  77. package/dist/editor/ai/terminal/agentContextMerge.js.map +1 -0
  78. package/dist/editor/ai/terminal/components/ActivitySummaryCell.d.ts +21 -0
  79. package/dist/editor/ai/terminal/components/ActivitySummaryCell.js +133 -0
  80. package/dist/editor/ai/terminal/components/ActivitySummaryCell.js.map +1 -0
  81. package/dist/editor/ai/terminal/components/AgentActivityOverviewPanel.d.ts +7 -0
  82. package/dist/editor/ai/terminal/components/AgentActivityOverviewPanel.js +145 -0
  83. package/dist/editor/ai/terminal/components/AgentActivityOverviewPanel.js.map +1 -0
  84. package/dist/editor/ai/terminal/components/AgentEditHistoryButton.js +1 -1
  85. package/dist/editor/ai/terminal/components/AgentEditHistoryButton.js.map +1 -1
  86. package/dist/editor/ai/terminal/components/AgentFullPromptControls.d.ts +2 -1
  87. package/dist/editor/ai/terminal/components/AgentFullPromptControls.js +13 -13
  88. package/dist/editor/ai/terminal/components/AgentFullPromptControls.js.map +1 -1
  89. package/dist/editor/ai/terminal/components/AgentGreeting.js +2 -2
  90. package/dist/editor/ai/terminal/components/AgentGreeting.js.map +1 -1
  91. package/dist/editor/ai/terminal/components/AgentMobileStatusPopover.js +1 -1
  92. package/dist/editor/ai/terminal/components/AgentMobileStatusPopover.js.map +1 -1
  93. package/dist/editor/ai/terminal/components/AgentModeSelector.d.ts +1 -1
  94. package/dist/editor/ai/terminal/components/AgentModeSelector.js +86 -9
  95. package/dist/editor/ai/terminal/components/AgentModeSelector.js.map +1 -1
  96. package/dist/editor/ai/terminal/components/AgentPredefinedPromptsButton.js +1 -1
  97. package/dist/editor/ai/terminal/components/AgentPredefinedPromptsButton.js.map +1 -1
  98. package/dist/editor/ai/terminal/components/AgentPromptActionButtons.js +2 -2
  99. package/dist/editor/ai/terminal/components/AgentPromptActionButtons.js.map +1 -1
  100. package/dist/editor/ai/terminal/components/AgentPromptInputArea.d.ts +2 -2
  101. package/dist/editor/ai/terminal/components/AgentPromptInputArea.js +4 -27
  102. package/dist/editor/ai/terminal/components/AgentPromptInputArea.js.map +1 -1
  103. package/dist/editor/ai/terminal/components/AgentPromptTrayPopovers.d.ts +2 -2
  104. package/dist/editor/ai/terminal/components/AgentPromptTrayPopovers.js +15 -12
  105. package/dist/editor/ai/terminal/components/AgentPromptTrayPopovers.js.map +1 -1
  106. package/dist/editor/ai/terminal/components/AgentSettingsPopover.js +1 -1
  107. package/dist/editor/ai/terminal/components/AgentSettingsPopover.js.map +1 -1
  108. package/dist/editor/ai/terminal/components/AgentSummaryAssistantResponse.d.ts +2 -0
  109. package/dist/editor/ai/terminal/components/AgentSummaryAssistantResponse.js.map +1 -1
  110. package/dist/editor/ai/terminal/components/AgentTerminalContextChrome.d.ts +1 -3
  111. package/dist/editor/ai/terminal/components/AgentTerminalContextChrome.js.map +1 -1
  112. package/dist/editor/ai/terminal/components/AgentTerminalFullLayout.d.ts +10 -10
  113. package/dist/editor/ai/terminal/components/AgentTerminalFullLayout.js +17 -3
  114. package/dist/editor/ai/terminal/components/AgentTerminalFullLayout.js.map +1 -1
  115. package/dist/editor/ai/terminal/components/AgentTerminalFullUpperContent.d.ts +2 -1
  116. package/dist/editor/ai/terminal/components/AgentTerminalFullUpperContent.js +59 -5
  117. package/dist/editor/ai/terminal/components/AgentTerminalFullUpperContent.js.map +1 -1
  118. package/dist/editor/ai/terminal/components/AgentTerminalView.d.ts +3 -2
  119. package/dist/editor/ai/terminal/components/AgentTerminalView.js +5 -4
  120. package/dist/editor/ai/terminal/components/AgentTerminalView.js.map +1 -1
  121. package/dist/editor/ai/terminal/components/AiResponseMessage.d.ts +2 -0
  122. package/dist/editor/ai/terminal/components/AiResponseMessage.js +84 -28
  123. package/dist/editor/ai/terminal/components/AiResponseMessage.js.map +1 -1
  124. package/dist/editor/ai/terminal/components/ContextInfoBar.d.ts +2 -4
  125. package/dist/editor/ai/terminal/components/ContextInfoBar.js +93 -223
  126. package/dist/editor/ai/terminal/components/ContextInfoBar.js.map +1 -1
  127. package/dist/editor/ai/terminal/useAgentDraftInitializer.js +7 -45
  128. package/dist/editor/ai/terminal/useAgentDraftInitializer.js.map +1 -1
  129. package/dist/editor/ai/terminal/useAgentEditorContextPipeline.d.ts +0 -4
  130. package/dist/editor/ai/terminal/useAgentEditorContextPipeline.js +1 -7
  131. package/dist/editor/ai/terminal/useAgentEditorContextPipeline.js.map +1 -1
  132. package/dist/editor/ai/terminal/useAgentPromptComposerSurface.d.ts +2 -2
  133. package/dist/editor/ai/terminal/useAgentQuickActions.d.ts +2 -2
  134. package/dist/editor/ai/terminal/useAgentQuickActions.js +61 -3
  135. package/dist/editor/ai/terminal/useAgentQuickActions.js.map +1 -1
  136. package/dist/editor/ai/terminal/useAgentSettingsPanel.js +0 -2
  137. package/dist/editor/ai/terminal/useAgentSettingsPanel.js.map +1 -1
  138. package/dist/editor/ai/terminal/useAgentSettingsSelectOptions.js +3 -3
  139. package/dist/editor/ai/terminal/useAgentSettingsSelectOptions.js.map +1 -1
  140. package/dist/editor/ai/terminal/useAgentSkillActions.d.ts +0 -3
  141. package/dist/editor/ai/terminal/useAgentSkillActions.js +8 -26
  142. package/dist/editor/ai/terminal/useAgentSkillActions.js.map +1 -1
  143. package/dist/editor/ai/terminal/useAgentSubmitContextBuilder.d.ts +1 -5
  144. package/dist/editor/ai/terminal/useAgentSubmitContextBuilder.js +6 -19
  145. package/dist/editor/ai/terminal/useAgentSubmitContextBuilder.js.map +1 -1
  146. package/dist/editor/ai/terminal/useAgentTerminalChrome.d.ts +1 -3
  147. package/dist/editor/ai/terminal/useAgentTerminalChrome.js +2 -2
  148. package/dist/editor/ai/terminal/useAgentTerminalChrome.js.map +1 -1
  149. package/dist/editor/ai/terminal/useAgentTerminalController.js +18 -22
  150. package/dist/editor/ai/terminal/useAgentTerminalController.js.map +1 -1
  151. package/dist/editor/ai/terminal/useAgentTerminalViewProps.d.ts +1 -1
  152. package/dist/editor/ai/terminal/useAgentTerminalViewProps.js +2 -2
  153. package/dist/editor/ai/terminal/useAgentTerminalViewProps.js.map +1 -1
  154. package/dist/editor/ai/terminal/useAgentTerminalViewState.d.ts +0 -6
  155. package/dist/editor/ai/terminal/useAgentTerminalViewState.js +2 -16
  156. package/dist/editor/ai/terminal/useAgentTerminalViewState.js.map +1 -1
  157. package/dist/editor/ai/useActiveAgentConversation.d.ts +2 -0
  158. package/dist/editor/ai/useActiveAgentConversation.js +20 -0
  159. package/dist/editor/ai/useActiveAgentConversation.js.map +1 -1
  160. package/dist/editor/bridge/protocol.d.ts +48 -0
  161. package/dist/editor/bridge/protocol.js +13 -1
  162. package/dist/editor/bridge/protocol.js.map +1 -1
  163. package/dist/editor/client/EditorShell.d.ts +2 -0
  164. package/dist/editor/client/EditorShell.js +129 -29
  165. package/dist/editor/client/EditorShell.js.map +1 -1
  166. package/dist/editor/client/editContext.d.ts +30 -4
  167. package/dist/editor/client/editContext.js.map +1 -1
  168. package/dist/editor/client/hooks/useReducedMotion.d.ts +8 -0
  169. package/dist/editor/client/hooks/useReducedMotion.js +12 -0
  170. package/dist/editor/client/hooks/useReducedMotion.js.map +1 -0
  171. package/dist/editor/client/manualShowMeFocus.d.ts +17 -0
  172. package/dist/editor/client/manualShowMeFocus.js +32 -0
  173. package/dist/editor/client/manualShowMeFocus.js.map +1 -0
  174. package/dist/editor/client/ui/FullscreenControls.js +5 -5
  175. package/dist/editor/client/ui/FullscreenControls.js.map +1 -1
  176. package/dist/editor/commands/componentCommands.js +30 -1
  177. package/dist/editor/commands/componentCommands.js.map +1 -1
  178. package/dist/editor/commands/keyboardCommands.d.ts +6 -0
  179. package/dist/editor/commands/keyboardCommands.js +74 -0
  180. package/dist/editor/commands/keyboardCommands.js.map +1 -1
  181. package/dist/editor/commands/reorderComponent.d.ts +20 -0
  182. package/dist/editor/commands/reorderComponent.js +40 -0
  183. package/dist/editor/commands/reorderComponent.js.map +1 -0
  184. package/dist/editor/commands/undo.js +3 -3
  185. package/dist/editor/commands/undo.js.map +1 -1
  186. package/dist/editor/componentFrameColors.d.ts +11 -0
  187. package/dist/editor/componentFrameColors.js +47 -0
  188. package/dist/editor/componentFrameColors.js.map +1 -0
  189. package/dist/editor/field-types/RichTextEditor.js +25 -6
  190. package/dist/editor/field-types/RichTextEditor.js.map +1 -1
  191. package/dist/editor/field-types/RichTextEditorComponent.js +14 -1
  192. package/dist/editor/field-types/RichTextEditorComponent.js.map +1 -1
  193. package/dist/editor/field-types/richtext/hooks/useRichTextProfile.d.ts +4 -1
  194. package/dist/editor/field-types/richtext/hooks/useRichTextProfile.js +33 -5
  195. package/dist/editor/field-types/richtext/hooks/useRichTextProfile.js.map +1 -1
  196. package/dist/editor/insertMenuItems.d.ts +11 -0
  197. package/dist/editor/insertMenuItems.js +9 -0
  198. package/dist/editor/insertMenuItems.js.map +1 -1
  199. package/dist/editor/menubar/ActiveUsers.js +3 -3
  200. package/dist/editor/menubar/ActiveUsers.js.map +1 -1
  201. package/dist/editor/menubar/FavoritesControls.js +46 -27
  202. package/dist/editor/menubar/FavoritesControls.js.map +1 -1
  203. package/dist/editor/menubar/GenericToolbar.js +2 -1
  204. package/dist/editor/menubar/GenericToolbar.js.map +1 -1
  205. package/dist/editor/menubar/ItemLanguageVersion.js +7 -5
  206. package/dist/editor/menubar/ItemLanguageVersion.js.map +1 -1
  207. package/dist/editor/menubar/PageSelector.js +1 -1
  208. package/dist/editor/menubar/PageSelector.js.map +1 -1
  209. package/dist/editor/menubar/PreviewDatePicker.js +40 -21
  210. package/dist/editor/menubar/PreviewDatePicker.js.map +1 -1
  211. package/dist/editor/menubar/Separator.d.ts +2 -1
  212. package/dist/editor/menubar/Separator.js +2 -2
  213. package/dist/editor/menubar/Separator.js.map +1 -1
  214. package/dist/editor/menubar/ToolbarFactory.js +24 -17
  215. package/dist/editor/menubar/ToolbarFactory.js.map +1 -1
  216. package/dist/editor/menubar/VersionSelector.d.ts +2 -1
  217. package/dist/editor/menubar/VersionSelector.js +3 -3
  218. package/dist/editor/menubar/VersionSelector.js.map +1 -1
  219. package/dist/editor/menubar/WorkflowButton.js +17 -25
  220. package/dist/editor/menubar/WorkflowButton.js.map +1 -1
  221. package/dist/editor/menubar/toolbar-sections/ContentTreeToggle.d.ts +1 -0
  222. package/dist/editor/menubar/toolbar-sections/ContentTreeToggle.js +13 -0
  223. package/dist/editor/menubar/toolbar-sections/ContentTreeToggle.js.map +1 -0
  224. package/dist/editor/menubar/toolbar-sections/CustomCommandsToolbar.js +1 -1
  225. package/dist/editor/menubar/toolbar-sections/CustomCommandsToolbar.js.map +1 -1
  226. package/dist/editor/menubar/toolbar-sections/DeviceSwitchToolbar.js +104 -9
  227. package/dist/editor/menubar/toolbar-sections/DeviceSwitchToolbar.js.map +1 -1
  228. package/dist/editor/menubar/toolbar-sections/EditControls.d.ts +4 -2
  229. package/dist/editor/menubar/toolbar-sections/EditControls.js +78 -11
  230. package/dist/editor/menubar/toolbar-sections/EditControls.js.map +1 -1
  231. package/dist/editor/menubar/toolbar-sections/FullscreenControl.d.ts +1 -0
  232. package/dist/editor/menubar/toolbar-sections/FullscreenControl.js +15 -0
  233. package/dist/editor/menubar/toolbar-sections/FullscreenControl.js.map +1 -0
  234. package/dist/editor/menubar/toolbar-sections/InsertControls.js +1 -1
  235. package/dist/editor/menubar/toolbar-sections/InsertControls.js.map +1 -1
  236. package/dist/editor/menubar/toolbar-sections/ManualBrowser.d.ts +12 -0
  237. package/dist/editor/menubar/toolbar-sections/ManualBrowser.js +169 -26
  238. package/dist/editor/menubar/toolbar-sections/ManualBrowser.js.map +1 -1
  239. package/dist/editor/menubar/toolbar-sections/ReviewCommands.js +2 -1
  240. package/dist/editor/menubar/toolbar-sections/ReviewCommands.js.map +1 -1
  241. package/dist/editor/menubar/toolbar-sections/UtilityControls.d.ts +3 -1
  242. package/dist/editor/menubar/toolbar-sections/UtilityControls.js +11 -3
  243. package/dist/editor/menubar/toolbar-sections/UtilityControls.js.map +1 -1
  244. package/dist/editor/menubar/toolbar-sections/ViewportControls.d.ts +1 -0
  245. package/dist/editor/menubar/toolbar-sections/ViewportControls.js +48 -29
  246. package/dist/editor/menubar/toolbar-sections/ViewportControls.js.map +1 -1
  247. package/dist/editor/menubar/toolbar-sections/index.d.ts +2 -1
  248. package/dist/editor/menubar/toolbar-sections/index.js +2 -1
  249. package/dist/editor/menubar/toolbar-sections/index.js.map +1 -1
  250. package/dist/editor/notifications/NotificationCenter.d.ts +4 -1
  251. package/dist/editor/notifications/NotificationCenter.js +13 -4
  252. package/dist/editor/notifications/NotificationCenter.js.map +1 -1
  253. package/dist/editor/notifications/WatchButton.d.ts +4 -2
  254. package/dist/editor/notifications/WatchButton.js +78 -20
  255. package/dist/editor/notifications/WatchButton.js.map +1 -1
  256. package/dist/editor/page-editor-chrome/BridgeInlineFormatOverlay.js +71 -6
  257. package/dist/editor/page-editor-chrome/BridgeInlineFormatOverlay.js.map +1 -1
  258. package/dist/editor/page-editor-chrome/CommentHighlightings.js +36 -40
  259. package/dist/editor/page-editor-chrome/CommentHighlightings.js.map +1 -1
  260. package/dist/editor/page-editor-chrome/DragInsertionOverlay.d.ts +36 -0
  261. package/dist/editor/page-editor-chrome/DragInsertionOverlay.js +879 -0
  262. package/dist/editor/page-editor-chrome/DragInsertionOverlay.js.map +1 -0
  263. package/dist/editor/page-editor-chrome/FeedbackHighlightBadge.d.ts +1 -0
  264. package/dist/editor/page-editor-chrome/FeedbackHighlightBadge.js +3 -3
  265. package/dist/editor/page-editor-chrome/FeedbackHighlightBadge.js.map +1 -1
  266. package/dist/editor/page-editor-chrome/FrameMenu.d.ts +3 -2
  267. package/dist/editor/page-editor-chrome/FrameMenu.js +49 -119
  268. package/dist/editor/page-editor-chrome/FrameMenu.js.map +1 -1
  269. package/dist/editor/page-editor-chrome/FrameMenus.d.ts +1 -1
  270. package/dist/editor/page-editor-chrome/FrameMenus.js +65 -15
  271. package/dist/editor/page-editor-chrome/FrameMenus.js.map +1 -1
  272. package/dist/editor/page-editor-chrome/InsertComponentMenu.d.ts +25 -0
  273. package/dist/editor/page-editor-chrome/InsertComponentMenu.js +30 -0
  274. package/dist/editor/page-editor-chrome/InsertComponentMenu.js.map +1 -0
  275. package/dist/editor/page-editor-chrome/PageEditorChrome.js +14 -2
  276. package/dist/editor/page-editor-chrome/PageEditorChrome.js.map +1 -1
  277. package/dist/editor/page-editor-chrome/PlaceholderDropZone.d.ts +33 -2
  278. package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +94 -71
  279. package/dist/editor/page-editor-chrome/PlaceholderDropZone.js.map +1 -1
  280. package/dist/editor/page-editor-chrome/PlaceholderDropZones.d.ts +13 -2
  281. package/dist/editor/page-editor-chrome/PlaceholderDropZones.js +105 -203
  282. package/dist/editor/page-editor-chrome/PlaceholderDropZones.js.map +1 -1
  283. package/dist/editor/page-editor-chrome/SuggestionHighlightings.js +51 -88
  284. package/dist/editor/page-editor-chrome/SuggestionHighlightings.js.map +1 -1
  285. package/dist/editor/page-editor-chrome/bridgeInlineFormatToolbarLayout.js +2 -1
  286. package/dist/editor/page-editor-chrome/bridgeInlineFormatToolbarLayout.js.map +1 -1
  287. package/dist/editor/page-editor-chrome/componentDragObject.d.ts +10 -0
  288. package/dist/editor/page-editor-chrome/componentDragObject.js +22 -0
  289. package/dist/editor/page-editor-chrome/componentDragObject.js.map +1 -0
  290. package/dist/editor/page-editor-chrome/overlay/IframeOverlayProvider.d.ts +32 -0
  291. package/dist/editor/page-editor-chrome/overlay/IframeOverlayProvider.js +8 -0
  292. package/dist/editor/page-editor-chrome/overlay/IframeOverlayProvider.js.map +1 -1
  293. package/dist/editor/page-editor-chrome/overlay/InsertionLine.d.ts +44 -0
  294. package/dist/editor/page-editor-chrome/overlay/InsertionLine.js +160 -0
  295. package/dist/editor/page-editor-chrome/overlay/InsertionLine.js.map +1 -0
  296. package/dist/editor/page-editor-chrome/overlay/geometry.d.ts +39 -0
  297. package/dist/editor/page-editor-chrome/overlay/geometry.js +67 -10
  298. package/dist/editor/page-editor-chrome/overlay/geometry.js.map +1 -1
  299. package/dist/editor/page-editor-chrome/overlay/placeholderZones.d.ts +66 -0
  300. package/dist/editor/page-editor-chrome/overlay/placeholderZones.js +274 -0
  301. package/dist/editor/page-editor-chrome/overlay/placeholderZones.js.map +1 -0
  302. package/dist/editor/page-editor-chrome/useComponentDragHandle.d.ts +23 -0
  303. package/dist/editor/page-editor-chrome/useComponentDragHandle.js +41 -0
  304. package/dist/editor/page-editor-chrome/useComponentDragHandle.js.map +1 -0
  305. package/dist/editor/page-editor-chrome/useDragInsertionGesture.d.ts +23 -0
  306. package/dist/editor/page-editor-chrome/useDragInsertionGesture.js +207 -0
  307. package/dist/editor/page-editor-chrome/useDragInsertionGesture.js.map +1 -0
  308. package/dist/editor/page-editor-chrome/usePinnedHoveredComponentId.d.ts +2 -0
  309. package/dist/editor/page-editor-chrome/usePinnedHoveredComponentId.js +18 -0
  310. package/dist/editor/page-editor-chrome/usePinnedHoveredComponentId.js.map +1 -0
  311. package/dist/editor/page-viewer/EditorForm.js +14 -12
  312. package/dist/editor/page-viewer/EditorForm.js.map +1 -1
  313. package/dist/editor/page-viewer/EditorFormHintPopover.d.ts +2 -2
  314. package/dist/editor/page-viewer/EditorFormHintPopover.js +4 -4
  315. package/dist/editor/page-viewer/EditorFormHintPopover.js.map +1 -1
  316. package/dist/editor/page-viewer/MiniMap.d.ts +6 -0
  317. package/dist/editor/page-viewer/MiniMap.js +97 -12
  318. package/dist/editor/page-viewer/MiniMap.js.map +1 -1
  319. package/dist/editor/page-viewer/MinimapDropTargets.d.ts +13 -0
  320. package/dist/editor/page-viewer/MinimapDropTargets.js +140 -0
  321. package/dist/editor/page-viewer/MinimapDropTargets.js.map +1 -0
  322. package/dist/editor/page-viewer/PageViewer.js +96 -10
  323. package/dist/editor/page-viewer/PageViewer.js.map +1 -1
  324. package/dist/editor/page-viewer/PageViewerFrame.js +263 -6
  325. package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
  326. package/dist/editor/page-viewer/pageViewContext.d.ts +4 -1
  327. package/dist/editor/page-viewer/pageViewContext.js.map +1 -1
  328. package/dist/editor/reviews/Comment.js +2 -0
  329. package/dist/editor/reviews/Comment.js.map +1 -1
  330. package/dist/editor/reviews/CommentDisplayPopover.js +5 -2
  331. package/dist/editor/reviews/CommentDisplayPopover.js.map +1 -1
  332. package/dist/editor/reviews/CommentPopover.d.ts +4 -0
  333. package/dist/editor/reviews/CommentPopover.js +15 -1
  334. package/dist/editor/reviews/CommentPopover.js.map +1 -1
  335. package/dist/editor/reviews/Comments.js +61 -44
  336. package/dist/editor/reviews/Comments.js.map +1 -1
  337. package/dist/editor/reviews/DecisionsMatrix.js +3 -3
  338. package/dist/editor/reviews/DecisionsMatrix.js.map +1 -1
  339. package/dist/editor/reviews/FeedbackModeIntro.d.ts +15 -0
  340. package/dist/editor/reviews/FeedbackModeIntro.js +22 -0
  341. package/dist/editor/reviews/FeedbackModeIntro.js.map +1 -0
  342. package/dist/editor/reviews/LatestFeedback.js +8 -2
  343. package/dist/editor/reviews/LatestFeedback.js.map +1 -1
  344. package/dist/editor/reviews/ReviewersPanel.js +2 -1
  345. package/dist/editor/reviews/ReviewersPanel.js.map +1 -1
  346. package/dist/editor/reviews/SuggestedEdit.js +9 -7
  347. package/dist/editor/reviews/SuggestedEdit.js.map +1 -1
  348. package/dist/editor/reviews/SuggestionDisplayPopover.js +3 -3
  349. package/dist/editor/reviews/SuggestionDisplayPopover.js.map +1 -1
  350. package/dist/editor/reviews/feedbackScrollTarget.d.ts +19 -0
  351. package/dist/editor/reviews/feedbackScrollTarget.js +171 -0
  352. package/dist/editor/reviews/feedbackScrollTarget.js.map +1 -0
  353. package/dist/editor/reviews/feedbackSelection.js +4 -4
  354. package/dist/editor/reviews/feedbackSelection.js.map +1 -1
  355. package/dist/editor/reviews/latestFeedbackData.js +1 -1
  356. package/dist/editor/reviews/openCommentsFeedback.d.ts +35 -0
  357. package/dist/editor/reviews/openCommentsFeedback.js +89 -0
  358. package/dist/editor/reviews/openCommentsFeedback.js.map +1 -0
  359. package/dist/editor/services/agentService.d.ts +5 -0
  360. package/dist/editor/services/agentService.js.map +1 -1
  361. package/dist/editor/services/aiService.d.ts +0 -2
  362. package/dist/editor/services/aiService.js.map +1 -1
  363. package/dist/editor/services/editService.d.ts +1 -0
  364. package/dist/editor/services/editService.js +4 -0
  365. package/dist/editor/services/editService.js.map +1 -1
  366. package/dist/editor/settings/IndexOverview.js +2 -2
  367. package/dist/editor/settings/IndexOverview.js.map +1 -1
  368. package/dist/editor/settings/QuotaInfo.js +2 -2
  369. package/dist/editor/settings/QuotaInfo.js.map +1 -1
  370. package/dist/editor/settings/SettingsBreadcrumb.js +8 -2
  371. package/dist/editor/settings/SettingsBreadcrumb.js.map +1 -1
  372. package/dist/editor/settings/SettingsPanelLayout.js +1 -1
  373. package/dist/editor/settings/SettingsPanelLayout.js.map +1 -1
  374. package/dist/editor/settings/SettingsView.js +7 -9
  375. package/dist/editor/settings/SettingsView.js.map +1 -1
  376. package/dist/editor/settings/StatusSummary.js +7 -17
  377. package/dist/editor/settings/StatusSummary.js.map +1 -1
  378. package/dist/editor/settings/panels/AgentToolsPanel.js +2 -1
  379. package/dist/editor/settings/panels/AgentToolsPanel.js.map +1 -1
  380. package/dist/editor/settings/panels/ClusterInstancesPanel.js +2 -1
  381. package/dist/editor/settings/panels/ClusterInstancesPanel.js.map +1 -1
  382. package/dist/editor/settings/panels/FieldTypeSerializersPanel.js +2 -1
  383. package/dist/editor/settings/panels/FieldTypeSerializersPanel.js.map +1 -1
  384. package/dist/editor/settings/panels/GroupedFieldConfigPanel.js +3 -2
  385. package/dist/editor/settings/panels/GroupedFieldConfigPanel.js.map +1 -1
  386. package/dist/editor/settings/panels/ItemConfigPanel.js +3 -2
  387. package/dist/editor/settings/panels/ItemConfigPanel.js.map +1 -1
  388. package/dist/editor/settings/panels/JavaScriptToolAgentPanel.js +2 -1
  389. package/dist/editor/settings/panels/JavaScriptToolAgentPanel.js.map +1 -1
  390. package/dist/editor/settings/panels/NotificationSubscriptionsPanel.js +2 -1
  391. package/dist/editor/settings/panels/NotificationSubscriptionsPanel.js.map +1 -1
  392. package/dist/editor/settings/panels/PersistentLogsPanel.js +3 -2
  393. package/dist/editor/settings/panels/PersistentLogsPanel.js.map +1 -1
  394. package/dist/editor/settings/panels/ProjectTemplateAgentPanel.js +2 -1
  395. package/dist/editor/settings/panels/ProjectTemplateAgentPanel.js.map +1 -1
  396. package/dist/editor/settings/panels/ProjectTemplateSelectorList.js +3 -2
  397. package/dist/editor/settings/panels/ProjectTemplateSelectorList.js.map +1 -1
  398. package/dist/editor/settings/panels/ProjectTemplatesPanel.js +3 -3
  399. package/dist/editor/settings/panels/ProjectTemplatesPanel.js.map +1 -1
  400. package/dist/editor/settings/panels/SearchConfigPanel.js +3 -2
  401. package/dist/editor/settings/panels/SearchConfigPanel.js.map +1 -1
  402. package/dist/editor/settings/panels/StatusPanel.js +3 -2
  403. package/dist/editor/settings/panels/StatusPanel.js.map +1 -1
  404. package/dist/editor/sidebar/ComponentPalette.d.ts +1 -1
  405. package/dist/editor/sidebar/ComponentPalette.js +58 -25
  406. package/dist/editor/sidebar/ComponentPalette.js.map +1 -1
  407. package/dist/editor/sidebar/ComponentTree.js +91 -7
  408. package/dist/editor/sidebar/ComponentTree.js.map +1 -1
  409. package/dist/editor/sidebar/ContentTreePanel.d.ts +3 -0
  410. package/dist/editor/sidebar/ContentTreePanel.js +14 -0
  411. package/dist/editor/sidebar/ContentTreePanel.js.map +1 -0
  412. package/dist/editor/sidebar/Favorites.js +2 -2
  413. package/dist/editor/sidebar/Favorites.js.map +1 -1
  414. package/dist/editor/sidebar/NavigationPanelItem.js +2 -1
  415. package/dist/editor/sidebar/NavigationPanelItem.js.map +1 -1
  416. package/dist/editor/sidebar/OperationItem.js +98 -17
  417. package/dist/editor/sidebar/OperationItem.js.map +1 -1
  418. package/dist/editor/sidebar/Workbox.js +14 -133
  419. package/dist/editor/sidebar/Workbox.js.map +1 -1
  420. package/dist/editor/sidebar/WorkspaceButton.js +1 -1
  421. package/dist/editor/sidebar/WorkspaceButton.js.map +1 -1
  422. package/dist/editor/sidebar/WorkspaceRail.js +12 -9
  423. package/dist/editor/sidebar/WorkspaceRail.js.map +1 -1
  424. package/dist/editor/sidebar/contentTreeConstants.d.ts +2 -0
  425. package/dist/editor/sidebar/contentTreeConstants.js +3 -0
  426. package/dist/editor/sidebar/contentTreeConstants.js.map +1 -0
  427. package/dist/editor/tree-indicators/GutterColumns.js +4 -14
  428. package/dist/editor/tree-indicators/GutterColumns.js.map +1 -1
  429. package/dist/editor/ui/ItemCollectionEditor.js +3 -2
  430. package/dist/editor/ui/ItemCollectionEditor.js.map +1 -1
  431. package/dist/editor/ui/LoadingState.d.ts +11 -0
  432. package/dist/editor/ui/LoadingState.js +27 -0
  433. package/dist/editor/ui/LoadingState.js.map +1 -0
  434. package/dist/editor/ui/PerfectTree.d.ts +22 -1
  435. package/dist/editor/ui/PerfectTree.js +17 -11
  436. package/dist/editor/ui/PerfectTree.js.map +1 -1
  437. package/dist/editor/ui/PublishDialog.d.ts +11 -0
  438. package/dist/editor/ui/PublishDialog.js +101 -0
  439. package/dist/editor/ui/PublishDialog.js.map +1 -0
  440. package/dist/editor/ui/PublishItemDialog.js +2 -1
  441. package/dist/editor/ui/PublishItemDialog.js.map +1 -1
  442. package/dist/editor/ui/PublishRestrictionsDialog.js +3 -2
  443. package/dist/editor/ui/PublishRestrictionsDialog.js.map +1 -1
  444. package/dist/editor/ui/SimpleIconButton.d.ts +6 -0
  445. package/dist/editor/ui/SimpleIconButton.js +13 -4
  446. package/dist/editor/ui/SimpleIconButton.js.map +1 -1
  447. package/dist/editor/ui/SimpleMenu.js +4 -4
  448. package/dist/editor/ui/SimpleMenu.js.map +1 -1
  449. package/dist/editor/ui/SimpleTabs.js +1 -1
  450. package/dist/editor/ui/Spinner.d.ts +14 -1
  451. package/dist/editor/ui/Spinner.js.map +1 -1
  452. package/dist/editor/ui/WorkboxItemsTable.d.ts +15 -0
  453. package/dist/editor/ui/WorkboxItemsTable.js +142 -0
  454. package/dist/editor/ui/WorkboxItemsTable.js.map +1 -0
  455. package/dist/index.d.ts +4 -0
  456. package/dist/index.js +2 -0
  457. package/dist/index.js.map +1 -1
  458. package/dist/lib/pointerDrag.d.ts +20 -0
  459. package/dist/lib/pointerDrag.js +57 -0
  460. package/dist/lib/pointerDrag.js.map +1 -0
  461. package/dist/logging/consolePrefix.d.ts +2 -0
  462. package/dist/logging/consolePrefix.js +49 -0
  463. package/dist/logging/consolePrefix.js.map +1 -0
  464. package/dist/logging/index.d.ts +1 -0
  465. package/dist/logging/index.js +2 -0
  466. package/dist/logging/index.js.map +1 -0
  467. package/dist/logging/install-browser-console.d.ts +1 -0
  468. package/dist/logging/install-browser-console.js +3 -0
  469. package/dist/logging/install-browser-console.js.map +1 -0
  470. package/dist/revision.d.ts +2 -2
  471. package/dist/revision.js +2 -2
  472. package/dist/splash-screen/ModernSplashScreen.js +2 -1
  473. package/dist/splash-screen/ModernSplashScreen.js.map +1 -1
  474. package/dist/task-board/TaskBoardWorkspace.js +181 -35
  475. package/dist/task-board/TaskBoardWorkspace.js.map +1 -1
  476. package/dist/task-board/components/CommentsList.js +20 -9
  477. package/dist/task-board/components/CommentsList.js.map +1 -1
  478. package/dist/task-board/components/FinishedProjectCard.d.ts +5 -0
  479. package/dist/task-board/components/FinishedProjectCard.js +8 -0
  480. package/dist/task-board/components/FinishedProjectCard.js.map +1 -0
  481. package/dist/task-board/components/ProjectDashboard.d.ts +10 -1
  482. package/dist/task-board/components/ProjectDashboard.js +90 -6
  483. package/dist/task-board/components/ProjectDashboard.js.map +1 -1
  484. package/dist/task-board/components/ProjectListContent.js +2 -1
  485. package/dist/task-board/components/ProjectListContent.js.map +1 -1
  486. package/dist/task-board/components/ProjectOverviewContent.js +2 -1
  487. package/dist/task-board/components/ProjectOverviewContent.js.map +1 -1
  488. package/dist/task-board/components/TaskAgentPanel.d.ts +4 -0
  489. package/dist/task-board/components/TaskAgentPanel.js +12 -6
  490. package/dist/task-board/components/TaskAgentPanel.js.map +1 -1
  491. package/dist/task-board/components/TaskAssigneeBadge.d.ts +16 -0
  492. package/dist/task-board/components/TaskAssigneeBadge.js +21 -0
  493. package/dist/task-board/components/TaskAssigneeBadge.js.map +1 -0
  494. package/dist/task-board/components/TaskAssigneePicker.js +12 -10
  495. package/dist/task-board/components/TaskAssigneePicker.js.map +1 -1
  496. package/dist/task-board/components/TaskAttachmentDropZone.d.ts +11 -0
  497. package/dist/task-board/components/TaskAttachmentDropZone.js +100 -0
  498. package/dist/task-board/components/TaskAttachmentDropZone.js.map +1 -0
  499. package/dist/task-board/components/TaskAttachmentsSection.d.ts +1 -0
  500. package/dist/task-board/components/TaskAttachmentsSection.js +15 -41
  501. package/dist/task-board/components/TaskAttachmentsSection.js.map +1 -1
  502. package/dist/task-board/components/TaskBoardFilterBox.d.ts +4 -0
  503. package/dist/task-board/components/TaskBoardFilterBox.js +7 -0
  504. package/dist/task-board/components/TaskBoardFilterBox.js.map +1 -0
  505. package/dist/task-board/components/TaskBoardProjectListSidebar.js +4 -5
  506. package/dist/task-board/components/TaskBoardProjectListSidebar.js.map +1 -1
  507. package/dist/task-board/components/TaskCard.js +26 -15
  508. package/dist/task-board/components/TaskCard.js.map +1 -1
  509. package/dist/task-board/components/TaskDetailPanel.d.ts +1 -0
  510. package/dist/task-board/components/TaskDetailPanel.js +15 -12
  511. package/dist/task-board/components/TaskDetailPanel.js.map +1 -1
  512. package/dist/task-board/components/TaskReviewActions.d.ts +1 -0
  513. package/dist/task-board/components/TaskReviewActions.js +4 -2
  514. package/dist/task-board/components/TaskReviewActions.js.map +1 -1
  515. package/dist/task-board/components/TaskRow.js +6 -12
  516. package/dist/task-board/components/TaskRow.js.map +1 -1
  517. package/dist/task-board/components/TaskboardPersistentLogPanel.js +3 -3
  518. package/dist/task-board/components/TaskboardPersistentLogPanel.js.map +1 -1
  519. package/dist/task-board/components/WizardCommunicationCards.js +1 -1
  520. package/dist/task-board/components/WizardCommunicationCards.js.map +1 -1
  521. package/dist/task-board/components/WizardCommunicationCenter.d.ts +7 -1
  522. package/dist/task-board/components/WizardCommunicationCenter.js +10 -6
  523. package/dist/task-board/components/WizardCommunicationCenter.js.map +1 -1
  524. package/dist/task-board/components/WizardCommunicationShared.js +5 -5
  525. package/dist/task-board/components/WizardCommunicationShared.js.map +1 -1
  526. package/dist/task-board/components/WizardTask.d.ts +5 -1
  527. package/dist/task-board/components/WizardTask.js +14 -30
  528. package/dist/task-board/components/WizardTask.js.map +1 -1
  529. package/dist/task-board/components/WizardTaskDetailsPanel.d.ts +10 -2
  530. package/dist/task-board/components/WizardTaskDetailsPanel.js +56 -11
  531. package/dist/task-board/components/WizardTaskDetailsPanel.js.map +1 -1
  532. package/dist/task-board/taskBoardNavStore.d.ts +3 -0
  533. package/dist/task-board/taskBoardNavStore.js +44 -0
  534. package/dist/task-board/taskBoardNavStore.js.map +1 -1
  535. package/dist/task-board/taskPriority.d.ts +4 -0
  536. package/dist/task-board/taskPriority.js +19 -0
  537. package/dist/task-board/taskPriority.js.map +1 -0
  538. package/dist/task-board/views/DependencyGraphView.js +48 -36
  539. package/dist/task-board/views/DependencyGraphView.js.map +1 -1
  540. package/dist/task-board/views/KanbanView.js +130 -96
  541. package/dist/task-board/views/KanbanView.js.map +1 -1
  542. package/dist/task-board/views/ListView.js +3 -3
  543. package/dist/task-board/views/ListView.js.map +1 -1
  544. package/dist/task-board/views/WizardView.js +7 -6
  545. package/dist/task-board/views/WizardView.js.map +1 -1
  546. package/dist/tour/default-tour.js +5 -5
  547. package/dist/tour/default-tour.js.map +1 -1
  548. package/package.json +11 -1
  549. package/styles.css +144 -0
  550. package/dist/editor/ai/terminal/useAgentEditorContextSync.d.ts +0 -19
  551. package/dist/editor/ai/terminal/useAgentEditorContextSync.js +0 -142
  552. 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