@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,263 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="body">
|
|
3
|
+
<div class="bk bk-blokkli-item-actions bk-control" @click.stop>
|
|
4
|
+
<div
|
|
5
|
+
v-show="
|
|
6
|
+
selection.blocks.value.length &&
|
|
7
|
+
!selection.isDragging.value &&
|
|
8
|
+
!selection.editableActive.value &&
|
|
9
|
+
!ui.isAnimating.value
|
|
10
|
+
"
|
|
11
|
+
ref="el"
|
|
12
|
+
class="bk-blokkli-item-actions-inner"
|
|
13
|
+
>
|
|
14
|
+
<div
|
|
15
|
+
id="bk-blokkli-item-actions-controls"
|
|
16
|
+
ref="controlsEl"
|
|
17
|
+
class="bk-blokkli-item-actions-controls"
|
|
18
|
+
>
|
|
19
|
+
<div id="bk-blokkli-item-actions-title">
|
|
20
|
+
<button
|
|
21
|
+
class="bk-blokkli-item-actions-type-button"
|
|
22
|
+
:disabled="!shouldRenderButton"
|
|
23
|
+
:title="title"
|
|
24
|
+
:class="{
|
|
25
|
+
'is-open': showDropdown,
|
|
26
|
+
'is-interactive': shouldRenderButton,
|
|
27
|
+
'bk-is-reusable': itemBundle?.id === 'from_library',
|
|
28
|
+
'bk-is-fragment': itemBundle?.id === 'blokkli_fragment',
|
|
29
|
+
}"
|
|
30
|
+
@click.prevent="showDropdown = !showDropdown"
|
|
31
|
+
>
|
|
32
|
+
<div class="bk-blokkli-item-actions-title-icon">
|
|
33
|
+
<ItemIcon v-if="bundleIcon" :bundle="bundleIcon" />
|
|
34
|
+
<Icon v-else name="selection" />
|
|
35
|
+
</div>
|
|
36
|
+
<span class="bk-blokkli-item-actions-title-label">{{
|
|
37
|
+
title
|
|
38
|
+
}}</span>
|
|
39
|
+
<span
|
|
40
|
+
v-if="selection.blocks.value.length > 1"
|
|
41
|
+
class="bk-blokkli-item-actions-title-count"
|
|
42
|
+
>{{ selection.blocks.value.length }}</span
|
|
43
|
+
>
|
|
44
|
+
<Icon v-if="shouldRenderButton" name="caret" class="bk-caret" />
|
|
45
|
+
</button>
|
|
46
|
+
<div
|
|
47
|
+
v-show="showDropdown && editingEnabled"
|
|
48
|
+
id="bk-blokkli-item-actions-dropdown"
|
|
49
|
+
class="bk-blokkli-item-actions-type-dropdown"
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<div id="bk-blokkli-item-actions-after" />
|
|
54
|
+
|
|
55
|
+
<div
|
|
56
|
+
id="bk-blokkli-item-actions"
|
|
57
|
+
class="bk-blokkli-item-actions-buttons"
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</Teleport>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script lang="ts" setup>
|
|
66
|
+
import {
|
|
67
|
+
watch,
|
|
68
|
+
ref,
|
|
69
|
+
computed,
|
|
70
|
+
useBlokkli,
|
|
71
|
+
onMounted,
|
|
72
|
+
onBeforeUnmount,
|
|
73
|
+
} from '#imports'
|
|
74
|
+
import { onlyUnique, findIdealRectPosition, falsy } from '#blokkli/helpers'
|
|
75
|
+
import type { Rectangle, PluginMountEvent } from '#blokkli/types'
|
|
76
|
+
import { ItemIcon, Icon } from '#blokkli/components'
|
|
77
|
+
import onBlokkliEvent from '#blokkli/helpers/composables/onBlokkliEvent'
|
|
78
|
+
import { getFragmentDefinition } from '#blokkli/definitions'
|
|
79
|
+
|
|
80
|
+
const { selection, $t, types, state, ui, dom } = useBlokkli()
|
|
81
|
+
|
|
82
|
+
const editingEnabled = computed(() => state.editMode.value === 'editing')
|
|
83
|
+
|
|
84
|
+
const ACTIONS_HEIGHT = 50
|
|
85
|
+
|
|
86
|
+
const el = ref<HTMLDivElement | null>(null)
|
|
87
|
+
|
|
88
|
+
const controlsEl = ref<HTMLElement | null>(null)
|
|
89
|
+
const mountedPlugins = ref<PluginMountEvent[]>([])
|
|
90
|
+
const showDropdown = ref(false)
|
|
91
|
+
|
|
92
|
+
watch(selection.blocks, () => {
|
|
93
|
+
showDropdown.value = false
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
const bundleIcon = computed(() => {
|
|
97
|
+
if (itemBundle.value?.id === 'from_library') {
|
|
98
|
+
const reusableBundle = selection.blocks.value[0]?.reusableBundle
|
|
99
|
+
if (reusableBundle) {
|
|
100
|
+
return reusableBundle
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return itemBundle.value?.id
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
const title = computed(() => {
|
|
108
|
+
if (itemBundle.value) {
|
|
109
|
+
if (itemBundle.value.id === 'blokkli_fragment') {
|
|
110
|
+
const fragments = selection.uuids.value
|
|
111
|
+
.map((uuid) => {
|
|
112
|
+
const item = state.getFieldListItem(uuid)
|
|
113
|
+
if (!item) {
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
const name = item.props?.name
|
|
117
|
+
if (!name) {
|
|
118
|
+
return
|
|
119
|
+
}
|
|
120
|
+
const definition = getFragmentDefinition(name)
|
|
121
|
+
return definition?.label
|
|
122
|
+
})
|
|
123
|
+
.filter(falsy)
|
|
124
|
+
|
|
125
|
+
if (fragments.length && fragments.length < 3) {
|
|
126
|
+
return fragments.join(', ')
|
|
127
|
+
}
|
|
128
|
+
} else if (itemBundle.value.id === 'from_library') {
|
|
129
|
+
const title = selection.blocks.value[0]?.editTitle
|
|
130
|
+
if (title) {
|
|
131
|
+
return title
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return itemBundle.value.label
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return $t('multipleItemsLabel', 'Items')
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
const itemBundleIds = computed(() =>
|
|
141
|
+
selection.blocks.value.map((v) => v.itemBundle).filter(onlyUnique),
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
const itemBundle = computed(() => {
|
|
145
|
+
if (itemBundleIds.value.length !== 1) {
|
|
146
|
+
return
|
|
147
|
+
}
|
|
148
|
+
const bundle = itemBundleIds.value[0]
|
|
149
|
+
return types.getBlockBundleDefinition(bundle)
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
const limitPlacedRect = (rect: Rectangle, padding: Rectangle): Rectangle => {
|
|
153
|
+
return {
|
|
154
|
+
width: rect.width,
|
|
155
|
+
height: rect.height,
|
|
156
|
+
x: Math.min(
|
|
157
|
+
Math.max(rect.x, padding.x),
|
|
158
|
+
padding.x + padding.width - rect.width,
|
|
159
|
+
),
|
|
160
|
+
y: Math.min(
|
|
161
|
+
Math.max(padding.y, rect.y),
|
|
162
|
+
padding.height + padding.y - rect.height,
|
|
163
|
+
),
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
let scrollWidth = 0
|
|
168
|
+
|
|
169
|
+
const observer = new ResizeObserver((entries) => {
|
|
170
|
+
const size = entries[0]?.contentBoxSize?.[0]
|
|
171
|
+
if (!size) {
|
|
172
|
+
return
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
scrollWidth = size.inlineSize
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
onMounted(() => {
|
|
179
|
+
if (controlsEl.value) {
|
|
180
|
+
observer.observe(controlsEl.value)
|
|
181
|
+
}
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
onBeforeUnmount(() => {
|
|
185
|
+
if (controlsEl.value) {
|
|
186
|
+
observer.unobserve(controlsEl.value)
|
|
187
|
+
observer.disconnect()
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
onBlokkliEvent('canvas:draw', () => {
|
|
192
|
+
if (!selection.blocks.value.length || ui.isMobile.value) {
|
|
193
|
+
return
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
let minX = 0
|
|
197
|
+
let minY = 0
|
|
198
|
+
const rects = selection.uuids.value
|
|
199
|
+
.map((uuid) => dom.getBlockRect(uuid))
|
|
200
|
+
.filter(falsy)
|
|
201
|
+
const offset = ui.artboardOffset.value
|
|
202
|
+
const scale = ui.artboardScale.value
|
|
203
|
+
|
|
204
|
+
for (let i = 0; i < rects.length; i++) {
|
|
205
|
+
const { x, y } = rects[i]
|
|
206
|
+
const rectX = (x + offset.x / scale) * scale
|
|
207
|
+
const rectY = (y + offset.y / scale) * scale
|
|
208
|
+
if (i === 0 || rectX < minX) {
|
|
209
|
+
minX = rectX
|
|
210
|
+
}
|
|
211
|
+
if (i === 0 || rectY < minY) {
|
|
212
|
+
minY = rectY
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const padding = ui.visibleViewportPadded.value
|
|
217
|
+
const rect = limitPlacedRect(
|
|
218
|
+
{
|
|
219
|
+
x: minX,
|
|
220
|
+
y: minY - ACTIONS_HEIGHT - 15,
|
|
221
|
+
width: scrollWidth,
|
|
222
|
+
height: ACTIONS_HEIGHT,
|
|
223
|
+
},
|
|
224
|
+
padding,
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
const ideal = findIdealRectPosition(
|
|
228
|
+
ui.viewportBlockingRects.value,
|
|
229
|
+
rect,
|
|
230
|
+
padding,
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
if (el.value) {
|
|
234
|
+
el.value.style.transform = ui.isMobile.value
|
|
235
|
+
? ''
|
|
236
|
+
: `translate3d(${Math.round(ideal.x)}px, ${Math.round(ideal.y)}px, 0)`
|
|
237
|
+
}
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
const shouldRenderButton = computed(() =>
|
|
241
|
+
mountedPlugins.value.some((v) => v.isRendering),
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
onBlokkliEvent('plugin:mount', (e) => {
|
|
245
|
+
if (e.type !== 'ItemDropdown') {
|
|
246
|
+
return
|
|
247
|
+
}
|
|
248
|
+
mountedPlugins.value.push(e as any)
|
|
249
|
+
})
|
|
250
|
+
|
|
251
|
+
onBlokkliEvent('plugin:unmount', (e) => {
|
|
252
|
+
if (e.type !== 'ItemDropdown') {
|
|
253
|
+
return
|
|
254
|
+
}
|
|
255
|
+
mountedPlugins.value = mountedPlugins.value.filter((v) => v.type !== e.id)
|
|
256
|
+
})
|
|
257
|
+
</script>
|
|
258
|
+
|
|
259
|
+
<script lang="ts">
|
|
260
|
+
export default {
|
|
261
|
+
name: 'ItemActions',
|
|
262
|
+
}
|
|
263
|
+
</script>
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<PluginContextMenu
|
|
3
|
+
:id="'add_list_item_' + id"
|
|
4
|
+
ref="el"
|
|
5
|
+
tag="button"
|
|
6
|
+
class="bk-list-item"
|
|
7
|
+
data-element-type="action"
|
|
8
|
+
:menu="menu"
|
|
9
|
+
:data-sortli-id="id"
|
|
10
|
+
:class="[
|
|
11
|
+
{
|
|
12
|
+
'bk-is-disabled': disabled,
|
|
13
|
+
},
|
|
14
|
+
'bk-is-' + orientation,
|
|
15
|
+
'bk-is-' + color,
|
|
16
|
+
]"
|
|
17
|
+
>
|
|
18
|
+
<div class="bk-list-item-inner">
|
|
19
|
+
<div class="bk-list-item-icon">
|
|
20
|
+
<Icon v-if="icon" :name="icon" />
|
|
21
|
+
<ItemIcon v-else-if="bundle" :bundle="bundle" />
|
|
22
|
+
</div>
|
|
23
|
+
<div
|
|
24
|
+
class="bk-list-item-label"
|
|
25
|
+
:class="{
|
|
26
|
+
'bk-tooltip': orientation === 'horizontal' && !ui.isMobile.value,
|
|
27
|
+
}"
|
|
28
|
+
>
|
|
29
|
+
<span>{{ label }}</span>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<div
|
|
34
|
+
class="bk-add-list-drop bk-drop-element"
|
|
35
|
+
:class="['bk-is-' + color, { 'bk-is-dark': isDark }]"
|
|
36
|
+
>
|
|
37
|
+
<div class="bk-add-list-drop-icon">
|
|
38
|
+
<ItemIcon v-if="bundle" :bundle="bundle" />
|
|
39
|
+
<Icon v-else-if="icon" :name="icon" />
|
|
40
|
+
</div>
|
|
41
|
+
<span>{{ label }}</span>
|
|
42
|
+
</div>
|
|
43
|
+
</PluginContextMenu>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script lang="ts" setup>
|
|
47
|
+
import type { BlokkliIcon } from '#blokkli/icons'
|
|
48
|
+
import type { AddListOrientation, ContextMenu } from '#blokkli/types'
|
|
49
|
+
import { useBlokkli, computed, ref } from '#imports'
|
|
50
|
+
import { ItemIcon, Icon } from '#blokkli/components'
|
|
51
|
+
import { PluginContextMenu } from '#blokkli/plugins'
|
|
52
|
+
|
|
53
|
+
const { ui, storage, $t } = useBlokkli()
|
|
54
|
+
|
|
55
|
+
const props = withDefaults(
|
|
56
|
+
defineProps<{
|
|
57
|
+
id: string
|
|
58
|
+
label: string
|
|
59
|
+
orientation: AddListOrientation
|
|
60
|
+
color?: 'rose' | 'lime' | 'default' | 'yellow' | 'accent'
|
|
61
|
+
bundle?: string
|
|
62
|
+
icon?: BlokkliIcon
|
|
63
|
+
disabled?: boolean
|
|
64
|
+
noContextMenu?: boolean
|
|
65
|
+
}>(),
|
|
66
|
+
{
|
|
67
|
+
color: 'default',
|
|
68
|
+
bundle: '',
|
|
69
|
+
icon: undefined,
|
|
70
|
+
},
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
const el = ref<InstanceType<typeof PluginContextMenu> | null>(null)
|
|
74
|
+
|
|
75
|
+
const favorites = storage.use<string[]>('blockFavorites', [])
|
|
76
|
+
|
|
77
|
+
const isFavorite = computed(() => favorites.value.includes(props.id))
|
|
78
|
+
|
|
79
|
+
const isDark = computed(
|
|
80
|
+
() => props.orientation !== 'sidebar' && props.color === 'default',
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
const toggleFavorite = () => {
|
|
84
|
+
if (favorites.value.includes(props.id)) {
|
|
85
|
+
favorites.value = favorites.value.filter((v) => v !== props.id)
|
|
86
|
+
} else {
|
|
87
|
+
favorites.value = [...favorites.value, props.id]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const menu = computed<ContextMenu[]>(() => {
|
|
92
|
+
if (props.noContextMenu) {
|
|
93
|
+
return []
|
|
94
|
+
}
|
|
95
|
+
return [
|
|
96
|
+
{
|
|
97
|
+
type: 'button',
|
|
98
|
+
label: isFavorite.value
|
|
99
|
+
? $t('addListItemFavoriteRemove', 'Remove from favorites')
|
|
100
|
+
: $t('addListItemFavoriteAdd', 'Add to favorites'),
|
|
101
|
+
icon: isFavorite.value ? 'unstar' : 'star',
|
|
102
|
+
callback: toggleFavorite,
|
|
103
|
+
},
|
|
104
|
+
]
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
const getElement = (): HTMLElement | null => el.value?.$el
|
|
108
|
+
|
|
109
|
+
defineExpose({ getElement })
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<script lang="ts">
|
|
113
|
+
export default {
|
|
114
|
+
name: 'AddListItem',
|
|
115
|
+
}
|
|
116
|
+
</script>
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="body">
|
|
3
|
+
<canvas id="bk-animation-canvas-webgl" ref="canvasGl" />
|
|
4
|
+
</Teleport>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import onBlokkliEvent from '#blokkli/helpers/composables/onBlokkliEvent'
|
|
9
|
+
import type { Rectangle } from '#blokkli/types'
|
|
10
|
+
import { ref, computed, useBlokkli, onMounted, watch } from '#imports'
|
|
11
|
+
|
|
12
|
+
const { ui, animation, eventBus } = useBlokkli()
|
|
13
|
+
|
|
14
|
+
const canvasGl = ref<HTMLCanvasElement | null>(null)
|
|
15
|
+
|
|
16
|
+
const canvasAttributes = computed(() => {
|
|
17
|
+
return {
|
|
18
|
+
width: ui.viewport.value.width * animation.dpi.value,
|
|
19
|
+
height: ui.viewport.value.height * animation.dpi.value,
|
|
20
|
+
style: {
|
|
21
|
+
width: ui.viewport.value.width + 'px',
|
|
22
|
+
height: ui.viewport.value.height + 'px',
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
let gl: WebGLRenderingContext | null | undefined = null
|
|
28
|
+
|
|
29
|
+
function initGl() {
|
|
30
|
+
if (!canvasGl.value) {
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
gl = animation.gl()
|
|
34
|
+
|
|
35
|
+
canvasGl.value.width = canvasAttributes.value.width
|
|
36
|
+
canvasGl.value.height = canvasAttributes.value.height
|
|
37
|
+
|
|
38
|
+
if (!gl) {
|
|
39
|
+
return
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
gl.enable(gl.BLEND)
|
|
43
|
+
gl.enable(gl.SCISSOR_TEST)
|
|
44
|
+
gl.disable(gl.DEPTH_TEST)
|
|
45
|
+
|
|
46
|
+
gl.clearColor(0.0, 0.0, 0.0, 0.0)
|
|
47
|
+
gl.viewport(0, 0, canvasAttributes.value.width, canvasAttributes.value.height)
|
|
48
|
+
// gl.blendFunc(gl[source.value as any], gl[destination.value as any])
|
|
49
|
+
// gl.blendEquation(gl[equtation.value as any])
|
|
50
|
+
gl.blendFunc(gl.SRC_ALPHA_SATURATE, gl.ONE)
|
|
51
|
+
gl.blendEquation(gl.FUNC_ADD)
|
|
52
|
+
setScissor(scissor.value)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const scissor = computed(() => {
|
|
56
|
+
const dpi = animation.dpi.value
|
|
57
|
+
return {
|
|
58
|
+
x: ui.visibleViewport.value.x * dpi,
|
|
59
|
+
y:
|
|
60
|
+
canvasAttributes.value.height -
|
|
61
|
+
ui.visibleViewport.value.y * dpi -
|
|
62
|
+
ui.visibleViewport.value.height * dpi,
|
|
63
|
+
width: ui.visibleViewport.value.width * dpi,
|
|
64
|
+
height: ui.visibleViewport.value.height * dpi,
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
function setScissor(v: Rectangle) {
|
|
69
|
+
if (!gl) {
|
|
70
|
+
return
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
gl.scissor(v.x, v.y, v.width, v.height)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
watch(scissor, setScissor)
|
|
77
|
+
|
|
78
|
+
let lastCanvasWidth = 0
|
|
79
|
+
let lastCanvasHeight = 0
|
|
80
|
+
|
|
81
|
+
onBlokkliEvent('animationFrame', (e) => {
|
|
82
|
+
if (!canvasGl.value) {
|
|
83
|
+
return
|
|
84
|
+
}
|
|
85
|
+
const canvasWidth = canvasAttributes.value.width
|
|
86
|
+
const canvasHeight = canvasAttributes.value.height
|
|
87
|
+
|
|
88
|
+
// Only update width and height if they have changed.
|
|
89
|
+
if (canvasWidth !== lastCanvasWidth || canvasHeight !== lastCanvasHeight) {
|
|
90
|
+
canvasGl.value.width = canvasWidth
|
|
91
|
+
canvasGl.value.height = canvasHeight
|
|
92
|
+
if (gl) {
|
|
93
|
+
gl.viewport(0, 0, canvasWidth, canvasHeight)
|
|
94
|
+
}
|
|
95
|
+
lastCanvasWidth = canvasWidth
|
|
96
|
+
lastCanvasHeight = canvasHeight
|
|
97
|
+
}
|
|
98
|
+
const offset = ui.artboardOffset.value
|
|
99
|
+
const scale = ui.artboardScale.value
|
|
100
|
+
// const size = ui.artboardSize.value
|
|
101
|
+
// const dpi = animation.dpi.value
|
|
102
|
+
// Restrict drawing to area on and 20px around artboard.
|
|
103
|
+
// gl.scissor(
|
|
104
|
+
// offset.x * dpi - 20,
|
|
105
|
+
// canvasHeight - offset.y * dpi - 20 - size.height * dpi * scale,
|
|
106
|
+
// size.width * scale * dpi + 40,
|
|
107
|
+
// size.height * scale * dpi + 40,
|
|
108
|
+
// )
|
|
109
|
+
// gl.clearColor(1.0, 0.0, 0.0, 0.4)
|
|
110
|
+
// gl.clear(gl.COLOR_BUFFER_BIT)
|
|
111
|
+
|
|
112
|
+
eventBus.emit('canvas:draw', {
|
|
113
|
+
...e,
|
|
114
|
+
artboardOffset: offset,
|
|
115
|
+
artboardScale: scale,
|
|
116
|
+
})
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
onMounted(() => {
|
|
120
|
+
initGl()
|
|
121
|
+
})
|
|
122
|
+
</script>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="#bk-toolbar-menu">
|
|
3
|
+
<div class="bk-toolbar-menu">
|
|
4
|
+
<button class="bk-toolbar-menu-button" @click.prevent.stop="onClick">
|
|
5
|
+
<Icon name="menu" />
|
|
6
|
+
</button>
|
|
7
|
+
</div>
|
|
8
|
+
</Teleport>
|
|
9
|
+
<Teleport to="body">
|
|
10
|
+
<transition name="bk-fade" :duration="200">
|
|
11
|
+
<div
|
|
12
|
+
v-if="menuOpen"
|
|
13
|
+
class="bk bk-menu-overlay bk-overlay"
|
|
14
|
+
@click="ui.menu.close()"
|
|
15
|
+
/>
|
|
16
|
+
</transition>
|
|
17
|
+
<transition name="bk-menu" :duration="200">
|
|
18
|
+
<div v-show="menuOpen" class="bk bk-menu-list">
|
|
19
|
+
<button :class="{ 'bk-is-active': menuOpen }" @click="ui.menu.close">
|
|
20
|
+
<Icon name="close" />
|
|
21
|
+
</button>
|
|
22
|
+
<div class="bk-menu-list-inner">
|
|
23
|
+
<div id="bk-menu-primary" />
|
|
24
|
+
<div id="bk-menu-secondary" />
|
|
25
|
+
<aside class="bk-menu-meta">
|
|
26
|
+
<div class="bk-menu-meta-logo">
|
|
27
|
+
<Icon name="logo" />
|
|
28
|
+
<div><strong>@blokkli/editor</strong> {{ blokkliVersion }}</div>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div>
|
|
32
|
+
<a href="https://www.blokk.li" target="_blank">blokk.li</a>
|
|
33
|
+
</div>
|
|
34
|
+
</aside>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</transition>
|
|
38
|
+
</Teleport>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
import { computed, useBlokkli } from '#imports'
|
|
43
|
+
import { Icon } from '#blokkli/components'
|
|
44
|
+
import { blokkliVersion } from '#blokkli/config'
|
|
45
|
+
|
|
46
|
+
const { ui, eventBus } = useBlokkli()
|
|
47
|
+
|
|
48
|
+
const menuOpen = computed(() => ui.menu.isOpen.value)
|
|
49
|
+
|
|
50
|
+
const onClick = () => {
|
|
51
|
+
eventBus.emit('select', '')
|
|
52
|
+
ui.menu.open()
|
|
53
|
+
}
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<script lang="ts">
|
|
57
|
+
export default {
|
|
58
|
+
name: 'AppMenu',
|
|
59
|
+
}
|
|
60
|
+
</script>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<slot />
|
|
3
|
+
|
|
4
|
+
<Teleport to="body">
|
|
5
|
+
<Transition name="bk-fade">
|
|
6
|
+
<div
|
|
7
|
+
v-if="errors.length"
|
|
8
|
+
class="bk bk-fatal-error-overlay"
|
|
9
|
+
@wheel.capture.passive.stop
|
|
10
|
+
@click.stop
|
|
11
|
+
@mousedown.stop
|
|
12
|
+
@touchstart.passive.stop
|
|
13
|
+
@mousemove.stop
|
|
14
|
+
>
|
|
15
|
+
<div class="bk-fatal-error-overlay-info">
|
|
16
|
+
<Icon name="sad" />
|
|
17
|
+
<div>
|
|
18
|
+
<h2>{{ $t('fatalErrorTitle', 'blökkli has stopped working') }}</h2>
|
|
19
|
+
<p>
|
|
20
|
+
{{
|
|
21
|
+
$t(
|
|
22
|
+
'fatalErrorText',
|
|
23
|
+
'Unfortunately blökkli has encountered a fatal error which prevents it from working normally. You may be able to continue using it, but things may not work as expected.',
|
|
24
|
+
)
|
|
25
|
+
}}
|
|
26
|
+
</p>
|
|
27
|
+
<button class="bk-button bk-is-danger" @click="errors = []">
|
|
28
|
+
{{ $t('fatalErrorButton', 'Continue anyway...') }}
|
|
29
|
+
</button>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
<div class="bk-fatal-error-overlay-list">
|
|
33
|
+
<div v-for="(e, i) in unique" :key="i">
|
|
34
|
+
<h3>{{ e.name }}: {{ e.message }}</h3>
|
|
35
|
+
<code>
|
|
36
|
+
<pre>{{ e.stack }}</pre>
|
|
37
|
+
</code>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</Transition>
|
|
42
|
+
</Teleport>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script lang="ts" setup>
|
|
46
|
+
import { computed, ref, onErrorCaptured } from '#imports'
|
|
47
|
+
import { Icon } from '#blokkli/components'
|
|
48
|
+
import textProvider from '#blokkli/helpers/textProvider'
|
|
49
|
+
|
|
50
|
+
const errors = ref<Error[]>([])
|
|
51
|
+
|
|
52
|
+
const $t = textProvider()
|
|
53
|
+
|
|
54
|
+
onErrorCaptured((err) => {
|
|
55
|
+
errors.value.push(err)
|
|
56
|
+
return false
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const unique = computed(() => {
|
|
60
|
+
return errors.value.filter((value, index, self) => {
|
|
61
|
+
return self.findIndex((v) => v.name === value.name) === index
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
</script>
|