@oicl/openbridge-webcomponents-full-bundle 2.2.0-next.21 → 2.2.0-next.22

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 (55) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +113 -56
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +49 -21
  4. package/dist/automation/automation-tank/automation-tank.d.ts.map +1 -1
  5. package/dist/automation/automation-tank/automation-tank.js +2 -1
  6. package/dist/automation/automation-tank/automation-tank.js.map +1 -1
  7. package/dist/building-blocks/bar-horizontal/bar-horizontal.d.ts +4 -2
  8. package/dist/building-blocks/bar-horizontal/bar-horizontal.d.ts.map +1 -1
  9. package/dist/building-blocks/bar-horizontal/bar-horizontal.js +12 -6
  10. package/dist/building-blocks/bar-horizontal/bar-horizontal.js.map +1 -1
  11. package/dist/building-blocks/bar-vertical/bar-vertical.d.ts +4 -2
  12. package/dist/building-blocks/bar-vertical/bar-vertical.d.ts.map +1 -1
  13. package/dist/building-blocks/bar-vertical/bar-vertical.js +12 -6
  14. package/dist/building-blocks/bar-vertical/bar-vertical.js.map +1 -1
  15. package/dist/building-blocks/external-scale/external-scale.d.ts +21 -3
  16. package/dist/building-blocks/external-scale/external-scale.d.ts.map +1 -1
  17. package/dist/building-blocks/external-scale/external-scale.js +40 -17
  18. package/dist/building-blocks/external-scale/external-scale.js.map +1 -1
  19. package/dist/navigation-instruments/gauge-horizontal/gauge-horizontal.d.ts +4 -2
  20. package/dist/navigation-instruments/gauge-horizontal/gauge-horizontal.d.ts.map +1 -1
  21. package/dist/navigation-instruments/gauge-horizontal/gauge-horizontal.js +14 -6
  22. package/dist/navigation-instruments/gauge-horizontal/gauge-horizontal.js.map +1 -1
  23. package/dist/navigation-instruments/gauge-vertical/gauge-vertical.d.ts +4 -2
  24. package/dist/navigation-instruments/gauge-vertical/gauge-vertical.d.ts.map +1 -1
  25. package/dist/navigation-instruments/gauge-vertical/gauge-vertical.js +14 -6
  26. package/dist/navigation-instruments/gauge-vertical/gauge-vertical.js.map +1 -1
  27. package/dist/svghelpers/advice-linear.d.ts +7 -0
  28. package/dist/svghelpers/advice-linear.d.ts.map +1 -1
  29. package/dist/svghelpers/advice-linear.js +14 -10
  30. package/dist/svghelpers/advice-linear.js.map +1 -1
  31. package/dist/svghelpers/advice-patterns.d.ts +2 -2
  32. package/dist/svghelpers/advice-patterns.d.ts.map +1 -1
  33. package/dist/svghelpers/advice-patterns.js +6 -4
  34. package/dist/svghelpers/advice-patterns.js.map +1 -1
  35. package/package.json +1 -1
  36. package/src/automation/automation-tank/automation-tank.ts +4 -0
  37. package/src/building-blocks/bar-horizontal/bar-horizontal-fixed-aspect.spec.ts +50 -0
  38. package/src/building-blocks/bar-horizontal/bar-horizontal.stories.ts +6 -0
  39. package/src/building-blocks/bar-horizontal/bar-horizontal.ts +22 -9
  40. package/src/building-blocks/bar-vertical/bar-vertical-dimensions.spec.ts +36 -0
  41. package/src/building-blocks/bar-vertical/bar-vertical-fixed-aspect.spec.ts +49 -0
  42. package/src/building-blocks/bar-vertical/bar-vertical.stories.ts +6 -0
  43. package/src/building-blocks/bar-vertical/bar-vertical.ts +22 -9
  44. package/src/building-blocks/external-scale/external-scale.spec.ts +151 -0
  45. package/src/building-blocks/external-scale/external-scale.stories.ts +6 -0
  46. package/src/building-blocks/external-scale/external-scale.ts +86 -40
  47. package/src/navigation-instruments/gauge-horizontal/gauge-horizontal.spec.ts +55 -0
  48. package/src/navigation-instruments/gauge-horizontal/gauge-horizontal.stories.ts +2 -0
  49. package/src/navigation-instruments/gauge-horizontal/gauge-horizontal.ts +24 -9
  50. package/src/navigation-instruments/gauge-trend/gauge-trend.stories.ts +25 -0
  51. package/src/navigation-instruments/gauge-vertical/gauge-vertical.spec.ts +55 -0
  52. package/src/navigation-instruments/gauge-vertical/gauge-vertical.stories.ts +2 -0
  53. package/src/navigation-instruments/gauge-vertical/gauge-vertical.ts +24 -9
  54. package/src/svghelpers/advice-linear.ts +25 -11
  55. package/src/svghelpers/advice-patterns.ts +13 -5
@@ -133,8 +133,10 @@ export declare class ObcGaugeHorizontal extends ObcGaugeHorizontal_base {
133
133
  */
134
134
  scaleReferenceSize: number;
135
135
  private _scale;
136
- /** The drawing's height in viewBox units, kept from the last render for the scale measurement. */
137
- private _viewBoxThickness;
136
+ /** The last render's layout inputs, for the scale measurement. */
137
+ private _layoutConfig?;
138
+ /** The drawing's height in viewBox units at a scale: the advice column is pixels, so it depends on it. */
139
+ private _thicknessAt;
138
140
  private _resizeController;
139
141
  /** Show numerical value labels at primary tickmarks */
140
142
  showLabels: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"gauge-horizontal.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/gauge-horizontal/gauge-horizontal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAO,MAAM,KAAK,CAAC;AAErC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,KAAK,CAAC;AAIxC,OAAO,EACL,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACT,MAAM,aAAa,CAAC;AAErB,OAAO,EASL,SAAS,EACT,QAAQ,EACR,cAAc,EAEd,iBAAiB,EAClB,MAAM,wDAAwD,CAAC;AAMhE,OAAO,EACL,SAAS,EACT,QAAQ,EACR,cAAc,EACd,UAAU,EACV,oBAAoB,EACpB,eAAe,EACf,iBAAiB,GAClB,CAAC;;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4GG;AACH,qBACa,kBAAmB,SAAQ,uBAIvC;IAC2B,QAAQ,SAAK;IACb,QAAQ,SAAO;IACd,OAAO,UAAS;IAE3C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAO;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmC;IA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AG,IAAI;IAUzC,OAAO,CAAC,OAAO,EAAE,cAAc;IAoCxC;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;cA2CL,gBAAgB;IAI1B,iBAAiB,IAAI,IAAI;IAOlC,qGAAqG;IACrG,OAAO,CAAC,eAAe,CAAC,CAGtB;IAEF;;;;OAIG;IACH,OAAO,CAAC,4BAA4B;IAiBpC,OAAO,CAAC,6BAA6B;IASrC,yFAAyF;IACzF,OAAO,CAAC,aAAa;IAarB,sDAAsD;IACtD,OAAO,CAAC,2BAA2B;CAQpC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,sBAAsB,EAAE,kBAAkB,CAAC;KAC5C;CACF"}
