rails-profiler 0.20.0 → 0.22.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f2b977ebc11075e9d00ae802a9d8f038819907c18b17073cf6b3a0fa437ba29
4
- data.tar.gz: 4565ab7a98d1a8992cfc3bde0646c6dea355b64d79ab66849c99cab2fff024a3
3
+ metadata.gz: b7bf5cab3285946189ba9adee630f79ad7303ae591aa4364e0fe4d7af320bab9
4
+ data.tar.gz: 4c2ad13691c8c6556355c2c4b2c5934ef2d6aab9d956e2f30d16d92098cd5997
5
5
  SHA512:
6
- metadata.gz: 48c0c092e6d9145ed04651fbc3e924fa7f3e02d79da737cc6a052e0d9d7b41c590651c086a941d76a983eef29358ee0817b1fd078c41d0a7edd750a948a191f2
7
- data.tar.gz: 7de21cc82a590ff838ed5130970e6947c69e4910ff2ebb5c93431f4d4deba93389cdf446e370fe50a9fce7097526b16ffcd442a18bea82ef29716b0638746028
6
+ metadata.gz: 1c846fa98d00dd5e6c5cc5ef8ca443b6f2b02664b9fdee77479bdbf6013d38cdf359e892ba6f08721b54fa5fb13d9b8663b909d7f17f97a849402654c4bf3821
7
+ data.tar.gz: 1697e1bfe8842df4d41aed3a1c5e84b8090d510fab6ee9622afc44e326553c13843a5252b74b34d5d6bb4195629f3d05330953b5527ef7a596aae89bf9a36b11
@@ -68,8 +68,8 @@
68
68
  }
69
69
  }
70
70
  function P(n2, l3, u4, t3, i3, r3, o3, e3, f4, c3, s3) {
71
- var a3, h3, y3, d3, w3, g2, _2, m3 = t3 && t3.__k || v, b = l3.length;
72
- for (f4 = A(u4, l3, m3, f4, b), a3 = 0; a3 < b; a3++) null != (y3 = u4.__k[a3]) && (h3 = -1 != y3.__i && m3[y3.__i] || p, y3.__i = a3, g2 = z(n2, y3, h3, i3, r3, o3, e3, f4, c3, s3), d3 = y3.__e, y3.ref && h3.ref != y3.ref && (h3.ref && D(h3.ref, null, y3), s3.push(y3.ref, y3.__c || d3, y3)), null == w3 && null != d3 && (w3 = d3), (_2 = !!(4 & y3.__u)) || h3.__k === y3.__k ? f4 = H(y3, f4, n2, _2) : "function" == typeof y3.type && void 0 !== g2 ? f4 = g2 : d3 && (f4 = d3.nextSibling), y3.__u &= -7);
71
+ var a3, h3, y3, d3, w3, g2, _3, m3 = t3 && t3.__k || v, b = l3.length;
72
+ for (f4 = A(u4, l3, m3, f4, b), a3 = 0; a3 < b; a3++) null != (y3 = u4.__k[a3]) && (h3 = -1 != y3.__i && m3[y3.__i] || p, y3.__i = a3, g2 = z(n2, y3, h3, i3, r3, o3, e3, f4, c3, s3), d3 = y3.__e, y3.ref && h3.ref != y3.ref && (h3.ref && D(h3.ref, null, y3), s3.push(y3.ref, y3.__c || d3, y3)), null == w3 && null != d3 && (w3 = d3), (_3 = !!(4 & y3.__u)) || h3.__k === y3.__k ? f4 = H(y3, f4, n2, _3) : "function" == typeof y3.type && void 0 !== g2 ? f4 = g2 : d3 && (f4 = d3.nextSibling), y3.__u &= -7);
73
73
  return u4.__e = w3, f4;
74
74
  }
75
75
  function A(n2, l3, u4, t3, i3) {
@@ -130,11 +130,11 @@
130
130
  };
131
131
  }
