@dxos/plugin-navtree 0.7.5-main.9d26e3a → 0.7.5-main.e9bb01b

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 (116) hide show
  1. package/dist/lib/browser/app-graph-builder-BL7LRXCM.mjs +44 -0
  2. package/dist/lib/browser/app-graph-builder-BL7LRXCM.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-AOAGODQB.mjs +15 -0
  4. package/dist/lib/browser/chunk-AOAGODQB.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-EO6JEADO.mjs +1113 -0
  6. package/dist/lib/browser/chunk-EO6JEADO.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-VAXG4OAG.mjs → chunk-KOXMEAOS.mjs} +3 -3
  8. package/dist/lib/browser/{chunk-VAXG4OAG.mjs.map → chunk-KOXMEAOS.mjs.map} +3 -3
  9. package/dist/lib/browser/index.mjs +108 -1199
  10. package/dist/lib/browser/index.mjs.map +4 -4
  11. package/dist/lib/browser/intent-resolver-U25VBFH3.mjs +47 -0
  12. package/dist/lib/browser/intent-resolver-U25VBFH3.mjs.map +7 -0
  13. package/dist/lib/browser/keyboard-MUBRTPI5.mjs +46 -0
  14. package/dist/lib/browser/keyboard-MUBRTPI5.mjs.map +7 -0
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/react-surface-6ZP5XUTS.mjs +57 -0
  17. package/dist/lib/browser/react-surface-6ZP5XUTS.mjs.map +7 -0
  18. package/dist/lib/browser/state-65TQKYX7.mjs +108 -0
  19. package/dist/lib/browser/state-65TQKYX7.mjs.map +7 -0
  20. package/dist/types/src/NavTreePlugin.d.ts +1 -3
  21. package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
  22. package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
  23. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  24. package/dist/types/src/capabilities/capabilities.d.ts +18 -0
  25. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  26. package/dist/types/src/capabilities/index.d.ts +251 -0
  27. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  28. package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
  29. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  30. package/dist/types/src/capabilities/keyboard.d.ts +4 -0
  31. package/dist/types/src/capabilities/keyboard.d.ts.map +1 -0
  32. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  33. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  34. package/dist/types/src/capabilities/state.d.ts +17 -0
  35. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  36. package/dist/types/src/components/CommandsDialog.d.ts.map +1 -1
  37. package/dist/types/src/components/CommandsTrigger.d.ts.map +1 -1
  38. package/dist/types/src/components/L0Menu.d.ts +9 -0
  39. package/dist/types/src/components/L0Menu.d.ts.map +1 -0
  40. package/dist/types/src/components/L1Panels.d.ts +8 -0
  41. package/dist/types/src/components/L1Panels.d.ts.map +1 -0
  42. package/dist/types/src/components/NavTree.d.ts +3 -22
  43. package/dist/types/src/components/NavTree.d.ts.map +1 -1
  44. package/dist/types/src/components/NavTree.stories.d.ts +2 -2
  45. package/dist/types/src/components/NavTree.stories.d.ts.map +1 -1
  46. package/dist/types/src/components/NavTreeContainer.d.ts +4 -3
  47. package/dist/types/src/components/NavTreeContainer.d.ts.map +1 -1
  48. package/dist/types/src/components/NavTreeContext.d.ts +4 -0
  49. package/dist/types/src/components/NavTreeContext.d.ts.map +1 -0
  50. package/dist/types/src/components/NavTreeItemAction.d.ts +4 -8
  51. package/dist/types/src/components/NavTreeItemAction.d.ts.map +1 -1
  52. package/dist/types/src/components/NavTreeItemAction.stories.d.ts +0 -5
  53. package/dist/types/src/components/NavTreeItemAction.stories.d.ts.map +1 -1
  54. package/dist/types/src/components/NavTreeItemColumns.d.ts +4 -0
  55. package/dist/types/src/components/NavTreeItemColumns.d.ts.map +1 -0
  56. package/dist/types/src/components/NotchStart.d.ts.map +1 -1
  57. package/dist/types/src/components/index.d.ts +3 -0
  58. package/dist/types/src/components/index.d.ts.map +1 -1
  59. package/dist/types/src/components/types.d.ts +25 -0
  60. package/dist/types/src/components/types.d.ts.map +1 -0
  61. package/dist/types/src/events.d.ts +4 -0
  62. package/dist/types/src/events.d.ts.map +1 -0
  63. package/dist/types/src/hooks.d.ts +3 -0
  64. package/dist/types/src/hooks.d.ts.map +1 -0
  65. package/dist/types/src/index.d.ts +3 -2
  66. package/dist/types/src/index.d.ts.map +1 -1
  67. package/dist/types/src/meta.d.ts +1 -2
  68. package/dist/types/src/meta.d.ts.map +1 -1
  69. package/dist/types/src/stories/Graph.stories.d.ts +2 -2
  70. package/dist/types/src/stories/Graph.stories.d.ts.map +1 -1
  71. package/dist/types/src/stories/StorybookNavTree.d.ts +4 -0
  72. package/dist/types/src/stories/StorybookNavTree.d.ts.map +1 -0
  73. package/dist/types/src/translations.d.ts +0 -7
  74. package/dist/types/src/translations.d.ts.map +1 -1
  75. package/dist/types/src/types.d.ts +3 -2
  76. package/dist/types/src/types.d.ts.map +1 -1
  77. package/dist/types/src/util.d.ts +9 -0
  78. package/dist/types/src/util.d.ts.map +1 -1
  79. package/dist/types/tsconfig.tsbuildinfo +1 -1
  80. package/package.json +34 -39
  81. package/src/NavTreePlugin.tsx +67 -291
  82. package/src/capabilities/app-graph-builder.ts +42 -0
  83. package/src/capabilities/capabilities.ts +19 -0
  84. package/src/capabilities/index.ts +13 -0
  85. package/src/capabilities/intent-resolver.ts +36 -0
  86. package/src/capabilities/keyboard.ts +54 -0
  87. package/src/capabilities/react-surface.tsx +56 -0
  88. package/src/capabilities/state.ts +97 -0
  89. package/src/components/CommandsDialog.tsx +3 -4
  90. package/src/components/CommandsTrigger.tsx +7 -5
  91. package/src/components/L0Menu.tsx +208 -0
  92. package/src/components/L1Panels.tsx +100 -0
  93. package/src/components/NavTree.stories.tsx +5 -5
  94. package/src/components/NavTree.tsx +26 -124
  95. package/src/components/NavTreeContainer.tsx +106 -44
  96. package/src/components/NavTreeContext.tsx +13 -0
  97. package/src/components/NavTreeItemAction.stories.tsx +0 -2
  98. package/src/components/NavTreeItemAction.tsx +58 -316
  99. package/src/components/NavTreeItemColumns.tsx +71 -0
  100. package/src/components/NotchStart.tsx +6 -5
  101. package/src/components/index.ts +3 -0
  102. package/src/components/types.ts +33 -0
  103. package/src/events.ts +11 -0
  104. package/src/hooks.ts +21 -0
  105. package/src/index.ts +3 -4
  106. package/src/meta.ts +1 -1
  107. package/src/stories/Graph.stories.tsx +5 -4
  108. package/src/stories/StorybookNavTree.tsx +63 -0
  109. package/src/translations.ts +0 -7
  110. package/src/types.ts +3 -2
  111. package/src/util.ts +54 -0
  112. package/dist/lib/browser/meta.mjs +0 -13
  113. package/dist/lib/browser/meta.mjs.map +0 -7
  114. package/dist/types/src/components/NavTreeFooter.d.ts +0 -6
  115. package/dist/types/src/components/NavTreeFooter.d.ts.map +0 -1
  116. package/src/components/NavTreeFooter.tsx +0 -159
