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.
Files changed (92) hide show
  1. package/bin/action/publish.js +2 -0
  2. package/bin/constants.js +6 -2
  3. package/bin/handler/liveReload.js +18 -0
  4. package/bin/importer.js +7 -4
  5. package/bin/operation/copyCheckmark.js +32 -0
  6. package/bin/operation/copyClient.js +5 -5
  7. package/bin/operation/markdownHTML.js +31 -9
  8. package/bin/operation/markdownStylesCSS.js +17 -10
  9. package/bin/operation/server.js +7 -10
  10. package/bin/router/static.js +17 -0
  11. package/checkmark.svg +12 -0
  12. package/client.js +6126 -1527
  13. package/css/loading.css +32 -32
  14. package/lib/client.js +48 -6
  15. package/lib/constants.js +28 -12
  16. package/lib/createMethods.js +64 -0
  17. package/lib/customEventTypes.js +9 -1
  18. package/lib/eventTypes.js +5 -1
  19. package/lib/localStorage.js +56 -0
  20. package/lib/mixins/fullsrean.js +63 -0
  21. package/lib/mixins/touch.js +101 -32
  22. package/lib/selectors.js +5 -9
  23. package/lib/state.js +133 -0
  24. package/lib/styles.js +78 -0
  25. package/lib/utilities/element.js +11 -11
  26. package/lib/utilities/fullScreen.js +16 -0
  27. package/lib/utilities/orientation.js +39 -0
  28. package/lib/view/button/closeMenu.js +121 -0
  29. package/lib/view/button/fullScreen.js +121 -0
  30. package/lib/view/button/zoomMenuIn.js +121 -0
  31. package/lib/view/button/zoomMenuOut.js +121 -0
  32. package/lib/view/button.js +160 -0
  33. package/lib/view/checkbox.js +193 -0
  34. package/lib/view/div/buttons.js +215 -0
  35. package/lib/view/div/checkbox/invertColours.js +151 -0
  36. package/lib/view/div/checkbox/restoreNativeGestures.js +147 -0
  37. package/lib/view/div/checkbox.js +220 -0
  38. package/lib/view/div/checkboxes.js +211 -0
  39. package/lib/view/div/menu.js +122 -28
  40. package/lib/view/div/overlay.js +639 -0
  41. package/lib/view/div/preloader.js +204 -0
  42. package/lib/view/{div/leaf.js → div.js} +21 -32
  43. package/lib/view/element.js +164 -0
  44. package/lib/view/span.js +182 -0
  45. package/lib/view/svg/closeMenu.js +138 -0
  46. package/lib/view/svg/fullScreen.js +138 -0
  47. package/lib/view/svg/zoomMenuIn.js +146 -0
  48. package/lib/view/svg/zoomMenuOut.js +141 -0
  49. package/lib/view/svg.js +184 -0
  50. package/lib/view.js +23 -396
  51. package/package.json +3 -2
  52. package/src/client.js +34 -8
  53. package/src/constants.js +7 -3
  54. package/src/createMethods.js +66 -0
  55. package/src/customEventTypes.js +2 -0
  56. package/src/eventTypes.js +1 -0
  57. package/src/localStorage.js +48 -0
  58. package/src/mixins/fullsrean.js +75 -0
  59. package/src/mixins/touch.js +98 -39
  60. package/src/selectors.js +1 -2
  61. package/src/state.js +130 -0
  62. package/src/styles.js +18 -0
  63. package/src/utilities/element.js +18 -15
  64. package/src/utilities/fullScreen.js +8 -0
  65. package/src/utilities/orientation.js +34 -0
  66. package/src/view/button/closeMenu.js +16 -0
  67. package/src/view/button/fullScreen.js +16 -0
  68. package/src/view/button/zoomMenuIn.js +16 -0
  69. package/src/view/button/zoomMenuOut.js +16 -0
  70. package/src/view/button.js +38 -0
  71. package/src/view/checkbox.js +68 -0
  72. package/src/view/div/buttons.js +39 -0
  73. package/src/view/div/checkbox/invertColours.js +33 -0
  74. package/src/view/div/checkbox/restoreNativeGestures.js +29 -0
  75. package/src/view/div/checkbox.js +45 -0
  76. package/src/view/div/checkboxes.js +36 -0
  77. package/src/view/div/menu.js +83 -26
  78. package/src/view/div/overlay.js +547 -0
  79. package/src/view/div/preloader.js +25 -0
  80. package/src/view/{div/leaf.js → div.js} +13 -21
  81. package/src/view/element.js +16 -0
  82. package/src/view/span.js +22 -0
  83. package/src/view/svg/closeMenu.js +19 -0
  84. package/src/view/svg/fullScreen.js +19 -0
  85. package/src/view/svg/zoomMenuIn.js +20 -0
  86. package/src/view/svg/zoomMenuOut.js +19 -0
  87. package/src/view/svg.js +24 -0
  88. package/src/view.js +20 -482
  89. package/lib/style.js +0 -13
  90. package/lib/utilities/tree.js +0 -55
  91. package/src/style.js +0 -3
  92. package/src/utilities/tree.js +0 -29
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ import { eventTypes } from "easy";
4
+
5
+ import { PORTRAIT_ORIENTATION, LANDSCAPE_ORIENTATION, ORIENTATION_PORTRAIT_QUERY } from "../constants";
6
+
7
+ const { CHANGE_EVENT_TYPE } = eventTypes;
8
+
9
+ var mediaQueryList = matchMedia(ORIENTATION_PORTRAIT_QUERY);
10
+
11
+ export function getOrientation(callback) {
12
+ const orientation = orientationFromMediaQueryList(mediaQueryList);
13
+
14
+ callback(orientation);
15
+ }
16
+
17
+ export function onOrientationChange(handler) {
18
+ const eventType = CHANGE_EVENT_TYPE;
19
+
20
+ mediaQueryList.addEventListener(eventType, (mediaQueryList) => {
21
+ const orientation = orientationFromMediaQueryList(mediaQueryList);
22
+
23
+ handler(orientation);
24
+ });
25
+ }
26
+
27
+ function orientationFromMediaQueryList(mediaQueryList) {
28
+ const { matches = false } = mediaQueryList,
29
+ orientation = matches ?
30
+ PORTRAIT_ORIENTATION :
31
+ LANDSCAPE_ORIENTATION;
32
+
33
+ return orientation;
34
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ import Button from "../button";
4
+ import CloseMenuSVG from "../svg/closeMenu";
5
+
6
+ export default class CloseMenuButton extends Button {
7
+ clickHandler = (event, element) => {
8
+ controller.closeMenu();
9
+ }
10
+
11
+ static SVG = CloseMenuSVG;
12
+
13
+ static defaultProperties = {
14
+ className: "close-menu"
15
+ };
16
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ import Button from "../button";
4
+ import FullScreenSVG from "../svg/fullScreen";
5
+
6
+ export default class FullScreenButton extends Button {
7
+ clickHandler = (event, element) => {
8
+ controller.enterFullScreen();
9
+ }
10
+
11
+ static SVG = FullScreenSVG;
12
+
13
+ static defaultProperties = {
14
+ className: "full-screen"
15
+ };
16
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ import Button from "../button";
4
+ import ZoomMenuInSVG from "../svg/zoomMenuIn";
5
+
6
+ export default class ZoomMenuInButton extends Button {
7
+ clickHandler = (event, element) => {
8
+ controller.zoomMenuIn();
9
+ }
10
+
11
+ static SVG = ZoomMenuInSVG;
12
+
13
+ static defaultProperties = {
14
+ className: "zoom-menu-in"
15
+ };
16
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ import Button from "../button";
4
+ import ZoomMenuOutSVG from "../svg/zoomMenuOut";
5
+
6
+ export default class ZoomMenuOutButton extends Button {
7
+ clickHandler = (event, element) => {
8
+ controller.zoomMenuOut();
9
+ }
10
+
11
+ static SVG = ZoomMenuOutSVG;
12
+
13
+ static defaultProperties = {
14
+ className: "zoom-menu-out"
15
+ };
16
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ import withStyle from "easy-with-style"; ///
4
+
5
+ import { Button } from "easy";
6
+
7
+ import { buttonSize, borderWidth, borderRadius, borderColour, buttonPadding } from "../styles";
8
+
9
+ export default withStyle(class extends Button {
10
+ didMount() {
11
+ this.onClick(this.clickHandler);
12
+ }
13
+
14
+ willUnmount() {
15
+ this.offClick(this.clickHandler);
16
+ }
17
+
18
+ childElements() {
19
+ const { SVG } = this.constructor;
20
+
21
+ return (
22
+
23
+ <SVG/>
24
+
25
+ );
26
+ }
27
+ })`
28
+
29
+ width: ${buttonSize};
30
+ height: ${buttonSize};
31
+ cursor: pointer;
32
+ border: ${borderWidth} solid ${borderColour};
33
+ margin: 0;
34
+ padding: ${buttonPadding};
35
+ background: transparent;
36
+ border-radius: ${borderRadius};
37
+
38
+ `;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ import withStyle from "easy-with-style"; ///
4
+
5
+ import { Checkbox } from "easy";
6
+
7
+ import { borderWidth, borderRadius, borderColour, checkboxSize, checkboxBackgroundColour } from "../styles";
8
+
9
+ export default withStyle(class extends Checkbox {
10
+ check() {
11
+ const checked = true;
12
+
13
+ super.check(checked);
14
+ }
15
+
16
+ uncheck() {
17
+ const checked = false;
18
+
19
+ super.check(checked);
20
+ }
21
+
22
+ parentContext() {
23
+ const checkCheckbox = this.check.bind(this), ///
24
+ uncheckCheckbox = this.uncheck.bind(this), ///
25
+ isCheckboxChecked = this.isChecked.bind(this); ///
26
+
27
+ return ({
28
+ checkCheckbox,
29
+ uncheckCheckbox,
30
+ isCheckboxChecked
31
+ });
32
+ }
33
+ })`
34
+
35
+ width: ${checkboxSize};
36
+ height: ${checkboxSize};
37
+ cursor: pointer;
38
+ display: block;
39
+ outline: none;
40
+ position: relative;
41
+ appearance: none;
42
+
43
+ ::before {
44
+ width: ${checkboxSize};
45
+ height: ${checkboxSize};
46
+ border: ${borderWidth} solid ${borderColour};
47
+ content: " ";
48
+ position: absolute;
49
+ border-radius: ${borderRadius};
50
+ background-color: ${checkboxBackgroundColour};
51
+ }
52
+
53
+ ::after {
54
+ top: 0;
55
+ left: 0;
56
+ width: ${checkboxSize};
57
+ height: ${checkboxSize};
58
+ content: " ";
59
+ position: absolute;
60
+ background-size: 0;
61
+ background-image: url("checkmark.svg");
62
+ }
63
+
64
+ :checked::after {
65
+ background-size: 100%;
66
+ }
67
+
68
+ `;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ import withStyle from "easy-with-style"; ///
4
+
5
+ import Element from "../element";
6
+ import CloseMenuButton from "../button/closeMenu";
7
+ import FullScreenButton from "../button/fullScreen";
8
+ import ZoomMenuInButton from "../button/zoomMenuIn";
9
+ import ZoomMenuOutButton from "../button/zoomMenuOut";
10
+
11
+ import { buttonsDivGap } from "../../styles";
12
+
13
+ class ButtonsDiv extends Element {
14
+ childElements() {
15
+ return ([
16
+
17
+ <ZoomMenuInButton/>,
18
+ <CloseMenuButton/>,
19
+ <ZoomMenuOutButton/>,
20
+ <FullScreenButton/>
21
+
22
+ ]);
23
+ }
24
+
25
+ static tagName = "div";
26
+
27
+ static defaultProperties = {
28
+ className: "buttons"
29
+ };
30
+ }
31
+
32
+ export default withStyle(ButtonsDiv)`
33
+
34
+ gap: ${buttonsDivGap};
35
+ display: grid;
36
+ grid-template-rows: min-content min-content;
37
+ grid-template-columns: min-content min-content;
38
+
39
+ `;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ import CheckboxDiv from "../../div/checkbox";
4
+
5
+ import { areColoursInverted } from "../../../state";
6
+
7
+ export default class InvertColoursCheckboxDiv extends CheckboxDiv {
8
+ changeHandler = (event, element) => {
9
+ const checkboxChecked = this.isCheckboxChecked();
10
+
11
+ checkboxChecked ?
12
+ controller.invertColours() :
13
+ controller.revertColours();
14
+ }
15
+
16
+ didMount() {
17
+ const coloursInverted = areColoursInverted();
18
+
19
+ coloursInverted ?
20
+ this.checkCheckbox() :
21
+ this.uncheckCheckbox();
22
+ }
23
+
24
+ willUnmount() {
25
+ ///
26
+ }
27
+
28
+ static message = "Invert colours";
29
+
30
+ static defaultProperties = {
31
+ className: "invert-colours"
32
+ };
33
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ import CheckboxDiv from "../../div/checkbox";
4
+
5
+ export default class RestoreNativeGesturesCheckboxDiv extends CheckboxDiv {
6
+ changeHandler = (event, element) => {
7
+ const checkboxChecked = this.isCheckboxChecked();
8
+
9
+ checkboxChecked ?
10
+ controller.restoreNativeGestures() :
11
+ controller.suppressNativeGestures();
12
+ }
13
+
14
+ parentContext() {
15
+ const checkRestoreNativeGesturesCheckbox = this.checkCheckbox.bind(this), ///
16
+ uncheckRestoreNativeGesturesCheckbox = this.uncheckCheckbox.bind(this); ///
17
+
18
+ return ({
19
+ checkRestoreNativeGesturesCheckbox,
20
+ uncheckRestoreNativeGesturesCheckbox
21
+ });
22
+ }
23
+
24
+ static message = "Restore native gestures";
25
+
26
+ static defaultProperties = {
27
+ className: "restore-native-gestures"
28
+ };
29
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ import withStyle from "easy-with-style"; ///
4
+
5
+ import Element from "../element";
6
+
7
+ import Span from "../span";
8
+ import Checkbox from "../checkbox";
9
+
10
+ import { checkboxDivGap } from "../../styles";
11
+
12
+ class CheckboxDiv extends Element {
13
+ childElements() {
14
+ const { message } = this.constructor;
15
+
16
+ return ([
17
+
18
+ <Checkbox onChange={this.changeHandler} />,
19
+ <Span>
20
+ {message}
21
+ </Span>
22
+
23
+ ]);
24
+ }
25
+
26
+ initialise() {
27
+ this.assignContext();
28
+ }
29
+
30
+ static tagName = "div";
31
+
32
+ static defaultProperties = {
33
+ className: "checkbox"
34
+ };
35
+ }
36
+
37
+ export default withStyle(CheckboxDiv)`
38
+
39
+ gap: ${checkboxDivGap};
40
+ display: flex;
41
+ align-items: flex-start;
42
+ flex-direction: row;
43
+ justify-content: flex-start;
44
+
45
+ `;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ import withStyle from "easy-with-style"; ///
4
+
5
+ import Element from "../element";
6
+ import InvertColoursCheckboxDiv from "./checkbox/invertColours";
7
+ import RestoreNativeGesturesCheckboxDiv from "./checkbox/restoreNativeGestures";
8
+
9
+ import { checkboxesDivGap } from "../../styles";
10
+
11
+ class CheckboxesDiv extends Element {
12
+ childElements() {
13
+ return ([
14
+
15
+ <InvertColoursCheckboxDiv/>,
16
+ <RestoreNativeGesturesCheckboxDiv/>
17
+
18
+ ]);
19
+ }
20
+
21
+ static tagName = "div";
22
+
23
+ static defaultProperties = {
24
+ className: "checkboxes"
25
+ };
26
+ }
27
+
28
+ export default withStyle(CheckboxesDiv)`
29
+
30
+ gap: ${checkboxesDivGap};
31
+ display: flex;
32
+ flex-wrap: wrap;
33
+ flex-direction: row;
34
+ justify-content: flex-start;
35
+
36
+ `;
@@ -1,46 +1,101 @@
1
1
  "use strict";
2
2
 
3
- import withStyle from "easy-with-style";
3
+ import withStyle from "easy-with-style"; ///
4
4
 
5
- import { Element } from "easy";
5
+ import Element from "../element";
6
+ import ButtonsDiv from "../div/buttons";
7
+ import CheckboxesDiv from "../div/checkboxes";
6
8
 
7
- import touchMixins from "../../mixins/touch";
8
-
9
- import { menuDivHeight } from "../../style";
9
+ import { GRID, ZOOM_RATIO } from "../../constants";
10
+ import { borderColour, menuDivPadding, backgroundColour } from "../../styles";
11
+ import { getMenuDivZoom as getZoom, setMenuDivZoom as setZoom } from "../../state";
10
12
 
11
13
  class MenuDiv extends Element {
12
- customTapHandler = (event, element) => {
13
- alert("MENU DIV TAP!")
14
+ zoomMenuOut() {
15
+ let zoom = getZoom();
16
+
17
+ zoom /= ZOOM_RATIO;
18
+
19
+ setZoom(zoom);
20
+
21
+ this.updateZoom();
14
22
  }
15
23
 
16
- didMount() {
17
- this.enableTouch();
24
+ zoomMenuIn() {
25
+ let zoom = getZoom();
26
+
27
+ zoom *= ZOOM_RATIO;
18
28
 
19
- this.onCustomTap(this.customTapHandler);
29
+ setZoom(zoom);
30
+
31
+ this.updateZoom();
20
32
  }
21
33
 
22
- willUnmount() {
23
- this.disableTouch();
34
+ updateZoom() {
35
+ const zoom = getZoom(),
36
+ width = `${100/zoom}%`,
37
+ transform = `scale(${zoom})`,
38
+ css = {
39
+ width,
40
+ transform
41
+ };
24
42
 
25
- this.offCustomTap(this.customTapHandler);
43
+ this.css(css);
26
44
  }
27
45
 
28
- initialise() {
46
+ show() {
47
+ const display = GRID;
48
+
49
+ this.display(display);
50
+ }
51
+
52
+ openMenu() {
53
+ this.show();
54
+ }
55
+
56
+ closeMenu() {
29
57
  this.hide();
30
58
  }
31
59
 
60
+ didMount() {
61
+ this.updateZoom();
62
+ }
63
+
64
+ willUnmount() {
65
+ ///
66
+ }
67
+
68
+ childElements() {
69
+ return ([
70
+
71
+ <CheckboxesDiv/>,
72
+ <ButtonsDiv/>
73
+
74
+ ]);
75
+ }
76
+
32
77
  parentContext() {
33
- const showMenuDiv = this.show.bind(this), ///
34
- hideMenuDiv = this.hide.bind(this), ///
35
- isMenuDivDisplayed = this.isDisplayed.bind(this); ///
78
+ const context = this.getContext(),
79
+ openMenu = this.openMenu.bind(this),
80
+ closeMenu = this.closeMenu.bind(this),
81
+ zoomMenuIn = this.zoomMenuIn.bind(this),
82
+ zoomMenuOut = this.zoomMenuOut.bind(this),
83
+ updateMenuDivZoom = this.updateZoom.bind(this); ///
36
84
 
37
85
  return ({
38
- showMenuDiv,
39
- hideMenuDiv,
40
- isMenuDivDisplayed
86
+ ...context,
87
+ openMenu,
88
+ closeMenu,
89
+ zoomMenuIn,
90
+ zoomMenuOut,
91
+ updateMenuDivZoom
41
92
  });
42
93
  }
43
94
 
95
+ initialise() {
96
+ this.hide();
97
+ }
98
+
44
99
  static tagName = "div";
45
100
 
46
101
  static defaultProperties = {
@@ -48,15 +103,17 @@ class MenuDiv extends Element {
48
103
  };
49
104
  }
50
105
 
51
- Object.assign(MenuDiv.prototype, touchMixins);
52
-
53
106
  export default withStyle(MenuDiv)`
54
107
 
55
108
  left: 0;
56
- width: 100%;
57
- height: ${menuDivHeight};
58
109
  bottom: 0;
110
+ display: grid;
111
+ padding: ${menuDivPadding};
59
112
  position: fixed;
60
- background-color: black;
61
-
113
+ border-top: 1px solid ${borderColour};
114
+ background-color: ${backgroundColour};
115
+ transform-origin: bottom left;
116
+ grid-template-rows: auto;
117
+ grid-template-columns: auto min-content;
118
+
62
119
  `;