@sentropic/design-system-angular 0.37.0 → 0.38.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 (318) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSE.THIRD-PARTY.md +110 -0
  3. package/dist/Accordion.js +3 -3
  4. package/dist/Alert.js +3 -3
  5. package/dist/AnomalySwimLaneChart.js +3 -3
  6. package/dist/AppChrome.js +3 -3
  7. package/dist/AppHeader.js +3 -3
  8. package/dist/AppShell.js +3 -3
  9. package/dist/ArcDiagramChart.d.ts +3 -1
  10. package/dist/ArcDiagramChart.d.ts.map +1 -1
  11. package/dist/ArcDiagramChart.js +9 -23
  12. package/dist/ArcDiagramChart.js.map +1 -1
  13. package/dist/AreaChart.js +3 -3
  14. package/dist/AreaRangeChart.js +3 -3
  15. package/dist/AreaSplineRangeChart.js +3 -3
  16. package/dist/AspectRatio.js +3 -3
  17. package/dist/Autosave.js +3 -3
  18. package/dist/Avatar.js +3 -3
  19. package/dist/AvatarGroup.js +3 -3
  20. package/dist/BackToTop.js +3 -3
  21. package/dist/Badge.js +3 -3
  22. package/dist/BarChart.js +3 -3
  23. package/dist/BellCurveChart.js +5 -5
  24. package/dist/BoxPlotChart.js +3 -3
  25. package/dist/Breadcrumb.js +3 -3
  26. package/dist/BulletChart.js +5 -5
  27. package/dist/BumpChart.js +5 -5
  28. package/dist/Button.d.ts +5 -1
  29. package/dist/Button.d.ts.map +1 -1
  30. package/dist/Button.js +15 -3
  31. package/dist/Button.js.map +1 -1
  32. package/dist/ButtonGroup.js +3 -3
  33. package/dist/Calendar.d.ts +12 -1
  34. package/dist/Calendar.d.ts.map +1 -1
  35. package/dist/Calendar.js +27 -3
  36. package/dist/Calendar.js.map +1 -1
  37. package/dist/CalendarHeatmapChart.d.ts.map +1 -1
  38. package/dist/CalendarHeatmapChart.js +27 -25
  39. package/dist/CalendarHeatmapChart.js.map +1 -1
  40. package/dist/CandlestickChart.js +3 -3
  41. package/dist/Card.js +3 -3
  42. package/dist/ChatComposer.js +3 -3
  43. package/dist/ChatMessage.js +3 -3
  44. package/dist/ChatThread.js +3 -3
  45. package/dist/Checkbox.d.ts +3 -1
  46. package/dist/Checkbox.d.ts.map +1 -1
  47. package/dist/Checkbox.js +9 -3
  48. package/dist/Checkbox.js.map +1 -1
  49. package/dist/CheckboxGroup.js +3 -3
  50. package/dist/ChordDiagram.js +3 -3
  51. package/dist/CodeSnippet.js +3 -3
  52. package/dist/Col.js +3 -3
  53. package/dist/Collapsible.js +3 -3
  54. package/dist/ColorScaleBar.js +3 -3
  55. package/dist/ColorSwatch.js +3 -3
  56. package/dist/ColumnPyramidChart.js +3 -3
  57. package/dist/ColumnRangeChart.js +3 -3
  58. package/dist/ComboChart.js +3 -3
  59. package/dist/Combobox.js +3 -3
  60. package/dist/ConfigItemCard.js +3 -3
  61. package/dist/Container.js +3 -3
  62. package/dist/ContentSwitcher.js +3 -3
  63. package/dist/ContextPanel.js +3 -3
  64. package/dist/ContourChart.d.ts.map +1 -1
  65. package/dist/ContourChart.js +51 -45
  66. package/dist/ContourChart.js.map +1 -1
  67. package/dist/CopyButton.js +3 -3
  68. package/dist/Dashboard.js +3 -3
  69. package/dist/DashboardGrid.js +3 -3
  70. package/dist/DataImage.js +3 -3
  71. package/dist/DataTable.js +3 -3
  72. package/dist/DatePicker.js +3 -3
  73. package/dist/DecompositionTreeChart.js +3 -3
  74. package/dist/Density2DChart.js +3 -3
  75. package/dist/DependencyWheelChart.d.ts +3 -1
  76. package/dist/DependencyWheelChart.d.ts.map +1 -1
  77. package/dist/DependencyWheelChart.js +9 -23
  78. package/dist/DependencyWheelChart.js.map +1 -1
  79. package/dist/DisplaySettings.js +3 -3
  80. package/dist/DivergentBarChart.js +3 -3
  81. package/dist/Divider.js +3 -3
  82. package/dist/DonutChart.js +3 -3
  83. package/dist/Drawer.js +3 -3
  84. package/dist/Dropdown.js +3 -3
  85. package/dist/DumbbellChart.js +5 -5
  86. package/dist/Embed.js +3 -3
  87. package/dist/EmptyState.js +3 -3
  88. package/dist/ErrorBarChart.js +3 -3
  89. package/dist/ErrorSummary.js +3 -3
  90. package/dist/EventFeedPanel.js +5 -5
  91. package/dist/FieldCard.js +3 -3
  92. package/dist/FileUploader.js +3 -3
  93. package/dist/FilterBar.js +3 -3
  94. package/dist/FilterPill.js +3 -3
  95. package/dist/FlamegraphChart.js +3 -3
  96. package/dist/Flex.js +3 -3
  97. package/dist/Footer.js +3 -3
  98. package/dist/ForceGraph.js +3 -3
  99. package/dist/Form.js +3 -3
  100. package/dist/FormGroup.js +3 -3
  101. package/dist/FunnelChart.js +3 -3
  102. package/dist/GanttChart.js +3 -3
  103. package/dist/GaugeChart.js +3 -3
  104. package/dist/GeoChart.js +5 -5
  105. package/dist/GraphLegend.js +3 -3
  106. package/dist/Grid.js +3 -3
  107. package/dist/HLCChart.js +3 -3
  108. package/dist/Header.js +3 -3
  109. package/dist/HeatmapChart.d.ts.map +1 -1
  110. package/dist/HeatmapChart.js +51 -45
  111. package/dist/HeatmapChart.js.map +1 -1
  112. package/dist/HeikinAshiChart.js +3 -3
  113. package/dist/Hidden.js +3 -3
  114. package/dist/Highlight.js +3 -3
  115. package/dist/HistogramChart.js +3 -3
  116. package/dist/HollowCandlestickChart.js +3 -3
  117. package/dist/Icon.d.ts +7 -2
  118. package/dist/Icon.d.ts.map +1 -1
  119. package/dist/Icon.js +57 -4
  120. package/dist/Icon.js.map +1 -1
  121. package/dist/IconButton.js +3 -3
  122. package/dist/IdentityMenu.js +3 -3
  123. package/dist/Inline.d.ts +16 -1
  124. package/dist/Inline.d.ts.map +1 -1
  125. package/dist/Inline.js +36 -5
  126. package/dist/Inline.js.map +1 -1
  127. package/dist/InlineLoading.js +3 -3
  128. package/dist/Input.d.ts +3 -1
  129. package/dist/Input.d.ts.map +1 -1
  130. package/dist/Input.js +9 -3
  131. package/dist/Input.js.map +1 -1
  132. package/dist/ItemChart.js +3 -3
  133. package/dist/KanbanBoard.js +3 -3
  134. package/dist/KpiCard.d.ts.map +1 -1
  135. package/dist/KpiCard.js +9 -4
  136. package/dist/KpiCard.js.map +1 -1
  137. package/dist/LanguageSelector.js +3 -3
  138. package/dist/LanguageToggle.js +3 -3
  139. package/dist/LineChart.d.ts +12 -0
  140. package/dist/LineChart.d.ts.map +1 -1
  141. package/dist/LineChart.js +15 -6
  142. package/dist/LineChart.js.map +1 -1
  143. package/dist/Link.js +3 -3
  144. package/dist/ListReportPage.js +3 -3
  145. package/dist/LoadingState.js +3 -3
  146. package/dist/LollipopChart.js +3 -3
  147. package/dist/MarimekkoChart.js +5 -5
  148. package/dist/MasterDetail.js +3 -3
  149. package/dist/MediaContent.js +3 -3
  150. package/dist/Menu.js +3 -3
  151. package/dist/MenuPopover.d.ts +25 -3
  152. package/dist/MenuPopover.d.ts.map +1 -1
  153. package/dist/MenuPopover.js +105 -15
  154. package/dist/MenuPopover.js.map +1 -1
  155. package/dist/MenuTriggerButton.js +3 -3
  156. package/dist/MessageActions.js +3 -3
  157. package/dist/MessageStatusBadge.js +3 -3
  158. package/dist/Modal.js +3 -3
  159. package/dist/MultiSelect.js +3 -3
  160. package/dist/NavActionStack.js +3 -3
  161. package/dist/NavDrawer.js +3 -3
  162. package/dist/NavItem.js +3 -3
  163. package/dist/NavRail.js +3 -3
  164. package/dist/NavSection.d.ts +1 -1
  165. package/dist/NavSection.d.ts.map +1 -1
  166. package/dist/NavSection.js +20 -9
  167. package/dist/NavSection.js.map +1 -1
  168. package/dist/NavShell.js +3 -3
  169. package/dist/Notification.js +3 -3
  170. package/dist/NumberInput.d.ts +3 -1
  171. package/dist/NumberInput.d.ts.map +1 -1
  172. package/dist/NumberInput.js +9 -3
  173. package/dist/NumberInput.js.map +1 -1
  174. package/dist/OHLCChart.js +5 -5
  175. package/dist/ObjectPage.js +3 -3
  176. package/dist/OrderedList.js +3 -3
  177. package/dist/OrganizationChart.js +5 -5
  178. package/dist/OverflowMenu.js +3 -3
  179. package/dist/Overline.js +3 -3
  180. package/dist/PackedBubblesChart.js +5 -5
  181. package/dist/Pagination.js +3 -3
  182. package/dist/PaginationNav.js +3 -3
  183. package/dist/PanelSection.d.ts +12 -0
  184. package/dist/PanelSection.d.ts.map +1 -1
  185. package/dist/PanelSection.js +16 -4
  186. package/dist/PanelSection.js.map +1 -1
  187. package/dist/PanelStack.d.ts +17 -0
  188. package/dist/PanelStack.d.ts.map +1 -1
  189. package/dist/PanelStack.js +20 -3
  190. package/dist/PanelStack.js.map +1 -1
  191. package/dist/ParallelCoordinatesChart.js +5 -5
  192. package/dist/ParetoChart.js +5 -5
  193. package/dist/PasswordInput.js +3 -3
  194. package/dist/PointAndFigureChart.d.ts.map +1 -1
  195. package/dist/PointAndFigureChart.js +19 -15
  196. package/dist/PointAndFigureChart.js.map +1 -1
  197. package/dist/PolygonChart.js +5 -5
  198. package/dist/Popover.js +3 -3
  199. package/dist/Popper.js +3 -3
  200. package/dist/Portal.js +3 -3
  201. package/dist/PriorityMatrix.d.ts +103 -0
  202. package/dist/PriorityMatrix.d.ts.map +1 -0
  203. package/dist/PriorityMatrix.js +495 -0
  204. package/dist/PriorityMatrix.js.map +1 -0
  205. package/dist/ProgressBar.js +3 -3
  206. package/dist/ProgressIndicator.js +3 -3
  207. package/dist/Quote.js +3 -3
  208. package/dist/RadarChart.js +3 -3
  209. package/dist/Radio.js +3 -3
  210. package/dist/RadioGroup.js +3 -3
  211. package/dist/RangeSlider.js +3 -3
  212. package/dist/Rating.js +3 -3
  213. package/dist/RenkoChart.d.ts.map +1 -1
  214. package/dist/RenkoChart.js +22 -16
  215. package/dist/RenkoChart.js.map +1 -1
  216. package/dist/RibbonChart.js +3 -3
  217. package/dist/RoseChart.js +3 -3
  218. package/dist/Row.js +3 -3
  219. package/dist/SankeyChart.js +3 -3
  220. package/dist/ScatterPlot.js +3 -3
  221. package/dist/ScoreCard.js +3 -3
  222. package/dist/Search.d.ts.map +1 -1
  223. package/dist/Search.js +7 -5
  224. package/dist/Search.js.map +1 -1
  225. package/dist/Select.d.ts +3 -1
  226. package/dist/Select.d.ts.map +1 -1
  227. package/dist/Select.js +9 -3
  228. package/dist/Select.js.map +1 -1
  229. package/dist/SelectableList.js +3 -3
  230. package/dist/SelectableRow.js +3 -3
  231. package/dist/SelectionChip.d.ts.map +1 -1
  232. package/dist/SelectionChip.js +7 -5
  233. package/dist/SelectionChip.js.map +1 -1
  234. package/dist/SideNav.js +3 -3
  235. package/dist/SkeletonText.js +3 -3
  236. package/dist/SkipLink.js +3 -3
  237. package/dist/SlideIndicator.js +3 -3
  238. package/dist/Slider.js +3 -3
  239. package/dist/SolidGaugeChart.js +3 -3
  240. package/dist/Sparkline.js +3 -3
  241. package/dist/Stack.js +3 -3
  242. package/dist/StackedBarChart.d.ts.map +1 -1
  243. package/dist/StackedBarChart.js +32 -18
  244. package/dist/StackedBarChart.js.map +1 -1
  245. package/dist/StateTimelineChart.js +3 -3
  246. package/dist/StatusDot.js +3 -3
  247. package/dist/StatusHistoryChart.js +3 -3
  248. package/dist/StepLineChart.js +3 -3
  249. package/dist/Stepper.js +3 -3
  250. package/dist/StreamgraphChart.js +3 -3
  251. package/dist/StreamingMessage.js +3 -3
  252. package/dist/StructuredList.js +3 -3
  253. package/dist/SunburstChart.js +5 -5
  254. package/dist/Switch.js +3 -3
  255. package/dist/Table.js +3 -3
  256. package/dist/TableOfContents.js +3 -3
  257. package/dist/Tabs.js +3 -3
  258. package/dist/Tag.js +3 -3
  259. package/dist/Textarea.d.ts +3 -1
  260. package/dist/Textarea.d.ts.map +1 -1
  261. package/dist/Textarea.js +9 -3
  262. package/dist/Textarea.js.map +1 -1
  263. package/dist/ThemeProvider.js +3 -3
  264. package/dist/Tile.js +3 -3
  265. package/dist/TileGroup.js +3 -3
  266. package/dist/TileMapChart.js +3 -3
  267. package/dist/TimePicker.js +3 -3
  268. package/dist/TimeRangePicker.d.ts +23 -2
  269. package/dist/TimeRangePicker.d.ts.map +1 -1
  270. package/dist/TimeRangePicker.js +156 -24
  271. package/dist/TimeRangePicker.js.map +1 -1
  272. package/dist/Timeline.js +3 -3
  273. package/dist/TimelineChart.d.ts.map +1 -1
  274. package/dist/TimelineChart.js +4 -4
  275. package/dist/TimelineChart.js.map +1 -1
  276. package/dist/Toast.js +3 -3
  277. package/dist/Toggle.js +3 -3
  278. package/dist/Toggletip.js +3 -3
  279. package/dist/Tooltip.js +3 -3
  280. package/dist/TraceWaterfallChart.js +3 -3
  281. package/dist/Transcription.js +3 -3
  282. package/dist/TreeView.js +3 -3
  283. package/dist/TreegraphChart.js +5 -5
  284. package/dist/TreemapChart.js +5 -5
  285. package/dist/Typography.js +3 -3
  286. package/dist/UnorderedList.js +3 -3
  287. package/dist/UtilityPanel.js +3 -3
  288. package/dist/VariablePieChart.js +3 -3
  289. package/dist/VectorFieldChart.d.ts.map +1 -1
  290. package/dist/VectorFieldChart.js +20 -16
  291. package/dist/VectorFieldChart.js.map +1 -1
  292. package/dist/VennChart.js +3 -3
  293. package/dist/ViolinChart.js +3 -3
  294. package/dist/WaffleChart.js +3 -3
  295. package/dist/WaterfallChart.js +3 -3
  296. package/dist/WindBarbChart.d.ts.map +1 -1
  297. package/dist/WindBarbChart.js +19 -15
  298. package/dist/WindBarbChart.js.map +1 -1
  299. package/dist/Wizard.js +4 -4
  300. package/dist/WordCloudChart.js +3 -3
  301. package/dist/chartScale.d.ts +8 -0
  302. package/dist/chartScale.d.ts.map +1 -1
  303. package/dist/chartScale.js +48 -5
  304. package/dist/chartScale.js.map +1 -1
  305. package/dist/index.d.ts +2 -0
  306. package/dist/index.d.ts.map +1 -1
  307. package/dist/index.js +1 -0
  308. package/dist/index.js.map +1 -1
  309. package/dist/priorityLabels.d.ts +143 -0
  310. package/dist/priorityLabels.d.ts.map +1 -0
  311. package/dist/priorityLabels.js +240 -0
  312. package/dist/priorityLabels.js.map +1 -0
  313. package/dist/styles.css +128 -4
  314. package/package.json +9 -7
  315. package/dist/GeoMap.d.ts +0 -204
  316. package/dist/GeoMap.d.ts.map +0 -1
  317. package/dist/GeoMap.js +0 -715
  318. package/dist/GeoMap.js.map +0 -1
