@overdoser/react-toolkit 0.11.0 → 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,4 +1,4 @@
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", l = "crk-axisUtc-ySg72", d = "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", b = "crk-axisMinorMedium-yyNB-", h = "crk-axisChip-Xr9r0", m = "crk-axisChipEvent-K9r-4", u = "crk-lane-hvtL1", L = "crk-axisLine-ZRK0p", v = "crk-bar-pqjsX", S = "crk-barPending-NsYu7", T = "crk-barDot-ZtYdm", P = "crk-stem-24Ud2", B = "crk-elbow-nQxQZ", E = "crk-chip-vC8yf", H = "crk-chipArrow-pyTpt", C = "crk-chipBadge-Tz11H", D = "crk-chipOp-qkIIM", M = "crk-chipTime-IoXbi", A = "crk-drawerCustom-w5gWa", K = "crk-drawerHead-mfyc3", R = "crk-drawerHeadRow-w-lfX", V = "crk-methodBadge-lfL4x", X = "crk-statusBadge-XiUl9", I = "crk-statusPending-Yg9At", U = "crk-statusError-G7XH8", G = "crk-drawerRoute-L-hK0", O = "crk-drawerSpacer-f6nIh", Q = "crk-drawerUrl-ajRgO", f = "crk-drawerRid-UsUb1", F = "crk-drawerXrid-JEUOj", Z = "crk-drawerTiming-FCpcS", N = "crk-drawerBody-Cx5-E", q = "crk-drawerSection-Zjpm1", J = "crk-kvRow-DXfXI", j = "crk-kvKey-MmSqV", W = "crk-kvKeyQuery-0hpds", Y = "crk-kvVal-PlEQT", z = "crk-awaiting-FNO2u", _ = "crk-awaitingDot-b4OtX", $ = "crk-dockAside-Q-I1l", rr = "crk-dockHead-kyJbl", cr = "crk-dockTitle-aZfap", or = "crk-dockCount-sTZG3", ar = "crk-dockScroll-EbMO5", er = "crk-dockEmpty-4I13b", tr = "crk-bodyHead-IAsVD", ir = "crk-bodyLabel-QeGYK", sr = "crk-payloadCopy-5FM-J", nr = "crk-copyStop-aE-Th", lr = "crk-logAside-Nmqov", dr = "crk-logBody-X2Ftb", kr = "crk-logEntry-eASJr", gr = "crk-logEntrySelected-AdHlH", pr = "crk-logEntryFlash-26ElD", yr = "crk-logTop-48t09", wr = "crk-logNum-1-eb7", xr = "crk-badgeSm-vw04n", br = "crk-logPair-i-P-t", hr = "crk-logClock-mrTdy", mr = "crk-logOp-qfkTp", ur = "crk-logPath-eHd2Z", Lr = "crk-logPayloadHead-jKUKx", vr = "crk-logPayloadLabel-wteWa", Sr = "crk-logPre-8h-ke", Tr = "crk-rail-IIJaP", Pr = "crk-railBtn-WNtG7", Br = "crk-railBtnActive-HnV74", Er = "crk-railGlyphDetails-h8Ip-", Hr = "crk-railGlyphLog-auInm", Cr = {
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
3
  inner: c,
4
4
  gridline: o,
@@ -8,164 +8,168 @@ const r = "crk-scroller-kwWVy", c = "crk-inner-vJ0BK", o = "crk-gridline-pcX-9",
8
8
  axis: i,
9
9
  axisDivider: s,
10
10
  axisSticky: n,
11
- axisUtc: l,
12
- axisViewDate: d,
11
+ axisUtc: d,
12
+ axisViewDate: l,
13
13
  axisViewTime: k,
14
14
  axisTickLabel: g,
15
15
  axisDateLabel: p,
16
16
  axisTickMark: y,
17
17
  axisSubLabel: w,
18
18
  axisMinorMark: x,
19
- axisMinorMedium: b,
20
- axisChip: h,
19
+ axisMinorMedium: h,
20
+ axisChip: b,
21
21
  axisChipEvent: m,
22
22
  lane: u,
23
23
  axisLine: L,
24
- bar: v,
25
- barPending: S,
26
- barDot: T,
27
- stem: P,
28
- elbow: B,
29
- chip: E,
30
- chipArrow: H,
31
- chipBadge: C,
24
+ bar: S,
25
+ barPending: T,
26
+ barDot: v,
27
+ stem: C,
28
+ elbow: E,
29
+ chip: P,
30
+ chipArrow: B,
31
+ chipBadge: H,
32
32
  chipOp: D,
33
- chipTime: M,
34
- drawerCustom: A,
35
- drawerHead: K,
36
- drawerHeadRow: R,
37
- methodBadge: V,
38
- statusBadge: X,
39
- statusPending: I,
40
- statusError: U,
41
- drawerRoute: G,
42
- drawerSpacer: O,
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
43
  drawerUrl: Q,
44
- drawerRid: f,
45
- drawerXrid: F,
44
+ drawerRid: O,
45
+ drawerXrid: f,
46
46
  drawerTiming: Z,
47
- drawerBody: N,
48
- drawerSection: q,
49
- kvRow: J,
47
+ drawerBody: q,
48
+ drawerSection: J,
49
+ kvRow: N,
50
50
  kvKey: j,
51
- kvKeyQuery: W,
52
- kvVal: Y,
53
- awaiting: z,
51
+ kvKeyQuery: z,
52
+ kvVal: W,
53
+ awaiting: Y,
54
54
  awaitingDot: _,
