app-devtools 0.1.0 → 0.3.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.
Files changed (83) hide show
  1. package/dist/main.d.ts +62 -0
  2. package/dist/main.js +2396 -0
  3. package/dist/main.umd.cjs +753 -0
  4. package/package.json +21 -16
  5. package/.eslintignore +0 -3
  6. package/.eslintrc.cjs +0 -112
  7. package/.gitattributes +0 -22
  8. package/.prettierrc +0 -10
  9. package/.quokka.ts +0 -115
  10. package/.vscode/settings.json +0 -7
  11. package/.vscode/snippets.code-snippets +0 -75
  12. package/.vscode/tasks.json +0 -17
  13. package/index.html +0 -46
  14. package/pnpm-lock.yaml +0 -5313
  15. package/scripts/check-if-is-sync.sh +0 -6
  16. package/scripts/filterFetchRequests.ts +0 -60
  17. package/src/Root.tsx +0 -11
  18. package/src/assets/icons/caret-down.svg +0 -11
  19. package/src/assets/icons/network.svg +0 -6
  20. package/src/assets/icons/search.svg +0 -3
  21. package/src/assets/icons/send.svg +0 -3
  22. package/src/assets/icons/settings.svg +0 -3
  23. package/src/components/ButtonElement.tsx +0 -18
  24. package/src/components/Icon.tsx +0 -44
  25. package/src/components/Section.tsx +0 -57
  26. package/src/components/Select.tsx +0 -101
  27. package/src/components/ValueVisualizer.tsx +0 -397
  28. package/src/config/icons.tsx +0 -23
  29. package/src/initializeApp.tsx +0 -28
  30. package/src/initializeDevTools.ts +0 -33
  31. package/src/main.ts +0 -42
  32. package/src/mocks/mockedRequests.json +0 -28391
  33. package/src/pages/api-explorer/ApiExplorerMenu.tsx +0 -136
  34. package/src/pages/api-explorer/ApiExplorerMenuItem.tsx +0 -208
  35. package/src/pages/api-explorer/Diff.tsx +0 -223
  36. package/src/pages/api-explorer/RequestDetails.tsx +0 -264
  37. package/src/pages/api-explorer/Timeline.tsx +0 -174
  38. package/src/pages/api-explorer/api-explorer.tsx +0 -21
  39. package/src/pages/api-explorer/getRequestPayload.tsx +0 -15
  40. package/src/pages/app/App.tsx +0 -79
  41. package/src/stores/callsStore.ts +0 -267
  42. package/src/stores/uiStore.ts +0 -15
  43. package/src/style/globalStyle.ts +0 -54
  44. package/src/style/helpers/allowTextSelection.ts +0 -7
  45. package/src/style/helpers/anchorColor.ts +0 -9
  46. package/src/style/helpers/centerContent.ts +0 -5
  47. package/src/style/helpers/circle.ts +0 -7
  48. package/src/style/helpers/ellipsis.ts +0 -8
  49. package/src/style/helpers/fillContainer.ts +0 -7
  50. package/src/style/helpers/gradientBorder.ts +0 -28
  51. package/src/style/helpers/gradientText.ts +0 -8
  52. package/src/style/helpers/inline.ts +0 -34
  53. package/src/style/helpers/mountAnim.ts +0 -26
  54. package/src/style/helpers/multilineEllipsis.ts +0 -8
  55. package/src/style/helpers/outline.ts +0 -5
  56. package/src/style/helpers/responsiveSize.ts +0 -27
  57. package/src/style/helpers/stack.ts +0 -36
  58. package/src/style/helpers/transition.ts +0 -63
  59. package/src/style/mediaQueries.ts +0 -6
  60. package/src/style/reset.ts +0 -75
  61. package/src/style/scrollBar.ts +0 -37
  62. package/src/style/theme.ts +0 -35
  63. package/src/types/global.d.ts +0 -8
  64. package/src/utils/initializeScreenLogger.ts +0 -12
  65. package/tsconfig.json +0 -36
  66. package/tsconfig.prod.json +0 -10
  67. package/tsup.config.ts +0 -7
  68. package/utils/arrayUtils.ts +0 -29
  69. package/utils/assertions.ts +0 -7
  70. package/utils/autoIncrementId.ts +0 -5
  71. package/utils/createThemev2.ts +0 -64
  72. package/utils/cx.ts +0 -27
  73. package/utils/getDiff.ts +0 -15
  74. package/utils/hexToRgb.ts +0 -14
  75. package/utils/objectUtils.ts +0 -3
  76. package/utils/parseUnit.ts +0 -10
  77. package/utils/solid.ts +0 -76
  78. package/utils/truncateText.ts +0 -7
  79. package/utils/tryExpression.ts +0 -14
  80. package/utils/typed.ts +0 -23
  81. package/utils/typings.ts +0 -40
  82. package/utils/urlPattern.ts +0 -25
  83. package/vite.config.ts +0 -46
