@dxos/plugin-navtree 0.8.4-main.406dc2a → 0.8.4-main.52d7546f51

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 (170) hide show
  1. package/dist/lib/browser/app-graph-builder-XGA4GPGL.mjs +44 -0
  2. package/dist/lib/browser/app-graph-builder-XGA4GPGL.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-63YLDLLE.mjs +1373 -0
  4. package/dist/lib/browser/chunk-63YLDLLE.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-X2HDG62A.mjs +23 -0
  6. package/dist/lib/browser/chunk-X2HDG62A.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-YKTYPINZ.mjs +19 -0
  8. package/dist/lib/browser/chunk-YKTYPINZ.mjs.map +7 -0
  9. package/dist/lib/browser/index.mjs +83 -91
  10. package/dist/lib/browser/index.mjs.map +4 -4
  11. package/dist/lib/browser/{keyboard-AHSAWKXA.mjs → keyboard-46XQHY2O.mjs} +21 -19
  12. package/dist/lib/browser/keyboard-46XQHY2O.mjs.map +7 -0
  13. package/dist/lib/browser/meta.json +1 -1
  14. package/dist/lib/browser/operation-resolver-NNNDII45.mjs +53 -0
  15. package/dist/lib/browser/operation-resolver-NNNDII45.mjs.map +7 -0
  16. package/dist/lib/browser/react-surface-APSEG23H.mjs +59 -0
  17. package/dist/lib/browser/react-surface-APSEG23H.mjs.map +7 -0
  18. package/dist/lib/browser/state-M5YUCIQU.mjs +121 -0
  19. package/dist/lib/browser/state-M5YUCIQU.mjs.map +7 -0
  20. package/dist/types/src/NavTreePlugin.d.ts +2 -1
  21. package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
  22. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
  23. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  24. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  25. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  26. package/dist/types/src/capabilities/index.d.ts +5 -108
  27. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  28. package/dist/types/src/capabilities/keyboard/index.d.ts +3 -0
  29. package/dist/types/src/capabilities/keyboard/index.d.ts.map +1 -0
  30. package/dist/types/src/capabilities/keyboard/keyboard.d.ts +5 -0
  31. package/dist/types/src/capabilities/keyboard/keyboard.d.ts.map +1 -0
  32. package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
  33. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
  34. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
  35. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
  36. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  37. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  38. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  39. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  40. package/dist/types/src/capabilities/state/index.d.ts +3 -0
  41. package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
  42. package/dist/types/src/capabilities/state/state.d.ts +6 -0
  43. package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
  44. package/dist/types/src/components/CommandsDialog/CommandsDialog.d.ts +3 -2
  45. package/dist/types/src/components/CommandsDialog/CommandsDialog.d.ts.map +1 -1
  46. package/dist/types/src/components/CommandsDialog/CommandsTrigger.d.ts.map +1 -1
  47. package/dist/types/src/components/NavTree/NavTree.d.ts +30 -1
  48. package/dist/types/src/components/NavTree/NavTree.d.ts.map +1 -1
  49. package/dist/types/src/components/NavTree/NavTree.stories.d.ts +4 -1
  50. package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +1 -1
  51. package/dist/types/src/components/NavTreeContainer.d.ts +8 -1
  52. package/dist/types/src/components/NavTreeContainer.d.ts.map +1 -1
  53. package/dist/types/src/components/NavTreeDocumentTitle.d.ts +1 -1
  54. package/dist/types/src/components/NavTreeDocumentTitle.d.ts.map +1 -1
  55. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts +6 -6
  56. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts.map +1 -1
  57. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts +2 -1
  58. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts.map +1 -1
  59. package/dist/types/src/components/Sidebar/L0Menu.d.ts +4 -4
  60. package/dist/types/src/components/Sidebar/L0Menu.d.ts.map +1 -1
  61. package/dist/types/src/components/Sidebar/L1Panel.d.ts +2 -2
  62. package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
  63. package/dist/types/src/components/Sidebar/L1Tabs.d.ts +2 -2
  64. package/dist/types/src/components/Sidebar/L1Tabs.d.ts.map +1 -1
  65. package/dist/types/src/components/index.d.ts.map +1 -1
  66. package/dist/types/src/components/types.d.ts +7 -7
  67. package/dist/types/src/components/types.d.ts.map +1 -1
  68. package/dist/types/src/experimental/Tree.stories.d.ts +15 -4
  69. package/dist/types/src/experimental/Tree.stories.d.ts.map +1 -1
  70. package/dist/types/src/hooks.d.ts +32 -1
  71. package/dist/types/src/hooks.d.ts.map +1 -1
  72. package/dist/types/src/index.d.ts +1 -2
  73. package/dist/types/src/index.d.ts.map +1 -1
  74. package/dist/types/src/meta.d.ts +2 -2
  75. package/dist/types/src/meta.d.ts.map +1 -1
  76. package/dist/types/src/testing/app-graph-builder.d.ts +2 -3
  77. package/dist/types/src/testing/app-graph-builder.d.ts.map +1 -1
  78. package/dist/types/src/testing/generator.d.ts +5 -6
  79. package/dist/types/src/testing/generator.d.ts.map +1 -1
  80. package/dist/types/src/testing/update-state.d.ts +2 -2
  81. package/dist/types/src/testing/update-state.d.ts.map +1 -1
  82. package/dist/types/src/types/capabilities.d.ts +16 -0
  83. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  84. package/dist/types/src/types/events.d.ts +5 -0
  85. package/dist/types/src/types/events.d.ts.map +1 -0
  86. package/dist/types/src/types/index.d.ts +4 -0
  87. package/dist/types/src/types/index.d.ts.map +1 -0
  88. package/dist/types/src/{types.d.ts → types/schema.d.ts} +7 -7
  89. package/dist/types/src/types/schema.d.ts.map +1 -0
  90. package/dist/types/src/util.d.ts +7 -7
  91. package/dist/types/src/util.d.ts.map +1 -1
  92. package/dist/types/tsconfig.tsbuildinfo +1 -1
  93. package/package.json +54 -52
  94. package/src/NavTreePlugin.tsx +53 -72
  95. package/src/capabilities/app-graph-builder/app-graph-builder.ts +42 -0
  96. package/src/capabilities/app-graph-builder/index.ts +7 -0
  97. package/src/capabilities/index.ts +5 -9
  98. package/src/capabilities/keyboard/index.ts +7 -0
  99. package/src/capabilities/keyboard/keyboard.ts +66 -0
  100. package/src/capabilities/operation-resolver/index.ts +7 -0
  101. package/src/capabilities/operation-resolver/operation-resolver.ts +42 -0
  102. package/src/capabilities/react-surface/index.ts +7 -0
  103. package/src/capabilities/react-surface/react-surface.tsx +55 -0
  104. package/src/capabilities/state/index.ts +7 -0
  105. package/src/capabilities/state/state.ts +122 -0
  106. package/src/components/CommandsDialog/CommandsDialog.tsx +107 -97
  107. package/src/components/CommandsDialog/CommandsTrigger.tsx +4 -13
  108. package/src/components/NavTree/NavTree.stories.tsx +36 -44
  109. package/src/components/NavTree/NavTree.tsx +5 -15
  110. package/src/components/NavTreeContainer.tsx +255 -263
  111. package/src/components/NavTreeDocumentTitle.tsx +3 -2
  112. package/src/components/NavTreeItem/NavTreeItemAction.stories.tsx +17 -7
  113. package/src/components/NavTreeItem/NavTreeItemAction.tsx +18 -12
  114. package/src/components/NavTreeItem/NavTreeItemColumns.tsx +5 -5
  115. package/src/components/Sidebar/L0Menu.tsx +69 -98
  116. package/src/components/Sidebar/L1Panel.tsx +151 -72
  117. package/src/components/Sidebar/L1Tabs.tsx +6 -31
  118. package/src/components/UserAccountAvatar/UserAccountAvatar.stories.tsx +1 -1
  119. package/src/components/index.ts +1 -0
  120. package/src/components/types.ts +7 -7
  121. package/src/experimental/Tree.stories.tsx +45 -54
  122. package/src/experimental/Tree.tsx +3 -3
  123. package/src/hooks.ts +54 -2
  124. package/src/index.ts +1 -2
  125. package/src/meta.ts +7 -2
  126. package/src/testing/app-graph-builder.ts +159 -235
  127. package/src/testing/generator.ts +19 -17
  128. package/src/testing/update-state.ts +6 -6
  129. package/src/types/capabilities.ts +21 -0
  130. package/src/types/events.ts +12 -0
  131. package/src/types/index.ts +7 -0
  132. package/src/{types.ts → types/schema.ts} +6 -6
  133. package/src/util.ts +13 -16
  134. package/dist/lib/browser/app-graph-builder-YAPMENYT.mjs +0 -46
  135. package/dist/lib/browser/app-graph-builder-YAPMENYT.mjs.map +0 -7
  136. package/dist/lib/browser/chunk-IMFXKPSB.mjs +0 -1482
  137. package/dist/lib/browser/chunk-IMFXKPSB.mjs.map +0 -7
  138. package/dist/lib/browser/chunk-LPAREX6J.mjs +0 -15
  139. package/dist/lib/browser/chunk-LPAREX6J.mjs.map +0 -7
  140. package/dist/lib/browser/chunk-ZENLR72O.mjs +0 -14
  141. package/dist/lib/browser/chunk-ZENLR72O.mjs.map +0 -7
  142. package/dist/lib/browser/intent-resolver-TCQXGF6U.mjs +0 -47
  143. package/dist/lib/browser/intent-resolver-TCQXGF6U.mjs.map +0 -7
  144. package/dist/lib/browser/keyboard-AHSAWKXA.mjs.map +0 -7
  145. package/dist/lib/browser/react-surface-AH2TP73M.mjs +0 -51
  146. package/dist/lib/browser/react-surface-AH2TP73M.mjs.map +0 -7
  147. package/dist/lib/browser/state-2Q623V7U.mjs +0 -117
  148. package/dist/lib/browser/state-2Q623V7U.mjs.map +0 -7
  149. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  150. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  151. package/dist/types/src/capabilities/capabilities.d.ts +0 -21
  152. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  153. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  154. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  155. package/dist/types/src/capabilities/keyboard.d.ts +0 -4
  156. package/dist/types/src/capabilities/keyboard.d.ts.map +0 -1
  157. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  158. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  159. package/dist/types/src/capabilities/state.d.ts +0 -20
  160. package/dist/types/src/capabilities/state.d.ts.map +0 -1
  161. package/dist/types/src/events.d.ts +0 -4
  162. package/dist/types/src/events.d.ts.map +0 -1
  163. package/dist/types/src/types.d.ts.map +0 -1
  164. package/src/capabilities/app-graph-builder.ts +0 -53
  165. package/src/capabilities/capabilities.ts +0 -20
  166. package/src/capabilities/intent-resolver.ts +0 -37
  167. package/src/capabilities/keyboard.ts +0 -59
  168. package/src/capabilities/react-surface.tsx +0 -45
  169. package/src/capabilities/state.ts +0 -105
  170. package/src/events.ts +0 -11
