@oicl/openbridge-webcomponents 0.0.15-dev-20241112205851 → 0.0.15-dev-20241119201940

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. package/.storybook/main.ts +2 -1
  2. package/.storybook/manager.ts +16 -0
  3. package/.storybook/preview.ts +0 -1
  4. package/__snapshots__/building-blocks-poi-graphic-line--primary.png +0 -0
  5. package/__snapshots__/building-blocks-poi-line--primary.png +0 -0
  6. package/__snapshots__/navigation-instruments-azimuth-thruster--active-at-setpoint.png +0 -0
  7. package/__snapshots__/navigation-instruments-azimuth-thruster--active-no-setpoint.png +0 -0
  8. package/__snapshots__/navigation-instruments-azimuth-thruster--active.png +0 -0
  9. package/__snapshots__/navigation-instruments-azimuth-thruster--in-command-at-setpoint-disable-auto-setpoint.png +0 -0
  10. package/__snapshots__/navigation-instruments-azimuth-thruster--in-command-at-setpoint.png +0 -0
  11. package/__snapshots__/navigation-instruments-azimuth-thruster--in-command.png +0 -0
  12. package/__snapshots__/navigation-instruments-azimuth-thruster--loading.png +0 -0
  13. package/__snapshots__/navigation-instruments-azimuth-thruster--off.png +0 -0
  14. package/__snapshots__/navigation-instruments-azimuth-thruster--pod.png +0 -0
  15. package/__snapshots__/navigation-instruments-azimuth-thruster--single-direction-with-propeller.png +0 -0
  16. package/__snapshots__/navigation-instruments-azimuth-thruster--single-direction.png +0 -0
  17. package/__snapshots__/navigation-instruments-azimuth-thruster-labeled--large.png +0 -0
  18. package/__snapshots__/navigation-instruments-azimuth-thruster-labeled--medium.png +0 -0
  19. package/__snapshots__/navigation-instruments-azimuth-thruster-labeled--no-command.png +0 -0
  20. package/__snapshots__/navigation-instruments-compass--primary.png +0 -0
  21. package/__snapshots__/navigation-instruments-compass-flat--primary.png +0 -0
  22. package/__snapshots__/navigation-instruments-compass-flat--with-fov-indicator.png +0 -0
  23. package/__snapshots__/navigation-instruments-main-engine--active.png +0 -0
  24. package/__snapshots__/navigation-instruments-main-engine--in-command.png +0 -0
  25. package/__snapshots__/navigation-instruments-main-engine--off.png +0 -0
  26. package/__snapshots__/navigation-instruments-poi-target--primary.png +0 -0
  27. package/__snapshots__/navigation-instruments-rudder--primary.png +0 -0
  28. package/__snapshots__/navigation-instruments-thruster--active-at-setpoint.png +0 -0
  29. package/__snapshots__/navigation-instruments-thruster--active.png +0 -0
  30. package/__snapshots__/navigation-instruments-thruster--in-command-at-setpoint-manual.png +0 -0
  31. package/__snapshots__/navigation-instruments-thruster--in-command-at-setpoint.png +0 -0
  32. package/__snapshots__/navigation-instruments-thruster--in-command-touching.png +0 -0
  33. package/__snapshots__/navigation-instruments-thruster--in-command.png +0 -0
  34. package/__snapshots__/navigation-instruments-thruster--loading.png +0 -0
  35. package/__snapshots__/navigation-instruments-thruster--no-setpoint.png +0 -0
  36. package/__snapshots__/navigation-instruments-thruster--off.png +0 -0
  37. package/__snapshots__/navigation-instruments-thruster--pulling-pod.png +0 -0
  38. package/__snapshots__/navigation-instruments-thruster--pushing-pod.png +0 -0
  39. package/__snapshots__/navigation-instruments-thruster--single-direction-single-sided-with-advice.png +0 -0
  40. package/__snapshots__/navigation-instruments-thruster--single-direction.png +0 -0
  41. package/__snapshots__/navigation-instruments-thruster--single-sided-with-advice.png +0 -0
  42. package/__snapshots__/navigation-instruments-thruster--single-sided.png +0 -0
  43. package/__snapshots__/navigation-instruments-thruster--tunnel.png +0 -0
  44. package/custom-elements.json +19 -64
  45. package/dist/automation/automation-tank/automation-tank.d.ts +7 -0
  46. package/dist/automation/automation-tank/automation-tank.d.ts.map +1 -1
  47. package/dist/automation/automation-tank/automation-tank.js.map +1 -1
  48. package/dist/navigation-instruments/compass/compass.d.ts +7 -6
  49. package/dist/navigation-instruments/compass/compass.d.ts.map +1 -1
  50. package/dist/navigation-instruments/compass/compass.js +12 -33
  51. package/dist/navigation-instruments/compass/compass.js.map +1 -1
  52. package/dist/navigation-instruments/compass-flat/compass-flat.css.js +2 -1
  53. package/dist/navigation-instruments/compass-flat/compass-flat.css.js.map +1 -1
  54. package/dist/navigation-instruments/compass-flat/compass-flat.d.ts +6 -0
  55. package/dist/navigation-instruments/compass-flat/compass-flat.d.ts.map +1 -1
  56. package/dist/navigation-instruments/compass-flat/compass-flat.js +10 -2
  57. package/dist/navigation-instruments/compass-flat/compass-flat.js.map +1 -1
  58. package/dist/storybook-util.d.ts +1 -1
  59. package/dist/storybook-util.d.ts.map +1 -1
  60. package/dist/storybook-util.js +3 -28
  61. package/dist/storybook-util.js.map +1 -1
  62. package/package.json +14 -13
  63. package/src/automation/automation-button/automation-button.stories.ts +4 -0
  64. package/src/automation/automation-tank/automation-tank.ts +7 -0
  65. package/src/components/top-bar/top-bar.stories.ts +1 -0
  66. package/src/icons.stories.ts +3 -0
  67. package/src/navigation-instruments/azimuth-thruster/azimuth-thruster.stories.ts +3 -3
  68. package/src/navigation-instruments/azimuth-thruster-labeled/azimuth-thruster-labeled.stories.ts +3 -3
  69. package/src/navigation-instruments/compass/compass.stories.ts +3 -3
  70. package/src/navigation-instruments/compass/compass.ts +17 -27
  71. package/src/navigation-instruments/compass-flat/compass-flat.css +2 -1
  72. package/src/navigation-instruments/compass-flat/compass-flat.stories.ts +5 -4
  73. package/src/navigation-instruments/compass-flat/compass-flat.ts +13 -2
  74. package/src/navigation-instruments/main-engine/main-engine.stories.ts +3 -3
  75. package/src/navigation-instruments/poi-graphic-line/poi-graphic-line.stories.ts +2 -3
  76. package/src/navigation-instruments/poi-line/poi-line.stories.ts +1 -4
  77. package/src/navigation-instruments/poi-target/poi-target.stories.ts +1 -3
  78. package/src/navigation-instruments/rudder/rudder.stories.ts +3 -3
  79. package/src/navigation-instruments/thruster/thruster.stories.ts +3 -3
  80. package/src/storybook-util.ts +4 -29
