@dxos/plugin-stack 0.12.0-next-73daef452f1464b62efdbca75fb0067c1066f264 → 0.14.0
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/PLUGIN.mdl +72 -9
- package/dist/lib/capabilities.browser.mjs +18 -0
- package/dist/lib/capabilities.browser.mjs.map +1 -0
- package/dist/lib/capabilities.mjs +2 -2
- package/dist/lib/capabilities.mjs.map +1 -1
- package/dist/lib/capabilities.node.mjs.map +1 -1
- package/dist/lib/capabilities.tauri.mjs +18 -0
- package/dist/lib/capabilities.tauri.mjs.map +1 -0
- package/dist/lib/capabilities.workerd.mjs.map +1 -1
- package/dist/lib/chunk-PLUGIN.mjs +6 -0
- package/dist/lib/chunk-PLUGIN.mjs.map +1 -0
- package/dist/lib/chunk-StackArticle.mjs +16 -17
- package/dist/lib/chunk-StackArticle.mjs.map +1 -1
- package/dist/lib/chunk-react-surface.mjs +2 -2
- package/dist/lib/chunk-react-surface.mjs.map +1 -1
- package/dist/lib/components.mjs +71 -58
- package/dist/lib/components.mjs.map +1 -1
- package/dist/lib/containers.mjs.map +1 -1
- package/dist/lib/index.mjs +0 -1
- package/dist/lib/meta.mjs.map +1 -1
- package/dist/lib/translations.mjs.map +1 -1
- package/dist/types/src/capabilities/gen/browser.d.ts +5 -0
- package/dist/types/src/capabilities/gen/browser.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/node.d.ts.map +1 -1
- package/dist/types/src/capabilities/gen/tauri.d.ts +5 -0
- package/dist/types/src/capabilities/gen/tauri.d.ts.map +1 -0
- package/dist/types/src/capabilities/gen/workerd.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/components/Stack/Stack.d.ts +4 -13
- package/dist/types/src/components/Stack/Stack.d.ts.map +1 -1
- package/dist/types/src/components/Stack/StackContext.d.ts +1 -1
- package/dist/types/src/components/Stack/StackContext.d.ts.map +1 -1
- package/dist/types/src/components/Stack/index.d.ts +2 -2
- package/dist/types/src/components/Stack/index.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/StackArticle/StackArticle.d.ts +1 -1
- package/dist/types/src/containers/StackArticle/StackArticle.d.ts.map +1 -1
- package/dist/types/src/containers/StackArticle/StackArticle.stories.d.ts +1 -1
- package/dist/types/src/containers/StackArticle/StackArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/StackArticle/index.d.ts +1 -1
- package/dist/types/src/containers/StackArticle/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +2 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +34 -32
- package/src/capabilities/gen/browser.ts +27 -0
- package/src/capabilities/gen/node.ts +1 -1
- package/src/capabilities/gen/tauri.ts +27 -0
- package/src/capabilities/gen/workerd.ts +1 -1
- package/src/capabilities/index.ts +2 -2
- package/src/capabilities/react-surface.ts +2 -2
- package/src/components/Stack/Stack.tsx +75 -67
- package/src/components/Stack/StackContext.ts +1 -1
- package/src/components/Stack/index.ts +2 -2
- package/src/components/index.ts +1 -1
- package/src/containers/StackArticle/StackArticle.stories.tsx +4 -4
- package/src/containers/StackArticle/StackArticle.tsx +24 -26
- package/src/containers/StackArticle/index.ts +1 -1
- package/src/containers/index.ts +1 -1
- package/src/index.ts +1 -2
- package/src/meta.ts +1 -1
- package/src/translations.ts +2 -2
- package/src/types/index.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-stack",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "DXOS Surface plugin for Stack entities",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -10,19 +10,21 @@
|
|
|
10
10
|
},
|
|
11
11
|
"license": "FSL-1.1-Apache-2.0",
|
|
12
12
|
"author": "DXOS.org",
|
|
13
|
-
"sideEffects":
|
|
13
|
+
"sideEffects": false,
|
|
14
14
|
"type": "module",
|
|
15
15
|
"imports": {
|
|
16
16
|
"#capabilities": {
|
|
17
17
|
"source": {
|
|
18
18
|
"workerd": "./src/capabilities/gen/workerd.ts",
|
|
19
19
|
"node": "./src/capabilities/gen/node.ts",
|
|
20
|
-
"
|
|
20
|
+
"tauri": "./src/capabilities/gen/tauri.ts",
|
|
21
|
+
"browser": "./src/capabilities/gen/browser.ts"
|
|
21
22
|
},
|
|
22
23
|
"types": "./dist/types/src/capabilities/index.d.ts",
|
|
23
24
|
"workerd": "./dist/lib/capabilities.workerd.mjs",
|
|
24
25
|
"node": "./dist/lib/capabilities.node.mjs",
|
|
25
|
-
"
|
|
26
|
+
"tauri": "./dist/lib/capabilities.tauri.mjs",
|
|
27
|
+
"browser": "./dist/lib/capabilities.browser.mjs"
|
|
26
28
|
},
|
|
27
29
|
"#components": {
|
|
28
30
|
"source": "./src/components/index.ts",
|
|
@@ -102,44 +104,44 @@
|
|
|
102
104
|
"PLUGIN.mdl"
|
|
103
105
|
],
|
|
104
106
|
"dependencies": {
|
|
105
|
-
"@effect/atom-react": "4.0.0
|
|
106
|
-
"effect": "4.0.0
|
|
107
|
-
"@dxos/app-framework": "0.
|
|
108
|
-
"@dxos/app-toolkit": "0.
|
|
109
|
-
"@dxos/
|
|
110
|
-
"@dxos/
|
|
111
|
-
"@dxos/
|
|
112
|
-
"@dxos/react-ui-attention": "0.
|
|
113
|
-
"@dxos/react-ui-
|
|
114
|
-
"@dxos/react-ui-
|
|
115
|
-
"@dxos/react-ui-mosaic": "0.
|
|
116
|
-
"@dxos/util": "0.
|
|
107
|
+
"@effect/atom-react": "4.0.0",
|
|
108
|
+
"effect": "4.0.0",
|
|
109
|
+
"@dxos/app-framework": "0.14.0",
|
|
110
|
+
"@dxos/app-toolkit": "0.14.0",
|
|
111
|
+
"@dxos/keys": "0.14.0",
|
|
112
|
+
"@dxos/echo": "0.14.0",
|
|
113
|
+
"@dxos/plugin-space": "0.14.0",
|
|
114
|
+
"@dxos/react-ui-attention": "0.14.0",
|
|
115
|
+
"@dxos/react-ui-dnd": "0.14.0",
|
|
116
|
+
"@dxos/react-ui-menu": "0.14.0",
|
|
117
|
+
"@dxos/react-ui-mosaic": "0.14.0",
|
|
118
|
+
"@dxos/util": "0.14.0"
|
|
117
119
|
},
|
|
118
120
|
"devDependencies": {
|
|
119
|
-
"@storybook/react-vite": "^10.
|
|
121
|
+
"@storybook/react-vite": "^10.6.0",
|
|
120
122
|
"@types/react": "~19.2.17",
|
|
121
123
|
"@types/react-dom": "~19.2.3",
|
|
122
124
|
"react": "~19.2.7",
|
|
123
125
|
"react-dom": "~19.2.7",
|
|
124
|
-
"vite": "^8.2.
|
|
125
|
-
"@dxos/echo-react": "0.
|
|
126
|
-
"@dxos/plugin-
|
|
127
|
-
"@dxos/plugin-
|
|
128
|
-
"@dxos/
|
|
129
|
-
"@dxos/
|
|
130
|
-
"@dxos/
|
|
131
|
-
"@dxos/
|
|
132
|
-
"@dxos/
|
|
133
|
-
"@dxos/
|
|
134
|
-
"@dxos/plugin-illustrator": "0.
|
|
126
|
+
"vite": "^8.2.2",
|
|
127
|
+
"@dxos/echo-react": "0.14.0",
|
|
128
|
+
"@dxos/plugin-client": "0.14.0",
|
|
129
|
+
"@dxos/plugin-markdown": "0.14.0",
|
|
130
|
+
"@dxos/plugin-testing": "0.14.0",
|
|
131
|
+
"@dxos/plugin-tldraw": "0.14.0",
|
|
132
|
+
"@dxos/react-client": "0.14.0",
|
|
133
|
+
"@dxos/react-ui": "0.14.0",
|
|
134
|
+
"@dxos/ui-theme": "0.14.0",
|
|
135
|
+
"@dxos/random": "0.14.0",
|
|
136
|
+
"@dxos/plugin-illustrator": "0.14.0"
|
|
135
137
|
},
|
|
136
138
|
"peerDependencies": {
|
|
137
|
-
"@effect/atom-react": "4.0.0
|
|
138
|
-
"effect": "4.0.0
|
|
139
|
+
"@effect/atom-react": "4.0.0",
|
|
140
|
+
"effect": "4.0.0",
|
|
139
141
|
"react": "~19.2.7",
|
|
140
142
|
"react-dom": "~19.2.7",
|
|
141
|
-
"@dxos/react-ui": "^0.
|
|
142
|
-
"@dxos/ui-theme": "^0.
|
|
143
|
+
"@dxos/react-ui": "^0.14.0",
|
|
144
|
+
"@dxos/ui-theme": "^0.14.0"
|
|
143
145
|
},
|
|
144
146
|
"publishConfig": {
|
|
145
147
|
"access": "public"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'browser' condition.
|
|
6
|
+
|
|
7
|
+
import * as AppCapability from '@dxos/app-toolkit/AppCapability';
|
|
8
|
+
|
|
9
|
+
import { meta } from '#meta';
|
|
10
|
+
import { translations } from '#translations';
|
|
11
|
+
|
|
12
|
+
import pluginSpec from '../../../PLUGIN.mdl?raw';
|
|
13
|
+
|
|
14
|
+
export const PluginAsset = AppCapability.pluginAsset({
|
|
15
|
+
pluginId: meta.profile.key,
|
|
16
|
+
path: 'PLUGIN.mdl',
|
|
17
|
+
content: pluginSpec,
|
|
18
|
+
mimeType: 'application/x-mdl',
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const ReactSurface = AppCapability.surface(() => import('../react-surface.ts'), {
|
|
22
|
+
roles: ['org.dxos.role.article'],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const Schema = AppCapability.schema(() => import('../schema.ts'));
|
|
26
|
+
|
|
27
|
+
export const Translations = AppCapability.translations(translations);
|
|
@@ -8,7 +8,7 @@ import * as AppCapability from '@dxos/app-toolkit/AppCapability';
|
|
|
8
8
|
|
|
9
9
|
import { translations } from '#translations';
|
|
10
10
|
|
|
11
|
-
export const Schema = AppCapability.schema(() => import('../schema'));
|
|
11
|
+
export const Schema = AppCapability.schema(() => import('../schema.ts'));
|
|
12
12
|
|
|
13
13
|
export const Translations = AppCapability.translations(translations);
|
|
14
14
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'tauri' condition.
|
|
6
|
+
|
|
7
|
+
import * as AppCapability from '@dxos/app-toolkit/AppCapability';
|
|
8
|
+
|
|
9
|
+
import { meta } from '#meta';
|
|
10
|
+
import { translations } from '#translations';
|
|
11
|
+
|
|
12
|
+
import pluginSpec from '../../../PLUGIN.mdl?raw';
|
|
13
|
+
|
|
14
|
+
export const PluginAsset = AppCapability.pluginAsset({
|
|
15
|
+
pluginId: meta.profile.key,
|
|
16
|
+
path: 'PLUGIN.mdl',
|
|
17
|
+
content: pluginSpec,
|
|
18
|
+
mimeType: 'application/x-mdl',
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const ReactSurface = AppCapability.surface(() => import('../react-surface.ts'), {
|
|
22
|
+
roles: ['org.dxos.role.article'],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const Schema = AppCapability.schema(() => import('../schema.ts'));
|
|
26
|
+
|
|
27
|
+
export const Translations = AppCapability.translations(translations);
|
|
@@ -8,7 +8,7 @@ import * as AppCapability from '@dxos/app-toolkit/AppCapability';
|
|
|
8
8
|
|
|
9
9
|
import { translations } from '#translations';
|
|
10
10
|
|
|
11
|
-
export const Schema = AppCapability.schema(() => import('../schema'));
|
|
11
|
+
export const Schema = AppCapability.schema(() => import('../schema.ts'));
|
|
12
12
|
|
|
13
13
|
export const Translations = AppCapability.translations(translations);
|
|
14
14
|
|
|
@@ -16,8 +16,8 @@ export const PluginAsset = AppCapability.pluginAsset({
|
|
|
16
16
|
content: pluginSpec,
|
|
17
17
|
mimeType: 'application/x-mdl',
|
|
18
18
|
});
|
|
19
|
-
export const ReactSurface = AppCapability.surface(() => import('./react-surface'), {
|
|
19
|
+
export const ReactSurface = AppCapability.surface(() => import('./react-surface.ts'), {
|
|
20
20
|
roles: ['org.dxos.role.article'],
|
|
21
21
|
});
|
|
22
|
-
export const Schema = AppCapability.schema(() => import('./schema'));
|
|
22
|
+
export const Schema = AppCapability.schema(() => import('./schema.ts'));
|
|
23
23
|
export const Translations = AppCapability.translations(translations);
|
|
@@ -6,8 +6,8 @@ import * as Effect from 'effect/Effect';
|
|
|
6
6
|
|
|
7
7
|
import * as Capabilities from '@dxos/app-framework/Capabilities';
|
|
8
8
|
import * as Capability from '@dxos/app-framework/Capability';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
9
|
+
import * as Surface from '@dxos/app-framework/Surface';
|
|
10
|
+
import * as AppSurface from '@dxos/app-toolkit/AppSurface';
|
|
11
11
|
import { Collection } from '@dxos/echo';
|
|
12
12
|
|
|
13
13
|
import { StackArticle } from '#containers';
|
|
@@ -12,25 +12,24 @@ import React, {
|
|
|
12
12
|
useState,
|
|
13
13
|
} from 'react';
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import * as Surface from '@dxos/app-framework/Surface';
|
|
16
|
+
import * as AppSurface from '@dxos/app-toolkit/AppSurface';
|
|
17
|
+
import * as AttentionSigil from '@dxos/app-toolkit/AttentionSigil';
|
|
16
18
|
import * as GraphPath from '@dxos/app-toolkit/GraphPath';
|
|
17
|
-
import { AppSurface, AttentionSigilButton } from '@dxos/app-toolkit/ui';
|
|
18
19
|
import { Obj } from '@dxos/echo';
|
|
19
|
-
import {
|
|
20
|
-
DropdownMenu,
|
|
21
|
-
Icon,
|
|
22
|
-
ScrollArea,
|
|
23
|
-
ScrollAreaRootProps,
|
|
24
|
-
type ThemedClassName,
|
|
25
|
-
useTranslation,
|
|
26
|
-
} from '@dxos/react-ui';
|
|
27
20
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
28
21
|
import { type DndContainerHandler } from '@dxos/react-ui-dnd';
|
|
29
22
|
import { Mosaic, type MosaicTileProps } from '@dxos/react-ui-mosaic';
|
|
23
|
+
import * as Hooks from '@dxos/react-ui/Hooks';
|
|
24
|
+
import * as Icon from '@dxos/react-ui/Icon';
|
|
25
|
+
import * as Layout from '@dxos/react-ui/Layout';
|
|
26
|
+
import * as Menu from '@dxos/react-ui/Menu';
|
|
27
|
+
import * as ScrollArea from '@dxos/react-ui/ScrollArea';
|
|
28
|
+
import type * as Util from '@dxos/react-ui/Util';
|
|
30
29
|
|
|
31
30
|
import { meta } from '#meta';
|
|
32
31
|
|
|
33
|
-
import { StackContext, useStack, useStackContext } from './StackContext';
|
|
32
|
+
import { StackContext, useStack, useStackContext } from './StackContext.ts';
|
|
34
33
|
|
|
35
34
|
//
|
|
36
35
|
// Types
|
|
@@ -119,9 +118,7 @@ StackRoot.displayName = 'Stack.Root';
|
|
|
119
118
|
// Content
|
|
120
119
|
//
|
|
121
120
|
|
|
122
|
-
type StackContentProps = ThemedClassName<
|
|
123
|
-
ComponentPropsWithoutRef<'div'> & Pick<ScrollAreaRootProps, 'centered' | 'thin' | 'padding'>
|
|
124
|
-
>;
|
|
121
|
+
type StackContentProps = Util.ThemedClassName<ComponentPropsWithoutRef<'div'>>;
|
|
125
122
|
|
|
126
123
|
const StackContent = forwardRef<HTMLDivElement, StackContentProps>(({ children, ...props }, forwardedRef) => {
|
|
127
124
|
const { eventHandler, viewport } = useStackContext('Stack.Content');
|
|
@@ -140,7 +137,7 @@ StackContent.displayName = 'Stack.Content';
|
|
|
140
137
|
// Viewport
|
|
141
138
|
//
|
|
142
139
|
|
|
143
|
-
type StackViewportProps = ThemedClassName<PropsWithChildren>;
|
|
140
|
+
type StackViewportProps = Util.ThemedClassName<PropsWithChildren>;
|
|
144
141
|
|
|
145
142
|
const StackViewport = forwardRef<HTMLDivElement, StackViewportProps>(
|
|
146
143
|
({ classNames, children }, forwardedRef: ForwardedRef<HTMLDivElement>) => {
|
|
@@ -185,7 +182,7 @@ type StackSectionProps = MosaicTileProps<StackSectionItem>;
|
|
|
185
182
|
// Inline grip glyph for the drag preview. The native drag image does not rasterize external SVG sprite
|
|
186
183
|
// `<use>` icons (e.g. `@dxos/react-ui` `Icon`), so the preview uses plain inline SVG circles instead.
|
|
187
184
|
const DragHandleGlyph = () => (
|
|
188
|
-
<svg width={10} height={16} viewBox='0 0 10 16' aria-hidden className='shrink-0 text-
|
|
185
|
+
<svg width={10} height={16} viewBox='0 0 10 16' aria-hidden className='shrink-0 text-fg-muted'>
|
|
189
186
|
{[3, 8, 13].flatMap((cy) =>
|
|
190
187
|
[2.5, 7.5].map((cx) => <circle key={`${cx}-${cy}`} cx={cx} cy={cy} r={1.1} fill='currentColor' />),
|
|
191
188
|
)}
|
|
@@ -194,7 +191,7 @@ const DragHandleGlyph = () => (
|
|
|
194
191
|
|
|
195
192
|
const StackSection = ({ data, ...tileProps }: StackSectionProps) => {
|
|
196
193
|
const { id, object } = data;
|
|
197
|
-
const { t } = useTranslation(meta.profile.key);
|
|
194
|
+
const { t } = Hooks.useTranslation(meta.profile.key);
|
|
198
195
|
const { attendableId: parentAttendableId, collapsed, onAdd, onMoveUp, onMoveDown, onCollapse, onDelete } = useStack();
|
|
199
196
|
const [optionsMenuOpen, setOptionsMenuOpen] = useState(false);
|
|
200
197
|
const attendableId = GraphPath.getCollectionObjectPath(parentAttendableId, object.id);
|
|
@@ -205,51 +202,60 @@ const StackSection = ({ data, ...tileProps }: StackSectionProps) => {
|
|
|
205
202
|
const title = Obj.getLabel(object, { fallback: 'typename' }) ?? t('untitled-section.title');
|
|
206
203
|
|
|
207
204
|
const rail = (
|
|
208
|
-
<
|
|
205
|
+
<Layout.Grid rows={['min', 'fill']}>
|
|
209
206
|
<div className='p-1 dx-toolbar-surface'>
|
|
210
|
-
<
|
|
211
|
-
<
|
|
212
|
-
<
|
|
213
|
-
<Icon icon={icon} classNames='transition-opacity' />
|
|
214
|
-
</
|
|
215
|
-
</
|
|
216
|
-
<
|
|
217
|
-
|
|
218
|
-
<
|
|
219
|
-
{
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
)
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
207
|
+
<Menu.Root open={optionsMenuOpen} onOpenChange={({ open }) => setOptionsMenuOpen(open)}>
|
|
208
|
+
<Menu.Trigger asChild>
|
|
209
|
+
<AttentionSigil.Button size='md' attendableId={attendableId}>
|
|
210
|
+
<Icon.Icon icon={icon} classNames='transition-opacity' />
|
|
211
|
+
</AttentionSigil.Button>
|
|
212
|
+
</Menu.Trigger>
|
|
213
|
+
<Menu.Content>
|
|
214
|
+
{isCollapsed ? (
|
|
215
|
+
<Menu.Item
|
|
216
|
+
item={{
|
|
217
|
+
value: 'section.expand',
|
|
218
|
+
label: t('expand.label'),
|
|
219
|
+
icon: 'ph--arrows-out-line-vertical--regular',
|
|
220
|
+
}}
|
|
221
|
+
onClick={() => onCollapse(id, false)}
|
|
222
|
+
data-testid='section.expand'
|
|
223
|
+
/>
|
|
224
|
+
) : (
|
|
225
|
+
<Menu.Item
|
|
226
|
+
item={{
|
|
227
|
+
value: 'section.collapse',
|
|
228
|
+
label: t('collapse.label'),
|
|
229
|
+
icon: 'ph--arrows-in-line-vertical--regular',
|
|
230
|
+
}}
|
|
231
|
+
onClick={() => onCollapse(id, true)}
|
|
232
|
+
data-testid='section.collapse'
|
|
233
|
+
/>
|
|
234
|
+
)}
|
|
235
|
+
<Menu.Separator />
|
|
236
|
+
<Menu.Item
|
|
237
|
+
item={{ value: 'section.add', label: t('add-section.label'), icon: 'ph--plus--regular' }}
|
|
238
|
+
onClick={() => onAdd(id)}
|
|
239
|
+
data-testid='section.add'
|
|
240
|
+
/>
|
|
241
|
+
<Menu.Item
|
|
242
|
+
item={{ value: 'section.move-up', label: t('move-up.label'), icon: 'ph--arrow-line-up--regular' }}
|
|
243
|
+
onClick={() => onMoveUp(id)}
|
|
244
|
+
data-testid='section.move-up'
|
|
245
|
+
/>
|
|
246
|
+
<Menu.Item
|
|
247
|
+
item={{ value: 'section.move-down', label: t('move-down.label'), icon: 'ph--arrow-line-down--regular' }}
|
|
248
|
+
onClick={() => onMoveDown(id)}
|
|
249
|
+
data-testid='section.move-down'
|
|
250
|
+
/>
|
|
251
|
+
<Menu.Separator />
|
|
252
|
+
<Menu.Item
|
|
253
|
+
item={{ value: 'section.remove', label: t('remove-section.label'), icon: 'ph--trash--regular' }}
|
|
254
|
+
onClick={() => onDelete(id)}
|
|
255
|
+
data-testid='section.remove'
|
|
256
|
+
/>
|
|
257
|
+
</Menu.Content>
|
|
258
|
+
</Menu.Root>
|
|
253
259
|
</div>
|
|
254
260
|
<div className='p-1'>
|
|
255
261
|
{/* Inline glyph (not a sprite `Icon`) so the handle stays visible in the tile's native drag image. */}
|
|
@@ -261,24 +267,26 @@ const StackSection = ({ data, ...tileProps }: StackSectionProps) => {
|
|
|
261
267
|
<DragHandleGlyph />
|
|
262
268
|
</Mosaic.DragHandle>
|
|
263
269
|
</div>
|
|
264
|
-
</
|
|
270
|
+
</Layout.Grid>
|
|
265
271
|
);
|
|
266
272
|
|
|
267
273
|
return (
|
|
268
274
|
<Mosaic.Tile
|
|
269
275
|
{...tileProps}
|
|
270
276
|
data={data}
|
|
271
|
-
classNames='grid grid-cols-[var(--dx-rail-action)_1fr] dx-attention-surface border border-
|
|
277
|
+
classNames='grid grid-cols-[var(--dx-rail-action)_1fr] dx-attention-surface border border-separator-subtle'
|
|
272
278
|
>
|
|
273
|
-
<div className='border-e border-
|
|
274
|
-
<
|
|
279
|
+
<div className='border-e border-separator-subtle'>
|
|
280
|
+
<Layout.Flex column align='center' classNames='sticky top-0'>
|
|
281
|
+
{rail}
|
|
282
|
+
</Layout.Flex>
|
|
275
283
|
</div>
|
|
276
284
|
<div {...attentionAttrs} className='min-w-0'>
|
|
277
285
|
<span className='sr-only'>{title}</span>
|
|
278
286
|
{isCollapsed ? (
|
|
279
|
-
<
|
|
287
|
+
<Layout.Flex classNames='h-(--dx-toolbar-size) p-1'>
|
|
280
288
|
<h2 className='flex items-center font-medium'>{title}</h2>
|
|
281
|
-
</
|
|
289
|
+
</Layout.Flex>
|
|
282
290
|
) : (
|
|
283
291
|
<Surface.Surface type={AppSurface.Section} data={surfaceData} limit={1} />
|
|
284
292
|
)}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { createContext, useContext } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type StackContextType, type StackContextValue } from './Stack';
|
|
7
|
+
import { type StackContextType, type StackContextValue } from './Stack.tsx';
|
|
8
8
|
|
|
9
9
|
// Kept out of `Stack.tsx`: react-refresh only fast-refreshes a module whose exports are all
|
|
10
10
|
// components, so a context and its hook exported beside them force a full page reload on every edit.
|
package/src/components/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ import React from 'react';
|
|
|
9
9
|
import * as Capability from '@dxos/app-framework/Capability';
|
|
10
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
11
|
import * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';
|
|
12
|
-
import
|
|
12
|
+
import * as AppSurface from '@dxos/app-toolkit/AppSurface';
|
|
13
13
|
import { Collection, Filter, Ref } from '@dxos/echo';
|
|
14
14
|
import { useQuery } from '@dxos/echo-react';
|
|
15
15
|
import { ClientPlugin, initializeIdentity } from '@dxos/plugin-client/testing';
|
|
@@ -18,7 +18,7 @@ import * as IllustratorPlugin from '@dxos/plugin-illustrator/IllustratorPlugin';
|
|
|
18
18
|
import * as Markdown from '@dxos/plugin-markdown/Markdown';
|
|
19
19
|
import { MarkdownPlugin } from '@dxos/plugin-markdown/testing';
|
|
20
20
|
import { SpacePlugin } from '@dxos/plugin-space/testing';
|
|
21
|
-
import
|
|
21
|
+
import * as CorePlugins from '@dxos/plugin-testing/CorePlugins';
|
|
22
22
|
import * as StorybookPlugin from '@dxos/plugin-testing/StorybookPlugin';
|
|
23
23
|
import * as Tldraw from '@dxos/plugin-tldraw/Tldraw';
|
|
24
24
|
import * as TldrawModel from '@dxos/plugin-tldraw/TldrawModel';
|
|
@@ -30,7 +30,7 @@ import { Loading, withLayout } from '@dxos/react-ui/testing';
|
|
|
30
30
|
|
|
31
31
|
import { translations } from '#translations';
|
|
32
32
|
|
|
33
|
-
import { StackArticle, type StackArticleProps } from './StackArticle';
|
|
33
|
+
import { StackArticle, type StackArticleProps } from './StackArticle.tsx';
|
|
34
34
|
|
|
35
35
|
// A minimal sketch (tldraw `tldraw.com/2`) snapshot, used as a test image.
|
|
36
36
|
const SKETCH_CONTENT = new TldrawModel.RecordBuilder()
|
|
@@ -60,7 +60,7 @@ const meta: Meta<typeof StackArticle> = {
|
|
|
60
60
|
withPluginManager({
|
|
61
61
|
capabilities: [Capability.contribute(AppCapabilities.Translations, translations)],
|
|
62
62
|
plugins: [
|
|
63
|
-
...
|
|
63
|
+
...CorePlugins.make(),
|
|
64
64
|
ClientPlugin.make({
|
|
65
65
|
types: [Collection.Collection, Markdown.Document, Drawing.Drawing, Drawing.Canvas],
|
|
66
66
|
onClientInitialized: ({ client }) =>
|
|
@@ -3,17 +3,20 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { useAtomValue } from '@effect/atom-react/Hooks';
|
|
6
|
-
import * as Atom from 'effect/
|
|
6
|
+
import * as Atom from 'effect/reactivity/Atom';
|
|
7
7
|
import React, { useCallback, useId, useMemo, useState } from 'react';
|
|
8
8
|
|
|
9
|
-
import
|
|
10
|
-
import
|
|
9
|
+
import * as Hooks from '@dxos/app-framework/Hooks';
|
|
10
|
+
import type * as AppSurface from '@dxos/app-toolkit/AppSurface';
|
|
11
11
|
import { type Collection, Obj } from '@dxos/echo';
|
|
12
12
|
import * as SpaceOperation from '@dxos/plugin-space/SpaceOperation';
|
|
13
|
-
import { Panel, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
14
13
|
import { type DndContainerHandler } from '@dxos/react-ui-dnd';
|
|
15
|
-
import {
|
|
14
|
+
import { ActionMenu, createMenuAction } from '@dxos/react-ui-menu';
|
|
16
15
|
import { Mosaic } from '@dxos/react-ui-mosaic';
|
|
16
|
+
import * as Button from '@dxos/react-ui/Button';
|
|
17
|
+
import * as UiHooks from '@dxos/react-ui/Hooks';
|
|
18
|
+
import * as Panel from '@dxos/react-ui/Panel';
|
|
19
|
+
import * as Toolbar from '@dxos/react-ui/Toolbar';
|
|
17
20
|
import { arrayMove, isNonNullable } from '@dxos/util';
|
|
18
21
|
|
|
19
22
|
import { Stack, type StackSectionItem } from '#components';
|
|
@@ -22,8 +25,8 @@ import { meta } from '#meta';
|
|
|
22
25
|
export type StackArticleProps = AppSurface.ObjectArticleProps<Collection.Collection>;
|
|
23
26
|
|
|
24
27
|
export const StackArticle = ({ attendableId, subject: collection }: StackArticleProps) => {
|
|
25
|
-
const { invokePromise } = useOperationInvoker();
|
|
26
|
-
const { t } = useTranslation(meta.profile.key);
|
|
28
|
+
const { invokePromise } = Hooks.useOperationInvoker();
|
|
29
|
+
const { t } = UiHooks.useTranslation(meta.profile.key);
|
|
27
30
|
const [collapsedSections, setCollapsedSections] = useState<Record<string, boolean>>({});
|
|
28
31
|
|
|
29
32
|
const collectionObjects = useAtomValue(createCollectionObjects(collection));
|
|
@@ -177,10 +180,9 @@ export const StackArticle = ({ attendableId, subject: collection }: StackArticle
|
|
|
177
180
|
|
|
178
181
|
return (
|
|
179
182
|
<Panel.Root>
|
|
180
|
-
<Panel.
|
|
183
|
+
<Panel.Header classNames='dx-toolbar-surface'>
|
|
181
184
|
<Toolbar.Root classNames='dx-document'>
|
|
182
|
-
<
|
|
183
|
-
square
|
|
185
|
+
<Button.Root
|
|
184
186
|
icon='ph--plus--regular'
|
|
185
187
|
iconOnly
|
|
186
188
|
label={t('add-section.label')}
|
|
@@ -188,21 +190,17 @@ export const StackArticle = ({ attendableId, subject: collection }: StackArticle
|
|
|
188
190
|
onClick={handleAddSection}
|
|
189
191
|
/>
|
|
190
192
|
<Toolbar.Separator />
|
|
191
|
-
<
|
|
192
|
-
<
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
/>
|
|
200
|
-
</Menu.Trigger>
|
|
201
|
-
<Menu.Content items={optionsMenu} />
|
|
202
|
-
</Menu.Root>
|
|
193
|
+
<ActionMenu actions={optionsMenu}>
|
|
194
|
+
<Button.Root
|
|
195
|
+
icon='ph--dots-three-vertical--regular'
|
|
196
|
+
iconOnly
|
|
197
|
+
label={t('options.label')}
|
|
198
|
+
data-testid='stack.options'
|
|
199
|
+
/>
|
|
200
|
+
</ActionMenu>
|
|
203
201
|
</Toolbar.Root>
|
|
204
|
-
</Panel.
|
|
205
|
-
<Panel.
|
|
202
|
+
</Panel.Header>
|
|
203
|
+
<Panel.Body>
|
|
206
204
|
<Stack.Root
|
|
207
205
|
id={Obj.getURI(collection)}
|
|
208
206
|
attendableId={attendableId}
|
|
@@ -214,13 +212,13 @@ export const StackArticle = ({ attendableId, subject: collection }: StackArticle
|
|
|
214
212
|
onMoveDown={handleMoveDown}
|
|
215
213
|
onDelete={handleDelete}
|
|
216
214
|
>
|
|
217
|
-
<Stack.Content
|
|
215
|
+
<Stack.Content data-testid='main.stack'>
|
|
218
216
|
<Stack.Viewport>
|
|
219
217
|
<Mosaic.Stack classNames='dx-document' items={items} getId={getId} Tile={Stack.Section} />
|
|
220
218
|
</Stack.Viewport>
|
|
221
219
|
</Stack.Content>
|
|
222
220
|
</Stack.Root>
|
|
223
|
-
</Panel.
|
|
221
|
+
</Panel.Body>
|
|
224
222
|
</Panel.Root>
|
|
225
223
|
);
|
|
226
224
|
};
|
package/src/containers/index.ts
CHANGED
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
package/src/translations.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import type * as Theme from '@dxos/react-ui/Theme';
|
|
6
6
|
|
|
7
7
|
import { meta } from '#meta';
|
|
8
8
|
|
|
@@ -36,4 +36,4 @@ export const translations = [
|
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
|
-
] as const satisfies Resource[];
|
|
39
|
+
] as const satisfies Theme.Resource[];
|
package/src/types/index.ts
CHANGED