@dxos/plugin-stack 0.8.4-main.422d1c7879 → 0.8.4-main.43cb759274

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 (84) 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/types/index.mjs → neutral/chunk-T4NSFSPH.mjs} +4 -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/index.mjs.map +7 -0
  20. package/dist/lib/neutral/meta.json +1 -0
  21. package/dist/lib/neutral/meta.mjs +9 -0
  22. package/dist/lib/neutral/meta.mjs.map +7 -0
  23. package/dist/lib/neutral/plugin.mjs +11 -0
  24. package/dist/lib/neutral/plugin.mjs.map +7 -0
  25. package/dist/lib/neutral/react-surface-MD3CVY2N.mjs +23 -0
  26. package/dist/lib/neutral/react-surface-MD3CVY2N.mjs.map +7 -0
  27. package/dist/lib/neutral/translations.mjs +37 -0
  28. package/dist/lib/neutral/translations.mjs.map +7 -0
  29. package/dist/lib/neutral/types/index.mjs +9 -0
  30. package/dist/lib/neutral/types/index.mjs.map +7 -0
  31. package/dist/types/src/StackPlugin.d.ts +1 -0
  32. package/dist/types/src/StackPlugin.d.ts.map +1 -1
  33. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  34. package/dist/types/src/components/StackSection/CaretDownUp.d.ts +1 -1
  35. package/dist/types/src/components/StackSection/CaretDownUp.d.ts.map +1 -1
  36. package/dist/types/src/components/StackSection/StackSection.d.ts.map +1 -1
  37. package/dist/types/src/components/StackSettings/StackSettings.d.ts.map +1 -1
  38. package/dist/types/src/containers/StackArticle/StackArticle.d.ts +7 -0
  39. package/dist/types/src/containers/StackArticle/StackArticle.d.ts.map +1 -0
  40. package/dist/types/src/containers/StackArticle/index.d.ts +2 -0
  41. package/dist/types/src/containers/StackArticle/index.d.ts.map +1 -0
  42. package/dist/types/src/containers/index.d.ts +1 -1
  43. package/dist/types/src/containers/index.d.ts.map +1 -1
  44. package/dist/types/src/index.d.ts +1 -1
  45. package/dist/types/src/index.d.ts.map +1 -1
  46. package/dist/types/src/meta.d.ts +3 -2
  47. package/dist/types/src/meta.d.ts.map +1 -1
  48. package/dist/types/src/plugin.d.ts +3 -0
  49. package/dist/types/src/plugin.d.ts.map +1 -0
  50. package/dist/types/src/translations.d.ts +30 -31
  51. package/dist/types/src/translations.d.ts.map +1 -1
  52. package/dist/types/src/types/stack.d.ts +1 -2
  53. package/dist/types/src/types/stack.d.ts.map +1 -1
  54. package/dist/types/src/types/types.d.ts +1 -2
  55. package/dist/types/src/types/types.d.ts.map +1 -1
  56. package/dist/types/tsconfig.tsbuildinfo +1 -1
  57. package/package.json +74 -46
  58. package/src/StackPlugin.ts +9 -20
  59. package/src/capabilities/react-surface.tsx +2 -2
  60. package/src/components/StackSection/StackSection.tsx +1 -1
  61. package/src/containers/{StackContainer/StackContainer.tsx → StackArticle/StackArticle.tsx} +13 -18
  62. package/src/containers/StackArticle/index.ts +5 -0
  63. package/src/containers/index.ts +1 -1
  64. package/src/index.ts +1 -1
  65. package/src/meta.ts +21 -7
  66. package/src/plugin.ts +9 -0
  67. package/src/translations.ts +1 -1
  68. package/src/types/stack.ts +3 -8
  69. package/src/types/types.ts +1 -2
  70. package/src/vite-env.d.ts +10 -0
  71. package/dist/lib/browser/index.mjs +0 -93
  72. package/dist/lib/browser/index.mjs.map +0 -7
  73. package/dist/lib/browser/meta.json +0 -1
  74. package/dist/lib/browser/types/index.mjs.map +0 -7
  75. package/dist/lib/node-esm/index.mjs +0 -95
  76. package/dist/lib/node-esm/index.mjs.map +0 -7
  77. package/dist/lib/node-esm/meta.json +0 -1
  78. package/dist/lib/node-esm/types/index.mjs +0 -28
  79. package/dist/lib/node-esm/types/index.mjs.map +0 -7
  80. package/dist/types/src/containers/StackContainer/StackContainer.d.ts +0 -7
  81. package/dist/types/src/containers/StackContainer/StackContainer.d.ts.map +0 -1
  82. package/dist/types/src/containers/StackContainer/index.d.ts +0 -2
  83. package/dist/types/src/containers/StackContainer/index.d.ts.map +0 -1
  84. package/src/containers/StackContainer/index.ts +0 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-stack",