@@ -1 +1 @@
1
- {"version":3,"file":"compass-flat.js","sources":["../../../src/navigation-instruments/compass-flat/compass-flat.ts"],"sourcesContent":["import {LitElement, svg, SVGTemplateResult, unsafeCSS} from 'lit';\nimport componentStyle from './compass-flat.css?inline';\nimport {customElement, property, state} from 'lit/decorators.js';\nimport {Tickmark, TickmarkType} from '../watch-flat/tickmark-flat';\nimport '../watch-flat/watch-flat';\n\nexport enum LabelPosition {\n top = -45,\n bottom = 50,\n}\n\nexport enum LabelStyle {\n regular = 'var(--instrument-tick-mark-secondary-color)',\n}\n\nexport interface Label {\n x: number;\n y: LabelPosition;\n text: string;\n}\n\n@customElement('obc-compass-flat')\nexport class ObcCompassFlat extends LitElement {\n @property({type: Boolean}) noPadding: boolean = true;\n @property({type: Boolean}) FOVIndicator: boolean = false;\n @property({type: Number}) padding: number = 16;\n @property({type: Number}) heading = 0;\n @property({type: Number}) courseOverGround = 0;\n @property({type: Number}) tickInterval = 5;\n @property({type: Number}) FOV = 45;\n @property({type: Number}) minFOV = 45;\n @property({type: Number}) maxFOV = 180;\n\n @state() containerWidth = 0;\n\n private resizeObserver: ResizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n this.containerWidth = entry.contentRect.width;\n }\n });\n\n override connectedCallback() {\n super.connectedCallback();\n this.resizeObserver.observe(this);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.resizeObserver.unobserve(this);\n }\n\n generateLabels() {\n if (this.containerWidth < 192) {\n return [];\n } else if (this.containerWidth <= 300) {\n return [\n {x: -180, y: LabelPosition.top, text: 'S'},\n {x: -90, y: LabelPosition.top, text: 'W'},\n {x: 0, y: LabelPosition.top, text: 'N'},\n {x: 90, y: LabelPosition.top, text: 'E'},\n {x: 180, y: LabelPosition.top, text: 'S'},\n {x: 270, y: LabelPosition.top, text: 'W'},\n {x: 360, y: LabelPosition.top, text: 'N'},\n {x: 450, y: LabelPosition.top, text: 'E'},\n {x: 540, y: LabelPosition.top, text: 'S'},\n ];\n } else {\n return [\n {x: -180, y: LabelPosition.top, text: 'S'},\n {x: -135, y: LabelPosition.top, text: 'SW'},\n {x: -90, y: LabelPosition.top, text: 'W'},\n {x: -45, y: LabelPosition.top, text: 'NW'},\n {x: 0, y: LabelPosition.top, text: 'N'},\n {x: 45, y: LabelPosition.top, text: 'NE'},\n {x: 90, y: LabelPosition.top, text: 'E'},\n {x: 135, y: LabelPosition.top, text: 'SE'},\n {x: 180, y: LabelPosition.top, text: 'S'},\n {x: 225, y: LabelPosition.top, text: 'SW'},\n {x: 270, y: LabelPosition.top, text: 'W'},\n {x: 315, y: LabelPosition.top, text: 'NW'},\n {x: 360, y: LabelPosition.top, text: 'N'},\n {x: 405, y: LabelPosition.top, text: 'NE'},\n {x: 450, y: LabelPosition.top, text: 'E'},\n {x: 495, y: LabelPosition.top, text: 'SE'},\n {x: 540, y: LabelPosition.top, text: 'S'},\n ];\n }\n }\n\n private generateIntervalTickmarks(scale: number): Tickmark[] {\n const tickmarks: Tickmark[] = [];\n let cardinalInterval = 90;\n\n if (this.containerWidth > 300) {\n cardinalInterval = 45;\n } else if (this.containerWidth < 192) {\n cardinalInterval = 0;\n }\n\n for (\n let angle = -180;\n angle < this.maxFOV * 3;\n angle += this.tickInterval\n ) {\n if (cardinalInterval !== 0 && angle % cardinalInterval === 0) {\n continue;\n }\n tickmarks.push({angle: angle * scale, type: TickmarkType.secondary});\n }\n\n return tickmarks;\n }\n\n private generateCardinalTickmarks(\n scale: number,\n labels: Label[]\n ): Tickmark[] {\n const tickmarks: Tickmark[] = [];\n\n for (const label of labels) {\n tickmarks.push({angle: label.x * scale, type: TickmarkType.main});\n }\n\n return tickmarks;\n }\n\n private generateTickmarks(scale: number, labels: Label[]): Tickmark[] {\n return [\n ...this.generateCardinalTickmarks(scale, labels),\n ...this.generateIntervalTickmarks(scale),\n ];\n }\n\n private renderFOVIndicator(): SVGTemplateResult[] {\n const indicators: SVGTemplateResult[] = [];\n\n const maxAdjustment = 10;\n const minContainerWidth = 300;\n const maxContainerWidth = 512;\n\n let yAdjustment = 0;\n if (this.containerWidth < maxContainerWidth) {\n const widthRange = maxContainerWidth - minContainerWidth;\n const scaleFactor =\n (maxContainerWidth - this.containerWidth) / widthRange;\n yAdjustment = scaleFactor * maxAdjustment;\n }\n\n const y = LabelPosition.bottom + yAdjustment;\n\n indicators.push(svg`\n <text x=\"-175\" y=${y} class=\"label left\" fill=${LabelStyle.regular}>\n ${-this.FOV}\\u00B0\n </text>`);\n\n indicators.push(svg`\n <text x=\"0\" y=${y} class=\"label\" fill=${LabelStyle.regular}>\n ${this.heading}\\u00B0\n </text>`);\n\n indicators.push(svg`\n <text x=\"175\" y=${y} class=\"label right\" fill=${LabelStyle.regular}>\n ${this.FOV}\\u00B0\n </text>`);\n\n return indicators;\n }\n\n private get HDGSvg(): SVGTemplateResult {\n return svg`<g transform=\"translate(-24, -74)\">\n <path d=\"M36.7011 44.1445L36.6898 44.1379L36.6781 44.1318L24.2301 37.6823L24.0001 37.5631L23.7701 37.6823L11.3221 44.1318L11.3104 44.1379L11.2991 44.1445C9.25497 45.3438 6.78661 43.308 7.68828 41.0919L22.6036 4.43285C23.1096 3.18905 24.8906 3.18905 25.3967 4.43284L40.3119 41.0919C41.2136 43.308 38.7452 45.3438 36.7011 44.1445Z\" fill=\"var(--instrument-enhanced-secondary-color)\" stroke=\"var(--border-silhouette-color)\"/>\n </g>`;\n }\n\n private COGSvg(translation: number): SVGTemplateResult {\n return svg`\n <g transform=\"translate(${-24 + translation}, -74)\">\n <path d=\"M31.9025 36.0262L33.1068 36.6502L32.5956 35.3938L24.4632 15.406L24.0001 14.2677L23.537 15.406L15.4046 35.3938L14.8935 36.6502L16.0978 36.0262L24.0001 31.9319L31.9025 36.0262ZM36.7011 44.1445L36.6898 44.1379L36.6781 44.1318L24.2301 37.6823L24.0001 37.5631L23.7701 37.6823L11.3221 44.1318L11.3104 44.1379L11.2991 44.1445C9.25497 45.3438 6.78661 43.308 7.68828 41.0919L22.6036 4.43285C23.1096 3.18905 24.8906 3.18905 25.3967 4.43284L40.3119 41.0919C41.2136 43.308 38.7452 45.3438 36.7011 44.1445Z\" fill=\"var(--instrument-enhanced-secondary-color)\" stroke=\"var(--border-silhouette-color)\"/>\n </g>\n `;\n }\n\n override render() {\n let angleDiff = this.courseOverGround - this.heading;\n\n if (angleDiff > this.maxFOV) {\n angleDiff -= 360;\n } else if (angleDiff < -this.maxFOV) {\n angleDiff += 360;\n }\n\n this.FOV = Math.max(this.minFOV, Math.abs(angleDiff));\n\n const baseOffset = 5;\n const translationScale = (baseOffset * 35) / this.FOV;\n\n const translation = angleDiff * translationScale;\n const labels = this.generateLabels();\n const tickmarks = this.generateTickmarks(translationScale, labels);\n const scaledLabels = labels.map((l) => ({\n ...l,\n x: l.x * translationScale,\n }));\n\n const viewBox = this.noPadding ? '-192 -128 384 128' : '-200 -144 400 144';\n\n return svg`\n <div class=\"container\">\n <obc-watch-flat .noPadding=${this.noPadding} .FOVIndicator=${this.FOVIndicator ? this.renderFOVIndicator() : []} .labels=${scaledLabels} .rotation=${this.heading} .tickmarks=${tickmarks} .tickmarkSpacing=${translationScale}></obc-watch-flat>\n <svg viewBox=${viewBox} xmlns=\"http://www.w3.org/2000/svg\"> \n ${this.HDGSvg}${this.COGSvg(translation)}\n </div>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-compass-flat': ObcCompassFlat;\n }\n}\n"],"names":["LabelPosition","LabelStyle"],"mappings":";;;;;;;;;;;;;;;;AAMY,IAAA,kCAAAA,mBAAL;AACLA,iBAAAA,eAAA,SAAM,GAAN,IAAA;AACAA,iBAAAA,eAAA,YAAS,EAAT,IAAA;AAFUA,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;AAKA,IAAA,+BAAAC,gBAAL;AACLA,cAAA,SAAU,IAAA;AADAA,SAAAA;AAAA,GAAA,cAAA,CAAA,CAAA;AAWC,IAAA,iBAAN,cAA6B,WAAW;AAAA,EAAxC,cAAA;AAAA,UAAA,GAAA,SAAA;AAC2C,SAAA,YAAA;AACG,SAAA,eAAA;AACP,SAAA,UAAA;AACR,SAAA,UAAA;AACS,SAAA,mBAAA;AACJ,SAAA,eAAA;AACT,SAAA,MAAA;AACG,SAAA,SAAA;AACA,SAAA,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AS,EAAC,MAAM,QAAO;AAAA,GARb,eAQe,WAAA,UAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GATb,eASe,WAAA,UAAA,CAAA;AAEjB,gBAAA;AAAA,EAAR,MAAM;AAAA,GAXI,eAWF,WAAA,kBAAA,CAAA;AAXE,iBAAN,gBAAA;AAAA,EADN,cAAc,kBAAkB;AAAA,GACpB,cAAA;"}
1
+ {"version":3,"file":"compass-flat.js","sources":["../../../src/navigation-instruments/compass-flat/compass-flat.ts"],"sourcesContent":["import {LitElement, svg, SVGTemplateResult, unsafeCSS} from 'lit';\nimport componentStyle from './compass-flat.css?inline';\nimport {customElement, property, state} from 'lit/decorators.js';\nimport {Tickmark, TickmarkType} from '../watch-flat/tickmark-flat';\nimport '../watch-flat/watch-flat';\n\nexport enum LabelPosition {\n top = -45,\n bottom = 50,\n}\n\nexport enum LabelStyle {\n regular = 'var(--instrument-tick-mark-secondary-color)',\n}\n\nexport interface Label {\n x: number;\n y: LabelPosition;\n text: string;\n}\n\n/**\n *\n * @ignition-base-height: 170px\n * @ignition-base-width: 512px\n */\n@customElement('obc-compass-flat')\nexport class ObcCompassFlat extends LitElement {\n @property({type: Boolean}) noPadding: boolean = true;\n @property({type: Boolean}) FOVIndicator: boolean = false;\n @property({type: Number}) padding: number = 16;\n @property({type: Number}) heading = 0;\n @property({type: Number}) courseOverGround = 0;\n @property({type: Number}) tickInterval = 5;\n @property({type: Number}) FOV = 45;\n @property({type: Number}) minFOV = 45;\n @property({type: Number}) maxFOV = 180;\n\n @state() containerWidth = 0;\n @state() maxContainerWidth = 0;\n\n private resizeObserver: ResizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n // Made by chatGPT so that the text is inside the wrapper\n this.maxContainerWidth = -125.36 + 3.79 * entry.contentRect.height;\n this.containerWidth = Math.min(\n entry.contentRect.width,\n this.maxContainerWidth\n );\n }\n });\n\n override connectedCallback() {\n super.connectedCallback();\n this.resizeObserver.observe(this);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.resizeObserver.unobserve(this);\n }\n\n generateLabels() {\n if (this.containerWidth < 192) {\n return [];\n } else if (this.containerWidth <= 300) {\n return [\n {x: -180, y: LabelPosition.top, text: 'S'},\n {x: -90, y: LabelPosition.top, text: 'W'},\n {x: 0, y: LabelPosition.top, text: 'N'},\n {x: 90, y: LabelPosition.top, text: 'E'},\n {x: 180, y: LabelPosition.top, text: 'S'},\n {x: 270, y: LabelPosition.top, text: 'W'},\n {x: 360, y: LabelPosition.top, text: 'N'},\n {x: 450, y: LabelPosition.top, text: 'E'},\n {x: 540, y: LabelPosition.top, text: 'S'},\n ];\n } else {\n return [\n {x: -180, y: LabelPosition.top, text: 'S'},\n {x: -135, y: LabelPosition.top, text: 'SW'},\n {x: -90, y: LabelPosition.top, text: 'W'},\n {x: -45, y: LabelPosition.top, text: 'NW'},\n {x: 0, y: LabelPosition.top, text: 'N'},\n {x: 45, y: LabelPosition.top, text: 'NE'},\n {x: 90, y: LabelPosition.top, text: 'E'},\n {x: 135, y: LabelPosition.top, text: 'SE'},\n {x: 180, y: LabelPosition.top, text: 'S'},\n {x: 225, y: LabelPosition.top, text: 'SW'},\n {x: 270, y: LabelPosition.top, text: 'W'},\n {x: 315, y: LabelPosition.top, text: 'NW'},\n {x: 360, y: LabelPosition.top, text: 'N'},\n {x: 405, y: LabelPosition.top, text: 'NE'},\n {x: 450, y: LabelPosition.top, text: 'E'},\n {x: 495, y: LabelPosition.top, text: 'SE'},\n {x: 540, y: LabelPosition.top, text: 'S'},\n ];\n }\n }\n\n private generateIntervalTickmarks(scale: number): Tickmark[] {\n const tickmarks: Tickmark[] = [];\n let cardinalInterval = 90;\n\n if (this.containerWidth > 300) {\n cardinalInterval = 45;\n } else if (this.containerWidth < 192) {\n cardinalInterval = 0;\n }\n\n for (\n let angle = -180;\n angle < this.maxFOV * 3;\n angle += this.tickInterval\n ) {\n if (cardinalInterval !== 0 && angle % cardinalInterval === 0) {\n continue;\n }\n tickmarks.push({angle: angle * scale, type: TickmarkType.secondary});\n }\n\n return tickmarks;\n }\n\n private generateCardinalTickmarks(\n scale: number,\n labels: Label[]\n ): Tickmark[] {\n const tickmarks: Tickmark[] = [];\n\n for (const label of labels) {\n tickmarks.push({angle: label.x * scale, type: TickmarkType.main});\n }\n\n return tickmarks;\n }\n\n private generateTickmarks(scale: number, labels: Label[]): Tickmark[] {\n return [\n ...this.generateCardinalTickmarks(scale, labels),\n ...this.generateIntervalTickmarks(scale),\n ];\n }\n\n private renderFOVIndicator(): SVGTemplateResult[] {\n const indicators: SVGTemplateResult[] = [];\n\n const maxAdjustment = 10;\n const minContainerWidth = 300;\n const maxContainerWidth = 512;\n\n let yAdjustment = 0;\n if (this.containerWidth < maxContainerWidth) {\n const widthRange = maxContainerWidth - minContainerWidth;\n const scaleFactor =\n (maxContainerWidth - this.containerWidth) / widthRange;\n yAdjustment = scaleFactor * maxAdjustment;\n }\n\n const y = LabelPosition.bottom + yAdjustment;\n\n indicators.push(svg`\n <text x=\"-175\" y=${y} class=\"label left\" fill=${LabelStyle.regular}>\n ${-this.FOV}\\u00B0\n </text>`);\n\n indicators.push(svg`\n <text x=\"0\" y=${y} class=\"label\" fill=${LabelStyle.regular}>\n ${this.heading}\\u00B0\n </text>`);\n\n indicators.push(svg`\n <text x=\"175\" y=${y} class=\"label right\" fill=${LabelStyle.regular}>\n ${this.FOV}\\u00B0\n </text>`);\n\n return indicators;\n }\n\n private get HDGSvg(): SVGTemplateResult {\n return svg`<g transform=\"translate(-24, -74)\">\n <path d=\"M36.7011 44.1445L36.6898 44.1379L36.6781 44.1318L24.2301 37.6823L24.0001 37.5631L23.7701 37.6823L11.3221 44.1318L11.3104 44.1379L11.2991 44.1445C9.25497 45.3438 6.78661 43.308 7.68828 41.0919L22.6036 4.43285C23.1096 3.18905 24.8906 3.18905 25.3967 4.43284L40.3119 41.0919C41.2136 43.308 38.7452 45.3438 36.7011 44.1445Z\" fill=\"var(--instrument-enhanced-secondary-color)\" stroke=\"var(--border-silhouette-color)\"/>\n </g>`;\n }\n\n private COGSvg(translation: number): SVGTemplateResult {\n return svg`\n <g transform=\"translate(${-24 + translation}, -74)\">\n <path d=\"M31.9025 36.0262L33.1068 36.6502L32.5956 35.3938L24.4632 15.406L24.0001 14.2677L23.537 15.406L15.4046 35.3938L14.8935 36.6502L16.0978 36.0262L24.0001 31.9319L31.9025 36.0262ZM36.7011 44.1445L36.6898 44.1379L36.6781 44.1318L24.2301 37.6823L24.0001 37.5631L23.7701 37.6823L11.3221 44.1318L11.3104 44.1379L11.2991 44.1445C9.25497 45.3438 6.78661 43.308 7.68828 41.0919L22.6036 4.43285C23.1096 3.18905 24.8906 3.18905 25.3967 4.43284L40.3119 41.0919C41.2136 43.308 38.7452 45.3438 36.7011 44.1445Z\" fill=\"var(--instrument-enhanced-secondary-color)\" stroke=\"var(--border-silhouette-color)\"/>\n </g>\n `;\n }\n\n override render() {\n let angleDiff = this.courseOverGround - this.heading;\n\n if (angleDiff > this.maxFOV) {\n angleDiff -= 360;\n } else if (angleDiff < -this.maxFOV) {\n angleDiff += 360;\n }\n\n this.FOV = Math.max(this.minFOV, Math.abs(angleDiff));\n\n const baseOffset = 5;\n const translationScale = (baseOffset * 35) / this.FOV;\n\n const translation = angleDiff * translationScale;\n const labels = this.generateLabels();\n const tickmarks = this.generateTickmarks(translationScale, labels);\n const scaledLabels = labels.map((l) => ({\n ...l,\n x: l.x * translationScale,\n }));\n\n const viewBox = this.noPadding ? '-192 -128 384 128' : '-200 -144 400 144';\n\n return svg`\n <div class=\"container\" style=\"max-width:${this.maxContainerWidth}px\">\n <obc-watch-flat .noPadding=${this.noPadding} .FOVIndicator=${this.FOVIndicator ? this.renderFOVIndicator() : []} .labels=${scaledLabels} .rotation=${this.heading} .tickmarks=${tickmarks} .tickmarkSpacing=${translationScale}></obc-watch-flat>\n <svg viewBox=${viewBox} xmlns=\"http://www.w3.org/2000/svg\"> \n ${this.HDGSvg}${this.COGSvg(translation)}\n </div>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-compass-flat': ObcCompassFlat;\n }\n}\n"],"names":["LabelPosition","LabelStyle"],"mappings":";;;;;;;;;;;;;;;;AAMY,IAAA,kCAAAA,mBAAL;AACLA,iBAAAA,eAAA,SAAM,GAAN,IAAA;AACAA,iBAAAA,eAAA,YAAS,EAAT,IAAA;AAFUA,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;AAKA,IAAA,+BAAAC,gBAAL;AACLA,cAAA,SAAU,IAAA;AADAA,SAAAA;AAAA,GAAA,cAAA,CAAA,CAAA;AAgBC,IAAA,iBAAN,cAA6B,WAAW;AAAA,EAAxC,cAAA;AAAA,UAAA,GAAA,SAAA;AAC2C,SAAA,YAAA;AACG,SAAA,eAAA;AACP,SAAA,UAAA;AACR,SAAA,UAAA;AACS,SAAA,mBAAA;AACJ,SAAA,eAAA;AACT,SAAA,MAAA;AACG,SAAA,SAAA;AACA,SAAA,SAAA;AAET,SAAA,iBAAA;AACG,SAAA,oBAAA;AAE7B,SAAQ,iBAAiC,IAAI,eAAe,CAAC,YAAY;AACvE,iBAAW,SAAS,SAAS;AAE3B,aAAK,oBAAoB,UAAU,OAAO,MAAM,YAAY;AAC5D,aAAK,iBAAiB,KAAK;AAAA,UACzB,MAAM,YAAY;AAAA,UAClB,KAAK;AAAA,QAAA;AAAA,MAET;AAAA,IAAA,CACD;AAAA,EAAA;AAAA,EAEQ,oBAAoB;AAC3B,UAAM,kBAAkB;AACnB,SAAA,eAAe,QAAQ,IAAI;AAAA,EAClC;AAAA,EAES,uBAAuB;AAC9B,UAAM,qBAAqB;AACtB,SAAA,eAAe,UAAU,IAAI;AAAA,EACpC;AAAA,EAEA,iBAAiB;AACX,QAAA,KAAK,iBAAiB,KAAK;AAC7B,aAAO;IAAC,WACC,KAAK,kBAAkB,KAAK;AAC9B,aAAA;AAAA,QACL,EAAC,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AAqB,gBAAgB;AAAA,uBAC/M,OAAO;AAAA,UACpB,KAAK,MAAM,GAAG,KAAK,OAAO,WAAW,CAAC;AAAA;AAAA;AAAA,EAG9C;AAGF;AAxMa,eAuMK,SAAS,UAAU,cAAc;AAtMtB,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,SAAQ;AAAA,GADd,eACgB,WAAA,aAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,SAAQ;AAAA,GAFd,eAEgB,WAAA,gBAAA,CAAA;AACD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GAHb,eAGe,WAAA,WAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GAJb,eAIe,WAAA,WAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GALb,eAKe,WAAA,oBAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GANb,eAMe,WAAA,gBAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GAPb,eAOe,WAAA,OAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GARb,eAQe,WAAA,UAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,QAAO;AAAA,GATb,eASe,WAAA,UAAA,CAAA;AAEjB,gBAAA;AAAA,EAAR,MAAM;AAAA,GAXI,eAWF,WAAA,kBAAA,CAAA;AACA,gBAAA;AAAA,EAAR,MAAM;AAAA,GAZI,eAYF,WAAA,qBAAA,CAAA;AAZE,iBAAN,gBAAA;AAAA,EADN,cAAc,kBAAkB;AAAA,GACpB,cAAA;"}
@@ -12,7 +12,7 @@ export declare function crossDecorator(story: () => unknown): HTMLTemplateResult
12
12
  export declare function widthDecorator(story: () => unknown, context: {
13
13
  args: {
14
14
  width: number;
15
+ height?: number;
15
16
  };
16
17
  }): HTMLTemplateResult;
