@spider-analyzer/timeline 5.0.6 → 5.0.8
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 +22 -0
- package/dist/index.js +39 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Cursor.jsx +3 -3
- package/src/TimeLine.tsx +12 -3
- package/src/cursorElements/CursorSelection.jsx +3 -3
- package/src/cursorElements/DragOverlay.jsx +3 -3
- package/src/moment-shim.ts +25 -0
- package/src/timeLineElements/HistoToolTip.jsx +3 -3
- package/src/timeLineElements/Histogram.jsx +3 -3
- package/src/timeLineElements/QualityLine.jsx +2 -2
- package/src/timeLineElements/XAxis.jsx +3 -3
package/dist/index.mjs
CHANGED
|
@@ -162,6 +162,25 @@ moment.tz = (x, zone) => {
|
|
|
162
162
|
const base = toDT(x);
|
|
163
163
|
return new MomentLike(base.setZone(zone));
|
|
164
164
|
};
|
|
165
|
+
function validate(props, propName, componentName) {
|
|
166
|
+
const v = props[propName];
|
|
167
|
+
if (v == null) return null;
|
|
168
|
+
if (moment.isMoment(v)) return null;
|
|
169
|
+
return new Error(
|
|
170
|
+
`Invalid prop \`${propName}\` supplied to \`${componentName}\`, expected a moment-like object.`
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
var required = (props, propName, componentName) => {
|
|
174
|
+
const v = props[propName];
|
|
175
|
+
if (v == null) {
|
|
176
|
+
return new Error(
|
|
177
|
+
`The prop \`${propName}\` is marked as required in \`${componentName}\`, but its value is \`${v}\`.`
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
return validate(props, propName, componentName);
|
|
181
|
+
};
|
|
182
|
+
var momentType = validate;
|
|
183
|
+
momentType.isRequired = required;
|
|
165
184
|
var moment_shim_default = moment;
|
|
166
185
|
|
|
167
186
|
// src/utils.ts
|
|
@@ -365,8 +384,8 @@ DragOverlay.propTypes = {
|
|
|
365
384
|
width: PropTypes11.number.isRequired,
|
|
366
385
|
marginBottom: PropTypes11.number,
|
|
367
386
|
items: PropTypes11.arrayOf(PropTypes11.shape({
|
|
368
|
-
start:
|
|
369
|
-
end:
|
|
387
|
+
start: momentType.isRequired,
|
|
388
|
+
end: momentType.isRequired,
|
|
370
389
|
x1: PropTypes11.number,
|
|
371
390
|
x2: PropTypes11.number,
|
|
372
391
|
metrics: PropTypes11.arrayOf(PropTypes11.number).isRequired,
|
|
@@ -676,8 +695,8 @@ CursorSelection.propTypes = {
|
|
|
676
695
|
showToolTipLeft: PropTypes11.func.isRequired,
|
|
677
696
|
showToolTipRight: PropTypes11.func.isRequired,
|
|
678
697
|
items: PropTypes11.arrayOf(PropTypes11.shape({
|
|
679
|
-
start:
|
|
680
|
-
end:
|
|
698
|
+
start: momentType.isRequired,
|
|
699
|
+
end: momentType.isRequired,
|
|
681
700
|
x1: PropTypes11.number,
|
|
682
701
|
x2: PropTypes11.number,
|
|
683
702
|
metrics: PropTypes11.arrayOf(PropTypes11.number).isRequired,
|
|
@@ -1263,8 +1282,8 @@ Cursor.propTypes = {
|
|
|
1263
1282
|
overlayHeight: PropTypes11.number.isRequired,
|
|
1264
1283
|
overlayWidth: PropTypes11.number.isRequired,
|
|
1265
1284
|
items: PropTypes11.arrayOf(PropTypes11.shape({
|
|
1266
|
-
start:
|
|
1267
|
-
end:
|
|
1285
|
+
start: momentType.isRequired,
|
|
1286
|
+
end: momentType.isRequired,
|
|
1268
1287
|
x1: PropTypes11.number,
|
|
1269
1288
|
x2: PropTypes11.number,
|
|
1270
1289
|
metrics: PropTypes11.arrayOf(PropTypes11.number).isRequired,
|
|
@@ -1373,8 +1392,8 @@ function Histogram({
|
|
|
1373
1392
|
Histogram.propTypes = {
|
|
1374
1393
|
classes: PropTypes11.object,
|
|
1375
1394
|
items: PropTypes11.arrayOf(PropTypes11.shape({
|
|
1376
|
-
start:
|
|
1377
|
-
end:
|
|
1395
|
+
start: momentType.isRequired,
|
|
1396
|
+
end: momentType.isRequired,
|
|
1378
1397
|
x1: PropTypes11.number,
|
|
1379
1398
|
x2: PropTypes11.number,
|
|
1380
1399
|
metrics: PropTypes11.arrayOf(PropTypes11.number).isRequired,
|
|
@@ -1474,8 +1493,8 @@ function XAxis({ min, max: max2, origin, axisWidth, marks, xAxis, classes, arrow
|
|
|
1474
1493
|
XAxis.propTypes = {
|
|
1475
1494
|
axisWidth: PropTypes11.number.isRequired,
|
|
1476
1495
|
classes: PropTypes11.object,
|
|
1477
|
-
min:
|
|
1478
|
-
max:
|
|
1496
|
+
min: momentType,
|
|
1497
|
+
max: momentType,
|
|
1479
1498
|
origin: PropTypes11.shape({
|
|
1480
1499
|
x: PropTypes11.number.isRequired,
|
|
1481
1500
|
y: PropTypes11.number.isRequired
|
|
@@ -1800,8 +1819,8 @@ function HistoTooltip({ metricsDefinition, item, onFormatTimeToolTips, onFormatM
|
|
|
1800
1819
|
HistoTooltip.propTypes = {
|
|
1801
1820
|
classes: PropTypes11.object,
|
|
1802
1821
|
item: PropTypes11.shape({
|
|
1803
|
-
start:
|
|
1804
|
-
end:
|
|
1822
|
+
start: momentType.isRequired,
|
|
1823
|
+
end: momentType.isRequired,
|
|
1805
1824
|
x1: PropTypes11.number,
|
|
1806
1825
|
x2: PropTypes11.number,
|
|
1807
1826
|
metrics: PropTypes11.arrayOf(PropTypes11.number).isRequired,
|
|
@@ -1869,7 +1888,7 @@ QualityLine.propTypes = {
|
|
|
1869
1888
|
xAxis: PropTypes11.func.isRequired,
|
|
1870
1889
|
quality: PropTypes11.shape({
|
|
1871
1890
|
items: PropTypes11.arrayOf(PropTypes11.shape({
|
|
1872
|
-
time:
|
|
1891
|
+
time: momentType.isRequired,
|
|
1873
1892
|
quality: PropTypes11.number.isRequired,
|
|
1874
1893
|
tip: PropTypes11.node
|
|
1875
1894
|
})),
|
|
@@ -2554,13 +2573,17 @@ var TimeLineInner = forwardRef(function TimeLine(props, ref) {
|
|
|
2554
2573
|
ticks,
|
|
2555
2574
|
dragging
|
|
2556
2575
|
} = state;
|
|
2576
|
+
const verticalScaleData = useMemo(() => prepareVerticalScale(), [prepareVerticalScale]);
|
|
2577
|
+
const items = useMemo(
|
|
2578
|
+
() => prepareHistogram({ domain, verticalScale: verticalScaleData.verticalScale }),
|
|
2579
|
+
[prepareHistogram, domain, verticalScaleData, histoWidth]
|
|
2580
|
+
);
|
|
2581
|
+
itemsRef.current = items;
|
|
2557
2582
|
const xAxisHeight = xAxisProp.height || xAxisDefault.height;
|
|
2558
2583
|
const pointZero = { x: 0, y: height - margin.bottom - xAxisHeight };
|
|
2559
2584
|
const originCursor = { x: 0, y: margin.top - 5 };
|
|
2560
2585
|
if (!isFunction(xAxisRef.current)) return null;
|
|
2561
|
-
const { verticalScale, verticalMarks, maxHeight } =
|
|
2562
|
-
const items = prepareHistogram({ domain, verticalScale });
|
|
2563
|
-
itemsRef.current = items;
|
|
2586
|
+
const { verticalScale, verticalMarks, maxHeight } = verticalScaleData;
|
|
2564
2587
|
return /* @__PURE__ */ jsx(
|
|
2565
2588
|
"svg",
|
|
2566
2589
|
{
|