@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.69 → 2.0.0-next.71

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.
@@ -63955,6 +63955,100 @@
63955
63955
  }
63956
63956
  ]
63957
63957
  },
63958
+ {
63959
+ "kind": "javascript-module",
63960
+ "path": "src/components/textbox/textbox.ts",
63961
+ "declarations": [
63962
+ {
63963
+ "kind": "class",
63964
+ "description": "`<obc-textbox>` – A text container that renders inline text at a\nprecise, cap-height-trimmed size with configurable alignment and reservable\nwidth.\n\nUse it to present short, read-only strings – such as values, labels, or\nunits – where vertical metrics must line up exactly across rows and the\nhorizontal footprint should stay stable while the text changes (for example\na numeric value that updates frequently). Synonyms: text container, value\nbox, label box.\n\n## Features / Variants\n- **Size:** `xs`, `s`, `m` (default), `l`, `xl` – each maps to a fixed box\n height (16 / 20 / 24 / 32 / 40 px) with 4px padding above and below, giving\n cap heights of 8 / 12 / 16 / 24 / 32 px so text aligns to a predictable\n grid.\n- **Font weight:** `regular` (default), `semibold`, `bold`.\n- **Alignment:** `left`, `center`, `right` (default) – positions the text\n within the box's width when the box is wider than the content.\n- **Reserved width:** content placed in the `length` slot reserves a minimum\n width invisibly, so the box does not resize as the visible text changes.\n The box always shows all content – it never crops.\n\n## Usage Guidelines\n- Pass the longest expected string to the `length` slot (e.g. `\"888.8\"` or\n `\"Wind speed\"`) so the box reserves space and does not jump in width as the\n visible value updates.\n- This is a display primitive for static text – use an input component for\n editable values.\n\n## Slots\n| Slot | Renders when… | Purpose |\n|-----------|--------------------|------------------------------------------------------|\n| (default) | Always | The visible text content. |\n| `length` | Always (invisible) | Reserves a minimum width based on its content width. |",
63965
+ "name": "ObcTextbox",
63966
+ "slots": [
63967
+ {
63968
+ "description": "The visible text content.",
63969
+ "name": ""
63970
+ },
63971
+ {
63972
+ "description": "Reserves a minimum width based on its content width.",
63973
+ "name": "length"
63974
+ }
63975
+ ],
63976
+ "members": [
63977
+ {
63978
+ "kind": "field",
63979
+ "name": "alignment",
63980
+ "type": {
63981
+ "text": "ObcTextboxAlignment"
63982
+ },
63983
+ "attribute": "alignment"
63984
+ },
63985
+ {
63986
+ "kind": "field",
63987
+ "name": "size",
63988
+ "type": {
63989
+ "text": "ObcTextboxSize"
63990
+ },
63991
+ "attribute": "size"
63992
+ },
63993
+ {
63994
+ "kind": "field",
63995
+ "name": "fontWeight",
63996
+ "type": {
63997
+ "text": "ObcTextboxFontWeight"
63998
+ },
63999
+ "attribute": "fontWeight"
64000
+ }
64001
+ ],
64002
+ "attributes": [
64003
+ {
64004
+ "name": "alignment",
64005
+ "type": {
64006
+ "text": "ObcTextboxAlignment"
64007
+ },
64008
+ "fieldName": "alignment"
64009
+ },
64010
+ {
64011
+ "name": "size",
64012
+ "type": {
64013
+ "text": "ObcTextboxSize"
64014
+ },
64015
+ "fieldName": "size"
64016
+ },
64017
+ {
64018
+ "name": "fontWeight",
64019
+ "type": {
64020
+ "text": "ObcTextboxFontWeight"
64021
+ },
64022
+ "fieldName": "fontWeight"
64023
+ }
64024
+ ],
64025
+ "superclass": {
64026
+ "name": "LitElement",
64027
+ "package": "lit"
64028
+ },
64029
+ "tagName": "obc-textbox",
64030
+ "customElement": true
64031
+ }
64032
+ ],
64033
+ "exports": [
64034
+ {
64035
+ "kind": "js",
64036
+ "name": "ObcTextbox",
64037
+ "declaration": {
64038
+ "name": "ObcTextbox",
64039
+ "module": "src/components/textbox/textbox.ts"
64040
+ }
64041
+ },
64042
+ {
64043
+ "kind": "custom-element-definition",
64044
+ "name": "obc-textbox",
64045
+ "declaration": {
64046
+ "name": "ObcTextbox",
64047
+ "module": "src/components/textbox/textbox.ts"
64048
+ }
64049
+ }
64050
+ ]
64051
+ },
63958
64052
  {
63959
64053
  "kind": "javascript-module",
63960
64054
  "path": "src/components/title-container/title-container.ts",
@@ -80299,19 +80393,19 @@
80299
80393
  "kind": "field",
80300
80394
  "name": "y",
80301
80395
  "type": {
80302
- "text": "number"
80396
+ "text": "number | undefined"
80303
80397
  },
80304
80398
  "privacy": "private",
80305
- "default": "24"
80399
+ "default": "undefined"
80306
80400
  },
80307
80401
  {
80308
80402
  "kind": "field",
80309
80403
  "name": "zeroLineY",
80310
80404
  "type": {
80311
- "text": "number"
80405
+ "text": "number | undefined"
80312
80406
  },
80313
80407
  "privacy": "private",
80314
- "default": "0"
80408
+ "default": "undefined"
80315
80409
  },
