@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,332 @@
|
|
|
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.PictureCropper = PictureCropper;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const dialog_1 = require("primereact/dialog");
|
|
9
|
+
const editContext_1 = require("./client/editContext");
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const button_1 = require("primereact/button");
|
|
12
|
+
const DialogButtons_1 = __importDefault(require("./ui/DialogButtons"));
|
|
13
|
+
const utils_1 = require("primereact/utils");
|
|
14
|
+
function PictureCropper({ field, onClose, variantName: selectedVariantName, }) {
|
|
15
|
+
const [pictureValue, setPictureValue] = (0, react_1.useState)();
|
|
16
|
+
const [isValid, setIsValid] = (0, react_1.useState)(true);
|
|
17
|
+
const [rawValue, setRawValue] = (0, react_1.useState)();
|
|
18
|
+
const imageRef = (0, react_1.useRef)(null);
|
|
19
|
+
const [rect, setRect] = (0, react_1.useState)();
|
|
20
|
+
const rectRef = (0, react_1.useRef)(rect);
|
|
21
|
+
const movingRef = (0, react_1.useRef)(false);
|
|
22
|
+
const [startPos, setStartPos] = (0, react_1.useState)({
|
|
23
|
+
x: 0,
|
|
24
|
+
y: 0,
|
|
25
|
+
});
|
|
26
|
+
const offset = (0, react_1.useRef)({ x: 0, y: 0 });
|
|
27
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
28
|
+
const EDGE_THRESHOLD = 10; // pixels from edge to detect resize
|
|
29
|
+
const [resizeEdge, setResizeEdge] = (0, react_1.useState)(null);
|
|
30
|
+
const resizeEdgeRef = (0, react_1.useRef)(null);
|
|
31
|
+
const getResizeEdge = (pos, rect, bounds) => {
|
|
32
|
+
if (!rect || !bounds)
|
|
33
|
+
return null;
|
|
34
|
+
const x = pos.x * bounds.width;
|
|
35
|
+
const y = pos.y * bounds.height;
|
|
36
|
+
const rectX = rect.x * bounds.width;
|
|
37
|
+
const rectY = rect.y * bounds.height;
|
|
38
|
+
const rectWidth = rect.width * bounds.width;
|
|
39
|
+
const rectHeight = rect.height * bounds.height;
|
|
40
|
+
const isNearLeft = Math.abs(x - rectX) < EDGE_THRESHOLD;
|
|
41
|
+
const isNearRight = Math.abs(x - (rectX + rectWidth)) < EDGE_THRESHOLD;
|
|
42
|
+
const isNearTop = Math.abs(y - rectY) < EDGE_THRESHOLD;
|
|
43
|
+
const isNearBottom = Math.abs(y - (rectY + rectHeight)) < EDGE_THRESHOLD;
|
|
44
|
+
if (isNearLeft && isNearTop)
|
|
45
|
+
return "nw";
|
|
46
|
+
if (isNearRight && isNearTop)
|
|
47
|
+
return "ne";
|
|
48
|
+
if (isNearLeft && isNearBottom)
|
|
49
|
+
return "sw";
|
|
50
|
+
if (isNearRight && isNearBottom)
|
|
51
|
+
return "se";
|
|
52
|
+
if (isNearLeft)
|
|
53
|
+
return "w";
|
|
54
|
+
if (isNearRight)
|
|
55
|
+
return "e";
|
|
56
|
+
if (isNearTop)
|
|
57
|
+
return "n";
|
|
58
|
+
if (isNearBottom)
|
|
59
|
+
return "s";
|
|
60
|
+
return null;
|
|
61
|
+
};
|
|
62
|
+
(0, react_1.useEffect)(() => {
|
|
63
|
+
const deepCopy = JSON.parse(JSON.stringify(field.value));
|
|
64
|
+
setPictureValue(deepCopy);
|
|
65
|
+
const raw = field?.rawValue
|
|
66
|
+
? JSON.parse(field?.rawValue)
|
|
67
|
+
: { Variants: [] };
|
|
68
|
+
setRawValue(raw);
|
|
69
|
+
}, [field]);
|
|
70
|
+
const selectedVariant = pictureValue && pictureValue.variants
|
|
71
|
+
? pictureValue.variants?.find((x) => x.name == selectedVariantName)
|
|
72
|
+
: null;
|
|
73
|
+
(0, react_1.useEffect)(() => {
|
|
74
|
+
if (selectedVariant?.region &&
|
|
75
|
+
(!selectedVariant.aspectRatioLock ||
|
|
76
|
+
Math.abs(selectedVariant.aspectRatioLock -
|
|
77
|
+
(selectedVariant.region.width * selectedVariant.width) /
|
|
78
|
+
(selectedVariant.region.height * selectedVariant.height)) < 0.1) &&
|
|
79
|
+
selectedVariant.region.width > 0 &&
|
|
80
|
+
selectedVariant.region.height > 0) {
|
|
81
|
+
setRect({
|
|
82
|
+
width: selectedVariant.region.width,
|
|
83
|
+
height: selectedVariant.region.height,
|
|
84
|
+
y: selectedVariant.region.y,
|
|
85
|
+
x: selectedVariant.region.x,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
setRect(undefined);
|
|
90
|
+
}
|
|
91
|
+
}, [selectedVariant]);
|
|
92
|
+
(0, react_1.useEffect)(() => {
|
|
93
|
+
if (!rect)
|
|
94
|
+
return;
|
|
95
|
+
if ((selectedVariant?.minWidth && selectedVariant.minWidth > widthPx) ||
|
|
96
|
+
(selectedVariant?.minHeight && selectedVariant?.minHeight > heightPx)) {
|
|
97
|
+
setIsValid(false);
|
|
98
|
+
}
|
|
99
|
+
else
|
|
100
|
+
setIsValid(true);
|
|
101
|
+
rectRef.current = rect;
|
|
102
|
+
}, [rect]);
|
|
103
|
+
(0, react_1.useEffect)(() => {
|
|
104
|
+
if (!rawValue)
|
|
105
|
+
return;
|
|
106
|
+
if (!selectedVariantName)
|
|
107
|
+
return;
|
|
108
|
+
if (selectedVariant) {
|
|
109
|
+
let selected = rawValue.Variants?.find((x) => x.Name == selectedVariantName);
|
|
110
|
+
if (!selected) {
|
|
111
|
+
selected = {
|
|
112
|
+
Name: selectedVariantName,
|
|
113
|
+
MediaId: selectedVariant.mediaId,
|
|
114
|
+
};
|
|
115
|
+
rawValue.Variants?.push(selected);
|
|
116
|
+
}
|
|
117
|
+
if (selected) {
|
|
118
|
+
if (rect)
|
|
119
|
+
selected.Region = {
|
|
120
|
+
X: rect.x,
|
|
121
|
+
Y: rect.y,
|
|
122
|
+
Width: rect.width,
|
|
123
|
+
Height: rect.height,
|
|
124
|
+
};
|
|
125
|
+
else
|
|
126
|
+
selected.Region = undefined;
|
|
127
|
+
setRawValue(rawValue);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}, [rect]);
|
|
131
|
+
const handleMouseMove = (ev) => {
|
|
132
|
+
if (!selectedVariant)
|
|
133
|
+
return null;
|
|
134
|
+
const bounds = imageRef.current?.getBoundingClientRect();
|
|
135
|
+
if (!bounds)
|
|
136
|
+
return;
|
|
137
|
+
const pos = {
|
|
138
|
+
x: (ev.clientX - bounds.left) / bounds.width,
|
|
139
|
+
y: (ev.clientY - bounds.top) / bounds.height,
|
|
140
|
+
};
|
|
141
|
+
// Update cursor on hover (when not dragging)
|
|
142
|
+
if (ev.buttons !== 1) {
|
|
143
|
+
const edge = getResizeEdge(pos, rect, bounds);
|
|
144
|
+
setResizeEdge(edge);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (ev.buttons === 1) {
|
|
148
|
+
if (!rectRef.current || !imageRef.current)
|
|
149
|
+
return;
|
|
150
|
+
const rect = rectRef.current;
|
|
151
|
+
const bounds = imageRef.current.getBoundingClientRect();
|
|
152
|
+
const deltaX = ev.clientX - startPos.x;
|
|
153
|
+
const deltaY = ev.clientY - startPos.y;
|
|
154
|
+
if (resizeEdgeRef.current) {
|
|
155
|
+
const pos = {
|
|
156
|
+
x: (ev.clientX - bounds.left) / bounds.width,
|
|
157
|
+
y: (ev.clientY - bounds.top) / bounds.height,
|
|
158
|
+
};
|
|
159
|
+
let newRect = { ...rect };
|
|
160
|
+
const aspectRatio = selectedVariant.aspectRatioLock;
|
|
161
|
+
const originalAspectRatio = selectedVariant.width / selectedVariant.height;
|
|
162
|
+
if (resizeEdgeRef.current.includes("w")) {
|
|
163
|
+
const newWidth = rect.width + rect.x - pos.x;
|
|
164
|
+
if (newWidth > 0) {
|
|
165
|
+
newRect.width = newWidth;
|
|
166
|
+
newRect.x = pos.x;
|
|
167
|
+
if (aspectRatio) {
|
|
168
|
+
newRect.height =
|
|
169
|
+
(newRect.width / aspectRatio) * originalAspectRatio;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (resizeEdgeRef.current.includes("e")) {
|
|
174
|
+
newRect.width = pos.x - rect.x;
|
|
175
|
+
if (aspectRatio) {
|
|
176
|
+
newRect.height =
|
|
177
|
+
(newRect.width / aspectRatio) * originalAspectRatio;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (resizeEdgeRef.current.includes("n")) {
|
|
181
|
+
const newHeight = rect.height + rect.y - pos.y;
|
|
182
|
+
if (newHeight > 0) {
|
|
183
|
+
newRect.height = newHeight;
|
|
184
|
+
newRect.y = pos.y;
|
|
185
|
+
if (aspectRatio) {
|
|
186
|
+
newRect.width =
|
|
187
|
+
(newRect.height * aspectRatio) / originalAspectRatio;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (resizeEdgeRef.current.includes("s")) {
|
|
192
|
+
newRect.height = pos.y - rect.y;
|
|
193
|
+
if (aspectRatio) {
|
|
194
|
+
newRect.width =
|
|
195
|
+
(newRect.height * aspectRatio) / originalAspectRatio;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
// Constrain to bounds
|
|
199
|
+
if (newRect.x < 0)
|
|
200
|
+
newRect.x = 0;
|
|
201
|
+
if (newRect.y < 0)
|
|
202
|
+
newRect.y = 0;
|
|
203
|
+
if (newRect.x + newRect.width > 1)
|
|
204
|
+
newRect.width = 1 - newRect.x;
|
|
205
|
+
if (newRect.y + newRect.height > 1)
|
|
206
|
+
newRect.height = 1 - newRect.y;
|
|
207
|
+
setRect(newRect);
|
|
208
|
+
}
|
|
209
|
+
else if (movingRef.current) {
|
|
210
|
+
setRect({
|
|
211
|
+
...rect,
|
|
212
|
+
x: Math.max(0, Math.min(1 - rectRef.current.width, (ev.clientX - bounds.left) / bounds.width - offset.current.x)),
|
|
213
|
+
y: Math.max(0, Math.min(1 - rectRef.current.height, (ev.clientY - bounds.top) / bounds.height - offset.current.y)),
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
const originalAspectRatio = selectedVariant.width / selectedVariant.height;
|
|
218
|
+
const aspectRatio = selectedVariant.aspectRatioLock;
|
|
219
|
+
let width = (ev.clientX - bounds.left) / bounds.width - rect.x;
|
|
220
|
+
let height = (ev.clientY - bounds.top) / bounds.height - rect.y;
|
|
221
|
+
if (aspectRatio) {
|
|
222
|
+
if (Math.abs(deltaX) > Math.abs(deltaY)) {
|
|
223
|
+
height = (width / aspectRatio) * originalAspectRatio;
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
width = (height * aspectRatio) / originalAspectRatio;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (width + rect.x > 1) {
|
|
230
|
+
width = 1 - rect.x;
|
|
231
|
+
if (aspectRatio)
|
|
232
|
+
height = (width / aspectRatio) * originalAspectRatio;
|
|
233
|
+
}
|
|
234
|
+
if (height + rect.y > 1) {
|
|
235
|
+
height = 1 - rect.y;
|
|
236
|
+
if (aspectRatio)
|
|
237
|
+
width = (height * aspectRatio) / originalAspectRatio;
|
|
238
|
+
}
|
|
239
|
+
const newRect = { ...rect, width, height };
|
|
240
|
+
setRect(newRect);
|
|
241
|
+
}
|
|
242
|
+
ev.preventDefault();
|
|
243
|
+
ev.stopPropagation();
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
const handleMouseUp = () => {
|
|
247
|
+
if (!rectRef.current || !rectRef.current.width || !rectRef.current.height) {
|
|
248
|
+
setRect(undefined);
|
|
249
|
+
}
|
|
250
|
+
movingRef.current = false;
|
|
251
|
+
resizeEdgeRef.current = null;
|
|
252
|
+
setResizeEdge(null);
|
|
253
|
+
// window.removeEventListener("mousemove", handleMouseMove);
|
|
254
|
+
window.removeEventListener("mouseup", handleMouseUp);
|
|
255
|
+
};
|
|
256
|
+
const isInRect = (pos, rect) => {
|
|
257
|
+
if (!rect || !selectedVariant)
|
|
258
|
+
return false;
|
|
259
|
+
return (pos.x >= rect.x &&
|
|
260
|
+
pos.x <= rect.x + rect.width &&
|
|
261
|
+
pos.y >= rect.y &&
|
|
262
|
+
pos.y <= rect.y + rect.height);
|
|
263
|
+
};
|
|
264
|
+
const handleMouseDown = (ev) => {
|
|
265
|
+
ev.preventDefault();
|
|
266
|
+
ev.stopPropagation();
|
|
267
|
+
const bounds = ev.currentTarget.getBoundingClientRect();
|
|
268
|
+
const pos = {
|
|
269
|
+
x: (ev.clientX - bounds.left) / bounds.width,
|
|
270
|
+
y: (ev.clientY - bounds.top) / bounds.height,
|
|
271
|
+
};
|
|
272
|
+
const edge = getResizeEdge(pos, rect, bounds);
|
|
273
|
+
if (edge) {
|
|
274
|
+
resizeEdgeRef.current = edge;
|
|
275
|
+
setResizeEdge(edge);
|
|
276
|
+
}
|
|
277
|
+
else if (isInRect(pos, rect)) {
|
|
278
|
+
movingRef.current = true;
|
|
279
|
+
offset.current = {
|
|
280
|
+
x: pos.x - rect.x,
|
|
281
|
+
y: pos.y - rect.y,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
setRect({
|
|
286
|
+
x: (ev.clientX - bounds.left) / bounds.width,
|
|
287
|
+
y: (ev.clientY - bounds.top) / bounds.height,
|
|
288
|
+
width: 0,
|
|
289
|
+
height: 0,
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
setStartPos({ x: ev.clientX, y: ev.clientY });
|
|
293
|
+
window.addEventListener("mouseup", handleMouseUp);
|
|
294
|
+
};
|
|
295
|
+
if (!selectedVariant)
|
|
296
|
+
return null;
|
|
297
|
+
const imageBounds = imageRef.current?.getBoundingClientRect();
|
|
298
|
+
const scale = imageBounds ? selectedVariant.width / imageBounds.width : 0;
|
|
299
|
+
const widthPx = rect ? Math.round(rect.width * selectedVariant.width) : 0;
|
|
300
|
+
const heightPx = rect ? Math.round(rect.height * selectedVariant.height) : 0;
|
|
301
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(dialog_1.Dialog, { header: "Crop " + field.name + " - " + selectedVariantName, pt: { content: { style: { paddingLeft: "0" } } }, visible: true, style: { width: "75vw", height: "75vh" }, onHide: onClose, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-1 flex-col justify h-full", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex-1 flex gap-2", children: [(0, jsx_runtime_1.jsxs)("div", { className: "w-56 text-sm p-4 bg-gray-100 flex flex-col gap-3", children: [(0, jsx_runtime_1.jsx)(LabelAndValue, { label: "Variant:", value: selectedVariantName }), (0, jsx_runtime_1.jsx)(LabelAndValue, { label: "Image Dimensions:", value: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [selectedVariant.width, " x ", selectedVariant.height] }) }), selectedVariant.aspectRatioLock && ((0, jsx_runtime_1.jsx)(LabelAndValue, { label: "Required Aspect Ratio:", value: selectedVariant.aspectRatioLockText })), selectedVariant.minWidth && ((0, jsx_runtime_1.jsx)(LabelAndValue, { label: "Minimum Width:", value: selectedVariant.minWidth })), selectedVariant.minHeight && ((0, jsx_runtime_1.jsx)(LabelAndValue, { label: "Minimum Height:", value: selectedVariant.minHeight })), rect && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(LabelAndValue, { label: "Selection:", value: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [widthPx, " x ", heightPx] }) }), selectedVariant.minWidth &&
|
|
302
|
+
widthPx < selectedVariant.minWidth && ((0, jsx_runtime_1.jsx)("div", { className: "text-red-500", children: "Minimum width not met!" })), selectedVariant.minHeight &&
|
|
303
|
+
heightPx < selectedVariant.minHeight && ((0, jsx_runtime_1.jsx)("div", { className: "text-red-500", children: "Minimum height not met!" }))] }))] }), (0, jsx_runtime_1.jsx)("div", { className: "flex-1 relative p-3", children: (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 top-3 select-none flex items-center justify-center", children: (0, jsx_runtime_1.jsxs)("div", { ref: imageRef, className: "relative cursor-crosshair max-h-full", style: {
|
|
304
|
+
aspectRatio: `${selectedVariant.width}/${selectedVariant.height}`,
|
|
305
|
+
}, onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, children: [(0, jsx_runtime_1.jsx)("img", { className: "object-scale-down", src: selectedVariant.originalSrc ?? selectedVariant.src }), rect && ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.classNames)("absolute bg-opacity-70 border text-xs cursor-move", isValid
|
|
306
|
+
? "bg-blue-200 border-blue-400 text-blue-500"
|
|
307
|
+
: "bg-red-200 border-red-400 text-red-500"), style: {
|
|
308
|
+
left: rect.x * 100 + "%",
|
|
309
|
+
top: rect.y * 100 + "%",
|
|
310
|
+
width: widthPx / scale + "px",
|
|
311
|
+
height: heightPx / scale + "px",
|
|
312
|
+
cursor: resizeEdge
|
|
313
|
+
? resizeEdge.length === 1
|
|
314
|
+
? `${resizeEdge}-resize`
|
|
315
|
+
: `${resizeEdge}-resize`
|
|
316
|
+
: "move",
|
|
317
|
+
}, children: widthPx / scale > 50 && ((0, jsx_runtime_1.jsxs)("div", { className: "absolute bottom-1 right-2 text-nowrap", style: { textShadow: "white 1px 1px" }, children: [widthPx, " x ", heightPx] })) }))] }) }) })] }), (0, jsx_runtime_1.jsxs)(DialogButtons_1.default, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { onClick: () => setRect(undefined), children: "Reset" }), (0, jsx_runtime_1.jsx)(button_1.Button, { size: "small", disabled: !isValid, onClick: () => {
|
|
318
|
+
if (pictureValue) {
|
|
319
|
+
if (field) {
|
|
320
|
+
editContext?.operations.editField({
|
|
321
|
+
field: field.descriptor,
|
|
322
|
+
rawValue: JSON.stringify(rawValue),
|
|
323
|
+
refresh: "immediate",
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
onClose();
|
|
328
|
+
}, children: "Ok" }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: onClose, size: "small", children: "Cancel" })] })] }) }) }));
|
|
329
|
+
}
|
|
330
|
+
function LabelAndValue({ label, value, }) {
|
|
331
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "font-bold", children: label }), (0, jsx_runtime_1.jsx)("div", { children: value })] }));
|
|
332
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PictureEditor = PictureEditor;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const editContext_1 = require("./client/editContext");
|
|
7
|
+
const PictureCropper_1 = require("./PictureCropper");
|
|
8
|
+
function PictureEditor({ field, variantName, style, forwardScrollevents, isPageEditor, }) {
|
|
9
|
+
const [showMenu, setShowMenu] = (0, react_1.useState)(false);
|
|
10
|
+
const [showCropper, setShowCropper] = (0, react_1.useState)(false);
|
|
11
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
12
|
+
const variant = field.value?.variants?.find((v) => v.name === variantName);
|
|
13
|
+
const raw = field?.rawValue && field?.rawValue[0] === "{"
|
|
14
|
+
? JSON.parse(field?.rawValue)
|
|
15
|
+
: { Variants: [] };
|
|
16
|
+
const rawVariant = raw.Variants?.find((x) => x.Name == variantName);
|
|
17
|
+
const reset = (0, react_1.useCallback)(() => {
|
|
18
|
+
raw.Variants = raw.Variants.filter((x) => x.Name !== variantName);
|
|
19
|
+
editContext.operations.editField({
|
|
20
|
+
field: field.descriptor,
|
|
21
|
+
rawValue: JSON.stringify(raw),
|
|
22
|
+
refresh: "immediate",
|
|
23
|
+
});
|
|
24
|
+
}, [field, variant]);
|
|
25
|
+
const imageSelected = (0, react_1.useCallback)(async (imageId) => {
|
|
26
|
+
const selected = raw.Variants?.find((x) => x.Name == variantName);
|
|
27
|
+
if (!selected) {
|
|
28
|
+
if (!raw.Variants)
|
|
29
|
+
raw.Variants = [];
|
|
30
|
+
raw.Variants.push({
|
|
31
|
+
Name: variantName,
|
|
32
|
+
MediaId: imageId,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
selected.MediaId = imageId;
|
|
37
|
+
}
|
|
38
|
+
editContext.operations.editField({
|
|
39
|
+
field: field.descriptor,
|
|
40
|
+
rawValue: JSON.stringify(raw),
|
|
41
|
+
refresh: "immediate",
|
|
42
|
+
});
|
|
43
|
+
}, [field, variant]);
|
|
44
|
+
const videoSelected = (0, react_1.useCallback)(async (videoId) => {
|
|
45
|
+
const selected = raw.Variants?.find((x) => x.Name == variantName);
|
|
46
|
+
if (!selected) {
|
|
47
|
+
if (!raw.Variants)
|
|
48
|
+
raw.Variants = [];
|
|
49
|
+
raw.Variants.push({
|
|
50
|
+
Name: variantName,
|
|
51
|
+
VideoId: videoId,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
selected.VideoId = videoId;
|
|
56
|
+
}
|
|
57
|
+
editContext.operations.editField({
|
|
58
|
+
field: field.descriptor,
|
|
59
|
+
rawValue: JSON.stringify(raw),
|
|
60
|
+
refresh: "immediate",
|
|
61
|
+
});
|
|
62
|
+
}, [field, variant]);
|
|
63
|
+
async function selectMedia(mode) {
|
|
64
|
+
const selectedImageId = await editContext?.selectMedia({
|
|
65
|
+
selectedIdPath: variant?.idPath || "",
|
|
66
|
+
mode: mode,
|
|
67
|
+
});
|
|
68
|
+
if (selectedImageId)
|
|
69
|
+
imageSelected(selectedImageId);
|
|
70
|
+
}
|
|
71
|
+
async function selectVideo() {
|
|
72
|
+
const selectedVideoId = await editContext?.selectMedia({
|
|
73
|
+
selectedIdPath: variant?.idPath || "",
|
|
74
|
+
mode: "video",
|
|
75
|
+
});
|
|
76
|
+
if (selectedVideoId)
|
|
77
|
+
videoSelected(selectedVideoId);
|
|
78
|
+
}
|
|
79
|
+
const notEmpty = variant?.mediaId;
|
|
80
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "absolute inset-0 flex items-center justify-center", onMouseEnter: () => setShowMenu(true), onMouseLeave: () => setShowMenu(false), onClick: () => {
|
|
81
|
+
if (!isPageEditor)
|
|
82
|
+
return;
|
|
83
|
+
const itemId = field.descriptor.item?.id;
|
|
84
|
+
if (itemId)
|
|
85
|
+
editContext?.select([itemId]);
|
|
86
|
+
}, onWheel: (e) => {
|
|
87
|
+
if (forwardScrollevents)
|
|
88
|
+
editContext?.pageView.editorIframeRef.current?.contentWindow?.document.documentElement?.scrollBy({
|
|
89
|
+
behavior: "instant",
|
|
90
|
+
left: 0,
|
|
91
|
+
top: e.deltaY,
|
|
92
|
+
});
|
|
93
|
+
editContext?.pageView.editorIframeRef.current?.contentWindow?.document.body?.scrollBy({
|
|
94
|
+
behavior: "instant",
|
|
95
|
+
left: 0,
|
|
96
|
+
top: e.deltaY,
|
|
97
|
+
});
|
|
98
|
+
}, style: style, "data-testid": "select-media", children: [showMenu && ((0, jsx_runtime_1.jsxs)("div", { className: "p-3 grid grid-cols-2 gap-1.5 items-stretch justify-center text-sm min-w-48", children: [(0, jsx_runtime_1.jsx)(Btn, { label: "Select", icon: "pi pi-image", onClick: () => selectMedia("images"), testId: "select-media-button", className: "min-w-[80px]" }), field.value?.allowVideos && ((0, jsx_runtime_1.jsx)(Btn, { label: "Video", icon: "pi pi-video", onClick: () => selectVideo(), testId: "video-media-button", className: "min-w-[80px]" })), notEmpty && ((0, jsx_runtime_1.jsx)(Btn, { label: "Crop", icon: "pi pi-expand", onClick: () => {
|
|
99
|
+
setShowCropper(true);
|
|
100
|
+
}, testId: "crop-media-button", className: "min-w-[80px]" })), rawVariant && ((0, jsx_runtime_1.jsx)(Btn, { label: "Reset", icon: "pi pi-times", onClick: () => reset(), testId: "reset-media-button", className: "min-w-[80px]" }))] })), showCropper && ((0, jsx_runtime_1.jsx)(PictureCropper_1.PictureCropper, { field: field, onClose: () => setShowCropper(false), variantName: variantName }))] }));
|
|
101
|
+
}
|
|
102
|
+
function Btn({ label, icon, onClick, testId, className, }) {
|
|
103
|
+
return ((0, jsx_runtime_1.jsxs)("button", { className: `btn bg-gray-500 text-white p-1.5 rounded-lg opacity-70 border hover:opacity-85 gap-1.5 flex items-center cursor-pointer ${className}`, onClick: onClick, "data-testid": testId, children: [(0, jsx_runtime_1.jsx)("i", { className: icon }), " ", label] }));
|
|
104
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
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.PictureEditorDialog = PictureEditorDialog;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const dialog_1 = require("primereact/dialog");
|
|
9
|
+
const editContext_1 = require("./client/editContext");
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const button_1 = require("primereact/button");
|
|
12
|
+
const DialogButtons_1 = __importDefault(require("./ui/DialogButtons"));
|
|
13
|
+
const editService_1 = require("./services/editService");
|
|
14
|
+
const picture_shared_1 = require("./picture-shared");
|
|
15
|
+
function PictureEditorDialog({ field, onCancel, onOk, params, }) {
|
|
16
|
+
const [selectedVariantName, setSelectedVariantName] = (0, react_1.useState)();
|
|
17
|
+
const [pictureValue, setPictureValue] = (0, react_1.useState)();
|
|
18
|
+
const [rawValue, setRawValue] = (0, react_1.useState)();
|
|
19
|
+
const emptyRect = () => ({
|
|
20
|
+
width: 0,
|
|
21
|
+
height: 0,
|
|
22
|
+
top: 0,
|
|
23
|
+
left: 0,
|
|
24
|
+
});
|
|
25
|
+
const [rect, setRect] = (0, react_1.useState)(emptyRect());
|
|
26
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
27
|
+
(0, react_1.useEffect)(() => {
|
|
28
|
+
setSelectedVariantName(field?.value?.variants[0].name);
|
|
29
|
+
}, []);
|
|
30
|
+
(0, react_1.useEffect)(() => {
|
|
31
|
+
const deepCopy = JSON.parse(JSON.stringify(field.value));
|
|
32
|
+
setPictureValue(deepCopy);
|
|
33
|
+
const raw = field?.rawValue
|
|
34
|
+
? JSON.parse(field?.rawValue)
|
|
35
|
+
: { Variants: [] };
|
|
36
|
+
setRawValue(raw);
|
|
37
|
+
if (!field?.value?.variants[0].src)
|
|
38
|
+
selectMedia(field?.value?.variants[0].name, raw);
|
|
39
|
+
}, [field]);
|
|
40
|
+
async function selectMedia(variantName, raw) {
|
|
41
|
+
const chosenImage = await editContext?.selectMedia({
|
|
42
|
+
selectedIdPath: selectedVariant?.idPath || "",
|
|
43
|
+
mode: "images",
|
|
44
|
+
});
|
|
45
|
+
if (chosenImage)
|
|
46
|
+
imageSelected(chosenImage, variantName ?? selectedVariantName, raw ?? rawValue);
|
|
47
|
+
}
|
|
48
|
+
const selectedVariant = pictureValue && pictureValue.variants
|
|
49
|
+
? pictureValue.variants?.find((x) => x.name == selectedVariantName)
|
|
50
|
+
: null;
|
|
51
|
+
(0, react_1.useEffect)(() => {
|
|
52
|
+
if (selectedVariant?.region &&
|
|
53
|
+
(!selectedVariant.aspectRatioLock ||
|
|
54
|
+
Math.abs(selectedVariant.aspectRatioLock -
|
|
55
|
+
selectedVariant.region.width / selectedVariant.region.height) < 0.1))
|
|
56
|
+
setRect({
|
|
57
|
+
width: selectedVariant.region.width,
|
|
58
|
+
height: selectedVariant.region.height,
|
|
59
|
+
top: selectedVariant.region.y,
|
|
60
|
+
left: selectedVariant.region.x,
|
|
61
|
+
});
|
|
62
|
+
else {
|
|
63
|
+
setRect(emptyRect());
|
|
64
|
+
}
|
|
65
|
+
}, [selectedVariantName]);
|
|
66
|
+
const getPictureFieldValue = async (field, rawValue) => {
|
|
67
|
+
if (!editContext?.pageView.site)
|
|
68
|
+
return null;
|
|
69
|
+
return (0, editService_1.getPictureValue)(field, rawValue, editContext.pageView.site?.name, editContext.sessionId);
|
|
70
|
+
};
|
|
71
|
+
const imageSelected = (0, react_1.useCallback)(async (imageId, variantName, rawValue) => {
|
|
72
|
+
if (!variantName || !rawValue)
|
|
73
|
+
return;
|
|
74
|
+
const selected = rawValue.Variants?.find((x) => x.Name == variantName);
|
|
75
|
+
if (!selected) {
|
|
76
|
+
if (!rawValue.Variants)
|
|
77
|
+
rawValue.Variants = [];
|
|
78
|
+
rawValue.Variants.push({
|
|
79
|
+
Name: variantName,
|
|
80
|
+
MediaId: imageId,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
selected.MediaId = imageId;
|
|
85
|
+
}
|
|
86
|
+
setRawValue(rawValue);
|
|
87
|
+
const newValue = await getPictureFieldValue(field, rawValue);
|
|
88
|
+
if (newValue) {
|
|
89
|
+
setPictureValue(newValue);
|
|
90
|
+
}
|
|
91
|
+
}, []);
|
|
92
|
+
const updateRawValue = async (rawValue) => {
|
|
93
|
+
setRawValue(rawValue);
|
|
94
|
+
const newValue = await getPictureFieldValue(field, rawValue);
|
|
95
|
+
if (newValue) {
|
|
96
|
+
setPictureValue(newValue);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const setVariantCrop = async () => {
|
|
100
|
+
if (!rawValue)
|
|
101
|
+
return;
|
|
102
|
+
if (!selectedVariantName)
|
|
103
|
+
return;
|
|
104
|
+
if (selectedVariant) {
|
|
105
|
+
let selected = rawValue.Variants?.find((x) => x.Name == selectedVariantName);
|
|
106
|
+
if (!selected) {
|
|
107
|
+
selected = {
|
|
108
|
+
Name: selectedVariantName,
|
|
109
|
+
MediaId: selectedVariant.mediaId,
|
|
110
|
+
};
|
|
111
|
+
rawValue.Variants?.push(selected);
|
|
112
|
+
}
|
|
113
|
+
if (selected) {
|
|
114
|
+
selected.Region = {
|
|
115
|
+
X: rect.left,
|
|
116
|
+
Y: rect.top,
|
|
117
|
+
Width: rect.width,
|
|
118
|
+
Height: rect.height,
|
|
119
|
+
};
|
|
120
|
+
await updateRawValue(rawValue);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const usage = getUsage(pictureValue, params);
|
|
125
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(dialog_1.Dialog, { header: "Edit " + field.name, visible: true, style: { width: "70vw", height: "70vh" }, onHide: onCancel, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-1 flex-col justify h-full", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex-1 flex gap-2", children: [(0, jsx_runtime_1.jsxs)("div", { className: " h-full border-r pt-3 w-48 relative", children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 overflow-y-auto flex flex-col gap-6", children: pictureValue &&
|
|
126
|
+
pictureValue.variants?.map((variant) => ((0, jsx_runtime_1.jsxs)("div", { onClick: () => setSelectedVariantName(variant.name), className: "text-xs flex flex-col items-center justify-center gap-1 cursor-pointer", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex justify-center items-center h-40 w-40 border relative" +
|
|
127
|
+
(selectedVariantName == variant.name
|
|
128
|
+
? " shadow-xl "
|
|
129
|
+
: ""), children: variant.src && (0, jsx_runtime_1.jsx)("img", { src: variant.thumbSrc }) }), (0, jsx_runtime_1.jsxs)("div", { className: "w-40", children: [(0, jsx_runtime_1.jsx)("div", { children: variant.name }), (0, jsx_runtime_1.jsx)("div", { children: variant.aspectRatioLockText }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "break-all", children: ["Name: ", variant.mediaItemName] }), (0, jsx_runtime_1.jsxs)("div", { children: ["Orig. size: ", variant.width, " x ", variant.height] }), (variant.width < 1 || variant.height < 1) && ((0, jsx_runtime_1.jsxs)("span", { children: [" ", (0, jsx_runtime_1.jsx)("i", { className: "pi pi-exclamation-triangle text-red-600 " })] }))] })] })] }, variant.name))) }), usage && (0, jsx_runtime_1.jsx)("div", { className: "text-xs", children: usage })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex-1 relative p-3", children: (0, jsx_runtime_1.jsxs)("div", { className: "absolute inset-0 top-3 overflow-auto select-none flex align-center justify-center", children: [selectedVariant && ((0, jsx_runtime_1.jsxs)("div", { className: "relative", onDoubleClick: () => selectMedia(), onMouseDown: (ev) => {
|
|
130
|
+
ev.preventDefault();
|
|
131
|
+
ev.stopPropagation();
|
|
132
|
+
const bounds = ev.currentTarget.getBoundingClientRect();
|
|
133
|
+
setRect({
|
|
134
|
+
left: (ev.clientX - bounds.left) / bounds.width,
|
|
135
|
+
top: (ev.clientY - bounds.top) / bounds.height,
|
|
136
|
+
width: 0,
|
|
137
|
+
height: 0,
|
|
138
|
+
});
|
|
139
|
+
}, onMouseMoveCapture: (ev) => {
|
|
140
|
+
if (ev.buttons === 1) {
|
|
141
|
+
const bounds = ev.currentTarget.getBoundingClientRect();
|
|
142
|
+
const width = (ev.clientX - bounds.left) / bounds.width - rect.left;
|
|
143
|
+
const newRect = {
|
|
144
|
+
...rect,
|
|
145
|
+
width,
|
|
146
|
+
height: selectedVariant.aspectRatioLock
|
|
147
|
+
? width / selectedVariant.aspectRatioLock
|
|
148
|
+
: (ev.clientY - bounds.top) / bounds.height -
|
|
149
|
+
rect.top,
|
|
150
|
+
};
|
|
151
|
+
setRect(newRect);
|
|
152
|
+
ev.preventDefault();
|
|
153
|
+
ev.stopPropagation();
|
|
154
|
+
}
|
|
155
|
+
}, onMouseUp: () => setVariantCrop(), children: [(0, jsx_runtime_1.jsx)("img", { src: selectedVariant.originalSrc ?? selectedVariant.src, className: "object-contain h-full w-full" }), (0, jsx_runtime_1.jsx)("div", { className: "absolute bg-opacity-70 bg-gray-300", style: {
|
|
156
|
+
left: rect.left * 100 + "%",
|
|
157
|
+
top: rect.top * 100 + "%",
|
|
158
|
+
width: rect.width * 100 + "%",
|
|
159
|
+
height: rect.height * 100 + "%",
|
|
160
|
+
} })] })), selectedVariant && ((0, jsx_runtime_1.jsxs)("div", { className: "absolute top-0 right-0 cursor-pointer text-sm flex flex-col gap-1 items-center p-2 bg-gray-100 bg-opacity-70", onClick: () => selectMedia(), children: [(0, jsx_runtime_1.jsx)("i", { className: "pi pi-pencil text-xl" }), "Choose"] }))] }) })] }), (0, jsx_runtime_1.jsxs)(DialogButtons_1.default, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { size: "small", onClick: () => {
|
|
161
|
+
if (pictureValue) {
|
|
162
|
+
if (field) {
|
|
163
|
+
editContext?.operations.editField({
|
|
164
|
+
field: field.descriptor,
|
|
165
|
+
rawValue: JSON.stringify(rawValue),
|
|
166
|
+
refresh: "immediate",
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
onOk(pictureValue);
|
|
170
|
+
}
|
|
171
|
+
}, children: "Ok" }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: () => {
|
|
172
|
+
onCancel();
|
|
173
|
+
}, size: "small", children: "Cancel" })] })] }) }) }));
|
|
174
|
+
}
|
|
175
|
+
function getUsage(pictureValue, params) {
|
|
176
|
+
if (!params)
|
|
177
|
+
return;
|
|
178
|
+
if (!pictureValue)
|
|
179
|
+
return;
|
|
180
|
+
if (pictureValue.variants.length <= 1)
|
|
181
|
+
return;
|
|
182
|
+
const mediaParams = typeof params === "object" && "default" in params ? params : undefined;
|
|
183
|
+
if (mediaParams) {
|
|
184
|
+
const sources = Object.keys(mediaParams ?? {});
|
|
185
|
+
const variants = sources
|
|
186
|
+
.map((source) => ({
|
|
187
|
+
source,
|
|
188
|
+
variant: (0, picture_shared_1.getRenderedPictureVariant)(mediaParams[source], pictureValue.variants),
|
|
189
|
+
}))
|
|
190
|
+
.filter((x) => x.variant);
|
|
191
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["This field rendering is using these variants:", (0, jsx_runtime_1.jsx)("table", { children: variants.map((v) => ((0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: v.source }), (0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)("b", { children: v.variant.name }) })] }))) })] }));
|
|
192
|
+
}
|
|
193
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["This field rendering is using the variant", " ", (0, jsx_runtime_1.jsxs)("b", { children: [(0, picture_shared_1.getRenderedPictureVariant)(params, pictureValue.variants)?.name, "."] })] }));
|
|
194
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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.ScrollingContentTree = ScrollingContentTree;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const ContentTree_1 = __importDefault(require("./ContentTree"));
|
|
10
|
+
const config_1 = require("../config/config");
|
|
11
|
+
const editContext_1 = require("./client/editContext");
|
|
12
|
+
function ScrollingContentTree({ selectedItemId, onSelectionChange, rootItemId, }) {
|
|
13
|
+
const [selectedItem, setSelectdItem] = (0, react_1.useState)(null);
|
|
14
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
15
|
+
(0, react_1.useEffect)(() => {
|
|
16
|
+
const loadItem = async () => {
|
|
17
|
+
if (!selectedItemId)
|
|
18
|
+
return;
|
|
19
|
+
const item = await editContext.itemsRepository.getItem({
|
|
20
|
+
id: selectedItemId,
|
|
21
|
+
language: editContext.currentItemDescriptor?.language ?? "en",
|
|
22
|
+
version: 0,
|
|
23
|
+
});
|
|
24
|
+
if (item)
|
|
25
|
+
setSelectdItem(item);
|
|
26
|
+
};
|
|
27
|
+
loadItem();
|
|
28
|
+
}, [selectedItemId]);
|
|
29
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 overflow-auto", children: (0, jsx_runtime_1.jsx)(ContentTree_1.default, { language: editContext.currentItemDescriptor?.language ?? "en", rootItemId: rootItemId ?? config_1.contentItemId, expandIdPath: selectedItem?.idPath, selectedItemIds: selectedItemId ? [selectedItemId] : [], selectionMode: "single", className: "h-full p-1", onSelectionChange: onSelectionChange }) }));
|
|
30
|
+
}
|