@macrostrat/column-views 2.2.2 → 2.3.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 (267) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/esm/{column-views.b0e6c0b3.js → column-views.04636815.js} +3 -3
  3. package/dist/esm/{column-views.b0e6c0b3.js.map → column-views.04636815.js.map} +1 -1
  4. package/dist/esm/{column-views.54f8b909.js → column-views.052498a6.js} +37 -4
  5. package/dist/esm/column-views.052498a6.js.map +1 -0
  6. package/dist/esm/{column-views.5456a1ee.js → column-views.0da4503a.js} +2 -2
  7. package/dist/esm/{column-views.5456a1ee.js.map → column-views.0da4503a.js.map} +1 -1
  8. package/dist/esm/{column-views.ee525e88.js → column-views.107b47b4.js} +8 -8
  9. package/dist/esm/{column-views.ee525e88.js.map → column-views.107b47b4.js.map} +1 -1
  10. package/dist/esm/column-views.17a70358.js +16 -0
  11. package/dist/esm/column-views.17a70358.js.map +1 -0
  12. package/dist/esm/{column-views.073c42da.js → column-views.1b5bf0c6.js} +3 -3
  13. package/dist/esm/{column-views.073c42da.js.map → column-views.1b5bf0c6.js.map} +1 -1
  14. package/dist/esm/{column-views.52ad973a.js → column-views.2708e176.js} +8 -8
  15. package/dist/esm/column-views.2708e176.js.map +1 -0
  16. package/dist/esm/{column-views.88d63dd0.js → column-views.275ba52b.js} +3 -3
  17. package/dist/esm/{column-views.88d63dd0.js.map → column-views.275ba52b.js.map} +1 -1
  18. package/dist/esm/{column-views.7c95c3d7.js → column-views.2bac03a2.js} +2 -2
  19. package/dist/esm/{column-views.7c95c3d7.js.map → column-views.2bac03a2.js.map} +1 -1
  20. package/dist/esm/column-views.322790f3.js +138 -0
  21. package/dist/esm/column-views.322790f3.js.map +1 -0
  22. package/dist/esm/{column-views.6698b95a.js → column-views.343fc926.js} +9 -18
  23. package/dist/esm/column-views.343fc926.js.map +1 -0
  24. package/dist/esm/column-views.3c9cba65.js +13 -0
  25. package/dist/esm/{column-views.43beafa3.js.map → column-views.3c9cba65.js.map} +1 -1
  26. package/dist/esm/{column-views.aeb61926.js → column-views.3d3e00be.js} +2 -2
  27. package/dist/esm/{column-views.aeb61926.js.map → column-views.3d3e00be.js.map} +1 -1
  28. package/dist/esm/{column-views.7d69838d.js → column-views.40094dd9.js} +3 -3
  29. package/dist/esm/{column-views.7d69838d.js.map → column-views.40094dd9.js.map} +1 -1
  30. package/dist/esm/{column-views.d2214a99.js → column-views.44373a90.js} +8 -7
  31. package/dist/esm/column-views.44373a90.js.map +1 -0
  32. package/dist/esm/{column-views.ad080c0e.js → column-views.488f24b6.js} +2 -2
  33. package/dist/esm/{column-views.ad080c0e.js.map → column-views.488f24b6.js.map} +1 -1
  34. package/dist/esm/{column-views.abf6aedd.js → column-views.4b259f9e.js} +2 -2
  35. package/dist/esm/{column-views.abf6aedd.js.map → column-views.4b259f9e.js.map} +1 -1
  36. package/dist/esm/{column-views.1151416d.css → column-views.54c1f382.css} +6 -5
  37. package/dist/esm/column-views.54c1f382.css.map +1 -0
  38. package/dist/esm/{column-views.729a6728.js → column-views.565b193a.js} +2 -2
  39. package/dist/esm/{column-views.729a6728.js.map → column-views.565b193a.js.map} +1 -1
  40. package/dist/esm/{column-views.058c0083.js → column-views.5ca2b219.js} +5 -5
  41. package/dist/esm/{column-views.058c0083.js.map → column-views.5ca2b219.js.map} +1 -1
  42. package/dist/esm/{column-views.218e8f5d.js → column-views.5eb4e6ff.js} +4 -4
  43. package/dist/esm/{column-views.218e8f5d.js.map → column-views.5eb4e6ff.js.map} +1 -1
  44. package/dist/esm/{column-views.11ae78f7.js → column-views.5fff0716.js} +3 -3
  45. package/dist/esm/{column-views.11ae78f7.js.map → column-views.5fff0716.js.map} +1 -1
  46. package/dist/esm/{column-views.05586d1f.js → column-views.60e97132.js} +2 -4
  47. package/dist/esm/column-views.60e97132.js.map +1 -0
  48. package/dist/esm/{column-views.75e5aebe.js → column-views.63d40878.js} +4 -4
  49. package/dist/esm/{column-views.75e5aebe.js.map → column-views.63d40878.js.map} +1 -1
  50. package/dist/esm/{column-views.d6d6df77.js → column-views.6c9e5069.js} +40 -62
  51. package/dist/esm/column-views.6c9e5069.js.map +1 -0
  52. package/dist/esm/column-views.6df65dab.js +9 -0
  53. package/dist/esm/column-views.6df65dab.js.map +1 -0
  54. package/dist/esm/column-views.7fa0d026.js +62 -0
  55. package/dist/esm/column-views.7fa0d026.js.map +1 -0
  56. package/dist/esm/{column-views.3a7179c4.js → column-views.82eb5026.js} +12 -7
  57. package/dist/esm/column-views.82eb5026.js.map +1 -0
  58. package/dist/esm/{column-views.9dd25b5b.js → column-views.92575b87.js} +3 -3
  59. package/dist/esm/column-views.92575b87.js.map +1 -0
  60. package/dist/esm/{column-views.833c2b74.js → column-views.9d51a5ab.js} +3 -3
  61. package/dist/esm/{column-views.833c2b74.js.map → column-views.9d51a5ab.js.map} +1 -1
  62. package/dist/esm/{column-views.817752b6.js → column-views.9ffc089b.js} +3 -3
  63. package/dist/esm/{column-views.817752b6.js.map → column-views.9ffc089b.js.map} +1 -1
  64. package/dist/esm/{column-views.70164236.js → column-views.aa9ede4d.js} +2 -2
  65. package/dist/esm/{column-views.70164236.js.map → column-views.aa9ede4d.js.map} +1 -1
  66. package/dist/esm/{column-views.6d63971b.js → column-views.ad2fe46c.js} +2 -2
  67. package/dist/esm/{column-views.6d63971b.js.map → column-views.ad2fe46c.js.map} +1 -1
  68. package/dist/esm/{column-views.7b4a1f15.js → column-views.afe0bb48.js} +5 -5
  69. package/dist/esm/{column-views.7b4a1f15.js.map → column-views.afe0bb48.js.map} +1 -1
  70. package/dist/esm/{column-views.aecf25bc.js → column-views.b4e1236d.js} +2 -2
  71. package/dist/esm/{column-views.aecf25bc.js.map → column-views.b4e1236d.js.map} +1 -1
  72. package/dist/esm/{column-views.6ce8cb61.js → column-views.c149f7a5.js} +3 -3
  73. package/dist/esm/{column-views.6ce8cb61.js.map → column-views.c149f7a5.js.map} +1 -1
  74. package/dist/esm/column-views.c3c7901a.js +149 -0
  75. package/dist/esm/column-views.c3c7901a.js.map +1 -0
  76. package/dist/esm/{column-views.b7016f82.css → column-views.cb6fc808.css} +10 -10
  77. package/dist/esm/column-views.cb6fc808.css.map +1 -0
  78. package/dist/esm/{column-views.35efe006.js → column-views.ce3a3ac8.js} +2 -2
  79. package/dist/esm/{column-views.35efe006.js.map → column-views.ce3a3ac8.js.map} +1 -1
  80. package/dist/esm/{column-views.77e22590.js → column-views.d1b49f5c.js} +2 -2
  81. package/dist/esm/{column-views.77e22590.js.map → column-views.d1b49f5c.js.map} +1 -1
  82. package/dist/esm/{column-views.faa4e06d.js → column-views.d524075b.js} +4 -4
  83. package/dist/esm/{column-views.faa4e06d.js.map → column-views.d524075b.js.map} +1 -1
  84. package/dist/esm/column-views.d5e788e8.js +31 -0
  85. package/dist/esm/column-views.d5e788e8.js.map +1 -0
  86. package/dist/esm/{column-views.30950997.js → column-views.d6c0b7bc.js} +2 -2
  87. package/dist/esm/{column-views.30950997.js.map → column-views.d6c0b7bc.js.map} +1 -1
  88. package/dist/esm/{column-views.44d3797a.js → column-views.dc195174.js} +2 -2
  89. package/dist/esm/{column-views.44d3797a.js.map → column-views.dc195174.js.map} +1 -1
  90. package/dist/esm/column-views.de433f18.js +139 -0
  91. package/dist/esm/column-views.de433f18.js.map +1 -0
  92. package/dist/esm/{column-views.ef88c46c.js → column-views.e075af15.js} +2 -2
  93. package/dist/esm/{column-views.ef88c46c.js.map → column-views.e075af15.js.map} +1 -1
  94. package/dist/esm/{column-views.7faf00ed.js → column-views.f7cdf6be.js} +3 -3
  95. package/dist/esm/{column-views.7faf00ed.js.map → column-views.f7cdf6be.js.map} +1 -1
  96. package/dist/esm/{column-views.66ccfc44.js → column-views.faa7e52e.js} +3 -3
  97. package/dist/esm/{column-views.66ccfc44.js.map → column-views.faa7e52e.js.map} +1 -1
  98. package/dist/esm/index.d.ts +39 -19
  99. package/dist/esm/index.d.ts.map +1 -1
  100. package/dist/esm/index.js +12 -12
  101. package/dist/node/column-views.012fa10c.js +2 -0
  102. package/dist/node/column-views.012fa10c.js.map +1 -0
  103. package/dist/node/{column-views.edb4ba54.js → column-views.021a6961.js} +2 -2
  104. package/dist/node/{column-views.edb4ba54.js.map → column-views.021a6961.js.map} +1 -1
  105. package/dist/node/{column-views.a19be00f.js → column-views.08bef1f6.js} +2 -2
  106. package/dist/node/{column-views.a19be00f.js.map → column-views.08bef1f6.js.map} +1 -1
  107. package/dist/node/{column-views.ae22e8b1.js → column-views.0f401891.js} +2 -2
  108. package/dist/node/{column-views.ae22e8b1.js.map → column-views.0f401891.js.map} +1 -1
  109. package/dist/node/column-views.1d064426.js +2 -0
  110. package/dist/node/column-views.1d064426.js.map +1 -0
  111. package/dist/node/{column-views.ae54d3e1.js → column-views.2577dec0.js} +2 -2
  112. package/dist/node/{column-views.ae54d3e1.js.map → column-views.2577dec0.js.map} +1 -1
  113. package/dist/node/{column-views.1ac9e2ed.js → column-views.2fe8feb9.js} +2 -2
  114. package/dist/node/{column-views.1ac9e2ed.js.map → column-views.2fe8feb9.js.map} +1 -1
  115. package/dist/node/{column-views.a281d5bb.js → column-views.42bc66a8.js} +2 -2
  116. package/dist/node/{column-views.a281d5bb.js.map → column-views.42bc66a8.js.map} +1 -1
  117. package/dist/node/{column-views.4ce5f5e4.js → column-views.465e593b.js} +2 -2
  118. package/dist/node/{column-views.4ce5f5e4.js.map → column-views.465e593b.js.map} +1 -1
  119. package/dist/node/{column-views.e1813308.js → column-views.46efb749.js} +2 -2
  120. package/dist/node/{column-views.e1813308.js.map → column-views.46efb749.js.map} +1 -1
  121. package/dist/node/{column-views.61dc64bc.js → column-views.47440961.js} +2 -2
  122. package/dist/node/{column-views.61dc64bc.js.map → column-views.47440961.js.map} +1 -1
  123. package/dist/node/column-views.5361f0e2.js +2 -0
  124. package/dist/node/column-views.5361f0e2.js.map +1 -0
  125. package/dist/node/{column-views.38835c99.js → column-views.5559de6a.js} +2 -2
  126. package/dist/node/{column-views.38835c99.js.map → column-views.5559de6a.js.map} +1 -1
  127. package/dist/node/{column-views.52cc4dd0.js → column-views.56f88b8c.js} +2 -2
  128. package/dist/node/{column-views.52cc4dd0.js.map → column-views.56f88b8c.js.map} +1 -1
  129. package/dist/node/{column-views.0b3a384e.js → column-views.5a9331a9.js} +2 -2
  130. package/dist/node/{column-views.0b3a384e.js.map → column-views.5a9331a9.js.map} +1 -1
  131. package/dist/node/column-views.5fd6e11a.js +2 -0
  132. package/dist/node/column-views.5fd6e11a.js.map +1 -0
  133. package/dist/node/column-views.672b683c.js +2 -0
  134. package/dist/node/column-views.672b683c.js.map +1 -0
  135. package/dist/node/{column-views.a08b0c9f.js → column-views.6c7f9245.js} +2 -2
  136. package/dist/node/{column-views.a08b0c9f.js.map → column-views.6c7f9245.js.map} +1 -1
  137. package/dist/node/{column-views.67fed1f5.js → column-views.75456275.js} +2 -2
  138. package/dist/node/{column-views.67fed1f5.js.map → column-views.75456275.js.map} +1 -1
  139. package/dist/node/column-views.75ba0464.css +2 -0
  140. package/dist/node/column-views.75ba0464.css.map +1 -0
  141. package/dist/node/column-views.777b9bb6.js +2 -0
  142. package/dist/node/column-views.777b9bb6.js.map +1 -0
  143. package/dist/node/{column-views.21a73236.js → column-views.7c322202.js} +2 -2
  144. package/dist/node/{column-views.21a73236.js.map → column-views.7c322202.js.map} +1 -1
  145. package/dist/node/column-views.7cc1a14f.js +2 -0
  146. package/dist/node/column-views.7cc1a14f.js.map +1 -0
  147. package/dist/node/{column-views.7faaf6c8.js → column-views.8e846c57.js} +2 -2
  148. package/dist/node/{column-views.7faaf6c8.js.map → column-views.8e846c57.js.map} +1 -1
  149. package/dist/node/{column-views.003348f6.js → column-views.8ee8469d.js} +2 -2
  150. package/dist/node/{column-views.003348f6.js.map → column-views.8ee8469d.js.map} +1 -1
  151. package/dist/node/{column-views.420b60d2.js → column-views.93bde6c1.js} +2 -2
  152. package/dist/node/{column-views.420b60d2.js.map → column-views.93bde6c1.js.map} +1 -1
  153. package/dist/node/{column-views.f2ee436e.js → column-views.a14f0134.js} +2 -2
  154. package/dist/node/{column-views.f2ee436e.js.map → column-views.a14f0134.js.map} +1 -1
  155. package/dist/node/{column-views.aef76eee.js → column-views.a596b1f5.js} +2 -2
  156. package/dist/node/{column-views.aef76eee.js.map → column-views.a596b1f5.js.map} +1 -1
  157. package/dist/node/column-views.af480651.js +2 -0
  158. package/dist/node/column-views.af480651.js.map +1 -0
  159. package/dist/node/column-views.b103acbc.js +2 -0
  160. package/dist/node/column-views.b103acbc.js.map +1 -0
  161. package/dist/node/{column-views.60b5663d.js → column-views.b40c1b9c.js} +2 -2
  162. package/dist/node/{column-views.60b5663d.js.map → column-views.b40c1b9c.js.map} +1 -1
  163. package/dist/node/column-views.b6e86cf0.js +2 -0
  164. package/dist/node/column-views.b6e86cf0.js.map +1 -0
  165. package/dist/node/{column-views.22c2d45b.js → column-views.c007152b.js} +2 -2
  166. package/dist/node/{column-views.22c2d45b.js.map → column-views.c007152b.js.map} +1 -1
  167. package/dist/node/{column-views.b6943236.js → column-views.c921fa1a.js} +2 -2
  168. package/dist/node/{column-views.b6943236.js.map → column-views.c921fa1a.js.map} +1 -1
  169. package/dist/node/{column-views.05cfc627.js → column-views.c9880a4d.js} +2 -2
  170. package/dist/node/{column-views.05cfc627.js.map → column-views.c9880a4d.js.map} +1 -1
  171. package/dist/node/column-views.ccfb9afb.css +2 -0
  172. package/dist/node/column-views.ccfb9afb.css.map +1 -0
  173. package/dist/node/{column-views.bde2dfa8.js → column-views.cd54f1b1.js} +2 -2
  174. package/dist/node/{column-views.bde2dfa8.js.map → column-views.cd54f1b1.js.map} +1 -1
  175. package/dist/node/{column-views.db47fe3c.js → column-views.d77d260b.js} +2 -2
  176. package/dist/node/{column-views.db47fe3c.js.map → column-views.d77d260b.js.map} +1 -1
  177. package/dist/node/{column-views.105c28fa.js → column-views.d818b387.js} +2 -2
  178. package/dist/node/{column-views.105c28fa.js.map → column-views.d818b387.js.map} +1 -1
  179. package/dist/node/{column-views.2d00d842.js → column-views.d8821a96.js} +2 -2
  180. package/dist/node/{column-views.2d00d842.js.map → column-views.d8821a96.js.map} +1 -1
  181. package/dist/node/column-views.dbb4a46b.js +2 -0
  182. package/dist/node/column-views.dbb4a46b.js.map +1 -0
  183. package/dist/node/{column-views.b12f8c81.js → column-views.e264a767.js} +2 -2
  184. package/dist/node/{column-views.b12f8c81.js.map → column-views.e264a767.js.map} +1 -1
  185. package/dist/node/column-views.e93b3bdb.js +2 -0
  186. package/dist/node/column-views.e93b3bdb.js.map +1 -0
  187. package/dist/node/{column-views.3913cd0f.js → column-views.ec691859.js} +2 -2
  188. package/dist/node/{column-views.3913cd0f.js.map → column-views.ec691859.js.map} +1 -1
  189. package/dist/node/column-views.ec7cc7cc.js +2 -0
  190. package/dist/node/column-views.ec7cc7cc.js.map +1 -0
  191. package/dist/node/{column-views.aae09aca.js → column-views.eecdc727.js} +2 -2
  192. package/dist/node/{column-views.aae09aca.js.map → column-views.eecdc727.js.map} +1 -1
  193. package/dist/node/{column-views.d08e4328.js → column-views.f577d065.js} +2 -2
  194. package/dist/node/{column-views.d08e4328.js.map → column-views.f577d065.js.map} +1 -1
  195. package/dist/node/column-views.fac4baff.js +2 -0
  196. package/dist/node/column-views.fac4baff.js.map +1 -0
  197. package/dist/node/index.js +1 -1
  198. package/dist/node/index.js.map +1 -1
  199. package/package.json +2 -2
  200. package/src/age-axis.ts +1 -1
  201. package/src/column.ts +4 -1
  202. package/src/correlation-chart/stories/correlation-chart.stories.ts +1 -1
  203. package/src/facets/detrital-zircon/index.ts +78 -11
  204. package/src/facets/detrital-zircon/provider.ts +1 -1
  205. package/src/facets/fossils/index.ts +145 -215
  206. package/src/facets/fossils/provider.ts +18 -25
  207. package/src/facets/fossils/taxon-ranges.ts +220 -0
  208. package/src/facets/index.ts +0 -1
  209. package/src/facets/{base-sample-column.module.sass → measurements/base.module.sass} +1 -0
  210. package/src/facets/measurements/base.ts +215 -0
  211. package/src/facets/measurements/index.ts +2 -38
  212. package/src/facets/measurements/sgp.ts +91 -0
  213. package/src/notes.ts +6 -3
  214. package/src/prepare-units/index.ts +8 -2
  215. package/src/prepare-units/utils.ts +55 -9
  216. package/dist/esm/column-views.05586d1f.js.map +0 -1
  217. package/dist/esm/column-views.1151416d.css.map +0 -1
  218. package/dist/esm/column-views.1e579112.js +0 -92
  219. package/dist/esm/column-views.1e579112.js.map +0 -1
  220. package/dist/esm/column-views.3a7179c4.js.map +0 -1
  221. package/dist/esm/column-views.43beafa3.js +0 -15
  222. package/dist/esm/column-views.52ad973a.js.map +0 -1
  223. package/dist/esm/column-views.54f8b909.js.map +0 -1
  224. package/dist/esm/column-views.6698b95a.js.map +0 -1
  225. package/dist/esm/column-views.6e7082db.js +0 -16
  226. package/dist/esm/column-views.6e7082db.js.map +0 -1
  227. package/dist/esm/column-views.7243e77d.js +0 -37
  228. package/dist/esm/column-views.7243e77d.js.map +0 -1
  229. package/dist/esm/column-views.76a220c4.js +0 -95
  230. package/dist/esm/column-views.76a220c4.js.map +0 -1
  231. package/dist/esm/column-views.9dd25b5b.js.map +0 -1
  232. package/dist/esm/column-views.b7016f82.css.map +0 -1
  233. package/dist/esm/column-views.d2214a99.js.map +0 -1
  234. package/dist/esm/column-views.d6d6df77.js.map +0 -1
  235. package/dist/esm/column-views.ea4ebbb7.js +0 -31
  236. package/dist/esm/column-views.ea4ebbb7.js.map +0 -1
  237. package/dist/node/column-views.16f336ee.js +0 -2
  238. package/dist/node/column-views.16f336ee.js.map +0 -1
  239. package/dist/node/column-views.1c567bfd.js +0 -2
  240. package/dist/node/column-views.1c567bfd.js.map +0 -1
  241. package/dist/node/column-views.2901b649.js +0 -2
  242. package/dist/node/column-views.2901b649.js.map +0 -1
  243. package/dist/node/column-views.29eb25bd.css +0 -2
  244. package/dist/node/column-views.29eb25bd.css.map +0 -1
  245. package/dist/node/column-views.39c21f22.js +0 -2
  246. package/dist/node/column-views.39c21f22.js.map +0 -1
  247. package/dist/node/column-views.573cb29d.js +0 -2
  248. package/dist/node/column-views.573cb29d.js.map +0 -1
  249. package/dist/node/column-views.5f3b0b04.js +0 -2
  250. package/dist/node/column-views.5f3b0b04.js.map +0 -1
  251. package/dist/node/column-views.77ace3a2.js +0 -2
  252. package/dist/node/column-views.77ace3a2.js.map +0 -1
  253. package/dist/node/column-views.8f54691f.js +0 -2
  254. package/dist/node/column-views.8f54691f.js.map +0 -1
  255. package/dist/node/column-views.a16cd1f2.js +0 -2
  256. package/dist/node/column-views.a16cd1f2.js.map +0 -1
  257. package/dist/node/column-views.a9576bac.js +0 -2
  258. package/dist/node/column-views.a9576bac.js.map +0 -1
  259. package/dist/node/column-views.c3c15cc2.js +0 -2
  260. package/dist/node/column-views.c3c15cc2.js.map +0 -1
  261. package/dist/node/column-views.cd7b223b.css +0 -2
  262. package/dist/node/column-views.cd7b223b.css.map +0 -1
  263. package/dist/node/column-views.f6ac1161.js +0 -2
  264. package/dist/node/column-views.f6ac1161.js.map +0 -1
  265. package/src/facets/base-sample-column.ts +0 -114
  266. package/src/facets/measurements/provider.ts +0 -80
  267. /package/src/facets/fossils/{index.module.sass → taxon-ranges.module.sass} +0 -0
