blue-chestnut-solar-expert 0.0.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.
Files changed (73) hide show
  1. package/LICENSE +21 -0
  2. package/dist/components/index.d.ts +33 -0
  3. package/dist/components/map-draw.d.ts +11 -0
  4. package/dist/components/solar-calculator.d.ts +11 -0
  5. package/dist/components/solar-expert.d.ts +11 -0
  6. package/dist/stencil-library/api-By7kNIGr.js +18774 -0
  7. package/dist/stencil-library/api-By7kNIGr.js.map +1 -0
  8. package/dist/stencil-library/app-globals-DQuL1Twl.js +6 -0
  9. package/dist/stencil-library/app-globals-DQuL1Twl.js.map +1 -0
  10. package/dist/stencil-library/decoder-DSavpK4g.js +29 -0
  11. package/dist/stencil-library/decoder-DSavpK4g.js.map +1 -0
  12. package/dist/stencil-library/deflate-Cpl_7R0h.js +13 -0
  13. package/dist/stencil-library/deflate-Cpl_7R0h.js.map +1 -0
  14. package/dist/stencil-library/index-CEfm4WRP.js +4170 -0
  15. package/dist/stencil-library/index-CEfm4WRP.js.map +1 -0
  16. package/dist/stencil-library/index-DimvNaNS.js +412 -0
  17. package/dist/stencil-library/index-DimvNaNS.js.map +1 -0
  18. package/dist/stencil-library/index.esm.js +12 -0
  19. package/dist/stencil-library/index.esm.js.map +1 -0
  20. package/dist/stencil-library/jpeg-3kYgfUiy.js +902 -0
  21. package/dist/stencil-library/jpeg-3kYgfUiy.js.map +1 -0
  22. package/dist/stencil-library/lerc-D9ISp5i_.js +2487 -0
  23. package/dist/stencil-library/lerc-D9ISp5i_.js.map +1 -0
  24. package/dist/stencil-library/loader.esm.js.map +1 -0
  25. package/dist/stencil-library/lucide-DGcPbaht.js +27006 -0
  26. package/dist/stencil-library/lucide-DGcPbaht.js.map +1 -0
  27. package/dist/stencil-library/lzw-15JscBc_.js +136 -0
  28. package/dist/stencil-library/lzw-15JscBc_.js.map +1 -0
  29. package/dist/stencil-library/map-draw.entry.esm.js.map +1 -0
  30. package/dist/stencil-library/map-draw.entry.js +2777 -0
  31. package/dist/stencil-library/map-draw.entry.js.map +1 -0
  32. package/dist/stencil-library/packbits-i_L--d7r.js +31 -0
  33. package/dist/stencil-library/packbits-i_L--d7r.js.map +1 -0
  34. package/dist/stencil-library/pako.esm-BdkEMvj8.js +6879 -0
  35. package/dist/stencil-library/pako.esm-BdkEMvj8.js.map +1 -0
  36. package/dist/stencil-library/raw-Cp-44rFp.js +12 -0
  37. package/dist/stencil-library/raw-Cp-44rFp.js.map +1 -0
  38. package/dist/stencil-library/solar-calculator.entry.esm.js.map +1 -0
  39. package/dist/stencil-library/solar-calculator.entry.js +70 -0
  40. package/dist/stencil-library/solar-calculator.entry.js.map +1 -0
  41. package/dist/stencil-library/solar-expert.entry.esm.js.map +1 -0
  42. package/dist/stencil-library/solar-expert.entry.js +66 -0
  43. package/dist/stencil-library/solar-expert.entry.js.map +1 -0
  44. package/dist/stencil-library/stencil-library.esm.js +51 -0
  45. package/dist/stencil-library/stencil-library.esm.js.map +1 -0
  46. package/dist/stencil-library/webimage-Cn4h3lmO.js +45 -0
  47. package/dist/stencil-library/webimage-Cn4h3lmO.js.map +1 -0
  48. package/dist/types/components/map-draw/map-draw.d.ts +58 -0
  49. package/dist/types/components/solar-calculator/solar-calculator.d.ts +15 -0
  50. package/dist/types/components/solar-expert/solar-expert.d.ts +15 -0
  51. package/dist/types/components.d.ts +81 -0
  52. package/dist/types/config.d.ts +15 -0
  53. package/dist/types/constants.d.ts +7 -0
  54. package/dist/types/index.d.ts +10 -0
  55. package/dist/types/stencil-public-runtime.d.ts +1702 -0
  56. package/dist/types/types/shapes.d.ts +32 -0
  57. package/dist/types/utils/api.d.ts +13 -0
  58. package/dist/types/utils/geometry/fitting.d.ts +89 -0
  59. package/dist/types/utils/geometry/gridMatch.d.ts +26 -0
  60. package/dist/types/utils/render/color.d.ts +3 -0
  61. package/dist/types/utils/render/polygon.d.ts +35 -0
  62. package/dist/types/utils/render/projection.d.ts +13 -0
  63. package/dist/types/utils/render/tools.d.ts +18 -0
  64. package/dist/types/utils/solar.d.ts +155 -0
  65. package/dist/types/utils/utils.d.ts +8 -0
  66. package/dist/types/utils/visualize.d.ts +111 -0
  67. package/loader/cdn.js +1 -0
  68. package/loader/index.cjs.js +1 -0
  69. package/loader/index.d.ts +24 -0
  70. package/loader/index.es2017.js +1 -0
  71. package/loader/index.js +2 -0
  72. package/package.json +66 -0
  73. package/readme.md +150 -0
