@oicl/openbridge-webcomponents-full-bundle 2.2.0-next.20 → 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.
- package/bundle/openbridge-webcomponents.bundle.js +156 -61
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +49 -21
- package/dist/automation/automation-tank/automation-tank.d.ts.map +1 -1
- package/dist/automation/automation-tank/automation-tank.js +2 -1
- package/dist/automation/automation-tank/automation-tank.js.map +1 -1
- package/dist/building-blocks/bar-horizontal/bar-horizontal.d.ts +4 -2
- package/dist/building-blocks/bar-horizontal/bar-horizontal.d.ts.map +1 -1
- package/dist/building-blocks/bar-horizontal/bar-horizontal.js +12 -6
- package/dist/building-blocks/bar-horizontal/bar-horizontal.js.map +1 -1
- package/dist/building-blocks/bar-vertical/bar-vertical.d.ts +4 -2
- package/dist/building-blocks/bar-vertical/bar-vertical.d.ts.map +1 -1
- package/dist/building-blocks/bar-vertical/bar-vertical.js +12 -6
- package/dist/building-blocks/bar-vertical/bar-vertical.js.map +1 -1
- package/dist/building-blocks/external-scale/external-scale.d.ts +21 -3
- package/dist/building-blocks/external-scale/external-scale.d.ts.map +1 -1
- package/dist/building-blocks/external-scale/external-scale.js +40 -17
- package/dist/building-blocks/external-scale/external-scale.js.map +1 -1
- package/dist/navigation-instruments/gauge-horizontal/gauge-horizontal.d.ts +4 -2
- package/dist/navigation-instruments/gauge-horizontal/gauge-horizontal.d.ts.map +1 -1
- package/dist/navigation-instruments/gauge-horizontal/gauge-horizontal.js +14 -6
- package/dist/navigation-instruments/gauge-horizontal/gauge-horizontal.js.map +1 -1
- package/dist/navigation-instruments/gauge-vertical/gauge-vertical.d.ts +4 -2
- package/dist/navigation-instruments/gauge-vertical/gauge-vertical.d.ts.map +1 -1
- package/dist/navigation-instruments/gauge-vertical/gauge-vertical.js +14 -6
- package/dist/navigation-instruments/gauge-vertical/gauge-vertical.js.map +1 -1
- package/dist/navigation-instruments/heave/heave.d.ts.map +1 -1
- package/dist/navigation-instruments/heave/heave.js +14 -5
- package/dist/navigation-instruments/heave/heave.js.map +1 -1
- package/dist/navigation-instruments/watch/vessel.d.ts +2 -0
- package/dist/navigation-instruments/watch/vessel.d.ts.map +1 -1
- package/dist/navigation-instruments/watch/vessel.js +6 -0
- package/dist/navigation-instruments/watch/vessel.js.map +1 -1
- package/dist/navigation-instruments/watch/vessels/fish-cage-side.d.ts +3 -0
- package/dist/navigation-instruments/watch/vessels/fish-cage-side.d.ts.map +1 -0
- package/dist/navigation-instruments/watch/vessels/fish-cage-side.js +13 -0
- package/dist/navigation-instruments/watch/vessels/fish-cage-side.js.map +1 -0
- package/dist/navigation-instruments/watch/vessels/fish-cage-top.d.ts +3 -0
- package/dist/navigation-instruments/watch/vessels/fish-cage-top.d.ts.map +1 -0
- package/dist/navigation-instruments/watch/vessels/fish-cage-top.js +20 -0
- package/dist/navigation-instruments/watch/vessels/fish-cage-top.js.map +1 -0
- package/dist/svghelpers/advice-linear.d.ts +7 -0
- package/dist/svghelpers/advice-linear.d.ts.map +1 -1
- package/dist/svghelpers/advice-linear.js +14 -10
- package/dist/svghelpers/advice-linear.js.map +1 -1
- package/dist/svghelpers/advice-patterns.d.ts +2 -2
- package/dist/svghelpers/advice-patterns.d.ts.map +1 -1
- package/dist/svghelpers/advice-patterns.js +6 -4
- package/dist/svghelpers/advice-patterns.js.map +1 -1
- package/package.json +1 -1
- package/src/automation/automation-tank/automation-tank.ts +4 -0
- package/src/building-blocks/bar-horizontal/bar-horizontal-fixed-aspect.spec.ts +50 -0
- package/src/building-blocks/bar-horizontal/bar-horizontal.stories.ts +6 -0
- package/src/building-blocks/bar-horizontal/bar-horizontal.ts +22 -9
- package/src/building-blocks/bar-vertical/bar-vertical-dimensions.spec.ts +36 -0
- package/src/building-blocks/bar-vertical/bar-vertical-fixed-aspect.spec.ts +49 -0
- package/src/building-blocks/bar-vertical/bar-vertical.stories.ts +6 -0
- package/src/building-blocks/bar-vertical/bar-vertical.ts +22 -9
- package/src/building-blocks/external-scale/external-scale.spec.ts +151 -0
- package/src/building-blocks/external-scale/external-scale.stories.ts +6 -0
- package/src/building-blocks/external-scale/external-scale.ts +86 -40
- package/src/navigation-instruments/gauge-horizontal/gauge-horizontal.spec.ts +55 -0
- package/src/navigation-instruments/gauge-horizontal/gauge-horizontal.stories.ts +2 -0
- package/src/navigation-instruments/gauge-horizontal/gauge-horizontal.ts +24 -9
- package/src/navigation-instruments/gauge-trend/gauge-trend.stories.ts +25 -0
- package/src/navigation-instruments/gauge-vertical/gauge-vertical.spec.ts +55 -0
- package/src/navigation-instruments/gauge-vertical/gauge-vertical.stories.ts +2 -0
- package/src/navigation-instruments/gauge-vertical/gauge-vertical.ts +24 -9
- package/src/navigation-instruments/heave/heave.stories.ts +12 -1
- package/src/navigation-instruments/heave/heave.ts +23 -7
- package/src/navigation-instruments/pitch/pitch.stories.ts +13 -0
- package/src/navigation-instruments/roll/roll.stories.ts +13 -1
- package/src/navigation-instruments/watch/vessel.ts +6 -0
- package/src/navigation-instruments/watch/vessels/fish-cage-side.ts +10 -0
- package/src/navigation-instruments/watch/vessels/fish-cage-top.ts +17 -0
- package/src/svghelpers/advice-linear.ts +25 -11
- 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
|
|
137
|
-
private
|
|
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;
|
|
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,CAAC,WAAW,CAAmC;IAC/D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAmC;IAEtC,IAAI,EAAE,iBAAiB,CAA4B;IAElD,gBAAgB,UAAS;IAC1B,kBAAkB,SAAO;IAGnD,OAA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C,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.
|
|
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.
|
|
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
|
|
125
|
-
|
|
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.
|
|
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,KAA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,CAAA;AACvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,mBAAA,WAAA,SAAA,KAAA,CAAA;AAEvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,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;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AAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,mBAAA,WAAA,yBAAA,KAAA,CAAA;AAzG1B,qBAAAA,WAAA,CAAA,cAAc,sBAAsB,CAAA,GAAA,kBAAA"}
|
|
@@ -133,8 +133,10 @@ export declare class ObcGaugeVertical extends ObcGaugeVertical_base {
|
|
|
133
133
|
*/
|
|
134
134
|
scaleReferenceSize: number;
|
|
135
135
|
private _scale;
|
|
136
|
-
/** The
|
|
137
|
-
private
|
|
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;
|
|
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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AM,GAEjB;IAED,OAAO,KAAK,eAAe,GAE1B;IAED,OAAO,KAAK,QAAQ,GAEnB;IAEyB,QAAQ,EAAE,QAAQ,CAAoB;IACtC,QAAQ,EAAE,QAAQ,CAAiB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAa;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAa;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAa;IAE3B,KAAK,EAAE,eAAe,CAA0B;IAE1E;;;OAGG;IACwB,OAAO,UAAS;IAE3C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAwC;IAEvE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA6B;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,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.
|
|
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.
|
|
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
|
|
125
|
-
|
|
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.
|
|
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;EA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AAA,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;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;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,C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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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heave.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/heave/heave.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAMV,cAAc,EACf,MAAM,KAAK,CAAC;AAGb,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AAM5D,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAErC,oBAAY,YAAY;IACtB,6EAA6E;IAC7E,MAAM,WAAW;IACjB,oEAAoE;IACpE,GAAG,QAAQ;CACZ;;
|
|
1
|
+
{"version":3,"file":"heave.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/heave/heave.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAMV,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a 128×384 frame. */
|
|
23
23
|
var BAR_VIEW_BOX = "-64 -192 128 384";
|
|
24
|
+
/**
|
|
25
|
+
* Floating objects at inclinometer size
|
|
26
|
+
*
|
|
27
|
+
* The fore silhouettes are drawn small in their 160 box, so heave zooms them
|
|
28
|
+
* ×3. The floating objects fill the box, so heave draws them at the 224/160
|
|
29
|
+
* the inclinometers use, centred on the face (Figma 47546:223140).
|
|
30
|
+
*/
|
|
31
|
+
var FLOATING_OBJECTS = /* @__PURE__ */ new Set([VesselImage.fishCageSide, VesselImage.fishCageTop]);
|
|
32
|
+
var FLOATING_OBJECT_ZOOM = 224 / 160;
|
|
24
33
|
var ObcHeave = class ObcHeave extends AdviceMixin(LitElement) {
|
|
25
34
|
constructor(..._args) {
|
|
26
35
|
super(..._args);
|
|
@@ -67,6 +76,9 @@ var ObcHeave = class ObcHeave extends AdviceMixin(LitElement) {
|
|
|
67
76
|
`;
|
|
68
77
|
}
|
|
69
78
|
renderVessel() {
|
|
79
|
+
const art = vesselArt(this.vesselImage, this.vesselImageSrc);
|
|
80
|
+
const y = this._toTranslatedValue((-this.heave + this.draftOffset) / this.gainScale);
|
|
81
|
+
const transform = "vesselImage" in art && FLOATING_OBJECTS.has(art.vesselImage) ? `translate(${-this._gaugeWidth / 2}, ${y}) scale(${FLOATING_OBJECT_ZOOM}) translate(-80, -80)` : `translate(0, ${y}) scale(3) translate(${-this._gaugeWidth / 2 - 80 / 1.5} , -80)`;
|
|
70
82
|
return svg`
|
|
71
83
|
<defs>
|
|
72
84
|
<clipPath id="heaveClip">
|
|
@@ -79,11 +91,8 @@ var ObcHeave = class ObcHeave extends AdviceMixin(LitElement) {
|
|
|
79
91
|
</clipPath>
|
|
80
92
|
</defs>
|
|
81
93
|
<g clip-path="url(#heaveClip)">
|
|
82
|
-
<g
|
|
83
|
-
|
|
84
|
-
translate(${-this._gaugeWidth / 2 - 80 / 1.5} , ${-80})"
|
|
85
|
-
>
|
|
86
|
-
${this.vesselImage ? renderVesselArt(vesselArt(this.vesselImage, this.vesselImageSrc), this._palette.current) : nothing}
|
|
94
|
+
<g transform=${transform}>
|
|
95
|
+
${this.vesselImage ? renderVesselArt(art, this._palette.current) : nothing}
|
|
87
96
|
</g>
|
|
88
97
|
</g>
|
|
89
98
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heave.js","names":["_decorate"],"sources":["../../../src/navigation-instruments/heave/heave.ts"],"sourcesContent":["import {\n LitElement,\n html,\n css,\n nothing,\n svg,\n type SVGTemplateResult,\n PropertyValues,\n} from 'lit';\nimport {customElement} from '../../decorator.js';\nimport {AdviceMixin, syncAdviceAlias} from '../../svghelpers/advice-mixin.js';\nimport type {AdviceInput} from '../../svghelpers/advice.js';\nimport {\n verticalScaleTickmarks,\n watchfaceLinear,\n} from '../../building-blocks/instrument-linear/instrument-linear.js';\nimport {property} from 'lit/decorators.js';\nimport {VesselImage} from '../watch/watch.js';\nimport {\n renderVesselArt,\n vesselArt,\n type VesselImageSrc,\n} from '../watch/vessel.js';\nimport {PaletteController} from '../../charthelpers/theme.js';\nimport {resolveLinearAdvice} from '../../building-blocks/instrument-linear/advice.js';\nimport {Priority} from '../types.js';\n\nexport enum ObcHeaveType {\n /** Vessel silhouette in a framed box, with the scale column at its right. */\n vessel = 'vessel',\n /** Scale column on its own — no frame, reference line or vessel. */\n bar = 'bar',\n}\n\n/** `vessel` viewBox: the 336×336 frame plus its surrounding padding. */\nconst VESSEL_VIEW_BOX = '-200 -200 400 400';\n/** `bar` viewBox: the 72×336 scale column centred in a 128×384 frame. */\nconst BAR_VIEW_BOX = '-64 -192 128 384';\n\n/**\n * `<obc-heave>` — Vertical heave indicator.\n *\n * Shows `heave` on a linear scale with a trend band, optional advice zones and\n * a `regular`/`enhanced` palette.\n *\n * Variants (`type`):\n * - `vessel` (default) — the scale beside a framed box holding a vessel\n * silhouette that rises and falls with the measured heave.\n * - `bar` — the scale column alone, for use beside another instrument or in a\n * narrow strip. The host is 128×384 rather than square.\n *\n * @element obc-heave\n *\n * @availableWhen gainScale type==vessel\n * @availableWhen draftOffset type==vessel\n * @availableWhen vesselImage type==vessel\n * @property vesselImageSrc - Image URLs per palette (`{bright, day, dusk, night}`, SVG, PNG or data URLs)\n * drawn instead of `vesselImage` in the same 160 × 160 box. A palette without a URL falls\n * back to the nearest one (see `VesselImageSrc`).\n * @availableWhen vesselImageSrc type==vessel\n * @property type - `vessel` (default) frames the scale next to a vessel silhouette; `bar`\n * renders the scale column on its own.\n * @property advice - Alias of `advices`: ranges and points in the heave unit, resolved against the trend band.\n * @stable\n */\n@customElement('obc-heave')\nexport class ObcHeave extends AdviceMixin(LitElement) {\n @property({type: Number}) heave = 0;\n @property({type: Number}) gainScale = 10;\n @property({type: Number}) minTrendHeave = 0;\n @property({type: Number}) maxTrendHeave = 0;\n @property({type: Number}) draftOffset = 0;\n /** @deprecated Alias of `advices`. Ranges in heave units. */\n @property({type: Array}) advice?: AdviceInput[];\n\n @property({type: Number}) instrumentRange = 10;\n @property({type: String}) vesselImage: VesselImage = VesselImage.psvFore;\n @property({type: Object, attribute: false})\n vesselImageSrc: VesselImageSrc | undefined;\n @property({type: String}) priority: Priority = Priority.regular;\n @property({type: String}) type: ObcHeaveType = ObcHeaveType.vessel;\n\n private readonly _palette = new PaletteController(this);\n\n private _toTranslatedValue(value: number) {\n return (value * (this._boxWidth / 2)) / this.instrumentRange;\n }\n _boxWidth = 336;\n _gaugeWidth = 72;\n _scaleWidth = 24;\n\n private renderFrame(): SVGTemplateResult {\n const r = 8;\n return svg`\n <path\n d=\"M ${this._boxWidth / 2 - this._gaugeWidth} ${-this._boxWidth / 2}\n H ${-this._boxWidth / 2 + r}\n a ${r} ${r} 0 0 0 ${-r} ${r}\n V ${this._boxWidth / 2 - r}\n a ${r} ${r} 0 0 0 ${r} ${r}\n H ${this._boxWidth / 2 - this._gaugeWidth}\"\n stroke=\"var(--instrument-frame-tertiary-color)\"\n fill=\"none\"\n vector-effect=\"non-scaling-stroke\"\n />\n <line\n x1=${this._boxWidth / 2 - this._gaugeWidth}\n x2=${-this._boxWidth / 2}\n y1=${0}\n y2=${0}\n stroke=\"var(--instrument-frame-tertiary-color)\"\n stroke-width=\"1\"\n vector-effect=\"non-scaling-stroke\"\n />\n `;\n }\n\n private renderVessel(): SVGTemplateResult {\n return svg`\n <defs>\n <clipPath id=\"heaveClip\">\n <rect\n x=\"-200\"\n y=${this._toTranslatedValue(-this.instrumentRange)}\n width=\"400\"\n height=${this._toTranslatedValue(this.instrumentRange) * 2}\n />\n </clipPath>\n </defs>\n <g clip-path=\"url(#heaveClip)\">\n <g\n transform=\"translate(0, ${this._toTranslatedValue(\n (-this.heave + this.draftOffset) / this.gainScale\n )}) scale(3)\n translate(${-this._gaugeWidth / 2 - 80 / 1.5} , ${-80})\"\n >\n ${this.vesselImage ? renderVesselArt(vesselArt(this.vesselImage, this.vesselImageSrc), this._palette.current) : nothing}\n </g>\n </g>\n `;\n }\n\n override willUpdate(changed: PropertyValues) {\n super.willUpdate(changed);\n syncAdviceAlias(this, this.advice);\n }\n\n override render() {\n const isBar = this.type === ObcHeaveType.bar;\n const gaugeOffset = isBar ? 0 : this._boxWidth / 2 - this._gaugeWidth / 2;\n\n return html`\n <div class=\"container\">\n <svg viewBox=${isBar ? BAR_VIEW_BOX : VESSEL_VIEW_BOX}>\n ${isBar ? nothing : this.renderFrame()}\n <g transform=\"translate(${gaugeOffset}, 0)\">\n ${watchfaceLinear(\n {\n height: this._boxWidth,\n width: this._gaugeWidth,\n scaleWidth: this._scaleWidth,\n minValue: -this.instrumentRange,\n maxValue: this.instrumentRange,\n },\n [\n {\n min: this.minTrendHeave,\n max: this.maxTrendHeave,\n },\n ],\n {\n value: this.heave,\n },\n {container: 'var(--instrument-frame-primary-color)'},\n {hideContainer: false, off: false, priority: this.priority},\n verticalScaleTickmarks(this.instrumentRange),\n resolveLinearAdvice(\n this.advices,\n this.minTrendHeave,\n this.maxTrendHeave,\n {trigger: this.adviceTrigger, emphasis: this.adviceEmphasis}\n )\n )}\n </g>\n ${isBar ? nothing : this.renderVessel()}\n </svg>\n </div>\n `;\n }\n\n static override styles = css`\n * {\n box-sizing: border-box;\n }\n\n .container {\n position: relative;\n width: 100%;\n height: 100%;\n }\n\n .container > * {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n }\n `;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-heave': ObcHeave;\n }\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,IAAY,eAAL,yBAAA,cAAA;;CAEL,aAAA,YAAA;;CAEA,aAAA,SAAA;;AACF,EAAA,CAAA,CAAA;;AAGA,IAAM,kBAAkB;;AAExB,IAAM,eAAe;AA6Bd,IAAM,WAAN,MAAM,iBAAiB,YAAY,UAAU,CAAC,CAAC;;;EAClB,KAAA,QAAA;EACI,KAAA,YAAA;EACI,KAAA,gBAAA;EACA,KAAA,gBAAA;EACF,KAAA,cAAA;EAII,KAAA,kBAAA;EACS,KAAA,cAAA,YAAY;EAGlB,KAAA,WAAA,SAAS;;EAG5B,KAAA,WAAA,IAAI,kBAAkB,IAAI;EAK1C,KAAA,YAAA;EACE,KAAA,cAAA;EACA,KAAA,cAAA;;CALd,mBAA2B,OAAe;EACxC,OAAQ,SAAS,KAAK,YAAY,KAAM,KAAK;CAC/C;CAKA,cAAyC;EACvC,MAAM,IAAI;EACV,OAAO,GAAG;;mBAEK,KAAK,YAAY,IAAI,KAAK,YAAY,GAAG,CAAC,KAAK,YAAY,EAAE;iBAC/D,CAAC,KAAK,YAAY,IAAI,EAAE;iBACxB,EAAE,GAAG,EAAE,SAAS,GAAG,GAAG,EAAE;iBACxB,KAAK,YAAY,IAAI,EAAE;iBACvB,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE;iBACvB,KAAK,YAAY,IAAI,KAAK,YAAY;;;;;;iBAMtC,KAAK,YAAY,IAAI,KAAK,YAAY;iBACtC,CAAC,KAAK,YAAY,EAAE;iBACpB,EAAE;iB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AAM,OAAM,CAAC,CAAA,GAAA,SAAA,WAAA,SAAA,KAAA,CAAA;AACvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,SAAA,WAAA,aAAA,KAAA,CAAA;AACvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,SAAA,WAAA,iBAAA,KAAA,CAAA;AACvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,SAAA,WAAA,iBAAA,KAAA,CAAA;AACvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,SAAA,WAAA,eAAA,KAAA,CAAA;AAEvBA,WAAA,CAAA,SAAS,EAAC,MAAM,MAAK,CAAC,CAAA,GAAA,SAAA,WAAA,UAAA,KAAA,CAAA;AAEtBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,SAAA,WAAA,mBAAA,KAAA,CAAA;AACvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,SAAA,WAAA,eAAA,KAAA,CAAA;AACvBA,WAAA,CAAA,SAAS;CAAC,MAAM;CAAQ,WAAW;AAAK,CAAC,CAAA,GAAA,SAAA,WAAA,kBAAA,KAAA,CAAA;AAEzCA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,SAAA,WAAA,YAAA,KAAA,CAAA;AACvBA,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,SAAA,WAAA,QAAA,KAAA,CAAA;AAfzB,WAAAA,WAAA,CAAA,cAAc,WAAW,CAAA,GAAA,QAAA"}
|
|
1
|
+
{"version":3,"file":"heave.js","names":["_decorate"],"sources":["../../../src/navigation-instruments/heave/heave.ts"],"sourcesContent":["import {\n LitElement,\n html,\n css,\n nothing,\n svg,\n type SVGTemplateResult,\n PropertyValues,\n} from 'lit';\nimport {customElement} from '../../decorator.js';\nimport {AdviceMixin, syncAdviceAlias} from '../../svghelpers/advice-mixin.js';\nimport type {AdviceInput} from '../../svghelpers/advice.js';\nimport {\n verticalScaleTickmarks,\n watchfaceLinear,\n} from '../../building-blocks/instrument-linear/instrument-linear.js';\nimport {property} from 'lit/decorators.js';\nimport {VesselImage} from '../watch/watch.js';\nimport {\n renderVesselArt,\n vesselArt,\n type VesselImageSrc,\n} from '../watch/vessel.js';\nimport {PaletteController} from '../../charthelpers/theme.js';\nimport {resolveLinearAdvice} from '../../building-blocks/instrument-linear/advice.js';\nimport {Priority} from '../types.js';\n\nexport enum ObcHeaveType {\n /** Vessel silhouette in a framed box, with the scale column at its right. */\n vessel = 'vessel',\n /** Scale column on its own — no frame, reference line or vessel. */\n bar = 'bar',\n}\n\n/** `vessel` viewBox: the 336×336 frame plus its surrounding padding. */\nconst VESSEL_VIEW_BOX = '-200 -200 400 400';\n/** `bar` viewBox: the 72×336 scale column centred in a 128×384 frame. */\nconst BAR_VIEW_BOX = '-64 -192 128 384';\n\n/**\n * Floating objects at inclinometer size\n *\n * The fore silhouettes are drawn small in their 160 box, so heave zooms them\n * ×3. The floating objects fill the box, so heave draws them at the 224/160\n * the inclinometers use, centred on the face (Figma 47546:223140).\n */\nconst FLOATING_OBJECTS: ReadonlySet<VesselImage> = new Set([\n VesselImage.fishCageSide,\n VesselImage.fishCageTop,\n]);\nconst FLOATING_OBJECT_ZOOM = 224 / 160;\n\n/**\n * `<obc-heave>` — Vertical heave indicator.\n *\n * Shows `heave` on a linear scale with a trend band, optional advice zones and\n * a `regular`/`enhanced` palette.\n *\n * Variants (`type`):\n * - `vessel` (default) — the scale beside a framed box holding a vessel\n * silhouette that rises and falls with the measured heave.\n * - `bar` — the scale column alone, for use beside another instrument or in a\n * narrow strip. The host is 128×384 rather than square.\n *\n * @element obc-heave\n *\n * @availableWhen gainScale type==vessel\n * @availableWhen draftOffset type==vessel\n * @availableWhen vesselImage type==vessel\n * @property vesselImageSrc - Image URLs per palette (`{bright, day, dusk, night}`, SVG, PNG or data URLs)\n * drawn instead of `vesselImage` in the same 160 × 160 box. A palette without a URL falls\n * back to the nearest one (see `VesselImageSrc`).\n * @availableWhen vesselImageSrc type==vessel\n * @property type - `vessel` (default) frames the scale next to a vessel silhouette; `bar`\n * renders the scale column on its own.\n * @property advice - Alias of `advices`: ranges and points in the heave unit, resolved against the trend band.\n * @stable\n */\n@customElement('obc-heave')\nexport class ObcHeave extends AdviceMixin(LitElement) {\n @property({type: Number}) heave = 0;\n @property({type: Number}) gainScale = 10;\n @property({type: Number}) minTrendHeave = 0;\n @property({type: Number}) maxTrendHeave = 0;\n @property({type: Number}) draftOffset = 0;\n /** @deprecated Alias of `advices`. Ranges in heave units. */\n @property({type: Array}) advice?: AdviceInput[];\n\n @property({type: Number}) instrumentRange = 10;\n @property({type: String}) vesselImage: VesselImage = VesselImage.psvFore;\n @property({type: Object, attribute: false})\n vesselImageSrc: VesselImageSrc | undefined;\n @property({type: String}) priority: Priority = Priority.regular;\n @property({type: String}) type: ObcHeaveType = ObcHeaveType.vessel;\n\n private readonly _palette = new PaletteController(this);\n\n private _toTranslatedValue(value: number) {\n return (value * (this._boxWidth / 2)) / this.instrumentRange;\n }\n _boxWidth = 336;\n _gaugeWidth = 72;\n _scaleWidth = 24;\n\n private renderFrame(): SVGTemplateResult {\n const r = 8;\n return svg`\n <path\n d=\"M ${this._boxWidth / 2 - this._gaugeWidth} ${-this._boxWidth / 2}\n H ${-this._boxWidth / 2 + r}\n a ${r} ${r} 0 0 0 ${-r} ${r}\n V ${this._boxWidth / 2 - r}\n a ${r} ${r} 0 0 0 ${r} ${r}\n H ${this._boxWidth / 2 - this._gaugeWidth}\"\n stroke=\"var(--instrument-frame-tertiary-color)\"\n fill=\"none\"\n vector-effect=\"non-scaling-stroke\"\n />\n <line\n x1=${this._boxWidth / 2 - this._gaugeWidth}\n x2=${-this._boxWidth / 2}\n y1=${0}\n y2=${0}\n stroke=\"var(--instrument-frame-tertiary-color)\"\n stroke-width=\"1\"\n vector-effect=\"non-scaling-stroke\"\n />\n `;\n }\n\n private renderVessel(): SVGTemplateResult {\n const art = vesselArt(this.vesselImage, this.vesselImageSrc);\n const y = this._toTranslatedValue(\n (-this.heave + this.draftOffset) / this.gainScale\n );\n const transform =\n 'vesselImage' in art && FLOATING_OBJECTS.has(art.vesselImage)\n ? `translate(${-this._gaugeWidth / 2}, ${y}) scale(${FLOATING_OBJECT_ZOOM}) translate(-80, -80)`\n : `translate(0, ${y}) scale(3) translate(${-this._gaugeWidth / 2 - 80 / 1.5} , ${-80})`;\n return svg`\n <defs>\n <clipPath id=\"heaveClip\">\n <rect\n x=\"-200\"\n y=${this._toTranslatedValue(-this.instrumentRange)}\n width=\"400\"\n height=${this._toTranslatedValue(this.instrumentRange) * 2}\n />\n </clipPath>\n </defs>\n <g clip-path=\"url(#heaveClip)\">\n <g transform=${transform}>\n ${this.vesselImage ? renderVesselArt(art, this._palette.current) : nothing}\n </g>\n </g>\n `;\n }\n\n override willUpdate(changed: PropertyValues) {\n super.willUpdate(changed);\n syncAdviceAlias(this, this.advice);\n }\n\n override render() {\n const isBar = this.type === ObcHeaveType.bar;\n const gaugeOffset = isBar ? 0 : this._boxWidth / 2 - this._gaugeWidth / 2;\n\n return html`\n <div class=\"container\">\n <svg viewBox=${isBar ? BAR_VIEW_BOX : VESSEL_VIEW_BOX}>\n ${isBar ? nothing : this.renderFrame()}\n <g transform=\"translate(${gaugeOffset}, 0)\">\n ${watchfaceLinear(\n {\n height: this._boxWidth,\n width: this._gaugeWidth,\n scaleWidth: this._scaleWidth,\n minValue: -this.instrumentRange,\n maxValue: this.instrumentRange,\n },\n [\n {\n min: this.minTrendHeave,\n max: this.maxTrendHeave,\n },\n ],\n {\n value: this.heave,\n },\n {container: 'var(--instrument-frame-primary-color)'},\n {hideContainer: false, off: false, priority: this.priority},\n verticalScaleTickmarks(this.instrumentRange),\n resolveLinearAdvice(\n this.advices,\n this.minTrendHeave,\n this.maxTrendHeave,\n {trigger: this.adviceTrigger, emphasis: this.adviceEmphasis}\n )\n )}\n </g>\n ${isBar ? nothing : this.renderVessel()}\n </svg>\n </div>\n `;\n }\n\n static override styles = css`\n * {\n box-sizing: border-box;\n }\n\n .container {\n position: relative;\n width: 100%;\n height: 100%;\n }\n\n .container > * {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n }\n `;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-heave': ObcHeave;\n }\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,IAAY,eAAL,yBAAA,cAAA;;CAEL,aAAA,YAAA;;CAEA,aAAA,SAAA;;AACF,EAAA,CAAA,CAAA;;AAGA,IAAM,kBAAkB;;AAExB,IAAM,eAAe;;;;;;;;AASrB,IAAM,mCAA6C,IAAI,IAAI,CACzD,YAAY,cACZ,YAAY,WACd,CAAC;AACD,IAAM,uBAAuB,MAAM;AA6B5B,IAAM,WAAN,MAAM,iBAAiB,YAAY,UAAU,CAAC,CAAC;;;EAClB,KAAA,QAAA;EACI,KAAA,YAAA;EACI,KAAA,gBAAA;EACA,KAAA,gBAAA;EACF,KAAA,cAAA;EAII,KAAA,kBAAA;EACS,KAAA,cAAA,YAAY;EAGlB,KAAA,WAAA,SAAS;;EAG5B,KAAA,WAAA,IAAI,kBAAkB,IAAI;EAK1C,KAAA,YAAA;EACE,KAAA,cAAA;EACA,KAAA,cAAA;;CALd,mBAA2B,OAAe;EACxC,OAAQ,SAAS,KAAK,YAAY,KAAM,KAAK;CAC/C;CAKA,cAAyC;EACvC,MAAM,IAAI;EACV,OAAO,GAAG;;mBAEK,KAAK,YAAY,IAAI,KAAK,YAAY,GAAG,CAAC,KAAK,YAAY,EAAE;iBAC/D,CAAC,KAAK,YAAY,IAAI,EAAE;iBACxB,EAAE,GAAG,EAAE,SAAS,GAAG,GAAG,EAAE;iBACxB,KAAK,YAAY,IAAI,EAAE;iBACvB,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE;iBAC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AAM,CAAC,CAAA,GAAA,SAAA,WAAA,QAAA,KAAA,CAAA;AAfzB,WAAAA,WAAA,CAAA,cAAc,WAAW,CAAA,GAAA,QAAA"}
|
|
@@ -20,6 +20,8 @@ export declare enum VesselImage {
|
|
|
20
20
|
cargoWindSide = "cargo-wind-side",
|
|
21
21
|
cargoWindSideFaded = "cargo-wind-side-faded",
|
|
22
22
|
cargoWindTop = "cargo-wind-top",
|
|
23
|
+
fishCageSide = "fish-cage-side",
|
|
24
|
+
fishCageTop = "fish-cage-top",
|
|
23
25
|
fishingVesselSide = "fishing-vessel-side",
|
|
24
26
|
fishingVesselSideFaded = "fishing-vessel-side-faded",
|
|
25
27
|
fishingVesselTop = "fishing-vessel-top",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vessel.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/watch/vessel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,iBAAiB,EAAC,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"vessel.d.ts","sourceRoot":"","sources":["../../../src/navigation-instruments/watch/vessel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,iBAAiB,EAAC,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAC;AAmDvD,oBAAY,eAAe;IACzB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED,oBAAY,WAAW;IACrB,WAAW,kBAAkB;IAC7B,YAAY,mBAAmB;IAC/B,YAAY,mBAAmB;IAC/B,iBAAiB,yBAAyB;IAC1C,WAAW,kBAAkB;IAC7B,SAAS,eAAe;IACxB,SAAS,eAAe;IACxB,cAAc,qBAAqB;IACnC,QAAQ,cAAc;IACtB,aAAa,oBAAoB;IACjC,aAAa,oBAAoB;IACjC,kBAAkB,0BAA0B;IAC5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U,GAClB,MAAM,GAAG,SAAS,CAKpB;AAED,+EAA+E;AAC/E,MAAM,MAAM,SAAS,GACnB;IAAC,WAAW,EAAE,WAAW,CAAA;CAAC,GAAG;IAAC,WAAW,EAAE,cAAc,CAAA;CAAC,CAAC;AAE7D,+EAA+E;AAC/E,wBAAgB,SAAS,CACvB,WAAW,EAAE,WAAW,EACxB,WAAW,CAAC,EAAE,cAAc,GAC3B,SAAS,CAIX;AAED,iFAAiF;AACjF,wBAAgB,eAAe,CAC7B,GAAG,EAAE,SAAS,EACd,OAAO,EAAE,UAAU,GAClB,iBAAiB,CAInB"}
|
|
@@ -9,6 +9,8 @@ import cargo_top_default from "./vessels/cargo-top.js";
|
|
|
9
9
|
import cargo_wind_fore_default from "./vessels/cargo-wind-fore.js";
|
|
10
10
|
import cargo_wind_side_default, { cargoWindSideFaded } from "./vessels/cargo-wind-side.js";
|
|
11
11
|
import cargo_wind_top_default from "./vessels/cargo-wind-top.js";
|
|
12
|
+
import fish_cage_side_default from "./vessels/fish-cage-side.js";
|
|
13
|
+
import fish_cage_top_default from "./vessels/fish-cage-top.js";
|
|
12
14
|
import fishing_vessel_side_default, { fishingVesselSideFaded } from "./vessels/fishing-vessel-side.js";
|
|
13
15
|
import fishing_vessel_top_default from "./vessels/fishing-vessel-top.js";
|
|
14
16
|
import generic_side_default, { genericSideFaded } from "./vessels/generic-side.js";
|
|
@@ -59,6 +61,8 @@ var VesselImage = /* @__PURE__ */ function(VesselImage) {
|
|
|
59
61
|
VesselImage["cargoWindSide"] = "cargo-wind-side";
|
|
60
62
|
VesselImage["cargoWindSideFaded"] = "cargo-wind-side-faded";
|
|
61
63
|
VesselImage["cargoWindTop"] = "cargo-wind-top";
|
|
64
|
+
VesselImage["fishCageSide"] = "fish-cage-side";
|
|
65
|
+
VesselImage["fishCageTop"] = "fish-cage-top";
|
|
62
66
|
VesselImage["fishingVesselSide"] = "fishing-vessel-side";
|
|
63
67
|
VesselImage["fishingVesselSideFaded"] = "fishing-vessel-side-faded";
|
|
64
68
|
VesselImage["fishingVesselTop"] = "fishing-vessel-top";
|
|
@@ -113,6 +117,8 @@ var vesselImages = {
|
|
|
113
117
|
["cargo-wind-side"]: cargo_wind_side_default,
|
|
114
118
|
["cargo-wind-side-faded"]: cargoWindSideFaded,
|
|
115
119
|
["cargo-wind-top"]: cargo_wind_top_default,
|
|
120
|
+
["fish-cage-side"]: fish_cage_side_default,
|
|
121
|
+
["fish-cage-top"]: fish_cage_top_default,
|
|
116
122
|
["fishing-vessel-side"]: fishing_vessel_side_default,
|
|
117
123
|
["fishing-vessel-side-faded"]: fishingVesselSideFaded,
|
|
118
124
|
["fishing-vessel-top"]: fishing_vessel_top_default,
|