@oicl/openbridge-webcomponents 0.0.15-dev-20240916083108 → 0.0.15-dev-20240923184809

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. package/.storybook/main.ts +8 -0
  2. package/.storybook/preview.ts +2 -0
  3. package/__snapshots__/building-blocks-watch--advice.png +0 -0
  4. package/__snapshots__/building-blocks-watch-flat--primary.png +0 -0
  5. package/__snapshots__/navigation-instruments-azimuth-thruster--in-command-at-setpoint-disable-auto-setpoint.png +0 -0
  6. package/__snapshots__/navigation-instruments-azimuth-thruster--in-command-at-setpoint.png +0 -0
  7. package/__snapshots__/navigation-instruments-azimuth-thruster--in-command.png +0 -0
  8. package/__snapshots__/navigation-instruments-azimuth-thruster--pod.png +0 -0
  9. package/__snapshots__/navigation-instruments-azimuth-thruster--single-direction-with-propeller.png +0 -0
  10. package/__snapshots__/navigation-instruments-azimuth-thruster--single-direction.png +0 -0
  11. package/__snapshots__/navigation-instruments-azimuth-thruster-labeled--large.png +0 -0
  12. package/__snapshots__/navigation-instruments-azimuth-thruster-labeled--medium.png +0 -0
  13. package/__snapshots__/navigation-instruments-azimuth-thruster-labeled--no-command.png +0 -0
  14. package/__snapshots__/navigation-instruments-compass--primary.png +0 -0
  15. package/__snapshots__/navigation-instruments-compass-flat--primary.png +0 -0
  16. package/__snapshots__/navigation-instruments-compass-flat--with-fov-indicator.png +0 -0
  17. package/__snapshots__/navigation-instruments-main-engine--active.png +0 -0
  18. package/__snapshots__/navigation-instruments-main-engine--in-command.png +0 -0
  19. package/__snapshots__/navigation-instruments-main-engine--off.png +0 -0
  20. package/__snapshots__/navigation-instruments-thruster--tunnel.png +0 -0
  21. package/custom-elements.json +2184 -660
  22. package/dist/navigation-instruments/azimuth-thruster/azimuth-thruster.d.ts.map +1 -1
  23. package/dist/navigation-instruments/azimuth-thruster/azimuth-thruster.js +2 -1
  24. package/dist/navigation-instruments/azimuth-thruster/azimuth-thruster.js.map +1 -1
  25. package/dist/navigation-instruments/compass/arrow.d.ts +7 -0
  26. package/dist/navigation-instruments/compass/arrow.d.ts.map +1 -0
  27. package/dist/navigation-instruments/compass/arrow.js +59 -0
  28. package/dist/navigation-instruments/compass/arrow.js.map +1 -0
  29. package/dist/navigation-instruments/compass/compass.d.ts +23 -0
  30. package/dist/navigation-instruments/compass/compass.d.ts.map +1 -0
  31. package/dist/navigation-instruments/compass/compass.js +139 -0
  32. package/dist/navigation-instruments/compass/compass.js.map +1 -0
  33. package/dist/navigation-instruments/compass/radial-tickmark.d.ts +4 -0
  34. package/dist/navigation-instruments/compass/radial-tickmark.d.ts.map +1 -0
  35. package/dist/navigation-instruments/compass/radial-tickmark.js +69 -0
  36. package/dist/navigation-instruments/compass/radial-tickmark.js.map +1 -0
  37. package/dist/navigation-instruments/compass-flat/compass-flat.css.js +29 -0
  38. package/dist/navigation-instruments/compass-flat/compass-flat.css.js.map +1 -0
  39. package/dist/navigation-instruments/compass-flat/compass-flat.d.ts +45 -0
  40. package/dist/navigation-instruments/compass-flat/compass-flat.d.ts.map +1 -0
  41. package/dist/navigation-instruments/compass-flat/compass-flat.js +223 -0
  42. package/dist/navigation-instruments/compass-flat/compass-flat.js.map +1 -0
  43. package/dist/navigation-instruments/main-engine/main-engine.css.js +22 -0
  44. package/dist/navigation-instruments/main-engine/main-engine.css.js.map +1 -0
  45. package/dist/navigation-instruments/main-engine/main-engine.d.ts +29 -0
  46. package/dist/navigation-instruments/main-engine/main-engine.d.ts.map +1 -0
  47. package/dist/navigation-instruments/main-engine/main-engine.js +196 -0
  48. package/dist/navigation-instruments/main-engine/main-engine.js.map +1 -0
  49. package/dist/navigation-instruments/thruster/advice.d.ts.map +1 -1
  50. package/dist/navigation-instruments/thruster/advice.js +9 -5
  51. package/dist/navigation-instruments/thruster/advice.js.map +1 -1
  52. package/dist/navigation-instruments/thruster/thruster.d.ts +54 -1
  53. package/dist/navigation-instruments/thruster/thruster.d.ts.map +1 -1
  54. package/dist/navigation-instruments/thruster/thruster.js +163 -99
  55. package/dist/navigation-instruments/thruster/thruster.js.map +1 -1
  56. package/dist/navigation-instruments/watch/advice.js +1 -1
  57. package/dist/navigation-instruments/watch/advice.js.map +1 -1
  58. package/dist/navigation-instruments/watch/label.d.ts +3 -0
  59. package/dist/navigation-instruments/watch/label.d.ts.map +1 -0
  60. package/dist/navigation-instruments/watch/label.js +68 -0
  61. package/dist/navigation-instruments/watch/label.js.map +1 -0
  62. package/dist/navigation-instruments/watch/watch.css.js +15 -14
  63. package/dist/navigation-instruments/watch/watch.css.js.map +1 -1
  64. package/dist/navigation-instruments/watch/watch.d.ts +3 -0
  65. package/dist/navigation-instruments/watch/watch.d.ts.map +1 -1
  66. package/dist/navigation-instruments/watch/watch.js +34 -1
  67. package/dist/navigation-instruments/watch/watch.js.map +1 -1
  68. package/dist/navigation-instruments/watch-flat/tickmark-flat.d.ts +20 -0
  69. package/dist/navigation-instruments/watch-flat/tickmark-flat.d.ts.map +1 -0
  70. package/dist/navigation-instruments/watch-flat/tickmark-flat.js +53 -0
  71. package/dist/navigation-instruments/watch-flat/tickmark-flat.js.map +1 -0
  72. package/dist/navigation-instruments/watch-flat/watch-flat.css.js +32 -0
  73. package/dist/navigation-instruments/watch-flat/watch-flat.css.js.map +1 -0
  74. package/dist/navigation-instruments/watch-flat/watch-flat.d.ts +29 -0
  75. package/dist/navigation-instruments/watch-flat/watch-flat.d.ts.map +1 -0
  76. package/dist/navigation-instruments/watch-flat/watch-flat.js +184 -0
  77. package/dist/navigation-instruments/watch-flat/watch-flat.js.map +1 -0
  78. package/dist/svghelpers/rectangular.d.ts +1 -0
  79. package/dist/svghelpers/rectangular.d.ts.map +1 -1
  80. package/dist/svghelpers/rectangular.js +3 -2
  81. package/dist/svghelpers/rectangular.js.map +1 -1
  82. package/package.json +16 -11
  83. package/src/navigation-instruments/azimuth-thruster/azimuth-thruster.ts +1 -0
  84. package/src/navigation-instruments/compass/arrow.ts +61 -0
  85. package/src/navigation-instruments/compass/compass.stories.ts +37 -0
  86. package/src/navigation-instruments/compass/compass.ts +132 -0
  87. package/src/navigation-instruments/compass/radial-tickmark.ts +77 -0
  88. package/src/navigation-instruments/compass-flat/compass-flat.css +23 -0
  89. package/src/navigation-instruments/compass-flat/compass-flat.stories.ts +35 -0
  90. package/src/navigation-instruments/compass-flat/compass-flat.ts +221 -0
  91. package/src/navigation-instruments/main-engine/main-engine.css +17 -0
  92. package/src/navigation-instruments/main-engine/main-engine.stories.ts +54 -0
  93. package/src/navigation-instruments/main-engine/main-engine.ts +160 -0
  94. package/src/navigation-instruments/thruster/advice.ts +9 -5
  95. package/src/navigation-instruments/thruster/thruster.stories.ts +1 -0
  96. package/src/navigation-instruments/thruster/thruster.ts +205 -113
  97. package/src/navigation-instruments/watch/advice.ts +1 -1
  98. package/src/navigation-instruments/watch/label.ts +69 -0
  99. package/src/navigation-instruments/watch/watch.css +7 -7
  100. package/src/navigation-instruments/watch/watch.ts +30 -1
  101. package/src/navigation-instruments/watch-flat/tickmark-flat.ts +62 -0
  102. package/src/navigation-instruments/watch-flat/watch-flat.css +19 -0
  103. package/src/navigation-instruments/watch-flat/watch-flat.stories.ts +17 -0
  104. package/src/navigation-instruments/watch-flat/watch-flat.ts +148 -0
  105. package/src/palettes/variables.css +1343 -1343
  106. package/src/svghelpers/rectangular.ts +6 -3
