@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.
- package/.storybook/preview.tsx +1 -1
- package/bundle/openbridge-webcomponents.bundle.js +439 -327
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +134 -34
- package/dist/components/keyboard-numeric/keyboard-numeric.css.js +2 -3
- package/dist/components/keyboard-numeric/keyboard-numeric.css.js.map +1 -1
- package/dist/navigation-instruments/compass-sector/compass-sector.css.js +20 -11
- package/dist/navigation-instruments/compass-sector/compass-sector.css.js.map +1 -1
- package/dist/navigation-instruments/compass-sector/compass-sector.d.ts +18 -17
- package/dist/navigation-instruments/compass-sector/compass-sector.d.ts.map +1 -1
- package/dist/navigation-instruments/compass-sector/compass-sector.js +85 -52
- package/dist/navigation-instruments/compass-sector/compass-sector.js.map +1 -1
- package/dist/navigation-instruments/gauge-radial/gauge-radial.css.js +2 -6
- package/dist/navigation-instruments/gauge-radial/gauge-radial.css.js.map +1 -1
- package/dist/navigation-instruments/rudder/rudder.css.js +40 -0
- package/dist/navigation-instruments/rudder/rudder.css.js.map +1 -0
- package/dist/navigation-instruments/rudder/rudder.d.ts +9 -0
- package/dist/navigation-instruments/rudder/rudder.d.ts.map +1 -1
- package/dist/navigation-instruments/rudder/rudder.js +40 -23
- package/dist/navigation-instruments/rudder/rudder.js.map +1 -1
- package/dist/navigation-instruments/watch/watch.css.js +6 -0
- package/dist/navigation-instruments/watch/watch.css.js.map +1 -1
- package/dist/navigation-instruments/watch/watch.d.ts.map +1 -1
- package/dist/navigation-instruments/watch/watch.js +11 -1
- package/dist/navigation-instruments/watch/watch.js.map +1 -1
- package/dist/svghelpers/arc-frame.d.ts +8 -0
- package/dist/svghelpers/arc-frame.d.ts.map +1 -1
- package/dist/svghelpers/arc-frame.js +16 -6
- package/dist/svghelpers/arc-frame.js.map +1 -1
- package/dist/svghelpers/radial-frame.d.ts +14 -1
- package/dist/svghelpers/radial-frame.d.ts.map +1 -1
- package/dist/svghelpers/radial-frame.js +3 -1
- package/dist/svghelpers/radial-frame.js.map +1 -1
- package/docs/GettingStarted.mdx +2 -0
- package/docs/MigrationGuide.mdx +924 -0
- package/docs/migration-guide/api-ar.md +7 -0
- package/docs/migration-guide/api-automation.md +11 -0
- package/docs/migration-guide/api-building-blocks.md +4 -0
- package/docs/migration-guide/api-instruments.md +19 -0
- package/docs/migration-guide/api-ui-components.md +19 -0
- package/docs/migration-guide/ar-paths.md +16 -0
- package/docs/migration-guide/css-variables.md +13 -0
- package/docs/migration-guide/deprecated-components.md +6 -0
- package/docs/migration-guide/deprecated-members.md +8 -0
- package/docs/migration-guide/flash-tempo.md +5 -0
- package/docs/migration-guide/icons-renamed.md +6 -0
- package/docs/migration-guide/icons-wind.md +16 -0
- package/docs/migration-guide/svelte-snippets.md +8 -0
- package/docs/migration-guide/wind-properties.md +10 -0
- package/package.json +1 -1
- package/script/check-css-variables.ts +1 -5
- package/src/components/keyboard-numeric/keyboard-numeric.css +2 -3
- package/src/mixins/contain-aspect.css +14 -0
- package/src/navigation-instruments/compass-sector/compass-sector.css +17 -11
- package/src/navigation-instruments/compass-sector/compass-sector.spec.ts +57 -0
- package/src/navigation-instruments/compass-sector/compass-sector.stories.ts +23 -0
- package/src/navigation-instruments/compass-sector/compass-sector.ts +127 -60
- package/src/navigation-instruments/gauge-radial/gauge-radial.css +3 -10
- package/src/navigation-instruments/rudder/rudder.css +27 -0
- package/src/navigation-instruments/rudder/rudder.ts +52 -22
- package/src/navigation-instruments/watch/watch.css +6 -0
- package/src/navigation-instruments/watch/watch.ts +16 -1
- package/src/svghelpers/arc-frame.ts +19 -5
- package/src/svghelpers/radial-frame.spec.ts +51 -0
- 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,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
|
@@ -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-
|
|
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-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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: {
|