@blokkli/editor 1.0.0
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/LICENSE +21 -0
- package/README.md +64 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +129 -0
- package/dist/module.d.ts +129 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +5430 -0
- package/dist/runtime/adapter/drupal/graphql/base.graphql +906 -0
- package/dist/runtime/adapter/drupal/graphql/comments.graphql +56 -0
- package/dist/runtime/adapter/drupal/graphql/fragments.graphql +25 -0
- package/dist/runtime/adapter/drupal/graphql/library.graphql +66 -0
- package/dist/runtime/adapter/drupal/graphql/search.graphql +19 -0
- package/dist/runtime/adapter/drupal/graphql/transform.graphql +27 -0
- package/dist/runtime/adapter/drupal/graphqlMiddleware.d.ts +2 -0
- package/dist/runtime/adapter/drupal/graphqlMiddleware.js +643 -0
- package/dist/runtime/adapter/index.d.ts +352 -0
- package/dist/runtime/adapter/index.js +3 -0
- package/dist/runtime/blokkliPlugins/AddAction/index.vue +87 -0
- package/dist/runtime/blokkliPlugins/ContextMenu/Menu/index.vue +95 -0
- package/dist/runtime/blokkliPlugins/ContextMenu/index.vue +49 -0
- package/dist/runtime/blokkliPlugins/DebugOverlay/index.vue +34 -0
- package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +73 -0
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue +132 -0
- package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue +42 -0
- package/dist/runtime/blokkliPlugins/MenuButton/index.vue +74 -0
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +334 -0
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue +286 -0
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue +104 -0
- package/dist/runtime/blokkliPlugins/TourItem/index.vue +45 -0
- package/dist/runtime/blokkliPlugins/ViewOption/index.vue +106 -0
- package/dist/runtime/blokkliPlugins/index.d.ts +12 -0
- package/dist/runtime/blokkliPlugins/index.js +24 -0
- package/dist/runtime/components/Blocks/Fragment/icon.svg +1 -0
- package/dist/runtime/components/Blocks/Fragment/index.vue +24 -0
- package/dist/runtime/components/Blocks/FromLibrary/index.vue +58 -0
- package/dist/runtime/components/BlokkliEditable.vue +73 -0
- package/dist/runtime/components/BlokkliField.vue +157 -0
- package/dist/runtime/components/BlokkliItem.vue +79 -0
- package/dist/runtime/components/BlokkliProvider.vue +160 -0
- package/dist/runtime/components/Edit/Actions/index.vue +263 -0
- package/dist/runtime/components/Edit/AddListItem/index.vue +116 -0
- package/dist/runtime/components/Edit/AnimationCanvas/index.vue +122 -0
- package/dist/runtime/components/Edit/AppMenu/index.vue +60 -0
- package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue +64 -0
- package/dist/runtime/components/Edit/Dialog/index.vue +163 -0
- package/dist/runtime/components/Edit/DragInteractions/index.vue +439 -0
- package/dist/runtime/components/Edit/DraggableList.vue +110 -0
- package/dist/runtime/components/Edit/EditIndicator.vue +82 -0
- package/dist/runtime/components/Edit/EditProvider.vue +213 -0
- package/dist/runtime/components/Edit/Features/AddList/docs.md +4 -0
- package/dist/runtime/components/Edit/Features/AddList/index.vue +205 -0
- package/dist/runtime/components/Edit/Features/Artboard/Manager/Artboard.d.ts +204 -0
- package/dist/runtime/components/Edit/Features/Artboard/Manager/Artboard.js +748 -0
- package/dist/runtime/components/Edit/Features/Artboard/Manager/Scrollbar/index.vue +176 -0
- package/dist/runtime/components/Edit/Features/Artboard/Manager/index.vue +317 -0
- package/dist/runtime/components/Edit/Features/Artboard/index.vue +45 -0
- package/dist/runtime/components/Edit/Features/Assistant/Overlay/ResultMarkup/index.vue +17 -0
- package/dist/runtime/components/Edit/Features/Assistant/Overlay/index.vue +147 -0
- package/dist/runtime/components/Edit/Features/Assistant/docs.md +7 -0
- package/dist/runtime/components/Edit/Features/Assistant/index.vue +68 -0
- package/dist/runtime/components/Edit/Features/BlockAddList/docs.md +15 -0
- package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +440 -0
- package/dist/runtime/components/Edit/Features/Clipboard/List/Item/File.vue +68 -0
- package/dist/runtime/components/Edit/Features/Clipboard/List/Item/Video.vue +56 -0
- package/dist/runtime/components/Edit/Features/Clipboard/List/index.vue +69 -0
- package/dist/runtime/components/Edit/Features/Clipboard/docs.md +16 -0
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue +485 -0
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue +61 -0
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +280 -0
- package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +51 -0
- package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue +32 -0
- package/dist/runtime/components/Edit/Features/Comments/Comment/index.vue +53 -0
- package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue +100 -0
- package/dist/runtime/components/Edit/Features/Comments/Overlay/index.vue +133 -0
- package/dist/runtime/components/Edit/Features/Comments/docs.md +13 -0
- package/dist/runtime/components/Edit/Features/Comments/index.vue +110 -0
- package/dist/runtime/components/Edit/Features/Conversions/index.vue +98 -0
- package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +55 -0
- package/dist/runtime/components/Edit/Features/Debug/Viewport/index.vue +93 -0
- package/dist/runtime/components/Edit/Features/Debug/docs.md +3 -0
- package/dist/runtime/components/Edit/Features/Debug/index.vue +178 -0
- package/dist/runtime/components/Edit/Features/Delete/index.vue +43 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +420 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/fragment.glsl +58 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +808 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/vertex.glsl +57 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +410 -0
- package/dist/runtime/components/Edit/Features/Duplicate/index.vue +109 -0
- package/dist/runtime/components/Edit/Features/Edit/index.vue +63 -0
- package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue +73 -0
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +217 -0
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Contenteditable/index.vue +42 -0
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue +68 -0
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +81 -0
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +357 -0
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +192 -0
- package/dist/runtime/components/Edit/Features/EditableMask/index.vue +64 -0
- package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +108 -0
- package/dist/runtime/components/Edit/Features/Exit/index.vue +38 -0
- package/dist/runtime/components/Edit/Features/FieldAreas/Overlay/index.vue +33 -0
- package/dist/runtime/components/Edit/Features/FieldAreas/index.vue +43 -0
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/Item/index.vue +68 -0
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue +137 -0
- package/dist/runtime/components/Edit/Features/Fragments/docs.md +101 -0
- package/dist/runtime/components/Edit/Features/Fragments/index.vue +86 -0
- package/dist/runtime/components/Edit/Features/Grid/index.vue +40 -0
- package/dist/runtime/components/Edit/Features/Help/Shortcuts/index.vue +71 -0
- package/dist/runtime/components/Edit/Features/Help/index.vue +53 -0
- package/dist/runtime/components/Edit/Features/History/index.vue +263 -0
- package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue +140 -0
- package/dist/runtime/components/Edit/Features/ImportExisting/index.vue +92 -0
- package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +0 -0
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/Item/index.vue +73 -0
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +184 -0
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +88 -0
- package/dist/runtime/components/Edit/Features/Library/docs.md +127 -0
- package/dist/runtime/components/Edit/Features/Library/index.vue +184 -0
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +184 -0
- package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +182 -0
- package/dist/runtime/components/Edit/Features/MediaLibrary/types.d.ts +57 -0
- package/dist/runtime/components/Edit/Features/MediaLibrary/types.js +0 -0
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/fragment.glsl +90 -0
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue +289 -0
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/vertex.glsl +182 -0
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +76 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Checkbox/index.vue +52 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Checkboxes/index.vue +129 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Color/index.vue +38 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Group.vue +25 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +155 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Number/index.vue +74 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Radios/index.vue +135 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Range/index.vue +47 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Text/index.vue +38 -0
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue +342 -0
- package/dist/runtime/components/Edit/Features/Options/index.vue +88 -0
- package/dist/runtime/components/Edit/Features/Ownership/index.vue +57 -0
- package/dist/runtime/components/Edit/Features/Preview/index.vue +45 -0
- package/dist/runtime/components/Edit/Features/PreviewGrant/QrCode/index.vue +30 -0
- package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +73 -0
- package/dist/runtime/components/Edit/Features/Publish/index.vue +50 -0
- package/dist/runtime/components/Edit/Features/ResponsivePreview/Frame/index.vue +81 -0
- package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +217 -0
- package/dist/runtime/components/Edit/Features/Revert/index.vue +68 -0
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +165 -0
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue +211 -0
- package/dist/runtime/components/Edit/Features/Search/Overlay/index.vue +214 -0
- package/dist/runtime/components/Edit/Features/Search/index.vue +79 -0
- package/dist/runtime/components/Edit/Features/Selection/Overlay/fragment.glsl +99 -0
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue +144 -0
- package/dist/runtime/components/Edit/Features/Selection/Overlay/vertex.glsl +85 -0
- package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +50 -0
- package/dist/runtime/components/Edit/Features/Selection/index.vue +295 -0
- package/dist/runtime/components/Edit/Features/Settings/Dialog/FeatureSetting/index.vue +141 -0
- package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue +138 -0
- package/dist/runtime/components/Edit/Features/Settings/index.vue +92 -0
- package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue +181 -0
- package/dist/runtime/components/Edit/Features/Structure/List/Item/index.vue +149 -0
- package/dist/runtime/components/Edit/Features/Structure/List/index.vue +55 -0
- package/dist/runtime/components/Edit/Features/Structure/index.vue +83 -0
- package/dist/runtime/components/Edit/Features/Theme/Color/index.vue +81 -0
- package/dist/runtime/components/Edit/Features/Theme/GeneratedCode/index.vue +24 -0
- package/dist/runtime/components/Edit/Features/Theme/index.vue +122 -0
- package/dist/runtime/components/Edit/Features/TouchActionBar/Bar/index.vue +26 -0
- package/dist/runtime/components/Edit/Features/TouchActionBar/index.vue +42 -0
- package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +270 -0
- package/dist/runtime/components/Edit/Features/Tour/Popup/index.vue +36 -0
- package/dist/runtime/components/Edit/Features/Tour/docs.md +0 -0
- package/dist/runtime/components/Edit/Features/Tour/index.vue +46 -0
- package/dist/runtime/components/Edit/Features/Transform/docs.md +67 -0
- package/dist/runtime/components/Edit/Features/Transform/index.vue +177 -0
- package/dist/runtime/components/Edit/Features/Translations/Banner/index.vue +50 -0
- package/dist/runtime/components/Edit/Features/Translations/index.vue +193 -0
- package/dist/runtime/components/Edit/Features/Validations/Overlay/Item.vue +50 -0
- package/dist/runtime/components/Edit/Features/Validations/Overlay/index.vue +51 -0
- package/dist/runtime/components/Edit/Features/Validations/SidebarItem/index.vue +50 -0
- package/dist/runtime/components/Edit/Features/Validations/index.vue +70 -0
- package/dist/runtime/components/Edit/Features/index.vue +67 -0
- package/dist/runtime/components/Edit/FormOverlay/Header/index.vue +39 -0
- package/dist/runtime/components/Edit/FormOverlay/index.vue +52 -0
- package/dist/runtime/components/Edit/Highlight/index.vue +94 -0
- package/dist/runtime/components/Edit/Icon/index.vue +21 -0
- package/dist/runtime/components/Edit/ItemIcon/index.vue +27 -0
- package/dist/runtime/components/Edit/Loading/index.vue +19 -0
- package/dist/runtime/components/Edit/Messages/Item/index.vue +107 -0
- package/dist/runtime/components/Edit/Messages/index.vue +37 -0
- package/dist/runtime/components/Edit/PreviewProvider.vue +223 -0
- package/dist/runtime/components/Edit/RelativeTime/index.vue +37 -0
- package/dist/runtime/components/Edit/Resizable/index.vue +90 -0
- package/dist/runtime/components/Edit/ScaleToFit/index.vue +57 -0
- package/dist/runtime/components/Edit/ShortcutIndicator/index.vue +90 -0
- package/dist/runtime/components/Edit/Sortli/index.vue +92 -0
- package/dist/runtime/components/Edit/SystemRequirements/index.vue +91 -0
- package/dist/runtime/components/Edit/Toolbar/index.vue +106 -0
- package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue +75 -0
- package/dist/runtime/components/Edit/index.d.ts +14 -0
- package/dist/runtime/components/Edit/index.js +28 -0
- package/dist/runtime/composables/defineBlokkli.d.ts +6 -0
- package/dist/runtime/composables/defineBlokkli.js +108 -0
- package/dist/runtime/composables/defineBlokkliFeature.d.ts +28 -0
- package/dist/runtime/composables/defineBlokkliFeature.js +62 -0
- package/dist/runtime/composables/defineBlokkliFragment.d.ts +3 -0
- package/dist/runtime/composables/defineBlokkliFragment.js +54 -0
- package/dist/runtime/composables/useBlokkli.d.ts +8 -0
- package/dist/runtime/composables/useBlokkli.js +5 -0
- package/dist/runtime/constants/index.d.ts +4 -0
- package/dist/runtime/constants/index.js +2 -0
- package/dist/runtime/css/output.css +1 -0
- package/dist/runtime/helpers/Artboard/index.d.ts +16 -0
- package/dist/runtime/helpers/Artboard/index.js +20 -0
- package/dist/runtime/helpers/DragStyle/index.d.ts +12 -0
- package/dist/runtime/helpers/DragStyle/index.js +86 -0
- package/dist/runtime/helpers/animationProvider.d.ts +25 -0
- package/dist/runtime/helpers/animationProvider.js +116 -0
- package/dist/runtime/helpers/broadcastProvider.d.ts +7 -0
- package/dist/runtime/helpers/broadcastProvider.js +26 -0
- package/dist/runtime/helpers/commandsProvider.d.ts +9 -0
- package/dist/runtime/helpers/commandsProvider.js +16 -0
- package/dist/runtime/helpers/composables/defineCommands.d.ts +2 -0
- package/dist/runtime/helpers/composables/defineCommands.js +10 -0
- package/dist/runtime/helpers/composables/defineDropAreas.d.ts +2 -0
- package/dist/runtime/helpers/composables/defineDropAreas.js +10 -0
- package/dist/runtime/helpers/composables/defineShortcut.d.ts +2 -0
- package/dist/runtime/helpers/composables/defineShortcut.js +19 -0
- package/dist/runtime/helpers/composables/defineTourItem.d.ts +2 -0
- package/dist/runtime/helpers/composables/defineTourItem.js +10 -0
- package/dist/runtime/helpers/composables/onBlokkliEvent.d.ts +2 -0
- package/dist/runtime/helpers/composables/onBlokkliEvent.js +10 -0
- package/dist/runtime/helpers/composables/useAnimationFrame.d.ts +1 -0
- package/dist/runtime/helpers/composables/useAnimationFrame.js +14 -0
- package/dist/runtime/helpers/composables/useDebugLogger.d.ts +2 -0
- package/dist/runtime/helpers/composables/useDebugLogger.js +5 -0
- package/dist/runtime/helpers/composables/useDelayedIntersectionObserver.d.ts +5 -0
- package/dist/runtime/helpers/composables/useDelayedIntersectionObserver.js +26 -0
- package/dist/runtime/helpers/debugProvider.d.ts +23 -0
- package/dist/runtime/helpers/debugProvider.js +65 -0
- package/dist/runtime/helpers/dom/index.d.ts +5 -0
- package/dist/runtime/helpers/dom/index.js +37 -0
- package/dist/runtime/helpers/domProvider.d.ts +46 -0
- package/dist/runtime/helpers/domProvider.js +446 -0
- package/dist/runtime/helpers/dropAreaProvider.d.ts +9 -0
- package/dist/runtime/helpers/dropAreaProvider.js +22 -0
- package/dist/runtime/helpers/easing.d.ts +3 -0
- package/dist/runtime/helpers/easing.js +16 -0
- package/dist/runtime/helpers/eventBus.d.ts +3 -0
- package/dist/runtime/helpers/eventBus.js +5 -0
- package/dist/runtime/helpers/featuresProvider.d.ts +23 -0
- package/dist/runtime/helpers/featuresProvider.js +16 -0
- package/dist/runtime/helpers/frameEventBus.d.ts +9 -0
- package/dist/runtime/helpers/frameEventBus.js +2 -0
- package/dist/runtime/helpers/index.d.ts +87 -0
- package/dist/runtime/helpers/index.js +467 -0
- package/dist/runtime/helpers/keyboardProvider.d.ts +17 -0
- package/dist/runtime/helpers/keyboardProvider.js +79 -0
- package/dist/runtime/helpers/options.d.ts +2 -0
- package/dist/runtime/helpers/options.js +21 -0
- package/dist/runtime/helpers/runtimeHelpers/index.d.ts +10 -0
- package/dist/runtime/helpers/runtimeHelpers/index.js +35 -0
- package/dist/runtime/helpers/selectionProvider.d.ts +62 -0
- package/dist/runtime/helpers/selectionProvider.js +149 -0
- package/dist/runtime/helpers/stateProvider.d.ts +35 -0
- package/dist/runtime/helpers/stateProvider.js +226 -0
- package/dist/runtime/helpers/storageProvider.d.ts +15 -0
- package/dist/runtime/helpers/storageProvider.js +61 -0
- package/dist/runtime/helpers/symbols.d.ts +16 -0
- package/dist/runtime/helpers/symbols.js +18 -0
- package/dist/runtime/helpers/textProvider.d.ts +4 -0
- package/dist/runtime/helpers/textProvider.js +20 -0
- package/dist/runtime/helpers/themeProvider.d.ts +27 -0
- package/dist/runtime/helpers/themeProvider.js +124 -0
- package/dist/runtime/helpers/tourProvider.d.ts +11 -0
- package/dist/runtime/helpers/tourProvider.js +19 -0
- package/dist/runtime/helpers/transform.d.ts +2 -0
- package/dist/runtime/helpers/transform.js +17 -0
- package/dist/runtime/helpers/typesProvider.d.ts +36 -0
- package/dist/runtime/helpers/typesProvider.js +138 -0
- package/dist/runtime/helpers/uiProvider.d.ts +36 -0
- package/dist/runtime/helpers/uiProvider.js +278 -0
- package/dist/runtime/helpers/webgl/index.d.ts +32 -0
- package/dist/runtime/helpers/webgl/index.js +132 -0
- package/dist/runtime/icons/alert.svg +6 -0
- package/dist/runtime/icons/area.svg +5 -0
- package/dist/runtime/icons/arrow-down.svg +1 -0
- package/dist/runtime/icons/arrow-left.svg +1 -0
- package/dist/runtime/icons/arrow-right.svg +1 -0
- package/dist/runtime/icons/arrow-up.svg +1 -0
- package/dist/runtime/icons/artboard-disabled.svg +9 -0
- package/dist/runtime/icons/artboard-enabled.svg +29 -0
- package/dist/runtime/icons/artboard.svg +1 -0
- package/dist/runtime/icons/bug.svg +1 -0
- package/dist/runtime/icons/button-pointer.svg +1 -0
- package/dist/runtime/icons/caret.svg +12 -0
- package/dist/runtime/icons/cellphone.svg +1 -0
- package/dist/runtime/icons/chat-question.svg +1 -0
- package/dist/runtime/icons/check.svg +1 -0
- package/dist/runtime/icons/checkbox.svg +5 -0
- package/dist/runtime/icons/checks.svg +1 -0
- package/dist/runtime/icons/chevron-left.svg +1 -0
- package/dist/runtime/icons/chevron-right.svg +1 -0
- package/dist/runtime/icons/clipboard.svg +5 -0
- package/dist/runtime/icons/close.svg +5 -0
- package/dist/runtime/icons/cog.svg +5 -0
- package/dist/runtime/icons/command.svg +1 -0
- package/dist/runtime/icons/comment.svg +5 -0
- package/dist/runtime/icons/comment_add.svg +5 -0
- package/dist/runtime/icons/convert.svg +1 -0
- package/dist/runtime/icons/cursor-move.svg +1 -0
- package/dist/runtime/icons/dead.svg +1 -0
- package/dist/runtime/icons/delete.svg +8 -0
- package/dist/runtime/icons/detach.svg +7 -0
- package/dist/runtime/icons/drag.svg +1 -0
- package/dist/runtime/icons/duplicate.svg +12 -0
- package/dist/runtime/icons/edit.svg +8 -0
- package/dist/runtime/icons/exit.svg +6 -0
- package/dist/runtime/icons/expand.svg +1 -0
- package/dist/runtime/icons/file.svg +1 -0
- package/dist/runtime/icons/form.svg +1 -0
- package/dist/runtime/icons/fragment.svg +1 -0
- package/dist/runtime/icons/grid.svg +13 -0
- package/dist/runtime/icons/group.svg +5 -0
- package/dist/runtime/icons/help.svg +1 -0
- package/dist/runtime/icons/history.svg +1 -0
- package/dist/runtime/icons/image.svg +1 -0
- package/dist/runtime/icons/import.svg +5 -0
- package/dist/runtime/icons/laptop.svg +1 -0
- package/dist/runtime/icons/list-view-grid.svg +1 -0
- package/dist/runtime/icons/list-view-horizontal.svg +1 -0
- package/dist/runtime/icons/loader.svg +1 -0
- package/dist/runtime/icons/logo.svg +5 -0
- package/dist/runtime/icons/magnifier.svg +5 -0
- package/dist/runtime/icons/menu.svg +1 -0
- package/dist/runtime/icons/minus.svg +1 -0
- package/dist/runtime/icons/monitor.svg +1 -0
- package/dist/runtime/icons/multi-select.svg +1 -0
- package/dist/runtime/icons/multimedia.svg +1 -0
- package/dist/runtime/icons/opacity.svg +5 -0
- package/dist/runtime/icons/open_in_new.svg +3 -0
- package/dist/runtime/icons/palette.svg +1 -0
- package/dist/runtime/icons/plus-box.svg +1 -0
- package/dist/runtime/icons/plus.svg +1 -0
- package/dist/runtime/icons/preview.svg +5 -0
- package/dist/runtime/icons/publish.svg +12 -0
- package/dist/runtime/icons/puzzle.svg +1 -0
- package/dist/runtime/icons/qrcode.svg +5 -0
- package/dist/runtime/icons/question.svg +5 -0
- package/dist/runtime/icons/redo.svg +12 -0
- package/dist/runtime/icons/resize.svg +1 -0
- package/dist/runtime/icons/reusable.svg +5 -0
- package/dist/runtime/icons/revert.svg +5 -0
- package/dist/runtime/icons/robot.svg +1 -0
- package/dist/runtime/icons/rotate-phone.svg +1 -0
- package/dist/runtime/icons/sad.svg +1 -0
- package/dist/runtime/icons/save.svg +1 -0
- package/dist/runtime/icons/script.svg +1 -0
- package/dist/runtime/icons/scrolltotop.svg +6 -0
- package/dist/runtime/icons/search.svg +1 -0
- package/dist/runtime/icons/selection.svg +5 -0
- package/dist/runtime/icons/spinner.svg +15 -0
- package/dist/runtime/icons/star.svg +1 -0
- package/dist/runtime/icons/swap-horizontal.svg +1 -0
- package/dist/runtime/icons/tablet.svg +1 -0
- package/dist/runtime/icons/textbox.svg +1 -0
- package/dist/runtime/icons/texturebox.svg +5 -0
- package/dist/runtime/icons/tiktok.svg +1 -0
- package/dist/runtime/icons/title.svg +1 -0
- package/dist/runtime/icons/tools.svg +1 -0
- package/dist/runtime/icons/translate.svg +5 -0
- package/dist/runtime/icons/tree.svg +5 -0
- package/dist/runtime/icons/tutor.svg +1 -0
- package/dist/runtime/icons/ui-list-horizontal.svg +19 -0
- package/dist/runtime/icons/ui-list-sidebar.svg +21 -0
- package/dist/runtime/icons/ui-list-vertical.svg +9 -0
- package/dist/runtime/icons/undo.svg +12 -0
- package/dist/runtime/icons/unstar.svg +1 -0
- package/dist/runtime/icons/upload.svg +1 -0
- package/dist/runtime/icons/user.svg +1 -0
- package/dist/runtime/icons/video-outline.svg +1 -0
- package/dist/runtime/icons/vimeo.svg +3 -0
- package/dist/runtime/icons/window-maximize.svg +1 -0
- package/dist/runtime/icons/window-minimize.svg +1 -0
- package/dist/runtime/icons/youtube.svg +3 -0
- package/dist/runtime/plugins/blokkliEditable.d.ts +2 -0
- package/dist/runtime/plugins/blokkliEditable.js +31 -0
- package/dist/runtime/public/Inter.var.woff2 +0 -0
- package/dist/runtime/types/blokkOptions.d.ts +83 -0
- package/dist/runtime/types/blokkOptions.js +0 -0
- package/dist/runtime/types/generatedModuleTypes.d.ts +41 -0
- package/dist/runtime/types/generatedModuleTypes.js +0 -0
- package/dist/runtime/types/index.d.ts +1052 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/theme.d.ts +33 -0
- package/dist/runtime/types/theme.js +0 -0
- package/dist/types.d.mts +1 -0
- package/dist/types.d.ts +1 -0
- package/package.json +103 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import onBlokkliEvent from "./composables/onBlokkliEvent.js";
|
|
2
|
+
import { computed, ref } from "#imports";
|
|
3
|
+
import {
|
|
4
|
+
findElement,
|
|
5
|
+
buildDraggableItem,
|
|
6
|
+
falsy,
|
|
7
|
+
modulo,
|
|
8
|
+
onlyUnique
|
|
9
|
+
} from "#blokkli/helpers";
|
|
10
|
+
import { eventBus } from "#blokkli/helpers/eventBus";
|
|
11
|
+
export default function(dom) {
|
|
12
|
+
const selectedUuids = ref([]);
|
|
13
|
+
const activeFieldKey = ref("");
|
|
14
|
+
const draggingMode = ref(null);
|
|
15
|
+
const editableActive = ref(false);
|
|
16
|
+
const isChangingOptions = ref(false);
|
|
17
|
+
const isMultiSelecting = ref(false);
|
|
18
|
+
const interactionMode = ref("mouse");
|
|
19
|
+
const dragItems = ref([]);
|
|
20
|
+
const dragItemsBundles = computed(
|
|
21
|
+
() => dragItems.value.map((v) => v.itemBundle).filter(falsy)
|
|
22
|
+
);
|
|
23
|
+
const uuidsMap = computed(() => {
|
|
24
|
+
return selectedUuids.value.reduce((acc, uuid) => {
|
|
25
|
+
acc[uuid] = true;
|
|
26
|
+
return acc;
|
|
27
|
+
}, {});
|
|
28
|
+
});
|
|
29
|
+
const isDragging = computed(() => !!draggingMode.value);
|
|
30
|
+
const blocks = computed(
|
|
31
|
+
() => selectedUuids.value.map((uuid) => {
|
|
32
|
+
return dom.findBlock(uuid);
|
|
33
|
+
}).filter(falsy)
|
|
34
|
+
);
|
|
35
|
+
function selectItems(uuids) {
|
|
36
|
+
unselectItems();
|
|
37
|
+
const items = uuids.map((uuid) => {
|
|
38
|
+
const element = findElement(uuid);
|
|
39
|
+
if (element) {
|
|
40
|
+
const item = buildDraggableItem(element);
|
|
41
|
+
if (item && item.itemType === "existing") {
|
|
42
|
+
return item;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}).filter(falsy);
|
|
46
|
+
selectedUuids.value = items.map((v) => v.uuid);
|
|
47
|
+
}
|
|
48
|
+
function unselectItems() {
|
|
49
|
+
activeFieldKey.value = "";
|
|
50
|
+
if (selectedUuids.value.length === 0) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
selectedUuids.value = [];
|
|
54
|
+
}
|
|
55
|
+
function onSelect(v) {
|
|
56
|
+
if (typeof v === "string") {
|
|
57
|
+
selectItems([v]);
|
|
58
|
+
} else {
|
|
59
|
+
selectItems(v.filter(onlyUnique));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const selectInList = (prev) => {
|
|
63
|
+
const items = dom.getAllBlocks();
|
|
64
|
+
if (!items.length) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const currentIndex = blocks.value[0] ? items.findIndex((v) => v.uuid === blocks.value[0].uuid) : -1;
|
|
68
|
+
const targetIndex = modulo(
|
|
69
|
+
prev ? currentIndex - 1 : currentIndex + 1,
|
|
70
|
+
items.length
|
|
71
|
+
);
|
|
72
|
+
const targetItem = items[targetIndex];
|
|
73
|
+
if (!targetItem) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
onSelect(targetItem.uuid);
|
|
77
|
+
dom.refreshBlockRect(targetItem.uuid);
|
|
78
|
+
eventBus.emit("scrollIntoView", { uuid: targetItem.uuid });
|
|
79
|
+
};
|
|
80
|
+
const setActiveFieldKey = (key) => activeFieldKey.value = key;
|
|
81
|
+
onBlokkliEvent("select", onSelect);
|
|
82
|
+
onBlokkliEvent("select:start", (e) => {
|
|
83
|
+
selectedUuids.value = (e.uuids || []).filter(onlyUnique);
|
|
84
|
+
isMultiSelecting.value = true;
|
|
85
|
+
interactionMode.value = e.mode;
|
|
86
|
+
activeFieldKey.value = "";
|
|
87
|
+
});
|
|
88
|
+
onBlokkliEvent("select:toggle", (uuid) => {
|
|
89
|
+
if (selectedUuids.value.includes(uuid)) {
|
|
90
|
+
selectedUuids.value = selectedUuids.value.filter((v) => v !== uuid);
|
|
91
|
+
} else {
|
|
92
|
+
selectedUuids.value.push(uuid);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
onBlokkliEvent("select:end", (uuids) => {
|
|
96
|
+
isMultiSelecting.value = false;
|
|
97
|
+
if (!uuids || uuids.length === 0 && selectedUuids.value.length === 0) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
selectItems(uuids);
|
|
101
|
+
});
|
|
102
|
+
onBlokkliEvent("select:previous", () => selectInList(true));
|
|
103
|
+
onBlokkliEvent("select:next", selectInList);
|
|
104
|
+
onBlokkliEvent("setActiveFieldKey", setActiveFieldKey);
|
|
105
|
+
onBlokkliEvent("state:reloaded", () => {
|
|
106
|
+
});
|
|
107
|
+
onBlokkliEvent("dragging:start", (e) => {
|
|
108
|
+
draggingMode.value = e.mode;
|
|
109
|
+
isMultiSelecting.value = false;
|
|
110
|
+
dragItems.value = e.items;
|
|
111
|
+
const blocks2 = e.items.filter(
|
|
112
|
+
(v) => v.itemType === "existing"
|
|
113
|
+
);
|
|
114
|
+
if (blocks2.length) {
|
|
115
|
+
selectItems(blocks2.map((v) => v.uuid));
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
onBlokkliEvent("dragging:end", () => {
|
|
119
|
+
draggingMode.value = null;
|
|
120
|
+
});
|
|
121
|
+
onBlokkliEvent("window:clickAway", () => {
|
|
122
|
+
unselectItems();
|
|
123
|
+
activeFieldKey.value = "";
|
|
124
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
125
|
+
document.activeElement.blur();
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
const isDraggingExisting = computed(() => {
|
|
129
|
+
return isDragging.value && !!dragItems.value.length && dragItems.value.some(
|
|
130
|
+
(v) => v.itemType === "existing" || v.itemType === "existing_structure"
|
|
131
|
+
);
|
|
132
|
+
});
|
|
133
|
+
return {
|
|
134
|
+
uuids: selectedUuids,
|
|
135
|
+
blocks,
|
|
136
|
+
activeFieldKey,
|
|
137
|
+
isDragging,
|
|
138
|
+
isDraggingExisting,
|
|
139
|
+
setActiveFieldKey,
|
|
140
|
+
editableActive,
|
|
141
|
+
isChangingOptions,
|
|
142
|
+
isMultiSelecting,
|
|
143
|
+
draggingMode,
|
|
144
|
+
interactionMode,
|
|
145
|
+
dragItems,
|
|
146
|
+
uuidsMap,
|
|
147
|
+
dragItemsBundles
|
|
148
|
+
};
|
|
149
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type Ref, type ComputedRef } from 'vue';
|
|
2
|
+
import type { BlokkliAdapter, AdapterContext } from '../adapter.js';
|
|
3
|
+
import type { MutatedField, EditEntity, MutatedOptions, TranslationState, MutationItem, Validation, MutateWithLoadingStateFunction, EditMode, FieldListItem } from '#blokkli/types';
|
|
4
|
+
import type { TextProvider } from './textProvider.js';
|
|
5
|
+
export type BlokkliOwner = {
|
|
6
|
+
name: string | undefined;
|
|
7
|
+
currentUserIsOwner: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type RenderedBlock = {
|
|
10
|
+
item: FieldListItem;
|
|
11
|
+
parentEntityType: string;
|
|
12
|
+
parentEntityBundle: string;
|
|
13
|
+
parentEntityUuid: string;
|
|
14
|
+
};
|
|
15
|
+
export type StateProvider = {
|
|
16
|
+
owner: Readonly<Ref<BlokkliOwner | null>>;
|
|
17
|
+
refreshKey: Readonly<Ref<string>>;
|
|
18
|
+
mutatedFields: Readonly<Ref<MutatedField[]>>;
|
|
19
|
+
entity: Readonly<Ref<EditEntity>>;
|
|
20
|
+
mutatedOptions: MutatedOptions;
|
|
21
|
+
translation: Readonly<Ref<TranslationState>>;
|
|
22
|
+
mutations: Readonly<Ref<MutationItem[]>>;
|
|
23
|
+
currentMutationIndex: Readonly<Ref<number>>;
|
|
24
|
+
violations: Readonly<Ref<Validation[]>>;
|
|
25
|
+
mutateWithLoadingState: MutateWithLoadingStateFunction;
|
|
26
|
+
editMode: Readonly<Ref<EditMode>>;
|
|
27
|
+
mutatedEntity: Readonly<Ref<any>>;
|
|
28
|
+
canEdit: ComputedRef<boolean>;
|
|
29
|
+
isLoading: Readonly<Ref<boolean>>;
|
|
30
|
+
getFieldBlockCount: (key: string) => number;
|
|
31
|
+
getBlockBundleCount: (bundle: string) => number;
|
|
32
|
+
getFieldListItem: (uuid: string) => FieldListItem | undefined;
|
|
33
|
+
getMutatedField: (uuid: string, fieldName: string) => MutatedField | undefined;
|
|
34
|
+
};
|
|
35
|
+
export default function (adapter: BlokkliAdapter<any>, context: ComputedRef<AdapterContext>, $t: TextProvider): Promise<StateProvider>;
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
ref,
|
|
4
|
+
reactive,
|
|
5
|
+
readonly,
|
|
6
|
+
provide
|
|
7
|
+
} from "vue";
|
|
8
|
+
import { refreshNuxtData } from "nuxt/app";
|
|
9
|
+
import { INJECT_MUTATED_FIELDS_MAP } from "./symbols.js";
|
|
10
|
+
import onBlokkliEvent from "./composables/onBlokkliEvent.js";
|
|
11
|
+
import { falsy, getFieldKey } from "#blokkli/helpers";
|
|
12
|
+
import { eventBus, emitMessage } from "#blokkli/helpers/eventBus";
|
|
13
|
+
import { nextTick } from "#imports";
|
|
14
|
+
export default async function(adapter, context, $t) {
|
|
15
|
+
const owner = ref(null);
|
|
16
|
+
const refreshKey = ref("");
|
|
17
|
+
const mutatedFields = ref([]);
|
|
18
|
+
const mutatedFieldsMap = reactive(
|
|
19
|
+
{}
|
|
20
|
+
);
|
|
21
|
+
const mutations = ref([]);
|
|
22
|
+
const violations = ref([]);
|
|
23
|
+
const mutatedEntity = ref(null);
|
|
24
|
+
const currentMutationIndex = ref(-1);
|
|
25
|
+
const isLoading = ref(false);
|
|
26
|
+
const entity = ref({
|
|
27
|
+
label: "",
|
|
28
|
+
status: false,
|
|
29
|
+
bundleLabel: ""
|
|
30
|
+
});
|
|
31
|
+
let fieldBlockCount = {};
|
|
32
|
+
const blockBundleCount = ref({});
|
|
33
|
+
const fieldListItemMap = {};
|
|
34
|
+
function getFieldListItem(uuid) {
|
|
35
|
+
const fieldKey = fieldListItemMap[uuid];
|
|
36
|
+
if (!fieldKey) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const field = mutatedFieldsMap[fieldKey];
|
|
40
|
+
if (!field) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
return field.list.find((v) => v.uuid === uuid);
|
|
44
|
+
}
|
|
45
|
+
const mutatedOptions = reactive({});
|
|
46
|
+
const translation = ref({
|
|
47
|
+
isTranslatable: false,
|
|
48
|
+
sourceLanguage: "",
|
|
49
|
+
availableLanguages: [],
|
|
50
|
+
translations: []
|
|
51
|
+
});
|
|
52
|
+
function setContext(context2) {
|
|
53
|
+
const options = context2?.mutatedState?.mutatedOptions || {};
|
|
54
|
+
const optionKeys = Object.keys(options);
|
|
55
|
+
for (let i = 0; i < optionKeys.length; i++) {
|
|
56
|
+
const key = optionKeys[i];
|
|
57
|
+
const newOptions = options[key];
|
|
58
|
+
const existing = mutatedOptions[key];
|
|
59
|
+
if (!existing || JSON.stringify(existing) !== JSON.stringify(newOptions)) {
|
|
60
|
+
mutatedOptions[key] = newOptions;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
mutations.value = context2?.mutations || [];
|
|
64
|
+
violations.value = context2?.mutatedState?.violations || [];
|
|
65
|
+
const currentIndex = context2?.currentIndex;
|
|
66
|
+
currentMutationIndex.value = currentIndex === void 0 ? -1 : currentIndex;
|
|
67
|
+
owner.value = {
|
|
68
|
+
name: context2?.ownerName,
|
|
69
|
+
currentUserIsOwner: !!context2?.currentUserIsOwner
|
|
70
|
+
};
|
|
71
|
+
entity.value.label = context2?.entity?.label;
|
|
72
|
+
entity.value.status = context2?.entity?.status;
|
|
73
|
+
entity.value.bundleLabel = context2?.entity?.bundleLabel || "";
|
|
74
|
+
translation.value.isTranslatable = !!context2?.translationState?.isTranslatable;
|
|
75
|
+
translation.value.translations = context2?.translationState?.translations?.filter(falsy) || [];
|
|
76
|
+
translation.value.sourceLanguage = context2?.translationState?.sourceLanguage || "";
|
|
77
|
+
translation.value.availableLanguages = context2?.translationState?.availableLanguages || [];
|
|
78
|
+
const newMutatedFields = (context2?.mutatedState?.fields || []).map(
|
|
79
|
+
(field) => {
|
|
80
|
+
return {
|
|
81
|
+
...field,
|
|
82
|
+
list: field.list.filter(falsy)
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
mutatedFields.value = newMutatedFields;
|
|
87
|
+
mutatedEntity.value = context2?.mutatedEntity;
|
|
88
|
+
const visitedFieldKeys = [];
|
|
89
|
+
const newBlockBundleCount = {};
|
|
90
|
+
fieldBlockCount = {};
|
|
91
|
+
for (let i = 0; i < newMutatedFields.length; i++) {
|
|
92
|
+
const field = newMutatedFields[i];
|
|
93
|
+
const key = getFieldKey(field.entityUuid, field.name);
|
|
94
|
+
visitedFieldKeys.push(key);
|
|
95
|
+
const existing = mutatedFieldsMap[key];
|
|
96
|
+
if (!existing || existing.list.length !== field.list.length || JSON.stringify(existing.list) !== JSON.stringify(field.list)) {
|
|
97
|
+
mutatedFieldsMap[key] = field;
|
|
98
|
+
}
|
|
99
|
+
for (let j = 0; j < field.list.length; j++) {
|
|
100
|
+
const item = field.list[j];
|
|
101
|
+
if (!newBlockBundleCount[item.bundle]) {
|
|
102
|
+
newBlockBundleCount[item.bundle] = 0;
|
|
103
|
+
}
|
|
104
|
+
newBlockBundleCount[item.bundle]++;
|
|
105
|
+
fieldListItemMap[item.uuid] = key;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
blockBundleCount.value = newBlockBundleCount;
|
|
109
|
+
const existingKeys = Object.keys(mutatedFieldsMap);
|
|
110
|
+
for (let i = 0; i < existingKeys.length; i++) {
|
|
111
|
+
const key = existingKeys[i];
|
|
112
|
+
if (!visitedFieldKeys.includes(key)) {
|
|
113
|
+
mutatedFieldsMap[key] = void 0;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
eventBus.emit("updateMutatedFields", { fields: newMutatedFields });
|
|
117
|
+
nextTick(() => {
|
|
118
|
+
refreshKey.value = Date.now().toString();
|
|
119
|
+
eventBus.emit("state:reloaded");
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function getMutatedField(entityUuid, fieldName) {
|
|
123
|
+
const key = getFieldKey(entityUuid, fieldName);
|
|
124
|
+
return mutatedFieldsMap[key];
|
|
125
|
+
}
|
|
126
|
+
function getBlockBundleCount(bundle) {
|
|
127
|
+
return blockBundleCount.value[bundle] || 0;
|
|
128
|
+
}
|
|
129
|
+
function getFieldBlockCount(key) {
|
|
130
|
+
if (fieldBlockCount[key] !== void 0) {
|
|
131
|
+
return fieldBlockCount[key];
|
|
132
|
+
}
|
|
133
|
+
const count = mutatedFieldsMap[key]?.list.length || 0;
|
|
134
|
+
fieldBlockCount[key] = count;
|
|
135
|
+
return count;
|
|
136
|
+
}
|
|
137
|
+
function lockBody() {
|
|
138
|
+
document.body.classList.add("bk-body-loading");
|
|
139
|
+
isLoading.value = true;
|
|
140
|
+
}
|
|
141
|
+
function unlockBody() {
|
|
142
|
+
document.body.classList.remove("bk-body-loading");
|
|
143
|
+
isLoading.value = false;
|
|
144
|
+
}
|
|
145
|
+
const mutateWithLoadingState = async (callback, errorMessage, successMessage) => {
|
|
146
|
+
if (!callback) {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
lockBody();
|
|
150
|
+
try {
|
|
151
|
+
const promise = callback();
|
|
152
|
+
const result = await promise;
|
|
153
|
+
if (!result) {
|
|
154
|
+
throw new Error("Unexpected error");
|
|
155
|
+
}
|
|
156
|
+
unlockBody();
|
|
157
|
+
if (result.state) {
|
|
158
|
+
setContext(adapter.mapState(result.state));
|
|
159
|
+
}
|
|
160
|
+
if (!result.success) {
|
|
161
|
+
const errorMessage2 = result.errors?.join("\n") || $t("unexpectedMutationError", "An unexpected error happened.");
|
|
162
|
+
throw new Error(errorMessage2);
|
|
163
|
+
}
|
|
164
|
+
if (successMessage) {
|
|
165
|
+
emitMessage(successMessage);
|
|
166
|
+
}
|
|
167
|
+
return true;
|
|
168
|
+
} catch (e) {
|
|
169
|
+
emitMessage(
|
|
170
|
+
errorMessage || $t("unexpectedMutationError", "An unexpected error happened."),
|
|
171
|
+
"error",
|
|
172
|
+
e
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
unlockBody();
|
|
176
|
+
return false;
|
|
177
|
+
};
|
|
178
|
+
async function loadState() {
|
|
179
|
+
const state = await adapter.loadState();
|
|
180
|
+
if (state) {
|
|
181
|
+
setContext(adapter.mapState(state));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
const canEdit = computed(() => !!owner.value?.currentUserIsOwner);
|
|
185
|
+
const isTranslation = computed(
|
|
186
|
+
() => context.value.language !== translation.value.sourceLanguage && translation.value.isTranslatable
|
|
187
|
+
);
|
|
188
|
+
const editMode = computed(() => {
|
|
189
|
+
if (!canEdit.value) {
|
|
190
|
+
return "readonly";
|
|
191
|
+
}
|
|
192
|
+
if (isTranslation.value) {
|
|
193
|
+
return "translating";
|
|
194
|
+
}
|
|
195
|
+
return "editing";
|
|
196
|
+
});
|
|
197
|
+
onBlokkliEvent("reloadState", async () => {
|
|
198
|
+
await loadState();
|
|
199
|
+
});
|
|
200
|
+
onBlokkliEvent("reloadEntity", async () => {
|
|
201
|
+
await refreshNuxtData();
|
|
202
|
+
await loadState();
|
|
203
|
+
});
|
|
204
|
+
provide(INJECT_MUTATED_FIELDS_MAP, mutatedFieldsMap);
|
|
205
|
+
await loadState();
|
|
206
|
+
return {
|
|
207
|
+
refreshKey,
|
|
208
|
+
owner: readonly(owner),
|
|
209
|
+
mutatedFields,
|
|
210
|
+
entity,
|
|
211
|
+
mutatedOptions,
|
|
212
|
+
translation,
|
|
213
|
+
mutations,
|
|
214
|
+
violations,
|
|
215
|
+
currentMutationIndex,
|
|
216
|
+
mutateWithLoadingState,
|
|
217
|
+
editMode,
|
|
218
|
+
canEdit,
|
|
219
|
+
isLoading: readonly(isLoading),
|
|
220
|
+
mutatedEntity,
|
|
221
|
+
getFieldBlockCount,
|
|
222
|
+
getBlockBundleCount,
|
|
223
|
+
getFieldListItem,
|
|
224
|
+
getMutatedField
|
|
225
|
+
};
|
|
226
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ComputedRef, type WritableComputedRef } from 'vue';
|
|
2
|
+
export type StorageProvider = {
|
|
3
|
+
use: <T>(key: string | ComputedRef<string>, defaultValue: T) => WritableComputedRef<T>;
|
|
4
|
+
clearAll: () => void;
|
|
5
|
+
clear: (key: string) => void;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Create a reactive variable that is synced to local storage using the
|
|
9
|
+
* given key. The sync only happens client side and after the component
|
|
10
|
+
* has been mounted.
|
|
11
|
+
*
|
|
12
|
+
* This composable can be used to keep state across page navigations and
|
|
13
|
+
* even after a refresh.
|
|
14
|
+
*/
|
|
15
|
+
export default function (): StorageProvider;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { computed, ref } from "vue";
|
|
2
|
+
import { storageDefaults } from "#blokkli/config";
|
|
3
|
+
const PREFIX = "blokkli:";
|
|
4
|
+
const getExisting = (key) => {
|
|
5
|
+
try {
|
|
6
|
+
const value = localStorage.getItem(key);
|
|
7
|
+
if (value) {
|
|
8
|
+
return JSON.parse(value);
|
|
9
|
+
}
|
|
10
|
+
} catch {
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export default function() {
|
|
14
|
+
const values = ref({});
|
|
15
|
+
const defaults = ref({});
|
|
16
|
+
const use = (key, providedDefaultValue) => {
|
|
17
|
+
const storageKey = computed(
|
|
18
|
+
() => PREFIX + (typeof key === "string" ? key : key.value)
|
|
19
|
+
);
|
|
20
|
+
const storageDefaultsValue = storageDefaults[typeof key === "string" ? key : key.value];
|
|
21
|
+
const defaultValue = storageDefaultsValue && typeof storageDefaultsValue === typeof providedDefaultValue ? storageDefaultsValue : providedDefaultValue;
|
|
22
|
+
if (!defaults.value[storageKey.value]) {
|
|
23
|
+
defaults.value[storageKey.value] = defaultValue;
|
|
24
|
+
}
|
|
25
|
+
if (values.value[storageKey.value] === void 0) {
|
|
26
|
+
const existing = getExisting(storageKey.value);
|
|
27
|
+
if (existing !== void 0) {
|
|
28
|
+
values.value[storageKey.value] = existing;
|
|
29
|
+
} else {
|
|
30
|
+
values.value[storageKey.value] = defaultValue;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return computed({
|
|
34
|
+
get() {
|
|
35
|
+
const v = values.value[storageKey.value];
|
|
36
|
+
if (v === void 0) {
|
|
37
|
+
return defaults.value[storageKey.value];
|
|
38
|
+
}
|
|
39
|
+
return v;
|
|
40
|
+
},
|
|
41
|
+
set(newValue) {
|
|
42
|
+
values.value[storageKey.value] = newValue;
|
|
43
|
+
window.localStorage.setItem(storageKey.value, JSON.stringify(newValue));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
const clearAll = () => {
|
|
48
|
+
values.value = {};
|
|
49
|
+
Object.keys(window.localStorage).forEach((key) => {
|
|
50
|
+
if (key.startsWith(PREFIX)) {
|
|
51
|
+
window.localStorage.removeItem(key);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
const clear = (key) => {
|
|
56
|
+
const storageKey = PREFIX + key;
|
|
57
|
+
values.value[storageKey] = void 0;
|
|
58
|
+
window.localStorage.removeItem(storageKey);
|
|
59
|
+
};
|
|
60
|
+
return { use, clearAll, clear };
|
|
61
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const INJECT_APP: unique symbol;
|
|
2
|
+
export declare const INJECT_EDIT_CONTEXT: unique symbol;
|
|
3
|
+
export declare const INJECT_IS_EDITING: unique symbol;
|
|
4
|
+
export declare const INJECT_IS_NESTED: unique symbol;
|
|
5
|
+
export declare const INJECT_IS_PREVIEW: unique symbol;
|
|
6
|
+
export declare const INJECT_IS_IN_REUSABLE: unique symbol;
|
|
7
|
+
export declare const INJECT_REUSABLE_OPTIONS: unique symbol;
|
|
8
|
+
export declare const INJECT_FIELD_LIST_TYPE: unique symbol;
|
|
9
|
+
export declare const INJECT_FIELD_LIST_BLOCKS: unique symbol;
|
|
10
|
+
export declare const INJECT_PROVIDER_BLOCKS: unique symbol;
|
|
11
|
+
export declare const INJECT_BLOCK_ITEM: unique symbol;
|
|
12
|
+
export declare const INJECT_MUTATED_FIELDS_MAP: unique symbol;
|
|
13
|
+
export declare const INJECT_ENTITY_CONTEXT: unique symbol;
|
|
14
|
+
export declare const INJECT_FRAGMENT_CONTEXT: unique symbol;
|
|
15
|
+
export declare const INJECT_EDIT_FIELD_LIST_COMPONENT: unique symbol;
|
|
16
|
+
export declare const INJECT_EDIT_LOGGER: unique symbol;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const INJECT_APP = Symbol("blokkli_app");
|
|
2
|
+
export const INJECT_EDIT_CONTEXT = Symbol("blokkli_edit_context");
|
|
3
|
+
export const INJECT_IS_EDITING = Symbol("blokkli_is_editing");
|
|
4
|
+
export const INJECT_IS_NESTED = Symbol("blokkli_is_nested");
|
|
5
|
+
export const INJECT_IS_PREVIEW = Symbol("blokkli_is_preview");
|
|
6
|
+
export const INJECT_IS_IN_REUSABLE = Symbol("blokkli_is_in_reusable");
|
|
7
|
+
export const INJECT_REUSABLE_OPTIONS = Symbol("blokkli_from_library_options");
|
|
8
|
+
export const INJECT_FIELD_LIST_TYPE = Symbol("blokkli_field_list_type");
|
|
9
|
+
export const INJECT_FIELD_LIST_BLOCKS = Symbol("blokkli_field_list_blocks");
|
|
10
|
+
export const INJECT_PROVIDER_BLOCKS = Symbol("blokkli_provider_blocks");
|
|
11
|
+
export const INJECT_BLOCK_ITEM = Symbol("blokkli_block_item");
|
|
12
|
+
export const INJECT_MUTATED_FIELDS_MAP = Symbol("blokkli_mutated_fields_map");
|
|
13
|
+
export const INJECT_ENTITY_CONTEXT = Symbol("blokkli_entity_context");
|
|
14
|
+
export const INJECT_FRAGMENT_CONTEXT = Symbol("blokkli_fragment_context");
|
|
15
|
+
export const INJECT_EDIT_FIELD_LIST_COMPONENT = Symbol(
|
|
16
|
+
"blokkli_edit_field_list_component"
|
|
17
|
+
);
|
|
18
|
+
export const INJECT_EDIT_LOGGER = Symbol("blokkli_edit_logger");
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { translations } from "#blokkli/translations";
|
|
3
|
+
import { defaultLanguage, forceDefaultLanguage } from "#blokkli/config";
|
|
4
|
+
export default function(context) {
|
|
5
|
+
const language = computed(() => {
|
|
6
|
+
if (forceDefaultLanguage) {
|
|
7
|
+
return defaultLanguage;
|
|
8
|
+
}
|
|
9
|
+
if (context?.value.language && translations[context.value.language]) {
|
|
10
|
+
return context.value.language;
|
|
11
|
+
}
|
|
12
|
+
return defaultLanguage;
|
|
13
|
+
});
|
|
14
|
+
const currentTranslations = computed(() => {
|
|
15
|
+
return translations[language.value] || {};
|
|
16
|
+
});
|
|
17
|
+
return (key, defaultValue) => {
|
|
18
|
+
return currentTranslations.value[key] || defaultValue;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DraggableStyle } from '#blokkli/types';
|
|
2
|
+
import type { RGB, ThemeColorGroup, ThemeColorShade, ThemeColors, ThemeContextColorGroup, ThemeContextColorShade, ThemeContextColors, ThemeName } from '#blokkli/types/theme';
|
|
3
|
+
import { type Ref } from '#imports';
|
|
4
|
+
type ThemeMap = {
|
|
5
|
+
accent: Ref<ThemeColors>;
|
|
6
|
+
mono: Ref<ThemeColors>;
|
|
7
|
+
teal: Ref<ThemeContextColors>;
|
|
8
|
+
yellow: Ref<ThemeContextColors>;
|
|
9
|
+
red: Ref<ThemeContextColors>;
|
|
10
|
+
lime: Ref<ThemeContextColors>;
|
|
11
|
+
};
|
|
12
|
+
export type ThemeProvider = {
|
|
13
|
+
accent: Ref<ThemeColors>;
|
|
14
|
+
mono: Ref<ThemeColors>;
|
|
15
|
+
teal: Ref<ThemeContextColors>;
|
|
16
|
+
yellow: Ref<ThemeContextColors>;
|
|
17
|
+
red: Ref<ThemeContextColors>;
|
|
18
|
+
lime: Ref<ThemeContextColors>;
|
|
19
|
+
getDraggableStyle: (el: HTMLElement | SVGElement) => DraggableStyle;
|
|
20
|
+
setColor: <Group extends ThemeColorGroup | ThemeContextColorGroup>(group: Group, shade: Group extends ThemeColorGroup ? ThemeColorShade : ThemeContextColorShade, value: RGB) => void;
|
|
21
|
+
applyTheme: (name: ThemeName | 'custom') => void;
|
|
22
|
+
invalidateCachedStyle: (el: HTMLElement | SVGElement) => void;
|
|
23
|
+
getColor<K extends keyof ThemeMap, T extends ThemeMap[K]['value']>(color: K, key: keyof T): RGB;
|
|
24
|
+
getColorString<K extends keyof ThemeMap, T extends ThemeMap[K]['value']>(color: K, key: keyof T, alpha?: number): string;
|
|
25
|
+
};
|
|
26
|
+
export default function (): ThemeProvider;
|
|
27
|
+
export {};
|