@dxos/plugin-explorer 0.8.4-main.406dc2a → 0.8.4-main.4668b7de9b

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 (270) hide show
  1. package/LICENSE +102 -5
  2. package/PLUGIN.mdl +340 -0
  3. package/dist/lib/neutral/ExplorerArticle-4I7PNGDC.mjs +459 -0
  4. package/dist/lib/neutral/ExplorerArticle-4I7PNGDC.mjs.map +7 -0
  5. package/dist/lib/neutral/ExplorerPlugin.mjs +10 -0
  6. package/dist/lib/neutral/capabilities/index.mjs +11 -0
  7. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  8. package/dist/lib/neutral/chunk-3D7BYXOR.mjs +37 -0
  9. package/dist/lib/neutral/chunk-3D7BYXOR.mjs.map +7 -0
  10. package/dist/lib/neutral/chunk-42BYLQQA.mjs +42 -0
  11. package/dist/lib/neutral/chunk-42BYLQQA.mjs.map +7 -0
  12. package/dist/lib/neutral/chunk-7XUDLV6E.mjs +287 -0
  13. package/dist/lib/neutral/chunk-7XUDLV6E.mjs.map +7 -0
  14. package/dist/lib/neutral/chunk-HI324IB4.mjs +69 -0
  15. package/dist/lib/neutral/chunk-HI324IB4.mjs.map +7 -0
  16. package/dist/lib/neutral/chunk-IKHJV3Q4.mjs +20 -0
  17. package/dist/lib/neutral/chunk-IKHJV3Q4.mjs.map +7 -0
  18. package/dist/lib/{browser/chunk-MOM5KCKC.mjs → neutral/components/index.mjs} +882 -556
  19. package/dist/lib/neutral/components/index.mjs.map +7 -0
  20. package/dist/lib/neutral/containers/index.mjs +9 -0
  21. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  22. package/dist/lib/neutral/create-object-F6TKVAGV.mjs +39 -0
  23. package/dist/lib/neutral/create-object-F6TKVAGV.mjs.map +7 -0
  24. package/dist/lib/neutral/hooks/index.mjs +45 -0
  25. package/dist/lib/neutral/hooks/index.mjs.map +7 -0
  26. package/dist/lib/neutral/index.mjs +14 -0
  27. package/dist/lib/neutral/meta.json +1 -0
  28. package/dist/lib/{browser → neutral}/meta.mjs +1 -1
  29. package/dist/lib/neutral/plugin.mjs +12 -0
  30. package/dist/lib/neutral/plugin.mjs.map +7 -0
  31. package/dist/lib/neutral/react-surface-APBW2VQG.mjs +26 -0
  32. package/dist/lib/neutral/react-surface-APBW2VQG.mjs.map +7 -0
  33. package/dist/lib/neutral/testing/index.mjs +139 -0
  34. package/dist/lib/neutral/testing/index.mjs.map +7 -0
  35. package/dist/lib/neutral/translations.mjs +33 -0
  36. package/dist/lib/neutral/translations.mjs.map +7 -0
  37. package/dist/lib/{browser → neutral}/types/index.mjs +1 -2
  38. package/dist/types/data/cities.d.ts +4 -4
  39. package/dist/types/data/cities.d.ts.map +1 -1
  40. package/dist/types/data/countries-110m.d.ts +19 -22
  41. package/dist/types/data/countries-110m.d.ts.map +1 -1
  42. package/dist/types/src/ExplorerPlugin.d.ts +3 -1
  43. package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
  44. package/dist/types/src/ExplorerPlugin.test.d.ts +2 -0
  45. package/dist/types/src/ExplorerPlugin.test.d.ts.map +1 -0
  46. package/dist/types/src/capabilities/create-object.d.ts +11 -0
  47. package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
  48. package/dist/types/src/capabilities/index.d.ts +8 -2
  49. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  50. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  51. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  52. package/dist/types/src/components/Chart/Chart.d.ts +1 -1
  53. package/dist/types/src/components/Chart/Chart.d.ts.map +1 -1
  54. package/dist/types/src/components/Chart/Chart.stories.d.ts +4 -1
  55. package/dist/types/src/components/Chart/Chart.stories.d.ts.map +1 -1
  56. package/dist/types/src/components/Globe/Globe.d.ts +1 -1
  57. package/dist/types/src/components/Globe/Globe.d.ts.map +1 -1
  58. package/dist/types/src/components/Globe/Globe.stories.d.ts +5 -2
  59. package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
  60. package/dist/types/src/components/Graph/CanvasForceGraph.d.ts +13 -0
  61. package/dist/types/src/components/Graph/CanvasForceGraph.d.ts.map +1 -0
  62. package/dist/types/src/components/Graph/CanvasForceGraph.stories.d.ts +17 -0
  63. package/dist/types/src/components/Graph/CanvasForceGraph.stories.d.ts.map +1 -0
  64. package/dist/types/src/components/Graph/ForceGraph.d.ts +12 -5
  65. package/dist/types/src/components/Graph/ForceGraph.d.ts.map +1 -1
  66. package/dist/types/src/components/Graph/ForceGraph.stories.d.ts +4 -2
  67. package/dist/types/src/components/Graph/ForceGraph.stories.d.ts.map +1 -1
  68. package/dist/types/src/components/Graph/{adapter.d.ts → graph-adapter.d.ts} +2 -2
  69. package/dist/types/src/components/Graph/graph-adapter.d.ts.map +1 -0
  70. package/dist/types/src/components/Graph/index.d.ts +1 -1
  71. package/dist/types/src/components/Graph/index.d.ts.map +1 -1
  72. package/dist/types/src/components/Lattice/Lattice.d.ts +20 -0
  73. package/dist/types/src/components/Lattice/Lattice.d.ts.map +1 -0
  74. package/dist/types/src/components/Lattice/Lattice.stories.d.ts +8 -0
  75. package/dist/types/src/components/Lattice/Lattice.stories.d.ts.map +1 -0
  76. package/dist/types/src/components/Lattice/index.d.ts +2 -0
  77. package/dist/types/src/components/Lattice/index.d.ts.map +1 -0
  78. package/dist/types/src/components/Tree/EdgeBundling.stories.d.ts +21 -0
  79. package/dist/types/src/components/Tree/EdgeBundling.stories.d.ts.map +1 -0
  80. package/dist/types/src/components/Tree/Tree.d.ts +20 -23
  81. package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
  82. package/dist/types/src/components/Tree/Tree.stories.d.ts +5 -12
  83. package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
  84. package/dist/types/src/components/Tree/index.d.ts +2 -0
  85. package/dist/types/src/components/Tree/index.d.ts.map +1 -1
  86. package/dist/types/src/components/Tree/layout/HierarchicalEdgeBundling.d.ts +37 -2
  87. package/dist/types/src/components/Tree/layout/HierarchicalEdgeBundling.d.ts.map +1 -1
  88. package/dist/types/src/components/Tree/layout/RadialTree.d.ts +35 -2
  89. package/dist/types/src/components/Tree/layout/RadialTree.d.ts.map +1 -1
  90. package/dist/types/src/components/Tree/layout/TidyTree.d.ts +24 -2
  91. package/dist/types/src/components/Tree/layout/TidyTree.d.ts.map +1 -1
  92. package/dist/types/src/components/Tree/layout/hierarchy.d.ts +17 -0
  93. package/dist/types/src/components/Tree/layout/hierarchy.d.ts.map +1 -0
  94. package/dist/types/src/components/Tree/layout/index.d.ts +5 -4
  95. package/dist/types/src/components/Tree/layout/index.d.ts.map +1 -1
  96. package/dist/types/src/components/Tree/layout/slots.d.ts +7 -0
  97. package/dist/types/src/components/Tree/layout/slots.d.ts.map +1 -0
  98. package/dist/types/src/components/Tree/layout/useContainerSize.d.ts +15 -0
  99. package/dist/types/src/components/Tree/layout/useContainerSize.d.ts.map +1 -0
  100. package/dist/types/src/components/Tree/types/tree.d.ts +50 -27
  101. package/dist/types/src/components/Tree/types/tree.d.ts.map +1 -1
  102. package/dist/types/src/components/Tree/types/types.d.ts +14 -4
  103. package/dist/types/src/components/Tree/types/types.d.ts.map +1 -1
  104. package/dist/types/src/components/index.d.ts +1 -4
  105. package/dist/types/src/components/index.d.ts.map +1 -1
  106. package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.d.ts +8 -0
  107. package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.d.ts.map +1 -0
  108. package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.stories.d.ts +15 -0
  109. package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.stories.d.ts.map +1 -0
  110. package/dist/types/src/containers/ExplorerArticle/Visualization.d.ts +18 -0
  111. package/dist/types/src/containers/ExplorerArticle/Visualization.d.ts.map +1 -0
  112. package/dist/types/src/containers/ExplorerArticle/index.d.ts +2 -0
  113. package/dist/types/src/containers/ExplorerArticle/index.d.ts.map +1 -0
  114. package/dist/types/src/containers/ExplorerArticle/variants.d.ts +9 -0
  115. package/dist/types/src/containers/ExplorerArticle/variants.d.ts.map +1 -0
  116. package/dist/types/src/containers/index.d.ts +3 -0
  117. package/dist/types/src/containers/index.d.ts.map +1 -0
  118. package/dist/types/src/hooks/useGraphModel.d.ts +2 -2
  119. package/dist/types/src/hooks/useGraphModel.d.ts.map +1 -1
  120. package/dist/types/src/index.d.ts +1 -3
  121. package/dist/types/src/index.d.ts.map +1 -1
  122. package/dist/types/src/meta.d.ts +2 -2
  123. package/dist/types/src/meta.d.ts.map +1 -1
  124. package/dist/types/src/plugin.d.ts +3 -0
  125. package/dist/types/src/plugin.d.ts.map +1 -0
  126. package/dist/types/src/{components/Tree/testing → testing}/generator.d.ts +1 -1
  127. package/dist/types/src/testing/generator.d.ts.map +1 -0
  128. package/dist/types/src/testing/index.d.ts +4 -0
  129. package/dist/types/src/testing/index.d.ts.map +1 -0
  130. package/dist/types/src/testing/relations.d.ts +32 -0
  131. package/dist/types/src/testing/relations.d.ts.map +1 -0
  132. package/dist/types/src/translations.d.ts +31 -22
  133. package/dist/types/src/translations.d.ts.map +1 -1
  134. package/dist/types/src/types/ExplorerAction.d.ts +1 -18
  135. package/dist/types/src/types/ExplorerAction.d.ts.map +1 -1
  136. package/dist/types/src/types/Graph.d.ts +14 -25
  137. package/dist/types/src/types/Graph.d.ts.map +1 -1
  138. package/dist/types/src/util/index.d.ts +3 -0
  139. package/dist/types/src/util/index.d.ts.map +1 -0
  140. package/dist/types/src/util/node-color.d.ts +13 -0
  141. package/dist/types/src/util/node-color.d.ts.map +1 -0
  142. package/dist/types/src/{components → util}/plot.d.ts +1 -1
  143. package/dist/types/src/util/plot.d.ts.map +1 -0
  144. package/dist/types/tsconfig.tsbuildinfo +1 -1
  145. package/package.json +113 -65
  146. package/src/ExplorerPlugin.test.ts +26 -0
  147. package/src/ExplorerPlugin.tsx +20 -54
  148. package/src/capabilities/create-object.ts +36 -0
  149. package/src/capabilities/index.ts +3 -3
  150. package/src/capabilities/react-surface.tsx +24 -19
  151. package/src/components/Chart/Chart.stories.tsx +16 -23
  152. package/src/components/Chart/Chart.tsx +1 -1
  153. package/src/components/Globe/Globe.stories.tsx +19 -22
  154. package/src/components/Globe/Globe.tsx +1 -1
  155. package/src/components/Graph/CanvasForceGraph.stories.tsx +97 -0
  156. package/src/components/Graph/CanvasForceGraph.tsx +124 -0
  157. package/src/components/Graph/ForceGraph.stories.tsx +98 -42
  158. package/src/components/Graph/ForceGraph.tsx +105 -85
  159. package/src/components/Graph/{adapter.ts → graph-adapter.ts} +14 -8
  160. package/src/components/Graph/index.ts +1 -1
  161. package/src/components/Lattice/Lattice.stories.tsx +104 -0
  162. package/src/components/Lattice/Lattice.tsx +182 -0
  163. package/src/components/Lattice/index.ts +5 -0
  164. package/src/components/Tree/EdgeBundling.stories.tsx +144 -0
  165. package/src/components/Tree/Tree.stories.tsx +20 -38
  166. package/src/components/Tree/Tree.tsx +69 -95
  167. package/src/components/Tree/index.ts +2 -0
  168. package/src/components/Tree/layout/HierarchicalEdgeBundling.tsx +335 -0
  169. package/src/components/Tree/layout/RadialTree.tsx +242 -0
  170. package/src/components/Tree/layout/TidyTree.tsx +246 -0
  171. package/src/components/Tree/layout/hierarchy.ts +32 -0
  172. package/src/components/Tree/layout/index.ts +5 -5
  173. package/src/components/Tree/layout/slots.ts +19 -0
  174. package/src/components/Tree/layout/useContainerSize.ts +43 -0
  175. package/src/components/Tree/types/tree.test.ts +8 -7
  176. package/src/components/Tree/types/tree.ts +51 -35
  177. package/src/components/Tree/types/types.ts +38 -29
  178. package/src/components/index.ts +1 -4
  179. package/src/containers/ExplorerArticle/ExplorerArticle.stories.tsx +152 -0
  180. package/src/containers/ExplorerArticle/ExplorerArticle.tsx +120 -0
  181. package/src/containers/ExplorerArticle/Visualization.tsx +523 -0
  182. package/src/containers/ExplorerArticle/index.ts +5 -0
  183. package/src/containers/ExplorerArticle/variants.ts +47 -0
  184. package/src/containers/index.ts +7 -0
  185. package/src/hooks/useGraphModel.ts +25 -14
  186. package/src/index.ts +1 -4
  187. package/src/meta.ts +30 -6
  188. package/src/plugin.ts +9 -0
  189. package/src/{components/Tree/testing → testing}/generator.ts +6 -4
  190. package/src/testing/index.ts +9 -0
  191. package/src/testing/relations.ts +117 -0
  192. package/src/translations.ts +16 -13
  193. package/src/types/ExplorerAction.ts +10 -19
  194. package/src/types/Graph.ts +20 -24
  195. package/src/typings.d.ts +8 -0
  196. package/src/util/index.ts +6 -0
  197. package/src/util/node-color.ts +23 -0
  198. package/src/{components → util}/plot.ts +16 -4
  199. package/src/vite-env.d.ts +10 -0
  200. package/dist/lib/browser/ExplorerContainer-6SHZJ6AK.mjs +0 -50
  201. package/dist/lib/browser/ExplorerContainer-6SHZJ6AK.mjs.map +0 -7
  202. package/dist/lib/browser/chunk-2DGFNLRO.mjs +0 -19
  203. package/dist/lib/browser/chunk-2DGFNLRO.mjs.map +0 -7
  204. package/dist/lib/browser/chunk-2MKBRIUT.mjs +0 -31
  205. package/dist/lib/browser/chunk-2MKBRIUT.mjs.map +0 -7
  206. package/dist/lib/browser/chunk-BZ65T5M3.mjs +0 -79
  207. package/dist/lib/browser/chunk-BZ65T5M3.mjs.map +0 -7
  208. package/dist/lib/browser/chunk-MOM5KCKC.mjs.map +0 -7
  209. package/dist/lib/browser/chunk-NXGP6NTP.mjs +0 -203
  210. package/dist/lib/browser/chunk-NXGP6NTP.mjs.map +0 -7
  211. package/dist/lib/browser/index.mjs +0 -118
  212. package/dist/lib/browser/index.mjs.map +0 -7
  213. package/dist/lib/browser/intent-resolver-K57C3LIX.mjs +0 -31
  214. package/dist/lib/browser/intent-resolver-K57C3LIX.mjs.map +0 -7
  215. package/dist/lib/browser/meta.json +0 -1
  216. package/dist/lib/browser/react-surface-OPBND5W3.mjs +0 -35
  217. package/dist/lib/browser/react-surface-OPBND5W3.mjs.map +0 -7
  218. package/dist/lib/node-esm/ExplorerContainer-FRTDXZI5.mjs +0 -51
  219. package/dist/lib/node-esm/ExplorerContainer-FRTDXZI5.mjs.map +0 -7
  220. package/dist/lib/node-esm/chunk-3ODK27PU.mjs +0 -33
  221. package/dist/lib/node-esm/chunk-3ODK27PU.mjs.map +0 -7
  222. package/dist/lib/node-esm/chunk-6JACZE7E.mjs +0 -205
  223. package/dist/lib/node-esm/chunk-6JACZE7E.mjs.map +0 -7
  224. package/dist/lib/node-esm/chunk-ES6AOMCY.mjs +0 -80
  225. package/dist/lib/node-esm/chunk-ES6AOMCY.mjs.map +0 -7
  226. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
  227. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
  228. package/dist/lib/node-esm/chunk-PX6LHR2N.mjs +0 -21
  229. package/dist/lib/node-esm/chunk-PX6LHR2N.mjs.map +0 -7
  230. package/dist/lib/node-esm/chunk-ZCV4U7LT.mjs +0 -11343
  231. package/dist/lib/node-esm/chunk-ZCV4U7LT.mjs.map +0 -7
  232. package/dist/lib/node-esm/index.mjs +0 -119
  233. package/dist/lib/node-esm/index.mjs.map +0 -7
  234. package/dist/lib/node-esm/intent-resolver-BLPPTTEY.mjs +0 -32
  235. package/dist/lib/node-esm/intent-resolver-BLPPTTEY.mjs.map +0 -7
  236. package/dist/lib/node-esm/meta.json +0 -1
  237. package/dist/lib/node-esm/meta.mjs +0 -9
  238. package/dist/lib/node-esm/react-surface-HCKQSHKJ.mjs +0 -36
  239. package/dist/lib/node-esm/react-surface-HCKQSHKJ.mjs.map +0 -7
  240. package/dist/lib/node-esm/types/index.mjs +0 -12
  241. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  242. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  243. package/dist/types/src/components/ExplorerContainer.d.ts +0 -9
  244. package/dist/types/src/components/ExplorerContainer.d.ts.map +0 -1
  245. package/dist/types/src/components/Graph/D3ForceGraph.d.ts +0 -14
  246. package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +0 -1
  247. package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts +0 -15
  248. package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts.map +0 -1
  249. package/dist/types/src/components/Graph/adapter.d.ts.map +0 -1
  250. package/dist/types/src/components/Graph/testing.d.ts +0 -14
  251. package/dist/types/src/components/Graph/testing.d.ts.map +0 -1
  252. package/dist/types/src/components/Tree/testing/generator.d.ts.map +0 -1
  253. package/dist/types/src/components/Tree/testing/index.d.ts +0 -2
  254. package/dist/types/src/components/Tree/testing/index.d.ts.map +0 -1
  255. package/dist/types/src/components/plot.d.ts.map +0 -1
  256. package/src/capabilities/intent-resolver.ts +0 -21
  257. package/src/components/ExplorerContainer.tsx +0 -54
  258. package/src/components/Graph/D3ForceGraph.stories.tsx +0 -77
  259. package/src/components/Graph/D3ForceGraph.tsx +0 -101
  260. package/src/components/Graph/testing.ts +0 -55
  261. package/src/components/Tree/layout/HierarchicalEdgeBundling.ts +0 -162
  262. package/src/components/Tree/layout/RadialTree.ts +0 -94
  263. package/src/components/Tree/layout/TidyTree.ts +0 -101
  264. package/src/components/Tree/testing/index.ts +0 -5
  265. /package/dist/lib/{browser/chunk-J5LGTIGS.mjs.map → neutral/ExplorerPlugin.mjs.map} +0 -0
  266. /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
  267. /package/dist/lib/{browser/meta.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
  268. /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
  269. /package/dist/lib/{node-esm → neutral}/meta.mjs.map +0 -0
  270. /package/dist/lib/{node-esm → neutral}/types/index.mjs.map +0 -0
@@ -0,0 +1,459 @@
1
+ import {
2
+ getNodeFillForObject
3
+ } from "./chunk-IKHJV3Q4.mjs";
4
+ import "./chunk-J5LGTIGS.mjs";
5
+
6
+ // src/containers/ExplorerArticle/ExplorerArticle.tsx
7
+ import React2, { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useState as useState2 } from "react";
8
+ import { Obj as Obj2 } from "@dxos/echo";
9
+ import { QueryBuilder } from "@dxos/echo-query";
10
+ import { useObject } from "@dxos/react-client/echo";
11
+ import { DxAnchorActivate, Icon, Panel, Toolbar } from "@dxos/react-ui";
12
+ import { QueryEditor } from "@dxos/react-ui-components";
13
+ import "@dxos/react-ui-graph/styles/graph.css";
14
+ import { useGraphModel } from "#hooks";
15
+
16
+ // src/containers/ExplorerArticle/variants.ts
17
+ var VARIANTS = [
18
+ {
19
+ value: "force",
20
+ icon: "ph--graph--regular",
21
+ label: "Force-directed"
22
+ },
23
+ {
24
+ value: "cluster",
25
+ icon: "ph--asterisk-simple--regular",
26
+ label: "Radial"
27
+ },
28
+ {
29
+ value: "bundle",
30
+ icon: "ph--circles-three-plus--regular",
31
+ label: "Connections"
32
+ },
33
+ {
34
+ value: "plexus",
35
+ icon: "ph--share-network--regular",
36
+ label: "Plexus"
37
+ },
38
+ {
39
+ value: "lattice",
40
+ icon: "ph--grid-four--regular",
41
+ label: "Lattice"
42
+ },
43
+ {
44
+ value: "swarm",
45
+ icon: "ph--microscope--regular",
46
+ label: "Swarm"
47
+ }
48
+ ];
49
+ var isVariant = (value) => value === "force" || value === "cluster" || value === "bundle" || value === "lattice" || value === "swarm" || value === "plexus";
50
+
51
+ // src/containers/ExplorerArticle/Visualization.tsx
52
+ import { curveCatmullRom, line as d3Line } from "d3";
53
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
54
+ import { Obj } from "@dxos/echo";
55
+ import { CLUSTER_NODE_TYPE_LEAF, CLUSTER_NODE_TYPE_ROOT, GraphBundleProjector, GraphClusterProjector, GraphForceProjector, GraphLatticeProjector, GraphPlexusProjector, GraphSwarmProjector, PLEXUS_NODE_TYPE_FOCUS, PLEXUS_NODE_TYPE_RELATION, SVG, appendRadialGroupLabel, appendRadialLeafLabel, appendRootLabel } from "@dxos/react-ui-graph";
56
+ import { mx } from "@dxos/ui-theme";
57
+ var Visualization = ({ classNames, debug = true, variant, model, onNodeHover, onSurfaceClick }) => {
58
+ const svgRef = useRef(null);
59
+ const [projector, setProjector] = useState();
60
+ const projectorRef = useRef(void 0);
61
+ projectorRef.current = projector;
62
+ const [focusId, setFocusId] = useState(void 0);
63
+ const lastLayoutRef = useRef(void 0);
64
+ useEffect(() => model?.subscribe(() => void 0), [
65
+ model
66
+ ]);
67
+ useEffect(() => {
68
+ if (variant !== "plexus") {
69
+ setFocusId(void 0);
70
+ }
71
+ }, [
72
+ variant
73
+ ]);
74
+ useEffect(() => {
75
+ if (projectorRef.current?.layout) {
76
+ lastLayoutRef.current = projectorRef.current.layout;
77
+ }
78
+ if (!svgRef.current) {
79
+ return;
80
+ }
81
+ setProjector(createProjector(svgRef.current, variant, focusId, lastLayoutRef.current));
82
+ }, [
83
+ variant,
84
+ focusId
85
+ ]);
86
+ const handleSelect = useCallback((node) => {
87
+ if (variant !== "plexus") {
88
+ return;
89
+ }
90
+ if (!node.data?.data?.object) {
91
+ return;
92
+ }
93
+ setFocusId((current) => current === node.id ? void 0 : node.id);
94
+ }, [
95
+ variant
96
+ ]);
97
+ const renderNode = useMemo(() => createRenderNode(variant), [
98
+ variant
99
+ ]);
100
+ const applyNode = useMemo(() => variant === "swarm" ? applyNodeSwarm : void 0, [
101
+ variant
102
+ ]);
103
+ const handlePointerMove = useCallback((point) => {
104
+ if (projector instanceof GraphSwarmProjector) {
105
+ projector.setCursor(point.x, point.y);
106
+ }
107
+ }, [
108
+ projector
109
+ ]);
110
+ const handlePointerLeave = useCallback(() => {
111
+ if (projector instanceof GraphSwarmProjector) {
112
+ projector.setCursor(null);
113
+ }
114
+ }, [
115
+ projector
116
+ ]);
117
+ const handleInspect = useCallback((node, event) => {
118
+ if (variant === "plexus") {
119
+ return;
120
+ }
121
+ onNodeHover?.(node ? {
122
+ id: node.id,
123
+ data: node.data?.data?.object
124
+ } : null, event);
125
+ }, [
126
+ variant === "plexus" ? void 0 : onNodeHover
127
+ ]);
128
+ const swarmPointerProps = variant === "swarm" ? {
129
+ onPointerMove: handlePointerMove,
130
+ onPointerLeave: handlePointerLeave
131
+ } : void 0;
132
+ return /* @__PURE__ */ React.createElement("div", {
133
+ className: mx("dx-expander relative", classNames),
134
+ onClick: onSurfaceClick
135
+ }, /* @__PURE__ */ React.createElement(SVG.Root, {
136
+ ref: svgRef
137
+ }, /* @__PURE__ */ React.createElement(SVG.Zoom, {
138
+ extent: [
139
+ 1 / 2,
140
+ 2
141
+ ]
142
+ }, /* @__PURE__ */ React.createElement(SVG.Graph, {
143
+ model,
144
+ projector,
145
+ renderNode,
146
+ applyNode,
147
+ edgeOpacity: variant === "swarm" ? 0.3 : void 0,
148
+ drag: variant === "force",
149
+ highlightOnHover: variant === "bundle",
150
+ onSelect: handleSelect,
151
+ onInspect: handleInspect,
152
+ ...swarmPointerProps
153
+ })), debug && /* @__PURE__ */ React.createElement(SVG.FPS, null)));
154
+ };
155
+ var TWEEN_MS = 500;
156
+ var LABEL_FADE_MS = 200;
157
+ var PLEXUS_LEAF_RADIUS = 5;
158
+ var PLEXUS_FOCUS_RADIUS = PLEXUS_LEAF_RADIUS * 2;
159
+ var swarmTrailLine = d3Line().curve(curveCatmullRom.alpha(0.5));
160
+ var applyNodeSwarm = (group, node) => {
161
+ const swarm = node;
162
+ const path = group.querySelector("path.dx-swarm-tail");
163
+ const grad = group.querySelector("linearGradient");
164
+ if (!path || !grad) {
165
+ return;
166
+ }
167
+ const history = swarm.history ?? [];
168
+ if (history.length === 0) {
169
+ path.setAttribute("d", "");
170
+ return;
171
+ }
172
+ const hx = swarm.x ?? 0;
173
+ const hy = swarm.y ?? 0;
174
+ const points = [
175
+ [
176
+ 0,
177
+ 0
178
+ ]
179
+ ];
180
+ for (let i = history.length - 1; i >= 0; i--) {
181
+ points.push([
182
+ history[i].x - hx,
183
+ history[i].y - hy
184
+ ]);
185
+ }
186
+ path.setAttribute("d", swarmTrailLine(points) ?? "");
187
+ const oldest = history[0];
188
+ grad.setAttribute("x2", String(oldest.x - hx));
189
+ grad.setAttribute("y2", String(oldest.y - hy));
190
+ };
191
+ var createProjector = (ctx, variant, focusId, prev) => {
192
+ switch (variant) {
193
+ case "force":
194
+ return new GraphForceProjector(ctx, void 0, void 0, prev);
195
+ case "swarm":
196
+ return new GraphSwarmProjector(ctx, void 0, void 0, prev);
197
+ case "lattice":
198
+ return new GraphLatticeProjector(ctx, {
199
+ duration: TWEEN_MS,
200
+ // Plugin-explorer overrides the projector's force-matched default (6)
201
+ // with a smaller node so the lattice reads as a dense matrix.
202
+ radius: 4,
203
+ // Cluster by typename first so same-type rects sit together; break ties by label.
204
+ sortBy: (node) => {
205
+ const obj = node.data?.data?.object;
206
+ const typename = obj ? Obj.getTypename(obj) ?? "(untyped)" : "(untyped)";
207
+ const label = (obj && Obj.getLabel(obj)) ?? node.data?.data?.label ?? node.id;
208
+ return `${typename} ${label}`;
209
+ }
210
+ }, void 0, prev);
211
+ case "cluster":
212
+ return new GraphClusterProjector(ctx, {
213
+ duration: TWEEN_MS,
214
+ groupOf: typenameGroupOf,
215
+ rootLabel: "Database",
216
+ groupLabel: shortTypename,
217
+ // All three node kinds share the same radius — leaves, groups, and root read
218
+ // as members of the same circle rather than ranked by size.
219
+ rootRadius: 4,
220
+ groupRadius: 4
221
+ }, void 0, prev);
222
+ case "bundle":
223
+ return new GraphBundleProjector(ctx, {
224
+ duration: TWEEN_MS,
225
+ groupOf: typenameGroupOf
226
+ }, void 0, prev);
227
+ case "plexus":
228
+ if (!focusId) {
229
+ return new GraphBundleProjector(ctx, {
230
+ duration: TWEEN_MS,
231
+ groupOf: typenameGroupOf
232
+ }, void 0, prev);
233
+ }
234
+ return new GraphPlexusProjector(ctx, {
235
+ duration: TWEEN_MS,
236
+ focus: focusId,
237
+ relationOf: plexusRelationOf,
238
+ leafRadius: PLEXUS_LEAF_RADIUS,
239
+ relationRadius: PLEXUS_LEAF_RADIUS,
240
+ focusRadius: PLEXUS_FOCUS_RADIUS
241
+ }, void 0, prev);
242
+ }
243
+ };
244
+ var plexusRelationOf = (edge, focusId) => {
245
+ const outgoing = edge.source.id === focusId;
246
+ const incoming = edge.target.id === focusId;
247
+ if (!outgoing && !incoming) {
248
+ return void 0;
249
+ }
250
+ const direction = outgoing ? "out" : "in";
251
+ const arrow = outgoing ? "\u2192" : "\u2190";
252
+ if (edge.type === "relation") {
253
+ const relation = edge.data?.object;
254
+ const typename = relation ? Obj.getTypename(relation) : void 0;
255
+ const name = typename ? shortTypename(typename) : "Relation";
256
+ return {
257
+ key: `relation:${direction}:${typename ?? "?"}`,
258
+ label: `${name} ${arrow}`
259
+ };
260
+ }
261
+ if (edge.type === "ref") {
262
+ const property = edge.data?.property;
263
+ const name = property ?? "References";
264
+ return {
265
+ key: `ref:${direction}:${property ?? "?"}`,
266
+ label: `${name} ${arrow}`
267
+ };
268
+ }
269
+ return void 0;
270
+ };
271
+ var createRenderNode = (variant) => {
272
+ switch (variant) {
273
+ case "force":
274
+ return (group, node) => {
275
+ const r = node.r ?? 6;
276
+ group.append("circle").attr("r", r).style("cursor", "pointer").style("fill", getNodeFillForObject(node.data?.data?.object));
277
+ };
278
+ case "swarm":
279
+ return (group, node) => {
280
+ const fill = getNodeFillForObject(node.data?.data?.object);
281
+ const r = node.r ?? 6;
282
+ const strokeWidth = Math.max(1, r * 0.6);
283
+ const gradId = `dx-swarm-grad-${String(node.id).replace(/[^\w-]/g, "_")}`;
284
+ const grad = group.append("defs").append("linearGradient").attr("id", gradId).attr("gradientUnits", "userSpaceOnUse").attr("x1", 0).attr("y1", 0).attr("x2", 0).attr("y2", 0);
285
+ grad.append("stop").attr("offset", 0).attr("stop-color", fill).attr("stop-opacity", 0.7);
286
+ grad.append("stop").attr("offset", 1).attr("stop-color", fill).attr("stop-opacity", 0);
287
+ group.append("path").classed("dx-swarm-tail", true).attr("fill", "none").attr("stroke", `url(#${gradId})`).attr("stroke-width", strokeWidth).attr("stroke-linecap", "round").attr("stroke-linejoin", "round").attr("pointer-events", "none");
288
+ group.append("circle").attr("r", r).style("cursor", "pointer").style("fill", fill);
289
+ };
290
+ case "lattice":
291
+ return (group, node) => {
292
+ const r = node.r ?? 6;
293
+ const sz = r * 2;
294
+ group.append("rect").attr("x", -r).attr("y", -r).attr("width", sz).attr("height", sz).attr("rx", r * 0.3).attr("ry", r * 0.3).style("cursor", "pointer").style("fill", getNodeFillForObject(node.data?.data?.object));
295
+ };
296
+ case "cluster":
297
+ return (group, node) => {
298
+ const obj = node.data?.data?.object;
299
+ const r = node.r ?? 4;
300
+ group.append("circle").attr("r", r).style("cursor", "pointer").style("fill", obj ? getNodeFillForObject(obj) : "var(--color-neutral-500)");
301
+ const labelOptions = {
302
+ delay: TWEEN_MS,
303
+ duration: LABEL_FADE_MS
304
+ };
305
+ if (node.type === CLUSTER_NODE_TYPE_LEAF) {
306
+ const text = labelForLeaf(node, obj);
307
+ if (text) {
308
+ appendRadialLeafLabel(group, node, text, r, labelOptions);
309
+ }
310
+ } else if (node.type === CLUSTER_NODE_TYPE_ROOT) {
311
+ if (node.label) {
312
+ appendRootLabel(group, node.label, r, labelOptions);
313
+ }
314
+ } else {
315
+ if (node.label) {
316
+ appendRadialGroupLabel(group, node, node.label, r, labelOptions);
317
+ }
318
+ }
319
+ };
320
+ case "bundle":
321
+ return (group, node) => {
322
+ const obj = node.data?.data?.object;
323
+ const r = node.r ?? 4;
324
+ group.append("circle").attr("r", r).style("cursor", "pointer").style("fill", obj ? getNodeFillForObject(obj) : "var(--color-neutral-500)");
325
+ const text = labelForLeaf(node, obj);
326
+ if (text) {
327
+ appendRadialLeafLabel(group, node, text, r, {
328
+ delay: TWEEN_MS,
329
+ duration: LABEL_FADE_MS
330
+ });
331
+ }
332
+ };
333
+ case "plexus":
334
+ return (group, node) => {
335
+ const obj = node.data?.data?.object;
336
+ const labelOptions = {
337
+ delay: TWEEN_MS,
338
+ duration: LABEL_FADE_MS
339
+ };
340
+ if (node.type === PLEXUS_NODE_TYPE_RELATION) {
341
+ const r2 = PLEXUS_LEAF_RADIUS;
342
+ group.append("circle").attr("r", r2).style("cursor", "default").style("fill", "var(--color-neutral-500)");
343
+ if (node.label) {
344
+ appendRadialGroupLabel(group, node, node.label, r2, labelOptions);
345
+ }
346
+ return;
347
+ }
348
+ const isFocus = node.type === PLEXUS_NODE_TYPE_FOCUS;
349
+ const r = isFocus ? PLEXUS_FOCUS_RADIUS : PLEXUS_LEAF_RADIUS;
350
+ group.append("circle").attr("r", r).style("cursor", "pointer").style("fill", obj ? getNodeFillForObject(obj) : "var(--color-neutral-500)");
351
+ const text = labelForLeaf(node, obj);
352
+ if (text) {
353
+ if (isFocus) {
354
+ appendRootLabel(group, text, r, labelOptions);
355
+ } else {
356
+ appendRadialLeafLabel(group, node, text, r, labelOptions);
357
+ }
358
+ }
359
+ };
360
+ }
361
+ };
362
+ var typenameGroupOf = (node) => {
363
+ const obj = node.data?.data?.object;
364
+ return obj ? Obj.getTypename(obj) ?? "(untyped)" : void 0;
365
+ };
366
+ var shortTypename = (typename) => {
367
+ const last = typename.split(".").pop() ?? typename;
368
+ return last.charAt(0).toUpperCase() + last.slice(1);
369
+ };
370
+ var labelForLeaf = (node, obj) => (obj && Obj.getLabel(obj)) ?? node.data?.data?.label ?? node.id;
371
+
372
+ // src/containers/ExplorerArticle/ExplorerArticle.tsx
373
+ var ExplorerArticle = ({ role, subject, variant }) => {
374
+ const [view] = useObject(subject);
375
+ const [filter, setFilter] = useState2();
376
+ const db = view && Obj2.getDatabase(view);
377
+ const model = useGraphModel(db, filter);
378
+ const builder = useMemo2(() => new QueryBuilder(), []);
379
+ const handleChange = useCallback2((value) => {
380
+ setFilter(builder.build(value).filter);
381
+ }, [
382
+ builder
383
+ ]);
384
+ const [selected, setSelected] = useState2(isVariant(variant) ? variant : "force");
385
+ useEffect2(() => {
386
+ if (isVariant(variant)) {
387
+ setSelected(variant);
388
+ }
389
+ }, [
390
+ variant
391
+ ]);
392
+ const handleVariantChange = useCallback2((value) => {
393
+ if (isVariant(value)) {
394
+ setSelected(value);
395
+ }
396
+ }, []);
397
+ const handleDismiss = useCallback2(() => {
398
+ document.defaultView?.dispatchEvent(new DxAnchorActivate({
399
+ dxn: "",
400
+ label: "",
401
+ trigger: document.body,
402
+ state: false
403
+ }));
404
+ }, []);
405
+ const handleHover = useCallback2((node, event) => {
406
+ if (!node || !event) {
407
+ return;
408
+ }
409
+ const obj = node.data;
410
+ if (!obj || !Obj2.isObject(obj)) {
411
+ return;
412
+ }
413
+ const dxn = Obj2.getURI(obj);
414
+ if (!dxn) {
415
+ return;
416
+ }
417
+ const target = event.target;
418
+ target.dispatchEvent(new DxAnchorActivate({
419
+ dxn,
420
+ kind: "card",
421
+ trigger: target,
422
+ label: Obj2.getLabel(obj) ?? dxn
423
+ }));
424
+ }, []);
425
+ const showToolbar = role === "article";
426
+ if (!db || !model) {
427
+ return null;
428
+ }
429
+ return /* @__PURE__ */ React2.createElement(Panel.Root, {
430
+ role
431
+ }, showToolbar && /* @__PURE__ */ React2.createElement(Panel.Toolbar, {
432
+ asChild: true
433
+ }, /* @__PURE__ */ React2.createElement(Toolbar.Root, null, /* @__PURE__ */ React2.createElement(QueryEditor, {
434
+ db,
435
+ onChange: handleChange
436
+ }), /* @__PURE__ */ React2.createElement(Toolbar.ToggleGroup, {
437
+ type: "single",
438
+ value: selected,
439
+ onValueChange: handleVariantChange
440
+ }, VARIANTS.map(({ value, icon, label }) => /* @__PURE__ */ React2.createElement(Toolbar.ToggleGroupItem, {
441
+ key: value,
442
+ value,
443
+ "aria-label": label,
444
+ title: label
445
+ }, /* @__PURE__ */ React2.createElement(Icon, {
446
+ icon,
447
+ size: 4
448
+ })))))), /* @__PURE__ */ React2.createElement(Panel.Content, null, /* @__PURE__ */ React2.createElement(Visualization, {
449
+ classNames: "bg-base-surface",
450
+ variant: selected,
451
+ model,
452
+ onNodeHover: handleHover,
453
+ onSurfaceClick: handleDismiss
454
+ })));
455
+ };
456
+ export {
457
+ ExplorerArticle as default
458
+ };
459
+ //# sourceMappingURL=ExplorerArticle-4I7PNGDC.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/containers/ExplorerArticle/ExplorerArticle.tsx", "../../../src/containers/ExplorerArticle/variants.ts", "../../../src/containers/ExplorerArticle/Visualization.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\n\nimport { type AppSurface } from '@dxos/app-toolkit/ui';\nimport { type Filter, Obj, type View } from '@dxos/echo';\nimport { QueryBuilder } from '@dxos/echo-query';\nimport { useObject } from '@dxos/react-client/echo';\nimport { DxAnchorActivate, Icon, Panel, Toolbar } from '@dxos/react-ui';\nimport { QueryEditor, type QueryEditorProps } from '@dxos/react-ui-components';\nimport '@dxos/react-ui-graph/styles/graph.css';\n\nimport { type TreeNode } from '#components';\nimport { useGraphModel } from '#hooks';\n\nimport { type ExplorerArticleVariant, VARIANTS, isVariant } from './variants';\nimport { Visualization } from './Visualization';\n\nexport type { ExplorerArticleVariant } from './variants';\n\nexport type ExplorerArticleProps = AppSurface.ObjectArticleProps<View.View>;\n\nexport const ExplorerArticle = ({ role, subject, variant }: ExplorerArticleProps) => {\n const [view] = useObject(subject);\n const [filter, setFilter] = useState<Filter.Any>();\n\n const db = view && Obj.getDatabase(view);\n const model = useGraphModel(db, filter);\n\n const builder = useMemo(() => new QueryBuilder(), []);\n const handleChange = useCallback<NonNullable<QueryEditorProps['onChange']>>(\n (value) => {\n setFilter(builder.build(value).filter);\n },\n [builder],\n );\n\n const [selected, setSelected] = useState<ExplorerArticleVariant>(isVariant(variant) ? variant : 'force');\n useEffect(() => {\n if (isVariant(variant)) {\n setSelected(variant);\n }\n }, [variant]);\n\n const handleVariantChange = useCallback((value: string) => {\n if (isVariant(value)) {\n setSelected(value);\n }\n }, []);\n\n // Dismiss the preview popover. The dxn/label/trigger fields are placeholders ignored on\n // `state: false`.\n const handleDismiss = useCallback(() => {\n document.defaultView?.dispatchEvent(\n new DxAnchorActivate({ dxn: '', label: '', trigger: document.body, state: false }),\n );\n }, []);\n\n const handleHover = useCallback((node: TreeNode | null, event?: MouseEvent) => {\n // Pointer left the node/label: keep the popover open so it can be hovered/interacted with.\n // The popover is dismissed only on an explicit click on the component surface (handleDismiss).\n if (!node || !event) {\n return;\n }\n const obj = node.data;\n if (!obj || !Obj.isObject(obj)) {\n return;\n }\n const dxn = Obj.getURI(obj);\n if (!dxn) {\n return;\n }\n\n const target = event.target as HTMLElement;\n target.dispatchEvent(\n new DxAnchorActivate({\n dxn,\n kind: 'card',\n trigger: target,\n label: Obj.getLabel(obj) ?? dxn,\n }),\n );\n }, []);\n\n const showToolbar = role === 'article';\n\n if (!db || !model) {\n return null;\n }\n\n return (\n <Panel.Root role={role}>\n {showToolbar && (\n <Panel.Toolbar asChild>\n <Toolbar.Root>\n <QueryEditor db={db} onChange={handleChange} />\n <Toolbar.ToggleGroup type='single' value={selected} onValueChange={handleVariantChange}>\n {VARIANTS.map(({ value, icon, label }) => (\n <Toolbar.ToggleGroupItem key={value} value={value} aria-label={label} title={label}>\n <Icon icon={icon} size={4} />\n </Toolbar.ToggleGroupItem>\n ))}\n </Toolbar.ToggleGroup>\n </Toolbar.Root>\n </Panel.Toolbar>\n )}\n <Panel.Content>\n <Visualization\n classNames='bg-base-surface'\n variant={selected}\n model={model}\n onNodeHover={handleHover}\n onSurfaceClick={handleDismiss}\n />\n </Panel.Content>\n </Panel.Root>\n );\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\n/** Visualization variants exposed by `ExplorerArticle`. */\nexport type ExplorerArticleVariant = 'force' | 'cluster' | 'bundle' | 'lattice' | 'swarm' | 'plexus';\n\nexport const VARIANTS: { value: ExplorerArticleVariant; icon: string; label: string }[] = [\n {\n value: 'force',\n icon: 'ph--graph--regular',\n label: 'Force-directed',\n },\n {\n value: 'cluster',\n icon: 'ph--asterisk-simple--regular',\n label: 'Radial',\n },\n {\n value: 'bundle',\n icon: 'ph--circles-three-plus--regular',\n label: 'Connections',\n },\n {\n value: 'plexus',\n icon: 'ph--share-network--regular',\n label: 'Plexus',\n },\n {\n value: 'lattice',\n icon: 'ph--grid-four--regular',\n label: 'Lattice',\n },\n {\n value: 'swarm',\n icon: 'ph--microscope--regular',\n label: 'Swarm',\n },\n];\n\nexport const isVariant = (value: unknown): value is ExplorerArticleVariant =>\n value === 'force' ||\n value === 'cluster' ||\n value === 'bundle' ||\n value === 'lattice' ||\n value === 'swarm' ||\n value === 'plexus';\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { curveCatmullRom, line as d3Line } from 'd3';\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { Obj } from '@dxos/echo';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport {\n CLUSTER_NODE_TYPE_LEAF,\n CLUSTER_NODE_TYPE_ROOT,\n GraphBundleProjector,\n GraphClusterProjector,\n GraphForceProjector,\n type GraphLayout,\n type GraphLayoutNode,\n GraphLatticeProjector,\n type GraphLayoutEdge,\n GraphPlexusProjector,\n type GraphProjector,\n GraphSwarmProjector,\n type ModelPoint,\n PLEXUS_NODE_TYPE_FOCUS,\n PLEXUS_NODE_TYPE_RELATION,\n type PlexusRelation,\n type RenderNode,\n SVG,\n type SVGContext,\n type SwarmNode,\n appendRadialGroupLabel,\n appendRadialLeafLabel,\n appendRootLabel,\n} from '@dxos/react-ui-graph';\nimport { type SpaceGraphEdge, type SpaceGraphModel, type SpaceGraphNode } from '@dxos/schema';\nimport { mx } from '@dxos/ui-theme';\n\nimport { type TreeNode } from '#components';\n\nimport { getNodeFillForObject } from '../../util';\nimport { type ExplorerArticleVariant } from './variants';\n\nexport type VisualizationProps = ThemedClassName<{\n debug?: boolean;\n variant: ExplorerArticleVariant;\n model: SpaceGraphModel;\n onNodeHover?: (node: TreeNode | null, event?: MouseEvent) => void;\n /** Called when the user clicks the visualization surface (e.g. to dismiss a node preview). */\n onSurfaceClick?: () => void;\n}>;\n\n/**\n * Renders the active visualization variant.\n */\nexport const Visualization = ({\n classNames,\n debug = true,\n variant,\n model,\n onNodeHover,\n onSurfaceClick,\n}: VisualizationProps) => {\n const svgRef = useRef<SVGContext>(null);\n const [projector, setProjector] = useState<GraphProjector<SpaceGraphNode> | undefined>();\n const projectorRef = useRef<GraphProjector<SpaceGraphNode> | undefined>(undefined);\n projectorRef.current = projector;\n\n // Plexus focus — single source of truth for both the bundle→plexus dispatch and re-focus.\n // `undefined` means \"no node focused\", which dispatches to the bundle projector.\n const [focusId, setFocusId] = useState<string | undefined>(undefined);\n\n // Latest layout we hand to the next SVG projector as `prev`. Captured from the live\n // projector when the variant changes so node x/y survive the swap.\n const lastLayoutRef = useRef<GraphLayout<SpaceGraphNode> | undefined>(undefined);\n\n // Subscribe to the graph atom — keeps it alive across child unmounts (effect-atom\n // disposes atoms with no subscribers) and triggers re-renders when query results land.\n useEffect(() => model?.subscribe(() => undefined), [model]);\n\n // Clear any focus when leaving plexus so returning to it starts from the bundle layout.\n useEffect(() => {\n if (variant !== 'plexus') {\n setFocusId(undefined);\n }\n }, [variant]);\n\n // Recreate the projector when the variant or focus changes; snapshot the live layout\n // first so the next projector animates from where the previous one left off.\n useEffect(() => {\n if (projectorRef.current?.layout) {\n lastLayoutRef.current = projectorRef.current.layout as GraphLayout<SpaceGraphNode>;\n }\n if (!svgRef.current) {\n return;\n }\n\n setProjector(createProjector(svgRef.current, variant, focusId, lastLayoutRef.current));\n }, [variant, focusId]);\n\n // Plexus: clicking an object node re-focuses on it; clicking the current focus clears it\n // (back to the bundle layout). Relation nodes carry no ECHO object, so their clicks are ignored.\n const handleSelect = useCallback(\n (node: GraphLayoutNode<SpaceGraphNode>) => {\n if (variant !== 'plexus') {\n return;\n }\n if (!node.data?.data?.object) {\n return;\n }\n setFocusId((current) => (current === node.id ? undefined : node.id));\n },\n [variant],\n );\n\n const renderNode = useMemo(() => createRenderNode(variant), [variant]);\n\n // Per-tick swarm tail update. Receives the dx-node `<g>` after its transform is set,\n // so the polyline points + gradient axis can live in node-local coordinates.\n const applyNode = useMemo(() => (variant === 'swarm' ? applyNodeSwarm : undefined), [variant]);\n\n // Cursor avoidance for the SVG swarm. The Graph component hands us pre-transformed\n // SVG model coordinates — same space the boids live in.\n const handlePointerMove = useCallback(\n (point: ModelPoint) => {\n if (projector instanceof GraphSwarmProjector) {\n projector.setCursor(point.x, point.y);\n }\n },\n [projector],\n );\n\n const handlePointerLeave = useCallback(() => {\n if (projector instanceof GraphSwarmProjector) {\n projector.setCursor(null);\n }\n }, [projector]);\n\n const handleInspect = useCallback(\n (node: GraphLayoutNode<SpaceGraphNode> | null, event: MouseEvent) => {\n if (variant === 'plexus') {\n return;\n }\n\n onNodeHover?.(node ? { id: node.id, data: node.data?.data?.object } : null, event);\n },\n [variant === 'plexus' ? undefined : onNodeHover],\n );\n\n // Only attach pointer handlers when the SVG swarm is active — other variants don't\n // need them and we want to avoid the per-move CTM math when it'd be a no-op.\n const swarmPointerProps =\n variant === 'swarm' ? { onPointerMove: handlePointerMove, onPointerLeave: handlePointerLeave } : undefined;\n\n return (\n <div className={mx('dx-expander relative', classNames)} onClick={onSurfaceClick}>\n <SVG.Root ref={svgRef}>\n <SVG.Zoom extent={[1 / 2, 2]}>\n <SVG.Graph<SpaceGraphNode, SpaceGraphEdge>\n model={model}\n projector={projector}\n renderNode={renderNode}\n applyNode={applyNode}\n edgeOpacity={variant === 'swarm' ? 0.3 : undefined}\n drag={variant === 'force'}\n highlightOnHover={variant === 'bundle'}\n onSelect={handleSelect}\n onInspect={handleInspect}\n {...swarmPointerProps}\n />\n </SVG.Zoom>\n {debug && <SVG.FPS />}\n </SVG.Root>\n </div>\n );\n};\n\n/** Cross-variant tween duration. Matches the renderer's edge fade timing so node movement and edge enter/exit complete together. */\nconst TWEEN_MS = 500;\n\n/** Fade-in duration applied to labels after the layout tween completes. */\nconst LABEL_FADE_MS = 200;\n\n/** Base radius shared by all plexus leaf + relation nodes; the focus node is double. */\nconst PLEXUS_LEAF_RADIUS = 5;\nconst PLEXUS_FOCUS_RADIUS = PLEXUS_LEAF_RADIUS * 2;\n\n/**\n * Catmull-Rom curve generator (α=0.5, \"centripetal\") for swarm boid trails.\n * Passes through every point and avoids the looping/overshoot artifacts a plain\n * cardinal spline produces when consecutive history samples land close together.\n */\nconst swarmTrailLine = d3Line<[number, number]>().curve(curveCatmullRom.alpha(0.5));\n\n/**\n * Per-tick swarm tail update. The dx-node `<g>` transform has just been written, so we work\n * in node-local coordinates: head at (0,0), history deltas trailing behind. The single\n * `<path>` is stroked with a per-boid `<linearGradient>` whose endpoints we sync to the\n * tail axis so the fade tracks the direction of travel.\n */\nconst applyNodeSwarm = (group: SVGGElement, node: GraphLayoutNode<SpaceGraphNode>): void => {\n const swarm = node as SwarmNode;\n const path = group.querySelector('path.dx-swarm-tail') as SVGPathElement | null;\n const grad = group.querySelector('linearGradient') as SVGLinearGradientElement | null;\n if (!path || !grad) {\n return;\n }\n const history = swarm.history ?? [];\n if (history.length === 0) {\n path.setAttribute('d', '');\n return;\n }\n\n const hx = swarm.x ?? 0;\n const hy = swarm.y ?? 0;\n // Build local-space points head → most-recent → … → oldest (history is push-at-end so\n // we walk it backwards), then run them through a Catmull-Rom curve generator so the\n // trail reads as a smooth arc rather than a polyline. The gradient axis below is still\n // head → oldest, so the fade stays aligned with travel direction.\n const points: Array<[number, number]> = [[0, 0]];\n for (let i = history.length - 1; i >= 0; i--) {\n points.push([history[i].x - hx, history[i].y - hy]);\n }\n path.setAttribute('d', swarmTrailLine(points) ?? '');\n const oldest = history[0];\n grad.setAttribute('x2', String(oldest.x - hx));\n grad.setAttribute('y2', String(oldest.y - hy));\n};\n\nconst createProjector = (\n ctx: SVGContext,\n variant: ExplorerArticleVariant,\n focusId: string | undefined,\n prev?: GraphLayout<SpaceGraphNode>,\n): GraphProjector<SpaceGraphNode> => {\n switch (variant) {\n case 'force':\n // Force has no `duration` — its own simulation drives motion via ticks.\n return new GraphForceProjector<SpaceGraphNode>(ctx, undefined, undefined, prev);\n\n case 'swarm':\n // Swarm in SVG: a per-tick projector mirroring force's emit-positions pattern.\n return new GraphSwarmProjector<SpaceGraphNode>(ctx, undefined, undefined, prev);\n\n case 'lattice':\n return new GraphLatticeProjector<SpaceGraphNode>(\n ctx,\n {\n duration: TWEEN_MS,\n // Plugin-explorer overrides the projector's force-matched default (6)\n // with a smaller node so the lattice reads as a dense matrix.\n radius: 4,\n // Cluster by typename first so same-type rects sit together; break ties by label.\n sortBy: (node: GraphLayoutNode<SpaceGraphNode>) => {\n const obj = node.data?.data?.object;\n const typename = obj ? (Obj.getTypename(obj) ?? '(untyped)') : '(untyped)';\n const label = (obj && Obj.getLabel(obj)) ?? node.data?.data?.label ?? node.id;\n return `${typename} ${label}`;\n },\n },\n undefined,\n prev,\n );\n\n case 'cluster':\n return new GraphClusterProjector<SpaceGraphNode>(\n ctx,\n {\n duration: TWEEN_MS,\n groupOf: typenameGroupOf,\n rootLabel: 'Database',\n groupLabel: shortTypename,\n // All three node kinds share the same radius — leaves, groups, and root read\n // as members of the same circle rather than ranked by size.\n rootRadius: 4,\n groupRadius: 4,\n },\n undefined,\n prev,\n );\n\n case 'bundle':\n return new GraphBundleProjector<SpaceGraphNode>(\n ctx,\n {\n duration: TWEEN_MS,\n groupOf: typenameGroupOf,\n },\n undefined,\n prev,\n );\n\n case 'plexus':\n // No focus → dispatch to the bundle projector (the unfocused overview). Once a node is\n // focused, switch to the focus-centric plexus layout; both receive `prev` so the swap\n // (and every re-focus) animates from the previous node positions.\n if (!focusId) {\n return new GraphBundleProjector<SpaceGraphNode>(\n ctx,\n {\n duration: TWEEN_MS,\n groupOf: typenameGroupOf,\n },\n undefined,\n prev,\n );\n }\n return new GraphPlexusProjector<SpaceGraphNode>(\n ctx,\n {\n duration: TWEEN_MS,\n focus: focusId,\n relationOf: plexusRelationOf,\n leafRadius: PLEXUS_LEAF_RADIUS,\n relationRadius: PLEXUS_LEAF_RADIUS,\n focusRadius: PLEXUS_FOCUS_RADIUS,\n },\n undefined,\n prev,\n );\n }\n};\n\n/**\n * Classify an edge incident to the focus into a relation group. Each relation/property gets two\n * possible nodes: one for the outgoing direction (focus is the edge source, arrow `→`) and one\n * for the incoming direction (focus is the edge target, arrow `←`), so both sides of a relation\n * fan out separately. Relations group by relation typename; references group by their top-level\n * property name. Edges not incident to the focus are ignored.\n */\nconst plexusRelationOf = (edge: GraphLayoutEdge<SpaceGraphNode>, focusId: string): PlexusRelation | undefined => {\n const outgoing = edge.source.id === focusId;\n const incoming = edge.target.id === focusId;\n if (!outgoing && !incoming) {\n return undefined;\n }\n const direction = outgoing ? 'out' : 'in';\n const arrow = outgoing ? '→' : '←';\n\n if (edge.type === 'relation') {\n const relation = (edge.data as any)?.object as Obj.Unknown | undefined;\n const typename = relation ? Obj.getTypename(relation) : undefined;\n const name = typename ? shortTypename(typename) : 'Relation';\n return { key: `relation:${direction}:${typename ?? '?'}`, label: `${name} ${arrow}` };\n }\n\n if (edge.type === 'ref') {\n const property = (edge.data as any)?.property as string | undefined;\n const name = property ?? 'References';\n return { key: `ref:${direction}:${property ?? '?'}`, label: `${name} ${arrow}` };\n }\n\n return undefined;\n};\n\nconst createRenderNode = (variant: ExplorerArticleVariant): RenderNode<SpaceGraphNode> | undefined => {\n switch (variant) {\n case 'force':\n return (group, node) => {\n const r = node.r ?? 6;\n group\n .append('circle')\n .attr('r', r)\n .style('cursor', 'pointer')\n .style('fill', getNodeFillForObject(node.data?.data?.object as Obj.Unknown | undefined));\n };\n\n case 'swarm':\n // Match the force variant's shape so identity-by-id transitions read continuously.\n // The tail is a SINGLE `<path>` traced through head + history points; its stroke\n // uses a per-boid `<linearGradient>` that fades head → tail. Done this way (rather\n // than as N overlapping `<line>` segments) so coincident segment endpoints don't\n // compound their alpha and read as a striped trail.\n return (group, node) => {\n const fill = getNodeFillForObject(node.data?.data?.object as Obj.Unknown | undefined);\n const r = node.r ?? 6;\n const strokeWidth = Math.max(1, r * 0.6);\n // Gradient id must be unique document-wide. node.id is the DXN, which contains\n // characters (`:`, `/`, etc.) that aren't valid in NCName-style ids, so sanitize.\n const gradId = `dx-swarm-grad-${String(node.id).replace(/[^\\w-]/g, '_')}`;\n const grad = group\n .append('defs')\n .append('linearGradient')\n .attr('id', gradId)\n // userSpaceOnUse so x1/y1/x2/y2 are interpreted in the dx-node's local coord space\n // (head at 0,0). The applyNode hook overwrites them per tick to align with the\n // path's head → tail axis.\n .attr('gradientUnits', 'userSpaceOnUse')\n .attr('x1', 0)\n .attr('y1', 0)\n .attr('x2', 0)\n .attr('y2', 0);\n grad.append('stop').attr('offset', 0).attr('stop-color', fill).attr('stop-opacity', 0.7);\n grad.append('stop').attr('offset', 1).attr('stop-color', fill).attr('stop-opacity', 0);\n // Path first so the head circle sits on top.\n group\n .append('path')\n .classed('dx-swarm-tail', true)\n .attr('fill', 'none')\n .attr('stroke', `url(#${gradId})`)\n .attr('stroke-width', strokeWidth)\n .attr('stroke-linecap', 'round')\n .attr('stroke-linejoin', 'round')\n .attr('pointer-events', 'none');\n group.append('circle').attr('r', r).style('cursor', 'pointer').style('fill', fill);\n };\n\n case 'lattice':\n return (group, node) => {\n const r = node.r ?? 6;\n const sz = r * 2;\n group\n .append('rect')\n .attr('x', -r)\n .attr('y', -r)\n .attr('width', sz)\n .attr('height', sz)\n .attr('rx', r * 0.3)\n .attr('ry', r * 0.3)\n .style('cursor', 'pointer')\n .style('fill', getNodeFillForObject(node.data?.data?.object as Obj.Unknown | undefined));\n };\n\n case 'cluster':\n return (group, node) => {\n const obj = node.data?.data?.object as Obj.Unknown | undefined;\n const r = node.r ?? 4;\n // Synthetic root / group nodes have no underlying ECHO object; render them as\n // smaller, neutral circles so the hierarchy reads as \"structure + leaves\".\n group\n .append('circle')\n .attr('r', r)\n .style('cursor', 'pointer')\n .style('fill', obj ? getNodeFillForObject(obj) : 'var(--color-neutral-500)');\n const labelOptions = { delay: TWEEN_MS, duration: LABEL_FADE_MS };\n if (node.type === CLUSTER_NODE_TYPE_LEAF) {\n const text = labelForLeaf(node, obj);\n if (text) {\n appendRadialLeafLabel(group, node, text, r, labelOptions);\n }\n } else if (node.type === CLUSTER_NODE_TYPE_ROOT) {\n if (node.label) {\n appendRootLabel(group, node.label, r, labelOptions);\n }\n } else {\n if (node.label) {\n appendRadialGroupLabel(group, node, node.label, r, labelOptions);\n }\n }\n };\n\n case 'bundle':\n // Bundle layout renders ONLY leaves (root/group are invisible routing anchors).\n return (group, node) => {\n const obj = node.data?.data?.object as Obj.Unknown | undefined;\n const r = node.r ?? 4;\n group\n .append('circle')\n .attr('r', r)\n .style('cursor', 'pointer')\n .style('fill', obj ? getNodeFillForObject(obj) : 'var(--color-neutral-500)');\n const text = labelForLeaf(node, obj);\n if (text) {\n appendRadialLeafLabel(group, node, text, r, { delay: TWEEN_MS, duration: LABEL_FADE_MS });\n }\n };\n\n case 'plexus':\n // Three node kinds: the focus at the centre (larger, object fill), synthetic relation\n // nodes on the inner ring (neutral, labelled by relation/property), and object leaves on\n // the outer ring (object fill). Type tags are set by the projector.\n return (group, node) => {\n const obj = node.data?.data?.object as Obj.Unknown | undefined;\n const labelOptions = { delay: TWEEN_MS, duration: LABEL_FADE_MS };\n\n // Size by node type (not node.r): the renderer bakes the circle radius at enter time\n // from the tween's start value, so a node.r fallback would inherit the previous\n // variant's radius. All leaves + relations share the base size; the focus is double.\n if (node.type === PLEXUS_NODE_TYPE_RELATION) {\n const r = PLEXUS_LEAF_RADIUS;\n group.append('circle').attr('r', r).style('cursor', 'default').style('fill', 'var(--color-neutral-500)');\n if (node.label) {\n appendRadialGroupLabel(group, node, node.label, r, labelOptions);\n }\n return;\n }\n\n const isFocus = node.type === PLEXUS_NODE_TYPE_FOCUS;\n const r = isFocus ? PLEXUS_FOCUS_RADIUS : PLEXUS_LEAF_RADIUS;\n group\n .append('circle')\n .attr('r', r)\n .style('cursor', 'pointer')\n .style('fill', obj ? getNodeFillForObject(obj) : 'var(--color-neutral-500)');\n const text = labelForLeaf(node, obj);\n if (text) {\n if (isFocus) {\n appendRootLabel(group, text, r, labelOptions);\n } else {\n appendRadialLeafLabel(group, node, text, r, labelOptions);\n }\n }\n };\n }\n};\n\n/**\n * Group leaves by typename so same-type leaves cluster together — used by both the\n * cluster (visible structural nodes) and bundle (invisible routing anchors) projectors.\n */\nconst typenameGroupOf = (node: GraphLayoutNode<SpaceGraphNode>): string | undefined => {\n const obj = node.data?.data?.object;\n return obj ? (Obj.getTypename(obj) ?? '(untyped)') : undefined;\n};\n\n/** Drop the package prefix from a typename for display: `org.dxos.type.Person` → `Person`. */\nconst shortTypename = (typename: string): string => {\n const last = typename.split('.').pop() ?? typename;\n return last.charAt(0).toUpperCase() + last.slice(1);\n};\n\n/** Resolve a leaf's display label from its ECHO object, falling back to node-level metadata. */\nconst labelForLeaf = (node: GraphLayoutNode<SpaceGraphNode>, obj: Obj.Unknown | undefined): string | undefined =>\n (obj && Obj.getLabel(obj)) ?? node.data?.data?.label ?? node.id;\n"],
5
+ "mappings": ";;;;;;AAIA,OAAOA,UAASC,eAAAA,cAAaC,aAAAA,YAAWC,WAAAA,UAASC,YAAAA,iBAAgB;AAGjE,SAAsBC,OAAAA,YAAsB;AAC5C,SAASC,oBAAoB;AAC7B,SAASC,iBAAiB;AAC1B,SAASC,kBAAkBC,MAAMC,OAAOC,eAAe;AACvD,SAASC,mBAA0C;AACnD,OAAO;AAGP,SAASC,qBAAqB;;;ACRvB,IAAMC,WAA6E;EACxF;IACEC,OAAO;IACPC,MAAM;IACNC,OAAO;EACT;EACA;IACEF,OAAO;IACPC,MAAM;IACNC,OAAO;EACT;EACA;IACEF,OAAO;IACPC,MAAM;IACNC,OAAO;EACT;EACA;IACEF,OAAO;IACPC,MAAM;IACNC,OAAO;EACT;EACA;IACEF,OAAO;IACPC,MAAM;IACNC,OAAO;EACT;EACA;IACEF,OAAO;IACPC,MAAM;IACNC,OAAO;EACT;;AAGK,IAAMC,YAAY,CAACH,UACxBA,UAAU,WACVA,UAAU,aACVA,UAAU,YACVA,UAAU,aACVA,UAAU,WACVA,UAAU;;;AC1CZ,SAASI,i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AS;AAE7B,MAAI,CAACQ,MAAM,CAACG,OAAO;AACjB,WAAO;EACT;AAEA,SACE,gBAAAmC,OAAA,cAACC,MAAMC,MAAI;IAAChD;KACT6C,eACC,gBAAAC,OAAA,cAACC,MAAME,SAAO;IAACC,SAAAA;KACb,gBAAAJ,OAAA,cAACG,QAAQD,MAAI,MACX,gBAAAF,OAAA,cAACK,aAAAA;IAAY3C;IAAQ4C,UAAUpC;MAC/B,gBAAA8B,OAAA,cAACG,QAAQI,aAAW;IAACC,MAAK;IAASpC,OAAOE;IAAUmC,eAAe/B;KAChEgC,SAASC,IAAI,CAAC,EAAEvC,OAAOwC,MAAM3B,MAAK,MACjC,gBAAAe,OAAA,cAACG,QAAQU,iBAAe;IAACC,KAAK1C;IAAOA;IAAc2C,cAAY9B;IAAO+B,OAAO/B;KAC3E,gBAAAe,OAAA,cAACiB,MAAAA;IAAKL;IAAYM,MAAM;WAOpC,gBAAAlB,OAAA,cAACC,MAAMkB,SAAO,MACZ,gBAAAnB,OAAA,cAACoB,eAAAA;IACCC,YAAW;IACXjE,SAASkB;IACTT;IACAyD,aAAajC;IACbkC,gBAAgB5C;;AAK1B;",
6
+ "names": ["React", "useCallback", "useEffect", "useMemo", "useState", "Obj", "QueryBuilder", "useObject", "DxAnchorActivate", "Icon", "Panel", "Toolbar", "QueryEditor", "useGraphModel", "VARIANTS", "value", "icon", "label", "isVariant", "curveCatmullRom", "line", "d3Line", "React", "useCallback", "useEffect", "useMemo", "useRef", "useState", "Obj", "CLUSTER_NODE_TYPE_LEAF", "CLUSTER_NODE_TYPE_ROOT", "GraphBundleProjector", "GraphClusterProjector", "GraphForceProjector", "GraphLatticeProjector", "GraphPlexusProjector", "GraphSwarmProjector", "PLEXUS_NODE_TYPE_FOCUS", "PLEXUS_NODE_TYPE_RELATION", "SVG", "appendRadialGroupLabel", "appendRadialLeafLabel", "appendRootLabel", "mx", "Visualization", "classNames", "debug", "variant", "model", "onNodeHover", "onSurfaceClick", "svgRef", "useRef", "projector", "setProjector", "useState", "projectorRef", "undefined", "current", "focusId", "setFocusId", "lastLayoutRef", "useEffect", "subscribe", "layout", "createProjector", "handleSelect", "useCallback", "node", "data", "object", "id", "renderNode", "useMemo", "createRenderNode", "applyNode", "applyNodeSwarm", "handlePointerMove", "point", "GraphSwarmProjector", "setCursor", "x", "y", "handlePointerLeave", "handleInspect", "event", "swarmPointerProps", "onPointerMove", "onPointerLeave", "div", "className", "mx", "onClick", "SVG", "Root", "ref", "Zoom", "extent", "Graph", "edgeOpacity", "drag", "highlightOnHover", "onSelect", "onInspect", "FPS", "TWEEN_MS", "LABEL_FADE_MS", "PLEXUS_LEAF_RADIUS", "PLEXUS_FOCUS_RADIUS", "swarmTrailLine", "d3Line", "curve", "curveCatmullRom", "alpha", "group", "swarm", "path", "querySelector", "grad", "history", "length", "setAttribute", "hx", "hy", "points", "i", "push", "oldest", "String", "ctx", "prev", "GraphForceProjector", "GraphLatticeProjector", "duration", "radius", "sortBy", "obj", "typename", "Obj", "getTypename", "label", "getLabel", "GraphClusterProjector", "groupOf", "typenameGroupOf", "rootLabel", "groupLabel", "shortTypename", "rootRadius", "groupRadius", "GraphBundleProjector", "GraphPlexusProjector", "focus", "relationOf", "plexusRelationOf", "leafRadius", "relationRadius", "focusRadius", "edge", "outgoing", "source", "incoming", "target", "direction", "arrow", "type", "relation", "name", "key", "property", "r", "append", "attr", "style", "getNodeFillForObject", "fill", "strokeWidth", "Math", "max", "gradId", "replace", "classed", "sz", "labelOptions", "delay", "CLUSTER_NODE_TYPE_LEAF", "text", "labelForLeaf", "appendRadialLeafLabel", "CLUSTER_NODE_TYPE_ROOT", "appendRootLabel", "appendRadialGroupLabel", "PLEXUS_NODE_TYPE_RELATION", "isFocus", "PLEXUS_NODE_TYPE_FOCUS", "last", "split", "pop", "charAt", "toUpperCase", "slice", "ExplorerArticle", "role", "subject", "variant", "view", "useObject", "filter", "setFilter", "useState", "db", "Obj", "getDatabase", "model", "useGraphModel", "builder", "useMemo", "QueryBuilder", "handleChange", "useCallback", "value", "build", "selected", "setSelected", "isVariant", "useEffect", "handleVariantChange", "handleDismiss", "document", "defaultView", "dispatchEvent", "DxAnchorActivate", "dxn", "label", "trigger", "body", "state", "handleHover", "node", "event", "obj", "data", "isObject", "getURI", "target", "kind", "getLabel", "showToolbar", "React", "Panel", "Root", "Toolbar", "asChild", "QueryEditor", "onChange", "ToggleGroup", "type", "onValueChange", "VARIANTS", "map", "icon", "ToggleGroupItem", "key", "aria-label", "title", "Icon", "size", "Content", "Visualization", "classNames", "onNodeHover", "onSurfaceClick"]
7
+ }
@@ -0,0 +1,10 @@
1
+ import {
2
+ ExplorerPlugin,
3
+ ExplorerPlugin_default
4
+ } from "./chunk-3D7BYXOR.mjs";
5
+ import "./chunk-J5LGTIGS.mjs";
6
+ export {
7
+ ExplorerPlugin,
8
+ ExplorerPlugin_default as default
9
+ };
10
+ //# sourceMappingURL=ExplorerPlugin.mjs.map
@@ -0,0 +1,11 @@
1
+ import "../chunk-J5LGTIGS.mjs";
2
+
3
+ // src/capabilities/index.ts
4
+ import { Capability } from "@dxos/app-framework";
5
+ var CreateObject = Capability.lazy("CreateObject", () => import("../create-object-F6TKVAGV.mjs"));
6
+ var ReactSurface = Capability.lazy("ReactSurface", () => import("../react-surface-APBW2VQG.mjs"));
7
+ export {
8
+ CreateObject,
9
+ ReactSurface
10
+ };
11
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/capabilities/index.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const CreateObject = Capability.lazy('CreateObject', () => import('./create-object'));\nexport const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));\n"],
5
+ "mappings": ";;;AAIA,SAASA,kBAAkB;AAEpB,IAAMC,eAAeD,WAAWE,KAAK,gBAAgB,MAAM,OAAO,+BAAA,CAAA;AAClE,IAAMC,eAAeH,WAAWE,KAAK,gBAAgB,MAAM,OAAO,+BAAA,CAAA;",
6
+ "names": ["Capability", "CreateObject", "lazy", "ReactSurface"]
7
+ }
@@ -0,0 +1,37 @@
1
+ // src/ExplorerPlugin.tsx
2
+ import { Plugin } from "@dxos/app-framework";
3
+ import { AppPlugin } from "@dxos/app-toolkit";
4
+ import { CreateObject, ReactSurface } from "#capabilities";
5
+ import { meta } from "#meta";
6
+ import { translations } from "#translations";
7
+ import { Graph } from "#types";
8
+
9
+ // raw-loader:/__w/dxos/dxos/packages/plugins/plugin-explorer/PLUGIN.mdl?raw
10
+ var PLUGIN_default = "---\nid: org.dxos.plugin.explorer\nname: ExplorerPlugin\nversion: 0.1.0\n---\n\nAn interactive hypergraph visualization plugin for `DXOS` Composer that reveals relationships between objects in a workspace.\nThe plugin renders a live `Graph` object \u2014 backed by a `View` and a `QueryAST` query \u2014 through four switchable layout\nvariants: force-directed, radial cluster, edge bundling, and lattice.\nNode colours are derived from ECHO object types; hovering a node triggers an anchor-card preview.\n\n## Extensions\n\nThe following extension dialects are used in this document.\nEach extension is defined in the Appendix or resolved via its URI.\n\n| Term | URI |\n|-------------|--------------------------------|\n| `type` | `org.dxos.mdl.type@1.0` |\n| `feat` | `org.dxos.mdl.feat@1.0` |\n| `test` | `org.dxos.mdl.test@1.0` |\n| `component` | `org.dxos.mdl.component@1.0` |\n| `op` | `org.dxos.mdl.op@1.0` |\n\n## Types\n\n```mdl\ntype QueryInput\n fields:\n raw?: string # raw query string entered by the user\n ast: QueryAST.Query # compiled AST produced by QueryBuilder\n```\n\n```mdl\ntype GraphObject\n desc: ECHO-persistent object that describes a hypergraph visualisation session.\n fields:\n name?: string\n view: Ref<View> # schema view that defines visible fields\n query: QueryInput\n```\n\n```mdl\ntype ExplorerVariant\n literals: force | cluster | bundle | lattice\n```\n\n## Components\n\n```mdl\ncomponent ExplorerArticle\n desc: |\n Top-level article / section surface for a Graph object.\n Renders one of four SVG layout variants and a toolbar for switching between them.\n props:\n role: article | section\n subject: Ref<View>\n attendableId?: string\n state:\n variant: ExplorerVariant # active layout; default force\n filter?: Filter.Any # compiled from toolbar query input\n model?: SpaceGraphModel # live reactive graph built from db + filter\n slots:\n toolbar?: ReactNode # shown only when role === article\n actions:\n setVariant(v: ExplorerVariant)\n setFilter(raw: string)\n layout: |\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 [toolbar slot \u2014 article only] \u2502\n \u2502 [QueryEditor] [variant tabs] \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 \u2502\n \u2502 SVG canvas (force / cluster \u2502\n \u2502 / bundle / lattice) \u2502\n \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n```mdl\ncomponent Visualization\n desc: |\n Internal component that owns a single persistent SVG.Graph mount.\n Swaps the active GraphProjector when the variant changes, seeding the\n new projector with the previous layout so node positions tween smoothly.\n props:\n variant: ExplorerVariant\n model: SpaceGraphModel\n state:\n projector?: GraphProjector<SpaceGraphNode>\n actions:\n createProjector(variant: ExplorerVariant, prev?: GraphLayout) \u2192 GraphProjector\n createRenderNode(variant: ExplorerVariant) \u2192 RenderNode\n```\n\n## Operations\n\n```mdl\nop createGraph\n desc: |\n Creates a new Graph object scoped to a target space or collection.\n Derives a ViewModel from the database for the selected typename, then\n writes the object via SpaceOperation.AddObject.\n input:\n name?: string\n typename?: string # ECHO typename used to seed the initial view\n target: Space | Collection\n targetNodeId?: string\n output: GraphObject\n effects: [echo:write]\n note: |\n The typename is resolved through ViewModel.makeFromDatabase; the resulting\n View is stored as a Ref inside the Graph object.\n```\n\n```mdl\nop buildFilter\n desc: |\n Compiles a raw query string into a Filter via QueryBuilder.\n Pure \u2014 no side effects; result is passed to SpaceGraphModel.setFilter.\n input:\n raw: string\n output: Filter.Any\n errors:\n ParseError: raw string is not valid query syntax\n```\n\n## Features\n\n```mdl\nfeat F-1: Graph Object\n\n req F-1.1: A Graph object stores a name, a View ref, and a compiled QueryAST.\n req F-1.2:\n when: user creates a new graph\n then: op:createGraph derives a ViewModel from the chosen typename and writes the Graph to ECHO\n\n req F-1.3:\n when: Graph is persisted\n then: it appears in the space object list and can be opened as an article\n```\n\n```mdl\nfeat F-2: Live Graph Model\n\n req F-2.1:\n when: ExplorerArticle mounts with a valid Graph subject\n then: SpaceGraphModel is opened against the subject's database\n\n req F-2.2:\n when: user types a query in the toolbar\n then: op:buildFilter compiles the raw string; model.setFilter applied; SVG re-renders\n\n req F-2.3:\n when: Graph is unmounted\n then: SpaceGraphModel is closed and all subscriptions released\n\n req F-2.4:\n when: an ECHO object in the database changes\n then: SpaceGraphModel emits an update and SVG.Graph re-renders without full remount\n tags: [reactive, collaborative]\n```\n\n```mdl\nfeat F-3: Visualization Variants\n\n req F-3.1:\n when: variant tab is selected\n then: Visualization swaps projector; previous node x/y seed the new projector so positions tween\n\n req F-3.2:\n when: variant is force\n then: SVG.Zoom wrapper is mounted enabling pan/zoom drag interaction\n\n req F-3.3:\n when: variant is cluster or bundle\n then: no SVG.Zoom wrapper; leaves grouped by typename; radial labels fade in after tween\n\n req F-3.4:\n when: variant is lattice\n then: nodes rendered as small rounded rectangles sorted by typename then label\n\n req F-3.5:\n when: variant is cluster and user clicks a root or group node\n then: subtree toggles collapsed/expanded via GraphClusterProjector.toggleCollapsed\n```\n\n```mdl\nfeat F-4: Node Interaction\n\n req F-4.1:\n when: pointer enters a node\n then: DxAnchorActivate event dispatched with the object's DXN and label, kind: card\n\n req F-4.2:\n when: pointer leaves a node\n then: DxAnchorActivate cleared (onNodeHover called with null)\n\n req F-4.3:\n when: node has no underlying ECHO object (synthetic root / group)\n then: no preview dispatched; node rendered in neutral colour\n```\n\n## Acceptance\n\n```mdl\ntest T-1: Graph creation\n given: user opens the object creation dialog and selects Graph\n when: a typename is selected and the form submitted\n then:\n - op:createGraph runs without error\n - new Graph object visible in space object list\n - Graph.view references a valid View object\n```\n\n```mdl\ntest T-2: Article mounts model\n given: a Graph with a populated query\n when: ExplorerArticle is rendered with role === article\n then:\n - SpaceGraphModel is opened\n - SVG canvas renders nodes derived from the database\n - toolbar shows QueryEditor and variant tabs\n```\n\n```mdl\ntest T-3: Variant switch preserves positions\n given: force variant is active with nodes positioned\n when: user switches to cluster variant\n then:\n - projector is recreated from previous layout\n - nodes tween from old positions to cluster target positions\n - SVG.Zoom wrapper is absent in the new mount\n```\n\n```mdl\ntest T-4: Query filter updates graph\n given: ExplorerArticle is open with all objects visible\n when: user types a typename filter in QueryEditor\n then:\n - op:buildFilter returns a Filter without error\n - SpaceGraphModel.setFilter applied\n - only matching nodes remain visible in the SVG\n```\n\n```mdl\ntest T-5: Node hover preview\n given: force-directed graph with at least one ECHO object node\n when: pointer enters that node\n then:\n - DxAnchorActivate event fired with correct DXN\n - kind === card\n```\n\n```mdl\ntest T-6: Lattice sort order\n given: database contains objects of two typenames A and B\n when: lattice variant is active\n then:\n - all typename-A nodes appear before typename-B nodes (or vice-versa, consistent order)\n - within each group nodes are ordered alphabetically by label\n```\n\n```mdl\ntest T-7: Model closed on unmount\n given: ExplorerArticle is mounted and SpaceGraphModel is open\n when: component unmounts\n then:\n - SpaceGraphModel.close() is called\n - no lingering ECHO subscriptions remain\n```\n\n---\n\n## Appendix: Extension Definitions\n\nExtension block types used in this document are defined below using\nthe core `ext` primitive \u2014 the only construct the base language provides.\n\n```mdl\next type\n uri: org.dxos.mdl.type@1.0\n desc: A named data structure with typed fields and optional literals.\n fields:\n desc?: Prose\n fields?: FieldMap # name[?]: TypeExpr (# inline comment)\n literals?: UnionList # a | b | c\n extends?: TypeRef[]\n```\n\n```mdl\next feat\n uri: org.dxos.mdl.feat@1.0\n desc: A named feature grouping one or more requirements.\n fields:\n desc?: Prose\n req: RequirementList\n nesting: self # feat blocks may contain feat blocks\n```\n\n```mdl\next test\n uri: org.dxos.mdl.test@1.0\n desc: An acceptance scenario expressed as given / when / then steps.\n fields:\n given?: Step | Step[]\n when?: Step | Step[]\n then: Step | Step[]\n tags?: TagList\n```\n\n```mdl\next component\n uri: org.dxos.mdl.component@1.0\n desc: A UI component with props, internal state, slots, actions, and events.\n fields:\n desc?: Prose\n props?: FieldMap # external inputs (immutable inside component)\n state?: FieldMap # internal reactive state\n slots?: FieldMap # named ReactNode injection points\n actions?: ActionMap # methods the component exposes or handles\n emits?: EventMap # events the component raises to its parent\n layout?: CodeBlock # ASCII sketch of visual structure (non-normative)\n```\n\n```mdl\next op\n uri: org.dxos.mdl.op@1.0\n desc: |\n A named operation with typed inputs, outputs, and declared errors.\n Pure ops have no effects or requires. Effectful ops declare both.\n fields:\n desc?: Prose\n input?: FieldMap # named input parameters\n output?: TypeExpr # return type\n errors?: ErrorMap # name: Prose (when this error occurs)\n effects?: EffectList # echo:read | echo:write | http | fs | ...\n requires?: ServiceList # injected service dependencies\n note?: Prose # implementation guidance (non-normative)\n```\n";
11
+
12
+ // src/ExplorerPlugin.tsx
13
+ var ExplorerPlugin = Plugin.define(meta).pipe(AppPlugin.addCreateObjectModule({
14
+ activate: CreateObject
15
+ }), AppPlugin.addSchemaModule({
16
+ schema: [
17
+ Graph.Graph
18
+ ]
19
+ }), AppPlugin.addSurfaceModule({
20
+ activate: ReactSurface
21
+ }), AppPlugin.addTranslationsModule({
22
+ translations
23
+ }), AppPlugin.addPluginAssetModule({
24
+ asset: {
25
+ pluginId: meta.id,
26
+ path: "PLUGIN.mdl",
27
+ content: PLUGIN_default,
28
+ mimeType: "application/x-mdl"
29
+ }
30
+ }), Plugin.make);
31
+ var ExplorerPlugin_default = ExplorerPlugin;
32
+
33
+ export {
34
+ ExplorerPlugin,
35
+ ExplorerPlugin_default
36
+ };
37
+ //# sourceMappingURL=chunk-3D7BYXOR.mjs.map