@dxos/plugin-debug 0.8.4-main.c85a9c8dae → 0.8.4-main.d9fc60f731
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/LICENSE +102 -5
- package/PLUGIN.mdl +373 -0
- package/README.md +1 -1
- package/dist/lib/{browser/DebugGraph-7HXJ2PS2.mjs → neutral/DebugGraph-G4FWS57E.mjs} +4 -5
- package/dist/lib/neutral/DebugGraph-G4FWS57E.mjs.map +7 -0
- package/dist/lib/neutral/DebugObjectPanel-OS65NC4M.mjs +59 -0
- package/dist/lib/neutral/DebugObjectPanel-OS65NC4M.mjs.map +7 -0
- package/dist/lib/neutral/DebugPlugin.mjs +59 -0
- package/dist/lib/neutral/DebugPlugin.mjs.map +7 -0
- package/dist/lib/neutral/DebugPlugin.node.mjs +18 -0
- package/dist/lib/neutral/DebugPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/DebugPlugin.workerd.mjs +12 -0
- package/dist/lib/neutral/DebugPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/DebugSettings-RKYNQIKH.mjs +223 -0
- package/dist/lib/neutral/DebugSettings-RKYNQIKH.mjs.map +7 -0
- package/dist/lib/{browser/DebugSpaceObjectsPanel-7NRPLWZ4.mjs → neutral/DebugSpaceObjectsPanel-BHOCFWDJ.mjs} +10 -26
- package/dist/lib/neutral/DebugSpaceObjectsPanel-BHOCFWDJ.mjs.map +7 -0
- package/dist/lib/{browser/DebugStatus-COQGH37G.mjs → neutral/DebugStatus-H2BAHN26.mjs} +36 -39
- package/dist/lib/neutral/DebugStatus-H2BAHN26.mjs.map +7 -0
- package/dist/lib/{browser/DevtoolsOverviewContainer-C75NFVER.mjs → neutral/DevtoolsOverviewContainer-YX7Z3D2H.mjs} +9 -6
- package/dist/lib/neutral/DevtoolsOverviewContainer-YX7Z3D2H.mjs.map +7 -0
- package/dist/lib/neutral/GithubPanel-QJKDJRVQ.mjs +177 -0
- package/dist/lib/neutral/GithubPanel-QJKDJRVQ.mjs.map +7 -0
- package/dist/lib/neutral/RegistryPanel-64GIYJHN.mjs +161 -0
- package/dist/lib/neutral/RegistryPanel-64GIYJHN.mjs.map +7 -0
- package/dist/lib/neutral/SpaceGenerator-Y35G6DRV.mjs +146 -0
- package/dist/lib/neutral/SpaceGenerator-Y35G6DRV.mjs.map +7 -0
- package/dist/lib/{browser/Wireframe-KAGOKEFW.mjs → neutral/Wireframe-WD7S2AUU.mjs} +9 -10
- package/dist/lib/neutral/Wireframe-WD7S2AUU.mjs.map +7 -0
- package/dist/lib/{browser/app-graph-builder-LGUQNXHD.mjs → neutral/app-graph-builder-XYLTBYKN.mjs} +246 -259
- package/dist/lib/neutral/app-graph-builder-XYLTBYKN.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +15 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-HOV6MV5B.mjs +43 -0
- package/dist/lib/neutral/chunk-HOV6MV5B.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/{browser/chunk-4UFQXPP7.mjs → neutral/chunk-UAAGABXZ.mjs} +24 -12
- package/dist/lib/neutral/chunk-UAAGABXZ.mjs.map +7 -0
- package/dist/lib/{browser/SpaceGenerator-SWSGJEEL.mjs → neutral/components/index.mjs} +90 -292
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +25 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +18 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +12 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/{browser/react-context-I3USIAF6.mjs → neutral/react-context-MUZ3KVLU.mjs} +6 -6
- package/dist/lib/neutral/react-context-MUZ3KVLU.mjs.map +7 -0
- package/dist/lib/{browser/react-surface-BTVNKKVQ.mjs → neutral/react-surface-3MDMZGCA.mjs} +162 -180
- package/dist/lib/neutral/react-surface-3MDMZGCA.mjs.map +7 -0
- package/dist/lib/{browser/settings-SLTQJJNF.mjs → neutral/settings-MPM6YUP4.mjs} +7 -11
- package/dist/lib/neutral/settings-MPM6YUP4.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +91 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +14 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/src/DebugPlugin.d.ts +2 -5
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/DebugPlugin.node.d.ts +5 -0
- package/dist/types/src/DebugPlugin.node.d.ts.map +1 -0
- package/dist/types/src/DebugPlugin.test.d.ts +2 -0
- package/dist/types/src/DebugPlugin.test.d.ts.map +1 -0
- package/dist/types/src/DebugPlugin.workerd.d.ts +5 -0
- package/dist/types/src/DebugPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +11 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/{settings/settings.d.ts → settings.d.ts} +2 -1
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.d.ts +11 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts +106 -0
- package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings/index.d.ts +2 -0
- package/dist/types/src/components/DebugSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/SchemaTable/SchemaTable.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +3 -4
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts +2 -2
- package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts.map +1 -1
- package/dist/types/src/containers/DebugGraph/index.d.ts +1 -2
- package/dist/types/src/containers/DebugGraph/index.d.ts.map +1 -1
- package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts +3 -4
- package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/containers/DebugObjectPanel/index.d.ts +1 -2
- package/dist/types/src/containers/DebugObjectPanel/index.d.ts.map +1 -1
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +3 -1
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -1
- package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts +1 -2
- package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts.map +1 -1
- package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts.map +1 -1
- package/dist/types/src/containers/DebugStatus/index.d.ts +1 -2
- package/dist/types/src/containers/DebugStatus/index.d.ts.map +1 -1
- package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts.map +1 -1
- package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts +1 -2
- package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/GithubPanel/GithubComponent.d.ts +15 -0
- package/dist/types/src/containers/GithubPanel/GithubComponent.d.ts.map +1 -0
- package/dist/types/src/containers/GithubPanel/GithubComponent.stories.d.ts +106 -0
- package/dist/types/src/containers/GithubPanel/GithubComponent.stories.d.ts.map +1 -0
- package/dist/types/src/containers/GithubPanel/GithubPanel.d.ts +3 -0
- package/dist/types/src/containers/GithubPanel/GithubPanel.d.ts.map +1 -0
- package/dist/types/src/containers/GithubPanel/index.d.ts +2 -0
- package/dist/types/src/containers/GithubPanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/RegistryPanel/RegistryPanel.d.ts +3 -0
- package/dist/types/src/containers/RegistryPanel/RegistryPanel.d.ts.map +1 -0
- package/dist/types/src/containers/RegistryPanel/index.d.ts +2 -0
- package/dist/types/src/containers/RegistryPanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts +3 -1
- package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/containers/SpaceGenerator/index.d.ts +1 -2
- package/dist/types/src/containers/SpaceGenerator/index.d.ts.map +1 -1
- package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -1
- package/dist/types/src/containers/Wireframe/index.d.ts +1 -2
- package/dist/types/src/containers/Wireframe/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +2 -1
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +87 -61
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +8 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +70 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +112 -71
- package/src/DebugPlugin.node.ts +18 -0
- package/src/DebugPlugin.test.ts +29 -0
- package/src/DebugPlugin.tsx +14 -10
- package/src/DebugPlugin.workerd.ts +12 -0
- package/src/capabilities/app-graph-builder.ts +433 -0
- package/src/capabilities/index.ts +6 -4
- package/src/capabilities/{react-context/react-context.tsx → react-context.tsx} +7 -2
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +179 -161
- package/src/capabilities/{settings/settings.ts → settings.ts} +4 -4
- package/src/components/DebugSettings/DebugSettings.stories.tsx +36 -0
- package/src/components/DebugSettings/DebugSettings.tsx +259 -0
- package/src/components/DebugSettings/index.ts +5 -0
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +28 -28
- package/src/components/SpaceGenerator/draw-util.ts +8 -8
- package/src/components/SpaceGenerator/presets.ts +39 -62
- package/src/components/index.ts +4 -0
- package/src/containers/DebugGraph/DebugGraph.tsx +3 -2
- package/src/containers/DebugGraph/index.ts +1 -3
- package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +49 -18
- package/src/containers/DebugObjectPanel/index.ts +1 -3
- package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +11 -24
- package/src/containers/DebugSpaceObjectsPanel/index.ts +1 -3
- package/src/containers/DebugStatus/DebugStatus.tsx +42 -19
- package/src/containers/DebugStatus/index.ts +1 -3
- package/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx +8 -1
- package/src/containers/DevtoolsOverviewContainer/index.ts +1 -3
- package/src/containers/GithubPanel/GithubComponent.stories.tsx +38 -0
- package/src/containers/GithubPanel/GithubComponent.tsx +192 -0
- package/src/containers/GithubPanel/GithubPanel.tsx +17 -0
- package/src/containers/GithubPanel/index.ts +5 -0
- package/src/containers/RegistryPanel/RegistryPanel.tsx +150 -0
- package/src/containers/RegistryPanel/index.ts +5 -0
- package/src/containers/SpaceGenerator/SpaceGenerator.tsx +104 -104
- package/src/containers/SpaceGenerator/index.ts +1 -3
- package/src/containers/Wireframe/Wireframe.tsx +3 -7
- package/src/containers/Wireframe/index.ts +1 -3
- package/src/containers/index.ts +2 -1
- package/src/index.ts +1 -1
- package/src/meta.ts +26 -6
- package/src/plugin.ts +10 -0
- package/src/translations.ts +83 -60
- package/src/types/Settings.ts +16 -0
- package/src/{types.ts → types/index.ts} +16 -14
- package/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/DebugGraph-7HXJ2PS2.mjs.map +0 -7
- package/dist/lib/browser/DebugObjectPanel-3TCDNUNW.mjs +0 -33
- package/dist/lib/browser/DebugObjectPanel-3TCDNUNW.mjs.map +0 -7
- package/dist/lib/browser/DebugSettings-JZMIUDYB.mjs +0 -174
- package/dist/lib/browser/DebugSettings-JZMIUDYB.mjs.map +0 -7
- package/dist/lib/browser/DebugSpaceObjectsPanel-7NRPLWZ4.mjs.map +0 -7
- package/dist/lib/browser/DebugStatus-COQGH37G.mjs.map +0 -7
- package/dist/lib/browser/DevtoolsOverviewContainer-C75NFVER.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-SWSGJEEL.mjs.map +0 -7
- package/dist/lib/browser/Wireframe-KAGOKEFW.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-LGUQNXHD.mjs.map +0 -7
- package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +0 -7
- package/dist/lib/browser/chunk-A5H5GRV6.mjs +0 -20
- package/dist/lib/browser/chunk-A5H5GRV6.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -132
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-context-I3USIAF6.mjs.map +0 -7
- package/dist/lib/browser/react-surface-BTVNKKVQ.mjs.map +0 -7
- package/dist/lib/browser/settings-SLTQJJNF.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-context/index.d.ts +0 -7
- package/dist/types/src/capabilities/react-context/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-context/react-context.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -3
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
- package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts +0 -10
- package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts.map +0 -1
- package/dist/types/src/containers/DebugSettings/index.d.ts +0 -3
- package/dist/types/src/containers/DebugSettings/index.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -68
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -441
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/react-context/index.ts +0 -7
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/settings/index.ts +0 -7
- package/src/containers/DebugSettings/DebugSettings.tsx +0 -201
- package/src/containers/DebugSettings/index.ts +0 -7
- /package/dist/types/src/capabilities/{app-graph-builder/app-graph-builder.d.ts → app-graph-builder.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-context/react-context.d.ts → react-context.d.ts} +0 -0
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React
|
|
5
|
+
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { Tree } from '@dxos/devtools';
|
|
8
8
|
import { Graph } from '@dxos/plugin-graph';
|
|
9
9
|
|
|
10
10
|
export type DebugGraphProps = { graph: Graph.Graph; root: string };
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
export const DebugGraph = ({ graph, root }: DebugGraphProps) => {
|
|
12
13
|
return <Tree data={Graph.toJSON(graph, root)} />;
|
|
13
14
|
};
|
|
@@ -2,42 +2,73 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { useState } from 'react';
|
|
5
|
+
import React, { useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
7
8
|
import { ObjectsTree } from '@dxos/devtools';
|
|
8
|
-
import { Filter, Obj, Query } from '@dxos/echo';
|
|
9
|
-
import type {
|
|
9
|
+
import { Filter, Json, Obj, Query } from '@dxos/echo';
|
|
10
|
+
import type { EntityId } from '@dxos/keys';
|
|
10
11
|
import { useQuery } from '@dxos/react-client/echo';
|
|
11
|
-
import { Clipboard,
|
|
12
|
-
import {
|
|
12
|
+
import { Clipboard, Input, Panel, ScrollArea, Toolbar } from '@dxos/react-ui';
|
|
13
|
+
import { Syntax } from '@dxos/react-ui-syntax-highlighter';
|
|
14
|
+
import { mx } from '@dxos/ui-theme';
|
|
13
15
|
|
|
14
|
-
export type DebugObjectPanelProps =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export const DebugObjectPanel = ({ object }: DebugObjectPanelProps) => {
|
|
19
|
-
const db = Obj.getDatabase(object);
|
|
16
|
+
export type DebugObjectPanelProps = Pick<
|
|
17
|
+
AppSurface.ObjectArticleProps<Obj.Unknown, {}, Obj.Unknown>,
|
|
18
|
+
'role' | 'companionTo'
|
|
19
|
+
>;
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
export const DebugObjectPanel = ({ role, companionTo }: DebugObjectPanelProps) => {
|
|
22
|
+
const db = Obj.getDatabase(companionTo);
|
|
23
|
+
const [selectedId, setSelectedId] = useState<EntityId | null>(null);
|
|
24
|
+
const [depth, setDepth] = useState(0);
|
|
22
25
|
const [selectedObject] = useQuery(
|
|
23
26
|
db,
|
|
24
|
-
Query.select(Filter.id(selectedId ??
|
|
27
|
+
Query.select(Filter.id(selectedId ?? companionTo.id)).options({ deleted: 'include' }),
|
|
25
28
|
);
|
|
29
|
+
const refReplacer = useMemo(() => (db ? Json.createRefReplacer({ db, depth }) : undefined), [db, depth]);
|
|
26
30
|
|
|
27
31
|
return (
|
|
28
32
|
<Clipboard.Provider>
|
|
29
|
-
<Panel.Root>
|
|
33
|
+
<Panel.Root role={role}>
|
|
34
|
+
<Panel.Toolbar asChild>
|
|
35
|
+
<Toolbar.Root />
|
|
36
|
+
</Panel.Toolbar>
|
|
30
37
|
<Panel.Content asChild>
|
|
31
|
-
<
|
|
38
|
+
<div className={mx('grid divide-y divide-separator', db && 'grid-rows-[1fr_2fr]')}>
|
|
32
39
|
{db && (
|
|
33
40
|
<ScrollArea.Root>
|
|
34
41
|
<ScrollArea.Viewport>
|
|
35
|
-
<ObjectsTree db={db} root={
|
|
42
|
+
<ObjectsTree db={db} root={companionTo} onSelect={(entity) => setSelectedId(entity.id)} />
|
|
36
43
|
</ScrollArea.Viewport>
|
|
37
44
|
</ScrollArea.Root>
|
|
38
45
|
)}
|
|
39
|
-
<
|
|
40
|
-
|
|
46
|
+
<Syntax.Root data={selectedObject} replacer={refReplacer}>
|
|
47
|
+
<Panel.Root>
|
|
48
|
+
<Panel.Toolbar asChild>
|
|
49
|
+
<Toolbar.Root classNames='grid grid-cols-[1fr_3rem]'>
|
|
50
|
+
<Syntax.Filter />
|
|
51
|
+
<Input.Root>
|
|
52
|
+
<Input.TextInput
|
|
53
|
+
variant='subdued'
|
|
54
|
+
type='number'
|
|
55
|
+
min={0}
|
|
56
|
+
step={1}
|
|
57
|
+
aria-label='Ref depth'
|
|
58
|
+
value={depth}
|
|
59
|
+
onChange={(event) => setDepth(Math.max(0, Number(event.target.value) || 0))}
|
|
60
|
+
/>
|
|
61
|
+
</Input.Root>
|
|
62
|
+
</Toolbar.Root>
|
|
63
|
+
</Panel.Toolbar>
|
|
64
|
+
<Panel.Content asChild>
|
|
65
|
+
<Syntax.Viewport>
|
|
66
|
+
<Syntax.Code />
|
|
67
|
+
</Syntax.Viewport>
|
|
68
|
+
</Panel.Content>
|
|
69
|
+
</Panel.Root>
|
|
70
|
+
</Syntax.Root>
|
|
71
|
+
</div>
|
|
41
72
|
</Panel.Content>
|
|
42
73
|
</Panel.Root>
|
|
43
74
|
</Clipboard.Provider>
|
|
@@ -4,33 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { useLayout } from '@dxos/app-toolkit/ui';
|
|
7
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
9
8
|
import { ObjectsTree } from '@dxos/devtools';
|
|
10
|
-
import {
|
|
11
|
-
import type
|
|
12
|
-
import {
|
|
13
|
-
import { parseId, useQuery } from '@dxos/react-client/echo';
|
|
9
|
+
import { Filter, Query } from '@dxos/echo';
|
|
10
|
+
import { type EntityId } from '@dxos/keys';
|
|
11
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
14
12
|
import { Clipboard, Grid, Input, Panel, ScrollArea, Toolbar } from '@dxos/react-ui';
|
|
15
|
-
import {
|
|
13
|
+
import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
16
14
|
|
|
17
|
-
export
|
|
18
|
-
const layout = useLayout();
|
|
19
|
-
const client = useCapability(ClientCapabilities.Client);
|
|
20
|
-
const { spaceId } = parseId(layout.workspace);
|
|
21
|
-
const space = spaceId ? client.spaces.get(spaceId) : undefined;
|
|
22
|
-
if (!space) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return <DebugSpaceObjectsPanelMain database={space.db} />;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const DebugSpaceObjectsPanelMain = ({ database }: { database: Database.Database }) => {
|
|
30
|
-
const [selectedId, setSelectedId] = useState<ObjectId | null>(null);
|
|
15
|
+
export type DebugSpaceObjectsPanelProps = AppSurface.SpaceArticleProps;
|
|
31
16
|
|
|
17
|
+
export const DebugSpaceObjectsPanel = ({ space }: DebugSpaceObjectsPanelProps) => {
|
|
18
|
+
const [selectedId, setSelectedId] = useState<EntityId | null>(null);
|
|
32
19
|
const [selectedObject] = useQuery(
|
|
33
|
-
|
|
20
|
+
space.db,
|
|
34
21
|
selectedId ? Query.select(Filter.id(selectedId)) : Query.select(Filter.nothing()),
|
|
35
22
|
);
|
|
36
23
|
|
|
@@ -48,10 +35,10 @@ const DebugSpaceObjectsPanelMain = ({ database }: { database: Database.Database
|
|
|
48
35
|
<Grid rows={2} classNames='divide-y divide-separator'>
|
|
49
36
|
<ScrollArea.Root>
|
|
50
37
|
<ScrollArea.Viewport>
|
|
51
|
-
<ObjectsTree db={
|
|
38
|
+
<ObjectsTree db={space.db} onSelect={(entity) => setSelectedId(entity.id)} />
|
|
52
39
|
</ScrollArea.Viewport>
|
|
53
40
|
</ScrollArea.Root>
|
|
54
|
-
{selectedObject && <
|
|
41
|
+
{selectedObject && <JsonHighlighter classNames='p-1' data={selectedObject} />}
|
|
55
42
|
</Grid>
|
|
56
43
|
</Panel.Content>
|
|
57
44
|
</Panel.Root>
|
|
@@ -5,11 +5,10 @@
|
|
|
5
5
|
import React, { useEffect, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { TimeoutError } from '@dxos/async';
|
|
8
|
-
import {
|
|
9
|
-
import { StatusBar } from '@dxos/plugin-status-bar';
|
|
8
|
+
import { StatusBar } from '@dxos/plugin-status-bar/components';
|
|
10
9
|
import { ConnectionState } from '@dxos/protocols/proto/dxos/client/services';
|
|
11
10
|
import { useNetworkStatus } from '@dxos/react-client/mesh';
|
|
12
|
-
import {
|
|
11
|
+
import { IconButton } from '@dxos/react-ui';
|
|
13
12
|
|
|
14
13
|
const styles = {
|
|
15
14
|
success: 'text-sky-300 dark:text-green-700',
|
|
@@ -89,14 +88,21 @@ const ErrorIndicator = () => {
|
|
|
89
88
|
|
|
90
89
|
if (errorRef.current) {
|
|
91
90
|
return (
|
|
92
|
-
<StatusBar.
|
|
93
|
-
<
|
|
94
|
-
|
|
91
|
+
<StatusBar.Item>
|
|
92
|
+
<IconButton
|
|
93
|
+
variant='ghost'
|
|
94
|
+
icon='ph--warning-circle--duotone'
|
|
95
|
+
iconOnly
|
|
96
|
+
label={errorRef.current.message}
|
|
97
|
+
classNames={styles.error}
|
|
98
|
+
onClick={handleReset}
|
|
99
|
+
/>
|
|
100
|
+
</StatusBar.Item>
|
|
95
101
|
);
|
|
96
102
|
} else {
|
|
97
103
|
return (
|
|
98
|
-
<StatusBar.Item
|
|
99
|
-
<
|
|
104
|
+
<StatusBar.Item>
|
|
105
|
+
<IconButton variant='ghost' icon='ph--check--regular' iconOnly label='No errors.' />
|
|
100
106
|
</StatusBar.Item>
|
|
101
107
|
);
|
|
102
108
|
}
|
|
@@ -114,14 +120,20 @@ const SwarmIndicator = () => {
|
|
|
114
120
|
|
|
115
121
|
if (state === 0) {
|
|
116
122
|
return (
|
|
117
|
-
<StatusBar.Item
|
|
118
|
-
<
|
|
123
|
+
<StatusBar.Item>
|
|
124
|
+
<IconButton variant='ghost' icon='ph--lightning--regular' iconOnly label='Connected to swarm.' />
|
|
119
125
|
</StatusBar.Item>
|
|
120
126
|
);
|
|
121
127
|
} else {
|
|
122
128
|
return (
|
|
123
|
-
<StatusBar.Item
|
|
124
|
-
<
|
|
129
|
+
<StatusBar.Item>
|
|
130
|
+
<IconButton
|
|
131
|
+
variant='ghost'
|
|
132
|
+
icon='ph--lightning-slash--regular'
|
|
133
|
+
iconOnly
|
|
134
|
+
label='Disconnected from swarm.'
|
|
135
|
+
classNames={styles.warning}
|
|
136
|
+
/>
|
|
125
137
|
</StatusBar.Item>
|
|
126
138
|
);
|
|
127
139
|
}
|
|
@@ -133,7 +145,6 @@ const SwarmIndicator = () => {
|
|
|
133
145
|
// TODO(burdon): Merge with SaveStatus.
|
|
134
146
|
const SavingIndicator = () => {
|
|
135
147
|
const [state, _setState] = useState(0);
|
|
136
|
-
const _space = useActiveSpace();
|
|
137
148
|
// TODO(dmaretskyi): Fix this when we have save status for automerge.
|
|
138
149
|
// useEffect(() => {
|
|
139
150
|
// if (!space) {
|
|
@@ -156,21 +167,33 @@ const SavingIndicator = () => {
|
|
|
156
167
|
switch (state) {
|
|
157
168
|
case 2:
|
|
158
169
|
return (
|
|
159
|
-
<StatusBar.Item
|
|
160
|
-
<
|
|
170
|
+
<StatusBar.Item>
|
|
171
|
+
<IconButton
|
|
172
|
+
variant='ghost'
|
|
173
|
+
icon='ph--circle--duotone'
|
|
174
|
+
iconOnly
|
|
175
|
+
label='Edit not saved.'
|
|
176
|
+
classNames={styles.warning}
|
|
177
|
+
/>
|
|
161
178
|
</StatusBar.Item>
|
|
162
179
|
);
|
|
163
180
|
case 1:
|
|
164
181
|
return (
|
|
165
|
-
<StatusBar.Item
|
|
166
|
-
<
|
|
182
|
+
<StatusBar.Item>
|
|
183
|
+
<IconButton
|
|
184
|
+
variant='ghost'
|
|
185
|
+
icon='ph--circle--duotone'
|
|
186
|
+
iconOnly
|
|
187
|
+
label='Saving...'
|
|
188
|
+
classNames={styles.success}
|
|
189
|
+
/>
|
|
167
190
|
</StatusBar.Item>
|
|
168
191
|
);
|
|
169
192
|
case 0:
|
|
170
193
|
default:
|
|
171
194
|
return (
|
|
172
|
-
<StatusBar.Item
|
|
173
|
-
<
|
|
195
|
+
<StatusBar.Item>
|
|
196
|
+
<IconButton variant='ghost' icon='ph--circle--duotone' iconOnly label='Modified indicator.' />
|
|
174
197
|
</StatusBar.Item>
|
|
175
198
|
);
|
|
176
199
|
}
|
|
@@ -9,9 +9,16 @@ import { StatsPanel, useStats } from '@dxos/devtools';
|
|
|
9
9
|
|
|
10
10
|
export const DevtoolsOverviewContainer = () => {
|
|
11
11
|
const [stats, refreshStats] = useStats();
|
|
12
|
+
const surfaceProfilerStats = Surface.useProfilerStats();
|
|
13
|
+
const clearSurfaceProfiler = Surface.useProfilerClear();
|
|
12
14
|
|
|
13
15
|
return (
|
|
14
|
-
<StatsPanel
|
|
16
|
+
<StatsPanel
|
|
17
|
+
stats={stats}
|
|
18
|
+
surfaceProfilerStats={surfaceProfilerStats}
|
|
19
|
+
onRefresh={refreshStats}
|
|
20
|
+
onClearSurfaceProfiler={clearSurfaceProfiler}
|
|
21
|
+
>
|
|
15
22
|
<Surface.Surface role='devtools-overview' />
|
|
16
23
|
</StatsPanel>
|
|
17
24
|
);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
9
|
+
|
|
10
|
+
import { translations } from '#translations';
|
|
11
|
+
|
|
12
|
+
import { GithubComponent } from './GithubComponent';
|
|
13
|
+
|
|
14
|
+
const DefaultStory = () => (
|
|
15
|
+
<GithubComponent.Root>
|
|
16
|
+
<div className='grid grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden h-full is-full'>
|
|
17
|
+
<GithubComponent.Header />
|
|
18
|
+
<GithubComponent.Content />
|
|
19
|
+
<GithubComponent.StatusBar />
|
|
20
|
+
</div>
|
|
21
|
+
</GithubComponent.Root>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const meta = {
|
|
25
|
+
title: 'plugins/plugin-debug/containers/GithubComponent',
|
|
26
|
+
component: DefaultStory,
|
|
27
|
+
decorators: [withTheme(), withLayout({ layout: 'column', classNames: 'w-(--dx-r1-size)' })],
|
|
28
|
+
parameters: {
|
|
29
|
+
layout: 'fullscreen',
|
|
30
|
+
translations,
|
|
31
|
+
},
|
|
32
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
33
|
+
|
|
34
|
+
export default meta;
|
|
35
|
+
|
|
36
|
+
type Story = StoryObj<typeof meta>;
|
|
37
|
+
|
|
38
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type ReactNode, createContext, useContext, useEffect, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { IconButton, ScrollArea, useTranslation } from '@dxos/react-ui';
|
|
8
|
+
|
|
9
|
+
import { meta } from '#meta';
|
|
10
|
+
|
|
11
|
+
const DEFAULT_REPO = 'dxos/dxos';
|
|
12
|
+
const DEFAULT_LIMIT = 20;
|
|
13
|
+
|
|
14
|
+
type GithubUser = {
|
|
15
|
+
login: string;
|
|
16
|
+
avatar_url: string;
|
|
17
|
+
html_url: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type GithubPullRequest = {
|
|
21
|
+
number: number;
|
|
22
|
+
title: string;
|
|
23
|
+
html_url: string;
|
|
24
|
+
merged_at: string | null;
|
|
25
|
+
user: GithubUser;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type ComponentContextValue = {
|
|
29
|
+
repo: string;
|
|
30
|
+
pulls: GithubPullRequest[];
|
|
31
|
+
unavailable: boolean;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const ComponentContext = createContext<ComponentContextValue | null>(null);
|
|
35
|
+
|
|
36
|
+
const useComponentContext = () => {
|
|
37
|
+
const ctx = useContext(ComponentContext);
|
|
38
|
+
if (!ctx) {
|
|
39
|
+
throw new Error('GithubComponent.* parts must be rendered inside GithubComponent.Root.');
|
|
40
|
+
}
|
|
41
|
+
return ctx;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type GithubComponentRootProps = {
|
|
45
|
+
/** `<owner>/<name>`. Defaults to `dxos/dxos`. */
|
|
46
|
+
repo?: string;
|
|
47
|
+
/** Maximum number of merged PRs to fetch. */
|
|
48
|
+
limit?: number;
|
|
49
|
+
children?: ReactNode;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const Root = ({ repo = DEFAULT_REPO, limit = DEFAULT_LIMIT, children }: GithubComponentRootProps) => {
|
|
53
|
+
const [pulls, setPulls] = useState<GithubPullRequest[]>([]);
|
|
54
|
+
const [unavailable, setUnavailable] = useState(false);
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
const controller = new AbortController();
|
|
58
|
+
setPulls([]);
|
|
59
|
+
setUnavailable(false);
|
|
60
|
+
void (async () => {
|
|
61
|
+
try {
|
|
62
|
+
const url = new URL(`https://api.github.com/repos/${repo}/pulls`);
|
|
63
|
+
url.searchParams.set('state', 'closed');
|
|
64
|
+
url.searchParams.set('sort', 'updated');
|
|
65
|
+
url.searchParams.set('direction', 'desc');
|
|
66
|
+
url.searchParams.set('per_page', String(limit * 2));
|
|
67
|
+
const response = await fetch(url.toString(), {
|
|
68
|
+
signal: controller.signal,
|
|
69
|
+
headers: { Accept: 'application/vnd.github+json' },
|
|
70
|
+
});
|
|
71
|
+
if (!response.ok) {
|
|
72
|
+
setUnavailable(true);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const items = (await response.json()) as GithubPullRequest[];
|
|
76
|
+
setPulls(items.filter((pull) => pull.merged_at !== null).slice(0, limit));
|
|
77
|
+
setUnavailable(false);
|
|
78
|
+
} catch {
|
|
79
|
+
if (controller.signal.aborted) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
setPulls([]);
|
|
83
|
+
setUnavailable(true);
|
|
84
|
+
}
|
|
85
|
+
})();
|
|
86
|
+
return () => controller.abort();
|
|
87
|
+
}, [repo, limit]);
|
|
88
|
+
|
|
89
|
+
return <ComponentContext.Provider value={{ repo, pulls, unavailable }}>{children}</ComponentContext.Provider>;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const Header = () => {
|
|
93
|
+
const { t } = useTranslation(meta.id);
|
|
94
|
+
const { repo, pulls, unavailable } = useComponentContext();
|
|
95
|
+
return (
|
|
96
|
+
<header className='flex items-center justify-between gap-1 px-4 py-3 bg-modal-surface border-b border-subdued-separator'>
|
|
97
|
+
<a
|
|
98
|
+
href={`https://github.com/${repo}`}
|
|
99
|
+
target='_blank'
|
|
100
|
+
rel='noopener noreferrer'
|
|
101
|
+
className='text-sm font-medium truncate'
|
|
102
|
+
>
|
|
103
|
+
@{repo}
|
|
104
|
+
</a>
|
|
105
|
+
<div className='text-xs text-description'>
|
|
106
|
+
{unavailable
|
|
107
|
+
? t('github-unavailable.message')
|
|
108
|
+
: pulls.length > 0
|
|
109
|
+
? t('recent-prs.label', { count: pulls.length })
|
|
110
|
+
: t('github-loading.message')}
|
|
111
|
+
</div>
|
|
112
|
+
</header>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const RELATIVE_UNITS: Array<[Intl.RelativeTimeFormatUnit, number]> = [
|
|
117
|
+
['year', 60 * 60 * 24 * 365],
|
|
118
|
+
['month', 60 * 60 * 24 * 30],
|
|
119
|
+
['week', 60 * 60 * 24 * 7],
|
|
120
|
+
['day', 60 * 60 * 24],
|
|
121
|
+
['hour', 60 * 60],
|
|
122
|
+
['minute', 60],
|
|
123
|
+
];
|
|
124
|
+
|
|
125
|
+
const formatRelative = (iso: string): string => {
|
|
126
|
+
const formatter = new Intl.RelativeTimeFormat(undefined, { numeric: 'auto' });
|
|
127
|
+
const diffSeconds = (Date.parse(iso) - Date.now()) / 1000;
|
|
128
|
+
const absDiff = Math.abs(diffSeconds);
|
|
129
|
+
for (const [unit, secondsInUnit] of RELATIVE_UNITS) {
|
|
130
|
+
if (absDiff >= secondsInUnit) {
|
|
131
|
+
return formatter.format(Math.round(diffSeconds / secondsInUnit), unit);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return formatter.format(Math.round(diffSeconds), 'second');
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const PullRow = ({ pull }: { pull: GithubPullRequest }) => (
|
|
138
|
+
<li>
|
|
139
|
+
<a
|
|
140
|
+
href={pull.html_url}
|
|
141
|
+
target='_blank'
|
|
142
|
+
rel='noopener noreferrer'
|
|
143
|
+
className='flex items-start gap-2 px-2 py-1 rounded-sm hover:bg-hover-surface'
|
|
144
|
+
>
|
|
145
|
+
<img src={pull.user.avatar_url} alt='' className='w-6 h-6 rounded-full shrink-0 mt-0.5' />
|
|
146
|
+
<div className='flex flex-col min-w-0 flex-1'>
|
|
147
|
+
<span className='text-sm truncate'>{pull.title}</span>
|
|
148
|
+
<span className='text-xs text-description truncate'>
|
|
149
|
+
#{pull.number} · {pull.user.login} · {pull.merged_at ? formatRelative(pull.merged_at) : ''}
|
|
150
|
+
</span>
|
|
151
|
+
</div>
|
|
152
|
+
</a>
|
|
153
|
+
</li>
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
const Content = () => {
|
|
157
|
+
const { pulls } = useComponentContext();
|
|
158
|
+
return (
|
|
159
|
+
<ScrollArea.Root orientation='vertical'>
|
|
160
|
+
<ScrollArea.Viewport>
|
|
161
|
+
<ul className='flex flex-col p-1'>
|
|
162
|
+
{pulls.map((pull) => (
|
|
163
|
+
<PullRow key={pull.number} pull={pull} />
|
|
164
|
+
))}
|
|
165
|
+
</ul>
|
|
166
|
+
</ScrollArea.Viewport>
|
|
167
|
+
</ScrollArea.Root>
|
|
168
|
+
);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const StatusBar = () => {
|
|
172
|
+
const { t } = useTranslation(meta.id);
|
|
173
|
+
const { repo } = useComponentContext();
|
|
174
|
+
return (
|
|
175
|
+
<IconButton
|
|
176
|
+
icon='ph--github-logo--regular'
|
|
177
|
+
label={t('view-on-github.button')}
|
|
178
|
+
variant='primary'
|
|
179
|
+
classNames='w-full'
|
|
180
|
+
onClick={() => {
|
|
181
|
+
window.open(`https://github.com/${repo}`, '_blank', 'noopener,noreferrer');
|
|
182
|
+
}}
|
|
183
|
+
/>
|
|
184
|
+
);
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export const GithubComponent = {
|
|
188
|
+
Root,
|
|
189
|
+
Header,
|
|
190
|
+
Content,
|
|
191
|
+
StatusBar,
|
|
192
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { GithubComponent } from './GithubComponent';
|
|
8
|
+
|
|
9
|
+
export const GithubPanel = () => (
|
|
10
|
+
<GithubComponent.Root>
|
|
11
|
+
<div className='h-full grid grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden h-full is-full'>
|
|
12
|
+
<GithubComponent.Header />
|
|
13
|
+
<GithubComponent.Content />
|
|
14
|
+
<GithubComponent.StatusBar />
|
|
15
|
+
</div>
|
|
16
|
+
</GithubComponent.Root>
|
|
17
|
+
);
|