package/dist/GeoMap.js DELETED
@@ -1,715 +0,0 @@
1
- import { NgFor, NgIf } from "@angular/common";
2
- import { Component, Input as NgInput } from "@angular/core";
3
- import { classNames } from "./classNames.js";
4
- import * as i0 from "@angular/core";
5
- const PADDING = 24;
6
- const MAX_POINT_RADIUS = 32;
7
- const WORLD = { south: -90, west: -180, north: 90, east: 180 };
8
- const TONES = [
9
- "category1",
10
- "category2",
11
- "category3",
12
- "category4",
13
- "category5",
14
- "category6",
15
- "category7",
16
- "category8",
17
- ];
18
- const GEOMETRY_TYPES = new Set(["Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon"]);
19
- function isFiniteCoordinate(c) {
20
- return !!c && Number.isFinite(c.latitude) && Number.isFinite(c.longitude);
21
- }
22
- function scaleNumber(value, min, max, start, end) {
23
- return max === min ? (start + end) / 2 : start + ((value - min) / (max - min)) * (end - start);
24
- }
25
- function mixPercent(value) {
26
- return `${Math.round(Math.max(0, Math.min(100, value)))}%`;
27
- }
28
- function coordinatePair(value) {
29
- if (!Array.isArray(value) || value.length < 2 || Array.isArray(value[0]))
30
- return undefined;
31
- const longitude = Number(value[0]);
32
- const latitude = Number(value[1]);
33
- if (!Number.isFinite(latitude) || !Number.isFinite(longitude))
34
- return undefined;
35
- return { latitude, longitude };
36
- }
37
- function collectGeometryCoordinates(value, out) {
38
- if (!Array.isArray(value))
39
- return;
40
- const pair = coordinatePair(value);
41
- if (pair) {
42
- out.push(pair);
43
- return;
44
- }
45
- for (const item of value)
46
- collectGeometryCoordinates(item, out);
47
- }
48
- function isGeometry(geometry) {
49
- return !!geometry && GEOMETRY_TYPES.has(geometry.type) && Array.isArray(geometry.coordinates);
50
- }
51
- function layerCoordinates(layer) {
52
- switch (layer.type) {
53
- case "geojson":
54
- case "choropleth": {
55
- const out = [];
56
- for (const feature of layer.features ?? []) {
57
- if (isGeometry(feature.geometry))
58
- collectGeometryCoordinates(feature.geometry.coordinates, out);
59
- }
60
- return out;
61
- }
62
- case "points":
63
- case "density":
64
- case "hexbin":
65
- case "cluster":
66
- return (layer.points ?? []).filter(isFiniteCoordinate);
67
- case "flow": {
68
- const out = [];
69
- for (const flow of layer.flows ?? []) {
70
- if (isFiniteCoordinate(flow.source))
71
- out.push(flow.source);
72
- if (isFiniteCoordinate(flow.target))
73
- out.push(flow.target);
74
- }
75
- return out;
76
- }
77
- }
78
- }
79
- function validBounds(candidate) {
80
- return candidate &&
81
- Number.isFinite(candidate.south) &&
82
- Number.isFinite(candidate.west) &&
83
- Number.isFinite(candidate.north) &&
84
- Number.isFinite(candidate.east) &&
85
- candidate.north > candidate.south &&
86
- candidate.east > candidate.west
87
- ? candidate
88
- : null;
89
- }
90
- function fitBounds(all) {
91
- const coords = [];
92
- for (const layer of all)
93
- coords.push(...layerCoordinates(layer));
94
- if (coords.length === 0)
95
- return WORLD;
96
- let south = Infinity;
97
- let west = Infinity;
98
- let north = -Infinity;
99
- let east = -Infinity;
100
- for (const c of coords) {
101
- if (c.latitude < south)
102
- south = c.latitude;
103
- if (c.latitude > north)
104
- north = c.latitude;
105
- if (c.longitude < west)
106
- west = c.longitude;
107
- if (c.longitude > east)
108
- east = c.longitude;
109
- }
110
- const latPad = Math.max((north - south) * 0.05, 1);
111
- const lonPad = Math.max((east - west) * 0.05, 1);
112
- return {
113
- south: Math.max(south - latPad, -90),
114
- west: Math.max(west - lonPad, -180),
115
- north: Math.min(north + latPad, 90),
116
- east: Math.min(east + lonPad, 180),
117
- };
118
- }
119
- function mercatorY(latitude) {
120
- const clamped = Math.max(-85, Math.min(85, latitude));
121
- return Math.log(Math.tan(Math.PI / 4 + (clamped * Math.PI) / 360));
122
- }
123
- function createProjector(b, projection, width, height) {
124
- const innerW = Math.max(width - PADDING * 2, 1);
125
- const innerH = Math.max(height - PADDING * 2, 1);
126
- const projY = (latitude) => (projection === "mercator" ? mercatorY(latitude) : latitude);
127
- const top = projY(b.north);
128
- const bottom = projY(b.south);
129
- const lonSpan = b.east - b.west || 1;
130
- const ySpan = top - bottom || 1;
131
- return (c) => ({
132
- x: PADDING + ((c.longitude - b.west) / lonSpan) * innerW,
133
- y: PADDING + ((top - projY(c.latitude)) / ySpan) * innerH,
134
- });
135
- }
136
- function linePath(coordinates, project) {
137
- return coordinates
138
- .map((item, index) => {
139
- const pair = coordinatePair(item);
140
- if (!pair)
141
- return "";
142
- const p = project(pair);
143
- return `${index === 0 ? "M" : "L"} ${p.x} ${p.y}`;
144
- })
145
- .filter(Boolean)
146
- .join(" ");
147
- }
148
- function ringsPath(coordinates, project) {
149
- return coordinates
150
- .map((ring) => {
151
- const path = Array.isArray(ring) ? linePath(ring, project) : "";
152
- return path === "" ? "" : `${path} Z`;
153
- })
154
- .filter(Boolean)
155
- .join(" ");
156
- }
157
- function geometryPath(geometry, project) {
158
- switch (geometry.type) {
159
- case "Point": {
160
- const pair = coordinatePair(geometry.coordinates);
161
- if (!pair)
162
- return "";
163
- const p = project(pair);
164
- return `M ${p.x - 5} ${p.y} a 5 5 0 1 0 10 0 a 5 5 0 1 0 -10 0`;
165
- }
166
- case "MultiPoint":
167
- return geometry.coordinates
168
- .map((c) => geometryPath({ type: "Point", coordinates: c }, project))
169
- .filter(Boolean)
170
- .join(" ");
171
- case "LineString":
172
- return linePath(geometry.coordinates, project);
173
- case "MultiLineString":
174
- return geometry.coordinates
175
- .map((line) => (Array.isArray(line) ? linePath(line, project) : ""))
176
- .filter(Boolean)
177
- .join(" ");
178
- case "Polygon":
179
- return ringsPath(geometry.coordinates, project);
180
- case "MultiPolygon":
181
- return geometry.coordinates
182
- .map((polygon) => (Array.isArray(polygon) ? ringsPath(polygon, project) : ""))
183
- .filter(Boolean)
184
- .join(" ");
185
- }
186
- }
187
- function pointRadius(point, min, max, rMin, rMax) {
188
- if (typeof point.r === "number" && Number.isFinite(point.r) && point.r >= 0) {
189
- return Math.min(point.r, MAX_POINT_RADIUS);
190
- }
191
- return scaleNumber(point.value ?? 1, min, max, rMin, rMax);
192
- }
193
- function hexagonPoints(cx, cy, radius) {
194
- return Array.from({ length: 6 }, (_, index) => {
195
- const angle = (Math.PI / 3) * index - Math.PI / 6;
196
- return `${cx + Math.cos(angle) * radius},${cy + Math.sin(angle) * radius}`;
197
- }).join(" ");
198
- }
199
- function flowPath(source, target, project) {
200
- const a = project(source);
201
- const b = project(target);
202
- const mx = (a.x + b.x) / 2;
203
- const my = (a.y + b.y) / 2;
204
- const dx = b.x - a.x;
205
- const dy = b.y - a.y;
206
- const cx = mx - dy * 0.18;
207
- const cy = my + dx * 0.18;
208
- return `M ${a.x} ${a.y} Q ${cx} ${cy} ${b.x} ${b.y}`;
209
- }
210
- function binPoints(points, cellSize) {
211
- const hexHeight = cellSize * (Math.sqrt(3) / 2);
212
- const bins = new Map();
213
- for (const point of points) {
214
- const q = Math.floor(point.longitude / cellSize);
215
- const r = Math.floor(point.latitude / hexHeight);
216
- const id = `${q}:${r}`;
217
- const bin = bins.get(id);
218
- const value = Number.isFinite(point.value) ? point.value : 1;
219
- if (bin) {
220
- bin.count += 1;
221
- bin.value += value;
222
- }
223
- else {
224
- bins.set(id, { id, q, r, center: { latitude: r * hexHeight, longitude: q * cellSize }, count: 1, value });
225
- }
226
- }
227
- return [...bins.values()];
228
- }
229
- function clusterPoints(points, radius) {
230
- const clusters = [];
231
- for (const point of points) {
232
- const cluster = clusters.find((item) => {
233
- const dLat = item.latitude - point.latitude;
234
- const dLon = item.longitude - point.longitude;
235
- return Math.sqrt(dLat * dLat + dLon * dLon) <= radius;
236
- });
237
- const value = Number.isFinite(point.value) ? point.value : 1;
238
- if (!cluster) {
239
- clusters.push({
240
- id: `cluster:${clusters.length}`,
241
- latitude: point.latitude,
242
- longitude: point.longitude,
243
- count: 1,
244
- value,
245
- });
246
- continue;
247
- }
248
- cluster.latitude = (cluster.latitude * cluster.count + point.latitude) / (cluster.count + 1);
249
- cluster.longitude = (cluster.longitude * cluster.count + point.longitude) / (cluster.count + 1);
250
- cluster.count += 1;
251
- cluster.value += value;
252
- }
253
- return clusters;
254
- }
255
- function positiveOr(value, fallback) {
256
- return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : fallback;
257
- }
258
- function emptyRenderLayer(type, key, summary) {
259
- return {
260
- key,
261
- type,
262
- summary,
263
- features: [],
264
- regions: [],
265
- circles: [],
266
- flows: [],
267
- hexes: [],
268
- clusters: [],
269
- };
270
- }
271
- export class GeoMap {
272
- static stComponentName = "GeoMap";
273
- componentName = "GeoMap";
274
- layers = [];
275
- width;
276
- height;
277
- projection;
278
- bounds;
279
- label = "";
280
- classInput;
281
- get hostClass() {
282
- return classNames("st-geoMap", this.classInput);
283
- }
284
- get resolvedWidth() {
285
- return this.width ?? 520;
286
- }
287
- get resolvedHeight() {
288
- return this.height ?? 320;
289
- }
290
- get resolvedProjection() {
291
- return this.projection === "mercator" ? "mercator" : "equirectangular";
292
- }
293
- get viewBox() {
294
- return `0 0 ${this.resolvedWidth} ${this.resolvedHeight}`;
295
- }
296
- get renderedLayers() {
297
- const layers = this.layers ?? [];
298
- const mapBounds = validBounds(this.bounds) ?? fitBounds(layers);
299
- const project = createProjector(mapBounds, this.resolvedProjection, this.resolvedWidth, this.resolvedHeight);
300
- return layers.map((layer, layerIndex) => {
301
- const key = `layer-${layerIndex}`;
302
- switch (layer.type) {
303
- case "geojson": {
304
- const features = (layer.features ?? [])
305
- .map((feature, index) => {
306
- if (!isGeometry(feature.geometry))
307
- return null;
308
- const d = geometryPath(feature.geometry, project);
309
- if (d === "")
310
- return null;
311
- return {
312
- key: `${feature.id}-${index}`,
313
- d,
314
- tone: layer.tone ?? TONES[index % TONES.length],
315
- line: feature.geometry.type === "LineString" || feature.geometry.type === "MultiLineString",
316
- text: `${feature.label ?? feature.id}${feature.value === undefined ? "" : `: ${feature.value}`}`,
317
- };
318
- })
319
- .filter((feature) => feature !== null);
320
- return { ...emptyRenderLayer(layer.type, key, `${layer.label ?? "GeoJSON"}: ${features.length} entités`), features };
321
- }
322
- case "choropleth": {
323
- const values = layer.values ?? {};
324
- const finiteValues = (layer.features ?? [])
325
- .map((feature) => values[feature.id])
326
- .filter((value) => Number.isFinite(value));
327
- const max = Math.max(1, ...finiteValues);
328
- const tone = layer.tone ?? "category1";
329
- const regions = (layer.features ?? [])
330
- .map((feature, index) => {
331
- if (!isGeometry(feature.geometry))
332
- return null;
333
- const d = geometryPath(feature.geometry, project);
334
- if (d === "")
335
- return null;
336
- const value = values[feature.id];
337
- const valid = Number.isFinite(value);
338
- return {
339
- key: `${feature.id}-${index}`,
340
- d,
341
- tone,
342
- mix: valid ? mixPercent(scaleNumber(value, 0, max, 22, 90)) : null,
343
- text: valid ? `${feature.label ?? feature.id}: ${value}` : `${feature.label ?? feature.id}`,
344
- };
345
- })
346
- .filter((region) => region !== null);
347
- return { ...emptyRenderLayer(layer.type, key, `${layer.label ?? "Choroplèthe"}: ${regions.length} régions`), regions };
348
- }
349
- case "points": {
350
- const valid = (layer.points ?? []).filter(isFiniteCoordinate);
351
- const pointValues = valid.map((point) => (Number.isFinite(point.value) ? point.value : 1));
352
- const min = Math.min(0, ...pointValues);
353
- const max = Math.max(1, ...pointValues);
354
- const rMin = positiveOr(layer.minRadius, 5);
355
- const rMax = positiveOr(layer.maxRadius, 14);
356
- const circles = valid.map((point, index) => {
357
- const p = project(point);
358
- return {
359
- key: `${point.id ?? index}`,
360
- cx: p.x,
361
- cy: p.y,
362
- r: pointRadius(point, min, max, rMin, rMax),
363
- tone: point.tone ?? layer.tone ?? TONES[index % TONES.length],
364
- mix: null,
365
- text: `${point.label ?? point.id ?? `(${point.latitude}, ${point.longitude})`}${point.value === undefined ? "" : `: ${point.value}`}`,
366
- };
367
- });
368
- return { ...emptyRenderLayer(layer.type, key, `${layer.label ?? "Points"}: ${circles.length}`), circles };
369
- }
370
- case "density": {
371
- const valid = (layer.points ?? []).filter(isFiniteCoordinate);
372
- const weights = valid.map((point) => (Number.isFinite(point.value) ? point.value : 1));
373
- const max = Math.max(1, ...weights);
374
- const rMax = positiveOr(layer.maxRadius, 17);
375
- const tone = layer.tone ?? "category3";
376
- const circles = valid.map((point, index) => {
377
- const p = project(point);
378
- const weight = Number.isFinite(point.value) ? point.value : 1;
379
- return {
380
- key: `${point.id ?? index}`,
381
- cx: p.x,
382
- cy: p.y,
383
- r: scaleNumber(weight, 0, max, 8, rMax),
384
- tone,
385
- mix: mixPercent(scaleNumber(weight, 0, max, 25, 60)),
386
- text: `(${point.latitude}, ${point.longitude}): ${weight}`,
387
- };
388
- });
389
- return { ...emptyRenderLayer(layer.type, key, `${layer.label ?? "Densité"}: ${circles.length} points`), circles };
390
- }
391
- case "flow": {
392
- const valid = (layer.flows ?? []).filter((flow) => isFiniteCoordinate(flow.source) && isFiniteCoordinate(flow.target));
393
- const flowValues = valid.map((flow) => (Number.isFinite(flow.value) ? flow.value : 1));
394
- const max = Math.max(1, ...flowValues);
395
- const tone = layer.tone ?? "category1";
396
- const flows = valid.map((flow, index) => {
397
- const value = Number.isFinite(flow.value) ? flow.value : 1;
398
- return {
399
- key: `${flow.id ?? index}`,
400
- d: flowPath(flow.source, flow.target, project),
401
- strokeWidth: scaleNumber(value, 0, max, 2, 9),
402
- tone,
403
- text: `${flow.label ?? `(${flow.source.latitude}, ${flow.source.longitude}) → (${flow.target.latitude}, ${flow.target.longitude})`}: ${value}`,
404
- };
405
- });
406
- return { ...emptyRenderLayer(layer.type, key, `${layer.label ?? "Flux"}: ${flows.length}`), flows };
407
- }
408
- case "hexbin": {
409
- const valid = (layer.points ?? []).filter(isFiniteCoordinate);
410
- const cellSize = positiveOr(layer.cellSize, 1);
411
- const bins = binPoints(valid, cellSize);
412
- const max = Math.max(1, ...bins.map((bin) => bin.value));
413
- const hexes = bins.map((bin, index) => {
414
- const p = project(bin.center);
415
- return {
416
- key: bin.id,
417
- points: hexagonPoints(p.x, p.y, scaleNumber(bin.value, 0, max, 10, 22)),
418
- tone: layer.tone ?? TONES[index % TONES.length],
419
- mix: mixPercent(scaleNumber(bin.value, 0, max, 25, 85)),
420
- text: `${bin.id}: ${bin.value}`,
421
- };
422
- });
423
- return { ...emptyRenderLayer(layer.type, key, `${layer.label ?? "Hexbin"}: ${hexes.length} alvéoles`), hexes };
424
- }
425
- case "cluster": {
426
- const valid = (layer.points ?? []).filter(isFiniteCoordinate);
427
- const radius = positiveOr(layer.radius, 1);
428
- const clusters = clusterPoints(valid, radius);
429
- const max = Math.max(1, ...clusters.map((cluster) => cluster.count));
430
- const marks = clusters.map((cluster, index) => {
431
- const p = project(cluster);
432
- return {
433
- key: cluster.id,
434
- cx: p.x,
435
- cy: p.y,
436
- r: scaleNumber(cluster.count, 0, max, 8, 24),
437
- tone: layer.tone ?? TONES[index % TONES.length],
438
- text: `${cluster.id}: ${cluster.count}`,
439
- };
440
- });
441
- return { ...emptyRenderLayer(layer.type, key, `${layer.label ?? "Clusters"}: ${marks.length}`), clusters: marks };
442
- }
443
- }
444
- });
445
- }
446
- get dataValueItems() {
447
- const items = [];
448
- for (const layer of this.renderedLayers) {
449
- items.push(layer.summary);
450
- items.push(...layer.features.map((feature) => feature.text));
451
- items.push(...layer.regions.map((region) => region.text));
452
- items.push(...layer.circles.map((circle) => circle.text));
453
- items.push(...layer.flows.map((flow) => flow.text));
454
- items.push(...layer.hexes.map((hex) => hex.text));
455
- items.push(...layer.clusters.map((cluster) => cluster.text));
456
- }
457
- return items;
458
- }
459
- trackByKey(_index, item) {
460
- return item.key;
461
- }
462
- layerClass(layer) {
463
- return `st-geoMap__layer st-geoMap__layer--${layer.type}`;
464
- }
465
- featureClass(feature) {
466
- return classNames("st-geoMap__feature", `st-geoMap__feature--${feature.tone}`, feature.line && "st-geoMap__feature--line");
467
- }
468
- regionClass(region) {
469
- return region.mix === null ? "st-geoMap__region st-geoMap__region--empty" : classNames("st-geoMap__region", `st-geoMap__region--${region.tone}`);
470
- }
471
- pointClass(mark) {
472
- return classNames("st-geoMap__point", `st-geoMap__point--${mark.tone}`);
473
- }
474
- densityClass(mark) {
475
- return classNames("st-geoMap__density", `st-geoMap__density--${mark.tone}`);
476
- }
477
- flowClass(mark) {
478
- return classNames("st-geoMap__flow", `st-geoMap__flow--${mark.tone}`);
479
- }
480
- hexClass(mark) {
481
- return classNames("st-geoMap__hexbin", `st-geoMap__hexbin--${mark.tone}`);
482
- }
483
- clusterClass(mark) {
484
- return classNames("st-geoMap__cluster", `st-geoMap__cluster--${mark.tone}`);
485
- }
486
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: GeoMap, deps: [], target: i0.ɵɵFactoryTarget.Component });
487
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: GeoMap, isStandalone: true, selector: "st-geo-map", inputs: { layers: "layers", width: "width", height: "height", projection: "projection", bounds: "bounds", label: "label", classInput: ["class", "classInput"] }, ngImport: i0, template: `
488
- <div [attr.data-st-component]="componentName" [class]="hostClass">
489
- <div class="st-geoMap__visual" role="img" [attr.aria-label]="label">
490
- <svg
491
- [attr.viewBox]="viewBox"
492
- preserveAspectRatio="xMidYMid meet"
493
- width="100%"
494
- height="100%"
495
- focusable="false"
496
- aria-hidden="true"
497
- >
498
- <rect
499
- class="st-geoMap__frame"
500
- x="0.5"
501
- y="0.5"
502
- [attr.width]="resolvedWidth - 1"
503
- [attr.height]="resolvedHeight - 1"
504
- rx="4"
505
- ></rect>
506
-
507
- <g *ngFor="let layer of renderedLayers; trackBy: trackByKey" [attr.class]="layerClass(layer)">
508
- <ng-container *ngIf="layer.type === 'geojson'">
509
- <path
510
- *ngFor="let feature of layer.features; trackBy: trackByKey"
511
- [attr.class]="featureClass(feature)"
512
- [attr.d]="feature.d"
513
- fill-rule="evenodd"
514
- ></path>
515
- </ng-container>
516
-
517
- <ng-container *ngIf="layer.type === 'choropleth'">
518
- <path
519
- *ngFor="let region of layer.regions; trackBy: trackByKey"
520
- [attr.class]="regionClass(region)"
521
- [attr.d]="region.d"
522
- [style.--st-geoMap-mix]="region.mix"
523
- fill-rule="evenodd"
524
- ></path>
525
- </ng-container>
526
-
527
- <ng-container *ngIf="layer.type === 'points'">
528
- <circle
529
- *ngFor="let mark of layer.circles; trackBy: trackByKey"
530
- [attr.class]="pointClass(mark)"
531
- [attr.cx]="mark.cx"
532
- [attr.cy]="mark.cy"
533
- [attr.r]="mark.r"
534
- ></circle>
535
- </ng-container>
536
-
537
- <ng-container *ngIf="layer.type === 'density'">
538
- <circle
539
- *ngFor="let mark of layer.circles; trackBy: trackByKey"
540
- [attr.class]="densityClass(mark)"
541
- [attr.cx]="mark.cx"
542
- [attr.cy]="mark.cy"
543
- [attr.r]="mark.r"
544
- [style.--st-geoMap-mix]="mark.mix"
545
- ></circle>
546
- </ng-container>
547
-
548
- <ng-container *ngIf="layer.type === 'flow'">
549
- <path
550
- *ngFor="let mark of layer.flows; trackBy: trackByKey"
551
- [attr.class]="flowClass(mark)"
552
- [attr.d]="mark.d"
553
- [attr.stroke-width]="mark.strokeWidth"
554
- ></path>
555
- </ng-container>
556
-
557
- <ng-container *ngIf="layer.type === 'hexbin'">
558
- <polygon
559
- *ngFor="let mark of layer.hexes; trackBy: trackByKey"
560
- [attr.class]="hexClass(mark)"
561
- [attr.points]="mark.points"
562
- [style.--st-geoMap-mix]="mark.mix"
563
- ></polygon>
564
- </ng-container>
565
-
566
- <ng-container *ngIf="layer.type === 'cluster'">
567
- <g
568
- *ngFor="let mark of layer.clusters; trackBy: trackByKey"
569
- [attr.class]="clusterClass(mark)"
570
- >
571
- <circle class="st-geoMap__clusterDot" [attr.cx]="mark.cx" [attr.cy]="mark.cy" [attr.r]="mark.r"></circle>
572
- <circle
573
- class="st-geoMap__clusterRing"
574
- [attr.cx]="mark.cx"
575
- [attr.cy]="mark.cy"
576
- [attr.r]="mark.r + 3"
577
- ></circle>
578
- </g>
579
- </ng-container>
580
- </g>
581
- </svg>
582
- </div>
583
-
584
- <ul class="st-chartDataList" [attr.aria-label]="label + ' data'">
585
- <li *ngFor="let item of dataValueItems">{{ item }}</li>
586
- </ul>
587
- </div>
588
- `, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
589
- }
590
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: GeoMap, decorators: [{
591
- type: Component,
592
- args: [{
593
- selector: "st-geo-map",
594
- standalone: true,
595
- imports: [NgFor, NgIf],
596
- template: `
597
- <div [attr.data-st-component]="componentName" [class]="hostClass">
598
- <div class="st-geoMap__visual" role="img" [attr.aria-label]="label">
599
- <svg
600
- [attr.viewBox]="viewBox"
601
- preserveAspectRatio="xMidYMid meet"
602
- width="100%"
603
- height="100%"
604
- focusable="false"
605
- aria-hidden="true"
606
- >
607
- <rect
608
- class="st-geoMap__frame"
609
- x="0.5"
610
- y="0.5"
611
- [attr.width]="resolvedWidth - 1"
612
- [attr.height]="resolvedHeight - 1"
613
- rx="4"
614
- ></rect>
615
-
616
- <g *ngFor="let layer of renderedLayers; trackBy: trackByKey" [attr.class]="layerClass(layer)">
617
- <ng-container *ngIf="layer.type === 'geojson'">
618
- <path
619
- *ngFor="let feature of layer.features; trackBy: trackByKey"
620
- [attr.class]="featureClass(feature)"
621
- [attr.d]="feature.d"
622
- fill-rule="evenodd"
623
- ></path>
624
- </ng-container>
625
-
626
- <ng-container *ngIf="layer.type === 'choropleth'">
627
- <path
628
- *ngFor="let region of layer.regions; trackBy: trackByKey"
629
- [attr.class]="regionClass(region)"
630
- [attr.d]="region.d"
631
- [style.--st-geoMap-mix]="region.mix"
632
- fill-rule="evenodd"
633
- ></path>
634
- </ng-container>
635
-
636
- <ng-container *ngIf="layer.type === 'points'">
637
- <circle
638
- *ngFor="let mark of layer.circles; trackBy: trackByKey"
639
- [attr.class]="pointClass(mark)"
640
- [attr.cx]="mark.cx"
641
- [attr.cy]="mark.cy"
642
- [attr.r]="mark.r"
643
- ></circle>
644
- </ng-container>
645
-
646
- <ng-container *ngIf="layer.type === 'density'">
647
- <circle
648
- *ngFor="let mark of layer.circles; trackBy: trackByKey"
649
- [attr.class]="densityClass(mark)"
650
- [attr.cx]="mark.cx"
651
- [attr.cy]="mark.cy"
652
- [attr.r]="mark.r"
653
- [style.--st-geoMap-mix]="mark.mix"
654
- ></circle>
655
- </ng-container>
656
-
657
- <ng-container *ngIf="layer.type === 'flow'">
658
- <path
659
- *ngFor="let mark of layer.flows; trackBy: trackByKey"
660
- [attr.class]="flowClass(mark)"
661
- [attr.d]="mark.d"
662
- [attr.stroke-width]="mark.strokeWidth"
663
- ></path>
664
- </ng-container>
665
-
666
- <ng-container *ngIf="layer.type === 'hexbin'">
667
- <polygon
668
- *ngFor="let mark of layer.hexes; trackBy: trackByKey"
669
- [attr.class]="hexClass(mark)"
670
- [attr.points]="mark.points"
671
- [style.--st-geoMap-mix]="mark.mix"
672
- ></polygon>
673
- </ng-container>
674
-
675
- <ng-container *ngIf="layer.type === 'cluster'">
676
- <g
677
- *ngFor="let mark of layer.clusters; trackBy: trackByKey"
678
- [attr.class]="clusterClass(mark)"
679
- >
680
- <circle class="st-geoMap__clusterDot" [attr.cx]="mark.cx" [attr.cy]="mark.cy" [attr.r]="mark.r"></circle>
681
- <circle
682
- class="st-geoMap__clusterRing"
683
- [attr.cx]="mark.cx"
684
- [attr.cy]="mark.cy"
685
- [attr.r]="mark.r + 3"
686
- ></circle>
687
- </g>
688
- </ng-container>
689
- </g>
690
- </svg>
691
- </div>
692
-
693
- <ul class="st-chartDataList" [attr.aria-label]="label + ' data'">
694
- <li *ngFor="let item of dataValueItems">{{ item }}</li>
695
- </ul>
696
- </div>
697
- `,
698
- }]
699
- }], propDecorators: { layers: [{
700
- type: NgInput
701
- }], width: [{
702
- type: NgInput
703
- }], height: [{
704
- type: NgInput
705
- }], projection: [{
706
- type: NgInput
707
- }], bounds: [{
708
- type: NgInput
709
- }], label: [{
710
- type: NgInput
711
- }], classInput: [{
712
- type: NgInput,
713
- args: ["class"]
714
- }] } });
715
- //# sourceMappingURL=GeoMap.js.map