@dxos/plugin-explorer 0.9.0 → 0.9.1-staging.ee54ba693a

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 (162) hide show
  1. package/dist/lib/neutral/ExplorerArticle-2WPXYTXV.mjs +101 -0
  2. package/dist/lib/neutral/ExplorerArticle-2WPXYTXV.mjs.map +7 -0
  3. package/dist/lib/neutral/ExplorerPlugin.mjs +1 -1
  4. package/dist/lib/neutral/NeighborhoodCompanion-WC6E3YE6.mjs +90 -0
  5. package/dist/lib/neutral/NeighborhoodCompanion-WC6E3YE6.mjs.map +7 -0
  6. package/dist/lib/neutral/app-graph-builder-L2TJ6GNR.mjs +37 -0
  7. package/dist/lib/neutral/app-graph-builder-L2TJ6GNR.mjs.map +7 -0
  8. package/dist/lib/neutral/capabilities/index.mjs +4 -2
  9. package/dist/lib/neutral/capabilities/index.mjs.map +3 -3
  10. package/dist/lib/neutral/{chunk-3D7BYXOR.mjs → chunk-4F6AT7RA.mjs} +6 -4
  11. package/dist/lib/neutral/chunk-4F6AT7RA.mjs.map +7 -0
  12. package/dist/lib/neutral/chunk-C56B464A.mjs +53 -0
  13. package/dist/lib/neutral/chunk-C56B464A.mjs.map +7 -0
  14. package/dist/lib/neutral/{chunk-7XUDLV6E.mjs → chunk-EZ52JY7X.mjs} +34 -31
  15. package/dist/lib/neutral/chunk-EZ52JY7X.mjs.map +7 -0
  16. package/dist/lib/neutral/{chunk-YBCHBVCJ.mjs → chunk-TTFPTHAQ.mjs} +8 -8
  17. package/dist/lib/neutral/chunk-TTFPTHAQ.mjs.map +7 -0
  18. package/dist/lib/neutral/components/index.mjs +430 -506
  19. package/dist/lib/neutral/components/index.mjs.map +4 -4
  20. package/dist/lib/neutral/containers/index.mjs +4 -2
  21. package/dist/lib/neutral/containers/index.mjs.map +3 -3
  22. package/dist/lib/neutral/{create-object-F6TKVAGV.mjs → create-object-WKIN3OB6.mjs} +3 -4
  23. package/dist/lib/neutral/{create-object-F6TKVAGV.mjs.map → create-object-WKIN3OB6.mjs.map} +3 -3
  24. package/dist/lib/neutral/hooks/index.mjs +64 -1
  25. package/dist/lib/neutral/hooks/index.mjs.map +4 -4
  26. package/dist/lib/neutral/index.mjs +2 -2
  27. package/dist/lib/neutral/meta.json +1 -1
  28. package/dist/lib/neutral/meta.mjs +1 -1
  29. package/dist/lib/neutral/plugin.mjs +1 -1
  30. package/dist/lib/neutral/react-surface-EWPG5PUQ.mjs +39 -0
  31. package/dist/lib/neutral/react-surface-EWPG5PUQ.mjs.map +7 -0
  32. package/dist/lib/neutral/testing/index.mjs +2 -2
  33. package/dist/lib/neutral/testing/index.mjs.map +2 -2
  34. package/dist/lib/neutral/translations.mjs +5 -2
  35. package/dist/lib/neutral/translations.mjs.map +3 -3
  36. package/dist/lib/neutral/types/index.mjs +1 -1
  37. package/dist/types/dx.config.d.ts +28 -0
  38. package/dist/types/dx.config.d.ts.map +1 -0
  39. package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
  40. package/dist/types/src/capabilities/app-graph-builder.d.ts +9 -0
  41. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  42. package/dist/types/src/capabilities/create-object.d.ts +1 -7
  43. package/dist/types/src/capabilities/create-object.d.ts.map +1 -1
  44. package/dist/types/src/capabilities/index.d.ts +3 -7
  45. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  46. package/dist/types/src/capabilities/react-surface.d.ts +2 -2
  47. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  48. package/dist/types/src/components/Lattice/Lattice.d.ts +1 -1
  49. package/dist/types/src/components/Lattice/Lattice.d.ts.map +1 -1
  50. package/dist/types/src/components/Tree/EdgeBundling.stories.d.ts +1 -1
  51. package/dist/types/src/components/Tree/EdgeBundling.stories.d.ts.map +1 -1
  52. package/dist/types/src/components/Tree/Tree.stories.d.ts +1 -1
  53. package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
  54. package/dist/types/src/components/Tree/index.d.ts +1 -3
  55. package/dist/types/src/components/Tree/index.d.ts.map +1 -1
  56. package/dist/types/src/components/Tree/types/tree.d.ts +10 -27
  57. package/dist/types/src/components/Tree/types/tree.d.ts.map +1 -1
  58. package/dist/types/src/components/Tree/types/types.d.ts +1 -10
  59. package/dist/types/src/components/Tree/types/types.d.ts.map +1 -1
  60. package/dist/types/src/components/Visualization/Visualization.d.ts +39 -0
  61. package/dist/types/src/components/Visualization/Visualization.d.ts.map +1 -0
  62. package/dist/types/src/components/Visualization/Visualization.stories.d.ts +13 -0
  63. package/dist/types/src/components/Visualization/Visualization.stories.d.ts.map +1 -0
  64. package/dist/types/src/components/Visualization/index.d.ts +3 -0
  65. package/dist/types/src/components/Visualization/index.d.ts.map +1 -0
  66. package/dist/types/src/components/Visualization/variants.d.ts +53 -0
  67. package/dist/types/src/components/Visualization/variants.d.ts.map +1 -0
  68. package/dist/types/src/components/index.d.ts +1 -0
  69. package/dist/types/src/components/index.d.ts.map +1 -1
  70. package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.d.ts +2 -2
  71. package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.d.ts.map +1 -1
  72. package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.stories.d.ts +2 -2
  73. package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.stories.d.ts.map +1 -1
  74. package/dist/types/src/containers/NeighborhoodCompanion/NeighborhoodCompanion.d.ts +14 -0
  75. package/dist/types/src/containers/NeighborhoodCompanion/NeighborhoodCompanion.d.ts.map +1 -0
  76. package/dist/types/src/containers/NeighborhoodCompanion/index.d.ts +2 -0
  77. package/dist/types/src/containers/NeighborhoodCompanion/index.d.ts.map +1 -0
  78. package/dist/types/src/containers/index.d.ts +1 -0
  79. package/dist/types/src/containers/index.d.ts.map +1 -1
  80. package/dist/types/src/hooks/index.d.ts +1 -0
  81. package/dist/types/src/hooks/index.d.ts.map +1 -1
  82. package/dist/types/src/hooks/useNeighborhoodModel.d.ts +14 -0
  83. package/dist/types/src/hooks/useNeighborhoodModel.d.ts.map +1 -0
  84. package/dist/types/src/meta.d.ts +32 -2
  85. package/dist/types/src/meta.d.ts.map +1 -1
  86. package/dist/types/src/testing/relations.d.ts +1 -2
  87. package/dist/types/src/testing/relations.d.ts.map +1 -1
  88. package/dist/types/src/translations.d.ts +6 -0
  89. package/dist/types/src/translations.d.ts.map +1 -1
  90. package/dist/types/src/types/Graph.d.ts +6 -8
  91. package/dist/types/src/types/Graph.d.ts.map +1 -1
  92. package/dist/types/tsconfig.tsbuildinfo +1 -1
  93. package/{dist/lib/neutral/chunk-42BYLQQA.mjs → dx.config.ts} +18 -21
  94. package/package.json +42 -37
  95. package/src/ExplorerPlugin.test.ts +1 -1
  96. package/src/ExplorerPlugin.tsx +3 -2
  97. package/src/capabilities/app-graph-builder.ts +40 -0
  98. package/src/capabilities/create-object.ts +3 -2
  99. package/src/capabilities/index.ts +1 -0
  100. package/src/capabilities/react-surface.tsx +14 -4
  101. package/src/components/Lattice/Lattice.tsx +1 -2
  102. package/src/components/Tree/EdgeBundling.stories.tsx +5 -3
  103. package/src/components/Tree/Tree.stories.tsx +7 -2
  104. package/src/components/Tree/index.ts +3 -3
  105. package/src/components/Tree/types/tree.ts +6 -6
  106. package/src/components/Tree/types/types.ts +1 -11
  107. package/src/components/Visualization/Visualization.stories.tsx +104 -0
  108. package/src/components/Visualization/Visualization.tsx +209 -0
  109. package/src/components/Visualization/index.ts +6 -0
  110. package/src/components/Visualization/variants.ts +508 -0
  111. package/src/components/index.ts +1 -0
  112. package/src/containers/ExplorerArticle/ExplorerArticle.stories.tsx +3 -3
  113. package/src/containers/ExplorerArticle/ExplorerArticle.tsx +9 -10
  114. package/src/containers/NeighborhoodCompanion/NeighborhoodCompanion.tsx +102 -0
  115. package/src/containers/NeighborhoodCompanion/index.ts +5 -0
  116. package/src/containers/index.ts +1 -0
  117. package/src/hooks/index.ts +1 -0
  118. package/src/hooks/useNeighborhoodModel.ts +81 -0
  119. package/src/meta.ts +2 -32
  120. package/src/testing/relations.ts +1 -3
  121. package/src/translations.ts +4 -1
  122. package/src/types/Graph.ts +18 -20
  123. package/dist/lib/neutral/ExplorerArticle-4I7PNGDC.mjs +0 -459
  124. package/dist/lib/neutral/ExplorerArticle-4I7PNGDC.mjs.map +0 -7
  125. package/dist/lib/neutral/chunk-3D7BYXOR.mjs.map +0 -7
  126. package/dist/lib/neutral/chunk-42BYLQQA.mjs.map +0 -7
  127. package/dist/lib/neutral/chunk-7XUDLV6E.mjs.map +0 -7
  128. package/dist/lib/neutral/chunk-IKHJV3Q4.mjs +0 -20
  129. package/dist/lib/neutral/chunk-IKHJV3Q4.mjs.map +0 -7
  130. package/dist/lib/neutral/chunk-YBCHBVCJ.mjs.map +0 -7
  131. package/dist/lib/neutral/react-surface-APBW2VQG.mjs +0 -26
  132. package/dist/lib/neutral/react-surface-APBW2VQG.mjs.map +0 -7
  133. package/dist/types/src/components/Tree/Tree.d.ts +0 -24
  134. package/dist/types/src/components/Tree/Tree.d.ts.map +0 -1
  135. package/dist/types/src/components/Tree/layout/HierarchicalEdgeBundling.d.ts +0 -40
  136. package/dist/types/src/components/Tree/layout/HierarchicalEdgeBundling.d.ts.map +0 -1
  137. package/dist/types/src/components/Tree/layout/RadialTree.d.ts +0 -37
  138. package/dist/types/src/components/Tree/layout/RadialTree.d.ts.map +0 -1
  139. package/dist/types/src/components/Tree/layout/TidyTree.d.ts +0 -26
  140. package/dist/types/src/components/Tree/layout/TidyTree.d.ts.map +0 -1
  141. package/dist/types/src/components/Tree/layout/hierarchy.d.ts +0 -17
  142. package/dist/types/src/components/Tree/layout/hierarchy.d.ts.map +0 -1
  143. package/dist/types/src/components/Tree/layout/index.d.ts +0 -6
  144. package/dist/types/src/components/Tree/layout/index.d.ts.map +0 -1
  145. package/dist/types/src/components/Tree/layout/slots.d.ts +0 -7
  146. package/dist/types/src/components/Tree/layout/slots.d.ts.map +0 -1
  147. package/dist/types/src/components/Tree/layout/useContainerSize.d.ts +0 -15
  148. package/dist/types/src/components/Tree/layout/useContainerSize.d.ts.map +0 -1
  149. package/dist/types/src/containers/ExplorerArticle/Visualization.d.ts +0 -18
  150. package/dist/types/src/containers/ExplorerArticle/Visualization.d.ts.map +0 -1
  151. package/dist/types/src/containers/ExplorerArticle/variants.d.ts +0 -9
  152. package/dist/types/src/containers/ExplorerArticle/variants.d.ts.map +0 -1
  153. package/src/components/Tree/Tree.tsx +0 -81
  154. package/src/components/Tree/layout/HierarchicalEdgeBundling.tsx +0 -335
  155. package/src/components/Tree/layout/RadialTree.tsx +0 -242
  156. package/src/components/Tree/layout/TidyTree.tsx +0 -246
  157. package/src/components/Tree/layout/hierarchy.ts +0 -32
  158. package/src/components/Tree/layout/index.ts +0 -9
  159. package/src/components/Tree/layout/slots.ts +0 -19
  160. package/src/components/Tree/layout/useContainerSize.ts +0 -43
  161. package/src/containers/ExplorerArticle/Visualization.tsx +0 -523
  162. package/src/containers/ExplorerArticle/variants.ts +0 -47
