@alpaca-headless/alpaca-headless-nextjs 1.0.129 → 1.0.253
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/dist/editor.css +435 -49
- package/dist/esm/Editor.js +13 -0
- package/dist/esm/client-components/ClientLink.js +35 -0
- package/dist/{cjs/components → esm/client-components}/LinkEditor.js +22 -19
- package/dist/esm/client-components/MultiComponentEditor.js +22 -0
- package/dist/esm/client-components/index.js +4 -0
- package/dist/esm/components/Error.js +10 -0
- package/dist/{cjs → esm}/components/Image.js +5 -8
- package/dist/esm/components/Link.js +30 -0
- package/dist/esm/components/LinkPreview.js +30 -0
- package/dist/esm/components/LockedFieldIndicator.js +21 -0
- package/dist/esm/components/Picture.js +132 -0
- package/dist/esm/components/PictureEditor.js +77 -0
- package/dist/esm/components/PictureEditorWrapper.js +7 -0
- package/dist/esm/components/Placeholder.js +141 -0
- package/dist/esm/components/RichText.js +29 -0
- package/dist/esm/components/RichTextEditor.js +92 -0
- package/dist/esm/components/RichTextEditorWrapper.js +7 -0
- package/dist/esm/components/Slot.js +6 -0
- package/dist/esm/components/Text.js +28 -0
- package/dist/esm/components/TextEditor.js +78 -0
- package/dist/esm/components/TextEditorWrapper.js +19 -0
- package/dist/esm/components/Translate.js +9 -0
- package/dist/esm/components/TranslateEditor.js +24 -0
- package/dist/esm/components/TranslateEditorWrapper.js +7 -0
- package/dist/esm/components/index.js +7 -0
- package/dist/esm/components/picture-shared.js +26 -0
- package/dist/esm/editor/ComponentInfo.js +12 -0
- package/dist/esm/editor/ConfirmationDialog.js +29 -0
- package/dist/{cjs → esm}/editor/ContentTree.js +61 -46
- package/dist/esm/editor/ContextMenu.js +90 -0
- package/dist/esm/editor/DialogButtons.js +4 -0
- package/dist/esm/editor/DictionaryEditor.js +37 -0
- package/dist/esm/editor/EditFrame.js +115 -0
- package/dist/esm/editor/EditFrameWrapper.js +7 -0
- package/dist/esm/editor/EditorClient.js +889 -0
- package/dist/esm/editor/EditorClientHost.js +15 -0
- package/dist/esm/editor/EditorWarning.js +10 -0
- package/dist/esm/editor/EditorWarnings.js +13 -0
- package/dist/esm/editor/FieldEditorPopup.js +23 -0
- package/dist/esm/editor/FieldList.js +48 -0
- package/dist/esm/editor/FieldListField.js +86 -0
- package/dist/esm/editor/FieldListFieldWithFallbacks.js +79 -0
- package/dist/{cjs → esm}/editor/FloatingToolbar.js +20 -23
- package/dist/esm/editor/ItemInfo.js +14 -0
- package/dist/esm/editor/LinkEditorDialog.js +61 -0
- package/dist/esm/editor/MainLayout.js +18 -0
- package/dist/esm/editor/MediaSelector.js +85 -0
- package/dist/esm/editor/Outline.js +82 -0
- package/dist/esm/editor/PageViewer.js +41 -0
- package/dist/esm/editor/PictureEditorDialog.js +201 -0
- package/dist/esm/editor/PlaceholderDropZone.js +130 -0
- package/dist/esm/editor/PlaceholderDropZoneHost.js +7 -0
- package/dist/esm/editor/PreviewClient.js +6 -0
- package/dist/esm/editor/PreviewClientHost.js +7 -0
- package/dist/esm/editor/PreviewPanel.js +7 -0
- package/dist/esm/editor/PublishDialog.js +15 -0
- package/dist/esm/editor/Terminal.js +55 -0
- package/dist/esm/editor/ai/AiPopup.js +28 -0
- package/dist/esm/editor/ai/AiResponseMessage.js +20 -0
- package/dist/esm/editor/ai/AiTerminal.js +216 -0
- package/dist/esm/editor/ai/AiToolCall.js +15 -0
- package/dist/esm/editor/ai/EditorAiTerminal.js +5 -0
- package/dist/esm/editor/commands/commands.js +1 -0
- package/dist/esm/editor/commands/componentCommands.js +287 -0
- package/dist/esm/editor/commands/createVersionCommand.js +26 -0
- package/dist/esm/editor/commands/undo.js +22 -0
- package/dist/esm/editor/component-designer/ComponentDesigner.js +7 -0
- package/dist/esm/editor/component-designer/ComponentDesignerAiTerminal.js +5 -0
- package/dist/esm/editor/component-designer/ComponentDesignerMenu.js +39 -0
- package/dist/esm/editor/component-designer/ComponentPreview.js +20 -0
- package/dist/esm/editor/component-designer/ComponentRenderingEditor.js +38 -0
- package/dist/esm/editor/component-designer/ComponentSelectionTree.js +56 -0
- package/dist/esm/editor/component-designer/componentDesignerContext.js +22 -0
- package/dist/esm/editor/componentTreeHelper.js +20 -0
- package/dist/esm/editor/config/config.js +327 -0
- package/dist/esm/editor/config/types.js +1 -0
- package/dist/esm/editor/editContext.js +11 -0
- package/dist/esm/editor/editor-warnings/ItemLocked.js +40 -0
- package/dist/esm/editor/editor-warnings/ValidationErrors.js +22 -0
- package/dist/esm/editor/fieldTypes/CheckboxEditor.js +21 -0
- package/dist/esm/editor/fieldTypes/DropLinkEditor.js +50 -0
- package/dist/esm/editor/fieldTypes/InternalLinkFieldEditor.js +41 -0
- package/dist/{cjs → esm}/editor/fieldTypes/LinkFieldEditor.js +14 -16
- package/dist/esm/editor/fieldTypes/MultiLineText.js +25 -0
- package/dist/esm/editor/fieldTypes/PictureFieldEditor.js +33 -0
- package/dist/esm/editor/fieldTypes/RawEditor.js +26 -0
- package/dist/esm/editor/fieldTypes/RichTextEditor.js +7 -0
- package/dist/esm/editor/fieldTypes/RichTextEditorComponent.js +46 -0
- package/dist/esm/editor/fieldTypes/SingleLineText.js +23 -0
- package/dist/esm/editor/fieldTypes/TreeListEditor.js +57 -0
- package/dist/esm/editor/itemCommands.js +27 -0
- package/dist/esm/editor/menubar/BrowseHistory.js +39 -0
- package/dist/esm/editor/menubar/ItemLanguageVersion.js +20 -0
- package/dist/esm/editor/menubar/LanguageSelector.js +18 -0
- package/dist/esm/editor/menubar/Menu.js +105 -0
- package/dist/esm/editor/menubar/PageViewerControls.js +66 -0
- package/dist/esm/editor/menubar/VersionSelector.js +18 -0
- package/dist/esm/editor/previewContext.js +5 -0
- package/dist/esm/editor/services/aiService.js +20 -0
- package/dist/esm/editor/services/componentDesignerService.js +23 -0
- package/dist/esm/editor/services/contentService.js +56 -0
- package/dist/esm/editor/services/editService.js +394 -0
- package/dist/esm/editor/services/serviceHelper.js +45 -0
- package/dist/esm/editor/sidebar/ComponentPalette.js +42 -0
- package/dist/esm/editor/sidebar/ComponentTree.js +237 -0
- package/dist/esm/editor/sidebar/Debug.js +46 -0
- package/dist/esm/editor/sidebar/EditHistory.js +66 -0
- package/dist/esm/editor/sidebar/EditorForm.js +24 -0
- package/dist/esm/editor/sidebar/GraphQL.js +85 -0
- package/dist/esm/editor/sidebar/Insert.js +7 -0
- package/dist/esm/editor/sidebar/MainContentTree.js +38 -0
- package/dist/esm/editor/sidebar/Sessions.js +11 -0
- package/dist/esm/editor/sidebar/Sidebar.js +13 -0
- package/dist/esm/editor/sidebar/SidebarView.js +73 -0
- package/dist/esm/editor/sidebar/Workbox.js +77 -0
- package/dist/esm/editor/ui/CopyToClipboardButton.js +14 -0
- package/dist/esm/editor/ui/Icons.js +19 -0
- package/dist/esm/editor/ui/ItemNameDialog.js +33 -0
- package/dist/esm/editor/ui/Section.js +8 -0
- package/dist/esm/editor/utils/insertOptions.js +39 -0
- package/dist/esm/editor/utils.js +71 -0
- package/dist/esm/editor/views/ItemEditor.js +18 -0
- package/dist/esm/fieldTypes.js +1 -0
- package/dist/esm/graphQL.js +50 -0
- package/dist/esm/graphQLTypes.js +1 -0
- package/dist/esm/index.js +9 -0
- package/dist/{cjs → esm}/loadRouteData.js +19 -37
- package/dist/{cjs → esm}/mediaProtection.js +4 -11
- package/dist/esm/middleware/handleRequest.js +45 -0
- package/dist/esm/middleware/index.js +1 -0
- package/dist/esm/public.js +10 -0
- package/dist/esm/renderContext.js +49 -0
- package/dist/esm/renderings.js +87 -0
- package/dist/esm/servertypes.js +1 -0
- package/dist/esm/translate.js +7 -0
- package/dist/primereact/resources/themes/arya-blue/theme.css +854 -790
- package/dist/primereact/resources/themes/arya-green/theme.css +854 -790
- package/dist/primereact/resources/themes/arya-orange/theme.css +854 -790
- package/dist/primereact/resources/themes/arya-purple/theme.css +854 -790
- package/dist/primereact/resources/themes/bootstrap4-dark-blue/theme.css +678 -615
- package/dist/primereact/resources/themes/bootstrap4-dark-purple/theme.css +678 -615
- package/dist/primereact/resources/themes/bootstrap4-light-blue/theme.css +679 -616
- package/dist/primereact/resources/themes/bootstrap4-light-purple/theme.css +679 -616
- package/dist/primereact/resources/themes/fluent-light/theme.css +686 -638
- package/dist/primereact/resources/themes/lara-dark-amber/theme.css +679 -630
- package/dist/primereact/resources/themes/lara-dark-blue/theme.css +679 -630
- package/dist/primereact/resources/themes/lara-dark-cyan/theme.css +679 -630
- package/dist/primereact/resources/themes/lara-dark-green/theme.css +679 -630
- package/dist/primereact/resources/themes/lara-dark-indigo/theme.css +679 -630
- package/dist/primereact/resources/themes/lara-dark-pink/theme.css +679 -630
- package/dist/primereact/resources/themes/lara-dark-purple/theme.css +679 -630
- package/dist/primereact/resources/themes/lara-dark-teal/theme.css +679 -630
- package/dist/primereact/resources/themes/lara-light-amber/theme.css +776 -725
- package/dist/primereact/resources/themes/lara-light-blue/theme.css +1011 -960
- package/dist/primereact/resources/themes/lara-light-cyan/theme.css +776 -725
- package/dist/primereact/resources/themes/lara-light-green/theme.css +820 -769
- package/dist/primereact/resources/themes/lara-light-indigo/theme.css +1016 -965
- package/dist/primereact/resources/themes/lara-light-pink/theme.css +776 -725
- package/dist/primereact/resources/themes/lara-light-purple/theme.css +1016 -965
- package/dist/primereact/resources/themes/lara-light-teal/theme.css +776 -725
- package/dist/primereact/resources/themes/luna-amber/theme.css +950 -887
- package/dist/primereact/resources/themes/luna-blue/theme.css +950 -887
- package/dist/primereact/resources/themes/luna-green/theme.css +950 -887
- package/dist/primereact/resources/themes/luna-pink/theme.css +950 -887
- package/dist/primereact/resources/themes/md-dark-deeppurple/theme.css +918 -950
- package/dist/primereact/resources/themes/md-dark-indigo/theme.css +918 -950
- package/dist/primereact/resources/themes/md-light-deeppurple/theme.css +878 -910
- package/dist/primereact/resources/themes/md-light-indigo/theme.css +878 -910
- package/dist/primereact/resources/themes/mdc-dark-deeppurple/theme.css +918 -950
- package/dist/primereact/resources/themes/mdc-dark-indigo/theme.css +918 -950
- package/dist/primereact/resources/themes/mdc-light-deeppurple/theme.css +878 -910
- package/dist/primereact/resources/themes/mdc-light-indigo/theme.css +878 -910
- package/dist/primereact/resources/themes/mira/theme.css +1562 -1532
- package/dist/primereact/resources/themes/nano/theme.css +707 -641
- package/dist/primereact/resources/themes/nova/theme.css +705 -643
- package/dist/primereact/resources/themes/nova-accent/theme.css +701 -636
- package/dist/primereact/resources/themes/nova-alt/theme.css +705 -643
- package/dist/primereact/resources/themes/rhea/theme.css +876 -811
- package/dist/primereact/resources/themes/saga-blue/theme.css +896 -832
- package/dist/primereact/resources/themes/saga-green/theme.css +896 -832
- package/dist/primereact/resources/themes/saga-orange/theme.css +896 -832
- package/dist/primereact/resources/themes/saga-purple/theme.css +896 -832
- package/dist/primereact/resources/themes/soho-dark/theme.css +701 -643
- package/dist/primereact/resources/themes/soho-light/theme.css +690 -634
- package/dist/primereact/resources/themes/tailwind-light/theme.css +1370 -1306
- package/dist/primereact/resources/themes/vela-blue/theme.css +862 -798
- package/dist/primereact/resources/themes/vela-green/theme.css +862 -798
- package/dist/primereact/resources/themes/vela-orange/theme.css +862 -798
- package/dist/primereact/resources/themes/vela-purple/theme.css +862 -798
- package/dist/primereact/resources/themes/viva-dark/theme.css +655 -612
- package/dist/primereact/resources/themes/viva-light/theme.css +737 -694
- package/package.json +26 -22
- package/types/Editor.d.ts +9 -0
- package/types/{components → client-components}/LinkEditor.d.ts +1 -1
- package/types/client-components/MultiComponentEditor.d.ts +4 -2
- package/types/client-components/index.d.ts +3 -2
- package/types/components/Image.d.ts +3 -0
- package/types/components/Link.d.ts +4 -2
- package/types/components/LinkPreview.d.ts +6 -0
- package/types/components/LockedFieldIndicator.d.ts +6 -0
- package/types/components/Picture.d.ts +6 -7
- package/types/components/PictureEditorWrapper.d.ts +3 -0
- package/types/components/Placeholder.d.ts +12 -14
- package/types/components/RichText.d.ts +5 -2
- package/types/components/RichTextEditor.d.ts +3 -290
- package/types/components/RichTextEditorWrapper.d.ts +2 -0
- package/types/components/Slot.d.ts +5 -2
- package/types/components/Text.d.ts +5 -2
- package/types/components/TextEditor.d.ts +3 -290
- package/types/components/TextEditorWrapper.d.ts +4 -0
- package/types/components/Translate.d.ts +4 -1
- package/types/components/TranslateEditorWrapper.d.ts +3 -0
- package/types/components/picture-shared.d.ts +16 -0
- package/types/editor/ComponentInfo.d.ts +1 -1
- package/types/editor/ContentTree.d.ts +4 -3
- package/types/editor/ContextMenu.d.ts +14 -0
- package/types/editor/DictionaryEditor.d.ts +1 -4
- package/types/editor/EditFrameWrapper.d.ts +6 -0
- package/types/editor/EditorClient.d.ts +18 -7
- package/types/editor/EditorClientHost.d.ts +5 -6
- package/types/editor/EditorWarning.d.ts +6 -0
- package/types/editor/EditorWarnings.d.ts +9 -0
- package/types/editor/FieldEditorPopup.d.ts +10 -0
- package/types/editor/FieldList.d.ts +6 -2
- package/types/editor/FieldListField.d.ts +8 -2
- package/types/editor/FieldListFieldWithFallbacks.d.ts +8 -0
- package/types/editor/ItemInfo.d.ts +1 -1
- package/types/editor/Outline.d.ts +11 -0
- package/types/editor/PageViewer.d.ts +1 -0
- package/types/editor/PictureEditorDialog.d.ts +4 -2
- package/types/editor/PlaceholderDropZone.d.ts +3 -2
- package/types/editor/PlaceholderDropZoneHost.d.ts +3 -2
- package/types/editor/PreviewClient.d.ts +5 -0
- package/types/editor/PreviewClientHost.d.ts +4 -0
- package/types/editor/PreviewPanel.d.ts +1 -0
- package/types/editor/PublishDialog.d.ts +7 -0
- package/types/editor/Terminal.d.ts +6 -2
- package/types/editor/{AiPopup.d.ts → ai/AiPopup.d.ts} +2 -3
- package/types/editor/ai/AiResponseMessage.d.ts +7 -0
- package/types/editor/ai/AiTerminal.d.ts +4 -0
- package/types/editor/ai/AiToolCall.d.ts +9 -0
- package/types/editor/ai/EditorAiTerminal.d.ts +4 -0
- package/types/editor/commands/commands.d.ts +21 -0
- package/types/editor/commands/componentCommands.d.ts +5 -0
- package/types/editor/commands/createVersionCommand.d.ts +2 -0
- package/types/editor/commands/undo.d.ts +15 -0
- package/types/editor/component-designer/ComponentDesigner.d.ts +1 -0
- package/types/editor/component-designer/ComponentDesignerAiTerminal.d.ts +1 -0
- package/types/editor/component-designer/ComponentDesignerMenu.d.ts +1 -0
- package/types/editor/component-designer/ComponentPreview.d.ts +1 -0
- package/types/editor/component-designer/ComponentRenderingEditor.d.ts +2 -0
- package/types/editor/component-designer/ComponentSelectionTree.d.ts +1 -0
- package/types/editor/component-designer/componentDesignerContext.d.ts +14 -0
- package/types/editor/componentTreeHelper.d.ts +2 -1
- package/types/editor/config/config.d.ts +2 -0
- package/types/editor/config/types.d.ts +66 -0
- package/types/editor/editContext.d.ts +72 -93
- package/types/editor/editor-warnings/ItemLocked.d.ts +2 -0
- package/types/editor/editor-warnings/ValidationErrors.d.ts +2 -0
- package/types/editor/fieldTypes/CheckboxEditor.d.ts +3 -2
- package/types/editor/fieldTypes/DropLinkEditor.d.ts +5 -0
- package/types/editor/fieldTypes/InternalLinkFieldEditor.d.ts +3 -2
- package/types/editor/fieldTypes/LinkFieldEditor.d.ts +3 -2
- package/types/editor/fieldTypes/MultiLineText.d.ts +3 -2
- package/types/editor/fieldTypes/PictureFieldEditor.d.ts +2 -1
- package/types/editor/fieldTypes/RawEditor.d.ts +5 -0
- package/types/editor/fieldTypes/RichTextEditor.d.ts +4 -3
- package/types/editor/fieldTypes/RichTextEditorComponent.d.ts +5 -0
- package/types/editor/fieldTypes/SingleLineText.d.ts +3 -2
- package/types/editor/fieldTypes/TreeListEditor.d.ts +2 -1
- package/types/editor/itemCommands.d.ts +3 -0
- package/types/editor/menubar/BrowseHistory.d.ts +4 -0
- package/types/editor/menubar/ItemLanguageVersion.d.ts +1 -0
- package/types/editor/menubar/LanguageSelector.d.ts +5 -0
- package/types/editor/menubar/Menu.d.ts +1 -0
- package/types/editor/menubar/PageViewerControls.d.ts +1 -0
- package/types/editor/menubar/VersionSelector.d.ts +5 -0
- package/types/editor/previewContext.d.ts +4 -0
- package/types/editor/services/aiService.d.ts +8 -0
- package/types/editor/services/componentDesignerService.d.ts +2 -0
- package/types/editor/{contentService.d.ts → services/contentService.d.ts} +2 -3
- package/types/editor/services/editService.d.ts +23 -0
- package/types/editor/services/serviceHelper.d.ts +7 -0
- package/types/editor/sidebar/ComponentPalette.d.ts +1 -0
- package/types/editor/sidebar/ComponentTree.d.ts +1 -0
- package/types/editor/sidebar/Debug.d.ts +1 -0
- package/types/editor/sidebar/EditHistory.d.ts +1 -0
- package/types/editor/sidebar/EditorForm.d.ts +1 -0
- package/types/editor/sidebar/GraphQL.d.ts +1 -0
- package/types/editor/sidebar/Insert.d.ts +1 -0
- package/types/editor/sidebar/MainContentTree.d.ts +3 -0
- package/types/editor/sidebar/Sessions.d.ts +1 -0
- package/types/editor/sidebar/Sidebar.d.ts +4 -0
- package/types/editor/sidebar/SidebarView.d.ts +8 -0
- package/types/editor/sidebar/Workbox.d.ts +1 -0
- package/types/editor/ui/CopyToClipboardButton.d.ts +3 -0
- package/types/editor/ui/Icons.d.ts +16 -0
- package/types/editor/{ItemNameDialog.d.ts → ui/ItemNameDialog.d.ts} +1 -0
- package/types/editor/utils/insertOptions.d.ts +3 -0
- package/types/editor/utils.d.ts +8 -0
- package/types/editor/views/ItemEditor.d.ts +1 -0
- package/types/fieldTypes.d.ts +39 -11
- package/types/graphQL.d.ts +12 -0
- package/types/index.d.ts +7 -4
- package/types/loadRouteData.d.ts +8 -85
- package/types/middleware/handleRequest.d.ts +5 -0
- package/types/middleware/index.d.ts +1 -1
- package/types/public.d.ts +12 -0
- package/types/renderContext.d.ts +41 -0
- package/types/renderings.d.ts +7 -0
- package/types/servertypes.d.ts +308 -0
- package/types/translate.d.ts +2 -0
- package/dist/cjs/alpacaContext.js +0 -12
- package/dist/cjs/client-components/ClientLink.js +0 -36
- package/dist/cjs/client-components/MultiComponentEditor.js +0 -26
- package/dist/cjs/client-components/index.js +0 -19
- package/dist/cjs/components/Error.js +0 -15
- package/dist/cjs/components/Link.js +0 -36
- package/dist/cjs/components/Picture.js +0 -124
- package/dist/cjs/components/PictureEditor.js +0 -49
- package/dist/cjs/components/Placeholder.js +0 -118
- package/dist/cjs/components/RichText.js +0 -47
- package/dist/cjs/components/RichTextEditor.js +0 -94
- package/dist/cjs/components/Slot.js +0 -8
- package/dist/cjs/components/Text.js +0 -46
- package/dist/cjs/components/TextEditor.js +0 -77
- package/dist/cjs/components/Translate.js +0 -14
- package/dist/cjs/components/TranslateEditor.js +0 -28
- package/dist/cjs/components/index.js +0 -23
- package/dist/cjs/editor/AiPopup.js +0 -33
- package/dist/cjs/editor/AiTerminal.js +0 -185
- package/dist/cjs/editor/ComponentInfo.js +0 -15
- package/dist/cjs/editor/ComponentPalette.js +0 -23
- package/dist/cjs/editor/ComponentTree.js +0 -217
- package/dist/cjs/editor/ConfirmationDialog.js +0 -31
- package/dist/cjs/editor/Debug.js +0 -26
- package/dist/cjs/editor/DialogButtons.js +0 -7
- package/dist/cjs/editor/DictionaryEditor.js +0 -41
- package/dist/cjs/editor/EditFrame.js +0 -129
- package/dist/cjs/editor/EditHistory.js +0 -43
- package/dist/cjs/editor/Editor.js +0 -27
- package/dist/cjs/editor/EditorClient.js +0 -753
- package/dist/cjs/editor/EditorClientHost.js +0 -37
- package/dist/cjs/editor/FieldList.js +0 -51
- package/dist/cjs/editor/FieldListField.js +0 -75
- package/dist/cjs/editor/GraphQL.js +0 -87
- package/dist/cjs/editor/ItemEditor.js +0 -9
- package/dist/cjs/editor/ItemInfo.js +0 -17
- package/dist/cjs/editor/ItemNameDialog.js +0 -37
- package/dist/cjs/editor/LanguageSelector.js +0 -21
- package/dist/cjs/editor/LinkEditorDialog.js +0 -67
- package/dist/cjs/editor/MainLayout.js +0 -24
- package/dist/cjs/editor/MediaSelector.js +0 -92
- package/dist/cjs/editor/PictureEditorDialog.js +0 -93
- package/dist/cjs/editor/PlaceholderDropZone.js +0 -93
- package/dist/cjs/editor/PlaceholderDropZoneHost.js +0 -37
- package/dist/cjs/editor/SidebarTabs.js +0 -47
- package/dist/cjs/editor/Terminal.js +0 -61
- package/dist/cjs/editor/Utils.js +0 -43
- package/dist/cjs/editor/VersionSelector.js +0 -21
- package/dist/cjs/editor/Workbox.js +0 -41
- package/dist/cjs/editor/componentCommands.js +0 -141
- package/dist/cjs/editor/componentTreeHelper.js +0 -18
- package/dist/cjs/editor/contentService.js +0 -80
- package/dist/cjs/editor/editContext.js +0 -40
- package/dist/cjs/editor/editService.js +0 -334
- package/dist/cjs/editor/fieldTypes/CheckboxEditor.js +0 -21
- package/dist/cjs/editor/fieldTypes/InternalLinkFieldEditor.js +0 -46
- package/dist/cjs/editor/fieldTypes/MultiLineText.js +0 -25
- package/dist/cjs/editor/fieldTypes/PictureFieldEditor.js +0 -19
- package/dist/cjs/editor/fieldTypes/RichTextEditor.js +0 -24
- package/dist/cjs/editor/fieldTypes/SingleLineText.js +0 -25
- package/dist/cjs/editor/fieldTypes/TreeListEditor.js +0 -59
- package/dist/cjs/editor/index.js +0 -18
- package/dist/cjs/editor/ui/Section.js +0 -8
- package/dist/cjs/fieldTypes.js +0 -2
- package/dist/cjs/graphQLTypes.js +0 -2
- package/dist/cjs/index.js +0 -36
- package/dist/cjs/layoutData.js +0 -2
- package/dist/cjs/middleware/authorization.js +0 -52
- package/dist/cjs/middleware/index.js +0 -17
- package/types/alpacaContext.d.ts +0 -25
- package/types/editor/AiTerminal.d.ts +0 -5
- package/types/editor/ComponentPalette.d.ts +0 -6
- package/types/editor/ComponentTree.d.ts +0 -5
- package/types/editor/Debug.d.ts +0 -6
- package/types/editor/EditHistory.d.ts +0 -4
- package/types/editor/Editor.d.ts +0 -6
- package/types/editor/GraphQL.d.ts +0 -5
- package/types/editor/ItemEditor.d.ts +0 -4
- package/types/editor/LanguageSelector.d.ts +0 -5
- package/types/editor/SidebarTabs.d.ts +0 -8
- package/types/editor/Utils.d.ts +0 -3
- package/types/editor/VersionSelector.d.ts +0 -5
- package/types/editor/Workbox.d.ts +0 -6
- package/types/editor/componentCommands.d.ts +0 -4
- package/types/editor/editService.d.ts +0 -20
- package/types/editor/index.d.ts +0 -2
- package/types/layoutData.d.ts +0 -92
- package/types/middleware/authorization.d.ts +0 -2
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
"use client";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const [link, setLink] = (0, react_1.useState)();
|
|
13
|
-
(0, react_1.useEffect)(() => {
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { LinkEditorDialog } from "../LinkEditorDialog";
|
|
5
|
+
import { useEditContext } from "../editContext";
|
|
6
|
+
export function LinkFieldEditor({ field, readOnly, }) {
|
|
7
|
+
const editContext = useEditContext();
|
|
8
|
+
const [showDialog, setShowDialog] = useState(false);
|
|
9
|
+
const [link, setLink] = useState();
|
|
10
|
+
useEffect(() => {
|
|
14
11
|
var _a;
|
|
15
12
|
setLink({
|
|
16
13
|
url: field.value.url,
|
|
@@ -25,10 +22,12 @@ function LinkFieldEditor({ field }) {
|
|
|
25
22
|
return;
|
|
26
23
|
if (!editContext)
|
|
27
24
|
return;
|
|
28
|
-
return ((
|
|
25
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "a-p-3 a-bg-gray-50 a-flex a-justify-between a-focus-shadow", onClick: (e) => {
|
|
26
|
+
if (readOnly)
|
|
27
|
+
return;
|
|
29
28
|
setShowDialog(true);
|
|
30
29
|
e.preventDefault();
|
|
31
|
-
}, children: [(
|
|
30
|
+
}, children: [_jsx("div", { children: field.value.url }), !readOnly && _jsx("i", { className: "pi pi-link a-cursor-pointer" })] }), showDialog && (_jsx(LinkEditorDialog, { linkValue: link || { type: "internal" }, onOk: (link) => {
|
|
32
31
|
var _a, _b;
|
|
33
32
|
const xml = link.type == "internal"
|
|
34
33
|
? '<link linktype="internal" querystring="' +
|
|
@@ -40,7 +39,7 @@ function LinkFieldEditor({ field }) {
|
|
|
40
39
|
'" />'
|
|
41
40
|
: '<link linktype="external" querystring="' +
|
|
42
41
|
((_b = link.queryString) !== null && _b !== void 0 ? _b : "") +
|
|
43
|
-
' url="' +
|
|
42
|
+
'" url="' +
|
|
44
43
|
link.url +
|
|
45
44
|
'" target="' +
|
|
46
45
|
link.target +
|
|
@@ -52,4 +51,3 @@ function LinkFieldEditor({ field }) {
|
|
|
52
51
|
setShowDialog(false);
|
|
53
52
|
} }))] }));
|
|
54
53
|
}
|
|
55
|
-
exports.LinkFieldEditor = LinkFieldEditor;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { InputTextarea } from "primereact/inputtextarea";
|
|
4
|
+
import { useEditContext } from "../editContext";
|
|
5
|
+
export function MultiLineText({ field, readOnly, }) {
|
|
6
|
+
var _a;
|
|
7
|
+
const editContext = useEditContext();
|
|
8
|
+
if (!editContext)
|
|
9
|
+
return;
|
|
10
|
+
const liveField = editContext.getLiveField(field);
|
|
11
|
+
if (!editContext)
|
|
12
|
+
return;
|
|
13
|
+
const value = (liveField === null || liveField === void 0 ? void 0 : liveField.value) || field.value;
|
|
14
|
+
const fieldItem = (_a = field._editor) === null || _a === void 0 ? void 0 : _a.descriptor.item;
|
|
15
|
+
if (!fieldItem)
|
|
16
|
+
return;
|
|
17
|
+
return (_jsx(InputTextarea, { value: value, disabled: readOnly, className: "a-p-2 a-focus-shadow a-text-sm", style: { width: "100%" }, rows: 12, onChange: (e) => {
|
|
18
|
+
editContext.editField({
|
|
19
|
+
field,
|
|
20
|
+
value: e.target.value,
|
|
21
|
+
refresh: "none",
|
|
22
|
+
});
|
|
23
|
+
// field.value = e.target.value;
|
|
24
|
+
} }, fieldItem.id + field.id + fieldItem.language + fieldItem.version));
|
|
25
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEditContext } from "../editContext";
|
|
4
|
+
import { PictureEditorDialog } from "../PictureEditorDialog";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { InputText } from "primereact/inputtext";
|
|
7
|
+
export function PictureFieldEditor({ field, readOnly, }) {
|
|
8
|
+
var _a, _b, _c, _d;
|
|
9
|
+
const editContext = useEditContext();
|
|
10
|
+
const [editorVisible, setEditorVisible] = useState(false);
|
|
11
|
+
if (!field)
|
|
12
|
+
return;
|
|
13
|
+
if (!editContext)
|
|
14
|
+
return;
|
|
15
|
+
var item = (_a = field._editor) === null || _a === void 0 ? void 0 : _a.descriptor.item;
|
|
16
|
+
return (_jsxs("div", { children: [_jsx("div", { className: "a-flex a-gap-2 a-h-full a-border-r a-focus-shadow a-overflow-auto", children: (_c = (_b = field === null || field === void 0 ? void 0 : field.value) === null || _b === void 0 ? void 0 : _b.variants) === null || _c === void 0 ? void 0 : _c.map((variant) => (_jsxs("div", { children: [_jsx("div", { className: "a-h-40 a-w-40 a-border a-relative a-cursor-pointer a-flex a-justify-center a-items-center", onClick: () => {
|
|
17
|
+
if (!readOnly)
|
|
18
|
+
setEditorVisible(true);
|
|
19
|
+
}, children: variant.src && _jsx("img", { src: variant.thumbSrc }) }), _jsx("div", { className: "a-text-xs", children: variant.name }), _jsx("div", { className: "a-text-xs", children: variant.aspectRatioLockText })] }, variant.name))) }), _jsxs("div", { className: "a-mt-2", children: [_jsx("div", { className: "a-mb-1", children: "Alt Text" }), _jsx(InputText, { value: ((_d = field.value) === null || _d === void 0 ? void 0 : _d.alt) || "", disabled: readOnly, className: "a-p-2 a-focus-shadow a-text-sm", style: { width: "100%" }, onChange: (e) => {
|
|
20
|
+
const raw = (field === null || field === void 0 ? void 0 : field._editor.rawValue)
|
|
21
|
+
? JSON.parse(field === null || field === void 0 ? void 0 : field._editor.rawValue)
|
|
22
|
+
: { Variants: [] };
|
|
23
|
+
raw.AltText = e.target.value;
|
|
24
|
+
if (field.value)
|
|
25
|
+
field.value.alt = e.target.value;
|
|
26
|
+
editContext.editField({
|
|
27
|
+
field,
|
|
28
|
+
rawValue: JSON.stringify(raw),
|
|
29
|
+
refresh: "none",
|
|
30
|
+
});
|
|
31
|
+
// field.value = e.target.value;
|
|
32
|
+
} }, item.id + field.id + item.language + item.version)] }), editorVisible && (_jsx(PictureEditorDialog, { field: field, onCancel: () => setEditorVisible(false), onOk: () => setEditorVisible(false) }))] }));
|
|
33
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { InputTextarea } from "primereact/inputtextarea";
|
|
4
|
+
import { useEditContext } from "../editContext";
|
|
5
|
+
export function RawEditor({ field, readOnly, }) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const editContext = useEditContext();
|
|
8
|
+
if (!editContext)
|
|
9
|
+
return;
|
|
10
|
+
const liveField = editContext.getLiveField(field);
|
|
11
|
+
if (!editContext)
|
|
12
|
+
return;
|
|
13
|
+
const value = ((_a = liveField === null || liveField === void 0 ? void 0 : liveField._editor) === null || _a === void 0 ? void 0 : _a.rawValue) || ((_b = field._editor) === null || _b === void 0 ? void 0 : _b.rawValue);
|
|
14
|
+
const fieldItem = field._editor.descriptor.item;
|
|
15
|
+
return (_jsx(InputTextarea, { value: value || "", disabled: readOnly, className: "a-p-2 a-focus-shadow a-text-sm", style: { width: "100%" }, rows: 12, onChange: (e) => {
|
|
16
|
+
field._editor.rawValue = e.target.value;
|
|
17
|
+
if (liveField)
|
|
18
|
+
liveField._editor.rawValue = e.target.value;
|
|
19
|
+
editContext.editField({
|
|
20
|
+
field,
|
|
21
|
+
rawValue: e.target.value,
|
|
22
|
+
refresh: "waitForQuietPeriod",
|
|
23
|
+
});
|
|
24
|
+
// field.value = e.target.value;
|
|
25
|
+
} }, fieldItem.id + field.id + fieldItem.language + fieldItem.version));
|
|
26
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import dynamic from "next/dynamic";
|
|
4
|
+
const RichTextEditorComponent = dynamic(() => import("./RichTextEditorComponent").then((dnd) => dnd.RichTextEditorComponent), { ssr: false });
|
|
5
|
+
export function RichTextEditor({ field, readOnly, }) {
|
|
6
|
+
return _jsx(RichTextEditorComponent, { field: field, readOnly: readOnly });
|
|
7
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Editor } from "primereact/editor";
|
|
4
|
+
import { useEditContext } from "../editContext";
|
|
5
|
+
import Quill from "quill";
|
|
6
|
+
let Inline = Quill.import("blots/inline");
|
|
7
|
+
class BoldBlot extends Inline {
|
|
8
|
+
}
|
|
9
|
+
BoldBlot.blotName = "bold";
|
|
10
|
+
BoldBlot.tagName = "strong";
|
|
11
|
+
Quill.register("formats/bold", BoldBlot);
|
|
12
|
+
export function RichTextEditorComponent({ field, readOnly, }) {
|
|
13
|
+
var _a;
|
|
14
|
+
const editContext = useEditContext();
|
|
15
|
+
if (!editContext)
|
|
16
|
+
return;
|
|
17
|
+
const liveField = editContext.getLiveField(field);
|
|
18
|
+
// const profile =
|
|
19
|
+
// editContext.configuration.fieldTypes["rich text"].custom.profiles.default;
|
|
20
|
+
// const toolbar = getToolbar(profile);
|
|
21
|
+
// const editorModules = {
|
|
22
|
+
// toolbar: {
|
|
23
|
+
// container: [
|
|
24
|
+
// // ... other toolbar options
|
|
25
|
+
// ["customButton"], // Add your custom button here
|
|
26
|
+
// ],
|
|
27
|
+
// },
|
|
28
|
+
// customButton: {}, // Initialize your custom module
|
|
29
|
+
// };
|
|
30
|
+
const fieldItem = (_a = field._editor) === null || _a === void 0 ? void 0 : _a.descriptor.item;
|
|
31
|
+
if (!fieldItem)
|
|
32
|
+
return;
|
|
33
|
+
return (_jsx(_Fragment, { children: _jsx(Editor, { className: "a-focus-shadow", disabled: readOnly, value: liveField.value, style: { width: "100%" },
|
|
34
|
+
// headerTemplate={toolbar}
|
|
35
|
+
//modules={editorModules}
|
|
36
|
+
onTextChange: (e) => {
|
|
37
|
+
var _a;
|
|
38
|
+
// console.log("Text change: " + field.itemId);
|
|
39
|
+
editContext.editField({
|
|
40
|
+
field,
|
|
41
|
+
value: (_a = e.htmlValue) !== null && _a !== void 0 ? _a : "",
|
|
42
|
+
refresh: "none",
|
|
43
|
+
});
|
|
44
|
+
// field.value = e.htmlValue;
|
|
45
|
+
} }, fieldItem.id + field.id + fieldItem.language + fieldItem.version) }));
|
|
46
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { InputText } from "primereact/inputtext";
|
|
4
|
+
import { useEditContext } from "../editContext";
|
|
5
|
+
export function SingleLineText({ field, readOnly, }) {
|
|
6
|
+
var _a;
|
|
7
|
+
const editContext = useEditContext();
|
|
8
|
+
if (!editContext)
|
|
9
|
+
return;
|
|
10
|
+
const liveField = editContext.getLiveField(field);
|
|
11
|
+
const value = (liveField === null || liveField === void 0 ? void 0 : liveField.value) || field.value;
|
|
12
|
+
const fieldItem = (_a = field._editor) === null || _a === void 0 ? void 0 : _a.descriptor.item;
|
|
13
|
+
if (!fieldItem)
|
|
14
|
+
return;
|
|
15
|
+
return (_jsx(InputText, { value: value || "", disabled: readOnly, className: "a-p-2 a-focus-shadow a-text-sm", style: { width: "100%" }, onChange: (e) => {
|
|
16
|
+
editContext.editField({
|
|
17
|
+
field,
|
|
18
|
+
value: e.target.value,
|
|
19
|
+
refresh: "none",
|
|
20
|
+
});
|
|
21
|
+
// field.value = e.target.value;
|
|
22
|
+
} }, fieldItem.id + field.id + fieldItem.language + fieldItem.version));
|
|
23
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Splitter, SplitterPanel } from "primereact/splitter";
|
|
3
|
+
import { useEditContext } from "../editContext";
|
|
4
|
+
import ContentTree from "../ContentTree";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { ListBox } from "primereact/listbox";
|
|
7
|
+
export default function TreeListEditor({ field, readOnly, }) {
|
|
8
|
+
const editContext = useEditContext();
|
|
9
|
+
const [selectedItemIdsInTree, setSelectedItemIdsInTree] = useState([]);
|
|
10
|
+
const [selectedFromList, setSelectedFromList] = useState([]);
|
|
11
|
+
if (!editContext)
|
|
12
|
+
return;
|
|
13
|
+
const rootItemId = field._editor.customProperties.datasources &&
|
|
14
|
+
field._editor.customProperties.datasources.length
|
|
15
|
+
? field._editor.customProperties.datasources[0]
|
|
16
|
+
: "{11111111-1111-1111-1111-111111111111}";
|
|
17
|
+
const trimPath = (path) => {
|
|
18
|
+
const splitPath = path.split("/");
|
|
19
|
+
if (splitPath.length > 2) {
|
|
20
|
+
return (splitPath[splitPath.length - 2] + "/" + splitPath[splitPath.length - 1]);
|
|
21
|
+
}
|
|
22
|
+
return path;
|
|
23
|
+
};
|
|
24
|
+
function removeFromList(items) {
|
|
25
|
+
editContext === null || editContext === void 0 ? void 0 : editContext.editField({
|
|
26
|
+
field: field,
|
|
27
|
+
rawValue: field.value
|
|
28
|
+
.filter((x) => !items.find((i) => x.id == i.id))
|
|
29
|
+
.map((x) => x.id)
|
|
30
|
+
.join("|"),
|
|
31
|
+
refresh: "immediate",
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function addToList(itemIds) {
|
|
35
|
+
const ids = field.value.map((x) => x.id);
|
|
36
|
+
itemIds.forEach((element) => {
|
|
37
|
+
if (ids.indexOf(element) == -1) {
|
|
38
|
+
ids.push(element);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
editContext === null || editContext === void 0 ? void 0 : editContext.editField({
|
|
42
|
+
field: field,
|
|
43
|
+
rawValue: ids.join("|"),
|
|
44
|
+
refresh: "immediate",
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return (_jsx("div", { className: "a-border a-focus-shadow", children: _jsxs(Splitter, { className: "a-h-52", children: [_jsx(SplitterPanel, { size: 50, className: "a-relative", children: _jsx("div", { className: "a-absolute a-inset-0 a-overflow-auto", children: _jsx(ContentTree, { onDoubleClick: (node) => {
|
|
48
|
+
if (!readOnly)
|
|
49
|
+
addToList([node.id]);
|
|
50
|
+
}, selectionMode: "multiple", selectedItemIds: selectedItemIdsInTree, onSelectionChange: (e) => {
|
|
51
|
+
const selcetedIds = e.map((x) => x.id);
|
|
52
|
+
setSelectedItemIdsInTree(selcetedIds);
|
|
53
|
+
}, rootItemId: rootItemId }) }) }), _jsx(SplitterPanel, { children: _jsx("div", { className: "a-h-full a-w-full a-relative", children: _jsxs("div", { className: "a-absolute a-inset-0 a-flex", children: [_jsxs("div", { className: "a-bg-gray-100 a-flex a-flex-col a-justify-center", children: [_jsx("button", { onClick: () => addToList(selectedItemIdsInTree), disabled: readOnly, children: _jsx("i", { className: "pi pi-angle-right a-p-2 hover:a-bg-gray-50" }) }), _jsx("button", { onClick: () => removeFromList(selectedFromList), disabled: readOnly, children: _jsx("i", { className: "pi pi-angle-left a-p-2 hover:a-bg-gray-50" }) })] }), _jsx("div", { className: "a-flex-1 a-h-full a-relative", children: _jsx(ListBox, { className: "a-absolute a-inset-0 a-overflow-auto a-text-xs", options: field.value || [], optionLabel: "path", emptyMessage: "None selected", multiple: true, value: selectedFromList, onChange: (e) => setSelectedFromList(e.value), itemTemplate: (option) => (_jsxs("div", { className: "a-select-none", onDoubleClick: () => {
|
|
54
|
+
if (!readOnly)
|
|
55
|
+
removeFromList([option]);
|
|
56
|
+
}, children: [trimPath(option.path), " "] })) }) }), _jsx("div", {})] }) }) })] }) }));
|
|
57
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { deleteItem } from "./services/editService";
|
|
11
|
+
import { confirmDialog } from "primereact/confirmdialog";
|
|
12
|
+
export function getDeleteItemCommand(item, editContext, callback) {
|
|
13
|
+
return () => {
|
|
14
|
+
confirmDialog({
|
|
15
|
+
message: "Are you sure you want to delete " +
|
|
16
|
+
item.name +
|
|
17
|
+
"? This cannot be undone.",
|
|
18
|
+
header: "Confirmation",
|
|
19
|
+
icon: "pi pi-exclamation-triangle",
|
|
20
|
+
accept: () => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
yield deleteItem(item);
|
|
22
|
+
editContext === null || editContext === void 0 ? void 0 : editContext.requestRefresh("immediate");
|
|
23
|
+
callback();
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Dropdown } from "primereact/dropdown";
|
|
3
|
+
import { useEditContext } from "../editContext";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
export function BrowseHistory({ item }) {
|
|
6
|
+
const editContext = useEditContext();
|
|
7
|
+
if (!editContext)
|
|
8
|
+
return;
|
|
9
|
+
// Initialize state with data from local storage (if available)
|
|
10
|
+
const [history, setHistory] = useState(() => {
|
|
11
|
+
const savedHistory = localStorage.getItem("editor.browseHistory");
|
|
12
|
+
return savedHistory ? JSON.parse(savedHistory) : [];
|
|
13
|
+
});
|
|
14
|
+
let currentValue = {
|
|
15
|
+
name: item._editor.path || "unknown",
|
|
16
|
+
id: item.id,
|
|
17
|
+
hasLayout: item._editor.hasLayout,
|
|
18
|
+
};
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
setHistory((history) => {
|
|
21
|
+
const newItem = item;
|
|
22
|
+
if (!newItem)
|
|
23
|
+
return history;
|
|
24
|
+
const newHistory = [
|
|
25
|
+
currentValue,
|
|
26
|
+
...history.filter((x) => x.id !== newItem.id).slice(0, 100),
|
|
27
|
+
];
|
|
28
|
+
return newHistory;
|
|
29
|
+
});
|
|
30
|
+
}, [item]);
|
|
31
|
+
return (_jsx(_Fragment, { children: _jsx(Dropdown, { className: "a-text-sm", value: currentValue, onChange: (e) => {
|
|
32
|
+
editContext.loadItem({
|
|
33
|
+
id: e.value.id,
|
|
34
|
+
language: item.language,
|
|
35
|
+
version: 0,
|
|
36
|
+
hasLayout: e.value.hasLayout,
|
|
37
|
+
});
|
|
38
|
+
}, options: history, optionLabel: "name", filter: true }) }));
|
|
39
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEditContext } from "../editContext";
|
|
3
|
+
import { BrowseHistory } from "./BrowseHistory";
|
|
4
|
+
import { LanguageSelector } from "./LanguageSelector";
|
|
5
|
+
import { VersionSelector } from "./VersionSelector";
|
|
6
|
+
export function ItemLanguageVersion() {
|
|
7
|
+
const editContext = useEditContext();
|
|
8
|
+
if (!editContext)
|
|
9
|
+
return;
|
|
10
|
+
const item = editContext.view.centerPanelView === "form"
|
|
11
|
+
? editContext.secondaryItem || editContext.page
|
|
12
|
+
: editContext.page;
|
|
13
|
+
if (!item)
|
|
14
|
+
return;
|
|
15
|
+
return (_jsxs("div", { children: [_jsx(BrowseHistory, { item: item }), _jsx(LanguageSelector, { item: item, onLanguageSelected: (language) => {
|
|
16
|
+
editContext.loadItem(Object.assign(Object.assign({}, item), { language }));
|
|
17
|
+
} }), _jsx(VersionSelector, { item: item, onVersionSelected: (version) => {
|
|
18
|
+
editContext.loadItem(Object.assign(Object.assign({}, item), { version }));
|
|
19
|
+
} })] }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Dropdown } from "primereact/dropdown";
|
|
4
|
+
export function LanguageSelector({ item, onLanguageSelected, }) {
|
|
5
|
+
var _a;
|
|
6
|
+
if (item == null)
|
|
7
|
+
return;
|
|
8
|
+
const selectedCountryTemplate = (option, props) => {
|
|
9
|
+
if (option) {
|
|
10
|
+
return _jsx("div", { children: option.name });
|
|
11
|
+
}
|
|
12
|
+
return _jsx("span", { children: props.placeholder });
|
|
13
|
+
};
|
|
14
|
+
const countryOptionTemplate = (option) => {
|
|
15
|
+
return (_jsxs("div", { children: [option.name, " (", option.versions, ")"] }));
|
|
16
|
+
};
|
|
17
|
+
return (_jsx(_Fragment, { children: _jsx(Dropdown, { className: "a-text-sm", value: item.language, onChange: (e) => onLanguageSelected(e.value), options: (_a = item._editor) === null || _a === void 0 ? void 0 : _a.languages, optionValue: "languageCode", optionLabel: "name", placeholder: "Select a language", filter: true, valueTemplate: selectedCountryTemplate, itemTemplate: countryOptionTemplate }) }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Menubar } from "primereact/menubar";
|
|
12
|
+
import { useEditContext } from "../editContext";
|
|
13
|
+
import { ItemLanguageVersion } from "./ItemLanguageVersion";
|
|
14
|
+
import { configuration } from "../config/config";
|
|
15
|
+
import { PageViewerControls } from "./PageViewerControls";
|
|
16
|
+
export function Menu() {
|
|
17
|
+
const editContext = useEditContext();
|
|
18
|
+
if (!editContext)
|
|
19
|
+
return;
|
|
20
|
+
const getSubItems = (items) => {
|
|
21
|
+
if (typeof items === "function")
|
|
22
|
+
items = items(editContext);
|
|
23
|
+
return items.map((y) => {
|
|
24
|
+
if ("execute" in y)
|
|
25
|
+
return {
|
|
26
|
+
label: y.label,
|
|
27
|
+
icon: y.icon,
|
|
28
|
+
disabled: editContext.isCommandDisabled(y),
|
|
29
|
+
command: (event) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
yield editContext.executeCommand({
|
|
31
|
+
command: y,
|
|
32
|
+
event: event.originalEvent,
|
|
33
|
+
});
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
label: y.label,
|
|
38
|
+
icon: y.icon,
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
const menuItems = configuration.chrome.editor.mainNavigation.map((x) => {
|
|
43
|
+
if ("execute" in x)
|
|
44
|
+
return {
|
|
45
|
+
label: x.label,
|
|
46
|
+
icon: x.icon,
|
|
47
|
+
disabled: editContext.isCommandDisabled(x),
|
|
48
|
+
command: (event) => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
yield editContext.executeCommand({
|
|
50
|
+
command: x,
|
|
51
|
+
event: event.originalEvent,
|
|
52
|
+
});
|
|
53
|
+
}),
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
label: x.label,
|
|
57
|
+
icon: x.icon,
|
|
58
|
+
items: getSubItems(x.items),
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
// [
|
|
62
|
+
// {
|
|
63
|
+
// label: "Undo",
|
|
64
|
+
// icon: "pi pi-fw pi-undo",
|
|
65
|
+
// command: () => editContext.undo(),
|
|
66
|
+
// disabled:
|
|
67
|
+
// editHistory.length === 0 ||
|
|
68
|
+
// !editHistory.find((x) => x.sessionId === sessionId && x.canUndo),
|
|
69
|
+
// },
|
|
70
|
+
// {
|
|
71
|
+
// label: "Redo",
|
|
72
|
+
// icon: "pi pi-fw pi-refresh",
|
|
73
|
+
// //command: () => editContext.redo(),
|
|
74
|
+
// disabled:
|
|
75
|
+
// editHistory.length === 0 ||
|
|
76
|
+
// !editHistory.find((x) => x.sessionId === sessionId && x.canRedo),
|
|
77
|
+
// },
|
|
78
|
+
// {
|
|
79
|
+
// label: "Selection",
|
|
80
|
+
// icon: "pi pi-fw pi-bars",
|
|
81
|
+
// items: componentCommandMenuItems,
|
|
82
|
+
// },
|
|
83
|
+
// { separator: true },
|
|
84
|
+
// {
|
|
85
|
+
// label: "Preview",
|
|
86
|
+
// icon: "pi pi-fw pi-external-link",
|
|
87
|
+
// command: () => {
|
|
88
|
+
// const currentUrl = new URL(window.location.href);
|
|
89
|
+
// const searchParams = currentUrl.searchParams;
|
|
90
|
+
// if (searchParams.get("mode") === "edit") {
|
|
91
|
+
// searchParams.set("mode", "preview");
|
|
92
|
+
// }
|
|
93
|
+
// window.open(currentUrl.href);
|
|
94
|
+
// },
|
|
95
|
+
// },
|
|
96
|
+
// // {
|
|
97
|
+
// // label: "Publish",
|
|
98
|
+
// // icon: "pi pi-fw pi-upload",
|
|
99
|
+
// // // command: () => publish(),
|
|
100
|
+
// // },
|
|
101
|
+
// //{ separator: true },
|
|
102
|
+
// ];
|
|
103
|
+
const endContent = (_jsxs("div", { className: "a-flex a-gap-3 a-items-center", children: [_jsx(PageViewerControls, {}), _jsx(ItemLanguageVersion, {})] }));
|
|
104
|
+
return (_jsx(Menubar, { model: menuItems, end: endContent, className: "a-p-1 a-text-sm a-rounded-none a-border-0 a-border-b a-bg-gray-50" }));
|
|
105
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { classNames } from "primereact/utils";
|
|
3
|
+
import { useEditContext } from "../editContext";
|
|
4
|
+
import { Menubar } from "primereact/menubar";
|
|
5
|
+
export function PageViewerControls() {
|
|
6
|
+
const editContext = useEditContext();
|
|
7
|
+
if (!editContext)
|
|
8
|
+
return null;
|
|
9
|
+
if (editContext.view.centerPanelView !== "page")
|
|
10
|
+
return null;
|
|
11
|
+
const zoom = editContext.pageView.zoom;
|
|
12
|
+
const setZoom = editContext.pageView.setZoom;
|
|
13
|
+
const device = editContext.pageView.device;
|
|
14
|
+
const setDevice = editContext.pageView.setDevice;
|
|
15
|
+
const zoomMenu = {
|
|
16
|
+
label: Math.floor(zoom * 100) + "%",
|
|
17
|
+
icon: "pi pi-search",
|
|
18
|
+
items: [
|
|
19
|
+
{
|
|
20
|
+
label: "25%",
|
|
21
|
+
icon: "pi pi-search",
|
|
22
|
+
command: () => setZoom(0.25),
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: "50%",
|
|
26
|
+
icon: "pi pi-search",
|
|
27
|
+
command: () => setZoom(0.5),
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: "75%",
|
|
31
|
+
icon: "pi pi-search",
|
|
32
|
+
command: () => setZoom(0.75),
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: "100%",
|
|
36
|
+
icon: "pi pi-search",
|
|
37
|
+
command: () => setZoom(1),
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: "125%",
|
|
41
|
+
icon: "pi pi-search",
|
|
42
|
+
command: () => setZoom(1.25),
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: "150%",
|
|
46
|
+
icon: "pi pi-search",
|
|
47
|
+
command: () => setZoom(1.5),
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
label: "200%",
|
|
51
|
+
icon: "pi pi-search",
|
|
52
|
+
command: () => setZoom(2),
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: "400%",
|
|
56
|
+
icon: "pi pi-search",
|
|
57
|
+
command: () => setZoom(4),
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
return (_jsxs("div", { className: "a-flex a-gap-2 a-items-center a-mr-4", children: [_jsx(Menubar, { model: [zoomMenu], className: "a-border-0 a-p-0" }), _jsx("i", { className: classNames(device === "desktop" ? "a-bg-gray-100" : "", "pi pi-desktop a-cursor-pointer"), onClick: () => {
|
|
62
|
+
setDevice("desktop");
|
|
63
|
+
} }), _jsx("i", { className: classNames(device === "mobile" ? "a-bg-gray-100" : "", "pi pi-tablet a-cursor-pointer"), onClick: () => {
|
|
64
|
+
setDevice("mobile");
|
|
65
|
+
} }), _jsx("i", { className: "pi pi-external-link a-cursor-pointer", onClick: () => editContext.pageView.setFullscreen(true) })] }));
|
|
66
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Dropdown } from "primereact/dropdown";
|
|
4
|
+
export function VersionSelector({ item, onVersionSelected, }) {
|
|
5
|
+
var _a;
|
|
6
|
+
if (item == null)
|
|
7
|
+
return;
|
|
8
|
+
const selectedVersionTemplate = (option, props) => {
|
|
9
|
+
if (option) {
|
|
10
|
+
return _jsx("div", { children: option.version });
|
|
11
|
+
}
|
|
12
|
+
return _jsx("span", { children: props.placeholder });
|
|
13
|
+
};
|
|
14
|
+
const versionOptionTemplate = (option) => {
|
|
15
|
+
return (_jsxs("div", { children: [option.version, " ", _jsxs("div", { className: "a-text-xs", children: ["(", option.updated.toString(), " by ", option.updatedBy, ")"] })] }));
|
|
16
|
+
};
|
|
17
|
+
return (_jsx(_Fragment, { children: _jsx(Dropdown, { className: "a-text-sm", value: item.version, onChange: (e) => onVersionSelected(e.value), options: (_a = item._editor) === null || _a === void 0 ? void 0 : _a.versions, optionValue: "version", optionLabel: "version", placeholder: "Select a version", valueTemplate: selectedVersionTemplate, itemTemplate: versionOptionTemplate }) }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { post } from "./serviceHelper";
|
|
11
|
+
export function loadAiConfig(item) {
|
|
12
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
let url = "/alpaca/headless/ai/config";
|
|
14
|
+
const response = yield post(url, item);
|
|
15
|
+
if (!response.response.ok) {
|
|
16
|
+
throw new Error("Error loading AI config");
|
|
17
|
+
}
|
|
18
|
+
return yield response.response.json();
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { post } from "./serviceHelper";
|
|
11
|
+
export function createNewComponent(parent, name) {
|
|
12
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
let url = "/alpaca/headless/component/create";
|
|
14
|
+
const response = yield post(url, {
|
|
15
|
+
settingsItemId: parent.id,
|
|
16
|
+
name,
|
|
17
|
+
});
|
|
18
|
+
if (!response.response.ok) {
|
|
19
|
+
return new Error("Error creating new item");
|
|
20
|
+
}
|
|
21
|
+
return yield response.response.json();
|
|
22
|
+
});
|
|
23
|
+
}
|