@dxos/plugin-stack 0.7.4 → 0.7.5-labs.071a3e2

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 (66) hide show
  1. package/dist/lib/browser/StackMain-RKYIGXZ7.mjs +296 -0
  2. package/dist/lib/browser/StackMain-RKYIGXZ7.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-DS5KGEJG.mjs → chunk-WTGFKPPQ.mjs} +3 -3
  4. package/dist/lib/browser/chunk-WTGFKPPQ.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +79 -236
  6. package/dist/lib/browser/index.mjs.map +4 -4
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/node/StackMain-6XIWVZUN.cjs +310 -0
  9. package/dist/lib/node/StackMain-6XIWVZUN.cjs.map +7 -0
  10. package/dist/lib/node/{chunk-PA5PRDM6.cjs → chunk-CZCFFT2J.cjs} +7 -7
  11. package/dist/lib/node/chunk-CZCFFT2J.cjs.map +7 -0
  12. package/dist/lib/node/index.cjs +80 -231
  13. package/dist/lib/node/index.cjs.map +4 -4
  14. package/dist/lib/node/meta.json +1 -1
  15. package/dist/lib/node-esm/StackMain-NAW7ZBKW.mjs +297 -0
  16. package/dist/lib/node-esm/StackMain-NAW7ZBKW.mjs.map +7 -0
  17. package/dist/lib/node-esm/{chunk-JEQMG2E2.mjs → chunk-SJU6TPRI.mjs} +3 -3
  18. package/dist/lib/node-esm/chunk-SJU6TPRI.mjs.map +7 -0
  19. package/dist/lib/node-esm/index.mjs +79 -236
  20. package/dist/lib/node-esm/index.mjs.map +4 -4
  21. package/dist/lib/node-esm/meta.json +1 -1
  22. package/dist/types/src/StackPlugin.d.ts +1 -3
  23. package/dist/types/src/StackPlugin.d.ts.map +1 -1
  24. package/dist/types/src/components/StackMain.d.ts.map +1 -1
  25. package/dist/types/src/components/StackSection.d.ts.map +1 -1
  26. package/dist/types/src/components/index.d.ts +1 -2
  27. package/dist/types/src/components/index.d.ts.map +1 -1
  28. package/dist/types/src/index.d.ts +1 -3
  29. package/dist/types/src/index.d.ts.map +1 -1
  30. package/dist/types/src/meta.d.ts +1 -2
  31. package/dist/types/src/meta.d.ts.map +1 -1
  32. package/dist/types/src/types/stack.d.ts +6 -12
  33. package/dist/types/src/types/stack.d.ts.map +1 -1
  34. package/dist/types/src/types/types.d.ts +2 -17
  35. package/dist/types/src/types/types.d.ts.map +1 -1
  36. package/dist/types/tsconfig.tsbuildinfo +1 -0
  37. package/package.json +24 -33
  38. package/src/StackPlugin.tsx +53 -73
  39. package/src/components/StackMain.tsx +75 -79
  40. package/src/components/StackSection.tsx +3 -5
  41. package/src/components/StackSettings.tsx +3 -3
  42. package/src/components/index.ts +0 -1
  43. package/src/index.ts +1 -6
  44. package/src/meta.ts +1 -1
  45. package/src/types/types.ts +2 -31
  46. package/dist/lib/browser/StackMain-4D4J4IRK.mjs +0 -391
  47. package/dist/lib/browser/StackMain-4D4J4IRK.mjs.map +0 -7
  48. package/dist/lib/browser/chunk-DS5KGEJG.mjs.map +0 -7
  49. package/dist/lib/browser/meta.mjs +0 -11
  50. package/dist/lib/browser/meta.mjs.map +0 -7
  51. package/dist/lib/node/StackMain-V7C55NCF.cjs +0 -403
  52. package/dist/lib/node/StackMain-V7C55NCF.cjs.map +0 -7
  53. package/dist/lib/node/chunk-PA5PRDM6.cjs.map +0 -7
  54. package/dist/lib/node/meta.cjs +0 -32
  55. package/dist/lib/node/meta.cjs.map +0 -7
  56. package/dist/lib/node-esm/StackMain-5I43UWGF.mjs +0 -392
  57. package/dist/lib/node-esm/StackMain-5I43UWGF.mjs.map +0 -7
  58. package/dist/lib/node-esm/chunk-JEQMG2E2.mjs.map +0 -7
  59. package/dist/lib/node-esm/meta.mjs +0 -12
  60. package/dist/lib/node-esm/meta.mjs.map +0 -7
  61. package/dist/types/src/components/AddSection.d.ts +0 -6
  62. package/dist/types/src/components/AddSection.d.ts.map +0 -1
  63. package/dist/types/src/components/AddSectionDialog.d.ts +0 -14
  64. package/dist/types/src/components/AddSectionDialog.d.ts.map +0 -1
  65. package/src/components/AddSection.tsx +0 -102
  66. package/src/components/AddSectionDialog.tsx +0 -128
