@tanstack/query-devtools 5.0.0-alpha.52 → 5.0.0-alpha.53

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,71 +0,0 @@
1
- import { DevtoolsComponent } from './Devtools';
2
- import { render } from 'solid-js/web';
3
- import { createSignal } from 'solid-js';
4
- class TanstackQueryDevtools {
5
- constructor(config) {
6
- this.isMounted = false;
7
- const { client, queryFlavor, version, onlineManager, buttonPosition, position, initialIsOpen, errorTypes, } = config;
8
- this.client = createSignal(client);
9
- this.queryFlavor = queryFlavor;
10
- this.version = version;
11
- this.onlineManager = onlineManager;
12
- this.buttonPosition = createSignal(buttonPosition);
13
- this.position = createSignal(position);
14
- this.initialIsOpen = createSignal(initialIsOpen);
15
- this.errorTypes = createSignal(errorTypes);
16
- }
17
- setButtonPosition(position) {
18
- this.buttonPosition[1](position);
19
- }
20
- setPosition(position) {
21
- this.position[1](position);
22
- }
23
- setInitialIsOpen(isOpen) {
24
- this.initialIsOpen[1](isOpen);
25
- }
26
- setErrorTypes(errorTypes) {
27
- this.errorTypes[1](errorTypes);
28
- }
29
- setClient(client) {
30
- this.client[1](client);
31
- }
32
- mount(el) {
33
- if (this.isMounted) {
34
- throw new Error('Devtools is already mounted');
35
- }
36
- const dispose = render(() => {
37
- const [btnPosition] = this.buttonPosition;
38
- const [pos] = this.position;
39
- const [isOpen] = this.initialIsOpen;
40
- const [errors] = this.errorTypes;
41
- const [queryClient] = this.client;
42
- return (<DevtoolsComponent queryFlavor={this.queryFlavor} version={this.version} onlineManager={this.onlineManager} {...{
43
- get client() {
44
- return queryClient();
45
- },
46
- get buttonPosition() {
47
- return btnPosition();
48
- },
49
- get position() {
50
- return pos();
51
- },
52
- get initialIsOpen() {
53
- return isOpen();
54
- },
55
- get errorTypes() {
56
- return errors();
57
- },
58
- }}/>);
59
- }, el);
60
- this.isMounted = true;
61
- this.dispose = dispose;
62
- }
63
- unmount() {
64
- if (!this.isMounted) {
65
- throw new Error('Devtools is not mounted');
66
- }
67
- this.dispose?.();
68
- this.isMounted = false;
69
- }
70
- }
71
- export { TanstackQueryDevtools };
@@ -1,304 +0,0 @@
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
- };
@@ -1,74 +0,0 @@
1
- import * as superjson 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 getQueryStatusColor({ queryState, observerCount, isStale, }) {
21
- return queryState.fetchStatus === 'fetching'
22
- ? 'blue'
23
- : !observerCount
24
- ? 'gray'
25
- : queryState.fetchStatus === 'paused'
26
- ? 'purple'
27
- : isStale
28
- ? 'yellow'
29
- : 'green';
30
- }
31
- export function getQueryStatusColorByLabel(label) {
32
- return label === 'fresh'
33
- ? 'green'
34
- : label === 'stale'
35
- ? 'yellow'
36
- : label === 'paused'
37
- ? 'purple'
38
- : label === 'inactive'
39
- ? 'gray'
40
- : 'blue';
41
- }
42
- /**
43
- * Displays a string regardless the type of the data
44
- * @param {unknown} value Value to be stringified
45
- * @param {boolean} beautify Formats json to multiline
46
- */
47
- export const displayValue = (value, beautify = false) => {
48
- const { json } = superjson.serialize(value);
49
- return JSON.stringify(json, null, beautify ? 2 : undefined);
50
- };
51
- const getStatusRank = (q) => q.state.fetchStatus !== 'idle'
52
- ? 0
53
- : !q.getObserversCount()
54
- ? 3
55
- : q.isStale()
56
- ? 2
57
- : 1;
58
- const queryHashSort = (a, b) => a.queryHash.localeCompare(b.queryHash);
59
- const dateSort = (a, b) => a.state.dataUpdatedAt < b.state.dataUpdatedAt ? 1 : -1;
60
- const statusAndDateSort = (a, b) => {
61
- if (getStatusRank(a) === getStatusRank(b)) {
62
- return dateSort(a, b);
63
- }
64
- return getStatusRank(a) > getStatusRank(b) ? 1 : -1;
65
- };
66
- export const sortFns = {
67
- status: statusAndDateSort,
68
- 'query hash': queryHashSort,
69
- 'last updated': dateSort,
70
- };
71
- export const convertRemToPixels = (rem) => {
72
- return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
73
- };
74
- export const convertPixelsToRem = (px) => px / convertRemToPixels(1);
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes