@alpaca-editor/core 1.0.0 → 1.0.3
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/build.css +3 -0
- package/components.json +21 -0
- package/dev.css +3 -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 +16 -0
- package/dist/client-components/index.js +17 -0
- package/dist/client-components/index.js.map +1 -0
- package/dist/components/ActionButton.d.ts +12 -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/ui/button.d.ts +10 -0
- package/dist/components/ui/button.js +32 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/config/config.d.ts +6 -0
- package/dist/config/config.js +647 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/types.d.ts +223 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/editor/ComponentInfo.d.ts +4 -0
- package/dist/editor/ComponentInfo.js +29 -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 +35 -0
- package/dist/editor/ContentTree.js +404 -0
- package/dist/editor/ContentTree.js.map +1 -0
- package/dist/editor/ContextMenu.d.ts +13 -0
- package/dist/editor/ContextMenu.js +114 -0
- package/dist/editor/ContextMenu.js.map +1 -0
- package/dist/editor/Editor.d.ts +11 -0
- package/dist/editor/Editor.js +50 -0
- package/dist/editor/Editor.js.map +1 -0
- package/dist/editor/EditorWarning.d.ts +5 -0
- package/dist/editor/EditorWarning.js +11 -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/FieldEditorPopup.d.ts +10 -0
- package/dist/editor/FieldEditorPopup.js +22 -0
- package/dist/editor/FieldEditorPopup.js.map +1 -0
- package/dist/editor/FieldHistory.d.ts +6 -0
- package/dist/editor/FieldHistory.js +38 -0
- package/dist/editor/FieldHistory.js.map +1 -0
- package/dist/editor/FieldList.d.ts +16 -0
- package/dist/editor/FieldList.js +58 -0
- package/dist/editor/FieldList.js.map +1 -0
- package/dist/editor/FieldListField.d.ts +14 -0
- package/dist/editor/FieldListField.js +161 -0
- package/dist/editor/FieldListField.js.map +1 -0
- package/dist/editor/FieldListFieldWithFallbacks.d.ts +10 -0
- package/dist/editor/FieldListFieldWithFallbacks.js +109 -0
- package/dist/editor/FieldListFieldWithFallbacks.js.map +1 -0
- package/dist/editor/FloatingToolbar.d.ts +7 -0
- package/dist/editor/FloatingToolbar.js +90 -0
- package/dist/editor/FloatingToolbar.js.map +1 -0
- package/dist/editor/ImageEditor.d.ts +5 -0
- package/dist/editor/ImageEditor.js +53 -0
- package/dist/editor/ImageEditor.js.map +1 -0
- package/dist/editor/InsertMenu.d.ts +8 -0
- package/dist/editor/InsertMenu.js +158 -0
- package/dist/editor/InsertMenu.js.map +1 -0
- package/dist/editor/ItemInfo.d.ts +4 -0
- package/dist/editor/ItemInfo.js +28 -0
- package/dist/editor/ItemInfo.js.map +1 -0
- package/dist/editor/LinkEditorDialog.d.ts +15 -0
- package/dist/editor/LinkEditorDialog.js +84 -0
- package/dist/editor/LinkEditorDialog.js.map +1 -0
- package/dist/editor/MainLayout.d.ts +9 -0
- package/dist/editor/MainLayout.js +41 -0
- package/dist/editor/MainLayout.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 +327 -0
- package/dist/editor/PictureCropper.js.map +1 -0
- package/dist/editor/PictureEditor.d.ts +8 -0
- package/dist/editor/PictureEditor.js +102 -0
- package/dist/editor/PictureEditor.js.map +1 -0
- package/dist/editor/PictureEditorDialog.d.ts +8 -0
- package/dist/editor/PictureEditorDialog.js +189 -0
- package/dist/editor/PictureEditorDialog.js.map +1 -0
- package/dist/editor/ScrollingContentTree.d.ts +6 -0
- package/dist/editor/ScrollingContentTree.js +25 -0
- package/dist/editor/ScrollingContentTree.js.map +1 -0
- package/dist/editor/Terminal.d.ts +14 -0
- package/dist/editor/Terminal.js +107 -0
- package/dist/editor/Terminal.js.map +1 -0
- package/dist/editor/Titlebar.d.ts +1 -0
- package/dist/editor/Titlebar.js +9 -0
- package/dist/editor/Titlebar.js.map +1 -0
- package/dist/editor/ai/AiPopup.d.ts +10 -0
- package/dist/editor/ai/AiPopup.js +23 -0
- package/dist/editor/ai/AiPopup.js.map +1 -0
- package/dist/editor/ai/AiResponseMessage.d.ts +8 -0
- package/dist/editor/ai/AiResponseMessage.js +22 -0
- package/dist/editor/ai/AiResponseMessage.js.map +1 -0
- package/dist/editor/ai/AiTerminal.d.ts +34 -0
- package/dist/editor/ai/AiTerminal.js +236 -0
- package/dist/editor/ai/AiTerminal.js.map +1 -0
- package/dist/editor/ai/AiToolCall.d.ts +9 -0
- package/dist/editor/ai/AiToolCall.js +16 -0
- package/dist/editor/ai/AiToolCall.js.map +1 -0
- package/dist/editor/ai/EditorAiTerminal.d.ts +5 -0
- package/dist/editor/ai/EditorAiTerminal.js +7 -0
- package/dist/editor/ai/EditorAiTerminal.js.map +1 -0
- package/dist/editor/ai/editorAiContext.d.ts +11 -0
- package/dist/editor/ai/editorAiContext.js +12 -0
- package/dist/editor/ai/editorAiContext.js.map +1 -0
- package/dist/editor/client/DialogContext.d.ts +12 -0
- package/dist/editor/client/DialogContext.js +25 -0
- package/dist/editor/client/DialogContext.js.map +1 -0
- package/dist/editor/client/EditorClient.d.ts +26 -0
- package/dist/editor/client/EditorClient.js +1298 -0
- package/dist/editor/client/EditorClient.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 +199 -0
- package/dist/editor/client/editContext.js +20 -0
- package/dist/editor/client/editContext.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/itemsRepository.d.ts +24 -0
- package/dist/editor/client/itemsRepository.js +253 -0
- package/dist/editor/client/itemsRepository.js.map +1 -0
- package/dist/editor/client/operations.d.ts +57 -0
- package/dist/editor/client/operations.js +393 -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 +127 -0
- package/dist/editor/client/pageModelBuilder.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 +13 -0
- package/dist/editor/commands/componentCommands.js +271 -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 +17 -0
- package/dist/editor/commands/itemCommands.js +132 -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 +89 -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/component-designer/ComponentDesigner.d.ts +1 -0
- package/dist/editor/component-designer/ComponentDesigner.js +56 -0
- package/dist/editor/component-designer/ComponentDesigner.js.map +1 -0
- package/dist/editor/component-designer/ComponentDesignerAiTerminal.d.ts +1 -0
- package/dist/editor/component-designer/ComponentDesignerAiTerminal.js +7 -0
- package/dist/editor/component-designer/ComponentDesignerAiTerminal.js.map +1 -0
- package/dist/editor/component-designer/ComponentDesignerMenu.d.ts +1 -0
- package/dist/editor/component-designer/ComponentDesignerMenu.js +65 -0
- package/dist/editor/component-designer/ComponentDesignerMenu.js.map +1 -0
- package/dist/editor/component-designer/ComponentEditor.d.ts +4 -0
- package/dist/editor/component-designer/ComponentEditor.js +57 -0
- package/dist/editor/component-designer/ComponentEditor.js.map +1 -0
- package/dist/editor/component-designer/ComponentRenderingCodeEditor.d.ts +5 -0
- package/dist/editor/component-designer/ComponentRenderingCodeEditor.js +11 -0
- package/dist/editor/component-designer/ComponentRenderingCodeEditor.js.map +1 -0
- package/dist/editor/component-designer/ComponentRenderingEditor.d.ts +1 -0
- package/dist/editor/component-designer/ComponentRenderingEditor.js +69 -0
- package/dist/editor/component-designer/ComponentRenderingEditor.js.map +1 -0
- package/dist/editor/component-designer/ComponentsDropdown.d.ts +4 -0
- package/dist/editor/component-designer/ComponentsDropdown.js +20 -0
- package/dist/editor/component-designer/ComponentsDropdown.js.map +1 -0
- package/dist/editor/component-designer/PlaceholdersEditor.d.ts +4 -0
- package/dist/editor/component-designer/PlaceholdersEditor.js +68 -0
- package/dist/editor/component-designer/PlaceholdersEditor.js.map +1 -0
- package/dist/editor/component-designer/RenderingsDropdown.d.ts +1 -0
- package/dist/editor/component-designer/RenderingsDropdown.js +23 -0
- package/dist/editor/component-designer/RenderingsDropdown.js.map +1 -0
- package/dist/editor/component-designer/TemplateEditor.d.ts +1 -0
- package/dist/editor/component-designer/TemplateEditor.js +142 -0
- package/dist/editor/component-designer/TemplateEditor.js.map +1 -0
- package/dist/editor/component-designer/aiContext.d.ts +5 -0
- package/dist/editor/component-designer/aiContext.js +16 -0
- package/dist/editor/component-designer/aiContext.js.map +1 -0
- package/dist/editor/componentTreeHelper.d.ts +16 -0
- package/dist/editor/componentTreeHelper.js +87 -0
- package/dist/editor/componentTreeHelper.js.map +1 -0
- package/dist/editor/control-center/ControlCenterMenu.d.ts +1 -0
- package/dist/editor/control-center/ControlCenterMenu.js +57 -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 +25 -0
- package/dist/editor/control-center/IndexOverview.js.map +1 -0
- package/dist/editor/control-center/IndexSettings.d.ts +5 -0
- package/dist/editor/control-center/IndexSettings.js +104 -0
- package/dist/editor/control-center/IndexSettings.js.map +1 -0
- package/dist/editor/control-center/Status.d.ts +1 -0
- package/dist/editor/control-center/Status.js +5 -0
- package/dist/editor/control-center/Status.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 +12 -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 +25 -0
- package/dist/editor/editor-warnings/ValidationErrors.js.map +1 -0
- package/dist/editor/field-types/AttachmentEditor.d.ts +4 -0
- package/dist/editor/field-types/AttachmentEditor.js +5 -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/DropLinkEditor.d.ts +5 -0
- package/dist/editor/field-types/DropLinkEditor.js +49 -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 +56 -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 +59 -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 +56 -0
- package/dist/editor/field-types/LinkFieldEditor.js.map +1 -0
- package/dist/editor/field-types/MultiLineText.d.ts +6 -0
- package/dist/editor/field-types/MultiLineText.js +33 -0
- package/dist/editor/field-types/MultiLineText.js.map +1 -0
- package/dist/editor/field-types/PictureFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/PictureFieldEditor.js +57 -0
- package/dist/editor/field-types/PictureFieldEditor.js.map +1 -0
- package/dist/editor/field-types/RawEditor.d.ts +5 -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 +5 -0
- package/dist/editor/field-types/RichTextEditor.js +8 -0
- package/dist/editor/field-types/RichTextEditor.js.map +1 -0
- package/dist/editor/field-types/RichTextEditorComponent.d.ts +6 -0
- package/dist/editor/field-types/RichTextEditorComponent.js +70 -0
- package/dist/editor/field-types/RichTextEditorComponent.js.map +1 -0
- package/dist/editor/field-types/SingleLineText.d.ts +6 -0
- package/dist/editor/field-types/SingleLineText.js +90 -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 +132 -0
- package/dist/editor/field-types/TreeListEditor.js.map +1 -0
- package/dist/editor/fieldTypes.d.ts +117 -0
- package/dist/editor/fieldTypes.js +2 -0
- package/dist/editor/fieldTypes.js.map +1 -0
- package/dist/editor/media-selector/AiImageSearch.d.ts +4 -0
- package/dist/editor/media-selector/AiImageSearch.js +105 -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 +56 -0
- package/dist/editor/media-selector/AiImageSearchPrompt.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 +7 -0
- package/dist/editor/media-selector/Preview.js.map +1 -0
- package/dist/editor/media-selector/Thumbnails.d.ts +13 -0
- package/dist/editor/media-selector/Thumbnails.js +9 -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 +165 -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 +78 -0
- package/dist/editor/media-selector/UploadZone.js.map +1 -0
- package/dist/editor/menubar/ActionsMenu.d.ts +1 -0
- package/dist/editor/menubar/ActionsMenu.js +31 -0
- package/dist/editor/menubar/ActionsMenu.js.map +1 -0
- package/dist/editor/menubar/ActiveUsers.d.ts +1 -0
- package/dist/editor/menubar/ActiveUsers.js +11 -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 +11 -0
- package/dist/editor/menubar/ApproveAndPublish.js.map +1 -0
- package/dist/editor/menubar/BrowseHistory.d.ts +6 -0
- package/dist/editor/menubar/BrowseHistory.js +12 -0
- package/dist/editor/menubar/BrowseHistory.js.map +1 -0
- package/dist/editor/menubar/ItemLanguageVersion.d.ts +1 -0
- package/dist/editor/menubar/ItemLanguageVersion.js +34 -0
- package/dist/editor/menubar/ItemLanguageVersion.js.map +1 -0
- package/dist/editor/menubar/LanguageSelector.d.ts +9 -0
- package/dist/editor/menubar/LanguageSelector.js +31 -0
- package/dist/editor/menubar/LanguageSelector.js.map +1 -0
- package/dist/editor/menubar/Menu.d.ts +1 -0
- package/dist/editor/menubar/Menu.js +63 -0
- package/dist/editor/menubar/Menu.js.map +1 -0
- package/dist/editor/menubar/NavButtons.d.ts +1 -0
- package/dist/editor/menubar/NavButtons.js +41 -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 +48 -0
- package/dist/editor/menubar/PageSelector.js.map +1 -0
- package/dist/editor/menubar/PageViewerControls.d.ts +1 -0
- package/dist/editor/menubar/PageViewerControls.js +35 -0
- package/dist/editor/menubar/PageViewerControls.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/User.d.ts +4 -0
- package/dist/editor/menubar/User.js +16 -0
- package/dist/editor/menubar/User.js.map +1 -0
- package/dist/editor/menubar/VersionSelector.d.ts +9 -0
- package/dist/editor/menubar/VersionSelector.js +47 -0
- package/dist/editor/menubar/VersionSelector.js.map +1 -0
- package/dist/editor/page-editor-chrome/CommentHighlighting.d.ts +6 -0
- package/dist/editor/page-editor-chrome/CommentHighlighting.js +212 -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 +25 -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 +25 -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 +13 -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 +176 -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 +99 -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 +63 -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 +107 -0
- package/dist/editor/page-editor-chrome/PictureEditorOverlay.js.map +1 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.d.ts +14 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +80 -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 +145 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js.map +1 -0
- package/dist/editor/page-viewer/DeviceToolbar.d.ts +6 -0
- package/dist/editor/page-viewer/DeviceToolbar.js +19 -0
- package/dist/editor/page-viewer/DeviceToolbar.js.map +1 -0
- package/dist/editor/page-viewer/EditorForm.d.ts +5 -0
- package/dist/editor/page-viewer/EditorForm.js +128 -0
- package/dist/editor/page-viewer/EditorForm.js.map +1 -0
- package/dist/editor/page-viewer/MiniMap.d.ts +9 -0
- package/dist/editor/page-viewer/MiniMap.js +222 -0
- package/dist/editor/page-viewer/MiniMap.js.map +1 -0
- package/dist/editor/page-viewer/PageViewer.d.ts +8 -0
- package/dist/editor/page-viewer/PageViewer.js +62 -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 +690 -0
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -0
- package/dist/editor/page-viewer/pageViewContext.d.ts +38 -0
- package/dist/editor/page-viewer/pageViewContext.js +115 -0
- package/dist/editor/page-viewer/pageViewContext.js.map +1 -0
- package/dist/editor/pageModel.d.ts +171 -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 +4 -0
- package/dist/editor/reviews/Comment.js +114 -0
- package/dist/editor/reviews/Comment.js.map +1 -0
- package/dist/editor/reviews/Comments.d.ts +1 -0
- package/dist/editor/reviews/Comments.js +22 -0
- package/dist/editor/reviews/Comments.js.map +1 -0
- package/dist/editor/reviews/PreviewInfo.d.ts +1 -0
- package/dist/editor/reviews/PreviewInfo.js +11 -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 +160 -0
- package/dist/editor/reviews/Reviews.js.map +1 -0
- package/dist/editor/reviews/reviewCommands.d.ts +3 -0
- package/dist/editor/reviews/reviewCommands.js +42 -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/aiService.d.ts +34 -0
- package/dist/editor/services/aiService.js +95 -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 +34 -0
- package/dist/editor/services/contentService.js +92 -0
- package/dist/editor/services/contentService.js.map +1 -0
- package/dist/editor/services/editService.d.ts +34 -0
- package/dist/editor/services/editService.js +294 -0
- package/dist/editor/services/editService.js.map +1 -0
- package/dist/editor/services/indexService.d.ts +6 -0
- package/dist/editor/services/indexService.js +19 -0
- package/dist/editor/services/indexService.js.map +1 -0
- package/dist/editor/services/reviewsService.d.ts +12 -0
- package/dist/editor/services/reviewsService.js +32 -0
- package/dist/editor/services/reviewsService.js.map +1 -0
- package/dist/editor/services/serviceHelper.d.ts +9 -0
- package/dist/editor/services/serviceHelper.js +64 -0
- package/dist/editor/services/serviceHelper.js.map +1 -0
- package/dist/editor/services/systemService.d.ts +2 -0
- package/dist/editor/services/systemService.js +5 -0
- package/dist/editor/services/systemService.js.map +1 -0
- package/dist/editor/services/translationService.d.ts +11 -0
- package/dist/editor/services/translationService.js +11 -0
- package/dist/editor/services/translationService.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/ComponentPalette.d.ts +1 -0
- package/dist/editor/sidebar/ComponentPalette.js +53 -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 +360 -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 +58 -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/EditHistory.d.ts +1 -0
- package/dist/editor/sidebar/EditHistory.js +72 -0
- package/dist/editor/sidebar/EditHistory.js.map +1 -0
- package/dist/editor/sidebar/GraphQL.d.ts +1 -0
- package/dist/editor/sidebar/GraphQL.js +113 -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/MainContentTree.d.ts +4 -0
- package/dist/editor/sidebar/MainContentTree.js +49 -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/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 +8 -0
- package/dist/editor/sidebar/SidebarView.js +74 -0
- package/dist/editor/sidebar/SidebarView.js.map +1 -0
- package/dist/editor/sidebar/Translations.d.ts +1 -0
- package/dist/editor/sidebar/Translations.js +158 -0
- package/dist/editor/sidebar/Translations.js.map +1 -0
- package/dist/editor/sidebar/Validation.d.ts +1 -0
- package/dist/editor/sidebar/Validation.js +50 -0
- package/dist/editor/sidebar/Validation.js.map +1 -0
- package/dist/editor/sidebar/ViewSelector.d.ts +1 -0
- package/dist/editor/sidebar/ViewSelector.js +13 -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 +78 -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/CopyToClipboardButton.d.ts +3 -0
- package/dist/editor/ui/CopyToClipboardButton.js +15 -0
- package/dist/editor/ui/CopyToClipboardButton.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/Icons.d.ts +38 -0
- package/dist/editor/ui/Icons.js +56 -0
- package/dist/editor/ui/Icons.js.map +1 -0
- package/dist/editor/ui/ItemNameDialog.d.ts +11 -0
- package/dist/editor/ui/ItemNameDialog.js +40 -0
- package/dist/editor/ui/ItemNameDialog.js.map +1 -0
- package/dist/editor/ui/ItemNameDialogNew.d.ts +10 -0
- package/dist/editor/ui/ItemNameDialogNew.js +56 -0
- package/dist/editor/ui/ItemNameDialogNew.js.map +1 -0
- package/dist/editor/ui/ItemSearch.d.ts +23 -0
- package/dist/editor/ui/ItemSearch.js +90 -0
- package/dist/editor/ui/ItemSearch.js.map +1 -0
- package/dist/editor/ui/PerfectTree.d.ts +60 -0
- package/dist/editor/ui/PerfectTree.js +187 -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 +10 -0
- package/dist/editor/ui/Section.js.map +1 -0
- package/dist/editor/ui/SimpleIconButton.d.ts +11 -0
- package/dist/editor/ui/SimpleIconButton.js +9 -0
- package/dist/editor/ui/SimpleIconButton.js.map +1 -0
- package/dist/editor/ui/SimpleMenu.d.ts +13 -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 +12 -0
- package/dist/editor/ui/SimpleTabs.js +19 -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 +3 -0
- package/dist/editor/ui/Spinner.js +5 -0
- package/dist/editor/ui/Spinner.js.map +1 -0
- package/dist/editor/ui/Splitter.d.ts +15 -0
- package/dist/editor/ui/Splitter.js +151 -0
- package/dist/editor/ui/Splitter.js.map +1 -0
- package/dist/editor/ui/StackedPanels.d.ts +5 -0
- package/dist/editor/ui/StackedPanels.js +67 -0
- package/dist/editor/ui/StackedPanels.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/itemutils.d.ts +3 -0
- package/dist/editor/utils/itemutils.js +22 -0
- package/dist/editor/utils/itemutils.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 +44 -0
- package/dist/editor/utils.js +309 -0
- package/dist/editor/utils.js.map +1 -0
- package/dist/editor/views/CompareView.d.ts +1 -0
- package/dist/editor/views/CompareView.js +145 -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 +22 -0
- package/dist/editor/views/ItemEditor.js.map +1 -0
- package/dist/editor/views/SingleEditView.d.ts +8 -0
- package/dist/editor/views/SingleEditView.js +23 -0
- package/dist/editor/views/SingleEditView.js.map +1 -0
- package/dist/images/bg-shape-black.webp +0 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/index.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/page-wizard/PageWizard.d.ts +70 -0
- package/dist/page-wizard/PageWizard.js +60 -0
- package/dist/page-wizard/PageWizard.js.map +1 -0
- package/dist/page-wizard/SelectWizard.d.ts +7 -0
- package/dist/page-wizard/SelectWizard.js +41 -0
- package/dist/page-wizard/SelectWizard.js.map +1 -0
- package/dist/page-wizard/WizardSteps.d.ts +8 -0
- package/dist/page-wizard/WizardSteps.js +69 -0
- package/dist/page-wizard/WizardSteps.js.map +1 -0
- package/dist/page-wizard/service.d.ts +15 -0
- package/dist/page-wizard/service.js +22 -0
- package/dist/page-wizard/service.js.map +1 -0
- package/dist/page-wizard/startPageWizardCommand.d.ts +13 -0
- package/dist/page-wizard/startPageWizardCommand.js +21 -0
- package/dist/page-wizard/startPageWizardCommand.js.map +1 -0
- package/dist/page-wizard/steps/BuildPageStep.d.ts +2 -0
- package/dist/page-wizard/steps/BuildPageStep.js +133 -0
- package/dist/page-wizard/steps/BuildPageStep.js.map +1 -0
- package/dist/page-wizard/steps/CollectStep.d.ts +2 -0
- package/dist/page-wizard/steps/CollectStep.js +119 -0
- package/dist/page-wizard/steps/CollectStep.js.map +1 -0
- package/dist/page-wizard/steps/ComponentTypesSelector.d.ts +11 -0
- package/dist/page-wizard/steps/ComponentTypesSelector.js +209 -0
- package/dist/page-wizard/steps/ComponentTypesSelector.js.map +1 -0
- package/dist/page-wizard/steps/Components.d.ts +9 -0
- package/dist/page-wizard/steps/Components.js +89 -0
- package/dist/page-wizard/steps/Components.js.map +1 -0
- package/dist/page-wizard/steps/CreatePage.d.ts +12 -0
- package/dist/page-wizard/steps/CreatePage.js +140 -0
- package/dist/page-wizard/steps/CreatePage.js.map +1 -0
- package/dist/page-wizard/steps/CreatePageAndLayoutStep.d.ts +2 -0
- package/dist/page-wizard/steps/CreatePageAndLayoutStep.js +228 -0
- package/dist/page-wizard/steps/CreatePageAndLayoutStep.js.map +1 -0
- package/dist/page-wizard/steps/EditButton.d.ts +8 -0
- package/dist/page-wizard/steps/EditButton.js +5 -0
- package/dist/page-wizard/steps/EditButton.js.map +1 -0
- package/dist/page-wizard/steps/FieldEditor.d.ts +5 -0
- package/dist/page-wizard/steps/FieldEditor.js +28 -0
- package/dist/page-wizard/steps/FieldEditor.js.map +1 -0
- package/dist/page-wizard/steps/Generate.d.ts +5 -0
- package/dist/page-wizard/steps/Generate.js +10 -0
- package/dist/page-wizard/steps/Generate.js.map +1 -0
- package/dist/page-wizard/steps/ImagesStep.d.ts +2 -0
- package/dist/page-wizard/steps/ImagesStep.js +156 -0
- package/dist/page-wizard/steps/ImagesStep.js.map +1 -0
- package/dist/page-wizard/steps/LayoutStep.d.ts +2 -0
- package/dist/page-wizard/steps/LayoutStep.js +118 -0
- package/dist/page-wizard/steps/LayoutStep.js.map +1 -0
- package/dist/page-wizard/steps/SelectStep.d.ts +2 -0
- package/dist/page-wizard/steps/SelectStep.js +145 -0
- package/dist/page-wizard/steps/SelectStep.js.map +1 -0
- package/dist/page-wizard/steps/schema.d.ts +13 -0
- package/dist/page-wizard/steps/schema.js +137 -0
- package/dist/page-wizard/steps/schema.js.map +1 -0
- package/dist/page-wizard/steps/usePageCreator.d.ts +6 -0
- package/dist/page-wizard/steps/usePageCreator.js +192 -0
- package/dist/page-wizard/steps/usePageCreator.js.map +1 -0
- package/dist/splash-screen/NewPage.d.ts +3 -0
- package/dist/splash-screen/NewPage.js +129 -0
- package/dist/splash-screen/NewPage.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/splash-screen/SplashScreen.d.ts +1 -0
- package/dist/splash-screen/SplashScreen.js +79 -0
- package/dist/splash-screen/SplashScreen.js.map +1 -0
- package/dist/styles.css +2739 -0
- package/dist/tour/Tour.d.ts +3 -0
- package/dist/tour/Tour.js +319 -0
- package/dist/tour/Tour.js.map +1 -0
- package/dist/tour/default-tour.d.ts +9 -0
- package/dist/tour/default-tour.js +229 -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 +91 -0
- package/dist/tour/preview-tour.js.map +1 -0
- package/dist/types.d.ts +259 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +12 -5
- package/src/components/ui/button.tsx +62 -0
- package/src/editor/Titlebar.tsx +2 -2
- package/src/editor/client/EditorClient.tsx +8 -9
- package/src/editor/menubar/ActionsMenu.tsx +1 -1
- package/src/editor/menubar/Menu.tsx +3 -3
- package/src/editor/menubar/VersionSelector.tsx +9 -10
- package/src/editor/page-editor-chrome/CommentHighlighting.tsx +8 -9
- package/src/editor/page-viewer/MiniMap.tsx +11 -11
- package/src/editor/reviews/Comment.tsx +38 -33
- package/src/editor/sidebar/ComponentTree.tsx +512 -512
- package/src/editor/sidebar/Insert.tsx +2 -2
- package/src/editor/sidebar/MainContentTree.tsx +1 -0
- package/src/editor/sidebar/Translations.tsx +12 -12
- package/src/editor/sidebar/ViewSelector.tsx +6 -7
- package/src/editor/ui/PerfectTree.tsx +2 -2
- package/src/editor/ui/SimpleTable.tsx +3 -6
- package/src/editor/utils.ts +32 -29
- package/src/index.ts +2 -0
- package/src/lib/utils.ts +6 -0
- package/src/splash-screen/SplashScreen.tsx +2 -2
- package/styles.css +124 -2
- package/tsconfig.build.json +23 -13
- package/tsconfig.json +3 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translationService.js","sourceRoot":"","sources":["../../../src/editor/services/translationService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,EAAC,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAwG;IAC3M,OAAO,MAAM,IAAI,CACf,+CAA+C,EAC/C,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAG,CACjE,CAAC;AACJ,CAAC;AAGD,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,MAAc;IACvD,OAAO,MAAM,GAAG,CACd,qDAAqD,MAAM,EAAE,CAC9D,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,OAAO,MAAM,GAAG,CAAW,sCAAsC,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
export type FetchOptions = {
|
|
3
|
+
tags?: string[];
|
|
4
|
+
revalidate?: number | false;
|
|
5
|
+
};
|
|
6
|
+
export type FetchResult = {
|
|
7
|
+
status: number;
|
|
8
|
+
error?: string;
|
|
9
|
+
data?: any;
|
|
10
|
+
headers: Headers;
|
|
11
|
+
};
|
|
12
|
+
export type ApiConfig = {
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
headers?: Headers;
|
|
15
|
+
};
|
|
16
|
+
export declare function apiGet(route: string, config?: ApiConfig): Promise<FetchResult>;
|
|
17
|
+
export declare function apiPostObject(route: string, object: any, config?: ApiConfig): Promise<FetchResult>;
|
|
18
|
+
export declare function getApiKey(): string | undefined;
|
|
19
|
+
export declare function getApiHeaders(): Promise<Headers>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import { headers } from "next/headers";
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
export async function apiGet(route, config) {
|
|
5
|
+
const url = process.env.LAYOUT_SERVICE_URL + route;
|
|
6
|
+
const requestHeaders = getRequestHeaders(config);
|
|
7
|
+
try {
|
|
8
|
+
const response = await axios.get(url, {
|
|
9
|
+
headers: requestHeaders,
|
|
10
|
+
});
|
|
11
|
+
return {
|
|
12
|
+
data: response.data,
|
|
13
|
+
status: response.status,
|
|
14
|
+
headers: convertAxiosHeaders(response.headers),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
if (error.response) {
|
|
19
|
+
return {
|
|
20
|
+
status: error.response.status,
|
|
21
|
+
error: error.response.statusText,
|
|
22
|
+
headers: convertAxiosHeaders(error.response.headers),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return {
|
|
27
|
+
status: 500,
|
|
28
|
+
error: error.message,
|
|
29
|
+
headers: convertAxiosHeaders(error.response.headers),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function getRequestHeaders(config) {
|
|
35
|
+
const requestHeaders = {};
|
|
36
|
+
// Convert Headers (node-fetch) to AxiosRequestHeaders (plain object)
|
|
37
|
+
if (config?.headers) {
|
|
38
|
+
config.headers.forEach((value, key) => {
|
|
39
|
+
requestHeaders[key] = value;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
// Set default headers
|
|
43
|
+
requestHeaders["Content-Type"] = "application/json";
|
|
44
|
+
requestHeaders["x-api-key"] = config?.apiKey ?? getApiKey();
|
|
45
|
+
return requestHeaders;
|
|
46
|
+
}
|
|
47
|
+
export async function apiPostObject(route, object, config) {
|
|
48
|
+
const url = process.env.LAYOUT_SERVICE_URL + route;
|
|
49
|
+
const requestHeaders = getRequestHeaders(config);
|
|
50
|
+
const body = JSON.stringify(object);
|
|
51
|
+
try {
|
|
52
|
+
const response = await axios.post(url, body, {
|
|
53
|
+
headers: requestHeaders,
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
data: response.data,
|
|
57
|
+
status: response.status,
|
|
58
|
+
headers: convertAxiosHeaders(response.headers),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
if (error.errors) {
|
|
63
|
+
let message = "";
|
|
64
|
+
error.errors.forEach((error) => {
|
|
65
|
+
message += error.message + " ";
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
status: 500,
|
|
69
|
+
error: message,
|
|
70
|
+
headers: new Headers(),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (error.response) {
|
|
74
|
+
return {
|
|
75
|
+
status: error.response.status,
|
|
76
|
+
error: error.response.statusText,
|
|
77
|
+
headers: convertAxiosHeaders(error.response.headers),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
return {
|
|
82
|
+
status: 500,
|
|
83
|
+
error: error.message,
|
|
84
|
+
headers: new Headers(),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
export function getApiKey() {
|
|
90
|
+
const apiKey = process.env.ALPACA_HEADLESS_API_KEY || process.env.API_KEY;
|
|
91
|
+
if (!apiKey)
|
|
92
|
+
console.log("ERROR: Could not find API key environment variable: ALPACA_HEADLESS_API_KEY");
|
|
93
|
+
return apiKey;
|
|
94
|
+
}
|
|
95
|
+
function convertAxiosHeaders(headers) {
|
|
96
|
+
const convertedHeaders = new Headers();
|
|
97
|
+
for (const key in headers) {
|
|
98
|
+
if (headers.hasOwnProperty(key)) {
|
|
99
|
+
convertedHeaders.set(key.toLowerCase(), headers[key]);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return convertedHeaders;
|
|
103
|
+
}
|
|
104
|
+
export async function getApiHeaders() {
|
|
105
|
+
const requestHeaders = await headers();
|
|
106
|
+
const apiHeaders = new Headers();
|
|
107
|
+
apiHeaders.set("Cookie", requestHeaders.get("Cookie") || "");
|
|
108
|
+
apiHeaders.set("Authorization", requestHeaders.get("Authorization") || "");
|
|
109
|
+
return apiHeaders;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/editor/services-server/api.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,KAA6C,MAAM,OAAO,CAAC;AAmBlE,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,KAAa,EACb,MAAkB;IAElB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,GAAG,KAAK,CAAC;IAEnD,MAAM,cAAc,GAAQ,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAEtD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAkB,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE;YACnD,OAAO,EAAE,cAAc;SACxB,CAAC,CAAC;QAEH,OAAO;YACL,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,OAAO,EAAE,mBAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC;SAC/C,CAAC;IACJ,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACnB,OAAO;gBACL,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM;gBAC7B,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,UAAU;gBAChC,OAAO,EAAE,mBAAmB,CAAC,KA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QAC1B,IAAI,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;YAChC,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,cAAc,GAAG,MAAM,OAAO,EAAE,CAAC;IACvC,MAAM,UAAU,GAAG,IAAI,OAAO,EAAE,CAAC;IACjC,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7D,UAAU,CAAC,GAAG,CAAC,eAAe,EAAE,cAAc,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3E,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ApiConfig } from "../services-server/api";
|
|
2
|
+
export type ExecuteGraphQLParams = {
|
|
3
|
+
query: string;
|
|
4
|
+
tags?: string[];
|
|
5
|
+
host?: string;
|
|
6
|
+
path?: string;
|
|
7
|
+
language?: string;
|
|
8
|
+
mode?: string;
|
|
9
|
+
itemId?: string;
|
|
10
|
+
version?: number;
|
|
11
|
+
revalidate?: number;
|
|
12
|
+
siteName?: string;
|
|
13
|
+
sessionId?: string;
|
|
14
|
+
schema?: string;
|
|
15
|
+
apiConfig?: ApiConfig;
|
|
16
|
+
};
|
|
17
|
+
export declare function executeGraphQLQuery({ query, host, path, language, mode, itemId, version, siteName, schema, sessionId, apiConfig, }: ExecuteGraphQLParams): Promise<{
|
|
18
|
+
status: number;
|
|
19
|
+
errors: any;
|
|
20
|
+
data?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
data: any;
|
|
23
|
+
status: number;
|
|
24
|
+
errors: any;
|
|
25
|
+
}>;
|
|
26
|
+
export declare function getGraphQLSchema({ id, apiConfig, }: {
|
|
27
|
+
id: string;
|
|
28
|
+
apiConfig: ApiConfig;
|
|
29
|
+
}): Promise<any>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { apiGet, apiPostObject } from "../services-server/api";
|
|
2
|
+
export async function executeGraphQLQuery({ query, host, path, language, mode, itemId, version,
|
|
3
|
+
// tags,
|
|
4
|
+
// revalidate,
|
|
5
|
+
siteName, schema, sessionId, apiConfig, }) {
|
|
6
|
+
let url = "/alpaca/headless/graphql";
|
|
7
|
+
if (sessionId)
|
|
8
|
+
url += "?sessionId=" + sessionId;
|
|
9
|
+
//console.log(`GraphQL query:`, query);
|
|
10
|
+
const request = {
|
|
11
|
+
Query: query,
|
|
12
|
+
Host: host,
|
|
13
|
+
Path: path,
|
|
14
|
+
ItemId: itemId,
|
|
15
|
+
Language: language,
|
|
16
|
+
Version: version,
|
|
17
|
+
Mode: mode,
|
|
18
|
+
SiteName: siteName,
|
|
19
|
+
Schema: schema,
|
|
20
|
+
};
|
|
21
|
+
//TODO: cache:
|
|
22
|
+
const response = await apiPostObject(url, request, apiConfig);
|
|
23
|
+
if (response.status !== 200) {
|
|
24
|
+
return { status: response.status, errors: getErrors(response) };
|
|
25
|
+
}
|
|
26
|
+
if (response.data?.errors) {
|
|
27
|
+
return {
|
|
28
|
+
status: 400,
|
|
29
|
+
errors: response.data?.errors,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
data: response.data?.data,
|
|
34
|
+
status: response.status,
|
|
35
|
+
errors: getErrors(response),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function getErrors(response) {
|
|
39
|
+
if (response.data?.errors)
|
|
40
|
+
return response.data?.errors;
|
|
41
|
+
if (response.error)
|
|
42
|
+
return [{ message: response.error }];
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
export async function getGraphQLSchema({ id, apiConfig, }) {
|
|
46
|
+
let url = "/alpaca/headless/graphql/schema?id=" + id;
|
|
47
|
+
const response = await apiGet(url, apiConfig);
|
|
48
|
+
if (response.status !== 200) {
|
|
49
|
+
return { status: response.status, error: response.error };
|
|
50
|
+
}
|
|
51
|
+
return response.data;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=graphQL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphQL.js","sourceRoot":"","sources":["../../../src/editor/services-server/graphQL.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,MAAM,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAkB1E,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EACxC,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,OAAO;AACP,QAAQ;AACR,cAAc;AACd,QAAQ,EACR,MAAM,EACN,SAAS,EACT,SAAS,GACY;IACrB,IAAI,GAAG,GAAG,0BAA0B,CAAC;IAErC,IAAI,SAAS;QAAE,GAAG,IAAI,aAAa,GAAG,SAAS,CAAC;IAEhD,uCAAuC;IAEvC,MAAM,OAAO,GAUT;QACF,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,MAAM;KACf,CAAC;IAEF,cAAc;IAEd,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAE9D,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QAC5B,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;IAClE,CAAC;IAED,IAAI,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;QAC1B,OAAO;YACL,MAAM,EAAE,GAAG;YACX,MAAM,EAAE,QAAQ,CAAC,IAAI,EAAE,MAAM;SAC9B,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,IAAI;QACzB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC;KAC5B,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,QAAa;IAC9B,IAAI,QAAQ,CAAC,IAAI,EAAE,MAAM;QAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACxD,IAAI,QAAQ,CAAC,KAAK;QAAE,OAAO,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IACzD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EACrC,EAAE,EACF,SAAS,GAIV;IACC,IAAI,GAAG,GAAG,qCAAqC,GAAG,EAAE,CAAC;IAErD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAE9C,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QAC5B,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;IAC5D,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ComponentPalette({}: {}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getInsertOptionsForCurrentSelection } from "../utils/insertOptions";
|
|
3
|
+
import { ArrowDownIcon } from "../ui/Icons";
|
|
4
|
+
import { getAbsoluteIconUrl } from "../utils";
|
|
5
|
+
import { classNames } from "primereact/utils";
|
|
6
|
+
import { useEditContext } from "../client/editContext";
|
|
7
|
+
import { InputText } from "primereact/inputtext";
|
|
8
|
+
import { useState, useRef } from "react";
|
|
9
|
+
export function ComponentPalette({}) {
|
|
10
|
+
const editContext = useEditContext();
|
|
11
|
+
const [filter, setFilter] = useState("");
|
|
12
|
+
const filterRef = useRef(null);
|
|
13
|
+
const insertOptions = getInsertOptionsForCurrentSelection(editContext);
|
|
14
|
+
const insertOptionsByGroup = insertOptions.reduce((acc, value) => {
|
|
15
|
+
const group = value.group || "Other";
|
|
16
|
+
if (!acc[group]) {
|
|
17
|
+
acc[group] = [];
|
|
18
|
+
}
|
|
19
|
+
acc[group].push(value);
|
|
20
|
+
return acc;
|
|
21
|
+
}, {});
|
|
22
|
+
return (_jsx("div", { className: "h-full relative tour-component-palette", children: _jsxs("div", { className: "overflow-y-auto absolute inset-0", children: [_jsx("div", { className: "p-4", children: _jsx(InputText, { ref: filterRef, className: "w-full text-sm", placeholder: "Filter components", onChange: (e) => setFilter(e.target.value) }) }), Object.keys(insertOptionsByGroup)
|
|
23
|
+
.sort()
|
|
24
|
+
.map((group, index) => {
|
|
25
|
+
const options = insertOptionsByGroup[group].filter((x) => !x.isHidden).filter((x) => x.name.toLowerCase().indexOf(filter.toLowerCase()) > -1);
|
|
26
|
+
if (options.length === 0)
|
|
27
|
+
return;
|
|
28
|
+
return (_jsxs("div", { className: classNames("m-4", index > 0 ? " border-t border-gray-200" : ""), children: [_jsxs("div", { className: "text-xs font-bold mt-2 mb-3 flex items-center gap-2", children: [_jsx(ArrowDownIcon, {}), " ", group] }), _jsx("div", { className: "grid gap-4 grid-cols-[repeat(auto-fill,_minmax(70px,_1fr))]", children: options.map((option) => {
|
|
29
|
+
function handleDragStart(event) {
|
|
30
|
+
editContext?.dragStart({
|
|
31
|
+
type: "template",
|
|
32
|
+
typeId: option.typeId,
|
|
33
|
+
name: option.name,
|
|
34
|
+
});
|
|
35
|
+
event.stopPropagation();
|
|
36
|
+
}
|
|
37
|
+
function handleDragEnd() {
|
|
38
|
+
editContext.dragEnd();
|
|
39
|
+
editContext.setSelectedForInsertion("");
|
|
40
|
+
}
|
|
41
|
+
const isDraggable = !option.isInvalid;
|
|
42
|
+
return (_jsxs("div", { id: "insert-component-" + option.typeId, onClick: () => {
|
|
43
|
+
editContext.setSelectedForInsertion(option.typeId);
|
|
44
|
+
}, draggable: isDraggable, onDragStart: handleDragStart, onDragEnd: handleDragEnd, className: classNames("p-2 border border-gray-200 flex items-center flex-col gap-2 text-center text-xs relative rounded break-all ", isDraggable ? "cursor-grab" : "", editContext.selectedForInsertion === option.typeId
|
|
45
|
+
? "border-sky-500"
|
|
46
|
+
: ""), "data-testid": "insert-component-option", children: [option.svg && (_jsx("div", { className: "w-8 h-8", dangerouslySetInnerHTML: { __html: option.svg } })), !option.svg && (_jsx("img", { src: getAbsoluteIconUrl(option.icon), width: "32", height: "32" })), _jsx("div", { className: "text-xs", children: option.name
|
|
47
|
+
.split(new RegExp(`(${filter})`, "i"))
|
|
48
|
+
.map((part, i) => part.toLowerCase() === filter.toLowerCase() &&
|
|
49
|
+
part ? (_jsx("u", { className: "font-bold", children: part }, i)) : (part && _jsx("span", { children: part }, i))) }), option.isInvalid && (_jsx("i", { className: "pi pi-exclamation-triangle text-red-500 absolute top-0 right-0", title: option.message }))] }, option.typeId));
|
|
50
|
+
}) })] }, group));
|
|
51
|
+
})] }) }));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=ComponentPalette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComponentPalette.js","sourceRoot":"","sources":["../../../src/editor/sidebar/ComponentPalette.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C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,KArCI,MAAM,CAAC,MAAM,CAsCd,CACP,CAAC;gCACJ,CAAC,CAAC,GACE,KAlFD,KAAK,CAmFN,CACP,CAAC;gBACJ,CAAC,CAAC,IACA,GACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ComponentTree({}: {}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEditContext, useEditContextRef } from "../client/editContext";
|
|
4
|
+
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { confirmDialog } from "primereact/confirmdialog";
|
|
6
|
+
import { getComponentCommands } from "../commands/componentCommands";
|
|
7
|
+
import { PerfectTree } from "../ui/PerfectTree";
|
|
8
|
+
import { isValidPlaceholder } from "../componentTreeHelper";
|
|
9
|
+
export function ComponentTree({}) {
|
|
10
|
+
const [expandedKeys, setExpandedKeys] = useState([]);
|
|
11
|
+
const [selectedKeys, setSelectedKeys] = useState([]);
|
|
12
|
+
const [rootNodes, setRootNodes] = useState([]);
|
|
13
|
+
const [nodeDictionary, setNodeDictionary] = useState({});
|
|
14
|
+
let editContextRef = useEditContextRef();
|
|
15
|
+
const editContext = useEditContext();
|
|
16
|
+
const treeRef = useRef(null);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (treeRef.current) {
|
|
19
|
+
const selectedNodeKey = Object.keys(selectedKeys || {})[0];
|
|
20
|
+
const selectedNodeElement = treeRef.current.querySelector(`[data-id="${selectedNodeKey}"]`);
|
|
21
|
+
if (selectedNodeElement) {
|
|
22
|
+
selectedNodeElement.scrollIntoView({
|
|
23
|
+
behavior: "smooth",
|
|
24
|
+
block: "nearest",
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}, [selectedKeys]);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (editContext?.selection) {
|
|
31
|
+
setSelectedKeys(editContext.selection);
|
|
32
|
+
}
|
|
33
|
+
}, [editContext?.selection]);
|
|
34
|
+
const selection = editContext?.selection || [];
|
|
35
|
+
const page = editContext?.page;
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
const newExpandedKeys = [...expandedKeys];
|
|
38
|
+
for (const id of selection) {
|
|
39
|
+
if (nodeDictionary[id]?.parent) {
|
|
40
|
+
expandParents(nodeDictionary[id].parent, newExpandedKeys);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (newExpandedKeys.length !== expandedKeys.length ||
|
|
44
|
+
!newExpandedKeys.every((key, i) => key === expandedKeys[i])) {
|
|
45
|
+
setExpandedKeys(newExpandedKeys);
|
|
46
|
+
}
|
|
47
|
+
}, [selection, nodeDictionary]);
|
|
48
|
+
function mapPlaceholderNode(p, parent) {
|
|
49
|
+
const node = {
|
|
50
|
+
key: p.key,
|
|
51
|
+
componentId: p.key,
|
|
52
|
+
label: p.name,
|
|
53
|
+
icon: "pi pi-folder",
|
|
54
|
+
data: p,
|
|
55
|
+
parent: parent,
|
|
56
|
+
type: "placeholder",
|
|
57
|
+
};
|
|
58
|
+
node.children = p.components.map((c) => mapComponentNode(c, node));
|
|
59
|
+
return node;
|
|
60
|
+
}
|
|
61
|
+
function mapPlaceholders(c, parent) {
|
|
62
|
+
if (!c?.placeholders)
|
|
63
|
+
return [];
|
|
64
|
+
if (c.placeholders.length > 1)
|
|
65
|
+
return c.placeholders.map((x) => mapPlaceholderNode(x, parent));
|
|
66
|
+
else if (c.placeholders.length > 0) {
|
|
67
|
+
return c.placeholders[0].components.map((c) => mapComponentNode(c, parent));
|
|
68
|
+
}
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
function mapComponentNode(c, parent) {
|
|
72
|
+
const node = {
|
|
73
|
+
key: c.id,
|
|
74
|
+
componentId: c.id,
|
|
75
|
+
label: c.name,
|
|
76
|
+
icon: "pi pi-stop",
|
|
77
|
+
data: c,
|
|
78
|
+
parent: parent,
|
|
79
|
+
tags: [],
|
|
80
|
+
className: c.isRemovedFromMasterLanguage ? "text-gray-400" : "",
|
|
81
|
+
type: "component",
|
|
82
|
+
};
|
|
83
|
+
if (c.isInheritedFromMasterLanguage) {
|
|
84
|
+
node.tags.push({
|
|
85
|
+
id: "inherited",
|
|
86
|
+
severity: "info",
|
|
87
|
+
value: "Inherited " + (c.isRemovedFromMasterLanguage ? " / removed" : ""),
|
|
88
|
+
tooltip: c.isRemovedFromMasterLanguage
|
|
89
|
+
? "Component was removed from master language"
|
|
90
|
+
: "Component is inherited from master language",
|
|
91
|
+
icon: "pi pi-caret-right",
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if (c.layoutId) {
|
|
95
|
+
node.tags.push({
|
|
96
|
+
id: "layout",
|
|
97
|
+
severity: "warning",
|
|
98
|
+
value: "Layout",
|
|
99
|
+
icon: "",
|
|
100
|
+
color: "rgb(192 132 252)",
|
|
101
|
+
tooltip: "Component is inherited from layout. Click to edit layout.",
|
|
102
|
+
onClick: async () => {
|
|
103
|
+
if (!editContext || !c.layoutId)
|
|
104
|
+
return;
|
|
105
|
+
const hostItem = await editContext.itemsRepository.getItem({
|
|
106
|
+
id: c.layoutId,
|
|
107
|
+
language: page.item.language,
|
|
108
|
+
version: 0,
|
|
109
|
+
});
|
|
110
|
+
if (!hostItem)
|
|
111
|
+
return;
|
|
112
|
+
confirmDialog({
|
|
113
|
+
header: "Edit layout",
|
|
114
|
+
message: "Edit layout " + hostItem.path + "?",
|
|
115
|
+
accept: () => editContext.loadItem({
|
|
116
|
+
id: c.layoutId,
|
|
117
|
+
language: page.item.language,
|
|
118
|
+
version: 0,
|
|
119
|
+
}),
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
if (c.datasourceItem && c.datasourceItem?.id !== c.id) {
|
|
125
|
+
node.tags.push({
|
|
126
|
+
id: "linked",
|
|
127
|
+
severity: "warning",
|
|
128
|
+
value: "Shared",
|
|
129
|
+
icon: "",
|
|
130
|
+
tooltip: "Component is linked to " + c.datasourceItem?.id,
|
|
131
|
+
color: "rgb(251, 146, 60)",
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
node.children = mapPlaceholders(c, node);
|
|
135
|
+
if (c.items.length > 0 && c.items[0].id !== c.datasourceItem?.id) {
|
|
136
|
+
const itemsNode = {
|
|
137
|
+
key: "items" + c.id,
|
|
138
|
+
label: "items",
|
|
139
|
+
icon: "pi pi-circle",
|
|
140
|
+
parent: node,
|
|
141
|
+
type: "items",
|
|
142
|
+
};
|
|
143
|
+
itemsNode.children = c.items.map((x) => {
|
|
144
|
+
const itemNode = {
|
|
145
|
+
key: x.id,
|
|
146
|
+
label: x.name,
|
|
147
|
+
icon: "pi pi-file",
|
|
148
|
+
parent: itemsNode,
|
|
149
|
+
type: "item",
|
|
150
|
+
};
|
|
151
|
+
return itemNode;
|
|
152
|
+
});
|
|
153
|
+
node.children.push(itemsNode);
|
|
154
|
+
}
|
|
155
|
+
return node;
|
|
156
|
+
}
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
if (!page)
|
|
159
|
+
return;
|
|
160
|
+
const treeNodes = mapPlaceholders(page.rootComponent, {
|
|
161
|
+
key: "root",
|
|
162
|
+
label: "Root",
|
|
163
|
+
icon: "pi pi-home",
|
|
164
|
+
children: [],
|
|
165
|
+
type: "placeholder",
|
|
166
|
+
});
|
|
167
|
+
const dict = {};
|
|
168
|
+
createMap(treeNodes, dict);
|
|
169
|
+
const otherNode = {
|
|
170
|
+
key: "other",
|
|
171
|
+
label: "Other",
|
|
172
|
+
icon: "pi pi-file",
|
|
173
|
+
children: [],
|
|
174
|
+
type: "other",
|
|
175
|
+
};
|
|
176
|
+
if (otherNode.children?.length)
|
|
177
|
+
treeNodes.push(otherNode);
|
|
178
|
+
const pageNode = {
|
|
179
|
+
key: "page",
|
|
180
|
+
label: "Page",
|
|
181
|
+
icon: "pi pi-home",
|
|
182
|
+
parent: undefined,
|
|
183
|
+
componentId: page.item.id,
|
|
184
|
+
type: "page",
|
|
185
|
+
};
|
|
186
|
+
setRootNodes([pageNode, ...treeNodes]);
|
|
187
|
+
setNodeDictionary(dict);
|
|
188
|
+
}, [page]);
|
|
189
|
+
const handleTreeSelection = (key, event) => {
|
|
190
|
+
let newKeys = [key];
|
|
191
|
+
if (event.ctrlKey) {
|
|
192
|
+
if (selectedKeys.includes(key)) {
|
|
193
|
+
newKeys = selectedKeys.filter((x) => x !== key);
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
newKeys = [...selectedKeys, key];
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
const selectedComponentIds = newKeys
|
|
200
|
+
.filter((key) => nodeDictionary[key])
|
|
201
|
+
.map((key) => nodeDictionary[key].componentId);
|
|
202
|
+
editContextRef.current?.select(selectedComponentIds);
|
|
203
|
+
if (selectedComponentIds.length === 1) {
|
|
204
|
+
editContextRef.current?.setScrollIntoView(selectedComponentIds[0]);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
// Handle tree context menu
|
|
208
|
+
const handleTreeContextMenu = (item, event) => {
|
|
209
|
+
const componentId = nodeDictionary[item.id]?.componentId;
|
|
210
|
+
let selectedComponentIds = editContext?.selection || [];
|
|
211
|
+
if (componentId) {
|
|
212
|
+
if (selectedComponentIds.indexOf(componentId) < 0) {
|
|
213
|
+
editContextRef.current?.select([componentId]);
|
|
214
|
+
selectedComponentIds = [componentId];
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function isDefinedEntity(entity) {
|
|
218
|
+
return entity !== undefined;
|
|
219
|
+
}
|
|
220
|
+
let selectedEntities = selectedComponentIds
|
|
221
|
+
.filter((key) => nodeDictionary[key])
|
|
222
|
+
.map((key) => nodeDictionary[key].data)
|
|
223
|
+
.filter(isDefinedEntity);
|
|
224
|
+
if (selectedEntities.length === 0 && item.data) {
|
|
225
|
+
selectedEntities = [item.data];
|
|
226
|
+
}
|
|
227
|
+
let commands = getComponentCommands(selectedEntities, editContextRef.current);
|
|
228
|
+
const menu = commands.map((x) => ({
|
|
229
|
+
label: x.label,
|
|
230
|
+
icon: x.icon,
|
|
231
|
+
disabled: editContextRef.current?.isCommandDisabled({
|
|
232
|
+
command: x,
|
|
233
|
+
}),
|
|
234
|
+
command: (ev) => {
|
|
235
|
+
editContextRef.current?.executeCommand({
|
|
236
|
+
command: x,
|
|
237
|
+
data: { components: selectedEntities },
|
|
238
|
+
event: ev.originalEvent,
|
|
239
|
+
});
|
|
240
|
+
},
|
|
241
|
+
}));
|
|
242
|
+
editContextRef.current?.showContextMenu(event, menu);
|
|
243
|
+
};
|
|
244
|
+
// Convert expanded keys for PerfectTree
|
|
245
|
+
const expandedItems = expandedKeys;
|
|
246
|
+
// Convert selected keys for PerfectTree
|
|
247
|
+
const selectedItems = selectedKeys;
|
|
248
|
+
// Handle expanding nodes
|
|
249
|
+
const handleToggle = (key) => {
|
|
250
|
+
if (expandedKeys.includes(key)) {
|
|
251
|
+
handleCollapseItem(key);
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
const newExpandedKeys = [...expandedKeys];
|
|
255
|
+
newExpandedKeys.push(key);
|
|
256
|
+
setExpandedKeys(newExpandedKeys);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
// Handle collapsing nodes
|
|
260
|
+
const handleCollapseItem = (key) => {
|
|
261
|
+
// First, get the node we're collapsing
|
|
262
|
+
const nodeToCollapse = nodeDictionary[key];
|
|
263
|
+
// Create a new array for expanded keys
|
|
264
|
+
const newExpandedKeys = [...expandedKeys].filter((x) => x !== key);
|
|
265
|
+
setExpandedKeys(newExpandedKeys);
|
|
266
|
+
};
|
|
267
|
+
const getPlaceholder = (node) => {
|
|
268
|
+
if (!node)
|
|
269
|
+
return null;
|
|
270
|
+
if (node.type === "placeholder")
|
|
271
|
+
return node.data;
|
|
272
|
+
if (node.type === "component" && node.data.placeholders) {
|
|
273
|
+
if (node.data.placeholders.length === 1)
|
|
274
|
+
return node.data.placeholders[0];
|
|
275
|
+
}
|
|
276
|
+
return null;
|
|
277
|
+
};
|
|
278
|
+
// Handle drag over node
|
|
279
|
+
const handleDragOverZone = (dragOverNode, index, event) => {
|
|
280
|
+
if (!editContext?.dragObject)
|
|
281
|
+
return false;
|
|
282
|
+
const placeholder = getPlaceholder(dragOverNode);
|
|
283
|
+
if (!placeholder)
|
|
284
|
+
return false;
|
|
285
|
+
var isValid = isValidPlaceholder(placeholder, editContext.dragObject);
|
|
286
|
+
return isValid;
|
|
287
|
+
};
|
|
288
|
+
// Handle drop on node
|
|
289
|
+
const handleDropZone = (droppedOnNode, index, event) => {
|
|
290
|
+
const placeholder = getPlaceholder(droppedOnNode);
|
|
291
|
+
if (!placeholder)
|
|
292
|
+
return;
|
|
293
|
+
editContext.droppedInPlaceholder(placeholder.key, index);
|
|
294
|
+
};
|
|
295
|
+
if (!page)
|
|
296
|
+
return (_jsx("div", { className: "flex h-full items-center justify-center text-sm text-gray-500" }));
|
|
297
|
+
// Use the PerfectTree component
|
|
298
|
+
return (_jsx("div", { className: "p-2", ref: treeRef, children: _jsx(PerfectTree, { nodes: rootNodes, isDragging: !!editContext?.dragObject, selectedKeys: selectedItems, expandedKeys: expandedItems, onToggleExpand: handleToggle, onSelect: handleTreeSelection, enableDragAndDrop: true, onDragOverZone: (parent, index, event) => handleDragOverZone(parent, index, event), onStartDrag: (data) => {
|
|
299
|
+
const component = data.node.data;
|
|
300
|
+
// Initialize drag data to make sure dataTransfer is set
|
|
301
|
+
data.event.dataTransfer.setData("text/plain", data.node.key);
|
|
302
|
+
// Only create drag object for components with datasourceItem
|
|
303
|
+
if (!component?.datasourceItem)
|
|
304
|
+
return;
|
|
305
|
+
editContext.dragStart({
|
|
306
|
+
type: "component",
|
|
307
|
+
typeId: component.typeId,
|
|
308
|
+
templateId: component.datasourceItem?.templateId,
|
|
309
|
+
name: component.name,
|
|
310
|
+
component: {
|
|
311
|
+
id: component.id,
|
|
312
|
+
language: editContext.page.item.language,
|
|
313
|
+
version: editContext.page.item.version,
|
|
314
|
+
},
|
|
315
|
+
});
|
|
316
|
+
}, onDragEnd: (event) => {
|
|
317
|
+
editContext.dragEnd();
|
|
318
|
+
}, onDrop: (parent, index, event) => handleDropZone(parent, index, event), renderNode: (node) => renderNode(node) }) }));
|
|
319
|
+
}
|
|
320
|
+
function renderNode(node) {
|
|
321
|
+
return (_jsx("div", { children: _jsxs("div", { className: "font-geist-sans flex items-center gap-2 p-0.5 text-[12px] text-gray-600", children: [_jsx("i", { className: node.icon }), _jsx("span", { className: node.className, children: node.label }), node.tags?.map((x) => (_jsx("div", { children: _jsxs("span", { id: `id-${node.key}-${x.id}`, className: "ml-2 rounded px-1 py-0.5 text-xs", style: {
|
|
322
|
+
backgroundColor: x.color,
|
|
323
|
+
marginLeft: "8px",
|
|
324
|
+
fontSize: "10px",
|
|
325
|
+
padding: "1px 4px 2px 2px",
|
|
326
|
+
}, title: x.tooltip, onClick: x.onClick
|
|
327
|
+
? (e) => {
|
|
328
|
+
e.stopPropagation();
|
|
329
|
+
x.onClick();
|
|
330
|
+
}
|
|
331
|
+
: undefined, children: [x.icon && _jsx("i", { className: x.icon }), x.value] }) }, `tag-${node.key}-${x.id}`)))] }) }));
|
|
332
|
+
}
|
|
333
|
+
function createMap(treeNodes, nodeDictionary) {
|
|
334
|
+
treeNodes.forEach((n) => {
|
|
335
|
+
if (n.key)
|
|
336
|
+
nodeDictionary[n.key] = n;
|
|
337
|
+
if (n.children)
|
|
338
|
+
createMap(n.children, nodeDictionary);
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
function expandParents(node, expandedKeysList) {
|
|
342
|
+
if (!node)
|
|
343
|
+
return;
|
|
344
|
+
if (node.key && !expandedKeysList.includes(node.key)) {
|
|
345
|
+
expandedKeysList.push(node.key);
|
|
346
|
+
}
|
|
347
|
+
if (node.parent) {
|
|
348
|
+
expandParents(node.parent, expandedKeysList);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
function hasSameProps(obj1, obj2) {
|
|
352
|
+
var obj1Props = Object.keys(obj1), obj2Props = Object.keys(obj2);
|
|
353
|
+
if (obj1Props.length == obj2Props.length) {
|
|
354
|
+
return obj1Props.every(function (prop) {
|
|
355
|
+
return obj2Props.indexOf(prop) >= 0;
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
360
|
+
//# sourceMappingURL=ComponentTree.js.map
|