@dxos/plugin-explorer 0.8.4-main.c1de068 → 0.8.4-main.f5c0578

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 (70) hide show
  1. package/dist/lib/browser/{ExplorerContainer-OGHSHZD5.mjs → ExplorerContainer-5QHLD2B2.mjs} +3 -3
  2. package/dist/lib/browser/{ExplorerContainer-OGHSHZD5.mjs.map → ExplorerContainer-5QHLD2B2.mjs.map} +2 -2
  3. package/dist/lib/browser/{chunk-OAOY7SHY.mjs → chunk-2MKBRIUT.mjs} +6 -5
  4. package/dist/lib/browser/chunk-2MKBRIUT.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-EF4BFHTI.mjs → chunk-CZZ3DDR7.mjs} +1 -1
  6. package/dist/lib/browser/{chunk-EF4BFHTI.mjs.map → chunk-CZZ3DDR7.mjs.map} +2 -2
  7. package/dist/lib/browser/{chunk-J2BBZOSF.mjs → chunk-L4U4MPSZ.mjs} +4 -1
  8. package/dist/lib/browser/{chunk-J2BBZOSF.mjs.map → chunk-L4U4MPSZ.mjs.map} +3 -3
  9. package/dist/lib/browser/{chunk-PVFZFKQ6.mjs → chunk-LGK64HLU.mjs} +4 -244
  10. package/dist/lib/browser/{chunk-PVFZFKQ6.mjs.map → chunk-LGK64HLU.mjs.map} +3 -3
  11. package/dist/lib/browser/index.mjs +7 -7
  12. package/dist/lib/browser/index.mjs.map +3 -3
  13. package/dist/lib/browser/{intent-resolver-XH2UO2FM.mjs → intent-resolver-7MVEYNX7.mjs} +3 -3
  14. package/dist/lib/browser/{intent-resolver-XH2UO2FM.mjs.map → intent-resolver-7MVEYNX7.mjs.map} +3 -3
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/{react-surface-65VQ42HX.mjs → react-surface-FABRDFTF.mjs} +4 -4
  17. package/dist/lib/browser/types/index.mjs +1 -1
  18. package/dist/lib/node-esm/{ExplorerContainer-6ON5NA2P.mjs → ExplorerContainer-AMYAVLO4.mjs} +3 -3
  19. package/dist/lib/node-esm/{ExplorerContainer-6ON5NA2P.mjs.map → ExplorerContainer-AMYAVLO4.mjs.map} +2 -2
  20. package/dist/lib/node-esm/{chunk-PPBUWC7F.mjs → chunk-3ODK27PU.mjs} +6 -5
  21. package/dist/lib/node-esm/chunk-3ODK27PU.mjs.map +7 -0
  22. package/dist/lib/node-esm/{chunk-VKCOKQRG.mjs → chunk-4GWDNZ4Z.mjs} +1 -1
  23. package/dist/lib/node-esm/{chunk-VKCOKQRG.mjs.map → chunk-4GWDNZ4Z.mjs.map} +2 -2
  24. package/dist/lib/node-esm/{chunk-4VMSNXYL.mjs → chunk-MCOXQ3ML.mjs} +4 -1
  25. package/dist/lib/node-esm/{chunk-4VMSNXYL.mjs.map → chunk-MCOXQ3ML.mjs.map} +3 -3
  26. package/dist/lib/node-esm/{chunk-S5A2EUSJ.mjs → chunk-W4ZNCGOD.mjs} +4 -244
  27. package/dist/lib/node-esm/{chunk-S5A2EUSJ.mjs.map → chunk-W4ZNCGOD.mjs.map} +3 -3
  28. package/dist/lib/node-esm/index.mjs +7 -7
  29. package/dist/lib/node-esm/index.mjs.map +3 -3
  30. package/dist/lib/node-esm/{intent-resolver-AGBBNA67.mjs → intent-resolver-NL3SR2XF.mjs} +3 -3
  31. package/dist/lib/node-esm/{intent-resolver-AGBBNA67.mjs.map → intent-resolver-NL3SR2XF.mjs.map} +3 -3
  32. package/dist/lib/node-esm/meta.json +1 -1
  33. package/dist/lib/node-esm/{react-surface-IJIMYAST.mjs → react-surface-EYCZUAAI.mjs} +4 -4
  34. package/dist/lib/node-esm/types/index.mjs +1 -1
  35. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  36. package/dist/types/src/components/Chart/Chart.d.ts.map +1 -1
  37. package/dist/types/src/components/Chart/Chart.stories.d.ts.map +1 -1
  38. package/dist/types/src/components/ExplorerContainer.d.ts.map +1 -1
  39. package/dist/types/src/components/Globe/Globe.d.ts.map +1 -1
  40. package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
  41. package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts.map +1 -1
  42. package/dist/types/src/components/Graph/ForceGraph.stories.d.ts.map +1 -1
  43. package/dist/types/src/components/Graph/testing.d.ts +1 -1
  44. package/dist/types/src/components/Graph/testing.d.ts.map +1 -1
  45. package/dist/types/src/hooks/useGraphModel.d.ts +2 -2
  46. package/dist/types/src/hooks/useGraphModel.d.ts.map +1 -1
  47. package/dist/types/src/types/types.d.ts.map +1 -1
  48. package/dist/types/tsconfig.tsbuildinfo +1 -1
  49. package/package.json +31 -28
  50. package/src/ExplorerPlugin.tsx +2 -2
  51. package/src/capabilities/intent-resolver.ts +1 -1
  52. package/src/components/Chart/Chart.stories.tsx +2 -1
  53. package/src/components/Chart/Chart.tsx +1 -1
  54. package/src/components/ExplorerContainer.tsx +2 -1
  55. package/src/components/Globe/Globe.stories.tsx +3 -2
  56. package/src/components/Globe/Globe.tsx +1 -1
  57. package/src/components/Graph/D3ForceGraph.stories.tsx +4 -3
  58. package/src/components/Graph/D3ForceGraph.tsx +1 -1
  59. package/src/components/Graph/ForceGraph.stories.tsx +4 -3
  60. package/src/components/Graph/ForceGraph.tsx +1 -1
  61. package/src/components/Graph/testing.ts +2 -2
  62. package/src/components/Tree/Tree.stories.tsx +1 -1
  63. package/src/components/Tree/Tree.tsx +1 -1
  64. package/src/components/Tree/types/tree.test.ts +2 -1
  65. package/src/hooks/useGraphModel.ts +5 -4
  66. package/src/types/types.ts +2 -1
  67. package/dist/lib/browser/chunk-OAOY7SHY.mjs.map +0 -7
  68. package/dist/lib/node-esm/chunk-PPBUWC7F.mjs.map +0 -7
  69. /package/dist/lib/browser/{react-surface-65VQ42HX.mjs.map → react-surface-FABRDFTF.mjs.map} +0 -0
  70. /package/dist/lib/node-esm/{react-surface-IJIMYAST.mjs.map → react-surface-EYCZUAAI.mjs.map} +0 -0
