@macrostrat/column-views 1.0.2 → 2.0.0

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 (242) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/esm/_shared.f7eec55a.js +9 -0
  3. package/dist/esm/_shared.f7eec55a.js.map +1 -0
  4. package/dist/esm/age-axis.4a8cf5e6.js +98 -0
  5. package/dist/esm/age-axis.4a8cf5e6.js.map +1 -0
  6. package/dist/esm/age-axis.module.03773a80.css +33 -0
  7. package/dist/esm/age-axis.module.03773a80.css.map +1 -0
  8. package/dist/esm/age-axis.module.3cc91335.js +22 -0
  9. package/dist/esm/age-axis.module.3cc91335.js.map +1 -0
  10. package/dist/esm/age-model-overlay.c7226855.js +57 -0
  11. package/dist/esm/age-model-overlay.c7226855.js.map +1 -0
  12. package/dist/esm/age-model-overlay.module.5d9e78fb.css +14 -0
  13. package/dist/esm/age-model-overlay.module.5d9e78fb.css.map +1 -0
  14. package/dist/esm/age-model-overlay.module.cd985dcb.js +16 -0
  15. package/dist/esm/age-model-overlay.module.cd985dcb.js.map +1 -0
  16. package/dist/esm/base.910b80b4.js +288 -0
  17. package/dist/esm/base.910b80b4.js.map +1 -0
  18. package/dist/esm/boxes.8292cff2.js +258 -0
  19. package/dist/esm/boxes.8292cff2.js.map +1 -0
  20. package/dist/esm/boxes.module.2b5fb18e.css +26 -0
  21. package/dist/esm/boxes.module.2b5fb18e.css.map +1 -0
  22. package/dist/esm/boxes.module.4ebc7796.js +19 -0
  23. package/dist/esm/boxes.module.4ebc7796.js.map +1 -0
  24. package/dist/esm/{carbon-isotopes.3b502a9e.js → carbon-isotopes.10db8285.js} +2 -2
  25. package/dist/esm/{carbon-isotopes.3b502a9e.js.map → carbon-isotopes.10db8285.js.map} +1 -1
  26. package/dist/esm/colors.395c6db5.js +40 -0
  27. package/dist/esm/colors.395c6db5.js.map +1 -0
  28. package/dist/esm/column-correlation.c8dcfe98.js +9 -0
  29. package/dist/esm/column-correlation.c8dcfe98.js.map +1 -0
  30. package/dist/esm/column-nav.5414677c.js +55 -0
  31. package/dist/esm/column-nav.5414677c.js.map +1 -0
  32. package/dist/esm/column-navigation.37cd3245.js +9 -0
  33. package/dist/esm/column-navigation.37cd3245.js.map +1 -0
  34. package/dist/esm/column.01d68dd8.js +127 -0
  35. package/dist/esm/column.01d68dd8.js.map +1 -0
  36. package/dist/esm/{column.db058031.js → column.a25f8ebd.js} +4 -4
  37. package/dist/esm/column.a25f8ebd.js.map +1 -0
  38. package/dist/esm/column.module.1b776e15.js +46 -0
  39. package/dist/esm/column.module.1b776e15.js.map +1 -0
  40. package/dist/esm/column.module.a67a6b4c.css +159 -0
  41. package/dist/esm/column.module.a67a6b4c.css.map +1 -0
  42. package/dist/esm/composite-scale.577bf64a.js +222 -0
  43. package/dist/esm/composite-scale.577bf64a.js.map +1 -0
  44. package/dist/esm/composite.039e4798.js +163 -0
  45. package/dist/esm/composite.039e4798.js.map +1 -0
  46. package/dist/esm/{core.4db8e452.js → core.843310d3.js} +11 -12
  47. package/dist/esm/core.843310d3.js.map +1 -0
  48. package/dist/esm/core.91ede078.js +206 -0
  49. package/dist/esm/core.91ede078.js.map +1 -0
  50. package/dist/esm/correlation-chart.abd8b346.js +9 -0
  51. package/dist/esm/correlation-chart.abd8b346.js.map +1 -0
  52. package/dist/esm/data-provider.1506eb64.js.map +1 -1
  53. package/dist/esm/data-provider.f10c6d0b.js +13 -0
  54. package/dist/esm/data-provider.f10c6d0b.js.map +1 -0
  55. package/dist/esm/fetch.99aec438.js +152 -0
  56. package/dist/esm/fetch.99aec438.js.map +1 -0
  57. package/dist/esm/hash-string.285b37fb.js +39 -0
  58. package/dist/esm/hash-string.285b37fb.js.map +1 -0
  59. package/dist/esm/helpers.2f0a0cb7.js +141 -0
  60. package/dist/esm/helpers.2f0a0cb7.js.map +1 -0
  61. package/dist/esm/index.d.ts +797 -120
  62. package/dist/esm/index.d.ts.map +1 -1
  63. package/dist/esm/index.js +14 -8
  64. package/dist/esm/index.js.map +1 -1
  65. package/dist/esm/inset-map.3c18106d.js +66 -0
  66. package/dist/esm/inset-map.3c18106d.js.map +1 -0
  67. package/dist/esm/keyboard-navigation.6713401b.js +48 -0
  68. package/dist/esm/keyboard-navigation.6713401b.js.map +1 -0
  69. package/dist/esm/keyboard-navigation.a9fc80dd.js +112 -0
  70. package/dist/esm/keyboard-navigation.a9fc80dd.js.map +1 -0
  71. package/dist/esm/layers.033d3fb0.js +170 -0
  72. package/dist/esm/layers.033d3fb0.js.map +1 -0
  73. package/dist/esm/main.2e0375a5.js +221 -0
  74. package/dist/esm/main.2e0375a5.js.map +1 -0
  75. package/dist/esm/main.module.3dd9500b.css +134 -0
  76. package/dist/esm/main.module.3dd9500b.css.map +1 -0
  77. package/dist/esm/main.module.c09154b1.js +70 -0
  78. package/dist/esm/main.module.c09154b1.js.map +1 -0
  79. package/dist/esm/mapbox.cac42eed.js +167 -0
  80. package/dist/esm/mapbox.cac42eed.js.map +1 -0
  81. package/dist/esm/maps.bcdea9c1.js +11 -0
  82. package/dist/esm/maps.bcdea9c1.js.map +1 -0
  83. package/dist/esm/{names.f6a4e9a4.js → names.a8f2b452.js} +5 -5
  84. package/dist/esm/names.a8f2b452.js.map +1 -0
  85. package/dist/esm/panel.598f76a5.js +420 -0
  86. package/dist/esm/panel.598f76a5.js.map +1 -0
  87. package/dist/esm/panel.module.386166cc.js +58 -0
  88. package/dist/esm/panel.module.386166cc.js.map +1 -0
  89. package/dist/esm/panel.module.3d2ea3c6.css +111 -0
  90. package/dist/esm/panel.module.3d2ea3c6.css.map +1 -0
  91. package/dist/esm/popover.a810b7bc.js +66 -0
  92. package/dist/esm/popover.a810b7bc.js.map +1 -0
  93. package/dist/esm/popover.module.c4ba4189.js +22 -0
  94. package/dist/esm/popover.module.c4ba4189.js.map +1 -0
  95. package/dist/esm/{selection-popover.module.0a701258.css → popover.module.c4d6bfb0.css} +11 -8
  96. package/dist/esm/popover.module.c4d6bfb0.css.map +1 -0
  97. package/dist/esm/prepare-data.d4284b4a.js +125 -0
  98. package/dist/esm/prepare-data.d4284b4a.js.map +1 -0
  99. package/dist/esm/prepare-units.6c890a96.js +104 -0
  100. package/dist/esm/prepare-units.6c890a96.js.map +1 -0
  101. package/dist/esm/{resolvers.b5c82b78.js → resolvers.36013b49.js} +13 -2
  102. package/dist/esm/resolvers.36013b49.js.map +1 -0
  103. package/dist/esm/section.a34d379a.js +215 -0
  104. package/dist/esm/section.a34d379a.js.map +1 -0
  105. package/dist/esm/selection.f5b0297e.js +143 -0
  106. package/dist/esm/selection.f5b0297e.js.map +1 -0
  107. package/dist/esm/state.178ef364.js +75 -0
  108. package/dist/esm/state.178ef364.js.map +1 -0
  109. package/dist/esm/state.2952cbca.js +118 -0
  110. package/dist/esm/state.2952cbca.js.map +1 -0
  111. package/dist/esm/store.c4d7a8a4.js +52 -0
  112. package/dist/esm/store.c4d7a8a4.js.map +1 -0
  113. package/dist/esm/styles.7bc776d1.js +95 -0
  114. package/dist/esm/styles.7bc776d1.js.map +1 -0
  115. package/dist/esm/svg.4b9a96c1.js +89 -0
  116. package/dist/esm/svg.4b9a96c1.js.map +1 -0
  117. package/dist/esm/types.0f0b57c9.js +3 -0
  118. package/dist/esm/types.0f0b57c9.js.map +1 -0
  119. package/dist/esm/unit-details.071cefed.js +9 -0
  120. package/dist/esm/unit-details.071cefed.js.map +1 -0
  121. package/dist/esm/units.5a4fc058.js +98 -0
  122. package/dist/esm/units.5a4fc058.js.map +1 -0
  123. package/dist/esm/utils.d7a43a2a.js +55 -0
  124. package/dist/esm/utils.d7a43a2a.js.map +1 -0
  125. package/dist/node/index.js.map +1 -1
  126. package/package.json +24 -7
  127. package/src/age-axis.module.sass +27 -0
  128. package/src/age-axis.ts +82 -19
  129. package/src/age-model-overlay.module.sass +11 -0
  130. package/src/age-model-overlay.ts +73 -0
  131. package/src/carbon-isotopes/column.ts +4 -2
  132. package/src/carbon-isotopes/core.ts +9 -6
  133. package/src/carbon-isotopes/data-provider.ts +3 -3
  134. package/src/column.module.sass +58 -49
  135. package/src/column.ts +149 -135
  136. package/src/correlation-chart/hash-string.ts +57 -0
  137. package/src/correlation-chart/index.ts +2 -0
  138. package/src/correlation-chart/main.module.sass +122 -0
  139. package/src/correlation-chart/main.ts +305 -0
  140. package/src/correlation-chart/prepare-data.ts +217 -0
  141. package/src/correlation-chart/stories/correlation-chart.stories.ts +192 -0
  142. package/src/correlation-chart/stories/stories.module.sass +18 -0
  143. package/src/correlation-chart/unconformity-line.module.sass +8 -0
  144. package/src/correlation-chart/unconformity-line.ts +25 -0
  145. package/src/data-provider/base.ts +388 -0
  146. package/src/data-provider/column-nav.ts +53 -0
  147. package/src/data-provider/fetch.ts +231 -0
  148. package/src/data-provider/index.ts +4 -0
  149. package/src/data-provider/store.ts +72 -0
  150. package/src/index.ts +6 -3
  151. package/src/maps/_shared/index.ts +2 -0
  152. package/src/maps/_shared/inset-map.stories.ts +20 -0
  153. package/src/maps/_shared/inset-map.ts +87 -0
  154. package/src/maps/_shared/styles.ts +57 -0
  155. package/src/maps/column-correlation/column-correlation-map.stories.ts +96 -0
  156. package/src/maps/column-correlation/core.ts +225 -0
  157. package/src/maps/column-correlation/index.ts +2 -0
  158. package/src/maps/column-correlation/state.ts +192 -0
  159. package/src/maps/column-navigation/index.ts +2 -0
  160. package/src/maps/column-navigation/mapbox/column-navigation-map.stories.ts +102 -0
  161. package/src/maps/column-navigation/mapbox/index.ts +219 -0
  162. package/src/maps/column-navigation/mapbox/keyboard-navigation.ts +119 -0
  163. package/src/maps/column-navigation/mapbox/state.ts +109 -0
  164. package/src/maps/column-navigation/svg/column-navigation-svg-map.stories.ts +46 -0
  165. package/src/{map → maps/column-navigation/svg}/index.ts +18 -6
  166. package/src/{map → maps/column-navigation/svg}/layers.ts +28 -109
  167. package/src/maps/column-navigation/utils/keyboard-navigation.ts +58 -0
  168. package/src/maps/index.ts +3 -0
  169. package/src/prepare-units/composite-scale.ts +353 -0
  170. package/src/prepare-units/helpers.ts +226 -0
  171. package/src/prepare-units/index.ts +177 -0
  172. package/src/prepare-units/utils.ts +98 -0
  173. package/src/section.ts +264 -84
  174. package/src/unit-details/index.ts +2 -215
  175. package/src/unit-details/{index.module.sass → panel.module.sass} +39 -8
  176. package/src/unit-details/panel.ts +523 -0
  177. package/src/{selection-popover.module.sass → unit-details/popover.module.sass} +4 -2
  178. package/src/unit-details/popover.ts +82 -0
  179. package/src/units/boxes.module.sass +16 -0
  180. package/src/units/boxes.ts +243 -90
  181. package/src/units/colors.ts +64 -0
  182. package/src/units/composite.ts +157 -152
  183. package/src/units/index.ts +76 -9
  184. package/src/units/names.ts +8 -4
  185. package/src/units/resolvers.ts +11 -0
  186. package/src/units/selection.ts +115 -101
  187. package/src/units/types.ts +5 -16
  188. package/dist/esm/age-axis.64c509ee.js +0 -41
  189. package/dist/esm/age-axis.64c509ee.js.map +0 -1
  190. package/dist/esm/boxes.13968b76.js +0 -164
  191. package/dist/esm/boxes.13968b76.js.map +0 -1
  192. package/dist/esm/boxes.module.28873d08.css +0 -4
  193. package/dist/esm/boxes.module.28873d08.css.map +0 -1
  194. package/dist/esm/boxes.module.605bdcd6.js +0 -13
  195. package/dist/esm/boxes.module.605bdcd6.js.map +0 -1
  196. package/dist/esm/column.8dd26e1a.js +0 -149
  197. package/dist/esm/column.8dd26e1a.js.map +0 -1
  198. package/dist/esm/column.db058031.js.map +0 -1
  199. package/dist/esm/column.module.039d872c.css +0 -151
  200. package/dist/esm/column.module.039d872c.css.map +0 -1
  201. package/dist/esm/column.module.e632868a.js +0 -19
  202. package/dist/esm/column.module.e632868a.js.map +0 -1
  203. package/dist/esm/composite.608a4ca2.js +0 -153
  204. package/dist/esm/composite.608a4ca2.js.map +0 -1
  205. package/dist/esm/core.4db8e452.js.map +0 -1
  206. package/dist/esm/helpers.8a03cfc7.js +0 -94
  207. package/dist/esm/helpers.8a03cfc7.js.map +0 -1
  208. package/dist/esm/index.module.0844afd8.css +0 -65
  209. package/dist/esm/index.module.0844afd8.css.map +0 -1
  210. package/dist/esm/index.module.24fe3a2e.js +0 -37
  211. package/dist/esm/index.module.24fe3a2e.js.map +0 -1
  212. package/dist/esm/layers.ad5fd25d.js +0 -231
  213. package/dist/esm/layers.ad5fd25d.js.map +0 -1
  214. package/dist/esm/map.7aa26f17.js +0 -82
  215. package/dist/esm/map.7aa26f17.js.map +0 -1
  216. package/dist/esm/names.f6a4e9a4.js.map +0 -1
  217. package/dist/esm/providers.cd1e652f.js +0 -25
  218. package/dist/esm/providers.cd1e652f.js.map +0 -1
  219. package/dist/esm/resolvers.b5c82b78.js.map +0 -1
  220. package/dist/esm/section.cc1b1100.js +0 -118
  221. package/dist/esm/section.cc1b1100.js.map +0 -1
  222. package/dist/esm/selection-popover.17d1bd55.js +0 -60
  223. package/dist/esm/selection-popover.17d1bd55.js.map +0 -1
  224. package/dist/esm/selection-popover.module.0a701258.css.map +0 -1
  225. package/dist/esm/selection-popover.module.e22f5183.js +0 -22
  226. package/dist/esm/selection-popover.module.e22f5183.js.map +0 -1
  227. package/dist/esm/selection.bbf26d0e.js +0 -117
  228. package/dist/esm/selection.bbf26d0e.js.map +0 -1
  229. package/dist/esm/store.25eaa168.js +0 -18
  230. package/dist/esm/store.25eaa168.js.map +0 -1
  231. package/dist/esm/types.f016e032.js +0 -18
  232. package/dist/esm/types.f016e032.js.map +0 -1
  233. package/dist/esm/unit-details.56ff8b70.js +0 -209
  234. package/dist/esm/unit-details.56ff8b70.js.map +0 -1
  235. package/dist/esm/units.361088d4.js +0 -42
  236. package/dist/esm/units.361088d4.js.map +0 -1
  237. package/src/helpers.ts +0 -133
  238. package/src/providers.ts +0 -34
  239. package/src/selection-popover.ts +0 -71
  240. package/src/store.ts +0 -12
  241. package/src/units/units.scss +0 -16
  242. /package/src/{map → maps/column-navigation/svg}/animated.ts +0 -0
