@blokkli/editor 2.0.0-alpha.13 → 2.0.0-alpha.15
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 +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +4873 -1167
- package/dist/modules/drupal/graphql/base/fragment.ParagraphsBlokkliConfigInput.graphql +31 -0
- package/dist/modules/drupal/graphql/base/fragment.blokkliProps.graphql +1 -0
- package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliEditState.graphql +5 -0
- package/dist/modules/drupal/graphql/base/query.pbEntityConfig.graphql +5 -0
- package/dist/modules/drupal/graphql/features/publishNew.graphql +1 -4
- package/dist/modules/drupal/graphql/features/scheduler.graphql +31 -0
- package/dist/modules/drupal/graphql/features/transform.graphql +9 -1
- package/dist/modules/drupal/graphql/features/transform_host.graphql +38 -0
- package/dist/modules/drupal/graphql/mutations/update_host_options.graphql +15 -0
- package/dist/modules/drupal/index.d.mts +1 -1
- package/dist/modules/drupal/index.mjs +37 -7
- package/dist/modules/drupal/runtime/adapter/index.js +140 -5
- package/dist/runtime/adapter/index.d.ts +90 -1
- package/dist/runtime/blokkliPlugins/AddAction/index.vue +27 -3
- package/dist/runtime/blokkliPlugins/BlockIndicator/index.vue +65 -0
- package/dist/runtime/blokkliPlugins/BlockIndicator/index.vue.d.ts +26 -0
- package/dist/runtime/blokkliPlugins/ContextMenu/Menu/index.vue +3 -0
- package/dist/runtime/blokkliPlugins/ContextMenu/index.vue +3 -2
- package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +3 -3
- package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue +49 -11
- package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue.d.ts +29 -15
- package/dist/runtime/blokkliPlugins/MenuButton/index.vue.d.ts +2 -2
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +6 -7
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue +2 -9
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +1 -1
- package/dist/runtime/blokkliPlugins/ViewOption/index.vue +6 -3
- package/dist/runtime/blokkliPlugins/index.d.ts +8 -7
- package/dist/runtime/blokkliPlugins/index.js +15 -13
- package/dist/runtime/components/Blocks/Fragment/icon.svg +1 -1
- package/dist/runtime/components/BlokkliProvider.vue +1 -0
- package/dist/runtime/components/BlokkliProvider.vue.d.ts +1 -0
- package/dist/runtime/components/Edit/Actions/index.vue +39 -67
- package/dist/runtime/components/Edit/AddListItem/index.vue +2 -5
- package/dist/runtime/components/Edit/AddListItem/index.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/AddListItemIcon/index.vue +19 -0
- package/dist/runtime/components/Edit/AddListItemIcon/index.vue.d.ts +15 -0
- package/dist/runtime/components/Edit/AppMenu/index.vue +5 -5
- package/dist/runtime/components/Edit/Dialog/index.vue +5 -1
- package/dist/runtime/components/Edit/Dialog/index.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/DiffViewer/State.vue +276 -0
- package/dist/runtime/components/Edit/DiffViewer/State.vue.d.ts +16 -0
- package/dist/runtime/components/Edit/DragInteractions/index.vue +35 -6
- package/dist/runtime/components/Edit/EditProvider.vue +46 -35
- package/dist/runtime/components/Edit/Features/AddList/index.vue +15 -25
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/fragment.glsl +58 -0
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/index.vue +168 -0
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/index.vue.d.ts +9 -0
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/vertex.glsl +72 -0
- package/dist/runtime/components/Edit/Features/Analyze/Renderer.vue +159 -0
- package/dist/runtime/components/Edit/Features/Analyze/Renderer.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue +100 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue +56 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue.d.ts +3 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue +87 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +101 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue.d.ts +8 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/Status.vue +18 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/Status.vue.d.ts +8 -0
- package/dist/runtime/components/Edit/Features/Analyze/Summary/Chart.vue +92 -0
- package/dist/runtime/components/Edit/Features/Analyze/Summary/Chart.vue.d.ts +17 -0
- package/dist/runtime/components/Edit/Features/Analyze/Summary/index.vue +77 -0
- package/dist/runtime/components/Edit/Features/Analyze/Summary/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/axe.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/axe.js +75 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/defineAnalyzer.d.ts +4 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/defineAnalyzer.js +5 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.d.ts +32 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.js +45 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/collectTextElements.d.ts +5 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/collectTextElements.js +95 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/normalizeArray.d.ts +3 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/normalizeArray.js +13 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/index.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/index.js +2 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/readability.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/readability.js +165 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/types.d.ts +44 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/types.js +0 -0
- package/dist/runtime/components/Edit/Features/Analyze/helper.d.ts +5 -0
- package/dist/runtime/components/Edit/Features/Analyze/helper.js +28 -0
- package/dist/runtime/components/Edit/Features/Analyze/index.vue +44 -0
- package/dist/runtime/components/Edit/Features/Anchors/Renderer.vue +136 -0
- package/dist/runtime/components/Edit/Features/Anchors/index.vue +32 -0
- package/dist/runtime/components/Edit/Features/Anchors/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Artboard/Overview/index.vue +25 -13
- package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +296 -0
- package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Features/Artboard/index.vue +10 -245
- package/dist/runtime/components/Edit/Features/Assistant/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +4 -4
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue +161 -28
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue +16 -4
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue.d.ts +0 -1
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +4 -53
- package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Conversions/index.vue +12 -14
- package/dist/runtime/components/Edit/Features/Debug/Viewport/index.vue +14 -0
- package/dist/runtime/components/Edit/Features/Debug/index.vue +27 -24
- package/dist/runtime/components/Edit/Features/Diff/DiffView/index.vue +13 -190
- package/dist/runtime/components/Edit/Features/Diff/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +4 -4
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/fragment.glsl +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +35 -71
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/vertex.glsl +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +62 -48
- package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +6 -2
- package/dist/runtime/components/Edit/Features/EditableMask/index.vue +3 -20
- package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +33 -1
- package/dist/runtime/components/Edit/Features/Fragments/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/History/index.vue +35 -12
- package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue +6 -2
- package/dist/runtime/components/Edit/Features/ImportExisting/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Library/index.vue +11 -9
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +5 -8
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/fragment.glsl +1 -1
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue +9 -4
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/vertex.glsl +1 -1
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +8 -14
- package/dist/runtime/components/Edit/Features/Options/Form/Checkbox/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Options/Form/Checkbox/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +9 -3
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue.d.ts +0 -1
- package/dist/runtime/components/Edit/Features/Options/Form/Radios/index.vue +37 -19
- package/dist/runtime/components/Edit/Features/Options/Form/Radios/index.vue.d.ts +8 -2
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue +81 -37
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue.d.ts +5 -5
- package/dist/runtime/components/Edit/Features/Options/index.vue +30 -6
- package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/Publish/Dialog/Item.vue +41 -14
- package/dist/runtime/components/Edit/Features/Publish/Dialog/Item.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/PublishOption.vue +47 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/PublishOption.vue.d.ts +19 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/ScheduleDate.vue +183 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/ScheduleDate.vue.d.ts +13 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/Summary.vue +83 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/Summary.vue.d.ts +9 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +381 -128
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue.d.ts +3 -14
- package/dist/runtime/components/Edit/Features/Publish/index.vue +37 -22
- package/dist/runtime/components/Edit/Features/Revert/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/Search/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/AddButtonsField.vue +54 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/AddButtonsField.vue.d.ts +14 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +120 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +15 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +459 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Selection/Overlay/fragment.glsl +14 -9
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue +32 -11
- package/dist/runtime/components/Edit/Features/Selection/Overlay/vertex.glsl +1 -1
- package/dist/runtime/components/Edit/Features/Selection/index.vue +76 -7
- package/dist/runtime/components/Edit/Features/Settings/Dialog/FeatureSetting/index.vue +12 -17
- package/dist/runtime/components/Edit/Features/Settings/index.vue +11 -25
- package/dist/runtime/components/Edit/Features/Theme/Color/index.vue +5 -1
- package/dist/runtime/components/Edit/Features/Theme/index.vue +2 -1
- package/dist/runtime/components/Edit/Features/TouchActionBar/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Transform/Dialog/index.vue +198 -0
- package/dist/runtime/components/Edit/Features/Transform/Dialog/index.vue.d.ts +13 -0
- package/dist/runtime/components/Edit/Features/Transform/index.vue +155 -44
- package/dist/runtime/components/Edit/Form/Datepicker/index.vue +198 -0
- package/dist/runtime/components/Edit/Form/Datepicker/index.vue.d.ts +15 -0
- package/dist/runtime/components/Edit/Form/Radio/index.vue +33 -0
- package/dist/runtime/components/Edit/Form/Radio/index.vue.d.ts +20 -0
- package/dist/runtime/components/Edit/Form/RadioTabs/index.vue +37 -0
- package/dist/runtime/components/Edit/Form/RadioTabs/index.vue.d.ts +22 -0
- package/dist/runtime/components/Edit/Form/Select/index.vue +29 -0
- package/dist/runtime/components/Edit/Form/Select/index.vue.d.ts +20 -0
- package/dist/runtime/components/Edit/Form/Text/index.vue +33 -0
- package/dist/runtime/components/Edit/Form/Text/index.vue.d.ts +19 -0
- package/dist/runtime/components/Edit/Form/Textarea/index.vue +13 -6
- package/dist/runtime/components/Edit/Form/Textarea/index.vue.d.ts +4 -0
- package/dist/runtime/components/Edit/FormOverlay/index.vue +1 -1
- package/dist/runtime/components/Edit/Indicators/index.vue +123 -0
- package/dist/runtime/components/Edit/Indicators/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/ItemIcon/index.vue +2 -1
- package/dist/runtime/components/Edit/Konami/Game/PixelGrid.vue +66 -0
- package/dist/runtime/components/Edit/Konami/Game/PixelGrid.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Konami/Game/blokkli.png +0 -0
- package/dist/runtime/components/Edit/Konami/Game/charmap.d.ts +2 -0
- package/dist/runtime/components/Edit/Konami/Game/charmap.js +168 -0
- package/dist/runtime/components/Edit/Konami/Game/index.vue +752 -0
- package/dist/runtime/components/Edit/Konami/Game/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Konami/Game/textRendering.d.ts +8 -0
- package/dist/runtime/components/Edit/Konami/Game/textRendering.js +138 -0
- package/dist/runtime/components/Edit/Konami/Game/useIconRendering.d.ts +9 -0
- package/dist/runtime/components/Edit/Konami/Game/useIconRendering.js +130 -0
- package/dist/runtime/components/Edit/Konami/index.vue +44 -0
- package/dist/runtime/components/Edit/Konami/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Loading/index.vue +6 -2
- package/dist/runtime/components/Edit/Loading/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Messages/index.vue +8 -3
- package/dist/runtime/components/Edit/PluginConfigForm/Checkbox/index.vue +17 -0
- package/dist/runtime/components/Edit/PluginConfigForm/Checkbox/index.vue.d.ts +11 -0
- package/dist/runtime/components/Edit/PluginConfigForm/Options/index.vue +37 -0
- package/dist/runtime/components/Edit/PluginConfigForm/Options/index.vue.d.ts +11 -0
- package/dist/runtime/components/Edit/PluginConfigForm/Text/index.vue +43 -0
- package/dist/runtime/components/Edit/PluginConfigForm/Text/index.vue.d.ts +11 -0
- package/dist/runtime/components/Edit/PluginConfigForm/index.vue +57 -0
- package/dist/runtime/components/Edit/PluginConfigForm/index.vue.d.ts +16 -0
- package/dist/runtime/components/Edit/PreviewProvider.vue +3 -4
- package/dist/runtime/components/Edit/RelativeTime/index.vue +3 -2
- package/dist/runtime/components/Edit/ShortcutIndicator/index.vue +8 -3
- package/dist/runtime/components/Edit/SystemRequirements/index.vue +3 -3
- package/dist/runtime/components/Edit/Toolbar/index.vue +3 -2
- package/dist/runtime/components/Edit/Transition/index.vue +41 -0
- package/dist/runtime/components/Edit/Transition/index.vue.d.ts +19 -0
- package/dist/runtime/components/Edit/index.d.ts +24 -15
- package/dist/runtime/components/Edit/index.js +46 -28
- package/dist/runtime/composables/defineBlokkli.js +7 -3
- package/dist/runtime/composables/defineBlokkliFeature.d.ts +4 -7
- package/dist/runtime/composables/defineBlokkliProvider.d.ts +11 -0
- package/dist/runtime/composables/defineBlokkliProvider.js +46 -0
- package/dist/runtime/composables/useBlokkliHelper.js +1 -1
- package/dist/runtime/constants/index.d.ts +3 -0
- package/dist/runtime/constants/index.js +3 -0
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/addElementClasses.d.ts +2 -0
- package/dist/runtime/helpers/addElementClasses.js +24 -0
- package/dist/runtime/helpers/animationProvider.d.ts +4 -2
- package/dist/runtime/helpers/animationProvider.js +7 -2
- package/dist/runtime/helpers/bundles/index.d.ts +1 -0
- package/dist/runtime/helpers/bundles/index.js +4 -0
- package/dist/runtime/helpers/composables/useStickyToolbar.d.ts +20 -0
- package/dist/runtime/helpers/composables/useStickyToolbar.js +215 -0
- package/dist/runtime/helpers/definitionProvider.d.ts +2 -1
- package/dist/runtime/helpers/definitionProvider.js +17 -0
- package/dist/runtime/helpers/domProvider.d.ts +2 -1
- package/dist/runtime/helpers/domProvider.js +89 -43
- package/dist/runtime/helpers/dropTargets/index.d.ts +6 -0
- package/dist/runtime/helpers/dropTargets/index.js +49 -0
- package/dist/runtime/helpers/eventBus.d.ts +1 -1
- package/dist/runtime/helpers/eventBus.js +2 -2
- package/dist/runtime/helpers/index.d.ts +10 -1
- package/dist/runtime/helpers/index.js +57 -0
- package/dist/runtime/helpers/indicatorsProvider.d.ts +10 -0
- package/dist/runtime/helpers/indicatorsProvider.js +23 -0
- package/dist/runtime/helpers/keyboardProvider.d.ts +2 -0
- package/dist/runtime/helpers/keyboardProvider.js +17 -1
- package/dist/runtime/helpers/pluginProvider.d.ts +10 -0
- package/dist/runtime/helpers/pluginProvider.js +33 -0
- package/dist/runtime/helpers/renderCycle.d.ts +1 -0
- package/dist/runtime/helpers/renderCycle.js +10 -0
- package/dist/runtime/helpers/runtimeHelpers/index.js +14 -11
- package/dist/runtime/helpers/selectionProvider.d.ts +16 -0
- package/dist/runtime/helpers/selectionProvider.js +47 -35
- package/dist/runtime/helpers/stateProvider.d.ts +7 -2
- package/dist/runtime/helpers/stateProvider.js +89 -14
- package/dist/runtime/helpers/storageProvider.d.ts +4 -3
- package/dist/runtime/helpers/storageProvider.js +56 -3
- package/dist/runtime/helpers/symbols.d.ts +1 -0
- package/dist/runtime/helpers/symbols.js +1 -0
- package/dist/runtime/helpers/textProvider.js +6 -0
- package/dist/runtime/helpers/themeProvider.d.ts +2 -0
- package/dist/runtime/helpers/themeProvider.js +4 -1
- package/dist/runtime/helpers/transform.js +1 -3
- package/dist/runtime/helpers/uiProvider.d.ts +9 -2
- package/dist/runtime/helpers/uiProvider.js +72 -47
- package/dist/runtime/helpers/useTransitionedValue.d.ts +18 -0
- package/dist/runtime/helpers/useTransitionedValue.js +57 -0
- package/dist/runtime/icons/anchor.svg +1 -0
- package/dist/runtime/icons/arrow-left.svg +1 -1
- package/dist/runtime/icons/arrow-right.svg +1 -1
- package/dist/runtime/icons/arrow-top-right.svg +1 -0
- package/dist/runtime/icons/calendar-clock.svg +1 -0
- package/dist/runtime/icons/chart.svg +1 -0
- package/dist/runtime/icons/copy.svg +1 -0
- package/dist/runtime/icons/cursor-move.svg +1 -1
- package/dist/runtime/icons/diff.svg +1 -1
- package/dist/runtime/icons/eye-off.svg +1 -0
- package/dist/runtime/icons/eye.svg +1 -1
- package/dist/runtime/icons/info.svg +1 -1
- package/dist/runtime/icons/link.svg +1 -0
- package/dist/runtime/icons/speedometer.svg +1 -0
- package/dist/runtime/types/blokkOptions.d.ts +8 -0
- package/dist/runtime/types/index.d.ts +172 -6
- package/dist/runtime/types/theme.d.ts +2 -1
- package/dist/shared/{editor.gz_ac6uT.d.mts → editor.CKsrTpc1.d.mts} +1 -1
- package/package.json +20 -5
- package/dist/runtime/components/Edit/Features/FieldAreas/Overlay/index.vue +0 -22
- package/dist/runtime/components/Edit/Features/FieldAreas/index.vue +0 -41
- /package/dist/runtime/components/Edit/Features/{FieldAreas/Overlay → Analyze}/index.vue.d.ts +0 -0
- /package/dist/runtime/components/Edit/Features/{FieldAreas/index.vue.d.ts → Anchors/Renderer.vue.d.ts} +0 -0
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="#bk-indicators">
|
|
3
|
+
<div
|
|
4
|
+
v-if="shouldRender"
|
|
5
|
+
v-show="showOverlay"
|
|
6
|
+
class="bk-selection-add"
|
|
7
|
+
:class="orientationClass"
|
|
8
|
+
:style="containerStyle"
|
|
9
|
+
>
|
|
10
|
+
<button
|
|
11
|
+
ref="before"
|
|
12
|
+
:key="'before' + orientationClass"
|
|
13
|
+
class="bk-selection-add-button bk-before"
|
|
14
|
+
:style="beforeAfterStyle"
|
|
15
|
+
:data-title="beforeTooltip"
|
|
16
|
+
tabindex="-1"
|
|
17
|
+
@click="onClickBefore"
|
|
18
|
+
>
|
|
19
|
+
<div>
|
|
20
|
+
<Icon name="plus" />
|
|
21
|
+
</div>
|
|
22
|
+
</button>
|
|
23
|
+
|
|
24
|
+
<button
|
|
25
|
+
ref="after"
|
|
26
|
+
:key="'after' + orientationClass"
|
|
27
|
+
class="bk-selection-add-button bk-after"
|
|
28
|
+
:style="beforeAfterStyle"
|
|
29
|
+
:data-title="afterTooltip"
|
|
30
|
+
tabindex="-1"
|
|
31
|
+
@click="onClickAfter"
|
|
32
|
+
>
|
|
33
|
+
<div>
|
|
34
|
+
<Icon name="plus" />
|
|
35
|
+
</div>
|
|
36
|
+
</button>
|
|
37
|
+
</div>
|
|
38
|
+
<AddButtonsField
|
|
39
|
+
v-for="(slot, index) in fieldButtonSlots"
|
|
40
|
+
v-show="showOverlay"
|
|
41
|
+
:key="index"
|
|
42
|
+
:field-key="slot.fieldKey"
|
|
43
|
+
:container-rect="containerRect"
|
|
44
|
+
:title="fieldTooltips[index] || ''"
|
|
45
|
+
@click="(el) => onClickEmptyField(index, el)"
|
|
46
|
+
/>
|
|
47
|
+
</Teleport>
|
|
48
|
+
|
|
49
|
+
<Teleport to="body">
|
|
50
|
+
<BlokkliTransition name="caret-tooltip">
|
|
51
|
+
<Overlay
|
|
52
|
+
v-if="addData"
|
|
53
|
+
:key="addData.key"
|
|
54
|
+
:bundles="addData.allowedBundles"
|
|
55
|
+
:anchor-el="addData.anchorEl"
|
|
56
|
+
:label="addData.label"
|
|
57
|
+
@select="onSelectBundle"
|
|
58
|
+
@close="closeOverlay"
|
|
59
|
+
@action="onSelectAction"
|
|
60
|
+
/>
|
|
61
|
+
</BlokkliTransition>
|
|
62
|
+
</Teleport>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script setup>
|
|
66
|
+
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
67
|
+
import { computed, useBlokkli, ref, watch, useTemplateRef } from "#imports";
|
|
68
|
+
import { Icon, BlokkliTransition } from "#blokkli/components";
|
|
69
|
+
import {
|
|
70
|
+
getChildrenOrientation,
|
|
71
|
+
getGapSize,
|
|
72
|
+
MIN_GAP,
|
|
73
|
+
determineCanAddChildren
|
|
74
|
+
} from "#blokkli/helpers/dropTargets";
|
|
75
|
+
import Overlay from "./Overlay/index.vue";
|
|
76
|
+
import AddButtonsField from "./AddButtonsField.vue";
|
|
77
|
+
import { renderCycle } from "#blokkli/helpers/renderCycle";
|
|
78
|
+
import { getFieldKey } from "#blokkli/helpers";
|
|
79
|
+
import { isInternalBundle } from "#blokkli/helpers/bundles";
|
|
80
|
+
const props = defineProps({
|
|
81
|
+
blocks: { type: Array, required: true }
|
|
82
|
+
});
|
|
83
|
+
const { dom, state, eventBus, types, ui, selection, $t } = useBlokkli();
|
|
84
|
+
const showOverlay = computed(
|
|
85
|
+
() => !ui.isTransforming.value && !ui.isAnalyzing.value && !selection.isMultiSelecting.value && !selection.isDragging.value && !ui.hasTransformOverlayOpen.value && !selection.isChangingOptions.value
|
|
86
|
+
);
|
|
87
|
+
const afterEl = useTemplateRef("after");
|
|
88
|
+
const beforeEL = useTemplateRef("before");
|
|
89
|
+
const shouldRender = computed(() => {
|
|
90
|
+
return props.blocks.length === 1;
|
|
91
|
+
});
|
|
92
|
+
const block = computed(() => {
|
|
93
|
+
if (props.blocks.length === 1) {
|
|
94
|
+
return props.blocks[0] ?? null;
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
});
|
|
98
|
+
const uuid = computed(() => {
|
|
99
|
+
return block.value?.uuid ?? null;
|
|
100
|
+
});
|
|
101
|
+
const emptyBlockFields = computed(() => {
|
|
102
|
+
if (!block.value) {
|
|
103
|
+
return [];
|
|
104
|
+
}
|
|
105
|
+
const uuid2 = block.value.uuid;
|
|
106
|
+
return types.fieldConfig.forEntityTypeAndBundle(block.value.entityType, block.value.itemBundle).map((field) => {
|
|
107
|
+
const key = getFieldKey(uuid2, field.name);
|
|
108
|
+
const count = state.getFieldBlockCount(key);
|
|
109
|
+
return {
|
|
110
|
+
key,
|
|
111
|
+
count,
|
|
112
|
+
name: field.name
|
|
113
|
+
};
|
|
114
|
+
}).filter((v) => {
|
|
115
|
+
return v.count === 0;
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
const containerStyle = ref({ visibility: "hidden" });
|
|
119
|
+
const orientationClass = ref("");
|
|
120
|
+
const containerRect = ref(null);
|
|
121
|
+
const fieldButtonSlots = ref([]);
|
|
122
|
+
const bundleLabel = computed(() => {
|
|
123
|
+
if (!block.value) {
|
|
124
|
+
return "";
|
|
125
|
+
}
|
|
126
|
+
return types.getBlockBundleDefinition(block.value.itemBundle)?.label || block.value.itemBundle;
|
|
127
|
+
});
|
|
128
|
+
const allowedBundlesForField = computed(() => {
|
|
129
|
+
if (!block.value) {
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
const blockData = dom.findBlock(block.value.uuid);
|
|
133
|
+
if (!blockData) {
|
|
134
|
+
return [];
|
|
135
|
+
}
|
|
136
|
+
const field = dom.findField(blockData.hostUuid, blockData.hostFieldName);
|
|
137
|
+
if (!field) {
|
|
138
|
+
return [];
|
|
139
|
+
}
|
|
140
|
+
return field.allowedBundles.filter((bundle) => !isInternalBundle(bundle));
|
|
141
|
+
});
|
|
142
|
+
const singleAllowedBundleLabel = computed(() => {
|
|
143
|
+
if (allowedBundlesForField.value.length === 1) {
|
|
144
|
+
const bundle = allowedBundlesForField.value[0];
|
|
145
|
+
if (bundle) {
|
|
146
|
+
return types.getBlockBundleDefinition(bundle)?.label || bundle;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return null;
|
|
150
|
+
});
|
|
151
|
+
const beforeTooltip = computed(() => {
|
|
152
|
+
if (singleAllowedBundleLabel.value) {
|
|
153
|
+
return $t("addButtonBundleBefore", 'Add "@bundle" before').replace(
|
|
154
|
+
"@bundle",
|
|
155
|
+
singleAllowedBundleLabel.value
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
return $t("addButtonBeforeBundle", "Add before...");
|
|
159
|
+
});
|
|
160
|
+
const afterTooltip = computed(() => {
|
|
161
|
+
if (singleAllowedBundleLabel.value) {
|
|
162
|
+
return $t("addButtonBundleAfter", 'Add "@bundle" after').replace(
|
|
163
|
+
"@bundle",
|
|
164
|
+
singleAllowedBundleLabel.value
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
return $t("addButtonAfterBundle", "Add after...");
|
|
168
|
+
});
|
|
169
|
+
const fieldTooltips = computed(() => {
|
|
170
|
+
if (!block.value || !bundleLabel.value) {
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
return emptyBlockFields.value.map((field) => {
|
|
174
|
+
const fieldConfig = types.fieldConfig.forEntityTypeAndBundle(block.value.entityType, block.value.itemBundle).find((f) => f.name === field.name);
|
|
175
|
+
const fieldLabel = fieldConfig?.label || field.name;
|
|
176
|
+
const fieldElement = dom.findField(block.value.uuid, field.name);
|
|
177
|
+
if (fieldElement) {
|
|
178
|
+
const allowedBundles = fieldElement.allowedBundles.filter(
|
|
179
|
+
(bundle) => !isInternalBundle(bundle)
|
|
180
|
+
);
|
|
181
|
+
if (allowedBundles.length === 1) {
|
|
182
|
+
const bundle = allowedBundles[0];
|
|
183
|
+
if (bundle) {
|
|
184
|
+
const singleBundleLabel = types.getBlockBundleDefinition(bundle)?.label || bundle;
|
|
185
|
+
return $t(
|
|
186
|
+
"addButtonBundleInsideField",
|
|
187
|
+
'Add "@bundle" inside @parentBundle \xBB @fieldLabel'
|
|
188
|
+
).replace("@bundle", singleBundleLabel).replace("@parentBundle", bundleLabel.value).replace("@fieldLabel", fieldLabel);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return $t(
|
|
193
|
+
"addButtonInsideField",
|
|
194
|
+
"Add inside @parentBundle \xBB @fieldLabel..."
|
|
195
|
+
).replace("@parentBundle", bundleLabel.value).replace("@fieldLabel", fieldLabel);
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
watch(emptyBlockFields, (fields) => {
|
|
199
|
+
const neededCount = fields.length;
|
|
200
|
+
while (fieldButtonSlots.value.length < neededCount) {
|
|
201
|
+
fieldButtonSlots.value.push({ fieldKey: void 0 });
|
|
202
|
+
}
|
|
203
|
+
for (let i = 0; i < fieldButtonSlots.value.length; i++) {
|
|
204
|
+
const slot = fieldButtonSlots.value[i];
|
|
205
|
+
if (!slot) {
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
if (i < fields.length) {
|
|
209
|
+
const field = fields[i];
|
|
210
|
+
slot.fieldKey = field?.key;
|
|
211
|
+
} else {
|
|
212
|
+
slot.fieldKey = void 0;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
const addData = ref(null);
|
|
217
|
+
function closeOverlay() {
|
|
218
|
+
addData.value = null;
|
|
219
|
+
}
|
|
220
|
+
function onSelectBundle(bundle) {
|
|
221
|
+
if (!addData.value) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
eventBus.emit("block:append", {
|
|
225
|
+
bundle,
|
|
226
|
+
host: { ...addData.value.host },
|
|
227
|
+
afterUuid: addData.value.preceedingUuid
|
|
228
|
+
});
|
|
229
|
+
closeOverlay();
|
|
230
|
+
}
|
|
231
|
+
function onSelectAction(id) {
|
|
232
|
+
if (!addData.value) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
eventBus.emit("action:placed", {
|
|
236
|
+
id,
|
|
237
|
+
field: addData.value.field,
|
|
238
|
+
preceedingUuid: addData.value.preceedingUuid,
|
|
239
|
+
host: { ...addData.value.host }
|
|
240
|
+
});
|
|
241
|
+
closeOverlay();
|
|
242
|
+
}
|
|
243
|
+
const cache = /* @__PURE__ */ new Map();
|
|
244
|
+
const canShowBeforeAfter = ref(false);
|
|
245
|
+
const beforeAfterStyle = computed(() => ({
|
|
246
|
+
visibility: canShowBeforeAfter.value ? "visible" : "hidden"
|
|
247
|
+
}));
|
|
248
|
+
function clearAllCache() {
|
|
249
|
+
cache.clear();
|
|
250
|
+
canShowBeforeAfter.value = false;
|
|
251
|
+
containerStyle.value = { visibility: "hidden" };
|
|
252
|
+
orientationClass.value = "";
|
|
253
|
+
}
|
|
254
|
+
function updateCache(uuid2) {
|
|
255
|
+
let cachedState = cache.get(uuid2);
|
|
256
|
+
if (!cachedState) {
|
|
257
|
+
const block2 = dom.findBlock(uuid2);
|
|
258
|
+
if (!block2) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
const field = dom.findField(block2.hostUuid, block2.hostFieldName);
|
|
262
|
+
if (!field) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const orientation = getChildrenOrientation(field.element);
|
|
266
|
+
const gap = Math.max(getGapSize(orientation, field.element), MIN_GAP);
|
|
267
|
+
const fieldChildren = [...field.element.children];
|
|
268
|
+
const currentCount = state.getFieldBlockCount(field.key);
|
|
269
|
+
const canShow = determineCanAddChildren(
|
|
270
|
+
field,
|
|
271
|
+
fieldChildren,
|
|
272
|
+
[],
|
|
273
|
+
// Not moving any blocks, adding a new one
|
|
274
|
+
currentCount,
|
|
275
|
+
1,
|
|
276
|
+
// Adding 1 new block
|
|
277
|
+
[]
|
|
278
|
+
// Don't know which bundle will be added
|
|
279
|
+
);
|
|
280
|
+
cachedState = {
|
|
281
|
+
orientation,
|
|
282
|
+
gap,
|
|
283
|
+
canShowBeforeAfter: canShow
|
|
284
|
+
};
|
|
285
|
+
cache.set(uuid2, cachedState);
|
|
286
|
+
}
|
|
287
|
+
canShowBeforeAfter.value = cachedState.canShowBeforeAfter;
|
|
288
|
+
orientationClass.value = cachedState.orientation === "vertical" ? "bk-is-vertical" : "bk-is-horizontal";
|
|
289
|
+
}
|
|
290
|
+
watch(
|
|
291
|
+
uuid,
|
|
292
|
+
async (newUuid) => {
|
|
293
|
+
closeOverlay();
|
|
294
|
+
if (!shouldRender.value) {
|
|
295
|
+
canShowBeforeAfter.value = false;
|
|
296
|
+
containerStyle.value = { visibility: "hidden" };
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (newUuid) {
|
|
300
|
+
await renderCycle();
|
|
301
|
+
updateCache(newUuid);
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
{ immediate: true }
|
|
305
|
+
);
|
|
306
|
+
onBlokkliEvent("canvas:draw", () => {
|
|
307
|
+
if (!shouldRender.value || !uuid.value) {
|
|
308
|
+
containerStyle.value = { visibility: "hidden" };
|
|
309
|
+
containerRect.value = null;
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
const cachedState = cache.get(uuid.value);
|
|
313
|
+
if (!cachedState) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
const blockRect = dom.getBlockRect(uuid.value);
|
|
317
|
+
if (!blockRect) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
if (blockRect.width === 0) {
|
|
321
|
+
containerStyle.value = { visibility: "hidden" };
|
|
322
|
+
containerRect.value = null;
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
containerStyle.value = {
|
|
326
|
+
transform: `translate(${blockRect.x}px, ${blockRect.y}px)`,
|
|
327
|
+
width: `${blockRect.width}px`,
|
|
328
|
+
height: `${blockRect.height}px`,
|
|
329
|
+
"--gap": `${cachedState.gap}px`,
|
|
330
|
+
visibility: "visible"
|
|
331
|
+
};
|
|
332
|
+
containerRect.value = { x: blockRect.x, y: blockRect.y };
|
|
333
|
+
});
|
|
334
|
+
onBlokkliEvent("state:reloaded", () => {
|
|
335
|
+
clearAllCache();
|
|
336
|
+
if (shouldRender.value && uuid.value) {
|
|
337
|
+
updateCache(uuid.value);
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
function setAddData(key, field, anchorEl, label, preceedingUuid) {
|
|
341
|
+
const allowedBundles = field.allowedBundles;
|
|
342
|
+
if (allowedBundles.length === 0) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
const host = {
|
|
346
|
+
type: field.hostEntityType,
|
|
347
|
+
uuid: field.hostEntityUuid,
|
|
348
|
+
fieldName: field.name
|
|
349
|
+
};
|
|
350
|
+
if (allowedBundles.length === 1) {
|
|
351
|
+
const bundle = allowedBundles[0];
|
|
352
|
+
eventBus.emit("block:append", {
|
|
353
|
+
bundle,
|
|
354
|
+
host,
|
|
355
|
+
afterUuid: preceedingUuid
|
|
356
|
+
});
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
addData.value = {
|
|
360
|
+
key,
|
|
361
|
+
allowedBundles,
|
|
362
|
+
preceedingUuid,
|
|
363
|
+
host,
|
|
364
|
+
anchorEl,
|
|
365
|
+
label,
|
|
366
|
+
field
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
function getPreceedingUuidBefore(uuid2, field) {
|
|
370
|
+
const children = [...field.element.children];
|
|
371
|
+
let prevUuid = void 0;
|
|
372
|
+
for (let i = 0; i < children.length; i++) {
|
|
373
|
+
const child = children[i];
|
|
374
|
+
if (!child) {
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
const childUuid = child.dataset.uuid;
|
|
378
|
+
if (childUuid === uuid2) {
|
|
379
|
+
return prevUuid;
|
|
380
|
+
}
|
|
381
|
+
prevUuid = childUuid;
|
|
382
|
+
}
|
|
383
|
+
return void 0;
|
|
384
|
+
}
|
|
385
|
+
function onClickBefore() {
|
|
386
|
+
if (addData.value?.key === "before") {
|
|
387
|
+
return closeOverlay();
|
|
388
|
+
}
|
|
389
|
+
if (!uuid.value) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
const cachedState = cache.get(uuid.value);
|
|
393
|
+
if (!cachedState) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
const block2 = dom.findBlock(uuid.value);
|
|
397
|
+
if (!block2) {
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
const field = dom.findField(block2.hostUuid, block2.hostFieldName);
|
|
401
|
+
if (!field) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
const preceedingUuid = getPreceedingUuidBefore(uuid.value, field);
|
|
405
|
+
if (!beforeEL.value) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
const label = beforeTooltip.value.replace("...", "");
|
|
409
|
+
setAddData("before", field, beforeEL.value, label, preceedingUuid);
|
|
410
|
+
}
|
|
411
|
+
function onClickAfter() {
|
|
412
|
+
if (addData.value?.key === "after") {
|
|
413
|
+
return closeOverlay();
|
|
414
|
+
}
|
|
415
|
+
if (!uuid.value) {
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
const cachedState = cache.get(uuid.value);
|
|
419
|
+
if (!cachedState) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
const block2 = dom.findBlock(uuid.value);
|
|
423
|
+
if (!block2) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
const field = dom.findField(block2.hostUuid, block2.hostFieldName);
|
|
427
|
+
if (!field) {
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
if (!afterEl.value) {
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
if (!field.allowedBundles.length) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
const label = afterTooltip.value.replace("...", "");
|
|
437
|
+
setAddData("after", field, afterEl.value, label, uuid.value);
|
|
438
|
+
}
|
|
439
|
+
function onClickEmptyField(index, element) {
|
|
440
|
+
const key = "field:" + index;
|
|
441
|
+
if (addData.value?.key === key) {
|
|
442
|
+
return closeOverlay();
|
|
443
|
+
}
|
|
444
|
+
if (!uuid.value) {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
const emptyField = emptyBlockFields.value[index];
|
|
448
|
+
if (!emptyField) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
const field = dom.findField(uuid.value, emptyField.name);
|
|
452
|
+
if (!field) {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
const label = (fieldTooltips.value[index] || "").replace("...", "");
|
|
456
|
+
setAddData(key, field, element, label);
|
|
457
|
+
}
|
|
458
|
+
onBlokkliEvent("mouse:up", closeOverlay);
|
|
459
|
+
</script>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DraggableExistingBlock } from '#blokkli/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
blocks: DraggableExistingBlock[];
|
|
4
|
+
};
|
|
5
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
export default _default;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
precision
|
|
1
|
+
precision highp float;
|
|
2
|
+
|
|
2
3
|
varying vec4 v_quad;
|
|
3
4
|
varying vec3 v_color;
|
|
4
5
|
varying vec4 v_rect_radius;
|
|
@@ -80,9 +81,10 @@ vec4 drawBox(float thickness, vec4 bg, vec4 fill, vec4 border, float offset) {
|
|
|
80
81
|
(sin(u_time / 270.0 - v_rect_id + offset) + 1.0) / 2.0
|
|
81
82
|
);
|
|
82
83
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
// Smoothly transition borderThickness animation
|
|
85
|
+
float animatedThickness = (t * 0.7 + 0.5) * borderThickness;
|
|
86
|
+
borderThickness = mix(borderThickness, animatedThickness, u_is_transforming);
|
|
87
|
+
|
|
86
88
|
vec2 size = v_rect_size + borderThickness * 2.0 * v_transition;
|
|
87
89
|
float u_edgeSoftness = 1.0 + v_transition;
|
|
88
90
|
vec4 radius = v_rect_radius * u_scale + vec4(borderThickness);
|
|
@@ -100,12 +102,15 @@ vec4 drawBox(float thickness, vec4 bg, vec4 fill, vec4 border, float offset) {
|
|
|
100
102
|
float borderAlpha =
|
|
101
103
|
1.0 - smoothstep(-u_borderSoftness, 0.0, abs(mainDist) - borderThickness);
|
|
102
104
|
|
|
105
|
+
// Smoothly transition stripe pattern
|
|
103
106
|
vec4 stripedFill = vec4(1.0, 1.0, 1.0, 0.0);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
vec4 animatedStripedFill = fill;
|
|
108
|
+
animatedStripedFill.a = getStripePattern(posRelativeToQuad, u_time);
|
|
109
|
+
stripedFill = mix(stripedFill, animatedStripedFill, u_is_transforming);
|
|
110
|
+
|
|
111
|
+
// Smoothly transition borderAlpha modification
|
|
112
|
+
float animatedBorderAlpha = borderAlpha * (t + 0.6);
|
|
113
|
+
borderAlpha = mix(borderAlpha, animatedBorderAlpha, u_is_transforming);
|
|
109
114
|
|
|
110
115
|
vec4 res_with_fill = mix(bg, stripedFill, fillAlpha * stripedFill.a);
|
|
111
116
|
return mix(res_with_fill, border, borderAlpha * border.a);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
7
|
-
import { useBlokkli, onBeforeUnmount } from "#imports";
|
|
7
|
+
import { useBlokkli, onBeforeUnmount, computed } from "#imports";
|
|
8
8
|
import {
|
|
9
9
|
setBuffersAndAttributes,
|
|
10
10
|
drawBufferInfo,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import vs from "./vertex.glsl?raw";
|
|
14
14
|
import fs from "./fragment.glsl?raw";
|
|
15
15
|
import { RectangleBufferCollector } from "#blokkli/helpers/webgl";
|
|
16
|
+
import { useTransitionedValue } from "#blokkli/helpers/useTransitionedValue";
|
|
16
17
|
import { toShaderColor } from "#blokkli/helpers";
|
|
17
18
|
const props = defineProps({
|
|
18
19
|
blocks: { type: Array, required: true },
|
|
@@ -72,22 +73,42 @@ class SelectionRectangleBufferCollector extends RectangleBufferCollector {
|
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
const collector = new SelectionRectangleBufferCollector(props.gl);
|
|
76
|
+
const hasTransformingStyle = computed(
|
|
77
|
+
() => ui.hasTransformOverlayOpen.value || ui.isTransforming.value
|
|
78
|
+
);
|
|
79
|
+
const getColorDefault = useTransitionedValue(() => {
|
|
80
|
+
if (hasTransformingStyle.value) {
|
|
81
|
+
return toShaderColor(theme.orange.value.normal);
|
|
82
|
+
}
|
|
83
|
+
return toShaderColor(theme.accent.value[600]);
|
|
84
|
+
});
|
|
85
|
+
const getColorInverted = useTransitionedValue(() => {
|
|
86
|
+
if (hasTransformingStyle.value) {
|
|
87
|
+
return toShaderColor(theme.orange.value.normal);
|
|
88
|
+
}
|
|
89
|
+
return toShaderColor([255, 255, 255]);
|
|
90
|
+
});
|
|
91
|
+
const getTransforming = useTransitionedValue(() => {
|
|
92
|
+
return ui.isTransforming.value ? 1 : 0;
|
|
93
|
+
});
|
|
75
94
|
onBlokkliEvent("canvas:draw", (e) => {
|
|
76
95
|
props.gl.useProgram(programInfo.program);
|
|
77
|
-
setUniforms(programInfo, {
|
|
78
|
-
u_color_default: toShaderColor(theme.accent.value[600]),
|
|
79
|
-
u_color_inverted: [255, 255, 255],
|
|
80
|
-
u_is_transforming: ui.isTransforming.value ? 1 : 0,
|
|
81
|
-
u_time: e.time
|
|
82
|
-
});
|
|
83
|
-
animation.setSharedUniforms(props.gl, programInfo);
|
|
84
96
|
const { info, hasChanged } = collector.getBufferInfo();
|
|
85
97
|
if (!info) {
|
|
86
98
|
return;
|
|
87
99
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
100
|
+
setUniforms(programInfo, {
|
|
101
|
+
u_color_default: getColorDefault(),
|
|
102
|
+
u_color_inverted: getColorInverted(),
|
|
103
|
+
u_artboard_size: [
|
|
104
|
+
ui.artboardSize.value.width,
|
|
105
|
+
ui.artboardSize.value.height
|
|
106
|
+
],
|
|
107
|
+
u_is_transforming: getTransforming(),
|
|
108
|
+
u_time: e.time
|
|
109
|
+
});
|
|
110
|
+
animation.setSharedUniforms(props.gl, programInfo);
|
|
111
|
+
setBuffersAndAttributes(props.gl, programInfo, info);
|
|
91
112
|
drawBufferInfo(props.gl, info, props.gl.TRIANGLES);
|
|
92
113
|
});
|
|
93
114
|
onBlokkliEvent("ui:resized", function() {
|
|
@@ -1,16 +1,41 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Overlay
|
|
3
|
-
v-if="isVisible && gl"
|
|
3
|
+
v-if="isVisible && gl && animation.webglEnabled.value"
|
|
4
4
|
:blocks="selection.blocks.value"
|
|
5
5
|
:uuids="selection.uuids.value"
|
|
6
6
|
:gl="gl"
|
|
7
7
|
/>
|
|
8
8
|
<OverlayFallback v-if="isVisible && !gl" :uuids="selection.uuids.value" />
|
|
9
|
+
<Teleport :to="artboardElement">
|
|
10
|
+
<div
|
|
11
|
+
class="bk bk-host-selection-overlay"
|
|
12
|
+
:style="{
|
|
13
|
+
visibility: selection.hasHostSelected.value ? 'visible' : 'hidden'
|
|
14
|
+
}"
|
|
15
|
+
/>
|
|
16
|
+
</Teleport>
|
|
17
|
+
|
|
18
|
+
<PluginItemDropdown
|
|
19
|
+
v-if="itemDropdownItems.length"
|
|
20
|
+
id="selection"
|
|
21
|
+
:title="$t('selectionActionGroupTitle', 'Selection')"
|
|
22
|
+
:enabled="itemDropdownEnabled"
|
|
23
|
+
:items="itemDropdownItems"
|
|
24
|
+
icon="selection"
|
|
25
|
+
weight="200"
|
|
26
|
+
@select="onSelectDropdownItem"
|
|
27
|
+
/>
|
|
28
|
+
|
|
29
|
+
<SelectionAddButtons
|
|
30
|
+
v-if="state.editMode.value === 'editing'"
|
|
31
|
+
:blocks="selection.blocks.value"
|
|
32
|
+
/>
|
|
9
33
|
</template>
|
|
10
34
|
|
|
11
35
|
<script setup>
|
|
12
36
|
import Overlay from "./Overlay/index.vue";
|
|
13
37
|
import OverlayFallback from "./OverlayFallback/index.vue";
|
|
38
|
+
import SelectionAddButtons from "./AddButtons/index.vue";
|
|
14
39
|
import {
|
|
15
40
|
calculateIntersection,
|
|
16
41
|
getBounds,
|
|
@@ -18,6 +43,7 @@ import {
|
|
|
18
43
|
originatesFromTextInput
|
|
19
44
|
} from "#blokkli/helpers";
|
|
20
45
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
46
|
+
import { PluginItemDropdown } from "#blokkli/plugins";
|
|
21
47
|
import {
|
|
22
48
|
computed,
|
|
23
49
|
useBlokkli,
|
|
@@ -31,13 +57,55 @@ defineBlokkliFeature({
|
|
|
31
57
|
label: "Selection",
|
|
32
58
|
description: "Renders an overlay that highlights the selected blocks."
|
|
33
59
|
});
|
|
34
|
-
const { selection, ui, eventBus, animation, dom, tour } = useBlokkli();
|
|
60
|
+
const { selection, ui, eventBus, animation, dom, tour, $t, types, state } = useBlokkli();
|
|
61
|
+
const selectedBundle = computed(() => {
|
|
62
|
+
let bundle = "";
|
|
63
|
+
for (let i = 0; i < selection.blocks.value.length; i++) {
|
|
64
|
+
const block = selection.blocks.value[i];
|
|
65
|
+
if (!block) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
if (bundle && bundle !== block.itemBundle) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
bundle = block.itemBundle;
|
|
72
|
+
}
|
|
73
|
+
return bundle || null;
|
|
74
|
+
});
|
|
75
|
+
const itemDropdownEnabled = computed(() => true);
|
|
76
|
+
const itemDropdownItems = computed(() => {
|
|
77
|
+
if (selectedBundle.value) {
|
|
78
|
+
const label = types.getBlockBundleDefinition(selectedBundle.value)?.label ?? selectedBundle.value;
|
|
79
|
+
return [
|
|
80
|
+
{
|
|
81
|
+
id: "select-all-of-bundle",
|
|
82
|
+
label: $t("selectAllOfBundle", 'Select all "@bundle" blocks').replace(
|
|
83
|
+
"@bundle",
|
|
84
|
+
label
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
return [];
|
|
90
|
+
});
|
|
91
|
+
function onSelectDropdownItem(item) {
|
|
92
|
+
if (item.id === "select-all-of-bundle" && selectedBundle.value) {
|
|
93
|
+
const uuids = state.getAllUuids(selectedBundle.value);
|
|
94
|
+
eventBus.emit("select", uuids);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const artboardElement = ui.artboardElement();
|
|
35
98
|
const gl = animation.gl();
|
|
36
99
|
const hasSelectedOnce = ref(false);
|
|
37
|
-
const stop = watch(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
100
|
+
const stop = watch(
|
|
101
|
+
selection.hasAnythingSelected,
|
|
102
|
+
function(hasAnythingSelected) {
|
|
103
|
+
if (hasAnythingSelected) {
|
|
104
|
+
hasSelectedOnce.value = true;
|
|
105
|
+
}
|
|
106
|
+
stop();
|
|
107
|
+
}
|
|
108
|
+
);
|
|
41
109
|
const isVisible = computed(
|
|
42
110
|
() => dom.isReady.value && !selection.isMultiSelecting.value && !selection.editableActive.value && !selection.isChangingOptions.value && !selection.isDragging.value && !ui.isAnimating.value && hasSelectedOnce.value
|
|
43
111
|
);
|
|
@@ -170,8 +238,9 @@ onBlokkliEvent("keyPressed", (e) => {
|
|
|
170
238
|
}
|
|
171
239
|
if (e.code === "Escape") {
|
|
172
240
|
eventBus.emit("select:end", []);
|
|
241
|
+
eventBus.emit("select:host:unselect");
|
|
173
242
|
} else if (e.code === "Tab") {
|
|
174
|
-
if (tour.isTouring.value) {
|
|
243
|
+
if (tour.isTouring.value || ui.hasDialogOpen.value) {
|
|
175
244
|
return;
|
|
176
245
|
}
|
|
177
246
|
e.originalEvent.preventDefault();
|