132
132
  function z(n2, u4, t3, i3, r3, o3, e3, f4, c3, s3) {
133
- var a3, h3, p3, y3, _2, m3, b, S2, C3, M2, $2, I2, A3, H2, L, T3 = u4.type;
133
+ var a3, h3, p3, y3, _3, m3, b, S2, C3, M2, $2, I2, A3, H2, L, T3 = u4.type;
134
134
  if (void 0 !== u4.constructor) return null;
135
135
  128 & t3.__u && (c3 = !!(32 & t3.__u), o3 = [f4 = u4.__e = t3.__e]), (a3 = l.__b) && a3(u4);
136
136
  n: if ("function" == typeof T3) try {
137
- if (S2 = u4.props, C3 = T3.prototype && T3.prototype.render, M2 = (a3 = T3.contextType) && i3[a3.__c], $2 = a3 ? M2 ? M2.props.value : a3.__ : i3, t3.__c ? b = (h3 = u4.__c = t3.__c).__ = h3.__E : (C3 ? u4.__c = h3 = new T3(S2, $2) : (u4.__c = h3 = new x(S2, $2), h3.constructor = T3, h3.render = G), M2 && M2.sub(h3), h3.state || (h3.state = {}), h3.__n = i3, p3 = h3.__d = true, h3.__h = [], h3._sb = []), C3 && null == h3.__s && (h3.__s = h3.state), C3 && null != T3.getDerivedStateFromProps && (h3.__s == h3.state && (h3.__s = w({}, h3.__s)), w(h3.__s, T3.getDerivedStateFromProps(S2, h3.__s))), y3 = h3.props, _2 = h3.state, h3.__v = u4, p3) C3 && null == T3.getDerivedStateFromProps && null != h3.componentWillMount && h3.componentWillMount(), C3 && null != h3.componentDidMount && h3.__h.push(h3.componentDidMount);
137
+ if (S2 = u4.props, C3 = T3.prototype && T3.prototype.render, M2 = (a3 = T3.contextType) && i3[a3.__c], $2 = a3 ? M2 ? M2.props.value : a3.__ : i3, t3.__c ? b = (h3 = u4.__c = t3.__c).__ = h3.__E : (C3 ? u4.__c = h3 = new T3(S2, $2) : (u4.__c = h3 = new x(S2, $2), h3.constructor = T3, h3.render = G), M2 && M2.sub(h3), h3.state || (h3.state = {}), h3.__n = i3, p3 = h3.__d = true, h3.__h = [], h3._sb = []), C3 && null == h3.__s && (h3.__s = h3.state), C3 && null != T3.getDerivedStateFromProps && (h3.__s == h3.state && (h3.__s = w({}, h3.__s)), w(h3.__s, T3.getDerivedStateFromProps(S2, h3.__s))), y3 = h3.props, _3 = h3.state, h3.__v = u4, p3) C3 && null == T3.getDerivedStateFromProps && null != h3.componentWillMount && h3.componentWillMount(), C3 && null != h3.componentDidMount && h3.__h.push(h3.componentDidMount);
138
138
  else {
139
139
  if (C3 && null == T3.getDerivedStateFromProps && S2 !== y3 && null != h3.componentWillReceiveProps && h3.componentWillReceiveProps(S2, $2), u4.__v == t3.__v || !h3.__e && null != h3.shouldComponentUpdate && false === h3.shouldComponentUpdate(S2, h3.__s, $2)) {
140
140
  u4.__v != t3.__v && (h3.props = S2, h3.state = h3.__s, h3.__d = false), u4.__e = t3.__e, u4.__k = t3.__k, u4.__k.some(function(n3) {
@@ -143,14 +143,14 @@
143
143
  break n;
144
144
  }
145
145
  null != h3.componentWillUpdate && h3.componentWillUpdate(S2, h3.__s, $2), C3 && null != h3.componentDidUpdate && h3.__h.push(function() {
146
- h3.componentDidUpdate(y3, _2, m3);
146
+ h3.componentDidUpdate(y3, _3, m3);
147
147
  });
148
148
  }
149
149
  if (h3.context = $2, h3.props = S2, h3.__P = n2, h3.__e = false, I2 = l.__r, A3 = 0, C3) h3.state = h3.__s, h3.__d = false, I2 && I2(u4), a3 = h3.render(h3.props, h3.state, h3.context), v.push.apply(h3.__h, h3._sb), h3._sb = [];
150
150
  else do {
151
151
  h3.__d = false, I2 && I2(u4), a3 = h3.render(h3.props, h3.state, h3.context), h3.state = h3.__s;
152
152
  } while (h3.__d && ++A3 < 25);
153
- h3.state = h3.__s, null != h3.getChildContext && (i3 = w(w({}, i3), h3.getChildContext())), C3 && !p3 && null != h3.getSnapshotBeforeUpdate && (m3 = h3.getSnapshotBeforeUpdate(y3, _2)), H2 = null != a3 && a3.type === k && null == a3.key ? q(a3.props.children) : a3, f4 = P(n2, d(H2) ? H2 : [H2], u4, t3, i3, r3, o3, e3, f4, c3, s3), h3.base = u4.__e, u4.__u &= -161, h3.__h.length && e3.push(h3), b && (h3.__E = h3.__ = null);
153
+ h3.state = h3.__s, null != h3.getChildContext && (i3 = w(w({}, i3), h3.getChildContext())), C3 && !p3 && null != h3.getSnapshotBeforeUpdate && (m3 = h3.getSnapshotBeforeUpdate(y3, _3)), H2 = null != a3 && a3.type === k && null == a3.key ? q(a3.props.children) : a3, f4 = P(n2, d(H2) ? H2 : [H2], u4, t3, i3, r3, o3, e3, f4, c3, s3), h3.base = u4.__e, u4.__u &= -161, h3.__h.length && e3.push(h3), b && (h3.__E = h3.__ = null);
154
154
  } catch (n3) {
155
155
  if (u4.__v = null, c3 || null != o3) if (n3.then) {
156
156
  for (u4.__u |= c3 ? 160 : 128; f4 && 8 == f4.nodeType && f4.nextSibling; ) f4 = f4.nextSibling;
@@ -184,7 +184,7 @@
184
184
  return "object" != typeof n2 || null == n2 || n2.__b > 0 ? n2 : d(n2) ? n2.map(q) : w({}, n2);
185
185
  }
186
186
  function B(u4, t3, i3, r3, o3, e3, f4, c3, s3) {
187
- var a3, h3, v3, y3, w3, _2, m3, b = i3.props || p, k3 = t3.props, x2 = t3.type;
187
+ var a3, h3, v3, y3, w3, _3, m3, b = i3.props || p, k3 = t3.props, x2 = t3.type;
188
188
  if ("svg" == x2 ? o3 = "http://www.w3.org/2000/svg" : "math" == x2 ? o3 = "http://www.w3.org/1998/Math/MathML" : o3 || (o3 = "http://www.w3.org/1999/xhtml"), null != e3) {
189
189
  for (a3 = 0; a3 < e3.length; a3++) if ((w3 = e3[a3]) && "setAttribute" in w3 == !!x2 && (x2 ? w3.localName == x2 : 3 == w3.nodeType)) {
190
190
  u4 = w3, e3[a3] = null;
@@ -199,10 +199,10 @@
199
199
  else {
200
200
  if (e3 = e3 && n.call(u4.childNodes), !c3 && null != e3) for (b = {}, a3 = 0; a3 < u4.attributes.length; a3++) b[(w3 = u4.attributes[a3]).name] = w3.value;
201
201
  for (a3 in b) w3 = b[a3], "dangerouslySetInnerHTML" == a3 ? v3 = w3 : "children" == a3 || a3 in k3 || "value" == a3 && "defaultValue" in k3 || "checked" == a3 && "defaultChecked" in k3 || F(u4, a3, null, w3, o3);
202
- for (a3 in k3) w3 = k3[a3], "children" == a3 ? y3 = w3 : "dangerouslySetInnerHTML" == a3 ? h3 = w3 : "value" == a3 ? _2 = w3 : "checked" == a3 ? m3 = w3 : c3 && "function" != typeof w3 || b[a3] === w3 || F(u4, a3, w3, b[a3], o3);
202
+ for (a3 in k3) w3 = k3[a3], "children" == a3 ? y3 = w3 : "dangerouslySetInnerHTML" == a3 ? h3 = w3 : "value" == a3 ? _3 = w3 : "checked" == a3 ? m3 = w3 : c3 && "function" != typeof w3 || b[a3] === w3 || F(u4, a3, w3, b[a3], o3);
203
203
  if (h3) c3 || v3 && (h3.__html == v3.__html || h3.__html == u4.innerHTML) || (u4.innerHTML = h3.__html), t3.__k = [];
204
204
  else if (v3 && (u4.innerHTML = ""), P("template" == t3.type ? u4.content : u4, d(y3) ? y3 : [y3], t3, i3, r3, "foreignObject" == x2 ? "http://www.w3.org/1999/xhtml" : o3, e3, f4, e3 ? e3[0] : i3.__k && S(i3, 0), c3, s3), null != e3) for (a3 = e3.length; a3--; ) g(e3[a3]);
205
- c3 || (a3 = "value", "progress" == x2 && null == _2 ? u4.removeAttribute("value") : null != _2 && (_2 !== u4[a3] || "progress" == x2 && !_2 || "option" == x2 && _2 != b[a3]) && F(u4, a3, _2, b[a3], o3), a3 = "checked", null != m3 && m3 != u4[a3] && F(u4, a3, m3, b[a3], o3));
205
+ c3 || (a3 = "value", "progress" == x2 && null == _3 ? u4.removeAttribute("value") : null != _3 && (_3 !== u4[a3] || "progress" == x2 && !_3 || "option" == x2 && _3 != b[a3]) && F(u4, a3, _3, b[a3], o3), a3 = "checked", null != m3 && m3 != u4[a3] && F(u4, a3, m3, b[a3], o3));
206
206
  }
207
207
  return u4;
208
208
  }
@@ -314,6 +314,10 @@
314
314
  var i3 = p2(t2++, 3);
315
315
  !c2.__s && C2(i3.__H, u4) && (i3.__ = n2, i3.u = u4, r2.__H.__h.push(i3));
316
316
  }
317
+ function _2(n2, u4) {
318
+ var i3 = p2(t2++, 4);
319
+ !c2.__s && C2(i3.__H, u4) && (i3.__ = n2, i3.u = u4, r2.__h.push(i3));
320
+ }
317
321
  function A2(n2) {
318
322
  return o2 = 5, T2(function() {
319
323
  return { current: n2 };
@@ -427,7 +431,7 @@
427
431
  }
428
432
  hideTimer.current = setTimeout(() => setVisible(false), 150);
429
433
  };
430
- y2(() => {
434
+ _2(() => {
431
435
  if (visible && panelRef.current) {
432
436
  const el = panelRef.current;
433
437
  el.style.left = "50%";
@@ -453,8 +457,7 @@
453
457
  "div",
454
458
  {
455
459
  ref: panelRef,
456
- class: `profiler-toolbar-panel${panelLarge ? " profiler-toolbar-panel-large" : ""}`,
457
- style: { display: visible ? "block" : "none" },
460
+ class: `profiler-toolbar-panel${panelLarge ? " profiler-toolbar-panel-large" : ""}${visible ? " is-visible" : ""}`,
458
461
  onMouseEnter: show,
459
462
  onMouseLeave: hide,
460
463
  children: panel
@@ -1007,6 +1010,60 @@
1007
1010
  ] });
1008
1011
  }
1009
1012
 
1013
+ // app/assets/typescript/profiler/components/toolbar/panels/MailerPanel.tsx
1014
+ function MailerPanel({ mailerData }) {
1015
+ const hasErrors = mailerData.failed > 0 || mailerData.loop_warnings.length > 0;
1016
+ return /* @__PURE__ */ u3(k, { children: [
1017
+ /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-header", children: [
1018
+ "Mailers",
1019
+ /* @__PURE__ */ u3("span", { class: "profiler-float-right", children: [
1020
+ mailerData.total,
1021
+ " email",
1022
+ mailerData.total !== 1 ? "s" : ""
1023
+ ] })
1024
+ ] }),
1025
+ /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-content", children: [
1026
+ mailerData.deliver_now > 0 && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
1027
+ /* @__PURE__ */ u3("span", { children: "deliver_now" }),
1028
+ /* @__PURE__ */ u3("strong", { children: mailerData.deliver_now })
1029
+ ] }),
1030
+ mailerData.deliver_later > 0 && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
1031
+ /* @__PURE__ */ u3("span", { children: "deliver_later" }),
1032
+ /* @__PURE__ */ u3("strong", { children: mailerData.deliver_later })
1033
+ ] }),
1034
+ (mailerData.queued_count ?? 0) > 0 && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
1035
+ /* @__PURE__ */ u3("span", { children: "Queued" }),
1036
+ /* @__PURE__ */ u3("strong", { children: mailerData.queued_count })
1037
+ ] }),
1038
+ mailerData.multi_part_count > 0 && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
1039
+ /* @__PURE__ */ u3("span", { children: "Multi-part" }),
1040
+ /* @__PURE__ */ u3("strong", { children: mailerData.multi_part_count })
1041
+ ] }),
1042
+ mailerData.failed > 0 && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
1043
+ /* @__PURE__ */ u3("span", { children: "Errors" }),
1044
+ /* @__PURE__ */ u3("strong", { class: "profiler-text--error", children: mailerData.failed })
1045
+ ] }),
1046
+ mailerData.loop_warnings.length > 0 && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row", children: [
1047
+ /* @__PURE__ */ u3("span", { class: "profiler-text--warning", children: "\u26A0\uFE0F Loop detected" }),
1048
+ /* @__PURE__ */ u3("strong", { class: "profiler-text--warning", children: mailerData.loop_warnings.length })
1049
+ ] }),
1050
+ [...mailerData.emails, ...mailerData.errors].slice(0, 3).map((email, i3) => /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row profiler-text--sm", children: [
1051
+ /* @__PURE__ */ u3("span", { class: "profiler-text--muted", children: [
1052
+ email.mailer_class,
1053
+ "#",
1054
+ email.action
1055
+ ] }),
1056
+ /* @__PURE__ */ u3("span", { class: email.error ? "profiler-text--error" : "profiler-text--success", children: email.error ? "\u274C" : "\u2705" })
1057
+ ] }, i3)),
1058
+ mailerData.total > 3 && /* @__PURE__ */ u3("div", { class: "profiler-toolbar-panel-row profiler-text--muted profiler-text--xs", children: [
1059
+ "+",
1060
+ mailerData.total - 3,
1061
+ " more\u2026"
1062
+ ] })
1063
+ ] })
1064
+ ] });
1065
+ }
1066
+
1010
1067
  // app/assets/typescript/profiler/components/toolbar/ToolbarApp.tsx
