@parhelia/core 0.1.10745
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +8 -0
- package/README.md +34 -0
- package/dev.css +3 -0
- package/dist/agents-view/AgentCard.d.ts +12 -0
- package/dist/agents-view/AgentCard.js +30 -0
- package/dist/agents-view/AgentCard.js.map +1 -0
- package/dist/agents-view/AgentsView.d.ts +5 -0
- package/dist/agents-view/AgentsView.js +255 -0
- package/dist/agents-view/AgentsView.js.map +1 -0
- package/dist/agents-view/ProfileAgentsGroup.d.ts +17 -0
- package/dist/agents-view/ProfileAgentsGroup.js +13 -0
- package/dist/agents-view/ProfileAgentsGroup.js.map +1 -0
- package/dist/client-components/api.d.ts +1 -0
- package/dist/client-components/api.js +4 -0
- package/dist/client-components/api.js.map +1 -0
- package/dist/client-components/index.d.ts +17 -0
- package/dist/client-components/index.js +18 -0
- package/dist/client-components/index.js.map +1 -0
- package/dist/components/ActionButton.d.ts +14 -0
- package/dist/components/ActionButton.js +6 -0
- package/dist/components/ActionButton.js.map +1 -0
- package/dist/components/Error.d.ts +9 -0
- package/dist/components/Error.js +24 -0
- package/dist/components/Error.js.map +1 -0
- package/dist/components/FilterInput.d.ts +22 -0
- package/dist/components/FilterInput.js +29 -0
- package/dist/components/FilterInput.js.map +1 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/components/index.js +5 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/ui/CardConnector.d.ts +4 -0
- package/dist/components/ui/CardConnector.js +6 -0
- package/dist/components/ui/CardConnector.js.map +1 -0
- package/dist/components/ui/LanguageSelector.d.ts +8 -0
- package/dist/components/ui/LanguageSelector.js +47 -0
- package/dist/components/ui/LanguageSelector.js.map +1 -0
- package/dist/components/ui/PlaceholderInput.d.ts +41 -0
- package/dist/components/ui/PlaceholderInput.js +160 -0
- package/dist/components/ui/PlaceholderInput.js.map +1 -0
- package/dist/components/ui/PlaceholderInputTypes.d.ts +41 -0
- package/dist/components/ui/PlaceholderInputTypes.js +48 -0
- package/dist/components/ui/PlaceholderInputTypes.js.map +1 -0
- package/dist/components/ui/PlaceholderItemSelector.d.ts +7 -0
- package/dist/components/ui/PlaceholderItemSelector.js +154 -0
- package/dist/components/ui/PlaceholderItemSelector.js.map +1 -0
- package/dist/components/ui/alert.d.ts +7 -0
- package/dist/components/ui/alert.js +21 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/badge.js +23 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/button.js +33 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/calendar.d.ts +7 -0
- package/dist/components/ui/calendar.js +58 -0
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/card.d.ts +19 -0
- package/dist/components/ui/card.js +78 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/checkbox.js +10 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/command.d.ts +18 -0
- package/dist/components/ui/command.js +35 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/context-menu.d.ts +53 -0
- package/dist/components/ui/context-menu.js +290 -0
- package/dist/components/ui/context-menu.js.map +1 -0
- package/dist/components/ui/copy-button.d.ts +10 -0
- package/dist/components/ui/copy-button.js +61 -0
- package/dist/components/ui/copy-button.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +16 -0
- package/dist/components/ui/dialog.js +37 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/components/ui/dropdown-menu.js +52 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/input.js +9 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/menubar.d.ts +26 -0
- package/dist/components/ui/menubar.js +55 -0
- package/dist/components/ui/menubar.js.map +1 -0
- package/dist/components/ui/paste-button.d.ts +14 -0
- package/dist/components/ui/paste-button.js +114 -0
- package/dist/components/ui/paste-button.js.map +1 -0
- package/dist/components/ui/popover.d.ts +11 -0
- package/dist/components/ui/popover.js +66 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/progress.d.ts +7 -0
- package/dist/components/ui/progress.js +9 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/select.d.ts +18 -0
- package/dist/components/ui/select.js +34 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/sonner.d.ts +3 -0
- package/dist/components/ui/sonner.js +16 -0
- package/dist/components/ui/sonner.js.map +1 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/switch.js +9 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +17 -0
- package/dist/components/ui/tabs.js +27 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/textarea.js +11 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +9 -0
- package/dist/components/ui/tooltip.js +18 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components/ui/upload-button.d.ts +15 -0
- package/dist/components/ui/upload-button.js +56 -0
- package/dist/components/ui/upload-button.js.map +1 -0
- package/dist/config/config.d.ts +24 -0
- package/dist/config/config.js +1087 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/types.d.ts +249 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/editor/AspectRatioSelector.d.ts +13 -0
- package/dist/editor/AspectRatioSelector.js +71 -0
- package/dist/editor/AspectRatioSelector.js.map +1 -0
- package/dist/editor/ComponentInfo.d.ts +4 -0
- package/dist/editor/ComponentInfo.js +41 -0
- package/dist/editor/ComponentInfo.js.map +1 -0
- package/dist/editor/ConfirmationDialog.d.ts +19 -0
- package/dist/editor/ConfirmationDialog.js +31 -0
- package/dist/editor/ConfirmationDialog.js.map +1 -0
- package/dist/editor/ContentTree.d.ts +39 -0
- package/dist/editor/ContentTree.js +586 -0
- package/dist/editor/ContentTree.js.map +1 -0
- package/dist/editor/ContextMenu.d.ts +15 -0
- package/dist/editor/ContextMenu.js +239 -0
- package/dist/editor/ContextMenu.js.map +1 -0
- package/dist/editor/Editor.d.ts +12 -0
- package/dist/editor/Editor.js +59 -0
- package/dist/editor/Editor.js.map +1 -0
- package/dist/editor/EditorWarning.d.ts +5 -0
- package/dist/editor/EditorWarning.js +12 -0
- package/dist/editor/EditorWarning.js.map +1 -0
- package/dist/editor/EditorWarnings.d.ts +9 -0
- package/dist/editor/EditorWarnings.js +19 -0
- package/dist/editor/EditorWarnings.js.map +1 -0
- package/dist/editor/FieldActionsOverlay.d.ts +18 -0
- package/dist/editor/FieldActionsOverlay.js +201 -0
- package/dist/editor/FieldActionsOverlay.js.map +1 -0
- package/dist/editor/FieldEditorPopup.d.ts +10 -0
- package/dist/editor/FieldEditorPopup.js +23 -0
- package/dist/editor/FieldEditorPopup.js.map +1 -0
- package/dist/editor/FieldHistory.d.ts +7 -0
- package/dist/editor/FieldHistory.js +42 -0
- package/dist/editor/FieldHistory.js.map +1 -0
- package/dist/editor/FieldList.d.ts +19 -0
- package/dist/editor/FieldList.js +90 -0
- package/dist/editor/FieldList.js.map +1 -0
- package/dist/editor/FieldListField.d.ts +16 -0
- package/dist/editor/FieldListField.js +231 -0
- package/dist/editor/FieldListField.js.map +1 -0
- package/dist/editor/FieldListFieldWithFallbacks.d.ts +11 -0
- package/dist/editor/FieldListFieldWithFallbacks.js +120 -0
- package/dist/editor/FieldListFieldWithFallbacks.js.map +1 -0
- package/dist/editor/FloatingToolbar.d.ts +7 -0
- package/dist/editor/FloatingToolbar.js +91 -0
- package/dist/editor/FloatingToolbar.js.map +1 -0
- package/dist/editor/ImageEditButton.d.ts +27 -0
- package/dist/editor/ImageEditButton.js +22 -0
- package/dist/editor/ImageEditButton.js.map +1 -0
- package/dist/editor/ImageEditor.d.ts +5 -0
- package/dist/editor/ImageEditor.js +76 -0
- package/dist/editor/ImageEditor.js.map +1 -0
- package/dist/editor/ItemInfo.d.ts +4 -0
- package/dist/editor/ItemInfo.js +36 -0
- package/dist/editor/ItemInfo.js.map +1 -0
- package/dist/editor/LinkEditorDialog.d.ts +18 -0
- package/dist/editor/LinkEditorDialog.js +101 -0
- package/dist/editor/LinkEditorDialog.js.map +1 -0
- package/dist/editor/MainLayout.d.ts +12 -0
- package/dist/editor/MainLayout.js +55 -0
- package/dist/editor/MainLayout.js.map +1 -0
- package/dist/editor/MobileLayout.d.ts +2 -0
- package/dist/editor/MobileLayout.js +34 -0
- package/dist/editor/MobileLayout.js.map +1 -0
- package/dist/editor/NewEditorClient.d.ts +5 -0
- package/dist/editor/NewEditorClient.js +7 -0
- package/dist/editor/NewEditorClient.js.map +1 -0
- package/dist/editor/PictureCropper.d.ts +6 -0
- package/dist/editor/PictureCropper.js +722 -0
- package/dist/editor/PictureCropper.js.map +1 -0
- package/dist/editor/PictureEditor.d.ts +9 -0
- package/dist/editor/PictureEditor.js +180 -0
- package/dist/editor/PictureEditor.js.map +1 -0
- package/dist/editor/PictureEditorDialog.d.ts +8 -0
- package/dist/editor/PictureEditorDialog.js +195 -0
- package/dist/editor/PictureEditorDialog.js.map +1 -0
- package/dist/editor/QuickItemSwitcher.d.ts +9 -0
- package/dist/editor/QuickItemSwitcher.js +78 -0
- package/dist/editor/QuickItemSwitcher.js.map +1 -0
- package/dist/editor/ScrollingContentTree.d.ts +10 -0
- package/dist/editor/ScrollingContentTree.js +54 -0
- package/dist/editor/ScrollingContentTree.js.map +1 -0
- package/dist/editor/Titlebar.d.ts +1 -0
- package/dist/editor/Titlebar.js +46 -0
- package/dist/editor/Titlebar.js.map +1 -0
- package/dist/editor/ai/AgentCostDisplay.d.ts +32 -0
- package/dist/editor/ai/AgentCostDisplay.js +93 -0
- package/dist/editor/ai/AgentCostDisplay.js.map +1 -0
- package/dist/editor/ai/AgentHistory.d.ts +11 -0
- package/dist/editor/ai/AgentHistory.js +12 -0
- package/dist/editor/ai/AgentHistory.js.map +1 -0
- package/dist/editor/ai/AgentProfilesOverview.d.ts +9 -0
- package/dist/editor/ai/AgentProfilesOverview.js +16 -0
- package/dist/editor/ai/AgentProfilesOverview.js.map +1 -0
- package/dist/editor/ai/AgentStatusBadge.d.ts +26 -0
- package/dist/editor/ai/AgentStatusBadge.js +126 -0
- package/dist/editor/ai/AgentStatusBadge.js.map +1 -0
- package/dist/editor/ai/AgentTerminal.d.ts +14 -0
- package/dist/editor/ai/AgentTerminal.js +2634 -0
- package/dist/editor/ai/AgentTerminal.js.map +1 -0
- package/dist/editor/ai/Agents.d.ts +4 -0
- package/dist/editor/ai/Agents.js +813 -0
- package/dist/editor/ai/Agents.js.map +1 -0
- package/dist/editor/ai/AiResponseMessage.d.ts +18 -0
- package/dist/editor/ai/AiResponseMessage.js +684 -0
- package/dist/editor/ai/AiResponseMessage.js.map +1 -0
- package/dist/editor/ai/ContextInfoBar.d.ts +11 -0
- package/dist/editor/ai/ContextInfoBar.js +355 -0
- package/dist/editor/ai/ContextInfoBar.js.map +1 -0
- package/dist/editor/ai/DancingDots.d.ts +1 -0
- package/dist/editor/ai/DancingDots.js +6 -0
- package/dist/editor/ai/DancingDots.js.map +1 -0
- package/dist/editor/ai/MediaImage.d.ts +6 -0
- package/dist/editor/ai/MediaImage.js +38 -0
- package/dist/editor/ai/MediaImage.js.map +1 -0
- package/dist/editor/ai/ToolCallDisplay.d.ts +45 -0
- package/dist/editor/ai/ToolCallDisplay.js +292 -0
- package/dist/editor/ai/ToolCallDisplay.js.map +1 -0
- package/dist/editor/ai/aiPageModel.d.ts +24 -0
- package/dist/editor/ai/aiPageModel.js +97 -0
- package/dist/editor/ai/aiPageModel.js.map +1 -0
- package/dist/editor/ai/editorAiContext.d.ts +10 -0
- package/dist/editor/ai/editorAiContext.js +10 -0
- package/dist/editor/ai/editorAiContext.js.map +1 -0
- package/dist/editor/ai/types.d.ts +30 -0
- package/dist/editor/ai/types.js +2 -0
- package/dist/editor/ai/types.js.map +1 -0
- package/dist/editor/ai/useAgentStatus.d.ts +14 -0
- package/dist/editor/ai/useAgentStatus.js +203 -0
- package/dist/editor/ai/useAgentStatus.js.map +1 -0
- package/dist/editor/client/AboutDialog.d.ts +2 -0
- package/dist/editor/client/AboutDialog.js +23 -0
- package/dist/editor/client/AboutDialog.js.map +1 -0
- package/dist/editor/client/EditorShell.d.ts +37 -0
- package/dist/editor/client/EditorShell.js +2388 -0
- package/dist/editor/client/EditorShell.js.map +1 -0
- package/dist/editor/client/GenericDialog.d.ts +10 -0
- package/dist/editor/client/GenericDialog.js +25 -0
- package/dist/editor/client/GenericDialog.js.map +1 -0
- package/dist/editor/client/editContext.d.ts +260 -0
- package/dist/editor/client/editContext.js +29 -0
- package/dist/editor/client/editContext.js.map +1 -0
- package/dist/editor/client/fieldModificationStore.d.ts +25 -0
- package/dist/editor/client/fieldModificationStore.js +184 -0
- package/dist/editor/client/fieldModificationStore.js.map +1 -0
- package/dist/editor/client/helpers.d.ts +12 -0
- package/dist/editor/client/helpers.js +29 -0
- package/dist/editor/client/helpers.js.map +1 -0
- package/dist/editor/client/hooks/useEditorUrlSync.d.ts +18 -0
- package/dist/editor/client/hooks/useEditorUrlSync.js +56 -0
- package/dist/editor/client/hooks/useEditorUrlSync.js.map +1 -0
- package/dist/editor/client/hooks/useEditorWebSocket.d.ts +11 -0
- package/dist/editor/client/hooks/useEditorWebSocket.js +86 -0
- package/dist/editor/client/hooks/useEditorWebSocket.js.map +1 -0
- package/dist/editor/client/hooks/useGlobalEditorKeyDown.d.ts +1 -0
- package/dist/editor/client/hooks/useGlobalEditorKeyDown.js +12 -0
- package/dist/editor/client/hooks/useGlobalEditorKeyDown.js.map +1 -0
- package/dist/editor/client/hooks/useMediaQuery.d.ts +1 -0
- package/dist/editor/client/hooks/useMediaQuery.js +19 -0
- package/dist/editor/client/hooks/useMediaQuery.js.map +1 -0
- package/dist/editor/client/hooks/useMediaSelector.d.ts +12 -0
- package/dist/editor/client/hooks/useMediaSelector.js +30 -0
- package/dist/editor/client/hooks/useMediaSelector.js.map +1 -0
- package/dist/editor/client/hooks/useQuota.d.ts +29 -0
- package/dist/editor/client/hooks/useQuota.js +53 -0
- package/dist/editor/client/hooks/useQuota.js.map +1 -0
- package/dist/editor/client/hooks/useSocketMessageHandler.d.ts +35 -0
- package/dist/editor/client/hooks/useSocketMessageHandler.js +234 -0
- package/dist/editor/client/hooks/useSocketMessageHandler.js.map +1 -0
- package/dist/editor/client/hooks/useWorkbox.d.ts +9 -0
- package/dist/editor/client/hooks/useWorkbox.js +52 -0
- package/dist/editor/client/hooks/useWorkbox.js.map +1 -0
- package/dist/editor/client/itemsRepository.d.ts +38 -0
- package/dist/editor/client/itemsRepository.js +468 -0
- package/dist/editor/client/itemsRepository.js.map +1 -0
- package/dist/editor/client/operations.d.ts +69 -0
- package/dist/editor/client/operations.js +627 -0
- package/dist/editor/client/operations.js.map +1 -0
- package/dist/editor/client/pageModelBuilder.d.ts +6 -0
- package/dist/editor/client/pageModelBuilder.js +155 -0
- package/dist/editor/client/pageModelBuilder.js.map +1 -0
- package/dist/editor/client/ui/EditorChrome.d.ts +12 -0
- package/dist/editor/client/ui/EditorChrome.js +30 -0
- package/dist/editor/client/ui/EditorChrome.js.map +1 -0
- package/dist/editor/client/ui/FullscreenControls.d.ts +7 -0
- package/dist/editor/client/ui/FullscreenControls.js +21 -0
- package/dist/editor/client/ui/FullscreenControls.js.map +1 -0
- package/dist/editor/commands/agentCommands.d.ts +9 -0
- package/dist/editor/commands/agentCommands.js +30 -0
- package/dist/editor/commands/agentCommands.js.map +1 -0
- package/dist/editor/commands/commands.d.ts +19 -0
- package/dist/editor/commands/commands.js +2 -0
- package/dist/editor/commands/commands.js.map +1 -0
- package/dist/editor/commands/componentCommands.d.ts +12 -0
- package/dist/editor/commands/componentCommands.js +378 -0
- package/dist/editor/commands/componentCommands.js.map +1 -0
- package/dist/editor/commands/createVersionCommand.d.ts +4 -0
- package/dist/editor/commands/createVersionCommand.js +24 -0
- package/dist/editor/commands/createVersionCommand.js.map +1 -0
- package/dist/editor/commands/deleteVersionCommand.d.ts +4 -0
- package/dist/editor/commands/deleteVersionCommand.js +53 -0
- package/dist/editor/commands/deleteVersionCommand.js.map +1 -0
- package/dist/editor/commands/itemCommands.d.ts +29 -0
- package/dist/editor/commands/itemCommands.js +428 -0
- package/dist/editor/commands/itemCommands.js.map +1 -0
- package/dist/editor/commands/localizeItem/LocalizeItemDialog.d.ts +8 -0
- package/dist/editor/commands/localizeItem/LocalizeItemDialog.js +91 -0
- package/dist/editor/commands/localizeItem/LocalizeItemDialog.js.map +1 -0
- package/dist/editor/commands/undo.d.ts +15 -0
- package/dist/editor/commands/undo.js +29 -0
- package/dist/editor/commands/undo.js.map +1 -0
- package/dist/editor/componentTreeHelper.d.ts +18 -0
- package/dist/editor/componentTreeHelper.js +123 -0
- package/dist/editor/componentTreeHelper.js.map +1 -0
- package/dist/editor/context-menu/CopyMoveMenu.d.ts +7 -0
- package/dist/editor/context-menu/CopyMoveMenu.js +58 -0
- package/dist/editor/context-menu/CopyMoveMenu.js.map +1 -0
- package/dist/editor/context-menu/InsertMenu.d.ts +9 -0
- package/dist/editor/context-menu/InsertMenu.js +229 -0
- package/dist/editor/context-menu/InsertMenu.js.map +1 -0
- package/dist/editor/control-center/About.d.ts +1 -0
- package/dist/editor/control-center/About.js +8 -0
- package/dist/editor/control-center/About.js.map +1 -0
- package/dist/editor/control-center/AllAgentsPanel.d.ts +5 -0
- package/dist/editor/control-center/AllAgentsPanel.js +126 -0
- package/dist/editor/control-center/AllAgentsPanel.js.map +1 -0
- package/dist/editor/control-center/ControlCenterMenu.d.ts +1 -0
- package/dist/editor/control-center/ControlCenterMenu.js +66 -0
- package/dist/editor/control-center/ControlCenterMenu.js.map +1 -0
- package/dist/editor/control-center/IndexOverview.d.ts +1 -0
- package/dist/editor/control-center/IndexOverview.js +323 -0
- package/dist/editor/control-center/IndexOverview.js.map +1 -0
- package/dist/editor/control-center/Info.d.ts +1 -0
- package/dist/editor/control-center/Info.js +10 -0
- package/dist/editor/control-center/Info.js.map +1 -0
- package/dist/editor/control-center/LatestFeedback.d.ts +1 -0
- package/dist/editor/control-center/LatestFeedback.js +136 -0
- package/dist/editor/control-center/LatestFeedback.js.map +1 -0
- package/dist/editor/control-center/QuotaInfo.d.ts +1 -0
- package/dist/editor/control-center/QuotaInfo.js +102 -0
- package/dist/editor/control-center/QuotaInfo.js.map +1 -0
- package/dist/editor/control-center/Setup.d.ts +1 -0
- package/dist/editor/control-center/Setup.js +18 -0
- package/dist/editor/control-center/Setup.js.map +1 -0
- package/dist/editor/control-center/Status.d.ts +1 -0
- package/dist/editor/control-center/Status.js +79 -0
- package/dist/editor/control-center/Status.js.map +1 -0
- package/dist/editor/control-center/WebSocketMessages.d.ts +1 -0
- package/dist/editor/control-center/WebSocketMessages.js +71 -0
- package/dist/editor/control-center/WebSocketMessages.js.map +1 -0
- package/dist/editor/control-center/parhelia-setup/Overview.d.ts +1 -0
- package/dist/editor/control-center/parhelia-setup/Overview.js +91 -0
- package/dist/editor/control-center/parhelia-setup/Overview.js.map +1 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/EmbeddingsModelSection.d.ts +2 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/EmbeddingsModelSection.js +195 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/EmbeddingsModelSection.js.map +1 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/index.d.ts +2 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/index.js +22 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/index.js.map +1 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/provider/ProviderSection.d.ts +1 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/provider/ProviderSection.js +233 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/provider/ProviderSection.js.map +1 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/required-containers/RequiredContainersList.d.ts +15 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/required-containers/RequiredContainersList.js +14 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/required-containers/RequiredContainersList.js.map +1 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/required-containers/RequiredContainersSection.d.ts +1 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/required-containers/RequiredContainersSection.js +94 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/required-containers/RequiredContainersSection.js.map +1 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/tools/GenerateToolsSection.d.ts +1 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/tools/GenerateToolsSection.js +367 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/tools/GenerateToolsSection.js.map +1 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/types.d.ts +1 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/types.js +2 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/types.js.map +1 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/utils.d.ts +4 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/utils.js +25 -0
- package/dist/editor/control-center/setup-steps/AiSetupStep/utils.js.map +1 -0
- package/dist/editor/control-center/setup-steps/DbSetupStep.d.ts +2 -0
- package/dist/editor/control-center/setup-steps/DbSetupStep.js +46 -0
- package/dist/editor/control-center/setup-steps/DbSetupStep.js.map +1 -0
- package/dist/editor/control-center/setup-steps/IndexSetupStep.d.ts +2 -0
- package/dist/editor/control-center/setup-steps/IndexSetupStep.js +36 -0
- package/dist/editor/control-center/setup-steps/IndexSetupStep.js.map +1 -0
- package/dist/editor/control-center/setup-steps/SettingsSetupStep.d.ts +2 -0
- package/dist/editor/control-center/setup-steps/SettingsSetupStep.js +107 -0
- package/dist/editor/control-center/setup-steps/SettingsSetupStep.js.map +1 -0
- package/dist/editor/editor-warnings/ItemLocked.d.ts +2 -0
- package/dist/editor/editor-warnings/ItemLocked.js +38 -0
- package/dist/editor/editor-warnings/ItemLocked.js.map +1 -0
- package/dist/editor/editor-warnings/NoLanguageWriteAccess.d.ts +2 -0
- package/dist/editor/editor-warnings/NoLanguageWriteAccess.js +14 -0
- package/dist/editor/editor-warnings/NoLanguageWriteAccess.js.map +1 -0
- package/dist/editor/editor-warnings/NoWorkflowWriteAccess.d.ts +2 -0
- package/dist/editor/editor-warnings/NoWorkflowWriteAccess.js +14 -0
- package/dist/editor/editor-warnings/NoWorkflowWriteAccess.js.map +1 -0
- package/dist/editor/editor-warnings/NoWriteAccess.d.ts +2 -0
- package/dist/editor/editor-warnings/NoWriteAccess.js +14 -0
- package/dist/editor/editor-warnings/NoWriteAccess.js.map +1 -0
- package/dist/editor/editor-warnings/ValidationErrors.d.ts +2 -0
- package/dist/editor/editor-warnings/ValidationErrors.js +28 -0
- package/dist/editor/editor-warnings/ValidationErrors.js.map +1 -0
- package/dist/editor/field-types/AttachmentEditor.d.ts +9 -0
- package/dist/editor/field-types/AttachmentEditor.js +73 -0
- package/dist/editor/field-types/AttachmentEditor.js.map +1 -0
- package/dist/editor/field-types/CheckboxEditor.d.ts +5 -0
- package/dist/editor/field-types/CheckboxEditor.js +30 -0
- package/dist/editor/field-types/CheckboxEditor.js.map +1 -0
- package/dist/editor/field-types/DateFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/DateFieldEditor.js +93 -0
- package/dist/editor/field-types/DateFieldEditor.js.map +1 -0
- package/dist/editor/field-types/DateTimeFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/DateTimeFieldEditor.js +151 -0
- package/dist/editor/field-types/DateTimeFieldEditor.js.map +1 -0
- package/dist/editor/field-types/DropLinkEditor.d.ts +5 -0
- package/dist/editor/field-types/DropLinkEditor.js +42 -0
- package/dist/editor/field-types/DropLinkEditor.js.map +1 -0
- package/dist/editor/field-types/DropListEditor.d.ts +5 -0
- package/dist/editor/field-types/DropListEditor.js +46 -0
- package/dist/editor/field-types/DropListEditor.js.map +1 -0
- package/dist/editor/field-types/ImageFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/ImageFieldEditor.js +34 -0
- package/dist/editor/field-types/ImageFieldEditor.js.map +1 -0
- package/dist/editor/field-types/InternalLinkFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/InternalLinkFieldEditor.js +120 -0
- package/dist/editor/field-types/InternalLinkFieldEditor.js.map +1 -0
- package/dist/editor/field-types/LinkFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/LinkFieldEditor.js +62 -0
- package/dist/editor/field-types/LinkFieldEditor.js.map +1 -0
- package/dist/editor/field-types/MultiLineText.d.ts +7 -0
- package/dist/editor/field-types/MultiLineText.js +48 -0
- package/dist/editor/field-types/MultiLineText.js.map +1 -0
- package/dist/editor/field-types/NameValueListEditor.d.ts +7 -0
- package/dist/editor/field-types/NameValueListEditor.js +101 -0
- package/dist/editor/field-types/NameValueListEditor.js.map +1 -0
- package/dist/editor/field-types/PictureFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/PictureFieldEditor.js +58 -0
- package/dist/editor/field-types/PictureFieldEditor.js.map +1 -0
- package/dist/editor/field-types/RawEditor.d.ts +6 -0
- package/dist/editor/field-types/RawEditor.js +31 -0
- package/dist/editor/field-types/RawEditor.js.map +1 -0
- package/dist/editor/field-types/ReactQuill.d.ts +125 -0
- package/dist/editor/field-types/ReactQuill.js +385 -0
- package/dist/editor/field-types/ReactQuill.js.map +1 -0
- package/dist/editor/field-types/RichTextEditor.d.ts +7 -0
- package/dist/editor/field-types/RichTextEditor.js +21 -0
- package/dist/editor/field-types/RichTextEditor.js.map +1 -0
- package/dist/editor/field-types/RichTextEditorComponent.d.ts +8 -0
- package/dist/editor/field-types/RichTextEditorComponent.js +74 -0
- package/dist/editor/field-types/RichTextEditorComponent.js.map +1 -0
- package/dist/editor/field-types/SingleLineText.d.ts +7 -0
- package/dist/editor/field-types/SingleLineText.js +113 -0
- package/dist/editor/field-types/SingleLineText.js.map +1 -0
- package/dist/editor/field-types/TreeListEditor.d.ts +5 -0
- package/dist/editor/field-types/TreeListEditor.js +316 -0
- package/dist/editor/field-types/TreeListEditor.js.map +1 -0
- package/dist/editor/field-types/richtext/components/EditorDropdown.d.ts +11 -0
- package/dist/editor/field-types/richtext/components/EditorDropdown.js +83 -0
- package/dist/editor/field-types/richtext/components/EditorDropdown.js.map +1 -0
- package/dist/editor/field-types/richtext/components/ReactSlate.d.ts +5 -0
- package/dist/editor/field-types/richtext/components/ReactSlate.js +607 -0
- package/dist/editor/field-types/richtext/components/ReactSlate.js.map +1 -0
- package/dist/editor/field-types/richtext/components/SimpleDropdown.d.ts +18 -0
- package/dist/editor/field-types/richtext/components/SimpleDropdown.js +71 -0
- package/dist/editor/field-types/richtext/components/SimpleDropdown.js.map +1 -0
- package/dist/editor/field-types/richtext/components/SimpleRichTextEditor.d.ts +5 -0
- package/dist/editor/field-types/richtext/components/SimpleRichTextEditor.js +359 -0
- package/dist/editor/field-types/richtext/components/SimpleRichTextEditor.js.map +1 -0
- package/dist/editor/field-types/richtext/components/SimpleToolbar.d.ts +16 -0
- package/dist/editor/field-types/richtext/components/SimpleToolbar.js +181 -0
- package/dist/editor/field-types/richtext/components/SimpleToolbar.js.map +1 -0
- package/dist/editor/field-types/richtext/components/SimpleToolbarButton.d.ts +9 -0
- package/dist/editor/field-types/richtext/components/SimpleToolbarButton.js +14 -0
- package/dist/editor/field-types/richtext/components/SimpleToolbarButton.js.map +1 -0
- package/dist/editor/field-types/richtext/components/ToolbarButton.d.ts +3 -0
- package/dist/editor/field-types/richtext/components/ToolbarButton.js +6 -0
- package/dist/editor/field-types/richtext/components/ToolbarButton.js.map +1 -0
- package/dist/editor/field-types/richtext/config/pluginFactory.d.ts +19 -0
- package/dist/editor/field-types/richtext/config/pluginFactory.js +17 -0
- package/dist/editor/field-types/richtext/config/pluginFactory.js.map +1 -0
- package/dist/editor/field-types/richtext/contextMenuFactory.d.ts +4 -0
- package/dist/editor/field-types/richtext/contextMenuFactory.js +201 -0
- package/dist/editor/field-types/richtext/contextMenuFactory.js.map +1 -0
- package/dist/editor/field-types/richtext/hooks/useProfileCache.d.ts +68 -0
- package/dist/editor/field-types/richtext/hooks/useProfileCache.js +214 -0
- package/dist/editor/field-types/richtext/hooks/useProfileCache.js.map +1 -0
- package/dist/editor/field-types/richtext/hooks/useRichTextProfile.d.ts +25 -0
- package/dist/editor/field-types/richtext/hooks/useRichTextProfile.js +64 -0
- package/dist/editor/field-types/richtext/hooks/useRichTextProfile.js.map +1 -0
- package/dist/editor/field-types/richtext/index.d.ts +6 -0
- package/dist/editor/field-types/richtext/index.js +7 -0
- package/dist/editor/field-types/richtext/index.js.map +1 -0
- package/dist/editor/field-types/richtext/types.d.ts +288 -0
- package/dist/editor/field-types/richtext/types.js +107 -0
- package/dist/editor/field-types/richtext/types.js.map +1 -0
- package/dist/editor/field-types/richtext/utils/conversion.d.ts +7 -0
- package/dist/editor/field-types/richtext/utils/conversion.js +762 -0
- package/dist/editor/field-types/richtext/utils/conversion.js.map +1 -0
- package/dist/editor/field-types/richtext/utils/plugins.d.ts +170 -0
- package/dist/editor/field-types/richtext/utils/plugins.js +490 -0
- package/dist/editor/field-types/richtext/utils/plugins.js.map +1 -0
- package/dist/editor/field-types/richtext/utils/profileMapper.d.ts +38 -0
- package/dist/editor/field-types/richtext/utils/profileMapper.js +386 -0
- package/dist/editor/field-types/richtext/utils/profileMapper.js.map +1 -0
- package/dist/editor/field-types/richtext/utils/profileServiceCache.d.ts +37 -0
- package/dist/editor/field-types/richtext/utils/profileServiceCache.js +119 -0
- package/dist/editor/field-types/richtext/utils/profileServiceCache.js.map +1 -0
- package/dist/editor/fieldTypes.d.ts +129 -0
- package/dist/editor/fieldTypes.js +2 -0
- package/dist/editor/fieldTypes.js.map +1 -0
- package/dist/editor/hooks/useEditorSettings.d.ts +17 -0
- package/dist/editor/hooks/useEditorSettings.js +61 -0
- package/dist/editor/hooks/useEditorSettings.js.map +1 -0
- package/dist/editor/media-selector/AiImageSearch.d.ts +4 -0
- package/dist/editor/media-selector/AiImageSearch.js +164 -0
- package/dist/editor/media-selector/AiImageSearch.js.map +1 -0
- package/dist/editor/media-selector/AiImageSearchPrompt.d.ts +3 -0
- package/dist/editor/media-selector/AiImageSearchPrompt.js +57 -0
- package/dist/editor/media-selector/AiImageSearchPrompt.js.map +1 -0
- package/dist/editor/media-selector/MediaFolderBrowser.d.ts +5 -0
- package/dist/editor/media-selector/MediaFolderBrowser.js +182 -0
- package/dist/editor/media-selector/MediaFolderBrowser.js.map +1 -0
- package/dist/editor/media-selector/MediaSelector.d.ts +9 -0
- package/dist/editor/media-selector/MediaSelector.js +8 -0
- package/dist/editor/media-selector/MediaSelector.js.map +1 -0
- package/dist/editor/media-selector/Preview.d.ts +4 -0
- package/dist/editor/media-selector/Preview.js +19 -0
- package/dist/editor/media-selector/Preview.js.map +1 -0
- package/dist/editor/media-selector/Thumbnails.d.ts +8 -0
- package/dist/editor/media-selector/Thumbnails.js +10 -0
- package/dist/editor/media-selector/Thumbnails.js.map +1 -0
- package/dist/editor/media-selector/TreeSelector.d.ts +7 -0
- package/dist/editor/media-selector/TreeSelector.js +183 -0
- package/dist/editor/media-selector/TreeSelector.js.map +1 -0
- package/dist/editor/media-selector/UploadZone.d.ts +4 -0
- package/dist/editor/media-selector/UploadZone.js +81 -0
- package/dist/editor/media-selector/UploadZone.js.map +1 -0
- package/dist/editor/media-selector/index.d.ts +8 -0
- package/dist/editor/media-selector/index.js +9 -0
- package/dist/editor/media-selector/index.js.map +1 -0
- package/dist/editor/menubar/ActiveUsers.d.ts +1 -0
- package/dist/editor/menubar/ActiveUsers.js +120 -0
- package/dist/editor/menubar/ActiveUsers.js.map +1 -0
- package/dist/editor/menubar/ApproveAndPublish.d.ts +1 -0
- package/dist/editor/menubar/ApproveAndPublish.js +13 -0
- package/dist/editor/menubar/ApproveAndPublish.js.map +1 -0
- package/dist/editor/menubar/FavoritesControls.d.ts +8 -0
- package/dist/editor/menubar/FavoritesControls.js +124 -0
- package/dist/editor/menubar/FavoritesControls.js.map +1 -0
- package/dist/editor/menubar/GenericToolbar.d.ts +11 -0
- package/dist/editor/menubar/GenericToolbar.js +10 -0
- package/dist/editor/menubar/GenericToolbar.js.map +1 -0
- package/dist/editor/menubar/ItemActionsMenu.d.ts +3 -0
- package/dist/editor/menubar/ItemActionsMenu.js +23 -0
- package/dist/editor/menubar/ItemActionsMenu.js.map +1 -0
- package/dist/editor/menubar/ItemLanguageVersion.d.ts +1 -0
- package/dist/editor/menubar/ItemLanguageVersion.js +54 -0
- package/dist/editor/menubar/ItemLanguageVersion.js.map +1 -0
- package/dist/editor/menubar/ItemToolbar.d.ts +1 -0
- package/dist/editor/menubar/ItemToolbar.js +11 -0
- package/dist/editor/menubar/ItemToolbar.js.map +1 -0
- package/dist/editor/menubar/NavButtons.d.ts +1 -0
- package/dist/editor/menubar/NavButtons.js +40 -0
- package/dist/editor/menubar/NavButtons.js.map +1 -0
- package/dist/editor/menubar/PageSelector.d.ts +4 -0
- package/dist/editor/menubar/PageSelector.js +149 -0
- package/dist/editor/menubar/PageSelector.js.map +1 -0
- package/dist/editor/menubar/Separator.d.ts +3 -0
- package/dist/editor/menubar/Separator.js +6 -0
- package/dist/editor/menubar/Separator.js.map +1 -0
- package/dist/editor/menubar/SiteInfo.d.ts +1 -0
- package/dist/editor/menubar/SiteInfo.js +24 -0
- package/dist/editor/menubar/SiteInfo.js.map +1 -0
- package/dist/editor/menubar/ToolbarFactory.d.ts +2 -0
- package/dist/editor/menubar/ToolbarFactory.js +55 -0
- package/dist/editor/menubar/ToolbarFactory.js.map +1 -0
- package/dist/editor/menubar/User.d.ts +4 -0
- package/dist/editor/menubar/User.js +18 -0
- package/dist/editor/menubar/User.js.map +1 -0
- package/dist/editor/menubar/VersionSelector.d.ts +10 -0
- package/dist/editor/menubar/VersionSelector.js +53 -0
- package/dist/editor/menubar/VersionSelector.js.map +1 -0
- package/dist/editor/menubar/WorkflowButton.d.ts +1 -0
- package/dist/editor/menubar/WorkflowButton.js +93 -0
- package/dist/editor/menubar/WorkflowButton.js.map +1 -0
- package/dist/editor/menubar/toolbar-sections/CompareControls.d.ts +1 -0
- package/dist/editor/menubar/toolbar-sections/CompareControls.js +11 -0
- package/dist/editor/menubar/toolbar-sections/CompareControls.js.map +1 -0
- package/dist/editor/menubar/toolbar-sections/EditControls.d.ts +7 -0
- package/dist/editor/menubar/toolbar-sections/EditControls.js +15 -0
- package/dist/editor/menubar/toolbar-sections/EditControls.js.map +1 -0
- package/dist/editor/menubar/toolbar-sections/InsertControls.d.ts +1 -0
- package/dist/editor/menubar/toolbar-sections/InsertControls.js +15 -0
- package/dist/editor/menubar/toolbar-sections/InsertControls.js.map +1 -0
- package/dist/editor/menubar/toolbar-sections/ReviewCommands.d.ts +1 -0
- package/dist/editor/menubar/toolbar-sections/ReviewCommands.js +41 -0
- package/dist/editor/menubar/toolbar-sections/ReviewCommands.js.map +1 -0
- package/dist/editor/menubar/toolbar-sections/UtilityControls.d.ts +1 -0
- package/dist/editor/menubar/toolbar-sections/UtilityControls.js +17 -0
- package/dist/editor/menubar/toolbar-sections/UtilityControls.js.map +1 -0
- package/dist/editor/menubar/toolbar-sections/ViewportControls.d.ts +1 -0
- package/dist/editor/menubar/toolbar-sections/ViewportControls.js +21 -0
- package/dist/editor/menubar/toolbar-sections/ViewportControls.js.map +1 -0
- package/dist/editor/menubar/toolbar-sections/index.d.ts +6 -0
- package/dist/editor/menubar/toolbar-sections/index.js +7 -0
- package/dist/editor/menubar/toolbar-sections/index.js.map +1 -0
- package/dist/editor/page-editor-chrome/CommentHighlighting.d.ts +6 -0
- package/dist/editor/page-editor-chrome/CommentHighlighting.js +270 -0
- package/dist/editor/page-editor-chrome/CommentHighlighting.js.map +1 -0
- package/dist/editor/page-editor-chrome/CommentHighlightings.d.ts +4 -0
- package/dist/editor/page-editor-chrome/CommentHighlightings.js +15 -0
- package/dist/editor/page-editor-chrome/CommentHighlightings.js.map +1 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicator.d.ts +4 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicator.js +35 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicator.js.map +1 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicators.d.ts +1 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicators.js +13 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicators.js.map +1 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicator.d.ts +8 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicator.js +26 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicator.js.map +1 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicators.d.ts +6 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicators.js +14 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicators.js.map +1 -0
- package/dist/editor/page-editor-chrome/FrameMenu.d.ts +7 -0
- package/dist/editor/page-editor-chrome/FrameMenu.js +346 -0
- package/dist/editor/page-editor-chrome/FrameMenu.js.map +1 -0
- package/dist/editor/page-editor-chrome/FrameMenus.d.ts +5 -0
- package/dist/editor/page-editor-chrome/FrameMenus.js +22 -0
- package/dist/editor/page-editor-chrome/FrameMenus.js.map +1 -0
- package/dist/editor/page-editor-chrome/InlineEditor.d.ts +5 -0
- package/dist/editor/page-editor-chrome/InlineEditor.js +704 -0
- package/dist/editor/page-editor-chrome/InlineEditor.js.map +1 -0
- package/dist/editor/page-editor-chrome/LockedFieldIndicator.d.ts +1 -0
- package/dist/editor/page-editor-chrome/LockedFieldIndicator.js +33 -0
- package/dist/editor/page-editor-chrome/LockedFieldIndicator.js.map +1 -0
- package/dist/editor/page-editor-chrome/NoLayout.d.ts +1 -0
- package/dist/editor/page-editor-chrome/NoLayout.js +19 -0
- package/dist/editor/page-editor-chrome/NoLayout.js.map +1 -0
- package/dist/editor/page-editor-chrome/PageEditorChrome.d.ts +6 -0
- package/dist/editor/page-editor-chrome/PageEditorChrome.js +64 -0
- package/dist/editor/page-editor-chrome/PageEditorChrome.js.map +1 -0
- package/dist/editor/page-editor-chrome/PictureEditorOverlay.d.ts +1 -0
- package/dist/editor/page-editor-chrome/PictureEditorOverlay.js +152 -0
- package/dist/editor/page-editor-chrome/PictureEditorOverlay.js.map +1 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.d.ts +18 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +122 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js.map +1 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.d.ts +5 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js +289 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js.map +1 -0
- package/dist/editor/page-editor-chrome/SuggestionHighlighting.d.ts +6 -0
- package/dist/editor/page-editor-chrome/SuggestionHighlighting.js +224 -0
- package/dist/editor/page-editor-chrome/SuggestionHighlighting.js.map +1 -0
- package/dist/editor/page-editor-chrome/SuggestionHighlightings.d.ts +4 -0
- package/dist/editor/page-editor-chrome/SuggestionHighlightings.js +16 -0
- package/dist/editor/page-editor-chrome/SuggestionHighlightings.js.map +1 -0
- package/dist/editor/page-editor-chrome/useInlineAICompletion.d.ts +7 -0
- package/dist/editor/page-editor-chrome/useInlineAICompletion.js +699 -0
- package/dist/editor/page-editor-chrome/useInlineAICompletion.js.map +1 -0
- package/dist/editor/page-viewer/DeviceToolbar.d.ts +6 -0
- package/dist/editor/page-viewer/DeviceToolbar.js +21 -0
- package/dist/editor/page-viewer/DeviceToolbar.js.map +1 -0
- package/dist/editor/page-viewer/EditorForm.d.ts +8 -0
- package/dist/editor/page-viewer/EditorForm.js +257 -0
- package/dist/editor/page-viewer/EditorForm.js.map +1 -0
- package/dist/editor/page-viewer/EditorFormPopup.d.ts +11 -0
- package/dist/editor/page-viewer/EditorFormPopup.js +41 -0
- package/dist/editor/page-viewer/EditorFormPopup.js.map +1 -0
- package/dist/editor/page-viewer/MiniMap.d.ts +9 -0
- package/dist/editor/page-viewer/MiniMap.js +233 -0
- package/dist/editor/page-viewer/MiniMap.js.map +1 -0
- package/dist/editor/page-viewer/PageViewer.d.ts +10 -0
- package/dist/editor/page-viewer/PageViewer.js +67 -0
- package/dist/editor/page-viewer/PageViewer.js.map +1 -0
- package/dist/editor/page-viewer/PageViewerFrame.d.ts +11 -0
- package/dist/editor/page-viewer/PageViewerFrame.js +857 -0
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -0
- package/dist/editor/page-viewer/pageModelSkeletonBuilder.d.ts +3 -0
- package/dist/editor/page-viewer/pageModelSkeletonBuilder.js +339 -0
- package/dist/editor/page-viewer/pageModelSkeletonBuilder.js.map +1 -0
- package/dist/editor/page-viewer/pageViewContext.d.ts +40 -0
- package/dist/editor/page-viewer/pageViewContext.js +156 -0
- package/dist/editor/page-viewer/pageViewContext.js.map +1 -0
- package/dist/editor/pageModel.d.ts +222 -0
- package/dist/editor/pageModel.js +2 -0
- package/dist/editor/pageModel.js.map +1 -0
- package/dist/editor/picture-shared.d.ts +16 -0
- package/dist/editor/picture-shared.js +25 -0
- package/dist/editor/picture-shared.js.map +1 -0
- package/dist/editor/reviews/Comment.d.ts +8 -0
- package/dist/editor/reviews/Comment.js +162 -0
- package/dist/editor/reviews/Comment.js.map +1 -0
- package/dist/editor/reviews/CommentDisplayPopover.d.ts +9 -0
- package/dist/editor/reviews/CommentDisplayPopover.js +104 -0
- package/dist/editor/reviews/CommentDisplayPopover.js.map +1 -0
- package/dist/editor/reviews/CommentEditor.d.ts +20 -0
- package/dist/editor/reviews/CommentEditor.js +57 -0
- package/dist/editor/reviews/CommentEditor.js.map +1 -0
- package/dist/editor/reviews/CommentPopover.d.ts +22 -0
- package/dist/editor/reviews/CommentPopover.js +145 -0
- package/dist/editor/reviews/CommentPopover.js.map +1 -0
- package/dist/editor/reviews/CommentView.d.ts +21 -0
- package/dist/editor/reviews/CommentView.js +52 -0
- package/dist/editor/reviews/CommentView.js.map +1 -0
- package/dist/editor/reviews/Comments.d.ts +3 -0
- package/dist/editor/reviews/Comments.js +118 -0
- package/dist/editor/reviews/Comments.js.map +1 -0
- package/dist/editor/reviews/DiffView.d.ts +17 -0
- package/dist/editor/reviews/DiffView.js +57 -0
- package/dist/editor/reviews/DiffView.js.map +1 -0
- package/dist/editor/reviews/PreviewInfo.d.ts +1 -0
- package/dist/editor/reviews/PreviewInfo.js +12 -0
- package/dist/editor/reviews/PreviewInfo.js.map +1 -0
- package/dist/editor/reviews/Reviews.d.ts +1 -0
- package/dist/editor/reviews/Reviews.js +186 -0
- package/dist/editor/reviews/Reviews.js.map +1 -0
- package/dist/editor/reviews/SuggestedEdit.d.ts +4 -0
- package/dist/editor/reviews/SuggestedEdit.js +200 -0
- package/dist/editor/reviews/SuggestedEdit.js.map +1 -0
- package/dist/editor/reviews/SuggestionDisplayPopover.d.ts +9 -0
- package/dist/editor/reviews/SuggestionDisplayPopover.js +204 -0
- package/dist/editor/reviews/SuggestionDisplayPopover.js.map +1 -0
- package/dist/editor/reviews/commentAi.d.ts +7 -0
- package/dist/editor/reviews/commentAi.js +100 -0
- package/dist/editor/reviews/commentAi.js.map +1 -0
- package/dist/editor/reviews/reviewCommands.d.ts +3 -0
- package/dist/editor/reviews/reviewCommands.js +38 -0
- package/dist/editor/reviews/reviewCommands.js.map +1 -0
- package/dist/editor/reviews/useReviews.d.ts +12 -0
- package/dist/editor/reviews/useReviews.js +43 -0
- package/dist/editor/reviews/useReviews.js.map +1 -0
- package/dist/editor/services/agentService.d.ts +306 -0
- package/dist/editor/services/agentService.js +627 -0
- package/dist/editor/services/agentService.js.map +1 -0
- package/dist/editor/services/aiService.d.ts +106 -0
- package/dist/editor/services/aiService.js +294 -0
- package/dist/editor/services/aiService.js.map +1 -0
- package/dist/editor/services/componentDesignerService.d.ts +46 -0
- package/dist/editor/services/componentDesignerService.js +72 -0
- package/dist/editor/services/componentDesignerService.js.map +1 -0
- package/dist/editor/services/contentService.d.ts +79 -0
- package/dist/editor/services/contentService.js +119 -0
- package/dist/editor/services/contentService.js.map +1 -0
- package/dist/editor/services/contextService.d.ts +26 -0
- package/dist/editor/services/contextService.js +103 -0
- package/dist/editor/services/contextService.js.map +1 -0
- package/dist/editor/services/editService.d.ts +66 -0
- package/dist/editor/services/editService.js +325 -0
- package/dist/editor/services/editService.js.map +1 -0
- package/dist/editor/services/favouritesService.d.ts +33 -0
- package/dist/editor/services/favouritesService.js +22 -0
- package/dist/editor/services/favouritesService.js.map +1 -0
- package/dist/editor/services/indexService.d.ts +13 -0
- package/dist/editor/services/indexService.js +45 -0
- package/dist/editor/services/indexService.js.map +1 -0
- package/dist/editor/services/reviewsService.d.ts +18 -0
- package/dist/editor/services/reviewsService.js +60 -0
- package/dist/editor/services/reviewsService.js.map +1 -0
- package/dist/editor/services/searchService.d.ts +17 -0
- package/dist/editor/services/searchService.js +25 -0
- package/dist/editor/services/searchService.js.map +1 -0
- package/dist/editor/services/serviceHelper.d.ts +10 -0
- package/dist/editor/services/serviceHelper.js +118 -0
- package/dist/editor/services/serviceHelper.js.map +1 -0
- package/dist/editor/services/setupService.d.ts +21 -0
- package/dist/editor/services/setupService.js +10 -0
- package/dist/editor/services/setupService.js.map +1 -0
- package/dist/editor/services/suggestedEditsService.d.ts +18 -0
- package/dist/editor/services/suggestedEditsService.js +36 -0
- package/dist/editor/services/suggestedEditsService.js.map +1 -0
- package/dist/editor/services/systemService.d.ts +4 -0
- package/dist/editor/services/systemService.js +11 -0
- package/dist/editor/services/systemService.js.map +1 -0
- package/dist/editor/services-server/api.d.ts +19 -0
- package/dist/editor/services-server/api.js +111 -0
- package/dist/editor/services-server/api.js.map +1 -0
- package/dist/editor/services-server/graphQL.d.ts +29 -0
- package/dist/editor/services-server/graphQL.js +53 -0
- package/dist/editor/services-server/graphQL.js.map +1 -0
- package/dist/editor/sidebar/Completions.d.ts +1 -0
- package/dist/editor/sidebar/Completions.js +55 -0
- package/dist/editor/sidebar/Completions.js.map +1 -0
- package/dist/editor/sidebar/ComponentPalette.d.ts +1 -0
- package/dist/editor/sidebar/ComponentPalette.js +86 -0
- package/dist/editor/sidebar/ComponentPalette.js.map +1 -0
- package/dist/editor/sidebar/ComponentTree.d.ts +1 -0
- package/dist/editor/sidebar/ComponentTree.js +691 -0
- package/dist/editor/sidebar/ComponentTree.js.map +1 -0
- package/dist/editor/sidebar/Debug.d.ts +1 -0
- package/dist/editor/sidebar/Debug.js +71 -0
- package/dist/editor/sidebar/Debug.js.map +1 -0
- package/dist/editor/sidebar/DictionaryEditor.d.ts +1 -0
- package/dist/editor/sidebar/DictionaryEditor.js +158 -0
- package/dist/editor/sidebar/DictionaryEditor.js.map +1 -0
- package/dist/editor/sidebar/Divider.d.ts +6 -0
- package/dist/editor/sidebar/Divider.js +6 -0
- package/dist/editor/sidebar/Divider.js.map +1 -0
- package/dist/editor/sidebar/EditHistory.d.ts +1 -0
- package/dist/editor/sidebar/EditHistory.js +78 -0
- package/dist/editor/sidebar/EditHistory.js.map +1 -0
- package/dist/editor/sidebar/GraphQL.d.ts +2 -0
- package/dist/editor/sidebar/GraphQL.js +234 -0
- package/dist/editor/sidebar/GraphQL.js.map +1 -0
- package/dist/editor/sidebar/Insert.d.ts +1 -0
- package/dist/editor/sidebar/Insert.js +22 -0
- package/dist/editor/sidebar/Insert.js.map +1 -0
- package/dist/editor/sidebar/LeftToolbar.d.ts +1 -0
- package/dist/editor/sidebar/LeftToolbar.js +16 -0
- package/dist/editor/sidebar/LeftToolbar.js.map +1 -0
- package/dist/editor/sidebar/MainContentTree.d.ts +5 -0
- package/dist/editor/sidebar/MainContentTree.js +70 -0
- package/dist/editor/sidebar/MainContentTree.js.map +1 -0
- package/dist/editor/sidebar/Performance.d.ts +1 -0
- package/dist/editor/sidebar/Performance.js +32 -0
- package/dist/editor/sidebar/Performance.js.map +1 -0
- package/dist/editor/sidebar/SEOInfo.d.ts +1 -0
- package/dist/editor/sidebar/SEOInfo.js +158 -0
- package/dist/editor/sidebar/SEOInfo.js.map +1 -0
- package/dist/editor/sidebar/Sessions.d.ts +1 -0
- package/dist/editor/sidebar/Sessions.js +29 -0
- package/dist/editor/sidebar/Sessions.js.map +1 -0
- package/dist/editor/sidebar/Sidebar.d.ts +1 -0
- package/dist/editor/sidebar/Sidebar.js +13 -0
- package/dist/editor/sidebar/Sidebar.js.map +1 -0
- package/dist/editor/sidebar/SidebarView.d.ts +10 -0
- package/dist/editor/sidebar/SidebarView.js +40 -0
- package/dist/editor/sidebar/SidebarView.js.map +1 -0
- package/dist/editor/sidebar/Validation.d.ts +1 -0
- package/dist/editor/sidebar/Validation.js +51 -0
- package/dist/editor/sidebar/Validation.js.map +1 -0
- package/dist/editor/sidebar/ViewSelector.d.ts +4 -0
- package/dist/editor/sidebar/ViewSelector.js +191 -0
- package/dist/editor/sidebar/ViewSelector.js.map +1 -0
- package/dist/editor/sidebar/Workbox.d.ts +1 -0
- package/dist/editor/sidebar/Workbox.js +79 -0
- package/dist/editor/sidebar/Workbox.js.map +1 -0
- package/dist/editor/ui/CenteredMessage.d.ts +3 -0
- package/dist/editor/ui/CenteredMessage.js +5 -0
- package/dist/editor/ui/CenteredMessage.js.map +1 -0
- package/dist/editor/ui/CopyMoveTargetSelectorDialog.d.ts +10 -0
- package/dist/editor/ui/CopyMoveTargetSelectorDialog.js +38 -0
- package/dist/editor/ui/CopyMoveTargetSelectorDialog.js.map +1 -0
- package/dist/editor/ui/DialogButtons.d.ts +3 -0
- package/dist/editor/ui/DialogButtons.js +5 -0
- package/dist/editor/ui/DialogButtons.js.map +1 -0
- package/dist/editor/ui/DragPreview.d.ts +14 -0
- package/dist/editor/ui/DragPreview.js +33 -0
- package/dist/editor/ui/DragPreview.js.map +1 -0
- package/dist/editor/ui/Icons.d.ts +74 -0
- package/dist/editor/ui/Icons.js +106 -0
- package/dist/editor/ui/Icons.js.map +1 -0
- package/dist/editor/ui/ItemList.d.ts +16 -0
- package/dist/editor/ui/ItemList.js +19 -0
- package/dist/editor/ui/ItemList.js.map +1 -0
- package/dist/editor/ui/ItemNameDialogNew.d.ts +10 -0
- package/dist/editor/ui/ItemNameDialogNew.js +68 -0
- package/dist/editor/ui/ItemNameDialogNew.js.map +1 -0
- package/dist/editor/ui/ItemSearch.d.ts +25 -0
- package/dist/editor/ui/ItemSearch.js +92 -0
- package/dist/editor/ui/ItemSearch.js.map +1 -0
- package/dist/editor/ui/PerfectTree.d.ts +78 -0
- package/dist/editor/ui/PerfectTree.js +858 -0
- package/dist/editor/ui/PerfectTree.js.map +1 -0
- package/dist/editor/ui/Section.d.ts +4 -0
- package/dist/editor/ui/Section.js +12 -0
- package/dist/editor/ui/Section.js.map +1 -0
- package/dist/editor/ui/SimpleIconButton.d.ts +14 -0
- package/dist/editor/ui/SimpleIconButton.js +15 -0
- package/dist/editor/ui/SimpleIconButton.js.map +1 -0
- package/dist/editor/ui/SimpleMenu.d.ts +6 -0
- package/dist/editor/ui/SimpleMenu.js +7 -0
- package/dist/editor/ui/SimpleMenu.js.map +1 -0
- package/dist/editor/ui/SimpleTable.d.ts +14 -0
- package/dist/editor/ui/SimpleTable.js +9 -0
- package/dist/editor/ui/SimpleTable.js.map +1 -0
- package/dist/editor/ui/SimpleTabs.d.ts +15 -0
- package/dist/editor/ui/SimpleTabs.js +20 -0
- package/dist/editor/ui/SimpleTabs.js.map +1 -0
- package/dist/editor/ui/SimpleToolbar.d.ts +3 -0
- package/dist/editor/ui/SimpleToolbar.js +5 -0
- package/dist/editor/ui/SimpleToolbar.js.map +1 -0
- package/dist/editor/ui/Spinner.d.ts +4 -0
- package/dist/editor/ui/Spinner.js +18 -0
- package/dist/editor/ui/Spinner.js.map +1 -0
- package/dist/editor/ui/Splitter.d.ts +22 -0
- package/dist/editor/ui/Splitter.js +443 -0
- package/dist/editor/ui/Splitter.js.map +1 -0
- package/dist/editor/ui/TemplateSelectorDialog.d.ts +8 -0
- package/dist/editor/ui/TemplateSelectorDialog.js +61 -0
- package/dist/editor/ui/TemplateSelectorDialog.js.map +1 -0
- package/dist/editor/ui/Toolbar.d.ts +3 -0
- package/dist/editor/ui/Toolbar.js +5 -0
- package/dist/editor/ui/Toolbar.js.map +1 -0
- package/dist/editor/utils/id-helper.d.ts +1 -0
- package/dist/editor/utils/id-helper.js +5 -0
- package/dist/editor/utils/id-helper.js.map +1 -0
- package/dist/editor/utils/insertOptions.d.ts +3 -0
- package/dist/editor/utils/insertOptions.js +43 -0
- package/dist/editor/utils/insertOptions.js.map +1 -0
- package/dist/editor/utils/itemConverters.d.ts +3 -0
- package/dist/editor/utils/itemConverters.js +53 -0
- package/dist/editor/utils/itemConverters.js.map +1 -0
- package/dist/editor/utils/itemutils.d.ts +3 -0
- package/dist/editor/utils/itemutils.js +24 -0
- package/dist/editor/utils/itemutils.js.map +1 -0
- package/dist/editor/utils/jsonCleaner.d.ts +8 -0
- package/dist/editor/utils/jsonCleaner.js +76 -0
- package/dist/editor/utils/jsonCleaner.js.map +1 -0
- package/dist/editor/utils/keyboardNavigation.d.ts +34 -0
- package/dist/editor/utils/keyboardNavigation.js +237 -0
- package/dist/editor/utils/keyboardNavigation.js.map +1 -0
- package/dist/editor/utils/urlUtils.d.ts +9 -0
- package/dist/editor/utils/urlUtils.js +25 -0
- package/dist/editor/utils/urlUtils.js.map +1 -0
- package/dist/editor/utils/useMemoDebug.d.ts +1 -0
- package/dist/editor/utils/useMemoDebug.js +18 -0
- package/dist/editor/utils/useMemoDebug.js.map +1 -0
- package/dist/editor/utils.d.ts +65 -0
- package/dist/editor/utils.js +468 -0
- package/dist/editor/utils.js.map +1 -0
- package/dist/editor/views/CompareView.d.ts +1 -0
- package/dist/editor/views/CompareView.js +148 -0
- package/dist/editor/views/CompareView.js.map +1 -0
- package/dist/editor/views/EditView.d.ts +1 -0
- package/dist/editor/views/EditView.js +15 -0
- package/dist/editor/views/EditView.js.map +1 -0
- package/dist/editor/views/ItemEditor.d.ts +7 -0
- package/dist/editor/views/ItemEditor.js +29 -0
- package/dist/editor/views/ItemEditor.js.map +1 -0
- package/dist/editor/views/MediaFolderEditView.d.ts +4 -0
- package/dist/editor/views/MediaFolderEditView.js +40 -0
- package/dist/editor/views/MediaFolderEditView.js.map +1 -0
- package/dist/editor/views/ParheliaView.d.ts +5 -0
- package/dist/editor/views/ParheliaView.js +136 -0
- package/dist/editor/views/ParheliaView.js.map +1 -0
- package/dist/editor/views/SingleEditView.d.ts +9 -0
- package/dist/editor/views/SingleEditView.js +33 -0
- package/dist/editor/views/SingleEditView.js.map +1 -0
- package/dist/images/bg-shape-black.webp +0 -0
- package/dist/images/wizard-bg.png +0 -0
- package/dist/images/wizard-tour.png +0 -0
- package/dist/images/wizard.png +0 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/safelist.d.ts +1 -0
- package/dist/lib/safelist.js +5 -0
- package/dist/lib/safelist.js.map +1 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +6 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/revision.d.ts +2 -0
- package/dist/revision.js +3 -0
- package/dist/revision.js.map +1 -0
- package/dist/splash-screen/ModernSplashScreen.d.ts +8 -0
- package/dist/splash-screen/ModernSplashScreen.js +92 -0
- package/dist/splash-screen/ModernSplashScreen.js.map +1 -0
- package/dist/splash-screen/NewPage.d.ts +3 -0
- package/dist/splash-screen/NewPage.js +145 -0
- package/dist/splash-screen/NewPage.js.map +1 -0
- package/dist/splash-screen/OpenPage.d.ts +1 -0
- package/dist/splash-screen/OpenPage.js +56 -0
- package/dist/splash-screen/OpenPage.js.map +1 -0
- package/dist/splash-screen/ParheliaAssistantChat.d.ts +8 -0
- package/dist/splash-screen/ParheliaAssistantChat.js +155 -0
- package/dist/splash-screen/ParheliaAssistantChat.js.map +1 -0
- package/dist/splash-screen/RecentAgents.d.ts +7 -0
- package/dist/splash-screen/RecentAgents.js +76 -0
- package/dist/splash-screen/RecentAgents.js.map +1 -0
- package/dist/splash-screen/RecentPages.d.ts +1 -0
- package/dist/splash-screen/RecentPages.js +47 -0
- package/dist/splash-screen/RecentPages.js.map +1 -0
- package/dist/splash-screen/SectionHeadline.d.ts +4 -0
- package/dist/splash-screen/SectionHeadline.js +7 -0
- package/dist/splash-screen/SectionHeadline.js.map +1 -0
- package/dist/styles.css +5914 -0
- package/dist/tour/Tour.d.ts +3 -0
- package/dist/tour/Tour.js +426 -0
- package/dist/tour/Tour.js.map +1 -0
- package/dist/tour/default-tour.d.ts +9 -0
- package/dist/tour/default-tour.js +302 -0
- package/dist/tour/default-tour.js.map +1 -0
- package/dist/tour/preview-tour.d.ts +2 -0
- package/dist/tour/preview-tour.js +93 -0
- package/dist/tour/preview-tour.js.map +1 -0
- package/dist/types.d.ts +396 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/images/bg-shape-black.webp +0 -0
- package/images/wizard-bg.png +0 -0
- package/images/wizard-tour.png +0 -0
- package/images/wizard.png +0 -0
- package/package.json +93 -0
|
@@ -0,0 +1,699 @@
|
|
|
1
|
+
import { useEffect, useCallback, useState, useMemo, useRef, } from "react";
|
|
2
|
+
import { useDebouncedCallback } from "use-debounce";
|
|
3
|
+
import { useEditContext, useFieldsEditContext } from "../client/editContext";
|
|
4
|
+
import { executePrompt } from "../services/aiService";
|
|
5
|
+
import { generatePageContext, getCachedContext, } from "../services/contextService";
|
|
6
|
+
export function useInlineAiCompletion({ pageViewContext, cursorSpanId, isUpdatingRef, }) {
|
|
7
|
+
const editContext = useEditContext();
|
|
8
|
+
const fieldsContext = useFieldsEditContext();
|
|
9
|
+
const [currentCompletion, setCurrentCompletion] = useState(null);
|
|
10
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
11
|
+
const abortControllerRef = useRef(null);
|
|
12
|
+
const loadingAnimationRef = useRef(null);
|
|
13
|
+
// Clean up hint element on unmount
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
return () => {
|
|
16
|
+
const hintElement = document.getElementById(`${cursorSpanId}-hint`);
|
|
17
|
+
if (hintElement) {
|
|
18
|
+
hintElement.remove();
|
|
19
|
+
}
|
|
20
|
+
if (loadingAnimationRef.current) {
|
|
21
|
+
cancelAnimationFrame(loadingAnimationRef.current);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}, [cursorSpanId]);
|
|
25
|
+
const lastCaretPosRef = useRef(null);
|
|
26
|
+
// Simple function to track caret position without inserting spans
|
|
27
|
+
const positionCursorSpan = () => {
|
|
28
|
+
if (isUpdatingRef.current)
|
|
29
|
+
return;
|
|
30
|
+
isUpdatingRef.current = true;
|
|
31
|
+
try {
|
|
32
|
+
const iframeWindow = pageViewContext.editorIframe?.contentWindow;
|
|
33
|
+
const iframeDocument = iframeWindow?.document;
|
|
34
|
+
const editableElement = fieldsContext?.inlineEditingFieldElement;
|
|
35
|
+
if (!iframeWindow || !iframeDocument || !editableElement)
|
|
36
|
+
return;
|
|
37
|
+
// Get current selection
|
|
38
|
+
const selection = iframeWindow.getSelection();
|
|
39
|
+
if (!selection || selection.rangeCount === 0)
|
|
40
|
+
return;
|
|
41
|
+
const range = selection.getRangeAt(0);
|
|
42
|
+
// Only proceed if selection is within our editing element
|
|
43
|
+
if (!editableElement.contains(range.commonAncestorContainer))
|
|
44
|
+
return;
|
|
45
|
+
// Save detailed information about the cursor position
|
|
46
|
+
const currentNode = range.startContainer;
|
|
47
|
+
const currentOffset = range.startOffset;
|
|
48
|
+
// Create a temporary range to get text up to cursor
|
|
49
|
+
const tempRange = document.createRange();
|
|
50
|
+
tempRange.selectNodeContents(editableElement);
|
|
51
|
+
tempRange.setEnd(currentNode, currentOffset);
|
|
52
|
+
const textUpToCursor = tempRange.toString();
|
|
53
|
+
// Check if cursor position has changed
|
|
54
|
+
const cursorMoved = !lastCaretPosRef.current ||
|
|
55
|
+
lastCaretPosRef.current.node !== currentNode ||
|
|
56
|
+
lastCaretPosRef.current.offset !== currentOffset ||
|
|
57
|
+
textUpToCursor.length !== (lastCaretPosRef.current.textLength || 0);
|
|
58
|
+
if (cursorMoved) {
|
|
59
|
+
// Reset completion if cursor position changed
|
|
60
|
+
lastCaretPosRef.current = {
|
|
61
|
+
node: currentNode,
|
|
62
|
+
offset: currentOffset,
|
|
63
|
+
textLength: textUpToCursor.length,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
// Save a copy of the current range
|
|
67
|
+
const originalRange = range.cloneRange();
|
|
68
|
+
// Remove any existing cursor spans
|
|
69
|
+
const existingSpan = iframeDocument.getElementById(cursorSpanId);
|
|
70
|
+
if (existingSpan) {
|
|
71
|
+
existingSpan.parentNode?.removeChild(existingSpan);
|
|
72
|
+
}
|
|
73
|
+
// Create our cursor span
|
|
74
|
+
const cursorSpan = existingSpan ?? iframeDocument.createElement("span");
|
|
75
|
+
cursorSpan.id = cursorSpanId;
|
|
76
|
+
cursorSpan.style.fontWeight = "bold";
|
|
77
|
+
cursorSpan.style.display = "inline";
|
|
78
|
+
cursorSpan.style.pointerEvents = "none";
|
|
79
|
+
cursorSpan.contentEditable = "false";
|
|
80
|
+
cursorSpan.setAttribute("data-cursor-indicator", "true");
|
|
81
|
+
// Get a working range for insertion
|
|
82
|
+
const workingRange = range.cloneRange();
|
|
83
|
+
workingRange.collapse(true);
|
|
84
|
+
// Insert the span at cursor position
|
|
85
|
+
workingRange.insertNode(cursorSpan);
|
|
86
|
+
// Restore original selection
|
|
87
|
+
selection.removeAllRanges();
|
|
88
|
+
selection.addRange(originalRange);
|
|
89
|
+
// setTimeout(() => {
|
|
90
|
+
// getCompletionDebounced();
|
|
91
|
+
// }, 100);
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
console.error("Error updating cursor:", error);
|
|
95
|
+
}
|
|
96
|
+
finally {
|
|
97
|
+
setTimeout(() => {
|
|
98
|
+
isUpdatingRef.current = false;
|
|
99
|
+
}, 10);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
// Handle keydown events - especially for cursor movement
|
|
104
|
+
const keyHandler = (e) => {
|
|
105
|
+
if (e.key === "ArrowLeft" ||
|
|
106
|
+
e.key === "ArrowRight" ||
|
|
107
|
+
e.key === "ArrowUp" ||
|
|
108
|
+
e.key === "ArrowDown" ||
|
|
109
|
+
e.key === " " ||
|
|
110
|
+
e.key === "Tab" ||
|
|
111
|
+
e.key === "End" ||
|
|
112
|
+
e.key === "Backspace" ||
|
|
113
|
+
e.key === "Delete" // Add Delete key handling
|
|
114
|
+
) {
|
|
115
|
+
// Clear the completion when arrow keys are used
|
|
116
|
+
setCurrentCompletion(null);
|
|
117
|
+
clearCursorSpan();
|
|
118
|
+
// Let the browser handle the cursor movement/deletion
|
|
119
|
+
// Then update our cursor span after a small delay
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
if (!isUpdatingRef.current) {
|
|
122
|
+
positionCursorSpan();
|
|
123
|
+
}
|
|
124
|
+
}, 10);
|
|
125
|
+
// Special handling for right arrow and delete which seems to have issues
|
|
126
|
+
if (e.key === "ArrowRight" || e.key === "Delete") {
|
|
127
|
+
// Make sure the cursor span doesn't block the movement/deletion
|
|
128
|
+
const cursorSpan = pageViewContext.editorIframe?.contentWindow?.document.getElementById(cursorSpanId);
|
|
129
|
+
if (cursorSpan) {
|
|
130
|
+
// Temporarily make it display none so it doesn't interfere with selection
|
|
131
|
+
const originalDisplay = cursorSpan.style.display;
|
|
132
|
+
cursorSpan.style.display = "none";
|
|
133
|
+
// Restore after the browser has processed the movement/deletion
|
|
134
|
+
setTimeout(() => {
|
|
135
|
+
if (cursorSpan.parentNode) {
|
|
136
|
+
cursorSpan.style.display = originalDisplay;
|
|
137
|
+
}
|
|
138
|
+
}, 0);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
pageViewContext.editorIframe?.contentWindow?.document.addEventListener("keydown", keyHandler);
|
|
144
|
+
return () => {
|
|
145
|
+
pageViewContext.editorIframe?.contentWindow?.document.removeEventListener("keydown", keyHandler);
|
|
146
|
+
};
|
|
147
|
+
}, [currentCompletion, pageViewContext.page]);
|
|
148
|
+
// Extracts the text up to the cursor position in the editable element
|
|
149
|
+
const getContentUpToCursor = (element) => {
|
|
150
|
+
const iframeWindow = pageViewContext.editorIframe?.contentWindow;
|
|
151
|
+
const selection = iframeWindow?.getSelection();
|
|
152
|
+
if (!element || !selection || selection.rangeCount === 0)
|
|
153
|
+
return null;
|
|
154
|
+
const range = selection.getRangeAt(0);
|
|
155
|
+
const cursorPosition = range.startOffset;
|
|
156
|
+
let contentUpToCursor = "";
|
|
157
|
+
if (element.childNodes.length === 0) {
|
|
158
|
+
contentUpToCursor = "";
|
|
159
|
+
}
|
|
160
|
+
else if (element.childNodes.length === 1 &&
|
|
161
|
+
element.firstChild?.nodeType === Node.TEXT_NODE) {
|
|
162
|
+
const full = element.innerText || "";
|
|
163
|
+
contentUpToCursor = full.substring(0, Math.min(cursorPosition, full.length));
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
const tempRange = document.createRange();
|
|
167
|
+
tempRange.selectNodeContents(element);
|
|
168
|
+
tempRange.setEnd(range.startContainer, range.startOffset);
|
|
169
|
+
contentUpToCursor = tempRange.toString();
|
|
170
|
+
}
|
|
171
|
+
return contentUpToCursor;
|
|
172
|
+
};
|
|
173
|
+
// Loading animation with three dots changing color
|
|
174
|
+
const startLoadingAnimation = () => {
|
|
175
|
+
const doc = pageViewContext.editorIframe?.contentWindow?.document;
|
|
176
|
+
const span = doc?.getElementById(cursorSpanId);
|
|
177
|
+
if (!doc || !span)
|
|
178
|
+
return;
|
|
179
|
+
// Create dots container
|
|
180
|
+
span.innerHTML = "";
|
|
181
|
+
span.style.display = "inline-flex";
|
|
182
|
+
span.style.gap = "4px";
|
|
183
|
+
span.style.alignItems = "center";
|
|
184
|
+
// Create three dots
|
|
185
|
+
for (let i = 0; i < 3; i++) {
|
|
186
|
+
const dot = doc.createElement("span");
|
|
187
|
+
dot.textContent = "•";
|
|
188
|
+
dot.style.transition = "color 0.3s ease";
|
|
189
|
+
dot.style.color = "#ccc";
|
|
190
|
+
dot.style.fontSize = "16px";
|
|
191
|
+
span.appendChild(dot);
|
|
192
|
+
}
|
|
193
|
+
// Animate dots
|
|
194
|
+
let step = 0;
|
|
195
|
+
const animate = () => {
|
|
196
|
+
const dots = span.querySelectorAll("span");
|
|
197
|
+
dots.forEach((dot, index) => {
|
|
198
|
+
if (index === step % 3) {
|
|
199
|
+
dot.style.color = "#666";
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
dot.style.color = "#ccc";
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
step++;
|
|
206
|
+
loadingAnimationRef.current = requestAnimationFrame(() => {
|
|
207
|
+
// Slow down animation by only updating every 15 frames (~250ms at 60fps)
|
|
208
|
+
if (step % 15 === 0) {
|
|
209
|
+
animate();
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
loadingAnimationRef.current = requestAnimationFrame(animate);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
animate();
|
|
217
|
+
};
|
|
218
|
+
const stopLoadingAnimation = () => {
|
|
219
|
+
if (loadingAnimationRef.current) {
|
|
220
|
+
cancelAnimationFrame(loadingAnimationRef.current);
|
|
221
|
+
loadingAnimationRef.current = null;
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
const getCompletion = async (element, isManualTrigger = false) => {
|
|
225
|
+
const contentUpToCursor = getContentUpToCursor(element);
|
|
226
|
+
if (!contentUpToCursor?.trim())
|
|
227
|
+
return null;
|
|
228
|
+
// Abort any in-flight request
|
|
229
|
+
if (abortControllerRef.current) {
|
|
230
|
+
abortControllerRef.current.abort();
|
|
231
|
+
}
|
|
232
|
+
// Create a new abort controller for this request
|
|
233
|
+
abortControllerRef.current = new AbortController();
|
|
234
|
+
const signal = abortControllerRef.current.signal;
|
|
235
|
+
// Get field attributes
|
|
236
|
+
const fieldId = element.getAttribute("data-fieldid");
|
|
237
|
+
const fieldName = element.getAttribute("data-fieldname");
|
|
238
|
+
const itemId = element.getAttribute("data-itemid");
|
|
239
|
+
const language = element.getAttribute("data-language");
|
|
240
|
+
const version = element.getAttribute("data-version");
|
|
241
|
+
if (!fieldId || !itemId || !language || !version)
|
|
242
|
+
return null;
|
|
243
|
+
// Only trigger completion after a space for automatic completions
|
|
244
|
+
// Manual triggers (Ctrl+Space) can work anywhere
|
|
245
|
+
if (!isManualTrigger) {
|
|
246
|
+
const lastChar = contentUpToCursor.slice(-1);
|
|
247
|
+
if (lastChar !== " " && lastChar !== "\u00A0") {
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (!editContext)
|
|
252
|
+
return null;
|
|
253
|
+
// Get page context for better completions
|
|
254
|
+
let pageContext = getCachedContext(editContext);
|
|
255
|
+
if (!pageContext) {
|
|
256
|
+
try {
|
|
257
|
+
pageContext = await generatePageContext(editContext, pageViewContext);
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
console.warn("Failed to generate page context:", error);
|
|
261
|
+
// Continue without context
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
// Create context-aware completion prompt
|
|
265
|
+
const systemPrompt = pageContext
|
|
266
|
+
? `You are a content completion tool for a ${pageContext.pageType} page titled "${pageContext.pageTitle}".
|
|
267
|
+
|
|
268
|
+
Page context: ${pageContext.abstract}
|
|
269
|
+
|
|
270
|
+
Field being edited: ${fieldName || fieldId}
|
|
271
|
+
|
|
272
|
+
ONLY provide the completion text (what comes after the user's text), never repeat any part of what the user wrote. Your completion should flow naturally from the user's text and be relevant to the page context and field being edited.`
|
|
273
|
+
: "You are a sentence completion tool. ONLY provide the completion text (what comes after the user's text), never repeat any part of what the user wrote. Your completion should flow naturally from the user's text.";
|
|
274
|
+
const messages = [
|
|
275
|
+
{
|
|
276
|
+
name: "system",
|
|
277
|
+
role: "system",
|
|
278
|
+
content: systemPrompt,
|
|
279
|
+
id: crypto.randomUUID(), // Use proper UUID instead of Date.now()
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: "user",
|
|
283
|
+
role: "user",
|
|
284
|
+
content: `Complete this text. ONLY provide the completion (do not repeat my text): ${contentUpToCursor}`,
|
|
285
|
+
id: crypto.randomUUID(), // Use proper UUID instead of Date.now()
|
|
286
|
+
},
|
|
287
|
+
];
|
|
288
|
+
// Show loading indicator
|
|
289
|
+
setIsLoading(true);
|
|
290
|
+
startLoadingAnimation();
|
|
291
|
+
try {
|
|
292
|
+
const result = await executePrompt(messages, {
|
|
293
|
+
promptData: {
|
|
294
|
+
itemid: itemId,
|
|
295
|
+
language,
|
|
296
|
+
version,
|
|
297
|
+
fieldid: fieldId,
|
|
298
|
+
fieldname: fieldName,
|
|
299
|
+
content: contentUpToCursor,
|
|
300
|
+
},
|
|
301
|
+
}, { model: "gpt-4.1-nano", sessionId: editContext.sessionId }, { signal });
|
|
302
|
+
return result;
|
|
303
|
+
}
|
|
304
|
+
catch (error) {
|
|
305
|
+
// Ignore AbortError as it's expected when cancelling
|
|
306
|
+
if (error instanceof Error && error.name !== "AbortError") {
|
|
307
|
+
console.error("Error getting completion:", error);
|
|
308
|
+
}
|
|
309
|
+
return null;
|
|
310
|
+
}
|
|
311
|
+
finally {
|
|
312
|
+
// Hide loading indicator
|
|
313
|
+
setIsLoading(false);
|
|
314
|
+
stopLoadingAnimation();
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
// Debounced AI call: recompute the sentence, call getCompletion, and extract only the "tail" for the ghost text
|
|
318
|
+
const getCompletionDebounced = useDebouncedCallback(async (isManualTrigger = false) => {
|
|
319
|
+
const el = fieldsContext?.inlineEditingFieldElement;
|
|
320
|
+
if (!el)
|
|
321
|
+
return;
|
|
322
|
+
// 1) Recompute the exact sentence at this moment
|
|
323
|
+
const full = getContentUpToCursor(el) || "";
|
|
324
|
+
const sentence = full.split(/[.?!]\s*/).pop() || "";
|
|
325
|
+
// 2) Ask AI for a completion
|
|
326
|
+
const result = await getCompletion(el, isManualTrigger);
|
|
327
|
+
const rawSuggestion = result?.messages?.[0]?.content;
|
|
328
|
+
if (!rawSuggestion) {
|
|
329
|
+
setCurrentCompletion(null);
|
|
330
|
+
clearCursorSpan();
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
// 3) Strip off the already-typed sentence to leave just the "completion tail"
|
|
334
|
+
const suggestion = rawSuggestion.startsWith(sentence)
|
|
335
|
+
? rawSuggestion
|
|
336
|
+
: sentence + rawSuggestion;
|
|
337
|
+
setCurrentCompletion(suggestion);
|
|
338
|
+
updateCursorSpan(suggestion.substring(sentence.length));
|
|
339
|
+
}, 250);
|
|
340
|
+
// Manual completion trigger (non-debounced for immediate response)
|
|
341
|
+
const getCompletionManual = async () => {
|
|
342
|
+
const el = fieldsContext?.inlineEditingFieldElement;
|
|
343
|
+
if (!el)
|
|
344
|
+
return;
|
|
345
|
+
// 1) Recompute the exact sentence at this moment
|
|
346
|
+
const full = getContentUpToCursor(el) || "";
|
|
347
|
+
const sentence = full.split(/[.?!]\s*/).pop() || "";
|
|
348
|
+
// 2) Ask AI for a completion
|
|
349
|
+
const result = await getCompletion(el, true);
|
|
350
|
+
const rawSuggestion = result?.messages?.[0]?.content;
|
|
351
|
+
if (!rawSuggestion) {
|
|
352
|
+
setCurrentCompletion(null);
|
|
353
|
+
clearCursorSpan();
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
// 3) Strip off the already-typed sentence to leave just the "completion tail"
|
|
357
|
+
const suggestion = rawSuggestion.startsWith(sentence)
|
|
358
|
+
? rawSuggestion
|
|
359
|
+
: sentence + rawSuggestion;
|
|
360
|
+
setCurrentCompletion(suggestion);
|
|
361
|
+
updateCursorSpan(suggestion.substring(sentence.length));
|
|
362
|
+
};
|
|
363
|
+
// Inserts or clears the ghost text inside the cursor span
|
|
364
|
+
const updateCursorSpan = (text) => {
|
|
365
|
+
const doc = pageViewContext.editorIframe?.contentWindow?.document;
|
|
366
|
+
const span = doc?.getElementById(cursorSpanId);
|
|
367
|
+
if (!doc || !span)
|
|
368
|
+
return;
|
|
369
|
+
// Update the completion text
|
|
370
|
+
if (text) {
|
|
371
|
+
// // Create a temporary span to measure the text width
|
|
372
|
+
// const measureSpan = doc.createElement("span");
|
|
373
|
+
// measureSpan.style.visibility = "hidden";
|
|
374
|
+
// measureSpan.style.position = "absolute";
|
|
375
|
+
// measureSpan.style.whiteSpace = "pre"; // Preserve whitespace
|
|
376
|
+
// measureSpan.style.font = window.getComputedStyle(span).font; // Match the font
|
|
377
|
+
// measureSpan.textContent = text;
|
|
378
|
+
// doc.body.appendChild(measureSpan);
|
|
379
|
+
// const textWidth = measureSpan.getBoundingClientRect().width;
|
|
380
|
+
// measureSpan.remove();
|
|
381
|
+
span.textContent = text;
|
|
382
|
+
span.style.color = "#888";
|
|
383
|
+
span.style.fontStyle = "italic";
|
|
384
|
+
//span.innerHTML = "hello";
|
|
385
|
+
// Create or update hint element in the main document
|
|
386
|
+
let hintElement = document.getElementById(`${cursorSpanId}-hint`);
|
|
387
|
+
if (!hintElement) {
|
|
388
|
+
hintElement = document.createElement("div");
|
|
389
|
+
hintElement.id = `${cursorSpanId}-hint`;
|
|
390
|
+
document.body.appendChild(hintElement);
|
|
391
|
+
}
|
|
392
|
+
hintElement.textContent = "Press Tab to accept ⇥";
|
|
393
|
+
// Apply styles that match Tailwind's utility classes
|
|
394
|
+
Object.assign(hintElement.style, {
|
|
395
|
+
position: "fixed",
|
|
396
|
+
fontSize: "12px",
|
|
397
|
+
fontWeight: "normal",
|
|
398
|
+
color: "rgb(75, 85, 99)",
|
|
399
|
+
backgroundColor: "white",
|
|
400
|
+
padding: "0.5rem",
|
|
401
|
+
marginLeft: "0.25rem",
|
|
402
|
+
marginRight: "0.25rem",
|
|
403
|
+
borderRadius: "0.25rem",
|
|
404
|
+
border: "1px solid rgb(229, 231, 235)",
|
|
405
|
+
fontStyle: "normal",
|
|
406
|
+
display: "block",
|
|
407
|
+
lineHeight: "1.4",
|
|
408
|
+
zIndex: "9999",
|
|
409
|
+
pointerEvents: "none",
|
|
410
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
|
|
411
|
+
});
|
|
412
|
+
// Position the hint element relative to the iframe and cursor span
|
|
413
|
+
const iframeRect = pageViewContext.editorIframe?.getBoundingClientRect();
|
|
414
|
+
const spanRect = span.getBoundingClientRect();
|
|
415
|
+
if (iframeRect) {
|
|
416
|
+
// Create a range for the last character to get proper position
|
|
417
|
+
const textLength = span.textContent?.length || 0;
|
|
418
|
+
if (textLength > 0 && span.firstChild) {
|
|
419
|
+
const range = doc.createRange();
|
|
420
|
+
range.setStart(span.firstChild, Math.max(0, textLength - 1));
|
|
421
|
+
range.setEnd(span.firstChild, textLength);
|
|
422
|
+
const rangeRect = range.getBoundingClientRect();
|
|
423
|
+
// Position at the end of the actual text
|
|
424
|
+
const absoluteLeft = iframeRect.left + rangeRect.right;
|
|
425
|
+
const absoluteTop = iframeRect.top + rangeRect.top;
|
|
426
|
+
hintElement.style.left = `${absoluteLeft}px`;
|
|
427
|
+
hintElement.style.top = `${absoluteTop}px`;
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
// Fallback to the old positioning if there's no text
|
|
431
|
+
const absoluteLeft = iframeRect.left + spanRect.right;
|
|
432
|
+
const absoluteTop = iframeRect.top + spanRect.top;
|
|
433
|
+
hintElement.style.left = `${absoluteLeft}px`;
|
|
434
|
+
hintElement.style.top = `${absoluteTop}px`;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
span.textContent = "";
|
|
440
|
+
// Remove hint element if it exists
|
|
441
|
+
const hintElement = document.getElementById(`${cursorSpanId}-hint`);
|
|
442
|
+
if (hintElement) {
|
|
443
|
+
hintElement.remove();
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
const clearCursorSpan = () => {
|
|
448
|
+
const doc = pageViewContext.editorIframe?.contentWindow?.document;
|
|
449
|
+
if (!doc)
|
|
450
|
+
return;
|
|
451
|
+
// Clear the completion text
|
|
452
|
+
updateCursorSpan("");
|
|
453
|
+
};
|
|
454
|
+
// On every input: either reuse the existing suggestion or fire a new one
|
|
455
|
+
const handleInput = useCallback((e) => {
|
|
456
|
+
const el = fieldsContext?.inlineEditingFieldElement;
|
|
457
|
+
if (!el)
|
|
458
|
+
return;
|
|
459
|
+
// Clear completion when Escape is pressed
|
|
460
|
+
if (e.key === "Escape") {
|
|
461
|
+
e.preventDefault();
|
|
462
|
+
e.stopPropagation();
|
|
463
|
+
setCurrentCompletion(null);
|
|
464
|
+
clearCursorSpan();
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
// Request new completion when Ctrl+Space is pressed
|
|
468
|
+
if (e.key === " " && (e.ctrlKey || e.metaKey)) {
|
|
469
|
+
e.preventDefault();
|
|
470
|
+
e.stopPropagation();
|
|
471
|
+
setCurrentCompletion(null);
|
|
472
|
+
clearCursorSpan();
|
|
473
|
+
getCompletionManual();
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
// Apply completion when Tab is pressed
|
|
477
|
+
if (e.key === "Tab") {
|
|
478
|
+
// Check if there's an actual completion in the cursor span
|
|
479
|
+
const cursorSpan = pageViewContext.editorIframe?.contentWindow?.document.getElementById(cursorSpanId);
|
|
480
|
+
if (cursorSpan &&
|
|
481
|
+
cursorSpan.textContent &&
|
|
482
|
+
cursorSpan.textContent.trim() !== "") {
|
|
483
|
+
e.preventDefault();
|
|
484
|
+
e.stopPropagation();
|
|
485
|
+
applyCompletion();
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
const full = getContentUpToCursor(el) || "";
|
|
490
|
+
const sentence = full.split(/[.?!]\s*/).pop() || "";
|
|
491
|
+
// If we already have a suggestion, check if the user is still typing along it
|
|
492
|
+
// Normalize spaces to handle both regular and non-breaking spaces
|
|
493
|
+
const normalizedSentence = sentence.replace(/\s/g, " ");
|
|
494
|
+
const normalizedCompletion = currentCompletion?.replace(/\s/g, " ");
|
|
495
|
+
if (normalizedCompletion &&
|
|
496
|
+
normalizedCompletion.startsWith(normalizedSentence)) {
|
|
497
|
+
// user is still matching the suggestion → update the remaining tail
|
|
498
|
+
const remaining = normalizedCompletion.slice(normalizedSentence.length);
|
|
499
|
+
updateCursorSpan(remaining);
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
// else: user diverged → drop it
|
|
503
|
+
setCurrentCompletion(null);
|
|
504
|
+
clearCursorSpan();
|
|
505
|
+
// No active suggestion → fire new request once they've typed 2+ words
|
|
506
|
+
const words = sentence.trim().split(/\s+/).filter(Boolean);
|
|
507
|
+
// Check if cursor is at the end of the text
|
|
508
|
+
const isAtEnd = () => {
|
|
509
|
+
const el = fieldsContext?.inlineEditingFieldElement;
|
|
510
|
+
if (!el)
|
|
511
|
+
return false;
|
|
512
|
+
const iframeWindow = pageViewContext.editorIframe?.contentWindow;
|
|
513
|
+
const selection = iframeWindow?.getSelection();
|
|
514
|
+
if (!selection || selection.rangeCount === 0)
|
|
515
|
+
return false;
|
|
516
|
+
const range = selection.getRangeAt(0);
|
|
517
|
+
// Create a range for the whole editable element
|
|
518
|
+
const fullRange = document.createRange();
|
|
519
|
+
fullRange.selectNodeContents(el);
|
|
520
|
+
// Get the full text content
|
|
521
|
+
const fullText = el.textContent || "";
|
|
522
|
+
// Get text up to cursor
|
|
523
|
+
const tempRange = document.createRange();
|
|
524
|
+
tempRange.selectNodeContents(el);
|
|
525
|
+
tempRange.setEnd(range.startContainer, range.startOffset);
|
|
526
|
+
const textUpToCursor = tempRange.toString();
|
|
527
|
+
// Cursor is at the end if the text up to cursor equals the full text
|
|
528
|
+
// (accounting for whitespace differences)
|
|
529
|
+
return (textUpToCursor.trim() === fullText.trim() ||
|
|
530
|
+
(fullText.trim().startsWith(textUpToCursor.trim()) &&
|
|
531
|
+
fullText.trim().length === textUpToCursor.trim().length));
|
|
532
|
+
};
|
|
533
|
+
if (words.length >= 2 && isAtEnd()) {
|
|
534
|
+
getCompletionDebounced();
|
|
535
|
+
}
|
|
536
|
+
else {
|
|
537
|
+
setCurrentCompletion(null);
|
|
538
|
+
clearCursorSpan();
|
|
539
|
+
}
|
|
540
|
+
}, [
|
|
541
|
+
fieldsContext?.inlineEditingFieldElement,
|
|
542
|
+
currentCompletion,
|
|
543
|
+
getCompletionDebounced,
|
|
544
|
+
getCompletionManual,
|
|
545
|
+
]);
|
|
546
|
+
// Wire up the input listener
|
|
547
|
+
useEffect(() => {
|
|
548
|
+
if (!editContext?.enableCompletions)
|
|
549
|
+
return;
|
|
550
|
+
const el = fieldsContext?.inlineEditingFieldElement;
|
|
551
|
+
if (!el)
|
|
552
|
+
return;
|
|
553
|
+
el.addEventListener("keydown", handleInput);
|
|
554
|
+
return () => el.removeEventListener("keydown", handleInput);
|
|
555
|
+
}, [
|
|
556
|
+
fieldsContext?.inlineEditingFieldElement,
|
|
557
|
+
handleInput,
|
|
558
|
+
editContext?.enableCompletions,
|
|
559
|
+
]);
|
|
560
|
+
// Add mouse click handler to update cursor span position
|
|
561
|
+
useEffect(() => {
|
|
562
|
+
if (!editContext?.enableCompletions)
|
|
563
|
+
return;
|
|
564
|
+
const el = fieldsContext?.inlineEditingFieldElement;
|
|
565
|
+
if (!el)
|
|
566
|
+
return;
|
|
567
|
+
const handleMouseUp = () => {
|
|
568
|
+
setTimeout(() => {
|
|
569
|
+
if (!isUpdatingRef.current) {
|
|
570
|
+
positionCursorSpan();
|
|
571
|
+
// Clear existing completion when cursor position changes via mouse
|
|
572
|
+
setCurrentCompletion(null);
|
|
573
|
+
clearCursorSpan();
|
|
574
|
+
}
|
|
575
|
+
}, 10);
|
|
576
|
+
};
|
|
577
|
+
el.addEventListener("mouseup", handleMouseUp);
|
|
578
|
+
return () => el.removeEventListener("mouseup", handleMouseUp);
|
|
579
|
+
}, [
|
|
580
|
+
fieldsContext?.inlineEditingFieldElement,
|
|
581
|
+
editContext?.enableCompletions,
|
|
582
|
+
]);
|
|
583
|
+
// Clean up abort controller on unmount
|
|
584
|
+
useEffect(() => {
|
|
585
|
+
return () => {
|
|
586
|
+
if (abortControllerRef.current) {
|
|
587
|
+
abortControllerRef.current.abort();
|
|
588
|
+
abortControllerRef.current = null;
|
|
589
|
+
}
|
|
590
|
+
if (loadingAnimationRef.current) {
|
|
591
|
+
cancelAnimationFrame(loadingAnimationRef.current);
|
|
592
|
+
loadingAnimationRef.current = null;
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
}, []);
|
|
596
|
+
// Function to apply the completion
|
|
597
|
+
const applyCompletion = () => {
|
|
598
|
+
// Get the cursor span to read the most up-to-date completion
|
|
599
|
+
const iframeWindow = pageViewContext.editorIframe?.contentWindow;
|
|
600
|
+
const iframeDocument = iframeWindow?.document;
|
|
601
|
+
if (!iframeWindow ||
|
|
602
|
+
!iframeDocument ||
|
|
603
|
+
!fieldsContext?.inlineEditingFieldElement)
|
|
604
|
+
return;
|
|
605
|
+
const cursorSpan = iframeDocument.getElementById(cursorSpanId);
|
|
606
|
+
if (!cursorSpan)
|
|
607
|
+
return;
|
|
608
|
+
// Get the completion text directly from the cursor span, which should be the most current
|
|
609
|
+
const completionToApply = cursorSpan.textContent || "";
|
|
610
|
+
if (!completionToApply)
|
|
611
|
+
return;
|
|
612
|
+
const element = fieldsContext?.inlineEditingFieldElement;
|
|
613
|
+
// Get the current selection position
|
|
614
|
+
const selection = iframeWindow.getSelection();
|
|
615
|
+
if (!selection || selection.rangeCount === 0)
|
|
616
|
+
return;
|
|
617
|
+
// Get the text up to the cursor to analyze current word
|
|
618
|
+
const range = selection.getRangeAt(0);
|
|
619
|
+
const tempRange = document.createRange();
|
|
620
|
+
tempRange.selectNodeContents(element);
|
|
621
|
+
tempRange.setEnd(range.startContainer, range.startOffset);
|
|
622
|
+
const textUpToCursor = tempRange.toString();
|
|
623
|
+
// Get the current partial word by finding text from the last word boundary to cursor
|
|
624
|
+
// Look for last word boundary (space, punctuation, etc.)
|
|
625
|
+
const wordBoundaryRegex = /[\s.,;:!?"'()[\]{}<>\/\\|=+\-*&^%$#@~`](?=[^\s.,;:!?"'()[\]{}<>\/\\|=+\-*&^%$#@~`]*$)/;
|
|
626
|
+
const match = textUpToCursor.match(wordBoundaryRegex);
|
|
627
|
+
const lastWordBoundaryIndex = match && match.index !== undefined ? match.index + 1 : 0;
|
|
628
|
+
const currentPartialWord = textUpToCursor
|
|
629
|
+
.substring(lastWordBoundaryIndex)
|
|
630
|
+
.trim();
|
|
631
|
+
// Check if completion overlaps with current partial word
|
|
632
|
+
// (e.g., if user typed "int" and completion is "integer")
|
|
633
|
+
const isOverlapping = currentPartialWord.length > 0 &&
|
|
634
|
+
completionToApply
|
|
635
|
+
.toLowerCase()
|
|
636
|
+
.startsWith(currentPartialWord.toLowerCase());
|
|
637
|
+
console.log("Is overlapping:", isOverlapping);
|
|
638
|
+
// If there's overlap, we need to delete the current partial word
|
|
639
|
+
if (isOverlapping) {
|
|
640
|
+
// Create a range to select the current partial word
|
|
641
|
+
const wordRange = document.createRange();
|
|
642
|
+
// Position where the current word starts
|
|
643
|
+
let startContainer = range.startContainer;
|
|
644
|
+
let startOffset = range.startOffset - currentPartialWord.length;
|
|
645
|
+
// We need to handle the case where the word spans multiple text nodes
|
|
646
|
+
// For simplicity, we'll try to handle the common case first
|
|
647
|
+
if (startOffset >= 0 && startContainer.nodeType === Node.TEXT_NODE) {
|
|
648
|
+
// Simple case: word is in the same text node as cursor
|
|
649
|
+
wordRange.setStart(startContainer, startOffset);
|
|
650
|
+
wordRange.setEnd(range.startContainer, range.startOffset);
|
|
651
|
+
wordRange.deleteContents(); // Delete the partial word
|
|
652
|
+
}
|
|
653
|
+
else {
|
|
654
|
+
// Complex case: use a simpler approach - just insert, user can delete manually if needed
|
|
655
|
+
// This is a fallback for complex DOM structures
|
|
656
|
+
// Add a space if we're in the middle of a sentence
|
|
657
|
+
if (textUpToCursor.length > 0 && !textUpToCursor.endsWith(" ")) {
|
|
658
|
+
const spaceNode = document.createTextNode(" ");
|
|
659
|
+
range.insertNode(spaceNode);
|
|
660
|
+
range.setStartAfter(spaceNode);
|
|
661
|
+
range.setEndAfter(spaceNode);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
else {
|
|
666
|
+
// Not overlapping, add a space if we're in the middle of text
|
|
667
|
+
// and not already at the beginning of text or after a space
|
|
668
|
+
if (textUpToCursor.length > 0 &&
|
|
669
|
+
!textUpToCursor.endsWith(" ") &&
|
|
670
|
+
// Don't add space at the start of a line or after punctuation that shouldn't have a space
|
|
671
|
+
!textUpToCursor.endsWith("\n") &&
|
|
672
|
+
!/[.!?\-—:;({[\s]$/.test(textUpToCursor)) {
|
|
673
|
+
const spaceNode = document.createTextNode(" ");
|
|
674
|
+
range.insertNode(spaceNode);
|
|
675
|
+
range.setStartAfter(spaceNode);
|
|
676
|
+
range.setEndAfter(spaceNode);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
// Now insert the completion text
|
|
680
|
+
const textNode = document.createTextNode(isOverlapping
|
|
681
|
+
? completionToApply // If overlapping, use the full completion
|
|
682
|
+
: completionToApply);
|
|
683
|
+
range.insertNode(textNode);
|
|
684
|
+
// Move the cursor after the inserted text
|
|
685
|
+
range.setStartAfter(textNode);
|
|
686
|
+
range.setEndAfter(textNode);
|
|
687
|
+
selection.removeAllRanges();
|
|
688
|
+
selection.addRange(range);
|
|
689
|
+
setCurrentCompletion(null);
|
|
690
|
+
clearCursorSpan();
|
|
691
|
+
};
|
|
692
|
+
// Exposed manual trigger (if needed)
|
|
693
|
+
return useMemo(() => () => {
|
|
694
|
+
setCurrentCompletion(null);
|
|
695
|
+
clearCursorSpan();
|
|
696
|
+
getCompletionManual();
|
|
697
|
+
}, [getCompletionManual]);
|
|
698
|
+
}
|
|
699
|
+
//# sourceMappingURL=useInlineAICompletion.js.map
|