80316
80410
  {
80317
80411
  "kind": "field",
@@ -0,0 +1,114 @@
1
+ import { css } from "lit";
2
+ const componentStyle = css`
3
+ * {
4
+ -webkit-tap-highlight-color: transparent;
5
+ }
6
+
7
+ :host {
8
+ display: inline-block;
9
+ line-height: 0;
10
+ }
11
+
12
+ .wrapper {
13
+ display: inline-flex;
14
+ flex-direction: column;
15
+ width: fit-content;
16
+ --height: 24px;
17
+ --padding: 4px;
18
+ font-family: var(--font-family-main);
19
+ letter-spacing: var(--global-typography-generic-l-letter-spacing);
20
+ }
21
+
22
+ /* The inner-wrapper is the box: its height (--height) is the full textbox
23
+ height, padding included. The content is sized to the cap height and
24
+ vertically centered, which leaves the padding as equal space above and
25
+ below. In engines that support text-box-trim the content box collapses to
26
+ the cap height exactly; in Firefox (no text-box-trim) the content keeps its
27
+ natural line box, so align-items:center + overflow:hidden crops it to the
28
+ same height instead. No padding here – the centering provides it.
29
+ (A small top padding could be added later to nudge the text up in Firefox.) */
30
+
31
+ .inner-wrapper {
32
+ box-sizing: border-box;
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: var(--alignment-justify, flex-end);
36
+ height: var(--height);
37
+ overflow: hidden;
38
+ }
39
+
40
+ /* The spacer must share the content's exact font metrics so the width it
41
+ reserves equals the rendered content width. font-size-adjust scales the
42
+ font, so it has to match too. */
43
+
44
+ .content,
45
+ .length-spacer {
46
+ font-size: calc(var(--height) - 2 * var(--padding));
47
+ font-size-adjust: cap-height 1;
48
+ white-space: nowrap;
49
+ }
50
+
51
+ .content {
52
+ text-box-trim: trim-both;
53
+ text-box-edge: cap alphabetic;
54
+ }
55
+
56
+ .wrapper.size-xs .inner-wrapper {
57
+ --height: 16px;
58
+ }
59
+
60
+ .wrapper.size-s .inner-wrapper {
61
+ --height: 20px;
62
+ }
63
+
64
+ .wrapper.size-m .inner-wrapper {
65
+ --height: 24px;
66
+ }
67
+
68
+ .wrapper.size-l .inner-wrapper {
69
+ --height: 32px;
70
+ }
71
+
72
+ .wrapper.size-xl .inner-wrapper {
73
+ --height: 40px;
74
+ }
75
+
76
+ .wrapper.font-weight-regular {
77
+ font-weight: var(--global-typography-generic-l-font-weight-regular);
78
+ }
79
+
80
+ .wrapper.font-weight-semibold {
81
+ font-weight: var(--global-typography-generic-l-font-weight-medium);
82
+ }
83
+
84
+ .wrapper.font-weight-bold {
85
+ font-weight: var(--global-typography-generic-l-font-weight-bold);
86
+ }
87
+
88
+ .wrapper.alignment-left {
89
+ --alignment-justify: flex-start;
90
+ }
91
+
92
+ .wrapper.alignment-center {
93
+ --alignment-justify: center;
94
+ }
95
+
96
+ .wrapper.alignment-right {
97
+ --alignment-justify: flex-end;
98
+ }
99
+
100
+ /* Reserves the box width from the \`length\` slot without occupying vertical
101
+ space. Acts as a minimum width so the box does not resize as visible
102
+ text changes. */
103
+
104
+ .length-spacer {
105
+ height: 0;
106
+ opacity: 0;
107
+ visibility: hidden;
108
+ overflow: hidden;
109
+ }
110
+ `;
111
+ export {
112
+ componentStyle as default
113
+ };
114
+ //# sourceMappingURL=textbox.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textbox.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,70 @@
1
+ import { LitElement } from 'lit';
2
+ export declare enum ObcTextboxAlignment {
3
+ Left = "left",
4
+ Center = "center",
5
+ Right = "right"
6
+ }
7
+ export declare enum ObcTextboxSize {
8
+ xs = "xs",
9
+ s = "s",
10
+ m = "m",
11
+ l = "l",
12
+ xl = "xl"
13
+ }
14
+ export declare enum ObcTextboxFontWeight {
15
+ regular = "regular",
16
+ semibold = "semibold",
17
+ bold = "bold"
18
+ }
19
+ /**
20
+ * `<obc-textbox>` – A text container that renders inline text at a
21
+ * precise, cap-height-trimmed size with configurable alignment and reservable
22
+ * width.
23
+ *
24
+ * Use it to present short, read-only strings – such as values, labels, or
25
+ * units – where vertical metrics must line up exactly across rows and the
26
+ * horizontal footprint should stay stable while the text changes (for example
27
+ * a numeric value that updates frequently). Synonyms: text container, value
28
+ * box, label box.
29
+ *
30
+ * ## Features / Variants
31
+ * - **Size:** `xs`, `s`, `m` (default), `l`, `xl` – each maps to a fixed box
32
+ * height (16 / 20 / 24 / 32 / 40 px) with 4px padding above and below, giving
33
+ * cap heights of 8 / 12 / 16 / 24 / 32 px so text aligns to a predictable
34
+ * grid.
35
+ * - **Font weight:** `regular` (default), `semibold`, `bold`.
36
+ * - **Alignment:** `left`, `center`, `right` (default) – positions the text
37
+ * within the box's width when the box is wider than the content.
38
+ * - **Reserved width:** content placed in the `length` slot reserves a minimum
39
+ * width invisibly, so the box does not resize as the visible text changes.
40
+ * The box always shows all content – it never crops.
41
+ *
42
+ * ## Usage Guidelines
43
+ * - Pass the longest expected string to the `length` slot (e.g. `"888.8"` or
44
+ * `"Wind speed"`) so the box reserves space and does not jump in width as the
45
+ * visible value updates.
46
+ * - This is a display primitive for static text – use an input component for
47
+ * editable values.
48
+ *
49
+ * ## Slots
50
+ * | Slot | Renders when… | Purpose |
51
+ * |-----------|--------------------|------------------------------------------------------|
52
+ * | (default) | Always | The visible text content. |
53
+ * | `length` | Always (invisible) | Reserves a minimum width based on its content width. |
54
+ *
55
+ * @slot - The visible text content.
56
+ * @slot length - Reserves a minimum width based on its content width.
57
+ */
58
+ export declare class ObcTextbox extends LitElement {
59
+ alignment: ObcTextboxAlignment;
60
+ size: ObcTextboxSize;
61
+ fontWeight: ObcTextboxFontWeight;
62
+ render(): import('lit-html').TemplateResult<1>;
63
+ static styles: import('lit').CSSResult;
64
+ }
65
+ declare global {
66
+ interface HTMLElementTagNameMap {
67
+ 'obc-textbox': ObcTextbox;
68
+ }
69
+ }
70
+ //# sourceMappingURL=textbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textbox.d.ts","sourceRoot":"","sources":["../../../src/components/textbox/textbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAkB,MAAM,KAAK,CAAC;AAMhD,oBAAY,mBAAmB;IAC7B,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED,oBAAY,cAAc;IACxB,EAAE,OAAO;IACT,CAAC,MAAM;IACP,CAAC,MAAM;IACP,CAAC,MAAM;IACP,EAAE,OAAO;CACV;AAED,oBAAY,oBAAoB;IAC9B,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,IAAI,SAAS;CACd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBACa,UAAW,SAAQ,UAAU;IACd,SAAS,EAAE,mBAAmB,CAC5B;IACF,IAAI,EAAE,cAAc,CAAoB;IACxC,UAAU,EAAE,oBAAoB,CAC3B;IAEtB,MAAM;IAsBf,OAAgB,MAAM,0BAA6B;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
@@ -0,0 +1,84 @@
1
+ import { unsafeCSS, LitElement, html } from "lit";
2
+ import { customElement } from "../../decorator.js";
3
+ import componentStyle from "./textbox.css.js";
4
+ import { property } from "lit/decorators.js";
5
+ import { classMap } from "lit/directives/class-map.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) __defProp(target, key, result);
14
+ return result;
15
+ };
16
+ var ObcTextboxAlignment = /* @__PURE__ */ ((ObcTextboxAlignment2) => {
17
+ ObcTextboxAlignment2["Left"] = "left";
18
+ ObcTextboxAlignment2["Center"] = "center";
19
+ ObcTextboxAlignment2["Right"] = "right";
20
+ return ObcTextboxAlignment2;
21
+ })(ObcTextboxAlignment || {});
22
+ var ObcTextboxSize = /* @__PURE__ */ ((ObcTextboxSize2) => {
23
+ ObcTextboxSize2["xs"] = "xs";
24
+ ObcTextboxSize2["s"] = "s";
25
+ ObcTextboxSize2["m"] = "m";
26
+ ObcTextboxSize2["l"] = "l";
27
+ ObcTextboxSize2["xl"] = "xl";
28
+ return ObcTextboxSize2;
29
+ })(ObcTextboxSize || {});
30
+ var ObcTextboxFontWeight = /* @__PURE__ */ ((ObcTextboxFontWeight2) => {
31
+ ObcTextboxFontWeight2["regular"] = "regular";
32
+ ObcTextboxFontWeight2["semibold"] = "semibold";
33
+ ObcTextboxFontWeight2["bold"] = "bold";
34
+ return ObcTextboxFontWeight2;
35
+ })(ObcTextboxFontWeight || {});
36
+ let ObcTextbox = class extends LitElement {
37
+ constructor() {
38
+ super(...arguments);
39
+ this.alignment = "right";
40
+ this.size = "m";
41
+ this.fontWeight = "regular";
42
+ }
43
+ render() {
44
+ return html`
45
+ <div
46
+ class=${classMap({
47
+ wrapper: true,
48
+ [`alignment-${this.alignment}`]: true,
49
+ [`size-${this.size}`]: true,
50
+ [`font-weight-${this.fontWeight}`]: true
51
+ })}
52
+ >
53
+ <div class="inner-wrapper">
54
+ <div class="content">
55
+ <slot></slot>
56
+ </div>
57
+ </div>
58
+ <div class="length-spacer" aria-hidden="true">
59
+ <slot name="length"></slot>
60
+ </div>
61
+ </div>
62
+ `;
63
+ }
64
+ };
65
+ ObcTextbox.styles = unsafeCSS(componentStyle);
66
+ __decorateClass([
67
+ property({ type: String })
68
+ ], ObcTextbox.prototype, "alignment", 2);
69
+ __decorateClass([
70
+ property({ type: String })
71
+ ], ObcTextbox.prototype, "size", 2);
72
+ __decorateClass([
73
+ property({ type: String })
74
+ ], ObcTextbox.prototype, "fontWeight", 2);
75
+ ObcTextbox = __decorateClass([
76
+ customElement("obc-textbox")
77
+ ], ObcTextbox);
78
+ export {
79
+ ObcTextbox,
80
+ ObcTextboxAlignment,
81
+ ObcTextboxFontWeight,
82
+ ObcTextboxSize
83
+ };
84
+ //# sourceMappingURL=textbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textbox.js","sources":["../../../src/components/textbox/textbox.ts"],"sourcesContent":["import {LitElement, html, unsafeCSS} from 'lit';\nimport {customElement} from '../../decorator.js';\nimport componentStyle from './textbox.css?inline';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\n\nexport enum ObcTextboxAlignment {\n Left = 'left',\n Center = 'center',\n Right = 'right',\n}\n\nexport enum ObcTextboxSize {\n xs = 'xs',\n s = 's',\n m = 'm',\n l = 'l',\n xl = 'xl',\n}\n\nexport enum ObcTextboxFontWeight {\n regular = 'regular',\n semibold = 'semibold',\n bold = 'bold',\n}\n\n/**\n * `<obc-textbox>` – A text container that renders inline text at a\n * precise, cap-height-trimmed size with configurable alignment and reservable\n * width.\n *\n * Use it to present short, read-only strings – such as values, labels, or\n * units – where vertical metrics must line up exactly across rows and the\n * horizontal footprint should stay stable while the text changes (for example\n * a numeric value that updates frequently). Synonyms: text container, value\n * box, label box.\n *\n * ## Features / Variants\n * - **Size:** `xs`, `s`, `m` (default), `l`, `xl` – each maps to a fixed box\n * height (16 / 20 / 24 / 32 / 40 px) with 4px padding above and below, giving\n * cap heights of 8 / 12 / 16 / 24 / 32 px so text aligns to a predictable\n * grid.\n * - **Font weight:** `regular` (default), `semibold`, `bold`.\n * - **Alignment:** `left`, `center`, `right` (default) – positions the text\n * within the box's width when the box is wider than the content.\n * - **Reserved width:** content placed in the `length` slot reserves a minimum\n * width invisibly, so the box does not resize as the visible text changes.\n * The box always shows all content – it never crops.\n *\n * ## Usage Guidelines\n * - Pass the longest expected string to the `length` slot (e.g. `\"888.8\"` or\n * `\"Wind speed\"`) so the box reserves space and does not jump in width as the\n * visible value updates.\n * - This is a display primitive for static text – use an input component for\n * editable values.\n *\n * ## Slots\n * | Slot | Renders when… | Purpose |\n * |-----------|--------------------|------------------------------------------------------|\n * | (default) | Always | The visible text content. |\n * | `length` | Always (invisible) | Reserves a minimum width based on its content width. |\n *\n * @slot - The visible text content.\n * @slot length - Reserves a minimum width based on its content width.\n */\n@customElement('obc-textbox')\nexport class ObcTextbox extends LitElement {\n @property({type: String}) alignment: ObcTextboxAlignment =\n ObcTextboxAlignment.Right;\n @property({type: String}) size: ObcTextboxSize = ObcTextboxSize.m;\n @property({type: String}) fontWeight: ObcTextboxFontWeight =\n ObcTextboxFontWeight.regular;\n\n override render() {\n return html`\n <div\n class=${classMap({\n wrapper: true,\n [`alignment-${this.alignment}`]: true,\n [`size-${this.size}`]: true,\n [`font-weight-${this.fontWeight}`]: true,\n })}\n >\n <div class=\"inner-wrapper\">\n <div class=\"content\">\n <slot></slot>\n </div>\n </div>\n <div class=\"length-spacer\" aria-hidden=\"true\">\n <slot name=\"length\"></slot>\n </div>\n </div>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-textbox': ObcTextbox;\n }\n}\n"],"names":["ObcTextboxAlignment","ObcTextboxSize","ObcTextboxFontWeight"],"mappings":";;;;;;;;;;;;;;;AAMO,IAAK,wCAAAA,yBAAL;AACLA,uBAAA,MAAA,IAAO;AACPA,uBAAA,QAAA,IAAS;AACTA,uBAAA,OAAA,IAAQ;AAHE,SAAAA;AAAA,GAAA,uBAAA,CAAA,CAAA;AAML,IAAK,mCAAA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;
16
16
  max?: number;
