highmark-cli 0.0.138 → 0.0.139

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.
Files changed (86) hide show
  1. package/bin/action/publish.js +2 -0
  2. package/bin/constants.js +3 -1
  3. package/bin/handler/liveReload.js +18 -0
  4. package/bin/operation/copyCheckmark.js +32 -0
  5. package/bin/operation/copyClient.js +5 -5
  6. package/bin/operation/markdownStylesCSS.js +2 -2
  7. package/bin/operation/server.js +7 -10
  8. package/bin/router/static.js +17 -0
  9. package/checkmark.svg +12 -0
  10. package/client.js +6216 -1574
  11. package/css/loading.css +32 -32
  12. package/lib/client.js +21 -6
  13. package/lib/constants.js +29 -9
  14. package/lib/createMethods.js +64 -0
  15. package/lib/customEventTypes.js +9 -1
  16. package/lib/eventTypes.js +5 -1
  17. package/lib/localStorage.js +56 -0
  18. package/lib/mixins/fullsrean.js +63 -0
  19. package/lib/mixins/touch.js +101 -32
  20. package/lib/selectors.js +9 -9
  21. package/lib/state.js +133 -0
  22. package/lib/styles.js +78 -0
  23. package/lib/utilities/fullScreen.js +16 -0
  24. package/lib/utilities/orientation.js +39 -0
  25. package/lib/view/button/closeMenu.js +121 -0
  26. package/lib/view/button/fullScreen.js +121 -0
  27. package/lib/view/button/zoomMenuIn.js +121 -0
  28. package/lib/view/button/zoomMenuOut.js +121 -0
  29. package/lib/view/button.js +160 -0
  30. package/lib/view/checkbox.js +193 -0
  31. package/lib/view/div/buttons.js +215 -0
  32. package/lib/view/div/checkbox/invertColours.js +151 -0
  33. package/lib/view/div/checkbox/restoreNativeGestures.js +147 -0
  34. package/lib/view/div/checkbox.js +220 -0
  35. package/lib/view/div/checkboxes.js +211 -0
  36. package/lib/view/div/leaf.js +12 -20
  37. package/lib/view/div/menu.js +122 -28
  38. package/lib/view/div/overlay.js +650 -0
  39. package/lib/view/div/preloader.js +204 -0
  40. package/lib/view/element.js +164 -0
  41. package/lib/view/span.js +182 -0
  42. package/lib/view/svg/closeMenu.js +138 -0
  43. package/lib/view/svg/fullScreen.js +138 -0
  44. package/lib/view/svg/zoomMenuIn.js +146 -0
  45. package/lib/view/svg/zoomMenuOut.js +141 -0
  46. package/lib/view/svg.js +184 -0
  47. package/lib/view.js +23 -396
  48. package/package.json +3 -2
  49. package/src/client.js +32 -8
  50. package/src/constants.js +7 -2
  51. package/src/createMethods.js +66 -0
  52. package/src/customEventTypes.js +2 -0
  53. package/src/eventTypes.js +1 -0
  54. package/src/localStorage.js +48 -0
  55. package/src/mixins/fullsrean.js +75 -0
  56. package/src/mixins/touch.js +98 -39
  57. package/src/selectors.js +2 -2
  58. package/src/state.js +130 -0
  59. package/src/styles.js +18 -0
  60. package/src/utilities/fullScreen.js +8 -0
  61. package/src/utilities/orientation.js +34 -0
  62. package/src/view/button/closeMenu.js +16 -0
  63. package/src/view/button/fullScreen.js +16 -0
  64. package/src/view/button/zoomMenuIn.js +16 -0
  65. package/src/view/button/zoomMenuOut.js +16 -0
  66. package/src/view/button.js +38 -0
  67. package/src/view/checkbox.js +68 -0
  68. package/src/view/div/buttons.js +39 -0
  69. package/src/view/div/checkbox/invertColours.js +33 -0
  70. package/src/view/div/checkbox/restoreNativeGestures.js +29 -0
  71. package/src/view/div/checkbox.js +45 -0
  72. package/src/view/div/checkboxes.js +36 -0
  73. package/src/view/div/leaf.js +10 -15
  74. package/src/view/div/menu.js +83 -26
  75. package/src/view/div/overlay.js +578 -0
  76. package/src/view/div/preloader.js +25 -0
  77. package/src/view/element.js +16 -0
  78. package/src/view/span.js +22 -0
  79. package/src/view/svg/closeMenu.js +19 -0
  80. package/src/view/svg/fullScreen.js +19 -0
  81. package/src/view/svg/zoomMenuIn.js +20 -0
  82. package/src/view/svg/zoomMenuOut.js +19 -0
  83. package/src/view/svg.js +24 -0
  84. package/src/view.js +20 -482
  85. package/lib/style.js +0 -13
  86. package/src/style.js +0 -3
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ import withStyle from "easy-with-style"; ///
4
+
5
+ import Element from "./element";
6
+
7
+ import { svgFill } from "../styles";
8
+
9
+ class FontSizeSVG extends Element {
10
+ static tagName = "svg";
11
+
12
+ static defaultProperties = {
13
+ viewBox: "0 0 25 25"
14
+ };
15
+ }
16
+
17
+ export default withStyle(FontSizeSVG)`
18
+
19
+ fill: ${svgFill};
20
+ stroke: none;
21
+ display: block;
22
+ pointer-events: none;
23
+
24
+ `;
package/src/view.js CHANGED
@@ -1,514 +1,52 @@
1
1
  "use strict";
