@dxos/plugin-debug 0.10.0 → 0.11.1
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/PLUGIN.mdl +12 -325
- package/README.md +4 -14
- package/dist/lib/DebugPlugin.mjs +29 -0
- package/dist/lib/DebugPlugin.mjs.map +1 -0
- package/dist/lib/DebugPlugin.node.mjs +10 -0
- package/dist/lib/DebugPlugin.node.mjs.map +1 -0
- package/dist/lib/DebugPlugin.workerd.mjs +8 -0
- package/dist/lib/DebugPlugin.workerd.mjs.map +1 -0
- package/dist/lib/capabilities.mjs +11 -0
- package/dist/lib/capabilities.mjs.map +1 -0
- package/dist/lib/chunk-DebugObjectPanel.mjs +58 -0
- package/dist/lib/chunk-DebugObjectPanel.mjs.map +1 -0
- package/dist/lib/chunk-DebugSettings.mjs +237 -0
- package/dist/lib/chunk-DebugSettings.mjs.map +1 -0
- package/dist/lib/chunk-DebugSpaceObjectsPanel.mjs +39 -0
- package/dist/lib/chunk-DebugSpaceObjectsPanel.mjs.map +1 -0
- package/dist/lib/chunk-DebugStatus.mjs +117 -0
- package/dist/lib/chunk-DebugStatus.mjs.map +1 -0
- package/dist/lib/chunk-LogStatus.mjs +44 -0
- package/dist/lib/chunk-LogStatus.mjs.map +1 -0
- package/dist/lib/chunk-SpaceGenerator.mjs +208 -0
- package/dist/lib/chunk-SpaceGenerator.mjs.map +1 -0
- package/dist/lib/chunk-StatsPanel.mjs +58 -0
- package/dist/lib/chunk-StatsPanel.mjs.map +1 -0
- package/dist/lib/chunk-Wireframe.mjs +60 -0
- package/dist/lib/chunk-Wireframe.mjs.map +1 -0
- package/dist/lib/chunk-app-graph-builder.mjs +76 -0
- package/dist/lib/chunk-app-graph-builder.mjs.map +1 -0
- package/dist/lib/chunk-log-recording.mjs +17 -0
- package/dist/lib/chunk-log-recording.mjs.map +1 -0
- package/dist/lib/chunk-meta.mjs +36 -0
- package/dist/lib/chunk-meta.mjs.map +1 -0
- package/dist/lib/chunk-react-surface.mjs +193 -0
- package/dist/lib/chunk-react-surface.mjs.map +1 -0
- package/dist/lib/chunk-settings.mjs +23 -0
- package/dist/lib/chunk-settings.mjs.map +1 -0
- package/dist/lib/chunk-stats-panel.mjs +56 -0
- package/dist/lib/chunk-stats-panel.mjs.map +1 -0
- package/dist/lib/chunk-types.mjs +60 -0
- package/dist/lib/chunk-types.mjs.map +1 -0
- package/dist/lib/components.mjs +763 -0
- package/dist/lib/components.mjs.map +1 -0
- package/dist/lib/containers.mjs +14 -0
- package/dist/lib/containers.mjs.map +1 -0
- package/dist/lib/index.mjs +3 -0
- package/dist/lib/meta.mjs +2 -0
- package/dist/lib/plugin.mjs +8 -0
- package/dist/lib/plugin.mjs.map +1 -0
- package/dist/lib/translations.mjs +38 -0
- package/dist/lib/translations.mjs.map +1 -0
- package/dist/lib/types.mjs +2 -0
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/DebugSurfaces.d.ts +25 -0
- package/dist/types/src/capabilities/DebugSurfaces.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/index.d.ts +4 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/log-recording.d.ts +10 -0
- package/dist/types/src/capabilities/log-recording.d.ts.map +1 -0
- 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/capabilities/stats-panel.d.ts +16 -0
- package/dist/types/src/capabilities/stats-panel.d.ts.map +1 -0
- package/dist/types/src/components/SchemaTable/SchemaTable.d.ts +4 -3
- package/dist/types/src/components/SchemaTable/SchemaTable.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts +4 -1
- package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts +4 -1
- package/dist/types/src/containers/DebugSettings/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/containers/DebugSettings/DebugSettings.stories.d.ts +30 -58
- package/dist/types/src/containers/DebugSettings/DebugSettings.stories.d.ts.map +1 -1
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +4 -1
- package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -1
- package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts +4 -1
- package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts.map +1 -1
- package/dist/types/src/containers/LogStatus/LogStatus.d.ts +6 -0
- package/dist/types/src/containers/LogStatus/LogStatus.d.ts.map +1 -0
- package/dist/types/src/containers/LogStatus/index.d.ts +2 -0
- package/dist/types/src/containers/LogStatus/index.d.ts.map +1 -0
- package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts +1 -1
- package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/containers/StatsPanel/StatsPanel.d.ts +6 -0
- package/dist/types/src/containers/StatsPanel/StatsPanel.d.ts.map +1 -0
- package/dist/types/src/containers/StatsPanel/index.d.ts +2 -0
- package/dist/types/src/containers/StatsPanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/Wireframe/Wireframe.d.ts +4 -1
- package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +4 -6
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +26 -57
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/DebugNodes.d.ts +7 -0
- package/dist/types/src/types/DebugNodes.d.ts.map +1 -0
- package/dist/types/src/types/DebugSurface.d.ts +8 -0
- package/dist/types/src/types/DebugSurface.d.ts.map +1 -0
- package/dist/types/src/types/debug.d.ts +3 -1
- package/dist/types/src/types/debug.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +2 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dx.config.ts +8 -13
- package/package.json +61 -63
- package/src/DebugPlugin.node.ts +1 -1
- package/src/DebugPlugin.tsx +10 -27
- package/src/DebugPlugin.workerd.ts +1 -1
- package/src/capabilities/DebugSurfaces.tsx +146 -0
- package/src/capabilities/app-graph-builder.ts +39 -373
- package/src/capabilities/index.ts +3 -2
- package/src/capabilities/log-recording.ts +20 -0
- package/src/capabilities/react-surface.ts +123 -0
- package/src/capabilities/stats-panel.ts +74 -0
- package/src/components/SchemaTable/SchemaTable.tsx +6 -5
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +9 -3
- package/src/components/SpaceGenerator/presets.ts +2 -2
- package/src/components/index.ts +1 -1
- package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +20 -20
- package/src/containers/DebugSettings/DebugSettings.tsx +4 -3
- package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +4 -2
- package/src/containers/DebugStatus/DebugStatus.tsx +2 -0
- package/src/containers/LogStatus/LogStatus.tsx +51 -0
- package/src/containers/LogStatus/index.ts +5 -0
- package/src/containers/SpaceGenerator/SpaceGenerator.tsx +108 -10
- package/src/containers/StatsPanel/StatsPanel.tsx +74 -0
- package/src/containers/StatsPanel/index.ts +5 -0
- package/src/containers/Wireframe/Wireframe.tsx +2 -0
- package/src/containers/index.ts +9 -7
- package/src/index.ts +1 -1
- package/src/meta.ts +1 -1
- package/src/plugin.ts +1 -1
- package/src/translations.ts +8 -52
- package/src/types/DebugNodes.ts +18 -0
- package/src/types/DebugSurface.ts +16 -0
- package/src/types/debug.ts +3 -1
- package/src/types/index.ts +3 -3
- package/dist/lib/neutral/DebugGraph-G4FWS57E.mjs +0 -15
- package/dist/lib/neutral/DebugGraph-G4FWS57E.mjs.map +0 -7
- package/dist/lib/neutral/DebugObjectPanel-QSGQJ3LM.mjs +0 -61
- package/dist/lib/neutral/DebugObjectPanel-QSGQJ3LM.mjs.map +0 -7
- package/dist/lib/neutral/DebugPlugin.mjs +0 -59
- package/dist/lib/neutral/DebugPlugin.mjs.map +0 -7
- package/dist/lib/neutral/DebugPlugin.node.mjs +0 -18
- package/dist/lib/neutral/DebugPlugin.node.mjs.map +0 -7
- package/dist/lib/neutral/DebugPlugin.workerd.mjs +0 -12
- package/dist/lib/neutral/DebugPlugin.workerd.mjs.map +0 -7
- package/dist/lib/neutral/DebugSettings-Q3WUL6YQ.mjs +0 -229
- package/dist/lib/neutral/DebugSettings-Q3WUL6YQ.mjs.map +0 -7
- package/dist/lib/neutral/DebugSpaceObjectsPanel-AXFZWEIM.mjs +0 -36
- package/dist/lib/neutral/DebugSpaceObjectsPanel-AXFZWEIM.mjs.map +0 -7
- package/dist/lib/neutral/DebugStatus-H2BAHN26.mjs +0 -122
- package/dist/lib/neutral/DebugStatus-H2BAHN26.mjs.map +0 -7
- package/dist/lib/neutral/DevtoolsOverviewContainer-DWQHTK7D.mjs +0 -24
- package/dist/lib/neutral/DevtoolsOverviewContainer-DWQHTK7D.mjs.map +0 -7
- package/dist/lib/neutral/GithubPanel-4CSJRVKE.mjs +0 -177
- package/dist/lib/neutral/GithubPanel-4CSJRVKE.mjs.map +0 -7
- package/dist/lib/neutral/RegistryPanel-64GIYJHN.mjs +0 -161
- package/dist/lib/neutral/RegistryPanel-64GIYJHN.mjs.map +0 -7
- package/dist/lib/neutral/SpaceGenerator-Y35G6DRV.mjs +0 -146
- package/dist/lib/neutral/SpaceGenerator-Y35G6DRV.mjs.map +0 -7
- package/dist/lib/neutral/Wireframe-WD7S2AUU.mjs +0 -52
- package/dist/lib/neutral/Wireframe-WD7S2AUU.mjs.map +0 -7
- package/dist/lib/neutral/app-graph-builder-UKG4WVYK.mjs +0 -619
- package/dist/lib/neutral/app-graph-builder-UKG4WVYK.mjs.map +0 -7
- package/dist/lib/neutral/capabilities/index.mjs +0 -15
- package/dist/lib/neutral/capabilities/index.mjs.map +0 -7
- package/dist/lib/neutral/chunk-72QXLYMI.mjs +0 -118
- package/dist/lib/neutral/chunk-72QXLYMI.mjs.map +0 -7
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
- package/dist/lib/neutral/chunk-R5C4CKOF.mjs +0 -54
- package/dist/lib/neutral/chunk-R5C4CKOF.mjs.map +0 -7
- package/dist/lib/neutral/components/index.mjs +0 -961
- package/dist/lib/neutral/components/index.mjs.map +0 -7
- package/dist/lib/neutral/containers/index.mjs +0 -27
- package/dist/lib/neutral/containers/index.mjs.map +0 -7
- package/dist/lib/neutral/index.mjs +0 -20
- package/dist/lib/neutral/index.mjs.map +0 -7
- package/dist/lib/neutral/meta.json +0 -1
- package/dist/lib/neutral/meta.mjs +0 -8
- package/dist/lib/neutral/meta.mjs.map +0 -7
- package/dist/lib/neutral/plugin.mjs +0 -12
- package/dist/lib/neutral/plugin.mjs.map +0 -7
- package/dist/lib/neutral/react-context-UJURDOO6.mjs +0 -17
- package/dist/lib/neutral/react-context-UJURDOO6.mjs.map +0 -7
- package/dist/lib/neutral/react-surface-URESE7J4.mjs +0 -484
- package/dist/lib/neutral/react-surface-URESE7J4.mjs.map +0 -7
- package/dist/lib/neutral/settings-5I2674B6.mjs +0 -28
- package/dist/lib/neutral/settings-5I2674B6.mjs.map +0 -7
- package/dist/lib/neutral/translations.mjs +0 -91
- package/dist/lib/neutral/translations.mjs.map +0 -7
- package/dist/lib/neutral/types/index.mjs +0 -16
- package/dist/lib/neutral/types/index.mjs.map +0 -7
- package/dist/types/src/DebugPlugin.test.d.ts +0 -2
- package/dist/types/src/DebugPlugin.test.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-context.d.ts +0 -5
- package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
- package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts +0 -8
- package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts.map +0 -1
- package/dist/types/src/containers/DebugGraph/index.d.ts +0 -2
- package/dist/types/src/containers/DebugGraph/index.d.ts.map +0 -1
- package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts +0 -3
- package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts.map +0 -1
- package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts +0 -2
- package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +0 -1
- package/dist/types/src/containers/GithubPanel/GithubComponent.d.ts +0 -15
- package/dist/types/src/containers/GithubPanel/GithubComponent.d.ts.map +0 -1
- package/dist/types/src/containers/GithubPanel/GithubComponent.stories.d.ts +0 -106
- package/dist/types/src/containers/GithubPanel/GithubComponent.stories.d.ts.map +0 -1
- package/dist/types/src/containers/GithubPanel/GithubPanel.d.ts +0 -3
- package/dist/types/src/containers/GithubPanel/GithubPanel.d.ts.map +0 -1
- package/dist/types/src/containers/GithubPanel/index.d.ts +0 -2
- package/dist/types/src/containers/GithubPanel/index.d.ts.map +0 -1
- package/dist/types/src/containers/RegistryPanel/RegistryPanel.d.ts +0 -3
- package/dist/types/src/containers/RegistryPanel/RegistryPanel.d.ts.map +0 -1
- package/dist/types/src/containers/RegistryPanel/index.d.ts +0 -2
- package/dist/types/src/containers/RegistryPanel/index.d.ts.map +0 -1
- package/dist/types/src/types/Devtools.d.ts +0 -57
- package/dist/types/src/types/Devtools.d.ts.map +0 -1
- package/dist/types/src/types/surface.d.ts +0 -4
- package/dist/types/src/types/surface.d.ts.map +0 -1
- package/src/DebugPlugin.test.ts +0 -29
- package/src/capabilities/react-context.tsx +0 -25
- package/src/capabilities/react-surface.tsx +0 -504
- package/src/containers/DebugGraph/DebugGraph.tsx +0 -14
- package/src/containers/DebugGraph/index.ts +0 -5
- package/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx +0 -27
- package/src/containers/DevtoolsOverviewContainer/index.ts +0 -5
- package/src/containers/GithubPanel/GithubComponent.stories.tsx +0 -38
- package/src/containers/GithubPanel/GithubComponent.tsx +0 -192
- package/src/containers/GithubPanel/GithubPanel.tsx +0 -17
- package/src/containers/GithubPanel/index.ts +0 -5
- package/src/containers/RegistryPanel/RegistryPanel.tsx +0 -150
- package/src/containers/RegistryPanel/index.ts +0 -5
- package/src/types/Devtools.ts +0 -73
- package/src/types/surface.ts +0 -10
|
@@ -1,192 +0,0 @@
|
|
|
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.profile.key);
|
|
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.profile.key);
|
|
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
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
);
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2026 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Operation } from '@dxos/compute';
|
|
8
|
-
import { JsonView, PanelContainer, Placeholder, Searchbar } from '@dxos/devtools';
|
|
9
|
-
import { Entity, Format, Obj, Type } from '@dxos/echo';
|
|
10
|
-
import { useClient } from '@dxos/react-client';
|
|
11
|
-
import { Toolbar } from '@dxos/react-ui';
|
|
12
|
-
import { DynamicTable, type TableFeatures } from '@dxos/react-ui-table';
|
|
13
|
-
import { mx } from '@dxos/ui-theme';
|
|
14
|
-
|
|
15
|
-
type RegistryRow = {
|
|
16
|
-
id: string;
|
|
17
|
-
kind: string;
|
|
18
|
-
label: string;
|
|
19
|
-
_entity: Entity.Unknown;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const textFilter = (text?: string) => {
|
|
23
|
-
if (!text) {
|
|
24
|
-
return () => true;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const matcher = new RegExp(text, 'i');
|
|
28
|
-
return (entity: Entity.Unknown) => {
|
|
29
|
-
const typename = Entity.getTypename(entity) ?? '';
|
|
30
|
-
const metaKey = Obj.isObject(entity) ? (Obj.getMeta(entity).key ?? '') : '';
|
|
31
|
-
const uri = Type.isType(entity) ? (Type.getURI(entity)?.toString() ?? '') : '';
|
|
32
|
-
const operationKey =
|
|
33
|
-
Obj.isObject(entity) && Obj.instanceOf(Operation.PersistentOperation, entity)
|
|
34
|
-
? (Operation.getKey(entity) ?? '')
|
|
35
|
-
: '';
|
|
36
|
-
const name = Obj.isObject(entity) && Obj.instanceOf(Operation.PersistentOperation, entity) ? entity.name : '';
|
|
37
|
-
return [typename, metaKey, uri, operationKey, name, getEntityId(entity)].some((value) => value.match(matcher));
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const getEntityId = (entity: Entity.Unknown): string => {
|
|
42
|
-
if (entity.id) {
|
|
43
|
-
return entity.id;
|
|
44
|
-
}
|
|
45
|
-
if (Type.isType(entity)) {
|
|
46
|
-
return Type.getURI(entity)?.toString() ?? Type.getTypename(entity) ?? 'unknown-type';
|
|
47
|
-
}
|
|
48
|
-
return Entity.getTypename(entity) ?? 'unknown';
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const getKind = (entity: Entity.Unknown): string => {
|
|
52
|
-
if (Type.isType(entity)) {
|
|
53
|
-
return 'type';
|
|
54
|
-
}
|
|
55
|
-
if (Obj.isObject(entity) && Obj.instanceOf(Operation.PersistentOperation, entity)) {
|
|
56
|
-
return 'operation';
|
|
57
|
-
}
|
|
58
|
-
return 'other';
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const getLabel = (entity: Entity.Unknown): string => {
|
|
62
|
-
if (Obj.isObject(entity) && Obj.instanceOf(Operation.PersistentOperation, entity)) {
|
|
63
|
-
return entity.name || Operation.getKey(entity) || getEntityId(entity);
|
|
64
|
-
}
|
|
65
|
-
if (Type.isType(entity)) {
|
|
66
|
-
return Type.getTypename(entity) ?? getEntityId(entity);
|
|
67
|
-
}
|
|
68
|
-
return getEntityId(entity);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const toDetailJson = (entity: Entity.Unknown): object => {
|
|
72
|
-
if (Type.isType(entity)) {
|
|
73
|
-
return {
|
|
74
|
-
id: getEntityId(entity),
|
|
75
|
-
typename: Type.getTypename(entity),
|
|
76
|
-
uri: Type.getURI(entity)?.toString(),
|
|
77
|
-
version: Type.getVersion(entity),
|
|
78
|
-
jsonSchema: entity.jsonSchema,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
if (Obj.isObject(entity)) {
|
|
82
|
-
return Obj.toJSON(entity);
|
|
83
|
-
}
|
|
84
|
-
return { id: getEntityId(entity), typename: Entity.getTypename(entity) };
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export const RegistryPanel = () => {
|
|
88
|
-
const client = useClient();
|
|
89
|
-
const [entities, setEntities] = useState<Entity.Unknown[]>([]);
|
|
90
|
-
const [filter, setFilter] = useState('');
|
|
91
|
-
const [selected, setSelected] = useState<Entity.Unknown>();
|
|
92
|
-
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
const registry = client.graph.registry;
|
|
95
|
-
const refresh = () => setEntities([...registry.list()]);
|
|
96
|
-
refresh();
|
|
97
|
-
return registry.changed.on(refresh);
|
|
98
|
-
}, [client]);
|
|
99
|
-
|
|
100
|
-
const properties = useMemo(
|
|
101
|
-
() => [
|
|
102
|
-
{ name: 'kind', format: Format.TypeFormat.String, size: 100 },
|
|
103
|
-
{ name: 'label', format: Format.TypeFormat.String },
|
|
104
|
-
{ name: 'id', format: Format.TypeFormat.String, size: 280 },
|
|
105
|
-
],
|
|
106
|
-
[],
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
const rows = useMemo((): RegistryRow[] => {
|
|
110
|
-
return entities
|
|
111
|
-
.filter(textFilter(filter))
|
|
112
|
-
.map((entity) => ({
|
|
113
|
-
id: getEntityId(entity),
|
|
114
|
-
kind: getKind(entity),
|
|
115
|
-
label: getLabel(entity),
|
|
116
|
-
_entity: entity,
|
|
117
|
-
}))
|
|
118
|
-
.toSorted((left, right) => left.label.localeCompare(right.label));
|
|
119
|
-
}, [entities, filter]);
|
|
120
|
-
|
|
121
|
-
const handleRowClicked = useCallback((row: RegistryRow | undefined) => {
|
|
122
|
-
if (!row?._entity) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
setSelected(row._entity);
|
|
126
|
-
}, []);
|
|
127
|
-
|
|
128
|
-
const detailJson = useMemo(() => (selected ? toDetailJson(selected) : undefined), [selected]);
|
|
129
|
-
|
|
130
|
-
const features: Partial<TableFeatures> = useMemo(() => ({ selection: { enabled: true, mode: 'single' } }), []);
|
|
131
|
-
|
|
132
|
-
return (
|
|
133
|
-
<PanelContainer
|
|
134
|
-
toolbar={
|
|
135
|
-
<Toolbar.Root>
|
|
136
|
-
<Searchbar placeholder='Filter...' onChange={setFilter} />
|
|
137
|
-
</Toolbar.Root>
|
|
138
|
-
}
|
|
139
|
-
>
|
|
140
|
-
<div className={mx('h-full grid grid-cols-[2fr_1fr] overflow-hidden')}>
|
|
141
|
-
<div className={mx('flex flex-col min-h-0 overflow-hidden')}>
|
|
142
|
-
<DynamicTable properties={properties} rows={rows} features={features} onRowClick={handleRowClicked} />
|
|
143
|
-
</div>
|
|
144
|
-
<div className={mx('min-h-0 h-full overflow-auto border-s border-separator text-sm')}>
|
|
145
|
-
{detailJson ? <JsonView data={detailJson} /> : <Placeholder label='Details' />}
|
|
146
|
-
</div>
|
|
147
|
-
</div>
|
|
148
|
-
</PanelContainer>
|
|
149
|
-
);
|
|
150
|
-
};
|
package/src/types/Devtools.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// @import-as-namespace
|
|
6
|
-
|
|
7
|
-
import { meta } from '#meta';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Extracts the last dot-separated segment of a Devtools namespaced ID string.
|
|
11
|
-
* Use this as the node segment `id` when building app-graph nodes whose `data`
|
|
12
|
-
* value is one of the other constants in this namespace.
|
|
13
|
-
*/
|
|
14
|
-
export const nodeId = (fullId: string): string => fullId.split('.').at(-1) ?? '';
|
|
15
|
-
|
|
16
|
-
const devtoolsId = `${meta.profile.key}.devtools`;
|
|
17
|
-
|
|
18
|
-
export const id = devtoolsId;
|
|
19
|
-
export const AppGraph = `${devtoolsId}.appGraph`;
|
|
20
|
-
export const Debug = `${devtoolsId}.debug`;
|
|
21
|
-
export const ToolsExplorer = `${devtoolsId}.toolsExplorer`;
|
|
22
|
-
|
|
23
|
-
export namespace Client {
|
|
24
|
-
export const id = `${devtoolsId}.client`;
|
|
25
|
-
export const Config = `${Client.id}.config`;
|
|
26
|
-
export const Storage = `${Client.id}.storage`;
|
|
27
|
-
export const Sqlite = `${Client.id}.sqlite`;
|
|
28
|
-
export const Logs = `${Client.id}.logs`;
|
|
29
|
-
export const Diagnostics = `${Client.id}.diagnostics`;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export namespace Halo {
|
|
33
|
-
export const id = `${devtoolsId}.halo`;
|
|
34
|
-
export const Identity = `${Halo.id}.identity`;
|
|
35
|
-
export const Devices = `${Halo.id}.devices`;
|
|
36
|
-
export const Keyring = `${Halo.id}.keyring`;
|
|
37
|
-
export const Credentials = `${Halo.id}.credentials`;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export namespace Echo {
|
|
41
|
-
export const id = `${devtoolsId}.echo`;
|
|
42
|
-
export const Spaces = `${Echo.id}.spaces`;
|
|
43
|
-
export const Space = `${Echo.id}.space`;
|
|
44
|
-
export const Feeds = `${Echo.id}.feeds`;
|
|
45
|
-
export const Objects = `${Echo.id}.objects`;
|
|
46
|
-
export const Schema = `${Echo.id}.schema`;
|
|
47
|
-
export const Registry = `${Echo.id}.registry`;
|
|
48
|
-
export const Automerge = `${Echo.id}.automerge`;
|
|
49
|
-
export const Queues = `${Echo.id}.queues`;
|
|
50
|
-
export const Members = `${Echo.id}.members`;
|
|
51
|
-
export const Metadata = `${Echo.id}.metadata`;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export namespace Mesh {
|
|
55
|
-
export const id = `${devtoolsId}.mesh`;
|
|
56
|
-
export const Signal = `${Mesh.id}.signal`;
|
|
57
|
-
export const Swarm = `${Mesh.id}.swarm`;
|
|
58
|
-
export const Network = `${Mesh.id}.network`;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export namespace Agent {
|
|
62
|
-
export const id = `${devtoolsId}.agent`;
|
|
63
|
-
export const Dashboard = `${Agent.id}.dashboard`;
|
|
64
|
-
export const Search = `${Agent.id}.search`;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export namespace Edge {
|
|
68
|
-
export const id = `${devtoolsId}.edge`;
|
|
69
|
-
export const Dashboard = `${Edge.id}.dashboard`;
|
|
70
|
-
export const Workflows = `${Edge.id}.workflows`;
|
|
71
|
-
export const Traces = `${Edge.id}.traces`;
|
|
72
|
-
export const Testing = `${Edge.id}.testing`;
|
|
73
|
-
}
|
package/src/types/surface.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Surface } from '@dxos/app-framework/ui';
|
|
6
|
-
|
|
7
|
-
/** Slot for the devtools-overview sub-surface inside the debug panel. */
|
|
8
|
-
export const DevtoolsOverview: Surface.RoleToken<Record<string, unknown>> = Surface.makeType(
|
|
9
|
-
'org.dxos.plugin.debug.role.devtoolsOverview',
|
|
10
|
-
);
|