@spider-analyzer/timeline 4.0.3 → 5.0.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 (76) hide show
  1. package/CHANGELOG.md +70 -1
  2. package/README.md +275 -637
  3. package/dist/index.d.mts +132 -0
  4. package/dist/index.d.ts +132 -0
  5. package/dist/index.js +2913 -22
  6. package/dist/index.js.map +1 -0
  7. package/dist/index.mjs +2906 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/dist/timeline-EX2XZ6IP.css +139 -0
  10. package/package.json +48 -15
  11. package/src/Cursor.jsx +5 -13
  12. package/src/TimeLine.tsx +994 -0
  13. package/src/TimeLineResizer.jsx +2 -8
  14. package/src/ToolTip.jsx +7 -7
  15. package/src/cursorElements/CursorIcon.jsx +6 -29
  16. package/src/cursorElements/CursorSelection.jsx +4 -19
  17. package/src/cursorElements/DragOverlay.jsx +2 -12
  18. package/src/cursorElements/LeftHandle.jsx +3 -19
  19. package/src/cursorElements/LeftToolTip.jsx +2 -7
  20. package/src/cursorElements/RightHandle.jsx +3 -19
  21. package/src/cursorElements/RightToolTip.jsx +4 -13
  22. package/src/cursorElements/ZoomIn.jsx +5 -25
  23. package/src/cursorElements/ZoomOut.jsx +4 -21
  24. package/src/cursorElements/utils.js +1 -1
  25. package/src/index.js +6 -0
  26. package/src/index.ts +158 -0
  27. package/src/moment-shim.ts +169 -0
  28. package/src/styles.ts +15 -0
  29. package/src/time.ts +52 -0
  30. package/src/timeLineElements/Button.jsx +5 -30
  31. package/src/timeLineElements/HistoToolTip.jsx +3 -17
  32. package/src/timeLineElements/Histogram.jsx +4 -16
  33. package/src/timeLineElements/Legend.jsx +2 -16
  34. package/src/timeLineElements/QualityLine.jsx +4 -11
  35. package/src/timeLineElements/Tools.jsx +1 -1
  36. package/src/timeLineElements/XAxis.jsx +5 -8
  37. package/src/timeLineElements/XGrid.jsx +3 -7
  38. package/src/timeLineElements/YAxis.jsx +4 -7
  39. package/src/timeLineElements/YGrid.jsx +2 -6
  40. package/src/timeLineElements/axesStyles.jsx +0 -49
  41. package/src/timeline.css +139 -0
  42. package/src/utils.ts +60 -0
  43. package/.babelrc +0 -8
  44. package/.gitlab-ci.yml +0 -27
  45. package/Makefile +0 -20
  46. package/dist/Cursor.js +0 -290
  47. package/dist/TimeLine.js +0 -1177
  48. package/dist/TimeLineResizer.js +0 -70
  49. package/dist/ToolTip.js +0 -43
  50. package/dist/cursorElements/CursorIcon.js +0 -98
  51. package/dist/cursorElements/CursorSelection.js +0 -179
  52. package/dist/cursorElements/DragOverlay.js +0 -168
  53. package/dist/cursorElements/LeftHandle.js +0 -95
  54. package/dist/cursorElements/LeftToolTip.js +0 -70
  55. package/dist/cursorElements/RightHandle.js +0 -95
  56. package/dist/cursorElements/RightToolTip.js +0 -75
  57. package/dist/cursorElements/ZoomIn.js +0 -93
  58. package/dist/cursorElements/ZoomOut.js +0 -67
  59. package/dist/cursorElements/commonStyles.js +0 -28
  60. package/dist/cursorElements/handleHistoHovering.js +0 -79
  61. package/dist/cursorElements/utils.js +0 -30
  62. package/dist/theme.js +0 -59
  63. package/dist/timeLineElements/Button.js +0 -101
  64. package/dist/timeLineElements/HistoToolTip.js +0 -78
  65. package/dist/timeLineElements/Histogram.js +0 -110
  66. package/dist/timeLineElements/Legend.js +0 -70
  67. package/dist/timeLineElements/QualityLine.js +0 -81
  68. package/dist/timeLineElements/Tools.js +0 -115
  69. package/dist/timeLineElements/XAxis.js +0 -76
  70. package/dist/timeLineElements/XGrid.js +0 -47
  71. package/dist/timeLineElements/YAxis.js +0 -60
  72. package/dist/timeLineElements/YGrid.js +0 -46
  73. package/dist/timeLineElements/axesStyles.js +0 -57
  74. package/src/TimeLine.jsx +0 -1163
  75. package/src/cursorElements/commonStyles.js +0 -21
  76. /package/dist/{tipDark.css → tipDark-BQEJ43KY.css} +0 -0