2
2
 
3
- import withStyle from "easy-with-style";
3
+ import withStyle from "easy-with-style"; ///
4
4
 
5
- import { keyCodes } from "necessary";
6
- import { Element, window } from "easy";
7
-
8
- import LeafDiv from "./view/div/leaf";
5
+ import Element from "./view/element";
9
6
  import MenuDiv from "./view/div/menu";
10
- import touchMixins from "./mixins/touch";
11
-
12
- import { leafNodesFromNodeList } from "./utilities/tree";
13
- import { elementsFromDOMElements } from "./utilities/element";
14
- import { VIEW_CHILD_DIVS_SELECTOR } from "./selectors";
15
- import { SHOW_DELAY, ZOOM_RATIO, SCROLL_DELAY, UP_DIRECTION, DECELERATION, DOWN_DIRECTION, MENU_DIV_SWIPE_BOTTOM } from "./constants";
16
-
17
- const { ENTER_KEY_CODE,
18
- ESCAPE_KEY_CODE,
19
- BACKSPACE_KEY_CODE,
20
- ARROW_UP_KEY_CODE,
21
- ARROW_DOWN_KEY_CODE,
22
- ARROW_LEFT_KEY_CODE,
23
- ARROW_RIGHT_KEY_CODE } = keyCodes;
7
+ import OverlayDiv from "./view/div/overlay";
8
+ import PreloaderDiv from "./view/div/preloader";
24
9
 
