@dxos/plugin-debug 0.8.4-main.2e9d522 → 0.8.4-main.3c1ae3b
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/{DevtoolsOverviewContainer-EPD6EWT5.mjs → DevtoolsOverviewContainer-JXVZVPHN.mjs} +2 -2
- package/dist/lib/browser/{DevtoolsOverviewContainer-EPD6EWT5.mjs.map → DevtoolsOverviewContainer-JXVZVPHN.mjs.map} +1 -1
- package/dist/lib/browser/{SpaceGenerator-AG3XGNMV.mjs → SpaceGenerator-GYCIEMMO.mjs} +274 -99
- package/dist/lib/browser/SpaceGenerator-GYCIEMMO.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-SQXFD2BL.mjs → app-graph-builder-CRH2HJKT.mjs} +77 -86
- package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs.map +7 -0
- package/dist/lib/browser/{chunk-AJA6RYN3.mjs → chunk-SRV2AIGJ.mjs} +2 -2
- package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-WZFZ4ESO.mjs +20 -0
- package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +13 -13
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-context-NVAGLAJD.mjs → react-context-P2YDWEWI.mjs} +6 -6
- package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-3GD2OWCA.mjs → react-surface-RFG63TTF.mjs} +104 -98
- package/dist/lib/browser/react-surface-RFG63TTF.mjs.map +7 -0
- package/dist/lib/browser/{settings-LSSWLM5I.mjs → settings-SQXR3OAH.mjs} +5 -5
- package/dist/lib/browser/{settings-LSSWLM5I.mjs.map → settings-SQXR3OAH.mjs.map} +1 -1
- package/dist/types/src/DebugPlugin.d.ts +1 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +5 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/components/DebugGraph.d.ts +8 -0
- package/dist/types/src/components/DebugGraph.d.ts.map +1 -0
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +4 -4
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +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 -4
- 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 +51 -4
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts +2 -2
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +68 -64
- package/src/DebugPlugin.tsx +6 -7
- package/src/capabilities/app-graph-builder.ts +68 -94
- package/src/capabilities/react-context.tsx +2 -2
- package/src/capabilities/react-surface.tsx +77 -56
- package/src/components/DebugGraph.tsx +14 -0
- package/src/components/DebugObjectPanel.tsx +2 -4
- package/src/components/DebugSettings.tsx +102 -73
- package/src/components/DebugStatus.tsx +2 -2
- package/src/components/DevtoolsOverviewContainer.tsx +1 -1
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +29 -36
- package/src/components/SpaceGenerator/SchemaTable.tsx +2 -2
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +11 -11
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +20 -16
- package/src/components/SpaceGenerator/draw-util.ts +5 -5
- package/src/components/SpaceGenerator/presets.ts +200 -21
- package/src/components/Wireframe.tsx +5 -5
- package/src/components/index.ts +1 -1
- package/src/meta.ts +6 -5
- package/src/translations.ts +3 -1
- package/src/types.ts +1 -1
- 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/chunk-5XPIRNQS.mjs +0 -18
- package/dist/lib/browser/chunk-5XPIRNQS.mjs.map +0 -7
- package/dist/lib/browser/chunk-AJA6RYN3.mjs.map +0 -7
- package/dist/lib/browser/react-context-NVAGLAJD.mjs.map +0 -7
- package/dist/lib/browser/react-surface-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
|
@@ -59,7 +59,7 @@ const _timer = (cb: (err?: Error) => void, options?: { min?: number; max?: numbe
|
|
|
59
59
|
// TODO(burdon): Integrate with Sentry?
|
|
60
60
|
const ErrorIndicator = () => {
|
|
61
61
|
const [, forceUpdate] = useState({});
|
|
62
|
-
const errorRef = useRef<Error>();
|
|
62
|
+
const errorRef = useRef<Error>(null);
|
|
63
63
|
useEffect(() => {
|
|
64
64
|
const errorListener = (event: any) => {
|
|
65
65
|
const error: Error = event.error ?? event.reason;
|
|
@@ -83,7 +83,7 @@ const ErrorIndicator = () => {
|
|
|
83
83
|
}, []);
|
|
84
84
|
|
|
85
85
|
const handleReset = () => {
|
|
86
|
-
errorRef.current =
|
|
86
|
+
errorRef.current = null;
|
|
87
87
|
forceUpdate({});
|
|
88
88
|
};
|
|
89
89
|
|
|
@@ -2,47 +2,47 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import type * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { type PromiseIntentDispatcher, createIntent } from '@dxos/app-framework';
|
|
6
8
|
import { addressToA1Notation } from '@dxos/compute';
|
|
7
9
|
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from '@dxos/conductor';
|
|
8
|
-
import { DXN, Filter, Key,
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { SheetType, type CellValue } from '@dxos/plugin-sheet/types';
|
|
13
|
-
import { CanvasType, DiagramType } from '@dxos/plugin-sketch/types';
|
|
10
|
+
import { DXN, Filter, Key, type Type } from '@dxos/echo';
|
|
11
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
12
|
+
import { Sheet } from '@dxos/plugin-sheet/types';
|
|
13
|
+
import { Diagram } 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 {
|
|
19
|
-
import {
|
|
18
|
+
import { View, getTypenameFromQuery } 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
|
-
|
|
25
|
-
|
|
26
|
-
const findViewByTypename = async (views: DataType.View[], typename: string) => {
|
|
27
|
-
return views.find((view) => view.query.typename === typename);
|
|
24
|
+
const findViewByTypename = async (views: View.View[], typename: string) => {
|
|
25
|
+
return views.find((view) => getTypenameFromQuery(view.query.ast) === typename);
|
|
28
26
|
};
|
|
29
27
|
|
|
30
|
-
export
|
|
28
|
+
export type ObjectGenerator<T> = (space: Space, n: number, cb?: (objects: T[]) => void) => Promise<T[]>;
|
|
29
|
+
|
|
30
|
+
export const createGenerator = <S extends Type.Obj.Any>(
|
|
31
31
|
client: Client,
|
|
32
32
|
dispatch: PromiseIntentDispatcher,
|
|
33
|
-
schema:
|
|
34
|
-
): ObjectGenerator<
|
|
35
|
-
return async (space: Space, n: number
|
|
33
|
+
schema: S,
|
|
34
|
+
): ObjectGenerator<Schema.Schema.Type<S>> => {
|
|
35
|
+
return async (space: Space, n: number): Promise<Schema.Schema.Type<S>[]> => {
|
|
36
36
|
const typename = schema.typename;
|
|
37
37
|
|
|
38
38
|
// Find or create table and view.
|
|
39
|
-
const
|
|
39
|
+
const views = await space.db.query(Filter.type(View.View)).run();
|
|
40
40
|
const view = await findViewByTypename(views, typename);
|
|
41
|
-
const staticSchema = client?.graph.schemaRegistry.
|
|
41
|
+
const staticSchema = client?.graph.schemaRegistry.query({ typename }).runSync()[0];
|
|
42
42
|
if (!view && !staticSchema) {
|
|
43
|
-
await dispatch(createIntent(SpaceAction.AddSchema, { space, schema }));
|
|
43
|
+
await dispatch(createIntent(SpaceAction.AddSchema, { space, schema, show: false }));
|
|
44
44
|
} else if (!view && staticSchema) {
|
|
45
|
-
await dispatch(createIntent(SpaceAction.UseStaticSchema, { space, typename }));
|
|
45
|
+
await dispatch(createIntent(SpaceAction.UseStaticSchema, { space, typename, show: false }));
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// Create objects.
|
|
@@ -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.make({
|
|
61
61
|
name: faker.commerce.productName(),
|
|
62
|
-
content:
|
|
62
|
+
content: faker.lorem.sentences(5),
|
|
63
63
|
}),
|
|
64
64
|
);
|
|
65
65
|
});
|
|
@@ -69,17 +69,10 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
69
69
|
},
|
|
70
70
|
],
|
|
71
71
|
[
|
|
72
|
-
|
|
72
|
+
Diagram.Diagram.typename,
|
|
73
73
|
async (space, n, cb) => {
|
|
74
74
|
const objects = range(n).map(() => {
|
|
75
|
-
|
|
76
|
-
const obj = space.db.add(
|
|
77
|
-
Obj.make(DiagramType, {
|
|
78
|
-
name: faker.commerce.productName(),
|
|
79
|
-
canvas: Ref.make(Obj.make(CanvasType, { content: {} })),
|
|
80
|
-
}),
|
|
81
|
-
);
|
|
82
|
-
|
|
75
|
+
const obj = space.db.add(Diagram.make({ name: faker.commerce.productName() }));
|
|
83
76
|
return obj;
|
|
84
77
|
});
|
|
85
78
|
|
|
@@ -89,10 +82,10 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
89
82
|
],
|
|
90
83
|
// TODO(burdon): Create unit tests.
|
|
91
84
|
[
|
|
92
|
-
|
|
85
|
+
Sheet.Sheet.typename,
|
|
93
86
|
async (space, n, cb) => {
|
|
94
87
|
const objects = range(n).map(() => {
|
|
95
|
-
const cells: Record<string, CellValue> = {};
|
|
88
|
+
const cells: Record<string, Sheet.CellValue> = {};
|
|
96
89
|
const year = new Date().getFullYear();
|
|
97
90
|
const cols = 4;
|
|
98
91
|
const rows = 16;
|
|
@@ -114,7 +107,7 @@ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
|
|
|
114
107
|
// TODO(burdon): Set width.
|
|
115
108
|
// TODO(burdon): Set formatting for columns.
|
|
116
109
|
return space.db.add(
|
|
117
|
-
|
|
110
|
+
Sheet.make({
|
|
118
111
|
name: faker.commerce.productName(),
|
|
119
112
|
cells,
|
|
120
113
|
}),
|
|
@@ -19,8 +19,8 @@ export const SchemaTable = ({ types, objects = {}, label, onClick }: SchemaTable
|
|
|
19
19
|
<h2 className='p-2'>{label}</h2>
|
|
20
20
|
{types.map((type) => (
|
|
21
21
|
<div key={type.typename} className='grid grid-cols-subgrid col-span-3 items-center'>
|
|
22
|
-
<div className='
|
|
23
|
-
<div className='
|
|
22
|
+
<div className='pli-2 text-sm font-mono text-subdued'>{type.typename}</div>
|
|
23
|
+
<div className='pli-2 text-right font-mono'>{objects[type.typename] ?? 0}</div>
|
|
24
24
|
<IconButton
|
|
25
25
|
variant='ghost'
|
|
26
26
|
icon='ph--plus--regular'
|
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React from 'react';
|
|
9
7
|
|
|
10
8
|
import { IntentPlugin } from '@dxos/app-framework';
|
|
11
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
10
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
13
11
|
import { useSpaces } from '@dxos/react-client/echo';
|
|
14
|
-
import {
|
|
12
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
13
|
+
import { render } from '@dxos/storybook-utils';
|
|
15
14
|
|
|
16
15
|
import { SpaceGenerator } from './SpaceGenerator';
|
|
17
16
|
|
|
@@ -24,29 +23,30 @@ const DefaultStory = () => {
|
|
|
24
23
|
return <SpaceGenerator space={space} />;
|
|
25
24
|
};
|
|
26
25
|
|
|
27
|
-
const meta
|
|
26
|
+
const meta = {
|
|
28
27
|
title: 'plugins/plugin-debug/SpaceGenerator',
|
|
29
|
-
component: SpaceGenerator,
|
|
28
|
+
component: SpaceGenerator as any,
|
|
30
29
|
render: render(DefaultStory),
|
|
31
30
|
decorators: [
|
|
31
|
+
withTheme,
|
|
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
|
}),
|
|
39
39
|
IntentPlugin(),
|
|
40
40
|
],
|
|
41
41
|
}),
|
|
42
|
-
withLayout(),
|
|
43
|
-
withTheme,
|
|
44
42
|
],
|
|
45
43
|
parameters: {
|
|
46
44
|
layout: 'fullscreen',
|
|
47
45
|
},
|
|
48
|
-
}
|
|
46
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
49
47
|
|
|
50
48
|
export default meta;
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
type Story = StoryObj<typeof meta>;
|
|
51
|
+
|
|
52
|
+
export const Default: Story = {};
|
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { useIntentDispatcher } from '@dxos/app-framework';
|
|
7
|
+
import { useIntentDispatcher } from '@dxos/app-framework/react';
|
|
8
8
|
import { ComputeGraph } from '@dxos/conductor';
|
|
9
|
-
import { Filter, type
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
9
|
+
import { Filter, Obj, type Type } from '@dxos/echo';
|
|
10
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
11
|
+
import { Sheet } from '@dxos/plugin-sheet/types';
|
|
12
|
+
import { Diagram } from '@dxos/plugin-sketch/types';
|
|
13
13
|
import { useClient } from '@dxos/react-client';
|
|
14
|
-
import {
|
|
14
|
+
import { type Space } 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
|
-
import {
|
|
17
|
+
import { Organization, Person, Task } from '@dxos/types';
|
|
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,17 +29,21 @@ 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 = [
|
|
32
|
+
const staticTypes = [Markdown.Document, Diagram.Diagram, Sheet.Sheet, ComputeGraph]; // TODO(burdon): Make extensible.
|
|
33
|
+
const recordTypes: Type.Obj.Any[] = [Organization.Organization, Person.Person, Task.Task];
|
|
34
34
|
const [count, setCount] = useState(1);
|
|
35
35
|
const [info, setInfo] = useState<any>({});
|
|
36
36
|
const presets = useMemo(() => generator(), []);
|
|
37
37
|
|
|
38
|
+
// Register types.
|
|
39
|
+
useAsyncEffect(async () => {
|
|
40
|
+
await client.addTypes([...staticTypes, ...recordTypes, ...presets.schemas]);
|
|
41
|
+
}, [client]);
|
|
42
|
+
|
|
38
43
|
// Create type generators.
|
|
39
44
|
const typeMap = useMemo(() => {
|
|
40
|
-
client.addTypes([...staticTypes, ...recordTypes, ...presets.schemas]);
|
|
41
45
|
const recordGenerators = new Map<string, ObjectGenerator<any>>(
|
|
42
|
-
recordTypes.map((type) => [type.typename, createGenerator(client, dispatch, type
|
|
46
|
+
recordTypes.map((type) => [type.typename, createGenerator(client, dispatch, type)]),
|
|
43
47
|
);
|
|
44
48
|
|
|
45
49
|
return new Map([...staticGenerators, ...presets.items, ...recordGenerators]);
|
|
@@ -52,10 +56,10 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
|
|
|
52
56
|
const staticSchema = space.db.graph.schemaRegistry.schemas;
|
|
53
57
|
|
|
54
58
|
// Create object map.
|
|
55
|
-
const
|
|
59
|
+
const objects = await space.db.query(Filter.everything()).run();
|
|
56
60
|
const objectMap = sortKeys(
|
|
57
61
|
objects.reduce<Record<string, number>>((map, obj) => {
|
|
58
|
-
const type = getTypename(obj);
|
|
62
|
+
const type = Obj.getTypename(obj);
|
|
59
63
|
if (type) {
|
|
60
64
|
const count = map[type] ?? 0;
|
|
61
65
|
map[type] = count + 1;
|
|
@@ -112,7 +116,7 @@ export const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps)
|
|
|
112
116
|
<SchemaTable types={presets.types} objects={info.objects} label='Presets' onClick={handleCreateData} />
|
|
113
117
|
|
|
114
118
|
<div>
|
|
115
|
-
<SyntaxHighlighter classNames='
|
|
119
|
+
<SyntaxHighlighter language='json' classNames='text-xs'>
|
|
116
120
|
{JSON.stringify({ space, ...info }, jsonKeyReplacer({ truncate: true }), 2)}
|
|
117
121
|
</SyntaxHighlighter>
|
|
118
122
|
</div>
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
// TODO(burdon): workerize-loader dep.
|
|
6
|
-
import {
|
|
6
|
+
import { type Edge, Graph, type PlainObject } from '@antv/graphlib';
|
|
7
7
|
import {
|
|
8
|
-
type Layout,
|
|
9
8
|
D3ForceLayout,
|
|
10
9
|
type D3ForceLayoutOptions,
|
|
11
10
|
GridLayout,
|
|
12
11
|
type GridLayoutOptions,
|
|
12
|
+
type Layout,
|
|
13
13
|
RadialLayout,
|
|
14
14
|
type RadialLayoutOptions,
|
|
15
15
|
} from '@antv/layout';
|
|
16
|
-
import {
|
|
16
|
+
import { type Editor, type SerializedStore, type TLRecord, createBindingId, createShapeId } from '@tldraw/tldraw';
|
|
17
17
|
|
|
18
18
|
import { faker } from '@dxos/random';
|
|
19
|
-
import {
|
|
19
|
+
import { isTruthy, range } from '@dxos/util';
|
|
20
20
|
|
|
21
21
|
// TODO(burdon): Graph layout:
|
|
22
22
|
// - https://www.npmjs.com/package/@antv/layout (uses d3)
|
|
@@ -67,7 +67,7 @@ export const generateGraph = (): Graph<PlainObject, PlainObject> => {
|
|
|
67
67
|
}
|
|
68
68
|
return target;
|
|
69
69
|
})
|
|
70
|
-
.filter(
|
|
70
|
+
.filter(isTruthy);
|
|
71
71
|
|
|
72
72
|
for (const target of targets) {
|
|
73
73
|
traverse(target);
|