@@ -0,0 +1,101 @@
1
+ import "./chunk-J5LGTIGS.mjs";
2
+
3
+ // src/containers/ExplorerArticle/ExplorerArticle.tsx
4
+ import React, { useCallback, useEffect, useMemo, useState } from "react";
5
+ import { AppSurface } from "@dxos/app-toolkit/ui";
6
+ import { Obj } from "@dxos/echo";
7
+ import { QueryBuilder } from "@dxos/echo-query";
8
+ import { useObject } from "@dxos/react-client/echo";
9
+ import { DxAnchorActivate, Icon, Panel, Toolbar } from "@dxos/react-ui";
10
+ import { QueryEditor } from "@dxos/react-ui-components";
11
+ import "@dxos/react-ui-graph/styles/graph.css";
12
+ import { VARIANTS, Visualization, isVariant } from "#components";
13
+ import { useGraphModel } from "#hooks";
14
+ var ExplorerArticle = ({ role, subject, variant }) => {
15
+ const [view] = useObject(subject);
16
+ const [filter, setFilter] = useState();
17
+ const db = view && Obj.getDatabase(view);
18
+ const model = useGraphModel(db, filter);
19
+ const builder = useMemo(() => new QueryBuilder(), []);
20
+ const handleChange = useCallback((value) => {
21
+ setFilter(builder.build(value).filter);
22
+ }, [
23
+ builder
24
+ ]);
25
+ const [selected, setSelected] = useState(isVariant(variant) ? variant : "force");
26
+ useEffect(() => {
27
+ if (isVariant(variant)) {
28
+ setSelected(variant);
29
+ }
30
+ }, [
31
+ variant
32
+ ]);
33
+ const handleVariantChange = useCallback((value) => {
34
+ if (isVariant(value)) {
35
+ setSelected(value);
36
+ }
37
+ }, []);
38
+ const handleDismiss = useCallback(() => {
39
+ document.defaultView?.dispatchEvent(new DxAnchorActivate({
40
+ dxn: "",
41
+ label: "",
42
+ trigger: document.body,
43
+ state: false
44
+ }));
45
+ }, []);
46
+ const handleHover = useCallback((node, event) => {
47
+ if (!node || !event) {
48
+ return;
49
+ }
50
+ const obj = node.data;
51
+ if (!obj || !Obj.isObject(obj)) {
52
+ return;
53
+ }
54
+ const dxn = Obj.getURI(obj);
55
+ if (!dxn) {
56
+ return;
57
+ }
58
+ const target = event.target;
59
+ target.dispatchEvent(new DxAnchorActivate({
60
+ dxn,
61
+ kind: "card",
62
+ trigger: target,
63
+ label: Obj.getLabel(obj) ?? dxn
64
+ }));
65
+ }, []);
66
+ const showToolbar = role === AppSurface.Article.role;
67
+ if (!db || !model) {
68
+ return null;
69
+ }
70
+ return /* @__PURE__ */ React.createElement(Panel.Root, {
71
+ role
72
+ }, showToolbar && /* @__PURE__ */ React.createElement(Panel.Toolbar, {
73
+ asChild: true
74
+ }, /* @__PURE__ */ React.createElement(Toolbar.Root, null, /* @__PURE__ */ React.createElement(QueryEditor, {
75
+ db,
76
+ onChange: handleChange
77
+ }), /* @__PURE__ */ React.createElement(Toolbar.ToggleGroup, {
78
+ type: "single",
79
+ value: selected,
80
+ onValueChange: handleVariantChange
81
+ }, VARIANTS.map(({ value, icon, label }) => /* @__PURE__ */ React.createElement(Toolbar.ToggleGroupItem, {
82
+ key: value,
83
+ value,
84
+ "aria-label": label,
85
+ title: label
86
+ }, /* @__PURE__ */ React.createElement(Icon, {
87
+ icon,
88
+ size: 4
89
+ })))))), /* @__PURE__ */ React.createElement(Panel.Content, null, /* @__PURE__ */ React.createElement(Visualization.Root, {
90
+ classNames: "bg-base-surface",
91
+ variant: selected,
92
+ model,
93
+ onSurfaceClick: handleDismiss
94
+ }, /* @__PURE__ */ React.createElement(Visualization.Graph, {
95
+ onNodeHover: handleHover
96
+ }))));
97
+ };
98
+ export {
99
+ ExplorerArticle as default
100
+ };
101
+ //# sourceMappingURL=ExplorerArticle-2WPXYTXV.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/containers/ExplorerArticle/ExplorerArticle.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\n\nimport { 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 { type TreeNode } from '@dxos/react-ui-graph';\nimport '@dxos/react-ui-graph/styles/graph.css';\n\nimport { type ExplorerArticleVariant, VARIANTS, Visualization, isVariant } from '#components';\nimport { useGraphModel } from '#hooks';\n\nexport type { ExplorerArticleVariant } from '#components';\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 === AppSurface.Article.role;\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.Root\n classNames='bg-base-surface'\n variant={selected}\n model={model}\n onSurfaceClick={handleDismiss}\n >\n <Visualization.Graph onNodeHover={handleHover} />\n </Visualization.Root>\n </Panel.Content>\n </Panel.Root>\n );\n};\n"],
5
+ "mappings": ";;;AAIA,OAAOA,SAASC,aAAaC,WAAWC,SAASC,gBAAgB;AAEjE,SAASC,kBAAkB;AAC3B,SAAsBC,WAAsB;AAC5C,SAASC,oBAAoB;AAC7B,SAASC,iBAAiB;AAC1B,SAASC,kBAAkBC,MAAMC,OAAOC,eAAe;AACvD,SAASC,mBAA0C;AAEnD,OAAO;AAEP,SAAsCC,UAAUC,eAAeC,iBAAiB;AAChF,SAASC,qBAAqB;AAMvB,IAAMC,kBAAkB,CAAC,EAAEC,MAAMC,SAASC,QAAO,MAAwB;AAC9E,QAAM,CAACC,IAAAA,IAAQd,UAAUY,OAAAA;AACzB,QAAM,CAACG,QAAQC,SAAAA,IAAapB,SAAAA;AAE5B,QAAMqB,KAAKH,QAAQhB,IAAIoB,YAAYJ,IAAAA;AACnC,QAAMK,QAAQV,cAAcQ,IAAIF,MAAAA;AAEhC,QAAMK,UAAUzB,QAAQ,MAAM,IAAII,aAAAA,GAAgB,CAAA,CAAE;AACpD,QAAMsB,eAAe5B,YACnB,CAAC6B,UAAAA;AACCN,cAAUI,QAAQG,MAAMD,KAAAA,EAAOP,MAAM;EACvC,GACA;IAACK;GAAQ;AAGX,QAAM,CAACI,UAAUC,WAAAA,IAAe7B,SAAiCY,UAAUK,OAAAA,IAAWA,UAAU,OAAA;AAChGnB,YAAU,MAAA;AACR,QAAIc,UAAUK,OAAAA,GAAU;AACtBY,kBAAYZ,OAAAA;IACd;EACF,GAAG;IAACA;GAAQ;AAEZ,QAAMa,sBAAsBjC,YAAY,CAAC6B,UAAAA;AACvC,QAAId,UAAUc,KAAAA,GAAQ;AACpBG,kBAAYH,KAAAA;IACd;EACF,GAAG,CAAA,CAAE;AAIL,QAAMK,gBAAgBlC,YAAY,MAAA;AAChCmC,aAASC,aAAaC,cACpB,IAAI7B,iBAAiB;MAAE8B,KAAK;MAAIC,OAAO;MAAIC,SAASL,SAASM;MAAMC,OAAO;IAAM,CAAA,CAAA;EAEpF,GAAG,CAAA,CAAE;AAEL,QAAMC,cAAc3C,YAAY,CAAC4C,MAAuBC,UAAAA;AAGtD,QAAI,CAACD,QAAQ,CAACC,OAAO;AACnB;IACF;AACA,UAAMC,MAAMF,KAAKG;AACjB,QAAI,CAACD,OAAO,CAACzC,IAAI2C,SAASF,GAAAA,GAAM;AAC9B;IACF;AACA,UAAMR,MAAMjC,IAAI4C,OAAOH,GAAAA;AACvB,QAAI,CAACR,KAAK;AACR;IACF;AAEA,UAAMY,SAASL,MAAMK;AACrBA,WAAOb,cACL,IAAI7B,iBAAiB;MACnB8B;MACAa,MAAM;MACNX,SAASU;MACTX,OAAOlC,IAAI+C,SAASN,GAAAA,KAAQR;IAC9B,CAAA,CAAA;EAEJ,GAAG,CAAA,CAAE;AAEL,QAAMe,cAAcnC,SAASd,WAAWkD,QAAQpC;AAEhD,MAAI,CAACM,MAAM,CAACE,OAAO;AACjB,WAAO;EACT;AAEA,SACE,sBAAA,cAAChB,MAAM6C,MAAI;IAACrC;KACTmC,eACC,sBAAA,cAAC3C,MAAMC,SAAO;IAAC6C,SAAAA;KACb,sBAAA,cAAC7C,QAAQ4C,MAAI,MACX,sBAAA,cAAC3C,aAAAA;IAAYY;IAAQiC,UAAU7B;MAC/B,sBAAA,cAACjB,QAAQ+C,aAAW;IAACC,MAAK;IAAS9B,OAAOE;IAAU6B,eAAe3B;KAChEpB,SAASgD,IAAI,CAAC,EAAEhC,OAAOiC,MAAMvB,MAAK,MACjC,sBAAA,cAAC5B,QAAQoD,iBAAe;IAACC,KAAKnC;IAAOA;IAAcoC,cAAY1B;IAAO2B,OAAO3B;KAC3E,sBAAA,cAAC9B,MAAAA;IAAKqD;IAAYK,MAAM;WAOpC,sBAAA,cAACzD,MAAM0D,SAAO,MACZ,sBAAA,cAACtD,cAAcyC,MAAI;IACjBc,YAAW;IACXjD,SAASW;IACTL;IACA4C,gBAAgBpC;KAEhB,sBAAA,cAACpB,cAAcyD,OAAK;IAACC,aAAa7B;;AAK5C;",
6
+ "names": ["React", "useCallback", "useEffect", "useMemo", "useState", "AppSurface", "Obj", "QueryBuilder", "useObject", "DxAnchorActivate", "Icon", "Panel", "Toolbar", "QueryEditor", "VARIANTS", "Visualization", "isVariant", "useGraphModel", "ExplorerArticle", "role", "subject", "variant", "view", "filter", "setFilter", "db", "getDatabase", "model", "builder", "handleChange", "value", "build", "selected", "setSelected", "handleVariantChange", "handleDismiss", "document", "defaultView", "dispatchEvent", "dxn", "label", "trigger", "body", "state", "handleHover", "node", "event", "obj", "data", "isObject", "getURI", "target", "kind", "getLabel", "showToolbar", "Article", "Root", "asChild", "onChange", "ToggleGroup", "type", "onValueChange", "map", "icon", "ToggleGroupItem", "key", "aria-label", "title", "size", "Content", "classNames", "onSurfaceClick", "Graph", "onNodeHover"]
7
+ }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ExplorerPlugin,
3
3
  ExplorerPlugin_default
