@spider-analyzer/timeline 5.0.1 → 5.0.3

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 CHANGED
@@ -1,3 +1,25 @@
1
+ ## 5.0.3
2
+
3
+ - Fix: preserve `undefined` at the Date-→-Moment boundary. Optional
4
+ fields like `maxDomain.min`, `maxDomain.max`, or a partially-populated
5
+ `timeSpan` were silently turning into `moment()` (= now) because
6
+ `moment(undefined)` returns the current time. That turned
7
+ `maxDomain.min = undefined` (the common "no lower bound" case) into an
8
+ active minimum of *now*, which made every visible window appear to be
9
+ before the minimum — triggering `minTime`/`minDomainMsg` on zoom-out,
10
+ blocking pan, and causing constant cursor flicker from re-emitted
11
+ corrections.
12
+
13
+ ## 5.0.2
14
+
15
+ - Fix: apply the `xAxis` / `yAxis` / `margin` defaults inside the outer
16
+ TimeLine wrapper before passing props to the inner component. Previously
17
+ the defaults existed only as local destructuring fallbacks, so
18
+ ref-path accesses inside `useEffect` bodies (e.g.
19
+ `propsRef.current.xAxis.spaceBetweenTicks`) threw when a consumer
20
+ omitted these props. Affects any host that relied on the v4 defaults
21
+ rather than passing `xAxis` explicitly.
22
+
1
23
  ## 5.0.1
2
24
 
3
25
  - Expose the stylesheets through the `exports` map so consumers can
package/dist/index.js CHANGED
@@ -1956,15 +1956,19 @@ function toMoment(x, zone) {
1956
1956
  const m = zone ? moment_shim_default.tz(x, zone) : moment_shim_default(x);
1957
1957
  return m;
1958
1958
  }
1959
+ function toMomentOpt(x, zone) {
1960
+ if (x == null) return void 0;
1961
+ return toMoment(x, zone);
1962
+ }
1959
1963
  function toDuration(x) {
1960
1964
  if (moment_shim_default.isDuration(x)) return x;
1961
1965
  return moment_shim_default.duration(x);
1962
1966
  }
1963
1967
  function domainToMoments(d, zone) {
1964
- return { min: toMoment(d.min, zone), max: toMoment(d.max, zone) };
1968
+ return { min: toMomentOpt(d.min, zone), max: toMomentOpt(d.max, zone) };
1965
1969
  }
1966
1970
  function timeSpanToMoments(t, zone) {
1967
- return { start: toMoment(t.start, zone), stop: toMoment(t.stop, zone) };
1971
+ return { start: toMomentOpt(t.start, zone), stop: toMomentOpt(t.stop, zone) };
1968
1972
  }
1969
1973
  var Cursor2 = Cursor;
1970
1974
  var Histogram2 = Histogram;
@@ -2758,8 +2762,9 @@ var TimeLine2 = react.forwardRef(function TimeLineWrapper(props, ref) {
2758
2762
  const handleLoadDefault = react.useCallback(() => {
2759
2763
  const ret = props.onLoadDefaultDomain?.();
2760
2764
  const apply = (d) => {
2761
- if (!d) return;
2765
+ if (!d || !d.min || !d.max) return;
2762
2766
  const m = domainToMoments(d, zone);
2767
+ if (!m.min || !m.max) return;
2763
2768
  setStack([m]);
2764
2769
  if (props.onDomainChange) {
2765
2770
  props.onDomainChange({ min: m.min.toDate(), max: m.max.toDate() });
@@ -2770,6 +2775,9 @@ var TimeLine2 = react.forwardRef(function TimeLineWrapper(props, ref) {
2770
2775
  }, [props.onLoadDefaultDomain, props.onDomainChange, zone]);
2771
2776
  const innerProps = {
2772
2777
  ...props,
2778
+ xAxis: { ...xAxisDefault, ...props.xAxis ?? {} },
2779
+ yAxis: props.yAxis ?? {},
2780
+ margin: { ...marginDefault, ...props.margin ?? {} },
2773
2781
  domains: stack,
2774
2782
  timeSpan: props.timeSpan ? timeSpanToMoments(props.timeSpan, zone) : void 0,
2775
2783
  maxDomain: props.maxDomain ? domainToMoments(props.maxDomain, zone) : void 0,