@blokkli/editor 1.4.0-alpha.1 → 2.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.d.mts +12 -194
- package/dist/module.json +4 -4
- package/dist/module.mjs +1847 -1306
- package/dist/modules/drupal/adapter/index.d.mts +6 -0
- package/dist/modules/drupal/adapter/index.mjs +762 -0
- package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliEditState.graphql +44 -0
- package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliMutatedField.graphql +11 -0
- package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliMutationItem.graphql +9 -0
- package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliMutationResult.graphql +7 -0
- package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliViolation.graphql +7 -0
- package/dist/modules/drupal/graphql/base/query.pbConfig.graphql +96 -0
- package/dist/modules/drupal/graphql/base/query.pbEditState.graphql +15 -0
- package/dist/modules/drupal/graphql/features/conversions.graphql +44 -0
- package/dist/modules/drupal/graphql/features/import-existing.graphql +34 -0
- package/dist/{runtime/adapter/drupal/graphql → modules/drupal/graphql/features}/library.graphql +17 -0
- package/dist/modules/drupal/graphql/features/media-library.graphql +28 -0
- package/dist/modules/drupal/graphql/features/preview-grant.graphql +13 -0
- package/dist/modules/drupal/graphql/features/publish.graphql +15 -0
- package/dist/modules/drupal/graphql/features/publishNew.graphql +59 -0
- package/dist/modules/drupal/graphql/mutations/add.graphql +25 -0
- package/dist/modules/drupal/graphql/mutations/add_clipboard_text.graphql +25 -0
- package/dist/modules/drupal/graphql/mutations/add_entity_reference.graphql +31 -0
- package/dist/modules/drupal/graphql/mutations/add_entity_reference_multiple.graphql +25 -0
- package/dist/modules/drupal/graphql/mutations/add_file.graphql +27 -0
- package/dist/modules/drupal/graphql/mutations/add_image.graphql +27 -0
- package/dist/modules/drupal/graphql/mutations/add_video_remote.graphql +25 -0
- package/dist/modules/drupal/graphql/mutations/bulk_update_behavior_settings.graphql +15 -0
- package/dist/modules/drupal/graphql/mutations/duplicate.graphql +33 -0
- package/dist/modules/drupal/graphql/mutations/move.graphql +25 -0
- package/dist/modules/drupal/graphql/mutations/move_multiple.graphql +25 -0
- package/dist/modules/drupal/graphql/mutations/redo.graphql +14 -0
- package/dist/modules/drupal/graphql/mutations/remove.graphql +15 -0
- package/dist/modules/drupal/graphql/mutations/remove_multiple.graphql +15 -0
- package/dist/modules/drupal/graphql/mutations/replace_host_entity_media.graphql +20 -0
- package/dist/modules/drupal/graphql/mutations/replace_media.graphql +22 -0
- package/dist/modules/drupal/graphql/mutations/revertAllChanges.graphql +14 -0
- package/dist/modules/drupal/graphql/mutations/setHistoryIndex.graphql +15 -0
- package/dist/modules/drupal/graphql/mutations/setMutationStatus.graphql +16 -0
- package/dist/modules/drupal/graphql/mutations/takeOwnership.graphql +14 -0
- package/dist/modules/drupal/graphql/mutations/undo.graphql +14 -0
- package/dist/modules/drupal/graphql/mutations/update_behavior_setting.graphql +23 -0
- package/dist/modules/drupal/graphql/mutations/update_field_value.graphql +22 -0
- package/dist/modules/drupal/graphql/mutations/update_host_entity_field_value.graphql +20 -0
- package/dist/modules/drupal/index.d.mts +10 -0
- package/dist/modules/drupal/index.mjs +170 -0
- package/dist/runtime/adapter/index.d.ts +30 -4
- package/dist/runtime/blokkliPlugins/AddAction/index.vue +39 -54
- package/dist/runtime/blokkliPlugins/AddAction/index.vue.d.ts +26 -0
- package/dist/runtime/blokkliPlugins/ContextMenu/Menu/index.vue +38 -64
- package/dist/runtime/blokkliPlugins/ContextMenu/Menu/index.vue.d.ts +12 -0
- package/dist/runtime/blokkliPlugins/ContextMenu/index.vue +19 -30
- package/dist/runtime/blokkliPlugins/ContextMenu/index.vue.d.ts +37 -0
- package/dist/runtime/blokkliPlugins/DebugOverlay/index.vue +15 -23
- package/dist/runtime/blokkliPlugins/DebugOverlay/index.vue.d.ts +21 -0
- package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +28 -45
- package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue.d.ts +41 -0
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue +39 -85
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +83 -0
- package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue +22 -26
- package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue.d.ts +17 -0
- package/dist/runtime/blokkliPlugins/MenuButton/index.vue +30 -38
- package/dist/runtime/blokkliPlugins/MenuButton/index.vue.d.ts +32 -0
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +146 -211
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue.d.ts +91 -0
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue +95 -139
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +85 -0
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue +38 -57
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue.d.ts +48 -0
- package/dist/runtime/blokkliPlugins/TourItem/index.vue +20 -29
- package/dist/runtime/blokkliPlugins/TourItem/index.vue.d.ts +20 -0
- package/dist/runtime/blokkliPlugins/ViewOption/index.vue +45 -59
- package/dist/runtime/blokkliPlugins/ViewOption/index.vue.d.ts +39 -0
- package/dist/runtime/components/Blocks/Fragment/index.vue +13 -20
- package/dist/runtime/components/Blocks/Fragment/index.vue.d.ts +6 -0
- package/dist/runtime/components/Blocks/FromLibrary/index.vue +19 -29
- package/dist/runtime/components/Blocks/FromLibrary/index.vue.d.ts +6 -0
- package/dist/runtime/components/BlokkliEditable.vue +30 -49
- package/dist/runtime/components/BlokkliEditable.vue.d.ts +20 -0
- package/dist/runtime/components/BlokkliField.vue +101 -159
- package/dist/runtime/components/BlokkliField.vue.d.ts +49 -0
- package/dist/runtime/components/BlokkliItem.vue +43 -66
- package/dist/runtime/components/BlokkliItem.vue.d.ts +26 -0
- package/dist/runtime/components/BlokkliProvider.vue +51 -87
- package/dist/runtime/components/BlokkliProvider.vue.d.ts +34 -0
- package/dist/runtime/components/Edit/Actions/index.vue +116 -164
- package/dist/runtime/components/Edit/Actions/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/AddListItem/index.vue +45 -66
- package/dist/runtime/components/Edit/AddListItem/index.vue.d.ts +28 -0
- package/dist/runtime/components/Edit/AnimationCanvas/index.vue +52 -88
- package/dist/runtime/components/Edit/AnimationCanvas/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/AppMenu/index.vue +12 -15
- package/dist/runtime/components/Edit/AppMenu/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/BlockProxy/index.vue +48 -82
- package/dist/runtime/components/Edit/BlockProxy/index.vue.d.ts +10 -0
- package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue +17 -21
- package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue.d.ts +23 -0
- package/dist/runtime/components/Edit/Dialog/index.vue +67 -103
- package/dist/runtime/components/Edit/Dialog/index.vue.d.ts +44 -0
- package/dist/runtime/components/Edit/DragInteractions/index.vue +219 -333
- package/dist/runtime/components/Edit/DragInteractions/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/DraggableList.vue +82 -125
- package/dist/runtime/components/Edit/DraggableList.vue.d.ts +27 -0
- package/dist/runtime/components/Edit/EditIndicator.vue +34 -46
- package/dist/runtime/components/Edit/EditIndicator.vue.d.ts +11 -0
- package/dist/runtime/components/Edit/EditProvider.vue +146 -142
- package/dist/runtime/components/Edit/EditProvider.vue.d.ts +26 -0
- package/dist/runtime/components/Edit/Features/AddList/index.vue +90 -117
- package/dist/runtime/components/Edit/Features/AddList/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Artboard/Overview/index.vue +43 -63
- package/dist/runtime/components/Edit/Features/Artboard/Overview/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Artboard/Scrollbar/index.vue +18 -23
- package/dist/runtime/components/Edit/Features/Artboard/Scrollbar/index.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Features/Artboard/index.vue +174 -223
- package/dist/runtime/components/Edit/Features/Artboard/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Assistant/Overlay/ResultMarkup/index.vue +7 -7
- package/dist/runtime/components/Edit/Features/Assistant/Overlay/ResultMarkup/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Assistant/Overlay/index.vue +41 -54
- package/dist/runtime/components/Edit/Features/Assistant/Overlay/index.vue.d.ts +8 -0
- package/dist/runtime/components/Edit/Features/Assistant/index.vue +31 -40
- package/dist/runtime/components/Edit/Features/Assistant/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +225 -326
- package/dist/runtime/components/Edit/Features/BlockAddList/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Clipboard/List/Item/File.vue +36 -44
- package/dist/runtime/components/Edit/Features/Clipboard/List/Item/File.vue.d.ts +3 -0
- package/dist/runtime/components/Edit/Features/Clipboard/List/Item/Video.vue +33 -35
- package/dist/runtime/components/Edit/Features/Clipboard/List/Item/Video.vue.d.ts +3 -0
- package/dist/runtime/components/Edit/Features/Clipboard/List/index.vue +13 -21
- package/dist/runtime/components/Edit/Features/Clipboard/List/index.vue.d.ts +10 -0
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue +227 -298
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue +24 -34
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue.d.ts +22 -0
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +146 -195
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +21 -26
- package/dist/runtime/components/Edit/Features/CommandPalette/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue +11 -14
- package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue.d.ts +8 -0
- package/dist/runtime/components/Edit/Features/Comments/Comment/index.vue +21 -29
- package/dist/runtime/components/Edit/Features/Comments/Comment/index.vue.d.ts +23 -0
- package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue +31 -43
- package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue.d.ts +19 -0
- package/dist/runtime/components/Edit/Features/Comments/Overlay/index.vue +70 -100
- package/dist/runtime/components/Edit/Features/Comments/Overlay/index.vue.d.ts +18 -0
- package/dist/runtime/components/Edit/Features/Comments/index.vue +37 -48
- package/dist/runtime/components/Edit/Features/Comments/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Conversions/index.vue +40 -56
- package/dist/runtime/components/Edit/Features/Conversions/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +37 -50
- package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Debug/Viewport/index.vue +35 -44
- package/dist/runtime/components/Edit/Features/Debug/Viewport/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Debug/index.vue +43 -57
- package/dist/runtime/components/Edit/Features/Debug/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Delete/index.vue +31 -52
- package/dist/runtime/components/Edit/Features/Delete/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Diff/DiffView/index.vue +75 -114
- package/dist/runtime/components/Edit/Features/Diff/DiffView/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Diff/index.vue +17 -19
- package/dist/runtime/components/Edit/Features/Diff/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +193 -337
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue.d.ts +27 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/fragment.glsl +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +391 -644
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue.d.ts +156 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +197 -323
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Duplicate/index.vue +49 -71
- package/dist/runtime/components/Edit/Features/Duplicate/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Edit/index.vue +41 -71
- package/dist/runtime/components/Edit/Features/Edit/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue +35 -51
- package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue.d.ts +11 -0
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +104 -140
- package/dist/runtime/components/Edit/Features/EditForm/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Contenteditable/index.vue +18 -25
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Contenteditable/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue +34 -50
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue.d.ts +16 -0
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +40 -51
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue.d.ts +16 -0
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +147 -209
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue.d.ts +15 -0
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +90 -143
- package/dist/runtime/components/Edit/Features/EditableField/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/EditableMask/index.vue +28 -36
- package/dist/runtime/components/Edit/Features/EditableMask/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +49 -58
- package/dist/runtime/components/Edit/Features/EntityTitle/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Exit/index.vue +16 -20
- package/dist/runtime/components/Edit/Features/Exit/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/FieldAreas/Overlay/index.vue +4 -15
- package/dist/runtime/components/Edit/Features/FieldAreas/Overlay/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/FieldAreas/index.vue +19 -21
- package/dist/runtime/components/Edit/Features/FieldAreas/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/Item/index.vue +28 -35
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/Item/index.vue.d.ts +8 -0
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue +51 -74
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/Fragments/index.vue +41 -51
- package/dist/runtime/components/Edit/Features/Fragments/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Grid/index.vue +17 -20
- package/dist/runtime/components/Edit/Features/Grid/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Help/Shortcuts/index.vue +24 -35
- package/dist/runtime/components/Edit/Features/Help/Shortcuts/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Help/index.vue +19 -23
- package/dist/runtime/components/Edit/Features/Help/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/History/List/index.vue +49 -70
- package/dist/runtime/components/Edit/Features/History/List/index.vue.d.ts +5 -0
- package/dist/runtime/components/Edit/Features/History/index.vue +54 -69
- package/dist/runtime/components/Edit/Features/History/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue +48 -66
- package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue.d.ts +14 -0
- package/dist/runtime/components/Edit/Features/ImportExisting/index.vue +38 -54
- package/dist/runtime/components/Edit/Features/ImportExisting/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +90 -128
- package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue.d.ts +13 -0
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/Item/index.vue +29 -38
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/Item/index.vue.d.ts +9 -0
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +68 -93
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +39 -49
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/Library/index.vue +85 -117
- package/dist/runtime/components/Edit/Features/Library/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/Item.vue +13 -19
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/Item.vue.d.ts +19 -0
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +76 -112
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +107 -140
- package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue +128 -188
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +42 -57
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Checkbox/index.vue +27 -34
- package/dist/runtime/components/Edit/Features/Options/Form/Checkbox/index.vue.d.ts +14 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Checkboxes/index.vue +55 -75
- package/dist/runtime/components/Edit/Features/Options/Form/Checkboxes/index.vue.d.ts +24 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Color/index.vue +18 -21
- package/dist/runtime/components/Edit/Features/Options/Form/Color/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/Options/Form/DateTimeLocal/index.vue +36 -0
- package/dist/runtime/components/Edit/Features/Options/Form/DateTimeLocal/index.vue.d.ts +20 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Group.vue +7 -9
- package/dist/runtime/components/Edit/Features/Options/Form/Group.vue.d.ts +29 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +87 -93
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue.d.ts +14 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Number/index.vue +31 -45
- package/dist/runtime/components/Edit/Features/Options/Form/Number/index.vue.d.ts +21 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Radios/index.vue +55 -79
- package/dist/runtime/components/Edit/Features/Options/Form/Radios/index.vue.d.ts +30 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Range/index.vue +23 -33
- package/dist/runtime/components/Edit/Features/Options/Form/Range/index.vue.d.ts +18 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Text/index.vue +17 -26
- package/dist/runtime/components/Edit/Features/Options/Form/Text/index.vue.d.ts +17 -0
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue +178 -272
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue.d.ts +9 -0
- package/dist/runtime/components/Edit/Features/Options/index.vue +38 -69
- package/dist/runtime/components/Edit/Features/Options/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Ownership/index.vue +27 -34
- package/dist/runtime/components/Edit/Features/Ownership/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Preview/index.vue +22 -27
- package/dist/runtime/components/Edit/Features/Preview/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/PreviewGrant/QrCode/index.vue +12 -16
- package/dist/runtime/components/Edit/Features/PreviewGrant/QrCode/index.vue.d.ts +5 -0
- package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +31 -36
- package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/ProxyView/index.vue +18 -20
- package/dist/runtime/components/Edit/Features/ProxyView/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/Item.vue +118 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/Item.vue.d.ts +18 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +251 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue.d.ts +19 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/types.d.ts +7 -0
- package/dist/runtime/components/Edit/Features/Publish/index.vue +70 -74
- package/dist/runtime/components/Edit/Features/Publish/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/ResponsivePreview/Frame/index.vue +48 -54
- package/dist/runtime/components/Edit/Features/ResponsivePreview/Frame/index.vue.d.ts +27 -0
- package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +77 -103
- package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Revert/index.vue +27 -32
- package/dist/runtime/components/Edit/Features/Revert/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +67 -88
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue.d.ts +17 -0
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue +89 -139
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue.d.ts +18 -0
- package/dist/runtime/components/Edit/Features/Search/Overlay/index.vue +79 -108
- package/dist/runtime/components/Edit/Features/Search/Overlay/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/Search/index.vue +30 -37
- package/dist/runtime/components/Edit/Features/Search/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue +67 -103
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue.d.ts +9 -0
- package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +28 -36
- package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue.d.ts +5 -0
- package/dist/runtime/components/Edit/Features/Selection/index.vue +131 -217
- package/dist/runtime/components/Edit/Features/Selection/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Settings/Dialog/FeatureSetting/index.vue +50 -81
- package/dist/runtime/components/Edit/Features/Settings/Dialog/FeatureSetting/index.vue.d.ts +9 -0
- package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue +73 -117
- package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Settings/index.vue +41 -53
- package/dist/runtime/components/Edit/Features/Settings/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue +65 -101
- package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue.d.ts +15 -0
- package/dist/runtime/components/Edit/Features/Structure/List/Item/index.vue +71 -99
- package/dist/runtime/components/Edit/Features/Structure/List/Item/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/Structure/List/index.vue +17 -26
- package/dist/runtime/components/Edit/Features/Structure/List/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/Structure/index.vue +31 -40
- package/dist/runtime/components/Edit/Features/Structure/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Theme/Color/index.vue +32 -53
- package/dist/runtime/components/Edit/Features/Theme/Color/index.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Features/Theme/GeneratedCode/index.vue +7 -10
- package/dist/runtime/components/Edit/Features/Theme/GeneratedCode/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Theme/index.vue +49 -63
- package/dist/runtime/components/Edit/Features/Theme/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/TouchActionBar/Bar/index.vue +9 -10
- package/dist/runtime/components/Edit/Features/TouchActionBar/Bar/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/TouchActionBar/index.vue +16 -19
- package/dist/runtime/components/Edit/Features/TouchActionBar/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +119 -174
- package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Tour/Popup/index.vue +10 -12
- package/dist/runtime/components/Edit/Features/Tour/Popup/index.vue.d.ts +8 -0
- package/dist/runtime/components/Edit/Features/Tour/index.vue +21 -25
- package/dist/runtime/components/Edit/Features/Tour/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Transform/index.vue +80 -120
- package/dist/runtime/components/Edit/Features/Transform/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Translations/Banner/index.vue +21 -29
- package/dist/runtime/components/Edit/Features/Translations/Banner/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Translations/index.vue +96 -139
- package/dist/runtime/components/Edit/Features/Translations/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Validations/Overlay/Item.vue +21 -35
- package/dist/runtime/components/Edit/Features/Validations/Overlay/Item.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Validations/Overlay/index.vue +30 -39
- package/dist/runtime/components/Edit/Features/Validations/Overlay/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Validations/SidebarItem/index.vue +20 -28
- package/dist/runtime/components/Edit/Features/Validations/SidebarItem/index.vue.d.ts +9 -0
- package/dist/runtime/components/Edit/Features/Validations/index.vue +27 -33
- package/dist/runtime/components/Edit/Features/Validations/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/index.vue +33 -52
- package/dist/runtime/components/Edit/Features/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Form/Group/index.vue +23 -0
- package/dist/runtime/components/Edit/Form/Group/index.vue.d.ts +20 -0
- package/dist/runtime/components/Edit/Form/Item/index.vue +5 -0
- package/dist/runtime/components/Edit/Form/Item/index.vue.d.ts +14 -0
- package/dist/runtime/components/Edit/Form/Textarea/index.vue +27 -0
- package/dist/runtime/components/Edit/Form/Textarea/index.vue.d.ts +16 -0
- package/dist/runtime/components/Edit/Form/Toggle/index.vue +21 -0
- package/dist/runtime/components/Edit/Form/Toggle/index.vue.d.ts +14 -0
- package/dist/runtime/components/Edit/FormOverlay/Header/index.vue +11 -22
- package/dist/runtime/components/Edit/FormOverlay/Header/index.vue.d.ts +18 -0
- package/dist/runtime/components/Edit/FormOverlay/index.vue +15 -21
- package/dist/runtime/components/Edit/FormOverlay/index.vue.d.ts +25 -0
- package/dist/runtime/components/Edit/Highlight/index.vue +31 -70
- package/dist/runtime/components/Edit/Highlight/index.vue.d.ts +20 -0
- package/dist/runtime/components/Edit/Icon/index.vue +11 -14
- package/dist/runtime/components/Edit/Icon/index.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/InfoBox/index.vue +5 -6
- package/dist/runtime/components/Edit/InfoBox/index.vue.d.ts +5 -0
- package/dist/runtime/components/Edit/ItemIcon/index.vue +13 -13
- package/dist/runtime/components/Edit/ItemIcon/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Loading/index.vue +8 -9
- package/dist/runtime/components/Edit/Loading/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Messages/Item/index.vue +30 -41
- package/dist/runtime/components/Edit/Messages/Item/index.vue.d.ts +11 -0
- package/dist/runtime/components/Edit/Messages/index.vue +13 -17
- package/dist/runtime/components/Edit/Messages/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Pagination/index.vue +6 -8
- package/dist/runtime/components/Edit/Pagination/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/PreviewProvider.vue +124 -177
- package/dist/runtime/components/Edit/PreviewProvider.vue.d.ts +24 -0
- package/dist/runtime/components/Edit/RelativeTime/index.vue +19 -25
- package/dist/runtime/components/Edit/RelativeTime/index.vue.d.ts +15 -0
- package/dist/runtime/components/Edit/Resizable/index.vue +45 -55
- package/dist/runtime/components/Edit/Resizable/index.vue.d.ts +13 -0
- package/dist/runtime/components/Edit/ScaleToFit/index.vue +44 -62
- package/dist/runtime/components/Edit/ScaleToFit/index.vue.d.ts +15 -0
- package/dist/runtime/components/Edit/ScrollBoundary/index.vue +11 -27
- package/dist/runtime/components/Edit/ScrollBoundary/index.vue.d.ts +23 -0
- package/dist/runtime/components/Edit/ShortcutIndicator/index.vue +47 -59
- package/dist/runtime/components/Edit/ShortcutIndicator/index.vue.d.ts +20 -0
- package/dist/runtime/components/Edit/Sortli/index.vue +45 -59
- package/dist/runtime/components/Edit/Sortli/index.vue.d.ts +14 -0
- package/dist/runtime/components/Edit/SystemRequirements/index.vue +29 -43
- package/dist/runtime/components/Edit/SystemRequirements/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Toolbar/index.vue +26 -41
- package/dist/runtime/components/Edit/Toolbar/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue +29 -51
- package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue.d.ts +20 -0
- package/dist/runtime/components/Edit/index.d.ts +5 -1
- package/dist/runtime/components/Edit/index.js +9 -1
- package/dist/runtime/composables/defineBlokkli.d.ts +2 -2
- package/dist/runtime/composables/defineBlokkli.js +29 -11
- package/dist/runtime/composables/defineBlokkliFragment.d.ts +1 -1
- package/dist/runtime/composables/defineBlokkliFragment.js +16 -24
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/definitionProvider.d.ts +18 -0
- package/dist/runtime/helpers/definitionProvider.js +96 -0
- package/dist/runtime/helpers/domProvider.d.ts +2 -1
- package/dist/runtime/helpers/domProvider.js +6 -3
- package/dist/runtime/helpers/editComponents/index.d.ts +2 -0
- package/dist/runtime/helpers/editComponents/index.js +10 -0
- package/dist/runtime/helpers/featuresProvider.d.ts +2 -1
- package/dist/runtime/helpers/featuresProvider.js +19 -10
- package/dist/runtime/helpers/frameEventBus.d.ts +1 -1
- package/dist/runtime/helpers/imports/index.d.ts +1 -0
- package/dist/runtime/helpers/imports/index.js +44 -0
- package/dist/runtime/helpers/index.js +5 -8
- package/dist/runtime/helpers/runtimeHelpers/index.d.ts +5 -0
- package/dist/runtime/helpers/runtimeHelpers/index.js +17 -4
- package/dist/runtime/helpers/stateProvider.d.ts +1 -1
- package/dist/runtime/helpers/textProvider.d.ts +1 -1
- package/dist/runtime/helpers/themeProvider.js +4 -1
- package/dist/runtime/helpers/transform.d.ts +1 -1
- package/dist/runtime/helpers/typesProvider.d.ts +2 -2
- package/dist/runtime/helpers/uiProvider.js +4 -5
- package/dist/runtime/helpers/webgl/index.js +1 -1
- package/dist/runtime/icons/arrow-right-thin.svg +3 -0
- package/dist/runtime/public/_blokkli-assets/check.svg +6 -0
- package/dist/runtime/public/_blokkli-assets/loader.svg +1 -0
- package/dist/runtime/types/blokkOptions.d.ts +11 -2
- package/dist/runtime/types/index.d.ts +34 -14
- package/dist/shared/editor.gz_ac6uT.d.mts +431 -0
- package/dist/types.d.mts +1 -1
- package/package.json +30 -25
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -198
- package/dist/runtime/adapter/drupal/graphql/base.graphql +0 -944
- package/dist/runtime/adapter/drupal/graphqlMiddleware.d.ts +0 -2
- package/dist/runtime/adapter/drupal/graphqlMiddleware.js +0 -680
- package/dist/runtime/types/generatedModuleTypes.d.ts +0 -49
- package/dist/types.d.ts +0 -1
- /package/dist/{runtime/adapter/drupal/graphql → modules/drupal/graphql/features}/comments.graphql +0 -0
- /package/dist/{runtime/adapter/drupal/graphql → modules/drupal/graphql/features}/fragments.graphql +0 -0
- /package/dist/{runtime/adapter/drupal/graphql → modules/drupal/graphql/features}/search.graphql +0 -0
- /package/dist/{runtime/adapter/drupal/graphql → modules/drupal/graphql/features}/transform.graphql +0 -0
- /package/dist/runtime/{types/generatedModuleTypes.js → components/Edit/Features/Publish/Dialog/types.js} +0 -0
- /package/dist/runtime/public/{Inter.var.woff2 → _blokkli-assets/Inter.var.woff2} +0 -0
|
@@ -4,96 +4,48 @@
|
|
|
4
4
|
</Teleport>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
|
-
<script
|
|
7
|
+
<script setup>
|
|
8
8
|
import {
|
|
9
9
|
falsy,
|
|
10
10
|
findClosestRectangle,
|
|
11
11
|
intersects,
|
|
12
12
|
isInsideRect,
|
|
13
13
|
rgbaToString,
|
|
14
|
-
toShaderColor
|
|
15
|
-
} from
|
|
16
|
-
import onBlokkliEvent from
|
|
17
|
-
import
|
|
18
|
-
DropTargetEvent,
|
|
19
|
-
BlokkliFieldElement,
|
|
20
|
-
DraggableItem,
|
|
21
|
-
DropArea,
|
|
22
|
-
Rectangle,
|
|
23
|
-
Coord,
|
|
24
|
-
} from '#blokkli/types'
|
|
25
|
-
import { ref, computed, useBlokkli, onBeforeUnmount } from '#imports'
|
|
14
|
+
toShaderColor
|
|
15
|
+
} from "#blokkli/helpers";
|
|
16
|
+
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
17
|
+
import { ref, computed, useBlokkli, onBeforeUnmount } from "#imports";
|
|
26
18
|
import {
|
|
27
19
|
setBuffersAndAttributes,
|
|
28
20
|
drawBufferInfo,
|
|
29
|
-
setUniforms
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
type FieldRectChild = Rectangle & {
|
|
58
|
-
id: string
|
|
59
|
-
label: string
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
type FieldRect = Rectangle & {
|
|
63
|
-
key: string
|
|
64
|
-
field: BlokkliFieldElement
|
|
65
|
-
label: string
|
|
66
|
-
canAddChildren: boolean
|
|
67
|
-
emptyChild?: FieldRectChild
|
|
68
|
-
orientation: Orientation
|
|
69
|
-
gap: number
|
|
70
|
-
childrenElements: HTMLElement[]
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
type DrawnRect = Rectangle & {
|
|
74
|
-
id: string
|
|
75
|
-
type: 'field' | 'drop-area' | 'active-area'
|
|
76
|
-
label: string
|
|
77
|
-
color: string
|
|
78
|
-
colorAlpha: string
|
|
79
|
-
field?: FieldRect
|
|
80
|
-
index: number
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const dragStart = Date.now()
|
|
84
|
-
|
|
85
|
-
const cursorIsInsideClipped = () =>
|
|
86
|
-
isInsideRect(props.mouseX, props.mouseY, ui.visibleViewport.value) &&
|
|
87
|
-
!ui.viewportBlockingRects.value.some((v) =>
|
|
88
|
-
isInsideRect(props.mouseX, props.mouseY, v),
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
const active = ref<DrawnRect | null>(null)
|
|
92
|
-
|
|
93
|
-
defineEmits<{
|
|
94
|
-
(e: 'drop', data: DropTargetEvent): void
|
|
95
|
-
}>()
|
|
96
|
-
|
|
21
|
+
setUniforms
|
|
22
|
+
} from "twgl.js";
|
|
23
|
+
import vs from "./vertex.glsl?raw";
|
|
24
|
+
import fs from "./fragment.glsl?raw";
|
|
25
|
+
import { RectangleBufferCollector } from "#blokkli/helpers/webgl";
|
|
26
|
+
const props = defineProps({
|
|
27
|
+
items: { type: Array, required: true },
|
|
28
|
+
box: { type: Object, required: true },
|
|
29
|
+
mouseX: { type: Number, required: true },
|
|
30
|
+
mouseY: { type: Number, required: true },
|
|
31
|
+
isTouch: { type: Boolean, required: true }
|
|
32
|
+
});
|
|
33
|
+
const MIN_GAP = 20;
|
|
34
|
+
var RectRenderType = /* @__PURE__ */ ((RectRenderType2) => {
|
|
35
|
+
RectRenderType2[RectRenderType2["DROP_AREA"] = 0] = "DROP_AREA";
|
|
36
|
+
RectRenderType2[RectRenderType2["FIELD_1"] = 1] = "FIELD_1";
|
|
37
|
+
RectRenderType2[RectRenderType2["FIELD_2"] = 2] = "FIELD_2";
|
|
38
|
+
RectRenderType2[RectRenderType2["FIELD_3"] = 3] = "FIELD_3";
|
|
39
|
+
RectRenderType2[RectRenderType2["FIELD_4"] = 4] = "FIELD_4";
|
|
40
|
+
RectRenderType2[RectRenderType2["ACTIVE_AREA"] = 5] = "ACTIVE_AREA";
|
|
41
|
+
return RectRenderType2;
|
|
42
|
+
})(RectRenderType || {});
|
|
43
|
+
const dragStart = Date.now();
|
|
44
|
+
const cursorIsInsideClipped = () => isInsideRect(props.mouseX, props.mouseY, ui.visibleViewport.value) && !ui.viewportBlockingRects.value.some(
|
|
45
|
+
(v) => isInsideRect(props.mouseX, props.mouseY, v)
|
|
46
|
+
);
|
|
47
|
+
const active = ref(null);
|
|
48
|
+
defineEmits(["drop"]);
|
|
97
49
|
const {
|
|
98
50
|
dom,
|
|
99
51
|
ui,
|
|
@@ -103,409 +55,282 @@ const {
|
|
|
103
55
|
animation,
|
|
104
56
|
state,
|
|
105
57
|
runtimeConfig,
|
|
106
|
-
types
|
|
107
|
-
} = useBlokkli()
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const areas = dropAreas
|
|
119
|
-
.getDropAreas(props.items)
|
|
120
|
-
.reduce<Record<string, DropArea>>((acc, v) => {
|
|
121
|
-
acc[v.id] = v
|
|
122
|
-
return acc
|
|
123
|
-
}, {})
|
|
124
|
-
|
|
125
|
-
const visibleDropAreas: Set<string> = new Set()
|
|
126
|
-
|
|
58
|
+
types
|
|
59
|
+
} = useBlokkli();
|
|
60
|
+
const gl = animation.gl();
|
|
61
|
+
const canvas = animation.getCanvasElement();
|
|
62
|
+
const ctx = !gl && canvas ? canvas.getContext("2d") : null;
|
|
63
|
+
const programInfo = gl ? animation.registerProgram("drop_targets", gl, [vs, fs]) : null;
|
|
64
|
+
const areas = dropAreas.getDropAreas(props.items).reduce((acc, v) => {
|
|
65
|
+
acc[v.id] = v;
|
|
66
|
+
return acc;
|
|
67
|
+
}, {});
|
|
68
|
+
const visibleDropAreas = /* @__PURE__ */ new Set();
|
|
127
69
|
const areasObserver = new IntersectionObserver(
|
|
128
70
|
(entries) => {
|
|
129
71
|
for (const entry of entries) {
|
|
130
72
|
if (entry.target instanceof HTMLElement) {
|
|
131
|
-
const id = entry.target.dataset.dropAreaId
|
|
73
|
+
const id = entry.target.dataset.dropAreaId;
|
|
132
74
|
if (id) {
|
|
133
75
|
if (entry.isIntersecting) {
|
|
134
|
-
visibleDropAreas.add(id)
|
|
76
|
+
visibleDropAreas.add(id);
|
|
135
77
|
} else {
|
|
136
|
-
visibleDropAreas.delete(id)
|
|
78
|
+
visibleDropAreas.delete(id);
|
|
137
79
|
}
|
|
138
80
|
}
|
|
139
81
|
}
|
|
140
82
|
}
|
|
141
83
|
},
|
|
142
84
|
{
|
|
143
|
-
threshold: 0
|
|
144
|
-
}
|
|
145
|
-
)
|
|
146
|
-
|
|
85
|
+
threshold: 0
|
|
86
|
+
}
|
|
87
|
+
);
|
|
147
88
|
Object.values(areas).forEach((area) => {
|
|
148
|
-
area.element.dataset.dropAreaId = area.id
|
|
149
|
-
areasObserver.observe(area.element)
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
onBlokkliEvent('mouse:up', (e) => {
|
|
89
|
+
area.element.dataset.dropAreaId = area.id;
|
|
90
|
+
areasObserver.observe(area.element);
|
|
91
|
+
});
|
|
92
|
+
onBlokkliEvent("mouse:down", (e) => {
|
|
93
|
+
const coord = toCanvasSpaceCoordinates(e.x, e.y);
|
|
94
|
+
const match = collector.getRectAtPosition(coord);
|
|
95
|
+
active.value = match || null;
|
|
96
|
+
});
|
|
97
|
+
onBlokkliEvent("mouse:up", (e) => {
|
|
159
98
|
if (!active.value) {
|
|
160
|
-
return
|
|
99
|
+
return;
|
|
161
100
|
}
|
|
162
|
-
|
|
163
|
-
// On touch devices, if the distance is greater than the threshold, the user
|
|
164
|
-
// has likely interacted with the artboard (panning, zooming).
|
|
165
101
|
if (props.isTouch && e.distance > 10) {
|
|
166
|
-
active.value = null
|
|
167
|
-
return
|
|
102
|
+
active.value = null;
|
|
103
|
+
return;
|
|
168
104
|
}
|
|
169
|
-
|
|
170
|
-
// On desktop, only emit drop if the distance is greater than the threshold.
|
|
171
|
-
// This prevents accidentally moving a block.
|
|
172
105
|
if (!props.isTouch && e.distance < 7) {
|
|
173
|
-
return
|
|
106
|
+
return;
|
|
174
107
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
})
|
|
178
|
-
|
|
108
|
+
emitDrop();
|
|
109
|
+
});
|
|
179
110
|
const emitDrop = async () => {
|
|
180
|
-
const timeDelta = Date.now() - dragStart
|
|
181
|
-
// Prevent accidental drops. At least 200ms should have passed between the
|
|
182
|
-
// time the drag was initiated and when the drop was made.
|
|
111
|
+
const timeDelta = Date.now() - dragStart;
|
|
183
112
|
if (active.value && timeDelta > 200) {
|
|
184
|
-
if (active.value.type ===
|
|
185
|
-
const [hostUuid, fieldName, preceedingUuid] = active.value.id.split(
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
113
|
+
if (active.value.type === "field") {
|
|
114
|
+
const [hostUuid, fieldName, preceedingUuid] = active.value.id.split(":");
|
|
115
|
+
if (!hostUuid || !fieldName) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const field = dom.findField(hostUuid, fieldName);
|
|
189
119
|
if (!field) {
|
|
190
|
-
return
|
|
120
|
+
return;
|
|
191
121
|
}
|
|
192
|
-
|
|
193
|
-
eventBus.emit('dragging:drop', {
|
|
122
|
+
eventBus.emit("dragging:drop", {
|
|
194
123
|
field,
|
|
195
124
|
preceedingUuid,
|
|
196
125
|
items: [...props.items],
|
|
197
126
|
host: {
|
|
198
127
|
type: field.hostEntityType,
|
|
199
128
|
uuid: field.hostEntityUuid,
|
|
200
|
-
fieldName: field.name
|
|
201
|
-
}
|
|
202
|
-
})
|
|
203
|
-
return
|
|
204
|
-
} else if (active.value.type ===
|
|
205
|
-
const area = areas[active.value.id]
|
|
129
|
+
fieldName: field.name
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
return;
|
|
133
|
+
} else if (active.value.type === "drop-area") {
|
|
134
|
+
const area = areas[active.value.id];
|
|
206
135
|
if (!area) {
|
|
207
|
-
return
|
|
136
|
+
return;
|
|
208
137
|
}
|
|
209
|
-
await area.onDrop()
|
|
138
|
+
await area.onDrop();
|
|
210
139
|
}
|
|
211
140
|
}
|
|
212
|
-
|
|
213
|
-
eventBus.emit(
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
// Check for Flex layout
|
|
221
|
-
if (computedStyle.display.includes('flex')) {
|
|
222
|
-
// Flex direction row or row-reverse indicates horizontal layout
|
|
223
|
-
if (
|
|
224
|
-
computedStyle.flexDirection === 'row' ||
|
|
225
|
-
computedStyle.flexDirection === 'row-reverse'
|
|
226
|
-
) {
|
|
227
|
-
return 'horizontal'
|
|
141
|
+
eventBus.emit("dragging:end");
|
|
142
|
+
eventBus.emit("item:dropped");
|
|
143
|
+
};
|
|
144
|
+
function getChildrenOrientation(element) {
|
|
145
|
+
const computedStyle = window.getComputedStyle(element);
|
|
146
|
+
if (computedStyle.display.includes("flex")) {
|
|
147
|
+
if (computedStyle.flexDirection === "row" || computedStyle.flexDirection === "row-reverse") {
|
|
148
|
+
return "horizontal";
|
|
228
149
|
} else {
|
|
229
|
-
|
|
230
|
-
return 'vertical'
|
|
150
|
+
return "vertical";
|
|
231
151
|
}
|
|
232
152
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
// We'll need to check the grid-template-columns and grid-template-rows
|
|
237
|
-
// This is a simple check, assuming a basic grid layout
|
|
238
|
-
if (computedStyle.gridTemplateColumns.split(' ').length > 1) {
|
|
239
|
-
return 'horizontal'
|
|
153
|
+
if (computedStyle.display.includes("grid")) {
|
|
154
|
+
if (computedStyle.gridTemplateColumns.split(" ").length > 1) {
|
|
155
|
+
return "horizontal";
|
|
240
156
|
} else {
|
|
241
|
-
return
|
|
157
|
+
return "vertical";
|
|
242
158
|
}
|
|
243
159
|
}
|
|
244
|
-
|
|
245
|
-
// Default to vertical for block elements and other displays
|
|
246
|
-
return 'vertical'
|
|
160
|
+
return "vertical";
|
|
247
161
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
)
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
.map((item) => {
|
|
272
|
-
if (item.itemType === 'existing') {
|
|
273
|
-
return item.uuid
|
|
274
|
-
}
|
|
275
|
-
})
|
|
276
|
-
.filter(falsy),
|
|
277
|
-
)
|
|
278
|
-
|
|
279
|
-
function getGapSize(orientation: Orientation, element: HTMLElement): number {
|
|
280
|
-
const computedStyle = window.getComputedStyle(element)
|
|
281
|
-
|
|
282
|
-
// Check for Grid or Flex layout
|
|
283
|
-
if (
|
|
284
|
-
computedStyle.display.includes('grid') ||
|
|
285
|
-
computedStyle.display.includes('flex')
|
|
286
|
-
) {
|
|
287
|
-
const gap =
|
|
288
|
-
orientation === 'vertical'
|
|
289
|
-
? computedStyle.columnGap || computedStyle.gridColumnGap
|
|
290
|
-
: computedStyle.rowGap || computedStyle.gridRowGap
|
|
291
|
-
|
|
162
|
+
const draggingBundles = computed(
|
|
163
|
+
() => props.items.flatMap((item) => {
|
|
164
|
+
const bundles = [];
|
|
165
|
+
if ("itemBundle" in item && item.itemBundle) {
|
|
166
|
+
bundles.push(item.itemBundle);
|
|
167
|
+
}
|
|
168
|
+
if ("reusableBundle" in item && item.reusableBundle) {
|
|
169
|
+
bundles.push(item.reusableBundle);
|
|
170
|
+
}
|
|
171
|
+
return bundles;
|
|
172
|
+
}).filter(falsy)
|
|
173
|
+
);
|
|
174
|
+
const selectionUuids = computed(
|
|
175
|
+
() => props.items.map((item) => {
|
|
176
|
+
if (item.itemType === "existing") {
|
|
177
|
+
return item.uuid;
|
|
178
|
+
}
|
|
179
|
+
}).filter(falsy)
|
|
180
|
+
);
|
|
181
|
+
function getGapSize(orientation, element) {
|
|
182
|
+
const computedStyle = window.getComputedStyle(element);
|
|
183
|
+
if (computedStyle.display.includes("grid") || computedStyle.display.includes("flex")) {
|
|
184
|
+
const gap = orientation === "vertical" ? computedStyle.columnGap || computedStyle.gridColumnGap : computedStyle.rowGap || computedStyle.gridRowGap;
|
|
292
185
|
if (gap) {
|
|
293
|
-
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
return Number.parseFloat(gapValue)
|
|
186
|
+
const gapParts = gap.split(" ");
|
|
187
|
+
const gapValue = gapParts[0];
|
|
188
|
+
if (gapValue?.endsWith("px")) {
|
|
189
|
+
return Number.parseFloat(gapValue);
|
|
298
190
|
}
|
|
299
191
|
}
|
|
300
192
|
}
|
|
301
|
-
|
|
302
|
-
return MIN_GAP
|
|
193
|
+
return MIN_GAP;
|
|
303
194
|
}
|
|
304
|
-
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
preceedingUuid?: string | undefined | null,
|
|
310
|
-
type?: string | undefined | null,
|
|
311
|
-
uuid?: string | undefined | null,
|
|
312
|
-
) => {
|
|
313
|
-
return `${field.key}:${preceedingUuid || ''}:${type || ''}:${uuid || ''}`
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
const buildChildren = (
|
|
317
|
-
field: FieldRect,
|
|
318
|
-
visible: string[],
|
|
319
|
-
): FieldRectChild[] => {
|
|
195
|
+
const fieldChildCache = {};
|
|
196
|
+
const buildChildId = (field, preceedingUuid, type, uuid) => {
|
|
197
|
+
return `${field.key}:${preceedingUuid || ""}:${type || ""}:${uuid || ""}`;
|
|
198
|
+
};
|
|
199
|
+
const buildChildren = (field, visible) => {
|
|
320
200
|
if (!field.canAddChildren) {
|
|
321
|
-
return []
|
|
201
|
+
return [];
|
|
322
202
|
}
|
|
323
|
-
|
|
324
203
|
if (field.emptyChild) {
|
|
325
|
-
return [field.emptyChild]
|
|
204
|
+
return [field.emptyChild];
|
|
326
205
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
let prevWasInSelection = false
|
|
331
|
-
let prevUuid: string | undefined = ''
|
|
332
|
-
|
|
206
|
+
const children = [];
|
|
207
|
+
let prevWasInSelection = false;
|
|
208
|
+
let prevUuid = "";
|
|
333
209
|
for (let i = 0; i < field.childrenElements.length; i++) {
|
|
334
|
-
const childrenForUuid
|
|
335
|
-
|
|
336
|
-
const
|
|
337
|
-
|
|
338
|
-
const el = field.childrenElements[i]
|
|
210
|
+
const childrenForUuid = [];
|
|
211
|
+
const isLast = i === field.childrenElements.length - 1;
|
|
212
|
+
const el = field.childrenElements[i];
|
|
339
213
|
if (!(el instanceof HTMLElement)) {
|
|
340
|
-
continue
|
|
214
|
+
continue;
|
|
341
215
|
}
|
|
342
|
-
|
|
343
|
-
const uuid = el.dataset.uuid
|
|
216
|
+
const uuid = el.dataset.uuid;
|
|
344
217
|
if (!uuid) {
|
|
345
|
-
continue
|
|
218
|
+
continue;
|
|
346
219
|
}
|
|
347
|
-
|
|
348
220
|
if (!visible.includes(uuid)) {
|
|
349
|
-
prevUuid = uuid
|
|
350
|
-
continue
|
|
221
|
+
prevUuid = uuid;
|
|
222
|
+
continue;
|
|
351
223
|
}
|
|
352
|
-
|
|
353
|
-
const cached = fieldChildCache[uuid]
|
|
224
|
+
const cached = fieldChildCache[uuid];
|
|
354
225
|
if (cached) {
|
|
355
|
-
children.push(...cached)
|
|
356
|
-
prevUuid = uuid
|
|
357
|
-
continue
|
|
226
|
+
children.push(...cached);
|
|
227
|
+
prevUuid = uuid;
|
|
228
|
+
continue;
|
|
358
229
|
}
|
|
359
|
-
|
|
360
|
-
// Skip child if it's part of the selection.
|
|
361
230
|
if (selectionUuids.value.includes(uuid)) {
|
|
362
|
-
prevWasInSelection = true
|
|
363
|
-
prevUuid = uuid
|
|
364
|
-
continue
|
|
231
|
+
prevWasInSelection = true;
|
|
232
|
+
prevUuid = uuid;
|
|
233
|
+
continue;
|
|
365
234
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
const elRect
|
|
369
|
-
dom.getBlockRect(uuid) ||
|
|
370
|
-
ui.getAbsoluteElementRect(el.getBoundingClientRect())
|
|
371
|
-
|
|
372
|
-
// Calculate the offset to the parent. We can not use el.offsetTop/el.offsetLeft here because the value could be 0.
|
|
373
|
-
const elOffsetTop = elRect.y - field.y
|
|
374
|
-
const elOffsetLeft = elRect.x - field.x
|
|
375
|
-
|
|
376
|
-
// Last element.
|
|
235
|
+
const elRect = dom.getBlockRect(uuid) || ui.getAbsoluteElementRect(el.getBoundingClientRect());
|
|
236
|
+
const elOffsetTop = elRect.y - field.y;
|
|
237
|
+
const elOffsetLeft = elRect.x - field.x;
|
|
377
238
|
if (isLast) {
|
|
378
|
-
const
|
|
379
|
-
if (field.orientation ===
|
|
239
|
+
const id2 = buildChildId(field.field, uuid, "last", uuid);
|
|
240
|
+
if (field.orientation === "vertical") {
|
|
380
241
|
childrenForUuid.push({
|
|
381
|
-
id,
|
|
242
|
+
id: id2,
|
|
382
243
|
width: field.width,
|
|
383
244
|
height: MIN_GAP,
|
|
384
245
|
x: 0,
|
|
385
246
|
y: elOffsetTop + el.scrollHeight,
|
|
386
|
-
label: field.label
|
|
387
|
-
})
|
|
247
|
+
label: field.label
|
|
248
|
+
});
|
|
388
249
|
} else {
|
|
389
250
|
childrenForUuid.push({
|
|
390
|
-
id,
|
|
251
|
+
id: id2,
|
|
391
252
|
width: MIN_GAP,
|
|
392
253
|
height: el.offsetHeight,
|
|
393
254
|
x: elOffsetLeft + el.offsetWidth + (field.gap - MIN_GAP) / 2,
|
|
394
255
|
y: elOffsetTop,
|
|
395
|
-
label: field.label
|
|
396
|
-
})
|
|
256
|
+
label: field.label
|
|
257
|
+
});
|
|
397
258
|
}
|
|
398
259
|
}
|
|
399
|
-
|
|
400
|
-
// If the previous element was part of the selection, don't add a child,
|
|
401
|
-
// because the move operation would result in the same position.
|
|
402
260
|
if (prevWasInSelection) {
|
|
403
|
-
prevWasInSelection = false
|
|
404
|
-
prevUuid = uuid
|
|
405
|
-
children.push(...childrenForUuid)
|
|
406
|
-
continue
|
|
261
|
+
prevWasInSelection = false;
|
|
262
|
+
prevUuid = uuid;
|
|
263
|
+
children.push(...childrenForUuid);
|
|
264
|
+
continue;
|
|
407
265
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
if (field.orientation === 'vertical') {
|
|
266
|
+
const id = buildChildId(field.field, prevUuid, "between", uuid);
|
|
267
|
+
if (field.orientation === "vertical") {
|
|
412
268
|
childrenForUuid.push({
|
|
413
269
|
id,
|
|
414
270
|
width: field.width,
|
|
415
271
|
height: MIN_GAP,
|
|
416
272
|
x: 0,
|
|
417
273
|
y: elOffsetTop - field.gap / 2,
|
|
418
|
-
label: field.label
|
|
419
|
-
})
|
|
274
|
+
label: field.label
|
|
275
|
+
});
|
|
420
276
|
} else {
|
|
421
277
|
childrenForUuid.push({
|
|
422
278
|
id,
|
|
423
279
|
width: MIN_GAP,
|
|
424
280
|
height: Math.max(el.offsetHeight, MIN_GAP),
|
|
425
|
-
x:
|
|
426
|
-
Math.max(elOffsetLeft - field.gap, -field.gap) +
|
|
427
|
-
(field.gap - MIN_GAP) / 2,
|
|
281
|
+
x: Math.max(elOffsetLeft - field.gap, -field.gap) + (field.gap - MIN_GAP) / 2,
|
|
428
282
|
y: elOffsetTop,
|
|
429
|
-
label: field.label
|
|
430
|
-
})
|
|
283
|
+
label: field.label
|
|
284
|
+
});
|
|
431
285
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
const fieldCache: Record<string, FieldRect> = {}
|
|
443
|
-
|
|
444
|
-
function getBundleLabel(field: BlokkliFieldElement): string {
|
|
286
|
+
fieldChildCache[uuid] = childrenForUuid;
|
|
287
|
+
children.push(...childrenForUuid);
|
|
288
|
+
prevUuid = uuid;
|
|
289
|
+
}
|
|
290
|
+
return children;
|
|
291
|
+
};
|
|
292
|
+
const fieldCache = {};
|
|
293
|
+
function getBundleLabel(field) {
|
|
445
294
|
if (field.hostEntityType === runtimeConfig.itemEntityType) {
|
|
446
|
-
return (
|
|
447
|
-
types.getBlockBundleDefinition(field.hostEntityBundle)?.label ||
|
|
448
|
-
field.hostEntityBundle
|
|
449
|
-
)
|
|
295
|
+
return types.getBlockBundleDefinition(field.hostEntityBundle)?.label || field.hostEntityBundle;
|
|
450
296
|
}
|
|
451
|
-
|
|
452
|
-
return state.entity.value.bundleLabel || field.hostEntityBundle
|
|
297
|
+
return state.entity.value.bundleLabel || field.hostEntityBundle;
|
|
453
298
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
return `${bundleLabel} » <strong>${field.label}</strong>`
|
|
299
|
+
function getInsertText(field) {
|
|
300
|
+
const bundleLabel = getBundleLabel(field);
|
|
301
|
+
return `${bundleLabel} \xBB <strong>${field.label}</strong>`;
|
|
458
302
|
}
|
|
459
|
-
|
|
460
|
-
const determineCanAddChildren = (
|
|
461
|
-
field: BlokkliFieldElement,
|
|
462
|
-
children: HTMLElement[],
|
|
463
|
-
) => {
|
|
464
|
-
// Check cardinality of field.
|
|
303
|
+
const determineCanAddChildren = (field, children) => {
|
|
465
304
|
if (field.cardinality !== -1) {
|
|
466
|
-
|
|
467
|
-
const count = state.getFieldBlockCount(field.key)
|
|
468
|
-
|
|
469
|
-
// Count of children that are also part of the selection.
|
|
305
|
+
const count = state.getFieldBlockCount(field.key);
|
|
470
306
|
const childrenThatAreSelection = children.filter((child) => {
|
|
471
|
-
const uuid = child.dataset.uuid
|
|
307
|
+
const uuid = child.dataset.uuid;
|
|
472
308
|
if (!uuid) {
|
|
473
|
-
return false
|
|
309
|
+
return false;
|
|
474
310
|
}
|
|
475
|
-
return selectionUuids.value.includes(uuid)
|
|
476
|
-
}).length
|
|
477
|
-
const countAfter = count - childrenThatAreSelection + props.items.length
|
|
311
|
+
return selectionUuids.value.includes(uuid);
|
|
312
|
+
}).length;
|
|
313
|
+
const countAfter = count - childrenThatAreSelection + props.items.length;
|
|
478
314
|
if (countAfter > field.cardinality) {
|
|
479
|
-
return false
|
|
315
|
+
return false;
|
|
480
316
|
}
|
|
481
317
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
)
|
|
488
|
-
)
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
const buildEmptyChild = (
|
|
492
|
-
field: BlokkliFieldElement,
|
|
493
|
-
children: HTMLElement[],
|
|
494
|
-
orientation: Orientation,
|
|
495
|
-
fieldWidth: number,
|
|
496
|
-
fieldHeight: number,
|
|
497
|
-
): FieldRectChild | undefined => {
|
|
318
|
+
return !draggingBundles.value.length || draggingBundles.value.every(
|
|
319
|
+
(bundle) => field.allowedBundles.includes(bundle)
|
|
320
|
+
);
|
|
321
|
+
};
|
|
322
|
+
const buildEmptyChild = (field, children, orientation, fieldWidth, fieldHeight) => {
|
|
498
323
|
if (children.length === 0) {
|
|
499
|
-
const id = buildChildId(field, null,
|
|
500
|
-
if (orientation ===
|
|
324
|
+
const id = buildChildId(field, null, "empty");
|
|
325
|
+
if (orientation === "horizontal") {
|
|
501
326
|
return {
|
|
502
327
|
id,
|
|
503
328
|
x: 0,
|
|
504
329
|
y: 0,
|
|
505
330
|
width: fieldWidth,
|
|
506
331
|
height: fieldHeight,
|
|
507
|
-
label: getInsertText(field)
|
|
508
|
-
}
|
|
332
|
+
label: getInsertText(field)
|
|
333
|
+
};
|
|
509
334
|
} else {
|
|
510
335
|
return {
|
|
511
336
|
id,
|
|
@@ -513,47 +338,42 @@ const buildEmptyChild = (
|
|
|
513
338
|
y: 0,
|
|
514
339
|
width: fieldWidth,
|
|
515
340
|
height: Math.max(fieldHeight, MIN_GAP),
|
|
516
|
-
label: getInsertText(field)
|
|
517
|
-
}
|
|
341
|
+
label: getInsertText(field)
|
|
342
|
+
};
|
|
518
343
|
}
|
|
519
344
|
}
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
const buildFieldRect = (key: string): FieldRect | undefined => {
|
|
345
|
+
};
|
|
346
|
+
const buildFieldRect = (key) => {
|
|
523
347
|
if (fieldCache[key]) {
|
|
524
|
-
return fieldCache[key]
|
|
348
|
+
return fieldCache[key];
|
|
525
349
|
}
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
350
|
+
const [uuid, name] = key.split(":");
|
|
351
|
+
if (!uuid || !name) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
const field = dom.findField(uuid, name);
|
|
529
355
|
if (!field) {
|
|
530
|
-
return
|
|
356
|
+
return;
|
|
531
357
|
}
|
|
532
|
-
const childElements = [...field.element.children]
|
|
533
|
-
|
|
534
|
-
const
|
|
535
|
-
const
|
|
536
|
-
field.dropAlignment || getChildrenOrientation(field.element)
|
|
537
|
-
|
|
538
|
-
const rect = dom.getFieldRect(field.key)
|
|
358
|
+
const childElements = [...field.element.children];
|
|
359
|
+
const canAddChildren = determineCanAddChildren(field, childElements);
|
|
360
|
+
const orientation = field.dropAlignment || getChildrenOrientation(field.element);
|
|
361
|
+
const rect = dom.getFieldRect(field.key);
|
|
539
362
|
if (!rect) {
|
|
540
|
-
throw new Error(
|
|
363
|
+
throw new Error("Failed to get rect for field: " + field.key);
|
|
541
364
|
}
|
|
542
|
-
const x = rect.x
|
|
543
|
-
const y = rect.y
|
|
544
|
-
const width = Math.max(rect.width, MIN_GAP)
|
|
545
|
-
|
|
546
|
-
const height = Math.max(rect.height, MIN_GAP)
|
|
365
|
+
const x = rect.x;
|
|
366
|
+
const y = rect.y;
|
|
367
|
+
const width = Math.max(rect.width, MIN_GAP);
|
|
368
|
+
const height = Math.max(rect.height, MIN_GAP);
|
|
547
369
|
const emptyChild = buildEmptyChild(
|
|
548
370
|
field,
|
|
549
371
|
childElements,
|
|
550
372
|
orientation,
|
|
551
373
|
width,
|
|
552
|
-
height
|
|
553
|
-
)
|
|
554
|
-
|
|
555
|
-
const gap = Math.max(getGapSize(orientation, field.element), MIN_GAP)
|
|
556
|
-
|
|
374
|
+
height
|
|
375
|
+
);
|
|
376
|
+
const gap = Math.max(getGapSize(orientation, field.element), MIN_GAP);
|
|
557
377
|
const fieldRect = {
|
|
558
378
|
key: field.key,
|
|
559
379
|
field,
|
|
@@ -566,74 +386,62 @@ const buildFieldRect = (key: string): FieldRect | undefined => {
|
|
|
566
386
|
emptyChild,
|
|
567
387
|
orientation,
|
|
568
388
|
gap,
|
|
569
|
-
childrenElements: childElements
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
const cachedDropAreaRects: Record<string, Rectangle> = {}
|
|
577
|
-
|
|
578
|
-
const buildDropAreaRect = (area: DropArea): Rectangle => {
|
|
389
|
+
childrenElements: childElements
|
|
390
|
+
};
|
|
391
|
+
fieldCache[key] = fieldRect;
|
|
392
|
+
return fieldRect;
|
|
393
|
+
};
|
|
394
|
+
const cachedDropAreaRects = {};
|
|
395
|
+
const buildDropAreaRect = (area) => {
|
|
579
396
|
if (cachedDropAreaRects[area.id]) {
|
|
580
|
-
return cachedDropAreaRects[area.id]
|
|
397
|
+
return cachedDropAreaRects[area.id];
|
|
581
398
|
}
|
|
582
|
-
|
|
583
|
-
const
|
|
584
|
-
|
|
585
|
-
const dropAreaRect: Rectangle = {
|
|
399
|
+
const rect = ui.getAbsoluteElementRect(area.element);
|
|
400
|
+
const dropAreaRect = {
|
|
586
401
|
x: rect.x,
|
|
587
402
|
y: rect.y,
|
|
588
403
|
width: Math.max(rect.width, MIN_GAP),
|
|
589
|
-
height: Math.max(rect.height, MIN_GAP)
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
const
|
|
597
|
-
const
|
|
598
|
-
|
|
599
|
-
const colorAccentAlpha = rgbaToString(theme.accent.value[800], 0.7)
|
|
600
|
-
|
|
601
|
-
function getRectType(field: BlokkliFieldElement): RectRenderType {
|
|
404
|
+
height: Math.max(rect.height, MIN_GAP)
|
|
405
|
+
};
|
|
406
|
+
cachedDropAreaRects[area.id] = dropAreaRect;
|
|
407
|
+
return dropAreaRect;
|
|
408
|
+
};
|
|
409
|
+
const colorTeal = rgbaToString(theme.teal.value.normal);
|
|
410
|
+
const colorTealAlpha = rgbaToString(theme.teal.value.normal, 0.7);
|
|
411
|
+
const colorAccent = rgbaToString(theme.accent.value[800]);
|
|
412
|
+
const colorAccentAlpha = rgbaToString(theme.accent.value[800], 0.7);
|
|
413
|
+
function getRectType(field) {
|
|
602
414
|
if (field.nestingLevel >= 3) {
|
|
603
|
-
return
|
|
415
|
+
return 4 /* FIELD_4 */;
|
|
604
416
|
} else if (field.nestingLevel >= 2) {
|
|
605
|
-
return
|
|
417
|
+
return 3 /* FIELD_3 */;
|
|
606
418
|
} else if (field.nestingLevel >= 1) {
|
|
607
|
-
return
|
|
419
|
+
return 2 /* FIELD_2 */;
|
|
608
420
|
}
|
|
609
|
-
return
|
|
421
|
+
return 1 /* FIELD_1 */;
|
|
610
422
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
const
|
|
615
|
-
const
|
|
616
|
-
|
|
617
|
-
const lengthBefore = this.positions.length
|
|
618
|
-
|
|
423
|
+
class DropTargetRectangleBufferCollector extends RectangleBufferCollector {
|
|
424
|
+
getBufferInfo() {
|
|
425
|
+
const visibleFields = dom.getVisibleFields();
|
|
426
|
+
const visibleBlocks = dom.getVisibleBlocks();
|
|
427
|
+
const lengthBefore = this.positions.length;
|
|
619
428
|
for (let i = 0; i < visibleFields.length; i++) {
|
|
620
|
-
const key = visibleFields[i]
|
|
621
|
-
const fieldRect = buildFieldRect(key)
|
|
622
|
-
|
|
429
|
+
const key = visibleFields[i];
|
|
430
|
+
const fieldRect = buildFieldRect(key);
|
|
623
431
|
if (!fieldRect) {
|
|
624
|
-
continue
|
|
432
|
+
continue;
|
|
625
433
|
}
|
|
626
|
-
const children = buildChildren(fieldRect, visibleBlocks)
|
|
434
|
+
const children = buildChildren(fieldRect, visibleBlocks);
|
|
627
435
|
for (let j = 0; j < children.length; j++) {
|
|
628
|
-
const child = children[j]
|
|
436
|
+
const child = children[j];
|
|
629
437
|
if (this.added.has(child.id)) {
|
|
630
|
-
continue
|
|
438
|
+
continue;
|
|
631
439
|
}
|
|
632
|
-
const type = getRectType(fieldRect.field)
|
|
440
|
+
const type = getRectType(fieldRect.field);
|
|
633
441
|
this.addRectangle(
|
|
634
442
|
{
|
|
635
443
|
id: child.id,
|
|
636
|
-
type:
|
|
444
|
+
type: "field",
|
|
637
445
|
label: child.label,
|
|
638
446
|
color: colorAccent,
|
|
639
447
|
colorAlpha: colorAccentAlpha,
|
|
@@ -641,173 +449,146 @@ class DropTargetRectangleBufferCollector extends RectangleBufferCollector<DrawnR
|
|
|
641
449
|
y: fieldRect.y + child.y,
|
|
642
450
|
width: child.width,
|
|
643
451
|
height: child.height,
|
|
644
|
-
field: fieldRect
|
|
452
|
+
field: fieldRect
|
|
645
453
|
},
|
|
646
454
|
type,
|
|
647
|
-
true
|
|
648
|
-
)
|
|
455
|
+
true
|
|
456
|
+
);
|
|
649
457
|
}
|
|
650
458
|
}
|
|
651
|
-
|
|
652
|
-
const visibleAreas = Array.from(visibleDropAreas)
|
|
653
|
-
|
|
459
|
+
const visibleAreas = Array.from(visibleDropAreas);
|
|
654
460
|
for (let i = 0; i < visibleAreas.length; i++) {
|
|
655
|
-
const area = areas[visibleAreas[i]]
|
|
461
|
+
const area = areas[visibleAreas[i]];
|
|
656
462
|
if (!area) {
|
|
657
|
-
continue
|
|
463
|
+
continue;
|
|
658
464
|
}
|
|
659
465
|
if (this.added.has(area.id)) {
|
|
660
|
-
continue
|
|
466
|
+
continue;
|
|
661
467
|
}
|
|
662
|
-
const areaRect = buildDropAreaRect(area)
|
|
663
|
-
|
|
468
|
+
const areaRect = buildDropAreaRect(area);
|
|
664
469
|
this.addRectangle(
|
|
665
470
|
{
|
|
666
471
|
id: area.id,
|
|
667
|
-
type:
|
|
472
|
+
type: "drop-area",
|
|
668
473
|
label: area.label,
|
|
669
474
|
color: colorTeal,
|
|
670
475
|
colorAlpha: colorTealAlpha,
|
|
671
476
|
x: areaRect.x,
|
|
672
477
|
y: areaRect.y,
|
|
673
478
|
width: areaRect.width,
|
|
674
|
-
height: areaRect.height
|
|
479
|
+
height: areaRect.height
|
|
675
480
|
},
|
|
676
|
-
|
|
677
|
-
false
|
|
678
|
-
)
|
|
481
|
+
0 /* DROP_AREA */,
|
|
482
|
+
false
|
|
483
|
+
);
|
|
679
484
|
}
|
|
680
|
-
|
|
681
|
-
const hasChanged = lengthBefore !== this.positions.length
|
|
682
|
-
|
|
683
|
-
// Only update the buffer info if it has changed.
|
|
485
|
+
const hasChanged = lengthBefore !== this.positions.length;
|
|
684
486
|
if (hasChanged) {
|
|
685
|
-
this.bufferInfo = this.createBufferInfo()
|
|
487
|
+
this.bufferInfo = this.createBufferInfo();
|
|
686
488
|
}
|
|
687
|
-
|
|
688
|
-
return { info: this.bufferInfo, hasChanged }
|
|
489
|
+
return { info: this.bufferInfo, hasChanged };
|
|
689
490
|
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
const
|
|
693
|
-
const rects = Object.values(this.rects)
|
|
491
|
+
getClosestIntersectingRect(box, coords) {
|
|
492
|
+
const candidates = [];
|
|
493
|
+
const rects = Object.values(this.rects);
|
|
694
494
|
for (let i = 0; i < rects.length; i++) {
|
|
695
|
-
const rect = rects[i]
|
|
696
|
-
if (rect.type ===
|
|
697
|
-
continue
|
|
495
|
+
const rect = rects[i];
|
|
496
|
+
if (rect.type === "active-area") {
|
|
497
|
+
continue;
|
|
698
498
|
}
|
|
699
499
|
if (intersects(box, rect)) {
|
|
700
|
-
candidates.push(rect)
|
|
500
|
+
candidates.push(rect);
|
|
701
501
|
}
|
|
702
502
|
}
|
|
703
|
-
|
|
704
503
|
if (candidates.length === 0) {
|
|
705
|
-
return null
|
|
504
|
+
return null;
|
|
706
505
|
} else if (candidates.length === 1) {
|
|
707
|
-
return candidates[0]
|
|
506
|
+
return candidates[0];
|
|
708
507
|
}
|
|
709
|
-
|
|
710
|
-
return findClosestRectangle(coords.x, coords.y, candidates)
|
|
508
|
+
return findClosestRectangle(coords.x, coords.y, candidates);
|
|
711
509
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
const rects = Object.values(this.rects)
|
|
715
|
-
|
|
510
|
+
getRectAtPosition(coord) {
|
|
511
|
+
const rects = Object.values(this.rects);
|
|
716
512
|
for (let i = 0; i < rects.length; i++) {
|
|
717
|
-
const rect = rects[i]
|
|
718
|
-
if (rect.type ===
|
|
719
|
-
continue
|
|
513
|
+
const rect = rects[i];
|
|
514
|
+
if (rect.type === "active-area") {
|
|
515
|
+
continue;
|
|
720
516
|
}
|
|
721
517
|
if (isInsideRect(coord.x, coord.y, rect)) {
|
|
722
|
-
return rect
|
|
518
|
+
return rect;
|
|
723
519
|
}
|
|
724
520
|
}
|
|
725
|
-
|
|
726
|
-
return null
|
|
521
|
+
return null;
|
|
727
522
|
}
|
|
728
523
|
}
|
|
729
|
-
|
|
730
|
-
const collector = new DropTargetRectangleBufferCollector(gl)
|
|
731
|
-
|
|
732
|
-
// Add a rectangle that we will use to display the hovered field area.
|
|
733
|
-
// The vertex shader will dynamically transform the quad to match the currently hovered field area.
|
|
524
|
+
const collector = new DropTargetRectangleBufferCollector(gl);
|
|
734
525
|
collector.addRectangle(
|
|
735
526
|
{
|
|
736
|
-
id:
|
|
737
|
-
type:
|
|
738
|
-
label:
|
|
739
|
-
color:
|
|
740
|
-
colorAlpha:
|
|
527
|
+
id: "active-hover-rect",
|
|
528
|
+
type: "active-area",
|
|
529
|
+
label: "Field Area",
|
|
530
|
+
color: "red",
|
|
531
|
+
colorAlpha: "red",
|
|
741
532
|
x: 0,
|
|
742
533
|
y: 0,
|
|
743
534
|
width: ui.artboardSize.value.width,
|
|
744
|
-
height: ui.artboardSize.value.height
|
|
535
|
+
height: ui.artboardSize.value.height
|
|
745
536
|
},
|
|
746
|
-
|
|
747
|
-
false
|
|
748
|
-
)
|
|
749
|
-
|
|
537
|
+
5 /* ACTIVE_AREA */,
|
|
538
|
+
false
|
|
539
|
+
);
|
|
750
540
|
const fieldColors = computed(() => {
|
|
751
541
|
return {
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
}
|
|
757
|
-
})
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
const nestingLevel = field?.field.nestingLevel || 0
|
|
542
|
+
"0": theme.accent.value[900],
|
|
543
|
+
"1": theme.accent.value[400],
|
|
544
|
+
"2": theme.accent.value[600],
|
|
545
|
+
"3": theme.accent.value[500]
|
|
546
|
+
};
|
|
547
|
+
});
|
|
548
|
+
function getColorForField(field) {
|
|
549
|
+
const nestingLevel = field?.field.nestingLevel || 0;
|
|
761
550
|
if (nestingLevel >= 3) {
|
|
762
|
-
return fieldColors.value[3]
|
|
551
|
+
return fieldColors.value[3];
|
|
763
552
|
} else if (nestingLevel >= 2) {
|
|
764
|
-
return fieldColors.value[2]
|
|
553
|
+
return fieldColors.value[2];
|
|
765
554
|
} else if (nestingLevel >= 1) {
|
|
766
|
-
return fieldColors.value[1]
|
|
555
|
+
return fieldColors.value[1];
|
|
767
556
|
}
|
|
768
|
-
return fieldColors.value[0]
|
|
557
|
+
return fieldColors.value[0];
|
|
769
558
|
}
|
|
770
|
-
|
|
771
559
|
const activeColorRgb = computed(() => {
|
|
772
|
-
if (active.value?.type ===
|
|
773
|
-
return theme.teal.value.normal
|
|
560
|
+
if (active.value?.type === "drop-area") {
|
|
561
|
+
return theme.teal.value.normal;
|
|
774
562
|
}
|
|
775
563
|
if (!active.value) {
|
|
776
|
-
return
|
|
564
|
+
return;
|
|
777
565
|
}
|
|
778
|
-
return getColorForField(active.value?.field)
|
|
779
|
-
})
|
|
780
|
-
|
|
566
|
+
return getColorForField(active.value?.field);
|
|
567
|
+
});
|
|
781
568
|
const activeColorHex = computed(() => {
|
|
782
569
|
if (activeColorRgb.value) {
|
|
783
|
-
return rgbaToString(activeColorRgb.value)
|
|
570
|
+
return rgbaToString(activeColorRgb.value);
|
|
784
571
|
}
|
|
785
|
-
return
|
|
786
|
-
})
|
|
787
|
-
|
|
788
|
-
const activeHoverField = ref<FieldRect | null>(null)
|
|
789
|
-
|
|
572
|
+
return "";
|
|
573
|
+
});
|
|
574
|
+
const activeHoverField = ref(null);
|
|
790
575
|
const activeHoverRect = computed(() => {
|
|
791
576
|
if (!activeHoverField.value) {
|
|
792
|
-
return [0, 0, 0, 0]
|
|
577
|
+
return [0, 0, 0, 0];
|
|
793
578
|
}
|
|
794
|
-
|
|
795
|
-
const outset = activeHoverField.value.field.nestingLevel === 0 ? 0 : 20
|
|
796
|
-
|
|
579
|
+
const outset = activeHoverField.value.field.nestingLevel === 0 ? 0 : 20;
|
|
797
580
|
return [
|
|
798
581
|
activeHoverField.value.x - outset,
|
|
799
582
|
activeHoverField.value.y - outset,
|
|
800
583
|
activeHoverField.value.width + 2 * outset,
|
|
801
|
-
activeHoverField.value.height + 2 * outset
|
|
802
|
-
]
|
|
803
|
-
})
|
|
804
|
-
|
|
584
|
+
activeHoverField.value.height + 2 * outset
|
|
585
|
+
];
|
|
586
|
+
});
|
|
805
587
|
const activeHoverColor = computed(() => {
|
|
806
|
-
return getColorForField(activeHoverField.value)
|
|
807
|
-
})
|
|
808
|
-
|
|
588
|
+
return getColorForField(activeHoverField.value);
|
|
589
|
+
});
|
|
809
590
|
const uniforms = computed(() => {
|
|
810
|
-
const index = active.value?.index
|
|
591
|
+
const index = active.value?.index;
|
|
811
592
|
return {
|
|
812
593
|
u_color_field_0: toShaderColor(fieldColors.value[0]),
|
|
813
594
|
u_color_field_1: toShaderColor(fieldColors.value[1]),
|
|
@@ -815,152 +596,118 @@ const uniforms = computed(() => {
|
|
|
815
596
|
u_color_field_3: toShaderColor(fieldColors.value[3]),
|
|
816
597
|
u_color_hover_area: toShaderColor(activeHoverColor.value),
|
|
817
598
|
u_color_area: toShaderColor(theme.teal.value.normal),
|
|
818
|
-
u_active_rect_id: index ===
|
|
819
|
-
u_active_hover_rect: activeHoverRect.value
|
|
820
|
-
}
|
|
821
|
-
})
|
|
822
|
-
|
|
823
|
-
const dragBox = ref<Rectangle>({
|
|
599
|
+
u_active_rect_id: index === void 0 ? -1 : index,
|
|
600
|
+
u_active_hover_rect: activeHoverRect.value
|
|
601
|
+
};
|
|
602
|
+
});
|
|
603
|
+
const dragBox = ref({
|
|
824
604
|
x: 0,
|
|
825
605
|
y: 0,
|
|
826
606
|
width: 0,
|
|
827
|
-
height: 0
|
|
828
|
-
})
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
const
|
|
832
|
-
const offset = { ...ui.artboardOffset.value }
|
|
607
|
+
height: 0
|
|
608
|
+
});
|
|
609
|
+
function toCanvasSpaceCoordinates(x, y) {
|
|
610
|
+
const scale = ui.artboardScale.value;
|
|
611
|
+
const offset = { ...ui.artboardOffset.value };
|
|
833
612
|
return {
|
|
834
613
|
x: (x - offset.x) / scale,
|
|
835
|
-
y: (y - offset.y) / scale
|
|
836
|
-
}
|
|
614
|
+
y: (y - offset.y) / scale
|
|
615
|
+
};
|
|
837
616
|
}
|
|
838
|
-
|
|
839
|
-
function setHoveredFieldArea(box: Rectangle, mouse: Coord) {
|
|
617
|
+
function setHoveredFieldArea(box, mouse) {
|
|
840
618
|
if (active.value?.field) {
|
|
841
619
|
if (activeHoverField.value?.key !== active.value.field.key) {
|
|
842
|
-
activeHoverField.value = active.value.field
|
|
620
|
+
activeHoverField.value = active.value.field;
|
|
843
621
|
}
|
|
844
|
-
return
|
|
622
|
+
return;
|
|
845
623
|
}
|
|
846
|
-
const fields = Object.values(fieldCache)
|
|
847
|
-
|
|
848
|
-
let
|
|
849
|
-
let candidate: FieldRect | null = null
|
|
850
|
-
|
|
624
|
+
const fields = Object.values(fieldCache);
|
|
625
|
+
let highestNestingLevel = 0;
|
|
626
|
+
let candidate = null;
|
|
851
627
|
for (let i = 0; i < fields.length; i++) {
|
|
852
|
-
const field = fields[i]
|
|
628
|
+
const field = fields[i];
|
|
853
629
|
if (!field.canAddChildren) {
|
|
854
|
-
continue
|
|
630
|
+
continue;
|
|
855
631
|
}
|
|
856
|
-
if (
|
|
857
|
-
|
|
858
|
-
field.field.nestingLevel
|
|
859
|
-
|
|
860
|
-
candidate = field
|
|
861
|
-
highestNestingLevel = field.field.nestingLevel
|
|
862
|
-
continue
|
|
632
|
+
if (isInsideRect(mouse.x, mouse.y, field) && field.field.nestingLevel >= highestNestingLevel) {
|
|
633
|
+
candidate = field;
|
|
634
|
+
highestNestingLevel = field.field.nestingLevel;
|
|
635
|
+
continue;
|
|
863
636
|
}
|
|
864
|
-
if (
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
) {
|
|
868
|
-
highestNestingLevel = field.field.nestingLevel
|
|
869
|
-
candidate = field
|
|
637
|
+
if (intersects(box, field) && field.field.nestingLevel >= highestNestingLevel) {
|
|
638
|
+
highestNestingLevel = field.field.nestingLevel;
|
|
639
|
+
candidate = field;
|
|
870
640
|
}
|
|
871
641
|
}
|
|
872
|
-
|
|
873
642
|
if (candidate && candidate.key !== activeHoverField.value?.key) {
|
|
874
|
-
activeHoverField.value = candidate
|
|
643
|
+
activeHoverField.value = candidate;
|
|
875
644
|
}
|
|
876
645
|
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
const
|
|
880
|
-
const offset = { ...ui.artboardOffset.value }
|
|
881
|
-
|
|
646
|
+
onBlokkliEvent("canvas:draw", () => {
|
|
647
|
+
const scale = ui.artboardScale.value;
|
|
648
|
+
const offset = { ...ui.artboardOffset.value };
|
|
882
649
|
dragBox.value = {
|
|
883
650
|
x: (props.box.x - offset.x) / scale,
|
|
884
651
|
y: (props.box.y - offset.y) / scale,
|
|
885
652
|
width: props.box.width / scale,
|
|
886
|
-
height: props.box.height / scale
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
const mouseAbsolute = toCanvasSpaceCoordinates(props.mouseX, props.mouseY)
|
|
890
|
-
|
|
653
|
+
height: props.box.height / scale
|
|
654
|
+
};
|
|
655
|
+
const mouseAbsolute = toCanvasSpaceCoordinates(props.mouseX, props.mouseY);
|
|
891
656
|
if (gl && programInfo) {
|
|
892
|
-
gl.useProgram(programInfo.program)
|
|
893
|
-
animation.setSharedUniforms(gl, programInfo)
|
|
657
|
+
gl.useProgram(programInfo.program);
|
|
658
|
+
animation.setSharedUniforms(gl, programInfo);
|
|
894
659
|
}
|
|
895
|
-
|
|
896
660
|
if (!props.isTouch) {
|
|
897
661
|
if (cursorIsInsideClipped()) {
|
|
898
662
|
const closest = collector.getClosestIntersectingRect(
|
|
899
663
|
dragBox.value,
|
|
900
|
-
mouseAbsolute
|
|
901
|
-
)
|
|
902
|
-
|
|
903
|
-
active.value = closest || null
|
|
664
|
+
mouseAbsolute
|
|
665
|
+
);
|
|
666
|
+
active.value = closest || null;
|
|
904
667
|
} else {
|
|
905
|
-
active.value = null
|
|
668
|
+
active.value = null;
|
|
906
669
|
}
|
|
907
670
|
}
|
|
908
|
-
|
|
909
|
-
const { info, hasChanged } = collector.getBufferInfo()
|
|
910
|
-
|
|
911
|
-
// WebGL rendering.
|
|
671
|
+
const { info, hasChanged } = collector.getBufferInfo();
|
|
912
672
|
if (programInfo && gl) {
|
|
913
|
-
setHoveredFieldArea(dragBox.value, mouseAbsolute)
|
|
914
|
-
setUniforms(programInfo, uniforms.value)
|
|
915
|
-
|
|
916
|
-
// Nothing to draw.
|
|
673
|
+
setHoveredFieldArea(dragBox.value, mouseAbsolute);
|
|
674
|
+
setUniforms(programInfo, uniforms.value);
|
|
917
675
|
if (info) {
|
|
918
|
-
// Only update buffer and attributes when they have changed.
|
|
919
676
|
if (hasChanged && gl && programInfo) {
|
|
920
|
-
setBuffersAndAttributes(gl, programInfo, info)
|
|
677
|
+
setBuffersAndAttributes(gl, programInfo, info);
|
|
921
678
|
}
|
|
922
|
-
|
|
923
679
|
if (gl) {
|
|
924
|
-
drawBufferInfo(gl, info, gl.TRIANGLES)
|
|
680
|
+
drawBufferInfo(gl, info, gl.TRIANGLES);
|
|
925
681
|
}
|
|
926
682
|
}
|
|
927
|
-
|
|
928
|
-
return
|
|
683
|
+
return;
|
|
929
684
|
}
|
|
930
|
-
|
|
931
|
-
// Fallback rendering.
|
|
932
685
|
if (!ctx) {
|
|
933
|
-
return
|
|
686
|
+
return;
|
|
934
687
|
}
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
const rects = Object.values(collector.rects)
|
|
939
|
-
|
|
688
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
689
|
+
const rects = Object.values(collector.rects);
|
|
940
690
|
for (let i = 0; i < rects.length; i++) {
|
|
941
|
-
const rect = rects[i]
|
|
691
|
+
const rect = rects[i];
|
|
942
692
|
if (active.value?.id === rect.id) {
|
|
943
|
-
ctx.fillStyle = rect.color
|
|
693
|
+
ctx.fillStyle = rect.color;
|
|
944
694
|
} else {
|
|
945
|
-
ctx.fillStyle = rect.colorAlpha
|
|
695
|
+
ctx.fillStyle = rect.colorAlpha;
|
|
946
696
|
}
|
|
947
|
-
|
|
948
697
|
ctx.fillRect(
|
|
949
698
|
(rect.x * scale + offset.x) * animation.dpi.value,
|
|
950
699
|
(rect.y * scale + offset.y) * animation.dpi.value,
|
|
951
700
|
rect.width * animation.dpi.value * scale,
|
|
952
|
-
rect.height * animation.dpi.value * scale
|
|
953
|
-
)
|
|
701
|
+
rect.height * animation.dpi.value * scale
|
|
702
|
+
);
|
|
954
703
|
}
|
|
955
|
-
})
|
|
956
|
-
|
|
704
|
+
});
|
|
957
705
|
onBeforeUnmount(() => {
|
|
958
706
|
if (gl) {
|
|
959
|
-
gl.clear(gl.COLOR_BUFFER_BIT)
|
|
707
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
960
708
|
}
|
|
961
|
-
|
|
962
709
|
if (ctx) {
|
|
963
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height)
|
|
710
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
964
711
|
}
|
|
965
|
-
})
|
|
712
|
+
});
|
|
966
713
|
</script>
|