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.
- package/dist/main.d.ts +62 -0
- package/dist/main.js +2396 -0
- package/dist/main.umd.cjs +753 -0
- package/package.json +21 -16
- package/.eslintignore +0 -3
- package/.eslintrc.cjs +0 -112
- package/.gitattributes +0 -22
- package/.prettierrc +0 -10
- package/.quokka.ts +0 -115
- package/.vscode/settings.json +0 -7
- package/.vscode/snippets.code-snippets +0 -75
- package/.vscode/tasks.json +0 -17
- package/index.html +0 -46
- package/pnpm-lock.yaml +0 -5313
- package/scripts/check-if-is-sync.sh +0 -6
- package/scripts/filterFetchRequests.ts +0 -60
- package/src/Root.tsx +0 -11
- package/src/assets/icons/caret-down.svg +0 -11
- package/src/assets/icons/network.svg +0 -6
- package/src/assets/icons/search.svg +0 -3
- package/src/assets/icons/send.svg +0 -3
- package/src/assets/icons/settings.svg +0 -3
- package/src/components/ButtonElement.tsx +0 -18
- package/src/components/Icon.tsx +0 -44
- package/src/components/Section.tsx +0 -57
- package/src/components/Select.tsx +0 -101
- package/src/components/ValueVisualizer.tsx +0 -397
- package/src/config/icons.tsx +0 -23
- package/src/initializeApp.tsx +0 -28
- package/src/initializeDevTools.ts +0 -33
- package/src/main.ts +0 -42
- package/src/mocks/mockedRequests.json +0 -28391
- package/src/pages/api-explorer/ApiExplorerMenu.tsx +0 -136
- package/src/pages/api-explorer/ApiExplorerMenuItem.tsx +0 -208
- package/src/pages/api-explorer/Diff.tsx +0 -223
- package/src/pages/api-explorer/RequestDetails.tsx +0 -264
- package/src/pages/api-explorer/Timeline.tsx +0 -174
- package/src/pages/api-explorer/api-explorer.tsx +0 -21
- package/src/pages/api-explorer/getRequestPayload.tsx +0 -15
- package/src/pages/app/App.tsx +0 -79
- package/src/stores/callsStore.ts +0 -267
- package/src/stores/uiStore.ts +0 -15
- package/src/style/globalStyle.ts +0 -54
- package/src/style/helpers/allowTextSelection.ts +0 -7
- package/src/style/helpers/anchorColor.ts +0 -9
- package/src/style/helpers/centerContent.ts +0 -5
- package/src/style/helpers/circle.ts +0 -7
- package/src/style/helpers/ellipsis.ts +0 -8
- package/src/style/helpers/fillContainer.ts +0 -7
- package/src/style/helpers/gradientBorder.ts +0 -28
- package/src/style/helpers/gradientText.ts +0 -8
- package/src/style/helpers/inline.ts +0 -34
- package/src/style/helpers/mountAnim.ts +0 -26
- package/src/style/helpers/multilineEllipsis.ts +0 -8
- package/src/style/helpers/outline.ts +0 -5
- package/src/style/helpers/responsiveSize.ts +0 -27
- package/src/style/helpers/stack.ts +0 -36
- package/src/style/helpers/transition.ts +0 -63
- package/src/style/mediaQueries.ts +0 -6
- package/src/style/reset.ts +0 -75
- package/src/style/scrollBar.ts +0 -37
- package/src/style/theme.ts +0 -35
- package/src/types/global.d.ts +0 -8
- package/src/utils/initializeScreenLogger.ts +0 -12
- package/tsconfig.json +0 -36
- package/tsconfig.prod.json +0 -10
- package/tsup.config.ts +0 -7
- package/utils/arrayUtils.ts +0 -29
- package/utils/assertions.ts +0 -7
- package/utils/autoIncrementId.ts +0 -5
- package/utils/createThemev2.ts +0 -64
- package/utils/cx.ts +0 -27
- package/utils/getDiff.ts +0 -15
- package/utils/hexToRgb.ts +0 -14
- package/utils/objectUtils.ts +0 -3
- package/utils/parseUnit.ts +0 -10
- package/utils/solid.ts +0 -76
- package/utils/truncateText.ts +0 -7
- package/utils/tryExpression.ts +0 -14
- package/utils/typed.ts +0 -23
- package/utils/typings.ts +0 -40
- package/utils/urlPattern.ts +0 -25
- package/vite.config.ts +0 -46
package/src/style/reset.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
export const resetStyle = `
|
|
2
|
-
*,
|
|
3
|
-
*::before,
|
|
4
|
-
*::after {
|
|
5
|
-
box-sizing: border-box;
|
|
6
|
-
margin: 0;
|
|
7
|
-
padding: 0;
|
|
8
|
-
min-height: 0;
|
|
9
|
-
min-width: 0;
|
|
10
|
-
flex-shrink: 0;
|
|
11
|
-
|
|
12
|
-
-webkit-font-smoothing: antialiased;
|
|
13
|
-
-moz-osx-font-smoothing: grayscale;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/* Remove default padding */
|
|
17
|
-
ul[class],
|
|
18
|
-
ol[class] {
|
|
19
|
-
padding: 0;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/* Remove default margin */
|
|
23
|
-
body,
|
|
24
|
-
h1,
|
|
25
|
-
h2,
|
|
26
|
-
h3,
|
|
27
|
-
h4,
|
|
28
|
-
p,
|
|
29
|
-
ul[class],
|
|
30
|
-
ol[class],
|
|
31
|
-
li,
|
|
32
|
-
figure,
|
|
33
|
-
figcaption,
|
|
34
|
-
blockquote,
|
|
35
|
-
dl,
|
|
36
|
-
dd {
|
|
37
|
-
margin: 0;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/* Set core body defaults */
|
|
41
|
-
body {
|
|
42
|
-
scroll-behavior: smooth;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/* Natural flow and rhythm in articles by default */
|
|
46
|
-
article > * + * {
|
|
47
|
-
margin-top: 1em;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/* Inherit fonts for inputs and buttons */
|
|
51
|
-
input,
|
|
52
|
-
button,
|
|
53
|
-
textarea,
|
|
54
|
-
select {
|
|
55
|
-
font: inherit;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
a {
|
|
59
|
-
color: inherit;
|
|
60
|
-
text-decoration: inherit;
|
|
61
|
-
cursor: pointer;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
a:visited {
|
|
65
|
-
color: inherit;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
button {
|
|
69
|
-
background: transparent;
|
|
70
|
-
border: 0;
|
|
71
|
-
outline: none;
|
|
72
|
-
cursor: pointer;
|
|
73
|
-
-webkit-appearance: none;
|
|
74
|
-
}
|
|
75
|
-
`
|
package/src/style/scrollBar.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { mq } from '@src/style/mediaQueries'
|
|
2
|
-
import { colors } from '@src/style/theme'
|
|
3
|
-
|
|
4
|
-
export const scrollBarStyle = `
|
|
5
|
-
::-webkit-scrollbar {
|
|
6
|
-
width: 6px;
|
|
7
|
-
height: 6px;
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
${mq.mobile} {
|
|
12
|
-
*::-webkit-scrollbar {
|
|
13
|
-
width: 0;
|
|
14
|
-
height: 0;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
::-webkit-scrollbar-track,
|
|
19
|
-
::-webkit-scrollbar-corner {
|
|
20
|
-
background-color: transparent;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
::-webkit-scrollbar-thumb {
|
|
24
|
-
border-radius: 4px;
|
|
25
|
-
margin: 2px;
|
|
26
|
-
background-color: ${colors.bg.alpha(0.5)};
|
|
27
|
-
|
|
28
|
-
&:hover {
|
|
29
|
-
background-color: ${colors.bg.lighter(6)};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
&:active {
|
|
33
|
-
background-color: ${colors.bg.lighter(11)};
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
`
|
package/src/style/theme.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { createThemeColors } from '@utils/createThemev2'
|
|
2
|
-
|
|
3
|
-
export const colors = createThemeColors({
|
|
4
|
-
bgPrimary: '#0F172A',
|
|
5
|
-
bgSecondary: '#1E293B',
|
|
6
|
-
textPrimary: '#fff',
|
|
7
|
-
primary: '#F472B6',
|
|
8
|
-
secondary: '#7DD3FC',
|
|
9
|
-
warning: '#FDE047',
|
|
10
|
-
error: '#f87171',
|
|
11
|
-
successDarker: '#0d9488',
|
|
12
|
-
success: '#4ADE80',
|
|
13
|
-
bg: '#EAEFFF',
|
|
14
|
-
white: '#fff',
|
|
15
|
-
black: '#000',
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
export const gradients = {
|
|
19
|
-
primary: `linear-gradient(90deg, #A78BFA, #00D4FF);`,
|
|
20
|
-
secondary: `linear-gradient(90deg, #448cfd , #6ee7b7);`,
|
|
21
|
-
red: `linear-gradient(90deg, #E53558 , #E75590);`,
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const shadows = {
|
|
25
|
-
modal: '0px 8px 16px rgba(26, 34, 46, 0.04)',
|
|
26
|
-
button: '0px 1px 8px rgba(26, 34, 46, 0.06)',
|
|
27
|
-
hardShadow: '0px 1px 8px rgba(26, 34, 46, 0.16)',
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type ThemeColors = keyof typeof colors
|
|
31
|
-
|
|
32
|
-
export const fonts = {
|
|
33
|
-
primary: 'Work Sans, sans-serif',
|
|
34
|
-
decorative: '"Fira Code", monospaced',
|
|
35
|
-
}
|
package/src/types/global.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
if (import.meta.env.DEV) {
|
|
2
|
-
const oslu = await import('oslu')
|
|
3
|
-
|
|
4
|
-
oslu.initializeTempLogs({ ignoreErrors: [] })
|
|
5
|
-
|
|
6
|
-
oslu.initializePersistentLogs()
|
|
7
|
-
|
|
8
|
-
const anyGlobalThis = globalThis as any
|
|
9
|
-
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
11
|
-
anyGlobalThis.watchValue = oslu.watchValue
|
|
12
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compileOnSave": false,
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "ESNext",
|
|
5
|
-
"module": "ESNext",
|
|
6
|
-
"moduleResolution": "node",
|
|
7
|
-
"jsx": "react-jsx",
|
|
8
|
-
"jsxImportSource": "solid-js",
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"types": ["node"],
|
|
11
|
-
"noEmit": true,
|
|
12
|
-
"esModuleInterop": true,
|
|
13
|
-
"strictNullChecks": true,
|
|
14
|
-
"noImplicitReturns": true,
|
|
15
|
-
"resolveJsonModule": true,
|
|
16
|
-
"noImplicitAny": true,
|
|
17
|
-
"alwaysStrict": true,
|
|
18
|
-
"strict": true,
|
|
19
|
-
"noUncheckedIndexedAccess": true,
|
|
20
|
-
"forceConsistentCasingInFileNames": true,
|
|
21
|
-
"strictPropertyInitialization": true,
|
|
22
|
-
|
|
23
|
-
"baseUrl": ".",
|
|
24
|
-
"paths": {
|
|
25
|
-
"@src/*": ["src/*"],
|
|
26
|
-
"@utils/*": ["utils/*"]
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
"plugins": [
|
|
30
|
-
{
|
|
31
|
-
"name": "typescript-styled-plugin",
|
|
32
|
-
"tags": ["css"]
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
}
|
package/tsconfig.prod.json
DELETED
package/tsup.config.ts
DELETED
package/utils/arrayUtils.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export function reverseCopy<T>(array: T[] | null | undefined): T[] {
|
|
2
|
-
if (!array) return []
|
|
3
|
-
|
|
4
|
-
return array.slice().reverse()
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function withIndex<T>(array: T[]): [T, number][] {
|
|
8
|
-
return array.map((item, index) => [item, index])
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function mapArrayToMap<
|
|
12
|
-
K extends string | number,
|
|
13
|
-
T extends any[] | readonly any[],
|
|
14
|
-
O,
|
|
15
|
-
>(
|
|
16
|
-
array: T,
|
|
17
|
-
mapFunction: (item: T[number], index: number) => [key: K, value: O],
|
|
18
|
-
): Map<K, O> {
|
|
19
|
-
const map = new Map<K, O>()
|
|
20
|
-
|
|
21
|
-
for (let i = 0; i < array.length; i++) {
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
23
|
-
const [key, value] = mapFunction(array[i], i)
|
|
24
|
-
|
|
25
|
-
map.set(key, value)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return map
|
|
29
|
-
}
|
package/utils/assertions.ts
DELETED
package/utils/autoIncrementId.ts
DELETED
package/utils/createThemev2.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { hexToRgb } from '@utils/hexToRgb'
|
|
2
|
-
import { typedObjectEntries } from '@utils/typed'
|
|
3
|
-
|
|
4
|
-
const rootStyle = document.documentElement.style
|
|
5
|
-
|
|
6
|
-
type ColorProps = {
|
|
7
|
-
var: string
|
|
8
|
-
raw: string
|
|
9
|
-
red: number
|
|
10
|
-
green: number
|
|
11
|
-
blue: number
|
|
12
|
-
alpha: (alpha: number) => string
|
|
13
|
-
darker: (percentage: number, alpha?: number) => string
|
|
14
|
-
lighter: (percentage: number, alpha?: number) => string
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
let autoId = 1
|
|
18
|
-
|
|
19
|
-
export function createThemeColors<C extends Record<string, string>>(colors: C) {
|
|
20
|
-
const themeColors: Record<keyof C, ColorProps> = {} as any
|
|
21
|
-
|
|
22
|
-
for (const [name, color] of typedObjectEntries(colors)) {
|
|
23
|
-
const [red, green, blue] = hexToRgb(color)
|
|
24
|
-
|
|
25
|
-
const colorId = `c${autoId}`
|
|
26
|
-
autoId++
|
|
27
|
-
|
|
28
|
-
rootStyle.setProperty(`--${colorId}-r`, String(red))
|
|
29
|
-
rootStyle.setProperty(`--${colorId}-g`, String(green))
|
|
30
|
-
rootStyle.setProperty(`--${colorId}-b`, String(blue))
|
|
31
|
-
rootStyle.setProperty(`--${colorId}`, color)
|
|
32
|
-
|
|
33
|
-
themeColors[name] = {
|
|
34
|
-
red: red!,
|
|
35
|
-
green: green!,
|
|
36
|
-
blue: blue!,
|
|
37
|
-
var: `var(--${colorId})`,
|
|
38
|
-
raw: color,
|
|
39
|
-
alpha: (alpha) =>
|
|
40
|
-
`rgba(var(--${colorId}-r), var(--${colorId}-g), var(--${colorId}-b), ${alpha})`,
|
|
41
|
-
darker: (percentage, alpha) => {
|
|
42
|
-
const weight = percentage / 100
|
|
43
|
-
|
|
44
|
-
return `${alpha ? 'rgba' : 'rgb'}(${[
|
|
45
|
-
`calc(var(--${colorId}-r) - var(--${colorId}-r) * ${weight})`,
|
|
46
|
-
`calc(var(--${colorId}-g) - var(--${colorId}-g) * ${weight})`,
|
|
47
|
-
`calc(var(--${colorId}-b) - var(--${colorId}-b) * ${weight})`,
|
|
48
|
-
].join(',')}${alpha !== undefined ? `, ${alpha}` : ''})`
|
|
49
|
-
},
|
|
50
|
-
lighter: (percentage, alpha) => {
|
|
51
|
-
const weight = percentage / 100
|
|
52
|
-
|
|
53
|
-
// mix function = c1r + (c2r - c1r) * weight, for each rgb value
|
|
54
|
-
return `${alpha ? 'rgba' : 'rgb'}(${[
|
|
55
|
-
`calc(var(--${colorId}-r) + (255 - var(--${colorId}-r)) * ${weight})`,
|
|
56
|
-
`calc(var(--${colorId}-g) + (255 - var(--${colorId}-g)) * ${weight})`,
|
|
57
|
-
`calc(var(--${colorId}-b) + (255 - var(--${colorId}-b)) * ${weight})`,
|
|
58
|
-
].join(',')}${alpha !== undefined ? `, ${alpha}` : ''})`
|
|
59
|
-
},
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return themeColors
|
|
64
|
-
}
|
package/utils/cx.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { anyObj } from '@utils/typings'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Utility for conditionally joining classNames together
|
|
5
|
-
*/
|
|
6
|
-
export function cx(...args: (string | false | undefined | null | anyObj)[]) {
|
|
7
|
-
const classNames = []
|
|
8
|
-
|
|
9
|
-
for (let i = 0; i < args.length; i++) {
|
|
10
|
-
const arg = args[i]
|
|
11
|
-
if (!arg) continue
|
|
12
|
-
|
|
13
|
-
const argType = typeof arg
|
|
14
|
-
|
|
15
|
-
if (argType === 'string' || argType === 'number') {
|
|
16
|
-
classNames.push(arg)
|
|
17
|
-
} else if (argType === 'object') {
|
|
18
|
-
for (let i2 = 0, keys = Object.keys(arg); i2 < keys.length; i2++) {
|
|
19
|
-
if ((arg as anyObj<boolean>)[keys[i2]!]) {
|
|
20
|
-
classNames.push(keys[i2])
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return classNames.join(' ')
|
|
27
|
-
}
|
package/utils/getDiff.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { dequal } from 'dequal'
|
|
2
|
-
import * as diff from 'diff'
|
|
3
|
-
|
|
4
|
-
export function getDiff(from: unknown, to: unknown) {
|
|
5
|
-
if (dequal(from, to)) {
|
|
6
|
-
return 'no changes'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const diffs = diff.diffJson(
|
|
10
|
-
typeof from === 'object' && from !== null ? from : String(from),
|
|
11
|
-
typeof to === 'object' && to !== null ? to : String(to),
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
return diffs
|
|
15
|
-
}
|
package/utils/hexToRgb.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export function hexToRgb(hex: string) {
|
|
2
|
-
if (hex.length < 4) throw new Error('Invalid hex value');
|
|
3
|
-
|
|
4
|
-
return (
|
|
5
|
-
hex
|
|
6
|
-
.replace(
|
|
7
|
-
/^#?([a-f\d])([a-f\d])([a-f\d])$/i,
|
|
8
|
-
(m: string, r: string, g: string, b: string) =>
|
|
9
|
-
`#${r}${r}${g}${g}${b}${b}`,
|
|
10
|
-
)
|
|
11
|
-
.substring(1)
|
|
12
|
-
.match(/.{2}/g) || []
|
|
13
|
-
).map((x: string) => parseInt(x, 16));
|
|
14
|
-
}
|
package/utils/objectUtils.ts
DELETED
package/utils/parseUnit.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export function parseUnit(
|
|
2
|
-
value: string | number | number[],
|
|
3
|
-
defaultUnit = 'px',
|
|
4
|
-
) {
|
|
5
|
-
return typeof value === 'string'
|
|
6
|
-
? String(value)
|
|
7
|
-
: Array.isArray(value)
|
|
8
|
-
? value.map((item) => `${item}${defaultUnit}`).join(' ')
|
|
9
|
-
: `${value}${defaultUnit}`;
|
|
10
|
-
}
|
package/utils/solid.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { dequal } from 'dequal'
|
|
2
|
-
import { createEffect, createMemo, createRoot, createSignal } from 'solid-js'
|
|
3
|
-
|
|
4
|
-
export function subscribe(callback: () => any) {
|
|
5
|
-
let disposer: (() => void) | null = null
|
|
6
|
-
|
|
7
|
-
createRoot((dispose) => {
|
|
8
|
-
createEffect(() => {
|
|
9
|
-
disposer = dispose
|
|
10
|
-
callback()
|
|
11
|
-
})
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
return disposer!
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type ReconcileItems<T> = T[]
|
|
18
|
-
|
|
19
|
-
export function reconcile<T>(
|
|
20
|
-
original: readonly T[] | undefined | null,
|
|
21
|
-
newItems: ReconcileItems<T>,
|
|
22
|
-
key: keyof T,
|
|
23
|
-
): T[] {
|
|
24
|
-
if (!original) {
|
|
25
|
-
return newItems
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const final: T[] = []
|
|
29
|
-
|
|
30
|
-
const originalMap = new Map<any, T>(original.map((item) => [item[key], item]))
|
|
31
|
-
|
|
32
|
-
for (const item of newItems) {
|
|
33
|
-
const currentValue = originalMap.get(item[key])
|
|
34
|
-
|
|
35
|
-
if (!currentValue) {
|
|
36
|
-
final.push(item)
|
|
37
|
-
} else if (dequal(currentValue, item)) {
|
|
38
|
-
final.push(currentValue)
|
|
39
|
-
} else {
|
|
40
|
-
final.push(item)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return final
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function createReconciledArray<T>(
|
|
48
|
-
array: T[] | (() => T[]),
|
|
49
|
-
key: keyof T,
|
|
50
|
-
) {
|
|
51
|
-
return createMemo<T[]>((prev) => {
|
|
52
|
-
return reconcile(prev, typeof array === 'function' ? array() : array, key)
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function createElemRef<E extends HTMLElement>() {
|
|
57
|
-
const ref = undefined as E | undefined
|
|
58
|
-
|
|
59
|
-
return ref
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export function createSignalRef<T>(initialValue: T) {
|
|
63
|
-
const [value, setValue] = createSignal(initialValue)
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
get value() {
|
|
67
|
-
return value()
|
|
68
|
-
},
|
|
69
|
-
set value(newValue) {
|
|
70
|
-
setValue(() => newValue)
|
|
71
|
-
},
|
|
72
|
-
set(newValue: T) {
|
|
73
|
-
setValue(() => newValue)
|
|
74
|
-
},
|
|
75
|
-
}
|
|
76
|
-
}
|
package/utils/truncateText.ts
DELETED
package/utils/tryExpression.ts
DELETED
package/utils/typed.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** a wrapper to Object.entries with a better typing inference */
|
|
2
|
-
export function typedObjectEntries<T extends object>(
|
|
3
|
-
obj: T,
|
|
4
|
-
): NonNullable<
|
|
5
|
-
{
|
|
6
|
-
[K in keyof T]: [K, T[K]]
|
|
7
|
-
}[keyof T]
|
|
8
|
-
>[] {
|
|
9
|
-
return Object.entries(obj) as any
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/** a wrapper to Object.keys with a better typing inference */
|
|
13
|
-
export function typedObjectKeys<T extends object>(obj: T): (keyof T)[] {
|
|
14
|
-
return Object.keys(obj) as any
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function arrayIsNotEmpty<T>(arr: T[] | null | undefined): arr is T[] {
|
|
18
|
-
return !!arr && arr.length !== 0
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function asType<T>(value: T): T {
|
|
22
|
-
return value as T
|
|
23
|
-
}
|
package/utils/typings.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2
|
-
export type anyObj<T = any> = {
|
|
3
|
-
[key: string]: T
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
-
export type anyFunction = {
|
|
8
|
-
(...params: any): any
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type Serializable =
|
|
12
|
-
| boolean
|
|
13
|
-
| number
|
|
14
|
-
| string
|
|
15
|
-
| null
|
|
16
|
-
| undefined
|
|
17
|
-
| Serializable[]
|
|
18
|
-
| { [key: string]: Serializable }
|
|
19
|
-
|
|
20
|
-
export type StrictEqualTypes = string | number | undefined
|
|
21
|
-
|
|
22
|
-
export type PartialRecord<K extends keyof any, T> = {
|
|
23
|
-
[P in K]?: T
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type ObjectPropValue<T extends anyObj> = T[keyof T]
|
|
27
|
-
|
|
28
|
-
export type MutuallyAssignable<T extends U, U extends V, V = T> = void
|
|
29
|
-
|
|
30
|
-
export type Modify<T, R> = Omit<T, keyof R> & R
|
|
31
|
-
|
|
32
|
-
export type StrictPropertyCheck<
|
|
33
|
-
T,
|
|
34
|
-
TExpected,
|
|
35
|
-
TError = 'Type does not satisfies the expected shape',
|
|
36
|
-
> = T extends TExpected
|
|
37
|
-
? Exclude<keyof T, keyof TExpected> extends never
|
|
38
|
-
? T
|
|
39
|
-
: TError
|
|
40
|
-
: TExpected
|
package/utils/urlPattern.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { parse } from 'regexparam'
|
|
2
|
-
|
|
3
|
-
export function matchURLPattern(url: string, pattern: string) {
|
|
4
|
-
const regex = parse(pattern)
|
|
5
|
-
|
|
6
|
-
return exec(url, regex)
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function exec(
|
|
10
|
-
path: string,
|
|
11
|
-
result: { keys: string[]; pattern: RegExp },
|
|
12
|
-
): Record<string, string | null> | null {
|
|
13
|
-
let i = 0
|
|
14
|
-
const out = {} as Record<string, string | null>
|
|
15
|
-
|
|
16
|
-
const matches = result.pattern.exec(path)
|
|
17
|
-
|
|
18
|
-
if (!matches) return null
|
|
19
|
-
|
|
20
|
-
while (i < result.keys.length) {
|
|
21
|
-
out[result.keys[i]!] = matches[++i] || null
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return out
|
|
25
|
-
}
|
package/vite.config.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import solidLabels from 'babel-plugin-solid-labels'
|
|
2
|
-
import { resolve } from 'path'
|
|
3
|
-
import { defineConfig } from 'vite'
|
|
4
|
-
import solidPlugin from 'vite-plugin-solid'
|
|
5
|
-
import packageJson from './package.json'
|
|
6
|
-
|
|
7
|
-
export default defineConfig((config) => ({
|
|
8
|
-
plugins: [
|
|
9
|
-
solidPlugin({
|
|
10
|
-
babel: {
|
|
11
|
-
plugins: [[solidLabels, { dev: config.command === 'serve' }]],
|
|
12
|
-
},
|
|
13
|
-
}),
|
|
14
|
-
],
|
|
15
|
-
build: {
|
|
16
|
-
target: 'esnext',
|
|
17
|
-
assetsInlineLimit: 0,
|
|
18
|
-
lib: {
|
|
19
|
-
entry: resolve(__dirname, 'src/main.ts'),
|
|
20
|
-
name: 'App Devtools',
|
|
21
|
-
// the proper extensions will be added
|
|
22
|
-
fileName: 'main',
|
|
23
|
-
},
|
|
24
|
-
rollupOptions: {
|
|
25
|
-
// make sure to externalize deps that shouldn't be bundled
|
|
26
|
-
// into your library
|
|
27
|
-
external: [...Object.keys(packageJson.dependencies)],
|
|
28
|
-
output: {
|
|
29
|
-
// Provide global variables to use in the UMD build
|
|
30
|
-
// for externalized deps
|
|
31
|
-
globals: {},
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
resolve: {
|
|
36
|
-
alias: [
|
|
37
|
-
{ find: '@src', replacement: '/src' },
|
|
38
|
-
{ find: '@utils', replacement: '/utils' },
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
test: {
|
|
42
|
-
include: ['test/*.test.{ts,tsx}'],
|
|
43
|
-
testTimeout: 5_000,
|
|
44
|
-
environment: 'happy-dom',
|
|
45
|
-
},
|
|
46
|
-
}))
|