@oicl/openbridge-webcomponents-full-bundle 2.1.0-next.3 → 2.1.0-next.4
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 +726 -485
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +1695 -410
- package/dist/automation/analog-threeway-valve/analog-threeway-valve.d.ts +76 -0
- package/dist/automation/analog-threeway-valve/analog-threeway-valve.d.ts.map +1 -0
- package/dist/automation/analog-threeway-valve/analog-threeway-valve.js +61 -0
- package/dist/automation/analog-threeway-valve/analog-threeway-valve.js.map +1 -0
- package/dist/automation/analog-valve/analog-valve.js +1 -1
- package/dist/automation/digital-threeway-valve/digital-threeway-valve.d.ts +82 -0
- package/dist/automation/digital-threeway-valve/digital-threeway-valve.d.ts.map +1 -0
- package/dist/automation/digital-threeway-valve/digital-threeway-valve.js +90 -0
- package/dist/automation/digital-threeway-valve/digital-threeway-valve.js.map +1 -0
- package/dist/automation/threeway-valve-shared/threeway-valve-shared.d.ts +39 -0
- package/dist/automation/threeway-valve-shared/threeway-valve-shared.d.ts.map +1 -0
- package/dist/automation/threeway-valve-shared/threeway-valve-shared.js +80 -0
- package/dist/automation/threeway-valve-shared/threeway-valve-shared.js.map +1 -0
- package/dist/automation/valve-analog-three-way-icon/valve-analog-three-way-icon.d.ts +65 -4
- package/dist/automation/valve-analog-three-way-icon/valve-analog-three-way-icon.d.ts.map +1 -1
- package/dist/automation/valve-analog-three-way-icon/valve-analog-three-way-icon.js +153 -111
- package/dist/automation/valve-analog-three-way-icon/valve-analog-three-way-icon.js.map +1 -1
- package/dist/components/automation-button-readout-stack/automation-button-readout-stack.d.ts +3 -0
- package/dist/components/automation-button-readout-stack/automation-button-readout-stack.d.ts.map +1 -1
- package/dist/components/automation-button-readout-stack/automation-button-readout-stack.js +17 -10
- package/dist/components/automation-button-readout-stack/automation-button-readout-stack.js.map +1 -1
- package/package.json +1 -1
- package/src/automation/analog-threeway-valve/analog-threeway-valve.stories.ts +106 -0
- package/src/automation/analog-threeway-valve/analog-threeway-valve.ts +105 -0
- package/src/automation/digital-threeway-valve/digital-threeway-valve.stories.ts +122 -0
- package/src/automation/digital-threeway-valve/digital-threeway-valve.ts +143 -0
- package/src/automation/threeway-valve-shared/threeway-valve-shared.ts +110 -0
- package/src/automation/valve-analog-three-way-icon/valve-analog-three-way-icon.stories.ts +145 -37
- package/src/automation/valve-analog-three-way-icon/valve-analog-three-way-icon.ts +225 -126
- package/src/components/automation-button-readout-stack/automation-button-readout-stack.stories.ts +13 -0
- package/src/components/automation-button-readout-stack/automation-button-readout-stack.ts +31 -16
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type {Meta, StoryObj} from '@storybook/web-components-vite';
|
|
2
|
+
import {ObcAnalogThreewayValve} from './analog-threeway-valve.js';
|
|
3
|
+
import {
|
|
4
|
+
AutomationButtonLabelDirection,
|
|
5
|
+
AutomationButtonReadoutPosition,
|
|
6
|
+
} from '../automation-button/automation-button.js';
|
|
7
|
+
import {AutomationButtonReadoutStackSize} from '../../components/automation-button-readout-stack/automation-button-readout-stack.js';
|
|
8
|
+
import './analog-threeway-valve.js';
|
|
9
|
+
import {crossDecorator} from '../../storybook-util.js';
|
|
10
|
+
import {argTypesAbstractAutomationButtonPassiveRound} from '../automation-button/abstract-automation-button-storybook-helpers.js';
|
|
11
|
+
import {ThreewayValveOrientation} from '../threeway-valve-shared/threeway-valve-shared.js';
|
|
12
|
+
|
|
13
|
+
const meta: Meta<typeof ObcAnalogThreewayValve> = {
|
|
14
|
+
title: 'Automation/Automation Devices/Analog Threeway Valve',
|
|
15
|
+
tags: ['autodocs', 'experimental'],
|
|
16
|
+
component: 'obc-analog-threeway-valve',
|
|
17
|
+
decorators: [crossDecorator],
|
|
18
|
+
args: {
|
|
19
|
+
tag: '#0012',
|
|
20
|
+
readoutPosition: AutomationButtonReadoutPosition.bottom,
|
|
21
|
+
readoutSize: AutomationButtonReadoutStackSize.regular,
|
|
22
|
+
alert: false,
|
|
23
|
+
progress: false,
|
|
24
|
+
showReadoutStack: true,
|
|
25
|
+
orientation: ThreewayValveOrientation.bottom,
|
|
26
|
+
open1: 100,
|
|
27
|
+
open2: 60,
|
|
28
|
+
open3: 40,
|
|
29
|
+
flows: [
|
|
30
|
+
{direction: AutomationButtonLabelDirection.down, value: 12, unit: 'm³/h'},
|
|
31
|
+
{direction: AutomationButtonLabelDirection.right, value: 8, unit: 'm³/h'},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
argTypes: {
|
|
35
|
+
...argTypesAbstractAutomationButtonPassiveRound,
|
|
36
|
+
open1: {control: {type: 'range', min: 0, max: 100, step: 1}},
|
|
37
|
+
open2: {control: {type: 'range', min: 0, max: 100, step: 1}},
|
|
38
|
+
open3: {control: {type: 'range', min: 0, max: 100, step: 1}},
|
|
39
|
+
orientation: {
|
|
40
|
+
options: Object.values(ThreewayValveOrientation),
|
|
41
|
+
control: {type: 'radio'},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
} as Meta<typeof ObcAnalogThreewayValve>;
|
|
45
|
+
|
|
46
|
+
export default meta;
|
|
47
|
+
type Story = StoryObj<ObcAnalogThreewayValve>;
|
|
48
|
+
|
|
49
|
+
const D = AutomationButtonLabelDirection;
|
|
50
|
+
|
|
51
|
+
export const Split: Story = {};
|
|
52
|
+
|
|
53
|
+
export const Open: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
open1: 100,
|
|
56
|
+
open2: 100,
|
|
57
|
+
open3: 100,
|
|
58
|
+
flows: [
|
|
59
|
+
{direction: D.down, value: 10, unit: 'm³/h'},
|
|
60
|
+
{direction: D.right, value: 10, unit: 'm³/h'},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const Closed: Story = {
|
|
66
|
+
args: {open1: 0, open2: 0, open3: 0},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const Port3Closed: Story = {
|
|
70
|
+
args: {
|
|
71
|
+
open1: 100,
|
|
72
|
+
open2: 100,
|
|
73
|
+
open3: 0,
|
|
74
|
+
flows: [{direction: D.down, value: 20, unit: 'm³/h'}],
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const OrientationLeft: Story = {
|
|
79
|
+
args: {
|
|
80
|
+
orientation: ThreewayValveOrientation.left,
|
|
81
|
+
flows: [
|
|
82
|
+
{direction: D.left, value: 12, unit: 'm³/h'},
|
|
83
|
+
{direction: D.down, value: 8, unit: 'm³/h'},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const OrientationTop: Story = {
|
|
89
|
+
args: {
|
|
90
|
+
orientation: ThreewayValveOrientation.top,
|
|
91
|
+
flows: [
|
|
92
|
+
{direction: D.up, value: 12, unit: 'm³/h'},
|
|
93
|
+
{direction: D.left, value: 8, unit: 'm³/h'},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const OrientationRight: Story = {
|
|
99
|
+
args: {
|
|
100
|
+
orientation: ThreewayValveOrientation.right,
|
|
101
|
+
flows: [
|
|
102
|
+
{direction: D.right, value: 12, unit: 'm³/h'},
|
|
103
|
+
{direction: D.up, value: 8, unit: 'm³/h'},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import {html} from 'lit';
|
|
2
|
+
import {property} from 'lit/decorators.js';
|
|
3
|
+
import '../valve-analog-three-way-icon/valve-analog-three-way-icon.js';
|
|
4
|
+
import {customElement} from '../../decorator.js';
|
|
5
|
+
import {ObcAbstractAutomationButton} from '../automation-button/abstract-automation-button.js';
|
|
6
|
+
import {AutomationButtonReadoutStack} from '../../components/automation-button-readout-stack/automation-button-readout-stack.js';
|
|
7
|
+
import {
|
|
8
|
+
ThreewayValveFlow,
|
|
9
|
+
ThreewayValveOrientation,
|
|
10
|
+
threewayValveReadouts,
|
|
11
|
+
} from '../threeway-valve-shared/threeway-valve-shared.js';
|
|
12
|
+
|
|
13
|
+
export enum AnalogThreewayValveVariant {
|
|
14
|
+
regular = 'regular',
|
|
15
|
+
flat = 'flat',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* `<obc-analog-threeway-valve>` – three-way control valve for process
|
|
20
|
+
* diagrams, with a continuous opening per port.
|
|
21
|
+
*
|
|
22
|
+
* ## Features
|
|
23
|
+
*
|
|
24
|
+
* - **Three ports:** `open1`, `open2` and `open3` set each port's opening in
|
|
25
|
+
* percent. Ports are numbered from the side without a port: with
|
|
26
|
+
* `orientation` `bottom`, port 1 is left, port 2 is the stem at the bottom
|
|
27
|
+
* and port 3 is right. The numbering turns with the symbol.
|
|
28
|
+
* - **Symbol:** a partly open port shows its shut part as a band at the port
|
|
29
|
+
* end, a port at 0 % is drawn plugged, and the handle shows how the most
|
|
30
|
+
* open port splits between the two others (`obc-valve-analog-three-way-icon`).
|
|
31
|
+
* - **Orientation:** `bottom` and `top` lay the valve on a horizontal pipe,
|
|
32
|
+
* `left` and `right` on a vertical one; the value names the side the stem
|
|
33
|
+
* points to.
|
|
34
|
+
* - **Flow readout:** `flows` lists one readout row per flow, each with an
|
|
35
|
+
* optional arrow direction and either a value with a unit (`%` when left out)
|
|
36
|
+
* or a state, `{open}`, shown as `Open` or `Closed` after the arrow, or
|
|
37
|
+
* after the on/off icon when there is no direction. Without flows the
|
|
38
|
+
* readout shows `Open` or `Closed`.
|
|
39
|
+
* - Badges, alert frame, progress and readout placement come from the shared
|
|
40
|
+
* automation button base.
|
|
41
|
+
*
|
|
42
|
+
* ## Usage Guidelines
|
|
43
|
+
*
|
|
44
|
+
* Use for a mixing or diverting valve that opens its ports continuously.
|
|
45
|
+
* With fewer than two ports open no flow can pass, and the valve shows as
|
|
46
|
+
* closed. For on/off ports use `obc-digital-threeway-valve`; for a two-port
|
|
47
|
+
* control valve use `obc-analog-valve`.
|
|
48
|
+
*
|
|
49
|
+
* @property open1 - Opening of port 1 in percent (0–100).
|
|
50
|
+
* @property open2 - Opening of port 2, the stem, in percent (0–100).
|
|
51
|
+
* @property open3 - Opening of port 3 in percent (0–100).
|
|
52
|
+
* @property orientation - Side the stem points to.
|
|
53
|
+
* @property flows - Readout rows, one per flow: an optional arrow direction with either a value and optional unit (default `%`) or `open` for an `Open`/`Closed` state.
|
|
54
|
+
* @property variant - Visual style of the button surround.
|
|
55
|
+
* @slot badge-top-right - Content projected into the top-right badge position; overrides `badgeAlert`.
|
|
56
|
+
* @slot badge-top-left - Content projected into the top-left badge position; overrides `badgeControl`.
|
|
57
|
+
* @slot badge-bottom-left - Content projected into the bottom-left badge position; overrides `badgeInterlock`.
|
|
58
|
+
* @slot badge-bottom-right - Content projected into the bottom-right badge position; overrides `badgeCommandLocked`.
|
|
59
|
+
* @fires click - Fired when the valve is clicked.
|
|
60
|
+
* @experimental
|
|
61
|
+
*/
|
|
62
|
+
@customElement('obc-analog-threeway-valve')
|
|
63
|
+
export class ObcAnalogThreewayValve extends ObcAbstractAutomationButton {
|
|
64
|
+
@property({type: Number}) open1: number = 0;
|
|
65
|
+
@property({type: Number}) open2: number = 0;
|
|
66
|
+
@property({type: Number}) open3: number = 0;
|
|
67
|
+
@property({type: String}) orientation: ThreewayValveOrientation =
|
|
68
|
+
ThreewayValveOrientation.bottom;
|
|
69
|
+
@property({type: Array, attribute: false}) flows: ThreewayValveFlow[] = [];
|
|
70
|
+
@property({type: String}) variant: AnalogThreewayValveVariant =
|
|
71
|
+
AnalogThreewayValveVariant.regular;
|
|
72
|
+
|
|
73
|
+
override get _on(): boolean {
|
|
74
|
+
return (
|
|
75
|
+
[this.open1, this.open2, this.open3].filter((o) => o > 0).length >= 2
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
override get extraReadouts(): AutomationButtonReadoutStack[] {
|
|
80
|
+
if (!this.showStatus) {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
return threewayValveReadouts(this._on, this.flows);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
private renderIcon(slot: string) {
|
|
87
|
+
return html`<obc-valve-analog-three-way-icon
|
|
88
|
+
.open1=${this.open1}
|
|
89
|
+
.open2=${this.open2}
|
|
90
|
+
.open3=${this.open3}
|
|
91
|
+
.orientation=${this.orientation}
|
|
92
|
+
slot=${slot}
|
|
93
|
+
></obc-valve-analog-three-way-icon>`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
override get icon() {
|
|
97
|
+
return html`${this.renderIcon('icon')}${this.renderIcon('icon-silhouette')}`;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare global {
|
|
102
|
+
interface HTMLElementTagNameMap {
|
|
103
|
+
'obc-analog-threeway-valve': ObcAnalogThreewayValve;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type {Meta, StoryObj} from '@storybook/web-components-vite';
|
|
2
|
+
import {ObcDigitalThreewayValve} from './digital-threeway-valve.js';
|
|
3
|
+
import {
|
|
4
|
+
AutomationButtonLabelDirection,
|
|
5
|
+
AutomationButtonReadoutPosition,
|
|
6
|
+
} from '../automation-button/automation-button.js';
|
|
7
|
+
import {AutomationButtonReadoutStackSize} from '../../components/automation-button-readout-stack/automation-button-readout-stack.js';
|
|
8
|
+
import './digital-threeway-valve.js';
|
|
9
|
+
import {crossDecorator} from '../../storybook-util.js';
|
|
10
|
+
import {argTypesAbstractAutomationButtonPassiveRound} from '../automation-button/abstract-automation-button-storybook-helpers.js';
|
|
11
|
+
import {ThreewayValveOrientation} from '../threeway-valve-shared/threeway-valve-shared.js';
|
|
12
|
+
|
|
13
|
+
const meta: Meta<typeof ObcDigitalThreewayValve> = {
|
|
14
|
+
title: 'Automation/Automation Devices/Digital Threeway Valve',
|
|
15
|
+
tags: ['autodocs', 'experimental'],
|
|
16
|
+
component: 'obc-digital-threeway-valve',
|
|
17
|
+
decorators: [crossDecorator],
|
|
18
|
+
args: {
|
|
19
|
+
tag: '#0012',
|
|
20
|
+
readoutPosition: AutomationButtonReadoutPosition.bottom,
|
|
21
|
+
readoutSize: AutomationButtonReadoutStackSize.regular,
|
|
22
|
+
alert: false,
|
|
23
|
+
progress: false,
|
|
24
|
+
showReadoutStack: true,
|
|
25
|
+
orientation: ThreewayValveOrientation.bottom,
|
|
26
|
+
open1: true,
|
|
27
|
+
open2: true,
|
|
28
|
+
open3: true,
|
|
29
|
+
},
|
|
30
|
+
argTypes: {
|
|
31
|
+
...argTypesAbstractAutomationButtonPassiveRound,
|
|
32
|
+
orientation: {
|
|
33
|
+
options: Object.values(ThreewayValveOrientation),
|
|
34
|
+
control: {type: 'radio'},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
} as Meta<typeof ObcDigitalThreewayValve>;
|
|
38
|
+
|
|
39
|
+
export default meta;
|
|
40
|
+
type Story = StoryObj<ObcDigitalThreewayValve>;
|
|
41
|
+
|
|
42
|
+
const D = AutomationButtonLabelDirection;
|
|
43
|
+
|
|
44
|
+
export const Open: Story = {
|
|
45
|
+
args: {},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const OpenExplicit: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
flows: [
|
|
51
|
+
{direction: D.right, open: true},
|
|
52
|
+
{direction: D.down, open: true},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const Closed: Story = {
|
|
58
|
+
args: {open1: false, open2: false, open3: false},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const Port1Closed: Story = {
|
|
62
|
+
args: {open1: false, flows: [{direction: D.right, open: true}]},
|
|
63
|
+
};
|
|
64
|
+
export const Port1ExplicitClosed: Story = {
|
|
65
|
+
args: {
|
|
66
|
+
open1: false,
|
|
67
|
+
flows: [
|
|
68
|
+
{direction: D.right, open: true},
|
|
69
|
+
{direction: D.left, open: false},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const Port2Closed: Story = {
|
|
75
|
+
args: {open2: false, flows: [{direction: D.right, open: true}]},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const Port3Closed: Story = {
|
|
79
|
+
args: {open3: false, flows: [{direction: D.down, open: true}]},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const OrientationLeft: Story = {
|
|
83
|
+
args: {
|
|
84
|
+
orientation: ThreewayValveOrientation.left,
|
|
85
|
+
open1: false,
|
|
86
|
+
flows: [{direction: D.down, open: true}],
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const OrientationTop: Story = {
|
|
91
|
+
args: {
|
|
92
|
+
orientation: ThreewayValveOrientation.top,
|
|
93
|
+
open1: false,
|
|
94
|
+
flows: [{direction: D.up, open: true}],
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const OrientationRight: Story = {
|
|
99
|
+
args: {
|
|
100
|
+
orientation: ThreewayValveOrientation.right,
|
|
101
|
+
open1: false,
|
|
102
|
+
flows: [{direction: D.right, open: true}],
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const WithValueFlows: Story = {
|
|
107
|
+
args: {
|
|
108
|
+
flows: [
|
|
109
|
+
{direction: D.right, value: 8, unit: 'm³/h'},
|
|
110
|
+
{direction: D.down, value: 12, unit: 'm³/h'},
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const WithValuePercentageFlows: Story = {
|
|
116
|
+
args: {
|
|
117
|
+
flows: [
|
|
118
|
+
{direction: D.right, value: 100},
|
|
119
|
+
{direction: D.down, value: 100},
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import {html} from 'lit';
|
|
2
|
+
import {property} from 'lit/decorators.js';
|
|
3
|
+
import '../../icons/icon-threeway-digital-open.js';
|
|
4
|
+
import '../../icons/icon-threeway-digital-closed.js';
|
|
5
|
+
import '../../icons/icon-threeway-digital-closed-left.js';
|
|
6
|
+
import '../../icons/icon-threeway-digital-closed-bottom.js';
|
|
7
|
+
import '../../icons/icon-threeway-digital-closed-right.js';
|
|
8
|
+
import {customElement} from '../../decorator.js';
|
|
9
|
+
import {ObcAbstractAutomationButton} from '../automation-button/abstract-automation-button.js';
|
|
10
|
+
import {AutomationButtonReadoutStack} from '../../components/automation-button-readout-stack/automation-button-readout-stack.js';
|
|
11
|
+
import {
|
|
12
|
+
ThreewayValveFlow,
|
|
13
|
+
ThreewayValveOrientation,
|
|
14
|
+
threewayValveReadouts,
|
|
15
|
+
threewayValveRotation,
|
|
16
|
+
} from '../threeway-valve-shared/threeway-valve-shared.js';
|
|
17
|
+
|
|
18
|
+
export enum DigitalThreewayValveVariant {
|
|
19
|
+
regular = 'regular',
|
|
20
|
+
flat = 'flat',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* `<obc-digital-threeway-valve>` – three-way on/off valve for process
|
|
25
|
+
* diagrams, with one open/closed state per port.
|
|
26
|
+
*
|
|
27
|
+
* ## Features
|
|
28
|
+
*
|
|
29
|
+
* - **Three ports:** `open1`, `open2` and `open3` open or close each port.
|
|
30
|
+
* Ports are numbered from the side without a port: with `orientation`
|
|
31
|
+
* `bottom`, port 1 is left, port 2 is the stem at the bottom and port 3 is
|
|
32
|
+
* right. The numbering turns with the symbol.
|
|
33
|
+
* - **Orientation:** `bottom` and `top` lay the valve on a horizontal pipe,
|
|
34
|
+
* `left` and `right` on a vertical one; the value names the side the stem
|
|
35
|
+
* points to.
|
|
36
|
+
* - **Flow readout:** `flows` lists one readout row per flow, each with an
|
|
37
|
+
* optional arrow direction and either a value with a unit (`%` when left out)
|
|
38
|
+
* or a state, `{open}`, shown as `Open` or `Closed` after the arrow, or
|
|
39
|
+
* after the on/off icon when there is no direction. Without flows the
|
|
40
|
+
* readout shows `Open` or `Closed`.
|
|
41
|
+
* - Badges, alert frame, progress and readout placement come from the shared
|
|
42
|
+
* automation button base.
|
|
43
|
+
*
|
|
44
|
+
* ## Usage Guidelines
|
|
45
|
+
*
|
|
46
|
+
* Use where a valve directs flow between three pipes and each port is either
|
|
47
|
+
* open or closed. With one port closed the symbol shows that port plugged;
|
|
48
|
+
* with fewer than two ports open no flow can pass, and the valve shows as
|
|
49
|
+
* closed. For a valve that opens its ports continuously use
|
|
50
|
+
* `obc-analog-threeway-valve`; for a two-port valve use `obc-digital-valve`.
|
|
51
|
+
*
|
|
52
|
+
* TODO(designer): no icon shows a single open port, so that case uses the
|
|
53
|
+
* closed symbol.
|
|
54
|
+
*
|
|
55
|
+
* @property open1 - Opens port 1.
|
|
56
|
+
* @property open2 - Opens port 2, the stem.
|
|
57
|
+
* @property open3 - Opens port 3.
|
|
58
|
+
* @property orientation - Side the stem points to.
|
|
59
|
+
* @property flows - Readout rows, one per flow: an optional arrow direction with either a value and optional unit (default `%`) or `open` for an `Open`/`Closed` state.
|
|
60
|
+
* @property variant - Visual style of the button surround.
|
|
61
|
+
* @slot badge-top-right - Content projected into the top-right badge position; overrides `badgeAlert`.
|
|
62
|
+
* @slot badge-top-left - Content projected into the top-left badge position; overrides `badgeControl`.
|
|
63
|
+
* @slot badge-bottom-left - Content projected into the bottom-left badge position; overrides `badgeInterlock`.
|
|
64
|
+
* @slot badge-bottom-right - Content projected into the bottom-right badge position; overrides `badgeCommandLocked`.
|
|
65
|
+
* @fires click - Fired when the valve is clicked.
|
|
66
|
+
* @experimental
|
|
67
|
+
*/
|
|
68
|
+
@customElement('obc-digital-threeway-valve')
|
|
69
|
+
export class ObcDigitalThreewayValve extends ObcAbstractAutomationButton {
|
|
70
|
+
@property({type: Boolean}) open1: boolean = false;
|
|
71
|
+
@property({type: Boolean}) open2: boolean = false;
|
|
72
|
+
@property({type: Boolean}) open3: boolean = false;
|
|
73
|
+
@property({type: String}) orientation: ThreewayValveOrientation =
|
|
74
|
+
ThreewayValveOrientation.bottom;
|
|
75
|
+
@property({type: Array, attribute: false}) flows: ThreewayValveFlow[] = [];
|
|
76
|
+
@property({type: String}) variant: DigitalThreewayValveVariant =
|
|
77
|
+
DigitalThreewayValveVariant.regular;
|
|
78
|
+
|
|
79
|
+
private get ports(): boolean[] {
|
|
80
|
+
return [this.open1, this.open2, this.open3];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
override get _on(): boolean {
|
|
84
|
+
return this.ports.filter(Boolean).length >= 2;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
override get extraReadouts(): AutomationButtonReadoutStack[] {
|
|
88
|
+
if (!this.showStatus) {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
return threewayValveReadouts(this._on, this.flows);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private renderIcon(slot: string) {
|
|
95
|
+
const style = `display: block; transform: rotate(${threewayValveRotation(
|
|
96
|
+
this.orientation
|
|
97
|
+
)}deg); line-height: 0;`;
|
|
98
|
+
const ports = this.ports;
|
|
99
|
+
if (!this._on) {
|
|
100
|
+
return html`<obi-threeway-digital-closed
|
|
101
|
+
usecsscolor
|
|
102
|
+
slot=${slot}
|
|
103
|
+
style=${style}
|
|
104
|
+
></obi-threeway-digital-closed>`;
|
|
105
|
+
}
|
|
106
|
+
switch (ports.indexOf(false)) {
|
|
107
|
+
case 0:
|
|
108
|
+
return html`<obi-threeway-digital-closed-left
|
|
109
|
+
usecsscolor
|
|
110
|
+
slot=${slot}
|
|
111
|
+
style=${style}
|
|
112
|
+
></obi-threeway-digital-closed-left>`;
|
|
113
|
+
case 1:
|
|
114
|
+
return html`<obi-threeway-digital-closed-bottom
|
|
115
|
+
usecsscolor
|
|
116
|
+
slot=${slot}
|
|
117
|
+
style=${style}
|
|
118
|
+
></obi-threeway-digital-closed-bottom>`;
|
|
119
|
+
case 2:
|
|
120
|
+
return html`<obi-threeway-digital-closed-right
|
|
121
|
+
usecsscolor
|
|
122
|
+
slot=${slot}
|
|
123
|
+
style=${style}
|
|
124
|
+
></obi-threeway-digital-closed-right>`;
|
|
125
|
+
default:
|
|
126
|
+
return html`<obi-threeway-digital-open
|
|
127
|
+
usecsscolor
|
|
128
|
+
slot=${slot}
|
|
129
|
+
style=${style}
|
|
130
|
+
></obi-threeway-digital-open>`;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
override get icon() {
|
|
135
|
+
return html`${this.renderIcon('icon')}${this.renderIcon('icon-silhouette')}`;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
declare global {
|
|
140
|
+
interface HTMLElementTagNameMap {
|
|
141
|
+
'obc-digital-threeway-valve': ObcDigitalThreewayValve;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared vocabulary of the three-way valves: `obc-digital-threeway-valve`,
|
|
3
|
+
* `obc-analog-threeway-valve` and `obc-valve-analog-three-way-icon`.
|
|
4
|
+
*
|
|
5
|
+
* ## Ports
|
|
6
|
+
*
|
|
7
|
+
* A three-way valve has three ports and one side without a port. The ports
|
|
8
|
+
* are numbered from the side without a port, in the order left, stem, right
|
|
9
|
+
* as seen with the stem pointing down: with `orientation` `bottom`, port 1 is
|
|
10
|
+
* the left port, port 2 the bottom port (the stem) and port 3 the right port.
|
|
11
|
+
* The numbering turns with the symbol, so port 2 is always the stem.
|
|
12
|
+
*
|
|
13
|
+
* ## Flow readouts
|
|
14
|
+
*
|
|
15
|
+
* Flow through a three-way valve can go several ways at once, so the readout
|
|
16
|
+
* is a list: one row per flow, each with an optional arrow direction and
|
|
17
|
+
* either a value with a unit (`%` when left out) or a state (`Open` /
|
|
18
|
+
* `Closed`).
|
|
19
|
+
*
|
|
20
|
+
* @module
|
|
21
|
+
*/
|
|
22
|
+
import {AutomationButtonLabelDirection} from '../automation-button/automation-button.js';
|
|
23
|
+
import {AutomationButtonReadoutStack} from '../../components/automation-button-readout-stack/automation-button-readout-stack.js';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The side the stem (port 2) points to. `bottom` and `top` lay the valve on a
|
|
27
|
+
* horizontal pipe, `left` and `right` on a vertical one.
|
|
28
|
+
*/
|
|
29
|
+
export enum ThreewayValveOrientation {
|
|
30
|
+
bottom = 'bottom',
|
|
31
|
+
left = 'left',
|
|
32
|
+
top = 'top',
|
|
33
|
+
right = 'right',
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Clockwise rotation from the `bottom` drawing, in degrees. */
|
|
37
|
+
export function threewayValveRotation(
|
|
38
|
+
orientation: ThreewayValveOrientation
|
|
39
|
+
): number {
|
|
40
|
+
switch (orientation) {
|
|
41
|
+
case ThreewayValveOrientation.left:
|
|
42
|
+
return 90;
|
|
43
|
+
case ThreewayValveOrientation.top:
|
|
44
|
+
return 180;
|
|
45
|
+
case ThreewayValveOrientation.right:
|
|
46
|
+
return 270;
|
|
47
|
+
default:
|
|
48
|
+
return 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** A flow readout row with a value: `→ 060 %`. */
|
|
53
|
+
export interface ThreewayValveValueFlow {
|
|
54
|
+
/** Arrow direction on screen; left out or `none` hides the arrow. */
|
|
55
|
+
direction?: AutomationButtonLabelDirection;
|
|
56
|
+
value: number;
|
|
57
|
+
/** Defaults to `%`. */
|
|
58
|
+
unit?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** A flow readout row with a state: `→ Open`, `→ Closed`, or the on/off icon without a direction. */
|
|
62
|
+
export interface ThreewayValveStateFlow {
|
|
63
|
+
/**
|
|
64
|
+
* Arrow direction on screen; left out or `none` shows the on or off icon
|
|
65
|
+
* instead.
|
|
66
|
+
*/
|
|
67
|
+
direction?: AutomationButtonLabelDirection;
|
|
68
|
+
open: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** One row of the flow readout. */
|
|
72
|
+
export type ThreewayValveFlow = ThreewayValveValueFlow | ThreewayValveStateFlow;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The readout rows of a three-way valve: `Closed` while no flow can pass,
|
|
76
|
+
* the flow rows while it can, and `Open` when the application gives no flows.
|
|
77
|
+
*/
|
|
78
|
+
export function threewayValveReadouts(
|
|
79
|
+
passing: boolean,
|
|
80
|
+
flows: ThreewayValveFlow[]
|
|
81
|
+
): AutomationButtonReadoutStack[] {
|
|
82
|
+
if (!passing) {
|
|
83
|
+
return [{type: 'state-off', value: 'Closed', hasIcon: true}];
|
|
84
|
+
}
|
|
85
|
+
if (flows.length === 0) {
|
|
86
|
+
return [{type: 'state-on', value: 'Open', hasIcon: true}];
|
|
87
|
+
}
|
|
88
|
+
return flows.map((flow): AutomationButtonReadoutStack => {
|
|
89
|
+
if ('open' in flow) {
|
|
90
|
+
return {
|
|
91
|
+
type: flow.open ? 'state-on' : 'state-off',
|
|
92
|
+
value: flow.open ? 'Open' : 'Closed',
|
|
93
|
+
hasIcon:
|
|
94
|
+
flow.direction === undefined ||
|
|
95
|
+
flow.direction === AutomationButtonLabelDirection.none,
|
|
96
|
+
direction: flow.direction,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const direction = flow.direction ?? AutomationButtonLabelDirection.none;
|
|
100
|
+
return {
|
|
101
|
+
type: 'value',
|
|
102
|
+
value: flow.value,
|
|
103
|
+
nDigits: 3,
|
|
104
|
+
unit: flow.unit ?? '%',
|
|
105
|
+
direction,
|
|
106
|
+
icon:
|
|
107
|
+
direction === AutomationButtonLabelDirection.none ? 'none' : 'arrow',
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
}
|