@macrostrat/column-views 3.6.1 → 3.9.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 (138) hide show
  1. package/CHANGELOG.md +144 -0
  2. package/dist/animated-age-window.cjs +51 -0
  3. package/dist/animated-age-window.cjs.map +1 -0
  4. package/dist/animated-age-window.d.ts +51 -0
  5. package/dist/animated-age-window.js +51 -0
  6. package/dist/animated-age-window.js.map +1 -0
  7. package/dist/column-views.css +118 -89
  8. package/dist/column.cjs +12 -3
  9. package/dist/column.cjs.map +1 -1
  10. package/dist/column.d.ts +11 -0
  11. package/dist/column.js +12 -3
  12. package/dist/column.js.map +1 -1
  13. package/dist/column.module.sass.cjs +15 -15
  14. package/dist/column.module.sass.js +15 -15
  15. package/dist/correlation-chart/main.cjs +156 -42
  16. package/dist/correlation-chart/main.cjs.map +1 -1
  17. package/dist/correlation-chart/main.d.ts +40 -2
  18. package/dist/correlation-chart/main.js +138 -23
  19. package/dist/correlation-chart/main.js.map +1 -1
  20. package/dist/correlation-chart/main.module.sass.cjs +23 -20
  21. package/dist/correlation-chart/main.module.sass.cjs.map +1 -1
  22. package/dist/correlation-chart/main.module.sass.js +23 -20
  23. package/dist/correlation-chart/main.module.sass.js.map +1 -1
  24. package/dist/correlation-chart/prepare-data.cjs +0 -1
  25. package/dist/correlation-chart/prepare-data.cjs.map +1 -1
  26. package/dist/correlation-chart/prepare-data.js +0 -1
  27. package/dist/correlation-chart/prepare-data.js.map +1 -1
  28. package/dist/data-provider/store.cjs +17 -4
  29. package/dist/data-provider/store.cjs.map +1 -1
  30. package/dist/data-provider/store.d.ts +6 -1
  31. package/dist/data-provider/store.js +17 -4
  32. package/dist/data-provider/store.js.map +1 -1
  33. package/dist/data-provider/unit-selection.cjs +4 -1
  34. package/dist/data-provider/unit-selection.cjs.map +1 -1
  35. package/dist/data-provider/unit-selection.d.ts +1 -1
  36. package/dist/data-provider/unit-selection.js +4 -1
  37. package/dist/data-provider/unit-selection.js.map +1 -1
  38. package/dist/index.cjs +16 -4
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.d.ts +1 -0
  41. package/dist/index.js +5 -2
  42. package/dist/index.js.map +1 -1
  43. package/dist/maps/column-correlation/core.cjs +127 -6
  44. package/dist/maps/column-correlation/core.cjs.map +1 -1
  45. package/dist/maps/column-correlation/core.js +128 -7
  46. package/dist/maps/column-correlation/core.js.map +1 -1
  47. package/dist/maps/column-correlation/state.cjs +63 -2
  48. package/dist/maps/column-correlation/state.cjs.map +1 -1
  49. package/dist/maps/column-correlation/state.d.ts +31 -1
  50. package/dist/maps/column-correlation/state.js +63 -2
  51. package/dist/maps/column-correlation/state.js.map +1 -1
  52. package/dist/maps/layers/columns.cjs +5 -1
  53. package/dist/maps/layers/columns.cjs.map +1 -1
  54. package/dist/maps/layers/columns.js +5 -1
  55. package/dist/maps/layers/columns.js.map +1 -1
  56. package/dist/prepare-units/composite-scale.cjs +94 -8
  57. package/dist/prepare-units/composite-scale.cjs.map +1 -1
  58. package/dist/prepare-units/composite-scale.d.ts +39 -0
  59. package/dist/prepare-units/composite-scale.js +96 -10
  60. package/dist/prepare-units/composite-scale.js.map +1 -1
  61. package/dist/prepare-units/helpers.cjs +0 -1
  62. package/dist/prepare-units/helpers.cjs.map +1 -1
  63. package/dist/prepare-units/helpers.js +0 -1
  64. package/dist/prepare-units/helpers.js.map +1 -1
  65. package/dist/prepare-units/index.cjs +33 -12
  66. package/dist/prepare-units/index.cjs.map +1 -1
  67. package/dist/prepare-units/index.js +34 -13
  68. package/dist/prepare-units/index.js.map +1 -1
  69. package/dist/prepare-units/types.cjs.map +1 -1
  70. package/dist/prepare-units/types.d.ts +13 -0
  71. package/dist/prepare-units/types.js.map +1 -1
  72. package/dist/section.cjs +10 -2
  73. package/dist/section.cjs.map +1 -1
  74. package/dist/section.d.ts +5 -0
  75. package/dist/section.js +10 -2
  76. package/dist/section.js.map +1 -1
  77. package/dist/unit-details/age-range.cjs +2 -1
  78. package/dist/unit-details/age-range.cjs.map +1 -1
  79. package/dist/unit-details/age-range.js +2 -1
  80. package/dist/unit-details/age-range.js.map +1 -1
  81. package/dist/unit-details/index.d.ts +1 -1
  82. package/dist/unit-details/panel.cjs +2 -3
  83. package/dist/unit-details/panel.cjs.map +1 -1
  84. package/dist/unit-details/panel.js +1 -2
  85. package/dist/unit-details/panel.js.map +1 -1
  86. package/dist/unit-details/panel.module.sass.cjs +18 -22
  87. package/dist/unit-details/panel.module.sass.cjs.map +1 -1
  88. package/dist/unit-details/panel.module.sass.js +18 -22
  89. package/dist/unit-details/panel.module.sass.js.map +1 -1
  90. package/dist/unit-details/strat-names.cjs +1 -2
  91. package/dist/unit-details/strat-names.cjs.map +1 -1
  92. package/dist/unit-details/strat-names.js +1 -2
  93. package/dist/unit-details/strat-names.js.map +1 -1
  94. package/dist/units/boxes.cjs +20 -36
  95. package/dist/units/boxes.cjs.map +1 -1
  96. package/dist/units/boxes.js +22 -38
  97. package/dist/units/boxes.js.map +1 -1
  98. package/dist/units/composite.cjs +12 -12
  99. package/dist/units/composite.cjs.map +1 -1
  100. package/dist/units/composite.js +12 -12
  101. package/dist/units/composite.js.map +1 -1
  102. package/package.json +9 -9
  103. package/src/animated-age-window.ts +120 -0
  104. package/src/column.module.sass +6 -0
  105. package/src/column.ts +24 -0
  106. package/src/correlation-chart/main.module.sass +46 -2
  107. package/src/correlation-chart/main.ts +210 -17
  108. package/src/correlation-chart/prepare-data.ts +0 -1
  109. package/src/data-provider/store.ts +21 -2
  110. package/src/data-provider/unit-selection.ts +13 -2
  111. package/src/index.ts +1 -0
  112. package/src/maps/column-correlation/column-correlation-map.stories.ts +12 -0
  113. package/src/maps/column-correlation/core.ts +155 -9
  114. package/src/maps/column-correlation/state.ts +110 -2
  115. package/src/maps/layers/columns.ts +7 -1
  116. package/src/prepare-units/composite-scale.ts +210 -10
  117. package/src/prepare-units/helpers.ts +0 -2
  118. package/src/prepare-units/index.ts +68 -14
  119. package/src/prepare-units/types.ts +13 -0
  120. package/src/section.ts +15 -1
  121. package/src/unit-details/age-range.ts +3 -1
  122. package/src/unit-details/index.ts +7 -1
  123. package/src/unit-details/panel.module.sass +0 -8
  124. package/src/unit-details/panel.ts +6 -6
  125. package/src/unit-details/strat-names.ts +1 -1
  126. package/src/units/boxes.ts +33 -53
  127. package/src/units/composite.ts +21 -12
  128. package/dist/correlation-chart/stories/utils.d.ts +0 -6
  129. package/dist/unit-details/identifiers.cjs +0 -56
  130. package/dist/unit-details/identifiers.cjs.map +0 -1
  131. package/dist/unit-details/identifiers.d.ts +0 -31
  132. package/dist/unit-details/identifiers.js +0 -54
  133. package/dist/unit-details/identifiers.js.map +0 -1
  134. package/src/correlation-chart/stories/correlation-chart.stories.ts +0 -228
  135. package/src/correlation-chart/stories/namibia-correlation.stories.ts +0 -151
  136. package/src/correlation-chart/stories/stories.module.sass +0 -18
  137. package/src/correlation-chart/stories/utils.ts +0 -24
  138. package/src/unit-details/identifiers.ts +0 -67
