@overdoser/react-toolkit 0.9.0 → 0.10.1

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,105 +1,111 @@
1
- const r = "crk-scroller-kwWVy", a = "crk-inner-vJ0BK", c = "crk-gridline-pcX-9", e = "crk-nowLine-05lmp", i = "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-axisTickLabel-9V7QB", x = "crk-axisDateLabel-QPPf7", p = "crk-axisTickMark-HGAZI", l = "crk-axisMinorMark-LmQdS", g = "crk-axisChip-Xr9r0", h = "crk-axisChipEvent-K9r-4", u = "crk-lane-hvtL1", v = "crk-axisLine-ZRK0p", L = "crk-bar-pqjsX", b = "crk-barPending-NsYu7", m = "crk-barDot-ZtYdm", y = "crk-stem-24Ud2", D = "crk-elbow-nQxQZ", B = "crk-chip-vC8yf", R = "crk-chipArrow-pyTpt", T = "crk-chipBadge-Tz11H", S = "crk-chipOp-qkIIM", X = "crk-chipTime-IoXbi", C = "crk-drawerCustom-w5gWa", K = "crk-drawerHead-mfyc3", H = "crk-drawerHeadRow-w-lfX", M = "crk-methodBadge-lfL4x", U = "crk-statusBadge-XiUl9", E = "crk-statusPending-Yg9At", P = "crk-statusError-G7XH8", Q = "crk-drawerRoute-L-hK0", V = "crk-drawerSpacer-f6nIh", f = "crk-drawerUrl-ajRgO", O = "crk-drawerRid-UsUb1", I = "crk-drawerXrid-JEUOj", Z = "crk-drawerTiming-FCpcS", q = "crk-drawerBody-Cx5-E", A = "crk-drawerSection-Zjpm1", j = "crk-kvRow-DXfXI", F = "crk-kvKey-MmSqV", J = "crk-kvKeyQuery-0hpds", Y = "crk-kvVal-PlEQT", z = "crk-awaiting-FNO2u", G = "crk-awaitingDot-b4OtX", N = {
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", $ = {
2
2
  scroller: r,
3
3
  inner: a,
4
- gridline: c,
4
+ gridline: i,
5
5
  nowLine: e,
6
- cursorLine: i,
6
+ cursorLine: c,
7
7
  eventLine: s,
8
8
  axis: t,
9
9
  axisDivider: n,
10
10
  axisSticky: o,
11
11
  axisUtc: k,
12
12
  axisViewDate: d,
13
- axisTickLabel: w,
14
- axisDateLabel: x,
13
+ axisViewTime: w,
14
+ axisTickLabel: x,
15
+ axisDateLabel: l,
15
16
  axisTickMark: p,
16
- axisMinorMark: l,
17
- axisChip: g,
17
+ axisSubLabel: g,
18
+ axisMinorMark: u,
19
+ axisMinorMedium: m,
20
+ axisChip: b,
18
21
  axisChipEvent: h,
19
- lane: u,
22
+ lane: L,
20
23
  axisLine: v,
21
- bar: L,
22
- barPending: b,
23
- barDot: m,
24
- stem: y,
24
+ bar: y,
25
+ barPending: T,
26
+ barDot: M,
27
+ stem: B,
25
28
  elbow: D,
26
- chip: B,
29
+ chip: S,
27
30
  chipArrow: R,
28
- chipBadge: T,
29
- chipOp: S,
30
- chipTime: X,
31
- drawerCustom: C,
32
- drawerHead: K,
31
+ chipBadge: X,
32
+ chipOp: C,
33
+ chipTime: K,
34
+ drawerCustom: U,
35
+ drawerHead: V,
33
36
  drawerHeadRow: H,
34
- methodBadge: M,
35
- statusBadge: U,
36
- statusPending: E,
37
- statusError: P,
38
- drawerRoute: Q,
39
- drawerSpacer: V,
40
- drawerUrl: f,
41
- drawerRid: O,
42
- drawerXrid: I,
43
- drawerTiming: Z,
44
- drawerBody: q,
45
- drawerSection: A,
46
- kvRow: j,
47
- kvKey: F,
48
- kvKeyQuery: J,
49
- kvVal: Y,
50
- awaiting: z,
51
- awaitingDot: G
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,
48
+ drawerSection: J,
49
+ kvRow: N,
50
+ kvKey: Y,
51
+ kvKeyQuery: z,
52
+ kvVal: G,
53
+ awaiting: W,
54
+ awaitingDot: _
52
55
  };
53
56
  export {
54
- z as awaiting,
55
- G as awaitingDot,
57
+ W as awaiting,
58
+ _ as awaitingDot,
56
59
  t as axis,
57
- g as axisChip,
60
+ b as axisChip,
58
61
  h as axisChipEvent,
59
- x as axisDateLabel,
62
+ l as axisDateLabel,
60
63
  n as axisDivider,
61
64
  v as axisLine,
62
- l as axisMinorMark,
65
+ u as axisMinorMark,
66
+ m as axisMinorMedium,
63
67
  o as axisSticky,
64
- w as axisTickLabel,
68
+ g as axisSubLabel,
69
+ x as axisTickLabel,
65
70
  p as axisTickMark,
66
71
  k as axisUtc,
67
72
  d as axisViewDate,
68
- L as bar,
69
- m as barDot,
70
- b as barPending,
71
- B as chip,
73
+ w as axisViewTime,
74
+ y as bar,
75
+ M as barDot,
76
+ T as barPending,
77
+ S as chip,
72
78
  R as chipArrow,
73
- T as chipBadge,
74
- S as chipOp,
75
- X as chipTime,
76
- i as cursorLine,
77
- N as default,
78
- q as drawerBody,
79
- C as drawerCustom,
80
- K as drawerHead,
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,
81
87
  H as drawerHeadRow,
82
- O as drawerRid,
83
- Q as drawerRoute,
84
- A as drawerSection,
85
- V as drawerSpacer,
86
- Z as drawerTiming,
87
- f as drawerUrl,
88
- I as drawerXrid,
88
+ q as drawerRid,
89
+ O as drawerRoute,
90
+ J as drawerSection,
91
+ I as drawerSpacer,
92
+ j as drawerTiming,
93
+ Z as drawerUrl,
94
+ A as drawerXrid,
89
95
  D as elbow,
90
96
  s as eventLine,
91
- c as gridline,
97
+ i as gridline,
92
98
  a as inner,
93
- F as kvKey,
94
- J as kvKeyQuery,
95
- j as kvRow,
96
- Y as kvVal,
97
- u as lane,
98
- M as methodBadge,
99
+ Y as kvKey,
100
+ z as kvKeyQuery,
101
+ N as kvRow,
102
+ G as kvVal,
103
+ L as lane,
104
+ E as methodBadge,
99
105
  e as nowLine,
100
106
  r as scroller,
101
- U as statusBadge,
102
- P as statusError,
103
- E as statusPending,
104
- y as stem
107
+ P as statusBadge,
108
+ f as statusError,
109
+ Q as statusPending,
110
+ B as stem
105
111
  };
@@ -25,8 +25,17 @@ export declare function fmtDateISO(t: number): string;
25
25
  export declare function fmtISO(t: number, ms?: boolean): string;
26
26
  /** Adaptive duration: `412ms`, `3.1s`, `4m 12s`, `3h 20m`, `2.5d`, `1.2y`. */
27
27
  export declare function fmtDur(ms: number | null | undefined): string;
28
- /** Tick step table spanning 1 second → 500 years. */
28
+ /** Tick step table spanning 1 millisecond → 500 years. */
29
29
  export declare const TICK_STEPS: number[];
