blue-chestnut-solar-expert 0.0.15 → 0.0.17
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/stencil-library/map-draw.entry.esm.js.map +1 -1
- package/dist/stencil-library/map-draw.entry.js +37 -9
- package/dist/stencil-library/map-draw.entry.js.map +1 -1
- package/dist/stencil-library/map-selector.entry.js +3 -3
- package/dist/stencil-library/settings-modal.entry.js +9 -9
- package/dist/stencil-library/solar-expert.entry.esm.js.map +1 -1
- package/dist/stencil-library/solar-expert.entry.js +16 -5
- package/dist/stencil-library/solar-expert.entry.js.map +1 -1
- package/dist/stencil-library/solar-system-form.entry.esm.js.map +1 -1
- package/dist/stencil-library/solar-system-form.entry.js +31 -26
- package/dist/stencil-library/solar-system-form.entry.js.map +1 -1
- package/dist/stencil-library/stencil-library.esm.js +1 -1
- package/dist/stencil-library/store-CbFNgpiN.js +583 -0
- package/dist/stencil-library/store-CbFNgpiN.js.map +1 -0
- package/dist/stencil-library/tool-box.entry.js +2 -2
- package/dist/types/components/map-draw/map-draw.d.ts +1 -0
- package/dist/types/store.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as registerInstance, g as getElement, h } from './index-DZjEuBrX.js';
|
|
2
2
|
import { f as fetchSolarData, g as getBuildingImages } from './api-E7GpMOpJ.js';
|
|
3
|
-
import { D as DOTTED_LINE_COLOR, R as ROW_SPACING, C as COLUMN_SPACING, a as DEFAULT_SOLAR_EXPERT_CONFIG, b as DEFAULT_SOLAR_PANEL_TYPE,
|
|
3
|
+
import { D as DOTTED_LINE_COLOR, R as ROW_SPACING, C as COLUMN_SPACING, a as DEFAULT_SOLAR_EXPERT_CONFIG, b as DEFAULT_SOLAR_PANEL_TYPE, c as DEFAULT_SUNNINESS, B as BORDER_INSET } from './config-hh5GAFbi.js';
|
|
4
4
|
import { r as roofTool, t as tools, m as moveTool, o as obstructionTool, d as deleteTool } from './tools-DO8CG56H.js';
|
|
5
|
-
import { o as onChange, s as state, g as getLanguageStrings } from './store-
|
|
5
|
+
import { o as onChange, s as state, g as getLanguageStrings } from './store-CbFNgpiN.js';
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
8
|
Copyright 2023 Google LLC
|
|
@@ -2224,6 +2224,7 @@ const MapDraw = class {
|
|
|
2224
2224
|
selectedPolygon = null;
|
|
2225
2225
|
buildingInsights = null;
|
|
2226
2226
|
pixelInMeters = 0.2;
|
|
2227
|
+
isMobile = false;
|
|
2227
2228
|
get el() { return getElement(this); }
|
|
2228
2229
|
canvasElement;
|
|
2229
2230
|
polygonCanvas;
|
|
@@ -2296,6 +2297,29 @@ const MapDraw = class {
|
|
|
2296
2297
|
if (!this.buildingInsights) {
|
|
2297
2298
|
alert("No building insights found. Please enter them manually.");
|
|
2298
2299
|
}
|
|
2300
|
+
// If on mobile, automatically calculate panels using Google API data
|
|
2301
|
+
if (state.isMobile && this.buildingInsights) {
|
|
2302
|
+
const maxPanels = this.buildingInsights.solarPotential.maxArrayPanelsCount;
|
|
2303
|
+
const approximatedPanels = Math.floor(maxPanels / 3); // Use one third of max panels
|
|
2304
|
+
const positionedPanels = Array(approximatedPanels).fill(null)
|
|
2305
|
+
.map((_, i) => ({
|
|
2306
|
+
panel: this.solarPanel,
|
|
2307
|
+
pixelPosition: {
|
|
2308
|
+
x: -1,
|
|
2309
|
+
y: -1,
|
|
2310
|
+
},
|
|
2311
|
+
horizontal: true,
|
|
2312
|
+
rotation: 0,
|
|
2313
|
+
}));
|
|
2314
|
+
this.roofPolygonsSolarPanels = {
|
|
2315
|
+
...this.roofPolygonsSolarPanels,
|
|
2316
|
+
["mobile-panels"]: {
|
|
2317
|
+
positionedPanels,
|
|
2318
|
+
sunniness: this.buildingInsights.solarPotential.buildingStats
|
|
2319
|
+
.sunshineQuantiles[5] ?? DEFAULT_SUNNINESS,
|
|
2320
|
+
},
|
|
2321
|
+
};
|
|
2322
|
+
}
|
|
2299
2323
|
}
|
|
2300
2324
|
async getBuildingImages() {
|
|
2301
2325
|
if (!state.latitude || !state.longitude) {
|
|
@@ -2332,6 +2356,8 @@ const MapDraw = class {
|
|
|
2332
2356
|
});
|
|
2333
2357
|
}
|
|
2334
2358
|
handleMouseMove(event) {
|
|
2359
|
+
if (state.isMobile)
|
|
2360
|
+
return; // Prevent interactions on mobile
|
|
2335
2361
|
if (!this.polygonCanvas || !this.polygonCtx)
|
|
2336
2362
|
return;
|
|
2337
2363
|
// translate the website pixel coordinates to the canvas coordinates
|
|
@@ -2490,6 +2516,8 @@ const MapDraw = class {
|
|
|
2490
2516
|
}
|
|
2491
2517
|
}
|
|
2492
2518
|
handleMouseDown(event) {
|
|
2519
|
+
if (state.isMobile)
|
|
2520
|
+
return; // Prevent interactions on mobile
|
|
2493
2521
|
if (!this.polygonCanvas || !this.polygonCtx)
|
|
2494
2522
|
return;
|
|
2495
2523
|
if (!this.polygonCanvas.contains(event.target))
|
|
@@ -2703,20 +2731,20 @@ const MapDraw = class {
|
|
|
2703
2731
|
render() {
|
|
2704
2732
|
const t = getLanguageStrings(state.settings.language);
|
|
2705
2733
|
const currentPolygon = this.getCurrentPolygon();
|
|
2706
|
-
return (h("div", { key: '
|
|
2734
|
+
return (h("div", { key: 'bc5cb8df93f77ad4fe45c79b1deef0609a77253a', class: "flex flex-col justify-center items-center w-full h-full gap-4", id: "map-draw" }, this.showInstructions && !state.isMobile && (h("div", { key: '54410436177fb4a4f306e7526dcd3a04f20335ea', class: "w-full rounded-4xl p-4 bg-white" }, t.mapDraw.instructions.parts.roof, " ", h("button", { key: '642ed241afe9a207fde659f084149e3e35f6ccd1', class: "inline-flex items-center justify-center p-1 rounded-full hover:bg-gray-300 transition-colors", onClick: () => this.handleToolSelect(roofTool) }, h("icon-selector", { key: '4071eff3dcc4a6d3d1d5d49177c3b21c761a3861', name: "house", inline: true })), " ", t.mapDraw.instructions.parts.obstruction, " ", h("button", { key: '7b9188696846fbea5f06415649f71bbd7f3b13c7', class: "inline-flex items-center justify-center p-1 rounded-full hover:bg-gray-300 transition-colors", onClick: () => this.handleToolSelect(obstructionTool) }, h("icon-selector", { key: 'a2494edd178f787d96aff921aec005d93df4031e', name: "octagon-minus", inline: true })), " ", t.mapDraw.instructions.parts.delete, " ", h("button", { key: 'ff5aa2388ea6e657dc1435cbebfb9b911a687934', class: "inline-flex items-center justify-center p-1 rounded-full hover:bg-gray-300 transition-colors", onClick: () => this.handleToolSelect(deleteTool) }, h("icon-selector", { key: 'f3cbd140baf8cb028f66bff5a1a8968cbef89363', name: "eraser", inline: true })), " ", t.mapDraw.instructions.parts.move, " ", h("button", { key: '3e81bf328648f3d2a8b4f60075b33fe2cf9b5ad6', class: "inline-flex items-center justify-center p-1 rounded-full hover:bg-gray-300 transition-colors", onClick: () => this.handleToolSelect(moveTool) }, h("icon-selector", { key: 'be1d5191ed1b2a3c8cf66776b1ea159d4ff43afd', name: "move", inline: true })), " ", t.mapDraw.instructions.parts.end)), h("div", { key: 'e94aca98a9480808b71049af0e1fb7d7343f22a0', class: "w-full flex flex-row justify-between items-center" }, !state.isMobile && (this.showInstructions
|
|
2707
2735
|
? (h("button", { class: "px-4 py-2 rounded-4xl hover:bg-gray-300 transition-colors duration-200 bg-white p-4", onClick: () => this.showInstructions = false }, t.mapDraw.instructions.hide))
|
|
2708
|
-
: (h("button", { class: "px-4 py-2 rounded-4xl hover:bg-gray-300 transition-colors duration-200 bg-white p-4", onClick: () => this.showInstructions = true }, t.mapDraw.instructions.show)), h("button", { key: '
|
|
2736
|
+
: (h("button", { class: "px-4 py-2 rounded-4xl hover:bg-gray-300 transition-colors duration-200 bg-white p-4", onClick: () => this.showInstructions = true }, t.mapDraw.instructions.show))), h("button", { key: '0c6706ca25dee7f3a7c0c7f375a7c43216f4e5dc', class: "flex items-center gap-2 bg-white p-2 rounded-4xl hover:bg-gray-300", onClick: this.handleSettingsClick }, h("settings-icon", { key: 'a0c2d9d7c75444a497fd79e627efa80878b77b76' }))), h("div", { key: 'b4299108e6cf2b3c44781108204061ff1f868b17', class: "w-full" }, !state.isMobile && (h("tool-box", { key: '25958772c5bcad715eed7e61e9fcf8ba834085e4', currentTool: this.currentTool, onToolSelect: (tool) => this.handleToolSelect(tool) }))), this.loadingState === "empty" && (h("div", { key: '73298d935a0d154587f44aefa01e535b4724965f', class: "w-full" }, h("p", { key: '355a0d78e9429be46867be7918ebee5bb988d86b', class: "text-white text-center flex items-center justify-center rounded-4xl p-4 w-full", style: {
|
|
2709
2737
|
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
2710
2738
|
} }, t.mapDraw.noAddressSelected))), (state.latitude && state.longitude &&
|
|
2711
|
-
this.loadingState === "loading") && (h("div", { key: '
|
|
2739
|
+
this.loadingState === "loading") && (h("div", { key: '63ef7715a479e33e10f32e4ef73512e742feae52', class: "flex items-center justify-center w-full bg-opacity-75 z-20 pt-7 rounded-4xl" }, h("div", { key: '09e523207603a59802393725446693ab9dfb0eec', class: "animate-spin rounded-full h-16 w-16 border-t-2 border-b-2 border-[#271200]" }))), h("div", { key: '1ba6f36469c629c4a735eb778a525e519b868dcc', class: "flex items-start justify-center h-full w-full bg-[#f3ebda] rounded-4xl" }, h("div", { key: '78a383993d84bd7a5a804a9b8aed982bca3593db', class: "relative h-full flex items-center justify-center w-full rounded-4xl bg-[#271200]", style: {
|
|
2712
2740
|
aspectRatio: this.rgbTiff
|
|
2713
2741
|
? `${this.rgbTiff.width}/${this.rgbTiff.height}`
|
|
2714
2742
|
: "1/1",
|
|
2715
|
-
} }, h("canvas", { key: '
|
|
2743
|
+
} }, h("canvas", { key: '9f73b8eacc53d97584d1a1f2ad75cce42f94d883', ref: (el) => this.canvasElement = el, class: "absolute top-0 left-0 w-full h-full rounded-4xl", id: "map-draw-canvas", style: {
|
|
2716
2744
|
cursor: this.currentTool.cursor,
|
|
2717
|
-
} }), h("canvas", { key: '
|
|
2745
|
+
} }), h("canvas", { key: 'd817b13ad847248e5cccbe4a572db0d38115f40d', ref: (el) => this.polygonCanvas = el, class: "absolute top-0 left-0 w-full h-full rounded-4xl", style: {
|
|
2718
2746
|
cursor: this.currentTool.cursor,
|
|
2719
|
-
} }), currentPolygon?.details && (h("button", { key: '
|
|
2747
|
+
} }), currentPolygon?.details && (h("button", { key: 'e1ac09242d33d5ff1df6442682c812734aec3ed6', class: "absolute bottom-4 right-4 px-4 py-2 bg-[#f3ebda] rounded-4xl hover:bg-[#ffffff] text-[#271200] transition-colors duration-200 z-10 text-xs", onClick: () => this.calculateSolarPanels() }, t.mapDraw.calculateSolarPanels)))), !state.isMobile && (h("div", { key: '08f69bf2844c1bced2dc1cc17c38a6aeccd4b8b7', class: "flex gap-4 flex-row justify-center items-center w-full" }, h("div", { key: 'e587229364e9644a764ebf57a22c73a8fd139054', class: "w-full bg-[#f3ebda] rounded-4xl p-4" }, h("h3", { key: '0606f98d16973c8dbf75ad59030de9716c757dbc', class: "text-lg font-semibold mb-4 text-center" }, t.mapDraw.information), currentPolygon?.details
|
|
2720
2748
|
? (h("div", { class: "space-y-4" }, h("div", null, h("div", { class: "grid grid-cols-2 gap-2" }, h("div", null, h("h4", { class: "text-sm font-medium text-gray-600" }, t.mapDraw.area), h("p", { class: "text-lg" }, currentPolygon.details
|
|
2721
2749
|
?.area
|
|
2722
2750
|
.toFixed(2), " m\u00B2")), h("div", null, h("div", null, h("h4", { class: "text-sm font-medium text-gray-600" }, t.mapDraw.panels), h("p", { class: "text-lg" }, this
|
|
@@ -2768,7 +2796,7 @@ const MapDraw = class {
|
|
|
2768
2796
|
this.calculateSolarPanels();
|
|
2769
2797
|
}
|
|
2770
2798
|
} }))))
|
|
2771
|
-
: (h("p", { class: "text-gray-500 text-center" }, t.mapDraw.noPolygonSelected)))), h("div", { key: '
|
|
2799
|
+
: (h("p", { class: "text-gray-500 text-center" }, t.mapDraw.noPolygonSelected))))), h("div", { key: '1155d23559182bc9571bdeeba276896dae44d8e6', class: "w-full" }, h("solar-system-form", { key: 'dd918fdc47abf838cbb1d12932ec837bf357515f', systemConfigs: this.roofPolygonsSolarPanels, roofPolygons: this.roofPolygons, obstructionPolygons: this.obstructionPolygons })), this.showSettings && (h("settings-modal", { key: 'cedf9b3c329cf19870631da50950254de778977d', settings: state.settings, onClose: this.handleSettingsClose, onSave: this.handleSettingsSave }))));
|
|
2772
2800
|
}
|
|
2773
2801
|
static get watchers() { return {
|
|
2774
2802
|
"rgbTiff": ["drawMap"],
|