3
- "version": "0.8.4-main.422d1c7879",
3
+ "version": "0.8.4-main.43cb759274",
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
15
  "imports": {
16
- "#capabilities": "./src/capabilities/index.ts",
17
- "#components": "./src/components/index.ts",
18
- "#containers": "./src/containers/index.ts",
19
- "#meta": "./src/meta.ts",
20
- "#types": "./src/types/index.ts"
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
+ }
21
51
  },
22
52
  "exports": {
23
53
  ".": {
24
54
  "source": "./src/index.ts",
25
55
  "types": "./dist/types/src/index.d.ts",
26
- "browser": "./dist/lib/browser/index.mjs",
27
- "node": "./dist/lib/node-esm/index.mjs"
56
+ "default": "./dist/lib/neutral/index.mjs"
28
57
  },
29
- "./types": {
30
- "source": "./src/types/index.ts",
31
- "types": "./dist/types/src/types/index.d.ts",
32
- "browser": "./dist/lib/browser/types/index.mjs",
33
- "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"
34
68
  }
35
69
  },
36
70
  "types": "dist/types/src/index.d.ts",
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.20.0",
46
- "node-fetch": "^2.6.0",
47
- "react-is": "~19.2.0",
48
- "@dxos/app-framework": "0.8.4-main.422d1c7879",
49
- "@dxos/app-toolkit": "0.8.4-main.422d1c7879",
50
- "@dxos/async": "0.8.4-main.422d1c7879",
51
- "@dxos/client": "0.8.4-main.422d1c7879",
52
- "@dxos/echo-atom": "0.8.4-main.422d1c7879",
53
- "@dxos/invariant": "0.8.4-main.422d1c7879",
54
- "@dxos/operation": "0.8.4-main.422d1c7879",
55
- "@dxos/echo": "0.8.4-main.422d1c7879",
56
- "@dxos/plugin-client": "0.8.4-main.422d1c7879",
57
- "@dxos/plugin-graph": "0.8.4-main.422d1c7879",
58
- "@dxos/plugin-deck": "0.8.4-main.422d1c7879",
59
- "@dxos/react-client": "0.8.4-main.422d1c7879",
60
- "@dxos/plugin-space": "0.8.4-main.422d1c7879",
61
- "@dxos/react-ui-form": "0.8.4-main.422d1c7879",
62
- "@dxos/react-ui-attention": "0.8.4-main.422d1c7879",
63
- "@dxos/react-ui-stack": "0.8.4-main.422d1c7879",
64
- "@dxos/types": "0.8.4-main.422d1c7879",
65
- "@dxos/react-ui-search": "0.8.4-main.422d1c7879",
66
- "@dxos/util": "0.8.4-main.422d1c7879",
67
- "@dxos/schema": "0.8.4-main.422d1c7879"
79
+ "effect": "3.21.2",
80
+ "@dxos/app-framework": "0.8.4-main.43cb759274",
81
+ "@dxos/app-toolkit": "0.8.4-main.43cb759274",
82
+ "@dxos/echo": "0.8.4-main.43cb759274",
83
+ "@dxos/echo-atom": "0.8.4-main.43cb759274",
84
+ "@dxos/invariant": "0.8.4-main.43cb759274",
85
+ "@dxos/plugin-graph": "0.8.4-main.43cb759274",
86
+ "@dxos/plugin-deck": "0.8.4-main.43cb759274",
87
+ "@dxos/plugin-space": "0.8.4-main.43cb759274",
88
+ "@dxos/react-ui-attention": "0.8.4-main.43cb759274",
89
+ "@dxos/util": "0.8.4-main.43cb759274",
90
+ "@dxos/operation": "0.8.4-main.43cb759274",
91
+ "@dxos/react-ui-stack": "0.8.4-main.43cb759274",
92
+ "@dxos/keys": "0.8.4-main.43cb759274",
93
+ "@dxos/react-ui-form": "0.8.4-main.43cb759274",
94
+ "@dxos/plugin-client": "0.8.4-main.43cb759274"
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.422d1c7879",
77
- "@dxos/storybook-utils": "0.8.4-main.422d1c7879",
78
- "@dxos/ui-theme": "0.8.4-main.422d1c7879"
102
+ "vite": "^8.0.14",
103
+ "@dxos/storybook-utils": "0.8.4-main.43cb759274",
104
+ "@dxos/react-ui": "0.8.4-main.43cb759274",
105
+ "@dxos/plugin-testing": "0.8.4-main.43cb759274",
106
+ "@dxos/ui-theme": "0.8.4-main.43cb759274"
79
107
  },
