@mxtommy/kip 1.3.0 → 2.0.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.
Files changed (273) hide show
  1. package/CHANGELOG.md +38 -3
  2. package/CONTRIBUTORS.md +4 -4
  3. package/KipGaugeSample3-1024x508.png +0 -0
  4. package/LICENSE +21 -0
  5. package/README.md +80 -42
  6. package/package.json +52 -46
  7. package/public/3rdpartylicenses.txt +61 -412
  8. package/public/assets/NoSleep.min.js +2 -2
  9. package/public/assets/icon-64x64.png +0 -0
  10. package/public/index.html +3 -3
  11. package/public/main.9dba30de44eed02b.js +1 -0
  12. package/public/manifest.json +9 -4
  13. package/public/polyfills.d1da7d2e907c253a.js +1 -0
  14. package/public/runtime.e75056c32c37f59d.js +1 -0
  15. package/public/styles.6b1c2c92be18a2cc.css +1 -0
  16. package/.angulardoc.json +0 -4
  17. package/angular.json +0 -162
  18. package/e2e/app.e2e-spec.ts +0 -14
  19. package/e2e/app.po.ts +0 -11
  20. package/e2e/tsconfig.e2e.json +0 -14
  21. package/karma.conf.js +0 -31
  22. package/public/main-es2018.98175eb4c61ccaf7eb17.js +0 -1
  23. package/public/main-es5.98175eb4c61ccaf7eb17.js +0 -1
  24. package/public/polyfills-es2018.3a61665863c173cd6ba3.js +0 -1
  25. package/public/polyfills-es5.44827ae4ff4e41de51fb.js +0 -1
  26. package/public/runtime-es2018.baedb88c6d2abacae2b8.js +0 -1
  27. package/public/runtime-es5.baedb88c6d2abacae2b8.js +0 -1
  28. package/public/styles.b92ae2c466c89712209d.css +0 -5
  29. package/src/app/alarm-menu/alarm-menu.component.html +0 -55
  30. package/src/app/alarm-menu/alarm-menu.component.scss +0 -52
  31. package/src/app/alarm-menu/alarm-menu.component.spec.ts +0 -25
  32. package/src/app/alarm-menu/alarm-menu.component.ts +0 -186
  33. package/src/app/app-help/app-help.component.css +0 -4
  34. package/src/app/app-help/app-help.component.html +0 -135
  35. package/src/app/app-help/app-help.component.ts +0 -45
  36. package/src/app/app-settings.service.spec.ts +0 -15
  37. package/src/app/app-settings.service.ts +0 -478
  38. package/src/app/app.component.css +0 -39
  39. package/src/app/app.component.html +0 -93
  40. package/src/app/app.component.scss +0 -79
  41. package/src/app/app.component.spec.ts +0 -32
  42. package/src/app/app.component.ts +0 -191
  43. package/src/app/app.module.ts +0 -200
  44. package/src/app/config.blank.const.ts +0 -52
  45. package/src/app/config.blank.notification.const.ts +0 -19
  46. package/src/app/config.blank.units.const.ts +0 -23
  47. package/src/app/config.demo.const.ts +0 -384
  48. package/src/app/data-browser/data-browser.component.css +0 -29
  49. package/src/app/data-browser/data-browser.component.html +0 -44
  50. package/src/app/data-browser/data-browser.component.spec.ts +0 -25
  51. package/src/app/data-browser/data-browser.component.ts +0 -91
  52. package/src/app/data-browser-row/data-browser-row-unit-modal.html +0 -17
  53. package/src/app/data-browser-row/data-browser-row.component.css +0 -10
  54. package/src/app/data-browser-row/data-browser-row.component.html +0 -5
  55. package/src/app/data-browser-row/data-browser-row.component.ts +0 -79
  56. package/src/app/data-set.service.spec.ts +0 -15
  57. package/src/app/data-set.service.ts +0 -273
  58. package/src/app/dynamic-widget.directive.spec.ts +0 -8
  59. package/src/app/dynamic-widget.directive.ts +0 -11
  60. package/src/app/filter-self.pipe.spec.ts +0 -8
  61. package/src/app/filter-self.pipe.ts +0 -14
  62. package/src/app/fit-text.directive.spec.ts +0 -8
  63. package/src/app/fit-text.directive.ts +0 -61
  64. package/src/app/gauge-steel/gauge-steel.component.css +0 -5
  65. package/src/app/gauge-steel/gauge-steel.component.html +0 -4
  66. package/src/app/gauge-steel/gauge-steel.component.spec.ts +0 -25
  67. package/src/app/gauge-steel/gauge-steel.component.ts +0 -282
  68. package/src/app/gauges-module/base-gauge.ts +0 -301
  69. package/src/app/gauges-module/gauges.module.ts +0 -17
  70. package/src/app/gauges-module/linear-gauge.ts +0 -50
  71. package/src/app/gauges-module/radial-gauge.ts +0 -48
  72. package/src/app/layout-split/layout-split.component.html +0 -30
  73. package/src/app/layout-split/layout-split.component.scss +0 -33
  74. package/src/app/layout-split/layout-split.component.spec.ts +0 -25
  75. package/src/app/layout-split/layout-split.component.ts +0 -59
  76. package/src/app/layout-splits.service.spec.ts +0 -15
  77. package/src/app/layout-splits.service.ts +0 -284
  78. package/src/app/modal-path-selector/modal-path-selector.component.html +0 -62
  79. package/src/app/modal-path-selector/modal-path-selector.component.scss +0 -39
  80. package/src/app/modal-path-selector/modal-path-selector.component.spec.ts +0 -25
  81. package/src/app/modal-path-selector/modal-path-selector.component.ts +0 -132
  82. package/src/app/modal-widget/modal-widget.component.css +0 -33
  83. package/src/app/modal-widget/modal-widget.component.html +0 -341
  84. package/src/app/modal-widget/modal-widget.component.spec.ts +0 -25
  85. package/src/app/modal-widget/modal-widget.component.ts +0 -84
  86. package/src/app/notifications.service.spec.ts +0 -12
  87. package/src/app/notifications.service.ts +0 -392
  88. package/src/app/object-keys.pipe.spec.ts +0 -8
  89. package/src/app/object-keys.pipe.ts +0 -13
  90. package/src/app/reset-config/reset-config.component.css +0 -0
  91. package/src/app/reset-config/reset-config.component.html +0 -3
  92. package/src/app/reset-config/reset-config.component.spec.ts +0 -25
  93. package/src/app/reset-config/reset-config.component.ts +0 -31
  94. package/src/app/root-display/root-display.component.css +0 -0
  95. package/src/app/root-display/root-display.component.html +0 -4
  96. package/src/app/root-display/root-display.component.spec.ts +0 -25
  97. package/src/app/root-display/root-display.component.ts +0 -57
  98. package/src/app/safe.pipe.ts +0 -16
  99. package/src/app/settings/settings.component.css +0 -9
  100. package/src/app/settings/settings.component.html +0 -25
  101. package/src/app/settings/settings.component.spec.ts +0 -25
  102. package/src/app/settings/settings.component.ts +0 -22
  103. package/src/app/settings-config/settings-config.component.css +0 -39
  104. package/src/app/settings-config/settings-config.component.html +0 -118
  105. package/src/app/settings-config/settings-config.component.spec.ts +0 -25
  106. package/src/app/settings-config/settings-config.component.ts +0 -161
  107. package/src/app/settings-datasets/settings-datasets.component.html +0 -43
  108. package/src/app/settings-datasets/settings-datasets.component.scss +0 -39
  109. package/src/app/settings-datasets/settings-datasets.component.spec.ts +0 -25
  110. package/src/app/settings-datasets/settings-datasets.component.ts +0 -98
  111. package/src/app/settings-datasets/settings-datasets.modal.html +0 -54
  112. package/src/app/settings-notifications/settings-notifications.component.css +0 -0
  113. package/src/app/settings-notifications/settings-notifications.component.html +0 -65
  114. package/src/app/settings-notifications/settings-notifications.component.spec.ts +0 -25
  115. package/src/app/settings-notifications/settings-notifications.component.ts +0 -29
  116. package/src/app/settings-signalk/settings-signalk.component.css +0 -3
  117. package/src/app/settings-signalk/settings-signalk.component.html +0 -89
  118. package/src/app/settings-signalk/settings-signalk.component.spec.ts +0 -25
  119. package/src/app/settings-signalk/settings-signalk.component.ts +0 -174
  120. package/src/app/settings-units/settings-units.component.css +0 -4
  121. package/src/app/settings-units/settings-units.component.html +0 -19
  122. package/src/app/settings-units/settings-units.component.spec.ts +0 -25
  123. package/src/app/settings-units/settings-units.component.ts +0 -62
  124. package/src/app/settings-zones/settings-zones.component.css +0 -22
  125. package/src/app/settings-zones/settings-zones.component.html +0 -70
  126. package/src/app/settings-zones/settings-zones.component.ts +0 -154
  127. package/src/app/settings-zones/settings-zones.modal.css +0 -14
  128. package/src/app/settings-zones/settings-zones.modal.html +0 -39
  129. package/src/app/signalk-connection.service.ts +0 -344
  130. package/src/app/signalk-delta.service.spec.ts +0 -15
  131. package/src/app/signalk-delta.service.ts +0 -97
  132. package/src/app/signalk-full.service.spec.ts +0 -15
  133. package/src/app/signalk-full.service.ts +0 -99
  134. package/src/app/signalk-interfaces.ts +0 -129
  135. package/src/app/signalk-requests.service.spec.ts +0 -12
  136. package/src/app/signalk-requests.service.ts +0 -180
  137. package/src/app/signalk.service.spec.ts +0 -15
  138. package/src/app/signalk.service.ts +0 -428
  139. package/src/app/svg-autopilot/svg-autopilot.component.html +0 -1036
  140. package/src/app/svg-autopilot/svg-autopilot.component.spec.ts +0 -25
  141. package/src/app/svg-autopilot/svg-autopilot.component.ts +0 -174
  142. package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.html +0 -119
  143. package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.scss +0 -0
  144. package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.spec.ts +0 -25
  145. package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.ts +0 -49
  146. package/src/app/svg-wind/svg-wind.component.css +0 -0
  147. package/src/app/svg-wind/svg-wind.component.html +0 -969
  148. package/src/app/svg-wind/svg-wind.component.scss +0 -76
  149. package/src/app/svg-wind/svg-wind.component.spec.ts +0 -25
  150. package/src/app/svg-wind/svg-wind.component.ts +0 -280
  151. package/src/app/unit-window/unit-window.component.css +0 -37
  152. package/src/app/unit-window/unit-window.component.html +0 -8
  153. package/src/app/unit-window/unit-window.component.spec.ts +0 -25
  154. package/src/app/unit-window/unit-window.component.ts +0 -134
  155. package/src/app/unit-window/unit-window.modal.html +0 -25
  156. package/src/app/units.service.ts +0 -300
  157. package/src/app/widget-autopilot/widget-autopilot.component.html +0 -78
  158. package/src/app/widget-autopilot/widget-autopilot.component.scss +0 -191
  159. package/src/app/widget-autopilot/widget-autopilot.component.spec.ts +0 -25
  160. package/src/app/widget-autopilot/widget-autopilot.component.ts +0 -774
  161. package/src/app/widget-blank/widget-blank.component.html +0 -5
  162. package/src/app/widget-blank/widget-blank.component.scss +0 -21
  163. package/src/app/widget-blank/widget-blank.component.spec.ts +0 -25
  164. package/src/app/widget-blank/widget-blank.component.ts +0 -17
  165. package/src/app/widget-gauge/widget-gauge.component.css +0 -26
  166. package/src/app/widget-gauge/widget-gauge.component.html +0 -29
  167. package/src/app/widget-gauge/widget-gauge.component.spec.ts +0 -25
  168. package/src/app/widget-gauge/widget-gauge.component.ts +0 -120
  169. package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.html +0 -126
  170. package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.scss +0 -94
  171. package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.spec.ts +0 -25
  172. package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.ts +0 -424
  173. package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.html +0 -122
  174. package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.scss +0 -69
  175. package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.spec.ts +0 -25
  176. package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.ts +0 -553
  177. package/src/app/widget-historical/widget-historical.component.css +0 -31
  178. package/src/app/widget-historical/widget-historical.component.html +0 -14
  179. package/src/app/widget-historical/widget-historical.component.scss +0 -0
  180. package/src/app/widget-historical/widget-historical.component.spec.ts +0 -25
  181. package/src/app/widget-historical/widget-historical.component.ts +0 -306
  182. package/src/app/widget-iframe/widget-iframe.component.css +0 -12
  183. package/src/app/widget-iframe/widget-iframe.component.html +0 -21
  184. package/src/app/widget-iframe/widget-iframe.component.spec.ts +0 -25
  185. package/src/app/widget-iframe/widget-iframe.component.ts +0 -63
  186. package/src/app/widget-list.service.spec.ts +0 -15
  187. package/src/app/widget-list.service.ts +0 -135
  188. package/src/app/widget-manager.service.spec.ts +0 -15
  189. package/src/app/widget-manager.service.ts +0 -141
  190. package/src/app/widget-numeric/widget-numeric.component.html +0 -13
  191. package/src/app/widget-numeric/widget-numeric.component.scss +0 -52
  192. package/src/app/widget-numeric/widget-numeric.component.spec.ts +0 -25
  193. package/src/app/widget-numeric/widget-numeric.component.ts +0 -457
  194. package/src/app/widget-simple-linear/widget-simple-linear.component.html +0 -28
  195. package/src/app/widget-simple-linear/widget-simple-linear.component.scss +0 -64
  196. package/src/app/widget-simple-linear/widget-simple-linear.component.spec.ts +0 -25
  197. package/src/app/widget-simple-linear/widget-simple-linear.component.ts +0 -199
  198. package/src/app/widget-state/widget-state.component.html +0 -27
  199. package/src/app/widget-state/widget-state.component.scss +0 -68
  200. package/src/app/widget-state/widget-state.component.spec.ts +0 -25
  201. package/src/app/widget-state/widget-state.component.ts +0 -178
  202. package/src/app/widget-switch/widget-switch.component.css +0 -70
  203. package/src/app/widget-switch/widget-switch.component.html +0 -17
  204. package/src/app/widget-switch/widget-switch.component.spec.ts +0 -25
  205. package/src/app/widget-switch/widget-switch.component.ts +0 -134
  206. package/src/app/widget-text-generic/widget-text-generic.component.css +0 -55
  207. package/src/app/widget-text-generic/widget-text-generic.component.html +0 -9
  208. package/src/app/widget-text-generic/widget-text-generic.component.spec.ts +0 -25
  209. package/src/app/widget-text-generic/widget-text-generic.component.ts +0 -253
  210. package/src/app/widget-tutorial/widget-tutorial.component.css +0 -0
  211. package/src/app/widget-tutorial/widget-tutorial.component.html +0 -34
  212. package/src/app/widget-tutorial/widget-tutorial.component.spec.ts +0 -25
  213. package/src/app/widget-tutorial/widget-tutorial.component.ts +0 -18
  214. package/src/app/widget-unknown/widget-unknown.component.css +0 -0
  215. package/src/app/widget-unknown/widget-unknown.component.html +0 -3
  216. package/src/app/widget-unknown/widget-unknown.component.spec.ts +0 -25
  217. package/src/app/widget-unknown/widget-unknown.component.ts +0 -15
  218. package/src/app/widget-wind/widget-wind.component.css +0 -24
  219. package/src/app/widget-wind/widget-wind.component.html +0 -20
  220. package/src/app/widget-wind/widget-wind.component.spec.ts +0 -25
  221. package/src/app/widget-wind/widget-wind.component.ts +0 -369
  222. package/src/assets/.gitkeep +0 -0
  223. package/src/assets/NoSleep.min.js +0 -2
  224. package/src/assets/alarm.mp3 +0 -0
  225. package/src/assets/alert.mp3 +0 -0
  226. package/src/assets/alertl.old.mp3 +0 -0
  227. package/src/assets/emergency.mp3 +0 -0
  228. package/src/assets/fontawesome6/css/all.min.css +0 -6
  229. package/src/assets/fontawesome6/webfonts/fa-brands-400.ttf +0 -0
  230. package/src/assets/fontawesome6/webfonts/fa-brands-400.woff2 +0 -0
  231. package/src/assets/fontawesome6/webfonts/fa-regular-400.ttf +0 -0
  232. package/src/assets/fontawesome6/webfonts/fa-regular-400.woff2 +0 -0
  233. package/src/assets/fontawesome6/webfonts/fa-solid-900.ttf +0 -0
  234. package/src/assets/fontawesome6/webfonts/fa-solid-900.woff2 +0 -0
  235. package/src/assets/fontawesome6/webfonts/fa-v4compatibility.ttf +0 -0
  236. package/src/assets/fontawesome6/webfonts/fa-v4compatibility.woff2 +0 -0
  237. package/src/assets/icon-192x192.png +0 -0
  238. package/src/assets/icon-256x256.png +0 -0
  239. package/src/assets/icon-384x384.png +0 -0
  240. package/src/assets/icon-512x512.png +0 -0
  241. package/src/assets/notification.mp3 +0 -0
  242. package/src/assets/steelseries-min.js +0 -25
  243. package/src/assets/steelseries-min.js.map +0 -8
  244. package/src/assets/steelseries.js +0 -15834
  245. package/src/assets/svg-autopilot-inkscape-plain.svg +0 -983
  246. package/src/assets/svg-wind-inkscape.svg +0 -1358
  247. package/src/assets/tween-min.js +0 -1
  248. package/src/assets/tween.js +0 -381
  249. package/src/assets/warn.mp3 +0 -0
  250. package/src/environments/environment.prod.ts +0 -3
  251. package/src/environments/environment.ts +0 -8
  252. package/src/favicon.ico +0 -0
  253. package/src/index.html +0 -20
  254. package/src/main.ts +0 -11
  255. package/src/manifest.json +0 -33
  256. package/src/polyfills.ts +0 -80
  257. package/src/styles.css +0 -47
  258. package/src/styles.scss +0 -157
  259. package/src/test.ts +0 -32
  260. package/src/themes/darkBlueTheme.scss +0 -117
  261. package/src/themes/defaultTheme.scss +0 -50
  262. package/src/themes/highContrastTheme.scss +0 -47
  263. package/src/themes/modernTheme.scss +0 -143
  264. package/src/themes/nightMode.scss +0 -185
  265. package/src/themes/platypusTheme.scss +0 -80
  266. package/src/themes/signalkTheme.scss +0 -112
  267. package/src/tsconfig.app.json +0 -15
  268. package/src/tsconfig.spec.json +0 -20
  269. package/src/typings.d.ts +0 -5
  270. package/tsconfig.json +0 -24
  271. package/tslint.json +0 -143
  272. /package/{KipGaugeSample-1-1024x545.png → KipGaugeSample1-1024x545.png} +0 -0
  273. /package/{KipMonitor-1024x488.png → KipGaugeSample2-1024x488.png} +0 -0
