@oicl/openbridge-webcomponents 2.1.0-next.2 → 2.1.0-next.3

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.
@@ -12949,6 +12949,13 @@ __decorate([n$4({ type: Boolean })], ObiTwowayAnalogClosed.prototype, "useCssCol
12949
12949
  ObiTwowayAnalogClosed = __decorate([customElement("obi-twoway-analog-closed")], ObiTwowayAnalogClosed);
12950
12950
  //#endregion
12951
12951
  //#region src/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.ts
12952
+ var OUTLINE = "M11 11L3.5547 6.03645C2.89015 5.59342 2 6.06981 2 6.8685V19.1315C2 19.9302 2.89015 20.4066 3.5547 19.9635L11 15H13L20.4453 19.9635C21.1099 20.4066 22 19.9302 22 19.1315V6.8685C22 6.06981 21.1099 5.59342 20.4453 6.03645L13 11H11ZM3 6.8685L3 19.1315L10.6972 14H13.3028L21 19.1315V6.8685L13.3028 12H10.6972L3 6.8685Z";
12953
+ var BODY = "M10.6972 12H13.3028L21 6.8685V19.1315L13.3028 14H10.6972L3 19.1315V6.8685L10.6972 12Z";
12954
+ /** Width of the shut band at each port end when the opening is 0 %, in icon units. */
12955
+ var BAND_RANGE = 7;
12956
+ var SECONDARY = "fill: var(--automation-device-secondary-color)";
12957
+ var TERTIARY = "fill: var(--automation-device-tertiary-color)";
12958
+ var PRIMARY = "fill: var(--automation-device-primary-color)";
12952
12959
  var ObcValveAnalogTwoWayIcon = class ObcValveAnalogTwoWayIcon extends i$4 {
12953
12960
  constructor(..._args) {
12954
12961
  super(..._args);
@@ -12956,21 +12963,37 @@ var ObcValveAnalogTwoWayIcon = class ObcValveAnalogTwoWayIcon extends i$4 {
12956
12963
  this.closed = false;
12957
12964
  this.vertical = false;
12958
12965
  }
12966
+ renderBands(width) {
12967
+ if (width <= 0) return null;
12968
+ const left = 3 + width;
12969
+ const right = 21 - width;
12970
+ return w`<g clip-path="url(#body)">
12971
+ <rect x="2" y="0" width=${left - 2} height="24" style=${SECONDARY}/>
12972
+ <rect x=${left} y="0" width="1" height="24" style=${TERTIARY}/>
12973
+ <rect x=${right} y="0" width=${22 - right} height="24" style=${SECONDARY}/>
12974
+ <rect x=${right - 1} y="0" width="1" height="24" style=${TERTIARY}/>
12975
+ </g>`;
12976
+ }
12977
+ /**
12978
+ * Horizontal at the top when open, turning to vertical and moving 2 units
12979
+ * down as the valve shuts, matching `obi-twoway-analog-open` at 100 %.
12980
+ */
12981
+ renderHandle(value) {
12982
+ const shut = 1 - value / 100;
12983
+ const angle = -90 * shut;
12984
+ const cx = 12;
12985
+ const cy = 3.5 + 2 * shut;
12986
+ return w`<g transform="rotate(${angle} ${cx} ${cy})">
12987
+ <rect x=${8} y=${cy - 1.5} width="8" height="3" rx="1.5" style=${TERTIARY}/>
12988
+ <rect x=${9} y=${cy - .5} width="6" height="1" rx="0.5" style=${PRIMARY}/>
12989
+ </g>`;
12990
+ }
12959
12991
  render() {
12960
12992
  const transform = this.vertical ? "transform: rotate(90deg);" : "";
12961
12993
  if (this.closed) return b` <div class="wrapper" style="${transform}">
12962
12994
  <obi-twoway-analog-closed useCssColor> </obi-twoway-analog-closed>
12963
12995
  </div>`;
12964
- const handleRotation = -(1 - this.value / 100) * 90;
12965
- const handle = w`
12966
- <g transform="translate(0, ${(1 - this.value / 100) * 2}) rotate(${handleRotation} 12 3.5) ">
12967
- <path fill-rule="evenodd" clip-rule="evenodd" d="M9.5 5H14.5C15.3284 5 16 4.32843 16 3.5C16 2.67157 15.3284 2 14.5 2H9.5C8.67157 2 8 2.67157 8 3.5C8 4.32843 8.67157 5 9.5 5ZM9.5 4L14.5 4C14.7761 4 15 3.77614 15 3.5C15 3.22386 14.7761 3 14.5 3L9.5 3C9.22386 3 9 3.22386 9 3.5C9 3.77614 9.22386 4 9.5 4Z" fill="var(--automation-device-tertiary-color)"/>
12968
- <path d="M9.5 4L14.5 4C14.7761 4 15 3.77614 15 3.5C15 3.22386 14.7761 3 14.5 3L9.5 3C9.22386 3 9 3.22386 9 3.5C9 3.77614 9.22386 4 9.5 4Z" fill="var(--automation-device-primary-color)"/>
12969
- </g>
12970
- `;
12971
- const xmin = 10.5;
12972
- const xmax = 2.5;
12973
- const x = xmin + -8 * this.value / 100;
12996
+ const value = clampPercent$1(this.value);
12974
12997
  return b`
12975
12998
  <div class="wrapper" style="${transform}">
12976
12999
  <svg
@@ -12980,55 +13003,13 @@ var ObcValveAnalogTwoWayIcon = class ObcValveAnalogTwoWayIcon extends i$4 {
12980
13003
  fill="none"
12981
13004
  xmlns="http://www.w3.org/2000/svg"
12982
13005
  >
12983
- <path
12984
- d="M11 11L3.5547 6.03645C2.89015 5.59342 2 6.06981 2 6.8685V19.1315C2 19.9302 2.89015 20.4066 3.5547 19.9635L11 15H13L20.4453 19.9635C21.1099 20.4066 22 19.9302 22 19.1315V6.8685C22 6.06981 21.1099 5.59342 20.4453 6.03645L13 11H11ZM3 6.8685L3 19.1315L10.6972 14H13.3028L21 19.1315V6.8685L13.3028 12H10.6972L3 6.8685Z"
12985
- fill="var(--automation-device-tertiary-color)"
12986
- />
12987
- <path
12988
- d="M10.6972 12H13.3028L21 6.8685V19.1315L13.3028 14H10.6972L3 19.1315V6.8685L10.6972 12Z"
12989
- fill="var(--automation-device-primary-color)"
12990
- />
12991
- ${handle}
12992
- <g clip-path="url(#clip0)">
12993
- <rect
12994
- x=${xmax}
12995
- y="0"
12996
- width=${x - xmax}
12997
- height="24"
12998
- fill="var(--automation-device-secondary-color)"
12999
- />
13000
- <line
13001
- x1=${x}
13002
- y1="0"
13003
- x2=${x}
13004
- y2="24"
13005
- stroke="var(--automation-device-tertiary-color)"
13006
- stroke-width="1"
13007
- />
13008
-
13009
- <rect
13010
- x=${24 - x}
13011
- y="0"
13012
- width=${x - xmax}
13013
- height="24"
13014
- fill="var(--automation-device-secondary-color)"
13015
- />
13016
- <line
13017
- x1=${24 - x}
13018
- y1="0"
13019
- x2=${24 - x}
13020
- y2="24"
13021
- stroke="var(--automation-device-tertiary-color)"
13022
- stroke-width="1"
13023
- />
13024
- </g>
13025
13006
  <defs>
13026
- <clipPath id="clip0">
13027
- <path
13028
- d="M10.6972 12H13.3028L21 6.8685V19.1315L13.3028 14H10.6972L3 19.1315V6.8685L10.6972 12Z"
13029
- />
13030
- </clipPath>
13007
+ <clipPath id="body"><path d=${BODY} /></clipPath>
13031
13008
  </defs>
13009
+ <path d=${OUTLINE} style=${TERTIARY} />
13010
+ <path d=${BODY} style=${PRIMARY} />
13011
+ ${this.renderBands(BAND_RANGE * (100 - value) / 100)}
13012
+ ${this.renderHandle(value)}
13032
13013
  </svg>
13033
13014
  </div>
13034
13015
  `;