@blokkli/editor 2.0.0-alpha.24 → 2.0.0-alpha.25
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.json +1 -1
- package/dist/module.mjs +191 -27
- package/dist/runtime/blokkliPlugins/BlockIndicator/index.vue.d.ts +38 -0
- package/dist/runtime/blokkliPlugins/ContextMenu/index.vue.d.ts +15 -0
- package/dist/runtime/blokkliPlugins/DebugOverlay/index.vue.d.ts +6 -0
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +28 -3
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +6 -4
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue +11 -3
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +138 -3
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue.d.ts +114 -0
- package/dist/runtime/blokkliPlugins/TourItem/index.vue.d.ts +21 -0
- package/dist/runtime/blokkliPlugins/ViewOption/index.vue.d.ts +98 -0
- package/dist/runtime/components/Blocks/NotImplemented/index.vue +24 -0
- package/dist/runtime/components/Blocks/NotImplemented/index.vue.d.ts +6 -0
- package/dist/runtime/components/BlokkliEditable.vue.d.ts +11 -0
- package/dist/runtime/components/BlokkliItem.vue +16 -3
- package/dist/runtime/components/BlokkliItem.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Actions/index.vue +1 -1
- package/dist/runtime/components/Edit/AddListItem/index.vue +1 -6
- package/dist/runtime/components/Edit/AddListItem/index.vue.d.ts +5 -13
- package/dist/runtime/components/Edit/ArtboardTooltip/index.vue +6 -0
- package/dist/runtime/components/Edit/BlockProxy/index.vue +2 -2
- package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue +3 -0
- package/dist/runtime/components/Edit/BlokkliRootErrorBoundary.vue +4 -1
- package/dist/runtime/components/Edit/Dialog/index.vue +15 -50
- package/dist/runtime/components/Edit/DraggableList.vue +12 -9
- package/dist/runtime/components/Edit/EditIndicator.vue +11 -4
- package/dist/runtime/components/Edit/EditProvider.vue +27 -24
- package/dist/runtime/components/Edit/Features/AddList/Actions/Action.vue +1 -0
- package/dist/runtime/components/Edit/Features/AddList/Blocks/index.vue +2 -3
- package/dist/runtime/components/Edit/Features/AddList/index.vue +17 -5
- package/dist/runtime/components/Edit/Features/Analyze/Icon.vue +85 -0
- package/dist/runtime/components/Edit/Features/Analyze/Icon.vue.d.ts +5 -0
- package/dist/runtime/components/Edit/Features/Analyze/Main.vue +288 -59
- package/dist/runtime/components/Edit/Features/Analyze/Main.vue.d.ts +8 -1
- package/dist/runtime/components/Edit/Features/Analyze/Renderer/fragment.glsl +25 -13
- package/dist/runtime/components/Edit/Features/Analyze/Renderer/index.vue +114 -52
- package/dist/runtime/components/Edit/Features/Analyze/Renderer/index.vue.d.ts +16 -2
- package/dist/runtime/components/Edit/Features/Analyze/Renderer/vertex.glsl +31 -11
- package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue +2 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue.d.ts +8 -1
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue +4 -4
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue.d.ts +20 -2
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue +11 -18
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue.d.ts +10 -3
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +46 -40
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue.d.ts +10 -4
- package/dist/runtime/components/Edit/Features/Analyze/Summary/Chart.vue +8 -4
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/axe.js +1 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.d.ts +4 -3
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.js +2 -1
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/readability.js +61 -20
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/types.d.ts +15 -1
- package/dist/runtime/components/Edit/Features/Analyze/index.vue +23 -2
- package/dist/runtime/components/Edit/Features/Artboard/Overview/index.vue +22 -8
- package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +1 -1
- package/dist/runtime/components/Edit/Features/Artboard/Scrollbar/index.vue +8 -3
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue +10 -1
- package/dist/runtime/components/Edit/Features/Debug/Main.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Debug/Section/Logging.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue +8 -2
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +1 -7
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +4 -3
- package/dist/runtime/components/Edit/Features/EditableMask/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +7 -2
- package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +9 -2
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +12 -3
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +9 -0
- package/dist/runtime/components/Edit/Features/ResponsivePreview/Frame/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +8 -2
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue +12 -2
- package/dist/runtime/components/Edit/Features/Search/Overlay/index.vue +11 -3
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +126 -33
- package/dist/runtime/components/Edit/Features/Selection/Renderer/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Settings/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Transform/Dialog/index.vue +7 -1
- package/dist/runtime/components/Edit/Form/Textarea/index.vue +1 -1
- package/dist/runtime/components/Edit/FormOverlay/index.vue +1 -1
- package/dist/runtime/components/Edit/Indicators/index.vue +1 -1
- package/dist/runtime/components/Edit/InfoBox/index.vue +3 -2
- package/dist/runtime/components/Edit/InfoBox/index.vue.d.ts +6 -1
- package/dist/runtime/components/Edit/Overlay/index.vue +4 -0
- package/dist/runtime/components/Edit/PreviewProvider.vue +3 -3
- package/dist/runtime/components/Edit/ScaleToFit/index.vue +4 -4
- package/dist/runtime/composables/defineBlokkliFeature.d.ts +1 -1
- package/dist/runtime/composables/useBlokkli.d.ts +6 -1
- package/dist/runtime/composables/useBlokkli.js +4 -1
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/composables/defineItemDropdownAction.d.ts +1 -1
- package/dist/runtime/helpers/composables/defineMenuButton.d.ts +1 -1
- package/dist/runtime/helpers/composables/defineRenderer.d.ts +1 -1
- package/dist/runtime/helpers/composables/onBroadcastEvent.d.ts +1 -1
- package/dist/runtime/helpers/composables/useBlockRegistration.d.ts +1 -1
- package/dist/runtime/helpers/composables/useBlockRegistration.js +12 -1
- package/dist/runtime/helpers/composables/useDebugLogger.d.ts +1 -1
- package/dist/runtime/helpers/composables/useFocusTrap.d.ts +52 -0
- package/dist/runtime/helpers/composables/useFocusTrap.js +59 -0
- package/dist/runtime/helpers/composables/useGlobalBlokkliObject.d.ts +1 -1
- package/dist/runtime/helpers/{useTransitionedValue.js → composables/useTransitionedValue.js} +1 -1
- package/dist/runtime/helpers/imports/index.d.ts +2 -1
- package/dist/runtime/helpers/imports/index.js +10 -1
- package/dist/runtime/helpers/{animationProvider.d.ts → providers/animation.d.ts} +100 -7
- package/dist/runtime/helpers/{animationProvider.js → providers/animation.js} +21 -11
- package/dist/runtime/helpers/providers/blocks.d.ts +25 -3
- package/dist/runtime/helpers/providers/blocks.js +9 -0
- package/dist/runtime/helpers/providers/commands.d.ts +41 -0
- package/dist/runtime/helpers/{commandsProvider.js → providers/commands.js} +1 -1
- package/dist/runtime/helpers/providers/debug.d.ts +125 -0
- package/dist/runtime/helpers/{debugProvider.js → providers/debug.js} +2 -2
- package/dist/runtime/helpers/providers/definition.d.ts +87 -0
- package/dist/runtime/helpers/providers/directive.d.ts +88 -2
- package/dist/runtime/helpers/providers/directive.js +18 -2
- package/dist/runtime/helpers/providers/dom.d.ts +225 -0
- package/dist/runtime/helpers/{domProvider.js → providers/dom.js} +27 -74
- package/dist/runtime/helpers/providers/dropArea.d.ts +47 -0
- package/dist/runtime/helpers/{dropAreaProvider.js → providers/dropArea.js} +1 -1
- package/dist/runtime/helpers/providers/element.d.ts +58 -1
- package/dist/runtime/helpers/providers/features.d.ts +56 -0
- package/dist/runtime/helpers/{featuresProvider.js → providers/features.js} +1 -1
- package/dist/runtime/helpers/providers/fields.d.ts +18 -11
- package/dist/runtime/helpers/providers/fields.js +1 -1
- package/dist/runtime/helpers/providers/indicators.d.ts +44 -0
- package/dist/runtime/helpers/providers/keyboard.d.ts +76 -0
- package/dist/runtime/helpers/{keyboardProvider.js → providers/keyboard.js} +1 -8
- package/dist/runtime/helpers/{pluginProvider.d.ts → providers/plugin.d.ts} +36 -0
- package/dist/runtime/helpers/{selectionProvider.d.ts → providers/selection.d.ts} +4 -1
- package/dist/runtime/helpers/{selectionProvider.js → providers/selection.js} +1 -1
- package/dist/runtime/helpers/providers/state.d.ts +227 -0
- package/dist/runtime/helpers/{stateProvider.js → providers/state.js} +3 -3
- package/dist/runtime/helpers/providers/storage.d.ts +64 -0
- package/dist/runtime/helpers/{textProvider.d.ts → providers/texts.d.ts} +1 -1
- package/dist/runtime/helpers/providers/theme.d.ts +119 -0
- package/dist/runtime/helpers/{themeProvider.js → providers/theme.js} +3 -3
- package/dist/runtime/helpers/providers/tour.d.ts +49 -0
- package/dist/runtime/helpers/{tourProvider.js → providers/tour.js} +1 -1
- package/dist/runtime/helpers/providers/types.d.ts +170 -0
- package/dist/runtime/helpers/{typesProvider.js → providers/types.js} +45 -1
- package/dist/runtime/helpers/providers/ui.d.ts +339 -0
- package/dist/runtime/helpers/{uiProvider.js → providers/ui.js} +11 -5
- package/dist/runtime/helpers/runtimeHelpers/index.d.ts +1 -1
- package/dist/runtime/helpers/symbols.d.ts +1 -0
- package/dist/runtime/helpers/symbols.js +3 -0
- package/dist/runtime/types/blockOptions.d.ts +349 -0
- package/dist/runtime/types/index.d.ts +22 -26
- package/package.json +2 -2
- package/dist/runtime/helpers/commandsProvider.d.ts +0 -9
- package/dist/runtime/helpers/debugProvider.d.ts +0 -33
- package/dist/runtime/helpers/definitionProvider.d.ts +0 -19
- package/dist/runtime/helpers/domProvider.d.ts +0 -91
- package/dist/runtime/helpers/dropAreaProvider.d.ts +0 -9
- package/dist/runtime/helpers/featuresProvider.d.ts +0 -17
- package/dist/runtime/helpers/indicatorsProvider.d.ts +0 -10
- package/dist/runtime/helpers/keyboardProvider.d.ts +0 -20
- package/dist/runtime/helpers/stateProvider.d.ts +0 -47
- package/dist/runtime/helpers/storageProvider.d.ts +0 -17
- package/dist/runtime/helpers/themeProvider.d.ts +0 -30
- package/dist/runtime/helpers/tourProvider.d.ts +0 -11
- package/dist/runtime/helpers/typesProvider.d.ts +0 -36
- package/dist/runtime/helpers/uiProvider.d.ts +0 -57
- package/dist/runtime/types/blokkOptions.d.ts +0 -100
- /package/dist/runtime/helpers/{addElementClasses.d.ts → composables/addElementClasses.d.ts} +0 -0
- /package/dist/runtime/helpers/{addElementClasses.js → composables/addElementClasses.js} +0 -0
- /package/dist/runtime/helpers/{defineElementStyle.d.ts → composables/defineElementStyle.d.ts} +0 -0
- /package/dist/runtime/helpers/{defineElementStyle.js → composables/defineElementStyle.js} +0 -0
- /package/dist/runtime/helpers/{useTransitionedValue.d.ts → composables/useTransitionedValue.d.ts} +0 -0
- /package/dist/runtime/helpers/{broadcastProvider.d.ts → providers/broadcast.d.ts} +0 -0
- /package/dist/runtime/helpers/{broadcastProvider.js → providers/broadcast.js} +0 -0
- /package/dist/runtime/helpers/{definitionProvider.js → providers/definition.js} +0 -0
- /package/dist/runtime/helpers/{indicatorsProvider.js → providers/indicators.js} +0 -0
- /package/dist/runtime/helpers/{pluginProvider.js → providers/plugin.js} +0 -0
- /package/dist/runtime/helpers/{storageProvider.js → providers/storage.js} +0 -0
- /package/dist/runtime/helpers/{textProvider.js → providers/texts.js} +0 -0
- /package/dist/runtime/types/{blokkOptions.js → blockOptions.js} +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
7
7
|
import defineRenderer from "#blokkli/helpers/composables/defineRenderer";
|
|
8
|
-
import { useBlokkli, computed } from "#imports";
|
|
8
|
+
import { useBlokkli, computed, watch } from "#imports";
|
|
9
9
|
import {
|
|
10
10
|
setBuffersAndAttributes,
|
|
11
11
|
drawBufferInfo,
|
|
@@ -16,9 +16,15 @@ import fs from "./fragment.glsl?raw";
|
|
|
16
16
|
import { RectangleBufferCollector } from "#blokkli/helpers/webgl";
|
|
17
17
|
import { toShaderColor } from "#blokkli/helpers";
|
|
18
18
|
const props = defineProps({
|
|
19
|
-
results: { type: Array, required: true }
|
|
19
|
+
results: { type: Array, required: true },
|
|
20
|
+
isStale: { type: Boolean, required: true },
|
|
21
|
+
isRunning: { type: Boolean, required: true },
|
|
22
|
+
manualAnalyzerIds: { type: Set, required: true }
|
|
20
23
|
});
|
|
21
|
-
const { animation, ui, theme, selection,
|
|
24
|
+
const { animation, ui, theme, selection, element, dom, blocks } = useBlokkli();
|
|
25
|
+
const activeId = defineModel({ type: String, ...{
|
|
26
|
+
default: ""
|
|
27
|
+
} });
|
|
22
28
|
const statusPriority = {
|
|
23
29
|
violation: 3,
|
|
24
30
|
incomplete: 2,
|
|
@@ -26,51 +32,88 @@ const statusPriority = {
|
|
|
26
32
|
inapplicable: 0
|
|
27
33
|
};
|
|
28
34
|
const nodes = computed(() => {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
const mappedNodes = [];
|
|
36
|
+
for (let i = 0; i < props.results.length; i++) {
|
|
37
|
+
const result = props.results[i];
|
|
38
|
+
if (!result) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (result.status !== "incomplete" && result.status !== "violation") {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
for (let j = 0; j < result.nodes.length; j++) {
|
|
45
|
+
const node = result.nodes[j];
|
|
46
|
+
if (!node) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
for (let k = 0; k < node.targets.length; k++) {
|
|
50
|
+
const target = node.targets[k];
|
|
51
|
+
if (!target) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
let targetElement = null;
|
|
55
|
+
if (typeof target.target === "string") {
|
|
56
|
+
targetElement = element.query(
|
|
36
57
|
ui.providerElement,
|
|
37
|
-
|
|
58
|
+
target.target,
|
|
38
59
|
"Find analyze node target element."
|
|
39
60
|
);
|
|
61
|
+
} else if (target.target instanceof HTMLElement) {
|
|
62
|
+
targetElement = target.target;
|
|
63
|
+
} else {
|
|
64
|
+
const item = blocks.getBlock(target.target.uuid);
|
|
65
|
+
if (item) {
|
|
66
|
+
targetElement = dom.getDragElement(item) ?? null;
|
|
67
|
+
}
|
|
40
68
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
69
|
+
if (targetElement) {
|
|
70
|
+
mappedNodes.push({
|
|
71
|
+
id: result.id,
|
|
72
|
+
element: targetElement,
|
|
73
|
+
index: target.globalIndex,
|
|
74
|
+
title: result.title,
|
|
75
|
+
status: result.status,
|
|
76
|
+
plugin: result.plugin
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
52
82
|
const nodeMap = /* @__PURE__ */ new Map();
|
|
53
|
-
for (const node of
|
|
83
|
+
for (const node of mappedNodes) {
|
|
54
84
|
const existing = nodeMap.get(node.element);
|
|
55
85
|
if (!existing || statusPriority[node.status] > statusPriority[existing.status]) {
|
|
56
86
|
nodeMap.set(node.element, node);
|
|
57
87
|
}
|
|
58
88
|
}
|
|
59
|
-
|
|
89
|
+
const finalNodes = Array.from(nodeMap.values());
|
|
90
|
+
return finalNodes;
|
|
91
|
+
});
|
|
92
|
+
const activeRectId = computed(() => {
|
|
93
|
+
if (!activeId.value) {
|
|
94
|
+
return -1;
|
|
95
|
+
}
|
|
96
|
+
for (let i = 0; i < nodes.value.length; i++) {
|
|
97
|
+
const node = nodes.value[i];
|
|
98
|
+
const id = node.id + "_____" + node.index;
|
|
99
|
+
if (activeId.value === id) {
|
|
100
|
+
return i;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return -1;
|
|
60
104
|
});
|
|
61
105
|
class AnalyzeRectangleBufferCollector extends RectangleBufferCollector {
|
|
62
106
|
prevKey = "";
|
|
63
107
|
rectCache = /* @__PURE__ */ new Map();
|
|
64
108
|
clearCache() {
|
|
65
109
|
this.rectCache.clear();
|
|
110
|
+
this.prevKey = "";
|
|
66
111
|
}
|
|
67
112
|
getBufferInfo(gl, force) {
|
|
68
113
|
const key = nodes.value.map((node, index) => {
|
|
69
114
|
if (!this.rectCache.has(node.element)) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
ui.getAbsoluteElementRect(node.element)
|
|
73
|
-
);
|
|
115
|
+
const rect2 = ui.getAbsoluteElementRect(node.element);
|
|
116
|
+
this.rectCache.set(node.element, rect2);
|
|
74
117
|
}
|
|
75
118
|
const rect = this.rectCache.get(node.element);
|
|
76
119
|
if (!rect) {
|
|
@@ -92,7 +135,8 @@ class AnalyzeRectangleBufferCollector extends RectangleBufferCollector {
|
|
|
92
135
|
continue;
|
|
93
136
|
}
|
|
94
137
|
this.added.add(id);
|
|
95
|
-
const
|
|
138
|
+
const isManual = props.manualAnalyzerIds.has(node.plugin);
|
|
139
|
+
const statusType = node.status === "violation" ? isManual ? 0 : 1 : isManual ? 2 : 3;
|
|
96
140
|
this.addRectangle(
|
|
97
141
|
{
|
|
98
142
|
id,
|
|
@@ -100,7 +144,9 @@ class AnalyzeRectangleBufferCollector extends RectangleBufferCollector {
|
|
|
100
144
|
y: rect.y,
|
|
101
145
|
width: rect.width,
|
|
102
146
|
height: rect.height,
|
|
103
|
-
status: node.status
|
|
147
|
+
status: node.status,
|
|
148
|
+
plugin: node.plugin,
|
|
149
|
+
nodeIndex: node.index
|
|
104
150
|
},
|
|
105
151
|
statusType
|
|
106
152
|
);
|
|
@@ -113,11 +159,14 @@ class AnalyzeRectangleBufferCollector extends RectangleBufferCollector {
|
|
|
113
159
|
return { info: this.bufferInfo, hasChanged };
|
|
114
160
|
}
|
|
115
161
|
}
|
|
162
|
+
function getOpacity() {
|
|
163
|
+
return props.isRunning ? 0.3 : 1;
|
|
164
|
+
}
|
|
116
165
|
const { collector } = defineRenderer("analyze-overlay", {
|
|
117
166
|
zIndex: 500,
|
|
118
167
|
collector: () => new AnalyzeRectangleBufferCollector(),
|
|
119
168
|
program: () => ({ shaders: [vs, fs] }),
|
|
120
|
-
enabled: () => !selection.isMultiSelecting.value && !selection.isDragging.value,
|
|
169
|
+
enabled: () => !selection.isMultiSelecting.value && !selection.isDragging.value && !selection.isChangingOptions.value,
|
|
121
170
|
render: (_ctx, gl, program) => {
|
|
122
171
|
gl.useProgram(program.program);
|
|
123
172
|
const { info } = collector.getBufferInfo(gl);
|
|
@@ -127,7 +176,9 @@ const { collector } = defineRenderer("analyze-overlay", {
|
|
|
127
176
|
setUniforms(program, {
|
|
128
177
|
u_color_violation: toShaderColor(theme.red.value.normal),
|
|
129
178
|
u_color_incomplete: toShaderColor(theme.yellow.value.normal),
|
|
130
|
-
|
|
179
|
+
u_opacity: getOpacity(),
|
|
180
|
+
u_manual_stale: props.isStale ? 1 : 0,
|
|
181
|
+
u_active_id: activeRectId.value
|
|
131
182
|
});
|
|
132
183
|
animation.setSharedUniforms(gl, program);
|
|
133
184
|
setBuffersAndAttributes(gl, program, info);
|
|
@@ -142,24 +193,23 @@ const { collector } = defineRenderer("analyze-overlay", {
|
|
|
142
193
|
const rgbaToCss = (rgb, alpha) => {
|
|
143
194
|
return `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, ${alpha})`;
|
|
144
195
|
};
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
const colorPass = rgbaToCss(theme.lime.value.normal, 0.3);
|
|
196
|
+
const globalOpacity = getOpacity();
|
|
197
|
+
const borderRadius = 8 * ctx.dpi;
|
|
148
198
|
for (let i = 0; i < rects.length; i++) {
|
|
149
199
|
const rect = rects[i];
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
200
|
+
const isManual = props.manualAnalyzerIds.has(rect.plugin);
|
|
201
|
+
const finalOpacity = isManual && props.isStale ? 0.3 : globalOpacity;
|
|
202
|
+
const fillAlpha = 0.3 * finalOpacity;
|
|
203
|
+
const baseColor = rect.status === "violation" ? theme.red.value.normal : theme.yellow.value.normal;
|
|
204
|
+
const fillColor = rgbaToCss(baseColor, fillAlpha);
|
|
205
|
+
const x = (rect.x * ctx.artboardScale + ctx.artboardOffset.x) * ctx.dpi;
|
|
206
|
+
const y = (rect.y * ctx.artboardScale + ctx.artboardOffset.y) * ctx.dpi;
|
|
207
|
+
const width = rect.width * ctx.artboardScale * ctx.dpi;
|
|
208
|
+
const height = rect.height * ctx.artboardScale * ctx.dpi;
|
|
156
209
|
ctx2d.fillStyle = fillColor;
|
|
157
|
-
ctx2d.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
rect.width * ctx.artboardScale * ctx.dpi,
|
|
161
|
-
rect.height * ctx.artboardScale * ctx.dpi
|
|
162
|
-
);
|
|
210
|
+
ctx2d.beginPath();
|
|
211
|
+
ctx2d.roundRect(x, y, width, height, borderRadius);
|
|
212
|
+
ctx2d.fill();
|
|
163
213
|
}
|
|
164
214
|
}
|
|
165
215
|
});
|
|
@@ -167,10 +217,17 @@ onBlokkliEvent("ui:resized", function() {
|
|
|
167
217
|
collector.clearCache();
|
|
168
218
|
collector.reset();
|
|
169
219
|
});
|
|
170
|
-
onBlokkliEvent("
|
|
220
|
+
onBlokkliEvent("option:finish-change", () => {
|
|
171
221
|
collector.clearCache();
|
|
172
222
|
collector.reset();
|
|
173
223
|
});
|
|
224
|
+
watch(
|
|
225
|
+
() => props.results,
|
|
226
|
+
() => {
|
|
227
|
+
collector.clearCache();
|
|
228
|
+
collector.reset();
|
|
229
|
+
}
|
|
230
|
+
);
|
|
174
231
|
onBlokkliEvent("mouse:up", (e) => {
|
|
175
232
|
const artboardX = (e.x - ui.artboardOffset.value.x) / ui.artboardScale.value;
|
|
176
233
|
const artboardY = (e.y - ui.artboardOffset.value.y) / ui.artboardScale.value;
|
|
@@ -181,14 +238,19 @@ onBlokkliEvent("mouse:up", (e) => {
|
|
|
181
238
|
continue;
|
|
182
239
|
}
|
|
183
240
|
if (artboardX >= rect.x && artboardX <= rect.x + rect.width && artboardY >= rect.y && artboardY <= rect.y + rect.height) {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
241
|
+
const id = node.id + "_____" + node.index;
|
|
242
|
+
if (activeId.value === id) {
|
|
243
|
+
activeId.value = "";
|
|
244
|
+
} else {
|
|
245
|
+
activeId.value = id;
|
|
246
|
+
}
|
|
188
247
|
return;
|
|
189
248
|
}
|
|
190
249
|
}
|
|
191
250
|
});
|
|
251
|
+
onBlokkliEvent("window:clickAway", () => {
|
|
252
|
+
activeId.value = "";
|
|
253
|
+
});
|
|
192
254
|
</script>
|
|
193
255
|
|
|
194
256
|
<script>
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import type { AnalyzeResultMapped } from '#blokkli/analyzer/types';
|
|
2
2
|
declare const _default: import("vue").DefineComponent<{
|
|
3
3
|
results: AnalyzeResultMapped[];
|
|
4
|
-
|
|
4
|
+
isStale: boolean;
|
|
5
|
+
isRunning: boolean;
|
|
6
|
+
manualAnalyzerIds: Set<string>;
|
|
7
|
+
} & {
|
|
8
|
+
modelValue?: string;
|
|
9
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
"update:modelValue": (value: string) => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
5
12
|
results: AnalyzeResultMapped[];
|
|
6
|
-
|
|
13
|
+
isStale: boolean;
|
|
14
|
+
isRunning: boolean;
|
|
15
|
+
manualAnalyzerIds: Set<string>;
|
|
16
|
+
} & {
|
|
17
|
+
modelValue?: string;
|
|
18
|
+
}> & Readonly<{
|
|
19
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
21
|
export default _default;
|
|
@@ -19,13 +19,19 @@ uniform float u_offset_y;
|
|
|
19
19
|
uniform vec2 u_resolution;
|
|
20
20
|
uniform vec3 u_color_violation;
|
|
21
21
|
uniform vec3 u_color_incomplete;
|
|
22
|
-
uniform
|
|
22
|
+
uniform float u_opacity;
|
|
23
|
+
uniform float u_manual_stale;
|
|
24
|
+
uniform float u_active_id;
|
|
23
25
|
|
|
24
26
|
out vec4 v_quad;
|
|
25
27
|
out float v_rect_type;
|
|
26
28
|
out vec3 v_color;
|
|
27
29
|
out vec2 v_rect_size;
|
|
28
30
|
out vec2 v_rect_center;
|
|
31
|
+
out float v_opacity;
|
|
32
|
+
out float v_border_opacity;
|
|
33
|
+
out float v_border_factor;
|
|
34
|
+
out float v_fill_opacity;
|
|
29
35
|
|
|
30
36
|
void main() {
|
|
31
37
|
// Apply global scale and offsets
|
|
@@ -57,18 +63,32 @@ void main() {
|
|
|
57
63
|
v_rect_center = vec2(v_quad.x + v_quad.z / 2.0, v_quad.y + v_quad.w / 2.0);
|
|
58
64
|
|
|
59
65
|
// Set color based on status type
|
|
60
|
-
// 0 =
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
// 0 = violation (manual), 1 = violation (continuous)
|
|
67
|
+
// 2 = incomplete (manual), 3 = incomplete (continuous)
|
|
68
|
+
if (a_rect_type < 1.5) {
|
|
69
|
+
// Types 0 and 1: violation
|
|
63
70
|
v_color = u_color_violation;
|
|
64
|
-
} else
|
|
65
|
-
// incomplete
|
|
71
|
+
} else {
|
|
72
|
+
// Types 2 and 3: incomplete
|
|
66
73
|
v_color = u_color_incomplete;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Calculate final opacity
|
|
77
|
+
// Check if this is a manual analyzer (type 0 or 2)
|
|
78
|
+
bool isManual = a_rect_type == 0.0 || a_rect_type == 2.0;
|
|
79
|
+
|
|
80
|
+
// If manual AND stale, use 0.3, otherwise use global opacity
|
|
81
|
+
if (isManual && u_manual_stale > 0.5) {
|
|
82
|
+
v_opacity = 0.3;
|
|
70
83
|
} else {
|
|
71
|
-
|
|
72
|
-
v_color = vec3(0.5, 0.5, 0.5);
|
|
84
|
+
v_opacity = u_opacity;
|
|
73
85
|
}
|
|
86
|
+
|
|
87
|
+
// Calculate border factor based on scale.
|
|
88
|
+
v_border_factor = smoothstep(0.5, 0.8, u_scale);
|
|
89
|
+
|
|
90
|
+
// Calculate fill opacity based on whether this rect is active
|
|
91
|
+
// If active (rect_id matches u_active_id), use 0.5, otherwise 0.1
|
|
92
|
+
v_fill_opacity = a_rect_id == u_active_id ? 0.3 : 0.1;
|
|
93
|
+
v_border_opacity = a_rect_id == u_active_id ? 1.0 : 0.5;
|
|
74
94
|
}
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
v-for="result in group.results"
|
|
26
26
|
v-bind="result"
|
|
27
27
|
:key="group.group + result.id"
|
|
28
|
+
v-model="activeId"
|
|
28
29
|
/>
|
|
29
30
|
</li>
|
|
30
31
|
</ul>
|
|
@@ -40,6 +41,7 @@ const props = defineProps({
|
|
|
40
41
|
results: { type: Array, required: true }
|
|
41
42
|
});
|
|
42
43
|
const { $t } = useBlokkli();
|
|
44
|
+
const activeId = defineModel({ type: String, ...{ default: "" } });
|
|
43
45
|
const groupOrder = {
|
|
44
46
|
problems: 1,
|
|
45
47
|
success: 2,
|
|
@@ -2,5 +2,12 @@ import type { AnalyzeResultMapped } from '../analyzers/types.js';
|
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
results: AnalyzeResultMapped[];
|
|
4
4
|
};
|
|
5
|
-
|
|
5
|
+
type __VLS_PublicProps = __VLS_Props & {
|
|
6
|
+
modelValue?: string;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
"update:modelValue": (value: string) => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
11
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
12
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
13
|
export default _default;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
{{ descriptionMapped }}
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
|
-
<ResultsItemNodes :nodes :result-id="id" />
|
|
18
|
+
<ResultsItemNodes v-model="activeId" :nodes :result-id="id" />
|
|
19
19
|
</div>
|
|
20
20
|
</template>
|
|
21
21
|
|
|
@@ -32,11 +32,11 @@ const props = defineProps({
|
|
|
32
32
|
description: { type: String, required: true },
|
|
33
33
|
link: { type: String, required: false },
|
|
34
34
|
status: { type: String, required: true },
|
|
35
|
-
nodes: { type: [Object, Array], required: true },
|
|
36
35
|
impact: { type: String, required: false },
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
plugin: { type: String, required: true },
|
|
37
|
+
nodes: { type: Array, required: true }
|
|
39
38
|
});
|
|
39
|
+
const activeId = defineModel({ type: String, ...{ default: "" } });
|
|
40
40
|
const { getCategoryLabel } = useAnalyzeHelper();
|
|
41
41
|
const { $t } = useBlokkli();
|
|
42
42
|
const categoryLabel = computed(() => {
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { AnalyzeCategory, AnalyzeImpact, AnalyzeNodeMapped, AnalyzeStatus } from '../analyzers/types.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
category: AnalyzeCategory;
|
|
6
|
+
description: string;
|
|
7
|
+
link?: string;
|
|
8
|
+
status: AnalyzeStatus;
|
|
9
|
+
impact?: AnalyzeImpact;
|
|
10
|
+
plugin: string;
|
|
11
|
+
nodes: AnalyzeNodeMapped[];
|
|
12
|
+
};
|
|
13
|
+
type __VLS_PublicProps = __VLS_Props & {
|
|
14
|
+
modelValue?: string;
|
|
15
|
+
};
|
|
16
|
+
declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
17
|
+
"update:modelValue": (value: string) => any;
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
19
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
21
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<details
|
|
3
|
-
v-if="
|
|
3
|
+
v-if="nodes.length"
|
|
4
4
|
class="bk-analyze-results-item-nodes"
|
|
5
5
|
:open="isSingle || isOpen"
|
|
6
6
|
@toggle="shouldRender = true"
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
<ResultsItemNodesTarget
|
|
26
26
|
v-for="(target, k) in node.targets"
|
|
27
27
|
:key="i + '_' + j + '_' + k"
|
|
28
|
-
|
|
28
|
+
v-model="activeId"
|
|
29
|
+
:target
|
|
29
30
|
:result-id
|
|
30
31
|
/>
|
|
31
32
|
</li>
|
|
@@ -37,31 +38,22 @@
|
|
|
37
38
|
</template>
|
|
38
39
|
|
|
39
40
|
<script setup>
|
|
40
|
-
import { computed, ref, useBlokkli } from "#imports";
|
|
41
|
+
import { computed, ref, useBlokkli, watch } from "#imports";
|
|
41
42
|
import ResultsItemNodesTarget from "./ResultsItemNodesTarget.vue";
|
|
42
43
|
import { Icon } from "#blokkli/components";
|
|
43
|
-
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
44
44
|
const props = defineProps({
|
|
45
45
|
resultId: { type: String, required: true },
|
|
46
|
-
nodes: { type:
|
|
46
|
+
nodes: { type: Array, required: true }
|
|
47
47
|
});
|
|
48
|
+
const activeId = defineModel({ type: String, ...{ default: "" } });
|
|
48
49
|
const shouldRender = ref(false);
|
|
49
50
|
const isOpen = ref(false);
|
|
50
51
|
const { $t } = useBlokkli();
|
|
51
|
-
const mappedNodes = computed(() => {
|
|
52
|
-
const nodes = Array.isArray(props.nodes) ? props.nodes : [props.nodes];
|
|
53
|
-
return nodes.map((node) => {
|
|
54
|
-
return {
|
|
55
|
-
...node,
|
|
56
|
-
targets: Array.isArray(node.targets) ? node.targets : [node.targets]
|
|
57
|
-
};
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
52
|
const isSingle = computed(
|
|
61
|
-
() =>
|
|
53
|
+
() => props.nodes.length === 1 && props.nodes[0]?.targets.length === 1
|
|
62
54
|
);
|
|
63
55
|
const grouped = computed(() => {
|
|
64
|
-
const map =
|
|
56
|
+
const map = props.nodes.reduce(
|
|
65
57
|
(acc, node) => {
|
|
66
58
|
const description = node.description ?? "NONE";
|
|
67
59
|
if (!acc[description]) {
|
|
@@ -79,8 +71,9 @@ const grouped = computed(() => {
|
|
|
79
71
|
};
|
|
80
72
|
});
|
|
81
73
|
});
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
watch(activeId, (id) => {
|
|
75
|
+
const resultId = id.split("_____")[0];
|
|
76
|
+
if (resultId === props.resultId) {
|
|
84
77
|
isOpen.value = true;
|
|
85
78
|
}
|
|
86
79
|
});
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AnalyzeNodeMapped } from '../analyzers/types.js';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
resultId: string;
|
|
4
|
-
nodes:
|
|
4
|
+
nodes: AnalyzeNodeMapped[];
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
type __VLS_PublicProps = __VLS_Props & {
|
|
7
|
+
modelValue?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
"update:modelValue": (value: string) => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
12
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
14
|
export default _default;
|
|
@@ -16,29 +16,39 @@
|
|
|
16
16
|
|
|
17
17
|
<script setup>
|
|
18
18
|
import { Icon } from "#blokkli/components";
|
|
19
|
-
import {
|
|
19
|
+
import { computed, useBlokkli, useTemplateRef, watch } from "#imports";
|
|
20
20
|
import { renderCycle } from "#blokkli/helpers/renderCycle";
|
|
21
|
-
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
22
21
|
const props = defineProps({
|
|
23
22
|
resultId: { type: String, required: true },
|
|
24
|
-
target: { type:
|
|
23
|
+
target: { type: Object, required: true }
|
|
25
24
|
});
|
|
26
25
|
const { eventBus, dom, blocks, element } = useBlokkli();
|
|
26
|
+
const activeId = defineModel({ type: String, ...{ default: "" } });
|
|
27
|
+
const activeIndex = computed(() => {
|
|
28
|
+
const index = activeId.value.split("_____")[1];
|
|
29
|
+
if (index === void 0) {
|
|
30
|
+
return -1;
|
|
31
|
+
}
|
|
32
|
+
const indexNumber = Number.parseInt(index);
|
|
33
|
+
if (Number.isNaN(indexNumber)) {
|
|
34
|
+
return -1;
|
|
35
|
+
}
|
|
36
|
+
return indexNumber;
|
|
37
|
+
});
|
|
27
38
|
const elButton = useTemplateRef("elButton");
|
|
28
|
-
const isFocused =
|
|
29
|
-
let focusTimeout = null;
|
|
39
|
+
const isFocused = computed(() => activeIndex.value === props.target.globalIndex);
|
|
30
40
|
function getElement() {
|
|
31
|
-
if (props.target) {
|
|
32
|
-
if (typeof props.target === "string") {
|
|
41
|
+
if (props.target.target) {
|
|
42
|
+
if (typeof props.target.target === "string") {
|
|
33
43
|
return element.query(
|
|
34
44
|
document.documentElement,
|
|
35
|
-
props.target,
|
|
45
|
+
props.target.target,
|
|
36
46
|
"Find analyze result item node target."
|
|
37
47
|
);
|
|
38
|
-
} else if (props.target instanceof HTMLElement) {
|
|
39
|
-
return props.target;
|
|
40
|
-
} else if (typeof props.target === "object" && "uuid" in props.target) {
|
|
41
|
-
const item = blocks.getBlock(props.target.uuid);
|
|
48
|
+
} else if (props.target.target instanceof HTMLElement) {
|
|
49
|
+
return props.target.target;
|
|
50
|
+
} else if (typeof props.target.target === "object" && "uuid" in props.target.target) {
|
|
51
|
+
const item = blocks.getBlock(props.target.target.uuid);
|
|
42
52
|
if (item) {
|
|
43
53
|
return dom.getDragElement(item) ?? null;
|
|
44
54
|
}
|
|
@@ -50,22 +60,22 @@ function getElementLabel(tagName) {
|
|
|
50
60
|
return `<${tagName.toLowerCase()}>`;
|
|
51
61
|
}
|
|
52
62
|
function getLabel() {
|
|
53
|
-
if (props.target) {
|
|
54
|
-
if (typeof props.target === "string") {
|
|
55
|
-
return props.target;
|
|
56
|
-
} else if (props.target instanceof HTMLElement) {
|
|
57
|
-
if (props.target instanceof HTMLImageElement) {
|
|
58
|
-
if (props.target.alt) {
|
|
59
|
-
return props.target.alt.slice(0, 50);
|
|
63
|
+
if (props.target.target) {
|
|
64
|
+
if (typeof props.target.target === "string") {
|
|
65
|
+
return props.target.target;
|
|
66
|
+
} else if (props.target.target instanceof HTMLElement) {
|
|
67
|
+
if (props.target.target instanceof HTMLImageElement) {
|
|
68
|
+
if (props.target.target.alt) {
|
|
69
|
+
return props.target.target.alt.slice(0, 50);
|
|
60
70
|
}
|
|
61
71
|
}
|
|
62
|
-
const textContent = (props.target.textContent ?? "").slice(0, 50);
|
|
72
|
+
const textContent = (props.target.target.textContent ?? "").slice(0, 50);
|
|
63
73
|
if (textContent) {
|
|
64
74
|
return textContent;
|
|
65
75
|
}
|
|
66
|
-
return getElementLabel(props.target.tagName);
|
|
67
|
-
} else if (typeof props.target === "object" && "uuid" in props.target) {
|
|
68
|
-
return props.target.uuid;
|
|
76
|
+
return getElementLabel(props.target.target.tagName);
|
|
77
|
+
} else if (typeof props.target.target === "object" && "uuid" in props.target.target) {
|
|
78
|
+
return props.target.target.uuid;
|
|
69
79
|
}
|
|
70
80
|
}
|
|
71
81
|
}
|
|
@@ -79,6 +89,10 @@ function findClosestUuid(element2) {
|
|
|
79
89
|
}
|
|
80
90
|
}
|
|
81
91
|
async function onClick() {
|
|
92
|
+
if (activeIndex.value === props.target.globalIndex) {
|
|
93
|
+
activeId.value = "";
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
82
96
|
const element2 = getElement();
|
|
83
97
|
if (!element2) {
|
|
84
98
|
return;
|
|
@@ -93,25 +107,17 @@ async function onClick() {
|
|
|
93
107
|
eventBus.emit("scrollIntoView", {
|
|
94
108
|
element: element2
|
|
95
109
|
});
|
|
110
|
+
activeId.value = props.resultId + "_____" + props.target.globalIndex;
|
|
96
111
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
window.clearTimeout(focusTimeout);
|
|
112
|
+
watch(isFocused, (isFocused2) => {
|
|
113
|
+
if (!isFocused2) {
|
|
114
|
+
return;
|
|
101
115
|
}
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
block: "center"
|
|
108
|
-
});
|
|
109
|
-
isFocused.value = true;
|
|
110
|
-
focusTimeout = window.setTimeout(() => {
|
|
111
|
-
isFocused.value = false;
|
|
112
|
-
}, 1e3);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
116
|
+
if (elButton.value) {
|
|
117
|
+
elButton.value.scrollIntoView({
|
|
118
|
+
behavior: "smooth",
|
|
119
|
+
block: "nearest"
|
|
120
|
+
});
|
|
115
121
|
}
|
|
116
122
|
});
|
|
117
123
|
</script>
|