@oicl/openbridge-webcomponents 2.0.0-next.110 → 2.0.0-next.112
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.
- package/bundle/openbridge-webcomponents.bundle.js +2370 -1522
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +641 -7
- package/dist/automation/indicator-battery/indicator-battery.css.js +52 -0
- package/dist/automation/indicator-battery/indicator-battery.css.js.map +1 -0
- package/dist/automation/indicator-battery/indicator-battery.d.ts +65 -0
- package/dist/automation/indicator-battery/indicator-battery.d.ts.map +1 -0
- package/dist/automation/indicator-battery/indicator-battery.js +119 -0
- package/dist/automation/indicator-battery/indicator-battery.js.map +1 -0
- package/dist/automation/indicator-engine/indicator-engine.css.js +45 -0
- package/dist/automation/indicator-engine/indicator-engine.css.js.map +1 -0
- package/dist/automation/indicator-engine/indicator-engine.d.ts +34 -0
- package/dist/automation/indicator-engine/indicator-engine.d.ts.map +1 -0
- package/dist/automation/indicator-engine/indicator-engine.js +73 -0
- package/dist/automation/indicator-engine/indicator-engine.js.map +1 -0
- package/dist/automation/indicator-generator/indicator-generator-geometry.d.ts +30 -0
- package/dist/automation/indicator-generator/indicator-generator-geometry.d.ts.map +1 -0
- package/dist/automation/indicator-generator/indicator-generator-geometry.js +61 -0
- package/dist/automation/indicator-generator/indicator-generator-geometry.js.map +1 -0
- package/dist/automation/indicator-generator/indicator-generator.css.js +121 -0
- package/dist/automation/indicator-generator/indicator-generator.css.js.map +1 -0
- package/dist/automation/indicator-generator/indicator-generator.d.ts +57 -0
- package/dist/automation/indicator-generator/indicator-generator.d.ts.map +1 -0
- package/dist/automation/indicator-generator/indicator-generator.js +136 -0
- package/dist/automation/indicator-generator/indicator-generator.js.map +1 -0
- package/dist/automation/indicator-shared/linear-indicator.d.ts +46 -0
- package/dist/automation/indicator-shared/linear-indicator.d.ts.map +1 -0
- package/dist/automation/indicator-shared/linear-indicator.js +175 -0
- package/dist/automation/indicator-shared/linear-indicator.js.map +1 -0
- package/dist/automation/indicator-tank-atmospheric/indicator-tank-atmospheric.css.js +48 -0
- package/dist/automation/indicator-tank-atmospheric/indicator-tank-atmospheric.css.js.map +1 -0
- package/dist/automation/indicator-tank-atmospheric/indicator-tank-atmospheric.d.ts +65 -0
- package/dist/automation/indicator-tank-atmospheric/indicator-tank-atmospheric.d.ts.map +1 -0
- package/dist/automation/indicator-tank-atmospheric/indicator-tank-atmospheric.js +105 -0
- package/dist/automation/indicator-tank-atmospheric/indicator-tank-atmospheric.js.map +1 -0
- package/dist/navigation-instruments/compass/compass.d.ts +1 -1
- package/dist/navigation-instruments/compass/compass.d.ts.map +1 -1
- package/dist/navigation-instruments/compass/compass.js +1 -1
- package/dist/navigation-instruments/compass/compass.js.map +1 -1
- package/dist/navigation-instruments/current/current.d.ts +25 -0
- package/dist/navigation-instruments/current/current.d.ts.map +1 -1
- package/dist/navigation-instruments/current/current.js +25 -4
- package/dist/navigation-instruments/current/current.js.map +1 -1
- package/dist/navigation-instruments/heading/heading.js +1 -1
- package/dist/navigation-instruments/heading/heading.js.map +1 -1
- package/dist/navigation-instruments/pitch-roll-heave/pitch-roll-heave.d.ts +6 -0
- package/dist/navigation-instruments/pitch-roll-heave/pitch-roll-heave.d.ts.map +1 -1
- package/dist/navigation-instruments/pitch-roll-heave/pitch-roll-heave.js +8 -1
- package/dist/navigation-instruments/pitch-roll-heave/pitch-roll-heave.js.map +1 -1
- package/dist/navigation-instruments/rate-of-turn/rate-of-turn.d.ts +5 -2
- package/dist/navigation-instruments/rate-of-turn/rate-of-turn.d.ts.map +1 -1
- package/dist/navigation-instruments/rate-of-turn/rate-of-turn.js.map +1 -1
- package/dist/navigation-instruments/top-view-propulsion/top-view-propulsion.d.ts +6 -0
- package/dist/navigation-instruments/top-view-propulsion/top-view-propulsion.d.ts.map +1 -1
- package/dist/navigation-instruments/top-view-propulsion/top-view-propulsion.js +19 -4
- package/dist/navigation-instruments/top-view-propulsion/top-view-propulsion.js.map +1 -1
- package/dist/navigation-instruments/watch/environment.d.ts +8 -0
- package/dist/navigation-instruments/watch/environment.d.ts.map +1 -1
- package/dist/navigation-instruments/watch/environment.js +3 -0
- package/dist/navigation-instruments/watch/environment.js.map +1 -1
- package/dist/navigation-instruments/watch/force-pattern.d.ts +20 -2
- package/dist/navigation-instruments/watch/force-pattern.d.ts.map +1 -1
- package/dist/navigation-instruments/watch/force-pattern.js +12 -5
- package/dist/navigation-instruments/watch/force-pattern.js.map +1 -1
- package/dist/navigation-instruments/watch/watch.d.ts.map +1 -1
- package/dist/navigation-instruments/watch/watch.js +6 -4
- package/dist/navigation-instruments/watch/watch.js.map +1 -1
- package/dist/navigation-instruments/wind/wind.d.ts +5 -2
- package/dist/navigation-instruments/wind/wind.d.ts.map +1 -1
- package/dist/navigation-instruments/wind/wind.js +5 -1
- package/dist/navigation-instruments/wind/wind.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare enum IndicatorGeneratorVariant {
|
|
3
|
+
button = "button",
|
|
4
|
+
bar = "bar",
|
|
5
|
+
doubleBar = "double-bar"
|
|
6
|
+
}
|
|
7
|
+
export declare enum IndicatorGeneratorValue {
|
|
8
|
+
off = "off",
|
|
9
|
+
regular = "regular",
|
|
10
|
+
filled = "filled",
|
|
11
|
+
enhanced = "enhanced",
|
|
12
|
+
categorical = "categorical"
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Compact generator status indicator (48×48; 56×56 as double-bar).
|
|
16
|
+
*
|
|
17
|
+
* ## Features / Variants
|
|
18
|
+
* - `variant`: `button` (plain disc), `bar` (disc with a circular progress
|
|
19
|
+
* ring) or `double-bar` (disc with two concentric progress rings)
|
|
20
|
+
* - `value`: visual scheme — `off`, `regular`, `filled`, `enhanced` or
|
|
21
|
+
* `categorical`; `off` hides the progress rings
|
|
22
|
+
* - `level`: 0–100 (%), sweep of the (outer) progress ring, clockwise from
|
|
23
|
+
* 12 o'clock
|
|
24
|
+
* - `secondaryLevel`: 0–100 (%), sweep of the inner ring (double-bar only)
|
|
25
|
+
*
|
|
26
|
+
* ## Usage Guidelines
|
|
27
|
+
* Use as an at-a-glance generator load indicator in dashboards and lists.
|
|
28
|
+
* For schematic (P&ID) placement with button behavior, use the electric
|
|
29
|
+
* generator automation devices instead.
|
|
30
|
+
*
|
|
31
|
+
* ## Slots
|
|
32
|
+
* | Slot | Condition | Purpose |
|
|
33
|
+
* | ------ | --------- | ------------------------------------------------ |
|
|
34
|
+
* | `icon` | always | Center icon, defaults to the generator G~ glyph |
|
|
35
|
+
*
|
|
36
|
+
* @slot icon - Center icon, defaults to the generator G~ glyph
|
|
37
|
+
*/
|
|
38
|
+
export declare class ObcIndicatorGenerator extends LitElement {
|
|
39
|
+
variant: IndicatorGeneratorVariant;
|
|
40
|
+
value: IndicatorGeneratorValue;
|
|
41
|
+
/** Outer progress ring sweep, 0-100 (%) */
|
|
42
|
+
level: number;
|
|
43
|
+
/** Inner progress ring sweep, 0-100 (%), double-bar only */
|
|
44
|
+
secondaryLevel: number;
|
|
45
|
+
private get center();
|
|
46
|
+
private get discRadius();
|
|
47
|
+
private get showOutline();
|
|
48
|
+
private renderRing;
|
|
49
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
50
|
+
static styles: import('lit').CSSResult;
|
|
51
|
+
}
|
|
52
|
+
declare global {
|
|
53
|
+
interface HTMLElementTagNameMap {
|
|
54
|
+
'obc-indicator-generator': ObcIndicatorGenerator;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=indicator-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indicator-generator.d.ts","sourceRoot":"","sources":["../../../src/automation/indicator-generator/indicator-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAgC,MAAM,KAAK,CAAC;AAuB9D,oBAAY,yBAAyB;IACnC,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,SAAS,eAAe;CACzB;AAED,oBAAY,uBAAuB;IACjC,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;CAC5B;AAQD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBACa,qBAAsB,SAAQ,UAAU;IACV,OAAO,EAAE,yBAAyB,CACxC;IACM,KAAK,EAAE,uBAAuB,CACzC;IAC9B,2CAA2C;IACjB,KAAK,SAAK;IACpC,4DAA4D;IAClC,cAAc,SAAK;IAE7C,OAAO,KAAK,MAAM,GAEjB;IAED,OAAO,KAAK,UAAU,GAYrB;IAED,OAAO,KAAK,WAAW,GAYtB;IAED,OAAO,CAAC,UAAU;IAeT,MAAM;IAmDf,OAAgB,MAAM,0BAA6B;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,yBAAyB,EAAE,qBAAqB,CAAC;KAClD;CACF"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { unsafeCSS, LitElement, nothing, svg, html } from "lit";
|
|
2
|
+
import { property } from "lit/decorators.js";
|
|
3
|
+
import componentStyle from "./indicator-generator.css.js";
|
|
4
|
+
import { customElement } from "../../decorator.js";
|
|
5
|
+
import { FILLED_DISC_RADIUS, DISC_RADIUS, arcPath, BUTTON_SILHOUETTE_RADIUS, BAR_SILHOUETTE_RADIUS, BAR_SILHOUETTE_STROKE_WIDTH, DOUBLE_BAR_OUTLINE_RADIUS, BAR_OUTLINE_RADIUS, OUTLINE_STROKE_WIDTH, BAR_TRACK_RADIUS, BAR_TRACK_STROKE_WIDTH, DOUBLE_BAR_OUTER_RADIUS, DOUBLE_BAR_OUTER_STROKE_WIDTH, DOUBLE_BAR_INNER_RADIUS, DOUBLE_BAR_INNER_STROKE_WIDTH, progressSweep } from "./indicator-generator-geometry.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 IndicatorGeneratorVariant = /* @__PURE__ */ ((IndicatorGeneratorVariant2) => {
|
|
17
|
+
IndicatorGeneratorVariant2["button"] = "button";
|
|
18
|
+
IndicatorGeneratorVariant2["bar"] = "bar";
|
|
19
|
+
IndicatorGeneratorVariant2["doubleBar"] = "double-bar";
|
|
20
|
+
return IndicatorGeneratorVariant2;
|
|
21
|
+
})(IndicatorGeneratorVariant || {});
|
|
22
|
+
var IndicatorGeneratorValue = /* @__PURE__ */ ((IndicatorGeneratorValue2) => {
|
|
23
|
+
IndicatorGeneratorValue2["off"] = "off";
|
|
24
|
+
IndicatorGeneratorValue2["regular"] = "regular";
|
|
25
|
+
IndicatorGeneratorValue2["filled"] = "filled";
|
|
26
|
+
IndicatorGeneratorValue2["enhanced"] = "enhanced";
|
|
27
|
+
IndicatorGeneratorValue2["categorical"] = "categorical";
|
|
28
|
+
return IndicatorGeneratorValue2;
|
|
29
|
+
})(IndicatorGeneratorValue || {});
|
|
30
|
+
const ICON_G_PATH = "M6.1686 5.216H10.6326V11.088C10.0353 11.2907 9.41127 11.4507 8.7606 11.568C8.1206 11.6853 7.38993 11.744 6.5686 11.744C5.43793 11.744 4.4726 11.52 3.6726 11.072C2.88327 10.6133 2.2806 9.94667 1.8646 9.072C1.4486 8.19733 1.2406 7.12533 1.2406 5.856C1.2406 4.66133 1.46993 3.62667 1.9286 2.752C2.39793 1.87733 3.07527 1.2 3.9606 0.72C4.84593 0.24 5.9286 0 7.2086 0C7.8166 0 8.41393 0.0640001 9.0006 0.192C9.58727 0.32 10.1206 0.490667 10.6006 0.704L9.8326 2.56C9.46993 2.37867 9.05927 2.22933 8.6006 2.112C8.1526 1.99467 7.68327 1.936 7.1926 1.936C6.4566 1.936 5.82193 2.10133 5.2886 2.432C4.76593 2.752 4.35527 3.21067 4.0566 3.808C3.7686 4.39467 3.6246 5.09333 3.6246 5.904C3.6246 6.66133 3.73127 7.33867 3.9446 7.936C4.15793 8.52267 4.49393 8.98133 4.9526 9.312C5.41127 9.64267 6.01393 9.808 6.7606 9.808C7.00593 9.808 7.21927 9.80267 7.4006 9.792C7.5926 9.77067 7.76327 9.74933 7.9126 9.728C8.0726 9.696 8.22727 9.66933 8.3766 9.648V7.152H6.1686V5.216Z";
|
|
31
|
+
const ICON_TILDE_PATH = "M4.20117 14.0059C5.30264 14.0679 6.22793 14.5801 7.02344 15.2207C7.64824 15.7239 8.18172 15.9676 8.7041 15.9971C9.21748 16.026 9.88939 15.8574 10.8096 15.1904L11.6191 14.6035L12.793 16.2227L11.9834 16.8096C10.8203 17.6526 9.7024 18.0567 8.5918 17.9941C7.49033 17.9321 6.56504 17.4199 5.76953 16.7793C5.14473 16.2761 4.61125 16.0324 4.08887 16.0029C3.57549 15.974 2.90358 16.1426 1.9834 16.8096L1.17383 17.3965L0 15.7773L0.80957 15.1904C1.97263 14.3473 3.09057 13.9433 4.20117 14.0059Z";
|
|
32
|
+
let ObcIndicatorGenerator = class extends LitElement {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
this.variant = "button";
|
|
36
|
+
this.value = "off";
|
|
37
|
+
this.level = 0;
|
|
38
|
+
this.secondaryLevel = 0;
|
|
39
|
+
}
|
|
40
|
+
get center() {
|
|
41
|
+
return this.variant === "double-bar" ? 28 : 24;
|
|
42
|
+
}
|
|
43
|
+
get discRadius() {
|
|
44
|
+
if (this.value === "filled") {
|
|
45
|
+
return FILLED_DISC_RADIUS;
|
|
46
|
+
}
|
|
47
|
+
if (this.variant === "button" || this.value === "off" || this.value === "regular") {
|
|
48
|
+
return DISC_RADIUS;
|
|
49
|
+
}
|
|
50
|
+
return FILLED_DISC_RADIUS;
|
|
51
|
+
}
|
|
52
|
+
get showOutline() {
|
|
53
|
+
if (this.variant === "bar") {
|
|
54
|
+
return [
|
|
55
|
+
"filled",
|
|
56
|
+
"enhanced",
|
|
57
|
+
"categorical"
|
|
58
|
+
/* categorical */
|
|
59
|
+
].includes(this.value);
|
|
60
|
+
}
|
|
61
|
+
if (this.variant === "double-bar") {
|
|
62
|
+
return this.value !== "off";
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
renderRing(radius, strokeWidth, level) {
|
|
67
|
+
const c = this.center;
|
|
68
|
+
const sweep = progressSweep(level);
|
|
69
|
+
return svg`
|
|
70
|
+
<circle class="ring-track" cx=${c} cy=${c} r=${radius} stroke-width=${strokeWidth} />
|
|
71
|
+
${sweep >= 360 ? svg`<circle class="ring-progress" cx=${c} cy=${c} r=${radius} stroke-width=${strokeWidth} />` : sweep > 0 ? svg`<path class="ring-progress" d=${arcPath(c, c, radius, 0, sweep)} stroke-width=${strokeWidth} />` : nothing}
|
|
72
|
+
`;
|
|
73
|
+
}
|
|
74
|
+
render() {
|
|
75
|
+
const c = this.center;
|
|
76
|
+
const doubleBar = this.variant === "double-bar";
|
|
77
|
+
const bar = this.variant === "bar";
|
|
78
|
+
const showRings = this.value !== "off";
|
|
79
|
+
const size = doubleBar ? 56 : 48;
|
|
80
|
+
return html`
|
|
81
|
+
<svg viewBox="0 0 ${size} ${size}" aria-hidden="true">
|
|
82
|
+
${this.variant === "button" ? svg`<circle class="silhouette" cx=${c} cy=${c} r=${BUTTON_SILHOUETTE_RADIUS} />` : nothing}
|
|
83
|
+
${bar ? svg`<circle class="silhouette-ring" cx=${c} cy=${c} r=${BAR_SILHOUETTE_RADIUS} stroke-width=${BAR_SILHOUETTE_STROKE_WIDTH} />` : nothing}
|
|
84
|
+
<circle class="disc" cx=${c} cy=${c} r=${this.discRadius} />
|
|
85
|
+
${this.showOutline ? svg`<circle
|
|
86
|
+
class="outline"
|
|
87
|
+
cx=${c}
|
|
88
|
+
cy=${c}
|
|
89
|
+
r=${doubleBar ? DOUBLE_BAR_OUTLINE_RADIUS : BAR_OUTLINE_RADIUS}
|
|
90
|
+
stroke-width=${OUTLINE_STROKE_WIDTH}
|
|
91
|
+
/>` : nothing}
|
|
92
|
+
${bar && showRings ? this.renderRing(
|
|
93
|
+
BAR_TRACK_RADIUS,
|
|
94
|
+
BAR_TRACK_STROKE_WIDTH,
|
|
95
|
+
this.level
|
|
96
|
+
) : nothing}
|
|
97
|
+
${doubleBar && showRings ? svg`
|
|
98
|
+
${this.renderRing(DOUBLE_BAR_OUTER_RADIUS, DOUBLE_BAR_OUTER_STROKE_WIDTH, this.level)}
|
|
99
|
+
${this.renderRing(DOUBLE_BAR_INNER_RADIUS, DOUBLE_BAR_INNER_STROKE_WIDTH, this.secondaryLevel)}
|
|
100
|
+
` : nothing}
|
|
101
|
+
</svg>
|
|
102
|
+
<div class="icon-wrapper">
|
|
103
|
+
<slot name="icon">
|
|
104
|
+
<svg class="default-icon" viewBox="0 0 24 24">
|
|
105
|
+
<g transform="translate(5.604 3)">
|
|
106
|
+
<path d=${ICON_G_PATH} />
|
|
107
|
+
<path d=${ICON_TILDE_PATH} />
|
|
108
|
+
</g>
|
|
109
|
+
</svg>
|
|
110
|
+
</slot>
|
|
111
|
+
</div>
|
|
112
|
+
`;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
ObcIndicatorGenerator.styles = unsafeCSS(componentStyle);
|
|
116
|
+
__decorateClass([
|
|
117
|
+
property({ type: String, reflect: true })
|
|
118
|
+
], ObcIndicatorGenerator.prototype, "variant", 2);
|
|
119
|
+
__decorateClass([
|
|
120
|
+
property({ type: String, reflect: true })
|
|
121
|
+
], ObcIndicatorGenerator.prototype, "value", 2);
|
|
122
|
+
__decorateClass([
|
|
123
|
+
property({ type: Number })
|
|
124
|
+
], ObcIndicatorGenerator.prototype, "level", 2);
|
|
125
|
+
__decorateClass([
|
|
126
|
+
property({ type: Number })
|
|
127
|
+
], ObcIndicatorGenerator.prototype, "secondaryLevel", 2);
|
|
128
|
+
ObcIndicatorGenerator = __decorateClass([
|
|
129
|
+
customElement("obc-indicator-generator")
|
|
130
|
+
], ObcIndicatorGenerator);
|
|
131
|
+
export {
|
|
132
|
+
IndicatorGeneratorValue,
|
|
133
|
+
IndicatorGeneratorVariant,
|
|
134
|
+
ObcIndicatorGenerator
|
|
135
|
+
};
|
|
136
|
+
//# sourceMappingURL=indicator-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indicator-generator.js","sources":["../../../src/automation/indicator-generator/indicator-generator.ts"],"sourcesContent":["import {LitElement, html, svg, unsafeCSS, nothing} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport componentStyle from './indicator-generator.css?inline';\nimport {customElement} from '../../decorator.js';\nimport {\n BUTTON_SILHOUETTE_RADIUS,\n DISC_RADIUS,\n FILLED_DISC_RADIUS,\n BAR_SILHOUETTE_RADIUS,\n BAR_SILHOUETTE_STROKE_WIDTH,\n BAR_OUTLINE_RADIUS,\n DOUBLE_BAR_OUTLINE_RADIUS,\n OUTLINE_STROKE_WIDTH,\n BAR_TRACK_RADIUS,\n BAR_TRACK_STROKE_WIDTH,\n DOUBLE_BAR_OUTER_RADIUS,\n DOUBLE_BAR_OUTER_STROKE_WIDTH,\n DOUBLE_BAR_INNER_RADIUS,\n DOUBLE_BAR_INNER_STROKE_WIDTH,\n arcPath,\n progressSweep,\n} from './indicator-generator-geometry.js';\n\nexport enum IndicatorGeneratorVariant {\n button = 'button',\n bar = 'bar',\n doubleBar = 'double-bar',\n}\n\nexport enum IndicatorGeneratorValue {\n off = 'off',\n regular = 'regular',\n filled = 'filled',\n enhanced = 'enhanced',\n categorical = 'categorical',\n}\n\nconst ICON_G_PATH =\n 'M6.1686 5.216H10.6326V11.088C10.0353 11.2907 9.41127 11.4507 8.7606 11.568C8.1206 11.6853 7.38993 11.744 6.5686 11.744C5.43793 11.744 4.4726 11.52 3.6726 11.072C2.88327 10.6133 2.2806 9.94667 1.8646 9.072C1.4486 8.19733 1.2406 7.12533 1.2406 5.856C1.2406 4.66133 1.46993 3.62667 1.9286 2.752C2.39793 1.87733 3.07527 1.2 3.9606 0.72C4.84593 0.24 5.9286 0 7.2086 0C7.8166 0 8.41393 0.0640001 9.0006 0.192C9.58727 0.32 10.1206 0.490667 10.6006 0.704L9.8326 2.56C9.46993 2.37867 9.05927 2.22933 8.6006 2.112C8.1526 1.99467 7.68327 1.936 7.1926 1.936C6.4566 1.936 5.82193 2.10133 5.2886 2.432C4.76593 2.752 4.35527 3.21067 4.0566 3.808C3.7686 4.39467 3.6246 5.09333 3.6246 5.904C3.6246 6.66133 3.73127 7.33867 3.9446 7.936C4.15793 8.52267 4.49393 8.98133 4.9526 9.312C5.41127 9.64267 6.01393 9.808 6.7606 9.808C7.00593 9.808 7.21927 9.80267 7.4006 9.792C7.5926 9.77067 7.76327 9.74933 7.9126 9.728C8.0726 9.696 8.22727 9.66933 8.3766 9.648V7.152H6.1686V5.216Z';\n\nconst ICON_TILDE_PATH =\n 'M4.20117 14.0059C5.30264 14.0679 6.22793 14.5801 7.02344 15.2207C7.64824 15.7239 8.18172 15.9676 8.7041 15.9971C9.21748 16.026 9.88939 15.8574 10.8096 15.1904L11.6191 14.6035L12.793 16.2227L11.9834 16.8096C10.8203 17.6526 9.7024 18.0567 8.5918 17.9941C7.49033 17.9321 6.56504 17.4199 5.76953 16.7793C5.14473 16.2761 4.61125 16.0324 4.08887 16.0029C3.57549 15.974 2.90358 16.1426 1.9834 16.8096L1.17383 17.3965L0 15.7773L0.80957 15.1904C1.97263 14.3473 3.09057 13.9433 4.20117 14.0059Z';\n\n/**\n * Compact generator status indicator (48×48; 56×56 as double-bar).\n *\n * ## Features / Variants\n * - `variant`: `button` (plain disc), `bar` (disc with a circular progress\n * ring) or `double-bar` (disc with two concentric progress rings)\n * - `value`: visual scheme — `off`, `regular`, `filled`, `enhanced` or\n * `categorical`; `off` hides the progress rings\n * - `level`: 0–100 (%), sweep of the (outer) progress ring, clockwise from\n * 12 o'clock\n * - `secondaryLevel`: 0–100 (%), sweep of the inner ring (double-bar only)\n *\n * ## Usage Guidelines\n * Use as an at-a-glance generator load indicator in dashboards and lists.\n * For schematic (P&ID) placement with button behavior, use the electric\n * generator automation devices instead.\n *\n * ## Slots\n * | Slot | Condition | Purpose |\n * | ------ | --------- | ------------------------------------------------ |\n * | `icon` | always | Center icon, defaults to the generator G~ glyph |\n *\n * @slot icon - Center icon, defaults to the generator G~ glyph\n */\n@customElement('obc-indicator-generator')\nexport class ObcIndicatorGenerator extends LitElement {\n @property({type: String, reflect: true}) variant: IndicatorGeneratorVariant =\n IndicatorGeneratorVariant.button;\n @property({type: String, reflect: true}) value: IndicatorGeneratorValue =\n IndicatorGeneratorValue.off;\n /** Outer progress ring sweep, 0-100 (%) */\n @property({type: Number}) level = 0;\n /** Inner progress ring sweep, 0-100 (%), double-bar only */\n @property({type: Number}) secondaryLevel = 0;\n\n private get center(): number {\n return this.variant === IndicatorGeneratorVariant.doubleBar ? 28 : 24;\n }\n\n private get discRadius(): number {\n if (this.value === IndicatorGeneratorValue.filled) {\n return FILLED_DISC_RADIUS;\n }\n if (\n this.variant === IndicatorGeneratorVariant.button ||\n this.value === IndicatorGeneratorValue.off ||\n this.value === IndicatorGeneratorValue.regular\n ) {\n return DISC_RADIUS;\n }\n return FILLED_DISC_RADIUS;\n }\n\n private get showOutline(): boolean {\n if (this.variant === IndicatorGeneratorVariant.bar) {\n return [\n IndicatorGeneratorValue.filled,\n IndicatorGeneratorValue.enhanced,\n IndicatorGeneratorValue.categorical,\n ].includes(this.value);\n }\n if (this.variant === IndicatorGeneratorVariant.doubleBar) {\n return this.value !== IndicatorGeneratorValue.off;\n }\n return false;\n }\n\n private renderRing(radius: number, strokeWidth: number, level: number) {\n const c = this.center;\n const sweep = progressSweep(level);\n return svg`\n <circle class=\"ring-track\" cx=${c} cy=${c} r=${radius} stroke-width=${strokeWidth} />\n ${\n sweep >= 360\n ? svg`<circle class=\"ring-progress\" cx=${c} cy=${c} r=${radius} stroke-width=${strokeWidth} />`\n : sweep > 0\n ? svg`<path class=\"ring-progress\" d=${arcPath(c, c, radius, 0, sweep)} stroke-width=${strokeWidth} />`\n : nothing\n }\n `;\n }\n\n override render() {\n const c = this.center;\n const doubleBar = this.variant === IndicatorGeneratorVariant.doubleBar;\n const bar = this.variant === IndicatorGeneratorVariant.bar;\n const showRings = this.value !== IndicatorGeneratorValue.off;\n const size = doubleBar ? 56 : 48;\n return html`\n <svg viewBox=\"0 0 ${size} ${size}\" aria-hidden=\"true\">\n ${this.variant === IndicatorGeneratorVariant.button\n ? svg`<circle class=\"silhouette\" cx=${c} cy=${c} r=${BUTTON_SILHOUETTE_RADIUS} />`\n : nothing}\n ${bar\n ? svg`<circle class=\"silhouette-ring\" cx=${c} cy=${c} r=${BAR_SILHOUETTE_RADIUS} stroke-width=${BAR_SILHOUETTE_STROKE_WIDTH} />`\n : nothing}\n <circle class=\"disc\" cx=${c} cy=${c} r=${this.discRadius} />\n ${this.showOutline\n ? svg`<circle\n class=\"outline\"\n cx=${c}\n cy=${c}\n r=${doubleBar ? DOUBLE_BAR_OUTLINE_RADIUS : BAR_OUTLINE_RADIUS}\n stroke-width=${OUTLINE_STROKE_WIDTH}\n />`\n : nothing}\n ${bar && showRings\n ? this.renderRing(\n BAR_TRACK_RADIUS,\n BAR_TRACK_STROKE_WIDTH,\n this.level\n )\n : nothing}\n ${doubleBar && showRings\n ? svg`\n ${this.renderRing(DOUBLE_BAR_OUTER_RADIUS, DOUBLE_BAR_OUTER_STROKE_WIDTH, this.level)}\n ${this.renderRing(DOUBLE_BAR_INNER_RADIUS, DOUBLE_BAR_INNER_STROKE_WIDTH, this.secondaryLevel)}\n `\n : nothing}\n </svg>\n <div class=\"icon-wrapper\">\n <slot name=\"icon\">\n <svg class=\"default-icon\" viewBox=\"0 0 24 24\">\n <g transform=\"translate(5.604 3)\">\n <path d=${ICON_G_PATH} />\n <path d=${ICON_TILDE_PATH} />\n </g>\n </svg>\n </slot>\n </div>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-indicator-generator': ObcIndicatorGenerator;\n }\n}\n"],"names":["IndicatorGeneratorVariant","IndicatorGeneratorValue"],"mappings":";;;;;;;;;;;;;;;AAuBO,IAAK,8CAAAA,+BAAL;AACLA,6BAAA,QAAA,IAAS;AACTA,6BAAA,KAAA,IAAM;AACNA,6BAAA,WAAA,IAAY;AAHF,SAAAA;AAAA,GAAA,6BAAA,CAAA,CAAA;AAML,IAAK,4CAAAC,6BAAL;AACLA,2BAAA,KAAA,IAAM;AACNA,2BAAA,SAAA,IAAU;AACVA,2BAAA,QAAA,IAAS;AACTA,2BAAA,UAAA,IAAW;AACXA,2BAAA,aAAA,IAAc;AALJ,SAAAA;AAAA,GAAA,2BAAA,CAAA,CAAA;AAQZ,MAAM,cACJ;AAEF,MAAM,kBACJ;AA2BK,IAAM,wBAAN,cAAoC,WAAW;AAAA,EAA/C,cAAA;AAAA,UAAA,GAAA,SAAA;AACoC,SAAA,UACvC;AACuC,SAAA,QACvC;AAEwB,SAAA,QAAQ;AAER,SAAA,iBAAiB;AAAA,EAAA;AAAA,EAE3C,IAAY,SAAiB;AAC3B,WAAO,KAAK,YAAY,eAAsC,KAAK;AAAA,EACrE;AAAA,EAEA,IAAY,aAAqB;AAC/B,QAAI,KAAK,UAAU,UAAgC;AACjD,aAAO;AAAA,IACT;AACA,QACE,KAAK,YAAY,YACjB,KAAK,UAAU,SACf,KAAK,UAAU,WACf;AACA,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT;AAAA,EAEA,IAAY,cAAuB;AACjC,QAAI,KAAK,YAAY,OAA+B;AAClD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K,WAAW,yBAAyB,+BAA+B,KAAK,KAAK,CAAC;AAAA,gBACnF,KAAK,WAAW,yBAAyB,+BAA+B,KAAK,cAAc,CAAC;AAAA,gBAEhG,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAMK,WAAW;AAAA,wBACX,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMrC;AAGF;AA7Ga,sBA4GK,SAAS,UAAU,cAAc;AA3GR,gBAAA;AAAA,EAAxC,SAAS,EAAC,MAAM,QAAQ,SAAS,MAAK;AAAA,GAD5B,sBAC8B,WAAA,WAAA,CAAA;AAEA,gBAAA;AAAA,EAAxC,SAAS,EAAC,MAAM,QAAQ,SAAS,MAAK;AAAA,GAH5B,sBAG8B,WAAA,SAAA,CAAA;AAGf,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GANb,sBAMe,WAAA,SAAA,CAAA;AAEA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GARb,sBAQe,WAAA,kBAAA,CAAA;AARf,wBAAN,gBAAA;AAAA,EADN,cAAc,yBAAyB;AAAA,GAC3B,qBAAA;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { SVGTemplateResult } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* Shared rendering core for linear automation indicators.
|
|
4
|
+
*
|
|
5
|
+
* Provides the internals used by `obc-indicator-battery` and
|
|
6
|
+
* `obc-indicator-tank-atmospheric`: a bottom-up percentage bar fill and a
|
|
7
|
+
* trend graph (history polyline with filled area plus a 4 px current-value
|
|
8
|
+
* micro-bar). The consuming component draws its own outer frame and places
|
|
9
|
+
* these templates inside its inner content rectangle.
|
|
10
|
+
*
|
|
11
|
+
* Coordinates are expressed in the component's 48×48 viewBox grid. Colors are
|
|
12
|
+
* resolved through CSS custom properties so the templates follow the active
|
|
13
|
+
* theme; the value scheme selects between the neutral, enhanced and
|
|
14
|
+
* categorical token sets.
|
|
15
|
+
*/
|
|
16
|
+
export declare enum IndicatorDirection {
|
|
17
|
+
vertical = "vertical",
|
|
18
|
+
horizontal = "horizontal"
|
|
19
|
+
}
|
|
20
|
+
export declare enum LinearIndicatorScheme {
|
|
21
|
+
regular = "regular",
|
|
22
|
+
enhanced = "enhanced",
|
|
23
|
+
categorical = "categorical"
|
|
24
|
+
}
|
|
25
|
+
export interface Rect {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
}
|
|
31
|
+
export declare function clampPercent(value: number): number;
|
|
32
|
+
export declare function fillHeight(rect: Rect, level: number): number;
|
|
33
|
+
export declare function expandRect(rect: Rect, amount: number): Rect;
|
|
34
|
+
export declare function trendPolylinePoints(rect: Rect, data: number[], graphWidth: number): string;
|
|
35
|
+
export declare function schemeFillToken(scheme: LinearIndicatorScheme): string;
|
|
36
|
+
export declare function schemeAccentToken(scheme: LinearIndicatorScheme): string;
|
|
37
|
+
export declare function schemeAreaToken(scheme: LinearIndicatorScheme): string;
|
|
38
|
+
/**
|
|
39
|
+
* Rectangle path with rounded left corners and square right corners, used
|
|
40
|
+
* to clip the trend graph so it follows the fill-container's rounded left
|
|
41
|
+
* edge while butting flat against the micro-bar gap on the right.
|
|
42
|
+
*/
|
|
43
|
+
export declare function roundedLeftRectPath(rect: Rect, width: number, radius: number): string;
|
|
44
|
+
export declare function renderLinearBar(rect: Rect, level: number, scheme: LinearIndicatorScheme, idPrefix: string): SVGTemplateResult;
|
|
45
|
+
export declare function renderTrendGraph(rect: Rect, data: number[], level: number, scheme: LinearIndicatorScheme, idPrefix: string): SVGTemplateResult;
|
|
46
|
+
//# sourceMappingURL=linear-indicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linear-indicator.d.ts","sourceRoot":"","sources":["../../../src/automation/indicator-shared/linear-indicator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,iBAAiB,EAA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,EACd,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,qBAAqB,EAC7B,QAAQ,EAAE,MAAM,GACf,iBAAiB,CA2DnB"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { svg } from "lit";
|
|
2
|
+
var IndicatorDirection = /* @__PURE__ */ ((IndicatorDirection2) => {
|
|
3
|
+
IndicatorDirection2["vertical"] = "vertical";
|
|
4
|
+
IndicatorDirection2["horizontal"] = "horizontal";
|
|
5
|
+
return IndicatorDirection2;
|
|
6
|
+
})(IndicatorDirection || {});
|
|
7
|
+
var LinearIndicatorScheme = /* @__PURE__ */ ((LinearIndicatorScheme2) => {
|
|
8
|
+
LinearIndicatorScheme2["regular"] = "regular";
|
|
9
|
+
LinearIndicatorScheme2["enhanced"] = "enhanced";
|
|
10
|
+
LinearIndicatorScheme2["categorical"] = "categorical";
|
|
11
|
+
return LinearIndicatorScheme2;
|
|
12
|
+
})(LinearIndicatorScheme || {});
|
|
13
|
+
const TREND_BAR_WIDTH = 4;
|
|
14
|
+
const TREND_BAR_GAP = 1;
|
|
15
|
+
function clampPercent(value) {
|
|
16
|
+
if (Number.isNaN(value)) return 0;
|
|
17
|
+
return Math.min(100, Math.max(0, value));
|
|
18
|
+
}
|
|
19
|
+
function fillHeight(rect, level) {
|
|
20
|
+
return rect.height * clampPercent(level) / 100;
|
|
21
|
+
}
|
|
22
|
+
function expandRect(rect, amount) {
|
|
23
|
+
return {
|
|
24
|
+
x: rect.x - amount,
|
|
25
|
+
y: rect.y - amount,
|
|
26
|
+
width: rect.width + 2 * amount,
|
|
27
|
+
height: rect.height + 2 * amount
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function round3(value) {
|
|
31
|
+
return Math.round(value * 1e3) / 1e3;
|
|
32
|
+
}
|
|
33
|
+
function trendPolylinePoints(rect, data, graphWidth) {
|
|
34
|
+
if (data.length < 2) return "";
|
|
35
|
+
return data.map((value, index) => {
|
|
36
|
+
const x = rect.x + index / (data.length - 1) * graphWidth;
|
|
37
|
+
const y = rect.y + rect.height * (1 - clampPercent(value) / 100);
|
|
38
|
+
return `${round3(x)},${round3(y)}`;
|
|
39
|
+
}).join(" ");
|
|
40
|
+
}
|
|
41
|
+
function schemeFillToken(scheme) {
|
|
42
|
+
switch (scheme) {
|
|
43
|
+
case "enhanced":
|
|
44
|
+
return "var(--element-neutral-enhanced-color)";
|
|
45
|
+
case "categorical":
|
|
46
|
+
return "var(--base-teal-400)";
|
|
47
|
+
default:
|
|
48
|
+
return "var(--element-neutral-color)";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function schemeAccentToken(scheme) {
|
|
52
|
+
switch (scheme) {
|
|
53
|
+
case "enhanced":
|
|
54
|
+
return "var(--element-neutral-enhanced-color)";
|
|
55
|
+
case "categorical":
|
|
56
|
+
return "var(--base-teal-500)";
|
|
57
|
+
default:
|
|
58
|
+
return "var(--element-neutral-color)";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function schemeAreaToken(scheme) {
|
|
62
|
+
switch (scheme) {
|
|
63
|
+
case "enhanced":
|
|
64
|
+
return "var(--instrument-enhanced-tertiary-color)";
|
|
65
|
+
case "categorical":
|
|
66
|
+
return "var(--base-teal-100)";
|
|
67
|
+
default:
|
|
68
|
+
return "var(--instrument-regular-tertiary-color)";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function roundedLeftRectPath(rect, width, radius) {
|
|
72
|
+
const x = round3(rect.x);
|
|
73
|
+
const y = round3(rect.y);
|
|
74
|
+
const right = round3(rect.x + width);
|
|
75
|
+
const bottom = round3(rect.y + rect.height);
|
|
76
|
+
const r = round3(radius);
|
|
77
|
+
return `M ${round3(rect.x + radius)} ${y} H ${right} V ${bottom} H ${round3(rect.x + radius)} A ${r} ${r} 0 0 1 ${x} ${round3(bottom - radius)} V ${round3(rect.y + radius)} A ${r} ${r} 0 0 1 ${round3(rect.x + radius)} ${y} Z`;
|
|
78
|
+
}
|
|
79
|
+
function renderLinearBar(rect, level, scheme, idPrefix) {
|
|
80
|
+
const fillRect = expandRect(rect, 0.5);
|
|
81
|
+
const height = fillHeight(fillRect, level);
|
|
82
|
+
const clipId = `${idPrefix}-bar-clip`;
|
|
83
|
+
return svg`
|
|
84
|
+
<clipPath id=${clipId}>
|
|
85
|
+
<rect x=${fillRect.x} y=${fillRect.y} width=${fillRect.width} height=${fillRect.height} rx="2.5"></rect>
|
|
86
|
+
</clipPath>
|
|
87
|
+
<rect
|
|
88
|
+
class="bar-background"
|
|
89
|
+
x=${rect.x}
|
|
90
|
+
y=${rect.y}
|
|
91
|
+
width=${rect.width}
|
|
92
|
+
height=${rect.height}
|
|
93
|
+
rx="2"
|
|
94
|
+
style="fill: var(--instrument-frame-secondary-color); stroke: var(--border-outline-color)"
|
|
95
|
+
></rect>
|
|
96
|
+
<rect
|
|
97
|
+
class="bar-fill"
|
|
98
|
+
clip-path="url(#${clipId})"
|
|
99
|
+
x=${fillRect.x}
|
|
100
|
+
y=${round3(fillRect.y + fillRect.height - height)}
|
|
101
|
+
width=${fillRect.width}
|
|
102
|
+
height=${round3(height)}
|
|
103
|
+
style="fill: ${schemeFillToken(scheme)}"
|
|
104
|
+
></rect>
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
107
|
+
function renderTrendGraph(rect, data, level, scheme, idPrefix) {
|
|
108
|
+
const graphWidth = rect.width - TREND_BAR_WIDTH - TREND_BAR_GAP;
|
|
109
|
+
const points = trendPolylinePoints(rect, data, graphWidth);
|
|
110
|
+
const bottom = round3(rect.y + rect.height);
|
|
111
|
+
const areaPath = points ? `M ${round3(rect.x)},${bottom} L ${points.split(" ").join(" L ")} L ${round3(rect.x + graphWidth)},${bottom} Z` : "";
|
|
112
|
+
const barX = rect.x + rect.width - TREND_BAR_WIDTH;
|
|
113
|
+
const height = fillHeight(rect, level);
|
|
114
|
+
const accent = schemeAccentToken(scheme);
|
|
115
|
+
const clipId = `${idPrefix}-trend-clip`;
|
|
116
|
+
const barClipId = `${idPrefix}-trend-bar-clip`;
|
|
117
|
+
return svg`
|
|
118
|
+
<clipPath id=${clipId}>
|
|
119
|
+
<path d=${roundedLeftRectPath(rect, graphWidth, 2)}></path>
|
|
120
|
+
</clipPath>
|
|
121
|
+
<clipPath id=${barClipId}>
|
|
122
|
+
<rect x=${barX} y=${rect.y} width=${TREND_BAR_WIDTH} height=${rect.height} rx="2"></rect>
|
|
123
|
+
</clipPath>
|
|
124
|
+
${areaPath ? svg`
|
|
125
|
+
<path
|
|
126
|
+
class="trend-area"
|
|
127
|
+
clip-path="url(#${clipId})"
|
|
128
|
+
d=${areaPath}
|
|
129
|
+
style="fill: ${schemeAreaToken(scheme)}"
|
|
130
|
+
></path>
|
|
131
|
+
<polyline
|
|
132
|
+
class="trend-line"
|
|
133
|
+
clip-path="url(#${clipId})"
|
|
134
|
+
points=${points}
|
|
135
|
+
fill="none"
|
|
136
|
+
style="stroke: ${accent}"
|
|
137
|
+
stroke-width="1"
|
|
138
|
+
vector-effect="non-scaling-stroke"
|
|
139
|
+
></polyline>
|
|
140
|
+
` : ""}
|
|
141
|
+
<rect
|
|
142
|
+
class="trend-track"
|
|
143
|
+
x=${barX}
|
|
144
|
+
y=${rect.y}
|
|
145
|
+
width=${TREND_BAR_WIDTH}
|
|
146
|
+
height=${rect.height}
|
|
147
|
+
rx="2"
|
|
148
|
+
style="fill: var(--border-divider-color)"
|
|
149
|
+
></rect>
|
|
150
|
+
<rect
|
|
151
|
+
class="trend-bar-fill"
|
|
152
|
+
clip-path="url(#${barClipId})"
|
|
153
|
+
x=${barX}
|
|
154
|
+
y=${round3(rect.y + rect.height - height)}
|
|
155
|
+
width=${TREND_BAR_WIDTH}
|
|
156
|
+
height=${round3(height)}
|
|
157
|
+
style="fill: ${accent}"
|
|
158
|
+
></rect>
|
|
159
|
+
`;
|
|
160
|
+
}
|
|
161
|
+
export {
|
|
162
|
+
IndicatorDirection,
|
|
163
|
+
LinearIndicatorScheme,
|
|
164
|
+
clampPercent,
|
|
165
|
+
expandRect,
|
|
166
|
+
fillHeight,
|
|
167
|
+
renderLinearBar,
|
|
168
|
+
renderTrendGraph,
|
|
169
|
+
roundedLeftRectPath,
|
|
170
|
+
schemeAccentToken,
|
|
171
|
+
schemeAreaToken,
|
|
172
|
+
schemeFillToken,
|
|
173
|
+
trendPolylinePoints
|
|
174
|
+
};
|
|
175
|
+
//# sourceMappingURL=linear-indicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linear-indicator.js","sources":["../../../src/automation/indicator-shared/linear-indicator.ts"],"sourcesContent":["import {svg, SVGTemplateResult} from 'lit';\n\n/**\n * Shared rendering core for linear automation indicators.\n *\n * Provides the internals used by `obc-indicator-battery` and\n * `obc-indicator-tank-atmospheric`: a bottom-up percentage bar fill and a\n * trend graph (history polyline with filled area plus a 4 px current-value\n * micro-bar). The consuming component draws its own outer frame and places\n * these templates inside its inner content rectangle.\n *\n * Coordinates are expressed in the component's 48×48 viewBox grid. Colors are\n * resolved through CSS custom properties so the templates follow the active\n * theme; the value scheme selects between the neutral, enhanced and\n * categorical token sets.\n */\n\nexport enum IndicatorDirection {\n vertical = 'vertical',\n horizontal = 'horizontal',\n}\n\nexport enum LinearIndicatorScheme {\n regular = 'regular',\n enhanced = 'enhanced',\n categorical = 'categorical',\n}\n\nexport interface Rect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nconst TREND_BAR_WIDTH = 4;\nconst TREND_BAR_GAP = 1;\n\nexport function clampPercent(value: number): number {\n if (Number.isNaN(value)) return 0;\n return Math.min(100, Math.max(0, value));\n}\n\nexport function fillHeight(rect: Rect, level: number): number {\n return (rect.height * clampPercent(level)) / 100;\n}\n\nexport function expandRect(rect: Rect, amount: number): Rect {\n return {\n x: rect.x - amount,\n y: rect.y - amount,\n width: rect.width + 2 * amount,\n height: rect.height + 2 * amount,\n };\n}\n\nfunction round3(value: number): number {\n return Math.round(value * 1000) / 1000;\n}\n\nexport function trendPolylinePoints(\n rect: Rect,\n data: number[],\n graphWidth: number\n): string {\n if (data.length < 2) return '';\n return data\n .map((value, index) => {\n const x = rect.x + (index / (data.length - 1)) * graphWidth;\n const y = rect.y + rect.height * (1 - clampPercent(value) / 100);\n return `${round3(x)},${round3(y)}`;\n })\n .join(' ');\n}\n\nexport function schemeFillToken(scheme: LinearIndicatorScheme): string {\n switch (scheme) {\n case LinearIndicatorScheme.enhanced:\n return 'var(--element-neutral-enhanced-color)';\n case LinearIndicatorScheme.categorical:\n return 'var(--base-teal-400)';\n default:\n return 'var(--element-neutral-color)';\n }\n}\n\nexport function schemeAccentToken(scheme: LinearIndicatorScheme): string {\n switch (scheme) {\n case LinearIndicatorScheme.enhanced:\n return 'var(--element-neutral-enhanced-color)';\n case LinearIndicatorScheme.categorical:\n return 'var(--base-teal-500)';\n default:\n return 'var(--element-neutral-color)';\n }\n}\n\nexport function schemeAreaToken(scheme: LinearIndicatorScheme): string {\n switch (scheme) {\n case LinearIndicatorScheme.enhanced:\n return 'var(--instrument-enhanced-tertiary-color)';\n case LinearIndicatorScheme.categorical:\n return 'var(--base-teal-100)';\n default:\n return 'var(--instrument-regular-tertiary-color)';\n }\n}\n\n/**\n * Rectangle path with rounded left corners and square right corners, used\n * to clip the trend graph so it follows the fill-container's rounded left\n * edge while butting flat against the micro-bar gap on the right.\n */\nexport function roundedLeftRectPath(\n rect: Rect,\n width: number,\n radius: number\n): string {\n const x = round3(rect.x);\n const y = round3(rect.y);\n const right = round3(rect.x + width);\n const bottom = round3(rect.y + rect.height);\n const r = round3(radius);\n return (\n `M ${round3(rect.x + radius)} ${y} H ${right} V ${bottom} ` +\n `H ${round3(rect.x + radius)} A ${r} ${r} 0 0 1 ${x} ${round3(bottom - radius)} ` +\n `V ${round3(rect.y + radius)} A ${r} ${r} 0 0 1 ${round3(rect.x + radius)} ${y} Z`\n );\n}\n\nexport function renderLinearBar(\n rect: Rect,\n level: number,\n scheme: LinearIndicatorScheme,\n idPrefix: string\n): SVGTemplateResult {\n const fillRect = expandRect(rect, 0.5);\n const height = fillHeight(fillRect, level);\n const clipId = `${idPrefix}-bar-clip`;\n return svg`\n <clipPath id=${clipId}>\n <rect x=${fillRect.x} y=${fillRect.y} width=${fillRect.width} height=${fillRect.height} rx=\"2.5\"></rect>\n </clipPath>\n <rect\n class=\"bar-background\"\n x=${rect.x}\n y=${rect.y}\n width=${rect.width}\n height=${rect.height}\n rx=\"2\"\n style=\"fill: var(--instrument-frame-secondary-color); stroke: var(--border-outline-color)\"\n ></rect>\n <rect\n class=\"bar-fill\"\n clip-path=\"url(#${clipId})\"\n x=${fillRect.x}\n y=${round3(fillRect.y + fillRect.height - height)}\n width=${fillRect.width}\n height=${round3(height)}\n style=\"fill: ${schemeFillToken(scheme)}\"\n ></rect>\n `;\n}\n\nexport function renderTrendGraph(\n rect: Rect,\n data: number[],\n level: number,\n scheme: LinearIndicatorScheme,\n idPrefix: string\n): SVGTemplateResult {\n const graphWidth = rect.width - TREND_BAR_WIDTH - TREND_BAR_GAP;\n const points = trendPolylinePoints(rect, data, graphWidth);\n const bottom = round3(rect.y + rect.height);\n const areaPath = points\n ? `M ${round3(rect.x)},${bottom} L ${points.split(' ').join(' L ')} L ${round3(rect.x + graphWidth)},${bottom} Z`\n : '';\n const barX = rect.x + rect.width - TREND_BAR_WIDTH;\n const height = fillHeight(rect, level);\n const accent = schemeAccentToken(scheme);\n const clipId = `${idPrefix}-trend-clip`;\n const barClipId = `${idPrefix}-trend-bar-clip`;\n return svg`\n <clipPath id=${clipId}>\n <path d=${roundedLeftRectPath(rect, graphWidth, 2)}></path>\n </clipPath>\n <clipPath id=${barClipId}>\n <rect x=${barX} y=${rect.y} width=${TREND_BAR_WIDTH} height=${rect.height} rx=\"2\"></rect>\n </clipPath>\n ${\n areaPath\n ? svg`\n <path\n class=\"trend-area\"\n clip-path=\"url(#${clipId})\"\n d=${areaPath}\n style=\"fill: ${schemeAreaToken(scheme)}\"\n ></path>\n <polyline\n class=\"trend-line\"\n clip-path=\"url(#${clipId})\"\n points=${points}\n fill=\"none\"\n style=\"stroke: ${accent}\"\n stroke-width=\"1\"\n vector-effect=\"non-scaling-stroke\"\n ></polyline>\n `\n : ''\n }\n <rect\n class=\"trend-track\"\n x=${barX}\n y=${rect.y}\n width=${TREND_BAR_WIDTH}\n height=${rect.height}\n rx=\"2\"\n style=\"fill: var(--border-divider-color)\"\n ></rect>\n <rect\n class=\"trend-bar-fill\"\n clip-path=\"url(#${barClipId})\"\n x=${barX}\n y=${round3(rect.y + rect.height - height)}\n width=${TREND_BAR_WIDTH}\n height=${round3(height)}\n style=\"fill: ${accent}\"\n ></rect>\n `;\n}\n"],"names":["IndicatorDirection","LinearIndicatorScheme"],"mappings":";AAiBO,IAAK,uCAAAA,wBAAL;AACLA,sBAAA,UAAA,IAAW;AACXA,sBAAA,YAAA,IAAa;AAFH,SAAAA;AAAA,GAAA,sBAAA,CAAA,CAAA;AAKL,IAAK,0CAAAC,2BAAL;AACLA,yBAAA,SAAA,IAAU;AACVA,yBAAA,UAAA,IAAW;AACXA,yBAAA,aAAA,IAAc;AAHJ,SAAAA;AAAA,GAAA,yBAAA,CAAA,CAAA;AAaZ,MAAM,kBAAkB;AACxB,MAAM,gBAAgB;AAEf,SAAS,aAAa,OAAuB;AAClD,MAAI,OAAO,MAAM,KAAK,EAAG,QAAO;AAChC,SAAO,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC;AACzC;AAEO,SAAS,WAAW,MAAY,OAAuB;AAC5D,SAAQ,KAAK,SAAS,aAAa,KAAK,IAAK;AAC/C;AAEO,SAAS,WAAW,MAAY,QAAsB;AAC3D,SAAO;AAAA,IACL,GAAG,KAAK,IAAI;AAAA,IACZ,GAAG,KAAK,IAAI;AAAA,IACZ,OAAO,KAAK,QAAQ,IAAI;AAAA,IACxB,QAAQ,KAAK,SAAS,IAAI;AAAA,EAAA;AAE9B;AAEA,SAAS,OAAO,OAAuB;AACrC,SAAO,KAAK,MAAM,QAAQ,GAAI,IAAI;AACpC;AA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AAC,CAAC;AAAA;AAAA,mBAErC,SAAS;AAAA,gBACZ,IAAI,MAAM,KAAK,CAAC,UAAU,eAAe,WAAW,KAAK,MAAM;AAAA;AAAA,MAGzE,WACI;AAAA;AAAA;AAAA,8BAGoB,MAAM;AAAA,gBACpB,QAAQ;AAAA,2BACG,gBAAgB,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA,8BAIpB,MAAM;AAAA,qBACf,MAAM;AAAA;AAAA,6BAEE,MAAM;AAAA;AAAA;AAAA;AAAA,YAKzB,EACN;AAAA;AAAA;AAAA,UAGM,IAAI;AAAA,UACJ,KAAK,CAAC;AAAA,cACF,eAAe;AAAA,eACd,KAAK,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAMF,SAAS;AAAA,UACvB,IAAI;AAAA,UACJ,OAAO,KAAK,IAAI,KAAK,SAAS,MAAM,CAAC;AAAA,cACjC,eAAe;AAAA,eACd,OAAO,MAAM,CAAC;AAAA,qBACR,MAAM;AAAA;AAAA;AAG3B;"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
const componentStyle = css`* {
|
|
3
|
+
-webkit-tap-highlight-color: transparent;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
:host {
|
|
7
|
+
display: block;
|
|
8
|
+
position: relative;
|
|
9
|
+
width: 48px;
|
|
10
|
+
height: 48px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
svg {
|
|
14
|
+
display: block;
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.frame {
|
|
20
|
+
fill: var(--instrument-frame-primary-color);
|
|
21
|
+
stroke: var(--instrument-frame-tertiary-color);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.icon-wrapper {
|
|
25
|
+
position: absolute;
|
|
26
|
+
inset: 12px;
|
|
27
|
+
color: var(--element-neutral-color);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:host([value="enhanced"]) .icon-wrapper {
|
|
31
|
+
color: var(--element-neutral-enhanced-color);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host([value="medium"]) .icon-wrapper {
|
|
35
|
+
color: var(--base-teal-500);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.icon-wrapper ::slotted(*),
|
|
39
|
+
.icon-wrapper obi-tank {
|
|
40
|
+
display: block;
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
export {
|
|
46
|
+
componentStyle as default
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=indicator-tank-atmospheric.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indicator-tank-atmospheric.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { IndicatorDirection } from '../indicator-shared/linear-indicator.js';
|
|
3
|
+
import '../../icons/icon-tank.js';
|
|
4
|
+
export declare enum IndicatorTankAtmosphericVariant {
|
|
5
|
+
bar = "bar",
|
|
6
|
+
trend = "trend"
|
|
7
|
+
}
|
|
8
|
+
export declare enum IndicatorTankAtmosphericValue {
|
|
9
|
+
regular = "regular",
|
|
10
|
+
enhanced = "enhanced",
|
|
11
|
+
medium = "medium"
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Compact 48×48 atmospheric tank level indicator.
|
|
15
|
+
*
|
|
16
|
+
* ## Features / Variants
|
|
17
|
+
* - `variant`: `bar` (bottom-up percentage fill) or `trend` (history graph
|
|
18
|
+
* with a current-value micro-bar)
|
|
19
|
+
* - `direction`: `vertical` or `horizontal` tank outline
|
|
20
|
+
* - `value`: color scheme — `regular`, `enhanced` or `medium`
|
|
21
|
+
* - `level`: current tank level 0–100 (%), drives the fill and micro-bar
|
|
22
|
+
* - `data`: history samples 0–100 (%) drawn as the trend graph
|
|
23
|
+
* - `hasIcon`: centered icon overlay (bar variant only)
|
|
24
|
+
*
|
|
25
|
+
* ## Usage Guidelines
|
|
26
|
+
* Use as an at-a-glance level indicator in dashboards and lists. For a
|
|
27
|
+
* full-featured tank cell with readouts, badges and setpoints, use
|
|
28
|
+
* `obc-automation-tank` instead.
|
|
29
|
+
*
|
|
30
|
+
* ## Best Practices / Constraints
|
|
31
|
+
* - `level` and `data` values are clamped to 0–100; values outside that
|
|
32
|
+
* range are pinned to the nearest bound.
|
|
33
|
+
* - The `trend` variant needs at least two `data` samples to draw a line;
|
|
34
|
+
* with fewer it shows only the current-value micro-bar.
|
|
35
|
+
* - The `icon` slot renders only in the `bar` variant; it is ignored in
|
|
36
|
+
* `trend`.
|
|
37
|
+
* - Display-only: the root SVG is `aria-hidden`; convey tank level to
|
|
38
|
+
* assistive tech through adjacent text if it is not otherwise available.
|
|
39
|
+
*
|
|
40
|
+
* ## Slots
|
|
41
|
+
* | Slot | Condition | Purpose |
|
|
42
|
+
* | ------ | ----------------------------- | ------------------------------ |
|
|
43
|
+
* | `icon` | `hasIcon` and `variant='bar'` | Icon overlay (`obi-*` element) |
|
|
44
|
+
*
|
|
45
|
+
* @slot icon - Centered icon overlay, defaults to `obi-tank`
|
|
46
|
+
*/
|
|
47
|
+
export declare class ObcIndicatorTankAtmospheric extends LitElement {
|
|
48
|
+
direction: IndicatorDirection;
|
|
49
|
+
variant: IndicatorTankAtmosphericVariant;
|
|
50
|
+
value: IndicatorTankAtmosphericValue;
|
|
51
|
+
/** Current level, 0-100 (%) */
|
|
52
|
+
level: number;
|
|
53
|
+
/** History samples, 0-100 (%) each, oldest first */
|
|
54
|
+
data: number[];
|
|
55
|
+
hasIcon: boolean;
|
|
56
|
+
private get scheme();
|
|
57
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
58
|
+
static styles: import('lit').CSSResult;
|
|
59
|
+
}
|
|
60
|
+
declare global {
|
|
61
|
+
interface HTMLElementTagNameMap {
|
|
62
|
+
'obc-indicator-tank-atmospheric': ObcIndicatorTankAtmospheric;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=indicator-tank-atmospheric.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indicator-tank-atmospheric.d.ts","sourceRoot":"","sources":["../../../src/automation/indicator-tank-atmospheric/indicator-tank-atmospheric.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,KAAK,CAAC;AAIzD,OAAO,0BAA0B,CAAC;AAClC,OAAO,EACL,kBAAkB,EAKnB,MAAM,yCAAyC,CAAC;AAEjD,oBAAY,+BAA+B;IACzC,GAAG,QAAQ;IACX,KAAK,UAAU;CAChB;AAED,oBAAY,6BAA6B;IACvC,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBACa,2BAA4B,SAAQ,UAAU;IAChB,SAAS,EAAE,kBAAkB,CACxC;IAE9B,OAAO,EAAE,+BAA+B,CACF;IAEtC,KAAK,EAAE,6BAA6B,CAAyC;IAC7E,+BAA+B;IACL,KAAK,SAAK;IACpC,oDAAoD;IAC3B,IAAI,EAAE,MAAM,EAAE,CAAM;IAClB,OAAO,UAAS;IAE3C,OAAO,KAAK,MAAM,GASjB;IAEQ,MAAM;IAsCf,OAAgB,MAAM,0BAA6B;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gCAAgC,EAAE,2BAA2B,CAAC;KAC/D;CACF"}
|