@macrostrat/column-views 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/esm/{data-area.daff8da0.js → column-views.062d164a.js} +1 -1
  3. package/dist/esm/{data-area.daff8da0.js.map → column-views.062d164a.js.map} +1 -1
  4. package/dist/esm/{data-provider.1506eb64.js → column-views.07521ce6.js} +1 -1
  5. package/dist/esm/{data-provider.1506eb64.js.map → column-views.07521ce6.js.map} +1 -1
  6. package/dist/esm/{correlation-chart.abd8b346.js → column-views.134b2e2a.js} +3 -3
  7. package/dist/esm/{correlation-chart.abd8b346.js.map → column-views.134b2e2a.js.map} +1 -1
  8. package/dist/esm/{popover.module.c4d6bfb0.css → column-views.16cc7a58.css} +1 -1
  9. package/dist/esm/{popover.module.c4d6bfb0.css.map → column-views.16cc7a58.css.map} +1 -1
  10. package/dist/esm/{helpers.2f0a0cb7.js → column-views.1c589cc4.js} +2 -2
  11. package/dist/esm/{helpers.2f0a0cb7.js.map → column-views.1c589cc4.js.map} +1 -1
  12. package/dist/esm/{panel.598f76a5.js → column-views.1ece326b.js} +6 -6
  13. package/dist/esm/{panel.598f76a5.js.map → column-views.1ece326b.js.map} +1 -1
  14. package/dist/esm/{colors.395c6db5.js → column-views.1edc7300.js} +1 -1
  15. package/dist/esm/{colors.395c6db5.js.map → column-views.1edc7300.js.map} +1 -1
  16. package/dist/esm/{column.module.a67a6b4c.css → column-views.240ef158.css} +1 -1
  17. package/dist/esm/{column.module.a67a6b4c.css.map → column-views.240ef158.css.map} +1 -1
  18. package/dist/esm/{panel.module.3d2ea3c6.css → column-views.25471fe0.css} +1 -1
  19. package/dist/esm/{panel.module.3d2ea3c6.css.map → column-views.25471fe0.css.map} +1 -1
  20. package/dist/esm/{base.910b80b4.js → column-views.28ee5f43.js} +3 -3
  21. package/dist/esm/{base.910b80b4.js.map → column-views.28ee5f43.js.map} +1 -1
  22. package/dist/esm/{state.2952cbca.js → column-views.30646469.js} +2 -2
  23. package/dist/esm/{state.2952cbca.js.map → column-views.30646469.js.map} +1 -1
  24. package/dist/esm/{main.module.3dd9500b.css → column-views.338a7a83.css} +1 -1
  25. package/dist/esm/{main.module.3dd9500b.css.map → column-views.338a7a83.css.map} +1 -1
  26. package/dist/esm/{styles.7bc776d1.js → column-views.33dbc778.js} +1 -1
  27. package/dist/esm/{styles.7bc776d1.js.map → column-views.33dbc778.js.map} +1 -1
  28. package/dist/esm/{units.5a4fc058.js → column-views.343b5aa2.js} +10 -10
  29. package/dist/esm/{units.5a4fc058.js.map → column-views.343b5aa2.js.map} +1 -1
  30. package/dist/esm/{prepare-units.6c890a96.js → column-views.34636ec7.js} +4 -4
  31. package/dist/esm/{prepare-units.6c890a96.js.map → column-views.34636ec7.js.map} +1 -1
  32. package/dist/esm/{age-model-overlay.module.cd985dcb.js → column-views.3465c8ad.js} +1 -1
  33. package/dist/esm/{age-model-overlay.module.cd985dcb.js.map → column-views.3465c8ad.js.map} +1 -1
  34. package/dist/esm/{utils.d7a43a2a.js → column-views.39657bbf.js} +1 -1
  35. package/dist/esm/{utils.d7a43a2a.js.map → column-views.39657bbf.js.map} +1 -1
  36. package/dist/esm/column-views.3b972a9b.css +4 -0
  37. package/dist/esm/{composite.module.69a38fd1.css.map → column-views.3b972a9b.css.map} +1 -1
  38. package/dist/esm/{mapbox.cac42eed.js → column-views.3bec70d6.js} +5 -5
  39. package/dist/esm/{mapbox.cac42eed.js.map → column-views.3bec70d6.js.map} +1 -1
  40. package/dist/esm/{inset-map.3c18106d.js → column-views.3de4dc43.js} +1 -1
  41. package/dist/esm/{inset-map.3c18106d.js.map → column-views.3de4dc43.js.map} +1 -1
  42. package/dist/esm/{column.a25f8ebd.js → column-views.3f4db8cb.js} +7 -7
  43. package/dist/esm/{column.a25f8ebd.js.map → column-views.3f4db8cb.js.map} +1 -1
  44. package/dist/esm/{core.91ede078.js → column-views.40c1f361.js} +4 -4
  45. package/dist/esm/{core.91ede078.js.map → column-views.40c1f361.js.map} +1 -1
  46. package/dist/esm/{composite.module.0638e7ee.js → column-views.40cd59b5.js} +1 -1
  47. package/dist/esm/{composite.module.0638e7ee.js.map → column-views.40cd59b5.js.map} +1 -1
  48. package/dist/esm/{column.module.1b776e15.js → column-views.4637f4ce.js} +1 -1
  49. package/dist/esm/{column.module.1b776e15.js.map → column-views.4637f4ce.js.map} +1 -1
  50. package/dist/esm/{composite.039e4798.js → column-views.4c4c5bac.js} +7 -7
  51. package/dist/esm/{composite.039e4798.js.map → column-views.4c4c5bac.js.map} +1 -1
  52. package/dist/esm/{boxes.module.4ebc7796.js → column-views.4d374a35.js} +1 -1
  53. package/dist/esm/{boxes.module.4ebc7796.js.map → column-views.4d374a35.js.map} +1 -1
  54. package/dist/esm/{prepare-data.d4284b4a.js → column-views.57c4ddf3.js} +2 -2
  55. package/dist/esm/{prepare-data.d4284b4a.js.map → column-views.57c4ddf3.js.map} +1 -1
  56. package/dist/esm/{panel.module.386166cc.js → column-views.58b82432.js} +1 -1
  57. package/dist/esm/{panel.module.386166cc.js.map → column-views.58b82432.js.map} +1 -1
  58. package/dist/esm/{data-provider.f10c6d0b.js → column-views.5b2635fd.js} +5 -5
  59. package/dist/esm/{data-provider.f10c6d0b.js.map → column-views.5b2635fd.js.map} +1 -1
  60. package/dist/esm/{boxes.8292cff2.js → column-views.5c02fee2.js} +9 -9
  61. package/dist/esm/{boxes.8292cff2.js.map → column-views.5c02fee2.js.map} +1 -1
  62. package/dist/esm/{fetch.99aec438.js → column-views.5cc09c1d.js} +1 -1
  63. package/dist/esm/{fetch.99aec438.js.map → column-views.5cc09c1d.js.map} +1 -1
  64. package/dist/esm/{names.a8f2b452.js → column-views.650bd9f5.js} +2 -2
  65. package/dist/esm/{names.a8f2b452.js.map → column-views.650bd9f5.js.map} +1 -1
  66. package/dist/esm/{svg.4b9a96c1.js → column-views.68409161.js} +2 -2
  67. package/dist/esm/{svg.4b9a96c1.js.map → column-views.68409161.js.map} +1 -1
  68. package/dist/esm/{main.module.c09154b1.js → column-views.6a954628.js} +1 -1
  69. package/dist/esm/{main.module.c09154b1.js.map → column-views.6a954628.js.map} +1 -1
  70. package/dist/esm/{boxes.module.2b5fb18e.css → column-views.6c670c13.css} +1 -1
  71. package/dist/esm/{boxes.module.2b5fb18e.css.map → column-views.6c670c13.css.map} +1 -1
  72. package/dist/esm/{column-nav.5414677c.js → column-views.6d6b73b4.js} +1 -1
  73. package/dist/esm/{column-nav.5414677c.js.map → column-views.6d6b73b4.js.map} +1 -1
  74. package/dist/esm/{composite-scale.577bf64a.js → column-views.86c4b36f.js} +2 -2
  75. package/dist/esm/{composite-scale.577bf64a.js.map → column-views.86c4b36f.js.map} +1 -1
  76. package/dist/esm/{unit-details.071cefed.js → column-views.88de2cee.js} +3 -3
  77. package/dist/esm/{unit-details.071cefed.js.map → column-views.88de2cee.js.map} +1 -1
  78. package/dist/esm/{resolvers.36013b49.js → column-views.8dd877af.js} +4 -2
  79. package/dist/esm/column-views.8dd877af.js.map +1 -0
  80. package/dist/esm/{selection.f5b0297e.js → column-views.8e51206e.js} +1 -1
  81. package/dist/esm/{selection.f5b0297e.js.map → column-views.8e51206e.js.map} +1 -1
  82. package/dist/esm/{column.module.7f47d25a.js → column-views.94b5cca1.js} +1 -1
  83. package/dist/esm/{column.module.7f47d25a.js.map → column-views.94b5cca1.js.map} +1 -1
  84. package/dist/esm/{state.178ef364.js → column-views.9804efda.js} +2 -2
  85. package/dist/esm/{state.178ef364.js.map → column-views.9804efda.js.map} +1 -1
  86. package/dist/esm/{age-model-overlay.c7226855.js → column-views.9bdd477a.js} +5 -5
  87. package/dist/esm/{age-model-overlay.c7226855.js.map → column-views.9bdd477a.js.map} +1 -1
  88. package/dist/esm/{age-axis.4a8cf5e6.js → column-views.9ced149e.js} +5 -5
  89. package/dist/esm/{age-axis.4a8cf5e6.js.map → column-views.9ced149e.js.map} +1 -1
  90. package/dist/esm/{column.module.cbb072df.css → column-views.a7be0a4a.css} +1 -1
  91. package/dist/esm/{column.module.cbb072df.css.map → column-views.a7be0a4a.css.map} +1 -1
  92. package/dist/esm/{column-correlation.c8dcfe98.js → column-views.a98214b2.js} +3 -3
  93. package/dist/esm/{column-correlation.c8dcfe98.js.map → column-views.a98214b2.js.map} +1 -1
  94. package/dist/esm/{main.2e0375a5.js → column-views.aa9fcdba.js} +12 -12
  95. package/dist/esm/{main.2e0375a5.js.map → column-views.aa9fcdba.js.map} +1 -1
  96. package/dist/esm/{isotopes-column.7cb5cc45.js → column-views.ac9fb5e1.js} +3 -3
  97. package/dist/esm/{isotopes-column.7cb5cc45.js.map → column-views.ac9fb5e1.js.map} +1 -1
  98. package/dist/esm/{maps.bcdea9c1.js → column-views.b2e5f1d9.js} +4 -4
  99. package/dist/esm/{maps.bcdea9c1.js.map → column-views.b2e5f1d9.js.map} +1 -1
  100. package/dist/esm/{keyboard-navigation.a9fc80dd.js → column-views.b775c0a3.js} +3 -3
  101. package/dist/esm/{keyboard-navigation.a9fc80dd.js.map → column-views.b775c0a3.js.map} +1 -1
  102. package/dist/esm/{hash-string.285b37fb.js → column-views.beb54e95.js} +1 -1
  103. package/dist/esm/{hash-string.285b37fb.js.map → column-views.beb54e95.js.map} +1 -1
  104. package/dist/esm/{core.843310d3.js → column-views.c58aad3f.js} +10 -10
  105. package/dist/esm/{core.843310d3.js.map → column-views.c58aad3f.js.map} +1 -1
  106. package/dist/esm/{carbon-isotopes.10db8285.js → column-views.d1ad48eb.js} +4 -4
  107. package/dist/esm/{carbon-isotopes.10db8285.js.map → column-views.d1ad48eb.js.map} +1 -1
  108. package/dist/esm/{keyboard-navigation.6713401b.js → column-views.dc42f5d0.js} +1 -1
  109. package/dist/esm/{keyboard-navigation.6713401b.js.map → column-views.dc42f5d0.js.map} +1 -1
  110. package/dist/esm/{age-axis.module.3cc91335.js → column-views.dff52504.js} +1 -1
  111. package/dist/esm/{age-axis.module.3cc91335.js.map → column-views.dff52504.js.map} +1 -1
  112. package/dist/esm/{age-axis.module.03773a80.css → column-views.e2b9c23c.css} +1 -1
  113. package/dist/esm/{age-axis.module.03773a80.css.map → column-views.e2b9c23c.css.map} +1 -1
  114. package/dist/esm/{age-model-overlay.module.5d9e78fb.css → column-views.e40b8bfb.css} +1 -1
  115. package/dist/esm/{age-model-overlay.module.5d9e78fb.css.map → column-views.e40b8bfb.css.map} +1 -1
  116. package/dist/esm/{layers.033d3fb0.js → column-views.e77b9d6b.js} +3 -3
  117. package/dist/esm/{layers.033d3fb0.js.map → column-views.e77b9d6b.js.map} +1 -1
  118. package/dist/esm/{store.c4d7a8a4.js → column-views.ea237aa8.js} +2 -2
  119. package/dist/esm/{store.c4d7a8a4.js.map → column-views.ea237aa8.js.map} +1 -1
  120. package/dist/esm/{popover.module.c4ba4189.js → column-views.edf77621.js} +1 -1
  121. package/dist/esm/{popover.module.c4ba4189.js.map → column-views.edf77621.js.map} +1 -1
  122. package/dist/esm/{column-navigation.37cd3245.js → column-views.f1efcc2c.js} +3 -3
  123. package/dist/esm/{column-navigation.37cd3245.js.map → column-views.f1efcc2c.js.map} +1 -1
  124. package/dist/esm/{popover.a810b7bc.js → column-views.f2e5a72f.js} +6 -6
  125. package/dist/esm/{popover.a810b7bc.js.map → column-views.f2e5a72f.js.map} +1 -1
  126. package/dist/esm/{column.01d68dd8.js → column-views.f71ec4b4.js} +11 -11
  127. package/dist/esm/{column.01d68dd8.js.map → column-views.f71ec4b4.js.map} +1 -1
  128. package/dist/esm/column-views.f9dab157.js +3 -0
  129. package/dist/esm/{types.0f0b57c9.js.map → column-views.f9dab157.js.map} +1 -1
  130. package/dist/esm/{section.a34d379a.js → column-views.fa6f3292.js} +8 -8
  131. package/dist/esm/{section.a34d379a.js.map → column-views.fa6f3292.js.map} +1 -1
  132. package/dist/esm/{_shared.f7eec55a.js → column-views.fc2b4611.js} +3 -3
  133. package/dist/esm/{_shared.f7eec55a.js.map → column-views.fc2b4611.js.map} +1 -1
  134. package/dist/esm/index.d.ts.map +1 -1
  135. package/dist/esm/index.js +11 -11
  136. package/dist/node/index.js +1 -1
  137. package/dist/node/index.js.map +1 -1
  138. package/package.json +9 -10
  139. package/src/units/resolvers.ts +1 -1
  140. package/dist/esm/composite.module.69a38fd1.css +0 -4
  141. package/dist/esm/resolvers.36013b49.js.map +0 -1
  142. package/dist/esm/types.0f0b57c9.js +0 -3