17
+ showZeroLine?: boolean;
17
18
  };
18
19
  }
19
20
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"indicator-graph.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/indicator-graph/indicator-graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,cAAc,EAAkB,MAAM,KAAK,CAAC;AAMhE,oBAAY,qBAAqB;IAC/B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED,oBAAY,yBAAyB;IACnC,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IACrC,CAAC,CAAC,EAAE;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;CAClC;AAED;;;;;GAKG;AACH,qBACa,iBAAkB,SAAQ,UAAU;IAE/C,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAY;IAGtC,MAAM,EAAE,uBAAuB,CAAM;IAGrC,OAAO,CAAC,KAAK,CAAkB;IAG/B,OAAO,CAAC,CAAC,CAAc;IAGvB,OAAO,CAAC,SAAS,CAAa;IAE9B,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,cAAc,CAA+B;IAErD,OAAO,CAAC,WAAW;IAKV,YAAY;IAmCZ,oBAAoB;IAQ7B,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,MAAM;IAed,OAAO,KAAK,cAAc,GAEzB;IAED,OAAO,KAAK,kBAAkB,GAE7B;IAED,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,eAAe;IASvB,aAAa;IAab,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,cAAc;IASb,OAAO,CAAC,iBAAiB,EAAE,cAAc;IAQzC,MAAM;IAsBf,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,qBAAqB,EAAE,iBAAiB,CAAC;KAC1C;CACF"}
1
+ {"version":3,"file":"indicator-graph.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/indicator-graph/indicator-graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,cAAc,EAAkB,MAAM,KAAK,CAAC;AAMhE,oBAAY,qBAAqB;IAC/B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED,oBAAY,yBAAyB;IACnC,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAGD,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IACrC,CAAC,CAAC,EAAE;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC;CAC1D;AAED;;;;;GAKG;AACH,qBACa,iBAAkB,SAAQ,UAAU;IAE/C,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAY;IAGtC,MAAM,EAAE,uBAAuB,CAAM;IAGrC,OAAO,CAAC,KAAK,CAAkB;IAG/B,OAAO,CAAC,CAAC,CAAiC;IAG1C,OAAO,CAAC,SAAS,CAAiC;IAElD,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,cAAc,CAA+B;IAErD,OAAO,CAAC,WAAW;IAKV,YAAY;IAmCZ,oBAAoB;IAQ7B,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,MAAM;IAed,OAAO,KAAK,cAAc,GAEzB;IAED,OAAO,KAAK,kBAAkB,GAE7B;IAED,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,eAAe;IASvB,aAAa;IAab,OAAO,CAAC,OAAO;IAef,OAAO,CAAC,cAAc;IAab,OAAO,CAAC,iBAAiB,EAAE,cAAc;IAQzC,MAAM;IAsBf,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,qBAAqB,EAAE,iBAAiB,CAAC;KAC1C;CACF"}
@@ -29,8 +29,8 @@ let ObcIndicatorGraph = class extends LitElement {
29
29
  super(...arguments);
30
30
  this.data = [[], []];
31
31
  this.layout = {};
32
- this.y = 24;
33
- this.zeroLineY = 0;
32
+ this.y = void 0;
33
+ this.zeroLineY = void 0;
34
34
  this.uplot = null;
35
35
  this.resizeObserver = null;
36
36
  }
