@dxos/plugin-stack 0.8.4-main.4a85c3132b → 0.8.4-main.51f1e5ca51
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/index.mjs +21 -47
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +37 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +21 -4
- package/dist/lib/browser/types/index.mjs.map +4 -4
- package/dist/lib/node-esm/index.mjs +22 -47
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/translations.mjs +39 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +22 -4
- package/dist/lib/node-esm/types/index.mjs.map +4 -4
- package/dist/types/src/capabilities/index.d.ts +2 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/{StackContext.d.ts → StackContext/StackContext.d.ts} +2 -1
- package/dist/types/src/components/StackContext/StackContext.d.ts.map +1 -0
- package/dist/types/src/components/StackContext/index.d.ts +2 -0
- package/dist/types/src/components/StackContext/index.d.ts.map +1 -0
- package/dist/types/src/components/{CaretDownUp.d.ts → StackSection/CaretDownUp.d.ts} +1 -1
- package/dist/types/src/components/StackSection/CaretDownUp.d.ts.map +1 -0
- package/dist/types/src/components/{StackSection.d.ts → StackSection/StackSection.d.ts} +1 -1
- package/dist/types/src/components/StackSection/StackSection.d.ts.map +1 -0
- package/dist/types/src/components/StackSection/index.d.ts +2 -0
- package/dist/types/src/components/StackSection/index.d.ts.map +1 -0
- package/dist/types/src/components/{StackSettings.d.ts → StackSettings/StackSettings.d.ts} +1 -1
- package/dist/types/src/components/StackSettings/StackSettings.d.ts.map +1 -0
- package/dist/types/src/components/StackSettings/index.d.ts +2 -0
- package/dist/types/src/components/StackSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/StackContainer/StackContainer.d.ts +3 -5
- package/dist/types/src/containers/StackContainer/StackContainer.d.ts.map +1 -1
- package/dist/types/src/containers/StackContainer/index.d.ts +1 -2
- package/dist/types/src/containers/StackContainer/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -1
- package/dist/types/src/translations.d.ts +30 -30
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +43 -36
- package/src/StackPlugin.ts +4 -4
- package/src/capabilities/index.ts +3 -1
- package/src/capabilities/react-surface.tsx +28 -0
- package/src/components/{StackContext.tsx → StackContext/StackContext.tsx} +3 -1
- package/src/components/StackContext/index.ts +5 -0
- package/src/components/{StackSection.tsx → StackSection/StackSection.tsx} +23 -20
- package/src/components/StackSection/index.ts +5 -0
- package/src/components/StackSettings/StackSettings.tsx +28 -0
- package/src/components/StackSettings/index.ts +5 -0
- package/src/containers/StackContainer/StackContainer.tsx +29 -28
- package/src/containers/StackContainer/index.ts +1 -3
- package/src/meta.ts +2 -2
- package/src/translations.ts +23 -22
- package/src/types/stack.ts +1 -1
- package/dist/lib/browser/StackContainer-BIFUBD3Y.mjs +0 -289
- package/dist/lib/browser/StackContainer-BIFUBD3Y.mjs.map +0 -7
- package/dist/lib/browser/chunk-4X7CK6FM.mjs +0 -21
- package/dist/lib/browser/chunk-4X7CK6FM.mjs.map +0 -7
- package/dist/lib/browser/chunk-CD32XYEB.mjs +0 -27
- package/dist/lib/browser/chunk-CD32XYEB.mjs.map +0 -7
- package/dist/lib/browser/react-surface-PVND4UCN.mjs +0 -34
- package/dist/lib/browser/react-surface-PVND4UCN.mjs.map +0 -7
- package/dist/lib/node-esm/StackContainer-7XVJHW4D.mjs +0 -290
- package/dist/lib/node-esm/StackContainer-7XVJHW4D.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-26XWE7UY.mjs +0 -29
- package/dist/lib/node-esm/chunk-26XWE7UY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HEEGXPSW.mjs +0 -23
- package/dist/lib/node-esm/chunk-HEEGXPSW.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-SZETVRAZ.mjs +0 -35
- package/dist/lib/node-esm/react-surface-SZETVRAZ.mjs.map +0 -7
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/components/CaretDownUp.d.ts.map +0 -1
- package/dist/types/src/components/StackContext.d.ts.map +0 -1
- package/dist/types/src/components/StackSection.d.ts.map +0 -1
- package/dist/types/src/components/StackSettings.d.ts.map +0 -1
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -34
- package/src/components/StackSettings.tsx +0 -30
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
- /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.
|
|
3
|
+
"version": "0.8.4-main.51f1e5ca51",
|
|
4
4
|
"description": "DXOS Surface plugin for Stack entities",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -12,6 +12,14 @@
|
|
|
12
12
|
"author": "DXOS.org",
|
|
13
13
|
"sideEffects": true,
|
|
14
14
|
"type": "module",
|
|
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
|
+
"#translations": "./src/translations.ts",
|
|
21
|
+
"#types": "./src/types/index.ts"
|
|
22
|
+
},
|
|
15
23
|
"exports": {
|
|
16
24
|
".": {
|
|
17
25
|
"source": "./src/index.ts",
|
|
@@ -19,6 +27,12 @@
|
|
|
19
27
|
"browser": "./dist/lib/browser/index.mjs",
|
|
20
28
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
21
29
|
},
|
|
30
|
+
"./translations": {
|
|
31
|
+
"source": "./src/translations.ts",
|
|
32
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
33
|
+
"browser": "./dist/lib/browser/translations.mjs",
|
|
34
|
+
"node": "./dist/lib/node-esm/translations.mjs"
|
|
35
|
+
},
|
|
22
36
|
"./types": {
|
|
23
37
|
"source": "./src/types/index.ts",
|
|
24
38
|
"types": "./dist/types/src/types/index.d.ts",
|
|
@@ -27,13 +41,6 @@
|
|
|
27
41
|
}
|
|
28
42
|
},
|
|
29
43
|
"types": "dist/types/src/index.d.ts",
|
|
30
|
-
"typesVersions": {
|
|
31
|
-
"*": {
|
|
32
|
-
"types": [
|
|
33
|
-
"dist/types/src/types/index.d.ts"
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
44
|
"files": [
|
|
38
45
|
"dist",
|
|
39
46
|
"src"
|
|
@@ -42,29 +49,29 @@
|
|
|
42
49
|
"@effect-atom/atom-react": "^0.5.0",
|
|
43
50
|
"@fluentui/react-tabster": "9.26.11",
|
|
44
51
|
"@radix-ui/react-collapsible": "1.1.3",
|
|
45
|
-
"effect": "3.
|
|
52
|
+
"effect": "3.20.0",
|
|
46
53
|
"node-fetch": "^2.6.0",
|
|
47
54
|
"react-is": "~19.2.0",
|
|
48
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/client": "0.8.4-main.
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/plugin-
|
|
57
|
-
"@dxos/plugin-
|
|
58
|
-
"@dxos/plugin-
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/react-
|
|
61
|
-
"@dxos/react-ui-form": "0.8.4-main.
|
|
62
|
-
"@dxos/react-ui-
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/util": "0.8.4-main.
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
55
|
+
"@dxos/app-framework": "0.8.4-main.51f1e5ca51",
|
|
56
|
+
"@dxos/async": "0.8.4-main.51f1e5ca51",
|
|
57
|
+
"@dxos/client": "0.8.4-main.51f1e5ca51",
|
|
58
|
+
"@dxos/app-toolkit": "0.8.4-main.51f1e5ca51",
|
|
59
|
+
"@dxos/echo": "0.8.4-main.51f1e5ca51",
|
|
60
|
+
"@dxos/echo-atom": "0.8.4-main.51f1e5ca51",
|
|
61
|
+
"@dxos/operation": "0.8.4-main.51f1e5ca51",
|
|
62
|
+
"@dxos/invariant": "0.8.4-main.51f1e5ca51",
|
|
63
|
+
"@dxos/plugin-client": "0.8.4-main.51f1e5ca51",
|
|
64
|
+
"@dxos/plugin-deck": "0.8.4-main.51f1e5ca51",
|
|
65
|
+
"@dxos/plugin-graph": "0.8.4-main.51f1e5ca51",
|
|
66
|
+
"@dxos/react-ui-attention": "0.8.4-main.51f1e5ca51",
|
|
67
|
+
"@dxos/react-client": "0.8.4-main.51f1e5ca51",
|
|
68
|
+
"@dxos/react-ui-form": "0.8.4-main.51f1e5ca51",
|
|
69
|
+
"@dxos/react-ui-search": "0.8.4-main.51f1e5ca51",
|
|
70
|
+
"@dxos/schema": "0.8.4-main.51f1e5ca51",
|
|
71
|
+
"@dxos/react-ui-stack": "0.8.4-main.51f1e5ca51",
|
|
72
|
+
"@dxos/util": "0.8.4-main.51f1e5ca51",
|
|
73
|
+
"@dxos/types": "0.8.4-main.51f1e5ca51",
|
|
74
|
+
"@dxos/plugin-space": "0.8.4-main.51f1e5ca51"
|
|
68
75
|
},
|
|
69
76
|
"devDependencies": {
|
|
70
77
|
"@babel/core": "^7.18.13",
|
|
@@ -72,18 +79,18 @@
|
|
|
72
79
|
"@types/react-dom": "~19.2.3",
|
|
73
80
|
"react": "~19.2.3",
|
|
74
81
|
"react-dom": "~19.2.3",
|
|
75
|
-
"vite": "^
|
|
76
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
82
|
+
"vite": "^8.0.10",
|
|
83
|
+
"@dxos/react-ui": "0.8.4-main.51f1e5ca51",
|
|
84
|
+
"@dxos/ui-theme": "0.8.4-main.51f1e5ca51",
|
|
85
|
+
"@dxos/storybook-utils": "0.8.4-main.51f1e5ca51"
|
|
79
86
|
},
|
|
80
87
|
"peerDependencies": {
|
|
81
88
|
"@effect-atom/atom-react": "^0.5.0",
|
|
82
|
-
"effect": "3.
|
|
89
|
+
"effect": "3.20.0",
|
|
83
90
|
"react": "~19.2.3",
|
|
84
91
|
"react-dom": "~19.2.3",
|
|
85
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
86
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
92
|
+
"@dxos/react-ui": "0.8.4-main.51f1e5ca51",
|
|
93
|
+
"@dxos/ui-theme": "0.8.4-main.51f1e5ca51"
|
|
87
94
|
},
|
|
88
95
|
"publishConfig": {
|
|
89
96
|
"access": "public"
|
package/src/StackPlugin.ts
CHANGED
|
@@ -6,10 +6,10 @@ import { Plugin } from '@dxos/app-framework';
|
|
|
6
6
|
import { AppPlugin } from '@dxos/app-toolkit';
|
|
7
7
|
import { type Obj } from '@dxos/echo';
|
|
8
8
|
|
|
9
|
-
import { ReactSurface } from '
|
|
10
|
-
import { SECTION_IDENTIFIER, meta } from '
|
|
11
|
-
import { translations } from '
|
|
12
|
-
import { StackViewType } from '
|
|
9
|
+
import { ReactSurface } from '#capabilities';
|
|
10
|
+
import { SECTION_IDENTIFIER, meta } from '#meta';
|
|
11
|
+
import { translations } from '#translations';
|
|
12
|
+
import { StackViewType } from '#types';
|
|
13
13
|
|
|
14
14
|
export const StackPlugin = Plugin.define(meta).pipe(
|
|
15
15
|
AppPlugin.addMetadataModule({
|
|
@@ -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 { StackContainer } 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 <StackContainer 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 '
|
|
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 () => {},
|
|
@@ -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
|
|
13
|
+
import { getSize, mx } from '@dxos/ui-theme';
|
|
13
14
|
|
|
14
|
-
import { meta } from '
|
|
15
|
-
import { type StackSectionItem } from '
|
|
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
|
|
|
@@ -28,10 +29,12 @@ export const StackSection = ({
|
|
|
28
29
|
metadata: { icon = 'ph--placeholder--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
|
|
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}
|
|
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'
|
|
59
|
-
<span className='ms-2 grow'>{t('navigate
|
|
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
|
|
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'
|
|
71
|
-
<span className='ms-2 grow'>{t('add
|
|
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'
|
|
75
|
-
<span className='ms-2 grow'>{t('add
|
|
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'
|
|
79
|
-
<span className='ms-2 grow'>{t('remove
|
|
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
|
|
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
|
|
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
|
|
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'
|
|
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,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
|
+
};
|
|
@@ -8,27 +8,25 @@ import React, { useCallback, useState } from 'react';
|
|
|
8
8
|
|
|
9
9
|
import { useCapabilities, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
10
10
|
import { AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';
|
|
11
|
-
import { type
|
|
12
|
-
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
11
|
+
import { useAppGraph, type AppSurface } from '@dxos/app-toolkit/ui';
|
|
13
12
|
import { Obj, type Ref } from '@dxos/echo';
|
|
14
13
|
import { type Collection } from '@dxos/echo';
|
|
15
14
|
import { AtomObj } from '@dxos/echo-atom';
|
|
16
15
|
import { Graph } from '@dxos/plugin-graph';
|
|
17
|
-
import { SpaceOperation } from '@dxos/plugin-space/
|
|
16
|
+
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
18
17
|
import { Toolbar, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
19
|
-
import { AttentionProvider } from '@dxos/react-ui-attention';
|
|
20
18
|
import { Stack, StackItem } from '@dxos/react-ui-stack';
|
|
21
19
|
import { isNonNullable } from '@dxos/util';
|
|
22
20
|
|
|
23
|
-
import { StackContext, StackSection } from '
|
|
24
|
-
import { meta } from '
|
|
21
|
+
import { StackContext, StackSection } from '#components';
|
|
22
|
+
import { meta } from '#meta';
|
|
25
23
|
import {
|
|
26
24
|
type AddSectionPosition,
|
|
27
25
|
type CollapsedSections,
|
|
28
26
|
type StackSectionItem,
|
|
29
27
|
type StackSectionMetadata,
|
|
30
28
|
type StackSectionView,
|
|
31
|
-
} from '
|
|
29
|
+
} from '#types';
|
|
32
30
|
|
|
33
31
|
const collectionObjectsFamily = Atom.family((collection: Collection.Collection) =>
|
|
34
32
|
Atom.make((get) => {
|
|
@@ -42,11 +40,9 @@ const collectionObjectsFamily = Atom.family((collection: Collection.Collection)
|
|
|
42
40
|
}),
|
|
43
41
|
);
|
|
44
42
|
|
|
45
|
-
type StackContainerProps =
|
|
46
|
-
id: string;
|
|
47
|
-
};
|
|
43
|
+
type StackContainerProps = AppSurface.ObjectArticleProps<Collection.Collection>;
|
|
48
44
|
|
|
49
|
-
export const StackContainer = ({
|
|
45
|
+
export const StackContainer = ({ attendableId, subject: collection }: StackContainerProps) => {
|
|
50
46
|
const { invokePromise } = useOperationInvoker();
|
|
51
47
|
const { graph } = useAppGraph();
|
|
52
48
|
const { t } = useTranslation(meta.id);
|
|
@@ -104,7 +100,7 @@ export const StackContainer = ({ id, subject: collection }: StackContainerProps)
|
|
|
104
100
|
async (id: string, position: AddSectionPosition) => {
|
|
105
101
|
// TODO(wittjosiah): Use object creation dialog.
|
|
106
102
|
await invokePromise(LayoutOperation.UpdateDialog, {
|
|
107
|
-
subject: `${meta.id}
|
|
103
|
+
subject: `${meta.id}.AddSectionDialog`,
|
|
108
104
|
blockAlign: 'start',
|
|
109
105
|
props: {
|
|
110
106
|
path: id,
|
|
@@ -138,7 +134,7 @@ export const StackContainer = ({ id, subject: collection }: StackContainerProps)
|
|
|
138
134
|
);
|
|
139
135
|
|
|
140
136
|
return (
|
|
141
|
-
<StackItem.Content toolbar classNames='dx-
|
|
137
|
+
<StackItem.Content toolbar classNames='dx-document'>
|
|
142
138
|
<Toolbar.Root>
|
|
143
139
|
<Toolbar.IconButton
|
|
144
140
|
icon='ph--plus--regular'
|
|
@@ -148,22 +144,27 @@ export const StackContainer = ({ id, subject: collection }: StackContainerProps)
|
|
|
148
144
|
onClick={handleAddSection}
|
|
149
145
|
/>
|
|
150
146
|
</Toolbar.Root>
|
|
151
|
-
<
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
147
|
+
<StackContext.Provider
|
|
148
|
+
value={{
|
|
149
|
+
attendableId,
|
|
150
|
+
onCollapse: handleCollapse,
|
|
151
|
+
onNavigate: handleNavigate,
|
|
152
|
+
onDelete: handleDelete,
|
|
153
|
+
onAdd: handleAdd,
|
|
154
|
+
}}
|
|
155
|
+
>
|
|
156
|
+
<Stack
|
|
157
|
+
orientation='vertical'
|
|
158
|
+
size='intrinsic'
|
|
159
|
+
id={Obj.getDXN(collection).toString()}
|
|
160
|
+
data-testid='main.stack'
|
|
161
|
+
classNames='overflow-y-auto'
|
|
159
162
|
>
|
|
160
|
-
|
|
161
|
-
{
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
</StackContext.Provider>
|
|
166
|
-
</AttentionProvider>
|
|
163
|
+
{items.map((item) => (
|
|
164
|
+
<StackSection key={item.id} {...item} />
|
|
165
|
+
))}
|
|
166
|
+
</Stack>
|
|
167
|
+
</StackContext.Provider>
|
|
167
168
|
</StackItem.Content>
|
|
168
169
|
);
|
|
169
170
|
};
|
package/src/meta.ts
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import { type Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
export const SECTION_IDENTIFIER = 'dxos.
|
|
8
|
+
export const SECTION_IDENTIFIER = 'org.dxos.type.stackSection';
|
|
9
9
|
|
|
10
10
|
export const meta: Plugin.Meta = {
|
|
11
|
-
id: 'dxos.
|
|
11
|
+
id: 'org.dxos.plugin.stack',
|
|
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.
|
|
14
14
|
name: 'Collections',
|
package/src/translations.ts
CHANGED
|
@@ -3,34 +3,35 @@
|
|
|
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
|
-
import { meta } from '
|
|
8
|
+
import { meta } from '#meta';
|
|
9
9
|
|
|
10
10
|
export const translations = [
|
|
11
11
|
{
|
|
12
12
|
'en-US': {
|
|
13
13
|
[meta.id]: {
|
|
14
|
-
'plugin
|
|
15
|
-
'settings
|
|
16
|
-
'settings
|
|
17
|
-
'
|
|
18
|
-
'add
|
|
19
|
-
'add
|
|
20
|
-
'add
|
|
21
|
-
'add
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'add
|
|
30
|
-
'
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
14
|
+
'plugin.name': 'Stacks',
|
|
15
|
+
'settings.title': 'Stack settings',
|
|
16
|
+
'settings.separation.label': 'Separate sections',
|
|
17
|
+
'settings.separation.description': 'Add visual dividers between sections in stacks.',
|
|
18
|
+
'add-section-beforeAll-dialog.title': 'Add a section to the start',
|
|
19
|
+
'add-section-afterAll-dialog.title': 'Add a section to the end',
|
|
20
|
+
'add-section-before-dialog.title': 'Add a section',
|
|
21
|
+
'add-section-after-dialog.title': 'Add a section',
|
|
22
|
+
'add-section-input.placeholder': 'Find the type of section to add',
|
|
23
|
+
'upload-file.label': 'Add file',
|
|
24
|
+
'add-section.label': 'Add section',
|
|
25
|
+
'empty-stack.message': 'Drag objects into the stack.',
|
|
26
|
+
'remove-section.label': 'Delete',
|
|
27
|
+
'navigate-to-section.label': 'Navigate to object',
|
|
28
|
+
'untitled-section.title': 'Untitled section',
|
|
29
|
+
'add-section-before.label': 'Add before',
|
|
30
|
+
'add-section-after.label': 'Add after',
|
|
31
|
+
'expand.label': 'Expand',
|
|
32
|
+
'collapse.label': 'Collapse',
|
|
33
|
+
'open-chat-thread.label': 'Open chat thread',
|
|
34
|
+
'drag-handle.label': 'Press space or enter to begin dragging this object.',
|
|
34
35
|
},
|
|
35
36
|
},
|
|
36
37
|
},
|
package/src/types/stack.ts
CHANGED
|
@@ -23,7 +23,7 @@ export const StackViewType = Schema.Struct({
|
|
|
23
23
|
sections: Schema.Record({ key: Schema.String, value: SectionSchema }),
|
|
24
24
|
}).pipe(
|
|
25
25
|
Type.object({
|
|
26
|
-
typename: 'dxos.
|
|
26
|
+
typename: 'org.dxos.type.stackView',
|
|
27
27
|
version: '0.1.0',
|
|
28
28
|
}),
|
|
29
29
|
);
|