@@ -1,7 +1,7 @@
1
1
  import '@dxos-theme';
2
2
  import { type Meta } from '@storybook/react';
3
- import { NavTree } from '../components';
3
+ import { StorybookNavTree } from './StorybookNavTree';
4
4
  export declare const Default: {};
5
- declare const meta: Meta<typeof NavTree>;
5
+ declare const meta: Meta<typeof StorybookNavTree>;
6
6
  export default meta;
7
7
  //# sourceMappingURL=Graph.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Graph.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/Graph.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAKrB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAW7C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAiCxC,eAAO,MAAM,OAAO,IAAK,CAAC;AAE1B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,OAAO,CAuE9B,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Graph.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/Graph.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAKrB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAW7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAiCtD,eAAO,MAAM,OAAO,IAAK,CAAC;AAE1B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CAwEvC,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { type NavTreeContextValue, type NavTreeProps } from '../components';
3
+ export declare const StorybookNavTree: ({ getActions, loadDescendents, renderItemEnd, popoverAnchorId, getItems, getProps, isCurrent, canDrop, onSelect, isOpen, onOpenChange, ...props }: NavTreeProps & NavTreeContextValue) => React.JSX.Element;
4
+ //# sourceMappingURL=StorybookNavTree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorybookNavTree.d.ts","sourceRoot":"","sources":["../../../../src/stories/StorybookNavTree.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAEjD,OAAO,EAA2B,KAAK,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAGrG,eAAO,MAAM,gBAAgB,sJAa1B,YAAY,GAAG,mBAAmB,sBAwCpC,CAAC"}
@@ -6,14 +6,7 @@ declare const _default: {
6
6
  'commands dialog title': string;
7
7
  'command list input placeholder': string;
8
8
  'node actions menu invoker label': string;
9
- 'warning title': string;
10
- 'technology preview message': string;
11
- 'learn more label': string;
12
- 'released message': string;
13
- 'see release label': string;
14
- 'powered by dxos message': string;
15
9
  'tree item actions label': string;
16
- 'tree item searchlist input placeholder': string;
17
10
  'empty branch message': string;
18
11
  };
