@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.161 → 2.0.0-next.163

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/.storybook/preview.tsx +1 -1
  2. package/bundle/openbridge-webcomponents.bundle.js +439 -327
  3. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  4. package/custom-elements.json +134 -34
  5. package/dist/components/keyboard-numeric/keyboard-numeric.css.js +2 -3
  6. package/dist/components/keyboard-numeric/keyboard-numeric.css.js.map +1 -1
  7. package/dist/navigation-instruments/compass-sector/compass-sector.css.js +20 -11
  8. package/dist/navigation-instruments/compass-sector/compass-sector.css.js.map +1 -1
  9. package/dist/navigation-instruments/compass-sector/compass-sector.d.ts +18 -17
  10. package/dist/navigation-instruments/compass-sector/compass-sector.d.ts.map +1 -1
  11. package/dist/navigation-instruments/compass-sector/compass-sector.js +85 -52
  12. package/dist/navigation-instruments/compass-sector/compass-sector.js.map +1 -1
  13. package/dist/navigation-instruments/gauge-radial/gauge-radial.css.js +2 -6
  14. package/dist/navigation-instruments/gauge-radial/gauge-radial.css.js.map +1 -1
  15. package/dist/navigation-instruments/rudder/rudder.css.js +40 -0
  16. package/dist/navigation-instruments/rudder/rudder.css.js.map +1 -0
  17. package/dist/navigation-instruments/rudder/rudder.d.ts +9 -0
  18. package/dist/navigation-instruments/rudder/rudder.d.ts.map +1 -1
  19. package/dist/navigation-instruments/rudder/rudder.js +40 -23
  20. package/dist/navigation-instruments/rudder/rudder.js.map +1 -1
  21. package/dist/navigation-instruments/watch/watch.css.js +6 -0
  22. package/dist/navigation-instruments/watch/watch.css.js.map +1 -1
  23. package/dist/navigation-instruments/watch/watch.d.ts.map +1 -1
  24. package/dist/navigation-instruments/watch/watch.js +11 -1
  25. package/dist/navigation-instruments/watch/watch.js.map +1 -1
  26. package/dist/svghelpers/arc-frame.d.ts +8 -0
  27. package/dist/svghelpers/arc-frame.d.ts.map +1 -1
  28. package/dist/svghelpers/arc-frame.js +16 -6
  29. package/dist/svghelpers/arc-frame.js.map +1 -1
  30. package/dist/svghelpers/radial-frame.d.ts +14 -1
  31. package/dist/svghelpers/radial-frame.d.ts.map +1 -1
  32. package/dist/svghelpers/radial-frame.js +3 -1
  33. package/dist/svghelpers/radial-frame.js.map +1 -1
  34. package/docs/GettingStarted.mdx +2 -0
  35. package/docs/MigrationGuide.mdx +924 -0
  36. package/docs/migration-guide/api-ar.md +7 -0
  37. package/docs/migration-guide/api-automation.md +11 -0
  38. package/docs/migration-guide/api-building-blocks.md +4 -0
  39. package/docs/migration-guide/api-instruments.md +19 -0
  40. package/docs/migration-guide/api-ui-components.md +19 -0
  41. package/docs/migration-guide/ar-paths.md +16 -0
  42. package/docs/migration-guide/css-variables.md +13 -0
  43. package/docs/migration-guide/deprecated-components.md +6 -0
  44. package/docs/migration-guide/deprecated-members.md +8 -0
  45. package/docs/migration-guide/flash-tempo.md +5 -0
  46. package/docs/migration-guide/icons-renamed.md +6 -0
  47. package/docs/migration-guide/icons-wind.md +16 -0
  48. package/docs/migration-guide/svelte-snippets.md +8 -0
  49. package/docs/migration-guide/wind-properties.md +10 -0
  50. package/package.json +1 -1
  51. package/script/check-css-variables.ts +1 -5
  52. package/src/components/keyboard-numeric/keyboard-numeric.css +2 -3
  53. package/src/mixins/contain-aspect.css +14 -0
  54. package/src/navigation-instruments/compass-sector/compass-sector.css +17 -11
  55. package/src/navigation-instruments/compass-sector/compass-sector.spec.ts +57 -0
  56. package/src/navigation-instruments/compass-sector/compass-sector.stories.ts +23 -0
  57. package/src/navigation-instruments/compass-sector/compass-sector.ts +127 -60
  58. package/src/navigation-instruments/gauge-radial/gauge-radial.css +3 -10
  59. package/src/navigation-instruments/rudder/rudder.css +27 -0
  60. package/src/navigation-instruments/rudder/rudder.ts +52 -22
  61. package/src/navigation-instruments/watch/watch.css +6 -0
  62. package/src/navigation-instruments/watch/watch.ts +16 -1
  63. package/src/svghelpers/arc-frame.ts +19 -5
  64. package/src/svghelpers/radial-frame.spec.ts +51 -0
  65. package/src/svghelpers/radial-frame.ts +15 -1
