@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
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
2
|
+
import { Position } from "@dxos/util";
|
|
3
|
+
import { useCallback, useMemo } from "react";
|
|
4
|
+
import { meta } from "#meta";
|
|
5
|
+
import { AppAnnotation, AppCapabilities, GraphPath, LayoutOperation } from "@dxos/app-toolkit";
|
|
6
|
+
import { Panel } from "@dxos/react-ui";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Annotation, Collection, Entity, Filter, Obj, Type } from "@dxos/echo";
|
|
9
|
+
import { SpaceCapabilities, SpaceOperation } from "@dxos/plugin-space";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import { DebugCapabilities, DebugNodes, DebugSurface } from "#types";
|
|
12
|
+
import { Logger } from "@dxos/react-ui-debug";
|
|
13
|
+
import { Surface, useAtomCapability, useOperationInvoker, useSettingsState } from "@dxos/app-framework/ui";
|
|
14
|
+
import { AppSurface, useActiveSpace } from "@dxos/app-toolkit/ui";
|
|
15
|
+
import { SpaceState, isSpace } from "@dxos/react-client/echo";
|
|
16
|
+
import { DebugObjectPanel, DebugSettings, DebugSpaceObjectsPanel, DebugStatus, LogStatus, SpaceGenerator, StatsPanel, Wireframe } from "#containers";
|
|
17
|
+
import { useAtomValue } from "@effect-atom/atom-react";
|
|
18
|
+
import * as Option from "effect/Option";
|
|
19
|
+
import { HiddenAnnotation } from "@dxos/echo/Annotation";
|
|
20
|
+
import { useClient } from "@dxos/react-client";
|
|
21
|
+
//#region src/capabilities/DebugSurfaces.tsx
|
|
22
|
+
/** Returns `onOpen` and `canOpen` for the ObjectsTree "Open" action. */
|
|
23
|
+
var useObjectOpenAction = (invokePromise) => {
|
|
24
|
+
const client = useClient();
|
|
25
|
+
const showHidden = useAtomCapability(SpaceCapabilities.Settings)?.showHidden ?? false;
|
|
26
|
+
const allTypes = useAtomValue(useMemo(() => client.graph.registry.query(Filter.type(Type.Type)).atom, [client]));
|
|
27
|
+
const hiddenTypenames = useMemo(() => {
|
|
28
|
+
const result = /* @__PURE__ */ new Set();
|
|
29
|
+
for (const typeEntity of allTypes) {
|
|
30
|
+
const schema = Type.getSchema(typeEntity);
|
|
31
|
+
if (HiddenAnnotation.get(schema).pipe(Option.getOrElse(() => false))) result.add(Type.getTypename(typeEntity));
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}, [allTypes]);
|
|
35
|
+
return {
|
|
36
|
+
onOpen: useCallback((object) => {
|
|
37
|
+
invokePromise(LayoutOperation.Open, { subject: [GraphPath.getObjectPathFromObject(object)] });
|
|
38
|
+
}, [invokePromise]),
|
|
39
|
+
canOpen: useCallback((entity) => {
|
|
40
|
+
if (showHidden) return true;
|
|
41
|
+
const typename = Entity.getTypename(entity);
|
|
42
|
+
return !hiddenTypenames.has(typename ?? "");
|
|
43
|
+
}, [showHidden, hiddenTypenames])
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
var DebugSettingsSurface = ({ subject, logStore, onUpload }) => {
|
|
47
|
+
const { settings, updateSettings } = useSettingsState(subject.atom);
|
|
48
|
+
return /* @__PURE__ */ jsx(DebugSettings, {
|
|
49
|
+
settings,
|
|
50
|
+
onSettingsChange: updateSettings,
|
|
51
|
+
logStore,
|
|
52
|
+
onUpload
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
/** Generated objects are added to the space's root collection, resolved at invocation time. */
|
|
56
|
+
var SpaceGeneratorSurface = ({ role, space }) => {
|
|
57
|
+
const { invokePromise } = useOperationInvoker();
|
|
58
|
+
return /* @__PURE__ */ jsx(SpaceGenerator, {
|
|
59
|
+
role,
|
|
60
|
+
space,
|
|
61
|
+
onCreateObjects: useCallback((objects) => {
|
|
62
|
+
const collection = space.state.get() === SpaceState.SPACE_READY && Annotation.get(space.properties, AppAnnotation.RootCollectionAnnotation).pipe(Option.getOrUndefined)?.target;
|
|
63
|
+
if (!Obj.instanceOf(Collection.Collection, collection)) return;
|
|
64
|
+
objects.forEach((object) => {
|
|
65
|
+
invokePromise(SpaceOperation.AddObject, {
|
|
66
|
+
target: collection,
|
|
67
|
+
object
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}, [space, invokePromise])
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
var ObjectDebugSurface = ({ role, companionTo }) => {
|
|
74
|
+
const { invokePromise } = useOperationInvoker();
|
|
75
|
+
const { onOpen, canOpen } = useObjectOpenAction(invokePromise);
|
|
76
|
+
return /* @__PURE__ */ jsx(DebugObjectPanel, {
|
|
77
|
+
role,
|
|
78
|
+
companionTo,
|
|
79
|
+
onOpen,
|
|
80
|
+
canOpen
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
var SpaceObjectsSurface = () => {
|
|
84
|
+
const space = useActiveSpace();
|
|
85
|
+
const { invokePromise } = useOperationInvoker();
|
|
86
|
+
const { onOpen, canOpen } = useObjectOpenAction(invokePromise);
|
|
87
|
+
if (!space) return null;
|
|
88
|
+
return /* @__PURE__ */ jsx(DebugSpaceObjectsPanel, {
|
|
89
|
+
space,
|
|
90
|
+
onOpen,
|
|
91
|
+
canOpen
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
var LoggerSurface = () => /* @__PURE__ */ jsx(Logger.Root, { children: /* @__PURE__ */ jsxs(Panel.Root, { children: [
|
|
95
|
+
/* @__PURE__ */ jsx(Panel.Toolbar, {
|
|
96
|
+
asChild: true,
|
|
97
|
+
children: /* @__PURE__ */ jsx(Logger.Toolbar, {})
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ jsx(Panel.Content, {
|
|
100
|
+
asChild: true,
|
|
101
|
+
children: /* @__PURE__ */ jsx(Logger.Content, { children: /* @__PURE__ */ jsx(Logger.List, {}) })
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ jsx(Panel.Statusbar, {
|
|
104
|
+
asChild: true,
|
|
105
|
+
children: /* @__PURE__ */ jsx(Logger.Filter, {})
|
|
106
|
+
})
|
|
107
|
+
] }) });
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/capabilities/react-surface.ts
|
|
110
|
+
var isSpaceDebug = (data) => typeof data === "object" && data !== null && "type" in data && data.type === DebugNodes.SpaceType && "space" in data && isSpace(data.space);
|
|
111
|
+
var react_surface_default = Capability.makeModule(Effect.fnUntraced(function* ({ logStore }) {
|
|
112
|
+
const capabilities = yield* Capability.Service;
|
|
113
|
+
const registry = capabilities.get(Capabilities.AtomRegistry);
|
|
114
|
+
const settingsAtom = capabilities.get(DebugCapabilities.Settings);
|
|
115
|
+
const fileUploader = capabilities.getAll(AppCapabilities.FileUploader)[0];
|
|
116
|
+
return Capability.contributes(Capabilities.ReactSurface, [
|
|
117
|
+
Surface.create({
|
|
118
|
+
id: "pluginSettings",
|
|
119
|
+
filter: AppSurface.settings(AppSurface.Article, meta.profile.key),
|
|
120
|
+
component: DebugSettingsSurface,
|
|
121
|
+
props: ({ data: { subject } }) => ({
|
|
122
|
+
subject,
|
|
123
|
+
logStore,
|
|
124
|
+
onUpload: fileUploader
|
|
125
|
+
})
|
|
126
|
+
}),
|
|
127
|
+
Surface.create({
|
|
128
|
+
id: "space",
|
|
129
|
+
filter: AppSurface.subject(AppSurface.Article, isSpaceDebug),
|
|
130
|
+
component: SpaceGeneratorSurface,
|
|
131
|
+
props: ({ role, data: { subject } }) => ({
|
|
132
|
+
role,
|
|
133
|
+
space: subject.space
|
|
134
|
+
})
|
|
135
|
+
}),
|
|
136
|
+
Surface.create({
|
|
137
|
+
id: "wireframe",
|
|
138
|
+
filter: AppSurface.oneOf(AppSurface.subject(AppSurface.Article, (value) => {
|
|
139
|
+
const settings = registry.get(settingsAtom);
|
|
140
|
+
return Obj.isObject(value) && !!settings.wireframe;
|
|
141
|
+
}), AppSurface.subject(AppSurface.Section, (value) => {
|
|
142
|
+
const settings = registry.get(settingsAtom);
|
|
143
|
+
return Obj.isObject(value) && !!settings.wireframe;
|
|
144
|
+
})),
|
|
145
|
+
position: Position.first,
|
|
146
|
+
component: Wireframe,
|
|
147
|
+
props: ({ role, name, data: { subject } }) => ({
|
|
148
|
+
label: `${role}:${name}`,
|
|
149
|
+
object: subject,
|
|
150
|
+
classNames: "row-span-2 overflow-hidden"
|
|
151
|
+
})
|
|
152
|
+
}),
|
|
153
|
+
Surface.create({
|
|
154
|
+
id: "objectDebug",
|
|
155
|
+
filter: AppSurface.allOf(AppSurface.literal(AppSurface.Article, "debug"), AppSurface.companion(AppSurface.Article)),
|
|
156
|
+
component: ObjectDebugSurface,
|
|
157
|
+
props: ({ role, data: { companionTo } }) => ({
|
|
158
|
+
role,
|
|
159
|
+
companionTo
|
|
160
|
+
})
|
|
161
|
+
}),
|
|
162
|
+
Surface.create({
|
|
163
|
+
id: "spaceObjects",
|
|
164
|
+
filter: Surface.makeFilter(AppSurface.deckCompanion("spaceObjects")),
|
|
165
|
+
component: SpaceObjectsSurface
|
|
166
|
+
}),
|
|
167
|
+
Surface.create({
|
|
168
|
+
id: "debugStatus",
|
|
169
|
+
filter: Surface.makeFilter(AppSurface.StatusIndicator),
|
|
170
|
+
position: Position.first,
|
|
171
|
+
component: DebugStatus
|
|
172
|
+
}),
|
|
173
|
+
Surface.create({
|
|
174
|
+
id: "logs",
|
|
175
|
+
filter: Surface.makeFilter(AppSurface.deckCompanion("logs")),
|
|
176
|
+
component: LoggerSurface
|
|
177
|
+
}),
|
|
178
|
+
Surface.create({
|
|
179
|
+
id: "logStatus",
|
|
180
|
+
filter: Surface.makeFilter(AppSurface.StatusIndicator),
|
|
181
|
+
component: LogStatus
|
|
182
|
+
}),
|
|
183
|
+
Surface.create({
|
|
184
|
+
id: "statsPanel",
|
|
185
|
+
filter: Surface.makeFilter(DebugSurface.Stats),
|
|
186
|
+
component: StatsPanel
|
|
187
|
+
})
|
|
188
|
+
]);
|
|
189
|
+
}));
|
|
190
|
+
//#endregion
|
|
191
|
+
export { react_surface_default as default };
|
|
192
|
+
|
|
193
|
+
//# sourceMappingURL=chunk-react-surface.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-react-surface.mjs","names":[],"sources":["../../src/capabilities/DebugSurfaces.tsx","../../src/capabilities/react-surface.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// Surface components that cannot be expressed as a `props` mapper, because they call hooks or compose.\n\nimport { useAtomValue } from '@effect-atom/atom-react';\nimport * as Option from 'effect/Option';\nimport React, { useCallback, useMemo } from 'react';\n\nimport { useAtomCapability, useOperationInvoker, useSettingsState } from '@dxos/app-framework/ui';\nimport { AppAnnotation, type AppCapabilities, GraphPath, LayoutOperation } from '@dxos/app-toolkit';\nimport { useActiveSpace } from '@dxos/app-toolkit/ui';\nimport { Annotation, Collection, Entity, Filter, Obj, Type } from '@dxos/echo';\nimport { HiddenAnnotation } from '@dxos/echo/Annotation';\nimport { type IdbLogStore } from '@dxos/log-store-idb';\nimport { SpaceCapabilities, SpaceOperation } from '@dxos/plugin-space';\nimport { useClient } from '@dxos/react-client';\nimport { type Space, SpaceState } from '@dxos/react-client/echo';\nimport { Panel } from '@dxos/react-ui';\nimport { Logger } from '@dxos/react-ui-debug';\n\nimport { DebugObjectPanel, DebugSettings, DebugSpaceObjectsPanel, SpaceGenerator } from '#containers';\nimport { type Settings } from '#types';\n\n/** Returns `onOpen` and `canOpen` for the ObjectsTree \"Open\" action. */\nconst useObjectOpenAction = (invokePromise: ReturnType<typeof useOperationInvoker>['invokePromise']) => {\n const client = useClient();\n const spaceSettings = useAtomCapability(SpaceCapabilities.Settings);\n const showHidden = spaceSettings?.showHidden ?? false;\n\n const allTypes = useAtomValue(useMemo(() => client.graph.registry.query(Filter.type(Type.Type)).atom, [client]));\n\n const hiddenTypenames = useMemo(() => {\n const result = new Set<string>();\n for (const typeEntity of allTypes) {\n const schema = Type.getSchema(typeEntity);\n if (HiddenAnnotation.get(schema).pipe(Option.getOrElse(() => false))) {\n result.add(Type.getTypename(typeEntity));\n }\n }\n return result;\n }, [allTypes]);\n\n const onOpen = useCallback(\n (object: Obj.Unknown) => {\n void invokePromise(LayoutOperation.Open, { subject: [GraphPath.getObjectPathFromObject(object)] });\n },\n [invokePromise],\n );\n\n const canOpen = useCallback(\n (entity: Entity.Snapshot) => {\n if (showHidden) {\n return true;\n }\n const typename = Entity.getTypename(entity);\n return !hiddenTypenames.has(typename ?? '');\n },\n [showHidden, hiddenTypenames],\n );\n\n return { onOpen, canOpen };\n};\n\nexport type DebugSettingsSurfaceProps = {\n subject: AppCapabilities.Settings;\n logStore?: IdbLogStore;\n onUpload?: AppCapabilities.FileUploader;\n};\n\nexport const DebugSettingsSurface = ({ subject, logStore, onUpload }: DebugSettingsSurfaceProps) => {\n const { settings, updateSettings } = useSettingsState<Settings.Settings>(subject.atom);\n\n return (\n <DebugSettings settings={settings} onSettingsChange={updateSettings} logStore={logStore} onUpload={onUpload} />\n );\n};\n\nexport type SpaceGeneratorSurfaceProps = {\n role: string;\n space: Space;\n};\n\n/** Generated objects are added to the space's root collection, resolved at invocation time. */\nexport const SpaceGeneratorSurface = ({ role, space }: SpaceGeneratorSurfaceProps) => {\n const { invokePromise } = useOperationInvoker();\n const handleCreateObjects = useCallback(\n (objects: Obj.Unknown[]) => {\n const collection =\n space.state.get() === SpaceState.SPACE_READY &&\n Annotation.get(space.properties, AppAnnotation.RootCollectionAnnotation).pipe(Option.getOrUndefined)?.target;\n if (!Obj.instanceOf(Collection.Collection, collection)) {\n return;\n }\n\n objects.forEach((object) => {\n void invokePromise(SpaceOperation.AddObject, { target: collection, object });\n });\n },\n [space, invokePromise],\n );\n\n return <SpaceGenerator role={role} space={space} onCreateObjects={handleCreateObjects} />;\n};\n\nexport type ObjectDebugSurfaceProps = {\n role: string;\n companionTo: Obj.Unknown;\n};\n\nexport const ObjectDebugSurface = ({ role, companionTo }: ObjectDebugSurfaceProps) => {\n const { invokePromise } = useOperationInvoker();\n const { onOpen, canOpen } = useObjectOpenAction(invokePromise);\n\n return <DebugObjectPanel role={role} companionTo={companionTo} onOpen={onOpen} canOpen={canOpen} />;\n};\n\nexport const SpaceObjectsSurface = () => {\n const space = useActiveSpace();\n const { invokePromise } = useOperationInvoker();\n const { onOpen, canOpen } = useObjectOpenAction(invokePromise);\n if (!space) {\n return null;\n }\n\n return <DebugSpaceObjectsPanel space={space} onOpen={onOpen} canOpen={canOpen} />;\n};\n\nexport const LoggerSurface = () => (\n <Logger.Root>\n <Panel.Root>\n <Panel.Toolbar asChild>\n <Logger.Toolbar />\n </Panel.Toolbar>\n <Panel.Content asChild>\n <Logger.Content>\n <Logger.List />\n </Logger.Content>\n </Panel.Content>\n <Panel.Statusbar asChild>\n <Logger.Filter />\n </Panel.Statusbar>\n </Panel.Root>\n </Logger.Root>\n);\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { Surface } from '@dxos/app-framework/ui';\nimport { AppCapabilities } from '@dxos/app-toolkit';\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { Obj } from '@dxos/echo';\nimport { type IdbLogStore } from '@dxos/log-store-idb';\nimport { type Space, isSpace } from '@dxos/react-client/echo';\nimport { Position } from '@dxos/util';\n\nimport { DebugStatus, LogStatus, StatsPanel, Wireframe } from '#containers';\nimport { meta } from '#meta';\nimport { DebugCapabilities, DebugNodes, DebugSurface } from '#types';\n\nimport {\n DebugSettingsSurface,\n LoggerSurface,\n ObjectDebugSurface,\n SpaceGeneratorSurface,\n SpaceObjectsSurface,\n} from './DebugSurfaces';\n\ntype SpaceDebug = {\n type: string;\n space: Space;\n};\n\nconst isSpaceDebug = (data: unknown): data is SpaceDebug =>\n typeof data === 'object' &&\n data !== null &&\n 'type' in data &&\n data.type === DebugNodes.SpaceType &&\n 'space' in data &&\n isSpace(data.space);\n\ntype ReactSurfaceOptions = {\n logStore?: IdbLogStore;\n};\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* ({ logStore }: ReactSurfaceOptions) {\n const capabilities = yield* Capability.Service;\n const registry = capabilities.get(Capabilities.AtomRegistry);\n const settingsAtom = capabilities.get(DebugCapabilities.Settings);\n const fileUploader = capabilities.getAll(AppCapabilities.FileUploader)[0];\n\n return Capability.contributes(Capabilities.ReactSurface, [\n Surface.create({\n id: 'pluginSettings',\n filter: AppSurface.settings(AppSurface.Article, meta.profile.key),\n component: DebugSettingsSurface,\n props: ({ data: { subject } }) => ({ subject, logStore, onUpload: fileUploader }),\n }),\n Surface.create({\n id: 'space',\n filter: AppSurface.subject(AppSurface.Article, isSpaceDebug),\n component: SpaceGeneratorSurface,\n props: ({ role, data: { subject } }) => ({ role, space: subject.space }),\n }),\n Surface.create({\n id: 'wireframe',\n // TODO(wittjosiah): Split into multiple surfaces if this filter proves too strict for non-article roles.\n filter: AppSurface.oneOf(\n AppSurface.subject(AppSurface.Article, (value): value is Obj.Unknown => {\n const settings = registry.get(settingsAtom);\n return Obj.isObject(value) && !!settings.wireframe;\n }),\n AppSurface.subject(AppSurface.Section, (value): value is Obj.Unknown => {\n const settings = registry.get(settingsAtom);\n return Obj.isObject(value) && !!settings.wireframe;\n }),\n ),\n position: Position.first,\n component: Wireframe,\n props: ({ role, name, data: { subject } }) => ({\n label: `${role}:${name}`,\n object: subject,\n classNames: 'row-span-2 overflow-hidden',\n }),\n }),\n Surface.create({\n id: 'objectDebug',\n filter: AppSurface.allOf(\n AppSurface.literal(AppSurface.Article, 'debug'),\n AppSurface.companion(AppSurface.Article),\n ),\n component: ObjectDebugSurface,\n props: ({ role, data: { companionTo } }) => ({ role, companionTo }),\n }),\n Surface.create({\n id: 'spaceObjects',\n filter: Surface.makeFilter(AppSurface.deckCompanion('spaceObjects')),\n component: SpaceObjectsSurface,\n }),\n Surface.create({\n id: 'debugStatus',\n filter: Surface.makeFilter(AppSurface.StatusIndicator),\n position: Position.first,\n component: DebugStatus,\n }),\n Surface.create({\n id: 'logs',\n filter: Surface.makeFilter(AppSurface.deckCompanion('logs')),\n component: LoggerSurface,\n }),\n Surface.create({\n id: 'logStatus',\n filter: Surface.makeFilter(AppSurface.StatusIndicator),\n component: LogStatus,\n }),\n Surface.create({\n id: 'statsPanel',\n filter: Surface.makeFilter(DebugSurface.Stats),\n component: StatsPanel,\n }),\n ]);\n }),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAM,uBAAuB,kBAA2E;CACtG,MAAM,SAAS,UAAU;CAEzB,MAAM,aADgB,kBAAkB,kBAAkB,QACvC,CAAA,EAAe,cAAc;CAEhD,MAAM,WAAW,aAAa,cAAc,OAAO,MAAM,SAAS,MAAM,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;CAE/G,MAAM,kBAAkB,cAAc;EACpC,MAAM,yBAAS,IAAI,IAAY;EAC/B,KAAK,MAAM,cAAc,UAAU;GACjC,MAAM,SAAS,KAAK,UAAU,UAAU;GACxC,IAAI,iBAAiB,IAAI,MAAM,CAAC,CAAC,KAAK,OAAO,gBAAgB,KAAK,CAAC,GACjE,OAAO,IAAI,KAAK,YAAY,UAAU,CAAC;EAE3C;EACA,OAAO;CACT,GAAG,CAAC,QAAQ,CAAC;CAoBb,OAAO;EAAE,QAlBM,aACZ,WAAwB;GACvB,cAAmB,gBAAgB,MAAM,EAAE,SAAS,CAAC,UAAU,wBAAwB,MAAM,CAAC,EAAE,CAAC;EACnG,GACA,CAAC,aAAa,CAcP;EAAQ,SAXD,aACb,WAA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+
import { meta } from "#meta";
|
|
3
|
+
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import { DebugCapabilities, Settings } from "#types";
|
|
6
|
+
import { createKvsStore } from "@dxos/effect";
|
|
7
|
+
//#region src/capabilities/settings.ts
|
|
8
|
+
var settings_default = Capability.makeModule(() => Effect.sync(() => {
|
|
9
|
+
const settingsAtom = createKvsStore({
|
|
10
|
+
key: meta.profile.key,
|
|
11
|
+
schema: Settings.Settings,
|
|
12
|
+
defaultValue: () => ({})
|
|
13
|
+
});
|
|
14
|
+
return [Capability.contributes(DebugCapabilities.Settings, settingsAtom), Capability.contributes(AppCapabilities.Settings, {
|
|
15
|
+
prefix: meta.profile.key,
|
|
16
|
+
schema: Settings.Settings,
|
|
17
|
+
atom: settingsAtom
|
|
18
|
+
})];
|
|
19
|
+
}));
|
|
20
|
+
//#endregion
|
|
21
|
+
export { settings_default as default };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=chunk-settings.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-settings.mjs","names":[],"sources":["../../src/capabilities/settings.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\nimport { createKvsStore } from '@dxos/effect';\n\nimport { meta } from '#meta';\nimport { DebugCapabilities, Settings } from '#types';\n\nexport default Capability.makeModule(() =>\n Effect.sync(() => {\n const settingsAtom = createKvsStore({\n key: meta.profile.key,\n schema: Settings.Settings,\n defaultValue: () => ({}),\n });\n\n return [\n Capability.contributes(DebugCapabilities.Settings, settingsAtom),\n Capability.contributes(AppCapabilities.Settings, {\n prefix: meta.profile.key,\n schema: Settings.Settings,\n atom: settingsAtom,\n }),\n ];\n }),\n);\n"],"mappings":";;;;;;;AAaA,IAAA,mBAAe,WAAW,iBACxB,OAAO,WAAW;CAChB,MAAM,eAAe,eAAe;EAClC,KAAK,KAAK,QAAQ;EAClB,QAAQ,SAAS;EACjB,qBAAqB,CAAC;CACxB,CAAC;CAED,OAAO,CACL,WAAW,YAAY,kBAAkB,UAAU,YAAY,GAC/D,WAAW,YAAY,gBAAgB,UAAU;EAC/C,QAAQ,KAAK,QAAQ;EACrB,QAAQ,SAAS;EACjB,MAAM;CACR,CAAC,CACH;AACF,CAAC,CACH"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
2
|
+
import { meta } from "#meta";
|
|
3
|
+
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import { Atom } from "@effect-atom/atom";
|
|
6
|
+
//#region src/capabilities/stats-panel.ts
|
|
7
|
+
var STORAGE_KEY = `${meta.profile.key}.statsPanel`;
|
|
8
|
+
/**
|
|
9
|
+
* Contributes the {@link AppCapabilities.StatsPanel} store: a single reactive atom holding one
|
|
10
|
+
* compartment per plugin, keyed by plugin key. Read access spans the whole store; writes are scoped
|
|
11
|
+
* to a compartment via `compartment(pluginKey)`. Kept alive with `Atom.keepAlive` so a background
|
|
12
|
+
* writer (e.g. a sync operation) can populate it before any surface subscribes. When `persist` is set
|
|
13
|
+
* the store hydrates from and saves to localStorage so stats survive a reload.
|
|
14
|
+
*/
|
|
15
|
+
var stats_panel_default = Capability.makeModule(Effect.fnUntraced(function* ({ persist = true } = {}) {
|
|
16
|
+
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
17
|
+
const canPersist = persist && typeof localStorage !== "undefined";
|
|
18
|
+
const hydrate = () => {
|
|
19
|
+
if (!canPersist) return {};
|
|
20
|
+
try {
|
|
21
|
+
const raw = localStorage.getItem(STORAGE_KEY);
|
|
22
|
+
return raw ? JSON.parse(raw) : {};
|
|
23
|
+
} catch {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const statsAtom = Atom.make(hydrate()).pipe(Atom.keepAlive);
|
|
28
|
+
const save = () => {
|
|
29
|
+
if (!canPersist) return;
|
|
30
|
+
try {
|
|
31
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(registry.get(statsAtom)));
|
|
32
|
+
} catch {}
|
|
33
|
+
};
|
|
34
|
+
return Capability.contributes(AppCapabilities.StatsPanel, {
|
|
35
|
+
statsAtom,
|
|
36
|
+
get: (pluginKey) => registry.get(statsAtom)[pluginKey],
|
|
37
|
+
compartment: (pluginKey) => ({
|
|
38
|
+
set: (stats) => {
|
|
39
|
+
registry.set(statsAtom, {
|
|
40
|
+
...registry.get(statsAtom),
|
|
41
|
+
[pluginKey]: stats
|
|
42
|
+
});
|
|
43
|
+
save();
|
|
44
|
+
},
|
|
45
|
+
clear: () => {
|
|
46
|
+
const { [pluginKey]: _removed, ...rest } = registry.get(statsAtom);
|
|
47
|
+
registry.set(statsAtom, rest);
|
|
48
|
+
save();
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
}));
|
|
53
|
+
//#endregion
|
|
54
|
+
export { stats_panel_default as default };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=chunk-stats-panel.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-stats-panel.mjs","names":[],"sources":["../../src/capabilities/stats-panel.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom';\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\n\nimport { meta } from '#meta';\n\ntype StatsPanelOptions = {\n /** Persist the store to localStorage (hydrate on load, save on write). */\n persist?: boolean;\n};\n\nconst STORAGE_KEY = `${meta.profile.key}.statsPanel`;\n\n/**\n * Contributes the {@link AppCapabilities.StatsPanel} store: a single reactive atom holding one\n * compartment per plugin, keyed by plugin key. Read access spans the whole store; writes are scoped\n * to a compartment via `compartment(pluginKey)`. Kept alive with `Atom.keepAlive` so a background\n * writer (e.g. a sync operation) can populate it before any surface subscribes. When `persist` is set\n * the store hydrates from and saves to localStorage so stats survive a reload.\n */\nexport default Capability.makeModule(\n Effect.fnUntraced(function* ({ persist = true }: StatsPanelOptions = {}) {\n const registry = yield* Capability.get(Capabilities.AtomRegistry);\n const canPersist = persist && typeof localStorage !== 'undefined';\n\n const hydrate = (): Record<string, unknown> => {\n if (!canPersist) {\n return {};\n }\n try {\n const raw = localStorage.getItem(STORAGE_KEY);\n return raw ? JSON.parse(raw) : {};\n } catch {\n // Best-effort: a malformed/unavailable value just starts empty.\n return {};\n }\n };\n\n const statsAtom = Atom.make<Record<string, unknown>>(hydrate()).pipe(Atom.keepAlive);\n\n const save = () => {\n if (!canPersist) {\n return;\n }\n try {\n localStorage.setItem(STORAGE_KEY, JSON.stringify(registry.get(statsAtom)));\n } catch {\n // Best-effort: localStorage may be disabled or over quota; the in-memory atom is authoritative.\n }\n };\n\n return Capability.contributes(AppCapabilities.StatsPanel, {\n statsAtom,\n get: (pluginKey) => registry.get(statsAtom)[pluginKey],\n compartment: (pluginKey) => ({\n set: (stats) => {\n registry.set(statsAtom, { ...registry.get(statsAtom), [pluginKey]: stats });\n save();\n },\n clear: () => {\n const { [pluginKey]: _removed, ...rest } = registry.get(statsAtom);\n registry.set(statsAtom, rest);\n save();\n },\n }),\n });\n }),\n);\n"],"mappings":";;;;;;AAiBA,IAAM,cAAc,GAAG,KAAK,QAAQ,IAAI;;;;;;;;AASxC,IAAA,sBAAe,WAAW,WACxB,OAAO,WAAW,WAAW,EAAE,UAAU,SAA4B,CAAC,GAAG;CACvE,MAAM,WAAW,OAAO,WAAW,IAAI,aAAa,YAAY;CAChE,MAAM,aAAa,WAAW,OAAO,iBAAiB;CAEtD,MAAM,gBAAyC;EAC7C,IAAI,CAAC,YACH,OAAO,CAAC;EAEV,IAAI;GACF,MAAM,MAAM,aAAa,QAAQ,WAAW;GAC5C,OAAO,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;EAClC,QAAQ;GAEN,OAAO,CAAC;EACV;CACF;CAEA,MAAM,YAAY,KAAK,KAA8B,QAAQ,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS;CAEnF,MAAM,aAAa;EACjB,IAAI,CAAC,YACH;EAEF,IAAI;GACF,aAAa,QAAQ,aAAa,KAAK,UAAU,SAAS,IAAI,SAAS,CAAC,CAAC;EAC3E,QAAQ,CAER;CACF;CAEA,OAAO,WAAW,YAAY,gBAAgB,YAAY;EACxD;EACA,MAAM,cAAc,SAAS,IAAI,SAAS,CAAC,CAAC;EAC5C,cAAc,eAAe;GAC3B,MAAM,UAAU;IACd,SAAS,IAAI,WAAW;KAAE,GAAG,SAAS,IAAI,SAAS;MAAI,YAAY;IAAM,CAAC;IAC1E,KAAK;GACP;GACA,aAAa;IACX,MAAM,GAAG,YAAY,UAAU,GAAG,SAAS,SAAS,IAAI,SAAS;IACjE,SAAS,IAAI,WAAW,IAAI;IAC5B,KAAK;GACP;EACF;CACF,CAAC;AACH,CAAC,CACH"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Capability, Role } from "@dxos/app-framework";
|
|
2
|
+
import { createContext } from "react";
|
|
3
|
+
import { meta } from "#meta";
|
|
4
|
+
import * as Schema from "effect/Schema";
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __exportAll = (all, no_symbols) => {
|
|
8
|
+
let target = {};
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/types/debug.ts
|
|
18
|
+
var DebugContext = createContext({
|
|
19
|
+
running: false,
|
|
20
|
+
start: () => {},
|
|
21
|
+
stop: () => {}
|
|
22
|
+
});
|
|
23
|
+
var DebugCapabilities;
|
|
24
|
+
(function(_DebugCapabilities) {
|
|
25
|
+
_DebugCapabilities.Settings = Capability.make(`${meta.profile.key}.capability.settings`);
|
|
26
|
+
})(DebugCapabilities || (DebugCapabilities = {}));
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/types/DebugNodes.ts
|
|
29
|
+
var DebugNodes_exports = /* @__PURE__ */ __exportAll({
|
|
30
|
+
SpaceType: () => SpaceType,
|
|
31
|
+
id: () => id,
|
|
32
|
+
nodeId: () => nodeId
|
|
33
|
+
});
|
|
34
|
+
/** Extracts the last dot-separated segment of a namespaced ID string for use as a node segment id. */
|
|
35
|
+
var nodeId = (fullId) => fullId.split(".").at(-1) ?? "";
|
|
36
|
+
var debugId = meta.profile.key;
|
|
37
|
+
/** Top-level Debug node (sibling of DevTools under the SYSTEM navtree group). */
|
|
38
|
+
var id = `${debugId}.debug`;
|
|
39
|
+
/** Discriminator for the space-generator article surface (`node.data.type`). */
|
|
40
|
+
var SpaceType = `${debugId}.space`;
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/types/DebugSurface.ts
|
|
43
|
+
var DebugSurface_exports = /* @__PURE__ */ __exportAll({ Stats: () => Stats });
|
|
44
|
+
/**
|
|
45
|
+
* Role token for the transient-stats panel — renders the {@link AppCapabilities.StatsPanel} store
|
|
46
|
+
* (arbitrary reactive telemetry keyed by owner id). A layout targets this role (role-only dispatch);
|
|
47
|
+
* the surface reads the store directly, so it needs no subject.
|
|
48
|
+
*/
|
|
49
|
+
var Stats = Role.make(`${meta.profile.key}.surface.stats`);
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/types/Settings.ts
|
|
52
|
+
var Settings_exports = /* @__PURE__ */ __exportAll({ Settings: () => Settings });
|
|
53
|
+
var Settings = Schema.mutable(Schema.Struct({
|
|
54
|
+
wireframe: Schema.optional(Schema.Boolean),
|
|
55
|
+
traceAll: Schema.optional(Schema.Boolean)
|
|
56
|
+
}));
|
|
57
|
+
//#endregion
|
|
58
|
+
export { DebugContext as a, DebugCapabilities as i, DebugSurface_exports as n, DebugNodes_exports as r, Settings_exports as t };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=chunk-types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-types.mjs","names":[],"sources":["../../src/types/debug.ts","../../src/types/DebugNodes.ts","../../src/types/DebugSurface.ts","../../src/types/Settings.ts"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Atom } from '@effect-atom/atom';\nimport { type Context, createContext } from 'react';\n\nimport { Capability } from '@dxos/app-framework';\nimport type { TimerCallback, TimerOptions } from '@dxos/async';\nimport { type IdbLogStore } from '@dxos/log-store-idb';\n\nimport { meta } from '#meta';\n\nimport * as Settings from './Settings';\n\nexport type DebugPluginOptions = {\n /** Shared persistent log store for capturing and downloading logs. */\n logStore?: IdbLogStore;\n /** Persist the stats-panel store to localStorage so it survives a reload. Defaults to `true`. */\n persistStats?: boolean;\n};\n\nexport type DebugContextType = {\n running: boolean;\n start: (cb: TimerCallback, options: TimerOptions) => void;\n stop: () => void;\n};\n\nexport const DebugContext: Context<DebugContextType> = createContext<DebugContextType>({\n running: false,\n start: () => {},\n stop: () => {},\n});\n\nexport namespace DebugCapabilities {\n export const Settings = Capability.make<Atom.Writable<Settings.Settings>>(`${meta.profile.key}.capability.settings`);\n}\n","//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport { meta } from '#meta';\n\n/** Extracts the last dot-separated segment of a namespaced ID string for use as a node segment id. */\nexport const nodeId = (fullId: string): string => fullId.split('.').at(-1) ?? '';\n\nconst debugId = meta.profile.key;\n\n/** Top-level Debug node (sibling of DevTools under the SYSTEM navtree group). */\nexport const id = `${debugId}.debug`;\n\n/** Discriminator for the space-generator article surface (`node.data.type`). */\nexport const SpaceType = `${debugId}.space`;\n","//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport { Role } from '@dxos/app-framework';\n\nimport { meta } from '#meta';\n\n/**\n * Role token for the transient-stats panel — renders the {@link AppCapabilities.StatsPanel} store\n * (arbitrary reactive telemetry keyed by owner id). A layout targets this role (role-only dispatch);\n * the surface reads the store directly, so it needs no subject.\n */\nexport const Stats = Role.make<Record<string, unknown>>(`${meta.profile.key}.surface.stats`);\n","//\n// Copyright 2023 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nexport const Settings = Schema.mutable(\n Schema.Struct({\n wireframe: Schema.optional(Schema.Boolean),\n traceAll: Schema.optional(Schema.Boolean),\n }),\n);\n\nexport interface Settings extends Schema.Schema.Type<typeof Settings> {}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,IAAa,eAA0C,cAAgC;CACrF,SAAS;CACT,aAAa,CAAC;CACd,YAAY,CAAC;AACf,CAAC;AAEM,IAAA;;CACQ,mBAAA,WAAW,WAAW,KAAuC,GAAG,KAAK,QAAQ,IAAI,qBAAqB;GACrH,sBAAA,oBAAA,CAAA,EAAA;;;;;;;;;AC3BA,IAAa,UAAU,WAA2B,OAAO,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK;AAE9E,IAAM,UAAU,KAAK,QAAQ;;AAG7B,IAAa,KAAK,GAAG,QAAQ;;AAG7B,IAAa,YAAY,GAAG,QAAQ;;;;;;;;;ACFpC,IAAa,QAAQ,KAAK,KAA8B,GAAG,KAAK,QAAQ,IAAI,eAAe;;;;ACP3F,IAAa,WAAW,OAAO,QAC7B,OAAO,OAAO;CACZ,WAAW,OAAO,SAAS,OAAO,OAAO;CACzC,UAAU,OAAO,SAAS,OAAO,OAAO;AAC1C,CAAC,CACH"}
|