25
10
  class View extends Element {
26
- doubleTapCustomHandler = (event, element) => {
27
- this.enableNativeGestures();
28
- }
29
-
30
- pinchStartCustomHandler = (event, element) => {
31
- const nativeGesturesEnabled = this.areNativeGesturesEnabled();
32
-
33
- if (nativeGesturesEnabled) {
34
- return;
35
- }
36
-
37
- const zoom = this.getZoom(),
38
- startZoom = zoom; ///
39
-
40
- this.setStartZoom(startZoom);
41
- }
42
-
43
- pinchMoveCustomHandler = (event, element, ratio) => {
44
- const nativeGesturesEnabled = this.areNativeGesturesEnabled();
45
-
46
- if (nativeGesturesEnabled) {
47
- return;
48
- }
49
-
50
- const startZoom = this.getStartZoom(),
51
- zoom = startZoom * Math.sqrt(ratio);
52
-
53
- this.setZoom(zoom);
54
-
55
- this.zoom(zoom);
56
- }
57
-
58
- swipeRightCustomHandler = (event, element) => {
59
- const nativeGesturesEnabled = this.areNativeGesturesEnabled();
60
-
61
- if (nativeGesturesEnabled) {
62
- return;
63
- }
64
-
65
- this.showLeftLeafDiv();
66
- }
67
-
68
- swipeLeftCustomHandler = (event, element) => {
69
- const nativeGesturesEnabled = this.areNativeGesturesEnabled();
70
-
71
- if (nativeGesturesEnabled) {
72
- return;
73
- }
74
-
75
- this.showRightLeftDiv();
76
- }
77
-
78
- swipeDownCustomHandler = (event, element, top, left, speed) => {
79
- const nativeGesturesEnabled = this.areNativeGesturesEnabled();
80
-
81
- if (nativeGesturesEnabled) {
82
- return;
83
- }
84
-
85
- const direction = DOWN_DIRECTION;
86
-
87
- this.scroll(speed, direction);
88
- }
89
-
90
- swipeUpCustomHandler = (event, element, top, left, speed) => {
91
- const nativeGesturesEnabled = this.areNativeGesturesEnabled();
92
-
93
- if (nativeGesturesEnabled) {
94
- return;
95
- }
96
-
97
- const height = this.getHeight(),
98
- bottom = height - top;
99
-
100
- if (bottom < MENU_DIV_SWIPE_BOTTOM) {
101
- this.showMenuDiv();
102
-
103
- return;
104
- }
105
-
106
- const direction = UP_DIRECTION;
107
-
108
- this.scroll(speed, direction);
109
- }
110
-
111
- dragStartCustomHandler = (event, element) => {
112
- const nativeGesturesEnabled = this.areNativeGesturesEnabled();
113
-
114
- if (nativeGesturesEnabled) {
115
- return;
116
- }
117
-
118
- const scrollTop = this.getScrollTop(),
119
- startScrollTop = scrollTop; ///
120
-
121
- this.setStartScrollTop(startScrollTop);
122
- }
123
-
124
- dragDownCustomHandler = (event, element, top, left) => {
125
- const nativeGesturesEnabled = this.areNativeGesturesEnabled();
126
-
127
- if (nativeGesturesEnabled) {
128
- return;
129
- }
130
-
131
- const startScrollTop = this.getStartScrollTop(),
132
- scrollTop = startScrollTop - top;
133
-
134
- this.setScrollTop(scrollTop);
135
- }
136
-
137
- dragUpCustomHandler = (event, element, top, left) => {
138
- const nativeGesturesEnabled = this.areNativeGesturesEnabled();
139
-
140
- if (nativeGesturesEnabled) {
141
- return;
142
- }
143
-
144
- const startScrollTop = this.getStartScrollTop(),
145
- scrollTop = startScrollTop - top;
146
-
147
- this.setScrollTop(scrollTop);
148
- }
149
-
150
- tapCustomHandler = (event, element) => {
151
-
152
- alert("view tap...")
153
-
154
- this.disableNativeGestures();
155
- }
156
-
157
- keyDownHandler = (event, element) => {
158
- const { keyCode } = event;
159
-
160
- switch (keyCode) {
161
- case ENTER_KEY_CODE:
162
- case ARROW_RIGHT_KEY_CODE: {
163
- this.showRightLeftDiv();
164
-
165
- break;
166
- }
167
-
168
- case BACKSPACE_KEY_CODE:
169
- case ARROW_LEFT_KEY_CODE: {
170
- this.showLeftLeafDiv();
171
-
172
- break;
173
- }
174
-
175
- case ESCAPE_KEY_CODE: {
176
- ///
177
-
178
- break;
179
- }
180
-
181
- case ARROW_UP_KEY_CODE: {
182
- this.showFirstLeftDiv();
183
-
184
- break;
185
- }
186
-
187
- case ARROW_DOWN_KEY_CODE: {
188
- this.showLastLeafDiv();
189
-
190
- break;
191
- }
192
- }
193
- }
194
-
195
- zoomOut() {
196
- let zoom = this.getZoom();
197
-
198
- zoom /= ZOOM_RATIO;
199
-
200
- this.setZoom(zoom);
201
-
202
- this.zoom(zoom);
203
- }
204
-
205
- zoomIn() {
206
- let zoom = this.getZoom();
207
-
208
- zoom *= ZOOM_RATIO;
209
-
210
- this.setZoom(zoom);
211
-
212
- this.zoom(zoom);
213
- }
214
-
215
- zoom(zoom) {
216
- const displayedLeafDiv = this.findDisplayedLeafDiv();
217
-
218
- displayedLeafDiv.zoom(zoom);
219
- }
220
-
221
- scroll(speed, direction) {
222
- let scrollTop = this.getScrollTop();
223
-
224
- scrollTop += speed * SCROLL_DELAY;
225
-
226
- this.setScrollTop(scrollTop);
227
-
228
- let interval = this.getInterval();
229
-
230
- if (interval !== null) {
231
- clearInterval(interval);
232
- }
233
-
234
- interval = setInterval(() => {
235
- speed = speed - direction * DECELERATION;
236
-
237
- if ((speed * direction) < 0) {
238
- clearInterval(interval);
239
-
240
- interval = null;
241
-
242
- this.setInterval(interval);
243
- }
244
-
245
- let scrollTop = this.getScrollTop();
246
-
247
- scrollTop += speed * SCROLL_DELAY;
248
-
249
- this.setScrollTop(scrollTop);
250
- }, SCROLL_DELAY);
251
-
252
- this.setInterval(interval);
253
- }
254
-
255
- showFirstLeftDiv() {
256
- const displayedLeafDiv = this.findDisplayedLeafDiv(),
257
- leafDivs = this.getLeafDivs(),
258
- index = leafDivs.indexOf(displayedLeafDiv),
259
- nextIndex = 0,
260
- previousIndex = index; ///
261
-
262
- this.showNextLeafDiv(nextIndex, previousIndex);
263
- }
264
-
265
- showLeftLeafDiv() {
266
- const displayedLeafDiv = this.findDisplayedLeafDiv(),
267
- leafDivs = this.getLeafDivs(),
268
- index = leafDivs.indexOf(displayedLeafDiv),
269
- nextIndex = index - 1,
270
- previousIndex = index; ///
271
-
272
- this.showNextLeafDiv(nextIndex, previousIndex);
273
- }
274
-
275
- showRightLeftDiv() {
276
- const displayedLeafDiv = this.findDisplayedLeafDiv(),
277
- leafDivs = this.getLeafDivs(),
278
- index = leafDivs.indexOf(displayedLeafDiv),
279
- nextIndex = index + 1,
280
- previousIndex = index; ///
281
-
282
- this.showNextLeafDiv(nextIndex, previousIndex);
283
- }
284
-
285
- showLastLeafDiv() {
286
- const displayedLeafDiv = this.findDisplayedLeafDiv(),
287
- leafDivs = this.getLeafDivs(),
288
- index = leafDivs.indexOf(displayedLeafDiv),
289
- leafDivsLength = leafDivs.length,
290
- nextIndex = leafDivsLength - 1,
291
- previousIndex = index; ///
292
-
293
- this.showNextLeafDiv(nextIndex, previousIndex);
294
- }
295
-
296
- showNextLeafDiv(nextIndex, previousIndex) {
297
- const leafDivs = this.getLeafDivs(),
298
- leafDivsLength = leafDivs.length,
299
- previousLeafDiv = leafDivs[previousIndex];
300
-
301
- if ((nextIndex === -1) || (nextIndex === previousIndex) || (nextIndex === leafDivsLength)) {
302
- return;
303
- }
304
-
305
- previousLeafDiv.hide();
306
-
307
- const nextLeafDiv = leafDivs[nextIndex],
308
- zoom = this.getZoom();
309
-
310
- nextLeafDiv.zoom(zoom);
311
-
312
- setTimeout(() => {
313
- const scrollTop = 0;
314
-
315
- nextLeafDiv.setScrollTop(scrollTop);
316
-
317
- nextLeafDiv.show();
318
- }, SHOW_DELAY);
319
- }
320
-
321
- enableNativeGestures() {
322
- this.addClass("native-gestures");
323
- }
324
-
325
- disableNativeGestures() {
326
- this.removeClass("native-gestures");
327
- }
328
-
329
- forEachLeafDiv(callback) {
330
- const leafDivs = this.getLeafDivs();
331
-
332
- leafDivs.forEach(callback);
333
- }
334
-
335
- findDisplayedLeafDiv() {
336
- const leafDivs = this.getLeafDivs(),
337
- displayedLeafDiv = leafDivs.find((leafDiv) => {
338
- const displayed = leafDiv.isDisplayed();
339
-
340
- if (displayed) {
341
- return true;
342
- }
343
- });
344
-
345
- return displayedLeafDiv;
346
- }
347
-
348
- retrieveLeafDivs() {
349
- const viewChildDivDOMElementNodeList = document.querySelectorAll(VIEW_CHILD_DIVS_SELECTOR),
350
- viewChildDivDOMElements = leafNodesFromNodeList(viewChildDivDOMElementNodeList), ///
351
- leafDivs = elementsFromDOMElements(viewChildDivDOMElements, LeafDiv);
352
-
353
- return leafDivs;
354
- }
355
-
356
- getZoom() {
357
- const { zoom } = this.getState();
358
-
359
- return zoom;
360
- }
361
-
362
- setZoom(zoom) {
363
- this.updateState({
364
- zoom
365
- });
366
- }
367
-
368
- getLeafDivs() {
369
- const { leafDivs } = this.getState();
370
-
371
- return leafDivs;
372
- }
373
-
374
- setLeftDivs(leafDivs) {
375
- this.updateState({
376
- leafDivs
377
- });
378
- }
379
-
380
- getInterval() {
381
- const { interval } = this.getState();
382
-
383
- return interval;
384
- }
385
-
386
- setInterval(interval) {
387
- this.updateState({
388
- interval
389
- });
390
- }
391
-
392
- getStartZoom() {
393
- const { startZoom } = this.getState();
394
-
395
- return startZoom;
396
- }
397
-
398
- setStartZoom(startZoom) {
399
- this.updateState({
400
- startZoom
401
- });
402
- }
403
-
404
- getStartScrollTop() {
405
- const { startScrollTop } = this.getState();
406
-
407
- return startScrollTop;
408
- }
409
-
410
- setStartScrollTop(startScrollTop) {
411
- this.updateState({
412
- startScrollTop
413
- });
414
- }
415
-
416
- areNativeGesturesEnabled() {
417
- const nativeGesturesEnabled = this.hasClass("native-gestures");
418
-
419
- return nativeGesturesEnabled;
420
- }
421
-
422
- setInitialState() {
423
- const zoom = 1,
424
- leafDivs = this.retrieveLeafDivs(),
425
- interval = null,
426
- startZoom = null,
427
- startScrollTop = null;
428
-
429
- this.setState({
430
- zoom,
431
- leafDivs,
432
- interval,
433
- startZoom,
434
- startScrollTop
435
- });
436
- }
437
-
438
- didMount() {
439
- this.enableTouch();
440
-
441
- this.onCustomTap(this.tapCustomHandler);
442
- this.onCustomDragUp(this.dragUpCustomHandler);
443
- this.onCustomDragDown(this.dragDownCustomHandler);
444
- this.onCustomDragStart(this.dragStartCustomHandler);
445
- this.onCustomSwipeUp(this.swipeUpCustomHandler);
446
- this.onCustomSwipeDown(this.swipeDownCustomHandler);
447
- this.onCustomSwipeLeft(this.swipeLeftCustomHandler);
448
- this.onCustomSwipeRight(this.swipeRightCustomHandler);
449
- this.onCustomPinchMove(this.pinchMoveCustomHandler);
450
- this.onCustomPinchStart(this.pinchStartCustomHandler);
451
- this.onCustomDoubleTap(this.doubleTapCustomHandler);
452
-
453
- window.onKeyDown(this.keyDownHandler);
454
- }
455
-
456
- willUnmount() {
457
- this.offCustomTap(this.tapCustomHandler);
458
- this.offCustomDragUp(this.dragUpCustomHandler);
459
- this.offCustomDragDown(this.dragDownCustomHandler);
460
- this.offCustomDragStart(this.dragStartCustomHandler);
461
- this.offCustomSwipeUp(this.swipeUpCustomHandler);
462
- this.offCustomSwipeDown(this.swipeDownCustomHandler);
463
- this.offCustomSwipeLeft(this.swipeLeftCustomHandler);
464
- this.offCustomSwipeRight(this.swipeRightCustomHandler);
465
- this.offCustomPinchMove(this.pinchMoveCustomHandler);
466
- this.offCustomPinchStart(this.pinchStartCustomHandler);
467
- this.offCustomDoubleTap(this.doubleTapCustomHandler);
468
-
469
- this.disableTouch();
470
-
471
- window.offKeyDown(this.keyDownHandler);
11
+ updateZoom() {
12
+ this.updateMenuDivZoom();
13
+ this.updateOverlayDivZoom();
472
14
  }
473
15
 
474
16
  childElements() {
475
- return (
17
+ const { divDOMElement } = this.properties;
476
18
 
19
+ return ([
20
+
21
+ <PreloaderDiv/>,
22
+ <OverlayDiv divDOMElement={divDOMElement} />,
477
23
  <MenuDiv/>
478
24
 
479
- );
25
+ ]);
480
26
  }
481
27
 
482
28
  initialise() {
483
29
  this.assignContext();
484
30
 
485
- this.setInitialState();
486
-
487
- this.forEachLeafDiv((leafDiv, index) => {
488
- (index === 0) ?
489
- leafDiv.show() :
490
- leafDiv.hide();
491
- });
31
+ this.show();
492
32
  }
493
33
 
494
34
  static tagName = "div";
495
35
 
36
+ static ignoredProperties = [
37
+ "divDOMElement"
38
+ ];
39
+
496
40
  static defaultProperties = {
497
41
  className: "view"
498
42
  };
499
43
  }
500
44
 
501
- Object.assign(View.prototype, touchMixins);
502
-
503
45
  export default withStyle(View)`
504
46
 
505
47
  width: 100%;
506
48
  height: 100%;
507
- overflow: hidden;
508
- touch-action: none;
509
-
510
- .native-gestures {
511
- touch-action: auto;
512
- }
49
+ align-items: stretch;
50
+ flex-direction: column;
513
51
 
514
52
  `;
package/lib/style.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "menuDivHeight", {
6
- enumerable: true,
7
- get: function() {
8
- return menuDivHeight;
9
- }
10
- });
11
- var menuDivHeight = "256px";
12
-
13
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9zdHlsZS5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuZXhwb3J0IGNvbnN0IG1lbnVEaXZIZWlnaHQgPSBcIjI1NnB4XCI7XG4iXSwibmFtZXMiOlsibWVudURpdkhlaWdodCJdLCJyYW5nZU1hcHBpbmdzIjoiOzs7Ozs7Ozs7OyIsIm1hcHBpbmdzIjoiQUFBQTs7OzsrQkFFYUE7OztlQUFBQTs7O0FBQU4sSUFBTUEsZ0JBQWdCIn0=
package/src/style.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
-
3
- export const menuDivHeight = "256px";