@@ -0,0 +1,7 @@
1
+ | Element | 1.0.1 | 2.0 |
2
+ | --------------------------------------------------------------------- | ----------------------- | -------------------------------------- |
3
+ | `obc-poi`, `obc-poi-aton`, `obc-poi-data`, `obc-poi-vessel` | `buttonY` = `null` | `buttonY` = `0` |
4
+ | `obc-poi-aton`, `obc-poi-data`, `obc-poi-vessel` | `lineCompensationY` | removed; the layer computes the offset |
5
+ | `obc-poi-layer` | attribute `isselected` | attribute `is-selected` |
6
+ | `obc-poi-object-aton`, `obc-poi-object-data`, `obc-poi-object-vessel` | `colorStyleVars` | removed |
7
+ | `obc-poi-object-data`, `obc-poi-object-vessel` | `objectStyle`: `string` | `objectStyle`: `ObcPoiObjectStyle` |
@@ -0,0 +1,11 @@
1
+ | Element | 1.0.1 | 2.0 |
2
+ | -------------------------------------------------------------------------------------- | -------------------------------------------------- | ----------------------------------------------------------- |
3
+ | all automation devices | `badgeAlertOff` | `badgeAlert="silence"` |
4
+ | all automation devices | `badgeAuto` | `badgeControl="auto"` |
5
+ | all automation devices | `badgeCommandLocked`: `boolean` | `badgeCommandLocked`: `AutomationButtonBadgeCommandLocked` |
6
+ | all automation devices | `badgeDuty` | `badgeInterlock="interlock"` |
7
+ | all automation devices except `obc-fan`, `obc-motor` and `obc-pump` | `direction` | removed; only `obc-motor`, `obc-pump` and `obc-fan` have it |
8
+ | all automation devices, `obc-automation-button`, `obc-automation-button-readout-stack` | `hasIdTag` | removed; set `tag`, or leave it unset to hide the tag |
9
+ | all automation devices | `tag` = `''` | `tag` = `null` |
10
+ | `obc-automation-button`, `obc-automation-button-readout-stack` | `tag`: `AutomationButtonReadoutStackTag` or `null` | `tag`: `string` or `null` |
11
+ | `obc-automation-tank` | `variant` | `orientation`; `variant="compact"` is now `compact` |
@@ -0,0 +1,4 @@
1
+ | Element | 1.0.1 | 2.0 |
2
+ | ----------------------- | ---------- | ------- |
3
+ | `obc-instrument-radial` | `maxAngle` | removed |
4
+ | `obc-instrument-radial` | `minAngle` | removed |
@@ -0,0 +1,19 @@
1
+ | Element | 1.0.1 | 2.0 |
2
+ | ------------------------------------------------------- | ---------------------------------------------------------- | -------------------------------------------------------------- |
3
+ | `obc-compass`, `obc-compass-flat`, `obc-compass-sector` | `rotMaxValue` = `10` | `rotMaxValue` = `60` |
4
+ | `obc-compass` | `windSpeed` | `currentWindSpeedKnots` |
5
+ | `obc-compass-indicator` | `arrow` | `direction` |
6
+ | `obc-compass-indicator` | `northUp` = `false` | `northUp` = `true` |
7
+ | `obc-compass-indicator` | attribute `northup` | none; set the `northUp` property |
8
+ | `obc-compass-sector` | wrapper event `None` (a `@fires` placeholder; never fired) | removed |
9
+ | `obc-depth-actual` | `primaryTickmarkInterval` = `50` | unset; follows the range |
10
+ | `obc-depth-actual` | `secondaryTickmarkInterval` = `10` | unset; follows the range |
11
+ | `obc-speed-gauge` | `showReadout` | `hasReadout` |
12
+ | `obc-velocity-projection-plot` | `instantCurrentDirectionDeg` | `currentFromDirection` |
13
+ | `obc-velocity-projection-plot` | `instantCurrentSpeedNumber` | `currentSpeedKnots` |
14
+ | `obc-velocity-projection-plot` | `instantWindDirectionDeg` | `currentWindFromDirection` |
15
+ | `obc-velocity-projection-plot` | `instantWindSpeedNumber` | `currentWindSpeedKnots` |
16
+ | `obc-watch` | `wind` | `windKnots` |
17
+ | `obc-wind` | `currentWindSpeedBeaufort` | `currentWindSpeedKnots` |
18
+ | `obc-wind-indicator` | `northUp` | removed; use `direction="relative"` with `rotation-angle` |
19
+ | `obc-wind-indicator` | `speed` | `currentWindSpeedKnots` (attribute `current-wind-speed-knots`) |
@@ -0,0 +1,19 @@
1
+ | Element | 1.0.1 | 2.0 |
2
+ | ------------------------ | ------------------------------------- | ------------------------------------------ |
3
+ | `obc-alert-icon` | `outline` | removed; use an `obi-*-badge-outline` icon |
4
+ | `obc-alert-menu` | wrapper event `alert-list-click` | `go-to-alert-list-click` |
5
+ | `obc-card` | `dialogTimeOutSeconds` = `20000` | `dialogTimeOutSeconds` = `20` |
6
+ | `obc-card` | `dialogVisibleTimerSeconds` = `10000` | `dialogVisibleTimerSeconds` = `10` |
7
+ | `obc-checkbox-item` | `isLevel1` | `level="1" expandable` |
8
+ | `obc-checkbox-item` | `isLevel2` | `level="2"` |
9
+ | `obc-checkbox-item` | `isNested` | `level="1"` |
10
+ | `obc-number-input-field` | `value` = `''` | `value` = `NaN` |
11
+ | `obc-number-input-field` | `value`: `string` | `value`: `number` |
12
+ | `obc-start-stop-switch` | `showCheckedStateIcon` | removed; the icon slots always rendered |
13
+ | `obc-start-stop-switch` | `showUncheckedStateIcon` | removed; the icon slots always rendered |
14
+ | `obc-stepper-box` | `hasHelperText` | set `helperText` |
15
+ | `obc-stepper-box` | `leftIcon` | removed |
16
+ | `obc-stepper-box` | `rightIcon` | removed |
17
+ | `obc-stepper-box` | default slot | set `value` |
18
+ | `obc-stepper-box` | slot `helper-text` | set `helperText` |
19
+ | `obc-stepper-box` | slot `unit` | set `unit` |
@@ -0,0 +1,16 @@
1
+ | 1.0.1 | 2.0 |
2
+ | ---------------------------------------------------- | ------------------------------------------- |
3
+ | `dist/ar/building-blocks/poi/poi.js` | `dist/ar/poi/poi.js` |
4
+ | `dist/ar/poi-aton/poi-aton.js` | `dist/ar/poi/poi-aton.js` |
5
+ | `dist/ar/poi-data/poi-data.js` | `dist/ar/poi/poi-data.js` |
6
+ | `dist/ar/poi-vessel/poi-vessel.js` | `dist/ar/poi/poi-vessel.js` |
7
+ | `dist/ar/building-blocks/poi-button/poi-button.js` | `dist/ar/poi-button/poi-button.js` |
8
+ | `dist/ar/poi-button-aton/poi-button-aton.js` | `dist/ar/poi-button/poi-button-aton.js` |
9
+ | `dist/ar/poi-button-data/poi-button-data.js` | `dist/ar/poi-button/poi-button-data.js` |
10
+ | `dist/ar/poi-button-vessel/poi-button-vessel.js` | `dist/ar/poi-button/poi-button-vessel.js` |
11
+ | `dist/ar/building-blocks/poi-object/poi-object.js` | `dist/ar/poi-object/poi-object.js` |
12
+ | `dist/ar/poi-object-aton/poi-object-aton.js` | `dist/ar/poi-object/poi-object-aton.js` |
13
+ | `dist/ar/poi-object-data/poi-object-data.js` | `dist/ar/poi-object/poi-object-data.js` |
14
+ | `dist/ar/poi-object-vessel/poi-object-vessel.js` | `dist/ar/poi-object/poi-object-vessel.js` |
15
+ | other `dist/ar/building-blocks/poi/*` modules | the same file name in `dist/ar/poi/` |
16
+ | other `dist/ar/building-blocks/poi-object/*` modules | the same file name in `dist/ar/poi-object/` |
@@ -0,0 +1,13 @@
1
+ | 1.0.1 | 2.0 |
2
+ | ---------------------------------------------------------------------- | ----------------------------------------------------------------------- |
3
+ | `--instrument-components-readout-new-*` (115 variables) | `--instrument-components-readout-*` |
4
+ | `--app-components-badge-*` (9 variables) | `--ui-components-badge-*` |
5
+ | `--ui-components-keyboard-nummeric-*` (9 variables) | `--ui-components-keyboard-numeric-*` |
6
+ | `--app-components-clock-colon-size` | `--app-components-clock-colon-size-regular` |
7
+ | `--app-components-clock-digit-spacing` | `--app-components-clock-digit-spacing-regular` |
8
+ | `--instrument-components-advice-indicator-alert-point-height` | `--instrument-components-advice-indicator-alert-point-thickness` |
9
+ | `--instrument-components-advice-indicator-alert-point-width` | `--instrument-components-advice-indicator-alert-point-lenght` |
10
+ | `--data-weather-cloud-seconday-color` | `--data-weather-cloud-secondary-color` |
11
+ | `--data-weather-cloud-light-seconday-color` | `--data-weather-cloud-light-secondary-color` |
12
+ | `--global-size-spacing-nav-item-and-menus-padding-horizonal-list-item` | `--global-size-spacing-nav-item-and-menus-padding-horizontal-list-item` |
13
+ | `--alert-warning-text-color` | none |
@@ -0,0 +1,6 @@
1
+ | Element | Use instead |
2
+ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
3
+ | `obc-instrument-field` | `obc-readout`; see [Instrument Field (deprecated)](?path=/docs/instruments-instrument-field-deprecated--docs) |
4
+ | `obc-azimuth-thruster-labeled` | `obc-azimuth-thruster` with an `obc-readout` beside it |
5
+ | `obc-notification-badge-button` | `obc-icon-button`: the icon goes in its default slot and the text in the `label` slot with `hasLabel`; `openLeft`, `openRight` and `indent` have no equivalent |
6
+ | `obc-corner-line`, `obc-direction-line`, `obc-end-point-line`, `obc-horizontal-line`, `obc-line-cross`, `obc-line-overlap`, `obc-three-way-line`, `obc-vertical-line` | the `@oicl/connector-diagram` package |
@@ -0,0 +1,8 @@
1
+ | Element | Deprecated | Use instead |
2
+ | ------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
3
+ | `obc-alert-icon` | `type` | `alertType` |
4
+ | `obc-compass`, `obc-compass-flat`, `obc-compass-sector`, `obc-rate-of-turn`, `obc-rot-indicator`, `obc-watch`, `obc-watch-flat` | `rotationsPerMinute` | `rateOfTurnDegreesPerMinute`; the old property applies only while the new one is unset |
5
+ | `obc-depth-actual` | `instrumentRange` | `maxDepth` |
6
+ | `obc-fan`, `obc-motor`, `obc-pump` | `speedInPercent` | `speed` with `speedUnit`; `speed` wins when both are set |
7
+ | `obc-tab-item`, and the `tabs` of `obc-tab-row` | `hasBadge`, `badgeCount`, `badgeType`, `badgeSize`, `badgeShowNumber`, `showLeadingBadgeIcon` | `badges` |
8
+ | `obc-wind-indicator` | `angle` | `currentWindFromDirection` |
@@ -0,0 +1,5 @@
1
+ | 1.0.1 (on / off) | 2.0 | On / off | Alert types |
2
+ | ------------------------------------------------------- | ----------------------------------------------- | ---------------- | ---------------------------- |
3
+ | `--alarm-blink-on`, `--alarm-blink-off` (1 s / 1 s) | `--flash-fast-on`, `--flash-fast-off` | 400 ms / 400 ms | alarm, high, critical |
4
+ | `--warning-blink-on`, `--warning-blink-off` (2 s / 2 s) | `--flash-slow-on`, `--flash-slow-off` | 400 ms / 1200 ms | warning, medium |
5
+ | none | `--flash-very-slow-on`, `--flash-very-slow-off` | 400 ms / 2800 ms | low, and any rectified alert |
@@ -0,0 +1,6 @@
1
+ | 1.0.1 | 2.0 |
2
+ | ------------------------------------- | -------------------------- |
3
+ | `obi-bipolar_transistor-*` (14 icons) | `obi-bipolar-transistor-*` |
4
+ | `obi-chevron-tripple-left` | `obi-chevron-triple-left` |
5
+ | `obi-chevron-tripple-right` | `obi-chevron-triple-right` |
6
+ | `obi-heat_pump_balance` | `obi-heat-pump-balance` |
@@ -0,0 +1,16 @@
1
+ | 1.0.1 suffix | 2.0 suffix |
2
+ | ------------------- | ------------------------------------------------------------ |
3
+ | `-1` (name reused) | `-0` |
4
+ | `-2` | `-1` |
5
+ | `-3` | `-5` |
6
+ | `-4` | `-10` |
7
+ | `-5` (name reused) | `-15` |
8
+ | `-6` | `-20` |
9
+ | `-7` | `-25` |
10
+ | `-8` | `-30` |
11
+ | `-9` | `-35` |
12
+ | `-10` (name reused) | `-40`; `obi-wind-true-*` has no `-40`, so use `-35` or `-45` |
13
+ | `-11` | `-45` |
14
+ | `-12` | `-50` |
15
+ | `-13` | `-60` |
16
+ | `-14` | `-70` |
@@ -0,0 +1,8 @@
1
+ | Component | 1.0.1 snippet | 2.0 snippet |
2
+ | ------------------------------------------------------------------------- | ------------------------------- | ---------------------------------------------------- |
3
+ | `ObcTabItem` | `title` | `titleSnippet` |
4
+ | `ObcTitleContainer` | `label` | `labelSnippet` |
5
+ | `ObcFormContainer` | `contentTitle` | `contentTitleSnippet` |
6
+ | `ObcMessageMenuItem` | `title`, `description` | `titleSnippet`, `descriptionSnippet` |
7
+ | `ObcChartObjectVesselButton` | `name`, `number`, `vesselImage` | `nameSnippet`, `numberSnippet`, `vesselImageSnippet` |
8
+ | `ObcFloatingItem`, `ObcAdviceFloatingItem`, `ObcNotificationFloatingItem` | `action`, `action2` | `actionSnippet`, `action2Snippet` |
@@ -0,0 +1,10 @@
1
+ | Element | 1.0.1 | 2.0 |
2
+ | ------------------------------ | ---------------------------- | -------------------------------------------------------------- |
3
+ | `obc-wind` | `currentWindSpeedBeaufort` | `currentWindSpeedKnots` |
4
+ | `obc-wind-indicator` | `speed` | `currentWindSpeedKnots` (attribute `current-wind-speed-knots`) |
5
+ | `obc-compass` | `windSpeed` | `currentWindSpeedKnots` |
6
+ | `obc-watch` | `wind` | `windKnots` |
7
+ | `obc-velocity-projection-plot` | `instantWindSpeedNumber` | `currentWindSpeedKnots` |
8
+ | `obc-velocity-projection-plot` | `instantWindDirectionDeg` | `currentWindFromDirection` |
9
+ | `obc-velocity-projection-plot` | `instantCurrentSpeedNumber` | `currentSpeedKnots` |
10
+ | `obc-velocity-projection-plot` | `instantCurrentDirectionDeg` | `currentFromDirection` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oicl/openbridge-webcomponents-full-bundle",
3
- "version": "2.0.0-next.161",
3
+ "version": "2.0.0-next.163",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -45,11 +45,7 @@ import path from 'path';
45
45
  import {globby} from 'globby';
