@dxos/plugin-debug 0.8.4-main.7ace549 → 0.8.4-main.937b3ca

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.
Files changed (111) hide show
  1. package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs +15 -0
  2. package/dist/lib/browser/DebugGraph-6VMEOKEV.mjs.map +7 -0
  3. package/dist/lib/browser/DevtoolsOverviewContainer-77PKFLYV.mjs +19 -0
  4. package/dist/lib/browser/{DevtoolsOverviewContainer-JXVZVPHN.mjs.map → DevtoolsOverviewContainer-77PKFLYV.mjs.map} +1 -1
  5. package/dist/lib/browser/{SpaceGenerator-BED4UXGS.mjs → SpaceGenerator-ZHVZWGM7.mjs} +168 -170
  6. package/dist/lib/browser/SpaceGenerator-ZHVZWGM7.mjs.map +7 -0
  7. package/dist/lib/browser/app-graph-builder-FBDRMMYF.mjs +597 -0
  8. package/dist/lib/browser/app-graph-builder-FBDRMMYF.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-SRV2AIGJ.mjs → chunk-4UFQXPP7.mjs} +11 -1
  10. package/dist/lib/browser/chunk-4UFQXPP7.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-WZFZ4ESO.mjs → chunk-A5H5GRV6.mjs} +1 -1
  12. package/dist/lib/browser/chunk-A5H5GRV6.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +33 -38
  14. package/dist/lib/browser/index.mjs.map +4 -4
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/react-context-FSWBT3MH.mjs +17 -0
  17. package/dist/lib/browser/react-context-FSWBT3MH.mjs.map +7 -0
  18. package/dist/lib/browser/react-surface-W62RJ32U.mjs +757 -0
  19. package/dist/lib/browser/react-surface-W62RJ32U.mjs.map +7 -0
  20. package/dist/lib/browser/settings-KA4GN73K.mjs +31 -0
  21. package/dist/lib/browser/settings-KA4GN73K.mjs.map +7 -0
  22. package/dist/types/src/DebugPlugin.d.ts +2 -1
  23. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  24. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
  25. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  26. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  27. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  28. package/dist/types/src/capabilities/index.d.ts +4 -8
  29. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  30. package/dist/types/src/capabilities/react-context/index.d.ts +7 -0
  31. package/dist/types/src/capabilities/react-context/index.d.ts.map +1 -0
  32. package/dist/types/src/capabilities/react-context/react-context.d.ts +10 -0
  33. package/dist/types/src/capabilities/react-context/react-context.d.ts.map +1 -0
  34. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  35. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  36. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  37. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  38. package/dist/types/src/capabilities/settings/index.d.ts +3 -0
  39. package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
  40. package/dist/types/src/capabilities/settings/settings.d.ts +5 -0
  41. package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
  42. package/dist/types/src/components/DebugGraph.d.ts +5 -4
  43. package/dist/types/src/components/DebugGraph.d.ts.map +1 -1
  44. package/dist/types/src/components/DebugObjectPanel.d.ts +1 -1
  45. package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
  46. package/dist/types/src/components/DebugSettings.d.ts +4 -2
  47. package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
  48. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +5 -5
  49. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  50. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +1 -1
  51. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -1
  52. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -1
  53. package/dist/types/src/components/SpaceGenerator/presets.d.ts +1 -48
  54. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  55. package/dist/types/src/components/Wireframe.d.ts +1 -1
  56. package/dist/types/src/components/Wireframe.d.ts.map +1 -1
  57. package/dist/types/src/components/index.d.ts +4 -4
  58. package/dist/types/src/components/index.d.ts.map +1 -1
  59. package/dist/types/src/meta.d.ts +2 -2
  60. package/dist/types/src/meta.d.ts.map +1 -1
  61. package/dist/types/src/types.d.ts +5 -0
  62. package/dist/types/src/types.d.ts.map +1 -1
  63. package/dist/types/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +76 -71
  65. package/src/DebugPlugin.tsx +16 -31
  66. package/src/capabilities/app-graph-builder/app-graph-builder.ts +419 -0
  67. package/src/capabilities/app-graph-builder/index.ts +7 -0
  68. package/src/capabilities/index.ts +4 -6
  69. package/src/capabilities/react-context/index.ts +7 -0
  70. package/src/capabilities/react-context/react-context.tsx +20 -0
  71. package/src/capabilities/react-surface/index.ts +7 -0
  72. package/src/capabilities/react-surface/react-surface.tsx +409 -0
  73. package/src/capabilities/settings/index.ts +7 -0
  74. package/src/capabilities/settings/settings.ts +30 -0
  75. package/src/components/DebugGraph.tsx +4 -3
  76. package/src/components/DebugObjectPanel.tsx +4 -4
  77. package/src/components/DebugSettings.tsx +10 -5
  78. package/src/components/SpaceGenerator/ObjectGenerator.tsx +15 -16
  79. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +7 -5
  80. package/src/components/SpaceGenerator/SpaceGenerator.tsx +15 -10
  81. package/src/components/SpaceGenerator/presets.ts +128 -27
  82. package/src/components/Wireframe.tsx +2 -2
  83. package/src/components/index.ts +4 -1
  84. package/src/meta.ts +2 -2
  85. package/src/types.ts +8 -0
  86. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +0 -20
  87. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +0 -7
  88. package/dist/lib/browser/DevtoolsOverviewContainer-JXVZVPHN.mjs +0 -25
  89. package/dist/lib/browser/SpaceGenerator-BED4UXGS.mjs.map +0 -7
  90. package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs +0 -588
  91. package/dist/lib/browser/app-graph-builder-CRH2HJKT.mjs.map +0 -7
  92. package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +0 -7
  93. package/dist/lib/browser/chunk-WZFZ4ESO.mjs.map +0 -7
  94. package/dist/lib/browser/react-context-P2YDWEWI.mjs +0 -16
  95. package/dist/lib/browser/react-context-P2YDWEWI.mjs.map +0 -7
  96. package/dist/lib/browser/react-surface-JM2H3RZI.mjs +0 -774
  97. package/dist/lib/browser/react-surface-JM2H3RZI.mjs.map +0 -7
  98. package/dist/lib/browser/settings-SQXR3OAH.mjs +0 -22
  99. package/dist/lib/browser/settings-SQXR3OAH.mjs.map +0 -7
  100. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  101. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  102. package/dist/types/src/capabilities/react-context.d.ts +0 -8
  103. package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
  104. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  105. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  106. package/dist/types/src/capabilities/settings.d.ts +0 -4
  107. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  108. package/src/capabilities/app-graph-builder.ts +0 -431
  109. package/src/capabilities/react-context.tsx +0 -16
  110. package/src/capabilities/react-surface.tsx +0 -418
  111. 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/react";
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, {
11
+ role: "devtools-overview"
12
+ }));
13
+ };
14
+ var DevtoolsOverviewContainer_default = DevtoolsOverviewContainer;
15
+ export {
16
+ DevtoolsOverviewContainer,
17
+ DevtoolsOverviewContainer_default as default
18
+ };
19
+ //# sourceMappingURL=DevtoolsOverviewContainer-77PKFLYV.mjs.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/DevtoolsOverviewContainer.tsx"],
4
4
  "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Surface } from '@dxos/app-framework/react';\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 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,UAAM,CAACC,OAAOC,YAAAA,IAAgBC,SAAAA;AAE9B,WACE,sBAAA,cAACC,YAAAA;MAAWH;MAAcI,WAAWH;OACnC,sBAAA,cAACI,SAAAA;MAAQC,MAAK;;;;;AAGpB;AAEA,IAAA,oCAAeP;",
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,SAAAA;IAAQC,MAAK;;AAGpB;AAEA,IAAA,oCAAeP;",
6
6
  "names": ["React", "Surface", "StatsPanel", "useStats", "DevtoolsOverviewContainer", "stats", "refreshStats", "useStats", "StatsPanel", "onRefresh", "Surface", "role"]
