@tanstack/query-devtools 5.0.0-alpha.53 → 5.0.0-alpha.54
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/build/{lib/index.cjs → cjs/Devtools-5f8e85ff.js} +1687 -2980
- package/build/cjs/Devtools-5f8e85ff.js.map +1 -0
- package/build/cjs/index-db699afb.js +1395 -0
- package/build/cjs/index-db699afb.js.map +1 -0
- package/build/cjs/index.js +8 -0
- package/build/cjs/index.js.map +1 -0
- package/build/{lib/index.js → esm/Devtools-8dd32079.js} +1407 -2706
- package/build/esm/Devtools-8dd32079.js.map +1 -0
- package/build/esm/index-34324cec.js +1365 -0
- package/build/esm/index-34324cec.js.map +1 -0
- package/build/esm/index.js +2 -0
- package/build/esm/index.js.map +1 -0
- package/build/source/Context.js +10 -0
- package/build/source/Devtools.jsx +1508 -0
- package/build/source/Explorer.jsx +264 -0
- package/build/source/fonts.js +7 -0
- package/build/source/icons/index.jsx +344 -0
- package/build/source/index.jsx +88 -0
- package/build/source/theme.js +304 -0
- package/build/source/utils.jsx +77 -0
- package/build/{lib → types}/Context.d.ts +0 -1
- package/build/{lib → types}/Devtools.d.ts +1 -2
- package/build/{lib → types}/Explorer.d.ts +0 -1
- package/build/{lib → types}/fonts.d.ts +0 -1
- package/build/{lib → types}/icons/index.d.ts +0 -1
- package/build/{lib → types}/index.d.ts +2 -1
- package/build/{lib → types}/theme.d.ts +0 -1
- package/build/{lib → types}/utils.d.ts +5 -4
- package/package.json +17 -10
- package/src/Devtools.tsx +40 -0
- package/src/Explorer.tsx +16 -18
- package/src/index.tsx +14 -3
- package/src/utils.tsx +12 -2
- package/build/lib/Context.d.ts.map +0 -1
- package/build/lib/Devtools.d.ts.map +0 -1
- package/build/lib/Explorer.d.ts.map +0 -1
- package/build/lib/__tests__/devtools.test.d.ts +0 -1
- package/build/lib/__tests__/devtools.test.d.ts.map +0 -1
- package/build/lib/fonts.d.ts.map +0 -1
- package/build/lib/icons/index.d.ts.map +0 -1
- package/build/lib/index.cjs.map +0 -1
- package/build/lib/index.d.ts.map +0 -1
- package/build/lib/index.js.map +0 -1
- package/build/lib/theme.d.ts.map +0 -1
- package/build/lib/utils.d.ts.map +0 -1
- package/build/stats-html.html +0 -6177
- package/build/stats.json +0 -1699
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { render } from 'solid-js/web';
|
|
2
|
+
import { createSignal, lazy } from 'solid-js';
|
|
3
|
+
class TanstackQueryDevtools {
|
|
4
|
+
client;
|
|
5
|
+
onlineManager;
|
|
6
|
+
queryFlavor;
|
|
7
|
+
version;
|
|
8
|
+
isMounted = false;
|
|
9
|
+
buttonPosition;
|
|
10
|
+
position;
|
|
11
|
+
initialIsOpen;
|
|
12
|
+
errorTypes;
|
|
13
|
+
Component;
|
|
14
|
+
dispose;
|
|
15
|
+
constructor(config) {
|
|
16
|
+
const { client, queryFlavor, version, onlineManager, buttonPosition, position, initialIsOpen, errorTypes, } = config;
|
|
17
|
+
this.client = createSignal(client);
|
|
18
|
+
this.queryFlavor = queryFlavor;
|
|
19
|
+
this.version = version;
|
|
20
|
+
this.onlineManager = onlineManager;
|
|
21
|
+
this.buttonPosition = createSignal(buttonPosition);
|
|
22
|
+
this.position = createSignal(position);
|
|
23
|
+
this.initialIsOpen = createSignal(initialIsOpen);
|
|
24
|
+
this.errorTypes = createSignal(errorTypes);
|
|
25
|
+
}
|
|
26
|
+
setButtonPosition(position) {
|
|
27
|
+
this.buttonPosition[1](position);
|
|
28
|
+
}
|
|
29
|
+
setPosition(position) {
|
|
30
|
+
this.position[1](position);
|
|
31
|
+
}
|
|
32
|
+
setInitialIsOpen(isOpen) {
|
|
33
|
+
this.initialIsOpen[1](isOpen);
|
|
34
|
+
}
|
|
35
|
+
setErrorTypes(errorTypes) {
|
|
36
|
+
this.errorTypes[1](errorTypes);
|
|
37
|
+
}
|
|
38
|
+
setClient(client) {
|
|
39
|
+
this.client[1](client);
|
|
40
|
+
}
|
|
41
|
+
mount(el) {
|
|
42
|
+
if (this.isMounted) {
|
|
43
|
+
throw new Error('Devtools is already mounted');
|
|
44
|
+
}
|
|
45
|
+
const dispose = render(() => {
|
|
46
|
+
const [btnPosition] = this.buttonPosition;
|
|
47
|
+
const [pos] = this.position;
|
|
48
|
+
const [isOpen] = this.initialIsOpen;
|
|
49
|
+
const [errors] = this.errorTypes;
|
|
50
|
+
const [queryClient] = this.client;
|
|
51
|
+
let Devtools;
|
|
52
|
+
if (this.Component) {
|
|
53
|
+
Devtools = this.Component;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
Devtools = lazy(() => import('./Devtools'));
|
|
57
|
+
this.Component = Devtools;
|
|
58
|
+
}
|
|
59
|
+
return (<Devtools queryFlavor={this.queryFlavor} version={this.version} onlineManager={this.onlineManager} {...{
|
|
60
|
+
get client() {
|
|
61
|
+
return queryClient();
|
|
62
|
+
},
|
|
63
|
+
get buttonPosition() {
|
|
64
|
+
return btnPosition();
|
|
65
|
+
},
|
|
66
|
+
get position() {
|
|
67
|
+
return pos();
|
|
68
|
+
},
|
|
69
|
+
get initialIsOpen() {
|
|
70
|
+
return isOpen();
|
|
71
|
+
},
|
|
72
|
+
get errorTypes() {
|
|
73
|
+
return errors();
|
|
74
|
+
},
|
|
75
|
+
}}/>);
|
|
76
|
+
}, el);
|
|
77
|
+
this.isMounted = true;
|
|
78
|
+
this.dispose = dispose;
|
|
79
|
+
}
|
|
80
|
+
unmount() {
|
|
81
|
+
if (!this.isMounted) {
|
|
82
|
+
throw new Error('Devtools is not mounted');
|
|
83
|
+
}
|
|
84
|
+
this.dispose?.();
|
|
85
|
+
this.isMounted = false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export { TanstackQueryDevtools };
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
const ShadowVariants = {
|
|
2
|
+
xs: '0 1px 2px 0 rgb(0 0 0 / 0.05)',
|
|
3
|
+
sm: '0 1px 3px 0 color, 0 1px 2px -1px color',
|
|
4
|
+
md: '0 4px 6px -1px color, 0 2px 4px -2px color',
|
|
5
|
+
lg: '0 10px 15px -3px color, 0 4px 6px -4px color',
|
|
6
|
+
xl: '0 20px 25px -5px color, 0 8px 10px -6px color',
|
|
7
|
+
'2xl': '0 25px 50px -12px color',
|
|
8
|
+
inner: 'inset 0 2px 4px 0 color',
|
|
9
|
+
none: 'none',
|
|
10
|
+
};
|
|
11
|
+
const getShadow = (variant, color = '') => {
|
|
12
|
+
return ShadowVariants[variant].replace(/color/g, color);
|
|
13
|
+
};
|
|
14
|
+
const Shadow = {
|
|
15
|
+
xs: (color = 'rgb(0 0 0 / 0.1)') => getShadow('xs', color),
|
|
16
|
+
sm: (color = 'rgb(0 0 0 / 0.1)') => getShadow('sm', color),
|
|
17
|
+
md: (color = 'rgb(0 0 0 / 0.1)') => getShadow('md', color),
|
|
18
|
+
lg: (color = 'rgb(0 0 0 / 0.1)') => getShadow('lg', color),
|
|
19
|
+
xl: (color = 'rgb(0 0 0 / 0.1)') => getShadow('xl', color),
|
|
20
|
+
'2xl': (color = 'rgb(0 0 0 / 0.25)') => getShadow('2xl', color),
|
|
21
|
+
inner: (color = 'rgb(0 0 0 / 0.05)') => getShadow('inner', color),
|
|
22
|
+
none: () => getShadow('none'),
|
|
23
|
+
};
|
|
24
|
+
export const tokens = {
|
|
25
|
+
colors: {
|
|
26
|
+
inherit: 'inherit',
|
|
27
|
+
current: 'currentColor',
|
|
28
|
+
transparent: 'transparent',
|
|
29
|
+
black: '#000000',
|
|
30
|
+
white: '#ffffff',
|
|
31
|
+
neutral: {
|
|
32
|
+
50: '#f9fafb',
|
|
33
|
+
100: '#f2f4f7',
|
|
34
|
+
200: '#eaecf0',
|
|
35
|
+
300: '#d0d5dd',
|
|
36
|
+
400: '#98a2b3',
|
|
37
|
+
500: '#667085',
|
|
38
|
+
600: '#475467',
|
|
39
|
+
700: '#344054',
|
|
40
|
+
800: '#1d2939',
|
|
41
|
+
900: '#101828',
|
|
42
|
+
},
|
|
43
|
+
darkGray: {
|
|
44
|
+
50: '#525c7a',
|
|
45
|
+
100: '#49536e',
|
|
46
|
+
200: '#414962',
|
|
47
|
+
300: '#394056',
|
|
48
|
+
400: '#313749',
|
|
49
|
+
500: '#292e3d',
|
|
50
|
+
600: '#212530',
|
|
51
|
+
700: '#191c24',
|
|
52
|
+
800: '#111318',
|
|
53
|
+
900: '#0b0d10',
|
|
54
|
+
},
|
|
55
|
+
gray: {
|
|
56
|
+
50: '#f9fafb',
|
|
57
|
+
100: '#f2f4f7',
|
|
58
|
+
200: '#eaecf0',
|
|
59
|
+
300: '#d0d5dd',
|
|
60
|
+
400: '#98a2b3',
|
|
61
|
+
500: '#667085',
|
|
62
|
+
600: '#475467',
|
|
63
|
+
700: '#344054',
|
|
64
|
+
800: '#1d2939',
|
|
65
|
+
900: '#101828',
|
|
66
|
+
},
|
|
67
|
+
blue: {
|
|
68
|
+
25: '#F5FAFF',
|
|
69
|
+
50: '#EFF8FF',
|
|
70
|
+
100: '#D1E9FF',
|
|
71
|
+
200: '#B2DDFF',
|
|
72
|
+
300: '#84CAFF',
|
|
73
|
+
400: '#53B1FD',
|
|
74
|
+
500: '#2E90FA',
|
|
75
|
+
600: '#1570EF',
|
|
76
|
+
700: '#175CD3',
|
|
77
|
+
800: '#1849A9',
|
|
78
|
+
900: '#194185',
|
|
79
|
+
},
|
|
80
|
+
green: {
|
|
81
|
+
25: '#F6FEF9',
|
|
82
|
+
50: '#ECFDF3',
|
|
83
|
+
100: '#D1FADF',
|
|
84
|
+
200: '#A6F4C5',
|
|
85
|
+
300: '#6CE9A6',
|
|
86
|
+
400: '#32D583',
|
|
87
|
+
500: '#12B76A',
|
|
88
|
+
600: '#039855',
|
|
89
|
+
700: '#027A48',
|
|
90
|
+
800: '#05603A',
|
|
91
|
+
900: '#054F31',
|
|
92
|
+
},
|
|
93
|
+
red: {
|
|
94
|
+
25: '#FFFBFA',
|
|
95
|
+
50: '#FEF3F2',
|
|
96
|
+
100: '#FEE4E2',
|
|
97
|
+
200: '#FECDCA',
|
|
98
|
+
300: '#FDA29B',
|
|
99
|
+
400: '#F97066',
|
|
100
|
+
500: '#F04438',
|
|
101
|
+
600: '#D92D20',
|
|
102
|
+
700: '#B42318',
|
|
103
|
+
800: '#912018',
|
|
104
|
+
900: '#7A271A',
|
|
105
|
+
},
|
|
106
|
+
yellow: {
|
|
107
|
+
25: '#FFFCF5',
|
|
108
|
+
50: '#FFFAEB',
|
|
109
|
+
100: '#FEF0C7',
|
|
110
|
+
200: '#FEDF89',
|
|
111
|
+
300: '#FEC84B',
|
|
112
|
+
400: '#FDB022',
|
|
113
|
+
500: '#F79009',
|
|
114
|
+
600: '#DC6803',
|
|
115
|
+
700: '#B54708',
|
|
116
|
+
800: '#93370D',
|
|
117
|
+
900: '#7A2E0E',
|
|
118
|
+
},
|
|
119
|
+
purple: {
|
|
120
|
+
25: '#FAFAFF',
|
|
121
|
+
50: '#F4F3FF',
|
|
122
|
+
100: '#EBE9FE',
|
|
123
|
+
200: '#D9D6FE',
|
|
124
|
+
300: '#BDB4FE',
|
|
125
|
+
400: '#9B8AFB',
|
|
126
|
+
500: '#7A5AF8',
|
|
127
|
+
600: '#6938EF',
|
|
128
|
+
700: '#5925DC',
|
|
129
|
+
800: '#4A1FB8',
|
|
130
|
+
900: '#3E1C96',
|
|
131
|
+
},
|
|
132
|
+
teal: {
|
|
133
|
+
25: '#F6FEFC',
|
|
134
|
+
50: '#F0FDF9',
|
|
135
|
+
100: '#CCFBEF',
|
|
136
|
+
200: '#99F6E0',
|
|
137
|
+
300: '#5FE9D0',
|
|
138
|
+
400: '#2ED3B7',
|
|
139
|
+
500: '#15B79E',
|
|
140
|
+
600: '#0E9384',
|
|
141
|
+
700: '#107569',
|
|
142
|
+
800: '#125D56',
|
|
143
|
+
900: '#134E48',
|
|
144
|
+
},
|
|
145
|
+
pink: {
|
|
146
|
+
25: '#fdf2f8',
|
|
147
|
+
50: '#fce7f3',
|
|
148
|
+
100: '#fbcfe8',
|
|
149
|
+
200: '#f9a8d4',
|
|
150
|
+
300: '#f472b6',
|
|
151
|
+
400: '#ec4899',
|
|
152
|
+
500: '#db2777',
|
|
153
|
+
600: '#be185d',
|
|
154
|
+
700: '#9d174d',
|
|
155
|
+
800: '#831843',
|
|
156
|
+
900: '#500724',
|
|
157
|
+
},
|
|
158
|
+
cyan: {
|
|
159
|
+
25: '#ecfeff',
|
|
160
|
+
50: '#cffafe',
|
|
161
|
+
100: '#a5f3fc',
|
|
162
|
+
200: '#67e8f9',
|
|
163
|
+
300: '#22d3ee',
|
|
164
|
+
400: '#06b6d4',
|
|
165
|
+
500: '#0891b2',
|
|
166
|
+
600: '#0e7490',
|
|
167
|
+
700: '#155e75',
|
|
168
|
+
800: '#164e63',
|
|
169
|
+
900: '#083344',
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
alpha: {
|
|
173
|
+
100: 'ff',
|
|
174
|
+
90: 'e5',
|
|
175
|
+
80: 'cc',
|
|
176
|
+
70: 'b3',
|
|
177
|
+
60: '99',
|
|
178
|
+
50: '80',
|
|
179
|
+
40: '66',
|
|
180
|
+
30: '4d',
|
|
181
|
+
20: '33',
|
|
182
|
+
10: '1a',
|
|
183
|
+
0: '00',
|
|
184
|
+
},
|
|
185
|
+
font: {
|
|
186
|
+
size: {
|
|
187
|
+
'2xs': '0.625rem',
|
|
188
|
+
xs: '0.75rem',
|
|
189
|
+
sm: '0.875rem',
|
|
190
|
+
md: '1rem',
|
|
191
|
+
lg: '1.125rem',
|
|
192
|
+
xl: '1.25rem',
|
|
193
|
+
'2xl': '1.5rem',
|
|
194
|
+
'3xl': '1.875rem',
|
|
195
|
+
'4xl': '2.25rem',
|
|
196
|
+
'5xl': '3rem',
|
|
197
|
+
'6xl': '3.75rem',
|
|
198
|
+
'7xl': '4.5rem',
|
|
199
|
+
'8xl': '6rem',
|
|
200
|
+
'9xl': '8rem',
|
|
201
|
+
},
|
|
202
|
+
lineHeight: {
|
|
203
|
+
xs: '1rem',
|
|
204
|
+
sm: '1.25rem',
|
|
205
|
+
md: '1.5rem',
|
|
206
|
+
lg: '1.75rem',
|
|
207
|
+
xl: '1.75rem',
|
|
208
|
+
'2xl': '2rem',
|
|
209
|
+
'3xl': '2.25rem',
|
|
210
|
+
'4xl': '2.5rem',
|
|
211
|
+
'5xl': '1',
|
|
212
|
+
'6xl': '1',
|
|
213
|
+
'7xl': '1',
|
|
214
|
+
'8xl': '1',
|
|
215
|
+
'9xl': '1',
|
|
216
|
+
},
|
|
217
|
+
weight: {
|
|
218
|
+
thin: '100',
|
|
219
|
+
extralight: '200',
|
|
220
|
+
light: '300',
|
|
221
|
+
normal: '400',
|
|
222
|
+
medium: '500',
|
|
223
|
+
semibold: '600',
|
|
224
|
+
bold: '700',
|
|
225
|
+
extrabold: '800',
|
|
226
|
+
black: '900',
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
breakpoints: {
|
|
230
|
+
xs: '320px',
|
|
231
|
+
sm: '640px',
|
|
232
|
+
md: '768px',
|
|
233
|
+
lg: '1024px',
|
|
234
|
+
xl: '1280px',
|
|
235
|
+
'2xl': '1536px',
|
|
236
|
+
},
|
|
237
|
+
border: {
|
|
238
|
+
radius: {
|
|
239
|
+
none: '0px',
|
|
240
|
+
xs: '0.125rem',
|
|
241
|
+
sm: '0.25rem',
|
|
242
|
+
md: '0.375rem',
|
|
243
|
+
lg: '0.5rem',
|
|
244
|
+
xl: '0.75rem',
|
|
245
|
+
'2xl': '1rem',
|
|
246
|
+
'3xl': '1.5rem',
|
|
247
|
+
full: '9999px',
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
size: {
|
|
251
|
+
0: '0px',
|
|
252
|
+
0.25: '0.0625rem',
|
|
253
|
+
0.5: '0.125rem',
|
|
254
|
+
1: '0.25rem',
|
|
255
|
+
1.5: '0.375rem',
|
|
256
|
+
2: '0.5rem',
|
|
257
|
+
2.5: '0.625rem',
|
|
258
|
+
3: '0.75rem',
|
|
259
|
+
3.5: '0.875rem',
|
|
260
|
+
4: '1rem',
|
|
261
|
+
4.5: '1.125rem',
|
|
262
|
+
5: '1.25rem',
|
|
263
|
+
6: '1.5rem',
|
|
264
|
+
7: '1.75rem',
|
|
265
|
+
8: '2rem',
|
|
266
|
+
9: '2.25rem',
|
|
267
|
+
10: '2.5rem',
|
|
268
|
+
11: '2.75rem',
|
|
269
|
+
12: '3rem',
|
|
270
|
+
14: '3.5rem',
|
|
271
|
+
16: '4rem',
|
|
272
|
+
20: '5rem',
|
|
273
|
+
24: '6rem',
|
|
274
|
+
28: '7rem',
|
|
275
|
+
32: '8rem',
|
|
276
|
+
36: '9rem',
|
|
277
|
+
40: '10rem',
|
|
278
|
+
44: '11rem',
|
|
279
|
+
48: '12rem',
|
|
280
|
+
52: '13rem',
|
|
281
|
+
56: '14rem',
|
|
282
|
+
60: '15rem',
|
|
283
|
+
64: '16rem',
|
|
284
|
+
72: '18rem',
|
|
285
|
+
80: '20rem',
|
|
286
|
+
96: '24rem',
|
|
287
|
+
},
|
|
288
|
+
shadow: Shadow,
|
|
289
|
+
zIndices: {
|
|
290
|
+
hide: -1,
|
|
291
|
+
auto: 'auto',
|
|
292
|
+
base: 0,
|
|
293
|
+
docked: 10,
|
|
294
|
+
dropdown: 1000,
|
|
295
|
+
sticky: 1100,
|
|
296
|
+
banner: 1200,
|
|
297
|
+
overlay: 1300,
|
|
298
|
+
modal: 1400,
|
|
299
|
+
popover: 1500,
|
|
300
|
+
skipLink: 1600,
|
|
301
|
+
toast: 1700,
|
|
302
|
+
tooltip: 1800,
|
|
303
|
+
},
|
|
304
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { serialize } from 'superjson';
|
|
2
|
+
export function getQueryStatusLabel(query) {
|
|
3
|
+
return query.state.fetchStatus === 'fetching'
|
|
4
|
+
? 'fetching'
|
|
5
|
+
: !query.getObserversCount()
|
|
6
|
+
? 'inactive'
|
|
7
|
+
: query.state.fetchStatus === 'paused'
|
|
8
|
+
? 'paused'
|
|
9
|
+
: query.isStale()
|
|
10
|
+
? 'stale'
|
|
11
|
+
: 'fresh';
|
|
12
|
+
}
|
|
13
|
+
export const queryStatusLabels = [
|
|
14
|
+
'fresh',
|
|
15
|
+
'stale',
|
|
16
|
+
'paused',
|
|
17
|
+
'inactive',
|
|
18
|
+
'fetching',
|
|
19
|
+
];
|
|
20
|
+
export function getSidedProp(prop, side) {
|
|
21
|
+
return `${prop}${side.charAt(0).toUpperCase() + side.slice(1)}`;
|
|
22
|
+
}
|
|
23
|
+
export function getQueryStatusColor({ queryState, observerCount, isStale, }) {
|
|
24
|
+
return queryState.fetchStatus === 'fetching'
|
|
25
|
+
? 'blue'
|
|
26
|
+
: !observerCount
|
|
27
|
+
? 'gray'
|
|
28
|
+
: queryState.fetchStatus === 'paused'
|
|
29
|
+
? 'purple'
|
|
30
|
+
: isStale
|
|
31
|
+
? 'yellow'
|
|
32
|
+
: 'green';
|
|
33
|
+
}
|
|
34
|
+
export function getQueryStatusColorByLabel(label) {
|
|
35
|
+
return label === 'fresh'
|
|
36
|
+
? 'green'
|
|
37
|
+
: label === 'stale'
|
|
38
|
+
? 'yellow'
|
|
39
|
+
: label === 'paused'
|
|
40
|
+
? 'purple'
|
|
41
|
+
: label === 'inactive'
|
|
42
|
+
? 'gray'
|
|
43
|
+
: 'blue';
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Displays a string regardless the type of the data
|
|
47
|
+
* @param {unknown} value Value to be stringified
|
|
48
|
+
* @param {boolean} beautify Formats json to multiline
|
|
49
|
+
*/
|
|
50
|
+
export const displayValue = (value, beautify = false) => {
|
|
51
|
+
const { json } = serialize(value);
|
|
52
|
+
return JSON.stringify(json, null, beautify ? 2 : undefined);
|
|
53
|
+
};
|
|
54
|
+
const getStatusRank = (q) => q.state.fetchStatus !== 'idle'
|
|
55
|
+
? 0
|
|
56
|
+
: !q.getObserversCount()
|
|
57
|
+
? 3
|
|
58
|
+
: q.isStale()
|
|
59
|
+
? 2
|
|
60
|
+
: 1;
|
|
61
|
+
const queryHashSort = (a, b) => a.queryHash.localeCompare(b.queryHash);
|
|
62
|
+
const dateSort = (a, b) => a.state.dataUpdatedAt < b.state.dataUpdatedAt ? 1 : -1;
|
|
63
|
+
const statusAndDateSort = (a, b) => {
|
|
64
|
+
if (getStatusRank(a) === getStatusRank(b)) {
|
|
65
|
+
return dateSort(a, b);
|
|
66
|
+
}
|
|
67
|
+
return getStatusRank(a) > getStatusRank(b) ? 1 : -1;
|
|
68
|
+
};
|
|
69
|
+
export const sortFns = {
|
|
70
|
+
status: statusAndDateSort,
|
|
71
|
+
'query hash': queryHashSort,
|
|
72
|
+
'last updated': dateSort,
|
|
73
|
+
};
|
|
74
|
+
export const convertRemToPixels = (rem) => {
|
|
75
|
+
return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
76
|
+
};
|
|
77
|
+
export const convertPixelsToRem = (px) => px / convertRemToPixels(1);
|
|
@@ -12,6 +12,7 @@ interface QueryStatusProps {
|
|
|
12
12
|
count: number;
|
|
13
13
|
}
|
|
14
14
|
export declare const DevtoolsComponent: Component<QueryDevtoolsProps>;
|
|
15
|
+
export default DevtoolsComponent;
|
|
15
16
|
export declare const Devtools: () => JSX.Element;
|
|
16
17
|
export declare const DevtoolsPanel: Component<DevtoolsPanelProps>;
|
|
17
18
|
export declare const QueryRow: Component<{
|
|
@@ -19,5 +20,3 @@ export declare const QueryRow: Component<{
|
|
|
19
20
|
}>;
|
|
20
21
|
export declare const QueryStatusCount: Component;
|
|
21
22
|
export declare const QueryStatus: Component<QueryStatusProps>;
|
|
22
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=Devtools.d.ts.map
|
|
@@ -9,4 +9,3 @@ export declare function Copier(): import("solid-js").JSX.Element;
|
|
|
9
9
|
export declare function CopiedCopier(): import("solid-js").JSX.Element;
|
|
10
10
|
export declare function ErrorCopier(): import("solid-js").JSX.Element;
|
|
11
11
|
export declare function TanstackLogo(): import("solid-js").JSX.Element;
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { QueryClient, onlineManager as TonlineManager } from '@tanstack/query-core';
|
|
2
|
+
import type { DevtoolsComponent } from './Devtools';
|
|
2
3
|
import type { DevtoolsButtonPosition, DevtoolsPosition, QueryDevtoolsProps, DevToolsErrorType } from './Context';
|
|
3
4
|
import type { Signal } from 'solid-js';
|
|
4
5
|
export type { DevtoolsButtonPosition, DevtoolsPosition, DevToolsErrorType };
|
|
@@ -14,6 +15,7 @@ declare class TanstackQueryDevtools {
|
|
|
14
15
|
position: Signal<DevtoolsPosition | undefined>;
|
|
15
16
|
initialIsOpen: Signal<boolean | undefined>;
|
|
16
17
|
errorTypes: Signal<DevToolsErrorType[] | undefined>;
|
|
18
|
+
Component: typeof DevtoolsComponent | undefined;
|
|
17
19
|
dispose?: () => void;
|
|
18
20
|
constructor(config: TanstackQueryDevtoolsConfig);
|
|
19
21
|
setButtonPosition(position: DevtoolsButtonPosition): void;
|
|
@@ -25,4 +27,3 @@ declare class TanstackQueryDevtools {
|
|
|
25
27
|
unmount(): void;
|
|
26
28
|
}
|
|
27
29
|
export { TanstackQueryDevtools };
|
|
28
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -294,4 +294,3 @@ export type ThemeColorsAll = {
|
|
|
294
294
|
}[keyof ThemeConfigType['colors']];
|
|
295
295
|
export type AtomicThemeColors = 'white' | 'black' | 'transparent' | 'current' | 'inherit';
|
|
296
296
|
export type ThemeColors = Exclude<ThemeColorsAll, AtomicThemeColors>;
|
|
297
|
-
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { Query } from '@tanstack/query-core';
|
|
2
|
-
|
|
2
|
+
import type { DevtoolsPosition } from './Context';
|
|
3
|
+
export declare function getQueryStatusLabel(query: Query): "inactive" | "paused" | "fetching" | "stale" | "fresh";
|
|
3
4
|
export declare const queryStatusLabels: readonly ["fresh", "stale", "paused", "inactive", "fetching"];
|
|
4
5
|
export type IQueryStatusLabel = (typeof queryStatusLabels)[number];
|
|
6
|
+
export declare function getSidedProp<T extends string>(prop: T, side: DevtoolsPosition): `${T}Left` | `${T}Right` | `${T}Top` | `${T}Bottom`;
|
|
5
7
|
export declare function getQueryStatusColor({ queryState, observerCount, isStale, }: {
|
|
6
8
|
queryState: Query['state'];
|
|
7
9
|
observerCount: number;
|
|
8
10
|
isStale: boolean;
|
|
9
|
-
}): "blue" | "gray" | "
|
|
10
|
-
export declare function getQueryStatusColorByLabel(label: IQueryStatusLabel): "blue" | "gray" | "
|
|
11
|
+
}): "blue" | "gray" | "green" | "purple" | "yellow";
|
|
12
|
+
export declare function getQueryStatusColorByLabel(label: IQueryStatusLabel): "blue" | "gray" | "green" | "purple" | "yellow";
|
|
11
13
|
/**
|
|
12
14
|
* Displays a string regardless the type of the data
|
|
13
15
|
* @param {unknown} value Value to be stringified
|
|
@@ -19,4 +21,3 @@ export declare const sortFns: Record<string, SortFn>;
|
|
|
19
21
|
export declare const convertRemToPixels: (rem: number) => number;
|
|
20
22
|
export declare const convertPixelsToRem: (px: number) => number;
|
|
21
23
|
export {};
|
|
22
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/query-devtools",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.54",
|
|
4
4
|
"description": "Developer tools to interact with and visualize the TanStack Query cache",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,16 +11,20 @@
|
|
|
11
11
|
"url": "https://github.com/sponsors/tannerlinsley"
|
|
12
12
|
},
|
|
13
13
|
"type": "module",
|
|
14
|
-
"types": "build/
|
|
15
|
-
"main": "build/
|
|
16
|
-
"module": "build/
|
|
14
|
+
"types": "build/types/index.d.ts",
|
|
15
|
+
"main": "build/cjs/index.js",
|
|
16
|
+
"module": "build/esm/index.js",
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
|
-
"types": "./build/
|
|
20
|
-
"solid": "./build/
|
|
21
|
-
"import": "./build/
|
|
22
|
-
"
|
|
23
|
-
|
|
19
|
+
"types": "./build/types/index.d.ts",
|
|
20
|
+
"solid": "./build/source/index.jsx",
|
|
21
|
+
"import": "./build/esm/index.js",
|
|
22
|
+
"browser": {
|
|
23
|
+
"import": "./build/esm/index.js",
|
|
24
|
+
"require": "./build/cjs/index.js"
|
|
25
|
+
},
|
|
26
|
+
"require": "./build/cjs/index.js",
|
|
27
|
+
"node": "./build/cjs/index.js"
|
|
24
28
|
},
|
|
25
29
|
"./package.json": "./package.json"
|
|
26
30
|
},
|
|
@@ -40,6 +44,7 @@
|
|
|
40
44
|
},
|
|
41
45
|
"devDependencies": {
|
|
42
46
|
"@tanstack/query-core": "^5.0.0-alpha.43",
|
|
47
|
+
"rollup-preset-solid": "^2.0.1",
|
|
43
48
|
"vite-plugin-solid": "^2.5.0"
|
|
44
49
|
},
|
|
45
50
|
"scripts": {
|
|
@@ -48,7 +53,9 @@
|
|
|
48
53
|
"test:types": "tsc --noEmit",
|
|
49
54
|
"test:lib": "vitest run --coverage",
|
|
50
55
|
"test:lib:dev": "pnpm run test:lib --watch",
|
|
51
|
-
"build": "
|
|
56
|
+
"test:build": "publint",
|
|
57
|
+
"build": "pnpm build:rollup && pnpm rename-build-dir",
|
|
58
|
+
"rename-build-dir": "rimraf ./build && mv ./dist ./build",
|
|
52
59
|
"build:rollup": "rollup --config rollup.config.js",
|
|
53
60
|
"build:types": "tsc --emitDeclarationOnly"
|
|
54
61
|
}
|
package/src/Devtools.tsx
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
getQueryStatusColorByLabel,
|
|
21
21
|
sortFns,
|
|
22
22
|
convertRemToPixels,
|
|
23
|
+
getSidedProp,
|
|
23
24
|
} from './utils'
|
|
24
25
|
import {
|
|
25
26
|
ArrowDown,
|
|
@@ -82,6 +83,8 @@ export const DevtoolsComponent: Component<QueryDevtoolsProps> = (props) => {
|
|
|
82
83
|
)
|
|
83
84
|
}
|
|
84
85
|
|
|
86
|
+
export default DevtoolsComponent
|
|
87
|
+
|
|
85
88
|
export const Devtools = () => {
|
|
86
89
|
loadFonts()
|
|
87
90
|
|
|
@@ -315,6 +318,42 @@ export const DevtoolsPanel: Component<DevtoolsPanelProps> = (props) => {
|
|
|
315
318
|
setSettingsOpen(false)
|
|
316
319
|
}
|
|
317
320
|
|
|
321
|
+
createEffect(() => {
|
|
322
|
+
const rootContainer = panelRef.parentElement?.parentElement?.parentElement
|
|
323
|
+
if (!rootContainer) return
|
|
324
|
+
const styleProp = getSidedProp(
|
|
325
|
+
'padding',
|
|
326
|
+
props.localStore.position as DevtoolsPosition,
|
|
327
|
+
)
|
|
328
|
+
const isVertical =
|
|
329
|
+
props.localStore.position === 'left' ||
|
|
330
|
+
props.localStore.position === 'right'
|
|
331
|
+
const previousPaddings = (({
|
|
332
|
+
padding,
|
|
333
|
+
paddingTop,
|
|
334
|
+
paddingBottom,
|
|
335
|
+
paddingLeft,
|
|
336
|
+
paddingRight,
|
|
337
|
+
}) => ({
|
|
338
|
+
padding,
|
|
339
|
+
paddingTop,
|
|
340
|
+
paddingBottom,
|
|
341
|
+
paddingLeft,
|
|
342
|
+
paddingRight,
|
|
343
|
+
}))(rootContainer.style)
|
|
344
|
+
|
|
345
|
+
rootContainer.style[styleProp] = `${
|
|
346
|
+
isVertical ? props.localStore.width : props.localStore.height
|
|
347
|
+
}px`
|
|
348
|
+
|
|
349
|
+
onCleanup(() => {
|
|
350
|
+
Object.entries(previousPaddings).forEach(([property, previousValue]) => {
|
|
351
|
+
rootContainer.style[property as keyof typeof previousPaddings] =
|
|
352
|
+
previousValue
|
|
353
|
+
})
|
|
354
|
+
})
|
|
355
|
+
})
|
|
356
|
+
|
|
318
357
|
return (
|
|
319
358
|
<aside
|
|
320
359
|
// Some context for styles here
|
|
@@ -1200,6 +1239,7 @@ const getStyles = () => {
|
|
|
1200
1239
|
font-family: 'Inter', sans-serif;
|
|
1201
1240
|
color: ${colors.gray[300]};
|
|
1202
1241
|
box-sizing: border-box;
|
|
1242
|
+
text-transform: none;
|
|
1203
1243
|
}
|
|
1204
1244
|
`,
|
|
1205
1245
|
'devtoolsBtn-position-bottom-right': css`
|