package/CHANGELOG.md CHANGED
@@ -1,5 +1,149 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.9.0] - 2026-08-25 [_changes_](https://github.com/UW-Macrostrat/web-components/compare/@macrostrat/column-views-v3.8.0...@macrostrat/column-views-v3.9.0)
4
+
5
+ ### Minor Changes
6
+
7
+ - Add `useAnimatedAgeWindow`: animates a column/correlation-chart's rendered
8
+ `t_age`/`b_age` for smooth pan-and-contract navigation at constant
9
+ `pixelScale` (density), driving the existing clipping + zig-zag unit edges. It
10
+ runs on the shared `useAnimatedDomain` core from `@macrostrat/timescale`.
11
+ Threads `isTransitioning` / `hideLabelsWhileTransitioning` flags through
12
+ `Column`/`CorrelationChart` → `ColumnProvider`; labels stay visible through
13
+ the animation by default, with an opt-in toggle to hide them. New stories for
14
+ the correlation chart and a single stratigraphic column, each with a
15
+ fixed-`pixelScale` variant and a label-hiding toggle.
16
+ [0247a5a2](https://github.com/UW-Macrostrat/web-components/commit/0247a5a2e12062fdb5e586b4b5dca9c3c6490127)
17
+
18
+ Add `windowPadding` (px): how much of the sections abutting the rendered
19
+ `t_age`/`b_age` window to reveal, so neighboring stratigraphy — and its
20
+ timescale intervals — stay visible and navigable when zoomed in. Available on
21
+ `Column` and `CorrelationChart`.
22
+
23
+ Unit density is now derived from the units the rendered window actually shows,
24
+ measured by their visible duration — so `targetUnitHeight` describes the units
25
+ on screen at any zoom depth, rather than the containing section's overall
26
+ average. A section the window doesn't reach falls back to its own units at
27
+ full duration and is drawn at its own scale. This removes the need for any
28
+ zoom-factor input: clipping shortens visible durations, which raises density,
29
+ so a column renders identically whether a window was animated to or set
30
+ directly.
31
+
32
+ Age columns now lay every section out at its **full extent** and apply the
33
+ rendered window as the last step, rather than clipping units and section
34
+ bounds up front. A section abutting the window therefore keeps its own density
35
+ and `minSectionHeight`, and is then trimmed to exactly the requested sliver —
36
+ previously such a fragment had its density re-derived from the few units that
37
+ survived the clip and was re-inflated to the floor, with its scale stretched
38
+ to match. Sections clipped by the window itself still honor
39
+ `minSectionHeight`, expanding their scale rather than rendering a sliver; only
40
+ the padding margin past the window renders at exactly its requested pixels.
41
+ Those final densities are resolved before the padding budget is spent, so a
42
+ margin measures the pixels requested rather than those pixels times whatever
43
+ stretch its neighbor needed — otherwise a short interval (a Holocene beside a
44
+ Pleistocene) is swallowed by its own margin. This also makes `windowPadding`
45
+ exact (it is spent against real section pixel heights; unconformity gaps
46
+ aren't charged, so padding smaller than `unconformityHeight` can still reach
47
+ across one) and stops unconformity-collapse decisions from shifting as the
48
+ window moves. Hybrid and externally-supplied scales keep the previous
49
+ clip-then-lay-out path.
50
+
51
+ Stabilize composite-scale package keys (positional index instead of
52
+ `package-${b_age}-${t_age}`) so the correlation chart's packages, columns, and
53
+ timescale reconcile instead of remounting on every animation frame. Unit
54
+ labels re-fit when a transition settles (via `SizeAwareLabel`'s
55
+ `remeasureKey`), not on intermediate frames.
56
+
57
+ `Column` now forwards `onClickTimescaleInterval` and `timescaleIntervalStyle`
58
+ to its composite timescale (via `CompositeTimescale`'s new
59
+ `onClickInterval`/`intervalStyle` props), so a standalone column supports
60
+ click-to-zoom interval navigation and per-interval styling (e.g. bolding the
61
+ selected interval).
62
+
63
+ Add an interval-zoom story (grouped with the other animation stories under
64
+ `Column views/Column animations`): clicking a timescale interval animates the
65
+ window to it, a preceding/postdating interval moves along the timescale, and
66
+ clicking the selected interval zooms out a level. The timescale shows a fixed
67
+ 3-level window that slides with the selected interval's rank (always one
68
+ coarser level to navigate up, one finer to drill down), independent of the
69
+ layout. `targetUnitHeight`, `minSectionHeight` and `windowPadding` are plain
70
+ display controls — there is no zoom-level input.
71
+
72
+ ### Patch Changes
73
+
74
+ - Fix two zoom-sync issues exposed by animated age-window zoom:
75
+ [0247a5a2](https://github.com/UW-Macrostrat/web-components/commit/0247a5a2e12062fdb5e586b4b5dca9c3c6490127)
76
+
77
+ - Age-axis (`AgeAxis`) now redraws when the scale's domain/range changes (not
78
+ just its object identity), and builds a fresh d3 axis generator each render.
79
+ Reusing the generator retained stale `.tickValues()` config, so a section
80
+ that was short (explicit first/last ticks) and later stretched kept those
81
+ out-of-domain tick values — leaving some axes with no labels. Both surfaced
82
+ once stable React keys stopped the axis remounting per frame.
83
+ - The inline-label/note tracker (`LabelTrackerProvider`) re-syncs to the
84
+ _current_ visible unit set on zoom. Its stale gate froze the "unlabeled" set
85
+ once the unit set changed, so a unit whose label now fit inline also kept
86
+ rendering as a note; it now recomputes over current units.
87
+
88
+ - Updated dependencies
89
+ [0247a5a2](https://github.com/UW-Macrostrat/web-components/commit/0247a5a2e12062fdb5e586b4b5dca9c3c6490127)
90
+ - Updated dependencies
91
+ [0247a5a2](https://github.com/UW-Macrostrat/web-components/commit/0247a5a2e12062fdb5e586b4b5dca9c3c6490127)
92
+ - Updated dependencies
93
+ [0247a5a2](https://github.com/UW-Macrostrat/web-components/commit/0247a5a2e12062fdb5e586b4b5dca9c3c6490127)
94
+ - Updated dependencies
95
+ [0247a5a2](https://github.com/UW-Macrostrat/web-components/commit/0247a5a2e12062fdb5e586b4b5dca9c3c6490127)
96
+ - Updated dependencies
97
+ [0247a5a2](https://github.com/UW-Macrostrat/web-components/commit/0247a5a2e12062fdb5e586b4b5dca9c3c6490127)
98
+ - @macrostrat/timescale@3.2.0
99
+ - @macrostrat/column-components@2.1.0
100
+ - @macrostrat/ui-components@5.2.0
101
+ - @macrostrat/map-styles@2.2.7
102
+
103
+ ## [3.8.0] - 2026-08-02 [_changes_](https://github.com/UW-Macrostrat/web-components/compare/@macrostrat/column-views-v3.7.0...@macrostrat/column-views-v3.8.0)
104
+
105
+ ### Minor Changes
106
+
107
+ - Move Identifier and UnitIdentifier to `@macrostrat/data-components`
108
+ [91fcea53](https://github.com/UW-Macrostrat/web-components/commit/91fcea536dd55e387b6f5bce1da0c07395da4635)
109
+
110
+ ### Patch Changes
111
+
112
+ - Remove some unnecessarily bundled packages
113
+ [930edeae](https://github.com/UW-Macrostrat/web-components/commit/930edeaef23d42d62ee3f533d2e20c75dbf9ea42)
114
+ - Updated dependencies
115
+ [1961f84a](https://github.com/UW-Macrostrat/web-components/commit/1961f84a397a341ce92eb032dcdc77c79f957707)
116
+ - Updated dependencies
117
+ [930edeae](https://github.com/UW-Macrostrat/web-components/commit/930edeaef23d42d62ee3f533d2e20c75dbf9ea42)
118
+ - Updated dependencies
119
+ [91fcea53](https://github.com/UW-Macrostrat/web-components/commit/91fcea536dd55e387b6f5bce1da0c07395da4635)
120
+ - @macrostrat/data-components@1.5.0
121
+ - @macrostrat/column-components@2.0.10
122
+ - @macrostrat/mapbox-react@3.3.3
123
+
124
+ ## [3.7.0] - 2026-07-30 [_changes_](https://github.com/UW-Macrostrat/web-components/compare/@macrostrat/column-views-v3.6.1...@macrostrat/column-views-v3.7.0)
125
+
126
+ ### Minor Changes
127
+
128
+ - - Improve column correlation chart to support more options
129
+ [b21ea1fc](https://github.com/UW-Macrostrat/web-components/commit/b21ea1fc297a5449a91997b3d97ff3509e8cd824)
130
+ - Create a new column reorganization draggable control
131
+ - Update data provider for intervals fetching
132
+
133
+ ### Patch Changes
134
+
135
+ - Updated dependencies
136
+ [b21ea1fc](https://github.com/UW-Macrostrat/web-components/commit/b21ea1fc297a5449a91997b3d97ff3509e8cd824)
137
+ - Updated dependencies
138
+ [b21ea1fc](https://github.com/UW-Macrostrat/web-components/commit/b21ea1fc297a5449a91997b3d97ff3509e8cd824)
139
+ - Updated dependencies
140
+ [b21ea1fc](https://github.com/UW-Macrostrat/web-components/commit/b21ea1fc297a5449a91997b3d97ff3509e8cd824)
141
+ - @macrostrat/map-interface@2.3.1
142
+ - @macrostrat/mapbox-react@3.3.2
143
+ - @macrostrat/data-components@1.4.1
144
+ - @macrostrat/data-provider@1.2.0
145
+ - @macrostrat/timescale@3.1.6
146
+
3
147
  ## [3.6.1] - 2026-07-28 [_changes_](https://github.com/UW-Macrostrat/web-components/compare/@macrostrat/column-views-v3.6.0...@macrostrat/column-views-v3.6.1)
4
148
 
5
149
  ### Patch Changes
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const React = require("react");
4
+ const timescale = require("@macrostrat/timescale");
5
+ function useAnimatedAgeWindow(options) {
6
+ const { fullExtent, duration } = options;
7
+ const extent = React.useMemo(() => toDomain(fullExtent), [
8
+ fullExtent?.t_age,
9
+ fullExtent?.b_age
10
+ ]);
11
+ const anim = timescale.useAnimatedDomain({ extent, duration });
12
+ const zoomToWindow = React.useCallback(
13
+ (target, opts = {}) => {
14
+ anim.animateTo([target.b_age, target.t_age], {
15
+ duration: opts.duration
16
+ });
17
+ },
18
+ [anim.animateTo]
19
+ );
20
+ const zoomToInterval = React.useCallback(
21
+ (interval, opts = {}) => {
22
+ zoomToWindow({ t_age: interval.lag, b_age: interval.eag }, opts);
23
+ },
24
+ [zoomToWindow]
25
+ );
26
+ const reset = React.useCallback(
27
+ (opts = {}) => {
28
+ if (fullExtent == null) return;
29
+ zoomToWindow(fullExtent, opts);
30
+ },
31
+ [zoomToWindow, fullExtent?.t_age, fullExtent?.b_age]
32
+ );
33
+ return {
34
+ window: toWindow(anim.domain),
35
+ isAnimating: anim.isAnimating,
36
+ isFullExtent: anim.isFullExtent,
37
+ zoomToWindow,
38
+ zoomToInterval,
39
+ reset
40
+ };
41
+ }
42
+ function toDomain(w) {
43
+ if (w == null) return null;
44
+ return [w.b_age, w.t_age];
45
+ }
46
+ function toWindow(d) {
47
+ if (d == null) return null;
48
+ return { t_age: d[1], b_age: d[0] };
49
+ }
50
+ exports.useAnimatedAgeWindow = useAnimatedAgeWindow;
51
+ //# sourceMappingURL=animated-age-window.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animated-age-window.cjs","sources":["../src/animated-age-window.ts"],"sourcesContent":["import { useCallback, useMemo } from \"react\";\nimport { AgeDomain, useAnimatedDomain } from \"@macrostrat/timescale\";\n\n/** A rendered age window, ordered as the column props expect:\n * `t_age` is the younger (top) bound, `b_age` the older (bottom) bound. */\nexport interface AgeWindow {\n t_age: number;\n b_age: number;\n}\n\nexport interface AnimateWindowOptions {\n duration?: number;\n}\n\nexport interface UseAnimatedAgeWindowOptions {\n /** The full data extent — the window to reset to, and the initial window.\n * `null` until the data (and hence extent) is known. */\n fullExtent: AgeWindow | null;\n /** Animation duration in ms (default 750). */\n duration?: number;\n}\n\nexport interface AnimatedAgeWindow {\n /** The current animated window to feed to `t_age`/`b_age` column props\n * (`null` until `fullExtent` is known). */\n window: AgeWindow | null;\n isAnimating: boolean;\n /** True when the window is (approximately) the full extent. */\n isFullExtent: boolean;\n /** Pan-and-contract to an explicit window (clamped to the full extent).\n * Density (`pixelScale`) is left untouched — this is not a zoom. */\n zoomToWindow(target: AgeWindow, opts?: AnimateWindowOptions): void;\n /** Pan-and-contract to a timescale interval, using `eag`/`lag`. */\n zoomToInterval(\n interval: { eag: number; lag: number },\n opts?: AnimateWindowOptions,\n ): void;\n /** Ease back to the full extent. */\n reset(opts?: AnimateWindowOptions): void;\n}\n\n/**\n * Animate the rendered age window (`t_age`/`b_age`) of a column or correlation\n * chart. This is the \"animate the current zoom approach\" model: narrowing the\n * window re-lays-out the column with explicit clipping — units past the bounds\n * get a zig-zag edge, unconformities keep their fixed `unconformityHeight`, and\n * `pixelScale` (density) is untouched, so a sub-interval click **pans and\n * contracts** at constant density rather than zooming. Joint domain/range\n * change (true zoom) stays under the user's direct control via `pixelScale`.\n *\n * The animation itself is `useAnimatedDomain` from `@macrostrat/timescale` —\n * the same state machine that drives the timescale's `useZoomableScale`. This\n * hook only maps an `[older, younger]` domain onto `{ b_age, t_age }`; it\n * animates the window you ask for and nothing more. Revealing a margin of the\n * neighboring column is the *layout's* job, via the `windowPadding` prop (px),\n * which is resolved against real section heights rather than predicted here.\n */\nexport function useAnimatedAgeWindow(\n options: UseAnimatedAgeWindowOptions,\n): AnimatedAgeWindow {\n const { fullExtent, duration } = options;\n\n const extent = useMemo(() => toDomain(fullExtent), [\n fullExtent?.t_age,\n fullExtent?.b_age,\n ]);\n\n const anim = useAnimatedDomain({ extent, duration });\n\n const zoomToWindow = useCallback(\n (target: AgeWindow, opts: AnimateWindowOptions = {}) => {\n anim.animateTo([target.b_age, target.t_age], {\n duration: opts.duration,\n });\n },\n [anim.animateTo],\n );\n\n const zoomToInterval = useCallback(\n (\n interval: { eag: number; lag: number },\n opts: AnimateWindowOptions = {},\n ) => {\n zoomToWindow({ t_age: interval.lag, b_age: interval.eag }, opts);\n },\n [zoomToWindow],\n );\n\n const reset = useCallback(\n (opts: AnimateWindowOptions = {}) => {\n if (fullExtent == null) return;\n zoomToWindow(fullExtent, opts);\n },\n [zoomToWindow, fullExtent?.t_age, fullExtent?.b_age],\n );\n\n return {\n window: toWindow(anim.domain),\n isAnimating: anim.isAnimating,\n isFullExtent: anim.isFullExtent,\n zoomToWindow,\n zoomToInterval,\n reset,\n };\n}\n\n/** `{t_age, b_age}` ↔ the core's `[older, younger]` domain. */\nfunction toDomain(w: AgeWindow): AgeDomain;\nfunction toDomain(w: AgeWindow | null): AgeDomain | null;\nfunction toDomain(w: AgeWindow | null): AgeDomain | null {\n if (w == null) return null;\n return [w.b_age, w.t_age];\n}\n\nfunction toWindow(d: AgeDomain): AgeWindow;\nfunction toWindow(d: AgeDomain | null): AgeWindow | null;\nfunction toWindow(d: AgeDomain | null): AgeWindow | null {\n if (d == null) return null;\n return { t_age: d[1], b_age: d[0] };\n}\n"],"names":["useMemo","useAnimatedDomain","useCallback"],"mappings":";;;;AAyDO,SAAS,qBACd,SACmB;AACnB,QAAM,EAAE,YAAY,SAAA,IAAa;AAEjC,QAAM,SAASA,MAAAA,QAAQ,MAAM,SAAS,UAAU,GAAG;AAAA,IACjD,YAAY;AAAA,IACZ,YAAY;AAAA,EAAA,CACb;AAED,QAAM,OAAOC,UAAAA,kBAAkB,EAAE,QAAQ,UAAU;AAEnD,QAAM,eAAeC,MAAAA;AAAAA,IACnB,CAAC,QAAmB,OAA6B,OAAO;AACtD,WAAK,UAAU,CAAC,OAAO,OAAO,OAAO,KAAK,GAAG;AAAA,QAC3C,UAAU,KAAK;AAAA,MAAA,CAChB;AAAA,IACH;AAAA,IACA,CAAC,KAAK,SAAS;AAAA,EAAA;AAGjB,QAAM,iBAAiBA,MAAAA;AAAAA,IACrB,CACE,UACA,OAA6B,OAC1B;AACH,mBAAa,EAAE,OAAO,SAAS,KAAK,OAAO,SAAS,IAAA,GAAO,IAAI;AAAA,IACjE;AAAA,IACA,CAAC,YAAY;AAAA,EAAA;AAGf,QAAM,QAAQA,MAAAA;AAAAA,IACZ,CAAC,OAA6B,CAAA,MAAO;AACnC,UAAI,cAAc,KAAM;AACxB,mBAAa,YAAY,IAAI;AAAA,IAC/B;AAAA,IACA,CAAC,cAAc,YAAY,OAAO,YAAY,KAAK;AAAA,EAAA;AAGrD,SAAO;AAAA,IACL,QAAQ,SAAS,KAAK,MAAM;AAAA,IAC5B,aAAa,KAAK;AAAA,IAClB,cAAc,KAAK;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;AAKA,SAAS,SAAS,GAAuC;AACvD,MAAI,KAAK,KAAM,QAAO;AACtB,SAAO,CAAC,EAAE,OAAO,EAAE,KAAK;AAC1B;AAIA,SAAS,SAAS,GAAuC;AACvD,MAAI,KAAK,KAAM,QAAO;AACtB,SAAO,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,EAAA;AAClC;;"}
@@ -0,0 +1,51 @@
1
+ /** A rendered age window, ordered as the column props expect:
2
+ * `t_age` is the younger (top) bound, `b_age` the older (bottom) bound. */
3
+ export interface AgeWindow {
4
+ t_age: number;
5
+ b_age: number;
6
+ }
7
+ export interface AnimateWindowOptions {
8
+ duration?: number;
9
+ }
10
+ export interface UseAnimatedAgeWindowOptions {
11
+ /** The full data extent — the window to reset to, and the initial window.
12
+ * `null` until the data (and hence extent) is known. */
13
+ fullExtent: AgeWindow | null;
14
+ /** Animation duration in ms (default 750). */
15
+ duration?: number;
16
+ }
17
+ export interface AnimatedAgeWindow {
18
+ /** The current animated window to feed to `t_age`/`b_age` column props
19
+ * (`null` until `fullExtent` is known). */
20
+ window: AgeWindow | null;
21
+ isAnimating: boolean;
22
+ /** True when the window is (approximately) the full extent. */
23
+ isFullExtent: boolean;
24
+ /** Pan-and-contract to an explicit window (clamped to the full extent).
25
+ * Density (`pixelScale`) is left untouched — this is not a zoom. */
26
+ zoomToWindow(target: AgeWindow, opts?: AnimateWindowOptions): void;
27
+ /** Pan-and-contract to a timescale interval, using `eag`/`lag`. */
28
+ zoomToInterval(interval: {
29
+ eag: number;
30
+ lag: number;
31
+ }, opts?: AnimateWindowOptions): void;
32
+ /** Ease back to the full extent. */
33
+ reset(opts?: AnimateWindowOptions): void;
34
+ }
35
+ /**
36
+ * Animate the rendered age window (`t_age`/`b_age`) of a column or correlation
37
+ * chart. This is the "animate the current zoom approach" model: narrowing the
38
+ * window re-lays-out the column with explicit clipping — units past the bounds
39
+ * get a zig-zag edge, unconformities keep their fixed `unconformityHeight`, and
40
+ * `pixelScale` (density) is untouched, so a sub-interval click **pans and
41
+ * contracts** at constant density rather than zooming. Joint domain/range
42
+ * change (true zoom) stays under the user's direct control via `pixelScale`.
43
+ *
44
+ * The animation itself is `useAnimatedDomain` from `@macrostrat/timescale` —
45
+ * the same state machine that drives the timescale's `useZoomableScale`. This
46
+ * hook only maps an `[older, younger]` domain onto `{ b_age, t_age }`; it
47
+ * animates the window you ask for and nothing more. Revealing a margin of the
48
+ * neighboring column is the *layout's* job, via the `windowPadding` prop (px),
49
+ * which is resolved against real section heights rather than predicted here.
50
+ */
51
+ export declare function useAnimatedAgeWindow(options: UseAnimatedAgeWindowOptions): AnimatedAgeWindow;
@@ -0,0 +1,51 @@
1
+ import { useMemo, useCallback } from "react";
2
+ import { useAnimatedDomain } from "@macrostrat/timescale";
3
+ function useAnimatedAgeWindow(options) {
4
+ const { fullExtent, duration } = options;
5
+ const extent = useMemo(() => toDomain(fullExtent), [
6
+ fullExtent?.t_age,
7
+ fullExtent?.b_age
8
+ ]);
9
+ const anim = useAnimatedDomain({ extent, duration });
10
+ const zoomToWindow = useCallback(
11
+ (target, opts = {}) => {
12
+ anim.animateTo([target.b_age, target.t_age], {
13
+ duration: opts.duration
14
+ });
15
+ },
16
+ [anim.animateTo]
17
+ );
18
+ const zoomToInterval = useCallback(
19
+ (interval, opts = {}) => {
20
+ zoomToWindow({ t_age: interval.lag, b_age: interval.eag }, opts);
21
+ },
22
+ [zoomToWindow]
23
+ );
24
+ const reset = useCallback(
25
+ (opts = {}) => {
26
+ if (fullExtent == null) return;
27
+ zoomToWindow(fullExtent, opts);
28
+ },
29
+ [zoomToWindow, fullExtent?.t_age, fullExtent?.b_age]
30
+ );
31
+ return {
32
+ window: toWindow(anim.domain),
33
+ isAnimating: anim.isAnimating,
34
+ isFullExtent: anim.isFullExtent,
35
+ zoomToWindow,
36
+ zoomToInterval,
37
+ reset
38
+ };
39
+ }
40
+ function toDomain(w) {
41
+ if (w == null) return null;
42
+ return [w.b_age, w.t_age];
43
+ }
44
+ function toWindow(d) {
45
+ if (d == null) return null;
46
+ return { t_age: d[1], b_age: d[0] };
47
+ }
48
+ export {
49
+ useAnimatedAgeWindow
50
+ };
51
+ //# sourceMappingURL=animated-age-window.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animated-age-window.js","sources":["../src/animated-age-window.ts"],"sourcesContent":["import { useCallback, useMemo } from \"react\";\nimport { AgeDomain, useAnimatedDomain } from \"@macrostrat/timescale\";\n\n/** A rendered age window, ordered as the column props expect:\n * `t_age` is the younger (top) bound, `b_age` the older (bottom) bound. */\nexport interface AgeWindow {\n t_age: number;\n b_age: number;\n}\n\nexport interface AnimateWindowOptions {\n duration?: number;\n}\n\nexport interface UseAnimatedAgeWindowOptions {\n /** The full data extent — the window to reset to, and the initial window.\n * `null` until the data (and hence extent) is known. */\n fullExtent: AgeWindow | null;\n /** Animation duration in ms (default 750). */\n duration?: number;\n}\n\nexport interface AnimatedAgeWindow {\n /** The current animated window to feed to `t_age`/`b_age` column props\n * (`null` until `fullExtent` is known). */\n window: AgeWindow | null;\n isAnimating: boolean;\n /** True when the window is (approximately) the full extent. */\n isFullExtent: boolean;\n /** Pan-and-contract to an explicit window (clamped to the full extent).\n * Density (`pixelScale`) is left untouched — this is not a zoom. */\n zoomToWindow(target: AgeWindow, opts?: AnimateWindowOptions): void;\n /** Pan-and-contract to a timescale interval, using `eag`/`lag`. */\n zoomToInterval(\n interval: { eag: number; lag: number },\n opts?: AnimateWindowOptions,\n ): void;\n /** Ease back to the full extent. */\n reset(opts?: AnimateWindowOptions): void;\n}\n\n/**\n * Animate the rendered age window (`t_age`/`b_age`) of a column or correlation\n * chart. This is the \"animate the current zoom approach\" model: narrowing the\n * window re-lays-out the column with explicit clipping — units past the bounds\n * get a zig-zag edge, unconformities keep their fixed `unconformityHeight`, and\n * `pixelScale` (density) is untouched, so a sub-interval click **pans and\n * contracts** at constant density rather than zooming. Joint domain/range\n * change (true zoom) stays under the user's direct control via `pixelScale`.\n *\n * The animation itself is `useAnimatedDomain` from `@macrostrat/timescale` —\n * the same state machine that drives the timescale's `useZoomableScale`. This\n * hook only maps an `[older, younger]` domain onto `{ b_age, t_age }`; it\n * animates the window you ask for and nothing more. Revealing a margin of the\n * neighboring column is the *layout's* job, via the `windowPadding` prop (px),\n * which is resolved against real section heights rather than predicted here.\n */\nexport function useAnimatedAgeWindow(\n options: UseAnimatedAgeWindowOptions,\n): AnimatedAgeWindow {\n const { fullExtent, duration } = options;\n\n const extent = useMemo(() => toDomain(fullExtent), [\n fullExtent?.t_age,\n fullExtent?.b_age,\n ]);\n\n const anim = useAnimatedDomain({ extent, duration });\n\n const zoomToWindow = useCallback(\n (target: AgeWindow, opts: AnimateWindowOptions = {}) => {\n anim.animateTo([target.b_age, target.t_age], {\n duration: opts.duration,\n });\n },\n [anim.animateTo],\n );\n\n const zoomToInterval = useCallback(\n (\n interval: { eag: number; lag: number },\n opts: AnimateWindowOptions = {},\n ) => {\n zoomToWindow({ t_age: interval.lag, b_age: interval.eag }, opts);\n },\n [zoomToWindow],\n );\n\n const reset = useCallback(\n (opts: AnimateWindowOptions = {}) => {\n if (fullExtent == null) return;\n zoomToWindow(fullExtent, opts);\n },\n [zoomToWindow, fullExtent?.t_age, fullExtent?.b_age],\n );\n\n return {\n window: toWindow(anim.domain),\n isAnimating: anim.isAnimating,\n isFullExtent: anim.isFullExtent,\n zoomToWindow,\n zoomToInterval,\n reset,\n };\n}\n\n/** `{t_age, b_age}` ↔ the core's `[older, younger]` domain. */\nfunction toDomain(w: AgeWindow): AgeDomain;\nfunction toDomain(w: AgeWindow | null): AgeDomain | null;\nfunction toDomain(w: AgeWindow | null): AgeDomain | null {\n if (w == null) return null;\n return [w.b_age, w.t_age];\n}\n\nfunction toWindow(d: AgeDomain): AgeWindow;\nfunction toWindow(d: AgeDomain | null): AgeWindow | null;\nfunction toWindow(d: AgeDomain | null): AgeWindow | null {\n if (d == null) return null;\n return { t_age: d[1], b_age: d[0] };\n}\n"],"names":[],"mappings":";;AAyDO,SAAS,qBACd,SACmB;AACnB,QAAM,EAAE,YAAY,SAAA,IAAa;AAEjC,QAAM,SAAS,QAAQ,MAAM,SAAS,UAAU,GAAG;AAAA,IACjD,YAAY;AAAA,IACZ,YAAY;AAAA,EAAA,CACb;AAED,QAAM,OAAO,kBAAkB,EAAE,QAAQ,UAAU;AAEnD,QAAM,eAAe;AAAA,IACnB,CAAC,QAAmB,OAA6B,OAAO;AACtD,WAAK,UAAU,CAAC,OAAO,OAAO,OAAO,KAAK,GAAG;AAAA,QAC3C,UAAU,KAAK;AAAA,MAAA,CAChB;AAAA,IACH;AAAA,IACA,CAAC,KAAK,SAAS;AAAA,EAAA;AAGjB,QAAM,iBAAiB;AAAA,IACrB,CACE,UACA,OAA6B,OAC1B;AACH,mBAAa,EAAE,OAAO,SAAS,KAAK,OAAO,SAAS,IAAA,GAAO,IAAI;AAAA,IACjE;AAAA,IACA,CAAC,YAAY;AAAA,EAAA;AAGf,QAAM,QAAQ;AAAA,IACZ,CAAC,OAA6B,CAAA,MAAO;AACnC,UAAI,cAAc,KAAM;AACxB,mBAAa,YAAY,IAAI;AAAA,IAC/B;AAAA,IACA,CAAC,cAAc,YAAY,OAAO,YAAY,KAAK;AAAA,EAAA;AAGrD,SAAO;AAAA,IACL,QAAQ,SAAS,KAAK,MAAM;AAAA,IAC5B,aAAa,KAAK;AAAA,IAClB,cAAc,KAAK;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;AAKA,SAAS,SAAS,GAAuC;AACvD,MAAI,KAAK,KAAM,QAAO;AACtB,SAAO,CAAC,EAAE,OAAO,EAAE,KAAK;AAC1B;AAIA,SAAS,SAAS,GAAuC;AACvD,MAAI,KAAK,KAAM,QAAO;AACtB,SAAO,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,EAAA;AAClC;"}