@plumix/core 0.1.4 → 0.2.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.
- package/dist/admin-bar/collect.d.ts.map +1 -1
- package/dist/admin-bar/collect.js +1 -15
- package/dist/admin-bar/collect.js.map +1 -1
- package/dist/admin-bar/styles.d.ts.map +1 -1
- package/dist/admin-bar/styles.js +1 -11
- package/dist/admin-bar/styles.js.map +1 -1
- package/dist/cli/worker-codegen.d.ts.map +1 -1
- package/dist/cli/worker-codegen.js +3 -5
- package/dist/cli/worker-codegen.js.map +1 -1
- package/dist/context/app.d.ts +8 -0
- package/dist/context/app.d.ts.map +1 -1
- package/dist/context/app.js +7 -0
- package/dist/context/app.js.map +1 -1
- package/dist/context/debug.d.ts +25 -0
- package/dist/context/debug.d.ts.map +1 -0
- package/dist/context/debug.js +13 -0
- package/dist/context/debug.js.map +1 -0
- package/dist/context/stores.d.ts +2 -0
- package/dist/context/stores.d.ts.map +1 -1
- package/dist/context/stores.js.map +1 -1
- package/dist/css-tag.d.ts +2 -0
- package/dist/css-tag.d.ts.map +1 -0
- package/dist/css-tag.js +13 -0
- package/dist/css-tag.js.map +1 -0
- package/dist/db/libsql.d.ts.map +1 -1
- package/dist/db/libsql.js +13 -2
- package/dist/db/libsql.js.map +1 -1
- package/dist/debug-bar/collect.d.ts.map +1 -1
- package/dist/debug-bar/collect.js +1 -15
- package/dist/debug-bar/collect.js.map +1 -1
- package/dist/debug-bar/collector.d.ts +9 -0
- package/dist/debug-bar/collector.d.ts.map +1 -0
- package/dist/debug-bar/collector.js +80 -0
- package/dist/debug-bar/collector.js.map +1 -0
- package/dist/debug-bar/component.d.ts.map +1 -1
- package/dist/debug-bar/component.js +15 -2
- package/dist/debug-bar/component.js.map +1 -1
- package/dist/debug-bar/core-panels.d.ts.map +1 -1
- package/dist/debug-bar/core-panels.js +12 -1
- package/dist/debug-bar/core-panels.js.map +1 -1
- package/dist/debug-bar/db-query.d.ts +21 -0
- package/dist/debug-bar/db-query.d.ts.map +1 -0
- package/dist/debug-bar/db-query.js +23 -0
- package/dist/debug-bar/db-query.js.map +1 -0
- package/dist/debug-bar/format-param.d.ts +14 -0
- package/dist/debug-bar/format-param.d.ts.map +1 -0
- package/dist/debug-bar/format-param.js +27 -0
- package/dist/debug-bar/format-param.js.map +1 -0
- package/dist/debug-bar/highlight-sql.d.ts +11 -0
- package/dist/debug-bar/highlight-sql.d.ts.map +1 -0
- package/dist/debug-bar/highlight-sql.js +82 -0
- package/dist/debug-bar/highlight-sql.js.map +1 -0
- package/dist/debug-bar/panels/app.d.ts +8 -0
- package/dist/debug-bar/panels/app.d.ts.map +1 -0
- package/dist/debug-bar/panels/app.js +32 -0
- package/dist/debug-bar/panels/app.js.map +1 -0
- package/dist/debug-bar/panels/database.d.ts +9 -0
- package/dist/debug-bar/panels/database.d.ts.map +1 -0
- package/dist/debug-bar/panels/database.js +33 -0
- package/dist/debug-bar/panels/database.js.map +1 -0
- package/dist/debug-bar/panels/request.d.ts +2 -2
- package/dist/debug-bar/panels/request.d.ts.map +1 -1
- package/dist/debug-bar/panels/request.js +24 -11
- package/dist/debug-bar/panels/request.js.map +1 -1
- package/dist/debug-bar/panels/template.d.ts +17 -0
- package/dist/debug-bar/panels/template.d.ts.map +1 -0
- package/dist/debug-bar/panels/template.js +26 -0
- package/dist/debug-bar/panels/template.js.map +1 -0
- package/dist/debug-bar/panels/timeline.d.ts +11 -0
- package/dist/debug-bar/panels/timeline.d.ts.map +1 -0
- package/dist/debug-bar/panels/timeline.js +46 -0
- package/dist/debug-bar/panels/timeline.js.map +1 -0
- package/dist/debug-bar/primitives.d.ts +12 -3
- package/dist/debug-bar/primitives.d.ts.map +1 -1
- package/dist/debug-bar/primitives.js +17 -1
- package/dist/debug-bar/primitives.js.map +1 -1
- package/dist/debug-bar/styles.d.ts.map +1 -1
- package/dist/debug-bar/styles.js +234 -17
- package/dist/debug-bar/styles.js.map +1 -1
- package/dist/debug-bar/template-node-label.d.ts +6 -0
- package/dist/debug-bar/template-node-label.d.ts.map +1 -0
- package/dist/debug-bar/template-node-label.js +20 -0
- package/dist/debug-bar/template-node-label.js.map +1 -0
- package/dist/debug-bar/timeline-geometry.d.ts +30 -0
- package/dist/debug-bar/timeline-geometry.d.ts.map +1 -0
- package/dist/debug-bar/timeline-geometry.js +26 -0
- package/dist/debug-bar/timeline-geometry.js.map +1 -0
- package/dist/debug-bar/timeline-model.d.ts +23 -0
- package/dist/debug-bar/timeline-model.d.ts.map +1 -0
- package/dist/debug-bar/timeline-model.js +34 -0
- package/dist/debug-bar/timeline-model.js.map +1 -0
- package/dist/debug-bar/trace-libsql.d.ts +18 -0
- package/dist/debug-bar/trace-libsql.d.ts.map +1 -0
- package/dist/debug-bar/trace-libsql.js +42 -0
- package/dist/debug-bar/trace-libsql.js.map +1 -0
- package/dist/debug-bar/types.d.ts +6 -0
- package/dist/debug-bar/types.d.ts.map +1 -1
- package/dist/hooks/registry.d.ts +14 -3
- package/dist/hooks/registry.d.ts.map +1 -1
- package/dist/hooks/registry.js +22 -0
- package/dist/hooks/registry.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin/manifest.d.ts +3 -0
- package/dist/plugin/manifest.d.ts.map +1 -1
- package/dist/plugin/manifest.js +1 -0
- package/dist/plugin/manifest.js.map +1 -1
- package/dist/plugin/register.d.ts.map +1 -1
- package/dist/plugin/register.js +1 -0
- package/dist/plugin/register.js.map +1 -1
- package/dist/route/render/render-template.d.ts +1 -1
- package/dist/route/render/render-template.d.ts.map +1 -1
- package/dist/route/render/render-template.js +17 -1
- package/dist/route/render/render-template.js.map +1 -1
- package/dist/runtime/app.d.ts +8 -5
- package/dist/runtime/app.d.ts.map +1 -1
- package/dist/runtime/app.js +1 -1
- package/dist/runtime/app.js.map +1 -1
- package/dist/runtime/dispatcher.d.ts.map +1 -1
- package/dist/runtime/dispatcher.js +4 -2
- package/dist/runtime/dispatcher.js.map +1 -1
- package/dist/test/dispatcher.d.ts +3 -0
- package/dist/test/dispatcher.d.ts.map +1 -1
- package/dist/test/dispatcher.js +8 -2
- package/dist/test/dispatcher.js.map +1 -1
- package/dist/test/harness.d.ts.map +1 -1
- package/dist/test/harness.js +12 -2
- package/dist/test/harness.js.map +1 -1
- package/package.json +2 -2
package/dist/debug-bar/styles.js
CHANGED
|
@@ -6,21 +6,17 @@
|
|
|
6
6
|
// structural elements, which neutralizes the common `table {}`/`label {}`-style
|
|
7
7
|
// theme element selectors — not airtight, but enough for a dev tool. Zero-JS:
|
|
8
8
|
// a native <details> toggles the panel and radio inputs drive the tabs.
|
|
9
|
-
|
|
10
|
-
function css(strings, ...values) {
|
|
11
|
-
let out = strings[0] ?? "";
|
|
12
|
-
for (let i = 0; i < values.length; i++) {
|
|
13
|
-
out += values[i] + (strings[i + 1] ?? "");
|
|
14
|
-
}
|
|
15
|
-
return out;
|
|
16
|
-
}
|
|
9
|
+
import { css } from "../css-tag.js";
|
|
17
10
|
// Upper bound on pure-CSS tab wiring. Panels beyond this still render but
|
|
18
11
|
// their tab won't toggle; core ships far fewer than this.
|
|
19
12
|
const MAX_TABS = 16;
|
|
20
13
|
function tabRules() {
|
|
21
14
|
let out = "";
|
|
22
15
|
for (let n = 1; n <= MAX_TABS; n++) {
|
|
16
|
+
// Show the checked tab's pane...
|
|
23
17
|
out += `.plumix-debug-bar__radio:nth-of-type(${n}):checked ~ .plumix-debug-bar__panes > .plumix-debug-bar__pane:nth-of-type(${n}){display:block}`;
|
|
18
|
+
// ...and highlight its label so the active tab is obvious.
|
|
19
|
+
out += `.plumix-debug-bar__radio:nth-of-type(${n}):checked ~ .plumix-debug-bar__labels > label:nth-of-type(${n}){background:#1d2327;color:#fff}`;
|
|
24
20
|
}
|
|
25
21
|
return out;
|
|
26
22
|
}
|
|
@@ -49,7 +45,10 @@ export const DEBUG_BAR_CSS = css `
|
|
|
49
45
|
font-size: 12px;
|
|
50
46
|
line-height: 1.5;
|
|
51
47
|
color: #e6e6e6;
|
|
52
|
-
max-width
|
|
48
|
+
/* Fixed width (not max-width) so switching tabs can't resize the bar —
|
|
49
|
+
a content-driven width shifts the anchored edges and moves the tab
|
|
50
|
+
labels out from under the cursor. */
|
|
51
|
+
width: min(440px, calc(100vw - 24px));
|
|
53
52
|
}
|
|
54
53
|
.plumix-debug-bar *,
|
|
55
54
|
.plumix-debug-bar *::before,
|
|
@@ -69,7 +68,10 @@ export const DEBUG_BAR_CSS = css `
|
|
|
69
68
|
.plumix-debug-bar tbody,
|
|
70
69
|
.plumix-debug-bar tr,
|
|
71
70
|
.plumix-debug-bar th,
|
|
72
|
-
.plumix-debug-bar td
|
|
71
|
+
.plumix-debug-bar td,
|
|
72
|
+
.plumix-debug-bar dl,
|
|
73
|
+
.plumix-debug-bar dt,
|
|
74
|
+
.plumix-debug-bar dd {
|
|
73
75
|
margin: 0;
|
|
74
76
|
padding: 0;
|
|
75
77
|
border: 0;
|
|
@@ -77,6 +79,15 @@ export const DEBUG_BAR_CSS = css `
|
|
|
77
79
|
font: inherit;
|
|
78
80
|
color: inherit;
|
|
79
81
|
text-align: inherit;
|
|
82
|
+
/* The font shorthand omits these — reset them so a theme's element
|
|
83
|
+
rules (e.g. label text-transform/letter-spacing) can't bleed in. */
|
|
84
|
+
text-transform: none;
|
|
85
|
+
letter-spacing: normal;
|
|
86
|
+
word-spacing: normal;
|
|
87
|
+
text-decoration: none;
|
|
88
|
+
text-indent: 0;
|
|
89
|
+
white-space: normal;
|
|
90
|
+
box-shadow: none;
|
|
80
91
|
}
|
|
81
92
|
.plumix-debug-bar > details {
|
|
82
93
|
background: #1d2327;
|
|
@@ -96,36 +107,115 @@ export const DEBUG_BAR_CSS = css `
|
|
|
96
107
|
.plumix-debug-bar summary::-webkit-details-marker {
|
|
97
108
|
display: none;
|
|
98
109
|
}
|
|
110
|
+
/* Toggle affordance: chevron points right when collapsed, down when open,
|
|
111
|
+
so it's clear the header opens and closes the bar. */
|
|
112
|
+
.plumix-debug-bar summary::after {
|
|
113
|
+
content: "▸";
|
|
114
|
+
float: right;
|
|
115
|
+
opacity: 0.6;
|
|
116
|
+
}
|
|
117
|
+
.plumix-debug-bar > details[open] > summary::after {
|
|
118
|
+
content: "▾";
|
|
119
|
+
}
|
|
99
120
|
.plumix-debug-bar__radio {
|
|
100
121
|
position: absolute;
|
|
101
122
|
opacity: 0;
|
|
102
123
|
pointer-events: none;
|
|
103
124
|
}
|
|
104
|
-
|
|
125
|
+
/* Qualified with nav so this out-specifies the element reset (which zeroes
|
|
126
|
+
nav padding) — otherwise the tabs get no left inset and hug the border. */
|
|
127
|
+
.plumix-debug-bar nav.plumix-debug-bar__labels {
|
|
105
128
|
display: flex;
|
|
106
129
|
flex-wrap: wrap;
|
|
107
|
-
gap:
|
|
108
|
-
|
|
130
|
+
gap: 6px;
|
|
131
|
+
/* 12px left inset matches the summary and panes; generous top padding
|
|
132
|
+
gives the tab row space below the header. */
|
|
133
|
+
padding: 14px 12px 0;
|
|
109
134
|
border-top: 1px solid #3c434a;
|
|
110
135
|
}
|
|
111
136
|
.plumix-debug-bar__labels label {
|
|
112
|
-
padding
|
|
137
|
+
/* No LEFT padding, so the tab text aligns exactly with the title and
|
|
138
|
+
content at 12px. Right padding gives the active box separation without
|
|
139
|
+
letting it overhang toward the border. */
|
|
140
|
+
padding: 3px 8px 3px 0;
|
|
113
141
|
border-radius: 4px 4px 0 0;
|
|
114
142
|
cursor: pointer;
|
|
115
143
|
color: #b9c0c7;
|
|
144
|
+
/* Intentional small-caps tab look, matching __section-title. Our own
|
|
145
|
+
rule (wins over the reset by source order), so it's theme-independent. */
|
|
146
|
+
font-size: 11px;
|
|
147
|
+
text-transform: uppercase;
|
|
148
|
+
letter-spacing: 0.04em;
|
|
116
149
|
}
|
|
117
150
|
.plumix-debug-bar__labels label:hover {
|
|
118
151
|
background: #2c3338;
|
|
119
152
|
color: #fff;
|
|
120
153
|
}
|
|
121
154
|
.plumix-debug-bar__panes {
|
|
122
|
-
|
|
123
|
-
|
|
155
|
+
/* Small horizontal inset so cards sit just off the bar edge; the card's
|
|
156
|
+
own padding adds the rest, landing content text at 12px — flush with
|
|
157
|
+
the summary title and tab row above. */
|
|
158
|
+
padding: 10px 4px 12px;
|
|
159
|
+
/* Fixed height (not max-height) so the bar doesn't grow/shrink between
|
|
160
|
+
tabs; each pane scrolls within the stable frame. */
|
|
161
|
+
height: min(50vh, 320px);
|
|
124
162
|
overflow: auto;
|
|
163
|
+
/* Narrow, theme-matched scrollbar instead of the OS default. */
|
|
164
|
+
scrollbar-width: thin;
|
|
165
|
+
scrollbar-color: #3c434a transparent;
|
|
166
|
+
}
|
|
167
|
+
.plumix-debug-bar__panes::-webkit-scrollbar {
|
|
168
|
+
width: 8px;
|
|
169
|
+
height: 8px;
|
|
170
|
+
}
|
|
171
|
+
.plumix-debug-bar__panes::-webkit-scrollbar-thumb {
|
|
172
|
+
background: #3c434a;
|
|
173
|
+
border-radius: 4px;
|
|
174
|
+
}
|
|
175
|
+
.plumix-debug-bar__panes::-webkit-scrollbar-thumb:hover {
|
|
176
|
+
background: #4a535b;
|
|
177
|
+
}
|
|
178
|
+
.plumix-debug-bar__panes::-webkit-scrollbar-track {
|
|
179
|
+
background: transparent;
|
|
125
180
|
}
|
|
126
181
|
.plumix-debug-bar__pane {
|
|
127
182
|
display: none;
|
|
128
183
|
}
|
|
184
|
+
.plumix-debug-bar__section-title {
|
|
185
|
+
margin: 0 0 6px;
|
|
186
|
+
font-size: 11px;
|
|
187
|
+
text-transform: uppercase;
|
|
188
|
+
letter-spacing: 0.04em;
|
|
189
|
+
color: #8a929a;
|
|
190
|
+
}
|
|
191
|
+
/* Key/value description list — a fixed first column so every value lines
|
|
192
|
+
up the same distance in, across all sections. */
|
|
193
|
+
.plumix-debug-bar__kv {
|
|
194
|
+
display: grid;
|
|
195
|
+
grid-template-columns: 104px 1fr;
|
|
196
|
+
gap: 3px 8px;
|
|
197
|
+
align-items: baseline;
|
|
198
|
+
}
|
|
199
|
+
.plumix-debug-bar__kv dt {
|
|
200
|
+
color: #8a929a;
|
|
201
|
+
}
|
|
202
|
+
.plumix-debug-bar__kv dd {
|
|
203
|
+
color: #fff;
|
|
204
|
+
overflow-wrap: anywhere;
|
|
205
|
+
}
|
|
206
|
+
/* Group each section as a subtle card. */
|
|
207
|
+
.plumix-debug-bar__pane > section {
|
|
208
|
+
background: #23282f;
|
|
209
|
+
border-radius: 6px;
|
|
210
|
+
padding: 8px;
|
|
211
|
+
}
|
|
212
|
+
.plumix-debug-bar__pane > section + section {
|
|
213
|
+
margin-top: 8px;
|
|
214
|
+
}
|
|
215
|
+
.plumix-debug-bar__error {
|
|
216
|
+
margin: 0;
|
|
217
|
+
color: #f0a5a5;
|
|
218
|
+
}
|
|
129
219
|
.plumix-debug-bar table {
|
|
130
220
|
width: 100%;
|
|
131
221
|
border-collapse: collapse;
|
|
@@ -143,12 +233,139 @@ export const DEBUG_BAR_CSS = css `
|
|
|
143
233
|
}
|
|
144
234
|
.plumix-debug-bar td.plumix-debug-bar__val {
|
|
145
235
|
white-space: normal;
|
|
146
|
-
|
|
236
|
+
/* Wrap long values at spaces (and break a word only if it would
|
|
237
|
+
overflow) without squeezing short cells — word-break:break-word
|
|
238
|
+
shrank the numeric columns until a value like 1.8 wrapped. */
|
|
239
|
+
overflow-wrap: break-word;
|
|
147
240
|
color: #fff;
|
|
148
241
|
}
|
|
149
242
|
.plumix-debug-bar th {
|
|
150
243
|
color: #8a929a;
|
|
151
244
|
}
|
|
245
|
+
.plumix-debug-bar__empty {
|
|
246
|
+
margin: 0;
|
|
247
|
+
color: #8a929a;
|
|
248
|
+
}
|
|
249
|
+
/* Template panel — candidate hierarchy */
|
|
250
|
+
.plumix-debug-bar__candidates {
|
|
251
|
+
list-style: none;
|
|
252
|
+
margin: 0;
|
|
253
|
+
padding: 0;
|
|
254
|
+
}
|
|
255
|
+
.plumix-debug-bar__candidate {
|
|
256
|
+
padding: 1px 0 1px 14px;
|
|
257
|
+
color: #8a929a;
|
|
258
|
+
}
|
|
259
|
+
.plumix-debug-bar__candidate--picked {
|
|
260
|
+
color: #7ee787;
|
|
261
|
+
font-weight: 600;
|
|
262
|
+
}
|
|
263
|
+
.plumix-debug-bar__candidate--picked::before {
|
|
264
|
+
content: "▸ ";
|
|
265
|
+
margin-left: -14px;
|
|
266
|
+
}
|
|
267
|
+
/* Timeline panel — SVG waterfall */
|
|
268
|
+
.plumix-debug-bar__timeline {
|
|
269
|
+
display: block;
|
|
270
|
+
overflow: visible;
|
|
271
|
+
}
|
|
272
|
+
.plumix-debug-bar__timeline-bar {
|
|
273
|
+
fill: #6ea8fe;
|
|
274
|
+
}
|
|
275
|
+
.plumix-debug-bar__timeline-name {
|
|
276
|
+
fill: #e6e6e6;
|
|
277
|
+
font-size: 10px;
|
|
278
|
+
}
|
|
279
|
+
.plumix-debug-bar__timeline-ms {
|
|
280
|
+
fill: #8a929a;
|
|
281
|
+
font-size: 9px;
|
|
282
|
+
}
|
|
283
|
+
/* Database panel — query list */
|
|
284
|
+
.plumix-debug-bar__queries {
|
|
285
|
+
list-style: none;
|
|
286
|
+
margin: 0;
|
|
287
|
+
padding: 0;
|
|
288
|
+
display: flex;
|
|
289
|
+
flex-direction: column;
|
|
290
|
+
gap: 8px;
|
|
291
|
+
}
|
|
292
|
+
.plumix-debug-bar__query {
|
|
293
|
+
display: flex;
|
|
294
|
+
flex-direction: column;
|
|
295
|
+
gap: 3px;
|
|
296
|
+
padding-bottom: 8px;
|
|
297
|
+
border-bottom: 1px solid #2c3338;
|
|
298
|
+
}
|
|
299
|
+
.plumix-debug-bar__query:last-child {
|
|
300
|
+
border-bottom: 0;
|
|
301
|
+
padding-bottom: 0;
|
|
302
|
+
}
|
|
303
|
+
.plumix-debug-bar__query-head {
|
|
304
|
+
display: flex;
|
|
305
|
+
gap: 6px;
|
|
306
|
+
align-items: baseline;
|
|
307
|
+
}
|
|
308
|
+
.plumix-debug-bar__kind {
|
|
309
|
+
flex: 0 0 auto;
|
|
310
|
+
font-size: 9px;
|
|
311
|
+
text-transform: uppercase;
|
|
312
|
+
letter-spacing: 0.04em;
|
|
313
|
+
padding: 1px 5px;
|
|
314
|
+
border-radius: 3px;
|
|
315
|
+
background: #2c3338;
|
|
316
|
+
color: #b9c0c7;
|
|
317
|
+
}
|
|
318
|
+
.plumix-debug-bar__kind--select {
|
|
319
|
+
background: rgba(126, 231, 135, 0.15);
|
|
320
|
+
color: #7ee787;
|
|
321
|
+
}
|
|
322
|
+
.plumix-debug-bar__kind--insert {
|
|
323
|
+
background: rgba(110, 168, 254, 0.15);
|
|
324
|
+
color: #6ea8fe;
|
|
325
|
+
}
|
|
326
|
+
.plumix-debug-bar__kind--update {
|
|
327
|
+
background: rgba(227, 179, 65, 0.15);
|
|
328
|
+
color: #e3b341;
|
|
329
|
+
}
|
|
330
|
+
.plumix-debug-bar__kind--delete {
|
|
331
|
+
background: rgba(240, 165, 165, 0.15);
|
|
332
|
+
color: #f0a5a5;
|
|
333
|
+
}
|
|
334
|
+
.plumix-debug-bar__sql {
|
|
335
|
+
font-family: inherit;
|
|
336
|
+
color: #c9d1d9;
|
|
337
|
+
overflow-wrap: anywhere;
|
|
338
|
+
}
|
|
339
|
+
.plumix-debug-bar__tok--keyword {
|
|
340
|
+
color: #6ea8fe;
|
|
341
|
+
}
|
|
342
|
+
.plumix-debug-bar__tok--string {
|
|
343
|
+
color: #7ee787;
|
|
344
|
+
}
|
|
345
|
+
.plumix-debug-bar__tok--number {
|
|
346
|
+
color: #56d4dd;
|
|
347
|
+
}
|
|
348
|
+
.plumix-debug-bar__params {
|
|
349
|
+
display: flex;
|
|
350
|
+
flex-wrap: wrap;
|
|
351
|
+
gap: 6px;
|
|
352
|
+
padding-left: 10px;
|
|
353
|
+
}
|
|
354
|
+
.plumix-debug-bar__param {
|
|
355
|
+
color: #b9c0c7;
|
|
356
|
+
}
|
|
357
|
+
.plumix-debug-bar__param--string {
|
|
358
|
+
color: #7ee787;
|
|
359
|
+
}
|
|
360
|
+
.plumix-debug-bar__param--number {
|
|
361
|
+
color: #56d4dd;
|
|
362
|
+
}
|
|
363
|
+
.plumix-debug-bar__param--boolean {
|
|
364
|
+
color: #e3b341;
|
|
365
|
+
}
|
|
366
|
+
.plumix-debug-bar__param--null {
|
|
367
|
+
color: #8a929a;
|
|
368
|
+
}
|
|
152
369
|
` +
|
|
153
370
|
POSITION_CSS +
|
|
154
371
|
tabRules();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/debug-bar/styles.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,4EAA4E;AAC5E,8EAA8E;AAC9E,8EAA8E;AAC9E,uEAAuE;AACvE,gFAAgF;AAChF,8EAA8E;AAC9E,wEAAwE;AAExE
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/debug-bar/styles.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,4EAA4E;AAC5E,8EAA8E;AAC9E,8EAA8E;AAC9E,uEAAuE;AACvE,gFAAgF;AAChF,8EAA8E;AAC9E,wEAAwE;AAExE,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,0EAA0E;AAC1E,0DAA0D;AAC1D,MAAM,QAAQ,GAAG,EAAE,CAAC;AAEpB,SAAS,QAAQ;IACf,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,iCAAiC;QACjC,GAAG,IAAI,wCAAwC,CAAC,8EAA8E,CAAC,kBAAkB,CAAC;QAClJ,2DAA2D;QAC3D,GAAG,IAAI,wCAAwC,CAAC,6DAA6D,CAAC,kCAAkC,CAAC;IACnJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,YAAY,GAAG,GAAG,CAAA;;;;;;;;;;;;;CAavB,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GACxB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4UF;IACD,YAAY;IACZ,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ResolvedNode } from "../route/render/template-hierarchy.js";
|
|
2
|
+
/** Panel id + collector namespace for the template hierarchy resolution. */
|
|
3
|
+
export declare const TEMPLATE_PANEL_ID = "template";
|
|
4
|
+
/** A human label for the resolved route node, for the Template panel. */
|
|
5
|
+
export declare function templateNodeLabel(node: ResolvedNode): string;
|
|
6
|
+
//# sourceMappingURL=template-node-label.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-node-label.d.ts","sourceRoot":"","sources":["../../src/debug-bar/template-node-label.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAE1E,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,aAAa,CAAC;AAE5C,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAe5D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Panel id + collector namespace for the template hierarchy resolution. */
|
|
2
|
+
export const TEMPLATE_PANEL_ID = "template";
|
|
3
|
+
/** A human label for the resolved route node, for the Template panel. */
|
|
4
|
+
export function templateNodeLabel(node) {
|
|
5
|
+
switch (node.kind) {
|
|
6
|
+
case "content":
|
|
7
|
+
return `${node.entryType}: ${node.slug}`;
|
|
8
|
+
case "term":
|
|
9
|
+
return `${node.taxonomy}: ${node.slug}`;
|
|
10
|
+
case "content-type-archive":
|
|
11
|
+
return `${node.entryType} archive`;
|
|
12
|
+
case "front-page":
|
|
13
|
+
return "front page";
|
|
14
|
+
case "posts-page":
|
|
15
|
+
return "posts page";
|
|
16
|
+
case "search":
|
|
17
|
+
return "search";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=template-node-label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-node-label.js","sourceRoot":"","sources":["../../src/debug-bar/template-node-label.ts"],"names":[],"mappings":"AAEA,4EAA4E;AAC5E,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAE5C,yEAAyE;AACzE,MAAM,UAAU,iBAAiB,CAAC,IAAkB;IAClD,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,SAAS;YACZ,OAAO,GAAG,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QAC3C,KAAK,MAAM;YACT,OAAO,GAAG,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QAC1C,KAAK,sBAAsB;YACzB,OAAO,GAAG,IAAI,CAAC,SAAS,UAAU,CAAC;QACrC,KAAK,YAAY;YACf,OAAO,YAAY,CAAC;QACtB,KAAK,YAAY;YACf,OAAO,YAAY,CAAC;QACtB,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC;IACpB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Timeline } from "./timeline-model.js";
|
|
2
|
+
export interface TimelineRectOptions {
|
|
3
|
+
/** Total SVG width the waterfall is scaled into. */
|
|
4
|
+
readonly width: number;
|
|
5
|
+
readonly rowHeight: number;
|
|
6
|
+
/** Vertical gap between rows. */
|
|
7
|
+
readonly rowGap: number;
|
|
8
|
+
/** Floor width so zero- and sub-pixel-duration bars stay visible. */
|
|
9
|
+
readonly minBarWidth: number;
|
|
10
|
+
}
|
|
11
|
+
interface TimelineRect {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly x: number;
|
|
14
|
+
readonly y: number;
|
|
15
|
+
readonly width: number;
|
|
16
|
+
readonly height: number;
|
|
17
|
+
}
|
|
18
|
+
export interface TimelineGeometry {
|
|
19
|
+
readonly width: number;
|
|
20
|
+
readonly height: number;
|
|
21
|
+
readonly rects: readonly TimelineRect[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Maps a {@link Timeline} to SVG rectangle coordinates for the waterfall. Pure
|
|
25
|
+
* and dimensionless of any DOM — one row per span, stacked top to bottom, each
|
|
26
|
+
* bar positioned and scaled against the window. The panel renders the rects.
|
|
27
|
+
*/
|
|
28
|
+
export declare function timelineGeometry(timeline: Timeline, options: TimelineRectOptions): TimelineGeometry;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=timeline-geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline-geometry.d.ts","sourceRoot":"","sources":["../../src/debug-bar/timeline-geometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,WAAW,mBAAmB;IAClC,oDAAoD;IACpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,iCAAiC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,UAAU,YAAY;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;CACzC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,mBAAmB,GAC3B,gBAAgB,CAuBlB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps a {@link Timeline} to SVG rectangle coordinates for the waterfall. Pure
|
|
3
|
+
* and dimensionless of any DOM — one row per span, stacked top to bottom, each
|
|
4
|
+
* bar positioned and scaled against the window. The panel renders the rects.
|
|
5
|
+
*/
|
|
6
|
+
export function timelineGeometry(timeline, options) {
|
|
7
|
+
const { width, rowHeight, rowGap, minBarWidth } = options;
|
|
8
|
+
const { rows, totalMs } = timeline;
|
|
9
|
+
const scale = totalMs > 0 ? width / totalMs : 0;
|
|
10
|
+
const rects = rows.map((row, i) => {
|
|
11
|
+
const barWidth = Math.max(row.durationMs * scale, minBarWidth);
|
|
12
|
+
return {
|
|
13
|
+
name: row.name,
|
|
14
|
+
// Clamp so a bar at (or near) the window end doesn't spill past the edge.
|
|
15
|
+
x: Math.min(row.offsetMs * scale, width - barWidth),
|
|
16
|
+
y: i * (rowHeight + rowGap),
|
|
17
|
+
width: barWidth,
|
|
18
|
+
height: rowHeight,
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
const height = rows.length === 0
|
|
22
|
+
? 0
|
|
23
|
+
: rows.length * rowHeight + (rows.length - 1) * rowGap;
|
|
24
|
+
return { width, height, rects };
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=timeline-geometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline-geometry.js","sourceRoot":"","sources":["../../src/debug-bar/timeline-geometry.ts"],"names":[],"mappings":"AA0BA;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAAkB,EAClB,OAA4B;IAE5B,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAC1D,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC;IACnC,MAAM,KAAK,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,GAAG,KAAK,EAAE,WAAW,CAAC,CAAC;QAC/D,OAAO;YACL,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,0EAA0E;YAC1E,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,GAAG,KAAK,EAAE,KAAK,GAAG,QAAQ,CAAC;YACnD,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,GAAG,MAAM,CAAC;YAC3B,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,SAAS;SAClB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,MAAM,GACV,IAAI,CAAC,MAAM,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,SAAS,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;IAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { TraceSpan } from "../context/stores.js";
|
|
2
|
+
/** A span flattened into a single waterfall row. */
|
|
3
|
+
interface TimelineRow {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
/** Nesting depth; 0 for a root span. */
|
|
6
|
+
readonly depth: number;
|
|
7
|
+
/** Start offset from the timeline window's start, in ms. */
|
|
8
|
+
readonly offsetMs: number;
|
|
9
|
+
readonly durationMs: number;
|
|
10
|
+
}
|
|
11
|
+
export interface Timeline {
|
|
12
|
+
readonly rows: readonly TimelineRow[];
|
|
13
|
+
/** Window span: latest end minus earliest start, in ms. */
|
|
14
|
+
readonly totalMs: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Flattens a trace-span tree into an ordered list of waterfall rows, each
|
|
18
|
+
* positioned relative to the request's overall time window. Pure — the panel
|
|
19
|
+
* feeds it {@link TraceSpan} roots from the collector and renders the result.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildTimeline(roots: readonly TraceSpan[]): Timeline;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=timeline-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline-model.d.ts","sourceRoot":"","sources":["../../src/debug-bar/timeline-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,oDAAoD;AACpD,UAAU,WAAW;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,CAAC;IACtC,2DAA2D;IAC3D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,GAAG,QAAQ,CAwBnE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flattens a trace-span tree into an ordered list of waterfall rows, each
|
|
3
|
+
* positioned relative to the request's overall time window. Pure — the panel
|
|
4
|
+
* feeds it {@link TraceSpan} roots from the collector and renders the result.
|
|
5
|
+
*/
|
|
6
|
+
export function buildTimeline(roots) {
|
|
7
|
+
let windowStart = Infinity;
|
|
8
|
+
let windowEnd = -Infinity;
|
|
9
|
+
const visit = (span) => {
|
|
10
|
+
windowStart = Math.min(windowStart, span.startedAt);
|
|
11
|
+
windowEnd = Math.max(windowEnd, span.startedAt + span.durationMs);
|
|
12
|
+
for (const child of span.children)
|
|
13
|
+
visit(child);
|
|
14
|
+
};
|
|
15
|
+
for (const root of roots)
|
|
16
|
+
visit(root);
|
|
17
|
+
if (roots.length === 0)
|
|
18
|
+
return { rows: [], totalMs: 0 };
|
|
19
|
+
const rows = [];
|
|
20
|
+
const flatten = (span, depth) => {
|
|
21
|
+
rows.push({
|
|
22
|
+
name: span.name,
|
|
23
|
+
depth,
|
|
24
|
+
offsetMs: span.startedAt - windowStart,
|
|
25
|
+
durationMs: span.durationMs,
|
|
26
|
+
});
|
|
27
|
+
for (const child of span.children)
|
|
28
|
+
flatten(child, depth + 1);
|
|
29
|
+
};
|
|
30
|
+
for (const root of roots)
|
|
31
|
+
flatten(root, 0);
|
|
32
|
+
return { rows, totalMs: windowEnd - windowStart };
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=timeline-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline-model.js","sourceRoot":"","sources":["../../src/debug-bar/timeline-model.ts"],"names":[],"mappings":"AAkBA;;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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Client } from "@libsql/client";
|
|
2
|
+
/**
|
|
3
|
+
* Wraps a libsql client so every `execute` runs inside a timed `ctx.debug.span`
|
|
4
|
+
* — the Timeline panel's source of per-query durations, which drizzle's logger
|
|
5
|
+
* contract can't provide. Dev-only (call it behind the `PLUMIX_DEV` gate); a
|
|
6
|
+
* no-op outside a request, and tree-shaken from prod along with its callers.
|
|
7
|
+
*
|
|
8
|
+
* Lives apart from the driver-agnostic query logger so the libsql type import
|
|
9
|
+
* stays out of adapters that don't use libsql (e.g. the D1 runtime).
|
|
10
|
+
*
|
|
11
|
+
* Assumes drizzle's single-argument call convention (`execute(stmt)`,
|
|
12
|
+
* `batch(stmts)`); it forwards only that first argument, so a direct
|
|
13
|
+
* `execute(sql, args)` call would drop its params. Queries inside a drizzle
|
|
14
|
+
* transaction run through `tx.execute` and aren't timed — acceptable for a dev
|
|
15
|
+
* panel.
|
|
16
|
+
*/
|
|
17
|
+
export declare function traceSqlClient(client: Client): Client;
|
|
18
|
+
//# sourceMappingURL=trace-libsql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace-libsql.d.ts","sourceRoot":"","sources":["../../src/debug-bar/trace-libsql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,gBAAgB,CAAC;AAK1D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CA0BrD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { tryGetContext } from "../context/stores.js";
|
|
2
|
+
import { queryKind } from "./highlight-sql.js";
|
|
3
|
+
/**
|
|
4
|
+
* Wraps a libsql client so every `execute` runs inside a timed `ctx.debug.span`
|
|
5
|
+
* — the Timeline panel's source of per-query durations, which drizzle's logger
|
|
6
|
+
* contract can't provide. Dev-only (call it behind the `PLUMIX_DEV` gate); a
|
|
7
|
+
* no-op outside a request, and tree-shaken from prod along with its callers.
|
|
8
|
+
*
|
|
9
|
+
* Lives apart from the driver-agnostic query logger so the libsql type import
|
|
10
|
+
* stays out of adapters that don't use libsql (e.g. the D1 runtime).
|
|
11
|
+
*
|
|
12
|
+
* Assumes drizzle's single-argument call convention (`execute(stmt)`,
|
|
13
|
+
* `batch(stmts)`); it forwards only that first argument, so a direct
|
|
14
|
+
* `execute(sql, args)` call would drop its params. Queries inside a drizzle
|
|
15
|
+
* transaction run through `tx.execute` and aren't timed — acceptable for a dev
|
|
16
|
+
* panel.
|
|
17
|
+
*/
|
|
18
|
+
export function traceSqlClient(client) {
|
|
19
|
+
const stmtSql = (stmt) => typeof stmt === "string" ? stmt : stmt.sql;
|
|
20
|
+
const rawExecute = client.execute.bind(client);
|
|
21
|
+
client.execute = (stmt) => {
|
|
22
|
+
const ctx = tryGetContext();
|
|
23
|
+
const run = () => rawExecute(stmt);
|
|
24
|
+
if (!ctx)
|
|
25
|
+
return run();
|
|
26
|
+
return ctx.debug.span(`db: ${queryKind(stmtSql(stmt))}`, run);
|
|
27
|
+
};
|
|
28
|
+
// Relational reads and transactions run as one batched round-trip; time the
|
|
29
|
+
// whole batch as a single span (labelled by kind when uniform).
|
|
30
|
+
const rawBatch = client.batch.bind(client);
|
|
31
|
+
client.batch = (stmts, ...rest) => {
|
|
32
|
+
const ctx = tryGetContext();
|
|
33
|
+
const run = () => rawBatch(stmts, ...rest);
|
|
34
|
+
if (!ctx || !Array.isArray(stmts))
|
|
35
|
+
return run();
|
|
36
|
+
const kinds = new Set(stmts.map((stmt) => queryKind(stmtSql(stmt))));
|
|
37
|
+
const label = kinds.size === 1 ? `db: ${[...kinds][0]}` : "db: batch";
|
|
38
|
+
return ctx.debug.span(`${label} (${stmts.length})`, run);
|
|
39
|
+
};
|
|
40
|
+
return client;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=trace-libsql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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C;YAAE,OAAO,GAAG,EAAE,CAAC;QAChD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACrE,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC;QACtE,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,KAAK,KAAK,CAAC,MAAM,GAAG,EAAE,GAAG,CAAC,CAAC;IAC3D,CAAC,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -12,6 +12,12 @@ export interface DebugPanel {
|
|
|
12
12
|
readonly title: Label;
|
|
13
13
|
/** Ascending; unset sorts after ordered panels (see DEFAULT_PANEL_ORDER). */
|
|
14
14
|
readonly order?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Rendered in isolation (its own SSR pass) so a throw can't crash the host
|
|
17
|
+
* page. Read request data off `ctx` (and `ctx.debug.get(id)` for your own
|
|
18
|
+
* recorded entries) — outer React context providers are NOT visible across
|
|
19
|
+
* the isolated render, so don't rely on `useContext` from the page tree.
|
|
20
|
+
*/
|
|
15
21
|
readonly render: (ctx: AppContext) => ReactNode;
|
|
16
22
|
}
|
|
17
23
|
declare module "../hooks/types.js" {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/debug-bar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,SAAS,CAAC;CACjD;AAED,OAAO,QAAQ,mBAAmB,CAAC;IACjC,UAAU,cAAc;QACtB,kBAAkB,EAAE,CAClB,MAAM,EAAE,SAAS,UAAU,EAAE,EAC7B,GAAG,EAAE,UAAU,KACZ,SAAS,UAAU,EAAE,CAAC;KAC5B;CACF"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/debug-bar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,SAAS,CAAC;CACjD;AAED,OAAO,QAAQ,mBAAmB,CAAC;IACjC,UAAU,cAAc;QACtB,kBAAkB,EAAE,CAClB,MAAM,EAAE,SAAS,UAAU,EAAE,EAC7B,GAAG,EAAE,UAAU,KACZ,SAAS,UAAU,EAAE,CAAC;KAC5B;CACF"}
|
package/dist/hooks/registry.d.ts
CHANGED
|
@@ -10,11 +10,21 @@ export interface HookExecutor {
|
|
|
10
10
|
* surfaces immediately instead of leaking a rejected value downstream.
|
|
11
11
|
*/
|
|
12
12
|
applyFilterSync<TName extends FilterName>(name: TName, input: FilterInput<TName>, ...rest: FilterRest<TName>): FilterInput<TName>;
|
|
13
|
+
/**
|
|
14
|
+
* Synchronous array-accumulating filter pipeline with per-handler error
|
|
15
|
+
* isolation: a handler that throws or returns a non-array is logged and
|
|
16
|
+
* skipped, and the chain continues from the last good value. Used by the
|
|
17
|
+
* collector surfaces (admin bar, debug bar) that gather contributions and
|
|
18
|
+
* must not let one misbehaving plugin take down the whole bar. Only valid
|
|
19
|
+
* for array-valued filters — the runtime treats a non-array return as the
|
|
20
|
+
* skip signal, so a scalar filter's every return would be discarded.
|
|
21
|
+
*/
|
|
22
|
+
applyFilterIsolated<TName extends FilterName>(name: TName, seed: FilterInput<TName>, ...rest: FilterRest<TName>): FilterInput<TName>;
|
|
13
23
|
/**
|
|
14
24
|
* Sorted snapshot of a filter's registered handlers — for surfaces that
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* `
|
|
25
|
+
* run the handlers themselves rather than as an accumulating pipeline.
|
|
26
|
+
* `admin-search` is the consumer: it fans the handlers out in parallel
|
|
27
|
+
* (`Promise.all`) instead of threading one result into the next.
|
|
18
28
|
*/
|
|
19
29
|
getFilterHandlers<TName extends FilterName>(name: TName): readonly {
|
|
20
30
|
readonly fn: FilterFn<TName>;
|
|
@@ -41,6 +51,7 @@ export declare class HookRegistry implements HookExecutor {
|
|
|
41
51
|
}): void;
|
|
42
52
|
applyFilter<TName extends FilterName>(name: TName, input: FilterInput<TName>, ...rest: FilterRest<TName>): Promise<FilterInput<TName>>;
|
|
43
53
|
applyFilterSync<TName extends FilterName>(name: TName, input: FilterInput<TName>, ...rest: FilterRest<TName>): FilterInput<TName>;
|
|
54
|
+
applyFilterIsolated<TName extends FilterName>(name: TName, seed: FilterInput<TName>, ...rest: FilterRest<TName>): FilterInput<TName>;
|
|
44
55
|
getFilterHandlers<TName extends FilterName>(name: TName): readonly {
|
|
45
56
|
readonly fn: FilterFn<TName>;
|
|
46
57
|
readonly plugin: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/hooks/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,WAAW,EACX,UAAU,EACV,UAAU,EACV,WAAW,EACZ,MAAM,YAAY,CAAC;AAmBpB,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,KAAK,SAAS,UAAU,EAClC,IAAI,EAAE,KAAK,EACX,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,EACzB,GAAG,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,GACzB,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/B;;;;;;;OAOG;IACH,eAAe,CAAC,KAAK,SAAS,UAAU,EACtC,IAAI,EAAE,KAAK,EACX,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,EACzB,GAAG,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,GACzB,WAAW,CAAC,KAAK,CAAC,CAAC;IACtB;;;;;OAKG;IACH,iBAAiB,CAAC,KAAK,SAAS,UAAU,EACxC,IAAI,EAAE,KAAK,GACV,SAAS;QACV,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;KAChC,EAAE,CAAC;IACJ,QAAQ,CAAC,KAAK,SAAS,UAAU,EAC/B,IAAI,EAAE,KAAK,EACX,GAAG,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,GACzB,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB;AAED,KAAK,eAAe,GAAG,CAAC,IAAI,EAAE;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB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