@tanstack/pacer-devtools 1.3.1 → 1.5.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,385 +0,0 @@
1
- import * as goober from 'goober'
2
- import { createEffect, createSignal } from 'solid-js'
3
- import { useTheme } from '@tanstack/devtools-ui'
4
- import { tokens } from './tokens'
5
-
6
- const stylesFactory = (theme: 'light' | 'dark') => {
7
- const { colors, font, size, alpha, border } = tokens
8
- const { fontFamily, size: fontSize } = font
9
- const css = goober.css
10
- const t = (light: string, dark: string) => (theme === 'light' ? light : dark)
11
-
12
- return {
13
- /**
14
- * Fills the devtools-utils portal div (height: 100%) and is a flex parent so MainPanel
15
- * gets a real flex height budget (not just height: 100% without a flex chain).
16
- */
17
- shellRoot: css`
18
- display: flex;
19
- flex-direction: column;
20
- box-sizing: border-box;
21
- width: 100%;
22
- height: 100%;
23
- min-height: 0;
24
- overflow: hidden;
25
- `,
26
- /** Overrides devtools-ui MainPanel overflow-y: auto so inner columns own scrolling */
27
- mainPanelShell: css`
28
- display: flex;
29
- flex-direction: column;
30
- flex: 1 1 0%;
31
- min-height: 0;
32
- overflow: hidden !important;
33
- `,
34
- mainContainer: css`
35
- display: flex;
36
- flex: 1 1 0%;
37
- min-height: 0;
38
- overflow: hidden;
39
- padding: ${size[2]};
40
- padding-top: 0;
41
- margin-top: ${size[2]};
42
- `,
43
- dragHandle: css`
44
- width: 8px;
45
- background: ${t(colors.gray[300], colors.darkGray[600])};
46
- cursor: col-resize;
47
- position: relative;
48
- transition: all 0.2s ease;
49
- user-select: none;
50
- pointer-events: all;
51
- margin: 0 ${size[1]};
52
- border-radius: 2px;
53
-
54
- &:hover {
55
- background: ${t(colors.blue[600], colors.blue[500])};
56
- margin: 0 ${size[1]};
57
- }
58
-
59
- &.dragging {
60
- background: ${t(colors.blue[700], colors.blue[600])};
61
- margin: 0 ${size[1]};
62
- }
63
-
64
- &::after {
65
- content: '';
66
- position: absolute;
67
- top: 50%;
68
- left: 50%;
69
- transform: translate(-50%, -50%);
70
- width: 2px;
71
- height: 20px;
72
- background: ${t(colors.gray[400], colors.darkGray[400])};
73
- border-radius: 1px;
74
- pointer-events: none;
75
- }
76
-
77
- &:hover::after,
78
- &.dragging::after {
79
- background: ${t(colors.blue[500], colors.blue[300])};
80
- }
81
- `,
82
- leftPanel: css`
83
- background: ${t(colors.gray[100], colors.darkGray[800])};
84
- border-radius: ${border.radius.lg};
85
- border: 1px solid ${t(colors.gray[200], colors.darkGray[700])};
86
- display: flex;
87
- flex-direction: column;
88
- overflow: hidden;
89
- min-height: 0;
90
- flex-shrink: 0;
91
- `,
92
- rightPanel: css`
93
- background: ${t(colors.gray[100], colors.darkGray[800])};
94
- border-radius: ${border.radius.lg};
95
- border: 1px solid ${t(colors.gray[200], colors.darkGray[700])};
96
- display: flex;
97
- flex-direction: column;
98
- overflow: hidden;
99
- min-height: 0;
100
- flex: 1;
101
- `,
102
- panelHeader: css`
103
- font-size: ${fontSize.md};
104
- font-weight: ${font.weight.bold};
105
- color: ${t(colors.blue[700], colors.blue[400])};
106
- padding: ${size[2]};
107
- border-bottom: 1px solid ${t(colors.gray[200], colors.darkGray[700])};
108
- background: ${t(colors.gray[100], colors.darkGray[800])};
109
- flex-shrink: 0;
110
- `,
111
- utilList: css`
112
- flex: 1;
113
- overflow-y: auto;
114
- padding: ${size[1]};
115
- min-height: 0;
116
- `,
117
- utilGroup: css`
118
- margin-bottom: ${size[2]};
119
- `,
120
- utilGroupHeader: css`
121
- font-size: ${fontSize.xs};
122
- font-weight: ${font.weight.semibold};
123
- color: ${t(colors.gray[600], colors.gray[400])};
124
- text-transform: uppercase;
125
- letter-spacing: 0.05em;
126
- margin-bottom: ${size[1]};
127
- padding: ${size[1]} ${size[2]};
128
- background: ${t(colors.gray[200], colors.darkGray[700])};
129
- border-radius: ${border.radius.md};
130
- `,
131
- utilRow: css`
132
- display: flex;
133
- justify-content: space-between;
134
- align-items: center;
135
- padding: ${size[2]};
136
- margin-bottom: ${size[1]};
137
- background: ${t(colors.gray[200], colors.darkGray[700])};
138
- border-radius: ${border.radius.md};
139
- cursor: pointer;
140
- transition: all 0.2s ease;
141
- border: 1px solid transparent;
142
-
143
- &:hover {
144
- background: ${t(colors.gray[300], colors.darkGray[600])};
145
- border-color: ${t(colors.gray[400], colors.darkGray[500])};
146
- }
147
- `,
148
- utilRowSelected: css`
149
- background: ${t(colors.blue[100], colors.blue[900] + alpha[20])};
150
- border-color: ${t(colors.blue[600], colors.blue[500])};
151
- box-shadow: 0 0 0 1px
152
- ${t(colors.blue[600] + alpha[30], colors.blue[500] + alpha[30])};
153
- `,
154
- utilKey: css`
155
- font-family: ${fontFamily.mono};
156
- font-size: ${fontSize.xs};
157
- color: ${t(colors.gray[900], colors.gray[100])};
158
- flex: 1;
159
- overflow: hidden;
160
- text-overflow: ellipsis;
161
- white-space: nowrap;
162
- `,
163
- utilStatus: css`
164
- font-size: ${fontSize.xs};
165
- color: ${t(colors.gray[600], colors.gray[400])};
166
- text-transform: uppercase;
167
- letter-spacing: 0.05em;
168
- padding: ${size[1]} ${size[1]};
169
- background: ${t(colors.gray[300], colors.darkGray[600])};
170
- border-radius: ${border.radius.sm};
171
- margin-left: ${size[1]};
172
- `,
173
- stateDetails: css`
174
- flex: 1;
175
- overflow-y: auto;
176
- padding: ${size[2]};
177
- min-height: 0;
178
- `,
179
- stateHeader: css`
180
- margin-bottom: ${size[2]};
181
- padding-bottom: ${size[2]};
182
- border-bottom: 1px solid ${t(colors.gray[200], colors.darkGray[700])};
183
- `,
184
- stateTitle: css`
185
- font-size: ${fontSize.md};
186
- font-weight: ${font.weight.bold};
187
- color: ${t(colors.blue[700], colors.blue[400])};
188
- margin-bottom: ${size[1]};
189
- `,
190
- stateKey: css`
191
- font-family: ${fontFamily.mono};
192
- font-size: ${fontSize.xs};
193
- color: ${t(colors.gray[600], colors.gray[400])};
194
- word-break: break-all;
195
- `,
196
- stateContent: css`
197
- background: ${t(colors.gray[100], colors.darkGray[700])};
198
- border-radius: ${border.radius.md};
199
- padding: ${size[2]};
200
- border: 1px solid ${t(colors.gray[300], colors.darkGray[600])};
201
- `,
202
- detailsGrid: css`
203
- display: grid;
204
- grid-template-columns: 1fr;
205
- gap: ${size[2]};
206
- align-items: start;
207
- `,
208
- detailSection: css`
209
- background: ${t(colors.white, colors.darkGray[700])};
210
- border: 1px solid ${t(colors.gray[300], colors.darkGray[600])};
211
- border-radius: ${border.radius.md};
212
- padding: ${size[2]};
213
- `,
214
- detailSectionHeader: css`
215
- font-size: ${fontSize.sm};
216
- font-weight: ${font.weight.bold};
217
- color: ${t(colors.gray[800], colors.gray[200])};
218
- margin-bottom: ${size[1]};
219
- text-transform: uppercase;
220
- letter-spacing: 0.04em;
221
- `,
222
- actionsRow: css`
223
- display: flex;
224
- flex-wrap: wrap;
225
- gap: ${size[2]};
226
- `,
227
- actionButton: css`
228
- display: inline-flex;
229
- align-items: center;
230
- gap: ${size[1]};
231
- padding: ${size[1]} ${size[2]};
232
- border-radius: ${border.radius.md};
233
- border: 1px solid ${t(colors.gray[300], colors.darkGray[500])};
234
- background: ${t(colors.gray[200], colors.darkGray[600])};
235
- color: ${t(colors.gray[900], colors.gray[100])};
236
- font-size: ${fontSize.xs};
237
- cursor: pointer;
238
- user-select: none;
239
- transition:
240
- background 0.15s,
241
- border-color 0.15s;
242
- &:hover {
243
- background: ${t(colors.gray[300], colors.darkGray[500])};
244
- border-color: ${t(colors.gray[400], colors.darkGray[400])};
245
- }
246
- &:disabled {
247
- opacity: 0.5;
248
- cursor: not-allowed;
249
- &:hover {
250
- background: ${t(colors.gray[200], colors.darkGray[600])};
251
- border-color: ${t(colors.gray[300], colors.darkGray[500])};
252
- }
253
- }
254
- `,
255
- actionDotBlue: css`
256
- width: 6px;
257
- height: 6px;
258
- border-radius: 9999px;
259
- background: ${colors.blue[400]};
260
- `,
261
- actionDotGreen: css`
262
- width: 6px;
263
- height: 6px;
264
- border-radius: 9999px;
265
- background: ${colors.green[400]};
266
- `,
267
- actionDotRed: css`
268
- width: 6px;
269
- height: 6px;
270
- border-radius: 9999px;
271
- background: ${colors.red[400]};
272
- `,
273
- actionDotYellow: css`
274
- width: 6px;
275
- height: 6px;
276
- border-radius: 9999px;
277
- background: ${colors.yellow[400]};
278
- `,
279
- actionDotOrange: css`
280
- width: 6px;
281
- height: 6px;
282
- border-radius: 9999px;
283
- background: ${colors.pink[400]};
284
- `,
285
- actionDotPurple: css`
286
- width: 6px;
287
- height: 6px;
288
- border-radius: 9999px;
289
- background: ${colors.purple[400]};
290
- `,
291
- infoGrid: css`
292
- display: grid;
293
- grid-template-columns: auto 1fr;
294
- gap: ${size[1]};
295
- row-gap: ${size[1]};
296
- align-items: center;
297
- `,
298
- infoLabel: css`
299
- color: ${t(colors.gray[600], colors.gray[400])};
300
- font-size: ${fontSize.xs};
301
- text-transform: uppercase;
302
- letter-spacing: 0.05em;
303
- `,
304
- infoValueMono: css`
305
- font-family: ${fontFamily.mono};
306
- font-size: ${fontSize.xs};
307
- color: ${t(colors.gray[900], colors.gray[100])};
308
- word-break: break-all;
309
- `,
310
- noSelection: css`
311
- flex: 1;
312
- display: flex;
313
- align-items: center;
314
- justify-content: center;
315
- color: ${t(colors.gray[500], colors.gray[500])};
316
- font-style: italic;
317
- text-align: center;
318
- padding: ${size[4]};
319
- `,
320
- // Keep existing styles for backward compatibility
321
- sectionContainer: css`
322
- display: flex;
323
- flex-wrap: wrap;
324
- gap: ${size[4]};
325
- `,
326
- section: css`
327
- background: ${t(colors.gray[100], colors.darkGray[800])};
328
- border-radius: ${border.radius.lg};
329
- box-shadow: ${tokens.shadow.md(
330
- t(colors.gray[400] + alpha[80], colors.black + alpha[80]),
331
- )};
332
- padding: ${size[4]};
333
- margin-bottom: ${size[4]};
334
- border: 1px solid ${t(colors.gray[200], colors.darkGray[700])};
335
- min-width: 0;
336
- max-width: 33%;
337
- max-height: fit-content;
338
- `,
339
- sectionHeader: css`
340
- font-size: ${fontSize.lg};
341
- font-weight: ${font.weight.bold};
342
- margin-bottom: ${size[2]};
343
- color: ${t(colors.blue[600], colors.blue[400])};
344
- letter-spacing: 0.01em;
345
- display: flex;
346
- align-items: center;
347
- gap: ${size[2]};
348
- `,
349
- sectionEmpty: css`
350
- color: ${t(colors.gray[500], colors.gray[500])};
351
- font-size: ${fontSize.sm};
352
- font-style: italic;
353
- margin: ${size[2]} 0;
354
- `,
355
- instanceList: css`
356
- display: flex;
357
- flex-direction: column;
358
- gap: ${size[2]};
359
- background: ${t(colors.gray[200], colors.darkGray[700])};
360
- border: 1px solid ${t(colors.gray[300], colors.darkGray[600])};
361
- `,
362
- instanceCard: css`
363
- background: ${t(colors.gray[200], colors.darkGray[700])};
364
- border-radius: ${border.radius.md};
365
- padding: ${size[3]};
366
- border: 1px solid ${t(colors.gray[300], colors.darkGray[600])};
367
- font-size: ${fontSize.sm};
368
- color: ${t(colors.gray[900], colors.gray[100])};
369
- font-family: ${fontFamily.mono};
370
- overflow-x: auto;
371
- transition:
372
- box-shadow 0.3s,
373
- background 0.3s;
374
- `,
375
- }
376
- }
377
-
378
- export function useStyles() {
379
- const { theme } = useTheme()
380
- const [styles, setStyles] = createSignal(stylesFactory(theme()))
381
- createEffect(() => {
382
- setStyles(stylesFactory(theme()))
383
- })
384
- return styles
385
- }
@@ -1,33 +0,0 @@
1
- /** TanStack Store (`@tanstack/store`) used by pacer utils. */
2
- export function isPacerUtilTanStackStore(x: unknown): x is {
3
- subscribe: (cb: (s: unknown) => void) => { unsubscribe: () => void }
4
- get: () => unknown
5
- } {
6
- return (
7
- typeof x === 'object' &&
8
- x !== null &&
9
- 'subscribe' in x &&
10
- typeof (x as { subscribe: unknown }).subscribe === 'function' &&
11
- 'get' in x &&
12
- typeof (x as { get: unknown }).get === 'function'
13
- )
14
- }
15
-
16
- /**
17
- * Core pacer utils expose TanStack `Store` (`get()` / `state`). React hooks may
18
- * also expose a reactive `state` field. Use this for devtools UI that needs a
19
- * plain snapshot (e.g. JsonTree).
20
- */
21
- export function getPacerUtilStoreState(instance: {
22
- store?: { get?: () => unknown; state?: unknown }
23
- state?: unknown
24
- }): unknown {
25
- const store = instance.store
26
- if (store && typeof store.get === 'function') {
27
- return store.get()
28
- }
29
- if (store && store.state !== undefined) {
30
- return store.state
31
- }
32
- return instance.state
33
- }