@overdoser/react-toolkit 0.10.1 → 0.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.
@@ -1,111 +1,175 @@
1
- const r = "crk-scroller-kwWVy", a = "crk-inner-vJ0BK", i = "crk-gridline-pcX-9", e = "crk-nowLine-05lmp", c = "crk-cursorLine-k7KZo", s = "crk-eventLine-znElH", t = "crk-axis--LqeF", n = "crk-axisDivider-gBKss", o = "crk-axisSticky-J-rsF", k = "crk-axisUtc-ySg72", d = "crk-axisViewDate-oRqHL", w = "crk-axisViewTime-bL50a", x = "crk-axisTickLabel-9V7QB", l = "crk-axisDateLabel-QPPf7", p = "crk-axisTickMark-HGAZI", g = "crk-axisSubLabel-mmUpt", u = "crk-axisMinorMark-LmQdS", m = "crk-axisMinorMedium-yyNB-", b = "crk-axisChip-Xr9r0", h = "crk-axisChipEvent-K9r-4", L = "crk-lane-hvtL1", v = "crk-axisLine-ZRK0p", y = "crk-bar-pqjsX", T = "crk-barPending-NsYu7", M = "crk-barDot-ZtYdm", B = "crk-stem-24Ud2", D = "crk-elbow-nQxQZ", S = "crk-chip-vC8yf", R = "crk-chipArrow-pyTpt", X = "crk-chipBadge-Tz11H", C = "crk-chipOp-qkIIM", K = "crk-chipTime-IoXbi", U = "crk-drawerCustom-w5gWa", V = "crk-drawerHead-mfyc3", H = "crk-drawerHeadRow-w-lfX", E = "crk-methodBadge-lfL4x", P = "crk-statusBadge-XiUl9", Q = "crk-statusPending-Yg9At", f = "crk-statusError-G7XH8", O = "crk-drawerRoute-L-hK0", I = "crk-drawerSpacer-f6nIh", Z = "crk-drawerUrl-ajRgO", q = "crk-drawerRid-UsUb1", A = "crk-drawerXrid-JEUOj", j = "crk-drawerTiming-FCpcS", F = "crk-drawerBody-Cx5-E", J = "crk-drawerSection-Zjpm1", N = "crk-kvRow-DXfXI", Y = "crk-kvKey-MmSqV", z = "crk-kvKeyQuery-0hpds", G = "crk-kvVal-PlEQT", W = "crk-awaiting-FNO2u", _ = "crk-awaitingDot-b4OtX", $ = {
1
+ const r = "crk-scroller-kwWVy", c = "crk-inner-vJ0BK", o = "crk-gridline-pcX-9", a = "crk-nowLine-05lmp", e = "crk-cursorLine-k7KZo", t = "crk-eventLine-znElH", i = "crk-axis--LqeF", s = "crk-axisDivider-gBKss", n = "crk-axisSticky-J-rsF", d = "crk-axisUtc-ySg72", l = "crk-axisViewDate-oRqHL", k = "crk-axisViewTime-bL50a", g = "crk-axisTickLabel-9V7QB", p = "crk-axisDateLabel-QPPf7", y = "crk-axisTickMark-HGAZI", w = "crk-axisSubLabel-mmUpt", x = "crk-axisMinorMark-LmQdS", h = "crk-axisMinorMedium-yyNB-", b = "crk-axisChip-Xr9r0", m = "crk-axisChipEvent-K9r-4", u = "crk-lane-hvtL1", L = "crk-axisLine-ZRK0p", S = "crk-bar-pqjsX", T = "crk-barPending-NsYu7", v = "crk-barDot-ZtYdm", C = "crk-stem-24Ud2", E = "crk-elbow-nQxQZ", P = "crk-chip-vC8yf", B = "crk-chipArrow-pyTpt", H = "crk-chipBadge-Tz11H", D = "crk-chipOp-qkIIM", R = "crk-chipTime-IoXbi", M = "crk-drawerCustom-w5gWa", A = "crk-drawerHead-mfyc3", K = "crk-drawerHeadRow-w-lfX", U = "crk-methodBadge-lfL4x", V = "crk-statusBadge-XiUl9", X = "crk-statusPending-Yg9At", I = "crk-statusError-G7XH8", F = "crk-drawerRoute-L-hK0", G = "crk-drawerSpacer-f6nIh", Q = "crk-drawerUrl-ajRgO", O = "crk-drawerRid-UsUb1", f = "crk-drawerXrid-JEUOj", Z = "crk-drawerTiming-FCpcS", q = "crk-drawerBody-Cx5-E", J = "crk-drawerSection-Zjpm1", N = "crk-kvRow-DXfXI", j = "crk-kvKey-MmSqV", z = "crk-kvKeyQuery-0hpds", W = "crk-kvVal-PlEQT", Y = "crk-awaiting-FNO2u", _ = "crk-awaitingDot-b4OtX", $ = "crk-dockCol-4dgEp", rr = "crk-dockColResizer-qUAce", cr = "crk-cardFlushRight-QGTEx", or = "crk-dockAside-Q-I1l", ar = "crk-dockHead-kyJbl", er = "crk-dockTitle-aZfap", tr = "crk-dockCount-sTZG3", ir = "crk-dockScroll-EbMO5", sr = "crk-dockEmpty-4I13b", nr = "crk-bodyHead-IAsVD", dr = "crk-bodyLabel-QeGYK", lr = "crk-payloadCopy-5FM-J", kr = "crk-logEntry-eASJr", gr = "crk-copyStop-aE-Th", pr = "crk-logBody-X2Ftb", yr = "crk-logEntrySelected-AdHlH", wr = "crk-logEntryFlash-26ElD", xr = "crk-logTop-48t09", hr = "crk-logNum-1-eb7", br = "crk-badgeSm-vw04n", mr = "crk-logPair-i-P-t", ur = "crk-logClock-mrTdy", Lr = "crk-logOp-qfkTp", Sr = "crk-logPath-eHd2Z", Tr = "crk-logPayloadHead-jKUKx", vr = "crk-logPayloadLabel-wteWa", Cr = "crk-logPre-8h-ke", Er = "crk-rail-IIJaP", Pr = "crk-railBtn-WNtG7", Br = "crk-railBtnActive-HnV74", Hr = "crk-railGlyphDetails-h8Ip-", Dr = "crk-railGlyphLog-auInm", Rr = {
2
2
  scroller: r,
3
- inner: a,
4
- gridline: i,
5
- nowLine: e,
6
- cursorLine: c,
7
- eventLine: s,
8
- axis: t,
9
- axisDivider: n,
10
- axisSticky: o,
11
- axisUtc: k,
12
- axisViewDate: d,
13
- axisViewTime: w,
14
- axisTickLabel: x,
15
- axisDateLabel: l,
16
- axisTickMark: p,
17
- axisSubLabel: g,
18
- axisMinorMark: u,
19
- axisMinorMedium: m,
3
+ inner: c,
4
+ gridline: o,
5
+ nowLine: a,
6
+ cursorLine: e,
7
+ eventLine: t,
8
+ axis: i,
9
+ axisDivider: s,
10
+ axisSticky: n,
11
+ axisUtc: d,
12
+ axisViewDate: l,
13
+ axisViewTime: k,
14
+ axisTickLabel: g,
15
+ axisDateLabel: p,
16
+ axisTickMark: y,
17
+ axisSubLabel: w,
18
+ axisMinorMark: x,
19
+ axisMinorMedium: h,
20
20
  axisChip: b,
21
- axisChipEvent: h,
22
- lane: L,
23
- axisLine: v,
24
- bar: y,
21
+ axisChipEvent: m,
22
+ lane: u,
23
+ axisLine: L,
24
+ bar: S,
25
25
  barPending: T,
26
- barDot: M,
27
- stem: B,
28
- elbow: D,
29
- chip: S,
30
- chipArrow: R,
31
- chipBadge: X,
32
- chipOp: C,
33
- chipTime: K,
34
- drawerCustom: U,
35
- drawerHead: V,
36
- drawerHeadRow: H,
37
- methodBadge: E,
38
- statusBadge: P,
39
- statusPending: Q,
40
- statusError: f,
41
- drawerRoute: O,
42
- drawerSpacer: I,
43
- drawerUrl: Z,
44
- drawerRid: q,
45
- drawerXrid: A,
46
- drawerTiming: j,
47
- drawerBody: F,
26
+ barDot: v,
27
+ stem: C,
28
+ elbow: E,
29
+ chip: P,
30
+ chipArrow: B,
31
+ chipBadge: H,
32
+ chipOp: D,
33
+ chipTime: R,
34
+ drawerCustom: M,
35
+ drawerHead: A,
36
+ drawerHeadRow: K,
37
+ methodBadge: U,
38
+ statusBadge: V,
39
+ statusPending: X,
40
+ statusError: I,
41
+ drawerRoute: F,
42
+ drawerSpacer: G,
43
+ drawerUrl: Q,
44
+ drawerRid: O,
45
+ drawerXrid: f,
46
+ drawerTiming: Z,
47
+ drawerBody: q,
48
48
  drawerSection: J,
49
49
  kvRow: N,
50
- kvKey: Y,
50
+ kvKey: j,
51
51
  kvKeyQuery: z,
52
- kvVal: G,
53
- awaiting: W,
54
- awaitingDot: _
52
+ kvVal: W,
53
+ awaiting: Y,
54
+ awaitingDot: _,
55
+ dockCol: $,
56
+ dockColResizer: rr,
57
+ cardFlushRight: cr,
58
+ dockAside: or,
59
+ dockHead: ar,
60
+ dockTitle: er,
61
+ dockCount: tr,
62
+ dockScroll: ir,
63
+ dockEmpty: sr,
64
+ bodyHead: nr,
65
+ bodyLabel: dr,
66
+ payloadCopy: lr,
67
+ logEntry: kr,
68
+ copyStop: gr,
69
+ logBody: pr,
70
+ logEntrySelected: yr,
71
+ logEntryFlash: wr,
72
+ logTop: xr,
73
+ logNum: hr,
74
+ badgeSm: br,
75
+ logPair: mr,
76
+ logClock: ur,
77
+ logOp: Lr,
78
+ logPath: Sr,
79
+ logPayloadHead: Tr,
80
+ logPayloadLabel: vr,
81
+ logPre: Cr,
82
+ rail: Er,
83
+ railBtn: Pr,
84
+ railBtnActive: Br,
85
+ railGlyphDetails: Hr,
86
+ railGlyphLog: Dr
55
87
  };
56
88
  export {
57
- W as awaiting,
89
+ Y as awaiting,
58
90
  _ as awaitingDot,
59
- t as axis,
91
+ i as axis,
60
92
  b as axisChip,
61
- h as axisChipEvent,
62
- l as axisDateLabel,
63
- n as axisDivider,
64
- v as axisLine,
65
- u as axisMinorMark,
66
- m as axisMinorMedium,
67
- o as axisSticky,
68
- g as axisSubLabel,
69
- x as axisTickLabel,
70
- p as axisTickMark,
71
- k as axisUtc,
72
- d as axisViewDate,
73
- w as axisViewTime,
74
- y as bar,
75
- M as barDot,
93
+ m as axisChipEvent,
94
+ p as axisDateLabel,
95
+ s as axisDivider,
96
+ L as axisLine,
97
+ x as axisMinorMark,
98
+ h as axisMinorMedium,
99
+ n as axisSticky,
100
+ w as axisSubLabel,
101
+ g as axisTickLabel,
102
+ y as axisTickMark,
103
+ d as axisUtc,
104
+ l as axisViewDate,
105
+ k as axisViewTime,
106
+ br as badgeSm,
107
+ S as bar,
108
+ v as barDot,
76
109
  T as barPending,
77
- S as chip,
78
- R as chipArrow,
79
- X as chipBadge,
80
- C as chipOp,
81
- K as chipTime,
82
- c as cursorLine,
83
- $ as default,
84
- F as drawerBody,
85
- U as drawerCustom,
86
- V as drawerHead,
87
- H as drawerHeadRow,
88
- q as drawerRid,
89
- O as drawerRoute,
110
+ nr as bodyHead,
111
+ dr as bodyLabel,
112
+ cr as cardFlushRight,
113
+ P as chip,
114
+ B as chipArrow,
115
+ H as chipBadge,
116
+ D as chipOp,
117
+ R as chipTime,
118
+ gr as copyStop,
119
+ e as cursorLine,
120
+ Rr as default,
121
+ or as dockAside,
122
+ $ as dockCol,
123
+ rr as dockColResizer,
124
+ tr as dockCount,
125
+ sr as dockEmpty,
126
+ ar as dockHead,
127
+ ir as dockScroll,
128
+ er as dockTitle,
129
+ q as drawerBody,
130
+ M as drawerCustom,
131
+ A as drawerHead,
132
+ K as drawerHeadRow,
133
+ O as drawerRid,
134
+ F as drawerRoute,
90
135
  J as drawerSection,
91
- I as drawerSpacer,
92
- j as drawerTiming,
93
- Z as drawerUrl,
94
- A as drawerXrid,
95
- D as elbow,
96
- s as eventLine,
97
- i as gridline,
98
- a as inner,
99
- Y as kvKey,
136
+ G as drawerSpacer,
137
+ Z as drawerTiming,
138
+ Q as drawerUrl,
139
+ f as drawerXrid,
140
+ E as elbow,
141
+ t as eventLine,
142
+ o as gridline,
143
+ c as inner,
144
+ j as kvKey,
100
145
  z as kvKeyQuery,
101
146
  N as kvRow,
102
- G as kvVal,
103
- L as lane,
104
- E as methodBadge,
105
- e as nowLine,
147
+ W as kvVal,
148
+ u as lane,
149
+ pr as logBody,
150
+ ur as logClock,
151
+ kr as logEntry,
152
+ wr as logEntryFlash,
153
+ yr as logEntrySelected,
154
+ hr as logNum,
155
+ Lr as logOp,
156
+ mr as logPair,
157
+ Sr as logPath,
158
+ Tr as logPayloadHead,
159
+ vr as logPayloadLabel,
160
+ Cr as logPre,
161
+ xr as logTop,
162
+ U as methodBadge,
163
+ a as nowLine,
164
+ lr as payloadCopy,
165
+ Er as rail,
166
+ Pr as railBtn,
167
+ Br as railBtnActive,
168
+ Hr as railGlyphDetails,
169
+ Dr as railGlyphLog,
106
170
  r as scroller,
107
- P as statusBadge,
108
- f as statusError,
109
- Q as statusPending,
110
- B as stem
171
+ V as statusBadge,
172
+ I as statusError,
173
+ X as statusPending,
174
+ C as stem
111
175
  };
@@ -1,6 +1,7 @@
1
1
  export type { TimelineSummaryPlacement } from './TimelineShared';
2
+ export type { TimelineWheelZoom } from './useTimeline';
2
3
  export { TraceTimeline } from './TraceTimeline';
3
- export type { TraceTimelineProps, TraceTimelineEvent, TraceTimelineClasses, TraceTimelineItemContext, } from './TraceTimeline';
4
+ export type { TraceTimelineProps, TraceTimelineEvent, TraceTimelineClasses, TraceTimelineDock, TraceTimelineItemContext, } from './TraceTimeline';
4
5
  export { HistoryTimeline } from './HistoryTimeline';
5
6
  export type { HistoryTimelineProps, HistoryTimelineEvent, HistoryTimelineClasses, HistoryTimelineOrientation, HistoryTimelineSpacing, HistoryTimelineItemContext, } from './HistoryTimeline';
6
7
  export { GanttTimeline } from './GanttTimeline';
@@ -30,6 +30,17 @@ export declare function animateScrollTo(el: HTMLElement, target: {
30
30
  left?: number;
31
31
  top?: number;
32
32
  }, duration?: number): void;
33
+ /**
34
+ * How the wheel interacts with timeline zoom. `'ctrl'` (the timelines'
35
+ * default) zooms only while Ctrl/Cmd is held — plain scrolling passes
36
+ * through to the page, and trackpad pinch keeps zooming since browsers
37
+ * report it as a `ctrlKey` wheel. `'free'` zooms on any wheel/trackpad
38
+ * scroll over the canvas, and `'none'` never wheel-zooms (the toolbar zoom
39
+ * buttons still work).
40
+ */
41
+ export type TimelineWheelZoom = 'free' | 'ctrl' | 'none';
42
+ /** True when a wheel event should zoom under the given mode. */
43
+ export declare function wheelZoomAllowed(mode: TimelineWheelZoom, e: WheelEvent): boolean;
33
44
  /**
34
45
  * Attach a non-passive wheel listener (plain mouse wheel zooms; the default
35
46
  * scroll must be preventable, which React's synthetic onWheel cannot do).
@@ -1,5 +1,5 @@
1
- import { useState as E, useEffect as v, useRef as h, useCallback as p } from "react";
2
- function b(e) {
1
+ import { useState as y, useEffect as v, useRef as h, useCallback as p } from "react";
2
+ function W(e) {
3
3
  const n = h(null), o = h(!1), r = p(
4
4
  (i) => {
5
5
  const c = e.current;
@@ -8,21 +8,21 @@ function b(e) {
8
8
  [e]
9
9
  ), t = p(
10
10
  (i) => {
11
- const c = n.current, l = e.current;
12
- if (!c || !l) return;
13
- const a = i.clientX - c.x, f = i.clientY - c.y;
14
- Math.abs(a) + Math.abs(f) > 5 && (c.moved = !0), l.scrollLeft = c.l - a, l.scrollTop = c.t - f;
11
+ const c = n.current, u = e.current;
12
+ if (!c || !u) return;
13
+ const d = i.clientX - c.x, f = i.clientY - c.y;
14
+ Math.abs(d) + Math.abs(f) > 5 && (c.moved = !0), u.scrollLeft = c.l - d, u.scrollTop = c.t - f;
15
15
  },
16
16
  [e]
17
17
  ), s = p(() => {
18
18
  n.current && n.current.moved && (o.current = !0, setTimeout(() => {
19
19
  o.current = !1;
20
20
  }, 60)), n.current = null;
21
- }, []), u = p(() => o.current, []);
22
- return { onPointerDown: r, onPointerMove: t, onPointerUp: s, wasDragSuppressed: u };
21
+ }, []), l = p(() => o.current, []);
22
+ return { onPointerDown: r, onPointerMove: t, onPointerUp: s, wasDragSuppressed: l };
23
23
  }
24
- function y(e, n = 1100) {
25
- const [o, r] = E(n);
24
+ function b(e, n = 1100) {
25
+ const [o, r] = y(n);
26
26
  return v(() => {
27
27
  const t = e.current;
28
28
  if (!t) return;
@@ -32,50 +32,54 @@ function y(e, n = 1100) {
32
32
  return s.observe(t), t.clientWidth && r(t.clientWidth), () => s.disconnect();
33
33
  }, [e]), o;
34
34
  }
35
- function D(e, n = 450) {
36
- const [o, r] = E(() => Date.now());
35
+ function A(e, n = 450) {
36
+ const [o, r] = y(() => Date.now());
37
37
  return v(() => {
38
38
  if (!e) return;
39
39
  const t = setInterval(() => r(Date.now()), n);
40
40
  return () => clearInterval(t);
41
41
  }, [e, n]), e ? o : Date.now();
42
42
  }
43
- const m = /* @__PURE__ */ new WeakMap();
44
- function x(e, n, o = 900) {
45
- const r = m.get(e);
43
+ const w = /* @__PURE__ */ new WeakMap();
44
+ function D(e, n, o = 900) {
45
+ const r = w.get(e);
46
46
  r != null && cancelAnimationFrame(r);
47
- const t = e.scrollLeft, s = e.scrollTop, u = n.left != null ? n.left - t : 0, i = n.top != null ? n.top - s : 0;
48
- if (!u && !i) return;
47
+ const t = e.scrollLeft, s = e.scrollTop, l = n.left != null ? n.left - t : 0, i = n.top != null ? n.top - s : 0;
48
+ if (!l && !i) return;
49
49
  if (typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches || o <= 0) {
50
50
  n.left != null && (e.scrollLeft = n.left), n.top != null && (e.scrollTop = n.top);
51
51
  return;
52
52
  }
53
- const l = performance.now(), a = (w) => 1 - Math.pow(1 - w, 3);
53
+ const u = performance.now(), d = (m) => 1 - Math.pow(1 - m, 3);
54
54
  let f = !1;
55
- const d = () => {
56
- f = !0, e.removeEventListener("wheel", d), e.removeEventListener("pointerdown", d), m.delete(e);
55
+ const a = () => {
56
+ f = !0, e.removeEventListener("wheel", a), e.removeEventListener("pointerdown", a), w.delete(e);
57
57
  };
58
- e.addEventListener("wheel", d, { once: !0 }), e.addEventListener("pointerdown", d, { once: !0 });
59
- const L = (w) => {
58
+ e.addEventListener("wheel", a, { once: !0 }), e.addEventListener("pointerdown", a, { once: !0 });
59
+ const L = (m) => {
60
60
  if (f) return;
61
- const T = Math.min(1, (w - l) / o), M = a(T);
62
- n.left != null && (e.scrollLeft = t + u * M), n.top != null && (e.scrollTop = s + i * M), T < 1 ? m.set(e, requestAnimationFrame(L)) : d();
61
+ const T = Math.min(1, (m - u) / o), M = d(T);
62
+ n.left != null && (e.scrollLeft = t + l * M), n.top != null && (e.scrollTop = s + i * M), T < 1 ? w.set(e, requestAnimationFrame(L)) : a();
63
63
  };
64
- m.set(e, requestAnimationFrame(L));
64
+ w.set(e, requestAnimationFrame(L));
65
65
  }
66
- function A(e, n, o) {
66
+ function x(e, n) {
67
+ return e === "free" || e === "ctrl" && (n.ctrlKey || n.metaKey);
68
+ }
69
+ function P(e, n, o) {
67
70
  const r = h(n);
68
71
  r.current = n, v(() => {
69
72
  const t = e.current;
70
73
  if (!t) return;
71
- const s = (u) => r.current(u);
74
+ const s = (l) => r.current(l);
72
75
  return t.addEventListener("wheel", s, { passive: !1 }), () => t.removeEventListener("wheel", s);
73
76
  }, [e, o]);
74
77
  }
75
78
  export {
76
- x as animateScrollTo,
77
- y as useContainerWidth,
78
- D as useNowTicker,
79
- b as useTimelinePan,
80
- A as useWheelZoom
79
+ D as animateScrollTo,
80
+ b as useContainerWidth,
81
+ A as useNowTicker,
82
+ W as useTimelinePan,
83
+ P as useWheelZoom,
84
+ x as wheelZoomAllowed
81
85
  };