@@ -1,17 +0,0 @@
1
- <div class="mainWrapper">
2
-
3
- <div class="switchContainer">
4
- <label class="switch">
5
- <input #switchSlider type="checkbox" [checked]="state" (change)="sendDelta(switchSlider.checked)">
6
- <span class="slider"></span>
7
- </label>
8
- </div>
9
-
10
-
11
- <div class="settingsButton" *ngIf="unlockStatus">
12
- <button color="accent" mat-mini-fab class="selector-fab" (click)="openWidgetSettings()">
13
- <span class="fa-solid fa-cog"></span>
14
- </button>
15
- </div>
16
-
17
- </div>
@@ -1,25 +0,0 @@
1
- import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
-
3
- import { WidgetSwitchComponent } from './widget-switch.component';
4
-
5
- describe('WidgetSwitchComponent', () => {
6
- let component: WidgetSwitchComponent;
7
- let fixture: ComponentFixture<WidgetSwitchComponent>;
8
-
9
- beforeEach(waitForAsync(() => {
10
- TestBed.configureTestingModule({
11
- declarations: [ WidgetSwitchComponent ]
12
- })
13
- .compileComponents();
14
- }));
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(WidgetSwitchComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should be created', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,134 +0,0 @@
1
- import { Component, Input, OnInit, OnDestroy, Inject } from '@angular/core';
2
- import { Subscription } from 'rxjs';
3
-
4
- import { MatDialog } from '@angular/material/dialog';
5
-
6
- import { ModalWidgetComponent } from '../modal-widget/modal-widget.component';
7
- import { SignalKService } from '../signalk.service';
8
- import { SignalkRequestsService, skRequest } from '../signalk-requests.service';
9
- import { WidgetManagerService, IWidget, IWidgetConfig } from '../widget-manager.service';
10
-
11
-
12
- const defaultConfig: IWidgetConfig = {
13
- displayName: null,
14
- filterSelfPaths: true,
15
- paths: {
16
- "statePath": {
17
- description: "State Data",
18
- path: null,
19
- source: null,
20
- pathType: "boolean",
21
- isPathConfigurable: true,
22
- convertUnitTo: "unitless"
23
- }
24
- },
25
- };
26
-
27
- @Component({
28
- selector: 'app-widget-switch',
29
- templateUrl: './widget-switch.component.html',
30
- styleUrls: ['./widget-switch.component.css']
31
- })
32
- export class WidgetSwitchComponent implements OnInit, OnDestroy {
33
-
34
- @Input('widgetUUID') widgetUUID: string;
35
- @Input('unlockStatus') unlockStatus: boolean;
36
-
37
- activeWidget: IWidget;
38
- config: IWidgetConfig;
39
-
40
- dataValue: number = null;
41
- dataTimestamp: number = Date.now();
42
- valueSub: Subscription = null;
43
-
44
- skRequestSub: Subscription = null;
45
-
46
- state: boolean = null;
47
-
48
- constructor(
49
- public dialog:MatDialog,
50
- private SignalKService: SignalKService,
51
- private SignalkRequestsService: SignalkRequestsService,
52
- private WidgetManagerService: WidgetManagerService) {
53
- }
54
-
55
- ngOnInit() {
56
- this.activeWidget = this.WidgetManagerService.getWidget(this.widgetUUID);
57
- if (this.activeWidget.config === null) {
58
- // no data, let's set some!
59
- this.WidgetManagerService.updateWidgetConfig(this.widgetUUID, defaultConfig);
60
- this.config = defaultConfig; // load default config.
61
- } else {
62
- this.config = this.activeWidget.config;
63
- }
64
- this.subscribePath();
65
- this.subscribeSKRequest();
66
- }
67
-
68
- ngOnDestroy() {
69
- this.unsubscribePath();
70
- this.unsubscribeSKRequest();
71
- }
72
-
73
- subscribePath() {
74
- this.unsubscribePath();
75
- if (typeof(this.config.paths['statePath'].path) != 'string') { return } // nothing to sub to...
76
-
77
- this.valueSub = this.SignalKService.subscribePath(this.widgetUUID, this.config.paths['statePath'].path, this.config.paths['statePath'].source).subscribe(
78
- newValue => {
79
- this.state = newValue.value;
80
- }
81
- );
82
- }
83
-
84
- unsubscribePath() {
85
- if (this.valueSub !== null) {
86
- this.valueSub.unsubscribe();
87
- this.valueSub = null;
88
- this.SignalKService.unsubscribePath(this.widgetUUID, this.config.paths['statePath'].path);
89
- }
90
- }
91
-
92
- subscribeSKRequest() {
93
- this.skRequestSub = this.SignalkRequestsService.subscribeRequest().subscribe(requestResult => {
94
- if (requestResult.widgetUUID == this.widgetUUID) {
95
- if (requestResult.statusCode != 200){
96
- let errMsg = requestResult.statusCode + " - " +requestResult.statusCodeDescription;
97
- if (requestResult.message){
98
- errMsg = errMsg + " Server Message: " + requestResult.message;
99
- }
100
- alert('[Widget Name: ' + errMsg);
101
- } else {
102
- console.log("AP Received: \n" + JSON.stringify(requestResult));
103
- }
104
- }
105
- });
106
- }
107
-
108
- unsubscribeSKRequest() {
109
- this.skRequestSub.unsubscribe();
110
- }
111
-
112
- sendDelta(value: boolean) {
113
- this.SignalkRequestsService.putRequest(this.config.paths['statePath'].path, value, this.widgetUUID);
114
- }
115
-
116
- openWidgetSettings() {
117
- let dialogRef = this.dialog.open(ModalWidgetComponent, {
118
- width: '80%',
119
- data: this.config
120
- });
121
-
122
- dialogRef.afterClosed().subscribe(result => {
123
- // save new settings
124
- if (result) {
125
- console.log(result);
126
- this.unsubscribePath();//unsub now as we will change variables so wont know what was subbed before...
127
- this.config = result;
128
- this.WidgetManagerService.updateWidgetConfig(this.widgetUUID, this.config);
129
- this.subscribePath();
130
- }
131
- });
132
- }
133
-
134
- }
@@ -1,55 +0,0 @@
1
- canvas {
2
- position: absolute;
3
- top: 0;
4
- left: 0;
5
- }
6
-
7
-
8
- .textGenericWrapper {
9
- position: relative;
10
- width: 100%;
11
- height: 100%;
12
- }
13
- .textGenericLabel {
14
- position: absolute;
15
- top: 5%;
16
- left: 5%;
17
-
18
- }
19
-
20
- .textGenericValue {
21
- position: absolute;
22
- width: 100%;
23
- height: 100%;
24
- display: flex;
25
- align-items: center;
26
- justify-content: center;
27
- font-family: "Arial", Times, serif;
28
- font-weight: bold;
29
- }
30
-
31
- .textGenericUnit {
32
- position: absolute;
33
- bottom: 5%;
34
- right: 5%;
35
- }
36
-
37
-
38
- .settingsButton {
39
- position: absolute;
40
- bottom: 5%;
41
- left: 50%;
42
- transform: translate(-50%);
43
- }
44
-
45
- .tab-group {
46
- border: 1px solid #e8e8e8;
47
- }
48
-
49
- .tab-content {
50
- padding: 16px;
51
- }
52
-
53
- .full-width {
54
- width: 100%;
55
- }
@@ -1,9 +0,0 @@
1
- <div #wrapperDiv class="textGenericWrapper">
2
- <canvas id="canvasValue" #canvasEl></canvas>
3
- <canvas id="cancasBG" #canvasBG></canvas>
4
- <div class="settingsButton" *ngIf="unlockStatus">
5
- <button color="accent" mat-mini-fab class="selector-fab" (click)="openWidgetSettings()">
6
- <span class="fa-solid fa-cog"></span>
7
- </button>
8
- </div>
9
- </div>
@@ -1,25 +0,0 @@
1
- import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
-
3
- import { WidgetTextGenericComponent } from './widget-text-generic.component';
4
-
5
- describe('WidgetTextGenericComponent', () => {
6
- let component: WidgetTextGenericComponent;
7
- let fixture: ComponentFixture<WidgetTextGenericComponent>;
8
-
9
- beforeEach(waitForAsync(() => {
10
- TestBed.configureTestingModule({
11
- declarations: [ WidgetTextGenericComponent ]
12
- })
13
- .compileComponents();
14
- }));
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(WidgetTextGenericComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should be created', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,253 +0,0 @@
1
- import { Component, Input, OnInit, OnDestroy, ViewChild, ElementRef, AfterViewChecked } from '@angular/core';
2
- import { Subscription } from 'rxjs';
3
- import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
4
-
5
- import { ModalWidgetComponent } from '../modal-widget/modal-widget.component';
6
- import { SignalKService } from '../signalk.service';
7
- import { AppSettingsService } from '../app-settings.service';
8
- import { WidgetManagerService, IWidget, IWidgetConfig } from '../widget-manager.service';
9
- import { isNull } from 'util';
10
-
11
-
12
- const defaultConfig: IWidgetConfig = {
13
- displayName: null,
14
- filterSelfPaths: true,
15
- paths: {
16
- "stringPath": {
17
- description: "String Data",
18
- path: null,
19
- source: null,
20
- pathType: "string",
21
- isPathConfigurable: true,
22
- }
23
- },
24
- };
25
-
26
- @Component({
27
- selector: 'app-widget-text-generic',
28
- templateUrl: './widget-text-generic.component.html',
29
- styleUrls: ['./widget-text-generic.component.css']
30
- })
31
- export class WidgetTextGenericComponent implements OnInit, OnDestroy {
32
-
33
- @Input('widgetUUID') widgetUUID: string;
34
- @Input('unlockStatus') unlockStatus: boolean;
35
- @ViewChild('canvasEl', {static: true, read: ElementRef}) canvasEl: ElementRef;
36
- @ViewChild('canvasBG', {static: true, read: ElementRef}) canvasBG: ElementRef;
37
- @ViewChild('wrapperDiv', {static: true, read: ElementRef}) wrapperDiv: ElementRef;
38
-
39
- activeWidget: IWidget;
40
- config: IWidgetConfig;
41
-
42
- dataValue: any = null;
43
-
44
- dataTimestamp: number = Date.now();
45
-
46
- valueFontSize: number = 1;
47
- currentValueLength: number = 0; // length (in charaters) of value text to be displayed. if changed from last time, need to recalculate font size...
48
- canvasCtx;
49
- canvasBGCtx;
50
-
51
- //subs
52
- valueSub: Subscription = null;
53
-
54
- // dynamics theme support
55
- themeNameSub: Subscription = null;
56
-
57
-
58
- constructor(
59
- public dialog:MatDialog,
60
- private SignalKService: SignalKService,
61
- private WidgetManagerService: WidgetManagerService,
62
- private AppSettingsService: AppSettingsService, // need for theme change subscription
63
- ) {
64
- }
65
-
66
- ngOnInit() {
67
- this.activeWidget = this.WidgetManagerService.getWidget(this.widgetUUID);
68
- if (this.activeWidget.config === null) {
69
- // no data, let's set some!
70
- this.WidgetManagerService.updateWidgetConfig(this.widgetUUID, defaultConfig);
71
- this.config = defaultConfig; // load default config.
72
- } else {
73
- this.config = this.activeWidget.config;
74
- }
75
-
76
- this.canvasCtx = this.canvasEl.nativeElement.getContext('2d');
77
- this.canvasBGCtx = this.canvasBG.nativeElement.getContext('2d');
78
-
79
- this.subscribePath();
80
- this.subscribeTheme();
81
- this.resizeWidget();
82
- }
83
-
84
- ngOnDestroy() {
85
- this.unsubscribePath();
86
- this.unsubscribeTheme();
87
- }
88
-
89
- ngAfterViewChecked() {
90
- this.resizeWidget();
91
- }
92
-
93
- resizeWidget() {
94
- let rect = this.wrapperDiv.nativeElement.getBoundingClientRect();
95
-
96
- if (rect.height < 50) { return; }
97
- if (rect.width < 50) { return; }
98
- if ((this.canvasEl.nativeElement.width != Math.floor(rect.width)) || (this.canvasEl.nativeElement.height != Math.floor(rect.height))) {
99
- this.canvasEl.nativeElement.width = Math.floor(rect.width);
100
- this.canvasEl.nativeElement.height = Math.floor(rect.height);
101
- this.canvasBG.nativeElement.width = Math.floor(rect.width);
102
- this.canvasBG.nativeElement.height = Math.floor(rect.height);
103
- this.currentValueLength = 0; //will force resetting the font size
104
- this.updateCanvas();
105
- this.updateCanvasBG();
106
- }
107
-
108
- }
109
-
110
-
111
- subscribePath() {
112
- this.unsubscribePath();
113
- if (typeof(this.config.paths['stringPath'].path) != 'string') { return } // nothing to sub to...
114
- this.valueSub = this.SignalKService.subscribePath(this.widgetUUID, this.config.paths['stringPath'].path, this.config.paths['stringPath'].source).subscribe(
115
- newValue => {
116
- this.dataValue = newValue.value;
117
- this.updateCanvas();
118
- }
119
- );
120
- }
121
-
122
- unsubscribePath() {
123
- if (this.valueSub !== null) {
124
- this.valueSub.unsubscribe();
125
- this.valueSub = null;
126
- this.SignalKService.unsubscribePath(this.widgetUUID, this.config.paths['stringPath'].path)
127
- }
128
- }
129
- // Subscribe to theme event
130
- subscribeTheme() {
131
- this.themeNameSub = this.AppSettingsService.getThemeNameAsO().subscribe(
132
- themeChange => {
133
- setTimeout(() => { // need a delay so browser getComputedStyles has time to complete theme application.
134
- this.drawTitle();
135
- this.drawValue();
136
- }, 100);
137
- })
138
- }
139
-
140
- unsubscribeTheme(){
141
- if (this.themeNameSub !== null) {
142
- this.themeNameSub.unsubscribe();
143
- this.themeNameSub = null;
144
- }
145
- }
146
-
147
- openWidgetSettings(content) {
148
-
149
- let dialogRef = this.dialog.open(ModalWidgetComponent, {
150
- width: '80%',
151
- data: this.config
152
- });
153
-
154
- dialogRef.afterClosed().subscribe(result => {
155
- // save new settings
156
- if (result) {
157
- console.log(result);
158
- this.unsubscribePath();//unsub now as we will change variables so wont know what was subbed before...
159
- this.config = result;
160
- this.WidgetManagerService.updateWidgetConfig(this.widgetUUID, this.config);
161
- this.subscribePath();
162
- this.resizeWidget();
163
- }
164
-
165
- });
166
- }
167
-
168
-
169
- /* ******************************************************************************************* */
170
- /* ******************************************************************************************* */
171
- /* ******************************************************************************************* */
172
- /* Canvas */
173
- /* ******************************************************************************************* */
174
- /* ******************************************************************************************* */
175
- /* ******************************************************************************************* */
176
-
177
- updateCanvas() {
178
- if (this.canvasCtx) {
179
- this.canvasCtx.clearRect(0,0,this.canvasEl.nativeElement.width, this.canvasEl.nativeElement.height);
180
- this.drawValue();
181
- }
182
- }
183
-
184
- updateCanvasBG() {
185
- if (this.canvasBGCtx) {
186
- this.canvasBGCtx.clearRect(0,0,this.canvasEl.nativeElement.width, this.canvasEl.nativeElement.height);
187
- this.drawTitle();
188
- }
189
- }
190
-
191
- drawValue() {
192
- let maxTextWidth = Math.floor(this.canvasEl.nativeElement.width - (this.canvasEl.nativeElement.width * 0.15));
193
- let maxTextHeight = Math.floor(this.canvasEl.nativeElement.height - (this.canvasEl.nativeElement.height * 0.2));
194
- let valueText : string;
195
-
196
- if (this.dataValue === null) {
197
- valueText = "--";
198
- } else {
199
- valueText = this.dataValue;
200
- }
201
- //check if length of string has changed since laste time.
202
- if (this.currentValueLength != valueText.length) {
203
- //we need to set font size...
204
- this.currentValueLength = valueText.length;
205
-
206
- // start with large font, no sense in going bigger than the size of the canvas :)
207
- this.valueFontSize = maxTextHeight;
208
- this.canvasCtx.font = "bold " + this.valueFontSize.toString() + "px Arial";
209
- let measure = this.canvasCtx.measureText(valueText).width;
210
-
211
- // if we are not too wide, we stop there, maxHeight was our limit... if we're too wide, we need to scale back
212
- if (measure > maxTextWidth) {
213
- let estimateRatio = maxTextWidth / measure;
214
- this.valueFontSize = Math.floor(this.valueFontSize * estimateRatio);
215
- this.canvasCtx.font = "bold " + this.valueFontSize.toString() + "px Arial";
216
- }
217
- // now decrease by 1 to in case still too big
218
- while (this.canvasCtx.measureText(valueText).width > maxTextWidth && this.valueFontSize > 0) {
219
- this.valueFontSize--;
220
- this.canvasCtx.font = "bold " + this.valueFontSize.toString() + "px Arial";
221
- }
222
- }
223
-
224
- this.canvasCtx.font = "bold " + this.valueFontSize.toString() + "px Arial";
225
- this.canvasCtx.textAlign = "center";
226
- this.canvasCtx.textBaseline="middle";
227
- this.canvasCtx.fillStyle = window.getComputedStyle(this.wrapperDiv.nativeElement).color;
228
- this.canvasCtx.fillText(valueText,this.canvasEl.nativeElement.width/2,(this.canvasEl.nativeElement.height/2)+(this.valueFontSize/15), maxTextWidth);
229
- }
230
-
231
- drawTitle() {
232
- var maxTextWidth = Math.floor(this.canvasEl.nativeElement.width - (this.canvasEl.nativeElement.width * 0.2));
233
- var maxTextHeight = Math.floor(this.canvasEl.nativeElement.height - (this.canvasEl.nativeElement.height * 0.8));
234
- // set font small and make bigger until we hit a max.
235
- if (this.config.displayName === null) { return; }
236
- var fontSize = 1;
237
-
238
- this.canvasBGCtx.font = "bold " + fontSize.toString() + "px Arial"; // need to init it so we do loop at least once :)
239
- while ( (this.canvasBGCtx.measureText(this.config.displayName).width < maxTextWidth) && (fontSize < maxTextHeight)) {
240
- fontSize++;
241
- this.canvasBGCtx.font = "bold " + fontSize.toString() + "px Arial";
242
- }
243
-
244
- this.canvasBGCtx.textAlign = "left";
245
- this.canvasBGCtx.textBaseline="top";
246
- this.canvasBGCtx.fillStyle = window.getComputedStyle(this.wrapperDiv.nativeElement).color;
247
- this.canvasBGCtx.fillText(this.config.displayName,this.canvasEl.nativeElement.width*0.03,this.canvasEl.nativeElement.height*0.03, maxTextWidth);
248
- }
249
-
250
-
251
-
252
-
253
- }
@@ -1,34 +0,0 @@
1
- <h1>
2
- Welcome to KIP!
3
- </h1>
4
-
5
- <p>NOTES: For complete functionality, certain SignalK plugin should be installed on the server you are connecting to.</p>
6
- <ul>
7
- <li>@signalk-alarm-silencer: To silence Notifications on the server. This enables Kip to instruct the SignalK server to silence said alarm for on all devices supporting SignalK Notifications, else Kip will be silenced.</li>
8
- <li>@signalk/signalk-autopilot: required for the N2k Autopilot to function.<br/><b>Use the Kip N2k autopilot at your own risk. Use with caution and constant supervision.</b></li>
9
- </ul>
10
-
11
- <p>If you want to dive right in to see what KIP can do, you can use this button to load demo configuration:</p>
12
- <button mat-raised-button routerLink="/demo">Load Demo</button>
13
-
14
- <div *ngIf="!unlockStatus">
15
- <h2>Unlocking</h2>
16
- <p>
17
- KIP is "Locked" by default. This is to prevent accidental interaction from touch screens from changing anything.
18
- You can unlock KIP using the hamburger icon in the lower right corner and selecting "Configuration -> Edit Layout". Go Ahead try it now!
19
- </p>
20
- </div>
21
- <div *ngIf="unlockStatus">
22
- <h2>Configuring</h2>
23
- <p>
24
- Now that KIP is unlocked, you can do a few actions.
25
- </p>
26
- <ul>
27
- <li>The icon in the lower right can be used to select the Widget you would like to display</li>
28
- <li>The icon in the lower left can be used to "split" the existing area. You can use this to display multiple items on one page</li>
29
- <li>The "X" in the upper right can be used to delete an area (basically undoing a split)</li>
30
- <li>Once a widget is selected, there will be a gear in the lower middle. Clicking it will allow you to setup the widget parameters</li>
31
- </ul>
32
-
33
-
34
- </div>
@@ -1,25 +0,0 @@
1
- import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
-
3
- import { WidgetTutorialComponent } from './widget-tutorial.component';
4
-
5
- describe('WidgetTutorialComponent', () => {
6
- let component: WidgetTutorialComponent;
7
- let fixture: ComponentFixture<WidgetTutorialComponent>;
8
-
9
- beforeEach(waitForAsync(() => {
10
- TestBed.configureTestingModule({
11
- declarations: [ WidgetTutorialComponent ]
12
- })
13
- .compileComponents();
14
- }));
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(WidgetTutorialComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should be created', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,18 +0,0 @@
1
- import { Component, Input, OnInit } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'app-widget-tutorial',
5
- templateUrl: './widget-tutorial.component.html',
6
- styleUrls: ['./widget-tutorial.component.css']
7
- })
8
- export class WidgetTutorialComponent implements OnInit {
9
-
10
- @Input('widgetUUID') widgetUUID: string;
11
- @Input('unlockStatus') unlockStatus: boolean;
12
-
13
- constructor() { }
14
-
15
- ngOnInit() {
16
- }
17
-
18
- }
@@ -1,3 +0,0 @@
1
- <p>
2
- widget-unknown!
3
- </p>
@@ -1,25 +0,0 @@
1
- import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
-
3
- import { WidgetUnknownComponent } from './widget-unknown.component';
4
-
5
- describe('WidgetUnknownComponent', () => {
6
- let component: WidgetUnknownComponent;
7
- let fixture: ComponentFixture<WidgetUnknownComponent>;
8
-
9
- beforeEach(waitForAsync(() => {
10
- TestBed.configureTestingModule({
11
- declarations: [ WidgetUnknownComponent ]
12
- })
13
- .compileComponents();
14
- }));
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(WidgetUnknownComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should be created', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,15 +0,0 @@
1
- import { Component, OnInit } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'app-widget-unknown',
5
- templateUrl: './widget-unknown.component.html',
6
- styleUrls: ['./widget-unknown.component.css']
7
- })
8
- export class WidgetUnknownComponent implements OnInit {
9
-
10
- constructor() { }
11
-
12
- ngOnInit() {
13
- }
14
-
15
- }
@@ -1,24 +0,0 @@
1
- .wrapper {
2
- position: relative;
3
- width: 100%;
4
- height: 100%;
5
- }
6
-
7
- .settingsButton {
8
- position: absolute;
9
- bottom: 5%;
10
- left: 50%;
11
- transform: translate(-50%);
12
- }
13
-
14
- .tab-group {
15
- border: 1px solid #e8e8e8;
16
- }
17
-
18
- .tab-content {
19
- padding: 16px;
20
- }
21
-
22
- .full-width {
23
- width: 100%;
24
- }