17
- export declare function beta6Decorator(story: () => unknown): HTMLTemplateResult;
18
18
  //# sourceMappingURL=storybook-util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"storybook-util.d.ts","sourceRoot":"","sources":["../src/storybook-util.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AACrC,OAAO,wBAAwB,CAAC;AAChC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,gCAAgC,CAAC;AACxC,OAAO,iCAAiC,CAAC;AACzC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAC,kBAAkB,EAAE,cAAc,EAAO,MAAM,KAAK,CAAC;AAG7D,eAAO,MAAM,OAAO,UAQZ,CAAC;AAET,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,MAAM,EACV,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACtC,cAAc,CAyBhB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,OAAO,GAAG,kBAAkB,CAsCvE;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,OAAO,EACpB,OAAO,EAAE;IAAC,IAAI,EAAE;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAA;CAAC,GAC/B,kBAAkB,CAOpB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,OAAO,GAAG,kBAAkB,CAyBvE"}
1
+ {"version":3,"file":"storybook-util.d.ts","sourceRoot":"","sources":["../src/storybook-util.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AACrC,OAAO,wBAAwB,CAAC;AAChC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,gCAAgC,CAAC;AACxC,OAAO,iCAAiC,CAAC;AACzC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAC,kBAAkB,EAAE,cAAc,EAAO,MAAM,KAAK,CAAC;AAG7D,eAAO,MAAM,OAAO,UAQZ,CAAC;AAET,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,MAAM,EACV,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACtC,cAAc,CAyBhB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,OAAO,GAAG,kBAAkB,CAsCvE;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,OAAO,EACpB,OAAO,EAAE;IAAC,IAAI,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAC,CAAA;CAAC,GAChD,kBAAkB,CASpB"}
@@ -82,41 +82,16 @@ function crossDecorator(story) {
82
82
  <div class="wrapper">${story()}</div>`;
83
83
  }
84
84
  function widthDecorator(story, context) {
85
+ const width = context.args.width;
86
+ const height = context.args.height ?? width;
85
87
  return html` <div
86
88
  class="wrapper"
87
- style="width: ${context.args.width}px; height: ${context.args.width}px"
89
+ style="width: ${width}px; height: ${height}px"
88
90
  >
89
91
  ${story()}
90
92
  </div>`;
91
93
  }
92
- function beta6Decorator(story) {
93
- return html`
94
- <div
95
- style="
96
- border-radius: 100px;
97
- background-color: var(--instrument-enhanced-primary-color);
98
- color: var(--instrument-frame-primary-color);
99
- height: 32px;
100
- padding: 0 24px;
101
- box-sizing: border-box;
102
- width: fit-content;
103
- display: grid;
104
- place-content: center;
105
- font-family: 'Noto Sans';
106
- font-size: 16px;
107
- font-style: normal;
108
- font-weight: 570;
109
- line-height: 24px; /* 150% */
110
- margin-bottom: 64px;
111
- "
112
- >
113
- Beta 6.0
114
- </div>
115
- ${story()}
116
- `;
117
- }
118
94
  export {
119
- beta6Decorator,
120
95
  crossDecorator,
121
96
  iconIdToIconHtml,
122
97
  iconIds,
@@ -1 +1 @@
1
- {"version":3,"file":"storybook-util.js","sources":["../src/storybook-util.ts"],"sourcesContent":["import './icons/icon-01-placeholder';\nimport './icons/icon-01-search';\nimport './icons/icon-06-radar';\nimport './icons/icon-04-day';\nimport './icons/icon-04-brilliance-low';\nimport './icons/icon-04-brilliance-high';\nimport './icons/icon-06-ship';\nimport {HTMLTemplateResult, TemplateResult, html} from 'lit';\nimport {spread} from '@open-wc/lit-helpers';\n\nexport const iconIds = [\n '01-placeholder',\n '01-search',\n '04-brilliance-low',\n '04-brilliance-high',\n '06-radar',\n '04-day',\n '06-ship',\n].sort();\n\nexport function iconIdToIconHtml(\n id: string,\n attributes: Record<string, string> = {}\n): TemplateResult {\n switch (id) {\n case '01-placeholder':\n return html`<obi-01-placeholder\n ${spread(attributes)}\n ></obi-01-placeholder>`;\n case '01-search':\n return html`<obi-01-search ${spread(attributes)}></obi-01-search>`;\n case '04-day':\n return html`<obi-04-day ${spread(attributes)}></obi-04-day>`;\n case '04-brilliance-low':\n return html`<obi-04-brilliance-low\n ${spread(attributes)}\n ></obi-04-brilliance-low>`;\n case '04-brilliance-high':\n return html`<obi-04-brilliance-high\n ${spread(attributes)}\n ></obi-04-brilliance-high>`;\n case '06-radar':\n return html`<obi-06-radar ${spread(attributes)}></obi-06-radar>`;\n case '06-ship':\n return html`<obi-06-ship ${spread(attributes)}></obi-06-ship>`;\n default:\n throw new Error(`Unknown icon id: ${id}`);\n }\n}\n\nexport function crossDecorator(story: () => unknown): HTMLTemplateResult {\n return html` <style>\n .wrapper {\n width: 100%;\n height: 100vh;\n position: relative;\n }\n\n .wrapper > * {\n position: absolute;\n top: 50%;\n left: 50%;\n }\n\n .wrapper::before {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n bottom: 0;\n width: 1px;\n left: calc(50% - 0.5px);\n background-color: rgb(0, 0, 0, 0.3);\n }\n\n .wrapper::after {\n content: '';\n display: block;\n position: absolute;\n left: 0;\n right: 0;\n height: 1px;\n top: calc(50% - 0.5px);\n background-color: rgb(0, 0, 0, 0.3);\n z-index: -100;\n }\n </style>\n <div class=\"wrapper\">${story()}</div>`;\n}\n\nexport function widthDecorator(\n story: () => unknown,\n context: {args: {width: number}}\n): HTMLTemplateResult {\n return html` <div\n class=\"wrapper\"\n style=\"width: ${context.args.width}px; height: ${context.args.width}px\"\n >\n ${story()}\n </div>`;\n}\n\nexport function beta6Decorator(story: () => unknown): HTMLTemplateResult {\n return html`\n <div\n style=\"\n border-radius: 100px; \n background-color: var(--instrument-enhanced-primary-color); \n color: var(--instrument-frame-primary-color); \n height: 32px; \n padding: 0 24px; \n box-sizing: border-box; \n width: fit-content; \n display: grid; \n place-content: center;\n font-family: 'Noto Sans';\n font-size: 16px;\n font-style: normal;\n font-weight: 570;\n line-height: 24px; /* 150% */\n margin-bottom: 64px;\n\"\n >\n Beta 6.0\n </div>\n ${story()}\n `;\n}\n"],"names":[],"mappings":";;;;;;;;;AAUO,MAAM,UAAU;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK;AAEA,SAAS,iBACd,IACA,aAAqC,IACrB;AAChB,UAAQ,IAAI;AAAA,IACV,KAAK;AACI,aAAA;AAAA,UACH,OAAO,UAAU,CAAC;AAAA;AAAA,IAExB,KAAK;AACI,aAAA,sBAAsB,OAAO,UAAU,CAAC;AAAA,IACjD,KAAK;AACI,aAAA,mBAAmB,OAAO,UAAU,CAAC;AAAA,IAC9C,KAAK;AACI,aAAA;AAAA,UACH,OAAO,UAAU,CAAC;AAAA;AAAA,IAExB,KAAK;AACI,aAAA;AAAA,UACH,OAAO,UAAU,CAAC;AAAA;AAAA,IAExB,KAAK;AACI,aAAA,qBAAqB,OAAO,UAAU,CAAC;AAAA,IAChD,KAAK;AACI,aAAA,oBAAoB,OAAO,UAAU,CAAC;AAAA,IAC/C;AACE,YAAM,IAAI,MAAM,oBAAoB,EAAE,EAAE;AAAA,EAC5C;AACF;AAEO,SAAS,eAAe,OAA0C;AAChE,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAoCkB,OAAO;AAClC;AAEgB,SAAA,eACd,OACA,SACoB;AACb,SAAA;AAAA;AAAA,oBAEW,QAAQ,KAAK,KAAK,eAAe,QAAQ,KAAK,KAAK;AAAA;AAAA,MAEjE,OAAO;AAAA;AAEb;AAEO,SAAS,eAAe,OAA0C;AAChE,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAsBH,OAAO;AAAA;AAEb;"}
1
+ {"version":3,"file":"storybook-util.js","sources":["../src/storybook-util.ts"],"sourcesContent":["import './icons/icon-01-placeholder';\nimport './icons/icon-01-search';\nimport './icons/icon-06-radar';\nimport './icons/icon-04-day';\nimport './icons/icon-04-brilliance-low';\nimport './icons/icon-04-brilliance-high';\nimport './icons/icon-06-ship';\nimport {HTMLTemplateResult, TemplateResult, html} from 'lit';\nimport {spread} from '@open-wc/lit-helpers';\n\nexport const iconIds = [\n '01-placeholder',\n '01-search',\n '04-brilliance-low',\n '04-brilliance-high',\n '06-radar',\n '04-day',\n '06-ship',\n].sort();\n\nexport function iconIdToIconHtml(\n id: string,\n attributes: Record<string, string> = {}\n): TemplateResult {\n switch (id) {\n case '01-placeholder':\n return html`<obi-01-placeholder\n ${spread(attributes)}\n ></obi-01-placeholder>`;\n case '01-search':\n return html`<obi-01-search ${spread(attributes)}></obi-01-search>`;\n case '04-day':\n return html`<obi-04-day ${spread(attributes)}></obi-04-day>`;\n case '04-brilliance-low':\n return html`<obi-04-brilliance-low\n ${spread(attributes)}\n ></obi-04-brilliance-low>`;\n case '04-brilliance-high':\n return html`<obi-04-brilliance-high\n ${spread(attributes)}\n ></obi-04-brilliance-high>`;\n case '06-radar':\n return html`<obi-06-radar ${spread(attributes)}></obi-06-radar>`;\n case '06-ship':\n return html`<obi-06-ship ${spread(attributes)}></obi-06-ship>`;\n default:\n throw new Error(`Unknown icon id: ${id}`);\n }\n}\n\nexport function crossDecorator(story: () => unknown): HTMLTemplateResult {\n return html` <style>\n .wrapper {\n width: 100%;\n height: 100vh;\n position: relative;\n }\n\n .wrapper > * {\n position: absolute;\n top: 50%;\n left: 50%;\n }\n\n .wrapper::before {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n bottom: 0;\n width: 1px;\n left: calc(50% - 0.5px);\n background-color: rgb(0, 0, 0, 0.3);\n }\n\n .wrapper::after {\n content: '';\n display: block;\n position: absolute;\n left: 0;\n right: 0;\n height: 1px;\n top: calc(50% - 0.5px);\n background-color: rgb(0, 0, 0, 0.3);\n z-index: -100;\n }\n </style>\n <div class=\"wrapper\">${story()}</div>`;\n}\n\nexport function widthDecorator(\n story: () => unknown,\n context: {args: {width: number; height?: number}}\n): HTMLTemplateResult {\n const width = context.args.width;\n const height = context.args.height ?? width;\n return html` <div\n class=\"wrapper\"\n style=\"width: ${width}px; height: ${height}px\"\n >\n ${story()}\n </div>`;\n}\n"],"names":[],"mappings":";;;;;;;;;AAUO,MAAM,UAAU;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK;AAEA,SAAS,iBACd,IACA,aAAqC,IACrB;AAChB,UAAQ,IAAI;AAAA,IACV,KAAK;AACI,aAAA;AAAA,UACH,OAAO,UAAU,CAAC;AAAA;AAAA,IAExB,KAAK;AACI,aAAA,sBAAsB,OAAO,UAAU,CAAC;AAAA,IACjD,KAAK;AACI,aAAA,mBAAmB,OAAO,UAAU,CAAC;AAAA,IAC9C,KAAK;AACI,aAAA;AAAA,UACH,OAAO,UAAU,CAAC;AAAA;AAAA,IAExB,KAAK;AACI,aAAA;AAAA,UACH,OAAO,UAAU,CAAC;AAAA;AAAA,IAExB,KAAK;AACI,aAAA,qBAAqB,OAAO,UAAU,CAAC;AAAA,IAChD,KAAK;AACI,aAAA,oBAAoB,OAAO,UAAU,CAAC;AAAA,IAC/C;AACE,YAAM,IAAI,MAAM,oBAAoB,EAAE,EAAE;AAAA,EAC5C;AACF;AAEO,SAAS,eAAe,OAA0C;AAChE,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAoCkB,OAAO;AAClC;AAEgB,SAAA,eACd,OACA,SACoB;AACd,QAAA,QAAQ,QAAQ,KAAK;AACrB,QAAA,SAAS,QAAQ,KAAK,UAAU;AAC/B,SAAA;AAAA;AAAA,oBAEW,KAAK,eAAe,MAAM;AAAA;AAAA,MAExC,OAAO;AAAA;AAEb;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oicl/openbridge-webcomponents",
3
- "version": "0.0.15-dev-20241112205851",
3
+ "version": "0.0.15-dev-20241119201940",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,18 +42,18 @@
42
42
  "@lit-labs/gen-wrapper-vue": "^0.3.3",
43
43
  "@open-wc/lit-helpers": "^0.7.0",
44
44
  "@playwright/test": "^1.46.1",
45
- "@storybook/addon-essentials": "^8.2.9",
46
- "@storybook/addon-interactions": "^8.2.9",
47
- "@storybook/addon-links": "^8.2.9",
48
- "@storybook/addon-storysource": "^8.2.9",
49
- "@storybook/addon-themes": "^8.2.9",
50
- "@storybook/blocks": "^8.2.9",
51
- "@storybook/manager-api": "^8.2.9",
52
- "@storybook/test": "^8.2.9",
45
+ "@storybook/addon-essentials": "^8.4.4",
46
+ "@storybook/addon-interactions": "^8.4.4",
47
+ "@storybook/addon-links": "^8.4.4",
48
+ "@storybook/addon-storysource": "^8.4.4",
49
+ "@storybook/addon-themes": "^8.4.4",
50
+ "@storybook/blocks": "^8.4.4",
51
+ "@storybook/manager-api": "^8.4.4",
52
+ "@storybook/test": "^8.4.4",
53
53
  "@storybook/test-runner": "^0.17.0",
54
- "@storybook/theming": "^8.2.9",
55
- "@storybook/web-components": "^8.2.9",
56
- "@storybook/web-components-vite": "^8.2.9",
54
+ "@storybook/theming": "^8.4.4",
55
+ "@storybook/web-components": "^8.4.4",
56
+ "@storybook/web-components-vite": "^8.4.4",
57
57
  "@topcli/prompts": "^1.8.0",
58
58
  "@types/jest-image-snapshot": "^6",
59
59
  "@types/node": "^22.4.1",
@@ -72,7 +72,8 @@
72
72
  "prettier": "^3.1.1",
73
73
  "release-it": "^17.1.1",
74
74
  "rollup-plugin-postcss-lit": "^2.1.0",
75
- "storybook": "^8.2.9",
75
+ "storybook": "^8.4.4",
76
+ "storybook-addon-tag-badges": "^1.2.0",
76
77
  "tsx": "^4.7.1",
77
78
  "typescript": "^5.3.3",
78
79
  "vite": "^5.2.7",
@@ -70,6 +70,10 @@ const meta: Meta<typeof ObcAutomationButton> = {
70
70
  labelSize: 'regular',
71
71
  labelStyle: 'regular',
72
72
  },
73
+ parameters: {
74
+ // Overrides the default behavior and pauses the animation at the first frame at the component level for all stories.
75
+ chromatic: {pauseAnimationAtEnd: false},
76
+ },
73
77
  } satisfies Meta<ObcAutomationButton>;
