@oicl/openbridge-webcomponents-full-bundle 2.1.0-next.6 → 2.1.0-next.7

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 (30) hide show
  1. package/.storybook/vitest.hidden-mount.setup.ts +96 -0
  2. package/bundle/openbridge-webcomponents.bundle.js +47 -8
  3. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  4. package/custom-elements.json +65 -3
  5. package/dist/ar/chart-object-vessel-button/chart-object-vessel-button.d.ts.map +1 -1
  6. package/dist/ar/chart-object-vessel-button/chart-object-vessel-button.js +1 -1
  7. package/dist/ar/chart-object-vessel-button/chart-object-vessel-button.js.map +1 -1
  8. package/dist/building-blocks/chart-line/chart-line-base.css.js +8 -0
  9. package/dist/building-blocks/chart-line/chart-line-base.css.js.map +1 -1
  10. package/dist/building-blocks/chart-line/chart-line-base.d.ts +3 -1
  11. package/dist/building-blocks/chart-line/chart-line-base.d.ts.map +1 -1
  12. package/dist/building-blocks/chart-line/chart-line-base.js +9 -4
  13. package/dist/building-blocks/chart-line/chart-line-base.js.map +1 -1
  14. package/dist/charthelpers/label-threshold.d.ts +7 -2
  15. package/dist/charthelpers/label-threshold.d.ts.map +1 -1
  16. package/dist/charthelpers/label-threshold.js +14 -2
  17. package/dist/charthelpers/label-threshold.js.map +1 -1
  18. package/dist/navigation-instruments/watch-flat/watch-flat.d.ts +8 -0
  19. package/dist/navigation-instruments/watch-flat/watch-flat.d.ts.map +1 -1
  20. package/dist/navigation-instruments/watch-flat/watch-flat.js +17 -1
  21. package/dist/navigation-instruments/watch-flat/watch-flat.js.map +1 -1
  22. package/package.json +2 -1
  23. package/src/ar/chart-object-vessel-button/chart-object-vessel-button.ts +3 -1
  24. package/src/building-blocks/chart-line/chart-line-base.css +8 -0
  25. package/src/building-blocks/chart-line/chart-line-base.ts +16 -5
  26. package/src/charthelpers/label-threshold.spec.ts +28 -0
  27. package/src/charthelpers/label-threshold.ts +16 -3
  28. package/src/navigation-instruments/rot-linear/rot-linear.spec.ts +36 -0
  29. package/src/navigation-instruments/watch-flat/watch-flat.spec.ts +76 -0
  30. package/src/navigation-instruments/watch-flat/watch-flat.ts +22 -1
@@ -8,9 +8,14 @@ import {
8
8
  unsafeCSS,
9
9
  } from 'lit';
10
10
  import {property} from 'lit/decorators.js';
11
+ import {ResizeController} from '@lit-labs/observers/resize-controller.js';
11
12
  import compentStyle from './watch-flat.css?inline';
12
13
  import {Tickmark, TickmarkStyle, tickmark} from './tickmark-flat.js';
13
14
  import {rect} from '../../svghelpers/rectangular.js';
15
+ import {
16
+ measureContainerPx,
17
+ observeInnerBox,
18
+ } from '../../svghelpers/radial-frame.js';
14
19
  import {Label} from '../compass-flat/compass-flat.js';
15
20
  import {customElement} from '../../decorator.js';
16
21
  import {Priority} from '../types.js';
@@ -113,6 +118,7 @@ export class ObcWatchFlat extends LitElement {
113
118
 
114
119
  private _legacyRotationsPerMinute = 0;
115
120
  private _rotController?: RateOfTurnController;
121
+ private _resizeController = new ResizeController(this, {});
116
122
 
117
123
  private get _effectiveRpm(): number {
118
124
  if (this.rateOfTurnDegreesPerMinute != null) {
@@ -123,6 +129,16 @@ export class ObcWatchFlat extends LitElement {
123
129
  return this._legacyRotationsPerMinute;
124
130
  }
125
131
 
132
+ /**
133
+ * Rendered px per user-space unit; the labels divide by it to keep their
134
+ * on-screen size. 1:1 while the strip has no width yet (hidden, or not laid
135
+ * out), until the ResizeController re-renders it.
136
+ */
137
+ private scaleFor(viewBoxWidth: number): number {
138
+ const scale = measureContainerPx(this).width / viewBoxWidth;
139
+ return Number.isFinite(scale) && scale > 0 ? scale : 1;
140
+ }
141
+
126
142
  private get totalHeight(): number {
127
143
  return this.bottomBar ? this.height + this.ticksHeight : this.height;
128
144
  }
@@ -390,6 +406,11 @@ export class ObcWatchFlat extends LitElement {
390
406
  : nothing;
391
407
  }
392
408
 
409
+ override firstUpdated(changed: PropertyValues): void {
410
+ super.firstUpdated(changed);
411
+ observeInnerBox(this._resizeController, this.renderRoot);
412
+ }
413
+
393
414
  override updated(changed: PropertyValues): void {
394
415
  super.updated(changed);
395
416
  const el = this.rotType
@@ -433,7 +454,7 @@ export class ObcWatchFlat extends LitElement {
433
454
  const width = (this.width / 2 + this.padding) * 2;
434
455
  const th = this.totalHeight;
435
456
  const viewBox = `-${width / 2} -${th / 2} ${width} ${th}`;
436
- const scale = this.clientWidth / width;
457
+ const scale = this.scaleFor(width);
437
458
 
438
459
  const contentOffsetY = this.bottomBar ? -this.ticksHeight / 2 : 0;
439
460