@@ -10978,7 +10978,6 @@ var TidyTree_default = TidyTree;
10978
10978
  import { Schema } from "effect";
10979
10979
  import { Key, Obj, Type } from "@dxos/echo";
10980
10980
  import { invariant } from "@dxos/invariant";
10981
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-explorer/src/components/Tree/types/tree.ts";
10982
10981
  var TreeNodeType = Schema.Struct({
10983
10982
  id: Key.ObjectId,
10984
10983
  children: Schema.mutable(Schema.Array(Key.ObjectId)),
@@ -10998,245 +10997,6 @@ var TreeType = Schema.Struct({
10998
10997
  typename: "dxos.org/type/Tree",
10999
10998
  version: "0.1.0"
11000
10999
  }));
11001
- var Tree = class _Tree {
11002
- static {
11003
- this.create = () => {
11004
- const id = Key.ObjectId.random();
11005
- return Obj.make(TreeType, {
11006
- root: id,
11007
- nodes: {
11008
- [id]: {
11009
- id,
11010
- children: [],
11011
- data: {
11012
- text: ""
11013
- }
11014
- }
11015
- }
11016
- });
11017
- };
11018
- }
11019
- constructor(tree3) {
11020
- this._tree = tree3 ?? _Tree.create();
11021
- }
11022
- get tree() {
11023
- return this._tree;
11024
- }
11025
- // TODO(burdon): Make reactive.
11026
- get size() {
11027
- return Object.keys(this._tree.nodes).length;
11028
- }
11029
- get root() {
11030
- return this.getNode(this._tree.root);
11031
- }
11032
- //
11033
- // Traversal
11034
- //
11035
- /**
11036
- * Recursively traverse the tree until the callback returns a value.
11037
- */
11038
- tranverse(callback, root = this._tree.root, depth = 0) {
11039
- const node = this._tree.nodes[root];
11040
- const result = callback(node, depth);
11041
- if (result !== void 0) {
11042
- return result;
11043
- }
11044
- for (const childId of node.children) {
11045
- const result2 = this.tranverse(callback, childId, depth + 1);
11046
- if (result2 !== void 0) {
11047
- return result2;
11048
- }
11049
- }
11050
- }
11051
- getNode(id) {
11052
- const node = this._tree.nodes[id];
11053
- invariant(node, void 0, {
11054
- F: __dxlog_file,
11055
- L: 98,
11056
- S: this,
11057
- A: [
11058
- "node",
11059
- ""
11060
- ]
11061
- });
11062
- return node;
11063
- }
11064
- /**
11065
- * Get the children of a node.
11066
- */
11067
- getChildNodes(node) {
11068
- return node.children.map((id) => this.getNode(id));
11069
- }
11070
- /**
11071
- * Get the parent of a node.
11072
- */
11073
- getParent(node) {
11074
- const parent = this.tranverse((n) => {
11075
- if (n.children.includes(node.id)) {
11076
- return n;
11077
- }
11078
- });
11079
- return parent ?? null;
11080
- }
11081
- /**
11082
- * Get the next node in the tree.
11083
- */
11084
- getNext(node, hierarchical = true) {
11085
- if (hierarchical && node.children.length) {
11086
- return this.getChildNodes(node)[0];
11087
- } else {
11088
- const parent = this.getParent(node);
11089
- if (parent) {
11090
- const idx = this.getChildNodes(parent).findIndex(({ id }) => id === node.id);
11091
- if (idx < parent.children.length - 1) {
11092
- return this.getNode(parent.children[idx + 1]);
11093
- } else {
11094
- return this.getNext(parent, false);
11095
- }
11096
- }
11097
- }
11098
- }
11099
- /**
11100
- * Get the previous node in the tree.
11101
- */
11102
- getPrevious(node, hierarchical = true) {
11103
- const parent = this.getParent(node);
11104
- const idx = this.getChildNodes(parent).findIndex(({ id }) => id === node.id);
11105
- if (idx === 0) {
11106
- if (hierarchical) {
11107
- return parent;
11108
- }
11109
- } else {
11110
- const previous = this.getNode(parent.children[idx - 1]);
11111
- if (hierarchical && previous.children.length) {
11112
- return this.getLastDescendent(previous);
11113
- }
11114
- return previous;
11115
- }
11116
- }
11117
- /**
11118
- * Get the last descendent of a node.
11119
- */
11120
- getLastDescendent(node) {
11121
- const children = this.getChildNodes(node);
11122
- const last = children.length ? children[children.length - 1] : void 0;
11123
- if (last) {
11124
- return this.getLastDescendent(last);
11125
- }
11126
- return node;
11127
- }
11128
- //
11129
- // Mutations
11130
- //
11131
- /**
11132
- * Clear tree.
11133
- */
11134
- clear() {
11135
- const root = this._tree.nodes[this._tree.root];
11136
- root.children.length = 0;
11137
- this._tree.nodes = {
11138
- [root.id]: root
11139
- };
11140
- }
11141
- /**
11142
- * Add node.
11143
- */
11144
- addNode(parent, node, index) {
11145
- if (!node) {
11146
- const id = Key.ObjectId.random();
11147
- node = {
11148
- id,
11149
- children: [],
11150
- data: {
11151
- text: ""
11152
- }
11153
- };
11154
- }
11155
- this._tree.nodes[node.id] = node;
11156
- parent.children.splice(index ?? parent.children.length, 0, node.id);
11157
- return node;
11158
- }
11159
- /**
11160
- * Delete node.
11161
- */
11162
- deleteNode(parent, id) {
11163
- const node = this._tree.nodes[id];
11164
- if (!node) {
11165
- return void 0;
11166
- }
11167
- delete this._tree.nodes[node.id];
11168
- const idx = parent.children.findIndex((child) => child === id);
11169
- if (idx !== -1) {
11170
- parent.children.splice(idx, 1);
11171
- }
11172
- return node;
11173
- }
11174
- /**
11175
- * Move child node.
11176
- */
11177
- moveNode(node, from, to) {
11178
- invariant(from >= 0 && from < node.children.length, void 0, {
11179
- F: __dxlog_file,
11180
- L: 228,
11181
- S: this,
11182
- A: [
11183
- "from >= 0 && from < node.children.length",
11184
- ""
11185
- ]
11186
- });
11187
- invariant(to >= 0 && to < node.children.length, void 0, {
11188
- F: __dxlog_file,
11189
- L: 229,
11190
- S: this,
11191
- A: [
11192
- "to >= 0 && to < node.children.length",
11193
- ""
11194
- ]
11195
- });
11196
- if (from === to) {
11197
- return null;
11198
- }
11199
- const child = node.children[from];
11200
- node.children.splice(from, 1);
11201
- node.children.splice(to, 0, child);
11202
- return this.getNode(child);
11203
- }
11204
- /**
11205
- * Indent node.
11206
- */
11207
- indentNode(node) {
11208
- const parent = this.getParent(node);
11209
- if (!parent) {
11210
- return;
11211
- }
11212
- const idx = parent.children.findIndex((child) => child === node.id);
11213
- if (idx < 1 || idx >= parent.children.length) {
11214
- return;
11215
- }
11216
- const previous = this.getNode(parent.children[idx - 1]);
11217
- parent.children.splice(idx, 1);
11218
- previous.children.push(node.id);
11219
- }
11220
- /**
11221
- * Unindent node.
11222
- */
11223
- unindentNode(node) {
11224
- const parent = this.getParent(node);
11225
- if (!parent) {
11226
- return;
11227
- }
11228
- const ancestor = this.getParent(parent);
11229
- if (!ancestor) {
11230
- return;
11231
- }
11232
- const nodeIdx = parent.children.findIndex((id) => id === node.id);
11233
- const [_, ...rest] = parent.children.splice(nodeIdx, parent.children.length - nodeIdx);
11234
- parent.children.splice(nodeIdx, parent.children.length - nodeIdx);
11235
- const parentIdx = this.getChildNodes(ancestor).findIndex((n) => n.id === parent.id);
11236
- ancestor.children.splice(parentIdx + 1, 0, node.id);
11237
- node.children.push(...rest);
11238
- }
11239
- };
11240
11000
 
11241
11001
  // src/components/Tree/types/types.ts
11242
11002
  var mapGraphToTreeData = (model, maxDepth = 8) => {
@@ -11264,7 +11024,7 @@ var renderers = /* @__PURE__ */ new Map([
11264
11024
  HierarchicalEdgeBundling_default
11265
11025
  ]
11266
11026
  ]);
11267
- var Tree2 = ({ space, selected, variant = "tidy", onNodeClick }) => {
11027
+ var Tree = ({ space, selected, variant = "tidy", onNodeClick }) => {
11268
11028
  var _effect = _useSignals3();
11269
11029
  try {
11270
11030
  const [model] = useAsyncState(async () => space ? new SpaceGraphModel().open(space) : void 0, [
@@ -11319,13 +11079,13 @@ var Tree2 = ({ space, selected, variant = "tidy", onNodeClick }) => {
11319
11079
 
11320
11080
  // src/components/index.ts
11321
11081
  import { lazy } from "react";
11322
- var ExplorerContainer = lazy(() => import("./ExplorerContainer-6ON5NA2P.mjs"));
11082
+ var ExplorerContainer = lazy(() => import("./ExplorerContainer-AMYAVLO4.mjs"));
11323
11083
 
11324
11084
  export {
11325
11085
  Chart,
11326
11086
  Globe,
11327
11087
  defaultTreeLayoutSlots,
11328
- Tree2 as Tree,
11088
+ Tree,
11329
11089
  ExplorerContainer
11330
11090
  };
11331
- //# sourceMappingURL=chunk-S5A2EUSJ.mjs.map
11091
+ //# sourceMappingURL=chunk-W4ZNCGOD.mjs.map