19
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAMA,wBAqBE"}
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAMA,wBAcE"}
@@ -1,6 +1,6 @@
1
1
  import { type Action, type ActionLike, type Node } from '@dxos/app-graph';
2
2
  import { type Label } from '@dxos/react-ui';
3
- import { type MaybePromise } from '@dxos/util';
3
+ import { type MaybePromise, type Position } from '@dxos/util';
4
4
  export type NavTreeItemGraphNode = Node<any, Partial<NodeProperties & {
5
5
  persistenceClass: string;
6
6
  persistenceKey: string;
@@ -19,6 +19,7 @@ type SharedProperties = {
19
19
  label: Label;
20
20
  icon?: string;
21
21
  disabled?: boolean;
22
+ position?: Position;
22
23
  testId?: string;
23
24
  className?: string;
24
25
  headingClassName?: string;
@@ -33,7 +34,7 @@ export type ActionProperties = SharedProperties & {
33
34
  disposition?: string;
34
35
  hidden?: boolean;
35
36
  caller?: string;
36
- menuType?: 'searchList' | 'dropdown';
37
+ menuType?: 'dropdown';
37
38
  keyBinding?: string | KeyBinding;
38
39
  };
39
40
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,GAAG,EACH,OAAO,CACL,cAAc,GAAG;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,sBAAsB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACpC,oBAAoB,EAAE,GAAG,CAAC,MAA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ph: Graph, node: Node) => FlattenedActions;
9
9
  export declare const expandChildrenAndActions: (graph: Graph, node: Node) => Promise<[void, [void, void]]>;
10
10
  export declare const expandChildren: (graph: Graph, node: Node) => Promise<void>;
11
11
  export declare const expandActions: (graph: Graph, node: Node) => Promise<[void, void]>;
12
+ export declare const l0ItemType: (item: Node<any>) => "collection" | "action" | "link" | "tab";
13
+ /**
14
+ * Returns the first two renderable characters from a string that are separated by non-word characters.
15
+ * Handles Unicode characters correctly.
16
+ *
17
+ * @param {string} label - The input string to process
18
+ * @returns {[string, string]} Array containing the two characters, or empty strings if not found
19
+ */
20
+ export declare const getFirstTwoRenderableChars: (label: string) => string[];
12
21
  //# sourceMappingURL=util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,KAAK,EAIX,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE3E,eAAO,MAAM,SAAS,UACb,KAAK,QACN,oBAAoB,QACpB,MAAM,EAAE,KACb,oBAAoB,GAAG,SAGzB,CAAC;AAEF,eAAO,MAAM,oBAAoB,UACxB,KAAK,QACN,oBAAoB,QACpB,MAAM,EAAE,oBACI,MAAM,KACvB,oBAAoB,GAAG,IAOzB,CAAC;AAEF,eAAO,MAAM,yBAAyB,UAC7B,KAAK,cACA,oBAAoB,mBACf,MAAM,EAAE,2BACA,oBAAoB,KAC5C,UAAU,GAAG,MAAM,GAAG,QAsBxB,CAAC;AAGF,eAAO,MAAM,WAAW,YAAa,MAAM,EAAE,KAAG,MAAM,EAWlD,CAAC;AAEL,eAAO,MAAM,WAAW,UACf,KAAK,QACN,oBAAoB,WACjB,UAAU,SACb,SAAS,MAAM,EAAE,KACtB,oBAAoB,EAStB,CAAC;A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D,CAAC;AAEF,eAAO,MAAM,aAAa,UAAW,KAAK,QAAQ,IAAI,0BAErD,CAAC;AAEF,eAAO,MAAM,UAAU,SAAU,IAAI,CAAC,GAAG,CAAC,6CAUzC,CAAC;AAOF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,UAAW,MAAM,aA2BvD,CAAC"}
@@ -1 +1 @@
1
- {"version":"5.7.2"}
1
+ {"version":"5.7.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-navtree",
3
- "version": "0.7.5-main.9d26e3a",
3
+ "version": "0.7.5-main.e9bb01b",
4
4
  "description": "DXOS Surface plugin for a tree view visualization of the graph.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -11,19 +11,11 @@
11
11
  ".": {
12
12
  "types": "./dist/types/src/index.d.ts",
13
13
  "browser": "./dist/lib/browser/index.mjs"
14
- },
15
- "./meta": {
16
- "types": "./dist/types/src/meta.d.ts",
17
- "browser": "./dist/lib/browser/meta.mjs"
18
14
  }
19
15
  },
20
16
  "types": "dist/types/src/index.d.ts",
21
17
  "typesVersions": {
22
- "*": {
23
- "meta": [
24
- "dist/types/src/meta.d.ts"
25
- ]
26
- }
18
+ "*": {}
27
19
  },
28
20
  "files": [
29
21
  "dist",
@@ -33,29 +25,32 @@
33
25
  "@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
34
26
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
35
27
  "@preact/signals-core": "^1.6.0",
36
- "@radix-ui/react-use-controllable-state": "^1.0.0",
28
+ "@radix-ui/react-dismissable-layer": "1.1.5",
29
+ "@radix-ui/react-use-controllable-state": "1.1.0",
37
30
  "date-fns": "^3.3.1",
38
- "@dxos/app-framework": "0.7.5-main.9d26e3a",
39
- "@dxos/app-graph": "0.7.5-main.9d26e3a",
40
- "@dxos/debug": "0.7.5-main.9d26e3a",
41
- "@dxos/async": "0.7.5-main.9d26e3a",
42
- "@dxos/echo-schema": "0.7.5-main.9d26e3a",
43
- "@dxos/invariant": "0.7.5-main.9d26e3a",
44
- "@dxos/keyboard": "0.7.5-main.9d26e3a",
45
- "@dxos/live-object": "0.7.5-main.9d26e3a",
46
- "@dxos/local-storage": "0.7.5-main.9d26e3a",
47
- "@dxos/log": "0.7.5-main.9d26e3a",
48
- "@dxos/plugin-graph": "0.7.5-main.9d26e3a",
49
- "@dxos/plugin-client": "0.7.5-main.9d26e3a",
50
- "@dxos/plugin-observability": "0.7.5-main.9d26e3a",
51
- "@dxos/plugin-theme": "0.7.5-main.9d26e3a",
52
- "@dxos/protocols": "0.7.5-main.9d26e3a",
53
- "@dxos/react-client": "0.7.5-main.9d26e3a",
54
- "@dxos/react-ui-mosaic": "0.7.5-main.9d26e3a",
55
- "@dxos/react-ui-list": "0.7.5-main.9d26e3a",
56
- "@dxos/react-ui-searchlist": "0.7.5-main.9d26e3a",
57
- "@dxos/util": "0.7.5-main.9d26e3a",
58
- "@dxos/react-ui-stack": "0.7.5-main.9d26e3a"
31
+ "@dxos/app-framework": "0.7.5-main.e9bb01b",
32
+ "@dxos/app-graph": "0.7.5-main.e9bb01b",
33
+ "@dxos/async": "0.7.5-main.e9bb01b",
34
+ "@dxos/echo-schema": "0.7.5-main.e9bb01b",
35
+ "@dxos/invariant": "0.7.5-main.e9bb01b",
36
+ "@dxos/debug": "0.7.5-main.e9bb01b",
37
+ "@dxos/keyboard": "0.7.5-main.e9bb01b",
38
+ "@dxos/local-storage": "0.7.5-main.e9bb01b",
39
+ "@dxos/log": "0.7.5-main.e9bb01b",
40
+ "@dxos/plugin-client": "0.7.5-main.e9bb01b",
41
+ "@dxos/live-object": "0.7.5-main.e9bb01b",
42
+ "@dxos/plugin-graph": "0.7.5-main.e9bb01b",
43
+ "@dxos/plugin-observability": "0.7.5-main.e9bb01b",
44
+ "@dxos/plugin-theme": "0.7.5-main.e9bb01b",
45
+ "@dxos/protocols": "0.7.5-main.e9bb01b",
46
+ "@dxos/react-client": "0.7.5-main.e9bb01b",
47
+ "@dxos/react-ui-list": "0.7.5-main.e9bb01b",
48
+ "@dxos/react-ui-menu": "0.7.5-main.e9bb01b",
49
+ "@dxos/react-ui-mosaic": "0.7.5-main.e9bb01b",
50
+ "@dxos/react-ui-searchlist": "0.7.5-main.e9bb01b",
51
+ "@dxos/react-ui-stack": "0.7.5-main.e9bb01b",
52
+ "@dxos/react-ui-tabs": "0.7.5-main.e9bb01b",
53
+ "@dxos/util": "0.7.5-main.e9bb01b"
59
54
  },
60
55
  "devDependencies": {
61
56
  "@phosphor-icons/react": "^2.1.5",
@@ -64,18 +59,18 @@
64
59
  "react": "~18.2.0",
65
60
  "react-dom": "~18.2.0",
66
61
  "vite": "5.4.7",
67
- "@dxos/echo-signals": "0.7.5-main.9d26e3a",
68
- "@dxos/random": "0.7.5-main.9d26e3a",
69
- "@dxos/react-ui": "0.7.5-main.9d26e3a",
70
- "@dxos/react-ui-theme": "0.7.5-main.9d26e3a",
71
- "@dxos/storybook-utils": "0.7.5-main.9d26e3a"
62
+ "@dxos/echo-signals": "0.7.5-main.e9bb01b",
63
+ "@dxos/random": "0.7.5-main.e9bb01b",
64
+ "@dxos/react-ui": "0.7.5-main.e9bb01b",
65
+ "@dxos/react-ui-theme": "0.7.5-main.e9bb01b",
66
+ "@dxos/storybook-utils": "0.7.5-main.e9bb01b"
72
67
  },
73
68
  "peerDependencies": {
74
69
  "@phosphor-icons/react": "^2.1.5",
75
70
  "react": "~18.2.0",
76
71
  "react-dom": "~18.2.0",
77
- "@dxos/react-ui": "0.7.5-main.9d26e3a",
78
- "@dxos/react-ui-theme": "0.7.5-main.9d26e3a"
72
+ "@dxos/react-ui-theme": "0.7.5-main.e9bb01b",
73
+ "@dxos/react-ui": "0.7.5-main.e9bb01b"
79
74
  },
80
75
  "publishConfig": {
81
76
  "access": "public"
@@ -1,206 +1,45 @@
1
1
  //
2
- // Copyright 2023 DXOS.org
2
+ // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { effect } from '@preact/signals-core';
6
- import React from 'react';
7
-
8
5
  import {
6
+ definePlugin,
7
+ defineModule,
8
+ Events,
9
+ contributes,
10
+ Capabilities,
11
+ allOf,
9
12
  createIntent,
10
- createResolver,
11
- createSurface,
12
- type GraphBuilderProvides,
13
- type GraphProvides,
14
- type IntentResolverProvides,
15
13
  LayoutAction,
16
- type MetadataRecordsProvides,
17
- NavigationAction,
18
- parseGraphPlugin,
19
- parseIntentPlugin,
20
- parseLayoutPlugin,
21
- parseNavigationPlugin,
22
- type Plugin,
23
- type PluginDefinition,
24
- resolvePlugin,
25
- type SurfaceProvides,
26
- type TranslationsProvides,
27
14
  } from '@dxos/app-framework';
28
- import { createExtension, type Graph, isAction, isGraphNode, type Node } from '@dxos/app-graph';
29
- import { type UnsubscribeCallback } from '@dxos/async';
30
- import { Keyboard } from '@dxos/keyboard';
31
- import { create, type ReactiveObject } from '@dxos/live-object';
32
15
  import { type TreeData } from '@dxos/react-ui-list';
33
- import { Path } from '@dxos/react-ui-mosaic';
34
- import { getHostPlatform } from '@dxos/util';
35
16
 
36
- import { CommandsDialogContent, NavTreeContainer, NavTreeDocumentTitle, NODE_TYPE, NotchStart } from './components';
37
- import { CommandsTrigger } from './components/CommandsTrigger';
38
- import meta, { COMMANDS_DIALOG, KEY_BINDING, NAVTREE_PLUGIN } from './meta';
17
+ import { AppGraphBuilder, IntentResolver, Keyboard, ReactSurface, State } from './capabilities';
18
+ import { NODE_TYPE } from './components';
19
+ import { NavTreeEvents } from './events';
20
+ import { meta } from './meta';
39
21
  import translations from './translations';
40
- import { type NavTreeItemGraphNode } from './types';
41
- import { expandChildrenAndActions } from './util';
42
-
43
- export type NavTreePluginProvides = SurfaceProvides &
44
- MetadataRecordsProvides &
45
- GraphBuilderProvides &
46
- TranslationsProvides &
47
- IntentResolverProvides;
48
-
49
- const KEY = `${NAVTREE_PLUGIN}/state`;
50
- const getInitialState = () => {
51
- const stringified = localStorage.getItem(KEY);
52
- if (!stringified) {
53
- return;
54
- }
55
-
56
- try {
57
- const cached: [string, { open: boolean; current: boolean }][] = JSON.parse(stringified);
58
- return cached.map(
59
- ([key, value]): [
60
- string,
61
- ReactiveObject<{
62
- open: boolean;
63
- current: boolean;
64
- }>,
65
- ] => [key, create({ open: value.open, current: false })],
66
- );
67
- } catch {}
68
- };
69
-
70
- export const NavTreePlugin = (): PluginDefinition<NavTreePluginProvides> => {
71
- let graphPlugin: Plugin<GraphProvides> | undefined;
72
- let graph: Graph | undefined;
73
- let unsubscribe: UnsubscribeCallback | undefined;
74
-
75
- // TODO(wittjosiah): This currently needs to be not a ReactiveObject at the root.
76
- // If it is a ReactiveObject then React errors when initializing new paths because of state change during render.
77
- // Ideally this could be a ReactiveObject but be able to access and update the root level without breaking render.
78
- // Wrapping accesses and updates in `untracked` didn't seem to work in all cases.
79
- const state = new Map<string, ReactiveObject<{ open: boolean; current: boolean }>>(
80
- getInitialState() ?? [
81
- // TODO(thure): Initialize these dynamically.
82
- ['root', create({ open: true, current: false })],
83
- ['root~dxos.org/plugin/space-spaces', create({ open: true, current: false })],
84
- ['root~dxos.org/plugin/files', create({ open: true, current: false })],
85
- ],
86
- );
87
-
88
- const getItem = (_path: string[]) => {
89
- const path = Path.create(..._path);
90
- const value = state.get(path) ?? create({ open: false, current: false });
91
- if (!state.has(path)) {
92
- state.set(path, value);
93
- }
94
-
95
- return value;
96
- };
97
-
98
- const setItem = (path: string[], key: 'open' | 'current', next: boolean) => {
99
- const value = getItem(path);
100
- value[key] = next;
101
-
102
- localStorage.setItem(KEY, JSON.stringify(Array.from(state.entries())));
103
- };
104
-
105
- const isOpen = (path: string[]) => getItem(path).open;
106
- const isCurrent = (path: string[]) => getItem(path).current;
107
-
108
- const handleOpenChange = ({ item: { id }, path, open }: { item: Node; path: string[]; open: boolean }) => {
109
- // TODO(thure): This might become a localstorage leak; openItemIds that no longer exist should be removed from this map.
110
- setItem(path, 'open', open);
111
-
112
- if (graph) {
113
- const node = graph.findNode(id);
114
- return node && expandChildrenAndActions(graph, node as NavTreeItemGraphNode);
115
- }
116
- };
117
22
 
118
- return {
119
- meta,
120
- ready: async ({ plugins }) => {
121
- const layout = resolvePlugin(plugins, parseLayoutPlugin)?.provides.layout;
122
- const location = resolvePlugin(plugins, parseNavigationPlugin)?.provides.location;
123
- graphPlugin = resolvePlugin(plugins, parseGraphPlugin);
124
- graph = graphPlugin?.provides.graph;
125
- if (!graph || !location || !layout) {
126
- return;
127
- }
128
-
129
- const soloPart = location?.active.solo?.[0];
130
- const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatchPromise;
131
- if (dispatch && soloPart) {
132
- void dispatch(createIntent(NavigationAction.Expose, { id: soloPart.id }));
133
- }
134
-
135
- let previous: string[] = [];
136
- unsubscribe = effect(() => {
137
- const part = layout.layoutMode === 'solo' ? 'solo' : 'main';
138
- const current = location.active[part]?.map(({ id }) => id) ?? [];
139
- const removed = previous.filter((id) => !current.includes(id));
140
- previous = current;
141
-
142
- // TODO(wittjosiah): This is setTimeout because there's a race between the keys be initialized.
143
- // This could be avoided if the location was a path as well and not just an id.
144
- setTimeout(() => {
145
- removed.forEach((id) => {
146
- const keys = Array.from(state.keys()).filter((key) => Path.last(key) === id);
147
- keys.forEach((key) => {
148
- setItem(Path.parts(key), 'current', false);
149
- });
150
- });
151
-
152
- current.forEach((id) => {
153
- const keys = Array.from(new Set([...state.keys(), id])).filter((key) => Path.last(key) === id);
154
- keys.forEach((key) => {
155
- setItem(Path.parts(key), 'current', true);
156
- });
157
- });
158
- });
159
- });
160
-
161
- // TODO(wittjosiah): Factor out.
162
- // TODO(wittjosiah): Handle removal of actions.
163
- graph.subscribeTraverse({
164
- visitor: (node, path) => {
165
- let shortcut: string | undefined;
166
- if (typeof node.properties.keyBinding === 'object') {
167
- const availablePlatforms = Object.keys(node.properties.keyBinding);
168
- const platform = getHostPlatform();
169
- shortcut = availablePlatforms.includes(platform)
170
- ? node.properties.keyBinding[platform]
171
- : platform === 'ios'
172
- ? node.properties.keyBinding.macos // Fallback to macos if ios-specific bindings not provided.
173
- : platform === 'linux' || platform === 'unknown'
174
- ? node.properties.keyBinding.windows // Fallback to windows if platform-specific bindings not provided.
175
- : undefined;
176
- } else {
177
- shortcut = node.properties.keyBinding;
178
- }
179
-
180
- if (shortcut && isAction(node)) {
181
- Keyboard.singleton.getContext(path.slice(0, -1).join('/')).bind({
182
- shortcut,
183
- handler: () => {
184
- void node.data({ node, caller: KEY_BINDING });
185
- },
186
- data: node.properties.label,
187
- });
188
- }
189
- },
190
- });
191
-
192
- // TODO(burdon): Create context and plugin.
193
- Keyboard.singleton.initialize();
194
- Keyboard.singleton.setCurrentContext(graphPlugin?.provides.graph.root.id);
195
- },
196
- unload: async () => {
197
- unsubscribe?.();
198
- Keyboard.singleton.destroy();
199
- },
200
- provides: {
201
- metadata: {
202
- records: {
203
- [NODE_TYPE]: {
23
+ export const NavTreePlugin = () =>
24
+ definePlugin(meta, [
25
+ defineModule({
26
+ id: `${meta.id}/module/state`,
27
+ activatesOn: Events.LayoutReady,
28
+ activatesAfter: [NavTreeEvents.StateReady],
29
+ activate: State,
30
+ }),
31
+ defineModule({
32
+ id: `${meta.id}/module/translations`,
33
+ activatesOn: Events.SetupTranslations,
34
+ activate: () => contributes(Capabilities.Translations, translations),
35
+ }),
36
+ defineModule({
37
+ id: `${meta.id}/module/metadata`,
38
+ activatesOn: Events.SetupMetadata,
39
+ activate: () =>
40
+ contributes(Capabilities.Metadata, {
41
+ id: NODE_TYPE,
42
+ metadata: {
204
43
  parse: ({ item }: TreeData, type: string) => {
205
44
  switch (type) {
206
45
  case 'node':
@@ -212,103 +51,40 @@ export const NavTreePlugin = (): PluginDefinition<NavTreePluginProvides> => {
212
51
  }
213
52
  },
214
53
  },
215
- },
216
- },
217
- surface: {
218
- definitions: () => [
219
- createSurface({
220
- id: COMMANDS_DIALOG,
221
- role: 'dialog',
222
- filter: (data): data is { subject?: string } => data.component === COMMANDS_DIALOG,
223
- component: ({ data }) => <CommandsDialogContent selected={data.subject} />,
224
- }),
225
- createSurface({
226
- id: `${NAVTREE_PLUGIN}/navigation`,
227
- role: 'navigation',
228
- component: ({ data }) => (
229
- <NavTreeContainer
230
- isOpen={isOpen}
231
- isCurrent={isCurrent}
232
- onOpenChange={handleOpenChange}
233
- popoverAnchorId={data.popoverAnchorId as string | undefined}
234
- />
235
- ),
236
- }),
237
- createSurface({
238
- id: `${NAVTREE_PLUGIN}/document-title`,
239
- role: 'document-title',
240
- component: ({ data }) => (
241
- <NavTreeDocumentTitle node={isGraphNode(data.subject) ? data.subject : undefined} />
242
- ),
243
- }),
244
- createSurface({
245
- id: `${NAVTREE_PLUGIN}/notch-start`,
246
- role: 'notch-start',
247
- component: () => <NotchStart />,
248
- }),
249
- createSurface({
250
- id: `${NAVTREE_PLUGIN}/search-input`,
251
- role: 'search-input',
252
- disposition: 'fallback',
253
- component: () => <CommandsTrigger />,
254
- }),
255
- ],
256
- },
257
- intent: {
258
- resolvers: ({ plugins }) => {
259
- const graph = resolvePlugin(plugins, parseGraphPlugin)?.provides.graph;
260
- if (!graph) {
261
- return [];
262
- }
263
-
264
- return createResolver(NavigationAction.Expose, async ({ id }) => {
265
- const path = await graph.waitForPath({ target: id });
266
- [...Array(path.length)].forEach((_, index) => {
267
- const subpath = path.slice(0, index);
268
- const value = getItem(subpath);
269
- if (!value.open) {
270
- setItem(subpath, 'open', true);
271
- }
272
- });
273
- });
274
- },
275
- },
276
- graph: {
277
- builder: (plugins) => {
278
- // TODO(burdon): Move to separate plugin (for keys and command k). Move bindings from LayoutPlugin.
279
- const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatchPromise;
280
-
281
- return [
282
- createExtension({
283
- id: NAVTREE_PLUGIN,
284
- filter: (node): node is Node<null> => node.id === 'root',
285
- actions: () => [
286
- {
287
- id: COMMANDS_DIALOG,
288
- data: async () => {
289
- await dispatch?.(
290
- createIntent(LayoutAction.SetLayout, {
291
- element: 'dialog',
292
- component: COMMANDS_DIALOG,
293
- dialogBlockAlign: 'start',
294
- }),
295
- );
296
- },
297
- properties: {
298
- label: ['open commands label', { ns: NAVTREE_PLUGIN }],
299
- icon: 'ph--magnifying-glass--regular',
300
- keyBinding: {
301
- macos: 'meta+k',
302
- windows: 'ctrl+k',
303
- },
304
- },
305
- },
306
- ],
307
- }),
308
- ];
309
- },
54
+ }),
55
+ }),
56
+ defineModule({
57
+ id: `${meta.id}/module/expose`,
58
+ activatesOn: allOf(Events.DispatcherReady, Events.LayoutReady, NavTreeEvents.StateReady),
59
+ activate: async (context) => {
60
+ const layout = context.requestCapability(Capabilities.Layout);
61
+ const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
62
+
63
+ if (dispatch && layout.active.length === 1) {
64
+ await dispatch(createIntent(LayoutAction.Expose, { part: 'navigation', subject: layout.active[0] }));
65
+ }
66
+
67
+ return [];
310
68
  },
311
- translations,
312
- },
313
- };
314
- };
69
+ }),
70
+ defineModule({
71
+ id: `${meta.id}/module/keyboard`,
72
+ activatesOn: Events.AppGraphReady,
73
+ activate: Keyboard,
74
+ }),
75
+ defineModule({
76
+ id: `${meta.id}/module/react-surface`,
77
+ activatesOn: Events.SetupSurfaces,
78
+ activate: ReactSurface,
79
+ }),
80
+ defineModule({
81
+ id: `${meta.id}/module/intent-resolver`,
82
+ activatesOn: Events.SetupIntents,
83
+ activate: IntentResolver,
84
+ }),
85
+ defineModule({
86
+ id: `${meta.id}/module/app-graph-builder`,
87
+ activatesOn: Events.SetupAppGraph,
88
+ activate: AppGraphBuilder,
89
+ }),
90
+ ]);
@@ -0,0 +1,42 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capabilities, contributes, type PluginsContext, createIntent, LayoutAction } from '@dxos/app-framework';
6
+ import { createExtension, type Node } from '@dxos/plugin-graph';
7
+
8
+ import { COMMANDS_DIALOG, NAVTREE_PLUGIN } from '../meta';
9
+
10
+ export default (context: PluginsContext) =>
11
+ contributes(
12
+ Capabilities.AppGraphBuilder,
13
+ createExtension({
14
+ id: NAVTREE_PLUGIN,
15
+ filter: (node): node is Node<null> => node.id === 'root',
16
+ actions: () => [
17
+ {
18
+ id: COMMANDS_DIALOG,
19
+ data: async () => {
20
+ const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
21
+ await dispatch(
22
+ createIntent(LayoutAction.UpdateDialog, {
23
+ part: 'dialog',
24
+ subject: COMMANDS_DIALOG,
25
+ options: {
26
+ blockAlign: 'start',
27
+ },
28
+ }),
29
+ );
30
+ },
31
+ properties: {
32
+ label: ['open commands label', { ns: NAVTREE_PLUGIN }],
33
+ icon: 'ph--magnifying-glass--regular',
34
+ keyBinding: {
35
+ macos: 'meta+k',
36
+ windows: 'ctrl+k',
37
+ },
38
+ },
39
+ },
40
+ ],
41
+ }),
42
+ );
@@ -0,0 +1,19 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { defineCapability } from '@dxos/app-framework';
6
+ import { type ReactiveObject } from '@dxos/live-object';
7
+
8
+ import { NAVTREE_PLUGIN } from '../meta';
9
+ import { type NavTreeItemGraphNode } from '../types';
10
+
11
+ export namespace NavTreeCapabilities {
12
+ export const State = defineCapability<{
13
+ state: Map<string, ReactiveObject<{ open: boolean; current: boolean }>>;
14
+ getItem: (path: string[]) => ReactiveObject<{ open: boolean; current: boolean }>;
15
+ setItem: (path: string[], key: 'open' | 'current', next: boolean) => void;
16
+ isOpen: (path: string[], item: NavTreeItemGraphNode) => boolean;
17
+ isCurrent: (path: string[], item: NavTreeItemGraphNode) => boolean;
18
+ }>(`${NAVTREE_PLUGIN}/capability/state`);
19
+ }