@dxos/plugin-debug 0.8.4-main.c1de068 → 0.8.4-main.dedc0f3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +20 -0
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +7 -0
- package/dist/lib/browser/{SpaceGenerator-AG3XGNMV.mjs → SpaceGenerator-DANYBPYZ.mjs} +54 -59
- package/dist/lib/browser/SpaceGenerator-DANYBPYZ.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-SQXFD2BL.mjs → app-graph-builder-JTIEFOWZ.mjs} +22 -32
- package/dist/lib/browser/app-graph-builder-JTIEFOWZ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +7 -4
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-3GD2OWCA.mjs → react-surface-YLOWSIBU.mjs} +28 -23
- package/dist/lib/browser/react-surface-YLOWSIBU.mjs.map +7 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +5 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/components/DebugGraph.d.ts +8 -0
- package/dist/types/src/components/DebugGraph.d.ts.map +1 -0
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +13 -3
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.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 +2 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +56 -55
- package/src/DebugPlugin.tsx +1 -1
- package/src/capabilities/app-graph-builder.ts +13 -40
- package/src/capabilities/react-surface.tsx +7 -6
- package/src/components/DebugGraph.tsx +14 -0
- package/src/components/DebugObjectPanel.tsx +1 -1
- package/src/components/DebugSettings.tsx +72 -64
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +12 -12
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +8 -6
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +7 -7
- package/src/components/SpaceGenerator/draw-util.ts +3 -3
- package/src/components/SpaceGenerator/presets.ts +11 -11
- package/src/components/Wireframe.tsx +2 -1
- package/src/components/index.ts +1 -1
- package/src/translations.ts +2 -0
- package/dist/lib/browser/DebugApp-ZDL4CPY5.mjs +0 -228
- package/dist/lib/browser/DebugApp-ZDL4CPY5.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-AG3XGNMV.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-SQXFD2BL.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3GD2OWCA.mjs.map +0 -7
- package/dist/types/src/components/DebugApp/DebugApp.d.ts +0 -6
- package/dist/types/src/components/DebugApp/DebugApp.d.ts.map +0 -1
- package/dist/types/src/components/DebugApp/Tree.d.ts +0 -18
- package/dist/types/src/components/DebugApp/Tree.d.ts.map +0 -1
- package/dist/types/src/components/DebugApp/index.d.ts +0 -3
- package/dist/types/src/components/DebugApp/index.d.ts.map +0 -1
- package/src/components/DebugApp/DebugApp.tsx +0 -84
- package/src/components/DebugApp/Tree.tsx +0 -103
- package/src/components/DebugApp/index.ts +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-debug",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.dedc0f3",
|
|
4
4
|
"description": "DXOS Surface plugin for testing.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
13
14
|
"types": "./dist/types/src/index.d.ts",
|
|
14
15
|
"browser": "./dist/lib/browser/index.mjs"
|
|
15
16
|
}
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"@antv/graphlib": "^2.0.4",
|
|
27
28
|
"@antv/layout": "^1.2.13",
|
|
28
|
-
"@automerge/automerge": "3.
|
|
29
|
+
"@automerge/automerge": "3.1.1",
|
|
29
30
|
"@preact-signals/safe-react": "^0.9.0",
|
|
30
31
|
"@preact/signals-core": "^1.9.0",
|
|
31
32
|
"@tldraw/tldraw": "^3.0.0",
|
|
@@ -33,63 +34,63 @@
|
|
|
33
34
|
"react-json-tree": "^0.18.0",
|
|
34
35
|
"react-resize-detector": "^11.0.1",
|
|
35
36
|
"workerize-loader": "^2.0.2",
|
|
36
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/client-services": "0.8.4-main.
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/context": "0.8.4-main.
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/echo": "0.8.4-main.
|
|
45
|
-
"@dxos/echo-generator": "0.8.4-main.
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/keys": "0.8.4-main.
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/plugin-
|
|
56
|
-
"@dxos/plugin-
|
|
57
|
-
"@dxos/plugin-
|
|
58
|
-
"@dxos/plugin-meeting": "0.8.4-main.
|
|
59
|
-
"@dxos/plugin-
|
|
60
|
-
"@dxos/plugin-
|
|
61
|
-
"@dxos/plugin-
|
|
62
|
-
"@dxos/plugin-
|
|
63
|
-
"@dxos/plugin-
|
|
64
|
-
"@dxos/plugin-table": "0.8.4-main.
|
|
65
|
-
"@dxos/plugin-theme": "0.8.4-main.
|
|
66
|
-
"@dxos/protocols": "0.8.4-main.
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/react-
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/react-ui-
|
|
71
|
-
"@dxos/react-ui-
|
|
72
|
-
"@dxos/react-ui-
|
|
73
|
-
"@dxos/react-ui-
|
|
74
|
-
"@dxos/react-ui-
|
|
75
|
-
"@dxos/react-ui-
|
|
76
|
-
"@dxos/react-ui-table": "0.8.4-main.
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
79
|
-
"@dxos/
|
|
37
|
+
"@dxos/app-framework": "0.8.4-main.dedc0f3",
|
|
38
|
+
"@dxos/async": "0.8.4-main.dedc0f3",
|
|
39
|
+
"@dxos/client-services": "0.8.4-main.dedc0f3",
|
|
40
|
+
"@dxos/compute": "0.8.4-main.dedc0f3",
|
|
41
|
+
"@dxos/conductor": "0.8.4-main.dedc0f3",
|
|
42
|
+
"@dxos/context": "0.8.4-main.dedc0f3",
|
|
43
|
+
"@dxos/config": "0.8.4-main.dedc0f3",
|
|
44
|
+
"@dxos/devtools": "0.8.4-main.dedc0f3",
|
|
45
|
+
"@dxos/echo": "0.8.4-main.dedc0f3",
|
|
46
|
+
"@dxos/echo-generator": "0.8.4-main.dedc0f3",
|
|
47
|
+
"@dxos/functions": "0.8.4-main.dedc0f3",
|
|
48
|
+
"@dxos/invariant": "0.8.4-main.dedc0f3",
|
|
49
|
+
"@dxos/echo-schema": "0.8.4-main.dedc0f3",
|
|
50
|
+
"@dxos/keys": "0.8.4-main.dedc0f3",
|
|
51
|
+
"@dxos/live-object": "0.8.4-main.dedc0f3",
|
|
52
|
+
"@dxos/local-storage": "0.8.4-main.dedc0f3",
|
|
53
|
+
"@dxos/echo-pipeline": "0.8.4-main.dedc0f3",
|
|
54
|
+
"@dxos/log": "0.8.4-main.dedc0f3",
|
|
55
|
+
"@dxos/plugin-client": "0.8.4-main.dedc0f3",
|
|
56
|
+
"@dxos/plugin-graph": "0.8.4-main.dedc0f3",
|
|
57
|
+
"@dxos/plugin-markdown": "0.8.4-main.dedc0f3",
|
|
58
|
+
"@dxos/plugin-deck": "0.8.4-main.dedc0f3",
|
|
59
|
+
"@dxos/plugin-meeting": "0.8.4-main.dedc0f3",
|
|
60
|
+
"@dxos/plugin-sheet": "0.8.4-main.dedc0f3",
|
|
61
|
+
"@dxos/plugin-sketch": "0.8.4-main.dedc0f3",
|
|
62
|
+
"@dxos/plugin-space": "0.8.4-main.dedc0f3",
|
|
63
|
+
"@dxos/plugin-script": "0.8.4-main.dedc0f3",
|
|
64
|
+
"@dxos/plugin-status-bar": "0.8.4-main.dedc0f3",
|
|
65
|
+
"@dxos/plugin-table": "0.8.4-main.dedc0f3",
|
|
66
|
+
"@dxos/plugin-theme": "0.8.4-main.dedc0f3",
|
|
67
|
+
"@dxos/protocols": "0.8.4-main.dedc0f3",
|
|
68
|
+
"@dxos/react-hooks": "0.8.4-main.dedc0f3",
|
|
69
|
+
"@dxos/react-ui-attention": "0.8.4-main.dedc0f3",
|
|
70
|
+
"@dxos/random": "0.8.4-main.dedc0f3",
|
|
71
|
+
"@dxos/react-ui-canvas-compute": "0.8.4-main.dedc0f3",
|
|
72
|
+
"@dxos/react-ui-form": "0.8.4-main.dedc0f3",
|
|
73
|
+
"@dxos/react-ui-kanban": "0.8.4-main.dedc0f3",
|
|
74
|
+
"@dxos/react-ui-stack": "0.8.4-main.dedc0f3",
|
|
75
|
+
"@dxos/react-ui-canvas-editor": "0.8.4-main.dedc0f3",
|
|
76
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.dedc0f3",
|
|
77
|
+
"@dxos/react-ui-table": "0.8.4-main.dedc0f3",
|
|
78
|
+
"@dxos/react-client": "0.8.4-main.dedc0f3",
|
|
79
|
+
"@dxos/schema": "0.8.4-main.dedc0f3",
|
|
80
|
+
"@dxos/util": "0.8.4-main.dedc0f3"
|
|
80
81
|
},
|
|
81
82
|
"devDependencies": {
|
|
82
83
|
"@effect-rx/rx-react": "0.38.0",
|
|
83
|
-
"@effect/platform": "0.
|
|
84
|
+
"@effect/platform": "0.90.2",
|
|
84
85
|
"@types/react": "~18.2.0",
|
|
85
86
|
"@types/react-dom": "~18.2.0",
|
|
86
|
-
"effect": "3.17.
|
|
87
|
+
"effect": "3.17.7",
|
|
87
88
|
"react": "~18.2.0",
|
|
88
89
|
"react-dom": "~18.2.0",
|
|
89
|
-
"vite": "
|
|
90
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
91
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
92
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
90
|
+
"vite": "7.1.1",
|
|
91
|
+
"@dxos/react-ui": "0.8.4-main.dedc0f3",
|
|
92
|
+
"@dxos/react-ui-theme": "0.8.4-main.dedc0f3",
|
|
93
|
+
"@dxos/storybook-utils": "0.8.4-main.dedc0f3"
|
|
93
94
|
},
|
|
94
95
|
"peerDependencies": {
|
|
95
96
|
"@effect-rx/rx-react": "^0.34.1",
|
|
@@ -97,9 +98,9 @@
|
|
|
97
98
|
"effect": "^3.13.3",
|
|
98
99
|
"react": "~18.2.0",
|
|
99
100
|
"react-dom": "~18.2.0",
|
|
100
|
-
"@dxos/random": "0.8.4-main.
|
|
101
|
-
"@dxos/react-ui
|
|
102
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
101
|
+
"@dxos/random": "0.8.4-main.dedc0f3",
|
|
102
|
+
"@dxos/react-ui": "0.8.4-main.dedc0f3",
|
|
103
|
+
"@dxos/react-ui-theme": "0.8.4-main.dedc0f3"
|
|
103
104
|
},
|
|
104
105
|
"publishConfig": {
|
|
105
106
|
"access": "public"
|
package/src/DebugPlugin.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Capabilities, contributes, defineModule, definePlugin
|
|
5
|
+
import { Capabilities, Events, contributes, defineModule, definePlugin } from '@dxos/app-framework';
|
|
6
6
|
import { type Client } from '@dxos/react-client';
|
|
7
7
|
|
|
8
8
|
import { AppGraphBuilder, DebugSettings, ReactContext, ReactSurface } from './capabilities';
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
import { Rx } from '@effect-rx/rx-react';
|
|
6
6
|
import { Option, pipe } from 'effect';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Capabilities, type PluginContext, contributes } from '@dxos/app-framework';
|
|
9
9
|
import { Obj } from '@dxos/echo';
|
|
10
10
|
import { ATTENDABLE_PATH_SEPARATOR, DECK_COMPANION_TYPE, PLANK_COMPANION_TYPE } from '@dxos/plugin-deck/types';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { ROOT_ID, createExtension, rxFromSignal } from '@dxos/plugin-graph';
|
|
12
|
+
import { SPACE_PLUGIN, getActiveSpace } from '@dxos/plugin-space';
|
|
13
13
|
|
|
14
14
|
import { DEBUG_PLUGIN } from '../meta';
|
|
15
15
|
import { Devtools } from '../types';
|
|
@@ -30,6 +30,7 @@ export default (context: PluginContext) =>
|
|
|
30
30
|
),
|
|
31
31
|
Option.map((node) => {
|
|
32
32
|
const space = get(rxFromSignal(() => getActiveSpace(context)));
|
|
33
|
+
const [graph] = get(context.capabilities(Capabilities.AppGraph));
|
|
33
34
|
|
|
34
35
|
return [
|
|
35
36
|
{
|
|
@@ -56,6 +57,15 @@ export default (context: PluginContext) =>
|
|
|
56
57
|
},
|
|
57
58
|
]
|
|
58
59
|
: []),
|
|
60
|
+
{
|
|
61
|
+
id: `app-graph-${node.id}`,
|
|
62
|
+
type: 'dxos.org/plugin/debug/app-graph',
|
|
63
|
+
data: { graph: graph?.graph, root: space ? space.id : ROOT_ID },
|
|
64
|
+
properties: {
|
|
65
|
+
label: ['debug app graph label', { ns: DEBUG_PLUGIN }],
|
|
66
|
+
icon: 'ph--graph--regular',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
59
69
|
{
|
|
60
70
|
id: `${Devtools.Client.id}-${node.id}`,
|
|
61
71
|
data: null,
|
|
@@ -366,43 +376,6 @@ export default (context: PluginContext) =>
|
|
|
366
376
|
),
|
|
367
377
|
}),
|
|
368
378
|
|
|
369
|
-
// Debug node.
|
|
370
|
-
createExtension({
|
|
371
|
-
id: 'dxos.org/plugin/debug/debug',
|
|
372
|
-
connector: (node) =>
|
|
373
|
-
Rx.make((get) =>
|
|
374
|
-
pipe(
|
|
375
|
-
get(node),
|
|
376
|
-
Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),
|
|
377
|
-
Option.flatMap(() => {
|
|
378
|
-
const [graph] = get(context.capabilities(Capabilities.AppGraph));
|
|
379
|
-
return graph ? Option.some(graph) : Option.none();
|
|
380
|
-
}),
|
|
381
|
-
Option.flatMap((graph) => {
|
|
382
|
-
// TODO(wittjosiah): Plank is currently blank. Remove?
|
|
383
|
-
// const settings = context
|
|
384
|
-
// .requestCapabilities(Capabilities.SettingsStore)[0]
|
|
385
|
-
// ?.getStore<DebugSettingsProps>(DEBUG_PLUGIN)?.value;
|
|
386
|
-
// return !!settings?.debug && node.id === 'root';
|
|
387
|
-
return Option.none();
|
|
388
|
-
}),
|
|
389
|
-
Option.map((graph) => [
|
|
390
|
-
{
|
|
391
|
-
id: 'dxos.org/plugin/debug/debug',
|
|
392
|
-
type: 'dxos.org/plugin/debug/debug',
|
|
393
|
-
data: { graph },
|
|
394
|
-
properties: {
|
|
395
|
-
label: ['debug label', { ns: DEBUG_PLUGIN }],
|
|
396
|
-
disposition: 'navigation',
|
|
397
|
-
icon: 'ph--bug--regular',
|
|
398
|
-
},
|
|
399
|
-
},
|
|
400
|
-
]),
|
|
401
|
-
Option.getOrElse(() => []),
|
|
402
|
-
),
|
|
403
|
-
),
|
|
404
|
-
}),
|
|
405
|
-
|
|
406
379
|
// Debug object companion.
|
|
407
380
|
createExtension({
|
|
408
381
|
id: `${DEBUG_PLUGIN}/debug-object`,
|
|
@@ -7,14 +7,14 @@ import React, { useCallback } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
Capabilities,
|
|
10
|
+
LayoutAction,
|
|
11
|
+
type PluginContext,
|
|
10
12
|
chain,
|
|
11
13
|
contributes,
|
|
12
14
|
createIntent,
|
|
13
15
|
createSurface,
|
|
14
|
-
LayoutAction,
|
|
15
16
|
useCapability,
|
|
16
17
|
useIntentDispatcher,
|
|
17
|
-
type PluginContext,
|
|
18
18
|
} from '@dxos/app-framework';
|
|
19
19
|
import {
|
|
20
20
|
AutomergePanel,
|
|
@@ -50,12 +50,12 @@ import { ClientCapabilities } from '@dxos/plugin-client';
|
|
|
50
50
|
import { Graph } from '@dxos/plugin-graph';
|
|
51
51
|
import { ScriptAction } from '@dxos/plugin-script/types';
|
|
52
52
|
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
53
|
-
import { SpaceState, isSpace,
|
|
53
|
+
import { type Space, SpaceState, isSpace, parseId } from '@dxos/react-client/echo';
|
|
54
54
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
55
55
|
import { DataType } from '@dxos/schema';
|
|
56
56
|
|
|
57
57
|
import {
|
|
58
|
-
|
|
58
|
+
DebugGraph,
|
|
59
59
|
DebugObjectPanel,
|
|
60
60
|
DebugSettings,
|
|
61
61
|
DebugStatus,
|
|
@@ -73,10 +73,11 @@ type SpaceDebug = {
|
|
|
73
73
|
|
|
74
74
|
type GraphDebug = {
|
|
75
75
|
graph: Graph;
|
|
76
|
+
root: string;
|
|
76
77
|
};
|
|
77
78
|
|
|
78
79
|
const isSpaceDebug = (data: any): data is SpaceDebug => data?.type === `${DEBUG_PLUGIN}/space` && isSpace(data.space);
|
|
79
|
-
const isGraphDebug = (data: any): data is GraphDebug => data?.graph instanceof Graph;
|
|
80
|
+
const isGraphDebug = (data: any): data is GraphDebug => data?.graph instanceof Graph && typeof data?.root === 'string';
|
|
80
81
|
|
|
81
82
|
// TODO(wittjosiah): Factor out?
|
|
82
83
|
const useCurrentSpace = () => {
|
|
@@ -134,7 +135,7 @@ export default (context: PluginContext) =>
|
|
|
134
135
|
id: `${DEBUG_PLUGIN}/graph`,
|
|
135
136
|
role: 'article',
|
|
136
137
|
filter: (data): data is { subject: GraphDebug } => isGraphDebug(data.subject),
|
|
137
|
-
component: ({ data }) => <
|
|
138
|
+
component: ({ data }) => <DebugGraph graph={data.subject.graph} root={data.subject.root} />,
|
|
138
139
|
}),
|
|
139
140
|
createSurface({
|
|
140
141
|
id: `${DEBUG_PLUGIN}/wireframe`,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type FC } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Tree } from '@dxos/devtools';
|
|
8
|
+
import { type Graph } from '@dxos/plugin-graph';
|
|
9
|
+
|
|
10
|
+
export const DebugGraph: FC<{ graph: Graph; root: string }> = ({ graph, root }) => {
|
|
11
|
+
return <Tree data={graph.toJSON(root)} />;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default DebugGraph;
|
|
@@ -26,7 +26,7 @@ export const DebugObjectPanel = ({ object }: DebugObjectPanelProps) => {
|
|
|
26
26
|
<Clipboard.IconButton value={dxn} />
|
|
27
27
|
</Input.Root>
|
|
28
28
|
</Toolbar.Root>
|
|
29
|
-
<SyntaxHighlighter classNames='
|
|
29
|
+
<SyntaxHighlighter language='json' classNames='text-xs'>
|
|
30
30
|
{JSON.stringify(object, null, 2)}
|
|
31
31
|
</SyntaxHighlighter>
|
|
32
32
|
</StackItem.Content>
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
import React, { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
8
|
-
import { type ConfigProto,
|
|
8
|
+
import { type ConfigProto, SaveConfig, Storage, defs } from '@dxos/config';
|
|
9
9
|
import { log } from '@dxos/log';
|
|
10
10
|
import { useClient } from '@dxos/react-client';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { Button, Icon, Input, Select, Toast, useFileDownload, useTranslation } from '@dxos/react-ui';
|
|
12
|
+
import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from '@dxos/react-ui-form';
|
|
13
13
|
import { setDeep } from '@dxos/util';
|
|
14
14
|
|
|
15
15
|
import { DEBUG_PLUGIN } from '../meta';
|
|
@@ -77,67 +77,75 @@ export const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) =>
|
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
return (
|
|
80
|
-
<
|
|
81
|
-
<
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
80
|
+
<ControlPage>
|
|
81
|
+
<ControlSection title={t('settings title', { ns: DEBUG_PLUGIN })}>
|
|
82
|
+
<ControlGroup>
|
|
83
|
+
<ControlItemInput title={t('settings wireframe')}>
|
|
84
|
+
<Input.Switch
|
|
85
|
+
checked={settings.wireframe}
|
|
86
|
+
onCheckedChange={(checked) => (settings.wireframe = !!checked)}
|
|
87
|
+
/>
|
|
88
|
+
</ControlItemInput>
|
|
89
|
+
<ControlItemInput title={t('settings download diagnostics')}>
|
|
90
|
+
<Button onClick={handleDownload}>
|
|
91
|
+
<Icon icon='ph--download-simple--regular' size={5} />
|
|
92
|
+
</Button>
|
|
93
|
+
</ControlItemInput>
|
|
94
|
+
<ControlItemInput title={t('settings repair')}>
|
|
95
|
+
<Button onClick={handleRepair}>
|
|
96
|
+
<Icon icon='ph--first-aid-kit--regular' size={5} />
|
|
97
|
+
</Button>
|
|
98
|
+
</ControlItemInput>
|
|
99
|
+
|
|
100
|
+
{/* TODO(burdon): Move to layout? */}
|
|
101
|
+
{toast && (
|
|
102
|
+
<Toast.Root>
|
|
103
|
+
<Toast.Body>
|
|
104
|
+
<Toast.Title>
|
|
105
|
+
<Icon icon='ph--gift--duotone' size={5} classNames='inline mr-1' />
|
|
106
|
+
<span>{toast.title}</span>
|
|
107
|
+
</Toast.Title>
|
|
108
|
+
{toast.description && <Toast.Description>{toast.description}</Toast.Description>}
|
|
109
|
+
</Toast.Body>
|
|
110
|
+
</Toast.Root>
|
|
111
|
+
)}
|
|
112
|
+
|
|
113
|
+
<ControlItemInput title={t('settings choose storage adaptor')}>
|
|
114
|
+
<Select.Root
|
|
115
|
+
value={
|
|
116
|
+
Object.entries(StorageAdapters).find(
|
|
117
|
+
([name, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore,
|
|
118
|
+
)?.[0]
|
|
119
|
+
}
|
|
120
|
+
onValueChange={(value) => {
|
|
121
|
+
if (confirm(t('settings storage adapter changed alert'))) {
|
|
122
|
+
updateConfig(
|
|
123
|
+
storageConfig,
|
|
124
|
+
setStorageConfig,
|
|
125
|
+
['runtime', 'client', 'storage', 'dataStore'],
|
|
126
|
+
StorageAdapters[value as keyof typeof StorageAdapters],
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
}}
|
|
130
|
+
>
|
|
131
|
+
<Select.TriggerButton placeholder={t('settings data store label')} />
|
|
132
|
+
<Select.Portal>
|
|
133
|
+
<Select.Content>
|
|
134
|
+
<Select.Viewport>
|
|
135
|
+
{Object.keys(StorageAdapters).map((key) => (
|
|
136
|
+
<Select.Option key={key} value={key}>
|
|
137
|
+
{t(`settings storage adaptor ${key} label`)}
|
|
138
|
+
</Select.Option>
|
|
139
|
+
))}
|
|
140
|
+
</Select.Viewport>
|
|
141
|
+
<Select.Arrow />
|
|
142
|
+
</Select.Content>
|
|
143
|
+
</Select.Portal>
|
|
144
|
+
</Select.Root>
|
|
145
|
+
</ControlItemInput>
|
|
146
|
+
</ControlGroup>
|
|
147
|
+
</ControlSection>
|
|
148
|
+
</ControlPage>
|
|
141
149
|
);
|
|
142
150
|
};
|
|
143
151
|
|
|
@@ -2,37 +2,37 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type PromiseIntentDispatcher, createIntent } from '@dxos/app-framework';
|
|
6
6
|
import { addressToA1Notation } from '@dxos/compute';
|
|
7
7
|
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from '@dxos/conductor';
|
|
8
8
|
import { DXN, Filter, Key, Obj, Ref, Type } from '@dxos/echo';
|
|
9
9
|
import { type TypedObject } from '@dxos/echo-schema';
|
|
10
|
-
import {
|
|
10
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
11
11
|
import { createSheet } from '@dxos/plugin-sheet/types';
|
|
12
|
-
import {
|
|
12
|
+
import { type CellValue, SheetType } from '@dxos/plugin-sheet/types';
|
|
13
13
|
import { CanvasType, DiagramType } from '@dxos/plugin-sketch/types';
|
|
14
14
|
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
15
15
|
import { faker } from '@dxos/random';
|
|
16
16
|
import { type Client } from '@dxos/react-client';
|
|
17
17
|
import { type Space } from '@dxos/react-client/echo';
|
|
18
|
-
import { DataType } from '@dxos/schema';
|
|
19
|
-
import {
|
|
18
|
+
import { DataType, typenameFromQuery } from '@dxos/schema';
|
|
19
|
+
import { type ValueGenerator, createAsyncGenerator } from '@dxos/schema/testing';
|
|
20
20
|
import { range } from '@dxos/util';
|
|
21
21
|
|
|
22
22
|
const generator: ValueGenerator = faker as any;
|
|
23
23
|
|
|
24
|
-
export type ObjectGenerator<T extends Obj.Any> = (space: Space, n: number, cb?: (objects: T[]) => void) => Promise<T[]>;
|
|
25
|
-
|
|
26
24
|
const findViewByTypename = async (views: DataType.View[], typename: string) => {
|
|
27
|
-
return views.find((view) => view.query
|
|
25
|
+
return views.find((view) => typenameFromQuery(view.query) === typename);
|
|
28
26
|
};
|
|
29
27
|
|
|
28
|
+
export type ObjectGenerator<T extends Obj.Any> = (space: Space, n: number, cb?: (objects: T[]) => void) => Promise<T[]>;
|
|
29
|
+
|
|
30
30
|
export const createGenerator = <T extends Obj.Any>(
|
|
31
31
|
client: Client,
|
|
32
32
|
dispatch: PromiseIntentDispatcher,
|
|
33
33
|
schema: TypedObject<T>,
|
|
34
34
|
): ObjectGenerator<T> => {
|
|
35
|
-
return async (space: Space, n: number
|
|
35
|
+
return async (space: Space, n: number): Promise<T[]> => {
|
|
36
36
|
const typename = schema.typename;
|
|
37
37
|
|
|
38
38
|
// Find or create table and view.
|
|
@@ -53,13 +53,13 @@ export const createGenerator = <T extends Obj.Any>(
|
|
|
53
53
|
|
|
54
54
|
export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
55
55
|
[
|
|
56
|
-
|
|
56
|
+
Markdown.Document.typename,
|
|
57
57
|
async (space, n, cb) => {
|
|
58
58
|
const objects = range(n).map(() => {
|
|
59
59
|
return space.db.add(
|
|
60
|
-
|
|
60
|
+
Markdown.makeDocument({
|
|
61
61
|
name: faker.commerce.productName(),
|
|
62
|
-
content:
|
|
62
|
+
content: faker.lorem.sentences(5),
|
|
63
63
|
}),
|
|
64
64
|
);
|
|
65
65
|
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
10
|
import { IntentPlugin } from '@dxos/app-framework';
|
|
@@ -24,15 +24,15 @@ const DefaultStory = () => {
|
|
|
24
24
|
return <SpaceGenerator space={space} />;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
const meta
|
|
27
|
+
const meta = {
|
|
28
28
|
title: 'plugins/plugin-debug/SpaceGenerator',
|
|
29
|
-
component: SpaceGenerator,
|
|
29
|
+
component: SpaceGenerator as any,
|
|
30
30
|
render: render(DefaultStory),
|
|
31
31
|
decorators: [
|
|
32
32
|
withPluginManager({
|
|
33
33
|
plugins: [
|
|
34
34
|
ClientPlugin({
|
|
35
|
-
onClientInitialized: async (
|
|
35
|
+
onClientInitialized: async ({ client }) => {
|
|
36
36
|
await client.halo.createIdentity();
|
|
37
37
|
},
|
|
38
38
|
}),
|
|
@@ -45,8 +45,10 @@ const meta: Meta = {
|
|
|
45
45
|
parameters: {
|
|
46
46
|
layout: 'fullscreen',
|
|
47
47
|
},
|
|
48
|
-
}
|
|
48
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
49
49
|
|
|
50
50
|
export default meta;
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
type Story = StoryObj<typeof meta>;
|
|
53
|
+
|
|
54
|
+
export const Default: Story = {};
|
|
@@ -7,19 +7,19 @@ import React, { useCallback, useMemo, useState } from 'react';
|
|
|
7
7
|
import { useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { ComputeGraph } from '@dxos/conductor';
|
|
9
9
|
import { Filter, type Obj } from '@dxos/echo';
|
|
10
|
-
import {
|
|
10
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
11
11
|
import { SheetType } from '@dxos/plugin-sheet/types';
|
|
12
12
|
import { DiagramType } from '@dxos/plugin-sketch/types';
|
|
13
13
|
import { useClient } from '@dxos/react-client';
|
|
14
|
-
import {
|
|
14
|
+
import { type Space, getTypename } from '@dxos/react-client/echo';
|
|
15
15
|
import { IconButton, Input, Toolbar, useAsyncEffect } from '@dxos/react-ui';
|
|
16
16
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
17
17
|
import { DataType } from '@dxos/schema';
|
|
18
18
|
import { jsonKeyReplacer, sortKeys } from '@dxos/util';
|
|
19
19
|
|
|
20
|
-
import { createGenerator, staticGenerators
|
|
21
|
-
import { SchemaTable } from './SchemaTable';
|
|
20
|
+
import { type ObjectGenerator, createGenerator, staticGenerators } from './ObjectGenerator';
|
|
22
21
|
import { generator } from './presets';
|
|
22
|
+
import { SchemaTable } from './SchemaTable';
|
|
23
23
|
|
|
24
24
|
export type SpaceGeneratorProps = {
|
|
25
25
|
space: Space;
|
|
@@ -29,8 +29,8 @@ export type SpaceGeneratorProps = {
|
|
|
29
29
|
export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps) => {
|
|
30
30
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
31
31
|
const client = useClient();
|
|
32
|
-
const staticTypes = [
|
|
33
|
-
const recordTypes = [DataType.Organization, DataType.
|
|
32
|
+
const staticTypes = [Markdown.Document, DiagramType, SheetType, ComputeGraph]; // TODO(burdon): Make extensible.
|
|
33
|
+
const recordTypes = [DataType.Organization, DataType.Person, DataType.Task];
|
|
34
34
|
const [count, setCount] = useState(1);
|
|
35
35
|
const [info, setInfo] = useState<any>({});
|
|
36
36
|
const presets = useMemo(() => generator(), []);
|
|
@@ -112,7 +112,7 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
|
|
|
112
112
|
<SchemaTable types={presets.types} objects={info.objects} label='Presets' onClick={handleCreateData} />
|
|
113
113
|
|
|
114
114
|
<div>
|
|
115
|
-
<SyntaxHighlighter classNames='
|
|
115
|
+
<SyntaxHighlighter language='json' classNames='text-xs'>
|
|
116
116
|
{JSON.stringify({ space, ...info }, jsonKeyReplacer({ truncate: true }), 2)}
|
|
117
117
|
</SyntaxHighlighter>
|
|
118
118
|
</div>
|