highmark-cli 0.0.138 → 0.0.140
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/bin/action/publish.js +2 -0
- package/bin/constants.js +6 -2
- package/bin/handler/liveReload.js +18 -0
- package/bin/importer.js +7 -4
- package/bin/operation/copyCheckmark.js +32 -0
- package/bin/operation/copyClient.js +5 -5
- package/bin/operation/markdownHTML.js +31 -9
- package/bin/operation/markdownStylesCSS.js +17 -10
- package/bin/operation/server.js +7 -10
- package/bin/router/static.js +17 -0
- package/checkmark.svg +12 -0
- package/client.js +6126 -1527
- package/css/loading.css +32 -32
- package/lib/client.js +48 -6
- package/lib/constants.js +28 -12
- package/lib/createMethods.js +64 -0
- package/lib/customEventTypes.js +9 -1
- package/lib/eventTypes.js +5 -1
- package/lib/localStorage.js +56 -0
- package/lib/mixins/fullsrean.js +63 -0
- package/lib/mixins/touch.js +101 -32
- package/lib/selectors.js +5 -9
- package/lib/state.js +133 -0
- package/lib/styles.js +78 -0
- package/lib/utilities/element.js +11 -11
- package/lib/utilities/fullScreen.js +16 -0
- package/lib/utilities/orientation.js +39 -0
- package/lib/view/button/closeMenu.js +121 -0
- package/lib/view/button/fullScreen.js +121 -0
- package/lib/view/button/zoomMenuIn.js +121 -0
- package/lib/view/button/zoomMenuOut.js +121 -0
- package/lib/view/button.js +160 -0
- package/lib/view/checkbox.js +193 -0
- package/lib/view/div/buttons.js +215 -0
- package/lib/view/div/checkbox/invertColours.js +151 -0
- package/lib/view/div/checkbox/restoreNativeGestures.js +147 -0
- package/lib/view/div/checkbox.js +220 -0
- package/lib/view/div/checkboxes.js +211 -0
- package/lib/view/div/menu.js +122 -28
- package/lib/view/div/overlay.js +639 -0
- package/lib/view/div/preloader.js +204 -0
- package/lib/view/{div/leaf.js → div.js} +21 -32
- package/lib/view/element.js +164 -0
- package/lib/view/span.js +182 -0
- package/lib/view/svg/closeMenu.js +138 -0
- package/lib/view/svg/fullScreen.js +138 -0
- package/lib/view/svg/zoomMenuIn.js +146 -0
- package/lib/view/svg/zoomMenuOut.js +141 -0
- package/lib/view/svg.js +184 -0
- package/lib/view.js +23 -396
- package/package.json +3 -2
- package/src/client.js +34 -8
- package/src/constants.js +7 -3
- package/src/createMethods.js +66 -0
- package/src/customEventTypes.js +2 -0
- package/src/eventTypes.js +1 -0
- package/src/localStorage.js +48 -0
- package/src/mixins/fullsrean.js +75 -0
- package/src/mixins/touch.js +98 -39
- package/src/selectors.js +1 -2
- package/src/state.js +130 -0
- package/src/styles.js +18 -0
- package/src/utilities/element.js +18 -15
- package/src/utilities/fullScreen.js +8 -0
- package/src/utilities/orientation.js +34 -0
- package/src/view/button/closeMenu.js +16 -0
- package/src/view/button/fullScreen.js +16 -0
- package/src/view/button/zoomMenuIn.js +16 -0
- package/src/view/button/zoomMenuOut.js +16 -0
- package/src/view/button.js +38 -0
- package/src/view/checkbox.js +68 -0
- package/src/view/div/buttons.js +39 -0
- package/src/view/div/checkbox/invertColours.js +33 -0
- package/src/view/div/checkbox/restoreNativeGestures.js +29 -0
- package/src/view/div/checkbox.js +45 -0
- package/src/view/div/checkboxes.js +36 -0
- package/src/view/div/menu.js +83 -26
- package/src/view/div/overlay.js +547 -0
- package/src/view/div/preloader.js +25 -0
- package/src/view/{div/leaf.js → div.js} +13 -21
- package/src/view/element.js +16 -0
- package/src/view/span.js +22 -0
- package/src/view/svg/closeMenu.js +19 -0
- package/src/view/svg/fullScreen.js +19 -0
- package/src/view/svg/zoomMenuIn.js +20 -0
- package/src/view/svg/zoomMenuOut.js +19 -0
- package/src/view/svg.js +24 -0
- package/src/view.js +20 -482
- package/lib/style.js +0 -13
- package/lib/utilities/tree.js +0 -55
- package/src/style.js +0 -3
- package/src/utilities/tree.js +0 -29
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import withStyle from "easy-with-style"; ///
|
|
4
|
+
|
|
5
|
+
import { window } from "easy";
|
|
6
|
+
import { keyCodes } from "necessary";
|
|
7
|
+
|
|
8
|
+
import Div from "../div";
|
|
9
|
+
import Element from "../element";
|
|
10
|
+
import touchMixins from "../../mixins/touch";
|
|
11
|
+
import fullScreenMixins from "../../mixins/fullsrean";
|
|
12
|
+
|
|
13
|
+
import { isFullScreen } from "../../utilities/fullScreen";
|
|
14
|
+
import { elementsFromDOMElements } from "../../utilities/element";
|
|
15
|
+
import { SCROLL_DELAY, UP_DIRECTION, DECELERATION, DOWN_DIRECTION, OPEN_MENU_TAP_AREA_HEIGHT } from "../../constants";
|
|
16
|
+
import { getViewZoom as getZoom, setViewZoom as setZoom, setColoursInverted, areColoursInverted } from "../../state";
|
|
17
|
+
|
|
18
|
+
const { ENTER_KEY_CODE,
|
|
19
|
+
ESCAPE_KEY_CODE,
|
|
20
|
+
BACKSPACE_KEY_CODE,
|
|
21
|
+
ARROW_UP_KEY_CODE,
|
|
22
|
+
ARROW_DOWN_KEY_CODE,
|
|
23
|
+
ARROW_LEFT_KEY_CODE,
|
|
24
|
+
ARROW_RIGHT_KEY_CODE } = keyCodes;
|
|
25
|
+
|
|
26
|
+
class OverlayDiv extends Element {
|
|
27
|
+
fullScreenChangeCustomHandler = (event, element) => {
|
|
28
|
+
controller.closeMenu();
|
|
29
|
+
|
|
30
|
+
this.updateZoom();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
doubleTapCustomHandler = (event, element, top, left) => {
|
|
34
|
+
const fullScreen = isFullScreen();
|
|
35
|
+
|
|
36
|
+
if (fullScreen) {
|
|
37
|
+
controller.exitFullScreen();
|
|
38
|
+
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
this.restoreNativeGestures();
|
|
43
|
+
|
|
44
|
+
controller.checkRestoreNativeGesturesCheckbox();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
pinchStartCustomHandler = (event, element) => {
|
|
48
|
+
const zoom = getZoom(),
|
|
49
|
+
startZoom = zoom; ///
|
|
50
|
+
|
|
51
|
+
this.setStartZoom(startZoom);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
pinchMoveCustomHandler = (event, element, ratio) => {
|
|
55
|
+
const startZoom = this.getStartZoom(),
|
|
56
|
+
zoom = startZoom * Math.sqrt(ratio);
|
|
57
|
+
|
|
58
|
+
setZoom(zoom);
|
|
59
|
+
|
|
60
|
+
this.updateZoom();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
swipeRightCustomHandler = (event, element) => {
|
|
64
|
+
this.showLeftDiv();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
swipeLeftCustomHandler = (event, element) => {
|
|
68
|
+
this.showRightDiv();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
swipeDownCustomHandler = (event, element, top, left, speed) => {
|
|
72
|
+
const direction = DOWN_DIRECTION;
|
|
73
|
+
|
|
74
|
+
this.startScrolling(speed, direction);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
swipeUpCustomHandler = (event, element, top, left, speed) => {
|
|
78
|
+
const direction = UP_DIRECTION;
|
|
79
|
+
|
|
80
|
+
this.startScrolling(speed, direction);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
dragStartCustomHandler = (event, element, top, left) => {
|
|
84
|
+
const scrollTop = this.getScrollTop(),
|
|
85
|
+
startScrollTop = scrollTop; ///
|
|
86
|
+
|
|
87
|
+
this.setStartScrollTop(startScrollTop);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
dragDownCustomHandler = (event, element, top, left) => {
|
|
91
|
+
const startScrollTop = this.getStartScrollTop();
|
|
92
|
+
|
|
93
|
+
if (startScrollTop === null) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const scrollTop = startScrollTop - top;
|
|
98
|
+
|
|
99
|
+
this.setScrollTop(scrollTop);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
dragUpCustomHandler = (event, element, top, left) => {
|
|
103
|
+
const startScrollTop = this.getStartScrollTop();
|
|
104
|
+
|
|
105
|
+
if (startScrollTop === null) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const scrollTop = startScrollTop - top;
|
|
110
|
+
|
|
111
|
+
this.setScrollTop(scrollTop);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
tapCustomHandler = (event, element, top, left) => {
|
|
115
|
+
const fullScreen = isFullScreen();
|
|
116
|
+
|
|
117
|
+
if (!fullScreen) {
|
|
118
|
+
const height = this.getHeight(),
|
|
119
|
+
bottom = height - top;
|
|
120
|
+
|
|
121
|
+
if (bottom < OPEN_MENU_TAP_AREA_HEIGHT) {
|
|
122
|
+
controller.openMenu();
|
|
123
|
+
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
this.suppressNativeGestures();
|
|
129
|
+
|
|
130
|
+
controller.uncheckRestoreNativeGesturesCheckbox();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
keyDownHandler = (event, element) => {
|
|
134
|
+
const { keyCode } = event;
|
|
135
|
+
|
|
136
|
+
switch (keyCode) {
|
|
137
|
+
case ENTER_KEY_CODE:
|
|
138
|
+
case ARROW_RIGHT_KEY_CODE: {
|
|
139
|
+
this.showRightDiv();
|
|
140
|
+
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
case BACKSPACE_KEY_CODE:
|
|
145
|
+
case ARROW_LEFT_KEY_CODE: {
|
|
146
|
+
this.showLeftDiv();
|
|
147
|
+
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
case ESCAPE_KEY_CODE: {
|
|
152
|
+
///
|
|
153
|
+
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
case ARROW_UP_KEY_CODE: {
|
|
158
|
+
this.showFirstDiv();
|
|
159
|
+
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
case ARROW_DOWN_KEY_CODE: {
|
|
164
|
+
this.showLastDiv();
|
|
165
|
+
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
updateColours() {
|
|
172
|
+
const coloursInverted = areColoursInverted();
|
|
173
|
+
|
|
174
|
+
coloursInverted ?
|
|
175
|
+
this.addClass("inverted-colours") :
|
|
176
|
+
this.removeClass("inverted-colours");
|
|
177
|
+
|
|
178
|
+
this.updateZoom();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
updateZoom() {
|
|
182
|
+
const zoom = getZoom(),
|
|
183
|
+
displayedDiv = this.findDisplayedDiv();
|
|
184
|
+
|
|
185
|
+
displayedDiv.zoom(zoom);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
scrollToTop() {
|
|
189
|
+
const scrollTop = 0;
|
|
190
|
+
|
|
191
|
+
this.setScrollTop(scrollTop);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
stopScrolling() {
|
|
195
|
+
let interval = this.getInterval();
|
|
196
|
+
|
|
197
|
+
if (interval !== null) {
|
|
198
|
+
clearInterval(interval);
|
|
199
|
+
|
|
200
|
+
interval = null;
|
|
201
|
+
|
|
202
|
+
this.setInterval(interval);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
startScrolling(speed, direction) {
|
|
207
|
+
let scrollTop = this.getScrollTop();
|
|
208
|
+
|
|
209
|
+
scrollTop += speed * SCROLL_DELAY;
|
|
210
|
+
|
|
211
|
+
this.setScrollTop(scrollTop);
|
|
212
|
+
|
|
213
|
+
let interval = this.getInterval();
|
|
214
|
+
|
|
215
|
+
if (interval !== null) {
|
|
216
|
+
clearInterval(interval);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
interval = setInterval(() => {
|
|
220
|
+
speed = speed - direction * DECELERATION;
|
|
221
|
+
|
|
222
|
+
if ((speed * direction) < 0) {
|
|
223
|
+
clearInterval(interval);
|
|
224
|
+
|
|
225
|
+
interval = null;
|
|
226
|
+
|
|
227
|
+
this.setInterval(interval);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
let scrollTop = this.getScrollTop();
|
|
231
|
+
|
|
232
|
+
scrollTop += speed * SCROLL_DELAY;
|
|
233
|
+
|
|
234
|
+
this.setScrollTop(scrollTop);
|
|
235
|
+
}, SCROLL_DELAY);
|
|
236
|
+
|
|
237
|
+
this.setInterval(interval);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
invertColours() {
|
|
241
|
+
const coloursInverted = true;
|
|
242
|
+
|
|
243
|
+
setColoursInverted(coloursInverted);
|
|
244
|
+
|
|
245
|
+
this.updateColours();
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
revertColours() {
|
|
249
|
+
const coloursInverted = false;
|
|
250
|
+
|
|
251
|
+
setColoursInverted(coloursInverted);
|
|
252
|
+
|
|
253
|
+
this.updateColours();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
enterFullScreen() {
|
|
257
|
+
this.requestFullScreen();
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
restoreNativeGestures() {
|
|
261
|
+
this.addClass("native-gestures");
|
|
262
|
+
|
|
263
|
+
this.disableCustomGestures();
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
suppressNativeGestures() {
|
|
267
|
+
this.removeClass("native-gestures");
|
|
268
|
+
|
|
269
|
+
this.enableCustomGestures();
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
showRightDiv() {
|
|
273
|
+
const displayedDiv = this.findDisplayedDiv(),
|
|
274
|
+
divs = this.getDivs(),
|
|
275
|
+
divsLength = divs.length,
|
|
276
|
+
index = divs.indexOf(displayedDiv),
|
|
277
|
+
nextIndex = index + 1,
|
|
278
|
+
previousIndex = index; ///
|
|
279
|
+
|
|
280
|
+
if (nextIndex === divsLength) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
this.showNextDiv(nextIndex, previousIndex);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
showFirstDiv() {
|
|
288
|
+
const displayedDiv = this.findDisplayedDiv(),
|
|
289
|
+
divs = this.getDivs(),
|
|
290
|
+
index = divs.indexOf(displayedDiv),
|
|
291
|
+
nextIndex = 0,
|
|
292
|
+
previousIndex = (index === -1) ?
|
|
293
|
+
nextIndex : ///
|
|
294
|
+
index; ///
|
|
295
|
+
|
|
296
|
+
this.showNextDiv(nextIndex, previousIndex);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
showLeftDiv() {
|
|
300
|
+
const displayedDiv = this.findDisplayedDiv(),
|
|
301
|
+
divs = this.getDivs(),
|
|
302
|
+
index = divs.indexOf(displayedDiv),
|
|
303
|
+
nextIndex = index - 1,
|
|
304
|
+
previousIndex = index; ///
|
|
305
|
+
|
|
306
|
+
if (nextIndex === -1) {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
this.showNextDiv(nextIndex, previousIndex);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
showLastDiv() {
|
|
314
|
+
const displayedDiv = this.findDisplayedDiv(),
|
|
315
|
+
divs = this.getDivs(),
|
|
316
|
+
index = divs.indexOf(displayedDiv),
|
|
317
|
+
divsLength = divs.length,
|
|
318
|
+
nextIndex = divsLength - 1,
|
|
319
|
+
previousIndex = (index === -1) ?
|
|
320
|
+
nextIndex : ///
|
|
321
|
+
index; ///
|
|
322
|
+
|
|
323
|
+
this.showNextDiv(nextIndex, previousIndex);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
showNextDiv(nextIndex, previousIndex) {
|
|
327
|
+
const divs = this.getDivs(),
|
|
328
|
+
nextDiv = divs[nextIndex],
|
|
329
|
+
previousDiv = divs[previousIndex],
|
|
330
|
+
backgroundColour = nextDiv.getBackgroundColour();
|
|
331
|
+
|
|
332
|
+
let zoom;
|
|
333
|
+
|
|
334
|
+
zoom = 1;
|
|
335
|
+
|
|
336
|
+
previousDiv.zoom(zoom);
|
|
337
|
+
|
|
338
|
+
zoom = getZoom();
|
|
339
|
+
|
|
340
|
+
nextDiv.zoom(zoom);
|
|
341
|
+
|
|
342
|
+
previousDiv.hide();
|
|
343
|
+
|
|
344
|
+
this.setBackgroundColour(backgroundColour);
|
|
345
|
+
|
|
346
|
+
this.stopScrolling();
|
|
347
|
+
|
|
348
|
+
this.scrollToTop();
|
|
349
|
+
|
|
350
|
+
nextDiv.show();
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
setBackgroundColour(backgroundColour) {
|
|
354
|
+
const backgroundColor = backgroundColour, ///
|
|
355
|
+
css = {
|
|
356
|
+
backgroundColor
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
this.css(css);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
findDisplayedDiv() {
|
|
363
|
+
const divs = this.getDivs(),
|
|
364
|
+
displayedDiv = divs.find((div) => {
|
|
365
|
+
const displayed = div.isDisplayed();
|
|
366
|
+
|
|
367
|
+
if (displayed) {
|
|
368
|
+
return true;
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
return displayedDiv;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
getDivs() {
|
|
376
|
+
const childElements = this.getChildElements(),
|
|
377
|
+
divs = childElements; ///
|
|
378
|
+
|
|
379
|
+
return divs;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
getInterval() {
|
|
383
|
+
const { interval } = this.getState();
|
|
384
|
+
|
|
385
|
+
return interval;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
setInterval(interval) {
|
|
389
|
+
this.updateState({
|
|
390
|
+
interval
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
getStartZoom() {
|
|
395
|
+
const { startZoom } = this.getState();
|
|
396
|
+
|
|
397
|
+
return startZoom;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
setStartZoom(startZoom) {
|
|
401
|
+
this.updateState({
|
|
402
|
+
startZoom
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
getStartScrollTop() {
|
|
407
|
+
const { startScrollTop } = this.getState();
|
|
408
|
+
|
|
409
|
+
return startScrollTop;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
setStartScrollTop(startScrollTop) {
|
|
413
|
+
this.updateState({
|
|
414
|
+
startScrollTop
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
setInitialState() {
|
|
419
|
+
const interval = null,
|
|
420
|
+
startZoom = null,
|
|
421
|
+
startScrollTop = null;
|
|
422
|
+
|
|
423
|
+
this.setState({
|
|
424
|
+
interval,
|
|
425
|
+
startZoom,
|
|
426
|
+
startScrollTop
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
didMount() {
|
|
431
|
+
window.onKeyDown(this.keyDownHandler);
|
|
432
|
+
|
|
433
|
+
this.onCustomTap(this.tapCustomHandler);
|
|
434
|
+
this.onCustomDragUp(this.dragUpCustomHandler);
|
|
435
|
+
this.onCustomDragDown(this.dragDownCustomHandler);
|
|
436
|
+
this.onCustomDragStart(this.dragStartCustomHandler);
|
|
437
|
+
this.onCustomSwipeUp(this.swipeUpCustomHandler);
|
|
438
|
+
this.onCustomSwipeDown(this.swipeDownCustomHandler);
|
|
439
|
+
this.onCustomSwipeLeft(this.swipeLeftCustomHandler);
|
|
440
|
+
this.onCustomSwipeRight(this.swipeRightCustomHandler);
|
|
441
|
+
this.onCustomPinchMove(this.pinchMoveCustomHandler);
|
|
442
|
+
this.onCustomPinchStart(this.pinchStartCustomHandler);
|
|
443
|
+
this.onCustomDoubleTap(this.doubleTapCustomHandler);
|
|
444
|
+
|
|
445
|
+
this.onCustomFullScreenChange(this.fullScreenChangeCustomHandler);
|
|
446
|
+
|
|
447
|
+
this.enableFullScreen();
|
|
448
|
+
|
|
449
|
+
this.enableTouch();
|
|
450
|
+
|
|
451
|
+
this.updateZoom();
|
|
452
|
+
|
|
453
|
+
this.updateColours();
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
willUnmount() {
|
|
457
|
+
this.disableTouch();
|
|
458
|
+
|
|
459
|
+
this.disableFullScreen();
|
|
460
|
+
|
|
461
|
+
this.offCustomTap(this.tapCustomHandler);
|
|
462
|
+
this.offCustomDragUp(this.dragUpCustomHandler);
|
|
463
|
+
this.offCustomDragDown(this.dragDownCustomHandler);
|
|
464
|
+
this.offCustomDragStart(this.dragStartCustomHandler);
|
|
465
|
+
this.offCustomSwipeUp(this.swipeUpCustomHandler);
|
|
466
|
+
this.offCustomSwipeDown(this.swipeDownCustomHandler);
|
|
467
|
+
this.offCustomSwipeLeft(this.swipeLeftCustomHandler);
|
|
468
|
+
this.offCustomSwipeRight(this.swipeRightCustomHandler);
|
|
469
|
+
this.offCustomPinchMove(this.pinchMoveCustomHandler);
|
|
470
|
+
this.offCustomPinchStart(this.pinchStartCustomHandler);
|
|
471
|
+
this.offCustomDoubleTap(this.doubleTapCustomHandler);
|
|
472
|
+
|
|
473
|
+
this.offCustomFullScreenChange(this.fullScreenChangeCustomHandler);
|
|
474
|
+
|
|
475
|
+
window.offKeyDown(this.keyDownHandler);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
childElements() {
|
|
479
|
+
const { divDOMElements } = this.properties,
|
|
480
|
+
divs = elementsFromDOMElements(divDOMElements, Div),
|
|
481
|
+
childElements = [
|
|
482
|
+
...divs
|
|
483
|
+
];
|
|
484
|
+
|
|
485
|
+
return childElements;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
parentContext() {
|
|
489
|
+
const invertColours = this.invertColours.bind(this),
|
|
490
|
+
revertColours = this.revertColours.bind(this),
|
|
491
|
+
exitFullScreen = this.exitFullScreen.bind(this),
|
|
492
|
+
enterFullScreen = this.enterFullScreen.bind(this),
|
|
493
|
+
updateOverlayDivZoom = this.updateZoom.bind(this), ///
|
|
494
|
+
restoreNativeGestures = this.restoreNativeGestures.bind(this),
|
|
495
|
+
suppressNativeGestures = this.suppressNativeGestures.bind(this);
|
|
496
|
+
|
|
497
|
+
return ({
|
|
498
|
+
invertColours,
|
|
499
|
+
revertColours,
|
|
500
|
+
exitFullScreen,
|
|
501
|
+
enterFullScreen,
|
|
502
|
+
updateOverlayDivZoom,
|
|
503
|
+
restoreNativeGestures,
|
|
504
|
+
suppressNativeGestures
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
initialise() {
|
|
509
|
+
this.assignContext();
|
|
510
|
+
|
|
511
|
+
this.setInitialState();
|
|
512
|
+
|
|
513
|
+
this.showFirstDiv();
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
static tagName = "div";
|
|
517
|
+
|
|
518
|
+
static ignoredProperties = [
|
|
519
|
+
"divDOMElements"
|
|
520
|
+
];
|
|
521
|
+
|
|
522
|
+
static defaultProperties = {
|
|
523
|
+
className: "overlay"
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
Object.assign(OverlayDiv.prototype, touchMixins);
|
|
528
|
+
Object.assign(OverlayDiv.prototype, fullScreenMixins);
|
|
529
|
+
|
|
530
|
+
export default withStyle(OverlayDiv)`
|
|
531
|
+
|
|
532
|
+
width: 100%;
|
|
533
|
+
height: 100%;
|
|
534
|
+
|
|
535
|
+
overflow: hidden;
|
|
536
|
+
touch-action: none;
|
|
537
|
+
|
|
538
|
+
.native-gestures {
|
|
539
|
+
overflow: scroll;
|
|
540
|
+
touch-action: auto;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.inverted-colours {
|
|
544
|
+
filter: invert(1);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
`;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import withStyle from "easy-with-style"; ///
|
|
4
|
+
|
|
5
|
+
import { Element } from "easy";
|
|
6
|
+
|
|
7
|
+
class PreloaderDiv extends Element {
|
|
8
|
+
childElements() {
|
|
9
|
+
return "PRELOAD";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
static tagName = "div";
|
|
13
|
+
|
|
14
|
+
static defaultProperties = {
|
|
15
|
+
className: "preloader"
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default withStyle(PreloaderDiv)`
|
|
20
|
+
|
|
21
|
+
height: 0;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
background-image: url("checkmark.svg");
|
|
24
|
+
|
|
25
|
+
`;
|
|
@@ -1,47 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import withStyle from "easy-with-style"; ///
|
|
4
|
+
|
|
3
5
|
import { Element } from "easy";
|
|
4
6
|
|
|
5
|
-
import
|
|
7
|
+
import { BACKGROUND_COLOUR } from "../constants";
|
|
8
|
+
|
|
9
|
+
class Div extends Element {
|
|
10
|
+
getBackgroundColour() {
|
|
11
|
+
const backgroundColour = this.css(BACKGROUND_COLOUR) || null;
|
|
12
|
+
|
|
13
|
+
return backgroundColour;
|
|
14
|
+
}
|
|
6
15
|
|
|
7
|
-
class LeafDiv extends Element {
|
|
8
16
|
zoom(zoom) {
|
|
9
17
|
const width = `${100/zoom}%`,
|
|
10
|
-
minHeight = `${100/zoom}%`,
|
|
11
18
|
transform = `scale(${zoom})`;
|
|
12
19
|
|
|
13
20
|
const css = {
|
|
14
21
|
width,
|
|
15
|
-
minHeight,
|
|
16
22
|
transform
|
|
17
23
|
};
|
|
18
24
|
|
|
19
25
|
this.css(css);
|
|
20
26
|
}
|
|
21
27
|
|
|
22
|
-
setInitialState() {
|
|
23
|
-
const zoom = 1;
|
|
24
|
-
|
|
25
|
-
this.setState({
|
|
26
|
-
zoom
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
initialise() {
|
|
31
|
-
this.setInitialState();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
28
|
static tagName = "div";
|
|
35
|
-
|
|
36
|
-
static defaultProperties = {
|
|
37
|
-
className: "leaf"
|
|
38
|
-
};
|
|
39
29
|
}
|
|
40
30
|
|
|
41
|
-
export default withStyle(
|
|
31
|
+
export default withStyle(Div)`
|
|
42
32
|
|
|
43
33
|
width: 100%;
|
|
34
|
+
display: none;
|
|
44
35
|
min-height: 100%;
|
|
36
|
+
pointer-events: none;
|
|
45
37
|
transform-origin: top left;
|
|
46
38
|
|
|
47
39
|
`;
|
package/src/view/span.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import withStyle from "easy-with-style"; ///
|
|
4
|
+
|
|
5
|
+
import Element from "./element";
|
|
6
|
+
|
|
7
|
+
import { spanColour, spanFontSize } from "../styles";
|
|
8
|
+
|
|
9
|
+
class Span extends Element {
|
|
10
|
+
static tagName = "span";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default withStyle(Span)`
|
|
14
|
+
|
|
15
|
+
color: ${spanColour};
|
|
16
|
+
display: inline-block;
|
|
17
|
+
font-size: ${spanFontSize};
|
|
18
|
+
line-height: 1;
|
|
19
|
+
white-space: pre;
|
|
20
|
+
font-family: serif;
|
|
21
|
+
|
|
22
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import SVG from "../svg";
|
|
4
|
+
|
|
5
|
+
export default class CloseMenuSVG extends SVG {
|
|
6
|
+
childElements() {
|
|
7
|
+
return (
|
|
8
|
+
|
|
9
|
+
<g>
|
|
10
|
+
<path d="M 18.156886,3.3074544 12.500012,8.9643288 6.8431375,3.3074544 3.307454,6.8431379 8.9643284,12.500012 3.3074544,18.156886 6.8431379,21.69257 12.500012,16.035696 18.156886,21.69257 21.69257,18.156886 16.035695,12.500012 21.69257,6.8431379 Z" />
|
|
11
|
+
</g>
|
|
12
|
+
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static defaultProperties = {
|
|
17
|
+
className: "close-menu"
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import SVG from "../svg";
|
|
4
|
+
|
|
5
|
+
export default class FullScreenSVG extends SVG {
|
|
6
|
+
childElements() {
|
|
7
|
+
return (
|
|
8
|
+
|
|
9
|
+
<g>
|
|
10
|
+
<path d="M 2.9998169 2.9998169 L 2.9998169 6.0001506 L 2.9998169 18.999874 L 2.9998169 22.000208 L 6.0001506 22.000208 L 18.999874 22.000208 L 22.000208 22.000208 L 22.000208 18.999874 L 22.000208 2.9998169 L 2.9998169 2.9998169 z M 6.0001506 6.0001506 L 18.999874 6.0001506 L 18.999874 18.999874 L 6.0001506 18.999874 L 6.0001506 6.0001506 z " />
|
|
11
|
+
</g>
|
|
12
|
+
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static defaultProperties = {
|
|
17
|
+
className: "full-screen"
|
|
18
|
+
};
|
|
19
|
+
}
|