80
108
  "peerDependencies": {
81
109
  "@effect-atom/atom-react": "^0.5.0",
82
- "effect": "3.20.0",
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.422d1c7879",
86
- "@dxos/ui-theme": "0.8.4-main.422d1c7879"
113
+ "@dxos/react-ui": "0.8.4-main.43cb759274",
114
+ "@dxos/ui-theme": "0.8.4-main.43cb759274"
87
115
  },
88
116
  "publishConfig": {
89
117
  "access": "public"
@@ -4,34 +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
8
  import { ReactSurface } from '#capabilities';
10
- import { SECTION_IDENTIFIER, meta } from '#meta';
9
+ import { meta } from '#meta';
10
+ import { translations } from '#translations';
11
11
  import { StackViewType } from '#types';
12
12
 
13
- import { translations } from './translations';
13
+ // eslint-disable-next-line import/no-relative-packages
14
+ import pluginSpec from '../PLUGIN.mdl?raw';
14
15
 
15
16
  export const StackPlugin = Plugin.define(meta).pipe(
16
- AppPlugin.addMetadataModule({
17
- metadata: {
18
- id: SECTION_IDENTIFIER,
19
- metadata: {
20
- parse: (section: { object: Obj.Unknown }, type: string) => {
21
- switch (type) {
22
- case 'node':
23
- return { id: section.object.id, label: (section.object as any).title, data: section.object };
24
- case 'object':
25
- return section.object;
26
- case 'view-object':
27
- return section;
28
- }
29
- },
30
- },
31
- },
32
- }),
33
17
  AppPlugin.addSchemaModule({ schema: [StackViewType] }),
34
18
  AppPlugin.addSurfaceModule({ activate: ReactSurface }),
35
19
  AppPlugin.addTranslationsModule({ translations }),
20
+ AppPlugin.addPluginAssetModule({
21
+ asset: { pluginId: meta.id, path: 'PLUGIN.mdl', content: pluginSpec, mimeType: 'application/x-mdl' },
22
+ }),
36
23
  Plugin.make,
37
24
  );
25
+
26
+ export default StackPlugin;
@@ -10,7 +10,7 @@ import { Surface } from '@dxos/app-framework/ui';
10
10
  import { AppSurface } from '@dxos/app-toolkit/ui';
11
11
  import { Collection } from '@dxos/echo';
12
12
 
13
- import { StackContainer } from '#containers';
13
+ import { StackArticle } from '#containers';
14
14
 
15
15
  export default Capability.makeModule(() =>
16
16
  Effect.succeed(
@@ -20,7 +20,7 @@ export default Capability.makeModule(() =>
20
20
  id: 'article',
21
21
  filter: AppSurface.object(AppSurface.Article, Collection.Collection),
22
22
  component: ({ role, data }) => {
23
- return <StackContainer attendableId={data.attendableId} role={role} subject={data.subject} />;
23
+ return <StackArticle attendableId={data.attendableId} role={role} subject={data.subject} />;
24
24
  },
25
25
  }),
26
26
  ),
@@ -26,7 +26,7 @@ export const StackSection = ({
26
26
  id,
27
27
  view,
28
28
  object,
29
- metadata: { icon = 'ph--placeholder--regular' },
29
+ metadata: { icon = 'ph--circle-dashed--regular' },
30
30
  }: StackSectionProps) => {
31
31
  const { t } = useTranslation(meta.id);
32
32
  const { attendableId: parentAttendableId, onNavigate, onAdd, onCollapse, onDelete } = useStack();
@@ -6,14 +6,13 @@ 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';
9
+ import { useOperationInvoker } from '@dxos/app-framework/ui';
10
+ import { LayoutOperation } from '@dxos/app-toolkit';
11
11
  import { useAppGraph, type AppSurface } from '@dxos/app-toolkit/ui';
12
- import { Obj, type Ref } from '@dxos/echo';
13
- import { type Collection } from '@dxos/echo';
12
+ import { type Collection, Obj, type Ref } from '@dxos/echo';
14
13
  import { AtomObj } from '@dxos/echo-atom';
15
14
  import { Graph } from '@dxos/plugin-graph';
16
- import { SpaceOperation } from '@dxos/plugin-space/operations';
15
+ import { SpaceOperation } from '@dxos/plugin-space';
17
16
  import { Toolbar, toLocalizedString, useTranslation } from '@dxos/react-ui';
18
17
  import { Stack, StackItem } from '@dxos/react-ui-stack';
19
18
  import { isNonNullable } from '@dxos/util';
@@ -40,13 +39,12 @@ const collectionObjectsFamily = Atom.family((collection: Collection.Collection)
40
39
  }),
41
40
  );
