@fc3/mmcadi 0.1.49 → 0.1.51
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/.last-compile-time +1 -1
- package/dist/.last-publish-time +1 -1
- package/dist/client.js +503 -84
- package/dist/src/client/helper/drag.d.ts +29 -0
- package/dist/src/client/helper/drag.js +350 -0
- package/dist/src/client/helper/drag.js.map +1 -0
- package/dist/src/client/helper/interaction.d.ts +30 -0
- package/dist/src/client/helper/interaction.js +385 -0
- package/dist/src/client/helper/interaction.js.map +1 -0
- package/dist/src/client/page/cursor.d.ts +3 -0
- package/dist/src/client/page/cursor.js +52 -33
- package/dist/src/client/page/cursor.js.map +1 -1
- package/dist/src/client/utility/get-index-path-for-element.d.ts +2 -0
- package/dist/src/client/utility/get-index-path-for-element.js +12 -0
- package/dist/src/client/utility/get-index-path-for-element.js.map +1 -0
- package/dist/src/common/utility/role-is-public.d.ts +3 -0
- package/dist/src/common/utility/role-is-public.js +13 -0
- package/dist/src/common/utility/role-is-public.js.map +1 -0
- package/dist/src/enum/action-type.d.ts +1 -0
- package/dist/src/enum/action-type.js +1 -0
- package/dist/src/enum/action-type.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +3 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/server/endpoint/action/create.d.ts +1 -0
- package/dist/src/server/endpoint/action/create.js +20 -1
- package/dist/src/server/endpoint/action/create.js.map +1 -1
- package/dist/src/server/operation/reposition-block.d.ts +15 -0
- package/dist/src/server/operation/reposition-block.js +108 -0
- package/dist/src/server/operation/reposition-block.js.map +1 -0
- package/dist/src/server/serializer/base.js +23 -13
- package/dist/src/server/serializer/base.js.map +1 -1
- package/dist/src/server/serializer/block/audio.js +1 -1
- package/dist/src/server/serializer/block.js +24 -20
- package/dist/src/server/serializer/block.js.map +1 -1
- package/dist/src/type/action/reposition-block.d.ts +8 -0
- package/dist/src/type/action/reposition-block.js +3 -0
- package/dist/src/type/action/reposition-block.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const time_1 = require("@fc3/time");
|
|
7
|
+
const errors_1 = require("@fc3/errors");
|
|
8
|
+
const action_type_1 = __importDefault(require("./../../enum/action-type.js"));
|
|
9
|
+
const get_index_path_for_element_1 = __importDefault(require("./../utility/get-index-path-for-element.js"));
|
|
10
|
+
class InteractionHelper {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.drag_start_coordinate = null;
|
|
13
|
+
this.drag_delay_timer = null;
|
|
14
|
+
}
|
|
15
|
+
attach() {
|
|
16
|
+
document.addEventListener('pointerdown', (event) => {
|
|
17
|
+
this.handlePointerDown(event);
|
|
18
|
+
}, { capture: true });
|
|
19
|
+
document.addEventListener('pointermove', (event) => {
|
|
20
|
+
this.handlePointerMove(event);
|
|
21
|
+
}, { capture: true, passive: false });
|
|
22
|
+
document.addEventListener('pointerup', (event) => {
|
|
23
|
+
this.handlePointerUp(event);
|
|
24
|
+
}, { capture: true });
|
|
25
|
+
document.addEventListener('pointercancel', (event) => {
|
|
26
|
+
this.handlePointerCancel(event);
|
|
27
|
+
}, { capture: true });
|
|
28
|
+
document.addEventListener('dragstart', (event) => {
|
|
29
|
+
this.handleNativeDragStart(event);
|
|
30
|
+
}, { capture: true });
|
|
31
|
+
}
|
|
32
|
+
isDragging() {
|
|
33
|
+
const elements = Array.from(document.querySelectorAll('.dragging'));
|
|
34
|
+
return elements.length > 0;
|
|
35
|
+
}
|
|
36
|
+
handlePointerDown(event) {
|
|
37
|
+
const { target } = event;
|
|
38
|
+
if (target === null) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const target_element = target;
|
|
42
|
+
let current_element = target_element;
|
|
43
|
+
while (current_element) {
|
|
44
|
+
const attribute = current_element.getAttribute('data-role');
|
|
45
|
+
if (attribute === 'block_activation') {
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
// Tricky. Bail out early if we detect an anchor element in the event
|
|
49
|
+
// ancestry that is NOT an all-block-encompassing link (eg, a folder block).
|
|
50
|
+
if (current_element instanceof HTMLAnchorElement) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
current_element = current_element.parentNode;
|
|
54
|
+
if (!(current_element instanceof HTMLElement)) {
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const block = target_element.closest('section.block');
|
|
59
|
+
if (block === null) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (target_element.closest('button, input, textarea, select, label, form')) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const coordinate = this.getEventCoordinate(event);
|
|
66
|
+
if (coordinate === null) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
this.drag_start_coordinate = coordinate;
|
|
70
|
+
block.classList.add('drag-candidate');
|
|
71
|
+
this.scheduleDelayedDrag();
|
|
72
|
+
}
|
|
73
|
+
scheduleDelayedDrag() {
|
|
74
|
+
this.cancelDelayedDrag();
|
|
75
|
+
const delay = time_1.TimeInterval.ONE_SECOND;
|
|
76
|
+
this.drag_delay_timer = setTimeout(this.beginDelayedDrag.bind(this), delay);
|
|
77
|
+
}
|
|
78
|
+
cancelDelayedDrag() {
|
|
79
|
+
if (this.drag_delay_timer !== null) {
|
|
80
|
+
clearTimeout(this.drag_delay_timer);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
removeClassFromAllElements(class_name) {
|
|
84
|
+
const raw_elements = document.querySelectorAll(`.${class_name}`);
|
|
85
|
+
const elements = Array.from(raw_elements);
|
|
86
|
+
elements.forEach((element) => {
|
|
87
|
+
element.classList.remove(class_name);
|
|
88
|
+
});
|
|
89
|
+
return elements;
|
|
90
|
+
}
|
|
91
|
+
beginDelayedDrag() {
|
|
92
|
+
const raw_candidates = document.querySelectorAll('.drag-candidate');
|
|
93
|
+
const candidates = Array.from(raw_candidates);
|
|
94
|
+
candidates.forEach((candidate) => {
|
|
95
|
+
const ghost = candidate.cloneNode(true);
|
|
96
|
+
const index_path = (0, get_index_path_for_element_1.default)(candidate);
|
|
97
|
+
ghost.classList.add('ghost');
|
|
98
|
+
ghost.setAttribute('data-for', index_path);
|
|
99
|
+
candidate.classList.remove('drag-candidate');
|
|
100
|
+
const { parentNode } = candidate;
|
|
101
|
+
if (parentNode === null) {
|
|
102
|
+
throw new errors_1.InvariantViolation(`
|
|
103
|
+
Expected drag candidate to be located in a parent, but it was null
|
|
104
|
+
`);
|
|
105
|
+
}
|
|
106
|
+
const rect = candidate.getBoundingClientRect();
|
|
107
|
+
Object.assign(candidate.style, {
|
|
108
|
+
top: `${rect.top}px`,
|
|
109
|
+
left: `${rect.left}px`,
|
|
110
|
+
width: `${rect.width}px`,
|
|
111
|
+
height: `${rect.height}px`
|
|
112
|
+
});
|
|
113
|
+
candidate.setAttribute('data-drag-start-x', rect.left.toString());
|
|
114
|
+
candidate.setAttribute('data-drag-start-y', rect.top.toString());
|
|
115
|
+
candidate.classList.add('dragging');
|
|
116
|
+
parentNode.insertBefore(ghost, candidate);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
handleNativeDragStart(event) {
|
|
120
|
+
const target = event.target;
|
|
121
|
+
if (!target) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const closest_block = target.closest('section.block');
|
|
125
|
+
if (closest_block !== null) {
|
|
126
|
+
event.preventDefault();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
handlePointerMove(event) {
|
|
130
|
+
const current_coordinate = this.getEventCoordinate(event);
|
|
131
|
+
const start_coordinate = this.getDragStartCoordinate();
|
|
132
|
+
if (start_coordinate === null || current_coordinate === null) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const { target } = event;
|
|
136
|
+
if (target !== null) {
|
|
137
|
+
const target_element = target;
|
|
138
|
+
const block = target_element.closest('section.block');
|
|
139
|
+
if (block) {
|
|
140
|
+
if (!block.classList.contains('dragging')) {
|
|
141
|
+
block.classList.add('drag-candidate');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const { x: start_x, y: start_y } = start_coordinate;
|
|
146
|
+
const { x: current_x, y: current_y } = current_coordinate;
|
|
147
|
+
const distance = Math.hypot(current_x - start_x, current_y - start_y);
|
|
148
|
+
if (distance > 25) {
|
|
149
|
+
this.removeClassFromAllElements('drag-candidate');
|
|
150
|
+
}
|
|
151
|
+
this.scheduleDelayedDrag();
|
|
152
|
+
const raw_targets = document.querySelectorAll('.dragging');
|
|
153
|
+
const drag_target_blocks = Array.from(raw_targets);
|
|
154
|
+
drag_target_blocks.forEach((target_block) => {
|
|
155
|
+
this.translateDragTargetBlock(target_block, current_coordinate);
|
|
156
|
+
});
|
|
157
|
+
if (drag_target_blocks.length > 0) {
|
|
158
|
+
event.preventDefault();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
translateDragTargetBlock(block, current_coordinate) {
|
|
162
|
+
const x_attribute = block.getAttribute('data-drag-start-x');
|
|
163
|
+
const y_attribute = block.getAttribute('data-drag-start-y');
|
|
164
|
+
if (x_attribute === null || y_attribute === null) {
|
|
165
|
+
throw new errors_1.InvariantViolation(`
|
|
166
|
+
Drag coordinate attributes were invalid:
|
|
167
|
+
x: ${x_attribute}
|
|
168
|
+
y: ${y_attribute}
|
|
169
|
+
`);
|
|
170
|
+
}
|
|
171
|
+
const parsed_x = parseInt(x_attribute);
|
|
172
|
+
const parsed_y = parseInt(y_attribute);
|
|
173
|
+
if (isNaN(parsed_x) || isNaN(parsed_y)) {
|
|
174
|
+
throw new errors_1.InvariantViolation(`
|
|
175
|
+
Drag coordinate attributes were invalid:
|
|
176
|
+
x: ${x_attribute}
|
|
177
|
+
y: ${y_attribute}
|
|
178
|
+
`);
|
|
179
|
+
}
|
|
180
|
+
const start_coordinate = this.getDragStartCoordinate();
|
|
181
|
+
if (start_coordinate === null) {
|
|
182
|
+
throw new errors_1.InvariantViolation(`
|
|
183
|
+
Tried to translate drag target, but drag start coordinate was null
|
|
184
|
+
`);
|
|
185
|
+
}
|
|
186
|
+
const { x: start_x, y: start_y } = start_coordinate;
|
|
187
|
+
const { x: current_x, y: current_y } = current_coordinate;
|
|
188
|
+
const x_delta = current_x - start_x;
|
|
189
|
+
const y_delta = current_y - start_y;
|
|
190
|
+
const new_x = parsed_x + x_delta;
|
|
191
|
+
const new_y = parsed_y + y_delta;
|
|
192
|
+
block.style.left = `${new_x}px`;
|
|
193
|
+
block.style.top = `${new_y}px`;
|
|
194
|
+
const block_rect = block.getBoundingClientRect();
|
|
195
|
+
const previous_block = this.getPreviousBlock(block);
|
|
196
|
+
const next_block = this.getNextBlock(block);
|
|
197
|
+
const ghost = this.getGhostForBlock(block);
|
|
198
|
+
let swapped = false;
|
|
199
|
+
if (previous_block !== null) {
|
|
200
|
+
const previous_rect = previous_block.getBoundingClientRect();
|
|
201
|
+
const previous_block_y_threshold = previous_rect.top + (previous_rect.height * 0.4);
|
|
202
|
+
if (block_rect.top < previous_block_y_threshold) {
|
|
203
|
+
swapped = true;
|
|
204
|
+
const next_sibling = ghost.nextElementSibling;
|
|
205
|
+
previous_block.replaceWith(ghost);
|
|
206
|
+
if (next_sibling) {
|
|
207
|
+
next_sibling.before(previous_block);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (next_block !== null && swapped === false) {
|
|
212
|
+
const next_rect = next_block.getBoundingClientRect();
|
|
213
|
+
const next_block_y_threshold = next_rect.top + (next_rect.height * 0.6);
|
|
214
|
+
if (block_rect.bottom > next_block_y_threshold) {
|
|
215
|
+
const next_sibling = ghost.nextElementSibling === next_block ? ghost : ghost.nextElementSibling;
|
|
216
|
+
next_block.replaceWith(ghost);
|
|
217
|
+
if (next_sibling) {
|
|
218
|
+
next_sibling.before(next_block);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
getGhostForBlock(block) {
|
|
224
|
+
const index_path = (0, get_index_path_for_element_1.default)(block);
|
|
225
|
+
const ghost = document.querySelector(`[data-for="${index_path}"]`);
|
|
226
|
+
if (ghost === null) {
|
|
227
|
+
throw new errors_1.InvariantViolation(`
|
|
228
|
+
Unable to find ghost for block with index path ${index_path}
|
|
229
|
+
`);
|
|
230
|
+
}
|
|
231
|
+
return ghost;
|
|
232
|
+
}
|
|
233
|
+
getPreviousBlock(block) {
|
|
234
|
+
const parent_node = block.parentNode;
|
|
235
|
+
const siblings = Array.from(parent_node.children);
|
|
236
|
+
const ghost = this.getGhostForBlock(block);
|
|
237
|
+
let index = siblings.indexOf(ghost);
|
|
238
|
+
if (index === -1) {
|
|
239
|
+
throw new errors_1.InvariantViolation('Unable to locate ghost within siblings');
|
|
240
|
+
}
|
|
241
|
+
while (index--) {
|
|
242
|
+
const sibling = siblings[index];
|
|
243
|
+
if (sibling === block) {
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
const { classList } = sibling;
|
|
247
|
+
if (!classList.contains('block')) {
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
if (classList.contains('ghost')) {
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
return sibling;
|
|
254
|
+
}
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
getNextBlock(block) {
|
|
258
|
+
const parent_node = block.parentNode;
|
|
259
|
+
const siblings = Array.from(parent_node.children);
|
|
260
|
+
const ghost = this.getGhostForBlock(block);
|
|
261
|
+
let index = siblings.indexOf(ghost);
|
|
262
|
+
if (index === -1) {
|
|
263
|
+
throw new errors_1.InvariantViolation('Unable to locate ghost within siblings');
|
|
264
|
+
}
|
|
265
|
+
while (index < siblings.length) {
|
|
266
|
+
index++;
|
|
267
|
+
const sibling = siblings[index];
|
|
268
|
+
if (sibling === block) {
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
const { classList } = sibling;
|
|
272
|
+
if (!classList.contains('block')) {
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
if (classList.contains('ghost')) {
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
return sibling;
|
|
279
|
+
}
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
handlePointerUp(event) {
|
|
283
|
+
this.stopDragging();
|
|
284
|
+
}
|
|
285
|
+
handlePointerCancel(event) {
|
|
286
|
+
this.stopDragging();
|
|
287
|
+
}
|
|
288
|
+
stopDragging() {
|
|
289
|
+
this.showFullscreenBlockingOverlay();
|
|
290
|
+
this.stopDraggingAsync().then(() => {
|
|
291
|
+
this.hideFullscreenBlockingOverlay();
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
showFullscreenBlockingOverlay() {
|
|
295
|
+
}
|
|
296
|
+
hideFullscreenBlockingOverlay() {
|
|
297
|
+
}
|
|
298
|
+
async stopDraggingAsync() {
|
|
299
|
+
this.cancelDelayedDrag();
|
|
300
|
+
this.removeClassFromAllElements('drag-candidate');
|
|
301
|
+
const dragging_elements = this.removeClassFromAllElements('dragging');
|
|
302
|
+
let index = 0;
|
|
303
|
+
while (index < dragging_elements.length) {
|
|
304
|
+
const element = dragging_elements[index++];
|
|
305
|
+
const ghost = this.getGhostForBlock(element);
|
|
306
|
+
const source_index_path = (0, get_index_path_for_element_1.default)(element);
|
|
307
|
+
const target_index_path = this.getIndexPathForGhost(ghost);
|
|
308
|
+
await this.submitReposition(source_index_path, target_index_path);
|
|
309
|
+
ghost.replaceWith(element);
|
|
310
|
+
Object.assign(element.style, {
|
|
311
|
+
left: '',
|
|
312
|
+
top: '',
|
|
313
|
+
right: '',
|
|
314
|
+
bottom: '',
|
|
315
|
+
width: '',
|
|
316
|
+
height: ''
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
getIndexPathSafe(element) {
|
|
321
|
+
const is_block = element.classList.contains('block');
|
|
322
|
+
if (!is_block) {
|
|
323
|
+
return null;
|
|
324
|
+
}
|
|
325
|
+
const is_ghost = element.classList.contains('ghost');
|
|
326
|
+
if (is_ghost) {
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
return (0, get_index_path_for_element_1.default)(element);
|
|
330
|
+
}
|
|
331
|
+
getIndexPathForGhost(ghost) {
|
|
332
|
+
let current_child = ghost;
|
|
333
|
+
while (current_child) {
|
|
334
|
+
const index_path = this.getIndexPathSafe(current_child);
|
|
335
|
+
if (index_path !== null) {
|
|
336
|
+
return index_path;
|
|
337
|
+
}
|
|
338
|
+
current_child = current_child.nextElementSibling;
|
|
339
|
+
}
|
|
340
|
+
current_child = ghost;
|
|
341
|
+
while (current_child) {
|
|
342
|
+
const index_path = this.getIndexPathSafe(current_child);
|
|
343
|
+
if (index_path !== null) {
|
|
344
|
+
// TODO: This will need to change when I implement drag-reordering of
|
|
345
|
+
// multicolumn layouts.
|
|
346
|
+
const index_major_version = parseInt(index_path);
|
|
347
|
+
const next_version = index_major_version + 1;
|
|
348
|
+
return next_version.toString();
|
|
349
|
+
}
|
|
350
|
+
current_child = current_child.previousElementSibling;
|
|
351
|
+
}
|
|
352
|
+
return '0';
|
|
353
|
+
}
|
|
354
|
+
async submitReposition(source_index_path, target_index_path) {
|
|
355
|
+
const form = new FormData();
|
|
356
|
+
form.set('path', window.location.pathname);
|
|
357
|
+
form.set('action_type', action_type_1.default.REPOSITION_BLOCK);
|
|
358
|
+
form.set('source_index_path', source_index_path);
|
|
359
|
+
form.set('target_index_path', target_index_path);
|
|
360
|
+
const response = await fetch(`/actions`, {
|
|
361
|
+
method: 'POST',
|
|
362
|
+
body: form,
|
|
363
|
+
credentials: 'same-origin',
|
|
364
|
+
redirect: 'follow'
|
|
365
|
+
});
|
|
366
|
+
try {
|
|
367
|
+
const url_object = new URL(response.url, window.location.origin);
|
|
368
|
+
return url_object.searchParams.get('index_path');
|
|
369
|
+
}
|
|
370
|
+
catch (_) {
|
|
371
|
+
return null;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
getEventCoordinate(event) {
|
|
375
|
+
return {
|
|
376
|
+
x: event.clientX,
|
|
377
|
+
y: event.clientY
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
getDragStartCoordinate() {
|
|
381
|
+
return this.drag_start_coordinate;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
exports.default = InteractionHelper;
|
|
385
|
+
//# sourceMappingURL=interaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction.js","sourceRoot":"","sources":["../../../../src/client/helper/interaction.ts"],"names":[],"mappings":";;;;;AAAA,oCAAuC;AACvC,wCAA+C;AAE/C,mEAA0C;AAC1C,2GAA+E;AAO/E,MAAM,iBAAiB;IAItB;QACC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAClC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC9B,CAAC;IAEM,MAAM;QACZ,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE;YAClD,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAEtB,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE;YAClD,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAC,CAAC,CAAC;QAErC,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE;YAChD,IAAI,CAAC,eAAe,CAAC,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QAAQ,CAAC,MAAM,CAAC,CAAC;YAEjE,OAAO,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACZ,OAAO,IAAI,CAAC;QACb,CAAC;IACF,CAAC;IAEO,kBAAkB,CAAC,KAAmB;QAC7C,OAAO;YACN,CAAC,EAAE,KAAK,CAAC,OAAO;YAChB,CAAC,EAAE,KAAK,CAAC,OAAO;SAChB,CAAC;IACH,CAAC;IAEO,sBAAsB;QAC7B,OAAO,IAAI,CAAC,qBAAqB,CAAC;IACnC,CAAC;CACD;AAED,kBAAe,iBAAiB,CAAC"}
|
|
@@ -4,6 +4,7 @@ declare abstract class CursorPage extends Page {
|
|
|
4
4
|
private logged_in;
|
|
5
5
|
private queued_media;
|
|
6
6
|
private ready_media;
|
|
7
|
+
private interaction_helper;
|
|
7
8
|
constructor();
|
|
8
9
|
protected initView(): void;
|
|
9
10
|
protected initEvents(): void;
|
|
@@ -33,6 +34,7 @@ declare abstract class CursorPage extends Page {
|
|
|
33
34
|
protected getLastBlockIndex(): string | null;
|
|
34
35
|
protected getNextBlockIndex(): string | null;
|
|
35
36
|
protected getPreviousBlockIndex(): string | null;
|
|
37
|
+
private activateCurrentBlock;
|
|
36
38
|
private activateBlock;
|
|
37
39
|
private activateTodoBlock;
|
|
38
40
|
private activateFolderBlock;
|
|
@@ -46,6 +48,7 @@ declare abstract class CursorPage extends Page {
|
|
|
46
48
|
private hasActiveMedia;
|
|
47
49
|
private getActiveMedia;
|
|
48
50
|
private pauseActiveMedia;
|
|
51
|
+
private getInteractionHelper;
|
|
49
52
|
protected isLoggedIn(): boolean;
|
|
50
53
|
protected abstract deleteBlockElement(block_element: Element): void;
|
|
51
54
|
}
|
|
@@ -13,29 +13,25 @@ const get_meta_value_1 = __importDefault(require("./../utility/get-meta-value.js
|
|
|
13
13
|
const get_parent_path_1 = __importDefault(require("./../../common/utility/get-parent-path.js"));
|
|
14
14
|
const get_block_activation_href_1 = __importDefault(require("./../utility/get-block-activation-href.js"));
|
|
15
15
|
const media_ready_state_1 = __importDefault(require("./../enum/media-ready-state.js"));
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
throw new errors_1.InvariantViolation(`
|
|
20
|
-
Tried to read ${attribute} for element, but it was not set
|
|
21
|
-
`);
|
|
22
|
-
}
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
function getIndexPathForElement(element) {
|
|
26
|
-
return getAttributeForElement(element, 'data-index-path');
|
|
27
|
-
}
|
|
16
|
+
const interaction_1 = __importDefault(require("./../helper/interaction.js"));
|
|
17
|
+
const get_index_path_for_element_1 = __importDefault(require("./../utility/get-index-path-for-element.js"));
|
|
18
|
+
// getIndexPathForElement moved to shared utility
|
|
28
19
|
class CursorPage extends page_1.default {
|
|
29
20
|
constructor() {
|
|
30
21
|
super();
|
|
31
22
|
this.logged_in = false;
|
|
32
23
|
this.queued_media = null;
|
|
33
24
|
this.ready_media = [];
|
|
25
|
+
this.interaction_helper = new interaction_1.default();
|
|
34
26
|
}
|
|
35
27
|
initView() {
|
|
36
28
|
this.focusCurrentBlockElement();
|
|
37
29
|
const meta_value = (0, get_meta_value_1.default)('logged_in');
|
|
38
30
|
this.logged_in = meta_value === 'true';
|
|
31
|
+
if (this.isLoggedIn()) {
|
|
32
|
+
const interaction_helper = this.getInteractionHelper();
|
|
33
|
+
interaction_helper.attach();
|
|
34
|
+
}
|
|
39
35
|
}
|
|
40
36
|
initEvents() {
|
|
41
37
|
super.initEvents();
|
|
@@ -53,7 +49,8 @@ class CursorPage extends page_1.default {
|
|
|
53
49
|
});
|
|
54
50
|
}
|
|
55
51
|
handleGenericClick(event) {
|
|
56
|
-
|
|
52
|
+
const interaction_helper = this.getInteractionHelper();
|
|
53
|
+
if (interaction_helper.isDragging()) {
|
|
57
54
|
return;
|
|
58
55
|
}
|
|
59
56
|
if (event.defaultPrevented) {
|
|
@@ -73,17 +70,34 @@ class CursorPage extends page_1.default {
|
|
|
73
70
|
return;
|
|
74
71
|
}
|
|
75
72
|
const target = event.target;
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
const selector = '[data-role="block_activation"]';
|
|
74
|
+
const activator = (() => {
|
|
75
|
+
if (target.matches(selector)) {
|
|
76
|
+
return target;
|
|
77
|
+
}
|
|
78
|
+
return target.querySelector(selector) || target.closest(selector);
|
|
79
|
+
})();
|
|
80
|
+
if (activator !== null) {
|
|
81
|
+
const block = activator.closest('section.block');
|
|
82
|
+
if (block === null) {
|
|
83
|
+
throw new errors_1.InvariantViolation(`
|
|
84
|
+
Unable to handle activator; no wrapping block was found
|
|
85
|
+
`);
|
|
86
|
+
}
|
|
87
|
+
return this.activateBlock(block);
|
|
79
88
|
}
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
89
|
+
const anchor = target.closest('a[href]');
|
|
90
|
+
// If the user clicked on a local link and the persistent media is playing,
|
|
91
|
+
// we want to only simulate navigation using the history API rather
|
|
92
|
+
// than allowing the event to go through.
|
|
93
|
+
if (anchor !== null && this.hasActiveMedia()) {
|
|
94
|
+
const url = new URL(anchor.href, window.location.href);
|
|
95
|
+
if (url.origin === window.location.origin) {
|
|
96
|
+
const path = url.pathname + url.search + url.hash;
|
|
97
|
+
this.navigateToPath(path);
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
}
|
|
83
100
|
}
|
|
84
|
-
event.preventDefault();
|
|
85
|
-
const path = url.pathname + url.search + url.hash;
|
|
86
|
-
this.navigateToPath(path);
|
|
87
101
|
}
|
|
88
102
|
navigateToPath(path) {
|
|
89
103
|
if (!this.hasActiveMedia()) {
|
|
@@ -139,7 +153,7 @@ class CursorPage extends page_1.default {
|
|
|
139
153
|
switch (key_code) {
|
|
140
154
|
case key_code_1.default.ENTER:
|
|
141
155
|
case key_code_1.default.O:
|
|
142
|
-
return this.
|
|
156
|
+
return this.activateCurrentBlock();
|
|
143
157
|
case key_code_1.default.G:
|
|
144
158
|
return this.performPageJump();
|
|
145
159
|
case key_code_1.default.J:
|
|
@@ -262,7 +276,7 @@ class CursorPage extends page_1.default {
|
|
|
262
276
|
const block_elements = this.getBlockElements();
|
|
263
277
|
let found = false;
|
|
264
278
|
block_elements.forEach((block_element) => {
|
|
265
|
-
const sibling_path =
|
|
279
|
+
const sibling_path = (0, get_index_path_for_element_1.default)(block_element);
|
|
266
280
|
const is_match = sibling_path === index_path;
|
|
267
281
|
block_element.classList.toggle('selected', is_match);
|
|
268
282
|
if (is_match) {
|
|
@@ -314,7 +328,7 @@ class CursorPage extends page_1.default {
|
|
|
314
328
|
if (element === null) {
|
|
315
329
|
return '0';
|
|
316
330
|
}
|
|
317
|
-
return
|
|
331
|
+
return (0, get_index_path_for_element_1.default)(element);
|
|
318
332
|
}
|
|
319
333
|
getCurrentBlockNumericIndex() {
|
|
320
334
|
const index = this.getCurrentBlockIndex();
|
|
@@ -343,7 +357,7 @@ class CursorPage extends page_1.default {
|
|
|
343
357
|
return null;
|
|
344
358
|
}
|
|
345
359
|
const element = block_elements.find((element) => {
|
|
346
|
-
const attribute =
|
|
360
|
+
const attribute = (0, get_index_path_for_element_1.default)(element);
|
|
347
361
|
return attribute === index_path;
|
|
348
362
|
});
|
|
349
363
|
return element || null;
|
|
@@ -354,7 +368,7 @@ class CursorPage extends page_1.default {
|
|
|
354
368
|
if (first_block === undefined) {
|
|
355
369
|
return null;
|
|
356
370
|
}
|
|
357
|
-
return
|
|
371
|
+
return (0, get_index_path_for_element_1.default)(first_block);
|
|
358
372
|
}
|
|
359
373
|
getLastBlockIndex() {
|
|
360
374
|
const blocks = this.getBlockElements();
|
|
@@ -362,7 +376,7 @@ class CursorPage extends page_1.default {
|
|
|
362
376
|
if (last_block === undefined) {
|
|
363
377
|
return null;
|
|
364
378
|
}
|
|
365
|
-
return
|
|
379
|
+
return (0, get_index_path_for_element_1.default)(last_block);
|
|
366
380
|
}
|
|
367
381
|
getNextBlockIndex() {
|
|
368
382
|
const current_block = this.getCurrentBlockElement();
|
|
@@ -372,7 +386,7 @@ class CursorPage extends page_1.default {
|
|
|
372
386
|
if (next_block === undefined) {
|
|
373
387
|
return null;
|
|
374
388
|
}
|
|
375
|
-
return
|
|
389
|
+
return (0, get_index_path_for_element_1.default)(next_block);
|
|
376
390
|
}
|
|
377
391
|
getPreviousBlockIndex() {
|
|
378
392
|
const current_block = this.getCurrentBlockElement();
|
|
@@ -384,11 +398,13 @@ class CursorPage extends page_1.default {
|
|
|
384
398
|
}
|
|
385
399
|
return previous_block.getAttribute('data-index-path');
|
|
386
400
|
}
|
|
387
|
-
|
|
401
|
+
activateCurrentBlock() {
|
|
388
402
|
const block_element = this.getCurrentBlockElement();
|
|
389
|
-
if (block_element
|
|
390
|
-
|
|
403
|
+
if (block_element !== null) {
|
|
404
|
+
this.activateBlock(block_element);
|
|
391
405
|
}
|
|
406
|
+
}
|
|
407
|
+
activateBlock(block_element) {
|
|
392
408
|
const attribute = block_element.getAttribute('data-block-type');
|
|
393
409
|
if (attribute === null) {
|
|
394
410
|
throw new errors_1.InvariantViolation(`
|
|
@@ -461,7 +477,7 @@ class CursorPage extends page_1.default {
|
|
|
461
477
|
Tried to access closest block wrapper for media, but it was not found
|
|
462
478
|
`);
|
|
463
479
|
}
|
|
464
|
-
const index_path =
|
|
480
|
+
const index_path = (0, get_index_path_for_element_1.default)(media_block);
|
|
465
481
|
this.navigateToIndex(index_path);
|
|
466
482
|
this.focusCurrentBlockElement();
|
|
467
483
|
const persistent_element = document.getElementById('persistent-audio');
|
|
@@ -582,6 +598,9 @@ class CursorPage extends page_1.default {
|
|
|
582
598
|
media_element.pause();
|
|
583
599
|
});
|
|
584
600
|
}
|
|
601
|
+
getInteractionHelper() {
|
|
602
|
+
return this.interaction_helper;
|
|
603
|
+
}
|
|
585
604
|
isLoggedIn() {
|
|
586
605
|
return this.logged_in;
|
|
587
606
|
}
|