4
- } from "./chunk-3D7BYXOR.mjs";
4
+ } from "./chunk-4F6AT7RA.mjs";
5
5
  import "./chunk-J5LGTIGS.mjs";
6
6
  export {
7
7
  ExplorerPlugin,
@@ -0,0 +1,90 @@
1
+ import "./chunk-J5LGTIGS.mjs";
2
+
3
+ // src/containers/NeighborhoodCompanion/NeighborhoodCompanion.tsx
4
+ import React, { useCallback, useState } from "react";
5
+ import { Obj } from "@dxos/echo";
6
+ import { DxAnchorActivate, Panel, Toolbar, useTranslation } from "@dxos/react-ui";
7
+ import "@dxos/react-ui-graph/styles/graph.css";
8
+ import { Visualization } from "#components";
9
+ import { DEFAULT_NEIGHBORHOOD_DEPTH, useNeighborhoodModel } from "#hooks";
10
+ import { meta } from "#meta";
11
+ var DEPTHS = [
12
+ 1,
13
+ 2,
14
+ 3
15
+ ];
16
+ var NeighborhoodCompanion = ({ role = "article", subject }) => {
17
+ const { t } = useTranslation(meta.profile.key);
18
+ const [depth, setDepth] = useState(DEFAULT_NEIGHBORHOOD_DEPTH);
19
+ const model = useNeighborhoodModel(subject, depth);
20
+ const handleDepthChange = useCallback((value) => {
21
+ const next = Number.parseInt(value, 10);
22
+ if (Number.isFinite(next)) {
23
+ setDepth(next);
24
+ }
25
+ }, []);
26
+ const handleDismiss = useCallback(() => {
27
+ document.defaultView?.dispatchEvent(new DxAnchorActivate({
28
+ dxn: "",
29
+ label: "",
30
+ trigger: document.body,
31
+ state: false
32
+ }));
33
+ }, []);
34
+ const handleHover = useCallback((node, event) => {
35
+ if (!node || !event) {
36
+ return;
37
+ }
38
+ const obj = node.data;
39
+ if (!obj || !Obj.isObject(obj)) {
40
+ return;
41
+ }
42
+ const dxn = Obj.getURI(obj);
43
+ if (!dxn) {
44
+ return;
45
+ }
46
+ const target = event.target;
47
+ target.dispatchEvent(new DxAnchorActivate({
48
+ dxn,
49
+ kind: "card",
50
+ trigger: target,
51
+ label: Obj.getLabel(obj) ?? dxn
52
+ }));
53
+ }, []);
54
+ if (!subject || !model) {
55
+ return null;
56
+ }
57
+ return /* @__PURE__ */ React.createElement(Panel.Root, {
58
+ role
59
+ }, /* @__PURE__ */ React.createElement(Panel.Toolbar, {
60
+ asChild: true
61
+ }, /* @__PURE__ */ React.createElement(Toolbar.Root, null, /* @__PURE__ */ React.createElement("div", {
62
+ role: "none",
63
+ className: "grow"
64
+ }), /* @__PURE__ */ React.createElement(Toolbar.ToggleGroup, {
65
+ type: "single",
66
+ value: String(depth),
67
+ onValueChange: handleDepthChange
68
+ }, DEPTHS.map((value) => /* @__PURE__ */ React.createElement(Toolbar.ToggleGroupItem, {
69
+ key: value,
70
+ value: String(value),
71
+ "aria-label": t("depth.label", {
72
+ count: value
73
+ }),
74
+ title: t("depth.label", {
75
+ count: value
76
+ })
77
+ }, value))))), /* @__PURE__ */ React.createElement(Panel.Content, null, /* @__PURE__ */ React.createElement(Visualization.Root, {
78
+ classNames: "bg-base-surface",
79
+ model,
80
+ variant: "neighborhood",
81
+ focus: subject.id,
82
+ onSurfaceClick: handleDismiss
83
+ }, /* @__PURE__ */ React.createElement(Visualization.Graph, {
84
+ onNodeHover: handleHover
85
+ }))));
86
+ };
87
+ export {
88
+ NeighborhoodCompanion as default
89
+ };
90
+ //# sourceMappingURL=NeighborhoodCompanion-WC6E3YE6.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/containers/NeighborhoodCompanion/NeighborhoodCompanion.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport React, { useCallback, useState } from 'react';\n\nimport { Obj } from '@dxos/echo';\nimport { DxAnchorActivate, Panel, Toolbar, useTranslation } from '@dxos/react-ui';\nimport { type TreeNode } from '@dxos/react-ui-graph';\nimport '@dxos/react-ui-graph/styles/graph.css';\n\nimport { Visualization } from '#components';\nimport { DEFAULT_NEIGHBORHOOD_DEPTH, useNeighborhoodModel } from '#hooks';\nimport { meta } from '#meta';\n\n/** Selectable traversal depths offered in the companion toolbar. */\nconst DEPTHS = [1, 2, 3] as const;\n\nexport type NeighborhoodCompanionProps = {\n role?: string;\n /** The active node whose neighbourhood is rendered (passed as the companion subject). */\n subject: Obj.Any;\n};\n\n/**\n * Companion that renders the n-hop neighbourhood of the active node as an ego-centric radial graph,\n * with the active node at the centre. Depth (number of hops traversed) is adjustable in the toolbar.\n */\nexport const NeighborhoodCompanion = ({ role = 'article', subject }: NeighborhoodCompanionProps) => {\n const { t } = useTranslation(meta.profile.key);\n const [depth, setDepth] = useState<number>(DEFAULT_NEIGHBORHOOD_DEPTH);\n const model = useNeighborhoodModel(subject, depth);\n\n const handleDepthChange = useCallback((value: string) => {\n const next = Number.parseInt(value, 10);\n if (Number.isFinite(next)) {\n setDepth(next);\n }\n }, []);\n\n // Dismiss the preview popover. The dxn/label/trigger fields are placeholders ignored on `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 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(new DxAnchorActivate({ dxn, kind: 'card', trigger: target, label: Obj.getLabel(obj) ?? dxn }));\n }, []);\n\n if (!subject || !model) {\n return null;\n }\n\n return (\n <Panel.Root role={role}>\n <Panel.Toolbar asChild>\n <Toolbar.Root>\n <div role='none' className='grow' />\n <Toolbar.ToggleGroup type='single' value={String(depth)} onValueChange={handleDepthChange}>\n {DEPTHS.map((value) => (\n <Toolbar.ToggleGroupItem\n key={value}\n value={String(value)}\n aria-label={t('depth.label', { count: value })}\n title={t('depth.label', { count: value })}\n >\n {value}\n </Toolbar.ToggleGroupItem>\n ))}\n </Toolbar.ToggleGroup>\n </Toolbar.Root>\n </Panel.Toolbar>\n <Panel.Content>\n <Visualization.Root\n classNames='bg-base-surface'\n model={model}\n variant='neighborhood'\n focus={subject.id}\n onSurfaceClick={handleDismiss}\n >\n <Visualization.Graph onNodeHover={handleHover} />\n </Visualization.Root>\n </Panel.Content>\n </Panel.Root>\n );\n};\n"],
5
+ "mappings": ";;;AAIA,OAAOA,SAASC,aAAaC,gBAAgB;AAE7C,SAASC,WAAW;AACpB,SAASC,kBAAkBC,OAAOC,SAASC,sBAAsB;AAEjE,OAAO;AAEP,SAASC,qBAAqB;AAC9B,SAASC,4BAA4BC,4BAA4B;AACjE,SAASC,YAAY;AAGrB,IAAMC,SAAS;EAAC;EAAG;EAAG;;AAYf,IAAMC,wBAAwB,CAAC,EAAEC,OAAO,WAAWC,QAAO,MAA8B;AAC7F,QAAM,EAAEC,EAAC,IAAKT,eAAeI,KAAKM,QAAQC,GAAG;AAC7C,QAAM,CAACC,OAAOC,QAAAA,IAAYlB,SAAiBO,0BAAAA;AAC3C,QAAMY,QAAQX,qBAAqBK,SAASI,KAAAA;AAE5C,QAAMG,oBAAoBrB,YAAY,CAACsB,UAAAA;AACrC,UAAMC,OAAOC,OAAOC,SAASH,OAAO,EAAA;AACpC,QAAIE,OAAOE,SAASH,IAAAA,GAAO;AACzBJ,eAASI,IAAAA;IACX;EACF,GAAG,CAAA,CAAE;AAGL,QAAMI,gBAAgB3B,YAAY,MAAA;AAChC4B,aAASC,aAAaC,cACpB,IAAI3B,iBAAiB;MAAE4B,KAAK;MAAIC,OAAO;MAAIC,SAASL,SAASM;MAAMC,OAAO;IAAM,CAAA,CAAA;EAEpF,GAAG,CAAA,CAAE;AAEL,QAAMC,cAAcpC,YAAY,CAACqC,MAAuBC,UAAAA;AAEtD,QAAI,CAACD,QAAQ,CAACC,OAAO;AACnB;IACF;AACA,UAAMC,MAAMF,KAAKG;AACjB,QAAI,CAACD,OAAO,CAACrC,IAAIuC,SAASF,GAAAA,GAAM;AAC9B;IACF;AACA,UAAMR,MAAM7B,IAAIwC,OAAOH,GAAAA;AACvB,QAAI,CAACR,KAAK;AACR;IACF;AAEA,UAAMY,SAASL,MAAMK;AACrBA,WAAOb,cAAc,IAAI3B,iBAAiB;MAAE4B;MAAKa,MAAM;MAAQX,SAASU;MAAQX,OAAO9B,IAAI2C,SAASN,GAAAA,KAAQR;IAAI,CAAA,CAAA;EAClH,GAAG,CAAA,CAAE;AAEL,MAAI,CAACjB,WAAW,CAACM,OAAO;AACtB,WAAO;EACT;AAEA,SACE,sBAAA,cAAChB,MAAM0C,MAAI;IAACjC;KACV,sBAAA,cAACT,MAAMC,SAAO;IAAC0C,SAAAA;KACb,sBAAA,cAAC1C,QAAQyC,MAAI,MACX,sBAAA,cAACE,OAAAA;IAAInC,MAAK;IAAOoC,WAAU;MAC3B,sBAAA,cAAC5C,QAAQ6C,aAAW;IAACC,MAAK;IAAS7B,OAAO8B,OAAOlC,KAAAA;IAAQmC,eAAehC;KACrEV,OAAO2C,IAAI,CAAChC,UACX,sBAAA,cAACjB,QAAQkD,iBAAe;IACtBtC,KAAKK;IACLA,OAAO8B,OAAO9B,KAAAA;IACdkC,cAAYzC,EAAE,eAAe;MAAE0C,OAAOnC;IAAM,CAAA;IAC5CoC,OAAO3C,EAAE,eAAe;MAAE0C,OAAOnC;IAAM,CAAA;KAEtCA,KAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAMX,sBAAA,cAAClB,MAAMuD,SAAO,MACZ,sBAAA,cAACpD,cAAcuC,MAAI;IACjBc,YAAW;IACXxC;IACAyC,SAAQ;IACRC,OAAOhD,QAAQiD;IACfC,gBAAgBrC;KAEhB,sBAAA,cAACpB,cAAc0D,OAAK;IAACC,aAAa9B;;AAK5C;",
6
+ "names": ["React", "useCallback", "useState", "Obj", "DxAnchorActivate", "Panel", "Toolbar", "useTranslation", "Visualization", "DEFAULT_NEIGHBORHOOD_DEPTH", "useNeighborhoodModel", "meta", "DEPTHS", "NeighborhoodCompanion", "role", "subject", "t", "profile", "key", "depth", "setDepth", "model", "handleDepthChange", "value", "next", "Number", "parseInt", "isFinite", "handleDismiss", "document", "defaultView", "dispatchEvent", "dxn", "label", "trigger", "body", "state", "handleHover", "node", "event", "obj", "data", "isObject", "getURI", "target", "kind", "getLabel", "Root", "asChild", "div", "className", "ToggleGroup", "type", "String", "onValueChange", "map", "ToggleGroupItem", "aria-label", "count", "title", "Content", "classNames", "variant", "focus", "id", "onSurfaceClick", "Graph", "onNodeHover"]
7
+ }
@@ -0,0 +1,37 @@
1
+ import "./chunk-J5LGTIGS.mjs";
2
+
3
+ // src/capabilities/app-graph-builder.ts
4
+ import * as Effect from "effect/Effect";
5
+ import { Capability } from "@dxos/app-framework";
6
+ import { AppCapabilities, AppNode } from "@dxos/app-toolkit";
7
+ import { GraphBuilder, NodeMatcher } from "@dxos/plugin-graph";
8
+ import { linkedSegment } from "@dxos/react-ui-attention";
9
+ import { Position } from "@dxos/util";
10
+ import { meta } from "#meta";
11
+ var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function* () {
12
+ const extensions = yield* Effect.all([
13
+ GraphBuilder.createExtension({
14
+ id: "neighborhoodCompanion",
15
+ match: NodeMatcher.whenEchoObjectMatches,
16
+ connector: () => Effect.succeed([
17
+ AppNode.makeCompanion({
18
+ id: linkedSegment("neighborhood"),
19
+ label: [
20
+ "neighborhood-companion.label",
21
+ {
22
+ ns: meta.profile.key
23
+ }
24
+ ],
25
+ icon: "ph--share-network--regular",
26
+ data: "neighborhood",
27
+ position: Position.last
28
+ })
29
+ ])
30
+ })
31
+ ]);
32
+ return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
33
+ }));
34
+ export {
35
+ app_graph_builder_default as default
36
+ };
37
+ //# sourceMappingURL=app-graph-builder-L2TJ6GNR.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/app-graph-builder.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities, AppNode } from '@dxos/app-toolkit';\nimport { GraphBuilder, NodeMatcher } from '@dxos/plugin-graph';\nimport { linkedSegment } from '@dxos/react-ui-attention';\nimport { Position } from '@dxos/util';\n\nimport { meta } from '#meta';\n\n/**\n * Offers a \"Neighborhood\" companion on any ECHO object. The matched node is passed through as the\n * companion's `companionTo` (the active node), which the surface renders as an ego-centric graph.\n */\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const extensions = yield* Effect.all([\n GraphBuilder.createExtension({\n id: 'neighborhoodCompanion',\n match: NodeMatcher.whenEchoObjectMatches,\n connector: () =>\n Effect.succeed([\n AppNode.makeCompanion({\n id: linkedSegment('neighborhood'),\n label: ['neighborhood-companion.label', { ns: meta.profile.key }],\n icon: 'ph--share-network--regular',\n data: 'neighborhood',\n position: Position.last,\n }),\n ]),\n }),\n ]);\n\n return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);\n }),\n);\n"],
5
+ "mappings": ";;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,iBAAiBC,eAAe;AACzC,SAASC,cAAcC,mBAAmB;AAC1C,SAASC,qBAAqB;AAC9B,SAASC,gBAAgB;AAEzB,SAASC,YAAY;AAMrB,IAAA,4BAAeP,WAAWQ,WACjBC,kBAAW,aAAA;AAChB,QAAMC,aAAa,OAAcC,WAAI;IACnCR,aAAaS,gBAAgB;MAC3BC,IAAI;MACJC,OAAOV,YAAYW;MACnBC,WAAW,MACFC,eAAQ;QACbf,QAAQgB,cAAc;UACpBL,IAAIR,cAAc,cAAA;UAClBc,OAAO;YAAC;YAAgC;cAAEC,IAAIb,KAAKc,QAAQC;YAAI;;UAC/DC,MAAM;UACNC,MAAM;UACNC,UAAUnB,SAASoB;QACrB,CAAA;OACD;IACL,CAAA;GACD;AAED,SAAO1B,WAAW2B,YAAY1B,gBAAgB2B,iBAAiBlB,UAAAA;AACjE,CAAA,CAAA;",
6
+ "names": ["Effect", "Capability", "AppCapabilities", "AppNode", "GraphBuilder", "NodeMatcher", "linkedSegment", "Position", "meta", "makeModule", "fnUntraced", "extensions", "all", "createExtension", "id", "match", "whenEchoObjectMatches", "connector", "succeed", "makeCompanion", "label", "ns", "profile", "key", "icon", "data", "position", "last", "contributes", "AppGraphBuilder"]
7
+ }
@@ -2,9 +2,11 @@ import "../chunk-J5LGTIGS.mjs";
2
2
 