@@ -0,0 +1,3 @@
1
+ import { SVGTemplateResult } from 'lit-html';
2
+ export declare function renderLabels(scale: number): SVGTemplateResult;
3
+ //# sourceMappingURL=label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/watch/label.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAEhD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAkE7D"}
@@ -0,0 +1,68 @@
1
+ import { svg } from "lit-html";
2
+ function renderLabels(scale) {
3
+ const labelWidth = 32;
4
+ const gap = 8;
5
+ const radius = 368 / 2;
6
+ const labels = [
7
+ {
8
+ label: "E",
9
+ x: radius + gap / scale + labelWidth / 2,
10
+ y: 0,
11
+ class: "label"
12
+ },
13
+ {
14
+ label: "S",
15
+ x: 0,
16
+ y: radius + gap / scale + labelWidth / 2,
17
+ class: "label"
18
+ },
19
+ {
20
+ label: "W",
21
+ x: -(radius + gap / scale + labelWidth / 2),
22
+ y: 0,
23
+ class: "label"
24
+ }
25
+ ];
26
+ let arrow = svg`<defs>
27
+ <mask id="circleMask">
28
+ <rect x="-${radius}" y="-${radius}" width="${radius * 2}" height="${radius * 2}" fill="black"/>
29
+ <circle cx="0" cy="0" r="${radius}" fill="white"/>
30
+ </mask>
31
+ </defs>
32
+ <g mask="url(#circleMask)" transform="translate(0, ${-(radius + 45 / scale)}) scale(${1 / scale}, ${1 / scale})">
33
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M-32.04 42.7192 0 0 32.039 42.7192C21.627 40.9314 10.922 40 0 40-10.922 40-21.627 40.9314-32.04 42.7192Z"
34
+ fill="var(--instrument-tick-mark-secondary-color)"/>
35
+ <path d="M5.003 29H2.091L-3.013 20.264H-3.077C-3.066 20.52-3.056 20.7813-3.045 21.048-3.034 21.3147-3.024 21.5867-3.013 21.864-2.992 22.1307-2.976 22.4027-2.965 22.68-2.954 22.9573-2.944 23.2347-2.933 23.512V29H-4.997V17.576H-2.101L2.987 26.232H3.035C3.024 25.9867 3.014 25.736 3.003 25.48 2.992 25.2133 2.982 24.952 2.971 24.696 2.971 24.4293 2.966 24.1627 2.955 23.896 2.944 23.6293 2.934 23.3627 2.923 23.096V17.576H5.003V29Z" fill="var(--element-active-inverted-color)"/>
36
+ </g>`;
37
+ if (scale < 0.58) {
38
+ arrow = svg`
39
+ <g mask="url(#circleMask)" transform="translate(0, ${-radius})">
40
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M-17.8457 24.984 0 0 17.8458 24.984C11.9868 24.3338 6.0324 24 0 24-6.0323 24-11.9867 24.3338-17.8457 24.984Z" fill="var(--instrument-frame-tertiary-color)"/>
41
+ </g>`;
42
+ labels.push({
43
+ label: "N",
44
+ x: 0,
45
+ y: -(radius + gap / scale + labelWidth / 2),
46
+ class: "label"
47
+ });
48
+ }
49
+ return svg`
50
+ ${arrow}
51
+
52
+ ${labels.map(
53
+ (l) => svg`
54
+ <text
55
+ x="${l.x}"
56
+ y="${l.y}"
57
+ class="${l.class}"
58
+ >
59
+ ${l.label}
60
+ </text>
61
+ `
62
+ )}
63
+ `;
64
+ }
65
+ export {
66
+ renderLabels
67
+ };
68
+ //# sourceMappingURL=label.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label.js","sources":["../../../src/navigation-instruments/watch/label.ts"],"sourcesContent":["import {svg, SVGTemplateResult} from 'lit-html';\n\nexport function renderLabels(scale: number): SVGTemplateResult {\n const labelWidth = 32;\n const gap = 8;\n const radius: number = 368 / 2;\n const labels = [\n {\n label: 'E',\n x: radius + gap / scale + labelWidth / 2,\n y: 0,\n class: 'label',\n },\n {\n label: 'S',\n x: 0,\n y: radius + gap / scale + labelWidth / 2,\n class: 'label',\n },\n {\n label: 'W',\n x: -(radius + gap / scale + labelWidth / 2),\n y: 0,\n class: 'label',\n },\n ];\n\n let arrow = svg`<defs>\n <mask id=\"circleMask\">\n <rect x=\"-${radius}\" y=\"-${radius}\" width=\"${radius * 2}\" height=\"${radius * 2}\" fill=\"black\"/>\n <circle cx=\"0\" cy=\"0\" r=\"${radius}\" fill=\"white\"/>\n </mask>\n </defs>\n <g mask=\"url(#circleMask)\" transform=\"translate(0, ${-(radius + 45 / scale)}) scale(${1 / scale}, ${1 / scale})\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M-32.04 42.7192 0 0 32.039 42.7192C21.627 40.9314 10.922 40 0 40-10.922 40-21.627 40.9314-32.04 42.7192Z\" \n fill=\"var(--instrument-tick-mark-secondary-color)\"/>\n <path d=\"M5.003 29H2.091L-3.013 20.264H-3.077C-3.066 20.52-3.056 20.7813-3.045 21.048-3.034 21.3147-3.024 21.5867-3.013 21.864-2.992 22.1307-2.976 22.4027-2.965 22.68-2.954 22.9573-2.944 23.2347-2.933 23.512V29H-4.997V17.576H-2.101L2.987 26.232H3.035C3.024 25.9867 3.014 25.736 3.003 25.48 2.992 25.2133 2.982 24.952 2.971 24.696 2.971 24.4293 2.966 24.1627 2.955 23.896 2.944 23.6293 2.934 23.3627 2.923 23.096V17.576H5.003V29Z\" fill=\"var(--element-active-inverted-color)\"/>\n </g>`;\n\n if (scale < 0.58) {\n arrow = svg`\n <g mask=\"url(#circleMask)\" transform=\"translate(0, ${-radius})\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M-17.8457 24.984 0 0 17.8458 24.984C11.9868 24.3338 6.0324 24 0 24-6.0323 24-11.9867 24.3338-17.8457 24.984Z\" fill=\"var(--instrument-frame-tertiary-color)\"/>\n </g>`;\n\n labels.push({\n label: 'N',\n x: 0,\n y: -(radius + gap / scale + labelWidth / 2),\n class: 'label',\n });\n }\n\n return svg`\n ${arrow}\n\n ${labels.map(\n (l) => svg`\n <text\n x=\"${l.x}\"\n y=\"${l.y}\"\n class=\"${l.class}\"\n >\n ${l.label}\n </text>\n `\n )}\n `;\n}\n"],"names":[],"mappings":";AAEO,SAAS,aAAa,OAAkC;AAC7D,QAAM,aAAa;AACnB,QAAM,MAAM;AACZ,QAAM,SAAiB,MAAM;AAC7B,QAAM,SAAS;AAAA,IACb;AAAA,MACE,OAAO;AAAA,MACP,GAAG,SAAS,MAAM,QAAQ,aAAa;AAAA,MACvC,GAAG;AAAA,MACH,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,GAAG;AAAA,MACH,GAAG,SAAS,MAAM,QAAQ,aAAa;AAAA,MACvC,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,GAAG,EAAE,SAAS,MAAM,QAAQ,aAAa;AAAA,MACzC,GAAG;AAAA,MACH,OAAO;AAAA,IACT;AAAA,EAAA;AAGF,MAAI,QAAQ;AAAA;AAAA,wBAEU,MAAM,SAAS,MAAM,YAAY,SAAS,CAAC,aAAa,SAAS,CAAC;AAAA,uCACnD,MAAM;AAAA;AAAA;AAAA,yDAGY,EAAE,SAAS,KAAK,MAAM,WAAW,IAAI,KAAK,KAAK,IAAI,KAAK;AAAA;AAAA;AAAA;AAAA;AAM/G,MAAI,QAAQ,MAAM;AACR,YAAA;AAAA,2DAC+C,CAAC,MAAM;AAAA;AAAA;AAI9D,WAAO,KAAK;AAAA,MACV,OAAO;AAAA,MACP,GAAG;AAAA,MACH,GAAG,EAAE,SAAS,MAAM,QAAQ,aAAa;AAAA,MACzC,OAAO;AAAA,IAAA,CACR;AAAA,EACH;AAEO,SAAA;AAAA,MACH,KAAK;AAAA;AAAA,MAEL,OAAO;AAAA,IACP,CAAC,MAAM;AAAA;AAAA,eAEE,EAAE,CAAC;AAAA,eACH,EAAE,CAAC;AAAA,mBACC,EAAE,KAAK;AAAA;AAAA,YAEd,EAAE,KAAK;AAAA;AAAA;AAAA,EAAA,CAGd;AAAA;AAEL;"}
@@ -1,22 +1,23 @@
1
1
  import { css } from "lit";
