@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.136 → 2.0.0-next.137

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 (39) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +11434 -10949
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +784 -0
  4. package/dist/automation/hydraulic-check-valve/hydraulic-check-valve.css.js +12 -0
  5. package/dist/automation/hydraulic-check-valve/hydraulic-check-valve.css.js.map +1 -0
  6. package/dist/automation/hydraulic-check-valve/hydraulic-check-valve.d.ts +33 -0
  7. package/dist/automation/hydraulic-check-valve/hydraulic-check-valve.d.ts.map +1 -0
  8. package/dist/automation/hydraulic-check-valve/hydraulic-check-valve.js +58 -0
  9. package/dist/automation/hydraulic-check-valve/hydraulic-check-valve.js.map +1 -0
  10. package/dist/automation/hydraulic-valve-4-3/hydraulic-valve-4-3.d.ts +77 -0
  11. package/dist/automation/hydraulic-valve-4-3/hydraulic-valve-4-3.d.ts.map +1 -0
  12. package/dist/automation/hydraulic-valve-4-3/hydraulic-valve-4-3.js +74 -0
  13. package/dist/automation/hydraulic-valve-4-3/hydraulic-valve-4-3.js.map +1 -0
  14. package/dist/automation/hydraulic-valve-x-2/hydraulic-valve-x-2.d.ts +74 -0
  15. package/dist/automation/hydraulic-valve-x-2/hydraulic-valve-x-2.d.ts.map +1 -0
  16. package/dist/automation/hydraulic-valve-x-2/hydraulic-valve-x-2.js +60 -0
  17. package/dist/automation/hydraulic-valve-x-2/hydraulic-valve-x-2.js.map +1 -0
  18. package/dist/automation/shuffle-button/shuffle-button-base.d.ts +67 -0
  19. package/dist/automation/shuffle-button/shuffle-button-base.d.ts.map +1 -0
  20. package/dist/automation/shuffle-button/shuffle-button-base.js +126 -0
  21. package/dist/automation/shuffle-button/shuffle-button-base.js.map +1 -0
  22. package/dist/automation/shuffle-button/shuffle-button.css.js +219 -0
  23. package/dist/automation/shuffle-button/shuffle-button.css.js.map +1 -0
  24. package/dist/automation/shuffle-button/shuffle-layout.d.ts +9 -0
  25. package/dist/automation/shuffle-button/shuffle-layout.d.ts.map +1 -0
  26. package/dist/automation/shuffle-button/shuffle-layout.js +16 -0
  27. package/dist/automation/shuffle-button/shuffle-layout.js.map +1 -0
  28. package/package.json +1 -1
  29. package/src/automation/hydraulic-check-valve/hydraulic-check-valve.css +3 -0
  30. package/src/automation/hydraulic-check-valve/hydraulic-check-valve.stories.ts +18 -0
  31. package/src/automation/hydraulic-check-valve/hydraulic-check-valve.ts +60 -0
  32. package/src/automation/hydraulic-valve-4-3/hydraulic-valve-4-3.stories.ts +72 -0
  33. package/src/automation/hydraulic-valve-4-3/hydraulic-valve-4-3.ts +108 -0
  34. package/src/automation/hydraulic-valve-x-2/hydraulic-valve-x-2.stories.ts +60 -0
  35. package/src/automation/hydraulic-valve-x-2/hydraulic-valve-x-2.ts +101 -0
  36. package/src/automation/shuffle-button/shuffle-button-base.ts +170 -0
  37. package/src/automation/shuffle-button/shuffle-button.css +136 -0
  38. package/src/automation/shuffle-button/shuffle-layout.spec.ts +44 -0
  39. package/src/automation/shuffle-button/shuffle-layout.ts +21 -0