@@ -3,18 +3,12 @@ export declare const SectionSchema: S.Struct<{
3
3
  height: S.optional<typeof S.Number>;
4
4
  custom: S.optional<S.Record$<typeof S.String, typeof S.Any>>;
5
5
  }>;
6
- declare const StackViewType_base: import("@dxos/echo-schema").AbstractTypedObject<{
7
- sections: {
8
- [x: string]: {
9
- readonly height?: number | undefined;
10
- readonly custom?: {
11
- readonly [x: string]: any;
12
- } | undefined;
13
- };
14
- };
15
- } & {
16
- id: string;
17
- }, S.Struct.Encoded<{
6
+ declare const StackViewType_base: import("@dxos/echo-schema").TypedObjectPrototype<import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectFields<{
7
+ sections: S.mutable<S.Record$<typeof S.String, S.Struct<{
8
+ height: S.optional<typeof S.Number>;
9
+ custom: S.optional<S.Record$<typeof S.String, typeof S.Any>>;
10
+ }>>>;
11
+ }, import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectOptions>, S.Struct.Encoded<{
18
12
  sections: S.mutable<S.Record$<typeof S.String, S.Struct<{
19
13
  height: S.optional<typeof S.Number>;
20
14
  custom: S.optional<S.Record$<typeof S.String, typeof S.Any>>;
@@ -1 +1 @@
1
- {"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../../src/types/stack.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;AAOnD,eAAO,MAAM,aAAa;;;EAKxB,CAAC;;;;;;;;;;;;;;;;;;AAGH,qBAAa,aAAc,SAAQ,kBAEjC;CAAG"}
1
+ {"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../../src/types/stack.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;AAOnD,eAAO,MAAM,aAAa;;;EAKxB,CAAC;;;;;;;;;;;;AAGH,qBAAa,aAAc,SAAQ,kBAEjC;CAAG"}
@@ -1,8 +1,7 @@
1
1
  import { type IconProps } from '@phosphor-icons/react';
2
2
  import { type FC } from 'react';
3
- import type { Intent, MetadataRecordsProvides, SettingsProvides, SurfaceProvides, TranslationsProvides } from '@dxos/app-framework';
4
- import { type SchemaProvides } from '@dxos/plugin-space';
5
3
  import { type CollectionType } from '@dxos/plugin-space/types';
4
+ import { type ReactiveEchoObject } from '@dxos/react-client/echo';
6
5
  import { type Label } from '@dxos/react-ui';
7
6
  import { type StackItemSize } from '@dxos/react-ui-stack';
8
7
  export type AddSectionPosition = 'before' | 'after' | 'beforeAll' | 'afterAll';
@@ -33,26 +32,12 @@ export type StackSectionMetadata = {
33
32
  };
34
33
  export type StackSectionItem = {
35
34
  id: string;
36
- object: CollectionType['objects'][number];
35
+ object: ReactiveEchoObject<any>;
37
36
  view: StackSectionView;
38
37
  metadata: StackSectionMetadata;
39
38
  };
40
- export type StackSectionCreator = StackSectionAction & {
41
- intent: Intent | Intent[];
42
- };
43
- export type StackProvides = {
44
- stack: {
45
- creators?: StackSectionCreator[];
46
- };
47
- };
48
- export type StackState = {
49
- creators: StackSectionCreator[];
50
- };
51
39
  export type StackSettingsProps = {
52
40
  separation: boolean;
53
41
  };
54
- export type StackPluginProvides = SurfaceProvides & MetadataRecordsProvides & SettingsProvides<StackSettingsProps> & TranslationsProvides & SchemaProvides & {
55
- stack: StackState;
56
- };
57
42
  export {};
58
43
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,KAAK,EACV,MAAM,EACN,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACrB,MAA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O,CAAA;CAAE,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":"5.7.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-stack",
3
- "version": "0.7.4",
3
+ "version": "0.7.5-labs.071a3e2",
4
4
  "description": "DXOS Surface plugin for Stack entities",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -13,11 +13,6 @@
13
13
  "browser": "./dist/lib/browser/index.mjs",
14
14
  "node": "./dist/lib/node-esm/index.mjs"
15
15
  },
16
- "./meta": {
17
- "types": "./dist/types/src/meta.d.ts",
18
- "browser": "./dist/lib/browser/meta.mjs",
19
- "node": "./dist/lib/node-esm/meta.mjs"
20
- },
21
16
  "./types": {
22
17
  "types": "./dist/types/src/types/index.d.ts",
23
18
  "browser": "./dist/lib/browser/types/index.mjs",
@@ -27,9 +22,6 @@
27
22
  "types": "dist/types/src/index.d.ts",
28
23
  "typesVersions": {
29
24
  "*": {
30
- "meta": [
31
- "dist/types/src/meta.d.ts"
32
- ],
33
25
  "types": [
34
26
  "dist/types/src/types/index.d.ts"
35
27
  ]
@@ -41,28 +33,27 @@
41
33
  ],
42
34
  "dependencies": {
43
35
  "@effect/schema": "^0.75.5",
44
- "@fluentui/react-tabster": "^9.19.0",
36
+ "@fluentui/react-tabster": "9.23.3",
45
37
  "@preact/signals-core": "^1.6.0",
46
- "@radix-ui/react-collapsible": "^1.0.2",
38
+ "@radix-ui/react-collapsible": "1.1.3",
47
39
  "node-fetch": "^2.6.0",
48
40
  "react-is": "~18.2.0",
49
- "@dxos/app-framework": "0.7.4",
50
- "@dxos/async": "0.7.4",
51
- "@dxos/client": "0.7.4",
52
- "@dxos/echo-schema": "0.7.4",
53
- "@dxos/invariant": "0.7.4",
54
- "@dxos/local-storage": "0.7.4",
55
- "@dxos/plugin-graph": "0.7.4",
56
- "@dxos/plugin-client": "0.7.4",
57
- "@dxos/plugin-ipfs": "0.7.4",
58
- "@dxos/plugin-space": "0.7.4",
59
- "@dxos/react-client": "0.7.4",
60
- "@dxos/react-ui-attention": "0.7.4",
61
- "@dxos/react-ui-form": "0.7.4",
62
- "@dxos/react-ui-mosaic": "0.7.4",
63
- "@dxos/react-ui-stack": "0.7.4",
64
- "@dxos/react-ui-searchlist": "0.7.4",
65
- "@dxos/util": "0.7.4"
41
+ "@dxos/app-framework": "0.7.5-labs.071a3e2",
42
+ "@dxos/async": "0.7.5-labs.071a3e2",
43
+ "@dxos/client": "0.7.5-labs.071a3e2",
44
+ "@dxos/echo-schema": "0.7.5-labs.071a3e2",
45
+ "@dxos/plugin-client": "0.7.5-labs.071a3e2",
46
+ "@dxos/local-storage": "0.7.5-labs.071a3e2",
47
+ "@dxos/invariant": "0.7.5-labs.071a3e2",
48
+ "@dxos/plugin-graph": "0.7.5-labs.071a3e2",
49
+ "@dxos/plugin-space": "0.7.5-labs.071a3e2",
50
+ "@dxos/react-client": "0.7.5-labs.071a3e2",
51
+ "@dxos/react-ui-attention": "0.7.5-labs.071a3e2",
52
+ "@dxos/react-ui-form": "0.7.5-labs.071a3e2",
53
+ "@dxos/react-ui-mosaic": "0.7.5-labs.071a3e2",
54
+ "@dxos/react-ui-stack": "0.7.5-labs.071a3e2",
55
+ "@dxos/react-ui-searchlist": "0.7.5-labs.071a3e2",
56
+ "@dxos/util": "0.7.5-labs.071a3e2"
66
57
  },
67
58
  "devDependencies": {
68
59
  "@babel/core": "^7.18.13",
@@ -72,16 +63,16 @@
72
63
  "react": "~18.2.0",
73
64
  "react-dom": "~18.2.0",
74
65
  "vite": "5.4.7",
75
- "@dxos/react-ui-theme": "0.7.4",
76
- "@dxos/react-ui": "0.7.4",
77
- "@dxos/storybook-utils": "0.7.4"
66
+ "@dxos/react-ui": "0.7.5-labs.071a3e2",
67
+ "@dxos/react-ui-theme": "0.7.5-labs.071a3e2",
68
+ "@dxos/storybook-utils": "0.7.5-labs.071a3e2"
78
69
  },
79
70
  "peerDependencies": {
80
71
  "@phosphor-icons/react": "^2.1.5",
81
72
  "react": "~18.2.0",
82
73
  "react-dom": "~18.2.0",
83
- "@dxos/react-ui": "0.7.4",
84
- "@dxos/react-ui-theme": "0.7.4"
74
+ "@dxos/react-ui": "0.7.5-labs.071a3e2",
75
+ "@dxos/react-ui-theme": "0.7.5-labs.071a3e2"
85
76
  },
86
77
  "publishConfig": {
87
78
  "access": "public"
@@ -4,47 +4,37 @@
4
4
 
5
5
  import React from 'react';
6
6
 
7
- import { type Plugin, type PluginDefinition } from '@dxos/app-framework';
8
- import { create, type ReactiveEchoObject, fullyQualifiedId } from '@dxos/client/echo';
9
- import { LocalStorageStore } from '@dxos/local-storage';
7
+ import { Capabilities, contributes, createSurface, defineModule, definePlugin, Events } from '@dxos/app-framework';
8
+ import { type ReactiveEchoObject, fullyQualifiedId } from '@dxos/client/echo';
9
+ import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
10
10
  import { CollectionType } from '@dxos/plugin-space/types';
11
- import { Main } from '@dxos/react-ui';
12
- import { baseSurface, topbarBlockPaddingStart, bottombarBlockPaddingEnd } from '@dxos/react-ui-theme';
13
11
 
14
- import { StackMain, StackSettings, AddSectionDialog, dataHasAddSectionDialogProps } from './components';
15
- import meta, { SECTION_IDENTIFIER, STACK_PLUGIN } from './meta';
12
+ import { StackMain } from './components';
13
+ import { meta, SECTION_IDENTIFIER, STACK_PLUGIN } from './meta';
16
14
  import translations from './translations';
17
15
  import { StackViewType } from './types';
18
- import { type StackPluginProvides, type StackProvides, type StackState, type StackSettingsProps } from './types';
19
16
 
20
- export const StackPlugin = (): PluginDefinition<StackPluginProvides> => {
21
- const settings = new LocalStorageStore<StackSettingsProps>(STACK_PLUGIN, { separation: true });
22
- const stackState = create<StackState>({ creators: [] });
23
-
24
- return {
25
- meta,
26
- ready: async (plugins) => {
27
- settings.prop({ key: 'separation', type: LocalStorageStore.bool() });
28
-
29
- for (const plugin of plugins) {
30
- if (plugin.meta.id === STACK_PLUGIN) {
31
- continue;
32
- }
33
-
34
- if (Array.isArray((plugin as Plugin<StackProvides>).provides?.stack?.creators)) {
35
- stackState.creators.push(...((plugin as Plugin<StackProvides>).provides.stack.creators ?? []));
36
- }
37
- }
38
- },
39
- provides: {
40
- settings: settings.values,
41
- metadata: {
42
- records: {
43
- [StackViewType.typename]: {
17
+ export const StackPlugin = () =>
18
+ definePlugin(meta, [
19
+ defineModule({
20
+ id: `${meta.id}/module/translations`,
21
+ activatesOn: Events.SetupTranslations,
22
+ activate: () => contributes(Capabilities.Translations, translations),
23
+ }),
24
+ defineModule({
25
+ id: `${meta.id}/module/metadata`,
26
+ activatesOn: Events.SetupMetadata,
27
+ activate: () => [
28
+ contributes(Capabilities.Metadata, {
29
+ id: StackViewType.typename,
30
+ metadata: {
44
31
  placeholder: ['stack title placeholder', { ns: STACK_PLUGIN }],
45
32
  icon: 'ph--stack-simple--regular',
46
33
  },
47
- [SECTION_IDENTIFIER]: {
34
+ }),
35
+ contributes(Capabilities.Metadata, {
36
+ id: SECTION_IDENTIFIER,
37
+ metadata: {
48
38
  parse: (section: { object: ReactiveEchoObject<any> }, type: string) => {
49
39
  switch (type) {
50
40
  case 'node':
@@ -57,45 +47,35 @@ export const StackPlugin = (): PluginDefinition<StackPluginProvides> => {
57
47
  }
58
48
  },
59
49
  },
60
- },
61
- },
62
- translations,
63
- echo: {
64
- system: [StackViewType],
65
- },
66
- surface: {
67
- component: ({ data, role }) => {
68
- switch (data.component) {
69
- case `${STACK_PLUGIN}/AddSectionDialog`:
70
- return dataHasAddSectionDialogProps(data) ? <AddSectionDialog {...data.subject} /> : null;
71
- }
72
-
73
- const primary = data.active ?? data.object;
74
- // This allows the id to be overridden by the surface for situations where the id of the collection
75
- // is not the same as the id of what is being represented (e.g., a space with a root collection).
76
- const id = typeof data.id === 'string' ? data.id : undefined;
77
- switch (role) {
78
- case 'main':
79
- return primary instanceof CollectionType ? (
80
- <Main.Content bounce classNames={[baseSurface, topbarBlockPaddingStart, bottombarBlockPaddingEnd]}>
81
- <StackMain id={id ?? fullyQualifiedId(primary)} collection={primary} />
82
- </Main.Content>
83
- ) : null;
84
- case 'article':
85
- return primary instanceof CollectionType ? (
50
+ }),
51
+ ],
52
+ }),
53
+ defineModule({
54
+ id: `${meta.id}/module/schema`,
55
+ activatesOn: ClientEvents.SetupSchema,
56
+ activate: () => contributes(ClientCapabilities.SystemSchema, [StackViewType]),
57
+ }),
58
+ defineModule({
59
+ id: `${meta.id}/module/react-surface`,
60
+ activatesOn: Events.SetupSurfaces,
61
+ activate: () =>
62
+ contributes(
63
+ Capabilities.ReactSurface,
64
+ createSurface({
65
+ id: `${STACK_PLUGIN}/article`,
66
+ role: 'article',
67
+ filter: (data): data is { id?: string; subject: CollectionType } => data.subject instanceof CollectionType,
68
+ component: ({ data }) => {
69
+ // This allows the id to be overridden by the surface for situations where the id of the collection
70
+ // is not the same as the id of what is being represented (e.g., a space with a root collection).
71
+ const id = typeof data.id === 'string' ? data.id : undefined;
72
+ return (
86
73
  <div role='none' className='overflow-auto' style={{ contain: 'layout' }}>
87
- <StackMain id={id ?? fullyQualifiedId(primary)} collection={primary} />
74
+ <StackMain id={id ?? fullyQualifiedId(data.subject)} collection={data.subject} />
88
75
  </div>
89
- ) : null;
90
- case 'settings': {
91
- return data.plugin === meta.id ? <StackSettings settings={settings.values} /> : null;
92
- }
93
- default:
94
- return null;
95
- }
96
- },
97
- },
98
- stack: stackState,
99
- },
100
- };
101
- };
76
+ );
77
+ },
78
+ }),
79
+ ),
80
+ }),
81
+ ]);
@@ -3,25 +3,24 @@
3
3
  //
4
4
 
5
5
  import { Plus } from '@phosphor-icons/react';
6
- import React, { useEffect, useMemo, useState } from 'react';
6
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
7
7
 
8
8
  import {
9
+ Capabilities,
10
+ createIntent,
9
11
  LayoutAction,
10
- NavigationAction,
11
- parseMetadataResolverPlugin,
12
+ useAppGraph,
13
+ useCapabilities,
12
14
  useIntentDispatcher,
13
- useResolvePlugin,
14
15
  } from '@dxos/app-framework';
15
- import { create, getType, fullyQualifiedId } from '@dxos/client/echo';
16
- import { useGraph } from '@dxos/plugin-graph';
17
- import { SpaceAction } from '@dxos/plugin-space';
16
+ import { create, getType, fullyQualifiedId, isReactiveObject, makeRef } from '@dxos/client/echo';
17
+ import { SpaceAction } from '@dxos/plugin-space/types';
18
18
  import { type CollectionType } from '@dxos/plugin-space/types';
19
19
  import { Button, toLocalizedString, useTranslation } from '@dxos/react-ui';
20
20
  import { AttentionProvider } from '@dxos/react-ui-attention';
21
21
  import { Stack } from '@dxos/react-ui-stack';
22
22
  import { nonNullable } from '@dxos/util';
23
23
 
24
- import { AddSection } from './AddSection';
25
24
  import { StackContext } from './StackContext';
26
25
  import { StackSection } from './StackSection';
27
26
  import { STACK_PLUGIN } from '../meta';
@@ -40,17 +39,17 @@ type StackMainProps = {
40
39
  };
41
40
 
42
41
  const StackMain = ({ id, collection }: StackMainProps) => {
43
- const dispatch = useIntentDispatcher();
44
- const { graph } = useGraph();
42
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
43
+ const { graph } = useAppGraph();
45
44
  const { t } = useTranslation(STACK_PLUGIN);
46
- const metadataPlugin = useResolvePlugin(parseMetadataResolverPlugin);
45
+ const allMetadata = useCapabilities(Capabilities.Metadata);
47
46
  const defaultStack = useMemo(() => create(StackViewType, { sections: {} }), [collection]);
48
- const stack = (collection.views[StackViewType.typename] as StackViewType) ?? defaultStack;
47
+ const stack = (collection.views[StackViewType.typename]?.target as StackViewType | undefined) ?? defaultStack;
49
48
  const [collapsedSections, setCollapsedSections] = useState<CollapsedSections>({});
50
49
 
51
50
  useEffect(() => {
52
51
  if (!collection.views[StackViewType.typename]) {
53
- collection.views[StackViewType.typename] = stack;
52
+ collection.views[StackViewType.typename] = makeRef(stack);
54
53
  }
55
54
  }, [collection, stack]);
56
55
 
@@ -58,11 +57,11 @@ const StackMain = ({ id, collection }: StackMainProps) => {
58
57
  collection.objects
59
58
  // TODO(wittjosiah): Should the database handle this differently?
60
59
  // TODO(wittjosiah): Render placeholders for missing objects so they can be removed from the stack?
60
+ .map((object) => object.target)
61
61
  .filter(nonNullable)
62
62
  .map((object) => {
63
- const metadata = metadataPlugin?.provides.metadata.resolver(
64
- getType(object)?.objectId ?? 'never',
65
- ) as StackSectionMetadata;
63
+ const metadata = allMetadata.find((m) => m.id === (getType(object)?.objectId ?? 'never'))
64
+ ?.metadata as StackSectionMetadata;
66
65
  const view = {
67
66
  ...stack.sections[object.id],
68
67
  collapsed: collapsedSections[fullyQualifiedId(object)],
@@ -72,46 +71,60 @@ const StackMain = ({ id, collection }: StackMainProps) => {
72
71
  return { id: fullyQualifiedId(object), object, metadata, view } satisfies StackSectionItem;
73
72
  }) ?? [];
74
73
 
75
- const handleDelete = async (id: string) => {
76
- const index = collection.objects.filter(nonNullable).findIndex((section) => fullyQualifiedId(section) === id);
77
- if (index >= 0) {
78
- await dispatch({
79
- action: SpaceAction.REMOVE_OBJECTS,
80
- data: { objects: [collection.objects[index]], collection },
81
- });
74
+ const handleDelete = useCallback(
75
+ async (id: string) => {
76
+ const index = collection.objects
77
+ .map((object) => object.target)
78
+ .filter(nonNullable)
79
+ .findIndex((section) => fullyQualifiedId(section) === id);
80
+ const object = collection.objects[index].target;
81
+ if (isReactiveObject(object)) {
82
+ await dispatch(createIntent(SpaceAction.RemoveObjects, { objects: [object], target: collection }));
82
83
 
83
- // TODO(wittjosiah): The section should also be removed, but needs to be restored if the action is undone.
84
- // delete stack.sections[Path.last(path)];
85
- }
86
- };
87
-
88
- const handleAdd = (id: string, position: AddSectionPosition) => {
89
- void dispatch?.({
90
- action: LayoutAction.SET_LAYOUT,
91
- data: {
92
- element: 'dialog',
93
- component: `${STACK_PLUGIN}/AddSectionDialog`,
94
- subject: { path: id, position, collection },
95
- },
96
- });
97
- };
98
-
99
- const handleNavigate = async (id: string) => {
100
- await dispatch([
101
- {
102
- action: NavigationAction.OPEN,
103
- data: { activeParts: { main: [id] } },
104
- },
105
- {
106
- action: LayoutAction.SCROLL_INTO_VIEW,
107
- data: { id },
108
- },
109
- ]);
110
- };
111
-
112
- const handleCollapse = (id: string, collapsed: boolean) => {
113
- setCollapsedSections((prev) => ({ ...prev, [id]: collapsed }));
114
- };
84
+ // TODO(wittjosiah): The section should also be removed, but needs to be restored if the action is undone.
85
+ // delete stack.sections[Path.last(path)];
86
+ }
87
+ },
88
+ [collection, dispatch],
89
+ );
90
+
91
+ const handleAdd = useCallback(
92
+ async (id: string, position: AddSectionPosition) => {
93
+ await dispatch?.(
94
+ // TODO(wittjosiah): Use object creation dialog.
95
+ createIntent(LayoutAction.UpdateDialog, {
96
+ part: 'dialog',
97
+ subject: `${STACK_PLUGIN}/AddSectionDialog`,
98
+ options: {
99
+ blockAlign: 'start',
100
+ props: {
101
+ path: id,
102
+ position,
103
+ collection,
104
+ },
105
+ },
106
+ }),
107
+ );
108
+ },
109
+ [collection, dispatch],
110
+ );
111
+
112
+ const handleNavigate = useCallback(
113
+ async (id: string) => {
114
+ await dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [id] }));
115
+ },
116
+ [dispatch],
117
+ );
118
+
119
+ const handleCollapse = useCallback(
120
+ (id: string, collapsed: boolean) => setCollapsedSections((prev) => ({ ...prev, [id]: collapsed })),
121
+ [],
122
+ );
123
+
124
+ const handleAddSection = useCallback(
125
+ () => dispatch?.(createIntent(SpaceAction.OpenCreateObject, { target: collection, navigable: false })),
126
+ [collection, dispatch],
127
+ );
115
128
 
116
129
  return (
117
130
  <AttentionProvider id={id}>
@@ -123,35 +136,18 @@ const StackMain = ({ id, collection }: StackMainProps) => {
123
136
  onAdd: handleAdd,
124
137
  }}
125
138
  >
126
- <Stack orientation='vertical' size='intrinsic' separators={false} id={id} data-testid='main.stack'>
139
+ <Stack orientation='vertical' size='intrinsic' id={id} data-testid='main.stack'>
127
140
  {items.map((item) => (
128
141
  <StackSection key={item.id} {...item} />
129
142
  ))}
130
143
  </Stack>
131
144
 
132
- {items.length === 0 ? (
133
- <AddSection collection={collection} />
134
- ) : (
135
- <div role='none' className='flex mlb-2 pli-2 justify-center'>
136
- <Button
137
- data-testid='stack.createSection'
138
- classNames='gap-2'
139
- onClick={() =>
140
- dispatch?.({
141
- action: LayoutAction.SET_LAYOUT,
142
- data: {
143
- element: 'dialog',
144
- component: 'dxos.org/plugin/stack/AddSectionDialog',
145
- subject: { position: 'afterAll', collection },
146
- },
147
- })
148
- }
149
- >
150
- <Plus />
151
- <span className='sr-only'>{t('add section label')}</span>
152
- </Button>
153
- </div>
154
- )}
145
+ <div role='none' className='flex mlb-2 pli-2 justify-center'>
146
+ <Button data-testid='stack.createSection' classNames='gap-2' onClick={handleAddSection}>
147
+ <Plus />
148
+ <span className='sr-only'>{t('add section label')}</span>
149
+ </Button>
150
+ </div>
155
151
  </StackContext.Provider>
156
152
  </AttentionProvider>
157
153
  );
@@ -47,7 +47,7 @@ export const StackSection = ({
47
47
  </StackItem.SigilButton>
48
48
  </DropdownMenu.Trigger>
49
49
  <DropdownMenu.Portal>
50
- <DropdownMenu.Content style={{ zIndex: 70 }}>
50
+ <DropdownMenu.Content>
51
51
  <DropdownMenu.Viewport>
52
52
  {view.collapsed ? (
53
53
  <DropdownMenu.Item onClick={() => onNavigate(id)} data-testid='section.navigate-to'>
@@ -83,7 +83,6 @@ export const StackSection = ({
83
83
  <CollapsiblePrimitive.Trigger asChild>
84
84
  <IconButton
85
85
  iconOnly
86
- tooltipZIndex='70'
87
86
  variant='ghost'
88
87
  label={t('expand label')}
89
88
  icon='ph--caret-up-down--regular'
@@ -93,7 +92,6 @@ export const StackSection = ({
93
92
  ) : (
94
93
  <IconButton
95
94
  iconOnly
96
- tooltipZIndex='70'
97
95
  variant='ghost'
98
96
  onClick={() => onNavigate(id)}
99
97
  label={t('navigate to section label')}
@@ -105,11 +103,11 @@ export const StackSection = ({
105
103
  </div>
106
104
  </StackItem.Heading>
107
105
  <CollapsiblePrimitive.Content>
108
- <Surface role='section' data={{ object }} limit={1} placeholder={<></>} />
106
+ <Surface role='section' data={{ subject: object }} limit={1} placeholder={<></>} />
109
107
  </CollapsiblePrimitive.Content>
110
108
  {view.collapsed && (
111
109
  <StackItem.Content toolbar={false} classNames='attention-surface'>
112
- <h2 className={mx('flex items-center p-4 font-medium is-full', textBlockWidth)}>{view.title}</h2>
110
+ <h2 className={mx('flex items-center p-4 font-medium', textBlockWidth)}>{view.title}</h2>
113
111
  </StackItem.Content>
114
112
  )}
115
113
  </StackItem.Root>
@@ -5,7 +5,7 @@
5
5
  import React from 'react';
6
6
 
7
7
  import { Input, useTranslation } from '@dxos/react-ui';
8
- import { DeprecatedFormInput } from '@dxos/react-ui-form';
8
+ import { DeprecatedFormContainer, DeprecatedFormInput } from '@dxos/react-ui-form';
9
9
 
10
10
  import { STACK_PLUGIN } from '../meta';
11
11
  import { type StackSettingsProps } from '../types';
@@ -14,10 +14,10 @@ export const StackSettings = ({ settings }: { settings: StackSettingsProps }) =>
14
14
  const { t } = useTranslation(STACK_PLUGIN);
15
15
 
16
16
  return (
17
- <>
17
+ <DeprecatedFormContainer>
18
18
  <DeprecatedFormInput label={t('settings separation label')}>
19
19
  <Input.Switch checked={settings.separation} onCheckedChange={(checked) => (settings.separation = !!checked)} />
20
20
  </DeprecatedFormInput>
21
- </>
21
+ </DeprecatedFormContainer>
22
22
  );
23
23
  };
@@ -7,4 +7,3 @@ import { lazy } from 'react';
7
7
  export const StackMain = lazy(() => import('./StackMain'));
8
8
 
9
9
  export * from './StackSettings';
10
- export * from './AddSectionDialog';
package/src/index.ts CHANGED
@@ -2,10 +2,5 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { StackPlugin } from './StackPlugin';
6
-
7
- export default StackPlugin;
8
-
9
- export * from './types';
10
-
5
+ export * from './meta';
11
6
  export * from './StackPlugin';
package/src/meta.ts CHANGED
@@ -7,7 +7,7 @@ import { type PluginMeta } from '@dxos/app-framework';
7
7
  export const STACK_PLUGIN = 'dxos.org/plugin/stack';
8
8
  export const SECTION_IDENTIFIER = 'dxos.org/type/StackSection';
9
9
 
10
- export default {
10
+ export const meta = {
11
11
  id: STACK_PLUGIN,
12
12
  // TODO(wittjosiah): Prevents "stacks" language from being exposed to users in settings panel.
13
13
  // Conside renaming this to the collection plugin and trying to factor more collections logic from the space plugin.