@@ -91,7 +91,7 @@ let ObcIndicatorGraph = class extends LitElement {
91
91
  const { min: minY, max: maxY } = this.layout.y ?? {};
92
92
  const range = maxY ?? initMax - (minY ?? initMin);
93
93
  let min = minY ?? initMin - range * 0.1;
94
- if (minY === void 0) {
94
+ if (minY === void 0 && this.layout.y?.showZeroLine !== false) {
95
95
  min = Math.min(0, min);
96
96
  }
97
97
  return [min, maxY ?? initMax + range * 0.1];
@@ -138,7 +138,11 @@ let ObcIndicatorGraph = class extends LitElement {
138
138
  }
139
139
  const lastY = this.data[1][this.data[1].length - 1];
140
140
  const yRatio = this.uplot.scales.y.valToPct(lastY);
141
- this.y = yRatio * this.chart.clientHeight;
141
+ if (yRatio < 0 || yRatio > 1) {
142
+ this.y = void 0;
143
+ } else {
144
+ this.y = yRatio * this.chart.clientHeight;
145
+ }
142
146
  this.updateZeroLine();
143
147
  }
144
148
  updateZeroLine() {
@@ -146,6 +150,10 @@ let ObcIndicatorGraph = class extends LitElement {
146
150
  return;
147
151
  }
148
152
  const yRatio = this.uplot.scales.y.valToPct(0);
153
+ if (yRatio < 0 || yRatio > 1) {
154
+ this.zeroLineY = void 0;
155
+ return;
156
+ }
149
157
  this.zeroLineY = yRatio * this.chart.clientHeight;
150
158
  }
151
159
  updated(changedProperties) {
@@ -162,15 +170,15 @@ let ObcIndicatorGraph = class extends LitElement {
162
170
  >
163
171
  <div
164
172
  id="zero-line"
165
- style="transform: translateY(${-this.zeroLineY}px);
166
- display: ${this.zeroLineY > -0.5 ? "block" : "none"};
173
+ style="transform: translateY(${-(this.zeroLineY ?? 0)}px);
174
+ display: ${this.zeroLineY !== void 0 ? "block" : "none"};
167
175
  "
168
176
  ></div>
169
177
  <div
170
178
  id="dot"
171
- style="transform: translateY(${-this.y}px);
172
- display: ${this.y > -0.5 ? "block" : "none"};
173
- "
179
+ style="transform: translateY(${-(this.y ?? 0)}px);
180
+ display: ${this.y !== void 0 ? "block" : "none"};
181
+ "
174
182
  ></div>
175
183
  </div>
176
184
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"indicator-graph.js","sources":["../../../src/navigation-instruments/indicator-graph/indicator-graph.ts"],"sourcesContent":["import {LitElement, PropertyValues, html, unsafeCSS} from 'lit';\nimport {property, query, state} from 'lit/decorators.js';\nimport compentStyle from './indicator-graph.css?inline';\nimport uPlot from 'uplot';\nimport {customElement} from '../../decorator.js';\n\nexport enum ObcIndicatorGraphSize {\n small = 'small',\n medium = 'medium',\n large = 'large',\n}\n\nexport enum ObcIndicatorGraphPriority {\n regular = 'regular',\n enhanced = 'enhanced',\n}\n\nexport interface ObcIndicatorGraphLayout {\n size?: ObcIndicatorGraphSize;\n priority?: ObcIndicatorGraphPriority;\n y?: {min?: number; max?: number};\n}\n\n/**\n * @element obc-indicator-graph\n * @description A mini graph component\n *\n * @property {Array} data - The data to display in the graph, first array is the x values, second array is the y values\n */\n@customElement('obc-indicator-graph')\nexport class ObcIndicatorGraph extends LitElement {\n @property({type: Array})\n data: [number[], number[]] = [[], []];\n\n @property({type: Object})\n layout: ObcIndicatorGraphLayout = {};\n\n @query('.chart-container')\n private chart!: HTMLDivElement;\n\n @state()\n private y: number = 24;\n\n @state()\n private zeroLineY: number = 0;\n\n private uplot: uPlot | null = null;\n private resizeObserver: ResizeObserver | null = null;\n\n private getCssColor(name: string) {\n const color = getComputedStyle(this).getPropertyValue(name).trim();\n return color;\n }\n\n override firstUpdated() {\n const opts = {\n width: this.chart.clientWidth,\n height: this.chart.clientHeight,\n scales: {\n x: {time: false, show: false},\n y: {\n auto: true,\n show: false,\n range: this._range.bind(this),\n },\n },\n series: [\n {},\n {\n stroke: this._getStrokeColor(),\n width: this._getStrokeWidth(),\n points: {show: false},\n },\n ],\n axes: [\n {show: false},\n {ticks: {show: false}, show: false, grid: {show: false}},\n ],\n legend: {show: false},\n cursor: {show: false},\n };\n\n this.uplot = new uPlot(opts, this.data, this.chart);\n requestAnimationFrame(() => this.updateY());\n\n this.resizeObserver = new ResizeObserver(() => this.updateSize());\n this.resizeObserver.observe(this.chart);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n this.uplot?.destroy();\n this.uplot = null;\n }\n\n private updateSize() {\n if (!this.uplot) {\n return;\n }\n this.uplot.setSize({\n width: this.chart.clientWidth,\n height: this.chart.clientHeight,\n });\n this.updateY();\n }\n\n private _range(\n _self: uPlot,\n initMin: number,\n initMax: number,\n _scaleKey: string\n ): [number, number] {\n const {min: minY, max: maxY} = this.layout.y ?? {};\n const range = maxY ?? initMax - (minY ?? initMin);\n let min = minY ?? initMin - range * 0.1;\n if (minY === undefined) {\n min = Math.min(0, min);\n }\n return [min, maxY ?? initMax + range * 0.1] as [number, number];\n }\n\n private get _effectiveSize() {\n return this.layout.size ?? ObcIndicatorGraphSize.medium;\n }\n\n private get _effectivePriority() {\n return this.layout.priority ?? ObcIndicatorGraphPriority.regular;\n }\n\n private _getStrokeWidth() {\n switch (this._effectiveSize) {\n case ObcIndicatorGraphSize.small:\n return 1;\n case ObcIndicatorGraphSize.medium:\n return 1.5;\n case ObcIndicatorGraphSize.large:\n return 2;\n }\n }\n\n private _getStrokeColor() {\n switch (this._effectivePriority) {\n case ObcIndicatorGraphPriority.regular:\n return this.getCssColor('--element-neutral-color');\n case ObcIndicatorGraphPriority.enhanced:\n return this.getCssColor('--element-neutral-enhanced-color');\n }\n }\n\n updatePalette() {\n if (!this.uplot) {\n return;\n }\n const stroke = this._getStrokeColor();\n this.uplot.setSeries(1, {\n // @ts-expect-error - stroke is not a property of the Series interface\n stroke: stroke,\n width: this._getStrokeWidth(),\n points: {show: false},\n });\n }\n\n private updateY() {\n if (!this.uplot) {\n return;\n }\n const lastY = this.data[1][this.data[1].length - 1];\n // @ts-expect-error - valToPct is not a property of the Scale interface\n const yRatio = this.uplot.scales.y.valToPct(lastY);\n this.y = yRatio * this.chart.clientHeight;\n this.updateZeroLine();\n }\n\n private updateZeroLine() {\n if (!this.uplot) {\n return;\n }\n // @ts-expect-error - valToPct is not a property of the Scale interface\n const yRatio = this.uplot.scales.y.valToPct(0);\n this.zeroLineY = yRatio * this.chart.clientHeight;\n }\n\n override updated(changedProperties: PropertyValues) {\n if (changedProperties.has('data') || changedProperties.has('layout')) {\n this.updatePalette();\n this.uplot?.setData(this.data);\n requestAnimationFrame(() => this.updateY());\n }\n }\n\n override render() {\n return html`\n <div\n class=\"chart-container ${this._effectivePriority} ${this\n ._effectiveSize}\"\n >\n <div\n id=\"zero-line\"\n style=\"transform: translateY(${-this.zeroLineY}px);\n display: ${this.zeroLineY > -0.5 ? 'block' : 'none'};\n \"\n ></div>\n <div\n id=\"dot\"\n style=\"transform: translateY(${-this.y}px);\n display: ${this.y > -0.5 ? 'block' : 'none'};\n \"\n ></div>\n </div>\n `;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-indicator-graph': ObcIndicatorGraph;\n }\n}\n"],"names":["ObcIndicatorGraphSize","ObcIndicatorGraphPriority"],"mappings":";;;;;;;;;;;;;;;AAMO,IAAK,0CAAAA,2BAAL;AACLA,yBAAA,OAAA,IAAQ;AACRA,yBAAA,QAAA,IAAS;AACTA,yBAAA,OAAA,IAAQ;AAHE,SAAAA;AAAA,GAAA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jD;AAGF;AAzLa,kBAwLK,SAAS,UAAU,YAAY;AAtL/C,gBAAA;AAAA,EADC,SAAS,EAAC,MAAM,MAAA,CAAM;AAAA,GADZ,kBAEX,WAAA,QAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAJb,kBAKX,WAAA,UAAA,CAAA;AAGQ,gBAAA;AAAA,EADP,MAAM,kBAAkB;AAAA,GAPd,kBAQH,WAAA,SAAA,CAAA;AAGA,gBAAA;AAAA,EADP,MAAA;AAAM,GAVI,kBAWH,WAAA,KAAA,CAAA;AAGA,gBAAA;AAAA,EADP,MAAA;AAAM,GAbI,kBAcH,WAAA,aAAA,CAAA;AAdG,oBAAN,gBAAA;AAAA,EADN,cAAc,qBAAqB;AAAA,GACvB,iBAAA;"}
1
+ {"version":3,"file":"indicator-graph.js","sources":["../../../src/navigation-instruments/indicator-graph/indicator-graph.ts"],"sourcesContent":["import {LitElement, PropertyValues, html, unsafeCSS} from 'lit';\nimport {property, query, state} from 'lit/decorators.js';\nimport compentStyle from './indicator-graph.css?inline';\nimport uPlot from 'uplot';\nimport {customElement} from '../../decorator.js';\n\nexport enum ObcIndicatorGraphSize {\n small = 'small',\n medium = 'medium',\n large = 'large',\n}\n\nexport enum ObcIndicatorGraphPriority {\n regular = 'regular',\n enhanced = 'enhanced',\n}\n\n// showZeroLine is defaulted to true\nexport interface ObcIndicatorGraphLayout {\n size?: ObcIndicatorGraphSize;\n priority?: ObcIndicatorGraphPriority;\n y?: {min?: number; max?: number; showZeroLine?: boolean};\n}\n\n/**\n * @element obc-indicator-graph\n * @description A mini graph component\n *\n * @property {Array} data - The data to display in the graph, first array is the x values, second array is the y values\n */\n@customElement('obc-indicator-graph')\nexport class ObcIndicatorGraph extends LitElement {\n @property({type: Array})\n data: [number[], number[]] = [[], []];\n\n @property({type: Object})\n layout: ObcIndicatorGraphLayout = {};\n\n @query('.chart-container')\n private chart!: HTMLDivElement;\n\n @state()\n private y: number | undefined = undefined;\n\n @state()\n private zeroLineY: number | undefined = undefined;\n\n private uplot: uPlot | null = null;\n private resizeObserver: ResizeObserver | null = null;\n\n private getCssColor(name: string) {\n const color = getComputedStyle(this).getPropertyValue(name).trim();\n return color;\n }\n\n override firstUpdated() {\n const opts = {\n width: this.chart.clientWidth,\n height: this.chart.clientHeight,\n scales: {\n x: {time: false, show: false},\n y: {\n auto: true,\n show: false,\n range: this._range.bind(this),\n },\n },\n series: [\n {},\n {\n stroke: this._getStrokeColor(),\n width: this._getStrokeWidth(),\n points: {show: false},\n },\n ],\n axes: [\n {show: false},\n {ticks: {show: false}, show: false, grid: {show: false}},\n ],\n legend: {show: false},\n cursor: {show: false},\n };\n\n this.uplot = new uPlot(opts, this.data, this.chart);\n requestAnimationFrame(() => this.updateY());\n\n this.resizeObserver = new ResizeObserver(() => this.updateSize());\n this.resizeObserver.observe(this.chart);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n this.uplot?.destroy();\n this.uplot = null;\n }\n\n private updateSize() {\n if (!this.uplot) {\n return;\n }\n this.uplot.setSize({\n width: this.chart.clientWidth,\n height: this.chart.clientHeight,\n });\n this.updateY();\n }\n\n private _range(\n _self: uPlot,\n initMin: number,\n initMax: number,\n _scaleKey: string\n ): [number, number] {\n const {min: minY, max: maxY} = this.layout.y ?? {};\n const range = maxY ?? initMax - (minY ?? initMin);\n let min = minY ?? initMin - range * 0.1;\n if (minY === undefined && this.layout.y?.showZeroLine !== false) {\n min = Math.min(0, min);\n }\n return [min, maxY ?? initMax + range * 0.1] as [number, number];\n }\n\n private get _effectiveSize() {\n return this.layout.size ?? ObcIndicatorGraphSize.medium;\n }\n\n private get _effectivePriority() {\n return this.layout.priority ?? ObcIndicatorGraphPriority.regular;\n }\n\n private _getStrokeWidth() {\n switch (this._effectiveSize) {\n case ObcIndicatorGraphSize.small:\n return 1;\n case ObcIndicatorGraphSize.medium:\n return 1.5;\n case ObcIndicatorGraphSize.large:\n return 2;\n }\n }\n\n private _getStrokeColor() {\n switch (this._effectivePriority) {\n case ObcIndicatorGraphPriority.regular:\n return this.getCssColor('--element-neutral-color');\n case ObcIndicatorGraphPriority.enhanced:\n return this.getCssColor('--element-neutral-enhanced-color');\n }\n }\n\n updatePalette() {\n if (!this.uplot) {\n return;\n }\n const stroke = this._getStrokeColor();\n this.uplot.setSeries(1, {\n // @ts-expect-error - stroke is not a property of the Series interface\n stroke: stroke,\n width: this._getStrokeWidth(),\n points: {show: false},\n });\n }\n\n private updateY() {\n if (!this.uplot) {\n return;\n }\n const lastY = this.data[1][this.data[1].length - 1];\n // @ts-expect-error - valToPct is not a property of the Scale interface\n const yRatio = this.uplot.scales.y.valToPct(lastY);\n if (yRatio < 0 || yRatio > 1) {\n this.y = undefined;\n } else {\n this.y = yRatio * this.chart.clientHeight;\n }\n this.updateZeroLine();\n }\n\n private updateZeroLine() {\n if (!this.uplot) {\n return;\n }\n // @ts-expect-error - valToPct is not a property of the Scale interface\n const yRatio = this.uplot.scales.y.valToPct(0);\n if (yRatio < 0 || yRatio > 1) {\n this.zeroLineY = undefined;\n return;\n }\n this.zeroLineY = yRatio * this.chart.clientHeight;\n }\n\n override updated(changedProperties: PropertyValues) {\n if (changedProperties.has('data') || changedProperties.has('layout')) {\n this.updatePalette();\n this.uplot?.setData(this.data);\n requestAnimationFrame(() => this.updateY());\n }\n }\n\n override render() {\n return html`\n <div\n class=\"chart-container ${this._effectivePriority} ${this\n ._effectiveSize}\"\n >\n <div\n id=\"zero-line\"\n style=\"transform: translateY(${-(this.zeroLineY ?? 0)}px);\n display: ${this.zeroLineY !== undefined ? 'block' : 'none'};\n \"\n ></div>\n <div\n id=\"dot\"\n style=\"transform: translateY(${-(this.y ?? 0)}px);\n display: ${this.y !== undefined ? 'block' : 'none'};\n \"\n ></div>\n </div>\n `;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-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WAAK,cAAA;AACL,WAAK,OAAO,QAAQ,KAAK,IAAI;AAC7B,4BAAsB,MAAM,KAAK,SAAS;AAAA,IAC5C;AAAA,EACF;AAAA,EAES,SAAS;AAChB,WAAO;AAAA;AAAA,iCAEsB,KAAK,kBAAkB,IAAI,KACjD,cAAc;AAAA;AAAA;AAAA;AAAA,yCAIgB,EAAE,KAAK,aAAa,EAAE;AAAA,qBAC1C,KAAK,cAAc,SAAY,UAAU,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,yCAK3B,EAAE,KAAK,KAAK,EAAE;AAAA,qBAClC,KAAK,MAAM,SAAY,UAAU,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,EAK1D;AAGF;AAjMa,kBAgMK,SAAS,UAAU,YAAY;AA9L/C,gBAAA;AAAA,EADC,SAAS,EAAC,MAAM,MAAA,CAAM;AAAA,GADZ,kBAEX,WAAA,QAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAJb,kBAKX,WAAA,UAAA,CAAA;AAGQ,gBAAA;AAAA,EADP,MAAM,kBAAkB;AAAA,GAPd,kBAQH,WAAA,SAAA,CAAA;AAGA,gBAAA;AAAA,EADP,MAAA;AAAM,GAVI,kBAWH,WAAA,KAAA,CAAA;AAGA,gBAAA;AAAA,EADP,MAAA;AAAM,GAbI,kBAcH,WAAA,aAAA,CAAA;AAdG,oBAAN,gBAAA;AAAA,EADN,cAAc,qBAAqB;AAAA,GACvB,iBAAA;"}
package/eslint.config.mjs CHANGED
@@ -301,16 +301,11 @@ const openbridgePlugin = {
301
301
  p.key.type === 'Identifier' &&
302
302
  p.key.name === 'attribute'
303
303
  );
304
- const isBuildingBlock =
305
- typeof context.filename === 'string' &&
306
- context.filename.includes('building-blocks');
307
304
  if (property?.value?.value === false) {
308
305
  return;
309
306
  }
310
- let message = 'Prefer boolean property default values of false';
311
- if (isBuildingBlock) {
312
- message += ' or set Attribute: false on the property decorator';
313
- }
307
+ let message =
308
+ 'Prefer boolean property default values of false or set attribute: false on the property decorator';
314
309
  context.report({
315
310
  node,
316
311
  message,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oicl/openbridge-webcomponents-full-bundle",
3
- "version": "2.0.0-next.69",
3
+ "version": "2.0.0-next.71",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",