@@ -0,0 +1,32 @@
1
+ import { RoofSegmentSizeAndSunshineStats } from "../utils/solar";
2
+ export interface Point {
3
+ x: number;
4
+ y: number;
5
+ }
6
+ export type PolygonType = "roof" | "obstruction";
7
+ export interface PolygonDetails {
8
+ area: number;
9
+ azimuth: number;
10
+ pitch: number;
11
+ assignedRoofStats?: RoofSegmentSizeAndSunshineStats;
12
+ }
13
+ export interface Polygon {
14
+ points: Point[];
15
+ type: PolygonType;
16
+ closed: boolean;
17
+ _id: string;
18
+ details?: PolygonDetails;
19
+ }
20
+ export interface SelectedPolygon {
21
+ _id: string;
22
+ type: "roof" | "obstruction";
23
+ }
24
+ export interface LineSegment {
25
+ start: Point;
26
+ end: Point;
27
+ type: "inner" | "outer" | "border";
28
+ }
29
+ export interface SegmentMatch {
30
+ segment: string;
31
+ matchedSegments: string[];
32
+ }
@@ -0,0 +1,13 @@
1
+ import { BuildingInsightsResponse } from "./solar";
2
+ export declare function getBuildingImages(latitude: number, longitude: number, apiKey: string): Promise<{
3
+ width: number;
4
+ height: number;
5
+ rasters: number[][];
6
+ bounds: {
7
+ north: any;
8
+ south: any;
9
+ east: any;
10
+ west: any;
11
+ };
12
+ }>;
13
+ export declare function fetchSolarData(latitude: number, longitude: number, apiKey: string): Promise<BuildingInsightsResponse>;
@@ -0,0 +1,89 @@
1
+ import { LineSegment, Polygon, SegmentMatch } from "../../types/shapes";
2
+ import { Bounds, RoofSegmentSizeAndSunshineStats, SolarPanelType } from "../solar";
3
+ import { Point } from "../../types/shapes";
4
+ import { Line } from "../render/polygon";
5
+ export interface PositionedSolarPanel {
6
+ panel: SolarPanelType;
7
+ pixelPosition: {
8
+ x: number;
9
+ y: number;
10
+ };
11
+ horizontal: boolean;
12
+ }
13
+ /**
14
+ * Get the intersections of a line parallel to the x-axis of the projected coordinate system with a polygon.
15
+ * @param projectedPoint the point to draw the line from
16
+ * @param projectedPolygon the polygon to get the intersections with
17
+ * @returns the intersections of the line with the polygon
18
+ */
19
+ export declare function getIntersections(projectedPoint: Point, projectedPolygon: Polygon): Point[];
20
+ export declare function projectPoint(point: Point, azimuth: number): Point;
21
+ export declare function projectPolygon(polygon: Polygon, azimuth: number): Polygon;
22
+ export declare function offsetPolygon(polygon: Polygon, offset?: {
23
+ x: number;
24
+ y: number;
25
+ }): {
26
+ polygon: Polygon;
27
+ offset: {
28
+ x: number;
29
+ y: number;
30
+ };
31
+ };
32
+ /**
33
+ * Checks if two lines intersect.
34
+ * if the lines intersect in a start or end point they are not considered as intersecting
35
+ * @param line1 The first line.
36
+ * @param line2 The second line.
37
+ * @returns True if the lines intersect, false otherwise.
38
+ */
39
+ export declare function intersects(line1: Line, line2: Line): boolean;
40
+ export declare function undoOffsetPolygon(polygon: Polygon, offset: {
41
+ x: number;
42
+ y: number;
43
+ }): Polygon;
44
+ export declare function segmentPolygon(polygon: Polygon): LineSegment[];
45
+ /**
46
+ * for each segment this method will find all the following segments that are connected to it
47
+ *
48
+ * first the method subdivides the segments into y levels (all segments that have the same y coordinate are in the same level)
49
+ * then it will check for each segment in each level if there is a following segment that is connected to it by checking it the
50
+ * start point of the top segment to the end point of the bottom segment does not intersect with any of the polygon borders and the center point of the connection is in the polygon
51
+ *
52
+ * @param segments
53
+ * @param roof
54
+ * @returns
55
+ */
56
+ export declare function matchSegments(segments: LineSegment[], roof: Polygon): {
57
+ matches: SegmentMatch[];
58
+ map: Record<string, LineSegment>;
59
+ };
60
+ /**
61
+ * Fits panels to a roof polygon.
62
+ *
63
+ * Starts with positioning a solar panel row (a rectangle with the height of the solar panel and the width in the direction of the perpendicular of
64
+ * the azimuth of the roof) at each corner of the roof.
65
+ * For each corner there are four possible cases (the width is the width of the whole roof in the direction of the perpendicular of the azimuth):
66
+ * 1. The row has height of the solar panel height and sits below the point in the direction of the azimuth of the roof.
67
+ * 2. The row has height of the solar panel height and sits above the point in the direction of the azimuth of the roof.
68
+ * 3. The row has the height of the solar panel width (solar panels are rotated) and sits below the point in the direction of the azimuth of the roof.
69
+ * 4. The row has the height of the solar panel width (solar panels are rotated) and sits above the point in the direction of the azimuth of the roof.
70
+ *
71
+ * For each of these cases the function then places the solar panel rows directly above and below the current row.
72
+ *
73
+ * after the function has positioned all the rows it places the solar panels in the spaces between the rows.
74
+ * For each of the four scenarios of each corner the number of panels are counted and the optimal placement is chosen.
75
+ *
76
+ * @param roof - The roof polygon.
77
+ * @param panelType - The type of panel to fit.
78
+ * @param borderOffset - The offset of the panel from the border of the roof. If negative, the panel can be partially overhanging the roof.
79
+ * @param azimuth - The azimuth of the roof.
80
+ * @returns The positioned panels.
81
+ */
82
+ export declare function fitPanelsToRoof(roof: Polygon, panelType: SolarPanelType, borderOffset?: number, azimuth?: number): PositionedSolarPanel[];
83
+ /**
84
+ * Uses the bounding box of the roof and the roof segment bounding boxes to find the best fitting roof segment.
85
+ * @param roof the roof shape
86
+ * @param roofSegmentStats the stats of the roof segments
87
+ * @returns the best fitting roof segment
88
+ */
89
+ export declare function getBestFittingRoofSegment(roof: Polygon, roofSegmentStats: RoofSegmentSizeAndSunshineStats[], bounds: Bounds, canvas: HTMLCanvasElement): RoofSegmentSizeAndSunshineStats;
@@ -0,0 +1,26 @@
1
+ import { Point, Polygon } from "../../types/shapes";
2
+ import { SolarPanelType } from "../solar";
3
+ import { PositionedSolarPanel } from "./fitting";
4
+ export interface MinMax {
5
+ minX: number;
6
+ maxX: number;
7
+ minY: number;
8
+ maxY: number;
9
+ }
10
+ export declare function generateGrid(minMax: MinMax, solarPanel: SolarPanelType, horizontal: boolean, anker: Point, rowSpacing: number, columnSpacing: number): Array<Array<PositionedSolarPanel>>;
11
+ export declare function solarPanelInObstacle(positionedSolarPanel: PositionedSolarPanel, obstacle: Polygon, horizontal: boolean): boolean;
12
+ export declare function solarPanelInPolygon(positionedSolarPanel: PositionedSolarPanel, polygon: Polygon, horizontal: boolean): boolean;
13
+ export interface Obstacle {
14
+ polygon: Polygon;
15
+ boundingBox: {
16
+ minX: number;
17
+ maxX: number;
18
+ minY: number;
19
+ maxY: number;
20
+ };
21
+ }
22
+ export declare function isPanelObstructed(positionedSolarPanel: PositionedSolarPanel, obstacles: Obstacle[], horizontal: boolean): boolean;
23
+ export declare function getSolarPanelsInPolygon(grid: Array<Array<PositionedSolarPanel>>, polygon: Polygon, horizontal: boolean, obstacles: Obstacle[]): Array<Array<PositionedSolarPanel>>;
24
+ export declare function getOptimalSolarPosition(roof: Polygon, obstacles: Obstacle[], solarPanel: SolarPanelType, angle: number): Array<Array<PositionedSolarPanel>>;
25
+ export declare function insetPolygon(polygon: Polygon, inset: number): Polygon;
26
+ export declare function getOptimalSolarPositionFully(roof: Polygon, obstacles: Polygon[], solarPanel: SolarPanelType, azimuth: number, inset: number, angle: number): Array<PositionedSolarPanel>;
@@ -0,0 +1,3 @@
1
+ import { Polygon, SelectedPolygon } from "../../types/shapes";
2
+ import { SolarExpertConfig } from "../../config";
3
+ export declare function getFillColor(selectedPolygon: SelectedPolygon | null, hoveredPolygon: SelectedPolygon | null, _id: string, polygon: Polygon, config: SolarExpertConfig): string | undefined;
@@ -0,0 +1,35 @@
1
+ import { Point, Polygon } from "../../types/shapes";
2
+ export interface DrawPolygonProps {
3
+ polygonCtx: CanvasRenderingContext2D;
4
+ polygonCanvas: HTMLCanvasElement;
5
+ polygon: Polygon;
6
+ pixelInMeters: number;
7
+ shiftKeyPressed: boolean;
8
+ mousePoint: Point | null;
9
+ strokeColor: string;
10
+ fillColor?: string;
11
+ }
12
+ export interface Line {
13
+ start: Point;
14
+ end: Point;
15
+ }
16
+ export interface DrawCircleProps {
17
+ ctx: CanvasRenderingContext2D;
18
+ x: number;
19
+ y: number;
20
+ radius: number;
21
+ strokeStyle?: string;
22
+ lineWidth?: number;
23
+ }
24
+ export declare function drawPolygon({ polygonCtx, polygonCanvas, polygon, shiftKeyPressed, mousePoint, strokeColor, fillColor }: DrawPolygonProps): void;
25
+ export declare function drawCircle({ ctx, x, y, radius, strokeStyle, lineWidth }: DrawCircleProps): void;
26
+ export declare function drawPerpendicularDottedLine({ ctx, startPoint, endPoint, dashPattern, strokeStyle, lineWidth }: {
27
+ ctx: CanvasRenderingContext2D;
28
+ startPoint: Point;
29
+ endPoint: Point;
30
+ dashPattern?: number[];
31
+ strokeStyle?: string;
32
+ lineWidth?: number;
33
+ }): void;
34
+ export declare function isPointOnBorder(point: Point, polygon: Polygon): boolean;
35
+ export declare function isPointInPolygon(point: Point, polygon: Polygon): boolean;
@@ -0,0 +1,13 @@
1
+ import { Point } from "../../types/shapes";
2
+ export declare function projectPointPerpendicularToLine({ x, y, lastPoint, secondLastPoint, }: {
3
+ x: number;
4
+ y: number;
5
+ lastPoint: {
6
+ x: number;
7
+ y: number;
8
+ };
9
+ secondLastPoint: {
10
+ x: number;
11
+ y: number;
12
+ };
13
+ }): Point;
@@ -0,0 +1,18 @@
1
+ export type ToolType = "move" | "roof" | "obstruction" | "delete";
2
+ export interface KeyboardCombination {
3
+ key: string;
4
+ description: string;
5
+ }
6
+ export interface Tool {
7
+ name: ToolType;
8
+ ariaLabel: string;
9
+ icon: string;
10
+ cursor: string;
11
+ keyboardShortcut?: string;
12
+ keyboardCombinations?: KeyboardCombination[];
13
+ }
14
+ export declare const moveTool: Tool;
15
+ export declare const roofTool: Tool;
16
+ export declare const obstructionTool: Tool;
17
+ export declare const deleteTool: Tool;
18
+ export declare const tools: Tool[];
@@ -0,0 +1,155 @@
1
+ export interface DataLayersResponse {
2
+ imageryDate: Date;
3
+ imageryProcessedDate: Date;
4
+ dsmUrl: string;
5
+ rgbUrl: string;
6
+ maskUrl: string;
7
+ annualFluxUrl: string;
8
+ monthlyFluxUrl: string;
9
+ hourlyShadeUrls: string[];
10
+ imageryQuality: 'HIGH' | 'MEDIUM' | 'LOW';
11
+ }
12
+ export interface Bounds {
13
+ north: number;
14
+ south: number;
15
+ east: number;
16
+ west: number;
17
+ }
18
+ export interface BuildingInsightsResponse {
19
+ name: string;
20
+ center: LatLng;
21
+ boundingBox: LatLngBox;
22
+ imageryDate: Date;
23
+ imageryProcessedDate: Date;
24
+ postalCode: string;
25
+ administrativeArea: string;
26
+ statisticalArea: string;
27
+ regionCode: string;
28
+ solarPotential: SolarPotential;
29
+ imageryQuality: 'HIGH' | 'MEDIUM' | 'LOW';
30
+ }
31
+ export interface SolarPotential {
32
+ maxArrayPanelsCount: number;
33
+ panelCapacityWatts: number;
34
+ panelHeightMeters: number;
35
+ panelWidthMeters: number;
36
+ panelLifetimeYears: number;
37
+ maxArrayAreaMeters2: number;
38
+ maxSunshineHoursPerYear: number;
39
+ carbonOffsetFactorKgPerMwh: number;
40
+ wholeRoofStats: SizeAndSunshineStats;
41
+ buildingStats: SizeAndSunshineStats;
42
+ roofSegmentStats: RoofSegmentSizeAndSunshineStats[];
43
+ solarPanels: SolarPanel[];
44
+ solarPanelConfigs: SolarPanelConfig[];
45
+ financialAnalyses: object;
46
+ }
47
+ export interface SizeAndSunshineStats {
48
+ areaMeters2: number;
49
+ sunshineQuantiles: number[];
50
+ groundAreaMeters2: number;
51
+ }
52
+ export interface RoofSegmentSizeAndSunshineStats {
53
+ pitchDegrees: number;
54
+ azimuthDegrees: number;
55
+ stats: SizeAndSunshineStats;
56
+ center: LatLng;
57
+ boundingBox: LatLngBox;
58
+ planeHeightAtCenterMeters: number;
59
+ }
60
+ export interface SolarPanel {
61
+ center: LatLng;
62
+ orientation: 'LANDSCAPE' | 'PORTRAIT';
63
+ segmentIndex: number;
64
+ yearlyEnergyDcKwh: number;
65
+ }
66
+ export interface SolarPanelType {
67
+ widthMeters: number;
68
+ heightMeters: number;
69
+ kWattPeak: number;
70
+ efficiency: number;
71
+ price: number;
72
+ }
73
+ export interface InternalSolarPanelConfig {
74
+ panelsCount: number;
75
+ yearlyEnergyDcKwh: number;
76
+ panels: SolarPanel[];
77
+ }
78
+ export interface SolarPanelConfig {
79
+ panelsCount: number;
80
+ yearlyEnergyDcKwh: number;
81
+ roofSegmentSummaries: RoofSegmentSummary[];
82
+ }
83
+ export interface RoofSegmentSummary {
84
+ pitchDegrees: number;
85
+ azimuthDegrees: number;
86
+ panelsCount: number;
87
+ yearlyEnergyDcKwh: number;
88
+ segmentIndex: number;
89
+ }
90
+ export interface LatLng {
91
+ latitude: number;
92
+ longitude: number;
93
+ }
94
+ export interface LatLngBox {
95
+ sw: LatLng;
96
+ ne: LatLng;
97
+ }
98
+ export interface Date {
99
+ year: number;
100
+ month: number;
101
+ day: number;
102
+ }
103
+ export interface RequestError {
104
+ error: {
105
+ code: number;
106
+ message: string;
107
+ status: string;
108
+ };
109
+ }
110
+ export type LayerId = 'mask' | 'dsm' | 'rgb' | 'annualFlux' | 'monthlyFlux' | 'hourlyShade';
111
+ /**
112
+ * Fetches the building insights information from the Solar API.
113
+ * https://developers.google.com/maps/documentation/solar/building-insights
114
+ *
115
+ * @param {LatLng} location Point of interest as latitude longitude.
116
+ * @param {string} apiKey Google Cloud API key.
117
+ * @return {Promise<DataLayersResponse>} Building Insights response.
118
+ */
119
+ export declare function findClosestBuilding(location: google.maps.LatLng, apiKey: string): Promise<BuildingInsightsResponse>;
120
+ /**
121
+ * Fetches the data layers information from the Solar API.
122
+ * https://developers.google.com/maps/documentation/solar/data-layers
123
+ *
124
+ * @param {LatLng} location Point of interest as latitude longitude.
125
+ * @param {number} radiusMeters Radius of the data layer size in meters.
126
+ * @param {string} apiKey Google Cloud API key.
127
+ * @return {Promise<DataLayersResponse>} Data Layers response.
128
+ */
129
+ export declare function getDataLayerUrls(location: LatLng, radiusMeters: number, apiKey: string): Promise<DataLayersResponse>;
130
+ export interface GeoTiff {
131
+ width: number;
132
+ height: number;
133
+ rasters: Array<number>[];
134
+ bounds: Bounds;
135
+ }
136
+ /**
137
+ * Downloads the pixel values for a Data Layer URL from the Solar API.
138
+ *
139
+ * @param {string} url URL from the Data Layers response.
140
+ * @param {string} apiKey Google Cloud API key.
141
+ * @return {Promise<GeoTiff>} Pixel values with shape and lat/lon bounds.
142
+ */
143
+ export declare function downloadGeoTIFF(url: string, apiKey: string): Promise<{
144
+ width: number;
145
+ height: number;
146
+ rasters: number[][];
147
+ bounds: {
148
+ north: any;
149
+ south: any;
150
+ east: any;
151
+ west: any;
152
+ };
153
+ }>;
154
+ export declare function showLatLng(point: LatLng): string;
155
+ export declare function showDate(date: Date): string;
@@ -0,0 +1,8 @@
1
+ import { Point } from "../types/shapes";
2
+ import { Bounds, GeoTiff, LatLng } from "./solar";
3
+ export declare function calculatePolygonArea(points: Point[]): number;
4
+ export declare function azimuthToCardinal(azimuth: number): string;
5
+ export declare function calculatePolygonOrientation(points: Point[]): number;
6
+ export declare function calculatePolygonAngle(points: Point[]): number;
7
+ export declare function latLngToPixel(bounds: Bounds, canvas: HTMLCanvasElement, latLng: LatLng): Point;
8
+ export declare function getPixelInMeters(rgbTiff: GeoTiff): number;
@@ -0,0 +1,111 @@
1
+ import { PositionedSolarPanel } from './geometry/fitting';
2
+ import type { Bounds, GeoTiff, InternalSolarPanelConfig } from './solar';
3
+ /**
4
+ * Renders an RGB GeoTiff image into an HTML canvas.
5
+ *
6
+ * The GeoTiff image must include 3 rasters (bands) which
7
+ * correspond to [Red, Green, Blue] in that order.
8
+ *
9
+ * @param {GeoTiff} rgb GeoTiff with RGB values of the image.
10
+ * @param {GeoTiff} mask Optional mask for transparency, defaults to opaque.
11
+ * @return {HTMLCanvasElement} Canvas element with the rendered image.
12
+ */
13
+ export declare function renderRGB(rgb: GeoTiff, mask?: GeoTiff, canvas?: HTMLCanvasElement | null): HTMLCanvasElement;
14
+ /**
15
+ * Renders a single value GeoTiff image into an HTML canvas.
16
+ *
17
+ * The GeoTiff image must include 1 raster (band) which contains
18
+ * the values we want to display.
19
+ *
20
+ * @param {GeoTiff} data GeoTiff with the values of interest.
21
+ * @param {GeoTiff} mask Optional mask for transparency, defaults to opaque.
22
+ * @param {string[]} colors Hex color palette, defaults to ['000000', 'ffffff'].
23
+ * @param {number} min Minimum value of the data range, defaults to 0.
24
+ * @param {number} max Maximum value of the data range, defaults to 1.
25
+ * @param {number} index Raster index for the data, defaults to 0.
26
+ * @return {HTMLCanvasElement} Canvas element with the rendered image.
27
+ */
28
+ export declare function renderPalette({ data, mask, colors, min, max, index, canvas, }: {
29
+ data: GeoTiff;
30
+ mask?: GeoTiff;
31
+ colors?: string[];
32
+ min?: number;
33
+ max?: number;
34
+ index?: number;
35
+ canvas?: HTMLCanvasElement | null;
36
+ }): HTMLCanvasElement;
37
+ /**
38
+ * Creates an {r, g, b} color palette from a hex list of colors.
39
+ *
40
+ * Each {r, g, b} value is a number between 0 and 255.
41
+ * The created palette is always of size 256, regardless of the number of
42
+ * hex colors passed in. Inbetween values are interpolated.
43
+ *
44
+ * @param {string[]} hexColors List of hex colors for the palette.
45
+ * @return {{r, g, b}[]} RGB values for the color palette.
46
+ */
47
+ export declare function createPalette(hexColors: string[]): {
48
+ r: number;
49
+ g: number;
50
+ b: number;
51
+ }[];
52
+ /**
53
+ * Convert a hex color into an {r, g, b} color.
54
+ *
55
+ * @param {string} color Hex color like 0099FF or #0099FF.
56
+ * @return {{r, g, b}} RGB values for that color.
57
+ */
58
+ export declare function colorToRGB(color: string): {
59
+ r: number;
60
+ g: number;
61
+ b: number;
62
+ };
63
+ /**
64
+ * Normalizes a number to a given data range.
65
+ *
66
+ * @param {number} x Value of interest.
67
+ * @param {number} max Maximum value in data range, defaults to 1.
68
+ * @param {number} min Minimum value in data range, defaults to 0.
69
+ * @return {number} Normalized value.
70
+ */
71
+ export declare function normalize(x: number, max?: number, min?: number): number;
72
+ /**
73
+ * Calculates the linear interpolation for a value within a range.
74
+ *
75
+ * @param {number} x Lower value in the range, when `t` is 0.
76
+ * @param {number} y Upper value in the range, when `t` is 1.
77
+ * @param {number} t "Time" between 0 and 1.
78
+ * @return {number} Inbetween value for that "time".
79
+ */
80
+ export declare function lerp(x: number, y: number, t: number): number;
81
+ /**
82
+ * Clamps a value to always be within a range.
83
+ *
84
+ * @param {number} x Value to clamp.
85
+ * @param {number} min Minimum value in the range.
86
+ * @param {number} max Maximum value in the range.
87
+ * @return {number} Clamped value.
88
+ */
89
+ export declare function clamp(x: number, min: number, max: number): number;
90
+ export declare function rgbToColor({ r, g, b }: {
91
+ r: number;
92
+ g: number;
93
+ b: number;
94
+ }): string;
95
+ export declare function renderAzimuth(azimuth: number, ctx: CanvasRenderingContext2D): void;
96
+ export declare function renderSolarPanel(solarPanel: PositionedSolarPanel, ctx: CanvasRenderingContext2D, panelWidth: number, panelHeight: number, azimuthAngle: number, pitchAngle: number): void;
97
+ export declare function renderPanels({ canvas, panelConfig, bounds, zoom, roofSegments }: {
98
+ canvas: HTMLCanvasElement | null;
99
+ panelConfig: InternalSolarPanelConfig;
100
+ bounds: Bounds;
101
+ zoom: number;
102
+ roofSegments: Record<number, {
103
+ pitchDegrees: number;
104
+ azimuthDegrees: number;
105
+ }>;
106
+ }): HTMLCanvasElement;
107
+ export declare function renderCombinedWithZoom({ rgb, zoom, canvas, }: {
108
+ rgb: GeoTiff;
109
+ zoom?: number;
110
+ canvas?: HTMLCanvasElement | null;
111
+ }): HTMLCanvasElement;
package/loader/cdn.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('../dist/cjs/loader.cjs.js');
@@ -0,0 +1 @@
1
+ module.exports = require('../dist/cjs/loader.cjs.js');
@@ -0,0 +1,24 @@
1
+ export * from '../dist/types/components';
2
+ export interface CustomElementsDefineOptions {
3
+ exclude?: string[];
4
+ resourcesUrl?: string;
5
+ syncQueue?: boolean;
6
+ jmp?: (c: Function) => any;
7
+ raf?: (c: FrameRequestCallback) => number;
8
+ ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
9
+ rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
10
+ }
11
+ export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): void;
12
+ /**
13
+ * @deprecated
14
+ */
15
+ export declare function applyPolyfills(): Promise<void>;
16
+
17
+ /**
18
+ * Used to specify a nonce value that corresponds with an application's CSP.
19
+ * When set, the nonce will be added to all dynamically created script and style tags at runtime.
20
+ * Alternatively, the nonce value can be set on a meta tag in the DOM head
21
+ * (<meta name="csp-nonce" content="{ nonce value here }" />) which
22
+ * will result in the same behavior.
23
+ */
24
+ export declare function setNonce(nonce: string): void;
@@ -0,0 +1 @@
1
+ export * from '../dist/esm/loader.js';
@@ -0,0 +1,2 @@
1
+ (function(){if("undefined"!==typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var a=HTMLElement;window.HTMLElement=function(){return Reflect.construct(a,[],this.constructor)};HTMLElement.prototype=a.prototype;HTMLElement.prototype.constructor=HTMLElement;Object.setPrototypeOf(HTMLElement,a)}})();
2
+ export * from '../dist/esm/loader.js';
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "blue-chestnut-solar-expert",
3
+ "version": "0.0.1",
4
+ "description": "Blue Chestnut Solar Expert",
5
+ "main": "dist/index.cjs.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/types/index.d.ts",
8
+ "collection": "dist/collection/collection-manifest.json",
9
+ "collection:main": "dist/collection/index.js",
10
+ "unpkg": "dist/stencil-library/stencil-library.esm.js",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/stencil-library/stencil-library.esm.js",
14
+ "require": "./dist/stencil-library/stencil-library.cjs.js"
15
+ },
16
+ "./my-component": {
17
+ "import": "./dist/components/my-component.js",
18
+ "types": "./dist/components/my-component.d.ts"
19
+ },
20
+ "./loader": {
21
+ "import": "./loader/index.js",
22
+ "require": "./loader/index.cjs",
23
+ "types": "./loader/index.d.ts"
24
+ }
25
+ },
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/stenciljs/component-starter.git"
29
+ },
30
+ "files": [
31
+ "dist/",
32
+ "loader/"
33
+ ],
34
+ "scripts": {
35
+ "build": "stencil build",
36
+ "start": "stencil build --dev --watch --serve",
37
+ "test": "stencil test --spec --e2e",
38
+ "testspec": "stencil test --spec --watchAll",
39
+ "testspecfile": "jest src/utils/geometry/gridMatching.spec.ts --watch",
40
+ "test.watch": "stencil test --spec --e2e --watchAll",
41
+ "generate": "stencil generate"
42
+ },
43
+ "devDependencies": {
44
+ "@stencil/core": "^4.27.1",
45
+ "@types/jest": "^29.5.14",
46
+ "@types/node": "^22.13.5",
47
+ "dotenv": "^16.5.0",
48
+ "jest": "^29.7.0",
49
+ "jest-cli": "^29.7.0",
50
+ "puppeteer": "^24.3.0",
51
+ "rollup-plugin-node-polyfills": "^0.2.1"
52
+ },
53
+ "license": "MIT",
54
+ "dependencies": {
55
+ "@googlemaps/js-api-loader": "^1.16.8",
56
+ "@rollup/plugin-node-resolve": "^16.0.1",
57
+ "@tailwindcss/cli": "^4.1.6",
58
+ "@types/google.maps": "^3.58.1",
59
+ "geotiff": "^2.1.3",
60
+ "geotiff-geokeys-to-proj4": "^2024.4.13",
61
+ "lucide": "^0.509.0",
62
+ "proj4": "^2.16.2",
63
+ "tailwindcss": "^4.1.6",
64
+ "ts-jest": "^29.3.4"
65
+ }
66
+ }