@@ -1,42 +0,0 @@
1
- import {UnitNamesColumn as $bc17276da4abb183$export$594d19cdd88f8c16} from "./names.f6a4e9a4.js";
2
- import {UnitBoxes as $d254716a820e9c85$export$5d1cdfabe8dc8085} from "./boxes.13968b76.js";
3
- import {TrackedLabeledUnit as $8c8238faa5cde49c$export$f613830566442374, AnnotatedUnitsColumn as $8c8238faa5cde49c$export$d8c3f2fdd653a082, CompositeUnitsColumn as $8c8238faa5cde49c$export$a6684360fef0406e, CompositeUnitComponent as $8c8238faa5cde49c$export$1dfa200d57964eee} from "./composite.608a4ca2.js";
4
- import {MacrostratAxisKey as $faf1eba02aecac6a$export$6d217bb9de27dba7, transformAxisType as $faf1eba02aecac6a$export$ab2a19f8a72df19b} from "./types.f016e032.js";
5
- import {useUnitSelectionDispatch as $4d5d1c15f39f6a14$export$77a278d5ca56e309, useSelectedUnit as $4d5d1c15f39f6a14$export$f0dd93f90aa8e5da, UnitSelectionProvider as $4d5d1c15f39f6a14$export$f19d75b1d4b676a4, useColumnNav as $4d5d1c15f39f6a14$export$91cb5ac808759b34, ColumnNavProvider as $4d5d1c15f39f6a14$export$36fed9e0f93a8fde, UnitKeyboardNavigation as $4d5d1c15f39f6a14$export$70f5ee19650fc7d1} from "./selection.bbf26d0e.js";
6
- import $7H3th$macrostrathyper from "@macrostrat/hyper";
7
- import {LithologyColumn as $7H3th$LithologyColumn} from "@macrostrat/column-components";
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
- const $4c8184c4a7317749$export$3750278673318c9a = ({ width: width = 100 })=>{
17
- /*
18
- A column showing units with USGS color fill
19
- */ return (0, $7H3th$macrostrathyper)((0, $7H3th$LithologyColumn), {
20
- width: width
21
- }, (0, $7H3th$macrostrathyper)((0, $d254716a820e9c85$export$5d1cdfabe8dc8085)));
22
- };
23
- const $4c8184c4a7317749$export$2006342ddaa547c6 = (props)=>{
24
- /*
25
- A column with units and names either
26
- overlapping or offset to the right
27
- */ const { columnWidth: columnWidth, width: width, gutterWidth: gutterWidth = 0, labelOffset: labelOffset = 30 } = props;
28
- return (0, $7H3th$macrostrathyper)([
29
- (0, $7H3th$macrostrathyper)($4c8184c4a7317749$export$3750278673318c9a, {
30
- width: columnWidth
31
- }),
32
- (0, $7H3th$macrostrathyper)((0, $bc17276da4abb183$export$594d19cdd88f8c16), {
33
- transform: `translate(${columnWidth + gutterWidth})`,
34
- paddingLeft: labelOffset,
35
- width: width - columnWidth - gutterWidth
36
- })
37
- ]);
38
- };
39
-
40
-
41
- export {$4c8184c4a7317749$export$3750278673318c9a as UnitsColumn, $4c8184c4a7317749$export$2006342ddaa547c6 as SimpleUnitsColumn, $8c8238faa5cde49c$export$f613830566442374 as TrackedLabeledUnit, $8c8238faa5cde49c$export$d8c3f2fdd653a082 as AnnotatedUnitsColumn, $8c8238faa5cde49c$export$a6684360fef0406e as CompositeUnitsColumn, $8c8238faa5cde49c$export$1dfa200d57964eee as CompositeUnitComponent, $faf1eba02aecac6a$export$6d217bb9de27dba7 as MacrostratAxisKey, $faf1eba02aecac6a$export$ab2a19f8a72df19b as transformAxisType, $4d5d1c15f39f6a14$export$77a278d5ca56e309 as useUnitSelectionDispatch, $4d5d1c15f39f6a14$export$f0dd93f90aa8e5da as useSelectedUnit, $4d5d1c15f39f6a14$export$f19d75b1d4b676a4 as UnitSelectionProvider, $4d5d1c15f39f6a14$export$91cb5ac808759b34 as useColumnNav, $4d5d1c15f39f6a14$export$36fed9e0f93a8fde as ColumnNavProvider, $4d5d1c15f39f6a14$export$70f5ee19650fc7d1 as UnitKeyboardNavigation};
42
- //# sourceMappingURL=units.361088d4.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;AAMA,MAAM,4CAAc,CAAC,SAAE,QAAQ,KAAK;IAClC;;EAEA,GACA,OAAO,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,sBAAc,GAAG;eAAE;IAAM,GAAG,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,yCAAQ;AACjD;AAEA,MAAM,4CAAoB,CAAC;IACzB;;;EAGA,GACA,MAAM,eAAE,WAAW,SAAE,KAAK,eAAE,cAAc,gBAAG,cAAc,IAAI,GAAG;IAElE,OAAO,CAAA,GAAA,sBAAA,EAAE;QACP,CAAA,GAAA,sBAAA,EAAE,2CAAa;YACb,OAAO;QACT;QACA,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,yCAAc,GAAG;YACjB,WAAW,CAAC,UAAU,EAAE,cAAc,YAAY,CAAC,CAAC;YACpD,aAAa;YACb,OAAO,QAAQ,cAAc;QAC/B;KACD;AACH","sources":["packages/column-views/src/units/index.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport { LithologyColumn } from \"@macrostrat/column-components\";\nimport { UnitNamesColumn } from \"./names\";\nimport { ICompositeUnitProps } from \"./composite\";\nimport { UnitBoxes } from \"./boxes\";\n\nconst UnitsColumn = ({ width = 100 }) => {\n /*\n A column showing units with USGS color fill\n */\n return h(LithologyColumn, { width }, h(UnitBoxes));\n};\n\nconst SimpleUnitsColumn = (props: ICompositeUnitProps) => {\n /*\n A column with units and names either\n overlapping or offset to the right\n */\n const { columnWidth, width, gutterWidth = 0, labelOffset = 30 } = props;\n\n return h([\n h(UnitsColumn, {\n width: columnWidth,\n }),\n h(UnitNamesColumn, {\n transform: `translate(${columnWidth + gutterWidth})`,\n paddingLeft: labelOffset,\n width: width - columnWidth - gutterWidth,\n }),\n ]);\n};\n\nexport { UnitsColumn, SimpleUnitsColumn };\nexport * from \"./composite\";\nexport * from \"./types\";\nexport * from \"./selection\";\n"],"names":[],"version":3,"file":"units.361088d4.js.map"}
package/src/helpers.ts DELETED
@@ -1,133 +0,0 @@
1
- import { BaseUnit, UnitLong } from "@macrostrat/api-types";
2
- import { IUnit } from "./units";
3
- import { SectionInfo } from "./section";
4
- import { group } from "d3-array";
5
- import {
6
- AgeRange,
7
- compareAgeRanges,
8
- AgeRangeRelationship,
9
- } from "@macrostrat/stratigraphy-utils";
10
-
11
- const dt = 0.001;
12
-
13
- function unitsOverlap<T extends BaseUnit>(a: T, b: T) {
14
- const rel = compareAgeRanges(unitAgeRange(a), unitAgeRange(b), 0.001);
15
- return rel != AgeRangeRelationship.Disjoint;
16
- }
17
-
18
- function unitAgeRange<T extends BaseUnit>(unit: T): AgeRange {
19
- return [unit.b_age, unit.t_age];
20
- }
21
-
22
- interface ExtUnit extends UnitLong {
23
- bottomOverlap: boolean;
24
- overlappingUnits: number[];
25
- column?: number;
26
- }
27
-
28
- export function extendDivision(
29
- unit: UnitLong,
30
- i: number,
31
- divisions: UnitLong[]
32
- ): ExtUnit {
33
- const overlappingUnits = divisions.filter(
34
- (d) => d.unit_id != unit.unit_id && unitsOverlap(unit, d)
35
- );
36
- let bottomOverlap = false;
37
- for (const d of overlappingUnits) {
38
- if (d.b_age < unit.b_age + dt) bottomOverlap = true;
39
- }
40
-
41
- let column = 0;
42
- if (overlappingUnits.length == 1) {
43
- column = 1;
44
- }
45
-
46
- return {
47
- ...unit,
48
- bottomOverlap,
49
- column,
50
- overlappingUnits: overlappingUnits.map((d) => d.unit_id),
51
- };
52
- }
53
-
54
- export function preprocessUnits(units: UnitLong[]) {
55
- let divisions = units.map(extendDivision);
56
- for (let d of divisions) {
57
- const overlappingUnits = divisions.filter((u) =>
58
- d.overlappingUnits.includes(u.unit_id)
59
- );
60
-
61
- const maxNOverlapping = Math.max(
62
- Math.max(
63
- ...d.overlappingUnits.map(
64
- (uid) =>
65
- divisions.find((u) => u.unit_id == uid).overlappingUnits.length
66
- ),
67
- 0
68
- )
69
- );
70
-
71
- //d.maxNOverlapping = maxNOverlapping;
72
-
73
- // Overlapping columns
74
- const columns = overlappingUnits.map((d) => d.column);
75
-
76
- if (columns.includes(d.column)) {
77
- let col = 0;
78
- // Go through columns to find a better index
79
- while (columns.includes(col)) {
80
- col++;
81
- }
82
- d.column = col;
83
- }
84
- }
85
-
86
- return divisions;
87
- }
88
-
89
- export function groupUnitsIntoSections(units: IUnit[]): SectionInfo[] {
90
- let groups = Array.from(group(units, (d) => d.section_id));
91
- return groups.map(([section_id, units]) => {
92
- const t_age = Math.min(...units.map((d) => d.t_age));
93
- const b_age = Math.max(...units.map((d) => d.b_age));
94
- return { section_id, t_age, b_age, units };
95
- });
96
- }
97
-
98
- export function _mergeOverlappingSections(
99
- sections: SectionInfo[]
100
- ): SectionInfo[] {
101
- /** Columns can have sections that overlap in time. Here, we merge overlapping
102
- * sections into a single section to correctly render gap-bound packages.
103
- */
104
- const [firstSection, ...rest] = sections;
105
- const newSections = [firstSection];
106
- for (const section of rest) {
107
- const lastSection = newSections[newSections.length - 1];
108
- if (
109
- lastSection.b_age < section.t_age ||
110
- lastSection.t_age > section.b_age
111
- ) {
112
- // No overlap, add the section as normal
113
- newSections.push(section);
114
- continue;
115
- }
116
- // Overlap, merge the sections
117
- lastSection.section_id = [
118
- ...ensureArray(lastSection.section_id),
119
- ...ensureArray(section.section_id),
120
- ];
121
- lastSection.units.push(...section.units);
122
- lastSection.b_age = Math.max(lastSection.b_age, section.b_age);
123
- lastSection.t_age = Math.min(lastSection.t_age, section.t_age);
124
- }
125
- return newSections;
126
- }
127
-
128
- export function ensureArray<T>(x: T | T[]): T[] {
129
- if (Array.isArray(x)) {
130
- return x;
131
- }
132
- return [x];
133
- }
package/src/providers.ts DELETED
@@ -1,34 +0,0 @@
1
- import h from "@macrostrat/hyper";
2
- import { ColumnProvider, ColumnAxisType } from "@macrostrat/column-components";
3
- import { APIProvider } from "@macrostrat/ui-components";
4
- import { ReactNode } from "react";
5
-
6
- export function MacrostratColumnProvider(props) {
7
- // A column provider specialized the Macrostrat API
8
- return h(ColumnProvider, { axisType: ColumnAxisType.AGE, ...props });
9
- }
10
-
11
- type APIProviderProps = {
12
- children: ReactNode;
13
- useDev?: boolean;
14
- baseURL?: string;
15
- };
16
-
17
- export function MacrostratAPIProvider({
18
- children,
19
- useDev = false,
20
- baseURL,
21
- }: APIProviderProps) {
22
- baseURL ??= useDev
23
- ? "https://dev2.macrostrat.org/api/v2"
24
- : "https://macrostrat.org/api/v2";
25
-
26
- return h(
27
- APIProvider,
28
- {
29
- baseURL,
30
- unwrapResponse: (res) => res.success.data,
31
- },
32
- children
33
- );
34
- }
@@ -1,71 +0,0 @@
1
- import hyper from "@macrostrat/hyper";
2
- import { Button, Popover } from "@blueprintjs/core";
3
- import { DOMElement } from "react";
4
- import styles from "./selection-popover.module.sass";
5
- import { useSelectedUnit } from "./units";
6
- import { UnitDetailsPanel } from "./unit-details";
7
-
8
- const h = hyper.styled(styles);
9
-
10
- export function UnitDetailsPopover({
11
- style,
12
- children,
13
- boundary,
14
- }: {
15
- style: object;
16
- children: React.ReactNode;
17
- boundary?: DOMElement<any, any>;
18
- }) {
19
- const content = h(LegendPopoverContainer, children);
20
-
21
- return h(
22
- "div.popover-main",
23
- {
24
- style,
25
- },
26
- h(
27
- Popover,
28
- // @ts-ignore
29
- { content, isOpen: true, usePortal: false, boundary, position: "right" },
30
- h("span.popover-target")
31
- )
32
- );
33
- }
34
-
35
- export function LegendPopoverContainer({ children }) {
36
- return h(
37
- "div.legend-panel-outer",
38
- {
39
- onClick(e) {
40
- // Stop events from leaking to the parent
41
- e.stopPropagation();
42
- },
43
- },
44
- [h("div.legend-info-panel", children)]
45
- );
46
- }
47
-
48
- export function UnitSelectionPopover(props) {
49
- const { position } = props;
50
- const unit = useSelectedUnit();
51
- if (unit == null) {
52
- return null;
53
- }
54
-
55
- return h(
56
- "div.unit-popover-container",
57
- h(
58
- UnitDetailsPopover,
59
- {
60
- style: {
61
- position: "absolute",
62
- top: position?.y,
63
- width: position?.width,
64
- left: position?.x,
65
- height: position?.height,
66
- },
67
- },
68
- h(UnitDetailsPanel, { unit })
69
- )
70
- );
71
- }
package/src/store.ts DELETED
@@ -1,12 +0,0 @@
1
- import { createContext, useContext } from "react";
2
- import h from "@macrostrat/hyper";
3
-
4
- const MacrostratUnitsContext = createContext(null);
5
-
6
- export function MacrostratUnitsProvider({ children, units }) {
7
- return h(MacrostratUnitsContext.Provider, { value: units }, children);
8
- }
9
-
10
- export function useMacrostratUnits() {
11
- return useContext(MacrostratUnitsContext);
12
- }
@@ -1,16 +0,0 @@
1
- g.labeled-unit div.unit-name {
2
- display: block;
3
- width: 100%;
4
- height: 100%;
5
- }
6
- g.labeled-unit span.label-text {
7
- text-align: center;
8
- }
9
- @media (prefers-color-scheme: dark) {
10
- .lithology-column .frame {
11
- stroke: #fff;
12
- }
13
- g.inner pattern image {
14
- filter: invert(100%);
15
- }
16
- }