@dxos/plugin-explorer 0.10.0 → 0.11.1

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 (105) hide show
  1. package/dist/lib/ExplorerPlugin.mjs +2 -0
  2. package/dist/lib/capabilities.mjs +9 -0
  3. package/dist/lib/capabilities.mjs.map +1 -0
  4. package/dist/lib/chunk-ExplorerArticle.mjs +90 -0
  5. package/dist/lib/chunk-ExplorerArticle.mjs.map +1 -0
  6. package/dist/lib/chunk-ExplorerPlugin.mjs +18 -0
  7. package/dist/lib/chunk-ExplorerPlugin.mjs.map +1 -0
  8. package/dist/lib/chunk-NeighborhoodCompanion.mjs +83 -0
  9. package/dist/lib/chunk-NeighborhoodCompanion.mjs.map +1 -0
  10. package/dist/lib/chunk-app-graph-builder.mjs +29 -0
  11. package/dist/lib/chunk-app-graph-builder.mjs.map +1 -0
  12. package/dist/lib/chunk-create-object.mjs +35 -0
  13. package/dist/lib/chunk-create-object.mjs.map +1 -0
  14. package/dist/lib/{neutral/chunk-C56B464A.mjs → chunk-meta.mjs} +20 -28
  15. package/dist/lib/chunk-meta.mjs.map +1 -0
  16. package/dist/lib/chunk-react-surface.mjs +29 -0
  17. package/dist/lib/chunk-react-surface.mjs.map +1 -0
  18. package/dist/lib/chunk-types.mjs +60 -0
  19. package/dist/lib/chunk-types.mjs.map +1 -0
  20. package/dist/lib/chunk-types2.mjs +231 -0
  21. package/dist/lib/chunk-types2.mjs.map +1 -0
  22. package/dist/lib/components.mjs +12314 -0
  23. package/dist/lib/components.mjs.map +1 -0
  24. package/dist/lib/containers.mjs +8 -0
  25. package/dist/lib/containers.mjs.map +1 -0
  26. package/dist/lib/hooks.mjs +101 -0
  27. package/dist/lib/hooks.mjs.map +1 -0
  28. package/dist/lib/index.mjs +3 -0
  29. package/dist/lib/meta.mjs +2 -0
  30. package/dist/lib/plugin.mjs +8 -0
  31. package/dist/lib/plugin.mjs.map +1 -0
  32. package/dist/lib/testing.mjs +118 -0
  33. package/dist/lib/testing.mjs.map +1 -0
  34. package/dist/lib/translations.mjs +29 -0
  35. package/dist/lib/translations.mjs.map +1 -0
  36. package/dist/lib/types.mjs +2 -0
  37. package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
  38. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  39. package/dist/types/src/capabilities/create-object.d.ts +1 -1
  40. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  41. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  42. package/dist/types/src/components/Graph/CanvasForceGraph.d.ts +1 -1
  43. package/dist/types/src/components/Graph/CanvasForceGraph.d.ts.map +1 -1
  44. package/dist/types/src/components/Graph/CanvasForceGraph.stories.d.ts +1 -1
  45. package/dist/types/src/components/Graph/ForceGraph.d.ts +1 -1
  46. package/dist/types/src/components/Graph/ForceGraph.d.ts.map +1 -1
  47. package/dist/types/src/components/Graph/ForceGraph.stories.d.ts +1 -1
  48. package/dist/types/src/components/Visualization/Visualization.d.ts +1 -1
  49. package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.d.ts +4 -1
  50. package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.d.ts.map +1 -1
  51. package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.stories.d.ts.map +1 -1
  52. package/dist/types/src/containers/NeighborhoodCompanion/NeighborhoodCompanion.d.ts +4 -5
  53. package/dist/types/src/containers/NeighborhoodCompanion/NeighborhoodCompanion.d.ts.map +1 -1
  54. package/dist/types/src/types/Graph.d.ts +1 -1
  55. package/dist/types/tsconfig.tsbuildinfo +1 -1
  56. package/dx.config.ts +1 -0
  57. package/package.json +49 -47
  58. package/src/capabilities/app-graph-builder.ts +1 -2
  59. package/src/capabilities/{react-surface.tsx → react-surface.ts} +4 -7
  60. package/src/components/Visualization/Visualization.stories.tsx +2 -2
  61. package/src/containers/ExplorerArticle/ExplorerArticle.stories.tsx +2 -1
  62. package/src/containers/ExplorerArticle/ExplorerArticle.tsx +5 -3
  63. package/src/containers/NeighborhoodCompanion/NeighborhoodCompanion.tsx +5 -3
  64. package/dist/lib/neutral/ExplorerArticle-2WPXYTXV.mjs +0 -101
  65. package/dist/lib/neutral/ExplorerArticle-2WPXYTXV.mjs.map +0 -7
  66. package/dist/lib/neutral/ExplorerPlugin.mjs +0 -10
  67. package/dist/lib/neutral/ExplorerPlugin.mjs.map +0 -7
  68. package/dist/lib/neutral/NeighborhoodCompanion-WC6E3YE6.mjs +0 -90
  69. package/dist/lib/neutral/NeighborhoodCompanion-WC6E3YE6.mjs.map +0 -7
  70. package/dist/lib/neutral/app-graph-builder-L2TJ6GNR.mjs +0 -37
  71. package/dist/lib/neutral/app-graph-builder-L2TJ6GNR.mjs.map +0 -7
  72. package/dist/lib/neutral/capabilities/index.mjs +0 -13
  73. package/dist/lib/neutral/capabilities/index.mjs.map +0 -7
  74. package/dist/lib/neutral/chunk-4F6AT7RA.mjs +0 -39
  75. package/dist/lib/neutral/chunk-4F6AT7RA.mjs.map +0 -7
  76. package/dist/lib/neutral/chunk-C56B464A.mjs.map +0 -7
  77. package/dist/lib/neutral/chunk-EZ52JY7X.mjs +0 -290
  78. package/dist/lib/neutral/chunk-EZ52JY7X.mjs.map +0 -7
  79. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
  80. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
  81. package/dist/lib/neutral/chunk-TTFPTHAQ.mjs +0 -69
  82. package/dist/lib/neutral/chunk-TTFPTHAQ.mjs.map +0 -7
  83. package/dist/lib/neutral/components/index.mjs +0 -11591
  84. package/dist/lib/neutral/components/index.mjs.map +0 -7
  85. package/dist/lib/neutral/containers/index.mjs +0 -11
  86. package/dist/lib/neutral/containers/index.mjs.map +0 -7
  87. package/dist/lib/neutral/create-object-WKIN3OB6.mjs +0 -38
  88. package/dist/lib/neutral/create-object-WKIN3OB6.mjs.map +0 -7
  89. package/dist/lib/neutral/hooks/index.mjs +0 -108
  90. package/dist/lib/neutral/hooks/index.mjs.map +0 -7
  91. package/dist/lib/neutral/index.mjs +0 -14
  92. package/dist/lib/neutral/index.mjs.map +0 -7
  93. package/dist/lib/neutral/meta.json +0 -1
  94. package/dist/lib/neutral/meta.mjs +0 -8
  95. package/dist/lib/neutral/meta.mjs.map +0 -7
  96. package/dist/lib/neutral/plugin.mjs +0 -12
  97. package/dist/lib/neutral/plugin.mjs.map +0 -7
  98. package/dist/lib/neutral/react-surface-EWPG5PUQ.mjs +0 -39
  99. package/dist/lib/neutral/react-surface-EWPG5PUQ.mjs.map +0 -7
  100. package/dist/lib/neutral/testing/index.mjs +0 -139
  101. package/dist/lib/neutral/testing/index.mjs.map +0 -7
  102. package/dist/lib/neutral/translations.mjs +0 -36
  103. package/dist/lib/neutral/translations.mjs.map +0 -7
  104. package/dist/lib/neutral/types/index.mjs +0 -10
  105. package/dist/lib/neutral/types/index.mjs.map +0 -7
