@macrostrat/column-views 2.3.2 → 2.4.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 +11 -0
- package/dist/esm/{column-views.ce3a3ac8.js → column-views.0f910df6.js} +2 -2
- package/dist/esm/{column-views.ce3a3ac8.js.map → column-views.0f910df6.js.map} +1 -1
- package/dist/esm/{column-views.4e6eead3.js → column-views.1cd57b96.js} +2 -2
- package/dist/esm/{column-views.4e6eead3.js.map → column-views.1cd57b96.js.map} +1 -1
- package/dist/esm/{column-views.ee9d71ba.js → column-views.1d356b7e.js} +2 -2
- package/dist/esm/{column-views.ee9d71ba.js.map → column-views.1d356b7e.js.map} +1 -1
- package/dist/esm/{column-views.3d3e00be.js → column-views.1ef0f7e8.js} +2 -2
- package/dist/esm/{column-views.3d3e00be.js.map → column-views.1ef0f7e8.js.map} +1 -1
- package/dist/esm/{column-views.ad2fe46c.js → column-views.1f954206.js} +2 -2
- package/dist/esm/{column-views.ad2fe46c.js.map → column-views.1f954206.js.map} +1 -1
- package/dist/esm/{column-views.24060b85.js → column-views.25713aad.js} +4 -4
- package/dist/esm/{column-views.24060b85.js.map → column-views.25713aad.js.map} +1 -1
- package/dist/esm/{column-views.9ffc089b.js → column-views.28cab78c.js} +3 -3
- package/dist/esm/{column-views.9ffc089b.js.map → column-views.28cab78c.js.map} +1 -1
- package/dist/esm/column-views.2e517e39.js +126 -0
- package/dist/esm/column-views.2e517e39.js.map +1 -0
- package/dist/esm/{column-views.18aac6a5.js → column-views.3067c5e3.js} +3 -3
- package/dist/esm/{column-views.18aac6a5.js.map → column-views.3067c5e3.js.map} +1 -1
- package/dist/esm/{column-views.6f96d1c3.js → column-views.31152763.js} +20 -17
- package/dist/esm/column-views.31152763.js.map +1 -0
- package/dist/esm/{column-views.04636815.js → column-views.33daabd5.js} +5 -5
- package/dist/esm/{column-views.04636815.js.map → column-views.33daabd5.js.map} +1 -1
- package/dist/esm/{column-views.e075af15.js → column-views.3c1cde51.js} +2 -2
- package/dist/esm/{column-views.e075af15.js.map → column-views.3c1cde51.js.map} +1 -1
- package/dist/esm/{column-views.0da4503a.js → column-views.3c9f5ba9.js} +2 -2
- package/dist/esm/{column-views.0da4503a.js.map → column-views.3c9f5ba9.js.map} +1 -1
- package/dist/esm/{column-views.c149f7a5.js → column-views.3d33ef0f.js} +3 -3
- package/dist/esm/{column-views.c149f7a5.js.map → column-views.3d33ef0f.js.map} +1 -1
- package/dist/esm/{column-views.8d972657.js → column-views.4099a246.js} +3 -3
- package/dist/esm/{column-views.8d972657.js.map → column-views.4099a246.js.map} +1 -1
- package/dist/esm/{column-views.b9265595.js → column-views.45acb682.js} +6 -6
- package/dist/esm/column-views.45acb682.js.map +1 -0
- package/dist/esm/{column-views.26e0e0b6.js → column-views.4e5746da.js} +2 -2
- package/dist/esm/{column-views.26e0e0b6.js.map → column-views.4e5746da.js.map} +1 -1
- package/dist/esm/{column-views.f7cdf6be.js → column-views.55bce35c.js} +3 -3
- package/dist/esm/{column-views.f7cdf6be.js.map → column-views.55bce35c.js.map} +1 -1
- package/dist/esm/{column-views.029ea8f1.js → column-views.631f55d4.js} +3 -3
- package/dist/esm/{column-views.029ea8f1.js.map → column-views.631f55d4.js.map} +1 -1
- package/dist/esm/column-views.67804ce5.js +68 -0
- package/dist/esm/column-views.67804ce5.js.map +1 -0
- package/dist/esm/column-views.8168c37d.js +113 -0
- package/dist/esm/column-views.8168c37d.js.map +1 -0
- package/dist/esm/{column-views.b977da35.js → column-views.848349c0.js} +5 -5
- package/dist/esm/{column-views.b977da35.js.map → column-views.848349c0.js.map} +1 -1
- package/dist/esm/{column-views.73fc96cb.js → column-views.86b879ba.js} +5 -5
- package/dist/esm/{column-views.73fc96cb.js.map → column-views.86b879ba.js.map} +1 -1
- package/dist/esm/{column-views.d6c0b7bc.js → column-views.8c8f3fe0.js} +2 -2
- package/dist/esm/{column-views.d6c0b7bc.js.map → column-views.8c8f3fe0.js.map} +1 -1
- package/dist/esm/{column-views.3f1cdc18.js → column-views.9b210fb2.js} +2 -2
- package/dist/esm/{column-views.3f1cdc18.js.map → column-views.9b210fb2.js.map} +1 -1
- package/dist/esm/{column-views.4685ea28.js → column-views.9d0d78aa.js} +2 -2
- package/dist/esm/{column-views.4685ea28.js.map → column-views.9d0d78aa.js.map} +1 -1
- package/dist/esm/{column-views.e3f0cd7b.js → column-views.af89f2b1.js} +23 -33
- package/dist/esm/column-views.af89f2b1.js.map +1 -0
- package/dist/esm/{column-views.75b83110.js → column-views.b3398cca.js} +5 -5
- package/dist/esm/{column-views.75b83110.js.map → column-views.b3398cca.js.map} +1 -1
- package/dist/esm/{column-views.2f979aee.js → column-views.b7b0be88.js} +3 -3
- package/dist/esm/{column-views.2f979aee.js.map → column-views.b7b0be88.js.map} +1 -1
- package/dist/esm/{column-views.d1b49f5c.js → column-views.b8933ea2.js} +2 -2
- package/dist/esm/{column-views.d1b49f5c.js.map → column-views.b8933ea2.js.map} +1 -1
- package/dist/esm/{column-views.0a010643.js → column-views.b9c4d94c.js} +4 -4
- package/dist/esm/{column-views.0a010643.js.map → column-views.b9c4d94c.js.map} +1 -1
- package/dist/esm/{column-views.5fff0716.js → column-views.d3a4596e.js} +3 -3
- package/dist/esm/{column-views.5fff0716.js.map → column-views.d3a4596e.js.map} +1 -1
- package/dist/esm/{column-views.d5fff9b8.js → column-views.dda76243.js} +3 -3
- package/dist/esm/{column-views.d5fff9b8.js.map → column-views.dda76243.js.map} +1 -1
- package/dist/esm/{column-views.9d51a5ab.js → column-views.df872a2c.js} +2 -2
- package/dist/esm/column-views.df872a2c.js.map +1 -0
- package/dist/esm/{column-views.488f24b6.js → column-views.e21f4e50.js} +2 -2
- package/dist/esm/{column-views.488f24b6.js.map → column-views.e21f4e50.js.map} +1 -1
- package/dist/esm/{column-views.a665cbb2.js → column-views.f046b170.js} +5 -5
- package/dist/esm/{column-views.a665cbb2.js.map → column-views.f046b170.js.map} +1 -1
- package/dist/esm/{column-views.82a5112b.js → column-views.fc4d28d8.js} +4 -4
- package/dist/esm/{column-views.82a5112b.js.map → column-views.fc4d28d8.js.map} +1 -1
- package/dist/esm/{column-views.faa7e52e.js → column-views.fdb3799c.js} +3 -3
- package/dist/esm/{column-views.faa7e52e.js.map → column-views.fdb3799c.js.map} +1 -1
- package/dist/esm/index.d.ts +73 -57
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +11 -11
- package/dist/node/{column-views.75456275.js → column-views.00c19fe8.js} +2 -2
- package/dist/node/{column-views.75456275.js.map → column-views.00c19fe8.js.map} +1 -1
- package/dist/node/{column-views.7c322202.js → column-views.00caa49a.js} +2 -2
- package/dist/node/{column-views.7c322202.js.map → column-views.00caa49a.js.map} +1 -1
- package/dist/node/{column-views.9efa91f1.js → column-views.07680def.js} +2 -2
- package/dist/node/{column-views.9efa91f1.js.map → column-views.07680def.js.map} +1 -1
- package/dist/node/column-views.0980c2a0.js +2 -0
- package/dist/node/column-views.0980c2a0.js.map +1 -0
- package/dist/node/column-views.1495397b.js +2 -0
- package/dist/node/column-views.1495397b.js.map +1 -0
- package/dist/node/{column-views.47440961.js → column-views.190241c4.js} +2 -2
- package/dist/node/{column-views.47440961.js.map → column-views.190241c4.js.map} +1 -1
- package/dist/node/{column-views.fafbc028.js → column-views.1d1d6117.js} +2 -2
- package/dist/node/{column-views.fafbc028.js.map → column-views.1d1d6117.js.map} +1 -1
- package/dist/node/column-views.26306041.js +2 -0
- package/dist/node/column-views.26306041.js.map +1 -0
- package/dist/node/{column-views.6556e004.js → column-views.3ce34544.js} +2 -2
- package/dist/node/{column-views.6556e004.js.map → column-views.3ce34544.js.map} +1 -1
- package/dist/node/{column-views.c007152b.js → column-views.41d72280.js} +2 -2
- package/dist/node/{column-views.c007152b.js.map → column-views.41d72280.js.map} +1 -1
- package/dist/node/{column-views.59ce629d.js → column-views.4e677bc4.js} +2 -2
- package/dist/node/{column-views.59ce629d.js.map → column-views.4e677bc4.js.map} +1 -1
- package/dist/node/{column-views.2fe8feb9.js → column-views.60dc38f3.js} +2 -2
- package/dist/node/{column-views.2fe8feb9.js.map → column-views.60dc38f3.js.map} +1 -1
- package/dist/node/{column-views.d818b387.js → column-views.68fe4814.js} +2 -2
- package/dist/node/{column-views.d818b387.js.map → column-views.68fe4814.js.map} +1 -1
- package/dist/node/{column-views.3a947d58.js → column-views.69ddf14d.js} +2 -2
- package/dist/node/{column-views.3a947d58.js.map → column-views.69ddf14d.js.map} +1 -1
- package/dist/node/column-views.6d6a8fde.js +2 -0
- package/dist/node/column-views.6d6a8fde.js.map +1 -0
- package/dist/node/{column-views.08bef1f6.js → column-views.705f66b1.js} +2 -2
- package/dist/node/{column-views.08bef1f6.js.map → column-views.705f66b1.js.map} +1 -1
- package/dist/node/{column-views.8e846c57.js → column-views.7714173b.js} +2 -2
- package/dist/node/{column-views.8e846c57.js.map → column-views.7714173b.js.map} +1 -1
- package/dist/node/{column-views.a14f0134.js → column-views.7ee01d2b.js} +2 -2
- package/dist/node/{column-views.a14f0134.js.map → column-views.7ee01d2b.js.map} +1 -1
- package/dist/node/column-views.861b8e3e.js +2 -0
- package/dist/node/column-views.861b8e3e.js.map +1 -0
- package/dist/node/{column-views.c921fa1a.js → column-views.89afd6b3.js} +2 -2
- package/dist/node/{column-views.c921fa1a.js.map → column-views.89afd6b3.js.map} +1 -1
- package/dist/node/{column-views.8eae7028.js → column-views.8f5532b0.js} +2 -2
- package/dist/node/{column-views.8eae7028.js.map → column-views.8f5532b0.js.map} +1 -1
- package/dist/node/{column-views.67e7a200.js → column-views.97f7f353.js} +2 -2
- package/dist/node/{column-views.67e7a200.js.map → column-views.97f7f353.js.map} +1 -1
- package/dist/node/{column-views.3d0c2bea.js → column-views.9a408bbf.js} +2 -2
- package/dist/node/{column-views.3d0c2bea.js.map → column-views.9a408bbf.js.map} +1 -1
- package/dist/node/column-views.a0969fc8.js +2 -0
- package/dist/node/column-views.a0969fc8.js.map +1 -0
- package/dist/node/{column-views.02869dc5.js → column-views.a0e23210.js} +2 -2
- package/dist/node/{column-views.02869dc5.js.map → column-views.a0e23210.js.map} +1 -1
- package/dist/node/{column-views.8f540f78.js → column-views.a54c0820.js} +2 -2
- package/dist/node/{column-views.8f540f78.js.map → column-views.a54c0820.js.map} +1 -1
- package/dist/node/{column-views.0f401891.js → column-views.b3aa406d.js} +2 -2
- package/dist/node/{column-views.0f401891.js.map → column-views.b3aa406d.js.map} +1 -1
- package/dist/node/{column-views.0a2596c2.js → column-views.b7f69f19.js} +2 -2
- package/dist/node/{column-views.0a2596c2.js.map → column-views.b7f69f19.js.map} +1 -1
- package/dist/node/{column-views.cd54f1b1.js → column-views.b9900855.js} +2 -2
- package/dist/node/{column-views.cd54f1b1.js.map → column-views.b9900855.js.map} +1 -1
- package/dist/node/{column-views.6b391d60.js → column-views.bd1481f0.js} +2 -2
- package/dist/node/{column-views.6b391d60.js.map → column-views.bd1481f0.js.map} +1 -1
- package/dist/node/{column-views.e264a767.js → column-views.bf90c8a3.js} +2 -2
- package/dist/node/column-views.bf90c8a3.js.map +1 -0
- package/dist/node/{column-views.fee4e65d.js → column-views.bfaf5ddb.js} +2 -2
- package/dist/node/{column-views.fee4e65d.js.map → column-views.bfaf5ddb.js.map} +1 -1
- package/dist/node/{column-views.00ad98fa.js → column-views.dedafcae.js} +2 -2
- package/dist/node/{column-views.00ad98fa.js.map → column-views.dedafcae.js.map} +1 -1
- package/dist/node/{column-views.e153680b.js → column-views.e1481ea6.js} +2 -2
- package/dist/node/{column-views.e153680b.js.map → column-views.e1481ea6.js.map} +1 -1
- package/dist/node/{column-views.c4188442.js → column-views.e4e014cd.js} +2 -2
- package/dist/node/{column-views.c4188442.js.map → column-views.e4e014cd.js.map} +1 -1
- package/dist/node/{column-views.465e593b.js → column-views.ed7b4c16.js} +2 -2
- package/dist/node/{column-views.465e593b.js.map → column-views.ed7b4c16.js.map} +1 -1
- package/dist/node/{column-views.2577dec0.js → column-views.f749dbd6.js} +2 -2
- package/dist/node/{column-views.2577dec0.js.map → column-views.f749dbd6.js.map} +1 -1
- package/dist/node/{column-views.825d2719.js → column-views.fcf2be3c.js} +2 -2
- package/dist/node/{column-views.825d2719.js.map → column-views.fcf2be3c.js.map} +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/package.json +5 -4
- package/src/age-model-overlay.ts +4 -2
- package/src/column.ts +18 -41
- package/src/correlation-chart/main.ts +11 -9
- package/src/data-provider/core.ts +89 -0
- package/src/data-provider/store.ts +79 -88
- package/src/data-provider/unit-selection.ts +120 -147
- package/src/unit-details/popover.ts +8 -4
- package/dist/esm/column-views.4b259f9e.js +0 -136
- package/dist/esm/column-views.4b259f9e.js.map +0 -1
- package/dist/esm/column-views.6f96d1c3.js.map +0 -1
- package/dist/esm/column-views.9d51a5ab.js.map +0 -1
- package/dist/esm/column-views.b9265595.js.map +0 -1
- package/dist/esm/column-views.c44febd0.js +0 -169
- package/dist/esm/column-views.c44febd0.js.map +0 -1
- package/dist/esm/column-views.e3f0cd7b.js.map +0 -1
- package/dist/node/column-views.0beae29d.js +0 -2
- package/dist/node/column-views.0beae29d.js.map +0 -1
- package/dist/node/column-views.46efb749.js +0 -2
- package/dist/node/column-views.46efb749.js.map +0 -1
- package/dist/node/column-views.868c04dc.js +0 -2
- package/dist/node/column-views.868c04dc.js.map +0 -1
- package/dist/node/column-views.dfe9a971.js +0 -2
- package/dist/node/column-views.dfe9a971.js.map +0 -1
- package/dist/node/column-views.e264a767.js.map +0 -1
- package/dist/node/column-views.ed2fd268.js +0 -2
- package/dist/node/column-views.ed2fd268.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;AAkBO,MAAM,4CAAwB,CAAA,GAAA,sBAAc;AAU5C,SAAS,0CAAe,YAC7B,QAAQ,SACR,KAAK,qBACL,oBAAoB,MACN;IACd,kDAAkD;IAClD,IAAI,MAAM;IACV,IAAI;QACF,MAAM,0CAAM,QAAQ;QACpB,uCAAuC;QACvC,OAAO;IACT,EAAE,OAAM;QACN,OAAO,CAAA,GAAA,sBAAA,EAAE,0CAAM,QAAQ,EAAE;YAAE,OAAO;YAAM,eAAe;QAAM,GAAG;YAC9D,CAAA,GAAA,sBAAA,EAAE,EAAE,CAAC,mBAAmB,mCAAa;uBAAE;YAAM;YAC7C;SACD;IACH;AACF;AAEA,SAAS,kCAAY,SACnB,KAAK,EAGN;IACC;;;;GAIC,GACD,uDAAuD,GACvD,mBAAmB;IACnB,MAAM,QAAQ,0CAAM,QAAQ;IAE5B,gCAAgC;IAChC,MAAM,gBAAgB,CAAA,GAAA,aAAK,EAAE,MAAM,MAAM;IACzC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,cAAc,OAAO,KAAK,MAAM,MAAM,EAAE;YAC1C,QAAQ,KAAK,CAAC;YACd,cAAc,OAAO,GAAG,MAAM,MAAM;QACtC;IACF,GAAG;QAAC,MAAM,MAAM;KAAC;IAEjB,KAAK,MAAM,CAAC,MAAM,MAAM,IAAI,MAC1B,CAAA,GAAA,gBAAQ,EAAE;QACR,MAAM,GAAG,CAAC,MAAM;IAClB,GAAG;QAAC;QAAO;KAAM;IAEnB,OAAO;AACT;AAEO,MAAM,4CAAkB,CAAA,GAAA,WAAG;AAE3B,MAAM,4CAAqB,CAAA,GAAA,WAAG,EAAgC,CAAC;IACpE,MAAM,QAAQ,IAAI;IAClB,IAAI,CAAC,OAAO,OAAO;IACnB,MAAM,UAAU,IAAI;IACpB,MAAM,OAAO,CAAC,CAAC;QACb,QAAQ,GAAG,CAAC,KAAK,OAAO,EAAE;IAC5B;IACA,OAAO;AACT","sources":["packages/column-views/src/data-provider/core.ts"],"sourcesContent":["import { atom, type WritableAtom } from \"jotai\";\nimport { createIsolation } from \"jotai-scope\";\nimport { BaseUnit } from \"@macrostrat/api-types\";\nimport { ReactNode, useEffect, useRef } from \"react\";\nimport h from \"@macrostrat/hyper\";\n\ninterface StateIsolation {\n Provider: (props: {\n store?: any;\n initialValues?: AtomMap;\n children: ReactNode;\n }) => ReactNode;\n useStore: () => any;\n useAtom: any;\n useAtomValue: any;\n useSetAtom: any;\n}\n\nexport const scope: StateIsolation = createIsolation();\n\nexport type AtomMap = [WritableAtom<any, any, any>, any][];\n\ntype ProviderProps = {\n children: ReactNode;\n atoms?: AtomMap;\n shouldUpdateAtoms?: boolean;\n};\n\nexport function ScopedProvider({\n children,\n atoms,\n shouldUpdateAtoms = true,\n}: ProviderProps) {\n // Always use the same store instance in this tree\n let val = null;\n try {\n val = scope.useStore();\n // This store has already been provided\n return children;\n } catch {\n return h(scope.Provider, { store: null, initialValues: atoms }, [\n h.if(shouldUpdateAtoms)(AtomUpdater, { atoms }),\n children,\n ]);\n }\n}\n\nfunction AtomUpdater({\n atoms,\n}: {\n atoms: [WritableAtom<any, any, any>, any][];\n}) {\n /**\n * A generic updater to sync Jotai atoms with state passed as props.\n * Useful for scoped providers where state needs to be synced outside\n * the current context.\n */\n /** TODO: this is an awkward way to keep atoms updated */\n // The scoped store\n const store = scope.useStore();\n\n // Warn on atoms changing length\n const prevLengthRef = useRef(atoms.length);\n useEffect(() => {\n if (prevLengthRef.current !== atoms.length) {\n console.error(\"Error: number of atoms in ScopedAtomUpdater has changed.\");\n prevLengthRef.current = atoms.length;\n }\n }, [atoms.length]);\n\n for (const [atom, value] of atoms) {\n useEffect(() => {\n store.set(atom, value);\n }, [store, value]);\n }\n return null;\n}\n\nexport const columnUnitsAtom = atom<BaseUnit[]>();\n\nexport const columnUnitsMapAtom = atom<Map<number, BaseUnit> | null>((get) => {\n const units = get(columnUnitsAtom);\n if (!units) return null;\n const unitMap = new Map<number, BaseUnit>();\n units.forEach((unit) => {\n unitMap.set(unit.unit_id, unit);\n });\n return unitMap;\n});\n"],"names":[],"version":3,"file":"column-views.67804ce5.js.map"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import {createCompositeScale as $728f6cf6c12cd490$export$3ada7641926a616d} from "./column-views.1b5bf0c6.js";
|
|
2
|
+
import {allowUnitSelectionAtom as $61771df184788970$export$3c12ff51b216428d, selectedUnitIDAtom as $61771df184788970$export$6d9520abc11d1c2b, UnitSelectionCallbackManager as $61771df184788970$export$1a7a0d00e4ba9c81} from "./column-views.2e517e39.js";
|
|
3
|
+
import {columnUnitsAtom as $c4083056aa697244$export$533095c4f32f2edc, columnUnitsMapAtom as $c4083056aa697244$export$c798b7ff7cb2357b, scope as $c4083056aa697244$export$5cff813ca8e50db9, ScopedProvider as $c4083056aa697244$export$deff48bd299912d9} from "./column-views.67804ce5.js";
|
|
4
|
+
import {useMemo as $a90Ta$useMemo, createContext as $a90Ta$createContext, useContext as $a90Ta$useContext} from "react";
|
|
5
|
+
import $a90Ta$macrostrathyper from "@macrostrat/hyper";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
function $d5074f164411387e$export$ef5395089200109b({ children: children, units: units, allowUnitSelection: allowUnitSelection = false, onUnitSelected: onUnitSelected, selectedUnit: selectedUnit }) {
|
|
13
|
+
/** Top-level provider for Macrostrat column data.
|
|
14
|
+
* It is either provided by the Column component itself, or
|
|
15
|
+
* can be hoisted higher in the tree to provide a common data context
|
|
16
|
+
*/ /* By default, unit selection is disabled. However, if any related props are passed,
|
|
17
|
+
we enable it.
|
|
18
|
+
*/ const _allowSelection = (0, $a90Ta$useMemo)(()=>{
|
|
19
|
+
if (allowUnitSelection) return true;
|
|
20
|
+
return selectedUnit != null || onUnitSelected != null;
|
|
21
|
+
}, []);
|
|
22
|
+
const atomMap = [
|
|
23
|
+
[
|
|
24
|
+
(0, $c4083056aa697244$export$533095c4f32f2edc),
|
|
25
|
+
units
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
(0, $61771df184788970$export$3c12ff51b216428d),
|
|
29
|
+
_allowSelection
|
|
30
|
+
],
|
|
31
|
+
[
|
|
32
|
+
(0, $61771df184788970$export$6d9520abc11d1c2b),
|
|
33
|
+
selectedUnit
|
|
34
|
+
]
|
|
35
|
+
];
|
|
36
|
+
let selectionHandlers = null;
|
|
37
|
+
if (_allowSelection) selectionHandlers = (0, $a90Ta$macrostrathyper)((0, $61771df184788970$export$1a7a0d00e4ba9c81), {
|
|
38
|
+
onUnitSelected: onUnitSelected
|
|
39
|
+
});
|
|
40
|
+
return (0, $a90Ta$macrostrathyper)((0, $c4083056aa697244$export$deff48bd299912d9), {
|
|
41
|
+
atoms: atomMap
|
|
42
|
+
}, [
|
|
43
|
+
selectionHandlers,
|
|
44
|
+
children
|
|
45
|
+
]);
|
|
46
|
+
}
|
|
47
|
+
const $d5074f164411387e$var$MacrostratColumnDataContext = (0, $a90Ta$createContext)(null);
|
|
48
|
+
function $d5074f164411387e$export$7fec7bd80ff9c10e({ children: children, units: units, sections: sections, totalHeight: totalHeight, axisType: axisType, allowUnitSelection: allowUnitSelection, onUnitSelected: onUnitSelected, selectedUnit: selectedUnit }) {
|
|
49
|
+
/** Internal provider for Macrostrat column data.
|
|
50
|
+
* As a general rule, we want to provide data and column-axis
|
|
51
|
+
* height calculations through the context, since these need to
|
|
52
|
+
* be accessed by any component that lays out information on the
|
|
53
|
+
* column.
|
|
54
|
+
*
|
|
55
|
+
* Cross-axis layout and view configuration (e.g., showing and hiding
|
|
56
|
+
* of different components or labels) should be handled through passing
|
|
57
|
+
* props to the components themselves.
|
|
58
|
+
* */ const value = (0, $a90Ta$useMemo)(()=>{
|
|
59
|
+
// For now, change ordinal axis types to age axis types
|
|
60
|
+
return {
|
|
61
|
+
units: units,
|
|
62
|
+
sections: sections,
|
|
63
|
+
totalHeight: totalHeight,
|
|
64
|
+
axisType: axisType
|
|
65
|
+
};
|
|
66
|
+
}, [
|
|
67
|
+
units,
|
|
68
|
+
sections,
|
|
69
|
+
totalHeight,
|
|
70
|
+
axisType
|
|
71
|
+
]);
|
|
72
|
+
return (0, $a90Ta$macrostrathyper)($d5074f164411387e$export$ef5395089200109b, {
|
|
73
|
+
units: units,
|
|
74
|
+
allowUnitSelection: allowUnitSelection,
|
|
75
|
+
onUnitSelected: onUnitSelected,
|
|
76
|
+
selectedUnit: selectedUnit
|
|
77
|
+
}, (0, $a90Ta$macrostrathyper)($d5074f164411387e$var$MacrostratColumnDataContext.Provider, {
|
|
78
|
+
value: value
|
|
79
|
+
}, children));
|
|
80
|
+
}
|
|
81
|
+
function $d5074f164411387e$export$f19d75b1d4b676a4(props) {
|
|
82
|
+
/* A basic unit selection provider without column data context.
|
|
83
|
+
Mostly for use with the CorrelationChart component.
|
|
84
|
+
*/ return (0, $a90Ta$macrostrathyper)($d5074f164411387e$export$ef5395089200109b, {
|
|
85
|
+
...props,
|
|
86
|
+
allowUnitSelection: true
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function $d5074f164411387e$export$f8509b7cce386c7d() {
|
|
90
|
+
const ctx = (0, $a90Ta$useContext)($d5074f164411387e$var$MacrostratColumnDataContext);
|
|
91
|
+
if (!ctx) throw new Error("useMacrostratColumnData must be used within a MacrostratColumnDataProvider");
|
|
92
|
+
return ctx;
|
|
93
|
+
}
|
|
94
|
+
function $d5074f164411387e$export$6fb40844db555b2() {
|
|
95
|
+
return (0, $c4083056aa697244$export$5cff813ca8e50db9).useAtomValue((0, $c4083056aa697244$export$533095c4f32f2edc));
|
|
96
|
+
}
|
|
97
|
+
function $d5074f164411387e$export$7513be0cfd10d9cc() {
|
|
98
|
+
try {
|
|
99
|
+
return (0, $c4083056aa697244$export$5cff813ca8e50db9).useAtomValue((0, $c4083056aa697244$export$c798b7ff7cb2357b));
|
|
100
|
+
} catch {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function $d5074f164411387e$export$a7fc62995ec4f76() {
|
|
105
|
+
const ctx = $d5074f164411387e$export$f8509b7cce386c7d();
|
|
106
|
+
return (0, $a90Ta$useMemo)(()=>(0, $728f6cf6c12cd490$export$3ada7641926a616d)(ctx.sections, true), [
|
|
107
|
+
ctx.sections
|
|
108
|
+
]);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
export {$d5074f164411387e$export$ef5395089200109b as MacrostratColumnStateProvider, $d5074f164411387e$export$7fec7bd80ff9c10e as MacrostratColumnDataProvider, $d5074f164411387e$export$f19d75b1d4b676a4 as UnitSelectionProvider, $d5074f164411387e$export$f8509b7cce386c7d as useMacrostratColumnData, $d5074f164411387e$export$6fb40844db555b2 as useMacrostratUnits, $d5074f164411387e$export$7513be0cfd10d9cc as useColumnUnitsMap, $d5074f164411387e$export$a7fc62995ec4f76 as useCompositeScale};
|
|
113
|
+
//# sourceMappingURL=column-views.8168c37d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;AAgCO,SAAS,0CAAkD,YAChE,QAAQ,SACR,KAAK,sBACL,qBAAqB,uBACrB,cAAc,gBACd,YAAY,EACgB;IAC5B;;;GAGC,GAED;;EAEA,GACA,MAAM,kBAAkB,CAAA,GAAA,cAAM,EAAE;QAC9B,IAAI,oBACF,OAAO;QAET,OAAO,gBAAgB,QAAQ,kBAAkB;IACnD,GAAG,EAAE;IAEL,MAAM,UAAmB;QACvB;YAAC,CAAA,GAAA,yCAAc;YAAG;SAAM;QACxB;YAAC,CAAA,GAAA,yCAAqB;YAAG;SAAgB;QACzC;YAAC,CAAA,GAAA,yCAAiB;YAAG;SAAa;KACnC;IAED,IAAI,oBAA+B;IACnC,IAAI,iBACF,oBAAoB,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,yCAA2B,GAAG;wBAAE;IAAe;IAGvE,OAAO,CAAA,GAAA,sBAAA,EACL,CAAA,GAAA,yCAAa,GACb;QACE,OAAO;IACT,GACA;QAAC;QAAmB;KAAS;AAEjC;AAeA,MAAM,oDACJ,CAAA,GAAA,oBAAY,EAAoC;AAE3C,SAAS,0CAAiD,YAC/D,QAAQ,SACR,KAAK,YACL,QAAQ,eACR,WAAW,YACX,QAAQ,sBACR,kBAAkB,kBAClB,cAAc,gBACd,YAAY,EACe;IAC3B;;;;;;;;;KASG,GAEH,MAAM,QAAQ,CAAA,GAAA,cAAM,EAAE;QACpB,uDAAuD;QACvD,OAAO;mBACL;sBACA;yBACA;sBACA;QACF;IACF,GAAG;QAAC;QAAO;QAAU;QAAa;KAAS;IAE3C,OAAO,CAAA,GAAA,sBAAA,EACL,2CACA;eACE;4BACA;wBACA;sBACA;IACF,GACA,CAAA,GAAA,sBAAA,EAAE,kDAA4B,QAAQ,EAAE;eAAE;IAAM,GAAG;AAEvD;AAEO,SAAS,0CAAsB,KAAoC;IACxE;;GAEC,GACD,OAAO,CAAA,GAAA,sBAAA,EAAE,2CAA+B;QACtC,GAAG,KAAK;QACR,oBAAoB;IACtB;AACF;AAEO,SAAS;IACd,MAAM,MAAM,CAAA,GAAA,iBAAS,EAAE;IACvB,IAAI,CAAC,KACH,MAAM,IAAI,MACR;IAGJ,OAAO;AACT;AAEO,SAAS;IACd,OAAO,CAAA,GAAA,yCAAI,EAAE,YAAY,CAAC,CAAA,GAAA,yCAAc;AAC1C;AAEO,SAAS;IACd,IAAI;QACF,OAAO,CAAA,GAAA,yCAAI,EAAE,YAAY,CAAC,CAAA,GAAA,yCAAiB;IAC7C,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAEO,SAAS;IACd,MAAM,MAAM;IACZ,OAAO,CAAA,GAAA,cAAM,EACX,IAAM,CAAA,GAAA,yCAAmB,EAAE,IAAI,QAAQ,EAAE,OACzC;QAAC,IAAI,QAAQ;KAAC;AAElB","sources":["packages/column-views/src/data-provider/store.ts"],"sourcesContent":["import { createContext, ReactNode, useContext, useMemo } from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport {\n CompositeColumnScale,\n createCompositeScale,\n} from \"../prepare-units/composite-scale\";\nimport { ColumnAxisType } from \"@macrostrat/column-components\";\nimport type { ExtUnit, PackageLayoutData } from \"../prepare-units\";\nimport {\n allowUnitSelectionAtom,\n selectedUnitIDAtom,\n UnitSelectionCallbacks,\n UnitSelectionCallbackManager,\n} from \"./unit-selection\";\nimport { BaseUnit } from \"@macrostrat/api-types\";\nimport {\n AtomMap,\n columnUnitsAtom,\n columnUnitsMapAtom,\n scope,\n ScopedProvider,\n} from \"./core\";\n\nexport interface ColumnStateProviderProps<\n T extends BaseUnit,\n> extends Partial<UnitSelectionCallbacks> {\n children: ReactNode;\n units: T[];\n selectedUnit: number | null;\n allowUnitSelection?: boolean;\n}\n\nexport function MacrostratColumnStateProvider<T extends BaseUnit>({\n children,\n units,\n allowUnitSelection = false,\n onUnitSelected,\n selectedUnit,\n}: ColumnStateProviderProps<T>) {\n /** Top-level provider for Macrostrat column data.\n * It is either provided by the Column component itself, or\n * can be hoisted higher in the tree to provide a common data context\n */\n\n /* By default, unit selection is disabled. However, if any related props are passed,\n we enable it.\n */\n const _allowSelection = useMemo(() => {\n if (allowUnitSelection) {\n return true;\n }\n return selectedUnit != null || onUnitSelected != null;\n }, []);\n\n const atomMap: AtomMap = [\n [columnUnitsAtom, units],\n [allowUnitSelectionAtom, _allowSelection],\n [selectedUnitIDAtom, selectedUnit],\n ];\n\n let selectionHandlers: ReactNode = null;\n if (_allowSelection) {\n selectionHandlers = h(UnitSelectionCallbackManager, { onUnitSelected });\n }\n\n return h(\n ScopedProvider,\n {\n atoms: atomMap,\n },\n [selectionHandlers, children],\n );\n}\n\nexport interface MacrostratColumnDataContext<T extends BaseUnit> {\n units: T[];\n sections: PackageLayoutData[];\n totalHeight?: number;\n axisType?: ColumnAxisType;\n allowUnitSelection?: boolean;\n}\n\nexport interface ColumnDataProviderProps<T extends BaseUnit>\n extends MacrostratColumnDataContext<T>, ColumnStateProviderProps<T> {\n children: ReactNode;\n}\n\nconst MacrostratColumnDataContext =\n createContext<MacrostratColumnDataContext<any>>(null);\n\nexport function MacrostratColumnDataProvider<T extends BaseUnit>({\n children,\n units,\n sections,\n totalHeight,\n axisType,\n allowUnitSelection,\n onUnitSelected,\n selectedUnit,\n}: ColumnDataProviderProps<T>) {\n /** Internal provider for Macrostrat column data.\n * As a general rule, we want to provide data and column-axis\n * height calculations through the context, since these need to\n * be accessed by any component that lays out information on the\n * column.\n *\n * Cross-axis layout and view configuration (e.g., showing and hiding\n * of different components or labels) should be handled through passing\n * props to the components themselves.\n * */\n\n const value = useMemo(() => {\n // For now, change ordinal axis types to age axis types\n return {\n units,\n sections,\n totalHeight,\n axisType,\n };\n }, [units, sections, totalHeight, axisType]);\n\n return h(\n MacrostratColumnStateProvider,\n {\n units,\n allowUnitSelection,\n onUnitSelected,\n selectedUnit,\n },\n h(MacrostratColumnDataContext.Provider, { value }, children),\n );\n}\n\nexport function UnitSelectionProvider(props: ColumnStateProviderProps<any>) {\n /* A basic unit selection provider without column data context.\n Mostly for use with the CorrelationChart component.\n */\n return h(MacrostratColumnStateProvider, {\n ...props,\n allowUnitSelection: true,\n });\n}\n\nexport function useMacrostratColumnData() {\n const ctx = useContext(MacrostratColumnDataContext);\n if (!ctx) {\n throw new Error(\n \"useMacrostratColumnData must be used within a MacrostratColumnDataProvider\",\n );\n }\n return ctx;\n}\n\nexport function useMacrostratUnits() {\n return scope.useAtomValue(columnUnitsAtom);\n}\n\nexport function useColumnUnitsMap(): Map<number, ExtUnit> | null {\n try {\n return scope.useAtomValue(columnUnitsMapAtom) as Map<number, ExtUnit>;\n } catch {\n return null;\n }\n}\n\nexport function useCompositeScale(): CompositeColumnScale {\n const ctx = useMacrostratColumnData();\n return useMemo(\n () => createCompositeScale(ctx.sections, true),\n [ctx.sections],\n );\n}\n"],"names":[],"version":3,"file":"column-views.8168c37d.js.map"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {CompositeUnitsColumn as $8c8238faa5cde49c$export$a6684360fef0406e, LabelTrackerProvider as $8c8238faa5cde49c$export$e4e89ab6c86ac513, SectionLabelsColumn as $8c8238faa5cde49c$export$13984e34afdbb040} from "./column-views.
|
|
1
|
+
import {CompositeUnitsColumn as $8c8238faa5cde49c$export$a6684360fef0406e, LabelTrackerProvider as $8c8238faa5cde49c$export$e4e89ab6c86ac513, SectionLabelsColumn as $8c8238faa5cde49c$export$13984e34afdbb040} from "./column-views.f046b170.js";
|
|
2
2
|
import $7zu8d$columnviewscc733361js from "./column-views.cc733361.js";
|
|
3
3
|
import "./column-views.e93478c3.css";
|
|
4
|
-
import {MacrostratColumnProvider as $774a5efa27d1c77b$export$9e42f9b6e0d67c7d, useMacrostratBaseURL as $774a5efa27d1c77b$export$33b1392d23dde04} from "./column-views.
|
|
5
|
-
import {useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d, useMacrostratUnits as $d5074f164411387e$export$6fb40844db555b2} from "./column-views.
|
|
6
|
-
import {Duration as $448b24baeef3b229$export$3b11bc38611c5941} from "./column-views.
|
|
4
|
+
import {MacrostratColumnProvider as $774a5efa27d1c77b$export$9e42f9b6e0d67c7d, useMacrostratBaseURL as $774a5efa27d1c77b$export$33b1392d23dde04} from "./column-views.3c1cde51.js";
|
|
5
|
+
import {useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d, useMacrostratUnits as $d5074f164411387e$export$6fb40844db555b2} from "./column-views.8168c37d.js";
|
|
6
|
+
import {Duration as $448b24baeef3b229$export$3b11bc38611c5941} from "./column-views.b9c4d94c.js";
|
|
7
7
|
import {useMemo as $7zu8d$useMemo} from "react";
|
|
8
8
|
import {useMacrostratIntervals as $7zu8d$useMacrostratIntervals, Timescale as $7zu8d$Timescale, TimescaleOrientation as $7zu8d$TimescaleOrientation} from "@macrostrat/timescale";
|
|
9
9
|
import {SVG as $7zu8d$SVG, ColumnAxisType as $7zu8d$ColumnAxisType} from "@macrostrat/column-components";
|
|
@@ -245,4 +245,4 @@ function $7d0f52717c0de7e1$var$Unconformity({ upperAge: upperAge, lowerAge: lowe
|
|
|
245
245
|
|
|
246
246
|
|
|
247
247
|
export {$7d0f52717c0de7e1$export$38cb0ab5af8f50d7 as SectionsColumn, $7d0f52717c0de7e1$export$e12e53eeee198b99 as UnconformityLabels, $7d0f52717c0de7e1$export$db2df5a73a6fbe10 as CompositeTimescale, $7d0f52717c0de7e1$export$463f46772c64d403 as CompositeTimescaleCore};
|
|
248
|
-
//# sourceMappingURL=column-views.
|
|
248
|
+
//# sourceMappingURL=column-views.848349c0.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,uEAAK;AAyBrB,SAAS,0CAAe,KAAyB;IACtD,MAAM,sBACJ,qBAAqB,qBACrB,aAAa,sBACb,kBAAkB,cAClB,aAAa,aACb,QAAQ,kBACR,cAAc,sBACd,kBAAkB,iBAClB,YAAY,0BACZ,kBAAkB,EACnB,GAAG;IAEJ,MAAM,QAAQ,CAAA,GAAA,wCAAiB;IAE/B,kCAAkC;IAClC,MAAM,MAAM,KAAK,CAAC,EAAE,EAAE;IAEtB,OAAO,wBAAE,CAAA,GAAA,yCAAmB,GAAG;eAAE;aAAO;IAAI,GAAG;QAC7C,wBAAE,0CAAoB;YACpB,OAAO;2BACP;gCACA;wBACA;uBACA;gCACA;gCACA;QACF;QACA,wBAAE,EAAE,CAAC,iBAAiB,CAAA,GAAA,yCAAkB,GAAG;YACzC,OAAO,QAAQ;QACjB;KACD;AACH;AAEA,SAAS,yCAAmB,KAAyB;IACnD,MAAM,SACJ,KAAK,cACL,UAAU,iBACV,aAAa,sBACb,kBAAkB,aAClB,SAAS,sBACT,kBAAkB,YAClB,QAAQ,sBACR,qBAAqB,MACtB,GAAG;IAEJ,MAAM,YAAE,QAAQ,eAAE,WAAW,EAAE,GAAG,CAAA,GAAA,yCAAsB;IAExD,MAAM,YAAsC,SAAS,GAAG,CAAC,CAAC;QACxD,OAAO,QAAQ,SAAS;IAC1B;IAEA,MAAM,aAAa,QAAQ;IAE3B,OAAO,wBAAE,+BAA+B;QAAE,OAAO;mBAAE;QAAM;IAAE,GAAG;QAC5D,wBACE,CAAA,GAAA,UAAE,GACF;YACE,WAAW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C;QAAK,wBAAE,eAAe;KAAQ;IAG5C,OAAO,wBAAE,oBAAoB;eAAE;mBAAO;IAAU,GAAG;QACjD,wBAAE,0BAA0B,wBAAE,yBAAyB;YAAC;YAAK;SAAO;KACrE;AACH","sources":["packages/column-views/src/section.ts"],"sourcesContent":["import {\n CompositeUnitsColumn,\n LabelTrackerProvider,\n SectionLabelsColumn,\n} from \"./units\";\nimport { ReactNode, FunctionComponent, useMemo } from \"react\";\nimport {\n Timescale,\n TimescaleOrientation,\n useMacrostratIntervals,\n} from \"@macrostrat/timescale\";\nimport { ColumnAxisType, SVG } from \"@macrostrat/column-components\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./column.module.sass\";\nimport {\n useMacrostratColumnData,\n useMacrostratUnits,\n MacrostratColumnProvider,\n useMacrostratBaseURL,\n} from \"./data-provider\";\nimport { Duration } from \"./unit-details\";\nimport { Value } from \"@macrostrat/data-components\";\nimport type { ExtUnit, PackageScaleLayoutData } from \"./prepare-units/types\";\n\nconst h = hyper.styled(styles);\n\nexport interface SectionSharedProps {\n unitComponent?: FunctionComponent<any>;\n unitComponentProps?: any;\n showLabels?: boolean;\n width?: number;\n columnWidth?: number;\n children?: ReactNode;\n showLabelColumn?: boolean;\n axisType?: ColumnAxisType;\n className?: string;\n clipUnits?: boolean;\n maxInternalColumns?: number;\n // Space between sections\n verticalSpacing?: number;\n // Whether to render unconformity labels\n unconformityLabels?: boolean;\n}\n\nexport interface SectionProps extends SectionSharedProps {\n units: ExtUnit[];\n scaleInfo: PackageScaleLayoutData;\n}\n\nexport function SectionsColumn(props: SectionSharedProps) {\n const {\n unconformityLabels = true,\n unitComponent,\n unitComponentProps,\n showLabels = true,\n width = 300,\n columnWidth = 150,\n showLabelColumn = true,\n clipUnits = true,\n maxInternalColumns,\n } = props;\n\n const units = useMacrostratUnits();\n\n // Get a unique key for the column\n const key = units[0]?.col_id;\n\n return h(LabelTrackerProvider, { units, key }, [\n h(SectionUnitsColumn, {\n width: columnWidth,\n unitComponent,\n unitComponentProps,\n showLabels,\n clipUnits,\n maxInternalColumns,\n unconformityLabels,\n }),\n h.if(showLabelColumn)(SectionLabelsColumn, {\n width: width - columnWidth,\n }),\n ]);\n}\n\nfunction SectionUnitsColumn(props: SectionSharedProps) {\n const {\n width,\n showLabels,\n unitComponent,\n unitComponentProps,\n clipUnits,\n maxInternalColumns,\n axisType,\n unconformityLabels = true,\n } = props;\n\n const { sections, totalHeight } = useMacrostratColumnData();\n\n const scaleData: PackageScaleLayoutData[] = sections.map((section) => {\n return section.scaleInfo;\n });\n\n const innerWidth = width - 2;\n\n return h(\"div.section-units-container\", { style: { width } }, [\n h(\n SVG,\n {\n className: \"sections\",\n height: totalHeight,\n innerWidth,\n paddingH: 1,\n },\n sections.map((group) => {\n const { units, scaleInfo, section_id } = group;\n\n const key = `section-${section_id}`;\n return h(\n SectionUnits,\n {\n units,\n scaleInfo,\n key,\n unitComponent,\n unitComponentProps,\n showLabels,\n width: innerWidth,\n clipUnits,\n maxInternalColumns,\n }, // This unconformity is with the section _above_\n );\n }),\n ),\n h.if(unconformityLabels)(UnconformityLabels, {\n width,\n sections: scaleData,\n verbose: false,\n }),\n ]);\n}\n\nfunction SectionUnits(props: SectionProps) {\n // Section with \"squishy\" timescale\n const {\n units,\n scaleInfo,\n unitComponent,\n showLabels = true,\n width = 300,\n unitComponentProps,\n className,\n clipUnits = true,\n maxInternalColumns,\n } = props;\n\n const { domain, pixelScale, pixelHeight, scale } = scaleInfo;\n\n /** Ensure that we can arrange units into the maximum number\n * of columns defined by unitComponentProps, but that we don't\n * use more than necessary.\n */\n const _unitComponentProps = useMemo(() => {\n return {\n ...unitComponentProps,\n nColumns: Math.min(\n maxInternalColumns ?? Math.floor(width / 10),\n unitComponentProps?.nColumns ?? Infinity,\n Math.max(...units.map((d) => d.column)) + 1,\n ),\n //axisType,\n };\n }, [units, unitComponentProps, maxInternalColumns, width]);\n\n const style = {\n \"--section-height\": `${pixelHeight}px`,\n \"--section-width\": `${width}px`,\n };\n\n return h(\n \"g.section\",\n { className, style, transform: `translate(0 ${scaleInfo.offset})` },\n h(\n MacrostratColumnProvider,\n {\n units,\n domain,\n pixelScale, // Actually pixels per myr,\n scale,\n },\n h(CompositeUnitsColumn, {\n width,\n showLabels,\n unitComponent,\n unitComponentProps: _unitComponentProps,\n clipToFrame: clipUnits,\n }),\n ),\n );\n}\n\ninterface CompositeTimescaleProps {\n levels?: [number, number] | number;\n unconformityLabels?: boolean;\n}\n\nexport function CompositeTimescale(props: CompositeTimescaleProps) {\n const { sections } = useMacrostratColumnData();\n const sectionScales = sections.map((section) => {\n return section.scaleInfo;\n });\n\n return h(CompositeTimescaleCore, {\n packages: sectionScales,\n ...props,\n });\n}\n\ntype CompositeTimescaleCoreProps = CompositeTimescaleProps & {\n packages: PackageScaleLayoutData[];\n};\n\nexport function CompositeTimescaleCore(props: CompositeTimescaleCoreProps) {\n const { levels = 3, packages, unconformityLabels = false } = props;\n\n // Use intervals from Macrostrat API\n const baseURL = useMacrostratBaseURL();\n const intervals = useMacrostratIntervals(baseURL);\n\n let _levels: [number, number];\n if (typeof levels === \"number\") {\n // If levels is a number, use the most common starting level\n _levels = [2, Math.max(2 + Math.min(levels, 5) - 1, 1)];\n } else {\n _levels = levels;\n }\n\n const nCols = _levels[1] - _levels[0] + 1;\n\n return h(\"div.timescale-column\", [\n h(\n \"div.timescales\",\n packages.map((group) => {\n const { pixelHeight, paddingTop, key, scale } = group;\n return h(\n \"div.timescale-container\",\n { style: { paddingTop, \"--timescale-level-count\": nCols }, key },\n [\n h(Timescale, {\n orientation: TimescaleOrientation.VERTICAL,\n length: pixelHeight,\n levels: _levels,\n absoluteAgeScale: true,\n showAgeAxis: false,\n scale,\n intervals,\n }),\n ],\n );\n }),\n ),\n h.if(unconformityLabels)(UnconformityLabels, {\n width: \"100%\",\n sections: packages,\n className: \"unconformity-labels\",\n axisType: ColumnAxisType.AGE,\n }),\n ]);\n}\n\nexport function UnconformityLabels(props: {\n width: string | number;\n sections: PackageScaleLayoutData[];\n axisType?: ColumnAxisType;\n className?: string;\n verbose?: boolean;\n}) {\n const { width, sections, className, axisType, verbose } = props;\n\n return h(\n \"div.unconformity-labels\",\n {\n style: {\n width,\n },\n className,\n },\n sections.map((scaleInfo, i) => {\n const lastGroup = sections[i - 1];\n const top = scaleInfo.offset - scaleInfo.paddingTop;\n const upperAge = lastGroup?.domain[0];\n const lowerAge = scaleInfo.domain[1];\n return h(Unconformity, {\n axisType,\n upperAge,\n lowerAge,\n style: {\n width,\n height: scaleInfo.paddingTop,\n top,\n },\n verbose,\n });\n }),\n );\n}\n\nfunction Unconformity({\n upperAge,\n lowerAge,\n style,\n axisType,\n verbose = false,\n}) {\n if (upperAge == null || lowerAge == null) {\n return null;\n }\n\n const ageGap = Math.abs(upperAge - lowerAge);\n\n let maximumFractionDigits = 0;\n\n let className: string = null;\n if (ageGap > 1000) {\n className = \"giga\";\n } else if (ageGap > 100) {\n className = \"mega\";\n } else if (ageGap > 10) {\n className = \"large\";\n } else if (ageGap < 1) {\n className = \"small\";\n maximumFractionDigits = 2;\n } else {\n maximumFractionDigits = 1;\n }\n\n let val: ReactNode;\n if (axisType === ColumnAxisType.DEPTH || axisType === ColumnAxisType.HEIGHT) {\n const _txt = ageGap.toLocaleString(\"en-US\", { maximumFractionDigits });\n val = h(Value, { value: _txt, unit: \"m\" });\n } else {\n val = h(Duration, { value: ageGap, maximumFractionDigits });\n }\n\n let prefix: ReactNode = null;\n if (verbose) {\n prefix = h([\" \", h(\"span.prefix\", \" gap\")]);\n }\n\n return h(\"div.unconformity\", { style, className }, [\n h(\"div.unconformity-inner\", h(\"div.unconformity-text\", [val, prefix])),\n ]);\n}\n"],"names":[],"version":3,"file":"column-views.b977da35.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,uEAAK;AAyBrB,SAAS,0CAAe,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,WAAW,MAAM,CAAC,EAAE;QACrC,MAAM,WAAW,UAAU,MAAM,CAAC,EAAE;QACpC,OAAO,wBAAE,oCAAc;sBACrB;sBACA;sBACA;YACA,OAAO;uBACL;gBACA,QAAQ,UAAU,UAAU;qBAC5B;YACF;qBACA;QACF;IACF;AAEJ;AAEA,SAAS,mCAAa,YACpB,QAAQ,YACR,QAAQ,SACR,KAAK,YACL,QAAQ,WACR,UAAU,OACX;IACC,IAAI,YAAY,QAAQ,YAAY,MAClC,OAAO;IAGT,MAAM,SAAS,KAAK,GAAG,CAAC,WAAW;IAEnC,IAAI,wBAAwB;IAE5B,IAAI,YAAoB;IACxB,IAAI,SAAS,MACX,YAAY;SACP,IAAI,SAAS,KAClB,YAAY;SACP,IAAI,SAAS,IAClB,YAAY;SACP,IAAI,SAAS,GAAG;QACrB,YAAY;QACZ,wBAAwB;IAC1B,OACE,wBAAwB;IAG1B,IAAI;IACJ,IAAI,aAAa,CAAA,GAAA,qBAAa,EAAE,KAAK,IAAI,aAAa,CAAA,GAAA,qBAAa,EAAE,MAAM,EAAE;QAC3E,MAAM,OAAO,OAAO,cAAc,CAAC,SAAS;mCAAE;QAAsB;QACpE,MAAM,wBAAE,CAAA,GAAA,YAAI,GAAG;YAAE,OAAO;YAAM,MAAM;QAAI;IAC1C,OACE,MAAM,wBAAE,CAAA,GAAA,yCAAO,GAAG;QAAE,OAAO;+BAAQ;IAAsB;IAG3D,IAAI,SAAoB;IACxB,IAAI,SACF,SAAS,wBAAE;QAAC;QAAK,wBAAE,eAAe;KAAQ;IAG5C,OAAO,wBAAE,oBAAoB;eAAE;mBAAO;IAAU,GAAG;QACjD,wBAAE,0BAA0B,wBAAE,yBAAyB;YAAC;YAAK;SAAO;KACrE;AACH","sources":["packages/column-views/src/section.ts"],"sourcesContent":["import {\n CompositeUnitsColumn,\n LabelTrackerProvider,\n SectionLabelsColumn,\n} from \"./units\";\nimport { ReactNode, FunctionComponent, useMemo } from \"react\";\nimport {\n Timescale,\n TimescaleOrientation,\n useMacrostratIntervals,\n} from \"@macrostrat/timescale\";\nimport { ColumnAxisType, SVG } from \"@macrostrat/column-components\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./column.module.sass\";\nimport {\n useMacrostratColumnData,\n useMacrostratUnits,\n MacrostratColumnProvider,\n useMacrostratBaseURL,\n} from \"./data-provider\";\nimport { Duration } from \"./unit-details\";\nimport { Value } from \"@macrostrat/data-components\";\nimport type { ExtUnit, PackageScaleLayoutData } from \"./prepare-units/types\";\n\nconst h = hyper.styled(styles);\n\nexport interface SectionSharedProps {\n unitComponent?: FunctionComponent<any>;\n unitComponentProps?: any;\n showLabels?: boolean;\n width?: number;\n columnWidth?: number;\n children?: ReactNode;\n showLabelColumn?: boolean;\n axisType?: ColumnAxisType;\n className?: string;\n clipUnits?: boolean;\n maxInternalColumns?: number;\n // Space between sections\n verticalSpacing?: number;\n // Whether to render unconformity labels\n unconformityLabels?: boolean;\n}\n\nexport interface SectionProps extends SectionSharedProps {\n units: ExtUnit[];\n scaleInfo: PackageScaleLayoutData;\n}\n\nexport function SectionsColumn(props: SectionSharedProps) {\n const {\n unconformityLabels = true,\n unitComponent,\n unitComponentProps,\n showLabels = true,\n width = 300,\n columnWidth = 150,\n showLabelColumn = true,\n clipUnits = true,\n maxInternalColumns,\n } = props;\n\n const units = useMacrostratUnits();\n\n // Get a unique key for the column\n const key = units[0]?.col_id;\n\n return h(LabelTrackerProvider, { units, key }, [\n h(SectionUnitsColumn, {\n width: columnWidth,\n unitComponent,\n unitComponentProps,\n showLabels,\n clipUnits,\n maxInternalColumns,\n unconformityLabels,\n }),\n h.if(showLabelColumn)(SectionLabelsColumn, {\n width: width - columnWidth,\n }),\n ]);\n}\n\nfunction SectionUnitsColumn(props: SectionSharedProps) {\n const {\n width,\n showLabels,\n unitComponent,\n unitComponentProps,\n clipUnits,\n maxInternalColumns,\n axisType,\n unconformityLabels = true,\n } = props;\n\n const { sections, totalHeight } = useMacrostratColumnData();\n\n const scaleData: PackageScaleLayoutData[] = sections.map((section) => {\n return section.scaleInfo;\n });\n\n const innerWidth = width - 2;\n\n return h(\"div.section-units-container\", { style: { width } }, [\n h(\n SVG,\n {\n className: \"sections\",\n height: totalHeight,\n innerWidth,\n paddingH: 1,\n },\n sections.map((group) => {\n const { units, scaleInfo, section_id } = group;\n\n const key = `section-${section_id}`;\n return h(\n SectionUnits,\n {\n units,\n scaleInfo,\n key,\n unitComponent,\n unitComponentProps,\n showLabels,\n width: innerWidth,\n clipUnits,\n maxInternalColumns,\n }, // This unconformity is with the section _above_\n );\n }),\n ),\n h.if(unconformityLabels)(UnconformityLabels, {\n width,\n sections: scaleData,\n verbose: false,\n }),\n ]);\n}\n\nfunction SectionUnits(props: SectionProps) {\n // Section with \"squishy\" timescale\n const {\n units,\n scaleInfo,\n unitComponent,\n showLabels = true,\n width = 300,\n unitComponentProps,\n className,\n clipUnits = true,\n maxInternalColumns,\n } = props;\n\n const { domain, pixelScale, pixelHeight, scale } = scaleInfo;\n\n /** Ensure that we can arrange units into the maximum number\n * of columns defined by unitComponentProps, but that we don't\n * use more than necessary.\n */\n const _unitComponentProps = useMemo(() => {\n return {\n ...unitComponentProps,\n nColumns: Math.min(\n maxInternalColumns ?? Math.floor(width / 10),\n unitComponentProps?.nColumns ?? Infinity,\n Math.max(...units.map((d) => d.column)) + 1,\n ),\n //axisType,\n };\n }, [units, unitComponentProps, maxInternalColumns, width]);\n\n const style = {\n \"--section-height\": `${pixelHeight}px`,\n \"--section-width\": `${width}px`,\n };\n\n return h(\n \"g.section\",\n { className, style, transform: `translate(0 ${scaleInfo.offset})` },\n h(\n MacrostratColumnProvider,\n {\n units,\n domain,\n pixelScale, // Actually pixels per myr,\n scale,\n },\n h(CompositeUnitsColumn, {\n width,\n showLabels,\n unitComponent,\n unitComponentProps: _unitComponentProps,\n clipToFrame: clipUnits,\n }),\n ),\n );\n}\n\ninterface CompositeTimescaleProps {\n levels?: [number, number] | number;\n unconformityLabels?: boolean;\n}\n\nexport function CompositeTimescale(props: CompositeTimescaleProps) {\n const { sections } = useMacrostratColumnData();\n const sectionScales = sections.map((section) => {\n return section.scaleInfo;\n });\n\n return h(CompositeTimescaleCore, {\n packages: sectionScales,\n ...props,\n });\n}\n\ntype CompositeTimescaleCoreProps = CompositeTimescaleProps & {\n packages: PackageScaleLayoutData[];\n};\n\nexport function CompositeTimescaleCore(props: CompositeTimescaleCoreProps) {\n const { levels = 3, packages, unconformityLabels = false } = props;\n\n // Use intervals from Macrostrat API\n const baseURL = useMacrostratBaseURL();\n const intervals = useMacrostratIntervals(baseURL);\n\n let _levels: [number, number];\n if (typeof levels === \"number\") {\n // If levels is a number, use the most common starting level\n _levels = [2, Math.max(2 + Math.min(levels, 5) - 1, 1)];\n } else {\n _levels = levels;\n }\n\n const nCols = _levels[1] - _levels[0] + 1;\n\n return h(\"div.timescale-column\", [\n h(\n \"div.timescales\",\n packages.map((group) => {\n const { pixelHeight, paddingTop, key, scale } = group;\n return h(\n \"div.timescale-container\",\n { style: { paddingTop, \"--timescale-level-count\": nCols }, key },\n [\n h(Timescale, {\n orientation: TimescaleOrientation.VERTICAL,\n length: pixelHeight,\n levels: _levels,\n absoluteAgeScale: true,\n showAgeAxis: false,\n scale,\n intervals,\n }),\n ],\n );\n }),\n ),\n h.if(unconformityLabels)(UnconformityLabels, {\n width: \"100%\",\n sections: packages,\n className: \"unconformity-labels\",\n axisType: ColumnAxisType.AGE,\n }),\n ]);\n}\n\nexport function UnconformityLabels(props: {\n width: string | number;\n sections: PackageScaleLayoutData[];\n axisType?: ColumnAxisType;\n className?: string;\n verbose?: boolean;\n}) {\n const { width, sections, className, axisType, verbose } = props;\n\n return h(\n \"div.unconformity-labels\",\n {\n style: {\n width,\n },\n className,\n },\n sections.map((scaleInfo, i) => {\n const lastGroup = sections[i - 1];\n const top = scaleInfo.offset - scaleInfo.paddingTop;\n const upperAge = lastGroup?.domain[0];\n const lowerAge = scaleInfo.domain[1];\n return h(Unconformity, {\n axisType,\n upperAge,\n lowerAge,\n style: {\n width,\n height: scaleInfo.paddingTop,\n top,\n },\n verbose,\n });\n }),\n );\n}\n\nfunction Unconformity({\n upperAge,\n lowerAge,\n style,\n axisType,\n verbose = false,\n}) {\n if (upperAge == null || lowerAge == null) {\n return null;\n }\n\n const ageGap = Math.abs(upperAge - lowerAge);\n\n let maximumFractionDigits = 0;\n\n let className: string = null;\n if (ageGap > 1000) {\n className = \"giga\";\n } else if (ageGap > 100) {\n className = \"mega\";\n } else if (ageGap > 10) {\n className = \"large\";\n } else if (ageGap < 1) {\n className = \"small\";\n maximumFractionDigits = 2;\n } else {\n maximumFractionDigits = 1;\n }\n\n let val: ReactNode;\n if (axisType === ColumnAxisType.DEPTH || axisType === ColumnAxisType.HEIGHT) {\n const _txt = ageGap.toLocaleString(\"en-US\", { maximumFractionDigits });\n val = h(Value, { value: _txt, unit: \"m\" });\n } else {\n val = h(Duration, { value: ageGap, maximumFractionDigits });\n }\n\n let prefix: ReactNode = null;\n if (verbose) {\n prefix = h([\" \", h(\"span.prefix\", \" gap\")]);\n }\n\n return h(\"div.unconformity\", { style, className }, [\n h(\"div.unconformity-inner\", h(\"div.unconformity-text\", [val, prefix])),\n ]);\n}\n"],"names":[],"version":3,"file":"column-views.848349c0.js.map"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {UnitNamesColumn as $bc17276da4abb183$export$594d19cdd88f8c16} from "./column-views.
|
|
2
|
-
import {UnitBoxes as $d254716a820e9c85$export$5d1cdfabe8dc8085} from "./column-views.
|
|
1
|
+
import {UnitNamesColumn as $bc17276da4abb183$export$594d19cdd88f8c16} from "./column-views.9d0d78aa.js";
|
|
2
|
+
import {UnitBoxes as $d254716a820e9c85$export$5d1cdfabe8dc8085} from "./column-views.fdb3799c.js";
|
|
3
3
|
import {getMixedUnitColor as $6698edd2a743bf07$export$175d3e927f1a9860} from "./column-views.9b77388d.js";
|
|
4
|
-
import {TrackedLabeledUnit as $8c8238faa5cde49c$export$f613830566442374, LabelTrackerProvider as $8c8238faa5cde49c$export$e4e89ab6c86ac513, CompositeUnitComponent as $8c8238faa5cde49c$export$1dfa200d57964eee, CompositeUnitsColumn as $8c8238faa5cde49c$export$a6684360fef0406e, AnnotatedUnitsColumn as $8c8238faa5cde49c$export$d8c3f2fdd653a082, SectionLabelsColumn as $8c8238faa5cde49c$export$13984e34afdbb040, ColumnNotesProvider as $8c8238faa5cde49c$export$6cc7a9df4edde18} from "./column-views.
|
|
5
|
-
import {useEnvironments as $774a5efa27d1c77b$export$c6b216bf4c71b61f, useLithologies as $774a5efa27d1c77b$export$4d18a90c945d129f} from "./column-views.
|
|
4
|
+
import {TrackedLabeledUnit as $8c8238faa5cde49c$export$f613830566442374, LabelTrackerProvider as $8c8238faa5cde49c$export$e4e89ab6c86ac513, CompositeUnitComponent as $8c8238faa5cde49c$export$1dfa200d57964eee, CompositeUnitsColumn as $8c8238faa5cde49c$export$a6684360fef0406e, AnnotatedUnitsColumn as $8c8238faa5cde49c$export$d8c3f2fdd653a082, SectionLabelsColumn as $8c8238faa5cde49c$export$13984e34afdbb040, ColumnNotesProvider as $8c8238faa5cde49c$export$6cc7a9df4edde18} from "./column-views.f046b170.js";
|
|
5
|
+
import {useEnvironments as $774a5efa27d1c77b$export$c6b216bf4c71b61f, useLithologies as $774a5efa27d1c77b$export$4d18a90c945d129f} from "./column-views.3c1cde51.js";
|
|
6
6
|
import {resolveID as $d3e69bd163d41f63$export$7be7d732f3de9464} from "./column-views.006d5180.js";
|
|
7
7
|
import "./column-views.f9dab157.js";
|
|
8
8
|
import $7H3th$macrostrathyper from "@macrostrat/hyper";
|
|
@@ -146,4 +146,4 @@ function $4c8184c4a7317749$var$getPatternID(liths, lithMap) {
|
|
|
146
146
|
|
|
147
147
|
|
|
148
148
|
export {$4c8184c4a7317749$export$3750278673318c9a as UnitsColumn, $4c8184c4a7317749$export$2006342ddaa547c6 as SimpleUnitsColumn, $4c8184c4a7317749$export$600691a8e9d13a7 as BasicUnitComponent, $4c8184c4a7317749$export$48a4cacf2b7a4441 as UnitComponent, $4c8184c4a7317749$export$62c7735c72801c19 as useUnitColor, $4c8184c4a7317749$export$6012fd1584b5d0c0 as ColoredUnitComponent, $4c8184c4a7317749$export$4830e703a903113 as useUnitColorByEnvironment, $4c8184c4a7317749$export$c2fe8a14da82d570 as EnvironmentColoredUnitComponent, $6698edd2a743bf07$export$175d3e927f1a9860 as getMixedUnitColor, $8c8238faa5cde49c$export$e4e89ab6c86ac513 as LabelTrackerProvider, $8c8238faa5cde49c$export$f613830566442374 as TrackedLabeledUnit, $8c8238faa5cde49c$export$1dfa200d57964eee as CompositeUnitComponent, $8c8238faa5cde49c$export$a6684360fef0406e as CompositeUnitsColumn, $8c8238faa5cde49c$export$d8c3f2fdd653a082 as AnnotatedUnitsColumn, $8c8238faa5cde49c$export$13984e34afdbb040 as SectionLabelsColumn, $8c8238faa5cde49c$export$6cc7a9df4edde18 as ColumnNotesProvider};
|
|
149
|
-
//# sourceMappingURL=column-views.
|
|
149
|
+
//# sourceMappingURL=column-views.86b879ba.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqBO,SAAS,0CAAY,SAAE,QAAQ,KAAK;IACzC;;EAEA,GACA,OAAO,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,sBAAc,GAAG;eAAE;IAAM,GAAG,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,yCAAQ;AACjD;AAEO,SAAS,0CAAkB,KAA0B;IAC1D;;;EAGA,GACA,MAAM,eAAE,WAAW,SAAE,KAAK,eAAE,cAAc,gBAAG,cAAc,IAAI,GAAG;IAElE,OAAO,CAAA,GAAA,sBAAA,EAAE;QACP,CAAA,GAAA,sBAAA,EAAE,2CAAa;YACb,OAAO;QACT;QACA,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,yCAAc,GAAG;YACjB,WAAW,CAAC,UAAU,EAAE,cAAc,YAAY,CAAC,CAAC;YACpD,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tD,OAAO;IAET,MAAM,aAAa,IAAI;IACvB,KAAK,MAAM,QAAQ,MAAO;QACxB,MAAM,WAAW,QAAQ,GAAG,CAAC,KAAK,OAAO;QACzC,IAAI,UACF,WAAW,GAAG,CAAC,GAAG,SAAS,IAAI,EAAE;IAErC;IACA,IAAI,KAAK,WAAW,MAAM,EAAE,CAAC,EAAE;IAC/B,IAAI,MAAM,KAAK,OAAO;IACtB,OAAO;AACT","sources":["packages/column-views/src/units/index.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport {\n LithologyColumn,\n useGeologicPattern,\n} from \"@macrostrat/column-components\";\nimport { UnitNamesColumn } from \"./names\";\nimport { ICompositeUnitProps } from \"./composite\";\nimport { UnitBoxes, UnitProps } from \"./boxes\";\nimport { useColumnLayout } from \"@macrostrat/column-components\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\nimport { getMixedUnitColor } from \"./colors\";\nimport { TrackedLabeledUnit } from \"./composite\";\nimport { useEnvironments, useLithologies } from \"../data-provider\";\nimport { useMemo } from \"react\";\nimport { resolveID } from \"./resolvers\";\nimport { Lithology } from \"@macrostrat/api-types\";\n\nexport * from \"./composite\";\nexport * from \"./types\";\nexport * from \"./colors\";\n\nexport function UnitsColumn({ width = 100 }) {\n /*\n A column showing units with USGS color fill\n */\n return h(LithologyColumn, { width }, h(UnitBoxes));\n}\n\nexport function SimpleUnitsColumn(props: ICompositeUnitProps) {\n /*\n A column with units and names either\n overlapping or offset to the right\n */\n const { columnWidth, width, gutterWidth = 0, labelOffset = 30 } = props;\n\n return h([\n h(UnitsColumn, {\n width: columnWidth,\n }),\n h(UnitNamesColumn, {\n transform: `translate(${columnWidth + gutterWidth})`,\n paddingLeft: labelOffset,\n width: width - columnWidth - gutterWidth,\n }),\n ]);\n}\n\nexport function BasicUnitComponent({ division, ...rest }) {\n /** A unit that allows directly setting colors and patterns. */\n\n return h(UnitComponent, {\n division,\n ...rest,\n backgroundColor: division.color,\n patternID: division.patternID,\n });\n}\n\nexport function UnitComponent({ division, nColumns = 2, ...rest }) {\n const width = rest.width ?? useColumnLayout()?.width;\n\n const nOverlappingUnits = division.overlappingUnits?.length ?? 0;\n const _nColumns = nOverlappingUnits == 0 ? 1 : nColumns;\n const columnIx = (division.column ?? 0) % _nColumns;\n const reducedWidth = width / _nColumns;\n const x = (columnIx * width) / _nColumns;\n\n return h(TrackedLabeledUnit, {\n division,\n ...rest,\n width: reducedWidth,\n x,\n });\n}\n\ninterface UnitColorOptions {\n asBackground?: boolean;\n}\n\nexport function useUnitColor(unit, opts: UnitColorOptions = {}): string | null {\n /** Get the color for a unit based on its lithology */\n const lithMap = useLithologies();\n const inDarkMode = useInDarkMode();\n const { asBackground = true } = opts;\n\n return useMemo(() => {\n if (unit == null || lithMap == null) return null;\n return getMixedUnitColor(unit, lithMap, inDarkMode, asBackground);\n }, [unit?.unit_id, lithMap, inDarkMode, asBackground]);\n}\n\nexport function ColoredUnitComponent(props) {\n /** A unit component that is colored using a mixture of lithologies.\n * This is a separate component because it depends on more providers/contexts to determine coloring. */\n const backgroundColor = useUnitColor(props.division);\n\n const patternID = useMemo(() => {\n return resolveID(props.division); // ?? getPatternID(props.division.lith, lithMap);\n }, [props.division?.unit_id]);\n\n const fill = useGeologicPattern(patternID);\n\n return h(UnitComponent, {\n fill,\n backgroundColor,\n ...props,\n });\n}\n\nexport function useUnitColorByEnvironment(\n unit,\n opts: UnitColorOptions = {},\n): string | null {\n /** Get the color for a unit based on its lithology */\n const environmentMap = useEnvironments();\n const lithMap = useLithologies();\n const inDarkMode = useInDarkMode();\n const { asBackground = true } = opts;\n\n return useMemo(() => {\n if (unit == null || environmentMap == null) return null;\n let c = getMixedUnitColor(unit, environmentMap, inDarkMode, asBackground, {\n key: \"environ\",\n id_key: \"environ_id\",\n });\n if (c != null) {\n return c;\n }\n // Fallback to lithology color if no environment color is found\n return getMixedUnitColor(unit, lithMap, inDarkMode, asBackground);\n }, [unit?.unit_id, environmentMap, lithMap, inDarkMode, asBackground]);\n}\n\nexport function EnvironmentColoredUnitComponent(props) {\n /** A unit component that is colored using a mixture of lithologies.\n * This is a separate component because it depends on more providers/contexts to determine coloring. */\n const backgroundColor = useUnitColorByEnvironment(props.division);\n\n const patternID = useMemo(() => {\n return resolveID(props.division); // ?? getPatternID(props.division.lith, lithMap);\n }, [props.division?.unit_id]);\n\n const fill = useGeologicPattern(patternID);\n\n return h(UnitComponent, {\n fill,\n backgroundColor,\n ...props,\n });\n}\n\nfunction getPatternID(\n liths: Array<Lithology>,\n lithMap: Map<number, Lithology>,\n): string | null {\n if (lithMap == null || liths == null || liths.length == 0) {\n return null;\n }\n const patternIDs = new Set<string>();\n for (const lith of liths) {\n const lithData = lithMap.get(lith.lith_id);\n if (lithData) {\n patternIDs.add(`${lithData.fill}`);\n }\n }\n let id = patternIDs.values()[0];\n if (id == \"0\") return null;\n return id;\n}\n"],"names":[],"version":3,"file":"column-views.
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqBO,SAAS,0CAAY,SAAE,QAAQ,KAAK;IACzC;;EAEA,GACA,OAAO,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,sBAAc,GAAG;eAAE;IAAM,GAAG,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,yCAAQ;AACjD;AAEO,SAAS,0CAAkB,KAA0B;IAC1D;;;EAGA,GACA,MAAM,eAAE,WAAW,SAAE,KAAK,eAAE,cAAc,gBAAG,cAAc,IAAI,GAAG;IAElE,OAAO,CAAA,GAAA,sBAAA,EAAE;QACP,CAAA,GAAA,sBAAA,EAAE,2CAAa;YACb,OAAO;QACT;QACA,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,yCAAc,GAAG;YACjB,WAAW,CAAC,UAAU,EAAE,cAAc,YAAY,CAAC,CAAC;YACpD,aAAa;YACb,OAAO,QAAQ,cAAc;QAC/B;KACD;AACH;AAEO,SAAS,yCAAmB,YAAE,QAAQ,EAAE,GAAG,MAAM;IACtD,6DAA6D,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QACzC,IAAI,UACF,WAAW,GAAG,CAAC,GAAG,SAAS,IAAI,EAAE;IAErC;IACA,IAAI,KAAK,WAAW,MAAM,EAAE,CAAC,EAAE;IAC/B,IAAI,MAAM,KAAK,OAAO;IACtB,OAAO;AACT","sources":["packages/column-views/src/units/index.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport {\n LithologyColumn,\n useGeologicPattern,\n} from \"@macrostrat/column-components\";\nimport { UnitNamesColumn } from \"./names\";\nimport { ICompositeUnitProps } from \"./composite\";\nimport { UnitBoxes, UnitProps } from \"./boxes\";\nimport { useColumnLayout } from \"@macrostrat/column-components\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\nimport { getMixedUnitColor } from \"./colors\";\nimport { TrackedLabeledUnit } from \"./composite\";\nimport { useEnvironments, useLithologies } from \"../data-provider\";\nimport { useMemo } from \"react\";\nimport { resolveID } from \"./resolvers\";\nimport { Lithology } from \"@macrostrat/api-types\";\n\nexport * from \"./composite\";\nexport * from \"./types\";\nexport * from \"./colors\";\n\nexport function UnitsColumn({ width = 100 }) {\n /*\n A column showing units with USGS color fill\n */\n return h(LithologyColumn, { width }, h(UnitBoxes));\n}\n\nexport function SimpleUnitsColumn(props: ICompositeUnitProps) {\n /*\n A column with units and names either\n overlapping or offset to the right\n */\n const { columnWidth, width, gutterWidth = 0, labelOffset = 30 } = props;\n\n return h([\n h(UnitsColumn, {\n width: columnWidth,\n }),\n h(UnitNamesColumn, {\n transform: `translate(${columnWidth + gutterWidth})`,\n paddingLeft: labelOffset,\n width: width - columnWidth - gutterWidth,\n }),\n ]);\n}\n\nexport function BasicUnitComponent({ division, ...rest }) {\n /** A unit that allows directly setting colors and patterns. */\n\n return h(UnitComponent, {\n division,\n ...rest,\n backgroundColor: division.color,\n patternID: division.patternID,\n });\n}\n\nexport function UnitComponent({ division, nColumns = 2, ...rest }) {\n const width = rest.width ?? useColumnLayout()?.width;\n\n const nOverlappingUnits = division.overlappingUnits?.length ?? 0;\n const _nColumns = nOverlappingUnits == 0 ? 1 : nColumns;\n const columnIx = (division.column ?? 0) % _nColumns;\n const reducedWidth = width / _nColumns;\n const x = (columnIx * width) / _nColumns;\n\n return h(TrackedLabeledUnit, {\n division,\n ...rest,\n width: reducedWidth,\n x,\n });\n}\n\ninterface UnitColorOptions {\n asBackground?: boolean;\n}\n\nexport function useUnitColor(unit, opts: UnitColorOptions = {}): string | null {\n /** Get the color for a unit based on its lithology */\n const lithMap = useLithologies();\n const inDarkMode = useInDarkMode();\n const { asBackground = true } = opts;\n\n return useMemo(() => {\n if (unit == null || lithMap == null) return null;\n return getMixedUnitColor(unit, lithMap, inDarkMode, asBackground);\n }, [unit?.unit_id, lithMap, inDarkMode, asBackground]);\n}\n\nexport function ColoredUnitComponent(props) {\n /** A unit component that is colored using a mixture of lithologies.\n * This is a separate component because it depends on more providers/contexts to determine coloring. */\n const backgroundColor = useUnitColor(props.division);\n\n const patternID = useMemo(() => {\n return resolveID(props.division); // ?? getPatternID(props.division.lith, lithMap);\n }, [props.division?.unit_id]);\n\n const fill = useGeologicPattern(patternID);\n\n return h(UnitComponent, {\n fill,\n backgroundColor,\n ...props,\n });\n}\n\nexport function useUnitColorByEnvironment(\n unit,\n opts: UnitColorOptions = {},\n): string | null {\n /** Get the color for a unit based on its lithology */\n const environmentMap = useEnvironments();\n const lithMap = useLithologies();\n const inDarkMode = useInDarkMode();\n const { asBackground = true } = opts;\n\n return useMemo(() => {\n if (unit == null || environmentMap == null) return null;\n let c = getMixedUnitColor(unit, environmentMap, inDarkMode, asBackground, {\n key: \"environ\",\n id_key: \"environ_id\",\n });\n if (c != null) {\n return c;\n }\n // Fallback to lithology color if no environment color is found\n return getMixedUnitColor(unit, lithMap, inDarkMode, asBackground);\n }, [unit?.unit_id, environmentMap, lithMap, inDarkMode, asBackground]);\n}\n\nexport function EnvironmentColoredUnitComponent(props) {\n /** A unit component that is colored using a mixture of lithologies.\n * This is a separate component because it depends on more providers/contexts to determine coloring. */\n const backgroundColor = useUnitColorByEnvironment(props.division);\n\n const patternID = useMemo(() => {\n return resolveID(props.division); // ?? getPatternID(props.division.lith, lithMap);\n }, [props.division?.unit_id]);\n\n const fill = useGeologicPattern(patternID);\n\n return h(UnitComponent, {\n fill,\n backgroundColor,\n ...props,\n });\n}\n\nfunction getPatternID(\n liths: Array<Lithology>,\n lithMap: Map<number, Lithology>,\n): string | null {\n if (lithMap == null || liths == null || liths.length == 0) {\n return null;\n }\n const patternIDs = new Set<string>();\n for (const lith of liths) {\n const lithData = lithMap.get(lith.lith_id);\n if (lithData) {\n patternIDs.add(`${lithData.fill}`);\n }\n }\n let id = patternIDs.values()[0];\n if (id == \"0\") return null;\n return id;\n}\n"],"names":[],"version":3,"file":"column-views.86b879ba.js.map"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76} from "./column-views.
|
|
1
|
+
import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76} from "./column-views.8168c37d.js";
|
|
2
2
|
import {line as $iZTQD$line} from "d3-shape";
|
|
3
3
|
import {createContext as $iZTQD$createContext, useContext as $iZTQD$useContext} from "react";
|
|
4
4
|
import $iZTQD$macrostrathyper from "@macrostrat/hyper";
|
|
@@ -83,4 +83,4 @@ const $5f39f3d52558a1d0$export$919dbb10b6b5b75 = ()=>(0, $iZTQD$useContext)($5f3
|
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
export {$5f39f3d52558a1d0$export$309ef8546e07d921 as IsotopesDataArea, $5f39f3d52558a1d0$export$4cb5d059db4e2bd as IsotopeDataPoint, $5f39f3d52558a1d0$export$628a3ef6eb9c3a89 as IsotopeDataLine, $5f39f3d52558a1d0$export$919dbb10b6b5b75 as useDataLocator};
|
|
86
|
-
//# sourceMappingURL=column-views.
|
|
86
|
+
//# sourceMappingURL=column-views.8c8f3fe0.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;AAMA,MAAM,iCA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,EAAE,UAAU;AAChE;AAEA,MAAM,2CAAmB,SAAU,KAAK;IACtC,MAAM,gBAAE,YAAY,EAAE,GAAG,CAAA,GAAA,iBAAS,EAAE;IACpC,MAAM,SAAE,KAAK,eAAE,WAAW,EAAE,GAAG,MAAM,GAAG;IACxC,MAAM,MAAM,aAAa;IACzB,IAAI,OAAO,MAAM,OAAO;IACxB,MAAM,CAAC,IAAI,GAAG,GAAG;IAEjB,OAAO,CAAA,GAAA,sBAAA,EAAE,UAAU;QACjB,KAAK,MAAM,SAAS;YACpB;YACA;QACA,GAAG;QACH,GAAG,IAAI;IACT;AACF;AAEA,MAAM,4CAAkB,SAAU,KAAK;IACrC,MAAM,EAAE,QAAQ,UAAU,EAAE,GAAG,MAAM,GAAG;IACxC,MAAM,eAAE,WAAW,EAAE,GAAG,CAAA,GAAA,iBAAS,EAAE;IACnC,OAAO,CAAA,GAAA,sBAAA,EAAE,QAAQ;QACf,GAAG,YAAY;QACf,MAAM;QACN,GAAG,IAAI;IACT;AACF;AAEA,MAAM,2CAAiB,IAAM,CAAA,GAAA,iBAAS,EAAE","sources":["packages/column-views/src/facets/carbon-isotopes/data-area.ts"],"sourcesContent":["import { line } from \"d3-shape\";\nimport { createContext, useContext } from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport { ColumnLayoutContext } from \"@macrostrat/column-components\";\nimport { useCompositeScale } from \"../../data-provider\";\n\nconst inDomain = (scale, num) => {\n const domain = scale.domain();\n return domain[0] < num < domain[1];\n};\n\nconst createPointLocator = function (opts) {\n const { xScale, scale, getHeight, ...rest } = opts;\n return function (d, s = 0) {\n const height = getHeight(d);\n if (!inDomain(scale, height)) return null;\n return [xScale(d.value), scale(height)];\n };\n};\n\nconst IsotopesDataContext = createContext(null);\n\nexport interface DataAreaProps {\n clipY: boolean;\n parameter: string;\n corrected: boolean;\n system: string;\n children: React.ReactNode;\n getHeight?: Function;\n}\n\nconst IsotopesDataArea = function (props: DataAreaProps) {\n const xScale = useContext(ColumnLayoutContext)?.xScale;\n\n const scale = useCompositeScale();\n\n let { corrected, system, children, getHeight, clipY = false } = props;\n if (getHeight == null) {\n getHeight = function (d) {\n if (d.height == null) {\n console.log(d);\n }\n return d.height;\n };\n }\n\n // Handlers for creating points and lines\n const pointLocator = createPointLocator({\n xScale,\n scale,\n corrected,\n system,\n getHeight,\n });\n\n let column = \"avg_\" + system;\n if (corrected) {\n column += \"_corr\";\n }\n const lineLocator = line()\n .x((d) => xScale(d[column]))\n // @ts-ignore\n .y((d) => scale(d.height));\n\n const value = { pointLocator, lineLocator, corrected, system, clipY };\n return h(IsotopesDataContext.Provider, { value }, h(\"g.data\", children));\n};\n\nconst IsotopeDataPoint = function (props) {\n const { pointLocator } = useContext(IsotopesDataContext);\n const { datum, strokeWidth, ...rest } = props;\n const loc = pointLocator(datum);\n if (loc == null) return null;\n const [cx, cy] = loc;\n\n return h(\"circle\", {\n key: datum.sample_id,\n cx,\n cy,\n r: 2,\n ...rest,\n });\n};\n\nconst IsotopeDataLine = function (props) {\n const { values: lineValues, ...rest } = props;\n const { lineLocator } = useContext(IsotopesDataContext);\n return h(\"path\", {\n d: lineLocator(lineValues),\n fill: \"transparent\",\n ...rest,\n });\n};\n\nconst useDataLocator = () => useContext(IsotopesDataContext);\n\nexport { IsotopesDataArea, IsotopeDataPoint, IsotopeDataLine, useDataLocator };\n"],"names":[],"version":3,"file":"column-views.
|
|
1
|
+
{"mappings":";;;;;;;;;;;AAMA,MAAM,iCAAW,CAAC,OAAO;IACvB,MAAM,SAAS,MAAM,MAAM;IAC3B,OAAO,MAAM,CAAC,EAAE,GAAG,MAAM,MAAM,CAAC,EAAE;AACpC;AAEA,MAAM,2CAAqB,SAAU,IAAI;IACvC,MAAM,UAAE,MAAM,SAAE,KAAK,aAAE,SAAS,EAAE,GAAG,MAAM,GAAG;IAC9C,OAAO,SAAU,CAAC,EAAE,IAAI,CAAC;QACvB,MAAM,SAAS,UAAU;QACzB,IAAI,CAAC,+BAAS,OAAO,SAAS,OA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M,SAAS;YACpB;YACA;QACA,GAAG;QACH,GAAG,IAAI;IACT;AACF;AAEA,MAAM,4CAAkB,SAAU,KAAK;IACrC,MAAM,EAAE,QAAQ,UAAU,EAAE,GAAG,MAAM,GAAG;IACxC,MAAM,eAAE,WAAW,EAAE,GAAG,CAAA,GAAA,iBAAS,EAAE;IACnC,OAAO,CAAA,GAAA,sBAAA,EAAE,QAAQ;QACf,GAAG,YAAY;QACf,MAAM;QACN,GAAG,IAAI;IACT;AACF;AAEA,MAAM,2CAAiB,IAAM,CAAA,GAAA,iBAAS,EAAE","sources":["packages/column-views/src/facets/carbon-isotopes/data-area.ts"],"sourcesContent":["import { line } from \"d3-shape\";\nimport { createContext, useContext } from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport { ColumnLayoutContext } from \"@macrostrat/column-components\";\nimport { useCompositeScale } from \"../../data-provider\";\n\nconst inDomain = (scale, num) => {\n const domain = scale.domain();\n return domain[0] < num < domain[1];\n};\n\nconst createPointLocator = function (opts) {\n const { xScale, scale, getHeight, ...rest } = opts;\n return function (d, s = 0) {\n const height = getHeight(d);\n if (!inDomain(scale, height)) return null;\n return [xScale(d.value), scale(height)];\n };\n};\n\nconst IsotopesDataContext = createContext(null);\n\nexport interface DataAreaProps {\n clipY: boolean;\n parameter: string;\n corrected: boolean;\n system: string;\n children: React.ReactNode;\n getHeight?: Function;\n}\n\nconst IsotopesDataArea = function (props: DataAreaProps) {\n const xScale = useContext(ColumnLayoutContext)?.xScale;\n\n const scale = useCompositeScale();\n\n let { corrected, system, children, getHeight, clipY = false } = props;\n if (getHeight == null) {\n getHeight = function (d) {\n if (d.height == null) {\n console.log(d);\n }\n return d.height;\n };\n }\n\n // Handlers for creating points and lines\n const pointLocator = createPointLocator({\n xScale,\n scale,\n corrected,\n system,\n getHeight,\n });\n\n let column = \"avg_\" + system;\n if (corrected) {\n column += \"_corr\";\n }\n const lineLocator = line()\n .x((d) => xScale(d[column]))\n // @ts-ignore\n .y((d) => scale(d.height));\n\n const value = { pointLocator, lineLocator, corrected, system, clipY };\n return h(IsotopesDataContext.Provider, { value }, h(\"g.data\", children));\n};\n\nconst IsotopeDataPoint = function (props) {\n const { pointLocator } = useContext(IsotopesDataContext);\n const { datum, strokeWidth, ...rest } = props;\n const loc = pointLocator(datum);\n if (loc == null) return null;\n const [cx, cy] = loc;\n\n return h(\"circle\", {\n key: datum.sample_id,\n cx,\n cy,\n r: 2,\n ...rest,\n });\n};\n\nconst IsotopeDataLine = function (props) {\n const { values: lineValues, ...rest } = props;\n const { lineLocator } = useContext(IsotopesDataContext);\n return h(\"path\", {\n d: lineLocator(lineValues),\n fill: \"transparent\",\n ...rest,\n });\n};\n\nconst useDataLocator = () => useContext(IsotopesDataContext);\n\nexport { IsotopesDataArea, IsotopeDataPoint, IsotopeDataLine, useDataLocator };\n"],"names":[],"version":3,"file":"column-views.8c8f3fe0.js.map"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {UnitDetailsPanel as $448b24baeef3b229$export$fbd245232df17557} from "./column-views.
|
|
1
|
+
import {UnitDetailsPanel as $448b24baeef3b229$export$fbd245232df17557} from "./column-views.b9c4d94c.js";
|
|
2
2
|
import {Button as $fodo6$Button} from "@blueprintjs/core";
|
|
3
3
|
import {useKeyHandler as $fodo6$useKeyHandler} from "@macrostrat/ui-components";
|
|
4
4
|
import $fodo6$macrostrathyper from "@macrostrat/hyper";
|
|
@@ -57,4 +57,4 @@ function $d418ca9cbe9b0f3c$export$cfdbe8496aa51962(props) {
|
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
export {$d418ca9cbe9b0f3c$export$cfdbe8496aa51962 as UnitDetailsPanelWithNavigation};
|
|
60
|
-
//# sourceMappingURL=column-views.
|
|
60
|
+
//# sourceMappingURL=column-views.9b210fb2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAKO,SAAS,0CAA+B,KAAK;IAClD,MAAM,YAAE,QAAQ,aAAE,SAAS,gBAAE,YAAY,gBAAE,YAAY,YAAE,QAAQ,EAAE,GAAG,MAAM,GAC1E;IAEF,MAAM,KAAK,UAAU,UACnB,CAAC,OAAS,KAAK,OAAO,KAAK,cAAc;IAG3C,MAAM,SAAS;QACb,IAAI,KAAK;QACT,IAAI,KAAK;IACX;IAEA,CAAA,GAAA,oBAAY,EACV,CAAC;QACC,MAAM,SAAS,MAAM,CAAC,MAAM,OAAO,CAAC;QACpC,IAAI,UAAU,QAAQ,SAAS,KAAK,UAAU,SAAS,MAAM,EAAE;QAC/D,aAAa,QAAQ,CAAC,OAAO,CAAC,OAAO;QACrC,MAAM,eAAe;IACvB,GACA;QAAC;QAAU;KAAG;IAGhB,IAAI,gBAAgB,MAAM,OAAO;IAEjC,MAAM,UAAU,CAAA,GAAA,sBAAA,EAAE;QAChB,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,aAAK,GAAG;YACR,MAAM;YACN,UAAU,OAAO;YACjB;gBACE,aAAa,QAAQ,CAAC,KAAK,EAAE,EAAE;YACjC;QACF;QACA,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,aAAK,GAAG;YACR,MAAM;YACN,UAAU,OAAO,SAAS,MAAM,GAAG;YACnC;gBACE,aAAa,QAAQ,CAAC,KAAK,EAAE,EAAE;YACjC;QACF;KACD;IAED,OAAO,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,yCAAe,GAAG;QACzB,MAAM;QACN,SAAQ,KAAK;YACX,aAAa;QACf;mBACA;iBACA;QACA,0BAA0B;QAC1B,YAAY;QACZ,aAAa;kBACb;QACA,GAAG,IAAI;IACT;AACF","sources":["packages/column-views/src/unit-details/modal-panel.ts"],"sourcesContent":["import { Button } from \"@blueprintjs/core\";\nimport { UnitDetailsPanel } from \"./panel\";\nimport { useKeyHandler } from \"@macrostrat/ui-components\";\nimport h from \"@macrostrat/hyper\";\n\nexport function UnitDetailsPanelWithNavigation(props) {\n const { unitData, className, selectedUnit, onSelectUnit, features, ...rest } =\n props;\n\n const ix = unitData?.findIndex(\n (unit) => unit.unit_id === selectedUnit?.unit_id,\n );\n\n const keyMap = {\n 38: ix - 1,\n 40: ix + 1,\n };\n\n useKeyHandler(\n (event) => {\n const nextIx = keyMap[event.keyCode];\n if (nextIx == null || nextIx < 0 || nextIx >= unitData.length) return;\n onSelectUnit(unitData[nextIx].unit_id);\n event.stopPropagation();\n },\n [unitData, ix],\n );\n\n if (selectedUnit == null) return null;\n\n const actions = h([\n h(Button, {\n icon: \"arrow-up\",\n disabled: ix === 0,\n onClick() {\n onSelectUnit(unitData[ix - 1]?.unit_id);\n },\n }),\n h(Button, {\n icon: \"arrow-down\",\n disabled: ix === unitData.length - 1,\n onClick() {\n onSelectUnit(unitData[ix + 1]?.unit_id);\n },\n }),\n ]);\n\n return h(UnitDetailsPanel, {\n unit: selectedUnit,\n onClose(event) {\n onSelectUnit(null);\n },\n className,\n actions,\n showLithologyProportions: true,\n selectUnit: onSelectUnit,\n columnUnits: unitData,\n features,\n ...rest,\n });\n}\n"],"names":[],"version":3,"file":"column-views.
|
|
1
|
+
{"mappings":";;;;;;;;;AAKO,SAAS,0CAA+B,KAAK;IAClD,MAAM,YAAE,QAAQ,aAAE,SAAS,gBAAE,YAAY,gBAAE,YAAY,YAAE,QAAQ,EAAE,GAAG,MAAM,GAC1E;IAEF,MAAM,KAAK,UAAU,UACnB,CAAC,OAAS,KAAK,OAAO,KAAK,cAAc;IAG3C,MAAM,SAAS;QACb,IAAI,KAAK;QACT,IAAI,KAAK;IACX;IAEA,CAAA,GAAA,oBAAY,EACV,CAAC;QACC,MAAM,SAAS,MAAM,CAAC,MAAM,OAAO,CAAC;QACpC,IAAI,UAAU,QAAQ,SAAS,KAAK,UAAU,SAAS,MAAM,EAAE;QAC/D,aAAa,QAAQ,CAAC,OAAO,CAAC,OAAO;QACrC,MAAM,eAAe;IACvB,GACA;QAAC;QAAU;KAAG;IAGhB,IAAI,gBAAgB,MAAM,OAAO;IAEjC,MAAM,UAAU,CAAA,GAAA,sBAAA,EAAE;QAChB,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,aAAK,GAAG;YACR,MAAM;YACN,UAAU,OAAO;YACjB;gBACE,aAAa,QAAQ,CAAC,KAAK,EAAE,EAAE;YACjC;QACF;QACA,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,aAAK,GAAG;YACR,MAAM;YACN,UAAU,OAAO,SAAS,MAAM,GAAG;YACnC;gBACE,aAAa,QAAQ,CAAC,KAAK,EAAE,EAAE;YACjC;QACF;KACD;IAED,OAAO,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,yCAAe,GAAG;QACzB,MAAM;QACN,SAAQ,KAAK;YACX,aAAa;QACf;mBACA;iBACA;QACA,0BAA0B;QAC1B,YAAY;QACZ,aAAa;kBACb;QACA,GAAG,IAAI;IACT;AACF","sources":["packages/column-views/src/unit-details/modal-panel.ts"],"sourcesContent":["import { Button } from \"@blueprintjs/core\";\nimport { UnitDetailsPanel } from \"./panel\";\nimport { useKeyHandler } from \"@macrostrat/ui-components\";\nimport h from \"@macrostrat/hyper\";\n\nexport function UnitDetailsPanelWithNavigation(props) {\n const { unitData, className, selectedUnit, onSelectUnit, features, ...rest } =\n props;\n\n const ix = unitData?.findIndex(\n (unit) => unit.unit_id === selectedUnit?.unit_id,\n );\n\n const keyMap = {\n 38: ix - 1,\n 40: ix + 1,\n };\n\n useKeyHandler(\n (event) => {\n const nextIx = keyMap[event.keyCode];\n if (nextIx == null || nextIx < 0 || nextIx >= unitData.length) return;\n onSelectUnit(unitData[nextIx].unit_id);\n event.stopPropagation();\n },\n [unitData, ix],\n );\n\n if (selectedUnit == null) return null;\n\n const actions = h([\n h(Button, {\n icon: \"arrow-up\",\n disabled: ix === 0,\n onClick() {\n onSelectUnit(unitData[ix - 1]?.unit_id);\n },\n }),\n h(Button, {\n icon: \"arrow-down\",\n disabled: ix === unitData.length - 1,\n onClick() {\n onSelectUnit(unitData[ix + 1]?.unit_id);\n },\n }),\n ]);\n\n return h(UnitDetailsPanel, {\n unit: selectedUnit,\n onClose(event) {\n onSelectUnit(null);\n },\n className,\n actions,\n showLithologyProportions: true,\n selectUnit: onSelectUnit,\n columnUnits: unitData,\n features,\n ...rest,\n });\n}\n"],"names":[],"version":3,"file":"column-views.9b210fb2.js.map"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.
|
|
1
|
+
import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.8168c37d.js";
|
|
2
2
|
import {getUnitHeightRange as $b6657fba8924a702$export$70e712e2ac0237a} from "./column-views.052498a6.js";
|
|
3
3
|
import $5ZBll$macrostrathyper from "@macrostrat/hyper";
|
|
4
4
|
import $5ZBll$react, {useCallback as $5ZBll$useCallback} from "react";
|
|
@@ -67,4 +67,4 @@ function $bc17276da4abb183$export$594d19cdd88f8c16(props) {
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
export {$bc17276da4abb183$export$2f2e65a797f8fc1e as noteForDivision, $bc17276da4abb183$export$c9757aeb43a67df0 as defaultNameFunction, $bc17276da4abb183$export$6316e673796ccb55 as UnitDataColumn, $bc17276da4abb183$export$594d19cdd88f8c16 as UnitNamesColumn};
|
|
70
|
-
//# sourceMappingURL=column-views.
|
|
70
|
+
//# sourceMappingURL=column-views.9d0d78aa.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;AAmCA,SAAS,0CACP,GAAU,EACV,IAA4E;IAE5E,MAAM,YAAE,QAAQ,EAAE,GAAG;IAErB,MAAM,CAAC,QAAQ,WAAW,GAAG,CAAA,GAAA,wCAAiB,EAAE,KAAK;IAErD,MAAM,kBAAkB,KAAK,eAAe,IAAI;IAEhD,OAAO;gBACL;oBACA;QACA,MAAM;QACN,IAAI,IAAI,OAA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,GAAG,MAAM,GAAG;IAClD,OAAO,CAAA,GAAA,sBAAA,EAAE,2CAAgB;uBACvB;QACA,GAAG,IAAI;IACT;AACF","sources":["packages/column-views/src/units/names.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport { useCallback } from \"react\";\nimport {\n ColumnAxisType,\n NotesColumn,\n type ColumnDivision,\n type NoteData,\n type NotesColumnProps,\n} from \"@macrostrat/column-components\";\nimport type { IUnit } from \"./types\";\nimport React from \"react\";\nimport { useCompositeScale, useMacrostratColumnData } from \"../data-provider\";\nimport {\n type CompositeColumnScale,\n getUnitHeightRange,\n} from \"../prepare-units\";\n\ninterface UnitDataProps extends NotesColumnProps {\n left?: number;\n transform?: string;\n nameForDivision?(obj: IUnit): string;\n noteComponent?: React.ComponentType<any>;\n shouldRenderNote?(div: ColumnDivision | IUnit, index: number): boolean;\n divisions?: IUnit[];\n minimumHeight?: number;\n scale?: CompositeColumnScale;\n}\n\ninterface UnitNote extends NoteData {\n height: number;\n top_height: number;\n data: IUnit;\n id: number;\n}\n\nfunction noteForDivision(\n div: IUnit,\n opts: { axisType: ColumnAxisType; nameForDivision?: (obj: IUnit) => string },\n): UnitNote {\n const { axisType } = opts;\n\n const [height, top_height] = getUnitHeightRange(div, axisType);\n\n const nameForDivision = opts.nameForDivision ?? defaultNameFunction;\n\n return {\n height,\n top_height,\n data: div,\n id: div.unit_id,\n note: nameForDivision(div),\n };\n}\n\nconst defaultNameFunction = (div) => {\n return div.unit_name\n .replace(\"Mbr\", \"Member\")\n .replace(\"Fm\", \"Formation\")\n .replace(\"Gp\", \"Group\");\n};\n\nfunction UnitDataColumn_(props: UnitDataProps) {\n const { axisType, units } = useMacrostratColumnData();\n const scale = useCompositeScale();\n const {\n left = 0,\n noteComponent,\n shouldRenderNote = (note: ColumnDivision | IUnit, i: number) => true,\n nameForDivision,\n minimumHeight = 0,\n divisions = units,\n ...rest\n } = props;\n\n const minimumHeightFilter = useCallback(\n (d) => {\n if (minimumHeight == 0) return true;\n const dy = Math.abs(scale(d.top_height) - scale(d.height));\n return dy > minimumHeight;\n },\n [scale, minimumHeight],\n );\n\n if (divisions == null) return null;\n const notes: UnitNote[] = divisions\n .filter(shouldRenderNote)\n .map((d: IUnit) => noteForDivision(d, { axisType, nameForDivision }))\n .filter(minimumHeightFilter);\n\n return h(NotesColumn, {\n transform: `translate(${left})`,\n editable: false,\n noteComponent,\n notes,\n forceOptions: {\n nodeSpacing: 1,\n },\n ...rest,\n });\n}\n\nconst UnitDataColumn = React.memo(UnitDataColumn_);\n\nexport interface UnitNamesProps extends UnitDataProps {\n paddingLeft?: number;\n width: number;\n onClickNote?: (note: any) => void;\n}\n\nfunction UnitNameNote(props: { note: UnitNote }) {\n const { note } = props;\n return h(\"p.col-note-label\", note.note);\n}\n\nexport function UnitNamesColumn(props: UnitNamesProps) {\n const { noteComponent = UnitNameNote, ...rest } = props;\n return h(UnitDataColumn, {\n noteComponent,\n ...rest,\n });\n}\n\nexport { defaultNameFunction, noteForDivision, UnitDataColumn };\n"],"names":[],"version":3,"file":"column-views.
|
|
1
|
+
{"mappings":";;;;;;;;;;;AAmCA,SAAS,0CACP,GAAU,EACV,IAA4E;IAE5E,MAAM,YAAE,QAAQ,EAAE,GAAG;IAErB,MAAM,CAAC,QAAQ,WAAW,GAAG,CAAA,GAAA,wCAAiB,EAAE,KAAK;IAErD,MAAM,kBAAkB,KAAK,eAAe,IAAI;IAEhD,OAAO;gBACL;oBACA;QACA,MAAM;QACN,IAAI,IAAI,OAAO;QACf,MAAM,gBAAgB;IACxB;AACF;AAEA,MAAM,4CAAsB,CAAC;IAC3B,OAAO,IAAI,SAAS,CACjB,OAAO,CAAC,OAAO,UACf,OAAO,CAAC,MAAM,aACd,OAAO,CAAC,MAAM;AACnB;AAEA,SAAS,sCAAgB,KAAoB;IAC3C,MAAM,YAAE,QAAQ,SAAE,KAAK,EAAE,GAAG,CAAA,GAAA,yCAAsB;IAClD,MAAM,QAAQ,CAAA,GAAA,wCAAgB;IAC9B,MAAM,QACJ,OAAO,kBACP,aAAa,oBACb,mBAAmB,CAAC,MAA8B,IAAc,uBAChE,eAAe,iBACf,gBAAgB,cAChB,YAAY,OACZ,GAAG,MACJ,GAAG;IAEJ,MAAM,sBAAsB,CAAA,GAAA,kBAAU,EACpC,CAAC;QACC,IAAI,iBAAiB,GAAG,OAAO;QAC/B,MAAM,KAAK,KAAK,GAAG,CAAC,MAAM,EAAE,UAAU,IAAI,MAAM,EAAE,MAAM;QACxD,OAAO,KAAK;IACd,GACA;QAAC;QAAO;KAAc;IAGxB,IAAI,aAAa,MAAM,OAAO;IAC9B,MAAM,QAAoB,UACvB,MAAM,CAAC,kBACP,GAAG,CAAC,CAAC,IAAa,0CAAgB,GAAG;sBAAE;6BAAU;QAAgB,IACjE,MAAM,CAAC;IAEV,OAAO,CAAA,GAAA,sBAAA,EAAE,CAAA,GAAA,kBAAU,GAAG;QACpB,WAAW,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC/B,UAAU;uBACV;eACA;QACA,cAAc;YACZ,aAAa;QACf;QACA,GAAG,IAAI;IACT;AACF;AAEA,MAAM,4CAAiB,CAAA,GAAA,YAAI,EAAE,IAAI,CAAC;AAQlC,SAAS,mCAAa,KAAyB;IAC7C,MAAM,QAAE,IAAI,EAAE,GAAG;IACjB,OAAO,CAAA,GAAA,sBAAA,EAAE,oBAAoB,KAAK,IAAI;AACxC;AAEO,SAAS,0CAAgB,KAAqB;IACnD,MAAM,iBAAE,gBAAgB,oCAAc,GAAG,MAAM,GAAG;IAClD,OAAO,CAAA,GAAA,sBAAA,EAAE,2CAAgB;uBACvB;QACA,GAAG,IAAI;IACT;AACF","sources":["packages/column-views/src/units/names.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\nimport { useCallback } from \"react\";\nimport {\n ColumnAxisType,\n NotesColumn,\n type ColumnDivision,\n type NoteData,\n type NotesColumnProps,\n} from \"@macrostrat/column-components\";\nimport type { IUnit } from \"./types\";\nimport React from \"react\";\nimport { useCompositeScale, useMacrostratColumnData } from \"../data-provider\";\nimport {\n type CompositeColumnScale,\n getUnitHeightRange,\n} from \"../prepare-units\";\n\ninterface UnitDataProps extends NotesColumnProps {\n left?: number;\n transform?: string;\n nameForDivision?(obj: IUnit): string;\n noteComponent?: React.ComponentType<any>;\n shouldRenderNote?(div: ColumnDivision | IUnit, index: number): boolean;\n divisions?: IUnit[];\n minimumHeight?: number;\n scale?: CompositeColumnScale;\n}\n\ninterface UnitNote extends NoteData {\n height: number;\n top_height: number;\n data: IUnit;\n id: number;\n}\n\nfunction noteForDivision(\n div: IUnit,\n opts: { axisType: ColumnAxisType; nameForDivision?: (obj: IUnit) => string },\n): UnitNote {\n const { axisType } = opts;\n\n const [height, top_height] = getUnitHeightRange(div, axisType);\n\n const nameForDivision = opts.nameForDivision ?? defaultNameFunction;\n\n return {\n height,\n top_height,\n data: div,\n id: div.unit_id,\n note: nameForDivision(div),\n };\n}\n\nconst defaultNameFunction = (div) => {\n return div.unit_name\n .replace(\"Mbr\", \"Member\")\n .replace(\"Fm\", \"Formation\")\n .replace(\"Gp\", \"Group\");\n};\n\nfunction UnitDataColumn_(props: UnitDataProps) {\n const { axisType, units } = useMacrostratColumnData();\n const scale = useCompositeScale();\n const {\n left = 0,\n noteComponent,\n shouldRenderNote = (note: ColumnDivision | IUnit, i: number) => true,\n nameForDivision,\n minimumHeight = 0,\n divisions = units,\n ...rest\n } = props;\n\n const minimumHeightFilter = useCallback(\n (d) => {\n if (minimumHeight == 0) return true;\n const dy = Math.abs(scale(d.top_height) - scale(d.height));\n return dy > minimumHeight;\n },\n [scale, minimumHeight],\n );\n\n if (divisions == null) return null;\n const notes: UnitNote[] = divisions\n .filter(shouldRenderNote)\n .map((d: IUnit) => noteForDivision(d, { axisType, nameForDivision }))\n .filter(minimumHeightFilter);\n\n return h(NotesColumn, {\n transform: `translate(${left})`,\n editable: false,\n noteComponent,\n notes,\n forceOptions: {\n nodeSpacing: 1,\n },\n ...rest,\n });\n}\n\nconst UnitDataColumn = React.memo(UnitDataColumn_);\n\nexport interface UnitNamesProps extends UnitDataProps {\n paddingLeft?: number;\n width: number;\n onClickNote?: (note: any) => void;\n}\n\nfunction UnitNameNote(props: { note: UnitNote }) {\n const { note } = props;\n return h(\"p.col-note-label\", note.note);\n}\n\nexport function UnitNamesColumn(props: UnitNamesProps) {\n const { noteComponent = UnitNameNote, ...rest } = props;\n return h(UnitDataColumn, {\n noteComponent,\n ...rest,\n });\n}\n\nexport { defaultNameFunction, noteForDivision, UnitDataColumn };\n"],"names":[],"version":3,"file":"column-views.9d0d78aa.js.map"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import $bTsJU$columnviewscc733361js from "./column-views.cc733361.js";
|
|
2
2
|
import "./column-views.e93478c3.css";
|
|
3
|
-
import {UnitComponent as $4c8184c4a7317749$export$48a4cacf2b7a4441} from "./column-views.
|
|
4
|
-
import {MacrostratColumnDataProvider as $d5074f164411387e$export$7fec7bd80ff9c10e, useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.
|
|
5
|
-
import {UnitKeyboardNavigation as $61771df184788970$export$70f5ee19650fc7d1,
|
|
6
|
-
import {Identifier as $448b24baeef3b229$export$989167234458594d, ReferencesField as $448b24baeef3b229$export$895d4931dd696e25} from "./column-views.
|
|
7
|
-
import {UnitSelectionPopover as $a9bcb536274d1bf9$export$db1115efab13710d} from "./column-views.
|
|
8
|
-
import {CompositeTimescale as $7d0f52717c0de7e1$export$db2df5a73a6fbe10, SectionsColumn as $7d0f52717c0de7e1$export$38cb0ab5af8f50d7} from "./column-views.
|
|
9
|
-
import {ApproximateHeightAxis as $43794af7643cdf40$export$82731b9607850ca6, CompositeAgeAxis as $43794af7643cdf40$export$40b6b0e4520eeb34} from "./column-views.
|
|
3
|
+
import {UnitComponent as $4c8184c4a7317749$export$48a4cacf2b7a4441} from "./column-views.86b879ba.js";
|
|
4
|
+
import {MacrostratColumnDataProvider as $d5074f164411387e$export$7fec7bd80ff9c10e, useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.8168c37d.js";
|
|
5
|
+
import {UnitKeyboardNavigation as $61771df184788970$export$70f5ee19650fc7d1, useColumnRef as $61771df184788970$export$ab00b48759e36cb4, useUnitSelectionDispatch as $61771df184788970$export$77a278d5ca56e309} from "./column-views.2e517e39.js";
|
|
6
|
+
import {Identifier as $448b24baeef3b229$export$989167234458594d, ReferencesField as $448b24baeef3b229$export$895d4931dd696e25} from "./column-views.b9c4d94c.js";
|
|
7
|
+
import {UnitSelectionPopover as $a9bcb536274d1bf9$export$db1115efab13710d} from "./column-views.45acb682.js";
|
|
8
|
+
import {CompositeTimescale as $7d0f52717c0de7e1$export$db2df5a73a6fbe10, SectionsColumn as $7d0f52717c0de7e1$export$38cb0ab5af8f50d7} from "./column-views.848349c0.js";
|
|
9
|
+
import {ApproximateHeightAxis as $43794af7643cdf40$export$82731b9607850ca6, CompositeAgeAxis as $43794af7643cdf40$export$40b6b0e4520eeb34} from "./column-views.b7b0be88.js";
|
|
10
10
|
import {HybridScaleType as $1254c5929638d7f9$export$45e8e2d7a1794c23} from "./column-views.079119f4.js";
|
|
11
11
|
import {usePreparedColumnUnits as $76e92a964ee11b97$export$206a0cb85295e433} from "./column-views.82eb5026.js";
|
|
12
12
|
import {ColumnAxisType as $bTsJU$ColumnAxisType} from "@macrostrat/column-components";
|
|
13
13
|
import {hyperStyled as $bTsJU$hyperStyled} from "@macrostrat/hyper";
|
|
14
14
|
import {extractPadding as $bTsJU$extractPadding, useDarkMode as $bTsJU$useDarkMode, Box as $bTsJU$Box} from "@macrostrat/ui-components";
|
|
15
15
|
import $bTsJU$classnames from "classnames";
|
|
16
|
-
import {
|
|
16
|
+
import {useCallback as $bTsJU$useCallback} from "react";
|
|
17
17
|
import {NonIdealState as $bTsJU$NonIdealState} from "@blueprintjs/core";
|
|
18
18
|
import {DataField as $bTsJU$DataField} from "@macrostrat/data-components";
|
|
19
19
|
|
|
@@ -37,9 +37,7 @@ function $parcel$interopDefault(a) {
|
|
|
37
37
|
|
|
38
38
|
const $2118f0266dc7e955$var$h = (0, $bTsJU$hyperStyled)((0, ($parcel$interopDefault($bTsJU$columnviewscc733361js))));
|
|
39
39
|
function $2118f0266dc7e955$export$816b5d811295e6bc(props) {
|
|
40
|
-
const { showUnitPopover: showUnitPopover = false, keyboardNavigation: keyboardNavigation = false, mergeSections: mergeSections, onUnitSelected: onUnitSelected, selectedUnit: selectedUnit, children: children, units: rawUnits, t_age: t_age, b_age: b_age, t_pos: t_pos, b_pos: b_pos, unconformityHeight: unconformityHeight = 30, targetUnitHeight: targetUnitHeight = 20, pixelScale: pixelScale, minPixelScale: minPixelScale = 0.2, minSectionHeight: minSectionHeight = 50, collapseSmallUnconformities: collapseSmallUnconformities = true, allowUnitSelection: allowUnitSelection, hybridScale: hybridScale, scale: scale, axisType: axisType, ...rest } = props;
|
|
41
|
-
const ref = (0, $bTsJU$useRef)();
|
|
42
|
-
// Selected item position
|
|
40
|
+
const { showUnitPopover: showUnitPopover = false, keyboardNavigation: keyboardNavigation = false, mergeSections: mergeSections, onUnitSelected: onUnitSelected, selectedUnit: selectedUnit, children: children, units: rawUnits, t_age: t_age, b_age: b_age, t_pos: t_pos, b_pos: b_pos, unconformityHeight: unconformityHeight = 30, targetUnitHeight: targetUnitHeight = 20, pixelScale: pixelScale, minPixelScale: minPixelScale = 0.2, minSectionHeight: minSectionHeight = 50, collapseSmallUnconformities: collapseSmallUnconformities = true, allowUnitSelection: allowUnitSelection = false, hybridScale: hybridScale, scale: scale, axisType: axisType, ...rest } = props;
|
|
43
41
|
/* Make pixelScale and targetUnitHeight mutually exclusive. PixelScale implies
|
|
44
42
|
* standardization of scales in all sections */ let _targetUnitHeight = targetUnitHeight;
|
|
45
43
|
let _minSectionHeight = minSectionHeight;
|
|
@@ -79,8 +77,15 @@ function $2118f0266dc7e955$export$816b5d811295e6bc(props) {
|
|
|
79
77
|
description: "No sections found in this column.",
|
|
80
78
|
icon: "warning-sign"
|
|
81
79
|
}));
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
return $2118f0266dc7e955$var$h((0, $d5074f164411387e$export$7fec7bd80ff9c10e), {
|
|
81
|
+
units: units,
|
|
82
|
+
sections: sections,
|
|
83
|
+
totalHeight: totalHeight,
|
|
84
|
+
axisType: _axisType,
|
|
85
|
+
allowUnitSelection: showUnitPopover || allowUnitSelection,
|
|
86
|
+
onUnitSelected: onUnitSelected,
|
|
87
|
+
selectedUnit: selectedUnit
|
|
88
|
+
}, $2118f0266dc7e955$var$h($2118f0266dc7e955$var$ColumnInner, {
|
|
84
89
|
ageAxisComponent: ageAxisComponent,
|
|
85
90
|
...rest
|
|
86
91
|
}, [
|
|
@@ -89,23 +94,7 @@ function $2118f0266dc7e955$export$816b5d811295e6bc(props) {
|
|
|
89
94
|
$2118f0266dc7e955$var$h.if(keyboardNavigation)((0, $61771df184788970$export$70f5ee19650fc7d1), {
|
|
90
95
|
units: units
|
|
91
96
|
})
|
|
92
|
-
]);
|
|
93
|
-
/* By default, unit selection is disabled. However, if any related props are passed,
|
|
94
|
-
we enable it.
|
|
95
|
-
*/ let _allowUnitSelection = allowUnitSelection ?? false;
|
|
96
|
-
if (showUnitPopover || selectedUnit != null || onUnitSelected != null) _allowUnitSelection = true;
|
|
97
|
-
if (_allowUnitSelection) main = $2118f0266dc7e955$var$h((0, $61771df184788970$export$f19d75b1d4b676a4), {
|
|
98
|
-
columnRef: ref,
|
|
99
|
-
onUnitSelected: onUnitSelected,
|
|
100
|
-
selectedUnit: selectedUnit,
|
|
101
|
-
units: units
|
|
102
|
-
}, main);
|
|
103
|
-
return $2118f0266dc7e955$var$h((0, $d5074f164411387e$export$7fec7bd80ff9c10e), {
|
|
104
|
-
units: units,
|
|
105
|
-
sections: sections,
|
|
106
|
-
totalHeight: totalHeight,
|
|
107
|
-
axisType: _axisType
|
|
108
|
-
}, main);
|
|
97
|
+
]));
|
|
109
98
|
}
|
|
110
99
|
function $2118f0266dc7e955$var$ColumnInner(props) {
|
|
111
100
|
const padding = (0, $bTsJU$extractPadding)(props);
|
|
@@ -116,8 +105,9 @@ function $2118f0266dc7e955$var$ColumnInner(props) {
|
|
|
116
105
|
"--column-padding-left": `${padding.paddingLeft}px`,
|
|
117
106
|
"--column-padding-right": `${padding.paddingRight}px`
|
|
118
107
|
};
|
|
119
|
-
const { unitComponent: unitComponent = (0, $4c8184c4a7317749$export$48a4cacf2b7a4441), unconformityLabels: unconformityLabels = "minimal", showLabels: showLabels = true, width: _width = 300, columnWidth: _columnWidth = 150, showLabelColumn: _showLabelColumn = true, className: className,
|
|
108
|
+
const { unitComponent: unitComponent = (0, $4c8184c4a7317749$export$48a4cacf2b7a4441), unconformityLabels: unconformityLabels = "minimal", showLabels: showLabels = true, width: _width = 300, columnWidth: _columnWidth = 150, showLabelColumn: _showLabelColumn = true, className: className, clipUnits: clipUnits = false, children: children, showTimescale: showTimescale, timescaleLevels: timescaleLevels, maxInternalColumns: maxInternalColumns, onMouseOver: onMouseOver, ageAxisComponent: ageAxisComponent = (0, $43794af7643cdf40$export$40b6b0e4520eeb34) } = props;
|
|
120
109
|
const { axisType: axisType } = (0, $d5074f164411387e$export$f8509b7cce386c7d)();
|
|
110
|
+
const columnRef = (0, $61771df184788970$export$ab00b48759e36cb4)();
|
|
121
111
|
// Coalesce unconformity label setting to a boolean
|
|
122
112
|
let _timescaleUnconformityLabels = false;
|
|
123
113
|
let _sectionUnconformityLabels = false;
|
|
@@ -160,7 +150,7 @@ function $2118f0266dc7e955$var$useMouseEventHandlers(_onMouseOver = null) {
|
|
|
160
150
|
/** Click event handler */ // Click handler for unit selection
|
|
161
151
|
const dispatch = (0, $61771df184788970$export$77a278d5ca56e309)();
|
|
162
152
|
const onClick = (0, $bTsJU$useCallback)((evt)=>{
|
|
163
|
-
dispatch?.(null, null
|
|
153
|
+
dispatch?.(null, null);
|
|
164
154
|
}, [
|
|
165
155
|
dispatch
|
|
166
156
|
]);
|
|
@@ -225,4 +215,4 @@ function $2118f0266dc7e955$export$fcdf79c491a4504f({ data: data, showColumnID: s
|
|
|
225
215
|
|
|
226
216
|
|
|
227
217
|
export {$2118f0266dc7e955$export$816b5d811295e6bc as Column, $2118f0266dc7e955$export$2194471aa3d52446 as ColumnContainer, $2118f0266dc7e955$export$fcdf79c491a4504f as ColumnBasicInfo};
|
|
228
|
-
//# sourceMappingURL=column-views.
|
|
218
|
+
//# sourceMappingURL=column-views.af89f2b1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,MAAM,0BAAI,CAAA,GAAA,kBAAU,EAAE,CAAA,GAAA,uEAAK;AA0CpB,SAAS,0CAAO,KAAkB;IACvC,MAAM,mBACJ,kBAAkB,2BAClB,qBAAqB,sBACrB,aAAa,kBACb,cAAc,gBACd,YAAY,YACZ,QAAQ,EACR,OAAO,QAAQ,SACf,KAAK,SACL,KAAK,SACL,KAAK,SACL,KAAK,sBACL,qBAAqB,sBACrB,mBAAmB,gBACnB,UAAU,iBACV,gBAAgB,uBAChB,mBAAmB,iCACnB,8BAA8B,0BAC9B,qBAAqB,oBACrB,WAAW,SACX,KAAK,YACL,QAAQ,EACR,GAAG,MACJ,GAAG;IAEJ;+CAC6C,GAC7C,IAAI,oBAAoB;IACxB,IAAI,oBAAoB;IACxB,IAAI,iBAAiB;IACrB,IAAI,cAAc,MAAM;QACtB,oBAAoB;QACpB,oBAAoB;QACpB,iBAAiB;IACnB;IAEA,2EAA2E;IAC3E,IAAI,YAAY,YAAY,CAAA,GAAA,qBAAa,EAAE,GAAG;IAC9C,IAAI,mBAAmB,CAAA,GAAA,yCAAe;IACtC,IACE,aAAa,SAAS,CAAA,GAAA,yCAAc,EAAE,iBAAiB,IACvD,aAAa,CAAA,GAAA,qBAAa,EAAE,GAA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ColumnAxisType } from \"@macrostrat/column-components\";\nimport { hyperStyled } from \"@macrostrat/hyper\";\nimport {\n Box,\n extractPadding,\n Padding,\n useDarkMode,\n} from \"@macrostrat/ui-components\";\nimport classNames from \"classnames\";\nimport {\n HTMLAttributes,\n useCallback,\n CSSProperties,\n ComponentType,\n} from \"react\";\nimport styles from \"./column.module.sass\";\nimport { UnitComponent } from \"./units\";\nimport {\n UnitKeyboardNavigation,\n useColumnRef,\n useUnitSelectionDispatch,\n} from \"./data-provider\";\n\nimport {\n Identifier,\n ReferencesField,\n UnitSelectionPopover,\n} from \"./unit-details\";\nimport {\n MacrostratColumnDataProvider,\n useCompositeScale,\n useMacrostratColumnData,\n} from \"./data-provider\";\nimport {\n SectionSharedProps,\n CompositeTimescale,\n SectionsColumn,\n} from \"./section\";\nimport { ApproximateHeightAxis, CompositeAgeAxis } from \"./age-axis\";\nimport {\n MergeSectionsMode,\n usePreparedColumnUnits,\n HybridScaleType,\n ColumnHeightScaleOptions,\n} from \"./prepare-units\";\nimport { UnitLong } from \"@macrostrat/api-types\";\nimport { NonIdealState } from \"@blueprintjs/core\";\nimport { DataField } from \"@macrostrat/data-components\";\nimport { ScaleContinuousNumeric } from \"d3-scale\";\n\nconst h = hyperStyled(styles);\n\ninterface BaseColumnProps extends Omit<\n SectionSharedProps,\n \"unconformityLabels\"\n> {\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 unconformityLabels?: boolean | UnconformityLabelPlacement;\n onMouseOver?: (\n unit: UnitLong | null,\n height: number | null,\n evt: MouseEvent,\n ) => void;\n}\n\nexport type UnconformityLabelPlacement = \"minimal\" | \"prominent\" | \"none\";\n\nexport interface ColumnProps\n extends Padding, BaseColumnProps, ColumnHeightScaleOptions {\n // Macrostrat units\n units: UnitLong[];\n t_age?: number;\n b_age?: number;\n t_pos?: number;\n b_pos?: number;\n mergeSections?: MergeSectionsMode;\n showUnitPopover?: boolean;\n allowUnitSelection?: boolean;\n selectedUnit?: number | null;\n onUnitSelected?: (unitID: number | null, unit: any) => void;\n // Unconformity height in pixels\n unconformityHeight?: number;\n scale?: ScaleContinuousNumeric<number, 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 t_age,\n b_age,\n t_pos,\n b_pos,\n unconformityHeight = 30,\n targetUnitHeight = 20,\n pixelScale,\n minPixelScale = 0.2,\n minSectionHeight = 50,\n collapseSmallUnconformities = true,\n allowUnitSelection = false,\n hybridScale,\n scale,\n axisType,\n ...rest\n } = props;\n\n /* Make pixelScale and targetUnitHeight mutually exclusive. PixelScale implies\n * standardization of scales in all sections */\n let _targetUnitHeight = targetUnitHeight;\n let _minSectionHeight = minSectionHeight;\n let _minPixelScale = minPixelScale;\n if (pixelScale != null) {\n _targetUnitHeight = null;\n _minSectionHeight = 0;\n _minPixelScale = pixelScale;\n }\n\n // Handle special cases for hybrid scales (WIP, we need to regularize this)\n let _axisType = axisType ?? ColumnAxisType.AGE;\n let ageAxisComponent = CompositeAgeAxis;\n if (\n hybridScale?.type === HybridScaleType.ApproximateHeight &&\n _axisType != ColumnAxisType.AGE\n ) {\n // Use approximate height axis for non-age columns if a non-age axis type is requested\n ageAxisComponent = ApproximateHeightAxis;\n _axisType = ColumnAxisType.AGE;\n }\n\n const { sections, units, totalHeight } = usePreparedColumnUnits(rawUnits, {\n axisType: _axisType,\n t_age,\n b_age,\n t_pos,\n b_pos,\n mergeSections,\n targetUnitHeight: _targetUnitHeight,\n unconformityHeight,\n pixelScale,\n minPixelScale: _minPixelScale,\n minSectionHeight: _minSectionHeight,\n collapseSmallUnconformities,\n // TODO: consider unifying scale and hybridScale options\n scale,\n hybridScale,\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 {\n units,\n sections,\n totalHeight,\n axisType: _axisType,\n allowUnitSelection: showUnitPopover || allowUnitSelection,\n onUnitSelected,\n selectedUnit,\n },\n h(ColumnInner, { ageAxisComponent, ...rest }, [\n children,\n h.if(showUnitPopover)(UnitSelectionPopover),\n h.if(keyboardNavigation)(UnitKeyboardNavigation, { units }),\n ]),\n );\n}\n\ninterface ColumnInnerProps extends BaseColumnProps {\n ageAxisComponent?: ComponentType;\n}\n\nfunction ColumnInner(props: ColumnInnerProps) {\n const padding = extractPadding(props);\n\n // TODO: integrate padding vars more closely with the rest of the spacing (right now padding is a bit ad-hoc)\n const paddingVars: any = {\n \"--column-padding-top\": `${padding.paddingTop}px`,\n \"--column-padding-bottom\": `${padding.paddingBottom}px`,\n \"--column-padding-left\": `${padding.paddingLeft}px`,\n \"--column-padding-right\": `${padding.paddingRight}px`,\n };\n\n const {\n unitComponent = UnitComponent,\n unconformityLabels = \"minimal\",\n showLabels = true,\n width: _width = 300,\n columnWidth: _columnWidth = 150,\n showLabelColumn: _showLabelColumn = true,\n className,\n clipUnits = false,\n children,\n showTimescale,\n timescaleLevels,\n maxInternalColumns,\n onMouseOver,\n ageAxisComponent = CompositeAgeAxis,\n } = props;\n\n const { axisType } = useMacrostratColumnData();\n\n const columnRef = useColumnRef();\n\n // Coalesce unconformity label setting to a boolean\n let _timescaleUnconformityLabels = false;\n let _sectionUnconformityLabels = false;\n if (unconformityLabels === true || unconformityLabels === \"prominent\") {\n _sectionUnconformityLabels = true;\n } else if (unconformityLabels === \"minimal\") {\n _timescaleUnconformityLabels = true;\n }\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 ?? true;\n if (timescaleLevels != null) {\n _showTimescale = true;\n }\n _showTimescale = axisType == ColumnAxisType.AGE && _showTimescale;\n\n return h(\n ColumnContainer,\n {\n ...useMouseEventHandlers(onMouseOver),\n style: paddingVars,\n className,\n },\n h(\"div.column\", { ref: columnRef }, [\n h(ageAxisComponent),\n h.if(_showTimescale)(CompositeTimescale, {\n levels: timescaleLevels,\n unconformityLabels: _timescaleUnconformityLabels,\n }),\n h(SectionsColumn, {\n unitComponent,\n showLabels,\n width,\n columnWidth,\n showLabelColumn,\n clipUnits,\n unconformityLabels: _sectionUnconformityLabels,\n maxInternalColumns,\n }),\n children,\n ]),\n );\n}\n\ntype ColumnMouseOverHandler = (\n unit: UnitLong | null,\n height: number | null,\n evt: MouseEvent,\n) => void;\n\nfunction useMouseEventHandlers(\n _onMouseOver: ColumnMouseOverHandler | null = null,\n) {\n /** Click event handler */\n\n // Click handler for unit selection\n const dispatch = useUnitSelectionDispatch();\n const onClick = useCallback(\n (evt) => {\n dispatch?.(null, null);\n },\n [dispatch],\n );\n\n /** Hover event handlers */\n const scale = useCompositeScale();\n\n const onMouseOver = useCallback(\n (evt) => {\n const height = scale.invert(\n evt.clientY - evt.currentTarget.getBoundingClientRect().top,\n );\n _onMouseOver?.(null, height, evt);\n },\n [scale, _onMouseOver],\n );\n\n const onMouseOut = useCallback(() => {\n _onMouseOver?.(null, null, null);\n }, [_onMouseOver]);\n\n if (_onMouseOver == null) {\n return {\n onClick,\n onMouseOver: undefined,\n onMouseMove: undefined,\n onMouseOut: undefined,\n };\n }\n\n return { onMouseOver, onMouseMove: onMouseOver, onMouseOut, onClick };\n}\n\nexport interface ColumnContainerProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n style?: CSSProperties;\n}\n\nexport function ColumnContainer(props: ColumnContainerProps) {\n const { className, ...rest } = props;\n const darkMode = useDarkMode();\n\n return h(Box, {\n className: classNames(\n className,\n {\n \"dark-mode\": darkMode?.isEnabled ?? false,\n },\n \"column-container\",\n ),\n ...rest,\n });\n}\n\nexport function ColumnBasicInfo({\n data,\n showColumnID = true,\n showReferences = true,\n}) {\n if (data == null) return null;\n return h(\"div.column-info\", [\n h(\"div.column-title-row\", [\n h(\"h2\", data.col_name),\n h.if(showColumnID)(\"h4\", h(Identifier, { id: data.col_id })),\n ]),\n h(DataField, { row: true, label: \"Group\", value: data.col_group }),\n h.if(showReferences)(ReferencesField, {\n refs: data.refs,\n inline: false,\n row: false,\n className: \"column-refs\",\n }),\n ]);\n}\n"],"names":[],"version":3,"file":"column-views.af89f2b1.js.map"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {PBDBFossilsColumn as $b9286605a04210d4$export$554267114407ef68, FossilDataType as $a3ff7da576c02df0$export$a990c76b38782f57, useFossilData as $a3ff7da576c02df0$export$e6af757fa9780077, PBDBOccurrencesMatrix as $d419340b86dbd2ea$export$652730986cccff7a} from "./column-views.
|
|
2
|
-
import {DetritalColumn as $715dd5fedd79146a$export$f176396e104db8d5, DetritalGroup as $715dd5fedd79146a$export$1b3047373cd1c8c7} from "./column-views.
|
|
3
|
-
import {IsotopesDataset as $d71d096cfe00860f$export$c69bd0285aa5d775, IsotopesColumn as $d71d096cfe00860f$export$5d8aa8022c284748, MeasurementDataContext as $5dbb619f2c7bef60$export$c644ef985ce7a4c4, MeasurementDataProvider as $5dbb619f2c7bef60$export$5f01d5b342a89841, useMeasurementData as $5dbb619f2c7bef60$export$8a0335fd9ff72150} from "./column-views.
|
|
4
|
-
import {standardizeMeasurementHeight as $50d219504625a431$export$9d101e1fcb2166a6, mergeHeightRanges as $50d219504625a431$export$8f2afa8ddee7317e, BaseMeasurementsColumn as $50d219504625a431$export$ce5c4f2fdf4e644d, TruncatedList as $50d219504625a431$export$653e47a7a0da0f0d, groupNotesByPixelDistance as $50d219504625a431$export$4e649f790614b299, SGPMeasurementsColumn as $c8e156b0b9c785ec$export$c49cf57576706bab} from "./column-views.
|
|
1
|
+
import {PBDBFossilsColumn as $b9286605a04210d4$export$554267114407ef68, FossilDataType as $a3ff7da576c02df0$export$a990c76b38782f57, useFossilData as $a3ff7da576c02df0$export$e6af757fa9780077, PBDBOccurrencesMatrix as $d419340b86dbd2ea$export$652730986cccff7a} from "./column-views.25713aad.js";
|
|
2
|
+
import {DetritalColumn as $715dd5fedd79146a$export$f176396e104db8d5, DetritalGroup as $715dd5fedd79146a$export$1b3047373cd1c8c7} from "./column-views.631f55d4.js";
|
|
3
|
+
import {IsotopesDataset as $d71d096cfe00860f$export$c69bd0285aa5d775, IsotopesColumn as $d71d096cfe00860f$export$5d8aa8022c284748, MeasurementDataContext as $5dbb619f2c7bef60$export$c644ef985ce7a4c4, MeasurementDataProvider as $5dbb619f2c7bef60$export$5f01d5b342a89841, useMeasurementData as $5dbb619f2c7bef60$export$8a0335fd9ff72150} from "./column-views.3c9f5ba9.js";
|
|
4
|
+
import {standardizeMeasurementHeight as $50d219504625a431$export$9d101e1fcb2166a6, mergeHeightRanges as $50d219504625a431$export$8f2afa8ddee7317e, BaseMeasurementsColumn as $50d219504625a431$export$ce5c4f2fdf4e644d, TruncatedList as $50d219504625a431$export$653e47a7a0da0f0d, groupNotesByPixelDistance as $50d219504625a431$export$4e649f790614b299, SGPMeasurementsColumn as $c8e156b0b9c785ec$export$c49cf57576706bab} from "./column-views.4099a246.js";
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -10,4 +10,4 @@ import {standardizeMeasurementHeight as $50d219504625a431$export$9d101e1fcb2166a
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
export {$b9286605a04210d4$export$554267114407ef68 as PBDBFossilsColumn, $a3ff7da576c02df0$export$a990c76b38782f57 as FossilDataType, $a3ff7da576c02df0$export$e6af757fa9780077 as useFossilData, $d419340b86dbd2ea$export$652730986cccff7a as PBDBOccurrencesMatrix, $715dd5fedd79146a$export$f176396e104db8d5 as DetritalColumn, $715dd5fedd79146a$export$1b3047373cd1c8c7 as DetritalGroup, $d71d096cfe00860f$export$c69bd0285aa5d775 as IsotopesDataset, $d71d096cfe00860f$export$5d8aa8022c284748 as IsotopesColumn, $5dbb619f2c7bef60$export$c644ef985ce7a4c4 as MeasurementDataContext, $5dbb619f2c7bef60$export$5f01d5b342a89841 as MeasurementDataProvider, $5dbb619f2c7bef60$export$8a0335fd9ff72150 as useMeasurementData, $50d219504625a431$export$9d101e1fcb2166a6 as standardizeMeasurementHeight, $50d219504625a431$export$8f2afa8ddee7317e as mergeHeightRanges, $50d219504625a431$export$ce5c4f2fdf4e644d as BaseMeasurementsColumn, $50d219504625a431$export$653e47a7a0da0f0d as TruncatedList, $50d219504625a431$export$4e649f790614b299 as groupNotesByPixelDistance, $c8e156b0b9c785ec$export$c49cf57576706bab as SGPMeasurementsColumn};
|
|
13
|
-
//# sourceMappingURL=column-views.
|
|
13
|
+
//# sourceMappingURL=column-views.b3398cca.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"","sources":["packages/column-views/src/facets/index.ts"],"sourcesContent":["export * from \"./fossils\";\nexport * from \"./detrital-zircon\";\nexport * from \"./carbon-isotopes\";\nexport * from \"./measurements\";\n"],"names":[],"version":3,"file":"column-views.
|
|
1
|
+
{"mappings":"","sources":["packages/column-views/src/facets/index.ts"],"sourcesContent":["export * from \"./fossils\";\nexport * from \"./detrital-zircon\";\nexport * from \"./carbon-isotopes\";\nexport * from \"./measurements\";\n"],"names":[],"version":3,"file":"column-views.b3398cca.js.map"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./column-views.321af3ae.css";
|
|
2
2
|
import $lfxOo$columnviews22ec902bjs from "./column-views.22ec902b.js";
|
|
3
|
-
import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.
|
|
4
|
-
import {AgeLabel as $448b24baeef3b229$export$37ebfd237811b1eb} from "./column-views.
|
|
3
|
+
import {useCompositeScale as $d5074f164411387e$export$a7fc62995ec4f76, useMacrostratColumnData as $d5074f164411387e$export$f8509b7cce386c7d} from "./column-views.8168c37d.js";
|
|
4
|
+
import {AgeLabel as $448b24baeef3b229$export$37ebfd237811b1eb} from "./column-views.b9c4d94c.js";
|
|
5
5
|
import $lfxOo$macrostrathyper from "@macrostrat/hyper";
|
|
6
6
|
import {ColumnContext as $lfxOo$ColumnContext, ColumnAxis as $lfxOo$ColumnAxis, ColumnAxisType as $lfxOo$ColumnAxisType, SVG as $lfxOo$SVG, AgeAxis as $lfxOo$AgeAxis} from "@macrostrat/column-components";
|
|
7
7
|
import {useContext as $lfxOo$useContext} from "react";
|
|
@@ -138,4 +138,4 @@ function $43794af7643cdf40$export$20d84abfcfa68dfa({ age: age }) {
|
|
|
138
138
|
|
|
139
139
|
|
|
140
140
|
export {$43794af7643cdf40$export$64204d5cbb3e8227 as VerticalAxisLabel, $43794af7643cdf40$export$40b6b0e4520eeb34 as CompositeAgeAxis, $43794af7643cdf40$export$ac30ca3cf5df959d as CompositeAgeAxisCore, $43794af7643cdf40$export$82731b9607850ca6 as ApproximateHeightAxis, $43794af7643cdf40$export$20d84abfcfa68dfa as AgeCursor};
|
|
141
|
-
//# sourceMappingURL=column-views.
|
|
141
|
+
//# sourceMappingURL=column-views.b7b0be88.js.map
|