@oicl/openbridge-webcomponents-full-bundle 2.1.0-next.2 → 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.
Files changed (40) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +726 -504
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +2035 -720
  4. package/dist/automation/analog-threeway-valve/analog-threeway-valve.d.ts +76 -0
  5. package/dist/automation/analog-threeway-valve/analog-threeway-valve.d.ts.map +1 -0
  6. package/dist/automation/analog-threeway-valve/analog-threeway-valve.js +61 -0
  7. package/dist/automation/analog-threeway-valve/analog-threeway-valve.js.map +1 -0
  8. package/dist/automation/analog-valve/analog-valve.js +1 -1
  9. package/dist/automation/digital-threeway-valve/digital-threeway-valve.d.ts +82 -0
  10. package/dist/automation/digital-threeway-valve/digital-threeway-valve.d.ts.map +1 -0
  11. package/dist/automation/digital-threeway-valve/digital-threeway-valve.js +90 -0
  12. package/dist/automation/digital-threeway-valve/digital-threeway-valve.js.map +1 -0
  13. package/dist/automation/threeway-valve-shared/threeway-valve-shared.d.ts +39 -0
  14. package/dist/automation/threeway-valve-shared/threeway-valve-shared.d.ts.map +1 -0
  15. package/dist/automation/threeway-valve-shared/threeway-valve-shared.js +80 -0
  16. package/dist/automation/threeway-valve-shared/threeway-valve-shared.js.map +1 -0
  17. package/dist/automation/valve-analog-three-way-icon/valve-analog-three-way-icon.d.ts +65 -4
  18. package/dist/automation/valve-analog-three-way-icon/valve-analog-three-way-icon.d.ts.map +1 -1
  19. package/dist/automation/valve-analog-three-way-icon/valve-analog-three-way-icon.js +153 -111
  20. package/dist/automation/valve-analog-three-way-icon/valve-analog-three-way-icon.js.map +1 -1
  21. package/dist/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.d.ts +21 -0
  22. package/dist/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.d.ts.map +1 -1
  23. package/dist/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.js +39 -58
  24. package/dist/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.js.map +1 -1
  25. package/dist/components/automation-button-readout-stack/automation-button-readout-stack.d.ts +3 -0
  26. package/dist/components/automation-button-readout-stack/automation-button-readout-stack.d.ts.map +1 -1
  27. package/dist/components/automation-button-readout-stack/automation-button-readout-stack.js +17 -10
  28. package/dist/components/automation-button-readout-stack/automation-button-readout-stack.js.map +1 -1
  29. package/package.json +1 -1
  30. package/src/automation/analog-threeway-valve/analog-threeway-valve.stories.ts +106 -0
  31. package/src/automation/analog-threeway-valve/analog-threeway-valve.ts +105 -0
  32. package/src/automation/digital-threeway-valve/digital-threeway-valve.stories.ts +122 -0
  33. package/src/automation/digital-threeway-valve/digital-threeway-valve.ts +143 -0
  34. package/src/automation/threeway-valve-shared/threeway-valve-shared.ts +110 -0
  35. package/src/automation/valve-analog-three-way-icon/valve-analog-three-way-icon.stories.ts +145 -37
  36. package/src/automation/valve-analog-three-way-icon/valve-analog-three-way-icon.ts +225 -126
  37. package/src/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.stories.ts +63 -0
  38. package/src/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.ts +58 -60
  39. package/src/components/automation-button-readout-stack/automation-button-readout-stack.stories.ts +13 -0
  40. package/src/components/automation-button-readout-stack/automation-button-readout-stack.ts +31 -16
@@ -80,26 +80,31 @@ var ObcAutomationButtonReadoutStack = class ObcAutomationButtonReadoutStack exte
80
80
  .hintedZeros=${format.hintedZeros ?? false}
