@macrostrat/column-views 3.11.0 → 3.12.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 +169 -0
- package/dist/age-model/data.cjs +57 -0
- package/dist/age-model/data.cjs.map +1 -0
- package/dist/age-model/data.d.ts +29 -0
- package/dist/age-model/data.js +57 -0
- package/dist/age-model/data.js.map +1 -0
- package/dist/age-model/details.cjs +261 -0
- package/dist/age-model/details.cjs.map +1 -0
- package/dist/age-model/details.d.ts +39 -0
- package/dist/age-model/details.js +258 -0
- package/dist/age-model/details.js.map +1 -0
- package/dist/age-model/details.module.sass.cjs +42 -0
- package/dist/age-model/details.module.sass.cjs.map +1 -0
- package/dist/age-model/details.module.sass.js +40 -0
- package/dist/age-model/details.module.sass.js.map +1 -0
- package/dist/age-model/index.d.ts +5 -0
- package/dist/age-model/legacy.cjs +28 -0
- package/dist/age-model/legacy.cjs.map +1 -0
- package/dist/age-model/legacy.d.ts +6 -0
- package/dist/age-model/legacy.js +26 -0
- package/dist/age-model/legacy.js.map +1 -0
- package/dist/age-model/surfaces.cjs +355 -0
- package/dist/age-model/surfaces.cjs.map +1 -0
- package/dist/age-model/surfaces.d.ts +68 -0
- package/dist/age-model/surfaces.js +352 -0
- package/dist/age-model/surfaces.js.map +1 -0
- package/dist/age-model/surfaces.module.sass.cjs +45 -0
- package/dist/age-model/surfaces.module.sass.cjs.map +1 -0
- package/dist/age-model/surfaces.module.sass.js +43 -0
- package/dist/age-model/surfaces.module.sass.js.map +1 -0
- package/dist/age-model/types.cjs +229 -0
- package/dist/age-model/types.cjs.map +1 -0
- package/dist/age-model/types.d.ts +112 -0
- package/dist/age-model/types.js +229 -0
- package/dist/age-model/types.js.map +1 -0
- package/dist/column-views.css +389 -57
- package/dist/column.cjs +20 -13
- package/dist/column.cjs.map +1 -1
- package/dist/column.d.ts +21 -6
- package/dist/column.js +21 -14
- package/dist/column.js.map +1 -1
- package/dist/column.module.sass.cjs +19 -15
- package/dist/column.module.sass.cjs.map +1 -1
- package/dist/column.module.sass.js +19 -15
- package/dist/column.module.sass.js.map +1 -1
- package/dist/data-provider/store.cjs +34 -1
- package/dist/data-provider/store.cjs.map +1 -1
- package/dist/data-provider/store.d.ts +5 -0
- package/dist/data-provider/store.js +35 -2
- package/dist/data-provider/store.js.map +1 -1
- package/dist/index.cjs +54 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +54 -3
- package/dist/index.js.map +1 -1
- package/dist/notes.cjs +11 -2
- package/dist/notes.cjs.map +1 -1
- package/dist/notes.d.ts +11 -1
- package/dist/notes.js +11 -2
- package/dist/notes.js.map +1 -1
- package/dist/prepare-units/composite-scale.cjs +18 -16
- package/dist/prepare-units/composite-scale.cjs.map +1 -1
- package/dist/prepare-units/composite-scale.js +18 -16
- package/dist/prepare-units/composite-scale.js.map +1 -1
- package/dist/prepare-units/density.cjs +83 -0
- package/dist/prepare-units/density.cjs.map +1 -0
- package/dist/prepare-units/density.d.ts +92 -0
- package/dist/prepare-units/density.js +83 -0
- package/dist/prepare-units/density.js.map +1 -0
- package/dist/prepare-units/index.cjs +15 -7
- package/dist/prepare-units/index.cjs.map +1 -1
- package/dist/prepare-units/index.d.ts +1 -0
- package/dist/prepare-units/index.js +15 -7
- package/dist/prepare-units/index.js.map +1 -1
- package/dist/prepare-units/types.cjs.map +1 -1
- package/dist/prepare-units/types.d.ts +34 -13
- package/dist/prepare-units/types.js.map +1 -1
- package/dist/section.cjs +108 -24
- package/dist/section.cjs.map +1 -1
- package/dist/section.d.ts +66 -6
- package/dist/section.js +109 -25
- package/dist/section.js.map +1 -1
- package/dist/timescale-zoom.cjs +191 -0
- package/dist/timescale-zoom.cjs.map +1 -0
- package/dist/timescale-zoom.d.ts +74 -0
- package/dist/timescale-zoom.js +191 -0
- package/dist/timescale-zoom.js.map +1 -0
- package/dist/unit-details/age-range.cjs +1 -0
- package/dist/unit-details/age-range.cjs.map +1 -1
- package/dist/unit-details/age-range.d.ts +5 -1
- package/dist/unit-details/age-range.js +1 -0
- package/dist/unit-details/age-range.js.map +1 -1
- package/dist/units/composite.cjs +4 -1
- package/dist/units/composite.cjs.map +1 -1
- package/dist/units/composite.d.ts +2 -0
- package/dist/units/composite.js +4 -1
- package/dist/units/composite.js.map +1 -1
- package/package.json +7 -7
- package/src/age-model/data.ts +98 -0
- package/src/age-model/details.module.sass +108 -0
- package/src/age-model/details.ts +333 -0
- package/src/age-model/index.ts +5 -0
- package/src/age-model/legacy.ts +30 -0
- package/src/age-model/surfaces.module.sass +168 -0
- package/src/age-model/surfaces.ts +568 -0
- package/src/age-model/types.ts +392 -0
- package/src/column.module.sass +59 -8
- package/src/column.ts +49 -23
- package/src/data-provider/store.ts +50 -1
- package/src/index.ts +5 -1
- package/src/notes.ts +20 -2
- package/src/prepare-units/composite-scale.ts +34 -31
- package/src/prepare-units/density.ts +197 -0
- package/src/prepare-units/index.ts +25 -6
- package/src/prepare-units/types.ts +34 -13
- package/src/section.ts +219 -33
- package/src/timescale-zoom.ts +341 -0
- package/src/unit-details/age-range.ts +3 -3
- package/src/units/composite.ts +11 -0
- package/dist/age-model-overlay.cjs +0 -50
- package/dist/age-model-overlay.cjs.map +0 -1
- package/dist/age-model-overlay.d.ts +0 -24
- package/dist/age-model-overlay.js +0 -48
- package/dist/age-model-overlay.js.map +0 -1
- package/dist/age-model-overlay.module.sass.cjs +0 -12
- package/dist/age-model-overlay.module.sass.cjs.map +0 -1
- package/dist/age-model-overlay.module.sass.js +0 -11
- package/dist/age-model-overlay.module.sass.js.map +0 -1
- package/src/age-model-overlay.module.sass +0 -11
- package/src/age-model-overlay.ts +0 -96
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sources":["../../src/data-provider/store.ts"],"sourcesContent":["import {\n createContext,\n ReactNode,\n RefObject,\n useContext,\n useMemo,\n} from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport {\n CompositeColumnScale,\n createCompositeScale,\n} from \"../prepare-units/composite-scale\";\nimport { ColumnAxisType, ColumnProvider } from \"@macrostrat/column-components\";\nimport type { ExtUnit, PackageLayoutData } from \"../prepare-units\";\nimport {\n allowUnitSelectionAtom,\n selectedUnitIDAtom,\n UnitSelectionCallbacks,\n UnitSelectionCallbackManager,\n selectedUnitElementAtom,\n} from \"./unit-selection\";\nimport type { BaseUnit } from \"@macrostrat/api-types\";\nimport {\n type AtomMap,\n createScopedStore,\n StateIsolation,\n} from \"@macrostrat/scoped-store\";\nimport { atom } from \"jotai\";\nimport { useEffect } from \"react\";\n\nexport const scope: StateIsolation = createScopedStore();\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\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 // Check if we're already in a columnStateProvider, and render a no-op if so\n const existingUnits = scope.useAtomValueIfExists(columnUnitsAtom);\n if (existingUnits != null) {\n if (allowUnitSelection || onUnitSelected || selectedUnit != null) {\n console.warn(\n \"MacrostratColumnStateProvider: unit selection props are ignored because a provider already exists in the tree\",\n );\n }\n return children;\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 scope.Provider,\n {\n atoms: atomMap,\n keepUpdated: true,\n },\n [selectionHandlers, children],\n );\n}\n\n/** Interface for imperative handlers that can\n * be invoked outside of the column's react context\n */\nexport interface ColumnRef {\n scrollSelectedUnitIntoView(): void;\n}\n\nexport interface MacrostratColumnDataContext<T extends BaseUnit> {\n units: T[];\n sections: PackageLayoutData[];\n totalHeight?: number;\n axisType?: ColumnAxisType;\n allowUnitSelection?: boolean;\n /** True while the age window is animating; propagated to each section's\n * `ColumnProvider` so per-frame label/pattern work can be skipped. */\n isTransitioning?: boolean;\n /** Hide unit labels while transitioning (perf escape hatch; default false). */\n hideLabelsWhileTransitioning?: boolean;\n}\n\nexport interface ColumnDataProviderProps<T extends BaseUnit>\n extends MacrostratColumnDataContext<T>, ColumnStateProviderProps<T> {\n children: ReactNode;\n ref: RefObject<ColumnRef>;\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 isTransitioning,\n hideLabelsWhileTransitioning,\n ref,\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 isTransitioning,\n hideLabelsWhileTransitioning,\n };\n }, [\n units,\n sections,\n totalHeight,\n axisType,\n isTransitioning,\n hideLabelsWhileTransitioning,\n ]);\n\n return h(\n MacrostratColumnStateProvider,\n {\n units,\n allowUnitSelection,\n onUnitSelected,\n selectedUnit,\n ref,\n },\n [\n h(ColumnRefManager, { ref }),\n h(MacrostratColumnDataContext.Provider, { value }, children),\n ],\n );\n}\n\nfunction ColumnRefManager({ ref }: { ref?: RefObject<ColumnRef> }) {\n const selectedUnitElement = scope.useAtomValue(selectedUnitElementAtom);\n useEffect(() => {\n if (ref == null) return;\n ref.current = {\n scrollSelectedUnitIntoView(opts?: ScrollIntoViewOptions) {\n selectedUnitElement?.scrollIntoView(\n opts ?? {\n behavior: \"smooth\",\n block: \"center\",\n inline: \"nearest\",\n },\n );\n },\n };\n }, [ref, selectedUnitElement]);\n\n return null;\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\nexport function MacrostratColumnProvider(props) {\n /** A column provider specialized the Macrostrat API. Maps more\n * generic concepts to Macrostrat-specific ones.\n */\n\n const { axisType, isTransitioning, hideLabelsWhileTransitioning } =\n useMacrostratColumnData();\n const { units, domain, pixelScale, scale, children } = props;\n return h(\n ColumnProvider,\n {\n axisType,\n divisions: units,\n range: domain,\n pixelsPerMeter: pixelScale,\n scale,\n isTransitioning,\n hideLabelsWhileTransitioning,\n },\n children,\n );\n}\n\n/** This is now a legacy provider */\nexport function LithologiesProvider({ children }) {\n useEffect(() => {\n console.warn(\n \"LithologiesProvider is deprecated. Replace with MacrostratDataProvider\",\n );\n }, []);\n return children;\n}\n"],"names":[],"mappings":";;;;;;;AA8BO,MAAM,QAAwB,kBAAA;AAE9B,MAAM,kBAAkB,KAAA;AAExB,MAAM,qBAAqB,KAAmC,CAAC,QAAQ;AAC5E,QAAM,QAAQ,IAAI,eAAe;AACjC,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,8BAAc,IAAA;AACpB,QAAM,QAAQ,CAAC,SAAS;AACtB,YAAQ,IAAI,KAAK,SAAS,IAAI;AAAA,EAChC,CAAC;AACD,SAAO;AACT,CAAC;AAWM,SAAS,8BAAkD;AAAA,EAChE;AAAA,EACA;AAAA,EACA,qBAAqB;AAAA,EACrB;AAAA,EACA;AACF,GAAgC;AAS9B,QAAM,kBAAkB,QAAQ,MAAM;AACpC,QAAI,oBAAoB;AACtB,aAAO;AAAA,IACT;AACA,WAAO,gBAAgB,QAAQ,kBAAkB;AAAA,EACnD,GAAG,CAAA,CAAE;AAGL,QAAM,gBAAgB,MAAM,qBAAqB,eAAe;AAChE,MAAI,iBAAiB,MAAM;AACzB,QAAI,sBAAsB,kBAAkB,gBAAgB,MAAM;AAChE,cAAQ;AAAA,QACN;AAAA,MAAA;AAAA,IAEJ;AACA,WAAO;AAAA,EACT;AAEA,QAAM,UAAmB;AAAA,IACvB,CAAC,iBAAiB,KAAK;AAAA,IACvB,CAAC,wBAAwB,eAAe;AAAA,IACxC,CAAC,oBAAoB,YAAY;AAAA,EAAA;AAGnC,MAAI,oBAA+B;AACnC,MAAI,iBAAiB;AACnB,wBAAoB,EAAE,8BAA8B,EAAE,eAAA,CAAgB;AAAA,EACxE;AAEA,SAAO;AAAA,IACL,MAAM;AA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H;AAEO,SAAS,0BAA0B;AACxC,QAAM,MAAM,WAAW,2BAA2B;AAClD,MAAI,CAAC,KAAK;AACR,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AACA,SAAO;AACT;AAEO,SAAS,qBAAqB;AACnC,SAAO,MAAM,aAAa,eAAe;AAC3C;AAEO,SAAS,oBAAiD;AAC/D,MAAI;AACF,WAAO,MAAM,aAAa,kBAAkB;AAAA,EAC9C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,oBAA0C;AACxD,QAAM,MAAM,wBAAA;AACZ,SAAO;AAAA,IACL,MAAM,qBAAqB,IAAI,UAAU,IAAI;AAAA,IAC7C,CAAC,IAAI,QAAQ;AAAA,EAAA;AAEjB;AAEO,SAAS,yBAAyB,OAAO;AAK9C,QAAM,EAAE,UAAU,iBAAiB,6BAAA,IACjC,wBAAA;AACF,QAAM,EAAE,OAAO,QAAQ,YAAY,OAAO,aAAa;AACvD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE;AAAA,MACA,WAAW;AAAA,MACX,OAAO;AAAA,MACP,gBAAgB;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,IAEF;AAAA,EAAA;AAEJ;AAGO,SAAS,oBAAoB,EAAE,YAAY;AAChD,YAAU,MAAM;AACd,YAAQ;AAAA,MACN;AAAA,IAAA;AAAA,EAEJ,GAAG,CAAA,CAAE;AACL,SAAO;AACT;"}
|
|
1
|
+
{"version":3,"file":"store.js","sources":["../../src/data-provider/store.ts"],"sourcesContent":["import {\n createContext,\n ReactNode,\n RefObject,\n useCallback,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport h from \"@macrostrat/hyper\";\nimport {\n CompositeColumnScale,\n createCompositeScale,\n} from \"../prepare-units/composite-scale\";\nimport { ColumnAxisType, ColumnProvider } from \"@macrostrat/column-components\";\nimport type { ExtUnit, PackageLayoutData } from \"../prepare-units\";\nimport {\n allowUnitSelectionAtom,\n selectedUnitIDAtom,\n UnitSelectionCallbacks,\n UnitSelectionCallbackManager,\n selectedUnitElementAtom,\n} from \"./unit-selection\";\nimport type { BaseUnit } from \"@macrostrat/api-types\";\nimport {\n type AtomMap,\n createScopedStore,\n StateIsolation,\n} from \"@macrostrat/scoped-store\";\nimport { atom } from \"jotai\";\nimport { useEffect } from \"react\";\n\nexport const scope: StateIsolation = createScopedStore();\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\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 // Check if we're already in a columnStateProvider, and render a no-op if so\n const existingUnits = scope.useAtomValueIfExists(columnUnitsAtom);\n if (existingUnits != null) {\n if (allowUnitSelection || onUnitSelected || selectedUnit != null) {\n console.warn(\n \"MacrostratColumnStateProvider: unit selection props are ignored because a provider already exists in the tree\",\n );\n }\n return children;\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 scope.Provider,\n {\n atoms: atomMap,\n keepUpdated: true,\n },\n [selectionHandlers, children],\n );\n}\n\n/** Interface for imperative handlers that can\n * be invoked outside of the column's react context\n */\nexport interface ColumnRef {\n scrollSelectedUnitIntoView(): void;\n}\n\nexport interface MacrostratColumnDataContext<T extends BaseUnit> {\n units: T[];\n sections: PackageLayoutData[];\n totalHeight?: number;\n axisType?: ColumnAxisType;\n allowUnitSelection?: boolean;\n /** True while the age window is animating; propagated to each section's\n * `ColumnProvider` so per-frame label/pattern work can be skipped. */\n isTransitioning?: boolean;\n /** Hide unit labels while transitioning (perf escape hatch; default false). */\n hideLabelsWhileTransitioning?: boolean;\n}\n\nexport interface ColumnDataProviderProps<T extends BaseUnit>\n extends MacrostratColumnDataContext<T>, ColumnStateProviderProps<T> {\n children: ReactNode;\n ref: RefObject<ColumnRef>;\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 isTransitioning,\n hideLabelsWhileTransitioning,\n ref,\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 isTransitioning,\n hideLabelsWhileTransitioning,\n };\n }, [\n units,\n sections,\n totalHeight,\n axisType,\n isTransitioning,\n hideLabelsWhileTransitioning,\n ]);\n\n return h(\n MacrostratColumnStateProvider,\n {\n units,\n allowUnitSelection,\n onUnitSelected,\n selectedUnit,\n ref,\n },\n [\n h(ColumnRefManager, { ref }),\n h(\n MacrostratColumnDataContext.Provider,\n { value },\n h(ColumnLayoutOverridesProvider, null, children),\n ),\n ],\n );\n}\n\n/* Layout overrides requested by a column's children. A layer that draws its\n * own labels beside the units (the surfaces view) claims the label column, so\n * the unit labels give way: it is one set of labels or the other. */\n\ninterface ColumnLayoutOverrides {\n /** How many children currently claim the label column */\n labelColumnClaims: number;\n claimLabelColumn(): () => void;\n}\n\nconst ColumnLayoutOverridesContext = createContext<ColumnLayoutOverrides>({\n labelColumnClaims: 0,\n claimLabelColumn: () => () => {},\n});\n\nfunction ColumnLayoutOverridesProvider({ children }: { children: ReactNode }) {\n const [labelColumnClaims, setClaims] = useState(0);\n const claimLabelColumn = useCallback(() => {\n setClaims((n) => n + 1);\n return () => setClaims((n) => Math.max(n - 1, 0));\n }, []);\n const value = useMemo(\n () => ({ labelColumnClaims, claimLabelColumn }),\n [labelColumnClaims, claimLabelColumn],\n );\n return h(ColumnLayoutOverridesContext.Provider, { value }, children);\n}\n\n/** Claim the column's label column for this component while it is mounted:\n * the unit labels are hidden in favor of whatever the caller draws there. */\nexport function useClaimLabelColumn(active: boolean = true) {\n const { claimLabelColumn } = useContext(ColumnLayoutOverridesContext);\n useEffect(() => {\n if (!active) return;\n return claimLabelColumn();\n }, [active, claimLabelColumn]);\n}\n\n/** Whether a child of the column has claimed the label column */\nexport function useLabelColumnClaimed(): boolean {\n return useContext(ColumnLayoutOverridesContext).labelColumnClaims > 0;\n}\n\nfunction ColumnRefManager({ ref }: { ref?: RefObject<ColumnRef> }) {\n const selectedUnitElement = scope.useAtomValue(selectedUnitElementAtom);\n useEffect(() => {\n if (ref == null) return;\n ref.current = {\n scrollSelectedUnitIntoView(opts?: ScrollIntoViewOptions) {\n selectedUnitElement?.scrollIntoView(\n opts ?? {\n behavior: \"smooth\",\n block: \"center\",\n inline: \"nearest\",\n },\n );\n },\n };\n }, [ref, selectedUnitElement]);\n\n return null;\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\nexport function MacrostratColumnProvider(props) {\n /** A column provider specialized the Macrostrat API. Maps more\n * generic concepts to Macrostrat-specific ones.\n */\n\n const { axisType, isTransitioning, hideLabelsWhileTransitioning } =\n useMacrostratColumnData();\n const { units, domain, pixelScale, scale, children } = props;\n return h(\n ColumnProvider,\n {\n axisType,\n divisions: units,\n range: domain,\n pixelsPerMeter: pixelScale,\n scale,\n isTransitioning,\n hideLabelsWhileTransitioning,\n },\n children,\n );\n}\n\n/** This is now a legacy provider */\nexport function LithologiesProvider({ children }) {\n useEffect(() => {\n console.warn(\n \"LithologiesProvider is deprecated. Replace with MacrostratDataProvider\",\n );\n }, []);\n return children;\n}\n"],"names":[],"mappings":";;;;;;;AAgCO,MAAM,QAAwB,kBAAA;AAE9B,MAAM,kBAAkB,KAAA;AAExB,MAAM,qBAAqB,KAAmC,CAAC,QAAQ;AAC5E,QAAM,QAAQ,IAAI,eAAe;AACjC,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,8BAAc,IAAA;AACpB,QAAM,QAAQ,CAAC,SAAS;AACtB,YAAQ,IAAI,KAAK,SAAS,IAAI;AAAA,EAChC,CAAC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ED
|
@@ -4,20 +4,26 @@ const index = require("./units/index.cjs");
|
|
|
4
4
|
const ageAxis = require("./age-axis.cjs");
|
|
5
5
|
const index$3 = require("./prepare-units/index.cjs");
|
|
6
6
|
const animatedAgeWindow = require("./animated-age-window.cjs");
|
|
7
|
+
const timescaleZoom = require("./timescale-zoom.cjs");
|
|
7
8
|
const column = require("./column.cjs");
|
|
8
|
-
const
|
|
9
|
+
const section = require("./section.cjs");
|
|
9
10
|
const notes = require("./notes.cjs");
|
|
10
11
|
const mapViews = require("@macrostrat/map-views");
|
|
12
|
+
const data = require("./age-model/data.cjs");
|
|
11
13
|
const ageRange = require("./unit-details/age-range.cjs");
|
|
12
14
|
const ageWindowTag = require("./unit-details/age-window-tag.cjs");
|
|
13
15
|
const composite = require("./units/composite.cjs");
|
|
14
16
|
const base = require("./facets/measurements/base.cjs");
|
|
17
|
+
const legacy = require("./age-model/legacy.cjs");
|
|
15
18
|
const dataComponents = require("@macrostrat/data-components");
|
|
16
19
|
const columnNav = require("./data-provider/column-nav.cjs");
|
|
20
|
+
const surfaces = require("./age-model/surfaces.cjs");
|
|
17
21
|
const main = require("./correlation-chart/main.cjs");
|
|
22
|
+
const density = require("./prepare-units/density.cjs");
|
|
18
23
|
const index$1 = require("./facets/detrital-zircon/index.cjs");
|
|
19
24
|
const provider = require("./facets/fossils/provider.cjs");
|
|
20
25
|
const types = require("./prepare-units/types.cjs");
|
|
26
|
+
const types$1 = require("./age-model/types.cjs");
|
|
21
27
|
const isotopesColumn = require("./facets/carbon-isotopes/isotopes-column.cjs");
|
|
22
28
|
const panel = require("./unit-details/panel.cjs");
|
|
23
29
|
const store = require("./data-provider/store.cjs");
|
|
@@ -27,6 +33,7 @@ const index$2 = require("./facets/fossils/index.cjs");
|
|
|
27
33
|
const taxonRanges = require("./facets/fossils/taxon-ranges.cjs");
|
|
28
34
|
const sgp = require("./facets/measurements/sgp.cjs");
|
|
29
35
|
const stratNames = require("./unit-details/strat-names.cjs");
|
|
36
|
+
const details = require("./age-model/details.cjs");
|
|
30
37
|
const modalPanel = require("./unit-details/modal-panel.cjs");
|
|
31
38
|
const popover = require("./unit-details/popover.cjs");
|
|
32
39
|
const unitSelection = require("./data-provider/unit-selection.cjs");
|
|
@@ -48,17 +55,24 @@ exports.VerticalAxisLabel = ageAxis.VerticalAxisLabel;
|
|
|
48
55
|
exports.prepareColumnUnits = index$3.prepareColumnUnits;
|
|
49
56
|
exports.usePreparedColumnUnits = index$3.usePreparedColumnUnits;
|
|
50
57
|
exports.useAnimatedAgeWindow = animatedAgeWindow.useAnimatedAgeWindow;
|
|
58
|
+
exports.levelsForSelected = timescaleZoom.levelsForSelected;
|
|
59
|
+
exports.unitsAgeExtent = timescaleZoom.unitsAgeExtent;
|
|
60
|
+
exports.useTimescaleZoom = timescaleZoom.useTimescaleZoom;
|
|
51
61
|
exports.Column = column.Column;
|
|
52
62
|
exports.ColumnBasicInfo = column.ColumnBasicInfo;
|
|
53
63
|
exports.ColumnContainer = column.ColumnContainer;
|
|
54
|
-
exports.
|
|
55
|
-
exports.
|
|
64
|
+
exports.CompositeTimescale = section.CompositeTimescale;
|
|
65
|
+
exports.CompositeTimescaleCore = section.CompositeTimescaleCore;
|
|
56
66
|
exports.ColumnNotes = notes.ColumnNotes;
|
|
67
|
+
exports.AGE_MODEL_ROUTE = data.AGE_MODEL_ROUTE;
|
|
68
|
+
exports.useColumnAgeModel = data.useColumnAgeModel;
|
|
69
|
+
exports.useColumnSurfaces = data.useColumnSurfaces;
|
|
57
70
|
exports.AgeField = ageRange.AgeField;
|
|
58
71
|
exports.AgeLabel = ageRange.AgeLabel;
|
|
59
72
|
exports.AgeRange = ageRange.AgeRange;
|
|
60
73
|
exports.Duration = ageRange.Duration;
|
|
61
74
|
exports.IntervalProportions = ageRange.IntervalProportions;
|
|
75
|
+
exports.Proportion = ageRange.Proportion;
|
|
62
76
|
exports.getAge = ageRange.getAge;
|
|
63
77
|
exports.getAgeRange = ageRange.getAgeRange;
|
|
64
78
|
exports.AgeWindowTag = ageWindowTag.AgeWindowTag;
|
|
@@ -75,6 +89,8 @@ exports.TruncatedList = base.TruncatedList;
|
|
|
75
89
|
exports.groupNotesByPixelDistance = base.groupNotesByPixelDistance;
|
|
76
90
|
exports.mergeHeightRanges = base.mergeHeightRanges;
|
|
77
91
|
exports.standardizeMeasurementHeight = base.standardizeMeasurementHeight;
|
|
92
|
+
exports.BoundaryAgeModelOverlay = legacy.BoundaryAgeModelOverlay;
|
|
93
|
+
exports.ComputedSurfacesOverlay = legacy.ComputedSurfacesOverlay;
|
|
78
94
|
Object.defineProperty(exports, "ClickableText", {
|
|
79
95
|
enumerable: true,
|
|
80
96
|
get: () => dataComponents.ClickableText
|
|
@@ -89,13 +105,42 @@ Object.defineProperty(exports, "UnitIdentifier", {
|
|
|
89
105
|
});
|
|
90
106
|
exports.ColumnNavProvider = columnNav.ColumnNavProvider;
|
|
91
107
|
exports.useColumnNav = columnNav.useColumnNav;
|
|
108
|
+
exports.ColumnSurfaceLabels = surfaces.ColumnSurfaceLabels;
|
|
109
|
+
exports.ColumnSurfaceLines = surfaces.ColumnSurfaceLines;
|
|
110
|
+
exports.ColumnSurfaces = surfaces.ColumnSurfaces;
|
|
111
|
+
exports.surfaceClasses = surfaces.surfaceClasses;
|
|
92
112
|
exports.CorrelationChart = main.CorrelationChart;
|
|
113
|
+
exports.DEFAULT_TARGET_UNIT_HEIGHT = density.DEFAULT_TARGET_UNIT_HEIGHT;
|
|
114
|
+
exports.atLeast = density.atLeast;
|
|
115
|
+
exports.fixedDensity = density.fixedDensity;
|
|
116
|
+
exports.resolveDensity = density.resolveDensity;
|
|
117
|
+
exports.sectionDensity = density.sectionDensity;
|
|
118
|
+
exports.sectionHeight = density.sectionHeight;
|
|
119
|
+
exports.statedDensity = density.statedDensity;
|
|
120
|
+
exports.unitHeight = density.unitHeight;
|
|
93
121
|
exports.DetritalColumn = index$1.DetritalColumn;
|
|
94
122
|
exports.DetritalGroup = index$1.DetritalGroup;
|
|
95
123
|
exports.FossilDataType = provider.FossilDataType;
|
|
96
124
|
exports.useFossilData = provider.useFossilData;
|
|
97
125
|
exports.HeightMethod = types.HeightMethod;
|
|
98
126
|
exports.HybridScaleType = types.HybridScaleType;
|
|
127
|
+
exports.INTERVAL_BOUND_TOLERANCE = types$1.INTERVAL_BOUND_TOLERANCE;
|
|
128
|
+
exports.TIE_POINT_STATUSES = types$1.TIE_POINT_STATUSES;
|
|
129
|
+
exports.boundaryToSurface = types$1.boundaryToSurface;
|
|
130
|
+
exports.compareAlongAxis = types$1.compareAlongAxis;
|
|
131
|
+
exports.formatAge = types$1.formatAge;
|
|
132
|
+
exports.formatProportion = types$1.formatProportion;
|
|
133
|
+
exports.inferTiePointStatuses = types$1.inferTiePointStatuses;
|
|
134
|
+
exports.isPositionAxis = types$1.isPositionAxis;
|
|
135
|
+
exports.nullifyUnitID = types$1.nullifyUnitID;
|
|
136
|
+
exports.surfaceLabel = types$1.surfaceLabel;
|
|
137
|
+
exports.surfacePosition = types$1.surfacePosition;
|
|
138
|
+
exports.surfaceStatusDescriptions = types$1.surfaceStatusDescriptions;
|
|
139
|
+
exports.surfaceStatusLabels = types$1.surfaceStatusLabels;
|
|
140
|
+
exports.surfaceStatuses = types$1.surfaceStatuses;
|
|
141
|
+
exports.surfaceToken = types$1.surfaceToken;
|
|
142
|
+
exports.surfacesFromBoundaries = types$1.surfacesFromBoundaries;
|
|
143
|
+
exports.surfacesFromUnits = types$1.surfacesFromUnits;
|
|
99
144
|
exports.IsotopesColumn = isotopesColumn.IsotopesColumn;
|
|
100
145
|
exports.IsotopesDataset = isotopesColumn.IsotopesDataset;
|
|
101
146
|
exports.LegendPanelHeader = panel.LegendPanelHeader;
|
|
@@ -111,8 +156,10 @@ exports.UnitSelectionProvider = store.UnitSelectionProvider;
|
|
|
111
156
|
exports.columnUnitsAtom = store.columnUnitsAtom;
|
|
112
157
|
exports.columnUnitsMapAtom = store.columnUnitsMapAtom;
|
|
113
158
|
exports.scope = store.scope;
|
|
159
|
+
exports.useClaimLabelColumn = store.useClaimLabelColumn;
|
|
114
160
|
exports.useColumnUnitsMap = store.useColumnUnitsMap;
|
|
115
161
|
exports.useCompositeScale = store.useCompositeScale;
|
|
162
|
+
exports.useLabelColumnClaimed = store.useLabelColumnClaimed;
|
|
116
163
|
exports.useMacrostratColumnData = store.useMacrostratColumnData;
|
|
117
164
|
exports.useMacrostratUnits = store.useMacrostratUnits;
|
|
118
165
|
exports.MeasurementDataContext = dataProvider.MeasurementDataContext;
|
|
@@ -130,6 +177,10 @@ exports.PBDBFossilsColumn = index$2.PBDBFossilsColumn;
|
|
|
130
177
|
exports.PBDBOccurrencesMatrix = taxonRanges.PBDBOccurrencesMatrix;
|
|
131
178
|
exports.SGPMeasurementsColumn = sgp.SGPMeasurementsColumn;
|
|
132
179
|
exports.StratNameField = stratNames.StratNameField;
|
|
180
|
+
exports.SurfaceDetailsPanel = details.SurfaceDetailsPanel;
|
|
181
|
+
exports.SurfaceStatusLegend = details.SurfaceStatusLegend;
|
|
182
|
+
exports.SurfaceStatusTag = details.SurfaceStatusTag;
|
|
183
|
+
exports.SurfaceTypeTag = details.SurfaceTypeTag;
|
|
133
184
|
exports.UnitDetailsPanelWithNavigation = modalPanel.UnitDetailsPanelWithNavigation;
|
|
134
185
|
exports.UnitDetailsPopover = popover.UnitDetailsPopover;
|
|
135
186
|
exports.UnitSelectionPopover = popover.UnitSelectionPopover;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,9 +3,11 @@ export * from './data-provider';
|
|
|
3
3
|
export * from './age-axis';
|
|
4
4
|
export * from './prepare-units';
|
|
5
5
|
export * from './animated-age-window';
|
|
6
|
+
export * from './timescale-zoom';
|
|
6
7
|
export * from './column';
|
|
8
|
+
export { CompositeTimescale, CompositeTimescaleCore } from './section';
|
|
7
9
|
export * from './unit-details';
|
|
8
|
-
export * from './age-model
|
|
10
|
+
export * from './age-model';
|
|
9
11
|
export * from './correlation-chart';
|
|
10
12
|
export * from './notes';
|
|
11
13
|
export * from './facets';
|
package/dist/index.js
CHANGED
|
@@ -2,35 +2,43 @@ import { BasicUnitComponent, ColoredUnitComponent, EnvironmentColoredUnitCompone
|
|
|
2
2
|
import { AgeCursor, ApproximateHeightAxis, CompositeAgeAxis, CompositeAgeAxisCore, VerticalAxisLabel } from "./age-axis.js";
|
|
3
3
|
import { prepareColumnUnits, usePreparedColumnUnits } from "./prepare-units/index.js";
|
|
4
4
|
import { useAnimatedAgeWindow } from "./animated-age-window.js";
|
|
5
|
+
import { levelsForSelected, unitsAgeExtent, useTimescaleZoom } from "./timescale-zoom.js";
|
|
5
6
|
import { Column, ColumnBasicInfo, ColumnContainer } from "./column.js";
|
|
6
|
-
import {
|
|
7
|
+
import { CompositeTimescale, CompositeTimescaleCore } from "./section.js";
|
|
7
8
|
import { ColumnNotes } from "./notes.js";
|
|
8
9
|
export * from "@macrostrat/map-views";
|
|
9
|
-
import {
|
|
10
|
+
import { AGE_MODEL_ROUTE, useColumnAgeModel, useColumnSurfaces } from "./age-model/data.js";
|
|
11
|
+
import { AgeField, AgeLabel, AgeRange, Duration, IntervalProportions, Proportion, getAge, getAgeRange } from "./unit-details/age-range.js";
|
|
10
12
|
import { AgeWindowTag, intervalShortFromTimescale } from "./unit-details/age-window-tag.js";
|
|
11
13
|
import { AnnotatedUnitsColumn, ColumnNotesProvider, CompositeUnitComponent, CompositeUnitsColumn, LabelTrackerProvider, SectionLabelsColumn, TrackedLabeledUnit } from "./units/composite.js";
|
|
12
14
|
import { BaseMeasurementsColumn, TruncatedList, groupNotesByPixelDistance, mergeHeightRanges, standardizeMeasurementHeight } from "./facets/measurements/base.js";
|
|
15
|
+
import { BoundaryAgeModelOverlay, ComputedSurfacesOverlay } from "./age-model/legacy.js";
|
|
13
16
|
import { ClickableText, Identifier, UnitIdentifier } from "@macrostrat/data-components";
|
|
14
17
|
import { ColumnNavProvider, useColumnNav } from "./data-provider/column-nav.js";
|
|
18
|
+
import { ColumnSurfaceLabels, ColumnSurfaceLines, ColumnSurfaces, surfaceClasses } from "./age-model/surfaces.js";
|
|
15
19
|
import { CorrelationChart } from "./correlation-chart/main.js";
|
|
20
|
+
import { DEFAULT_TARGET_UNIT_HEIGHT, atLeast, fixedDensity, resolveDensity, sectionDensity, sectionHeight, statedDensity, unitHeight } from "./prepare-units/density.js";
|
|
16
21
|
import { DetritalColumn, DetritalGroup } from "./facets/detrital-zircon/index.js";
|
|
17
22
|
import { FossilDataType, useFossilData } from "./facets/fossils/provider.js";
|
|
18
23
|
import { HeightMethod, HybridScaleType } from "./prepare-units/types.js";
|
|
24
|
+
import { INTERVAL_BOUND_TOLERANCE, TIE_POINT_STATUSES, boundaryToSurface, compareAlongAxis, formatAge, formatProportion, inferTiePointStatuses, isPositionAxis, nullifyUnitID, surfaceLabel, surfacePosition, surfaceStatusDescriptions, surfaceStatusLabels, surfaceStatuses, surfaceToken, surfacesFromBoundaries, surfacesFromUnits } from "./age-model/types.js";
|
|
19
25
|
import { IsotopesColumn, IsotopesDataset } from "./facets/carbon-isotopes/isotopes-column.js";
|
|
20
26
|
import { LegendPanelHeader, ReferencesField, ThicknessField, UnitDetailsFeature, UnitDetailsPanel } from "./unit-details/panel.js";
|
|
21
|
-
import { LithologiesProvider, MacrostratColumnDataProvider, MacrostratColumnProvider, MacrostratColumnStateProvider, UnitSelectionProvider, columnUnitsAtom, columnUnitsMapAtom, scope, useColumnUnitsMap, useCompositeScale, useMacrostratColumnData, useMacrostratUnits } from "./data-provider/store.js";
|
|
27
|
+
import { LithologiesProvider, MacrostratColumnDataProvider, MacrostratColumnProvider, MacrostratColumnStateProvider, UnitSelectionProvider, columnUnitsAtom, columnUnitsMapAtom, scope, useClaimLabelColumn, useColumnUnitsMap, useCompositeScale, useLabelColumnClaimed, useMacrostratColumnData, useMacrostratUnits } from "./data-provider/store.js";
|
|
22
28
|
import { MeasurementDataContext, MeasurementDataProvider, useMeasurementData } from "./facets/carbon-isotopes/data-provider.js";
|
|
23
29
|
import { MergeSectionsMode, agesOverlap, createUnitSorter, ensureArray, ensureRealFloat, getPositionWithinUnit, getUnitHeightRange, unitsOverlap } from "./prepare-units/utils.js";
|
|
24
30
|
import { PBDBFossilsColumn } from "./facets/fossils/index.js";
|
|
25
31
|
import { PBDBOccurrencesMatrix } from "./facets/fossils/taxon-ranges.js";
|
|
26
32
|
import { SGPMeasurementsColumn } from "./facets/measurements/sgp.js";
|
|
27
33
|
import { StratNameField } from "./unit-details/strat-names.js";
|
|
34
|
+
import { SurfaceDetailsPanel, SurfaceStatusLegend, SurfaceStatusTag, SurfaceTypeTag } from "./age-model/details.js";
|
|
28
35
|
import { UnitDetailsPanelWithNavigation } from "./unit-details/modal-panel.js";
|
|
29
36
|
import { UnitDetailsPopover, UnitSelectionPopover } from "./unit-details/popover.js";
|
|
30
37
|
import { UnitKeyboardNavigation, UnitSelectionCallbackManager, allowUnitSelectionAtom, selectedUnitElementAtom, selectedUnitIDAtom, useAtomOverlayPosition, useColumnRef, useSelectedUnit, useUnitSelection, useUnitSelectionDispatch, useUnitSelectionTarget } from "./data-provider/unit-selection.js";
|
|
31
38
|
import { parseLineFromString, stringifyLine } from "./correlation-chart/hash-string.js";
|
|
32
39
|
import { preprocessUnits } from "./prepare-units/helpers.js";
|
|
33
40
|
export {
|
|
41
|
+
AGE_MODEL_ROUTE,
|
|
34
42
|
AgeCursor,
|
|
35
43
|
AgeField,
|
|
36
44
|
AgeLabel,
|
|
@@ -49,12 +57,18 @@ export {
|
|
|
49
57
|
ColumnNavProvider,
|
|
50
58
|
ColumnNotes,
|
|
51
59
|
ColumnNotesProvider,
|
|
60
|
+
ColumnSurfaceLabels,
|
|
61
|
+
ColumnSurfaceLines,
|
|
62
|
+
ColumnSurfaces,
|
|
52
63
|
CompositeAgeAxis,
|
|
53
64
|
CompositeAgeAxisCore,
|
|
65
|
+
CompositeTimescale,
|
|
66
|
+
CompositeTimescaleCore,
|
|
54
67
|
CompositeUnitComponent,
|
|
55
68
|
CompositeUnitsColumn,
|
|
56
69
|
ComputedSurfacesOverlay,
|
|
57
70
|
CorrelationChart,
|
|
71
|
+
DEFAULT_TARGET_UNIT_HEIGHT,
|
|
58
72
|
DetritalColumn,
|
|
59
73
|
DetritalGroup,
|
|
60
74
|
Duration,
|
|
@@ -62,6 +76,7 @@ export {
|
|
|
62
76
|
FossilDataType,
|
|
63
77
|
HeightMethod,
|
|
64
78
|
HybridScaleType,
|
|
79
|
+
INTERVAL_BOUND_TOLERANCE,
|
|
65
80
|
Identifier,
|
|
66
81
|
IntervalProportions,
|
|
67
82
|
IsotopesColumn,
|
|
@@ -77,11 +92,17 @@ export {
|
|
|
77
92
|
MergeSectionsMode,
|
|
78
93
|
PBDBFossilsColumn,
|
|
79
94
|
PBDBOccurrencesMatrix,
|
|
95
|
+
Proportion,
|
|
80
96
|
ReferencesField,
|
|
81
97
|
SGPMeasurementsColumn,
|
|
82
98
|
SectionLabelsColumn,
|
|
83
99
|
SimpleUnitsColumn,
|
|
84
100
|
StratNameField,
|
|
101
|
+
SurfaceDetailsPanel,
|
|
102
|
+
SurfaceStatusLegend,
|
|
103
|
+
SurfaceStatusTag,
|
|
104
|
+
SurfaceTypeTag,
|
|
105
|
+
TIE_POINT_STATUSES,
|
|
85
106
|
ThicknessField,
|
|
86
107
|
TrackedLabeledUnit,
|
|
87
108
|
TruncatedList,
|
|
@@ -99,39 +120,69 @@ export {
|
|
|
99
120
|
VerticalAxisLabel,
|
|
100
121
|
agesOverlap,
|
|
101
122
|
allowUnitSelectionAtom,
|
|
123
|
+
atLeast,
|
|
124
|
+
boundaryToSurface,
|
|
102
125
|
columnUnitsAtom,
|
|
103
126
|
columnUnitsMapAtom,
|
|
127
|
+
compareAlongAxis,
|
|
104
128
|
createUnitSorter,
|
|
105
129
|
ensureArray,
|
|
106
130
|
ensureRealFloat,
|
|
131
|
+
fixedDensity,
|
|
132
|
+
formatAge,
|
|
133
|
+
formatProportion,
|
|
107
134
|
getAge,
|
|
108
135
|
getAgeRange,
|
|
109
136
|
getPositionWithinUnit,
|
|
110
137
|
getUnitHeightRange,
|
|
111
138
|
groupNotesByPixelDistance,
|
|
139
|
+
inferTiePointStatuses,
|
|
112
140
|
intervalShortFromTimescale,
|
|
141
|
+
isPositionAxis,
|
|
142
|
+
levelsForSelected,
|
|
113
143
|
mergeHeightRanges,
|
|
144
|
+
nullifyUnitID,
|
|
114
145
|
parseLineFromString,
|
|
115
146
|
prepareColumnUnits,
|
|
116
147
|
preprocessUnits,
|
|
148
|
+
resolveDensity,
|
|
117
149
|
scope,
|
|
150
|
+
sectionDensity,
|
|
151
|
+
sectionHeight,
|
|
118
152
|
selectedUnitElementAtom,
|
|
119
153
|
selectedUnitIDAtom,
|
|
120
154
|
standardizeMeasurementHeight,
|
|
155
|
+
statedDensity,
|
|
121
156
|
stringifyLine,
|
|
157
|
+
surfaceClasses,
|
|
158
|
+
surfaceLabel,
|
|
159
|
+
surfacePosition,
|
|
160
|
+
surfaceStatusDescriptions,
|
|
161
|
+
surfaceStatusLabels,
|
|
162
|
+
surfaceStatuses,
|
|
163
|
+
surfaceToken,
|
|
164
|
+
surfacesFromBoundaries,
|
|
165
|
+
surfacesFromUnits,
|
|
166
|
+
unitHeight,
|
|
167
|
+
unitsAgeExtent,
|
|
122
168
|
unitsOverlap,
|
|
123
169
|
useAnimatedAgeWindow,
|
|
124
170
|
useAtomOverlayPosition,
|
|
171
|
+
useClaimLabelColumn,
|
|
172
|
+
useColumnAgeModel,
|
|
125
173
|
useColumnNav,
|
|
126
174
|
useColumnRef,
|
|
175
|
+
useColumnSurfaces,
|
|
127
176
|
useColumnUnitsMap,
|
|
128
177
|
useCompositeScale,
|
|
129
178
|
useFossilData,
|
|
179
|
+
useLabelColumnClaimed,
|
|
130
180
|
useMacrostratColumnData,
|
|
131
181
|
useMacrostratUnits,
|
|
132
182
|
useMeasurementData,
|
|
133
183
|
usePreparedColumnUnits,
|
|
134
184
|
useSelectedUnit,
|
|
185
|
+
useTimescaleZoom,
|
|
135
186
|
useUnitColor,
|
|
136
187
|
useUnitColorByEnvironment,
|
|
137
188
|
useUnitSelection,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/notes.cjs
CHANGED
|
@@ -13,6 +13,11 @@ function ColumnNotes({
|
|
|
13
13
|
paddingLeft = 60,
|
|
14
14
|
deltaConnectorAttachment,
|
|
15
15
|
focusedNoteComponent,
|
|
16
|
+
onClickNote,
|
|
17
|
+
forceOptions,
|
|
18
|
+
connectorOverhang,
|
|
19
|
+
showPointMarker,
|
|
20
|
+
className,
|
|
16
21
|
children
|
|
17
22
|
}) {
|
|
18
23
|
const { totalHeight } = store.useMacrostratColumnData();
|
|
@@ -25,14 +30,18 @@ function ColumnNotes({
|
|
|
25
30
|
pixelScale: -1
|
|
26
31
|
},
|
|
27
32
|
[
|
|
28
|
-
h__default.default(columnComponents.SVG, { width, height: totalHeight, paddingH: 4 }, [
|
|
33
|
+
h__default.default(columnComponents.SVG, { width, height: totalHeight, paddingH: 4, className }, [
|
|
29
34
|
h__default.default(columnComponents.NotesColumn, {
|
|
30
35
|
width,
|
|
31
36
|
notes,
|
|
32
37
|
noteComponent,
|
|
33
38
|
paddingLeft,
|
|
34
39
|
deltaConnectorAttachment,
|
|
35
|
-
focusedNoteComponent
|
|
40
|
+
focusedNoteComponent,
|
|
41
|
+
onClickNote,
|
|
42
|
+
forceOptions,
|
|
43
|
+
connectorOverhang,
|
|
44
|
+
showPointMarker
|
|
36
45
|
})
|
|
37
46
|
]),
|
|
38
47
|
children
|
package/dist/notes.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notes.cjs","sources":["../src/notes.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\n\nimport { ColumnNotesProvider } from \"./units\";\n\nimport { NotesColumn, SVG } from \"@macrostrat/column-components\";\nimport { useCompositeScale, useMacrostratColumnData } from \"./data-provider\";\nimport type { ComponentType, ReactNode } from \"react\";\n\ninterface ColumnNotesProps {\n notes: any[];\n width?: number;\n noteComponent?: any;\n paddingLeft?: number;\n deltaConnectorAttachment?: number;\n children?: ReactNode;\n focusedNoteComponent?: ComponentType<any> | null;\n}\n\nexport function ColumnNotes({\n notes,\n width = 200,\n noteComponent,\n paddingLeft = 60,\n deltaConnectorAttachment,\n focusedNoteComponent,\n children,\n}: ColumnNotesProps) {\n const { totalHeight } = useMacrostratColumnData();\n const scale = useCompositeScale();\n\n return h(\n ColumnNotesProvider,\n {\n scale,\n totalHeight,\n pixelScale: -1,\n },\n [\n h(SVG, { width, height: totalHeight, paddingH: 4 }, [\n h(NotesColumn, {\n width,\n notes,\n noteComponent,\n paddingLeft,\n deltaConnectorAttachment,\n focusedNoteComponent,\n }),\n ]),\n children,\n ],\n );\n}\n"],"names":["useMacrostratColumnData","useCompositeScale","h","ColumnNotesProvider","SVG","NotesColumn"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"notes.cjs","sources":["../src/notes.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\n\nimport { ColumnNotesProvider } from \"./units\";\n\nimport { NotesColumn, SVG, type NoteData } from \"@macrostrat/column-components\";\nimport { useCompositeScale, useMacrostratColumnData } from \"./data-provider\";\nimport type { ComponentType, ReactNode } from \"react\";\n\ninterface ColumnNotesProps {\n notes: any[];\n width?: number;\n noteComponent?: any;\n paddingLeft?: number;\n deltaConnectorAttachment?: number;\n children?: ReactNode;\n focusedNoteComponent?: ComponentType<any> | null;\n /** Called when a note is clicked */\n onClickNote?: (note: NoteData) => void;\n /** Px the connector continues past each end (see `NodeConnectorOptions`) */\n connectorOverhang?: number | [number, number];\n /** Draw the marker at a point note's height (default true) */\n showPointMarker?: boolean;\n /** Options for the label force layout (e.g. `nodeSpacing`) */\n forceOptions?: object;\n className?: string;\n}\n\nexport function ColumnNotes({\n notes,\n width = 200,\n noteComponent,\n paddingLeft = 60,\n deltaConnectorAttachment,\n focusedNoteComponent,\n onClickNote,\n forceOptions,\n connectorOverhang,\n showPointMarker,\n className,\n children,\n}: ColumnNotesProps) {\n const { totalHeight } = useMacrostratColumnData();\n const scale = useCompositeScale();\n\n return h(\n ColumnNotesProvider,\n {\n scale,\n totalHeight,\n pixelScale: -1,\n },\n [\n h(SVG, { width, height: totalHeight, paddingH: 4, className }, [\n h(NotesColumn, {\n width,\n notes,\n noteComponent,\n paddingLeft,\n deltaConnectorAttachment,\n focusedNoteComponent,\n onClickNote,\n forceOptions,\n connectorOverhang,\n showPointMarker,\n }),\n ]),\n children,\n ],\n );\n}\n"],"names":["useMacrostratColumnData","useCompositeScale","h","ColumnNotesProvider","SVG","NotesColumn"],"mappings":";;;;;;;;AA2BO,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAqB;AACnB,QAAM,EAAE,YAAA,IAAgBA,8BAAA;AACxB,QAAM,QAAQC,MAAAA,kBAAA;AAEd,SAAOC,WAAAA;AAAAA,IACLC,UAAAA;AAAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA,YAAY;AAAA,IAAA;AAAA,IAEd;AAAA,MACED,mBAAEE,iBAAAA,KAAK,EAAE,OAAO,QAAQ,aAAa,UAAU,GAAG,aAAa;AAAA,QAC7DF,WAAAA,QAAEG,iBAAAA,aAAa;AAAA,UACb;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA,CACD;AAAA,MAAA,CACF;AAAA,MACD;AAAA,IAAA;AAAA,EACF;AAEJ;;"}
|
package/dist/notes.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NoteData } from '@macrostrat/column-components';
|
|
1
2
|
import { ComponentType, ReactNode } from 'react';
|
|
2
3
|
interface ColumnNotesProps {
|
|
3
4
|
notes: any[];
|
|
@@ -7,6 +8,15 @@ interface ColumnNotesProps {
|
|
|
7
8
|
deltaConnectorAttachment?: number;
|
|
8
9
|
children?: ReactNode;
|
|
9
10
|
focusedNoteComponent?: ComponentType<any> | null;
|
|
11
|
+
/** Called when a note is clicked */
|
|
12
|
+
onClickNote?: (note: NoteData) => void;
|
|
13
|
+
/** Px the connector continues past each end (see `NodeConnectorOptions`) */
|
|
14
|
+
connectorOverhang?: number | [number, number];
|
|
15
|
+
/** Draw the marker at a point note's height (default true) */
|
|
16
|
+
showPointMarker?: boolean;
|
|
17
|
+
/** Options for the label force layout (e.g. `nodeSpacing`) */
|
|
18
|
+
forceOptions?: object;
|
|
19
|
+
className?: string;
|
|
10
20
|
}
|
|
11
|
-
export declare function ColumnNotes({ notes, width, noteComponent, paddingLeft, deltaConnectorAttachment, focusedNoteComponent, children, }: ColumnNotesProps): import('react').FunctionComponentElement<any>;
|
|
21
|
+
export declare function ColumnNotes({ notes, width, noteComponent, paddingLeft, deltaConnectorAttachment, focusedNoteComponent, onClickNote, forceOptions, connectorOverhang, showPointMarker, className, children, }: ColumnNotesProps): import('react').FunctionComponentElement<any>;
|
|
12
22
|
export {};
|
package/dist/notes.js
CHANGED
|
@@ -9,6 +9,11 @@ function ColumnNotes({
|
|
|
9
9
|
paddingLeft = 60,
|
|
10
10
|
deltaConnectorAttachment,
|
|
11
11
|
focusedNoteComponent,
|
|
12
|
+
onClickNote,
|
|
13
|
+
forceOptions,
|
|
14
|
+
connectorOverhang,
|
|
15
|
+
showPointMarker,
|
|
16
|
+
className,
|
|
12
17
|
children
|
|
13
18
|
}) {
|
|
14
19
|
const { totalHeight } = useMacrostratColumnData();
|
|
@@ -21,14 +26,18 @@ function ColumnNotes({
|
|
|
21
26
|
pixelScale: -1
|
|
22
27
|
},
|
|
23
28
|
[
|
|
24
|
-
h(SVG, { width, height: totalHeight, paddingH: 4 }, [
|
|
29
|
+
h(SVG, { width, height: totalHeight, paddingH: 4, className }, [
|
|
25
30
|
h(NotesColumn, {
|
|
26
31
|
width,
|
|
27
32
|
notes,
|
|
28
33
|
noteComponent,
|
|
29
34
|
paddingLeft,
|
|
30
35
|
deltaConnectorAttachment,
|
|
31
|
-
focusedNoteComponent
|
|
36
|
+
focusedNoteComponent,
|
|
37
|
+
onClickNote,
|
|
38
|
+
forceOptions,
|
|
39
|
+
connectorOverhang,
|
|
40
|
+
showPointMarker
|
|
32
41
|
})
|
|
33
42
|
]),
|
|
34
43
|
children
|
package/dist/notes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notes.js","sources":["../src/notes.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\n\nimport { ColumnNotesProvider } from \"./units\";\n\nimport { NotesColumn, SVG } from \"@macrostrat/column-components\";\nimport { useCompositeScale, useMacrostratColumnData } from \"./data-provider\";\nimport type { ComponentType, ReactNode } from \"react\";\n\ninterface ColumnNotesProps {\n notes: any[];\n width?: number;\n noteComponent?: any;\n paddingLeft?: number;\n deltaConnectorAttachment?: number;\n children?: ReactNode;\n focusedNoteComponent?: ComponentType<any> | null;\n}\n\nexport function ColumnNotes({\n notes,\n width = 200,\n noteComponent,\n paddingLeft = 60,\n deltaConnectorAttachment,\n focusedNoteComponent,\n children,\n}: ColumnNotesProps) {\n const { totalHeight } = useMacrostratColumnData();\n const scale = useCompositeScale();\n\n return h(\n ColumnNotesProvider,\n {\n scale,\n totalHeight,\n pixelScale: -1,\n },\n [\n h(SVG, { width, height: totalHeight, paddingH: 4 }, [\n h(NotesColumn, {\n width,\n notes,\n noteComponent,\n paddingLeft,\n deltaConnectorAttachment,\n focusedNoteComponent,\n }),\n ]),\n children,\n ],\n );\n}\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"notes.js","sources":["../src/notes.ts"],"sourcesContent":["import h from \"@macrostrat/hyper\";\n\nimport { ColumnNotesProvider } from \"./units\";\n\nimport { NotesColumn, SVG, type NoteData } from \"@macrostrat/column-components\";\nimport { useCompositeScale, useMacrostratColumnData } from \"./data-provider\";\nimport type { ComponentType, ReactNode } from \"react\";\n\ninterface ColumnNotesProps {\n notes: any[];\n width?: number;\n noteComponent?: any;\n paddingLeft?: number;\n deltaConnectorAttachment?: number;\n children?: ReactNode;\n focusedNoteComponent?: ComponentType<any> | null;\n /** Called when a note is clicked */\n onClickNote?: (note: NoteData) => void;\n /** Px the connector continues past each end (see `NodeConnectorOptions`) */\n connectorOverhang?: number | [number, number];\n /** Draw the marker at a point note's height (default true) */\n showPointMarker?: boolean;\n /** Options for the label force layout (e.g. `nodeSpacing`) */\n forceOptions?: object;\n className?: string;\n}\n\nexport function ColumnNotes({\n notes,\n width = 200,\n noteComponent,\n paddingLeft = 60,\n deltaConnectorAttachment,\n focusedNoteComponent,\n onClickNote,\n forceOptions,\n connectorOverhang,\n showPointMarker,\n className,\n children,\n}: ColumnNotesProps) {\n const { totalHeight } = useMacrostratColumnData();\n const scale = useCompositeScale();\n\n return h(\n ColumnNotesProvider,\n {\n scale,\n totalHeight,\n pixelScale: -1,\n },\n [\n h(SVG, { width, height: totalHeight, paddingH: 4, className }, [\n h(NotesColumn, {\n width,\n notes,\n noteComponent,\n paddingLeft,\n deltaConnectorAttachment,\n focusedNoteComponent,\n onClickNote,\n forceOptions,\n connectorOverhang,\n showPointMarker,\n }),\n ]),\n children,\n ],\n );\n}\n"],"names":[],"mappings":";;;;AA2BO,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAqB;AACnB,QAAM,EAAE,YAAA,IAAgB,wBAAA;AACxB,QAAM,QAAQ,kBAAA;AAEd,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA,YAAY;AAAA,IAAA;AAAA,IAEd;AAAA,MACE,EAAE,KAAK,EAAE,OAAO,QAAQ,aAAa,UAAU,GAAG,aAAa;AAAA,QAC7D,EAAE,aAAa;AAAA,UACb;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA,CACD;AAAA,MAAA,CACF;AAAA,MACD;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -4,6 +4,7 @@ const columnComponents = require("@macrostrat/column-components");
|
|
|
4
4
|
const utils = require("./utils.cjs");
|
|
5
5
|
const d3Scale = require("d3-scale");
|
|
6
6
|
const dynamicScales = require("./dynamic-scales.cjs");
|
|
7
|
+
const density = require("./density.cjs");
|
|
7
8
|
const types = require("./types.cjs");
|
|
8
9
|
function buildCompositeScaleInfo(inputScales, unconformityHeight) {
|
|
9
10
|
let totalHeight = unconformityHeight / 2;
|
|
@@ -67,7 +68,8 @@ function addScaleToSection(group, opts) {
|
|
|
67
68
|
}
|
|
68
69
|
const scaleInfo = buildSectionScale(units, {
|
|
69
70
|
...opts,
|
|
70
|
-
domain: _range
|
|
71
|
+
domain: _range,
|
|
72
|
+
sectionID: group.section_id
|
|
71
73
|
});
|
|
72
74
|
return {
|
|
73
75
|
...group,
|
|
@@ -77,12 +79,11 @@ function addScaleToSection(group, opts) {
|
|
|
77
79
|
function buildSectionScale(data, opts) {
|
|
78
80
|
const {
|
|
79
81
|
targetUnitHeight = 20,
|
|
80
|
-
minPixelScale = 0.2,
|
|
81
82
|
axisType,
|
|
82
|
-
minSectionHeight,
|
|
83
83
|
visibleWindow,
|
|
84
84
|
scale,
|
|
85
|
-
hybridScale
|
|
85
|
+
hybridScale,
|
|
86
|
+
sectionID
|
|
86
87
|
} = opts;
|
|
87
88
|
const domain = opts.domain ?? findSectionHeightRange(data, axisType);
|
|
88
89
|
const dAge = Math.abs(domain[0] - domain[1]);
|
|
@@ -91,6 +92,8 @@ function buildSectionScale(data, opts) {
|
|
|
91
92
|
if (hybridScale != null) {
|
|
92
93
|
if (hybridScale.type === types.HybridScaleType.EquidistantSurfaces) {
|
|
93
94
|
_pixelScale ??= targetUnitHeight;
|
|
95
|
+
} else {
|
|
96
|
+
_pixelScale = opts.pixelsPerMeter ?? _pixelScale;
|
|
94
97
|
}
|
|
95
98
|
return dynamicScales.buildHybridScale(hybridScale, data, domain, {
|
|
96
99
|
pixelOffset: 0,
|
|
@@ -98,14 +101,14 @@ function buildSectionScale(data, opts) {
|
|
|
98
101
|
});
|
|
99
102
|
}
|
|
100
103
|
if (scale == null) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
_pixelScale = density.sectionDensity(opts)({
|
|
105
|
+
extent: dAge,
|
|
106
|
+
unitExtents: visibleUnitExtents(data, axisType, visibleWindow),
|
|
107
|
+
units: data,
|
|
108
|
+
sectionID,
|
|
109
|
+
axisType
|
|
110
|
+
});
|
|
111
|
+
pixelHeight = dAge * _pixelScale;
|
|
109
112
|
} else {
|
|
110
113
|
pixelHeight = Math.abs(scale(domain[0]) - scale(domain[1]));
|
|
111
114
|
}
|
|
@@ -233,7 +236,7 @@ function findSectionHeightRange(data, axisType) {
|
|
|
233
236
|
return [b_pos, t_pos];
|
|
234
237
|
}
|
|
235
238
|
}
|
|
236
|
-
function
|
|
239
|
+
function visibleUnitExtents(data, axisType, visibleWindow) {
|
|
237
240
|
const durations = (clip) => data.map((d) => {
|
|
238
241
|
const [b_pos, t_pos] = utils.getUnitHeightRange(d, axisType);
|
|
239
242
|
if (!clip) return Math.abs(b_pos - t_pos);
|
|
@@ -246,8 +249,7 @@ function findAverageUnitHeight(data, axisType, visibleWindow) {
|
|
|
246
249
|
const useWindow = visibleWindow != null && axisType === columnComponents.ColumnAxisType.AGE;
|
|
247
250
|
let heights = useWindow ? durations(true) : [];
|
|
248
251
|
if (heights.length === 0) heights = durations(false);
|
|
249
|
-
|
|
250
|
-
return heights.reduce((a, b) => a + b, 0) / heights.length;
|
|
252
|
+
return heights;
|
|
251
253
|
}
|
|
252
254
|
function createCompositeScale(sections, interpolateUnconformities = false) {
|
|
253
255
|
const scales = [];
|
|
@@ -324,7 +326,7 @@ function collapseUnconformitiesByPixelHeight(sections, threshold, opts) {
|
|
|
324
326
|
_diff(heights.map(nextSection.scaleInfo.scale)),
|
|
325
327
|
_diff(heights.map(currentSection.scaleInfo.scale))
|
|
326
328
|
];
|
|
327
|
-
const pxHeight = Math.
|
|
329
|
+
const pxHeight = Math.max(...pxHeights);
|
|
328
330
|
if (pxHeight < threshold) {
|
|
329
331
|
let t_pos;
|
|
330
332
|
let b_pos;
|