myio-js-library 0.1.166 → 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 +12 -4
- package/dist/index.d.cts +7 -0
- package/dist/index.js +12 -4
- package/dist/myio-js-library.umd.js +12 -4
- 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,7 +24016,9 @@ 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
24023
|
await chartInstance.render();
|
|
24016
24024
|
},
|
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) */
|
|
@@ -2887,6 +2892,8 @@ interface ConsumptionModalConfig extends Omit<Consumption7DaysConfig, 'container
|
|
|
2887
2892
|
showSettingsButton?: boolean;
|
|
2888
2893
|
/** Callback when settings button is clicked */
|
|
2889
2894
|
onSettingsClick?: () => void;
|
|
2895
|
+
/** Initial data to display (skips fetch if provided) */
|
|
2896
|
+
initialData?: Consumption7DaysData;
|
|
2890
2897
|
}
|
|
2891
2898
|
interface ConsumptionModalInstance {
|
|
2892
2899
|
/** Opens the modal */
|
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,7 +23875,9 @@ 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
23882
|
await chartInstance.render();
|
|
23875
23883
|
},
|
|
@@ -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,7 +23693,9 @@ ${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
23700
|
await chartInstance.render();
|
|
23693
23701
|
},
|