81
81
  ></obc-readout-block>`;
82
82
  }
83
- renderValue(readout) {
84
- let directionIcon = nothing;
85
- if (readout.icon == "arrow") {
86
- if (readout.direction == "up") directionIcon = html`<obi-arrow-up-google
83
+ renderArrow(direction) {
84
+ switch (direction) {
85
+ case "up": return html`<obi-arrow-up-google
87
86
  class="icon"
88
87
  useCssColor
89
88
  ></obi-arrow-up-google>`;
90
- else if (readout.direction == "down") directionIcon = html`<obi-arrow-down-google
89
+ case "down": return html`<obi-arrow-down-google
91
90
  class="icon"
92
91
  useCssColor
93
92
  ></obi-arrow-down-google>`;
94
- else if (readout.direction == "left") directionIcon = html`<obi-arrow-left-google
93
+ case "left": return html`<obi-arrow-left-google
95
94
  class="icon"
96
95
  useCssColor
97
96
  ></obi-arrow-left-google>`;
98
- else if (readout.direction == "right") directionIcon = html`<obi-arrow-right-google
97
+ case "right": return html`<obi-arrow-right-google
99
98
  class="icon"
100
99
  useCssColor
101
100
  ></obi-arrow-right-google>`;
102
- } else if (readout.icon == "chevron") {
101
+ default: return nothing;
102
+ }
103
+ }
104
+ renderValue(readout) {
105
+ let directionIcon = nothing;
106
+ if (readout.icon == "arrow") directionIcon = this.renderArrow(readout.direction);
107
+ else if (readout.icon == "chevron") {
103
108
  if (readout.direction == "up") directionIcon = html`<obi-chevron-double-up-google
104
109
  class="icon"
105
110
  useCssColor
@@ -145,13 +150,15 @@ var ObcAutomationButtonReadoutStack = class ObcAutomationButtonReadoutStack exte
145
150
  }
146
151
  renderStateOff(readout) {
147
152
  let offIcon = html``;
148
- if (readout.hasIcon) offIcon = html`<obi-off class="icon" useCssColor></obi-off>`;
153
+ if (readout.direction && readout.direction !== "none") offIcon = this.renderArrow(readout.direction);
154
+ else if (readout.hasIcon) offIcon = html`<obi-off class="icon" useCssColor></obi-off>`;
149
155
  const content = this.renderValueText(readout.value);
150
156
  return this.renderValueContainer("state-off", offIcon, content);
151
157
  }
152
158
  renderStateOn(readout) {
153
159
  let onIcon = html``;
154
- if (readout.hasIcon) onIcon = html`<obi-on class="icon" useCssColor></obi-on>`;
160
+ if (readout.direction && readout.direction !== "none") onIcon = this.renderArrow(readout.direction);
161
+ else if (readout.hasIcon) onIcon = html`<obi-on class="icon" useCssColor></obi-on>`;
155
162
  const content = this.renderValueText(readout.value);
156
163
  return this.renderValueContainer("state-on", onIcon, content);
157
164
  }
@@ -1 +1 @@
1
- {"version":3,"file":"automation-button-readout-stack.js","names":[],"sources":["../../../src/components/automation-button-readout-stack/automation-button-readout-stack.ts"],"sourcesContent":["import {HTMLTemplateResult, LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {customElement} from '../../decorator.js';\nimport compentStyle from './automation-button-readout-stack.css?inline';\nimport {property} from 'lit/decorators.js';\nimport '../../icons/icon-arrow-up-google.js';\nimport '../../icons/icon-arrow-down-google.js';\nimport '../../icons/icon-arrow-left-google.js';\nimport '../../icons/icon-arrow-right-google.js';\nimport '../../icons/icon-chevron-double-up-google.js';\nimport '../../icons/icon-chevron-double-down-google.js';\nimport '../../icons/icon-chevron-double-left-google.js';\nimport '../../icons/icon-chevron-double-right-google.js';\nimport '../../icons/icon-off.js';\nimport '../../icons/icon-on.js';\nimport '../../icons/icon-temperature-air.js';\nimport '../button/button.js';\nimport '../../building-blocks/readout-block/readout-block.js';\nimport {ReadoutBlockSize} from '../../building-blocks/readout-block/readout-block.js';\nimport {ObcTextboxSize} from '../../components/textbox/textbox.js';\nimport {SETPOINT_PATH_FILLED} from '../../svghelpers/setpoint.js';\n\nexport enum AutomationButtonReadoutStackSize {\n small = 'small',\n regular = 'regular',\n enhanced = 'enhanced',\n}\n\nexport enum IdTagOrientation {\n top = 'top',\n bottom = 'bottom',\n}\n\n// The stack's three tiers map onto the readout block's: `small` is the block's\n// small tier at xs number typography, `regular` the small tier at its default\n// s, `enhanced` the large tier. The block's cap-height boxes (16 / 20 / 32)\n// match the tiers' former line-heights.\nconst blockSizeBySize: Record<\n AutomationButtonReadoutStackSize,\n ReadoutBlockSize\n> = {\n [AutomationButtonReadoutStackSize.small]: ReadoutBlockSize.small,\n [AutomationButtonReadoutStackSize.regular]: ReadoutBlockSize.small,\n [AutomationButtonReadoutStackSize.enhanced]: ReadoutBlockSize.large,\n};\n\nconst valueSizeBySize: Record<\n AutomationButtonReadoutStackSize,\n ObcTextboxSize\n> = {\n [AutomationButtonReadoutStackSize.small]: ObcTextboxSize.xs,\n [AutomationButtonReadoutStackSize.regular]: ObcTextboxSize.s,\n [AutomationButtonReadoutStackSize.enhanced]: ObcTextboxSize.l,\n};\n\nexport interface AutomationButtonReadoutStackValue {\n type: 'value';\n value: number;\n nDigits: number;\n unit: string;\n direction: 'up' | 'down' | 'left' | 'right' | 'none';\n icon: 'none' | 'arrow' | 'chevron' | 'slot';\n /**\n * Host slot the row's icon is projected from when `icon` is `'slot'` —\n * consumers place any icon element with this slot name in the stack's\n * light DOM (e.g. a device-specific `<obi-*>` icon).\n */\n slotName?: string;\n}\n\nexport interface AutomationButtonReadoutStackStateOn {\n type: 'state-on';\n value: string;\n hasIcon: boolean;\n}\n\nexport interface AutomationButtonReadoutStackStateOff {\n type: 'state-off';\n value: string;\n hasIcon: boolean;\n}\n\nexport interface AutomationButtonReadoutStackButton {\n type: 'button';\n value: number;\n hasIcon: boolean;\n unit: string;\n}\n\nexport interface AutomationButtonReadoutStackSetpoint {\n type: 'setpoint';\n value: number;\n nDigits: number;\n unit?: string;\n}\n\nexport type AutomationButtonReadoutStack =\n | AutomationButtonReadoutStackValue\n | AutomationButtonReadoutStackStateOn\n | AutomationButtonReadoutStackStateOff\n | AutomationButtonReadoutStackButton\n | AutomationButtonReadoutStackSetpoint;\n\n/**\n * A value row with `icon: 'slot'` projects its icon from the host slot named\n * by its `slotName` — a dynamic slot name, so it carries no `@slot` tag (the\n * wrapper generator needs literal names).\n *\n * @property readouts - Rows rendered top-to-bottom: `value` (padded digits, unit,\n * optional direction icon), `state-on`/`state-off`, `button`, and `setpoint`\n * (shared setpoint glyph + padded digits).\n * @property tag - Identifier line (e.g. '#0001'); `null` hides it.\n * @property size - Typography tier of the rows (small / regular / enhanced).\n * @property idTagOrientation - Whether the tag renders above or below the rows.\n * @experimental\n */\n@customElement('obc-automation-button-readout-stack')\nexport class ObcAutomationButtonReadoutStack extends LitElement {\n @property({type: Array, attribute: false})\n readouts: AutomationButtonReadoutStack[] = [];\n @property({type: String}) tag: string | null = null;\n @property() size: AutomationButtonReadoutStackSize =\n AutomationButtonReadoutStackSize.regular;\n @property() idTagOrientation: IdTagOrientation = IdTagOrientation.top;\n\n renderTag(): typeof nothing | HTMLTemplateResult {\n if (this.tag === null) return nothing;\n\n return html`<div class=\"tag\">${this.tag}</div>`;\n }\n\n private renderValueContainer(\n type: string,\n icon: HTMLTemplateResult | typeof nothing,\n content: HTMLTemplateResult\n ): HTMLTemplateResult {\n return html`<div class=\"readout-item ${type}\">\n ${icon}\n <div class=\"value-container\">\n <div class=\"label-container\">${content}</div>\n </div>\n </div>`;\n }\n\n private renderValueText(text: string): HTMLTemplateResult {\n return html`<span class=\"value-text\">${text}</span>`;\n }\n\n /**\n * A numeric segment on `obc-readout-block` — the block owns the formatting:\n * hinted zeros fill the integer part to `maxDigits`, the sign is prepended\n * without consuming a zero (`-005`), and an unavailable value renders the\n * family's dash placeholder.\n */\n private renderNumber(\n value: number,\n format: {maxDigits?: number; fractionDigits?: number; hintedZeros?: boolean}\n ): HTMLTemplateResult {\n return html`<obc-readout-block\n class=\"number\"\n .value=${value}\n .size=${blockSizeBySize[this.size]}\n .valueSize=${valueSizeBySize[this.size]}\n .maxDigits=${format.maxDigits ?? 0}\n .fractionDigits=${format.fractionDigits ?? 0}\n .hintedZeros=${format.hintedZeros ?? false}\n ></obc-readout-block>`;\n }\n\n renderValue(readout: AutomationButtonReadoutStackValue): HTMLTemplateResult {\n let directionIcon: HTMLTemplateResult | typeof nothing = nothing;\n if (readout.icon == 'arrow') {\n if (readout.direction == 'up') {\n directionIcon = html`<obi-arrow-up-google\n class=\"icon\"\n useCssColor\n ></obi-arrow-up-google>`;\n } else if (readout.direction == 'down') {\n directionIcon = html`<obi-arrow-down-google\n class=\"icon\"\n useCssColor\n ></obi-arrow-down-google>`;\n } else if (readout.direction == 'left') {\n directionIcon = html`<obi-arrow-left-google\n class=\"icon\"\n useCssColor\n ></obi-arrow-left-google>`;\n } else if (readout.direction == 'right') {\n directionIcon = html`<obi-arrow-right-google\n class=\"icon\"\n useCssColor\n ></obi-arrow-right-google>`;\n }\n } else if (readout.icon == 'chevron') {\n if (readout.direction == 'up') {\n directionIcon = html`<obi-chevron-double-up-google\n class=\"icon\"\n useCssColor\n ></obi-chevron-double-up-google>`;\n } else if (readout.direction == 'down') {\n directionIcon = html`<obi-chevron-double-down-google\n class=\"icon\"\n useCssColor\n ></obi-chevron-double-down-google>`;\n } else if (readout.direction == 'left') {\n directionIcon = html`<obi-chevron-double-left-google\n class=\"icon\"\n useCssColor\n ></obi-chevron-double-left-google>`;\n } else if (readout.direction == 'right') {\n directionIcon = html`<obi-chevron-double-right-google\n class=\"icon\"\n useCssColor\n ></obi-chevron-double-right-google>`;\n }\n } else if (readout.icon == 'slot' && readout.slotName) {\n directionIcon = html`<slot class=\"icon\" name=${readout.slotName}></slot>`;\n }\n const content = html`\n ${this.renderNumber(readout.value, {\n maxDigits: readout.nDigits,\n hintedZeros: true,\n })}\n <span class=\"unit\">${readout.unit}</span>\n `;\n\n return this.renderValueContainer('value', directionIcon, content);\n }\n\n renderSetpoint(\n readout: AutomationButtonReadoutStackSetpoint\n ): HTMLTemplateResult {\n const glyph = html`<svg\n class=\"setpoint-glyph\"\n viewBox=\"2.5 -2.5 21 26\"\n aria-hidden=\"true\"\n >\n <path d=${SETPOINT_PATH_FILLED} transform=\"rotate(-90 13 10.5)\" />\n </svg>`;\n const content = html`\n ${this.renderNumber(readout.value, {\n maxDigits: readout.nDigits,\n hintedZeros: true,\n })}\n ${\n readout.unit ? html`<span class=\"unit\">${readout.unit}</span>` : nothing\n }\n `;\n return this.renderValueContainer('setpoint', glyph, content);\n }\n\n renderStateOff(\n readout: AutomationButtonReadoutStackStateOff\n ): HTMLTemplateResult {\n let offIcon: HTMLTemplateResult = html``;\n if (readout.hasIcon) {\n offIcon = html`<obi-off class=\"icon\" useCssColor></obi-off>`;\n }\n\n const content = this.renderValueText(readout.value);\n return this.renderValueContainer('state-off', offIcon, content);\n }\n\n renderStateOn(\n readout: AutomationButtonReadoutStackStateOn\n ): HTMLTemplateResult {\n let onIcon: HTMLTemplateResult = html``;\n if (readout.hasIcon) {\n onIcon = html`<obi-on class=\"icon\" useCssColor></obi-on>`;\n }\n\n const content = this.renderValueText(readout.value);\n return this.renderValueContainer('state-on', onIcon, content);\n }\n\n renderButton(\n readout: AutomationButtonReadoutStackButton\n ): HTMLTemplateResult {\n let temperatureIcon: HTMLTemplateResult = html``;\n if (readout.hasIcon) {\n temperatureIcon = html`<obi-temperature-air\n class=\"icon\"\n useCssColor\n ></obi-temperature-air>`;\n }\n\n const content = html`\n ${this.renderNumber(readout.value, {fractionDigits: 1})}\n <span class=\"unit\">${readout.unit}</span>\n `;\n\n return html`<obc-button class=\"readout-button\" part=\"readout-button\">\n ${this.renderValueContainer('button', temperatureIcon, content)}\n </obc-button>`;\n }\n\n renderReadout(readout: AutomationButtonReadoutStack): HTMLTemplateResult {\n if (readout.type === 'value') {\n return this.renderValue(readout);\n } else if (readout.type === 'state-on') {\n return this.renderStateOn(readout);\n } else if (readout.type === 'state-off') {\n return this.renderStateOff(readout);\n } else if (readout.type === 'button') {\n return this.renderButton(readout);\n } else if (readout.type === 'setpoint') {\n return this.renderSetpoint(readout);\n } else {\n throw new Error('Invalid readout type');\n }\n }\n\n override render() {\n const displayableReadouts = this.readouts.filter(\n (readout) =>\n readout.type === 'value' ||\n readout.type === 'state-off' ||\n readout.type === 'state-on' ||\n readout.type === 'button' ||\n readout.type === 'setpoint'\n );\n\n const renderedReadouts = displayableReadouts.map((r) =>\n this.renderReadout(r)\n );\n const tag = this.renderTag();\n const elements: unknown[] = [];\n\n if (this.idTagOrientation === IdTagOrientation.top) {\n elements.push(tag);\n elements.push(...renderedReadouts);\n } else {\n elements.push(...renderedReadouts);\n elements.push(tag);\n }\n\n return html`<div class=\"readout-stack ${this.size}\">${elements}</div>`;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-automation-button-readout-stack': ObcAutomationButtonReadoutStack;\n }\n}\n"],"mappings":";;;;;;;;;;;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,SAAS,CAAA,GAAA,gCAAA,WAAA,QAAA,KAAA,CAAA;AAET,WAAA,CAAA,SAAS,CAAA,GAAA,gCAAA,WAAA,oBAAA,KAAA,CAAA;AAPX,kCAAA,WAAA,CAAA,cAAc,qCAAqC,CAAA,GAAA,+BAAA"}
1
+ {"version":3,"file":"automation-button-readout-stack.js","names":[],"sources":["../../../src/components/automation-button-readout-stack/automation-button-readout-stack.ts"],"sourcesContent":["import {HTMLTemplateResult, LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {customElement} from '../../decorator.js';\nimport compentStyle from './automation-button-readout-stack.css?inline';\nimport {property} from 'lit/decorators.js';\nimport '../../icons/icon-arrow-up-google.js';\nimport '../../icons/icon-arrow-down-google.js';\nimport '../../icons/icon-arrow-left-google.js';\nimport '../../icons/icon-arrow-right-google.js';\nimport '../../icons/icon-chevron-double-up-google.js';\nimport '../../icons/icon-chevron-double-down-google.js';\nimport '../../icons/icon-chevron-double-left-google.js';\nimport '../../icons/icon-chevron-double-right-google.js';\nimport '../../icons/icon-off.js';\nimport '../../icons/icon-on.js';\nimport '../../icons/icon-temperature-air.js';\nimport '../button/button.js';\nimport '../../building-blocks/readout-block/readout-block.js';\nimport {ReadoutBlockSize} from '../../building-blocks/readout-block/readout-block.js';\nimport {ObcTextboxSize} from '../../components/textbox/textbox.js';\nimport {SETPOINT_PATH_FILLED} from '../../svghelpers/setpoint.js';\n\nexport enum AutomationButtonReadoutStackSize {\n small = 'small',\n regular = 'regular',\n enhanced = 'enhanced',\n}\n\nexport enum IdTagOrientation {\n top = 'top',\n bottom = 'bottom',\n}\n\n// The stack's three tiers map onto the readout block's: `small` is the block's\n// small tier at xs number typography, `regular` the small tier at its default\n// s, `enhanced` the large tier. The block's cap-height boxes (16 / 20 / 32)\n// match the tiers' former line-heights.\nconst blockSizeBySize: Record<\n AutomationButtonReadoutStackSize,\n ReadoutBlockSize\n> = {\n [AutomationButtonReadoutStackSize.small]: ReadoutBlockSize.small,\n [AutomationButtonReadoutStackSize.regular]: ReadoutBlockSize.small,\n [AutomationButtonReadoutStackSize.enhanced]: ReadoutBlockSize.large,\n};\n\nconst valueSizeBySize: Record<\n AutomationButtonReadoutStackSize,\n ObcTextboxSize\n> = {\n [AutomationButtonReadoutStackSize.small]: ObcTextboxSize.xs,\n [AutomationButtonReadoutStackSize.regular]: ObcTextboxSize.s,\n [AutomationButtonReadoutStackSize.enhanced]: ObcTextboxSize.l,\n};\n\nexport interface AutomationButtonReadoutStackValue {\n type: 'value';\n value: number;\n nDigits: number;\n unit: string;\n direction: 'up' | 'down' | 'left' | 'right' | 'none';\n icon: 'none' | 'arrow' | 'chevron' | 'slot';\n /**\n * Host slot the row's icon is projected from when `icon` is `'slot'` —\n * consumers place any icon element with this slot name in the stack's\n * light DOM (e.g. a device-specific `<obi-*>` icon).\n */\n slotName?: string;\n}\n\nexport interface AutomationButtonReadoutStackStateOn {\n type: 'state-on';\n value: string;\n hasIcon: boolean;\n direction?: 'up' | 'down' | 'left' | 'right' | 'none';\n}\n\nexport interface AutomationButtonReadoutStackStateOff {\n type: 'state-off';\n value: string;\n hasIcon: boolean;\n direction?: 'up' | 'down' | 'left' | 'right' | 'none';\n}\n\nexport interface AutomationButtonReadoutStackButton {\n type: 'button';\n value: number;\n hasIcon: boolean;\n unit: string;\n}\n\nexport interface AutomationButtonReadoutStackSetpoint {\n type: 'setpoint';\n value: number;\n nDigits: number;\n unit?: string;\n}\n\nexport type AutomationButtonReadoutStack =\n | AutomationButtonReadoutStackValue\n | AutomationButtonReadoutStackStateOn\n | AutomationButtonReadoutStackStateOff\n | AutomationButtonReadoutStackButton\n | AutomationButtonReadoutStackSetpoint;\n\n/**\n * A value row with `icon: 'slot'` projects its icon from the host slot named\n * by its `slotName` — a dynamic slot name, so it carries no `@slot` tag (the\n * wrapper generator needs literal names).\n *\n * @property readouts - Rows rendered top-to-bottom: `value` (padded digits, unit,\n * optional direction icon), `state-on`/`state-off`, `button`, and `setpoint`\n * (shared setpoint glyph + padded digits).\n * @property tag - Identifier line (e.g. '#0001'); `null` hides it.\n * @property size - Typography tier of the rows (small / regular / enhanced).\n * @property idTagOrientation - Whether the tag renders above or below the rows.\n * @experimental\n */\n@customElement('obc-automation-button-readout-stack')\nexport class ObcAutomationButtonReadoutStack extends LitElement {\n @property({type: Array, attribute: false})\n readouts: AutomationButtonReadoutStack[] = [];\n @property({type: String}) tag: string | null = null;\n @property() size: AutomationButtonReadoutStackSize =\n AutomationButtonReadoutStackSize.regular;\n @property() idTagOrientation: IdTagOrientation = IdTagOrientation.top;\n\n renderTag(): typeof nothing | HTMLTemplateResult {\n if (this.tag === null) return nothing;\n\n return html`<div class=\"tag\">${this.tag}</div>`;\n }\n\n private renderValueContainer(\n type: string,\n icon: HTMLTemplateResult | typeof nothing,\n content: HTMLTemplateResult\n ): HTMLTemplateResult {\n return html`<div class=\"readout-item ${type}\">\n ${icon}\n <div class=\"value-container\">\n <div class=\"label-container\">${content}</div>\n </div>\n </div>`;\n }\n\n private renderValueText(text: string): HTMLTemplateResult {\n return html`<span class=\"value-text\">${text}</span>`;\n }\n\n /**\n * A numeric segment on `obc-readout-block` — the block owns the formatting:\n * hinted zeros fill the integer part to `maxDigits`, the sign is prepended\n * without consuming a zero (`-005`), and an unavailable value renders the\n * family's dash placeholder.\n */\n private renderNumber(\n value: number,\n format: {maxDigits?: number; fractionDigits?: number; hintedZeros?: boolean}\n ): HTMLTemplateResult {\n return html`<obc-readout-block\n class=\"number\"\n .value=${value}\n .size=${blockSizeBySize[this.size]}\n .valueSize=${valueSizeBySize[this.size]}\n .maxDigits=${format.maxDigits ?? 0}\n .fractionDigits=${format.fractionDigits ?? 0}\n .hintedZeros=${format.hintedZeros ?? false}\n ></obc-readout-block>`;\n }\n\n private renderArrow(\n direction: 'up' | 'down' | 'left' | 'right' | 'none' | undefined\n ): HTMLTemplateResult | typeof nothing {\n switch (direction) {\n case 'up':\n return html`<obi-arrow-up-google\n class=\"icon\"\n useCssColor\n ></obi-arrow-up-google>`;\n case 'down':\n return html`<obi-arrow-down-google\n class=\"icon\"\n useCssColor\n ></obi-arrow-down-google>`;\n case 'left':\n return html`<obi-arrow-left-google\n class=\"icon\"\n useCssColor\n ></obi-arrow-left-google>`;\n case 'right':\n return html`<obi-arrow-right-google\n class=\"icon\"\n useCssColor\n ></obi-arrow-right-google>`;\n default:\n return nothing;\n }\n }\n\n renderValue(readout: AutomationButtonReadoutStackValue): HTMLTemplateResult {\n let directionIcon: HTMLTemplateResult | typeof nothing = nothing;\n if (readout.icon == 'arrow') {\n directionIcon = this.renderArrow(readout.direction);\n } else if (readout.icon == 'chevron') {\n if (readout.direction == 'up') {\n directionIcon = html`<obi-chevron-double-up-google\n class=\"icon\"\n useCssColor\n ></obi-chevron-double-up-google>`;\n } else if (readout.direction == 'down') {\n directionIcon = html`<obi-chevron-double-down-google\n class=\"icon\"\n useCssColor\n ></obi-chevron-double-down-google>`;\n } else if (readout.direction == 'left') {\n directionIcon = html`<obi-chevron-double-left-google\n class=\"icon\"\n useCssColor\n ></obi-chevron-double-left-google>`;\n } else if (readout.direction == 'right') {\n directionIcon = html`<obi-chevron-double-right-google\n class=\"icon\"\n useCssColor\n ></obi-chevron-double-right-google>`;\n }\n } else if (readout.icon == 'slot' && readout.slotName) {\n directionIcon = html`<slot class=\"icon\" name=${readout.slotName}></slot>`;\n }\n const content = html`\n ${this.renderNumber(readout.value, {\n maxDigits: readout.nDigits,\n hintedZeros: true,\n })}\n <span class=\"unit\">${readout.unit}</span>\n `;\n\n return this.renderValueContainer('value', directionIcon, content);\n }\n\n renderSetpoint(\n readout: AutomationButtonReadoutStackSetpoint\n ): HTMLTemplateResult {\n const glyph = html`<svg\n class=\"setpoint-glyph\"\n viewBox=\"2.5 -2.5 21 26\"\n aria-hidden=\"true\"\n >\n <path d=${SETPOINT_PATH_FILLED} transform=\"rotate(-90 13 10.5)\" />\n </svg>`;\n const content = html`\n ${this.renderNumber(readout.value, {\n maxDigits: readout.nDigits,\n hintedZeros: true,\n })}\n ${\n readout.unit ? html`<span class=\"unit\">${readout.unit}</span>` : nothing\n }\n `;\n return this.renderValueContainer('setpoint', glyph, content);\n }\n\n renderStateOff(\n readout: AutomationButtonReadoutStackStateOff\n ): HTMLTemplateResult {\n let offIcon: HTMLTemplateResult | typeof nothing = html``;\n if (readout.direction && readout.direction !== 'none') {\n offIcon = this.renderArrow(readout.direction);\n } else if (readout.hasIcon) {\n offIcon = html`<obi-off class=\"icon\" useCssColor></obi-off>`;\n }\n\n const content = this.renderValueText(readout.value);\n return this.renderValueContainer('state-off', offIcon, content);\n }\n\n renderStateOn(\n readout: AutomationButtonReadoutStackStateOn\n ): HTMLTemplateResult {\n let onIcon: HTMLTemplateResult | typeof nothing = html``;\n if (readout.direction && readout.direction !== 'none') {\n onIcon = this.renderArrow(readout.direction);\n } else if (readout.hasIcon) {\n onIcon = html`<obi-on class=\"icon\" useCssColor></obi-on>`;\n }\n\n const content = this.renderValueText(readout.value);\n return this.renderValueContainer('state-on', onIcon, content);\n }\n\n renderButton(\n readout: AutomationButtonReadoutStackButton\n ): HTMLTemplateResult {\n let temperatureIcon: HTMLTemplateResult = html``;\n if (readout.hasIcon) {\n temperatureIcon = html`<obi-temperature-air\n class=\"icon\"\n useCssColor\n ></obi-temperature-air>`;\n }\n\n const content = html`\n ${this.renderNumber(readout.value, {fractionDigits: 1})}\n <span class=\"unit\">${readout.unit}</span>\n `;\n\n return html`<obc-button class=\"readout-button\" part=\"readout-button\">\n ${this.renderValueContainer('button', temperatureIcon, content)}\n </obc-button>`;\n }\n\n renderReadout(readout: AutomationButtonReadoutStack): HTMLTemplateResult {\n if (readout.type === 'value') {\n return this.renderValue(readout);\n } else if (readout.type === 'state-on') {\n return this.renderStateOn(readout);\n } else if (readout.type === 'state-off') {\n return this.renderStateOff(readout);\n } else if (readout.type === 'button') {\n return this.renderButton(readout);\n } else if (readout.type === 'setpoint') {\n return this.renderSetpoint(readout);\n } else {\n throw new Error('Invalid readout type');\n }\n }\n\n override render() {\n const displayableReadouts = this.readouts.filter(\n (readout) =>\n readout.type === 'value' ||\n readout.type === 'state-off' ||\n readout.type === 'state-on' ||\n readout.type === 'button' ||\n readout.type === 'setpoint'\n );\n\n const renderedReadouts = displayableReadouts.map((r) =>\n this.renderReadout(r)\n );\n const tag = this.renderTag();\n const elements: unknown[] = [];\n\n if (this.idTagOrientation === IdTagOrientation.top) {\n elements.push(tag);\n elements.push(...renderedReadouts);\n } else {\n elements.push(...renderedReadouts);\n elements.push(tag);\n }\n\n return html`<div class=\"readout-stack ${this.size}\">${elements}</div>`;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-automation-button-readout-stack': ObcAutomationButtonReadoutStack;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,IAAY,mCAAL,yBAAA,kCAAA;CACL,iCAAA,WAAA;CACA,iCAAA,aAAA;CACA,iCAAA,cAAA;;AACF,EAAA,CAAA,CAAA;AAEA,IAAY,mBAAL,yBAAA,kBAAA;CACL,iBAAA,SAAA;CACA,iBAAA,YAAA;;AACF,EAAA,CAAA,CAAA;AAMA,IAAM,kBAGF;EACwC,UAAA,iBAAiB;EACf,YAAA,iBAAiB;EAChB,aAAA,iBAAiB;AAChE;AAEA,IAAM,kBAGF;EACwC,UAAA,eAAe;EACb,YAAA,eAAe;EACd,aAAA,eAAe;AAC9D;AAkEO,IAAM,kCAAN,MAAM,wCAAwC,WAAW;;;EAEnB,KAAA,WAAA,CAAC;EACG,KAAA,MAAA;;;;CAK/C,YAAiD;EAC/C,IAAI,KAAK,QAAQ,MAAM,OAAO;EAE9B,OAAO,IAAI,oBAAoB,KAAK,IAAI;CAC1C;CAEA,qBACE,MACA,MACA,SACoB;EACpB,OAAO,IAAI,4BAA4B,KAAK;QACxC,KAAK;;uCAE0B,QAAQ;;;CAG7C;CAEA,gBAAwB,MAAkC;EACxD,OAAO,IAAI,4BAA4B,KAAK;CAC9C;;;;;;;CAQA,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ACjB,QAAQ,SAAS,eACjB,QAAQ,SAAS,cACjB,QAAQ,SAAS,YACjB,QAAQ,SAAS,UAGI,CAAA,CAAoB,KAAK,MAChD,KAAK,cAAc,CAAC,CACtB;EACA,MAAM,MAAM,KAAK,UAAU;EAC3B,MAAM,WAAsB,CAAC;EAE7B,IAAI,KAAK,qBAAA,OAA2C;GAClD,SAAS,KAAK,GAAG;GACjB,SAAS,KAAK,GAAG,gBAAgB;EACnC,OAAO;GACL,SAAS,KAAK,GAAG,gBAAgB;GACjC,SAAS,KAAK,GAAG;EACnB;EAEA,OAAO,IAAI,6BAA6B,KAAK,KAAK,IAAI,SAAS;CACjE;;EAEyB,KAAA,SAAA,UAAU,uCAAY;;AACjD;AA3OG,WAAA,CAAA,SAAS;CAAC,MAAM;CAAO,WAAW;AAAK,CAAC,CAAA,GAAA,gCAAA,WAAA,YAAA,KAAA,CAAA;AAExC,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,gCAAA,WAAA,OAAA,KAAA,CAAA;AACvB,WAAA,CAAA,SAAS,CAAA,GAAA,gCAAA,WAAA,QAAA,KAAA,CAAA;AAET,WAAA,CAAA,SAAS,CAAA,GAAA,gCAAA,WAAA,oBAAA,KAAA,CAAA;AAPX,kCAAA,WAAA,CAAA,cAAc,qCAAqC,CAAA,GAAA,+BAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oicl/openbridge-webcomponents-full-bundle",
3
- "version": "2.1.0-next.2",
3
+ "version": "2.1.0-next.4",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -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
+ }