@dxos/plugin-explorer 0.8.4-main.70d3990 → 0.8.4-main.74a063c4e0

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 (121) hide show
  1. package/dist/lib/browser/{chunk-UBHZGWZQ.mjs → chunk-LSUP47BZ.mjs} +2 -2
  2. package/dist/lib/browser/chunk-LSUP47BZ.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +11343 -81
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/meta.mjs +1 -1
  7. package/dist/lib/browser/types/index.mjs +64 -5
  8. package/dist/lib/browser/types/index.mjs.map +4 -4
  9. package/dist/lib/node-esm/{chunk-UXZM5VJB.mjs → chunk-EN3JZNEY.mjs} +2 -2
  10. package/dist/lib/node-esm/chunk-EN3JZNEY.mjs.map +7 -0
  11. package/dist/lib/node-esm/index.mjs +11343 -81
  12. package/dist/lib/node-esm/index.mjs.map +4 -4
  13. package/dist/lib/node-esm/meta.json +1 -1
  14. package/dist/lib/node-esm/meta.mjs +1 -1
  15. package/dist/lib/node-esm/types/index.mjs +64 -5
  16. package/dist/lib/node-esm/types/index.mjs.map +4 -4
  17. package/dist/types/src/ExplorerPlugin.d.ts +2 -1
  18. package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
  19. package/dist/types/src/capabilities/index.d.ts +2 -2
  20. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  21. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  22. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  23. package/dist/types/src/components/Chart/Chart.stories.d.ts.map +1 -1
  24. package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
  25. package/dist/types/src/components/Graph/D3ForceGraph.d.ts +10 -5
  26. package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +1 -1
  27. package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts +8 -2
  28. package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts.map +1 -1
  29. package/dist/types/src/components/Graph/ForceGraph.stories.d.ts +1 -1
  30. package/dist/types/src/components/Graph/ForceGraph.stories.d.ts.map +1 -1
  31. package/dist/types/src/components/Graph/adapter.d.ts +1 -1
  32. package/dist/types/src/components/Graph/adapter.d.ts.map +1 -1
  33. package/dist/types/src/components/Graph/testing.d.ts.map +1 -1
  34. package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
  35. package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
  36. package/dist/types/src/components/Tree/testing/generator.d.ts.map +1 -1
  37. package/dist/types/src/components/Tree/types/tree.d.ts +18 -16
  38. package/dist/types/src/components/Tree/types/tree.d.ts.map +1 -1
  39. package/dist/types/src/components/Tree/types/types.d.ts +1 -1
  40. package/dist/types/src/components/Tree/types/types.d.ts.map +1 -1
  41. package/dist/types/src/components/index.d.ts +0 -2
  42. package/dist/types/src/components/index.d.ts.map +1 -1
  43. package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts +6 -0
  44. package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts.map +1 -0
  45. package/dist/types/src/containers/ExplorerContainer/index.d.ts +2 -0
  46. package/dist/types/src/containers/ExplorerContainer/index.d.ts.map +1 -0
  47. package/dist/types/src/containers/index.d.ts +3 -0
  48. package/dist/types/src/containers/index.d.ts.map +1 -0
  49. package/dist/types/src/hooks/useGraphModel.d.ts.map +1 -1
  50. package/dist/types/src/meta.d.ts +2 -2
  51. package/dist/types/src/meta.d.ts.map +1 -1
  52. package/dist/types/src/translations.d.ts +29 -28
  53. package/dist/types/src/translations.d.ts.map +1 -1
  54. package/dist/types/src/types/ExplorerAction.d.ts +0 -17
  55. package/dist/types/src/types/ExplorerAction.d.ts.map +1 -1
  56. package/dist/types/src/types/Graph.d.ts +10 -19
  57. package/dist/types/src/types/Graph.d.ts.map +1 -1
  58. package/dist/types/tsconfig.tsbuildinfo +1 -1
  59. package/package.json +59 -46
  60. package/src/ExplorerPlugin.tsx +42 -43
  61. package/src/capabilities/index.ts +2 -3
  62. package/src/capabilities/react-surface.tsx +22 -18
  63. package/src/components/Chart/Chart.stories.tsx +3 -4
  64. package/src/components/Globe/Globe.stories.tsx +3 -4
  65. package/src/components/Graph/D3ForceGraph.stories.tsx +20 -17
  66. package/src/components/Graph/D3ForceGraph.tsx +82 -75
  67. package/src/components/Graph/ForceGraph.stories.tsx +20 -17
  68. package/src/components/Graph/adapter.ts +14 -8
  69. package/src/components/Graph/testing.ts +8 -5
  70. package/src/components/Tree/Tree.stories.tsx +9 -6
  71. package/src/components/Tree/Tree.tsx +8 -3
  72. package/src/components/Tree/testing/generator.ts +4 -2
  73. package/src/components/Tree/types/tree.test.ts +5 -4
  74. package/src/components/Tree/types/tree.ts +41 -20
  75. package/src/components/Tree/types/types.ts +1 -1
  76. package/src/components/index.ts +0 -4
  77. package/src/containers/ExplorerContainer/ExplorerContainer.tsx +53 -0
  78. package/src/containers/ExplorerContainer/index.ts +5 -0
  79. package/src/containers/index.ts +7 -0
  80. package/src/hooks/useGraphModel.ts +17 -10
  81. package/src/meta.ts +3 -3
  82. package/src/translations.ts +13 -12
  83. package/src/types/ExplorerAction.ts +0 -17
  84. package/src/types/Graph.ts +13 -27
  85. package/src/typings.d.ts +8 -0
  86. package/dist/lib/browser/ExplorerContainer-NOLLVUTE.mjs +0 -50
  87. package/dist/lib/browser/ExplorerContainer-NOLLVUTE.mjs.map +0 -7
  88. package/dist/lib/browser/chunk-2MKBRIUT.mjs +0 -31
  89. package/dist/lib/browser/chunk-2MKBRIUT.mjs.map +0 -7
  90. package/dist/lib/browser/chunk-6BVXZQPP.mjs +0 -188
  91. package/dist/lib/browser/chunk-6BVXZQPP.mjs.map +0 -7
  92. package/dist/lib/browser/chunk-ARBGXQFH.mjs +0 -11089
  93. package/dist/lib/browser/chunk-ARBGXQFH.mjs.map +0 -7
  94. package/dist/lib/browser/chunk-P6FFFVPM.mjs +0 -100
  95. package/dist/lib/browser/chunk-P6FFFVPM.mjs.map +0 -7
  96. package/dist/lib/browser/chunk-UBHZGWZQ.mjs.map +0 -7
  97. package/dist/lib/browser/intent-resolver-EWB3H5KH.mjs +0 -35
  98. package/dist/lib/browser/intent-resolver-EWB3H5KH.mjs.map +0 -7
  99. package/dist/lib/browser/react-surface-BY2DYCTH.mjs +0 -34
  100. package/dist/lib/browser/react-surface-BY2DYCTH.mjs.map +0 -7
  101. package/dist/lib/node-esm/ExplorerContainer-N3S5KSUX.mjs +0 -51
  102. package/dist/lib/node-esm/ExplorerContainer-N3S5KSUX.mjs.map +0 -7
  103. package/dist/lib/node-esm/chunk-3ODK27PU.mjs +0 -33
  104. package/dist/lib/node-esm/chunk-3ODK27PU.mjs.map +0 -7
  105. package/dist/lib/node-esm/chunk-4BY2XZET.mjs +0 -101
  106. package/dist/lib/node-esm/chunk-4BY2XZET.mjs.map +0 -7
  107. package/dist/lib/node-esm/chunk-CRSVAZNA.mjs +0 -190
  108. package/dist/lib/node-esm/chunk-CRSVAZNA.mjs.map +0 -7
  109. package/dist/lib/node-esm/chunk-NPIP4VEH.mjs +0 -11091
  110. package/dist/lib/node-esm/chunk-NPIP4VEH.mjs.map +0 -7
  111. package/dist/lib/node-esm/chunk-UXZM5VJB.mjs.map +0 -7
  112. package/dist/lib/node-esm/intent-resolver-SH6PW7VF.mjs +0 -36
  113. package/dist/lib/node-esm/intent-resolver-SH6PW7VF.mjs.map +0 -7
  114. package/dist/lib/node-esm/react-surface-7AAV7GBG.mjs +0 -35
  115. package/dist/lib/node-esm/react-surface-7AAV7GBG.mjs.map +0 -7
  116. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  117. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  118. package/dist/types/src/components/ExplorerContainer.d.ts +0 -9
  119. package/dist/types/src/components/ExplorerContainer.d.ts.map +0 -1
  120. package/src/capabilities/intent-resolver.ts +0 -23
  121. package/src/components/ExplorerContainer.tsx +0 -54