1
+ {"version":3,"file":"gauge-horizontal.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/gauge-horizontal/gauge-horizontal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAO,MAAM,KAAK,CAAC;AAErC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,KAAK,CAAC;AAIxC,OAAO,EACL,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACT,MAAM,aAAa,CAAC;AAKrB,OAAO,EASL,SAAS,EACT,QAAQ,EACR,cAAc,EAEd,iBAAiB,EAClB,MAAM,wDAAwD,CAAC;AAMhE,OAAO,EACL,SAAS,EACT,QAAQ,EACR,cAAc,EACd,UAAU,EACV,oBAAoB,EACpB,eAAe,EACf,iBAAiB,GAClB,CAAC;;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4GG;AACH,qBACa,kBAAmB,SAAQ,uBAIvC;IAC2B,QAAQ,SAAK;IACb,QAAQ,SAAO;IACd,OAAO,UAAS;IAE3C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAO;IAC7B,OAAO,CAAC,QAAQ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IAEpC,qBAAqB,UAAS;IAEhD,MAAM;IA4FN,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAUzC,OAAO,CAAC,OAAO,EAAE,cAAc;IAoCxC;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;cA8CL,gBAAgB;IAI1B,iBAAiB,IAAI,IAAI;IAOlC,qGAAqG;IACrG,OAAO,CAAC,eAAe,CAAC,CAGtB;IAEF;;;;OAIG;IACH,OAAO,CAAC,4BAA4B;IAiBpC,OAAO,CAAC,6BAA6B;IASrC,yFAAyF;IACzF,OAAO,CAAC,aAAa;IAarB,sDAAsD;IACtD,OAAO,CAAC,2BAA2B;CAQpC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,sBAAsB,EAAE,kBAAkB,CAAC;KAC5C;CACF"}
@@ -23,7 +23,10 @@ var ObcGaugeHorizontal = class ObcGaugeHorizontal extends AdviceMixin(SetpointMi
23
23
  this.fixedAspectRatio = false;
24
24
  this.scaleReferenceSize = 384;
25
25
  this._scale = 1;
26
- this._viewBoxThickness = 0;
26
+ this._thicknessAt = (scale) => this._layoutConfig ? computeExternalScaleLayout({
27
+ ...this._layoutConfig,
28
+ fixedAspectRatioScale: scale
29
+ }).thickness : 0;
27
30
  this._resizeController = new ResizeController(this, { callback: (entries) => {
28
31
  if (!this.fixedAspectRatio) return;
29
32
  const entry = entries[0];
@@ -33,7 +36,7 @@ var ObcGaugeHorizontal = class ObcGaugeHorizontal extends AdviceMixin(SetpointMi
33
36
  containerMainAxisSize: entry.contentRect.width,
34
37
  containerCrossAxisSize: entry.contentRect.height,
35
38
  scaleReferenceSize: this.scaleReferenceSize,
36
- viewBoxThickness: this._viewBoxThickness
39
+ viewBoxThickness: this._thicknessAt
37
40
  });
38
41
  this._scale = scale > 0 ? scale : 1;
39
42
  this.reportDimensions();
@@ -118,11 +121,13 @@ var ObcGaugeHorizontal = class ObcGaugeHorizontal extends AdviceMixin(SetpointMi
118
121
  adviceEmphasis: this.adviceEmphasis,
119
122
  adviceMaskPrefix: this._adviceMaskPrefix,
120
123
  fixedAspectRatio: this.fixedAspectRatio,
124
+ fixedAspectRatioScale: this.fixedAspectRatio ? this._scale : 1,
121
125
  instrumentMode: true,
122
126
  highlightCurrentValue: this.highlightCurrentValue
123
127
  };
124
- const layout = computeExternalScaleLayout(toExternalScaleLayoutConfig(config));
125
- this._viewBoxThickness = layout.thickness;
128
+ const layoutConfig = toExternalScaleLayoutConfig(config);
129
+ const layout = computeExternalScaleLayout(layoutConfig);
130
+ this._layoutConfig = layoutConfig;
126
131
  const parts = renderExternalScale(config);
127
132
  const viewBox = computeExternalScaleViewBox({
128
133
  orientation: config.orientation,
@@ -189,8 +194,11 @@ var ObcGaugeHorizontal = class ObcGaugeHorizontal extends AdviceMixin(SetpointMi
189
194
  labelThickness: this.labelThickness,
190
195
  length: this.fixedAspectRatio ? this.scaleReferenceSize : this.width,
191
196
  scaleType: this.scaleType,
197
+ advicePosition: this.advicePosition,
198
+ hasAdvice: !!this.advices && this.advices.length > 0,
192
199
  hasAdviceIcon: !!this.advices?.some((a) => a.showIcon),
193
- hasSetpoint: this.setpoint !== void 0 || this.newSetpoint !== void 0 || this.departingNewSetpoint !== void 0
200
+ hasSetpoint: this.setpoint !== void 0 || this.newSetpoint !== void 0 || this.departingNewSetpoint !== void 0,
201
+ fixedAspectRatioScale: this.fixedAspectRatio ? this._scale : 1
194
202
  });
195
203
  const dimensions = this.fixedAspectRatio ? {
196
204
  ...baseDimensions,
@@ -247,7 +255,7 @@ var ObcGaugeHorizontal = class ObcGaugeHorizontal extends AdviceMixin(SetpointMi
247
255
  containerMainAxisSize: width,
248
256
  containerCrossAxisSize: height,
249
257
  scaleReferenceSize: this.scaleReferenceSize,
250
- viewBoxThickness: this._viewBoxThickness
258
+ viewBoxThickness: this._thicknessAt
251
259
  });
252
260
  return true;
253
261
  }
@@ -1 +1 @@
1
- {"version":3,"file":"gauge-horizontal.js","names":["_decorate"],"sources":["../../../src/navigation-instruments/gauge-horizontal/gauge-horizontal.ts"],"sourcesContent":["import {LitElement, html} from 'lit';\nimport {property, state} from 'lit/decorators.js';\nimport type {PropertyValues} from 'lit';\nimport {customElement} from '../../decorator.js';\nimport {ResizeController} from '@lit-labs/observers/resize-controller.js';\nimport {CHART_DIMENSIONS} from '../../charthelpers/constants.js';\nimport {\n InstrumentState,\n FrameStyle,\n BorderRadiusPosition,\n Priority,\n} from '../types.js';\nimport type {ExternalScaleConfig} from '../../building-blocks/external-scale/external-scale.js';\nimport {\n computeExternalScaleViewBox,\n computeFixedAspectRatioScale,\n computeExternalScaleLayout,\n renderExternalScale,\n toExternalScaleLayoutConfig,\n computeScaleDimensionsForReport,\n computeExternalScaleEffectiveBarThickness,\n readContentBox,\n ScaleType,\n FillMode,\n AdvicePosition,\n ExternalScaleOrientation,\n ExternalScaleSide,\n} from '../../building-blocks/external-scale/external-scale.js';\nimport {SetpointMixin} from '../../svghelpers/setpoint-mixin.js';\nimport {AdviceMixin} from '../../svghelpers/advice-mixin.js';\nimport {nextAdviceMaskId} from '../../svghelpers/advice.js';\n\n// Re-export shared enums for convenience\nexport {\n ScaleType,\n FillMode,\n AdvicePosition,\n FrameStyle,\n BorderRadiusPosition,\n InstrumentState,\n ExternalScaleSide,\n};\n\n/**\n * `<obc-gauge-horizontal>` – A horizontal gauge component with bar and scale background.\n *\n * Use `obc-gauge-horizontal` when you need a standalone horizontal gauge with a visible scale\n * and bar. This is ideal for displaying single values like speed, power, or progress where\n * the scale context is always needed.\n *\n * This is the same as `obc-bar-horizontal` (both use `external-scale.ts`)\n * but with several properties fixed for consistent gauge appearance.\n * Unlike `obc-bar-horizontal`, this component always shows the bar and scale background.\n *\n * ---\n *\n * ### Features\n * - **Fixed Layout:** Width (384px), padding (32px), bar/tick/label thicknesses, and border radius are fixed for consistent gauge appearance. 384 px is the length the design is drawn at, not a layout limit: see `fixedAspectRatio`.\n * - **Scale Configuration:**\n * - Configurable `minValue` and `maxValue` for the value range.\n * - Optional main, primary, secondary, and tertiary tickmarks at specified intervals.\n * - Labels shown at primary tickmark intervals (controlled via `showLabels`).\n * - **Side Positioning:** Can be placed on the `top` or `bottom` side via the `side` property.\n * - **Value Display:**\n * - `value` property drives the bar fill.\n * - `fillMode` controls visualization: `fill` shows bar from `fillMin` to `fillMax`; `tint` adds a marker at the `value` position.\n * - Set `priority` to `Priority.enhanced` to use the blue/enhanced color palette for bar fill and setpoint (default: `Priority.regular`).\n * - **Setpoint Marker:**\n * - Optional `setpoint` value displays a marker.\n * - Automatic at-setpoint detection with configurable deadband.\n * - **Advice Overlays:** Render advice ranges with different types and hinted states.\n * - **Fixed Aspect Ratio:** `fixedAspectRatio` scales the whole gauge to its container like a vector image while the label font size stays put; `scaleReferenceSize` is the container width at which it draws 1:1.\n * - **Dimension Reporting:** Dispatches `scale-dimensions-changed` events for parent chart integration.\n *\n * ---\n *\n * ### Fixed Properties (not configurable)\n * - `width`: 384px\n * - `paddingLeft`/`paddingRight`: 32px (`CHART_DIMENSIONS.CANVAS_PADDING`)\n * - `barThickness`: 48px\n * - `tickThickness`: 24px\n * - `labelThickness`: 60px\n * - `borderRadius`: 8px (matches obc-component-size-medium)\n * - `scaleType`: regular\n * - `frameStyle`: regular\n * - `hasBar`: true\n * - `hasScale`: true\n * - `scaleBackground`: true\n *\n * ---\n *\n * ### Implementation\n * This is a higher fidelity implementation of the concept shown in `instrument-linear.ts`,\n * providing a complete gauge with container, scale background, tickmarks, labels, advice overlays, and setpoint marker.\n *\n * This is a thin web-component wrapper around the pure SVG building-block renderer in `external-scale.ts`.\n * It sets up the outer `<svg>`/`viewBox` for a horizontal scale and delegates rendering/layout to:\n * - `computeExternalScaleLayout(...)`\n * - `renderExternalScale(config)`\n *\n * For renderer documentation see: **Building Blocks/External Scale**.\n *\n * For a version where these properties are user-configurable, see **Bars and Graphs/Bar Horizontal**.\n *\n * ---\n *\n * ### Events\n * - `scale-dimensions-changed` – Fired when layout-affecting properties (`side`, `showLabels`) change, reporting dimensions to parent chart components.\n *\n * ---\n *\n * ### Example\n *\n * ```html\n * <obc-gauge-horizontal\n * min-value=\"0\"\n * max-value=\"100\"\n * value=\"75\"\n * primary-tickmark-interval=\"20\"\n * secondary-tickmark-interval=\"10\"\n * setpoint=\"80\"\n * side=\"bottom\"\n * ></obc-gauge-horizontal>\n * ```\n *\n * @property minValue - Minimum scale value\n * @property maxValue - Maximum scale value\n * @property reverse - Plot `minValue` at the right so values grow leftward.\n * @property side - Which side of the chart area this scale lives on (top or bottom)\n * @property fixedAspectRatio - Scale the whole gauge to its container like a vector image, keeping the label font size: the SVG fills the host, so size the host. Off, the gauge draws at its 384 px reference width.\n * @property scaleReferenceSize - Container width at which a `fixedAspectRatio` gauge draws 1:1 with the design. A wider container enlarges the drawing proportionally, a narrower one shrinks it.\n * @availableWhen scaleReferenceSize fixedAspectRatio==true\n * @property showLabels - Show numerical value labels at primary tickmarks\n * @property mainTickmarks - Array of values for main tickmarks. When undefined, no main tickmarks shown. When empty array [], defaults to [minValue, 0, maxValue].\n * @property primaryTickmarkInterval - Interval for primary (longest) tickmarks with labels\n * @property secondaryTickmarkInterval - Interval for secondary (medium) tickmarks\n * @property tertiaryTickmarkInterval - Interval for tertiary (shortest) tickmarks\n * @property borderRadiusPosition - Border radius position based on component layout\n * @property priority - Color priority: enhanced uses blue instrument colors for bar fill and setpoint\n * @property fillMode - Fill visualization mode: 'fill' shows bar from fillMin to fillMax; 'tint' adds a marker at the value position\n * @property fillMin - Minimum fill value (defaults to 0)\n * @property fillMax - Maximum fill value (defaults to value)\n * @property value - Current value (bar fill level)\n * @property state - Instrument state: active, loading, or off\n * @property advices - Advice/alert overlays with min, max, type, and hinted state. When undefined or empty, no advice shown.\n * @property highlightCurrentValue - When true, displays a dot indicator at the current value position.\n * The dot is rendered in the scale band, touching its inner edge (towards the chart).\n * This provides an alternative to bar fill for highlighting the current value.\n * @property focused - Earlier name for `touching`: a change to it sets `touching`, unless `touching` changes in the same update, which then wins. It is not updated from `touching`, so it does not read back the current value.\n * @fires {CustomEvent} scale-dimensions-changed - Fired when layout-affecting properties change, providing dimension info for parent chart integration. It bubbles to the chart slot the gauge sits in and does not leave the shadow root around it.\n * @stable\n */\n@customElement('obc-gauge-horizontal')\nexport class ObcGaugeHorizontal extends AdviceMixin(\n SetpointMixin(LitElement, {\n defaultDeadband: 1,\n })\n) {\n @property({type: Number}) minValue = 0;\n @property({type: Number}) maxValue = 100;\n @property({type: Boolean}) reverse = false;\n\n private readonly width = 384;\n private readonly paddingLeft = CHART_DIMENSIONS.CANVAS_PADDING;\n private readonly paddingRight = CHART_DIMENSIONS.CANVAS_PADDING;\n\n @property({type: String}) side: ExternalScaleSide = ExternalScaleSide.bottom;\n\n @property({type: Boolean}) fixedAspectRatio = false;\n @property({type: Number}) scaleReferenceSize = 384;\n\n @state()\n private _scale = 1;\n\n /** The drawing's height in viewBox units, kept from the last render for the scale measurement. */\n private _viewBoxThickness = 0;\n\n // ResizeController automatically subscribes/unsubscribes based on component lifecycle\n // @ts-expect-error - Controller is used for side effects, not accessed directly\n private _resizeController = new ResizeController(this, {\n callback: (entries) => {\n if (!this.fixedAspectRatio) return;\n\n const entry = entries[0];\n if (!entry) return;\n\n const scale = computeFixedAspectRatioScale({\n orientation: ExternalScaleOrientation.horizontal,\n containerMainAxisSize: entry.contentRect.width,\n containerCrossAxisSize: entry.contentRect.height,\n scaleReferenceSize: this.scaleReferenceSize,\n viewBoxThickness: this._viewBoxThickness,\n });\n // Guard against zero-sized containers, but allow fractional scales < 1\n this._scale = scale > 0 ? scale : 1;\n\n // Report scaled dimensions to parent chart\n this.reportDimensions();\n },\n });\n\n @property({type: Boolean, attribute: false}) showLabels = true;\n private readonly barThickness = 48;\n private readonly tickThickness = 24;\n private readonly labelThickness = 60;\n\n @property({type: Array, attribute: false}) mainTickmarks?: number[] = [];\n @property({type: Number}) primaryTickmarkInterval?: number = undefined;\n @property({type: Number}) secondaryTickmarkInterval?: number = undefined;\n @property({type: Number}) tertiaryTickmarkInterval?: number = undefined;\n private readonly scaleType: ScaleType = ScaleType.regular;\n private readonly frameStyle: FrameStyle = FrameStyle.regular;\n @property({type: String, attribute: false})\n borderRadiusPosition?: BorderRadiusPosition =\n BorderRadiusPosition.innerFirstChild;\n\n private readonly borderRadius = 8;\n\n private get hasBar(): boolean {\n return true;\n }\n\n private get scaleBackground(): boolean {\n return true;\n }\n\n private get hasScale(): boolean {\n return true;\n }\n\n @property({type: String}) priority: Priority = Priority.regular;\n @property({type: String}) fillMode: FillMode = FillMode.fill;\n @property({type: Number}) fillMin?: number = undefined;\n @property({type: Number}) fillMax?: number = undefined;\n @property({type: Number}) value?: number = undefined;\n\n @property({type: String}) state: InstrumentState = InstrumentState.active;\n\n /**\n * @deprecated Use `touching` (from SetpointMixin) instead.\n * Kept for backward compatibility. Synced to `touching` in `willUpdate()`.\n */\n @property({type: Boolean}) focused = false;\n\n private readonly advicePosition: AdvicePosition = AdvicePosition.inner;\n // Mask ids are document-scoped, so each gauge names its own.\n private readonly _adviceMaskPrefix = nextAdviceMaskId('gauge');\n\n @property({type: Boolean}) highlightCurrentValue = false;\n\n override render() {\n // A chart pushes its own width to a slotted scale; in fixedAspectRatio\n // mode the drawing keeps its reference length and the SVG scales it.\n const effectiveLength = this.fixedAspectRatio\n ? this.scaleReferenceSize\n : this.width;\n\n const config: ExternalScaleConfig = {\n orientation: ExternalScaleOrientation.horizontal,\n side: this.side,\n length: effectiveLength,\n paddingStart: this.paddingLeft,\n paddingEnd: this.paddingRight,\n minValue: this.minValue,\n maxValue: this.maxValue,\n reverse: this.reverse,\n hasScale: this.hasScale,\n labels: this.showLabels,\n hasBar: this.hasBar,\n scaleBackground: this.scaleBackground,\n barThickness: this.barThickness,\n tickThickness: this.tickThickness,\n labelThickness: this.labelThickness,\n mainTickmarks: this.mainTickmarks,\n primaryTickmarkInterval: this.primaryTickmarkInterval,\n secondaryTickmarkInterval: this.secondaryTickmarkInterval,\n tertiaryTickmarkInterval: this.tertiaryTickmarkInterval,\n scaleType: this.scaleType,\n frameStyle: this.frameStyle,\n borderRadiusPosition: this.borderRadiusPosition,\n borderRadius: this.borderRadius,\n priority: this.priority,\n fillMode: this.fillMode,\n fillMin: this.fillMin,\n fillMax: this.fillMax,\n value: this.value,\n setpoint: this.setpoint,\n newSetpoint: this.newSetpoint,\n atSetpoint: this.atSetpoint,\n autoAtSetpoint: this.autoAtSetpoint,\n autoAtSetpointDeadband: this.autoAtSetpointDeadband,\n setpointAtZeroDeadband: this.setpointAtZeroDeadband,\n animateSetpoint: this.animateSetpoint,\n departingNewSetpoint: this.departingNewSetpoint,\n state: this.state,\n touching: this.touching,\n setpointOverride: this.setpointOverride,\n advicePosition: this.advicePosition,\n advices: this.advices,\n adviceTrigger: this.adviceTrigger,\n adviceEmphasis: this.adviceEmphasis,\n adviceMaskPrefix: this._adviceMaskPrefix,\n fixedAspectRatio: this.fixedAspectRatio,\n // Gauges are always in instrument mode - they use fixed borderRadius (8px)\n // and don't respond to .obc-component-size-* CSS classes for border radius\n instrumentMode: true,\n highlightCurrentValue: this.highlightCurrentValue,\n };\n\n const layout = computeExternalScaleLayout(\n toExternalScaleLayoutConfig(config)\n );\n this._viewBoxThickness = layout.thickness;\n\n const parts = renderExternalScale(config);\n\n const viewBox = computeExternalScaleViewBox(\n {orientation: config.orientation, length: effectiveLength},\n layout\n );\n const preserveAspectRatio = this.fixedAspectRatio\n ? 'xMidYMid meet'\n : 'none';\n\n return html`\n <svg\n width=${this.fixedAspectRatio ? '100%' : `${this.width}px`}\n height=${this.fixedAspectRatio ? '100%' : `${viewBox.height}px`}\n viewBox=\"${viewBox.x} ${viewBox.y} ${viewBox.width} ${viewBox.height}\"\n preserveAspectRatio=\"${preserveAspectRatio}\"\n style=\"--scale: ${\n this.fixedAspectRatio ? this._scale : 1\n }; display: block;\"\n part=\"svg\"\n >\n ${parts.barContainer} ${parts.barFill} ${parts.scaleBackground}\n ${parts.tickmarks} ${parts.labels} ${parts.adviceOverlays}\n ${parts.currentValueDot} ${parts.setpoint}\n </svg>\n `;\n }\n\n override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n\n // Sync deprecated alias to mixin property\n // Only sync if the alias was set and the mixin property was NOT also set.\n if (changed.has('focused') && !changed.has('touching')) {\n this.touching = this.focused;\n }\n }\n\n override updated(changed: PropertyValues) {\n super.updated(changed);\n\n // Only the styles this element applied are removed: the first update\n // lists every property, and a consumer's inline style is theirs.\n if (changed.has('fixedAspectRatio')) {\n if (this.fixedAspectRatio) {\n this._applyFixedAspectRatioStyles();\n this._updateScaleFromCurrentSize();\n } else if (changed.get('fixedAspectRatio') === true) {\n this._removeFixedAspectRatioStyles();\n this._scale = 1;\n }\n }\n\n if (changed.has('scaleReferenceSize') && this.fixedAspectRatio) {\n this._updateScaleFromCurrentSize();\n }\n\n // The reported thickness follows the bands, the advice icons, the\n // setpoint marker band and the mode, whichever mode is on; a resize\n // re-reports through the ResizeController.\n if (\n changed.has('fixedAspectRatio') ||\n changed.has('side') ||\n changed.has('showLabels') ||\n changed.has('advices') ||\n this.setpointPresenceChanged(changed)\n ) {\n // A thinner or thicker drawing under the same box changes the painted\n // scale without a resize event.\n if (this.fixedAspectRatio) this._measureScale();\n this.reportDimensions();\n }\n }\n\n /**\n * Report scale dimensions to parent chart component.\n * When fixedAspectRatio=true, reports the actual visual (scaled) thickness\n * so the chart can correctly reserve space for the scale.\n * When fixedAspectRatio=false, reports the base/unscaled thickness.\n */\n private reportDimensions() {\n const effectiveBarThickness = computeExternalScaleEffectiveBarThickness({\n hasBar: this.hasBar,\n barThickness: this.barThickness,\n borderRadius: this.borderRadius,\n scaleType: this.scaleType,\n });\n\n const baseDimensions = computeScaleDimensionsForReport({\n orientation: ExternalScaleOrientation.horizontal,\n side: this.side,\n hasBar: this.hasBar,\n hasScale: this.hasScale,\n labels: this.showLabels,\n barThickness: effectiveBarThickness,\n tickThickness: this.tickThickness,\n labelThickness: this.labelThickness,\n length: this.fixedAspectRatio ? this.scaleReferenceSize : this.width,\n scaleType: this.scaleType,\n hasAdviceIcon: !!this.advices?.some((a) => a.showIcon),\n hasSetpoint:\n this.setpoint !== undefined ||\n this.newSetpoint !== undefined ||\n this.departingNewSetpoint !== undefined,\n });\n\n // The chart lays out in visual pixels, so a scaled drawing reports its\n // scaled thickness.\n const dimensions = this.fixedAspectRatio\n ? {\n ...baseDimensions,\n thickness: Math.round(baseDimensions.thickness * this._scale),\n }\n : baseDimensions;\n\n this.dispatchEvent(\n new CustomEvent('scale-dimensions-changed', {\n detail: dimensions,\n bubbles: true,\n })\n );\n }\n\n protected override createRenderRoot() {\n return this;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (this.fixedAspectRatio) {\n this._applyFixedAspectRatioStyles();\n }\n }\n\n /** The inline sizing, value and priority, the consumer had before fixedAspectRatio took the host. */\n private _consumerSizing?: Record<\n 'display' | 'width' | 'height',\n [value: string, priority: string]\n >;\n\n /**\n * A custom element is inline by default, which gives the percentage-sized\n * SVG nothing to fill; in fixedAspectRatio mode the host is a block that\n * takes its container's width.\n */\n private _applyFixedAspectRatioStyles(): void {\n if (!this._consumerSizing) {\n const snapshot = (name: string): [string, string] => [\n this.style.getPropertyValue(name),\n this.style.getPropertyPriority(name),\n ];\n this._consumerSizing = {\n display: snapshot('display'),\n width: snapshot('width'),\n height: snapshot('height'),\n };\n }\n this.style.display = 'block';\n this.style.width = '100%';\n this.style.height = 'auto';\n }\n\n private _removeFixedAspectRatioStyles(): void {\n const saved = this._consumerSizing;\n this._consumerSizing = undefined;\n for (const name of ['display', 'width', 'height'] as const) {\n const [value, priority] = saved?.[name] ?? ['', ''];\n this.style.setProperty(name, value, priority);\n }\n }\n\n /** Reads the host's content box into the scale; false while the host has no size yet. */\n private _measureScale(): boolean {\n const {width, height} = readContentBox(this);\n if (width <= 0) return false;\n this._scale = computeFixedAspectRatioScale({\n orientation: ExternalScaleOrientation.horizontal,\n containerMainAxisSize: width,\n containerCrossAxisSize: height,\n scaleReferenceSize: this.scaleReferenceSize,\n viewBoxThickness: this._viewBoxThickness,\n });\n return true;\n }\n\n /** Measures once layout has settled, then reports. */\n private _updateScaleFromCurrentSize(): void {\n requestAnimationFrame(() => {\n if (this._measureScale()) {\n this.requestUpdate();\n this.reportDimensions();\n }\n });\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-gauge-horizontal': ObcGaugeHorizontal;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAyJO,IAAM,qBAAN,MAAM,2BAA2B,YACtC,cAAc,YAAY,EACxB,iBAAiB,EACnB,CAAC,CACH,CAAC,CAAC;;;EACqC,KAAA,WAAA;EACA,KAAA,WAAA;EACA,KAAA,UAAA;EAEZ,KAAA,QAAA;EACM,KAAA,cAAA,iBAAiB;EAChB,KAAA,eAAA,iBAAiB;EAEG,KAAA,OAAA,kBAAkB;EAExB,KAAA,mBAAA;EACC,KAAA,qBAAA;EAG9B,KAAA,SAAA;EAGW,KAAA,oBAAA;EAIA,KAAA,oBAAA,IAAI,iBAAiB,MAAM,EACrD,WAAW,YAAY;GACrB,IAAI,CAAC,KAAK,kBAAkB;GAE5B,MAAM,QAAQ,QAAQ;GACtB,IAAI,CAAC,OAAO;GAEZ,MAAM,QAAQ,6BAA6B;IACzC,aAAa,yBAAyB;IACtC,uBAAuB,MAAM,YAAY;IACzC,wBAAwB,MAAM,YAAY;IAC1C,oBAAoB,KAAK;IACzB,kBAAkB,KAAK;GACzB,CAAC;GAED,KAAK,SAAS,QAAQ,IAAI,QAAQ;GAGlC,KAAK,iBAAiB;EACxB,EACF,CAAC;EAEyD,KAAA,aAAA;EAC1B,KAAA,eAAA;EACC,KAAA,gBAAA;EACC,KAAA,iBAAA;EAEoC,KAAA,gBAAA,CAAC;EACV,KAAA,0BAAA,KAAA;EACE,KAAA,4BAAA,KAAA;EACD,KAAA,2BAAA,KAAA;EACtB,KAAA,YAAA,UAAU;EACR,KAAA,aAAA,WAAW;EAGnD,KAAA,uBAAA,qBAAqB;EAES,KAAA,eAAA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,GAAA,mBAAA,WAAA,SAAA,KAAA,CAAA;AAMvBA,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,mBAAA,WAAA,WAAA,KAAA,CAAA;AAMxBA,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,mBAAA,WAAA,yBAAA,KAAA,CAAA;AAhG1B,qBAAAA,WAAA,CAAA,cAAc,sBAAsB,CAAA,GAAA,kBAAA"}
1
+ {"version":3,"file":"gauge-horizontal.js","names":["_decorate"],"sources":["../../../src/navigation-instruments/gauge-horizontal/gauge-horizontal.ts"],"sourcesContent":["import {LitElement, html} from 'lit';\nimport {property, state} from 'lit/decorators.js';\nimport type {PropertyValues} from 'lit';\nimport {customElement} from '../../decorator.js';\nimport {ResizeController} from '@lit-labs/observers/resize-controller.js';\nimport {CHART_DIMENSIONS} from '../../charthelpers/constants.js';\nimport {\n InstrumentState,\n FrameStyle,\n BorderRadiusPosition,\n Priority,\n} from '../types.js';\nimport type {\n ExternalScaleConfig,\n ExternalScaleLayoutConfig,\n} from '../../building-blocks/external-scale/external-scale.js';\nimport {\n computeExternalScaleViewBox,\n computeFixedAspectRatioScale,\n computeExternalScaleLayout,\n renderExternalScale,\n toExternalScaleLayoutConfig,\n computeScaleDimensionsForReport,\n computeExternalScaleEffectiveBarThickness,\n readContentBox,\n ScaleType,\n FillMode,\n AdvicePosition,\n ExternalScaleOrientation,\n ExternalScaleSide,\n} from '../../building-blocks/external-scale/external-scale.js';\nimport {SetpointMixin} from '../../svghelpers/setpoint-mixin.js';\nimport {AdviceMixin} from '../../svghelpers/advice-mixin.js';\nimport {nextAdviceMaskId} from '../../svghelpers/advice.js';\n\n// Re-export shared enums for convenience\nexport {\n ScaleType,\n FillMode,\n AdvicePosition,\n FrameStyle,\n BorderRadiusPosition,\n InstrumentState,\n ExternalScaleSide,\n};\n\n/**\n * `<obc-gauge-horizontal>` – A horizontal gauge component with bar and scale background.\n *\n * Use `obc-gauge-horizontal` when you need a standalone horizontal gauge with a visible scale\n * and bar. This is ideal for displaying single values like speed, power, or progress where\n * the scale context is always needed.\n *\n * This is the same as `obc-bar-horizontal` (both use `external-scale.ts`)\n * but with several properties fixed for consistent gauge appearance.\n * Unlike `obc-bar-horizontal`, this component always shows the bar and scale background.\n *\n * ---\n *\n * ### Features\n * - **Fixed Layout:** Width (384px), padding (32px), bar/tick/label thicknesses, and border radius are fixed for consistent gauge appearance. 384 px is the length the design is drawn at, not a layout limit: see `fixedAspectRatio`.\n * - **Scale Configuration:**\n * - Configurable `minValue` and `maxValue` for the value range.\n * - Optional main, primary, secondary, and tertiary tickmarks at specified intervals.\n * - Labels shown at primary tickmark intervals (controlled via `showLabels`).\n * - **Side Positioning:** Can be placed on the `top` or `bottom` side via the `side` property.\n * - **Value Display:**\n * - `value` property drives the bar fill.\n * - `fillMode` controls visualization: `fill` shows bar from `fillMin` to `fillMax`; `tint` adds a marker at the `value` position.\n * - Set `priority` to `Priority.enhanced` to use the blue/enhanced color palette for bar fill and setpoint (default: `Priority.regular`).\n * - **Setpoint Marker:**\n * - Optional `setpoint` value displays a marker.\n * - Automatic at-setpoint detection with configurable deadband.\n * - **Advice Overlays:** Render advice ranges with different types and hinted states.\n * - **Fixed Aspect Ratio:** `fixedAspectRatio` scales the whole gauge to its container like a vector image while the label font size stays put; `scaleReferenceSize` is the container width at which it draws 1:1.\n * - **Dimension Reporting:** Dispatches `scale-dimensions-changed` events for parent chart integration.\n *\n * ---\n *\n * ### Fixed Properties (not configurable)\n * - `width`: 384px\n * - `paddingLeft`/`paddingRight`: 32px (`CHART_DIMENSIONS.CANVAS_PADDING`)\n * - `barThickness`: 48px\n * - `tickThickness`: 24px\n * - `labelThickness`: 60px\n * - `borderRadius`: 8px (matches obc-component-size-medium)\n * - `scaleType`: regular\n * - `frameStyle`: regular\n * - `hasBar`: true\n * - `hasScale`: true\n * - `scaleBackground`: true\n *\n * ---\n *\n * ### Implementation\n * This is a higher fidelity implementation of the concept shown in `instrument-linear.ts`,\n * providing a complete gauge with container, scale background, tickmarks, labels, advice overlays, and setpoint marker.\n *\n * This is a thin web-component wrapper around the pure SVG building-block renderer in `external-scale.ts`.\n * It sets up the outer `<svg>`/`viewBox` for a horizontal scale and delegates rendering/layout to:\n * - `computeExternalScaleLayout(...)`\n * - `renderExternalScale(config)`\n *\n * For renderer documentation see: **Building Blocks/External Scale**.\n *\n * For a version where these properties are user-configurable, see **Bars and Graphs/Bar Horizontal**.\n *\n * ---\n *\n * ### Events\n * - `scale-dimensions-changed` – Fired when layout-affecting properties (`side`, `showLabels`) change, reporting dimensions to parent chart components.\n *\n * ---\n *\n * ### Example\n *\n * ```html\n * <obc-gauge-horizontal\n * min-value=\"0\"\n * max-value=\"100\"\n * value=\"75\"\n * primary-tickmark-interval=\"20\"\n * secondary-tickmark-interval=\"10\"\n * setpoint=\"80\"\n * side=\"bottom\"\n * ></obc-gauge-horizontal>\n * ```\n *\n * @property minValue - Minimum scale value\n * @property maxValue - Maximum scale value\n * @property reverse - Plot `minValue` at the right so values grow leftward.\n * @property side - Which side of the chart area this scale lives on (top or bottom)\n * @property fixedAspectRatio - Scale the whole gauge to its container like a vector image, keeping the label font size: the SVG fills the host, so size the host. Off, the gauge draws at its 384 px reference width.\n * @property scaleReferenceSize - Container width at which a `fixedAspectRatio` gauge draws 1:1 with the design. A wider container enlarges the drawing proportionally, a narrower one shrinks it.\n * @availableWhen scaleReferenceSize fixedAspectRatio==true\n * @property showLabels - Show numerical value labels at primary tickmarks\n * @property mainTickmarks - Array of values for main tickmarks. When undefined, no main tickmarks shown. When empty array [], defaults to [minValue, 0, maxValue].\n * @property primaryTickmarkInterval - Interval for primary (longest) tickmarks with labels\n * @property secondaryTickmarkInterval - Interval for secondary (medium) tickmarks\n * @property tertiaryTickmarkInterval - Interval for tertiary (shortest) tickmarks\n * @property borderRadiusPosition - Border radius position based on component layout\n * @property priority - Color priority: enhanced uses blue instrument colors for bar fill and setpoint\n * @property fillMode - Fill visualization mode: 'fill' shows bar from fillMin to fillMax; 'tint' adds a marker at the value position\n * @property fillMin - Minimum fill value (defaults to 0)\n * @property fillMax - Maximum fill value (defaults to value)\n * @property value - Current value (bar fill level)\n * @property state - Instrument state: active, loading, or off\n * @property advices - Advice/alert overlays with min, max, type, and hinted state. When undefined or empty, no advice shown.\n * @property highlightCurrentValue - When true, displays a dot indicator at the current value position.\n * The dot is rendered in the scale band, touching its inner edge (towards the chart).\n * This provides an alternative to bar fill for highlighting the current value.\n * @property focused - Earlier name for `touching`: a change to it sets `touching`, unless `touching` changes in the same update, which then wins. It is not updated from `touching`, so it does not read back the current value.\n * @fires {CustomEvent} scale-dimensions-changed - Fired when layout-affecting properties change, providing dimension info for parent chart integration. It bubbles to the chart slot the gauge sits in and does not leave the shadow root around it.\n * @stable\n */\n@customElement('obc-gauge-horizontal')\nexport class ObcGaugeHorizontal extends AdviceMixin(\n SetpointMixin(LitElement, {\n defaultDeadband: 1,\n })\n) {\n @property({type: Number}) minValue = 0;\n @property({type: Number}) maxValue = 100;\n @property({type: Boolean}) reverse = false;\n\n private readonly width = 384;\n private readonly paddingLeft = CHART_DIMENSIONS.CANVAS_PADDING;\n private readonly paddingRight = CHART_DIMENSIONS.CANVAS_PADDING;\n\n @property({type: String}) side: ExternalScaleSide = ExternalScaleSide.bottom;\n\n @property({type: Boolean}) fixedAspectRatio = false;\n @property({type: Number}) scaleReferenceSize = 384;\n\n @state()\n private _scale = 1;\n\n /** The last render's layout inputs, for the scale measurement. */\n private _layoutConfig?: ExternalScaleLayoutConfig;\n\n /** The drawing's height in viewBox units at a scale: the advice column is pixels, so it depends on it. */\n private _thicknessAt = (scale: number): number =>\n this._layoutConfig\n ? computeExternalScaleLayout({\n ...this._layoutConfig,\n fixedAspectRatioScale: scale,\n }).thickness\n : 0;\n\n // ResizeController automatically subscribes/unsubscribes based on component lifecycle\n // @ts-expect-error - Controller is used for side effects, not accessed directly\n private _resizeController = new ResizeController(this, {\n callback: (entries) => {\n if (!this.fixedAspectRatio) return;\n\n const entry = entries[0];\n if (!entry) return;\n\n const scale = computeFixedAspectRatioScale({\n orientation: ExternalScaleOrientation.horizontal,\n containerMainAxisSize: entry.contentRect.width,\n containerCrossAxisSize: entry.contentRect.height,\n scaleReferenceSize: this.scaleReferenceSize,\n viewBoxThickness: this._thicknessAt,\n });\n // Guard against zero-sized containers, but allow fractional scales < 1\n this._scale = scale > 0 ? scale : 1;\n\n // Report scaled dimensions to parent chart\n this.reportDimensions();\n },\n });\n\n @property({type: Boolean, attribute: false}) showLabels = true;\n private readonly barThickness = 48;\n private readonly tickThickness = 24;\n private readonly labelThickness = 60;\n\n @property({type: Array, attribute: false}) mainTickmarks?: number[] = [];\n @property({type: Number}) primaryTickmarkInterval?: number = undefined;\n @property({type: Number}) secondaryTickmarkInterval?: number = undefined;\n @property({type: Number}) tertiaryTickmarkInterval?: number = undefined;\n private readonly scaleType: ScaleType = ScaleType.regular;\n private readonly frameStyle: FrameStyle = FrameStyle.regular;\n @property({type: String, attribute: false})\n borderRadiusPosition?: BorderRadiusPosition =\n BorderRadiusPosition.innerFirstChild;\n\n private readonly borderRadius = 8;\n\n private get hasBar(): boolean {\n return true;\n }\n\n private get scaleBackground(): boolean {\n return true;\n }\n\n private get hasScale(): boolean {\n return true;\n }\n\n @property({type: String}) priority: Priority = Priority.regular;\n @property({type: String}) fillMode: FillMode = FillMode.fill;\n @property({type: Number}) fillMin?: number = undefined;\n @property({type: Number}) fillMax?: number = undefined;\n @property({type: Number}) value?: number = undefined;\n\n @property({type: String}) state: InstrumentState = InstrumentState.active;\n\n /**\n * @deprecated Use `touching` (from SetpointMixin) instead.\n * Kept for backward compatibility. Synced to `touching` in `willUpdate()`.\n */\n @property({type: Boolean}) focused = false;\n\n private readonly advicePosition: AdvicePosition = AdvicePosition.inner;\n // Mask ids are document-scoped, so each gauge names its own.\n private readonly _adviceMaskPrefix = nextAdviceMaskId('gauge');\n\n @property({type: Boolean}) highlightCurrentValue = false;\n\n override render() {\n // A chart pushes its own width to a slotted scale; in fixedAspectRatio\n // mode the drawing keeps its reference length and the SVG scales it.\n const effectiveLength = this.fixedAspectRatio\n ? this.scaleReferenceSize\n : this.width;\n\n const config: ExternalScaleConfig = {\n orientation: ExternalScaleOrientation.horizontal,\n side: this.side,\n length: effectiveLength,\n paddingStart: this.paddingLeft,\n paddingEnd: this.paddingRight,\n minValue: this.minValue,\n maxValue: this.maxValue,\n reverse: this.reverse,\n hasScale: this.hasScale,\n labels: this.showLabels,\n hasBar: this.hasBar,\n scaleBackground: this.scaleBackground,\n barThickness: this.barThickness,\n tickThickness: this.tickThickness,\n labelThickness: this.labelThickness,\n mainTickmarks: this.mainTickmarks,\n primaryTickmarkInterval: this.primaryTickmarkInterval,\n secondaryTickmarkInterval: this.secondaryTickmarkInterval,\n tertiaryTickmarkInterval: this.tertiaryTickmarkInterval,\n scaleType: this.scaleType,\n frameStyle: this.frameStyle,\n borderRadiusPosition: this.borderRadiusPosition,\n borderRadius: this.borderRadius,\n priority: this.priority,\n fillMode: this.fillMode,\n fillMin: this.fillMin,\n fillMax: this.fillMax,\n value: this.value,\n setpoint: this.setpoint,\n newSetpoint: this.newSetpoint,\n atSetpoint: this.atSetpoint,\n autoAtSetpoint: this.autoAtSetpoint,\n autoAtSetpointDeadband: this.autoAtSetpointDeadband,\n setpointAtZeroDeadband: this.setpointAtZeroDeadband,\n animateSetpoint: this.animateSetpoint,\n departingNewSetpoint: this.departingNewSetpoint,\n state: this.state,\n touching: this.touching,\n setpointOverride: this.setpointOverride,\n advicePosition: this.advicePosition,\n advices: this.advices,\n adviceTrigger: this.adviceTrigger,\n adviceEmphasis: this.adviceEmphasis,\n adviceMaskPrefix: this._adviceMaskPrefix,\n fixedAspectRatio: this.fixedAspectRatio,\n fixedAspectRatioScale: this.fixedAspectRatio ? this._scale : 1,\n // Gauges are always in instrument mode - they use fixed borderRadius (8px)\n // and don't respond to .obc-component-size-* CSS classes for border radius\n instrumentMode: true,\n highlightCurrentValue: this.highlightCurrentValue,\n };\n\n const layoutConfig = toExternalScaleLayoutConfig(config);\n const layout = computeExternalScaleLayout(layoutConfig);\n this._layoutConfig = layoutConfig;\n\n const parts = renderExternalScale(config);\n\n const viewBox = computeExternalScaleViewBox(\n {orientation: config.orientation, length: effectiveLength},\n layout\n );\n const preserveAspectRatio = this.fixedAspectRatio\n ? 'xMidYMid meet'\n : 'none';\n\n return html`\n <svg\n width=${this.fixedAspectRatio ? '100%' : `${this.width}px`}\n height=${this.fixedAspectRatio ? '100%' : `${viewBox.height}px`}\n viewBox=\"${viewBox.x} ${viewBox.y} ${viewBox.width} ${viewBox.height}\"\n preserveAspectRatio=\"${preserveAspectRatio}\"\n style=\"--scale: ${\n this.fixedAspectRatio ? this._scale : 1\n }; display: block;\"\n part=\"svg\"\n >\n ${parts.barContainer} ${parts.barFill} ${parts.scaleBackground}\n ${parts.tickmarks} ${parts.labels} ${parts.adviceOverlays}\n ${parts.currentValueDot} ${parts.setpoint}\n </svg>\n `;\n }\n\n override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n\n // Sync deprecated alias to mixin property\n // Only sync if the alias was set and the mixin property was NOT also set.\n if (changed.has('focused') && !changed.has('touching')) {\n this.touching = this.focused;\n }\n }\n\n override updated(changed: PropertyValues) {\n super.updated(changed);\n\n // Only the styles this element applied are removed: the first update\n // lists every property, and a consumer's inline style is theirs.\n if (changed.has('fixedAspectRatio')) {\n if (this.fixedAspectRatio) {\n this._applyFixedAspectRatioStyles();\n this._updateScaleFromCurrentSize();\n } else if (changed.get('fixedAspectRatio') === true) {\n this._removeFixedAspectRatioStyles();\n this._scale = 1;\n }\n }\n\n if (changed.has('scaleReferenceSize') && this.fixedAspectRatio) {\n this._updateScaleFromCurrentSize();\n }\n\n // The reported thickness follows the bands, the advice icons, the\n // setpoint marker band and the mode, whichever mode is on; a resize\n // re-reports through the ResizeController.\n if (\n changed.has('fixedAspectRatio') ||\n changed.has('side') ||\n changed.has('showLabels') ||\n changed.has('advices') ||\n this.setpointPresenceChanged(changed)\n ) {\n // A thinner or thicker drawing under the same box changes the painted\n // scale without a resize event.\n if (this.fixedAspectRatio) this._measureScale();\n this.reportDimensions();\n }\n }\n\n /**\n * Report scale dimensions to parent chart component.\n * When fixedAspectRatio=true, reports the actual visual (scaled) thickness\n * so the chart can correctly reserve space for the scale.\n * When fixedAspectRatio=false, reports the base/unscaled thickness.\n */\n private reportDimensions() {\n const effectiveBarThickness = computeExternalScaleEffectiveBarThickness({\n hasBar: this.hasBar,\n barThickness: this.barThickness,\n borderRadius: this.borderRadius,\n scaleType: this.scaleType,\n });\n\n const baseDimensions = computeScaleDimensionsForReport({\n orientation: ExternalScaleOrientation.horizontal,\n side: this.side,\n hasBar: this.hasBar,\n hasScale: this.hasScale,\n labels: this.showLabels,\n barThickness: effectiveBarThickness,\n tickThickness: this.tickThickness,\n labelThickness: this.labelThickness,\n length: this.fixedAspectRatio ? this.scaleReferenceSize : this.width,\n scaleType: this.scaleType,\n advicePosition: this.advicePosition,\n hasAdvice: !!this.advices && this.advices.length > 0,\n hasAdviceIcon: !!this.advices?.some((a) => a.showIcon),\n hasSetpoint:\n this.setpoint !== undefined ||\n this.newSetpoint !== undefined ||\n this.departingNewSetpoint !== undefined,\n fixedAspectRatioScale: this.fixedAspectRatio ? this._scale : 1,\n });\n\n // The chart lays out in visual pixels, so a scaled drawing reports its\n // scaled thickness.\n const dimensions = this.fixedAspectRatio\n ? {\n ...baseDimensions,\n thickness: Math.round(baseDimensions.thickness * this._scale),\n }\n : baseDimensions;\n\n this.dispatchEvent(\n new CustomEvent('scale-dimensions-changed', {\n detail: dimensions,\n bubbles: true,\n })\n );\n }\n\n protected override createRenderRoot() {\n return this;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (this.fixedAspectRatio) {\n this._applyFixedAspectRatioStyles();\n }\n }\n\n /** The inline sizing, value and priority, the consumer had before fixedAspectRatio took the host. */\n private _consumerSizing?: Record<\n 'display' | 'width' | 'height',\n [value: string, priority: string]\n >;\n\n /**\n * A custom element is inline by default, which gives the percentage-sized\n * SVG nothing to fill; in fixedAspectRatio mode the host is a block that\n * takes its container's width.\n */\n private _applyFixedAspectRatioStyles(): void {\n if (!this._consumerSizing) {\n const snapshot = (name: string): [string, string] => [\n this.style.getPropertyValue(name),\n this.style.getPropertyPriority(name),\n ];\n this._consumerSizing = {\n display: snapshot('display'),\n width: snapshot('width'),\n height: snapshot('height'),\n };\n }\n this.style.display = 'block';\n this.style.width = '100%';\n this.style.height = 'auto';\n }\n\n private _removeFixedAspectRatioStyles(): void {\n const saved = this._consumerSizing;\n this._consumerSizing = undefined;\n for (const name of ['display', 'width', 'height'] as const) {\n const [value, priority] = saved?.[name] ?? ['', ''];\n this.style.setProperty(name, value, priority);\n }\n }\n\n /** Reads the host's content box into the scale; false while the host has no size yet. */\n private _measureScale(): boolean {\n const {width, height} = readContentBox(this);\n if (width <= 0) return false;\n this._scale = computeFixedAspectRatioScale({\n orientation: ExternalScaleOrientation.horizontal,\n containerMainAxisSize: width,\n containerCrossAxisSize: height,\n scaleReferenceSize: this.scaleReferenceSize,\n viewBoxThickness: this._thicknessAt,\n });\n return true;\n }\n\n /** Measures once layout has settled, then reports. */\n private _updateScaleFromCurrentSize(): void {\n requestAnimationFrame(() => {\n if (this._measureScale()) {\n this.requestUpdate();\n this.reportDimensions();\n }\n });\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-gauge-horizontal': ObcGaugeHorizontal;\n }\n}\n"],"mappings":";;;;;;;;;;;;AA4JO,IAAM,qBAAN,MAAM,2BAA2B,YACtC,cAAc,YAAY,EACxB,iBAAiB,EACnB,CAAC,CACH,CAAC,CAAC;;;EACqC,KAAA,WAAA;EACA,KAAA,WAAA;EACA,KAAA,UAAA;EAEZ,KAAA,QAAA;EACM,KAAA,cAAA,iBAAiB;EAChB,KAAA,eAAA,iBAAiB;EAEG,KAAA,OAAA,kBAAkB;EAExB,KAAA,mBAAA;EACC,KAAA,qBAAA;EAG9B,KAA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,10 @@ export declare class ObcGaugeVertical extends ObcGaugeVertical_base {
133
133
  */
134
134
  scaleReferenceSize: number;
135
135
  private _scale;
136
- /** The drawing's width in viewBox units, kept from the last render for the scale measurement. */
137
- private _viewBoxThickness;
136
+ /** The last render's layout inputs, for the scale measurement. */
137
+ private _layoutConfig?;
138
+ /** The drawing's width in viewBox units at a scale: the advice column is pixels, so it depends on it. */
139
+ private _thicknessAt;
138
140
  private _resizeController;
139
141
  /** Show numerical value labels at primary tickmarks */
140
142
  showLabels: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"gauge-vertical.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/gauge-vertical/gauge-vertical.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAO,MAAM,KAAK,CAAC;AAErC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,KAAK,CAAC;AAIxC,OAAO,EACL,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACT,MAAM,aAAa,CAAC;AAErB,OAAO,EASL,SAAS,EACT,QAAQ,EACR,cAAc,EAEd,iBAAiB,EAClB,MAAM,wDAAwD,CAAC;AAMhE,OAAO,EACL,SAAS,EACT,QAAQ,EACR,cAAc,EACd,UAAU,EACV,oBAAoB,EACpB,eAAe,EACf,iBAAiB,GAClB,CAAC;;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4GG;AACH,qBACa,gBAAiB,SAAQ,qBAIrC;IAC2B,QAAQ,SAAK;IACb,QAAQ,SAAO;IACd,OAAO,UAAS;IAE3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAO;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmC;IAC9D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAmC;IAEvC,IAAI,EAAE,iBAAiB,CAA2B;IAEjD,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BAAgB;cA2CL,gBAAgB;IAI1B,iBAAiB,IAAI,IAAI;IAOlC,qGAAqG;IACrG,OAAO,CAAC,eAAe,CAAC,CAGtB;IAEF;;;;OAIG;IACH,OAAO,CAAC,4BAA4B;IAiBpC,OAAO,CAAC,6BAA6B;IASrC,yFAAyF;IACzF,OAAO,CAAC,aAAa;IAarB,sDAAsD;IACtD,OAAO,CAAC,2BAA2B;CAQpC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,gBAAgB,CAAC;KACxC;CACF"}
1
+ {"version":3,"file":"gauge-vertical.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/gauge-vertical/gauge-vertical.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAO,MAAM,KAAK,CAAC;AAErC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,KAAK,CAAC;AAIxC,OAAO,EACL,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACT,MAAM,aAAa,CAAC;AAKrB,OAAO,EASL,SAAS,EACT,QAAQ,EACR,cAAc,EAEd,iBAAiB,EAClB,MAAM,wDAAwD,CAAC;AAMhE,OAAO,EACL,SAAS,EACT,QAAQ,EACR,cAAc,EACd,UAAU,EACV,oBAAoB,EACpB,eAAe,EACf,iBAAiB,GAClB,CAAC;;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4GG;AACH,qBACa,gBAAiB,SAAQ,qBAIrC;IAC2B,QAAQ,SAAK;IACb,QAAQ,SAAO;IACd,OAAO,UAAS;IAE3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAO;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmC;IAC9D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAmC;IAEvC,IAAI,EAAE,iB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C,OAAO,CAAC,OAAO,EAAE,cAAc;IAoCxC;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;cA8CL,gBAAgB;IAI1B,iBAAiB,IAAI,IAAI;IAOlC,qGAAqG;IACrG,OAAO,CAAC,eAAe,CAAC,CAGtB;IAEF;;;;OAIG;IACH,OAAO,CAAC,4BAA4B;IAiBpC,OAAO,CAAC,6BAA6B;IASrC,yFAAyF;IACzF,OAAO,CAAC,aAAa;IAarB,sDAAsD;IACtD,OAAO,CAAC,2BAA2B;CAQpC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,gBAAgB,CAAC;KACxC;CACF"}
@@ -23,7 +23,10 @@ var ObcGaugeVertical = class ObcGaugeVertical extends AdviceMixin(SetpointMixin(
23
23
  this.fixedAspectRatio = false;
24
24
  this.scaleReferenceSize = 384;
25
25
  this._scale = 1;
26
- this._viewBoxThickness = 0;
26
+ this._thicknessAt = (scale) => this._layoutConfig ? computeExternalScaleLayout({
27
+ ...this._layoutConfig,
28
+ fixedAspectRatioScale: scale
29
+ }).thickness : 0;
27
30
  this._resizeController = new ResizeController(this, { callback: (entries) => {
28
31
  if (!this.fixedAspectRatio) return;
29
32
  const entry = entries[0];
@@ -33,7 +36,7 @@ var ObcGaugeVertical = class ObcGaugeVertical extends AdviceMixin(SetpointMixin(
33
36
  containerMainAxisSize: entry.contentRect.height,
34
37
  containerCrossAxisSize: entry.contentRect.width,
35
38
  scaleReferenceSize: this.scaleReferenceSize,
36
- viewBoxThickness: this._viewBoxThickness
39
+ viewBoxThickness: this._thicknessAt
37
40
  });
38
41
  this._scale = scale > 0 ? scale : 1;
39
42
  this.reportDimensions();
@@ -118,11 +121,13 @@ var ObcGaugeVertical = class ObcGaugeVertical extends AdviceMixin(SetpointMixin(
118
121
  adviceEmphasis: this.adviceEmphasis,
119
122
  adviceMaskPrefix: this._adviceMaskPrefix,
120
123
  fixedAspectRatio: this.fixedAspectRatio,
124
+ fixedAspectRatioScale: this.fixedAspectRatio ? this._scale : 1,
121
125
  instrumentMode: true,
122
126
  highlightCurrentValue: this.highlightCurrentValue
123
127
  };
124
- const layout = computeExternalScaleLayout(toExternalScaleLayoutConfig(config));
125
- this._viewBoxThickness = layout.thickness;
128
+ const layoutConfig = toExternalScaleLayoutConfig(config);
129
+ const layout = computeExternalScaleLayout(layoutConfig);
130
+ this._layoutConfig = layoutConfig;
126
131
  const parts = renderExternalScale(config);
127
132
  const viewBox = computeExternalScaleViewBox({
128
133
  orientation: config.orientation,
@@ -189,8 +194,11 @@ var ObcGaugeVertical = class ObcGaugeVertical extends AdviceMixin(SetpointMixin(
189
194
  labelThickness: this.labelThickness,
190
195
  length: this.fixedAspectRatio ? this.scaleReferenceSize : this.height,
191
196
  scaleType: this.scaleType,
197
+ advicePosition: this.advicePosition,
198
+ hasAdvice: !!this.advices && this.advices.length > 0,
192
199
  hasAdviceIcon: !!this.advices?.some((a) => a.showIcon),
193
- hasSetpoint: this.setpoint !== void 0 || this.newSetpoint !== void 0 || this.departingNewSetpoint !== void 0
200
+ hasSetpoint: this.setpoint !== void 0 || this.newSetpoint !== void 0 || this.departingNewSetpoint !== void 0,
201
+ fixedAspectRatioScale: this.fixedAspectRatio ? this._scale : 1
194
202
  });
195
203
  const dimensions = this.fixedAspectRatio ? {
196
204
  ...baseDimensions,
@@ -247,7 +255,7 @@ var ObcGaugeVertical = class ObcGaugeVertical extends AdviceMixin(SetpointMixin(
247
255
  containerMainAxisSize: height,
248
256
  containerCrossAxisSize: width,
249
257
  scaleReferenceSize: this.scaleReferenceSize,
250
- viewBoxThickness: this._viewBoxThickness
258
+ viewBoxThickness: this._thicknessAt
251
259
  });
252
260
  return true;
253
261
  }
@@ -1 +1 @@
1
- {"version":3,"file":"gauge-vertical.js","names":["_decorate"],"sources":["../../../src/navigation-instruments/gauge-vertical/gauge-vertical.ts"],"sourcesContent":["import {LitElement, html} from 'lit';\nimport {property, state} from 'lit/decorators.js';\nimport type {PropertyValues} from 'lit';\nimport {customElement} from '../../decorator.js';\nimport {ResizeController} from '@lit-labs/observers/resize-controller.js';\nimport {CHART_DIMENSIONS} from '../../charthelpers/constants.js';\nimport {\n InstrumentState,\n FrameStyle,\n BorderRadiusPosition,\n Priority,\n} from '../types.js';\nimport type {ExternalScaleConfig} from '../../building-blocks/external-scale/external-scale.js';\nimport {\n computeExternalScaleViewBox,\n computeFixedAspectRatioScale,\n computeExternalScaleLayout,\n renderExternalScale,\n toExternalScaleLayoutConfig,\n computeScaleDimensionsForReport,\n computeExternalScaleEffectiveBarThickness,\n readContentBox,\n ScaleType,\n FillMode,\n AdvicePosition,\n ExternalScaleOrientation,\n ExternalScaleSide,\n} from '../../building-blocks/external-scale/external-scale.js';\nimport {SetpointMixin} from '../../svghelpers/setpoint-mixin.js';\nimport {AdviceMixin} from '../../svghelpers/advice-mixin.js';\nimport {nextAdviceMaskId} from '../../svghelpers/advice.js';\n\n// Re-export shared enums for convenience\nexport {\n ScaleType,\n FillMode,\n AdvicePosition,\n FrameStyle,\n BorderRadiusPosition,\n InstrumentState,\n ExternalScaleSide,\n};\n\n/**\n * `<obc-gauge-vertical>` – A vertical gauge component with bar and scale background.\n *\n * Use `obc-gauge-vertical` when you need a standalone vertical gauge with a visible scale\n * and bar. This is ideal for displaying single values like tank levels, pressure, or\n * temperature where the scale context is always needed.\n *\n * This is the same as `obc-bar-vertical` (both use `external-scale.ts`)\n * but with several properties fixed for consistent gauge appearance.\n * Unlike `obc-bar-vertical`, this component always shows the bar and scale background.\n *\n * ---\n *\n * ### Features\n * - **Fixed Layout:** Height (384px), padding (32px), bar/tick/label thicknesses, and border radius are fixed for consistent gauge appearance. 384 px is the length the design is drawn at, not a layout limit: see `fixedAspectRatio`.\n * - **Scale Configuration:**\n * - Configurable `minValue` and `maxValue` for the value range.\n * - Optional main, primary, secondary, and tertiary tickmarks at specified intervals.\n * - Labels shown at primary tickmark intervals (controlled via `showLabels`).\n * - **Side Positioning:** Can be placed on the `left` or `right` side via the `side` property.\n * - **Value Display:**\n * - `value` property drives the bar fill.\n * - `fillMode` controls visualization: `fill` shows bar from `fillMin` to `fillMax`; `tint` adds a marker at the `value` position.\n * - Set `priority` to `Priority.enhanced` to use the blue/enhanced color palette for bar fill and setpoint (default: `Priority.regular`).\n * - **Setpoint Marker:**\n * - Optional `setpoint` value displays a marker.\n * - Automatic at-setpoint detection with configurable deadband.\n * - **Advice Overlays:** Render advice ranges with different types and hinted states.\n * - **Fixed Aspect Ratio:** `fixedAspectRatio` scales the whole gauge to its container like a vector image while the label font size stays put; `scaleReferenceSize` is the container height at which it draws 1:1.\n * - **Dimension Reporting:** Dispatches `scale-dimensions-changed` events for parent chart integration.\n *\n * ---\n *\n * ### Fixed Properties (not configurable)\n * - `height`: 384px\n * - `paddingTop`/`paddingBottom`: 32px (`CHART_DIMENSIONS.CANVAS_PADDING`)\n * - `barThickness`: 48px\n * - `tickThickness`: 24px\n * - `labelThickness`: 60px\n * - `borderRadius`: 8px (matches obc-component-size-medium)\n * - `scaleType`: regular\n * - `frameStyle`: regular\n * - `hasBar`: true\n * - `hasScale`: true\n * - `scaleBackground`: true\n *\n * ---\n *\n * ### Implementation\n * This is a higher fidelity implementation of the concept shown in `instrument-linear.ts`,\n * providing a complete gauge with container, scale background, tickmarks, labels, advice overlays, and setpoint marker.\n *\n * This is a thin web-component wrapper around the pure SVG building-block renderer in `external-scale.ts`.\n * It sets up the outer `<svg>`/`viewBox` for a vertical scale and delegates rendering/layout to:\n * - `computeExternalScaleLayout(...)`\n * - `renderExternalScale(config)`\n *\n * For renderer documentation see: **Building Blocks/External Scale**.\n *\n * For a version where these properties are user-configurable, see **Bars and Graphs/Bar Vertical**.\n *\n * ---\n *\n * ### Events\n * - `scale-dimensions-changed` – Fired when layout-affecting properties (`side`, `showLabels`) change, reporting dimensions to parent chart components.\n *\n * ---\n *\n * ### Example\n *\n * ```html\n * <obc-gauge-vertical\n * min-value=\"0\"\n * max-value=\"100\"\n * value=\"75\"\n * primary-tickmark-interval=\"20\"\n * secondary-tickmark-interval=\"10\"\n * setpoint=\"80\"\n * side=\"right\"\n * ></obc-gauge-vertical>\n * ```\n *\n * @property minValue - Minimum scale value\n * @property maxValue - Maximum scale value\n * @property reverse - Plot `minValue` at the top so values grow downward.\n * @property side - Which side of the chart area this scale lives on (left or right)\n * @property fixedAspectRatio - Scale the whole gauge to its container like a vector image, keeping the label font size: the SVG fills the host, so size the host. Off, the gauge draws at its 384 px reference height.\n * @property scaleReferenceSize - Container height at which a `fixedAspectRatio` gauge draws 1:1 with the design. A taller container enlarges the drawing proportionally, a shorter one shrinks it.\n * @availableWhen scaleReferenceSize fixedAspectRatio==true\n * @property showLabels - Show numerical value labels at primary tickmarks\n * @property mainTickmarks - Array of values for main tickmarks. When undefined, no main tickmarks shown. When empty array [], defaults to [minValue, 0, maxValue].\n * @property primaryTickmarkInterval - Interval for primary (longest) tickmarks with labels\n * @property secondaryTickmarkInterval - Interval for secondary (medium) tickmarks\n * @property tertiaryTickmarkInterval - Interval for tertiary (shortest) tickmarks\n * @property borderRadiusPosition - Border radius position based on component layout\n * @property priority - Color priority: enhanced uses blue instrument colors for bar fill and setpoint\n * @property fillMode - Fill visualization mode: 'fill' shows bar from fillMin to fillMax; 'tint' adds a marker at the value position\n * @property fillMin - Minimum fill value (defaults to 0)\n * @property fillMax - Maximum fill value (defaults to value)\n * @property value - Current value (bar fill level)\n * @property state - Instrument state: active, loading, or off\n * @property advices - Advice/alert overlays with min, max, type, and hinted state. When undefined or empty, no advice shown.\n * @property highlightCurrentValue - When true, displays a dot indicator at the current value position.\n * The dot is rendered in the scale band, touching its inner edge (towards the chart).\n * This provides an alternative to bar fill for highlighting the current value.\n * @property focused - Earlier name for `touching`: a change to it sets `touching`, unless `touching` changes in the same update, which then wins. It is not updated from `touching`, so it does not read back the current value.\n * @fires {CustomEvent} scale-dimensions-changed - Fired when layout-affecting properties change, providing dimension info for parent chart integration. It bubbles to the chart slot the gauge sits in and does not leave the shadow root around it.\n * @stable\n */\n@customElement('obc-gauge-vertical')\nexport class ObcGaugeVertical extends AdviceMixin(\n SetpointMixin(LitElement, {\n defaultDeadband: 1,\n })\n) {\n @property({type: Number}) minValue = 0;\n @property({type: Number}) maxValue = 100;\n @property({type: Boolean}) reverse = false;\n\n private readonly height = 384;\n private readonly paddingTop = CHART_DIMENSIONS.CANVAS_PADDING;\n private readonly paddingBottom = CHART_DIMENSIONS.CANVAS_PADDING;\n\n @property({type: String}) side: ExternalScaleSide = ExternalScaleSide.right;\n\n @property({type: Boolean}) fixedAspectRatio = false;\n @property({type: Number}) scaleReferenceSize = 384;\n\n @state()\n private _scale = 1;\n\n /** The drawing's width in viewBox units, kept from the last render for the scale measurement. */\n private _viewBoxThickness = 0;\n\n // ResizeController automatically subscribes/unsubscribes based on component lifecycle\n // @ts-expect-error - Controller is used for side effects, not accessed directly\n private _resizeController = new ResizeController(this, {\n callback: (entries) => {\n if (!this.fixedAspectRatio) return;\n\n const entry = entries[0];\n if (!entry) return;\n\n const scale = computeFixedAspectRatioScale({\n orientation: ExternalScaleOrientation.vertical,\n containerMainAxisSize: entry.contentRect.height,\n containerCrossAxisSize: entry.contentRect.width,\n scaleReferenceSize: this.scaleReferenceSize,\n viewBoxThickness: this._viewBoxThickness,\n });\n // Guard against zero-sized containers, but allow fractional scales < 1\n this._scale = scale > 0 ? scale : 1;\n\n // Report scaled dimensions to parent chart\n this.reportDimensions();\n },\n });\n\n @property({type: Boolean, attribute: false}) showLabels = true;\n private readonly barThickness = 48;\n private readonly tickThickness = 24;\n private readonly labelThickness = 60;\n\n @property({type: Array, attribute: false}) mainTickmarks?: number[] = [];\n @property({type: Number}) primaryTickmarkInterval?: number = undefined;\n @property({type: Number}) secondaryTickmarkInterval?: number = undefined;\n @property({type: Number}) tertiaryTickmarkInterval?: number = undefined;\n private readonly scaleType: ScaleType = ScaleType.regular;\n private readonly frameStyle: FrameStyle = FrameStyle.regular;\n @property({type: String, attribute: false})\n borderRadiusPosition?: BorderRadiusPosition =\n BorderRadiusPosition.innerFirstChild;\n\n private readonly borderRadius = 8;\n\n private get hasBar(): boolean {\n return true;\n }\n\n private get scaleBackground(): boolean {\n return true;\n }\n\n private get hasScale(): boolean {\n return true;\n }\n\n @property({type: String}) priority: Priority = Priority.regular;\n @property({type: String}) fillMode: FillMode = FillMode.fill;\n @property({type: Number}) fillMin?: number = undefined;\n @property({type: Number}) fillMax?: number = undefined;\n @property({type: Number}) value?: number = undefined;\n\n @property({type: String}) state: InstrumentState = InstrumentState.active;\n\n /**\n * @deprecated Use `touching` (from SetpointMixin) instead.\n * Kept for backward compatibility. Synced to `touching` in `willUpdate()`.\n */\n @property({type: Boolean}) focused = false;\n\n private readonly advicePosition: AdvicePosition = AdvicePosition.inner;\n // Mask ids are document-scoped, so each gauge names its own.\n private readonly _adviceMaskPrefix = nextAdviceMaskId('gauge');\n\n @property({type: Boolean}) highlightCurrentValue = false;\n\n override render() {\n // A chart pushes its own height to a slotted scale; in fixedAspectRatio\n // mode the drawing keeps its reference length and the SVG scales it.\n const effectiveLength = this.fixedAspectRatio\n ? this.scaleReferenceSize\n : this.height;\n\n const config: ExternalScaleConfig = {\n orientation: ExternalScaleOrientation.vertical,\n side: this.side,\n length: effectiveLength,\n paddingStart: this.paddingTop,\n paddingEnd: this.paddingBottom,\n minValue: this.minValue,\n maxValue: this.maxValue,\n reverse: this.reverse,\n hasScale: this.hasScale,\n labels: this.showLabels,\n hasBar: this.hasBar,\n scaleBackground: this.scaleBackground,\n barThickness: this.barThickness,\n tickThickness: this.tickThickness,\n labelThickness: this.labelThickness,\n mainTickmarks: this.mainTickmarks,\n primaryTickmarkInterval: this.primaryTickmarkInterval,\n secondaryTickmarkInterval: this.secondaryTickmarkInterval,\n tertiaryTickmarkInterval: this.tertiaryTickmarkInterval,\n scaleType: this.scaleType,\n frameStyle: this.frameStyle,\n borderRadiusPosition: this.borderRadiusPosition,\n borderRadius: this.borderRadius,\n priority: this.priority,\n fillMode: this.fillMode,\n fillMin: this.fillMin,\n fillMax: this.fillMax,\n value: this.value,\n setpoint: this.setpoint,\n newSetpoint: this.newSetpoint,\n atSetpoint: this.atSetpoint,\n autoAtSetpoint: this.autoAtSetpoint,\n autoAtSetpointDeadband: this.autoAtSetpointDeadband,\n setpointAtZeroDeadband: this.setpointAtZeroDeadband,\n animateSetpoint: this.animateSetpoint,\n departingNewSetpoint: this.departingNewSetpoint,\n state: this.state,\n touching: this.touching,\n setpointOverride: this.setpointOverride,\n advicePosition: this.advicePosition,\n advices: this.advices,\n adviceTrigger: this.adviceTrigger,\n adviceEmphasis: this.adviceEmphasis,\n adviceMaskPrefix: this._adviceMaskPrefix,\n fixedAspectRatio: this.fixedAspectRatio,\n // Gauges are always in instrument mode - they use fixed borderRadius (8px)\n // and don't respond to .obc-component-size-* CSS classes for border radius\n instrumentMode: true,\n highlightCurrentValue: this.highlightCurrentValue,\n };\n\n const layout = computeExternalScaleLayout(\n toExternalScaleLayoutConfig(config)\n );\n this._viewBoxThickness = layout.thickness;\n\n const parts = renderExternalScale(config);\n\n const viewBox = computeExternalScaleViewBox(\n {orientation: config.orientation, length: effectiveLength},\n layout\n );\n const preserveAspectRatio = this.fixedAspectRatio\n ? 'xMidYMid meet'\n : 'none';\n\n return html`\n <svg\n width=${this.fixedAspectRatio ? '100%' : `${viewBox.width}px`}\n height=${this.fixedAspectRatio ? '100%' : `${this.height}px`}\n viewBox=\"${viewBox.x} ${viewBox.y} ${viewBox.width} ${viewBox.height}\"\n preserveAspectRatio=\"${preserveAspectRatio}\"\n style=\"--scale: ${\n this.fixedAspectRatio ? this._scale : 1\n }; display: block;\"\n part=\"svg\"\n >\n ${parts.barContainer} ${parts.barFill} ${parts.scaleBackground}\n ${parts.tickmarks} ${parts.labels} ${parts.adviceOverlays}\n ${parts.currentValueDot} ${parts.setpoint}\n </svg>\n `;\n }\n\n override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n\n // Sync deprecated alias to mixin property\n // Only sync if the alias was set and the mixin property was NOT also set.\n if (changed.has('focused') && !changed.has('touching')) {\n this.touching = this.focused;\n }\n }\n\n override updated(changed: PropertyValues) {\n super.updated(changed);\n\n // Only the styles this element applied are removed: the first update\n // lists every property, and a consumer's inline style is theirs.\n if (changed.has('fixedAspectRatio')) {\n if (this.fixedAspectRatio) {\n this._applyFixedAspectRatioStyles();\n this._updateScaleFromCurrentSize();\n } else if (changed.get('fixedAspectRatio') === true) {\n this._removeFixedAspectRatioStyles();\n this._scale = 1;\n }\n }\n\n if (changed.has('scaleReferenceSize') && this.fixedAspectRatio) {\n this._updateScaleFromCurrentSize();\n }\n\n // The reported thickness follows the bands, the advice icons, the\n // setpoint marker band and the mode, whichever mode is on; a resize\n // re-reports through the ResizeController.\n if (\n changed.has('fixedAspectRatio') ||\n changed.has('side') ||\n changed.has('showLabels') ||\n changed.has('advices') ||\n this.setpointPresenceChanged(changed)\n ) {\n // A thinner or thicker drawing under the same box changes the painted\n // scale without a resize event.\n if (this.fixedAspectRatio) this._measureScale();\n this.reportDimensions();\n }\n }\n\n /**\n * Report scale dimensions to parent chart component.\n * When fixedAspectRatio=true, reports the actual visual (scaled) thickness\n * so the chart can correctly reserve space for the scale.\n * When fixedAspectRatio=false, reports the base/unscaled thickness.\n */\n private reportDimensions() {\n const effectiveBarThickness = computeExternalScaleEffectiveBarThickness({\n hasBar: this.hasBar,\n barThickness: this.barThickness,\n borderRadius: this.borderRadius,\n scaleType: this.scaleType,\n });\n\n const baseDimensions = computeScaleDimensionsForReport({\n orientation: ExternalScaleOrientation.vertical,\n side: this.side,\n hasBar: this.hasBar,\n hasScale: this.hasScale,\n labels: this.showLabels,\n barThickness: effectiveBarThickness,\n tickThickness: this.tickThickness,\n labelThickness: this.labelThickness,\n length: this.fixedAspectRatio ? this.scaleReferenceSize : this.height,\n scaleType: this.scaleType,\n hasAdviceIcon: !!this.advices?.some((a) => a.showIcon),\n hasSetpoint:\n this.setpoint !== undefined ||\n this.newSetpoint !== undefined ||\n this.departingNewSetpoint !== undefined,\n });\n\n // The chart lays out in visual pixels, so a scaled drawing reports its\n // scaled thickness.\n const dimensions = this.fixedAspectRatio\n ? {\n ...baseDimensions,\n thickness: Math.round(baseDimensions.thickness * this._scale),\n }\n : baseDimensions;\n\n this.dispatchEvent(\n new CustomEvent('scale-dimensions-changed', {\n detail: dimensions,\n bubbles: true,\n })\n );\n }\n\n protected override createRenderRoot() {\n return this;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (this.fixedAspectRatio) {\n this._applyFixedAspectRatioStyles();\n }\n }\n\n /** The inline sizing, value and priority, the consumer had before fixedAspectRatio took the host. */\n private _consumerSizing?: Record<\n 'display' | 'height' | 'width',\n [value: string, priority: string]\n >;\n\n /**\n * A custom element is inline by default, which gives the percentage-sized\n * SVG nothing to fill; in fixedAspectRatio mode the host is a block that\n * takes its container's height.\n */\n private _applyFixedAspectRatioStyles(): void {\n if (!this._consumerSizing) {\n const snapshot = (name: string): [string, string] => [\n this.style.getPropertyValue(name),\n this.style.getPropertyPriority(name),\n ];\n this._consumerSizing = {\n display: snapshot('display'),\n height: snapshot('height'),\n width: snapshot('width'),\n };\n }\n this.style.display = 'block';\n this.style.height = '100%';\n this.style.width = 'auto';\n }\n\n private _removeFixedAspectRatioStyles(): void {\n const saved = this._consumerSizing;\n this._consumerSizing = undefined;\n for (const name of ['display', 'height', 'width'] as const) {\n const [value, priority] = saved?.[name] ?? ['', ''];\n this.style.setProperty(name, value, priority);\n }\n }\n\n /** Reads the host's content box into the scale; false while the host has no size yet. */\n private _measureScale(): boolean {\n const {width, height} = readContentBox(this);\n if (height <= 0) return false;\n this._scale = computeFixedAspectRatioScale({\n orientation: ExternalScaleOrientation.vertical,\n containerMainAxisSize: height,\n containerCrossAxisSize: width,\n scaleReferenceSize: this.scaleReferenceSize,\n viewBoxThickness: this._viewBoxThickness,\n });\n return true;\n }\n\n /** Measures once layout has settled, then reports. */\n private _updateScaleFromCurrentSize(): void {\n requestAnimationFrame(() => {\n if (this._measureScale()) {\n this.requestUpdate();\n this.reportDimensions();\n }\n });\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-gauge-vertical': ObcGaugeVertical;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAyJO,IAAM,mBAAN,MAAM,yBAAyB,YACpC,cAAc,YAAY,EACxB,iBAAiB,EACnB,CAAC,CACH,CAAC,CAAC;;;EACqC,KAAA,WAAA;EACA,KAAA,WAAA;EACA,KAAA,UAAA;EAEX,KAAA,SAAA;EACI,KAAA,aAAA,iBAAiB;EACd,KAAA,gBAAA,iBAAiB;EAEE,KAAA,OAAA,kBAAkB;EAExB,KAAA,mBAAA;EACC,KAAA,qBAAA;EAG9B,KAAA,SAAA;EAGW,KAAA,oBAAA;EAIA,KAAA,oBAAA,IAAI,iBAAiB,MAAM,EACrD,WAAW,YAAY;GACrB,IAAI,CAAC,KAAK,kBAAkB;GAE5B,MAAM,QAAQ,QAAQ;GACtB,IAAI,CAAC,OAAO;GAEZ,MAAM,QAAQ,6BAA6B;IACzC,aAAa,yBAAyB;IACtC,uBAAuB,MAAM,YAAY;IACzC,wBAAwB,MAAM,YAAY;IAC1C,oBAAoB,KAAK;IACzB,kBAAkB,KAAK;GACzB,CAAC;GAED,KAAK,SAAS,QAAQ,IAAI,QAAQ;GAGlC,KAAK,iBAAiB;EACxB,EACF,CAAC;EAEyD,KAAA,aAAA;EAC1B,KAAA,eAAA;EACC,KAAA,gBAAA;EACC,KAAA,iBAAA;EAEoC,KAAA,gBAAA,CAAC;EACV,KAAA,0BAAA,KAAA;EACE,KAAA,4BAAA,KAAA;EACD,KAAA,2BAAA,KAAA;EACtB,KAAA,YAAA,UAAU;EACR,KAAA,aAAA,WAAW;EAGnD,KAAA,uBAAA,qBAAqB;EAES,KAAA,eAAA;EAce,KAAA,WAAA,SAAS;EACT,KAAA,WAAA,SAAS;EACX,KAAA,UAAA,KAAA;EACA,KAAA,UAAA,KAAA;EACF,KAAA,QAAA,KAAA;EAEQ,KAAA,QAAA,g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A,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,iBAAA,WAAA,yBAAA,KAAA,CAAA;AAhG1B,mBAAAA,WAAA,CAAA,cAAc,oBAAoB,CAAA,GAAA,gBAAA"}
1
+ {"version":3,"file":"gauge-vertical.js","names":["_decorate"],"sources":["../../../src/navigation-instruments/gauge-vertical/gauge-vertical.ts"],"sourcesContent":["import {LitElement, html} from 'lit';\nimport {property, state} from 'lit/decorators.js';\nimport type {PropertyValues} from 'lit';\nimport {customElement} from '../../decorator.js';\nimport {ResizeController} from '@lit-labs/observers/resize-controller.js';\nimport {CHART_DIMENSIONS} from '../../charthelpers/constants.js';\nimport {\n InstrumentState,\n FrameStyle,\n BorderRadiusPosition,\n Priority,\n} from '../types.js';\nimport type {\n ExternalScaleConfig,\n ExternalScaleLayoutConfig,\n} from '../../building-blocks/external-scale/external-scale.js';\nimport {\n computeExternalScaleViewBox,\n computeFixedAspectRatioScale,\n computeExternalScaleLayout,\n renderExternalScale,\n toExternalScaleLayoutConfig,\n computeScaleDimensionsForReport,\n computeExternalScaleEffectiveBarThickness,\n readContentBox,\n ScaleType,\n FillMode,\n AdvicePosition,\n ExternalScaleOrientation,\n ExternalScaleSide,\n} from '../../building-blocks/external-scale/external-scale.js';\nimport {SetpointMixin} from '../../svghelpers/setpoint-mixin.js';\nimport {AdviceMixin} from '../../svghelpers/advice-mixin.js';\nimport {nextAdviceMaskId} from '../../svghelpers/advice.js';\n\n// Re-export shared enums for convenience\nexport {\n ScaleType,\n FillMode,\n AdvicePosition,\n FrameStyle,\n BorderRadiusPosition,\n InstrumentState,\n ExternalScaleSide,\n};\n\n/**\n * `<obc-gauge-vertical>` – A vertical gauge component with bar and scale background.\n *\n * Use `obc-gauge-vertical` when you need a standalone vertical gauge with a visible scale\n * and bar. This is ideal for displaying single values like tank levels, pressure, or\n * temperature where the scale context is always needed.\n *\n * This is the same as `obc-bar-vertical` (both use `external-scale.ts`)\n * but with several properties fixed for consistent gauge appearance.\n * Unlike `obc-bar-vertical`, this component always shows the bar and scale background.\n *\n * ---\n *\n * ### Features\n * - **Fixed Layout:** Height (384px), padding (32px), bar/tick/label thicknesses, and border radius are fixed for consistent gauge appearance. 384 px is the length the design is drawn at, not a layout limit: see `fixedAspectRatio`.\n * - **Scale Configuration:**\n * - Configurable `minValue` and `maxValue` for the value range.\n * - Optional main, primary, secondary, and tertiary tickmarks at specified intervals.\n * - Labels shown at primary tickmark intervals (controlled via `showLabels`).\n * - **Side Positioning:** Can be placed on the `left` or `right` side via the `side` property.\n * - **Value Display:**\n * - `value` property drives the bar fill.\n * - `fillMode` controls visualization: `fill` shows bar from `fillMin` to `fillMax`; `tint` adds a marker at the `value` position.\n * - Set `priority` to `Priority.enhanced` to use the blue/enhanced color palette for bar fill and setpoint (default: `Priority.regular`).\n * - **Setpoint Marker:**\n * - Optional `setpoint` value displays a marker.\n * - Automatic at-setpoint detection with configurable deadband.\n * - **Advice Overlays:** Render advice ranges with different types and hinted states.\n * - **Fixed Aspect Ratio:** `fixedAspectRatio` scales the whole gauge to its container like a vector image while the label font size stays put; `scaleReferenceSize` is the container height at which it draws 1:1.\n * - **Dimension Reporting:** Dispatches `scale-dimensions-changed` events for parent chart integration.\n *\n * ---\n *\n * ### Fixed Properties (not configurable)\n * - `height`: 384px\n * - `paddingTop`/`paddingBottom`: 32px (`CHART_DIMENSIONS.CANVAS_PADDING`)\n * - `barThickness`: 48px\n * - `tickThickness`: 24px\n * - `labelThickness`: 60px\n * - `borderRadius`: 8px (matches obc-component-size-medium)\n * - `scaleType`: regular\n * - `frameStyle`: regular\n * - `hasBar`: true\n * - `hasScale`: true\n * - `scaleBackground`: true\n *\n * ---\n *\n * ### Implementation\n * This is a higher fidelity implementation of the concept shown in `instrument-linear.ts`,\n * providing a complete gauge with container, scale background, tickmarks, labels, advice overlays, and setpoint marker.\n *\n * This is a thin web-component wrapper around the pure SVG building-block renderer in `external-scale.ts`.\n * It sets up the outer `<svg>`/`viewBox` for a vertical scale and delegates rendering/layout to:\n * - `computeExternalScaleLayout(...)`\n * - `renderExternalScale(config)`\n *\n * For renderer documentation see: **Building Blocks/External Scale**.\n *\n * For a version where these properties are user-configurable, see **Bars and Graphs/Bar Vertical**.\n *\n * ---\n *\n * ### Events\n * - `scale-dimensions-changed` – Fired when layout-affecting properties (`side`, `showLabels`) change, reporting dimensions to parent chart components.\n *\n * ---\n *\n * ### Example\n *\n * ```html\n * <obc-gauge-vertical\n * min-value=\"0\"\n * max-value=\"100\"\n * value=\"75\"\n * primary-tickmark-interval=\"20\"\n * secondary-tickmark-interval=\"10\"\n * setpoint=\"80\"\n * side=\"right\"\n * ></obc-gauge-vertical>\n * ```\n *\n * @property minValue - Minimum scale value\n * @property maxValue - Maximum scale value\n * @property reverse - Plot `minValue` at the top so values grow downward.\n * @property side - Which side of the chart area this scale lives on (left or right)\n * @property fixedAspectRatio - Scale the whole gauge to its container like a vector image, keeping the label font size: the SVG fills the host, so size the host. Off, the gauge draws at its 384 px reference height.\n * @property scaleReferenceSize - Container height at which a `fixedAspectRatio` gauge draws 1:1 with the design. A taller container enlarges the drawing proportionally, a shorter one shrinks it.\n * @availableWhen scaleReferenceSize fixedAspectRatio==true\n * @property showLabels - Show numerical value labels at primary tickmarks\n * @property mainTickmarks - Array of values for main tickmarks. When undefined, no main tickmarks shown. When empty array [], defaults to [minValue, 0, maxValue].\n * @property primaryTickmarkInterval - Interval for primary (longest) tickmarks with labels\n * @property secondaryTickmarkInterval - Interval for secondary (medium) tickmarks\n * @property tertiaryTickmarkInterval - Interval for tertiary (shortest) tickmarks\n * @property borderRadiusPosition - Border radius position based on component layout\n * @property priority - Color priority: enhanced uses blue instrument colors for bar fill and setpoint\n * @property fillMode - Fill visualization mode: 'fill' shows bar from fillMin to fillMax; 'tint' adds a marker at the value position\n * @property fillMin - Minimum fill value (defaults to 0)\n * @property fillMax - Maximum fill value (defaults to value)\n * @property value - Current value (bar fill level)\n * @property state - Instrument state: active, loading, or off\n * @property advices - Advice/alert overlays with min, max, type, and hinted state. When undefined or empty, no advice shown.\n * @property highlightCurrentValue - When true, displays a dot indicator at the current value position.\n * The dot is rendered in the scale band, touching its inner edge (towards the chart).\n * This provides an alternative to bar fill for highlighting the current value.\n * @property focused - Earlier name for `touching`: a change to it sets `touching`, unless `touching` changes in the same update, which then wins. It is not updated from `touching`, so it does not read back the current value.\n * @fires {CustomEvent} scale-dimensions-changed - Fired when layout-affecting properties change, providing dimension info for parent chart integration. It bubbles to the chart slot the gauge sits in and does not leave the shadow root around it.\n * @stable\n */\n@customElement('obc-gauge-vertical')\nexport class ObcGaugeVertical extends AdviceMixin(\n SetpointMixin(LitElement, {\n defaultDeadband: 1,\n })\n) {\n @property({type: Number}) minValue = 0;\n @property({type: Number}) maxValue = 100;\n @property({type: Boolean}) reverse = false;\n\n private readonly height = 384;\n private readonly paddingTop = CHART_DIMENSIONS.CANVAS_PADDING;\n private readonly paddingBottom = CHART_DIMENSIONS.CANVAS_PADDING;\n\n @property({type: String}) side: ExternalScaleSide = ExternalScaleSide.right;\n\n @property({type: Boolean}) fixedAspectRatio = false;\n @property({type: Number}) scaleReferenceSize = 384;\n\n @state()\n private _scale = 1;\n\n /** The last render's layout inputs, for the scale measurement. */\n private _layoutConfig?: ExternalScaleLayoutConfig;\n\n /** The drawing's width in viewBox units at a scale: the advice column is pixels, so it depends on it. */\n private _thicknessAt = (scale: number): number =>\n this._layoutConfig\n ? computeExternalScaleLayout({\n ...this._layoutConfig,\n fixedAspectRatioScale: scale,\n }).thickness\n : 0;\n\n // ResizeController automatically subscribes/unsubscribes based on component lifecycle\n // @ts-expect-error - Controller is used for side effects, not accessed directly\n private _resizeController = new ResizeController(this, {\n callback: (entries) => {\n if (!this.fixedAspectRatio) return;\n\n const entry = entries[0];\n if (!entry) return;\n\n const scale = computeFixedAspectRatioScale({\n orientation: ExternalScaleOrientation.vertical,\n containerMainAxisSize: entry.contentRect.height,\n containerCrossAxisSize: entry.contentRect.width,\n scaleReferenceSize: this.scaleReferenceSize,\n viewBoxThickness: this._thicknessAt,\n });\n // Guard against zero-sized containers, but allow fractional scales < 1\n this._scale = scale > 0 ? scale : 1;\n\n // Report scaled dimensions to parent chart\n this.reportDimensions();\n },\n });\n\n @property({type: Boolean, attribute: false}) showLabels = true;\n private readonly barThickness = 48;\n private readonly tickThickness = 24;\n private readonly labelThickness = 60;\n\n @property({type: Array, attribute: false}) mainTickmarks?: number[] = [];\n @property({type: Number}) primaryTickmarkInterval?: number = undefined;\n @property({type: Number}) secondaryTickmarkInterval?: number = undefined;\n @property({type: Number}) tertiaryTickmarkInterval?: number = undefined;\n private readonly scaleType: ScaleType = ScaleType.regular;\n private readonly frameStyle: FrameStyle = FrameStyle.regular;\n @property({type: String, attribute: false})\n borderRadiusPosition?: BorderRadiusPosition =\n BorderRadiusPosition.innerFirstChild;\n\n private readonly borderRadius = 8;\n\n private get hasBar(): boolean {\n return true;\n }\n\n private get scaleBackground(): boolean {\n return true;\n }\n\n private get hasScale(): boolean {\n return true;\n }\n\n @property({type: String}) priority: Priority = Priority.regular;\n @property({type: String}) fillMode: FillMode = FillMode.fill;\n @property({type: Number}) fillMin?: number = undefined;\n @property({type: Number}) fillMax?: number = undefined;\n @property({type: Number}) value?: number = undefined;\n\n @property({type: String}) state: InstrumentState = InstrumentState.active;\n\n /**\n * @deprecated Use `touching` (from SetpointMixin) instead.\n * Kept for backward compatibility. Synced to `touching` in `willUpdate()`.\n */\n @property({type: Boolean}) focused = false;\n\n private readonly advicePosition: AdvicePosition = AdvicePosition.inner;\n // Mask ids are document-scoped, so each gauge names its own.\n private readonly _adviceMaskPrefix = nextAdviceMaskId('gauge');\n\n @property({type: Boolean}) highlightCurrentValue = false;\n\n override render() {\n // A chart pushes its own height to a slotted scale; in fixedAspectRatio\n // mode the drawing keeps its reference length and the SVG scales it.\n const effectiveLength = this.fixedAspectRatio\n ? this.scaleReferenceSize\n : this.height;\n\n const config: ExternalScaleConfig = {\n orientation: ExternalScaleOrientation.vertical,\n side: this.side,\n length: effectiveLength,\n paddingStart: this.paddingTop,\n paddingEnd: this.paddingBottom,\n minValue: this.minValue,\n maxValue: this.maxValue,\n reverse: this.reverse,\n hasScale: this.hasScale,\n labels: this.showLabels,\n hasBar: this.hasBar,\n scaleBackground: this.scaleBackground,\n barThickness: this.barThickness,\n tickThickness: this.tickThickness,\n labelThickness: this.labelThickness,\n mainTickmarks: this.mainTickmarks,\n primaryTickmarkInterval: this.primaryTickmarkInterval,\n secondaryTickmarkInterval: this.secondaryTickmarkInterval,\n tertiaryTickmarkInterval: this.tertiaryTickmarkInterval,\n scaleType: this.scaleType,\n frameStyle: this.frameStyle,\n borderRadiusPosition: this.borderRadiusPosition,\n borderRadius: this.borderRadius,\n priority: this.priority,\n fillMode: this.fillMode,\n fillMin: this.fillMin,\n fillMax: this.fillMax,\n value: this.value,\n setpoint: this.setpoint,\n newSetpoint: this.newSetpoint,\n atSetpoint: this.atSetpoint,\n autoAtSetpoint: this.autoAtSetpoint,\n autoAtSetpointDeadband: this.autoAtSetpointDeadband,\n setpointAtZeroDeadband: this.setpointAtZeroDeadband,\n animateSetpoint: this.animateSetpoint,\n departingNewSetpoint: this.departingNewSetpoint,\n state: this.state,\n touching: this.touching,\n setpointOverride: this.setpointOverride,\n advicePosition: this.advicePosition,\n advices: this.advices,\n adviceTrigger: this.adviceTrigger,\n adviceEmphasis: this.adviceEmphasis,\n adviceMaskPrefix: this._adviceMaskPrefix,\n fixedAspectRatio: this.fixedAspectRatio,\n fixedAspectRatioScale: this.fixedAspectRatio ? this._scale : 1,\n // Gauges are always in instrument mode - they use fixed borderRadius (8px)\n // and don't respond to .obc-component-size-* CSS classes for border radius\n instrumentMode: true,\n highlightCurrentValue: this.highlightCurrentValue,\n };\n\n const layoutConfig = toExternalScaleLayoutConfig(config);\n const layout = computeExternalScaleLayout(layoutConfig);\n this._layoutConfig = layoutConfig;\n\n const parts = renderExternalScale(config);\n\n const viewBox = computeExternalScaleViewBox(\n {orientation: config.orientation, length: effectiveLength},\n layout\n );\n const preserveAspectRatio = this.fixedAspectRatio\n ? 'xMidYMid meet'\n : 'none';\n\n return html`\n <svg\n width=${this.fixedAspectRatio ? '100%' : `${viewBox.width}px`}\n height=${this.fixedAspectRatio ? '100%' : `${this.height}px`}\n viewBox=\"${viewBox.x} ${viewBox.y} ${viewBox.width} ${viewBox.height}\"\n preserveAspectRatio=\"${preserveAspectRatio}\"\n style=\"--scale: ${\n this.fixedAspectRatio ? this._scale : 1\n }; display: block;\"\n part=\"svg\"\n >\n ${parts.barContainer} ${parts.barFill} ${parts.scaleBackground}\n ${parts.tickmarks} ${parts.labels} ${parts.adviceOverlays}\n ${parts.currentValueDot} ${parts.setpoint}\n </svg>\n `;\n }\n\n override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n\n // Sync deprecated alias to mixin property\n // Only sync if the alias was set and the mixin property was NOT also set.\n if (changed.has('focused') && !changed.has('touching')) {\n this.touching = this.focused;\n }\n }\n\n override updated(changed: PropertyValues) {\n super.updated(changed);\n\n // Only the styles this element applied are removed: the first update\n // lists every property, and a consumer's inline style is theirs.\n if (changed.has('fixedAspectRatio')) {\n if (this.fixedAspectRatio) {\n this._applyFixedAspectRatioStyles();\n this._updateScaleFromCurrentSize();\n } else if (changed.get('fixedAspectRatio') === true) {\n this._removeFixedAspectRatioStyles();\n this._scale = 1;\n }\n }\n\n if (changed.has('scaleReferenceSize') && this.fixedAspectRatio) {\n this._updateScaleFromCurrentSize();\n }\n\n // The reported thickness follows the bands, the advice icons, the\n // setpoint marker band and the mode, whichever mode is on; a resize\n // re-reports through the ResizeController.\n if (\n changed.has('fixedAspectRatio') ||\n changed.has('side') ||\n changed.has('showLabels') ||\n changed.has('advices') ||\n this.setpointPresenceChanged(changed)\n ) {\n // A thinner or thicker drawing under the same box changes the painted\n // scale without a resize event.\n if (this.fixedAspectRatio) this._measureScale();\n this.reportDimensions();\n }\n }\n\n /**\n * Report scale dimensions to parent chart component.\n * When fixedAspectRatio=true, reports the actual visual (scaled) thickness\n * so the chart can correctly reserve space for the scale.\n * When fixedAspectRatio=false, reports the base/unscaled thickness.\n */\n private reportDimensions() {\n const effectiveBarThickness = computeExternalScaleEffectiveBarThickness({\n hasBar: this.hasBar,\n barThickness: this.barThickness,\n borderRadius: this.borderRadius,\n scaleType: this.scaleType,\n });\n\n const baseDimensions = computeScaleDimensionsForReport({\n orientation: ExternalScaleOrientation.vertical,\n side: this.side,\n hasBar: this.hasBar,\n hasScale: this.hasScale,\n labels: this.showLabels,\n barThickness: effectiveBarThickness,\n tickThickness: this.tickThickness,\n labelThickness: this.labelThickness,\n length: this.fixedAspectRatio ? this.scaleReferenceSize : this.height,\n scaleType: this.scaleType,\n advicePosition: this.advicePosition,\n hasAdvice: !!this.advices && this.advices.length > 0,\n hasAdviceIcon: !!this.advices?.some((a) => a.showIcon),\n hasSetpoint:\n this.setpoint !== undefined ||\n this.newSetpoint !== undefined ||\n this.departingNewSetpoint !== undefined,\n fixedAspectRatioScale: this.fixedAspectRatio ? this._scale : 1,\n });\n\n // The chart lays out in visual pixels, so a scaled drawing reports its\n // scaled thickness.\n const dimensions = this.fixedAspectRatio\n ? {\n ...baseDimensions,\n thickness: Math.round(baseDimensions.thickness * this._scale),\n }\n : baseDimensions;\n\n this.dispatchEvent(\n new CustomEvent('scale-dimensions-changed', {\n detail: dimensions,\n bubbles: true,\n })\n );\n }\n\n protected override createRenderRoot() {\n return this;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (this.fixedAspectRatio) {\n this._applyFixedAspectRatioStyles();\n }\n }\n\n /** The inline sizing, value and priority, the consumer had before fixedAspectRatio took the host. */\n private _consumerSizing?: Record<\n 'display' | 'height' | 'width',\n [value: string, priority: string]\n >;\n\n /**\n * A custom element is inline by default, which gives the percentage-sized\n * SVG nothing to fill; in fixedAspectRatio mode the host is a block that\n * takes its container's height.\n */\n private _applyFixedAspectRatioStyles(): void {\n if (!this._consumerSizing) {\n const snapshot = (name: string): [string, string] => [\n this.style.getPropertyValue(name),\n this.style.getPropertyPriority(name),\n ];\n this._consumerSizing = {\n display: snapshot('display'),\n height: snapshot('height'),\n width: snapshot('width'),\n };\n }\n this.style.display = 'block';\n this.style.height = '100%';\n this.style.width = 'auto';\n }\n\n private _removeFixedAspectRatioStyles(): void {\n const saved = this._consumerSizing;\n this._consumerSizing = undefined;\n for (const name of ['display', 'height', 'width'] as const) {\n const [value, priority] = saved?.[name] ?? ['', ''];\n this.style.setProperty(name, value, priority);\n }\n }\n\n /** Reads the host's content box into the scale; false while the host has no size yet. */\n private _measureScale(): boolean {\n const {width, height} = readContentBox(this);\n if (height <= 0) return false;\n this._scale = computeFixedAspectRatioScale({\n orientation: ExternalScaleOrientation.vertical,\n containerMainAxisSize: height,\n containerCrossAxisSize: width,\n scaleReferenceSize: this.scaleReferenceSize,\n viewBoxThickness: this._thicknessAt,\n });\n return true;\n }\n\n /** Measures once layout has settled, then reports. */\n private _updateScaleFromCurrentSize(): void {\n requestAnimationFrame(() => {\n if (this._measureScale()) {\n this.requestUpdate();\n this.reportDimensions();\n }\n });\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-gauge-vertical': ObcGaugeVertical;\n }\n}\n"],"mappings":";;;;;;;;;;;;AA4JO,IAAM,mBAAN,MAAM,yBAAyB,YACpC,cAAc,YAAY,EACxB,iBAAiB,EACnB,CAAC,CACH,CAAC,CAAC;;;EACqC,KAAA,WAAA;EACA,KAAA,WAAA;EACA,KAAA,UAAA;EAEX,KAAA,SAAA;EACI,KAAA,aAAA,iBAAiB;EACd,KAAA,gBAAA,iBAAiB;EAEE,KAAA,OAAA,kBAAkB;EAExB,KAAA,mBAAA;EACC,KAAA,qBAAA;EAG9B,KAAA,SAAA;EAMO,KAAA,gBAAA,UACtB,KAAK,gBACD,2BAA2B;GACzB,GAAG,KAAK;GACR,uBAAuB;EACzB,CAAC,CAAC,CAAC,YACH;EAIsB,KAAA,oBAAA,IAAI,iBAAiB,MAAM,EACrD,WAAW,YAAY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AAA,WAAA,6BAAA,KAAA,CAAA;AACvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,iBAAA,WAAA,4BAAA,KAAA,CAAA;AAGvBA,WAAA,CAAA,SAAS;CAAC,MAAM;CAAQ,WAAW;AAAK,CAAC,CAAA,GAAA,iBAAA,WAAA,wBAAA,KAAA,CAAA;AAkBzCA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,iBAAA,WAAA,YAAA,KAAA,CAAA;AACvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,iBAAA,WAAA,YAAA,KAAA,CAAA;AACvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,iBAAA,WAAA,WAAA,KAAA,CAAA;AACvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,iBAAA,WAAA,WAAA,KAAA,CAAA;AACvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,iBAAA,WAAA,SAAA,KAAA,CAAA;AAEvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,iBAAA,WAAA,SAAA,KAAA,CAAA;AAMvBA,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,iBAAA,WAAA,WAAA,KAAA,CAAA;AAMxBA,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,iBAAA,WAAA,yBAAA,KAAA,CAAA;AAzG1B,mBAAAA,WAAA,CAAA,cAAc,oBAAoB,CAAA,GAAA,gBAAA"}
@@ -16,6 +16,11 @@ export interface LinearAdviceBandOptions {
16
16
  maskId: string;
17
17
  /** The band is drawn under a reflection, so the hatch is mirrored back. */
18
18
  mirrorPattern?: boolean;
19
+ /**
20
+ * ViewBox units per CSS pixel when the band is pixel-fixed inside a scaled
21
+ * drawing: the hatch tile is enlarged by it so the stripes keep their pitch.
22
+ */
23
+ unitsPerPx?: number;
19
24
  }
20
25
  /** One advice band. `nothing` when the range is too short for its caps. */
21
26
  export declare function renderLinearAdviceBand(o: LinearAdviceBandOptions): SVGTemplateResult | typeof nothing;
@@ -27,6 +32,8 @@ export interface LinearAdvicePointOptions {
27
32
  /** Perpendicular coordinate of the band centreline. */
28
33
  perpCenter: number;
29
34
  advice: AdviceInput | ResolvedAdvice;
35
+ /** ViewBox units per CSS pixel when the marker is pixel-fixed inside a scaled drawing. */
36
+ unitsPerPx?: number;
30
37
  }
31
38
  /**
32
39
  * A point advice: a dot for a go-to category, a thick tick across the band
@@ -1 +1 @@
1
- {"version":3,"file":"advice-linear.d.ts","sourceRoot":"","sources":["../../src/svghelpers/advice-linear.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAC,OAAO,EAAO,KAAK,iBAAiB,EAAC,MAAM,KAAK,CAAC;AACzD,OAAO,EAeL,KAAK,WAAW,EAChB,KAAK,cAAc,EAEpB,MAAM,aAAa,CAAC;AAIrB,oFAAoF;AACpF,MAAM,WAAW,uBAAuB;IACtC,2DAA2D;IAC3D,QAAQ,EAAE,OAAO,CAAC;IAClB,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,kGAAkG;IAClG,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,GAAG,cAAc,CAAC;IACrC,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AA+DD,2EAA2E;AAC3E,wBAAgB,sBAAsB,CACpC,CAAC,EAAE,uBAAuB,GACzB,iBAAiB,GAAG,OAAO,OAAO,CAkCpC;AAED,sEAAsE;AACtE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,OAAO,CAAC;IAClB,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,GAAG,cAAc,CAAC;CACtC;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,CAAC,EAAE,wBAAwB,GAC1B,iBAAiB,CAkBnB;AAED,qFAAqF;AACrF,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,GAAG,cAAc,CAAC;IACrC,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,CAAC,EAAE,uBAAuB,GACzB,iBAAiB,CAwCnB;AAED,iGAAiG;AACjG,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,OAAO,CAAC;IAClB,iGAAiG;IACjG,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,GAAG,cAAc,CAAC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,yFAAyF;AACzF,wBAAgB,sBAAsB,CACpC,CAAC,EAAE,uBAAuB,GACzB,iBAAiB,CAWnB"}
1
+ {"version":3,"file":"advice-linear.d.ts","sourceRoot":"","sources":["../../src/svghelpers/advice-linear.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAC,OAAO,EAAO,KAAK,iBAAiB,EAAC,MAAM,KAAK,CAAC;AACzD,OAAO,EAeL,KAAK,WAAW,EAChB,KAAK,cAAc,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BAAgB,sBAAsB,CACpC,CAAC,EAAE,uBAAuB,GACzB,iBAAiB,CAwCnB;AAED,iGAAiG;AACjG,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,OAAO,CAAC;IAClB,iGAAiG;IACjG,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,GAAG,cAAc,CAAC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,yFAAyF;AACzF,wBAAgB,sBAAsB,CACpC,CAAC,EAAE,uBAAuB,GACzB,iBAAiB,CAWnB"}
@@ -28,9 +28,11 @@ function bandPath(o, advice) {
28
28
  const hi = Math.max(o.mainStart, o.mainEnd);
29
29
  const capLo = ascending ? caps.start : caps.end;
30
30
  const capHi = ascending ? caps.end : caps.start;
31
- const edgeLo = capLo === AdviceCap.pill ? lo + 4 : lo;
32
- const edgeHi = capHi === AdviceCap.pill ? hi - 4 : hi;
33
- const radius = (cap) => cap === AdviceCap.pill ? t / 2 : cap === AdviceCap.square ? 2 : 0;
31
+ const u = o.unitsPerPx ?? 1;
32
+ const inset = 4 * u;
33
+ const edgeLo = capLo === AdviceCap.pill ? lo + inset : lo;
34
+ const edgeHi = capHi === AdviceCap.pill ? hi - inset : hi;
35
+ const radius = (cap) => cap === AdviceCap.pill ? t / 2 : cap === AdviceCap.square ? 2 * u : 0;
34
36
  const rLo = radius(capLo);
35
37
  const rHi = radius(capHi);
36
38
  if (edgeHi - edgeLo < rLo + rHi) return null;
@@ -62,13 +64,14 @@ function renderLinearAdviceBand(o) {
62
64
  const style = adviceStyle(advice.category, advice.state);
63
65
  const d = bandPath(o, advice);
64
66
  if (d === null) return nothing;
65
- if (style.pattern === "none") return svg`<path d=${d} fill=${style.fill} stroke=${style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
67
+ if (style.pattern === "none") return svg`<path class="advice-band" d=${d} fill=${style.fill} stroke=${style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
66
68
  const t = o.thickness ?? 8;
67
69
  const lo = Math.min(o.mainStart, o.mainEnd);
68
70
  const hi = Math.max(o.mainStart, o.mainEnd);
69
71
  const patternId = `${o.maskId}-pattern`;
70
72
  const mirrored = o.mirrorPattern ?? false;
71
- const pattern = style.pattern === "hairline" ? hairlinePattern(patternId, style.patternColor, mirrored) : stripePattern(patternId, style.patternColor, ADVICE_STRIPE.width, mirrored);
73
+ const unitsPerPx = o.unitsPerPx ?? 1;
74
+ const pattern = style.pattern === "hairline" ? hairlinePattern(patternId, style.patternColor, mirrored, unitsPerPx) : stripePattern(patternId, style.patternColor, ADVICE_STRIPE.width, mirrored, unitsPerPx);
72
75
  const cover = o.vertical ? svg`<rect x=${o.perpStart} y=${lo} width=${t} height=${hi - lo} fill=${style.fill}/><rect x=${o.perpStart} y=${lo} width=${t} height=${hi - lo} fill="url(#${patternId})"/>` : svg`<rect x=${lo} y=${o.perpStart} width=${hi - lo} height=${t} fill=${style.fill}/><rect x=${lo} y=${o.perpStart} width=${hi - lo} height=${t} fill="url(#${patternId})"/>`;
73
76
  return svg`
74
77
  <defs>
@@ -78,7 +81,7 @@ function renderLinearAdviceBand(o) {
78
81
  </mask>
79
82
  </defs>
80
83
  <g mask="url(#${o.maskId})">${cover}</g>
81
- <path d=${d} fill="none" stroke=${style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
84
+ <path class="advice-band" d=${d} fill="none" stroke=${style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
82
85
  }
83
86
  /**
84
87
  * A point advice: a dot for a go-to category, a thick tick across the band
@@ -90,12 +93,13 @@ function renderLinearAdvicePoint(o) {
90
93
  const style = adviceStyle(advice.category, advice.state);
91
94
  const cx = o.vertical ? o.perpCenter : o.main;
92
95
  const cy = o.vertical ? o.main : o.perpCenter;
93
- if (isGoToCategory(advice.category)) return svg`<circle cx=${cx} cy=${cy} r=${9 / 2} fill=${style.fill} stroke=${style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
96
+ const u = o.unitsPerPx ?? 1;
97
+ if (isGoToCategory(advice.category)) return svg`<circle cx=${cx} cy=${cy} r=${9 / 2 * u} fill=${style.fill} stroke=${style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
94
98
  const grey = advice.category === AdviceCategory.caution ? advice.state === AdviceState.triggered ? "var(--instrument-tick-mark-primary-color)" : style.stroke : void 0;
95
99
  const { length, thickness, radius } = ADVICE_POINT_TICK;
96
- const w = o.vertical ? length : thickness;
97
- const h = o.vertical ? thickness : length;
98
- return svg`<rect x=${cx - w / 2} y=${cy - h / 2} width=${w} height=${h} rx=${radius} fill=${grey ?? style.fill} stroke=${grey ?? style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
100
+ const w = (o.vertical ? length : thickness) * u;
101
+ const h = (o.vertical ? thickness : length) * u;
102
+ return svg`<rect x=${cx - w / 2} y=${cy - h / 2} width=${w} height=${h} rx=${radius * u} fill=${grey ?? style.fill} stroke=${grey ?? style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
99
103
  }
100
104
  /**
101
105
  * The area layer across a bar: the category's tint or pattern between the