@@ -1 +1 @@
1
- {"mappings":";;;;;;;AAwCO,SAAS,0CACd,OAAqB,EACrB,QAAkC;IAElC,QAAQ,GAAG,CAAC;IACZ,MAAM,iBACJ,gBAAgB,CAAA,GAAA,yCAAgB,EAAE,WAAW,oBAC7C,gBAAgB,EAChB,GAAG,MACJ,GAAG;IAEJ,MAAM,OAA6B;QACjC,UAAU,CAAA,GAAA,qBAAa,EAAE,GAAG;0BAC5B;QACA,GAAG,IAAI;IACT;IAEA,IAAI,QAAQ,MAAM,IAAI,GACpB,OAAO;IAGT,2EAA2E;IAC3E,MAAM,SAAS,QAAQ,GAAG,CAAC,CAAC,IAAM,EAAE,KAAK,EAAE,IAAI;IAE/C,MAAM,YAAY,QAAQ,GAAG,CAAC,CAAC,IAAM,EAAE,QAAQ;IAE/C,MAAM,gBAAgB,CAAA,GAAA,yCAAiB,EAAE,QAAQ;IAEjD,MAAM,YAAE,QAAQ,eAAE,WAAW,EAAE,GAAG;IAElC,MAAM,YAA6C;QACjD,UAAU,CAAA,GAAA,qBAAa,EAAE,GAAG;qBAC5B;QACA,UAAU,SAAS,GAAG,CAAC,CAAC,IAAM,EAAE,SAAS;IAC3C;IAEA,MAAM,WAAW,SAAS,GAAG,CAAC,CAAC;QAC7B,OAAO,sCAAgB,GAAG;IAC5B;IAEA,OAAO;mBAAE;kBAAW;QAAU,UAAU,UAAU,MAAM;IAAC;AAC3D;AA4BO,SAAS,0CACd,GAA2B;IAE3B,MAAM,cAAE,UAAU,SAAE,KAAK,SAAE,KAAK,EAAE,GAAG;IACrC,+BAA+B;IAC/B,MAAM,YAA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;2BACR;6BACA;YACA,OAAO,KAAK,KAAK;YACjB,OAAO,KAAK,KAAK;YACjB,OAAO,EAAE;QACX;aAEA,WAAW,MAAM,GAAG;QAEtB,WAAW,KAAK,CAAC,IAAI,CAAC;IACxB;IACA,OAAO;AACT;AAEA,SAAS,sCACP,GAAsB,EACtB,SAAmB;IAEnB,+BAA+B,GAC/B,MAAM,SAAE,KAAK,SAAE,KAAK,SAAE,KAAK,EAAE,GAAG;IAEhC,OAAO;QACL,YAAY,UAAU,GAAG,CAAC,CAAC;YACzB,MAAM,KAAK,MAAM,MAAM,CAAC,CAAC,OAAS,KAAK,MAAM,IAAI;YACjD,GAAG,IAAI,CAAC,CAAC,GAAG,IAAM,EAAE,KAAK,GAAG,EAAE,KAAK;YACnC,OAAO;gBACL,UAAU;gBACV,+CAA+C;gBAC/C,OAAO,CAAA,GAAA,sBAAc,EACnB;oBACE,GAAG,GAAG;oBACN,OAAO;gBACT,GACA,CAAA,GAAA,qBAAa,EAAE,GAAG;YAEtB;QACF;QACA,gBAAgB,IAAI,SAAS,CAAC,UAAU;eACxC;eACA;IACF;AACF;AAEO,SAAS,0CACd,GAAwB;IAExB,OAAO;QACL,QAAQ,IAAI,UAAU,CAAC,MAAM;QAC7B,UAAU,IAAI,UAAU,CAAC,QAAQ;QACjC,YAAY,IAAI,UAAU,CAAC,UAAU;IACvC;AACF","sources":["packages/column-views/src/correlation-chart/prepare-data.ts"],"sourcesContent":["import { CompositeStratigraphicScaleInfo } from \"../age-axis\";\nimport { PackageLayoutData } from \"../prepare-units/composite-scale\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport { type ColumnGeoJSONRecord, UnitLong } from \"@macrostrat/api-types\";\nimport {\n MergeSectionsMode,\n PrepareColumnOptions,\n prepareColumnUnits,\n preprocessUnits,\n} from \"../prepare-units\";\nimport { mergeAgeRanges } from \"@macrostrat/stratigraphy-utils\";\n\nexport interface ColumnIdentifier {\n col_id: number;\n col_name: string;\n project_id: number;\n}\n\ninterface ColumnData {\n columnID: number;\n units: UnitLong[];\n}\n\nexport interface CorrelationChartSettings\n extends Omit<PrepareColumnOptions, \"axisType\"> {\n targetUnitHeight?: number;\n}\n\nexport interface CorrelationChartData {\n packages: MultiColumnPackageData[];\n scaleInfo: CompositeStratigraphicScaleInfo;\n nColumns: number;\n}\n\nexport interface ColumnIdentifier {\n col_id: number;\n col_name: string;\n project_id: number;\n}\n\nexport function buildCorrelationChartData(\n columns: ColumnData[],\n settings: CorrelationChartSettings\n): CorrelationChartData {\n console.log(settings);\n const {\n mergeSections = MergeSectionsMode.OVERLAPPING,\n targetUnitHeight,\n ...rest\n } = settings;\n\n const opts: PrepareColumnOptions = {\n axisType: ColumnAxisType.AGE,\n targetUnitHeight,\n ...rest,\n };\n\n if (columns.length == 0) {\n return null;\n }\n\n // Flatten the units array to pretend that all units are in the same column\n const _units = columns.map((d) => d.units).flat();\n\n const columnIDs = columns.map((d) => d.columnID);\n\n const preparedUnits = prepareColumnUnits(_units, opts);\n\n const { sections, totalHeight } = preparedUnits;\n\n const scaleInfo: CompositeStratigraphicScaleInfo = {\n axisType: ColumnAxisType.AGE,\n totalHeight,\n packages: sections.map((d) => d.scaleInfo),\n };\n\n const packages = sections.map((d) => {\n return separateColumns(d, columnIDs);\n });\n\n return { scaleInfo, packages, nColumns: columnIDs.length };\n}\n\ninterface UnitGroup {\n b_age: number;\n t_age: number;\n strat_name_id: number;\n strat_name_long: string;\n units: (UnitLong | null)[];\n}\n\nexport interface UnitGroupBox extends UnitGroup {\n units: UnitLong[];\n startCol: number;\n endCol: number;\n}\n\ninterface ColumnExt {\n columnID: number;\n units: UnitLong[];\n}\n\ninterface MultiColumnPackageData {\n columnData: ColumnExt[];\n bestPixelScale: number;\n b_age: number;\n t_age: number;\n}\n\nexport function findLaterallyExtensiveUnits(\n pkg: MultiColumnPackageData\n): UnitGroup[] {\n const { columnData, b_age, t_age } = pkg;\n // Group units by strat_name_id\n const unitIndex = new Map<number, Map<number, UnitLong>>();\n for (const column of columnData) {\n const { units } = column;\n for (const unit of units) {\n if (unit.strat_name_id == null) continue;\n if (!unitIndex.has(unit.strat_name_id)) {\n unitIndex.set(unit.strat_name_id, new Map());\n }\n unitIndex.get(unit.strat_name_id).set(column.columnID, unit);\n }\n }\n\n // Prepare grouped units for rendering\n const unitGroups: UnitGroup[] = [];\n for (const [strat_name_id, unitIndex0] of unitIndex) {\n const units = columnData.map((d) => unitIndex0.get(d.columnID) ?? null);\n const filteredUnits = units.filter((d) => d != null);\n const [t_age, b_age] = mergeAgeRanges(\n filteredUnits.map((d) => [d.t_age, d.b_age])\n );\n if (filteredUnits.length <= 1) continue;\n\n unitGroups.push({\n b_age,\n t_age,\n strat_name_id,\n strat_name_long: filteredUnits[0].strat_name_long,\n units,\n });\n }\n\n return unitGroups;\n}\n\nexport function splitStratIntoBoxes(pkg: UnitGroup): UnitGroupBox[] {\n const { strat_name_long, strat_name_id, units } = pkg;\n const boxes: UnitGroupBox[] = [];\n let currentBox: UnitGroupBox = null;\n for (let i = 0; i < units.length; i++) {\n const unit = units[i];\n if (unit == null) {\n if (currentBox != null) {\n boxes.push(currentBox);\n currentBox = null;\n }\n continue;\n }\n if (currentBox == null) {\n currentBox = {\n startCol: i,\n endCol: i,\n strat_name_id,\n strat_name_long,\n t_age: unit.t_age,\n b_age: unit.b_age,\n units: [],\n };\n } else {\n currentBox.endCol = i;\n }\n currentBox.units.push(unit);\n }\n return boxes;\n}\n\nfunction separateColumns(\n pkg: PackageLayoutData,\n columnIDs: number[]\n): MultiColumnPackageData {\n /** Separate columns by col_id */\n const { units, t_age, b_age } = pkg;\n\n return {\n columnData: columnIDs.map((d) => {\n const u1 = units.filter((unit) => unit.col_id == d);\n u1.sort((a, b) => a.t_age - b.t_age);\n return {\n columnID: d,\n // Ensure that the units correctly show overlap\n units: preprocessUnits(\n {\n ...pkg,\n units: u1,\n },\n ColumnAxisType.AGE\n ),\n };\n }),\n bestPixelScale: pkg.scaleInfo.pixelScale,\n t_age,\n b_age,\n };\n}\n\nexport function columnGeoJSONRecordToColumnIdentifier(\n col: ColumnGeoJSONRecord\n): ColumnIdentifier {\n return {\n col_id: col.properties.col_id,\n col_name: col.properties.col_name,\n project_id: col.properties.project_id,\n };\n}\n"],"names":[],"version":3,"file":"prepare-data.d4284b4a.js.map"}
1
+ {"mappings":";;;;;;;AAwCO,SAAS,0CACd,OAAqB,EACrB,QAAkC;IAElC,QAAQ,GAAG,CAAC;IACZ,MAAM,iBACJ,gBAAgB,CAAA,GAAA,yCAAgB,EAAE,WAAW,oBAC7C,gBAAgB,EAChB,GAAG,MACJ,GAAG;IAEJ,MAAM,OAA6B;QACjC,UAAU,CAAA,GAAA,qBAAa,EAAE,GAAG;0BAC5B;QACA,GAAG,IAAI;IACT;IAEA,IAAI,QAAQ,MAAM,IAAI,GACpB,OAAO;IAGT,2EAA2E;IAC3E,MAAM,SAAS,QAAQ,GAAG,CAAC,CAAC,IAAM,EAAE,KAAK,EAAE,IAAI;IAE/C,MAAM,YAAY,QAAQ,GAAG,CAAC,CAAC,IAAM,EAAE,QAAQ;IAE/C,MAAM,gBAAgB,CAAA,GAAA,yCAAiB,EAAE,QAAQ;IAEjD,MAAM,YAAE,QAAQ,eAAE,WAAW,EAAE,GAAG;IAElC,MAAM,YAA6C;QACjD,UAAU,CAAA,GAAA,qBAAa,EAAE,GAAG;qBAC5B;QACA,UAAU,SAAS,GAAG,CAAC,CAAC,IAAM,EAAE,SAAS;IAC3C;IAEA,MAAM,WAAW,SAAS,GAAG,CAAC,CAAC;QAC7B,OAAO,sCAAgB,GAAG;IAC5B;IAEA,OAAO;mBAAE;kBAAW;QAAU,UAAU,UAAU,MAAM;IAAC;AAC3D;AA4BO,SAAS,0CACd,GAA2B;IAE3B,MAAM,cAAE,UAAU,SAAE,KAAK,SAAE,KAAK,EAAE,GAAG;IACrC,+BAA+B;IAC/B,MAAM,YAAY,IAAI;IACtB,KAAK,MAAM,UAAU,WAAY;QAC/B,MAAM,SAAE,KAAK,EA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OAAO,EAAE;QACX;aAEA,WAAW,MAAM,GAAG;QAEtB,WAAW,KAAK,CAAC,IAAI,CAAC;IACxB;IACA,OAAO;AACT;AAEA,SAAS,sCACP,GAAsB,EACtB,SAAmB;IAEnB,+BAA+B,GAC/B,MAAM,SAAE,KAAK,SAAE,KAAK,SAAE,KAAK,EAAE,GAAG;IAEhC,OAAO;QACL,YAAY,UAAU,GAAG,CAAC,CAAC;YACzB,MAAM,KAAK,MAAM,MAAM,CAAC,CAAC,OAAS,KAAK,MAAM,IAAI;YACjD,GAAG,IAAI,CAAC,CAAC,GAAG,IAAM,EAAE,KAAK,GAAG,EAAE,KAAK;YACnC,OAAO;gBACL,UAAU;gBACV,+CAA+C;gBAC/C,OAAO,CAAA,GAAA,sBAAc,EACnB;oBACE,GAAG,GAAG;oBACN,OAAO;gBACT,GACA,CAAA,GAAA,qBAAa,EAAE,GAAG;YAEtB;QACF;QACA,gBAAgB,IAAI,SAAS,CAAC,UAAU;eACxC;eACA;IACF;AACF;AAEO,SAAS,0CACd,GAAwB;IAExB,OAAO;QACL,QAAQ,IAAI,UAAU,CAAC,MAAM;QAC7B,UAAU,IAAI,UAAU,CAAC,QAAQ;QACjC,YAAY,IAAI,UAAU,CAAC,UAAU;IACvC;AACF","sources":["packages/column-views/src/correlation-chart/prepare-data.ts"],"sourcesContent":["import { CompositeStratigraphicScaleInfo } from \"../age-axis\";\nimport { PackageLayoutData } from \"../prepare-units/composite-scale\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport { type ColumnGeoJSONRecord, UnitLong } from \"@macrostrat/api-types\";\nimport {\n MergeSectionsMode,\n PrepareColumnOptions,\n prepareColumnUnits,\n preprocessUnits,\n} from \"../prepare-units\";\nimport { mergeAgeRanges } from \"@macrostrat/stratigraphy-utils\";\n\nexport interface ColumnIdentifier {\n col_id: number;\n col_name: string;\n project_id: number;\n}\n\ninterface ColumnData {\n columnID: number;\n units: UnitLong[];\n}\n\nexport interface CorrelationChartSettings\n extends Omit<PrepareColumnOptions, \"axisType\"> {\n targetUnitHeight?: number;\n}\n\nexport interface CorrelationChartData {\n packages: MultiColumnPackageData[];\n scaleInfo: CompositeStratigraphicScaleInfo;\n nColumns: number;\n}\n\nexport interface ColumnIdentifier {\n col_id: number;\n col_name: string;\n project_id: number;\n}\n\nexport function buildCorrelationChartData(\n columns: ColumnData[],\n settings: CorrelationChartSettings\n): CorrelationChartData {\n console.log(settings);\n const {\n mergeSections = MergeSectionsMode.OVERLAPPING,\n targetUnitHeight,\n ...rest\n } = settings;\n\n const opts: PrepareColumnOptions = {\n axisType: ColumnAxisType.AGE,\n targetUnitHeight,\n ...rest,\n };\n\n if (columns.length == 0) {\n return null;\n }\n\n // Flatten the units array to pretend that all units are in the same column\n const _units = columns.map((d) => d.units).flat();\n\n const columnIDs = columns.map((d) => d.columnID);\n\n const preparedUnits = prepareColumnUnits(_units, opts);\n\n const { sections, totalHeight } = preparedUnits;\n\n const scaleInfo: CompositeStratigraphicScaleInfo = {\n axisType: ColumnAxisType.AGE,\n totalHeight,\n packages: sections.map((d) => d.scaleInfo),\n };\n\n const packages = sections.map((d) => {\n return separateColumns(d, columnIDs);\n });\n\n return { scaleInfo, packages, nColumns: columnIDs.length };\n}\n\ninterface UnitGroup {\n b_age: number;\n t_age: number;\n strat_name_id: number;\n strat_name_long: string;\n units: (UnitLong | null)[];\n}\n\nexport interface UnitGroupBox extends UnitGroup {\n units: UnitLong[];\n startCol: number;\n endCol: number;\n}\n\ninterface ColumnExt {\n columnID: number;\n units: UnitLong[];\n}\n\ninterface MultiColumnPackageData {\n columnData: ColumnExt[];\n bestPixelScale: number;\n b_age: number;\n t_age: number;\n}\n\nexport function findLaterallyExtensiveUnits(\n pkg: MultiColumnPackageData\n): UnitGroup[] {\n const { columnData, b_age, t_age } = pkg;\n // Group units by strat_name_id\n const unitIndex = new Map<number, Map<number, UnitLong>>();\n for (const column of columnData) {\n const { units } = column;\n for (const unit of units) {\n if (unit.strat_name_id == null) continue;\n if (!unitIndex.has(unit.strat_name_id)) {\n unitIndex.set(unit.strat_name_id, new Map());\n }\n unitIndex.get(unit.strat_name_id).set(column.columnID, unit);\n }\n }\n\n // Prepare grouped units for rendering\n const unitGroups: UnitGroup[] = [];\n for (const [strat_name_id, unitIndex0] of unitIndex) {\n const units = columnData.map((d) => unitIndex0.get(d.columnID) ?? null);\n const filteredUnits = units.filter((d) => d != null);\n const [t_age, b_age] = mergeAgeRanges(\n filteredUnits.map((d) => [d.t_age, d.b_age])\n );\n if (filteredUnits.length <= 1) continue;\n\n unitGroups.push({\n b_age,\n t_age,\n strat_name_id,\n strat_name_long: filteredUnits[0].strat_name_long,\n units,\n });\n }\n\n return unitGroups;\n}\n\nexport function splitStratIntoBoxes(pkg: UnitGroup): UnitGroupBox[] {\n const { strat_name_long, strat_name_id, units } = pkg;\n const boxes: UnitGroupBox[] = [];\n let currentBox: UnitGroupBox = null;\n for (let i = 0; i < units.length; i++) {\n const unit = units[i];\n if (unit == null) {\n if (currentBox != null) {\n boxes.push(currentBox);\n currentBox = null;\n }\n continue;\n }\n if (currentBox == null) {\n currentBox = {\n startCol: i,\n endCol: i,\n strat_name_id,\n strat_name_long,\n t_age: unit.t_age,\n b_age: unit.b_age,\n units: [],\n };\n } else {\n currentBox.endCol = i;\n }\n currentBox.units.push(unit);\n }\n return boxes;\n}\n\nfunction separateColumns(\n pkg: PackageLayoutData,\n columnIDs: number[]\n): MultiColumnPackageData {\n /** Separate columns by col_id */\n const { units, t_age, b_age } = pkg;\n\n return {\n columnData: columnIDs.map((d) => {\n const u1 = units.filter((unit) => unit.col_id == d);\n u1.sort((a, b) => a.t_age - b.t_age);\n return {\n columnID: d,\n // Ensure that the units correctly show overlap\n units: preprocessUnits(\n {\n ...pkg,\n units: u1,\n },\n ColumnAxisType.AGE\n ),\n };\n }),\n bestPixelScale: pkg.scaleInfo.pixelScale,\n t_age,\n b_age,\n };\n}\n\nexport function columnGeoJSONRecordToColumnIdentifier(\n col: ColumnGeoJSONRecord\n): ColumnIdentifier {\n return {\n col_id: col.properties.col_id,\n col_name: col.properties.col_name,\n project_id: col.properties.project_id,\n };\n}\n"],"names":[],"version":3,"file":"column-views.57c4ddf3.js.map"}
@@ -55,4 +55,4 @@ $99635b65dd697f61$export$e22f189945dfce76 = `XUD4UG_unit-id`;
55
55
 
56
56
 
57
57
  export {$99635b65dd697f61$exports as default};
58
- //# sourceMappingURL=panel.module.386166cc.js.map
58
+ //# sourceMappingURL=column-views.58b82432.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAfA,4CAAiC,CAAC,mBAAmB,CAAC;AACtD,4CAAqC,CAAC,uBAAuB,CAAC;AAC9D,4CAAmC,CAAC,qBAAqB,CAAC;AAC1D,4CAAyC,CAAC,2BAA2B,CAAC;AACtE,4CAAwC,CAAC,0BAA0B,CAAC;AACpE,4CAA6B,CAAC,eAAe,CAAC;AAC9C,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAyB,CAAC,WAAW,CAAC;AACtC,4CAAwB,CAAC,UAAU,CAAC;AACpC,4CAA2B,CAAC,aAAa,CAAC;AAC1C,4CAAkC,CAAC,oBAAoB,CAAC;AACxD,4CAAoC,CAAC,sBAAsB,CAAC;AAC5D,4CAAyC,CAAC,2BAA2B,CAAC;AACtE,4CAAgD,CAAC,kCAAkC,CAAC;AACpF,4CAAuC,CAAC,yBAAyB,CAAC;AAClE,4CAA4B,CAAC,cAAc,CAAC","sources":["packages/column-views/src/unit-details/panel.module.sass"],"sourcesContent":[".legend-panel-header\n display: flex\n justify-content: space-between\n align-items: baseline\n gap: 1em\n border-bottom: 1px solid var(--panel-rule-color)\n position: sticky\n top: 0\n background-color: var(--panel-secondary-background-color)\n padding: 0.5em 1em\n z-index: 50\n .title-container\n display: flex\n flex-direction: row\n gap: 0.5em\n align-items: center\n margin: -0.5em 0\n &:hover\n .hidden-actions\n display: flex\n opacity: 0.5\n h1, h2, h3\n margin: 0.5em 0\n .hidden-actions\n display: none\n button\n transform: translateY(0px)\n\n code\n font-size: 0.9em\n color: var(--secondary-color)\n .spacer\n flex: 1\n button\n line-height: 1.5\n transform: translateY(2px)\n\n.unit-details-panel\n display: flex\n flex-direction: column\n .unit-details-content-holder\n flex: 1\n overflow-y: scroll\n\n.unit-details-content\n position: relative\n margin: 1em\n\n.proportion, .sep, .no-units\n color: var(--secondary-color)\n font-style: italic\n\n.strat-name-id, .unit-id\n font-family: var(--monospace-font)\n color: var(--secondary-color)\n\n &::before\n content: '#'\n color: var(--tertiary-color)\n\n.color-swatch\n width: 1em\n height: 1em\n border-radius: 0.2em\n margin-right: 0.2em\n border: 1px solid var(--panel-rule-color)\n display: inline-block\n\n.refs\n list-style: none\n margin: 0\n padding-left: 0\n\n.interval-proportions\n flex-grow: 1\n width: 100%\n text-align: right\n .discourage-break\n white-space: nowrap\n .sep\n margin: 0 0.3em\n\n"],"names":[],"version":3,"file":"panel.module.386166cc.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAfA,4CAAiC,CAAC,mBAAmB,CAAC;AACtD,4CAAqC,CAAC,uBAAuB,CAAC;AAC9D,4CAAmC,CAAC,qBAAqB,CAAC;AAC1D,4CAAyC,CAAC,2BAA2B,CAAC;AACtE,4CAAwC,CAAC,0BAA0B,CAAC;AACpE,4CAA6B,CAAC,eAAe,CAAC;AAC9C,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAyB,CAAC,WAAW,CAAC;AACtC,4CAAwB,CAAC,UAAU,CAAC;AACpC,4CAA2B,CAAC,aAAa,CAAC;AAC1C,4CAAkC,CAAC,oBAAoB,CAAC;AACxD,4CAAoC,CAAC,sBAAsB,CAAC;AAC5D,4CAAyC,CAAC,2BAA2B,CAAC;AACtE,4CAAgD,CAAC,kCAAkC,CAAC;AACpF,4CAAuC,CAAC,yBAAyB,CAAC;AAClE,4CAA4B,CAAC,cAAc,CAAC","sources":["packages/column-views/src/unit-details/panel.module.sass"],"sourcesContent":[".legend-panel-header\n display: flex\n justify-content: space-between\n align-items: baseline\n gap: 1em\n border-bottom: 1px solid var(--panel-rule-color)\n position: sticky\n top: 0\n background-color: var(--panel-secondary-background-color)\n padding: 0.5em 1em\n z-index: 50\n .title-container\n display: flex\n flex-direction: row\n gap: 0.5em\n align-items: center\n margin: -0.5em 0\n &:hover\n .hidden-actions\n display: flex\n opacity: 0.5\n h1, h2, h3\n margin: 0.5em 0\n .hidden-actions\n display: none\n button\n transform: translateY(0px)\n\n code\n font-size: 0.9em\n color: var(--secondary-color)\n .spacer\n flex: 1\n button\n line-height: 1.5\n transform: translateY(2px)\n\n.unit-details-panel\n display: flex\n flex-direction: column\n .unit-details-content-holder\n flex: 1\n overflow-y: scroll\n\n.unit-details-content\n position: relative\n margin: 1em\n\n.proportion, .sep, .no-units\n color: var(--secondary-color)\n font-style: italic\n\n.strat-name-id, .unit-id\n font-family: var(--monospace-font)\n color: var(--secondary-color)\n\n &::before\n content: '#'\n color: var(--tertiary-color)\n\n.color-swatch\n width: 1em\n height: 1em\n border-radius: 0.2em\n margin-right: 0.2em\n border: 1px solid var(--panel-rule-color)\n display: inline-block\n\n.refs\n list-style: none\n margin: 0\n padding-left: 0\n\n.interval-proportions\n flex-grow: 1\n width: 100%\n text-align: right\n .discourage-break\n white-space: nowrap\n .sep\n margin: 0 0.3em\n\n"],"names":[],"version":3,"file":"column-views.58b82432.js.map"}
@@ -1,7 +1,7 @@
1
- import {fetchAllColumns as $33a46f9423c8104a$export$45bd78cd093090fa, useColumnFeatures as $33a46f9423c8104a$export$e3270a4e30e40ff9, fetchLithologies as $33a46f9423c8104a$export$1aa679bd5e605f82, fetchIntervals as $33a46f9423c8104a$export$5d2ec2e733dfe6c7, fetchEnvironments as $33a46f9423c8104a$export$780b4b253712916c, fetchRefs as $33a46f9423c8104a$export$cd7bfa0860f58b96, fetchUnits as $33a46f9423c8104a$export$b97b9bdd6a521298, fetchColumnUnits as $33a46f9423c8104a$export$d3d8b0fabcc76c5d} from "./fetch.99aec438.js";
2
- import {useMacrostratStore as $774a5efa27d1c77b$export$fb98d5bae3a6800, useMacrostratDefs as $774a5efa27d1c77b$export$89dd4e5ae4a82373, useMacrostratColumns as $774a5efa27d1c77b$export$81eaae0b474404fd, useMacrostratData as $774a5efa27d1c77b$export$b9c9fc603d74a555, MacrostratDataProvider as $774a5efa27d1c77b$export$690613f93cdc5576, MacrostratAPIProvider as $774a5efa27d1c77b$export$3098013bc6cc316d, MacrostratColumnProvider as $774a5efa27d1c77b$export$9e42f9b6e0d67c7d, LithologiesProvider as $774a5efa27d1c77b$export$8492a5cae82b6a70, useLithologies as $774a5efa27d1c77b$export$4d18a90c945d129f} from "./base.910b80b4.js";
3
- import {useColumnNav as $b8de97dfa82f4910$export$91cb5ac808759b34, ColumnNavProvider as $b8de97dfa82f4910$export$36fed9e0f93a8fde} from "./column-nav.5414677c.js";
4
- import {MacrostratColumnDataProvider as $d5074f164411387e$export$7fec7bd80ff9c10e, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d, useMacrostratUnits as $d5074f164411387e$export$6fb40844db555b2, useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76} from "./store.c4d7a8a4.js";
1
+ import {fetchAllColumns as $33a46f9423c8104a$export$45bd78cd093090fa, useColumnFeatures as $33a46f9423c8104a$export$e3270a4e30e40ff9, fetchLithologies as $33a46f9423c8104a$export$1aa679bd5e605f82, fetchIntervals as $33a46f9423c8104a$export$5d2ec2e733dfe6c7, fetchEnvironments as $33a46f9423c8104a$export$780b4b253712916c, fetchRefs as $33a46f9423c8104a$export$cd7bfa0860f58b96, fetchUnits as $33a46f9423c8104a$export$b97b9bdd6a521298, fetchColumnUnits as $33a46f9423c8104a$export$d3d8b0fabcc76c5d} from "./column-views.5cc09c1d.js";
2
+ import {useMacrostratStore as $774a5efa27d1c77b$export$fb98d5bae3a6800, useMacrostratDefs as $774a5efa27d1c77b$export$89dd4e5ae4a82373, useMacrostratColumns as $774a5efa27d1c77b$export$81eaae0b474404fd, useMacrostratData as $774a5efa27d1c77b$export$b9c9fc603d74a555, MacrostratDataProvider as $774a5efa27d1c77b$export$690613f93cdc5576, MacrostratAPIProvider as $774a5efa27d1c77b$export$3098013bc6cc316d, MacrostratColumnProvider as $774a5efa27d1c77b$export$9e42f9b6e0d67c7d, LithologiesProvider as $774a5efa27d1c77b$export$8492a5cae82b6a70, useLithologies as $774a5efa27d1c77b$export$4d18a90c945d129f} from "./column-views.28ee5f43.js";
3
+ import {useColumnNav as $b8de97dfa82f4910$export$91cb5ac808759b34, ColumnNavProvider as $b8de97dfa82f4910$export$36fed9e0f93a8fde} from "./column-views.6d6b73b4.js";
4
+ import {MacrostratColumnDataProvider as $d5074f164411387e$export$7fec7bd80ff9c10e, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d, useMacrostratUnits as $d5074f164411387e$export$6fb40844db555b2, useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76} from "./column-views.ea237aa8.js";
5
5
 
