@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.
Files changed (130) hide show
  1. package/CHANGELOG.md +169 -0
  2. package/dist/age-model/data.cjs +57 -0
  3. package/dist/age-model/data.cjs.map +1 -0
  4. package/dist/age-model/data.d.ts +29 -0
  5. package/dist/age-model/data.js +57 -0
  6. package/dist/age-model/data.js.map +1 -0
  7. package/dist/age-model/details.cjs +261 -0
  8. package/dist/age-model/details.cjs.map +1 -0
  9. package/dist/age-model/details.d.ts +39 -0
  10. package/dist/age-model/details.js +258 -0
  11. package/dist/age-model/details.js.map +1 -0
  12. package/dist/age-model/details.module.sass.cjs +42 -0
  13. package/dist/age-model/details.module.sass.cjs.map +1 -0
  14. package/dist/age-model/details.module.sass.js +40 -0
  15. package/dist/age-model/details.module.sass.js.map +1 -0
  16. package/dist/age-model/index.d.ts +5 -0
  17. package/dist/age-model/legacy.cjs +28 -0
  18. package/dist/age-model/legacy.cjs.map +1 -0
  19. package/dist/age-model/legacy.d.ts +6 -0
  20. package/dist/age-model/legacy.js +26 -0
  21. package/dist/age-model/legacy.js.map +1 -0
  22. package/dist/age-model/surfaces.cjs +355 -0
  23. package/dist/age-model/surfaces.cjs.map +1 -0
  24. package/dist/age-model/surfaces.d.ts +68 -0
  25. package/dist/age-model/surfaces.js +352 -0
  26. package/dist/age-model/surfaces.js.map +1 -0
  27. package/dist/age-model/surfaces.module.sass.cjs +45 -0
  28. package/dist/age-model/surfaces.module.sass.cjs.map +1 -0
  29. package/dist/age-model/surfaces.module.sass.js +43 -0
  30. package/dist/age-model/surfaces.module.sass.js.map +1 -0
  31. package/dist/age-model/types.cjs +229 -0
  32. package/dist/age-model/types.cjs.map +1 -0
  33. package/dist/age-model/types.d.ts +112 -0
  34. package/dist/age-model/types.js +229 -0
  35. package/dist/age-model/types.js.map +1 -0
  36. package/dist/column-views.css +389 -57
  37. package/dist/column.cjs +20 -13
  38. package/dist/column.cjs.map +1 -1
  39. package/dist/column.d.ts +21 -6
  40. package/dist/column.js +21 -14
  41. package/dist/column.js.map +1 -1
  42. package/dist/column.module.sass.cjs +19 -15
  43. package/dist/column.module.sass.cjs.map +1 -1
  44. package/dist/column.module.sass.js +19 -15
  45. package/dist/column.module.sass.js.map +1 -1
  46. package/dist/data-provider/store.cjs +34 -1
  47. package/dist/data-provider/store.cjs.map +1 -1
  48. package/dist/data-provider/store.d.ts +5 -0
  49. package/dist/data-provider/store.js +35 -2
  50. package/dist/data-provider/store.js.map +1 -1
  51. package/dist/index.cjs +54 -3
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.d.ts +3 -1
  54. package/dist/index.js +54 -3
  55. package/dist/index.js.map +1 -1
  56. package/dist/notes.cjs +11 -2
  57. package/dist/notes.cjs.map +1 -1
  58. package/dist/notes.d.ts +11 -1
  59. package/dist/notes.js +11 -2
  60. package/dist/notes.js.map +1 -1
  61. package/dist/prepare-units/composite-scale.cjs +18 -16
  62. package/dist/prepare-units/composite-scale.cjs.map +1 -1
  63. package/dist/prepare-units/composite-scale.js +18 -16
  64. package/dist/prepare-units/composite-scale.js.map +1 -1
  65. package/dist/prepare-units/density.cjs +83 -0
  66. package/dist/prepare-units/density.cjs.map +1 -0
  67. package/dist/prepare-units/density.d.ts +92 -0
  68. package/dist/prepare-units/density.js +83 -0
  69. package/dist/prepare-units/density.js.map +1 -0
  70. package/dist/prepare-units/index.cjs +15 -7
  71. package/dist/prepare-units/index.cjs.map +1 -1
  72. package/dist/prepare-units/index.d.ts +1 -0
  73. package/dist/prepare-units/index.js +15 -7
  74. package/dist/prepare-units/index.js.map +1 -1
  75. package/dist/prepare-units/types.cjs.map +1 -1
  76. package/dist/prepare-units/types.d.ts +34 -13
  77. package/dist/prepare-units/types.js.map +1 -1
  78. package/dist/section.cjs +108 -24
  79. package/dist/section.cjs.map +1 -1
  80. package/dist/section.d.ts +66 -6
  81. package/dist/section.js +109 -25
  82. package/dist/section.js.map +1 -1
  83. package/dist/timescale-zoom.cjs +191 -0
  84. package/dist/timescale-zoom.cjs.map +1 -0
  85. package/dist/timescale-zoom.d.ts +74 -0
  86. package/dist/timescale-zoom.js +191 -0
  87. package/dist/timescale-zoom.js.map +1 -0
  88. package/dist/unit-details/age-range.cjs +1 -0
  89. package/dist/unit-details/age-range.cjs.map +1 -1
  90. package/dist/unit-details/age-range.d.ts +5 -1
  91. package/dist/unit-details/age-range.js +1 -0
  92. package/dist/unit-details/age-range.js.map +1 -1
  93. package/dist/units/composite.cjs +4 -1
  94. package/dist/units/composite.cjs.map +1 -1
  95. package/dist/units/composite.d.ts +2 -0
  96. package/dist/units/composite.js +4 -1
  97. package/dist/units/composite.js.map +1 -1
  98. package/package.json +7 -7
  99. package/src/age-model/data.ts +98 -0
  100. package/src/age-model/details.module.sass +108 -0
  101. package/src/age-model/details.ts +333 -0
  102. package/src/age-model/index.ts +5 -0
  103. package/src/age-model/legacy.ts +30 -0
  104. package/src/age-model/surfaces.module.sass +168 -0
  105. package/src/age-model/surfaces.ts +568 -0
  106. package/src/age-model/types.ts +392 -0
  107. package/src/column.module.sass +59 -8
  108. package/src/column.ts +49 -23
  109. package/src/data-provider/store.ts +50 -1
  110. package/src/index.ts +5 -1
  111. package/src/notes.ts +20 -2
  112. package/src/prepare-units/composite-scale.ts +34 -31
  113. package/src/prepare-units/density.ts +197 -0
  114. package/src/prepare-units/index.ts +25 -6
  115. package/src/prepare-units/types.ts +34 -13
  116. package/src/section.ts +219 -33
  117. package/src/timescale-zoom.ts +341 -0
  118. package/src/unit-details/age-range.ts +3 -3
  119. package/src/units/composite.ts +11 -0
  120. package/dist/age-model-overlay.cjs +0 -50
  121. package/dist/age-model-overlay.cjs.map +0 -1
  122. package/dist/age-model-overlay.d.ts +0 -24
  123. package/dist/age-model-overlay.js +0 -48
  124. package/dist/age-model-overlay.js.map +0 -1
  125. package/dist/age-model-overlay.module.sass.cjs +0 -12
  126. package/dist/age-model-overlay.module.sass.cjs.map +0 -1
  127. package/dist/age-model-overlay.module.sass.js +0 -11
  128. package/dist/age-model-overlay.module.sass.js.map +0 -1
  129. package/src/age-model-overlay.module.sass +0 -11
  130. package/src/age-model-overlay.ts +0 -96