55
- dockAside: $,
56
- dockHead: rr,
57
- dockTitle: cr,
58
- dockCount: or,
59
- dockScroll: ar,
60
- dockEmpty: er,
61
- bodyHead: tr,
62
- bodyLabel: ir,
63
- payloadCopy: sr,
64
- copyStop: nr,
65
- logAside: lr,
66
- logBody: dr,
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
67
  logEntry: kr,
68
- logEntrySelected: gr,
69
- logEntryFlash: pr,
70
- logTop: yr,
71
- logNum: wr,
72
- badgeSm: xr,
73
- logPair: br,
74
- logClock: hr,
75
- logOp: mr,
76
- logPath: ur,
77
- logPayloadHead: Lr,
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,
78
80
  logPayloadLabel: vr,
79
- logPre: Sr,
80
- rail: Tr,
81
+ logPre: Cr,
82
+ rail: Er,
81
83
  railBtn: Pr,
82
84
  railBtnActive: Br,
83
- railGlyphDetails: Er,
84
- railGlyphLog: Hr
85
+ railGlyphDetails: Hr,
86
+ railGlyphLog: Dr
85
87
  };
86
88
  export {
87
- z as awaiting,
89
+ Y as awaiting,
88
90
  _ as awaitingDot,
89
91
  i as axis,
90
- h as axisChip,
92
+ b as axisChip,
91
93
  m as axisChipEvent,
92
94
  p as axisDateLabel,
93
95
  s as axisDivider,
94
96
  L as axisLine,
95
97
  x as axisMinorMark,
96
- b as axisMinorMedium,
98
+ h as axisMinorMedium,
97
99
  n as axisSticky,
98
100
  w as axisSubLabel,
99
101
  g as axisTickLabel,
100
102
  y as axisTickMark,
101
- l as axisUtc,
102
- d as axisViewDate,
103
+ d as axisUtc,
104
+ l as axisViewDate,
103
105
  k as axisViewTime,
104
- xr as badgeSm,
105
- v as bar,
106
- T as barDot,
107
- S as barPending,
108
- tr as bodyHead,
109
- ir as bodyLabel,
110
- E as chip,
111
- H as chipArrow,
112
- C as chipBadge,
106
+ br as badgeSm,
107
+ S as bar,
108
+ v as barDot,
109
+ T as barPending,
110
+ nr as bodyHead,
111
+ dr as bodyLabel,
112
+ cr as cardFlushRight,
113
+ P as chip,
114
+ B as chipArrow,
115
+ H as chipBadge,
113
116
  D as chipOp,
114
- M as chipTime,
115
- nr as copyStop,
117
+ R as chipTime,
118
+ gr as copyStop,
116
119
  e as cursorLine,
117
- Cr as default,
118
- $ as dockAside,
119
- or as dockCount,
120
- er as dockEmpty,
121
- rr as dockHead,
122
- ar as dockScroll,
123
- cr as dockTitle,
124
- N as drawerBody,
125
- A as drawerCustom,
126
- K as drawerHead,
127
- R as drawerHeadRow,
128
- f as drawerRid,
129
- G as drawerRoute,
130
- q as drawerSection,
131
- O as drawerSpacer,
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,
135
+ J as drawerSection,
136
+ G as drawerSpacer,
132
137
  Z as drawerTiming,
133
138
  Q as drawerUrl,
134
- F as drawerXrid,
135
- B as elbow,
139
+ f as drawerXrid,
140
+ E as elbow,
136
141
  t as eventLine,
137
142
  o as gridline,
138
143
  c as inner,
139
144
  j as kvKey,
140
- W as kvKeyQuery,
141
- J as kvRow,
142
- Y as kvVal,
145
+ z as kvKeyQuery,
146
+ N as kvRow,
147
+ W as kvVal,
143
148
  u as lane,
144
- lr as logAside,
145
- dr as logBody,
146
- hr as logClock,
149
+ pr as logBody,
150
+ ur as logClock,
147
151
  kr as logEntry,
148
- pr as logEntryFlash,
149
- gr as logEntrySelected,
150
- wr as logNum,
151
- mr as logOp,
152
- br as logPair,
153
- ur as logPath,
154
- Lr as logPayloadHead,
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,
155
159
  vr as logPayloadLabel,
156
- Sr as logPre,
157
- yr as logTop,
158
- V as methodBadge,
160
+ Cr as logPre,
161
+ xr as logTop,
162
+ U as methodBadge,
159
163
  a as nowLine,
160
- sr as payloadCopy,
161
- Tr as rail,
164
+ lr as payloadCopy,
165
+ Er as rail,
162
166
  Pr as railBtn,
163
167
  Br as railBtnActive,
164
- Er as railGlyphDetails,
165
- Hr as railGlyphLog,
168
+ Hr as railGlyphDetails,
169
+ Dr as railGlyphLog,
166
170
  r as scroller,
167
- X as statusBadge,
168
- U as statusError,
169
- I as statusPending,
170
- P as stem
171
+ V as statusBadge,
172
+ I as statusError,
173
+ X as statusPending,
174
+ C as stem
171
175
  };
@@ -1,4 +1,5 @@
1
1
  export type { TimelineSummaryPlacement } from './TimelineShared';
2
+ export type { TimelineWheelZoom } from './useTimeline';
2
3
  export { TraceTimeline } from './TraceTimeline';
3
4
  export type { TraceTimelineProps, TraceTimelineEvent, TraceTimelineClasses, TraceTimelineDock, TraceTimelineItemContext, } from './TraceTimeline';
4
5
  export { HistoryTimeline } from './HistoryTimeline';
@@ -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
  };