@oicl/openbridge-webcomponents 2.1.0-next.1 → 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.
Files changed (59) hide show
  1. package/README.md +1 -0
  2. package/bundle/openbridge-webcomponents.bundle.js +390 -301
  3. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  4. package/custom-elements.json +979 -94
  5. package/dist/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.d.ts +25 -1
  6. package/dist/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.d.ts.map +1 -1
  7. package/dist/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.js +39 -58
  8. package/dist/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.js.map +1 -1
  9. package/dist/building-blocks/alert-list/alert-list-base.d.ts +60 -0
  10. package/dist/building-blocks/alert-list/alert-list-base.d.ts.map +1 -0
  11. package/dist/building-blocks/alert-list/alert-list-base.js +191 -0
  12. package/dist/building-blocks/alert-list/alert-list-base.js.map +1 -0
  13. package/dist/building-blocks/alert-list/alert-list.css.js.map +1 -1
  14. package/dist/building-blocks/alert-list/alert-list.d.ts +13 -26
  15. package/dist/building-blocks/alert-list/alert-list.d.ts.map +1 -1
  16. package/dist/building-blocks/alert-list/alert-list.js +7 -142
  17. package/dist/building-blocks/alert-list/alert-list.js.map +1 -1
  18. package/dist/components/alert-icon/alert-icon.d.ts.map +1 -1
  19. package/dist/components/alert-icon/alert-icon.js +6 -5
  20. package/dist/components/alert-icon/alert-icon.js.map +1 -1
  21. package/dist/components/alert-list-details/alert-list-details.css.js +4 -1
  22. package/dist/components/alert-list-details/alert-list-details.css.js.map +1 -1
  23. package/dist/components/alert-menu/alert-menu.css.js +3 -42
  24. package/dist/components/alert-menu/alert-menu.css.js.map +1 -1
  25. package/dist/components/alert-menu/alert-menu.d.ts +28 -6
  26. package/dist/components/alert-menu/alert-menu.d.ts.map +1 -1
  27. package/dist/components/alert-menu/alert-menu.js +81 -60
  28. package/dist/components/alert-menu/alert-menu.js.map +1 -1
  29. package/dist/components/alert-menu-item/alert-menu-item.d.ts +16 -6
  30. package/dist/components/alert-menu-item/alert-menu-item.d.ts.map +1 -1
  31. package/dist/components/alert-menu-item/alert-menu-item.js +11 -2
  32. package/dist/components/alert-menu-item/alert-menu-item.js.map +1 -1
  33. package/dist/components/number-input-field/number-input-field.css.js +8 -2
  34. package/dist/components/number-input-field/number-input-field.css.js.map +1 -1
  35. package/dist/components/number-input-field/number-input-field.d.ts +15 -1
  36. package/dist/components/number-input-field/number-input-field.d.ts.map +1 -1
  37. package/dist/components/number-input-field/number-input-field.js +38 -44
  38. package/dist/components/number-input-field/number-input-field.js.map +1 -1
  39. package/dist/components/textbox/textbox.css.js +3 -9
  40. package/dist/components/textbox/textbox.css.js.map +1 -1
  41. package/dist/components/textbox/textbox.d.ts +3 -0
  42. package/dist/components/textbox/textbox.d.ts.map +1 -1
  43. package/dist/components/textbox/textbox.js.map +1 -1
  44. package/dist/generated/locales/es-419.d.ts +1 -1
  45. package/dist/generated/locales/es-419.js +1 -1
  46. package/dist/generated/locales/es-419.js.map +1 -1
  47. package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js +2 -1
  48. package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js.map +1 -1
  49. package/dist/pages/alert-detail-page/alert-detail-page.js +1 -1
  50. package/dist/pages/alert-detail-page/alert-detail-page.js.map +1 -1
  51. package/dist/pages/alert-list-page-small/alert-list-page-small-base.d.ts +63 -0
  52. package/dist/pages/alert-list-page-small/alert-list-page-small-base.d.ts.map +1 -0
  53. package/dist/pages/alert-list-page-small/alert-list-page-small-base.js +126 -0
  54. package/dist/pages/alert-list-page-small/alert-list-page-small-base.js.map +1 -0
  55. package/dist/pages/alert-list-page-small/alert-list-page-small.d.ts +12 -15
  56. package/dist/pages/alert-list-page-small/alert-list-page-small.d.ts.map +1 -1
  57. package/dist/pages/alert-list-page-small/alert-list-page-small.js +41 -92
  58. package/dist/pages/alert-list-page-small/alert-list-page-small.js.map +1 -1
  59. package/package.json +1 -1
@@ -1,14 +1,38 @@
1
1
  import { LitElement } from 'lit';
2
2
  import '../../icons/icon-twoway-analog-closed.js';
3
3
  /**
4
+ * Two-way analog valve symbol whose opening moves continuously from 0 to
5
+ * 100 %.
6
+ *
7
+ * Draws the same symbol as the `obi-twoway-analog-*` icons. The shut bands at
8
+ * the port ends and the handle are linear in the opening: exact at 100 %
9
+ * (`obi-twoway-analog-open`) and at 0 % (vertical handle, ports shut to the
10
+ * centre), and close to the icons' 10/25/50/75 % steps in between. Used as
11
+ * the icon of `obc-analog-valve`.
12
+ *
13
+ * @property value - Opening in percent (0–100).
4
14
  * @availableWhen value closed==false
15
+ * @property closed - Shows the closed symbol.
16
+ * @property vertical - Turns the symbol 90° for a vertical pipe.
5
17
  * @stable
6
18
  */