@@ -1,100 +0,0 @@
1
- import {
2
- meta
3
- } from "./chunk-UBHZGWZQ.mjs";
4
- import {
5
- __export
6
- } from "./chunk-J5LGTIGS.mjs";
7
-
8
- // src/types/ExplorerAction.ts
9
- var ExplorerAction_exports = {};
10
- __export(ExplorerAction_exports, {
11
- CreateGraph: () => CreateGraph,
12
- GraphProps: () => GraphProps
13
- });
14
- import * as Schema2 from "effect/Schema";
15
- import { TypeInputOptionsAnnotation } from "@dxos/plugin-space/types";
16
- import { SpaceSchema } from "@dxos/react-client/echo";
17
-
18
- // src/types/Graph.ts
19
- var Graph_exports = {};
20
- __export(Graph_exports, {
21
- Graph: () => Graph,
22
- GraphV1: () => GraphV1,
23
- make: () => make
24
- });
25
- import * as Schema from "effect/Schema";
26
- import { Filter, Obj, Query, QueryAST, Ref, Type } from "@dxos/echo";
27
- import { FormInputAnnotation, LabelAnnotation } from "@dxos/echo/internal";
28
- import { View, ViewAnnotation } from "@dxos/schema";
29
- var GraphSchema = Schema.Struct({
30
- name: Schema.optional(Schema.String),
31
- view: Type.Ref(View.View).pipe(FormInputAnnotation.set(false)),
32
- query: Schema.Struct({
33
- raw: Schema.optional(Schema.String),
34
- ast: QueryAST.Query
35
- }).pipe(Schema.mutable, FormInputAnnotation.set(false))
36
- }).pipe(Type.Obj({
37
- typename: "dxos.org/type/Graph",
38
- version: "0.2.0"
39
- }), LabelAnnotation.set([
40
- "name"
41
- ]), ViewAnnotation.set(true));
42
- var Graph = GraphSchema;
43
- var make = ({ name, query = {
44
- raw: "",
45
- ast: Query.select(Filter.nothing()).ast
46
- }, view }) => {
47
- return Obj.make(Graph, {
48
- name,
49
- view: Ref.make(view),
50
- query
51
- });
52
- };
53
- var GraphV1 = Schema.Struct({
54
- name: Schema.optional(Schema.String),
55
- query: Schema.Struct({
56
- raw: Schema.optional(Schema.String),
57
- ast: QueryAST.Query
58
- }).pipe(Schema.mutable)
59
- }).pipe(Type.Obj({
60
- typename: "dxos.org/type/Graph",
61
- version: "0.1.0"
62
- }), LabelAnnotation.set([
63
- "name"
64
- ]));
65
-
66
- // src/types/ExplorerAction.ts
67
- var EXPLORER_ACTION = `${meta.id}/action`;
68
- var GraphProps = Schema2.Struct({
69
- name: Schema2.optional(Schema2.String),
70
- // TODO(wittjosiah): This should be a query input instead.
71
- typename: Schema2.String.pipe(Schema2.annotations({
72
- title: "Select type"
73
- }), TypeInputOptionsAnnotation.set({
74
- location: [
75
- "database",
76
- "runtime"
77
- ],
78
- kind: [
79
- "user"
80
- ],
81
- registered: [
82
- "registered"
83
- ]
84
- }), Schema2.optional)
85
- });
86
- var CreateGraph = class extends Schema2.TaggedClass()(`${EXPLORER_ACTION}/create-graph`, {
87
- input: Schema2.Struct({
88
- space: SpaceSchema
89
- }).pipe(Schema2.extend(GraphProps)),
90
- output: Schema2.Struct({
91
- object: Graph
92
- })
93
- }) {
94
- };
95
-
96
- export {
97
- Graph_exports,
98
- ExplorerAction_exports
99
- };
100
- //# sourceMappingURL=chunk-P6FFFVPM.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/ExplorerAction.ts", "../../../src/types/Graph.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { TypeInputOptionsAnnotation } from '@dxos/plugin-space/types';\nimport { SpaceSchema } from '@dxos/react-client/echo';\n\nimport { meta } from '../meta';\n\nimport * as Graph from './Graph';\n\nconst EXPLORER_ACTION = `${meta.id}/action`;\n\nexport const GraphProps = Schema.Struct({\n name: Schema.optional(Schema.String),\n // TODO(wittjosiah): This should be a query input instead.\n typename: Schema.String.pipe(\n Schema.annotations({ title: 'Select type' }),\n TypeInputOptionsAnnotation.set({\n location: ['database', 'runtime'],\n kind: ['user'],\n registered: ['registered'],\n }),\n Schema.optional,\n ),\n});\n\nexport class CreateGraph extends Schema.TaggedClass<CreateGraph>()(`${EXPLORER_ACTION}/create-graph`, {\n input: Schema.Struct({\n space: SpaceSchema,\n }).pipe(Schema.extend(GraphProps)),\n output: Schema.Struct({\n object: Graph.Graph,\n }),\n}) {}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Filter, Obj, Query, QueryAST, Ref, Type } from '@dxos/echo';\nimport { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';\nimport { View, ViewAnnotation } from '@dxos/schema';\n\nconst GraphSchema = Schema.Struct({\n name: Schema.optional(Schema.String),\n\n view: Type.Ref(View.View).pipe(FormInputAnnotation.set(false)),\n\n query: Schema.Struct({\n raw: Schema.optional(Schema.String),\n ast: QueryAST.Query,\n }).pipe(Schema.mutable, FormInputAnnotation.set(false)),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Graph',\n version: '0.2.0',\n }),\n LabelAnnotation.set(['name']),\n ViewAnnotation.set(true),\n);\nexport interface Graph extends Schema.Schema.Type<typeof GraphSchema> {}\nexport interface GraphEncoded extends Schema.Schema.Encoded<typeof GraphSchema> {}\nexport const Graph: Schema.Schema<Graph, GraphEncoded> = GraphSchema;\n\ntype MakeProps = Omit<Partial<Obj.MakeProps<typeof Graph>>, 'view'> & {\n view: View.View;\n};\n\n/**\n * Make a graph as a view of a data set.\n */\nexport const make = ({\n name,\n query = { raw: '', ast: Query.select(Filter.nothing()).ast },\n view,\n}: MakeProps): Graph => {\n return Obj.make(Graph, { name, view: Ref.make(view), query });\n};\n\n//\n// V1\n//\n\nexport const GraphV1 = Schema.Struct({\n name: Schema.optional(Schema.String),\n query: Schema.Struct({\n raw: Schema.optional(Schema.String),\n ast: QueryAST.Query,\n }).pipe(Schema.mutable),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Graph',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n);\n"],
5
- "mappings": ";;;;;;;;AAAA;;;;;AAIA,YAAYA,aAAY;AAExB,SAASC,kCAAkC;AAC3C,SAASC,mBAAmB;;;ACP5B;;;;;;AAIA,YAAYC,YAAY;AAExB,SAASC,QAAQC,KAAKC,OAAOC,UAAUC,KAAKC,YAAY;AACxD,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,MAAMC,sBAAsB;AAErC,IAAMC,cAAqBC,cAAO;EAChCC,MAAaC,gBAAgBC,aAAM;EAEnCC,MAAMC,KAAKC,IAAIC,KAAKA,IAAI,EAAEC,KAAKC,oBAAoBC,IAAI,KAAA,CAAA;EAEvDC,OAAcX,cAAO;IACnBY,KAAYV,gBAAgBC,aAAM;IAClCU,KAAKC,SAASC;EAChB,CAAA,EAAGP,KAAYQ,gBAASP,oBAAoBC,IAAI,KAAA,CAAA;AAClD,CAAA,EAAGF,KACDH,KAAKY,IAAI;EACPC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBV,IAAI;EAAC;CAAO,GAC5BW,eAAeX,IAAI,IAAA,CAAA;AAId,IAAMY,QAA4CvB;AASlD,IAAMwB,OAAO,CAAC,EACnBtB,MACAU,QAAQ;EAAEC,KAAK;EAAIC,KAAKE,MAAMS,OAAOC,OAAOC,QAAO,CAAA,EAAIb;AAAI,GAC3DT,KAAI,MACM;AACV,SAAOa,IAAIM,KAAKD,OAAO;IAAErB;IAAMG,MAAME,IAAIiB,KAAKnB,IAAAA;IAAOO;EAAM,CAAA;AAC7D;AAMO,IAAMgB,UAAiB3B,cAAO;EACnCC,MAAaC,gBAAgBC,aAAM;EACnCQ,OAAcX,cAAO;IACnBY,KAAYV,gBAAgBC,aAAM;IAClCU,KAAKC,SAASC;EAChB,CAAA,EAAGP,KAAYQ,cAAO;AACxB,CAAA,EAAGR,KACDH,KAAKY,IAAI;EACPC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBV,IAAI;EAAC;CAAO,CAAA;;;ADhD9B,IAAMkB,kBAAkB,GAAGC,KAAKC,EAAE;AAE3B,IAAMC,aAAoBC,eAAO;EACtCC,MAAaC,iBAAgBC,cAAM;;EAEnCC,UAAiBD,eAAOE,KACfC,oBAAY;IAAEC,OAAO;EAAc,CAAA,GAC1CC,2BAA2BC,IAAI;IAC7BC,UAAU;MAAC;MAAY;;IACvBC,MAAM;MAAC;;IACPC,YAAY;MAAC;;EACf,CAAA,GACOV,gBAAQ;AAEnB,CAAA;AAEO,IAAMW,cAAN,cAAiCC,oBAAW,EAAgB,GAAGlB,eAAAA,iBAAgC;EACpGmB,OAAcf,eAAO;IACnBgB,OAAOC;EACT,CAAA,EAAGZ,KAAYa,eAAOnB,UAAAA,CAAAA;EACtBoB,QAAenB,eAAO;IACpBoB,QAAcC;EAChB,CAAA;AACF,CAAA,EAAA;AAAI;",
6
- "names": ["Schema", "TypeInputOptionsAnnotation", "SpaceSchema", "Schema", "Filter", "Obj", "Query", "QueryAST", "Ref", "Type", "FormInputAnnotation", "LabelAnnotation", "View", "ViewAnnotation", "GraphSchema", "Struct", "name", "optional", "String", "view", "Type", "Ref", "View", "pipe", "FormInputAnnotation", "set", "query", "raw", "ast", "QueryAST", "Query", "mutable", "Obj", "typename", "version", "LabelAnnotation", "ViewAnnotation", "Graph", "make", "select", "Filter", "nothing", "GraphV1", "EXPLORER_ACTION", "meta", "id", "GraphProps", "Struct", "name", "optional", "String", "typename", "pipe", "annotations", "title", "TypeInputOptionsAnnotation", "set", "location", "kind", "registered", "CreateGraph", "TaggedClass", "input", "space", "SpaceSchema", "extend", "output", "object", "Graph"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: PluginMeta = {\n id: 'dxos.org/plugin/explorer',\n name: 'Explorer',\n description: trim`\n Interactive hypergraph visualization that reveals relationships between objects in your workspace.\n Navigate complex data structures and discover connections through a dynamic network view.\n `,\n icon: 'ph--graph--regular',\n iconHue: 'green',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-explorer',\n tags: ['labs'],\n screenshots: ['https://dxos.network/plugin-details-explorer-dark.png'],\n};\n"],
5
- "mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,MAAM;IAAC;;EACPC,aAAa;IAAC;;AAChB;",
6
- "names": ["trim", "meta", "id", "name", "description", "trim", "icon", "iconHue", "source", "tags", "screenshots"]
7
- }
@@ -1,35 +0,0 @@
1
- import {
2
- ExplorerAction_exports,
3
- Graph_exports
4
- } from "./chunk-P6FFFVPM.mjs";
5
- import "./chunk-UBHZGWZQ.mjs";
6
- import "./chunk-J5LGTIGS.mjs";
7
-
8
- // src/capabilities/intent-resolver.ts
9
- import { Capabilities, contributes, createResolver } from "@dxos/app-framework";
10
- import { ClientCapabilities } from "@dxos/plugin-client";
11
- import { View } from "@dxos/schema";
12
- var intent_resolver_default = ((context) => contributes(Capabilities.IntentResolver, createResolver({
13
- intent: ExplorerAction_exports.CreateGraph,
14
- resolve: async ({ space, name, typename }) => {
15
- const client = context.getCapability(ClientCapabilities.Client);
16
- const { view } = await View.makeFromSpace({
17
- client,
18
- space,
19
- typename
20
- });
21
- const graph = Graph_exports.make({
22
- name,
23
- view
24
- });
25
- return {
26
- data: {
27
- object: graph
28
- }
29
- };
30
- }
31
- })));
32
- export {
33
- intent_resolver_default as default
34
- };
35
- //# sourceMappingURL=intent-resolver-EWB3H5KH.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/intent-resolver.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, type PluginContext, contributes, createResolver } from '@dxos/app-framework';\nimport { ClientCapabilities } from '@dxos/plugin-client';\nimport { View } from '@dxos/schema';\n\nimport { ExplorerAction, Graph } from '../types';\n\nexport default (context: PluginContext) =>\n contributes(\n Capabilities.IntentResolver,\n createResolver({\n intent: ExplorerAction.CreateGraph,\n resolve: async ({ space, name, typename }) => {\n const client = context.getCapability(ClientCapabilities.Client);\n const { view } = await View.makeFromSpace({ client, space, typename });\n const graph = Graph.make({ name, view });\n return { data: { object: graph } };\n },\n }),\n );\n"],
5
- "mappings": ";;;;;;;;AAIA,SAASA,cAAkCC,aAAaC,sBAAsB;AAC9E,SAASC,0BAA0B;AACnC,SAASC,YAAY;AAIrB,IAAA,2BAAe,CAACC,YACdC,YACEC,aAAaC,gBACbC,eAAe;EACbC,QAAQC,uBAAeC;EACvBC,SAAS,OAAO,EAAEC,OAAOC,MAAMC,SAAQ,MAAE;AACvC,UAAMC,SAASZ,QAAQa,cAAcC,mBAAmBC,MAAM;AAC9D,UAAM,EAAEC,KAAI,IAAK,MAAMC,KAAKC,cAAc;MAAEN;MAAQH;MAAOE;IAAS,CAAA;AACpE,UAAMQ,QAAQC,cAAMC,KAAK;MAAEX;MAAMM;IAAK,CAAA;AACtC,WAAO;MAAEM,MAAM;QAAEC,QAAQJ;MAAM;IAAE;EACnC;AACF,CAAA,CAAA;",
6
- "names": ["Capabilities", "contributes", "createResolver", "ClientCapabilities", "View", "context", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "ExplorerAction", "CreateGraph", "resolve", "space", "name", "typename", "client", "getCapability", "ClientCapabilities", "Client", "view", "View", "makeFromSpace", "graph", "Graph", "make", "data", "object"]
7
- }
@@ -1,34 +0,0 @@
1
- import {
2
- ExplorerContainer
3
- } from "./chunk-ARBGXQFH.mjs";
4
- import "./chunk-6BVXZQPP.mjs";
5
- import {
6
- Graph_exports
7
- } from "./chunk-P6FFFVPM.mjs";
8
- import {
9
- meta
10
- } from "./chunk-UBHZGWZQ.mjs";
11
- import "./chunk-J5LGTIGS.mjs";
12
-
13
- // src/capabilities/react-surface.tsx
14
- import React from "react";
15
- import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
16
- import { Obj } from "@dxos/echo";
17
- var react_surface_default = (() => contributes(Capabilities.ReactSurface, createSurface({
18
- id: `${meta.id}/article`,
19
- role: [
20
- "article",
21
- "section"
22
- ],
23
- filter: (data) => Obj.instanceOf(Graph_exports.Graph, data.subject),
24
- component: ({ data, role }) => {
25
- return /* @__PURE__ */ React.createElement(ExplorerContainer, {
26
- view: data.subject,
27
- role
28
- });
29
- }
30
- })));
31
- export {
32
- react_surface_default as default
33
- };
34
- //# sourceMappingURL=react-surface-BY2DYCTH.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/react-surface.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\nimport { type View } from '@dxos/schema';\n\nimport { ExplorerContainer } from '../components';\nimport { meta } from '../meta';\nimport { Graph } from '../types';\n\nexport default () =>\n contributes(\n Capabilities.ReactSurface,\n createSurface({\n id: `${meta.id}/article`,\n role: ['article', 'section'],\n filter: (data): data is { subject: View.View } => Obj.instanceOf(Graph.Graph, data.subject),\n component: ({ data, role }) => {\n return <ExplorerContainer view={data.subject} role={role} />;\n },\n }),\n );\n"],
5
- "mappings": ";;;;;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,cAAcC,aAAaC,qBAAqB;AACzD,SAASC,WAAW;AAOpB,IAAA,yBAAe,MACbC,YACEC,aAAaC,cACbC,cAAc;EACZC,IAAI,GAAGC,KAAKD,EAAE;EACdE,MAAM;IAAC;IAAW;;EAClBC,QAAQ,CAACC,SAAyCC,IAAIC,WAAWC,cAAMA,OAAOH,KAAKI,OAAO;EAC1FC,WAAW,CAAC,EAAEL,MAAMF,KAAI,MAAE;AACxB,WAAO,sBAAA,cAACQ,mBAAAA;MAAkBC,MAAMP,KAAKI;MAASN;;EAChD;AACF,CAAA,CAAA;",
6
- "names": ["React", "Capabilities", "contributes", "createSurface", "Obj", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "Obj", "instanceOf", "Graph", "subject", "component", "ExplorerContainer", "view"]
7
- }
@@ -1,51 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- useGraphModel
4
- } from "./chunk-3ODK27PU.mjs";
5
- import {
6
- D3ForceGraph
7
- } from "./chunk-CRSVAZNA.mjs";
8
- import "./chunk-HSLMI22Q.mjs";
9
-
10
- // src/components/ExplorerContainer.tsx
11
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
12
- import React, { useCallback, useMemo, useState } from "react";
13
- import { QueryBuilder } from "@dxos/echo-query";
14
- import { useGlobalSearch } from "@dxos/plugin-search";
15
- import { getSpace } from "@dxos/react-client/echo";
16
- import { Toolbar } from "@dxos/react-ui";
17
- import { QueryEditor } from "@dxos/react-ui-components";
18
- import { StackItem } from "@dxos/react-ui-stack";
19
- var ExplorerContainer = ({ role, view }) => {
20
- var _effect = _useSignals();
21
- try {
22
- const space = getSpace(view);
23
- const [filter, setFilter] = useState();
24
- const model = useGraphModel(space, filter);
25
- const { match } = useGlobalSearch();
26
- const builder = useMemo(() => new QueryBuilder(), []);
27
- const handleChange = useCallback((value) => {
28
- setFilter(builder.build(value).filter);
29
- }, []);
30
- const showToolbar = role === "article";
31
- if (!space || !model) {
32
- return null;
33
- }
34
- return /* @__PURE__ */ React.createElement(StackItem.Content, {
35
- toolbar: showToolbar
36
- }, showToolbar && /* @__PURE__ */ React.createElement(Toolbar.Root, null, /* @__PURE__ */ React.createElement(QueryEditor, {
37
- db: space.db,
38
- onChange: handleChange
39
- })), /* @__PURE__ */ React.createElement(D3ForceGraph, {
40
- model,
41
- match
42
- }));
43
- } finally {
44
- _effect.f();
45
- }
46
- };
47
- var ExplorerContainer_default = ExplorerContainer;
48
- export {
49
- ExplorerContainer_default as default
50
- };
51
- //# sourceMappingURL=ExplorerContainer-N3S5KSUX.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/ExplorerContainer.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useCallback, useMemo, useState } from 'react';\n\nimport { type Filter } from '@dxos/echo';\nimport { QueryBuilder } from '@dxos/echo-query';\nimport { useGlobalSearch } from '@dxos/plugin-search';\nimport { getSpace } from '@dxos/react-client/echo';\nimport { Toolbar } from '@dxos/react-ui';\nimport { QueryEditor, type QueryEditorProps } from '@dxos/react-ui-components';\nimport { StackItem } from '@dxos/react-ui-stack';\nimport { type View } from '@dxos/schema';\n\nimport { useGraphModel } from '../hooks';\n\nimport { D3ForceGraph } from './Graph';\n\ntype ExplorerContainerProps = {\n role: string;\n view: View.View;\n};\n\nconst ExplorerContainer = ({ role, view }: ExplorerContainerProps) => {\n const space = getSpace(view);\n const [filter, setFilter] = useState<Filter.Any>();\n const model = useGraphModel(space, filter);\n const { match } = useGlobalSearch();\n\n const builder = useMemo(() => new QueryBuilder(), []);\n const handleChange = useCallback<NonNullable<QueryEditorProps['onChange']>>((value) => {\n setFilter(builder.build(value).filter);\n }, []);\n\n const showToolbar = role === 'article';\n\n if (!space || !model) {\n return null;\n }\n\n return (\n <StackItem.Content toolbar={showToolbar}>\n {showToolbar && (\n <Toolbar.Root>\n <QueryEditor db={space.db} onChange={handleChange} />\n </Toolbar.Root>\n )}\n <D3ForceGraph model={model} match={match} />\n </StackItem.Content>\n );\n};\n\nexport default ExplorerContainer;\n"],
5
- "mappings": ";;;;;;;;;;;AAIA,OAAOA,SAASC,aAAaC,SAASC,gBAAgB;AAGtD,SAASC,oBAAoB;AAC7B,SAASC,uBAAuB;AAChC,SAASC,gBAAgB;AACzB,SAASC,eAAe;AACxB,SAASC,mBAA0C;AACnD,SAASC,iBAAiB;AAY1B,IAAMC,oBAAoB,CAAC,EAAEC,MAAMC,KAAI,MAA0B;;;AAC/D,UAAMC,QAAQC,SAASF,IAAAA;AACvB,UAAM,CAACG,QAAQC,SAAAA,IAAaC,SAAAA;AAC5B,UAAMC,QAAQC,cAAcN,OAAOE,MAAAA;AACnC,UAAM,EAAEK,MAAK,IAAKC,gBAAAA;AAElB,UAAMC,UAAUC,QAAQ,MAAM,IAAIC,aAAAA,GAAgB,CAAA,CAAE;AACpD,UAAMC,eAAeC,YAAuD,CAACC,UAAAA;AAC3EX,gBAAUM,QAAQM,MAAMD,KAAAA,EAAOZ,MAAM;IACvC,GAAG,CAAA,CAAE;AAEL,UAAMc,cAAclB,SAAS;AAE7B,QAAI,CAACE,SAAS,CAACK,OAAO;AACpB,aAAO;IACT;AAEA,WACE,sBAAA,cAACY,UAAUC,SAAO;MAACC,SAASH;OACzBA,eACC,sBAAA,cAACI,QAAQC,MAAI,MACX,sBAAA,cAACC,aAAAA;MAAYC,IAAIvB,MAAMuB;MAAIC,UAAUZ;SAGzC,sBAAA,cAACa,cAAAA;MAAapB;MAAcE;;;;;AAGlC;AAEA,IAAA,4BAAeV;",
6
- "names": ["React", "useCallback", "useMemo", "useState", "QueryBuilder", "useGlobalSearch", "getSpace", "Toolbar", "QueryEditor", "StackItem", "ExplorerContainer", "role", "view", "space", "getSpace", "filter", "setFilter", "useState", "model", "useGraphModel", "match", "useGlobalSearch", "builder", "useMemo", "QueryBuilder", "handleChange", "useCallback", "value", "build", "showToolbar", "StackItem", "Content", "toolbar", "Toolbar", "Root", "QueryEditor", "db", "onChange", "D3ForceGraph"]
7
- }
@@ -1,33 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
-
3
- // src/hooks/useGraphModel.ts
4
- import { useEffect, useState } from "react";
5
- import { SpaceGraphModel } from "@dxos/schema";
6
- var useGraphModel = (space, filter, options, queue) => {
7
- const [model, setModel] = useState(void 0);
8
- useEffect(() => {
9
- if (!space) {
10
- void model?.close();
11
- setModel(void 0);
12
- return;
13
- }
14
- if (!model || model.queue !== queue) {
15
- const model2 = new SpaceGraphModel().setFilter(filter).setOptions(options);
16
- void model2.open(space, queue);
17
- setModel(model2);
18
- } else {
19
- model.setFilter(filter).setOptions(options);
20
- }
21
- }, [
22
- space,
23
- filter,
24
- options,
25
- queue
26
- ]);
27
- return model;
28
- };
29
-
30
- export {
31
- useGraphModel
32
- };
33
- //# sourceMappingURL=chunk-3ODK27PU.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/hooks/useGraphModel.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { type Filter, type Queue, type Space } from '@dxos/client/echo';\nimport { SpaceGraphModel, type SpaceGraphModelOptions } from '@dxos/schema';\n\n// TODO(burdon): Factor out.\nexport const useGraphModel = (\n space: Space | undefined,\n filter?: Filter.Any | undefined,\n options?: SpaceGraphModelOptions,\n queue?: Queue,\n): SpaceGraphModel | undefined => {\n const [model, setModel] = useState<SpaceGraphModel | undefined>(undefined);\n useEffect(() => {\n if (!space) {\n void model?.close();\n setModel(undefined);\n return;\n }\n\n // TODO(burdon): Does this need to be a dependency?\n if (!model || model.queue !== queue) {\n const model = new SpaceGraphModel().setFilter(filter).setOptions(options);\n void model.open(space, queue);\n setModel(model);\n } else {\n model.setFilter(filter).setOptions(options);\n }\n }, [space, filter, options, queue]);\n\n return model;\n};\n"],
5
- "mappings": ";;;AAIA,SAASA,WAAWC,gBAAgB;AAGpC,SAASC,uBAAoD;AAGtD,IAAMC,gBAAgB,CAC3BC,OACAC,QACAC,SACAC,UAAAA;AAEA,QAAM,CAACC,OAAOC,QAAAA,IAAYC,SAAsCC,MAAAA;AAChEC,YAAU,MAAA;AACR,QAAI,CAACR,OAAO;AACV,WAAKI,OAAOK,MAAAA;AACZJ,eAASE,MAAAA;AACT;IACF;AAGA,QAAI,CAACH,SAASA,MAAMD,UAAUA,OAAO;AACnC,YAAMC,SAAQ,IAAIM,gBAAAA,EAAkBC,UAAUV,MAAAA,EAAQW,WAAWV,OAAAA;AACjE,WAAKE,OAAMS,KAAKb,OAAOG,KAAAA;AACvBE,eAASD,MAAAA;IACX,OAAO;AACLA,YAAMO,UAAUV,MAAAA,EAAQW,WAAWV,OAAAA;IACrC;EACF,GAAG;IAACF;IAAOC;IAAQC;IAASC;GAAM;AAElC,SAAOC;AACT;",
6
- "names": ["useEffect", "useState", "SpaceGraphModel", "useGraphModel", "space", "filter", "options", "queue", "model", "setModel", "useState", "undefined", "useEffect", "close", "SpaceGraphModel", "setFilter", "setOptions", "open"]
7
- }
@@ -1,101 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- meta
4
- } from "./chunk-UXZM5VJB.mjs";
5
- import {
6
- __export
7
- } from "./chunk-HSLMI22Q.mjs";
8
-
9
- // src/types/ExplorerAction.ts
10
- var ExplorerAction_exports = {};
11
- __export(ExplorerAction_exports, {
12
- CreateGraph: () => CreateGraph,
13
- GraphProps: () => GraphProps
14
- });
15
- import * as Schema2 from "effect/Schema";
16
- import { TypeInputOptionsAnnotation } from "@dxos/plugin-space/types";
17
- import { SpaceSchema } from "@dxos/react-client/echo";
18
-
19
- // src/types/Graph.ts
20
- var Graph_exports = {};
21
- __export(Graph_exports, {
22
- Graph: () => Graph,
23
- GraphV1: () => GraphV1,
24
- make: () => make
25
- });
26
- import * as Schema from "effect/Schema";
27
- import { Filter, Obj, Query, QueryAST, Ref, Type } from "@dxos/echo";
28
- import { FormInputAnnotation, LabelAnnotation } from "@dxos/echo/internal";
29
- import { View, ViewAnnotation } from "@dxos/schema";
30
- var GraphSchema = Schema.Struct({
31
- name: Schema.optional(Schema.String),
32
- view: Type.Ref(View.View).pipe(FormInputAnnotation.set(false)),
33
- query: Schema.Struct({
34
- raw: Schema.optional(Schema.String),
35
- ast: QueryAST.Query
36
- }).pipe(Schema.mutable, FormInputAnnotation.set(false))
37
- }).pipe(Type.Obj({
38
- typename: "dxos.org/type/Graph",
39
- version: "0.2.0"
40
- }), LabelAnnotation.set([
41
- "name"
42
- ]), ViewAnnotation.set(true));
43
- var Graph = GraphSchema;
44
- var make = ({ name, query = {
45
- raw: "",
46
- ast: Query.select(Filter.nothing()).ast
47
- }, view }) => {
48
- return Obj.make(Graph, {
49
- name,
50
- view: Ref.make(view),
51
- query
52
- });
53
- };
54
- var GraphV1 = Schema.Struct({
55
- name: Schema.optional(Schema.String),
56
- query: Schema.Struct({
57
- raw: Schema.optional(Schema.String),
58
- ast: QueryAST.Query
59
- }).pipe(Schema.mutable)
60
- }).pipe(Type.Obj({
61
- typename: "dxos.org/type/Graph",
62
- version: "0.1.0"
63
- }), LabelAnnotation.set([
64
- "name"
65
- ]));
66
-
67
- // src/types/ExplorerAction.ts
68
- var EXPLORER_ACTION = `${meta.id}/action`;
69
- var GraphProps = Schema2.Struct({
70
- name: Schema2.optional(Schema2.String),
71
- // TODO(wittjosiah): This should be a query input instead.
72
- typename: Schema2.String.pipe(Schema2.annotations({
73
- title: "Select type"
74
- }), TypeInputOptionsAnnotation.set({
75
- location: [
76
- "database",
77
- "runtime"
78
- ],
79
- kind: [
80
- "user"
81
- ],
82
- registered: [
83
- "registered"
84
- ]
85
- }), Schema2.optional)
86
- });
87
- var CreateGraph = class extends Schema2.TaggedClass()(`${EXPLORER_ACTION}/create-graph`, {
88
- input: Schema2.Struct({
89
- space: SpaceSchema
90
- }).pipe(Schema2.extend(GraphProps)),
91
- output: Schema2.Struct({
92
- object: Graph
93
- })
94
- }) {
95
- };
96
-
97
- export {
98
- Graph_exports,
99
- ExplorerAction_exports
100
- };
101
- //# sourceMappingURL=chunk-4BY2XZET.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/ExplorerAction.ts", "../../../src/types/Graph.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { TypeInputOptionsAnnotation } from '@dxos/plugin-space/types';\nimport { SpaceSchema } from '@dxos/react-client/echo';\n\nimport { meta } from '../meta';\n\nimport * as Graph from './Graph';\n\nconst EXPLORER_ACTION = `${meta.id}/action`;\n\nexport const GraphProps = Schema.Struct({\n name: Schema.optional(Schema.String),\n // TODO(wittjosiah): This should be a query input instead.\n typename: Schema.String.pipe(\n Schema.annotations({ title: 'Select type' }),\n TypeInputOptionsAnnotation.set({\n location: ['database', 'runtime'],\n kind: ['user'],\n registered: ['registered'],\n }),\n Schema.optional,\n ),\n});\n\nexport class CreateGraph extends Schema.TaggedClass<CreateGraph>()(`${EXPLORER_ACTION}/create-graph`, {\n input: Schema.Struct({\n space: SpaceSchema,\n }).pipe(Schema.extend(GraphProps)),\n output: Schema.Struct({\n object: Graph.Graph,\n }),\n}) {}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Filter, Obj, Query, QueryAST, Ref, Type } from '@dxos/echo';\nimport { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';\nimport { View, ViewAnnotation } from '@dxos/schema';\n\nconst GraphSchema = Schema.Struct({\n name: Schema.optional(Schema.String),\n\n view: Type.Ref(View.View).pipe(FormInputAnnotation.set(false)),\n\n query: Schema.Struct({\n raw: Schema.optional(Schema.String),\n ast: QueryAST.Query,\n }).pipe(Schema.mutable, FormInputAnnotation.set(false)),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Graph',\n version: '0.2.0',\n }),\n LabelAnnotation.set(['name']),\n ViewAnnotation.set(true),\n);\nexport interface Graph extends Schema.Schema.Type<typeof GraphSchema> {}\nexport interface GraphEncoded extends Schema.Schema.Encoded<typeof GraphSchema> {}\nexport const Graph: Schema.Schema<Graph, GraphEncoded> = GraphSchema;\n\ntype MakeProps = Omit<Partial<Obj.MakeProps<typeof Graph>>, 'view'> & {\n view: View.View;\n};\n\n/**\n * Make a graph as a view of a data set.\n */\nexport const make = ({\n name,\n query = { raw: '', ast: Query.select(Filter.nothing()).ast },\n view,\n}: MakeProps): Graph => {\n return Obj.make(Graph, { name, view: Ref.make(view), query });\n};\n\n//\n// V1\n//\n\nexport const GraphV1 = Schema.Struct({\n name: Schema.optional(Schema.String),\n query: Schema.Struct({\n raw: Schema.optional(Schema.String),\n ast: QueryAST.Query,\n }).pipe(Schema.mutable),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Graph',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n);\n"],
5
- "mappings": ";;;;;;;;;AAAA;;;;;AAIA,YAAYA,aAAY;AAExB,SAASC,kCAAkC;AAC3C,SAASC,mBAAmB;;;ACP5B;;;;;;AAIA,YAAYC,YAAY;AAExB,SAASC,QAAQC,KAAKC,OAAOC,UAAUC,KAAKC,YAAY;AACxD,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,MAAMC,sBAAsB;AAErC,IAAMC,cAAqBC,cAAO;EAChCC,MAAaC,gBAAgBC,aAAM;EAEnCC,MAAMC,KAAKC,IAAIC,KAAKA,IAAI,EAAEC,KAAKC,oBAAoBC,IAAI,KAAA,CAAA;EAEvDC,OAAcX,cAAO;IACnBY,KAAYV,gBAAgBC,aAAM;IAClCU,KAAKC,SAASC;EAChB,CAAA,EAAGP,KAAYQ,gBAASP,oBAAoBC,IAAI,KAAA,CAAA;AAClD,CAAA,EAAGF,KACDH,KAAKY,IAAI;EACPC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBV,IAAI;EAAC;CAAO,GAC5BW,eAAeX,IAAI,IAAA,CAAA;AAId,IAAMY,QAA4CvB;AASlD,IAAMwB,OAAO,CAAC,EACnBtB,MACAU,QAAQ;EAAEC,KAAK;EAAIC,KAAKE,MAAMS,OAAOC,OAAOC,QAAO,CAAA,EAAIb;AAAI,GAC3DT,KAAI,MACM;AACV,SAAOa,IAAIM,KAAKD,OAAO;IAAErB;IAAMG,MAAME,IAAIiB,KAAKnB,IAAAA;IAAOO;EAAM,CAAA;AAC7D;AAMO,IAAMgB,UAAiB3B,cAAO;EACnCC,MAAaC,gBAAgBC,aAAM;EACnCQ,OAAcX,cAAO;IACnBY,KAAYV,gBAAgBC,aAAM;IAClCU,KAAKC,SAASC;EAChB,CAAA,EAAGP,KAAYQ,cAAO;AACxB,CAAA,EAAGR,KACDH,KAAKY,IAAI;EACPC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBV,IAAI;EAAC;CAAO,CAAA;;;ADhD9B,IAAMkB,kBAAkB,GAAGC,KAAKC,EAAE;AAE3B,IAAMC,aAAoBC,eAAO;EACtCC,MAAaC,iBAAgBC,cAAM;;EAEnCC,UAAiBD,eAAOE,KACfC,oBAAY;IAAEC,OAAO;EAAc,CAAA,GAC1CC,2BAA2BC,IAAI;IAC7BC,UAAU;MAAC;MAAY;;IACvBC,MAAM;MAAC;;IACPC,YAAY;MAAC;;EACf,CAAA,GACOV,gBAAQ;AAEnB,CAAA;AAEO,IAAMW,cAAN,cAAiCC,oBAAW,EAAgB,GAAGlB,eAAAA,iBAAgC;EACpGmB,OAAcf,eAAO;IACnBgB,OAAOC;EACT,CAAA,EAAGZ,KAAYa,eAAOnB,UAAAA,CAAAA;EACtBoB,QAAenB,eAAO;IACpBoB,QAAcC;EAChB,CAAA;AACF,CAAA,EAAA;AAAI;",
6
- "names": ["Schema", "TypeInputOptionsAnnotation", "SpaceSchema", "Schema", "Filter", "Obj", "Query", "QueryAST", "Ref", "Type", "FormInputAnnotation", "LabelAnnotation", "View", "ViewAnnotation", "GraphSchema", "Struct", "name", "optional", "String", "view", "Type", "Ref", "View", "pipe", "FormInputAnnotation", "set", "query", "raw", "ast", "QueryAST", "Query", "mutable", "Obj", "typename", "version", "LabelAnnotation", "ViewAnnotation", "Graph", "make", "select", "Filter", "nothing", "GraphV1", "EXPLORER_ACTION", "meta", "id", "GraphProps", "Struct", "name", "optional", "String", "typename", "pipe", "annotations", "title", "TypeInputOptionsAnnotation", "set", "location", "kind", "registered", "CreateGraph", "TaggedClass", "input", "space", "SpaceSchema", "extend", "output", "object", "Graph"]
7
- }
@@ -1,190 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
-
3
- // src/components/Graph/D3ForceGraph.tsx
4
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
5
- import React, { useCallback, useEffect, useMemo, useRef } from "react";
6
- import { Obj } from "@dxos/echo";
7
- import { SelectionModel } from "@dxos/graph";
8
- import { GraphForceProjector, SVG } from "@dxos/react-ui-graph";
9
- import { getHashStyles } from "@dxos/react-ui-theme";
10
- import "@dxos/react-ui-graph/styles/graph.css";
11
- var D3ForceGraph = ({ classNames, model, selection: _selection, grid, ...props }) => {
12
- var _effect = _useSignals();
13
- try {
14
- const context = useRef(null);
15
- const projector = useMemo(() => {
16
- if (context.current) {
17
- return new GraphForceProjector(context.current, {
18
- attributes: {
19
- linkForce: (edge) => {
20
- return edge.data?.object?.active !== false;
21
- }
22
- },
23
- forces: {
24
- point: {
25
- strength: 0.01
26
- }
27
- }
28
- });
29
- }
30
- }, [
31
- context.current
32
- ]);
33
- const graph = useRef(null);
34
- const selection = useMemo(() => _selection ?? new SelectionModel(), [
35
- _selection
36
- ]);
37
- useEffect(() => graph.current?.repaint(), [
38
- selection.selected.value
39
- ]);
40
- const handleSelect = useCallback((node) => {
41
- if (selection.contains(node.id)) {
42
- selection.remove(node.id);
43
- } else {
44
- selection.add(node.id);
45
- }
46
- }, [
47
- selection
48
- ]);
49
- return /* @__PURE__ */ React.createElement(SVG.Root, {
50
- ref: context,
51
- classNames
52
- }, /* @__PURE__ */ React.createElement(SVG.Markers, null), grid && /* @__PURE__ */ React.createElement(SVG.Grid, {
53
- axis: true
54
- }), /* @__PURE__ */ React.createElement(SVG.Zoom, {
55
- extent: [
56
- 1 / 2,
57
- 2
58
- ]
59
- }, /* @__PURE__ */ React.createElement(SVG.Graph, {
60
- ...props,
61
- ref: graph,
62
- model,
63
- projector,
64
- labels: {
65
- text: (node) => {
66
- return node.data?.data.label ?? node.id;
67
- }
68
- },
69
- attributes: {
70
- node: (node) => {
71
- const obj = node.data?.data.object;
72
- return {
73
- data: {
74
- color: getHashStyles(obj && Obj.getTypename(obj))?.hue
75
- },
76
- classes: {
77
- "dx-selected": selection.contains(node.id)
78
- }
79
- };
80
- }
81
- },
82
- onSelect: handleSelect
83
- })));
84
- } finally {
85
- _effect.f();
86
- }
87
- };
88
-
89
- // src/components/Graph/ForceGraph.tsx
90
- import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
91
- import { forceLink, forceManyBody } from "d3";
92
- import NativeForceGraph from "force-graph";
93
- import React2, { useEffect as useEffect2, useRef as useRef2, useState } from "react";
94
- import { useResizeDetector } from "react-resize-detector";
95
- import { filterObjectsSync } from "@dxos/plugin-search";
96
-
97
- // src/components/Graph/adapter.ts
98
- var GraphAdapter = class {
99
- graph;
100
- _nodes = [];
101
- _links = [];
102
- constructor(graph) {
103
- this.graph = graph;
104
- this._nodes = graph.nodes.map((node) => ({
105
- id: node.id,
106
- type: node.type,
107
- data: node.data
108
- }));
109
- this._links = graph.edges.map((edge) => ({
110
- type: edge.type,
111
- source: edge.source,
112
- target: edge.target,
113
- data: edge.data
114
- }));
115
- }
116
- get nodes() {
117
- return this._nodes;
118
- }
119
- get links() {
120
- return this._links;
121
- }
122
- };
123
-
124
- // src/components/Graph/ForceGraph.tsx
125
- var ForceGraph = ({ model, match }) => {
126
- var _effect = _useSignals2();
127
- try {
128
- const { ref, width, height } = useResizeDetector({
129
- refreshRate: 200
130
- });
131
- const rootRef = useRef2(null);
132
- const forceGraph = useRef2(null);
133
- const filteredRef = useRef2([]);
134
- filteredRef.current = filterObjectsSync(model?.objects ?? [], match);
135
- const [data, setData] = useState();
136
- useEffect2(() => {
137
- return model?.subscribe((model2) => {
138
- setData(new GraphAdapter(model2.graph));
139
- });
140
- }, [
141
- model
142
- ]);
143
- useEffect2(() => {
144
- if (rootRef.current) {
145
- forceGraph.current = new NativeForceGraph(rootRef.current).nodeRelSize(6).nodeLabel((node) => node.type === "schema" ? node.data.typename : node.data.label ?? node.id).nodeAutoColorBy((node) => node.type === "schema" ? "schema" : node.data.typename).linkAutoColorBy((link) => link.type);
146
- }
147
- return () => {
148
- forceGraph.current?.pauseAnimation().graphData({
149
- nodes: [],
150
- links: []
151
- });
152
- forceGraph.current = null;
153
- };
154
- }, []);
155
- useEffect2(() => {
156
- if (!data || !width || !height || !forceGraph.current) {
157
- return;
158
- }
159
- forceGraph.current.pauseAnimation().width(width).height(height).onEngineStop(() => {
160
- handleZoomToFit();
161
- }).onNodeClick((node) => {
162
- forceGraph.current?.emitParticle(node);
163
- }).d3Force("link", forceLink().distance(160).strength(0.5)).d3Force("charge", forceManyBody().strength(-30)).graphData(data).warmupTicks(100).cooldownTime(1e3).resumeAnimation();
164
- }, [
165
- data,
166
- width,
167
- height,
168
- forceGraph.current
169
- ]);
170
- const handleZoomToFit = () => {
171
- forceGraph.current?.zoomToFit(400, 40);
172
- };
173
- return /* @__PURE__ */ React2.createElement("div", {
174
- ref,
175
- className: "relative grow",
176
- onClick: handleZoomToFit
177
- }, /* @__PURE__ */ React2.createElement("div", {
178
- ref: rootRef,
179
- className: "absolute inset-0"
180
- }));
181
- } finally {
182
- _effect.f();
183
- }
184
- };
185
-
186
- export {
187
- D3ForceGraph,
188
- ForceGraph
189
- };
190
- //# sourceMappingURL=chunk-CRSVAZNA.mjs.map