46
46
 
47
47
  // Undefined CSS variables that only a fix in Figma can resolve (#929).
48
- const allowedUndefinedVariables = new Set([
49
- // B-7: Figma binds both to variables missing from Component-size
50
- '--ui-components-keyboard-numeric-component-height-min',
51
- '--ui-components-keyboard-numeric-touch-target-size',
52
- ]);
48
+ const allowedUndefinedVariables = new Set<string>([]);
53
49
 
54
50
  interface VariableDefinitionLocation {
55
51
  file: string;
@@ -3,7 +3,6 @@
3
3
  width: fit-content;
4
4
  height: fit-content;
5
5
  min-width: var(--ui-components-keyboard-numeric-component-width-min);
6
- min-height: var(--ui-components-keyboard-numeric-component-height-min);
7
6
  flex-direction: column;
8
7
  align-items: flex-start;
9
8
  border-radius: var(--ui-components-keyboard-numeric-border-radius);
@@ -114,7 +113,7 @@ obc-icon-button.calculation-button::part(visible-wrapper) {
114
113
 
115
114
  .key-button {
116
115
  flex: 1 0 0;
117
- min-width: var(--ui-components-keyboard-numeric-touch-target-size);
116
+ min-width: var(--ui-components-keyboard-numeric-button-size-min);
118
117
  min-height: var(--ui-components-keyboard-numeric-button-size-min);
119
118
  height: var(--ui-components-keyboard-numeric-button-size-min);
120
119
  }
@@ -123,7 +122,7 @@ obc-button.key-button::part(visible-wrapper) {
123
122
  box-sizing: border-box;
124
123
  display: flex;
125
124
  flex: 1 0 0;
126
- min-width: var(--ui-components-keyboard-numeric-touch-target-size);
125
+ min-width: var(--ui-components-keyboard-numeric-button-size-min);
127
126
  min-height: var(--ui-components-keyboard-numeric-button-size-min);
128
127
  height: 100%;
129
128
  align-items: center;
@@ -0,0 +1,14 @@
1
+ /* Sizing shared by radial instruments whose frame is not square
2
+ (docs/agents/watch-radial-instruments.md). The caller owns `aspect-ratio`,
3
+ since only it knows the frame. */
4
+
5
+ /* The dial becomes the largest box of its aspect that fits inside *both* the
6
+ available width and height of the (full-size) host. `width: auto` stretches
7
+ the block to the host width, then `aspect-ratio` + `max-height` transfer the
8
+ constraint back, shrinking it to fit a short host too — see issue #992. */
9
+ @define-mixin contain-aspect {
10
+ width: auto;
11
+ height: auto;
12
+ max-width: 100%;
13
+ max-height: 100%;
14
+ }
@@ -16,6 +16,13 @@
16
16
  height: 100%;
17
17
  }
18
18
 
19
+ .container > svg {
20
+ /* The arc is drawn where it points and rotated into the window, so it paints
21
+ outside the cropped viewBox; `transform-origin` (set inline) keeps that
22
+ rotation on the compass centre. */
23
+ overflow: visible;
24
+ }
25
+
19
26
  .container > .readout {
20
27
  left: 50%;
21
28
  width: auto;
@@ -25,16 +32,15 @@
25
32
 
26
33
  :host {
27
34
  display: block;
28
- width: 100%;
29
- height: 100%;
30
- /* Clips the rotated overlay <svg transform="rotate(...)">, whose corners
31
- swing outside the host and leak arc pixels in wide layouts (same
32
- protection obc-watch has had since #994). Known trade-off: the HDG/COG
33
- arrow apexes previously painted 1-2px past the host's top edge and are
34
- now shaved flat at the box edge — imperceptible at normal viewing.
35
- TODO(designer): if the shave is unwanted, the frame needs headroom so
36
- the arrow tips fit inside the box — see "Host clipping & the arrow-apex
37
- shave" in docs/agents/watch-radial-instruments.md before changing
38
- (interacts with the #1021/#1049 label-reserve geometry). */
35
+ /* The element is the cropped canvas, not a square holding one, so the
36
+ aspect comes from the frame each render — the crop and the label reserve
37
+ both move it. 448 / 217 is the default crop's box (448 wide × 448·(1 −
38
+ 51.5%) tall); keep in sync with `SECTOR_CLIP_BOTTOM` in
39
+ compass-sector.ts. */
40
+ @mixin contain-aspect;
41
+ aspect-ratio: var(--obc-compass-sector-aspect, 448 / 217);
42
+
43
+ /* Both layers paint past their viewBox so the rotation can carry the arc in;
44
+ this is the edge that bounds the component. */
39
45
  overflow: hidden;
40
46
  }
@@ -0,0 +1,57 @@
1
+ import {describe, expect, it} from 'vitest';
2
+ import {render} from 'vitest-browser-lit';
3
+ import {html} from 'lit';
4
+ import './compass-sector.js';
5
+ import type {ObcCompassSector} from './compass-sector.js';
6
+ import '../../main.css';
7
+
8
+ const HEADINGS = [0, 37, 90, 180, 311, 359];
9
+
10
+ async function frameOf(
11
+ heading: number,
12
+ zoomToFitArc: boolean
13
+ ): Promise<{viewBox: string; aspect: string}> {
14
+ const screen = render(
15
+ html`<div style="width: 512px; height: 512px">
16
+ <obc-compass-sector
17
+ .heading=${heading}
18
+ .courseOverGround=${heading + 12}
19
+ .zoomToFitArc=${zoomToFitArc}
20
+ ></obc-compass-sector>
21
+ </div>`
22
+ );
23
+ const el = screen.container.querySelector(
24
+ 'obc-compass-sector'
25
+ ) as ObcCompassSector;
26
+ await el.updateComplete;
27
+ const overlay = el.shadowRoot!.querySelector('svg') as SVGSVGElement;
28
+ return {
29
+ viewBox: overlay.getAttribute('viewBox') ?? '',
30
+ // The host itself is the canvas, so its box is what must follow the frame.
31
+ aspect: getComputedStyle(el).aspectRatio,
32
+ };
33
+ }
34
+
35
+ describe('obc-compass-sector — the canvas holds still', () => {
36
+ for (const zoomToFitArc of [false, true]) {
37
+ it(`keeps one frame at every heading (zoomToFitArc: ${zoomToFitArc})`, async () => {
38
+ const frames = [];
39
+ for (const heading of HEADINGS) {
40
+ frames.push(await frameOf(heading, zoomToFitArc));
41
+ }
42
+ for (const frame of frames) {
43
+ expect(frame).toEqual(frames[0]);
44
+ }
45
+ });
46
+ }
47
+
48
+ it('crops the square box to a wide canvas', async () => {
49
+ const {viewBox, aspect} = await frameOf(0, false);
50
+ const [x, , width, height] = viewBox.split(' ').map(Number);
51
+ // Full width, cropped to the arc's 40-unit bottom margin.
52
+ expect(width).toBe(448);
53
+ expect(height).toBeCloseTo(217.28, 1);
54
+ expect(x).toBe(-224);
55
+ expect(aspect).toBe(`${width} / ${height}`);
56
+ });
57
+ });
@@ -184,6 +184,29 @@ export const WithRotBarEnhanced: Story = {
184
184
  },
185
185
  };
186
186
 
187
+ export const ShortWideContainer: Story = {
188
+ args: {
189
+ headingSetpoint: 311,
190
+ width: 600,
191
+ height: 200,
192
+ },
193
+ };
194
+
195
+ export const SmallWidth: Story = {
196
+ args: {
197
+ headingSetpoint: 311,
198
+ width: 200,
199
+ },
200
+ };
201
+
202
+ export const NarrowFovZoomed: Story = {
203
+ args: {
204
+ heading: 90,
205
+ courseOverGround: 90,
206
+ minFOV: 5,
207
+ },
208
+ };
209
+
187
210
  export const WithRateOfTurnDegreesPerMinute: Story = {
188
211
  tags: ['skip-test'],
189
212
  args: {