@dxos/plugin-debug 0.8.4-main.28f8d3d → 0.8.4-main.406dc2a
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/lib/browser/DebugGraph-EDOH6R2G.mjs +20 -0
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +7 -0
- package/dist/lib/browser/{SpaceGenerator-XJJAOTIT.mjs → SpaceGenerator-VMWHGAJZ.mjs} +210 -31
- package/dist/lib/browser/SpaceGenerator-VMWHGAJZ.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-PXPZIIGY.mjs → app-graph-builder-I4IHBKKN.mjs} +73 -82
- package/dist/lib/browser/app-graph-builder-I4IHBKKN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-AJA6RYN3.mjs → chunk-SRV2AIGJ.mjs} +2 -2
- package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-5XPIRNQS.mjs → chunk-SVCKCXCL.mjs} +2 -4
- package/dist/lib/browser/chunk-SVCKCXCL.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +13 -12
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-context-NVAGLAJD.mjs → react-context-QLZE7VSQ.mjs} +6 -6
- package/dist/lib/browser/react-context-QLZE7VSQ.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-UNFNQFWK.mjs → react-surface-GFORPA3A.mjs} +75 -71
- package/dist/lib/browser/react-surface-GFORPA3A.mjs.map +7 -0
- package/dist/lib/browser/{settings-LSSWLM5I.mjs → settings-EBVICEEW.mjs} +5 -5
- package/dist/lib/browser/{settings-LSSWLM5I.mjs.map → settings-EBVICEEW.mjs.map} +1 -1
- package/dist/types/src/DebugPlugin.d.ts +1 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +5 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/components/DebugGraph.d.ts +8 -0
- package/dist/types/src/components/DebugGraph.d.ts.map +1 -0
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +13 -4
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +4 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +65 -63
- package/src/DebugPlugin.tsx +5 -6
- package/src/capabilities/app-graph-builder.ts +61 -87
- package/src/capabilities/react-context.tsx +2 -2
- package/src/capabilities/react-surface.tsx +46 -44
- package/src/components/DebugGraph.tsx +14 -0
- package/src/components/DebugObjectPanel.tsx +2 -4
- package/src/components/DebugSettings.tsx +72 -64
- package/src/components/DebugStatus.tsx +2 -2
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +8 -8
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +10 -10
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +1 -1
- package/src/components/SpaceGenerator/draw-util.ts +2 -2
- package/src/components/SpaceGenerator/presets.ts +172 -11
- package/src/components/Wireframe.tsx +2 -1
- package/src/components/index.ts +1 -1
- package/src/meta.ts +1 -3
- package/src/translations.ts +2 -0
- package/src/types.ts +1 -1
- package/dist/lib/browser/DebugApp-F4UFVW4Y.mjs +0 -228
- package/dist/lib/browser/DebugApp-F4UFVW4Y.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-XJJAOTIT.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-PXPZIIGY.mjs.map +0 -7
- package/dist/lib/browser/chunk-5XPIRNQS.mjs.map +0 -7
- package/dist/lib/browser/chunk-AJA6RYN3.mjs.map +0 -7
- package/dist/lib/browser/react-context-NVAGLAJD.mjs.map +0 -7
- package/dist/lib/browser/react-surface-UNFNQFWK.mjs.map +0 -7
- package/dist/types/src/components/DebugApp/DebugApp.d.ts +0 -6
- package/dist/types/src/components/DebugApp/DebugApp.d.ts.map +0 -1
- package/dist/types/src/components/DebugApp/Tree.d.ts +0 -18
- package/dist/types/src/components/DebugApp/Tree.d.ts.map +0 -1
- package/dist/types/src/components/DebugApp/index.d.ts +0 -3
- package/dist/types/src/components/DebugApp/index.d.ts.map +0 -1
- package/src/components/DebugApp/DebugApp.tsx +0 -85
- package/src/components/DebugApp/Tree.tsx +0 -103
- package/src/components/DebugApp/index.ts +0 -7
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type FC, type HTMLAttributes, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
8
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
9
|
-
import { arrayToBuffer } from '@dxos/util';
|
|
10
|
-
|
|
11
|
-
// TODO(burdon): Copied form devtools.
|
|
12
|
-
|
|
13
|
-
export const replacer = (key: any, value: any) => {
|
|
14
|
-
if (typeof value === 'object') {
|
|
15
|
-
if (value instanceof Uint8Array) {
|
|
16
|
-
return arrayToBuffer(value).toString('hex');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (value?.type === 'Buffer') {
|
|
20
|
-
return Buffer.from(value.data).toString('hex');
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (key === 'downloaded') {
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return value;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const Json: FC<{ data?: object }> = ({ data }) => {
|
|
32
|
-
return <SyntaxHighlighter language='json'>{JSON.stringify(data, replacer, 2)}</SyntaxHighlighter>;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const Tree: FC<{ data?: object }> = ({ data }) => {
|
|
36
|
-
return (
|
|
37
|
-
<div className='p-2'>
|
|
38
|
-
<Node data={data} root />
|
|
39
|
-
</div>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const Node: FC<{ data?: any; root?: boolean }> = ({ data, root }) => {
|
|
44
|
-
if (typeof data !== 'object' || data === undefined || data === null) {
|
|
45
|
-
return <Scalar value={data} />;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (Array.isArray(data)) {
|
|
49
|
-
return (
|
|
50
|
-
<div className='flex flex-col space-y-2'>
|
|
51
|
-
{data.map((value, index) => (
|
|
52
|
-
<KeyValue key={index} label={String(index)} data={value} className='bg-teal-50' />
|
|
53
|
-
))}
|
|
54
|
-
</div>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<div className='flex flex-col space-y-2'>
|
|
60
|
-
{Object.entries(data).map(([key, value]) => (
|
|
61
|
-
<KeyValue key={key} label={key} data={value} className='bg-blue-50' />
|
|
62
|
-
))}
|
|
63
|
-
</div>
|
|
64
|
-
);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export const KeyValue: FC<{ label: string; data?: any; className?: string }> = ({ label, data, className }) => {
|
|
68
|
-
const [open, setOpen] = useState(true);
|
|
69
|
-
if (data === undefined) {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<div className='flex'>
|
|
75
|
-
<Box
|
|
76
|
-
className={mx('border-blue-200 text-sm select-none cursor-pointer', className)}
|
|
77
|
-
onClick={() => setOpen((open) => !open)}
|
|
78
|
-
>
|
|
79
|
-
{label}
|
|
80
|
-
</Box>
|
|
81
|
-
{open && <Node data={data} />}
|
|
82
|
-
</div>
|
|
83
|
-
);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const Scalar: FC<{ value: any }> = ({ value }) => {
|
|
87
|
-
return (
|
|
88
|
-
<Box className='bg-green-50 border-green-200 rounded-r text-sm font-thin'>
|
|
89
|
-
{(value === undefined && 'undefined') ||
|
|
90
|
-
(value === null && 'null') ||
|
|
91
|
-
(typeof value === 'string' && value) ||
|
|
92
|
-
JSON.stringify(value)}
|
|
93
|
-
</Box>
|
|
94
|
-
);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const Box: FC<HTMLAttributes<HTMLDivElement>> = ({ children, className, ...props }) => {
|
|
98
|
-
return (
|
|
99
|
-
<div className={mx('flex px-2 border border-l-0 font-mono truncate', className)} {...props}>
|
|
100
|
-
{children}
|
|
101
|
-
</div>
|
|
102
|
-
);
|
|
103
|
-
};
|