@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,81 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<tr>
|
|
3
|
+
<td class="bk-theme-editor-color-shade">{{ shade }}</td>
|
|
4
|
+
<td class="bk-theme-editor-color-hex">
|
|
5
|
+
<input v-model="inputValue" type="text" maxlength="7" />
|
|
6
|
+
</td>
|
|
7
|
+
<td class="bk-theme-editor-color-buttons">
|
|
8
|
+
<button
|
|
9
|
+
v-if="inputValue !== initValue"
|
|
10
|
+
@click.stop="inputValue = initValue"
|
|
11
|
+
>
|
|
12
|
+
<Icon name="revert" />
|
|
13
|
+
</button>
|
|
14
|
+
</td>
|
|
15
|
+
<td class="bk-theme-editor-color-color">
|
|
16
|
+
<input v-model.lazy="inputValue" type="color" :name="group + shade" />
|
|
17
|
+
</td>
|
|
18
|
+
</tr>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script lang="ts" setup>
|
|
22
|
+
import { computed, useBlokkli } from '#imports'
|
|
23
|
+
import { Icon } from '#blokkli/components'
|
|
24
|
+
import { theme as configTheme } from '#blokkli/config'
|
|
25
|
+
import type {
|
|
26
|
+
RGB,
|
|
27
|
+
ThemeColorGroup,
|
|
28
|
+
ThemeColorShade,
|
|
29
|
+
ThemeContextColorGroup,
|
|
30
|
+
ThemeContextColorShade,
|
|
31
|
+
} from '#blokkli/types/theme'
|
|
32
|
+
|
|
33
|
+
const props = defineProps<{
|
|
34
|
+
group: ThemeColorGroup | ThemeContextColorGroup
|
|
35
|
+
shade: ThemeColorShade | ThemeContextColorShade
|
|
36
|
+
}>()
|
|
37
|
+
|
|
38
|
+
const { theme } = useBlokkli()
|
|
39
|
+
|
|
40
|
+
function rgbToHex(rgb: RGB): string {
|
|
41
|
+
// Helper function to convert a single RGB component to a two-digit hexadecimal string
|
|
42
|
+
const toHex = (component: number): string => {
|
|
43
|
+
const hexValue = component.toString(16)
|
|
44
|
+
return hexValue.length == 1 ? '0' + hexValue : hexValue
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Destructuring the RGB components from the input array
|
|
48
|
+
const [r, g, b] = rgb
|
|
49
|
+
|
|
50
|
+
// Converting each component to hex and concatenating them
|
|
51
|
+
return `#${toHex(r)}${toHex(g)}${toHex(b)}`
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function hexToRgb(v: string): RGB | null {
|
|
55
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(v)
|
|
56
|
+
return result
|
|
57
|
+
? [
|
|
58
|
+
Number.parseInt(result[1], 16),
|
|
59
|
+
Number.parseInt(result[2], 16),
|
|
60
|
+
Number.parseInt(result[3], 16),
|
|
61
|
+
]
|
|
62
|
+
: null
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const initValue = computed(() =>
|
|
66
|
+
rgbToHex((configTheme as any)[props.group][props.shade]),
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
const inputValue = computed({
|
|
70
|
+
get() {
|
|
71
|
+
return rgbToHex((theme as any)[props.group].value[props.shade])
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
set(hex: string) {
|
|
75
|
+
const rgb = hexToRgb(hex)
|
|
76
|
+
if (rgb) {
|
|
77
|
+
theme.setColor(props.group, props.shade, rgb)
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
</script>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="bk-theme-editor-code">
|
|
3
|
+
<textarea :value="code" rows="10" />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { useBlokkli, computed } from '#imports'
|
|
9
|
+
|
|
10
|
+
const { theme } = useBlokkli()
|
|
11
|
+
|
|
12
|
+
const code = computed(() => {
|
|
13
|
+
const obj = {
|
|
14
|
+
accent: theme.accent.value,
|
|
15
|
+
mono: theme.mono.value,
|
|
16
|
+
teal: theme.teal.value,
|
|
17
|
+
yellow: theme.yellow.value,
|
|
18
|
+
red: theme.red.value,
|
|
19
|
+
lime: theme.lime.value,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return JSON.stringify(obj, null, 2)
|
|
23
|
+
})
|
|
24
|
+
</script>
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<PluginSidebar
|
|
3
|
+
id="theme"
|
|
4
|
+
:title="$t('theme', 'Theme')"
|
|
5
|
+
:tour-text="
|
|
6
|
+
$t(
|
|
7
|
+
'themeTourText',
|
|
8
|
+
'Change the colors of the theme and generate a theme file.',
|
|
9
|
+
)
|
|
10
|
+
"
|
|
11
|
+
icon="palette"
|
|
12
|
+
weight="-100"
|
|
13
|
+
>
|
|
14
|
+
<div class="bk bk-theme-editor bk-control" @wheel.capture.stop.passive>
|
|
15
|
+
<div class="bk-theme-editor-select">
|
|
16
|
+
<select v-model="selectedTheme">
|
|
17
|
+
<option v-for="option in themeOptions" :key="option" :value="option">
|
|
18
|
+
{{ option }}
|
|
19
|
+
</option>
|
|
20
|
+
</select>
|
|
21
|
+
</div>
|
|
22
|
+
<div :key="selectedThemeId" class="bk-theme-editor-groups">
|
|
23
|
+
<div v-for="group in groups" :key="group" class="bk-theme-editor-group">
|
|
24
|
+
<h2>{{ group }}</h2>
|
|
25
|
+
<table class="bk-theme-editor-table">
|
|
26
|
+
<Color
|
|
27
|
+
v-for="shade in shades"
|
|
28
|
+
:key="group + shade"
|
|
29
|
+
:group="group"
|
|
30
|
+
:shade="shade"
|
|
31
|
+
/>
|
|
32
|
+
</table>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<div
|
|
36
|
+
v-for="group in contextGroups"
|
|
37
|
+
:key="group"
|
|
38
|
+
class="bk-theme-editor-group"
|
|
39
|
+
>
|
|
40
|
+
<h2>{{ group }}</h2>
|
|
41
|
+
<table class="bk-theme-editor-table">
|
|
42
|
+
<Color
|
|
43
|
+
v-for="shade in contextShades"
|
|
44
|
+
:key="group + shade"
|
|
45
|
+
:group="group"
|
|
46
|
+
:shade="shade"
|
|
47
|
+
/>
|
|
48
|
+
</table>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<GeneratedCode />
|
|
53
|
+
</div>
|
|
54
|
+
</PluginSidebar>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<script lang="ts" setup>
|
|
58
|
+
import { useBlokkli, defineBlokkliFeature, ref, computed } from '#imports'
|
|
59
|
+
import { PluginSidebar } from '#blokkli/plugins'
|
|
60
|
+
import Color from './Color/index.vue'
|
|
61
|
+
import GeneratedCode from './GeneratedCode/index.vue'
|
|
62
|
+
import type {
|
|
63
|
+
ThemeColorGroup,
|
|
64
|
+
ThemeColorShade,
|
|
65
|
+
ThemeContextColorGroup,
|
|
66
|
+
ThemeContextColorShade,
|
|
67
|
+
} from '#blokkli/types/theme'
|
|
68
|
+
|
|
69
|
+
import { themes } from '#blokkli/config'
|
|
70
|
+
|
|
71
|
+
defineBlokkliFeature({
|
|
72
|
+
id: 'theme',
|
|
73
|
+
icon: 'palette',
|
|
74
|
+
label: 'Theme',
|
|
75
|
+
description: 'Implements a theme editor.',
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const { $t, theme } = useBlokkli()
|
|
79
|
+
|
|
80
|
+
const selectedThemeId = ref('custom')
|
|
81
|
+
|
|
82
|
+
const selectedTheme = computed({
|
|
83
|
+
get() {
|
|
84
|
+
return selectedThemeId.value
|
|
85
|
+
},
|
|
86
|
+
set(id: any) {
|
|
87
|
+
selectedThemeId.value = id
|
|
88
|
+
theme.applyTheme(id)
|
|
89
|
+
},
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
const themeOptions = computed(() => ['custom', ...Object.keys(themes)])
|
|
93
|
+
|
|
94
|
+
const groups: ThemeColorGroup[] = ['accent', 'mono']
|
|
95
|
+
const shades: ThemeColorShade[] = [
|
|
96
|
+
'50',
|
|
97
|
+
'100',
|
|
98
|
+
'200',
|
|
99
|
+
'300',
|
|
100
|
+
'400',
|
|
101
|
+
'500',
|
|
102
|
+
'600',
|
|
103
|
+
'700',
|
|
104
|
+
'800',
|
|
105
|
+
'900',
|
|
106
|
+
'950',
|
|
107
|
+
]
|
|
108
|
+
|
|
109
|
+
const contextGroups: ThemeContextColorGroup[] = [
|
|
110
|
+
'teal',
|
|
111
|
+
'yellow',
|
|
112
|
+
'red',
|
|
113
|
+
'lime',
|
|
114
|
+
]
|
|
115
|
+
const contextShades: ThemeContextColorShade[] = ['light', 'normal', 'dark']
|
|
116
|
+
</script>
|
|
117
|
+
|
|
118
|
+
<script lang="ts">
|
|
119
|
+
export default {
|
|
120
|
+
name: 'Theme',
|
|
121
|
+
}
|
|
122
|
+
</script>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="bk bk-touch-action-bar bk-control">
|
|
3
|
+
<button
|
|
4
|
+
class="bk-button"
|
|
5
|
+
:class="danger ? 'bk-is-danger' : 'bk-is-primary'"
|
|
6
|
+
@click.stop.prevent.capture="$emit('click')"
|
|
7
|
+
>
|
|
8
|
+
{{ label }}
|
|
9
|
+
</button>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
defineProps<{
|
|
15
|
+
label: string
|
|
16
|
+
danger?: boolean
|
|
17
|
+
}>()
|
|
18
|
+
|
|
19
|
+
defineEmits(['click'])
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
export default {
|
|
24
|
+
name: 'TouchActionBar',
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="body">
|
|
3
|
+
<Transition name="bk-touch-bar">
|
|
4
|
+
<Bar
|
|
5
|
+
v-if="
|
|
6
|
+
selection.isMultiSelecting.value &&
|
|
7
|
+
selection.interactionMode.value === 'touch'
|
|
8
|
+
"
|
|
9
|
+
:label="$t('touchBarFinishSelecting', 'Finish selecting')"
|
|
10
|
+
@click="eventBus.emit('select:end', [...selection.uuids.value])"
|
|
11
|
+
/>
|
|
12
|
+
<Bar
|
|
13
|
+
v-else-if="
|
|
14
|
+
selection.isDragging.value && selection.draggingMode.value === 'touch'
|
|
15
|
+
"
|
|
16
|
+
:label="$t('touchBarCancelDragging', 'Cancel dragging')"
|
|
17
|
+
danger
|
|
18
|
+
@click="eventBus.emit('dragging:end')"
|
|
19
|
+
/>
|
|
20
|
+
</Transition>
|
|
21
|
+
</Teleport>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script lang="ts" setup>
|
|
25
|
+
import { useBlokkli, defineBlokkliFeature } from '#imports'
|
|
26
|
+
import Bar from './Bar/index.vue'
|
|
27
|
+
|
|
28
|
+
const { eventBus, selection, $t } = useBlokkli()
|
|
29
|
+
|
|
30
|
+
defineBlokkliFeature({
|
|
31
|
+
id: 'touch-action-bar',
|
|
32
|
+
label: 'Touch Action Bar',
|
|
33
|
+
description: 'Renders a button on touch devices to cancel touch actions.',
|
|
34
|
+
icon: 'button-pointer',
|
|
35
|
+
})
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<script lang="ts">
|
|
39
|
+
export default {
|
|
40
|
+
name: 'TouchActionBarBar',
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport v-if="activeItem" to="body">
|
|
3
|
+
<div class="bk bk-tour" :style="tooltipStyle">
|
|
4
|
+
<div class="bk-tour-inner">
|
|
5
|
+
<div class="bk-tour-title">
|
|
6
|
+
<span>{{ activeItem.title }}</span>
|
|
7
|
+
<button @click.prevent="$emit('close')">
|
|
8
|
+
<Icon name="close" />
|
|
9
|
+
</button>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="bk-tour-content">
|
|
12
|
+
<div
|
|
13
|
+
:style="{
|
|
14
|
+
height: tooltipHeight + 'px',
|
|
15
|
+
}"
|
|
16
|
+
>
|
|
17
|
+
<div
|
|
18
|
+
ref="contentEl"
|
|
19
|
+
class="bk-tour-content-text"
|
|
20
|
+
v-html="activeItem.text"
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="bk-tour-buttons">
|
|
26
|
+
<button @click.stop.prevent="prev">
|
|
27
|
+
<Icon name="chevron-left" />
|
|
28
|
+
<span>{{ $t('tourPrev', 'Previous') }}</span>
|
|
29
|
+
<div class="bk-tooltip">
|
|
30
|
+
<span>Arrow Right</span>
|
|
31
|
+
<ShortcutIndicator label="Prev Tour Item" key-code="ArrowLeft" />
|
|
32
|
+
</div>
|
|
33
|
+
</button>
|
|
34
|
+
<div>
|
|
35
|
+
<span>{{ activeIndex + 1 }}</span
|
|
36
|
+
> /
|
|
37
|
+
<span>{{ items.length }}</span>
|
|
38
|
+
</div>
|
|
39
|
+
<button @click.stop.prevent="next">
|
|
40
|
+
<span>{{ $t('tourNext', 'Next') }}</span>
|
|
41
|
+
<Icon name="chevron-right" />
|
|
42
|
+
<div class="bk-tooltip">
|
|
43
|
+
<span>Arrow Left</span>
|
|
44
|
+
<ShortcutIndicator label="Next Tour Item" key-code="ArrowRight" />
|
|
45
|
+
</div>
|
|
46
|
+
</button>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<div :style="rectStyle" class="bk bk-tour-overlay-element" />
|
|
50
|
+
</Teleport>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<script lang="ts" setup>
|
|
54
|
+
import { useBlokkli, computed, ref } from '#imports'
|
|
55
|
+
import { falsy, modulo } from '#blokkli/helpers'
|
|
56
|
+
import { Icon, ShortcutIndicator } from '#blokkli/components'
|
|
57
|
+
import onBlokkliEvent from '#blokkli/helpers/composables/onBlokkliEvent'
|
|
58
|
+
import useAnimationFrame from '#blokkli/helpers/composables/useAnimationFrame'
|
|
59
|
+
|
|
60
|
+
const emit = defineEmits(['close'])
|
|
61
|
+
|
|
62
|
+
type ItemPosition = 'top' | 'left' | 'bottom' | 'right'
|
|
63
|
+
|
|
64
|
+
const rectStyle = computed(() => {
|
|
65
|
+
return {
|
|
66
|
+
width: activeItem.value.rect.width + 'px',
|
|
67
|
+
height: activeItem.value.rect.height + 'px',
|
|
68
|
+
transform: `translate(${activeItem.value.rect.x}px, ${activeItem.value.rect.y}px)`,
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
const tooltipStyle = computed(() => {
|
|
73
|
+
const x = Math.max(
|
|
74
|
+
Math.min(
|
|
75
|
+
activeItem.value.x - tooltipWidth.value / 2,
|
|
76
|
+
ui.visibleViewportPadded.value.x +
|
|
77
|
+
ui.visibleViewportPadded.value.width -
|
|
78
|
+
tooltipWidth.value,
|
|
79
|
+
),
|
|
80
|
+
ui.visibleViewportPadded.value.x,
|
|
81
|
+
)
|
|
82
|
+
const y = Math.max(
|
|
83
|
+
Math.min(
|
|
84
|
+
activeItem.value.y - tooltipHeight.value / 2,
|
|
85
|
+
ui.visibleViewportPadded.value.y +
|
|
86
|
+
ui.visibleViewportPadded.value.height -
|
|
87
|
+
tooltipHeight.value -
|
|
88
|
+
100,
|
|
89
|
+
),
|
|
90
|
+
ui.visibleViewportPadded.value.y,
|
|
91
|
+
)
|
|
92
|
+
return {
|
|
93
|
+
width: tooltipWidth.value + 'px',
|
|
94
|
+
transform: `translate(${x}px, ${y}px)`,
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
const { tour, ui, $t } = useBlokkli()
|
|
99
|
+
|
|
100
|
+
const activeIndex = ref(0)
|
|
101
|
+
const contentEl = ref<HTMLDivElement | null>(null)
|
|
102
|
+
|
|
103
|
+
const tooltipHeight = ref(100)
|
|
104
|
+
const tooltipWidth = computed(() => {
|
|
105
|
+
return ui.isMobile.value ? Math.min(window.innerWidth - 20, 400) : 400
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
type PositionedTourItem = {
|
|
109
|
+
id: string
|
|
110
|
+
title: string
|
|
111
|
+
text: string
|
|
112
|
+
rect: DOMRect
|
|
113
|
+
x: number
|
|
114
|
+
y: number
|
|
115
|
+
position: ItemPosition
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function calculateCenterPoint(rect: DOMRect): { x: number; y: number } {
|
|
119
|
+
return {
|
|
120
|
+
x: rect.x,
|
|
121
|
+
y: rect.y,
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const viewportCenter = computed(() => ({
|
|
126
|
+
x: ui.viewport.value.width / 2,
|
|
127
|
+
y: ui.viewport.value.height / 2,
|
|
128
|
+
}))
|
|
129
|
+
|
|
130
|
+
const items = computed<PositionedTourItem[]>(() =>
|
|
131
|
+
tour
|
|
132
|
+
.getTourItems()
|
|
133
|
+
.map((item) => {
|
|
134
|
+
if (!item.element) {
|
|
135
|
+
return
|
|
136
|
+
}
|
|
137
|
+
const element =
|
|
138
|
+
typeof item.element === 'function' ? item.element() : item.element
|
|
139
|
+
if (!(element instanceof HTMLElement)) {
|
|
140
|
+
return
|
|
141
|
+
}
|
|
142
|
+
const rect = element.getBoundingClientRect()
|
|
143
|
+
const { x, y, position } = calculatePosition(rect)
|
|
144
|
+
return {
|
|
145
|
+
position,
|
|
146
|
+
id: item.id,
|
|
147
|
+
rect,
|
|
148
|
+
title: item.title,
|
|
149
|
+
text: item.text,
|
|
150
|
+
x,
|
|
151
|
+
y,
|
|
152
|
+
}
|
|
153
|
+
})
|
|
154
|
+
.filter(falsy)
|
|
155
|
+
.sort((a, b) => {
|
|
156
|
+
const centerA = calculateCenterPoint(a.rect)
|
|
157
|
+
const centerB = calculateCenterPoint(b.rect)
|
|
158
|
+
|
|
159
|
+
const angleA = Math.atan2(
|
|
160
|
+
centerA.y - viewportCenter.value.y,
|
|
161
|
+
centerA.x - viewportCenter.value.x,
|
|
162
|
+
)
|
|
163
|
+
const angleB = Math.atan2(
|
|
164
|
+
centerB.y - viewportCenter.value.y,
|
|
165
|
+
centerB.x - viewportCenter.value.x,
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
return angleA - angleB
|
|
169
|
+
}),
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
const activeItem = computed(() => items.value[activeIndex.value])
|
|
173
|
+
|
|
174
|
+
const prev = () => {
|
|
175
|
+
activeIndex.value = modulo(activeIndex.value - 1, items.value.length)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const next = () => {
|
|
179
|
+
activeIndex.value = modulo(activeIndex.value + 1, items.value.length)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const getIdealPosition = (rect: DOMRect): ItemPosition => {
|
|
183
|
+
if (rect.y < 20) {
|
|
184
|
+
return 'bottom'
|
|
185
|
+
} else if (
|
|
186
|
+
rect.y >
|
|
187
|
+
ui.visibleViewportPadded.value.y + ui.visibleViewportPadded.value.height
|
|
188
|
+
) {
|
|
189
|
+
return 'top'
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Calculate available space around the element
|
|
193
|
+
const availableSpace: Record<ItemPosition, number> = {
|
|
194
|
+
top: rect.top,
|
|
195
|
+
bottom: ui.visibleViewportPadded.value.height - rect.bottom,
|
|
196
|
+
left: rect.left,
|
|
197
|
+
right: ui.viewport.value.width - rect.right,
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Determine the best position for the tooltip
|
|
201
|
+
const sortedSpaces = (
|
|
202
|
+
Object.entries(availableSpace) as [ItemPosition, number][]
|
|
203
|
+
).sort((a, b) => b[1] - a[1])
|
|
204
|
+
|
|
205
|
+
return sortedSpaces[0][0]
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function calculatePosition(rect: DOMRect): {
|
|
209
|
+
x: number
|
|
210
|
+
y: number
|
|
211
|
+
position: ItemPosition
|
|
212
|
+
} {
|
|
213
|
+
const position = getIdealPosition(rect)
|
|
214
|
+
|
|
215
|
+
switch (position) {
|
|
216
|
+
case 'top':
|
|
217
|
+
return {
|
|
218
|
+
position,
|
|
219
|
+
y: ui.viewport.value.height,
|
|
220
|
+
x: rect.x + rect.width / 2,
|
|
221
|
+
}
|
|
222
|
+
case 'bottom':
|
|
223
|
+
return {
|
|
224
|
+
position,
|
|
225
|
+
x: rect.x + rect.width / 2,
|
|
226
|
+
y: rect.bottom,
|
|
227
|
+
}
|
|
228
|
+
case 'left':
|
|
229
|
+
return {
|
|
230
|
+
position,
|
|
231
|
+
y: rect.y + rect.height / 2,
|
|
232
|
+
x: rect.x,
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return {
|
|
237
|
+
position,
|
|
238
|
+
x: rect.right + 20,
|
|
239
|
+
y: Math.max(rect.top, 70),
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
onBlokkliEvent('keyPressed', (e) => {
|
|
244
|
+
if (e.code === 'Tab') {
|
|
245
|
+
e.originalEvent.preventDefault()
|
|
246
|
+
if (e.shift) {
|
|
247
|
+
prev()
|
|
248
|
+
} else {
|
|
249
|
+
next()
|
|
250
|
+
}
|
|
251
|
+
} else if (e.code === 'Escape') {
|
|
252
|
+
e.originalEvent.preventDefault()
|
|
253
|
+
emit('close')
|
|
254
|
+
} else if (e.code === 'ArrowLeft') {
|
|
255
|
+
e.originalEvent.preventDefault()
|
|
256
|
+
prev()
|
|
257
|
+
} else if (e.code === 'ArrowRight') {
|
|
258
|
+
e.originalEvent.preventDefault()
|
|
259
|
+
next()
|
|
260
|
+
}
|
|
261
|
+
})
|
|
262
|
+
|
|
263
|
+
useAnimationFrame(() => {
|
|
264
|
+
if (!contentEl.value) {
|
|
265
|
+
return
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
tooltipHeight.value = contentEl.value.scrollHeight + 50
|
|
269
|
+
})
|
|
270
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="body">
|
|
3
|
+
<ViewportBlockingRect id="tour-popup" class="bk bk-tour-popup">
|
|
4
|
+
<div class="bk-tour-popup-title">
|
|
5
|
+
<h2>{{ $t('tourLabel', 'Take a tour') }}</h2>
|
|
6
|
+
<button class="bk-tour-popup-close" @click="$emit('close')">
|
|
7
|
+
<Icon name="close" />
|
|
8
|
+
</button>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<div class="bk-tour-popup-content">
|
|
12
|
+
<p>
|
|
13
|
+
{{
|
|
14
|
+
$t(
|
|
15
|
+
'tourIntro',
|
|
16
|
+
'Explore the most important features of the editor and learn how to get started using blökkli.',
|
|
17
|
+
)
|
|
18
|
+
}}
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
<button class="bk-button" @click="$emit('start')">
|
|
22
|
+
{{ $t('tourStartButton', 'Start the tour') }}
|
|
23
|
+
</button>
|
|
24
|
+
</div>
|
|
25
|
+
</ViewportBlockingRect>
|
|
26
|
+
</Teleport>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script lang="ts" setup>
|
|
30
|
+
import { Icon, ViewportBlockingRect } from '#blokkli/components'
|
|
31
|
+
import { useBlokkli } from '#imports'
|
|
32
|
+
|
|
33
|
+
const { $t } = useBlokkli()
|
|
34
|
+
|
|
35
|
+
defineEmits(['start', 'close'])
|
|
36
|
+
</script>
|
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Overlay v-if="tour.isTouring.value" @close="close" />
|
|
3
|
+
<PluginMenuButton
|
|
4
|
+
id="tour"
|
|
5
|
+
:title="$t('tourLabel', 'Take a tour')"
|
|
6
|
+
:description="$t('tourDescription', 'Explore the features of the editor')"
|
|
7
|
+
icon="tutor"
|
|
8
|
+
secondary
|
|
9
|
+
:weight="-10"
|
|
10
|
+
@click="start"
|
|
11
|
+
/>
|
|
12
|
+
<Popup v-if="showTourPopup" @close="close" @start="start" />
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script lang="ts" setup>
|
|
16
|
+
import { defineBlokkliFeature, useBlokkli } from '#imports'
|
|
17
|
+
import Overlay from './Overlay/index.vue'
|
|
18
|
+
import { PluginMenuButton } from '#blokkli/plugins'
|
|
19
|
+
import Popup from './Popup/index.vue'
|
|
20
|
+
|
|
21
|
+
defineBlokkliFeature({
|
|
22
|
+
id: 'tour',
|
|
23
|
+
label: 'Tour',
|
|
24
|
+
icon: 'tutor',
|
|
25
|
+
description: 'Provides a tour overlay to get to know the editor.',
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const { tour, $t, storage } = useBlokkli()
|
|
29
|
+
|
|
30
|
+
const showTourPopup = storage.use('showTourPopup', true)
|
|
31
|
+
|
|
32
|
+
const start = () => {
|
|
33
|
+
showTourPopup.value = false
|
|
34
|
+
tour.isTouring.value = true
|
|
35
|
+
}
|
|
36
|
+
const close = () => {
|
|
37
|
+
showTourPopup.value = false
|
|
38
|
+
tour.isTouring.value = false
|
|
39
|
+
}
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<script lang="ts">
|
|
43
|
+
export default {
|
|
44
|
+
name: 'Tour',
|
|
45
|
+
}
|
|
46
|
+
</script>
|