7
7
  }
@@ -1,7 +1,6 @@
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 { useIntentDispatcher } from "@dxos/app-framework/react";
3
+ import { useOperationInvoker } from "@dxos/app-framework/react";
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";
@@ -14,14 +13,13 @@ import { Organization as Organization2, Person as Person2, Task } from "@dxos/ty
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
- import { DXN, Filter, Key, Type } from "@dxos/echo";
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 { SpaceAction } from "@dxos/plugin-space/types";
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,24 +28,26 @@ 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, dispatch, schema) => {
31
+ var createGenerator = (client, invokePromise, schema) => {
34
32
  return async (space, n) => {
35
33
  const typename = schema.typename;
36
- const { objects: views } = await space.db.query(Filter.type(View.View)).run();
34
+ const views = await space.db.query(Filter.type(View.View)).run();
37
35
  const view = await findViewByTypename(views, typename);
38
- const staticSchema = client?.graph.schemaRegistry.schemas.find((schema2) => Type.getTypename(schema2) === typename);
36
+ const staticSchema = client?.graph.schemaRegistry.query({
37
+ typename
38
+ }).runSync()[0];
39
39
  if (!view && !staticSchema) {
40
- await dispatch(createIntent(SpaceAction.AddSchema, {
41
- space,
40
+ await invokePromise(SpaceOperation.AddSchema, {
41
+ db: space.db,
42
42
  schema,
43
43
  show: false
44
- }));
44
+ });
45
45
  } else if (!view && staticSchema) {
46
- await dispatch(createIntent(SpaceAction.UseStaticSchema, {
47
- space,
46
+ await invokePromise(SpaceOperation.UseStaticSchema, {
47
+ db: space.db,
48
48
  typename,
49
49
  show: false
50
- }));
50
+ });
51
51
  }
52
52
  const generate = createAsyncGenerator(generator, schema, {
53
53
  db: space.db
@@ -198,7 +198,7 @@ import * as Schema from "effect/Schema";
198
198
  import { Agent, EntityExtraction, ResearchBlueprint } from "@dxos/assistant-toolkit";
199
199
  import { Prompt } from "@dxos/blueprints";
200
200
  import { NODE_INPUT as NODE_INPUT2 } from "@dxos/conductor";
201
- import { DXN as DXN2, Filter as Filter2, Key as Key2, Obj, Query, Ref, Tag, Type as Type2 } from "@dxos/echo";
201
+ import { DXN as DXN2, Filter as Filter2, Key as Key2, Obj, Query, Ref, Tag, Type } from "@dxos/echo";
202
202
  import { Trigger, serializeFunction } from "@dxos/functions";
203
203
  import { invariant } from "@dxos/invariant";
204
204
  import { gmail } from "@dxos/plugin-inbox";
@@ -246,9 +246,11 @@ var generator2 = () => ({
246
246
  label: "Investor"
247
247
  }));
248
248
  const tagDxn = Obj.getDXN(tag).toString();
249
- Obj.getMeta(doc).tags = [
250
- tagDxn
251
- ];
249
+ Obj.change(doc, (d) => {
250
+ Obj.getMeta(d).tags = [
251
+ tagDxn
252
+ ];
253
+ });
252
254
  space.db.add(Obj.make(Person.Person, {
253
255
  fullName: "Rich",
254
256
  organization: Ref.make(org)
@@ -352,19 +354,19 @@ var generator2 = () => ({
352
354
  mailbox.queue.dxn.toString()
353
355
  ]
354
356
  }),
355
- jsonSchema: Type2.toJsonSchema(Message.Message)
357
+ jsonSchema: Type.toJsonSchema(Message.Message)
356
358
  });
357
359
  const contactsView = View2.make({
358
360
  query: contactsQuery,
359
- jsonSchema: Type2.toJsonSchema(Person.Person)
361
+ jsonSchema: Type.toJsonSchema(Person.Person)
360
362
  });
361
363
  const organizationsView = View2.make({
362
364
  query: organizationsQuery,
363
- jsonSchema: Type2.toJsonSchema(Organization.Organization)
365
+ jsonSchema: Type.toJsonSchema(Organization.Organization)
364
366
  });
365
367
  const notesView = View2.make({
366
368
  query: notesQuery,
367
- jsonSchema: Type2.toJsonSchema(Markdown2.Document)
369
+ jsonSchema: Type.toJsonSchema(Markdown2.Document)
368
370
  });
369
371
  return space.db.add(Project.make({
370
372
  name: "Investor Research",
@@ -860,7 +862,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
860
862
  const triggerSpec = functionTrigger.spec;
861
863
  invariant(triggerSpec && triggerSpec.kind === triggerKind, "No trigger spec.", {
862
864
  F: __dxlog_file,
863
- L: 675,
865
+ L: 762,
864
866
  S: void 0,
865
867
  A: [
866
868
  "triggerSpec && triggerSpec.kind === triggerKind",
@@ -873,7 +875,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
873
875
  const templateComputeNode = computeModel.nodes.find((n) => n.id === template.node);
874
876
  invariant(templateComputeNode, "Template compute node was not created.", {
875
877
  F: __dxlog_file,
876
- L: 682,
878
+ L: 769,
877
879
  S: void 0,
878
880
  A: [
879
881
  "templateComputeNode",
@@ -886,7 +888,7 @@ var createQueueSinkPreset = (space, triggerKind, initSpec, triggerOutputName) =>
886
888
  ' "id": "@{{changeId}}"',
887
889
  "}"
888
890
  ].join("\n");
889
- templateComputeNode.inputSchema = Type2.toJsonSchema(Schema.Struct({
891
+ templateComputeNode.inputSchema = Type.toJsonSchema(Schema.Struct({
890
892
  type: Schema.String,
891
893
  changeId: Schema.String
892
894
  }));
@@ -935,16 +937,18 @@ var setupQueue = (space, canvasModel, args) => {
935
937
  var attachTrigger = (functionTrigger, computeModel) => {
936
938
  invariant(functionTrigger, void 0, {
937
939
  F: __dxlog_file,
938
- L: 721,
940
+ L: 809,
939
941
  S: void 0,
940
942
  A: [
941
943
  "functionTrigger",
942
944
  ""
943
945
  ]
944
946
  });
945
- functionTrigger.function = Ref.make(computeModel.root);
946
947
  const inputNode = computeModel.nodes.find((node) => node.type === NODE_INPUT2);
947
- functionTrigger.inputNodeId = inputNode.id;
948
+ Obj.change(functionTrigger, (t) => {
949
+ t.function = Ref.make(computeModel.root);
950
+ t.inputNodeId = inputNode.id;
951
+ });
948
952
  };
949
953
  var rawPosition = (args) => {
950
954
  return {
@@ -991,157 +995,151 @@ var position = (rect) => {
991
995
  };
992
996
 
993
997
  // src/components/SpaceGenerator/SchemaTable.tsx
994
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
995
998
  import React from "react";
996
999
  import { IconButton } from "@dxos/react-ui";
997
1000
  var SchemaTable = ({ types, objects = {}, label, onClick }) => {
998
- var _effect = _useSignals();
999
- try {
1000
- return /* @__PURE__ */ React.createElement("div", {
1001
- className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
1002
- }, /* @__PURE__ */ React.createElement("h2", {
1003
- className: "p-2"
1004
- }, label), types.map((type) => /* @__PURE__ */ React.createElement("div", {
1005
- key: type.typename,
1006
- className: "grid grid-cols-subgrid col-span-3 items-center"
1007
- }, /* @__PURE__ */ React.createElement("div", {
1008
- className: "pli-2 text-sm font-mono text-subdued"
1009
- }, type.typename), /* @__PURE__ */ React.createElement("div", {
1010
- className: "pli-2 text-right font-mono"
1011
- }, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
1012
- variant: "ghost",
1013
- icon: "ph--plus--regular",
1014
- iconOnly: true,
1015
- label: "Create data",
1016
- onClick: () => onClick(type.typename)
1017
- }))));
1018
- } finally {
1019
- _effect.f();
1020
- }
1001
+ return /* @__PURE__ */ React.createElement("div", {
1002
+ className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
1003
+ }, /* @__PURE__ */ React.createElement("h2", {
1004
+ className: "p-2"
1005
+ }, label), types.map((type) => /* @__PURE__ */ React.createElement("div", {
1006
+ key: type.typename,
1007
+ className: "grid grid-cols-subgrid col-span-3 items-center"
1008
+ }, /* @__PURE__ */ React.createElement("div", {
1009
+ className: "pli-2 text-sm font-mono text-subdued"
1010
+ }, type.typename), /* @__PURE__ */ React.createElement("div", {
1011
+ className: "pli-2 text-right font-mono"
1012
+ }, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
1013
+ variant: "ghost",
1014
+ icon: "ph--plus--regular",
1015
+ iconOnly: true,
1016
+ label: "Create data",
1017
+ onClick: () => onClick(type.typename)
1018
+ }))));
1021
1019
  };
1022
1020
 
1023
1021
  // src/components/SpaceGenerator/SpaceGenerator.tsx
1024
1022
  var SpaceGenerator = ({ space, onCreateObjects }) => {
1025
- var _effect = _useSignals2();
1026
- try {
1027
- const { dispatchPromise: dispatch } = useIntentDispatcher();
1028
- const client = useClient();
1029
- const staticTypes = [
1030
- Markdown3.Document,
1031
- Diagram2.Diagram,
1032
- Sheet2.Sheet,
1033
- ComputeGraph2
1034
- ];
1035
- const recordTypes = [
1036
- Organization2.Organization,
1037
- Person2.Person,
1038
- Task.Task
1039
- ];
1040
- const [count, setCount] = useState(1);
1041
- const [info, setInfo] = useState({});
1042
- const presets = useMemo(() => generator2(), []);
1043
- const typeMap = useMemo(() => {
1044
- client.addTypes([
1045
- ...staticTypes,
1046
- ...recordTypes,
1047
- ...presets.schemas
1048
- ]);
1049
- const recordGenerators = new Map(recordTypes.map((type) => [
1050
- type.typename,
1051
- createGenerator(client, dispatch, type)
1052
- ]));
1053
- return new Map([
1054
- ...staticGenerators,
1055
- ...presets.items,
1056
- ...recordGenerators
1057
- ]);
1058
- }, [
1059
- client,
1060
- recordTypes
1023
+ const { invokePromise } = useOperationInvoker();
1024
+ const client = useClient();
1025
+ const staticTypes = [
1026
+ Markdown3.Document,
1027
+ Diagram2.Diagram,
1028
+ Sheet2.Sheet,
1029
+ ComputeGraph2
1030
+ ];
1031
+ const recordTypes = [
1032
+ Organization2.Organization,
1033
+ Person2.Person,
1034
+ Task.Task
1035
+ ];
1036
+ const [count, setCount] = useState(1);
1037
+ const [info, setInfo] = useState({});
1038
+ const presets = useMemo(() => generator2(), []);
1039
+ useAsyncEffect(async () => {
1040
+ await client.addTypes([
1041
+ ...staticTypes,
1042
+ ...recordTypes,
1043
+ ...presets.schemas
1061
1044
  ]);
1062
- const updateInfo = async () => {
1063
- const echoSchema = await space.db.schemaRegistry.query().run();
1064
- const staticSchema = space.db.graph.schemaRegistry.schemas;
1065
- const { objects } = await space.db.query(Filter3.everything()).run();
1066
- const objectMap = sortKeys(objects.reduce((map, obj) => {
1067
- const type = Obj2.getTypename(obj);
1068
- if (type) {
1069
- const count2 = map[type] ?? 0;
1070
- map[type] = count2 + 1;
1071
- }
1072
- return map;
1073
- }, {}));
1074
- setInfo({
1075
- schema: {
1076
- static: staticSchema.length,
1077
- mutable: echoSchema.length
1078
- },
1079
- objects: objectMap
1080
- });
1081
- };
1082
- useAsyncEffect(updateInfo, [
1083
- space
1045
+ }, [
1046
+ client
1047
+ ]);
1048
+ const typeMap = useMemo(() => {
1049
+ const recordGenerators = new Map(recordTypes.map((type) => [
1050
+ type.typename,
1051
+ createGenerator(client, invokePromise, type)
1052
+ ]));
1053
+ return new Map([
1054
+ ...staticGenerators,
1055
+ ...presets.items,
1056
+ ...recordGenerators
1084
1057
  ]);
1085
- const handleCreateData = useCallback(async (typename) => {
1086
- const constructor = typeMap.get(typename);
1087
- if (constructor) {
1088
- await constructor(space, count, onCreateObjects);
1089
- await updateInfo();
1058
+ }, [
1059
+ client,
1060
+ recordTypes,
1061
+ invokePromise
1062
+ ]);
1063
+ const updateInfo = async () => {
1064
+ const echoSchema = await space.db.schemaRegistry.query().run();
1065
+ const staticSchema = await space.db.graph.schemaRegistry.query().run();
1066
+ const objects = await space.db.query(Filter3.everything()).run();
1067
+ const objectMap = sortKeys(objects.reduce((map, obj) => {
1068
+ const type = Obj2.getTypename(obj);
1069
+ if (type) {
1070
+ const count2 = map[type] ?? 0;
1071
+ map[type] = count2 + 1;
1090
1072
  }
1091
- }, [
1092
- typeMap,
1093
- count
1094
- ]);
1095
- return /* @__PURE__ */ React2.createElement("div", {
1096
- role: "none",
1097
- className: "flex flex-col grow overflow-hidden"
1098
- }, /* @__PURE__ */ React2.createElement(Toolbar.Root, {
1099
- classNames: "border-be border-subduedSeparator"
1100
- }, /* @__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
- min: 1,
1110
- max: 100,
1111
- placeholder: "Count",
1112
- classNames: "!w-[4rem] !text-right",
1113
- size: 8,
1114
- value: count,
1115
- onChange: (ev) => setCount(parseInt(ev.target.value))
1116
- }))), /* @__PURE__ */ React2.createElement("div", {
1117
- className: "flex flex-col overflow-y-auto divide-y divide-separator"
1118
- }, /* @__PURE__ */ React2.createElement(SchemaTable, {
1119
- types: staticTypes,
1120
- objects: info.objects,
1121
- label: "Static Types",
1122
- onClick: handleCreateData
1123
- }), /* @__PURE__ */ React2.createElement(SchemaTable, {
1124
- types: recordTypes,
1125
- objects: info.objects,
1126
- label: "Record Types",
1127
- onClick: handleCreateData
1128
- }), /* @__PURE__ */ React2.createElement(SchemaTable, {
1129
- types: presets.types,
1130
- objects: info.objects,
1131
- label: "Presets",
1132
- onClick: handleCreateData
1133
- }), /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
1134
- language: "json",
1135
- classNames: "text-xs"
1136
- }, JSON.stringify({
1137
- space,
1138
- ...info
1139
- }, jsonKeyReplacer({
1140
- truncate: true
1141
- }), 2)))));
1142
- } finally {
1143
- _effect.f();
1144
- }
1073
+ return map;
1074
+ }, {}));
1075
+ setInfo({
1076
+ schema: {
1077
+ static: staticSchema.length,
1078
+ mutable: echoSchema.length
1079
+ },
1080
+ objects: objectMap
1081
+ });
1082
+ };
1083
+ useAsyncEffect(updateInfo, [
1084
+ space
1085
+ ]);
1086
+ const handleCreateData = useCallback(async (typename) => {
1087
+ const constructor = typeMap.get(typename);
1088
+ if (constructor) {
1089
+ await constructor(space, count, onCreateObjects);
1090
+ await updateInfo();
1091
+ }
1092
+ }, [
1093
+ typeMap,
1094
+ count
1095
+ ]);
1096
+ return /* @__PURE__ */ React2.createElement("div", {
1097
+ role: "none",
1098
+ className: "flex flex-col grow overflow-hidden"
1099
+ }, /* @__PURE__ */ React2.createElement(Toolbar.Root, {
1100
+ classNames: "border-be border-subduedSeparator"
1101
+ }, /* @__PURE__ */ React2.createElement(IconButton2, {
1102
+ icon: "ph--arrow-clockwise--regular",
1103
+ iconOnly: true,
1104
+ label: "Refresh",
1105
+ onClick: updateInfo
1106
+ }), /* @__PURE__ */ React2.createElement(Toolbar.Separator, {
1107
+ variant: "gap"
1108
+ }), /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.TextInput, {
1109
+ type: "number",
1110
+ min: 1,
1111
+ max: 100,
1112
+ placeholder: "Count",
1113
+ classNames: "!w-[4rem] !text-right",
1114
+ size: 8,
1115
+ value: count,
1116
+ onChange: (ev) => setCount(parseInt(ev.target.value))
1117
+ }))), /* @__PURE__ */ React2.createElement("div", {
1118
+ className: "flex flex-col overflow-y-auto divide-y divide-separator"
1119
+ }, /* @__PURE__ */ React2.createElement(SchemaTable, {
1120
+ types: staticTypes,
1121
+ objects: info.objects,
1122
+ label: "Static Types",
1123
+ onClick: handleCreateData
1124
+ }), /* @__PURE__ */ React2.createElement(SchemaTable, {
1125
+ types: recordTypes,
1126
+ objects: info.objects,
1127
+ label: "Record Types",
1128
+ onClick: handleCreateData
1129
+ }), /* @__PURE__ */ React2.createElement(SchemaTable, {
1130
+ types: presets.types,
1131
+ objects: info.objects,
1132
+ label: "Presets",
1133
+ onClick: handleCreateData
1134
+ }), /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
1135
+ language: "json",
1136
+ classNames: "text-xs"
1137
+ }, JSON.stringify({
1138
+ space,
1139
+ ...info
1140
+ }, jsonKeyReplacer({
1141
+ truncate: true
1142
+ }), 2)))));
1145
1143
  };
1146
1144
 
1147
1145
  // src/components/SpaceGenerator/index.ts
@@ -1149,4 +1147,4 @@ var SpaceGenerator_default = SpaceGenerator;
1149
1147
  export {
1150
1148
  SpaceGenerator_default as default
1151
1149
  };
1152
- //# sourceMappingURL=SpaceGenerator-BED4UXGS.mjs.map
1150
+ //# sourceMappingURL=SpaceGenerator-ZHVZWGM7.mjs.map