@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,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Debug = Debug;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const tabview_1 = require("primereact/tabview");
|
|
6
|
+
const CopyToClipboardButton_1 = require("../ui/CopyToClipboardButton");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const componentTreeHelper_1 = require("../componentTreeHelper");
|
|
9
|
+
const react_inspector_1 = require("react-inspector");
|
|
10
|
+
const editContext_1 = require("../client/editContext");
|
|
11
|
+
const contentService_1 = require("../services/contentService");
|
|
12
|
+
function Debug({}) {
|
|
13
|
+
const [activeTab, setActiveTab] = (0, react_1.useState)(0);
|
|
14
|
+
const [pageLayout, setPageLayout] = (0, react_1.useState)(null);
|
|
15
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
16
|
+
if (!editContext)
|
|
17
|
+
return;
|
|
18
|
+
(0, react_1.useEffect)(() => {
|
|
19
|
+
const loadLayout = async () => {
|
|
20
|
+
if (!editContext.currentItemDescriptor)
|
|
21
|
+
return;
|
|
22
|
+
const layout = await (0, contentService_1.getPageJson)(editContext.currentItemDescriptor);
|
|
23
|
+
setPageLayout(layout);
|
|
24
|
+
};
|
|
25
|
+
loadLayout();
|
|
26
|
+
}, [editContext.currentItemDescriptor, editContext.itemsRepository.revision]);
|
|
27
|
+
const page = pageLayout; // editContext.page;
|
|
28
|
+
let component = null;
|
|
29
|
+
if (page) {
|
|
30
|
+
const selectedComponents = editContext.selection
|
|
31
|
+
.map((x) => (0, componentTreeHelper_1.getComponentByIdFromHeadlessLayout)(x, page))
|
|
32
|
+
.filter((x) => x);
|
|
33
|
+
component = selectedComponents.length === 1 ? selectedComponents[0] : null;
|
|
34
|
+
}
|
|
35
|
+
if (!component && !page)
|
|
36
|
+
return;
|
|
37
|
+
const replacer = function (key, value) {
|
|
38
|
+
if (key === "parentComponent" ||
|
|
39
|
+
key === "placeholderReference" ||
|
|
40
|
+
key === "_editor") {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
return value;
|
|
44
|
+
};
|
|
45
|
+
const tabs = [];
|
|
46
|
+
const defaultNodeRenderer = ({ depth, name, data, isNonenumerable }) => {
|
|
47
|
+
if (name == "__editor" ||
|
|
48
|
+
name == "parentComponent" ||
|
|
49
|
+
name == "placeholderReference")
|
|
50
|
+
return null;
|
|
51
|
+
return depth === 0 ? ((0, jsx_runtime_1.jsx)(react_inspector_1.ObjectRootLabel, { name: name, data: data })) : ((0, jsx_runtime_1.jsx)(react_inspector_1.ObjectLabel, { name: name, data: data, isNonenumerable: isNonenumerable }));
|
|
52
|
+
};
|
|
53
|
+
if (component) {
|
|
54
|
+
tabs.push((0, jsx_runtime_1.jsx)(tabview_1.TabPanel, { header: "Component", className: "relative h-full", children: (0, jsx_runtime_1.jsx)("div", { className: "relative h-full", children: (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 overflow-auto p-2", children: (0, jsx_runtime_1.jsx)(react_inspector_1.ObjectInspector, { data: component, nodeRenderer: defaultNodeRenderer }) }) }) }, "component"));
|
|
55
|
+
}
|
|
56
|
+
tabs.push((0, jsx_runtime_1.jsx)(tabview_1.TabPanel, { header: "Page", className: "relative h-full", children: (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 overflow-auto p-2", children: (0, jsx_runtime_1.jsx)(react_inspector_1.ObjectInspector, { data: page, nodeRenderer: defaultNodeRenderer }) }) }, "page"));
|
|
57
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "relative h-[calc(100%-6px)]", children: [(0, jsx_runtime_1.jsx)(tabview_1.TabView, { className: "alpaceditor-tabs h-full", onTabChange: (ev) => {
|
|
58
|
+
setActiveTab(ev.index);
|
|
59
|
+
}, activeIndex: activeTab, children: tabs }), (0, jsx_runtime_1.jsx)("div", { className: "absolute top-2 right-1", children: (0, jsx_runtime_1.jsx)(CopyToClipboardButton_1.CopyToClipboardButton, { text: JSON.stringify(activeTab === 0 && component ? component : page, replacer, 2) }) })] }));
|
|
60
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DictionaryEditor = DictionaryEditor;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const editContext_1 = require("../client/editContext");
|
|
8
|
+
const contentService_1 = require("../services/contentService");
|
|
9
|
+
const SimpleTable_1 = require("../ui/SimpleTable");
|
|
10
|
+
const progressspinner_1 = require("primereact/progressspinner");
|
|
11
|
+
const inputtext_1 = require("primereact/inputtext");
|
|
12
|
+
const button_1 = require("primereact/button");
|
|
13
|
+
const utils_1 = require("primereact/utils");
|
|
14
|
+
const CenteredMessage_1 = require("../ui/CenteredMessage");
|
|
15
|
+
const dropdown_1 = require("primereact/dropdown");
|
|
16
|
+
const SimpleToolbar_1 = require("../ui/SimpleToolbar");
|
|
17
|
+
function DictionaryEditor({}) {
|
|
18
|
+
const context = (0, editContext_1.useEditContext)();
|
|
19
|
+
const [dictionary, setDictionary] = (0, react_1.useState)({});
|
|
20
|
+
const [renderedDictionaryKeys, setRenderedDictionaryKeys] = (0, react_1.useState)();
|
|
21
|
+
const [unknownKeys, setUnknownKeys] = (0, react_1.useState)();
|
|
22
|
+
const [otherKeys, setOtherKeys] = (0, react_1.useState)();
|
|
23
|
+
const [validKeys, setValidKeys] = (0, react_1.useState)();
|
|
24
|
+
const [sites, setSites] = (0, react_1.useState)();
|
|
25
|
+
const [siteName, setSiteName] = (0, react_1.useState)();
|
|
26
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
27
|
+
(0, react_1.useEffect)(() => {
|
|
28
|
+
if (!context?.pageView.site)
|
|
29
|
+
return;
|
|
30
|
+
setSiteName(context.pageView.site.name);
|
|
31
|
+
}, [context?.pageView.site]);
|
|
32
|
+
(0, react_1.useEffect)(() => {
|
|
33
|
+
const loadSites = async () => {
|
|
34
|
+
setLoading(true);
|
|
35
|
+
const sites = await (0, contentService_1.getSites)();
|
|
36
|
+
if (sites.data)
|
|
37
|
+
setSites(sites.data);
|
|
38
|
+
setLoading(false);
|
|
39
|
+
};
|
|
40
|
+
loadSites();
|
|
41
|
+
}, []);
|
|
42
|
+
const currentItemDescriptor = context?.currentItemDescriptor;
|
|
43
|
+
(0, react_1.useEffect)(() => {
|
|
44
|
+
if (!siteName || !currentItemDescriptor)
|
|
45
|
+
return;
|
|
46
|
+
const loadDictionary = async (site, language) => {
|
|
47
|
+
const dictionary = await (0, contentService_1.getDictionary)(site, language);
|
|
48
|
+
setDictionary(dictionary);
|
|
49
|
+
};
|
|
50
|
+
loadDictionary(siteName, currentItemDescriptor.language);
|
|
51
|
+
}, [siteName, currentItemDescriptor]);
|
|
52
|
+
(0, react_1.useEffect)(() => {
|
|
53
|
+
const findAllKeys = (component, keys) => {
|
|
54
|
+
component.renderedDictionaryKeys.forEach((k) => {
|
|
55
|
+
if (!keys.includes(k))
|
|
56
|
+
keys.push(k);
|
|
57
|
+
});
|
|
58
|
+
component.placeholders.forEach((p) => {
|
|
59
|
+
p.components.forEach((c) => findAllKeys(c, keys));
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
if (!context?.page)
|
|
63
|
+
return;
|
|
64
|
+
const keys = [];
|
|
65
|
+
findAllKeys(context.page.rootComponent, keys);
|
|
66
|
+
setRenderedDictionaryKeys(keys);
|
|
67
|
+
}, [context?.page]);
|
|
68
|
+
(0, react_1.useEffect)(() => {
|
|
69
|
+
if (!dictionary || !renderedDictionaryKeys) {
|
|
70
|
+
setValidKeys([]);
|
|
71
|
+
setOtherKeys([]);
|
|
72
|
+
setUnknownKeys([]);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const getEntries = (keys) => {
|
|
76
|
+
const entries = Object.keys(dictionary)
|
|
77
|
+
.filter((k) => keys.includes(k))
|
|
78
|
+
.map((k) => ({
|
|
79
|
+
key: k,
|
|
80
|
+
field: dictionary[k],
|
|
81
|
+
translation: dictionary[k].value,
|
|
82
|
+
}));
|
|
83
|
+
entries.sort((a, b) => (a.key > b.key ? -1 : 1));
|
|
84
|
+
return entries;
|
|
85
|
+
};
|
|
86
|
+
const unknownKeys = renderedDictionaryKeys.filter((k) => !dictionary[k]);
|
|
87
|
+
unknownKeys.sort((a, b) => (a > b ? -1 : 1));
|
|
88
|
+
setUnknownKeys(unknownKeys);
|
|
89
|
+
setValidKeys(getEntries(renderedDictionaryKeys.filter((k) => dictionary[k])));
|
|
90
|
+
setOtherKeys(getEntries(Object.keys(dictionary).filter((k) => !renderedDictionaryKeys.includes(k))));
|
|
91
|
+
}, [renderedDictionaryKeys, dictionary]);
|
|
92
|
+
const getContent = () => {
|
|
93
|
+
if (!unknownKeys || !validKeys || !otherKeys)
|
|
94
|
+
return null;
|
|
95
|
+
if (!siteName)
|
|
96
|
+
return (0, jsx_runtime_1.jsx)(CenteredMessage_1.CenteredMessage, { children: "No Site" });
|
|
97
|
+
if (loading)
|
|
98
|
+
return (0, jsx_runtime_1.jsx)(CenteredMessage_1.CenteredMessage, { children: "Loading..." });
|
|
99
|
+
if (!dictionary)
|
|
100
|
+
return (0, jsx_runtime_1.jsx)(CenteredMessage_1.CenteredMessage, { children: "No dictionary found" });
|
|
101
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Divider, { text: "Keys rendered on this page", className: "mt-1" }), (0, jsx_runtime_1.jsx)(DictionaryTable, { entries: validKeys, context: context }), (0, jsx_runtime_1.jsx)(Divider, { text: "\u26A0 Unknown keys", className: "mt-6" }), (0, jsx_runtime_1.jsx)(UnknownKeysTable, { entries: unknownKeys }), (0, jsx_runtime_1.jsx)(Divider, { text: "Other keys", className: "mt-6" }), (0, jsx_runtime_1.jsx)(DictionaryTable, { entries: otherKeys, context: context })] }));
|
|
102
|
+
};
|
|
103
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-1 h-full", children: [(0, jsx_runtime_1.jsxs)(SimpleToolbar_1.SimpleToolbar, { children: ["Site:", " ", (0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, { options: sites?.map((s) => ({ label: s.name, value: s.name })) || [], value: siteName, onChange: (e) => setSiteName(e.value) })] }), getContent()] }));
|
|
104
|
+
}
|
|
105
|
+
function Divider({ text, className }) {
|
|
106
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.classNames)(className, "py-1 flex items-center text-sm font-bold before:flex-1 before:border-t before:border-gray-200 before:me-6 after:flex-1 after:border-t after:border-gray-200 after:ms-6"), children: text }));
|
|
107
|
+
}
|
|
108
|
+
function DictionaryTable({ entries, context, }) {
|
|
109
|
+
const [editing, setEditing] = (0, react_1.useState)();
|
|
110
|
+
const [value, setValue] = (0, react_1.useState)("");
|
|
111
|
+
const [refresh, setRefresh] = (0, react_1.useState)(false);
|
|
112
|
+
const modifiedFieldsContext = (0, editContext_1.useModifiedFieldsContext)();
|
|
113
|
+
(0, react_1.useEffect)(() => {
|
|
114
|
+
if (refresh) {
|
|
115
|
+
setEditing(undefined);
|
|
116
|
+
setRefresh(false);
|
|
117
|
+
}
|
|
118
|
+
}, [context.refreshCompletedFlag]);
|
|
119
|
+
const textEditor = (entry) => {
|
|
120
|
+
if (entry.field)
|
|
121
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-wrap gap-2 items-center", children: [(0, jsx_runtime_1.jsx)(inputtext_1.InputText, { value: value, disabled: refresh, onChange: (e) => setValue(e.target.value), autoFocus: true }), !refresh && ((0, jsx_runtime_1.jsx)(button_1.Button, { size: "small", onClick: () => {
|
|
122
|
+
setRefresh(true);
|
|
123
|
+
if (!entry.field)
|
|
124
|
+
return;
|
|
125
|
+
context?.operations.editField({
|
|
126
|
+
field: entry.field.descriptor,
|
|
127
|
+
value: value,
|
|
128
|
+
refresh: "immediate",
|
|
129
|
+
});
|
|
130
|
+
}, children: "Apply" })), refresh && ((0, jsx_runtime_1.jsx)(progressspinner_1.ProgressSpinner, { style: { width: "20px", height: "20px" } }))] }));
|
|
131
|
+
else
|
|
132
|
+
return null;
|
|
133
|
+
};
|
|
134
|
+
const columns = [
|
|
135
|
+
{ body: (entry) => entry.key, header: "Key" },
|
|
136
|
+
{
|
|
137
|
+
body: (entry) => {
|
|
138
|
+
const modifiedField = modifiedFieldsContext?.modifiedFields.find((x) => x.fieldId === entry.field?.id &&
|
|
139
|
+
x.item.id === entry.field?.descriptor.item.id &&
|
|
140
|
+
x.item.language === entry.field?.descriptor.item.language &&
|
|
141
|
+
x.item.version === entry.field?.descriptor.item.version);
|
|
142
|
+
if (editing === entry.key)
|
|
143
|
+
return textEditor(entry);
|
|
144
|
+
else
|
|
145
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "min-w-ful cursor-pointer", onClick: () => {
|
|
146
|
+
if (!editing) {
|
|
147
|
+
setValue(modifiedField?.value ?? entry.translation);
|
|
148
|
+
setEditing(entry.key);
|
|
149
|
+
}
|
|
150
|
+
}, children: [modifiedField?.value ?? entry.translation, " \u00A0"] }));
|
|
151
|
+
},
|
|
152
|
+
header: "Translation",
|
|
153
|
+
},
|
|
154
|
+
];
|
|
155
|
+
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(SimpleTable_1.SimpleTable, { items: entries, columns: columns }) }));
|
|
156
|
+
}
|
|
157
|
+
function UnknownKeysTable({ entries }) {
|
|
158
|
+
const columns = [{ body: (entry) => entry, header: "Key" }];
|
|
159
|
+
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(SimpleTable_1.SimpleTable, { items: entries, columns: columns }) }));
|
|
160
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.EditHistory = EditHistory;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const utils_1 = require("primereact/utils");
|
|
7
|
+
const editContext_1 = require("../client/editContext");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const Icons_1 = require("../ui/Icons");
|
|
10
|
+
const SimpleIconButton_1 = require("../ui/SimpleIconButton");
|
|
11
|
+
const undo_1 = require("../commands/undo");
|
|
12
|
+
const utils_2 = require("../utils");
|
|
13
|
+
const SimpleToolbar_1 = require("../ui/SimpleToolbar");
|
|
14
|
+
function EditHistory() {
|
|
15
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
16
|
+
const [showOnlyMyChanges, setShowOnlyMyChanges] = (0, react_1.useState)(true);
|
|
17
|
+
const [history, setHistory] = (0, react_1.useState)([]);
|
|
18
|
+
if (!editContext)
|
|
19
|
+
return;
|
|
20
|
+
(0, react_1.useEffect)(() => {
|
|
21
|
+
let operations = showOnlyMyChanges
|
|
22
|
+
? editContext.editHistory.filter((x) => x.sessionId === editContext.sessionId)
|
|
23
|
+
: editContext.editHistory;
|
|
24
|
+
operations = filterUndone(operations);
|
|
25
|
+
setHistory(operations);
|
|
26
|
+
}, [editContext.editHistory]);
|
|
27
|
+
const undoCommand = (0, undo_1.getUndoCommand)();
|
|
28
|
+
const redoCommand = (0, undo_1.getRedoCommand)();
|
|
29
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "absolute inset-0 flex flex-col", children: [(0, jsx_runtime_1.jsxs)(SimpleToolbar_1.SimpleToolbar, { children: [(0, jsx_runtime_1.jsx)(SimpleIconButton_1.SimpleIconButton, { selected: showOnlyMyChanges, onClick: () => setShowOnlyMyChanges(!showOnlyMyChanges), icon: "pi pi-user", label: "Show only my changes" }), (0, jsx_runtime_1.jsx)(SimpleIconButton_1.SimpleIconButton, { onClick: (ev) => {
|
|
30
|
+
editContext.executeCommand({ command: undoCommand, event: ev });
|
|
31
|
+
}, icon: undoCommand.icon, label: undoCommand.label, disabled: editContext.isCommandDisabled({ command: undoCommand }) }), (0, jsx_runtime_1.jsx)(SimpleIconButton_1.SimpleIconButton, { onClick: (ev) => {
|
|
32
|
+
editContext.executeCommand({ command: redoCommand, event: ev });
|
|
33
|
+
}, icon: redoCommand.icon, label: redoCommand.label, disabled: editContext.isCommandDisabled({ command: redoCommand }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-1 flex-col overflow-x-hidden overflow-y-auto text-sm", children: history.map((o, i) => singleOperation(i, o)) })] }));
|
|
34
|
+
function getDate(o) {
|
|
35
|
+
const date = new Date(o.date);
|
|
36
|
+
return (0, utils_2.formatDate)(date);
|
|
37
|
+
}
|
|
38
|
+
function singleOperation(i, o) {
|
|
39
|
+
let className = "border-b border-gray-200 p-2 flex justify-between items-start text-xs hover:bg-gray-100";
|
|
40
|
+
if (o.undone)
|
|
41
|
+
className = className + " text-gray-300";
|
|
42
|
+
if (o.focus)
|
|
43
|
+
className = className + " cursor-pointer";
|
|
44
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: className, onClick: () => {
|
|
45
|
+
if (o.focus) {
|
|
46
|
+
const focusComponents = o.focus.split(":");
|
|
47
|
+
if (focusComponents.length > 0) {
|
|
48
|
+
editContext?.select([focusComponents[0]]);
|
|
49
|
+
}
|
|
50
|
+
if (focusComponents.length > 1 &&
|
|
51
|
+
focusComponents[1] &&
|
|
52
|
+
focusComponents[0]) {
|
|
53
|
+
editContext?.setFocusedField({
|
|
54
|
+
item: {
|
|
55
|
+
id: focusComponents[0],
|
|
56
|
+
language: editContext.page.item.language,
|
|
57
|
+
version: editContext.page.item.version,
|
|
58
|
+
},
|
|
59
|
+
fieldId: focusComponents[1],
|
|
60
|
+
}, false);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex gap-1", children: [o.user?.ai && ((0, jsx_runtime_1.jsx)(Icons_1.WizardIcon, { className: (0, utils_1.classNames)("h-4 w-4", o.undone ? "text-gray-200" : "text-gray-500") })), (0, jsx_runtime_1.jsx)("div", { children: o.description })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs", children: getDate(o) }), !showOnlyMyChanges && (0, jsx_runtime_1.jsx)("div", { className: "text-xs", children: o.user?.name })] })] }, i));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function filterUndone(operations) {
|
|
67
|
+
let allUndone = true;
|
|
68
|
+
return operations.filter((o) => {
|
|
69
|
+
if (!o.undone) {
|
|
70
|
+
allUndone = false;
|
|
71
|
+
}
|
|
72
|
+
return allUndone || !o.undone;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GraphQL = GraphQL;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const splitter_1 = require("primereact/splitter");
|
|
6
|
+
const inputtextarea_1 = require("primereact/inputtextarea");
|
|
7
|
+
const button_1 = require("primereact/button");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const editContext_1 = require("../client/editContext");
|
|
10
|
+
const react_inspector_1 = require("react-inspector");
|
|
11
|
+
const SimpleTabs_1 = require("../ui/SimpleTabs");
|
|
12
|
+
function GraphQL() {
|
|
13
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
14
|
+
const [query, setQuery] = (0, react_1.useState)("");
|
|
15
|
+
const [showSpinner, setShowSpinner] = (0, react_1.useState)(false);
|
|
16
|
+
let item = editContext?.page?.item;
|
|
17
|
+
//const graphql = item?.graphql;
|
|
18
|
+
(0, react_1.useEffect)(() => {
|
|
19
|
+
setShowSpinner(false);
|
|
20
|
+
}, [editContext?.refreshCompletedFlag]);
|
|
21
|
+
(0, react_1.useEffect)(() => {
|
|
22
|
+
const graphql_query = item?.fields.find((x) => x.name === "graphql_query")?.rawValue;
|
|
23
|
+
if (graphql_query)
|
|
24
|
+
setQuery(graphql_query || "");
|
|
25
|
+
}, [item]);
|
|
26
|
+
// if (item) {
|
|
27
|
+
// const selectedComponents = editContext!.selection
|
|
28
|
+
// .map((x) => getComponentById(x, editContext!.page!))
|
|
29
|
+
// .filter((x) => x) as Component[];
|
|
30
|
+
// if (selectedComponents.length === 1) item = selectedComponents[0];
|
|
31
|
+
// }
|
|
32
|
+
// type JsonType = { [key: string]: any };
|
|
33
|
+
// function findFields(json: JsonType): { [key: string]: Array<JsonValueType> } {
|
|
34
|
+
// let result: { [key: string]: Array<JsonValueType> } = {};
|
|
35
|
+
// for (let key in json) {
|
|
36
|
+
// if (typeof json[key] === "object" && json[key] !== null) {
|
|
37
|
+
// let subResult = findFields(json[key]);
|
|
38
|
+
// for (let subKey in subResult) {
|
|
39
|
+
// if (result[subKey]) {
|
|
40
|
+
// result[subKey] = result[subKey].concat(subResult[subKey]);
|
|
41
|
+
// } else {
|
|
42
|
+
// result[subKey] = subResult[subKey];
|
|
43
|
+
// }
|
|
44
|
+
// }
|
|
45
|
+
// }
|
|
46
|
+
// if (key === "jsonValue" && json[key]) {
|
|
47
|
+
// let groupKey = `${json[key].itemId}_${json[key].language}_${json[key].version}`;
|
|
48
|
+
// if (result[groupKey]) {
|
|
49
|
+
// result[groupKey].push(json[key]);
|
|
50
|
+
// } else {
|
|
51
|
+
// result[groupKey] = [json[key]];
|
|
52
|
+
// }
|
|
53
|
+
// }
|
|
54
|
+
// }
|
|
55
|
+
// return result;
|
|
56
|
+
// }
|
|
57
|
+
//type JsonValueType = { itemId: string; language: string; version: string };
|
|
58
|
+
//const fieldsjsonValues = findFields(graphql);
|
|
59
|
+
// function renderItem(fields: Field[]) {
|
|
60
|
+
// const first = fields[0];
|
|
61
|
+
// const item = first.descriptor.item;
|
|
62
|
+
// if (!item) return null;
|
|
63
|
+
// return (
|
|
64
|
+
// <div key={first.id + item.id + item.language + item.version}>
|
|
65
|
+
// Item: {item.id} {first.id} {item.language} {item.version}
|
|
66
|
+
// <FieldList
|
|
67
|
+
// fields={fields}
|
|
68
|
+
// validators={
|
|
69
|
+
// editContext?.pageValidationResult?.find(
|
|
70
|
+
// (x) =>
|
|
71
|
+
// x.item.id === item.id &&
|
|
72
|
+
// x.item.language === item.language &&
|
|
73
|
+
// x.item.version === item.version
|
|
74
|
+
// )?.results || []
|
|
75
|
+
// }
|
|
76
|
+
// />
|
|
77
|
+
// </div>
|
|
78
|
+
// );
|
|
79
|
+
// }
|
|
80
|
+
if (!item)
|
|
81
|
+
return null;
|
|
82
|
+
const graphql = {};
|
|
83
|
+
// function refresh() {
|
|
84
|
+
// if (!item) return;
|
|
85
|
+
// const field: Field = {
|
|
86
|
+
// _editor: {
|
|
87
|
+
// name: "_GraphQL",
|
|
88
|
+
// type: "jsonValue",
|
|
89
|
+
// descriptor: {
|
|
90
|
+
// item: item,
|
|
91
|
+
// fieldId: "3622F861-ECA9-45D7-8DA7-2CDA35235002",
|
|
92
|
+
// },
|
|
93
|
+
// sourceItems: [],
|
|
94
|
+
// },
|
|
95
|
+
// id: "3622F861-ECA9-45D7-8DA7-2CDA35235002",
|
|
96
|
+
// value: query,
|
|
97
|
+
// };
|
|
98
|
+
// const prettyQuery = format(query);
|
|
99
|
+
// setQuery(prettyQuery);
|
|
100
|
+
// setShowSpinner(true);
|
|
101
|
+
// editContext?.editField({
|
|
102
|
+
// field: field._editor!.descriptor,
|
|
103
|
+
// value: prettyQuery,
|
|
104
|
+
// });
|
|
105
|
+
// }
|
|
106
|
+
return ((0, jsx_runtime_1.jsxs)(splitter_1.Splitter, { layout: "vertical", style: { height: "100%" }, children: [(0, jsx_runtime_1.jsx)(splitter_1.SplitterPanel, { size: 50, className: "relative", children: (0, jsx_runtime_1.jsxs)("div", { className: "absolute inset-0 flex", children: [(0, jsx_runtime_1.jsx)(inputtextarea_1.InputTextarea, { value: query, onChange: (e) => setQuery(e.target.value), className: "flex-1 text-xs", style: { height: "100%" } }), (0, jsx_runtime_1.jsx)(button_1.Button, { icon: "pi pi-refresh" + (showSpinner ? " pi-spin" : ""),
|
|
107
|
+
// onClick={refresh}
|
|
108
|
+
disabled: showSpinner })] }) }), (0, jsx_runtime_1.jsx)(splitter_1.SplitterPanel, { className: "relative", children: (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0", children: (0, jsx_runtime_1.jsx)(SimpleTabs_1.SimpleTabs, { tabs: [
|
|
109
|
+
{
|
|
110
|
+
id: "json",
|
|
111
|
+
label: "JSON",
|
|
112
|
+
content: ((0, jsx_runtime_1.jsx)("div", { className: "relative h-full", children: (0, jsx_runtime_1.jsx)("div", { className: "flex-1 overflow-y-auto p-2", children: (0, jsx_runtime_1.jsx)(react_inspector_1.ObjectInspector, { data: graphql, expandLevel: 3 }) }) })),
|
|
113
|
+
},
|
|
114
|
+
], activeTab: 0, setActiveTab: (index) => { } }) }) })] }));
|
|
115
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Insert = Insert;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ComponentPalette_1 = require("./ComponentPalette");
|
|
6
|
+
const MainContentTree_1 = require("./MainContentTree");
|
|
7
|
+
const SimpleTabs_1 = require("../ui/SimpleTabs");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
function Insert() {
|
|
10
|
+
const [activeTab, setActiveTab] = (0, react_1.useState)(0);
|
|
11
|
+
const tabs = [
|
|
12
|
+
{
|
|
13
|
+
label: "New Component",
|
|
14
|
+
content: (0, jsx_runtime_1.jsx)(ComponentPalette_1.ComponentPalette, {}),
|
|
15
|
+
id: "new",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
label: "Existing Component",
|
|
19
|
+
content: ((0, jsx_runtime_1.jsx)("div", { className: "flex-1 relative", children: (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 overflow-auto", children: (0, jsx_runtime_1.jsx)(MainContentTree_1.MainContentTree, { mode: "insert" }) }) })),
|
|
20
|
+
id: "existing",
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(SimpleTabs_1.SimpleTabs, { tabs: tabs, className: " flex gap-1 justify-center items-center py-3 text-sm border-b border-gray-200", activeTab: activeTab, setActiveTab: (index) => setActiveTab(index) }, "insert-tabs"));
|
|
24
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MainContentTree = MainContentTree;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const ContentTree_1 = __importDefault(require("../ContentTree"));
|
|
10
|
+
const editContext_1 = require("../client/editContext");
|
|
11
|
+
const insertOptions_1 = require("../utils/insertOptions");
|
|
12
|
+
const ItemSearch_1 = __importDefault(require("../ui/ItemSearch"));
|
|
13
|
+
function MainContentTree({ mode, rootItemId, }) {
|
|
14
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
15
|
+
const [insertOptions, setInsertOptions] = (0, react_1.useState)();
|
|
16
|
+
if (!editContext)
|
|
17
|
+
return null;
|
|
18
|
+
const page = editContext.page;
|
|
19
|
+
const selectedItem = editContext.contentEditorItem ?? page?.item;
|
|
20
|
+
const [selectedItemIds, setSelectedItemIds] = (0, react_1.useState)([]);
|
|
21
|
+
(0, react_1.useEffect)(() => {
|
|
22
|
+
if (selectedItem)
|
|
23
|
+
setSelectedItemIds([selectedItem.id]);
|
|
24
|
+
}, [selectedItem]);
|
|
25
|
+
(0, react_1.useEffect)(() => {
|
|
26
|
+
const loadInsertOptions = async () => {
|
|
27
|
+
if (!page)
|
|
28
|
+
return;
|
|
29
|
+
const options = await (0, insertOptions_1.getInsertOptionsForCurrentSelection)(editContext);
|
|
30
|
+
setInsertOptions(options);
|
|
31
|
+
};
|
|
32
|
+
loadInsertOptions();
|
|
33
|
+
}, [editContext.selection, page]);
|
|
34
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex h-full flex-col", children: [(0, jsx_runtime_1.jsx)("div", { className: "border-b border-gray-200 p-2", children: (0, jsx_runtime_1.jsx)(ItemSearch_1.default, { resultClassName: "px-2 py-1", itemSelected: (item) => editContext?.loadItem({
|
|
35
|
+
id: item.id,
|
|
36
|
+
language: item.language,
|
|
37
|
+
version: 0,
|
|
38
|
+
}) }) }), (0, jsx_runtime_1.jsx)("div", { className: "relative flex-1", children: (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-1 overflow-auto", children: (0, jsx_runtime_1.jsx)(ContentTree_1.default, { language: editContext.currentItemDescriptor?.language ?? "en", rootItemId: rootItemId ?? "{11111111-1111-1111-1111-111111111111}", expandIdPath: selectedItem?.idPath
|
|
39
|
+
? selectedItem?.idPath.split("/").slice(0, -1).join("/")
|
|
40
|
+
: undefined, className: "h-full", selectPagesOnly: mode === "select-page", selectionMode: mode == "insert" ? "none" : "multiple", selectedItemIds: selectedItemIds, onSelectionChange: (selection) => {
|
|
41
|
+
const selectedItems = selection;
|
|
42
|
+
setSelectedItemIds(selectedItems.map((x) => x.id));
|
|
43
|
+
if (selectedItems.length > 0 && selectedItems[0])
|
|
44
|
+
editContext.loadItem({
|
|
45
|
+
id: selectedItems[0].id,
|
|
46
|
+
language: selectedItems[0].language,
|
|
47
|
+
version: selectedItems[0].version,
|
|
48
|
+
});
|
|
49
|
+
}, isDraggable: (x) => mode === "insert" &&
|
|
50
|
+
insertOptions?.find((insertOption) => insertOption.typeId == x.templateId ||
|
|
51
|
+
insertOption.compatibleTemplates?.find((compatibleTemplate) => compatibleTemplate == x.templateId) !== undefined) !== undefined, renderNode: (node, defaultRenderer) => ((0, jsx_runtime_1.jsx)("div", { className: "group flex w-full gap-4", children: defaultRenderer(node) })) }) }) })] }));
|
|
52
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Performance = Performance;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const editContext_1 = require("../client/editContext");
|
|
6
|
+
const SimpleTable_1 = require("../ui/SimpleTable");
|
|
7
|
+
function Performance() {
|
|
8
|
+
const context = (0, editContext_1.useEditContext)();
|
|
9
|
+
if (!context?.timings)
|
|
10
|
+
return null;
|
|
11
|
+
const values = Object.keys(context.timings).map((key) => ({
|
|
12
|
+
key,
|
|
13
|
+
value: Math.round(context.timings[key]),
|
|
14
|
+
}));
|
|
15
|
+
const columns = [
|
|
16
|
+
{
|
|
17
|
+
body: (entry) => {
|
|
18
|
+
if (/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/.test(entry.key)) {
|
|
19
|
+
const ids = entry.key
|
|
20
|
+
.split("_")
|
|
21
|
+
.filter((part) => /[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/.test(part));
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "cursor-pointer", onClick: () => context.select(ids), children: entry.key }));
|
|
23
|
+
}
|
|
24
|
+
return entry.key;
|
|
25
|
+
},
|
|
26
|
+
header: "Metric",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
body: (entry) => entry.value,
|
|
30
|
+
header: "Time (ms)",
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "overflow-x-auto", children: (0, jsx_runtime_1.jsx)(SimpleTable_1.SimpleTable, { items: values, columns: columns }) }));
|
|
34
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Sessions = Sessions;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const editContext_1 = require("../client/editContext");
|
|
6
|
+
const SimpleTable_1 = require("../ui/SimpleTable");
|
|
7
|
+
function Sessions() {
|
|
8
|
+
var editContext = (0, editContext_1.useEditContext)();
|
|
9
|
+
if (!editContext)
|
|
10
|
+
return null;
|
|
11
|
+
const sessions = editContext?.activeSessions;
|
|
12
|
+
const columns = [
|
|
13
|
+
{ body: (session) => session.user?.name, header: "User" },
|
|
14
|
+
{
|
|
15
|
+
body: (session) => ((0, jsx_runtime_1.jsx)("a", { href: "#", onClick: () => {
|
|
16
|
+
if (session.item)
|
|
17
|
+
editContext?.loadItem(session.item);
|
|
18
|
+
}, children: session.item?.name })),
|
|
19
|
+
header: "Page",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
body: (session) => session.item?.language,
|
|
23
|
+
header: "Language",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
body: (session) => session.item?.version,
|
|
27
|
+
header: "Version",
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
return (0, jsx_runtime_1.jsx)(SimpleTable_1.SimpleTable, { items: sessions, columns: columns });
|
|
31
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Sidebar = Sidebar;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const editContext_1 = require("../client/editContext");
|
|
6
|
+
const SidebarView_1 = require("./SidebarView");
|
|
7
|
+
function Sidebar() {
|
|
8
|
+
var editContext = (0, editContext_1.useEditContext)();
|
|
9
|
+
if (!editContext)
|
|
10
|
+
return null;
|
|
11
|
+
const view = editContext.view;
|
|
12
|
+
if (!view || !view.leftSidebar)
|
|
13
|
+
return null;
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(SidebarView_1.SidebarView, { sidebar: view.leftSidebar, editContext: editContext, active: true }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SidebarView = SidebarView;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
require("allotment/dist/style.css");
|
|
6
|
+
const allotment_1 = require("allotment");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const utils_1 = require("primereact/utils");
|
|
9
|
+
function SidebarView({ sidebar, editContext, active, }) {
|
|
10
|
+
const splitter = (0, react_1.useRef)(null);
|
|
11
|
+
const [sizes, setSizes] = (0, react_1.useState)([]);
|
|
12
|
+
const [preferredSizes, setPreferredSizes] = (0, react_1.useState)(undefined);
|
|
13
|
+
const [panelsExpanded, setPanelsExpanded] = (0, react_1.useState)([]);
|
|
14
|
+
const [sizeToSet, setSizeToSet] = (0, react_1.useState)();
|
|
15
|
+
const panelHeaderSize = 40;
|
|
16
|
+
const toggle = (panelIndex) => {
|
|
17
|
+
const newSize = panelsExpanded[panelIndex]
|
|
18
|
+
? panelHeaderSize
|
|
19
|
+
: (preferredSizes || sizes)[panelIndex];
|
|
20
|
+
if (newSize)
|
|
21
|
+
resizePanel(panelIndex, newSize);
|
|
22
|
+
setPanelsExpanded((x) => {
|
|
23
|
+
const newState = [...x];
|
|
24
|
+
newState[panelIndex] = !newState[panelIndex];
|
|
25
|
+
return newState;
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const resolvedPanels = sidebar.panels.map((x) => {
|
|
29
|
+
if (typeof x === "function") {
|
|
30
|
+
return x(editContext);
|
|
31
|
+
}
|
|
32
|
+
return x;
|
|
33
|
+
});
|
|
34
|
+
(0, react_1.useEffect)(() => {
|
|
35
|
+
setPanelsExpanded(sidebar.panels.map(() => true));
|
|
36
|
+
setPreferredSizes(() => resolvedPanels.map((x) => x.initialSize));
|
|
37
|
+
}, [sidebar]);
|
|
38
|
+
const resizePanel = (panelIndex, newSize) => {
|
|
39
|
+
const totalSize = sizes.reduce((a, b) => a + b, 0);
|
|
40
|
+
const totalOther = totalSize - sizes[panelIndex];
|
|
41
|
+
const tmpSizes = [...sizes];
|
|
42
|
+
tmpSizes[panelIndex] = newSize;
|
|
43
|
+
const percentages = tmpSizes.map((x) => x / totalOther);
|
|
44
|
+
percentages[panelIndex] = 0;
|
|
45
|
+
const remaining = totalSize - newSize;
|
|
46
|
+
const newSizes = percentages.map((x) => x * remaining);
|
|
47
|
+
newSizes[panelIndex] = newSize;
|
|
48
|
+
setSizes(newSizes);
|
|
49
|
+
setSizeToSet(newSizes);
|
|
50
|
+
};
|
|
51
|
+
(0, react_1.useEffect)(() => {
|
|
52
|
+
if (sizeToSet)
|
|
53
|
+
splitter.current?.resize(sizeToSet);
|
|
54
|
+
}, [sizeToSet]);
|
|
55
|
+
const getHeader = (panel, index) => {
|
|
56
|
+
if (panel.header)
|
|
57
|
+
return panel.header({ panel, index });
|
|
58
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.classNames)(" p-2.5 bg-gray-50 uppercase text-gray-500 text-xs flex justify items-center cursor-pointer relative", panelsExpanded[index] ? "border-b border-gray-200" : ""), onClick: () => toggle(index), children: [panel.icon &&
|
|
59
|
+
(typeof panel.icon === "string" ? ((0, jsx_runtime_1.jsx)("i", { className: (0, utils_1.classNames)(panel.icon, "pi mr-1.5") })) : ((0, jsx_runtime_1.jsx)("div", { className: "w-4 h-4 mr-2", children: panel.icon }))), (0, jsx_runtime_1.jsx)("div", { className: "mr-auto", children: panel.title }), (0, jsx_runtime_1.jsx)("i", { className: (0, utils_1.classNames)(panelsExpanded[index] ? "pi-chevron-up" : "pi-chevron-down", "pi text-sm") })] }));
|
|
60
|
+
};
|
|
61
|
+
const initalSizes = resolvedPanels.map((x) => x.initialSize);
|
|
62
|
+
return ((0, jsx_runtime_1.jsx)(allotment_1.Allotment, { vertical: true, snap: true, className: !active ? "hidden h-full" : "h-full", ref: splitter, defaultSizes: initalSizes, onChange: (s) => {
|
|
63
|
+
if (sizes.join(",") != s.join(","))
|
|
64
|
+
setSizes(s);
|
|
65
|
+
const newPreferred = [...(preferredSizes || s)];
|
|
66
|
+
s.forEach((x, i) => {
|
|
67
|
+
if (x > panelHeaderSize)
|
|
68
|
+
newPreferred[i] = x;
|
|
69
|
+
});
|
|
70
|
+
setPreferredSizes(newPreferred);
|
|
71
|
+
}, children: resolvedPanels.map((panel, index) => ((0, jsx_runtime_1.jsx)(allotment_1.Allotment.Pane, {
|
|
72
|
+
// preferredSize={(preferredSizes || initalSizes)[index] + "%"}
|
|
73
|
+
maxSize: panelsExpanded.length <= index || panelsExpanded[index]
|
|
74
|
+
? 10000
|
|
75
|
+
: panelHeaderSize, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col h-full", children: [getHeader(panel, index), panelsExpanded[index] && ((0, jsx_runtime_1.jsx)("div", { className: "overflow-hidden relative flex-1", children: (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.classNames)("inset-0 absolute", panel.noOverflow ? "" : "overflow-y-auto"), children: panel.content }) }))] }) }, index))) }));
|
|
76
|
+
}
|