@@ -0,0 +1,62 @@
1
+ import {BaseMeasurementsColumn as $50d219504625a431$export$ce5c4f2fdf4e644d, groupNotesByPixelDistance as $50d219504625a431$export$4e649f790614b299, standardizeMeasurementHeight as $50d219504625a431$export$9d101e1fcb2166a6, TruncatedList as $50d219504625a431$export$653e47a7a0da0f0d} from "./column-views.de433f18.js";
2
+ import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.4b259f9e.js";
3
+ import $8DpYT$macrostrathyper from "@macrostrat/hyper";
4
+ import {useAPIResult as $8DpYT$useAPIResult} from "@macrostrat/ui-components";
5
+
6
+
7
+
8
+
9
+
10
+ function $c8e156b0b9c785ec$var$useSGPData({ col_id: col_id }) {
11
+ const res = (0, $8DpYT$useAPIResult)("https://dev.macrostrat.org/api/pg/sgp_unit_matches", {
12
+ col_id: `eq.${col_id}`
13
+ }, (d)=>d);
14
+ return res;
15
+ }
16
+ function $c8e156b0b9c785ec$export$c49cf57576706bab({ columnID: columnID, color: color = "magenta" }) {
17
+ const data = $c8e156b0b9c785ec$var$useSGPData({
18
+ col_id: columnID
19
+ });
20
+ const { axisType: axisType, units: units } = (0, $d5074f164411387e$export$f8509b7cce386c7d)();
21
+ const scale = (0, $d5074f164411387e$export$a7fc62995ec4f76)();
22
+ if (data == null || units == null || scale == null) return null;
23
+ const data1 = $c8e156b0b9c785ec$var$prepareSGPData(data, scale, units, axisType);
24
+ return (0, $8DpYT$macrostrathyper)((0, $50d219504625a431$export$ce5c4f2fdf4e644d), {
25
+ data: data1,
26
+ noteComponent: $c8e156b0b9c785ec$var$SGPSamplesNote,
27
+ focusedNoteComponent: $c8e156b0b9c785ec$var$SGPSamplesNote
28
+ });
29
+ }
30
+ function $c8e156b0b9c785ec$var$SGPSamplesNote(props) {
31
+ const { note: note, focused: focused } = props;
32
+ const sgp_samples = note?.data;
33
+ if (sgp_samples == null || sgp_samples.length === 0) return null;
34
+ return (0, $8DpYT$macrostrathyper)((0, $50d219504625a431$export$653e47a7a0da0f0d), {
35
+ className: "sgp-samples",
36
+ data: sgp_samples,
37
+ itemRenderer: (p)=>(0, $8DpYT$macrostrathyper)("span", p.data.name),
38
+ maxItems: focused ? Infinity : 5
39
+ });
40
+ }
41
+ function $c8e156b0b9c785ec$var$prepareSGPData(data, scale, units, axisType) {
42
+ // Find matching units for samples
43
+ const d1 = data.map((sample)=>{
44
+ const data = sample.sgp_samples;
45
+ if (data == null || data.length === 0) return null;
46
+ const heightData = (0, $50d219504625a431$export$9d101e1fcb2166a6)({
47
+ unit_id: sample.unit_id
48
+ }, units, axisType);
49
+ if (heightData == null) return null;
50
+ data.sort((a, b)=>a.id - b.id);
51
+ return {
52
+ ...heightData,
53
+ data: data,
54
+ id: sample.unit_id
55
+ };
56
+ }).filter(Boolean);
57
+ return (0, $50d219504625a431$export$4e649f790614b299)(d1, scale, axisType, 5);
58
+ }
59
+
60
+
61
+ export {$c8e156b0b9c785ec$export$c49cf57576706bab as SGPMeasurementsColumn};
62
+ //# sourceMappingURL=column-views.7fa0d026.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAgBA,SAAS,iCAAW,UAAE,MAAM,EAAE;IAC5B,MAAM,MAAM,CAAA,GAAA,mBAAW,EACrB,sDACA;QACE,QAAQ,CAAC,GAAG,EAAE,QAAQ;IACxB,GACA,CAAC,IAAM;IAET,OAAO;AACT;AAQO,SAAS,0CAAsB,YAAE,QAAQ,SAAE,QAAQ,WAAW;IACnE,MAAM,OAA+B,iCAAW;QAAE,QAAQ;IAAS;IACnE,MAAM,YAAE,QAAQ,SAAE,KAAK,EAAE,GAAG,CAAA,GAAA,yCAAsB;IAClD,MAAM,QAAQ,CAAA,GAAA,wCAAgB;IAE9B,IAAI,QAAQ,QAAQ,SAAS,QAAQ,SAAS,MAAM,OAAO;IAE3D,MAAM,QAAQ,qCAAe,MAAM,OAAO,OAAO;IAEjD,OAAO,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,yCAAqB,GAAG;QAC/B,MAAM;QACN,eAAe;QACf,sBAAsB;IACxB;AACF;AAEA,SAAS,qCAAe,KAAK;IAC3B,MAAM,QAAE,IAAI,WAAE,OAAO,EAAE,GAAG;IAC1B,MAAM,cAAc,MAAM;IAE1B,IAAI,eAAe,QAAQ,YAAY,MAAM,KAAK,GAAG,OAAO;IAE5D,OAAO,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,yCAAY,GAAG;QACtB,WAAW;QACX,MAAM;QACN,cAAc,CAAC,IAAM,CAAA,GAAA,sBAAA,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI;QAC1C,UAAU,UAAU,WAAW;IACjC;AACF;AAEA,SAAS,qCACP,IAAqB,EACrB,KAA2B,EAC3B,KAAiB,EACjB,QAAwB;IAExB,kCAAkC;IAClC,MAAM,KAAK,KACR,GAAG,CAAC,CAAC;QACJ,MAAM,OAAO,OAAO,WAAW;QAC/B,IAAI,QAAQ,QAAQ,KAAK,MAAM,KAAK,GAAG,OAAO;QAC9C,MAAM,aAAa,CAAA,GAAA,yCAA2B,EAC5C;YAAE,SAAS,OAAO,OAAO;QAAC,GAC1B,OACA;QAEF,IAAI,cAAc,MAAM,OAAO;QAC/B,KAAK,IAAI,CAAC,CAAC,GAAG,IAAM,EAAE,EAAE,GAAG,EAAE,EAAE;QAC/B,OAAO;YACL,GAAG,UAAU;kBACb;YACA,IAAI,OAAO,OAAO;QACpB;IACF,GACC,MAAM,CAAC;IAEV,OAAO,CAAA,GAAA,yCAAwB,EAAE,IAAI,OAAO,UAAU;AACxD","sources":["packages/column-views/src/facets/measurements/sgp.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport { useAPIResult } from \"@macrostrat/ui-components\";\nimport {\n BaseMeasurementsColumn,\n groupNotesByPixelDistance,\n standardizeMeasurementHeight,\n TruncatedList,\n} from \"./base\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport {\n useCompositeScale,\n useMacrostratColumnData,\n} from \"../../data-provider\";\nimport { CompositeColumnScale } from \"../../prepare-units/composite-scale\";\n\nfunction useSGPData({ col_id }) {\n const res = useAPIResult(\n \"https://dev.macrostrat.org/api/pg/sgp_unit_matches\",\n {\n col_id: `eq.${col_id}`,\n },\n (d) => d,\n );\n return res;\n}\n\ninterface SGPSampleData {\n col_id: number;\n unit_id: number;\n sgp_samples: { name: string; id: number }[];\n}\n\nexport function SGPMeasurementsColumn({ columnID, color = \"magenta\" }) {\n const data: SGPSampleData[] | null = useSGPData({ col_id: columnID });\n const { axisType, units } = useMacrostratColumnData();\n const scale = useCompositeScale();\n\n if (data == null || units == null || scale == null) return null;\n\n const data1 = prepareSGPData(data, scale, units, axisType);\n\n return h(BaseMeasurementsColumn, {\n data: data1,\n noteComponent: SGPSamplesNote,\n focusedNoteComponent: SGPSamplesNote,\n });\n}\n\nfunction SGPSamplesNote(props) {\n const { note, focused } = props;\n const sgp_samples = note?.data;\n\n if (sgp_samples == null || sgp_samples.length === 0) return null;\n\n return h(TruncatedList, {\n className: \"sgp-samples\",\n data: sgp_samples,\n itemRenderer: (p) => h(\"span\", p.data.name),\n maxItems: focused ? Infinity : 5,\n });\n}\n\nfunction prepareSGPData(\n data: SGPSampleData[],\n scale: CompositeColumnScale,\n units: UnitLong[],\n axisType: ColumnAxisType,\n) {\n // Find matching units for samples\n const d1 = data\n .map((sample) => {\n const data = sample.sgp_samples;\n if (data == null || data.length === 0) return null;\n const heightData = standardizeMeasurementHeight(\n { unit_id: sample.unit_id },\n units,\n axisType,\n );\n if (heightData == null) return null;\n data.sort((a, b) => a.id - b.id);\n return {\n ...heightData,\n data,\n id: sample.unit_id,\n };\n })\n .filter(Boolean);\n\n return groupNotesByPixelDistance(d1, scale, axisType, 5);\n}\n"],"names":[],"version":3,"file":"column-views.7fa0d026.js.map"}
@@ -1,6 +1,6 @@
1
- import {getSectionAgeRange as $663a0cdd08b02256$export$8093438ec3e4c6fd, getSectionPosRange as $663a0cdd08b02256$export$483b05c497fd70c6, groupUnitsIntoSectionsByOverlap as $663a0cdd08b02256$export$bb26cdbde9c8c08b, groupUnitsIntoSectionsBySectionID as $663a0cdd08b02256$export$eeade20e3eee4638, mergeOverlappingSections as $663a0cdd08b02256$export$e7bb744b9be37f3d, preprocessSectionUnit as $663a0cdd08b02256$export$47e05aac3f0b77d4, preprocessUnits as $663a0cdd08b02256$export$55543e159517d62d} from "./column-views.aecf25bc.js";
2
- import {collapseUnconformitiesByPixelHeight as $728f6cf6c12cd490$export$edbf01b435c75274, computeSectionHeights as $728f6cf6c12cd490$export$7d3f3129a1a4b84e, finalizeSectionHeights as $728f6cf6c12cd490$export$67442a0f5bef147b} from "./column-views.073c42da.js";
3
- import {MergeSectionsMode as $b6657fba8924a702$export$e1644389ce074058, agesOverlap as $b6657fba8924a702$export$d92a67740c050efb, unitsOverlap as $b6657fba8924a702$export$f1a15f539858307, getUnitHeightRange as $b6657fba8924a702$export$70e712e2ac0237a, createUnitSorter as $b6657fba8924a702$export$ab14c04795685c55, ensureArray as $b6657fba8924a702$export$d0c8ecbd4ed8940c, ensureRealFloat as $b6657fba8924a702$export$97de5b0a6b4e4dac} from "./column-views.54f8b909.js";
1
+ import {getSectionAgeRange as $663a0cdd08b02256$export$8093438ec3e4c6fd, getSectionPosRange as $663a0cdd08b02256$export$483b05c497fd70c6, groupUnitsIntoSectionsByOverlap as $663a0cdd08b02256$export$bb26cdbde9c8c08b, groupUnitsIntoSectionsBySectionID as $663a0cdd08b02256$export$eeade20e3eee4638, mergeOverlappingSections as $663a0cdd08b02256$export$e7bb744b9be37f3d, preprocessSectionUnit as $663a0cdd08b02256$export$47e05aac3f0b77d4, preprocessUnits as $663a0cdd08b02256$export$55543e159517d62d} from "./column-views.b4e1236d.js";
2
+ import {collapseUnconformitiesByPixelHeight as $728f6cf6c12cd490$export$edbf01b435c75274, computeSectionHeights as $728f6cf6c12cd490$export$7d3f3129a1a4b84e, finalizeSectionHeights as $728f6cf6c12cd490$export$67442a0f5bef147b} from "./column-views.1b5bf0c6.js";
3
+ import {MergeSectionsMode as $b6657fba8924a702$export$e1644389ce074058, agesOverlap as $b6657fba8924a702$export$d92a67740c050efb, unitsOverlap as $b6657fba8924a702$export$f1a15f539858307, getUnitHeightRange as $b6657fba8924a702$export$70e712e2ac0237a, getPositionWithinUnit as $b6657fba8924a702$export$441710fb21b4ae09, createUnitSorter as $b6657fba8924a702$export$ab14c04795685c55, ensureArray as $b6657fba8924a702$export$d0c8ecbd4ed8940c, ensureRealFloat as $b6657fba8924a702$export$97de5b0a6b4e4dac} from "./column-views.052498a6.js";
4
4
  import {HybridScaleType as $1254c5929638d7f9$export$45e8e2d7a1794c23, HeightMethod as $1254c5929638d7f9$export$e40aae6f0de9bb95} from "./column-views.079119f4.js";
5
5
  import {ColumnAxisType as $iaXiN$ColumnAxisType} from "@macrostrat/column-components";
6
6
  import {useMemo as $iaXiN$useMemo} from "react";