package/src/util.ts CHANGED
@@ -2,22 +2,24 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type Action, type Node, type ReadableGraph, isActionLike } from '@dxos/app-graph';
5
+ import { Graph, Node } from '@dxos/plugin-graph';
6
6
  import { isNonNullable } from '@dxos/util';
7
7
 
8
8
  import { type NavTreeItemGraphNode } from './types';
9
9
 
10
10
  export const getParent = (
11
- graph: ReadableGraph,
11
+ graph: Graph.ReadableGraph,
12
12
  node: NavTreeItemGraphNode,
13
13
  path: string[],
14
14
  ): NavTreeItemGraphNode | undefined => {
15
15
  const parentId = path[path.length - 2];
16
- return graph.getConnections(node.id, 'inbound').find((n) => n.id === parentId) as NavTreeItemGraphNode | undefined;
16
+ return Graph.getConnections(graph, node.id, 'inbound').find((n: Node.Node) => n.id === parentId) as
17
+ | NavTreeItemGraphNode
18
+ | undefined;
17
19
  };
18
20
 
19
21
  export const getPersistenceParent = (
20
- graph: ReadableGraph,
22
+ graph: Graph.ReadableGraph,
21
23
  node: NavTreeItemGraphNode,
22
24
  path: string[],
23
25
  persistenceClass: string,
@@ -31,7 +33,7 @@ export const getPersistenceParent = (
31
33
  };
32
34
 
33
35
  export const resolveMigrationOperation = (
34
- graph: ReadableGraph,
36
+ graph: Graph.ReadableGraph,
35
37
  activeNode: NavTreeItemGraphNode,
36
38
  destinationPath: string[],
37
39
  destinationRelatedNode?: NavTreeItemGraphNode,
@@ -60,7 +62,7 @@ export const resolveMigrationOperation = (
60
62
  };
61
63
 
62
64
  // TODO(wittjosiah): Move into node implementation?
63
- export const sortActions = (actions: Action[]): Action[] =>
65
+ export const sortActions = (actions: Node.Action[]): Node.Action[] =>
64
66
  actions.sort((a, b) => {
65
67
  if (a.properties.disposition === b.properties.disposition) {
66
68
  return 0;
@@ -74,13 +76,12 @@ export const sortActions = (actions: Action[]): Action[] =>
74
76
  });
75
77
 
76
78
  export const getChildren = (
77
- graph: ReadableGraph,
79
+ graph: Graph.ReadableGraph,
78
80
  node: NavTreeItemGraphNode,
79
81
  path: readonly string[] = [],
80
82
  ): NavTreeItemGraphNode[] => {
81
- return graph
82
- .getConnections(node.id, 'outbound')
83
- .map((n) => {
83
+ return Graph.getConnections(graph, node.id, 'outbound')
84
+ .map((n: Node.Node) => {
84
85
  // Break cycles.
85
86
  const nextPath = [...path, node.id];
86
87
  return nextPath.includes(n.id) ? undefined : (n as NavTreeItemGraphNode);
@@ -88,13 +89,9 @@ export const getChildren = (
88
89
  .filter(isNonNullable) as NavTreeItemGraphNode[];
89
90
  };
90
91
 
91
- export const l0ItemType = (item: Node<any>) => {
92
- if (item.properties.disposition === 'collection') {
93
- return 'collection';
94
- } else if (isActionLike(item)) {
92
+ export const l0ItemType = (item: Node.Node) => {
93
+ if (Node.isActionLike(item)) {
95
94
  return 'action';
96
- } else if (item.properties.disposition === 'navigation') {
97
- return 'link';
98
95
  } else {
99
96
  return 'tab';
100
97
  }
@@ -1,46 +0,0 @@
1
- import {
2
- COMMANDS_DIALOG,
3
- meta
4
- } from "./chunk-ZENLR72O.mjs";
5
-
6
- // src/capabilities/app-graph-builder.ts
7
- import { Rx } from "@effect-rx/rx-react";
8
- import * as Function from "effect/Function";
9
- import * as Option from "effect/Option";
10
- import { Capabilities, LayoutAction, contributes, createIntent } from "@dxos/app-framework";
11
- import { ROOT_ID, createExtension } from "@dxos/plugin-graph";
12
- var app_graph_builder_default = ((context) => contributes(Capabilities.AppGraphBuilder, createExtension({
13
- id: meta.id,
14
- actions: (node) => Rx.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.id === ROOT_ID ? Option.some(node2) : Option.none()), Option.map(() => [
15
- {
16
- id: COMMANDS_DIALOG,
17
- data: async () => {
18
- const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
19
- await dispatch(createIntent(LayoutAction.UpdateDialog, {
20
- part: "dialog",
21
- subject: COMMANDS_DIALOG,
22
- options: {
23
- blockAlign: "start"
24
- }
25
- }));
26
- },
27
- properties: {
28
- label: [
29
- "open commands label",
30
- {
31
- ns: meta.id
32
- }
33
- ],
34
- icon: "ph--magnifying-glass--regular",
35
- keyBinding: {
36
- macos: "meta+k",
37
- windows: "ctrl+k"
38
- }
39
- }
40
- }
41
- ]), Option.getOrElse(() => [])))
42
- })));
43
- export {
44
- app_graph_builder_default as default
45
- };
46
- //# sourceMappingURL=app-graph-builder-YAPMENYT.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/app-graph-builder.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Rx } from '@effect-rx/rx-react';\nimport * as Function from 'effect/Function';\nimport * as Option from 'effect/Option';\n\nimport { Capabilities, LayoutAction, type PluginContext, contributes, createIntent } from '@dxos/app-framework';\nimport { ROOT_ID, createExtension } from '@dxos/plugin-graph';\n\nimport { COMMANDS_DIALOG, meta } from '../meta';\n\nexport default (context: PluginContext) =>\n contributes(\n Capabilities.AppGraphBuilder,\n createExtension({\n id: meta.id,\n actions: (node) =>\n Rx.make((get) =>\n Function.pipe(\n get(node),\n Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),\n Option.map(() => [\n {\n id: COMMANDS_DIALOG,\n data: async () => {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n await dispatch(\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: COMMANDS_DIALOG,\n options: {\n blockAlign: 'start',\n },\n }),\n );\n },\n properties: {\n label: ['open commands label', { ns: meta.id }],\n icon: 'ph--magnifying-glass--regular',\n keyBinding: {\n macos: 'meta+k',\n windows: 'ctrl+k',\n },\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n );\n"],
5
- "mappings": ";;;;;;AAIA,SAASA,UAAU;AACnB,YAAYC,cAAc;AAC1B,YAAYC,YAAY;AAExB,SAASC,cAAcC,cAAkCC,aAAaC,oBAAoB;AAC1F,SAASC,SAASC,uBAAuB;AAIzC,IAAA,6BAAe,CAACC,YACdC,YACEC,aAAaC,iBACbC,gBAAgB;EACdC,IAAIC,KAAKD;EACTE,SAAS,CAACC,SACRC,GAAGC,KAAK,CAACC,QACEC,cACPD,IAAIH,IAAAA,GACGK,eAAQ,CAACL,UAAUA,MAAKH,OAAOS,UAAiBC,YAAKP,KAAAA,IAAeQ,YAAI,CAAA,GACxEC,WAAI,MAAM;IACf;MACEZ,IAAIa;MACJC,MAAM,YAAA;AACJ,cAAM,EAAEC,iBAAiBC,SAAQ,IAAKrB,QAAQsB,cAAcpB,aAAaqB,gBAAgB;AACzF,cAAMF,SACJG,aAAaC,aAAaC,cAAc;UACtCC,MAAM;UACNC,SAASV;UACTW,SAAS;YACPC,YAAY;UACd;QACF,CAAA,CAAA;MAEJ;MACAC,YAAY;QACVC,OAAO;UAAC;UAAuB;YAAEC,IAAI3B,KAAKD;UAAG;;QAC7C6B,MAAM;QACNC,YAAY;UACVC,OAAO;UACPC,SAAS;QACX;MACF;IACF;GACD,GACMC,iBAAU,MAAM,CAAA,CAAE,CAAA,CAAA;AAGjC,CAAA,CAAA;",
6
- "names": ["Rx", "Function", "Option", "Capabilities", "LayoutAction", "contributes", "createIntent", "ROOT_ID", "createExtension", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "meta", "actions", "node", "Rx", "make", "get", "pipe", "flatMap", "ROOT_ID", "some", "none", "map", "COMMANDS_DIALOG", "data", "dispatchPromise", "dispatch", "getCapability", "IntentDispatcher", "createIntent", "LayoutAction", "UpdateDialog", "part", "subject", "options", "blockAlign", "properties", "label", "ns", "icon", "keyBinding", "macos", "windows", "getOrElse"]
7
- }