@dxos/plugin-stack 0.8.4-main.406dc2a → 0.8.4-main.52d7546f51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/StackContainer-TFG62M42.mjs +275 -0
- package/dist/lib/browser/StackContainer-TFG62M42.mjs.map +7 -0
- package/dist/lib/browser/{chunk-MS4QSWEZ.mjs → chunk-4X7CK6FM.mjs} +6 -2
- package/dist/lib/browser/chunk-4X7CK6FM.mjs.map +7 -0
- package/dist/lib/browser/{chunk-NHMDZYOB.mjs → chunk-CD32XYEB.mjs} +9 -10
- package/dist/lib/browser/chunk-CD32XYEB.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +38 -53
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-RMMCIEXY.mjs +41 -0
- package/dist/lib/browser/react-surface-RMMCIEXY.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node-esm/StackContainer-G4QUICWO.mjs +276 -0
- package/dist/lib/node-esm/StackContainer-G4QUICWO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ZZFA7HIV.mjs → chunk-26XWE7UY.mjs} +9 -10
- package/dist/lib/node-esm/chunk-26XWE7UY.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-5FDDKAPB.mjs → chunk-HEEGXPSW.mjs} +6 -2
- package/dist/lib/node-esm/chunk-HEEGXPSW.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +38 -53
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-R5QS3JT6.mjs +42 -0
- package/dist/lib/node-esm/react-surface-R5QS3JT6.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/StackPlugin.d.ts +2 -1
- package/dist/types/src/StackPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/StackContainer.d.ts +4 -4
- package/dist/types/src/components/StackContainer.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +7 -5
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +4 -4
- package/dist/types/src/types/stack.d.ts +12 -13
- package/dist/types/src/types/stack.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +3 -3
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +38 -34
- package/src/StackPlugin.ts +23 -38
- package/src/capabilities/index.ts +1 -3
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +34 -0
- package/src/components/StackContainer.tsx +50 -44
- package/src/components/StackSection.tsx +3 -3
- package/src/components/StackSettings.tsx +9 -9
- package/src/meta.ts +7 -3
- package/src/translations.ts +3 -3
- package/src/types/stack.ts +11 -7
- package/src/types/types.ts +3 -3
- package/dist/lib/browser/StackContainer-RFJDTQBT.mjs +0 -297
- package/dist/lib/browser/StackContainer-RFJDTQBT.mjs.map +0 -7
- package/dist/lib/browser/chunk-MS4QSWEZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-NHMDZYOB.mjs.map +0 -7
- package/dist/lib/browser/react-surface-DGGN5OPM.mjs +0 -40
- package/dist/lib/browser/react-surface-DGGN5OPM.mjs.map +0 -7
- package/dist/lib/node-esm/StackContainer-HL6KYBW2.mjs +0 -298
- package/dist/lib/node-esm/StackContainer-HL6KYBW2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5FDDKAPB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZZFA7HIV.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-TEOPQTLH.mjs +0 -41
- package/dist/lib/node-esm/react-surface-TEOPQTLH.mjs.map +0 -7
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/src/capabilities/react-surface.tsx +0 -30
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-stack",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.52d7546f51",
|
|
4
4
|
"description": "DXOS Surface plugin for Stack entities",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"sideEffects": true,
|
|
@@ -35,48 +39,48 @@
|
|
|
35
39
|
"src"
|
|
36
40
|
],
|
|
37
41
|
"dependencies": {
|
|
38
|
-
"@fluentui/react-tabster": "
|
|
39
|
-
"@preact-signals/safe-react": "^0.9.0",
|
|
40
|
-
"@preact/signals-core": "^1.12.1",
|
|
42
|
+
"@fluentui/react-tabster": "9.26.11",
|
|
41
43
|
"@radix-ui/react-collapsible": "1.1.3",
|
|
42
|
-
"effect": "3.
|
|
44
|
+
"effect": "3.19.16",
|
|
43
45
|
"node-fetch": "^2.6.0",
|
|
44
46
|
"react-is": "~19.2.0",
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/app-
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/invariant": "0.8.4-main.
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/plugin-client": "0.8.4-main.
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/plugin-
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/plugin-space": "0.8.4-main.
|
|
56
|
-
"@dxos/react-
|
|
57
|
-
"@dxos/react-ui-
|
|
58
|
-
"@dxos/react-ui-form": "0.8.4-main.
|
|
59
|
-
"@dxos/react-ui-
|
|
60
|
-
"@dxos/schema": "0.8.4-main.
|
|
61
|
-
"@dxos/
|
|
47
|
+
"@dxos/app-framework": "0.8.4-main.52d7546f51",
|
|
48
|
+
"@dxos/app-toolkit": "0.8.4-main.52d7546f51",
|
|
49
|
+
"@dxos/echo": "0.8.4-main.52d7546f51",
|
|
50
|
+
"@dxos/invariant": "0.8.4-main.52d7546f51",
|
|
51
|
+
"@dxos/client": "0.8.4-main.52d7546f51",
|
|
52
|
+
"@dxos/operation": "0.8.4-main.52d7546f51",
|
|
53
|
+
"@dxos/plugin-client": "0.8.4-main.52d7546f51",
|
|
54
|
+
"@dxos/async": "0.8.4-main.52d7546f51",
|
|
55
|
+
"@dxos/plugin-graph": "0.8.4-main.52d7546f51",
|
|
56
|
+
"@dxos/plugin-deck": "0.8.4-main.52d7546f51",
|
|
57
|
+
"@dxos/plugin-space": "0.8.4-main.52d7546f51",
|
|
58
|
+
"@dxos/react-client": "0.8.4-main.52d7546f51",
|
|
59
|
+
"@dxos/react-ui-attention": "0.8.4-main.52d7546f51",
|
|
60
|
+
"@dxos/react-ui-form": "0.8.4-main.52d7546f51",
|
|
61
|
+
"@dxos/react-ui-searchlist": "0.8.4-main.52d7546f51",
|
|
62
|
+
"@dxos/schema": "0.8.4-main.52d7546f51",
|
|
63
|
+
"@dxos/react-ui-stack": "0.8.4-main.52d7546f51",
|
|
64
|
+
"@dxos/types": "0.8.4-main.52d7546f51",
|
|
65
|
+
"@dxos/util": "0.8.4-main.52d7546f51"
|
|
62
66
|
},
|
|
63
67
|
"devDependencies": {
|
|
64
68
|
"@babel/core": "^7.18.13",
|
|
65
|
-
"@types/react": "~19.2.
|
|
66
|
-
"@types/react-dom": "~19.2.
|
|
67
|
-
"react": "~19.2.
|
|
68
|
-
"react-dom": "~19.2.
|
|
69
|
+
"@types/react": "~19.2.7",
|
|
70
|
+
"@types/react-dom": "~19.2.3",
|
|
71
|
+
"react": "~19.2.3",
|
|
72
|
+
"react-dom": "~19.2.3",
|
|
69
73
|
"vite": "7.1.9",
|
|
70
|
-
"@dxos/react-ui
|
|
71
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
72
|
-
"@dxos/
|
|
74
|
+
"@dxos/react-ui": "0.8.4-main.52d7546f51",
|
|
75
|
+
"@dxos/storybook-utils": "0.8.4-main.52d7546f51",
|
|
76
|
+
"@dxos/ui-theme": "0.8.4-main.52d7546f51"
|
|
73
77
|
},
|
|
74
78
|
"peerDependencies": {
|
|
75
|
-
"effect": "
|
|
76
|
-
"react": "
|
|
77
|
-
"react-dom": "
|
|
78
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
79
|
-
"@dxos/
|
|
79
|
+
"effect": "3.19.16",
|
|
80
|
+
"react": "~19.2.3",
|
|
81
|
+
"react-dom": "~19.2.3",
|
|
82
|
+
"@dxos/react-ui": "0.8.4-main.52d7546f51",
|
|
83
|
+
"@dxos/ui-theme": "0.8.4-main.52d7546f51"
|
|
80
84
|
},
|
|
81
85
|
"publishConfig": {
|
|
82
86
|
"access": "public"
|
package/src/StackPlugin.ts
CHANGED
|
@@ -2,50 +2,35 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
6
7
|
import { type Obj } from '@dxos/echo';
|
|
7
|
-
import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
|
|
8
8
|
|
|
9
9
|
import { ReactSurface } from './capabilities';
|
|
10
10
|
import { SECTION_IDENTIFIER, meta } from './meta';
|
|
11
11
|
import { translations } from './translations';
|
|
12
12
|
import { StackViewType } from './types';
|
|
13
13
|
|
|
14
|
-
export const StackPlugin =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
switch (type) {
|
|
29
|
-
case 'node':
|
|
30
|
-
return { id: section.object.id, label: (section.object as any).title, data: section.object };
|
|
31
|
-
case 'object':
|
|
32
|
-
return section.object;
|
|
33
|
-
case 'view-object':
|
|
34
|
-
return section;
|
|
35
|
-
}
|
|
36
|
-
},
|
|
14
|
+
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
|
+
}
|
|
37
28
|
},
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
}),
|
|
41
|
-
defineModule({
|
|
42
|
-
id: `${meta.id}/module/schema`,
|
|
43
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
44
|
-
activate: () => contributes(ClientCapabilities.Schema, [StackViewType]),
|
|
45
|
-
}),
|
|
46
|
-
defineModule({
|
|
47
|
-
id: `${meta.id}/module/react-surface`,
|
|
48
|
-
activatesOn: Events.SetupReactSurface,
|
|
49
|
-
activate: ReactSurface,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
50
31
|
}),
|
|
51
|
-
])
|
|
32
|
+
AppPlugin.addSchemaModule({ schema: [StackViewType] }),
|
|
33
|
+
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
34
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
35
|
+
Plugin.make,
|
|
36
|
+
);
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { Obj } from '@dxos/echo';
|
|
11
|
+
import { Collection } from '@dxos/schema';
|
|
12
|
+
|
|
13
|
+
import { StackContainer } from '../../components';
|
|
14
|
+
import { meta } from '../../meta';
|
|
15
|
+
|
|
16
|
+
export default Capability.makeModule(() =>
|
|
17
|
+
Effect.succeed(
|
|
18
|
+
Capability.contributes(
|
|
19
|
+
Capabilities.ReactSurface,
|
|
20
|
+
Surface.create({
|
|
21
|
+
id: `${meta.id}/article`,
|
|
22
|
+
role: 'article',
|
|
23
|
+
filter: (data): data is { id?: string; subject: Collection.Collection } =>
|
|
24
|
+
Obj.instanceOf(Collection.Collection, data.subject),
|
|
25
|
+
component: ({ role, data }) => {
|
|
26
|
+
// This allows the id to be overridden by the surface for situations where the id of the collection
|
|
27
|
+
// is not the same as the id of what is being represented (e.g., a space with a root collection).
|
|
28
|
+
const id = typeof data.id === 'string' ? data.id : undefined;
|
|
29
|
+
return <StackContainer id={id ?? Obj.getDXN(data.subject).toString()} role={role} subject={data.subject} />;
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
),
|
|
33
|
+
),
|
|
34
|
+
);
|
|
@@ -5,21 +5,17 @@
|
|
|
5
5
|
import * as Option from 'effect/Option';
|
|
6
6
|
import React, { useCallback, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
useAppGraph,
|
|
13
|
-
useCapabilities,
|
|
14
|
-
useIntentDispatcher,
|
|
15
|
-
} from '@dxos/app-framework';
|
|
16
|
-
import { fullyQualifiedId, isLiveObject } from '@dxos/client/echo';
|
|
8
|
+
import { useCapabilities, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
9
|
+
import { AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';
|
|
10
|
+
import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
11
|
+
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
17
12
|
import { Obj } from '@dxos/echo';
|
|
18
|
-
import {
|
|
13
|
+
import { Graph } from '@dxos/plugin-graph';
|
|
14
|
+
import { SpaceOperation } from '@dxos/plugin-space/types';
|
|
19
15
|
import { Toolbar, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
20
16
|
import { AttentionProvider } from '@dxos/react-ui-attention';
|
|
21
17
|
import { Stack, StackItem } from '@dxos/react-ui-stack';
|
|
22
|
-
import { type
|
|
18
|
+
import { type Collection } from '@dxos/schema';
|
|
23
19
|
import { isNonNullable } from '@dxos/util';
|
|
24
20
|
|
|
25
21
|
import { meta } from '../meta';
|
|
@@ -34,16 +30,15 @@ import {
|
|
|
34
30
|
import { StackContext } from './StackContext';
|
|
35
31
|
import { StackSection } from './StackSection';
|
|
36
32
|
|
|
37
|
-
type StackContainerProps = {
|
|
33
|
+
type StackContainerProps = SurfaceComponentProps<Collection.Collection> & {
|
|
38
34
|
id: string;
|
|
39
|
-
collection: DataType.Collection;
|
|
40
35
|
};
|
|
41
36
|
|
|
42
|
-
const StackContainer = ({ id, collection }: StackContainerProps) => {
|
|
43
|
-
const {
|
|
37
|
+
const StackContainer = ({ id, subject: collection }: StackContainerProps) => {
|
|
38
|
+
const { invokePromise } = useOperationInvoker();
|
|
44
39
|
const { graph } = useAppGraph();
|
|
45
40
|
const { t } = useTranslation(meta.id);
|
|
46
|
-
const allMetadata = useCapabilities(
|
|
41
|
+
const allMetadata = useCapabilities(AppCapabilities.Metadata);
|
|
47
42
|
const [collapsedSections, setCollapsedSections] = useState<CollapsedSections>({});
|
|
48
43
|
|
|
49
44
|
// TODO(wittjosiah): Re-implement stack views with relations.
|
|
@@ -66,13 +61,16 @@ const StackContainer = ({ id, collection }: StackContainerProps) => {
|
|
|
66
61
|
?.metadata as StackSectionMetadata;
|
|
67
62
|
const view = {
|
|
68
63
|
// ...stack.sections[object.id],
|
|
69
|
-
collapsed: collapsedSections[
|
|
64
|
+
collapsed: collapsedSections[Obj.getDXN(object).toString()],
|
|
70
65
|
title:
|
|
71
66
|
(object as any)?.title ??
|
|
72
67
|
// TODO(wittjosiah): `getNode` is not reactive.
|
|
73
|
-
toLocalizedString(
|
|
68
|
+
toLocalizedString(
|
|
69
|
+
Graph.getNode(graph, Obj.getDXN(object).toString()).pipe(Option.getOrNull)?.properties.label,
|
|
70
|
+
t,
|
|
71
|
+
),
|
|
74
72
|
} as StackSectionView;
|
|
75
|
-
return { id:
|
|
73
|
+
return { id: Obj.getDXN(object).toString(), object, metadata, view } satisfies StackSectionItem;
|
|
76
74
|
}) ?? [];
|
|
77
75
|
|
|
78
76
|
const handleDelete = useCallback(
|
|
@@ -80,44 +78,42 @@ const StackContainer = ({ id, collection }: StackContainerProps) => {
|
|
|
80
78
|
const index = collection.objects
|
|
81
79
|
.map((object) => object.target)
|
|
82
80
|
.filter(isNonNullable)
|
|
83
|
-
.findIndex((section) =>
|
|
81
|
+
.findIndex((section) => Obj.getDXN(section).toString() === id);
|
|
84
82
|
const object = collection.objects[index].target;
|
|
85
|
-
if (
|
|
86
|
-
await
|
|
83
|
+
if (Obj.isObject(object)) {
|
|
84
|
+
await invokePromise(SpaceOperation.RemoveObjects, {
|
|
85
|
+
objects: [object],
|
|
86
|
+
target: collection,
|
|
87
|
+
});
|
|
87
88
|
|
|
88
89
|
// TODO(wittjosiah): The section should also be removed, but needs to be restored if the action is undone.
|
|
89
90
|
// delete stack.sections[Path.last(path)];
|
|
90
91
|
}
|
|
91
92
|
},
|
|
92
|
-
[collection,
|
|
93
|
+
[collection, invokePromise],
|
|
93
94
|
);
|
|
94
95
|
|
|
95
96
|
const handleAdd = useCallback(
|
|
96
97
|
async (id: string, position: AddSectionPosition) => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
collection,
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
}),
|
|
111
|
-
);
|
|
98
|
+
// TODO(wittjosiah): Use object creation dialog.
|
|
99
|
+
await invokePromise(LayoutOperation.UpdateDialog, {
|
|
100
|
+
subject: `${meta.id}/AddSectionDialog`,
|
|
101
|
+
blockAlign: 'start',
|
|
102
|
+
props: {
|
|
103
|
+
path: id,
|
|
104
|
+
position,
|
|
105
|
+
collection,
|
|
106
|
+
},
|
|
107
|
+
});
|
|
112
108
|
},
|
|
113
|
-
[collection,
|
|
109
|
+
[collection, invokePromise],
|
|
114
110
|
);
|
|
115
111
|
|
|
116
112
|
const handleNavigate = useCallback(
|
|
117
113
|
async (id: string) => {
|
|
118
|
-
await
|
|
114
|
+
await invokePromise(LayoutOperation.Open, { subject: [id] });
|
|
119
115
|
},
|
|
120
|
-
[
|
|
116
|
+
[invokePromise],
|
|
121
117
|
);
|
|
122
118
|
|
|
123
119
|
const handleCollapse = useCallback(
|
|
@@ -126,8 +122,12 @@ const StackContainer = ({ id, collection }: StackContainerProps) => {
|
|
|
126
122
|
);
|
|
127
123
|
|
|
128
124
|
const handleAddSection = useCallback(
|
|
129
|
-
() =>
|
|
130
|
-
|
|
125
|
+
() =>
|
|
126
|
+
invokePromise(SpaceOperation.OpenCreateObject, {
|
|
127
|
+
target: collection,
|
|
128
|
+
navigable: false,
|
|
129
|
+
}),
|
|
130
|
+
[collection, invokePromise],
|
|
131
131
|
);
|
|
132
132
|
|
|
133
133
|
return (
|
|
@@ -136,7 +136,13 @@ const StackContainer = ({ id, collection }: StackContainerProps) => {
|
|
|
136
136
|
classNames='container-max-width overflow-hidden border-l border-r border-subduedSeparator'
|
|
137
137
|
>
|
|
138
138
|
<Toolbar.Root>
|
|
139
|
-
<Toolbar.IconButton
|
|
139
|
+
<Toolbar.IconButton
|
|
140
|
+
icon='ph--plus--regular'
|
|
141
|
+
iconOnly
|
|
142
|
+
label='Add section'
|
|
143
|
+
data-testid='stack.addSection'
|
|
144
|
+
onClick={handleAddSection}
|
|
145
|
+
/>
|
|
140
146
|
</Toolbar.Root>
|
|
141
147
|
<AttentionProvider id={id}>
|
|
142
148
|
<StackContext.Provider
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
6
6
|
import React, { useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { Surface } from '@dxos/app-framework';
|
|
8
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
9
9
|
import { DropdownMenu, Icon, IconButton, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
11
11
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
12
|
-
import { getSize, mx, textBlockWidth } from '@dxos/
|
|
12
|
+
import { getSize, mx, textBlockWidth } from '@dxos/ui-theme';
|
|
13
13
|
|
|
14
14
|
import { meta } from '../meta';
|
|
15
15
|
import { type StackSectionItem } from '../types';
|
|
@@ -107,7 +107,7 @@ export const StackSection = ({
|
|
|
107
107
|
</StackItem.HeadingStickyContent>
|
|
108
108
|
</StackItem.Heading>
|
|
109
109
|
<CollapsiblePrimitive.Content>
|
|
110
|
-
<Surface role='section' data={{ subject: object }} limit={1} placeholder={<></>} />
|
|
110
|
+
<Surface.Surface role='section' data={{ subject: object }} limit={1} placeholder={<></>} />
|
|
111
111
|
</CollapsiblePrimitive.Content>
|
|
112
112
|
{view.collapsed && (
|
|
113
113
|
<StackItem.Content classNames='attention-surface'>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { Input, useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import {
|
|
8
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
9
9
|
|
|
10
10
|
import { meta } from '../meta';
|
|
11
11
|
import { type StackSettingsProps } from '../types';
|
|
@@ -14,17 +14,17 @@ export const StackSettings = ({ settings }: { settings: StackSettingsProps }) =>
|
|
|
14
14
|
const { t } = useTranslation(meta.id);
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
|
-
<
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
<
|
|
17
|
+
<Settings.Root>
|
|
18
|
+
<Settings.Section title={t('settings title', { ns: meta.id })}>
|
|
19
|
+
<Settings.Group>
|
|
20
|
+
<Settings.ItemInput title={t('settings separation label')}>
|
|
21
21
|
<Input.Switch
|
|
22
22
|
checked={settings.separation}
|
|
23
23
|
onCheckedChange={(checked) => (settings.separation = !!checked)}
|
|
24
24
|
/>
|
|
25
|
-
</
|
|
26
|
-
</
|
|
27
|
-
</
|
|
28
|
-
</
|
|
25
|
+
</Settings.ItemInput>
|
|
26
|
+
</Settings.Group>
|
|
27
|
+
</Settings.Section>
|
|
28
|
+
</Settings.Root>
|
|
29
29
|
);
|
|
30
30
|
};
|
package/src/meta.ts
CHANGED
|
@@ -2,16 +2,20 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
8
|
export const SECTION_IDENTIFIER = 'dxos.org/type/StackSection';
|
|
8
9
|
|
|
9
|
-
export const meta:
|
|
10
|
+
export const meta: Plugin.Meta = {
|
|
10
11
|
id: 'dxos.org/plugin/stack',
|
|
11
12
|
// TODO(wittjosiah): Prevents "stacks" language from being exposed to users in settings panel.
|
|
12
13
|
// Conside renaming this to the collection plugin and trying to factor more collections logic from the space plugin.
|
|
13
14
|
name: 'Collections',
|
|
14
|
-
description:
|
|
15
|
+
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.
|
|
18
|
+
`,
|
|
15
19
|
icon: 'ph--stack-simple--regular',
|
|
16
20
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-stack',
|
|
17
21
|
};
|
package/src/translations.ts
CHANGED
|
@@ -21,16 +21,16 @@ export const translations = [
|
|
|
21
21
|
'add section input placeholder': 'Find the type of section to add',
|
|
22
22
|
'upload file label': 'Add file',
|
|
23
23
|
'add section label': 'Add section',
|
|
24
|
-
'empty stack message': 'Drag
|
|
24
|
+
'empty stack message': 'Drag objects into the stack.',
|
|
25
25
|
'remove section label': 'Delete',
|
|
26
|
-
'navigate to section label': 'Navigate to
|
|
26
|
+
'navigate to section label': 'Navigate to object',
|
|
27
27
|
'untitled section title': 'Untitled section',
|
|
28
28
|
'add section before label': 'Add before',
|
|
29
29
|
'add section after label': 'Add after',
|
|
30
30
|
'expand label': 'Expand',
|
|
31
31
|
'collapse label': 'Collapse',
|
|
32
32
|
'open chat thread label': 'Open chat thread',
|
|
33
|
-
'drag handle label': 'Press space or enter to begin dragging this
|
|
33
|
+
'drag handle label': 'Press space or enter to begin dragging this object.',
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
},
|
package/src/types/stack.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { 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.
|
|
@@ -19,9 +19,13 @@ export const SectionSchema = Schema.Struct({
|
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
// TODO(wittjosiah): This needs a relation to be connected to a stack.
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
export const StackViewType = Schema.Struct({
|
|
23
|
+
sections: Schema.Record({ key: Schema.String, value: SectionSchema }),
|
|
24
|
+
}).pipe(
|
|
25
|
+
Type.object({
|
|
26
|
+
typename: 'dxos.org/type/StackView',
|
|
27
|
+
version: '0.1.0',
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export interface StackViewType extends Schema.Schema.Type<typeof StackViewType> {}
|
package/src/types/types.ts
CHANGED
|
@@ -7,13 +7,13 @@ import { type FC } from 'react';
|
|
|
7
7
|
import { type Obj } from '@dxos/echo';
|
|
8
8
|
import { type Label } from '@dxos/react-ui';
|
|
9
9
|
import { type StackItemSize } from '@dxos/react-ui-stack';
|
|
10
|
-
import { type
|
|
10
|
+
import { type Collection } from '@dxos/schema';
|
|
11
11
|
|
|
12
12
|
export type AddSectionPosition = 'before' | 'after' | 'beforeAll' | 'afterAll';
|
|
13
13
|
|
|
14
14
|
export type CollapsedSections = Record<string, boolean>;
|
|
15
15
|
|
|
16
|
-
export type CollectionItem =
|
|
16
|
+
export type CollectionItem = Collection.Collection['objects'][number];
|
|
17
17
|
|
|
18
18
|
export type StackSectionView = {
|
|
19
19
|
title?: string;
|
|
@@ -39,7 +39,7 @@ export type StackSectionMetadata = {
|
|
|
39
39
|
|
|
40
40
|
export type StackSectionItem = {
|
|
41
41
|
id: string;
|
|
42
|
-
object: Obj.
|
|
42
|
+
object: Obj.Unknown;
|
|
43
43
|
view: StackSectionView;
|
|
44
44
|
metadata: StackSectionMetadata;
|
|
45
45
|
};
|