42
41
 
43
- type StackContainerProps = AppSurface.ObjectArticleProps<Collection.Collection>;
42
+ type StackArticleProps = AppSurface.ObjectArticleProps<Collection.Collection>;
44
43
 
45
- export const StackContainer = ({ attendableId, subject: collection }: StackContainerProps) => {
44
+ export const StackArticle = ({ attendableId, subject: collection }: StackArticleProps) => {
46
45
  const { invokePromise } = useOperationInvoker();
47
46
  const { graph } = useAppGraph();
48
47
  const { t } = useTranslation(meta.id);
49
- const allMetadata = useCapabilities(AppCapabilities.Metadata);
50
48
  const [collapsedSections, setCollapsedSections] = useState<CollapsedSections>({});
51
49
 
52
50
  // TODO(wittjosiah): Re-implement stack views with relations.
@@ -60,20 +58,17 @@ export const StackContainer = ({ attendableId, subject: collection }: StackConta
60
58
 
61
59
  const collectionObjects = useAtomValue(collectionObjectsFamily(collection));
62
60
  const items = collectionObjects.map((object: Obj.Unknown) => {
63
- const metadata = allMetadata.find((m) => m.id === (Obj.getTypename(object) ?? 'never'))
64
- ?.metadata as StackSectionMetadata;
61
+ const iconAnnotation = Obj.getIcon(object);
62
+ const metadata: StackSectionMetadata = { icon: iconAnnotation?.icon };
65
63
  const view = {
66
64
  // ...stack.sections[object.id],
67
- collapsed: collapsedSections[Obj.getDXN(object).toString()],
65
+ collapsed: collapsedSections[Obj.getURI(object)],
68
66
  title:
69
67
  (object as any)?.title ??
70
68
  // TODO(wittjosiah): `getNode` is not reactive.
71
- toLocalizedString(
72
- Graph.getNode(graph, Obj.getDXN(object).toString()).pipe(Option.getOrNull)?.properties.label,
73
- t,
74
- ),
69
+ toLocalizedString(Graph.getNode(graph, Obj.getURI(object)).pipe(Option.getOrNull)?.properties.label, t),
75
70
  } as StackSectionView;
76
- return { id: Obj.getDXN(object).toString(), object, metadata, view } satisfies StackSectionItem;
71
+ return { id: Obj.getURI(object), object, metadata, view } satisfies StackSectionItem;
77
72
  });
78
73
 
79
74
  const handleDelete = useCallback(
@@ -81,7 +76,7 @@ export const StackContainer = ({ attendableId, subject: collection }: StackConta
81
76
  const index = collection.objects
82
77
  .map((object) => object.target)
83
78
  .filter(isNonNullable)
84
- .findIndex((section) => Obj.getDXN(section).toString() === id);
79
+ .findIndex((section) => Obj.getURI(section) === id);
85
80
  const object = collection.objects[index].target;
86
81
  if (Obj.isObject(object)) {
87
82
  await invokePromise(SpaceOperation.RemoveObjects, {
@@ -156,7 +151,7 @@ export const StackContainer = ({ attendableId, subject: collection }: StackConta
156
151
  <Stack
157
152
  orientation='vertical'
158
153
  size='intrinsic'
159
- id={Obj.getDXN(collection).toString()}
154
+ id={Obj.getURI(collection)}
160
155
  data-testid='main.stack'
161
156
  classNames='overflow-y-auto'
162
157
  >
@@ -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';
package/src/meta.ts CHANGED
@@ -2,20 +2,34 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type Plugin } from '@dxos/app-framework';
5
+ import { Plugin } from '@dxos/app-framework';
6
+ import { DXN } from '@dxos/keys';
6
7
  import { trim } from '@dxos/util';
7
8
 
8
- export const SECTION_IDENTIFIER = 'org.dxos.type.stackSection';
9
+ export const SECTION_IDENTIFIER = DXN.make('org.dxos.type.stackSection');
9
10
 
10
- export const meta: Plugin.Meta = {
11
- id: 'org.dxos.plugin.stack',
11
+ export const meta = Plugin.makeMeta({
12
+ key: DXN.make('org.dxos.plugin.stack'),
12
13
  // TODO(wittjosiah): Prevents "stacks" language from being exposed to users in settings panel.
13
14
  // Conside renaming this to the collection plugin and trying to factor more collections logic from the space plugin.
14
15
  name: 'Collections',
16
+ author: 'DXOS',
17
+ spec: 'PLUGIN.mdl',
15
18
  description: trim`
16
- Organize and view curated collections of workspace objects in customizable layouts.
17
- Group related items together and manage collections with sections and filtering.
19
+ StackPlugin renders any Collection object as a vertically scrollable stack of collapsible sections in the
20
+ Composer article surface. Each section wraps an arbitrary ECHO object and delegates its content rendering
21
+ to the section surface role, enabling any other plugin to contribute its own section renderer.
22
+
23
+ Sections can be individually collapsed to show only their title, expanded to reveal full content, navigated
24
+ to directly, or removed from the collection. New sections can be inserted before or after any existing
25
+ section via a per-section dropdown menu, or appended via the toolbar Add button.
26
+
27
+ The plugin registers StackViewType with the ECHO schema module so that per-section view metadata
28
+ (height overrides, custom display data) can be stored and replicated alongside the collection.
29
+
30
+ A settings panel exposes a separation toggle that controls whether visual dividers are rendered between
31
+ sections.
18
32
  `,
19
33
  icon: 'ph--stack-simple--regular',
20
34
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-stack',
21
- };
35
+ });
package/src/plugin.ts ADDED
@@ -0,0 +1,9 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { Plugin } from '@dxos/app-framework';
6
+
7
+ import { meta } from './meta';
8
+
9
+ export const StackPlugin = Plugin.lazy(meta, () => import('#plugin'));
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { type Resource } from '@dxos/react-ui';
6
- import { translations as stackTranslations } from '@dxos/react-ui-stack';
6
+ import { translations as stackTranslations } from '@dxos/react-ui-stack/translations';
7
7
 
8
8
  import { meta } from '#meta';
9
9
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  import * as Schema from 'effect/Schema';
6
6
 
7
- import { Type } from '@dxos/echo';
7
+ import { DXN, Type } from '@dxos/echo';
8
8
 
9
9
  // All section metadata needs to be optional/have defaults.
10
10
  // Any objects added to the collection will start with the section defaults.
@@ -21,11 +21,6 @@ export const SectionSchema = Schema.Struct({
21
21
  // TODO(wittjosiah): This needs a relation to be connected to a stack.
22
22
  export const StackViewType = Schema.Struct({
23
23
  sections: Schema.Record({ key: Schema.String, value: SectionSchema }),
24
- }).pipe(
25
- Type.object({
26
- typename: 'org.dxos.type.stackView',
27
- version: '0.1.0',
28
- }),
29
- );
24
+ }).pipe(Type.makeObject(DXN.make('org.dxos.type.stackView', '0.1.0')));
30
25
 
31
- export interface StackViewType extends Schema.Schema.Type<typeof StackViewType> {}
26
+ export type StackViewType = Type.InstanceType<typeof StackViewType>;
@@ -4,8 +4,7 @@
4
4
 
5
5
  import { type FC } from 'react';
6
6
 
7
- import { type Obj } from '@dxos/echo';
8
- import { type Collection } from '@dxos/echo';
7
+ import { type Collection, type Obj } from '@dxos/echo';
9
8
  import { type Label } from '@dxos/react-ui';
10
9
  import { type StackItemSize } from '@dxos/react-ui-stack';
11
10
 
@@ -0,0 +1,10 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ //
4
+ // Copyright 2026 DXOS.org
5
+ //
6
+
7
+ declare module '*.mdl?raw' {
8
+ const content: string;
9
+ export default content;
10
+ }
@@ -1,93 +0,0 @@
1
- // src/meta.ts
2
- import { trim } from "@dxos/util";
3
- var SECTION_IDENTIFIER = "org.dxos.type.stackSection";
4
- var meta = {
5
- id: "org.dxos.plugin.stack",
6
- // TODO(wittjosiah): Prevents "stacks" language from being exposed to users in settings panel.
7
- // Conside renaming this to the collection plugin and trying to factor more collections logic from the space plugin.
8
- name: "Collections",
9
- description: trim`
10
- Organize and view curated collections of workspace objects in customizable layouts.
11
- Group related items together and manage collections with sections and filtering.
12
- `,
13
- icon: "ph--stack-simple--regular",
14
- source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-stack"
15
- };
16
-
17
- // src/StackPlugin.ts
18
- import { Plugin } from "@dxos/app-framework";
19
- import { AppPlugin } from "@dxos/app-toolkit";
20
- import { ReactSurface } from "#capabilities";
21
- import { SECTION_IDENTIFIER as SECTION_IDENTIFIER2, meta as meta3 } from "#meta";
22
- import { StackViewType } from "#types";
23
-
24
- // src/translations.ts
25
- import { translations as stackTranslations } from "@dxos/react-ui-stack";
26
- import { meta as meta2 } from "#meta";
27
- var translations = [
28
- {
29
- "en-US": {
30
- [meta2.id]: {
31
- "plugin.name": "Stacks",
32
- "settings.title": "Stack settings",
33
- "settings.separation.label": "Separate sections",
34
- "settings.separation.description": "Add visual dividers between sections in stacks.",
35
- "add-section-beforeAll-dialog.title": "Add a section to the start",
36
- "add-section-afterAll-dialog.title": "Add a section to the end",
37
- "add-section-before-dialog.title": "Add a section",
38
- "add-section-after-dialog.title": "Add a section",
39
- "add-section-input.placeholder": "Find the type of section to add",
40
- "upload-file.label": "Add file",
41
- "add-section.label": "Add section",
42
- "empty-stack.message": "Drag objects into the stack.",
43
- "remove-section.label": "Delete",
44
- "navigate-to-section.label": "Navigate to object",
45
- "untitled-section.title": "Untitled section",
46
- "add-section-before.label": "Add before",
47
- "add-section-after.label": "Add after",
48
- "expand.label": "Expand",
49
- "collapse.label": "Collapse",
50
- "open-chat-thread.label": "Open chat thread",
51
- "drag-handle.label": "Press space or enter to begin dragging this object."
52
- }
53
- }
54
- },
55
- ...stackTranslations
56
- ];
57
-
58
- // src/StackPlugin.ts
59
- var StackPlugin = Plugin.define(meta3).pipe(AppPlugin.addMetadataModule({
60
- metadata: {
61
- id: SECTION_IDENTIFIER2,
62
- metadata: {
63
- parse: (section, type) => {
64
- switch (type) {
65
- case "node":
66
- return {
67
- id: section.object.id,
68
- label: section.object.title,
69
- data: section.object
70
- };
71
- case "object":
72
- return section.object;
73
- case "view-object":
74
- return section;
75
- }
76
- }
77
- }
78
- }
79
- }), AppPlugin.addSchemaModule({
80
- schema: [
81
- StackViewType
82
- ]
83
- }), AppPlugin.addSurfaceModule({
84
- activate: ReactSurface
85
- }), AppPlugin.addTranslationsModule({
86
- translations
87
- }), Plugin.make);
88
- export {
89
- SECTION_IDENTIFIER,
90
- StackPlugin,
91
- meta
92
- };
93
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.ts", "../../../src/StackPlugin.ts", "../../../src/translations.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const SECTION_IDENTIFIER = 'org.dxos.type.stackSection';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.stack',\n // TODO(wittjosiah): Prevents \"stacks\" language from being exposed to users in settings panel.\n // Conside renaming this to the collection plugin and trying to factor more collections logic from the space plugin.\n name: 'Collections',\n description: trim`\n Organize and view curated collections of workspace objects in customizable layouts.\n Group related items together and manage collections with sections and filtering.\n `,\n icon: 'ph--stack-simple--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-stack',\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { type Obj } from '@dxos/echo';\n\nimport { ReactSurface } from '#capabilities';\nimport { SECTION_IDENTIFIER, meta } from '#meta';\nimport { StackViewType } from '#types';\n\nimport { translations } from './translations';\n\nexport const StackPlugin = Plugin.define(meta).pipe(\n AppPlugin.addMetadataModule({\n metadata: {\n id: SECTION_IDENTIFIER,\n metadata: {\n parse: (section: { object: Obj.Unknown }, type: string) => {\n switch (type) {\n case 'node':\n return { id: section.object.id, label: (section.object as any).title, data: section.object };\n case 'object':\n return section.object;\n case 'view-object':\n return section;\n }\n },\n },\n },\n }),\n AppPlugin.addSchemaModule({ schema: [StackViewType] }),\n AppPlugin.addSurfaceModule({ activate: ReactSurface }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.make,\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\nimport { translations as stackTranslations } from '@dxos/react-ui-stack';\n\nimport { meta } from '#meta';\n\nexport const translations = [\n {\n 'en-US': {\n [meta.id]: {\n 'plugin.name': 'Stacks',\n 'settings.title': 'Stack settings',\n 'settings.separation.label': 'Separate sections',\n 'settings.separation.description': 'Add visual dividers between sections in stacks.',\n 'add-section-beforeAll-dialog.title': 'Add a section to the start',\n 'add-section-afterAll-dialog.title': 'Add a section to the end',\n 'add-section-before-dialog.title': 'Add a section',\n 'add-section-after-dialog.title': 'Add a section',\n 'add-section-input.placeholder': 'Find the type of section to add',\n 'upload-file.label': 'Add file',\n 'add-section.label': 'Add section',\n 'empty-stack.message': 'Drag objects into the stack.',\n 'remove-section.label': 'Delete',\n 'navigate-to-section.label': 'Navigate to object',\n 'untitled-section.title': 'Untitled section',\n 'add-section-before.label': 'Add before',\n 'add-section-after.label': 'Add after',\n 'expand.label': 'Expand',\n 'collapse.label': 'Collapse',\n 'open-chat-thread.label': 'Open chat thread',\n 'drag-handle.label': 'Press space or enter to begin dragging this object.',\n },\n },\n },\n ...stackTranslations,\n] as const satisfies Resource[];\n"],
5
- "mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,qBAAqB;AAE3B,IAAMC,OAAoB;EAC/BC,IAAI;;;EAGJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,QAAQ;AACV;;;AChBA,SAASC,cAAc;AACvB,SAASC,iBAAiB;AAG1B,SAASC,oBAAoB;AAC7B,SAASC,sBAAAA,qBAAoBC,QAAAA,aAAY;AACzC,SAASC,qBAAqB;;;ACL9B,SAASC,gBAAgBC,yBAAyB;AAElD,SAASC,QAAAA,aAAY;AAEd,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACC,MAAKC,EAAE,GAAG;QACT,eAAe;QACf,kBAAkB;QAClB,6BAA6B;QAC7B,mCAAmC;QACnC,sCAAsC;QACtC,qCAAqC;QACrC,mCAAmC;QACnC,kCAAkC;QAClC,iCAAiC;QACjC,qBAAqB;QACrB,qBAAqB;QACrB,uBAAuB;QACvB,wBAAwB;QACxB,6BAA6B;QAC7B,0BAA0B;QAC1B,4BAA4B;QAC5B,2BAA2B;QAC3B,gBAAgB;QAChB,kBAAkB;QAClB,0BAA0B;QAC1B,qBAAqB;MACvB;IACF;EACF;KACGC;;;;ADvBE,IAAMC,cAAcC,OAAOC,OAAOC,KAAAA,EAAMC,KAC7CC,UAAUC,kBAAkB;EAC1BC,UAAU;IACRC,IAAIC;IACJF,UAAU;MACRG,OAAO,CAACC,SAAkCC,SAAAA;AACxC,gBAAQA,MAAAA;UACN,KAAK;AACH,mBAAO;cAAEJ,IAAIG,QAAQE,OAAOL;cAAIM,OAAQH,QAAQE,OAAeE;cAAOC,MAAML,QAAQE;YAAO;UAC7F,KAAK;AACH,mBAAOF,QAAQE;UACjB,KAAK;AACH,mBAAOF;QACX;MACF;IACF;EACF;AACF,CAAA,GACAN,UAAUY,gBAAgB;EAAEC,QAAQ;IAACC;;AAAe,CAAA,GACpDd,UAAUe,iBAAiB;EAAEC,UAAUC;AAAa,CAAA,GACpDjB,UAAUkB,sBAAsB;EAAEC;AAAa,CAAA,GAC/CvB,OAAOwB,IAAI;",
6
- "names": ["trim", "SECTION_IDENTIFIER", "meta", "id", "name", "description", "trim", "icon", "source", "Plugin", "AppPlugin", "ReactSurface", "SECTION_IDENTIFIER", "meta", "StackViewType", "translations", "stackTranslations", "meta", "translations", "meta", "id", "stackTranslations", "StackPlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addMetadataModule", "metadata", "id", "SECTION_IDENTIFIER", "parse", "section", "type", "object", "label", "title", "data", "addSchemaModule", "schema", "StackViewType", "addSurfaceModule", "activate", "ReactSurface", "addTranslationsModule", "translations", "make"]
7
- }
@@ -1 +0,0 @@
1
- {"inputs":{"src/meta.ts":{"bytes":2522,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/translations.ts":{"bytes":4677,"imports":[{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true}],"format":"esm"},"src/StackPlugin.ts":{"bytes":4331,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"#capabilities","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"#types","kind":"import-statement","external":true},{"path":"src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"src/index.ts":{"bytes":547,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/StackPlugin.ts","kind":"import-statement","original":"./StackPlugin"}],"format":"esm"},"src/types/stack.ts":{"bytes":3750,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"format":"esm"},"src/types/index.ts":{"bytes":499,"imports":[{"path":"src/types/stack.ts","kind":"import-statement","original":"./stack"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5417},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"#capabilities","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"#types","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true}],"exports":["SECTION_IDENTIFIER","StackPlugin","meta"],"entryPoint":"src/index.ts","inputs":{"src/meta.ts":{"bytesInOutput":695},"src/index.ts":{"bytesInOutput":0},"src/StackPlugin.ts":{"bytesInOutput":967},"src/translations.ts":{"bytesInOutput":1401}},"bytes":3239},"dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1764},"dist/lib/browser/types/index.mjs":{"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"exports":["SectionSchema","StackViewType"],"entryPoint":"src/types/index.ts","inputs":{"src/types/stack.ts":{"bytesInOutput":575},"src/types/index.ts":{"bytesInOutput":0}},"bytes":677}}}
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/types/stack.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Type } from '@dxos/echo';\n\n// All section metadata needs to be optional/have defaults.\n// Any objects added to the collection will start with the section defaults.\n// If an object is removed from the collection without removing the section metadata this is fine.\n// Stack components should clean-up the superfluous data on future edits.\n\nexport const SectionSchema = Schema.Struct({\n height: Schema.optional(Schema.Number),\n // Space for data that isn't stack-specific but is specific to this view instance.\n // e.g. cover/fill for an image\n custom: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),\n});\n\n// TODO(wittjosiah): This needs a relation to be connected to a stack.\nexport const StackViewType = Schema.Struct({\n sections: Schema.Record({ key: Schema.String, value: SectionSchema }),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.stackView',\n version: '0.1.0',\n }),\n);\n\nexport interface StackViewType extends Schema.Schema.Type<typeof StackViewType> {}\n"],
5
- "mappings": ";AAIA,YAAYA,YAAY;AAExB,SAASC,YAAY;AAOd,IAAMC,gBAAuBC,cAAO;EACzCC,QAAeC,gBAAgBC,aAAM;;;EAGrCC,QAAeF,gBAAgBG,cAAO;IAAEC,KAAYC;IAAQC,OAAcC;EAAI,CAAA,CAAA;AAChF,CAAA;AAGO,IAAMC,gBAAuBV,cAAO;EACzCW,UAAiBN,cAAO;IAAEC,KAAYC;IAAQC,OAAOT;EAAc,CAAA;AACrE,CAAA,EAAGa,KACDC,KAAKC,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,CAAA;",
6
- "names": ["Schema", "Type", "SectionSchema", "Struct", "height", "optional", "Number", "custom", "Record", "key", "String", "value", "Any", "StackViewType", "sections", "pipe", "Type", "object", "typename", "version"]
7
- }