@@ -24,15 +24,18 @@ function $76e92a964ee11b97$export$206a0cb85295e433(data, options) {
24
24
  function $76e92a964ee11b97$export$be8c5a449df4bde4(units, options) {
25
25
  /** Prepare units for rendering into Macrostrat columns */ let { t_age: t_age, b_age: b_age, t_pos: t_pos, b_pos: b_pos } = options;
26
26
  const { mergeSections: mergeSections = (0, $b6657fba8924a702$export$e1644389ce074058).OVERLAPPING, axisType: axisType, unconformityHeight: unconformityHeight, collapseSmallUnconformities: collapseSmallUnconformities = false, hybridScale: hybridScale, scale: scale } = options;
27
+ let _totalHeight = null;
27
28
  if (scale != null) {
28
29
  // Set t_age and b_age based on scale domain if not already set
29
30
  const domain = scale.domain();
30
31
  if (axisType == (0, $iaXiN$ColumnAxisType).AGE) {
31
32
  if (t_age == null) t_age = Math.min(...domain);
32
33
  if (b_age == null) b_age = Math.max(...domain);
34
+ _totalHeight = Math.abs(scale(b_age) - scale(t_age));
33
35
  } else {
34
36
  if (t_pos == null) t_pos = Math.min(...domain);
35
37
  if (b_pos == null) b_pos = Math.max(...domain);
38
+ _totalHeight = Math.abs(scale(b_pos) - scale(t_pos));
36
39
  }
37
40
  }
38
41
  // Start by ensuring that ages and positions are numbers
@@ -107,7 +110,9 @@ function $76e92a964ee11b97$export$be8c5a449df4bde4(units, options) {
107
110
  if (typeof collapseSmallUnconformities == "number") threshold = collapseSmallUnconformities;
108
111
  sectionsWithScales = (0, $728f6cf6c12cd490$export$edbf01b435c75274)(sectionsWithScales, threshold, options);
109
112
  }
110
- /** Prepare section scale information using groups */ let { totalHeight: totalHeight, sections: sections2 } = (0, $728f6cf6c12cd490$export$67442a0f5bef147b)(sectionsWithScales, unconformityHeight);
113
+ /** Prepare section scale information using groups.
114
+ * Total height is computed from section scales.
115
+ * */ let { totalHeight: totalHeight, sections: sections2 } = (0, $728f6cf6c12cd490$export$67442a0f5bef147b)(sectionsWithScales, unconformityHeight);
111
116
  /** For each section, find units that are overlapping.
112
117
  * We do this after merging sections so that we can
113
118
  * handle cases where there are overlapping units across sections
@@ -127,11 +132,11 @@ function $76e92a964ee11b97$export$be8c5a449df4bde4(units, options) {
127
132
  }, []);
128
133
  return {
129
134
  units: units2,
130
- totalHeight: totalHeight,
135
+ totalHeight: _totalHeight ?? totalHeight,
131
136
  sections: sectionsOut
132
137
  };
133
138
  }
134
139
 
135
140
 
136
- export {$76e92a964ee11b97$export$206a0cb85295e433 as usePreparedColumnUnits, $76e92a964ee11b97$export$be8c5a449df4bde4 as prepareColumnUnits, $663a0cdd08b02256$export$55543e159517d62d as preprocessUnits, $b6657fba8924a702$export$e1644389ce074058 as MergeSectionsMode, $b6657fba8924a702$export$f1a15f539858307 as unitsOverlap, $b6657fba8924a702$export$70e712e2ac0237a as getUnitHeightRange, $b6657fba8924a702$export$d92a67740c050efb as agesOverlap, $b6657fba8924a702$export$ab14c04795685c55 as createUnitSorter, $b6657fba8924a702$export$d0c8ecbd4ed8940c as ensureArray, $b6657fba8924a702$export$97de5b0a6b4e4dac as ensureRealFloat, $1254c5929638d7f9$export$45e8e2d7a1794c23 as HybridScaleType, $1254c5929638d7f9$export$e40aae6f0de9bb95 as HeightMethod};
137
- //# sourceMappingURL=column-views.3a7179c4.js.map
141
+ export {$76e92a964ee11b97$export$206a0cb85295e433 as usePreparedColumnUnits, $76e92a964ee11b97$export$be8c5a449df4bde4 as prepareColumnUnits, $663a0cdd08b02256$export$55543e159517d62d as preprocessUnits, $b6657fba8924a702$export$e1644389ce074058 as MergeSectionsMode, $b6657fba8924a702$export$f1a15f539858307 as unitsOverlap, $b6657fba8924a702$export$70e712e2ac0237a as getUnitHeightRange, $b6657fba8924a702$export$d92a67740c050efb as agesOverlap, $b6657fba8924a702$export$441710fb21b4ae09 as getPositionWithinUnit, $b6657fba8924a702$export$ab14c04795685c55 as createUnitSorter, $b6657fba8924a702$export$d0c8ecbd4ed8940c as ensureArray, $b6657fba8924a702$export$97de5b0a6b4e4dac as ensureRealFloat, $1254c5929638d7f9$export$45e8e2d7a1794c23 as HybridScaleType, $1254c5929638d7f9$export$e40aae6f0de9bb95 as HeightMethod};
142
+ //# sourceMappingURL=column-views.82eb5026.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;AA8BO,SAAS,0CACd,IAAgB,EAChB,OAA6B;IAE7B;;GAEC,GACD,OAAO,CAAA,GAAA,cAAM,EAAE;QACb,OAAO,0CAAmB,MAAM;IAClC,GAAG;QAAC;WAAS,OAAO,MAAM,CAAC;KAAS;AACtC;AAEO,SAAS,0CACd,KAAiB,EACjB,OAA6B;IAE7B,wDAAwD,GAExD,IAAI,SAAE,KAAK,SAAE,KAAK,SAAE,KAAK,SAAE,KAAK,EAAE,GAAG;IAErC,MAAM,iBACJ,gBAAgB,CAAA,GAAA,yCAAgB,EAAE,WAAW,YAC7C,QAAQ,sBACR,kBAAkB,+BAClB,8BAA8B,oBAC9B,WAAW,SACX,KAAK,EACN,GAAG;IAEJ,IAAI,eAAe;IAEnB,IAAI,SAAS,MAAM;QACjB,+DAA+D;QAC/D,MAAM,SAAS,MAAM,MAAM;QAC3B,IAAI,YAAY,CAAA,GAAA,qBAAa,EAAE,GAAG,EAAE;YAClC,IAAI,SAAS,MAAM,QAAQ,KAAK,GAAG,IAAI;YACvC,IAAI,SAAS,MAAM,QAAQ,KAAK,GAAG,IAAI;YACvC,eAAe,KAAK,GAAG,CAAC,MAAM,SAAS,MAAM;QAC/C,OAAO;YACL,IAAI,SAAS,MAAM,QAAQ,KAAK,GAAG,IAAI;YACvC,IAAI,SAAS,MAAM,QAAQ,KAAK,GAAG,IAAI;YACvC,eAAe,KAAK,GAAG,CAAC,MAAM,SAAS,MAAM;QAC/C;IACF;IAEA,wDAAwD;IACxD,iDAAiD;IACjD,IAAI,SAAS,MAAM,GAAG,CAAC,CAAA,GAAA,yCAAoB;IAE3C,qCAAqC,GACrC,SAAS,OAAO,MAAM,CAAC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],"sourcesContent":["import {\n getSectionAgeRange,\n getSectionPosRange,\n groupUnitsIntoSectionsByOverlap,\n groupUnitsIntoSectionsBySectionID,\n mergeOverlappingSections,\n preprocessSectionUnit,\n preprocessUnits,\n} from \"./helpers\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport { useMemo } from \"react\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nimport {\n collapseUnconformitiesByPixelHeight,\n computeSectionHeights,\n finalizeSectionHeights,\n} from \"./composite-scale\";\nimport {\n agesOverlap,\n MergeSectionsMode,\n PrepareColumnOptions,\n PreparedColumnData,\n unitsOverlap,\n} from \"./utils\";\nimport { SectionInfo } from \"./types\";\n\nexport * from \"./utils\";\nexport * from \"./types\";\nexport { preprocessUnits };\n\nexport function usePreparedColumnUnits(\n data: UnitLong[],\n options: PrepareColumnOptions,\n): PreparedColumnData {\n /** This function wraps and memoizes all preparation steps for converting\n * an array of units from the /units route to a form ready for usage.\n */\n return useMemo(() => {\n return prepareColumnUnits(data, options);\n }, [data, ...Object.values(options)]);\n}\n\nexport function prepareColumnUnits(\n units: UnitLong[],\n options: PrepareColumnOptions,\n): PreparedColumnData {\n /** Prepare units for rendering into Macrostrat columns */\n\n let { t_age, b_age, t_pos, b_pos } = options;\n\n const {\n mergeSections = MergeSectionsMode.OVERLAPPING,\n axisType,\n unconformityHeight,\n collapseSmallUnconformities = false,\n hybridScale,\n scale,\n } = options;\n\n let _totalHeight = null;\n\n if (scale != null) {\n // Set t_age and b_age based on scale domain if not already set\n const domain = scale.domain();\n if (axisType == ColumnAxisType.AGE) {\n if (t_age == null) t_age = Math.min(...domain);\n if (b_age == null) b_age = Math.max(...domain);\n _totalHeight = Math.abs(scale(b_age) - scale(t_age));\n } else {\n if (t_pos == null) t_pos = Math.min(...domain);\n if (b_pos == null) b_pos = Math.max(...domain);\n _totalHeight = Math.abs(scale(b_pos) - scale(t_pos));\n }\n }\n\n // Start by ensuring that ages and positions are numbers\n // also set up some values for eODP-style columns\n let units1 = units.map(preprocessSectionUnit);\n\n /** Prototype filtering to age range */\n units1 = units1.filter((d) => {\n // Filter units by t_age and b_age, inclusive\n if (axisType == ColumnAxisType.AGE) {\n return agesOverlap(d, { t_age, b_age });\n } else {\n return unitsOverlap(d, { t_pos, b_pos } as any, axisType);\n }\n });\n\n let mergeMode = mergeSections;\n // if (axisType != ColumnAxisType.AGE) {\n // // For non-age columns, we always merge sections.\n // // This is because the \"groupUnitsIntoSections\" function is not well-defined\n // // for non-age columns.\n // mergeMode = MergeSectionsMode.ALL;\n // }\n\n let sections0: SectionInfo<UnitLong>[];\n if (mergeMode == MergeSectionsMode.ALL) {\n // For the \"merge sections\" mode, we need to create a single section\n const [b_unit_pos, t_unit_pos] = getSectionPosRange(units1, axisType);\n const [b_unit_age, t_unit_age] = getSectionAgeRange(units1);\n sections0 = [\n {\n section_id: 0,\n /**\n * If ages limits are directly specified, use them to define the section bounds.\n * */\n t_pos: t_unit_pos,\n b_pos: b_unit_pos,\n t_age: t_unit_age,\n b_age: b_unit_age,\n units: units1,\n },\n ];\n } else if (axisType == ColumnAxisType.AGE) {\n sections0 = groupUnitsIntoSectionsBySectionID(units1, axisType);\n } else {\n sections0 = groupUnitsIntoSectionsByOverlap(units1, axisType);\n }\n\n // Limit sections to the range specified by t_age/b_age or t_pos/b_pos global options\n for (let section of sections0) {\n if (axisType == ColumnAxisType.AGE) {\n section.t_age = Math.max(section.t_age, t_age ?? -Infinity);\n section.b_age = Math.min(section.b_age, b_age ?? Infinity);\n } else if (axisType == ColumnAxisType.DEPTH) {\n section.t_pos = Math.max(section.t_pos, t_pos ?? -Infinity);\n section.b_pos = Math.min(section.b_pos, b_pos ?? Infinity);\n } else if (axisType == ColumnAxisType.HEIGHT) {\n section.t_pos = Math.max(section.t_pos, t_pos ?? -Infinity);\n section.b_pos = Math.min(section.b_pos, b_pos ?? Infinity);\n }\n }\n\n /** Merging overlapping sections really only makes sense for age/height/depth\n * columns. Ordinal columns are numbered by section so merging them\n * results in collisions.\n */\n let sections = sections0;\n if (\n mergeSections == MergeSectionsMode.OVERLAPPING &&\n axisType == ColumnAxisType.AGE\n ) {\n sections = mergeOverlappingSections(sections);\n }\n // Filter out undefined sections just in case\n sections = sections.filter((d) => d != null);\n\n // SCALES\n\n /* Compute pixel scales etc. for sections\n * We need to do this now to determine which unconformities\n * are small enough to collapse.\n */\n let sectionsWithScales = computeSectionHeights(sections, options);\n\n if (collapseSmallUnconformities && hybridScale == null) {\n // Collapse small unconformities in pixel height space\n // TODO: this doesn't seem to work properly for non-age columns?\n let threshold = unconformityHeight ?? 30;\n if (typeof collapseSmallUnconformities == \"number\") {\n threshold = collapseSmallUnconformities;\n }\n\n sectionsWithScales = collapseUnconformitiesByPixelHeight(\n sectionsWithScales,\n threshold,\n options,\n );\n }\n\n /** Prepare section scale information using groups.\n * Total height is computed from section scales.\n * */\n let { totalHeight, sections: sections2 } = finalizeSectionHeights(\n sectionsWithScales,\n unconformityHeight,\n );\n\n /** For each section, find units that are overlapping.\n * We do this after merging sections so that we can\n * handle cases where there are overlapping units across sections\n * */\n const sectionsOut = sections2.map((section) => {\n return {\n ...section,\n units: preprocessUnits(section, axisType),\n };\n });\n\n /** Reconstitute the units so that they are sorted by section and properly enhanced.\n * This is mostly important so that unit keyboard navigation\n * predictably selects adjacent units.\n */\n const units2 = sectionsOut.reduce((acc, group) => {\n const { units } = group;\n for (const unit of units) {\n acc.push(unit);\n }\n return acc;\n }, []);\n\n return {\n units: units2,\n totalHeight: _totalHeight ?? totalHeight,\n sections: sectionsOut,\n };\n}\n"],"names":[],"version":3,"file":"column-views.82eb5026.js.map"}
@@ -1,7 +1,7 @@
1
1
  import "./column-views.321af3ae.css";
2
2
  import $lfxOo$columnviews22ec902bjs from "./column-views.22ec902b.js";
3
- import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.abf6aedd.js";
4
- import {AgeLabel as $448b24baeef3b229$export$37ebfd237811b1eb} from "./column-views.218e8f5d.js";
3
+ import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.4b259f9e.js";
4
+ import {AgeLabel as $448b24baeef3b229$export$37ebfd237811b1eb} from "./column-views.5eb4e6ff.js";
5
5
  import $lfxOo$macrostrathyper from "@macrostrat/hyper";
6
6
  import {ColumnContext as $lfxOo$ColumnContext, ColumnAxis as $lfxOo$ColumnAxis, ColumnAxisType as $lfxOo$ColumnAxisType, SVG as $lfxOo$SVG, AgeAxis as $lfxOo$AgeAxis} from "@macrostrat/column-components";
7
7
  import {useContext as $lfxOo$useContext} from "react";
@@ -138,4 +138,4 @@ function $43794af7643cdf40$export$20d84abfcfa68dfa({ age: age }) {
138
138
 
139
139
 
140
140
  export {$43794af7643cdf40$export$64204d5cbb3e8227 as VerticalAxisLabel, $43794af7643cdf40$export$40b6b0e4520eeb34 as CompositeAgeAxis, $43794af7643cdf40$export$ac30ca3cf5df959d as CompositeAgeAxisCore, $43794af7643cdf40$export$82731b9607850ca6 as ApproximateHeightAxis, $43794af7643cdf40$export$20d84abfcfa68dfa as AgeCursor};
141
- //# sourceMappingURL=column-views.9dd25b5b.js.map
141
+ //# sourceMappingURL=column-views.92575b87.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;AAeA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,uEAAK;AAE5B,MAAM,oCAAc,CAAC,SAAE,KAAK,eAAE,cAAc,gBAAI,aAAa,OAAO;IAClE,MAAM,eAAE,WAAW,EAAE,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,oBAAY;IAC/C,iCAAiC;IACjC,IAAI,IAAI,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,cAAc,cAAc;IAExD,OAAO,wBAAE,UAAU;QAAE,WAAW;IAAkB,GAAG;QACnD,wBA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,QAAQ,EAAE,GAAG,MAAM,GACrE;IAEF,IAAI,YAAY,CAAA,GAAA,qBAAa,EAAE,OAAO,EACpC,OAAO;IAGT,IAAI,aAAqB,aAAa;IACtC,IAAI,YAAY,YAAY;IAC5B,IAAI,YAAY,CAAA,GAAA,qBAAa,EAAE,KAAK,EAAE;QACpC,aAAa;QACb,YAAY;IACd,OAAO,IAAI,YAAY,CAAA,GAAA,qBAAa,EAAE,MAAM,EAAE;QAC5C,aAAa;QACb,YAAY;IACd;IAEA,OAAO,wBAAE,0BAA0B,MAAM;QACvC,wBAAE,2CAAmB;YACnB,OAAO;YACP,MAAM;YACN,QAAQ;QACV;QACA,wBACE,CAAA,GAAA,UAAE,GACF;YACE,WAAW;YACX,OAAO;gBAAE,OAAO,CAAC,IAAI,CAAC;gBAAE,QAAQ,GAAG,YAAY,EAAE,CAAC;YAAC;YACnD,OAAO;YACP,QAAQ;QACV,GACA,SAAS,GAAG,CAAC,CAAC,OAAO;YACnB,MAAM,OAAE,GAAG,SAAE,KAAK,EAAE,GAAG;YAEvB,OAAO,wBAAE,CAAA,GAAA,cAAM,GAAG;qBAChB;gBACA,WAAW;uBACX;gBACA,eAAe;YACjB;QACF;KAEH;AACH;AAEO,SAAS,0CAAU,OAAE,GAAG,EAAE;IAC/B,qEAAqE,GACrE,MAAM,QAAQ,CAAA,GAAA,wCAAgB;IAC9B,MAAM,WAAW,MAAM;IAEvB,IAAI,OAAO,QAAQ,YAAY,MAC7B,OAAO;IAGT,OAAO,wBACL,kBACA;QACE,OAAO;YACL,KAAK;QACP;IACF,GACA;QAAC,wBAAE;QAAa,wBAAE,CAAA,GAAA,yCAAO,GAAG;iBAAE;YAAK,WAAW;QAAQ;KAAG;AAE7D","sources":["packages/column-views/src/age-axis.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport {\n SVG,\n ColumnAxis,\n ColumnContext,\n ColumnAxisType,\n AgeAxis,\n} from \"@macrostrat/column-components\";\nimport { useContext } from \"react\";\nimport styles from \"./age-axis.module.sass\";\nimport { useCompositeScale, useMacrostratColumnData } from \"./data-provider\";\nimport { Parenthetical } from \"@macrostrat/data-components\";\nimport { AgeLabel } from \"./unit-details\";\nimport { PackageScaleLayoutData } from \"./prepare-units\";\n\nconst h = hyper.styled(styles);\n\nconst AgeAxisCore = ({ ticks, tickSpacing = 40, showDomain = false }) => {\n const { pixelHeight } = useContext(ColumnContext);\n // A tick roughly every 40 pixels\n let v = Math.max(Math.round(pixelHeight / tickSpacing), 1);\n\n return h(\"g.axis\", { transform: \"translate(20 0)\" }, [\n h(ColumnAxis, {\n ticks: v,\n showDomain,\n }),\n ]);\n};\n\nexport function VerticalAxisLabel(props) {\n const { label = \"Age\", unit = \"Ma\", className, height } = props;\n return h(\n \"div.column-axis-label.age-axis-label\",\n { className, style: { height } },\n [\n label,\n \" \",\n h.if(unit)(Parenthetical, { className: \"age-axis-unit\" }, unit),\n ],\n );\n}\n\ninterface CompositeAgeAxisProps {\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport function CompositeAgeAxis(rest: CompositeAgeAxisProps) {\n const { axisType, sections, totalHeight } = useMacrostratColumnData();\n\n const packages = sections.map((section) => {\n return {\n key: `section-${section.section_id}`,\n ...section.scaleInfo,\n };\n });\n\n return h(CompositeAgeAxisCore, {\n axisType,\n packages,\n totalHeight,\n ...rest,\n });\n}\n\nexport function ApproximateHeightAxis(rest: CompositeAgeAxisProps) {\n /** Axis to show approximate height based on dynamic column scales */\n const { axisType, sections, totalHeight } = useMacrostratColumnData();\n\n const packages = sections.map((section) => {\n const { scaleInfo } = section;\n if (scaleInfo.heightScale == null) {\n throw new Error(\"No height scale available for section\");\n }\n return {\n key: `section-${section.section_id}`,\n ...scaleInfo,\n scale: scaleInfo.heightScale, // Use height scale instead of age scale\n // This only works with dynamic columns\n };\n });\n\n return h(CompositeAgeAxisCore, {\n axisType,\n axisLabel: \"Approx. height\",\n axisUnit: \"m\",\n packages,\n totalHeight,\n ...rest,\n });\n}\n\nexport interface CompositeStratigraphicScaleInfo extends CompositeAgeAxisProps {\n axisType: ColumnAxisType;\n axisLabel?: string;\n axisUnit?: string;\n totalHeight: number;\n packages: PackageScaleLayoutData[];\n}\n\nexport function CompositeAgeAxisCore(props: CompositeStratigraphicScaleInfo) {\n const { axisType, axisLabel, axisUnit, totalHeight, packages, ...rest } =\n props;\n\n if (axisType == ColumnAxisType.ORDINAL) {\n return null;\n }\n\n let _axisLabel: string = axisLabel ?? \"Age\";\n let _axisUnit = axisUnit ?? \"Ma\";\n if (axisType == ColumnAxisType.DEPTH) {\n _axisLabel = \"Depth\";\n _axisUnit = \"m\";\n } else if (axisType == ColumnAxisType.HEIGHT) {\n _axisLabel = \"Height\";\n _axisUnit = \"m\";\n }\n\n return h(\"div.composite-age-axis\", rest, [\n h(VerticalAxisLabel, {\n label: _axisLabel,\n unit: _axisUnit,\n height: totalHeight,\n }),\n h(\n SVG,\n {\n className: \"age-axis-column\",\n style: { width: `22px`, height: `${totalHeight}px` },\n width: 22,\n height: totalHeight,\n },\n packages.map((group, i) => {\n const { key, scale } = group;\n\n return h(AgeAxis, {\n key,\n className: \"age-axis\",\n scale,\n tickSizeOuter: 3,\n });\n }),\n ),\n ]);\n}\n\nexport function AgeCursor({ age }) {\n /** A cursor that shows the age at a specific point on the age axis. */\n const scale = useCompositeScale();\n const heightPx = scale(age);\n\n if (age == null || heightPx == null) {\n return null;\n }\n\n return h(\n \"div.age-cursor\",\n {\n style: {\n top: heightPx,\n },\n },\n [h(\"div.line\"), h(AgeLabel, { age, className: \"label\" })],\n );\n}\n"],"names":[],"version":3,"file":"column-views.92575b87.js.map"}
@@ -1,7 +1,7 @@
1
1
  import "./column-views.e40b8bfb.css";
2
2
  import $3vk6I$columnviews3465c8adjs from "./column-views.3465c8ad.js";
3
- import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratUnits as $d5074f164411387e$export$6fb40844db555b2} from "./column-views.abf6aedd.js";
4
- import {buildColumnSurfaces as $90d6b105908858a7$export$151c207e6887154c} from "./column-views.70164236.js";
3
+ import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratUnits as $d5074f164411387e$export$6fb40844db555b2} from "./column-views.4b259f9e.js";
4
+ import {buildColumnSurfaces as $90d6b105908858a7$export$151c207e6887154c} from "./column-views.aa9ede4d.js";
5
5
  import $3vk6I$macrostrathyper from "@macrostrat/hyper";
6
6
  import {useAPIResult as $3vk6I$useAPIResult} from "@macrostrat/ui-components";
7
7
 
@@ -72,4 +72,4 @@ function $1a65c216af27346a$export$ddca1abd3171ec6f() {
72
72
 
73
73
 
74
74
  export {$1a65c216af27346a$export$1d1ebe9df97e8db as BoundaryAgeModelOverlay, $1a65c216af27346a$export$ddca1abd3171ec6f as ComputedSurfacesOverlay};
75
- //# sourceMappingURL=column-views.833c2b74.js.map
75
+ //# sourceMappingURL=column-views.9d51a5ab.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;;;AAOH,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,uEAAK;AAoBrB,SAAS;IACd,MAAM,SAAS,CAAA,GAAA,wCAAiB,KAAK,CAAC,EAAE,EAAE;IAC1C,MAAM,QAAQ,CAAA,GAAA,wCAAgB;IAE9B,MAAM,WAAW,CAAA,GAAA,mBAAW,EAC1B,+CACA;gBAAE;IAAO,GACT,CAAC,MAAQ,IAAI,OAAO,CAAC,IAAI;IAG3B,IAAI,YAAY,MACd,OAAO;IAGT,OAAO,wBACL,0BACA,SAAS,GAAG,CAAC,CAAC;QACZ,MAAM,SAAS,MAAM,QAAQ,SAAS;QAEtC,OAAO,wBAAE,kCAAkC;YACzC,KAAK,QAAQ,WAAW;YACxB,OAAO;gBAAE,KAAK,GAAG,OAAO,EAAE,CAAC;YAAC;QAC9B;IACF;AAEJ;AAEO,SAAS;IACd;;GAEC,GACD,MAAM,QAAQ,CAAA,GAAA,wCAAiB;IAC/B,MAAM,WAAW,CAAA,GAAA,yCAAkB,EAAE;IACrC,MAAM,QAAQ,CAAA,GAAA,wCAAgB;IAE9B,OAAO,wBACL,0BACA,SAAS,GAAG,CAAC,CAAC;QACZ,MAAM,SAAS,MAAM,QAAQ,GAAG;QAChC,OAAO,wBAAE,kCAAkC;YACzC,KAAK,QAAQ,KAAK;YAClB,OAAO;gBAAE,KAAK,GAAG,OAAO,EAAE,CAAC;YAAC;QAC9B;IACF;AAEJ","sources":["packages/column-views/src/age-model-overlay.ts"],"sourcesContent":["/** An in-development overlay for a column's age model.\n *\n * Age model info:\n * {\n * \"boundary_id\": 8049,\n * \"col_id\": 432,\n * \"section_id\": 3104,\n * \"interval_id\": 268,\n * \"interval_name\": \"Calymmian\",\n * \"age_bottom\": 1600,\n * \"age_top\": 1400,\n * \"rel_position\": 0.85,\n * \"model_age\": 1430,\n * \"boundary_status\": \"absolute\",\n * \"boundary_type\": \"\",\n * \"boundary_position\": null,\n * \"unit_below\": 11541,\n * \"unit_above\": 0,\n * \"ref_id\": 217\n * },\n *\n * */\n\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./age-model-overlay.module.sass\";\nimport { useAPIResult } from \"@macrostrat/ui-components\";\nimport { useCompositeScale, useMacrostratUnits } from \"./data-provider\";\nimport { buildColumnSurfaces } from \"./prepare-units/dynamic-scales\";\nconst h = hyper.styled(styles);\n\ninterface AgeModelSurface {\n boundary_id: number;\n col_id: number;\n section_id: number;\n interval_id: number;\n interval_name: string;\n age_bottom: number;\n age_top: number;\n rel_position: number;\n model_age: number;\n boundary_status: \"absolute\" | \"relative\" | \"modeled\";\n boundary_type: string;\n boundary_position: null | number;\n unit_below: number;\n unit_above: number;\n ref_id: number;\n}\n\nexport function BoundaryAgeModelOverlay() {\n const col_id = useMacrostratUnits()?.[0]?.col_id;\n const scale = useCompositeScale();\n\n const ageModel = useAPIResult(\n \"https://dev.macrostrat.org/api/v2/age_model\",\n { col_id },\n (res) => res.success.data,\n );\n\n if (ageModel == null) {\n return null;\n }\n\n return h(\n \"div.boundary-age-model\",\n ageModel.map((surface) => {\n const height = scale(surface.model_age);\n\n return h(\"div.boundary-age-model-surface\", {\n key: surface.boundary_id,\n style: { top: `${height}px` },\n });\n }),\n );\n}\n\nexport function ComputedSurfacesOverlay() {\n /** Overlay showing age surfaces. This is like the boundary age model overlay but\n * it is computed on the fly from unit tops and bottoms.\n */\n const units = useMacrostratUnits();\n const surfaces = buildColumnSurfaces(units);\n const scale = useCompositeScale();\n\n return h(\n \"div.boundary-age-model\",\n surfaces.map((surface) => {\n const height = scale(surface.age);\n return h(\"div.boundary-age-model-surface\", {\n key: surface.index,\n style: { top: `${height}px` },\n });\n }),\n );\n}\n"],"names":[],"version":3,"file":"column-views.833c2b74.js.map"}
1
+ {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;;;AAOH,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,uEAAK;AAoBrB,SAAS;IACd,MAAM,SAAS,CAAA,GAAA,wCAAiB,KAAK,CAAC,EAAE,EAAE;IAC1C,MAAM,QAAQ,CAAA,GAAA,wCAAgB;IAE9B,MAAM,WAAW,CAAA,GAAA,mBAAW,EAC1B,+CACA;gBAAE;IAAO,GACT,CAAC,MAAQ,IAAI,OAAO,CAAC,IAAI;IAG3B,IAAI,YAAY,MACd,OAAO;IAGT,OAAO,wBACL,0BACA,SAAS,GAAG,CAAC,CAAC;QACZ,MAAM,SAAS,MAAM,QAAQ,SAAS;QAEtC,OAAO,wBAAE,kCAAkC;YACzC,KAAK,QAAQ,WAAW;YACxB,OAAO;gBAAE,KAAK,GAAG,OAAO,EAAE,CAAC;YAAC;QAC9B;IACF;AAEJ;AAEO,SAAS;IACd;;GAEC,GACD,MAAM,QAAQ,CAAA,GAAA,wCAAiB;IAC/B,MAAM,WAAW,CAAA,GAAA,yCAAkB,EAAE;IACrC,MAAM,QAAQ,CAAA,GAAA,wCAAgB;IAE9B,OAAO,wBACL,0BACA,SAAS,GAAG,CAAC,CAAC;QACZ,MAAM,SAAS,MAAM,QAAQ,GAAG;QAChC,OAAO,wBAAE,kCAAkC;YACzC,KAAK,QAAQ,KAAK;YAClB,OAAO;gBAAE,KAAK,GAAG,OAAO,EAAE,CAAC;YAAC;QAC9B;IACF;AAEJ","sources":["packages/column-views/src/age-model-overlay.ts"],"sourcesContent":["/** An in-development overlay for a column's age model.\n *\n * Age model info:\n * {\n * \"boundary_id\": 8049,\n * \"col_id\": 432,\n * \"section_id\": 3104,\n * \"interval_id\": 268,\n * \"interval_name\": \"Calymmian\",\n * \"age_bottom\": 1600,\n * \"age_top\": 1400,\n * \"rel_position\": 0.85,\n * \"model_age\": 1430,\n * \"boundary_status\": \"absolute\",\n * \"boundary_type\": \"\",\n * \"boundary_position\": null,\n * \"unit_below\": 11541,\n * \"unit_above\": 0,\n * \"ref_id\": 217\n * },\n *\n * */\n\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./age-model-overlay.module.sass\";\nimport { useAPIResult } from \"@macrostrat/ui-components\";\nimport { useCompositeScale, useMacrostratUnits } from \"./data-provider\";\nimport { buildColumnSurfaces } from \"./prepare-units/dynamic-scales\";\nconst h = hyper.styled(styles);\n\ninterface AgeModelSurface {\n boundary_id: number;\n col_id: number;\n section_id: number;\n interval_id: number;\n interval_name: string;\n age_bottom: number;\n age_top: number;\n rel_position: number;\n model_age: number;\n boundary_status: \"absolute\" | \"relative\" | \"modeled\";\n boundary_type: string;\n boundary_position: null | number;\n unit_below: number;\n unit_above: number;\n ref_id: number;\n}\n\nexport function BoundaryAgeModelOverlay() {\n const col_id = useMacrostratUnits()?.[0]?.col_id;\n const scale = useCompositeScale();\n\n const ageModel = useAPIResult(\n \"https://dev.macrostrat.org/api/v2/age_model\",\n { col_id },\n (res) => res.success.data,\n );\n\n if (ageModel == null) {\n return null;\n }\n\n return h(\n \"div.boundary-age-model\",\n ageModel.map((surface) => {\n const height = scale(surface.model_age);\n\n return h(\"div.boundary-age-model-surface\", {\n key: surface.boundary_id,\n style: { top: `${height}px` },\n });\n }),\n );\n}\n\nexport function ComputedSurfacesOverlay() {\n /** Overlay showing age surfaces. This is like the boundary age model overlay but\n * it is computed on the fly from unit tops and bottoms.\n */\n const units = useMacrostratUnits();\n const surfaces = buildColumnSurfaces(units);\n const scale = useCompositeScale();\n\n return h(\n \"div.boundary-age-model\",\n surfaces.map((surface) => {\n const height = scale(surface.age);\n return h(\"div.boundary-age-model-surface\", {\n key: surface.index,\n style: { top: `${height}px` },\n });\n }),\n );\n}\n"],"names":[],"version":3,"file":"column-views.9d51a5ab.js.map"}
@@ -1,6 +1,6 @@
1
1
  import {useMeasurementData as $5dbb619f2c7bef60$export$8a0335fd9ff72150} from "./column-views.a7c5ae16.js";
2
- import {IsotopeDataPoint as $5f39f3d52558a1d0$export$4cb5d059db4e2bd, IsotopesDataArea as $5f39f3d52558a1d0$export$309ef8546e07d921, useDataLocator as $5f39f3d52558a1d0$export$919dbb10b6b5b75} from "./column-views.30950997.js";
3
- import {useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d, useMacrostratUnits as $d5074f164411387e$export$6fb40844db555b2} from "./column-views.abf6aedd.js";
2
+ import {IsotopeDataPoint as $5f39f3d52558a1d0$export$4cb5d059db4e2bd, IsotopesDataArea as $5f39f3d52558a1d0$export$309ef8546e07d921, useDataLocator as $5f39f3d52558a1d0$export$919dbb10b6b5b75} from "./column-views.d6c0b7bc.js";
3
+ import {useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d, useMacrostratUnits as $d5074f164411387e$export$6fb40844db555b2} from "./column-views.4b259f9e.js";
4
4
  import "./column-views.708140ab.css";
5
5
  import $0zDA3$columnviews6992ca88js from "./column-views.6992ca88.js";
6
6
  import {useMemo as $0zDA3$useMemo} from "react";
@@ -184,4 +184,4 @@ function $d71d096cfe00860f$var$ColumnScaleLines(props) {
184
184
 
185
185
 
186
186
  export {$d71d096cfe00860f$export$c69bd0285aa5d775 as IsotopesDataset, $d71d096cfe00860f$export$5d8aa8022c284748 as IsotopesColumn};
187
- //# sourceMappingURL=column-views.817752b6.js.map
187
+ //# sourceMappingURL=column-views.9ffc089b.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,uEAAK;AAO5B,SAAS,kCAAY,SAAE,KAAK,QAAE,IAAI,EAAE,GAAG,MAAyB;IAC9D,MAAM,gBAAE,YAAY,EAAE,GAAG,CAAA,GAAA,wCAAa;IACtC,MAAM,CAAC,GAAG,EAAE,GAAG,aAAa;IAC5B,OAAO,wBACL,QACA;WACE;WACA;QACA,GAAG,IAAI;IACT,GACA;AAEJ;AAWA,SAAS,gCAAU,KAAqB;IACtC,IAAI,SAAE,KAAK,aAAE,SAAS,eAAE,WAAW,eAAE,WAAW,EAAE,GAAG,MAAM,GAAG;IAC9D,MAAM,YAAE,QAAQ,EAAE,GAAG,CAAA,GAAA,yCAAsB;IAE3C,MAAM,UAAE,MAAM,EAAE,GAAG,CAAA,GAAA,sBAAc;IACjC,MAAM,IAAI,OAAO;IACjB,MAAM,YAAY,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACnC,YAAY,CAAA,GAAA,iBAAS,EAAE,WAAW;QAAE,MAAM,UAAU;IAAE;IACtD,OAAO,wBAAE,UAAU;mBAAE;mBAAW;QAAW,KAAK;IAAM,GAAG;QACvD,wBACE,gBACA,SAAS,GAAG,CAAC,CAAC;YACZ,MAAM,aAAE,SAAS,EAAE,GAAG;YACtB,MAAM,KAAK,UAAU,MAAM;YAC3B,MAAM,KAAK,KAAK,UAAU,WAAW;YACrC,OAAO,wBAAE,QAAQ;oBACf;oBACA;gBACA,iBAAiB,MAAM,eAAe;gBACtC,aAAa;YACf;QACF;KAEH;AACH;AAEA,SAAS,mCAAa,QAAQ;IAC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ACd,OAAO,wBAAE,iCAAW;mBAAE;QAAM;IAC9B;AAEJ","sources":["packages/column-views/src/facets/carbon-isotopes/isotopes-column.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport hyper from \"@macrostrat/hyper\";\nimport classNames from \"classnames\";\nimport { AxisBottom } from \"@visx/axis\";\nimport { useMeasurementData } from \"./data-provider\";\n\nimport {\n IsotopesDataArea,\n useDataLocator,\n IsotopeDataPoint,\n} from \"./data-area\";\nimport { referenceMeasuresToColumn } from \"@macrostrat/stratigraphy-utils\";\nimport {\n SVG,\n ColumnLayoutProvider,\n useColumnLayout,\n} from \"@macrostrat/column-components\";\nimport {\n useMacrostratColumnData,\n useMacrostratUnits,\n} from \"../../data-provider\";\nimport styles from \"./isotopes-column.module.sass\";\nimport { scaleLinear } from \"d3-scale\";\n\nconst h = hyper.styled(styles);\n\ntype IsotopesTextProps = {\n datum: any;\n text: string;\n};\n\nfunction IsotopeText({ datum, text, ...rest }: IsotopesTextProps) {\n const { pointLocator } = useDataLocator();\n const [x, y] = pointLocator(datum);\n return h(\n \"text\",\n {\n x,\n y,\n ...rest,\n },\n text,\n );\n}\n\ninterface ScaleLineProps {\n value: number;\n className?: string;\n labelBottom?: boolean;\n labelOffset?: number;\n strokeDasharray?: string;\n stroke?: string | number;\n}\n\nfunction ScaleLine(props: ScaleLineProps) {\n let { value, className, labelBottom, labelOffset, ...rest } = props;\n const { sections } = useMacrostratColumnData();\n\n const { xScale } = useColumnLayout();\n const x = xScale(value);\n const transform = `translate(${x})`;\n className = classNames(className, { zero: value === 0 });\n return h(\"g.tick\", { transform, className, key: value }, [\n h(\n \"g.tick-lines\",\n sections.map((d) => {\n const { scaleInfo } = d;\n const y1 = scaleInfo.offset;\n const y2 = y1 + scaleInfo.pixelHeight;\n return h(\"line\", {\n y1,\n y2,\n strokeDasharray: props.strokeDasharray,\n strokeWidth: 1,\n });\n }),\n ),\n ]);\n}\n\nfunction unnestPoints(measures) {\n let points = [];\n for (const meas of measures) {\n const vals = meas.measure_value.map((d, i) => {\n return {\n value: d,\n age: meas.measure_age[i],\n position: meas.measure_position[i],\n unit_id: meas.unit_id,\n sample_id: meas.sample_no[i],\n measurement: meas.measurement,\n };\n });\n Array.prototype.push.apply(points, vals);\n }\n return points;\n}\n\ninterface IsotopesDatasetProps {\n color: string;\n parameter: string;\n}\n\ninterface IsotopeColumnProps extends IsotopesDatasetProps {\n width: number;\n tickValues?: number[];\n label: string;\n domain: [number, number];\n transform?: string;\n getHeight?: Function;\n nTicks?: number;\n showAxis?: boolean;\n}\n\nfunction IsotopesDataset(props) {\n const { parameter, color = \"dodgerblue\" } = props;\n const units = useMacrostratUnits();\n const measures = useMeasurementData() ?? [];\n\n const points = useMemo(() => {\n const data = measures.filter((d) => d.measurement === parameter);\n const refMeasures = referenceMeasuresToColumn(units, data);\n return unnestPoints(refMeasures);\n }, [measures, parameter, units]);\n\n return h(\n IsotopesDataArea,\n {\n getHeight(d) {\n return d.age;\n },\n } as any,\n h(\n \"g.data-points\",\n points.map((d) => {\n return h(IsotopeDataPoint, {\n datum: d,\n fill: color,\n });\n }),\n ),\n );\n}\n\nfunction IsotopesColumn(\n props: IsotopeColumnProps & { children?: React.ReactNode },\n) {\n const {\n width = 120,\n domain = [-14, 6],\n parameter,\n label,\n color = \"dodgerblue\",\n children = null,\n transform,\n getHeight,\n showAxis = true,\n tickValues: _tickVals,\n nTicks = 6,\n ...rest\n } = props;\n\n const { totalHeight } = useMacrostratColumnData();\n\n let _children: any = children;\n if (children == null && parameter != null) {\n _children = h(IsotopesDataset, { parameter, color, getHeight });\n }\n\n const xScale = useMemo(\n () => scaleLinear().domain(domain).range([0, width]),\n [domain, width],\n );\n\n const tickValues = _tickVals ?? xScale.ticks(nTicks);\n\n return h(\"div.isotopes-column\", [\n h(\n SVG,\n {\n height: totalHeight,\n innerWidth: width,\n paddingH: 15,\n },\n h(\n ColumnLayoutProvider,\n { width, xScale },\n h(\"g.isotopes-column\", { className: parameter, transform }, [\n h(ColumnScaleLines, {\n xScale,\n tickValues,\n width,\n ...rest,\n }),\n _children,\n ]),\n ),\n ),\n h.if(showAxis)(ColumnScaleAxis, {\n width,\n label: label ?? parameter,\n xScale,\n tickValues,\n ...rest,\n }),\n ]);\n}\n\nfunction ColumnScaleAxis(props) {\n const { label, xScale, width, showAxis = true, tickValues, ...rest } = props;\n\n return h(\"div.isotopes-scale-axis\", [\n h(\n SVG,\n {\n innerWidth: width,\n height: 45,\n paddingH: 15,\n },\n [\n h(AxisBottom, {\n scale: xScale,\n tickLength: 5,\n tickValues,\n stroke: \"var(--column-stroke-color)\",\n tickStroke: \"var(--column-stroke-color)\",\n ...rest,\n label,\n }),\n ],\n ),\n ]);\n}\n\nfunction ColumnScaleLines(props) {\n const { tickValues, xScale } = props;\n\n return h(\n \"g.scale-lines\",\n tickValues.map((value) => {\n return h(ScaleLine, { value });\n }),\n );\n}\n\nexport { IsotopesColumn, IsotopesDataset };\n"],"names":[],"version":3,"file":"column-views.817752b6.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,uEAAK;AAO5B,SAAS,kCAAY,SAAE,KAAK,QAAE,IAAI,EAAE,GAAG,MAAyB;IAC9D,MAAM,gBAAE,YAAY,EAAE,GAAG,CAAA,GAAA,wCAAa;IACtC,MAAM,CAAC,GAAG,EAAE,GAAG,aAAa;IAC5B,OAAO,wBACL,QACA;WACE;WACA;QACA,GAAG,IAAI;IACT,GACA;AAEJ;AAWA,SAAS,gCAAU,KAAqB;IACtC,IAAI,SAAE,KAAK,aAAE,SAAS,eAAE,WAAW,eAAE,WAAW,EAAE,GAAG,MAAM,GAAG;IAC9D,MAAM,YAAE,QAAQ,EAAE,GAAG,CAAA,GAAA,yCAAsB;IAE3C,MAAM,UAAE,MAAM,EAAE,GAAG,CAAA,GAAA,sBAAc;IACjC,MAAM,IAAI,OAAO;IACjB,MAAM,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E,MAAM,SAAE,KAAK,YAAE,WAAW,kBAAM,UAAU,EAAE,GAAG,MAAM,GAAG;IAEvE,OAAO,wBAAE,2BAA2B;QAClC,wBACE,CAAA,GAAA,UAAE,GACF;YACE,YAAY;YACZ,QAAQ;YACR,UAAU;QACZ,GACA;YACE,wBAAE,CAAA,GAAA,iBAAS,GAAG;gBACZ,OAAO;gBACP,YAAY;4BACZ;gBACA,QAAQ;gBACR,YAAY;gBACZ,GAAG,IAAI;uBACP;YACF;SACD;KAEJ;AACH;AAEA,SAAS,uCAAiB,KAAK;IAC7B,MAAM,cAAE,UAAU,UAAE,MAAM,EAAE,GAAG;IAE/B,OAAO,wBACL,iBACA,WAAW,GAAG,CAAC,CAAC;QACd,OAAO,wBAAE,iCAAW;mBAAE;QAAM;IAC9B;AAEJ","sources":["packages/column-views/src/facets/carbon-isotopes/isotopes-column.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport hyper from \"@macrostrat/hyper\";\nimport classNames from \"classnames\";\nimport { AxisBottom } from \"@visx/axis\";\nimport { useMeasurementData } from \"./data-provider\";\n\nimport {\n IsotopesDataArea,\n useDataLocator,\n IsotopeDataPoint,\n} from \"./data-area\";\nimport { referenceMeasuresToColumn } from \"@macrostrat/stratigraphy-utils\";\nimport {\n SVG,\n ColumnLayoutProvider,\n useColumnLayout,\n} from \"@macrostrat/column-components\";\nimport {\n useMacrostratColumnData,\n useMacrostratUnits,\n} from \"../../data-provider\";\nimport styles from \"./isotopes-column.module.sass\";\nimport { scaleLinear } from \"d3-scale\";\n\nconst h = hyper.styled(styles);\n\ntype IsotopesTextProps = {\n datum: any;\n text: string;\n};\n\nfunction IsotopeText({ datum, text, ...rest }: IsotopesTextProps) {\n const { pointLocator } = useDataLocator();\n const [x, y] = pointLocator(datum);\n return h(\n \"text\",\n {\n x,\n y,\n ...rest,\n },\n text,\n );\n}\n\ninterface ScaleLineProps {\n value: number;\n className?: string;\n labelBottom?: boolean;\n labelOffset?: number;\n strokeDasharray?: string;\n stroke?: string | number;\n}\n\nfunction ScaleLine(props: ScaleLineProps) {\n let { value, className, labelBottom, labelOffset, ...rest } = props;\n const { sections } = useMacrostratColumnData();\n\n const { xScale } = useColumnLayout();\n const x = xScale(value);\n const transform = `translate(${x})`;\n className = classNames(className, { zero: value === 0 });\n return h(\"g.tick\", { transform, className, key: value }, [\n h(\n \"g.tick-lines\",\n sections.map((d) => {\n const { scaleInfo } = d;\n const y1 = scaleInfo.offset;\n const y2 = y1 + scaleInfo.pixelHeight;\n return h(\"line\", {\n y1,\n y2,\n strokeDasharray: props.strokeDasharray,\n strokeWidth: 1,\n });\n }),\n ),\n ]);\n}\n\nfunction unnestPoints(measures) {\n let points = [];\n for (const meas of measures) {\n const vals = meas.measure_value.map((d, i) => {\n return {\n value: d,\n age: meas.measure_age[i],\n position: meas.measure_position[i],\n unit_id: meas.unit_id,\n sample_id: meas.sample_no[i],\n measurement: meas.measurement,\n };\n });\n Array.prototype.push.apply(points, vals);\n }\n return points;\n}\n\ninterface IsotopesDatasetProps {\n color: string;\n parameter: string;\n}\n\ninterface IsotopeColumnProps extends IsotopesDatasetProps {\n width: number;\n tickValues?: number[];\n label: string;\n domain: [number, number];\n transform?: string;\n getHeight?: Function;\n nTicks?: number;\n showAxis?: boolean;\n}\n\nfunction IsotopesDataset(props) {\n const { parameter, color = \"dodgerblue\" } = props;\n const units = useMacrostratUnits();\n const measures = useMeasurementData() ?? [];\n\n const points = useMemo(() => {\n const data = measures.filter((d) => d.measurement === parameter);\n const refMeasures = referenceMeasuresToColumn(units, data);\n return unnestPoints(refMeasures);\n }, [measures, parameter, units]);\n\n return h(\n IsotopesDataArea,\n {\n getHeight(d) {\n return d.age;\n },\n } as any,\n h(\n \"g.data-points\",\n points.map((d) => {\n return h(IsotopeDataPoint, {\n datum: d,\n fill: color,\n });\n }),\n ),\n );\n}\n\nfunction IsotopesColumn(\n props: IsotopeColumnProps & { children?: React.ReactNode },\n) {\n const {\n width = 120,\n domain = [-14, 6],\n parameter,\n label,\n color = \"dodgerblue\",\n children = null,\n transform,\n getHeight,\n showAxis = true,\n tickValues: _tickVals,\n nTicks = 6,\n ...rest\n } = props;\n\n const { totalHeight } = useMacrostratColumnData();\n\n let _children: any = children;\n if (children == null && parameter != null) {\n _children = h(IsotopesDataset, { parameter, color, getHeight });\n }\n\n const xScale = useMemo(\n () => scaleLinear().domain(domain).range([0, width]),\n [domain, width],\n );\n\n const tickValues = _tickVals ?? xScale.ticks(nTicks);\n\n return h(\"div.isotopes-column\", [\n h(\n SVG,\n {\n height: totalHeight,\n innerWidth: width,\n paddingH: 15,\n },\n h(\n ColumnLayoutProvider,\n { width, xScale },\n h(\"g.isotopes-column\", { className: parameter, transform }, [\n h(ColumnScaleLines, {\n xScale,\n tickValues,\n width,\n ...rest,\n }),\n _children,\n ]),\n ),\n ),\n h.if(showAxis)(ColumnScaleAxis, {\n width,\n label: label ?? parameter,\n xScale,\n tickValues,\n ...rest,\n }),\n ]);\n}\n\nfunction ColumnScaleAxis(props) {\n const { label, xScale, width, showAxis = true, tickValues, ...rest } = props;\n\n return h(\"div.isotopes-scale-axis\", [\n h(\n SVG,\n {\n innerWidth: width,\n height: 45,\n paddingH: 15,\n },\n [\n h(AxisBottom, {\n scale: xScale,\n tickLength: 5,\n tickValues,\n stroke: \"var(--column-stroke-color)\",\n tickStroke: \"var(--column-stroke-color)\",\n ...rest,\n label,\n }),\n ],\n ),\n ]);\n}\n\nfunction ColumnScaleLines(props) {\n const { tickValues, xScale } = props;\n\n return h(\n \"g.scale-lines\",\n tickValues.map((value) => {\n return h(ScaleLine, { value });\n }),\n );\n}\n\nexport { IsotopesColumn, IsotopesDataset };\n"],"names":[],"version":3,"file":"column-views.9ffc089b.js.map"}
@@ -1,4 +1,4 @@
1
- import {getUnitHeightRange as $b6657fba8924a702$export$70e712e2ac0237a} from "./column-views.54f8b909.js";
1
+ import {getUnitHeightRange as $b6657fba8924a702$export$70e712e2ac0237a} from "./column-views.052498a6.js";
2
2
  import {HeightMethod as $1254c5929638d7f9$export$e40aae6f0de9bb95, HybridScaleType as $1254c5929638d7f9$export$45e8e2d7a1794c23} from "./column-views.079119f4.js";
3
3
  import {scaleLinear as $a4oUv$scaleLinear} from "d3-scale";
4
4
  import {ColumnAxisType as $a4oUv$ColumnAxisType} from "@macrostrat/column-components";
@@ -203,4 +203,4 @@ function $90d6b105908858a7$export$d02d2d708a7b495f(surfaces, options = {}) {
203
203
 
204
204
 
205
205
  export {$90d6b105908858a7$export$151c207e6887154c as buildColumnSurfaces, $90d6b105908858a7$export$6b39f1b6356d94b6 as buildHybridScale, $90d6b105908858a7$export$d02d2d708a7b495f as buildScaleFromSurfacesSimple, $90d6b105908858a7$export$be7a6f1f0a23d12c as buildApproximateHeightScale};
206
- //# sourceMappingURL=column-views.70164236.js.map
206
+ //# sourceMappingURL=column-views.aa9ede4d.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;AAqBO,SAAS,0CACd,KAAU,EACV,YAAoB,KAAK;IAEzB,qEAAqE,GACrE,MAAM,WAAyC,EAAE;IACjD,KAAK,MAAM,QAAQ,MAAO;QACxB,cAAc;QACd,SAAS,IAAI,CAAC;YACZ,KAAK,KAAK,KAAK;YACf,aAAa;gBAAC,KAAK,OAAO;aAAC;YAC3B,aAAa,EAAE;QACjB;QACA,iBAAiB;QACjB,SAAS,IAAI,CAAC;YACZ,KAAK,KAAK,KAAK;YACf,aAAa;gBAAC,KAAK,OAAO;aAAC;YAC3B,aAAa,EAAE;QACjB;IACF;IAEA,sCAAsC;IACtC,MAAM,iBAA+C,EAAE;IACvD,KAAK,MAAM,WAAW,SAAU;QAC9B,MAAM,kBAAkB,eAAe,IAAI,CACzC,CAAC,IAAM,KAAK,GAAG,CAAC,EAAE,GAAG,GAAG,QAAQ,GAAG,IAAI;QAEzC,IAAI,iBAAiB;YACnB,gBAAgB,WAAW,CAAC,IAAI,IAAI,QAAQ,WAAW;YACvD,gBAAgB,WAAW,CAAC,IAAI,IAAI,QAAQ,WA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Content":["import type { UnitLong } from \"@macrostrat/api-types\";\nimport { scaleLinear } from \"d3-scale\";\nimport { getUnitHeightRange } from \"./utils\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport { mergeAgeRanges, MergeMode } from \"@macrostrat/stratigraphy-utils\";\nimport type {\n ApproxHeightScaleOptions,\n ExtUnit,\n HybridScaleDefinition,\n HybridScaleOptions,\n PackageScaleInfo,\n} from \"./types\";\nimport { HybridScaleType, HeightMethod } from \"./types\";\n\ninterface BaseSurface {\n index: number;\n age: number;\n units_below: number[];\n units_above: number[];\n}\n\nexport function buildColumnSurfaces<T extends UnitLong>(\n units: T[],\n tolerance: number = 0.001,\n): BaseSurface[] {\n /** Compute age surfaces for a column based on unit tops and bottoms */\n const surfaces: Omit<BaseSurface, \"index\">[] = [];\n for (const unit of units) {\n // Top surface\n surfaces.push({\n age: unit.t_age,\n units_below: [unit.unit_id],\n units_above: [],\n });\n // Bottom surface\n surfaces.push({\n age: unit.b_age,\n units_above: [unit.unit_id],\n units_below: [],\n });\n }\n\n // Merge duplicate surfaces (same age)\n const mergedSurfaces: Omit<BaseSurface, \"index\">[] = [];\n for (const surface of surfaces) {\n const existingSurface = mergedSurfaces.find(\n (s) => Math.abs(s.age - surface.age) < tolerance,\n );\n if (existingSurface) {\n existingSurface.units_above.push(...surface.units_above);\n existingSurface.units_below.push(...surface.units_below);\n } else {\n mergedSurfaces.push(surface);\n }\n }\n\n // Sort surfaces by age (ascending)\n mergedSurfaces.sort((a, b) => a.age - b.age);\n\n return mergedSurfaces.map((s, i) => ({ ...s, index: i }));\n}\n\ninterface AgeDomainUnitInfo {\n t_age: number;\n b_age: number;\n units: ExtUnit[];\n}\n\nfunction getUnitsInAgeDomains(\n surfaces: BaseSurface[],\n units: ExtUnit[],\n): AgeDomainUnitInfo[] {\n // Get unit IDs represented between the same surface, and the proportion of their total height represented\n const domainUnitInfo: AgeDomainUnitInfo[] = [];\n for (let i = 0; i < surfaces.length - 1; i++) {\n const topSurface = surfaces[i];\n const bottomSurface = surfaces[i + 1];\n const unitsInDomain = units.filter((unit) => {\n return (\n unit.t_age <= topSurface.age + 0.001 &&\n unit.b_age >= bottomSurface.age - 0.001\n );\n });\n domainUnitInfo.push({\n t_age: topSurface.age,\n b_age: bottomSurface.age,\n units: unitsInDomain,\n });\n }\n return domainUnitInfo;\n}\n\nfunction proportionOfUnitInDomain(\n unit: ExtUnit,\n t_age: number,\n b_age: number,\n): number {\n // Compute the proportion of a unit's height that lies within the given age domain\n\n const rng = getUnitHeightRange(unit, ColumnAxisType.AGE);\n const rng1: [number, number] = [b_age, t_age];\n // Compute overlap\n\n const mergedRange = mergeAgeRanges([rng, rng1], MergeMode.Inner);\n\n const unitHeight = Math.abs(rng[1] - rng[0]);\n const mergedHeight = Math.abs(mergedRange[1] - mergedRange[0]);\n\n return mergedHeight / unitHeight;\n}\n\nexport function buildHybridScale<T extends UnitLong>(\n def: HybridScaleDefinition,\n units: T[],\n domain: [number, number],\n options: HybridScaleOptions = {},\n): PackageScaleInfo {\n const surfaces = buildColumnSurfaces(units);\n\n const filteredSurfaces = surfaces.filter(\n (s) => s.age < Math.max(...domain) && s.age > Math.min(...domain),\n );\n\n const s1 = [\n { index: -1, age: Math.min(...domain), units_above: [], units_below: [] },\n ...filteredSurfaces,\n {\n index: -1,\n age: Math.max(...domain),\n units_above: [],\n units_below: [],\n },\n ];\n\n const { type, ...rest } = def;\n\n if (type === HybridScaleType.EquidistantSurfaces) {\n return buildScaleFromSurfacesSimple(s1, options);\n }\n\n return buildApproximateHeightScale(s1, units, { ...options, ...rest });\n}\n\nfunction getApproximateHeight(\n unit: ExtUnit,\n method: HeightMethod = HeightMethod.Maximum,\n): number | null {\n // Get approximate height of a unit based on specified method\n const heights = [];\n let minHeight = unit.min_thick;\n if (method === HeightMethod.Minimum || method === HeightMethod.Average) {\n const h = unit.min_thick;\n if (h != null && !isNaN(h) && h > 0) heights.push(h);\n }\n if (method === HeightMethod.Average || method === HeightMethod.Maximum) {\n const h = unit.max_thick;\n if (h != null && !isNaN(h) && h > 0) heights.push(h);\n }\n\n if (heights.length === 0) return null;\n\n if (method === HeightMethod.Average) {\n return heights.reduce((sum, h) => sum + h, 0) / heights.length;\n } else {\n return heights[0];\n }\n}\n\nexport function buildApproximateHeightScale(\n surfaces: BaseSurface[],\n units: UnitLong[],\n options: HybridScaleOptions & ApproxHeightScaleOptions = {},\n): PackageScaleInfo {\n /** Build a variable age scale that places age surfaces equally far apart in height space.\n * It is presumed that gaps are already removed from the unit set provided.\n * */\n\n const {\n pixelScale = 1, // pixels per meter\n pixelOffset = 0,\n minHeight = 5,\n heightMethod = HeightMethod.Maximum,\n // Default height for when height is unknown\n defaultHeight = 100,\n } = options;\n\n // Get units associated with each surface\n // Note: we could hoist this if it proved useful for other scale types\n const domainInfo = getUnitsInAgeDomains(surfaces, units as ExtUnit[]);\n\n // Compute the height in pixels for each surface\n\n const surfaceHeights = [];\n const ageDomain = [];\n let lastHeight = pixelOffset;\n\n for (const domain of domainInfo) {\n if (lastHeight == pixelOffset) {\n surfaceHeights.push(lastHeight);\n ageDomain.push(domain.t_age);\n }\n\n // Approximate height based on units in this domain\n const units = domain.units;\n let unitHeightInfo: { unit: ExtUnit; height: number }[] = [];\n\n for (const unit of units) {\n const proportion = proportionOfUnitInDomain(\n unit,\n domain.t_age,\n domain.b_age,\n );\n const height = getApproximateHeight(unit, heightMethod);\n if (height != null) {\n unitHeightInfo.push({ unit, height: height * proportion });\n }\n }\n\n let thisHeight = 0;\n if (unitHeightInfo.length === 0) {\n thisHeight = defaultHeight; // Default height if no units with height info\n } else {\n // Normalize weights (take the mean)\n\n const meanHeight =\n unitHeightInfo.reduce((sum, d) => sum + d.height, 0) /\n unitHeightInfo.length;\n\n if (meanHeight == 0) {\n thisHeight = defaultHeight; // Arbitrary height for zero-height intervals\n } else if (meanHeight < minHeight) {\n thisHeight = minHeight; // Minimum height\n } else {\n thisHeight = meanHeight;\n }\n }\n\n lastHeight += thisHeight;\n surfaceHeights.push(lastHeight);\n ageDomain.push(domain.b_age);\n }\n\n // Build a piecewise linear scale mapping age to pixel height\n const pixelRange = surfaceHeights.map((h) => h * pixelScale);\n\n const scale = scaleLinear().domain(ageDomain).range(pixelRange);\n\n const heightDomain = surfaceHeights.map((h) => lastHeight - h);\n\n const heightScale = scaleLinear().domain(heightDomain).range(pixelRange);\n\n const domain: [number, number] = [\n ageDomain[ageDomain.length - 1],\n ageDomain[0],\n ];\n\n return {\n scale,\n pixelScale: null, // pixels per unit\n domain,\n pixelHeight: Math.abs(pixelRange[pixelRange.length - 1] - pixelRange[0]),\n heightScale,\n };\n}\n\nexport function buildScaleFromSurfacesSimple(\n surfaces: BaseSurface[],\n options: HybridScaleOptions = {},\n): PackageScaleInfo {\n /** Build a variable age scale that places age surfaces equally far apart in height space.\n * It is presumed that gaps are already removed from the unit set provided.\n * */\n\n const { pixelScale = 30 } = options;\n\n const domain: [number, number] = [\n surfaces[surfaces.length - 1].age,\n surfaces[0].age,\n ];\n // Compute the height in pixels for each surface\n\n const surfaceHeights = surfaces.map((surface, i) => {\n return i * pixelScale;\n });\n\n // Build a piecewise linear scale mapping age to pixel height\n const ageDomain = surfaces.map((s) => s.age);\n const pixelRange = surfaceHeights;\n\n const scale = scaleLinear().domain(ageDomain).range(pixelRange);\n\n return {\n scale,\n pixelScale: null, // pixels per unit\n domain,\n pixelHeight: Math.abs(pixelRange[pixelRange.length - 1] - pixelRange[0]),\n };\n}\n"],"names":[],"version":3,"file":"column-views.70164236.js.map"}
1
+ {"mappings":";;;;;;;;;;;AAqBO,SAAS,0CACd,KAAU,EACV,YAAoB,KAAK;IAEzB,qEAAqE,GACrE,MAAM,WAAyC,EAAE;IACjD,KAAK,MAAM,QAAQ,MAAO;QACxB,cAAc;QACd,SAAS,IAAI,CAAC;YACZ,KAAK,KAAK,KAAK;YACf,aAAa;gBAAC,KAAK,OAAO;aAAC;YAC3B,aAAa,EAAE;QACjB;QACA,iBAAiB;QACjB,SAAS,IAAI,CA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,CAAC,CAAC,SAAS;QAC5C,OAAO,IAAI;IACb;IAEA,6DAA6D;IAC7D,MAAM,YAAY,SAAS,GAAG,CAAC,CAAC,IAAM,EAAE,GAAG;IAC3C,MAAM,aAAa;IAEnB,MAAM,QAAQ,CAAA,GAAA,kBAAU,IAAI,MAAM,CAAC,WAAW,KAAK,CAAC;IAEpD,OAAO;eACL;QACA,YAAY;gBACZ;QACA,aAAa,KAAK,GAAG,CAAC,UAAU,CAAC,WAAW,MAAM,GAAG,EAAE,GAAG,UAAU,CAAC,EAAE;IACzE;AACF","sources":["packages/column-views/src/prepare-units/dynamic-scales.ts"],"sourcesContent":["import type { UnitLong } from \"@macrostrat/api-types\";\nimport { scaleLinear } from \"d3-scale\";\nimport { getUnitHeightRange } from \"./utils\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport { mergeAgeRanges, MergeMode } from \"@macrostrat/stratigraphy-utils\";\nimport type {\n ApproxHeightScaleOptions,\n ExtUnit,\n HybridScaleDefinition,\n HybridScaleOptions,\n PackageScaleInfo,\n} from \"./types\";\nimport { HybridScaleType, HeightMethod } from \"./types\";\n\ninterface BaseSurface {\n index: number;\n age: number;\n units_below: number[];\n units_above: number[];\n}\n\nexport function buildColumnSurfaces<T extends UnitLong>(\n units: T[],\n tolerance: number = 0.001,\n): BaseSurface[] {\n /** Compute age surfaces for a column based on unit tops and bottoms */\n const surfaces: Omit<BaseSurface, \"index\">[] = [];\n for (const unit of units) {\n // Top surface\n surfaces.push({\n age: unit.t_age,\n units_below: [unit.unit_id],\n units_above: [],\n });\n // Bottom surface\n surfaces.push({\n age: unit.b_age,\n units_above: [unit.unit_id],\n units_below: [],\n });\n }\n\n // Merge duplicate surfaces (same age)\n const mergedSurfaces: Omit<BaseSurface, \"index\">[] = [];\n for (const surface of surfaces) {\n const existingSurface = mergedSurfaces.find(\n (s) => Math.abs(s.age - surface.age) < tolerance,\n );\n if (existingSurface) {\n existingSurface.units_above.push(...surface.units_above);\n existingSurface.units_below.push(...surface.units_below);\n } else {\n mergedSurfaces.push(surface);\n }\n }\n\n // Sort surfaces by age (ascending)\n mergedSurfaces.sort((a, b) => a.age - b.age);\n\n return mergedSurfaces.map((s, i) => ({ ...s, index: i }));\n}\n\ninterface AgeDomainUnitInfo {\n t_age: number;\n b_age: number;\n units: ExtUnit[];\n}\n\nfunction getUnitsInAgeDomains(\n surfaces: BaseSurface[],\n units: ExtUnit[],\n): AgeDomainUnitInfo[] {\n // Get unit IDs represented between the same surface, and the proportion of their total height represented\n const domainUnitInfo: AgeDomainUnitInfo[] = [];\n for (let i = 0; i < surfaces.length - 1; i++) {\n const topSurface = surfaces[i];\n const bottomSurface = surfaces[i + 1];\n const unitsInDomain = units.filter((unit) => {\n return (\n unit.t_age <= topSurface.age + 0.001 &&\n unit.b_age >= bottomSurface.age - 0.001\n );\n });\n domainUnitInfo.push({\n t_age: topSurface.age,\n b_age: bottomSurface.age,\n units: unitsInDomain,\n });\n }\n return domainUnitInfo;\n}\n\nfunction proportionOfUnitInDomain(\n unit: ExtUnit,\n t_age: number,\n b_age: number,\n): number {\n // Compute the proportion of a unit's height that lies within the given age domain\n\n const rng = getUnitHeightRange(unit, ColumnAxisType.AGE);\n const rng1: [number, number] = [b_age, t_age];\n // Compute overlap\n\n const mergedRange = mergeAgeRanges([rng, rng1], MergeMode.Inner);\n\n const unitHeight = Math.abs(rng[1] - rng[0]);\n const mergedHeight = Math.abs(mergedRange[1] - mergedRange[0]);\n\n return mergedHeight / unitHeight;\n}\n\nexport function buildHybridScale<T extends UnitLong>(\n def: HybridScaleDefinition,\n units: T[],\n domain: [number, number],\n options: HybridScaleOptions = {},\n): PackageScaleInfo {\n const surfaces = buildColumnSurfaces(units);\n\n const filteredSurfaces = surfaces.filter(\n (s) => s.age < Math.max(...domain) && s.age > Math.min(...domain),\n );\n\n const s1 = [\n { index: -1, age: Math.min(...domain), units_above: [], units_below: [] },\n ...filteredSurfaces,\n {\n index: -1,\n age: Math.max(...domain),\n units_above: [],\n units_below: [],\n },\n ];\n\n const { type, ...rest } = def;\n\n if (type === HybridScaleType.EquidistantSurfaces) {\n return buildScaleFromSurfacesSimple(s1, options);\n }\n\n return buildApproximateHeightScale(s1, units, { ...options, ...rest });\n}\n\nfunction getApproximateHeight(\n unit: ExtUnit,\n method: HeightMethod = HeightMethod.Maximum,\n): number | null {\n // Get approximate height of a unit based on specified method\n const heights = [];\n let minHeight = unit.min_thick;\n if (method === HeightMethod.Minimum || method === HeightMethod.Average) {\n const h = unit.min_thick;\n if (h != null && !isNaN(h) && h > 0) heights.push(h);\n }\n if (method === HeightMethod.Average || method === HeightMethod.Maximum) {\n const h = unit.max_thick;\n if (h != null && !isNaN(h) && h > 0) heights.push(h);\n }\n\n if (heights.length === 0) return null;\n\n if (method === HeightMethod.Average) {\n return heights.reduce((sum, h) => sum + h, 0) / heights.length;\n } else {\n return heights[0];\n }\n}\n\nexport function buildApproximateHeightScale(\n surfaces: BaseSurface[],\n units: UnitLong[],\n options: HybridScaleOptions & ApproxHeightScaleOptions = {},\n): PackageScaleInfo {\n /** Build a variable age scale that places age surfaces equally far apart in height space.\n * It is presumed that gaps are already removed from the unit set provided.\n * */\n\n const {\n pixelScale = 1, // pixels per meter\n pixelOffset = 0,\n minHeight = 5,\n heightMethod = HeightMethod.Maximum,\n // Default height for when height is unknown\n defaultHeight = 100,\n } = options;\n\n // Get units associated with each surface\n // Note: we could hoist this if it proved useful for other scale types\n const domainInfo = getUnitsInAgeDomains(surfaces, units as ExtUnit[]);\n\n // Compute the height in pixels for each surface\n\n const surfaceHeights = [];\n const ageDomain = [];\n let lastHeight = pixelOffset;\n\n for (const domain of domainInfo) {\n if (lastHeight == pixelOffset) {\n surfaceHeights.push(lastHeight);\n ageDomain.push(domain.t_age);\n }\n\n // Approximate height based on units in this domain\n const units = domain.units;\n let unitHeightInfo: { unit: ExtUnit; height: number }[] = [];\n\n for (const unit of units) {\n const proportion = proportionOfUnitInDomain(\n unit,\n domain.t_age,\n domain.b_age,\n );\n const height = getApproximateHeight(unit, heightMethod);\n if (height != null) {\n unitHeightInfo.push({ unit, height: height * proportion });\n }\n }\n\n let thisHeight = 0;\n if (unitHeightInfo.length === 0) {\n thisHeight = defaultHeight; // Default height if no units with height info\n } else {\n // Normalize weights (take the mean)\n\n const meanHeight =\n unitHeightInfo.reduce((sum, d) => sum + d.height, 0) /\n unitHeightInfo.length;\n\n if (meanHeight == 0) {\n thisHeight = defaultHeight; // Arbitrary height for zero-height intervals\n } else if (meanHeight < minHeight) {\n thisHeight = minHeight; // Minimum height\n } else {\n thisHeight = meanHeight;\n }\n }\n\n lastHeight += thisHeight;\n surfaceHeights.push(lastHeight);\n ageDomain.push(domain.b_age);\n }\n\n // Build a piecewise linear scale mapping age to pixel height\n const pixelRange = surfaceHeights.map((h) => h * pixelScale);\n\n const scale = scaleLinear().domain(ageDomain).range(pixelRange);\n\n const heightDomain = surfaceHeights.map((h) => lastHeight - h);\n\n const heightScale = scaleLinear().domain(heightDomain).range(pixelRange);\n\n const domain: [number, number] = [\n ageDomain[ageDomain.length - 1],\n ageDomain[0],\n ];\n\n return {\n scale,\n pixelScale: null, // pixels per unit\n domain,\n pixelHeight: Math.abs(pixelRange[pixelRange.length - 1] - pixelRange[0]),\n heightScale,\n };\n}\n\nexport function buildScaleFromSurfacesSimple(\n surfaces: BaseSurface[],\n options: HybridScaleOptions = {},\n): PackageScaleInfo {\n /** Build a variable age scale that places age surfaces equally far apart in height space.\n * It is presumed that gaps are already removed from the unit set provided.\n * */\n\n const { pixelScale = 30 } = options;\n\n const domain: [number, number] = [\n surfaces[surfaces.length - 1].age,\n surfaces[0].age,\n ];\n // Compute the height in pixels for each surface\n\n const surfaceHeights = surfaces.map((surface, i) => {\n return i * pixelScale;\n });\n\n // Build a piecewise linear scale mapping age to pixel height\n const ageDomain = surfaces.map((s) => s.age);\n const pixelRange = surfaceHeights;\n\n const scale = scaleLinear().domain(ageDomain).range(pixelRange);\n\n return {\n scale,\n pixelScale: null, // pixels per unit\n domain,\n pixelHeight: Math.abs(pixelRange[pixelRange.length - 1] - pixelRange[0]),\n };\n}\n"],"names":[],"version":3,"file":"column-views.aa9ede4d.js.map"}
@@ -1,4 +1,4 @@
1
- import {useMacrostratColumns as $774a5efa27d1c77b$export$81eaae0b474404fd} from "./column-views.ef88c46c.js";
1
+ import {useMacrostratColumns as $774a5efa27d1c77b$export$81eaae0b474404fd} from "./column-views.e075af15.js";
2
2
  import {create as $i7Wch$create, useStore as $i7Wch$useStore} from "zustand";
3
3
  import {lineIntersect as $i7Wch$lineIntersect} from "@turf/line-intersect";
4
4
  import $i7Wch$turfdistance from "@turf/distance";
@@ -115,4 +115,4 @@ function $74e211dc185c20b4$var$sorted(data, accessor) {
115
115
 
116
116
 
117
117
  export {$74e211dc185c20b4$export$72ffe141ebf87ef1 as ColumnCorrelationProvider, $74e211dc185c20b4$export$21398703d3a9bb4d as useCorrelationMapStore};
118
- //# sourceMappingURL=column-views.6d63971b.js.map
118
+ //# sourceMappingURL=column-views.ad2fe46c.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;AAuCA,MAAM,gDACJ,CAAA,GAAA,oBAAY,EAAwC;AAMtD,2EAA2E,GAC3E,MAAM,iCAAW,CAAA,GAAA,qBAAa,EAAE,CAAC;IAC/B,OAAO;QACL,kEAAkE;QAClE,gBAAgB,8CAAwB,MAAM,OAAO,EAAE,MAAM,WAAW;IAC1E;AACF;AAEO,SAAS,0CAA0B,YACxC,QAAQ,WACR,OAAO,aACP,SAAS,aACT,SAAS,eACT,WAAW,mBACX,eAAe,EACU;IACzB,MAAM,CAAC,MAAM,GAAG,CAAA,GAAA,eAAO,EAAE;QACvB,OAAO,CAAA,GAAA,aAAK,EACV,+BAAS,CAAC,KAAK;YACb,OAAO;6BACL;gBACA,SAAS;gBACT,YAAW,KAA6B,EAAE,KAAY;oBACpD,MAAM,QAAQ;oBACd,gCAAgC;oBAChC,MAAM,kBAAkB,MAAM,aAAa,CAAC,QAAQ;o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QAAQ,MAAM,CAAC,CAAC;QACrB,MAAM,OAAO,IAAI,QAAQ;QAEzB,wDAAwD;QACxD,IAAI,QAAQ,MAAM,OAAO;QACzB,IAAI,KAAK,IAAI,IAAI,aAAa,KAAK,IAAI,IAAI,gBAAgB,OAAO;QAElE,MAAM,eAAe,CAAA,GAAA,oBAAY,EAAE,MAAM;QACzC,OAAO,aAAa,QAAQ,CAAC,MAAM,GAAG;IACxC;AACF;AAUA,SAAS,6CACP,OAA8B,EAC9B,IAAgB;IAEhB,MAAM,YAAY,QAAQ,GAAG,CAAC,CAAC,MAAQ,CAAA,GAAA,eAAO,EAAE,IAAI,QAAQ;IAC5D,MAAM,kBAAkB,UAAU,GAAG,CAAC,CAAC,QACrC,CAAA,GAAA,yBAAiB,EAAE,MAAM;IAE3B,MAAM,YAAY,gBAAgB,GAAG,CAAC,CAAC,QACrC,CAAA,GAAA,mBAAO,EAAE,MAAM,QAAQ,CAAC,WAAW,EAAE,KAAK,WAAW,CAAC,EAAE;IAG1D,IAAI,aAAa,QAAQ,GAAG,CAAC,CAAC,KAAK;QACjC,OAAO;YACL,GAAG,GAAG;YACN,YAAY;gBACV,GAAG,IAAI,UAAU;gBACjB,UAAU,SAAS,CAAC,EAAE;gBACtB,oBAAoB,eAAe,CAAC,EAAE;gBACtC,mBAAmB,SAAS,CAAC,EAAE;YACjC;QACF;IACF;IAEA,OAAO,6BAAO,YAAY,CAAC,IAAM,EAAE,UAAU,CAAC,iBAAiB;AACjE;AAEA,SAAS,6BAAO,IAAI,EAAE,QAAuB;IAC3C,OAAO,KAAK,IAAI,CAAC,CAAC,GAAG,IAAM,SAAS,KAAK,SAAS;AACpD","sources":["packages/column-views/src/maps/column-correlation/state.ts"],"sourcesContent":["import { LineString, Point } from \"geojson\";\nimport { create, StoreApi, useStore } from \"zustand\";\nimport type { ColumnGeoJSONRecord } from \"@macrostrat/api-types\";\n// Turf intersection\nimport { lineIntersect } from \"@turf/line-intersect\";\nimport distance from \"@turf/distance\";\nimport { nearestPointOnLine } from \"@turf/nearest-point-on-line\";\nimport { centroid } from \"@turf/centroid\";\nimport {\n createContext,\n useState,\n useContext,\n ReactNode,\n useEffect,\n} from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport { createComputed } from \"zustand-computed\";\nimport { useMacrostratColumns } from \"../../data-provider/base\";\n\nexport interface CorrelationMapInput {\n columns: ColumnGeoJSONRecord[];\n focusedLine: LineString | null;\n}\n\nexport interface CorrelationMapStore extends CorrelationMapInput {\n onClickMap: (event: mapboxgl.MapMouseEvent, point: Point) => void;\n}\n\nexport interface CorrelationProviderProps extends CorrelationMapInput {\n projectID?: number;\n inProcess?: boolean;\n columns: ColumnGeoJSONRecord[] | null;\n children: ReactNode;\n onSelectColumns?: (\n columns: FocusedColumnGeoJSONRecord[],\n line: LineString | null,\n ) => void;\n}\n\nconst CorrelationStoreContext =\n createContext<StoreApi<CorrelationMapStore> | null>(null);\n\ntype ComputedStore = {\n focusedColumns: FocusedColumnGeoJSONRecord[];\n};\n\n/** A computed store that will automatically update when the state changes */\nconst computed = createComputed((state: CorrelationMapStore): ComputedStore => {\n return {\n // We compute the focused columns based on columns and focusedLine\n focusedColumns: buildCorrelationColumns(state.columns, state.focusedLine),\n };\n}) as any;\n\nexport function ColumnCorrelationProvider({\n children,\n columns,\n projectID,\n inProcess,\n focusedLine,\n onSelectColumns,\n}: CorrelationProviderProps) {\n const [store] = useState(() => {\n return create<CorrelationMapStore & ComputedStore>(\n computed((set, get): CorrelationMapStore => {\n return {\n focusedLine,\n columns: null,\n onClickMap(event: mapboxgl.MapMouseEvent, point: Point) {\n const state = get();\n // Check if shift key is pressed\n const shiftKeyPressed = event.originalEvent.shiftKey;\n let existingCoords = state.focusedLine?.coordinates ?? [];\n\n if (existingCoords.length >= 2 && !shiftKeyPressed) {\n // Reset the line to zero length\n existingCoords = [];\n }\n set({\n focusedLine: {\n type: \"LineString\",\n coordinates: [...existingCoords, point.coordinates],\n },\n });\n },\n };\n }),\n );\n });\n\n // Set up the store\n /** TODO: move the fetching of all columns to within the map */\n const _columns = useMacrostratColumns(projectID, inProcess);\n useEffect(() => {\n if (_columns != null) {\n store.setState({ columns: _columns });\n }\n }, [_columns]);\n\n // Kind of an awkward way to do this but we need to allow the selector to run\n const focusedColumns = useStore(store, (state) => state.focusedColumns);\n const _focusedLine = useStore(store, (state) => state.focusedLine);\n\n useEffect(() => {\n onSelectColumns?.(focusedColumns, _focusedLine);\n }, [focusedColumns, _focusedLine]);\n\n return h(CorrelationStoreContext.Provider, { value: store }, children);\n}\n\nexport function useCorrelationMapStore(\n selector: (state: CorrelationMapStore & ComputedStore) => any,\n) {\n const storeApi = useContext(CorrelationStoreContext);\n if (storeApi == null) {\n throw new Error(\"Missing CorrelationMapProvider\");\n }\n return useStore(storeApi, selector);\n}\n\nfunction buildCorrelationColumns(\n columns: ColumnGeoJSONRecord[],\n line: LineString,\n): FocusedColumnGeoJSONRecord[] {\n if (columns == null || line == null || line.coordinates.length < 2) {\n return [];\n }\n return orderColumnsByDistance(\n computeIntersectingColumns(columns, line),\n line,\n );\n}\n\nfunction computeIntersectingColumns(\n columns: ColumnGeoJSONRecord[],\n line: LineString,\n): ColumnGeoJSONRecord[] {\n if (columns == null || line == null) {\n return [];\n }\n\n return columns.filter((col) => {\n const poly = col.geometry;\n\n // Some in-process datasets seem to have null geometries\n if (poly == null) return false;\n if (poly.type != \"Polygon\" && poly.type != \"MultiPolygon\") return false;\n\n const intersection = lineIntersect(line, poly);\n return intersection.features.length > 0;\n });\n}\n\ninterface FocusedColumnGeoJSONRecord extends ColumnGeoJSONRecord {\n properties: {\n centroid: Point;\n nearestPointOnLine: Point;\n distanceAlongLine: number;\n } & ColumnGeoJSONRecord[\"properties\"];\n}\n\nfunction orderColumnsByDistance(\n columns: ColumnGeoJSONRecord[],\n line: LineString,\n): FocusedColumnGeoJSONRecord[] {\n const centroids = columns.map((col) => centroid(col.geometry));\n const projectedPoints = centroids.map((point) =>\n nearestPointOnLine(line, point),\n );\n const distances = projectedPoints.map((point) =>\n distance(point.geometry.coordinates, line.coordinates[0]),\n );\n\n let newColumns = columns.map((col, i) => {\n return {\n ...col,\n properties: {\n ...col.properties,\n centroid: centroids[i],\n nearestPointOnLine: projectedPoints[i],\n distanceAlongLine: distances[i],\n },\n };\n });\n\n return sorted(newColumns, (d) => d.properties.distanceAlongLine);\n}\n\nfunction sorted(data, accessor: (d) => number) {\n return data.sort((a, b) => accessor(a) - accessor(b));\n}\n"],"names":[],"version":3,"file":"column-views.6d63971b.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;AAuCA,MAAM,gDACJ,CAAA,GAAA,oBAAY,EAAwC;AAMtD,2EAA2E,GAC3E,MAAM,iCAAW,CAAA,GAAA,qBAAa,EAAE,CAAC;IAC/B,OAAO;QACL,kEAAkE;QAClE,gBAAgB,8CAAwB,MAAM,OAAO,EAAE,MAAM,WAAW;IAC1E;AACF;AAEO,SAAS,0CAA0B,YACxC,QAAQ,WACR,OAAO,aACP,SAAS,aACT,SAAS,eACT,WAAW,mBACX,eAAe,EACU;IACzB,MAAM,CAAC,MAAM,GAAG,CAAA,GAAA,eAAO,EAAE;QACvB,OAAO,CAAA,GAAA,aAAK,EACV,+BAAS,CAAC,KAAK;YACb,OAAO;6BACL;gBACA,SAAS;gBACT,YAAW,KAA6B,EAAE,KAAY;oBACpD,MAAM,QAAQ;oBACd,gCAAgC;oBAChC,MAAM,kBAAkB,MAAM,aAAa,CAAC,QAAQ;oBACpD,IAAI,iBAAiB,MAAM,WAAW,EAAE,eAAe,EAAE;oBAEzD,IAAI,eAAe,MAAM,IAAI,KAAK,CAAC,iBACjC,gCAAgC;oBAChC,iBAAiB,EAAE;oBAErB,IAAI;wBACF,aAAa;4BACX,MAAM;4BACN,aAAa;mCAAI;gCAAgB,MAAM,WAAW;6BAAC;wBACrD;oBACF;gBACF;YACF;QACF;IAEJ;IAEA,mBAAmB;IACnB,6DAA6D,GAC7D,MAAM,WAAW,CAAA,GAAA,yCAAm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hB,MAAM,YAAY,QAAQ,GAAG,CAAC,CAAC,MAAQ,CAAA,GAAA,eAAO,EAAE,IAAI,QAAQ;IAC5D,MAAM,kBAAkB,UAAU,GAAG,CAAC,CAAC,QACrC,CAAA,GAAA,yBAAiB,EAAE,MAAM;IAE3B,MAAM,YAAY,gBAAgB,GAAG,CAAC,CAAC,QACrC,CAAA,GAAA,mBAAO,EAAE,MAAM,QAAQ,CAAC,WAAW,EAAE,KAAK,WAAW,CAAC,EAAE;IAG1D,IAAI,aAAa,QAAQ,GAAG,CAAC,CAAC,KAAK;QACjC,OAAO;YACL,GAAG,GAAG;YACN,YAAY;gBACV,GAAG,IAAI,UAAU;gBACjB,UAAU,SAAS,CAAC,EAAE;gBACtB,oBAAoB,eAAe,CAAC,EAAE;gBACtC,mBAAmB,SAAS,CAAC,EAAE;YACjC;QACF;IACF;IAEA,OAAO,6BAAO,YAAY,CAAC,IAAM,EAAE,UAAU,CAAC,iBAAiB;AACjE;AAEA,SAAS,6BAAO,IAAI,EAAE,QAAuB;IAC3C,OAAO,KAAK,IAAI,CAAC,CAAC,GAAG,IAAM,SAAS,KAAK,SAAS;AACpD","sources":["packages/column-views/src/maps/column-correlation/state.ts"],"sourcesContent":["import { LineString, Point } from \"geojson\";\nimport { create, StoreApi, useStore } from \"zustand\";\nimport type { ColumnGeoJSONRecord } from \"@macrostrat/api-types\";\n// Turf intersection\nimport { lineIntersect } from \"@turf/line-intersect\";\nimport distance from \"@turf/distance\";\nimport { nearestPointOnLine } from \"@turf/nearest-point-on-line\";\nimport { centroid } from \"@turf/centroid\";\nimport {\n createContext,\n useState,\n useContext,\n ReactNode,\n useEffect,\n} from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport { createComputed } from \"zustand-computed\";\nimport { useMacrostratColumns } from \"../../data-provider/base\";\n\nexport interface CorrelationMapInput {\n columns: ColumnGeoJSONRecord[];\n focusedLine: LineString | null;\n}\n\nexport interface CorrelationMapStore extends CorrelationMapInput {\n onClickMap: (event: mapboxgl.MapMouseEvent, point: Point) => void;\n}\n\nexport interface CorrelationProviderProps extends CorrelationMapInput {\n projectID?: number;\n inProcess?: boolean;\n columns: ColumnGeoJSONRecord[] | null;\n children: ReactNode;\n onSelectColumns?: (\n columns: FocusedColumnGeoJSONRecord[],\n line: LineString | null,\n ) => void;\n}\n\nconst CorrelationStoreContext =\n createContext<StoreApi<CorrelationMapStore> | null>(null);\n\ntype ComputedStore = {\n focusedColumns: FocusedColumnGeoJSONRecord[];\n};\n\n/** A computed store that will automatically update when the state changes */\nconst computed = createComputed((state: CorrelationMapStore): ComputedStore => {\n return {\n // We compute the focused columns based on columns and focusedLine\n focusedColumns: buildCorrelationColumns(state.columns, state.focusedLine),\n };\n}) as any;\n\nexport function ColumnCorrelationProvider({\n children,\n columns,\n projectID,\n inProcess,\n focusedLine,\n onSelectColumns,\n}: CorrelationProviderProps) {\n const [store] = useState(() => {\n return create<CorrelationMapStore & ComputedStore>(\n computed((set, get): CorrelationMapStore => {\n return {\n focusedLine,\n columns: null,\n onClickMap(event: mapboxgl.MapMouseEvent, point: Point) {\n const state = get();\n // Check if shift key is pressed\n const shiftKeyPressed = event.originalEvent.shiftKey;\n let existingCoords = state.focusedLine?.coordinates ?? [];\n\n if (existingCoords.length >= 2 && !shiftKeyPressed) {\n // Reset the line to zero length\n existingCoords = [];\n }\n set({\n focusedLine: {\n type: \"LineString\",\n coordinates: [...existingCoords, point.coordinates],\n },\n });\n },\n };\n }),\n );\n });\n\n // Set up the store\n /** TODO: move the fetching of all columns to within the map */\n const _columns = useMacrostratColumns(projectID, inProcess);\n useEffect(() => {\n if (_columns != null) {\n store.setState({ columns: _columns });\n }\n }, [_columns]);\n\n // Kind of an awkward way to do this but we need to allow the selector to run\n const focusedColumns = useStore(store, (state) => state.focusedColumns);\n const _focusedLine = useStore(store, (state) => state.focusedLine);\n\n useEffect(() => {\n onSelectColumns?.(focusedColumns, _focusedLine);\n }, [focusedColumns, _focusedLine]);\n\n return h(CorrelationStoreContext.Provider, { value: store }, children);\n}\n\nexport function useCorrelationMapStore(\n selector: (state: CorrelationMapStore & ComputedStore) => any,\n) {\n const storeApi = useContext(CorrelationStoreContext);\n if (storeApi == null) {\n throw new Error(\"Missing CorrelationMapProvider\");\n }\n return useStore(storeApi, selector);\n}\n\nfunction buildCorrelationColumns(\n columns: ColumnGeoJSONRecord[],\n line: LineString,\n): FocusedColumnGeoJSONRecord[] {\n if (columns == null || line == null || line.coordinates.length < 2) {\n return [];\n }\n return orderColumnsByDistance(\n computeIntersectingColumns(columns, line),\n line,\n );\n}\n\nfunction computeIntersectingColumns(\n columns: ColumnGeoJSONRecord[],\n line: LineString,\n): ColumnGeoJSONRecord[] {\n if (columns == null || line == null) {\n return [];\n }\n\n return columns.filter((col) => {\n const poly = col.geometry;\n\n // Some in-process datasets seem to have null geometries\n if (poly == null) return false;\n if (poly.type != \"Polygon\" && poly.type != \"MultiPolygon\") return false;\n\n const intersection = lineIntersect(line, poly);\n return intersection.features.length > 0;\n });\n}\n\ninterface FocusedColumnGeoJSONRecord extends ColumnGeoJSONRecord {\n properties: {\n centroid: Point;\n nearestPointOnLine: Point;\n distanceAlongLine: number;\n } & ColumnGeoJSONRecord[\"properties\"];\n}\n\nfunction orderColumnsByDistance(\n columns: ColumnGeoJSONRecord[],\n line: LineString,\n): FocusedColumnGeoJSONRecord[] {\n const centroids = columns.map((col) => centroid(col.geometry));\n const projectedPoints = centroids.map((point) =>\n nearestPointOnLine(line, point),\n );\n const distances = projectedPoints.map((point) =>\n distance(point.geometry.coordinates, line.coordinates[0]),\n );\n\n let newColumns = columns.map((col, i) => {\n return {\n ...col,\n properties: {\n ...col.properties,\n centroid: centroids[i],\n nearestPointOnLine: projectedPoints[i],\n distanceAlongLine: distances[i],\n },\n };\n });\n\n return sorted(newColumns, (d) => d.properties.distanceAlongLine);\n}\n\nfunction sorted(data, accessor: (d) => number) {\n return data.sort((a, b) => accessor(a) - accessor(b));\n}\n"],"names":[],"version":3,"file":"column-views.ad2fe46c.js.map"}
@@ -1,9 +1,9 @@
1
- import {CompositeUnitsColumn as $8c8238faa5cde49c$export$a6684360fef0406e, LabelTrackerProvider as $8c8238faa5cde49c$export$e4e89ab6c86ac513, SectionLabelsColumn as $8c8238faa5cde49c$export$13984e34afdbb040} from "./column-views.75e5aebe.js";
1
+ import {CompositeUnitsColumn as $8c8238faa5cde49c$export$a6684360fef0406e, LabelTrackerProvider as $8c8238faa5cde49c$export$e4e89ab6c86ac513, SectionLabelsColumn as $8c8238faa5cde49c$export$13984e34afdbb040} from "./column-views.63d40878.js";
2
2
  import $7zu8d$columnviewscc733361js from "./column-views.cc733361.js";
3
3
  import "./column-views.e93478c3.css";
4
- import {MacrostratColumnProvider as $774a5efa27d1c77b$export$9e42f9b6e0d67c7d, useMacrostratBaseURL as $774a5efa27d1c77b$export$33b1392d23dde04} from "./column-views.ef88c46c.js";
5
- import {useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d, useMacrostratUnits as $d5074f164411387e$export$6fb40844db555b2} from "./column-views.abf6aedd.js";
6
- import {Duration as $448b24baeef3b229$export$3b11bc38611c5941} from "./column-views.218e8f5d.js";
4
+ import {MacrostratColumnProvider as $774a5efa27d1c77b$export$9e42f9b6e0d67c7d, useMacrostratBaseURL as $774a5efa27d1c77b$export$33b1392d23dde04} from "./column-views.e075af15.js";
5
+ import {useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d, useMacrostratUnits as $d5074f164411387e$export$6fb40844db555b2} from "./column-views.4b259f9e.js";
6
+ import {Duration as $448b24baeef3b229$export$3b11bc38611c5941} from "./column-views.5eb4e6ff.js";
7
7
  import {useMemo as $7zu8d$useMemo} from "react";
8
8
  import {useMacrostratIntervals as $7zu8d$useMacrostratIntervals, Timescale as $7zu8d$Timescale, TimescaleOrientation as $7zu8d$TimescaleOrientation} from "@macrostrat/timescale";
9
9
  import {SVG as $7zu8d$SVG, ColumnAxisType as $7zu8d$ColumnAxisType} from "@macrostrat/column-components";
@@ -245,4 +245,4 @@ function $7d0f52717c0de7e1$var$Unconformity({ upperAge: upperAge, lowerAge: lowe
245
245
 
246
246
 
247
247
  export {$7d0f52717c0de7e1$export$38cb0ab5af8f50d7 as SectionsColumn, $7d0f52717c0de7e1$export$e12e53eeee198b99 as UnconformityLabels, $7d0f52717c0de7e1$export$db2df5a73a6fbe10 as CompositeTimescale, $7d0f52717c0de7e1$export$463f46772c64d403 as CompositeTimescaleCore};
248
- //# sourceMappingURL=column-views.7b4a1f15.js.map
248
+ //# sourceMappingURL=column-views.afe0bb48.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,uEAAK;AAyBrB,SAAS,0CAAe,KAAyB;IACtD,MAAM,sBACJ,qBAAqB,qBACrB,aAAa,sBACb,kBAAkB,cAClB,aAAa,aACb,QAAQ,kBACR,cAAc,sBACd,kBAAkB,iBAClB,YAAY,0BACZ,kBAAkB,EACnB,GAAG;IAEJ,MAAM,QAAQ,CAAA,GAAA,wCAAiB;IAE/B,kCAAkC;IAClC,MAAM,MAAM,KAAK,CAAC,EAAE,EAAE;IAEtB,OAAO,wBAAE,CAAA,GAAA,yCAAmB,GAAG;eAAE;aAAO;IAAI,GAAG;QAC7C,wBAAE,0CAAoB;YACpB,OAAO;2BACP;gCACA;wBACA;uBACA;gCACA;gCACA;QACF;QACA,wBAAE,EAAE,CAAC,iBAAiB,CAAA,GAAA,yCAAkB,GAAG;YACzC,OAAO,QAAQ;QACjB;KACD;AACH;AAEA,SAAS,yCAAmB,KAAyB;IACnD,MAAM,SACJ,KAAK,cACL,UAAU,iBACV,aAAa,sBACb,kBAAkB,aAClB,SAAS,sBACT,kBAAkB,YAClB,QAAQ,sBACR,qBAAqB,MACtB,GAAG;IAEJ,MAAM,YAAE,QAAQ,eAAE,WAAW,EAAE,GAAG,CAAA,GAAA,yCAAsB;IAExD,MAAM,YA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AAM,wBAAE,CAAA,GAAA,YAAI,GAAG;YAAE,OAAO;YAAM,MAAM;QAAI;IAC1C,OACE,MAAM,wBAAE,CAAA,GAAA,yCAAO,GAAG;QAAE,OAAO;+BAAQ;IAAsB;IAG3D,IAAI,SAAoB;IACxB,IAAI,SACF,SAAS,wBAAE;QAAC;QAAK,wBAAE,eAAe;KAAQ;IAG5C,OAAO,wBAAE,oBAAoB;eAAE;mBAAO;IAAU,GAAG;QACjD,wBAAE,0BAA0B,wBAAE,yBAAyB;YAAC;YAAK;SAAO;KACrE;AACH","sources":["packages/column-views/src/section.ts"],"sourcesContent":["import {\n CompositeUnitsColumn,\n LabelTrackerProvider,\n SectionLabelsColumn,\n} from \"./units\";\nimport { ReactNode, FunctionComponent, useMemo } from \"react\";\nimport {\n Timescale,\n TimescaleOrientation,\n useMacrostratIntervals,\n} from \"@macrostrat/timescale\";\nimport { ColumnAxisType, SVG } from \"@macrostrat/column-components\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./column.module.sass\";\nimport {\n useMacrostratColumnData,\n useMacrostratUnits,\n MacrostratColumnProvider,\n useMacrostratBaseURL,\n} from \"./data-provider\";\nimport { Duration } from \"./unit-details\";\nimport { Value } from \"@macrostrat/data-components\";\nimport type { ExtUnit, PackageScaleLayoutData } from \"./prepare-units/types\";\n\nconst h = hyper.styled(styles);\n\nexport interface SectionSharedProps {\n unitComponent?: FunctionComponent<any>;\n unitComponentProps?: any;\n showLabels?: boolean;\n width?: number;\n columnWidth?: number;\n children?: ReactNode;\n showLabelColumn?: boolean;\n axisType?: ColumnAxisType;\n className?: string;\n clipUnits?: boolean;\n maxInternalColumns?: number;\n // Space between sections\n verticalSpacing?: number;\n // Whether to render unconformity labels\n unconformityLabels?: boolean;\n}\n\nexport interface SectionProps extends SectionSharedProps {\n units: ExtUnit[];\n scaleInfo: PackageScaleLayoutData;\n}\n\nexport function SectionsColumn(props: SectionSharedProps) {\n const {\n unconformityLabels = true,\n unitComponent,\n unitComponentProps,\n showLabels = true,\n width = 300,\n columnWidth = 150,\n showLabelColumn = true,\n clipUnits = true,\n maxInternalColumns,\n } = props;\n\n const units = useMacrostratUnits();\n\n // Get a unique key for the column\n const key = units[0]?.col_id;\n\n return h(LabelTrackerProvider, { units, key }, [\n h(SectionUnitsColumn, {\n width: columnWidth,\n unitComponent,\n unitComponentProps,\n showLabels,\n clipUnits,\n maxInternalColumns,\n unconformityLabels,\n }),\n h.if(showLabelColumn)(SectionLabelsColumn, {\n width: width - columnWidth,\n }),\n ]);\n}\n\nfunction SectionUnitsColumn(props: SectionSharedProps) {\n const {\n width,\n showLabels,\n unitComponent,\n unitComponentProps,\n clipUnits,\n maxInternalColumns,\n axisType,\n unconformityLabels = true,\n } = props;\n\n const { sections, totalHeight } = useMacrostratColumnData();\n\n const scaleData: PackageScaleLayoutData[] = sections.map((section) => {\n return section.scaleInfo;\n });\n\n const innerWidth = width - 2;\n\n return h(\"div.section-units-container\", { style: { width } }, [\n h(\n SVG,\n {\n className: \"sections\",\n height: totalHeight,\n innerWidth,\n paddingH: 1,\n },\n sections.map((group) => {\n const { units, scaleInfo, section_id } = group;\n\n const key = `section-${section_id}`;\n return h(\n SectionUnits,\n {\n units,\n scaleInfo,\n key,\n unitComponent,\n unitComponentProps,\n showLabels,\n width: innerWidth,\n clipUnits,\n maxInternalColumns,\n }, // This unconformity is with the section _above_\n );\n }),\n ),\n h.if(unconformityLabels)(UnconformityLabels, {\n width,\n sections: scaleData,\n verbose: false,\n }),\n ]);\n}\n\nfunction SectionUnits(props: SectionProps) {\n // Section with \"squishy\" timescale\n const {\n units,\n scaleInfo,\n unitComponent,\n showLabels = true,\n width = 300,\n unitComponentProps,\n className,\n clipUnits = true,\n maxInternalColumns,\n } = props;\n\n const { domain, pixelScale, pixelHeight, scale } = scaleInfo;\n\n /** Ensure that we can arrange units into the maximum number\n * of columns defined by unitComponentProps, but that we don't\n * use more than necessary.\n */\n const _unitComponentProps = useMemo(() => {\n return {\n ...unitComponentProps,\n nColumns: Math.min(\n maxInternalColumns ?? Math.floor(width / 10),\n unitComponentProps?.nColumns ?? Infinity,\n Math.max(...units.map((d) => d.column)) + 1,\n ),\n //axisType,\n };\n }, [units, unitComponentProps, maxInternalColumns, width]);\n\n const style = {\n \"--section-height\": `${pixelHeight}px`,\n \"--section-width\": `${width}px`,\n };\n\n return h(\n \"g.section\",\n { className, style, transform: `translate(0 ${scaleInfo.offset})` },\n h(\n MacrostratColumnProvider,\n {\n units,\n domain,\n pixelScale, // Actually pixels per myr,\n scale,\n },\n h(CompositeUnitsColumn, {\n width,\n showLabels,\n unitComponent,\n unitComponentProps: _unitComponentProps,\n clipToFrame: clipUnits,\n }),\n ),\n );\n}\n\ninterface CompositeTimescaleProps {\n levels?: [number, number] | number;\n unconformityLabels?: boolean;\n}\n\nexport function CompositeTimescale(props: CompositeTimescaleProps) {\n const { sections } = useMacrostratColumnData();\n const sectionScales = sections.map((section) => {\n return section.scaleInfo;\n });\n\n return h(CompositeTimescaleCore, {\n packages: sectionScales,\n ...props,\n });\n}\n\ntype CompositeTimescaleCoreProps = CompositeTimescaleProps & {\n packages: PackageScaleLayoutData[];\n};\n\nexport function CompositeTimescaleCore(props: CompositeTimescaleCoreProps) {\n const { levels = 3, packages, unconformityLabels = false } = props;\n\n // Use intervals from Macrostrat API\n const baseURL = useMacrostratBaseURL();\n const intervals = useMacrostratIntervals(baseURL);\n\n let _levels: [number, number];\n if (typeof levels === \"number\") {\n // If levels is a number, use the most common starting level\n _levels = [2, Math.max(2 + Math.min(levels, 5) - 1, 1)];\n } else {\n _levels = levels;\n }\n\n const nCols = _levels[1] - _levels[0] + 1;\n\n return h(\"div.timescale-column\", [\n h(\n \"div.timescales\",\n packages.map((group) => {\n const { pixelHeight, paddingTop, key, scale } = group;\n return h(\n \"div.timescale-container\",\n { style: { paddingTop, \"--timescale-level-count\": nCols }, key },\n [\n h(Timescale, {\n orientation: TimescaleOrientation.VERTICAL,\n length: pixelHeight,\n levels: _levels,\n absoluteAgeScale: true,\n showAgeAxis: false,\n scale,\n intervals,\n }),\n ],\n );\n }),\n ),\n h.if(unconformityLabels)(UnconformityLabels, {\n width: \"100%\",\n sections: packages,\n className: \"unconformity-labels\",\n axisType: ColumnAxisType.AGE,\n }),\n ]);\n}\n\nexport function UnconformityLabels(props: {\n width: string | number;\n sections: PackageScaleLayoutData[];\n axisType?: ColumnAxisType;\n className?: string;\n verbose?: boolean;\n}) {\n const { width, sections, className, axisType, verbose } = props;\n\n return h(\n \"div.unconformity-labels\",\n {\n style: {\n width,\n },\n className,\n },\n sections.map((scaleInfo, i) => {\n const lastGroup = sections[i - 1];\n const top = scaleInfo.offset - scaleInfo.paddingTop;\n const upperAge = lastGroup?.domain[0];\n const lowerAge = scaleInfo.domain[1];\n return h(Unconformity, {\n axisType,\n upperAge,\n lowerAge,\n style: {\n width,\n height: scaleInfo.paddingTop,\n top,\n },\n verbose,\n });\n }),\n );\n}\n\nfunction Unconformity({\n upperAge,\n lowerAge,\n style,\n axisType,\n verbose = false,\n}) {\n if (upperAge == null || lowerAge == null) {\n return null;\n }\n\n const ageGap = Math.abs(upperAge - lowerAge);\n\n let maximumFractionDigits = 0;\n\n let className: string = null;\n if (ageGap > 1000) {\n className = \"giga\";\n } else if (ageGap > 100) {\n className = \"mega\";\n } else if (ageGap > 10) {\n className = \"large\";\n } else if (ageGap < 1) {\n className = \"small\";\n maximumFractionDigits = 2;\n } else {\n maximumFractionDigits = 1;\n }\n\n let val: ReactNode;\n if (axisType === ColumnAxisType.DEPTH || axisType === ColumnAxisType.HEIGHT) {\n const _txt = ageGap.toLocaleString(\"en-US\", { maximumFractionDigits });\n val = h(Value, { value: _txt, unit: \"m\" });\n } else {\n val = h(Duration, { value: ageGap, maximumFractionDigits });\n }\n\n let prefix: ReactNode = null;\n if (verbose) {\n prefix = h([\" \", h(\"span.prefix\", \" gap\")]);\n }\n\n return h(\"div.unconformity\", { style, className }, [\n h(\"div.unconformity-inner\", h(\"div.unconformity-text\", [val, prefix])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wBAAE,yBAAyB;YAAC;YAAK;SAAO;KACrE;AACH","sources":["packages/column-views/src/section.ts"],"sourcesContent":["import {\n CompositeUnitsColumn,\n LabelTrackerProvider,\n SectionLabelsColumn,\n} from \"./units\";\nimport { ReactNode, FunctionComponent, useMemo } from \"react\";\nimport {\n Timescale,\n TimescaleOrientation,\n useMacrostratIntervals,\n} from \"@macrostrat/timescale\";\nimport { ColumnAxisType, SVG } from \"@macrostrat/column-components\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./column.module.sass\";\nimport {\n useMacrostratColumnData,\n useMacrostratUnits,\n MacrostratColumnProvider,\n useMacrostratBaseURL,\n} from \"./data-provider\";\nimport { Duration } from \"./unit-details\";\nimport { Value } from \"@macrostrat/data-components\";\nimport type { ExtUnit, PackageScaleLayoutData } from \"./prepare-units/types\";\n\nconst h = hyper.styled(styles);\n\nexport interface SectionSharedProps {\n unitComponent?: FunctionComponent<any>;\n unitComponentProps?: any;\n showLabels?: boolean;\n width?: number;\n columnWidth?: number;\n children?: ReactNode;\n showLabelColumn?: boolean;\n axisType?: ColumnAxisType;\n className?: string;\n clipUnits?: boolean;\n maxInternalColumns?: number;\n // Space between sections\n verticalSpacing?: number;\n // Whether to render unconformity labels\n unconformityLabels?: boolean;\n}\n\nexport interface SectionProps extends SectionSharedProps {\n units: ExtUnit[];\n scaleInfo: PackageScaleLayoutData;\n}\n\nexport function SectionsColumn(props: SectionSharedProps) {\n const {\n unconformityLabels = true,\n unitComponent,\n unitComponentProps,\n showLabels = true,\n width = 300,\n columnWidth = 150,\n showLabelColumn = true,\n clipUnits = true,\n maxInternalColumns,\n } = props;\n\n const units = useMacrostratUnits();\n\n // Get a unique key for the column\n const key = units[0]?.col_id;\n\n return h(LabelTrackerProvider, { units, key }, [\n h(SectionUnitsColumn, {\n width: columnWidth,\n unitComponent,\n unitComponentProps,\n showLabels,\n clipUnits,\n maxInternalColumns,\n unconformityLabels,\n }),\n h.if(showLabelColumn)(SectionLabelsColumn, {\n width: width - columnWidth,\n }),\n ]);\n}\n\nfunction SectionUnitsColumn(props: SectionSharedProps) {\n const {\n width,\n showLabels,\n unitComponent,\n unitComponentProps,\n clipUnits,\n maxInternalColumns,\n axisType,\n unconformityLabels = true,\n } = props;\n\n const { sections, totalHeight } = useMacrostratColumnData();\n\n const scaleData: PackageScaleLayoutData[] = sections.map((section) => {\n return section.scaleInfo;\n });\n\n const innerWidth = width - 2;\n\n return h(\"div.section-units-container\", { style: { width } }, [\n h(\n SVG,\n {\n className: \"sections\",\n height: totalHeight,\n innerWidth,\n paddingH: 1,\n },\n sections.map((group) => {\n const { units, scaleInfo, section_id } = group;\n\n const key = `section-${section_id}`;\n return h(\n SectionUnits,\n {\n units,\n scaleInfo,\n key,\n unitComponent,\n unitComponentProps,\n showLabels,\n width: innerWidth,\n clipUnits,\n maxInternalColumns,\n }, // This unconformity is with the section _above_\n );\n }),\n ),\n h.if(unconformityLabels)(UnconformityLabels, {\n width,\n sections: scaleData,\n verbose: false,\n }),\n ]);\n}\n\nfunction SectionUnits(props: SectionProps) {\n // Section with \"squishy\" timescale\n const {\n units,\n scaleInfo,\n unitComponent,\n showLabels = true,\n width = 300,\n unitComponentProps,\n className,\n clipUnits = true,\n maxInternalColumns,\n } = props;\n\n const { domain, pixelScale, pixelHeight, scale } = scaleInfo;\n\n /** Ensure that we can arrange units into the maximum number\n * of columns defined by unitComponentProps, but that we don't\n * use more than necessary.\n */\n const _unitComponentProps = useMemo(() => {\n return {\n ...unitComponentProps,\n nColumns: Math.min(\n maxInternalColumns ?? Math.floor(width / 10),\n unitComponentProps?.nColumns ?? Infinity,\n Math.max(...units.map((d) => d.column)) + 1,\n ),\n //axisType,\n };\n }, [units, unitComponentProps, maxInternalColumns, width]);\n\n const style = {\n \"--section-height\": `${pixelHeight}px`,\n \"--section-width\": `${width}px`,\n };\n\n return h(\n \"g.section\",\n { className, style, transform: `translate(0 ${scaleInfo.offset})` },\n h(\n MacrostratColumnProvider,\n {\n units,\n domain,\n pixelScale, // Actually pixels per myr,\n scale,\n },\n h(CompositeUnitsColumn, {\n width,\n showLabels,\n unitComponent,\n unitComponentProps: _unitComponentProps,\n clipToFrame: clipUnits,\n }),\n ),\n );\n}\n\ninterface CompositeTimescaleProps {\n levels?: [number, number] | number;\n unconformityLabels?: boolean;\n}\n\nexport function CompositeTimescale(props: CompositeTimescaleProps) {\n const { sections } = useMacrostratColumnData();\n const sectionScales = sections.map((section) => {\n return section.scaleInfo;\n });\n\n return h(CompositeTimescaleCore, {\n packages: sectionScales,\n ...props,\n });\n}\n\ntype CompositeTimescaleCoreProps = CompositeTimescaleProps & {\n packages: PackageScaleLayoutData[];\n};\n\nexport function CompositeTimescaleCore(props: CompositeTimescaleCoreProps) {\n const { levels = 3, packages, unconformityLabels = false } = props;\n\n // Use intervals from Macrostrat API\n const baseURL = useMacrostratBaseURL();\n const intervals = useMacrostratIntervals(baseURL);\n\n let _levels: [number, number];\n if (typeof levels === \"number\") {\n // If levels is a number, use the most common starting level\n _levels = [2, Math.max(2 + Math.min(levels, 5) - 1, 1)];\n } else {\n _levels = levels;\n }\n\n const nCols = _levels[1] - _levels[0] + 1;\n\n return h(\"div.timescale-column\", [\n h(\n \"div.timescales\",\n packages.map((group) => {\n const { pixelHeight, paddingTop, key, scale } = group;\n return h(\n \"div.timescale-container\",\n { style: { paddingTop, \"--timescale-level-count\": nCols }, key },\n [\n h(Timescale, {\n orientation: TimescaleOrientation.VERTICAL,\n length: pixelHeight,\n levels: _levels,\n absoluteAgeScale: true,\n showAgeAxis: false,\n scale,\n intervals,\n }),\n ],\n );\n }),\n ),\n h.if(unconformityLabels)(UnconformityLabels, {\n width: \"100%\",\n sections: packages,\n className: \"unconformity-labels\",\n axisType: ColumnAxisType.AGE,\n }),\n ]);\n}\n\nexport function UnconformityLabels(props: {\n width: string | number;\n sections: PackageScaleLayoutData[];\n axisType?: ColumnAxisType;\n className?: string;\n verbose?: boolean;\n}) {\n const { width, sections, className, axisType, verbose } = props;\n\n return h(\n \"div.unconformity-labels\",\n {\n style: {\n width,\n },\n className,\n },\n sections.map((scaleInfo, i) => {\n const lastGroup = sections[i - 1];\n const top = scaleInfo.offset - scaleInfo.paddingTop;\n const upperAge = lastGroup?.domain[0];\n const lowerAge = scaleInfo.domain[1];\n return h(Unconformity, {\n axisType,\n upperAge,\n lowerAge,\n style: {\n width,\n height: scaleInfo.paddingTop,\n top,\n },\n verbose,\n });\n }),\n );\n}\n\nfunction Unconformity({\n upperAge,\n lowerAge,\n style,\n axisType,\n verbose = false,\n}) {\n if (upperAge == null || lowerAge == null) {\n return null;\n }\n\n const ageGap = Math.abs(upperAge - lowerAge);\n\n let maximumFractionDigits = 0;\n\n let className: string = null;\n if (ageGap > 1000) {\n className = \"giga\";\n } else if (ageGap > 100) {\n className = \"mega\";\n } else if (ageGap > 10) {\n className = \"large\";\n } else if (ageGap < 1) {\n className = \"small\";\n maximumFractionDigits = 2;\n } else {\n maximumFractionDigits = 1;\n }\n\n let val: ReactNode;\n if (axisType === ColumnAxisType.DEPTH || axisType === ColumnAxisType.HEIGHT) {\n const _txt = ageGap.toLocaleString(\"en-US\", { maximumFractionDigits });\n val = h(Value, { value: _txt, unit: \"m\" });\n } else {\n val = h(Duration, { value: ageGap, maximumFractionDigits });\n }\n\n let prefix: ReactNode = null;\n if (verbose) {\n prefix = h([\" \", h(\"span.prefix\", \" gap\")]);\n }\n\n return h(\"div.unconformity\", { style, className }, [\n h(\"div.unconformity-inner\", h(\"div.unconformity-text\", [val, prefix])),\n ]);\n}\n"],"names":[],"version":3,"file":"column-views.afe0bb48.js.map"}
@@ -1,4 +1,4 @@
1
- import {createUnitSorter as $b6657fba8924a702$export$ab14c04795685c55, ensureArray as $b6657fba8924a702$export$d0c8ecbd4ed8940c, ensureRealFloat as $b6657fba8924a702$export$97de5b0a6b4e4dac, getUnitHeightRange as $b6657fba8924a702$export$70e712e2ac0237a, unitsOverlap as $b6657fba8924a702$export$f1a15f539858307} from "./column-views.54f8b909.js";
1
+ import {createUnitSorter as $b6657fba8924a702$export$ab14c04795685c55, ensureArray as $b6657fba8924a702$export$d0c8ecbd4ed8940c, ensureRealFloat as $b6657fba8924a702$export$97de5b0a6b4e4dac, getUnitHeightRange as $b6657fba8924a702$export$70e712e2ac0237a, unitsOverlap as $b6657fba8924a702$export$f1a15f539858307} from "./column-views.052498a6.js";
2
2
  import {group as $ailTa$group} from "d3-array";
3
3
  import {ColumnAxisType as $ailTa$ColumnAxisType} from "@macrostrat/column-components";
4
4
  import {compareAgeRanges as $ailTa$compareAgeRanges, AgeRangeRelationship as $ailTa$AgeRangeRelationship} from "@macrostrat/stratigraphy-utils";
@@ -222,4 +222,4 @@ function $663a0cdd08b02256$export$47e05aac3f0b77d4(unit) {
222
222
 
223
223
 
224
224
  export {$663a0cdd08b02256$export$55543e159517d62d as preprocessUnits, $663a0cdd08b02256$export$eeade20e3eee4638 as groupUnitsIntoSectionsBySectionID, $663a0cdd08b02256$export$8093438ec3e4c6fd as getSectionAgeRange, $663a0cdd08b02256$export$483b05c497fd70c6 as getSectionPosRange, $663a0cdd08b02256$export$bb26cdbde9c8c08b as groupUnitsIntoSectionsByOverlap, $663a0cdd08b02256$export$e7bb744b9be37f3d as mergeOverlappingSections, $663a0cdd08b02256$export$47e05aac3f0b77d4 as preprocessSectionUnit};
225
- //# sourceMappingURL=column-views.aecf25bc.js.map
225
+ //# sourceMappingURL=column-views.b4e1236d.js.map