@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
|
@@ -29,6 +29,8 @@ watch(dom.isReady, buildRects);
|
|
|
29
29
|
let lastInteractedElement = null;
|
|
30
30
|
let pointerDownElement = null;
|
|
31
31
|
let mouseStartCoordinates = null;
|
|
32
|
+
let pointerDownTimestamp = 0;
|
|
33
|
+
let pointerUpTimestamp = 0;
|
|
32
34
|
function getInteractedElement(e) {
|
|
33
35
|
const { x, y } = getInteractionCoordinates(e);
|
|
34
36
|
const elements = document.elementsFromPoint(x, y);
|
|
@@ -95,14 +97,26 @@ function onPointerMove(e) {
|
|
|
95
97
|
if (e.pointerType === "touch") {
|
|
96
98
|
return onTouchMove(e);
|
|
97
99
|
}
|
|
98
|
-
if (e.buttons !==
|
|
100
|
+
if (e.buttons !== MOUSE_BUTTONS.PRIMARY) {
|
|
99
101
|
return;
|
|
100
102
|
}
|
|
101
|
-
if (!
|
|
103
|
+
if (!mouseStartCoordinates || selection.isMultiSelecting.value || selection.isDragging.value || keyboard.isPressingSpace.value) {
|
|
102
104
|
return;
|
|
103
105
|
}
|
|
104
106
|
const diffX = Math.abs(mouseStartCoordinates.x - e.clientX);
|
|
105
107
|
const diffY = Math.abs(mouseStartCoordinates.y - e.clientY);
|
|
108
|
+
if (!pointerDownElement) {
|
|
109
|
+
const timeDelta = Date.now() - pointerDownTimestamp;
|
|
110
|
+
const maxMovement = Math.max(diffX, diffY);
|
|
111
|
+
if (maxMovement > 6 && timeDelta > 150 || maxMovement > 20) {
|
|
112
|
+
rootEl.removeEventListener("pointermove", onPointerMove);
|
|
113
|
+
eventBus.emit("multi-select:start", {
|
|
114
|
+
x: e.clientX,
|
|
115
|
+
y: e.clientY
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
106
120
|
if (diffX < 6 && diffY < 6) {
|
|
107
121
|
return;
|
|
108
122
|
}
|
|
@@ -124,10 +138,9 @@ function onPointerMove(e) {
|
|
|
124
138
|
});
|
|
125
139
|
}
|
|
126
140
|
}
|
|
141
|
+
rootEl.removeEventListener("pointermove", onPointerMove);
|
|
127
142
|
}
|
|
128
143
|
}
|
|
129
|
-
let pointerDownTimestamp = 0;
|
|
130
|
-
let pointerUpTimestamp = 0;
|
|
131
144
|
function onPointerDown(e) {
|
|
132
145
|
if (e.buttons === MOUSE_BUTTONS.AUXILIARY) {
|
|
133
146
|
return;
|
|
@@ -149,10 +162,10 @@ function onPointerDown(e) {
|
|
|
149
162
|
if (selection.isDragging.value) {
|
|
150
163
|
return;
|
|
151
164
|
}
|
|
165
|
+
pointerDownTimestamp = Date.now();
|
|
152
166
|
const coords = { x: e.clientX, y: e.clientY };
|
|
167
|
+
mouseStartCoordinates = coords;
|
|
153
168
|
if (!e.shiftKey && e.buttons === MOUSE_BUTTONS.PRIMARY) {
|
|
154
|
-
pointerDownTimestamp = Date.now();
|
|
155
|
-
mouseStartCoordinates = coords;
|
|
156
169
|
const interacted = getInteractedElement(e);
|
|
157
170
|
pointerDownElement = interacted;
|
|
158
171
|
if (interacted) {
|
|
@@ -161,6 +174,17 @@ function onPointerDown(e) {
|
|
|
161
174
|
}
|
|
162
175
|
eventBus.emit("mouse:down", { ...coords, type: "mouse", distance: 0 });
|
|
163
176
|
}
|
|
177
|
+
function isClickInArtboard(coords) {
|
|
178
|
+
const size = ui.artboardSize.value;
|
|
179
|
+
const scale = ui.artboardScale.value;
|
|
180
|
+
const rect = {
|
|
181
|
+
x: ui.artboardOffset.value.x,
|
|
182
|
+
y: ui.artboardOffset.value.y,
|
|
183
|
+
width: size.width * scale,
|
|
184
|
+
height: size.height * scale
|
|
185
|
+
};
|
|
186
|
+
return isInsideRect(coords.x, coords.y, rect);
|
|
187
|
+
}
|
|
164
188
|
function onPointerUp(e) {
|
|
165
189
|
rootEl.removeEventListener("pointermove", onPointerMove);
|
|
166
190
|
if (e.button === MOUSE_BUTTON.AUXILIARY) {
|
|
@@ -236,6 +260,11 @@ function onPointerUp(e) {
|
|
|
236
260
|
return;
|
|
237
261
|
}
|
|
238
262
|
eventBus.emit("window:clickAway");
|
|
263
|
+
if (isClickInArtboard(coords)) {
|
|
264
|
+
eventBus.emit("select:host");
|
|
265
|
+
} else {
|
|
266
|
+
eventBus.emit("select:host:unselect");
|
|
267
|
+
}
|
|
239
268
|
}
|
|
240
269
|
let longPressTimeout = null;
|
|
241
270
|
let touchStartInteraction = null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Teleport to="body">
|
|
3
|
-
<Transition name="bk-loading">
|
|
3
|
+
<Transition :name="ui.useAnimations.value ? 'bk-loading' : void 0">
|
|
4
4
|
<Loading
|
|
5
5
|
v-if="isInitializing || !toolbarLoaded || !featuresLoaded"
|
|
6
6
|
screen
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
<Actions v-if="!isInitializing" />
|
|
30
30
|
<Toolbar @loaded="toolbarLoaded = true" />
|
|
31
31
|
<AppMenu v-if="toolbarLoaded" />
|
|
32
|
+
<Indicators />
|
|
32
33
|
<Features
|
|
33
34
|
v-if="!isInitializing && toolbarLoaded"
|
|
34
35
|
:key="route.fullPath"
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
/>
|
|
37
38
|
<DragInteractions v-if="!isInitializing" />
|
|
38
39
|
<AnimationCanvas v-if="!isInitializing" />
|
|
40
|
+
<Konami />
|
|
39
41
|
<SystemRequirements />
|
|
40
42
|
<slot
|
|
41
43
|
v-if="!isInitializing"
|
|
@@ -46,7 +48,6 @@
|
|
|
46
48
|
|
|
47
49
|
<script setup>
|
|
48
50
|
import {
|
|
49
|
-
watch,
|
|
50
51
|
ref,
|
|
51
52
|
computed,
|
|
52
53
|
provide,
|
|
@@ -54,18 +55,21 @@ import {
|
|
|
54
55
|
onBeforeUnmount,
|
|
55
56
|
useRoute,
|
|
56
57
|
useRuntimeConfig,
|
|
57
|
-
nextTick
|
|
58
|
+
nextTick,
|
|
59
|
+
inject
|
|
58
60
|
} from "#imports";
|
|
59
61
|
import Toolbar from "./Toolbar/index.vue";
|
|
60
62
|
import Actions from "./Actions/index.vue";
|
|
61
63
|
import Loading from "./Loading/index.vue";
|
|
62
64
|
import Messages from "./Messages/index.vue";
|
|
63
65
|
import Features from "./Features/index.vue";
|
|
66
|
+
import Indicators from "./Indicators/index.vue";
|
|
64
67
|
import AppMenu from "./AppMenu/index.vue";
|
|
65
68
|
import DraggableList from "./DraggableList.vue";
|
|
66
69
|
import DragInteractions from "./DragInteractions/index.vue";
|
|
67
70
|
import AnimationCanvas from "./AnimationCanvas/index.vue";
|
|
68
71
|
import SystemRequirements from "./SystemRequirements/index.vue";
|
|
72
|
+
import Konami from "./Konami/index.vue";
|
|
69
73
|
import animationProvider from "./../../helpers/animationProvider";
|
|
70
74
|
import keyboardProvider from "./../../helpers/keyboardProvider";
|
|
71
75
|
import selectionProvider from "./../../helpers/selectionProvider";
|
|
@@ -83,6 +87,8 @@ import tourProvider from "./../../helpers/tourProvider";
|
|
|
83
87
|
import debugProvider from "./../../helpers/debugProvider";
|
|
84
88
|
import definitionProvider from "./../../helpers/definitionProvider";
|
|
85
89
|
import dropAreasProvider from "./../../helpers/dropAreaProvider";
|
|
90
|
+
import indicatorsProvider from "./../../helpers/indicatorsProvider";
|
|
91
|
+
import pluginProvider from "./../../helpers/pluginProvider";
|
|
86
92
|
import { eventBus } from "#blokkli/helpers/eventBus";
|
|
87
93
|
import "#blokkli-build/styles.css";
|
|
88
94
|
import getAdapter from "#blokkli-build/edit-adapter";
|
|
@@ -92,9 +98,11 @@ import {
|
|
|
92
98
|
INJECT_EDIT_FIELD_LIST_COMPONENT,
|
|
93
99
|
INJECT_EDIT_LOGGER,
|
|
94
100
|
INJECT_GLOBAL_PROXY_MODE,
|
|
95
|
-
INJECT_IS_EDITING
|
|
101
|
+
INJECT_IS_EDITING,
|
|
102
|
+
INJECT_PROVIDER_KEY
|
|
96
103
|
} from "#blokkli/helpers/symbols";
|
|
97
104
|
import { useBlockRegistration } from "#blokkli/helpers/composables/useBlockRegistration";
|
|
105
|
+
import { addElementClasses } from "#blokkli/helpers/addElementClasses";
|
|
98
106
|
const props = defineProps({
|
|
99
107
|
entity: { type: null, required: false, default: void 0 },
|
|
100
108
|
entityType: { type: String, required: true },
|
|
@@ -113,6 +121,7 @@ const context = computed(() => {
|
|
|
113
121
|
};
|
|
114
122
|
});
|
|
115
123
|
const adapter = await getAdapter(context);
|
|
124
|
+
const providerKey = inject(INJECT_PROVIDER_KEY, "");
|
|
116
125
|
const route = useRoute();
|
|
117
126
|
const runtimeConfig = useRuntimeConfig().public.blokkli;
|
|
118
127
|
const toolbarLoaded = ref(false);
|
|
@@ -120,8 +129,8 @@ const featuresLoaded = ref(false);
|
|
|
120
129
|
const isInitializing = ref(true);
|
|
121
130
|
const definitions = definitionProvider();
|
|
122
131
|
const $t = textProvider(context);
|
|
123
|
-
const state = await editStateProvider(adapter, context, $t);
|
|
124
|
-
const storage = storageProvider();
|
|
132
|
+
const state = await editStateProvider(adapter, context, $t, providerKey);
|
|
133
|
+
const storage = await storageProvider(adapter);
|
|
125
134
|
const debug = debugProvider(storage);
|
|
126
135
|
const features = featuresProvider(storage);
|
|
127
136
|
const theme = themeProvider();
|
|
@@ -129,12 +138,14 @@ const commands = commandsProvider();
|
|
|
129
138
|
const tour = tourProvider();
|
|
130
139
|
const dropAreas = dropAreasProvider();
|
|
131
140
|
const broadcast = broadcastProvider();
|
|
132
|
-
const ui = uiProvider(storage, state);
|
|
141
|
+
const ui = uiProvider(storage, state, context);
|
|
133
142
|
const dom = domProvider(ui, debug, definitions);
|
|
134
|
-
const animation = animationProvider(ui);
|
|
143
|
+
const animation = animationProvider(ui, storage);
|
|
135
144
|
const keyboard = keyboardProvider(animation);
|
|
136
145
|
const selection = selectionProvider(dom);
|
|
137
146
|
const types = await typesProvider(adapter, selection, context);
|
|
147
|
+
const indicators = indicatorsProvider();
|
|
148
|
+
const plugins = pluginProvider();
|
|
138
149
|
const mutatedEntity = computed(() => state.mutatedEntity.value || props.entity);
|
|
139
150
|
const onContextMenu = (e) => {
|
|
140
151
|
e.preventDefault();
|
|
@@ -148,22 +159,22 @@ function onTouchStart(e) {
|
|
|
148
159
|
e.preventDefault();
|
|
149
160
|
}
|
|
150
161
|
}
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
162
|
+
const shouldIsolate = computed(() => props.isolate);
|
|
163
|
+
addElementClasses(
|
|
164
|
+
document.documentElement,
|
|
165
|
+
"bk-use-animations",
|
|
166
|
+
ui.useAnimations
|
|
167
|
+
);
|
|
168
|
+
addElementClasses(
|
|
169
|
+
document.documentElement,
|
|
170
|
+
"bk-isolate-provider",
|
|
171
|
+
shouldIsolate
|
|
172
|
+
);
|
|
158
173
|
const baseLogger = debug.createLogger("EditProvider");
|
|
159
174
|
onMounted(() => {
|
|
160
175
|
window.addEventListener("contextmenu", onContextMenu);
|
|
161
|
-
if (props.isolate) {
|
|
162
|
-
document.documentElement.classList.add("bk-isolate-provider");
|
|
163
|
-
}
|
|
164
176
|
document.documentElement.addEventListener("touchmove", onTouchMove);
|
|
165
177
|
document.documentElement.addEventListener("touchstart", onTouchStart);
|
|
166
|
-
setRootClasses();
|
|
167
178
|
baseLogger.log("EditProvider mounted");
|
|
168
179
|
dom.init();
|
|
169
180
|
isInitializing.value = false;
|
|
@@ -173,10 +184,8 @@ onBeforeUnmount(() => {
|
|
|
173
184
|
window.removeEventListener("contextmenu", onContextMenu);
|
|
174
185
|
isInitializing.value = true;
|
|
175
186
|
toolbarLoaded.value = false;
|
|
176
|
-
document.documentElement.classList.remove("bk-isolate-provider");
|
|
177
187
|
document.documentElement.removeEventListener("touchmove", onTouchMove);
|
|
178
188
|
document.documentElement.removeEventListener("touchstart", onTouchStart);
|
|
179
|
-
setRootClasses(true);
|
|
180
189
|
});
|
|
181
190
|
provide(INJECT_EDIT_LOGGER, baseLogger);
|
|
182
191
|
provide(INJECT_EDIT_FIELD_LIST_COMPONENT, DraggableList);
|
|
@@ -189,27 +198,29 @@ provide(INJECT_EDIT_CONTEXT, {
|
|
|
189
198
|
useBlockRegistration
|
|
190
199
|
});
|
|
191
200
|
provide(INJECT_APP, {
|
|
201
|
+
$t,
|
|
192
202
|
adapter,
|
|
203
|
+
animation,
|
|
204
|
+
broadcast,
|
|
205
|
+
commands,
|
|
206
|
+
context,
|
|
207
|
+
debug,
|
|
208
|
+
definitions,
|
|
209
|
+
dom,
|
|
210
|
+
dropAreas,
|
|
193
211
|
eventBus,
|
|
212
|
+
features,
|
|
213
|
+
indicators,
|
|
214
|
+
keyboard,
|
|
215
|
+
plugins,
|
|
194
216
|
runtimeConfig,
|
|
217
|
+
selection,
|
|
195
218
|
state,
|
|
196
|
-
dom,
|
|
197
219
|
storage,
|
|
198
|
-
types,
|
|
199
|
-
selection,
|
|
200
|
-
keyboard,
|
|
201
|
-
ui,
|
|
202
|
-
animation,
|
|
203
|
-
context,
|
|
204
|
-
$t,
|
|
205
|
-
broadcast,
|
|
206
|
-
features,
|
|
207
220
|
theme,
|
|
208
|
-
commands,
|
|
209
221
|
tour,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
definitions
|
|
222
|
+
types,
|
|
223
|
+
ui
|
|
213
224
|
});
|
|
214
225
|
const isProxyMode = computed(() => ui.isProxyMode.value);
|
|
215
226
|
provide(INJECT_GLOBAL_PROXY_MODE, isProxyMode);
|
|
@@ -50,13 +50,12 @@ import {
|
|
|
50
50
|
ref,
|
|
51
51
|
computed,
|
|
52
52
|
useBlokkli,
|
|
53
|
-
onMounted,
|
|
54
|
-
onBeforeUnmount,
|
|
55
53
|
nextTick,
|
|
56
54
|
defineBlokkliFeature
|
|
57
55
|
} from "#imports";
|
|
58
56
|
import { Sortli } from "#blokkli/components";
|
|
59
57
|
import { PluginSidebar, PluginTourItem } from "#blokkli/plugins";
|
|
58
|
+
import { addElementClasses } from "#blokkli/helpers/addElementClasses";
|
|
60
59
|
const { settings } = defineBlokkliFeature({
|
|
61
60
|
id: "add-list",
|
|
62
61
|
icon: "plus",
|
|
@@ -94,14 +93,10 @@ const hasContextMenuOpen = computed(
|
|
|
94
93
|
const isSidebar = computed(() => ui.addListOrientation.value === "sidebar");
|
|
95
94
|
const shouldRender = computed(() => state.editMode.value === "editing");
|
|
96
95
|
watch(ui.addListOrientation, () => {
|
|
97
|
-
setRootClasses();
|
|
98
96
|
nextTick(() => {
|
|
99
97
|
eventBus.emit("add-list:change");
|
|
100
98
|
});
|
|
101
99
|
});
|
|
102
|
-
watch(shouldRender, () => {
|
|
103
|
-
setRootClasses();
|
|
104
|
-
});
|
|
105
100
|
const CLASS_LEFT = "bk-has-add-list-left";
|
|
106
101
|
const CLASS_BOTTOM = "bk-has-add-list-bottom";
|
|
107
102
|
const wrapper = ref(null);
|
|
@@ -146,18 +141,6 @@ const onWheel = (e) => {
|
|
|
146
141
|
e.stopPropagation();
|
|
147
142
|
}
|
|
148
143
|
};
|
|
149
|
-
function setRootClasses() {
|
|
150
|
-
document.documentElement.classList.remove(CLASS_BOTTOM);
|
|
151
|
-
document.documentElement.classList.remove(CLASS_LEFT);
|
|
152
|
-
if (!shouldRender.value) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
if (ui.addListOrientation.value === "horizontal") {
|
|
156
|
-
document.documentElement.classList.add(CLASS_BOTTOM);
|
|
157
|
-
} else if (ui.addListOrientation.value === "vertical") {
|
|
158
|
-
document.documentElement.classList.add(CLASS_LEFT);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
144
|
const sidebarTitle = computed(() => $t("addListSidebarTitle", "Add blocks"));
|
|
162
145
|
const tourText = computed(
|
|
163
146
|
() => $t(
|
|
@@ -165,13 +148,20 @@ const tourText = computed(
|
|
|
165
148
|
"<p>This shows the list of available blocks that can be placed. Add a block by dragging the icon into the page.</p><p>When an existing block is selected, some blocks may be greyed out. This indicates which blocks can be placed inside or after the selected block.</p>"
|
|
166
149
|
)
|
|
167
150
|
);
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
151
|
+
addElementClasses(
|
|
152
|
+
document.documentElement,
|
|
153
|
+
CLASS_BOTTOM,
|
|
154
|
+
computed(
|
|
155
|
+
() => ui.addListOrientation.value === "horizontal" && shouldRender.value
|
|
156
|
+
)
|
|
157
|
+
);
|
|
158
|
+
addElementClasses(
|
|
159
|
+
document.documentElement,
|
|
160
|
+
CLASS_LEFT,
|
|
161
|
+
computed(
|
|
162
|
+
() => ui.addListOrientation.value === "vertical" && shouldRender.value
|
|
163
|
+
)
|
|
164
|
+
);
|
|
175
165
|
</script>
|
|
176
166
|
|
|
177
167
|
<script>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
precision highp float;
|
|
2
|
+
|
|
3
|
+
varying vec4 v_quad;
|
|
4
|
+
varying float v_rect_type;
|
|
5
|
+
varying vec3 v_color;
|
|
6
|
+
varying vec2 v_rect_size;
|
|
7
|
+
varying vec2 v_rect_center;
|
|
8
|
+
|
|
9
|
+
uniform float u_dpi;
|
|
10
|
+
|
|
11
|
+
int pseudoQuadrant(vec2 p) {
|
|
12
|
+
return int(floor(step(0.0, p.x) + 2.0 * step(0.0, -p.y)));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
float sdRoundBox(vec2 p, vec2 b, vec4 radii) {
|
|
16
|
+
int idx = pseudoQuadrant(p);
|
|
17
|
+
float cr;
|
|
18
|
+
if (idx == 0) cr = radii[0];
|
|
19
|
+
else if (idx == 1) cr = radii[1];
|
|
20
|
+
else if (idx == 2) cr = radii[3];
|
|
21
|
+
else cr = radii[2];
|
|
22
|
+
vec2 q = abs(p) - b + cr;
|
|
23
|
+
return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - cr;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
void main() {
|
|
27
|
+
float borderThickness = 2.0 * u_dpi;
|
|
28
|
+
vec2 size = v_rect_size;
|
|
29
|
+
vec4 radius = vec4(0.0); // No rounded corners for now
|
|
30
|
+
|
|
31
|
+
vec2 posRelativeToQuad = gl_FragCoord.xy - v_rect_center;
|
|
32
|
+
|
|
33
|
+
float mainDist = sdRoundBox(posRelativeToQuad, size / 2.0, radius);
|
|
34
|
+
|
|
35
|
+
// Calculate fill alpha (inside the rectangle)
|
|
36
|
+
float fillAlpha = 1.0 - smoothstep(-1.0, 0.0, mainDist);
|
|
37
|
+
|
|
38
|
+
// Calculate border alpha (edge of the rectangle)
|
|
39
|
+
float borderAlpha =
|
|
40
|
+
1.0 - smoothstep(-1.0, 0.0, abs(mainDist) - borderThickness);
|
|
41
|
+
|
|
42
|
+
// Background (transparent)
|
|
43
|
+
vec4 bg = vec4(0.0, 0.0, 0.0, 0.0);
|
|
44
|
+
|
|
45
|
+
// Fill (semi-transparent)
|
|
46
|
+
vec4 fill = vec4(v_color, 0.3);
|
|
47
|
+
|
|
48
|
+
// Border (fully opaque)
|
|
49
|
+
vec4 border = vec4(v_color, 1.0);
|
|
50
|
+
|
|
51
|
+
// Mix background with fill
|
|
52
|
+
vec4 res_with_fill = mix(bg, fill, fillAlpha);
|
|
53
|
+
|
|
54
|
+
// Mix with border
|
|
55
|
+
vec4 finalColor = mix(res_with_fill, border, borderAlpha * border.a);
|
|
56
|
+
|
|
57
|
+
gl_FragColor = finalColor;
|
|
58
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
7
|
+
import { useBlokkli, onBeforeUnmount, computed } from "#imports";
|
|
8
|
+
import {
|
|
9
|
+
setBuffersAndAttributes,
|
|
10
|
+
drawBufferInfo,
|
|
11
|
+
setUniforms
|
|
12
|
+
} from "twgl.js";
|
|
13
|
+
import vs from "./vertex.glsl?raw";
|
|
14
|
+
import fs from "./fragment.glsl?raw";
|
|
15
|
+
import { RectangleBufferCollector } from "#blokkli/helpers/webgl";
|
|
16
|
+
import { toShaderColor } from "#blokkli/helpers";
|
|
17
|
+
const props = defineProps({
|
|
18
|
+
results: { type: Array, required: true },
|
|
19
|
+
gl: { type: null, required: true }
|
|
20
|
+
});
|
|
21
|
+
const { animation, ui, theme, selection, eventBus } = useBlokkli();
|
|
22
|
+
const programInfo = animation.registerProgram("analyze", props.gl, [vs, fs]);
|
|
23
|
+
const statusPriority = {
|
|
24
|
+
violation: 3,
|
|
25
|
+
incomplete: 2,
|
|
26
|
+
pass: 1,
|
|
27
|
+
inapplicable: 0
|
|
28
|
+
};
|
|
29
|
+
const providerElement = ui.providerElement();
|
|
30
|
+
const nodes = computed(() => {
|
|
31
|
+
const allNodes = props.results.filter((v) => v.status === "incomplete" || v.status === "violation").flatMap((result) => {
|
|
32
|
+
const nodes2 = Array.isArray(result.nodes) ? result.nodes : [result.nodes];
|
|
33
|
+
return nodes2.flatMap((node) => {
|
|
34
|
+
const targets = Array.isArray(node.targets) ? node.targets : [node.targets];
|
|
35
|
+
return targets.map((v) => {
|
|
36
|
+
if (typeof v === "string") {
|
|
37
|
+
return providerElement.querySelector(v);
|
|
38
|
+
}
|
|
39
|
+
return v;
|
|
40
|
+
}).filter((v) => v instanceof HTMLElement).filter((v) => providerElement.contains(v));
|
|
41
|
+
}).map((element) => {
|
|
42
|
+
return {
|
|
43
|
+
id: result.id,
|
|
44
|
+
element,
|
|
45
|
+
title: result.title,
|
|
46
|
+
status: result.status
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
const nodeMap = /* @__PURE__ */ new Map();
|
|
51
|
+
for (const node of allNodes) {
|
|
52
|
+
const existing = nodeMap.get(node.element);
|
|
53
|
+
if (!existing || statusPriority[node.status] > statusPriority[existing.status]) {
|
|
54
|
+
nodeMap.set(node.element, node);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return Array.from(nodeMap.values());
|
|
58
|
+
});
|
|
59
|
+
class AnalyzeRectangleBufferCollector extends RectangleBufferCollector {
|
|
60
|
+
prevKey = "";
|
|
61
|
+
rectCache = /* @__PURE__ */ new Map();
|
|
62
|
+
clearCache() {
|
|
63
|
+
this.rectCache.clear();
|
|
64
|
+
}
|
|
65
|
+
getBufferInfo(force) {
|
|
66
|
+
const key = nodes.value.map((node, index) => {
|
|
67
|
+
if (!this.rectCache.has(node.element)) {
|
|
68
|
+
this.rectCache.set(
|
|
69
|
+
node.element,
|
|
70
|
+
ui.getAbsoluteElementRect(node.element)
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
const rect = this.rectCache.get(node.element);
|
|
74
|
+
if (!rect) {
|
|
75
|
+
return `${index}_no_rect`;
|
|
76
|
+
}
|
|
77
|
+
return `${index}_${rect.x}_${rect.y}_${rect.width}_${rect.height}_${node.status}`;
|
|
78
|
+
}).join("_");
|
|
79
|
+
const hasChanged = force || this.prevKey !== key;
|
|
80
|
+
if (hasChanged) {
|
|
81
|
+
this.reset();
|
|
82
|
+
for (let i = 0; i < nodes.value.length; i++) {
|
|
83
|
+
const node = nodes.value[i];
|
|
84
|
+
const id = `analyze_${i}`;
|
|
85
|
+
if (this.added.has(id)) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const rect = this.rectCache.get(node.element);
|
|
89
|
+
if (!rect) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
this.added.add(id);
|
|
93
|
+
const statusType = node.status === "violation" ? 3 : node.status === "incomplete" ? 1 : node.status === "inapplicable" ? 2 : 0;
|
|
94
|
+
this.addRectangle(
|
|
95
|
+
{
|
|
96
|
+
id,
|
|
97
|
+
x: rect.x,
|
|
98
|
+
y: rect.y,
|
|
99
|
+
width: rect.width,
|
|
100
|
+
height: rect.height,
|
|
101
|
+
status: node.status
|
|
102
|
+
},
|
|
103
|
+
statusType
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
this.prevKey = key;
|
|
107
|
+
}
|
|
108
|
+
if (hasChanged) {
|
|
109
|
+
this.bufferInfo = this.createBufferInfo();
|
|
110
|
+
}
|
|
111
|
+
return { info: this.bufferInfo, hasChanged };
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const collector = new AnalyzeRectangleBufferCollector(props.gl);
|
|
115
|
+
onBlokkliEvent("canvas:draw", () => {
|
|
116
|
+
if (selection.isMultiSelecting.value || selection.isDragging.value) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
props.gl.useProgram(programInfo.program);
|
|
120
|
+
const { info } = collector.getBufferInfo();
|
|
121
|
+
if (!info) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
setUniforms(programInfo, {
|
|
125
|
+
u_color_violation: toShaderColor(theme.red.value.normal),
|
|
126
|
+
u_color_incomplete: toShaderColor(theme.yellow.value.normal),
|
|
127
|
+
u_color_pass: toShaderColor(theme.lime.value.normal)
|
|
128
|
+
});
|
|
129
|
+
animation.setSharedUniforms(props.gl, programInfo);
|
|
130
|
+
setBuffersAndAttributes(props.gl, programInfo, info);
|
|
131
|
+
drawBufferInfo(props.gl, info, props.gl.TRIANGLES);
|
|
132
|
+
});
|
|
133
|
+
onBlokkliEvent("ui:resized", function() {
|
|
134
|
+
collector.clearCache();
|
|
135
|
+
collector.reset();
|
|
136
|
+
});
|
|
137
|
+
onBlokkliEvent("state:reloaded", function() {
|
|
138
|
+
collector.clearCache();
|
|
139
|
+
collector.reset();
|
|
140
|
+
});
|
|
141
|
+
onBlokkliEvent("mouse:up", (e) => {
|
|
142
|
+
const artboardX = (e.x - ui.artboardOffset.value.x) / ui.artboardScale.value;
|
|
143
|
+
const artboardY = (e.y - ui.artboardOffset.value.y) / ui.artboardScale.value;
|
|
144
|
+
for (let i = 0; i < nodes.value.length; i++) {
|
|
145
|
+
const node = nodes.value[i];
|
|
146
|
+
const rect = collector.rectCache.get(node.element);
|
|
147
|
+
if (!rect) {
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (artboardX >= rect.x && artboardX <= rect.x + rect.width && artboardY >= rect.y && artboardY <= rect.y + rect.height) {
|
|
151
|
+
eventBus.emit("analyze:click-node", {
|
|
152
|
+
id: node.id,
|
|
153
|
+
target: node.element
|
|
154
|
+
});
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
onBeforeUnmount(() => {
|
|
160
|
+
props.gl.clear(props.gl.COLOR_BUFFER_BIT);
|
|
161
|
+
});
|
|
162
|
+
</script>
|
|
163
|
+
|
|
164
|
+
<script>
|
|
165
|
+
export default {
|
|
166
|
+
name: "AnalyzeOverlay"
|
|
167
|
+
};
|
|
168
|
+
</script>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AnalyzeResultMapped } from '#blokkli/analyzer/types';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{
|
|
3
|
+
results: AnalyzeResultMapped[];
|
|
4
|
+
gl: WebGLRenderingContext;
|
|
5
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
6
|
+
results: AnalyzeResultMapped[];
|
|
7
|
+
gl: WebGLRenderingContext;
|
|
8
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
precision highp float;
|
|
2
|
+
|
|
3
|
+
// [x, y] position.
|
|
4
|
+
attribute vec2 a_position;
|
|
5
|
+
// The [x,y,width, height] of the quad the vertex belongs to.
|
|
6
|
+
attribute vec4 a_quad;
|
|
7
|
+
attribute float a_rect_id;
|
|
8
|
+
attribute float a_rect_type;
|
|
9
|
+
|
|
10
|
+
// The global scaling applied to all quads.
|
|
11
|
+
uniform float u_scale;
|
|
12
|
+
uniform float u_dpi;
|
|
13
|
+
// The amount of pixels to offset on the x axis.
|
|
14
|
+
uniform float u_offset_x;
|
|
15
|
+
// The amount of pixels to offset on the y axis.
|
|
16
|
+
uniform float u_offset_y;
|
|
17
|
+
uniform vec2 u_resolution;
|
|
18
|
+
uniform vec3 u_color_violation;
|
|
19
|
+
uniform vec3 u_color_incomplete;
|
|
20
|
+
uniform vec3 u_color_pass;
|
|
21
|
+
|
|
22
|
+
varying vec4 v_quad;
|
|
23
|
+
varying float v_rect_type;
|
|
24
|
+
varying vec3 v_color;
|
|
25
|
+
varying vec2 v_rect_size;
|
|
26
|
+
varying vec2 v_rect_center;
|
|
27
|
+
|
|
28
|
+
void main() {
|
|
29
|
+
// Apply global scale and offsets
|
|
30
|
+
vec2 offsetPosition = a_position * u_scale;
|
|
31
|
+
offsetPosition.x += u_offset_x;
|
|
32
|
+
offsetPosition.y += u_offset_y;
|
|
33
|
+
|
|
34
|
+
// Normalize position for rendering
|
|
35
|
+
vec2 normalizedPosition = offsetPosition / u_resolution;
|
|
36
|
+
|
|
37
|
+
// Transform to screen space (-1 to 1)
|
|
38
|
+
vec2 screenSpacePosition = normalizedPosition * 2.0 - vec2(1.0, 1.0);
|
|
39
|
+
screenSpacePosition.y = -screenSpacePosition.y;
|
|
40
|
+
|
|
41
|
+
// Output final position in clip space
|
|
42
|
+
gl_Position = vec4(screenSpacePosition, 0.0, 1.0) * u_dpi;
|
|
43
|
+
|
|
44
|
+
// Pass quad and type to fragment shader
|
|
45
|
+
vec4 transformed_quad = vec4(
|
|
46
|
+
(a_quad.x * u_scale + u_offset_x) * u_dpi,
|
|
47
|
+
(u_resolution.y - a_quad.y * u_scale - a_quad.w * u_scale - u_offset_y) *
|
|
48
|
+
u_dpi,
|
|
49
|
+
a_quad.z * u_scale * u_dpi,
|
|
50
|
+
a_quad.w * u_scale * u_dpi
|
|
51
|
+
);
|
|
52
|
+
v_quad = transformed_quad;
|
|
53
|
+
v_rect_type = a_rect_type;
|
|
54
|
+
v_rect_size = vec2(v_quad.z, v_quad.w);
|
|
55
|
+
v_rect_center = vec2(v_quad.x + v_quad.z / 2.0, v_quad.y + v_quad.w / 2.0);
|
|
56
|
+
|
|
57
|
+
// Set color based on status type
|
|
58
|
+
// 0 = pass, 1 = incomplete, 2 = inapplicable, 3 = violation
|
|
59
|
+
if (a_rect_type > 2.5) {
|
|
60
|
+
// violation
|
|
61
|
+
v_color = u_color_violation;
|
|
62
|
+
} else if (a_rect_type > 0.5 && a_rect_type < 1.5) {
|
|
63
|
+
// incomplete
|
|
64
|
+
v_color = u_color_incomplete;
|
|
65
|
+
} else if (a_rect_type < 0.5) {
|
|
66
|
+
// pass
|
|
67
|
+
v_color = u_color_pass;
|
|
68
|
+
} else {
|
|
69
|
+
// inapplicable - use a neutral gray
|
|
70
|
+
v_color = vec3(0.5, 0.5, 0.5);
|
|
71
|
+
}
|
|
72
|
+
}
|