@dxos/plugin-deck 0.7.5-main.b19bfc8 → 0.7.5-main.d9d2d4e
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/{chunk-CYE6QZBQ.mjs → chunk-FT33W5CI.mjs} +1 -1
- package/dist/lib/browser/chunk-FT33W5CI.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DIM5INBX.mjs → chunk-J65MNI4S.mjs} +7 -7
- package/dist/lib/browser/{chunk-DIXE74SK.mjs → chunk-OEDK54N2.mjs} +52 -21
- package/dist/lib/browser/chunk-OEDK54N2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3 -1
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/{intent-resolver-MWUADUNI.mjs → intent-resolver-ZD67BRUI.mjs} +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-IELFERPV.mjs → react-root-2T6BCRK4.mjs} +4 -4
- package/dist/lib/browser/{react-surface-WL45R43W.mjs → react-surface-GFMOJSIA.mjs} +4 -4
- package/dist/lib/browser/{settings-YONG3QB7.mjs → settings-H35U6NHE.mjs} +2 -2
- package/dist/lib/browser/{state-MZZL5S2D.mjs → state-U4SHOPJW.mjs} +7 -2
- package/dist/lib/browser/{state-MZZL5S2D.mjs.map → state-U4SHOPJW.mjs.map} +3 -3
- package/dist/lib/browser/{tools-5LDJNU56.mjs → tools-64LXGLYR.mjs} +12 -4
- package/dist/lib/browser/tools-64LXGLYR.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/tools.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +6 -0
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +29 -29
- package/src/capabilities/state.ts +1 -0
- package/src/capabilities/tools.ts +8 -3
- package/src/components/DeckLayout/ComplementarySidebar.tsx +93 -36
- package/src/components/DeckLayout/Sidebar.tsx +5 -1
- package/src/translations.ts +2 -0
- package/src/types.ts +6 -0
- package/dist/lib/browser/chunk-CYE6QZBQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-DIXE74SK.mjs.map +0 -7
- package/dist/lib/browser/tools-5LDJNU56.mjs.map +0 -7
- /package/dist/lib/browser/{chunk-DIM5INBX.mjs.map → chunk-J65MNI4S.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-resolver-MWUADUNI.mjs.map → intent-resolver-ZD67BRUI.mjs.map} +0 -0
- /package/dist/lib/browser/{react-root-IELFERPV.mjs.map → react-root-2T6BCRK4.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-WL45R43W.mjs.map → react-surface-GFMOJSIA.mjs.map} +0 -0
- /package/dist/lib/browser/{settings-YONG3QB7.mjs.map → settings-H35U6NHE.mjs.map} +0 -0
|
@@ -7,6 +7,8 @@ declare const _default: {
|
|
|
7
7
|
'collapse navigation sidebar label': string;
|
|
8
8
|
'open complementary sidebar label': string;
|
|
9
9
|
'close complementary sidebar label': string;
|
|
10
|
+
'sidebar title': string;
|
|
11
|
+
'complementary sidebar title': string;
|
|
10
12
|
'plugin error message': string;
|
|
11
13
|
'content fallback message': string;
|
|
12
14
|
'content fallback description': string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wBAsDE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { S } from '@dxos/echo-schema';
|
|
2
2
|
import { type Node } from '@dxos/plugin-graph';
|
|
3
3
|
import { type Label } from '@dxos/react-ui';
|
|
4
|
+
import { type Position } from '@dxos/util';
|
|
4
5
|
export declare const NewPlankPositions: readonly ["start", "end"];
|
|
5
6
|
export type NewPlankPositioning = (typeof NewPlankPositions)[number];
|
|
6
7
|
export declare const OverscrollOptions: readonly ["none", "centering"];
|
|
@@ -9,6 +10,11 @@ export type Panel = {
|
|
|
9
10
|
id: string;
|
|
10
11
|
label: Label;
|
|
11
12
|
icon: string;
|
|
13
|
+
position?: Position;
|
|
14
|
+
/**
|
|
15
|
+
* If true, the panel will now be wrapped in a scroll area.
|
|
16
|
+
*/
|
|
17
|
+
fixed?: boolean;
|
|
12
18
|
filter?: (node: Node) => boolean;
|
|
13
19
|
};
|
|
14
20
|
export declare const DeckSettingsSchema: S.mutable<S.Struct<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAK3C,eAAO,MAAM,iBAAiB,2BAA4B,CAAC;AAC3D,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAA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AC;AAGF,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,eAAO,MAAM,WAAW,QAA0B,CAAC;AAEnD,yBAAiB,UAAU,CAAC;IAC1B,MAAM,oBAAoB,oHAKzB,CAAC;IACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,oBAAoB,CAAC,CAAC;IACxE,MAAM,CAAC,MAAM,UAAU;;;OAAoE,CAAC;IAC5F,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC;;;;;;;;;;IAE1D;;OAEG;IACH,MAAM,OAAO,MAAO,SAAQ,WAG1B;KAAG;;;;;;;;;;IAEL,MAAM,OAAO,eAAgB,SAAQ,oBAMnC;KAAG;;CACN"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-deck",
|
|
3
|
-
"version": "0.7.5-main.
|
|
3
|
+
"version": "0.7.5-main.d9d2d4e",
|
|
4
4
|
"description": "DXOS Surface plugin for the main application layout.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -35,29 +35,29 @@
|
|
|
35
35
|
"@preact/signals-core": "^1.6.0",
|
|
36
36
|
"effect": "^3.12.3",
|
|
37
37
|
"immer": "^10.1.1",
|
|
38
|
-
"@dxos/app-framework": "0.7.5-main.
|
|
39
|
-
"@dxos/artifact": "0.7.5-main.
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/live-object": "0.7.5-main.
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/plugin-
|
|
51
|
-
"@dxos/plugin-
|
|
52
|
-
"@dxos/plugin-
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/react-ui-
|
|
56
|
-
"@dxos/react-ui-
|
|
57
|
-
"@dxos/react-ui-
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/react-ui-
|
|
38
|
+
"@dxos/app-framework": "0.7.5-main.d9d2d4e",
|
|
39
|
+
"@dxos/artifact": "0.7.5-main.d9d2d4e",
|
|
40
|
+
"@dxos/debug": "0.7.5-main.d9d2d4e",
|
|
41
|
+
"@dxos/async": "0.7.5-main.d9d2d4e",
|
|
42
|
+
"@dxos/invariant": "0.7.5-main.d9d2d4e",
|
|
43
|
+
"@dxos/echo-schema": "0.7.5-main.d9d2d4e",
|
|
44
|
+
"@dxos/keyboard": "0.7.5-main.d9d2d4e",
|
|
45
|
+
"@dxos/live-object": "0.7.5-main.d9d2d4e",
|
|
46
|
+
"@dxos/echo-signals": "0.7.5-main.d9d2d4e",
|
|
47
|
+
"@dxos/log": "0.7.5-main.d9d2d4e",
|
|
48
|
+
"@dxos/plugin-graph": "0.7.5-main.d9d2d4e",
|
|
49
|
+
"@dxos/local-storage": "0.7.5-main.d9d2d4e",
|
|
50
|
+
"@dxos/plugin-attention": "0.7.5-main.d9d2d4e",
|
|
51
|
+
"@dxos/plugin-client": "0.7.5-main.d9d2d4e",
|
|
52
|
+
"@dxos/plugin-observability": "0.7.5-main.d9d2d4e",
|
|
53
|
+
"@dxos/react-client": "0.7.5-main.d9d2d4e",
|
|
54
|
+
"@dxos/plugin-theme": "0.7.5-main.d9d2d4e",
|
|
55
|
+
"@dxos/react-ui-attention": "0.7.5-main.d9d2d4e",
|
|
56
|
+
"@dxos/react-ui-form": "0.7.5-main.d9d2d4e",
|
|
57
|
+
"@dxos/react-ui-tabs": "0.7.5-main.d9d2d4e",
|
|
58
|
+
"@dxos/util": "0.7.5-main.d9d2d4e",
|
|
59
|
+
"@dxos/react-ui-text-tooltip": "0.7.5-main.d9d2d4e",
|
|
60
|
+
"@dxos/react-ui-stack": "0.7.5-main.d9d2d4e"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -66,16 +66,16 @@
|
|
|
66
66
|
"react": "~18.2.0",
|
|
67
67
|
"react-dom": "~18.2.0",
|
|
68
68
|
"vite": "5.4.7",
|
|
69
|
-
"@dxos/react-ui": "0.7.5-main.
|
|
70
|
-
"@dxos/react-ui-theme": "0.7.5-main.
|
|
71
|
-
"@dxos/storybook-utils": "0.7.5-main.
|
|
69
|
+
"@dxos/react-ui": "0.7.5-main.d9d2d4e",
|
|
70
|
+
"@dxos/react-ui-theme": "0.7.5-main.d9d2d4e",
|
|
71
|
+
"@dxos/storybook-utils": "0.7.5-main.d9d2d4e"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"@phosphor-icons/react": "^2.0.5",
|
|
75
75
|
"react": "~18.2.0",
|
|
76
76
|
"react-dom": "~18.2.0",
|
|
77
|
-
"@dxos/react-ui
|
|
78
|
-
"@dxos/react-ui": "0.7.5-main.
|
|
77
|
+
"@dxos/react-ui": "0.7.5-main.d9d2d4e",
|
|
78
|
+
"@dxos/react-ui-theme": "0.7.5-main.d9d2d4e"
|
|
79
79
|
},
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
@@ -69,6 +69,7 @@ export default () => {
|
|
|
69
69
|
state
|
|
70
70
|
.prop({ key: 'sidebarState', type: LocalStorageStore.enum<SidebarState>() })
|
|
71
71
|
.prop({ key: 'complementarySidebarState', type: LocalStorageStore.enum<SidebarState>() })
|
|
72
|
+
.prop({ key: 'complementarySidebarPanel', type: LocalStorageStore.string({ allowUndefined: true }) })
|
|
72
73
|
.prop({ key: 'decks', type: LocalStorageStore.json<Record<string, Deck>>() })
|
|
73
74
|
.prop({ key: 'activeDeck', type: LocalStorageStore.string() })
|
|
74
75
|
.prop({ key: 'previousDeck', type: LocalStorageStore.string() });
|
|
@@ -13,6 +13,8 @@ import { defineTool, ToolResult } from '@dxos/artifact';
|
|
|
13
13
|
import { S } from '@dxos/echo-schema';
|
|
14
14
|
import { invariant } from '@dxos/invariant';
|
|
15
15
|
|
|
16
|
+
import { meta } from '../meta';
|
|
17
|
+
|
|
16
18
|
// TODO(burdon): Factor out.
|
|
17
19
|
declare global {
|
|
18
20
|
interface ToolContextExtensions {
|
|
@@ -23,11 +25,14 @@ declare global {
|
|
|
23
25
|
|
|
24
26
|
export default () =>
|
|
25
27
|
contributes(Capabilities.Tools, [
|
|
26
|
-
defineTool({
|
|
28
|
+
defineTool(meta.id, {
|
|
27
29
|
name: 'show',
|
|
28
30
|
// TODO(ZaymonFC): We should update the prompt to teach the LLM the difference between object ids and fully qualified ids.
|
|
29
|
-
description:
|
|
30
|
-
|
|
31
|
+
description: `
|
|
32
|
+
Show an item in the app. Use this tool to open an artifact.
|
|
33
|
+
When supplying IDs to show, they must be fully qualified like space:object.
|
|
34
|
+
`,
|
|
35
|
+
caption: 'Showing item...',
|
|
31
36
|
// TODO(wittjosiah): Refactor Layout/Navigation/Deck actions so that they can be used directly.
|
|
32
37
|
schema: S.Struct({
|
|
33
38
|
id: S.String.annotations({
|
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
5
|
+
import React, {
|
|
6
|
+
type PropsWithChildren,
|
|
7
|
+
useCallback,
|
|
8
|
+
useEffect,
|
|
9
|
+
useMemo,
|
|
10
|
+
useState,
|
|
11
|
+
type MouseEvent,
|
|
12
|
+
Fragment,
|
|
13
|
+
} from 'react';
|
|
6
14
|
|
|
7
15
|
import {
|
|
8
16
|
createIntent,
|
|
@@ -13,9 +21,17 @@ import {
|
|
|
13
21
|
useCapability,
|
|
14
22
|
useIntentDispatcher,
|
|
15
23
|
} from '@dxos/app-framework';
|
|
16
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
Main,
|
|
26
|
+
useTranslation,
|
|
27
|
+
toLocalizedString,
|
|
28
|
+
IconButton,
|
|
29
|
+
ScrollArea as NaturalScrollArea,
|
|
30
|
+
type Label,
|
|
31
|
+
} from '@dxos/react-ui';
|
|
17
32
|
import { useAttended } from '@dxos/react-ui-attention';
|
|
18
33
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
34
|
+
import { byPosition } from '@dxos/util';
|
|
19
35
|
|
|
20
36
|
import { PlankContentError } from './PlankError';
|
|
21
37
|
import { PlankLoading } from './PlankLoading';
|
|
@@ -23,12 +39,15 @@ import { ToggleComplementarySidebarButton } from './SidebarButton';
|
|
|
23
39
|
import { DeckCapabilities } from '../../capabilities';
|
|
24
40
|
import { useNode } from '../../hooks';
|
|
25
41
|
import { DECK_PLUGIN } from '../../meta';
|
|
42
|
+
import { type Panel } from '../../types';
|
|
26
43
|
import { layoutAppliesTopbar, useBreakpoints, useHoistStatusbar } from '../../util';
|
|
27
44
|
|
|
28
45
|
export type ComplementarySidebarProps = {
|
|
29
46
|
current?: string;
|
|
30
47
|
};
|
|
31
48
|
|
|
49
|
+
const label = ['complementary sidebar title', { ns: DECK_PLUGIN }] satisfies Label;
|
|
50
|
+
|
|
32
51
|
export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) => {
|
|
33
52
|
const { t } = useTranslation(DECK_PLUGIN);
|
|
34
53
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
@@ -41,13 +60,15 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
41
60
|
const hoistStatusbar = useHoistStatusbar(breakpoint);
|
|
42
61
|
|
|
43
62
|
const panels = useCapabilities(DeckCapabilities.ComplementaryPanel);
|
|
44
|
-
const availablePanels = panels
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
63
|
+
const availablePanels = panels
|
|
64
|
+
.filter((panel) => {
|
|
65
|
+
if (!node || !panel.filter) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
48
68
|
|
|
49
|
-
|
|
50
|
-
|
|
69
|
+
return panel.filter(node);
|
|
70
|
+
})
|
|
71
|
+
.toSorted(byPosition);
|
|
51
72
|
const activePanelId = availablePanels.find((panel) => panel.id === current)?.id ?? availablePanels[0]?.id;
|
|
52
73
|
const [internalValue, setInternalValue] = useState(activePanelId);
|
|
53
74
|
|
|
@@ -83,6 +104,7 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
83
104
|
// TODO(burdon): Scroll area should be controlled by surface.
|
|
84
105
|
return (
|
|
85
106
|
<Main.ComplementarySidebar
|
|
107
|
+
label={label}
|
|
86
108
|
classNames={[
|
|
87
109
|
topbar && 'block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]',
|
|
88
110
|
hoistStatusbar && 'block-end-[--statusbar-size]',
|
|
@@ -137,37 +159,72 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
137
159
|
classNames='absolute data-[state="inactive"]:-z-[1] inset-block-0 inline-start-0 is-[calc(100%-var(--r0-size))] lg:is-[--r1-size] grid grid-cols-1 grid-rows-[var(--rail-size)_1fr_min-content] pbs-[env(safe-area-inset-top)]'
|
|
138
160
|
{...(layout.complementarySidebarState !== 'expanded' && { inert: 'true' })}
|
|
139
161
|
>
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
<ScrollArea.Viewport>
|
|
147
|
-
<Surface
|
|
148
|
-
role={`complementary--${activePanelId}`}
|
|
149
|
-
data={data}
|
|
150
|
-
fallback={PlankContentError}
|
|
151
|
-
placeholder={<PlankLoading />}
|
|
152
|
-
/>
|
|
153
|
-
</ScrollArea.Viewport>
|
|
154
|
-
<ScrollArea.Scrollbar orientation='vertical'>
|
|
155
|
-
<ScrollArea.Thumb />
|
|
156
|
-
</ScrollArea.Scrollbar>
|
|
157
|
-
</ScrollArea.Root>
|
|
158
|
-
{!hoistStatusbar && (
|
|
159
|
-
<div
|
|
160
|
-
role='contentinfo'
|
|
161
|
-
className='flex flex-wrap justify-center items-center border-bs border-separator pbs-1 pbe-[max(env(safe-area-inset-bottom),0.25rem)]'
|
|
162
|
-
>
|
|
163
|
-
<Surface role='status-bar--r1-footer' limit={1} />
|
|
164
|
-
</div>
|
|
165
|
-
)}
|
|
166
|
-
</>
|
|
167
|
-
)}
|
|
162
|
+
<ComplementarySidebarPanel
|
|
163
|
+
panel={panel}
|
|
164
|
+
activePanelId={activePanelId}
|
|
165
|
+
data={data}
|
|
166
|
+
hoistStatusbar={hoistStatusbar}
|
|
167
|
+
/>
|
|
168
168
|
</Tabs.Tabpanel>
|
|
169
169
|
))}
|
|
170
170
|
</Tabs.Root>
|
|
171
171
|
</Main.ComplementarySidebar>
|
|
172
172
|
);
|
|
173
173
|
};
|
|
174
|
+
|
|
175
|
+
type ComplementarySidebarPanelProps = {
|
|
176
|
+
panel: Panel;
|
|
177
|
+
activePanelId: string;
|
|
178
|
+
data?: {
|
|
179
|
+
id: string;
|
|
180
|
+
subject: any;
|
|
181
|
+
workspace: string;
|
|
182
|
+
popoverAnchorId?: string;
|
|
183
|
+
};
|
|
184
|
+
hoistStatusbar: boolean;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const ScrollArea = ({ children }: PropsWithChildren) => {
|
|
188
|
+
return (
|
|
189
|
+
<NaturalScrollArea.Root>
|
|
190
|
+
<NaturalScrollArea.Viewport>{children}</NaturalScrollArea.Viewport>
|
|
191
|
+
<NaturalScrollArea.Scrollbar orientation='vertical'>
|
|
192
|
+
<NaturalScrollArea.Thumb />
|
|
193
|
+
</NaturalScrollArea.Scrollbar>
|
|
194
|
+
</NaturalScrollArea.Root>
|
|
195
|
+
);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const ComplementarySidebarPanel = ({ panel, activePanelId, data, hoistStatusbar }: ComplementarySidebarPanelProps) => {
|
|
199
|
+
const { t } = useTranslation(DECK_PLUGIN);
|
|
200
|
+
|
|
201
|
+
if (panel.id !== activePanelId || !data) {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const Wrapper = panel.fixed ? Fragment : ScrollArea;
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
<>
|
|
209
|
+
<h2 className='flex items-center pli-2 border-separator border-be font-medium'>
|
|
210
|
+
{toLocalizedString(panel.label, t)}
|
|
211
|
+
</h2>
|
|
212
|
+
<Wrapper>
|
|
213
|
+
<Surface
|
|
214
|
+
role={`complementary--${activePanelId}`}
|
|
215
|
+
data={data}
|
|
216
|
+
fallback={PlankContentError}
|
|
217
|
+
placeholder={<PlankLoading />}
|
|
218
|
+
/>
|
|
219
|
+
</Wrapper>
|
|
220
|
+
{!hoistStatusbar && (
|
|
221
|
+
<div
|
|
222
|
+
role='contentinfo'
|
|
223
|
+
className='flex flex-wrap justify-center items-center border-bs border-separator pbs-1 pbe-[max(env(safe-area-inset-bottom),0.25rem)]'
|
|
224
|
+
>
|
|
225
|
+
<Surface role='status-bar--r1-footer' limit={1} />
|
|
226
|
+
</div>
|
|
227
|
+
)}
|
|
228
|
+
</>
|
|
229
|
+
);
|
|
230
|
+
};
|
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Surface, useCapability } from '@dxos/app-framework';
|
|
8
|
-
import { Main } from '@dxos/react-ui';
|
|
8
|
+
import { type Label, Main } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
10
|
import { DeckCapabilities } from '../../capabilities';
|
|
11
|
+
import { DECK_PLUGIN } from '../../meta';
|
|
11
12
|
import { layoutAppliesTopbar, useBreakpoints, useHoistStatusbar } from '../../util';
|
|
12
13
|
|
|
14
|
+
const label = ['sidebar title', { ns: DECK_PLUGIN }] satisfies Label;
|
|
15
|
+
|
|
13
16
|
export const Sidebar = () => {
|
|
14
17
|
const { popoverAnchorId, activeDeck: current } = useCapability(DeckCapabilities.DeckState);
|
|
15
18
|
const breakpoint = useBreakpoints();
|
|
@@ -23,6 +26,7 @@ export const Sidebar = () => {
|
|
|
23
26
|
|
|
24
27
|
return (
|
|
25
28
|
<Main.NavigationSidebar
|
|
29
|
+
label={label}
|
|
26
30
|
classNames={[
|
|
27
31
|
'grid',
|
|
28
32
|
topbar && 'block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]',
|
package/src/translations.ts
CHANGED
|
@@ -14,6 +14,8 @@ export default [
|
|
|
14
14
|
'collapse navigation sidebar label': 'Minimize sidebar',
|
|
15
15
|
'open complementary sidebar label': 'Open context sidebar',
|
|
16
16
|
'close complementary sidebar label': 'Minimize context sidebar',
|
|
17
|
+
'sidebar title': 'Navigation sidebar',
|
|
18
|
+
'complementary sidebar title': 'Context sidebar',
|
|
17
19
|
'plugin error message': 'Content failed to render.',
|
|
18
20
|
'content fallback message': 'Unsupported',
|
|
19
21
|
'content fallback description':
|
package/src/types.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { LayoutAction } from '@dxos/app-framework';
|
|
|
6
6
|
import { S } from '@dxos/echo-schema';
|
|
7
7
|
import { type Node } from '@dxos/plugin-graph';
|
|
8
8
|
import { type Label } from '@dxos/react-ui';
|
|
9
|
+
import { type Position } from '@dxos/util';
|
|
9
10
|
|
|
10
11
|
import { DECK_PLUGIN } from './meta';
|
|
11
12
|
|
|
@@ -20,6 +21,11 @@ export type Panel = {
|
|
|
20
21
|
id: string;
|
|
21
22
|
label: Label;
|
|
22
23
|
icon: string;
|
|
24
|
+
position?: Position;
|
|
25
|
+
/**
|
|
26
|
+
* If true, the panel will now be wrapped in a scroll area.
|
|
27
|
+
*/
|
|
28
|
+
fixed?: boolean;
|
|
23
29
|
filter?: (node: Node) => boolean;
|
|
24
30
|
};
|
|
25
31
|
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { LayoutAction } from '@dxos/app-framework';\nimport { S } from '@dxos/echo-schema';\nimport { type Node } from '@dxos/plugin-graph';\nimport { type Label } from '@dxos/react-ui';\n\nimport { DECK_PLUGIN } from './meta';\n\n// TODO(Zan): In the future we should consider adding new planks adjacent to the attended plank.\nexport const NewPlankPositions = ['start', 'end'] as const;\nexport type NewPlankPositioning = (typeof NewPlankPositions)[number];\n\nexport const OverscrollOptions = ['none', 'centering'] as const;\nexport type Overscroll = (typeof OverscrollOptions)[number];\n\nexport type Panel = {\n id: string;\n label: Label;\n icon: string;\n filter?: (node: Node) => boolean;\n};\n\nexport const DeckSettingsSchema = S.mutable(\n S.Struct({\n showHints: S.Boolean,\n enableNativeRedirect: S.Boolean,\n enableIdeStyleStatusbar: S.Boolean,\n newPlankPositioning: S.Literal(...NewPlankPositions),\n overscroll: S.Literal(...OverscrollOptions),\n }),\n);\n\nexport type DeckSettingsProps = S.Schema.Type<typeof DeckSettingsSchema>;\n\nconst LayoutMode = S.Union(S.Literal('deck'), S.Literal('solo'), S.Literal('fullscreen'));\nexport const isLayoutMode = (value: any): value is LayoutMode => S.is(LayoutMode)(value);\nexport type LayoutMode = S.Schema.Type<typeof LayoutMode>;\n\nexport const PlankSizing = S.Record({ key: S.String, value: S.Number });\nexport type PlankSizing = S.Schema.Type<typeof PlankSizing>;\n\nexport const Deck = S.Struct({\n initialized: S.Boolean.annotations({\n description: \"If false, the deck has not yet left solo mode and new planks should be solo'd.\",\n }),\n active: S.mutable(S.Array(S.String)),\n inactive: S.mutable(S.Array(S.String)),\n solo: S.optional(S.String),\n fullscreen: S.Boolean,\n plankSizing: S.mutable(PlankSizing),\n});\nexport type Deck = S.Schema.Type<typeof Deck>;\n\nexport const DeckState = S.mutable(\n S.Struct({\n sidebarState: S.Literal('closed', 'collapsed', 'expanded'),\n complementarySidebarState: S.Literal('closed', 'collapsed', 'expanded'),\n complementarySidebarPanel: S.optional(S.String),\n\n dialogOpen: S.Boolean,\n /**\n * Data to be passed to the dialog Surface.\n */\n dialogContent: S.optional(S.Any),\n dialogBlockAlign: S.optional(S.Literal('start', 'center', 'end')),\n dialogType: S.optional(S.Literal('default', 'alert')),\n\n popoverOpen: S.Boolean,\n popoverSide: S.optional(S.Literal('top', 'right', 'bottom', 'left')),\n /**\n * Data to be passed to the popover Surface.\n */\n popoverContent: S.optional(S.Any),\n popoverAnchorId: S.optional(S.String),\n\n toasts: S.mutable(S.Array(LayoutAction.Toast)),\n currentUndoId: S.optional(S.String),\n\n activeDeck: S.String,\n previousDeck: S.String,\n decks: S.mutable(S.Record({ key: S.String, value: S.mutable(Deck) })),\n previousMode: S.mutable(S.Record({ key: S.String, value: LayoutMode })),\n deck: S.mutable(Deck),\n\n /**\n * The identifier of a component to scroll into view when it is mounted.\n */\n scrollIntoView: S.optional(S.String),\n }),\n);\n\nexport type DeckState = S.Schema.Type<typeof DeckState>;\n\nexport const getMode = (deck: Deck): LayoutMode => {\n if (deck.solo) {\n return deck.fullscreen ? 'fullscreen' : 'solo';\n }\n\n return 'deck';\n};\n\n// NOTE: Chosen from RFC 1738’s `safe` characters: http://www.faqs.org/rfcs/rfc1738.html\nexport const SLUG_PATH_SEPARATOR = '~';\n\nexport const DECK_ACTION = `${DECK_PLUGIN}/action`;\n\nexport namespace DeckAction {\n const PartAdjustmentSchema = S.Union(\n S.Literal('close').annotations({ description: 'Close the plank.' }),\n S.Literal('solo').annotations({ description: 'Solo the plank.' }),\n S.Literal('increment-start').annotations({ description: 'Move the plank towards the start of the deck.' }),\n S.Literal('increment-end').annotations({ description: 'Move the plank towards the end of the deck.' }),\n );\n export type PartAdjustment = S.Schema.Type<typeof PartAdjustmentSchema>;\n export const Adjustment = S.mutable(S.Struct({ id: S.String, type: PartAdjustmentSchema }));\n export type Adjustment = S.Schema.Type<typeof Adjustment>;\n\n /**\n * An atomic transaction to apply to the deck, describing which element to move to which location.\n */\n export class Adjust extends S.TaggedClass<Adjust>()(`${DECK_ACTION}/adjust`, {\n input: Adjustment,\n output: S.Void,\n }) {}\n\n export class UpdatePlankSize extends S.TaggedClass<UpdatePlankSize>()(`${DECK_ACTION}/update-plank-size`, {\n input: S.Struct({\n id: S.String,\n size: S.Number,\n }),\n output: S.Void,\n }) {}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,oBAAoB;AAC7B,SAASC,SAAS;AAOX,IAAMC,oBAAoB;EAAC;EAAS;;AAGpC,IAAMC,oBAAoB;EAAC;EAAQ;;AAUnC,IAAMC,qBAAqBC,EAAEC,QAClCD,EAAEE,OAAO;EACPC,WAAWH,EAAEI;EACbC,sBAAsBL,EAAEI;EACxBE,yBAAyBN,EAAEI;EAC3BG,qBAAqBP,EAAEQ,QAAO,GAAIX,iBAAAA;EAClCY,YAAYT,EAAEQ,QAAO,GAAIV,iBAAAA;AAC3B,CAAA,CAAA;AAKF,IAAMY,aAAaV,EAAEW,MAAMX,EAAEQ,QAAQ,MAAA,GAASR,EAAEQ,QAAQ,MAAA,GAASR,EAAEQ,QAAQ,YAAA,CAAA;AACpE,IAAMI,eAAe,CAACC,UAAoCb,EAAEc,GAAGJ,UAAAA,EAAYG,KAAAA;AAG3E,IAAME,cAAcf,EAAEgB,OAAO;EAAEC,KAAKjB,EAAEkB;EAAQL,OAAOb,EAAEmB;AAAO,CAAA;AAG9D,IAAMC,OAAOpB,EAAEE,OAAO;EAC3BmB,aAAarB,EAAEI,QAAQkB,YAAY;IACjCC,aAAa;EACf,CAAA;EACAC,QAAQxB,EAAEC,QAAQD,EAAEyB,MAAMzB,EAAEkB,MAAM,CAAA;EAClCQ,UAAU1B,EAAEC,QAAQD,EAAEyB,MAAMzB,EAAEkB,MAAM,CAAA;EACpCS,MAAM3B,EAAE4B,SAAS5B,EAAEkB,MAAM;EACzBW,YAAY7B,EAAEI;EACd0B,aAAa9B,EAAEC,QAAQc,WAAAA;AACzB,CAAA;AAGO,IAAMgB,YAAY/B,EAAEC,QACzBD,E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B,sBAAsB;AAE5B,IAAMC,cAAc,GAAGC,WAAAA;;UAEbC,aAAAA;AACf,QAAMC,uBAAuB3D,EAAEW,MAC7BX,EAAEQ,QAAQ,OAAA,EAASc,YAAY;IAAEC,aAAa;EAAmB,CAAA,GACjEvB,EAAEQ,QAAQ,MAAA,EAAQc,YAAY;IAAEC,aAAa;EAAkB,CAAA,GAC/DvB,EAAEQ,QAAQ,iBAAA,EAAmBc,YAAY;IAAEC,aAAa;EAAgD,CAAA,GACxGvB,EAAEQ,QAAQ,eAAA,EAAiBc,YAAY;IAAEC,aAAa;EAA8C,CAAA,CAAA;cAGzFqC,aAAa5D,EAAEC,QAAQD,EAAEE,OAAO;IAAE2D,IAAI7D,EAAEkB;IAAQ4C,MAAMH;EAAqB,CAAA,CAAA;EAMjF,MAAMI,eAAe/D,EAAEgE,YAAW,EAAW,GAAGR,WAAAA,WAAsB;IAC3ES,OAAKP,YAAEE;IACPM,QAAQlE,EAAEmE;EACZ,CAAA,EAAA;EAAI;AAJH,EAAAT,YACYK,SAAAA;EAKN,MAAMK,wBAAwBpE,EAAEgE,YAAW,EAAoB,GAAGR,WAAAA,sBAAiC;IACxGS,OAAOjE,EAAEE,OAAO;MACd2D,IAAI7D,EAAEkB;MACNmD,MAAMrE,EAAEmB;IACV,CAAA;IACA+C,QAAQlE,EAAEmE;EACZ,CAAA,EAAA;EAAI;cANSC,kBAAAA;AAOf,GA1BiBV,eAAAA,aAAAA,CAAAA,EAAAA;",
|
|
6
|
-
"names": ["LayoutAction", "S", "NewPlankPositions", "OverscrollOptions", "DeckSettingsSchema", "S", "mutable", "Struct", "showHints", "Boolean", "enableNativeRedirect", "enableIdeStyleStatusbar", "newPlankPositioning", "Literal", "overscroll", "LayoutMode", "Union", "isLayoutMode", "value", "is", "PlankSizing", "Record", "key", "String", "Number", "Deck", "initialized", "annotations", "description", "active", "Array", "inactive", "solo", "optional", "fullscreen", "plankSizing", "DeckState", "sidebarState", "complementarySidebarState", "complementarySidebarPanel", "dialogOpen", "dialogContent", "Any", "dialogBlockAlign", "dialogType", "popoverOpen", "popoverSide", "popoverContent", "popoverAnchorId", "toasts", "LayoutAction", "Toast", "currentUndoId", "activeDeck", "previousDeck", "decks", "previousMode", "deck", "scrollIntoView", "getMode", "SLUG_PATH_SEPARATOR", "DECK_ACTION", "DECK_PLUGIN", "DeckAction", "PartAdjustmentSchema", "Adjustment", "id", "type", "Adjust", "TaggedClass", "input", "output", "Void", "UpdatePlankSize", "size"]
|
|
7
|
-
}
|