1011
1068
  function statusClass2(status) {
1012
1069
  if (status >= 200 && status < 300) return "profiler-text--success";
@@ -1027,7 +1084,7 @@
1027
1084
  second: "2-digit"
1028
1085
  });
1029
1086
  }
1030
- function ToolbarApp({ profile, token, currentVersion }) {
1087
+ function ToolbarApp({ profile, token }) {
1031
1088
  const cd = profile.collectors_data || {};
1032
1089
  const requestData = cd["request"];
1033
1090
  const dbData = cd["database"];
@@ -1042,13 +1099,14 @@
1042
1099
  const routesData = cd["routes"];
1043
1100
  const i18nData = cd["i18n"];
1044
1101
  const envData = cd["env"];
1102
+ const mailerData = cd["mailer"];
1045
1103
  const childJobs = profile.child_jobs ?? [];
1046
1104
  const reqClass = statusClass2(profile.status);
1047
1105
  const durClass = durationClass(profile.duration);
1048
1106
  const dbClass = (dbData?.slow_queries ?? 0) > 0 ? "profiler-text--error" : "profiler-text--success";
1049
1107
  const ajaxClass = (ajaxData?.total_requests ?? 0) > 20 ? "profiler-text--error" : "profiler-text--success";
1050
1108
  const cacheClass = (cacheData?.hit_rate ?? 0) > 80 ? "profiler-text--success" : "profiler-text--warning";
1051
- return /* @__PURE__ */ u3("div", { class: "profiler-toolbar-container", children: [
1109
+ return /* @__PURE__ */ u3(k, { children: /* @__PURE__ */ u3("div", { class: "profiler-toolbar-container", children: [
1052
1110
  requestData && /* @__PURE__ */ u3(k, { children: [
1053
1111
  /* @__PURE__ */ u3(
1054
1112
  ToolbarItem,
@@ -1280,6 +1338,32 @@
1280
1338
  ]
1281
1339
  }
1282
1340
  ),
1341
+ mailerData && (mailerData.total > 0 || (mailerData.queued_count ?? 0) > 0) && /* @__PURE__ */ u3(
1342
+ ToolbarItem,
1343
+ {
1344
+ href: `/_profiler/profiles/${token}?tab=mailer`,
1345
+ className: mailerData.failed > 0 ? "profiler-text--error" : "profiler-text--success",
1346
+ panelLarge: true,
1347
+ panel: /* @__PURE__ */ u3(MailerPanel, { mailerData }),
1348
+ children: [
1349
+ /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: "MAIL" }),
1350
+ mailerData.total > 0 && /* @__PURE__ */ u3("span", { children: mailerData.total }),
1351
+ mailerData.total === 0 && (mailerData.queued_count ?? 0) > 0 && /* @__PURE__ */ u3("span", { class: "profiler-text--muted", children: [
1352
+ mailerData.queued_count,
1353
+ "q"
1354
+ ] }),
1355
+ mailerData.total > 0 && (mailerData.queued_count ?? 0) > 0 && /* @__PURE__ */ u3("span", { class: "profiler-text--muted profiler-text--xs", children: [
1356
+ "+",
1357
+ mailerData.queued_count,
1358
+ "q"
1359
+ ] }),
1360
+ mailerData.failed > 0 && /* @__PURE__ */ u3("span", { class: "profiler-text--error profiler-text--xs", children: [
1361
+ "\u25B2 ",
1362
+ mailerData.failed
1363
+ ] })
1364
+ ]
1365
+ }
1366
+ ),
1283
1367
  envData && envData.total > 0 && /* @__PURE__ */ u3(
1284
1368
  ToolbarItem,
1285
1369
  {
@@ -1291,83 +1375,84 @@
1291
1375
  ]
1292
1376
  }
1293
1377
  ),
1294
- profile.gem_version && profile.gem_version !== currentVersion ? /* @__PURE__ */ u3(
1295
- "a",
1296
- {
1297
- href: `/_profiler/profiles/${token}`,
1298
- class: "profiler-toolbar-item profiler-text--warning",
1299
- title: `Captur\xE9 avec v${profile.gem_version} \u2014 actuel : v${currentVersion}`,
1300
- children: [
1301
- "\u26A0\uFE0F v",
1302
- profile.gem_version
1303
- ]
1304
- }
1305
- ) : currentVersion ? /* @__PURE__ */ u3("span", { class: "profiler-toolbar-item", style: "cursor:default", children: [
1306
- "v",
1307
- currentVersion
1308
- ] }) : null,
1309
- /* @__PURE__ */ u3("a", { href: "/_profiler", class: "profiler-toolbar-item", children: "\u2B21 Profiler" })
1310
- ] });
1378
+ /* @__PURE__ */ u3("a", { href: "/_profiler", class: "profiler-toolbar-item profiler-toolbar-logo", children: "\u2B21 Profiler" })
1379
+ ] }) });
1311
1380
  }
