@oicl/openbridge-webcomponents 2.0.0-next.127 → 2.0.0-next.128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/openbridge-webcomponents.bundle.js +55 -11
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +33 -3
- package/dist/building-blocks/chart-line/chart-line-base.d.ts +10 -2
- package/dist/building-blocks/chart-line/chart-line-base.d.ts.map +1 -1
- package/dist/building-blocks/chart-line/chart-line-base.js +27 -8
- package/dist/building-blocks/chart-line/chart-line-base.js.map +1 -1
- package/dist/charthelpers/chart-common.css.js +28 -3
- package/dist/charthelpers/chart-common.css.js.map +1 -1
- package/package.json +1 -1
|
@@ -20349,11 +20349,36 @@ canvas {
|
|
|
20349
20349
|
display: block;
|
|
20350
20350
|
}
|
|
20351
20351
|
|
|
20352
|
-
/* Fixed aspect ratio scaling mode: canvas
|
|
20352
|
+
/* Fixed aspect ratio scaling mode: the canvas container must be a definite
|
|
20353
|
+
box, not shrink-to-fit. The wrapper is a column flex with align-items:
|
|
20354
|
+
center, so the container would otherwise size to the canvas' max-content
|
|
20355
|
+
width — and a canvas with an auto width and a definite height resolves
|
|
20356
|
+
against its intrinsic 2:1 ratio, capping the chart at height * 2. */
|
|
20353
20357
|
|
|
20354
|
-
:host([fixedaspectratioscaling]) canvas {
|
|
20358
|
+
:host([fixedaspectratioscaling]) .canvas-and-slots-container {
|
|
20355
20359
|
width: 100%;
|
|
20356
|
-
|
|
20360
|
+
}
|
|
20361
|
+
|
|
20362
|
+
/* Fixed aspect ratio scaling mode: canvas fills wrapper.
|
|
20363
|
+
|
|
20364
|
+
\`!important\` is load-bearing, not a shortcut. Chart.js measures the
|
|
20365
|
+
container with getBoundingClientRect() — which is scaled by any ancestor
|
|
20366
|
+
CSS \`zoom\` — and writes that number straight back as an inline
|
|
20367
|
+
\`style="width/height: Npx"\`. The browser then scales that CSS-pixel value
|
|
20368
|
+
by the same zoom a second time, so the canvas lands at zoom² of its cell
|
|
20369
|
+
(64% at zoom 0.8, 156% at zoom 1.25). Overriding the inline style pins the
|
|
20370
|
+
canvas to the box the layout actually gave it at every zoom level; Chart.js
|
|
20371
|
+
keeps using its own measurement for the drawing buffer, which only affects
|
|
20372
|
+
raster resolution, not geometry.
|
|
20373
|
+
|
|
20374
|
+
No auto margins here either: Chart.js subtracts the canvas' resolved
|
|
20375
|
+
margins from the container width, so centring it with \`margin: 0 auto\`
|
|
20376
|
+
makes the leftover space permanently unavailable to it. */
|
|
20377
|
+
|
|
20378
|
+
:host([fixedaspectratioscaling]) canvas {
|
|
20379
|
+
width: 100% !important;
|
|
20380
|
+
height: var(--chart-height, auto) !important;
|
|
20381
|
+
margin: 0;
|
|
20357
20382
|
}
|
|
20358
20383
|
`;
|
|
20359
20384
|
const chartDebugStyle = i$7`* {
|
|
@@ -35266,6 +35291,11 @@ const LINE_GRAPH_RECREATE_PROP_NAMES = [
|
|
|
35266
35291
|
"height",
|
|
35267
35292
|
"fixedAspectRatioScaling"
|
|
35268
35293
|
];
|
|
35294
|
+
const LINE_GRAPH_DIMENSION_PROP_NAMES = [
|
|
35295
|
+
"width",
|
|
35296
|
+
"height",
|
|
35297
|
+
"fixedAspectRatioScaling"
|
|
35298
|
+
];
|
|
35269
35299
|
const _ObcChartLineBase = class _ObcChartLineBase extends i$4 {
|
|
35270
35300
|
constructor() {
|
|
35271
35301
|
super(...arguments);
|
|
@@ -35798,7 +35828,7 @@ const _ObcChartLineBase = class _ObcChartLineBase extends i$4 {
|
|
|
35798
35828
|
* This is the main coordination function
|
|
35799
35829
|
*/
|
|
35800
35830
|
syncScalesAndChart() {
|
|
35801
|
-
if (this.isUpdatingScales) return;
|
|
35831
|
+
if (this.isUpdatingScales) return false;
|
|
35802
35832
|
this.isUpdatingScales = true;
|
|
35803
35833
|
try {
|
|
35804
35834
|
const padding = this.calculatePaddingFromScales();
|
|
@@ -35812,13 +35842,14 @@ const _ObcChartLineBase = class _ObcChartLineBase extends i$4 {
|
|
|
35812
35842
|
effectiveWidth,
|
|
35813
35843
|
effectiveHeight
|
|
35814
35844
|
});
|
|
35815
|
-
return;
|
|
35845
|
+
return false;
|
|
35816
35846
|
}
|
|
35817
35847
|
this.updateScaleProperties(padding);
|
|
35818
35848
|
if (this.chart) {
|
|
35819
35849
|
this.chart.destroy();
|
|
35820
35850
|
}
|
|
35821
35851
|
this.createChart();
|
|
35852
|
+
return true;
|
|
35822
35853
|
} finally {
|
|
35823
35854
|
this.isUpdatingScales = false;
|
|
35824
35855
|
}
|
|
@@ -36053,6 +36084,9 @@ const _ObcChartLineBase = class _ObcChartLineBase extends i$4 {
|
|
|
36053
36084
|
if (!this.hasAnyChanged(changed, LINE_GRAPH_WATCHED_PROP_NAMES)) {
|
|
36054
36085
|
return;
|
|
36055
36086
|
}
|
|
36087
|
+
if (this.hasAnyChanged(changed, LINE_GRAPH_DIMENSION_PROP_NAMES)) {
|
|
36088
|
+
if (this.updateComputedDimensions()) return;
|
|
36089
|
+
}
|
|
36056
36090
|
if (changed.has("hasLabelPadding") && this.hasExternalScales()) {
|
|
36057
36091
|
this.syncScalesAndChart();
|
|
36058
36092
|
return;
|
|
@@ -36138,19 +36172,27 @@ const _ObcChartLineBase = class _ObcChartLineBase extends i$4 {
|
|
|
36138
36172
|
this.aspectRatioResizeObserver.observe(wrapper);
|
|
36139
36173
|
}
|
|
36140
36174
|
/**
|
|
36141
|
-
*
|
|
36142
|
-
*
|
|
36175
|
+
* Refresh `computedWidth` / `computedHeight`, the derived pixel size the
|
|
36176
|
+
* chart and its slotted scales are laid out from.
|
|
36177
|
+
*
|
|
36178
|
+
* In pixel mode they simply mirror `width` / `height`. Only in
|
|
36179
|
+
* `fixedAspectRatioScaling` mode are they derived — from the wrapper's
|
|
36180
|
+
* measured width and the aspect ratio the `width` / `height` pair defines —
|
|
36181
|
+
* and only then can this rebuild the chart.
|
|
36182
|
+
*
|
|
36183
|
+
* @returns `true` when the change was significant enough that the chart was
|
|
36184
|
+
* rebuilt here, so the caller must not rebuild it a second time.
|
|
36143
36185
|
*/
|
|
36144
36186
|
updateComputedDimensions() {
|
|
36145
36187
|
if (!this.fixedAspectRatioScaling) {
|
|
36146
36188
|
this.computedWidth = this.width;
|
|
36147
36189
|
this.computedHeight = this.height;
|
|
36148
|
-
return;
|
|
36190
|
+
return false;
|
|
36149
36191
|
}
|
|
36150
36192
|
const wrapper = this.renderRoot.querySelector(".wrapper");
|
|
36151
|
-
if (!wrapper) return;
|
|
36193
|
+
if (!wrapper) return false;
|
|
36152
36194
|
const parentWidth = wrapper.clientWidth;
|
|
36153
|
-
if (parentWidth <= 0) return;
|
|
36195
|
+
if (parentWidth <= 0) return false;
|
|
36154
36196
|
const aspectRatio = this.width / this.height;
|
|
36155
36197
|
const newWidth = parentWidth;
|
|
36156
36198
|
const newHeight = Math.round(parentWidth / aspectRatio);
|
|
@@ -36158,12 +36200,14 @@ const _ObcChartLineBase = class _ObcChartLineBase extends i$4 {
|
|
|
36158
36200
|
this.computedWidth = newWidth;
|
|
36159
36201
|
this.computedHeight = newHeight;
|
|
36160
36202
|
if (this.hasExternalScales()) {
|
|
36161
|
-
this.syncScalesAndChart();
|
|
36203
|
+
return this.syncScalesAndChart();
|
|
36162
36204
|
} else if (this.chart) {
|
|
36163
36205
|
this.chart.destroy();
|
|
36164
36206
|
this.createChart();
|
|
36207
|
+
return true;
|
|
36165
36208
|
}
|
|
36166
36209
|
}
|
|
36210
|
+
return false;
|
|
36167
36211
|
}
|
|
36168
36212
|
/**
|
|
36169
36213
|
* Get the effective width for chart rendering.
|