2
2
  const compentStyle = css`* {
3
- box-sizing: border-box;
3
+ box-sizing: border-box;
4
4
  }
5
5
 
6
6
  .label {
7
- /* UI/Body */
8
- font-family: 'Noto Sans';
9
- font-size: 16px;
10
- font-style: normal;
11
- font-weight: 370;
12
- line-height: 24px;
13
- /* 150% */
14
- text-decoration: none;
15
- font-size: calc(16px / var(--scale));
16
- fill: var(--element-neutral-color);
17
- alignment-baseline: middle;
18
- text-anchor: middle;
19
- }`;
7
+ /* UI/Body */
8
+ font-family: 'Noto Sans';
9
+ font-size: 16px;
10
+ font-style: normal;
11
+ font-weight: 370;
12
+ line-height: 24px;
13
+ /* 150% */
14
+ text-decoration: none;
15
+ font-size: calc(16px / var(--scale));
16
+ fill: var(--element-neutral-color);
17
+ alignment-baseline: middle;
18
+ text-anchor: middle;
19
+ }
20
+ `;
20
21
  export {
21
22
  compentStyle as default
22
23
  };
@@ -1 +1 @@
1
- {"version":3,"file":"watch.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"watch.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
@@ -13,8 +13,11 @@ export declare class ObcWatch extends LitElement {
13
13
  roundInsideCut: boolean;
14
14
  tickmarks: Tickmark[];
15
15
  advices: AngleAdviceRaw[];
16
+ crosshairEnabled: boolean;
17
+ labelFrameEnabled: boolean;
16
18
  private _resizeController;
17
19
  private watchCircle;
20
+ private renderCrosshair;
18
21
  render(): import("lit-html").TemplateResult<1>;
19
22
  private renderSetpoint;
20
23
  static styles: import("lit").CSSResult;
@@ -1 +1 @@
1
- {"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/watch/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAMX,MAAM,KAAK,CAAC;AAIb,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAGzC,OAAO,EAAC,cAAc,EAAe,MAAM,UAAU,CAAC;AACtD,OAAO,EAAC,QAAQ,EAA0B,MAAM,YAAY,CAAC;AAE7D,qBACa,QAAS,SAAQ,UAAU;IACZ,KAAK,EAAE,eAAe,CAA6B;IACnD,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,eAAe,EAAE,OAAO,CAAS;IAClC,OAAO,SAAM;IACb,aAAa,EAAE,MAAM,GAAG,IAAI,CAAQ;IACpC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAQ;IACjC,eAAe,UAAS;IACxB,cAAc,UAAS;IACP,SAAS,EAAE,QAAQ,EAAE,CAAM;IAC3B,OAAO,EAAE,cAAc,EAAE,CAAM;IAI1E,OAAO,CAAC,iBAAiB,CAAkC;IAE3D,OAAO,CAAC,WAAW;IA2DV,MAAM;IAuBf,OAAO,CAAC,cAAc;IA8CtB,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
1
+ {"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/watch/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAMX,MAAM,KAAK,CAAC;AAIb,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAGzC,OAAO,EAAC,cAAc,EAAe,MAAM,UAAU,CAAC;AACtD,OAAO,EAAC,QAAQ,EAA0B,MAAM,YAAY,CAAC;AAG7D,qBACa,QAAS,SAAQ,UAAU;IACZ,KAAK,EAAE,eAAe,CAA6B;IACnD,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,eAAe,EAAE,OAAO,CAAS;IAClC,OAAO,SAAM;IACb,aAAa,EAAE,MAAM,GAAG,IAAI,CAAQ;IACpC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAQ;IACjC,eAAe,UAAS;IACxB,cAAc,UAAS;IACP,SAAS,EAAE,QAAQ,EAAE,CAAM;IAC3B,OAAO,EAAE,cAAc,EAAE,CAAM;IAC/C,gBAAgB,EAAE,OAAO,CAAS;IAClC,iBAAiB,EAAE,OAAO,CAAS;IAI9D,OAAO,CAAC,iBAAiB,CAAkC;IAE3D,OAAO,CAAC,WAAW;IA2DnB,OAAO,CAAC,eAAe;IAuBd,MAAM;IA0Bf,OAAO,CAAC,cAAc;IA8CtB,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
@@ -7,6 +7,7 @@ import compentStyle from "./watch.css.js";
7
7
  import { ResizeController } from "@lit-labs/observers/resize-controller.js";
8
8
  import { renderAdvice } from "./advice.js";
9
9
  import { tickmark, TickmarkStyle } from "./tickmark.js";
10
+ import { renderLabels } from "./label.js";
10
11
  var __defProp = Object.defineProperty;
11
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
13
  var __decorateClass = (decorators, target, key, kind) => {
@@ -30,6 +31,8 @@ let ObcWatch = class extends LitElement {
30
31
  this.roundInsideCut = false;
31
32
  this.tickmarks = [];
32
33
  this.advices = [];
34
+ this.crosshairEnabled = false;
35
+ this.labelFrameEnabled = false;
33
36
  this._resizeController = new ResizeController(this, {});
34
37
  }
35
38
  watchCircle() {
@@ -82,6 +85,28 @@ let ObcWatch = class extends LitElement {
82
85
  `;
83
86
  }
84
87
  }
88
+ renderCrosshair(radius) {
89
+ return svg`
90
+ <line
91
+ x1="-${radius}"
92
+ y1="0"
93
+ x2="${radius}"
94
+ y2="0"
95
+ stroke="var(--instrument-frame-tertiary-color)"
96
+ stroke-width="1"
97
+ vector-effect="non-scaling-stroke"
98
+ />
99
+ <line
100
+ x1="0"
101
+ y1="-${radius}"
102
+ x2="0"
103
+ y2="${radius}"
104
+ stroke="var(--instrument-frame-tertiary-color)"
105
+ stroke-width="1"
106
+ vector-effect="non-scaling-stroke"
107
+ />
108
+ `;
109
+ }
85
110
  render() {
86
111
  const width = (176 + this.padding) * 2;
87
112
  const viewBox = `-${width / 2} -${width / 2} ${width} ${width}`;
@@ -91,6 +116,7 @@ let ObcWatch = class extends LitElement {
91
116
  (t) => tickmark(t.angle, t.type, TickmarkStyle.hinted, scale, t.text)
92
117
  );
93
118
  const advices = this.advices ? this.advices.map((a) => renderAdvice(a)) : nothing;
119
+ const labels = this.labelFrameEnabled ? renderLabels(scale) : nothing;
94
120
  return html`
95
121
  <svg
96
122
  width="100%"
@@ -98,7 +124,8 @@ let ObcWatch = class extends LitElement {
98
124
  viewBox=${viewBox}
99
125
  style="--scale: ${scale}"
100
126
  >
101
- ${this.watchCircle()} ${tickmarks} ${advices} ${angleSetpoint}
127
+ ${this.watchCircle()} ${tickmarks} ${advices} ${angleSetpoint} ${labels}
128
+ ${this.crosshairEnabled ? this.renderCrosshair(320 / 2) : nothing}
102
129
  </svg>
103
130
  `;
104
131
  }