3
3
  // src/capabilities/index.ts
4
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"));
5
+ var AppGraphBuilder = Capability.lazy("AppGraphBuilder", () => import("../app-graph-builder-L2TJ6GNR.mjs"));
6
+ var CreateObject = Capability.lazy("CreateObject", () => import("../create-object-WKIN3OB6.mjs"));
7
+ var ReactSurface = Capability.lazy("ReactSurface", () => import("../react-surface-EWPG5PUQ.mjs"));
7
8
  export {
9
+ AppGraphBuilder,
8
10
  CreateObject,
9
11
  ReactSurface
10
12
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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"]
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const AppGraphBuilder = Capability.lazy('AppGraphBuilder', () => import('./app-graph-builder'));\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,kBAAkBD,WAAWE,KAAK,mBAAmB,MAAM,OAAO,mCAAA,CAAA;AACxE,IAAMC,eAAeH,WAAWE,KAAK,gBAAgB,MAAM,OAAO,+BAAA,CAAA;AAClE,IAAME,eAAeJ,WAAWE,KAAK,gBAAgB,MAAM,OAAO,+BAAA,CAAA;",
6
+ "names": ["Capability", "AppGraphBuilder", "lazy", "CreateObject", "ReactSurface"]
7
7
  }
@@ -1,17 +1,19 @@
1
1
  // src/ExplorerPlugin.tsx
