@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
|
@@ -48,6 +48,11 @@ export interface LinearAdviceBandOptions {
|
|
|
48
48
|
maskId: string;
|
|
49
49
|
/** The band is drawn under a reflection, so the hatch is mirrored back. */
|
|
50
50
|
mirrorPattern?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* ViewBox units per CSS pixel when the band is pixel-fixed inside a scaled
|
|
53
|
+
* drawing: the hatch tile is enlarged by it so the stripes keep their pitch.
|
|
54
|
+
*/
|
|
55
|
+
unitsPerPx?: number;
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
const point = (vertical: boolean, main: number, perp: number) =>
|
|
@@ -67,13 +72,17 @@ function bandPath(o: LinearAdviceBandOptions, advice: ResolvedAdvice) {
|
|
|
67
72
|
const hi = Math.max(o.mainStart, o.mainEnd);
|
|
68
73
|
const capLo = ascending ? caps.start : caps.end;
|
|
69
74
|
const capHi = ascending ? caps.end : caps.start;
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
// The caps are pixel geometry like the band: a scaled drawing holds them
|
|
76
|
+
// in the band's own units.
|
|
77
|
+
const u = o.unitsPerPx ?? 1;
|
|
78
|
+
const inset = ADVICE_CAP_INSET * u;
|
|
79
|
+
const edgeLo = capLo === AdviceCap.pill ? lo + inset : lo;
|
|
80
|
+
const edgeHi = capHi === AdviceCap.pill ? hi - inset : hi;
|
|
72
81
|
const radius = (cap: AdviceCap) =>
|
|
73
82
|
cap === AdviceCap.pill
|
|
74
83
|
? t / 2
|
|
75
84
|
: cap === AdviceCap.square
|
|
76
|
-
? ADVICE_ALERT_CORNER_RADIUS
|
|
85
|
+
? ADVICE_ALERT_CORNER_RADIUS * u
|
|
77
86
|
: 0;
|
|
78
87
|
const rLo = radius(capLo);
|
|
79
88
|
const rHi = radius(capHi);
|
|
@@ -120,21 +129,23 @@ export function renderLinearAdviceBand(
|
|
|
120
129
|
const d = bandPath(o, advice);
|
|
121
130
|
if (d === null) return nothing;
|
|
122
131
|
if (style.pattern === 'none') {
|
|
123
|
-
return svg`<path d=${d} fill=${style.fill} stroke=${style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
|
|
132
|
+
return svg`<path class="advice-band" d=${d} fill=${style.fill} stroke=${style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
|
|
124
133
|
}
|
|
125
134
|
const t = o.thickness ?? ADVICE_BAND_THICKNESS;
|
|
126
135
|
const lo = Math.min(o.mainStart, o.mainEnd);
|
|
127
136
|
const hi = Math.max(o.mainStart, o.mainEnd);
|
|
128
137
|
const patternId = `${o.maskId}-pattern`;
|
|
129
138
|
const mirrored = o.mirrorPattern ?? false;
|
|
139
|
+
const unitsPerPx = o.unitsPerPx ?? 1;
|
|
130
140
|
const pattern =
|
|
131
141
|
style.pattern === 'hairline'
|
|
132
|
-
? hairlinePattern(patternId, style.patternColor, mirrored)
|
|
142
|
+
? hairlinePattern(patternId, style.patternColor, mirrored, unitsPerPx)
|
|
133
143
|
: stripePattern(
|
|
134
144
|
patternId,
|
|
135
145
|
style.patternColor,
|
|
136
146
|
ADVICE_STRIPE.width,
|
|
137
|
-
mirrored
|
|
147
|
+
mirrored,
|
|
148
|
+
unitsPerPx
|
|
138
149
|
);
|
|
139
150
|
const cover = o.vertical
|
|
140
151
|
? svg`<rect x=${o.perpStart} y=${lo} width=${t} height=${hi - lo} fill=${style.fill}/><rect x=${o.perpStart} y=${lo} width=${t} height=${hi - lo} fill="url(#${patternId})"/>`
|
|
@@ -147,7 +158,7 @@ export function renderLinearAdviceBand(
|
|
|
147
158
|
</mask>
|
|
148
159
|
</defs>
|
|
149
160
|
<g mask="url(#${o.maskId})">${cover}</g>
|
|
150
|
-
<path d=${d} fill="none" stroke=${style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
|
|
161
|
+
<path class="advice-band" d=${d} fill="none" stroke=${style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
|
|
151
162
|
}
|
|
152
163
|
|
|
153
164
|
/** Where a point marker sits: on the band centreline at its value. */
|
|
@@ -158,6 +169,8 @@ export interface LinearAdvicePointOptions {
|
|
|
158
169
|
/** Perpendicular coordinate of the band centreline. */
|
|
159
170
|
perpCenter: number;
|
|
160
171
|
advice: AdviceInput | ResolvedAdvice;
|
|
172
|
+
/** ViewBox units per CSS pixel when the marker is pixel-fixed inside a scaled drawing. */
|
|
173
|
+
unitsPerPx?: number;
|
|
161
174
|
}
|
|
162
175
|
|
|
163
176
|
/**
|
|
@@ -172,8 +185,9 @@ export function renderLinearAdvicePoint(
|
|
|
172
185
|
const style = adviceStyle(advice.category, advice.state);
|
|
173
186
|
const cx = o.vertical ? o.perpCenter : o.main;
|
|
174
187
|
const cy = o.vertical ? o.main : o.perpCenter;
|
|
188
|
+
const u = o.unitsPerPx ?? 1;
|
|
175
189
|
if (isGoToCategory(advice.category)) {
|
|
176
|
-
return svg`<circle cx=${cx} cy=${cy} r=${ADVICE_POINT_DOT_DIAMETER / 2} fill=${style.fill} stroke=${style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
|
|
190
|
+
return svg`<circle cx=${cx} cy=${cy} r=${(ADVICE_POINT_DOT_DIAMETER / 2) * u} fill=${style.fill} stroke=${style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
|
|
177
191
|
}
|
|
178
192
|
const grey =
|
|
179
193
|
advice.category === AdviceCategory.caution
|
|
@@ -182,9 +196,9 @@ export function renderLinearAdvicePoint(
|
|
|
182
196
|
: style.stroke
|
|
183
197
|
: undefined;
|
|
184
198
|
const {length, thickness, radius} = ADVICE_POINT_TICK;
|
|
185
|
-
const w = o.vertical ? length : thickness;
|
|
186
|
-
const h = o.vertical ? thickness : length;
|
|
187
|
-
return svg`<rect x=${cx - w / 2} y=${cy - h / 2} width=${w} height=${h} rx=${radius} fill=${grey ?? style.fill} stroke=${grey ?? style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
|
|
199
|
+
const w = (o.vertical ? length : thickness) * u;
|
|
200
|
+
const h = (o.vertical ? thickness : length) * u;
|
|
201
|
+
return svg`<rect x=${cx - w / 2} y=${cy - h / 2} width=${w} height=${h} rx=${radius * u} fill=${grey ?? style.fill} stroke=${grey ?? style.stroke} stroke-width="1" vector-effect="non-scaling-stroke"/>`;
|
|
188
202
|
}
|
|
189
203
|
|
|
190
204
|
/** Where an area sits: the advice's range along the main axis, the bar across it. */
|
|
@@ -26,12 +26,19 @@ export function stripePattern(
|
|
|
26
26
|
id: string,
|
|
27
27
|
color: string,
|
|
28
28
|
width: number = ADVICE_STRIPE.width,
|
|
29
|
-
mirrored = false
|
|
29
|
+
mirrored = false,
|
|
30
|
+
unitsPerPx = 1
|
|
30
31
|
): SVGTemplateResult {
|
|
31
32
|
const t = STRIPE_TILE;
|
|
32
33
|
// A group drawn under a reflection shows the stripe sloping the other way;
|
|
33
|
-
// mirroring the tile back keeps every band on the same slope.
|
|
34
|
-
|
|
34
|
+
// mirroring the tile back keeps every band on the same slope. A band that
|
|
35
|
+
// is pixel-fixed inside a scaled drawing enlarges the tile by the same
|
|
36
|
+
// factor, so the stripes keep the design pitch on screen.
|
|
37
|
+
const transforms = [
|
|
38
|
+
mirrored ? 'scale(-1 1)' : '',
|
|
39
|
+
unitsPerPx !== 1 ? `scale(${unitsPerPx})` : '',
|
|
40
|
+
].filter(Boolean);
|
|
41
|
+
const transform = transforms.length ? transforms.join(' ') : nothing;
|
|
35
42
|
return svg`<pattern id=${id} patternUnits="userSpaceOnUse" width=${t} height=${t} patternTransform=${transform}>
|
|
36
43
|
<path d="M 0 0 L ${t} ${t} M ${t / 2} ${-t / 2} L ${(3 * t) / 2} ${t / 2} M ${-t / 2} ${t / 2} L ${t / 2} ${(3 * t) / 2}" stroke=${color} stroke-width=${width} stroke-linecap="square"/>
|
|
37
44
|
</pattern>`;
|
|
@@ -41,9 +48,10 @@ export function stripePattern(
|
|
|
41
48
|
export function hairlinePattern(
|
|
42
49
|
id: string,
|
|
43
50
|
color: string,
|
|
44
|
-
mirrored = false
|
|
51
|
+
mirrored = false,
|
|
52
|
+
unitsPerPx = 1
|
|
45
53
|
): SVGTemplateResult {
|
|
46
|
-
return stripePattern(id, color, ADVICE_HAIRLINE_WIDTH, mirrored);
|
|
54
|
+
return stripePattern(id, color, ADVICE_HAIRLINE_WIDTH, mirrored, unitsPerPx);
|
|
47
55
|
}
|
|
48
56
|
|
|
49
57
|
/** The alarm lattice: square dots on a grid, every other row shifted by half a pitch. */
|