7
19
  export declare class ObcValveAnalogTwoWayIcon extends LitElement {
8
- /** Available when `closed==false`. */
20
+ /**
21
+ * Opening in percent (0–100).
22
+ *
23
+ * Available when `closed==false`.
24
+ */
9
25
  value: number;
26
+ /** Shows the closed symbol. */
10
27
  closed: boolean;
28
+ /** Turns the symbol 90° for a vertical pipe. */
11
29
  vertical: boolean;
30
+ private renderBands;
31
+ /**
32
+ * Horizontal at the top when open, turning to vertical and moving 2 units
33
+ * down as the valve shuts, matching `obi-twoway-analog-open` at 100 %.
34
+ */
35
+ private renderHandle;
12
36
  render(): import('lit-html').TemplateResult<1>;
13
37
  static styles: import('lit').CSSResult;
14
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"valve-analog-two-way-icon.d.ts","sourceRoot":"","sources":["../../../src/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAuB,MAAM,KAAK,CAAC;AAIrD,OAAO,0CAA0C,CAAC;AAElD;;;GAGG;AACH,qBACa,wBAAyB,SAAQ,UAAU;IAC5B,KAAK,EAAE,MAAM,CAAK;IACjB,MAAM,EAAE,OAAO,CAAS;IACxB,QAAQ,EAAE,OAAO,CAAS;IAE5C,MAAM;IAoFf,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,+BAA+B,EAAE,wBAAwB,CAAC;KAC3D;CACF"}
1
+ {"version":3,"file":"valve-analog-two-way-icon.d.ts","sourceRoot":"","sources":["../../../src/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAuB,MAAM,KAAK,CAAC;AAKrD,OAAO,0CAA0C,CAAC;AAclD;;;;;;;;;;;;;;;GAeG;AACH,qBACa,wBAAyB,SAAQ,UAAU;IAC5B,KAAK,EAAE,MAAM,CAAK;IACjB,MAAM,EAAE,OAAO,CAAS;IACxB,QAAQ,EAAE,OAAO,CAAS;IAErD,OAAO,CAAC,WAAW;IAYnB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAWX,MAAM;IA8Bf,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,+BAA+B,EAAE,wBAAwB,CAAC;KAC3D;CACF"}
@@ -1,10 +1,18 @@
1
1
  import { customElement } from "../../decorator.js";
2
+ import { clampPercent } from "../../svghelpers/math.js";
2
3
  import __decorate from "../../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/decorate.js";
3
4
  import "../../icons/icon-twoway-analog-closed.js";
4
5
  import valve_analog_two_way_icon_default from "./valve-analog-two-way-icon.css.js";
5
6
  import { LitElement, html, svg, unsafeCSS } from "lit";
6
7
  import { property } from "lit/decorators.js";
7
8
  //#region src/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.ts
9
+ 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";
10
+ var BODY = "M10.6972 12H13.3028L21 6.8685V19.1315L13.3028 14H10.6972L3 19.1315V6.8685L10.6972 12Z";
11
+ /** Width of the shut band at each port end when the opening is 0 %, in icon units. */
12
+ var BAND_RANGE = 7;
13
+ var SECONDARY = "fill: var(--automation-device-secondary-color)";
14
+ var TERTIARY = "fill: var(--automation-device-tertiary-color)";
15
+ var PRIMARY = "fill: var(--automation-device-primary-color)";
8
16
  var ObcValveAnalogTwoWayIcon = class ObcValveAnalogTwoWayIcon extends LitElement {
9
17
  constructor(..._args) {
10
18
  super(..._args);
@@ -12,22 +20,37 @@ var ObcValveAnalogTwoWayIcon = class ObcValveAnalogTwoWayIcon extends LitElement
12
20
  this.closed = false;
13
21
  this.vertical = false;
14
22
  }
23
+ renderBands(width) {
24
+ if (width <= 0) return null;
25
+ const left = 3 + width;
26
+ const right = 21 - width;
27
+ return svg`<g clip-path="url(#body)">
28
+ <rect x="2" y="0" width=${left - 2} height="24" style=${SECONDARY}/>
29
+ <rect x=${left} y="0" width="1" height="24" style=${TERTIARY}/>
30
+ <rect x=${right} y="0" width=${22 - right} height="24" style=${SECONDARY}/>
31
+ <rect x=${right - 1} y="0" width="1" height="24" style=${TERTIARY}/>
32
+ </g>`;
33
+ }
34
+ /**
35
+ * Horizontal at the top when open, turning to vertical and moving 2 units
36
+ * down as the valve shuts, matching `obi-twoway-analog-open` at 100 %.
37
+ */
38
+ renderHandle(value) {
39
+ const shut = 1 - value / 100;
40
+ const angle = -90 * shut;
41
+ const cx = 12;
42
+ const cy = 3.5 + 2 * shut;
43
+ return svg`<g transform="rotate(${angle} ${cx} ${cy})">
44
+ <rect x=${8} y=${cy - 1.5} width="8" height="3" rx="1.5" style=${TERTIARY}/>
45
+ <rect x=${9} y=${cy - .5} width="6" height="1" rx="0.5" style=${PRIMARY}/>
46
+ </g>`;
47
+ }
15
48
  render() {
16
49
  const transform = this.vertical ? "transform: rotate(90deg);" : "";
17
50
  if (this.closed) return html` <div class="wrapper" style="${transform}">
18
51
  <obi-twoway-analog-closed useCssColor> </obi-twoway-analog-closed>
19
52
  </div>`;
20
- const handleRotation = -(1 - this.value / 100) * 90;
21
- const handleTranslation = (1 - this.value / 100) * 2;
22
- const handle = svg`
23
- <g transform="translate(0, ${handleTranslation}) rotate(${handleRotation} 12 3.5) ">
24
- <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)"/>
25
- <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)"/>
26
- </g>
27
- `;
28
- const xmin = 10.5;
29
- const xmax = 2.5;
30
- const x = xmin + -8 * this.value / 100;
53
+ const value = clampPercent(this.value);
31
54
  return html`
32
55
  <div class="wrapper" style="${transform}">
33
56
  <svg
@@ -37,55 +60,13 @@ var ObcValveAnalogTwoWayIcon = class ObcValveAnalogTwoWayIcon extends LitElement
37
60
  fill="none"
38
61
  xmlns="http://www.w3.org/2000/svg"
39
62
  >
40
- <path
41
- 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"
42
- fill="var(--automation-device-tertiary-color)"
43
- />
44
- <path
45
- d="M10.6972 12H13.3028L21 6.8685V19.1315L13.3028 14H10.6972L3 19.1315V6.8685L10.6972 12Z"
46
- fill="var(--automation-device-primary-color)"
47
- />
48
- ${handle}
49
- <g clip-path="url(#clip0)">
50
- <rect
51
- x=${xmax}
52
- y="0"
53
- width=${x - xmax}
54
- height="24"
55
- fill="var(--automation-device-secondary-color)"
56
- />
57
- <line
58
- x1=${x}
59
- y1="0"
60
- x2=${x}
61
- y2="24"
62
- stroke="var(--automation-device-tertiary-color)"
63
- stroke-width="1"
64
- />
65
-
66
- <rect
67
- x=${24 - x}
68
- y="0"
69
- width=${x - xmax}
70
- height="24"
71
- fill="var(--automation-device-secondary-color)"
72
- />
73
- <line
74
- x1=${24 - x}
75
- y1="0"
76
- x2=${24 - x}
77
- y2="24"
78
- stroke="var(--automation-device-tertiary-color)"
79
- stroke-width="1"
80
- />
81
- </g>
82
63
  <defs>
83
- <clipPath id="clip0">
84
- <path
85
- d="M10.6972 12H13.3028L21 6.8685V19.1315L13.3028 14H10.6972L3 19.1315V6.8685L10.6972 12Z"
86
- />
87
- </clipPath>
64
+ <clipPath id="body"><path d=${BODY} /></clipPath>
88
65
  </defs>
66
+ <path d=${OUTLINE} style=${TERTIARY} />
67
+ <path d=${BODY} style=${PRIMARY} />
68
+ ${this.renderBands(BAND_RANGE * (100 - value) / 100)}
69
+ ${this.renderHandle(value)}
89
70
  </svg>
90
71
  </div>
91
72
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"valve-analog-two-way-icon.js","names":[],"sources":["../../../src/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.ts"],"sourcesContent":["import {LitElement, html, svg, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport compentStyle from './valve-analog-two-way-icon.css?inline';\nimport {customElement} from '../../decorator.js';\nimport '../../icons/icon-twoway-analog-closed.js';\n\n/**\n * @availableWhen value closed==false\n * @stable\n */\n@customElement('obc-valve-analog-two-way-icon')\nexport class ObcValveAnalogTwoWayIcon extends LitElement {\n @property({type: Number}) value: number = 0;\n @property({type: Boolean}) closed: boolean = false;\n @property({type: Boolean}) vertical: boolean = false;\n\n override render() {\n const transform = this.vertical ? 'transform: rotate(90deg);' : '';\n if (this.closed) {\n return html` <div class=\"wrapper\" style=\"${transform}\">\n <obi-twoway-analog-closed useCssColor> </obi-twoway-analog-closed>\n </div>`;\n }\n\n const handleRotation = -(1 - this.value / 100) * 90;\n const handleTranslation = (1 - this.value / 100) * 2;\n const handle = svg`\n <g transform=\"translate(0, ${handleTranslation}) rotate(${handleRotation} 12 3.5) \">\n <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)\"/>\n <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)\"/>\n </g>\n `;\n\n const xmin = 10.5;\n const xmax = 2.5;\n const x = xmin + ((xmax - xmin) * this.value) / 100;\n\n return html`\n <div class=\"wrapper\" style=\"${transform}\">\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n 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\"\n fill=\"var(--automation-device-tertiary-color)\"\n />\n <path\n d=\"M10.6972 12H13.3028L21 6.8685V19.1315L13.3028 14H10.6972L3 19.1315V6.8685L10.6972 12Z\"\n fill=\"var(--automation-device-primary-color)\"\n />\n ${handle}\n <g clip-path=\"url(#clip0)\">\n <rect\n x=${xmax}\n y=\"0\"\n width=${x - xmax}\n height=\"24\"\n fill=\"var(--automation-device-secondary-color)\"\n />\n <line\n x1=${x}\n y1=\"0\"\n x2=${x}\n y2=\"24\"\n stroke=\"var(--automation-device-tertiary-color)\"\n stroke-width=\"1\"\n />\n\n <rect\n x=${24 - x}\n y=\"0\"\n width=${x - xmax}\n height=\"24\"\n fill=\"var(--automation-device-secondary-color)\"\n />\n <line\n x1=${24 - x}\n y1=\"0\"\n x2=${24 - x}\n y2=\"24\"\n stroke=\"var(--automation-device-tertiary-color)\"\n stroke-width=\"1\"\n />\n </g>\n <defs>\n <clipPath id=\"clip0\">\n <path\n d=\"M10.6972 12H13.3028L21 6.8685V19.1315L13.3028 14H10.6972L3 19.1315V6.8685L10.6972 12Z\"\n />\n </clipPath>\n </defs>\n </svg>\n </div>\n `;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-valve-analog-two-way-icon': ObcValveAnalogTwoWayIcon;\n }\n}\n"],"mappings":";;;;;;;AAWO,IAAM,2BAAN,MAAM,iCAAiC,WAAW;;;EACb,KAAA,QAAA;EACG,KAAA,SAAA;EACE,KAAA,WAAA;;CAE/C,SAAkB;EAChB,MAAM,YAAY,KAAK,WAAW,8BAA8B;EAChE,IAAI,KAAK,QACP,OAAO,IAAI,gCAAgC,UAAU;;;EAKvD,MAAM,iBAAiB,EAAE,IAAI,KAAK,QAAQ,OAAO;EACjD,MAAM,qBAAqB,IAAI,KAAK,QAAQ,OAAO;EACnD,MAAM,SAAS,GAAG;mCACa,kBAAkB,WAAW,eAAe;;;;;EAM3E,MAAM,OAAO;EACb,MAAM,OAAO;EACb,MAAM,IAAI,OAAS,KAAe,KAAK,QAAS;EAEhD,OAAO,IAAI;oCACqB,UAAU;;;;;;;;;;;;;;;;YAgBlC,OAAO;;;kBAGD,KAAK;;sBAED,IAAI,KAAK;;;;;mBAKZ,EAAE;;mBAEF,EAAE;;;;;;;kBAOH,KAAK,EAAE;;sBAEH,IAAI,KAAK;;;;;mBAKZ,KAAK,EAAE;;mBAEP,KAAK,EAAE;;;;;;;;;;;;;;;;CAgBxB;;EAEyB,KAAA,SAAA,UAAU,iCAAY;;AACjD;AAzFG,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,yBAAA,WAAA,SAAA,KAAA,CAAA;AACvB,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,yBAAA,WAAA,UAAA,KAAA,CAAA;AACxB,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,yBAAA,WAAA,YAAA,KAAA,CAAA;AAJ1B,2BAAA,WAAA,CAAA,cAAc,+BAA+B,CAAA,GAAA,wBAAA"}
1
+ {"version":3,"file":"valve-analog-two-way-icon.js","names":[],"sources":["../../../src/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.ts"],"sourcesContent":["import {LitElement, html, svg, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport compentStyle from './valve-analog-two-way-icon.css?inline';\nimport {customElement} from '../../decorator.js';\nimport {clampPercent} from '../../svghelpers/math.js';\nimport '../../icons/icon-twoway-analog-closed.js';\n\nconst OUTLINE =\n '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';\nconst BODY =\n 'M10.6972 12H13.3028L21 6.8685V19.1315L13.3028 14H10.6972L3 19.1315V6.8685L10.6972 12Z';\n\n/** Width of the shut band at each port end when the opening is 0 %, in icon units. */\nconst BAND_RANGE = 7;\n\nconst SECONDARY = 'fill: var(--automation-device-secondary-color)';\nconst TERTIARY = 'fill: var(--automation-device-tertiary-color)';\nconst PRIMARY = 'fill: var(--automation-device-primary-color)';\n\n/**\n * Two-way analog valve symbol whose opening moves continuously from 0 to\n * 100 %.\n *\n * Draws the same symbol as the `obi-twoway-analog-*` icons. The shut bands at\n * the port ends and the handle are linear in the opening: exact at 100 %\n * (`obi-twoway-analog-open`) and at 0 % (vertical handle, ports shut to the\n * centre), and close to the icons' 10/25/50/75 % steps in between. Used as\n * the icon of `obc-analog-valve`.\n *\n * @property value - Opening in percent (0–100).\n * @availableWhen value closed==false\n * @property closed - Shows the closed symbol.\n * @property vertical - Turns the symbol 90° for a vertical pipe.\n * @stable\n */\n@customElement('obc-valve-analog-two-way-icon')\nexport class ObcValveAnalogTwoWayIcon extends LitElement {\n @property({type: Number}) value: number = 0;\n @property({type: Boolean}) closed: boolean = false;\n @property({type: Boolean}) vertical: boolean = false;\n\n private renderBands(width: number) {\n if (width <= 0) return null;\n const left = 3 + width;\n const right = 21 - width;\n return svg`<g clip-path=\"url(#body)\">\n <rect x=\"2\" y=\"0\" width=${left - 2} height=\"24\" style=${SECONDARY}/>\n <rect x=${left} y=\"0\" width=\"1\" height=\"24\" style=${TERTIARY}/>\n <rect x=${right} y=\"0\" width=${22 - right} height=\"24\" style=${SECONDARY}/>\n <rect x=${right - 1} y=\"0\" width=\"1\" height=\"24\" style=${TERTIARY}/>\n </g>`;\n }\n\n /**\n * Horizontal at the top when open, turning to vertical and moving 2 units\n * down as the valve shuts, matching `obi-twoway-analog-open` at 100 %.\n */\n private renderHandle(value: number) {\n const shut = 1 - value / 100;\n const angle = -90 * shut;\n const cx = 12;\n const cy = 3.5 + 2 * shut;\n return svg`<g transform=\"rotate(${angle} ${cx} ${cy})\">\n <rect x=${cx - 4} y=${cy - 1.5} width=\"8\" height=\"3\" rx=\"1.5\" style=${TERTIARY}/>\n <rect x=${cx - 3} y=${cy - 0.5} width=\"6\" height=\"1\" rx=\"0.5\" style=${PRIMARY}/>\n </g>`;\n }\n\n override render() {\n const transform = this.vertical ? 'transform: rotate(90deg);' : '';\n if (this.closed) {\n return html` <div class=\"wrapper\" style=\"${transform}\">\n <obi-twoway-analog-closed useCssColor> </obi-twoway-analog-closed>\n </div>`;\n }\n\n const value = clampPercent(this.value);\n return html`\n <div class=\"wrapper\" style=\"${transform}\">\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <defs>\n <clipPath id=\"body\"><path d=${BODY} /></clipPath>\n </defs>\n <path d=${OUTLINE} style=${TERTIARY} />\n <path d=${BODY} style=${PRIMARY} />\n ${this.renderBands((BAND_RANGE * (100 - value)) / 100)}\n ${this.renderHandle(value)}\n </svg>\n </div>\n `;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-valve-analog-two-way-icon': ObcValveAnalogTwoWayIcon;\n }\n}\n"],"mappings":";;;;;;;;AAOA,IAAM,UACJ;AACF,IAAM,OACJ;;AAGF,IAAM,aAAa;AAEnB,IAAM,YAAY;AAClB,IAAM,WAAW;AACjB,IAAM,UAAU;AAmBT,IAAM,2BAAN,MAAM,iCAAiC,WAAW;;;EACb,KAAA,QAAA;EACG,KAAA,SAAA;EACE,KAAA,WAAA;;CAE/C,YAAoB,OAAe;EACjC,IAAI,SAAS,GAA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
@@ -0,0 +1,60 @@
1
+ import { CSSResultGroup, LitElement, PropertyValues } from 'lit';
2
+ import '../../components/scrollbar/scrollbar.js';
3
+ /** What an empty alert list shows where its `empty-*` slots are left unfilled. */
4
+ export interface AlertListEmptyFallback {
5
+ icon?: unknown;
6
+ title?: unknown;
7
+ }
8
+ /**
9
+ * `ObcAlertListBase` – Scrolling list of slotted alert items that animates items
10
+ * into place and shows an empty state when no item passes its filter.
11
+ *
12
+ * Not registered as an element: the subclasses decide which items pass.
13
+ * `obc-alert-list` runs a predicate the consumer sets.
14
+ *
15
+ * ### Features
16
+ * - **Filter:** `matchesFilter()` decides which items count; the list re-reads
17
+ * it when items are added or removed, when an item attribute named by
18
+ * `observedItemAttributes` changes, and when `filterChanged()` reports a
19
+ * change of the subclass's filter inputs.
20
+ * - **Motion:** items that move slide to their new place; new items play
21
+ * their intro animation once the list has been seen.
22
+ * - **Empty state:** icon, title and description slots, with fallback content
23
+ * from `emptyFallback`.
24
+ * - **Visible items:** `getVisibleElements()` returns the items that pass the
25
+ * filter and sit inside the scroll viewport.
26
+ */
27
+ export declare class ObcAlertListBase extends LitElement {
28
+ private oldElementTop;
29
+ private mutationObserver;
30
+ private intersectionObserver;
31
+ private hasRenderedPanel;
32
+ _empty: boolean;
33
+ protected alertItems: HTMLElement[];
34
+ private scrollbar;
35
+ /** Whether the list counts an item as one it shows. */
36
+ protected matchesFilter(_item: HTMLElement): boolean;
37
+ /** Whether this update changed what `matchesFilter` decides. */
38
+ protected filterChanged(_changed: PropertyValues): boolean;
39
+ /** Item attributes whose changes can change what `matchesFilter` decides. */
40
+ protected get observedItemAttributes(): string[];
41
+ protected get emptyFallback(): AlertListEmptyFallback;
42
+ firstUpdated(): void;
43
+ connectedCallback(): void;
44
+ disconnectedCallback(): void;
45
+ protected willUpdate(_changedProperties: PropertyValues): void;
46
+ /** Runs whenever the items or the filter change; a subclass extends it to act on each item. */
47
+ protected applyFilter(): void;
48
+ private getAlertItems;
49
+ private updateOldElementTop;
50
+ private setupMutationObserver;
51
+ private handleSlotChange;
52
+ private handleElementsChange;
53
+ getVisibleElements(): {
54
+ element: HTMLElement;
55
+ index: number;
56
+ }[];
57
+ render(): import('lit-html').TemplateResult<1>;
58
+ static styles: CSSResultGroup;
59
+ }
60
+ //# sourceMappingURL=alert-list-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-list-base.d.ts","sourceRoot":"","sources":["../../../src/building-blocks/alert-list/alert-list-base.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,UAAU,EACV,cAAc,EAIf,MAAM,KAAK,CAAC;AAGb,OAAO,yCAAyC,CAAC;AAIjD,kFAAkF;AAClF,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAC9C,OAAO,CAAC,aAAa,CAAuC;IAC5D,OAAO,CAAC,gBAAgB,CAAiC;IACzD,OAAO,CAAC,oBAAoB,CAAqC;IACjE,OAAO,CAAC,gBAAgB,CAAS;IACxB,MAAM,UAAS;IAGxB,SAAS,CAAC,UAAU,EAAG,WAAW,EAAE,CAAC;IAGrC,OAAO,CAAC,SAAS,CAAgB;IAEjC,uDAAuD;IACvD,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAIpD,gEAAgE;IAChE,SAAS,CAAC,aAAa,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO;IAI1D,6EAA6E;IAC7E,SAAS,KAAK,sBAAsB,IAAI,MAAM,EAAE,CAE/C;IAED,SAAS,KAAK,aAAa,IAAI,sBAAsB,CAEpD;IAEQ,YAAY;IAKZ,iBAAiB;IAcjB,oBAAoB;cAYV,UAAU,CAAC,kBAAkB,EAAE,cAAc,GAAG,IAAI;IAOvE,+FAA+F;IAC/F,SAAS,CAAC,WAAW;IAIrB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,mBAAmB;IAuB3B,OAAO,CAAC,qBAAqB;IAoB7B,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,oBAAoB;IAgDrB,kBAAkB,IAAI;QAAC,OAAO,EAAE,WAAW,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,EAAE;IA4B3D,MAAM;IAsBf,OAAgB,MAAM,EAAE,cAAc,CAA2B;CAClE"}
@@ -0,0 +1,191 @@
1
+ import __decorate from "../../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/decorate.js";
2
+ import alert_list_default from "./alert-list.css.js";
3
+ import "../../components/scrollbar/scrollbar.js";
4
+ import { LitElement, html, nothing, unsafeCSS } from "lit";
5
+ import { query, queryAssignedElements, state } from "lit/decorators.js";
6
+ //#region src/building-blocks/alert-list/alert-list-base.ts
7
+ /**
8
+ * `ObcAlertListBase` – Scrolling list of slotted alert items that animates items
9
+ * into place and shows an empty state when no item passes its filter.
10
+ *
11
+ * Not registered as an element: the subclasses decide which items pass.
12
+ * `obc-alert-list` runs a predicate the consumer sets.
13
+ *
14
+ * ### Features
15
+ * - **Filter:** `matchesFilter()` decides which items count; the list re-reads
16
+ * it when items are added or removed, when an item attribute named by
17
+ * `observedItemAttributes` changes, and when `filterChanged()` reports a
18
+ * change of the subclass's filter inputs.
19
+ * - **Motion:** items that move slide to their new place; new items play
20
+ * their intro animation once the list has been seen.
21
+ * - **Empty state:** icon, title and description slots, with fallback content
22
+ * from `emptyFallback`.
23
+ * - **Visible items:** `getVisibleElements()` returns the items that pass the
24
+ * filter and sit inside the scroll viewport.
25
+ */
26
+ var ObcAlertListBase = class extends LitElement {
27
+ constructor(..._args) {
28
+ super(..._args);
29
+ this.oldElementTop = /* @__PURE__ */ new Map();
30
+ this.mutationObserver = null;
31
+ this.intersectionObserver = null;
32
+ this.hasRenderedPanel = false;
33
+ this._empty = false;
34
+ }
35
+ /** Whether the list counts an item as one it shows. */
36
+ matchesFilter(_item) {
37
+ return true;
38
+ }
39
+ /** Whether this update changed what `matchesFilter` decides. */
40
+ filterChanged(_changed) {
41
+ return false;
42
+ }
43
+ /** Item attributes whose changes can change what `matchesFilter` decides. */
44
+ get observedItemAttributes() {
45
+ return ["status", "shelved"];
46
+ }
47
+ get emptyFallback() {
48
+ return {};
49
+ }
50
+ firstUpdated() {
51
+ this.applyFilter();
52
+ this.setupMutationObserver();
53
+ }
54
+ connectedCallback() {
55
+ super.connectedCallback();
56
+ const intersectionObserver = new IntersectionObserver((entries) => {
57
+ if (entries[0].intersectionRatio === 0) this.hasRenderedPanel = false;
58
+ });
59
+ intersectionObserver.observe(this);
60
+ this.intersectionObserver = intersectionObserver;
61
+ this.setupMutationObserver();
62
+ }
63
+ disconnectedCallback() {
64
+ super.disconnectedCallback();
65
+ if (this.mutationObserver) {
66
+ this.mutationObserver.disconnect();
67
+ this.mutationObserver = null;
68
+ }
69
+ if (this.intersectionObserver) {
70
+ this.intersectionObserver.disconnect();
71
+ this.intersectionObserver = null;
72
+ }
73
+ }
74
+ willUpdate(_changedProperties) {
75
+ if (this.filterChanged(_changedProperties)) {
76
+ this.applyFilter();
77
+ this.updateOldElementTop();
78
+ }
79
+ }
80
+ /** Runs whenever the items or the filter change; a subclass extends it to act on each item. */
81
+ applyFilter() {
82
+ this._empty = this.getAlertItems().length === 0;
83
+ }
84
+ getAlertItems() {
85
+ return this.alertItems.filter((item) => this.matchesFilter(item));
86
+ }
87
+ updateOldElementTop() {
88
+ const elements = this.getAlertItems();
89
+ if (elements.length === 0) return;
90
+ let top = elements[0].getBoundingClientRect().top;
91
+ this.oldElementTop.clear();
92
+ elements.forEach((element) => {
93
+ const elementRect = element.getBoundingClientRect();
94
+ if (elementRect.height === 0) return;
95
+ this.oldElementTop.set(element, top);
96
+ top += elementRect.height;
97
+ });
98
+ }
99
+ setupMutationObserver() {
100
+ if (this.mutationObserver) {
101
+ this.mutationObserver.disconnect();
102
+ this.mutationObserver = null;
103
+ }
104
+ this.mutationObserver = new MutationObserver(() => {
105
+ this.handleElementsChange();
106
+ });
107
+ this.alertItems.forEach((element) => {
108
+ this.mutationObserver?.observe(element, {
109
+ attributes: true,
110
+ attributeFilter: this.observedItemAttributes
111
+ });
112
+ });
113
+ }
114
+ handleSlotChange() {
115
+ this.handleElementsChange();
116
+ this.setupMutationObserver();
117
+ }
118
+ handleElementsChange() {
119
+ this.mutationObserver?.takeRecords();
120
+ this.applyFilter();
121
+ if (!this.checkVisibility()) return;
122
+ const elements = this.getAlertItems();
123
+ const oldElementTop = new Map(this.oldElementTop);
124
+ requestAnimationFrame(() => {
125
+ this.updateOldElementTop();
126
+ let hasNewElements = false;
127
+ elements.forEach((element) => {
128
+ const elementRect = element.getBoundingClientRect();
129
+ const oldTop = oldElementTop.get(element);
130
+ if (oldTop === void 0) {
131
+ element.animateIntro = this.hasRenderedPanel;
132
+ hasNewElements = true;
133
+ setTimeout(() => {
134
+ element.animateIntro = false;
135
+ }, 101);
136
+ return;
137
+ }
138
+ const diff = oldTop - elementRect.top;
139
+ if (diff === 0) return;
140
+ element.style.transform = `translateY(${diff}px)`;
141
+ element.style.transition = "none";
142
+ element.offsetHeight;
143
+ element.style.transition = "transform 100ms ease-in-out";
144
+ element.style.transform = "translateY(0px)";
145
+ });
146
+ this.hasRenderedPanel = true;
147
+ if (hasNewElements) setTimeout(() => {
148
+ this.updateOldElementTop();
149
+ }, 101);
150
+ });
151
+ }
152
+ getVisibleElements() {
153
+ const scrollbarRect = this.scrollbar.getBoundingClientRect();
154
+ return this.getAlertItems().map((element, index) => ({
155
+ element,
156
+ index
157
+ })).filter(({ element }) => {
158
+ const style = window.getComputedStyle(element);
159
+ if (style.display === "none" || style.visibility === "hidden") return false;
160
+ const elementRect = element.getBoundingClientRect();
161
+ return !(elementRect.top < scrollbarRect.top || elementRect.bottom > scrollbarRect.bottom);
162
+ });
163
+ }
164
+ render() {
165
+ const fallback = this.emptyFallback;
166
+ return html` <obc-scrollbar class="alert-list" id="scrollbar">
167
+ <slot @slotchange=${this.handleSlotChange}></slot>
168
+ ${this._empty ? html` <div class="empty-list">
169
+ <div class="icon">
170
+ <slot name="empty-icon">${fallback.icon}</slot>
171
+ </div>
172
+ <div class="empty-title">
173
+ <slot name="empty-title">${fallback.title}</slot>
174
+ </div>
175
+ <div class="empty-description">
176
+ <slot name="empty-description"></slot>
177
+ </div>
178
+ </div>` : nothing}
179
+ </obc-scrollbar>`;
180
+ }
181
+ static {
182
+ this.styles = unsafeCSS(alert_list_default);
183
+ }
184
+ };
185
+ __decorate([state()], ObcAlertListBase.prototype, "_empty", void 0);
186
+ __decorate([queryAssignedElements({ flatten: true })], ObcAlertListBase.prototype, "alertItems", void 0);
187
+ __decorate([query("#scrollbar", true)], ObcAlertListBase.prototype, "scrollbar", void 0);
188
+ //#endregion
189
+ export { ObcAlertListBase };
190
+
191
+ //# sourceMappingURL=alert-list-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-list-base.js","names":[],"sources":["../../../src/building-blocks/alert-list/alert-list-base.ts"],"sourcesContent":["import {\n CSSResultGroup,\n LitElement,\n PropertyValues,\n html,\n nothing,\n unsafeCSS,\n} from 'lit';\nimport {queryAssignedElements, query, state} from 'lit/decorators.js';\nimport compentStyle from './alert-list.css?inline';\nimport '../../components/scrollbar/scrollbar.js';\nimport {ObcScrollbar} from '../../components/scrollbar/scrollbar.js';\nimport {ObcAlertMenuItem} from '../../components/alert-menu-item/alert-menu-item.js';\n\n/** What an empty alert list shows where its `empty-*` slots are left unfilled. */\nexport interface AlertListEmptyFallback {\n icon?: unknown;\n title?: unknown;\n}\n\n/**\n * `ObcAlertListBase` – Scrolling list of slotted alert items that animates items\n * into place and shows an empty state when no item passes its filter.\n *\n * Not registered as an element: the subclasses decide which items pass.\n * `obc-alert-list` runs a predicate the consumer sets.\n *\n * ### Features\n * - **Filter:** `matchesFilter()` decides which items count; the list re-reads\n * it when items are added or removed, when an item attribute named by\n * `observedItemAttributes` changes, and when `filterChanged()` reports a\n * change of the subclass's filter inputs.\n * - **Motion:** items that move slide to their new place; new items play\n * their intro animation once the list has been seen.\n * - **Empty state:** icon, title and description slots, with fallback content\n * from `emptyFallback`.\n * - **Visible items:** `getVisibleElements()` returns the items that pass the\n * filter and sit inside the scroll viewport.\n */\nexport class ObcAlertListBase extends LitElement {\n private oldElementTop: Map<HTMLElement, number> = new Map();\n private mutationObserver: MutationObserver | null = null;\n private intersectionObserver: IntersectionObserver | null = null;\n private hasRenderedPanel = false;\n @state() _empty = false;\n\n @queryAssignedElements({flatten: true})\n protected alertItems!: HTMLElement[];\n\n @query('#scrollbar', true)\n private scrollbar!: ObcScrollbar;\n\n /** Whether the list counts an item as one it shows. */\n protected matchesFilter(_item: HTMLElement): boolean {\n return true;\n }\n\n /** Whether this update changed what `matchesFilter` decides. */\n protected filterChanged(_changed: PropertyValues): boolean {\n return false;\n }\n\n /** Item attributes whose changes can change what `matchesFilter` decides. */\n protected get observedItemAttributes(): string[] {\n return ['status', 'shelved'];\n }\n\n protected get emptyFallback(): AlertListEmptyFallback {\n return {};\n }\n\n override firstUpdated() {\n this.applyFilter();\n this.setupMutationObserver();\n }\n\n override connectedCallback() {\n super.connectedCallback();\n const intersectionObserver = new IntersectionObserver((entries) => {\n // If intersectionRatio is 0, the target is out of view\n if (entries[0].intersectionRatio === 0) {\n this.hasRenderedPanel = false;\n }\n });\n intersectionObserver.observe(this);\n this.intersectionObserver = intersectionObserver;\n\n this.setupMutationObserver();\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n this.mutationObserver = null;\n }\n if (this.intersectionObserver) {\n this.intersectionObserver.disconnect();\n this.intersectionObserver = null;\n }\n }\n\n protected override willUpdate(_changedProperties: PropertyValues): void {\n if (this.filterChanged(_changedProperties)) {\n this.applyFilter();\n this.updateOldElementTop();\n }\n }\n\n /** Runs whenever the items or the filter change; a subclass extends it to act on each item. */\n protected applyFilter() {\n this._empty = this.getAlertItems().length === 0;\n }\n\n private getAlertItems() {\n return this.alertItems.filter((item) => this.matchesFilter(item));\n }\n\n private updateOldElementTop() {\n const elements = this.getAlertItems();\n if (elements.length === 0) {\n return;\n }\n\n // Get the top of the element,\n // the element may be in an animation\n // we therefor sum the height of each element\n const firstElement = elements[0];\n const firstElementRect = firstElement.getBoundingClientRect();\n let top = firstElementRect.top;\n this.oldElementTop.clear();\n elements.forEach((element) => {\n const elementRect = element.getBoundingClientRect();\n if (elementRect.height === 0) {\n return;\n }\n this.oldElementTop.set(element, top);\n top += elementRect.height;\n });\n }\n\n private setupMutationObserver() {\n if (this.mutationObserver) {\n // Make a new observer to avoid memory leaks\n this.mutationObserver.disconnect();\n this.mutationObserver = null;\n }\n this.mutationObserver = new MutationObserver(() => {\n this.handleElementsChange();\n });\n\n const slotElements = this.alertItems;\n slotElements.forEach((element) => {\n // Earlier observed elements are just updated, and not registered twice.\n this.mutationObserver?.observe(element, {\n attributes: true,\n attributeFilter: this.observedItemAttributes,\n });\n });\n }\n\n private handleSlotChange() {\n this.handleElementsChange();\n this.setupMutationObserver();\n }\n\n private handleElementsChange() {\n // Take records to ensure the observer is not triggered again\n this.mutationObserver?.takeRecords();\n this.applyFilter();\n if (!this.checkVisibility()) {\n return;\n }\n\n const elements = this.getAlertItems();\n // Animate the elements to their new positions\n const oldElementTop: Map<HTMLElement, number> = new Map(this.oldElementTop);\n\n requestAnimationFrame(() => {\n this.updateOldElementTop();\n let hasNewElements = false;\n elements.forEach((element) => {\n const elementRect = element.getBoundingClientRect();\n const oldTop = oldElementTop.get(element);\n if (oldTop === undefined) {\n // New element\n (element as ObcAlertMenuItem).animateIntro = this.hasRenderedPanel;\n hasNewElements = true;\n setTimeout(() => {\n (element as ObcAlertMenuItem).animateIntro = false;\n }, 101);\n return;\n }\n const diff = oldTop - elementRect.top;\n if (diff === 0) return;\n element.style.transform = `translateY(${diff}px)`;\n element.style.transition = 'none';\n\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- the read forces the reflow that restarts the transition\n element.offsetHeight;\n\n // Remove the transition after the animation is complete\n element.style.transition = 'transform 100ms ease-in-out';\n element.style.transform = 'translateY(0px)';\n });\n this.hasRenderedPanel = true;\n if (hasNewElements) {\n setTimeout(() => {\n this.updateOldElementTop();\n }, 101);\n }\n });\n }\n\n public getVisibleElements(): {element: HTMLElement; index: number}[] {\n // Get all slotted elements in the visible tab's scrollbar\n\n const scrollbarRect = this.scrollbar.getBoundingClientRect();\n const slottedElements = this.getAlertItems();\n\n // Filter for only visible elements that are within the scrollbar viewport\n return slottedElements\n .map((element, index) => ({element, index}))\n .filter(({element}) => {\n const style = window.getComputedStyle(element);\n if (style.display === 'none' || style.visibility === 'hidden') {\n return false;\n }\n\n // Check if the element is within the scrollbar's viewport\n const elementRect = element.getBoundingClientRect();\n\n // Check if element overlaps with scrollbar viewport\n const isVisible = !(\n elementRect.top < scrollbarRect.top ||\n elementRect.bottom > scrollbarRect.bottom\n );\n\n return isVisible;\n });\n }\n\n override render() {\n const fallback = this.emptyFallback;\n return html` <obc-scrollbar class=\"alert-list\" id=\"scrollbar\">\n <slot @slotchange=${this.handleSlotChange}></slot>\n ${\n this._empty\n ? html` <div class=\"empty-list\">\n <div class=\"icon\">\n <slot name=\"empty-icon\">${fallback.icon}</slot>\n </div>\n <div class=\"empty-title\">\n <slot name=\"empty-title\">${fallback.title}</slot>\n </div>\n <div class=\"empty-description\">\n <slot name=\"empty-description\"></slot>\n </div>\n </div>`\n : nothing\n }\n </obc-scrollbar>`;\n }\n\n static override styles: CSSResultGroup = unsafeCSS(compentStyle);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAa,mBAAb,cAAsC,WAAW;;;EACG,KAAA,gCAAA,IAAI,IAAI;EACN,KAAA,mBAAA;EACQ,KAAA,uBAAA;EACjC,KAAA,mBAAA;EACT,KAAA,SAAA;;;CASlB,cAAwB,OAA6B;EACnD,OAAO;CACT;;CAGA,cAAwB,UAAmC;EACz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Aa;GACrB,MAAM,QAAQ,OAAO,iBAAiB,OAAO;GAC7C,IAAI,MAAM,YAAY,UAAU,MAAM,eAAe,UACnD,OAAO;GAIT,MAAM,cAAc,QAAQ,sBAAsB;GAQlD,OAAO,EAJL,YAAY,MAAM,cAAc,OAChC,YAAY,SAAS,cAAc;EAIvC,CAAC;CACL;CAEA,SAAkB;EAChB,MAAM,WAAW,KAAK;EACtB,OAAO,IAAI;0BACW,KAAK,iBAAiB;QAExC,KAAK,SACD,IAAI;;0CAE0B,SAAS,KAAK;;;2CAGb,SAAS,MAAM;;;;;sBAM9C,QACL;;CAEL;;EAEyC,KAAA,SAAA,UAAU,kBAAY;;AACjE;AA7NG,WAAA,CAAA,MAAM,CAAA,GAAA,iBAAA,WAAA,UAAA,KAAA,CAAA;AAEN,WAAA,CAAA,sBAAsB,EAAC,SAAS,KAAI,CAAC,CAAA,GAAA,iBAAA,WAAA,cAAA,KAAA,CAAA;AAGrC,WAAA,CAAA,MAAM,cAAc,IAAI,CAAA,GAAA,iBAAA,WAAA,aAAA,KAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"alert-list.css.js","names":[],"sources":["../../../src/building-blocks/alert-list/alert-list.css?inline"],"sourcesContent":["* {\n box-sizing: border-box;\n}\n\n:host {\n display: block;\n}\n\n.alert-list {\n height: 100%;\n}\n\n.empty-list {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100%;\n gap: var(--app-components-alert-menu-button-spacing);\n\n .icon {\n height: 96px;\n width: 96px;\n }\n\n .empty-title {\n color: var(--element-active-color);\n @mixin font-body-active;\n }\n\n .empty-description {\n color: var(--element-neutral-color);\n @mixin font-body;\n max-width: 344px;\n text-align: center;\n }\n}\n\n::slotted(*) {\n display: block;\n will-change: transform;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"alert-list.css.js","names":[],"sources":["../../../src/building-blocks/alert-list/alert-list.css?inline"],"sourcesContent":["* {\n box-sizing: border-box;\n}\n\n:host {\n display: block;\n}\n\n.alert-list {\n height: 100%;\n}\n\n.empty-list {\n @mixin alert-list-empty;\n}\n\n::slotted(*) {\n display: block;\n will-change: transform;\n}\n"],"mappings":""}
@@ -1,37 +1,24 @@
1
- import { LitElement, PropertyValues } from 'lit';
2
- import '../../components/scrollbar/scrollbar.js';
1
+ import { PropertyValues } from 'lit';
2
+ import { ObcAlertListBase } from './alert-list-base.js';
3
3
  /**
4
+ * `<obc-alert-list>` – Scrolling list of alert items with an empty state.
5
+ *
6
+ * `filter` decides which items count: the empty state shows when none does,
7
+ * and `getVisibleElements()` returns only those. Hiding the other items is
8
+ * left to the consumer's CSS.
9
+ *
10
+ * @property filter - Predicate that picks the items the list counts as shown.
4
11
  * @slot - Default slot for the alert list items.
5
12
  * @slot empty-icon - Icon shown when the list is empty.
6
13
  * @slot empty-title - Title shown when the list is empty.
7
14
  * @slot empty-description - Description shown when the list is empty.
8
15
  * @stable
9
16
  */
10
- export declare class ObcAlertList extends LitElement {
17
+ export declare class ObcAlertList extends ObcAlertListBase {
18
+ /** Predicate that picks the items the list counts as shown. */
11
19
  filter: (item: HTMLElement) => boolean;
12
- private oldElementTop;
13
- private mutationObserver;
14
- private intersectionObserver;
15
- private hasRenderedPanel;
16
- _empty: boolean;
17
- private alertItems;
18
- private scrollbar;
19
- firstUpdated(): void;
20
- connectedCallback(): void;
21
- disconnectedCallback(): void;
22
- protected willUpdate(_changedProperties: PropertyValues): void;
23
- private updateEmpty;
24
- private getAlertItems;
25
- private updateOldElementTop;
26
- private setupMutationObserver;
27
- private handleSlotChange;
28
- private handleElementsChange;
29
- getVisibleElements(): {
30
- element: HTMLElement;
31
- index: number;
32
- }[];
33
- render(): import('lit-html').TemplateResult<1>;
34
- static styles: import('lit').CSSResult;
20
+ protected matchesFilter(item: HTMLElement): boolean;
21
+ protected filterChanged(changed: PropertyValues): boolean;
35
22
  }
36
23
  declare global {
37
24
  interface HTMLElementTagNameMap {
@@ -1 +1 @@
1
- {"version":3,"file":"alert-list.d.ts","sourceRoot":"","sources":["../../../src/building-blocks/alert-list/alert-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,cAAc,EAA2B,MAAM,KAAK,CAAC;AAIzE,OAAO,yCAAyC,CAAC;AAIjD;;;;;;GAMG;AACH,qBACa,YAAa,SAAQ,UAAU;IACZ,MAAM,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAC7D;IAEP,OAAO,CAAC,aAAa,CAAuC;IAC5D,OAAO,CAAC,gBAAgB,CAAiC;IACzD,OAAO,CAAC,oBAAoB,CAAqC;IACjE,OAAO,CAAC,gBAAgB,CAAS;IACxB,MAAM,UAAS;IAGxB,OAAO,CAAC,UAAU,CAAiB;IAGnC,OAAO,CAAC,SAAS,CAAgB;IAExB,YAAY;IAKZ,iBAAiB;IAcjB,oBAAoB;cAWV,UAAU,CAAC,kBAAkB,EAAE,cAAc,GAAG,IAAI;IAOvE,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,mBAAmB;IAuB3B,OAAO,CAAC,qBAAqB;IAoB7B,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,oBAAoB;IAgDrB,kBAAkB,IAAI;QAAC,OAAO,EAAE,WAAW,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,EAAE;IA4B3D,MAAM;IAqBf,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,YAAY,CAAC;KAChC;CACF"}
1
+ {"version":3,"file":"alert-list.d.ts","sourceRoot":"","sources":["../../../src/building-blocks/alert-list/alert-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,KAAK,CAAC;AAGnC,OAAO,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAEtD;;;;;;;;;;;;;GAaG;AACH,qBACa,YAAa,SAAQ,gBAAgB;IAClB,MA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