@@ -0,0 +1,12 @@
1
+ import { css } from "lit";
2
+ const componentStyle = css`* {
3
+ -webkit-tap-highlight-color: transparent
4
+ }
5
+ .thumb {
6
+ cursor: default; /* display-only symbol, nothing to select */
7
+ }
8
+ `;
9
+ export {
10
+ componentStyle as default
11
+ };
12
+ //# sourceMappingURL=hydraulic-check-valve.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydraulic-check-valve.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -0,0 +1,33 @@
1
+ import { LitElement } from 'lit';
2
+ import '../../icons/icon-hydraulic-13.js';
3
+ /**
4
+ * `<obc-hydraulic-check-valve>` – Static check valve symbol.
5
+ *
6
+ * Renders the check valve symbol in the same thumb-on-track visual style as
7
+ * the position-selector valve components, sized to a single slot (48px at
8
+ * regular size). A check valve has no selectable positions, so the component
9
+ * is display-only and not focusable.
10
+ *
11
+ * ## Usage Guidelines
12
+ * Use alongside `<obc-hydraulic-valve-4-3>` and `<obc-hydraulic-valve-x-2>`
13
+ * for consistent styling of valves without switchable positions.
14
+ *
15
+ * @experimental
16
+ *
17
+ * @property ariaLabel - Accessible name for the symbol.
18
+ * @property vertical - Rotates the symbol 90° counter-clockwise to match a vertical flow path.
19
+ */
20
+ export declare class ObcHydraulicCheckValve extends LitElement {
21
+ /** Accessible name for the symbol. */
22
+ ariaLabel: string;
23
+ /** Rotates the symbol 90° counter-clockwise to match a vertical flow path. */
24
+ vertical: boolean;
25
+ render(): import('lit-html').TemplateResult<1>;
26
+ static styles: import('lit').CSSResult[];
27
+ }
28
+ declare global {
29
+ interface HTMLElementTagNameMap {
30
+ 'obc-hydraulic-check-valve': ObcHydraulicCheckValve;
31
+ }
32
+ }
33
+ //# sourceMappingURL=hydraulic-check-valve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydraulic-check-valve.d.ts","sourceRoot":"","sources":["../../../src/automation/hydraulic-check-valve/hydraulic-check-valve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAkB,MAAM,KAAK,CAAC;AAMhD,OAAO,kCAAkC,CAAC;AAE1C;;;;;;;;;;;;;;;;GAgBG;AACH,qBACa,sBAAuB,SAAQ,UAAU;IACjB,SAAS,SAAiB;IAElC,QAAQ,UAAS;IAEnC,MAAM;IAqBf,OAAgB,MAAM,4BAAuD;CAC9E;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,2BAA2B,EAAE,sBAAsB,CAAC;KACrD;CACF"}
@@ -0,0 +1,58 @@
1
+ import { unsafeCSS, LitElement, html } from "lit";
2
+ import { property } from "lit/decorators.js";
3
+ import { classMap } from "lit/directives/class-map.js";
4
+ import { customElement } from "../../decorator.js";
5
+ import componentStyle from "../shuffle-button/shuffle-button.css.js";
6
+ import componentStyle$1 from "./hydraulic-check-valve.css.js";
7
+ import "../../icons/icon-hydraulic-13.js";
8
+ var __defProp = Object.defineProperty;
9
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
10
+ var __decorateClass = (decorators, target, key, kind) => {
11
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
12
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
13
+ if (decorator = decorators[i])
14
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
15
+ if (kind && result) __defProp(target, key, result);
16
+ return result;
17
+ };
18
+ let ObcHydraulicCheckValve = class extends LitElement {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.ariaLabel = "Check valve";
22
+ this.vertical = false;
23
+ }
24
+ render() {
25
+ return html`
26
+ <div
27
+ class=${classMap({ shuffle: true, vertical: this.vertical })}
28
+ role="img"
29
+ aria-label=${this.ariaLabel}
30
+ >
31
+ <div class="window">
32
+ <div class="track"></div>
33
+ <div class="thumb selected">
34
+ <div class="visible-wrapper">
35
+ <div class="icon-container">
36
+ <obi-hydraulic-13></obi-hydraulic-13>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ </div>
41
+ </div>
42
+ `;
43
+ }
44
+ };
45
+ ObcHydraulicCheckValve.styles = [unsafeCSS(componentStyle), unsafeCSS(componentStyle$1)];
46
+ __decorateClass([
47
+ property({ type: String })
48
+ ], ObcHydraulicCheckValve.prototype, "ariaLabel", 2);
49
+ __decorateClass([
50
+ property({ type: Boolean })
51
+ ], ObcHydraulicCheckValve.prototype, "vertical", 2);
52
+ ObcHydraulicCheckValve = __decorateClass([
53
+ customElement("obc-hydraulic-check-valve")
54
+ ], ObcHydraulicCheckValve);
55
+ export {
56
+ ObcHydraulicCheckValve
57
+ };
58
+ //# sourceMappingURL=hydraulic-check-valve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydraulic-check-valve.js","sources":["../../../src/automation/hydraulic-check-valve/hydraulic-check-valve.ts"],"sourcesContent":["import {LitElement, html, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {customElement} from '../../decorator.js';\nimport sharedStyle from '../shuffle-button/shuffle-button.css?inline';\nimport componentStyle from './hydraulic-check-valve.css?inline';\nimport '../../icons/icon-hydraulic-13.js';\n\n/**\n * `<obc-hydraulic-check-valve>` – Static check valve symbol.\n *\n * Renders the check valve symbol in the same thumb-on-track visual style as\n * the position-selector valve components, sized to a single slot (48px at\n * regular size). A check valve has no selectable positions, so the component\n * is display-only and not focusable.\n *\n * ## Usage Guidelines\n * Use alongside `<obc-hydraulic-valve-4-3>` and `<obc-hydraulic-valve-x-2>`\n * for consistent styling of valves without switchable positions.\n *\n * @experimental\n *\n * @property ariaLabel - Accessible name for the symbol.\n * @property vertical - Rotates the symbol 90° counter-clockwise to match a vertical flow path.\n */\n@customElement('obc-hydraulic-check-valve')\nexport class ObcHydraulicCheckValve extends LitElement {\n @property({type: String}) override ariaLabel = 'Check valve';\n\n @property({type: Boolean}) vertical = false;\n\n override render() {\n return html`\n <div\n class=${classMap({shuffle: true, vertical: this.vertical})}\n role=\"img\"\n aria-label=${this.ariaLabel}\n >\n <div class=\"window\">\n <div class=\"track\"></div>\n <div class=\"thumb selected\">\n <div class=\"visible-wrapper\">\n <div class=\"icon-container\">\n <obi-hydraulic-13></obi-hydraulic-13>\n </div>\n </div>\n </div>\n </div>\n </div>\n `;\n }\n\n static override styles = [unsafeCSS(sharedStyle), unsafeCSS(componentStyle)];\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-hydraulic-check-valve': ObcHydraulicCheckValve;\n }\n}\n"],"names":["sharedStyle","componentStyle"],"mappings":";;;;;;;;;;;;;;;;;AA0BO,IAAM,yBAAN,cAAqC,WAAW;AAAA,EAAhD,cAAA;AAAA,UAAA,GAAA,SAAA;AACqB,SAAS,YAAY;AAEpB,SAAA,WAAW;AAAA,EAAA;AAAA,EAE7B,SAAS;AAChB,WAAO;AAAA;AAAA,gBAEK,SAAS,EAAC,SAAS,MAAM,UAAU,KAAK,UAAS,CAAC;AAAA;AAAA,qBAE7C,KAAK,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcjC;AAGF;AA3Ba,uBA0BK,SAAS,CAAC,UAAUA,cAAW,GAAG,UAAUC,gBAAc,CAAC;AAzBxC,gBAAA;AAAA,EAAlC,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GADb,uBACwB,WAAA,aAAA,CAAA;AAER,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAHd,uBAGgB,WAAA,YAAA,CAAA;AAHhB,yBAAN,gBAAA;AAAA,EADN,cAAc,2BAA2B;AAAA,GAC7B,sBAAA;"}
@@ -0,0 +1,77 @@
1
+ import { TemplateResult } from 'lit';
2
+ import { ObcShuffleButtonBase } from '../shuffle-button/shuffle-button-base.js';
3
+ import '../../icons/icon-hydraulic-01.js';
4
+ import '../../icons/icon-hydraulic-02.js';
5
+ import '../../icons/icon-hydraulic-05.js';
6
+ import '../../icons/icon-hydraulic-06.js';
7
+ import '../../icons/icon-hydraulic-07.js';
8
+ import '../../icons/icon-hydraulic-08.js';
9
+ import '../../icons/icon-hydraulic-16.js';
10
+ /**
11
+ * Detail payload for the `position-selected` event: the zero-based position
12
+ * the user requested (0 = left, 1 = center, 2 = right).
13
+ *
14
+ * Declared here rather than imported from the base: the wrapper generators
15
+ * resolve event types in the component's own module only.
16
+ */
17
+ export interface PositionSelectedDetail {
18
+ position: number;
19
+ }
20
+ /**
21
+ * Center-position symbol variant of `<obc-hydraulic-valve-4-3>`.
22
+ * Each value maps to a different center (neutral) position symbol.
23
+ */
24
+ export declare enum HydraulicValve43Type {
25
+ One = "1",
26
+ Two = "2",
27
+ Three = "3",
28
+ Four = "4",
29
+ Five = "5"
30
+ }
31
+ /**
32
+ * `<obc-hydraulic-valve-4-3>` – Position selector symbol for a 4/3 directional valve.
33
+ *
34
+ * Shows the valve's three positions as icon thumbs on a shared track. The
35
+ * selected position always occupies the fixed center slot; the other position
36
+ * thumbs keep their logical order and shift to either side, so the component's
37
+ * total width never changes (five 48px slots at regular size).
38
+ *
39
+ * ## Features / Variants
40
+ * - `type` selects the center-position symbol (five variants).
41
+ * - `vertical` stacks the positions top to bottom and rotates the symbols to
42
+ * match a vertical flow path.
43
+ * - Controlled selection: clicking an option or pressing arrow keys fires
44
+ * `position-selected` with the requested position; the application updates
45
+ * `selectedPosition` once the change is confirmed.
46
+ * - Scales with the component size classes (`obc-component-size-*`).
47
+ *
48
+ * ## Usage Guidelines
49
+ * Use to display and command the position of a 4/3 directional valve. For
50
+ * two-position valves use `<obc-hydraulic-valve-x-2>`; for a static check
51
+ * valve symbol use `<obc-hydraulic-check-valve>`. Bind `selectedPosition` to
52
+ * the position the device reports, not to the last request, so the symbol
53
+ * never shows a position the valve has not reached.
54
+ *
55
+ * ## Events
56
+ * - `position-selected` – Fired when the user requests a position (click or
57
+ * arrow key). Detail: `{position: number}` (0 = left, 1 = center, 2 = right).
58
+ *
59
+ * @property type - Center-position symbol variant.
60
+ * @property ariaLabel - Accessible name for the control.
61
+ * @fires {CustomEvent<PositionSelectedDetail>} position-selected - Fired when the user requests a position (click or arrow key).
62
+ * @experimental
63
+ */
64
+ export declare class ObcHydraulicValve43 extends ObcShuffleButtonBase {
65
+ /** Center-position symbol variant. */
66
+ type: HydraulicValve43Type;
67
+ /** Accessible name for the control. */
68
+ ariaLabel: string;
69
+ protected get positionCount(): number;
70
+ protected renderPositionIcon(position: number): TemplateResult;
71
+ }
72
+ declare global {
73
+ interface HTMLElementTagNameMap {
74
+ 'obc-hydraulic-valve-4-3': ObcHydraulicValve43;
75
+ }
76
+ }
77
+ //# sourceMappingURL=hydraulic-valve-4-3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydraulic-valve-4-3.d.ts","sourceRoot":"","sources":["../../../src/automation/hydraulic-valve-4-3/hydraulic-valve-4-3.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,KAAK,CAAC;AAGxC,OAAO,EAAC,oBAAoB,EAAC,MAAM,0CAA0C,CAAC;AAC9E,OAAO,kCAAkC,CAAC;AAC1C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,kCAAkC,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,oBAAY,oBAAoB;IAC9B,GAAG,MAAM;IACT,GAAG,MAAM;IACT,KAAK,MAAM;IACX,IAAI,MAAM;IACV,IAAI,MAAM;CACX;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBACa,mBAAoB,SAAQ,oBAAoB;IACjC,IAAI,EAAE,oBAAoB,CACzB;IAEQ,SAAS,SAAyB;IAErE,cAAuB,aAAa,IAAI,MAAM,CAE7C;cAEkB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc;CAqBxE;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,yBAAyB,EAAE,mBAAmB,CAAC;KAChD;CACF"}
@@ -0,0 +1,74 @@
1
+ import { html } from "lit";
2
+ import { property } from "lit/decorators.js";
3
+ import { customElement } from "../../decorator.js";
4
+ import { ObcShuffleButtonBase } from "../shuffle-button/shuffle-button-base.js";
5
+ import "../../icons/icon-hydraulic-01.js";
6
+ import "../../icons/icon-hydraulic-02.js";
7
+ import "../../icons/icon-hydraulic-05.js";
8
+ import "../../icons/icon-hydraulic-06.js";
9
+ import "../../icons/icon-hydraulic-07.js";
10
+ import "../../icons/icon-hydraulic-08.js";
11
+ import "../../icons/icon-hydraulic-16.js";
12
+ var __defProp = Object.defineProperty;
13
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
14
+ var __decorateClass = (decorators, target, key, kind) => {
15
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
16
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
17
+ if (decorator = decorators[i])
18
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
19
+ if (kind && result) __defProp(target, key, result);
20
+ return result;
21
+ };
22
+ var HydraulicValve43Type = /* @__PURE__ */ ((HydraulicValve43Type2) => {
23
+ HydraulicValve43Type2["One"] = "1";
24
+ HydraulicValve43Type2["Two"] = "2";
25
+ HydraulicValve43Type2["Three"] = "3";
26
+ HydraulicValve43Type2["Four"] = "4";
27
+ HydraulicValve43Type2["Five"] = "5";
28
+ return HydraulicValve43Type2;
29
+ })(HydraulicValve43Type || {});
30
+ let ObcHydraulicValve43 = class extends ObcShuffleButtonBase {
31
+ constructor() {
32
+ super(...arguments);
33
+ this.type = "1";
34
+ this.ariaLabel = "Hydraulic 4/3 valve";
35
+ }
36
+ get positionCount() {
37
+ return 3;
38
+ }
39
+ renderPositionIcon(position) {
40
+ if (position === 0) {
41
+ return html`<obi-hydraulic-02></obi-hydraulic-02>`;
42
+ }
43
+ if (position === 2) {
44
+ return html`<obi-hydraulic-07></obi-hydraulic-07>`;
45
+ }
46
+ switch (this.type) {
47
+ case "2":
48
+ return html`<obi-hydraulic-16></obi-hydraulic-16>`;
49
+ case "3":
50
+ return html`<obi-hydraulic-08></obi-hydraulic-08>`;
51
+ case "4":
52
+ return html`<obi-hydraulic-05></obi-hydraulic-05>`;
53
+ case "5":
54
+ return html`<obi-hydraulic-06></obi-hydraulic-06>`;
55
+ case "1":
56
+ default:
57
+ return html`<obi-hydraulic-01></obi-hydraulic-01>`;
58
+ }
59
+ }
60
+ };
61
+ __decorateClass([
62
+ property({ type: String })
63
+ ], ObcHydraulicValve43.prototype, "type", 2);
64
+ __decorateClass([
65
+ property({ type: String })
66
+ ], ObcHydraulicValve43.prototype, "ariaLabel", 2);
67
+ ObcHydraulicValve43 = __decorateClass([
68
+ customElement("obc-hydraulic-valve-4-3")
69
+ ], ObcHydraulicValve43);
70
+ export {
71
+ HydraulicValve43Type,
72
+ ObcHydraulicValve43
73
+ };
74
+ //# sourceMappingURL=hydraulic-valve-4-3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydraulic-valve-4-3.js","sources":["../../../src/automation/hydraulic-valve-4-3/hydraulic-valve-4-3.ts"],"sourcesContent":["import {html} from 'lit';\nimport type {TemplateResult} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {customElement} from '../../decorator.js';\nimport {ObcShuffleButtonBase} from '../shuffle-button/shuffle-button-base.js';\nimport '../../icons/icon-hydraulic-01.js';\nimport '../../icons/icon-hydraulic-02.js';\nimport '../../icons/icon-hydraulic-05.js';\nimport '../../icons/icon-hydraulic-06.js';\nimport '../../icons/icon-hydraulic-07.js';\nimport '../../icons/icon-hydraulic-08.js';\nimport '../../icons/icon-hydraulic-16.js';\n\n/**\n * Detail payload for the `position-selected` event: the zero-based position\n * the user requested (0 = left, 1 = center, 2 = right).\n *\n * Declared here rather than imported from the base: the wrapper generators\n * resolve event types in the component's own module only.\n */\nexport interface PositionSelectedDetail {\n position: number;\n}\n\n/**\n * Center-position symbol variant of `<obc-hydraulic-valve-4-3>`.\n * Each value maps to a different center (neutral) position symbol.\n */\nexport enum HydraulicValve43Type {\n One = '1',\n Two = '2',\n Three = '3',\n Four = '4',\n Five = '5',\n}\n\n/**\n * `<obc-hydraulic-valve-4-3>` – Position selector symbol for a 4/3 directional valve.\n *\n * Shows the valve's three positions as icon thumbs on a shared track. The\n * selected position always occupies the fixed center slot; the other position\n * thumbs keep their logical order and shift to either side, so the component's\n * total width never changes (five 48px slots at regular size).\n *\n * ## Features / Variants\n * - `type` selects the center-position symbol (five variants).\n * - `vertical` stacks the positions top to bottom and rotates the symbols to\n * match a vertical flow path.\n * - Controlled selection: clicking an option or pressing arrow keys fires\n * `position-selected` with the requested position; the application updates\n * `selectedPosition` once the change is confirmed.\n * - Scales with the component size classes (`obc-component-size-*`).\n *\n * ## Usage Guidelines\n * Use to display and command the position of a 4/3 directional valve. For\n * two-position valves use `<obc-hydraulic-valve-x-2>`; for a static check\n * valve symbol use `<obc-hydraulic-check-valve>`. Bind `selectedPosition` to\n * the position the device reports, not to the last request, so the symbol\n * never shows a position the valve has not reached.\n *\n * ## Events\n * - `position-selected` – Fired when the user requests a position (click or\n * arrow key). Detail: `{position: number}` (0 = left, 1 = center, 2 = right).\n *\n * @property type - Center-position symbol variant.\n * @property ariaLabel - Accessible name for the control.\n * @fires {CustomEvent<PositionSelectedDetail>} position-selected - Fired when the user requests a position (click or arrow key).\n * @experimental\n */\n@customElement('obc-hydraulic-valve-4-3')\nexport class ObcHydraulicValve43 extends ObcShuffleButtonBase {\n @property({type: String}) type: HydraulicValve43Type =\n HydraulicValve43Type.One;\n\n @property({type: String}) override ariaLabel = 'Hydraulic 4/3 valve';\n\n protected override get positionCount(): number {\n return 3;\n }\n\n protected override renderPositionIcon(position: number): TemplateResult {\n if (position === 0) {\n return html`<obi-hydraulic-02></obi-hydraulic-02>`;\n }\n if (position === 2) {\n return html`<obi-hydraulic-07></obi-hydraulic-07>`;\n }\n switch (this.type) {\n case HydraulicValve43Type.Two:\n return html`<obi-hydraulic-16></obi-hydraulic-16>`;\n case HydraulicValve43Type.Three:\n return html`<obi-hydraulic-08></obi-hydraulic-08>`;\n case HydraulicValve43Type.Four:\n return html`<obi-hydraulic-05></obi-hydraulic-05>`;\n case HydraulicValve43Type.Five:\n return html`<obi-hydraulic-06></obi-hydraulic-06>`;\n case HydraulicValve43Type.One:\n default:\n return html`<obi-hydraulic-01></obi-hydraulic-01>`;\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-hydraulic-valve-4-3': ObcHydraulicValve43;\n }\n}\n"],"names":["HydraulicValve43Type"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4BO,IAAK,yCAAAA,0BAAL;AACLA,wBAAA,KAAA,IAAM;AACNA,wBAAA,KAAA,IAAM;AACNA,wBAAA,OAAA,IAAQ;AACRA,wBAAA,MAAA,IAAO;AACPA,wBAAA,MAAA,IAAO;AALG,SAAAA;AAAA,GAAA,wBAAA,CAAA,CAAA;AA0CL,IAAM,sBAAN,cAAkC,qBAAqB;AAAA,EAAvD,cAAA;AAAA,UAAA,GAAA,SAAA;AACqB,SAAA,OACxB;AAEwB,SAAS,YAAY;AAAA,EAAA;AAAA,EAE/C,IAAuB,gBAAwB;AAC7C,WAAO;AAAA,EACT;AAAA,EAEmB,mBAAmB,UAAkC;AACtE,QAAI,aAAa,GAAG;AAClB,aAAO;AAAA,IACT;AACA,QAAI,aAAa,GAAG;AAClB,aAAO;AAAA,IACT;AACA,YAAQ,KAAK,MAAA;AAAA,MACX,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AAAA,MACL;AACE,eAAO;AAAA,IAAA;AAAA,EAEb;AACF;AA9B4B,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GADb,oBACe,WAAA,QAAA,CAAA;AAGS,gBAAA;AAAA,EAAlC,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAJb,oBAIwB,WAAA,aAAA,CAAA;AAJxB,sBAAN,gBAAA;AAAA,EADN,cAAc,yBAAyB;AAAA,GAC3B,mBAAA;"}
@@ -0,0 +1,74 @@
1
+ import { TemplateResult } from 'lit';
2
+ import { ObcShuffleButtonBase } from '../shuffle-button/shuffle-button-base.js';
3
+ import '../../icons/icon-hydraulic-01.js';
4
+ import '../../icons/icon-hydraulic-02.js';
5
+ import '../../icons/icon-hydraulic-07.js';
6
+ import '../../icons/icon-hydraulic-10.js';
7
+ import '../../icons/icon-hydraulic-11.js';
8
+ /**
9
+ * Detail payload for the `position-selected` event: the zero-based position
10
+ * the user requested (0 = first, 1 = second).
11
+ *
12
+ * Declared here rather than imported from the base: the wrapper generators
13
+ * resolve event types in the component's own module only.
14
+ */
15
+ export interface PositionSelectedDetail {
16
+ position: number;
17
+ }
18
+ /**
19
+ * Port/position configuration of `<obc-hydraulic-valve-x-2>`:
20
+ * `2/2`, `3/2` or `4/2` (ports/positions). Each value maps to its own pair of
21
+ * position symbols.
22
+ */
23
+ export declare enum HydraulicValveX2Type {
24
+ TwoTwo = "2/2",
25
+ ThreeTwo = "3/2",
26
+ FourTwo = "4/2"
27
+ }
28
+ /**
29
+ * `<obc-hydraulic-valve-x-2>` – Position selector symbol for a two-position valve.
30
+ *
31
+ * Shows the valve's two positions as icon thumbs on a shared track. The
32
+ * selected position always occupies the fixed center slot; the option thumb
33
+ * sits to its left or right depending on logical order, and an empty spacer
34
+ * slot keeps the total width constant (three 48px slots at regular size).
35
+ *
36
+ * ## Features / Variants
37
+ * - `type` selects the port/position configuration: `2/2`, `3/2` or `4/2`.
38
+ * - `vertical` stacks the positions top to bottom and rotates the symbols to
39
+ * match a vertical flow path.
40
+ * - Controlled selection: clicking the option or pressing arrow keys fires
41
+ * `position-selected`; the application updates `selectedPosition` once the
42
+ * change is confirmed.
43
+ * - Scales with the component size classes (`obc-component-size-*`).
44
+ *
45
+ * ## Usage Guidelines
46
+ * Use to display and command the position of a two-position valve. For 4/3
47
+ * directional valves use `<obc-hydraulic-valve-4-3>`; for a static check
48
+ * valve symbol use `<obc-hydraulic-check-valve>`. Bind `selectedPosition` to
49
+ * the position the device reports, not to the last request, so the symbol
50
+ * never shows a position the valve has not reached.
51
+ *
52
+ * ## Events
53
+ * - `position-selected` – Fired when the user requests a position (click or
54
+ * arrow key). Detail: `{position: number}` (0 = first, 1 = second).
55
+ *
56
+ * @property type - Port/position configuration.
57
+ * @property ariaLabel - Accessible name for the control.
58
+ * @fires {CustomEvent<PositionSelectedDetail>} position-selected - Fired when the user requests a position (click or arrow key).
59
+ * @experimental
60
+ */
61
+ export declare class ObcHydraulicValveX2 extends ObcShuffleButtonBase {
62
+ /** Port/position configuration. */
63
+ type: HydraulicValveX2Type;
64
+ /** Accessible name for the control. */
65
+ ariaLabel: string;
66
+ protected get positionCount(): number;
67
+ protected renderPositionIcon(position: number): TemplateResult;
68
+ }
69
+ declare global {
70
+ interface HTMLElementTagNameMap {
71
+ 'obc-hydraulic-valve-x-2': ObcHydraulicValveX2;
72
+ }
73
+ }
74
+ //# sourceMappingURL=hydraulic-valve-x-2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydraulic-valve-x-2.d.ts","sourceRoot":"","sources":["../../../src/automation/hydraulic-valve-x-2/hydraulic-valve-x-2.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,KAAK,CAAC;AAGxC,OAAO,EAAC,oBAAoB,EAAC,MAAM,0CAA0C,CAAC;AAC9E,OAAO,kCAAkC,CAAC;AAC1C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,kCAAkC,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,oBAAY,oBAAoB;IAC9B,MAAM,QAAQ;IACd,QAAQ,QAAQ;IAChB,OAAO,QAAQ;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBACa,mBAAoB,SAAQ,oBAAoB;IACjC,IAAI,EAAE,oBAAoB,CACtB;IAEK,SAAS,SAAqB;IAEjE,cAAuB,aAAa,IAAI,MAAM,CAE7C;cAEkB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc;CAiBxE;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,yBAAyB,EAAE,mBAAmB,CAAC;KAChD;CACF"}
@@ -0,0 +1,60 @@
1
+ import { html } from "lit";
2
+ import { property } from "lit/decorators.js";
3
+ import { customElement } from "../../decorator.js";
4
+ import { ObcShuffleButtonBase } from "../shuffle-button/shuffle-button-base.js";
5
+ import "../../icons/icon-hydraulic-01.js";
6
+ import "../../icons/icon-hydraulic-02.js";
7
+ import "../../icons/icon-hydraulic-07.js";
8
+ import "../../icons/icon-hydraulic-10.js";
9
+ import "../../icons/icon-hydraulic-11.js";
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __decorateClass = (decorators, target, key, kind) => {
13
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
14
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
15
+ if (decorator = decorators[i])
16
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
17
+ if (kind && result) __defProp(target, key, result);
18
+ return result;
19
+ };
20
+ var HydraulicValveX2Type = /* @__PURE__ */ ((HydraulicValveX2Type2) => {
21
+ HydraulicValveX2Type2["TwoTwo"] = "2/2";
22
+ HydraulicValveX2Type2["ThreeTwo"] = "3/2";
23
+ HydraulicValveX2Type2["FourTwo"] = "4/2";
24
+ return HydraulicValveX2Type2;
25
+ })(HydraulicValveX2Type || {});
26
+ let ObcHydraulicValveX2 = class extends ObcShuffleButtonBase {
27
+ constructor() {
28
+ super(...arguments);
29
+ this.type = "2/2";
30
+ this.ariaLabel = "Hydraulic valve";
31
+ }
32
+ get positionCount() {
33
+ return 2;
34
+ }
35
+ renderPositionIcon(position) {
36
+ switch (this.type) {
37
+ case "3/2":
38
+ return position === 0 ? html`<obi-hydraulic-11></obi-hydraulic-11>` : html`<obi-hydraulic-10></obi-hydraulic-10>`;
39
+ case "4/2":
40
+ return position === 0 ? html`<obi-hydraulic-02></obi-hydraulic-02>` : html`<obi-hydraulic-07></obi-hydraulic-07>`;
41
+ case "2/2":
42
+ default:
43
+ return position === 0 ? html`<obi-hydraulic-02></obi-hydraulic-02>` : html`<obi-hydraulic-01></obi-hydraulic-01>`;
44
+ }
45
+ }
46
+ };
47
+ __decorateClass([
48
+ property({ type: String })
49
+ ], ObcHydraulicValveX2.prototype, "type", 2);
50
+ __decorateClass([
51
+ property({ type: String })
52
+ ], ObcHydraulicValveX2.prototype, "ariaLabel", 2);
53
+ ObcHydraulicValveX2 = __decorateClass([
54
+ customElement("obc-hydraulic-valve-x-2")
55
+ ], ObcHydraulicValveX2);
56
+ export {
57
+ HydraulicValveX2Type,
58
+ ObcHydraulicValveX2
59
+ };
60
+ //# sourceMappingURL=hydraulic-valve-x-2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydraulic-valve-x-2.js","sources":["../../../src/automation/hydraulic-valve-x-2/hydraulic-valve-x-2.ts"],"sourcesContent":["import {html} from 'lit';\nimport type {TemplateResult} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {customElement} from '../../decorator.js';\nimport {ObcShuffleButtonBase} from '../shuffle-button/shuffle-button-base.js';\nimport '../../icons/icon-hydraulic-01.js';\nimport '../../icons/icon-hydraulic-02.js';\nimport '../../icons/icon-hydraulic-07.js';\nimport '../../icons/icon-hydraulic-10.js';\nimport '../../icons/icon-hydraulic-11.js';\n\n/**\n * Detail payload for the `position-selected` event: the zero-based position\n * the user requested (0 = first, 1 = second).\n *\n * Declared here rather than imported from the base: the wrapper generators\n * resolve event types in the component's own module only.\n */\nexport interface PositionSelectedDetail {\n position: number;\n}\n\n/**\n * Port/position configuration of `<obc-hydraulic-valve-x-2>`:\n * `2/2`, `3/2` or `4/2` (ports/positions). Each value maps to its own pair of\n * position symbols.\n */\nexport enum HydraulicValveX2Type {\n TwoTwo = '2/2',\n ThreeTwo = '3/2',\n FourTwo = '4/2',\n}\n\n/**\n * `<obc-hydraulic-valve-x-2>` – Position selector symbol for a two-position valve.\n *\n * Shows the valve's two positions as icon thumbs on a shared track. The\n * selected position always occupies the fixed center slot; the option thumb\n * sits to its left or right depending on logical order, and an empty spacer\n * slot keeps the total width constant (three 48px slots at regular size).\n *\n * ## Features / Variants\n * - `type` selects the port/position configuration: `2/2`, `3/2` or `4/2`.\n * - `vertical` stacks the positions top to bottom and rotates the symbols to\n * match a vertical flow path.\n * - Controlled selection: clicking the option or pressing arrow keys fires\n * `position-selected`; the application updates `selectedPosition` once the\n * change is confirmed.\n * - Scales with the component size classes (`obc-component-size-*`).\n *\n * ## Usage Guidelines\n * Use to display and command the position of a two-position valve. For 4/3\n * directional valves use `<obc-hydraulic-valve-4-3>`; for a static check\n * valve symbol use `<obc-hydraulic-check-valve>`. Bind `selectedPosition` to\n * the position the device reports, not to the last request, so the symbol\n * never shows a position the valve has not reached.\n *\n * ## Events\n * - `position-selected` – Fired when the user requests a position (click or\n * arrow key). Detail: `{position: number}` (0 = first, 1 = second).\n *\n * @property type - Port/position configuration.\n * @property ariaLabel - Accessible name for the control.\n * @fires {CustomEvent<PositionSelectedDetail>} position-selected - Fired when the user requests a position (click or arrow key).\n * @experimental\n */\n@customElement('obc-hydraulic-valve-x-2')\nexport class ObcHydraulicValveX2 extends ObcShuffleButtonBase {\n @property({type: String}) type: HydraulicValveX2Type =\n HydraulicValveX2Type.TwoTwo;\n\n @property({type: String}) override ariaLabel = 'Hydraulic valve';\n\n protected override get positionCount(): number {\n return 2;\n }\n\n protected override renderPositionIcon(position: number): TemplateResult {\n switch (this.type) {\n case HydraulicValveX2Type.ThreeTwo:\n return position === 0\n ? html`<obi-hydraulic-11></obi-hydraulic-11>`\n : html`<obi-hydraulic-10></obi-hydraulic-10>`;\n case HydraulicValveX2Type.FourTwo:\n return position === 0\n ? html`<obi-hydraulic-02></obi-hydraulic-02>`\n : html`<obi-hydraulic-07></obi-hydraulic-07>`;\n case HydraulicValveX2Type.TwoTwo:\n default:\n return position === 0\n ? html`<obi-hydraulic-02></obi-hydraulic-02>`\n : html`<obi-hydraulic-01></obi-hydraulic-01>`;\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-hydraulic-valve-x-2': ObcHydraulicValveX2;\n }\n}\n"],"names":["HydraulicValveX2Type"],"mappings":";;;;;;;;;;;;;;;;;;;AA2BO,IAAK,yCAAAA,0BAAL;AACLA,wBAAA,QAAA,IAAS;AACTA,wBAAA,UAAA,IAAW;AACXA,wBAAA,SAAA,IAAU;AAHA,SAAAA;AAAA,GAAA,wBAAA,CAAA,CAAA;AAwCL,IAAM,sBAAN,cAAkC,qBAAqB;AAAA,EAAvD,cAAA;AAAA,UAAA,GAAA,SAAA;AACqB,SAAA,OACxB;AAEwB,SAAS,YAAY;AAAA,EAAA;AAAA,EAE/C,IAAuB,gBAAwB;AAC7C,WAAO;AAAA,EACT;AAAA,EAEmB,mBAAmB,UAAkC;AACtE,YAAQ,KAAK,MAAA;AAAA,MACX,KAAK;AACH,eAAO,aAAa,IAChB,8CACA;AAAA,MACN,KAAK;AACH,eAAO,aAAa,IAChB,8CACA;AAAA,MACN,KAAK;AAAA,MACL;AACE,eAAO,aAAa,IAChB,8CACA;AAAA,IAAA;AAAA,EAEV;AACF;AA1B4B,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GADb,oBACe,WAAA,QAAA,CAAA;AAGS,gBAAA;AAAA,EAAlC,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAJb,oBAIwB,WAAA,aAAA,CAAA;AAJxB,sBAAN,gBAAA;AAAA,EADN,cAAc,yBAAyB;AAAA,GAC3B,mBAAA;"}
@@ -0,0 +1,67 @@
1
+ import { LitElement, PropertyValues, TemplateResult } from 'lit';
2
+ /**
3
+ * Detail payload for the `position-selected` event dispatched by
4
+ * shuffle-button components. `position` is the zero-based position the user
5
+ * requested.
6
+ */
7
+ export interface PositionSelectedDetail {
8
+ position: number;
9
+ }
10
+ /**
11
+ * The `position-selected` event dispatched by shuffle-button components.
12
+ */
13
+ export type PositionSelectedEvent = CustomEvent<PositionSelectedDetail>;
14
+ /**
15
+ * Base class for shuffle-button selectors: a control whose selected thumb
16
+ * always occupies the fixed center slot of a (2·n−1)-slot row (or column when
17
+ * `vertical`). Option thumbs keep their logical order and redistribute to
18
+ * either side of the selected thumb; empty spacer slots absorb the remaining
19
+ * length so the total size never changes.
20
+ *
21
+ * ## Controlled selection
22
+ * Clicking an option or pressing an arrow key only fires `position-selected`.
23
+ * The host application sets `selectedPosition` once the device confirms the
24
+ * change, so the control never shows a position the device has not reached.
25
+ *
26
+ * ## Keyboard
27
+ * Follows the WAI-ARIA radio group pattern
28
+ * (https://www.w3.org/WAI/ARIA/apg/patterns/radio/): `role="radiogroup"` with
29
+ * one `role="radio"` thumb per position, a single tab stop on the selected
30
+ * thumb, and Left/Up and Right/Down moving to the previous/next position with
31
+ * wrap-around. Departures: arrow keys request the position rather than moving
32
+ * the checked state (controlled selection above), and focus follows the thumb
33
+ * only once the host confirms it. Space/Enter on a focused thumb request it
34
+ * through the native button click. Home/End are out of scope.
35
+ *
36
+ * Subclasses define `positionCount` and `renderPositionIcon()` and carry the
37
+ * `@fires position-selected` tag: the manifest and the framework wrappers read
38
+ * events from the registered element, not from this base.
39
+ *
40
+ * Not declared `abstract`: the wrapper generators wrap every `LitElement`
41
+ * subclass and pass its constructor as a concrete `Constructor<T>`, so the
42
+ * default implementations below stand in for abstract members (same as
43
+ * `ObcAbstractAutomationButton`).
44
+ *
45
+ * @property selectedPosition - Zero-based index of the currently selected position. Out-of-range values are clamped.
46
+ * @property vertical - Lays the control out vertically: positions stack top to bottom and the position symbols rotate 90° counter-clockwise to match a vertical flow path.
47
+ * @property ariaLabel - Accessible name for the radio group (the control is icon-only). Concrete components override the default with a device-specific name.
48
+ */
49
+ export declare class ObcShuffleButtonBase extends LitElement {
50
+ /** Zero-based index of the currently selected position. Out-of-range values are clamped. */
51
+ selectedPosition: number;
52
+ /** Lays the control out vertically: positions stack top to bottom and the position symbols rotate 90° counter-clockwise to match a vertical flow path. */
53
+ vertical: boolean;
54
+ /** Accessible name for the radio group (the control is icon-only). Concrete components override the default with a device-specific name. */
55
+ ariaLabel: string;
56
+ private suppressHover;
57
+ protected get positionCount(): number;
58
+ protected renderPositionIcon(_position: number): TemplateResult;
59
+ render(): TemplateResult<1>;
60
+ private renderThumb;
61
+ private requestPosition;
62
+ private restoreHover;
63
+ private handleKeydown;
64
+ protected updated(changed: PropertyValues): void;
65
+ static styles: import('lit').CSSResult;
66
+ }
67
+ //# sourceMappingURL=shuffle-button-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shuffle-button-base.d.ts","sourceRoot":"","sources":["../../../src/automation/shuffle-button/shuffle-button-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAkB,MAAM,KAAK,CAAC;AAChD,OAAO,KAAK,EAAC,cAAc,EAAE,cAAc,EAAC,MAAM,KAAK,CAAC;AAUxD;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC,sBAAsB,CAAC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBAAa,oBAAqB,SAAQ,UAAU;IACxB,gBAAgB,SAAK;IAEpB,QAAQ,UAAS;IAET,SAAS,SAAuB;IAE1D,OAAO,CAAC,aAAa,CAAS;IAEvC,SAAS,KAAK,aAAa,IAAI,MAAM,CAEpC;IAED,SAAS,CAAC,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc;IAItD,MAAM;IA4Bf,OAAO,CAAC,WAAW;IAkBnB,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,aAAa;cAeF,OAAO,CAAC,OAAO,EAAE,cAAc;IAWlD,OAAgB,MAAM,0BAA6B;CACpD"}
@@ -0,0 +1,126 @@
1
+ import { LitElement, html, unsafeCSS } from "lit";
2
+ import { property, state } from "lit/decorators.js";
3
+ import { classMap } from "lit/directives/class-map.js";
4
+ import componentStyle from "./shuffle-button.css.js";
5
+ import { clampPosition, shuffleSlotCount, shuffleWindowOffset } from "./shuffle-layout.js";
6
+ var __defProp = Object.defineProperty;
7
+ var __decorateClass = (decorators, target, key, kind) => {
8
+ var result = void 0;
9
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
10
+ if (decorator = decorators[i])
11
+ result = decorator(target, key, result) || result;
12
+ if (result) __defProp(target, key, result);
13
+ return result;
14
+ };
15
+ const _ObcShuffleButtonBase = class _ObcShuffleButtonBase extends LitElement {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.selectedPosition = 1;
19
+ this.vertical = false;
20
+ this.ariaLabel = "Position selector";
21
+ this.suppressHover = false;
22
+ }
23
+ get positionCount() {
24
+ return 1;
25
+ }
26
+ renderPositionIcon(_position) {
27
+ return html``;
28
+ }
29
+ render() {
30
+ const count = this.positionCount;
31
+ const selected = clampPosition(count, this.selectedPosition);
32
+ return html`
33
+ <div
34
+ class=${classMap({ shuffle: true, vertical: this.vertical })}
35
+ role="radiogroup"
36
+ aria-label=${this.ariaLabel}
37
+ aria-orientation=${this.vertical ? "vertical" : "horizontal"}
38
+ style="--_shuffle-slot-count: ${shuffleSlotCount(
39
+ count
40
+ )}; --_shuffle-window-offset: ${shuffleWindowOffset(
41
+ count,
42
+ selected
43
+ )};${this.suppressHover ? " --obc-can-hover: 0;" : ""}"
44
+ @keydown=${this.handleKeydown}
45
+ @pointermove=${this.restoreHover}
46
+ >
47
+ <div class="window">
48
+ <div class="track"></div>
49
+ ${Array.from(
50
+ { length: count },
51
+ (_, position) => this.renderThumb(position, selected)
52
+ )}
53
+ </div>
54
+ </div>
55
+ `;
56
+ }
57
+ renderThumb(position, selected) {
58
+ const isSelected = position === selected;
59
+ return html`
60
+ <button
61
+ class=${classMap({ thumb: true, selected: isSelected })}
62
+ type="button"
63
+ role="radio"
64
+ aria-checked=${isSelected}
65
+ tabindex=${isSelected ? 0 : -1}
66
+ @click=${() => this.requestPosition(position)}
67
+ >
68
+ <div class="visible-wrapper">
69
+ <div class="icon-container">${this.renderPositionIcon(position)}</div>
70
+ </div>
71
+ </button>
72
+ `;
73
+ }
74
+ requestPosition(position) {
75
+ if (position === clampPosition(this.positionCount, this.selectedPosition)) {
76
+ return;
77
+ }
78
+ this.suppressHover = true;
79
+ const event = new CustomEvent("position-selected", {
80
+ detail: { position },
81
+ bubbles: true,
82
+ composed: true
83
+ });
84
+ this.dispatchEvent(event);
85
+ }
86
+ restoreHover() {
87
+ this.suppressHover = false;
88
+ }
89
+ handleKeydown(event) {
90
+ let delta;
91
+ if (event.key === "ArrowRight" || event.key === "ArrowDown") {
92
+ delta = 1;
93
+ } else if (event.key === "ArrowLeft" || event.key === "ArrowUp") {
94
+ delta = -1;
95
+ } else {
96
+ return;
97
+ }
98
+ event.preventDefault();
99
+ const count = this.positionCount;
100
+ const selected = clampPosition(count, this.selectedPosition);
101
+ this.requestPosition((selected + delta + count) % count);
102
+ }
103
+ updated(changed) {
104
+ if (changed.has("selectedPosition") && this.shadowRoot?.activeElement instanceof HTMLElement) {
105
+ this.shadowRoot.querySelector("button.thumb.selected")?.focus();
106
+ }
107
+ }
108
+ };
109
+ _ObcShuffleButtonBase.styles = unsafeCSS(componentStyle);
110
+ let ObcShuffleButtonBase = _ObcShuffleButtonBase;
111
+ __decorateClass([
112
+ property({ type: Number })
113
+ ], ObcShuffleButtonBase.prototype, "selectedPosition");
114
+ __decorateClass([
115
+ property({ type: Boolean })
116
+ ], ObcShuffleButtonBase.prototype, "vertical");
117
+ __decorateClass([
118
+ property({ type: String })
119
+ ], ObcShuffleButtonBase.prototype, "ariaLabel");
120
+ __decorateClass([
121
+ state()
122
+ ], ObcShuffleButtonBase.prototype, "suppressHover");
123
+ export {
124
+ ObcShuffleButtonBase
125
+ };
126
+ //# sourceMappingURL=shuffle-button-base.js.map