2
2
  import { Plugin } from "@dxos/app-framework";
3
3
  import { AppPlugin } from "@dxos/app-toolkit";
4
- import { CreateObject, ReactSurface } from "#capabilities";
4
+ import { AppGraphBuilder, CreateObject, ReactSurface } from "#capabilities";
5
5
  import { meta } from "#meta";
6
6
  import { translations } from "#translations";
7
7
  import { Graph } from "#types";
8
8
 
9
- // raw-loader:/__w/dxos/dxos/packages/plugins/plugin-explorer/PLUGIN.mdl?raw
9
+ // raw-loader:/__w/dxos/dxos/packages/plugins/plugin-explorer/PLUGIN.mdl
10
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
11
 
12
12
  // src/ExplorerPlugin.tsx
13
13
  var ExplorerPlugin = Plugin.define(meta).pipe(AppPlugin.addCreateObjectModule({
14
14
  activate: CreateObject
15
+ }), AppPlugin.addAppGraphModule({
16
+ activate: AppGraphBuilder
15
17
  }), AppPlugin.addSchemaModule({
16
18
  schema: [
17
19
  Graph.Graph
@@ -22,7 +24,7 @@ var ExplorerPlugin = Plugin.define(meta).pipe(AppPlugin.addCreateObjectModule({
22
24
  translations
23
25
  }), AppPlugin.addPluginAssetModule({
24
26
  asset: {
25
- pluginId: meta.id,
27
+ pluginId: meta.profile.key,
26
28
  path: "PLUGIN.mdl",
27
29
  content: PLUGIN_default,
28
30
  mimeType: "application/x-mdl"
@@ -34,4 +36,4 @@ export {
34
36
  ExplorerPlugin,
35
37
  ExplorerPlugin_default
36
38
  };
37
- //# sourceMappingURL=chunk-3D7BYXOR.mjs.map
39
+ //# sourceMappingURL=chunk-4F6AT7RA.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ExplorerPlugin.tsx", "raw-loader:/__w/dxos/dxos/packages/plugins/plugin-explorer/PLUGIN.mdl"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\n\nimport { AppGraphBuilder, CreateObject, ReactSurface } from '#capabilities';\nimport { meta } from '#meta';\nimport { translations } from '#translations';\nimport { Graph } from '#types';\n\n// eslint-disable-next-line import/no-relative-packages\nimport pluginSpec from '../PLUGIN.mdl?raw';\n\nexport const ExplorerPlugin = Plugin.define(meta).pipe(\n AppPlugin.addCreateObjectModule({ activate: CreateObject }),\n AppPlugin.addAppGraphModule({ activate: AppGraphBuilder }),\n AppPlugin.addSchemaModule({ schema: [Graph.Graph] }),\n AppPlugin.addSurfaceModule({ activate: ReactSurface }),\n AppPlugin.addTranslationsModule({ translations }),\n AppPlugin.addPluginAssetModule({\n asset: { pluginId: meta.profile.key, path: 'PLUGIN.mdl', content: pluginSpec, mimeType: 'application/x-mdl' },\n }),\n Plugin.make,\n);\n\nexport default ExplorerPlugin;\n", "---\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"],
5
+ "mappings": ";AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAE1B,SAASC,iBAAiBC,cAAcC,oBAAoB;AAC5D,SAASC,YAAY;AACrB,SAASC,oBAAoB;AAC7B,SAASC,aAAa;;;ACVtB;;;ADeO,IAAMC,iBAAiBC,OAAOC,OAAOC,IAAAA,EAAMC,KAChDC,UAAUC,sBAAsB;EAAEC,UAAUC;AAAa,CAAA,GACzDH,UAAUI,kBAAkB;EAAEF,UAAUG;AAAgB,CAAA,GACxDL,UAAUM,gBAAgB;EAAEC,QAAQ;IAACC,MAAMA;;AAAO,CAAA,GAClDR,UAAUS,iBAAiB;EAAEP,UAAUQ;AAAa,CAAA,GACpDV,UAAUW,sBAAsB;EAAEC;AAAa,CAAA,GAC/CZ,UAAUa,qBAAqB;EAC7BC,OAAO;IAAEC,UAAUjB,KAAKkB,QAAQC;IAAKC,MAAM;IAAcC,SAASC;IAAYC,UAAU;EAAoB;AAC9G,CAAA,GACAzB,OAAO0B,IAAI;AAGb,IAAA,yBAAe3B;",
6
+ "names": ["Plugin", "AppPlugin", "AppGraphBuilder", "CreateObject", "ReactSurface", "meta", "translations", "Graph", "ExplorerPlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addCreateObjectModule", "activate", "CreateObject", "addAppGraphModule", "AppGraphBuilder", "addSchemaModule", "schema", "Graph", "addSurfaceModule", "ReactSurface", "addTranslationsModule", "translations", "addPluginAssetModule", "asset", "pluginId", "profile", "key", "path", "content", "pluginSpec", "mimeType", "make"]
7
+ }
@@ -0,0 +1,53 @@
1
+ // src/meta.ts
2
+ import { Plugin } from "@dxos/app-framework";
3
+
4
+ // dx.config.ts
5
+ import { Config2 } from "@dxos/app-framework/config";
6
+ import { trim } from "@dxos/util";
7
+ var dx_config_default = Config2.make({
8
+ plugin: {
9
+ key: "org.dxos.plugin.explorer",
10
+ name: "Explorer",
11
+ author: "DXOS",
12
+ description: trim`
13
+ Explorer is an interactive hypergraph visualization plugin that reveals the relationships
14
+ between objects stored in your DXOS workspace. Each Graph document is backed by a live
15
+ ECHO query and a View that you configure — Explorer keeps the visualization synchronized
16
+ with the database in real time so every peer immediately sees changes made by collaborators.
17
+
18
+ The plugin offers four switchable layout algorithms for the same data set: a physics-based
19
+ force-directed graph for freeform exploration, a radial cluster layout that groups objects
20
+ by type around a central root, an edge-bundling layout that tames visual clutter on dense
21
+ graphs, and a lattice grid that arranges objects in a sorted matrix sorted by type and label.
22
+ Switching between layouts smoothly tweens node positions so spatial context is preserved.
23
+
24
+ Nodes are coloured by their ECHO object type, and hovering any node opens an anchor-card
25
+ preview panel with the object's details without leaving the graph view.
26
+ The toolbar's query editor lets you filter the visible node set on the fly using
27
+ the same query syntax available across Composer.
28
+
29
+ A new Graph document can be created from the object-creation dialog; Explorer automatically
30
+ derives an initial View from the chosen type and persists both to ECHO so the graph is
31
+ immediately shareable and replicable across the space.
32
+ `,
33
+ source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-explorer",
34
+ icon: {
35
+ key: "ph--graph--regular",
36
+ hue: "green"
37
+ },
38
+ spec: "PLUGIN.mdl",
39
+ screenshots: [
40
+ {
41
+ dark: "https://dxos.network/plugin-details-explorer-dark.png"
42
+ }
43
+ ]
44
+ }
45
+ });
46
+
47
+ // src/meta.ts
48
+ var meta = Plugin.getMetaFromConfig(dx_config_default);
49
+
50
+ export {
51
+ meta
52
+ };
53
+ //# sourceMappingURL=chunk-C56B464A.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/meta.ts", "../../../dx.config.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\n\nimport config from '../dx.config';\n\nexport const meta = Plugin.getMetaFromConfig(config);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Config2 } from '@dxos/app-framework/config';\nimport { trim } from '@dxos/util';\n\nexport default Config2.make({\n plugin: {\n key: 'org.dxos.plugin.explorer',\n name: 'Explorer',\n author: 'DXOS',\n description: trim`\n Explorer is an interactive hypergraph visualization plugin that reveals the relationships\n between objects stored in your DXOS workspace. Each Graph document is backed by a live\n ECHO query and a View that you configure — Explorer keeps the visualization synchronized\n with the database in real time so every peer immediately sees changes made by collaborators.\n\n The plugin offers four switchable layout algorithms for the same data set: a physics-based\n force-directed graph for freeform exploration, a radial cluster layout that groups objects\n by type around a central root, an edge-bundling layout that tames visual clutter on dense\n graphs, and a lattice grid that arranges objects in a sorted matrix sorted by type and label.\n Switching between layouts smoothly tweens node positions so spatial context is preserved.\n\n Nodes are coloured by their ECHO object type, and hovering any node opens an anchor-card\n preview panel with the object's details without leaving the graph view.\n The toolbar's query editor lets you filter the visible node set on the fly using\n the same query syntax available across Composer.\n\n A new Graph document can be created from the object-creation dialog; Explorer automatically\n derives an initial View from the chosen type and persists both to ECHO so the graph is\n immediately shareable and replicable across the space.\n `,\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-explorer',\n icon: { key: 'ph--graph--regular', hue: 'green' },\n spec: 'PLUGIN.mdl',\n screenshots: [{ dark: 'https://dxos.network/plugin-details-explorer-dark.png' }],\n },\n});\n"],
5
+ "mappings": ";AAIA,SAASA,cAAc;;;ACAvB,SAASC,eAAe;AACxB,SAASC,YAAY;AAErB,IAAA,oBAAeD,QAAQE,KAAK;EAC1BC,QAAQ;IACNC,KAAK;IACLC,MAAM;IACNC,QAAQ;IACRC,aAAaN;;;;;;;;;;;;;;;;;;;;;IAqBbO,QAAQ;IACRC,MAAM;MAAEL,KAAK;MAAsBM,KAAK;IAAQ;IAChDC,MAAM;IACNC,aAAa;MAAC;QAAEC,MAAM;MAAwD;;EAChF;AACF,CAAA;;;AD9BO,IAAMC,OAAOC,OAAOC,kBAAkBC,iBAAAA;",
6
+ "names": ["Plugin", "Config2", "trim", "make", "plugin", "key", "name", "author", "description", "source", "icon", "hue", "spec", "screenshots", "dark", "meta", "Plugin", "getMetaFromConfig", "config"]
7
+ }
@@ -1,28 +1,3 @@
1
- // src/components/Tree/types/types.ts
2
- var treeTypeToTreeNode = (tree, rootId = tree.root, visited = /* @__PURE__ */ new Set()) => {
3
- const node = tree.nodes[rootId];
4
- if (!node) {
5
- return void 0;
6
- }
7
- if (visited.has(rootId)) {
8
- return {
9
- id: rootId,
10
- label: labelOf(node),
11
- data: node.data
12
- };
13
- }
14
- visited.add(rootId);
15
- return {
16
- id: rootId,
17
- label: labelOf(node),
18
- data: node.data,
19
- children: node.children.map((childId) => treeTypeToTreeNode(tree, childId, visited)).filter((c) => Boolean(c))
20
- };
21
- };
22
- var labelOf = (node) => {
23
- return typeof node.data?.text === "string" ? node.data.text : void 0;
24
- };
25
-
26
1
  // src/components/Tree/types/tree.ts
27
2
  import * as Schema from "effect/Schema";
28
3
  import { DXN, Key, Obj, Ref, Type } from "@dxos/echo";
@@ -38,13 +13,14 @@ var TreeNodeType = Schema.Struct({
38
13
  })),
39
14
  ref: Schema.optional(Ref.Ref(TestSchema.Expando))
40
15
  }).pipe(Schema.mutable);
41
- var TreeType = Schema.Struct({
16
+ var TreeType = class extends Type.makeObject(DXN.make("org.dxos.type.tree", "0.1.0"))(Schema.Struct({
42
17
  root: Key.EntityId,
43
18
  nodes: Schema.mutable(Schema.Record({
44
19
  key: Key.EntityId,
45
20
  value: TreeNodeType
46
21
  }))
47
- }).pipe(Type.makeObject(DXN.make("org.dxos.type.tree", "0.1.0")));
22
+ })) {
23
+ };
48
24
  var Tree = class _Tree {
49
25
  static create = () => {
50
26
  const id = Key.EntityId.random();
@@ -96,7 +72,7 @@ var Tree = class _Tree {
96
72
  }
97
73
  getNode(id) {
98
74
  const node = this._tree.nodes[id];
99
- invariant(node, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 77, S: this, A: ["node", ""] });
75
+ invariant(node, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 78, S: this, A: ["node", ""] });
100
76
  return node;
101
77
  }
102
78
  /**
@@ -222,8 +198,8 @@ var Tree = class _Tree {
222
198
  * Move child node.
223
199
  */
224
200
  moveNode(node, from, to) {
225
- invariant(from >= 0 && from < node.children.length, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 197, S: this, A: ["from >= 0 && from < node.children.length", ""] });
226
- invariant(to >= 0 && to < node.children.length, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 198, S: this, A: ["to >= 0 && to < node.children.length", ""] });
201
+ invariant(from >= 0 && from < node.children.length, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 198, S: this, A: ["from >= 0 && from < node.children.length", ""] });
202
+ invariant(to >= 0 && to < node.children.length, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 199, S: this, A: ["to >= 0 && to < node.children.length", ""] });
227
203
  if (from === to) {
228
204
  return null;
229
205
  }