6
6
 
7
7
 
@@ -10,4 +10,4 @@ import {MacrostratColumnDataProvider as $d5074f164411387e$export$7fec7bd80ff9c10
10
10
 
11
11
 
12
12
  export {$33a46f9423c8104a$export$45bd78cd093090fa as fetchAllColumns, $33a46f9423c8104a$export$e3270a4e30e40ff9 as useColumnFeatures, $33a46f9423c8104a$export$1aa679bd5e605f82 as fetchLithologies, $33a46f9423c8104a$export$5d2ec2e733dfe6c7 as fetchIntervals, $33a46f9423c8104a$export$780b4b253712916c as fetchEnvironments, $33a46f9423c8104a$export$cd7bfa0860f58b96 as fetchRefs, $33a46f9423c8104a$export$b97b9bdd6a521298 as fetchUnits, $33a46f9423c8104a$export$d3d8b0fabcc76c5d as fetchColumnUnits, $774a5efa27d1c77b$export$fb98d5bae3a6800 as useMacrostratStore, $774a5efa27d1c77b$export$89dd4e5ae4a82373 as useMacrostratDefs, $774a5efa27d1c77b$export$81eaae0b474404fd as useMacrostratColumns, $774a5efa27d1c77b$export$b9c9fc603d74a555 as useMacrostratData, $774a5efa27d1c77b$export$690613f93cdc5576 as MacrostratDataProvider, $774a5efa27d1c77b$export$3098013bc6cc316d as MacrostratAPIProvider, $774a5efa27d1c77b$export$9e42f9b6e0d67c7d as MacrostratColumnProvider, $774a5efa27d1c77b$export$8492a5cae82b6a70 as LithologiesProvider, $774a5efa27d1c77b$export$4d18a90c945d129f as useLithologies, $b8de97dfa82f4910$export$91cb5ac808759b34 as useColumnNav, $b8de97dfa82f4910$export$36fed9e0f93a8fde as ColumnNavProvider, $d5074f164411387e$export$7fec7bd80ff9c10e as MacrostratColumnDataProvider, $d5074f164411387e$export$f8509b7cce386c7d as useMacrostratColumnData, $d5074f164411387e$export$6fb40844db555b2 as useMacrostratUnits, $d5074f164411387e$export$a7fc62995ec4f76 as useCompositeScale};
13
- //# sourceMappingURL=data-provider.f10c6d0b.js.map
13
+ //# sourceMappingURL=column-views.5b2635fd.js.map
@@ -1 +1 @@
1
- {"mappings":"","sources":["packages/column-views/src/data-provider/index.ts"],"sourcesContent":["export * from \"./fetch\";\nexport * from \"./base\";\nexport * from \"./column-nav\";\nexport * from \"./store\";\n"],"names":[],"version":3,"file":"data-provider.f10c6d0b.js.map"}
1
+ {"mappings":"","sources":["packages/column-views/src/data-provider/index.ts"],"sourcesContent":["export * from \"./fetch\";\nexport * from \"./base\";\nexport * from \"./column-nav\";\nexport * from \"./store\";\n"],"names":[],"version":3,"file":"column-views.5b2635fd.js.map"}
@@ -1,10 +1,10 @@
1
- import {resolveID as $d3e69bd163d41f63$export$7be7d732f3de9464, scalePattern as $d3e69bd163d41f63$export$e8deec7b02ce51eb} from "./resolvers.36013b49.js";
2
- import {useUnitSelectionTarget as $4d5d1c15f39f6a14$export$cbbec12b1451fe7d} from "./selection.f5b0297e.js";
3
- import "./boxes.module.2b5fb18e.css";
4
- import $lClM8$boxesmodule4ebc7796js from "./boxes.module.4ebc7796.js";
5
- import {getUnitHeightRange as $b6657fba8924a702$export$70e712e2ac0237a} from "./utils.d7a43a2a.js";
6
- import {useLithologies as $774a5efa27d1c77b$export$4d18a90c945d129f} from "./base.910b80b4.js";
7
- import {getMixedUnitColor as $6698edd2a743bf07$export$175d3e927f1a9860} from "./colors.395c6db5.js";
1
+ import {resolveID as $d3e69bd163d41f63$export$7be7d732f3de9464, scalePattern as $d3e69bd163d41f63$export$e8deec7b02ce51eb} from "./column-views.8dd877af.js";
2
+ import {useUnitSelectionTarget as $4d5d1c15f39f6a14$export$cbbec12b1451fe7d} from "./column-views.8e51206e.js";
3
+ import "./column-views.6c670c13.css";
4
+ import $lClM8$columnviews4d374a35js from "./column-views.4d374a35.js";
5
+ import {getUnitHeightRange as $b6657fba8924a702$export$70e712e2ac0237a} from "./column-views.39657bbf.js";
6
+ import {useLithologies as $774a5efa27d1c77b$export$4d18a90c945d129f} from "./column-views.28ee5f43.js";
7
+ import {getMixedUnitColor as $6698edd2a743bf07$export$175d3e927f1a9860} from "./column-views.1edc7300.js";
8
8
  import {ColumnAxisType as $lClM8$ColumnAxisType, ColumnContext as $lClM8$ColumnContext, ColumnLayoutContext as $lClM8$ColumnLayoutContext, useColumn as $lClM8$useColumn, useGeologicPattern as $lClM8$useGeologicPattern, ForeignObject as $lClM8$ForeignObject, PatternDefsProvider as $lClM8$PatternDefsProvider} from "@macrostrat/column-components";
9
9
  import {SizeAwareLabel as $lClM8$SizeAwareLabel} from "@macrostrat/ui-components";
10
10
  import $lClM8$macrostrathyper from "@macrostrat/hyper";
@@ -28,7 +28,7 @@ function $parcel$interopDefault(a) {
28
28
 
29
29
 
30
30
 
31
- const $d254716a820e9c85$var$h = (0, $lClM8$macrostrathyper).styled((0, ($parcel$interopDefault($lClM8$boxesmodule4ebc7796js))));
31
+ const $d254716a820e9c85$var$h = (0, $lClM8$macrostrathyper).styled((0, ($parcel$interopDefault($lClM8$columnviews4d374a35js))));
32
32
  function $d254716a820e9c85$var$useUnitRect(division, options = {}) {
33
33
  const { widthFraction: widthFraction = 1, axisType: axisType = (0, $lClM8$ColumnAxisType).AGE, padding: padding = 0 } = options;
34
34
  const { scale: scale } = (0, $lClM8$useContext)((0, $lClM8$ColumnContext));
@@ -255,4 +255,4 @@ function $d254716a820e9c85$export$5d1cdfabe8dc8085(props) {
255
255
 
256
256
 
257
257
  export {$d254716a820e9c85$export$d54fdbabca27e53 as MinimalUnit, $d254716a820e9c85$export$1d8b9ae22d404866 as Unit, $d254716a820e9c85$export$b4f0ca233b98f9af as LabeledUnit, $d254716a820e9c85$export$5d1cdfabe8dc8085 as UnitBoxes};
258
- //# sourceMappingURL=boxes.8292cff2.js.map
258
+ //# sourceMappingURL=column-views.5c02fee2.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,uEAAK;AAkC5B,SAAS,kCACP,QAAe,EACf,UAA2B,CAAC,CAAC;IAE7B,MAAM,iBACJ,gBAAgB,aAChB,WAAW,CAAA,GAAA,qBAAa,EAAE,GAAG,WAC7B,UAAU,GACX,GAAG;IACJ,MAAM,SAAE,KAAK,EAAE,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,oBAAY;IACzC,MAAM,SAAE,KAAK,EAAE,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0BAAkB;IAE/C,MAAM,CAAC,cAAc,UAAU,GAAG,CAAA,GAAA,wCAAiB,EAAE,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AAQ;IAC7B,MAAM,SAAS;QACb,GAAG,kCAAY,UAAU;2BAAE;sBAAe;QAAS,EAAE;QACrD,GAAG,UAAU;IACf;IACA,MAAM,SAAE,KAAK,UAAE,MAAM,EAAE,GAAG;IAC1B,OAAO,wBACL,2CACA;QAAE,WAAW;kBAAgB;yBAAU;QAAiB,GAAG,MAAM;IAAC,GAClE;QACE,wBAAE,EAAE,CAAC,WACH,CAAA,GAAA,oBAAY,GACZ;YAAE,GAAG,MAAM;YAAE,WAAW;QAAuB,GAC/C,wBAAE,CAAA,GAAA,qBAAa,GAAG;YAChB,WAAW;YACX,gBAAgB;YAChB,OAAO;uBAAE;wBAAO;YAAO;mBACvB;YACA,qBAAoB,GAAG;gBACrB,eAAe,OAAO;YACxB;QACF;KAEH;AAEL;AAEA,SAAS,0CAAa,KASrB;IACC,MAAM,iBAAE,gBAAgB,+DAAM,qBAAqB,CAAC,GAAG,GAAG;IAC1D,MAAM,aAAE,SAAS,EAAE,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,oBAAY;IAE7C,IAAI,UAAU,MAAM,IAAI,GAAG;QACzB,QAAQ,IAAI,CAAC;QACb,OAAO;IACT;IAEA,MAAM,WAAW,CAAA,GAAA,cAAM,EAAE;QACvB,OAAO,UAAU,GAAG,CAAC,CAAC,UAAe;YACnC,aAAa;YACb,OAAO,wBAAE,eAAe;0BACtB;gBACA,KAAK,SAAS,OAAO;gBACrB,GAAG,kBAAkB;YACvB;QACF;IACF,GAAG;QAAC;QAAW;QAAe;KAAmB;IAEjD,OAAO,wBACL,CAAA,GAAA,0BAAkB,GAClB;mBAAE;sBAAW;IAAa,GAC1B,wBAAE,eAAe;AAErB","sources":["packages/column-views/src/units/boxes.ts"],"sourcesContent":["import {\n ColumnAxisType,\n ColumnContext,\n ColumnLayoutContext,\n ForeignObject,\n PatternDefsProvider,\n useColumn,\n useGeologicPattern,\n} from \"@macrostrat/column-components\";\nimport { SizeAwareLabel, Clickable } from \"@macrostrat/ui-components\";\nimport hyper from \"@macrostrat/hyper\";\nimport { forwardRef, ReactNode, useContext, useMemo } from \"react\";\nimport { resolveID, scalePattern } from \"./resolvers\";\nimport { useUnitSelectionTarget } from \"./selection\";\nimport { IUnit } from \"./types\";\nimport styles from \"./boxes.module.sass\";\nimport classNames from \"classnames\";\nimport { getUnitHeightRange } from \"../prepare-units/utils\";\nimport { useLithologies } from \"../data-provider\";\nimport { getMixedUnitColor } from \"./colors\";\nimport { path } from \"d3-path\";\nimport type { RectBounds } from \"./types\";\n\nconst h = hyper.styled(styles);\n\ninterface UnitRectOptions {\n widthFraction?: number;\n axisType?: ColumnAxisType;\n // Padding to create overflow for zig-zags or other ornamented edges\n padding?: number;\n}\n\ninterface UnitProps extends Clickable, Partial<RectBounds>, UnitRectOptions {\n division: IUnit;\n resolveID?(IUnit): string;\n UUID?: string;\n defaultFill?: string;\n widthFraction?: number;\n children?: ReactNode;\n className?: string;\n fill?: string;\n backgroundColor?: string;\n patternColor?: string;\n}\n\nexport interface LabeledUnitProps\n extends UnitRectOptions,\n Clickable,\n Partial<RectBounds> {\n division: IUnit;\n label: string;\n onLabelUpdated?(label: string, shown: boolean);\n halfWidth?: boolean;\n showLabel?: boolean;\n backgroundColor?: string;\n}\n\nfunction useUnitRect(\n division: IUnit,\n options: UnitRectOptions = {}\n): RectBounds {\n const {\n widthFraction = 1,\n axisType = ColumnAxisType.AGE,\n padding = 0,\n } = options;\n const { scale } = useContext(ColumnContext);\n const { width } = useContext(ColumnLayoutContext);\n\n const [bottomHeight, topHeight] = getUnitHeightRange(division, axisType);\n\n const y = scale(topHeight);\n const height = Math.abs(scale(bottomHeight) - y);\n\n return {\n x: width * (1 - widthFraction) - padding,\n y: y - padding,\n height: height + padding * 2,\n width: widthFraction * width + padding * 2,\n };\n}\n\nexport function MinimalUnit(props) {\n const {\n division: d,\n children,\n className,\n widthFraction = 1,\n axisType: _, // not sure why this is brought in...\n nColumns: __,\n ...baseBounds\n } = props;\n\n const { axisType } = useColumn();\n const lithMap = useLithologies();\n const bounds = {\n ...useUnitRect(d, { widthFraction, axisType }),\n ...baseBounds,\n };\n\n const backgroundColor = getMixedUnitColor(d, lithMap, null, false);\n\n const [ref, selected, onClick] = useUnitSelectionTarget(d);\n\n return h(\n \"g.unit\",\n {\n className,\n style: {\n \"--column-unit-background-color\": backgroundColor,\n \"--column-stroke-color\": backgroundColor,\n },\n },\n [\n h(\"rect.unit.background\", {\n ref,\n ...bounds,\n fill: backgroundColor,\n fillOpacity: 0.8,\n stroke: backgroundColor,\n onClick,\n }),\n h.if(selected)(\"rect.selection-overlay\", bounds),\n ]\n );\n}\n\nfunction Unit(props: UnitProps) {\n const {\n division: d,\n children,\n fill,\n defaultFill = \"transparent\",\n className,\n widthFraction = 1,\n backgroundColor,\n patternColor,\n axisType: _, // not sure why this is brought in...\n ...baseBounds\n } = props;\n\n const { axisType } = useColumn();\n\n const hasOverflowTop = d.t_clip_pos != null;\n const hasOverflowBottom = d.b_clip_pos != null;\n\n const bounds = {\n ...useUnitRect(d, { widthFraction, axisType }),\n ...baseBounds,\n overflowTop: hasOverflowTop,\n overflowBottom: hasOverflowBottom,\n };\n const patternID = resolveID(d);\n let _fill = fill ?? useGeologicPattern(patternID, defaultFill);\n\n const hasBackgroundColor = backgroundColor != null;\n\n const _className = classNames(className, { colored: hasBackgroundColor });\n\n const [ref, selected, onClick] = useUnitSelectionTarget(d);\n\n //const key = `unit-${d.unit_id}`;\n\n return h(\n \"g.unit\",\n {\n className: _className,\n style: {\n \"--column-unit-background-color\": backgroundColor,\n },\n },\n [\n h(UnitRect, {\n ...bounds,\n fill: backgroundColor,\n onClick,\n className: \"background\",\n }),\n h(UnitRect, {\n ref,\n ...bounds,\n fill: _fill,\n //mask,\n onClick,\n className: \"unit\",\n }),\n h.if(selected)(UnitRect, { ...bounds, className: \"selection-overlay\" }),\n //defs,\n children,\n ]\n );\n}\n\ninterface UnitRectProps {\n x: number;\n y: number;\n width: number;\n height: number;\n className: string;\n // Used to determine if the rect should have a zig-zag edge on the top or bottom\n overflowTop?: boolean;\n overflowBottom?: boolean;\n [key: string]: any;\n}\n\nconst UnitRect = forwardRef((props: UnitRectProps, ref) => {\n const {\n x,\n y,\n width,\n height,\n overflowTop = false,\n overflowBottom = false,\n ...rest\n } = props;\n\n if (!overflowTop && !overflowBottom) {\n return h(\"rect\", {\n x,\n y,\n width,\n height,\n ref,\n ...rest,\n });\n } else {\n const d = zigZagBoxPath(x, y, width, height, overflowTop, overflowBottom);\n return h(\"path\", {\n d,\n ref,\n ...rest,\n });\n }\n});\n\nfunction zigZagBoxPath(x, y, width, height, top: boolean, bottom: boolean) {\n const zigZagWidth = 10;\n const zigZagHeight = 4;\n\n const d = path();\n\n const nZigZags = Math.floor(width / zigZagWidth - 0.5);\n const _zigZagWidth = width / (nZigZags + 0.5);\n\n d.moveTo(x, y);\n let dy = zigZagHeight / 2;\n // Each zig-zag consists of a short outward motion\n let dx = _zigZagWidth / 4;\n\n let cx = x;\n let cy = y;\n\n const doZigZag = (last = false) => {\n cx += dx;\n cy -= dy;\n d.lineTo(cx, cy);\n let scalar = last ? 1 : 2;\n cx += dx * scalar;\n cy += dy * scalar;\n d.lineTo(cx, cy);\n cx += dx;\n cy -= dy;\n };\n\n if (top) {\n // Move to the offset\n //d.lineTo(cx, y);\n // Draw the zig-zags\n for (let i = 0; i < nZigZags; i++) {\n doZigZag();\n }\n // Draw the last half zig-zag\n doZigZag(true);\n }\n // Draw the right edge\n d.lineTo(x + width, y);\n d.lineTo(x + width, y + height);\n\n if (bottom) {\n dx = -dx;\n dy = -dy;\n cx = x + width;\n cy = y + height;\n\n for (let i = 0; i < nZigZags; i++) {\n doZigZag();\n }\n doZigZag(true);\n }\n // Draw the last line to the left edge\n d.lineTo(x, y + height);\n // Draw the left edge\n d.closePath();\n\n // Now render the path;\n return d.toString();\n}\n\nfunction LabeledUnit(props: LabeledUnitProps) {\n const {\n division,\n label,\n onLabelUpdated,\n widthFraction,\n showLabel = true,\n backgroundColor,\n axisType: _, // not sure why this is brought in...\n ...baseBounds\n } = props;\n\n const { axisType } = useColumn();\n const bounds = {\n ...useUnitRect(division, { widthFraction, axisType }),\n ...baseBounds,\n };\n const { width, height } = bounds;\n return h(\n Unit,\n { className: \"labeled-unit\", division, backgroundColor, ...bounds },\n [\n h.if(showLabel)(\n ForeignObject,\n { ...bounds, className: \"unit-label-container\" },\n h(SizeAwareLabel, {\n className: \"unit-overlay\",\n labelClassName: \"unit-label\",\n style: { width, height },\n label,\n onVisibilityChanged(viz) {\n onLabelUpdated(label, viz);\n },\n })\n ),\n ]\n );\n}\n\nfunction UnitBoxes<T>(props: {\n unitComponent: React.FunctionComponent<{ division: T }>;\n unitComponentProps?: any;\n transformDivisions?(divisions: T[]): T[];\n transformDivision?: (\n division: any,\n index: number,\n divisions: any[]\n ) => T | null;\n}) {\n const { unitComponent = Unit, unitComponentProps = {} } = props;\n const { divisions } = useContext(ColumnContext);\n\n if (divisions.length == 0) {\n console.warn(\"No divisions found in column context\");\n return null;\n }\n\n const children = useMemo(() => {\n return divisions.map((division: any, i) => {\n // @ts-ignore\n return h(unitComponent, {\n division,\n key: division.unit_id,\n ...unitComponentProps,\n });\n });\n }, [divisions, unitComponent, unitComponentProps]);\n\n return h(\n PatternDefsProvider,\n { resolveID, scalePattern },\n h(\"g.divisions\", children)\n );\n}\n\nexport { LabeledUnit, Unit, UnitBoxes, UnitProps };\n"],"names":[],"version":3,"file":"boxes.8292cff2.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,uEAAK;AAkC5B,SAAS,kCACP,QAAe,EACf,UAA2B,CAAC,CAAC;IAE7B,MAAM,iBACJ,gBAAgB,aAChB,WAAW,CAAA,GAAA,qBAAa,EAAE,GAAG,WAC7B,UAAU,GACX,GAAG;IACJ,MAAM,SAAE,KAAK,EAAE,GAAG,CAAA,GAAA,i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-views/src/units/boxes.ts"],"sourcesContent":["import {\n ColumnAxisType,\n ColumnContext,\n ColumnLayoutContext,\n ForeignObject,\n PatternDefsProvider,\n useColumn,\n useGeologicPattern,\n} from \"@macrostrat/column-components\";\nimport { SizeAwareLabel, Clickable } from \"@macrostrat/ui-components\";\nimport hyper from \"@macrostrat/hyper\";\nimport { forwardRef, ReactNode, useContext, useMemo } from \"react\";\nimport { resolveID, scalePattern } from \"./resolvers\";\nimport { useUnitSelectionTarget } from \"./selection\";\nimport { IUnit } from \"./types\";\nimport styles from \"./boxes.module.sass\";\nimport classNames from \"classnames\";\nimport { getUnitHeightRange } from \"../prepare-units/utils\";\nimport { useLithologies } from \"../data-provider\";\nimport { getMixedUnitColor } from \"./colors\";\nimport { path } from \"d3-path\";\nimport type { RectBounds } from \"./types\";\n\nconst h = hyper.styled(styles);\n\ninterface UnitRectOptions {\n widthFraction?: number;\n axisType?: ColumnAxisType;\n // Padding to create overflow for zig-zags or other ornamented edges\n padding?: number;\n}\n\ninterface UnitProps extends Clickable, Partial<RectBounds>, UnitRectOptions {\n division: IUnit;\n resolveID?(IUnit): string;\n UUID?: string;\n defaultFill?: string;\n widthFraction?: number;\n children?: ReactNode;\n className?: string;\n fill?: string;\n backgroundColor?: string;\n patternColor?: string;\n}\n\nexport interface LabeledUnitProps\n extends UnitRectOptions,\n Clickable,\n Partial<RectBounds> {\n division: IUnit;\n label: string;\n onLabelUpdated?(label: string, shown: boolean);\n halfWidth?: boolean;\n showLabel?: boolean;\n backgroundColor?: string;\n}\n\nfunction useUnitRect(\n division: IUnit,\n options: UnitRectOptions = {}\n): RectBounds {\n const {\n widthFraction = 1,\n axisType = ColumnAxisType.AGE,\n padding = 0,\n } = options;\n const { scale } = useContext(ColumnContext);\n const { width } = useContext(ColumnLayoutContext);\n\n const [bottomHeight, topHeight] = getUnitHeightRange(division, axisType);\n\n const y = scale(topHeight);\n const height = Math.abs(scale(bottomHeight) - y);\n\n return {\n x: width * (1 - widthFraction) - padding,\n y: y - padding,\n height: height + padding * 2,\n width: widthFraction * width + padding * 2,\n };\n}\n\nexport function MinimalUnit(props) {\n const {\n division: d,\n children,\n className,\n widthFraction = 1,\n axisType: _, // not sure why this is brought in...\n nColumns: __,\n ...baseBounds\n } = props;\n\n const { axisType } = useColumn();\n const lithMap = useLithologies();\n const bounds = {\n ...useUnitRect(d, { widthFraction, axisType }),\n ...baseBounds,\n };\n\n const backgroundColor = getMixedUnitColor(d, lithMap, null, false);\n\n const [ref, selected, onClick] = useUnitSelectionTarget(d);\n\n return h(\n \"g.unit\",\n {\n className,\n style: {\n \"--column-unit-background-color\": backgroundColor,\n \"--column-stroke-color\": backgroundColor,\n },\n },\n [\n h(\"rect.unit.background\", {\n ref,\n ...bounds,\n fill: backgroundColor,\n fillOpacity: 0.8,\n stroke: backgroundColor,\n onClick,\n }),\n h.if(selected)(\"rect.selection-overlay\", bounds),\n ]\n );\n}\n\nfunction Unit(props: UnitProps) {\n const {\n division: d,\n children,\n fill,\n defaultFill = \"transparent\",\n className,\n widthFraction = 1,\n backgroundColor,\n patternColor,\n axisType: _, // not sure why this is brought in...\n ...baseBounds\n } = props;\n\n const { axisType } = useColumn();\n\n const hasOverflowTop = d.t_clip_pos != null;\n const hasOverflowBottom = d.b_clip_pos != null;\n\n const bounds = {\n ...useUnitRect(d, { widthFraction, axisType }),\n ...baseBounds,\n overflowTop: hasOverflowTop,\n overflowBottom: hasOverflowBottom,\n };\n const patternID = resolveID(d);\n let _fill = fill ?? useGeologicPattern(patternID, defaultFill);\n\n const hasBackgroundColor = backgroundColor != null;\n\n const _className = classNames(className, { colored: hasBackgroundColor });\n\n const [ref, selected, onClick] = useUnitSelectionTarget(d);\n\n //const key = `unit-${d.unit_id}`;\n\n return h(\n \"g.unit\",\n {\n className: _className,\n style: {\n \"--column-unit-background-color\": backgroundColor,\n },\n },\n [\n h(UnitRect, {\n ...bounds,\n fill: backgroundColor,\n onClick,\n className: \"background\",\n }),\n h(UnitRect, {\n ref,\n ...bounds,\n fill: _fill,\n //mask,\n onClick,\n className: \"unit\",\n }),\n h.if(selected)(UnitRect, { ...bounds, className: \"selection-overlay\" }),\n //defs,\n children,\n ]\n );\n}\n\ninterface UnitRectProps {\n x: number;\n y: number;\n width: number;\n height: number;\n className: string;\n // Used to determine if the rect should have a zig-zag edge on the top or bottom\n overflowTop?: boolean;\n overflowBottom?: boolean;\n [key: string]: any;\n}\n\nconst UnitRect = forwardRef((props: UnitRectProps, ref) => {\n const {\n x,\n y,\n width,\n height,\n overflowTop = false,\n overflowBottom = false,\n ...rest\n } = props;\n\n if (!overflowTop && !overflowBottom) {\n return h(\"rect\", {\n x,\n y,\n width,\n height,\n ref,\n ...rest,\n });\n } else {\n const d = zigZagBoxPath(x, y, width, height, overflowTop, overflowBottom);\n return h(\"path\", {\n d,\n ref,\n ...rest,\n });\n }\n});\n\nfunction zigZagBoxPath(x, y, width, height, top: boolean, bottom: boolean) {\n const zigZagWidth = 10;\n const zigZagHeight = 4;\n\n const d = path();\n\n const nZigZags = Math.floor(width / zigZagWidth - 0.5);\n const _zigZagWidth = width / (nZigZags + 0.5);\n\n d.moveTo(x, y);\n let dy = zigZagHeight / 2;\n // Each zig-zag consists of a short outward motion\n let dx = _zigZagWidth / 4;\n\n let cx = x;\n let cy = y;\n\n const doZigZag = (last = false) => {\n cx += dx;\n cy -= dy;\n d.lineTo(cx, cy);\n let scalar = last ? 1 : 2;\n cx += dx * scalar;\n cy += dy * scalar;\n d.lineTo(cx, cy);\n cx += dx;\n cy -= dy;\n };\n\n if (top) {\n // Move to the offset\n //d.lineTo(cx, y);\n // Draw the zig-zags\n for (let i = 0; i < nZigZags; i++) {\n doZigZag();\n }\n // Draw the last half zig-zag\n doZigZag(true);\n }\n // Draw the right edge\n d.lineTo(x + width, y);\n d.lineTo(x + width, y + height);\n\n if (bottom) {\n dx = -dx;\n dy = -dy;\n cx = x + width;\n cy = y + height;\n\n for (let i = 0; i < nZigZags; i++) {\n doZigZag();\n }\n doZigZag(true);\n }\n // Draw the last line to the left edge\n d.lineTo(x, y + height);\n // Draw the left edge\n d.closePath();\n\n // Now render the path;\n return d.toString();\n}\n\nfunction LabeledUnit(props: LabeledUnitProps) {\n const {\n division,\n label,\n onLabelUpdated,\n widthFraction,\n showLabel = true,\n backgroundColor,\n axisType: _, // not sure why this is brought in...\n ...baseBounds\n } = props;\n\n const { axisType } = useColumn();\n const bounds = {\n ...useUnitRect(division, { widthFraction, axisType }),\n ...baseBounds,\n };\n const { width, height } = bounds;\n return h(\n Unit,\n { className: \"labeled-unit\", division, backgroundColor, ...bounds },\n [\n h.if(showLabel)(\n ForeignObject,\n { ...bounds, className: \"unit-label-container\" },\n h(SizeAwareLabel, {\n className: \"unit-overlay\",\n labelClassName: \"unit-label\",\n style: { width, height },\n label,\n onVisibilityChanged(viz) {\n onLabelUpdated(label, viz);\n },\n })\n ),\n ]\n );\n}\n\nfunction UnitBoxes<T>(props: {\n unitComponent: React.FunctionComponent<{ division: T }>;\n unitComponentProps?: any;\n transformDivisions?(divisions: T[]): T[];\n transformDivision?: (\n division: any,\n index: number,\n divisions: any[]\n ) => T | null;\n}) {\n const { unitComponent = Unit, unitComponentProps = {} } = props;\n const { divisions } = useContext(ColumnContext);\n\n if (divisions.length == 0) {\n console.warn(\"No divisions found in column context\");\n return null;\n }\n\n const children = useMemo(() => {\n return divisions.map((division: any, i) => {\n // @ts-ignore\n return h(unitComponent, {\n division,\n key: division.unit_id,\n ...unitComponentProps,\n });\n });\n }, [divisions, unitComponent, unitComponentProps]);\n\n return h(\n PatternDefsProvider,\n { resolveID, scalePattern },\n h(\"g.divisions\", children)\n );\n}\n\nexport { LabeledUnit, Unit, UnitBoxes, UnitProps };\n"],"names":[],"version":3,"file":"column-views.5c02fee2.js.map"}
@@ -149,4 +149,4 @@ async function $33a46f9423c8104a$export$d3d8b0fabcc76c5d(col_id, fetch = $33a46f
149
149
 
150
150
 
151
151
  export {$33a46f9423c8104a$export$45bd78cd093090fa as fetchAllColumns, $33a46f9423c8104a$export$e3270a4e30e40ff9 as useColumnFeatures, $33a46f9423c8104a$export$1aa679bd5e605f82 as fetchLithologies, $33a46f9423c8104a$export$5d2ec2e733dfe6c7 as fetchIntervals, $33a46f9423c8104a$export$780b4b253712916c as fetchEnvironments, $33a46f9423c8104a$export$cd7bfa0860f58b96 as fetchRefs, $33a46f9423c8104a$export$b97b9bdd6a521298 as fetchUnits, $33a46f9423c8104a$export$d3d8b0fabcc76c5d as fetchColumnUnits};
152
- //# sourceMappingURL=fetch.99aec438.js.map
152
+ //# sourceMappingURL=column-views.5cc09c1d.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAeA,SAAS,mCACP,GAAW,EACX,OAA4C;IAE5C,MAAM,UAAU;IAChB,OAAO,CAAA,GAAA,iBAAS,EAAE,UAAU,KAAK;AACnC;AAUO,eAAe,0CACpB,UAA8B,CAAC,CAAC;IAEhC,MAAM,cACJ,UAAU,aACV,SAAS,UACT,SAAS,wBACT,UAAU,SACV,QAAQ,CAAA,GAAA,iBAAS,GAClB,GAAG;IAEJ,IAAI,OAAY;gBAAE;IAAO;IACzB,IAAI,aAAa,MACf,OAAO;QAAE,GAAG,IAAI;QAAE,YAAY;IAAU;IAE1C,IAAI,cAAc,MAChB,OAAO;QAAE,GAAG,IAAI;QAAE,aAAa;IAAW;IAG5C,IAAI,aAAa,MACf,OAAO;QAAE,GAAG,IAAI;QAAE,KAAK;IAAK;IAG9B,IAAI,MAAM;IACV,IAAI,cAAc,MAChB,MAAM,CAAA,GAAA,cAAM,EAAE,YAAY;IAG5B,iBAAiB;IACjB,MAAM,CAAA,GAAA,qBAAa,EAAE,KAAK;IAE1B,MAAM,MAAM,MAAM,MAAM,KAAK;QAC3B,QAAQ;QACR,SAAS;YACP,gBAAgB;QAClB;IACF;IAEA,IAAI,OAAO,MACT,OAAO;IAGT,WAAW;IACX,MAAM,OAAO,MAAM,IAAI,IAAI;IAC3B,OAAO,yCAAmB,sCAAgB,CAAC,OAAO,CAAC;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AM,IAAI,IAAI;IAC3B,IAAI,CAAC,KAAK,OAAO,EACf,MAAM,IAAI,MAAM;IAElB,MAAM,QAAQ,KAAK,OAAO,CAAC,IAAI;IAC/B,OAAO;QAAE,UAAU;eAAQ;IAAM;AACnC","sources":["packages/column-views/src/data-provider/fetch.ts"],"sourcesContent":["import {\n ColumnGeoJSONRecord,\n ColumnGeoJSONRecordWithID,\n MacrostratRef,\n UnitLong,\n} from \"@macrostrat/api-types\";\nimport {\n addQueryString,\n joinURL,\n useAPIResult,\n} from \"@macrostrat/ui-components\";\nimport crossFetch from \"cross-fetch\";\nimport { feature } from \"topojson-client\";\nimport { geoArea } from \"d3-geo\";\n\nfunction defaultFetch(\n url: string,\n options: RequestInit | undefined = undefined\n) {\n const baseURL = \"https://macrostrat.org/api/v2\";\n return crossFetch(baseURL + url, options);\n}\n\nexport interface ColumnFetchOptions {\n apiBaseURL?: string;\n projectID?: number;\n statusCode?: \"in process\";\n format?: \"geojson\" | \"topojson\" | \"geojson_bare\";\n fetch?: any;\n}\n\nexport async function fetchAllColumns(\n options: ColumnFetchOptions = {}\n): Promise<ColumnGeoJSONRecord[]> {\n const {\n apiBaseURL,\n projectID,\n format = \"topojson\",\n statusCode,\n fetch = crossFetch,\n } = options;\n\n let args: any = { format };\n if (projectID != null) {\n args = { ...args, project_id: projectID };\n }\n if (statusCode != null) {\n args = { ...args, status_code: statusCode };\n }\n\n if (projectID == null) {\n args = { ...args, all: true };\n }\n\n let url = \"/columns\";\n if (apiBaseURL != null) {\n url = joinURL(apiBaseURL, url);\n }\n\n // Try with fetch\n url = addQueryString(url, args);\n\n const res = await fetch(url, {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n });\n\n if (res == null) {\n return null;\n }\n\n // Get JSON\n const data = await res.json();\n return postProcessColumns(columnProcessors[format](data));\n}\n\nexport function useColumnFeatures({\n apiRoute = \"/columns\",\n status_code,\n project_id,\n format = \"geojson\",\n}) {\n let all: boolean = undefined;\n if (status_code == null && project_id == null) {\n all = true;\n }\n\n const processor = columnProcessors[format];\n\n return useAPIResult(\n apiRoute,\n { format, all, status_code, project_id },\n processor\n );\n}\n\nfunction processGeoJSON(res) {\n return processGeoJSONBare(res?.success?.data);\n}\n\nfunction processGeoJSONBare(res) {\n return res?.features;\n}\n\nfunction processTopoJSON(res) {\n try {\n const { data } = res.success;\n const { features: f } = feature(data, data.objects.output) as any;\n return f;\n } catch (err) {\n console.error(err);\n return [];\n }\n}\n\nfunction postProcessColumns(columns) {\n return promoteColumnIDs(\n convertSmallAreasToPoints(removeFeaturesWithoutGeometry(columns))\n );\n}\n\nfunction promoteColumnIDs(\n features: ColumnGeoJSONRecord[]\n): ColumnGeoJSONRecordWithID[] {\n return features.map((f, i) => {\n return {\n id: f.properties?.col_id,\n ...f,\n };\n });\n}\n\nfunction removeFeaturesWithoutGeometry(features) {\n return features.filter((f) => f.geometry != null);\n}\n\nfunction convertSmallAreasToPoints(features) {\n return features.map((f) => {\n // GeoArea takes a long time to run. We are really more worried about points that are zero-area\n if (geoArea(f.geometry) < 1e-8) {\n const centroid = f.geometry.coordinates[0][0];\n f.geometry = {\n type: \"Point\",\n coordinates: centroid,\n };\n }\n return f;\n });\n}\n\nconst columnProcessors = {\n topojson: processTopoJSON,\n geojson: processGeoJSON,\n geojson_bare: processGeoJSONBare,\n};\n\nasync function unwrapResponse(res) {\n if (res == null) {\n return null;\n }\n const resData = await res.json();\n return resData[\"success\"][\"data\"];\n}\n\nexport async function fetchLithologies(fetch = defaultFetch) {\n const res = await fetch(\"/defs/lithologies?all\");\n return await unwrapResponse(res);\n}\n\nexport async function fetchIntervals(\n timescaleID: number | null,\n fetch = defaultFetch\n) {\n let url = `/defs/intervals`;\n if (timescaleID != null) {\n url += `?timescale_id=${timescaleID}`;\n } else {\n url += \"?all\";\n }\n const res = await fetch(url);\n return await unwrapResponse(res);\n}\n\nexport async function fetchEnvironments(fetch = defaultFetch) {\n const res = await fetch(\"/defs/environments?all\");\n return await unwrapResponse(res);\n}\n\nexport async function fetchRefs(\n refs: number[],\n fetch = defaultFetch\n): Promise<MacrostratRef[]> {\n let url = `/defs/refs`;\n if (refs.length == 0) {\n return [];\n }\n url += \"?ref_id=\" + refs.join(\",\");\n const res = await fetch(url);\n return await unwrapResponse(res);\n}\n\nexport type ColumnData = {\n units: UnitLong[];\n columnID: number;\n};\n\nexport async function fetchUnits(\n columns: number[],\n fetch = defaultFetch\n): Promise<ColumnData[]> {\n const promises = columns.map((col_id) => fetchColumnUnits(col_id, fetch));\n return await Promise.all(promises);\n}\n\nexport async function fetchColumnUnits(\n col_id: number,\n fetch = defaultFetch\n): Promise<ColumnData> {\n const params = new URLSearchParams();\n params.append(\"response\", \"long\");\n params.append(\"col_id\", col_id.toString());\n const res = await fetch(\"/units\" + \"?\" + params.toString());\n const data = await res.json();\n if (!data.success) {\n throw new Error(\"Failed to fetch column units\");\n }\n const units = data.success.data;\n return { columnID: col_id, units };\n}\n"],"names":[],"version":3,"file":"fetch.99aec438.js.map"}
1
+ {"mappings":";;;;;;;;;AAeA,SAAS,mCACP,GAAW,EACX,OAA4C;IAE5C,MAAM,UAAU;IAChB,OAAO,CAAA,GAAA,iBAAS,EAAE,UAAU,KAAK;AACnC;AAUO,eAAe,0CACpB,UAA8B,CAAC,CAAC;IAEhC,MAAM,cACJ,UAAU,aACV,SAAS,UACT,SAAS,wBACT,UAAU,SACV,QAAQ,CAAA,GAAA,iBAAS,GAClB,GAAG;IAEJ,IAAI,OAAY;gBAAE;IAAO;IACzB,IAAI,aAAa,MACf,OAAO;QAAE,GAAG,IAAI;QAAE,YAAY;IAAU;IAE1C,IAAI,cAAc,MAChB,OAAO;QAAE,GAAG,IAAI;QAAE,aAAa;IAAW;IAG5C,IAAI,aAAa,MACf,OAAO;QAAE,GAAG,IAAI;QAAE,KAAK;IAAK;IAG9B,IAAI,MAAM;IACV,IAAI,cAAc,MAChB,MAAM,CAAA,GAAA,cAAM,EAAE,YAAY;IAG5B,iBAAiB;IACjB,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MAAM,QAAQ,GAAG,CAAC;AAC3B;AAEO,eAAe,0CACpB,MAAc,EACd,QAAQ,kCAAY;IAEpB,MAAM,SAAS,IAAI;IACnB,OAAO,MAAM,CAAC,YAAY;IAC1B,OAAO,MAAM,CAAC,UAAU,OAAO,QAAQ;IACvC,MAAM,MAAM,MAAM,MAAM,YAAiB,OAAO,QAAQ;IACxD,MAAM,OAAO,MAAM,IAAI,IAAI;IAC3B,IAAI,CAAC,KAAK,OAAO,EACf,MAAM,IAAI,MAAM;IAElB,MAAM,QAAQ,KAAK,OAAO,CAAC,IAAI;IAC/B,OAAO;QAAE,UAAU;eAAQ;IAAM;AACnC","sources":["packages/column-views/src/data-provider/fetch.ts"],"sourcesContent":["import {\n ColumnGeoJSONRecord,\n ColumnGeoJSONRecordWithID,\n MacrostratRef,\n UnitLong,\n} from \"@macrostrat/api-types\";\nimport {\n addQueryString,\n joinURL,\n useAPIResult,\n} from \"@macrostrat/ui-components\";\nimport crossFetch from \"cross-fetch\";\nimport { feature } from \"topojson-client\";\nimport { geoArea } from \"d3-geo\";\n\nfunction defaultFetch(\n url: string,\n options: RequestInit | undefined = undefined\n) {\n const baseURL = \"https://macrostrat.org/api/v2\";\n return crossFetch(baseURL + url, options);\n}\n\nexport interface ColumnFetchOptions {\n apiBaseURL?: string;\n projectID?: number;\n statusCode?: \"in process\";\n format?: \"geojson\" | \"topojson\" | \"geojson_bare\";\n fetch?: any;\n}\n\nexport async function fetchAllColumns(\n options: ColumnFetchOptions = {}\n): Promise<ColumnGeoJSONRecord[]> {\n const {\n apiBaseURL,\n projectID,\n format = \"topojson\",\n statusCode,\n fetch = crossFetch,\n } = options;\n\n let args: any = { format };\n if (projectID != null) {\n args = { ...args, project_id: projectID };\n }\n if (statusCode != null) {\n args = { ...args, status_code: statusCode };\n }\n\n if (projectID == null) {\n args = { ...args, all: true };\n }\n\n let url = \"/columns\";\n if (apiBaseURL != null) {\n url = joinURL(apiBaseURL, url);\n }\n\n // Try with fetch\n url = addQueryString(url, args);\n\n const res = await fetch(url, {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n });\n\n if (res == null) {\n return null;\n }\n\n // Get JSON\n const data = await res.json();\n return postProcessColumns(columnProcessors[format](data));\n}\n\nexport function useColumnFeatures({\n apiRoute = \"/columns\",\n status_code,\n project_id,\n format = \"geojson\",\n}) {\n let all: boolean = undefined;\n if (status_code == null && project_id == null) {\n all = true;\n }\n\n const processor = columnProcessors[format];\n\n return useAPIResult(\n apiRoute,\n { format, all, status_code, project_id },\n processor\n );\n}\n\nfunction processGeoJSON(res) {\n return processGeoJSONBare(res?.success?.data);\n}\n\nfunction processGeoJSONBare(res) {\n return res?.features;\n}\n\nfunction processTopoJSON(res) {\n try {\n const { data } = res.success;\n const { features: f } = feature(data, data.objects.output) as any;\n return f;\n } catch (err) {\n console.error(err);\n return [];\n }\n}\n\nfunction postProcessColumns(columns) {\n return promoteColumnIDs(\n convertSmallAreasToPoints(removeFeaturesWithoutGeometry(columns))\n );\n}\n\nfunction promoteColumnIDs(\n features: ColumnGeoJSONRecord[]\n): ColumnGeoJSONRecordWithID[] {\n return features.map((f, i) => {\n return {\n id: f.properties?.col_id,\n ...f,\n };\n });\n}\n\nfunction removeFeaturesWithoutGeometry(features) {\n return features.filter((f) => f.geometry != null);\n}\n\nfunction convertSmallAreasToPoints(features) {\n return features.map((f) => {\n // GeoArea takes a long time to run. We are really more worried about points that are zero-area\n if (geoArea(f.geometry) < 1e-8) {\n const centroid = f.geometry.coordinates[0][0];\n f.geometry = {\n type: \"Point\",\n coordinates: centroid,\n };\n }\n return f;\n });\n}\n\nconst columnProcessors = {\n topojson: processTopoJSON,\n geojson: processGeoJSON,\n geojson_bare: processGeoJSONBare,\n};\n\nasync function unwrapResponse(res) {\n if (res == null) {\n return null;\n }\n const resData = await res.json();\n return resData[\"success\"][\"data\"];\n}\n\nexport async function fetchLithologies(fetch = defaultFetch) {\n const res = await fetch(\"/defs/lithologies?all\");\n return await unwrapResponse(res);\n}\n\nexport async function fetchIntervals(\n timescaleID: number | null,\n fetch = defaultFetch\n) {\n let url = `/defs/intervals`;\n if (timescaleID != null) {\n url += `?timescale_id=${timescaleID}`;\n } else {\n url += \"?all\";\n }\n const res = await fetch(url);\n return await unwrapResponse(res);\n}\n\nexport async function fetchEnvironments(fetch = defaultFetch) {\n const res = await fetch(\"/defs/environments?all\");\n return await unwrapResponse(res);\n}\n\nexport async function fetchRefs(\n refs: number[],\n fetch = defaultFetch\n): Promise<MacrostratRef[]> {\n let url = `/defs/refs`;\n if (refs.length == 0) {\n return [];\n }\n url += \"?ref_id=\" + refs.join(\",\");\n const res = await fetch(url);\n return await unwrapResponse(res);\n}\n\nexport type ColumnData = {\n units: UnitLong[];\n columnID: number;\n};\n\nexport async function fetchUnits(\n columns: number[],\n fetch = defaultFetch\n): Promise<ColumnData[]> {\n const promises = columns.map((col_id) => fetchColumnUnits(col_id, fetch));\n return await Promise.all(promises);\n}\n\nexport async function fetchColumnUnits(\n col_id: number,\n fetch = defaultFetch\n): Promise<ColumnData> {\n const params = new URLSearchParams();\n params.append(\"response\", \"long\");\n params.append(\"col_id\", col_id.toString());\n const res = await fetch(\"/units\" + \"?\" + params.toString());\n const data = await res.json();\n if (!data.success) {\n throw new Error(\"Failed to fetch column units\");\n }\n const units = data.success.data;\n return { columnID: col_id, units };\n}\n"],"names":[],"version":3,"file":"column-views.5cc09c1d.js.map"}
@@ -1,4 +1,4 @@
1
- import {getUnitHeightRange as $b6657fba8924a702$export$70e712e2ac0237a} from "./utils.d7a43a2a.js";
1
+ import {getUnitHeightRange as $b6657fba8924a702$export$70e712e2ac0237a} from "./column-views.39657bbf.js";
2
2
  import $5ZBll$macrostrathyper from "@macrostrat/hyper";
3
3
  import $5ZBll$react, {useContext as $5ZBll$useContext, useCallback as $5ZBll$useCallback} from "react";
4
4
  import {ColumnContext as $5ZBll$ColumnContext, NotesColumn as $5ZBll$NotesColumn} from "@macrostrat/column-components";
@@ -62,4 +62,4 @@ function $bc17276da4abb183$export$594d19cdd88f8c16(props) {
62
62
 
63
63
 
64
64
  export {$bc17276da4abb183$export$2f2e65a797f8fc1e as noteForDivision, $bc17276da4abb183$export$c9757aeb43a67df0 as defaultNameFunction, $bc17276da4abb183$export$6316e673796ccb55 as UnitDataColumn, $bc17276da4abb183$export$594d19cdd88f8c16 as UnitNamesColumn};
65
- //# sourceMappingURL=names.a8f2b452.js.map
65
+ //# sourceMappingURL=column-views.650bd9f5.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AA+BA,SAAS,0CACP,GAAU,EACV,IAAkC;IAElC,MAAM,YAAE,QAAQ,EAAE,GAAG;IAErB,MAAM,CAAC,QAAQ,WAAW,GAAG,CAAA,GAAA,wCAAiB,EAAE,KAAK;IAErD,OAAO;gBACL;oBACA;QACA,MAAM;QACN,IAAI,IAAI,OAAO;IACjB;AACF;AAEA,MAAM,4CAAsB,CAAC;IAC3B,OAAO,IAAI,SAAS,CACjB,OAAO,CAAC,OAAO,UACf,OAAO,CAAC,MAAM,aACd,OAAO,CAAC,MAAM;AACnB;AAEA,SAAS,sCAAgB,KAAoB;IAC3C,MAAM,MAAM,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,oBAAY;IACnC,MAAM,QACJ,IAAI,iBACJ,aAAa,oBACb,mBAAmB,CAAC,MAA8B,IAAc,qBAChE,gBAAgB,cAChB,YAAY,KAAK,WACjB,GAAG,MACJ,GAAG;IAEJ,MAAM,SAAE,KAAK,EAAE,GAAG;IAElB,MAAM,sBAAsB,CAAA,GAAA,kBAAU,EACpC,CAAC;QACC,IAAI,iBAAiB,GAAG,OAAO;QAC/B,MAAM,KAAK,KAAK,GAAG,CAAC,MAAM,EAAE,UAAU,IAAI,MAAM,EAAE,MAAM;QACxD,OAAO,KAAK;IACd,GACA;QAAC;QAAO;KAAc;IAGxB,IAAI,aAAa,MAAM,OAAO;IAC9B,MAAM,QAAoB,UACvB,MAAM,CAAC,kBACP,GAAG,CAAC,CAAC,IAAa,0CAAgB,GAAG;YAAE,UAAU,IAAI,QAAQ;QAAC,IAC9D,MAAM,CAAC;IAEV,OAAO,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,kBAAU,GAAG;QACpB,WAAW,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;QACpC,UAAU;uBACV;eACA;QACA,cAAc;YACZ,aAAa;QACf;QACA,GAAG,IAAI;IACT;AACF;AAEA,MAAM,4CAAiB,CAAA,GAAA,YAAI,EAAE,IAAI,CAAC;AAQ3B,SAAS,0CAAgB,KAAqB;IACnD,MAAM,mBACJ,kBAAkB,0DAClB,aAAa,EACb,GAAG,MACJ,GAAG;IAEJ,MAAM,gBAAgB,CAAC;QACrB,MAAM,QAAE,IAAI,EAAE,GAAG;QACjB,OAAO,CAAA,GAAA,sBAAA,EAAE,oBAAoB,gBAAgB,KAAK,IAAI;IACxD;IAEA,OAAO,CAAA,GAAA,sBAAA,EAAE,2CAAgB;QACvB,eAAe,iBAAiB;QAChC,GAAG,IAAI;IACT;AACF","sources":["packages/column-views/src/units/names.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport { useContext, useCallback } from \"react\";\nimport {\n ColumnContext,\n ColumnAxisType,\n NotesColumn,\n NotesColumnProps,\n} from \"@macrostrat/column-components\";\nimport type { ColumnDivision } from \"@macrostrat/column-components\";\nimport { IUnit } from \"./types\";\nimport React from \"react\";\nimport { getUnitHeightRange } from \"../prepare-units/utils\";\nimport { CompositeColumnScale } from \"./composite\";\n\ninterface UnitDataProps extends NotesColumnProps {\n left?: number;\n transform?: string;\n noteComponent?: React.ComponentType<any>;\n shouldRenderNote?(div: ColumnDivision | IUnit, index: number): boolean;\n divisions?: IUnit[];\n minimumHeight?: number;\n scale?: CompositeColumnScale;\n}\n\ntype UnitNote = {\n height: number;\n top_height: number;\n data: IUnit;\n id: number;\n};\n\nfunction noteForDivision(\n div: IUnit,\n opts: { axisType: ColumnAxisType }\n): UnitNote {\n const { axisType } = opts;\n\n const [height, top_height] = getUnitHeightRange(div, axisType);\n\n return {\n height,\n top_height,\n data: div,\n id: div.unit_id,\n };\n}\n\nconst defaultNameFunction = (div) => {\n return div.unit_name\n .replace(\"Mbr\", \"Member\")\n .replace(\"Fm\", \"Formation\")\n .replace(\"Gp\", \"Group\");\n};\n\nfunction UnitDataColumn_(props: UnitDataProps) {\n const ctx = useContext(ColumnContext);\n const {\n left,\n noteComponent,\n shouldRenderNote = (note: ColumnDivision | IUnit, i: number) => true,\n minimumHeight = 0,\n divisions = ctx?.divisions,\n ...rest\n } = props;\n\n const { scale } = ctx;\n\n const minimumHeightFilter = useCallback(\n (d) => {\n if (minimumHeight == 0) return true;\n const dy = Math.abs(scale(d.top_height) - scale(d.height));\n return dy > minimumHeight;\n },\n [scale, minimumHeight]\n );\n\n if (divisions == null) return null;\n const notes: UnitNote[] = divisions\n .filter(shouldRenderNote)\n .map((d: IUnit) => noteForDivision(d, { axisType: ctx.axisType }))\n .filter(minimumHeightFilter);\n\n return h(NotesColumn, {\n transform: `translate(${left || 0})`,\n editable: false,\n noteComponent,\n notes,\n forceOptions: {\n nodeSpacing: 1,\n },\n ...rest,\n });\n}\n\nconst UnitDataColumn = React.memo(UnitDataColumn_);\n\ninterface UnitNamesProps extends UnitDataProps {\n nameForDivision?(obj: IUnit): string;\n paddingLeft?: number;\n width: number;\n}\n\nexport function UnitNamesColumn(props: UnitNamesProps) {\n const {\n nameForDivision = defaultNameFunction,\n noteComponent,\n ...rest\n } = props;\n\n const NoteComponent = (props) => {\n const { note } = props;\n return h(\"p.col-note-label\", nameForDivision(note.data));\n };\n\n return h(UnitDataColumn, {\n noteComponent: noteComponent ?? NoteComponent,\n ...rest,\n });\n}\n\nexport type { UnitNamesProps };\nexport { defaultNameFunction, noteForDivision, UnitDataColumn };\n"],"names":[],"version":3,"file":"names.a8f2b452.js.map"}
1
+ {"mappings":";;;;;;;;;AA+BA,SAAS,0CACP,GAAU,EACV,IAAkC;IAElC,MAAM,YAAE,QAA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a,EACb,GAAG,MACJ,GAAG;IAEJ,MAAM,gBAAgB,CAAC;QACrB,MAAM,QAAE,IAAI,EAAE,GAAG;QACjB,OAAO,CAAA,GAAA,sBAAA,EAAE,oBAAoB,gBAAgB,KAAK,IAAI;IACxD;IAEA,OAAO,CAAA,GAAA,sBAAA,EAAE,2CAAgB;QACvB,eAAe,iBAAiB;QAChC,GAAG,IAAI;IACT;AACF","sources":["packages/column-views/src/units/names.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport { useContext, useCallback } from \"react\";\nimport {\n ColumnContext,\n ColumnAxisType,\n NotesColumn,\n NotesColumnProps,\n} from \"@macrostrat/column-components\";\nimport type { ColumnDivision } from \"@macrostrat/column-components\";\nimport { IUnit } from \"./types\";\nimport React from \"react\";\nimport { getUnitHeightRange } from \"../prepare-units/utils\";\nimport { CompositeColumnScale } from \"./composite\";\n\ninterface UnitDataProps extends NotesColumnProps {\n left?: number;\n transform?: string;\n noteComponent?: React.ComponentType<any>;\n shouldRenderNote?(div: ColumnDivision | IUnit, index: number): boolean;\n divisions?: IUnit[];\n minimumHeight?: number;\n scale?: CompositeColumnScale;\n}\n\ntype UnitNote = {\n height: number;\n top_height: number;\n data: IUnit;\n id: number;\n};\n\nfunction noteForDivision(\n div: IUnit,\n opts: { axisType: ColumnAxisType }\n): UnitNote {\n const { axisType } = opts;\n\n const [height, top_height] = getUnitHeightRange(div, axisType);\n\n return {\n height,\n top_height,\n data: div,\n id: div.unit_id,\n };\n}\n\nconst defaultNameFunction = (div) => {\n return div.unit_name\n .replace(\"Mbr\", \"Member\")\n .replace(\"Fm\", \"Formation\")\n .replace(\"Gp\", \"Group\");\n};\n\nfunction UnitDataColumn_(props: UnitDataProps) {\n const ctx = useContext(ColumnContext);\n const {\n left,\n noteComponent,\n shouldRenderNote = (note: ColumnDivision | IUnit, i: number) => true,\n minimumHeight = 0,\n divisions = ctx?.divisions,\n ...rest\n } = props;\n\n const { scale } = ctx;\n\n const minimumHeightFilter = useCallback(\n (d) => {\n if (minimumHeight == 0) return true;\n const dy = Math.abs(scale(d.top_height) - scale(d.height));\n return dy > minimumHeight;\n },\n [scale, minimumHeight]\n );\n\n if (divisions == null) return null;\n const notes: UnitNote[] = divisions\n .filter(shouldRenderNote)\n .map((d: IUnit) => noteForDivision(d, { axisType: ctx.axisType }))\n .filter(minimumHeightFilter);\n\n return h(NotesColumn, {\n transform: `translate(${left || 0})`,\n editable: false,\n noteComponent,\n notes,\n forceOptions: {\n nodeSpacing: 1,\n },\n ...rest,\n });\n}\n\nconst UnitDataColumn = React.memo(UnitDataColumn_);\n\ninterface UnitNamesProps extends UnitDataProps {\n nameForDivision?(obj: IUnit): string;\n paddingLeft?: number;\n width: number;\n}\n\nexport function UnitNamesColumn(props: UnitNamesProps) {\n const {\n nameForDivision = defaultNameFunction,\n noteComponent,\n ...rest\n } = props;\n\n const NoteComponent = (props) => {\n const { note } = props;\n return h(\"p.col-note-label\", nameForDivision(note.data));\n };\n\n return h(UnitDataColumn, {\n noteComponent: noteComponent ?? NoteComponent,\n ...rest,\n });\n}\n\nexport type { UnitNamesProps };\nexport { defaultNameFunction, noteForDivision, UnitDataColumn };\n"],"names":[],"version":3,"file":"column-views.650bd9f5.js.map"}
@@ -1,4 +1,4 @@
1
- import {Columns as $93f116a6493b17c3$export$f02cc02ad0e0bba3, CurrentColumn as $93f116a6493b17c3$export$b9d912252344e099, MeasurementsLayer as $93f116a6493b17c3$export$2254347cd20e6080, ColumnFeatures as $93f116a6493b17c3$export$f177ff57c101017a, ColumnKeyboardNavigation as $93f116a6493b17c3$export$8c41dd563753848, ColumnCenters as $93f116a6493b17c3$export$4d8f6e6df85d9012} from "./layers.033d3fb0.js";
1
+ import {Columns as $93f116a6493b17c3$export$f02cc02ad0e0bba3, CurrentColumn as $93f116a6493b17c3$export$b9d912252344e099, MeasurementsLayer as $93f116a6493b17c3$export$2254347cd20e6080, ColumnFeatures as $93f116a6493b17c3$export$f177ff57c101017a, ColumnKeyboardNavigation as $93f116a6493b17c3$export$8c41dd563753848, ColumnCenters as $93f116a6493b17c3$export$4d8f6e6df85d9012} from "./column-views.e77b9d6b.js";
2
2
  import {useRef as $9RwS3$useRef} from "react";
3
3
  import $9RwS3$macrostrathyper from "@macrostrat/hyper";
4
4
  import {Globe as $9RwS3$Globe, LandLayer as $9RwS3$LandLayer} from "@macrostrat/svg-map-components";
@@ -86,4 +86,4 @@ function $e6046e00d2c8a163$export$9595c40c7a4c4f7b(props) {
86
86
 
87
87
 
88
88
  export {$e6046e00d2c8a163$export$c4313db718750a5a as ResizableMapFrame, $e6046e00d2c8a163$export$9595c40c7a4c4f7b as ColumnNavigationSVGMap, $93f116a6493b17c3$export$2254347cd20e6080 as MeasurementsLayer, $93f116a6493b17c3$export$f177ff57c101017a as ColumnFeatures, $93f116a6493b17c3$export$8c41dd563753848 as ColumnKeyboardNavigation, $93f116a6493b17c3$export$f02cc02ad0e0bba3 as Columns, $93f116a6493b17c3$export$4d8f6e6df85d9012 as ColumnCenters, $93f116a6493b17c3$export$b9d912252344e099 as CurrentColumn};
89
- //# sourceMappingURL=svg.4b9a96c1.js.map
89
+ //# sourceMappingURL=column-views.68409161.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AAQO,SAAS,0CAAkB,KAAK;IACrC,MAAM,UAAE,MAAM,YAAE,QAAQ,SAAE,KAAK,UAAE,MAAM,aAAE,SAAS,aAAE,SAAS,EAAE,GAAG,MAAM,GACtE;IACF,IAAI,SAAE,KAAK,EAAE,GAAG;IAChB,MAAM,MAAM,CAAA,GAAA,aAAK,EAAE;IACnB,MAAM,KAAK,CAAA,GAAA,qBAAa,EAAE;IAC1B,MAAM,SAAE,KAAK,UAAE,MAAM,EAAE,GAAG,MAAM;QAAE,OAAO;QAAG,QAAQ;IAAE;IACtD,IAAI,SAAS,MACX,QAAQ,KAAK,GAAG,CAAC,OAAO,UAAU,IAAI;IAGxC,IAAI,kBAAkB;IAEtB,IAAI,WACF,kBAAkB;QAChB,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cesContent":["import { useRef } from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport { Globe, LandLayer } from \"@macrostrat/svg-map-components\";\nimport { geoCentroid } from \"d3-geo\";\nimport { useElementSize } from \"@macrostrat/ui-components\";\nimport { Columns, CurrentColumn } from \"./layers\";\nimport type { LngLatLike } from \"mapbox-gl\";\n\nexport function ResizableMapFrame(props) {\n const { center, children, style, margin, className, allowZoom, ...rest } =\n props;\n let { scale } = props;\n const ref = useRef(null);\n const sz = useElementSize(ref);\n const { width, height } = sz ?? { width: 0, height: 0 };\n if (scale == null) {\n scale = Math.min(width, height) + 2 * margin;\n }\n\n let zoomScaleExtent = null;\n\n if (allowZoom) {\n zoomScaleExtent = [\n 0.1 * Math.min(width, height),\n 2 * Math.max(width, height),\n ];\n }\n\n return h(\"div.map-area\", { ref, style, className }, [\n h(\n Globe,\n {\n width,\n height,\n margin,\n center,\n allowDrag: true,\n allowZoom,\n keepNorthUp: true,\n zoomScaleExtent,\n ...rest,\n scale,\n },\n [h(LandLayer), children]\n ),\n ]);\n}\n\ntype ColumnNavigationSVGMapProps = any;\nexport type { ColumnNavigationSVGMapProps };\n\nexport function ColumnNavigationSVGMap(props) {\n const {\n currentColumn,\n setCurrentColumn,\n children,\n style,\n margin = 10,\n scale,\n className,\n showInProcessColumns = false,\n showDebugLayers = false,\n center,\n ...rest\n } = props;\n\n let _center: LngLatLike | null = center ?? [-100, 38];\n // Override center if currentColumn is set\n if (currentColumn != null) {\n _center = geoCentroid(currentColumn);\n }\n\n console.log(currentColumn);\n\n return h(\n ResizableMapFrame,\n { center: _center, style, margin, scale, className },\n [\n children,\n h(Columns, {\n onChange: setCurrentColumn,\n col_id: currentColumn?.properties.col_id,\n showDebugLayers,\n ...rest,\n }),\n h.if(showInProcessColumns)(Columns, {\n onChange: setCurrentColumn,\n col_id: currentColumn?.properties.col_id,\n status_code: \"in process\",\n color: \"rgba(200,150,150, 0.5)\",\n ...rest,\n }),\n h.if(currentColumn != null)(CurrentColumn, { fe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AAA,kBAAU,EAAE;IAGxB,QAAQ,GAAG,CAAC;IAEZ,OAAO,CAAA,GAAA,sBAAA,EACL,2CACA;QAAE,QAAQ;eAAS;gBAAO;eAAQ;mBAAO;IAAU,GACnD;QACE;QACA,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,yCAAM,GAAG;YACT,UAAU;YACV,QAAQ,eAAe,WAAW;6BAClC;YACA,GAAG,IAAI;QACT;QACA,CAAA,GAAA,sBAAA,EAAE,EAAE,CAAC,sBAAsB,CAAA,GAAA,yCAAM,GAAG;YAClC,UAAU;YACV,QAAQ,eAAe,WAAW;YAClC,aAAa;YACb,OAAO;YACP,GAAG,IAAI;QACT;QACA,CAAA,GAAA,sBAAA,EAAE,EAAE,CAAC,iBAAiB,MAAM,CAAA,GAAA,yCAAY,GAAG;YAAE,SAAS;QAAc;KACrE;AAEL","sources":["packages/column-views/src/maps/column-navigation/svg/index.ts"],"sourcesContent":["import { useRef } from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport { Globe, LandLayer } from \"@macrostrat/svg-map-components\";\nimport { geoCentroid } from \"d3-geo\";\nimport { useElementSize } from \"@macrostrat/ui-components\";\nimport { Columns, CurrentColumn } from \"./layers\";\nimport type { LngLatLike } from \"mapbox-gl\";\n\nexport function ResizableMapFrame(props) {\n const { center, children, style, margin, className, allowZoom, ...rest } =\n props;\n let { scale } = props;\n const ref = useRef(null);\n const sz = useElementSize(ref);\n const { width, height } = sz ?? { width: 0, height: 0 };\n if (scale == null) {\n scale = Math.min(width, height) + 2 * margin;\n }\n\n let zoomScaleExtent = null;\n\n if (allowZoom) {\n zoomScaleExtent = [\n 0.1 * Math.min(width, height),\n 2 * Math.max(width, height),\n ];\n }\n\n return h(\"div.map-area\", { ref, style, className }, [\n h(\n Globe,\n {\n width,\n height,\n margin,\n center,\n allowDrag: true,\n allowZoom,\n keepNorthUp: true,\n zoomScaleExtent,\n ...rest,\n scale,\n },\n [h(LandLayer), children]\n ),\n ]);\n}\n\ntype ColumnNavigationSVGMapProps = any;\nexport type { ColumnNavigationSVGMapProps };\n\nexport function ColumnNavigationSVGMap(props) {\n const {\n currentColumn,\n setCurrentColumn,\n children,\n style,\n margin = 10,\n scale,\n className,\n showInProcessColumns = false,\n showDebugLayers = false,\n center,\n ...rest\n } = props;\n\n let _center: LngLatLike | null = center ?? [-100, 38];\n // Override center if currentColumn is set\n if (currentColumn != null) {\n _center = geoCentroid(currentColumn);\n }\n\n console.log(currentColumn);\n\n return h(\n ResizableMapFrame,\n { center: _center, style, margin, scale, className },\n [\n children,\n h(Columns, {\n onChange: setCurrentColumn,\n col_id: currentColumn?.properties.col_id,\n showDebugLayers,\n ...rest,\n }),\n h.if(showInProcessColumns)(Columns, {\n onChange: setCurrentColumn,\n col_id: currentColumn?.properties.col_id,\n status_code: \"in process\",\n color: \"rgba(200,150,150, 0.5)\",\n ...rest,\n }),\n h.if(currentColumn != null)(CurrentColumn, { feature: currentColumn }),\n ]\n );\n}\n\nexport * from \"./layers\";\n"],"names":[],"version":3,"file":"column-views.68409161.js.map"}
@@ -67,4 +67,4 @@ $e36693a971586437$export$f94e3d1eb82ee550 = `vpjVaa_unit-details-panel`;
67
67
 
68
68
 
69
69
  export {$e36693a971586437$exports as default};
70
- //# sourceMappingURL=main.module.c09154b1.js.map
70
+ //# sourceMappingURL=column-views.6a954628.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAnBA,4CAAuC,CAAC,yBAAyB,CAAC;AAClE,4CAA8B,CAAC,gBAAgB,CAAC;AAChD,4CAAqC,CAAC,uBAAuB,CAAC;AAC9D,4CAAyC,CAAC,2BAA2B,CAAC;AACtE,4CAA4C,CAAC,8BAA8B,CAAC;AAC5E,4CAAwC,CAAC,0BAA0B,CAAC;AACpE,4CAAoC,CAAC,sBAAsB,CAAC;AAC5D,4CAAsC,CAAC,wBAAwB,CAAC;AAChE,4CAA6C,CAAC,+BAA+B,CAAC;AAC9E,4CAA8B,CAAC,gBAAgB,CAAC;AAChD,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAiC,CAAC,mBAAmB,CAAC;AACtD,4CAAwC,CAAC,0BAA0B,CAAC;AACpE,4CAA8B,CAAC,gBAAgB,CAAC;AAChD,2CAA4B,CAAC,cAAc,CAAC;AAC5C,4CAAoC,CAAC,sBAAsB,CAAC;AAC5D,4CAAgC,CAAC,kBAAkB,CAAC;AACpD,4CAAmC,CAAC,qBAAqB,CAAC;AAC1D,4CAAuC,CAAC,yBAAyB,CAAC","sources":["packages/column-views/src/correlation-chart/main.module.sass"],"sourcesContent":["$map-size: 40em\n$map-size-inset: 12em\n\n.page-header\n display: flex\n flex-direction: row\n justify-content: space-between\n margin-bottom: 1em\n\n.diagram-container\n flex: 1\n position: relative\n min-height: 0\n display: flex\n\n &.map-inset\n .column-selection-map\n position: absolute\n top: 1em\n right: 1em\n height: $map-size-inset\n width: $map-size-inset\n z-index: 1000\n\n &.map-expanded\n flex-direction: row\n gap: 1em\n\n .assistant\n width: 40em\n position: relative\n\n.column-selection-map, .unit-details-panel, .main-area\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3)\n border-radius: 6px\n\n.column-selection-map\n overflow: hidden\n\n .correlation-map\n height: 100%\n position: relative\n\n flex: 1\n min-height: $map-size-inset\n max-height: $map-size\n width: $map-size\n position: relative\n top: 0\n right: 0\n\n.unit-details-panel\n overflow: scroll\n background: var(--panel-secondary-background-color)\n flex: 2\n padding: 1em\n max-width: 100%\n\n.main-area\n position: relative\n flex: 1\n min-height: 0\n min-width: 0\n overflow: scroll\n background-color: var(--panel-secondary-background-color)\n\n\n.correlation-diagram\n padding: 1em\n padding-left: 0\n background-color: var(--panel-secondary-background-color)\n //box-shadow: 0 0 0.3em 0 var(--card-shadow-color)\n --column-background-color: var(--background-color)\n --column-stroke-color: var(--text-color)\n\n\n.package\n position: relative\n\n .package-overlay\n position: absolute\n top: 9px\n left: 0\n border: 2px solid red\n\n .laterally-extensive-unit .strat-col-span\n position: absolute\n border: 2px solid red\n\n .column-container\n display: flex\n flex-direction: row\n\n.map-expanded-button\n position: absolute\n top: 0.5em\n right: 0.5em\n z-index: 100\n\n.main-panel\n position: relative\n height: 100%\n display: flex\n flex-direction: column\n\n.main-chart\n position: relative\n\n.correlation-chart-inner\n display: flex\n flex-direction: row\n position: relative\n\n.age-axis-container\n display: flex\n flex-direction: row\n position: sticky\n left: 0\n z-index: 100\n padding-left: 1em\n padding-right: 2px\n background-color: var(--panel-secondary-background-color)\n"],"names":[],"version":3,"file":"main.module.c09154b1.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAnBA,4CAAuC,CAAC,yBAAyB,CAAC;AAClE,4CAA8B,CAAC,gBAAgB,CAAC;AAChD,4CAAqC,CAAC,uBAAuB,CAAC;AAC9D,4CAAyC,CAAC,2BAA2B,CAAC;AACtE,4CAA4C,CAAC,8BAA8B,CAAC;AAC5E,4CAAwC,CAAC,0BAA0B,CAAC;AACpE,4CAAoC,CAAC,sBAAsB,CAAC;AAC5D,4CAAsC,CAAC,wBAAwB,CAAC;AAChE,4CAA6C,CAAC,+BAA+B,CAAC;AAC9E,4CAA8B,CAAC,gBAAgB,CAAC;AAChD,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAiC,CAAC,mBAAmB,CAAC;AACtD,4CAAwC,CAAC,0BAA0B,CAAC;AACpE,4CAA8B,CAAC,gBAAgB,CAAC;AAChD,2CAA4B,CAAC,cAAc,CAAC;AAC5C,4CAAoC,CAAC,sBAAsB,CAAC;AAC5D,4CAAgC,CAAC,kBAAkB,CAAC;AACpD,4CAAmC,CAAC,qBAAqB,CAAC;AAC1D,4CAAuC,CAAC,yBAAyB,CAAC","sources":["packages/column-views/src/correlation-chart/main.module.sass"],"sourcesContent":["$map-size: 40em\n$map-size-inset: 12em\n\n.page-header\n display: flex\n flex-direction: row\n justify-content: space-between\n margin-bottom: 1em\n\n.diagram-container\n flex: 1\n position: relative\n min-height: 0\n display: flex\n\n &.map-inset\n .column-selection-map\n position: absolute\n top: 1em\n right: 1em\n height: $map-size-inset\n width: $map-size-inset\n z-index: 1000\n\n &.map-expanded\n flex-direction: row\n gap: 1em\n\n .assistant\n width: 40em\n position: relative\n\n.column-selection-map, .unit-details-panel, .main-area\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3)\n border-radius: 6px\n\n.column-selection-map\n overflow: hidden\n\n .correlation-map\n height: 100%\n position: relative\n\n flex: 1\n min-height: $map-size-inset\n max-height: $map-size\n width: $map-size\n position: relative\n top: 0\n right: 0\n\n.unit-details-panel\n overflow: scroll\n background: var(--panel-secondary-background-color)\n flex: 2\n padding: 1em\n max-width: 100%\n\n.main-area\n position: relative\n flex: 1\n min-height: 0\n min-width: 0\n overflow: scroll\n background-color: var(--panel-secondary-background-color)\n\n\n.correlation-diagram\n padding: 1em\n padding-left: 0\n background-color: var(--panel-secondary-background-color)\n //box-shadow: 0 0 0.3em 0 var(--card-shadow-color)\n --column-background-color: var(--background-color)\n --column-stroke-color: var(--text-color)\n\n\n.package\n position: relative\n\n .package-overlay\n position: absolute\n top: 9px\n left: 0\n border: 2px solid red\n\n .laterally-extensive-unit .strat-col-span\n position: absolute\n border: 2px solid red\n\n .column-container\n display: flex\n flex-direction: row\n\n.map-expanded-button\n position: absolute\n top: 0.5em\n right: 0.5em\n z-index: 100\n\n.main-panel\n position: relative\n height: 100%\n display: flex\n flex-direction: column\n\n.main-chart\n position: relative\n\n.correlation-chart-inner\n display: flex\n flex-direction: row\n position: relative\n\n.age-axis-container\n display: flex\n flex-direction: row\n position: sticky\n left: 0\n z-index: 100\n padding-left: 1em\n padding-right: 2px\n background-color: var(--panel-secondary-background-color)\n"],"names":[],"version":3,"file":"column-views.6a954628.js.map"}
@@ -23,4 +23,4 @@
23
23
  .WkKD8q_labeled-unit .WkKD8q_background {
24
24
  fill: var(--column-unit-background-internal, transparent);
25
25
  }
26
- /*# sourceMappingURL=boxes.module.2b5fb18e.css.map */
26
+ /*# sourceMappingURL=column-views.6c670c13.css.map */
@@ -1 +1 @@
1
- {"mappings":"AAAA;;;;AAGA;;;;AAEE;;;;;;;;AAOA;;;;;;AAKA","sources":["packages/column-views/src/units/boxes.module.sass"],"sourcesContent":[".unit-label-container\n pointer-events: none\n\n.labeled-unit\n --column-unit-background-internal: var(--column-unit-background-color, var(--column-background-color))\n :global(.unit-overlay)\n font-size: 10px\n font-style: italic\n display: flex\n align-items: center\n justify-content: center\n\n :global(.unit-label)\n display: block\n color: var(--column-text-color)\n text-shadow: 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal)\n\n .background\n fill: var(--column-unit-background-internal, transparent)\n"],"names":[],"version":3,"file":"boxes.module.2b5fb18e.css.map"}
1
+ {"mappings":"AAAA;;;;AAGA;;;;AAEE;;;;;;;;AAOA;;;;;;AAKA","sources":["packages/column-views/src/units/boxes.module.sass"],"sourcesContent":[".unit-label-container\n pointer-events: none\n\n.labeled-unit\n --column-unit-background-internal: var(--column-unit-background-color, var(--column-background-color))\n :global(.unit-overlay)\n font-size: 10px\n font-style: italic\n display: flex\n align-items: center\n justify-content: center\n\n :global(.unit-label)\n display: block\n color: var(--column-text-color)\n text-shadow: 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal), 0px 0px 4px var(--column-unit-background-internal)\n\n .background\n fill: var(--column-unit-background-internal, transparent)\n"],"names":[],"version":3,"file":"column-views.6c670c13.css.map"}
@@ -52,4 +52,4 @@ function $b8de97dfa82f4910$export$36fed9e0f93a8fde({ children: children, ...defa
52
52
 
53
53
 
54
54
  export {$b8de97dfa82f4910$export$91cb5ac808759b34 as useColumnNav, $b8de97dfa82f4910$export$36fed9e0f93a8fde as ColumnNavProvider};
55
- //# sourceMappingURL=column-nav.5414677c.js.map
55
+ //# sourceMappingURL=column-views.6d6b73b4.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;AAaA,MAAM,qCAAe,CAAA,GAAA,oBAAY,EAA4B;AAEtD,SAAS,0CACd,cAA0B;IAAE,QAAQ;IAAK,SAAS;AAAK,CAAC;IAExD,MAAM,MAAM,CAAA,GAAA,iBAAS,EAAE;IACvB,IAAI,OAAO,MAAM,OAAO;IAExB,MAAM,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,eAAO,EACzC,wCAAkB,CAAA,GAAA,qBAAa,EAAE,OAAO,QAAQ,CAAC,MAAM,MAAM;IAG/D,CAAA,GAAA,gBAAQ,EAAE,IAAM,CAAA,GAAA,qBAAa,EAAE,aAAa;QAAC;KAAW;IAExD,MAAM,UAAE,MAAM,cAAE,UAAU,eAAE,WAAW,EAAE,GAAG;IAE5C,MAAM,mBAAmB,CAAC;QACxB,IAAI,OAAO;QACX,IAAI,gBAAgB,KAClB,OAAO;YAAE,QAAQ,IAAI,UAAU,CAAC,MAAM;wBAAE;yBAAY;QAAY;QAElE,mBAAmB;QACnB,CAAA,GAAA,qBAAa,EAAE;QACf,cAAc;IAChB;IAEA,OAAO;QAAC;QAAY;KAAiB;AACvC;AAEA,SAAS,wCAAkB,MAAW;IACpC,MAAM,UAAE,MAAM,WAAE,OAAO,cAAE,UAAU,eAAE,WAAW,EAAE,GAAG,UAAU,CAAC;IAChE,IAAI,UAAU,MAAM,OAAO;IAC3B,OAAO;gBAAE;iBAAQ;oBAAS;qBAAY;IAAY;AACpD;AAEO,SAAS,0CAAkB,YAAE,QAAQ,EAAE,GAAG,aAAa;IAC5D,kFAAkF,GAClF,MAAM,QAAQ,0CAAa;IAC3B,OAAO,CAAA,GAAA,sBAAA,EAAE,mCAAa,QAAQ,EAAE;eAAE;IAAM,GAAG;AAC7C","sources":["packages/column-views/src/data-provider/column-nav.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport { getQueryString, setQueryString } from \"@macrostrat/ui-components\";\nimport { createContext, useContext, useEffect, useState } from \"react\";\n\nexport interface ColumnArgs {\n col_id?: number;\n unit_id?: number;\n project_id?: number;\n status_code?: \"in process\";\n}\n\ntype ColumnManagerData = [ColumnArgs, (c: ColumnArgs) => void];\n\nconst ColumnNavCtx = createContext<ColumnManagerData | null>(null);\n\nexport function useColumnNav(\n defaultArgs: ColumnArgs = { col_id: 495, unit_id: null }\n): ColumnManagerData {\n const ctx = useContext(ColumnNavCtx);\n if (ctx != null) return ctx;\n\n const [columnArgs, setColumnArgs] = useState<ColumnArgs>(\n extractColumnArgs(getQueryString(window.location.search)) ?? defaultArgs\n );\n\n useEffect(() => setQueryString(columnArgs), [columnArgs]);\n\n const { col_id, project_id, status_code } = columnArgs;\n\n const setCurrentColumn = (obj) => {\n let args = obj;\n if (\"properties\" in obj) {\n args = { col_id: obj.properties.col_id, project_id, status_code };\n }\n // Set query string\n setQueryString(args);\n setColumnArgs(args);\n };\n\n return [columnArgs, setCurrentColumn];\n}\n\nfunction extractColumnArgs(search: any): ColumnArgs | null {\n const { col_id, unit_id, project_id, status_code } = search ?? {};\n if (col_id == null) return null;\n return { col_id, unit_id, project_id, status_code };\n}\n\nexport function ColumnNavProvider({ children, ...defaultArgs }) {\n /** Column navigation provider that manages the query string for selected columns */\n const value = useColumnNav(defaultArgs as any);\n return h(ColumnNavCtx.Provider, { value }, children);\n}\n"],"names":[],"version":3,"file":"column-nav.5414677c.js.map"}
1
+ {"mappings":";;;;;;;AAaA,MAAM,qCAAe,CAAA,GAAA,oBAAY,EAA4B;AAEtD,SAAS,0CACd,cAA0B;IAAE,QAAQ;IAAK,SAAS;AAAK,CAAC;IAExD,MAAM,MAAM,CAAA,GAAA,iBAAS,EAAE;IACvB,IAAI,OAAO,MAAM,OAAO;IAExB,MAAM,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,eAAO,EACzC,wCAAkB,CAAA,GAAA,qBAAa,EAAE,OAAO,QAAQ,CAAC,MAAM,MAAM;IAG/D,CAAA,GAAA,gBAAQ,EAAE,IAAM,CAAA,GAAA,qBAAa,EAAE,aAAa;QAAC;KAAW;IAExD,MAAM,UAAE,MAAM,cAAE,UAAU,eAAE,WAAW,EAAE,GAAG;IAE5C,MAAM,mBAAmB,CAAC;QACxB,IAAI,OAAO;QACX,IAAI,gBAAgB,KAClB,OAAO;YAAE,QAAQ,IAAI,UAAU,CAAC,MAAM;wBAAE;yBAAY;QAAY;QAElE,mBAAmB;QACnB,CAAA,GAAA,qBAAa,EAAE;QACf,cAAc;IAChB;IAEA,OAAO;QAAC;QAAY;KAAiB;AACvC;AAEA,SAAS,wCAAkB,MAAW;IACpC,MAAM,UAAE,MAAM,WAAE,OAAO,cAAE,UAAU,eAAE,WAAW,EAAE,GAAG,UAAU,CAAC;IAChE,IAAI,UAAU,MAAM,OAAO;IAC3B,OAAO;gBAAE;iBAAQ;oBAAS;qBAAY;IAAY;AACpD;AAEO,SAAS,0CAAkB,YAAE,QAAQ,EAAE,GAAG,aAAa;IAC5D,kFAAkF,GAClF,MAAM,QAAQ,0CAAa;IAC3B,OAAO,CAAA,GAAA,sBAAA,EAAE,mCAAa,QAAQ,EAAE;eAAE;IAAM,GAAG;AAC7C","sources":["packages/column-views/src/data-provider/column-nav.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport { getQueryString, setQueryString } from \"@macrostrat/ui-components\";\nimport { createContext, useContext, useEffect, useState } from \"react\";\n\nexport interface ColumnArgs {\n col_id?: number;\n unit_id?: number;\n project_id?: number;\n status_code?: \"in process\";\n}\n\ntype ColumnManagerData = [ColumnArgs, (c: ColumnArgs) => void];\n\nconst ColumnNavCtx = createContext<ColumnManagerData | null>(null);\n\nexport function useColumnNav(\n defaultArgs: ColumnArgs = { col_id: 495, unit_id: null }\n): ColumnManagerData {\n const ctx = useContext(ColumnNavCtx);\n if (ctx != null) return ctx;\n\n const [columnArgs, setColumnArgs] = useState<ColumnArgs>(\n extractColumnArgs(getQueryString(window.location.search)) ?? defaultArgs\n );\n\n useEffect(() => setQueryString(columnArgs), [columnArgs]);\n\n const { col_id, project_id, status_code } = columnArgs;\n\n const setCurrentColumn = (obj) => {\n let args = obj;\n if (\"properties\" in obj) {\n args = { col_id: obj.properties.col_id, project_id, status_code };\n }\n // Set query string\n setQueryString(args);\n setColumnArgs(args);\n };\n\n return [columnArgs, setCurrentColumn];\n}\n\nfunction extractColumnArgs(search: any): ColumnArgs | null {\n const { col_id, unit_id, project_id, status_code } = search ?? {};\n if (col_id == null) return null;\n return { col_id, unit_id, project_id, status_code };\n}\n\nexport function ColumnNavProvider({ children, ...defaultArgs }) {\n /** Column navigation provider that manages the query string for selected columns */\n const value = useColumnNav(defaultArgs as any);\n return h(ColumnNavCtx.Provider, { value }, children);\n}\n"],"names":[],"version":3,"file":"column-views.6d6b73b4.js.map"}
@@ -1,4 +1,4 @@
1
- import {ensureArray as $b6657fba8924a702$export$d0c8ecbd4ed8940c, getUnitHeightRange as $b6657fba8924a702$export$70e712e2ac0237a} from "./utils.d7a43a2a.js";
1
+ import {getUnitHeightRange as $b6657fba8924a702$export$70e712e2ac0237a, ensureArray as $b6657fba8924a702$export$d0c8ecbd4ed8940c} from "./column-views.39657bbf.js";
2
2
  import {ColumnAxisType as $egi9E$ColumnAxisType} from "@macrostrat/column-components";
3
3
  import {scaleLinear as $egi9E$scaleLinear} from "d3-scale";
4
4
 
@@ -219,4 +219,4 @@ function $728f6cf6c12cd490$export$edbf01b435c75274(sections, threshold, opts) {
219
219
 
220
220
 
221
221
  export {$728f6cf6c12cd490$export$e7184dd8bb3302ed as buildCompositeScaleInfo, $728f6cf6c12cd490$export$d6235b492bceb8c5 as createPackageScale, $728f6cf6c12cd490$export$67442a0f5bef147b as finalizeSectionHeights, $728f6cf6c12cd490$export$7d3f3129a1a4b84e as computeSectionHeights, $728f6cf6c12cd490$export$3ada7641926a616d as createCompositeScale, $728f6cf6c12cd490$export$edbf01b435c75274 as collapseUnconformitiesByPixelHeight};
222
- //# sourceMappingURL=composite-scale.577bf64a.js.map
222
+ //# sourceMappingURL=column-views.86c4b36f.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;AA6EO,SAAS,0CACd,WAA6B,EAC7B,kBAA0B;IAE1B;;GAEC,GAED,IAAI,cAAc,qBAAqB;IACvC,IAAI,uBAAuB;IAE3B,MAAM,YAAsC,EAAE;IAC9C,KAAK,MAAM,SAAS,YAAa;QAC/B,MAAM,UAAE,MAAM,cAAE,UAAU,EAAE,GAAG;QAC/B,MAAM,CAAC,OAAO,MAAM,GAAG;QACvB,MAAM,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,OAAO;QAEvC,UAAU,IAAI,CAAC;YACb,GAAG,0CAAmB,OAAO,YAAY;iBACzC;YACA,QAAQ;YACR,oDAAoD;YACpD,YAAY,cAAc;QAC5B;QACA,MAAM,cAAc,aAAa,KAAK,GAAG,CAAC,QAAQ;QAClD,uBAAuB,cAAc;QACrC,cAAc,uBAAuB;IACvC;IACA,eAAe,qBAAqB;IACpC,OAAO;qBACL;QACA,UAAU;IACZ;AACF;AAEO,SAAS,0CACd,QAAmC,EACnC,kBAA0B;IAE1B;;GAEC,GAED,MAAM,gBAAgB,SAAS,GAAG,CAAC,CAAC,IAAM,EAAE,SAAS;IACrD,MAAM,eAAE,WAAW,EAAE,UAAU,QAAQ,EAAE,GAAG,0CAC1C,eACA;IAGF,oCAAoC;IACpC,MAAM,YAAoC,EAAE;IAC5C,IAAK,MAAM,KAAK,SAAU;QACxB,MAAM,QAAQ,QAAQ,CAAC,EAAE;QACzB,MAAM,YAAY,QAAQ,CAAC,EAAE;QAC7B,UAAU,IAAI,CAAC;YACb,GAAG,KAAK;YACR,KAAK,UAAU,GAAG;uBAClB;QACF;IACF;IACA,OAAO;qBACL;QACA,UAAU;IACZ;AACF;AAOO,SAAS,0CACd,QAA0B,EAC1B,IA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K,GAAG,CACN,eAAe,SAAS,CAAC,UAAU,EACnC,YAAY,SAAS,CAAC,UAAU;QAEpC,IAAI,WAAW,WAAW;YACxB,gCAAgC;YAChC,MAAM,oBAAoC;gBACxC,OAAO;uBAAI,eAAe,KAAK;uBAAK,YAAY,KAAK;iBAAC;gBACtD,YAAY;uBACP,CAAA,GAAA,yCAAU,EAAE,eAAe,UAAU;uBACrC,CAAA,GAAA,yCAAU,EAAE,YAAY,UAAU;iBACtC;gBACD,OAAO,KAAK,GAAG,CAAC,eAAe,KAAK,EAAE,YAAY,KAAK;gBACvD,OAAO,KAAK,GAAG,CAAC,eAAe,KAAK,EAAE,YAAY,KAAK;YACzD;YAEA,MAAM,mBAAmB,wCAAkB,mBAAmB;YAC9D,iBAAiB;QACnB,OAAO;YACL,8BAA8B;YAC9B,YAAY,IAAI,CAAC;YACjB,iBAAiB;QACnB;IACF;IACA,IAAI,kBAAkB,MACpB,YAAY,IAAI,CAAC;IAGnB,OAAO;AACT","sources":["packages/column-views/src/prepare-units/composite-scale.ts"],"sourcesContent":["import type { ExtUnit, SectionInfo } from \"./helpers\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport { ensureArray, getUnitHeightRange } from \"./utils\";\nimport { ScaleLinear, scaleLinear } from \"d3-scale\";\nimport { UnitLong } from \"@macrostrat/api-types\";\n\nexport interface ColumnHeightScaleOptions {\n /** A fixed pixel scale to use for the section (pixels per Myr) */\n pixelScale?: number;\n /** The target height of a constituent unit in pixels, for dynamic\n * scale generation */\n targetUnitHeight?: number;\n /** Min height of a section in pixels. Will override minPixelScale in some cases. */\n minSectionHeight?: number;\n /** The minimum pixel scale to use for the section (pixels per Myr). This is mostly\n * needed because small sections (<1-2 units) don't necessarily have space to comfortably\n * render two axis labels */\n minPixelScale?: number;\n // Axis scale type\n axisType?: ColumnAxisType;\n // Unconformity height in pixels\n unconformityHeight?: number;\n // Whether to collapse unconformities that are less than a height threshold\n collapseSmallUnconformities?: boolean | number;\n}\n\nexport interface SectionScaleOptions extends ColumnHeightScaleOptions {\n axisType: ColumnAxisType;\n domain: [number, number];\n}\n\nexport interface LinearScaleDef {\n domain: [number, number];\n pixelScale: number;\n}\n\n/** Output of a section scale. For now, this assumes that the\n * mapping is linear, but it could be extended to support arbitrary\n * scale functions.\n */\nexport interface PackageScaleInfo extends LinearScaleDef {\n pixelHeight: number;\n // TODO: add a function\n scale: ScaleLinear<number, number>;\n}\n\nexport type PackageScaleLayoutData = PackageScaleInfo & {\n // A unique key for the section to use in React\n key: string;\n offset: number;\n // How much to\n paddingTop: number;\n};\n\nexport type PackageLayoutData<T extends UnitLong = ExtUnit> = SectionInfo<T> & {\n scaleInfo: PackageScaleLayoutData;\n // A unique key for the section to use in React\n key: string;\n};\n\nexport interface CompositeScaleData {\n totalHeight: number;\n sections: PackageScaleLayoutData[];\n}\n\nexport interface ColumnScaleOptions extends ColumnHeightScaleOptions {\n axisType: ColumnAxisType;\n unconformityHeight: number;\n}\n\n// Composite scale information augmented with units in each package\n\nexport interface CompositeColumnData<T extends UnitLong = ExtUnit>\n extends Omit<CompositeScaleData, \"sections\"> {\n sections: PackageLayoutData<T>[];\n}\n\nexport function buildCompositeScaleInfo(\n inputScales: LinearScaleDef[],\n unconformityHeight: number\n): CompositeScaleData {\n /** Finalize the heights of sections, including the heights of unconformities\n * between them.\n */\n\n let totalHeight = unconformityHeight / 2;\n let lastSectionTopHeight = 0;\n\n const packages2: PackageScaleLayoutData[] = [];\n for (const group of inputScales) {\n const { domain, pixelScale } = group;\n const [b_age, t_age] = domain;\n const key = `package-${b_age}-${t_age}`;\n\n packages2.push({\n ...createPackageScale(group, totalHeight),\n key,\n offset: totalHeight,\n // Unconformity height above this particular section\n paddingTop: totalHeight - lastSectionTopHeight,\n });\n const pixelHeight = pixelScale * Math.abs(b_age - t_age);\n lastSectionTopHeight = totalHeight + pixelHeight;\n totalHeight = lastSectionTopHeight + unconformityHeight;\n }\n totalHeight += unconformityHeight / 2;\n return {\n totalHeight,\n sections: packages2,\n };\n}\n\nexport function finalizeSectionHeights<T extends UnitLong>(\n sections: SectionInfoWithScale<T>[],\n unconformityHeight: number\n): CompositeColumnData<T> {\n /** Finalize the heights of sections, including the heights of unconformities\n * between them.\n */\n\n const sectionScales = sections.map((d) => d.scaleInfo);\n const { totalHeight, sections: packages } = buildCompositeScaleInfo(\n sectionScales,\n unconformityHeight\n );\n\n // This could perhaps be simplified.\n const sections1: PackageLayoutData<T>[] = [];\n for (const i in sections) {\n const group = sections[i];\n const scaleInfo = packages[i];\n sections1.push({\n ...group,\n key: scaleInfo.key,\n scaleInfo,\n });\n }\n return {\n totalHeight,\n sections: sections1,\n };\n}\n\ninterface SectionInfoWithScale<T extends UnitLong = ExtUnit>\n extends SectionInfo<T> {\n scaleInfo: PackageScaleInfo;\n}\n\nexport function computeSectionHeights<T extends UnitLong>(\n sections: SectionInfo<T>[],\n opts: ColumnScaleOptions\n): SectionInfoWithScale<T>[] {\n return sections.map((group) => {\n return addScaleToSection<T>(group, opts);\n });\n}\n\nfunction addScaleToSection<T extends UnitLong = ExtUnit>(\n group: SectionInfo<T>,\n opts: ColumnScaleOptions\n): SectionInfoWithScale<T> {\n const { t_age, b_age, units } = group;\n let _range = null;\n // if t_age and b_age are set for a group, use them to define the range...\n if (t_age != null && b_age != null && opts.axisType == ColumnAxisType.AGE) {\n _range = [b_age, t_age];\n }\n\n const scaleInfo = buildSectionScale<T>(units, {\n ...opts,\n domain: _range,\n });\n\n return {\n ...group,\n scaleInfo,\n };\n}\n\nfunction buildSectionScale<T extends UnitLong>(\n data: T[],\n opts: SectionScaleOptions\n): PackageScaleInfo {\n const {\n targetUnitHeight = 20,\n minPixelScale = 0.2,\n axisType,\n minSectionHeight,\n } = opts;\n const domain = opts.domain ?? findSectionHeightRange(data, axisType);\n\n const dAge = Math.abs(domain[0] - domain[1]);\n\n let _pixelScale = opts.pixelScale;\n if (_pixelScale == null) {\n const avgAgeRange = findAverageUnitHeight(data, axisType);\n // Get pixel height necessary to render average unit at target height\n _pixelScale = Math.max(targetUnitHeight / avgAgeRange, minPixelScale);\n\n // OLD METHOD that cares about overall section height vs. individual unit height\n // 0.2 pixel per myr is the floor scale\n //const targetHeight = targetUnitHeight * data.length;\n // 1 pixel per myr is the floor scale\n //_pixelScale = Math.max(targetHeight / dAge, minPixelScale);\n }\n\n let height = dAge * _pixelScale;\n\n // If height is less than minSectionHeight, set it to minSectionHeight\n const _minSectionHeight = minSectionHeight ?? targetUnitHeight ?? 0;\n height = Math.max(height, _minSectionHeight);\n _pixelScale = height / dAge;\n\n return createPackageScale({ domain, pixelScale: _pixelScale }, 0);\n}\n\nexport function createPackageScale(\n def: LinearScaleDef,\n offset: number = 0\n): PackageScaleInfo {\n /** Build a section scale */\n // Domain should be oriented from bottom to top, but scale is oriented from top to bottom\n const { domain, pixelScale } = def;\n const pixelHeight = pixelScale * Math.abs(domain[0] - domain[1]);\n return {\n domain,\n pixelScale,\n pixelHeight,\n scale: scaleLinear()\n .domain([domain[1], domain[0]])\n .range([offset, pixelHeight + offset]),\n };\n}\n\nfunction findSectionHeightRange(\n data: UnitLong[],\n axisType: ColumnAxisType\n): [number, number] {\n if (axisType == null) {\n throw new Error(\"Axis type is not set\");\n }\n if (axisType === ColumnAxisType.AGE) {\n const t_age = Math.min(...data.map((d) => d.t_age));\n const b_age = Math.max(...data.map((d) => d.b_age));\n return [b_age, t_age];\n } else if (\n axisType == ColumnAxisType.DEPTH ||\n axisType == ColumnAxisType.ORDINAL\n ) {\n const t_pos = Math.min(...data.map((d) => d.t_pos));\n const b_pos = Math.max(...data.map((d) => d.b_pos));\n return [b_pos, t_pos];\n } else if (axisType == ColumnAxisType.HEIGHT) {\n const t_pos = Math.max(...data.map((d) => d.t_pos));\n const b_pos = Math.min(...data.map((d) => d.b_pos));\n return [b_pos, t_pos];\n }\n}\n\nfunction findAverageUnitHeight(\n data: UnitLong[],\n axisType: ColumnAxisType\n): number {\n const unitHeights = data.map((d) => {\n const [b_pos, t_pos] = getUnitHeightRange(d, axisType);\n return Math.abs(b_pos - t_pos);\n });\n return unitHeights.reduce((a, b) => a + b, 0) / unitHeights.length;\n}\n\nexport function createCompositeScale(\n sections: PackageLayoutData[],\n interpolateUnconformities: boolean = false\n): (age: number) => number | null {\n /** Create a scale that works across multiple packages */\n // Get surfaces at which scale breaks\n let scaleBreaks: [number, number][] = [];\n for (const section of sections) {\n const { pixelHeight, pixelScale, offset, domain } = section.scaleInfo;\n\n scaleBreaks.push([domain[1], offset]);\n scaleBreaks.push([domain[0], offset + pixelHeight]);\n }\n // Sort the scale breaks by age\n scaleBreaks.sort((a, b) => a[0] - b[0]);\n\n return (age) => {\n /** Given an age, find the corresponding pixel position */\n // Iterate through the sections to find the correct one\n\n // Accumulate scale breaks and pixel height\n let pixelHeight = 0;\n let pixelScale = 0;\n let lastAge = null;\n for (const [age1, height] of scaleBreaks) {\n if (age <= age1) {\n if (lastAge != null) {\n pixelHeight += (age - lastAge) * pixelScale;\n return pixelHeight;\n }\n lastAge = age;\n pixelHeight = height;\n }\n }\n };\n}\n\n/** Collapse sections separated by unconformities that are smaller than a given pixel height. */\nexport function collapseUnconformitiesByPixelHeight<T extends UnitLong>(\n sections: SectionInfoWithScale<T>[],\n threshold: number,\n opts: ColumnScaleOptions\n): SectionInfoWithScale<T>[] {\n const newSections = [];\n let currentSection: SectionInfoWithScale<T> | null = null;\n for (const nextSection of sections) {\n if (currentSection == null) {\n currentSection = nextSection;\n continue;\n }\n const dAge = Math.abs(nextSection.t_age - currentSection.b_age);\n const pxHeight =\n dAge *\n Math.max(\n currentSection.scaleInfo.pixelScale,\n nextSection.scaleInfo.pixelScale\n );\n if (pxHeight < threshold) {\n // We need to merge the sections\n const compositeSection0: SectionInfo<T> = {\n units: [...currentSection.units, ...nextSection.units],\n section_id: [\n ...ensureArray(currentSection.section_id),\n ...ensureArray(nextSection.section_id),\n ],\n t_age: Math.min(currentSection.t_age, nextSection.t_age),\n b_age: Math.max(currentSection.b_age, nextSection.b_age),\n };\n\n const compositeSection = addScaleToSection(compositeSection0, opts);\n currentSection = compositeSection;\n } else {\n // We need to keep the section\n newSections.push(currentSection);\n currentSection = nextSection;\n }\n }\n if (currentSection != null) {\n newSections.push(currentSection);\n }\n\n return newSections;\n}\n"],"names":[],"version":3,"file":"composite-scale.577bf64a.js.map"}
1
+ {"mappings":";;;;;;;AA6EO,SAAS,0CACd,WAA6B,EAC7B,kBAA0B;IAE1B;;GAEC,GAED,IAAI,cAAc,qBAAqB;IACvC,IAAI,uBAAuB;IAE3B,MAAM,YAAsC,EAAE;IAC9C,KAAK,MAAM,SAAS,YAAa;QAC/B,MAAM,UAAE,MAAM,cAAE,UAAU,EAAE,GAAG;QAC/B,MAAM,CAAC,OAAO,MAAM,GAAG;QACvB,MAAM,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,OAAO;QAEvC,UAAU,IAAI,CAAC;YACb,GAAG,0CAAmB,OAAO,YAAY;iBACzC;YACA,QAAQ;YACR,oDAAoD;YACpD,YAAY,cAAc;QAC5B;QACA,MAAM,cAAc,aAAa,KAAK,GAAG,CAAC,QAAQ;QAClD,uBAAuB,cAAc;QACrC,cAAc,uBAAuB;IACvC;IACA,eAAe,qBAAqB;IACpC,OAAO;qBACL;QACA,UAAU;IACZ;AACF;AAEO,SAAS,0CACd,QAAmC,EACnC,kBAA0B;IAE1B;;GAEC,GAED,MAAM,gBAAgB,SAAS,GAAG,CAAC,CAAC,IAAM,EAAE,SAAS;IACrD,MAAM,eAAE,WAAW,EAAE,UAAU,QAAQ,EAAE,GAAG,0CAC1C,eACA;IAGF,oCAAoC;IACpC,MAAM,YAAoC,EAAE;IAC5C,IAAK,MAAM,KAAK,SAAU;QACxB,MAAM,QAAQ,QAAQ,CAAC,EAAE;QACzB,MAAM,YAAY,QAAQ,CAAC,EAAE;QAC7B,UAAU,IAAI,CAAC;YACb,GAAG,KAAK;YACR,KAAK,UAAU,GAAG;uBAClB;QACF;IACF;IACA,OAAO;qBACL;QACA,UAAU;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GAAG,eAAe,KAAK;QAC9D,MAAM,WACJ,OACA,KAAK,GAAG,CACN,eAAe,SAAS,CAAC,UAAU,EACnC,YAAY,SAAS,CAAC,UAAU;QAEpC,IAAI,WAAW,WAAW;YACxB,gCAAgC;YAChC,MAAM,oBAAoC;gBACxC,OAAO;uBAAI,eAAe,KAAK;uBAAK,YAAY,KAAK;iBAAC;gBACtD,YAAY;uBACP,CAAA,GAAA,yCAAU,EAAE,eAAe,UAAU;uBACrC,CAAA,GAAA,yCAAU,EAAE,YAAY,UAAU;iBACtC;gBACD,OAAO,KAAK,GAAG,CAAC,eAAe,KAAK,EAAE,YAAY,KAAK;gBACvD,OAAO,KAAK,GAAG,CAAC,eAAe,KAAK,EAAE,YAAY,KAAK;YACzD;YAEA,MAAM,mBAAmB,wCAAkB,mBAAmB;YAC9D,iBAAiB;QACnB,OAAO;YACL,8BAA8B;YAC9B,YAAY,IAAI,CAAC;YACjB,iBAAiB;QACnB;IACF;IACA,IAAI,kBAAkB,MACpB,YAAY,IAAI,CAAC;IAGnB,OAAO;AACT","sources":["packages/column-views/src/prepare-units/composite-scale.ts"],"sourcesContent":["import type { ExtUnit, SectionInfo } from \"./helpers\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport { ensureArray, getUnitHeightRange } from \"./utils\";\nimport { ScaleLinear, scaleLinear } from \"d3-scale\";\nimport { UnitLong } from \"@macrostrat/api-types\";\n\nexport interface ColumnHeightScaleOptions {\n /** A fixed pixel scale to use for the section (pixels per Myr) */\n pixelScale?: number;\n /** The target height of a constituent unit in pixels, for dynamic\n * scale generation */\n targetUnitHeight?: number;\n /** Min height of a section in pixels. Will override minPixelScale in some cases. */\n minSectionHeight?: number;\n /** The minimum pixel scale to use for the section (pixels per Myr). This is mostly\n * needed because small sections (<1-2 units) don't necessarily have space to comfortably\n * render two axis labels */\n minPixelScale?: number;\n // Axis scale type\n axisType?: ColumnAxisType;\n // Unconformity height in pixels\n unconformityHeight?: number;\n // Whether to collapse unconformities that are less than a height threshold\n collapseSmallUnconformities?: boolean | number;\n}\n\nexport interface SectionScaleOptions extends ColumnHeightScaleOptions {\n axisType: ColumnAxisType;\n domain: [number, number];\n}\n\nexport interface LinearScaleDef {\n domain: [number, number];\n pixelScale: number;\n}\n\n/** Output of a section scale. For now, this assumes that the\n * mapping is linear, but it could be extended to support arbitrary\n * scale functions.\n */\nexport interface PackageScaleInfo extends LinearScaleDef {\n pixelHeight: number;\n // TODO: add a function\n scale: ScaleLinear<number, number>;\n}\n\nexport type PackageScaleLayoutData = PackageScaleInfo & {\n // A unique key for the section to use in React\n key: string;\n offset: number;\n // How much to\n paddingTop: number;\n};\n\nexport type PackageLayoutData<T extends UnitLong = ExtUnit> = SectionInfo<T> & {\n scaleInfo: PackageScaleLayoutData;\n // A unique key for the section to use in React\n key: string;\n};\n\nexport interface CompositeScaleData {\n totalHeight: number;\n sections: PackageScaleLayoutData[];\n}\n\nexport interface ColumnScaleOptions extends ColumnHeightScaleOptions {\n axisType: ColumnAxisType;\n unconformityHeight: number;\n}\n\n// Composite scale information augmented with units in each package\n\nexport interface CompositeColumnData<T extends UnitLong = ExtUnit>\n extends Omit<CompositeScaleData, \"sections\"> {\n sections: PackageLayoutData<T>[];\n}\n\nexport function buildCompositeScaleInfo(\n inputScales: LinearScaleDef[],\n unconformityHeight: number\n): CompositeScaleData {\n /** Finalize the heights of sections, including the heights of unconformities\n * between them.\n */\n\n let totalHeight = unconformityHeight / 2;\n let lastSectionTopHeight = 0;\n\n const packages2: PackageScaleLayoutData[] = [];\n for (const group of inputScales) {\n const { domain, pixelScale } = group;\n const [b_age, t_age] = domain;\n const key = `package-${b_age}-${t_age}`;\n\n packages2.push({\n ...createPackageScale(group, totalHeight),\n key,\n offset: totalHeight,\n // Unconformity height above this particular section\n paddingTop: totalHeight - lastSectionTopHeight,\n });\n const pixelHeight = pixelScale * Math.abs(b_age - t_age);\n lastSectionTopHeight = totalHeight + pixelHeight;\n totalHeight = lastSectionTopHeight + unconformityHeight;\n }\n totalHeight += unconformityHeight / 2;\n return {\n totalHeight,\n sections: packages2,\n };\n}\n\nexport function finalizeSectionHeights<T extends UnitLong>(\n sections: SectionInfoWithScale<T>[],\n unconformityHeight: number\n): CompositeColumnData<T> {\n /** Finalize the heights of sections, including the heights of unconformities\n * between them.\n */\n\n const sectionScales = sections.map((d) => d.scaleInfo);\n const { totalHeight, sections: packages } = buildCompositeScaleInfo(\n sectionScales,\n unconformityHeight\n );\n\n // This could perhaps be simplified.\n const sections1: PackageLayoutData<T>[] = [];\n for (const i in sections) {\n const group = sections[i];\n const scaleInfo = packages[i];\n sections1.push({\n ...group,\n key: scaleInfo.key,\n scaleInfo,\n });\n }\n return {\n totalHeight,\n sections: sections1,\n };\n}\n\ninterface SectionInfoWithScale<T extends UnitLong = ExtUnit>\n extends SectionInfo<T> {\n scaleInfo: PackageScaleInfo;\n}\n\nexport function computeSectionHeights<T extends UnitLong>(\n sections: SectionInfo<T>[],\n opts: ColumnScaleOptions\n): SectionInfoWithScale<T>[] {\n return sections.map((group) => {\n return addScaleToSection<T>(group, opts);\n });\n}\n\nfunction addScaleToSection<T extends UnitLong = ExtUnit>(\n group: SectionInfo<T>,\n opts: ColumnScaleOptions\n): SectionInfoWithScale<T> {\n const { t_age, b_age, units } = group;\n let _range = null;\n // if t_age and b_age are set for a group, use them to define the range...\n if (t_age != null && b_age != null && opts.axisType == ColumnAxisType.AGE) {\n _range = [b_age, t_age];\n }\n\n const scaleInfo = buildSectionScale<T>(units, {\n ...opts,\n domain: _range,\n });\n\n return {\n ...group,\n scaleInfo,\n };\n}\n\nfunction buildSectionScale<T extends UnitLong>(\n data: T[],\n opts: SectionScaleOptions\n): PackageScaleInfo {\n const {\n targetUnitHeight = 20,\n minPixelScale = 0.2,\n axisType,\n minSectionHeight,\n } = opts;\n const domain = opts.domain ?? findSectionHeightRange(data, axisType);\n\n const dAge = Math.abs(domain[0] - domain[1]);\n\n let _pixelScale = opts.pixelScale;\n if (_pixelScale == null) {\n const avgAgeRange = findAverageUnitHeight(data, axisType);\n // Get pixel height necessary to render average unit at target height\n _pixelScale = Math.max(targetUnitHeight / avgAgeRange, minPixelScale);\n\n // OLD METHOD that cares about overall section height vs. individual unit height\n // 0.2 pixel per myr is the floor scale\n //const targetHeight = targetUnitHeight * data.length;\n // 1 pixel per myr is the floor scale\n //_pixelScale = Math.max(targetHeight / dAge, minPixelScale);\n }\n\n let height = dAge * _pixelScale;\n\n // If height is less than minSectionHeight, set it to minSectionHeight\n const _minSectionHeight = minSectionHeight ?? targetUnitHeight ?? 0;\n height = Math.max(height, _minSectionHeight);\n _pixelScale = height / dAge;\n\n return createPackageScale({ domain, pixelScale: _pixelScale }, 0);\n}\n\nexport function createPackageScale(\n def: LinearScaleDef,\n offset: number = 0\n): PackageScaleInfo {\n /** Build a section scale */\n // Domain should be oriented from bottom to top, but scale is oriented from top to bottom\n const { domain, pixelScale } = def;\n const pixelHeight = pixelScale * Math.abs(domain[0] - domain[1]);\n return {\n domain,\n pixelScale,\n pixelHeight,\n scale: scaleLinear()\n .domain([domain[1], domain[0]])\n .range([offset, pixelHeight + offset]),\n };\n}\n\nfunction findSectionHeightRange(\n data: UnitLong[],\n axisType: ColumnAxisType\n): [number, number] {\n if (axisType == null) {\n throw new Error(\"Axis type is not set\");\n }\n if (axisType === ColumnAxisType.AGE) {\n const t_age = Math.min(...data.map((d) => d.t_age));\n const b_age = Math.max(...data.map((d) => d.b_age));\n return [b_age, t_age];\n } else if (\n axisType == ColumnAxisType.DEPTH ||\n axisType == ColumnAxisType.ORDINAL\n ) {\n const t_pos = Math.min(...data.map((d) => d.t_pos));\n const b_pos = Math.max(...data.map((d) => d.b_pos));\n return [b_pos, t_pos];\n } else if (axisType == ColumnAxisType.HEIGHT) {\n const t_pos = Math.max(...data.map((d) => d.t_pos));\n const b_pos = Math.min(...data.map((d) => d.b_pos));\n return [b_pos, t_pos];\n }\n}\n\nfunction findAverageUnitHeight(\n data: UnitLong[],\n axisType: ColumnAxisType\n): number {\n const unitHeights = data.map((d) => {\n const [b_pos, t_pos] = getUnitHeightRange(d, axisType);\n return Math.abs(b_pos - t_pos);\n });\n return unitHeights.reduce((a, b) => a + b, 0) / unitHeights.length;\n}\n\nexport function createCompositeScale(\n sections: PackageLayoutData[],\n interpolateUnconformities: boolean = false\n): (age: number) => number | null {\n /** Create a scale that works across multiple packages */\n // Get surfaces at which scale breaks\n let scaleBreaks: [number, number][] = [];\n for (const section of sections) {\n const { pixelHeight, pixelScale, offset, domain } = section.scaleInfo;\n\n scaleBreaks.push([domain[1], offset]);\n scaleBreaks.push([domain[0], offset + pixelHeight]);\n }\n // Sort the scale breaks by age\n scaleBreaks.sort((a, b) => a[0] - b[0]);\n\n return (age) => {\n /** Given an age, find the corresponding pixel position */\n // Iterate through the sections to find the correct one\n\n // Accumulate scale breaks and pixel height\n let pixelHeight = 0;\n let pixelScale = 0;\n let lastAge = null;\n for (const [age1, height] of scaleBreaks) {\n if (age <= age1) {\n if (lastAge != null) {\n pixelHeight += (age - lastAge) * pixelScale;\n return pixelHeight;\n }\n lastAge = age;\n pixelHeight = height;\n }\n }\n };\n}\n\n/** Collapse sections separated by unconformities that are smaller than a given pixel height. */\nexport function collapseUnconformitiesByPixelHeight<T extends UnitLong>(\n sections: SectionInfoWithScale<T>[],\n threshold: number,\n opts: ColumnScaleOptions\n): SectionInfoWithScale<T>[] {\n const newSections = [];\n let currentSection: SectionInfoWithScale<T> | null = null;\n for (const nextSection of sections) {\n if (currentSection == null) {\n currentSection = nextSection;\n continue;\n }\n const dAge = Math.abs(nextSection.t_age - currentSection.b_age);\n const pxHeight =\n dAge *\n Math.max(\n currentSection.scaleInfo.pixelScale,\n nextSection.scaleInfo.pixelScale\n );\n if (pxHeight < threshold) {\n // We need to merge the sections\n const compositeSection0: SectionInfo<T> = {\n units: [...currentSection.units, ...nextSection.units],\n section_id: [\n ...ensureArray(currentSection.section_id),\n ...ensureArray(nextSection.section_id),\n ],\n t_age: Math.min(currentSection.t_age, nextSection.t_age),\n b_age: Math.max(currentSection.b_age, nextSection.b_age),\n };\n\n const compositeSection = addScaleToSection(compositeSection0, opts);\n currentSection = compositeSection;\n } else {\n // We need to keep the section\n newSections.push(currentSection);\n currentSection = nextSection;\n }\n }\n if (currentSection != null) {\n newSections.push(currentSection);\n }\n\n return newSections;\n}\n"],"names":[],"version":3,"file":"column-views.86c4b36f.js.map"}
@@ -1,9 +1,9 @@
1
- import {UnitDetailsPanel as $448b24baeef3b229$export$fbd245232df17557, LegendPanelHeader as $448b24baeef3b229$export$fc503c39cc5cff43, UnitDetailsFeature as $448b24baeef3b229$export$ec297f6f9a6ccad0, Duration as $448b24baeef3b229$export$3b11bc38611c5941} from "./panel.598f76a5.js";
2
- import {UnitDetailsPopover as $a9bcb536274d1bf9$export$6716aecc2c9afbe2, UnitSelectionPopover as $a9bcb536274d1bf9$export$db1115efab13710d} from "./popover.a810b7bc.js";
1
+ import {UnitDetailsPanel as $448b24baeef3b229$export$fbd245232df17557, LegendPanelHeader as $448b24baeef3b229$export$fc503c39cc5cff43, UnitDetailsFeature as $448b24baeef3b229$export$ec297f6f9a6ccad0, Duration as $448b24baeef3b229$export$3b11bc38611c5941} from "./column-views.1ece326b.js";
2
+ import {UnitDetailsPopover as $a9bcb536274d1bf9$export$6716aecc2c9afbe2, UnitSelectionPopover as $a9bcb536274d1bf9$export$db1115efab13710d} from "./column-views.f2e5a72f.js";
3
3
 
4
4
 
5
5
 
6
6
 
7
7
 
8
8
  export {$448b24baeef3b229$export$fbd245232df17557 as UnitDetailsPanel, $448b24baeef3b229$export$fc503c39cc5cff43 as LegendPanelHeader, $448b24baeef3b229$export$ec297f6f9a6ccad0 as UnitDetailsFeature, $448b24baeef3b229$export$3b11bc38611c5941 as Duration, $a9bcb536274d1bf9$export$6716aecc2c9afbe2 as UnitDetailsPopover, $a9bcb536274d1bf9$export$db1115efab13710d as UnitSelectionPopover};
9
- //# sourceMappingURL=unit-details.071cefed.js.map
9
+ //# sourceMappingURL=column-views.88de2cee.js.map
@@ -1 +1 @@
1
- {"mappings":"","sources":["packages/column-views/src/unit-details/index.ts"],"sourcesContent":["export * from \"./panel\";\nexport * from \"./popover\";\n"],"names":[],"version":3,"file":"unit-details.071cefed.js.map"}
1
+ {"mappings":"","sources":["packages/column-views/src/unit-details/index.ts"],"sourcesContent":["export * from \"./panel\";\nexport * from \"./popover\";\n"],"names":[],"version":3,"file":"column-views.88de2cee.js.map"}
@@ -54,7 +54,9 @@ const $d3e69bd163d41f63$var$symbolIndex = {
54
54
  diamictite: 681
55
55
  };
56
56
  const $d3e69bd163d41f63$export$7be7d732f3de9464 = (d)=>{
57
- let liths = d.lith;
57
+ let liths = [
58
+ ...d.lith
59
+ ];
58
60
  let environs = d.environ.map((d)=>d.name).join(" ");
59
61
  liths.sort((a, b)=>b.prop - a.prop);
60
62
  //console.log(d, d.unit_name, liths.map(d => d.name), environs)
@@ -91,4 +93,4 @@ const $d3e69bd163d41f63$export$e8deec7b02ce51eb = (id)=>{
91
93
 
92
94
 
93
95
  export {$d3e69bd163d41f63$export$7be7d732f3de9464 as resolveID, $d3e69bd163d41f63$export$e8deec7b02ce51eb as scalePattern};
94
- //# sourceMappingURL=resolvers.36013b49.js.map
96
+ //# sourceMappingURL=column-views.8dd877af.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAAA,MAAM,oCAAc;IAClB,sBAAsB;IACtB,eAAe;IACf,WAAW;IACX,kBAAkB;IAClB,aAAa;IACb,MAAM;IACN,WAAW;IACX,MAAM;IACN,eAAe;IACf,KAAK;IACL,uBAAuB;IACvB,OAAO;IACP,WAAW;IACX,UAAU;IACV,cAAc;IACd,WAAW;IACX,qBAAqB;IACrB,WAAW;IACX,UAAU;IACV,OAAO;IACP,kBAAkB;IAClB,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,WAAW;IACX,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,UAAU;IACV,UAAU;IACV,MAAM;IACN,OAAO;IACP,m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,GAAG,IAAI,CAAC,IAAI;AAClC","sources":["packages/column-views/src/units/resolvers.ts"],"sourcesContent":["const symbolIndex = {\n \"dolomite-limestone\": 641,\n lime_mudstone: 627,\n sandstone: 607,\n \"quartz arenite\": 607,\n litharenite: 608,\n sand: 608,\n siltstone: 616,\n silt: 616,\n siliciclastic: 615,\n mud: 620,\n \"dolomitic siltstone\": 616,\n shale: 620,\n limestone: 627,\n dolomite: 642,\n conglomerate: 602,\n carbonate: 627,\n \"dolomite-mudstone\": 642,\n dolostone: 642,\n mudstone: 620,\n slate: 703,\n \"sandy-dolomite\": 645,\n quartzite: 702,\n halite: 668,\n gypsum: 667,\n evaporite: 667,\n claystone: 620,\n anhydrite: 667,\n gabbro: 720,\n basalt: 717,\n diabase: 717,\n rhyolite: 722,\n andesite: 723,\n till: 681,\n loess: 684,\n \"calcareous ooze\": 653,\n \"siliceous ooze\": 653,\n chalk: 626,\n gravel: 601,\n plutonic: 721,\n granite: 719,\n clay: 660,\n syenite: 722,\n tuff: 711,\n volcanic: 725,\n metamorphic: 707,\n volcaniclastic: 714,\n migmatite: 709,\n gneiss: 708,\n tonalite: 727,\n granodiorite: 725,\n monzonite: 723,\n argillite: 624,\n diamictite: 681,\n};\n\nconst resolveID = (d: any) => {\n let liths = [...d.lith];\n let environs = d.environ.map((d) => d.name).join(\" \");\n liths.sort((a, b) => b.prop - a.prop);\n\n //console.log(d, d.unit_name, liths.map(d => d.name), environs)\n\n let sym = null;\n\n // overrides for IODP columns\n if (d.unit_name == \"clay\") {\n return \"650\";\n }\n if (d.unit_name == \"calcareous clay\") {\n return \"651\";\n }\n\n for (const k of liths) {\n if (k.name == \"sandstone\") {\n // Special cases for sandstone\n if (environs.includes(\"dune\")) {\n return \"609\";\n }\n if (environs.includes(\"marine\")) {\n return \"608\";\n }\n if (environs.includes(\"shore\")) {\n return \"611\";\n }\n if (environs.includes(\"loess\")) {\n return \"686\";\n }\n }\n\n if (k.name == \"conglomerate\") {\n // Special cases for sandstone\n if (environs.includes(\"fluvial\")) {\n return \"603\";\n }\n }\n\n if (k.name.includes(\"tuff\")) {\n return \"711\";\n }\n sym = symbolIndex[k.name];\n if (sym != null) {\n return sym;\n }\n\n if (k.type == \"volcanic\") {\n return \"725\";\n }\n }\n return sym;\n};\n\nconst patternScale = {\n \"609\": 1.5,\n \"603\": 1.5,\n};\n\nconst scalePattern = (id) => {\n return patternScale[`${id}`] ?? 1;\n};\n\nexport { resolveID, scalePattern };\n"],"names":[],"version":3,"file":"column-views.8dd877af.js.map"}
@@ -140,4 +140,4 @@ function $4d5d1c15f39f6a14$export$70f5ee19650fc7d1({ units: units }) {
140
140
 
141
141
 
142
142
  export {$4d5d1c15f39f6a14$export$77a278d5ca56e309 as useUnitSelectionDispatch, $4d5d1c15f39f6a14$export$b220b1d3591dc9e5 as useUnitSelectionStore, $4d5d1c15f39f6a14$export$f0dd93f90aa8e5da as useSelectedUnit, $4d5d1c15f39f6a14$export$f19d75b1d4b676a4 as UnitSelectionProvider, $4d5d1c15f39f6a14$export$cbbec12b1451fe7d as useUnitSelectionTarget, $4d5d1c15f39f6a14$export$70f5ee19650fc7d1 as UnitKeyboardNavigation};
143
- //# sourceMappingURL=selection.f5b0297e.js.map
143
+ //# sourceMappingURL=column-views.8e51206e.js.map