@dxos/plugin-stack 0.8.4-main.c85a9c8dae → 0.8.4-main.d9fc60f731

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 (127) hide show
  1. package/LICENSE +102 -5
  2. package/PLUGIN.mdl +326 -0
  3. package/README.md +1 -1
  4. package/dist/lib/neutral/StackArticle-M7AYNDZN.mjs +125 -0
  5. package/dist/lib/neutral/StackArticle-M7AYNDZN.mjs.map +7 -0
  6. package/dist/lib/neutral/StackPlugin.mjs +34 -0
  7. package/dist/lib/neutral/StackPlugin.mjs.map +7 -0
  8. package/dist/lib/neutral/capabilities/index.mjs +7 -0
  9. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  10. package/dist/lib/neutral/chunk-RGJSGQGF.mjs +36 -0
  11. package/dist/lib/neutral/chunk-RGJSGQGF.mjs.map +7 -0
  12. package/dist/lib/{browser/chunk-CD32XYEB.mjs → neutral/chunk-T4NSFSPH.mjs} +3 -6
  13. package/dist/lib/neutral/chunk-T4NSFSPH.mjs.map +7 -0
  14. package/dist/lib/neutral/components/index.mjs +182 -0
  15. package/dist/lib/neutral/components/index.mjs.map +7 -0
  16. package/dist/lib/neutral/containers/index.mjs +7 -0
  17. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  18. package/dist/lib/neutral/index.mjs +15 -0
  19. package/dist/lib/neutral/meta.json +1 -0
  20. package/dist/lib/neutral/meta.mjs +9 -0
  21. package/dist/lib/neutral/plugin.mjs +11 -0
  22. package/dist/lib/neutral/plugin.mjs.map +7 -0
  23. package/dist/lib/neutral/react-surface-MD3CVY2N.mjs +23 -0
  24. package/dist/lib/neutral/react-surface-MD3CVY2N.mjs.map +7 -0
  25. package/dist/lib/neutral/translations.mjs +37 -0
  26. package/dist/lib/neutral/translations.mjs.map +7 -0
  27. package/dist/lib/{browser → neutral}/types/index.mjs +1 -1
  28. package/dist/lib/neutral/types/index.mjs.map +7 -0
  29. package/dist/types/src/StackPlugin.d.ts +1 -0
  30. package/dist/types/src/StackPlugin.d.ts.map +1 -1
  31. package/dist/types/src/capabilities/index.d.ts +2 -1
  32. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  33. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  34. package/dist/types/src/components/{StackContext.d.ts → StackContext/StackContext.d.ts} +2 -1
  35. package/dist/types/src/components/StackContext/StackContext.d.ts.map +1 -0
  36. package/dist/types/src/components/StackContext/index.d.ts +2 -0
  37. package/dist/types/src/components/StackContext/index.d.ts.map +1 -0
  38. package/dist/types/src/components/{CaretDownUp.d.ts → StackSection/CaretDownUp.d.ts} +1 -1
  39. package/dist/types/src/components/StackSection/CaretDownUp.d.ts.map +1 -0
  40. package/dist/types/src/components/{StackSection.d.ts → StackSection/StackSection.d.ts} +1 -1
  41. package/dist/types/src/components/StackSection/StackSection.d.ts.map +1 -0
  42. package/dist/types/src/components/StackSection/index.d.ts +2 -0
  43. package/dist/types/src/components/StackSection/index.d.ts.map +1 -0
  44. package/dist/types/src/components/{StackSettings.d.ts → StackSettings/StackSettings.d.ts} +1 -1
  45. package/dist/types/src/components/StackSettings/StackSettings.d.ts.map +1 -0
  46. package/dist/types/src/components/StackSettings/index.d.ts +2 -0
  47. package/dist/types/src/components/StackSettings/index.d.ts.map +1 -0
  48. package/dist/types/src/containers/StackArticle/StackArticle.d.ts +7 -0
  49. package/dist/types/src/containers/StackArticle/StackArticle.d.ts.map +1 -0
  50. package/dist/types/src/containers/StackArticle/index.d.ts +2 -0
  51. package/dist/types/src/containers/StackArticle/index.d.ts.map +1 -0
  52. package/dist/types/src/containers/index.d.ts +1 -1
  53. package/dist/types/src/containers/index.d.ts.map +1 -1
  54. package/dist/types/src/index.d.ts +1 -1
  55. package/dist/types/src/index.d.ts.map +1 -1
  56. package/dist/types/src/meta.d.ts +3 -2
  57. package/dist/types/src/meta.d.ts.map +1 -1
  58. package/dist/types/src/plugin.d.ts +3 -0
  59. package/dist/types/src/plugin.d.ts.map +1 -0
  60. package/dist/types/src/translations.d.ts +30 -30
  61. package/dist/types/src/translations.d.ts.map +1 -1
  62. package/dist/types/src/types/stack.d.ts +1 -2
  63. package/dist/types/src/types/stack.d.ts.map +1 -1
  64. package/dist/types/src/types/types.d.ts +1 -2
  65. package/dist/types/src/types/types.d.ts.map +1 -1
  66. package/dist/types/tsconfig.tsbuildinfo +1 -1
  67. package/package.json +76 -48
  68. package/src/StackPlugin.ts +12 -22
  69. package/src/capabilities/index.ts +3 -1
  70. package/src/capabilities/react-surface.tsx +28 -0
  71. package/src/components/{StackContext.tsx → StackContext/StackContext.tsx} +3 -1
  72. package/src/components/StackContext/index.ts +5 -0
  73. package/src/components/{StackSection.tsx → StackSection/StackSection.tsx} +24 -21
  74. package/src/components/StackSection/index.ts +5 -0
  75. package/src/components/StackSettings/StackSettings.tsx +28 -0
  76. package/src/components/StackSettings/index.ts +5 -0
  77. package/src/containers/{StackContainer/StackContainer.tsx → StackArticle/StackArticle.tsx} +38 -42
  78. package/src/containers/StackArticle/index.ts +5 -0
  79. package/src/containers/index.ts +1 -1
  80. package/src/index.ts +1 -1
  81. package/src/meta.ts +21 -7
  82. package/src/plugin.ts +9 -0
  83. package/src/translations.ts +23 -22
  84. package/src/types/stack.ts +3 -8
  85. package/src/types/types.ts +1 -2
  86. package/src/vite-env.d.ts +10 -0
  87. package/dist/lib/browser/StackContainer-BIFUBD3Y.mjs +0 -289
  88. package/dist/lib/browser/StackContainer-BIFUBD3Y.mjs.map +0 -7
  89. package/dist/lib/browser/chunk-4X7CK6FM.mjs +0 -21
  90. package/dist/lib/browser/chunk-4X7CK6FM.mjs.map +0 -7
  91. package/dist/lib/browser/chunk-CD32XYEB.mjs.map +0 -7
  92. package/dist/lib/browser/index.mjs +0 -84
  93. package/dist/lib/browser/index.mjs.map +0 -7
  94. package/dist/lib/browser/meta.json +0 -1
  95. package/dist/lib/browser/react-surface-PVND4UCN.mjs +0 -34
  96. package/dist/lib/browser/react-surface-PVND4UCN.mjs.map +0 -7
  97. package/dist/lib/node-esm/StackContainer-7XVJHW4D.mjs +0 -290
  98. package/dist/lib/node-esm/StackContainer-7XVJHW4D.mjs.map +0 -7
  99. package/dist/lib/node-esm/chunk-26XWE7UY.mjs +0 -29
  100. package/dist/lib/node-esm/chunk-26XWE7UY.mjs.map +0 -7
  101. package/dist/lib/node-esm/chunk-HEEGXPSW.mjs +0 -23
  102. package/dist/lib/node-esm/chunk-HEEGXPSW.mjs.map +0 -7
  103. package/dist/lib/node-esm/index.mjs +0 -85
  104. package/dist/lib/node-esm/index.mjs.map +0 -7
  105. package/dist/lib/node-esm/meta.json +0 -1
  106. package/dist/lib/node-esm/react-surface-SZETVRAZ.mjs +0 -35
  107. package/dist/lib/node-esm/react-surface-SZETVRAZ.mjs.map +0 -7
  108. package/dist/lib/node-esm/types/index.mjs +0 -10
  109. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  110. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  111. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  112. package/dist/types/src/components/CaretDownUp.d.ts.map +0 -1
  113. package/dist/types/src/components/StackContext.d.ts.map +0 -1
  114. package/dist/types/src/components/StackSection.d.ts.map +0 -1
  115. package/dist/types/src/components/StackSettings.d.ts.map +0 -1
  116. package/dist/types/src/containers/StackContainer/StackContainer.d.ts +0 -9
  117. package/dist/types/src/containers/StackContainer/StackContainer.d.ts.map +0 -1
  118. package/dist/types/src/containers/StackContainer/index.d.ts +0 -3
  119. package/dist/types/src/containers/StackContainer/index.d.ts.map +0 -1
  120. package/src/capabilities/react-surface/index.ts +0 -7
  121. package/src/capabilities/react-surface/react-surface.tsx +0 -34
  122. package/src/components/StackSettings.tsx +0 -30
  123. package/src/containers/StackContainer/index.ts +0 -7
  124. /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
  125. /package/dist/lib/{node-esm/types/index.mjs.map → neutral/meta.mjs.map} +0 -0
  126. /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
  127. /package/src/components/{CaretDownUp.tsx → StackSection/CaretDownUp.tsx} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-stack",
