@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,7 @@
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,eAAM,aAAA,IAAA,QAAA,CAAA;QAASV,eAAU,cAAA;IAAC,KAAA;IAC3EW,OAAYC;EACXC,CAAAA,CAAAA;EAIH,KAAaC,gBAAAA,IAAAA,IAAiBT,WAAKU,OAAyBC,CAAAA;QAE9CC,cAAQ;AAClBC,IAAOlB,WAAPkB,cAAsBlB,KAAOmB,WAAO,IAAA,KAAA,sBAAA,OAAA,CAAA,EAAA,cAAA;QAAEC,IAAKlB;SAAqBmB,eAAAA,cAAAA;IAAa,KAAA,IAAA;IAC/E,OAAA;EACC,CAAA,CAAA;AAEH,CAAA,CAAA,EAAA;;AAKI,IAAMC,OAAN,MAAMA,MAAKpB;SACX,SAAWc,MAAKF;UACdS,KAAMD,IAAAA,SAAAA,OAAAA;WACNJ,IAAO,KAAA,UAAA;YACJI;;cAECd;UACAC;oBAAc,CAAA;UAAG,MAAA;YACnB,MAAA;UACF;QACF;MACA;IAEMe,CAAAA;EAER;;EAEA,YAAA,MAAA;AAEIC,SAAAA,QAAO,QAAA,MAAA,OAAA;;EAEX,IAAA,OAAA;AAEA,WAAA,KAAA;EACA;;EAEA,IAAA,OAAA;AAEIF,WAAO,OAAA,KAAA,KAAA,MAAA,KAAA,EAAA;;EAEX,IAAA,OAAA;AAEE,WAAA,KAAA,QAAA,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KQ,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
+ }
@@ -32,12 +32,12 @@ __export(Graph_exports, {
32
32
  make: () => make
33
33
  });
34
34
  import * as Schema2 from "effect/Schema";
35
- import { DXN, Annotation, Filter, Obj, Query, QueryAST, Ref, Type, View } from "@dxos/echo";
35
+ import { Annotation, DXN, Filter, Obj, Query, QueryAST, Ref, Type, View } from "@dxos/echo";
36
36
  import { FormInputAnnotation, LabelAnnotation } from "@dxos/echo/Annotation";
37
37
  import { ViewAnnotation } from "@dxos/schema";
38
- var GraphSchema = Schema2.Struct({
38
+ var Graph = class extends Type.makeObject(DXN.make("org.dxos.type.graph", "0.1.0"))(Schema2.Struct({
39
39
  name: Schema2.optional(Schema2.String),
40
- view: Ref.Ref(View.View).pipe(FormInputAnnotation.set(false)),
40
+ view: Ref.Ref(View.View).pipe(FormInputAnnotation.set(false), Schema2.optional),
41
41
  query: Schema2.Struct({
42
42
  raw: Schema2.optional(Schema2.String),
43
43
  ast: QueryAST.Query
@@ -49,15 +49,15 @@ var GraphSchema = Schema2.Struct({
49
49
  ]), Annotation.IconAnnotation.set({
50
50
  icon: "ph--graph--regular",
51
51
  hue: "green"
52
- }), Type.makeObject(DXN.make("org.dxos.type.graph", "0.1.0")));
53
- var Graph = GraphSchema;
52
+ }))) {
53
+ };
54
54
  var make = ({ name, query = {
55
55
  raw: "",
56
56
  ast: Query.select(Filter.nothing()).ast
57
- }, view }) => {
57
+ }, view } = {}) => {
58
58
  return Obj.make(Graph, {
59
59
  name,
60
- view: Ref.make(view),
60
+ view: view && Ref.make(view),
61
61
  query
62
62
  });
63
63
  };
@@ -66,4 +66,4 @@ export {
66
66
  ExplorerAction_exports,
67
67
  Graph_exports
68
68
  };
69
- //# sourceMappingURL=chunk-YBCHBVCJ.mjs.map
69
+ //# sourceMappingURL=chunk-TTFPTHAQ.mjs.map
@@ -0,0 +1,7 @@
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
+ }