@@ -1,397 +0,0 @@
1
- import ButtonElement from '@src/components/ButtonElement'
2
- import Icon from '@src/components/Icon'
3
- import { allowTextSelection } from '@src/style/helpers/allowTextSelection'
4
- import { ellipsis } from '@src/style/helpers/ellipsis'
5
- import { inline } from '@src/style/helpers/inline'
6
- import { multilineEllipsis } from '@src/style/helpers/multilineEllipsis'
7
- import { stack } from '@src/style/helpers/stack'
8
- import { colors, fonts } from '@src/style/theme'
9
- import { JSXElement } from 'solid-js'
10
- import { css } from 'solid-styled-components'
11
-
12
- const containerStyle = css`
13
- &&& {
14
- font-family: ${fonts.decorative};
15
- font-size: 13px;
16
- ${allowTextSelection};
17
- ${stack({ gap: 2 })};
18
- padding-left: 8px;
19
-
20
- .expand-button {
21
- margin-left: -16px;
22
- width: 16px;
23
- display: inline-block;
24
- vertical-align: middle;
25
- color: ${colors.white.alpha(0.5)};
26
-
27
- &:not(.expanded) .icon {
28
- transform: rotate(-90deg);
29
- }
30
- }
31
-
32
- .show-all {
33
- color: ${colors.white.alpha(0.5)};
34
- text-align: left;
35
- }
36
-
37
- .childs {
38
- ${stack({ gap: 2 })};
39
- }
40
-
41
- .delimiter {
42
- color: ${colors.white.alpha(0.5)};
43
- margin-top: 1px;
44
- margin-bottom: 1px;
45
-
46
- &.end {
47
- &::after {
48
- content: ',';
49
- }
50
- }
51
- }
52
-
53
- .childs {
54
- padding-left: 20px;
55
- grid-column: 1 / span 3;
56
- border-left: 1px solid ${colors.white.alpha(0.05)};
57
-
58
- > .value {
59
- &::after {
60
- content: ',';
61
- opacity: 0.5;
62
- color: ${colors.white.var};
63
- }
64
- }
65
- }
66
-
67
- .child {
68
- display: grid;
69
- grid-template-columns: auto auto 1fr;
70
-
71
- .key {
72
- color: #a5d6ff;
73
- margin-right: 5px;
74
- ${inline({ align: 'top' })};
75
-
76
- span {
77
- flex-shrink: 1;
78
- ${ellipsis};
79
- }
80
-
81
- &.index {
82
- color: ${colors.success.alpha(0.7)};
83
- }
84
-
85
- &::after {
86
- content: ':';
87
- color: ${colors.secondary.alpha(0.5)};
88
- }
89
- }
90
- }
91
-
92
- .string-quotes {
93
- opacity: 0.7;
94
- }
95
-
96
- .value {
97
- word-wrap: break-word;
98
- ${multilineEllipsis(5)};
99
- }
100
-
101
- [data-type='number'] {
102
- color: ${colors.primary.var};
103
- }
104
-
105
- [data-type='boolean'] {
106
- color: ${colors.warning.var};
107
- }
108
-
109
- [data-type='object'],
110
- [data-type='undefined'] {
111
- color: ${colors.white.alpha(0.6)};
112
- }
113
-
114
- .collapsed {
115
- color: ${colors.white.alpha(0.5)};
116
- }
117
- }
118
- `
119
-
120
- const numberFormatter = new Intl.NumberFormat('en-US')
121
-
122
- const compactMaxChilds = 14
123
-
124
- type ValueVisualizerProps = {
125
- value: unknown
126
- compact?: boolean
127
- }
128
-
129
- const ValueItem = (props: {
130
- value: unknown
131
- indent: number
132
- key?: string
133
- index?: number
134
- compact: boolean
135
- }) => {
136
- let expanded = $signal(props.indent > 0 && props.compact ? false : true)
137
- let showAllChilds = $signal(!props.compact)
138
-
139
- return (
140
- <>
141
- {(() => {
142
- const value = props.value
143
- const valueIsArray = Array.isArray(value)
144
- const valueIsObject =
145
- !valueIsArray && typeof value === 'object' && value !== null
146
-
147
- const hasKey = props.key !== undefined || props.index !== undefined
148
-
149
- const showExpandButton =
150
- (valueIsArray && value.length > 0) ||
151
- (valueIsObject && Object.keys(value).length > 0)
152
-
153
- const toggleExpanded = showExpandButton && (
154
- <ButtonElement
155
- onClick={() => {
156
- expanded = !expanded
157
- }}
158
- classList={{
159
- expanded,
160
- }}
161
- class="expand-button"
162
- >
163
- <Icon
164
- name="caret-down"
165
- size={14}
166
- />
167
- </ButtonElement>
168
- )
169
-
170
- return (
171
- <>
172
- {hasKey && (
173
- <div
174
- class="key"
175
- title={`${
176
- props.key ? `${props.key}\n` : ''
177
- }Shift + Click to copy value`}
178
- classList={{
179
- index: props.index !== undefined,
180
- }}
181
- onClick={(e) => {
182
- if (e.shiftKey) {
183
- copyToClipboard(JSON.stringify(value))
184
- }
185
- }}
186
- >
187
- {valueIsArray || valueIsObject ? toggleExpanded : null}
188
- <span>{props.key || props.index}</span>
189
- </div>
190
- )}
191
-
192
- {hasKey && showExpandButton && !expanded ? (
193
- <div class="collapsed">
194
- {valueIsArray
195
- ? `[…] ${value.length} items`
196
- : `{…} ${Object.keys(value).length} properties`}
197
- </div>
198
- ) : (
199
- ((): JSXElement => {
200
- if (valueIsArray && value.length === 0) {
201
- return <div class="delimiter">[]</div>
202
- }
203
-
204
- if (valueIsObject && Object.keys(value).length === 0) {
205
- return <div class="delimiter">{`{}`}</div>
206
- }
207
-
208
- if (valueIsArray) {
209
- return (
210
- <>
211
- <div
212
- class="delimiter"
213
- title={
214
- !hasKey ? 'Shift + Click to copy value' : undefined
215
- }
216
- onClick={
217
- !hasKey
218
- ? (e) => {
219
- if (e.shiftKey) {
220
- copyToClipboard(JSON.stringify(value))
221
- }
222
- }
223
- : undefined
224
- }
225
- >
226
- {!hasKey && toggleExpanded}
227
-
228
- {expanded ? '[' : `[…] ${value.length} items`}
229
- </div>
230
-
231
- {expanded && (
232
- <>
233
- <div class="childs">
234
- {(() => {
235
- let items = value
236
- const totalSize = items.length
237
-
238
- if (!showAllChilds) {
239
- items = items.slice(0, compactMaxChilds)
240
- }
241
-
242
- return (
243
- <>
244
- {items.map((item, index) => (
245
- <div class="child">
246
- <ValueItem
247
- value={item}
248
- indent={props.indent + 1}
249
- index={index}
250
- compact={props.compact}
251
- />
252
- </div>
253
- ))}
254
-
255
- {!showAllChilds &&
256
- totalSize > compactMaxChilds && (
257
- <ButtonElement
258
- onClick={() => {
259
- showAllChilds = true
260
- }}
261
- class="show-all"
262
- >
263
- …show all (+
264
- {totalSize - compactMaxChilds})
265
- </ButtonElement>
266
- )}
267
- </>
268
- )
269
- })()}
270
- </div>
271
- <div class="delimiter end">]</div>
272
- </>
273
- )}
274
- </>
275
- )
276
- }
277
-
278
- if (valueIsObject) {
279
- return (
280
- <>
281
- <div
282
- class="delimiter"
283
- title={
284
- !hasKey ? 'Shift + Click to copy value' : undefined
285
- }
286
- onClick={
287
- !hasKey
288
- ? (e) => {
289
- if (e.shiftKey) {
290
- copyToClipboard(JSON.stringify(value))
291
- }
292
- }
293
- : undefined
294
- }
295
- >
296
- {!hasKey && toggleExpanded}
297
-
298
- {expanded
299
- ? '{'
300
- : `{…} ${Object.keys(value).length} properties`}
301
- </div>
302
-
303
- {expanded && (
304
- <>
305
- <div class="childs">
306
- {(() => {
307
- let entries = Object.entries(value)
308
- const totalSize = entries.length
309
-
310
- if (!showAllChilds) {
311
- entries = entries.slice(0, compactMaxChilds)
312
- }
313
-
314
- return (
315
- <>
316
- {entries.map(([key, objValue]) => (
317
- <div class="child">
318
- <ValueItem
319
- value={objValue}
320
- key={key}
321
- indent={props.indent + 1}
322
- compact={props.compact}
323
- />
324
- </div>
325
- ))}
326
-
327
- {!showAllChilds &&
328
- totalSize > compactMaxChilds && (
329
- <ButtonElement
330
- onClick={() => {
331
- showAllChilds = true
332
- }}
333
- class="show-all"
334
- >
335
- …show all (+
336
- {totalSize - compactMaxChilds})
337
- </ButtonElement>
338
- )}
339
- </>
340
- )
341
- })()}
342
- </div>
343
- <div class="delimiter end">{'}'}</div>
344
- </>
345
- )}
346
- </>
347
- )
348
- }
349
-
350
- return (
351
- <div
352
- class="value"
353
- data-type={typeof value}
354
- title="Shift + Click to copy value"
355
- onClick={(e) => {
356
- if (e.shiftKey) {
357
- copyToClipboard(String(value))
358
- }
359
- }}
360
- >
361
- {typeof value === 'string' && (
362
- <span class="string-quotes">"</span>
363
- )}
364
- {typeof value === 'number'
365
- ? numberFormatter.format(value)
366
- : String(value)}
367
- {typeof value === 'string' && (
368
- <span class="string-quotes">"</span>
369
- )}
370
- </div>
371
- )
372
- })()
373
- )}
374
- </>
375
- )
376
- })()}
377
- </>
378
- )
379
- }
380
-
381
- export const ValueVisualizer = (props: ValueVisualizerProps) => {
382
- return (
383
- <div class={containerStyle}>
384
- <ValueItem
385
- value={props.value}
386
- indent={0}
387
- compact={!!props.compact}
388
- />
389
- </div>
390
- )
391
- }
392
-
393
- async function copyToClipboard(text: string) {
394
- await navigator.clipboard.writeText(text)
395
-
396
- alert('Copied to clipboard')
397
- }
@@ -1,23 +0,0 @@
1
- export type Icons =
2
- | 'network'
3
- | 'search'
4
- | 'settings'
5
- | 'send'
6
- | 'caret-down'
7
-
8
- const test = import.meta.glob('/src/assets/icons/*.svg', {
9
- eager: true,
10
- as: 'raw',
11
- })
12
-
13
- export function getIconSvg(icon: Icons): string {
14
- const svg = test[`/src/assets/icons/${icon}.svg`]
15
-
16
- if (import.meta.env.DEV) {
17
- if (!svg) {
18
- throw new Error(`Icon ${icon} not found`)
19
- }
20
- }
21
-
22
- return svg as unknown as string
23
- }
@@ -1,28 +0,0 @@
1
- import '@src/utils/initializeScreenLogger'
2
- import dayjs from 'dayjs'
3
- import relativeTime from 'dayjs/plugin/relativeTime'
4
- import { render } from 'solid-js/web'
5
- import Root from '@src/Root'
6
-
7
- let unmount: () => void = () => {}
8
-
9
- export function initializeApp() {
10
- dayjs.extend(relativeTime)
11
-
12
- if (navigator.platform.indexOf('Win') > -1) {
13
- document.body.classList.add('windows')
14
- }
15
-
16
- const devToolsRoot =
17
- document.getElementById('dev-tools-root') || document.createElement('div')
18
-
19
- devToolsRoot.id = 'dev-tools-root'
20
-
21
- document.body.appendChild(devToolsRoot)
22
-
23
- unmount = render(() => <Root />, devToolsRoot)
24
- }
25
-
26
- export function unmountApp() {
27
- unmount()
28
- }
@@ -1,33 +0,0 @@
1
- import { initializeApp } from '@src/initializeApp'
2
- import { Config, setConfig } from '@src/stores/callsStore'
3
-
4
- import tinykeys from 'tinykeys'
5
-
6
- export function initializeDevTools({
7
- callsProcessor,
8
- shortcut = '$mod+D',
9
- }: {
10
- callsProcessor: Config['callsProcessor']
11
- shortcut?: string
12
- }) {
13
- tinykeys(window, {
14
- [shortcut]: (e) => {
15
- e.preventDefault()
16
-
17
- const active = document.activeElement
18
- const enteringText =
19
- active instanceof HTMLElement &&
20
- (active.isContentEditable ||
21
- active.tagName === 'INPUT' ||
22
- active.tagName === 'TEXTAREA')
23
-
24
- if (enteringText) return
25
-
26
- initializeApp()
27
- },
28
- })
29
-
30
- setConfig({
31
- callsProcessor,
32
- })
33
- }
package/src/main.ts DELETED
@@ -1,42 +0,0 @@
1
- import { initializeApp } from '@src/initializeApp'
2
- import { initializeDevTools } from '@src/initializeDevTools'
3
- import { addCall } from '@src/stores/callsStore'
4
-
5
- export { initializeDevTools, addCall }
6
-
7
- if (import.meta.env.DEV) {
8
- initializeApp()
9
-
10
- initializeDevTools({
11
- callsProcessor: [
12
- {
13
- match: '/objectProperties/index',
14
- callName: 'table fields',
15
- payloadAlias(payload: { object_type: string }) {
16
- return `table: ${payload.object_type}`
17
- },
18
- },
19
- {
20
- match: '/v3/tab/:id/views',
21
- // callName: 'tab views',
22
- payloadAlias(_, request) {
23
- return `tab: ${request.pathParams?.id}`
24
- },
25
- },
26
- {
27
- match: '/v3/tabs/:id',
28
- callName: 'tab config',
29
- payloadAlias(_, request) {
30
- return `tab: ${request.pathParams?.id}`
31
- },
32
- },
33
- {
34
- match: '/v3/low-code-functions/list-triggers/:id',
35
- callName: 'low code triggers',
36
- payloadAlias(_, request) {
37
- return `tab: ${request.pathParams?.id}`
38
- },
39
- },
40
- ],
41
- })
42
- }