30
+ /**
31
+ * Subdivision for a tick step: how many equal `parts` it splits into for minor
32
+ * marks, and which part index gets a medium mark (`0` = none). Steps outside
33
+ * `TICK_STEPS` fall back to a plain quarter split.
34
+ */
35
+ export declare function tickSubdiv(step: number): {
36
+ parts: number;
37
+ medium: number;
38
+ };
30
39
  export interface Tick {
31
40
  t: number;
32
41
  label: string;
@@ -38,7 +47,8 @@ export interface TickResult {
38
47
  /**
39
48
  * Pick a step from the table so ticks are at least `minPx` apart across
40
49
  * `widthPx`, and enumerate them. Labels use the local clock below day
41
- * granularity and `Jul 27`-style dates above it.
50
+ * granularity (with milliseconds below second granularity) and `Jul 27`-style
51
+ * dates above it.
42
52
  */
43
53
  export declare function ticks(t0: number, t1: number, widthPx: number, minPx?: number): TickResult;
44
54
  export interface HighlightPart {
@@ -1,31 +1,40 @@
1
- const O = 1e3, S = 6e4, U = 36e5, C = 864e5, c = (t) => String(t).padStart(2, "0"), h = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
2
- function f(t, e) {
1
+ const O = 1e3, U = 6e4, N = 36e5, S = 864e5, c = (t) => String(t).padStart(2, "0"), A = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
2
+ function u(t, e) {
3
3
  const n = new Date(t);
4
- return c(n.getHours()) + ":" + c(n.getMinutes()) + ":" + c(n.getSeconds());
4
+ return c(n.getHours()) + ":" + c(n.getMinutes()) + ":" + c(n.getSeconds()) + (e ? "." + String(n.getMilliseconds()).padStart(3, "0") : "");
5
5
  }
6
- function u(t) {
6
+ function s(t) {
7
7
  const e = new Date(t);
8
- return h[e.getMonth()] + " " + e.getDate();
8
+ return A[e.getMonth()] + " " + e.getDate();
9
9
  }
10
- function E(t) {
10
+ function C(t) {
11
11
  const e = new Date(t).getFullYear(), n = e !== (/* @__PURE__ */ new Date()).getFullYear();
12
- return n && Date.now() - t > 2 * 365 * 864e5 ? u(t) + " " + e : u(t) + (n ? " " + e : "") + " · " + f(t);
12
+ return n && Date.now() - t > 2 * 365 * 864e5 ? s(t) + " " + e : s(t) + (n ? " " + e : "") + " · " + u(t);
13
13
  }
14
- function g(t, e) {
14
+ function Y(t, e) {
15
15
  const n = new Date(t);
16
16
  return c(n.getUTCHours()) + ":" + c(n.getUTCMinutes()) + ":" + c(n.getUTCSeconds()) + (e ? "." + String(n.getUTCMilliseconds()).padStart(3, "0") : "");
17
17
  }
18
- function d(t) {
18
+ function h(t) {
19
19
  const e = new Date(t);
20
20
  return e.getUTCFullYear() + "-" + c(e.getUTCMonth() + 1) + "-" + c(e.getUTCDate());
21
21
  }
22
22
  function M(t, e) {
23
- return d(t) + "T" + g(t, e) + "Z";
23
+ return h(t) + "T" + Y(t, e) + "Z";
24
24
  }
25
- function T(t) {
25
+ function d(t) {
26
26
  return t == null ? "" : t < 1e3 ? Math.round(t) + "ms" : t < 6e4 ? (t / 1e3).toFixed(t < 10 * 1e3 ? 1 : 0) + "s" : t < 36e5 ? Math.floor(t / 6e4) + "m " + Math.round(t % 6e4 / 1e3) + "s" : t < 2 * 864e5 ? Math.floor(t / 36e5) + "h " + Math.round(t % 36e5 / 6e4) + "m" : t < 365 * 864e5 ? (t / 864e5).toFixed(1) + "d" : (t / (365.25 * 864e5)).toFixed(t < 3650 * 864e5 ? 1 : 0) + "y";
27
27
  }
28
- const s = [
28
+ const l = [
29
+ 1,
30
+ 2,
31
+ 5,
32
+ 10,
33
+ 25,
34
+ 50,
35
+ 100,
36
+ 250,
37
+ 500,
29
38
  1e3,
30
39
  2 * 1e3,
31
40
  5 * 1e3,
@@ -59,30 +68,78 @@ const s = [
59
68
  36525 * 864e5,
60
69
  91311 * 864e5,
61
70
  182625 * 864e5
62
- ];
63
- function A(t, e, n, a) {
71
+ ], E = /* @__PURE__ */ new Map([
72
+ [1, [0, 0]],
73
+ [2, [2, 0]],
74
+ [5, [5, 0]],
75
+ [10, [10, 5]],
76
+ [25, [5, 0]],
77
+ [50, [10, 5]],
78
+ [100, [10, 5]],
79
+ [250, [5, 0]],
80
+ [500, [10, 5]],
81
+ [1e3, [10, 5]],
82
+ [2 * 1e3, [4, 2]],
83
+ [5 * 1e3, [5, 0]],
84
+ [10 * 1e3, [10, 5]],
85
+ [15 * 1e3, [3, 0]],
86
+ [30 * 1e3, [6, 3]],
87
+ [6e4, [6, 3]],
88
+ [2 * 6e4, [4, 2]],
89
+ [5 * 6e4, [5, 0]],
90
+ [10 * 6e4, [10, 5]],
91
+ [15 * 6e4, [3, 0]],
92
+ [30 * 6e4, [6, 3]],
93
+ [36e5, [6, 3]],
94
+ [2 * 36e5, [4, 2]],
95
+ [3 * 36e5, [3, 0]],
96
+ [6 * 36e5, [6, 3]],
97
+ [12 * 36e5, [4, 2]],
98
+ [864e5, [4, 2]],
99
+ [2 * 864e5, [4, 2]],
100
+ [7 * 864e5, [7, 0]],
101
+ [14 * 864e5, [14, 7]],
102
+ [30 * 864e5, [6, 3]],
103
+ [90 * 864e5, [3, 0]],
104
+ [180 * 864e5, [6, 3]],
105
+ [365 * 864e5, [4, 2]],
106
+ [730 * 864e5, [4, 2]],
107
+ [1825 * 864e5, [5, 0]],
108
+ [3650 * 864e5, [10, 5]],
109
+ [9131 * 864e5, [5, 0]],
110
+ [18262 * 864e5, [10, 5]],
111
+ [36525 * 864e5, [10, 5]],
112
+ [91311 * 864e5, [5, 0]],
113
+ [182625 * 864e5, [5, 0]]
114
+ ]);
115
+ function g(t) {
116
+ const e = E.get(t) || [4, 0];
117
+ return { parts: e[0], medium: e[1] };
118
+ }
119
+ function T(t, e, n, a) {
64
120
  a = a || 88;
65
- const l = Math.max(1, e - t), i = s.find((D) => D / l * n >= a) || s[s.length - 1], o = [];
66
- let r = Math.ceil(t / i) * i;
67
- for (; r <= e; r += i) o.push({ t: r, label: i >= 864e5 ? u(r) : f(r) });
68
- return { step: i, list: o };
121
+ const D = Math.max(1, e - t), r = l.find((f) => f / D * n >= a) || l[l.length - 1], o = [];
122
+ let i = Math.ceil(t / r) * r;
123
+ for (; i <= e; i += r)
124
+ o.push({ t: i, label: r >= 864e5 ? s(i) : u(i, r < 1e3) });
125
+ return { step: r, list: o };
69
126
  }
70
- function N(t, e) {
127
+ function I(t, e) {
71
128
  const n = String(t ?? "");
72
129
  if (e = (e || "").trim(), !e) return [{ t: n, hit: !1 }];
73
- const a = e.toLowerCase(), l = n.toLowerCase(), i = [];
130
+ const a = e.toLowerCase(), D = n.toLowerCase(), r = [];
74
131
  let o = 0;
75
132
  for (; ; ) {
76
- const r = l.indexOf(a, o);
77
- if (r < 0) {
78
- o < n.length && i.push({ t: n.slice(o), hit: !1 });
133
+ const i = D.indexOf(a, o);
134
+ if (i < 0) {
135
+ o < n.length && r.push({ t: n.slice(o), hit: !1 });
79
136
  break;
80
137
  }
81
- r > o && i.push({ t: n.slice(o, r), hit: !1 }), i.push({ t: n.slice(r, r + e.length), hit: !0 }), o = r + e.length;
138
+ i > o && r.push({ t: n.slice(o, i), hit: !1 }), r.push({ t: n.slice(i, i + e.length), hit: !0 }), o = i + e.length;
82
139
  }
83
- return i.length ? i : [{ t: n, hit: !1 }];
140
+ return r.length ? r : [{ t: n, hit: !1 }];
84
141
  }
85
- function Y(t, e) {
142
+ function k(t, e) {
86
143
  if (e = (e || "").trim(), !e) return !0;
87
144
  let n;
88
145
  try {
@@ -92,7 +149,7 @@ function Y(t, e) {
92
149
  }
93
150
  return e.toLowerCase().split(/\s+/).filter(Boolean).every((a) => n.includes(a));
94
151
  }
95
- const k = [
152
+ const H = [
96
153
  "var(--crk-timeline-1, #0e7568)",
97
154
  "var(--crk-timeline-2, #4c5bd4)",
98
155
  "var(--crk-timeline-3, #c05f2c)",
@@ -100,10 +157,10 @@ const k = [
100
157
  "var(--crk-timeline-5, #3e6b8f)",
101
158
  "var(--crk-timeline-6, #b03a48)"
102
159
  ];
103
- function m(t, e) {
160
+ function R(t, e) {
104
161
  return `color-mix(in srgb, ${t} ${e}%, white)`;
105
162
  }
106
- const I = {
163
+ const m = {
107
164
  body: "var(--crk-timeline-body, #3b352f)",
108
165
  stem: "var(--crk-timeline-stem, #c9c1b5)",
109
166
  stemHot: "var(--crk-timeline-stem-hot, #8a8175)",
@@ -114,22 +171,23 @@ const I = {
114
171
  selectedRing: "var(--crk-timeline-selected-ring, #b8ddd6)"
115
172
  };
116
173
  export {
117
- C as DAY,
118
- U as HOUR,
119
- S as MINUTE,
174
+ S as DAY,
175
+ N as HOUR,
176
+ U as MINUTE,
120
177
  O as SECOND,
121
- s as TICK_STEPS,
122
- k as TIMELINE_PALETTE_VARS,
123
- I as TL_COLORS,
124
- Y as eventMatches,
125
- f as fmtClock,
126
- g as fmtClockUTC,
127
- u as fmtDate,
128
- d as fmtDateISO,
129
- E as fmtDateTime,
130
- T as fmtDur,
178
+ l as TICK_STEPS,
179
+ H as TIMELINE_PALETTE_VARS,
180
+ m as TL_COLORS,
181
+ k as eventMatches,
182
+ u as fmtClock,
183
+ Y as fmtClockUTC,
184
+ s as fmtDate,
185
+ h as fmtDateISO,
186
+ C as fmtDateTime,
187
+ d as fmtDur,
131
188
  M as fmtISO,
132
- N as highlightParts,
133
- A as ticks,
134
- m as tint
189
+ I as highlightParts,
190
+ g as tickSubdiv,
191
+ T as ticks,
192
+ R as tint
135
193
  };