@alpaca-headless/alpaca-headless-nextjs 0.0.4 → 1.0.19
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/cjs/components/Image.js +36 -0
- package/dist/cjs/components/Link.js +31 -0
- package/dist/cjs/components/LinkEditor.js +22 -0
- package/dist/cjs/components/Picture.js +119 -0
- package/dist/cjs/components/PictureEditor.js +42 -0
- package/dist/cjs/components/Placeholder.js +40 -4
- package/dist/cjs/components/RichText.js +44 -0
- package/dist/cjs/components/RichTextEditor.js +82 -0
- package/dist/cjs/components/Slot.js +8 -0
- package/dist/cjs/components/Text.js +24 -4
- package/dist/cjs/components/TextEditor.js +68 -0
- package/dist/cjs/components/Translate.js +14 -0
- package/dist/cjs/components/index.js +5 -0
- package/dist/cjs/editor/AiTerminal.js +161 -0
- package/dist/cjs/editor/ComponentInfo.js +14 -0
- package/dist/cjs/editor/ComponentPalette.js +78 -0
- package/dist/cjs/editor/ComponentTree.js +200 -0
- package/dist/cjs/editor/ContentTree.js +120 -0
- package/dist/cjs/editor/Debug.js +16 -0
- package/dist/cjs/editor/DictionaryEditor.js +35 -0
- package/dist/cjs/editor/EditFrame.js +61 -0
- package/dist/cjs/editor/EditHistory.js +30 -0
- package/dist/cjs/editor/Editor.js +27 -0
- package/dist/cjs/editor/EditorClient.js +460 -0
- package/dist/cjs/editor/EditorClientHost.js +37 -0
- package/dist/cjs/editor/FieldList.js +59 -0
- package/dist/cjs/editor/GraphQL.js +90 -0
- package/dist/cjs/editor/LanguageSelector.js +21 -0
- package/dist/cjs/editor/MediaSelector.js +61 -0
- package/dist/cjs/editor/PageInfo.js +12 -0
- package/dist/cjs/editor/PlaceholderDropZone.js +54 -0
- package/dist/cjs/editor/PlaceholderDropZoneHost.js +37 -0
- package/dist/cjs/editor/Terminal.js +51 -0
- package/dist/cjs/editor/TranslateEditor.js +25 -0
- package/dist/cjs/editor/VersionSelector.js +21 -0
- package/dist/cjs/editor/componentTreeHelper.js +18 -0
- package/dist/cjs/editor/contentService.js +38 -0
- package/dist/cjs/editor/editContext.js +35 -0
- package/dist/cjs/editor/editService.js +150 -0
- package/dist/cjs/editor/fieldTypes/RichTextEditor.js +19 -0
- package/dist/cjs/editor/fieldTypes/SingleLineText.js +17 -0
- package/dist/cjs/editor/index.js +18 -0
- package/dist/cjs/graphQLTypes.js +2 -0
- package/dist/cjs/index.js +15 -0
- package/dist/cjs/loadRouteData.js +98 -40
- package/dist/cjs/mediaProtection.js +56 -0
- package/dist/editor.css +426 -0
- package/dist/esm/components/Image.js +32 -0
- package/dist/esm/components/Link.js +24 -0
- package/dist/esm/components/LinkEditor.js +19 -0
- package/dist/esm/components/Picture.js +115 -0
- package/dist/esm/components/PictureEditor.js +38 -0
- package/dist/esm/components/Placeholder.js +38 -5
- package/dist/esm/components/RichText.js +37 -0
- package/dist/esm/components/RichTextEditor.js +55 -0
- package/dist/esm/components/Slot.js +5 -0
- package/dist/esm/components/Text.js +24 -4
- package/dist/esm/components/TextEditor.js +41 -0
- package/dist/esm/components/Translate.js +10 -0
- package/dist/esm/components/index.js +5 -0
- package/dist/esm/editor/AiTerminal.js +157 -0
- package/dist/esm/editor/ComponentInfo.js +10 -0
- package/dist/esm/editor/ComponentPalette.js +71 -0
- package/dist/esm/editor/ComponentTree.js +196 -0
- package/dist/esm/editor/ContentTree.js +117 -0
- package/dist/esm/editor/Debug.js +9 -0
- package/dist/esm/editor/DictionaryEditor.js +31 -0
- package/dist/esm/editor/EditFrame.js +57 -0
- package/dist/esm/editor/EditHistory.js +26 -0
- package/dist/esm/editor/Editor.js +23 -0
- package/dist/esm/editor/EditorClient.js +453 -0
- package/dist/esm/editor/EditorClientHost.js +7 -0
- package/dist/esm/editor/FieldList.js +55 -0
- package/dist/esm/editor/GraphQL.js +83 -0
- package/dist/esm/editor/LanguageSelector.js +17 -0
- package/dist/esm/editor/MediaSelector.js +54 -0
- package/dist/esm/editor/PageInfo.js +8 -0
- package/dist/esm/editor/PlaceholderDropZone.js +50 -0
- package/dist/esm/editor/PlaceholderDropZoneHost.js +7 -0
- package/dist/esm/editor/Terminal.js +47 -0
- package/dist/esm/editor/TranslateEditor.js +21 -0
- package/dist/esm/editor/VersionSelector.js +17 -0
- package/dist/esm/editor/componentTreeHelper.js +14 -0
- package/dist/esm/editor/contentService.js +31 -0
- package/dist/esm/editor/editContext.js +5 -0
- package/dist/esm/editor/editService.js +139 -0
- package/dist/esm/editor/fieldTypes/RichTextEditor.js +15 -0
- package/dist/esm/editor/fieldTypes/SingleLineText.js +13 -0
- package/dist/esm/editor/index.js +2 -0
- package/dist/esm/graphQLTypes.js +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/loadRouteData.js +97 -39
- package/dist/esm/mediaProtection.js +49 -0
- package/dist/primeicons/CHANGELOG.md +303 -0
- package/dist/primeicons/LICENSE +21 -0
- package/dist/primeicons/README.md +14 -0
- package/dist/primeicons/fonts/primeicons.eot +0 -0
- package/dist/primeicons/fonts/primeicons.svg +292 -0
- package/dist/primeicons/fonts/primeicons.ttf +0 -0
- package/dist/primeicons/fonts/primeicons.woff +0 -0
- package/dist/primeicons/fonts/primeicons.woff2 +0 -0
- package/dist/primeicons/package.json +16 -0
- package/dist/primeicons/primeicons.css +1102 -0
- package/dist/primeicons/raw-svg/align-center.svg +1 -0
- package/dist/primeicons/raw-svg/align-justify.svg +1 -0
- package/dist/primeicons/raw-svg/align-left.svg +1 -0
- package/dist/primeicons/raw-svg/align-right.svg +1 -0
- package/dist/primeicons/raw-svg/android.svg +1 -0
- package/dist/primeicons/raw-svg/angle-double-down.svg +1 -0
- package/dist/primeicons/raw-svg/angle-double-left.svg +1 -0
- package/dist/primeicons/raw-svg/angle-double-right.svg +1 -0
- package/dist/primeicons/raw-svg/angle-double-up.svg +1 -0
- package/dist/primeicons/raw-svg/angle-down.svg +1 -0
- package/dist/primeicons/raw-svg/angle-left.svg +1 -0
- package/dist/primeicons/raw-svg/angle-right.svg +1 -0
- package/dist/primeicons/raw-svg/angle-up.svg +1 -0
- package/dist/primeicons/raw-svg/apple.svg +1 -0
- package/dist/primeicons/raw-svg/arrow-circle-down.svg +1 -0
- package/dist/primeicons/raw-svg/arrow-circle-left.svg +1 -0
- package/dist/primeicons/raw-svg/arrow-circle-right.svg +1 -0
- package/dist/primeicons/raw-svg/arrow-circle-up.svg +1 -0
- package/dist/primeicons/raw-svg/arrow-down-left.svg +1 -0
- package/dist/primeicons/raw-svg/arrow-down-right.svg +1 -0
- package/dist/primeicons/raw-svg/arrow-down.svg +1 -0
- package/dist/primeicons/raw-svg/arrow-left.svg +1 -0
- package/dist/primeicons/raw-svg/arrow-right-arrow-left.svg +4 -0
- package/dist/primeicons/raw-svg/arrow-right.svg +1 -0
- package/dist/primeicons/raw-svg/arrow-up-left.svg +1 -0
- package/dist/primeicons/raw-svg/arrow-up-right.svg +1 -0
- package/dist/primeicons/raw-svg/arrow-up.svg +1 -0
- package/dist/primeicons/raw-svg/arrows-alt.svg +4 -0
- package/dist/primeicons/raw-svg/arrows-h.svg +1 -0
- package/dist/primeicons/raw-svg/arrows-v.svg +1 -0
- package/dist/primeicons/raw-svg/at.svg +1 -0
- package/dist/primeicons/raw-svg/backward.svg +4 -0
- package/dist/primeicons/raw-svg/ban.svg +1 -0
- package/dist/primeicons/raw-svg/bars.svg +1 -0
- package/dist/primeicons/raw-svg/bell.svg +1 -0
- package/dist/primeicons/raw-svg/bitcoin.svg +4 -0
- package/dist/primeicons/raw-svg/bolt.svg +1 -0
- package/dist/primeicons/raw-svg/book.svg +1 -0
- package/dist/primeicons/raw-svg/bookmark-fill.svg +1 -0
- package/dist/primeicons/raw-svg/bookmark.svg +1 -0
- package/dist/primeicons/raw-svg/box.svg +1 -0
- package/dist/primeicons/raw-svg/briefcase.svg +1 -0
- package/dist/primeicons/raw-svg/building.svg +1 -0
- package/dist/primeicons/raw-svg/calculator.svg +4 -0
- package/dist/primeicons/raw-svg/calendar-minus.svg +1 -0
- package/dist/primeicons/raw-svg/calendar-plus.svg +1 -0
- package/dist/primeicons/raw-svg/calendar-times.svg +1 -0
- package/dist/primeicons/raw-svg/calendar.svg +1 -0
- package/dist/primeicons/raw-svg/camera.svg +1 -0
- package/dist/primeicons/raw-svg/car.svg +1 -0
- package/dist/primeicons/raw-svg/caret-down.svg +1 -0
- package/dist/primeicons/raw-svg/caret-left.svg +1 -0
- package/dist/primeicons/raw-svg/caret-right.svg +1 -0
- package/dist/primeicons/raw-svg/caret-up.svg +1 -0
- package/dist/primeicons/raw-svg/cart-plus.svg +4 -0
- package/dist/primeicons/raw-svg/chart-bar.svg +1 -0
- package/dist/primeicons/raw-svg/chart-line.svg +1 -0
- package/dist/primeicons/raw-svg/chart-pie.svg +1 -0
- package/dist/primeicons/raw-svg/check-circle.svg +1 -0
- package/dist/primeicons/raw-svg/check-square.svg +1 -0
- package/dist/primeicons/raw-svg/check.svg +1 -0
- package/dist/primeicons/raw-svg/chevron-circle-down.svg +1 -0
- package/dist/primeicons/raw-svg/chevron-circle-left.svg +1 -0
- package/dist/primeicons/raw-svg/chevron-circle-right.svg +1 -0
- package/dist/primeicons/raw-svg/chevron-circle-up.svg +1 -0
- package/dist/primeicons/raw-svg/chevron-down.svg +1 -0
- package/dist/primeicons/raw-svg/chevron-left.svg +1 -0
- package/dist/primeicons/raw-svg/chevron-right.svg +1 -0
- package/dist/primeicons/raw-svg/chevron-up.svg +1 -0
- package/dist/primeicons/raw-svg/circle-fill.svg +1 -0
- package/dist/primeicons/raw-svg/circle-off.svg +1 -0
- package/dist/primeicons/raw-svg/circle-on.svg +1 -0
- package/dist/primeicons/raw-svg/circle.svg +1 -0
- package/dist/primeicons/raw-svg/clock.svg +1 -0
- package/dist/primeicons/raw-svg/clone.svg +1 -0
- package/dist/primeicons/raw-svg/cloud-download.svg +1 -0
- package/dist/primeicons/raw-svg/cloud-upload.svg +1 -0
- package/dist/primeicons/raw-svg/cloud.svg +1 -0
- package/dist/primeicons/raw-svg/code.svg +1 -0
- package/dist/primeicons/raw-svg/cog.svg +1 -0
- package/dist/primeicons/raw-svg/comment.svg +1 -0
- package/dist/primeicons/raw-svg/comments.svg +1 -0
- package/dist/primeicons/raw-svg/compass.svg +1 -0
- package/dist/primeicons/raw-svg/copy.svg +1 -0
- package/dist/primeicons/raw-svg/credit-card.svg +1 -0
- package/dist/primeicons/raw-svg/database.svg +1 -0
- package/dist/primeicons/raw-svg/delete-left.svg +4 -0
- package/dist/primeicons/raw-svg/desktop.svg +1 -0
- package/dist/primeicons/raw-svg/directions-alt.svg +1 -0
- package/dist/primeicons/raw-svg/directions.svg +1 -0
- package/dist/primeicons/raw-svg/discord.svg +4 -0
- package/dist/primeicons/raw-svg/dollar.svg +1 -0
- package/dist/primeicons/raw-svg/download.svg +1 -0
- package/dist/primeicons/raw-svg/eject.svg +1 -0
- package/dist/primeicons/raw-svg/ellipsis-h.svg +1 -0
- package/dist/primeicons/raw-svg/ellipsis-v.svg +1 -0
- package/dist/primeicons/raw-svg/envelope.svg +1 -0
- package/dist/primeicons/raw-svg/eraser.svg +4 -0
- package/dist/primeicons/raw-svg/euro.svg +1 -0
- package/dist/primeicons/raw-svg/exclamation-circle.svg +1 -0
- package/dist/primeicons/raw-svg/exclamation-triangle.svg +1 -0
- package/dist/primeicons/raw-svg/external-link.svg +1 -0
- package/dist/primeicons/raw-svg/eye-slash.svg +1 -0
- package/dist/primeicons/raw-svg/eye.svg +1 -0
- package/dist/primeicons/raw-svg/facebook.svg +1 -0
- package/dist/primeicons/raw-svg/fast-backward.svg +4 -0
- package/dist/primeicons/raw-svg/fast-forward.svg +4 -0
- package/dist/primeicons/raw-svg/file-edit.svg +4 -0
- package/dist/primeicons/raw-svg/file-excel.svg +1 -0
- package/dist/primeicons/raw-svg/file-export.svg +4 -0
- package/dist/primeicons/raw-svg/file-import.svg +4 -0
- package/dist/primeicons/raw-svg/file-o.svg +1 -0
- package/dist/primeicons/raw-svg/file-pdf.svg +1 -0
- package/dist/primeicons/raw-svg/file-word.svg +4 -0
- package/dist/primeicons/raw-svg/file.svg +1 -0
- package/dist/primeicons/raw-svg/filter-fill.svg +1 -0
- package/dist/primeicons/raw-svg/filter-slash.svg +1 -0
- package/dist/primeicons/raw-svg/filter.svg +1 -0
- package/dist/primeicons/raw-svg/flag-fill.svg +1 -0
- package/dist/primeicons/raw-svg/flag.svg +1 -0
- package/dist/primeicons/raw-svg/folder-open.svg +1 -0
- package/dist/primeicons/raw-svg/folder.svg +1 -0
- package/dist/primeicons/raw-svg/forward.svg +4 -0
- package/dist/primeicons/raw-svg/gift.svg +4 -0
- package/dist/primeicons/raw-svg/github.svg +1 -0
- package/dist/primeicons/raw-svg/globe.svg +1 -0
- package/dist/primeicons/raw-svg/google.svg +1 -0
- package/dist/primeicons/raw-svg/hashtag.svg +1 -0
- package/dist/primeicons/raw-svg/heart-fill.svg +1 -0
- package/dist/primeicons/raw-svg/heart.svg +1 -0
- package/dist/primeicons/raw-svg/history.svg +1 -0
- package/dist/primeicons/raw-svg/home.svg +1 -0
- package/dist/primeicons/raw-svg/hourglass.svg +4 -0
- package/dist/primeicons/raw-svg/id-card.svg +1 -0
- package/dist/primeicons/raw-svg/image.svg +1 -0
- package/dist/primeicons/raw-svg/images.svg +1 -0
- package/dist/primeicons/raw-svg/inbox.svg +1 -0
- package/dist/primeicons/raw-svg/info-circle.svg +1 -0
- package/dist/primeicons/raw-svg/info.svg +1 -0
- package/dist/primeicons/raw-svg/instagram.svg +1 -0
- package/dist/primeicons/raw-svg/key.svg +1 -0
- package/dist/primeicons/raw-svg/language.svg +4 -0
- package/dist/primeicons/raw-svg/link.svg +1 -0
- package/dist/primeicons/raw-svg/linkedin.svg +1 -0
- package/dist/primeicons/raw-svg/list.svg +1 -0
- package/dist/primeicons/raw-svg/lock-open.svg +1 -0
- package/dist/primeicons/raw-svg/lock.svg +1 -0
- package/dist/primeicons/raw-svg/map-marker.svg +1 -0
- package/dist/primeicons/raw-svg/map.svg +1 -0
- package/dist/primeicons/raw-svg/megaphone.svg +4 -0
- package/dist/primeicons/raw-svg/microphone.svg +4 -0
- package/dist/primeicons/raw-svg/microsoft.svg +1 -0
- package/dist/primeicons/raw-svg/minus-circle.svg +1 -0
- package/dist/primeicons/raw-svg/minus.svg +1 -0
- package/dist/primeicons/raw-svg/mobile.svg +4 -0
- package/dist/primeicons/raw-svg/money-bill.svg +1 -0
- package/dist/primeicons/raw-svg/moon.svg +1 -0
- package/dist/primeicons/raw-svg/palette.svg +4 -0
- package/dist/primeicons/raw-svg/paperclip.svg +1 -0
- package/dist/primeicons/raw-svg/pause.svg +1 -0
- package/dist/primeicons/raw-svg/paypal.svg +1 -0
- package/dist/primeicons/raw-svg/pencil.svg +1 -0
- package/dist/primeicons/raw-svg/percentage.svg +1 -0
- package/dist/primeicons/raw-svg/phone.svg +1 -0
- package/dist/primeicons/raw-svg/play.svg +1 -0
- package/dist/primeicons/raw-svg/plus-circle.svg +1 -0
- package/dist/primeicons/raw-svg/plus.svg +1 -0
- package/dist/primeicons/raw-svg/pound.svg +1 -0
- package/dist/primeicons/raw-svg/power-off.svg +1 -0
- package/dist/primeicons/raw-svg/prime.svg +1 -0
- package/dist/primeicons/raw-svg/print.svg +1 -0
- package/dist/primeicons/raw-svg/qrcode.svg +1 -0
- package/dist/primeicons/raw-svg/question-circle.svg +4 -0
- package/dist/primeicons/raw-svg/question.svg +1 -0
- package/dist/primeicons/raw-svg/reddit.svg +1 -0
- package/dist/primeicons/raw-svg/refresh.svg +1 -0
- package/dist/primeicons/raw-svg/replay.svg +1 -0
- package/dist/primeicons/raw-svg/reply.svg +1 -0
- package/dist/primeicons/raw-svg/save.svg +1 -0
- package/dist/primeicons/raw-svg/search-minus.svg +1 -0
- package/dist/primeicons/raw-svg/search-plus.svg +1 -0
- package/dist/primeicons/raw-svg/search.svg +1 -0
- package/dist/primeicons/raw-svg/send.svg +1 -0
- package/dist/primeicons/raw-svg/server.svg +1 -0
- package/dist/primeicons/raw-svg/share-alt.svg +1 -0
- package/dist/primeicons/raw-svg/shield.svg +1 -0
- package/dist/primeicons/raw-svg/shopping-bag.svg +1 -0
- package/dist/primeicons/raw-svg/shopping-cart.svg +4 -0
- package/dist/primeicons/raw-svg/sign-in.svg +1 -0
- package/dist/primeicons/raw-svg/sign-out.svg +1 -0
- package/dist/primeicons/raw-svg/sitemap.svg +1 -0
- package/dist/primeicons/raw-svg/slack.svg +1 -0
- package/dist/primeicons/raw-svg/sliders-h.svg +1 -0
- package/dist/primeicons/raw-svg/sliders-v.svg +1 -0
- package/dist/primeicons/raw-svg/sort-alpha-alt-down.svg +6 -0
- package/dist/primeicons/raw-svg/sort-alpha-alt-up.svg +6 -0
- package/dist/primeicons/raw-svg/sort-alpha-down.svg +6 -0
- package/dist/primeicons/raw-svg/sort-alpha-up.svg +6 -0
- package/dist/primeicons/raw-svg/sort-alt-slash.svg +6 -0
- package/dist/primeicons/raw-svg/sort-alt.svg +7 -0
- package/dist/primeicons/raw-svg/sort-amount-down-alt.svg +9 -0
- package/dist/primeicons/raw-svg/sort-amount-down.svg +9 -0
- package/dist/primeicons/raw-svg/sort-amount-up-alt.svg +9 -0
- package/dist/primeicons/raw-svg/sort-amount-up.svg +9 -0
- package/dist/primeicons/raw-svg/sort-down.svg +1 -0
- package/dist/primeicons/raw-svg/sort-numeric-alt-down.svg +1 -0
- package/dist/primeicons/raw-svg/sort-numeric-alt-up.svg +1 -0
- package/dist/primeicons/raw-svg/sort-numeric-down.svg +1 -0
- package/dist/primeicons/raw-svg/sort-numeric-up.svg +8 -0
- package/dist/primeicons/raw-svg/sort-up.svg +1 -0
- package/dist/primeicons/raw-svg/sort.svg +1 -0
- package/dist/primeicons/raw-svg/spinner.svg +1 -0
- package/dist/primeicons/raw-svg/star-fill.svg +1 -0
- package/dist/primeicons/raw-svg/star.svg +1 -0
- package/dist/primeicons/raw-svg/step-backward-alt.svg +4 -0
- package/dist/primeicons/raw-svg/step-backward.svg +1 -0
- package/dist/primeicons/raw-svg/step-forward-alt.svg +4 -0
- package/dist/primeicons/raw-svg/step-forward.svg +1 -0
- package/dist/primeicons/raw-svg/stop-circle.svg +1 -0
- package/dist/primeicons/raw-svg/stop.svg +1 -0
- package/dist/primeicons/raw-svg/stopwatch.svg +4 -0
- package/dist/primeicons/raw-svg/sun.svg +1 -0
- package/dist/primeicons/raw-svg/sync.svg +1 -0
- package/dist/primeicons/raw-svg/table.svg +1 -0
- package/dist/primeicons/raw-svg/tablet.svg +4 -0
- package/dist/primeicons/raw-svg/tag.svg +4 -0
- package/dist/primeicons/raw-svg/tags.svg +4 -0
- package/dist/primeicons/raw-svg/telegram.svg +1 -0
- package/dist/primeicons/raw-svg/th-large.svg +1 -0
- package/dist/primeicons/raw-svg/thumbs-down-fill.svg +4 -0
- package/dist/primeicons/raw-svg/thumbs-down.svg +4 -0
- package/dist/primeicons/raw-svg/thumbs-up-fill.svg +4 -0
- package/dist/primeicons/raw-svg/thumbs-up.svg +4 -0
- package/dist/primeicons/raw-svg/ticket.svg +1 -0
- package/dist/primeicons/raw-svg/times-circle.svg +1 -0
- package/dist/primeicons/raw-svg/times.svg +1 -0
- package/dist/primeicons/raw-svg/trash.svg +1 -0
- package/dist/primeicons/raw-svg/truck.svg +4 -0
- package/dist/primeicons/raw-svg/twitter.svg +1 -0
- package/dist/primeicons/raw-svg/undo.svg +1 -0
- package/dist/primeicons/raw-svg/unlock.svg +1 -0
- package/dist/primeicons/raw-svg/upload.svg +1 -0
- package/dist/primeicons/raw-svg/user-edit.svg +1 -0
- package/dist/primeicons/raw-svg/user-minus.svg +1 -0
- package/dist/primeicons/raw-svg/user-plus.svg +1 -0
- package/dist/primeicons/raw-svg/user.svg +1 -0
- package/dist/primeicons/raw-svg/users.svg +1 -0
- package/dist/primeicons/raw-svg/verified.svg +4 -0
- package/dist/primeicons/raw-svg/video.svg +1 -0
- package/dist/primeicons/raw-svg/vimeo.svg +1 -0
- package/dist/primeicons/raw-svg/volume-down.svg +1 -0
- package/dist/primeicons/raw-svg/volume-off.svg +1 -0
- package/dist/primeicons/raw-svg/volume-up.svg +1 -0
- package/dist/primeicons/raw-svg/wallet.svg +1 -0
- package/dist/primeicons/raw-svg/whatsapp.svg +1 -0
- package/dist/primeicons/raw-svg/wifi.svg +1 -0
- package/dist/primeicons/raw-svg/window-maximize.svg +1 -0
- package/dist/primeicons/raw-svg/window-minimize.svg +1 -0
- package/dist/primeicons/raw-svg/wrench.svg +4 -0
- package/dist/primeicons/raw-svg/youtube.svg +1 -0
- package/dist/primereact/resources/images/color.png +0 -0
- package/dist/primereact/resources/images/hue.png +0 -0
- package/dist/primereact/resources/images/line.gif +0 -0
- package/dist/primereact/resources/primereact.css +6301 -0
- package/dist/primereact/resources/primereact.min.css +1 -0
- package/dist/primereact/resources/themes/arya-blue/theme.css +6249 -0
- package/dist/primereact/resources/themes/arya-green/theme.css +6249 -0
- package/dist/primereact/resources/themes/arya-orange/theme.css +6249 -0
- package/dist/primereact/resources/themes/arya-purple/theme.css +6249 -0
- package/dist/primereact/resources/themes/bootstrap4-dark-blue/theme.css +6252 -0
- package/dist/primereact/resources/themes/bootstrap4-dark-purple/theme.css +6252 -0
- package/dist/primereact/resources/themes/bootstrap4-light-blue/theme.css +6252 -0
- package/dist/primereact/resources/themes/bootstrap4-light-purple/theme.css +6252 -0
- package/dist/primereact/resources/themes/fluent-light/theme.css +6383 -0
- package/dist/primereact/resources/themes/lara-dark-blue/theme.css +6239 -0
- package/dist/primereact/resources/themes/lara-dark-indigo/theme.css +6239 -0
- package/dist/primereact/resources/themes/lara-dark-purple/theme.css +6239 -0
- package/dist/primereact/resources/themes/lara-dark-teal/theme.css +6239 -0
- package/dist/primereact/resources/themes/lara-light-blue/theme.css +6239 -0
- package/dist/primereact/resources/themes/lara-light-indigo/theme.css +6239 -0
- package/dist/primereact/resources/themes/lara-light-purple/theme.css +6239 -0
- package/dist/primereact/resources/themes/lara-light-teal/theme.css +6239 -0
- package/dist/primereact/resources/themes/luna-amber/theme.css +6195 -0
- package/dist/primereact/resources/themes/luna-blue/theme.css +6195 -0
- package/dist/primereact/resources/themes/luna-green/theme.css +6195 -0
- package/dist/primereact/resources/themes/luna-pink/theme.css +6195 -0
- package/dist/primereact/resources/themes/md-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-500.woff +0 -0
- package/dist/primereact/resources/themes/md-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-500.woff2 +0 -0
- package/dist/primereact/resources/themes/md-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-700.woff +0 -0
- package/dist/primereact/resources/themes/md-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-700.woff2 +0 -0
- package/dist/primereact/resources/themes/md-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-regular.woff +0 -0
- package/dist/primereact/resources/themes/md-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-regular.woff2 +0 -0
- package/dist/primereact/resources/themes/md-dark-deeppurple/theme.css +7777 -0
- package/dist/primereact/resources/themes/md-dark-indigo/fonts/roboto-v20-latin-ext_latin-500.woff +0 -0
- package/dist/primereact/resources/themes/md-dark-indigo/fonts/roboto-v20-latin-ext_latin-500.woff2 +0 -0
- package/dist/primereact/resources/themes/md-dark-indigo/fonts/roboto-v20-latin-ext_latin-700.woff +0 -0
- package/dist/primereact/resources/themes/md-dark-indigo/fonts/roboto-v20-latin-ext_latin-700.woff2 +0 -0
- package/dist/primereact/resources/themes/md-dark-indigo/fonts/roboto-v20-latin-ext_latin-regular.woff +0 -0
- package/dist/primereact/resources/themes/md-dark-indigo/fonts/roboto-v20-latin-ext_latin-regular.woff2 +0 -0
- package/dist/primereact/resources/themes/md-dark-indigo/theme.css +7777 -0
- package/dist/primereact/resources/themes/md-light-deeppurple/fonts/roboto-v20-latin-ext_latin-500.woff +0 -0
- package/dist/primereact/resources/themes/md-light-deeppurple/fonts/roboto-v20-latin-ext_latin-500.woff2 +0 -0
- package/dist/primereact/resources/themes/md-light-deeppurple/fonts/roboto-v20-latin-ext_latin-700.woff +0 -0
- package/dist/primereact/resources/themes/md-light-deeppurple/fonts/roboto-v20-latin-ext_latin-700.woff2 +0 -0
- package/dist/primereact/resources/themes/md-light-deeppurple/fonts/roboto-v20-latin-ext_latin-regular.woff +0 -0
- package/dist/primereact/resources/themes/md-light-deeppurple/fonts/roboto-v20-latin-ext_latin-regular.woff2 +0 -0
- package/dist/primereact/resources/themes/md-light-deeppurple/theme.css +7777 -0
- package/dist/primereact/resources/themes/md-light-indigo/fonts/roboto-v20-latin-ext_latin-500.woff +0 -0
- package/dist/primereact/resources/themes/md-light-indigo/fonts/roboto-v20-latin-ext_latin-500.woff2 +0 -0
- package/dist/primereact/resources/themes/md-light-indigo/fonts/roboto-v20-latin-ext_latin-700.woff +0 -0
- package/dist/primereact/resources/themes/md-light-indigo/fonts/roboto-v20-latin-ext_latin-700.woff2 +0 -0
- package/dist/primereact/resources/themes/md-light-indigo/fonts/roboto-v20-latin-ext_latin-regular.woff +0 -0
- package/dist/primereact/resources/themes/md-light-indigo/fonts/roboto-v20-latin-ext_latin-regular.woff2 +0 -0
- package/dist/primereact/resources/themes/md-light-indigo/theme.css +7777 -0
- package/dist/primereact/resources/themes/mdc-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-500.woff +0 -0
- package/dist/primereact/resources/themes/mdc-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-500.woff2 +0 -0
- package/dist/primereact/resources/themes/mdc-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-700.woff +0 -0
- package/dist/primereact/resources/themes/mdc-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-700.woff2 +0 -0
- package/dist/primereact/resources/themes/mdc-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-regular.woff +0 -0
- package/dist/primereact/resources/themes/mdc-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-regular.woff2 +0 -0
- package/dist/primereact/resources/themes/mdc-dark-deeppurple/theme.css +7777 -0
- package/dist/primereact/resources/themes/mdc-dark-indigo/fonts/roboto-v20-latin-ext_latin-500.woff +0 -0
- package/dist/primereact/resources/themes/mdc-dark-indigo/fonts/roboto-v20-latin-ext_latin-500.woff2 +0 -0
- package/dist/primereact/resources/themes/mdc-dark-indigo/fonts/roboto-v20-latin-ext_latin-700.woff +0 -0
- package/dist/primereact/resources/themes/mdc-dark-indigo/fonts/roboto-v20-latin-ext_latin-700.woff2 +0 -0
- package/dist/primereact/resources/themes/mdc-dark-indigo/fonts/roboto-v20-latin-ext_latin-regular.woff +0 -0
- package/dist/primereact/resources/themes/mdc-dark-indigo/fonts/roboto-v20-latin-ext_latin-regular.woff2 +0 -0
- package/dist/primereact/resources/themes/mdc-dark-indigo/theme.css +7777 -0
- package/dist/primereact/resources/themes/mdc-light-deeppurple/fonts/roboto-v20-latin-ext_latin-500.woff +0 -0
- package/dist/primereact/resources/themes/mdc-light-deeppurple/fonts/roboto-v20-latin-ext_latin-500.woff2 +0 -0
- package/dist/primereact/resources/themes/mdc-light-deeppurple/fonts/roboto-v20-latin-ext_latin-700.woff +0 -0
- package/dist/primereact/resources/themes/mdc-light-deeppurple/fonts/roboto-v20-latin-ext_latin-700.woff2 +0 -0
- package/dist/primereact/resources/themes/mdc-light-deeppurple/fonts/roboto-v20-latin-ext_latin-regular.woff +0 -0
- package/dist/primereact/resources/themes/mdc-light-deeppurple/fonts/roboto-v20-latin-ext_latin-regular.woff2 +0 -0
- package/dist/primereact/resources/themes/mdc-light-deeppurple/theme.css +7777 -0
- package/dist/primereact/resources/themes/mdc-light-indigo/fonts/roboto-v20-latin-ext_latin-500.woff +0 -0
- package/dist/primereact/resources/themes/mdc-light-indigo/fonts/roboto-v20-latin-ext_latin-500.woff2 +0 -0
- package/dist/primereact/resources/themes/mdc-light-indigo/fonts/roboto-v20-latin-ext_latin-700.woff +0 -0
- package/dist/primereact/resources/themes/mdc-light-indigo/fonts/roboto-v20-latin-ext_latin-700.woff2 +0 -0
- package/dist/primereact/resources/themes/mdc-light-indigo/fonts/roboto-v20-latin-ext_latin-regular.woff +0 -0
- package/dist/primereact/resources/themes/mdc-light-indigo/fonts/roboto-v20-latin-ext_latin-regular.woff2 +0 -0
- package/dist/primereact/resources/themes/mdc-light-indigo/theme.css +7777 -0
- package/dist/primereact/resources/themes/mira/fonts/Inter-Bold.woff +0 -0
- package/dist/primereact/resources/themes/mira/fonts/Inter-Bold.woff2 +0 -0
- package/dist/primereact/resources/themes/mira/fonts/Inter-Medium.woff +0 -0
- package/dist/primereact/resources/themes/mira/fonts/Inter-Medium.woff2 +0 -0
- package/dist/primereact/resources/themes/mira/fonts/Inter-Regular.woff +0 -0
- package/dist/primereact/resources/themes/mira/fonts/Inter-Regular.woff2 +0 -0
- package/dist/primereact/resources/themes/mira/fonts/Inter-SemiBold.woff +0 -0
- package/dist/primereact/resources/themes/mira/fonts/Inter-SemiBold.woff2 +0 -0
- package/dist/primereact/resources/themes/mira/theme.css +6454 -0
- package/dist/primereact/resources/themes/nano/theme.css +6230 -0
- package/dist/primereact/resources/themes/nova/theme.css +6209 -0
- package/dist/primereact/resources/themes/nova-accent/theme.css +6219 -0
- package/dist/primereact/resources/themes/nova-alt/theme.css +6221 -0
- package/dist/primereact/resources/themes/rhea/theme.css +6197 -0
- package/dist/primereact/resources/themes/saga-blue/theme.css +6246 -0
- package/dist/primereact/resources/themes/saga-green/theme.css +6246 -0
- package/dist/primereact/resources/themes/saga-orange/theme.css +6246 -0
- package/dist/primereact/resources/themes/saga-purple/theme.css +6246 -0
- package/dist/primereact/resources/themes/soho-dark/fonts/lato-v17-latin-ext_latin-300.woff +0 -0
- package/dist/primereact/resources/themes/soho-dark/fonts/lato-v17-latin-ext_latin-300.woff2 +0 -0
- package/dist/primereact/resources/themes/soho-dark/fonts/lato-v17-latin-ext_latin-700.woff +0 -0
- package/dist/primereact/resources/themes/soho-dark/fonts/lato-v17-latin-ext_latin-700.woff2 +0 -0
- package/dist/primereact/resources/themes/soho-dark/fonts/lato-v17-latin-ext_latin-regular.woff +0 -0
- package/dist/primereact/resources/themes/soho-dark/fonts/lato-v17-latin-ext_latin-regular.woff2 +0 -0
- package/dist/primereact/resources/themes/soho-dark/theme.css +6220 -0
- package/dist/primereact/resources/themes/soho-light/fonts/lato-v17-latin-ext_latin-300.woff +0 -0
- package/dist/primereact/resources/themes/soho-light/fonts/lato-v17-latin-ext_latin-300.woff2 +0 -0
- package/dist/primereact/resources/themes/soho-light/fonts/lato-v17-latin-ext_latin-700.woff +0 -0
- package/dist/primereact/resources/themes/soho-light/fonts/lato-v17-latin-ext_latin-700.woff2 +0 -0
- package/dist/primereact/resources/themes/soho-light/fonts/lato-v17-latin-ext_latin-regular.woff +0 -0
- package/dist/primereact/resources/themes/soho-light/fonts/lato-v17-latin-ext_latin-regular.woff2 +0 -0
- package/dist/primereact/resources/themes/soho-light/theme.css +6274 -0
- package/dist/primereact/resources/themes/tailwind-light/fonts/Inter-Bold.woff +0 -0
- package/dist/primereact/resources/themes/tailwind-light/fonts/Inter-Bold.woff2 +0 -0
- package/dist/primereact/resources/themes/tailwind-light/fonts/Inter-Light.woff +0 -0
- package/dist/primereact/resources/themes/tailwind-light/fonts/Inter-Light.woff2 +0 -0
- package/dist/primereact/resources/themes/tailwind-light/fonts/Inter-Medium.woff +0 -0
- package/dist/primereact/resources/themes/tailwind-light/fonts/Inter-Medium.woff2 +0 -0
- package/dist/primereact/resources/themes/tailwind-light/fonts/Inter-Regular.woff +0 -0
- package/dist/primereact/resources/themes/tailwind-light/fonts/Inter-Regular.woff2 +0 -0
- package/dist/primereact/resources/themes/tailwind-light/fonts/Inter-SemiBold.woff +0 -0
- package/dist/primereact/resources/themes/tailwind-light/fonts/Inter-SemiBold.woff2 +0 -0
- package/dist/primereact/resources/themes/tailwind-light/theme.css +6336 -0
- package/dist/primereact/resources/themes/vela-blue/theme.css +6249 -0
- package/dist/primereact/resources/themes/vela-green/theme.css +6249 -0
- package/dist/primereact/resources/themes/vela-orange/theme.css +6249 -0
- package/dist/primereact/resources/themes/vela-purple/theme.css +6249 -0
- package/dist/primereact/resources/themes/viva-dark/fonts/poppins-v15-latin-ext_latin-300.woff +0 -0
- package/dist/primereact/resources/themes/viva-dark/fonts/poppins-v15-latin-ext_latin-300.woff2 +0 -0
- package/dist/primereact/resources/themes/viva-dark/fonts/poppins-v15-latin-ext_latin-600.woff +0 -0
- package/dist/primereact/resources/themes/viva-dark/fonts/poppins-v15-latin-ext_latin-600.woff2 +0 -0
- package/dist/primereact/resources/themes/viva-dark/fonts/poppins-v15-latin-ext_latin-700.woff +0 -0
- package/dist/primereact/resources/themes/viva-dark/fonts/poppins-v15-latin-ext_latin-700.woff2 +0 -0
- package/dist/primereact/resources/themes/viva-dark/fonts/poppins-v15-latin-ext_latin-regular.woff +0 -0
- package/dist/primereact/resources/themes/viva-dark/fonts/poppins-v15-latin-ext_latin-regular.woff2 +0 -0
- package/dist/primereact/resources/themes/viva-dark/theme.css +6381 -0
- package/dist/primereact/resources/themes/viva-light/fonts/poppins-v15-latin-ext_latin-300.woff +0 -0
- package/dist/primereact/resources/themes/viva-light/fonts/poppins-v15-latin-ext_latin-300.woff2 +0 -0
- package/dist/primereact/resources/themes/viva-light/fonts/poppins-v15-latin-ext_latin-600.woff +0 -0
- package/dist/primereact/resources/themes/viva-light/fonts/poppins-v15-latin-ext_latin-600.woff2 +0 -0
- package/dist/primereact/resources/themes/viva-light/fonts/poppins-v15-latin-ext_latin-700.woff +0 -0
- package/dist/primereact/resources/themes/viva-light/fonts/poppins-v15-latin-ext_latin-700.woff2 +0 -0
- package/dist/primereact/resources/themes/viva-light/fonts/poppins-v15-latin-ext_latin-regular.woff +0 -0
- package/dist/primereact/resources/themes/viva-light/fonts/poppins-v15-latin-ext_latin-regular.woff2 +0 -0
- package/dist/primereact/resources/themes/viva-light/theme.css +6381 -0
- package/package.json +20 -4
- package/tailwind.config.js +22 -0
- package/types/alpacaContext.d.ts +11 -0
- package/types/components/Image.d.ts +10 -0
- package/types/components/Link.d.ts +6 -0
- package/types/components/LinkEditor.d.ts +6 -0
- package/types/components/Picture.d.ts +20 -0
- package/types/components/PictureEditor.d.ts +3 -0
- package/types/components/RichText.d.ts +7 -0
- package/types/components/RichTextEditor.d.ts +296 -0
- package/types/components/Slot.d.ts +4 -0
- package/types/components/Text.d.ts +3 -2
- package/types/components/TextEditor.d.ts +296 -0
- package/types/components/Translate.d.ts +3 -0
- package/types/components/index.d.ts +5 -0
- package/types/editor/AiTerminal.d.ts +4 -0
- package/types/editor/ComponentInfo.d.ts +4 -0
- package/types/editor/ComponentPalette.d.ts +7 -0
- package/types/editor/ComponentTree.d.ts +5 -0
- package/types/editor/ContentTree.d.ts +13 -0
- package/types/editor/Debug.d.ts +6 -0
- package/types/editor/DictionaryEditor.d.ts +3 -0
- package/types/editor/EditFrame.d.ts +6 -0
- package/types/editor/EditHistory.d.ts +4 -0
- package/types/editor/Editor.d.ts +6 -0
- package/types/editor/EditorClient.d.ts +12 -0
- package/types/editor/EditorClientHost.d.ts +8 -0
- package/types/editor/FieldList.d.ts +4 -0
- package/types/editor/GraphQL.d.ts +5 -0
- package/types/editor/LanguageSelector.d.ts +5 -0
- package/types/editor/MediaSelector.d.ts +5 -0
- package/types/editor/PageInfo.d.ts +4 -0
- package/types/editor/PlaceholderDropZone.d.ts +6 -0
- package/types/editor/PlaceholderDropZoneHost.d.ts +6 -0
- package/types/editor/Terminal.d.ts +4 -0
- package/types/editor/TranslateEditor.d.ts +3 -0
- package/types/editor/VersionSelector.d.ts +5 -0
- package/types/editor/componentTreeHelper.d.ts +2 -0
- package/types/editor/contentService.d.ts +14 -0
- package/types/editor/editContext.d.ts +81 -0
- package/types/editor/editService.d.ts +12 -0
- package/types/editor/fieldTypes/RichTextEditor.d.ts +4 -0
- package/types/editor/fieldTypes/SingleLineText.d.ts +4 -0
- package/types/editor/index.d.ts +2 -0
- package/types/fieldTypes.d.ts +63 -1
- package/types/graphQLTypes.d.ts +24 -0
- package/types/index.d.ts +2 -0
- package/types/layoutData.d.ts +56 -1
- package/types/loadRouteData.d.ts +30 -1
- package/types/mediaProtection.d.ts +2 -0
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { useState, useEffect, useRef } from "react";
|
|
13
|
+
import uuid from "react-uuid";
|
|
14
|
+
import { PrimeReactProvider } from "primereact/api";
|
|
15
|
+
import { Menubar } from "primereact/menubar";
|
|
16
|
+
import { ProgressSpinner } from "primereact/progressspinner";
|
|
17
|
+
import { TabView, TabPanel } from "primereact/tabview";
|
|
18
|
+
import { Toast } from "primereact/toast";
|
|
19
|
+
import { Splitter, SplitterPanel } from "primereact/splitter";
|
|
20
|
+
import { BlockUI } from "primereact/blockui";
|
|
21
|
+
import { ConfirmDialog, confirmDialog } from "primereact/confirmdialog";
|
|
22
|
+
import { Sidebar } from "primereact/sidebar";
|
|
23
|
+
import { EditContextProvider, } from "..";
|
|
24
|
+
import { useRouter, useSearchParams, usePathname } from "next/navigation";
|
|
25
|
+
import { FieldList } from "./FieldList";
|
|
26
|
+
import { GraphQL } from "./GraphQL";
|
|
27
|
+
import { ComponentTree } from "./ComponentTree";
|
|
28
|
+
import { ComponentInfo } from "./ComponentInfo";
|
|
29
|
+
import { LanguageSelector } from "./LanguageSelector";
|
|
30
|
+
import { findComponent } from "./componentTreeHelper";
|
|
31
|
+
import { ComponentPalette } from "./ComponentPalette";
|
|
32
|
+
import { DictionaryEditor } from "./DictionaryEditor";
|
|
33
|
+
import { AiTerminal } from "./AiTerminal";
|
|
34
|
+
import { EditHistory } from "./EditHistory";
|
|
35
|
+
import { Debug } from "./Debug";
|
|
36
|
+
import { PageInfo } from "./PageInfo";
|
|
37
|
+
import { VersionSelector } from "./VersionSelector";
|
|
38
|
+
import { commitChanges, currentOperation, executeRedo, executeUndo, executeEditOperation, setCurrentOperation, } from "./editService";
|
|
39
|
+
import "../../editor.css";
|
|
40
|
+
import "../../primereact/resources/primereact.min.css";
|
|
41
|
+
import "../../primeicons/primeicons.css";
|
|
42
|
+
import "../../primereact/resources/themes/lara-light-indigo/theme.css";
|
|
43
|
+
// Hook
|
|
44
|
+
function useEventListener(eventName, handler, element) {
|
|
45
|
+
// Create a ref that stores handler
|
|
46
|
+
const savedHandler = useRef();
|
|
47
|
+
// Update ref.current value if handler changes.
|
|
48
|
+
// This allows our effect below to always get latest handler ...
|
|
49
|
+
// ... without us needing to pass it in effect deps array ...
|
|
50
|
+
// ... and potentially cause effect to re-run every render.
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
savedHandler.current = handler;
|
|
53
|
+
}, [handler]);
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
// Make sure element supports addEventListener
|
|
56
|
+
// On
|
|
57
|
+
const isSupported = element && element.addEventListener;
|
|
58
|
+
if (!isSupported)
|
|
59
|
+
return;
|
|
60
|
+
// Create event listener that calls handler function stored in ref
|
|
61
|
+
const eventListener = (event) => savedHandler.current(event);
|
|
62
|
+
// Add event listener
|
|
63
|
+
element.addEventListener(eventName, eventListener);
|
|
64
|
+
// Remove event listener on cleanup
|
|
65
|
+
return () => {
|
|
66
|
+
element.removeEventListener(eventName, eventListener);
|
|
67
|
+
};
|
|
68
|
+
}, [eventName, element] // Re-run if eventName or element changes
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
export function EditorClient({ content, dictionaryObject, edit, children, }) {
|
|
72
|
+
const router = useRouter();
|
|
73
|
+
const pathname = usePathname();
|
|
74
|
+
const searchParams = useSearchParams();
|
|
75
|
+
const [selection, setSelection] = useState([]);
|
|
76
|
+
const [selectedForInsertion, setSelectedForInsertion] = useState("");
|
|
77
|
+
const [currentEditOperation, setCurrentEditOperation] = useState();
|
|
78
|
+
const [dictionary, setDictionary] = useState(dictionaryObject);
|
|
79
|
+
const [unresolvedDictionaryKeys, setUnresolvedDictionaryKeys] = useState([]);
|
|
80
|
+
const [editData, setEditData] = useState(edit);
|
|
81
|
+
const [refreshCompletedFlag, setRefreshCompletedFlag] = useState(false);
|
|
82
|
+
const [updateContentEditingFields, setUpdateContentEditingFields] = useState(false);
|
|
83
|
+
const [page, setPageData] = useState(null);
|
|
84
|
+
const [uiBlocked, setUiBlocked] = useState(false);
|
|
85
|
+
const [componentsPaletteVisible, setComponentsPaletteVisible] = useState(false);
|
|
86
|
+
const [dragObject, setDragObject] = useState();
|
|
87
|
+
const [hidePalette, setHidePalette] = useState(false);
|
|
88
|
+
const [refreshTimer, setRefreshTimer] = useState();
|
|
89
|
+
const sessionId = searchParams.get("session");
|
|
90
|
+
if (!sessionId)
|
|
91
|
+
return;
|
|
92
|
+
function switchLanguage(language) {
|
|
93
|
+
const current = new URLSearchParams(Array.from(searchParams.entries()));
|
|
94
|
+
current.set("language", language);
|
|
95
|
+
const newUrl = `${pathname}?${current.toString()}`;
|
|
96
|
+
router.replace(newUrl, { scroll: false });
|
|
97
|
+
}
|
|
98
|
+
function switchVersion(version) {
|
|
99
|
+
const current = new URLSearchParams(Array.from(searchParams.entries()));
|
|
100
|
+
current.set("version", version.toString());
|
|
101
|
+
const newUrl = `${pathname}?${current.toString()}`;
|
|
102
|
+
router.replace(newUrl, { scroll: false });
|
|
103
|
+
}
|
|
104
|
+
function handleErrorResult(result) {
|
|
105
|
+
if (result.type === "error") {
|
|
106
|
+
showErrorToast(result);
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
if (result.type === "unauthenticated") {
|
|
110
|
+
confirmDialog({
|
|
111
|
+
header: "Not logged in",
|
|
112
|
+
message: "You are not logged in anymore. Proceed to login page?",
|
|
113
|
+
accept: () => {
|
|
114
|
+
window.location.href = edit.loginUrl;
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
showErrorToast(result);
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (selection.length)
|
|
123
|
+
setSelectedForInsertion("");
|
|
124
|
+
}, [selection]);
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
const sync = () => __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
if (currentEditOperation) {
|
|
128
|
+
const result = yield executeEditOperation(currentEditOperation, sessionId);
|
|
129
|
+
if (handleErrorResult(result))
|
|
130
|
+
return;
|
|
131
|
+
if ((result.id && edit.operations.length == 0) ||
|
|
132
|
+
edit.operations[edit.operations.length - 1].id !=
|
|
133
|
+
result.id) {
|
|
134
|
+
edit.operations = edit.operations.filter((x) => !x.undone);
|
|
135
|
+
edit.operations.push(result);
|
|
136
|
+
setEditData(Object.assign({}, edit));
|
|
137
|
+
}
|
|
138
|
+
if (result.type === "add-component" ||
|
|
139
|
+
result.type === "link-component") {
|
|
140
|
+
console.log("CURRENT: " + JSON.stringify(result));
|
|
141
|
+
setSelection([result.componentId]);
|
|
142
|
+
}
|
|
143
|
+
if (!currentEditOperation.noRefresh)
|
|
144
|
+
requestRefresh(currentEditOperation.refreshAfterQuietPeriod);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
sync();
|
|
148
|
+
}, [currentEditOperation]);
|
|
149
|
+
const requestRefresh = (waitForQuietPeriod) => {
|
|
150
|
+
console.log("request refresh with " + waitForQuietPeriod);
|
|
151
|
+
if (waitForQuietPeriod && refreshTimer) {
|
|
152
|
+
clearTimeout(refreshTimer);
|
|
153
|
+
}
|
|
154
|
+
if (!refreshTimer || waitForQuietPeriod) {
|
|
155
|
+
setRefreshTimer(setTimeout(() => {
|
|
156
|
+
console.log("refreshing");
|
|
157
|
+
router.refresh();
|
|
158
|
+
setRefreshCompletedFlag(!refreshCompletedFlag);
|
|
159
|
+
setRefreshTimer(undefined);
|
|
160
|
+
}, waitForQuietPeriod ? 2000 : 1000));
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const saveAndRefresh = (callback) => __awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
if (!edit.operations.length) {
|
|
165
|
+
if (callback)
|
|
166
|
+
callback();
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
setUiBlocked(true);
|
|
170
|
+
if (!(yield commitChanges(sessionId))) {
|
|
171
|
+
setUiBlocked(false);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
router.refresh();
|
|
175
|
+
//setEditOperations([]);
|
|
176
|
+
setUiBlocked(false);
|
|
177
|
+
toast.current.show({
|
|
178
|
+
severity: "success",
|
|
179
|
+
summary: "Saved",
|
|
180
|
+
detail: "Your changes were saved successfully.",
|
|
181
|
+
life: 3000,
|
|
182
|
+
});
|
|
183
|
+
if (callback)
|
|
184
|
+
callback();
|
|
185
|
+
});
|
|
186
|
+
// function ensureSaved(callback: () => void) {
|
|
187
|
+
// if (!edit.operations.length) {
|
|
188
|
+
// callback();
|
|
189
|
+
// return;
|
|
190
|
+
// }
|
|
191
|
+
// confirmDialog({
|
|
192
|
+
// message: "Save changes?",
|
|
193
|
+
// header: "Save changes?",
|
|
194
|
+
// icon: "pi pi-exclamation-triangle",
|
|
195
|
+
// accept: () => saveAndRefresh(callback),
|
|
196
|
+
// reject: callback,
|
|
197
|
+
// });
|
|
198
|
+
// }
|
|
199
|
+
function handleKeyDown(event) {
|
|
200
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
201
|
+
if (event.ctrlKey && event.key === "s") {
|
|
202
|
+
event.preventDefault();
|
|
203
|
+
yield saveAndRefresh();
|
|
204
|
+
}
|
|
205
|
+
if (event.ctrlKey && event.key === "z") {
|
|
206
|
+
event.preventDefault();
|
|
207
|
+
yield undo();
|
|
208
|
+
}
|
|
209
|
+
if (event.ctrlKey && event.key === "y") {
|
|
210
|
+
event.preventDefault();
|
|
211
|
+
yield redo();
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
if (typeof window !== "undefined")
|
|
216
|
+
useEventListener("keydown", handleKeyDown, window);
|
|
217
|
+
const toast = useRef();
|
|
218
|
+
useEffect(() => {
|
|
219
|
+
setPageData(content);
|
|
220
|
+
}, [content]);
|
|
221
|
+
useEffect(() => {
|
|
222
|
+
setEditData(edit);
|
|
223
|
+
}, [edit]);
|
|
224
|
+
function getComponentById(id) {
|
|
225
|
+
if (!page)
|
|
226
|
+
return null;
|
|
227
|
+
return findComponent(id, page.placeholders);
|
|
228
|
+
}
|
|
229
|
+
function redo() {
|
|
230
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
231
|
+
setUpdateContentEditingFields(!updateContentEditingFields);
|
|
232
|
+
let result = yield executeRedo(sessionId);
|
|
233
|
+
if (result.type === "success") {
|
|
234
|
+
router.refresh();
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
showErrorToast(result);
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function showErrorToast(result) {
|
|
244
|
+
toast.current.show({
|
|
245
|
+
severity: "error",
|
|
246
|
+
summary: result.summary,
|
|
247
|
+
detail: result.details,
|
|
248
|
+
life: 3000,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function undo() {
|
|
252
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
253
|
+
setUpdateContentEditingFields(!updateContentEditingFields);
|
|
254
|
+
let result = yield executeUndo(sessionId);
|
|
255
|
+
if (result.type === "success") {
|
|
256
|
+
router.refresh();
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
showErrorToast(result);
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
const selectedComponent = selection.length === 1 && page ? getComponentById(selection[0]) : null;
|
|
266
|
+
const editField = (field, value, noRefresh = true) => {
|
|
267
|
+
var _a;
|
|
268
|
+
if (!page)
|
|
269
|
+
return;
|
|
270
|
+
const component = findComponent(field.itemId, page.placeholders);
|
|
271
|
+
let op = currentOperation;
|
|
272
|
+
if (!op ||
|
|
273
|
+
op.type !== "edit-field" ||
|
|
274
|
+
op.itemId !== field.itemId ||
|
|
275
|
+
op.fieldId !== field.id ||
|
|
276
|
+
op.language !== field.language ||
|
|
277
|
+
op.version !== field.version) {
|
|
278
|
+
op = {
|
|
279
|
+
type: "edit-field",
|
|
280
|
+
itemId: field.itemId,
|
|
281
|
+
fieldId: field.id,
|
|
282
|
+
version: field.version,
|
|
283
|
+
language: field.language,
|
|
284
|
+
fieldName: field.name,
|
|
285
|
+
itemName: field.itemId == page.id ? "Page" : (_a = component === null || component === void 0 ? void 0 : component.name) !== null && _a !== void 0 ? _a : "<unknown>",
|
|
286
|
+
pageItemId: page.id,
|
|
287
|
+
pageItemLanguage: page.language,
|
|
288
|
+
pageItemVersion: page.version,
|
|
289
|
+
date: new Date(),
|
|
290
|
+
id: uuid(),
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
op.date = new Date();
|
|
294
|
+
op.noRefresh = noRefresh;
|
|
295
|
+
op.refreshAfterQuietPeriod = !noRefresh;
|
|
296
|
+
op.value = value;
|
|
297
|
+
function getField(fields, id) {
|
|
298
|
+
return Object.values(fields).find((f) => f.id === id);
|
|
299
|
+
}
|
|
300
|
+
if (component) {
|
|
301
|
+
const f = getField(component.fields, field.id);
|
|
302
|
+
if (f && f.value != value) {
|
|
303
|
+
f.value = value;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
const f = getField(page.fields, field.id);
|
|
308
|
+
if (f && f.value != value)
|
|
309
|
+
f.value = value;
|
|
310
|
+
}
|
|
311
|
+
setCurrentOperation(op);
|
|
312
|
+
setCurrentEditOperation(Object.assign({}, op));
|
|
313
|
+
};
|
|
314
|
+
const menuItems = [
|
|
315
|
+
{
|
|
316
|
+
label: "Save",
|
|
317
|
+
icon: "pi pi-fw pi-save text-red",
|
|
318
|
+
command: () => saveAndRefresh(),
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
label: "Insert",
|
|
322
|
+
icon: "pi pi-fw pi-sitemap",
|
|
323
|
+
command: () => setComponentsPaletteVisible(true),
|
|
324
|
+
},
|
|
325
|
+
];
|
|
326
|
+
const spinner = _jsx(ProgressSpinner, {});
|
|
327
|
+
const endContent = (_jsxs(_Fragment, { children: [_jsx(LanguageSelector, { page: page, onLanguageSelected: (language) => {
|
|
328
|
+
if (!language)
|
|
329
|
+
return;
|
|
330
|
+
//ensureSaved(() => switchLanguage(language));
|
|
331
|
+
switchLanguage(language);
|
|
332
|
+
} }), _jsx(VersionSelector, { page: page, onVersionSelected: (version) => {
|
|
333
|
+
switchVersion(version);
|
|
334
|
+
} })] }));
|
|
335
|
+
return (_jsxs(EditContextProvider, { value: {
|
|
336
|
+
sessionId: sessionId,
|
|
337
|
+
selection,
|
|
338
|
+
setSelection,
|
|
339
|
+
selectedForInsertion,
|
|
340
|
+
setSelectedForInsertion,
|
|
341
|
+
editField,
|
|
342
|
+
getComponentById,
|
|
343
|
+
dragObject,
|
|
344
|
+
dictionary,
|
|
345
|
+
setDictionary,
|
|
346
|
+
refreshCompletedFlag,
|
|
347
|
+
unresolvedDictionaryKeys,
|
|
348
|
+
setUnresolvedDictionaryKeys,
|
|
349
|
+
updateContentEditingFields,
|
|
350
|
+
showToast: () => { },
|
|
351
|
+
removeComponent: (componentId, callback) => {
|
|
352
|
+
confirmDialog({
|
|
353
|
+
message: "Are you sure you want to remove this component?",
|
|
354
|
+
header: "Remove component",
|
|
355
|
+
icon: "pi pi-exclamation-triangle",
|
|
356
|
+
accept: () => {
|
|
357
|
+
var _a;
|
|
358
|
+
const op = {
|
|
359
|
+
type: "remove-component",
|
|
360
|
+
date: new Date(),
|
|
361
|
+
id: uuid(),
|
|
362
|
+
pageItemId: page.id,
|
|
363
|
+
pageItemLanguage: page.language,
|
|
364
|
+
pageItemVersion: page.version,
|
|
365
|
+
componentId,
|
|
366
|
+
componentName: (_a = getComponentById(componentId)) === null || _a === void 0 ? void 0 : _a.name,
|
|
367
|
+
};
|
|
368
|
+
setCurrentEditOperation(op);
|
|
369
|
+
callback(true);
|
|
370
|
+
},
|
|
371
|
+
});
|
|
372
|
+
},
|
|
373
|
+
openComponentPalette: () => setComponentsPaletteVisible(true),
|
|
374
|
+
dragStart: (dragObject) => {
|
|
375
|
+
console.log("dragging " + JSON.stringify(dragObject));
|
|
376
|
+
setDragObject(dragObject);
|
|
377
|
+
},
|
|
378
|
+
droppedInPlaceholder: (placeholderKey, index) => __awaiter(this, void 0, void 0, function* () {
|
|
379
|
+
if (!dragObject)
|
|
380
|
+
return;
|
|
381
|
+
console.log(dragObject.templateId +
|
|
382
|
+
" dropped in " +
|
|
383
|
+
placeholderKey +
|
|
384
|
+
" " +
|
|
385
|
+
index);
|
|
386
|
+
// console.log(JSON.stringify(page));
|
|
387
|
+
const placeholderKeyComponents = placeholderKey.split("_");
|
|
388
|
+
const parentId = placeholderKeyComponents.length === 1
|
|
389
|
+
? null
|
|
390
|
+
: placeholderKeyComponents[0];
|
|
391
|
+
const placeholderName = placeholderKeyComponents.length === 1
|
|
392
|
+
? placeholderKeyComponents[0]
|
|
393
|
+
: placeholderKeyComponents[1];
|
|
394
|
+
let op;
|
|
395
|
+
if (dragObject.type == "template") {
|
|
396
|
+
op = {
|
|
397
|
+
type: "add-component",
|
|
398
|
+
pageItemId: page.id,
|
|
399
|
+
pageItemLanguage: page.language,
|
|
400
|
+
pageItemVersion: page.version,
|
|
401
|
+
parentItemId: parentId,
|
|
402
|
+
placeholderName: placeholderName,
|
|
403
|
+
placeholderIndex: index,
|
|
404
|
+
templateId: dragObject === null || dragObject === void 0 ? void 0 : dragObject.templateId,
|
|
405
|
+
date: new Date(),
|
|
406
|
+
id: uuid(),
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
if (dragObject.type == "component" ||
|
|
410
|
+
(dragObject.type == "link-component" && dragObject.componentId)) {
|
|
411
|
+
op = {
|
|
412
|
+
type: dragObject.type == "link-component"
|
|
413
|
+
? "link-component"
|
|
414
|
+
: "move-component",
|
|
415
|
+
pageItemId: page.id,
|
|
416
|
+
pageItemLanguage: page.language,
|
|
417
|
+
pageItemVersion: page.version,
|
|
418
|
+
parentItemId: parentId,
|
|
419
|
+
placeholderName: placeholderName,
|
|
420
|
+
placeholderIndex: index,
|
|
421
|
+
componentId: dragObject.componentId,
|
|
422
|
+
date: new Date(),
|
|
423
|
+
id: uuid(),
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
//const newOps = [...editOperations, op];
|
|
427
|
+
//setEditOperations();
|
|
428
|
+
// await sendEditOperationsToServer(newOps as EditOperation[]);
|
|
429
|
+
// router.refresh();
|
|
430
|
+
//setEditOperations(newOps);
|
|
431
|
+
if (op)
|
|
432
|
+
setCurrentEditOperation(op);
|
|
433
|
+
setDragObject(undefined);
|
|
434
|
+
}),
|
|
435
|
+
}, children: [_jsx(Toast, { ref: toast }), _jsxs(PrimeReactProvider, { children: [_jsx(ConfirmDialog, {}), _jsx(Sidebar, { style: { width: "40%" }, visible: componentsPaletteVisible, position: "right", onHide: () => setComponentsPaletteVisible(false), pt: {
|
|
436
|
+
mask: {
|
|
437
|
+
onDragOver: () => setHidePalette(true),
|
|
438
|
+
style: {
|
|
439
|
+
left: hidePalette || !componentsPaletteVisible ? "100vw" : 0,
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
}, children: page && (_jsx(ComponentPalette, { page: page, selection: selection, dragStart: (dragObject) => {
|
|
443
|
+
//console.log("dragging " + JSON.stringify(dragObject));
|
|
444
|
+
setDragObject(dragObject);
|
|
445
|
+
}, dragEnd: () => {
|
|
446
|
+
setDragObject(undefined);
|
|
447
|
+
if (hidePalette) {
|
|
448
|
+
setComponentsPaletteVisible(false);
|
|
449
|
+
setHidePalette(false);
|
|
450
|
+
}
|
|
451
|
+
setSelectedForInsertion("");
|
|
452
|
+
} })) }), _jsxs(BlockUI, { blocked: uiBlocked, template: spinner, children: [_jsx(Menubar, { model: menuItems, end: endContent }), _jsxs(Splitter, { children: [_jsx(SplitterPanel, { size: 25, className: "alpaca-overflow-scroll", children: _jsxs(Splitter, { layout: "vertical", children: [_jsx(SplitterPanel, { className: "a-overflow-hidden a-relative", children: _jsx("div", { className: "a-inset-0 a-absolute a-overflow-y-auto", children: _jsx(ComponentTree, { page: page, selection: selection }) }) }), _jsx(SplitterPanel, { className: "alpaca-editor-tabs", children: _jsxs(TabView, { className: "a-inset-0 a-absolute", scrollable: true, children: [selectedComponent && (_jsxs(TabPanel, { header: "Fields", children: [_jsx(ComponentInfo, { component: selectedComponent }), _jsx(FieldList, { fields: selectedComponent.fields })] })), selectedComponent && (_jsx(TabPanel, { header: "GraphQL", style: { height: "100%" }, children: _jsx(GraphQL, { component: selectedComponent }) })), _jsxs(TabPanel, { header: "Page", children: [page && _jsx(PageInfo, { page: page }), page && _jsx(FieldList, { fields: page.fields })] }), _jsx(TabPanel, { header: "Dictionary", children: _jsx(DictionaryEditor, { dictionary: dictionary }) }), _jsx(TabPanel, { header: "Debug", children: _jsx(Debug, { component: selectedComponent, page: page }) })] }) })] }) }), _jsx(SplitterPanel, { size: 55, className: "alpaca-overflow-scroll alpaca-editor-content", children: _jsx("div", { onDragEndCapture: () => setDragObject(undefined), className: "alpaca-editor-container", children: children }) }), _jsx(SplitterPanel, { size: 20, children: _jsxs(Splitter, { layout: "vertical", className: "alpaca-editor", children: [_jsx(SplitterPanel, { className: "overflow-hidden a-relative", children: _jsx(EditHistory, { operations: editData === null || editData === void 0 ? void 0 : editData.operations }) }), _jsx(SplitterPanel, { className: "overflow-hidden a-relative", children: _jsx(AiTerminal, { selection: selection, requestRefresh: requestRefresh }) })] }) })] })] })] })] }));
|
|
453
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import dynamic from "next/dynamic";
|
|
4
|
+
const EditorClient = dynamic(() => import("./EditorClient").then((dnd) => dnd.EditorClient), { ssr: false });
|
|
5
|
+
export function EditorClientHost({ content, dictionaryObject, children, edit, }) {
|
|
6
|
+
return (_jsx(EditorClient, { content: content, dictionaryObject: dictionaryObject, edit: edit, children: children }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { InputText } from "primereact/inputtext";
|
|
4
|
+
import { Checkbox } from "primereact/checkbox";
|
|
5
|
+
import { SingleLineText } from "./fieldTypes/SingleLineText";
|
|
6
|
+
import { RichTextEditor } from "./fieldTypes/RichTextEditor";
|
|
7
|
+
export function FieldList({ fields }) {
|
|
8
|
+
if (!fields)
|
|
9
|
+
return;
|
|
10
|
+
if (!Array.isArray(fields))
|
|
11
|
+
fields = Object.values(fields);
|
|
12
|
+
const sections = fields.reduce((acc, value) => {
|
|
13
|
+
// Group initialization
|
|
14
|
+
if (!acc[value.section || "Default"]) {
|
|
15
|
+
acc[value.section || "Default"] = [];
|
|
16
|
+
}
|
|
17
|
+
// Grouping
|
|
18
|
+
acc[value.section || "Default"].push(value);
|
|
19
|
+
return acc;
|
|
20
|
+
}, {});
|
|
21
|
+
const sectionList = Object.values(sections);
|
|
22
|
+
sectionList.sort((a, b) => b[0].sortOrder - a[0].sortOrder);
|
|
23
|
+
return (_jsx("div", { className: "a-p-1", children: Object.keys(sections).map((section) => (_jsxs("div", { children: [_jsx("div", { className: "alpaca-fields-section-headline", children: section }), getSectionFields(sections[section])] }, section))) }));
|
|
24
|
+
}
|
|
25
|
+
function getSectionFields(fields) {
|
|
26
|
+
return fields.map((field) => (_jsxs("div", { children: [_jsx("label", { className: "alpaca-field-label", children: field.name }), !field.containsFallbackValue ? (_jsx("button", { className: "a-text-xs a-p-0 a-m-1", children: "Reset " })) : (_jsx("button", { children: "Fallback" })), _jsx("div", { children: getFieldEditor(field) })] }, field.id)));
|
|
27
|
+
}
|
|
28
|
+
function getFieldEditor(field) {
|
|
29
|
+
switch (field.type) {
|
|
30
|
+
case "checkbox":
|
|
31
|
+
return checkbox(field);
|
|
32
|
+
case "picture":
|
|
33
|
+
return picture(field);
|
|
34
|
+
case "image":
|
|
35
|
+
return image(field);
|
|
36
|
+
case "rich text":
|
|
37
|
+
return _jsx(RichTextEditor, { field: field });
|
|
38
|
+
default:
|
|
39
|
+
return _jsx(SingleLineText, { field: field });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function checkbox(field) {
|
|
43
|
+
return _jsx(Checkbox, { checked: field.value === "1" });
|
|
44
|
+
}
|
|
45
|
+
// function singleLineText(field: Field) {
|
|
46
|
+
// return <InputText value={field.value as string} />;
|
|
47
|
+
// }
|
|
48
|
+
function picture(field) {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
return (_jsxs(_Fragment, { children: [_jsx("label", { className: "alpaca-minor-label", children: "Alt" }), _jsx(InputText, { value: (_b = (_a = field.value) === null || _a === void 0 ? void 0 : _a.alt) !== null && _b !== void 0 ? _b : "" })] }));
|
|
51
|
+
}
|
|
52
|
+
function image(field) {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
return (_jsxs(_Fragment, { children: [_jsx("label", { className: "alpaca-minor-label", children: "Alt" }), _jsx(InputText, { value: (_b = (_a = field.value) === null || _a === void 0 ? void 0 : _a.altText) !== null && _b !== void 0 ? _b : "" })] }));
|
|
55
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEditContext } from "..";
|
|
3
|
+
import JSONPretty from "react-json-pretty";
|
|
4
|
+
import "react-json-pretty/themes/monikai.css";
|
|
5
|
+
import { TabView, TabPanel } from "primereact/tabview";
|
|
6
|
+
import { FieldList } from "./FieldList";
|
|
7
|
+
import { Splitter, SplitterPanel } from "primereact/splitter";
|
|
8
|
+
import { InputTextarea } from "primereact/inputtextarea";
|
|
9
|
+
import { Button } from "primereact/button";
|
|
10
|
+
import { useEffect, useState } from "react";
|
|
11
|
+
import { format } from "graphql-formatter";
|
|
12
|
+
export function GraphQL({ component }) {
|
|
13
|
+
const editContext = useEditContext();
|
|
14
|
+
const [query, setQuery] = useState("");
|
|
15
|
+
const [showSpinner, setShowSpinner] = useState(false);
|
|
16
|
+
if (!component)
|
|
17
|
+
return;
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
setQuery(component.graphql_query);
|
|
20
|
+
}, [component.graphql_query]);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
setShowSpinner(false);
|
|
23
|
+
}, [editContext === null || editContext === void 0 ? void 0 : editContext.refreshCompletedFlag]);
|
|
24
|
+
function findFields(json) {
|
|
25
|
+
let result = {};
|
|
26
|
+
for (let key in json) {
|
|
27
|
+
if (typeof json[key] === "object" && json[key] !== null) {
|
|
28
|
+
let subResult = findFields(json[key]);
|
|
29
|
+
for (let subKey in subResult) {
|
|
30
|
+
if (result[subKey]) {
|
|
31
|
+
result[subKey] = result[subKey].concat(subResult[subKey]);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
result[subKey] = subResult[subKey];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (key === "jsonValue") {
|
|
39
|
+
let groupKey = `${json[key].itemId}_${json[key].language}_${json[key].version}`;
|
|
40
|
+
if (result[groupKey]) {
|
|
41
|
+
result[groupKey].push(json[key]);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
result[groupKey] = [json[key]];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
const fieldsjsonValues = findFields(component.graphql);
|
|
51
|
+
function renderItem(fields) {
|
|
52
|
+
const first = fields[0];
|
|
53
|
+
return (_jsxs("div", { children: ["Item: ", first.path, " ", first.id, " ", first.language, " ", first.version, _jsx(FieldList, { fields: fields })] }, first.path + first.id + first.language + first.version));
|
|
54
|
+
}
|
|
55
|
+
function refresh() {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
if (!component)
|
|
58
|
+
return;
|
|
59
|
+
let language = ((_a = component.hostingPageItem) === null || _a === void 0 ? void 0 : _a.language) || "en";
|
|
60
|
+
let version = ((_b = component.hostingPageItem) === null || _b === void 0 ? void 0 : _b.version) || 0;
|
|
61
|
+
if (component.linkedComponentItem) {
|
|
62
|
+
language = component.linkedComponentItem.language;
|
|
63
|
+
version = component.linkedComponentItem.version;
|
|
64
|
+
}
|
|
65
|
+
const field = {
|
|
66
|
+
name: "_GraphQL",
|
|
67
|
+
itemId: component === null || component === void 0 ? void 0 : component.id,
|
|
68
|
+
language: language,
|
|
69
|
+
version: version,
|
|
70
|
+
path: "graphql",
|
|
71
|
+
id: "3622F861-ECA9-45D7-8DA7-2CDA35235002",
|
|
72
|
+
value: query,
|
|
73
|
+
type: "jsonValue",
|
|
74
|
+
};
|
|
75
|
+
const prettyQuery = format(query);
|
|
76
|
+
console.log(query);
|
|
77
|
+
console.log(prettyQuery);
|
|
78
|
+
setQuery(prettyQuery);
|
|
79
|
+
editContext === null || editContext === void 0 ? void 0 : editContext.editField(field, prettyQuery, false);
|
|
80
|
+
setShowSpinner(true);
|
|
81
|
+
}
|
|
82
|
+
return (_jsxs(Splitter, { layout: "vertical", style: { height: "100%" }, children: [_jsx(SplitterPanel, { size: 50, className: "a-relative", children: _jsxs("div", { className: "a-absolute a-inset-0 a-flex", children: [_jsx(InputTextarea, { value: query, onChange: (e) => setQuery(e.target.value), className: "a-flex-1", style: { height: "100%" } }), _jsx(Button, { icon: "pi pi-refresh" + (showSpinner ? " pi-spin" : ""), onClick: refresh, disabled: showSpinner })] }) }), _jsx(SplitterPanel, { className: "alpaca-editor-tabs", children: _jsxs(TabView, { className: "a-inset-0 absolute", children: [_jsx(TabPanel, { header: "Data", style: { height: "100%" }, className: "a-relative", children: _jsx("div", { className: "a-m-1", children: Object.values(fieldsjsonValues).map((x) => renderItem(x)) }) }), _jsx(TabPanel, { header: "JSON", className: "a-relative", style: { height: "100%" }, children: _jsx("div", { className: "a-inset-0 a-absolute a-overflow-y-auto", children: _jsx(JSONPretty, { data: component.graphql }) }) })] }) })] }));
|
|
83
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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({ page, onLanguageSelected, }) {
|
|
5
|
+
if (page == null)
|
|
6
|
+
return;
|
|
7
|
+
const selectedCountryTemplate = (option, props) => {
|
|
8
|
+
if (option) {
|
|
9
|
+
return _jsx("div", { children: option.name });
|
|
10
|
+
}
|
|
11
|
+
return _jsx("span", { children: props.placeholder });
|
|
12
|
+
};
|
|
13
|
+
const countryOptionTemplate = (option) => {
|
|
14
|
+
return (_jsxs("div", { children: [option.name, " (", option.versions, ")"] }));
|
|
15
|
+
};
|
|
16
|
+
return (_jsx(_Fragment, { children: _jsx(Dropdown, { value: page.language, onChange: (e) => onLanguageSelected(e.value), options: page.languages, optionValue: "languageCode", optionLabel: "name", placeholder: "Select a language", filter: true, valueTemplate: selectedCountryTemplate, itemTemplate: countryOptionTemplate }) }));
|
|
17
|
+
}
|