@abi-software/scaffoldvuer 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,360 +0,0 @@
1
- <template>
2
- <div class="help-mode-dialog" :class="{'finish': lastItem}">
3
- <h4>Help Mode</h4>
4
-
5
- <template v-if="lastItem">
6
- <p>
7
- All caught up! <br>
8
- Click 'Help' to restart.
9
- </p>
10
- <div>
11
- <el-button class="button" @click="finishHelpMode">
12
- Finish
13
- </el-button>
14
- </div>
15
- </template>
16
- <template v-else>
17
- <p>Click "Next" to see the next item.</p>
18
- <div>
19
- <el-button class="button" @click="showNext">
20
- Next
21
- </el-button>
22
- <el-button class="button secondary" @click="finishHelpMode">
23
- Exit Help Mode
24
- </el-button>
25
- </div>
26
- </template>
27
- </div>
28
- </template>
29
-
30
- <script>
31
- import {
32
- ElButton as Button,
33
- } from 'element-plus';
34
-
35
- export default {
36
- name: 'HelpModeDialog',
37
- components: {
38
- Button,
39
- },
40
- props: {
41
- multiflatmapRef: {
42
- type: Object,
43
- default: null,
44
- },
45
- flatmapRef: {
46
- type: Object,
47
- default: null,
48
- },
49
- scaffoldRef: {
50
- type: Object,
51
- default: null,
52
- },
53
- lastItem: {
54
- type: Boolean,
55
- default: false,
56
- required: false,
57
- }
58
- },
59
- mounted: function () {
60
- this.toggleHelpModeHighlight(true);
61
- // For tooltips outside of Flatmap
62
- this.toggleTooltipHighlight();
63
- },
64
- unmounted: function () {
65
- this.toggleHelpModeHighlight(false);
66
- },
67
- watch: {
68
- lastItem: function (isLastItem) {
69
- if (isLastItem) {
70
- this.toggleTooltipHighlight();
71
- }
72
- }
73
- },
74
- methods: {
75
- showNext: function () {
76
- this.$emit('show-next');
77
- },
78
- finishHelpMode: function () {
79
- this.$emit('finish-help-mode');
80
- },
81
- /**
82
- * This function must be called on 'shown-map-tooltip' event.
83
- */
84
- toggleTooltipPinHighlight: function () {
85
- const currentFlatmapEl = this.getCurrentFlatmap();
86
- this.resetHighlightedItems();
87
-
88
- this.$nextTick(() => {
89
- // Temporary solution to find the position of map marker from popover
90
- const mapPins = currentFlatmapEl.querySelectorAll('.maplibregl-marker');
91
- const mapPinPopover = currentFlatmapEl.querySelector('.flatmap-popup-popper');
92
- const styleVal = mapPinPopover?.style?.transform || '';
93
- const mapPopoverPosition = this.extractMarkerPosition(styleVal);
94
-
95
- mapPins.forEach((mapPin) => {
96
- const mapPinStyleVal = mapPin.style.transform;
97
- const mapPinPosition = this.extractMarkerPosition(mapPinStyleVal);
98
-
99
- if (mapPinPosition === mapPopoverPosition) {
100
- mapPin.classList.add('in-help-highlight');
101
- }
102
- });
103
- });
104
- },
105
- /**
106
- * This function must be called on 'shown-tooltip' event.
107
- */
108
- toggleTooltipHighlight: function () {
109
- this.resetHighlightedItems();
110
-
111
- this.$nextTick(() => {
112
- const activePoppers = document.querySelectorAll('.el-popper:not([style*="none"])');
113
-
114
- activePoppers.forEach((activePopper) => {
115
- const multiFlatmapTooltip = activePopper.classList.contains('flatmap-popper');
116
- const flatmapTooltip = activePopper.classList.contains('el-fade-in-linear-enter-active');
117
-
118
- if (multiFlatmapTooltip || flatmapTooltip) {
119
- this.toggleHighlight(activePopper);
120
- }
121
- });
122
- });
123
- },
124
- toggleHighlight: function (activePopper) {
125
- const popperId = activePopper?.id || '';
126
- const popperTrigger = document.querySelector(`[aria-describedby="${popperId}"]`);
127
-
128
- if (popperTrigger) {
129
- popperTrigger.classList.add('in-help-highlight');
130
- }
131
- },
132
- resetHighlightedItems: function () {
133
- const allHighlightedItems = document.querySelectorAll('.in-help-highlight');
134
- allHighlightedItems.forEach((el) => {
135
- el.classList.remove('in-help-highlight');
136
- });
137
- },
138
- getCurrentScaffold: function () {
139
- const scaffoldEl = this.scaffoldRef?.$el || null;
140
- return scaffoldEl;
141
- },
142
- getCurrentMultiflatmap: function () {
143
- const multiflatmapEl = this.multiflatmapRef?.$el || null;
144
- return multiflatmapEl;
145
- },
146
- getCurrentFlatmap: function () {
147
- const flatmap = this.flatmapRef || this.multiflatmapRef?.getCurrentFlatmap();
148
- const flatmapEl = flatmap?.$el || null;
149
- return flatmapEl;
150
- },
151
- toggleHelpModeHighlight: function (option) {
152
- const currentMultiflatmapEl = this.getCurrentMultiflatmap();
153
- const currentFlatmapEl = this.getCurrentFlatmap();
154
- const currentScaffoldEl = this.getCurrentScaffold();
155
- const allHighlightedItems = document.querySelectorAll('.in-help-highlight');
156
-
157
- if (currentMultiflatmapEl) {
158
- if (option) {
159
- currentMultiflatmapEl.classList.add('in-help');
160
- } else {
161
- currentMultiflatmapEl.classList.remove('in-help');
162
- }
163
- }
164
-
165
- if (currentFlatmapEl) {
166
- if (option) {
167
- currentFlatmapEl.classList.add('in-help');
168
- } else {
169
- currentFlatmapEl.classList.remove('in-help');
170
- }
171
- }
172
-
173
- if (currentScaffoldEl) {
174
- if (option) {
175
- currentScaffoldEl.classList.add('in-help');
176
- } else {
177
- currentScaffoldEl.classList.remove('in-help');
178
- }
179
- }
180
-
181
- if (!option) {
182
- allHighlightedItems.forEach((el) => {
183
- el.classList.remove('in-help-highlight');
184
- });
185
- }
186
- },
187
- /**
188
- * Temporary solution to find the position of map marker from popover
189
- */
190
- extractMarkerPosition: function (str) {
191
- const translateRegex = /translate\((.*?)\)/g;
192
- const matches = str.match(translateRegex);
193
- if (!matches) {
194
- return '';
195
- }
196
- const lastMatch = matches[matches.length - 1];
197
- const values = lastMatch.slice(10, -1);
198
- return values;
199
- },
200
- }
201
- }
202
- </script>
203
-
204
- <style lang="scss" scoped>
205
- .help-mode-dialog {
206
- display: flex;
207
- flex-direction: column;
208
- align-items: center;
209
- justify-content: center;
210
- gap: 1rem;
211
- width: 300px;
212
- padding: 1rem;
213
- font-family: inherit;
214
- font-size: 14px;
215
- background: white;
216
- border-radius: 4px 4px;
217
- border: 1px solid $app-primary-color;
218
- box-shadow: 0px 0px 160px 80px rgba(0,0,0,0.5);
219
- position: absolute;
220
- top: 0;
221
- left: 50%;
222
- transform: translateX(-50%);
223
- z-index: 2;
224
-
225
- &.finish {
226
- animation: shake 0.35s;
227
- animation-delay: 0.7s;
228
- }
229
-
230
- h4 {
231
- color: $app-primary-color;
232
- }
233
-
234
- h4, p {
235
- margin: 0;
236
- }
237
-
238
- p {
239
- line-height: 1.5;
240
- }
241
-
242
- .button {
243
- color: #fff;
244
- background-color: $app-primary-color;
245
- transform: scale(1);
246
- transform-origin: 50% 50%;
247
- transition: all var(--el-transition-duration);
248
-
249
- &:hover {
250
- color: #fff !important;
251
- background: #ac76c5 !important;
252
- border: 1px solid #ac76c5 !important;
253
- }
254
-
255
- &:active {
256
- transform: scale(0.95);
257
- }
258
-
259
- &.secondary {
260
- background: #f3e6f9;
261
- border-color: $app-primary-color;
262
- color: $app-primary-color;
263
-
264
- &:hover {
265
- color: $app-primary-color !important;
266
- background: #fff !important;
267
- }
268
- }
269
- }
270
- }
271
-
272
- @keyframes shake {
273
- 0% {
274
- transform: translateX(-50%) rotate(2deg);
275
- }
276
- 25% {
277
- transform: translateX(-50%) rotate(-2deg);
278
- }
279
- 50% {
280
- transform: translateX(-50%) rotate(2deg);
281
- }
282
- 75% {
283
- transform: translateX(-50%) rotate(-2deg);
284
- }
285
- 100% {
286
- transform: translateX(-50%) rotate(2deg);
287
- }
288
- }
289
-
290
- // Just for App.vue with options popover on top
291
- .help-mode-dialog {
292
- .options-popover + .multi-container + & {
293
- margin-top: 40px;
294
- }
295
- .options-popover:not([style*="display: none"]) + .multi-container + & {
296
- margin-top: 175px;
297
- }
298
- }
299
- </style>
300
-
301
- <style lang="scss">
302
- .scaffold-container.in-help,
303
- .flatmap-container.in-help {
304
- background: rgba(0,0,0,0.3);
305
- }
306
-
307
- .scaffold-container.in-help {
308
- canvas {
309
- opacity: 0.3;
310
- }
311
- }
312
-
313
- .scaffold-container.in-help,
314
- .flatmap-container.in-help {
315
- .el-tooltip__trigger,
316
- .el-popover {
317
- opacity: 0.3;
318
- }
319
-
320
- .pathway-location:has(.in-help-highlight) {
321
- opacity: 1;
322
-
323
- .pathway-container {
324
- background: transparent;
325
- }
326
-
327
- .container,
328
- .legends-container,
329
- .selections-container {
330
- opacity: 0.3;
331
- }
332
- }
333
-
334
- .maplibregl-canvas,
335
- .maplibregl-ctrl-minimap {
336
- opacity: 0.3;
337
- }
338
-
339
- .maplibregl-map,
340
- .maplibregl-canvas {
341
- pointer-events: none;
342
- }
343
- }
344
-
345
- .in-help .el-popper:not([style*="none"]) {
346
- opacity: 1 !important;
347
- }
348
-
349
- .in-help-highlight {
350
- opacity: 1 !important;
351
- background: white !important;
352
- box-shadow: 0px 0px 128px 128px white !important;
353
- animation: highlight-area 0.1s;
354
-
355
- &.maplibregl-marker {
356
- background: none !important;
357
- box-shadow: 0px 0px 128px 128px rgba(255,255,255,0.5) !important;
358
- }
359
- }
360
- </style>