@@ -280,8 +256,35 @@ var Tree = class _Tree {
280
256
  }
281
257
  };
282
258
 
259
+ // src/components/Tree/types/types.ts
260
+ var treeTypeToTreeNode = (tree, rootId = tree.root, visited = /* @__PURE__ */ new Set()) => {
261
+ const node = tree.nodes[rootId];
262
+ if (!node) {
263
+ return void 0;
264
+ }
265
+ if (visited.has(rootId)) {
266
+ return {
267
+ id: rootId,
268
+ label: labelOf(node),
269
+ data: node.data
270
+ };
271
+ }
272
+ visited.add(rootId);
273
+ return {
274
+ id: rootId,
275
+ label: labelOf(node),
276
+ data: node.data,
277
+ children: node.children.map((childId) => treeTypeToTreeNode(tree, childId, visited)).filter((c) => Boolean(c))
278
+ };
279
+ };
280
+ var labelOf = (node) => {
281
+ return typeof node.data?.text === "string" ? node.data.text : void 0;
282
+ };
283
+
283
284
  export {
285
+ TreeNodeType,
286
+ TreeType,
284
287
  Tree,
285
288
  treeTypeToTreeNode
286
289
  };
287
- //# sourceMappingURL=chunk-7XUDLV6E.mjs.map
290
+ //# sourceMappingURL=chunk-EZ52JY7X.mjs.map