@dxos/plugin-debug 0.8.4-main.3c1ae3b → 0.8.4-main.3eb6e50203
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-6VMEOKEV.mjs +15 -0
- package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs.map +7 -0
- package/dist/lib/browser/DevtoolsOverviewContainer-2C6XMJ3L.mjs +19 -0
- package/dist/lib/browser/DevtoolsOverviewContainer-2C6XMJ3L.mjs.map +7 -0
- package/dist/lib/browser/{SpaceGenerator-GYCIEMMO.mjs → SpaceGenerator-W3LJORYT.mjs} +167 -173
- package/dist/lib/browser/SpaceGenerator-W3LJORYT.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-DEBTVBQG.mjs +599 -0
- package/dist/lib/browser/app-graph-builder-DEBTVBQG.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SRV2AIGJ.mjs → chunk-4UFQXPP7.mjs} +11 -1
- package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WZFZ4ESO.mjs → chunk-A5H5GRV6.mjs} +1 -1
- package/dist/lib/browser/chunk-A5H5GRV6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +34 -38
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-I3USIAF6.mjs +17 -0
- package/dist/lib/browser/react-context-I3USIAF6.mjs.map +7 -0
- package/dist/lib/browser/react-surface-FMVC5GPV.mjs +758 -0
- package/dist/lib/browser/react-surface-FMVC5GPV.mjs.map +7 -0
- package/dist/lib/browser/settings-SLTQJJNF.mjs +32 -0
- package/dist/lib/browser/settings-SLTQJJNF.mjs.map +7 -0
- package/dist/types/src/DebugPlugin.d.ts +2 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -8
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context/index.d.ts +7 -0
- package/dist/types/src/capabilities/react-context/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-context/react-context.d.ts +10 -0
- package/dist/types/src/capabilities/react-context/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +3 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +6 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/components/DebugGraph.d.ts +5 -4
- package/dist/types/src/components/DebugGraph.d.ts.map +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts +1 -1
- package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/DebugSettings.d.ts +4 -2
- package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +2 -2
- 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.map +1 -1
- package/dist/types/src/components/SpaceGenerator/presets.d.ts +1 -48
- package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts +1 -1
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +5 -0
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +77 -71
- package/src/DebugPlugin.tsx +17 -31
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +421 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/index.ts +4 -6
- package/src/capabilities/react-context/index.ts +7 -0
- package/src/capabilities/react-context/react-context.tsx +20 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +411 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +31 -0
- package/src/components/DebugGraph.tsx +4 -3
- package/src/components/DebugObjectPanel.tsx +4 -5
- package/src/components/DebugSettings.tsx +26 -21
- package/src/components/DevtoolsOverviewContainer.tsx +2 -2
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +5 -5
- package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +8 -6
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +21 -21
- package/src/components/SpaceGenerator/presets.ts +139 -42
- package/src/components/Wireframe.tsx +2 -2
- package/src/components/index.ts +4 -1
- package/src/meta.ts +2 -2
- package/src/types.ts +8 -0
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +0 -20
- package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +0 -7
- package/dist/lib/browser/DevtoolsOverviewContainer-JXVZVPHN.mjs +0 -25
- package/dist/lib/browser/DevtoolsOverviewContainer-JXVZVPHN.mjs.map +0 -7
- package/dist/lib/browser/SpaceGenerator-GYCIEMMO.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs +0 -588
- package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs.map +0 -7
- package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +0 -7
- package/dist/lib/browser/react-context-P2YDWEWI.mjs +0 -16
- package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +0 -7
- package/dist/lib/browser/react-surface-RFG63TTF.mjs +0 -774
- package/dist/lib/browser/react-surface-RFG63TTF.mjs.map +0 -7
- package/dist/lib/browser/settings-SQXR3OAH.mjs +0 -22
- package/dist/lib/browser/settings-SQXR3OAH.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-context.d.ts +0 -8
- package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -431
- package/src/capabilities/react-context.tsx +0 -16
- package/src/capabilities/react-surface.tsx +0 -418
- package/src/capabilities/settings.ts +0 -19
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/components/DebugGraph.tsx
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Tree } from "@dxos/devtools";
|
|
4
|
+
import { Graph } from "@dxos/plugin-graph";
|
|
5
|
+
var DebugGraph = ({ graph, root }) => {
|
|
6
|
+
return /* @__PURE__ */ React.createElement(Tree, {
|
|
7
|
+
data: Graph.toJSON(graph, root)
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var DebugGraph_default = DebugGraph;
|
|
11
|
+
export {
|
|
12
|
+
DebugGraph,
|
|
13
|
+
DebugGraph_default as default
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=DebugGraph-6VMEOKEV.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/DebugGraph.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nimport { Tree } from '@dxos/devtools';\nimport { Graph } from '@dxos/plugin-graph';\n\nexport type DebugGraphProps = { graph: Graph.Graph; root: string };\nexport const DebugGraph: FC<DebugGraphProps> = ({ graph, root }) => {\n return <Tree data={Graph.toJSON(graph, root)} />;\n};\n\nexport default DebugGraph;\n"],
|
|
5
|
+
"mappings": ";AAIA,OAAOA,WAAwB;AAE/B,SAASC,YAAY;AACrB,SAASC,aAAa;AAGf,IAAMC,aAAkC,CAAC,EAAEC,OAAOC,KAAI,MAAE;AAC7D,SAAO,sBAAA,cAACC,MAAAA;IAAKC,MAAMC,MAAMC,OAAOL,OAAOC,IAAAA;;AACzC;AAEA,IAAA,qBAAeF;",
|
|
6
|
+
"names": ["React", "Tree", "Graph", "DebugGraph", "graph", "root", "Tree", "data", "Graph", "toJSON"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/components/DevtoolsOverviewContainer.tsx
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Surface } from "@dxos/app-framework/ui";
|
|
4
|
+
import { StatsPanel, useStats } from "@dxos/devtools";
|
|
5
|
+
var DevtoolsOverviewContainer = () => {
|
|
6
|
+
const [stats, refreshStats] = useStats();
|
|
7
|
+
return /* @__PURE__ */ React.createElement(StatsPanel, {
|
|
8
|
+
stats,
|
|
9
|
+
onRefresh: refreshStats
|
|
10
|
+
}, /* @__PURE__ */ React.createElement(Surface.Surface, {
|
|
11
|
+
role: "devtools-overview"
|
|
12
|
+
}));
|
|
13
|
+
};
|
|
14
|
+
var DevtoolsOverviewContainer_default = DevtoolsOverviewContainer;
|
|
15
|
+
export {
|
|
16
|
+
DevtoolsOverviewContainer,
|
|
17
|
+
DevtoolsOverviewContainer_default as default
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=DevtoolsOverviewContainer-2C6XMJ3L.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/DevtoolsOverviewContainer.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Surface } from '@dxos/app-framework/ui';\nimport { StatsPanel, useStats } from '@dxos/devtools';\n\nexport const DevtoolsOverviewContainer = () => {\n const [stats, refreshStats] = useStats();\n\n return (\n <StatsPanel stats={stats} onRefresh={refreshStats}>\n <Surface.Surface role='devtools-overview' />\n </StatsPanel>\n );\n};\n\nexport default DevtoolsOverviewContainer;\n"],
|
|
5
|
+
"mappings": ";AAIA,OAAOA,WAAW;AAElB,SAASC,eAAe;AACxB,SAASC,YAAYC,gBAAgB;AAE9B,IAAMC,4BAA4B,MAAA;AACvC,QAAM,CAACC,OAAOC,YAAAA,IAAgBC,SAAAA;AAE9B,SACE,sBAAA,cAACC,YAAAA;IAAWH;IAAcI,WAAWH;KACnC,sBAAA,cAACI,QAAQA,SAAO;IAACC,MAAK;;AAG5B;AAEA,IAAA,oCAAeP;",
|
|
6
|
+
"names": ["React", "Surface", "StatsPanel", "useStats", "DevtoolsOverviewContainer", "stats", "refreshStats", "useStats", "StatsPanel", "onRefresh", "Surface", "role"]
|
|
7
|
+
}
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
// src/components/SpaceGenerator/SpaceGenerator.tsx
|
|
2
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
3
2
|
import React2, { useCallback, useMemo, useState } from "react";
|
|
4
|
-
import {
|
|
3
|
+
import { useOperationInvoker } from "@dxos/app-framework/ui";
|
|
5
4
|
import { ComputeGraph as ComputeGraph2 } from "@dxos/conductor";
|
|
6
5
|
import { Filter as Filter3, Obj as Obj2 } from "@dxos/echo";
|
|
7
6
|
import { Markdown as Markdown3 } from "@dxos/plugin-markdown/types";
|
|
8
7
|
import { Sheet as Sheet2 } from "@dxos/plugin-sheet/types";
|
|
9
8
|
import { Diagram as Diagram2 } from "@dxos/plugin-sketch/types";
|
|
10
9
|
import { useClient } from "@dxos/react-client";
|
|
11
|
-
import { IconButton as IconButton2, Input, Toolbar, useAsyncEffect } from "@dxos/react-ui";
|
|
10
|
+
import { IconButton as IconButton2, Input, Layout, ScrollArea, Toolbar, useAsyncEffect } from "@dxos/react-ui";
|
|
12
11
|
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
13
12
|
import { Organization as Organization2, Person as Person2, Task } from "@dxos/types";
|
|
14
13
|
import { jsonKeyReplacer, sortKeys } from "@dxos/util";
|
|
15
14
|
|
|
16
15
|
// src/components/SpaceGenerator/ObjectGenerator.tsx
|
|
17
|
-
import { createIntent } from "@dxos/app-framework";
|
|
18
16
|
import { addressToA1Notation } from "@dxos/compute";
|
|
19
17
|
import { ComputeGraph, ComputeGraphModel, DEFAULT_OUTPUT, NODE_INPUT, NODE_OUTPUT } from "@dxos/conductor";
|
|
20
18
|
import { DXN, Filter, Key } from "@dxos/echo";
|
|
21
19
|
import { Markdown } from "@dxos/plugin-markdown/types";
|
|
22
20
|
import { Sheet } from "@dxos/plugin-sheet/types";
|
|
23
21
|
import { Diagram } from "@dxos/plugin-sketch/types";
|
|
24
|
-
import {
|
|
22
|
+
import { SpaceOperation } from "@dxos/plugin-space/types";
|
|
25
23
|
import { faker } from "@dxos/random";
|
|
26
24
|
import { View, getTypenameFromQuery } from "@dxos/schema";
|
|
27
25
|
import { createAsyncGenerator } from "@dxos/schema/testing";
|
|
@@ -30,7 +28,7 @@ var generator = faker;
|
|
|
30
28
|
var findViewByTypename = async (views, typename) => {
|
|
31
29
|
return views.find((view) => getTypenameFromQuery(view.query.ast) === typename);
|
|
32
30
|
};
|
|
33
|
-
var createGenerator = (client,
|
|
31
|
+
var createGenerator = (client, invokePromise, schema) => {
|
|
34
32
|
return async (space, n) => {
|
|
35
33
|
const typename = schema.typename;
|
|
36
34
|
const views = await space.db.query(Filter.type(View.View)).run();
|
|
@@ -39,17 +37,17 @@ var createGenerator = (client, dispatch, schema) => {
|
|
|
39
37
|
typename
|
|
40
38
|
}).runSync()[0];
|
|
41
39
|
if (!view && !staticSchema) {
|
|
42
|
-
await
|
|
43
|
-
space,
|
|
40
|
+
await invokePromise(SpaceOperation.AddSchema, {
|
|
41
|
+
db: space.db,
|
|
44
42
|
schema,
|
|
45
43
|
show: false
|
|
46
|
-
})
|
|
44
|
+
});
|
|
47
45
|
} else if (!view && staticSchema) {
|
|
48
|
-
await
|
|
49
|
-
space,
|
|
46
|
+
await invokePromise(SpaceOperation.UseStaticSchema, {
|
|
47
|
+
db: space.db,
|
|
50
48
|
typename,
|
|
51
49
|
show: false
|
|
52
|
-
})
|
|
50
|
+
});
|
|
53
51
|
}
|
|
54
52
|
const generate = createAsyncGenerator(generator, schema, {
|
|
55
53
|
db: space.db
|
|
@@ -207,9 +205,9 @@ import { gmail } from "@dxos/plugin-inbox";
|
|
|
207
205
|
import { Mailbox } from "@dxos/plugin-inbox/types";
|
|
208
206
|
import { Markdown as Markdown2 } from "@dxos/plugin-markdown/types";
|
|
209
207
|
import { createAppend, createChat, createComputeGraph, createConstant, createFunction, createGpt, createQueue, createRandom, createSurface, createTemplate, createText, createTrigger } from "@dxos/react-ui-canvas-compute";
|
|
210
|
-
import {
|
|
208
|
+
import { CanvasBoard, CanvasGraphModel, pointMultiply, pointsToRect, rectToPoints } from "@dxos/react-ui-canvas-editor";
|
|
211
209
|
import { View as View2 } from "@dxos/schema";
|
|
212
|
-
import { Message, Organization, Person,
|
|
210
|
+
import { Message, Organization, Person, Pipeline } from "@dxos/types";
|
|
213
211
|
import { range as range2, trim } from "@dxos/util";
|
|
214
212
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-debug/src/components/SpaceGenerator/presets.ts";
|
|
215
213
|
var PresetName = /* @__PURE__ */ (function(PresetName2) {
|
|
@@ -225,7 +223,7 @@ var PresetName = /* @__PURE__ */ (function(PresetName2) {
|
|
|
225
223
|
})({});
|
|
226
224
|
var generator2 = () => ({
|
|
227
225
|
schemas: [
|
|
228
|
-
|
|
226
|
+
CanvasBoard.CanvasBoard,
|
|
229
227
|
Trigger.Trigger
|
|
230
228
|
],
|
|
231
229
|
types: Object.values(PresetName).map((name) => ({
|
|
@@ -248,9 +246,11 @@ var generator2 = () => ({
|
|
|
248
246
|
label: "Investor"
|
|
249
247
|
}));
|
|
250
248
|
const tagDxn = Obj.getDXN(tag).toString();
|
|
251
|
-
Obj.
|
|
252
|
-
|
|
253
|
-
|
|
249
|
+
Obj.change(doc, (d) => {
|
|
250
|
+
Obj.getMeta(d).tags = [
|
|
251
|
+
tagDxn
|
|
252
|
+
];
|
|
253
|
+
});
|
|
254
254
|
space.db.add(Obj.make(Person.Person, {
|
|
255
255
|
fullName: "Rich",
|
|
256
256
|
organization: Ref.make(org)
|
|
@@ -297,7 +297,7 @@ var generator2 = () => ({
|
|
|
297
297
|
},
|
|
298
298
|
function: Ref.make(serializeFunction(gmail.sync)),
|
|
299
299
|
input: {
|
|
300
|
-
|
|
300
|
+
mailbox: Ref.make(mailbox)
|
|
301
301
|
}
|
|
302
302
|
}));
|
|
303
303
|
space.db.add(Trigger.make({
|
|
@@ -368,7 +368,7 @@ var generator2 = () => ({
|
|
|
368
368
|
query: notesQuery,
|
|
369
369
|
jsonSchema: Type.toJsonSchema(Markdown2.Document)
|
|
370
370
|
});
|
|
371
|
-
return space.db.add(
|
|
371
|
+
return space.db.add(Pipeline.make({
|
|
372
372
|
name: "Investor Research",
|
|
373
373
|
columns: [
|
|
374
374
|
{
|
|
@@ -862,20 +862,22 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
862
862
|
const triggerSpec = functionTrigger.spec;
|
|
863
863
|
invariant(triggerSpec && triggerSpec.kind === triggerKind, "No trigger spec.", {
|
|
864
864
|
F: __dxlog_file,
|
|
865
|
-
L:
|
|
865
|
+
L: 756,
|
|
866
866
|
S: void 0,
|
|
867
867
|
A: [
|
|
868
868
|
"triggerSpec && triggerSpec.kind === triggerKind",
|
|
869
869
|
"'No trigger spec.'"
|
|
870
870
|
]
|
|
871
871
|
});
|
|
872
|
-
|
|
872
|
+
Obj.change(functionTrigger, (ft) => {
|
|
873
|
+
initSpec(ft.spec);
|
|
874
|
+
});
|
|
873
875
|
});
|
|
874
876
|
const computeModel = createComputeGraph(canvasModel);
|
|
875
877
|
const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
|
|
876
878
|
invariant(templateComputeNode, "Template compute node was not created.", {
|
|
877
879
|
F: __dxlog_file,
|
|
878
|
-
L:
|
|
880
|
+
L: 765,
|
|
879
881
|
S: void 0,
|
|
880
882
|
A: [
|
|
881
883
|
"templateComputeNode",
|
|
@@ -899,7 +901,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
|
|
|
899
901
|
};
|
|
900
902
|
};
|
|
901
903
|
var addToSpace = (name, space, canvas, compute) => {
|
|
902
|
-
return space.db.add(Obj.make(
|
|
904
|
+
return space.db.add(Obj.make(CanvasBoard.CanvasBoard, {
|
|
903
905
|
name,
|
|
904
906
|
computeGraph: Ref.make(compute.root),
|
|
905
907
|
layout: canvas.graph
|
|
@@ -937,16 +939,18 @@ var setupQueue = (space, canvasModel, args) => {
|
|
|
937
939
|
var attachTrigger = (functionTrigger, computeModel) => {
|
|
938
940
|
invariant(functionTrigger, void 0, {
|
|
939
941
|
F: __dxlog_file,
|
|
940
|
-
L:
|
|
942
|
+
L: 805,
|
|
941
943
|
S: void 0,
|
|
942
944
|
A: [
|
|
943
945
|
"functionTrigger",
|
|
944
946
|
""
|
|
945
947
|
]
|
|
946
948
|
});
|
|
947
|
-
functionTrigger.function = Ref.make(computeModel.root);
|
|
948
949
|
const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT2);
|
|
949
|
-
functionTrigger
|
|
950
|
+
Obj.change(functionTrigger, (t) => {
|
|
951
|
+
t.function = Ref.make(computeModel.root);
|
|
952
|
+
t.inputNodeId = inputNode.id;
|
|
953
|
+
});
|
|
950
954
|
};
|
|
951
955
|
var rawPosition = (args) => {
|
|
952
956
|
return {
|
|
@@ -993,161 +997,151 @@ var position = (rect) => {
|
|
|
993
997
|
};
|
|
994
998
|
|
|
995
999
|
// src/components/SpaceGenerator/SchemaTable.tsx
|
|
996
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
997
1000
|
import React from "react";
|
|
998
1001
|
import { IconButton } from "@dxos/react-ui";
|
|
999
1002
|
var SchemaTable = ({ types, objects = {}, label, onClick }) => {
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
onClick: () => onClick(type.typename)
|
|
1019
|
-
}))));
|
|
1020
|
-
} finally {
|
|
1021
|
-
_effect.f();
|
|
1022
|
-
}
|
|
1003
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1004
|
+
className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
|
|
1005
|
+
}, /* @__PURE__ */ React.createElement("h2", {
|
|
1006
|
+
className: "p-2"
|
|
1007
|
+
}, label), types.map((type) => /* @__PURE__ */ React.createElement("div", {
|
|
1008
|
+
key: type.typename,
|
|
1009
|
+
className: "grid grid-cols-subgrid col-span-3 items-center"
|
|
1010
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1011
|
+
className: "pli-2 text-sm font-mono text-subdued"
|
|
1012
|
+
}, type.typename), /* @__PURE__ */ React.createElement("div", {
|
|
1013
|
+
className: "pli-2 text-right font-mono"
|
|
1014
|
+
}, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
|
|
1015
|
+
variant: "ghost",
|
|
1016
|
+
icon: "ph--plus--regular",
|
|
1017
|
+
iconOnly: true,
|
|
1018
|
+
label: "Create data",
|
|
1019
|
+
onClick: () => onClick(type.typename)
|
|
1020
|
+
}))));
|
|
1023
1021
|
};
|
|
1024
1022
|
|
|
1025
1023
|
// src/components/SpaceGenerator/SpaceGenerator.tsx
|
|
1026
1024
|
var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
...recordTypes,
|
|
1049
|
-
...presets.schemas
|
|
1050
|
-
]);
|
|
1051
|
-
}, [
|
|
1052
|
-
client
|
|
1053
|
-
]);
|
|
1054
|
-
const typeMap = useMemo(() => {
|
|
1055
|
-
const recordGenerators = new Map(recordTypes.map((type) => [
|
|
1056
|
-
type.typename,
|
|
1057
|
-
createGenerator(client, dispatch, type)
|
|
1058
|
-
]));
|
|
1059
|
-
return new Map([
|
|
1060
|
-
...staticGenerators,
|
|
1061
|
-
...presets.items,
|
|
1062
|
-
...recordGenerators
|
|
1063
|
-
]);
|
|
1064
|
-
}, [
|
|
1065
|
-
client,
|
|
1066
|
-
recordTypes
|
|
1025
|
+
const { invokePromise } = useOperationInvoker();
|
|
1026
|
+
const client = useClient();
|
|
1027
|
+
const staticTypes = [
|
|
1028
|
+
Markdown3.Document,
|
|
1029
|
+
Diagram2.Diagram,
|
|
1030
|
+
Sheet2.Sheet,
|
|
1031
|
+
ComputeGraph2
|
|
1032
|
+
];
|
|
1033
|
+
const recordTypes = [
|
|
1034
|
+
Organization2.Organization,
|
|
1035
|
+
Person2.Person,
|
|
1036
|
+
Task.Task
|
|
1037
|
+
];
|
|
1038
|
+
const [count, setCount] = useState(1);
|
|
1039
|
+
const [info, setInfo] = useState({});
|
|
1040
|
+
const presets = useMemo(() => generator2(), []);
|
|
1041
|
+
useAsyncEffect(async () => {
|
|
1042
|
+
await client.addTypes([
|
|
1043
|
+
...staticTypes,
|
|
1044
|
+
...recordTypes,
|
|
1045
|
+
...presets.schemas
|
|
1067
1046
|
]);
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
setInfo({
|
|
1081
|
-
schema: {
|
|
1082
|
-
static: staticSchema.length,
|
|
1083
|
-
mutable: echoSchema.length
|
|
1084
|
-
},
|
|
1085
|
-
objects: objectMap
|
|
1086
|
-
});
|
|
1087
|
-
};
|
|
1088
|
-
useAsyncEffect(updateInfo, [
|
|
1089
|
-
space
|
|
1047
|
+
}, [
|
|
1048
|
+
client
|
|
1049
|
+
]);
|
|
1050
|
+
const typeMap = useMemo(() => {
|
|
1051
|
+
const recordGenerators = new Map(recordTypes.map((type) => [
|
|
1052
|
+
type.typename,
|
|
1053
|
+
createGenerator(client, invokePromise, type)
|
|
1054
|
+
]));
|
|
1055
|
+
return new Map([
|
|
1056
|
+
...staticGenerators,
|
|
1057
|
+
...presets.items,
|
|
1058
|
+
...recordGenerators
|
|
1090
1059
|
]);
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1060
|
+
}, [
|
|
1061
|
+
client,
|
|
1062
|
+
recordTypes,
|
|
1063
|
+
invokePromise
|
|
1064
|
+
]);
|
|
1065
|
+
const updateInfo = async () => {
|
|
1066
|
+
const echoSchema = await space.db.schemaRegistry.query().run();
|
|
1067
|
+
const staticSchema = await space.db.graph.schemaRegistry.query().run();
|
|
1068
|
+
const objects = await space.db.query(Filter3.everything()).run();
|
|
1069
|
+
const objectMap = sortKeys(objects.reduce((map, obj) => {
|
|
1070
|
+
const type = Obj2.getTypename(obj);
|
|
1071
|
+
if (type) {
|
|
1072
|
+
const count2 = map[type] ?? 0;
|
|
1073
|
+
map[type] = count2 + 1;
|
|
1096
1074
|
}
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
|
|
1075
|
+
return map;
|
|
1076
|
+
}, {}));
|
|
1077
|
+
setInfo({
|
|
1078
|
+
schema: {
|
|
1079
|
+
static: staticSchema.length,
|
|
1080
|
+
mutable: echoSchema.length
|
|
1081
|
+
},
|
|
1082
|
+
objects: objectMap
|
|
1083
|
+
});
|
|
1084
|
+
};
|
|
1085
|
+
useAsyncEffect(updateInfo, [
|
|
1086
|
+
space
|
|
1087
|
+
]);
|
|
1088
|
+
const handleCreateData = useCallback(async (typename) => {
|
|
1089
|
+
const constructor = typeMap.get(typename);
|
|
1090
|
+
if (constructor) {
|
|
1091
|
+
await constructor(space, count, onCreateObjects);
|
|
1092
|
+
await updateInfo();
|
|
1093
|
+
}
|
|
1094
|
+
}, [
|
|
1095
|
+
typeMap,
|
|
1096
|
+
count
|
|
1097
|
+
]);
|
|
1098
|
+
return /* @__PURE__ */ React2.createElement(Layout.Main, {
|
|
1099
|
+
toolbar: true
|
|
1100
|
+
}, /* @__PURE__ */ React2.createElement(Toolbar.Root, null, /* @__PURE__ */ React2.createElement(IconButton2, {
|
|
1101
|
+
icon: "ph--arrow-clockwise--regular",
|
|
1102
|
+
iconOnly: true,
|
|
1103
|
+
label: "Refresh",
|
|
1104
|
+
onClick: updateInfo
|
|
1105
|
+
}), /* @__PURE__ */ React2.createElement(Toolbar.Separator, {
|
|
1106
|
+
variant: "gap"
|
|
1107
|
+
}), /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.TextInput, {
|
|
1108
|
+
type: "number",
|
|
1109
|
+
placeholder: "Count",
|
|
1110
|
+
classNames: "is-[4rem] text-right",
|
|
1111
|
+
min: 1,
|
|
1112
|
+
max: 100,
|
|
1113
|
+
size: 8,
|
|
1114
|
+
value: count,
|
|
1115
|
+
onChange: (event) => setCount(parseInt(event.target.value))
|
|
1116
|
+
}))), /* @__PURE__ */ React2.createElement(ScrollArea.Root, {
|
|
1117
|
+
thin: true,
|
|
1118
|
+
orientation: "vertical"
|
|
1119
|
+
}, /* @__PURE__ */ React2.createElement(ScrollArea.Viewport, {
|
|
1120
|
+
classNames: "gap-4 divide-y divide-subduedSeparator"
|
|
1121
|
+
}, /* @__PURE__ */ React2.createElement(SchemaTable, {
|
|
1122
|
+
types: staticTypes,
|
|
1123
|
+
objects: info.objects,
|
|
1124
|
+
label: "Static Types",
|
|
1125
|
+
onClick: handleCreateData
|
|
1126
|
+
}), /* @__PURE__ */ React2.createElement(SchemaTable, {
|
|
1127
|
+
types: recordTypes,
|
|
1128
|
+
objects: info.objects,
|
|
1129
|
+
label: "Record Types",
|
|
1130
|
+
onClick: handleCreateData
|
|
1131
|
+
}), /* @__PURE__ */ React2.createElement(SchemaTable, {
|
|
1132
|
+
types: presets.types,
|
|
1133
|
+
objects: info.objects,
|
|
1134
|
+
label: "Presets",
|
|
1135
|
+
onClick: handleCreateData
|
|
1136
|
+
}), /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
|
|
1137
|
+
language: "json",
|
|
1138
|
+
classNames: "text-xs"
|
|
1139
|
+
}, JSON.stringify({
|
|
1140
|
+
space,
|
|
1141
|
+
...info
|
|
1142
|
+
}, jsonKeyReplacer({
|
|
1143
|
+
truncate: true
|
|
1144
|
+
}), 2)))));
|
|
1151
1145
|
};
|
|
1152
1146
|
|
|
1153
1147
|
// src/components/SpaceGenerator/index.ts
|
|
@@ -1155,4 +1149,4 @@ var SpaceGenerator_default = SpaceGenerator;
|
|
|
1155
1149
|
export {
|
|
1156
1150
|
SpaceGenerator_default as default
|
|
1157
1151
|
};
|
|
1158
|
-
//# sourceMappingURL=SpaceGenerator-
|
|
1152
|
+
//# sourceMappingURL=SpaceGenerator-W3LJORYT.mjs.map
|