3
- "version": "0.8.4-main.c85a9c8dae",
3
+ "version": "0.8.4-main.d9fc60f731",
4
4
  "description": "DXOS Surface plugin for Stack entities",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -8,63 +8,90 @@
8
8
  "type": "git",
9
9
  "url": "https://github.com/dxos/dxos"
10
10
  },
11
- "license": "MIT",
11
+ "license": "FSL-1.1-Apache-2.0",
12
12
  "author": "DXOS.org",
13
13
  "sideEffects": true,
14
14
  "type": "module",
15
+ "imports": {
16
+ "#capabilities": {
17
+ "source": "./src/capabilities/index.ts",
18
+ "types": "./dist/types/src/capabilities/index.d.ts",
19
+ "default": "./dist/lib/neutral/capabilities/index.mjs"
20
+ },
21
+ "#components": {
22
+ "source": "./src/components/index.ts",
23
+ "types": "./dist/types/src/components/index.d.ts",
24
+ "default": "./dist/lib/neutral/components/index.mjs"
25
+ },
26
+ "#containers": {
27
+ "source": "./src/containers/index.ts",
28
+ "types": "./dist/types/src/containers/index.d.ts",
29
+ "default": "./dist/lib/neutral/containers/index.mjs"
30
+ },
31
+ "#meta": {
32
+ "source": "./src/meta.ts",
33
+ "types": "./dist/types/src/meta.d.ts",
34
+ "default": "./dist/lib/neutral/meta.mjs"
35
+ },
36
+ "#plugin": {
37
+ "source": "./src/StackPlugin.ts",
38
+ "types": "./dist/types/src/StackPlugin.d.ts",
39
+ "default": "./dist/lib/neutral/StackPlugin.mjs"
40
+ },
41
+ "#translations": {
42
+ "source": "./src/translations.ts",
43
+ "types": "./dist/types/src/translations.d.ts",
44
+ "default": "./dist/lib/neutral/translations.mjs"
45
+ },
46
+ "#types": {
47
+ "source": "./src/types/index.ts",
48
+ "types": "./dist/types/src/types/index.d.ts",
49
+ "default": "./dist/lib/neutral/types/index.mjs"
50
+ }
51
+ },
15
52
  "exports": {
16
53
  ".": {
17
54
  "source": "./src/index.ts",
18
55
  "types": "./dist/types/src/index.d.ts",
19
- "browser": "./dist/lib/browser/index.mjs",
20
- "node": "./dist/lib/node-esm/index.mjs"
56
+ "default": "./dist/lib/neutral/index.mjs"
21
57
  },
22
- "./types": {
23
- "source": "./src/types/index.ts",
24
- "types": "./dist/types/src/types/index.d.ts",
25
- "browser": "./dist/lib/browser/types/index.mjs",
26
- "node": "./dist/lib/node-esm/types/index.mjs"
58
+ "./assets/PLUGIN.mdl": "./PLUGIN.mdl",
59
+ "./plugin": {
60
+ "source": "./src/plugin.ts",
61
+ "types": "./dist/types/src/plugin.d.ts",
62
+ "default": "./dist/lib/neutral/plugin.mjs"
63
+ },
64
+ "./translations": {
65
+ "source": "./src/translations.ts",
66
+ "types": "./dist/types/src/translations.d.ts",
67
+ "default": "./dist/lib/neutral/translations.mjs"
27
68
  }
28
69
  },
29
70
  "types": "dist/types/src/index.d.ts",
30
- "typesVersions": {
31
- "*": {
32
- "types": [
33
- "dist/types/src/types/index.d.ts"
34
- ]
35
- }
36
- },
37
71
  "files": [
38
72
  "dist",
39
- "src"
73
+ "src",
74
+ "PLUGIN.mdl"
40
75
  ],
41
76
  "dependencies": {
42
77
  "@effect-atom/atom-react": "^0.5.0",
43
- "@fluentui/react-tabster": "9.26.11",
44
78
  "@radix-ui/react-collapsible": "1.1.3",
45
- "effect": "3.19.16",
46
- "node-fetch": "^2.6.0",
47
- "react-is": "~19.2.0",
48
- "@dxos/app-framework": "0.8.4-main.c85a9c8dae",
49
- "@dxos/app-toolkit": "0.8.4-main.c85a9c8dae",
50
- "@dxos/async": "0.8.4-main.c85a9c8dae",
51
- "@dxos/echo-atom": "0.8.4-main.c85a9c8dae",
52
- "@dxos/client": "0.8.4-main.c85a9c8dae",
53
- "@dxos/echo": "0.8.4-main.c85a9c8dae",
54
- "@dxos/invariant": "0.8.4-main.c85a9c8dae",
55
- "@dxos/plugin-client": "0.8.4-main.c85a9c8dae",
56
- "@dxos/operation": "0.8.4-main.c85a9c8dae",
57
- "@dxos/plugin-deck": "0.8.4-main.c85a9c8dae",
58
- "@dxos/plugin-graph": "0.8.4-main.c85a9c8dae",
59
- "@dxos/plugin-space": "0.8.4-main.c85a9c8dae",
60
- "@dxos/react-ui-form": "0.8.4-main.c85a9c8dae",
61
- "@dxos/react-client": "0.8.4-main.c85a9c8dae",
62
- "@dxos/react-ui-attention": "0.8.4-main.c85a9c8dae",
63
- "@dxos/types": "0.8.4-main.c85a9c8dae",
64
- "@dxos/react-ui-searchlist": "0.8.4-main.c85a9c8dae",
65
- "@dxos/react-ui-stack": "0.8.4-main.c85a9c8dae",
66
- "@dxos/util": "0.8.4-main.c85a9c8dae",
67
- "@dxos/schema": "0.8.4-main.c85a9c8dae"
79
+ "effect": "3.21.2",
80
+ "@dxos/app-framework": "0.8.4-main.d9fc60f731",
81
+ "@dxos/echo-atom": "0.8.4-main.d9fc60f731",
82
+ "@dxos/app-toolkit": "0.8.4-main.d9fc60f731",
83
+ "@dxos/invariant": "0.8.4-main.d9fc60f731",
84
+ "@dxos/echo": "0.8.4-main.d9fc60f731",
85
+ "@dxos/keys": "0.8.4-main.d9fc60f731",
86
+ "@dxos/operation": "0.8.4-main.d9fc60f731",
87
+ "@dxos/plugin-client": "0.8.4-main.d9fc60f731",
88
+ "@dxos/plugin-deck": "0.8.4-main.d9fc60f731",
89
+ "@dxos/react-ui-form": "0.8.4-main.d9fc60f731",
90
+ "@dxos/util": "0.8.4-main.d9fc60f731",
91
+ "@dxos/react-ui-stack": "0.8.4-main.d9fc60f731",
92
+ "@dxos/plugin-space": "0.8.4-main.d9fc60f731",
93
+ "@dxos/react-ui-attention": "0.8.4-main.d9fc60f731",
94
+ "@dxos/plugin-graph": "0.8.4-main.d9fc60f731"
68
95
  },
69
96
  "devDependencies": {
70
97
  "@babel/core": "^7.18.13",
@@ -72,18 +99,19 @@
72
99
  "@types/react-dom": "~19.2.3",
73
100
  "react": "~19.2.3",
74
101
  "react-dom": "~19.2.3",
75
- "vite": "^7.1.11",
76
- "@dxos/react-ui": "0.8.4-main.c85a9c8dae",
77
- "@dxos/storybook-utils": "0.8.4-main.c85a9c8dae",
78
- "@dxos/ui-theme": "0.8.4-main.c85a9c8dae"
102
+ "vite": "^8.0.14",
103
+ "@dxos/plugin-testing": "0.8.4-main.d9fc60f731",
104
+ "@dxos/react-ui": "0.8.4-main.d9fc60f731",
105
+ "@dxos/ui-theme": "0.8.4-main.d9fc60f731",
106
+ "@dxos/storybook-utils": "0.8.4-main.d9fc60f731"
79
107
  },
80
108
  "peerDependencies": {
81
109
  "@effect-atom/atom-react": "^0.5.0",
82
- "effect": "3.19.16",
110
+ "effect": "3.21.2",
83
111
  "react": "~19.2.3",
84
112
  "react-dom": "~19.2.3",
85
- "@dxos/react-ui": "0.8.4-main.c85a9c8dae",
86
- "@dxos/ui-theme": "0.8.4-main.c85a9c8dae"
113
+ "@dxos/react-ui": "0.8.4-main.d9fc60f731",
114
+ "@dxos/ui-theme": "0.8.4-main.d9fc60f731"
87
115
  },
88
116
  "publishConfig": {
89
117
  "access": "public"
@@ -4,33 +4,23 @@
4
4
 
5
5
  import { Plugin } from '@dxos/app-framework';
6
6
  import { AppPlugin } from '@dxos/app-toolkit';
7
- import { type Obj } from '@dxos/echo';
8
7
 
9
- import { ReactSurface } from './capabilities';
10
- import { SECTION_IDENTIFIER, meta } from './meta';
11
- import { translations } from './translations';
12
- import { StackViewType } from './types';
8
+ import { ReactSurface } from '#capabilities';
9
+ import { meta } from '#meta';
10
+ import { translations } from '#translations';
11
+ import { StackViewType } from '#types';
12
+
13
+ // eslint-disable-next-line import/no-relative-packages
14
+ import pluginSpec from '../PLUGIN.mdl?raw';
13
15
 
14
16
  export const StackPlugin = Plugin.define(meta).pipe(
15
- AppPlugin.addMetadataModule({
16
- metadata: {
17
- id: SECTION_IDENTIFIER,
18
- metadata: {
19
- parse: (section: { object: Obj.Unknown }, type: string) => {
20
- switch (type) {
21
- case 'node':
22
- return { id: section.object.id, label: (section.object as any).title, data: section.object };
23
- case 'object':
24
- return section.object;
25
- case 'view-object':
26
- return section;
27
- }
28
- },
29
- },
30
- },
31
- }),
32
17
  AppPlugin.addSchemaModule({ schema: [StackViewType] }),
33
18
  AppPlugin.addSurfaceModule({ activate: ReactSurface }),
34
19
  AppPlugin.addTranslationsModule({ translations }),
20
+ AppPlugin.addPluginAssetModule({
21
+ asset: { pluginId: meta.id, path: 'PLUGIN.mdl', content: pluginSpec, mimeType: 'application/x-mdl' },
22
+ }),
35
23
  Plugin.make,
36
24
  );
25
+
26
+ export default StackPlugin;
@@ -2,4 +2,6 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export * from './react-surface';
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
@@ -0,0 +1,28 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import React from 'react';
7
+
8
+ import { Capabilities, Capability } from '@dxos/app-framework';
9
+ import { Surface } from '@dxos/app-framework/ui';
10
+ import { AppSurface } from '@dxos/app-toolkit/ui';
11
+ import { Collection } from '@dxos/echo';
12
+
13
+ import { StackArticle } from '#containers';
14
+
15
+ export default Capability.makeModule(() =>
16
+ Effect.succeed(
17
+ Capability.contributes(
18
+ Capabilities.ReactSurface,
19
+ Surface.create({
20
+ id: 'article',
21
+ filter: AppSurface.object(AppSurface.Article, Collection.Collection),
22
+ component: ({ role, data }) => {
23
+ return <StackArticle attendableId={data.attendableId} role={role} subject={data.subject} />;
24
+ },
25
+ }),
26
+ ),
27
+ ),
28
+ );
@@ -4,9 +4,10 @@
4
4
 
5
5
  import { createContext, useContext } from 'react';
6
6
 
7
- import { type AddSectionPosition } from '../types';
7
+ import { type AddSectionPosition } from '#types';
8
8
 
9
9
  export type StackContextValue = {
10
+ attendableId: string;
10
11
  onCollapse: (id: string, collapsed: boolean) => void;
11
12
  onNavigate: (id: string) => Promise<void>;
12
13
  onDelete: (id: string) => Promise<void>;
@@ -14,6 +15,7 @@ export type StackContextValue = {
14
15
  };
15
16
 
16
17
  export const StackContext = createContext<StackContextValue>({
18
+ attendableId: '',
17
19
  onCollapse: () => {},
18
20
  onNavigate: async () => {},
19
21
  onDelete: async () => {},
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export * from './StackContext';
@@ -6,16 +6,17 @@ import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
6
6
  import React, { useMemo, useState } from 'react';
7
7
 
8
8
  import { Surface } from '@dxos/app-framework/ui';
9
+ import { AppSurface } from '@dxos/app-toolkit/ui';
9
10
  import { DropdownMenu, Icon, IconButton, useTranslation } from '@dxos/react-ui';
10
11
  import { useAttentionAttributes } from '@dxos/react-ui-attention';
11
12
  import { StackItem } from '@dxos/react-ui-stack';
12
- import { getSize, mx, textBlockWidth } from '@dxos/ui-theme';
13
+ import { getSize, mx } from '@dxos/ui-theme';
13
14
 
14
- import { meta } from '../meta';
15
- import { type StackSectionItem } from '../types';
15
+ import { meta } from '#meta';
16
+ import { type StackSectionItem } from '#types';
16
17
 
18
+ import { useStack } from '../StackContext';
17
19
  import { CaretDownUp } from './CaretDownUp';
18
- import { useStack } from './StackContext';
19
20
 
20
21
  const sectionActionDimensions = 'p-1 my-1 shrink-0 min-h-0 w-(--dx-rail-action) h-min';
21
22
 
@@ -25,13 +26,15 @@ export const StackSection = ({
25
26
  id,
26
27
  view,
27
28
  object,
28
- metadata: { icon = 'ph--placeholder--regular' },
29
+ metadata: { icon = 'ph--circle-dashed--regular' },
29
30
  }: StackSectionProps) => {
30
31
  const { t } = useTranslation(meta.id);
31
- const { onNavigate, onAdd, onCollapse, onDelete } = useStack();
32
+ const { attendableId: parentAttendableId, onNavigate, onAdd, onCollapse, onDelete } = useStack();
32
33
  const [optionsMenuOpen, setOptionsMenuOpen] = useState(false);
33
- const attentionAttrs = useAttentionAttributes(id);
34
+ const attendableId = `${parentAttendableId}/${object.id}`;
35
+ const attentionAttrs = useAttentionAttributes(attendableId);
34
36
  const stackItem = useMemo(() => ({ id }), [id]);
37
+ const data = useMemo(() => ({ attendableId, subject: object }), [object, attendableId]);
35
38
 
36
39
  return (
37
40
  <CollapsiblePrimitive.Root asChild open={!view.collapsed} onOpenChange={(nextOpen) => onCollapse?.(id, !nextOpen)}>
@@ -47,7 +50,7 @@ export const StackSection = ({
47
50
  >
48
51
  <DropdownMenu.Trigger asChild>
49
52
  <StackItem.SigilButton>
50
- <Icon icon={icon} size={5} classNames='transition-opacity' />
53
+ <Icon icon={icon} classNames='transition-opacity' />
51
54
  </StackItem.SigilButton>
52
55
  </DropdownMenu.Trigger>
53
56
  <DropdownMenu.Portal>
@@ -55,28 +58,28 @@ export const StackSection = ({
55
58
  <DropdownMenu.Viewport>
56
59
  {view.collapsed ? (
57
60
  <DropdownMenu.Item onClick={() => onNavigate(id)} data-testid='section.navigate-to'>
58
- <Icon icon='ph--arrow-right--regular' size={5} />
59
- <span className='ms-2 grow'>{t('navigate to section label')}</span>
61
+ <Icon icon='ph--arrow-right--regular' />
62
+ <span className='ms-2 grow'>{t('navigate-to-section.label')}</span>
60
63
  </DropdownMenu.Item>
61
64
  ) : (
62
65
  <CollapsiblePrimitive.Trigger asChild>
63
66
  <DropdownMenu.Item>
64
67
  <CaretDownUp className={getSize(5)} />
65
- <span className='ms-2 grow'>{t('collapse label')}</span>
68
+ <span className='ms-2 grow'>{t('collapse.label')}</span>
66
69
  </DropdownMenu.Item>
67
70
  </CollapsiblePrimitive.Trigger>
68
71
  )}
69
72
  <DropdownMenu.Item onClick={() => onAdd(id, 'before')} data-testid='section.add-before'>
70
- <Icon icon='ph--arrow-line-up--regular' size={5} />
71
- <span className='ms-2 grow'>{t('add section before label')}</span>
73
+ <Icon icon='ph--arrow-line-up--regular' />
74
+ <span className='ms-2 grow'>{t('add-section-before.label')}</span>
72
75
  </DropdownMenu.Item>
73
76
  <DropdownMenu.Item onClick={() => onAdd(id, 'after')} data-testid='section.add-after'>
74
- <Icon icon='ph--arrow-line-down--regular' size={5} />
75
- <span className='ms-2 grow'>{t('add section after label')}</span>
77
+ <Icon icon='ph--arrow-line-down--regular' />
78
+ <span className='ms-2 grow'>{t('add-section-after.label')}</span>
76
79
  </DropdownMenu.Item>
77
80
  <DropdownMenu.Item onClick={() => onDelete(id)} data-testid='section.remove'>
78
- <Icon icon='ph--trash--regular' size={5} />
79
- <span className='ms-2 grow'>{t('remove section label')}</span>
81
+ <Icon icon='ph--trash--regular' />
82
+ <span className='ms-2 grow'>{t('remove-section.label')}</span>
80
83
  </DropdownMenu.Item>
81
84
  </DropdownMenu.Viewport>
82
85
  <DropdownMenu.Arrow />
@@ -88,7 +91,7 @@ export const StackSection = ({
88
91
  <IconButton
89
92
  iconOnly
90
93
  variant='ghost'
91
- label={t('expand label')}
94
+ label={t('expand.label')}
92
95
  icon='ph--caret-up-down--regular'
93
96
  classNames={sectionActionDimensions}
94
97
  />
@@ -98,7 +101,7 @@ export const StackSection = ({
98
101
  iconOnly
99
102
  variant='ghost'
100
103
  onClick={() => onNavigate(id)}
101
- label={t('navigate to section label')}
104
+ label={t('navigate-to-section.label')}
102
105
  icon='ph--arrow-right--regular'
103
106
  data-testid='section.navigate-to'
104
107
  classNames={sectionActionDimensions}
@@ -107,11 +110,11 @@ export const StackSection = ({
107
110
  </StackItem.HeadingStickyContent>
108
111
  </StackItem.Heading>
109
112
  <CollapsiblePrimitive.Content>
110
- <Surface.Surface role='section' data={{ subject: object }} limit={1} placeholder={<></>} />
113
+ <Surface.Surface type={AppSurface.Section} data={data} limit={1} placeholder={<></>} />
111
114
  </CollapsiblePrimitive.Content>
112
115
  {view.collapsed && (
113
116
  <StackItem.Content classNames='dx-attention-surface'>
114
- <h2 className={mx('flex items-center p-4 font-medium', textBlockWidth)}>{view.title}</h2>
117
+ <h2 className={mx('flex items-center p-4 font-medium')}>{view.title}</h2>
115
118
  </StackItem.Content>
116
119
  )}
117
120
  </StackItem.Root>
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export * from './StackSection';
@@ -0,0 +1,28 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { Input, useTranslation } from '@dxos/react-ui';
8
+ import { Settings as SettingsForm } from '@dxos/react-ui-form';
9
+
10
+ import { meta } from '#meta';
11
+ import { type StackSettingsProps } from '#types';
12
+
13
+ export const StackSettings = ({ settings }: { settings: StackSettingsProps }) => {
14
+ const { t } = useTranslation(meta.id);
15
+
16
+ return (
17
+ <SettingsForm.Viewport>
18
+ <SettingsForm.Section title={t('settings.title', { ns: meta.id })}>
19
+ <SettingsForm.Item title={t('settings.separation.label')} description={t('settings.separation.description')}>
20
+ <Input.Switch
21
+ checked={settings.separation}
22
+ onCheckedChange={(checked) => (settings.separation = !!checked)}
23
+ />
24
+ </SettingsForm.Item>
25
+ </SettingsForm.Section>
26
+ </SettingsForm.Viewport>
27
+ );
28
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export * from './StackSettings';
@@ -6,29 +6,26 @@ import { Atom, useAtomValue } from '@effect-atom/atom-react';
6
6
  import * as Option from 'effect/Option';
7
7
  import React, { useCallback, useState } from 'react';
8
8
 
9
- import { useCapabilities, useOperationInvoker } from '@dxos/app-framework/ui';
10
- import { AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';
11
- import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
12
- import { useAppGraph } from '@dxos/app-toolkit/ui';
13
- import { Obj, type Ref } from '@dxos/echo';
14
- import { type Collection } from '@dxos/echo';
9
+ import { useOperationInvoker } from '@dxos/app-framework/ui';
10
+ import { LayoutOperation } from '@dxos/app-toolkit';
11
+ import { useAppGraph, type AppSurface } from '@dxos/app-toolkit/ui';
12
+ import { type Collection, Obj, type Ref } from '@dxos/echo';
15
13
  import { AtomObj } from '@dxos/echo-atom';
16
14
  import { Graph } from '@dxos/plugin-graph';
17
- import { SpaceOperation } from '@dxos/plugin-space/types';
15
+ import { SpaceOperation } from '@dxos/plugin-space';
18
16
  import { Toolbar, toLocalizedString, useTranslation } from '@dxos/react-ui';
19
- import { AttentionProvider } from '@dxos/react-ui-attention';
20
17
  import { Stack, StackItem } from '@dxos/react-ui-stack';
21
18
  import { isNonNullable } from '@dxos/util';
22
19
 
23
- import { StackContext, StackSection } from '../../components';
24
- import { meta } from '../../meta';
20
+ import { StackContext, StackSection } from '#components';
21
+ import { meta } from '#meta';
25
22
  import {
26
23
  type AddSectionPosition,
27
24
  type CollapsedSections,
28
25
  type StackSectionItem,
29
26
  type StackSectionMetadata,
30
27
  type StackSectionView,
31
- } from '../../types';
28
+ } from '#types';
32
29
 
33
30
  const collectionObjectsFamily = Atom.family((collection: Collection.Collection) =>
34
31
  Atom.make((get) => {
@@ -42,15 +39,12 @@ const collectionObjectsFamily = Atom.family((collection: Collection.Collection)
42
39
  }),
43
40
  );
44
41
 
45
- type StackContainerProps = SurfaceComponentProps<Collection.Collection> & {
46
- id: string;
47
- };
42
+ type StackArticleProps = AppSurface.ObjectArticleProps<Collection.Collection>;
48
43
 
49
- export const StackContainer = ({ id, subject: collection }: StackContainerProps) => {
44
+ export const StackArticle = ({ attendableId, subject: collection }: StackArticleProps) => {
50
45
  const { invokePromise } = useOperationInvoker();
51
46
  const { graph } = useAppGraph();
52
47
  const { t } = useTranslation(meta.id);
53
- const allMetadata = useCapabilities(AppCapabilities.Metadata);
54
48
  const [collapsedSections, setCollapsedSections] = useState<CollapsedSections>({});
55
49
 
56
50
  // TODO(wittjosiah): Re-implement stack views with relations.
@@ -64,20 +58,17 @@ export const StackContainer = ({ id, subject: collection }: StackContainerProps)
64
58
 
65
59
  const collectionObjects = useAtomValue(collectionObjectsFamily(collection));
66
60
  const items = collectionObjects.map((object: Obj.Unknown) => {
67
- const metadata = allMetadata.find((m) => m.id === (Obj.getTypename(object) ?? 'never'))
68
- ?.metadata as StackSectionMetadata;
61
+ const iconAnnotation = Obj.getIcon(object);
62
+ const metadata: StackSectionMetadata = { icon: iconAnnotation?.icon };
69
63
  const view = {
70
64
  // ...stack.sections[object.id],
71
- collapsed: collapsedSections[Obj.getDXN(object).toString()],
65
+ collapsed: collapsedSections[Obj.getURI(object)],
72
66
  title:
73
67
  (object as any)?.title ??
74
68
  // TODO(wittjosiah): `getNode` is not reactive.
75
- toLocalizedString(
76
- Graph.getNode(graph, Obj.getDXN(object).toString()).pipe(Option.getOrNull)?.properties.label,
77
- t,
78
- ),
69
+ toLocalizedString(Graph.getNode(graph, Obj.getURI(object)).pipe(Option.getOrNull)?.properties.label, t),
79
70
  } as StackSectionView;
80
- return { id: Obj.getDXN(object).toString(), object, metadata, view } satisfies StackSectionItem;
71
+ return { id: Obj.getURI(object), object, metadata, view } satisfies StackSectionItem;
81
72
  });
82
73
 
83
74
  const handleDelete = useCallback(
@@ -85,7 +76,7 @@ export const StackContainer = ({ id, subject: collection }: StackContainerProps)
85
76
  const index = collection.objects
86
77
  .map((object) => object.target)
87
78
  .filter(isNonNullable)
88
- .findIndex((section) => Obj.getDXN(section).toString() === id);
79
+ .findIndex((section) => Obj.getURI(section) === id);
89
80
  const object = collection.objects[index].target;
90
81
  if (Obj.isObject(object)) {
91
82
  await invokePromise(SpaceOperation.RemoveObjects, {
@@ -104,7 +95,7 @@ export const StackContainer = ({ id, subject: collection }: StackContainerProps)
104
95
  async (id: string, position: AddSectionPosition) => {
105
96
  // TODO(wittjosiah): Use object creation dialog.
106
97
  await invokePromise(LayoutOperation.UpdateDialog, {
107
- subject: `${meta.id}/AddSectionDialog`,
98
+ subject: `${meta.id}.AddSectionDialog`,
108
99
  blockAlign: 'start',
109
100
  props: {
110
101
  path: id,
@@ -138,7 +129,7 @@ export const StackContainer = ({ id, subject: collection }: StackContainerProps)
138
129
  );
139
130
 
140
131
  return (
141
- <StackItem.Content toolbar classNames='dx-article overflow-hidden border-l border-r border-subdued-separator'>
132
+ <StackItem.Content toolbar classNames='dx-document'>
142
133
  <Toolbar.Root>
143
134
  <Toolbar.IconButton
144
135
  icon='ph--plus--regular'
@@ -148,22 +139,27 @@ export const StackContainer = ({ id, subject: collection }: StackContainerProps)
148
139
  onClick={handleAddSection}
149
140
  />
150
141
  </Toolbar.Root>
151
- <AttentionProvider id={id}>
152
- <StackContext.Provider
153
- value={{
154
- onCollapse: handleCollapse,
155
- onNavigate: handleNavigate,
156
- onDelete: handleDelete,
157
- onAdd: handleAdd,
158
- }}
142
+ <StackContext.Provider
143
+ value={{
144
+ attendableId,
145
+ onCollapse: handleCollapse,
146
+ onNavigate: handleNavigate,
147
+ onDelete: handleDelete,
148
+ onAdd: handleAdd,
149
+ }}
150
+ >
151
+ <Stack
152
+ orientation='vertical'
153
+ size='intrinsic'
154
+ id={Obj.getURI(collection)}
155
+ data-testid='main.stack'
156
+ classNames='overflow-y-auto'
159
157
  >
160
- <Stack orientation='vertical' size='intrinsic' id={id} data-testid='main.stack' classNames='overflow-y-auto'>
161
- {items.map((item) => (
162
- <StackSection key={item.id} {...item} />
163
- ))}
164
- </Stack>
165
- </StackContext.Provider>
166
- </AttentionProvider>
158
+ {items.map((item) => (
159
+ <StackSection key={item.id} {...item} />
160
+ ))}
161
+ </Stack>
162
+ </StackContext.Provider>
167
163
  </StackItem.Content>
168
164
  );
169
165
  };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export { StackArticle as default } from './StackArticle';
@@ -4,4 +4,4 @@
4
4
 
5
5
  import { type ComponentType, lazy } from 'react';
6
6
 
7
- export const StackContainer: ComponentType<any> = lazy(() => import('./StackContainer'));
7
+ export const StackArticle: ComponentType<any> = lazy(() => import('./StackArticle'));
package/src/index.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  //
4
4
 
5
5
  export * from './meta';
6
- export * from './StackPlugin';
6
+ export * from './types';