@@ -0,0 +1,355 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const h$1 = require("@macrostrat/hyper");
4
+ const classNames = require("classnames");
5
+ const React = require("react");
6
+ const dataComponents = require("@macrostrat/data-components");
7
+ const dataProvider = require("@macrostrat/data-provider");
8
+ const notes = require("../notes.cjs");
9
+ const ageRange = require("../unit-details/age-range.cjs");
10
+ const column_module = require("../column.module.sass.cjs");
11
+ const surfaces_module = require("./surfaces.module.sass.cjs");
12
+ const types = require("./types.cjs");
13
+ const data = require("./data.cjs");
14
+ const store = require("../data-provider/store.cjs");
15
+ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
16
+ const h__default = /* @__PURE__ */ _interopDefault(h$1);
17
+ const classNames__default = /* @__PURE__ */ _interopDefault(classNames);
18
+ const h = h__default.default.styled(surfaces_module.default);
19
+ function ColumnSurfaces(props) {
20
+ const {
21
+ showLines = true,
22
+ showLabels = true,
23
+ extent = "units",
24
+ labelWidth,
25
+ labelPaddingLeft,
26
+ statuses,
27
+ labelStatuses = types.TIE_POINT_STATUSES,
28
+ minLabelSpacing,
29
+ selectedSurface,
30
+ onSelectSurface,
31
+ className,
32
+ ...dataOptions
33
+ } = props;
34
+ const { surfaces: allSurfaces } = data.useColumnSurfaces(dataOptions);
35
+ const surfaces = React.useMemo(
36
+ () => filterByStatus(allSurfaces, statuses),
37
+ [allSurfaces, statuses]
38
+ );
39
+ const [selectedID, select] = useSurfaceSelection(
40
+ selectedSurface,
41
+ onSelectSurface
42
+ );
43
+ return h([
44
+ h.if(showLines)(ColumnSurfaceLines, {
45
+ surfaces,
46
+ extent,
47
+ selectedSurface: selectedID,
48
+ onSelectSurface: select,
49
+ className
50
+ }),
51
+ h.if(showLabels)(ColumnSurfaceLabels, {
52
+ surfaces,
53
+ labelStatuses,
54
+ minLabelSpacing,
55
+ width: labelWidth,
56
+ paddingLeft: labelPaddingLeft,
57
+ selectedSurface: selectedID,
58
+ onSelectSurface: select,
59
+ className
60
+ })
61
+ ]);
62
+ }
63
+ function ColumnSurfaceLines(props) {
64
+ const {
65
+ surfaces,
66
+ extent = "units",
67
+ selectedSurface,
68
+ onSelectSurface,
69
+ className
70
+ } = props;
71
+ const scale = store.useCompositeScale();
72
+ const { axisType, totalHeight } = store.useMacrostratColumnData();
73
+ const intervalMap = useSurfaceIntervalDefs(surfaces);
74
+ const ref = React.useRef(null);
75
+ const unitsExtent = useUnitsColumnExtent(ref, extent === "units");
76
+ let style = { height: totalHeight };
77
+ if (unitsExtent != null) {
78
+ style = { ...style, left: unitsExtent.left, width: unitsExtent.width };
79
+ }
80
+ const measuring = extent === "units" && unitsExtent == null;
81
+ return h(
82
+ "div.column-surface-lines",
83
+ { ref, style, className: classNames__default.default(className, { measuring }) },
84
+ surfaces.map((surface) => {
85
+ const position = types.surfacePosition(surface, axisType);
86
+ if (position == null) return null;
87
+ const y = scale(position);
88
+ if (y == null) return null;
89
+ return h(SurfaceLine, {
90
+ key: surface.id,
91
+ surface,
92
+ y,
93
+ color: surfaceIntervalColor(surface, intervalMap),
94
+ selected: surface.id === selectedSurface,
95
+ onSelect: onSelectSurface
96
+ });
97
+ })
98
+ );
99
+ }
100
+ function SurfaceLine({
101
+ surface,
102
+ y,
103
+ color,
104
+ selected,
105
+ onSelect
106
+ }) {
107
+ const onClick = React.useCallback(
108
+ (evt) => {
109
+ evt.stopPropagation();
110
+ if (selected) {
111
+ onSelect?.(null);
112
+ } else {
113
+ onSelect?.(surface);
114
+ }
115
+ },
116
+ [surface, selected, onSelect]
117
+ );
118
+ let style = { top: y };
119
+ if (color != null) {
120
+ style = { ...style, "--surface-color": color };
121
+ }
122
+ return h(
123
+ "div.surface-line",
124
+ {
125
+ style,
126
+ className: classNames__default.default(surfaceClasses(surface), {
127
+ selected,
128
+ interactive: onSelect != null
129
+ }),
130
+ title: types.surfaceLabel(surface),
131
+ onClick
132
+ },
133
+ h("div.surface-line-inner")
134
+ );
135
+ }
136
+ function ColumnSurfaceLabels(props) {
137
+ const {
138
+ surfaces,
139
+ labelStatuses = types.TIE_POINT_STATUSES,
140
+ minLabelSpacing = 22,
141
+ width = 200,
142
+ paddingLeft = 24,
143
+ selectedSurface,
144
+ onSelectSurface,
145
+ className
146
+ } = props;
147
+ const { axisType } = store.useMacrostratColumnData();
148
+ const scale = store.useCompositeScale();
149
+ const intervalMap = useSurfaceIntervalDefs(surfaces);
150
+ store.useClaimLabelColumn();
151
+ const labeled = React.useMemo(() => {
152
+ const byStatus = filterByStatus(surfaces, labelStatuses);
153
+ return thinByPixelSpacing(
154
+ byStatus,
155
+ (s) => scale(types.surfacePosition(s, axisType) ?? NaN),
156
+ minLabelSpacing,
157
+ selectedSurface
158
+ );
159
+ }, [
160
+ surfaces,
161
+ labelStatuses,
162
+ minLabelSpacing,
163
+ selectedSurface,
164
+ scale,
165
+ axisType
166
+ ]);
167
+ const notes$1 = React.useMemo(() => {
168
+ const _notes = [];
169
+ for (const surface of labeled) {
170
+ const position = types.surfacePosition(surface, axisType);
171
+ if (position == null) continue;
172
+ _notes.push({
173
+ id: surface.id,
174
+ height: position,
175
+ note: types.surfaceLabel(surface),
176
+ // The note's color reaches its connector, so a label's leader line
177
+ // matches the surface line it points at
178
+ color: surfaceIntervalColor(surface, intervalMap) ?? void 0,
179
+ surface,
180
+ interval: calibrationInterval(surface, intervalMap),
181
+ selected: surface.id === selectedSurface
182
+ });
183
+ }
184
+ return _notes;
185
+ }, [labeled, axisType, selectedSurface, intervalMap]);
186
+ const onClickNote = React.useCallback(
187
+ (note) => {
188
+ const { surface, selected } = note;
189
+ if (selected) {
190
+ onSelectSurface?.(null);
191
+ } else {
192
+ onSelectSurface?.(surface);
193
+ }
194
+ },
195
+ [onSelectSurface]
196
+ );
197
+ return h(
198
+ "div.column-surface-labels",
199
+ { className },
200
+ h(notes.ColumnNotes, {
201
+ notes: notes$1,
202
+ width,
203
+ paddingLeft,
204
+ noteComponent: SurfaceNoteLabel,
205
+ onClickNote,
206
+ forceOptions: LABEL_FORCE_OPTIONS,
207
+ // The leader runs from the surface line in the column to the tag body,
208
+ // continuing a little past both ends rather than stopping in the gap —
209
+ // so it needs no endpoint marker of its own
210
+ connectorOverhang: LABEL_CONNECTOR_OVERHANG,
211
+ showPointMarker: false
212
+ })
213
+ );
214
+ }
215
+ const LABEL_FORCE_OPTIONS = { nodeSpacing: 2 };
216
+ const LABEL_CONNECTOR_OVERHANG = [8, 6];
217
+ function SurfaceNoteLabel({ note }) {
218
+ const { surface, interval, selected } = note;
219
+ let primary;
220
+ if (interval != null) {
221
+ primary = h(dataComponents.IntervalTag, {
222
+ interval,
223
+ size: dataComponents.TagSize.Small,
224
+ prefix: h(ageRange.Proportion, { value: surface.proportion }),
225
+ className: "surface-interval-tag"
226
+ });
227
+ } else {
228
+ primary = h(
229
+ "span.surface-label-status",
230
+ `${types.surfaceStatusLabels[surface.status]} surface`
231
+ );
232
+ }
233
+ return h(
234
+ "div.surface-label",
235
+ { className: classNames__default.default(surfaceClasses(surface), { selected }) },
236
+ h("div.surface-label-primary", primary)
237
+ );
238
+ }
239
+ function useSurfaceIntervalDefs(surfaces) {
240
+ const intervalIDs = React.useMemo(() => {
241
+ const ids = /* @__PURE__ */ new Set();
242
+ for (const surface of surfaces) {
243
+ if (surface.calibration != null) ids.add(surface.calibration.id);
244
+ }
245
+ return Array.from(ids);
246
+ }, [surfaces]);
247
+ return dataProvider.useMacrostratDefs("intervals", intervalIDs, null);
248
+ }
249
+ function surfaceIntervalColor(surface, intervalMap) {
250
+ const id = surface.calibration?.id;
251
+ if (id == null) return null;
252
+ return intervalMap?.get(id)?.color ?? null;
253
+ }
254
+ function calibrationInterval(surface, intervalMap) {
255
+ const { calibration } = surface;
256
+ if (calibration == null) return null;
257
+ const def = intervalMap?.get(calibration.id);
258
+ return {
259
+ id: calibration.id,
260
+ name: calibration.name,
261
+ b_age: calibration.b_age,
262
+ t_age: calibration.t_age,
263
+ color: def?.color,
264
+ rank: def?.rank
265
+ };
266
+ }
267
+ function surfaceClasses(surface) {
268
+ return classNames__default.default(
269
+ `status-${types.surfaceToken(surface.status)}`,
270
+ `type-${types.surfaceToken(surface.type)}`
271
+ );
272
+ }
273
+ function thinByPixelSpacing(surfaces, pixelPosition, minSpacing, selectedSurface) {
274
+ if (minSpacing <= 0) return surfaces;
275
+ const positioned = surfaces.map((surface) => ({ surface, y: pixelPosition(surface) })).filter((d) => d.y != null && !Number.isNaN(d.y)).sort((a, b) => a.y - b.y);
276
+ const kept = [];
277
+ for (const item of positioned) {
278
+ const selected = item.surface.id === selectedSurface;
279
+ const last = kept[kept.length - 1];
280
+ if (last == null || item.y - last.y >= minSpacing) {
281
+ kept.push(item);
282
+ } else if (selected) {
283
+ kept[kept.length - 1] = item;
284
+ }
285
+ }
286
+ return kept.map((d) => d.surface);
287
+ }
288
+ function filterByStatus(surfaces, statuses) {
289
+ if (statuses == null) return surfaces;
290
+ const allowed = new Set(statuses);
291
+ return surfaces.filter((d) => allowed.has(d.status));
292
+ }
293
+ function useSurfaceSelection(selectedID, onSelect) {
294
+ const [internal, setInternal] = React.useState(null);
295
+ const isControlled = selectedID !== void 0;
296
+ const select = React.useCallback(
297
+ (surface) => {
298
+ setInternal(surface?.id ?? null);
299
+ onSelect?.(surface);
300
+ },
301
+ [onSelect]
302
+ );
303
+ let current = internal;
304
+ if (isControlled) {
305
+ current = selectedID;
306
+ }
307
+ return [current, select];
308
+ }
309
+ const useMeasureEffect = typeof window === "undefined" ? React.useEffect : React.useLayoutEffect;
310
+ function useUnitsColumnExtent(ref, enabled) {
311
+ const [extent, setExtent] = React.useState(null);
312
+ const measure = React.useCallback(() => {
313
+ if (!enabled) return;
314
+ const parent = ref.current?.parentElement;
315
+ const target = parent?.querySelector(
316
+ `.${unitsContainerClass()}`
317
+ );
318
+ if (parent == null || target == null) return;
319
+ const p = parent.getBoundingClientRect();
320
+ const t = target.getBoundingClientRect();
321
+ const next = { left: t.left - p.left, width: t.width };
322
+ setExtent((prev) => {
323
+ if (prev?.left === next.left && prev?.width === next.width) {
324
+ return prev;
325
+ }
326
+ return next;
327
+ });
328
+ }, [enabled]);
329
+ useMeasureEffect(measure);
330
+ useMeasureEffect(() => {
331
+ if (!enabled) {
332
+ setExtent(null);
333
+ return;
334
+ }
335
+ const parent = ref.current?.parentElement;
336
+ if (parent == null) return;
337
+ if (typeof ResizeObserver === "undefined") return;
338
+ const observer = new ResizeObserver(measure);
339
+ observer.observe(parent);
340
+ for (const child of Array.from(parent.children)) {
341
+ observer.observe(child);
342
+ }
343
+ return () => observer.disconnect();
344
+ }, [enabled, measure]);
345
+ return extent;
346
+ }
347
+ function unitsContainerClass() {
348
+ const s = column_module.default;
349
+ return s["section-units-container"] ?? s.sectionUnitsContainer ?? "section-units-container";
350
+ }
351
+ exports.ColumnSurfaceLabels = ColumnSurfaceLabels;
352
+ exports.ColumnSurfaceLines = ColumnSurfaceLines;
353
+ exports.ColumnSurfaces = ColumnSurfaces;
354
+ exports.surfaceClasses = surfaceClasses;
355
+ //# sourceMappingURL=surfaces.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surfaces.cjs","sources":["../../src/age-model/surfaces.ts"],"sourcesContent":["/** The surfaces view: age-model calibration surfaces drawn on a column.\n *\n * `ColumnSurfaces` is dropped into a `Column` as a child. It draws one line\n * per surface across the units (`ColumnSurfaceLines`) and a notes column of\n * labels beside them (`ColumnSurfaceLabels`), styled by `boundary_status` and\n * `boundary_type`, with hover and selection.\n */\nimport hyper from \"@macrostrat/hyper\";\nimport classNames from \"classnames\";\nimport {\n type CSSProperties,\n type RefObject,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { NoteData } from \"@macrostrat/column-components\";\nimport {\n type IntervalShort,\n IntervalTag,\n TagSize,\n} from \"@macrostrat/data-components\";\nimport { useMacrostratDefs } from \"@macrostrat/data-provider\";\nimport {\n useClaimLabelColumn,\n useCompositeScale,\n useMacrostratColumnData,\n} from \"../data-provider\";\nimport { ColumnNotes } from \"../notes\";\nimport { AgeLabel, Proportion } from \"../unit-details/age-range\";\nimport columnStyles from \"../column.module.sass\";\nimport styles from \"./surfaces.module.sass\";\nimport {\n type ColumnSurface,\n type SurfaceStatus,\n formatProportion,\n surfaceLabel,\n surfacePosition,\n surfaceStatusLabels,\n surfaceToken,\n TIE_POINT_STATUSES,\n} from \"./types\";\nimport { type UseColumnSurfacesOptions, useColumnSurfaces } from \"./data\";\n\nconst h = hyper.styled(styles);\n\n/** How far the surface lines extend: across the units column only, or the\n * full width of the column including its axes. */\nexport type SurfaceLinesExtent = \"units\" | \"column\";\n\nexport type SurfaceSelectionHandler = (surface: ColumnSurface | null) => void;\n\nexport interface SurfaceSelectionProps {\n /** The selected surface's id. Pass `null` for a controlled, empty\n * selection; leave undefined for the component to manage selection. */\n selectedSurface?: ColumnSurface[\"id\"] | null;\n onSelectSurface?: SurfaceSelectionHandler;\n}\n\nexport interface ColumnSurfacesProps\n extends UseColumnSurfacesOptions, SurfaceSelectionProps {\n showLines?: boolean;\n showLabels?: boolean;\n extent?: SurfaceLinesExtent;\n /** Width of the labels column, connector included (default 200) */\n labelWidth?: number;\n labelPaddingLeft?: number;\n /** Only show surfaces with these statuses */\n statuses?: SurfaceStatus[] | null;\n /** Which surfaces get a label. Defaults to the tie points — the statuses\n * at which the age model was constrained — so interpolated (`modeled`),\n * unspecified and unit-derived surfaces are drawn as lines only. Pass\n * `null` to label every surface shown. */\n labelStatuses?: SurfaceStatus[] | null;\n /** Labels closer than this (in pixels) are thinned out, since the column\n * has finite room; the selected surface's label is always kept. */\n minLabelSpacing?: number;\n className?: string;\n}\n\nexport function ColumnSurfaces(props: ColumnSurfacesProps) {\n const {\n showLines = true,\n showLabels = true,\n extent = \"units\",\n labelWidth,\n labelPaddingLeft,\n statuses,\n labelStatuses = TIE_POINT_STATUSES,\n minLabelSpacing,\n selectedSurface,\n onSelectSurface,\n className,\n ...dataOptions\n } = props;\n\n const { surfaces: allSurfaces } = useColumnSurfaces(dataOptions);\n const surfaces = useMemo(\n () => filterByStatus(allSurfaces, statuses),\n [allSurfaces, statuses],\n );\n\n const [selectedID, select] = useSurfaceSelection(\n selectedSurface,\n onSelectSurface,\n );\n\n return h([\n h.if(showLines)(ColumnSurfaceLines, {\n surfaces,\n extent,\n selectedSurface: selectedID,\n onSelectSurface: select,\n className,\n }),\n h.if(showLabels)(ColumnSurfaceLabels, {\n surfaces,\n labelStatuses,\n minLabelSpacing,\n width: labelWidth,\n paddingLeft: labelPaddingLeft,\n selectedSurface: selectedID,\n onSelectSurface: select,\n className,\n }),\n ]);\n}\n\nexport interface ColumnSurfaceLinesProps extends SurfaceSelectionProps {\n surfaces: ColumnSurface[];\n extent?: SurfaceLinesExtent;\n className?: string;\n}\n\n/** One horizontal line per surface, overlaid on the column at the surface's\n * age (or measured position, for height and depth columns). */\nexport function ColumnSurfaceLines(props: ColumnSurfaceLinesProps) {\n const {\n surfaces,\n extent = \"units\",\n selectedSurface,\n onSelectSurface,\n className,\n } = props;\n const scale = useCompositeScale();\n const { axisType, totalHeight } = useMacrostratColumnData();\n const intervalMap = useSurfaceIntervalDefs(surfaces);\n\n const ref = useRef<HTMLDivElement>(null);\n const unitsExtent = useUnitsColumnExtent(ref, extent === \"units\");\n\n let style: CSSProperties = { height: totalHeight };\n if (unitsExtent != null) {\n style = { ...style, left: unitsExtent.left, width: unitsExtent.width };\n }\n const measuring = extent === \"units\" && unitsExtent == null;\n\n return h(\n \"div.column-surface-lines\",\n { ref, style, className: classNames(className, { measuring }) },\n surfaces.map((surface) => {\n const position = surfacePosition(surface, axisType);\n if (position == null) return null;\n const y = scale(position);\n if (y == null) return null;\n return h(SurfaceLine, {\n key: surface.id,\n surface,\n y,\n color: surfaceIntervalColor(surface, intervalMap),\n selected: surface.id === selectedSurface,\n onSelect: onSelectSurface,\n });\n }),\n );\n}\n\nfunction SurfaceLine({\n surface,\n y,\n color,\n selected,\n onSelect,\n}: {\n surface: ColumnSurface;\n y: number;\n /** The interval color, when known; otherwise the status color is used */\n color?: string | null;\n selected: boolean;\n onSelect?: SurfaceSelectionHandler;\n}) {\n const onClick = useCallback(\n (evt: MouseEvent) => {\n // Don't let the column deselect its unit\n evt.stopPropagation();\n if (selected) {\n onSelect?.(null);\n } else {\n onSelect?.(surface);\n }\n },\n [surface, selected, onSelect],\n );\n\n let style: CSSProperties = { top: y };\n if (color != null) {\n style = { ...style, \"--surface-color\": color } as CSSProperties;\n }\n\n return h(\n \"div.surface-line\",\n {\n style,\n className: classNames(surfaceClasses(surface), {\n selected,\n interactive: onSelect != null,\n }),\n title: surfaceLabel(surface),\n onClick,\n },\n h(\"div.surface-line-inner\"),\n );\n}\n\nexport interface ColumnSurfaceLabelsProps extends SurfaceSelectionProps {\n surfaces: ColumnSurface[];\n /** Which surfaces get a label (see `ColumnSurfacesProps.labelStatuses`) */\n labelStatuses?: SurfaceStatus[] | null;\n /** Minimum pixel spacing between labels (see `ColumnSurfacesProps`) */\n minLabelSpacing?: number;\n /** Total width, connector included */\n width?: number;\n paddingLeft?: number;\n className?: string;\n}\n\ninterface SurfaceNote extends NoteData {\n /** The interval color, which the note's connector picks up */\n color?: string;\n surface: ColumnSurface;\n /** The calibration interval, with color and rank from the definitions */\n interval: IntervalShort | null;\n selected: boolean;\n}\n\n/** A notes column of surface labels, laid out beside the units with the\n * collision avoidance of `NotesColumn`. It takes the label column over from\n * the unit labels while mounted: labels are one or the other. */\nexport function ColumnSurfaceLabels(props: ColumnSurfaceLabelsProps) {\n const {\n surfaces,\n labelStatuses = TIE_POINT_STATUSES,\n minLabelSpacing = 22,\n width = 200,\n paddingLeft = 24,\n selectedSurface,\n onSelectSurface,\n className,\n } = props;\n const { axisType } = useMacrostratColumnData();\n const scale = useCompositeScale();\n const intervalMap = useSurfaceIntervalDefs(surfaces);\n useClaimLabelColumn();\n\n const labeled = useMemo(() => {\n const byStatus = filterByStatus(surfaces, labelStatuses);\n return thinByPixelSpacing(\n byStatus,\n (s) => scale(surfacePosition(s, axisType) ?? NaN),\n minLabelSpacing,\n selectedSurface,\n );\n }, [\n surfaces,\n labelStatuses,\n minLabelSpacing,\n selectedSurface,\n scale,\n axisType,\n ]);\n\n const notes: SurfaceNote[] = useMemo(() => {\n const _notes: SurfaceNote[] = [];\n for (const surface of labeled) {\n const position = surfacePosition(surface, axisType);\n if (position == null) continue;\n _notes.push({\n id: surface.id,\n height: position,\n note: surfaceLabel(surface),\n // The note's color reaches its connector, so a label's leader line\n // matches the surface line it points at\n color: surfaceIntervalColor(surface, intervalMap) ?? undefined,\n surface,\n interval: calibrationInterval(surface, intervalMap),\n selected: surface.id === selectedSurface,\n });\n }\n return _notes;\n }, [labeled, axisType, selectedSurface, intervalMap]);\n\n const onClickNote = useCallback(\n (note: NoteData) => {\n const { surface, selected } = note as SurfaceNote;\n if (selected) {\n onSelectSurface?.(null);\n } else {\n onSelectSurface?.(surface);\n }\n },\n [onSelectSurface],\n );\n\n return h(\n \"div.column-surface-labels\",\n { className },\n h(ColumnNotes, {\n notes,\n width,\n paddingLeft,\n noteComponent: SurfaceNoteLabel,\n onClickNote,\n forceOptions: LABEL_FORCE_OPTIONS,\n // The leader runs from the surface line in the column to the tag body,\n // continuing a little past both ends rather than stopping in the gap —\n // so it needs no endpoint marker of its own\n connectorOverhang: LABEL_CONNECTOR_OVERHANG,\n showPointMarker: false,\n }),\n );\n}\n\n/** Breathing room between stacked labels, in pixels */\nconst LABEL_FORCE_OPTIONS = { nodeSpacing: 2 };\n\n/** How far the label's leader line continues past each end, in pixels: left\n * into the column to meet the surface line, right under the tag body. */\nconst LABEL_CONNECTOR_OVERHANG: [number, number] = [8, 6];\n\n/** A surface's label: its calibration interval as the standard interval tag\n * (with the position within the interval as the tag's detail), and the\n * modeled age beneath. Surfaces without a calibration show their status. */\nfunction SurfaceNoteLabel({ note }: { note: SurfaceNote }) {\n const { surface, interval, selected } = note;\n\n let primary: any;\n if (interval != null) {\n primary = h(IntervalTag, {\n interval,\n size: TagSize.Small,\n prefix: h(Proportion, { value: surface.proportion }),\n className: \"surface-interval-tag\",\n });\n } else {\n primary = h(\n \"span.surface-label-status\",\n `${surfaceStatusLabels[surface.status]} surface`,\n );\n }\n\n return h(\n \"div.surface-label\",\n { className: classNames(surfaceClasses(surface), { selected }) },\n h(\"div.surface-label-primary\", primary),\n );\n}\n\n/** The interval definitions for the surfaces' calibration intervals. The age\n * model carries interval ids and names but no colors, so they come from the\n * definitions store (which holds them all, and fetches once). */\nfunction useSurfaceIntervalDefs(\n surfaces: ColumnSurface[],\n): Map<number, any> | null {\n const intervalIDs = useMemo(() => {\n const ids = new Set<number>();\n for (const surface of surfaces) {\n if (surface.calibration != null) ids.add(surface.calibration.id);\n }\n return Array.from(ids);\n }, [surfaces]);\n return useMacrostratDefs(\"intervals\", intervalIDs, null);\n}\n\n/** The color a surface is drawn in: its calibration interval's, so the line\n * and its label's leader read as the interval the surface is tied to. `null`\n * for an uncalibrated surface, or before the definitions load — the status\n * color stands in. */\nfunction surfaceIntervalColor(\n surface: ColumnSurface,\n intervalMap: Map<number, any> | null,\n): string | null {\n const id = surface.calibration?.id;\n if (id == null) return null;\n return intervalMap?.get(id)?.color ?? null;\n}\n\n/** The calibration interval in the shape the interval tag takes, colored\n * from the definitions when they have loaded. */\nfunction calibrationInterval(\n surface: ColumnSurface,\n intervalMap: Map<number, any> | null,\n): IntervalShort | null {\n const { calibration } = surface;\n if (calibration == null) return null;\n const def = intervalMap?.get(calibration.id);\n return {\n id: calibration.id,\n name: calibration.name,\n b_age: calibration.b_age,\n t_age: calibration.t_age,\n color: def?.color,\n rank: def?.rank,\n };\n}\n\n/** Class names shared by the lines, labels, legend and tags, so a status or\n * type reads the same everywhere. */\nexport function surfaceClasses(surface: {\n status?: SurfaceStatus | null;\n type?: string | null;\n}): string {\n return classNames(\n `status-${surfaceToken(surface.status)}`,\n `type-${surfaceToken(surface.type)}`,\n );\n}\n\n/** Walk the surfaces down the column and drop any whose label would sit\n * within `minSpacing` pixels of the last one kept. The selected surface is\n * always kept (and displaces a neighbor if need be). */\nfunction thinByPixelSpacing(\n surfaces: ColumnSurface[],\n pixelPosition: (s: ColumnSurface) => number | null,\n minSpacing: number,\n selectedSurface: ColumnSurface[\"id\"] | null | undefined,\n): ColumnSurface[] {\n if (minSpacing <= 0) return surfaces;\n const positioned = surfaces\n .map((surface) => ({ surface, y: pixelPosition(surface) }))\n .filter((d) => d.y != null && !Number.isNaN(d.y))\n .sort((a, b) => a.y - b.y);\n\n const kept: { surface: ColumnSurface; y: number }[] = [];\n for (const item of positioned) {\n const selected = item.surface.id === selectedSurface;\n const last = kept[kept.length - 1];\n if (last == null || item.y - last.y >= minSpacing) {\n kept.push(item);\n } else if (selected) {\n // The selection wins its slot\n kept[kept.length - 1] = item;\n }\n }\n return kept.map((d) => d.surface);\n}\n\nfunction filterByStatus(\n surfaces: ColumnSurface[],\n statuses: SurfaceStatus[] | null | undefined,\n): ColumnSurface[] {\n if (statuses == null) return surfaces;\n const allowed = new Set(statuses);\n return surfaces.filter((d) => allowed.has(d.status));\n}\n\n/** Controlled-or-uncontrolled selection: when `selectedID` is passed (even as\n * `null`) the consumer owns it; otherwise it is kept internally. */\nfunction useSurfaceSelection(\n selectedID: ColumnSurface[\"id\"] | null | undefined,\n onSelect: SurfaceSelectionHandler | undefined,\n): [ColumnSurface[\"id\"] | null, SurfaceSelectionHandler] {\n const [internal, setInternal] = useState<ColumnSurface[\"id\"] | null>(null);\n const isControlled = selectedID !== undefined;\n\n const select: SurfaceSelectionHandler = useCallback(\n (surface) => {\n setInternal(surface?.id ?? null);\n onSelect?.(surface);\n },\n [onSelect],\n );\n\n let current = internal;\n if (isControlled) {\n current = selectedID;\n }\n return [current, select];\n}\n\ninterface HorizontalExtent {\n left: number;\n width: number;\n}\n\n/** `useLayoutEffect` in the browser, `useEffect` on the server — where it\n * would warn and has nothing to measure anyway. */\nconst useMeasureEffect =\n typeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\n/** Measure where the units column sits within the `Column`, so an overlay\n * can cover exactly the units rather than the axes. `null` while unmeasured,\n * when disabled, or when the units column can't be found. */\nfunction useUnitsColumnExtent(\n ref: RefObject<HTMLDivElement | null>,\n enabled: boolean,\n): HorizontalExtent | null {\n const [extent, setExtent] = useState<HorizontalExtent | null>(null);\n\n const measure = useCallback(() => {\n if (!enabled) return;\n const parent = ref.current?.parentElement;\n const target = parent?.querySelector<HTMLElement>(\n `.${unitsContainerClass()}`,\n );\n if (parent == null || target == null) return;\n\n const p = parent.getBoundingClientRect();\n const t = target.getBoundingClientRect();\n const next = { left: t.left - p.left, width: t.width };\n setExtent((prev) => {\n if (prev?.left === next.left && prev?.width === next.width) {\n return prev;\n }\n return next;\n });\n }, [enabled]);\n\n // Re-measure on every render as a backstop: cheap, and it catches layout\n // changes that no observer reports.\n useMeasureEffect(measure);\n\n useMeasureEffect(() => {\n if (!enabled) {\n setExtent(null);\n return;\n }\n const parent = ref.current?.parentElement;\n if (parent == null) return;\n if (typeof ResizeObserver === \"undefined\") return;\n\n const observer = new ResizeObserver(measure);\n // The units column *moves* when a sibling changes width — the timescale\n // widening once its intervals load, or its level count changing — and\n // that is not a resize of the units column or of the column itself, so\n // the siblings have to be watched too.\n observer.observe(parent);\n for (const child of Array.from(parent.children)) {\n observer.observe(child);\n }\n return () => observer.disconnect();\n }, [enabled, measure]);\n\n return extent;\n}\n\n/** The (module-scoped) class of the units container rendered by\n * `SectionsColumn`. */\nfunction unitsContainerClass(): string {\n const s = columnStyles as any;\n return (\n s[\"section-units-container\"] ??\n s.sectionUnitsContainer ??\n \"section-units-container\"\n );\n}\n"],"names":["hyper","styles","TIE_POINT_STATUSES","useColumnSurfaces","useMemo","useCompositeScale","useMacrostratColumnData","useRef","classNames","surfacePosition","useCallback","surfaceLabel","useClaimLabelColumn","notes","ColumnNotes","IntervalTag","TagSize","Proportion","surfaceStatusLabels","useMacrostratDefs","surfaceToken","useState","useEffect","useLayoutEffect","columnStyles"],"mappings":";;;;;;;;;;;;;;;;;AA+CA,MAAM,IAAIA,WAAAA,QAAM,OAAOC,uBAAM;AAoCtB,SAAS,eAAe,OAA4B;AACzD,QAAM;AAAA,IACJ,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgBC,MAAAA;AAAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD;AAEJ,QAAM,EAAE,UAAU,gBAAgBC,KAAAA,kBAAkB,WAAW;AAC/D,QAAM,WAAWC,MAAAA;AAAAA,IACf,MAAM,eAAe,aAAa,QAAQ;AAAA,IAC1C,CAAC,aAAa,QAAQ;AAAA,EAAA;AAGxB,QAAM,CAAC,YAAY,MAAM,IAAI;AAAA,IAC3B;AAAA,IACA;AAAA,EAAA;AAGF,SAAO,EAAE;AAAA,IACP,EAAE,GAAG,SAAS,EAAE,oBAAoB;AAAA,MAClC;AAAA,MACA;AAAA,MACA,iBAAiB;AAAA,MACjB,iBAAiB;AAAA,MACjB;AAAA,IAAA,CACD;AAAA,IACD,EAAE,GAAG,UAAU,EAAE,qBAAqB;AAAA,MACpC;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP,aAAa;AAAA,MACb,iBAAiB;AAAA,MACjB,iBAAiB;AAAA,MACjB;AAAA,IAAA,CACD;AAAA,EAAA,CACF;AACH;AAUO,SAAS,mBAAmB,OAAgC;AACjE,QAAM;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AACJ,QAAM,QAAQC,MAAAA,kBAAA;AACd,QAAM,EAAE,UAAU,YAAA,IAAgBC,8BAAA;AAClC,QAAM,cAAc,uBAAuB,QAAQ;AAE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MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,EAAE,MAAA;AAC/C,cAAU,CAAC,SAAS;AAClB,UAAI,MAAM,SAAS,KAAK,QAAQ,MAAM,UAAU,KAAK,OAAO;AAC1D,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT,CAAC;AAAA,EACH,GAAG,CAAC,OAAO,CAAC;AAIZ,mBAAiB,OAAO;AAExB,mBAAiB,MAAM;AACrB,QAAI,CAAC,SAAS;AACZ,gBAAU,IAAI;AACd;AAAA,IACF;AACA,UAAM,SAAS,IAAI,SAAS;AAC5B,QAAI,UAAU,KAAM;AACpB,QAAI,OAAO,mBAAmB,YAAa;AAE3C,UAAM,WAAW,IAAI,eAAe,OAAO;AAK3C,aAAS,QAAQ,MAAM;AACvB,eAAW,SAAS,MAAM,KAAK,OAAO,QAAQ,GAAG;AAC/C,eAAS,QAAQ,KAAK;AAAA,IACxB;AACA,WAAO,MAAM,SAAS,WAAA;AAAA,EACxB,GAAG,CAAC,SAAS,OAAO,CAAC;AAErB,SAAO;AACT;AAIA,SAAS,sBAA8B;AACrC,QAAM,IAAIc,cAAAA;AACV,SACE,EAAE,yBAAyB,KAC3B,EAAE,yBACF;AAEJ;;;;;"}
@@ -0,0 +1,68 @@
1
+ import { CSSProperties, RefObject } from 'react';
2
+ import { ColumnSurface, SurfaceStatus } from './types';
3
+ import { UseColumnSurfacesOptions } from './data';
4
+ /** How far the surface lines extend: across the units column only, or the
5
+ * full width of the column including its axes. */
6
+ export type SurfaceLinesExtent = "units" | "column";
7
+ export type SurfaceSelectionHandler = (surface: ColumnSurface | null) => void;
8
+ export interface SurfaceSelectionProps {
9
+ /** The selected surface's id. Pass `null` for a controlled, empty
10
+ * selection; leave undefined for the component to manage selection. */
11
+ selectedSurface?: ColumnSurface["id"] | null;
12
+ onSelectSurface?: SurfaceSelectionHandler;
13
+ }
14
+ export interface ColumnSurfacesProps extends UseColumnSurfacesOptions, SurfaceSelectionProps {
15
+ showLines?: boolean;
16
+ showLabels?: boolean;
17
+ extent?: SurfaceLinesExtent;
18
+ /** Width of the labels column, connector included (default 200) */
19
+ labelWidth?: number;
20
+ labelPaddingLeft?: number;
21
+ /** Only show surfaces with these statuses */
22
+ statuses?: SurfaceStatus[] | null;
23
+ /** Which surfaces get a label. Defaults to the tie points — the statuses
24
+ * at which the age model was constrained — so interpolated (`modeled`),
25
+ * unspecified and unit-derived surfaces are drawn as lines only. Pass
26
+ * `null` to label every surface shown. */
27
+ labelStatuses?: SurfaceStatus[] | null;
28
+ /** Labels closer than this (in pixels) are thinned out, since the column
29
+ * has finite room; the selected surface's label is always kept. */
30
+ minLabelSpacing?: number;
31
+ className?: string;
32
+ }
33
+ export declare function ColumnSurfaces(props: ColumnSurfacesProps): import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>>;
34
+ export interface ColumnSurfaceLinesProps extends SurfaceSelectionProps {
35
+ surfaces: ColumnSurface[];
36
+ extent?: SurfaceLinesExtent;
37
+ className?: string;
38
+ }
39
+ /** One horizontal line per surface, overlaid on the column at the surface's
40
+ * age (or measured position, for height and depth columns). */
41
+ export declare function ColumnSurfaceLines(props: ColumnSurfaceLinesProps): import('react').ReactElement<{
42
+ ref: RefObject<HTMLDivElement | null>;
43
+ style: CSSProperties;
44
+ className: string;
45
+ }, string | import('react').JSXElementConstructor<any>>;
46
+ export interface ColumnSurfaceLabelsProps extends SurfaceSelectionProps {
47
+ surfaces: ColumnSurface[];
48
+ /** Which surfaces get a label (see `ColumnSurfacesProps.labelStatuses`) */
49
+ labelStatuses?: SurfaceStatus[] | null;
50
+ /** Minimum pixel spacing between labels (see `ColumnSurfacesProps`) */
51
+ minLabelSpacing?: number;
52
+ /** Total width, connector included */
53
+ width?: number;
54
+ paddingLeft?: number;
55
+ className?: string;
56
+ }
57
+ /** A notes column of surface labels, laid out beside the units with the
58
+ * collision avoidance of `NotesColumn`. It takes the label column over from
59
+ * the unit labels while mounted: labels are one or the other. */
60
+ export declare function ColumnSurfaceLabels(props: ColumnSurfaceLabelsProps): import('react').ReactElement<{
61
+ className: string | undefined;
62
+ }, string | import('react').JSXElementConstructor<any>>;
63
+ /** Class names shared by the lines, labels, legend and tags, so a status or
64
+ * type reads the same everywhere. */
65
+ export declare function surfaceClasses(surface: {
66
+ status?: SurfaceStatus | null;
67
+ type?: string | null;
68
+ }): string;