@solercia/ui 0.8.0 → 0.8.1
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/CHANGELOG.md +10 -0
- package/fesm2022/solercia-ui.mjs +17 -5
- package/fesm2022/solercia-ui.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ All notable changes to this package are documented in this file. The format foll
|
|
|
5
5
|
[SemVer](https://semver.org/). The package started at `0.1.0`; while it is pre-1.0 and has only a
|
|
6
6
|
few consumers, `minor` versions may include breaking changes.
|
|
7
7
|
|
|
8
|
+
## [0.8.1] - 2026-11-25
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- `chart.js` no longer lands in the initial bundle of apps that do not render `sol-chart`. The
|
|
13
|
+
`Chart.register()` call ran at module load, a side effect that kept chart.js in every app importing
|
|
14
|
+
anything from `@solercia/ui`; it now runs once, lazily, when the first chart is created. Measured
|
|
15
|
+
with an Angular production build of an app that only imports `SOL_I18N`: initial bundle from
|
|
16
|
+
305.8 kB to 115.4 kB.
|
|
17
|
+
|
|
8
18
|
## [0.8.0] - 2026-11-25
|
|
9
19
|
|
|
10
20
|
### Changed
|
package/fesm2022/solercia-ui.mjs
CHANGED
|
@@ -7659,16 +7659,28 @@ function buildEngineOptions(type, data, theme, options) {
|
|
|
7659
7659
|
return engineOptions;
|
|
7660
7660
|
}
|
|
7661
7661
|
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
|
|
7662
|
+
let chartJsRegistered = false;
|
|
7663
|
+
/**
|
|
7664
|
+
* Registers only what the four declarative chart types need (never chart.js/auto). It runs lazily
|
|
7665
|
+
* on the first real chart, not at module load: a top-level `Chart.register()` is a side effect
|
|
7666
|
+
* that keeps chart.js in the initial bundle of every app importing anything from `@solercia/ui`.
|
|
7667
|
+
*/
|
|
7668
|
+
function ensureChartJsRegistered() {
|
|
7669
|
+
if (chartJsRegistered)
|
|
7670
|
+
return;
|
|
7671
|
+
Chart.register(LineController, BarController, DoughnutController, LineElement, PointElement, BarElement, ArcElement, CategoryScale, LinearScale, Legend, Tooltip, Filler);
|
|
7672
|
+
chartJsRegistered = true;
|
|
7673
|
+
}
|
|
7665
7674
|
/**
|
|
7666
7675
|
* Punto ÚNICO de acople con Chart.js: la fábrica por defecto instancia
|
|
7667
7676
|
* `new Chart(...)`. Los specs la sustituyen para probar el componente sin
|
|
7668
7677
|
* canvas real; un eventual cambio de motor se resuelve aquí y en el adapter.
|
|
7669
7678
|
*/
|
|
7670
|
-
const SOL_CHART_ENGINE = new InjectionToken('SOL_CHART_ENGINE', {
|
|
7671
|
-
factory: () => (canvas, config) =>
|
|
7679
|
+
const SOL_CHART_ENGINE = /* @__PURE__ */ new InjectionToken('SOL_CHART_ENGINE', {
|
|
7680
|
+
factory: () => (canvas, config) => {
|
|
7681
|
+
ensureChartJsRegistered();
|
|
7682
|
+
return new Chart(canvas, config);
|
|
7683
|
+
},
|
|
7672
7684
|
});
|
|
7673
7685
|
/**
|
|
7674
7686
|
* `sol-chart` (E3): envoltura propia de Chart.js con API declarativa.
|