@@ -1,13 +0,0 @@
1
- import "../chunk-J5LGTIGS.mjs";
2
-
3
- // src/capabilities/index.ts
4
- import { Capability } from "@dxos/app-framework";
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"));
8
- export {
9
- AppGraphBuilder,
10
- CreateObject,
11
- ReactSurface
12
- };
13
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
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 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
- }
@@ -1,39 +0,0 @@
1
- // src/ExplorerPlugin.tsx
2
- import { Plugin } from "@dxos/app-framework";
3
- import { AppPlugin } from "@dxos/app-toolkit";
4
- import { AppGraphBuilder, 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
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.addAppGraphModule({
16
- activate: AppGraphBuilder
17
- }), AppPlugin.addSchemaModule({
18
- schema: [
19
- Graph.Graph
20
- ]
21
- }), AppPlugin.addSurfaceModule({
22
- activate: ReactSurface
23
- }), AppPlugin.addTranslationsModule({
24
- translations
25
- }), AppPlugin.addPluginAssetModule({
26
- asset: {
27
- pluginId: meta.profile.key,
28
- path: "PLUGIN.mdl",
29
- content: PLUGIN_default,
30
- mimeType: "application/x-mdl"
31
- }
32
- }), Plugin.make);
33
- var ExplorerPlugin_default = ExplorerPlugin;
34
-
35
- export {
36
- ExplorerPlugin,
37
- ExplorerPlugin_default
38
- };
39
- //# sourceMappingURL=chunk-4F6AT7RA.mjs.map
@@ -1,7 +0,0 @@
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
- }
@@ -1,7 +0,0 @@
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,290 +0,0 @@
1
- // src/components/Tree/types/tree.ts
2
- import * as Schema from "effect/Schema";
3
- import { DXN, Key, Obj, Ref, Type } from "@dxos/echo";
4
- import { TestSchema } from "@dxos/echo/testing";
5
- import { invariant } from "@dxos/invariant";
6
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-explorer/src/components/Tree/types/tree.ts";
7
- var TreeNodeType = Schema.Struct({
8
- id: Key.EntityId,
9
- children: Schema.mutable(Schema.Array(Key.EntityId)),
10
- data: Schema.mutable(Schema.Record({
11
- key: Schema.String,
12
- value: Schema.Any
13
- })),
14
- ref: Schema.optional(Ref.Ref(TestSchema.Expando))
15
- }).pipe(Schema.mutable);
16
- var TreeType = class extends Type.makeObject(DXN.make("org.dxos.type.tree", "0.1.0"))(Schema.Struct({
17
- root: Key.EntityId,
18
- nodes: Schema.mutable(Schema.Record({
19
- key: Key.EntityId,
20
- value: TreeNodeType
21
- }))
22
- })) {
23
- };
24
- var Tree = class _Tree {
25
- static create = () => {
26
- const id = Key.EntityId.random();
27
- return Obj.make(TreeType, {
28
- root: id,
29
- nodes: {
30
- [id]: {
31
- id,
32
- children: [],
33
- data: {
34
- text: ""
35
- }
36
- }
37
- }
38
- });
39
- };
40
- _tree;
41
- constructor(tree) {
42
- this._tree = tree ?? _Tree.create();
43
- }
44
- get tree() {
45
- return this._tree;
46
- }
47
- // TODO(burdon): Make reactive.
48
- get size() {
49
- return Object.keys(this._tree.nodes).length;
50
- }
51
- get root() {
52
- return this.getNode(this._tree.root);
53
- }
54
- //
55
- // Traversal
56
- //
57
- /**
58
- * Recursively traverse the tree until the callback returns a value.
59
- */
60
- tranverse(callback, root = this._tree.root, depth = 0) {
61
- const node = this._tree.nodes[root];
62
- const result = callback(node, depth);
63
- if (result !== void 0) {
64
- return result;
65
- }
66
- for (const childId of node.children) {
67
- const result2 = this.tranverse(callback, childId, depth + 1);
68
- if (result2 !== void 0) {
69
- return result2;
70
- }
71
- }
72
- }
73
- getNode(id) {
74
- const node = this._tree.nodes[id];
75
- invariant(node, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 78, S: this, A: ["node", ""] });
76
- return node;
77
- }
78
- /**
79
- * Get the children of a node.
80
- */
81
- getChildNodes(node) {
82
- return node.children.map((id) => this.getNode(id));
83
- }
84
- /**
85
- * Get the parent of a node.
86
- */
87
- getParent(node) {
88
- const parent = this.tranverse((n) => {
89
- if (n.children.includes(node.id)) {
90
- return n;
91
- }
92
- });
93
- return parent ?? null;
94
- }
95
- /**
96
- * Get the next node in the tree.
97
- */
98
- getNext(node, hierarchical = true) {
99
- if (hierarchical && node.children.length) {
100
- return this.getChildNodes(node)[0];
101
- } else {
102
- const parent = this.getParent(node);
103
- if (parent) {
104
- const idx = this.getChildNodes(parent).findIndex(({ id }) => id === node.id);
105
- if (idx < parent.children.length - 1) {
106
- return this.getNode(parent.children[idx + 1]);
107
- } else {
108
- return this.getNext(parent, false);
109
- }
110
- }
111
- }
112
- }
113
- /**
114
- * Get the previous node in the tree.
115
- */
116
- getPrevious(node, hierarchical = true) {
117
- const parent = this.getParent(node);
118
- const idx = this.getChildNodes(parent).findIndex(({ id }) => id === node.id);
119
- if (idx === 0) {
120
- if (hierarchical) {
121
- return parent;
122
- }
123
- } else {
124
- const previous = this.getNode(parent.children[idx - 1]);
125
- if (hierarchical && previous.children.length) {
126
- return this.getLastDescendent(previous);
127
- }
128
- return previous;
129
- }
130
- }
131
- /**
132
- * Get the last descendent of a node.
133
- */
134
- getLastDescendent(node) {
135
- const children = this.getChildNodes(node);
136
- const last = children.length ? children[children.length - 1] : void 0;
137
- if (last) {
138
- return this.getLastDescendent(last);
139
- }
140
- return node;
141
- }
142
- //
143
- // Mutations
144
- //
145
- /**
146
- * Clear tree.
147
- */
148
- clear() {
149
- const root = this._tree.nodes[this._tree.root];
150
- root.children.length = 0;
151
- Obj.update(this._tree, (obj) => {
152
- obj.nodes = {
153
- [root.id]: root
154
- };
155
- });
156
- }
157
- /**
158
- * Add node.
159
- */
160
- addNode(parent, node, index) {
161
- if (!node) {
162
- const id = Key.EntityId.random();
163
- node = {
164
- id,
165
- children: [],
166
- data: {
167
- text: ""
168
- }
169
- };
170
- }
171
- const nodeToAdd = node;
172
- Obj.update(this._tree, (obj) => {
173
- obj.nodes[nodeToAdd.id] = nodeToAdd;
174
- parent.children.splice(index ?? parent.children.length, 0, nodeToAdd.id);
175
- });
176
- return node;
177
- }
178
- /**
179
- * Delete node.
180
- */
181
- deleteNode(parent, id) {
182
- const node = this._tree.nodes[id];
183
- if (!node) {
184
- return void 0;
185
- }
186
- Obj.update(this._tree, (obj) => {
187
- delete obj.nodes[node.id];
188
- });
189
- const idx = parent.children.findIndex((child) => child === id);
190
- if (idx !== -1) {
191
- Obj.update(this._tree, () => {
192
- parent.children.splice(idx, 1);
193
- });
194
- }
195
- return node;
196
- }
197
- /**
198
- * Move child node.
199
- */
200
- moveNode(node, from, to) {
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", ""] });
203
- if (from === to) {
204
- return null;
205
- }
206
- const child = node.children[from];
207
- Obj.update(this._tree, () => {
208
- node.children.splice(from, 1);
209
- node.children.splice(to, 0, child);
210
- });
211
- return this.getNode(child);
212
- }
213
- /**
214
- * Indent node.
215
- */
216
- indentNode(node) {
217
- const parent = this.getParent(node);
218
- if (!parent) {
219
- return;
220
- }
221
- const idx = parent.children.findIndex((child) => child === node.id);
222
- if (idx < 1 || idx >= parent.children.length) {
223
- return;
224
- }
225
- const previous = this.getNode(parent.children[idx - 1]);
226
- Obj.update(this._tree, () => {
227
- parent.children.splice(idx, 1);
228
- previous.children.push(node.id);
229
- });
230
- }
231
- /**
232
- * Unindent node.
233
- */
234
- unindentNode(node) {
235
- const parent = this.getParent(node);
236
- if (!parent) {
237
- return;
238
- }
239
- const ancestor = this.getParent(parent);
240
- if (!ancestor) {
241
- return;
242
- }
243
- const nodeIdx = parent.children.findIndex((id) => id === node.id);
244
- let rest = [];
245
- Obj.update(this._tree, () => {
246
- const removed = parent.children.splice(nodeIdx, parent.children.length - nodeIdx);
247
- rest = removed.slice(1);
248
- });
249
- const parentIdx = this.getChildNodes(ancestor).findIndex((n) => n.id === parent.id);
250
- Obj.update(this._tree, () => {
251
- ancestor.children.splice(parentIdx + 1, 0, node.id);
252
- });
253
- Obj.update(this._tree, () => {
254
- node.children.push(...rest);
255
- });
256
- }
257
- };
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
-
284
- export {
285
- TreeNodeType,
286
- TreeType,
287
- Tree,
288
- treeTypeToTreeNode
289
- };
290
- //# sourceMappingURL=chunk-EZ52JY7X.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/Tree/types/tree.ts", "../../../src/components/Tree/types/types.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { DXN, Key, Obj, Ref, Type } from '@dxos/echo';\nimport { TestSchema } from '@dxos/echo/testing';\nimport { invariant } from '@dxos/invariant';\n\n// TODO(burdon): Reconcile with @dxos/graph (i.e., common types).\n\nexport const TreeNodeType = Schema.Struct({\n id: Key.EntityId,\n children: Schema.mutable(Schema.Array(Key.EntityId)),\n data: Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.Any })),\n ref: Schema.optional(Ref.Ref(TestSchema.Expando)),\n}).pipe(Schema.mutable);\n\nexport type TreeNodeType = Schema.Schema.Type<typeof TreeNodeType>;\n\nexport class TreeType extends Type.makeObject<TreeType>(DXN.make('org.dxos.type.tree', '0.1.0'))(\n Schema.Struct({\n root: Key.EntityId,\n nodes: Schema.mutable(Schema.Record({ key: Key.EntityId, value: TreeNodeType })),\n }),\n) {}\n\n/**\n * Wrapper object for tree.\n */\nexport class Tree {\n static create = (): TreeType => {\n const id = Key.EntityId.random();\n return Obj.make(TreeType, {\n root: id,\n nodes: {\n [id]: {\n id,\n children: [],\n data: { text: '' }, // TODO(burdon): Generic.\n },\n },\n });\n };\n\n private _tree: TreeType;\n\n constructor(tree?: TreeType) {\n this._tree = tree ?? Tree.create();\n }\n\n get tree() {\n return this._tree;\n }\n\n // TODO(burdon): Make reactive.\n get size() {\n return Object.keys(this._tree.nodes).length;\n }\n\n get root() {\n return this.getNode(this._tree.root);\n }\n\n //\n // Traversal\n //\n\n /**\n * Recursively traverse the tree until the callback returns a value.\n */\n tranverse<T>(\n callback: (node: TreeNodeType, depth: number) => T | void,\n root: Key.EntityId = this._tree.root,\n depth = 0,\n ): T | void {\n const node = this._tree.nodes[root];\n const result = callback(node, depth);\n if (result !== undefined) {\n return result;\n }\n\n for (const childId of node.children) {\n const result = this.tranverse(callback, childId, depth + 1);\n if (result !== undefined) {\n return result;\n }\n }\n }\n\n getNode(id: Key.EntityId): TreeNodeType {\n const node = this._tree.nodes[id];\n invariant(node);\n return node;\n }\n\n /**\n * Get the children of a node.\n */\n getChildNodes(node: TreeNodeType): Array<TreeNodeType> {\n return node.children.map((id) => this.getNode(id));\n }\n\n /**\n * Get the parent of a node.\n */\n getParent(node: TreeNodeType): TreeNodeType | null {\n const parent = this.tranverse((n) => {\n if (n.children.includes(node.id)) {\n return n;\n }\n });\n\n return parent ?? null;\n }\n\n /**\n * Get the next node in the tree.\n */\n getNext(node: TreeNodeType, hierarchical = true): TreeNodeType | undefined {\n if (hierarchical && node.children.length) {\n // First child.\n return this.getChildNodes(node)[0];\n } else {\n const parent = this.getParent(node);\n if (parent) {\n const idx = this.getChildNodes(parent).findIndex(({ id }) => id === node.id);\n if (idx < parent.children.length - 1) {\n // Next sibling.\n return this.getNode(parent.children[idx + 1]);\n } else {\n // Get parent's next sibling.\n return this.getNext(parent, false);\n }\n }\n }\n }\n\n /**\n * Get the previous node in the tree.\n */\n getPrevious(node: TreeNodeType, hierarchical = true): TreeNodeType | undefined {\n const parent = this.getParent(node)!;\n const idx = this.getChildNodes(parent).findIndex(({ id }) => id === node.id);\n if (idx === 0) {\n if (hierarchical) {\n return parent;\n }\n } else {\n const previous = this.getNode(parent.children[idx - 1]);\n if (hierarchical && previous.children.length) {\n return this.getLastDescendent(previous);\n }\n\n return previous;\n }\n }\n\n /**\n * Get the last descendent of a node.\n */\n getLastDescendent(node: TreeNodeType): TreeNodeType | undefined {\n const children = this.getChildNodes(node);\n const last = children.length ? children[children.length - 1] : undefined;\n if (last) {\n return this.getLastDescendent(last);\n }\n\n return node;\n }\n\n //\n // Mutations\n //\n\n /**\n * Clear tree.\n */\n clear(): void {\n const root = this._tree.nodes[this._tree.root];\n root.children.length = 0;\n Obj.update(this._tree, (obj) => {\n obj.nodes = {\n [root.id]: root,\n };\n });\n }\n\n /**\n * Add node.\n */\n addNode(parent: TreeNodeType, node?: TreeNodeType, index?: number): TreeNodeType {\n if (!node) {\n const id = Key.EntityId.random();\n node = { id, children: [], data: { text: '' } }; // TODO(burdon): Generic.\n }\n\n const nodeToAdd = node;\n Obj.update(this._tree, (obj) => {\n obj.nodes[nodeToAdd.id] = nodeToAdd;\n parent.children.splice(index ?? parent.children.length, 0, nodeToAdd.id);\n });\n return node;\n }\n\n /**\n * Delete node.\n */\n deleteNode(parent: TreeNodeType, id: Key.EntityId): TreeNodeType | undefined {\n const node = this._tree.nodes[id];\n if (!node) {\n return undefined;\n }\n\n Obj.update(this._tree, (obj) => {\n delete obj.nodes[node.id];\n });\n const idx = parent.children.findIndex((child) => child === id);\n if (idx !== -1) {\n Obj.update(this._tree, () => {\n parent.children.splice(idx, 1);\n });\n }\n\n return node;\n }\n\n /**\n * Move child node.\n */\n moveNode(node: TreeNodeType, from: number, to: number): TreeNodeType | null {\n invariant(from >= 0 && from < node.children.length);\n invariant(to >= 0 && to < node.children.length);\n if (from === to) {\n return null;\n }\n\n const child = node.children[from];\n Obj.update(this._tree, () => {\n node.children.splice(from, 1);\n node.children.splice(to, 0, child);\n });\n return this.getNode(child);\n }\n\n /**\n * Indent node.\n */\n indentNode(node: TreeNodeType): void {\n const parent = this.getParent(node);\n if (!parent) {\n return;\n }\n\n const idx = parent.children.findIndex((child) => child === node.id);\n if (idx < 1 || idx >= parent.children.length) {\n return;\n }\n\n const previous = this.getNode(parent.children[idx - 1]);\n Obj.update(this._tree, () => {\n parent.children.splice(idx, 1);\n previous.children.push(node.id);\n });\n }\n\n /**\n * Unindent node.\n */\n unindentNode(node: TreeNodeType): void {\n const parent = this.getParent(node);\n if (!parent) {\n return;\n }\n\n const ancestor = this.getParent(parent);\n if (!ancestor) {\n return;\n }\n\n // Remove node from parent and get following siblings.\n const nodeIdx = parent.children.findIndex((id) => id === node.id);\n let rest: Key.EntityId[] = [];\n Obj.update(this._tree, () => {\n const removed = parent.children.splice(nodeIdx, parent.children.length - nodeIdx);\n rest = removed.slice(1); // Skip the node itself.\n });\n\n // Add to ancestor.\n const parentIdx = this.getChildNodes(ancestor).findIndex((n) => n.id === parent.id);\n Obj.update(this._tree, () => {\n ancestor.children.splice(parentIdx + 1, 0, node.id);\n });\n\n // Transplant following siblings to current node.\n Obj.update(this._tree, () => {\n node.children.push(...rest);\n });\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Key } from '@dxos/echo';\nimport { type TreeNode } from '@dxos/react-ui-graph';\n\nimport { type TreeType } from './tree';\n\n/**\n * Convert an ECHO `TreeType` (id-keyed node map) into a nested `TreeNode` hierarchy.\n * Returns `undefined` if the root id is missing — the tree is then incomplete and shouldn't render.\n */\nexport const treeTypeToTreeNode = (\n tree: TreeType,\n rootId: Key.EntityId = tree.root,\n visited: Set<string> = new Set(),\n): TreeNode | undefined => {\n const node = tree.nodes[rootId];\n if (!node) {\n return undefined;\n }\n if (visited.has(rootId)) {\n return { id: rootId, label: labelOf(node), data: node.data };\n }\n visited.add(rootId);\n\n return {\n id: rootId,\n label: labelOf(node),\n data: node.data,\n children: node.children\n .map((childId) => treeTypeToTreeNode(tree, childId, visited))\n .filter((c): c is TreeNode => Boolean(c)),\n };\n};\n\nconst labelOf = (node: { data: Record<string, any> }): string | undefined => {\n return typeof node.data?.text === 'string' ? node.data.text : undefined;\n};\n"],
5
- "mappings": ";AAIA,YAAYA,YAAY;AAExB,SAASC,KAAKC,KAAKC,KAAKC,KAAKC,YAAY;AACzC,SAASC,kBAAkB;AAC3B,SAASC,iBAAiB;AAE1B,IAAA,eAAA;AAIEC,IAAAA,eAAyBR,cAAaE;EACtCO,IAAAA,IAAMT;YAA2CU,e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AAA,OAAA,YAAA,GAAA,GAAA,KAAiD,EAAA;IACjDzB,CAAAA;AAEA,QAAA,OAAA,KAAA,OAAA,MAAA;AACF,WAAA,SAAA,KAAA,GAAA,IAAA;IACF,CAAA;;;;;AC/RO,IAAMuD,qBAAqB,CAChCC,MACAC,SAAuBD,KAAKE,MAC5BC,UAAuB,oBAAIC,IAAAA,MAAK;AAEhC,QAAMC,OAAOL,KAAKM,MAAML,MAAAA;AACxB,MAAI,CAACI,MAAM;AACT,WAAOE;EACT;AACA,MAAIJ,QAAQK,IAAIP,MAAAA,GAAS;AACvB,WAAO;MAAEQ,IAAIR;MAAQS,OAAOC,QAAQN,IAAAA;MAAOO,MAAMP,KAAKO;IAAK;EAC7D;AACAT,UAAQU,IAAIZ,MAAAA;AAEZ,SAAO;IACLQ,IAAIR;IACJS,OAAOC,QAAQN,IAAAA;IACfO,MAAMP,KAAKO;IACXE,UAAUT,KAAKS,SACZC,IAAI,CAACC,YAAYjB,mBAAmBC,MAAMgB,SAASb,OAAAA,CAAAA,EACnDc,OAAO,CAACC,MAAqBC,QAAQD,CAAAA,CAAAA;EAC1C;AACF;AAEA,IAAMP,UAAU,CAACN,SAAAA;AACf,SAAO,OAAOA,KAAKO,MAAMQ,SAAS,WAAWf,KAAKO,KAAKQ,OAAOb;AAChE;",
6
- "names": ["Schema", "DXN", "Key", "Obj", "Ref", "Type", "TestSchema", "invariant", "children", "data", "String", "ref", "optional", "pipe", "TreeType", "makeObject", "make", "EntityId", "nodes", "Record", "key", "TreeNodeType", "id", "root", "_tree", "tree", "result", "callback", "node", "depth", "undefined", "childId", "getNode", "n", "getChildNodes", "parent", "getParent", "idx", "hierarchical", "getLastDescendent", "previous", "length", "last", "update", "obj", "nodeToAdd", "splice", "index", "findIndex", "to", "from", "child", "push", "removed", "rest", "slice", "ancestor", "parentIdx", "treeTypeToTreeNode", "tree", "rootId", "root", "visited", "Set", "node", "nodes", "undefined", "has", "id", "label", "labelOf", "data", "add", "children", "map", "childId", "filter", "c", "Boolean", "text"]
7
- }
@@ -1,10 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- export {
8
- __export
9
- };
10
- //# sourceMappingURL=chunk-J5LGTIGS.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,69 +0,0 @@
1
- import {
2
- __export
3
- } from "./chunk-J5LGTIGS.mjs";
4
-
5
- // src/types/ExplorerAction.ts
6
- var ExplorerAction_exports = {};
7
- __export(ExplorerAction_exports, {
8
- GraphProps: () => GraphProps
9
- });
10
- import * as Schema from "effect/Schema";
11
- import { TypeInputOptionsAnnotation } from "@dxos/plugin-space";
12
- var GraphProps = Schema.Struct({
13
- name: Schema.optional(Schema.String),
14
- // TODO(wittjosiah): This should be a query input instead.
15
- typename: Schema.String.pipe(Schema.annotations({
16
- title: "Select type"
17
- }), TypeInputOptionsAnnotation.set({
18
- location: [
19
- "database",
20
- "runtime"
21
- ],
22
- kind: [
23
- "user"
24
- ]
25
- }), Schema.optional)
26
- });
27
-
28
- // src/types/Graph.ts
29
- var Graph_exports = {};
30
- __export(Graph_exports, {
31
- Graph: () => Graph,
32
- make: () => make
33
- });
34
- import * as Schema2 from "effect/Schema";
35
- import { Annotation, DXN, Filter, Obj, Query, QueryAST, Ref, Type, View } from "@dxos/echo";
36
- import { FormInputAnnotation, LabelAnnotation } from "@dxos/echo/Annotation";
37
- import { ViewAnnotation } from "@dxos/schema";
38
- var Graph = class extends Type.makeObject(DXN.make("org.dxos.type.graph", "0.1.0"))(Schema2.Struct({
39
- name: Schema2.optional(Schema2.String),
40
- view: Ref.Ref(View.View).pipe(FormInputAnnotation.set(false), Schema2.optional),
41
- query: Schema2.Struct({
42
- raw: Schema2.optional(Schema2.String),
43
- ast: QueryAST.Query
44
- }).pipe(FormInputAnnotation.set(false))
45
- }).pipe(LabelAnnotation.set([
46
- "name"
47
- ]), ViewAnnotation.set([
48
- "view"
49
- ]), Annotation.IconAnnotation.set({
50
- icon: "ph--graph--regular",
51
- hue: "green"
52
- }))) {
53
- };
54
- var make = ({ name, query = {
55
- raw: "",
56
- ast: Query.select(Filter.nothing()).ast
57
- }, view } = {}) => {
58
- return Obj.make(Graph, {
59
- name,
60
- view: view && Ref.make(view),
61
- query
62
- });
63
- };
64
-
65
- export {
66
- ExplorerAction_exports,
67
- Graph_exports
68
- };
69
- //# sourceMappingURL=chunk-TTFPTHAQ.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/ExplorerAction.ts", "../../../src/types/Graph.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { TypeInputOptionsAnnotation } from '@dxos/plugin-space';\n\nexport const GraphProps = Schema.Struct({\n name: Schema.optional(Schema.String),\n // TODO(wittjosiah): This should be a query input instead.\n typename: Schema.String.pipe(\n Schema.annotations({ title: 'Select type' }),\n TypeInputOptionsAnnotation.set({\n location: ['database', 'runtime'],\n kind: ['user'],\n }),\n Schema.optional,\n ),\n});\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, DXN, Filter, Obj, Query, QueryAST, Ref, Type, View } from '@dxos/echo';\nimport { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/Annotation';\nimport { ViewAnnotation } from '@dxos/schema';\n\nexport class Graph extends Type.makeObject<Graph>(DXN.make('org.dxos.type.graph', '0.1.0'))(\n Schema.Struct({\n name: Schema.optional(Schema.String),\n view: Ref.Ref(View.View).pipe(FormInputAnnotation.set(false), Schema.optional),\n query: Schema.Struct({\n raw: Schema.optional(Schema.String),\n ast: QueryAST.Query,\n }).pipe(FormInputAnnotation.set(false)),\n }).pipe(\n LabelAnnotation.set(['name']),\n ViewAnnotation.set(['view']),\n Annotation.IconAnnotation.set({ icon: 'ph--graph--regular', hue: 'green' }),\n ),\n) {}\n\ntype MakeProps = Omit<Partial<Obj.MakeProps<typeof Graph>>, 'view'> & {\n view?: View.View;\n};\n\n/**\n * Make a graph as a view of a data set.\n */\nexport const make = ({\n name,\n query = { raw: '', ast: Query.select(Filter.nothing()).ast },\n view,\n}: MakeProps = {}): Graph => {\n return Obj.make(Graph, { name, view: view && Ref.make(view), query });\n};\n"],
5
- "mappings": ";;;;;AAAA;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,kCAAkC;AAEpC,IAAMC,aAAoBC,cAAO;EACtCC,MAAaC,gBAAgBC,aAAM;;EAEnCC,UAAiBD,cAAOE,KACfC,mBAAY;IAAEC,OAAO;EAAc,CAAA,GAC1CT,2BAA2BU,IAAI;IAC7BC,UAAU;MAAC;MAAY;;IACvBC,MAAM;MAAC;;EACT,CAAA,GACOR,eAAQ;AAEnB,CAAA;;;ACnBA;;;;;AAIA,YAAYS,aAAY;AAExB,SAASC,YAAYC,KAAKC,QAAQC,KAAKC,OAAOC,UAAUC,KAAKC,MAAMC,YAAY;AAC/E,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,sBAAsB;AAExB,IAAMC,QAAN,cAAoBL,KAAKM,WAAkBZ,IAAIa,KAAK,uBAAuB,OAAA,CAAA,EACzEC,eAAO;EACZC,MAAaC,iBAAgBC,cAAM;EACnCC,MAAMb,IAAIA,IAAIE,KAAKA,IAAI,EAAEY,KAAKX,oBAAoBY,IAAI,KAAA,GAAeJ,gBAAQ;EAC7EK,OAAcP,eAAO;IACnBQ,KAAYN,iBAAgBC,cAAM;IAClCM,KAAKnB,SAASD;EAChB,CAAA,EAAGgB,KAAKX,oBAAoBY,IAAI,KAAA,CAAA;AAClC,CAAA,EAAGD,KACDV,gBAAgBW,IAAI;EAAC;CAAO,GAC5BV,eAAeU,IAAI;EAAC;CAAO,GAC3BrB,WAAWyB,eAAeJ,IAAI;EAAEK,MAAM;EAAsBC,KAAK;AAAQ,CAAA,CAAA,CAAA,EAAA;AAE1E;AASI,IAAMb,OAAO,CAAC,EACnBE,MACAM,QAAQ;EAAEC,KAAK;EAAIC,KAAKpB,MAAMwB,OAAO1B,OAAO2B,QAAO,CAAA,EAAIL;AAAI,GAC3DL,KAAI,IACS,CAAC,MAAC;AACf,SAAOhB,IAAIW,KAAKF,OAAO;IAAEI;IAAMG,MAAMA,QAAQb,IAAIQ,KAAKK,IAAAA;IAAOG;EAAM,CAAA;AACrE;",
6
- "names": ["Schema", "TypeInputOptionsAnnotation", "GraphProps", "Struct", "name", "optional", "String", "typename", "pipe", "annotations", "title", "set", "location", "kind", "Schema", "Annotation", "DXN", "Filter", "Obj", "Query", "QueryAST", "Ref", "Type", "View", "FormInputAnnotation", "LabelAnnotation", "ViewAnnotation", "Graph", "makeObject", "make", "Struct", "name", "optional", "String", "view", "pipe", "set", "query", "raw", "ast", "IconAnnotation", "icon", "hue", "select", "nothing"]
7
- }