@alpaca-editor/core 1.0.3762-mono
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/.prettierrc +3 -0
- package/dist/client-components/api.js +6 -0
- package/dist/client-components/index.js +36 -0
- package/dist/components/ActionButton.js +9 -0
- package/dist/components/Error.js +28 -0
- package/dist/config/config.js +654 -0
- package/dist/config/types.js +2 -0
- package/dist/editor/ComponentInfo.js +31 -0
- package/dist/editor/ConfirmationDialog.js +32 -0
- package/dist/editor/ContentTree.js +406 -0
- package/dist/editor/ContextMenu.js +117 -0
- package/dist/editor/Editor.js +55 -0
- package/dist/editor/EditorWarning.js +13 -0
- package/dist/editor/EditorWarnings.js +24 -0
- package/dist/editor/FieldEditorPopup.js +24 -0
- package/dist/editor/FieldHistory.js +40 -0
- package/dist/editor/FieldList.js +63 -0
- package/dist/editor/FieldListField.js +164 -0
- package/dist/editor/FieldListFieldWithFallbacks.js +114 -0
- package/dist/editor/FloatingToolbar.js +92 -0
- package/dist/editor/ImageEditor.js +55 -0
- package/dist/editor/InsertMenu.js +164 -0
- package/dist/editor/ItemInfo.js +30 -0
- package/dist/editor/LinkEditorDialog.js +89 -0
- package/dist/editor/MainLayout.js +46 -0
- package/dist/editor/NewEditorClient.js +9 -0
- package/dist/editor/PictureCropper.js +332 -0
- package/dist/editor/PictureEditor.js +104 -0
- package/dist/editor/PictureEditorDialog.js +194 -0
- package/dist/editor/ScrollingContentTree.js +30 -0
- package/dist/editor/Terminal.js +109 -0
- package/dist/editor/Titlebar.js +11 -0
- package/dist/editor/ai/AiPopup.js +25 -0
- package/dist/editor/ai/AiResponseMessage.js +24 -0
- package/dist/editor/ai/AiTerminal.js +241 -0
- package/dist/editor/ai/AiToolCall.js +18 -0
- package/dist/editor/ai/EditorAiTerminal.js +9 -0
- package/dist/editor/ai/editorAiContext.js +14 -0
- package/dist/editor/client/DialogContext.js +29 -0
- package/dist/editor/client/EditorClient.js +1336 -0
- package/dist/editor/client/GenericDialog.js +27 -0
- package/dist/editor/client/editContext.js +59 -0
- package/dist/editor/client/helpers.js +31 -0
- package/dist/editor/client/itemsRepository.js +255 -0
- package/dist/editor/client/operations.js +398 -0
- package/dist/editor/client/pageModelBuilder.js +129 -0
- package/dist/editor/commands/commands.js +2 -0
- package/dist/editor/commands/componentCommands.js +277 -0
- package/dist/editor/commands/createVersionCommand.js +26 -0
- package/dist/editor/commands/deleteVersionCommand.js +55 -0
- package/dist/editor/commands/itemCommands.js +134 -0
- package/dist/editor/commands/localizeItem/LocalizeItemDialog.js +94 -0
- package/dist/editor/commands/undo.js +32 -0
- package/dist/editor/component-designer/ComponentDesigner.js +58 -0
- package/dist/editor/component-designer/ComponentDesignerAiTerminal.js +9 -0
- package/dist/editor/component-designer/ComponentDesignerMenu.js +67 -0
- package/dist/editor/component-designer/ComponentEditor.js +59 -0
- package/dist/editor/component-designer/ComponentRenderingCodeEditor.js +16 -0
- package/dist/editor/component-designer/ComponentRenderingEditor.js +71 -0
- package/dist/editor/component-designer/ComponentsDropdown.js +22 -0
- package/dist/editor/component-designer/PlaceholdersEditor.js +70 -0
- package/dist/editor/component-designer/RenderingsDropdown.js +25 -0
- package/dist/editor/component-designer/TemplateEditor.js +144 -0
- package/dist/editor/component-designer/aiContext.js +18 -0
- package/dist/editor/componentTreeHelper.js +97 -0
- package/dist/editor/control-center/ControlCenterMenu.js +59 -0
- package/dist/editor/control-center/IndexOverview.js +27 -0
- package/dist/editor/control-center/IndexSettings.js +106 -0
- package/dist/editor/control-center/Status.js +7 -0
- package/dist/editor/editor-warnings/ItemLocked.js +40 -0
- package/dist/editor/editor-warnings/NoLanguageWriteAccess.js +16 -0
- package/dist/editor/editor-warnings/NoWorkflowWriteAccess.js +16 -0
- package/dist/editor/editor-warnings/NoWriteAccess.js +14 -0
- package/dist/editor/editor-warnings/ValidationErrors.js +27 -0
- package/dist/editor/field-types/AttachmentEditor.js +7 -0
- package/dist/editor/field-types/CheckboxEditor.js +32 -0
- package/dist/editor/field-types/DropLinkEditor.js +51 -0
- package/dist/editor/field-types/DropListEditor.js +58 -0
- package/dist/editor/field-types/ImageFieldEditor.js +36 -0
- package/dist/editor/field-types/InternalLinkFieldEditor.js +64 -0
- package/dist/editor/field-types/LinkFieldEditor.js +58 -0
- package/dist/editor/field-types/MultiLineText.js +35 -0
- package/dist/editor/field-types/PictureFieldEditor.js +59 -0
- package/dist/editor/field-types/RawEditor.js +33 -0
- package/dist/editor/field-types/ReactQuill.js +366 -0
- package/dist/editor/field-types/RichTextEditor.js +46 -0
- package/dist/editor/field-types/RichTextEditorComponent.js +72 -0
- package/dist/editor/field-types/SingleLineText.js +92 -0
- package/dist/editor/field-types/TreeListEditor.js +137 -0
- package/dist/editor/fieldTypes.js +2 -0
- package/dist/editor/media-selector/AiImageSearch.js +110 -0
- package/dist/editor/media-selector/AiImageSearchPrompt.js +58 -0
- package/dist/editor/media-selector/MediaSelector.js +11 -0
- package/dist/editor/media-selector/Preview.js +9 -0
- package/dist/editor/media-selector/Thumbnails.js +11 -0
- package/dist/editor/media-selector/TreeSelector.js +171 -0
- package/dist/editor/media-selector/UploadZone.js +80 -0
- package/dist/editor/menubar/ActionsMenu.js +33 -0
- package/dist/editor/menubar/ActiveUsers.js +13 -0
- package/dist/editor/menubar/ApproveAndPublish.js +13 -0
- package/dist/editor/menubar/BrowseHistory.js +14 -0
- package/dist/editor/menubar/ItemLanguageVersion.js +36 -0
- package/dist/editor/menubar/LanguageSelector.js +33 -0
- package/dist/editor/menubar/Menu.js +65 -0
- package/dist/editor/menubar/NavButtons.js +43 -0
- package/dist/editor/menubar/PageSelector.js +50 -0
- package/dist/editor/menubar/PageViewerControls.js +37 -0
- package/dist/editor/menubar/Separator.js +8 -0
- package/dist/editor/menubar/SiteInfo.js +26 -0
- package/dist/editor/menubar/User.js +18 -0
- package/dist/editor/menubar/VersionSelector.js +49 -0
- package/dist/editor/page-editor-chrome/CommentHighlighting.js +214 -0
- package/dist/editor/page-editor-chrome/CommentHighlightings.js +17 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicator.js +27 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicators.js +15 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicator.js +27 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicators.js +15 -0
- package/dist/editor/page-editor-chrome/FrameMenu.js +178 -0
- package/dist/editor/page-editor-chrome/FrameMenus.js +24 -0
- package/dist/editor/page-editor-chrome/InlineEditor.js +101 -0
- package/dist/editor/page-editor-chrome/LockedFieldIndicator.js +35 -0
- package/dist/editor/page-editor-chrome/NoLayout.js +21 -0
- package/dist/editor/page-editor-chrome/PageEditorChrome.js +65 -0
- package/dist/editor/page-editor-chrome/PictureEditorOverlay.js +109 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +82 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js +147 -0
- package/dist/editor/page-viewer/DeviceToolbar.js +21 -0
- package/dist/editor/page-viewer/EditorForm.js +130 -0
- package/dist/editor/page-viewer/MiniMap.js +257 -0
- package/dist/editor/page-viewer/PageViewer.js +64 -0
- package/dist/editor/page-viewer/PageViewerFrame.js +696 -0
- package/dist/editor/page-viewer/pageViewContext.js +117 -0
- package/dist/editor/pageModel.js +2 -0
- package/dist/editor/picture-shared.js +28 -0
- package/dist/editor/reviews/Comment.js +112 -0
- package/dist/editor/reviews/Comments.js +24 -0
- package/dist/editor/reviews/PreviewInfo.js +13 -0
- package/dist/editor/reviews/Reviews.js +165 -0
- package/dist/editor/reviews/reviewCommands.js +44 -0
- package/dist/editor/reviews/useReviews.js +48 -0
- package/dist/editor/services/aiService.js +99 -0
- package/dist/editor/services/componentDesignerService.js +79 -0
- package/dist/editor/services/contentService.js +104 -0
- package/dist/editor/services/editService.js +322 -0
- package/dist/editor/services/indexService.js +25 -0
- package/dist/editor/services/reviewsService.js +43 -0
- package/dist/editor/services/serviceHelper.js +67 -0
- package/dist/editor/services/systemService.js +7 -0
- package/dist/editor/services/translationService.js +15 -0
- package/dist/editor/services-server/api.js +119 -0
- package/dist/editor/services-server/graphQL.js +56 -0
- package/dist/editor/sidebar/ComponentPalette.js +55 -0
- package/dist/editor/sidebar/ComponentTree.js +362 -0
- package/dist/editor/sidebar/Debug.js +60 -0
- package/dist/editor/sidebar/DictionaryEditor.js +160 -0
- package/dist/editor/sidebar/EditHistory.js +74 -0
- package/dist/editor/sidebar/GraphQL.js +115 -0
- package/dist/editor/sidebar/Insert.js +24 -0
- package/dist/editor/sidebar/MainContentTree.js +52 -0
- package/dist/editor/sidebar/Performance.js +34 -0
- package/dist/editor/sidebar/Sessions.js +31 -0
- package/dist/editor/sidebar/Sidebar.js +15 -0
- package/dist/editor/sidebar/SidebarView.js +76 -0
- package/dist/editor/sidebar/Translations.js +160 -0
- package/dist/editor/sidebar/Validation.js +52 -0
- package/dist/editor/sidebar/ViewSelector.js +15 -0
- package/dist/editor/sidebar/Workbox.js +80 -0
- package/dist/editor/ui/CenteredMessage.js +7 -0
- package/dist/editor/ui/CopyToClipboardButton.js +17 -0
- package/dist/editor/ui/DialogButtons.js +7 -0
- package/dist/editor/ui/Icons.js +75 -0
- package/dist/editor/ui/ItemNameDialog.js +45 -0
- package/dist/editor/ui/ItemNameDialogNew.js +61 -0
- package/dist/editor/ui/ItemSearch.js +93 -0
- package/dist/editor/ui/PerfectTree.js +223 -0
- package/dist/editor/ui/Section.js +12 -0
- package/dist/editor/ui/SimpleIconButton.js +11 -0
- package/dist/editor/ui/SimpleMenu.js +9 -0
- package/dist/editor/ui/SimpleTable.js +11 -0
- package/dist/editor/ui/SimpleTabs.js +21 -0
- package/dist/editor/ui/SimpleToolbar.js +7 -0
- package/dist/editor/ui/Spinner.js +7 -0
- package/dist/editor/ui/Splitter.js +187 -0
- package/dist/editor/ui/StackedPanels.js +69 -0
- package/dist/editor/ui/Toolbar.js +7 -0
- package/dist/editor/utils/id-helper.js +7 -0
- package/dist/editor/utils/insertOptions.js +45 -0
- package/dist/editor/utils/itemutils.js +25 -0
- package/dist/editor/utils/useMemoDebug.js +20 -0
- package/dist/editor/utils.js +328 -0
- package/dist/editor/views/CompareView.js +147 -0
- package/dist/editor/views/EditView.js +17 -0
- package/dist/editor/views/ItemEditor.js +24 -0
- package/dist/editor/views/SingleEditView.js +25 -0
- package/dist/index.js +22 -0
- package/dist/page-wizard/PageWizard.js +62 -0
- package/dist/page-wizard/SelectWizard.js +43 -0
- package/dist/page-wizard/WizardSteps.js +71 -0
- package/dist/page-wizard/service.js +26 -0
- package/dist/page-wizard/startPageWizardCommand.js +23 -0
- package/dist/page-wizard/steps/BuildPageStep.js +138 -0
- package/dist/page-wizard/steps/CollectStep.js +124 -0
- package/dist/page-wizard/steps/ComponentTypesSelector.js +211 -0
- package/dist/page-wizard/steps/Components.js +94 -0
- package/dist/page-wizard/steps/CreatePage.js +142 -0
- package/dist/page-wizard/steps/CreatePageAndLayoutStep.js +230 -0
- package/dist/page-wizard/steps/EditButton.js +7 -0
- package/dist/page-wizard/steps/FieldEditor.js +30 -0
- package/dist/page-wizard/steps/Generate.js +11 -0
- package/dist/page-wizard/steps/ImagesStep.js +159 -0
- package/dist/page-wizard/steps/LayoutStep.js +120 -0
- package/dist/page-wizard/steps/SelectStep.js +150 -0
- package/dist/page-wizard/steps/schema.js +140 -0
- package/dist/page-wizard/steps/usePageCreator.js +194 -0
- package/dist/splash-screen/NewPage.js +131 -0
- package/dist/splash-screen/SectionHeadline.js +9 -0
- package/dist/splash-screen/SplashScreen.js +81 -0
- package/dist/tour/Tour.js +321 -0
- package/dist/tour/default-tour.js +231 -0
- package/dist/tour/preview-tour.js +93 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types.js +2 -0
- package/eslint.config.mjs +4 -0
- package/images/bg-shape-black.webp +0 -0
- package/package.json +52 -0
- package/src/client-components/api.ts +6 -0
- package/src/client-components/index.ts +19 -0
- package/src/components/ActionButton.tsx +43 -0
- package/src/components/Error.tsx +57 -0
- package/src/config/config.tsx +737 -0
- package/src/config/types.ts +263 -0
- package/src/editor/ComponentInfo.tsx +77 -0
- package/src/editor/ConfirmationDialog.tsx +103 -0
- package/src/editor/ContentTree.tsx +654 -0
- package/src/editor/ContextMenu.tsx +155 -0
- package/src/editor/Editor.tsx +91 -0
- package/src/editor/EditorWarning.tsx +34 -0
- package/src/editor/EditorWarnings.tsx +33 -0
- package/src/editor/FieldEditorPopup.tsx +65 -0
- package/src/editor/FieldHistory.tsx +74 -0
- package/src/editor/FieldList.tsx +190 -0
- package/src/editor/FieldListField.tsx +387 -0
- package/src/editor/FieldListFieldWithFallbacks.tsx +211 -0
- package/src/editor/FloatingToolbar.tsx +163 -0
- package/src/editor/ImageEditor.tsx +129 -0
- package/src/editor/InsertMenu.tsx +332 -0
- package/src/editor/ItemInfo.tsx +90 -0
- package/src/editor/LinkEditorDialog.tsx +192 -0
- package/src/editor/MainLayout.tsx +94 -0
- package/src/editor/NewEditorClient.tsx +11 -0
- package/src/editor/PictureCropper.tsx +505 -0
- package/src/editor/PictureEditor.tsx +206 -0
- package/src/editor/PictureEditorDialog.tsx +381 -0
- package/src/editor/PublishDialog.ignore +74 -0
- package/src/editor/ScrollingContentTree.tsx +47 -0
- package/src/editor/Terminal.tsx +215 -0
- package/src/editor/Titlebar.tsx +23 -0
- package/src/editor/ai/AiPopup.tsx +59 -0
- package/src/editor/ai/AiResponseMessage.tsx +82 -0
- package/src/editor/ai/AiTerminal.tsx +450 -0
- package/src/editor/ai/AiToolCall.tsx +46 -0
- package/src/editor/ai/EditorAiTerminal.tsx +20 -0
- package/src/editor/ai/editorAiContext.ts +18 -0
- package/src/editor/client/DialogContext.tsx +49 -0
- package/src/editor/client/EditorClient.tsx +1831 -0
- package/src/editor/client/GenericDialog.tsx +50 -0
- package/src/editor/client/editContext.ts +330 -0
- package/src/editor/client/helpers.ts +44 -0
- package/src/editor/client/itemsRepository.ts +391 -0
- package/src/editor/client/operations.ts +610 -0
- package/src/editor/client/pageModelBuilder.ts +182 -0
- package/src/editor/commands/commands.ts +23 -0
- package/src/editor/commands/componentCommands.tsx +408 -0
- package/src/editor/commands/createVersionCommand.ts +33 -0
- package/src/editor/commands/deleteVersionCommand.ts +71 -0
- package/src/editor/commands/itemCommands.tsx +186 -0
- package/src/editor/commands/localizeItem/LocalizeItemDialog.tsx +201 -0
- package/src/editor/commands/undo.ts +39 -0
- package/src/editor/component-designer/ComponentDesigner.tsx +70 -0
- package/src/editor/component-designer/ComponentDesignerAiTerminal.tsx +11 -0
- package/src/editor/component-designer/ComponentDesignerMenu.tsx +91 -0
- package/src/editor/component-designer/ComponentEditor.tsx +97 -0
- package/src/editor/component-designer/ComponentRenderingCodeEditor.tsx +31 -0
- package/src/editor/component-designer/ComponentRenderingEditor.tsx +104 -0
- package/src/editor/component-designer/ComponentsDropdown.tsx +39 -0
- package/src/editor/component-designer/PlaceholdersEditor.tsx +183 -0
- package/src/editor/component-designer/RenderingsDropdown.tsx +36 -0
- package/src/editor/component-designer/TemplateEditor.tsx +236 -0
- package/src/editor/component-designer/aiContext.ts +23 -0
- package/src/editor/componentTreeHelper.tsx +114 -0
- package/src/editor/control-center/ControlCenterMenu.tsx +71 -0
- package/src/editor/control-center/IndexOverview.tsx +50 -0
- package/src/editor/control-center/IndexSettings.tsx +266 -0
- package/src/editor/control-center/Status.tsx +7 -0
- package/src/editor/editor-warnings/ItemLocked.tsx +63 -0
- package/src/editor/editor-warnings/NoLanguageWriteAccess.tsx +22 -0
- package/src/editor/editor-warnings/NoWorkflowWriteAccess.tsx +23 -0
- package/src/editor/editor-warnings/NoWriteAccess.tsx +15 -0
- package/src/editor/editor-warnings/ValidationErrors.tsx +54 -0
- package/src/editor/field-types/AttachmentEditor.tsx +9 -0
- package/src/editor/field-types/CheckboxEditor.tsx +47 -0
- package/src/editor/field-types/DropLinkEditor.tsx +75 -0
- package/src/editor/field-types/DropListEditor.tsx +84 -0
- package/src/editor/field-types/ImageFieldEditor.tsx +65 -0
- package/src/editor/field-types/InternalLinkFieldEditor.tsx +112 -0
- package/src/editor/field-types/LinkFieldEditor.tsx +85 -0
- package/src/editor/field-types/MultiLineText.tsx +63 -0
- package/src/editor/field-types/PictureFieldEditor.tsx +121 -0
- package/src/editor/field-types/RawEditor.tsx +53 -0
- package/src/editor/field-types/ReactQuill.tsx +580 -0
- package/src/editor/field-types/RichTextEditor.tsx +22 -0
- package/src/editor/field-types/RichTextEditorComponent.tsx +108 -0
- package/src/editor/field-types/SingleLineText.tsx +150 -0
- package/src/editor/field-types/TreeListEditor.tsx +261 -0
- package/src/editor/fieldTypes.ts +140 -0
- package/src/editor/media-selector/AiImageSearch.tsx +186 -0
- package/src/editor/media-selector/AiImageSearchPrompt.tsx +95 -0
- package/src/editor/media-selector/MediaSelector.tsx +42 -0
- package/src/editor/media-selector/Preview.tsx +14 -0
- package/src/editor/media-selector/Thumbnails.tsx +48 -0
- package/src/editor/media-selector/TreeSelector.tsx +292 -0
- package/src/editor/media-selector/UploadZone.tsx +137 -0
- package/src/editor/menubar/ActionsMenu.tsx +47 -0
- package/src/editor/menubar/ActiveUsers.tsx +17 -0
- package/src/editor/menubar/ApproveAndPublish.tsx +18 -0
- package/src/editor/menubar/BrowseHistory.tsx +37 -0
- package/src/editor/menubar/ItemLanguageVersion.tsx +52 -0
- package/src/editor/menubar/LanguageSelector.tsx +152 -0
- package/src/editor/menubar/Menu.tsx +83 -0
- package/src/editor/menubar/NavButtons.tsx +74 -0
- package/src/editor/menubar/PageSelector.tsx +139 -0
- package/src/editor/menubar/PageViewerControls.tsx +99 -0
- package/src/editor/menubar/Separator.tsx +12 -0
- package/src/editor/menubar/SiteInfo.tsx +53 -0
- package/src/editor/menubar/User.tsx +27 -0
- package/src/editor/menubar/VersionSelector.tsx +143 -0
- package/src/editor/page-editor-chrome/CommentHighlighting.tsx +287 -0
- package/src/editor/page-editor-chrome/CommentHighlightings.tsx +35 -0
- package/src/editor/page-editor-chrome/FieldActionIndicator.tsx +44 -0
- package/src/editor/page-editor-chrome/FieldActionIndicators.tsx +23 -0
- package/src/editor/page-editor-chrome/FieldEditedIndicator.tsx +64 -0
- package/src/editor/page-editor-chrome/FieldEditedIndicators.tsx +35 -0
- package/src/editor/page-editor-chrome/FrameMenu.tsx +263 -0
- package/src/editor/page-editor-chrome/FrameMenus.tsx +48 -0
- package/src/editor/page-editor-chrome/InlineEditor.tsx +147 -0
- package/src/editor/page-editor-chrome/LockedFieldIndicator.tsx +61 -0
- package/src/editor/page-editor-chrome/NoLayout.tsx +36 -0
- package/src/editor/page-editor-chrome/PageEditorChrome.tsx +119 -0
- package/src/editor/page-editor-chrome/PictureEditorOverlay.tsx +154 -0
- package/src/editor/page-editor-chrome/PlaceholderDropZone.tsx +171 -0
- package/src/editor/page-editor-chrome/PlaceholderDropZones.tsx +233 -0
- package/src/editor/page-viewer/DeviceToolbar.tsx +70 -0
- package/src/editor/page-viewer/EditorForm.tsx +247 -0
- package/src/editor/page-viewer/MiniMap.tsx +351 -0
- package/src/editor/page-viewer/PageViewer.tsx +127 -0
- package/src/editor/page-viewer/PageViewerFrame.tsx +1030 -0
- package/src/editor/page-viewer/pageViewContext.ts +186 -0
- package/src/editor/pageModel.ts +191 -0
- package/src/editor/picture-shared.tsx +53 -0
- package/src/editor/reviews/Comment.tsx +265 -0
- package/src/editor/reviews/Comments.tsx +50 -0
- package/src/editor/reviews/PreviewInfo.tsx +35 -0
- package/src/editor/reviews/Reviews.tsx +280 -0
- package/src/editor/reviews/reviewCommands.tsx +47 -0
- package/src/editor/reviews/useReviews.tsx +70 -0
- package/src/editor/services/aiService.ts +155 -0
- package/src/editor/services/componentDesignerService.ts +151 -0
- package/src/editor/services/contentService.ts +159 -0
- package/src/editor/services/editService.ts +462 -0
- package/src/editor/services/indexService.ts +24 -0
- package/src/editor/services/reviewsService.ts +45 -0
- package/src/editor/services/serviceHelper.ts +95 -0
- package/src/editor/services/systemService.ts +5 -0
- package/src/editor/services/translationService.ts +21 -0
- package/src/editor/services-server/api.ts +150 -0
- package/src/editor/services-server/graphQL.ts +106 -0
- package/src/editor/sidebar/ComponentPalette.tsx +146 -0
- package/src/editor/sidebar/ComponentTree.tsx +512 -0
- package/src/editor/sidebar/ComponentTree2.tsxx +490 -0
- package/src/editor/sidebar/Debug.tsx +105 -0
- package/src/editor/sidebar/DictionaryEditor.tsx +261 -0
- package/src/editor/sidebar/EditHistory.tsx +134 -0
- package/src/editor/sidebar/GraphQL.tsx +164 -0
- package/src/editor/sidebar/Insert.tsx +35 -0
- package/src/editor/sidebar/MainContentTree.tsx +95 -0
- package/src/editor/sidebar/Performance.tsx +53 -0
- package/src/editor/sidebar/Sessions.tsx +35 -0
- package/src/editor/sidebar/Sidebar.tsx +20 -0
- package/src/editor/sidebar/SidebarView.tsx +150 -0
- package/src/editor/sidebar/Translations.tsx +276 -0
- package/src/editor/sidebar/Validation.tsx +102 -0
- package/src/editor/sidebar/ViewSelector.tsx +49 -0
- package/src/editor/sidebar/Workbox.tsx +209 -0
- package/src/editor/ui/CenteredMessage.tsx +7 -0
- package/src/editor/ui/CopyToClipboardButton.tsx +23 -0
- package/src/editor/ui/DialogButtons.tsx +11 -0
- package/src/editor/ui/Icons.tsx +585 -0
- package/src/editor/ui/ItemNameDialog.tsx +94 -0
- package/src/editor/ui/ItemNameDialogNew.tsx +118 -0
- package/src/editor/ui/ItemSearch.tsx +173 -0
- package/src/editor/ui/PerfectTree.tsx +550 -0
- package/src/editor/ui/Section.tsx +35 -0
- package/src/editor/ui/SimpleIconButton.tsx +43 -0
- package/src/editor/ui/SimpleMenu.tsx +48 -0
- package/src/editor/ui/SimpleTable.tsx +63 -0
- package/src/editor/ui/SimpleTabs.tsx +55 -0
- package/src/editor/ui/SimpleToolbar.tsx +7 -0
- package/src/editor/ui/Spinner.tsx +7 -0
- package/src/editor/ui/Splitter.tsx +247 -0
- package/src/editor/ui/StackedPanels.tsx +134 -0
- package/src/editor/ui/Toolbar.tsx +7 -0
- package/src/editor/utils/id-helper.ts +3 -0
- package/src/editor/utils/insertOptions.ts +69 -0
- package/src/editor/utils/itemutils.ts +29 -0
- package/src/editor/utils/useMemoDebug.ts +28 -0
- package/src/editor/utils.ts +435 -0
- package/src/editor/views/CompareView.tsx +256 -0
- package/src/editor/views/EditView.tsx +27 -0
- package/src/editor/views/ItemEditor.tsx +58 -0
- package/src/editor/views/SingleEditView.tsx +44 -0
- package/src/fonts/Geist-Black.woff2 +0 -0
- package/src/fonts/Geist-Bold.woff2 +0 -0
- package/src/fonts/Geist-ExtraBold.woff2 +0 -0
- package/src/fonts/Geist-ExtraLight.woff2 +0 -0
- package/src/fonts/Geist-Light.woff2 +0 -0
- package/src/fonts/Geist-Medium.woff2 +0 -0
- package/src/fonts/Geist-Regular.woff2 +0 -0
- package/src/fonts/Geist-SemiBold.woff2 +0 -0
- package/src/fonts/Geist-Thin.woff2 +0 -0
- package/src/fonts/Geist[wght].woff2 +0 -0
- package/src/index.ts +7 -0
- package/src/page-wizard/PageWizard.tsx +163 -0
- package/src/page-wizard/SelectWizard.tsx +109 -0
- package/src/page-wizard/WizardSteps.tsx +207 -0
- package/src/page-wizard/service.ts +35 -0
- package/src/page-wizard/startPageWizardCommand.ts +27 -0
- package/src/page-wizard/steps/BuildPageStep.tsx +266 -0
- package/src/page-wizard/steps/CollectStep.tsx +233 -0
- package/src/page-wizard/steps/ComponentTypesSelector.tsx +443 -0
- package/src/page-wizard/steps/Components.tsx +193 -0
- package/src/page-wizard/steps/CreatePage.tsx +285 -0
- package/src/page-wizard/steps/CreatePageAndLayoutStep.tsx +384 -0
- package/src/page-wizard/steps/EditButton.tsx +34 -0
- package/src/page-wizard/steps/FieldEditor.tsx +102 -0
- package/src/page-wizard/steps/Generate.tsx +32 -0
- package/src/page-wizard/steps/ImagesStep.tsx +318 -0
- package/src/page-wizard/steps/LayoutStep.tsx +228 -0
- package/src/page-wizard/steps/SelectStep.tsx +256 -0
- package/src/page-wizard/steps/schema.ts +180 -0
- package/src/page-wizard/steps/usePageCreator.ts +279 -0
- package/src/splash-screen/NewPage.tsx +232 -0
- package/src/splash-screen/SectionHeadline.tsx +21 -0
- package/src/splash-screen/SplashScreen.tsx +156 -0
- package/src/tour/Tour.tsx +558 -0
- package/src/tour/default-tour.tsx +300 -0
- package/src/tour/preview-tour.tsx +127 -0
- package/src/types.ts +302 -0
- package/styles.css +476 -0
- package/tsconfig.build.json +21 -0
- package/tsconfig.json +11 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoLayout = NoLayout;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const editContext_1 = require("../client/editContext");
|
|
7
|
+
function NoLayout() {
|
|
8
|
+
const [lastPageItem, setLastPageItem] = (0, react_1.useState)(null);
|
|
9
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
10
|
+
(0, react_1.useEffect)(() => {
|
|
11
|
+
const updateLastPage = async () => {
|
|
12
|
+
if (!editContext?.pageView.pageItemDescriptor)
|
|
13
|
+
return;
|
|
14
|
+
const lastPage = await editContext.itemsRepository.getItem(editContext.pageView.pageItemDescriptor);
|
|
15
|
+
if (lastPage)
|
|
16
|
+
setLastPageItem(lastPage);
|
|
17
|
+
};
|
|
18
|
+
updateLastPage();
|
|
19
|
+
}, [editContext?.currentItemDescriptor]);
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "h-full w-full flex flex-col items-center justify-center text-sm", children: ["Item has no layout.", lastPageItem && ((0, jsx_runtime_1.jsxs)("div", { className: "cursor-pointer hover:underline p-2", onClick: () => editContext?.loadItem(lastPageItem.descriptor), children: ["Load ", lastPageItem?.name, "?"] }))] }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PageEditorChrome = PageEditorChrome;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const editContext_1 = require("../client/editContext");
|
|
6
|
+
const InlineEditor_1 = require("./InlineEditor");
|
|
7
|
+
const FieldActionIndicators_1 = require("./FieldActionIndicators");
|
|
8
|
+
const PlaceholderDropZones_1 = require("./PlaceholderDropZones");
|
|
9
|
+
const PictureEditorOverlay_1 = require("./PictureEditorOverlay");
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const LockedFieldIndicator_1 = require("./LockedFieldIndicator");
|
|
12
|
+
const FrameMenus_1 = require("./FrameMenus");
|
|
13
|
+
const FieldEditedIndicators_1 = require("./FieldEditedIndicators");
|
|
14
|
+
const CommentHighlightings_1 = require("./CommentHighlightings");
|
|
15
|
+
function PageEditorChrome({ iframe, mode, pageViewContext, }) {
|
|
16
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
17
|
+
const [insertingStyle, setInsertingStyle] = (0, react_1.useState)();
|
|
18
|
+
if (!editContext?.pageView || !iframe?.contentDocument)
|
|
19
|
+
return null;
|
|
20
|
+
(0, react_1.useEffect)(() => {
|
|
21
|
+
if (!editContext.inserting)
|
|
22
|
+
setInsertingStyle(undefined);
|
|
23
|
+
let insertingPosition;
|
|
24
|
+
const insertingRect = editContext.inserting
|
|
25
|
+
? editContext.inserting.positionElement.getBoundingClientRect()
|
|
26
|
+
: null;
|
|
27
|
+
if (insertingRect) {
|
|
28
|
+
if (editContext.inserting?.positionAnchor === "top")
|
|
29
|
+
insertingPosition = {
|
|
30
|
+
y: insertingRect.y,
|
|
31
|
+
x: insertingRect.x + insertingRect.width / 2,
|
|
32
|
+
};
|
|
33
|
+
if (editContext.inserting?.positionAnchor === "bottom")
|
|
34
|
+
insertingPosition = {
|
|
35
|
+
y: insertingRect.y + insertingRect.height,
|
|
36
|
+
x: insertingRect.x + insertingRect.width / 2,
|
|
37
|
+
};
|
|
38
|
+
if (editContext.inserting?.positionAnchor === "left")
|
|
39
|
+
insertingPosition = {
|
|
40
|
+
y: insertingRect.y + insertingRect.height / 2,
|
|
41
|
+
x: insertingRect.x,
|
|
42
|
+
};
|
|
43
|
+
if (editContext.inserting?.positionAnchor === "right")
|
|
44
|
+
insertingPosition = {
|
|
45
|
+
y: insertingRect.y + insertingRect.height / 2,
|
|
46
|
+
x: insertingRect.x + insertingRect.width,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const getInsertingStyle = () => {
|
|
50
|
+
if (!insertingPosition)
|
|
51
|
+
return;
|
|
52
|
+
const scale = pageViewContext.zoom;
|
|
53
|
+
const x = Math.min(pageViewContext.viewport.width - 20, Math.max(20, insertingPosition.x * (scale || 1)));
|
|
54
|
+
const y = Math.min(pageViewContext.viewport.height - 20, Math.max(20, insertingPosition.y * (scale || 1)));
|
|
55
|
+
return {
|
|
56
|
+
top: y - 16 + "px",
|
|
57
|
+
left: x - 16 + "px",
|
|
58
|
+
zIndex: 1000,
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
const insertingStyle = getInsertingStyle();
|
|
62
|
+
setInsertingStyle(insertingStyle);
|
|
63
|
+
}, [editContext.inserting, pageViewContext.viewport]);
|
|
64
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(FrameMenus_1.FrameMenus, { mode: mode, pageViewContext: pageViewContext }), (0, jsx_runtime_1.jsx)(InlineEditor_1.InlineEditor, { mode: mode === "edit" ? "edit" : "view", pageViewContext: pageViewContext }), (0, jsx_runtime_1.jsx)(LockedFieldIndicator_1.LockedFieldIndicator, {}), (0, jsx_runtime_1.jsx)(FieldActionIndicators_1.FieldActionsIndicators, {}), editContext.showComments && ((0, jsx_runtime_1.jsx)(CommentHighlightings_1.CommentHighlightings, { iframe: pageViewContext?.editorIframeRef.current, scale: 1 })), (0, jsx_runtime_1.jsx)(FieldEditedIndicators_1.FieldEditedIndicators, { pageViewContext: pageViewContext }), mode === "edit" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(PlaceholderDropZones_1.PlaceholderDropZones, { iframe: pageViewContext?.editorIframeRef.current, size: "large" }), (0, jsx_runtime_1.jsx)(PictureEditorOverlay_1.PictureEditorOverlay, {}), insertingStyle && ((0, jsx_runtime_1.jsxs)("div", { className: "absolute flex h-8 w-8", style: insertingStyle, children: [(0, jsx_runtime_1.jsx)("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-sky-400 opacity-75" }), (0, jsx_runtime_1.jsx)("span", { className: "relative inline-flex rounded-full h-8 w-8 bg-sky-500" })] }))] }))] }));
|
|
65
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PictureEditorOverlay = PictureEditorOverlay;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const editContext_1 = require("../client/editContext");
|
|
7
|
+
const PictureEditor_1 = require("../PictureEditor");
|
|
8
|
+
const componentTreeHelper_1 = require("../componentTreeHelper");
|
|
9
|
+
function PictureEditorOverlay() {
|
|
10
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
11
|
+
const pageViewContext = editContext?.pageView;
|
|
12
|
+
const iframe = pageViewContext?.editorIframeRef.current;
|
|
13
|
+
const [field, setField] = (0, react_1.useState)();
|
|
14
|
+
const [variantName, setVariantName] = (0, react_1.useState)();
|
|
15
|
+
const [element, setElement] = (0, react_1.useState)();
|
|
16
|
+
const editContextRef = (0, react_1.useRef)(editContext);
|
|
17
|
+
(0, react_1.useEffect)(() => {
|
|
18
|
+
editContextRef.current = editContext;
|
|
19
|
+
}, [editContext]);
|
|
20
|
+
const onMouseEnter = (0, react_1.useCallback)((e) => {
|
|
21
|
+
if (!e.target)
|
|
22
|
+
return;
|
|
23
|
+
if (!("closest" in e.target))
|
|
24
|
+
return;
|
|
25
|
+
const target = e.target;
|
|
26
|
+
const pictureElement = target.closest("picture") || target.closest("img");
|
|
27
|
+
setElement(pictureElement || undefined);
|
|
28
|
+
}, [iframe, editContext]);
|
|
29
|
+
(0, react_1.useEffect)(() => {
|
|
30
|
+
if (element) {
|
|
31
|
+
const itemId = element.getAttribute("data-itemid");
|
|
32
|
+
const language = element.getAttribute("data-language");
|
|
33
|
+
const version = element.getAttribute("data-version");
|
|
34
|
+
const fieldId = element.getAttribute("data-fieldid");
|
|
35
|
+
if (!itemId ||
|
|
36
|
+
!language ||
|
|
37
|
+
!version ||
|
|
38
|
+
!fieldId ||
|
|
39
|
+
!pageViewContext?.page ||
|
|
40
|
+
!iframe?.contentWindow)
|
|
41
|
+
return;
|
|
42
|
+
const component = (0, componentTreeHelper_1.getComponentById)(itemId, pageViewContext.page);
|
|
43
|
+
if (component == null)
|
|
44
|
+
return;
|
|
45
|
+
const pictureField = component.datasourceItem?.fields.find((f) => f.id === fieldId);
|
|
46
|
+
if (!pictureField)
|
|
47
|
+
return;
|
|
48
|
+
setField(pictureField);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
setField(undefined);
|
|
52
|
+
}
|
|
53
|
+
}, [element, pageViewContext?.page]);
|
|
54
|
+
(0, react_1.useEffect)(() => {
|
|
55
|
+
if (!element || !iframe?.contentWindow)
|
|
56
|
+
return;
|
|
57
|
+
const sourceELement = getCurrentPictureSource(element, iframe.contentWindow);
|
|
58
|
+
if (sourceELement) {
|
|
59
|
+
const variantName = sourceELement.getAttribute("data-variant");
|
|
60
|
+
if (variantName) {
|
|
61
|
+
setVariantName(variantName);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}, [pageViewContext?.viewport, element]);
|
|
65
|
+
const handleLoad = () => {
|
|
66
|
+
if (iframe?.contentDocument) {
|
|
67
|
+
iframe.contentDocument.addEventListener("mouseenter", onMouseEnter, true);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
(0, react_1.useEffect)(() => {
|
|
71
|
+
if (iframe) {
|
|
72
|
+
// Ensure the iframe is loaded and accessible
|
|
73
|
+
iframe.addEventListener("load", handleLoad);
|
|
74
|
+
return () => {
|
|
75
|
+
if (iframe?.contentDocument) {
|
|
76
|
+
iframe?.contentDocument.removeEventListener("mouseenter", onMouseEnter);
|
|
77
|
+
}
|
|
78
|
+
if (iframe) {
|
|
79
|
+
iframe.removeEventListener("load", handleLoad);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}, [iframe, editContext?.refreshCompletedFlag]);
|
|
84
|
+
if (!field || !variantName || !element)
|
|
85
|
+
return null;
|
|
86
|
+
const bounds = element.getBoundingClientRect();
|
|
87
|
+
const style = {
|
|
88
|
+
left: bounds.x + "px",
|
|
89
|
+
top: bounds.y + "px",
|
|
90
|
+
width: bounds.width + "px",
|
|
91
|
+
height: bounds.height + "px",
|
|
92
|
+
};
|
|
93
|
+
return ((0, jsx_runtime_1.jsx)(PictureEditor_1.PictureEditor, { field: field, variantName: variantName, style: style, forwardScrollevents: true, isPageEditor: true }));
|
|
94
|
+
}
|
|
95
|
+
function getCurrentPictureSource(pictureElement, iframeWindow) {
|
|
96
|
+
if (pictureElement.tagName === "IMG")
|
|
97
|
+
return pictureElement;
|
|
98
|
+
const sources = pictureElement.querySelectorAll("source");
|
|
99
|
+
let currentSrc = null;
|
|
100
|
+
sources.forEach((source) => {
|
|
101
|
+
const media = source.getAttribute("media");
|
|
102
|
+
if (!media)
|
|
103
|
+
return;
|
|
104
|
+
if (media && iframeWindow.matchMedia(media).matches) {
|
|
105
|
+
currentSrc = source;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
return currentSrc || pictureElement.querySelector("img") || null;
|
|
109
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.PlaceholderDropZone = PlaceholderDropZone;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const editContext_1 = require("../client/editContext");
|
|
8
|
+
const utils_1 = require("primereact/utils");
|
|
9
|
+
const utils_2 = require("../utils");
|
|
10
|
+
function PlaceholderDropZone({ placeholder, description, index, parentName, spotPosition, spotPositionElement, spotPositionAnchor, size, }) {
|
|
11
|
+
const [isHovering, setIsHovering] = (0, react_1.useState)(false);
|
|
12
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
13
|
+
if (!editContext)
|
|
14
|
+
return;
|
|
15
|
+
function dragOver(ev) {
|
|
16
|
+
ev.dataTransfer.dropEffect =
|
|
17
|
+
editContext?.dragObject?.type == "template" ? "copy" : "move";
|
|
18
|
+
setIsHovering(true);
|
|
19
|
+
ev.preventDefault();
|
|
20
|
+
}
|
|
21
|
+
function drop(ev) {
|
|
22
|
+
ev.preventDefault();
|
|
23
|
+
setIsHovering(false);
|
|
24
|
+
editContext.setStatusMessage("");
|
|
25
|
+
editContext.droppedInPlaceholder(placeholder.key, index, spotPositionElement, spotPositionAnchor);
|
|
26
|
+
}
|
|
27
|
+
const overlayStyle = {
|
|
28
|
+
top: spotPosition.y,
|
|
29
|
+
left: spotPosition.x,
|
|
30
|
+
zIndex: isHovering ? 40 : 30,
|
|
31
|
+
transform: "none",
|
|
32
|
+
};
|
|
33
|
+
if (size === "small")
|
|
34
|
+
overlayStyle.transform = "scale(0.5)";
|
|
35
|
+
(0, react_1.useEffect)(() => {
|
|
36
|
+
if (isHovering) {
|
|
37
|
+
editContext.setStatusMessage((0, jsx_runtime_1.jsxs)("div", { children: ["Drop into placeholder", " ", (0, jsx_runtime_1.jsx)("span", { className: "font-bold", children: parentName }), " /", " ", (0, jsx_runtime_1.jsx)("span", { className: "font-bold", children: description || placeholder.name }), " ", "at position ", (0, jsx_runtime_1.jsx)("span", { className: "font-bold", children: index + 1 })] }));
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
editContext.setStatusMessage("");
|
|
41
|
+
}
|
|
42
|
+
}, [isHovering]);
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "absolute", style: overlayStyle, children: (0, jsx_runtime_1.jsx)("div", { onDragOver: dragOver, title: (description ?? placeholder.name) + " (" + index + ")", "data-testid": "placeholder-dropzone", "data-testindex": index, onDrop: drop, onDragLeave: () => setIsHovering(false), onClick: (e) => {
|
|
44
|
+
//const placeholderKeyComponents = placeholder.key.split("_");
|
|
45
|
+
// const parentId =
|
|
46
|
+
// placeholderKeyComponents.length === 1
|
|
47
|
+
// ? undefined
|
|
48
|
+
// : placeholderKeyComponents[0];
|
|
49
|
+
const insertOption = placeholder.insertOptions.find((x) => x.typeId === editContext.selectedForInsertion);
|
|
50
|
+
if (insertOption) {
|
|
51
|
+
editContext.droppedInPlaceholder(placeholder.key, index, spotPositionElement, spotPositionAnchor, insertOption);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const insertOptions = placeholder.insertOptions
|
|
55
|
+
?.filter((x) => !x.isHidden && !x.isInvalid)
|
|
56
|
+
.map((x) => ({
|
|
57
|
+
id: x.typeId,
|
|
58
|
+
icon: ((0, jsx_runtime_1.jsx)("img", { src: (0, utils_2.getAbsoluteIconUrl)(x.icon), width: "16", height: "16", className: "m-1" })),
|
|
59
|
+
label: x.name,
|
|
60
|
+
command: () => {
|
|
61
|
+
editContext.operations.addComponent(x.typeId, placeholder.key, index);
|
|
62
|
+
},
|
|
63
|
+
})) || [];
|
|
64
|
+
if (insertOptions.length > 0)
|
|
65
|
+
editContext.showContextMenu(e, [
|
|
66
|
+
{
|
|
67
|
+
label: "Insert",
|
|
68
|
+
disabled: true,
|
|
69
|
+
className: "border-b border-gray-400 pb-2 pl-2",
|
|
70
|
+
template: () => {
|
|
71
|
+
return ((0, jsx_runtime_1.jsx)("span", { className: "text-black text-sm ", children: "Insert" }));
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
...insertOptions,
|
|
75
|
+
]);
|
|
76
|
+
e.preventDefault();
|
|
77
|
+
}, className: "placeholder cursor-pointer placeholder-dropzone", children: (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.classNames)(isHovering
|
|
78
|
+
? "z-30 shadow-xl shadow-black w-20 h-20 shadow-blue-500/50"
|
|
79
|
+
: "z-30 w-10 h-10 hover:scale-[1.1]", "transition-all duration-200 text-white text-center p-2 text-sm flex justify-center items-center bg-blue-500 rounded-full absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 test-ph-dropzone tour-placeholder-dropzone"), "data-testid": "placeholder-dropzone-button", children: (0, jsx_runtime_1.jsx)("i", { className: "pi pi-plus block" }) }) }) })
|
|
80
|
+
// </div>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlaceholderDropZones = PlaceholderDropZones;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const editContext_1 = require("../client/editContext");
|
|
7
|
+
const componentTreeHelper_1 = require("../componentTreeHelper");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const PlaceholderDropZone_1 = require("./PlaceholderDropZone");
|
|
10
|
+
function PlaceholderDropZones({ scale, iframe, size, }) {
|
|
11
|
+
const [placeholders, setPlaceholders] = (0, react_1.useState)([]);
|
|
12
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
13
|
+
const pageViewContext = editContext?.pageView;
|
|
14
|
+
(0, react_1.useEffect)(() => {
|
|
15
|
+
if (!pageViewContext?.page)
|
|
16
|
+
return;
|
|
17
|
+
setPlaceholders((0, componentTreeHelper_1.getAllPlaceholders)(pageViewContext.page));
|
|
18
|
+
}, [pageViewContext?.page]);
|
|
19
|
+
if (!pageViewContext ||
|
|
20
|
+
(!editContext?.dragObject && !editContext.selectedForInsertion) ||
|
|
21
|
+
!placeholders)
|
|
22
|
+
return null;
|
|
23
|
+
const matchingPlaceholders = placeholders.filter((x) => x.parentComponent?.id === editContext.selectedForInsertion ||
|
|
24
|
+
x.insertOptions?.find((y) => y.typeId === editContext.selectedForInsertion ||
|
|
25
|
+
y.typeId === editContext.dragObject?.typeId ||
|
|
26
|
+
y.typeId === editContext.dragObject?.templateId ||
|
|
27
|
+
y.compatibleTemplates?.find((z) => z == editContext.dragObject?.typeId) !== undefined ||
|
|
28
|
+
y.typeId === editContext.dragObject?.templateId ||
|
|
29
|
+
y.compatibleTemplates?.find((z) => z == editContext.dragObject?.templateId) !== undefined));
|
|
30
|
+
if (!iframe)
|
|
31
|
+
return;
|
|
32
|
+
const zones = [];
|
|
33
|
+
const scrollHeight = editContext.pageView.editorIframeRef?.current?.contentWindow?.document
|
|
34
|
+
.documentElement.scrollHeight || 0;
|
|
35
|
+
matchingPlaceholders.forEach((placeholder) => {
|
|
36
|
+
const placeholderElement = iframe.contentWindow?.document.body.querySelector("[data-placeholder-start='" + placeholder.key + "']");
|
|
37
|
+
if (!placeholderElement)
|
|
38
|
+
return;
|
|
39
|
+
const prev = getPreviousElement(placeholderElement);
|
|
40
|
+
const nextOrParent = getNextElement(placeholderElement) || placeholderElement.parentElement;
|
|
41
|
+
const orientation = placeholderElement?.getAttribute("data-orientation");
|
|
42
|
+
const rect = (prev ?? nextOrParent).getBoundingClientRect();
|
|
43
|
+
const zoom = pageViewContext.zoom;
|
|
44
|
+
const position = orientation === "horizontal"
|
|
45
|
+
? {
|
|
46
|
+
x: (prev ? rect.x + rect.width : rect.x) * zoom,
|
|
47
|
+
y: (rect.y + rect.height / 2) * zoom,
|
|
48
|
+
}
|
|
49
|
+
: {
|
|
50
|
+
x: (rect.x + rect.width / 2) * zoom,
|
|
51
|
+
y: (prev ? rect.y + rect.height : rect.y) * zoom,
|
|
52
|
+
};
|
|
53
|
+
let index = 0;
|
|
54
|
+
const description = placeholderElement.getAttribute("data-description");
|
|
55
|
+
let anchor = "top";
|
|
56
|
+
if (prev && orientation === "horizontal") {
|
|
57
|
+
anchor = "right";
|
|
58
|
+
}
|
|
59
|
+
if (prev && orientation !== "horizontal") {
|
|
60
|
+
anchor = "bottom";
|
|
61
|
+
}
|
|
62
|
+
if (!prev && orientation === "horizontal") {
|
|
63
|
+
anchor = "left";
|
|
64
|
+
}
|
|
65
|
+
if (!prev && orientation !== "horizontal") {
|
|
66
|
+
anchor = "top";
|
|
67
|
+
}
|
|
68
|
+
zones.push({
|
|
69
|
+
placeholder,
|
|
70
|
+
position,
|
|
71
|
+
index,
|
|
72
|
+
element: prev ?? nextOrParent,
|
|
73
|
+
anchor,
|
|
74
|
+
description,
|
|
75
|
+
});
|
|
76
|
+
let nextElement = placeholderElement?.nextElementSibling;
|
|
77
|
+
while (nextElement) {
|
|
78
|
+
nextElement = nextElement?.nextElementSibling;
|
|
79
|
+
if (nextElement) {
|
|
80
|
+
if (nextElement.getAttribute("data-placeholder-end") === placeholder.key) {
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
if (nextElement.getAttribute("data-component-end")) {
|
|
84
|
+
const componentRect = (0, utils_1.findComponentRect)(iframe, (nextElement.getAttribute("data-component-end") ||
|
|
85
|
+
nextElement.getAttribute("data-dropzone")));
|
|
86
|
+
if (!componentRect)
|
|
87
|
+
continue;
|
|
88
|
+
const position = getPositionFromRect(componentRect.rect, pageViewContext.zoom, orientation);
|
|
89
|
+
index++;
|
|
90
|
+
zones.push({
|
|
91
|
+
placeholder,
|
|
92
|
+
position,
|
|
93
|
+
index,
|
|
94
|
+
anchor: orientation === "horizontal" ? "right" : "bottom",
|
|
95
|
+
element: componentRect.elements[componentRect.elements.length - 1],
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
else if (nextElement.getAttribute("data-dropzone")) {
|
|
99
|
+
const rect = nextElement.getBoundingClientRect();
|
|
100
|
+
const position = getPositionFromRect(rect, pageViewContext.zoom);
|
|
101
|
+
index++;
|
|
102
|
+
zones.push({
|
|
103
|
+
placeholder,
|
|
104
|
+
position,
|
|
105
|
+
index,
|
|
106
|
+
anchor: orientation === "horizontal" ? "left" : "top",
|
|
107
|
+
element: nextElement,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return zones.map((zone, index) => {
|
|
114
|
+
const x = Math.min(pageViewContext.viewport.width - 20, Math.max(20, zone.position.x * (scale || 1)));
|
|
115
|
+
const y = Math.min(scrollHeight - 20, Math.max(20 - pageViewContext.scroll, zone.position.y * (scale || 1)));
|
|
116
|
+
return ((0, jsx_runtime_1.jsx)(PlaceholderDropZone_1.PlaceholderDropZone, { placeholder: zone.placeholder, spotPosition: {
|
|
117
|
+
x,
|
|
118
|
+
y,
|
|
119
|
+
}, index: zone.index, size: size, spotPositionElement: zone.element, spotPositionAnchor: zone.anchor, parentName: zone.placeholder.parentComponent?.name, description: zone.description || undefined }, index));
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function getPreviousElement(element) {
|
|
123
|
+
let prev = element.previousElementSibling;
|
|
124
|
+
while (prev && prev.tagName === "SCRIPT") {
|
|
125
|
+
prev = prev.previousElementSibling;
|
|
126
|
+
}
|
|
127
|
+
return prev;
|
|
128
|
+
}
|
|
129
|
+
function getNextElement(element) {
|
|
130
|
+
let next = element.nextElementSibling;
|
|
131
|
+
while (next && next.tagName === "SCRIPT") {
|
|
132
|
+
next = next.nextElementSibling;
|
|
133
|
+
}
|
|
134
|
+
return next;
|
|
135
|
+
}
|
|
136
|
+
function getPositionFromRect(rect, zoom, orientation) {
|
|
137
|
+
const position = orientation === "horizontal"
|
|
138
|
+
? {
|
|
139
|
+
x: rect.x + rect.width * zoom,
|
|
140
|
+
y: (rect.y + rect.height / 2) * zoom,
|
|
141
|
+
}
|
|
142
|
+
: {
|
|
143
|
+
x: (rect.x + rect.width / 2) * zoom,
|
|
144
|
+
y: rect.y + rect.height * zoom,
|
|
145
|
+
};
|
|
146
|
+
return position;
|
|
147
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeviceToolbar = DeviceToolbar;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const dropdown_1 = require("primereact/dropdown");
|
|
6
|
+
const inputnumber_1 = require("primereact/inputnumber");
|
|
7
|
+
const SimpleIconButton_1 = require("../ui/SimpleIconButton");
|
|
8
|
+
const Icons_1 = require("../ui/Icons");
|
|
9
|
+
const use_debounce_1 = require("use-debounce");
|
|
10
|
+
function DeviceToolbar({ pageViewContext, configuration, }) {
|
|
11
|
+
const debouncedSetDeviceWidth = (0, use_debounce_1.useDebouncedCallback)((width) => {
|
|
12
|
+
pageViewContext.setDeviceWidth(width);
|
|
13
|
+
}, 400);
|
|
14
|
+
const debouncedSetDeviceHeight = (0, use_debounce_1.useDebouncedCallback)((height) => {
|
|
15
|
+
pageViewContext.setDeviceHeight(height);
|
|
16
|
+
}, 400);
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex justify-center w-full items-center bg-gray-100 p-1 z-1000 text-sm gap-2 border-b", children: [(0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, { options: configuration.devices.map((x) => ({
|
|
18
|
+
label: x.name,
|
|
19
|
+
value: x.name,
|
|
20
|
+
})), value: pageViewContext.device, onChange: (e) => pageViewContext.setDevice(e.value) }), (0, jsx_runtime_1.jsx)(inputnumber_1.InputNumber, { size: 4, max: 10000, className: "text-sm", value: pageViewContext.deviceWidth, onChange: (e) => debouncedSetDeviceWidth(e.value || undefined) }), "x", (0, jsx_runtime_1.jsx)(inputnumber_1.InputNumber, { size: 4, max: 10000, className: "text-sm", value: pageViewContext.deviceHeight, onChange: (e) => debouncedSetDeviceHeight(e.value || undefined) }), (0, jsx_runtime_1.jsx)(SimpleIconButton_1.SimpleIconButton, { icon: "pi pi-lock", selected: pageViewContext.lockHeight || false, onClick: () => pageViewContext.setLockHeight(!pageViewContext.lockHeight), label: "Lock Height" }), (0, jsx_runtime_1.jsx)(SimpleIconButton_1.SimpleIconButton, { icon: (0, jsx_runtime_1.jsx)(Icons_1.RotateDeviceIcon, { className: "w-4 h-4" }), selected: pageViewContext.rotate || false, onClick: () => pageViewContext.setRotate(!pageViewContext.rotate), label: "Rotate" })] }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EditorForm = EditorForm;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const editContext_1 = require("../client/editContext");
|
|
6
|
+
const componentTreeHelper_1 = require("../componentTreeHelper");
|
|
7
|
+
const FieldList_1 = require("../FieldList");
|
|
8
|
+
const ItemInfo_1 = require("../ItemInfo");
|
|
9
|
+
const Insert_1 = require("../sidebar/Insert");
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const SimpleIconButton_1 = require("../ui/SimpleIconButton");
|
|
12
|
+
const Spinner_1 = require("../ui/Spinner");
|
|
13
|
+
const SimpleTabs_1 = require("../ui/SimpleTabs");
|
|
14
|
+
function EditorForm({ pageViewContext, readonly, }) {
|
|
15
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
16
|
+
if (!pageViewContext)
|
|
17
|
+
pageViewContext = editContext.pageView;
|
|
18
|
+
const setInsertMode = editContext.setInsertMode;
|
|
19
|
+
const insertMode = editContext.insertMode;
|
|
20
|
+
const [activeTabKey, setActiveTabKey] = (0, react_1.useState)("content");
|
|
21
|
+
const [item, setItem] = (0, react_1.useState)();
|
|
22
|
+
const [component, setComponent] = (0, react_1.useState)();
|
|
23
|
+
const toggleInsertMode = () => {
|
|
24
|
+
if (insertMode) {
|
|
25
|
+
setInsertMode(false);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
// if (editContext.selection.length > 0)
|
|
29
|
+
// editContext.setSelectedForInsertion(editContext.selection[0]);
|
|
30
|
+
setInsertMode(true);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
(0, react_1.useEffect)(() => {
|
|
34
|
+
if (editContext.selectedForInsertion)
|
|
35
|
+
setInsertMode(true);
|
|
36
|
+
}, [editContext.selectedForInsertion]);
|
|
37
|
+
let isShared = false;
|
|
38
|
+
(0, react_1.useEffect)(() => {
|
|
39
|
+
if (!pageViewContext.page)
|
|
40
|
+
return;
|
|
41
|
+
let newSelectedItem;
|
|
42
|
+
if (editContext.selection.length === 1) {
|
|
43
|
+
const component = (0, componentTreeHelper_1.getComponentById)(editContext.selection[0], pageViewContext.page);
|
|
44
|
+
setComponent(component);
|
|
45
|
+
newSelectedItem = component?.datasourceItem;
|
|
46
|
+
if (component?.datasourceItem &&
|
|
47
|
+
component?.datasourceItem?.id !== component?.id)
|
|
48
|
+
isShared = true;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
newSelectedItem = pageViewContext.page.rootComponent.datasourceItem;
|
|
52
|
+
setComponent(pageViewContext.page.rootComponent);
|
|
53
|
+
}
|
|
54
|
+
// if (
|
|
55
|
+
// newSelectedItem?.id !== item?.id ||
|
|
56
|
+
// newSelectedItem?.language !== item?.language ||
|
|
57
|
+
// newSelectedItem?.version !== item?.version
|
|
58
|
+
// ) {
|
|
59
|
+
// setInsertMode(false);
|
|
60
|
+
// }
|
|
61
|
+
setItem(newSelectedItem || pageViewContext.page.rootComponent.datasourceItem);
|
|
62
|
+
}, [
|
|
63
|
+
editContext.selection,
|
|
64
|
+
pageViewContext.page,
|
|
65
|
+
pageViewContext.pageItemDescriptor,
|
|
66
|
+
]);
|
|
67
|
+
if (!item)
|
|
68
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "grid h-full w-full items-center justify-center", children: (0, jsx_runtime_1.jsx)(Spinner_1.Spinner, {}) }));
|
|
69
|
+
const validators = editContext.validationResult?.find((x) => x.item.id === item?.id &&
|
|
70
|
+
x.item.language === item?.language &&
|
|
71
|
+
x.item.version === item?.version)?.results || [];
|
|
72
|
+
let designFields = Object.values(item?.fields).filter((x) => x.section === "Design" || x.section === "Rendering");
|
|
73
|
+
const editorFields = component?.editorFields;
|
|
74
|
+
if (editorFields && editorFields["Design"]) {
|
|
75
|
+
editorFields["Design"]?.addFields.forEach((fieldName) => {
|
|
76
|
+
const field = item?.fields.find((x) => x.name === fieldName);
|
|
77
|
+
if (field)
|
|
78
|
+
designFields.push(field);
|
|
79
|
+
});
|
|
80
|
+
editorFields["Design"]?.removeFields.forEach((fieldName) => {
|
|
81
|
+
designFields = designFields.filter((x) => x.name !== fieldName);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
const itemFields = [];
|
|
85
|
+
const contentFields = Object.values(item?.fields).filter((x) => ((editorFields && editorFields["Content"]?.addFields.includes(x.name)) ||
|
|
86
|
+
item.renderedFieldIds.indexOf(x.id) >= 0) &&
|
|
87
|
+
!(editorFields && editorFields["Content"]?.removeFields.includes(x.name)));
|
|
88
|
+
if (contentFields.length > 0)
|
|
89
|
+
itemFields.push({ fields: contentFields });
|
|
90
|
+
component?.items
|
|
91
|
+
.filter((x) => x.id !== item.id)
|
|
92
|
+
.forEach((i) => {
|
|
93
|
+
const fields = [];
|
|
94
|
+
i.renderedFieldIds.forEach((id) => {
|
|
95
|
+
const field = Object.values(i?.fields).find((x) => x.id === id);
|
|
96
|
+
if (field)
|
|
97
|
+
fields.push(field);
|
|
98
|
+
});
|
|
99
|
+
if (fields.length > 0)
|
|
100
|
+
itemFields.push({ headline: i.name, fields });
|
|
101
|
+
});
|
|
102
|
+
const getFieldsTab = (fields, headline, id) => {
|
|
103
|
+
return {
|
|
104
|
+
label: headline,
|
|
105
|
+
content: ((0, jsx_runtime_1.jsx)("div", { className: "relative h-full", children: (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 overflow-auto px-3", children: (0, jsx_runtime_1.jsx)(FieldList_1.FieldList, { fields: fields, validators: validators, simplified: true, readonly: readonly }) }) })),
|
|
106
|
+
id,
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
const tabPanels = [];
|
|
110
|
+
if (itemFields.length > 0)
|
|
111
|
+
tabPanels.push(getFieldsTab(itemFields, "Content", "content"));
|
|
112
|
+
//TODO: generalize this
|
|
113
|
+
if (editorFields) {
|
|
114
|
+
Object.keys(editorFields).forEach((key) => {
|
|
115
|
+
if (key !== "Content" && key !== "Design") {
|
|
116
|
+
const fields = item?.fields.filter((x) => editorFields[key]?.addFields.includes(x.name));
|
|
117
|
+
if (fields?.length)
|
|
118
|
+
tabPanels.push(getFieldsTab([{ fields }], key, key));
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
if (designFields?.length)
|
|
123
|
+
tabPanels.push(getFieldsTab([{ fields: designFields }], "Design", "design"));
|
|
124
|
+
tabPanels.push({
|
|
125
|
+
label: "Advanced",
|
|
126
|
+
content: ((0, jsx_runtime_1.jsx)("div", { className: "relative h-full", children: (0, jsx_runtime_1.jsxs)("div", { className: "absolute inset-0 overflow-auto px-3", children: [(0, jsx_runtime_1.jsx)(ItemInfo_1.ItemInfo, { item: item }), (0, jsx_runtime_1.jsx)(FieldList_1.FieldList, { fields: [{ fields: item.fields }], validators: validators, showStandardFieldsEnabled: true, readonly: readonly })] }) })),
|
|
127
|
+
id: "advanced",
|
|
128
|
+
});
|
|
129
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex h-full flex-col bg-gray-50", "data-testid": "editor-sidepanel", children: [(0, jsx_runtime_1.jsxs)("h1", { className: "flex h-12 items-center justify-center border-b border-gray-200 p-2", children: [editContext.selection.length > 0 && ((0, jsx_runtime_1.jsx)(SimpleIconButton_1.SimpleIconButton, { icon: "pi pi-angle-left", onClick: () => editContext.select([]), label: "Back to page", size: "large" })), editContext.selection.length === 0 && (0, jsx_runtime_1.jsx)("div", { className: "w-12" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 text-center", id: "item-name", "data-testid": "component-name", children: [item?.name, isShared && ((0, jsx_runtime_1.jsx)("span", { className: "ml-2 rounded-md bg-orange-400 p-2 text-sm text-black", children: "Shared" }))] }), (0, jsx_runtime_1.jsx)(SimpleIconButton_1.SimpleIconButton, { id: "insert-component-button", icon: insertMode ? "pi pi-pencil" : "pi pi-plus", onClick: () => toggleInsertMode(), label: insertMode ? "Continue editing" : "Insert component", size: "large", disabled: !editContext.page?.item.canWriteItem || !item?.canWriteItem })] }), insertMode && (0, jsx_runtime_1.jsx)(Insert_1.Insert, {}), !insertMode && ((0, jsx_runtime_1.jsx)(SimpleTabs_1.SimpleTabs, { tabs: tabPanels, className: "flex flex-1 items-center justify-center border-b border-gray-200 bg-gray-50 py-3 text-sm", activeTab: tabPanels.findIndex((x) => x.id === activeTabKey) || 0, setActiveTab: (index) => setActiveTabKey(tabPanels[index]?.id) }, "editor-tabs"))] }));
|
|
130
|
+
}
|