74
78
 
75
79
  export default meta;
@@ -23,6 +23,13 @@ export enum TankVariant {
23
23
  compact = 'compact',
24
24
  }
25
25
 
26
+ /**
27
+ *
28
+ *
29
+ * @ignition-base-height: 173px
30
+ * @ignition-base-width: 168px
31
+ * @ignition-center
32
+ */
26
33
  @customElement('obc-automation-tank')
27
34
  export class ObcAutomationTank extends LitElement {
28
35
  @property({type: String}) medium: LineMedium = LineMedium.water;
@@ -16,6 +16,7 @@ const meta: Meta<typeof ObcTopBar> = {
16
16
  component: 'obc-top-bar',
17
17
  parameters: {
18
18
  layout: 'fullscreen',
19
+ chromatic: {pauseAnimationAtEnd: false},
19
20
  },
20
21
  args: {
21
22
  showAppsButton: true,
@@ -51,6 +51,9 @@ export const List: Story = {
51
51
  </div>
52
52
  `;
53
53
  },
54
+ parameters: {
55
+ chromatic: {disableSnapshot: true},
56
+ },
54
57
  };
55
58
 
56
59
  export const UseFontColor: Story = {
@@ -2,13 +2,13 @@ import type {Meta, StoryObj} from '@storybook/web-components';
2
2
  import {ObcAzimuthThruster} from './azimuth-thruster';
3
3
  import './azimuth-thruster';
4
4
  import {InstrumentState, Size} from '../types';
5
- import {beta6Decorator, widthDecorator} from '../../storybook-util';
5
+ import {widthDecorator} from '../../storybook-util';
6
6
  import {AdviceType} from '../watch/advice';
7
7
  import {PropellerType} from '../thruster/propeller';
8
8
 
9
9
  const meta: Meta<typeof ObcAzimuthThruster> = {
10
10
  title: 'Navigation instruments/Azimuth thruster',
11
- tags: ['autodocs'],
11
+ tags: ['autodocs', '6.0'],
12
12
  component: 'obc-azimuth-thruster',
13
13
  argTypes: {
14
14
  thrust: {control: {type: 'range', min: -100, max: 100, step: 1}},
@@ -32,7 +32,7 @@ const meta: Meta<typeof ObcAzimuthThruster> = {
32
32
  autoAtAngleSetpointDeadband: 2,
33
33
  thrustSetpointAtZeroDeadband: 0.1,
34
34
  },
35
- decorators: [widthDecorator, beta6Decorator],
35
+ decorators: [widthDecorator],
36
36
  } satisfies Meta<ObcAzimuthThruster>;
37
37
 
38
38
  export default meta;
@@ -6,12 +6,12 @@ import {
6
6
  import './azimuth-thruster-labeled';
7
7
  import {CommandStatus} from '../badge-command/badge-command';
8
8
  import {AdviceType} from '../watch/advice';
9
- import {beta6Decorator, widthDecorator} from '../../storybook-util';
9
+ import {widthDecorator} from '../../storybook-util';
10
10
  import {PropellerType} from '../thruster/propeller';
11
11
 
12
12
  const meta: Meta<typeof ObcAzimuthThrusterLabeled> = {
13
13
  title: 'Navigation instruments/Azimuth thruster labeled',
14
- tags: ['autodocs'],
14
+ tags: ['autodocs', '6.0'],
15
15
  component: 'obc-azimuth-thruster-labeled',
16
16
  args: {
17
17
  angle: 30,
@@ -29,7 +29,7 @@ const meta: Meta<typeof ObcAzimuthThrusterLabeled> = {
29
29
  {min: -100, max: -75, type: AdviceType.caution, hinted: true},
30
30
  ],
31
31
  },
32
- decorators: [widthDecorator, beta6Decorator],
32
+ decorators: [widthDecorator],
33
33
  argTypes: {
34
34
  commandStatus: {
35
35
  options: Object.values(CommandStatus),
@@ -1,12 +1,12 @@
1
1
  import type {Meta, StoryObj} from '@storybook/web-components';
2
2
  import {ObcCompass} from './compass';
3
3
  import './compass';
4
- import {beta6Decorator, widthDecorator} from '../../storybook-util';
4
+ import {widthDecorator} from '../../storybook-util';
5
5
  import {AdviceType} from '../watch/advice';
6
6
 
7
7
  const meta: Meta<typeof ObcCompass> = {
8
8
  title: 'Navigation Instruments/Compass',
9
- tags: ['autodocs'],
9
+ tags: ['autodocs', '6.0'],
10
10
  component: 'obc-compass',
11
11
  args: {
12
12
  width: 512,
@@ -26,7 +26,7 @@ const meta: Meta<typeof ObcCompass> = {
26
26
  heading: {control: {type: 'range', min: 0, max: 360, step: 1}},
27
27
  courseOverGround: {control: {type: 'range', min: 0, max: 360, step: 1}},
28
28
  },
29
- decorators: [widthDecorator, beta6Decorator],
29
+ decorators: [widthDecorator],
30
30
  } satisfies Meta<ObcCompass>;
31
31
 
32
32
  export default meta;
@@ -1,5 +1,5 @@
1
1
  import {LitElement, css, html} from 'lit';
2
- import {customElement, property, state} from 'lit/decorators.js';
2
+ import {customElement, property} from 'lit/decorators.js';
3
3
  import '../watch/watch';
4
4
  import {Tickmark, TickmarkType} from '../watch/tickmark';
5
5
  import {arrow, ArrowStyle} from './arrow';
@@ -10,37 +10,26 @@ import {
10
10
  AngleAdviceRaw,
11
11
  } from '../watch/advice';
12
12
  import {radialTickmarks} from './radial-tickmark';
13
+ import {ResizeController} from '@lit-labs/observers/resize-controller.js';
13
14
 
15
+ /**
16
+ *
17
+ * @ignition-base-height: 512px
18
+ * @ignition-base-width: 512px
19
+ */
14
20
  @customElement('obc-compass')
15
21
  export class ObcCompass extends LitElement {
16
22
  @property({type: Number}) heading = 0;
17
23
  @property({type: Number}) courseOverGround = 0;
18
- @property({type: Number}) padding = 48;
19
24
  @property({type: Array, attribute: false}) headingAdvices: AngleAdvice[] = [];
20
- @state() containerWidth = 0;
21
25
 
22
- private resizeObserver: ResizeObserver = new ResizeObserver((entries) => {
23
- for (const entry of entries) {
24
- this.containerWidth = Math.min(
25
- entry.contentRect.width,
26
- entry.contentRect.height
27
- );
28
- this.adjustPadding();
29
- }
30
- });
31
-
32
- override connectedCallback() {
33
- super.connectedCallback();
34
- this.resizeObserver.observe(this);
35
- }
36
-
37
- override disconnectedCallback() {
38
- super.disconnectedCallback();
39
- this.resizeObserver.unobserve(this);
40
- }
26
+ // @ts-expect-error TS6133: The controller ensures that the render
27
+ // function is called on resize of the element
28
+ private _resizeController = new ResizeController(this, {});
41
29
 
42
- private adjustPadding() {
43
- const deltaWidth = 512 - this.containerWidth;
30
+ private getPadding() {
31
+ const size = Math.min(this.clientHeight, this.clientWidth);
32
+ const deltaWidth = 512 - size;
44
33
  const steps = deltaWidth / 128;
45
34
  let deltaPadding = 0;
46
35
  if (deltaWidth > 0) {
@@ -49,7 +38,7 @@ export class ObcCompass extends LitElement {
49
38
  deltaPadding = steps * 6;
50
39
  }
51
40
 
52
- this.padding = 72 + deltaPadding;
41
+ return 72 + deltaPadding;
53
42
  }
54
43
 
55
44
  private get angleAdviceRaw(): AngleAdviceRaw[] {
@@ -80,13 +69,14 @@ export class ObcCompass extends LitElement {
80
69
  )
81
70
  );
82
71
 
83
- const width = (176 + this.padding) * 2;
72
+ const padding = this.getPadding();
73
+ const width = (176 + padding) * 2;
84
74
  const viewBox = `-${width / 2} -${width / 2} ${width} ${width}`;
85
75
 
86
76
  return html`
87
77
  <div class="container">
88
78
  <obc-watch
89
- .padding=${this.padding}
79
+ .padding=${padding}
90
80
  .advices=${this.angleAdviceRaw}
91
81
  .tickmarks=${tickmarks}
92
82
  .labelFrameEnabled=${true}
@@ -17,7 +17,8 @@
17
17
  }
18
18
 
19
19
  :host {
20
- display: block;
20
+ display: grid;
21
+ place-items: center;
21
22
  width: 100%;
22
23
  height: 100%;
23
24
  }
@@ -1,15 +1,15 @@
1
1
  import type {Meta, StoryObj} from '@storybook/web-components';
2
2
  import {ObcCompassFlat} from './compass-flat';
3
3
  import './compass-flat';
4
- import {beta6Decorator, widthDecorator} from '../../storybook-util';
5
- import {LabelPosition} from './compass-flat';
4
+ import {widthDecorator} from '../../storybook-util';
6
5
 
7
6
  const meta: Meta<typeof ObcCompassFlat> = {
8
7
  title: 'Navigation Instruments/Compass flat',
9
- tags: ['autodocs'],
8
+ tags: ['autodocs', '6.0'],
10
9
  component: 'obc-compass-flat',
11
10
  args: {
12
11
  width: 512,
12
+ height: 512,
13
13
  heading: 45,
14
14
  courseOverGround: 50,
15
15
  FOVIndicator: false,
@@ -17,10 +17,11 @@ const meta: Meta<typeof ObcCompassFlat> = {
17
17
  },
18
18
  argTypes: {
19
19
  width: {control: {type: 'range', min: 32, max: 1028, step: 1}},
20
+ height: {control: {type: 'range', min: 32, max: 1028, step: 1}},
20
21
  heading: {control: {type: 'range', min: 0, max: 360, step: 1}},
21
22
  courseOverGround: {control: {type: 'range', min: 0, max: 360, step: 1}},
22
23
  },
23
- decorators: [widthDecorator, beta6Decorator],
24
+ decorators: [widthDecorator],
24
25
  } satisfies Meta<ObcCompassFlat>;
25
26
 
26
27
  export default meta;
@@ -19,6 +19,11 @@ export interface Label {
19
19
  text: string;
20
20
  }
21
21
 
22
+ /**
23
+ *
24
+ * @ignition-base-height: 170px
25
+ * @ignition-base-width: 512px
26
+ */
22
27
  @customElement('obc-compass-flat')
23
28
  export class ObcCompassFlat extends LitElement {
24
29
  @property({type: Boolean}) noPadding: boolean = true;
@@ -32,10 +37,16 @@ export class ObcCompassFlat extends LitElement {
32
37
  @property({type: Number}) maxFOV = 180;
33
38
 
34
39
  @state() containerWidth = 0;
40
+ @state() maxContainerWidth = 0;
35
41
 
36
42
  private resizeObserver: ResizeObserver = new ResizeObserver((entries) => {
37
43
  for (const entry of entries) {
38
- this.containerWidth = entry.contentRect.width;
44
+ // Made by chatGPT so that the text is inside the wrapper
45
+ this.maxContainerWidth = -125.36 + 3.79 * entry.contentRect.height;
46
+ this.containerWidth = Math.min(
47
+ entry.contentRect.width,
48
+ this.maxContainerWidth
49
+ );
39
50
  }
40
51
  });
41
52
 
@@ -205,7 +216,7 @@ export class ObcCompassFlat extends LitElement {
205
216
  const viewBox = this.noPadding ? '-192 -128 384 128' : '-200 -144 400 144';
206
217
 
207
218
  return svg`
208
- <div class="container">
219
+ <div class="container" style="max-width:${this.maxContainerWidth}px">
209
220
  <obc-watch-flat .noPadding=${this.noPadding} .FOVIndicator=${this.FOVIndicator ? this.renderFOVIndicator() : []} .labels=${scaledLabels} .rotation=${this.heading} .tickmarks=${tickmarks} .tickmarkSpacing=${translationScale}></obc-watch-flat>
210
221
  <svg viewBox=${viewBox} xmlns="http://www.w3.org/2000/svg">
211
222
  ${this.HDGSvg}${this.COGSvg(translation)}
@@ -1,12 +1,12 @@
1
1
  import type {Meta, StoryObj} from '@storybook/web-components';
2
2
  import {ObcMainEngine} from './main-engine';
3
3
  import './main-engine';
4
- import {beta6Decorator, widthDecorator} from '../../storybook-util';
4
+ import {widthDecorator} from '../../storybook-util';
5
5
  import {InstrumentState} from '../types';
6
6
 
7
7
  const meta: Meta<typeof ObcMainEngine> = {
8
8
  title: 'Navigation instruments/Main Engine',
9
- tags: ['autodocs'],
9
+ tags: ['autodocs', '6.0'],
10
10
  component: 'obc-main-engine',
11
11
  args: {
12
12
  width: 352,
@@ -25,7 +25,7 @@ const meta: Meta<typeof ObcMainEngine> = {
25
25
  options: Object.values(InstrumentState),
26
26
  },
27
27
  },
28
- decorators: [widthDecorator, beta6Decorator],
28
+ decorators: [widthDecorator],
29
29
  } satisfies Meta<ObcMainEngine>;
30
30
 
31
31
  export default meta;
@@ -2,11 +2,10 @@ import type {Meta, StoryObj} from '@storybook/web-components';
2
2
  import {ObcPoiGraphicLine} from './poi-graphic-line';
3
3
  import './poi-graphic-line';
4
4
  import {POIStyle} from './poi-config';
5
- import {beta6Decorator} from '../../storybook-util';
6
5
 
7
6
  const meta: Meta<typeof ObcPoiGraphicLine> = {
8
7
  title: 'Building blocks/POI Graphic Line',
9
- tags: ['autodocs'],
8
+ tags: ['autodocs', '6.0'],
10
9
  component: 'obc-poi-graphic-line',
11
10
  argTypes: {
12
11
  lineStyle: {
@@ -22,7 +21,7 @@ const meta: Meta<typeof ObcPoiGraphicLine> = {
22
21
  height: 100,
23
22
  lineStyle: POIStyle.Enhanced,
24
23
  },
25
- decorators: [beta6Decorator],
24
+ decorators: [],
26
25
  } satisfies Meta<ObcPoiGraphicLine>;
27
26
 
28
27
  export default meta;
@@ -2,11 +2,10 @@ import type {Meta, StoryObj} from '@storybook/web-components';
2
2
  import {ObcPoiLine} from './poi-line';
3
3
  import './poi-line';
4
4
  import {POIStyle} from '../poi-graphic-line/poi-config';
5
- import {beta6Decorator} from '../../storybook-util';
6
5
 
7
6
  const meta: Meta<typeof ObcPoiLine> = {
8
7
  title: 'Building blocks/POI Line',
9
- tags: ['autodocs'],
8
+ tags: ['autodocs', '6.0'],
10
9
  component: 'obc-poi-line',
11
10
  argTypes: {
12
11
  lineStyle: {
@@ -19,8 +18,6 @@ const meta: Meta<typeof ObcPoiLine> = {
19
18
  lineStyle: POIStyle.Enhanced,
20
19
  height: 100,
21
20
  },
22
-
23
- decorators: [beta6Decorator],
24
21
  } satisfies Meta<ObcPoiLine>;
25
22
 
26
23
  export default meta;
@@ -1,11 +1,10 @@
1
1
  import type {Meta, StoryObj} from '@storybook/web-components';
2
2
  import {ObcPoiTarget, Pointer} from './poi-target';
3
3
  import './poi-target';
4
- import {beta6Decorator} from '../../storybook-util';
5
4
 
6
5
  const meta: Meta<typeof ObcPoiTarget> = {
7
6
  title: 'Navigation Instruments/POI Target',
8
- tags: ['autodocs'],
7
+ tags: ['autodocs', '6.0'],
9
8
  component: 'obc-poi-target',
10
9
  args: {
11
10
  height: 188,
@@ -32,7 +31,6 @@ const meta: Meta<typeof ObcPoiTarget> = {
32
31
  control: {type: 'range', min: 0, max: 360},
33
32
  },
34
33
  },
35
- decorators: [beta6Decorator],
36
34
  } satisfies Meta<ObcPoiTarget>;
37
35
 
38
36
  export default meta;
@@ -1,11 +1,11 @@
1
1
  import type {Meta, StoryObj} from '@storybook/web-components';
2
2
  import {ObcRudder} from './rudder';
3
3
  import './rudder';
4
- import {beta6Decorator, widthDecorator} from '../../storybook-util';
4
+ import {widthDecorator} from '../../storybook-util';
5
5
 
6
6
  const meta: Meta<typeof ObcRudder> = {
7
7
  title: 'Navigation Instruments/Rudder',
8
- tags: ['autodocs'],
8
+ tags: ['autodocs', '6.0'],
9
9
  component: 'obc-rudder',
10
10
  args: {
11
11
  width: 512,
@@ -19,7 +19,7 @@ const meta: Meta<typeof ObcRudder> = {
19
19
  maxAngle: {control: {type: 'range', min: 1, max: 90, step: 1}},
20
20
  setpoint: {control: {type: 'range', min: -90, max: 90, step: 1}},
21
21
  },
22
- decorators: [widthDecorator, beta6Decorator],
22
+ decorators: [widthDecorator],
23
23
  } satisfies Meta<ObcRudder>;
24
24
 
25
25
  export default meta;
@@ -2,13 +2,13 @@ import type {Meta, StoryObj} from '@storybook/web-components';
2
2
  import {ObcThruster} from './thruster';
3
3
  import './thruster';
4
4
  import {InstrumentState} from '../types';
5
- import {beta6Decorator, widthDecorator} from '../../storybook-util';
5
+ import {widthDecorator} from '../../storybook-util';
6
6
  import {AdviceType} from '../watch/advice';
7
7
  import {PropellerType} from './propeller';
8
8
 
9
9
  const meta: Meta<typeof ObcThruster> = {
10
10
  title: 'Navigation instruments/Thruster',
11
- tags: ['autodocs'],
11
+ tags: ['autodocs', '6.0'],
12
12
  component: 'obc-thruster',
13
13
  args: {width: 320},
14
14
  argTypes: {
@@ -25,7 +25,7 @@ const meta: Meta<typeof ObcThruster> = {
25
25
  options: Object.values(PropellerType),
26
26
  },
27
27
  },
28
- decorators: [widthDecorator, beta6Decorator],
28
+ decorators: [widthDecorator],
29
29
  } satisfies Meta<ObcThruster>;
30
30
 
31
31
  export default meta;