blue-chestnut-solar-expert 0.0.34 → 0.0.36
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/cjs/eraser-icon.house-icon.icon-selector.map-draw.map-selector.move-icon.octagon-minus-icon.polygon-buttons.polygon-information.search-icon.settings-icon.settings-modal.solar-expert.solar-system-form.tool-box.undo-icon.entry.cjs.js.map +1 -1
- package/dist/cjs/eraser-icon_16.cjs.entry.js +78 -43
- package/dist/cjs/eraser-icon_16.cjs.entry.js.map +1 -1
- package/dist/cjs/loading-widget.cjs.entry.js +1 -1
- package/dist/collection/components/map-draw/tool-box.js +7 -3
- package/dist/collection/components/map-draw/tool-box.js.map +1 -1
- package/dist/collection/components/solar-expert/solar-expert.js +2 -2
- package/dist/collection/components/solar-expert/solar-expert.js.map +1 -1
- package/dist/collection/components/solar-system-form/solar-system-form.js +58 -34
- package/dist/collection/components/solar-system-form/solar-system-form.js.map +1 -1
- package/dist/collection/components/widgets/loading-widget.js +1 -1
- package/dist/collection/constants.js +1 -1
- package/dist/collection/constants.js.map +1 -1
- package/dist/collection/types/lang.js.map +1 -1
- package/dist/collection/utils/lang/english.js +1 -0
- package/dist/collection/utils/lang/english.js.map +1 -1
- package/dist/collection/utils/lang/german.js +1 -0
- package/dist/collection/utils/lang/german.js.map +1 -1
- package/dist/collection/utils/lang/spanish.js +1 -0
- package/dist/collection/utils/lang/spanish.js.map +1 -1
- package/dist/collection/utils/simulation/simulation.js +8 -3
- package/dist/collection/utils/simulation/simulation.js.map +1 -1
- package/dist/collection/utils/simulation/types.js.map +1 -1
- package/dist/components/loading-widget.js +1 -1
- package/dist/components/map-draw.js +1 -1
- package/dist/components/map-selector.js +1 -1
- package/dist/components/{p-DbJfa2yQ.js → p-2Um_yzGy.js} +3 -3
- package/dist/components/{p-DbJfa2yQ.js.map → p-2Um_yzGy.js.map} +1 -1
- package/dist/components/{p-BGxYjXB5.js → p-3JEPWoBM.js} +3 -3
- package/dist/components/{p-BGxYjXB5.js.map → p-3JEPWoBM.js.map} +1 -1
- package/dist/components/{p-BcV6HHN8.js → p-BU8VgrD9.js} +3 -3
- package/dist/components/{p-BcV6HHN8.js.map → p-BU8VgrD9.js.map} +1 -1
- package/dist/components/{p-B1ywivYa.js → p-CUDvRPwB.js} +3 -3
- package/dist/components/{p-B1ywivYa.js.map → p-CUDvRPwB.js.map} +1 -1
- package/dist/components/{p-ClYOM_0b.js → p-CsaE9aHg.js} +8 -8
- package/dist/components/{p-ClYOM_0b.js.map → p-CsaE9aHg.js.map} +1 -1
- package/dist/components/{p-CrzEBN9H.js → p-Cti_pU17.js} +69 -41
- package/dist/components/p-Cti_pU17.js.map +1 -0
- package/dist/components/{p-DMkbzkL_.js → p-DJT7IBlC.js} +10 -6
- package/dist/components/p-DJT7IBlC.js.map +1 -0
- package/dist/components/{p-BLXc1FjC.js → p-DmmMPG7q.js} +5 -2
- package/dist/components/p-DmmMPG7q.js.map +1 -0
- package/dist/components/polygon-buttons.js +1 -1
- package/dist/components/polygon-information.js +1 -1
- package/dist/components/settings-modal.js +1 -1
- package/dist/components/solar-expert.js +10 -10
- package/dist/components/solar-expert.js.map +1 -1
- package/dist/components/solar-system-form.js +1 -1
- package/dist/components/tool-box.js +1 -1
- package/dist/esm/eraser-icon.house-icon.icon-selector.map-draw.map-selector.move-icon.octagon-minus-icon.polygon-buttons.polygon-information.search-icon.settings-icon.settings-modal.solar-expert.solar-system-form.tool-box.undo-icon.entry.js.map +1 -1
- package/dist/esm/eraser-icon_16.entry.js +78 -43
- package/dist/esm/eraser-icon_16.entry.js.map +1 -1
- package/dist/esm/loading-widget.entry.js +1 -1
- package/dist/stencil-library/eraser-icon.house-icon.icon-selector.map-draw.map-selector.move-icon.octagon-minus-icon.polygon-buttons.polygon-information.search-icon.settings-icon.settings-modal.solar-expert.solar-system-form.tool-box.undo-icon.entry.esm.js.map +1 -1
- package/dist/stencil-library/p-b60b09ed.entry.js +2 -0
- package/dist/stencil-library/p-b60b09ed.entry.js.map +1 -0
- package/dist/stencil-library/{p-1e4e5fe9.entry.js → p-df0b0ef8.entry.js} +2 -2
- package/dist/stencil-library/stencil-library.esm.js +1 -1
- package/dist/types/components/solar-system-form/solar-system-form.d.ts +1 -0
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/types/lang.d.ts +1 -0
- package/dist/types/utils/simulation/types.d.ts +1 -0
- package/package.json +1 -1
- package/dist/components/p-BLXc1FjC.js.map +0 -1
- package/dist/components/p-CrzEBN9H.js.map +0 -1
- package/dist/components/p-DMkbzkL_.js.map +0 -1
- package/dist/stencil-library/p-958f0a27.entry.js +0 -2
- package/dist/stencil-library/p-958f0a27.entry.js.map +0 -1
- /package/dist/stencil-library/{p-1e4e5fe9.entry.js.map → p-df0b0ef8.entry.js.map} +0 -0
|
@@ -9,7 +9,7 @@ const LoadingWidget = class {
|
|
|
9
9
|
index.registerInstance(this, hostRef);
|
|
10
10
|
}
|
|
11
11
|
render() {
|
|
12
|
-
return (index.h("div", { key: '
|
|
12
|
+
return (index.h("div", { key: '977cdc480ba45a866e73bf5bba91f35b26663412', class: "absolute flex items-center justify-center bg-muted bg-opacity-75 z-20 pt-7 rounded-4xl" }, index.h("div", { key: '3982cf82646e2d7cd02eafc5c91985563954eed3', class: "animate-spin rounded-full h-16 w-16 border-t-2 border-b-2 border-secondary" })));
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
LoadingWidget.style = outputCss;
|
|
@@ -12,9 +12,13 @@ export class ToolBox {
|
|
|
12
12
|
return (h("div", { key: '6a249c8eddd0bf541a98f77d09bcc9e297e8ec63', class: "flex lg:gap-4 rounded-4xl bg-primary p-4 flex-wrap justify-center w-full text-xs" }, tools.map((tool) => {
|
|
13
13
|
const toolStrings = t.mapDraw.tools[tool.name];
|
|
14
14
|
return (h("button", { class: `px-4 py-2 rounded-4xl transition-colors duration-200 ${this.currentTool.name === tool.name
|
|
15
|
-
? "bg-secondary hover:bg-secondary/80
|
|
16
|
-
: "bg-primary hover:bg-muted
|
|
17
|
-
|
|
15
|
+
? "bg-secondary hover:bg-secondary/80"
|
|
16
|
+
: "bg-primary hover:bg-muted"}`, style: {
|
|
17
|
+
color: this.currentTool.name === tool.name
|
|
18
|
+
? "var(--color-secondary-foreground)"
|
|
19
|
+
: "var(--color-primary-foreground)",
|
|
20
|
+
}, "aria-label": toolStrings.ariaLabel, title: toolStrings.explanation, onClick: () => this.onToolSelect(tool) }, h("div", { class: "flex items-center gap-1 flex-col" }, h("icon-selector", { name: tool.icon }), h("span", null, toolStrings.name))));
|
|
21
|
+
}), h("button", { key: 'b9eefc37d84ce8cf1fc3ea27fd0135d477a30eb2', class: `px-4 py-2 rounded-4xl transition-colors duration-200 bg-primary hover:bg-muted text-primary-foreground`, "aria-label": undoToolStrings.ariaLabel, title: undoToolStrings.explanation, onClick: () => this.undoCallback() }, h("div", { key: '06388aa01a0a70de8ffb202717e4d63df6c9cd1b', class: "flex items-center gap-1 flex-col" }, h("undo-icon", { key: 'ba5614562d52b0b06be3a9f557ed3dcb103eeeaa' }), h("span", { key: '39aeaf8cd4c4cabd39bec5051ef0eb53459e7846' }, undoToolStrings.name)))));
|
|
18
22
|
}
|
|
19
23
|
static get is() { return "tool-box"; }
|
|
20
24
|
static get originalStyleUrls() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-box.js","sourceRoot":"","sources":["../../../src/components/map-draw/tool-box.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO3D,MAAM,OAAO,OAAO;IAEhB,WAAW,CAAO;IAElB,YAAY,CAAa;IAEzB,YAAY,CAAuB;IAE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CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC/C,OAAO,CACH,cACI,KAAK,EAAE,wDACH,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI;wBAC/B,CAAC,CAAC,oCAAoC;wBACtC,CAAC,CAAC,2BACV,EAAE,EACF,KAAK,EAAE;wBACH,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI;4BACtC,CAAC,CAAC,mCAAmC;4BACrC,CAAC,CAAC,iCAAiC;qBAC1C,gBACW,WAAW,CAAC,SAAS,EACjC,KAAK,EAAE,WAAW,CAAC,WAAW,EAC9B,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;oBAEtC,WAAK,KAAK,EAAC,kCAAkC;wBACzC,qBAAe,IAAI,EAAE,IAAI,CAAC,IAAI,GAAI;wBAClC,gBAAO,WAAW,CAAC,IAAI,CAAQ,CAC7B,CACD,CACZ,CAAC;YACN,CAAC,CAAC;YACF,+DACI,KAAK,EAAE,wGAAwG,gBACnG,eAAe,CAAC,SAAS,EACrC,KAAK,EAAE,eAAe,CAAC,WAAW,EAClC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE;gBAElC,4DAAK,KAAK,EAAC,kCAAkC;oBACzC,mEAAa;oBACb,+DAAO,eAAe,CAAC,IAAI,CAAQ,CACjC,CACD,CACP,CACT,CAAC;IACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, h, Prop } from \"@stencil/core\";\r\nimport { Tool } from \"../../utils/render/tools\";\r\nimport { getLanguageStrings } from \"../../utils/lang/general\";\r\nimport { state } from \"../../store\";\r\nimport { tools, undoTool } from \"../../utils/render/tools\";\r\n\r\n@Component({\r\n tag: \"tool-box\",\r\n styleUrl: \"../../output.css\",\r\n shadow: false,\r\n})\r\nexport class ToolBox {\r\n @Prop()\r\n currentTool: Tool;\r\n @Prop()\r\n undoCallback: () => void;\r\n @Prop()\r\n onToolSelect: (tool: Tool) => void;\r\n\r\n render() {\r\n const t = getLanguageStrings(state.settings.language);\r\n const undoToolStrings = t.mapDraw.tools[undoTool.name];\r\n\r\n return (\r\n <div class=\"flex lg:gap-4 rounded-4xl bg-primary p-4 flex-wrap justify-center w-full text-xs\">\r\n {tools.map((tool) => {\r\n const toolStrings = t.mapDraw.tools[tool.name];\r\n return (\r\n <button\r\n class={`px-4 py-2 rounded-4xl transition-colors duration-200 ${\r\n this.currentTool.name === tool.name\r\n ? \"bg-secondary hover:bg-secondary/80\"\r\n : \"bg-primary hover:bg-muted\"\r\n }`}\r\n style={{\r\n color: this.currentTool.name === tool.name\r\n ? \"var(--color-secondary-foreground)\"\r\n : \"var(--color-primary-foreground)\",\r\n }}\r\n aria-label={toolStrings.ariaLabel}\r\n title={toolStrings.explanation}\r\n onClick={() => this.onToolSelect(tool)}\r\n >\r\n <div class=\"flex items-center gap-1 flex-col\">\r\n <icon-selector name={tool.icon} />\r\n <span>{toolStrings.name}</span>\r\n </div>\r\n </button>\r\n );\r\n })}\r\n <button\r\n class={`px-4 py-2 rounded-4xl transition-colors duration-200 bg-primary hover:bg-muted text-primary-foreground`}\r\n aria-label={undoToolStrings.ariaLabel}\r\n title={undoToolStrings.explanation}\r\n onClick={() => this.undoCallback()}\r\n >\r\n <div class=\"flex items-center gap-1 flex-col\">\r\n <undo-icon />\r\n <span>{undoToolStrings.name}</span>\r\n </div>\r\n </button>\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
|
|
@@ -64,7 +64,7 @@ export class SolarExpert {
|
|
|
64
64
|
state.settings.language = this.language;
|
|
65
65
|
const isIPhone = navigator.userAgent.indexOf("iPhone") != -1;
|
|
66
66
|
const isMac = navigator.userAgent.indexOf("Mac OS") != -1;
|
|
67
|
-
state.isIOS = isIPhone || isMac
|
|
67
|
+
state.isIOS = isIPhone || isMac;
|
|
68
68
|
if (!this.colorScheme) {
|
|
69
69
|
applyThemeToElement(this.el, DEFAULT_COLOR_SCHEME);
|
|
70
70
|
applyThemeGlobally(DEFAULT_COLOR_SCHEME);
|
|
@@ -128,7 +128,7 @@ export class SolarExpert {
|
|
|
128
128
|
}
|
|
129
129
|
render() {
|
|
130
130
|
const t = getLanguageStrings(this.language);
|
|
131
|
-
return (h("div", { key: '
|
|
131
|
+
return (h("div", { key: 'f9bac9f41ec94a5dd11f85477fc8f739faa7f909', class: "flex flex-col w-full h-full p-3 m-auto", id: "solar-calculator" }, this.showMapSelector
|
|
132
132
|
? (h("map-selector", { "api-key": this.apiKey, language: this.language }))
|
|
133
133
|
: (h(h.Fragment, null, h("div", { class: "pb-3 flex flex-row gap-4 items-stretch w-full" }, h("div", { class: "relative flex-3" }, h("div", { class: "absolute left-3 top-0 h-full flex items-center text-muted-foreground pointer-events-none" }, h("search-icon", null)), h("input", { ref: (el) => this.inputElement = el, type: "text", placeholder: t.solarExpert
|
|
134
134
|
.searchPlaceholder, class: "w-full pl-10 pr-4 py-2 border border-border rounded-4xl focus:ring-secondary bg-muted text-muted-foreground h-full" })), h("button", { onClick: () => this.handleChooseOnMap(), class: "flex-1 pl-4 pr-4 py-2 border border-border bg-muted rounded-4xl focus:ring-secondary hover:bg-secondary hover:text-muted" }, t.mapSelector.chooseOnMap)), h("map-draw", { apiKey: this.apiKey })))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solar-expert.js","sourceRoot":"","sources":["../../../src/components/solar-expert/solar-expert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, Element, Env, h, Prop, State, Watch } from \"@stencil/core\";\r\nimport { Loader } from \"@googlemaps/js-api-loader\";\r\nimport { Language } from \"../../types/lang\";\r\nimport { getLanguageStrings } from \"../../utils/lang/general\";\r\nimport { onChange, state } from \"../../store\";\r\nimport { ColorScheme, DEFAULT_COLOR_SCHEME } from \"../../config\";\r\nimport { applyThemeGlobally, applyThemeToElement } from \"../../utils/theme\";\r\n\r\n@Component({\r\n tag: \"solar-expert\",\r\n shadow: false,\r\n styleUrl: \"../../output.css\",\r\n})\r\nexport class SolarExpert {\r\n @Element()\r\n el!: HTMLElement;\r\n\r\n @Prop()\r\n apiKey: string = Env.GOOGLE_MAPS_API_KEY;\r\n @Prop()\r\n language: Language = \"en\";\r\n @Prop()\r\n colorScheme: Partial<ColorScheme> | null = null;\r\n // {\r\n // primary: \"hsl(0 0% 100%)\",\r\n // secondary: \"hsl(0 0% 100%)\",\r\n // tertiary: \"hsl(0 0% 100%)\",\r\n // muted: \"hsl(0 0% 100%)\",\r\n // error: \"hsl(0 0% 100%)\",\r\n // // secondary: \"hsl(180 100% 25%)\",\r\n // // tertiary: \"hsl(24 100% 18%)\",\r\n // // muted: \"hsl(0 0% 85%)\",\r\n // // error: \"hsl(240 75% 29%)\",\r\n // primaryForeground: \"hsl(0 0% 100%)\",\r\n // secondaryForeground: \"hsl(0 0% 100%)\",\r\n // tertiaryForeground: \"hsl(0 0% 100%)\",\r\n // mutedForeground: \"hsl(0 0% 100%)\",\r\n // errorForeground: \"hsl(0 0% 100%)\",\r\n // surface: \"hsl(0 0% 100%)\",\r\n // surfaceHover: \"hsl(0 0% 100%)\",\r\n // surfaceActive: \"hsl(0 0% 100%)\",\r\n // // Text colors\r\n // textMuted: \"hsl(0 0% 100%)\",\r\n // textSecondary: \"hsl(0 0% 100%)\",\r\n // textPlaceholder: \"hsl(0 0% 100%)\",\r\n // // Border colors\r\n // border: \"hsl(0 0% 100%)\",\r\n // borderLight: \"hsl(0 0% 100%)\",\r\n // // Status colors\r\n // success: \"hsl(0 0% 100%)\",\r\n // info: \"hsl(0 0% 100%)\",\r\n // // Interactive colors\r\n // hover: \"hsl(0 0% 100%)\",\r\n // hoverDark: \"hsl(0 0% 100%)\",\r\n // overlay: \"hsl(0 0% 100%)\",\r\n // tooltip: \"hsl(0 0% 100%)\",\r\n // };\r\n\r\n @State()\r\n latitude: number | null = 40.581614;\r\n @State()\r\n longitude: number | null = -4.128423;\r\n @State()\r\n isLoaded: boolean = false;\r\n @State()\r\n autocomplete: google.maps.places.Autocomplete | null = null;\r\n @State()\r\n place: google.maps.places.PlaceResult | null = null;\r\n @State()\r\n showMapSelector: boolean = false;\r\n\r\n private inputElement?: HTMLInputElement;\r\n\r\n componentWillLoad() {\r\n state.isMobile =\r\n /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i\r\n .test(navigator.userAgent) || window.innerWidth < 768;\r\n this.loadGoogleMapsScript();\r\n onChange(\"latitude\", () => {\r\n if (this.showMapSelector) {\r\n this.showMapSelector = false;\r\n this.scrollToMapDraw();\r\n }\r\n });\r\n state.settings.language = this.language;\r\n\r\n const isIPhone = navigator.userAgent.indexOf(\"iPhone\") != -1;\r\n const isMac = navigator.userAgent.indexOf(\"Mac OS\") != -1;\r\n\r\n state.isIOS = isIPhone || isMac || true;\r\n if (!this.colorScheme) {\r\n applyThemeToElement(this.el, DEFAULT_COLOR_SCHEME);\r\n applyThemeGlobally(DEFAULT_COLOR_SCHEME);\r\n }\r\n this.applyTheme();\r\n }\r\n\r\n @Watch(\"colorScheme\")\r\n colorSchemeChanged() {\r\n this.applyTheme();\r\n }\r\n\r\n private applyTheme() {\r\n if (this.colorScheme) {\r\n // Apply theme globally for non-shadow components\r\n applyThemeGlobally(this.colorScheme);\r\n // Apply theme to this component's Shadow DOM host element\r\n applyThemeToElement(this.el, this.colorScheme);\r\n }\r\n }\r\n\r\n private async loadGoogleMapsScript() {\r\n try {\r\n const loader = new Loader({\r\n apiKey: this.apiKey,\r\n libraries: [\"places\", \"maps\", \"marker\"],\r\n });\r\n\r\n const places = await loader.importLibrary(\"places\");\r\n this.isLoaded = true;\r\n this.initializeAutocomplete(places);\r\n } catch (error) {\r\n console.error(\"Error loading Google Maps: \", error);\r\n }\r\n }\r\n\r\n private initializeAutocomplete(\r\n places: google.maps.PlacesLibrary,\r\n ) {\r\n if (!this.inputElement || !this.isLoaded) return;\r\n this.autocomplete = new places.Autocomplete(this.inputElement);\r\n\r\n this.autocomplete.addListener(\"place_changed\", () => {\r\n const place = this.autocomplete?.getPlace();\r\n this.latitude = place?.geometry?.location?.lat() ?? 0;\r\n this.longitude = place?.geometry?.location?.lng() ?? 0;\r\n state.latitude = this.latitude;\r\n state.longitude = this.longitude;\r\n\r\n this.scrollToMapDraw();\r\n });\r\n }\r\n\r\n private scrollToMapDraw() {\r\n if (state.isMobile) {\r\n const solarSystemFormElement = this.el.querySelector(\r\n \"solar-system-form\",\r\n );\r\n if (solarSystemFormElement) {\r\n solarSystemFormElement.scrollIntoView({ behavior: \"smooth\" });\r\n }\r\n } else {\r\n const mapDrawElement = this.el.querySelector(\"map-draw\");\r\n if (mapDrawElement) {\r\n mapDrawElement.scrollIntoView({ behavior: \"smooth\" });\r\n }\r\n }\r\n }\r\n\r\n private handleChooseOnMap() {\r\n this.showMapSelector = true;\r\n }\r\n\r\n render() {\r\n const t = getLanguageStrings(this.language);\r\n return (\r\n <div\r\n class=\"flex flex-col w-full h-full p-3 m-auto\"\r\n id=\"solar-calculator\"\r\n >\r\n {this.showMapSelector\r\n ? (\r\n <map-selector\r\n api-key={this.apiKey}\r\n language={this.language}\r\n />\r\n )\r\n : (\r\n <>\r\n <div class=\"pb-3 flex flex-row gap-4 items-stretch w-full\">\r\n <div class=\"relative flex-3\">\r\n <div class=\"absolute left-3 top-0 h-full flex items-center text-muted-foreground pointer-events-none\">\r\n <search-icon />\r\n </div>\r\n <input\r\n ref={(el) => this.inputElement = el}\r\n type=\"text\"\r\n placeholder={t.solarExpert\r\n .searchPlaceholder}\r\n class=\"w-full pl-10 pr-4 py-2 border border-border rounded-4xl focus:ring-secondary bg-muted text-muted-foreground h-full\"\r\n />\r\n </div>\r\n <button\r\n onClick={() => this.handleChooseOnMap()}\r\n class=\"flex-1 pl-4 pr-4 py-2 border border-border bg-muted rounded-4xl focus:ring-secondary hover:bg-secondary hover:text-muted\"\r\n >\r\n {t.mapSelector.chooseOnMap}\r\n </button>\r\n </div>\r\n <map-draw\r\n apiKey={this.apiKey}\r\n />\r\n </>\r\n )}\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"solar-expert.js","sourceRoot":"","sources":["../../../src/components/solar-expert/solar-expert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAe,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAO5E,MAAM,OAAO,WAAW;IAEpB,EAAE,CAAe;IAGjB,MAAM,GAAW,GAAG,CAAC,mBAAmB,CAAC;IAEzC,QAAQ,GAAa,IAAI,CAAC;IAE1B,WAAW,GAAgC,IAAI,CAAC;IAChD,IAAI;IACJ,iCAAiC;IACjC,mCAAmC;IACnC,kCAAkC;IAClC,+BAA+B;IAC/B,+BAA+B;IAC/B,yCAAyC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;QAC5C,OAAO,CACH,4DACI,KAAK,EAAC,wCAAwC,EAC9C,EAAE,EAAC,kBAAkB,IAEpB,IAAI,CAAC,eAAe;YACjB,CAAC,CAAC,CACE,+BACa,IAAI,CAAC,MAAM,EACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ,GACzB,CACL;YACD,CAAC,CAAC,CACE;gBACI,WAAK,KAAK,EAAC,+CAA+C;oBACtD,WAAK,KAAK,EAAC,iBAAiB;wBACxB,WAAK,KAAK,EAAC,0FAA0F;4BACjG,sBAAe,CACb;wBACN,aACI,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,GAAG,EAAE,EACnC,IAAI,EAAC,MAAM,EACX,WAAW,EAAE,CAAC,CAAC,WAAW;iCACrB,iBAAiB,EACtB,KAAK,EAAC,oHAAoH,GAC5H,CACA;oBACN,cACI,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,EACvC,KAAK,EAAC,0HAA0H,IAE/H,CAAC,CAAC,WAAW,CAAC,WAAW,CACrB,CACP;gBACN,gBACI,MAAM,EAAE,IAAI,CAAC,MAAM,GACrB,CACH,CACN,CACH,CACT,CAAC;IACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, Element, Env, h, Prop, State, Watch } from \"@stencil/core\";\r\nimport { Loader } from \"@googlemaps/js-api-loader\";\r\nimport { Language } from \"../../types/lang\";\r\nimport { getLanguageStrings } from \"../../utils/lang/general\";\r\nimport { onChange, state } from \"../../store\";\r\nimport { ColorScheme, DEFAULT_COLOR_SCHEME } from \"../../config\";\r\nimport { applyThemeGlobally, applyThemeToElement } from \"../../utils/theme\";\r\n\r\n@Component({\r\n tag: \"solar-expert\",\r\n shadow: false,\r\n styleUrl: \"../../output.css\",\r\n})\r\nexport class SolarExpert {\r\n @Element()\r\n el!: HTMLElement;\r\n\r\n @Prop()\r\n apiKey: string = Env.GOOGLE_MAPS_API_KEY;\r\n @Prop()\r\n language: Language = \"en\";\r\n @Prop()\r\n colorScheme: Partial<ColorScheme> | null = null;\r\n // {\r\n // primary: \"hsl(0 0% 100%)\",\r\n // secondary: \"hsl(0 0% 100%)\",\r\n // tertiary: \"hsl(0 0% 100%)\",\r\n // muted: \"hsl(0 0% 100%)\",\r\n // error: \"hsl(0 0% 100%)\",\r\n // // secondary: \"hsl(180 100% 25%)\",\r\n // // tertiary: \"hsl(24 100% 18%)\",\r\n // // muted: \"hsl(0 0% 85%)\",\r\n // // error: \"hsl(240 75% 29%)\",\r\n // primaryForeground: \"hsl(0 0% 100%)\",\r\n // secondaryForeground: \"hsl(0 0% 100%)\",\r\n // tertiaryForeground: \"hsl(0 0% 100%)\",\r\n // mutedForeground: \"hsl(0 0% 100%)\",\r\n // errorForeground: \"hsl(0 0% 100%)\",\r\n // surface: \"hsl(0 0% 100%)\",\r\n // surfaceHover: \"hsl(0 0% 100%)\",\r\n // surfaceActive: \"hsl(0 0% 100%)\",\r\n // // Text colors\r\n // textMuted: \"hsl(0 0% 100%)\",\r\n // textSecondary: \"hsl(0 0% 100%)\",\r\n // textPlaceholder: \"hsl(0 0% 100%)\",\r\n // // Border colors\r\n // border: \"hsl(0 0% 100%)\",\r\n // borderLight: \"hsl(0 0% 100%)\",\r\n // // Status colors\r\n // success: \"hsl(0 0% 100%)\",\r\n // info: \"hsl(0 0% 100%)\",\r\n // // Interactive colors\r\n // hover: \"hsl(0 0% 100%)\",\r\n // hoverDark: \"hsl(0 0% 100%)\",\r\n // overlay: \"hsl(0 0% 100%)\",\r\n // tooltip: \"hsl(0 0% 100%)\",\r\n // };\r\n\r\n @State()\r\n latitude: number | null = 40.581614;\r\n @State()\r\n longitude: number | null = -4.128423;\r\n @State()\r\n isLoaded: boolean = false;\r\n @State()\r\n autocomplete: google.maps.places.Autocomplete | null = null;\r\n @State()\r\n place: google.maps.places.PlaceResult | null = null;\r\n @State()\r\n showMapSelector: boolean = false;\r\n\r\n private inputElement?: HTMLInputElement;\r\n\r\n componentWillLoad() {\r\n state.isMobile =\r\n /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i\r\n .test(navigator.userAgent) || window.innerWidth < 768;\r\n this.loadGoogleMapsScript();\r\n onChange(\"latitude\", () => {\r\n if (this.showMapSelector) {\r\n this.showMapSelector = false;\r\n this.scrollToMapDraw();\r\n }\r\n });\r\n state.settings.language = this.language;\r\n\r\n const isIPhone = navigator.userAgent.indexOf(\"iPhone\") != -1;\r\n const isMac = navigator.userAgent.indexOf(\"Mac OS\") != -1;\r\n\r\n state.isIOS = isIPhone || isMac;\r\n if (!this.colorScheme) {\r\n applyThemeToElement(this.el, DEFAULT_COLOR_SCHEME);\r\n applyThemeGlobally(DEFAULT_COLOR_SCHEME);\r\n }\r\n this.applyTheme();\r\n }\r\n\r\n @Watch(\"colorScheme\")\r\n colorSchemeChanged() {\r\n this.applyTheme();\r\n }\r\n\r\n private applyTheme() {\r\n if (this.colorScheme) {\r\n // Apply theme globally for non-shadow components\r\n applyThemeGlobally(this.colorScheme);\r\n // Apply theme to this component's Shadow DOM host element\r\n applyThemeToElement(this.el, this.colorScheme);\r\n }\r\n }\r\n\r\n private async loadGoogleMapsScript() {\r\n try {\r\n const loader = new Loader({\r\n apiKey: this.apiKey,\r\n libraries: [\"places\", \"maps\", \"marker\"],\r\n });\r\n\r\n const places = await loader.importLibrary(\"places\");\r\n this.isLoaded = true;\r\n this.initializeAutocomplete(places);\r\n } catch (error) {\r\n console.error(\"Error loading Google Maps: \", error);\r\n }\r\n }\r\n\r\n private initializeAutocomplete(\r\n places: google.maps.PlacesLibrary,\r\n ) {\r\n if (!this.inputElement || !this.isLoaded) return;\r\n this.autocomplete = new places.Autocomplete(this.inputElement);\r\n\r\n this.autocomplete.addListener(\"place_changed\", () => {\r\n const place = this.autocomplete?.getPlace();\r\n this.latitude = place?.geometry?.location?.lat() ?? 0;\r\n this.longitude = place?.geometry?.location?.lng() ?? 0;\r\n state.latitude = this.latitude;\r\n state.longitude = this.longitude;\r\n\r\n this.scrollToMapDraw();\r\n });\r\n }\r\n\r\n private scrollToMapDraw() {\r\n if (state.isMobile) {\r\n const solarSystemFormElement = this.el.querySelector(\r\n \"solar-system-form\",\r\n );\r\n if (solarSystemFormElement) {\r\n solarSystemFormElement.scrollIntoView({ behavior: \"smooth\" });\r\n }\r\n } else {\r\n const mapDrawElement = this.el.querySelector(\"map-draw\");\r\n if (mapDrawElement) {\r\n mapDrawElement.scrollIntoView({ behavior: \"smooth\" });\r\n }\r\n }\r\n }\r\n\r\n private handleChooseOnMap() {\r\n this.showMapSelector = true;\r\n }\r\n\r\n render() {\r\n const t = getLanguageStrings(this.language);\r\n return (\r\n <div\r\n class=\"flex flex-col w-full h-full p-3 m-auto\"\r\n id=\"solar-calculator\"\r\n >\r\n {this.showMapSelector\r\n ? (\r\n <map-selector\r\n api-key={this.apiKey}\r\n language={this.language}\r\n />\r\n )\r\n : (\r\n <>\r\n <div class=\"pb-3 flex flex-row gap-4 items-stretch w-full\">\r\n <div class=\"relative flex-3\">\r\n <div class=\"absolute left-3 top-0 h-full flex items-center text-muted-foreground pointer-events-none\">\r\n <search-icon />\r\n </div>\r\n <input\r\n ref={(el) => this.inputElement = el}\r\n type=\"text\"\r\n placeholder={t.solarExpert\r\n .searchPlaceholder}\r\n class=\"w-full pl-10 pr-4 py-2 border border-border rounded-4xl focus:ring-secondary bg-muted text-muted-foreground h-full\"\r\n />\r\n </div>\r\n <button\r\n onClick={() => this.handleChooseOnMap()}\r\n class=\"flex-1 pl-4 pr-4 py-2 border border-border bg-muted rounded-4xl focus:ring-secondary hover:bg-secondary hover:text-muted\"\r\n >\r\n {t.mapSelector.chooseOnMap}\r\n </button>\r\n </div>\r\n <map-draw\r\n apiKey={this.apiKey}\r\n />\r\n </>\r\n )}\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
|
|
@@ -3,6 +3,7 @@ import { DEFAULT_SOLAR_PANEL_TYPE } from "../../config";
|
|
|
3
3
|
import { getLanguageStrings } from "../../utils/lang/general";
|
|
4
4
|
import { state } from "../../store";
|
|
5
5
|
import { generateElectricCarChargingHours, simulate, } from "../../utils/simulation/simulation";
|
|
6
|
+
import { HEAT_PUMP_CONSUMPTION } from "../../constants";
|
|
6
7
|
export class SolarSystemForm {
|
|
7
8
|
systemConfigs = {};
|
|
8
9
|
roofPolygons = {};
|
|
@@ -41,6 +42,16 @@ export class SolarSystemForm {
|
|
|
41
42
|
.kWattPeak;
|
|
42
43
|
this.recalculate();
|
|
43
44
|
}
|
|
45
|
+
formatEuropeanNumber(num, decimals = 2) {
|
|
46
|
+
const fixed = num.toFixed(decimals);
|
|
47
|
+
const [integerPart, decimalPart] = fixed.split(".");
|
|
48
|
+
// Add dots as thousands separators
|
|
49
|
+
const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
50
|
+
// Join with comma as decimal separator
|
|
51
|
+
return decimalPart
|
|
52
|
+
? `${formattedInteger},${decimalPart}`
|
|
53
|
+
: formattedInteger;
|
|
54
|
+
}
|
|
44
55
|
recalculate() {
|
|
45
56
|
const simulationConfig = {
|
|
46
57
|
general: {
|
|
@@ -84,7 +95,7 @@ export class SolarSystemForm {
|
|
|
84
95
|
const result = simulate(simulationConfig);
|
|
85
96
|
this.compensation25Years = result.compensationPerDay * 365 * 25;
|
|
86
97
|
this.savedCosts25Years = result.byYearSavedCosts.reduce((acc, curr) => acc + curr, 0);
|
|
87
|
-
this.costSavings = result.
|
|
98
|
+
this.costSavings = result.byYearSavedCosts[0];
|
|
88
99
|
this.autonomy = result.autonomy * 100;
|
|
89
100
|
}
|
|
90
101
|
componentWillLoad() {
|
|
@@ -137,13 +148,13 @@ export class SolarSystemForm {
|
|
|
137
148
|
}
|
|
138
149
|
render() {
|
|
139
150
|
const t = getLanguageStrings(state.settings.language);
|
|
140
|
-
return (h("div", { key: '
|
|
151
|
+
return (h("div", { key: '54ae8ac6f38ee6b69f0b744e0c63ef7d64b14935', class: "flex flex-col justify-center items-center w-full h-full pt-4" // style={{
|
|
141
152
|
,
|
|
142
153
|
// display: (Object.keys(this.systemConfigs).length === 0)
|
|
143
154
|
// ? "none"
|
|
144
155
|
// : "flex",
|
|
145
156
|
// }}
|
|
146
|
-
id: "solar-system-form" }, h("h1", { key: '
|
|
157
|
+
id: "solar-system-form" }, h("h1", { key: '02743af3ca750b419cd815fb1fc3fde328b0b288', class: "text-2xl font-bold text-secondary mb-4 w-full" }, t.solarSystemForm.title), h("div", { key: '3a71e7d1fcd5c3eaac9fd31251a503b0004868d9', class: "w-full bg-primary rounded-4xl p-6 space-y-6" }, h("div", { key: '331105ccd59c18236423d1e1e5e43eea7cf491e9', class: "space-y-4" }, h("h2", { key: '31a17a2198080f06c51cf49338a1055ae2bb2e21', class: "text-lg font-semibold text-secondary" }, t.solarSystemForm.systemInformation), h("div", { key: '7909de26291c67bdd83aacb0e08874a92698877f', class: "grid grid-rows-3 gap-0" }, h("div", { key: '8664dee7e53df21b25a8a1af4f007dca533b34c6', class: "grid grid-cols-2 gap-4" }, h("label", { key: '24f58513ed901c3660407ba5fdce3481551bb269', class: "block text-sm font-medium text-text-muted mb-1" }, t.solarSystemForm.numberOfPanels), h("label", { key: '18b456396e4bf074ec6f51ec85d6fc25574278f0', class: "block text-sm font-medium text-text-muted mb-1" }, t.solarSystemForm.panelPeakPower)), h("div", { key: 'bb3552536aca95d954c98a5ec064b47fb64789c5', class: "grid grid-cols-2 gap-4" }, !this.isIOS()
|
|
147
158
|
? (h("input", { type: "number", class: "w-full px-4 py-2 rounded-4xl border border-border focus:ring-2 focus:ring-tertiary focus:border-transparent bg-muted text-muted-foreground", value: this.numberOfPanels, readOnly: true }))
|
|
148
159
|
: (h("input", { type: "number", min: "1", max: this.maxPanels, class: "flex-1 px-4 py-2 rounded-4xl border border-border focus:ring-2 focus:ring-tertiary focus:border-transparent bg-muted text-muted-foreground", value: this.numberOfPanels, onInput: (e) => {
|
|
149
160
|
const value = parseInt(e.target
|
|
@@ -154,36 +165,36 @@ export class SolarSystemForm {
|
|
|
154
165
|
this.numberOfPanels = value;
|
|
155
166
|
this.recalculate();
|
|
156
167
|
}
|
|
157
|
-
} })), h("input", { key: '
|
|
158
|
-
(h("input", { key: '
|
|
168
|
+
} })), h("input", { key: '92d8ad7d12e18c297b683b5b12c4a1ef07a49dc5', type: "number", class: "w-full px-4 py-2 rounded-4xl border border-border focus:ring-2 focus:ring-tertiary focus:border-transparent bg-muted text-muted-foreground", value: this.panelPeakPower, readonly: true })), h("div", { key: 'b0c3127cbb24691ded2f229c67e015915cf45451', class: "grid grid-cols-2 gap-4" }, h("div", { key: '826c3adcd8d127ab9af26836715241389e26f4c7', class: "w-full pt-2" }, !this.isIOS() &&
|
|
169
|
+
(h("input", { key: '50af1ab53be7ca292bf4f0c652fdf4742141d784', type: "range", min: "1", max: this.maxPanels, step: "1", class: "input-slider w-full custom-range appearance-none rounded-full bg-transparent [&::-webkit-slider-runnable-track]:rounded-full [&::-webkit-slider-runnable-track]:bg-black/25 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:h-[10px] [&::-webkit-slider-thumb]:w-[10px] [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-muted", value: this.numberOfPanels, onInput: (e) => {
|
|
159
170
|
this.numberOfPanels =
|
|
160
171
|
parseInt(e.target
|
|
161
172
|
.value);
|
|
162
173
|
this.recalculate();
|
|
163
|
-
} }))))), h("div", { key: '
|
|
164
|
-
this.numberOfPanels).toFixed(1), " kW")))), h("div", { key: '
|
|
174
|
+
} }))))), h("div", { key: '0d07fec98799e61dbb496d71dc5fcda87ea121d9', class: "bg-muted rounded-4xl p-4" }, h("div", { key: 'f13fcf447f3e457eff48ebd3b84ab9e03b07043c', class: "flex items-center justify-between" }, h("span", { key: '72cd250034d8163624780a7d7693d0410ee4e410', class: "text-text-muted" }, t.solarSystemForm.totalSystemPeakPower), h("span", { key: 'c962284ec7b7997881c70e619bbccb4842693726', class: "text-xl font-bold text-secondary" }, (DEFAULT_SOLAR_PANEL_TYPE.kWattPeak *
|
|
175
|
+
this.numberOfPanels).toFixed(1), " kW")))), h("div", { key: '3e485240e8c3097c3eeb132f88a78499ff008d02', class: "space-y-4" }, h("h2", { key: 'd8921b1e78515483b22436b7f530a1bc30fffc07', class: "text-lg font-semibold text-secondary" }, t.solarSystemForm.householdConsumptionTitle), h("div", { key: '1b429ce292e4ce8491609588d50c77dcdb2889df', class: "grid grid-rows-2 gap-0" }, h("div", { key: '73f977fb97ca42f0224f6574b233ec0d1099c99f', class: "grid grid-cols-2 gap-4" }, h("label", { key: 'dc3bd8a75017ae3f6213a5b1a17ba519e53be4e5', class: "block text-sm font-medium text-text-muted" }, t.solarSystemForm.annualConsumption), h("label", { key: 'd112f9634beb0aaad834de5f1eb663c9ba94b376', class: "block text-sm font-medium text-text-muted" }, t.solarSystemForm.consumptionProfileTitle)), h("div", { key: '05bf6fae443e9732923744faa0d38347a4c73b4b', class: "grid grid-cols-2 gap-4" }, h("input", { key: '0d1b4152b6847de4f389e08cfa4816ecff33f6f0', type: "number", class: "w-full px-4 py-2 rounded-4xl border border-border focus:ring-2 focus:ring-tertiary focus:border-transparent bg-muted text-muted-foreground", value: this.householdConsumption, onInput: (e) => {
|
|
165
176
|
this.householdConsumption = parseInt(e.target
|
|
166
177
|
.value);
|
|
167
178
|
this.recalculate();
|
|
168
|
-
} }), h("select", { key: '
|
|
179
|
+
} }), h("select", { key: 'e871185bee56c07cb3b63786bb4b93ea7b041251', class: "w-full px-4 py-2 rounded-4xl border border-border focus:ring-2 focus:ring-tertiary focus:border-transparent bg-muted text-muted-foreground", onChange: (e) => {
|
|
169
180
|
this.consumptionProfile =
|
|
170
181
|
e.target
|
|
171
182
|
.value;
|
|
172
183
|
this.recalculate();
|
|
173
|
-
} }, h("option", { key: '
|
|
184
|
+
} }, h("option", { key: 'b5cedc71aea907231bb460bd57d623c72e4f4358', value: "mostly_at_home", selected: this.consumptionProfile ===
|
|
174
185
|
"mostly_at_home" }, t.solarSystemForm.consumptionProfiles
|
|
175
|
-
.mostlyAtHome), h("option", { key: '
|
|
186
|
+
.mostlyAtHome), h("option", { key: 'a4ae3edb18d7fff9f661e0ff7eba7ead4b599928', value: "mostly_away", selected: this.consumptionProfile ===
|
|
176
187
|
"mostly_away" }, t.solarSystemForm.consumptionProfiles
|
|
177
|
-
.mostlyAway))))), h("div", { key: '
|
|
188
|
+
.mostlyAway))))), h("div", { key: '43429573a2fd47f40b31f995f48bf9f642783357', class: "space-y-4" }, h("h2", { key: '830462bd52e14b52d207b7814f191875e0bffa24', class: "text-lg font-semibold text-secondary" }, t.solarSystemForm.additionalComponents.title), h("div", { key: '74ab7b371ba17bb9fc336695aba3036a36154cf1', class: "flex flex-col gap-4" }, h("div", { key: '54dd4ca5913d5b59add38da17d8ebb9e800f56f1', class: "flex flex-col bg-muted rounded-4xl p-4 gap-4" }, h("div", { key: '7220b78ceae0ee40ff07b0032c0731aff3f8e0ab', class: "flex items-center justify-between" }, h("div", { key: '04a8069a311561627bf545fd9bcceed60c4c8fac', class: "flex items-center gap-2" }, h("input", { key: '0f2151269cade204b5a3a8056d5c27c551a877ee', type: "checkbox", id: "heatPump", class: "w-4 h-4 accent-tertiary border-border rounded-full focus:ring-tertiary focus:ring-offset-0 focus:ring-2", checked: this.heatPump > 0, onChange: (e) => {
|
|
178
189
|
this.heatPump =
|
|
179
190
|
e.target
|
|
180
191
|
.checked
|
|
181
192
|
? 100
|
|
182
193
|
: 0;
|
|
183
194
|
this.recalculate();
|
|
184
|
-
} }), h("label", { key: '
|
|
195
|
+
} }), h("label", { key: '0e5e18b56b24d1b68613a71c6adafdec7ba30e26', htmlFor: "heatPump", class: "text-text-muted" }, t.solarSystemForm
|
|
185
196
|
.additionalComponents
|
|
186
|
-
.heatPump)), (this.heatPump > 0 && !this.isIOS()) && (h("span", { key: '
|
|
197
|
+
.heatPump)), (this.heatPump > 0 && !this.isIOS()) && (h("span", { key: '2d87021c97585d2b716b56e518d7f7bbc0043f7e', class: "text-text-muted" }, this.heatPump, " m\u00B2"))), this.heatPump > 0 && (h("div", { key: '0b3fcceef3eeaa77d136226ec8d62627f0f1862a', class: "flex flex-col gap-2" }, this.isIOS()
|
|
187
198
|
? (h("div", { class: "flex items-center gap-2" }, h("input", { type: "number", min: "10", max: "300", step: "10", class: "flex-1 px-4 py-2 rounded-4xl border border-border focus:ring-2 focus:ring-tertiary focus:border-transparent bg-muted", style: {
|
|
188
199
|
border: "1px solid var(--color-border)",
|
|
189
200
|
}, value: this.heatPump, onInput: (e) => {
|
|
@@ -201,41 +212,41 @@ export class SolarSystemForm {
|
|
|
201
212
|
parseInt(e.target
|
|
202
213
|
.value);
|
|
203
214
|
this.recalculate();
|
|
204
|
-
} }))))), h("div", { key: '
|
|
215
|
+
} }))))), h("div", { key: 'a24607f315a2944990f039394b6091ad63e20720', class: "flex flex-col bg-muted rounded-4xl p-4 gap-4" }, h("div", { key: '0bff87ab8748f1b25f4b4e1442802307ae21ca45', class: "flex items-center justify-between" }, h("div", { key: '6ce2554bc8d6f36dfc723cf39b44cec7c66ce574', class: "flex items-center gap-2" }, h("input", { key: 'fee9af7857e139ecfe08c9acc75b5bc160441dcd', type: "checkbox", id: "electricCar", class: "w-4 h-4 accent-tertiary border-border rounded focus:ring-tertiary focus:ring-offset-0 focus:ring-2", checked: this.electricCar, onChange: (e) => {
|
|
205
216
|
this.electricCar =
|
|
206
217
|
e.target
|
|
207
218
|
.checked;
|
|
208
219
|
this.recalculate();
|
|
209
|
-
} }), h("label", { key: '
|
|
220
|
+
} }), h("label", { key: '2d1a9dbcdb418231efddd0c81486f707093eb956', htmlFor: "electricCar", class: "text-text-muted" }, t.solarSystemForm
|
|
210
221
|
.additionalComponents
|
|
211
|
-
.electricCar))), this.electricCar && (h("div", { key: '
|
|
222
|
+
.electricCar))), this.electricCar && (h("div", { key: '0099c8d5704f9b4d41ca5c1143feb487d8b9b9f4', class: "flex flex-col gap-2" }, h("div", { key: '03515c7a59dac82123bc8f0bcd491af21c5f7353', class: "grid grid-cols-2 gap-4" }, h("label", { key: 'b90b47cbdd7f2761949dea631402b77d0cfd28b1', class: "text-sm text-text-muted" }, t.solarSystemForm
|
|
212
223
|
.additionalComponents
|
|
213
|
-
.chargingTime), h("label", { key: '
|
|
224
|
+
.chargingTime), h("label", { key: 'ac6ea4a40d40f11f65ce18dfd1a4da8b5cf33dfb', class: "text-sm text-text-muted" }, t.solarSystemForm
|
|
214
225
|
.additionalComponents
|
|
215
|
-
.kilometersPerYear)), h("div", { key: '
|
|
226
|
+
.kilometersPerYear)), h("div", { key: '03ed3eb147b16b0a0bc968d83ed811341ed9f766', class: "grid grid-cols-2 gap-4" }, h("select", { key: '2d6201c807ae6f9713b6c7efd4fb47d4673df6db', class: "w-full px-4 py-2 rounded-4xl border border-border focus:ring-2 focus:ring-tertiary focus:border-transparent bg-muted", onChange: (e) => {
|
|
216
227
|
this.electricCarChargingTime =
|
|
217
228
|
e.target
|
|
218
229
|
.value;
|
|
219
230
|
this.recalculate();
|
|
220
231
|
}, style: {
|
|
221
232
|
border: "1px solid var(--color-border)",
|
|
222
|
-
} }, h("option", { key: '
|
|
233
|
+
} }, h("option", { key: 'f05e82478fdf651ed90c36ed3e2b3f3ef815990f', value: "day", selected: this
|
|
223
234
|
.electricCarChargingTime ===
|
|
224
235
|
"day" }, t.solarSystemForm
|
|
225
236
|
.additionalComponents
|
|
226
|
-
.chargingTimeDay), h("option", { key: '
|
|
237
|
+
.chargingTimeDay), h("option", { key: 'a74c9a39d468cda1be903f5b95e8060c6ee24b52', value: "night", selected: this
|
|
227
238
|
.electricCarChargingTime ===
|
|
228
239
|
"night" }, t.solarSystemForm
|
|
229
240
|
.additionalComponents
|
|
230
|
-
.chargingTimeNight)), h("input", { key: '
|
|
241
|
+
.chargingTimeNight)), h("input", { key: 'ca2d32d22bb3bd55f79eab13ed6bf1b106c0d1a8', type: "number", min: "1000", max: "50000", step: "1000", class: "w-full px-4 py-2 rounded-4xl border border-border focus:ring-2 focus:ring-tertiary focus:border-transparent bg-muted", value: this.kmDrivenPerYear, onInput: (e) => {
|
|
231
242
|
this.kmDrivenPerYear =
|
|
232
243
|
parseInt(e.target
|
|
233
244
|
.value);
|
|
234
245
|
this.recalculate();
|
|
235
246
|
}, style: {
|
|
236
247
|
border: "1px solid var(--color-border)",
|
|
237
|
-
} }))))), h("div", { key: '
|
|
238
|
-
.battery), !this.isIOS() && (h("span", { key: '
|
|
248
|
+
} }))))), h("div", { key: 'e221294fb0f0facc8c1e421cca3947fd2d942428', class: "flex flex-col bg-muted rounded-4xl p-4 gap-4" }, h("div", { key: 'f0253c7f6d43717ce59b28ae1d99c92dc111e3ac', class: "flex items-center justify-between" }, h("label", { key: 'e2fc797a71aa62638749696fb320b7f8d161c662', class: "text-text-muted" }, t.solarSystemForm.additionalComponents
|
|
249
|
+
.battery), !this.isIOS() && (h("span", { key: 'dd61bfbc95a605663c4b72dd222b995ffb42e109', class: "text-text-muted" }, this.battery, " kWh"))), h("div", { key: '1c5c728fbcaa256f3afb935b778fc84eb2eb4767', class: "flex flex-col gap-2" }, this.isIOS()
|
|
239
250
|
? (h("div", { class: "flex items-center gap-2" }, h("input", { type: "number", min: "0", max: "20", step: "1", class: "flex-1 px-4 py-2 rounded-4xl border border-border focus:ring-2 focus:ring-tertiary focus:border-transparent bg-muted", value: this.battery, onInput: (e) => {
|
|
240
251
|
const value = parseInt(e.target
|
|
241
252
|
.value);
|
|
@@ -252,41 +263,54 @@ export class SolarSystemForm {
|
|
|
252
263
|
this.battery = parseInt(e.target
|
|
253
264
|
.value);
|
|
254
265
|
this.recalculate();
|
|
255
|
-
} })))))), h("div", { key: '
|
|
266
|
+
} })))))), h("div", { key: 'd2d8f2976dea1671bd61b46fd11611b215065b54', class: "space-y-4" }, h("h2", { key: '7cf8b9ebead489919985bfe4a43c1882e839df22', class: "text-lg font-semibold text-secondary" }, t.solarSystemForm.electricityCostsTitle), h("div", { key: 'd68713f19fe46986bd02d867fc48b8a29ba4c4b8', class: "grid grid-rows-2 gap-0" }, h("div", { key: 'b3044a3509c60decd0be125f3e48d1e1b1bda9b8', class: "grid grid-cols-3 gap-4" }, h("label", { key: '3d00cda38e85bc0211db156fd42bc13147a4e9b8', class: "block text-sm font-medium text-text-muted mb-1" }, t.solarSystemForm.electricityPrice), h("label", { key: 'deab7ae1cc17e62a8957884f103b4bc28100bd4e', class: "block text-sm font-medium text-text-muted mb-1" }, t.solarSystemForm.compensationRate), h("label", { key: 'd11b0dbd0bbd7e849a4238ec4fb59f229b3edab9', class: "block text-sm font-medium text-text-muted mb-1" }, t.solarSystemForm.annualPriceIncrease)), h("div", { key: 'a1b62f9c488b8f340a7eae0f45d50db22dcf8813', class: "grid grid-cols-3 gap-4 text-primary-foreground" }, h("input", { key: '89af074138e212d08e04791a122d7acdded16dae', type: "number", step: "0.01", class: "w-full px-4 py-2 rounded-4xl border border-border focus:ring-2 focus:ring-tertiary focus:border-transparent bg-muted", value: this.electricityPrice.toFixed(2), onInput: (e) => {
|
|
256
267
|
this.electricityPrice = parseFloat(e.target
|
|
257
268
|
.value);
|
|
258
269
|
this.recalculate();
|
|
259
|
-
} }), h("input", { key: '
|
|
270
|
+
} }), h("input", { key: '87300118e1ccb1ef6aa0fce4442405bca5589ecb', type: "number", step: "0.01", class: "w-full px-4 py-2 rounded-4xl border border-border focus:ring-2 focus:ring-tertiary focus:border-transparent bg-muted", value: this.compensationRate.toFixed(2), onInput: (e) => {
|
|
260
271
|
this.compensationRate = parseFloat(e.target
|
|
261
272
|
.value);
|
|
262
273
|
this.recalculate();
|
|
263
|
-
} }), h("input", { key: '
|
|
274
|
+
} }), h("input", { key: 'f062503fbfcbbdaf839483653b8dc80ca546a64b', type: "number", step: "0.1", class: "w-full px-4 py-2 rounded-4xl border border-border focus:ring-2 focus:ring-tertiary focus:border-transparent bg-muted", value: this.annualPriceIncrease.toFixed(1), onInput: (e) => {
|
|
264
275
|
this.annualPriceIncrease = parseFloat(e.target
|
|
265
276
|
.value);
|
|
266
277
|
this.recalculate();
|
|
267
|
-
} })))), h("div", { key: '
|
|
278
|
+
} })))), h("div", { key: 'aa2d6be869135594a4986996a731e3f944fd76a3', class: "space-y-4 p-4 border border-border rounded-4xl", style: {
|
|
268
279
|
border: "1px solid var(--color-border)",
|
|
269
|
-
} }, h("h2", { key: '
|
|
280
|
+
} }, h("h2", { key: '2f635ebdc17c5793b721ca754b2a0f57157698e7', class: "text-lg font-semibold text-secondary" }, t.solarSystemForm.resultsTitle), h("div", { key: '3791d46c9f40a737e25bbd445b5f559e79688116', class: "bg-muted rounded-4xl p-4" }, h("div", { key: 'df1a21d001ae742086730e4818400046f1241ef6', class: "flex items-center justify-between" }, h("span", { key: 'bc13c5be45a46f4cf9cd0580ebb585375d3d2fc3', class: "text-text-muted" }, t.solarSystemForm.autonomy), h("span", { key: 'd2095ecc11a533d9b2fd45258679e335e7315e1b', class: "text-xl font-bold text-secondary" }, this.autonomy > 100
|
|
270
281
|
? "100"
|
|
271
|
-
: this.autonomy
|
|
272
|
-
|
|
273
|
-
|
|
282
|
+
: this.formatEuropeanNumber(this.autonomy, 1), "%")), h("div", { key: '81898ca185bebeff0ccbf4f02c90decc5d862f09', class: "flex items-center justify-between mt-4" }, h("span", { key: 'caab8e25b9f38a2e76e1e0fe783457e355a1acb8', class: "text-text-muted" }, t.solarSystemForm.totalEnergyConsumption), h("span", { key: '6a0263eb84c3c5c584407dee9f82ae6768f2ba63', class: "text-xl font-bold text-secondary" }, (() => {
|
|
283
|
+
let total = this.householdConsumption;
|
|
284
|
+
// Add electric car consumption: km/year * 17kWh/100km
|
|
285
|
+
if (this.electricCar) {
|
|
286
|
+
total +=
|
|
287
|
+
(this.kmDrivenPerYear * 17) /
|
|
288
|
+
100;
|
|
289
|
+
}
|
|
290
|
+
// Add heat pump consumption: m2 * 60kWh/m2/year (typical estimate)
|
|
291
|
+
if (this.heatPump > 0) {
|
|
292
|
+
total += this.heatPump *
|
|
293
|
+
HEAT_PUMP_CONSUMPTION * 365;
|
|
294
|
+
}
|
|
295
|
+
return this.formatEuropeanNumber(total, 0);
|
|
296
|
+
})(), " kWh/", t.solarSystemForm.year)), h("div", { key: '6794dce452849c7af8e3d8c962d489a48963584d', class: "flex items-center justify-between mt-4" }, h("div", { key: '53c13901f579cce93526379a91a8e7eaaf6c548b', class: "flex items-center gap-2" }, h("span", { key: '850410fcbc8e2a6eab5ac09b8f9b479881a067bd', class: "text-text-muted" }, t.solarSystemForm.costSavings)), h("span", { key: 'e3da29831203391b74494151269a7df1aa1bc7b7', class: "text-xl font-bold text-success" }, this.formatEuropeanNumber(this.costSavings), "\u20AC/", t
|
|
297
|
+
.solarSystemForm.year)), h("div", { key: '501a7c259a7a93088e5ecdffc7a945caffc75311', class: "flex items-center justify-between mt-4" }, h("div", { key: '8217b4111bccf792ac61d0f58e2d3f7dc7809d8d', class: "flex items-center gap-2" }, h("span", { key: '1fb8e90aa8a90540091281dd6aa73a5cea29fbc0', class: "text-text-muted" }, "Einspeiseverg\u00FCtung 25 Jahre")), h("span", { key: '415fa94c170faae836208d4b9a677722f7203c8b', class: "text-xl font-bold text-success" }, this.formatEuropeanNumber(this.compensation25Years), "\u20AC")), h("div", { key: 'c1fc077620e3075ccaf8dc8ecc8c3c411412b345', class: "flex items-center justify-between mt-4" }, h("div", { key: 'd36ca61883ce3a8d4248df906db24ecaad0500c6', class: "flex items-center gap-2" }, h("span", { key: 'adf9c8da85d13387adf55e71d014486cf648548e', class: "text-text-muted" }, "Geldwerter Vorteil 25 Jahre")), h("span", { key: '9066fe1b8d495685389918503f50a1e6c7f13e66', class: "text-xl font-bold text-success" }, this.formatEuropeanNumber(this.savedCosts25Years), "\u20AC")))), h("div", { key: '8d904bfa8def92a4db3d54e8b5b491f0753e2dd3', class: "space-y-4 pt-4" }, h("h2", { key: '1a37b638d734f6474dbc3e748e6feaf183d5de7b', class: "text-lg font-semibold text-secondary" }, t.solarSystemForm.requestOffer), h("div", { key: '5d1a596d9b6324ec463f648bc820470d688da63a', class: "grid gap-4" }, h("div", { key: '24cfe4e44b713b0bbe717079a8c4017529afbc48', class: "grid grid-cols-2 gap-4" }, h("label", { key: '596f38dfbf796ffbc91c3bde3da96e0aee6123e3', class: "block text-sm font-medium text-text-muted mb-1" }, t.solarSystemForm.name), h("label", { key: '15f013c792373f86580d901b5df987d1d71126ce', class: "block text-sm font-medium text-text-muted mb-1" }, t.solarSystemForm.email)), h("div", { key: '73a6d732cff322b79fc6aa86e700b887126011d1', class: "grid grid-cols-2 gap-4" }, h("div", { key: '76dcc5d4d62731b255a05eaa366cd0e1ae1baee5' }, h("input", { key: '58eebcba6e3ffd91c6c427e654b2a54af57c4d8c', type: "text", class: `w-full px-4 py-2 rounded-4xl border ${this.nameError
|
|
274
298
|
? "border-error"
|
|
275
299
|
: "border-border"} focus:ring-2 focus:ring-tertiary focus:border-transparent bg-muted text-muted-foreground`, value: this.name, onInput: (e) => {
|
|
276
300
|
this.name =
|
|
277
301
|
e.target
|
|
278
302
|
.value;
|
|
279
303
|
this.validateForm();
|
|
280
|
-
}, placeholder: "Your name" }), this.nameError && (h("p", { key: '
|
|
304
|
+
}, placeholder: "Your name" }), this.nameError && (h("p", { key: '61f77bf18fe7f3d24a7d6323a7e7f3ca2f27f6ab', class: "text-error text-sm mt-1" }, this.nameError))), h("div", { key: 'a1e91db4a7c509bafe2002a3c93ada9ddf389aba' }, h("input", { key: '81cdb2b8ddc586145cb4b9c48f6bf0a521c8b955', type: "email", class: `w-full px-4 py-2 rounded-4xl border ${this.emailError
|
|
281
305
|
? "border-error"
|
|
282
306
|
: "border-border"} focus:ring-2 focus:ring-tertiary focus:border-transparent bg-muted text-muted-foreground`, value: this.email, onInput: (e) => {
|
|
283
307
|
this.email =
|
|
284
308
|
e.target
|
|
285
309
|
.value;
|
|
286
310
|
this.validateForm();
|
|
287
|
-
}, placeholder: "your.email@example.com" }), this.emailError && (h("p", { key: '
|
|
311
|
+
}, placeholder: "your.email@example.com" }), this.emailError && (h("p", { key: 'b8f6f0daf8ccb035fbbc6a8d1752faf652684085', class: "text-error text-sm mt-1" }, this.emailError))))), h("div", { key: '0c85591ef6c2ea28df6990a66b0f32daf6378683', class: "flex justify-center" }, h("button", { key: '1d64eed72404031a2a6e7e0ef4e6966591d86f6a', onClick: () => this.handleRequestOffer(), disabled: !this.name.trim() ||
|
|
288
312
|
!this.email.trim() || !!this.nameError ||
|
|
289
|
-
!!this.emailError, class: "px-4 py-2 bg-secondary rounded-4xl hover:bg-tertiary transition-colors duration-200
|
|
313
|
+
!!this.emailError, class: "px-4 py-2 bg-secondary rounded-4xl hover:bg-tertiary transition-colors duration-200", style: { color: "var(--color-muted)" } }, t.solarSystemForm.requestOfferButton))))));
|
|
290
314
|
}
|
|
291
315
|
static get is() { return "solar-system-form"; }
|
|
292
316
|
static get originalStyleUrls() {
|