@@ -0,0 +1,139 @@
1
+ /* @spider-analyzer/timeline — default stylesheet.
2
+ *
3
+ * Every rule is keyed on a `tl-<slot>` class. Consumers override by
4
+ * passing `classes={{ <slot>: 'my-class' }}` — the component emits
5
+ * `tl-<slot> my-class` together, so any CSS in `.my-class` wins via
6
+ * normal specificity / source order.
7
+ */
8
+
9
+ /* Layout */
10
+ .tl-timelineContainer { width: 100%; height: 100%; }
11
+
12
+ /* Axes / grid */
13
+ .tl-axis { fill: none; stroke: #b4b4b4; stroke-width: 1; }
14
+ .tl-arrow { fill: #b4b4b4; fill-opacity: 1; stroke: #b4b4b4; stroke-width: 1; }
15
+ .tl-now { fill: #545454; stroke: #545454; stroke-width: 1; }
16
+ .tl-grid { stroke: #ececec; stroke-width: 1; }
17
+ .tl-limitMarker { stroke: #b4b4b4; stroke-width: 1; }
18
+ .tl-timeAxisText {
19
+ font-size: 10px;
20
+ font-family: Roboto, sans-serif;
21
+ fill: #b4b4b4;
22
+ text-align: center;
23
+ text-anchor: middle;
24
+ user-select: none;
25
+ }
26
+ .tl-timeAxisDaysText { fill: #545454; }
27
+ .tl-verticalAxisText {
28
+ font-size: 10px;
29
+ font-family: Roboto, sans-serif;
30
+ fill: #b4b4b4;
31
+ text-align: end;
32
+ text-anchor: end;
33
+ user-select: none;
34
+ }
35
+
36
+ /* Legend */
37
+ .tl-legend {
38
+ font-size: 12.5px;
39
+ line-height: 125%;
40
+ font-family: Roboto, sans-serif;
41
+ fill-opacity: 1;
42
+ stroke: none;
43
+ text-align: end;
44
+ text-anchor: end;
45
+ user-select: none;
46
+ }
47
+
48
+ /* Histogram */
49
+ .tl-histoItem { fill-opacity: 1; stroke-width: 1; }
50
+ .tl-histoHovered { stroke-width: 0; fill: #000000; fill-opacity: 0.3; }
51
+
52
+ /* Histo tooltip */
53
+ .tl-innerTipMetrics { margin-top: 4px; }
54
+ .tl-innerTipLeft { margin-right: 4px; display: inline-block; }
55
+ .tl-innerTipRight { display: inline-block; float: right; }
56
+
57
+ /* Quality line */
58
+ .tl-qualityCell { stroke-width: 0; }
59
+
60
+ /* Buttons */
61
+ .tl-buttonGroup { cursor: pointer; }
62
+ .tl-buttonGroupInactive { cursor: not-allowed; }
63
+ .tl-buttonOverShape { fill: transparent; }
64
+ .tl-buttonIcon {
65
+ fill: #b4b4b4; fill-opacity: 1;
66
+ stroke: #b4b4b4; stroke-width: 1; stroke-opacity: 1;
67
+ }
68
+ .tl-buttonIconOver { fill: #ff8080; stroke: #ff8080; }
69
+
70
+ /* Cursor selection */
71
+ .tl-cursorArea {
72
+ fill: #00BCD4;
73
+ fill-opacity: 0.2;
74
+ stroke: #00BCD4;
75
+ stroke-width: 1px;
76
+ stroke-linecap: butt;
77
+ stroke-linejoin: miter;
78
+ stroke-opacity: 1;
79
+ cursor: move;
80
+ transition: fill 0.5s, stroke 0.5s;
81
+ }
82
+ .tl-cursorArea.tl--maxSize { stroke: #00899f; }
83
+
84
+ /* Cursor handles */
85
+ .tl-cursorLeftHandle, .tl-cursorRightHandle {
86
+ fill-opacity: 1;
87
+ stroke-width: 1px;
88
+ transition: r 0.5s;
89
+ r: 4;
90
+ fill: #ffffff;
91
+ stroke: #00BCD4;
92
+ cursor: ew-resize;
93
+ }
94
+ .tl-cursorLeftHandle:hover, .tl-cursorRightHandle:hover { r: 8; }
95
+ .tl-cursorLeftHandle.tl--maxSize { cursor: e-resize; }
96
+ .tl-cursorRightHandle.tl--maxSize { cursor: w-resize; }
97
+ .tl-cursorLeftHandle.tl--outOfView,
98
+ .tl-cursorRightHandle.tl--outOfView {
99
+ fill: #ececec;
100
+ stroke: #b4b4b4;
101
+ }
102
+
103
+ /* Drag overlay */
104
+ .tl-dragOverlay { fill: transparent; fill-opacity: 1; stroke: none; cursor: crosshair; }
105
+
106
+ /* Cursor icon (offscreen indicator) */
107
+ .tl-cursorIconRect { fill: #00bcd4; fill-opacity: 0.25; stroke: #00bcd4; stroke-width: 0.42; }
108
+ .tl-cursorIconCircle { fill: #ffffff; stroke: #00bcd4; stroke-width: 0.52; }
109
+ .tl-cursorIconRectOver { fill: #ff8080; stroke: #e7594f; }
110
+ .tl-cursorIconCircleOver { stroke: #e7594f; }
111
+
112
+ /* Zoom buttons */
113
+ .tl-zoomIn { fill: #00BCD4; fill-opacity: 1; stroke: none; }
114
+ .tl-zoomOut { fill: #ff816b; fill-opacity: 1; stroke: none; }
115
+ .tl-zoomArea { fill: transparent; fill-opacity: 1; stroke: none; }
116
+ .tl-zoomInContainer {
117
+ opacity: 0;
118
+ visibility: hidden;
119
+ transition: opacity 0.5s, visibility 0.5s;
120
+ cursor: pointer;
121
+ }
122
+ .tl-zoomOutContainer { cursor: pointer; }
123
+
124
+ /* Tooltips (cursor start/stop) */
125
+ .tl-toolTipArea { opacity: 0; visibility: hidden; transition: opacity 0.25s, visibility 0.25s; }
126
+ .tl-toolTip {
127
+ fill: #1a1a1a;
128
+ fill-opacity: 0.80;
129
+ stroke: #ffffff;
130
+ stroke-opacity: 1;
131
+ stroke-width: 0.1;
132
+ stroke-miterlimit: 1.3;
133
+ }
134
+ .tl-toolTipText {
135
+ font-size: 12.5px;
136
+ font-family: Roboto, sans-serif;
137
+ fill: #ffffff;
138
+ }
139
+ .tl-toolTipTextRight { text-align: end; text-anchor: end; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spider-analyzer/timeline",
3
- "version": "4.0.3",
3
+ "version": "5.0.0",
4
4
  "description": "React graphical component to display metric over time with a time selection feature.",
5
5
  "author": "Thibaut Raballand <spider.analyzer@gmail.com> (https://spider-analyzer.io)",
6
6
  "license": "MIT",
@@ -24,21 +24,42 @@
24
24
  },
25
25
  "homepage": "https://gitlab.com/TincaTibo/timeline",
26
26
  "main": "dist/index.js",
27
+ "module": "dist/index.mjs",
28
+ "types": "dist/index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.mjs",
33
+ "require": "./dist/index.js"
34
+ },
35
+ "./package.json": "./package.json"
36
+ },
37
+ "sideEffects": [
38
+ "**/*.css"
39
+ ],
40
+ "files": [
41
+ "dist",
42
+ "src",
43
+ "CHANGELOG.md",
44
+ "README.md",
45
+ "LICENSE"
46
+ ],
27
47
  "scripts": {
28
48
  "clean": "rimraf dist",
29
- "build:babel": "babel src -d dist --copy-files",
30
- "build": "npm run clean && npm run build:babel"
49
+ "build": "tsup",
50
+ "test": "vitest run",
51
+ "test:watch": "vitest",
52
+ "typecheck": "tsc --noEmit"
31
53
  },
32
54
  "dependencies": {
33
55
  "clsx": "^1.1.1",
34
56
  "d3-drag": "^3.0.0",
35
- "d3-scale": "^4.0.0",
57
+ "d3-scale": "^4.0.2",
36
58
  "d3-selection": "^3.0.0",
37
- "d3-time": "^3.0.0",
38
- "lodash-es": "^4.17.21",
39
- "moment-timezone": "^0.5.45",
59
+ "d3-time": "^3.1.0",
60
+ "luxon": "^3.7.2",
40
61
  "prop-types": "^15.7.2",
41
- "rc-tooltip": "^5.1.0"
62
+ "rc-tooltip": "^6.4.0"
42
63
  },
43
64
  "devDependencies": {
44
65
  "@babel/cli": "^7.14.8",
@@ -48,14 +69,26 @@
48
69
  "@babel/plugin-transform-react-jsx": "^7.14.9",
49
70
  "@babel/preset-env": "^7.15.0",
50
71
  "@babel/preset-react": "^7.14.5",
51
- "@material-ui/styles": "^4.11.4",
52
- "react": "^16.14.0",
53
- "react-dom": "^16.14.0",
54
- "rimraf": "^3.0.2"
72
+ "@babel/preset-typescript": "^7.28.5",
73
+ "@testing-library/dom": "^10.4.1",
74
+ "@testing-library/jest-dom": "^6.9.1",
75
+ "@testing-library/react": "^16.3.2",
76
+ "@testing-library/user-event": "^14.6.1",
77
+ "@types/d3-scale": "^4.0.9",
78
+ "@types/luxon": "^3.7.1",
79
+ "@types/react": "^18.3.28",
80
+ "@types/react-dom": "^18.3.7",
81
+ "@vitejs/plugin-react": "^4.7.0",
82
+ "jsdom": "^25.0.1",
83
+ "react": "^18.3.1",
84
+ "react-dom": "^18.3.1",
85
+ "rimraf": "^3.0.2",
86
+ "tsup": "^8.5.1",
87
+ "typescript": "^5.9.3",
88
+ "vitest": "^2.1.9"
55
89
  },
56
90
  "peerDependencies": {
57
- "@material-ui/styles": "^4.0.0",
58
- "react": "^15.0.0 || ^16.0.0 || ^17.0.0",
59
- "react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0"
91
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
92
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
60
93
  }
61
94
  }
package/src/Cursor.jsx CHANGED
@@ -12,21 +12,21 @@ import RightHandle from './cursorElements/RightHandle';
12
12
  import ZoomIn from './cursorElements/ZoomIn';
13
13
  import LeftToolTip from './cursorElements/LeftToolTip';
14
14
  import RightToolTip from './cursorElements/RightToolTip';
15
- import moment from 'moment-timezone';
15
+ import moment from './moment-shim';
16
16
 
17
17
  export default function Cursor({
18
18
  overlayWidth, overlayHeight,
19
- items, setBarHovered, setToolTipVisible, showHistoToolTip, tooltipVisible, barHovered,
20
- dragging, setDragging,
19
+ items, setBarHovered = identity, setToolTipVisible = identity, showHistoToolTip, tooltipVisible, barHovered,
20
+ dragging, setDragging = identity,
21
21
  origin, height,
22
22
  startPos, endPos,
23
23
  canZoom, minZoom, maxZoom, maxSize,
24
24
  zoomOutLabel, zoomOut,
25
25
  cursorIsAfterView, cursorIsBeforeView,
26
26
  gotoCursorLabel, onGotoCursor,
27
- rcToolTipPrefixCls, classes,
27
+ rcToolTipPrefixCls, classes = {},
28
28
  onStartDrawCursor, onDrawCursor, onEndCursor,
29
- onMoveDomain, onMovedDomain, onDragCursor, onEndDragCursor,
29
+ onMoveDomain = identity, onMovedDomain = identity, onDragCursor, onEndDragCursor,
30
30
  startText, stopText,
31
31
  zoomInLabel, zoomIn,
32
32
  startIsOutOfView, endIsOutOfView, tools,
@@ -268,11 +268,3 @@ Cursor.propTypes = {
268
268
 
269
269
  const identity = () => {};
270
270
 
271
- Cursor.defaultProps = {
272
- classes: {},
273
- onMoveDomain: identity,
274
- onMovedDomain: identity,
275
- setBarHovered: identity,
276
- setToolTipVisible: identity,
277
- setDragging: identity,
278
- }