@@ -176,6 +203,12 @@ __decorateClass([
176
203
  __decorateClass([
177
204
  property({ type: Array, attribute: false })
178
205
  ], ObcWatch.prototype, "advices", 2);
206
+ __decorateClass([
207
+ property({ type: Boolean })
208
+ ], ObcWatch.prototype, "crosshairEnabled", 2);
209
+ __decorateClass([
210
+ property({ type: Boolean })
211
+ ], ObcWatch.prototype, "labelFrameEnabled", 2);
179
212
  ObcWatch = __decorateClass([
180
213
  customElement("obc-watch")
181
214
  ], ObcWatch);
@@ -1 +1 @@
1
- {"version":3,"file":"watch.js","sources":["../../../src/navigation-instruments/watch/watch.ts"],"sourcesContent":["import {\n LitElement,\n SVGTemplateResult,\n html,\n nothing,\n svg,\n unsafeCSS,\n} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\nimport {circle} from '../../svghelpers';\nimport {roundedArch} from '../../svghelpers/roundedArch';\nimport {InstrumentState} from '../types';\nimport compentStyle from './watch.css?inline';\nimport {ResizeController} from '@lit-labs/observers/resize-controller.js';\nimport {AngleAdviceRaw, renderAdvice} from './advice';\nimport {Tickmark, TickmarkStyle, tickmark} from './tickmark';\n\n@customElement('obc-watch')\nexport class ObcWatch extends LitElement {\n @property({type: String}) state: InstrumentState = InstrumentState.inCommand;\n @property({type: Number}) angleSetpoint: number | undefined;\n @property({type: Boolean}) atAngleSetpoint: boolean = false;\n @property({type: Number}) padding = 24;\n @property({type: Number}) cutAngleStart: number | null = null;\n @property({type: Number}) cutAngleEnd: number | null = null;\n @property({type: Boolean}) roundOutsideCut = false;\n @property({type: Boolean}) roundInsideCut = false;\n @property({type: Array, attribute: false}) tickmarks: Tickmark[] = [];\n @property({type: Array, attribute: false}) advices: AngleAdviceRaw[] = [];\n\n // @ts-expect-error TS6133: The controller unsures that the render\n // function is called on resize of the element\n private _resizeController = new ResizeController(this, {});\n\n private watchCircle(): SVGTemplateResult {\n if (this.cutAngleStart === null || this.cutAngleEnd === null) {\n return svg`\n <defs>\n <mask id=\"mask1\" x=\"0\" y=\"0\" width=\"100%\" height=\"100%\">\n <rect x=\"-200\" y=\"-200\" width=\"400\" height=\"400\" fill=\"white\" />\n <circle cx=\"0\" cy=\"0\" r=\"160\" fill=\"black\" />\n </mask>\n </defs>\n ${\n this.state === InstrumentState.off\n ? null\n : svg`\n <circle\n cx=\"0\"\n cy=\"0\"\n r=\"184\"\n fill=\"var(--instrument-frame-primary-color)\"\n mask=\"url(#mask1)\"\n />`\n }\n ${circle('innerRing', {\n radius: 320 / 2,\n strokeWidth: 1,\n strokeColor: 'var(--instrument-frame-tertiary-color)',\n strokePosition: 'center',\n fillColor: 'none',\n })}\n ${\n this.state === InstrumentState.off\n ? null\n : circle('outerRing', {\n radius: 368 / 2,\n strokeWidth: 1,\n strokeColor: 'var(--instrument-frame-tertiary-color)',\n strokePosition: 'center',\n fillColor: 'none',\n })\n }\n `;\n } else {\n const R = 184;\n const r = 160;\n const svgPath = roundedArch({\n startAngle: this.cutAngleStart,\n endAngle: this.cutAngleEnd,\n R,\n r,\n roundOutsideCut: this.roundOutsideCut,\n roundInsideCut: this.roundInsideCut,\n });\n return svg`\n <path d=${svgPath} fill=\"var(--instrument-frame-primary-color)\" \n stroke=\"var(--instrument-frame-tertiary-color)\"\n vector-effect=\"non-scaling-stroke\"/>\n `;\n }\n }\n\n override render() {\n const width = (176 + this.padding) * 2;\n const viewBox = `-${width / 2} -${width / 2} ${width} ${width}`;\n const angleSetpoint = this.renderSetpoint();\n const scale = this.clientWidth / width;\n const tickmarks = this.tickmarks.map((t) =>\n tickmark(t.angle, t.type, TickmarkStyle.hinted, scale, t.text)\n );\n const advices = this.advices\n ? this.advices.map((a) => renderAdvice(a))\n : nothing;\n return html`\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox=${viewBox}\n style=\"--scale: ${scale}\"\n >\n ${this.watchCircle()} ${tickmarks} ${advices} ${angleSetpoint}\n </svg>\n `;\n }\n\n private renderSetpoint(): SVGTemplateResult | typeof nothing {\n let setPointColor = 'var(--instrument-enhanced-primary-color)';\n if (this.atAngleSetpoint) {\n setPointColor = 'var(--instrument-enhanced-secondary-color)';\n }\n if (this.state === InstrumentState.active) {\n setPointColor = 'var(--instrument-regular-primary-color)';\n if (this.atAngleSetpoint) {\n setPointColor = 'var(--instrument-regular-secondary-color)';\n }\n } else if (this.state === InstrumentState.loading) {\n setPointColor = 'var(--instrument-frame-tertiary-color)';\n } else if (this.state === InstrumentState.off) {\n setPointColor = 'var(--instrument-frame-tertiary-color)';\n }\n\n if (this.angleSetpoint === undefined) {\n return nothing;\n } else {\n let path;\n if (this.state === InstrumentState.inCommand) {\n path =\n 'M23.5119 8C24.6981 6.35191 23.5696 4 21.5926 4L2.39959 4C0.422598 4 -0.705911 6.35191 0.480283 8L11.9961 24L23.5119 8Z';\n } else {\n path =\n 'M18.5836 8L5.4086 8L11.9961 17.1526L18.5836 8ZM23.5119 8C24.6981 6.35191 23.5696 4 21.5926 4L2.39959 4C0.422598 4 -0.705911 6.35191 0.480283 8L11.9961 24L23.5119 8Z';\n }\n return svg`\n <defs>\n <g id=\"setpoint\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" transform=\"translate(-24 12) rotate(-90)\" d=${path} vector-effect=\"non-scaling-stroke\"/>\n </g>\n <mask id=\"setpointMask\">\n <rect x=\"-20\" y=\"-20\" width=\"50\" height=\"50\" fill=\"white\" />\n <use href=\"#setpoint\" fill=\"black\" />\n </mask>\n </defs>\n <g transform=\"rotate(${this.angleSetpoint + 90}) translate(-168 0) \">\n <use href=\"#setpoint\" fill=${setPointColor} stroke-width=\"0\" />\n \n <use href=\"#setpoint\" vector-effect=\"non-scaling-stroke\" fill=\"none\" stroke=\"var(--border-silhouette-color)\" stroke-width=\"2\" stroke-linejoin=\"round\" mask=\"url(#setpointMask)\" />\n </g>\n `;\n }\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-watch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U,YAAY;AA/IrB,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GADb,SACe,WAAA,SAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GAFb,SAEe,WAAA,iBAAA,CAAA;AACC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,SAAQ;AAAA,GAHd,SAGgB,WAAA,mBAAA,CAAA;AACD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GAJb,SAIe,WAAA,WAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GALb,SAKe,WAAA,iBAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GANb,SAMe,WAAA,eAAA,CAAA;AACC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,SAAQ;AAAA,GAPd,SAOgB,WAAA,mBAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,SAAQ;AAAA,GARd,SAQgB,WAAA,kBAAA,CAAA;AACgB,gBAAA;AAAA,EAA1C,SAAS,EAAC,MAAM,OAAO,WAAW,OAAM;AAAA,GAT9B,SASgC,WAAA,aAAA,CAAA;AACA,gBAAA;AAAA,EAA1C,SAAS,EAAC,MAAM,OAAO,WAAW,OAAM;AAAA,GAV9B,SAUgC,WAAA,WAAA,CAAA;AAVhC,WAAN,gBAAA;AAAA,EADN,cAAc,WAAW;AAAA,GACb,QAAA;"}
1
+ {"version":3,"file":"watch.js","sources":["../../../src/navigation-instruments/watch/watch.ts"],"sourcesContent":["import {\n LitElement,\n SVGTemplateResult,\n html,\n nothing,\n svg,\n unsafeCSS,\n} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\nimport {circle} from '../../svghelpers';\nimport {roundedArch} from '../../svghelpers/roundedArch';\nimport {InstrumentState} from '../types';\nimport compentStyle from './watch.css?inline';\nimport {ResizeController} from '@lit-labs/observers/resize-controller.js';\nimport {AngleAdviceRaw, renderAdvice} from './advice';\nimport {Tickmark, TickmarkStyle, tickmark} from './tickmark';\nimport {renderLabels} from './label';\n\n@customElement('obc-watch')\nexport class ObcWatch extends LitElement {\n @property({type: String}) state: InstrumentState = InstrumentState.inCommand;\n @property({type: Number}) angleSetpoint: number | undefined;\n @property({type: Boolean}) atAngleSetpoint: boolean = false;\n @property({type: Number}) padding = 24;\n @property({type: Number}) cutAngleStart: number | null = null;\n @property({type: Number}) cutAngleEnd: number | null = null;\n @property({type: Boolean}) roundOutsideCut = false;\n @property({type: Boolean}) roundInsideCut = false;\n @property({type: Array, attribute: false}) tickmarks: Tickmark[] = [];\n @property({type: Array, attribute: false}) advices: AngleAdviceRaw[] = [];\n @property({type: Boolean}) crosshairEnabled: boolean = false;\n @property({type: Boolean}) labelFrameEnabled: boolean = false;\n\n // @ts-expect-error TS6133: The controller unsures that the render\n // function is called on resize of the element\n private _resizeController = new ResizeController(this, {});\n\n private watchCircle(): SVGTemplateResult {\n if (this.cutAngleStart === null || this.cutAngleEnd === null) {\n return svg`\n <defs>\n <mask id=\"mask1\" x=\"0\" y=\"0\" width=\"100%\" height=\"100%\">\n <rect x=\"-200\" y=\"-200\" width=\"400\" height=\"400\" fill=\"white\" />\n <circle cx=\"0\" cy=\"0\" r=\"160\" fill=\"black\" />\n </mask>\n </defs>\n ${\n this.state === InstrumentState.off\n ? null\n : svg`\n <circle\n cx=\"0\"\n cy=\"0\"\n r=\"184\"\n fill=\"var(--instrument-frame-primary-color)\"\n mask=\"url(#mask1)\"\n />`\n }\n ${circle('innerRing', {\n radius: 320 / 2,\n strokeWidth: 1,\n strokeColor: 'var(--instrument-frame-tertiary-color)',\n strokePosition: 'center',\n fillColor: 'none',\n })}\n ${\n this.state === InstrumentState.off\n ? null\n : circle('outerRing', {\n radius: 368 / 2,\n strokeWidth: 1,\n strokeColor: 'var(--instrument-frame-tertiary-color)',\n strokePosition: 'center',\n fillColor: 'none',\n })\n }\n `;\n } else {\n const R = 184;\n const r = 160;\n const svgPath = roundedArch({\n startAngle: this.cutAngleStart,\n endAngle: this.cutAngleEnd,\n R,\n r,\n roundOutsideCut: this.roundOutsideCut,\n roundInsideCut: this.roundInsideCut,\n });\n return svg`\n <path d=${svgPath} fill=\"var(--instrument-frame-primary-color)\" \n stroke=\"var(--instrument-frame-tertiary-color)\"\n vector-effect=\"non-scaling-stroke\"/>\n `;\n }\n }\n\n private renderCrosshair(radius: number): SVGTemplateResult {\n return svg`\n <line\n x1=\"-${radius}\"\n y1=\"0\"\n x2=\"${radius}\"\n y2=\"0\"\n stroke=\"var(--instrument-frame-tertiary-color)\"\n stroke-width=\"1\"\n vector-effect=\"non-scaling-stroke\"\n />\n <line\n x1=\"0\"\n y1=\"-${radius}\"\n x2=\"0\"\n y2=\"${radius}\"\n stroke=\"var(--instrument-frame-tertiary-color)\"\n stroke-width=\"1\"\n vector-effect=\"non-scaling-stroke\"\n />\n `;\n }\n\n override render() {\n const width = (176 + this.padding) * 2;\n const viewBox = `-${width / 2} -${width / 2} ${width} ${width}`;\n const angleSetpoint = this.renderSetpoint();\n const scale = this.clientWidth / width;\n const tickmarks = this.tickmarks.map((t) =>\n tickmark(t.angle, t.type, TickmarkStyle.hinted, scale, t.text)\n );\n const advices = this.advices\n ? this.advices.map((a) => renderAdvice(a))\n : nothing;\n const labels = this.labelFrameEnabled ? renderLabels(scale) : nothing;\n\n return html`\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox=${viewBox}\n style=\"--scale: ${scale}\"\n >\n ${this.watchCircle()} ${tickmarks} ${advices} ${angleSetpoint} ${labels}\n ${this.crosshairEnabled ? this.renderCrosshair(320 / 2) : nothing}\n </svg>\n `;\n }\n\n private renderSetpoint(): SVGTemplateResult | typeof nothing {\n let setPointColor = 'var(--instrument-enhanced-primary-color)';\n if (this.atAngleSetpoint) {\n setPointColor = 'var(--instrument-enhanced-secondary-color)';\n }\n if (this.state === InstrumentState.active) {\n setPointColor = 'var(--instrument-regular-primary-color)';\n if (this.atAngleSetpoint) {\n setPointColor = 'var(--instrument-regular-secondary-color)';\n }\n } else if (this.state === InstrumentState.loading) {\n setPointColor = 'var(--instrument-frame-tertiary-color)';\n } else if (this.state === InstrumentState.off) {\n setPointColor = 'var(--instrument-frame-tertiary-color)';\n }\n\n if (this.angleSetpoint === undefined) {\n return nothing;\n } else {\n let path;\n if (this.state === InstrumentState.inCommand) {\n path =\n 'M23.5119 8C24.6981 6.35191 23.5696 4 21.5926 4L2.39959 4C0.422598 4 -0.705911 6.35191 0.480283 8L11.9961 24L23.5119 8Z';\n } else {\n path =\n 'M18.5836 8L5.4086 8L11.9961 17.1526L18.5836 8ZM23.5119 8C24.6981 6.35191 23.5696 4 21.5926 4L2.39959 4C0.422598 4 -0.705911 6.35191 0.480283 8L11.9961 24L23.5119 8Z';\n }\n return svg`\n <defs>\n <g id=\"setpoint\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" transform=\"translate(-24 12) rotate(-90)\" d=${path} vector-effect=\"non-scaling-stroke\"/>\n </g>\n <mask id=\"setpointMask\">\n <rect x=\"-20\" y=\"-20\" width=\"50\" height=\"50\" fill=\"white\" />\n <use href=\"#setpoint\" fill=\"black\" />\n </mask>\n </defs>\n <g transform=\"rotate(${this.angleSetpoint + 90}) translate(-168 0) \">\n <use href=\"#setpoint\" fill=${setPointColor} stroke-width=\"0\" />\n \n <use href=\"#setpoint\" vector-effect=\"non-scaling-stroke\" fill=\"none\" stroke=\"var(--border-silhouette-color)\" stroke-width=\"2\" stroke-linejoin=\"round\" mask=\"url(#setpointMask)\" />\n </g>\n `;\n }\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-watch': ObcWatch;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmBa,IAAA,WAAN,cAAuB,WAAW;AAAA,EAAlC,cAAA;AAAA,UAAA,GAAA,SAAA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oBAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,SAAQ;AAAA,GAZd,SAYgB,WAAA,qBAAA,CAAA;AAZhB,WAAN,gBAAA;AAAA,EADN,cAAc,WAAW;AAAA,GACb,QAAA;"}
@@ -0,0 +1,20 @@
1
+ import { SVGTemplateResult } from 'lit';
2
+ export interface Tickmark {
3
+ angle: number;
4
+ type: TickmarkType;
5
+ text?: string;
6
+ }
7
+ export declare enum TickmarkType {
8
+ main = "main",
9
+ primary = "primary",
10
+ secondary = "secondary",
11
+ tertiary = "tertiary"
12
+ }
13
+ export declare enum TickmarkStyle {
14
+ hinted = "hinted",
15
+ regular = "regular",
16
+ enhanced = "enhanced"
17
+ }
18
+ export declare function tickmarkColor(style: TickmarkStyle): string;
19
+ export declare function tickmark(angle: number, tickmarkSize: TickmarkType, style: TickmarkStyle, text?: string): SVGTemplateResult | SVGTemplateResult[];
20
+ //# sourceMappingURL=tickmark-flat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tickmark-flat.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/watch-flat/tickmark-flat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAM,MAAM,KAAK,CAAC;AAE3C,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,oBAAY,YAAY;IACtB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,QAAQ,aAAa;CACtB;AAED,oBAAY,aAAa;IACvB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAQ1D;AAED,wBAAgB,QAAQ,CACtB,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,aAAa,EACpB,IAAI,CAAC,EAAE,MAAM,GACZ,iBAAiB,GAAG,iBAAiB,EAAE,CAyBzC"}
@@ -0,0 +1,53 @@
1
+ import { svg } from "lit";
2
+ var TickmarkType = /* @__PURE__ */ ((TickmarkType2) => {
3
+ TickmarkType2["main"] = "main";
4
+ TickmarkType2["primary"] = "primary";
5
+ TickmarkType2["secondary"] = "secondary";
6
+ TickmarkType2["tertiary"] = "tertiary";
7
+ return TickmarkType2;
8
+ })(TickmarkType || {});
9
+ var TickmarkStyle = /* @__PURE__ */ ((TickmarkStyle2) => {
10
+ TickmarkStyle2["hinted"] = "hinted";
11
+ TickmarkStyle2["regular"] = "regular";
12
+ TickmarkStyle2["enhanced"] = "enhanced";
13
+ return TickmarkStyle2;
14
+ })(TickmarkStyle || {});
15
+ function tickmarkColor(style) {
16
+ if (style === "hinted") {
17
+ return "var(--instrument-frame-tertiary-color)";
18
+ } else if (style === "regular") {
19
+ return "var(--instrument-tick-mark-secondary-color)";
20
+ } else {
21
+ return "var(--instrument-tick-mark-primary-color)";
22
+ }
23
+ }
24
+ function tickmark(angle, tickmarkSize, style, text) {
25
+ const textHeight = -32;
26
+ let lineStartY = -35;
27
+ let lineEndY = -34;
28
+ if (tickmarkSize === "secondary") {
29
+ lineStartY = -24;
30
+ lineEndY = lineStartY + 8;
31
+ } else if (tickmarkSize === "main") {
32
+ lineEndY = lineStartY + 20;
33
+ } else if (tickmarkSize === "tertiary") {
34
+ throw new Error("Tertiary tickmarks are not supported");
35
+ }
36
+ const colorName = tickmarkColor(style);
37
+ const tick = svg`<line x1=${angle} y1=${lineStartY} x2=${angle} y2=${lineEndY} stroke=${colorName} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
38
+ if (text) {
39
+ const textY = lineEndY + textHeight;
40
+ return [
41
+ tick,
42
+ svg`<text x=${angle} y=${textY} class="label" text-anchor="middle">${text}</text>`
43
+ ];
44
+ }
45
+ return tick;
46
+ }
47
+ export {
48
+ TickmarkStyle,
49
+ TickmarkType,
50
+ tickmark,
51
+ tickmarkColor
52
+ };
53
+ //# sourceMappingURL=tickmark-flat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tickmark-flat.js","sources":["../../../src/navigation-instruments/watch-flat/tickmark-flat.ts"],"sourcesContent":["import {SVGTemplateResult, svg} from 'lit';\n\nexport interface Tickmark {\n angle: number;\n type: TickmarkType;\n text?: string;\n}\n\nexport enum TickmarkType {\n main = 'main',\n primary = 'primary',\n secondary = 'secondary',\n tertiary = 'tertiary',\n}\n\nexport enum TickmarkStyle {\n hinted = 'hinted',\n regular = 'regular',\n enhanced = 'enhanced',\n}\n\nexport function tickmarkColor(style: TickmarkStyle): string {\n if (style === TickmarkStyle.hinted) {\n return 'var(--instrument-frame-tertiary-color)';\n } else if (style === TickmarkStyle.regular) {\n return 'var(--instrument-tick-mark-secondary-color)';\n } else {\n return 'var(--instrument-tick-mark-primary-color)';\n }\n}\n\nexport function tickmark(\n angle: number,\n tickmarkSize: TickmarkType,\n style: TickmarkStyle,\n text?: string\n): SVGTemplateResult | SVGTemplateResult[] {\n const textHeight = -32;\n let lineStartY: number = -35;\n let lineEndY: number = -34;\n\n if (tickmarkSize === TickmarkType.secondary) {\n lineStartY = -24;\n lineEndY = lineStartY + 8;\n } else if (tickmarkSize === TickmarkType.main) {\n lineEndY = lineStartY + 20;\n } else if (tickmarkSize === TickmarkType.tertiary) {\n throw new Error('Tertiary tickmarks are not supported');\n }\n\n const colorName = tickmarkColor(style);\n const tick = svg`<line x1=${angle} y1=${lineStartY} x2=${angle} y2=${lineEndY} stroke=${colorName} stroke-width=\"1\" vector-effect=\"non-scaling-stroke\"/>`;\n if (text) {\n const textY = lineEndY + textHeight;\n return [\n tick,\n svg`<text x=${angle} y=${textY} class=\"label\" text-anchor=\"middle\">${text}</text>`,\n ];\n }\n\n return tick;\n}\n"],"names":["TickmarkType","TickmarkStyle"],"mappings":";AAQY,IAAA,iCAAAA,kBAAL;AACLA,gBAAA,MAAO,IAAA;AACPA,gBAAA,SAAU,IAAA;AACVA,gBAAA,WAAY,IAAA;AACZA,gBAAA,UAAW,IAAA;AAJDA,SAAAA;AAAA,GAAA,gBAAA,CAAA,CAAA;AAOA,IAAA,kCAAAC,mBAAL;AACLA,iBAAA,QAAS,IAAA;AACTA,iBAAA,SAAU,IAAA;AACVA,iBAAA,UAAW,IAAA;AAHDA,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;AAML,SAAS,cAAc,OAA8B;AAC1D,MAAI,UAAU,UAAsB;AAC3B,WAAA;AAAA,EAAA,WACE,UAAU,WAAuB;AACnC,WAAA;AAAA,EAAA,OACF;AACE,WAAA;AAAA,EACT;AACF;AAEO,SAAS,SACd,OACA,cACA,OACA,MACyC;AACzC,QAAM,aAAa;AACnB,MAAI,aAAqB;AACzB,MAAI,WAAmB;AAEvB,MAAI,iBAAiB,aAAwB;AAC9B,iBAAA;AACb,eAAW,aAAa;AAAA,EAAA,WACf,iBAAiB,QAAmB;AAC7C,eAAW,aAAa;AAAA,EAAA,WACf,iBAAiB,YAAuB;AAC3C,UAAA,IAAI,MAAM,sCAAsC;AAAA,EACxD;AAEM,QAAA,YAAY,cAAc,KAAK;AAC/B,QAAA,OAAO,eAAe,KAAK,OAAO,UAAU,OAAO,KAAK,OAAO,QAAQ,WAAW,SAAS;AACjG,MAAI,MAAM;AACR,UAAM,QAAQ,WAAW;AAClB,WAAA;AAAA,MACL;AAAA,MACA,cAAc,KAAK,MAAM,KAAK,uCAAuC,IAAI;AAAA,IAAA;AAAA,EAE7E;AAEO,SAAA;AACT;"}
@@ -0,0 +1,32 @@
1
+ import { css } from "lit";
2
+ const compentStyle = css`* {
3
+ box-sizing: border-box;
4
+ }
5
+
6
+ .label {
7
+ /* UI/Body */
8
+ font-family: 'Noto Sans';
9
+ font-size: 16px;
10
+ font-style: normal;
11
+ font-weight: 370;
12
+ line-height: 24px;
13
+ /* 150% */
14
+ text-decoration: none;
15
+ font-size: calc(16px / var(--scale));
16
+ fill: var(--element-neutral-color);
17
+ alignment-baseline: middle;
18
+ text-anchor: middle;
19
+ }
20
+
21
+ .label.left {
22
+ text-anchor: start;
23
+ }
24
+
25
+ .label.right {
26
+ text-anchor: end;
27
+ }
28
+ `;
29
+ export {
30
+ compentStyle as default
31
+ };
32
+ //# sourceMappingURL=watch-flat.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch-flat.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,29 @@
1
+ import { LitElement, SVGTemplateResult } from 'lit';
2
+ import { Tickmark } from './tickmark-flat';
3
+ import { Label } from '../compass-flat/compass-flat';
4
+ export declare class ObcWatchFlat extends LitElement {
5
+ width: number;
6
+ height: number;
7
+ padding: number;
8
+ rotation: number;
9
+ tickmarkSpacing: number;
10
+ angleSetpoint: number | undefined;
11
+ tickmarks: Tickmark[];
12
+ labels: Label[];
13
+ FOVIndicator: SVGTemplateResult[];
14
+ trackHeight: number;
15
+ ticksHeight: number;
16
+ borderRadius: number;
17
+ private renderClipPath;
18
+ private renderLabelMask;
19
+ private renderLabels;
20
+ private watchFace;
21
+ render(): import("lit-html").TemplateResult<1>;
22
+ static styles: import("lit").CSSResult;
23
+ }
24
+ declare global {
25
+ interface HTMLElementTagNameMap {
26
+ 'obc-watch-flat': ObcWatchFlat;
27
+ }
28
+ }
29
+ //# sourceMappingURL=watch-flat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch-flat.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/watch-flat/watch-flat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,iBAAiB,EAAuB,MAAM,KAAK,CAAC;AAGxE,OAAO,EAAC,QAAQ,EAA0B,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAC,KAAK,EAAC,MAAM,8BAA8B,CAAC;AAEnD,qBACa,YAAa,SAAQ,UAAU;IAChB,KAAK,SAAO;IACZ,MAAM,SAAM;IACZ,OAAO,SAAK;IACZ,QAAQ,SAAK;IACb,eAAe,SAAK;IACpB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IACjB,SAAS,EAAE,QAAQ,EAAE,CAAM;IAC3B,MAAM,EAAE,KAAK,EAAE,CAAM;IACrB,YAAY,EAAE,iBAAiB,EAAE,CACvE;IACqB,WAAW,SAAyB;IACpC,WAAW,SAAkC;IAC7C,YAAY,SAAK;IAE3C,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,eAAe;IAqBvB,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,SAAS;IAwCR,MAAM;IA8Bf,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,YAAY,CAAC;KAChC;CACF"}
@@ -0,0 +1,184 @@
1
+ import { unsafeCSS, LitElement, svg, html } from "lit";
2
+ import { property, customElement } from "lit/decorators.js";
3
+ import compentStyle from "./watch-flat.css.js";
4
+ import { tickmark, TickmarkStyle } from "./tickmark-flat.js";
5
+ import { rect } from "../../svghelpers/rectangular.js";
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __decorateClass = (decorators, target, key, kind) => {
9
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
10
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11
+ if (decorator = decorators[i])
12
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
13
+ if (kind && result)
14
+ __defProp(target, key, result);
15
+ return result;
16
+ };
17
+ let ObcWatchFlat = class extends LitElement {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.width = 352;
21
+ this.height = 72;
22
+ this.padding = 0;
23
+ this.rotation = 0;
24
+ this.tickmarkSpacing = 0;
25
+ this.tickmarks = [];
26
+ this.labels = [];
27
+ this.FOVIndicator = [];
28
+ this.trackHeight = 2 / 3 * this.height;
29
+ this.ticksHeight = this.height - this.trackHeight;
30
+ this.borderRadius = 8;
31
+ }
32
+ renderClipPath(offsetY = 0) {
33
+ return svg`
34
+ <clipPath id="frameClipPath${offsetY === 0 ? "" : "Tickmarks"}">
35
+ <rect x="${-this.width / 2}" y="${-this.height / 2 + offsetY}"
36
+ width="${this.width}" height="${this.height}"
37
+ rx="${this.borderRadius}" />
38
+ </clipPath>
39
+ `;
40
+ }
41
+ renderLabelMask() {
42
+ return svg`
43
+ <mask id="labelMask">
44
+ <rect x="${-this.width / 2}" y="${-70}"
45
+ width="${this.width}" height="${32}"
46
+ />
47
+ <linearGradient id="fadeGradient" gradientUnits="userSpaceOnUse"
48
+ x1="${-this.width / 2}" y1="0" x2="${this.width / 2}" y2="0">
49
+ <stop offset="0%" style="stop-color:black; stop-opacity:1;" />
50
+ <stop offset="10%" style="stop-color:white; stop-opacity:1;" />
51
+ <stop offset="50%" style="stop-color:white; stop-opacity:1;" />
52
+ <stop offset="90%" style="stop-color:white; stop-opacity:1;" />
53
+ <stop offset="100%" style="stop-color:black; stop-opacity:1;" />
54
+ </linearGradient>
55
+ <rect x="${-this.width / 2}" y="${-70}"
56
+ width="${this.width}" height="${32}"
57
+ fill="url(#fadeGradient)" />
58
+ </mask>
59
+ `;
60
+ }
61
+ renderLabels(scale) {
62
+ const labels = [];
63
+ for (const l of this.labels) {
64
+ labels.push(
65
+ svg`<g transform="translate(${-this.rotation * this.tickmarkSpacing}, ${-6 / scale})">
66
+ <text x=${l.x} y=${l.y} class="label" fill=${"var(--instrument-tick-mark-secondary-color)"}>
67
+ ${l.text}
68
+ </text>
69
+ </g>`
70
+ );
71
+ }
72
+ return labels;
73
+ }
74
+ watchFace() {
75
+ const strokeWidth = 1;
76
+ return svg`
77
+ ${this.renderClipPath()}
78
+ ${this.renderClipPath(-40)}
79
+ <g clip-path="url(#frameClipPath)">
80
+ ${rect("frame-track", {
81
+ width: this.width,
82
+ height: this.trackHeight,
83
+ y: this.height / 2 - this.trackHeight,
84
+ strokeWidth,
85
+ strokeColor: "var(--instrument-frame-secondary-color)",
86
+ strokePosition: "inside",
87
+ fillColor: "var(--instrument-frame-secondary-color)",
88
+ borderRadius: 0
89
+ })}
90
+ ${rect("frame-ticks", {
91
+ width: this.width,
92
+ height: this.ticksHeight,
93
+ y: this.height / 2 - this.trackHeight - this.ticksHeight,
94
+ strokeWidth,
95
+ strokeColor: "var(--instrument-frame-primary-color)",
96
+ strokePosition: "inside",
97
+ fillColor: "var(--instrument-frame-primary-color)",
98
+ borderRadius: 0
99
+ })}
100
+ </g>
101
+ ${rect("frame-outline", {
102
+ width: this.width,
103
+ height: this.height,
104
+ strokeWidth,
105
+ strokeColor: "var(--instrument-frame-tertiary-color)",
106
+ strokePosition: "inside",
107
+ fillColor: "none",
108
+ borderRadius: this.borderRadius
109
+ })}
110
+ `;
111
+ }
112
+ render() {
113
+ const width = (this.width / 2 + this.padding) * 2;
114
+ const viewBox = `-${width / 2} -${this.height / 2} ${width} ${this.height}`;
115
+ const scale = this.clientWidth / width;
116
+ return html`
117
+ <svg
118
+ width="100%"
119
+ height="100%"
120
+ viewBox=${viewBox}
121
+ style="--scale: ${scale}"
122
+ >
123
+ ${this.watchFace()} ${this.renderLabelMask()} ${this.FOVIndicator}
124
+
125
+ <g clip-path="url(#frameClipPath)">
126
+ ${this.tickmarks.map(
127
+ (t) => svg`
128
+ <g transform="translate(${-this.rotation * this.tickmarkSpacing}, 0)">
129
+ ${tickmark(t.angle, t.type, TickmarkStyle.hinted)}
130
+ </g>
131
+ `
132
+ )}
133
+ </g>
134
+
135
+ <g mask="url(#labelMask)">
136
+ ${this.renderLabels(scale)}
137
+ </svg>
138
+ `;
139
+ }
140
+ };
141
+ ObcWatchFlat.styles = unsafeCSS(compentStyle);
142
+ __decorateClass([
143
+ property({ type: Number })
144
+ ], ObcWatchFlat.prototype, "width", 2);
145
+ __decorateClass([
146
+ property({ type: Number })
147
+ ], ObcWatchFlat.prototype, "height", 2);
148
+ __decorateClass([
149
+ property({ type: Number })
150
+ ], ObcWatchFlat.prototype, "padding", 2);
151
+ __decorateClass([
152
+ property({ type: Number })
153
+ ], ObcWatchFlat.prototype, "rotation", 2);
154
+ __decorateClass([
155
+ property({ type: Number })
156
+ ], ObcWatchFlat.prototype, "tickmarkSpacing", 2);
157
+ __decorateClass([
158
+ property({ type: Number })
159
+ ], ObcWatchFlat.prototype, "angleSetpoint", 2);
160
+ __decorateClass([
161
+ property({ type: Array, attribute: false })
162
+ ], ObcWatchFlat.prototype, "tickmarks", 2);
163
+ __decorateClass([
164
+ property({ type: Array, attribute: false })
165
+ ], ObcWatchFlat.prototype, "labels", 2);
166
+ __decorateClass([
167
+ property({ type: Array, attribute: false })
168
+ ], ObcWatchFlat.prototype, "FOVIndicator", 2);
169
+ __decorateClass([
170
+ property({ type: Number })
171
+ ], ObcWatchFlat.prototype, "trackHeight", 2);
172
+ __decorateClass([
173
+ property({ type: Number })
174
+ ], ObcWatchFlat.prototype, "ticksHeight", 2);
175
+ __decorateClass([
176
+ property({ type: Number })
177
+ ], ObcWatchFlat.prototype, "borderRadius", 2);
178
+ ObcWatchFlat = __decorateClass([
179
+ customElement("obc-watch-flat")
180
+ ], ObcWatchFlat);
181
+ export {
182
+ ObcWatchFlat
183
+ };
184
+ //# sourceMappingURL=watch-flat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch-flat.js","sources":["../../../src/navigation-instruments/watch-flat/watch-flat.ts"],"sourcesContent":["import {LitElement, SVGTemplateResult, html, svg, unsafeCSS} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\nimport compentStyle from './watch-flat.css?inline';\nimport {Tickmark, TickmarkStyle, tickmark} from './tickmark-flat';\nimport {rect} from '../../svghelpers/rectangular';\nimport {Label} from '../compass-flat/compass-flat';\n\n@customElement('obc-watch-flat')\nexport class ObcWatchFlat extends LitElement {\n @property({type: Number}) width = 352;\n @property({type: Number}) height = 72;\n @property({type: Number}) padding = 0;\n @property({type: Number}) rotation = 0;\n @property({type: Number}) tickmarkSpacing = 0;\n @property({type: Number}) angleSetpoint: number | undefined;\n @property({type: Array, attribute: false}) tickmarks: Tickmark[] = [];\n @property({type: Array, attribute: false}) labels: Label[] = [];\n @property({type: Array, attribute: false}) FOVIndicator: SVGTemplateResult[] =\n [];\n @property({type: Number}) trackHeight = (2 / 3) * this.height;\n @property({type: Number}) ticksHeight = this.height - this.trackHeight;\n @property({type: Number}) borderRadius = 8;\n\n private renderClipPath(offsetY: number = 0): SVGTemplateResult {\n return svg`\n <clipPath id=\"frameClipPath${offsetY === 0 ? '' : 'Tickmarks'}\">\n <rect x=\"${-this.width / 2}\" y=\"${-this.height / 2 + offsetY}\" \n width=\"${this.width}\" height=\"${this.height}\" \n rx=\"${this.borderRadius}\" />\n </clipPath>\n `;\n }\n\n private renderLabelMask(): SVGTemplateResult {\n return svg`\n <mask id=\"labelMask\">\n <rect x=\"${-this.width / 2}\" y=\"${-70}\" \n width=\"${this.width}\" height=\"${32}\"\n />\n <linearGradient id=\"fadeGradient\" gradientUnits=\"userSpaceOnUse\"\n x1=\"${-this.width / 2}\" y1=\"0\" x2=\"${this.width / 2}\" y2=\"0\">\n <stop offset=\"0%\" style=\"stop-color:black; stop-opacity:1;\" />\n <stop offset=\"10%\" style=\"stop-color:white; stop-opacity:1;\" />\n <stop offset=\"50%\" style=\"stop-color:white; stop-opacity:1;\" />\n <stop offset=\"90%\" style=\"stop-color:white; stop-opacity:1;\" />\n <stop offset=\"100%\" style=\"stop-color:black; stop-opacity:1;\" />\n </linearGradient>\n <rect x=\"${-this.width / 2}\" y=\"${-70}\" \n width=\"${this.width}\" height=\"${32}\"\n fill=\"url(#fadeGradient)\" />\n </mask>\n `;\n }\n\n private renderLabels(scale: number): SVGTemplateResult[] {\n const labels: SVGTemplateResult[] = [];\n\n for (const l of this.labels) {\n labels.push(\n svg`<g transform=\"translate(${-this.rotation * this.tickmarkSpacing}, ${-6 / scale})\">\n <text x=${l.x} y=${l.y} class=\"label\" fill=${'var(--instrument-tick-mark-secondary-color)'}>\n ${l.text}\n </text>\n </g>`\n );\n }\n\n return labels;\n }\n\n private watchFace(): SVGTemplateResult {\n const strokeWidth = 1;\n\n return svg`\n ${this.renderClipPath()}\n ${this.renderClipPath(-40)}\n <g clip-path=\"url(#frameClipPath)\">\n ${rect('frame-track', {\n width: this.width,\n height: this.trackHeight,\n y: this.height / 2 - this.trackHeight,\n strokeWidth: strokeWidth,\n strokeColor: 'var(--instrument-frame-secondary-color)',\n strokePosition: 'inside',\n fillColor: 'var(--instrument-frame-secondary-color)',\n borderRadius: 0,\n })}\n ${rect('frame-ticks', {\n width: this.width,\n height: this.ticksHeight,\n y: this.height / 2 - this.trackHeight - this.ticksHeight,\n strokeWidth: strokeWidth,\n strokeColor: 'var(--instrument-frame-primary-color)',\n strokePosition: 'inside',\n fillColor: 'var(--instrument-frame-primary-color)',\n borderRadius: 0,\n })}\n </g>\n ${rect('frame-outline', {\n width: this.width,\n height: this.height,\n strokeWidth: strokeWidth,\n strokeColor: 'var(--instrument-frame-tertiary-color)',\n strokePosition: 'inside',\n fillColor: 'none',\n borderRadius: this.borderRadius,\n })}\n `;\n }\n\n override render() {\n const width = (this.width / 2 + this.padding) * 2;\n const viewBox = `-${width / 2} -${this.height / 2} ${width} ${this.height}`;\n const scale = this.clientWidth / width;\n\n return html`\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox=${viewBox}\n style=\"--scale: ${scale}\"\n >\n ${this.watchFace()} ${this.renderLabelMask()} ${this.FOVIndicator}\n\n <g clip-path=\"url(#frameClipPath)\">\n ${this.tickmarks.map(\n (t) => svg`\n <g transform=\"translate(${-this.rotation * this.tickmarkSpacing}, 0)\">\n ${tickmark(t.angle, t.type, TickmarkStyle.hinted)}\n </g>\n `\n )}\n </g>\n\n <g mask=\"url(#labelMask)\">\n ${this.renderLabels(scale)}\n </svg>\n `;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-watch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