@macrostrat/column-views 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -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 -120
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +14 -8
- 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 +6 -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":";;;;;;;;;AAAA,qFAAqF;;;;;;;;AA2DrF,SAAS,4CACP,UAAkB,+BAA+B;IAEjD,OAAO,CAAA,GAAA,aAAK,EAAmB,CAAC,KAAK;QACnC,OAAO;qBACL;YACA,kBAAkB,IAAI;YACtB,MAAM,OAAM,GAAW,EAAE,OAAqB;gBAC5C,MAAM,OAAO,UAAU;gBACvB,2BAA2B;gBAC3B,MAAM,oBAAE,gBAAgB,EAAE,GAAG;gBAC7B,IAAI,iBAAiB,GAAG,CAAC,OACvB,OAAO,MAAM,mCAAmC;gBAElD,iBAAiB,GAAG,CAAC;gBACrB,4BAA4B;gBAC5B,MAAM,MAAM,MAAM,CAAA,GAAA,iBAAQ,EAAE,MAAM;gBAClC,iBAAiB,MAAM,CAAC;gBACxB,WAAW;gBACX,OAAO;YACT;YACA,GAAG,6CAAuB,KAAK,IAAI;YACnC,GAAG,2CAAqB,KAAK,IAAI;YACjC,GAAG,8CAAwB,KAAK,IAAI;YACpC,GAAG,yCAAmB,KAAK,IAAI;YAC/B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ACjE,MAAM,cAAc,yCAAmB,CAAC,IAAM,EAAE,WAAW;IAC3D,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,eAAe,MAAM;IAC3B,GAAG;QAAC;QAAa;KAAe;IAChC,OAAO;AACT","sources":["packages/column-views/src/data-provider/base.ts"],"sourcesContent":["/** Data provider for information that needs to be loaded in bulk for frontend views */\nimport baseFetch from \"cross-fetch\";\nimport { createContext, useContext, useEffect, useMemo, useState } from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport { create, useStore } from \"zustand\";\nimport {\n ColumnGeoJSONRecord,\n ColumnGeoJSONRecordWithID,\n Environment,\n MacrostratRef,\n} from \"@macrostrat/api-types\";\nimport {\n fetchAllColumns,\n fetchEnvironments,\n fetchIntervals,\n fetchLithologies,\n fetchRefs,\n} from \"./fetch\";\nimport { APIProvider } from \"@macrostrat/ui-components\";\nimport { ColumnProvider } from \"@macrostrat/column-components\";\n\nimport { ReactNode } from \"react\";\nimport { useMacrostratColumnData } from \"./store\";\n\nexport interface MacrostratDataProviderProps {\n baseURL: string;\n children: React.ReactNode;\n}\n\ninterface ColumnFootprintsStorage {\n project_id: number;\n // Whether the \"in process\" flag was used\n inProcess: boolean;\n // The column footprints\n columns: ColumnGeoJSONRecordWithID[];\n}\n\ninterface RefsSlice {\n refs: Map<number, MacrostratRef>;\n inFlightRequests: Set<string>; // Track requests to avoid duplicates\n getRefs(ids: number[]): Promise<MacrostratRef[]>;\n}\n\ninterface MacrostratStore extends RefsSlice {\n baseURL: string;\n fetch: any;\n lithologies: Map<number, any> | null;\n getLithologies(ids: number[] | null): Promise<any>;\n intervals: Map<number, any> | null;\n getIntervals(ids: number[] | null, timescaleID: number | null): Promise<any>;\n environments: Map<number, Environment> | null;\n getEnvironments(ids: number[] | null): Promise<Environment[]>;\n columnFootprints: Map<number, ColumnFootprintsStorage>;\n getColumns(\n projectID: number | null,\n inProcess: boolean\n ): Promise<ColumnGeoJSONRecord[]>;\n}\n\nfunction createMacrostratStore(\n baseURL: string = \"https://macrostrat.org/api/v2\"\n) {\n return create<MacrostratStore>((set, get): MacrostratStore => {\n return {\n baseURL,\n inFlightRequests: new Set(),\n async fetch(url: string, options?: RequestInit) {\n const url1 = baseURL + url;\n // Avoid duplicate requests\n const { inFlightRequests } = get();\n if (inFlightRequests.has(url1)) {\n return null; // Return null if already in flight\n }\n inFlightRequests.add(url1);\n //set({ inFlightRequests });\n const res = await baseFetch(url1, options);\n inFlightRequests.delete(url1);\n //set({in})\n return res;\n },\n ...createLithologiesSlice(set, get),\n ...createIntervalsSlice(set, get),\n ...createEnvironmentsSlice(set, get),\n ...createColumnsSlice(set, get),\n ...createRefsSlice(set, get),\n };\n });\n}\n\nfunction createRefsSlice(set, get) {\n return {\n refs: new Map(),\n async getRefs(ids: number[]): Promise<MacrostratRef[]> {\n const { refs, fetch } = get();\n const missing = ids.filter((id) => !refs.has(id));\n if (missing.length == 0) {\n return ids.map((id) => refs.get(id));\n }\n const data = await fetchRefs(missing, fetch);\n if (data == null) return [];\n for (const d of data) {\n refs.set(d.ref_id, d);\n }\n set({ refs });\n return ids.map((id) => refs.get(id));\n },\n };\n}\n\nfunction createColumnsSlice(set, get) {\n // Column footprints separated by project\n return {\n columnFootprints: new Map(),\n async getColumns(projectID: number | null, inProcess: boolean) {\n const { columnFootprints, baseURL, fetch } = get();\n const key = projectID ?? -1;\n let _inProcess = inProcess;\n if (projectID == null) {\n // If no project is specified, in process columns cannot be included\n _inProcess = false;\n }\n let footprints = columnFootprints.get(key);\n if (footprints == null || footprints.inProcess != _inProcess) {\n // Fetch the columns\n const statusCode = inProcess ? \"in process\" : null;\n let columns = await fetchAllColumns({\n projectID,\n statusCode: null,\n fetch,\n });\n if (columns == null) {\n return;\n }\n if (_inProcess) {\n const inProcessColumns = await fetchAllColumns({\n projectID,\n statusCode: \"in process\",\n fetch,\n });\n if (inProcessColumns == null) {\n return;\n }\n // Combine active and in-process columns\n columns = columns.concat(inProcessColumns);\n }\n\n footprints = {\n project_id: projectID,\n inProcess,\n columns,\n };\n // We could break multi-project result sets into separate caches here...\n // Copy the original map\n const columnFootprints2 = new Map(columnFootprints);\n columnFootprints2.set(key, footprints);\n set({ columnFootprints: columnFootprints2 });\n }\n return footprints.columns;\n },\n };\n}\n\nfunction createLithologiesSlice(set, get) {\n return {\n lithologies: null,\n async getLithologies(ids: number[] | null) {\n const { lithologies, fetch } = get();\n let lithMap = lithologies;\n if (lithMap == null) {\n const data = await fetchLithologies(fetch);\n if (data == null) return;\n lithMap = new Map(data.map((d) => [d.lith_id, d]));\n set({ lithologies: lithMap });\n }\n // Now get the lithologies\n if (ids == null) return lithMap.values();\n return ids.map((id) => lithMap.get(id));\n },\n };\n}\n\nfunction createEnvironmentsSlice(set, get) {\n return {\n environments: null,\n async getEnvironments(ids: number[] | null): Promise<Environment[]> {\n const { environments, fetch } = get();\n let envMap = environments;\n if (envMap == null) {\n const data = await fetchEnvironments(fetch);\n if (data == null) return [];\n envMap = new Map(data.map((d) => [d.environ_id, d]));\n set({ environments: envMap });\n }\n // Now get the environments\n if (ids == null) return envMap.values();\n return ids.map((id) => envMap.get(id));\n },\n };\n}\n\nfunction createIntervalsSlice(set, get) {\n return {\n intervals: null,\n async getIntervals(ids: number[] | null, timescaleID: number | null) {\n const { intervals, fetch } = get();\n let _intervals = intervals;\n if (intervals == null || !includesTimescale(intervals, timescaleID)) {\n // Fetch the intervals\n const data = await fetchIntervals(timescaleID, fetch);\n if (data == null) {\n return [];\n }\n const intervalMap = intervals ?? new Map();\n for (const d of data) {\n intervalMap.set(d.int_id, d);\n }\n _intervals = intervalMap;\n set({ intervals: _intervals });\n }\n if (ids == null && timescaleID == null)\n return Array.from(_intervals.values());\n if (timescaleID != null) {\n return Array.from(_intervals.values() as any[]).filter(\n (d) => d.timescale_id == timescaleID\n );\n }\n return ids.map((id) => intervals.get(id));\n },\n };\n}\n\nfunction includesTimescale(intervals: Map<number, any>, timescaleID: number) {\n if (intervals == null) return false;\n if (timescaleID == null) return true;\n return Array.from(intervals.values()).some(\n (d) => d.timescale_id == timescaleID\n );\n}\n\ntype MacrostratSelector = (store: MacrostratStore) => any;\n\nexport function useMacrostratStore(selector: MacrostratSelector | \"api\") {\n const ctx = useContext(MacrostratDataProviderContext);\n if (ctx == null) {\n throw new Error(\"Missing MacrostratDataProvider\");\n }\n if (selector === \"api\") {\n return ctx;\n }\n\n return useStore(ctx, selector);\n}\n\nconst dataTypeMapping = {\n lithologies: (store) => store.getLithologies,\n intervals: (store) => store.getIntervals,\n columns: (store) => store.getColumns,\n environments: (store) => store.getEnvironments,\n refs: (store) => store.getRefs,\n};\n\nexport function useMacrostratDefs(dataType: string): Map<number, any> | null {\n if (dataType == \"columns\") {\n throw new Error(\"Columns are not provided as a map\");\n }\n const operator = useMacrostratStore(dataTypeMapping[dataType]);\n useEffect(() => {\n operator();\n }, []);\n return useMacrostratStore((state) => state[dataType]);\n}\n\nexport function useMacrostratColumns(\n projectID: number | null,\n inProcess: boolean\n) {\n const getColumns = useMacrostratStore((s) => s.getColumns);\n const columnsMap = useMacrostratStore((s) => s.columnFootprints);\n const key = projectID ?? -1;\n const colData = columnsMap?.get(key);\n useEffect(() => {\n // Refetch if the columns are not available, or if we have requested inProcess columns where we didn't before\n if (colData == null || (inProcess && !colData.inProcess)) {\n getColumns(projectID, inProcess);\n }\n // If we've already fetched the columns there's nothing to do...\n }, [colData, inProcess, getColumns]);\n\n return useMemo(() => {\n if (colData == null) return null;\n let columns = colData.columns;\n if (!inProcess && colData.inProcess) {\n // Our available set of columns includes 'in process' columns, but we don't want them\n columns.features = columns.features?.filter(\n (d) => d.properties.status != \"in process\"\n );\n }\n return columns;\n }, [colData, inProcess]);\n}\n\nexport function useMacrostratData(dataType: string, ...args: any[]) {\n const selector = dataTypeMapping[dataType];\n const operator = useMacrostratStore(selector);\n\n const [value, setValue] = useState(null);\n\n useEffect(() => {\n operator(...args).then(setValue);\n }, [operator, ...args]);\n\n return value;\n}\n\n/** By default, we provide a store linked to the production API */\nconst MacrostratDataProviderContext = createContext(createMacrostratStore());\n\nexport function MacrostratDataProvider(props: MacrostratDataProviderProps) {\n const { baseURL = \"https://macrostrat.org/api/v2\", children } = props;\n\n const [store] = useState(() => createMacrostratStore(baseURL));\n\n return h(\n MacrostratAPIProvider,\n { baseURL },\n h(MacrostratDataProviderContext.Provider, { value: store }, children)\n );\n}\n\n/** Legacy API provider so useAPIResult can work */\n\ntype APIProviderProps = {\n children: ReactNode;\n useDev?: boolean;\n baseURL?: string;\n};\n\nexport function MacrostratAPIProvider({\n children,\n useDev = false,\n baseURL,\n}: APIProviderProps) {\n baseURL ??= useDev\n ? \"https://dev2.macrostrat.org/api/v2\"\n : \"https://macrostrat.org/api/v2\";\n\n return h(\n APIProvider,\n {\n baseURL,\n unwrapResponse: (res) => res.success.data,\n },\n children\n );\n}\n\nexport function MacrostratColumnProvider(props) {\n /** A column provider specialized the Macrostrat API. Maps more\n * generic concepts to Macrostrat-specific ones.\n */\n\n const { axisType } = useMacrostratColumnData();\n const { units, domain, pixelScale, children } = props;\n return h(\n ColumnProvider,\n { axisType, divisions: units, range: domain, pixelsPerMeter: pixelScale },\n children\n );\n}\n\n/** This is now a legacy provider */\nexport function LithologiesProvider({ children }) {\n useEffect(() => {\n console.warn(\n \"LithologiesProvider is deprecated. Replace with MacrostratDataProvider\"\n );\n }, []);\n return children;\n}\n\nexport function useLithologies() {\n const getLithologies = useMacrostratStore((s) => s.getLithologies);\n const lithologies = useMacrostratStore((s) => s.lithologies);\n useEffect(() => {\n if (lithologies == null) getLithologies();\n }, [lithologies, getLithologies]);\n return lithologies;\n}\n"],"names":[],"version":3,"file":"base.910b80b4.js.map"}
|
|
@@ -0,0 +1,258 @@
|
|
|
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";
|
|
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
|
+
import {SizeAwareLabel as $lClM8$SizeAwareLabel} from "@macrostrat/ui-components";
|
|
10
|
+
import $lClM8$macrostrathyper from "@macrostrat/hyper";
|
|
11
|
+
import {useContext as $lClM8$useContext, forwardRef as $lClM8$forwardRef, useMemo as $lClM8$useMemo} from "react";
|
|
12
|
+
import $lClM8$classnames from "classnames";
|
|
13
|
+
import {path as $lClM8$path} from "d3-path";
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
function $parcel$interopDefault(a) {
|
|
17
|
+
return a && a.__esModule ? a.default : a;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
const $d254716a820e9c85$var$h = (0, $lClM8$macrostrathyper).styled((0, ($parcel$interopDefault($lClM8$boxesmodule4ebc7796js))));
|
|
32
|
+
function $d254716a820e9c85$var$useUnitRect(division, options = {}) {
|
|
33
|
+
const { widthFraction: widthFraction = 1, axisType: axisType = (0, $lClM8$ColumnAxisType).AGE, padding: padding = 0 } = options;
|
|
34
|
+
const { scale: scale } = (0, $lClM8$useContext)((0, $lClM8$ColumnContext));
|
|
35
|
+
const { width: width } = (0, $lClM8$useContext)((0, $lClM8$ColumnLayoutContext));
|
|
36
|
+
const [bottomHeight, topHeight] = (0, $b6657fba8924a702$export$70e712e2ac0237a)(division, axisType);
|
|
37
|
+
const y = scale(topHeight);
|
|
38
|
+
const height = Math.abs(scale(bottomHeight) - y);
|
|
39
|
+
return {
|
|
40
|
+
x: width * (1 - widthFraction) - padding,
|
|
41
|
+
y: y - padding,
|
|
42
|
+
height: height + padding * 2,
|
|
43
|
+
width: widthFraction * width + padding * 2
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function $d254716a820e9c85$export$d54fdbabca27e53(props) {
|
|
47
|
+
const { division: d, children: children, className: className, widthFraction: widthFraction = 1, axisType: _, nColumns: __, ...baseBounds } = props;
|
|
48
|
+
const { axisType: axisType } = (0, $lClM8$useColumn)();
|
|
49
|
+
const lithMap = (0, $774a5efa27d1c77b$export$4d18a90c945d129f)();
|
|
50
|
+
const bounds = {
|
|
51
|
+
...$d254716a820e9c85$var$useUnitRect(d, {
|
|
52
|
+
widthFraction: widthFraction,
|
|
53
|
+
axisType: axisType
|
|
54
|
+
}),
|
|
55
|
+
...baseBounds
|
|
56
|
+
};
|
|
57
|
+
const backgroundColor = (0, $6698edd2a743bf07$export$175d3e927f1a9860)(d, lithMap, null, false);
|
|
58
|
+
const [ref, selected, onClick] = (0, $4d5d1c15f39f6a14$export$cbbec12b1451fe7d)(d);
|
|
59
|
+
return $d254716a820e9c85$var$h("g.unit", {
|
|
60
|
+
className: className,
|
|
61
|
+
style: {
|
|
62
|
+
"--column-unit-background-color": backgroundColor,
|
|
63
|
+
"--column-stroke-color": backgroundColor
|
|
64
|
+
}
|
|
65
|
+
}, [
|
|
66
|
+
$d254716a820e9c85$var$h("rect.unit.background", {
|
|
67
|
+
ref: ref,
|
|
68
|
+
...bounds,
|
|
69
|
+
fill: backgroundColor,
|
|
70
|
+
fillOpacity: 0.8,
|
|
71
|
+
stroke: backgroundColor,
|
|
72
|
+
onClick: onClick
|
|
73
|
+
}),
|
|
74
|
+
$d254716a820e9c85$var$h.if(selected)("rect.selection-overlay", bounds)
|
|
75
|
+
]);
|
|
76
|
+
}
|
|
77
|
+
function $d254716a820e9c85$export$1d8b9ae22d404866(props) {
|
|
78
|
+
const { division: d, children: children, fill: fill, defaultFill: defaultFill = "transparent", className: className, widthFraction: widthFraction = 1, backgroundColor: backgroundColor, patternColor: patternColor, axisType: _, ...baseBounds } = props;
|
|
79
|
+
const { axisType: axisType } = (0, $lClM8$useColumn)();
|
|
80
|
+
const hasOverflowTop = d.t_clip_pos != null;
|
|
81
|
+
const hasOverflowBottom = d.b_clip_pos != null;
|
|
82
|
+
const bounds = {
|
|
83
|
+
...$d254716a820e9c85$var$useUnitRect(d, {
|
|
84
|
+
widthFraction: widthFraction,
|
|
85
|
+
axisType: axisType
|
|
86
|
+
}),
|
|
87
|
+
...baseBounds,
|
|
88
|
+
overflowTop: hasOverflowTop,
|
|
89
|
+
overflowBottom: hasOverflowBottom
|
|
90
|
+
};
|
|
91
|
+
const patternID = (0, $d3e69bd163d41f63$export$7be7d732f3de9464)(d);
|
|
92
|
+
let _fill = fill ?? (0, $lClM8$useGeologicPattern)(patternID, defaultFill);
|
|
93
|
+
const hasBackgroundColor = backgroundColor != null;
|
|
94
|
+
const _className = (0, $lClM8$classnames)(className, {
|
|
95
|
+
colored: hasBackgroundColor
|
|
96
|
+
});
|
|
97
|
+
const [ref, selected, onClick] = (0, $4d5d1c15f39f6a14$export$cbbec12b1451fe7d)(d);
|
|
98
|
+
//const key = `unit-${d.unit_id}`;
|
|
99
|
+
return $d254716a820e9c85$var$h("g.unit", {
|
|
100
|
+
className: _className,
|
|
101
|
+
style: {
|
|
102
|
+
"--column-unit-background-color": backgroundColor
|
|
103
|
+
}
|
|
104
|
+
}, [
|
|
105
|
+
$d254716a820e9c85$var$h($d254716a820e9c85$var$UnitRect, {
|
|
106
|
+
...bounds,
|
|
107
|
+
fill: backgroundColor,
|
|
108
|
+
onClick: onClick,
|
|
109
|
+
className: "background"
|
|
110
|
+
}),
|
|
111
|
+
$d254716a820e9c85$var$h($d254716a820e9c85$var$UnitRect, {
|
|
112
|
+
ref: ref,
|
|
113
|
+
...bounds,
|
|
114
|
+
fill: _fill,
|
|
115
|
+
onClick: //mask,
|
|
116
|
+
onClick,
|
|
117
|
+
className: "unit"
|
|
118
|
+
}),
|
|
119
|
+
$d254716a820e9c85$var$h.if(selected)($d254716a820e9c85$var$UnitRect, {
|
|
120
|
+
...bounds,
|
|
121
|
+
className: "selection-overlay"
|
|
122
|
+
}),
|
|
123
|
+
//defs,
|
|
124
|
+
children
|
|
125
|
+
]);
|
|
126
|
+
}
|
|
127
|
+
const $d254716a820e9c85$var$UnitRect = (0, $lClM8$forwardRef)((props, ref)=>{
|
|
128
|
+
const { x: x, y: y, width: width, height: height, overflowTop: overflowTop = false, overflowBottom: overflowBottom = false, ...rest } = props;
|
|
129
|
+
if (!overflowTop && !overflowBottom) return $d254716a820e9c85$var$h("rect", {
|
|
130
|
+
x: x,
|
|
131
|
+
y: y,
|
|
132
|
+
width: width,
|
|
133
|
+
height: height,
|
|
134
|
+
ref: ref,
|
|
135
|
+
...rest
|
|
136
|
+
});
|
|
137
|
+
else {
|
|
138
|
+
const d = $d254716a820e9c85$var$zigZagBoxPath(x, y, width, height, overflowTop, overflowBottom);
|
|
139
|
+
return $d254716a820e9c85$var$h("path", {
|
|
140
|
+
d: d,
|
|
141
|
+
ref: ref,
|
|
142
|
+
...rest
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
function $d254716a820e9c85$var$zigZagBoxPath(x, y, width, height, top, bottom) {
|
|
147
|
+
const zigZagWidth = 10;
|
|
148
|
+
const zigZagHeight = 4;
|
|
149
|
+
const d = (0, $lClM8$path)();
|
|
150
|
+
const nZigZags = Math.floor(width / zigZagWidth - 0.5);
|
|
151
|
+
const _zigZagWidth = width / (nZigZags + 0.5);
|
|
152
|
+
d.moveTo(x, y);
|
|
153
|
+
let dy = zigZagHeight / 2;
|
|
154
|
+
// Each zig-zag consists of a short outward motion
|
|
155
|
+
let dx = _zigZagWidth / 4;
|
|
156
|
+
let cx = x;
|
|
157
|
+
let cy = y;
|
|
158
|
+
const doZigZag = (last = false)=>{
|
|
159
|
+
cx += dx;
|
|
160
|
+
cy -= dy;
|
|
161
|
+
d.lineTo(cx, cy);
|
|
162
|
+
let scalar = last ? 1 : 2;
|
|
163
|
+
cx += dx * scalar;
|
|
164
|
+
cy += dy * scalar;
|
|
165
|
+
d.lineTo(cx, cy);
|
|
166
|
+
cx += dx;
|
|
167
|
+
cy -= dy;
|
|
168
|
+
};
|
|
169
|
+
if (top) {
|
|
170
|
+
// Move to the offset
|
|
171
|
+
//d.lineTo(cx, y);
|
|
172
|
+
// Draw the zig-zags
|
|
173
|
+
for(let i = 0; i < nZigZags; i++)doZigZag();
|
|
174
|
+
// Draw the last half zig-zag
|
|
175
|
+
doZigZag(true);
|
|
176
|
+
}
|
|
177
|
+
// Draw the right edge
|
|
178
|
+
d.lineTo(x + width, y);
|
|
179
|
+
d.lineTo(x + width, y + height);
|
|
180
|
+
if (bottom) {
|
|
181
|
+
dx = -dx;
|
|
182
|
+
dy = -dy;
|
|
183
|
+
cx = x + width;
|
|
184
|
+
cy = y + height;
|
|
185
|
+
for(let i = 0; i < nZigZags; i++)doZigZag();
|
|
186
|
+
doZigZag(true);
|
|
187
|
+
}
|
|
188
|
+
// Draw the last line to the left edge
|
|
189
|
+
d.lineTo(x, y + height);
|
|
190
|
+
// Draw the left edge
|
|
191
|
+
d.closePath();
|
|
192
|
+
// Now render the path;
|
|
193
|
+
return d.toString();
|
|
194
|
+
}
|
|
195
|
+
function $d254716a820e9c85$export$b4f0ca233b98f9af(props) {
|
|
196
|
+
const { division: division, label: label, onLabelUpdated: onLabelUpdated, widthFraction: widthFraction, showLabel: showLabel = true, backgroundColor: backgroundColor, axisType: _, ...baseBounds } = props;
|
|
197
|
+
const { axisType: axisType } = (0, $lClM8$useColumn)();
|
|
198
|
+
const bounds = {
|
|
199
|
+
...$d254716a820e9c85$var$useUnitRect(division, {
|
|
200
|
+
widthFraction: widthFraction,
|
|
201
|
+
axisType: axisType
|
|
202
|
+
}),
|
|
203
|
+
...baseBounds
|
|
204
|
+
};
|
|
205
|
+
const { width: width, height: height } = bounds;
|
|
206
|
+
return $d254716a820e9c85$var$h($d254716a820e9c85$export$1d8b9ae22d404866, {
|
|
207
|
+
className: "labeled-unit",
|
|
208
|
+
division: division,
|
|
209
|
+
backgroundColor: backgroundColor,
|
|
210
|
+
...bounds
|
|
211
|
+
}, [
|
|
212
|
+
$d254716a820e9c85$var$h.if(showLabel)((0, $lClM8$ForeignObject), {
|
|
213
|
+
...bounds,
|
|
214
|
+
className: "unit-label-container"
|
|
215
|
+
}, $d254716a820e9c85$var$h((0, $lClM8$SizeAwareLabel), {
|
|
216
|
+
className: "unit-overlay",
|
|
217
|
+
labelClassName: "unit-label",
|
|
218
|
+
style: {
|
|
219
|
+
width: width,
|
|
220
|
+
height: height
|
|
221
|
+
},
|
|
222
|
+
label: label,
|
|
223
|
+
onVisibilityChanged (viz) {
|
|
224
|
+
onLabelUpdated(label, viz);
|
|
225
|
+
}
|
|
226
|
+
}))
|
|
227
|
+
]);
|
|
228
|
+
}
|
|
229
|
+
function $d254716a820e9c85$export$5d1cdfabe8dc8085(props) {
|
|
230
|
+
const { unitComponent: unitComponent = $d254716a820e9c85$export$1d8b9ae22d404866, unitComponentProps: unitComponentProps = {} } = props;
|
|
231
|
+
const { divisions: divisions } = (0, $lClM8$useContext)((0, $lClM8$ColumnContext));
|
|
232
|
+
if (divisions.length == 0) {
|
|
233
|
+
console.warn("No divisions found in column context");
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
const children = (0, $lClM8$useMemo)(()=>{
|
|
237
|
+
return divisions.map((division, i)=>{
|
|
238
|
+
// @ts-ignore
|
|
239
|
+
return $d254716a820e9c85$var$h(unitComponent, {
|
|
240
|
+
division: division,
|
|
241
|
+
key: division.unit_id,
|
|
242
|
+
...unitComponentProps
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
}, [
|
|
246
|
+
divisions,
|
|
247
|
+
unitComponent,
|
|
248
|
+
unitComponentProps
|
|
249
|
+
]);
|
|
250
|
+
return $d254716a820e9c85$var$h((0, $lClM8$PatternDefsProvider), {
|
|
251
|
+
resolveID: $d3e69bd163d41f63$export$7be7d732f3de9464,
|
|
252
|
+
scalePattern: $d3e69bd163d41f63$export$e8deec7b02ce51eb
|
|
253
|
+
}, $d254716a820e9c85$var$h("g.divisions", children));
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
|
|
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
|
|
@@ -0,0 +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,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AAM,YAAE,QAAQ,EAAE,GAAG,CAAA,GAAA,gBAAQ;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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.WkKD8q_unit-label-container {
|
|
2
|
+
pointer-events: none;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.WkKD8q_labeled-unit {
|
|
6
|
+
--column-unit-background-internal: var(--column-unit-background-color, var(--column-background-color));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.WkKD8q_labeled-unit .unit-overlay {
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
font-size: 10px;
|
|
13
|
+
font-style: italic;
|
|
14
|
+
display: flex;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.WkKD8q_labeled-unit .unit-label {
|
|
18
|
+
color: var(--column-text-color);
|
|
19
|
+
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);
|
|
20
|
+
display: block;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.WkKD8q_labeled-unit .WkKD8q_background {
|
|
24
|
+
fill: var(--column-unit-background-internal, transparent);
|
|
25
|
+
}
|
|
26
|
+
/*# sourceMappingURL=boxes.module.2b5fb18e.css.map */
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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 $b9031ec72fd2f651$exports = {};
|
|
6
|
+
|
|
7
|
+
$parcel$export($b9031ec72fd2f651$exports, "background", () => $b9031ec72fd2f651$export$8ce1fd94bee2f412, (v) => $b9031ec72fd2f651$export$8ce1fd94bee2f412 = v);
|
|
8
|
+
$parcel$export($b9031ec72fd2f651$exports, "labeled-unit", () => $b9031ec72fd2f651$export$1dec37058a9db506, (v) => $b9031ec72fd2f651$export$1dec37058a9db506 = v);
|
|
9
|
+
$parcel$export($b9031ec72fd2f651$exports, "unit-label-container", () => $b9031ec72fd2f651$export$7756584041496870, (v) => $b9031ec72fd2f651$export$7756584041496870 = v);
|
|
10
|
+
var $b9031ec72fd2f651$export$8ce1fd94bee2f412;
|
|
11
|
+
var $b9031ec72fd2f651$export$1dec37058a9db506;
|
|
12
|
+
var $b9031ec72fd2f651$export$7756584041496870;
|
|
13
|
+
$b9031ec72fd2f651$export$8ce1fd94bee2f412 = `WkKD8q_background`;
|
|
14
|
+
$b9031ec72fd2f651$export$1dec37058a9db506 = `WkKD8q_labeled-unit`;
|
|
15
|
+
$b9031ec72fd2f651$export$7756584041496870 = `WkKD8q_unit-label-container`;
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export {$b9031ec72fd2f651$exports as default};
|
|
19
|
+
//# sourceMappingURL=boxes.module.4ebc7796.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AAFA,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAiC,CAAC,mBAAmB,CAAC;AACtD,4CAAyC,CAAC,2BAA2B,CAAC","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.4ebc7796.js.map"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {IsotopesDataset as $d5a3eba6c540ff58$export$c69bd0285aa5d775, IsotopesColumn as $d5a3eba6c540ff58$export$5d8aa8022c284748} from "./isotopes-column.7cb5cc45.js";
|
|
2
2
|
import {MeasurementDataContext as $8adf39b8c41fe3cc$export$c644ef985ce7a4c4, MeasurementDataProvider as $8adf39b8c41fe3cc$export$5f01d5b342a89841, useMeasurementData as $8adf39b8c41fe3cc$export$8a0335fd9ff72150} from "./data-provider.1506eb64.js";
|
|
3
|
-
import {CarbonIsotopesColumn as $5cc70deb5088007a$export$883edafebdc6d87e, CarbonIsotopesApp as $5cc70deb5088007a$export$e2beef9ae524c9d5} from "./core.
|
|
3
|
+
import {CarbonIsotopesColumn as $5cc70deb5088007a$export$883edafebdc6d87e, CarbonIsotopesApp as $5cc70deb5088007a$export$e2beef9ae524c9d5} from "./core.843310d3.js";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -8,4 +8,4 @@ import {CarbonIsotopesColumn as $5cc70deb5088007a$export$883edafebdc6d87e, Carbo
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
export {$d5a3eba6c540ff58$export$c69bd0285aa5d775 as IsotopesDataset, $d5a3eba6c540ff58$export$5d8aa8022c284748 as IsotopesColumn, $8adf39b8c41fe3cc$export$c644ef985ce7a4c4 as MeasurementDataContext, $8adf39b8c41fe3cc$export$5f01d5b342a89841 as MeasurementDataProvider, $8adf39b8c41fe3cc$export$8a0335fd9ff72150 as useMeasurementData, $5cc70deb5088007a$export$883edafebdc6d87e as CarbonIsotopesColumn, $5cc70deb5088007a$export$e2beef9ae524c9d5 as CarbonIsotopesApp};
|
|
11
|
-
//# sourceMappingURL=carbon-isotopes.
|
|
11
|
+
//# sourceMappingURL=carbon-isotopes.10db8285.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"","sources":["packages/column-views/src/carbon-isotopes/index.ts"],"sourcesContent":["export * from \"./isotopes-column\";\nexport * from \"./data-provider\";\nexport * from \"./core\";\n"],"names":[],"version":3,"file":"carbon-isotopes.
|
|
1
|
+
{"mappings":"","sources":["packages/column-views/src/carbon-isotopes/index.ts"],"sourcesContent":["export * from \"./isotopes-column\";\nexport * from \"./data-provider\";\nexport * from \"./core\";\n"],"names":[],"version":3,"file":"carbon-isotopes.10db8285.js.map"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import $kwOHx$chromajs from "chroma-js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function $6698edd2a743bf07$export$175d3e927f1a9860(unit, lithMap, inDarkMode = false, asBackground = true) {
|
|
5
|
+
const liths = unit.lith;
|
|
6
|
+
if (liths == null) return "gray";
|
|
7
|
+
const lithData = liths.map((d)=>{
|
|
8
|
+
let prop = d.prop;
|
|
9
|
+
if (prop == null || isNaN(prop) || prop <= 0) prop = null;
|
|
10
|
+
return {
|
|
11
|
+
lith_id: d.lith_id,
|
|
12
|
+
prop: prop,
|
|
13
|
+
color: lithMap?.get(d.lith_id)?.color
|
|
14
|
+
};
|
|
15
|
+
}).filter((d)=>d.color != null);
|
|
16
|
+
const lithsWithProp = lithData.filter((d)=>d.prop != null);
|
|
17
|
+
const lithsWithoutProp = lithData.filter((d)=>d.prop == null);
|
|
18
|
+
const totalProp = lithsWithProp.reduce((sum, d)=>sum + d.prop, 0);
|
|
19
|
+
if (totalProp < 1 && lithsWithoutProp.length > 0) {
|
|
20
|
+
const remainingProp = 1 - totalProp;
|
|
21
|
+
// Distribute remaining proportion equally among liths without prop
|
|
22
|
+
const equalProp = remainingProp / lithsWithoutProp.length;
|
|
23
|
+
lithsWithoutProp.forEach((d)=>{
|
|
24
|
+
lithsWithProp.push({
|
|
25
|
+
...d,
|
|
26
|
+
prop: equalProp
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (lithsWithProp.length == 0) return null;
|
|
31
|
+
// Mix colors proportionally
|
|
32
|
+
const baseColor = (0, $kwOHx$chromajs).average(lithsWithProp.map((d)=>d.color), "lrgb", lithsWithProp.map((d)=>d.prop));
|
|
33
|
+
if (!asBackground) return baseColor.hex();
|
|
34
|
+
if (inDarkMode) return baseColor.set("hsl.l", 0.2).hex();
|
|
35
|
+
else return baseColor.set("hsl.l", 0.9).hex();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
export {$6698edd2a743bf07$export$175d3e927f1a9860 as getMixedUnitColor};
|
|
40
|
+
//# sourceMappingURL=colors.395c6db5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;AAGO,SAAS,0CACd,IAAc,EACd,OAAO,EACP,aAAa,KAAK,EAClB,eAAe,IAAI;IAEnB,MAAM,QAAQ,KAAK,IAAI;IACvB,IAAI,SAAS,MACX,OAAO;IAET,MAAM,WAAW,MACd,GAAG,CAAC,CAAC;QACJ,IAAI,OAAO,EAAE,IAAI;QACjB,IAAI,QAAQ,QAAQ,MAAM,SAAS,QAAQ,GACzC,OAAO;QAET,OAAO;YACL,SAAS,EAAE,OAAO;kBAClB;YACA,OAAO,SAAS,IAAI,EAAE,OAAO,GAAG;QAClC;IACF,GACC,MAAM,CAAC,CAAC,IAAM,EAAE,KAAK,IAAI;IAE5B,MAAM,gBAAgB,SAAS,MAAM,CAAC,CAAC,IAAM,EAAE,IAAI,IAAI;IACvD,MAAM,mBAAmB,SAAS,MAAM,CAAC,CAAC,IAAM,EAAE,IAAI,IAAI;IAE1D,MAAM,YAAY,cAAc,MAAM,CAAC,CAAC,KAAK,IAAM,MAAM,EAAE,IAAI,EAAE;IACjE,IAAI,YAAY,KAAK,iBAAiB,MAAM,GAAG,GAAG;QAChD,MAAM,gBAAgB,IAAI;QAC1B,mEAAmE;QACnE,MAAM,YAAY,gBAAgB,iBAAiB,MAAM;QACzD,iBAAiB,OAAO,CAAC,CAAC;YACxB,cAAc,IAAI,CAAC;gBACjB,GAAG,CAAC;gBACJ,MAAM;YACR;QACF;IACF;IAEA,IAAI,cAAc,MAAM,IAAI,GAC1B,OAAO;IAGT,4BAA4B;IAC5B,MAAM,YAAY,CAAA,GAAA,eAAK,EAAE,OAAO,CAC9B,cAAc,GAAG,CAAC,CAAC,IAAM,EAAE,KAAK,GAChC,QACA,cAAc,GAAG,CAAC,CAAC,IAAM,EAAE,IAAI;IAGjC,IAAI,CAAC,cACH,OAAO,UAAU,GAAG;IAGtB,IAAI,YACF,OAAO,UAAU,GAAG,CAAC,SAAS,KAAK,GAAG;SAEtC,OAAO,UAAU,GAAG,CAAC,SAAS,KAAK,GAAG;AAE1C","sources":["packages/column-views/src/units/colors.ts"],"sourcesContent":["import chroma from \"chroma-js\";\nimport { UnitLong } from \"@macrostrat/api-types\";\n\nexport function getMixedUnitColor(\n unit: UnitLong,\n lithMap,\n inDarkMode = false,\n asBackground = true\n): string | null {\n const liths = unit.lith;\n if (liths == null) {\n return \"gray\";\n }\n const lithData = liths\n .map((d) => {\n let prop = d.prop;\n if (prop == null || isNaN(prop) || prop <= 0) {\n prop = null;\n }\n return {\n lith_id: d.lith_id,\n prop,\n color: lithMap?.get(d.lith_id)?.color,\n };\n })\n .filter((d) => d.color != null);\n\n const lithsWithProp = lithData.filter((d) => d.prop != null);\n const lithsWithoutProp = lithData.filter((d) => d.prop == null);\n\n const totalProp = lithsWithProp.reduce((sum, d) => sum + d.prop, 0);\n if (totalProp < 1 && lithsWithoutProp.length > 0) {\n const remainingProp = 1 - totalProp;\n // Distribute remaining proportion equally among liths without prop\n const equalProp = remainingProp / lithsWithoutProp.length;\n lithsWithoutProp.forEach((d) => {\n lithsWithProp.push({\n ...d,\n prop: equalProp,\n });\n });\n }\n\n if (lithsWithProp.length == 0) {\n return null;\n }\n\n // Mix colors proportionally\n const baseColor = chroma.average(\n lithsWithProp.map((d) => d.color),\n \"lrgb\",\n lithsWithProp.map((d) => d.prop)\n );\n\n if (!asBackground) {\n return baseColor.hex();\n }\n\n if (inDarkMode) {\n return baseColor.set(\"hsl.l\", 0.2).hex();\n } else {\n return baseColor.set(\"hsl.l\", 0.9).hex();\n }\n}\n"],"names":[],"version":3,"file":"colors.395c6db5.js.map"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {ColumnCorrelationMap as $dcd183b733f66144$export$8e7d97509e84cc49} from "./core.91ede078.js";
|
|
2
|
+
import {ColumnCorrelationProvider as $74e211dc185c20b4$export$72ffe141ebf87ef1, useCorrelationMapStore as $74e211dc185c20b4$export$21398703d3a9bb4d} from "./state.2952cbca.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export {$dcd183b733f66144$export$8e7d97509e84cc49 as ColumnCorrelationMap, $74e211dc185c20b4$export$72ffe141ebf87ef1 as ColumnCorrelationProvider, $74e211dc185c20b4$export$21398703d3a9bb4d as useCorrelationMapStore};
|
|
9
|
+
//# sourceMappingURL=column-correlation.c8dcfe98.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"","sources":["packages/column-views/src/maps/column-correlation/index.ts"],"sourcesContent":["export * from \"./core\";\nexport * from \"./state\";\n"],"names":[],"version":3,"file":"column-correlation.c8dcfe98.js.map"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import $cgYa0$macrostrathyper from "@macrostrat/hyper";
|
|
2
|
+
import {getQueryString as $cgYa0$getQueryString, setQueryString as $cgYa0$setQueryString} from "@macrostrat/ui-components";
|
|
3
|
+
import {createContext as $cgYa0$createContext, useContext as $cgYa0$useContext, useState as $cgYa0$useState, useEffect as $cgYa0$useEffect} from "react";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const $b8de97dfa82f4910$var$ColumnNavCtx = (0, $cgYa0$createContext)(null);
|
|
9
|
+
function $b8de97dfa82f4910$export$91cb5ac808759b34(defaultArgs = {
|
|
10
|
+
col_id: 495,
|
|
11
|
+
unit_id: null
|
|
12
|
+
}) {
|
|
13
|
+
const ctx = (0, $cgYa0$useContext)($b8de97dfa82f4910$var$ColumnNavCtx);
|
|
14
|
+
if (ctx != null) return ctx;
|
|
15
|
+
const [columnArgs, setColumnArgs] = (0, $cgYa0$useState)($b8de97dfa82f4910$var$extractColumnArgs((0, $cgYa0$getQueryString)(window.location.search)) ?? defaultArgs);
|
|
16
|
+
(0, $cgYa0$useEffect)(()=>(0, $cgYa0$setQueryString)(columnArgs), [
|
|
17
|
+
columnArgs
|
|
18
|
+
]);
|
|
19
|
+
const { col_id: col_id, project_id: project_id, status_code: status_code } = columnArgs;
|
|
20
|
+
const setCurrentColumn = (obj)=>{
|
|
21
|
+
let args = obj;
|
|
22
|
+
if ("properties" in obj) args = {
|
|
23
|
+
col_id: obj.properties.col_id,
|
|
24
|
+
project_id: project_id,
|
|
25
|
+
status_code: status_code
|
|
26
|
+
};
|
|
27
|
+
// Set query string
|
|
28
|
+
(0, $cgYa0$setQueryString)(args);
|
|
29
|
+
setColumnArgs(args);
|
|
30
|
+
};
|
|
31
|
+
return [
|
|
32
|
+
columnArgs,
|
|
33
|
+
setCurrentColumn
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
function $b8de97dfa82f4910$var$extractColumnArgs(search) {
|
|
37
|
+
const { col_id: col_id, unit_id: unit_id, project_id: project_id, status_code: status_code } = search ?? {};
|
|
38
|
+
if (col_id == null) return null;
|
|
39
|
+
return {
|
|
40
|
+
col_id: col_id,
|
|
41
|
+
unit_id: unit_id,
|
|
42
|
+
project_id: project_id,
|
|
43
|
+
status_code: status_code
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function $b8de97dfa82f4910$export$36fed9e0f93a8fde({ children: children, ...defaultArgs }) {
|
|
47
|
+
/** Column navigation provider that manages the query string for selected columns */ const value = $b8de97dfa82f4910$export$91cb5ac808759b34(defaultArgs);
|
|
48
|
+
return (0, $cgYa0$macrostrathyper)($b8de97dfa82f4910$var$ColumnNavCtx.Provider, {
|
|
49
|
+
value: value
|
|
50
|
+
}, children);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
export {$b8de97dfa82f4910$export$91cb5ac808759b34 as useColumnNav, $b8de97dfa82f4910$export$36fed9e0f93a8fde as ColumnNavProvider};
|
|
55
|
+
//# sourceMappingURL=column-nav.5414677c.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {ColumnNavigationMap as $9d5d216fa2057b5b$export$821baedf611249f3} from "./mapbox.cac42eed.js";
|
|
2
|
+
import {ResizableMapFrame as $e6046e00d2c8a163$export$c4313db718750a5a, ColumnNavigationSVGMap as $e6046e00d2c8a163$export$9595c40c7a4c4f7b, MeasurementsLayer as $93f116a6493b17c3$export$2254347cd20e6080, ColumnFeatures as $93f116a6493b17c3$export$f177ff57c101017a, ColumnKeyboardNavigation as $93f116a6493b17c3$export$8c41dd563753848, Columns as $93f116a6493b17c3$export$f02cc02ad0e0bba3, ColumnCenters as $93f116a6493b17c3$export$4d8f6e6df85d9012, CurrentColumn as $93f116a6493b17c3$export$b9d912252344e099} from "./svg.4b9a96c1.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export {$9d5d216fa2057b5b$export$821baedf611249f3 as ColumnNavigationMap, $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};
|
|
9
|
+
//# sourceMappingURL=column-navigation.37cd3245.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"","sources":["packages/column-views/src/maps/column-navigation/index.ts"],"sourcesContent":["export * from \"./mapbox\";\nexport * from \"./svg\";\n"],"names":[],"version":3,"file":"column-navigation.37cd3245.js.map"}
|