@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,280 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="bk-command-palette bk-control"
|
|
4
|
+
@wheel.passive.stop
|
|
5
|
+
@keydown.stop="onKeyDown"
|
|
6
|
+
@keyup.stop
|
|
7
|
+
@click.stop
|
|
8
|
+
>
|
|
9
|
+
<div class="bk-command-palette-input">
|
|
10
|
+
<Icon name="command" />
|
|
11
|
+
<input
|
|
12
|
+
ref="inputEl"
|
|
13
|
+
v-model="text"
|
|
14
|
+
type="text"
|
|
15
|
+
:placeholder="
|
|
16
|
+
$t('commandPalette.inputPlaceholder', 'Search commands...')
|
|
17
|
+
"
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="bk-command-palette-results bk-scrollbar-dark">
|
|
21
|
+
<Group
|
|
22
|
+
v-for="group in groups"
|
|
23
|
+
:key="group.id"
|
|
24
|
+
:label="group.label"
|
|
25
|
+
:commands="group.commands"
|
|
26
|
+
:visible-ids="visibleIds"
|
|
27
|
+
:focused-id="focusedId"
|
|
28
|
+
@close="$emit('close')"
|
|
29
|
+
@focus="focusedId = $event"
|
|
30
|
+
@select="onSelect($event)"
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script lang="ts" setup>
|
|
37
|
+
import {
|
|
38
|
+
computed,
|
|
39
|
+
onMounted,
|
|
40
|
+
ref,
|
|
41
|
+
useBlokkli,
|
|
42
|
+
watch,
|
|
43
|
+
nextTick,
|
|
44
|
+
onBeforeUnmount,
|
|
45
|
+
} from '#imports'
|
|
46
|
+
import { Icon } from '#blokkli/components'
|
|
47
|
+
import type { Command, CommandGroup } from '#blokkli/types'
|
|
48
|
+
import Group from './Group/index.vue'
|
|
49
|
+
import { falsy } from '#blokkli/helpers'
|
|
50
|
+
import { Fzf } from 'fzf'
|
|
51
|
+
|
|
52
|
+
const { commands, $t, selection } = useBlokkli()
|
|
53
|
+
|
|
54
|
+
const emit = defineEmits(['close'])
|
|
55
|
+
|
|
56
|
+
const inputEl = ref<HTMLInputElement | null>(null)
|
|
57
|
+
const text = ref('')
|
|
58
|
+
const focusedId = ref('')
|
|
59
|
+
|
|
60
|
+
type GroupedCommands = {
|
|
61
|
+
id: CommandGroup
|
|
62
|
+
label: string
|
|
63
|
+
commands: Array<Command & { _id: number }>
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const getGroupLabel = (id: CommandGroup): string => {
|
|
67
|
+
if (id === 'ui') {
|
|
68
|
+
return $t('commandGroup.ui', 'Interface')
|
|
69
|
+
} else if (id === 'add') {
|
|
70
|
+
return $t('commandGroup.add', 'Add new')
|
|
71
|
+
} else if (id === 'action') {
|
|
72
|
+
return $t('commandGroup.action', 'Actions')
|
|
73
|
+
} else if (id === 'selection') {
|
|
74
|
+
return $t('commandGroup.selection', 'Selection')
|
|
75
|
+
} else if (id === 'misc') {
|
|
76
|
+
return $t('commandGroup.misc', 'Miscellaneous')
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return id
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const groupOrder = computed<CommandGroup[]>(() => {
|
|
83
|
+
// When blocks are selected, the block actions should be first.
|
|
84
|
+
if (selection.uuids.value.length) {
|
|
85
|
+
return ['selection', 'add']
|
|
86
|
+
}
|
|
87
|
+
return ['add']
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
const items = computed<Array<Command & { _id: number }>>(() =>
|
|
91
|
+
commands
|
|
92
|
+
.getCommands()
|
|
93
|
+
.filter((v) => !v.disabled)
|
|
94
|
+
.map((doc, index) => {
|
|
95
|
+
return {
|
|
96
|
+
...doc,
|
|
97
|
+
_id: index,
|
|
98
|
+
}
|
|
99
|
+
}),
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
const fzf = new Fzf(items.value, {
|
|
103
|
+
// With selector you tell FZF where it can find
|
|
104
|
+
// the string that you want to query on
|
|
105
|
+
selector: (item) => item.label,
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
const visibleIds = computed<{ id: number; positions: number[] }[] | undefined>(
|
|
109
|
+
() => {
|
|
110
|
+
if (!text.value) {
|
|
111
|
+
return undefined
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const results = fzf.find(text.value)
|
|
115
|
+
return results.map((v) => {
|
|
116
|
+
return {
|
|
117
|
+
id: v.item._id,
|
|
118
|
+
positions: [...v.positions],
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
},
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
const groups = computed<GroupedCommands[]>(() => {
|
|
125
|
+
return Object.values(
|
|
126
|
+
items.value.reduce<Record<string, GroupedCommands>>((acc, command) => {
|
|
127
|
+
const group = command.group || 'misc'
|
|
128
|
+
if (!acc[group]) {
|
|
129
|
+
acc[group] = {
|
|
130
|
+
id: group,
|
|
131
|
+
label: getGroupLabel(group),
|
|
132
|
+
commands: [],
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
acc[group].commands.push(command)
|
|
137
|
+
return acc
|
|
138
|
+
}, {}),
|
|
139
|
+
).sort((a, b) => {
|
|
140
|
+
const indexA = groupOrder.value.indexOf(a.id)
|
|
141
|
+
const indexB = groupOrder.value.indexOf(b.id)
|
|
142
|
+
|
|
143
|
+
if (indexA === -1 && indexB === -1) {
|
|
144
|
+
return 0
|
|
145
|
+
} else if (indexA === -1) {
|
|
146
|
+
return 1
|
|
147
|
+
} else if (indexB === -1) {
|
|
148
|
+
return -1
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return indexA - indexB
|
|
152
|
+
})
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
watch(text, () => {
|
|
156
|
+
nextTick(() => {
|
|
157
|
+
focusFirst()
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
watch(selection.uuids, () => emit('close'))
|
|
162
|
+
|
|
163
|
+
const focusFirst = () => {
|
|
164
|
+
const element = document.querySelector(
|
|
165
|
+
'.bk-command-palette .bk-command[data-command-visible="true"]',
|
|
166
|
+
)
|
|
167
|
+
if (element instanceof HTMLElement) {
|
|
168
|
+
focusedId.value = element.dataset.commandId || ''
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const getCommandElements = () => {
|
|
173
|
+
return [
|
|
174
|
+
...document.querySelectorAll(
|
|
175
|
+
'.bk-command-palette .bk-command[data-command-visible="true"]',
|
|
176
|
+
),
|
|
177
|
+
]
|
|
178
|
+
.map((el) => {
|
|
179
|
+
if (el instanceof HTMLElement) {
|
|
180
|
+
const id = el.dataset.commandId
|
|
181
|
+
if (id) {
|
|
182
|
+
return {
|
|
183
|
+
id,
|
|
184
|
+
el,
|
|
185
|
+
focused: focusedId.value === id,
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
.filter(falsy)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const focusPrev = () => {
|
|
194
|
+
const elements = getCommandElements()
|
|
195
|
+
if (elements.length === -1) {
|
|
196
|
+
return
|
|
197
|
+
}
|
|
198
|
+
const focusedIndex = elements.findIndex((v) => v.focused)
|
|
199
|
+
// None or first is focused.
|
|
200
|
+
if (focusedIndex <= 0) {
|
|
201
|
+
// Focus last element.
|
|
202
|
+
focusedId.value = elements[elements.length - 1].id
|
|
203
|
+
} else {
|
|
204
|
+
focusedId.value = elements[focusedIndex - 1].id
|
|
205
|
+
}
|
|
206
|
+
scrollFocusedIntoView()
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const focusNext = () => {
|
|
210
|
+
const elements = getCommandElements()
|
|
211
|
+
if (elements.length === -1) {
|
|
212
|
+
return
|
|
213
|
+
}
|
|
214
|
+
const focusedIndex = elements.findIndex((v) => v.focused)
|
|
215
|
+
// None or last is focused.
|
|
216
|
+
if (focusedIndex === -1 || focusedIndex === elements.length - 1) {
|
|
217
|
+
// Focus last element.
|
|
218
|
+
focusedId.value = elements[0].id
|
|
219
|
+
} else {
|
|
220
|
+
focusedId.value = elements[focusedIndex + 1].id
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
scrollFocusedIntoView()
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const scrollFocusedIntoView = () => {
|
|
227
|
+
const element = getCommandElements().find((v) => v.focused)?.el
|
|
228
|
+
if (element) {
|
|
229
|
+
element.scrollIntoView({ block: 'nearest', inline: 'nearest' })
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const onSelect = (id: string) => {
|
|
234
|
+
const command = items.value.find((v) => v.id === id)
|
|
235
|
+
if (command) {
|
|
236
|
+
command.callback()
|
|
237
|
+
emit('close')
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const onKeyDown = (e: KeyboardEvent) => {
|
|
242
|
+
if (e.code === 'Tab') {
|
|
243
|
+
e.preventDefault()
|
|
244
|
+
if (e.shiftKey) {
|
|
245
|
+
focusPrev()
|
|
246
|
+
} else {
|
|
247
|
+
focusNext()
|
|
248
|
+
}
|
|
249
|
+
} else if (e.code === 'ArrowDown') {
|
|
250
|
+
e.preventDefault()
|
|
251
|
+
focusNext()
|
|
252
|
+
} else if (e.code === 'ArrowUp') {
|
|
253
|
+
e.preventDefault()
|
|
254
|
+
focusPrev()
|
|
255
|
+
} else if (e.code === 'Enter') {
|
|
256
|
+
e.preventDefault()
|
|
257
|
+
onSelect(focusedId.value)
|
|
258
|
+
} else if (e.code === 'Escape') {
|
|
259
|
+
e.preventDefault()
|
|
260
|
+
emit('close')
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const onWindowClick = () => {
|
|
265
|
+
emit('close')
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
onMounted(() => {
|
|
269
|
+
if (inputEl.value) {
|
|
270
|
+
inputEl.value.focus()
|
|
271
|
+
focusFirst()
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
document.body.addEventListener('click', onWindowClick)
|
|
275
|
+
})
|
|
276
|
+
|
|
277
|
+
onBeforeUnmount(() => {
|
|
278
|
+
document.body.removeEventListener('click', onWindowClick)
|
|
279
|
+
})
|
|
280
|
+
</script>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="body">
|
|
3
|
+
<div class="bk">
|
|
4
|
+
<Transition name="bk-command-palette">
|
|
5
|
+
<Palette v-if="isVisible" @close="isVisible = false" />
|
|
6
|
+
</Transition>
|
|
7
|
+
</div>
|
|
8
|
+
</Teleport>
|
|
9
|
+
<PluginToolbarButton
|
|
10
|
+
id="command_palette"
|
|
11
|
+
:title="label"
|
|
12
|
+
meta
|
|
13
|
+
key-code="K"
|
|
14
|
+
region="before-sidebar"
|
|
15
|
+
:tour-text="
|
|
16
|
+
$t(
|
|
17
|
+
'commandPaletteTourText',
|
|
18
|
+
'Easily perform actions using your keyboard by launching the command palette. Most of the features available using clicks is also available in the command palette.',
|
|
19
|
+
)
|
|
20
|
+
"
|
|
21
|
+
icon="command"
|
|
22
|
+
@click="isVisible = true"
|
|
23
|
+
/>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script lang="ts" setup>
|
|
27
|
+
import { useBlokkli, defineBlokkliFeature, ref, computed } from '#imports'
|
|
28
|
+
import { PluginToolbarButton } from '#blokkli/plugins'
|
|
29
|
+
import Palette from './Palette/index.vue'
|
|
30
|
+
|
|
31
|
+
defineBlokkliFeature({
|
|
32
|
+
id: 'command-palette',
|
|
33
|
+
icon: 'command',
|
|
34
|
+
label: 'Command Palette',
|
|
35
|
+
description:
|
|
36
|
+
'Provides a command palette with search to access most UI features with a keyboard.',
|
|
37
|
+
viewports: ['desktop'],
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const { $t } = useBlokkli()
|
|
41
|
+
|
|
42
|
+
const isVisible = ref(false)
|
|
43
|
+
|
|
44
|
+
const label = computed(() => $t('commandPaletteOpen', 'Open Command Palette'))
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<script lang="ts">
|
|
48
|
+
export default {
|
|
49
|
+
name: 'CommandPalette',
|
|
50
|
+
}
|
|
51
|
+
</script>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="bk-blokkli-item-actions-comment-dropdown" @keydown.capture.stop>
|
|
3
|
+
<label for="comment_body" class="bk-form-label">{{
|
|
4
|
+
$t('commentBody', 'Comment')
|
|
5
|
+
}}</label>
|
|
6
|
+
<textarea
|
|
7
|
+
id="comment_body"
|
|
8
|
+
v-model="comment"
|
|
9
|
+
type="text"
|
|
10
|
+
class="bk-form-input"
|
|
11
|
+
rows="5"
|
|
12
|
+
required
|
|
13
|
+
/>
|
|
14
|
+
<button class="bk-button bk-is-primary" @click="$emit('add', comment)">
|
|
15
|
+
{{ $t('commentSave', 'Submit comment') }}
|
|
16
|
+
</button>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script lang="ts" setup>
|
|
21
|
+
import { ref, useBlokkli } from '#imports'
|
|
22
|
+
|
|
23
|
+
const comment = ref('')
|
|
24
|
+
defineEmits(['add'])
|
|
25
|
+
const { $t } = useBlokkli()
|
|
26
|
+
|
|
27
|
+
const getComment = (): string => {
|
|
28
|
+
return comment.value
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
defineExpose({ getComment })
|
|
32
|
+
</script>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="bk bk-comment" @click="$emit('clickComment')">
|
|
3
|
+
<h3>
|
|
4
|
+
{{ user?.label }}
|
|
5
|
+
</h3>
|
|
6
|
+
<RelativeTime v-slot="{ formatted }" :timestamp="timestamp">
|
|
7
|
+
<div class="bk-comment-date">
|
|
8
|
+
{{ formatted }}
|
|
9
|
+
</div>
|
|
10
|
+
</RelativeTime>
|
|
11
|
+
<div class="bk-comment-body" v-html="body" />
|
|
12
|
+
<button
|
|
13
|
+
v-if="!resolved && resolveImplemeted"
|
|
14
|
+
@click.capture.stop="$emit('resolve')"
|
|
15
|
+
>
|
|
16
|
+
<Icon name="check" />
|
|
17
|
+
<span>{{ $t('commentsMarkAsResolved', 'Resolve') }}</span>
|
|
18
|
+
</button>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script lang="ts" setup>
|
|
23
|
+
import { computed, useBlokkli } from '#imports'
|
|
24
|
+
import type { CommentItem } from '#blokkli/types'
|
|
25
|
+
import { Icon, RelativeTime } from '#blokkli/components'
|
|
26
|
+
|
|
27
|
+
const { adapter, $t } = useBlokkli()
|
|
28
|
+
|
|
29
|
+
const resolveImplemeted = computed(() => !!adapter.resolveComment)
|
|
30
|
+
|
|
31
|
+
defineEmits<{
|
|
32
|
+
(e: 'resolve' | 'clickComment'): void
|
|
33
|
+
}>()
|
|
34
|
+
|
|
35
|
+
const props = defineProps<{
|
|
36
|
+
uuid?: string | number
|
|
37
|
+
blockUuids?: string[]
|
|
38
|
+
resolved?: boolean
|
|
39
|
+
body?: string
|
|
40
|
+
created?: CommentItem['created']
|
|
41
|
+
user?: CommentItem['user']
|
|
42
|
+
}>()
|
|
43
|
+
|
|
44
|
+
const timestamp = computed(() =>
|
|
45
|
+
props.created ? Number.parseInt(props.created.toString()) : 0,
|
|
46
|
+
)
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<script lang="ts">
|
|
50
|
+
export default {
|
|
51
|
+
name: 'Comment',
|
|
52
|
+
}
|
|
53
|
+
</script>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="bk-comments-overlay-item"
|
|
4
|
+
:style="style"
|
|
5
|
+
:class="{
|
|
6
|
+
'bk-is-active': showComments,
|
|
7
|
+
'bk-is-left': isLeft,
|
|
8
|
+
'bk-is-right': !isLeft,
|
|
9
|
+
}"
|
|
10
|
+
>
|
|
11
|
+
<button
|
|
12
|
+
class="bk-comments-overlay-item-button"
|
|
13
|
+
:class="{
|
|
14
|
+
'bk-has-unresolved-comments': unresolvedCount > 0,
|
|
15
|
+
}"
|
|
16
|
+
@click="$emit('toggle')"
|
|
17
|
+
>
|
|
18
|
+
<Icon v-if="showComments" name="close" />
|
|
19
|
+
<span v-else>{{ unresolvedCount }}</span>
|
|
20
|
+
</button>
|
|
21
|
+
<div
|
|
22
|
+
v-show="showComments"
|
|
23
|
+
class="bk-comments-overlay-comments"
|
|
24
|
+
:class="{ 'bk-is-left': isLeft, 'bk-is-right': !isLeft }"
|
|
25
|
+
>
|
|
26
|
+
<div class="bk-comments-overlay-comments-header">
|
|
27
|
+
<Icon name="comment" />
|
|
28
|
+
<span
|
|
29
|
+
>{{ comments.length }}
|
|
30
|
+
{{
|
|
31
|
+
comments.length === 1
|
|
32
|
+
? $t('singleComment', 'comment')
|
|
33
|
+
: $t('comments', 'Comments')
|
|
34
|
+
}}</span
|
|
35
|
+
>
|
|
36
|
+
</div>
|
|
37
|
+
<div v-for="comment in comments" :key="comment.uuid">
|
|
38
|
+
<Comment v-bind="comment" @resolve="resolveComment(comment.uuid)" />
|
|
39
|
+
</div>
|
|
40
|
+
<div class="bk-comments-overlay-form" @keydown.capture.stop>
|
|
41
|
+
<textarea
|
|
42
|
+
v-model="commentText"
|
|
43
|
+
type="text"
|
|
44
|
+
class="bk-form-input"
|
|
45
|
+
:placeholder="$t('commentBodyPlaceholder', 'Add reply')"
|
|
46
|
+
required
|
|
47
|
+
@focus="showFullForm = true"
|
|
48
|
+
/>
|
|
49
|
+
<button
|
|
50
|
+
v-if="showFullForm && commentText"
|
|
51
|
+
class="bk-button bk-is-primary bk-is-small"
|
|
52
|
+
@click="addComment"
|
|
53
|
+
>
|
|
54
|
+
{{ $t('commentAdd', 'Add comment') }}
|
|
55
|
+
</button>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script lang="ts" setup>
|
|
62
|
+
import { ref, computed, useBlokkli } from '#imports'
|
|
63
|
+
import type { CommentItem } from '#blokkli/types'
|
|
64
|
+
import { Icon } from '#blokkli/components'
|
|
65
|
+
import Comment from './../../Comment/index.vue'
|
|
66
|
+
|
|
67
|
+
const { $t } = useBlokkli()
|
|
68
|
+
|
|
69
|
+
const commentText = ref('')
|
|
70
|
+
const showFullForm = ref(false)
|
|
71
|
+
const emit = defineEmits<{
|
|
72
|
+
(e: 'toggle'): void
|
|
73
|
+
(e: 'addComment' | 'resolveComment', text: string): void
|
|
74
|
+
}>()
|
|
75
|
+
|
|
76
|
+
const props = defineProps<{
|
|
77
|
+
isReduced: boolean
|
|
78
|
+
isLeft: boolean
|
|
79
|
+
uuids: string[]
|
|
80
|
+
comments: CommentItem[]
|
|
81
|
+
style: any
|
|
82
|
+
showComments: boolean
|
|
83
|
+
}>()
|
|
84
|
+
|
|
85
|
+
const unresolvedCount = computed(
|
|
86
|
+
() => props.comments.filter((v) => !v.resolved).length,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
function addComment() {
|
|
90
|
+
emit('addComment', commentText.value)
|
|
91
|
+
showFullForm.value = false
|
|
92
|
+
commentText.value = ''
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function resolveComment(uuid: string | undefined) {
|
|
96
|
+
if (uuid) {
|
|
97
|
+
emit('resolveComment', uuid)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
</script>
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="body">
|
|
3
|
+
<div class="bk bk-comments-overlay bk-control">
|
|
4
|
+
<Item
|
|
5
|
+
v-for="item in indicators"
|
|
6
|
+
:key="item.id"
|
|
7
|
+
v-bind="item"
|
|
8
|
+
:is-reduced="isReduced"
|
|
9
|
+
:is-left="isLeft"
|
|
10
|
+
:show-comments="active === item.id"
|
|
11
|
+
@toggle="toggle(item)"
|
|
12
|
+
@add-comment="$emit('addComment', { body: $event, uuids: item.uuids })"
|
|
13
|
+
@resolve-comment="$emit('resolveComment', $event)"
|
|
14
|
+
/>
|
|
15
|
+
</div>
|
|
16
|
+
</Teleport>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script lang="ts" setup>
|
|
20
|
+
import { ref, useBlokkli } from '#imports'
|
|
21
|
+
import type { CommentItem } from '#blokkli/types'
|
|
22
|
+
import { falsy, getBounds } from '#blokkli/helpers'
|
|
23
|
+
import Item from './Item/index.vue'
|
|
24
|
+
import onBlokkliEvent from '#blokkli/helpers/composables/onBlokkliEvent'
|
|
25
|
+
|
|
26
|
+
type Indicator = {
|
|
27
|
+
id: string
|
|
28
|
+
comments: CommentItem[]
|
|
29
|
+
uuids: string[]
|
|
30
|
+
style: {
|
|
31
|
+
transform: string
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const { eventBus, ui, dom } = useBlokkli()
|
|
36
|
+
|
|
37
|
+
const props = defineProps<{
|
|
38
|
+
comments: CommentItem[]
|
|
39
|
+
}>()
|
|
40
|
+
|
|
41
|
+
defineEmits<{
|
|
42
|
+
(e: 'addComment', data: { uuids: string[]; body: string }): void
|
|
43
|
+
(e: 'resolveComment', uuid: string): void
|
|
44
|
+
}>()
|
|
45
|
+
|
|
46
|
+
const isReduced = ref(false)
|
|
47
|
+
const isLeft = ref(false)
|
|
48
|
+
const active = ref('')
|
|
49
|
+
|
|
50
|
+
function toggle(item: Indicator) {
|
|
51
|
+
if (active.value === item.id) {
|
|
52
|
+
active.value = ''
|
|
53
|
+
eventBus.emit('select:end', [])
|
|
54
|
+
} else {
|
|
55
|
+
active.value = item.id
|
|
56
|
+
eventBus.emit('select:end', item.uuids)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const indicators = ref<Indicator[]>([])
|
|
61
|
+
|
|
62
|
+
onBlokkliEvent('canvas:draw', (e) => {
|
|
63
|
+
const scale = e.artboardScale
|
|
64
|
+
const offset = e.artboardOffset
|
|
65
|
+
|
|
66
|
+
const x = Math.min(
|
|
67
|
+
offset.x + ui.artboardSize.value.width * scale + 10,
|
|
68
|
+
ui.visibleViewportPadded.value.x +
|
|
69
|
+
ui.visibleViewportPadded.value.width -
|
|
70
|
+
30,
|
|
71
|
+
)
|
|
72
|
+
isReduced.value = scale < 0.8
|
|
73
|
+
isLeft.value =
|
|
74
|
+
x + 300 <
|
|
75
|
+
ui.visibleViewportPadded.value.x + ui.visibleViewportPadded.value.width
|
|
76
|
+
|
|
77
|
+
const newIndicators: Record<string, Indicator> = {}
|
|
78
|
+
const yMap = new Set<number>()
|
|
79
|
+
|
|
80
|
+
const findY = (y: number): number => {
|
|
81
|
+
if (yMap.has(y)) {
|
|
82
|
+
return findY(y + 60)
|
|
83
|
+
}
|
|
84
|
+
yMap.add(y)
|
|
85
|
+
return y
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
for (let i = 0; i < props.comments.length; i++) {
|
|
89
|
+
const comment = props.comments[i]
|
|
90
|
+
const uuids = comment.blockUuids || []
|
|
91
|
+
const rects = uuids
|
|
92
|
+
.filter(falsy)
|
|
93
|
+
.map((uuid) => {
|
|
94
|
+
const blockRect = dom.getBlockRect(uuid)
|
|
95
|
+
if (!blockRect) {
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const rect = ui.getViewportRelativeRect(blockRect)
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
x: rect.x,
|
|
103
|
+
y: rect.y,
|
|
104
|
+
width: rect.width,
|
|
105
|
+
height: rect.height,
|
|
106
|
+
uuid,
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
.filter(falsy)
|
|
110
|
+
if (rects.length) {
|
|
111
|
+
const bounds = getBounds(rects)
|
|
112
|
+
const id = uuids.join(',')
|
|
113
|
+
if (bounds && !newIndicators[id]) {
|
|
114
|
+
const y = findY(Math.round(bounds.y))
|
|
115
|
+
newIndicators[id] = {
|
|
116
|
+
id,
|
|
117
|
+
comments: [],
|
|
118
|
+
uuids,
|
|
119
|
+
style: {
|
|
120
|
+
// @TODO: Because the --bk-artboard-scale CSS variable was
|
|
121
|
+
// removed, the comment box now scaled with the artboard.
|
|
122
|
+
// This should be fixed by not positioning the box inside the
|
|
123
|
+
// artboard element so it does not scale.
|
|
124
|
+
transform: `translate(${x}px, ${y}px)`,
|
|
125
|
+
},
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
newIndicators[id].comments.push(comment)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
indicators.value = Object.values(newIndicators)
|
|
132
|
+
})
|
|
133
|
+
</script>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Sidebar
|
|
2
|
+
|
|
3
|
+
The sidebar pane renders a list of all comments on the current page.
|
|
4
|
+
|
|
5
|
+
## Overlay
|
|
6
|
+
|
|
7
|
+
The overlay renders comments next to the blocks. Unresolved comments are
|
|
8
|
+
highlighted.
|
|
9
|
+
|
|
10
|
+
## Action
|
|
11
|
+
|
|
12
|
+
The action is added to the block actions overlay on selected blocks. Clicking
|
|
13
|
+
the action opens a dropdown to add a new comment.
|