1312
1381
 
1313
1382
  // app/assets/typescript/profiler/toolbar-bundle.tsx
1314
- function applyTheme(el) {
1383
+ var ANIM_MS = 280;
1384
+ function applyTheme(elements) {
1315
1385
  const stored = localStorage.getItem("profiler-theme");
1316
1386
  const theme = stored === "light" ? "light" : stored === "dark" ? "dark" : window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark";
1317
- el.setAttribute("data-theme", theme);
1387
+ elements.forEach((el) => el.setAttribute("data-theme", theme));
1388
+ }
1389
+ function ToolbarMount({ token }) {
1390
+ const [profile, setProfile] = d2(null);
1391
+ y2(() => {
1392
+ const load = () => {
1393
+ fetch(`/_profiler/api/toolbar/${token}`).then((res) => res.json()).then((data) => {
1394
+ if (data.profile) setProfile(data.profile);
1395
+ }).catch((err) => console.debug("Profiler toolbar load failed:", err));
1396
+ };
1397
+ window.__PROFILER_REFRESH_TOOLBAR__ = load;
1398
+ load();
1399
+ }, [token]);
1400
+ if (!profile) return null;
1401
+ return /* @__PURE__ */ u3(ToolbarApp, { profile, token });
1318
1402
  }
1319
1403
  function mountToolbar() {
1320
1404
  const el = document.getElementById("profiler-toolbar");
1321
- if (!el) return;
1405
+ const toggleEl = document.getElementById("profiler-toolbar-toggle");
1406
+ if (!el || !toggleEl) return;
1322
1407
  const token = el.dataset.token;
1323
1408
  if (!token) return;
1324
- const currentVersion = el.dataset.version ?? "";
1325
- applyTheme(el);
1409
+ const themeEls = [el, toggleEl];
1410
+ applyTheme(themeEls);
1326
1411
  window.addEventListener("storage", (e3) => {
1327
- if (e3.key === "profiler-theme") applyTheme(el);
1412
+ if (e3.key === "profiler-theme") applyTheme(themeEls);
1328
1413
  });
1329
1414
  window.addEventListener("profiler:theme-change", ((e3) => {
1330
- if (e3.detail?.theme) el.setAttribute("data-theme", e3.detail.theme);
1415
+ if (e3.detail?.theme) themeEls.forEach((elem) => elem.setAttribute("data-theme", e3.detail.theme));
1331
1416
  }));
1332
- const renderToolbar = (profile) => {
1333
- J(/* @__PURE__ */ u3(ToolbarApp, { profile, token, currentVersion }), el);
1334
- applyTheme(el);
1335
- };
1336
- const loadAndRender = () => {
1337
- fetch(`/_profiler/api/toolbar/${token}`).then((res) => res.json()).then((data) => {
1338
- if (data.profile) renderToolbar(data.profile);
1339
- }).catch((err) => console.debug("Profiler toolbar load failed:", err));
1340
- };
1341
- window.__PROFILER_REFRESH_TOOLBAR__ = loadAndRender;
1342
- loadAndRender();
1417
+ let isCollapsed = localStorage.getItem("profiler-toolbar-collapsed") === "true";
1418
+ toggleEl.dataset.collapsed = String(isCollapsed);
1419
+ if (isCollapsed && !el.style.transform) {
1420
+ el.style.animation = "none";
1421
+ el.style.transform = "translateX(calc(100% + 44px))";
1422
+ }
1423
+ if (!isCollapsed) {
1424
+ setTimeout(() => {
1425
+ el.style.animation = "none";
1426
+ }, 400);
1427
+ }
1428
+ function toggleCollapse() {
1429
+ const next = !isCollapsed;
1430
+ isCollapsed = next;
1431
+ localStorage.setItem("profiler-toolbar-collapsed", String(next));
1432
+ toggleEl.dataset.collapsed = String(next);
1433
+ if (next) {
1434
+ el.style.transition = `transform ${ANIM_MS}ms cubic-bezier(0.4,0,0.2,1)`;
1435
+ el.style.transform = "translateX(calc(100% + 44px))";
1436
+ } else {
1437
+ el.style.transition = "none";
1438
+ el.style.transform = "translateX(calc(100% + 44px))";
1439
+ void el.offsetWidth;
1440
+ el.style.transition = `transform ${ANIM_MS}ms cubic-bezier(0.4,0,0.2,1)`;
1441
+ el.style.transform = "translateX(0)";
1442
+ setTimeout(() => {
1443
+ el.style.transform = "";
1444
+ el.style.transition = "";
1445
+ }, ANIM_MS + 50);
1446
+ }
1447
+ }
1448
+ toggleEl.addEventListener("click", toggleCollapse);
1343
1449
  document.addEventListener("keydown", (e3) => {
1344
1450
  if (e3.altKey && e3.key === "p") {
1345
1451
  e3.preventDefault();
1346
- const hidden2 = el.dataset.hidden === "true";
1347
- if (hidden2) {
1348
- el.dataset.hidden = "false";
1349
- el.style.transform = "translateY(0)";
1350
- el.style.opacity = "1";
1351
- localStorage.setItem("profiler-toolbar-hidden", "false");
1352
- } else {
1353
- el.dataset.hidden = "true";
1354
- el.style.transform = "translateY(100%)";
1355
- el.style.opacity = "0";
1356
- localStorage.setItem("profiler-toolbar-hidden", "true");
1357
- }
1358
- }
1359
- if (e3.key === "Escape") {
1360
- el.dataset.hidden = "true";
1361
- el.style.transform = "translateY(100%)";
1362
- el.style.opacity = "0";
1452
+ toggleCollapse();
1363
1453
  }
1364
1454
  });
1365
- const hidden = localStorage.getItem("profiler-toolbar-hidden") === "true";
1366
- if (hidden) {
1367
- el.dataset.hidden = "true";
1368
- el.style.transform = "translateY(100%)";
1369
- el.style.opacity = "0";
1370
- }
1455
+ J(/* @__PURE__ */ u3(ToolbarMount, { token }), el);
1371
1456
  }
1372
1457
  if (document.readyState === "loading") {
1373
1458
  document.addEventListener("DOMContentLoaded", mountToolbar);
@@ -1395,6 +1395,26 @@ tr:hover .btn-row-delete {
1395
1395
  color: var(--profiler-text-muted);
1396
1396
  }
1397
1397
 
1398
+ @keyframes pfPop {
1399
+ 0% {
1400
+ transform: scaleX(1);
1401
+ }
1402
+ 15% {
1403
+ transform: scaleX(1.18);
1404
+ }
1405
+ 40% {
1406
+ transform: scaleX(0.87);
1407
+ }
1408
+ 65% {
1409
+ transform: scaleX(1.08);
1410
+ }
1411
+ 85% {
1412
+ transform: scaleX(0.97);
1413
+ }
1414
+ 100% {
1415
+ transform: scaleX(1);
1416
+ }
1417
+ }
1398
1418
  #profiler-toolbar {
1399
1419
  position: fixed;
1400
1420
  bottom: 0;
@@ -1409,6 +1429,7 @@ tr:hover .btn-row-delete {
1409
1429
  font-family: var(--profiler-font-mono);
1410
1430
  font-size: 11px;
1411
1431
  animation: toolbarIn 300ms cubic-bezier(0.4, 0, 0.2, 1) both;
1432
+ transition: left 280ms cubic-bezier(0.4, 0, 0.2, 1);
1412
1433
  }
1413
1434
  #profiler-toolbar::before {
1414
1435
  content: "";
@@ -1464,12 +1485,10 @@ tr:hover .btn-row-delete {
1464
1485
  background: var(--profiler-accent);
1465
1486
  transform: scaleX(0);
1466
1487
  transform-origin: left;
1467
- transition: transform var(--profiler-transition-base);
1488
+ transition: transform 280ms cubic-bezier(0.34, 1.4, 0.64, 1);
1468
1489
  }
1469
1490
  .profiler-toolbar-item:last-child {
1470
1491
  border-right: none;
1471
- margin-left: auto;
1472
- padding-left: 20px;
1473
1492
  }
1474
1493
  .profiler-toolbar-item:hover {
1475
1494
  color: var(--profiler-text);
@@ -1479,12 +1498,30 @@ tr:hover .btn-row-delete {
1479
1498
  transform: scaleX(1);
1480
1499
  }
1481
1500
 
1501
+ .profiler-toolbar-collapse-btn {
1502
+ margin-left: auto;
1503
+ padding: 0 14px;
1504
+ border-left: 1px solid var(--profiler-border);
1505
+ font-size: 10px;
1506
+ color: var(--profiler-text-muted);
1507
+ cursor: pointer;
1508
+ }
1509
+ .profiler-toolbar-collapse-btn:hover {
1510
+ color: var(--profiler-text);
1511
+ background: var(--profiler-accent-bg);
1512
+ animation: pfPop 380ms ease-out both;
1513
+ }
1514
+
1482
1515
  a.profiler-toolbar-item {
1483
1516
  cursor: pointer;
1484
1517
  font-family: var(--profiler-font-mono);
1485
1518
  font-size: 11px;
1486
1519
  }
1487
1520
 
1521
+ .profiler-toolbar-logo {
1522
+ border-right: 1px solid var(--profiler-border) !important;
1523
+ }
1524
+
1488
1525
  .profiler-text--success {
1489
1526
  color: var(--profiler-success) !important;
1490
1527
  }
@@ -1505,19 +1542,22 @@ a.profiler-toolbar-item {
1505
1542
  color: var(--profiler-accent) !important;
1506
1543
  }
1507
1544
 
1508
- a.profiler-toolbar-item.profiler-text--error::after {
1545
+ .profiler-toolbar-item.profiler-text--error::after {
1509
1546
  background: var(--profiler-error);
1510
1547
  }
1511
1548
 
1512
- a.profiler-toolbar-item.profiler-text--warning::after {
1549
+ .profiler-toolbar-item.profiler-text--warning::after {
1513
1550
  background: var(--profiler-warning);
1514
1551
  }
1515
1552
 
1553
+ .profiler-toolbar-item.profiler-text--success::after {
1554
+ background: var(--profiler-success);
1555
+ }
1556
+
1516
1557
  .profiler-toolbar-hoverable {
1517
1558
  position: relative;
1518
1559
  }
1519
1560
  .profiler-toolbar-hoverable .profiler-toolbar-panel {
1520
- display: none;
1521
1561
  position: absolute;
1522
1562
  bottom: calc(100% + 12px);
1523
1563
  left: 50%;
@@ -1530,6 +1570,16 @@ a.profiler-toolbar-item.profiler-text--warning::after {
1530
1570
  box-shadow: var(--profiler-shadow-xl), 0 0 0 1px var(--profiler-border-accent);
1531
1571
  z-index: var(--profiler-z-panel);
1532
1572
  overflow: hidden;
1573
+ opacity: 0;
1574
+ visibility: hidden;
1575
+ pointer-events: none;
1576
+ transition: opacity 160ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 160ms;
1577
+ }
1578
+ .profiler-toolbar-hoverable .profiler-toolbar-panel.is-visible {
1579
+ opacity: 1;
1580
+ visibility: visible;
1581
+ pointer-events: auto;
1582
+ transition: opacity 160ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s;
1533
1583
  }
1534
1584
  .profiler-toolbar-hoverable .profiler-toolbar-panel::before {
1535
1585
  content: "";
@@ -1674,6 +1724,16 @@ a.profiler-toolbar-item.profiler-text--warning::after {
1674
1724
  margin-top: 6px;
1675
1725
  }
1676
1726
 
1727
+ #profiler-toolbar[data-collapsed=true] .profiler-toolbar-item:not(.profiler-toolbar-collapse-btn) {
1728
+ display: none;
1729
+ }
1730
+ #profiler-toolbar[data-collapsed=true] .profiler-toolbar-collapse-btn {
1731
+ margin-left: 0;
1732
+ }
1733
+ #profiler-toolbar[data-collapsed=true]::before {
1734
+ opacity: 0;
1735
+ }
1736
+
1677
1737
  .container > table {
1678
1738
  width: 100%;
1679
1739
  border-collapse: collapse;