myio-js-library 0.1.167 → 0.1.168
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/dist/index.cjs +13 -9
- package/dist/index.d.cts +5 -0
- package/dist/index.js +13 -9
- package/dist/myio-js-library.umd.js +13 -9
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23559,9 +23559,15 @@ function createConsumption7DaysChart(config) {
|
|
|
23559
23559
|
const canvas = validateCanvas();
|
|
23560
23560
|
if (!canvas) return;
|
|
23561
23561
|
try {
|
|
23562
|
-
|
|
23563
|
-
|
|
23564
|
-
|
|
23562
|
+
if (config.initialData) {
|
|
23563
|
+
log("log", "Using initial data (instant display)");
|
|
23564
|
+
cachedData = config.initialData;
|
|
23565
|
+
cachedData.fetchTimestamp = cachedData.fetchTimestamp || Date.now();
|
|
23566
|
+
} else {
|
|
23567
|
+
log("log", `Fetching ${currentPeriod} days of data...`);
|
|
23568
|
+
cachedData = await config.fetchData(currentPeriod);
|
|
23569
|
+
cachedData.fetchTimestamp = Date.now();
|
|
23570
|
+
}
|
|
23565
23571
|
if (config.onBeforeRender) {
|
|
23566
23572
|
cachedData = config.onBeforeRender(cachedData);
|
|
23567
23573
|
}
|
|
@@ -24010,13 +24016,11 @@ function createConsumptionModal(config) {
|
|
|
24010
24016
|
containerId: `${modalId}-chart`,
|
|
24011
24017
|
theme: currentTheme,
|
|
24012
24018
|
defaultChartType: currentChartType,
|
|
24013
|
-
defaultVizMode: currentVizMode
|
|
24019
|
+
defaultVizMode: currentVizMode,
|
|
24020
|
+
// RFC-0098: Pass initialData to chart config for instant display
|
|
24021
|
+
initialData: config.initialData
|
|
24014
24022
|
});
|
|
24015
|
-
|
|
24016
|
-
chartInstance.update(config.initialData);
|
|
24017
|
-
} else {
|
|
24018
|
-
await chartInstance.render();
|
|
24019
|
-
}
|
|
24023
|
+
await chartInstance.render();
|
|
24020
24024
|
},
|
|
24021
24025
|
close() {
|
|
24022
24026
|
if (modalElement) {
|
package/dist/index.d.cts
CHANGED
|
@@ -2574,6 +2574,11 @@ interface Consumption7DaysConfig {
|
|
|
2574
2574
|
* @returns Promise resolving to consumption data
|
|
2575
2575
|
*/
|
|
2576
2576
|
fetchData: (period: number) => Promise<Consumption7DaysData>;
|
|
2577
|
+
/**
|
|
2578
|
+
* Initial data to display (skips fetch if provided)
|
|
2579
|
+
* Useful for modal/fullscreen views that reuse cached data
|
|
2580
|
+
*/
|
|
2581
|
+
initialData?: Consumption7DaysData;
|
|
2577
2582
|
/** Large unit for values above threshold (MWh, etc.) - null to disable */
|
|
2578
2583
|
unitLarge?: string | null;
|
|
2579
2584
|
/** Threshold value to switch to large unit (1000 for kWh->MWh) */
|
package/dist/index.js
CHANGED
|
@@ -23418,9 +23418,15 @@ function createConsumption7DaysChart(config) {
|
|
|
23418
23418
|
const canvas = validateCanvas();
|
|
23419
23419
|
if (!canvas) return;
|
|
23420
23420
|
try {
|
|
23421
|
-
|
|
23422
|
-
|
|
23423
|
-
|
|
23421
|
+
if (config.initialData) {
|
|
23422
|
+
log("log", "Using initial data (instant display)");
|
|
23423
|
+
cachedData = config.initialData;
|
|
23424
|
+
cachedData.fetchTimestamp = cachedData.fetchTimestamp || Date.now();
|
|
23425
|
+
} else {
|
|
23426
|
+
log("log", `Fetching ${currentPeriod} days of data...`);
|
|
23427
|
+
cachedData = await config.fetchData(currentPeriod);
|
|
23428
|
+
cachedData.fetchTimestamp = Date.now();
|
|
23429
|
+
}
|
|
23424
23430
|
if (config.onBeforeRender) {
|
|
23425
23431
|
cachedData = config.onBeforeRender(cachedData);
|
|
23426
23432
|
}
|
|
@@ -23869,13 +23875,11 @@ function createConsumptionModal(config) {
|
|
|
23869
23875
|
containerId: `${modalId}-chart`,
|
|
23870
23876
|
theme: currentTheme,
|
|
23871
23877
|
defaultChartType: currentChartType,
|
|
23872
|
-
defaultVizMode: currentVizMode
|
|
23878
|
+
defaultVizMode: currentVizMode,
|
|
23879
|
+
// RFC-0098: Pass initialData to chart config for instant display
|
|
23880
|
+
initialData: config.initialData
|
|
23873
23881
|
});
|
|
23874
|
-
|
|
23875
|
-
chartInstance.update(config.initialData);
|
|
23876
|
-
} else {
|
|
23877
|
-
await chartInstance.render();
|
|
23878
|
-
}
|
|
23882
|
+
await chartInstance.render();
|
|
23879
23883
|
},
|
|
23880
23884
|
close() {
|
|
23881
23885
|
if (modalElement) {
|
|
@@ -23236,9 +23236,15 @@ ${rangeText}`;
|
|
|
23236
23236
|
const canvas = validateCanvas();
|
|
23237
23237
|
if (!canvas) return;
|
|
23238
23238
|
try {
|
|
23239
|
-
|
|
23240
|
-
|
|
23241
|
-
|
|
23239
|
+
if (config.initialData) {
|
|
23240
|
+
log("log", "Using initial data (instant display)");
|
|
23241
|
+
cachedData = config.initialData;
|
|
23242
|
+
cachedData.fetchTimestamp = cachedData.fetchTimestamp || Date.now();
|
|
23243
|
+
} else {
|
|
23244
|
+
log("log", `Fetching ${currentPeriod} days of data...`);
|
|
23245
|
+
cachedData = await config.fetchData(currentPeriod);
|
|
23246
|
+
cachedData.fetchTimestamp = Date.now();
|
|
23247
|
+
}
|
|
23242
23248
|
if (config.onBeforeRender) {
|
|
23243
23249
|
cachedData = config.onBeforeRender(cachedData);
|
|
23244
23250
|
}
|
|
@@ -23687,13 +23693,11 @@ ${rangeText}`;
|
|
|
23687
23693
|
containerId: `${modalId}-chart`,
|
|
23688
23694
|
theme: currentTheme,
|
|
23689
23695
|
defaultChartType: currentChartType,
|
|
23690
|
-
defaultVizMode: currentVizMode
|
|
23696
|
+
defaultVizMode: currentVizMode,
|
|
23697
|
+
// RFC-0098: Pass initialData to chart config for instant display
|
|
23698
|
+
initialData: config.initialData
|
|
23691
23699
|
});
|
|
23692
|
-
|
|
23693
|
-
chartInstance.update(config.initialData);
|
|
23694
|
-
} else {
|
|
23695
|
-
await chartInstance.render();
|
|
23696
|
-
}
|
|
23700
|
+
await chartInstance.render();
|
|
23697
23701
|
},
|
|
23698
23702
|
close() {
|
|
23699
23703
|
if (modalElement) {
|