@macrostrat/column-views 1.0.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/esm/_shared.f7eec55a.js +9 -0
- package/dist/esm/_shared.f7eec55a.js.map +1 -0
- package/dist/esm/age-axis.4a8cf5e6.js +98 -0
- package/dist/esm/age-axis.4a8cf5e6.js.map +1 -0
- package/dist/esm/age-axis.module.03773a80.css +33 -0
- package/dist/esm/age-axis.module.03773a80.css.map +1 -0
- package/dist/esm/age-axis.module.3cc91335.js +22 -0
- package/dist/esm/age-axis.module.3cc91335.js.map +1 -0
- package/dist/esm/age-model-overlay.c7226855.js +57 -0
- package/dist/esm/age-model-overlay.c7226855.js.map +1 -0
- package/dist/esm/age-model-overlay.module.5d9e78fb.css +14 -0
- package/dist/esm/age-model-overlay.module.5d9e78fb.css.map +1 -0
- package/dist/esm/age-model-overlay.module.cd985dcb.js +16 -0
- package/dist/esm/age-model-overlay.module.cd985dcb.js.map +1 -0
- package/dist/esm/base.910b80b4.js +288 -0
- package/dist/esm/base.910b80b4.js.map +1 -0
- package/dist/esm/boxes.8292cff2.js +258 -0
- package/dist/esm/boxes.8292cff2.js.map +1 -0
- package/dist/esm/boxes.module.2b5fb18e.css +26 -0
- package/dist/esm/boxes.module.2b5fb18e.css.map +1 -0
- package/dist/esm/boxes.module.4ebc7796.js +19 -0
- package/dist/esm/boxes.module.4ebc7796.js.map +1 -0
- package/dist/esm/{carbon-isotopes.3b502a9e.js → carbon-isotopes.10db8285.js} +2 -2
- package/dist/esm/{carbon-isotopes.3b502a9e.js.map → carbon-isotopes.10db8285.js.map} +1 -1
- package/dist/esm/colors.395c6db5.js +40 -0
- package/dist/esm/colors.395c6db5.js.map +1 -0
- package/dist/esm/column-correlation.c8dcfe98.js +9 -0
- package/dist/esm/column-correlation.c8dcfe98.js.map +1 -0
- package/dist/esm/column-nav.5414677c.js +55 -0
- package/dist/esm/column-nav.5414677c.js.map +1 -0
- package/dist/esm/column-navigation.37cd3245.js +9 -0
- package/dist/esm/column-navigation.37cd3245.js.map +1 -0
- package/dist/esm/column.01d68dd8.js +127 -0
- package/dist/esm/column.01d68dd8.js.map +1 -0
- package/dist/esm/{column.db058031.js → column.a25f8ebd.js} +4 -4
- package/dist/esm/column.a25f8ebd.js.map +1 -0
- package/dist/esm/column.module.1b776e15.js +46 -0
- package/dist/esm/column.module.1b776e15.js.map +1 -0
- package/dist/esm/column.module.a67a6b4c.css +159 -0
- package/dist/esm/column.module.a67a6b4c.css.map +1 -0
- package/dist/esm/composite-scale.577bf64a.js +222 -0
- package/dist/esm/composite-scale.577bf64a.js.map +1 -0
- package/dist/esm/composite.039e4798.js +163 -0
- package/dist/esm/composite.039e4798.js.map +1 -0
- package/dist/esm/{core.4db8e452.js → core.843310d3.js} +11 -12
- package/dist/esm/core.843310d3.js.map +1 -0
- package/dist/esm/core.91ede078.js +206 -0
- package/dist/esm/core.91ede078.js.map +1 -0
- package/dist/esm/correlation-chart.abd8b346.js +9 -0
- package/dist/esm/correlation-chart.abd8b346.js.map +1 -0
- package/dist/esm/data-provider.1506eb64.js.map +1 -1
- package/dist/esm/data-provider.f10c6d0b.js +13 -0
- package/dist/esm/data-provider.f10c6d0b.js.map +1 -0
- package/dist/esm/fetch.99aec438.js +152 -0
- package/dist/esm/fetch.99aec438.js.map +1 -0
- package/dist/esm/hash-string.285b37fb.js +39 -0
- package/dist/esm/hash-string.285b37fb.js.map +1 -0
- package/dist/esm/helpers.2f0a0cb7.js +141 -0
- package/dist/esm/helpers.2f0a0cb7.js.map +1 -0
- package/dist/esm/index.d.ts +797 -130
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +13 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/inset-map.3c18106d.js +66 -0
- package/dist/esm/inset-map.3c18106d.js.map +1 -0
- package/dist/esm/keyboard-navigation.6713401b.js +48 -0
- package/dist/esm/keyboard-navigation.6713401b.js.map +1 -0
- package/dist/esm/keyboard-navigation.a9fc80dd.js +112 -0
- package/dist/esm/keyboard-navigation.a9fc80dd.js.map +1 -0
- package/dist/esm/layers.033d3fb0.js +170 -0
- package/dist/esm/layers.033d3fb0.js.map +1 -0
- package/dist/esm/main.2e0375a5.js +221 -0
- package/dist/esm/main.2e0375a5.js.map +1 -0
- package/dist/esm/main.module.3dd9500b.css +134 -0
- package/dist/esm/main.module.3dd9500b.css.map +1 -0
- package/dist/esm/main.module.c09154b1.js +70 -0
- package/dist/esm/main.module.c09154b1.js.map +1 -0
- package/dist/esm/mapbox.cac42eed.js +167 -0
- package/dist/esm/mapbox.cac42eed.js.map +1 -0
- package/dist/esm/maps.bcdea9c1.js +11 -0
- package/dist/esm/maps.bcdea9c1.js.map +1 -0
- package/dist/esm/{names.f6a4e9a4.js → names.a8f2b452.js} +5 -5
- package/dist/esm/names.a8f2b452.js.map +1 -0
- package/dist/esm/panel.598f76a5.js +420 -0
- package/dist/esm/panel.598f76a5.js.map +1 -0
- package/dist/esm/panel.module.386166cc.js +58 -0
- package/dist/esm/panel.module.386166cc.js.map +1 -0
- package/dist/esm/panel.module.3d2ea3c6.css +111 -0
- package/dist/esm/panel.module.3d2ea3c6.css.map +1 -0
- package/dist/esm/popover.a810b7bc.js +66 -0
- package/dist/esm/popover.a810b7bc.js.map +1 -0
- package/dist/esm/popover.module.c4ba4189.js +22 -0
- package/dist/esm/popover.module.c4ba4189.js.map +1 -0
- package/dist/esm/{selection-popover.module.0a701258.css → popover.module.c4d6bfb0.css} +11 -8
- package/dist/esm/popover.module.c4d6bfb0.css.map +1 -0
- package/dist/esm/prepare-data.d4284b4a.js +125 -0
- package/dist/esm/prepare-data.d4284b4a.js.map +1 -0
- package/dist/esm/prepare-units.6c890a96.js +104 -0
- package/dist/esm/prepare-units.6c890a96.js.map +1 -0
- package/dist/esm/{resolvers.b5c82b78.js → resolvers.36013b49.js} +13 -2
- package/dist/esm/resolvers.36013b49.js.map +1 -0
- package/dist/esm/section.a34d379a.js +215 -0
- package/dist/esm/section.a34d379a.js.map +1 -0
- package/dist/esm/selection.f5b0297e.js +143 -0
- package/dist/esm/selection.f5b0297e.js.map +1 -0
- package/dist/esm/state.178ef364.js +75 -0
- package/dist/esm/state.178ef364.js.map +1 -0
- package/dist/esm/state.2952cbca.js +118 -0
- package/dist/esm/state.2952cbca.js.map +1 -0
- package/dist/esm/store.c4d7a8a4.js +52 -0
- package/dist/esm/store.c4d7a8a4.js.map +1 -0
- package/dist/esm/styles.7bc776d1.js +95 -0
- package/dist/esm/styles.7bc776d1.js.map +1 -0
- package/dist/esm/svg.4b9a96c1.js +89 -0
- package/dist/esm/svg.4b9a96c1.js.map +1 -0
- package/dist/esm/types.0f0b57c9.js +3 -0
- package/dist/esm/types.0f0b57c9.js.map +1 -0
- package/dist/esm/unit-details.071cefed.js +9 -0
- package/dist/esm/unit-details.071cefed.js.map +1 -0
- package/dist/esm/units.5a4fc058.js +98 -0
- package/dist/esm/units.5a4fc058.js.map +1 -0
- package/dist/esm/utils.d7a43a2a.js +55 -0
- package/dist/esm/utils.d7a43a2a.js.map +1 -0
- package/dist/node/index.js.map +1 -1
- package/package.json +24 -7
- package/src/age-axis.module.sass +27 -0
- package/src/age-axis.ts +82 -19
- package/src/age-model-overlay.module.sass +11 -0
- package/src/age-model-overlay.ts +73 -0
- package/src/carbon-isotopes/column.ts +4 -2
- package/src/carbon-isotopes/core.ts +9 -6
- package/src/carbon-isotopes/data-provider.ts +3 -3
- package/src/column.module.sass +58 -49
- package/src/column.ts +149 -135
- package/src/correlation-chart/hash-string.ts +57 -0
- package/src/correlation-chart/index.ts +2 -0
- package/src/correlation-chart/main.module.sass +122 -0
- package/src/correlation-chart/main.ts +305 -0
- package/src/correlation-chart/prepare-data.ts +217 -0
- package/src/correlation-chart/stories/correlation-chart.stories.ts +192 -0
- package/src/correlation-chart/stories/stories.module.sass +18 -0
- package/src/correlation-chart/unconformity-line.module.sass +8 -0
- package/src/correlation-chart/unconformity-line.ts +25 -0
- package/src/data-provider/base.ts +388 -0
- package/src/data-provider/column-nav.ts +53 -0
- package/src/data-provider/fetch.ts +231 -0
- package/src/data-provider/index.ts +4 -0
- package/src/data-provider/store.ts +72 -0
- package/src/index.ts +5 -3
- package/src/maps/_shared/index.ts +2 -0
- package/src/maps/_shared/inset-map.stories.ts +20 -0
- package/src/maps/_shared/inset-map.ts +87 -0
- package/src/maps/_shared/styles.ts +57 -0
- package/src/maps/column-correlation/column-correlation-map.stories.ts +96 -0
- package/src/maps/column-correlation/core.ts +225 -0
- package/src/maps/column-correlation/index.ts +2 -0
- package/src/maps/column-correlation/state.ts +192 -0
- package/src/maps/column-navigation/index.ts +2 -0
- package/src/maps/column-navigation/mapbox/column-navigation-map.stories.ts +102 -0
- package/src/maps/column-navigation/mapbox/index.ts +219 -0
- package/src/maps/column-navigation/mapbox/keyboard-navigation.ts +119 -0
- package/src/maps/column-navigation/mapbox/state.ts +109 -0
- package/src/maps/column-navigation/svg/column-navigation-svg-map.stories.ts +46 -0
- package/src/{map → maps/column-navigation/svg}/index.ts +18 -6
- package/src/{map → maps/column-navigation/svg}/layers.ts +28 -109
- package/src/maps/column-navigation/utils/keyboard-navigation.ts +58 -0
- package/src/maps/index.ts +3 -0
- package/src/prepare-units/composite-scale.ts +353 -0
- package/src/prepare-units/helpers.ts +226 -0
- package/src/prepare-units/index.ts +177 -0
- package/src/prepare-units/utils.ts +98 -0
- package/src/section.ts +264 -84
- package/src/unit-details/index.ts +2 -215
- package/src/unit-details/{index.module.sass → panel.module.sass} +39 -8
- package/src/unit-details/panel.ts +523 -0
- package/src/{selection-popover.module.sass → unit-details/popover.module.sass} +4 -2
- package/src/unit-details/popover.ts +82 -0
- package/src/units/boxes.module.sass +16 -0
- package/src/units/boxes.ts +243 -90
- package/src/units/colors.ts +64 -0
- package/src/units/composite.ts +157 -152
- package/src/units/index.ts +76 -9
- package/src/units/names.ts +8 -4
- package/src/units/resolvers.ts +11 -0
- package/src/units/selection.ts +115 -101
- package/src/units/types.ts +5 -16
- package/dist/esm/age-axis.64c509ee.js +0 -41
- package/dist/esm/age-axis.64c509ee.js.map +0 -1
- package/dist/esm/boxes.13968b76.js +0 -164
- package/dist/esm/boxes.13968b76.js.map +0 -1
- package/dist/esm/boxes.module.28873d08.css +0 -4
- package/dist/esm/boxes.module.28873d08.css.map +0 -1
- package/dist/esm/boxes.module.605bdcd6.js +0 -13
- package/dist/esm/boxes.module.605bdcd6.js.map +0 -1
- package/dist/esm/column.8dd26e1a.js +0 -149
- package/dist/esm/column.8dd26e1a.js.map +0 -1
- package/dist/esm/column.db058031.js.map +0 -1
- package/dist/esm/column.module.039d872c.css +0 -151
- package/dist/esm/column.module.039d872c.css.map +0 -1
- package/dist/esm/column.module.e632868a.js +0 -19
- package/dist/esm/column.module.e632868a.js.map +0 -1
- package/dist/esm/composite.608a4ca2.js +0 -153
- package/dist/esm/composite.608a4ca2.js.map +0 -1
- package/dist/esm/core.4db8e452.js.map +0 -1
- package/dist/esm/helpers.8a03cfc7.js +0 -94
- package/dist/esm/helpers.8a03cfc7.js.map +0 -1
- package/dist/esm/index.module.0844afd8.css +0 -65
- package/dist/esm/index.module.0844afd8.css.map +0 -1
- package/dist/esm/index.module.24fe3a2e.js +0 -37
- package/dist/esm/index.module.24fe3a2e.js.map +0 -1
- package/dist/esm/layers.ad5fd25d.js +0 -231
- package/dist/esm/layers.ad5fd25d.js.map +0 -1
- package/dist/esm/map.7aa26f17.js +0 -82
- package/dist/esm/map.7aa26f17.js.map +0 -1
- package/dist/esm/names.f6a4e9a4.js.map +0 -1
- package/dist/esm/providers.cd1e652f.js +0 -25
- package/dist/esm/providers.cd1e652f.js.map +0 -1
- package/dist/esm/resolvers.b5c82b78.js.map +0 -1
- package/dist/esm/section.cc1b1100.js +0 -118
- package/dist/esm/section.cc1b1100.js.map +0 -1
- package/dist/esm/selection-popover.17d1bd55.js +0 -60
- package/dist/esm/selection-popover.17d1bd55.js.map +0 -1
- package/dist/esm/selection-popover.module.0a701258.css.map +0 -1
- package/dist/esm/selection-popover.module.e22f5183.js +0 -22
- package/dist/esm/selection-popover.module.e22f5183.js.map +0 -1
- package/dist/esm/selection.bbf26d0e.js +0 -117
- package/dist/esm/selection.bbf26d0e.js.map +0 -1
- package/dist/esm/store.25eaa168.js +0 -18
- package/dist/esm/store.25eaa168.js.map +0 -1
- package/dist/esm/types.f016e032.js +0 -18
- package/dist/esm/types.f016e032.js.map +0 -1
- package/dist/esm/unit-details.56ff8b70.js +0 -209
- package/dist/esm/unit-details.56ff8b70.js.map +0 -1
- package/dist/esm/units.361088d4.js +0 -42
- package/dist/esm/units.361088d4.js.map +0 -1
- package/src/helpers.ts +0 -133
- package/src/providers.ts +0 -34
- package/src/selection-popover.ts +0 -71
- package/src/store.ts +0 -12
- package/src/units/units.scss +0 -16
- /package/src/{map → maps/column-navigation/svg}/animated.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,0BAAI,CAAA,GAAA,kBAAU,EAAE,CAAA,GAAA,wEAAK;AA0BpB,SAAS,0CAAO,KAAkB;IACvC,MAAM,mBACJ,kBAAkB,2BAClB,qBAAqB,sBACrB,aAAa,kBACb,cAAc,gBACd,YAAY,YACZ,QAAQ,EACR,OAAO,QAAQ,YACf,WAAW,CAAA,GAAA,qBAAa,EAAE,GAAG,SAC7B,KAAK,SACL,KAAK,sBACL,qBAAqB,sBACrB,mBAAmB,gBACnB,UAAU,iBACV,gBAAgB,uBAChB,mBAAmB,iCACnB,8BAA8B,MAC9B,GAAG,MACJ,GAAG;IACJ,MAAM,MAAM,CAAA,GAAA,aAAK;IACjB,yBAAyB;IAEzB,MAAM,YAAE,QAAQ,SAAE,KAAK,eAAE,WAAW,EAAE,GAAG,CAAA,GAAA,yCAAqB,EAAE,UAAU;kBACxE;eACA;eACA;uBACA;0BACA;4BACA;oBACA;uBACA;0BACA;qCACA;IACF;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U,GAAG;QAClC,wBAAE,CAAA,GAAA,yCAAe;QACjB,wBAAE,EAAE,CAAC,gBAAgB,CAAA,GAAA,yCAAiB,GAAG;YAAE,QAAQ;QAAgB;QACnE,wBAAE,CAAA,GAAA,yCAAa,GAAG;2BAChB;wBACA;mBACA;yBACA;6BACA;uBACA;gCACA;gCACA;QACF;QACA;KACD;AAEL;AAMO,SAAS,0CAAgB,KAA2B;IACzD,MAAM,aAAE,SAAS,EAAE,GAAG,MAAM,GAAG;IAC/B,MAAM,WAAW,CAAA,GAAA,kBAAU;IAE3B,OAAO,wBAAE,wBAAwB;QAC/B,WAAW,CAAA,GAAA,iBAAS,EAAE,WAAW;YAC/B,aAAa,UAAU,aAAa;QACtC;QACA,GAAG,IAAI;IACT;AACF","sources":["packages/column-views/src/column.ts"],"sourcesContent":["import { ColumnAxisType } from \"@macrostrat/column-components\";\nimport { hyperStyled } from \"@macrostrat/hyper\";\nimport { useDarkMode } from \"@macrostrat/ui-components\";\nimport classNames from \"classnames\";\nimport { RefObject, useRef, HTMLAttributes } from \"react\";\nimport styles from \"./column.module.sass\";\nimport {\n UnitSelectionProvider,\n UnitComponent,\n UnitKeyboardNavigation,\n useUnitSelectionDispatch,\n} from \"./units\";\n\nimport { ColumnHeightScaleOptions } from \"./prepare-units/composite-scale\";\nimport { UnitSelectionPopover } from \"./unit-details\";\nimport {\n MacrostratColumnDataProvider,\n useMacrostratColumnData,\n} from \"./data-provider\";\nimport {\n SectionSharedProps,\n CompositeTimescale,\n SectionsColumn,\n} from \"./section\";\nimport { CompositeAgeAxis } from \"./age-axis\";\nimport { MergeSectionsMode, usePreparedColumnUnits } from \"./prepare-units\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nimport { NonIdealState } from \"@blueprintjs/core\";\n\nconst h = hyperStyled(styles);\n\ninterface BaseColumnProps extends SectionSharedProps {\n className?: string;\n showLabelColumn?: boolean;\n keyboardNavigation?: boolean;\n showLabels?: boolean;\n maxInternalColumns?: number;\n // Timescale properties\n showTimescale?: boolean;\n timescaleLevels?: number | [number, number];\n}\n\nexport interface ColumnProps extends BaseColumnProps, ColumnHeightScaleOptions {\n // Macrostrat units\n units: UnitLong[];\n t_age?: number;\n b_age?: number;\n mergeSections?: MergeSectionsMode;\n showUnitPopover?: boolean;\n selectedUnit?: number | null;\n onUnitSelected?: (unitID: number | null, unit: any) => void;\n // Unconformity height in pixels\n unconformityHeight?: number;\n}\n\nexport function Column(props: ColumnProps) {\n const {\n showUnitPopover = false,\n keyboardNavigation = false,\n mergeSections,\n onUnitSelected,\n selectedUnit,\n children,\n units: rawUnits,\n axisType = ColumnAxisType.AGE,\n t_age,\n b_age,\n unconformityHeight = 30,\n targetUnitHeight = 20,\n pixelScale,\n minPixelScale = 0.2,\n minSectionHeight = 50,\n collapseSmallUnconformities = true,\n ...rest\n } = props;\n const ref = useRef<HTMLElement>();\n // Selected item position\n\n const { sections, units, totalHeight } = usePreparedColumnUnits(rawUnits, {\n axisType,\n t_age,\n b_age,\n mergeSections,\n targetUnitHeight,\n unconformityHeight,\n pixelScale,\n minPixelScale,\n minSectionHeight,\n collapseSmallUnconformities,\n });\n\n if (sections.length === 0) {\n return h(\n \"div.column-container.empty\",\n h(NonIdealState, {\n title: \"Empty column\",\n description: \"No sections found in this column.\",\n icon: \"warning-sign\",\n })\n );\n }\n\n return h(\n MacrostratColumnDataProvider,\n { units, sections, totalHeight, axisType },\n h(\n UnitSelectionProvider,\n { columnRef: ref, onUnitSelected, selectedUnit, units },\n h(ColumnInner, { columnRef: ref, ...rest }, [\n children,\n h.if(showUnitPopover)(UnitSelectionPopover),\n h.if(keyboardNavigation)(UnitKeyboardNavigation, { units }),\n ])\n )\n );\n}\n\ninterface ColumnInnerProps extends BaseColumnProps {\n columnRef: RefObject<HTMLElement>;\n}\n\nfunction ColumnInner(props: ColumnInnerProps) {\n const {\n unitComponent = UnitComponent,\n unconformityLabels = true,\n showLabels = true,\n width: _width = 300,\n columnWidth: _columnWidth = 150,\n showLabelColumn: _showLabelColumn = true,\n className,\n columnRef,\n clipUnits = false,\n children,\n showTimescale,\n timescaleLevels,\n maxInternalColumns,\n } = props;\n\n const { axisType } = useMacrostratColumnData();\n\n const dispatch = useUnitSelectionDispatch();\n\n let width = _width;\n let columnWidth = _columnWidth;\n if (columnWidth > width) {\n columnWidth = width;\n }\n let showLabelColumn = _showLabelColumn;\n if (columnWidth > width - 10) {\n showLabelColumn = false;\n }\n\n let _showTimescale = showTimescale;\n if (timescaleLevels !== null) {\n _showTimescale = true;\n }\n _showTimescale = axisType == ColumnAxisType.AGE && _showTimescale;\n\n return h(\n ColumnContainer,\n {\n onClick(evt) {\n dispatch?.(null, null, evt as any);\n },\n className,\n },\n h(\"div.column\", { ref: columnRef }, [\n h(CompositeAgeAxis),\n h.if(_showTimescale)(CompositeTimescale, { levels: timescaleLevels }),\n h(SectionsColumn, {\n unitComponent,\n showLabels,\n width,\n columnWidth,\n showLabelColumn,\n clipUnits,\n unconformityLabels,\n maxInternalColumns,\n }),\n children,\n ])\n );\n}\n\nexport interface ColumnContainerProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n}\n\nexport function ColumnContainer(props: ColumnContainerProps) {\n const { className, ...rest } = props;\n const darkMode = useDarkMode();\n\n return h(\"div.column-container\", {\n className: classNames(className, {\n \"dark-mode\": darkMode?.isEnabled ?? false,\n }),\n ...rest,\n });\n}\n"],"names":[],"version":3,"file":"column.01d68dd8.js.map"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {SimpleUnitsColumn as $4c8184c4a7317749$export$2006342ddaa547c6} from "./units.
|
|
1
|
+
import {SimpleUnitsColumn as $4c8184c4a7317749$export$2006342ddaa547c6} from "./units.5a4fc058.js";
|
|
2
2
|
import {IsotopesColumn as $d5a3eba6c540ff58$export$5d8aa8022c284748} from "./isotopes-column.7cb5cc45.js";
|
|
3
|
-
import {MacrostratColumnProvider as $29bf41d89292aad4$export$9e42f9b6e0d67c7d} from "./providers.cd1e652f.js";
|
|
4
3
|
import $hEPNH$columnmodule7f47d25ajs from "./column.module.7f47d25a.js";
|
|
5
4
|
import "./column.module.cbb072df.css";
|
|
5
|
+
import {MacrostratColumnProvider as $774a5efa27d1c77b$export$9e42f9b6e0d67c7d} from "./base.910b80b4.js";
|
|
6
6
|
import $hEPNH$macrostrathyper from "@macrostrat/hyper";
|
|
7
7
|
import {group as $hEPNH$group} from "d3-array";
|
|
8
8
|
import {useAPIResult as $hEPNH$useAPIResult} from "@macrostrat/ui-components";
|
|
@@ -46,7 +46,7 @@ const $132b1b0fb905c489$export$6e2c8f0811a474ce = (props)=>{
|
|
|
46
46
|
const targetHeight = 50 * data.length;
|
|
47
47
|
pixelScale = Math.ceil(targetHeight / dAge);
|
|
48
48
|
}
|
|
49
|
-
return $132b1b0fb905c489$var$h((0, $
|
|
49
|
+
return $132b1b0fb905c489$var$h((0, $774a5efa27d1c77b$export$9e42f9b6e0d67c7d), {
|
|
50
50
|
divisions: data,
|
|
51
51
|
range: range,
|
|
52
52
|
pixelsPerMeter: pixelScale
|
|
@@ -114,4 +114,4 @@ var $132b1b0fb905c489$export$2e2bcd8739ae039 = $132b1b0fb905c489$var$Column;
|
|
|
114
114
|
|
|
115
115
|
|
|
116
116
|
export {$132b1b0fb905c489$export$6e2c8f0811a474ce as Section, $132b1b0fb905c489$export$2e2bcd8739ae039 as default};
|
|
117
|
-
//# sourceMappingURL=column.
|
|
117
|
+
//# sourceMappingURL=column.a25f8ebd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,wEAAK;AAS5B,MAAM,gCAAU,CAAC,SAAE,KAAK,EAAE;IACxB,MAAM,eAAE,WAAW,EAAE,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,oBAAY;IAC/C,iCAAiC;IACjC,IAAI,IAAI,KAAK,GAAG,CAAC,KAAK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C,KAAK;QACL,GAAG,MAAM;QACT,UAAU;IACZ;IACA,IAAI,QAAQ,MAAM,OAAO;IAEzB,IAAI,gBAAgB,MAAM,IAAI,CAAC,CAAA,GAAA,YAAI,EAAE,MAAM,CAAC,IAAM,EAAE,UAAU;IAE9D,kDAAkD;IAElD,OAAO,wBAAE,cAAc;QACrB,wBAAE,sBAAsB;QACxB,wBACE,mBACA,cAAc,GAAG,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE;YAC/B,OAAO,wBAAE,CAAC,YAAY,EAAE,IAAI,EAAE;gBAC5B,wBAAE,2CAAS;oBACT,MAAM;oBACN,gBAAgB,KAAK,cAAc,MAAM,GAAG;gBAC9C;aACD;QACH;KAEH;AACH;IAGA,2CAAe","sources":["packages/column-views/src/carbon-isotopes/column.ts"],"sourcesContent":["import hyper from \"@macrostrat/hyper\";\nimport { group } from \"d3-array\";\nimport { useAPIResult } from \"@macrostrat/ui-components\";\nimport {\n ColumnSVG,\n ColumnAxis,\n ColumnContext,\n} from \"@macrostrat/column-components\";\nimport { SimpleUnitsColumn, IUnit } from \"../units\";\nimport { useContext } from \"react\";\nimport { IsotopesColumn } from \"./isotopes-column\";\nimport { MacrostratColumnProvider } from \"../data-provider\";\nimport styles from \"./column.module.sass\";\n\nconst h = hyper.styled(styles);\n\ninterface IColumnProps {\n data: IUnit[];\n pixelScale?: number;\n isOldestColumn: boolean;\n range?: [number, number];\n}\n\nconst AgeAxis = ({ ticks }) => {\n const { pixelHeight } = useContext(ColumnContext);\n // A tick roughly every 40 pixels\n let v = Math.max(Math.round(pixelHeight / 40), 1);\n\n return h(ColumnAxis, {\n ticks: v,\n showDomain: false,\n });\n};\n\nconst Section = (props: IColumnProps) => {\n // Section with \"squishy\" time scale\n const {\n data,\n isOldestColumn = true,\n range = [data[data.length - 1].b_age, data[0].t_age],\n } = props;\n let { pixelScale } = props;\n\n const notesOffset = 100;\n\n if (!pixelScale) {\n // Make up a pixel scale\n const dAge = range[0] - range[1];\n const targetHeight = 50 * data.length;\n pixelScale = Math.ceil(targetHeight / dAge);\n }\n\n return h(\n MacrostratColumnProvider,\n {\n divisions: data,\n range,\n pixelsPerMeter: pixelScale, // Actually pixels per myr\n },\n [\n h(\n ColumnSVG,\n {\n width: 650,\n padding: 20,\n paddingTop: 5,\n paddingBottom: 25,\n },\n [\n h(AgeAxis),\n h(SimpleUnitsColumn, {\n width: 400,\n columnWidth: 90,\n }),\n h(IsotopesColumn, {\n parameter: \"D13C\",\n label: \"δ¹³C\",\n width: 100,\n // @ts-ignore\n nTicks: 4,\n showAxis: isOldestColumn,\n transform: \"translate(250,0)\",\n }),\n h(IsotopesColumn, {\n parameter: \"D18O\",\n label: \"δ¹⁸O\",\n color: \"red\",\n domain: [-40, 0],\n width: 100,\n // @ts-ignore\n nTicks: 4,\n showAxis: isOldestColumn,\n transform: \"translate(370,0)\",\n }),\n ]\n ),\n ]\n );\n};\n\ntype ColumnArgs = any;\n\nfunction Column(props: Omit<IColumnProps, \"data\"> & { params: ColumnArgs }) {\n const { params } = props;\n const data: IUnit[] = useAPIResult(\"/units\", {\n all: true,\n ...params,\n response: \"long\",\n });\n if (data == null) return null;\n\n let sectionGroups = Array.from(group(data, (d) => d.section_id));\n\n //sectionGroups.sort((a, b) => a.t_age - b.t_age);\n\n return h(\"div.column\", [\n h(\"div.age-axis-label\", \"Age (Ma)\"),\n h(\n \"div.main-column\",\n sectionGroups.map(([id, values], i) => {\n return h(`div.section-${id}`, [\n h(Section, {\n data: values,\n isOldestColumn: i == sectionGroups.length - 1,\n }),\n ]);\n })\n ),\n ]);\n}\n\nexport { Section, IColumnProps };\nexport default Column;\n"],"names":[],"version":3,"file":"column.a25f8ebd.js.map"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
|
|
2
|
+
function $parcel$export(e, n, v, s) {
|
|
3
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
4
|
+
}
|
|
5
|
+
var $6cbea5de739af804$exports = {};
|
|
6
|
+
|
|
7
|
+
$parcel$export($6cbea5de739af804$exports, "column-container", () => $6cbea5de739af804$export$e908cef0cccb98df, (v) => $6cbea5de739af804$export$e908cef0cccb98df = v);
|
|
8
|
+
$parcel$export($6cbea5de739af804$exports, "timescale-column", () => $6cbea5de739af804$export$82c2e1a892d790ab, (v) => $6cbea5de739af804$export$82c2e1a892d790ab = v);
|
|
9
|
+
$parcel$export($6cbea5de739af804$exports, "section-main", () => $6cbea5de739af804$export$add6075ee40659c8, (v) => $6cbea5de739af804$export$add6075ee40659c8 = v);
|
|
10
|
+
$parcel$export($6cbea5de739af804$exports, "section-units-container", () => $6cbea5de739af804$export$37c0a390e37eb2da, (v) => $6cbea5de739af804$export$37c0a390e37eb2da = v);
|
|
11
|
+
$parcel$export($6cbea5de739af804$exports, "main-column", () => $6cbea5de739af804$export$9c88f9a435c40ccb, (v) => $6cbea5de739af804$export$9c88f9a435c40ccb = v);
|
|
12
|
+
$parcel$export($6cbea5de739af804$exports, "unconformity-labels", () => $6cbea5de739af804$export$d726faed2da21993, (v) => $6cbea5de739af804$export$d726faed2da21993 = v);
|
|
13
|
+
$parcel$export($6cbea5de739af804$exports, "unconformity", () => $6cbea5de739af804$export$7b4a6d978979c0fa, (v) => $6cbea5de739af804$export$7b4a6d978979c0fa = v);
|
|
14
|
+
$parcel$export($6cbea5de739af804$exports, "giga", () => $6cbea5de739af804$export$197e40aa3a484017, (v) => $6cbea5de739af804$export$197e40aa3a484017 = v);
|
|
15
|
+
$parcel$export($6cbea5de739af804$exports, "mega", () => $6cbea5de739af804$export$580f1e8cf64f2815, (v) => $6cbea5de739af804$export$580f1e8cf64f2815 = v);
|
|
16
|
+
$parcel$export($6cbea5de739af804$exports, "large", () => $6cbea5de739af804$export$f09585a853dddd32, (v) => $6cbea5de739af804$export$f09585a853dddd32 = v);
|
|
17
|
+
$parcel$export($6cbea5de739af804$exports, "small", () => $6cbea5de739af804$export$3c17b0e969a90510, (v) => $6cbea5de739af804$export$3c17b0e969a90510 = v);
|
|
18
|
+
$parcel$export($6cbea5de739af804$exports, "unconformity-text", () => $6cbea5de739af804$export$925235908943319a, (v) => $6cbea5de739af804$export$925235908943319a = v);
|
|
19
|
+
var $6cbea5de739af804$export$e908cef0cccb98df;
|
|
20
|
+
var $6cbea5de739af804$export$82c2e1a892d790ab;
|
|
21
|
+
var $6cbea5de739af804$export$add6075ee40659c8;
|
|
22
|
+
var $6cbea5de739af804$export$37c0a390e37eb2da;
|
|
23
|
+
var $6cbea5de739af804$export$9c88f9a435c40ccb;
|
|
24
|
+
var $6cbea5de739af804$export$d726faed2da21993;
|
|
25
|
+
var $6cbea5de739af804$export$7b4a6d978979c0fa;
|
|
26
|
+
var $6cbea5de739af804$export$197e40aa3a484017;
|
|
27
|
+
var $6cbea5de739af804$export$580f1e8cf64f2815;
|
|
28
|
+
var $6cbea5de739af804$export$f09585a853dddd32;
|
|
29
|
+
var $6cbea5de739af804$export$3c17b0e969a90510;
|
|
30
|
+
var $6cbea5de739af804$export$925235908943319a;
|
|
31
|
+
$6cbea5de739af804$export$e908cef0cccb98df = "column-container_afc440";
|
|
32
|
+
$6cbea5de739af804$export$82c2e1a892d790ab = "timescale-column_afc440";
|
|
33
|
+
$6cbea5de739af804$export$add6075ee40659c8 = "section-main_afc440";
|
|
34
|
+
$6cbea5de739af804$export$37c0a390e37eb2da = "section-units-container_afc440";
|
|
35
|
+
$6cbea5de739af804$export$9c88f9a435c40ccb = "main-column_afc440";
|
|
36
|
+
$6cbea5de739af804$export$d726faed2da21993 = "unconformity-labels_afc440";
|
|
37
|
+
$6cbea5de739af804$export$7b4a6d978979c0fa = "unconformity_afc440";
|
|
38
|
+
$6cbea5de739af804$export$197e40aa3a484017 = "giga_afc440";
|
|
39
|
+
$6cbea5de739af804$export$580f1e8cf64f2815 = "mega_afc440";
|
|
40
|
+
$6cbea5de739af804$export$f09585a853dddd32 = "large_afc440";
|
|
41
|
+
$6cbea5de739af804$export$3c17b0e969a90510 = "small_afc440";
|
|
42
|
+
$6cbea5de739af804$export$925235908943319a = "unconformity-text_afc440";
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
export {$6cbea5de739af804$exports as default};
|
|
46
|
+
//# sourceMappingURL=column.module.1b776e15.js.map
|
|
@@ -0,0 +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;AAXA,4CAAqC;AACrC,4CAAqC;AACrC,4CAAiC;AACjC,4CAA4C;AAC5C,4CAAgC;AAChC,4CAAwC;AACxC,4CAAiC;AACjC,4CAAyB;AACzB,4CAAyB;AACzB,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAAsC","sources":["packages/column-views/src/column.module.sass"],"sourcesContent":[".column-container, body:global(.light-mode) .column-container\n --column-background-color: var(--background-color, #fff)\n --column-stroke-color: var(--text-emphasized-color, #000)\n --column-text-color: var(--text-emphasized-color, #000)\n\n/* We have to duplicate the dark mode styles here\n because we want to set them either if the preferred\n color scheme is dark OR if dark mode is explicitly enabled.\n If dark mode is explicitly enabled, we want to override\n the media query. */\n@media (prefers-color-scheme: dark)\n body:not(:global(.light-mode)) .column-container\n --column-background-color: var(--background-color, #000)\n --column-stroke-color: var(--text-emphasized-color, #fff)\n --column-text-color: var(--text-emphasized-color, #fff)\n color-scheme: dark\n color: var(--column-text-color)\n :global\n .timescale\n color: #000\n svg pattern image\n filter: invert(100%)\n\nbody:global(.dark-mode) .column-container\n --column-background-color: var(--background-color, #000)\n --column-stroke-color: var(--text-emphasized-color, #fff)\n --column-text-color: var(--text-emphasized-color, #fff)\n color-scheme: dark\n color: var(--column-text-color)\n :global\n .timescale\n color: #000\n svg pattern image\n filter: invert(100%)\n\n.column-container :global\n .column\n display: flex\n flex-direction: row\n position: relative\n\n .unit\n stroke: var(--column-stroke-color)\n stroke-width: 1px\n\n .selection-overlay\n fill: var(--selection-overlay-color, red)\n fill-opacity: var(--selection-overlay-opacity, 0.5)\n\n g.lithology-column use.frame\n stroke: var(--column-stroke-color)\n stroke-width: 1.5px !important\n pointer-events: none\n\n.column-container :global .unit-label\n text-align: center\n\n.column-container :global .col-note-label\n font-size: 10px\n margin-top: 3px\n padding: 2px\n padding-left: 3px\n line-height: 9px\n border-left: none !important\n\n.column-container :global g.height-range\n display: none\n\n.column-container :global .note-inner\n border: none\n\n.column-container :global .frame rect\n fill: transparent\n\n.column-container :global .default-buttons\n width: 100%\n margin: 0 -10px\n\n.column-container :global div.section\n display: flex\n flex-direction: row\n\n.column-container :global .section .divisions .unit\n cursor: pointer\n\n.column-container :global(.timescale)\n width: calc(calc(1.5em + 1.5px) * var(--timescale-level-count, 4))\n --timescale-level-size: 1.5em\n\n.timescale-column\n position: relative\n\n.section-main\n position: relative\n margin-bottom: -4px\n\n.section-units-container\n position: relative\n\n.main-column\n position: relative\n\n.unconformity-labels\n position: absolute\n top: 0\n left: 0\n pointer-events: none\n\n\n.unconformity\n text-align: center\n position: absolute\n top: 0px\n display: flex\n justify-content: center\n align-items: center\n font-size: 0.8em\n &.giga\n font-weight: 800\n font-size: 1em\n &.mega\n font-weight: 600\n font-weight: 700\n font-size: 0.9em\n &.large\n font-weight: 600\n &.small\n font-weight: 300\n\n\n.unconformity-text\n width: var(--column-width)\n color: var(--column-stroke-color)\n --unit-font-style: normal\n\n\n"],"names":[],"version":3,"file":"column.module.1b776e15.js.map"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
.column-container_afc440, body.light-mode .column-container_afc440 {
|
|
2
|
+
--column-background-color: var(--background-color, #fff);
|
|
3
|
+
--column-stroke-color: var(--text-emphasized-color, #000);
|
|
4
|
+
--column-text-color: var(--text-emphasized-color, #000);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
@media (prefers-color-scheme: dark) {
|
|
8
|
+
body:not(.light-mode) .column-container_afc440 {
|
|
9
|
+
--column-background-color: var(--background-color, #000);
|
|
10
|
+
--column-stroke-color: var(--text-emphasized-color, #fff);
|
|
11
|
+
--column-text-color: var(--text-emphasized-color, #fff);
|
|
12
|
+
color-scheme: dark;
|
|
13
|
+
color: var(--column-text-color);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
body:not(.light-mode) .column-container_afc440 .timescale {
|
|
17
|
+
color: #000;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
body:not(.light-mode) .column-container_afc440 svg pattern image {
|
|
21
|
+
filter: invert();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
body.dark-mode .column-container_afc440 {
|
|
26
|
+
--column-background-color: var(--background-color, #000);
|
|
27
|
+
--column-stroke-color: var(--text-emphasized-color, #fff);
|
|
28
|
+
--column-text-color: var(--text-emphasized-color, #fff);
|
|
29
|
+
color-scheme: dark;
|
|
30
|
+
color: var(--column-text-color);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
body.dark-mode .column-container_afc440 .timescale {
|
|
34
|
+
color: #000;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
body.dark-mode .column-container_afc440 svg pattern image {
|
|
38
|
+
filter: invert();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.column-container_afc440 .column {
|
|
42
|
+
flex-direction: row;
|
|
43
|
+
display: flex;
|
|
44
|
+
position: relative;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.column-container_afc440 .unit {
|
|
48
|
+
stroke: var(--column-stroke-color);
|
|
49
|
+
stroke-width: 1px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.column-container_afc440 .selection-overlay {
|
|
53
|
+
fill: var(--selection-overlay-color, red);
|
|
54
|
+
fill-opacity: var(--selection-overlay-opacity, .5);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.column-container_afc440 g.lithology-column use.frame {
|
|
58
|
+
stroke: var(--column-stroke-color);
|
|
59
|
+
pointer-events: none;
|
|
60
|
+
stroke-width: 1.5px !important;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.column-container_afc440 .unit-label {
|
|
64
|
+
text-align: center;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.column-container_afc440 .col-note-label {
|
|
68
|
+
margin-top: 3px;
|
|
69
|
+
padding: 2px 2px 2px 3px;
|
|
70
|
+
font-size: 10px;
|
|
71
|
+
line-height: 9px;
|
|
72
|
+
border-left: none !important;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.column-container_afc440 g.height-range {
|
|
76
|
+
display: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.column-container_afc440 .note-inner {
|
|
80
|
+
border: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.column-container_afc440 .frame rect {
|
|
84
|
+
fill: #0000;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.column-container_afc440 .default-buttons {
|
|
88
|
+
width: 100%;
|
|
89
|
+
margin: 0 -10px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.column-container_afc440 div.section {
|
|
93
|
+
flex-direction: row;
|
|
94
|
+
display: flex;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.column-container_afc440 .section .divisions .unit {
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.column-container_afc440 .timescale {
|
|
102
|
+
width: calc((1.5em + 1.5px) * var(--timescale-level-count, 4));
|
|
103
|
+
--timescale-level-size: 1.5em;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.timescale-column_afc440 {
|
|
107
|
+
position: relative;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.section-main_afc440 {
|
|
111
|
+
margin-bottom: -4px;
|
|
112
|
+
position: relative;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.section-units-container_afc440, .main-column_afc440 {
|
|
116
|
+
position: relative;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.unconformity-labels_afc440 {
|
|
120
|
+
pointer-events: none;
|
|
121
|
+
position: absolute;
|
|
122
|
+
top: 0;
|
|
123
|
+
left: 0;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.unconformity_afc440 {
|
|
127
|
+
text-align: center;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
align-items: center;
|
|
130
|
+
font-size: .8em;
|
|
131
|
+
display: flex;
|
|
132
|
+
position: absolute;
|
|
133
|
+
top: 0;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.unconformity_afc440.giga_afc440 {
|
|
137
|
+
font-size: 1em;
|
|
138
|
+
font-weight: 800;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.unconformity_afc440.mega_afc440 {
|
|
142
|
+
font-size: .9em;
|
|
143
|
+
font-weight: 700;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.unconformity_afc440.large_afc440 {
|
|
147
|
+
font-weight: 600;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.unconformity_afc440.small_afc440 {
|
|
151
|
+
font-weight: 300;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.unconformity-text_afc440 {
|
|
155
|
+
width: var(--column-width);
|
|
156
|
+
color: var(--column-stroke-color);
|
|
157
|
+
--unit-font-style: normal;
|
|
158
|
+
}
|
|
159
|
+
/*# sourceMappingURL=column.module.a67a6b4c.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA;;;;;;AAWE;EACE;;;;;;;;EAOI;;;;EAEA;;;;;AAIN;;;;;;;;AAOE;;;;AAIF;;;;;;;;;;AAUE;;;;;AAKA;;;;;AAIF;;;;;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;AAoBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BF;;;;;;;AAOE;;;;;;;;;;;;;;;AAWE;;;;;AAMF","sources":["packages/column-views/src/column.module.sass"],"sourcesContent":[".column-container, body:global(.light-mode) .column-container\n --column-background-color: var(--background-color, #fff)\n --column-stroke-color: var(--text-emphasized-color, #000)\n --column-text-color: var(--text-emphasized-color, #000)\n\n/* We have to duplicate the dark mode styles here\n because we want to set them either if the preferred\n color scheme is dark OR if dark mode is explicitly enabled.\n If dark mode is explicitly enabled, we want to override\n the media query. */\n@media (prefers-color-scheme: dark)\n body:not(:global(.light-mode)) .column-container\n --column-background-color: var(--background-color, #000)\n --column-stroke-color: var(--text-emphasized-color, #fff)\n --column-text-color: var(--text-emphasized-color, #fff)\n color-scheme: dark\n color: var(--column-text-color)\n :global\n .timescale\n color: #000\n svg pattern image\n filter: invert(100%)\n\nbody:global(.dark-mode) .column-container\n --column-background-color: var(--background-color, #000)\n --column-stroke-color: var(--text-emphasized-color, #fff)\n --column-text-color: var(--text-emphasized-color, #fff)\n color-scheme: dark\n color: var(--column-text-color)\n :global\n .timescale\n color: #000\n svg pattern image\n filter: invert(100%)\n\n.column-container :global\n .column\n display: flex\n flex-direction: row\n position: relative\n\n .unit\n stroke: var(--column-stroke-color)\n stroke-width: 1px\n\n .selection-overlay\n fill: var(--selection-overlay-color, red)\n fill-opacity: var(--selection-overlay-opacity, 0.5)\n\n g.lithology-column use.frame\n stroke: var(--column-stroke-color)\n stroke-width: 1.5px !important\n pointer-events: none\n\n.column-container :global .unit-label\n text-align: center\n\n.column-container :global .col-note-label\n font-size: 10px\n margin-top: 3px\n padding: 2px\n padding-left: 3px\n line-height: 9px\n border-left: none !important\n\n.column-container :global g.height-range\n display: none\n\n.column-container :global .note-inner\n border: none\n\n.column-container :global .frame rect\n fill: transparent\n\n.column-container :global .default-buttons\n width: 100%\n margin: 0 -10px\n\n.column-container :global div.section\n display: flex\n flex-direction: row\n\n.column-container :global .section .divisions .unit\n cursor: pointer\n\n.column-container :global(.timescale)\n width: calc(calc(1.5em + 1.5px) * var(--timescale-level-count, 4))\n --timescale-level-size: 1.5em\n\n.timescale-column\n position: relative\n\n.section-main\n position: relative\n margin-bottom: -4px\n\n.section-units-container\n position: relative\n\n.main-column\n position: relative\n\n.unconformity-labels\n position: absolute\n top: 0\n left: 0\n pointer-events: none\n\n\n.unconformity\n text-align: center\n position: absolute\n top: 0px\n display: flex\n justify-content: center\n align-items: center\n font-size: 0.8em\n &.giga\n font-weight: 800\n font-size: 1em\n &.mega\n font-weight: 600\n font-weight: 700\n font-size: 0.9em\n &.large\n font-weight: 600\n &.small\n font-weight: 300\n\n\n.unconformity-text\n width: var(--column-width)\n color: var(--column-stroke-color)\n --unit-font-style: normal\n\n\n"],"names":[],"version":3,"file":"column.module.a67a6b4c.css.map"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import {ensureArray as $b6657fba8924a702$export$d0c8ecbd4ed8940c, getUnitHeightRange as $b6657fba8924a702$export$70e712e2ac0237a} from "./utils.d7a43a2a.js";
|
|
2
|
+
import {ColumnAxisType as $egi9E$ColumnAxisType} from "@macrostrat/column-components";
|
|
3
|
+
import {scaleLinear as $egi9E$scaleLinear} from "d3-scale";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
function $728f6cf6c12cd490$export$e7184dd8bb3302ed(inputScales, unconformityHeight) {
|
|
9
|
+
/** Finalize the heights of sections, including the heights of unconformities
|
|
10
|
+
* between them.
|
|
11
|
+
*/ let totalHeight = unconformityHeight / 2;
|
|
12
|
+
let lastSectionTopHeight = 0;
|
|
13
|
+
const packages2 = [];
|
|
14
|
+
for (const group of inputScales){
|
|
15
|
+
const { domain: domain, pixelScale: pixelScale } = group;
|
|
16
|
+
const [b_age, t_age] = domain;
|
|
17
|
+
const key = `package-${b_age}-${t_age}`;
|
|
18
|
+
packages2.push({
|
|
19
|
+
...$728f6cf6c12cd490$export$d6235b492bceb8c5(group, totalHeight),
|
|
20
|
+
key: key,
|
|
21
|
+
offset: totalHeight,
|
|
22
|
+
// Unconformity height above this particular section
|
|
23
|
+
paddingTop: totalHeight - lastSectionTopHeight
|
|
24
|
+
});
|
|
25
|
+
const pixelHeight = pixelScale * Math.abs(b_age - t_age);
|
|
26
|
+
lastSectionTopHeight = totalHeight + pixelHeight;
|
|
27
|
+
totalHeight = lastSectionTopHeight + unconformityHeight;
|
|
28
|
+
}
|
|
29
|
+
totalHeight += unconformityHeight / 2;
|
|
30
|
+
return {
|
|
31
|
+
totalHeight: totalHeight,
|
|
32
|
+
sections: packages2
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function $728f6cf6c12cd490$export$67442a0f5bef147b(sections, unconformityHeight) {
|
|
36
|
+
/** Finalize the heights of sections, including the heights of unconformities
|
|
37
|
+
* between them.
|
|
38
|
+
*/ const sectionScales = sections.map((d)=>d.scaleInfo);
|
|
39
|
+
const { totalHeight: totalHeight, sections: packages } = $728f6cf6c12cd490$export$e7184dd8bb3302ed(sectionScales, unconformityHeight);
|
|
40
|
+
// This could perhaps be simplified.
|
|
41
|
+
const sections1 = [];
|
|
42
|
+
for(const i in sections){
|
|
43
|
+
const group = sections[i];
|
|
44
|
+
const scaleInfo = packages[i];
|
|
45
|
+
sections1.push({
|
|
46
|
+
...group,
|
|
47
|
+
key: scaleInfo.key,
|
|
48
|
+
scaleInfo: scaleInfo
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
totalHeight: totalHeight,
|
|
53
|
+
sections: sections1
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function $728f6cf6c12cd490$export$7d3f3129a1a4b84e(sections, opts) {
|
|
57
|
+
return sections.map((group)=>{
|
|
58
|
+
return $728f6cf6c12cd490$var$addScaleToSection(group, opts);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function $728f6cf6c12cd490$var$addScaleToSection(group, opts) {
|
|
62
|
+
const { t_age: t_age, b_age: b_age, units: units } = group;
|
|
63
|
+
let _range = null;
|
|
64
|
+
// if t_age and b_age are set for a group, use them to define the range...
|
|
65
|
+
if (t_age != null && b_age != null && opts.axisType == (0, $egi9E$ColumnAxisType).AGE) _range = [
|
|
66
|
+
b_age,
|
|
67
|
+
t_age
|
|
68
|
+
];
|
|
69
|
+
const scaleInfo = $728f6cf6c12cd490$var$buildSectionScale(units, {
|
|
70
|
+
...opts,
|
|
71
|
+
domain: _range
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
...group,
|
|
75
|
+
scaleInfo: scaleInfo
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function $728f6cf6c12cd490$var$buildSectionScale(data, opts) {
|
|
79
|
+
const { targetUnitHeight: targetUnitHeight = 20, minPixelScale: minPixelScale = 0.2, axisType: axisType, minSectionHeight: minSectionHeight } = opts;
|
|
80
|
+
const domain = opts.domain ?? $728f6cf6c12cd490$var$findSectionHeightRange(data, axisType);
|
|
81
|
+
const dAge = Math.abs(domain[0] - domain[1]);
|
|
82
|
+
let _pixelScale = opts.pixelScale;
|
|
83
|
+
if (_pixelScale == null) {
|
|
84
|
+
const avgAgeRange = $728f6cf6c12cd490$var$findAverageUnitHeight(data, axisType);
|
|
85
|
+
// Get pixel height necessary to render average unit at target height
|
|
86
|
+
_pixelScale = Math.max(targetUnitHeight / avgAgeRange, minPixelScale);
|
|
87
|
+
// OLD METHOD that cares about overall section height vs. individual unit height
|
|
88
|
+
// 0.2 pixel per myr is the floor scale
|
|
89
|
+
//const targetHeight = targetUnitHeight * data.length;
|
|
90
|
+
// 1 pixel per myr is the floor scale
|
|
91
|
+
//_pixelScale = Math.max(targetHeight / dAge, minPixelScale);
|
|
92
|
+
}
|
|
93
|
+
let height = dAge * _pixelScale;
|
|
94
|
+
// If height is less than minSectionHeight, set it to minSectionHeight
|
|
95
|
+
const _minSectionHeight = minSectionHeight ?? targetUnitHeight ?? 0;
|
|
96
|
+
height = Math.max(height, _minSectionHeight);
|
|
97
|
+
_pixelScale = height / dAge;
|
|
98
|
+
return $728f6cf6c12cd490$export$d6235b492bceb8c5({
|
|
99
|
+
domain: domain,
|
|
100
|
+
pixelScale: _pixelScale
|
|
101
|
+
}, 0);
|
|
102
|
+
}
|
|
103
|
+
function $728f6cf6c12cd490$export$d6235b492bceb8c5(def, offset = 0) {
|
|
104
|
+
/** Build a section scale */ // Domain should be oriented from bottom to top, but scale is oriented from top to bottom
|
|
105
|
+
const { domain: domain, pixelScale: pixelScale } = def;
|
|
106
|
+
const pixelHeight = pixelScale * Math.abs(domain[0] - domain[1]);
|
|
107
|
+
return {
|
|
108
|
+
domain: domain,
|
|
109
|
+
pixelScale: pixelScale,
|
|
110
|
+
pixelHeight: pixelHeight,
|
|
111
|
+
scale: (0, $egi9E$scaleLinear)().domain([
|
|
112
|
+
domain[1],
|
|
113
|
+
domain[0]
|
|
114
|
+
]).range([
|
|
115
|
+
offset,
|
|
116
|
+
pixelHeight + offset
|
|
117
|
+
])
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function $728f6cf6c12cd490$var$findSectionHeightRange(data, axisType) {
|
|
121
|
+
if (axisType == null) throw new Error("Axis type is not set");
|
|
122
|
+
if (axisType === (0, $egi9E$ColumnAxisType).AGE) {
|
|
123
|
+
const t_age = Math.min(...data.map((d)=>d.t_age));
|
|
124
|
+
const b_age = Math.max(...data.map((d)=>d.b_age));
|
|
125
|
+
return [
|
|
126
|
+
b_age,
|
|
127
|
+
t_age
|
|
128
|
+
];
|
|
129
|
+
} else if (axisType == (0, $egi9E$ColumnAxisType).DEPTH || axisType == (0, $egi9E$ColumnAxisType).ORDINAL) {
|
|
130
|
+
const t_pos = Math.min(...data.map((d)=>d.t_pos));
|
|
131
|
+
const b_pos = Math.max(...data.map((d)=>d.b_pos));
|
|
132
|
+
return [
|
|
133
|
+
b_pos,
|
|
134
|
+
t_pos
|
|
135
|
+
];
|
|
136
|
+
} else if (axisType == (0, $egi9E$ColumnAxisType).HEIGHT) {
|
|
137
|
+
const t_pos = Math.max(...data.map((d)=>d.t_pos));
|
|
138
|
+
const b_pos = Math.min(...data.map((d)=>d.b_pos));
|
|
139
|
+
return [
|
|
140
|
+
b_pos,
|
|
141
|
+
t_pos
|
|
142
|
+
];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function $728f6cf6c12cd490$var$findAverageUnitHeight(data, axisType) {
|
|
146
|
+
const unitHeights = data.map((d)=>{
|
|
147
|
+
const [b_pos, t_pos] = (0, $b6657fba8924a702$export$70e712e2ac0237a)(d, axisType);
|
|
148
|
+
return Math.abs(b_pos - t_pos);
|
|
149
|
+
});
|
|
150
|
+
return unitHeights.reduce((a, b)=>a + b, 0) / unitHeights.length;
|
|
151
|
+
}
|
|
152
|
+
function $728f6cf6c12cd490$export$3ada7641926a616d(sections, interpolateUnconformities = false) {
|
|
153
|
+
/** Create a scale that works across multiple packages */ // Get surfaces at which scale breaks
|
|
154
|
+
let scaleBreaks = [];
|
|
155
|
+
for (const section of sections){
|
|
156
|
+
const { pixelHeight: pixelHeight, pixelScale: pixelScale, offset: offset, domain: domain } = section.scaleInfo;
|
|
157
|
+
scaleBreaks.push([
|
|
158
|
+
domain[1],
|
|
159
|
+
offset
|
|
160
|
+
]);
|
|
161
|
+
scaleBreaks.push([
|
|
162
|
+
domain[0],
|
|
163
|
+
offset + pixelHeight
|
|
164
|
+
]);
|
|
165
|
+
}
|
|
166
|
+
// Sort the scale breaks by age
|
|
167
|
+
scaleBreaks.sort((a, b)=>a[0] - b[0]);
|
|
168
|
+
return (age)=>{
|
|
169
|
+
/** Given an age, find the corresponding pixel position */ // Iterate through the sections to find the correct one
|
|
170
|
+
// Accumulate scale breaks and pixel height
|
|
171
|
+
let pixelHeight = 0;
|
|
172
|
+
let pixelScale = 0;
|
|
173
|
+
let lastAge = null;
|
|
174
|
+
for (const [age1, height] of scaleBreaks)if (age <= age1) {
|
|
175
|
+
if (lastAge != null) {
|
|
176
|
+
pixelHeight += (age - lastAge) * pixelScale;
|
|
177
|
+
return pixelHeight;
|
|
178
|
+
}
|
|
179
|
+
lastAge = age;
|
|
180
|
+
pixelHeight = height;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function $728f6cf6c12cd490$export$edbf01b435c75274(sections, threshold, opts) {
|
|
185
|
+
const newSections = [];
|
|
186
|
+
let currentSection = null;
|
|
187
|
+
for (const nextSection of sections){
|
|
188
|
+
if (currentSection == null) {
|
|
189
|
+
currentSection = nextSection;
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
const dAge = Math.abs(nextSection.t_age - currentSection.b_age);
|
|
193
|
+
const pxHeight = dAge * Math.max(currentSection.scaleInfo.pixelScale, nextSection.scaleInfo.pixelScale);
|
|
194
|
+
if (pxHeight < threshold) {
|
|
195
|
+
// We need to merge the sections
|
|
196
|
+
const compositeSection0 = {
|
|
197
|
+
units: [
|
|
198
|
+
...currentSection.units,
|
|
199
|
+
...nextSection.units
|
|
200
|
+
],
|
|
201
|
+
section_id: [
|
|
202
|
+
...(0, $b6657fba8924a702$export$d0c8ecbd4ed8940c)(currentSection.section_id),
|
|
203
|
+
...(0, $b6657fba8924a702$export$d0c8ecbd4ed8940c)(nextSection.section_id)
|
|
204
|
+
],
|
|
205
|
+
t_age: Math.min(currentSection.t_age, nextSection.t_age),
|
|
206
|
+
b_age: Math.max(currentSection.b_age, nextSection.b_age)
|
|
207
|
+
};
|
|
208
|
+
const compositeSection = $728f6cf6c12cd490$var$addScaleToSection(compositeSection0, opts);
|
|
209
|
+
currentSection = compositeSection;
|
|
210
|
+
} else {
|
|
211
|
+
// We need to keep the section
|
|
212
|
+
newSections.push(currentSection);
|
|
213
|
+
currentSection = nextSection;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (currentSection != null) newSections.push(currentSection);
|
|
217
|
+
return newSections;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
|
|
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
|
|
@@ -0,0 +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,UA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AK,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":"composite-scale.577bf64a.js.map"}
|