@dxos/plugin-deck 0.7.5-main.9d2a38b → 0.7.5-main.e94eead
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/{app-graph-builder-67VRUD5K.mjs → app-graph-builder-IYHAGFA3.mjs} +61 -31
- package/dist/lib/browser/app-graph-builder-IYHAGFA3.mjs.map +7 -0
- package/dist/lib/browser/{check-app-scheme-GEX6W2R5.mjs → check-app-scheme-S3EYUPMF.mjs} +3 -3
- package/dist/lib/browser/{check-app-scheme-GEX6W2R5.mjs.map → check-app-scheme-S3EYUPMF.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-5VFDMW5M.mjs → chunk-22AQ5IVX.mjs} +2 -2
- package/dist/lib/browser/chunk-22AQ5IVX.mjs.map +7 -0
- package/dist/lib/browser/chunk-FT33W5CI.mjs +128 -0
- package/dist/lib/browser/chunk-FT33W5CI.mjs.map +7 -0
- package/dist/lib/browser/chunk-G2X3ZDCE.mjs +24 -0
- package/dist/lib/browser/chunk-G2X3ZDCE.mjs.map +7 -0
- package/dist/lib/browser/chunk-KANJBSIX.mjs +97 -0
- package/dist/lib/browser/chunk-KANJBSIX.mjs.map +7 -0
- package/dist/lib/browser/{chunk-JQJ5UWVB.mjs → chunk-N7TEPFVR.mjs} +3 -2
- package/dist/lib/browser/{chunk-JQJ5UWVB.mjs.map → chunk-N7TEPFVR.mjs.map} +3 -3
- package/dist/lib/browser/chunk-O4RFYYQ6.mjs +1114 -0
- package/dist/lib/browser/chunk-O4RFYYQ6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +45 -78
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-ZD67BRUI.mjs +488 -0
- package/dist/lib/browser/intent-resolver-ZD67BRUI.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-UL7ZDRVZ.mjs → react-root-6ILKHD5J.mjs} +12 -17
- package/dist/lib/browser/react-root-6ILKHD5J.mjs.map +7 -0
- package/dist/lib/browser/react-surface-O75FKXAI.mjs +39 -0
- package/dist/lib/browser/react-surface-O75FKXAI.mjs.map +7 -0
- package/dist/lib/browser/{settings-FNWW6WIJ.mjs → settings-H35U6NHE.mjs} +6 -7
- package/dist/lib/browser/settings-H35U6NHE.mjs.map +7 -0
- package/dist/lib/browser/state-U4SHOPJW.mjs +129 -0
- package/dist/lib/browser/state-U4SHOPJW.mjs.map +7 -0
- package/dist/lib/browser/tools-64LXGLYR.mjs +59 -0
- package/dist/lib/browser/tools-64LXGLYR.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +16 -4
- package/dist/lib/browser/url-handler-MVHTKUYA.mjs +72 -0
- package/dist/lib/browser/url-handler-MVHTKUYA.mjs.map +7 -0
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +137 -8
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/check-app-scheme.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +188 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +79 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/tools.d.ts +10 -0
- package/dist/types/src/capabilities/tools.d.ts.map +1 -0
- package/dist/types/src/capabilities/url-handler.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/ActiveNode.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/ActiveNode.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Banner.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/Banner.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts +1 -4
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +2 -7
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Fallback.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/Fallback.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Fullscreen.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/Fullscreen.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts +3 -3
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Plank.d.ts +8 -6
- package/dist/types/src/components/DeckLayout/Plank.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/PlankControls.d.ts +2 -2
- package/dist/types/src/components/DeckLayout/PlankControls.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/PlankError.d.ts +6 -6
- package/dist/types/src/components/DeckLayout/PlankError.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/PlankLoading.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/PlankLoading.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/SidebarButton.d.ts +6 -5
- package/dist/types/src/components/DeckLayout/SidebarButton.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/StatusBar.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/StatusBar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Toast.d.ts +2 -3
- package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Topbar.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/Topbar.d.ts.map +1 -1
- package/dist/types/src/components/LayoutSettings.d.ts +1 -2
- package/dist/types/src/components/LayoutSettings.d.ts.map +1 -1
- package/dist/types/src/components/fragments.d.ts +2 -0
- package/dist/types/src/components/fragments.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +1 -0
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/hooks/useMainSize.d.ts +2 -2
- package/dist/types/src/hooks/useNode.d.ts.map +1 -1
- package/dist/types/src/layout.d.ts +5 -19
- package/dist/types/src/layout.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -3
- package/dist/types/src/types.d.ts +117 -2
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +3 -1
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/layoutAppliesTopbar.d.ts +2 -0
- package/dist/types/src/util/layoutAppliesTopbar.d.ts.map +1 -0
- package/dist/types/src/util/set-active.d.ts +9 -0
- package/dist/types/src/util/set-active.d.ts.map +1 -0
- package/dist/types/src/util/useHoistStatusbar.d.ts.map +1 -1
- package/package.json +32 -31
- package/src/DeckPlugin.ts +23 -59
- package/src/capabilities/{layout/app-graph-builder.ts → app-graph-builder.ts} +40 -28
- package/src/capabilities/capabilities.ts +5 -7
- package/src/capabilities/{navigation/check-app-scheme.ts → check-app-scheme.ts} +2 -2
- package/src/capabilities/index.ts +12 -3
- package/src/capabilities/intent-resolver.ts +368 -0
- package/src/capabilities/{layout/react-root.tsx → react-root.tsx} +8 -14
- package/src/capabilities/react-surface.tsx +31 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +4 -5
- package/src/capabilities/state.ts +108 -0
- package/src/capabilities/tools.ts +66 -0
- package/src/capabilities/url-handler.ts +65 -0
- package/src/components/DeckLayout/ActiveNode.tsx +2 -3
- package/src/components/DeckLayout/ComplementarySidebar.tsx +185 -77
- package/src/components/DeckLayout/ContentEmpty.tsx +7 -10
- package/src/components/DeckLayout/DeckLayout.tsx +141 -84
- package/src/components/DeckLayout/Fullscreen.tsx +2 -3
- package/src/components/DeckLayout/NodePlankHeading.tsx +57 -65
- package/src/components/DeckLayout/Plank.tsx +33 -41
- package/src/components/DeckLayout/PlankControls.tsx +12 -11
- package/src/components/DeckLayout/PlankError.tsx +6 -5
- package/src/components/DeckLayout/Sidebar.tsx +17 -20
- package/src/components/DeckLayout/SidebarButton.tsx +25 -31
- package/src/components/DeckLayout/StatusBar.tsx +5 -11
- package/src/components/DeckLayout/Toast.tsx +2 -2
- package/src/components/LayoutSettings.tsx +8 -8
- package/src/components/fragments.ts +8 -0
- package/src/components/index.ts +0 -2
- package/src/events.ts +1 -0
- package/src/hooks/useMainSize.ts +3 -3
- package/src/hooks/useNode.ts +3 -1
- package/src/layout.ts +43 -212
- package/src/meta.ts +1 -0
- package/src/translations.ts +8 -8
- package/src/types.ts +103 -4
- package/src/util/index.ts +3 -1
- package/src/util/layoutAppliesTopbar.ts +7 -0
- package/src/util/set-active.ts +47 -0
- package/src/util/useHoistStatusbar.ts +13 -8
- package/dist/lib/browser/app-graph-builder-67VRUD5K.mjs.map +0 -7
- package/dist/lib/browser/chunk-2M4PXYNB.mjs +0 -1052
- package/dist/lib/browser/chunk-2M4PXYNB.mjs.map +0 -7
- package/dist/lib/browser/chunk-2PJNBVCY.mjs +0 -39
- package/dist/lib/browser/chunk-2PJNBVCY.mjs.map +0 -7
- package/dist/lib/browser/chunk-4C2AFTET.mjs +0 -186
- package/dist/lib/browser/chunk-4C2AFTET.mjs.map +0 -7
- package/dist/lib/browser/chunk-5VFDMW5M.mjs.map +0 -7
- package/dist/lib/browser/chunk-KY5WXIXY.mjs +0 -44
- package/dist/lib/browser/chunk-KY5WXIXY.mjs.map +0 -7
- package/dist/lib/browser/deck-PLCSKPGL.mjs +0 -26
- package/dist/lib/browser/deck-PLCSKPGL.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-FVOQSTBX.mjs +0 -152
- package/dist/lib/browser/intent-resolver-FVOQSTBX.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-K7GW4A2I.mjs +0 -249
- package/dist/lib/browser/intent-resolver-K7GW4A2I.mjs.map +0 -7
- package/dist/lib/browser/location-QHRBQBQN.mjs +0 -35
- package/dist/lib/browser/location-QHRBQBQN.mjs.map +0 -7
- package/dist/lib/browser/react-context-3BDW7W2N.mjs +0 -32
- package/dist/lib/browser/react-context-3BDW7W2N.mjs.map +0 -7
- package/dist/lib/browser/react-root-UL7ZDRVZ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-VPNOGGNN.mjs +0 -28
- package/dist/lib/browser/react-surface-VPNOGGNN.mjs.map +0 -7
- package/dist/lib/browser/settings-FNWW6WIJ.mjs.map +0 -7
- package/dist/lib/browser/state-7I5BD7SE.mjs +0 -34
- package/dist/lib/browser/state-7I5BD7SE.mjs.map +0 -7
- package/dist/lib/browser/url-handler-Z5B7LD3N.mjs +0 -76
- package/dist/lib/browser/url-handler-Z5B7LD3N.mjs.map +0 -7
- package/dist/types/src/capabilities/layout/app-graph-builder.d.ts +0 -181
- package/dist/types/src/capabilities/layout/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/layout/deck.d.ts +0 -4
- package/dist/types/src/capabilities/layout/deck.d.ts.map +0 -1
- package/dist/types/src/capabilities/layout/index.d.ts +0 -229
- package/dist/types/src/capabilities/layout/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/layout/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/layout/react-context.d.ts +0 -8
- package/dist/types/src/capabilities/layout/react-context.d.ts.map +0 -1
- package/dist/types/src/capabilities/layout/react-root.d.ts.map +0 -1
- package/dist/types/src/capabilities/layout/state.d.ts +0 -42
- package/dist/types/src/capabilities/layout/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation/check-app-scheme.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation/index.d.ts +0 -5
- package/dist/types/src/capabilities/navigation/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/navigation/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation/location.d.ts +0 -4
- package/dist/types/src/capabilities/navigation/location.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation/set-location.d.ts +0 -10
- package/dist/types/src/capabilities/navigation/set-location.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation/url-handler.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -3
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
- package/dist/types/src/components/DeckContext.d.ts +0 -11
- package/dist/types/src/components/DeckContext.d.ts.map +0 -1
- package/dist/types/src/components/LayoutContext.d.ts +0 -5
- package/dist/types/src/components/LayoutContext.d.ts.map +0 -1
- package/dist/types/src/layout.test.d.ts +0 -2
- package/dist/types/src/layout.test.d.ts.map +0 -1
- package/dist/types/src/util/layout-parts.d.ts +0 -7
- package/dist/types/src/util/layout-parts.d.ts.map +0 -1
- package/src/capabilities/layout/deck.ts +0 -25
- package/src/capabilities/layout/index.ts +0 -12
- package/src/capabilities/layout/intent-resolver.ts +0 -128
- package/src/capabilities/layout/react-context.tsx +0 -26
- package/src/capabilities/layout/state.ts +0 -32
- package/src/capabilities/navigation/index.ts +0 -10
- package/src/capabilities/navigation/intent-resolver.ts +0 -216
- package/src/capabilities/navigation/location.ts +0 -28
- package/src/capabilities/navigation/set-location.ts +0 -38
- package/src/capabilities/navigation/url-handler.ts +0 -67
- package/src/capabilities/settings/index.ts +0 -8
- package/src/capabilities/settings/react-surface.tsx +0 -23
- package/src/components/DeckContext.ts +0 -19
- package/src/components/LayoutContext.ts +0 -12
- package/src/layout.test.ts +0 -380
- package/src/util/layout-parts.ts +0 -12
- /package/dist/types/src/capabilities/{navigation/check-app-scheme.d.ts → check-app-scheme.d.ts} +0 -0
- /package/dist/types/src/capabilities/{layout/intent-resolver.d.ts → intent-resolver.d.ts} +0 -0
- /package/dist/types/src/capabilities/{layout/react-root.d.ts → react-root.d.ts} +0 -0
- /package/dist/types/src/capabilities/{settings/react-surface.d.ts → react-surface.d.ts} +0 -0
- /package/dist/types/src/capabilities/{settings/settings.d.ts → settings.d.ts} +0 -0
- /package/dist/types/src/capabilities/{navigation/url-handler.d.ts → url-handler.d.ts} +0 -0
|
@@ -4,22 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Capabilities, contributes,
|
|
7
|
+
import { Capabilities, contributes, useCapability } from '@dxos/app-framework';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
9
|
+
import { DeckCapabilities } from './capabilities';
|
|
10
|
+
import { DeckLayout } from '../components';
|
|
11
|
+
import { DECK_PLUGIN } from '../meta';
|
|
12
|
+
import { type DeckSettingsProps } from '../types';
|
|
13
13
|
|
|
14
14
|
export default () =>
|
|
15
15
|
contributes(Capabilities.ReactRoot, {
|
|
16
16
|
id: DECK_PLUGIN,
|
|
17
17
|
root: () => {
|
|
18
|
-
const layout = useCapability(
|
|
19
|
-
const location = useCapability(Capabilities.Location);
|
|
20
|
-
const deck = useCapability(DeckCapabilities.MutableDeckState);
|
|
18
|
+
const layout = useCapability(DeckCapabilities.MutableDeckState);
|
|
21
19
|
const settings = useCapability(Capabilities.SettingsStore).getStore<DeckSettingsProps>(DECK_PLUGIN)!.value;
|
|
22
|
-
const panels = useCapabilities(DeckCapabilities.ComplementaryPanel);
|
|
23
20
|
|
|
24
21
|
const handleDismissToast = useCallback(
|
|
25
22
|
(id: string) => {
|
|
@@ -28,8 +25,8 @@ export default () =>
|
|
|
28
25
|
// Allow time for the toast to animate out.
|
|
29
26
|
// TODO(burdon): Factor out and unregister timeout.
|
|
30
27
|
setTimeout(() => {
|
|
31
|
-
if (layout.toasts[index].id ===
|
|
32
|
-
|
|
28
|
+
if (layout.toasts[index].id === layout.currentUndoId) {
|
|
29
|
+
layout.currentUndoId = undefined;
|
|
33
30
|
}
|
|
34
31
|
layout.toasts.splice(index, 1);
|
|
35
32
|
}, 1_000);
|
|
@@ -40,11 +37,8 @@ export default () =>
|
|
|
40
37
|
|
|
41
38
|
return (
|
|
42
39
|
<DeckLayout
|
|
43
|
-
layoutParts={location.active}
|
|
44
40
|
showHints={settings.showHints}
|
|
45
41
|
overscroll={settings.overscroll}
|
|
46
|
-
toasts={layout.toasts}
|
|
47
|
-
panels={panels}
|
|
48
42
|
onDismissToast={handleDismissToast}
|
|
49
43
|
/>
|
|
50
44
|
);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
8
|
+
import { SettingsStore } from '@dxos/local-storage';
|
|
9
|
+
|
|
10
|
+
import { LayoutSettings } from '../components';
|
|
11
|
+
import { Banner } from '../components/DeckLayout/Banner';
|
|
12
|
+
import { DECK_PLUGIN } from '../meta';
|
|
13
|
+
import { type DeckSettingsProps } from '../types';
|
|
14
|
+
|
|
15
|
+
export default () =>
|
|
16
|
+
contributes(Capabilities.ReactSurface, [
|
|
17
|
+
createSurface({
|
|
18
|
+
id: `${DECK_PLUGIN}/settings`,
|
|
19
|
+
role: 'article',
|
|
20
|
+
filter: (data): data is { subject: SettingsStore<DeckSettingsProps> } =>
|
|
21
|
+
data.subject instanceof SettingsStore && data.subject.prefix === DECK_PLUGIN,
|
|
22
|
+
component: ({ data: { subject } }) => <LayoutSettings settings={subject.value} />,
|
|
23
|
+
}),
|
|
24
|
+
createSurface({
|
|
25
|
+
id: `${DECK_PLUGIN}/banner`,
|
|
26
|
+
role: 'banner',
|
|
27
|
+
component: ({ data }) => {
|
|
28
|
+
return <Banner variant={data.variant} />;
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
]);
|
|
@@ -5,17 +5,16 @@
|
|
|
5
5
|
import { Capabilities, contributes } from '@dxos/app-framework';
|
|
6
6
|
import { create } from '@dxos/live-object';
|
|
7
7
|
|
|
8
|
-
import { DECK_PLUGIN } from '
|
|
9
|
-
import { DeckSettingsSchema, type DeckSettingsProps } from '
|
|
8
|
+
import { DECK_PLUGIN } from '../meta';
|
|
9
|
+
import { DeckSettingsSchema, type DeckSettingsProps } from '../types';
|
|
10
10
|
|
|
11
11
|
export default () => {
|
|
12
12
|
const settings = create<DeckSettingsProps>({
|
|
13
13
|
showHints: false,
|
|
14
|
-
customSlots: false,
|
|
15
|
-
flatDeck: false,
|
|
16
14
|
enableNativeRedirect: false,
|
|
15
|
+
enableIdeStyleStatusbar: true,
|
|
17
16
|
newPlankPositioning: 'start',
|
|
18
|
-
overscroll: '
|
|
17
|
+
overscroll: 'none',
|
|
19
18
|
});
|
|
20
19
|
|
|
21
20
|
return contributes(Capabilities.Settings, { schema: DeckSettingsSchema, prefix: DECK_PLUGIN, value: settings });
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capabilities, contributes } from '@dxos/app-framework';
|
|
6
|
+
import { invariant } from '@dxos/invariant';
|
|
7
|
+
import { create } from '@dxos/live-object';
|
|
8
|
+
import { LocalStorageStore } from '@dxos/local-storage';
|
|
9
|
+
import { type SidebarState } from '@dxos/react-ui';
|
|
10
|
+
|
|
11
|
+
import { DeckCapabilities } from './capabilities';
|
|
12
|
+
import { DECK_PLUGIN } from '../meta';
|
|
13
|
+
import { getMode, type Deck, type DeckState } from '../types';
|
|
14
|
+
|
|
15
|
+
const boolean = /true|false/;
|
|
16
|
+
|
|
17
|
+
// TODO(thure, 18 Feb 2025): Remove after the next release.
|
|
18
|
+
|
|
19
|
+
const migrateSidebarStateDefaults = {
|
|
20
|
+
[`${DECK_PLUGIN}/complementary-sidebar-state`]: 'expanded',
|
|
21
|
+
[`${DECK_PLUGIN}/sidebar-state`]: 'collapsed',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const migrateSidebarState = () => {
|
|
25
|
+
Object.entries(migrateSidebarStateDefaults).forEach(([key, defaultValue]) => {
|
|
26
|
+
if (boolean.test(localStorage.getItem(key) ?? 'never')) {
|
|
27
|
+
localStorage.setItem(key, defaultValue);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default () => {
|
|
33
|
+
migrateSidebarState();
|
|
34
|
+
|
|
35
|
+
const state = new LocalStorageStore<DeckState>(DECK_PLUGIN, {
|
|
36
|
+
sidebarState: 'expanded',
|
|
37
|
+
complementarySidebarState: 'collapsed',
|
|
38
|
+
complementarySidebarPanel: undefined,
|
|
39
|
+
dialogContent: null,
|
|
40
|
+
dialogOpen: false,
|
|
41
|
+
dialogBlockAlign: undefined,
|
|
42
|
+
dialogType: undefined,
|
|
43
|
+
popoverContent: null,
|
|
44
|
+
popoverAnchorId: undefined,
|
|
45
|
+
popoverOpen: false,
|
|
46
|
+
toasts: [],
|
|
47
|
+
currentUndoId: undefined,
|
|
48
|
+
activeDeck: 'default',
|
|
49
|
+
previousDeck: 'default',
|
|
50
|
+
decks: {
|
|
51
|
+
default: {
|
|
52
|
+
initialized: false,
|
|
53
|
+
active: [],
|
|
54
|
+
inactive: [],
|
|
55
|
+
fullscreen: false,
|
|
56
|
+
solo: undefined,
|
|
57
|
+
plankSizing: {},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
get deck() {
|
|
61
|
+
const deck = this.decks[this.activeDeck];
|
|
62
|
+
invariant(deck, `Deck not found: ${this.activeDeck}`);
|
|
63
|
+
return deck;
|
|
64
|
+
},
|
|
65
|
+
previousMode: {},
|
|
66
|
+
scrollIntoView: undefined,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
state
|
|
70
|
+
.prop({ key: 'sidebarState', type: LocalStorageStore.enum<SidebarState>() })
|
|
71
|
+
.prop({ key: 'complementarySidebarState', type: LocalStorageStore.enum<SidebarState>() })
|
|
72
|
+
.prop({ key: 'complementarySidebarPanel', type: LocalStorageStore.string({ allowUndefined: true }) })
|
|
73
|
+
.prop({ key: 'decks', type: LocalStorageStore.json<Record<string, Deck>>() })
|
|
74
|
+
.prop({ key: 'activeDeck', type: LocalStorageStore.string() })
|
|
75
|
+
.prop({ key: 'previousDeck', type: LocalStorageStore.string() });
|
|
76
|
+
|
|
77
|
+
const layout = create<Capabilities.Layout>({
|
|
78
|
+
get mode() {
|
|
79
|
+
return getMode(state.values.deck);
|
|
80
|
+
},
|
|
81
|
+
get dialogOpen() {
|
|
82
|
+
return state.values.dialogOpen;
|
|
83
|
+
},
|
|
84
|
+
get sidebarOpen() {
|
|
85
|
+
return state.values.sidebarState === 'expanded';
|
|
86
|
+
},
|
|
87
|
+
get complementarySidebarOpen() {
|
|
88
|
+
return state.values.complementarySidebarState === 'expanded';
|
|
89
|
+
},
|
|
90
|
+
get workspace() {
|
|
91
|
+
return state.values.activeDeck;
|
|
92
|
+
},
|
|
93
|
+
get active() {
|
|
94
|
+
return state.values.deck.solo ? [state.values.deck.solo] : state.values.deck.active;
|
|
95
|
+
},
|
|
96
|
+
get inactive() {
|
|
97
|
+
return state.values.deck.inactive;
|
|
98
|
+
},
|
|
99
|
+
get scrollIntoView() {
|
|
100
|
+
return state.values.scrollIntoView;
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
return [
|
|
105
|
+
contributes(DeckCapabilities.DeckState, state.values, () => state.close()),
|
|
106
|
+
contributes(Capabilities.Layout, layout),
|
|
107
|
+
];
|
|
108
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
contributes,
|
|
7
|
+
createIntent,
|
|
8
|
+
Capabilities,
|
|
9
|
+
LayoutAction,
|
|
10
|
+
type PromiseIntentDispatcher,
|
|
11
|
+
} from '@dxos/app-framework';
|
|
12
|
+
import { defineTool, ToolResult } from '@dxos/artifact';
|
|
13
|
+
import { S } from '@dxos/echo-schema';
|
|
14
|
+
import { invariant } from '@dxos/invariant';
|
|
15
|
+
|
|
16
|
+
import { meta } from '../meta';
|
|
17
|
+
|
|
18
|
+
// TODO(burdon): Factor out.
|
|
19
|
+
declare global {
|
|
20
|
+
interface ToolContextExtensions {
|
|
21
|
+
dispatch?: PromiseIntentDispatcher;
|
|
22
|
+
pivotId?: string;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default () =>
|
|
27
|
+
contributes(Capabilities.Tools, [
|
|
28
|
+
defineTool(meta.id, {
|
|
29
|
+
name: 'show',
|
|
30
|
+
// TODO(ZaymonFC): We should update the prompt to teach the LLM the difference between object ids and fully qualified ids.
|
|
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...',
|
|
36
|
+
// TODO(wittjosiah): Refactor Layout/Navigation/Deck actions so that they can be used directly.
|
|
37
|
+
schema: S.Struct({
|
|
38
|
+
id: S.String.annotations({
|
|
39
|
+
description: 'The ID of the item to show.',
|
|
40
|
+
}),
|
|
41
|
+
pivotId: S.optional(
|
|
42
|
+
S.String.annotations({
|
|
43
|
+
description: 'The ID of the chat. If provided, the item will be added after the pivot item.',
|
|
44
|
+
}),
|
|
45
|
+
),
|
|
46
|
+
}),
|
|
47
|
+
execute: async ({ id }, { extensions }) => {
|
|
48
|
+
invariant(extensions?.dispatch, 'No intent dispatcher');
|
|
49
|
+
const { data, error } = await extensions.dispatch(
|
|
50
|
+
createIntent(LayoutAction.Open, {
|
|
51
|
+
subject: [id],
|
|
52
|
+
part: 'main',
|
|
53
|
+
options: {
|
|
54
|
+
pivotId: extensions.pivotId,
|
|
55
|
+
positioning: 'end',
|
|
56
|
+
},
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
59
|
+
if (error) {
|
|
60
|
+
return ToolResult.Error(error.message);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return ToolResult.Success(data);
|
|
64
|
+
},
|
|
65
|
+
}),
|
|
66
|
+
]);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capabilities, contributes, createIntent, LayoutAction, type PluginsContext } from '@dxos/app-framework';
|
|
6
|
+
import { scheduledEffect } from '@dxos/echo-signals/core';
|
|
7
|
+
|
|
8
|
+
import { DeckCapabilities } from './capabilities';
|
|
9
|
+
|
|
10
|
+
// TODO(wittjosiah): Cleanup the url handling. May justify introducing routing capabilities.
|
|
11
|
+
export default async (context: PluginsContext) => {
|
|
12
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher) ?? {};
|
|
13
|
+
const state = context.requestCapability(DeckCapabilities.MutableDeckState);
|
|
14
|
+
|
|
15
|
+
const handleNavigation = async () => {
|
|
16
|
+
const pathname = window.location.pathname;
|
|
17
|
+
if (pathname === '/reset') {
|
|
18
|
+
state.activeDeck = 'default';
|
|
19
|
+
state.decks = {
|
|
20
|
+
default: {
|
|
21
|
+
initialized: false,
|
|
22
|
+
active: [],
|
|
23
|
+
inactive: [],
|
|
24
|
+
fullscreen: false,
|
|
25
|
+
solo: undefined,
|
|
26
|
+
plankSizing: {},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
window.location.pathname = '/';
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const [_, nextDeck, nextSolo] = pathname.split('/');
|
|
34
|
+
if (nextDeck && nextDeck !== state.activeDeck) {
|
|
35
|
+
await dispatch(createIntent(LayoutAction.SwitchWorkspace, { part: 'workspace', subject: nextDeck }));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (nextSolo && nextSolo !== state.deck.solo) {
|
|
39
|
+
await dispatch(
|
|
40
|
+
createIntent(LayoutAction.SetLayoutMode, { part: 'mode', subject: nextSolo, options: { mode: 'solo' } }),
|
|
41
|
+
);
|
|
42
|
+
} else if (!nextSolo && state.deck.solo) {
|
|
43
|
+
await dispatch(createIntent(LayoutAction.SetLayoutMode, { part: 'mode', options: { mode: 'deck' } }));
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
await handleNavigation();
|
|
48
|
+
window.addEventListener('popstate', handleNavigation);
|
|
49
|
+
|
|
50
|
+
const unsubscribe = scheduledEffect(
|
|
51
|
+
() => ({ solo: state.deck.solo, activeDeck: state.activeDeck }),
|
|
52
|
+
({ solo, activeDeck }) => {
|
|
53
|
+
const path = solo ? `/${activeDeck}/${solo}` : `/${activeDeck}`;
|
|
54
|
+
if (window.location.pathname !== path) {
|
|
55
|
+
// TODO(thure): In some browsers, this only preserves the most recent state change, even though this is not `history.replace`…
|
|
56
|
+
history.pushState(null, '', `${path}${window.location.search}`);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
return contributes(Capabilities.Null, null, () => {
|
|
62
|
+
window.removeEventListener('popstate', handleNavigation);
|
|
63
|
+
unsubscribe();
|
|
64
|
+
});
|
|
65
|
+
};
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { Surface } from '@dxos/app-framework';
|
|
8
|
-
import { useGraph } from '@dxos/plugin-graph';
|
|
7
|
+
import { Surface, useAppGraph } from '@dxos/app-framework';
|
|
9
8
|
import { useAttended } from '@dxos/react-ui-attention';
|
|
10
9
|
|
|
11
10
|
import { useNode, useNodeActionExpander } from '../../hooks';
|
|
@@ -13,7 +12,7 @@ import { useNode, useNodeActionExpander } from '../../hooks';
|
|
|
13
12
|
// TODO(burdon): Factor out to effect in plugin set document title.
|
|
14
13
|
export const ActiveNode = () => {
|
|
15
14
|
const [id] = useAttended();
|
|
16
|
-
const { graph } =
|
|
15
|
+
const { graph } = useAppGraph();
|
|
17
16
|
const activeNode = useNode(graph, id);
|
|
18
17
|
useNodeActionExpander(activeNode);
|
|
19
18
|
|
|
@@ -2,111 +2,219 @@
|
|
|
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
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
import {
|
|
16
|
+
createIntent,
|
|
17
|
+
LayoutAction,
|
|
18
|
+
Surface,
|
|
19
|
+
useAppGraph,
|
|
20
|
+
useCapabilities,
|
|
21
|
+
useCapability,
|
|
22
|
+
useIntentDispatcher,
|
|
23
|
+
} from '@dxos/app-framework';
|
|
24
|
+
import { Main, useTranslation, toLocalizedString, IconButton, ScrollArea as NaturalScrollArea } from '@dxos/react-ui';
|
|
10
25
|
import { useAttended } from '@dxos/react-ui-attention';
|
|
11
|
-
import { railGridHorizontal, StackContext, StackItem } from '@dxos/react-ui-stack';
|
|
12
26
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
13
|
-
import {
|
|
27
|
+
import { byPosition } from '@dxos/util';
|
|
14
28
|
|
|
15
29
|
import { PlankContentError } from './PlankError';
|
|
16
30
|
import { PlankLoading } from './PlankLoading';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
31
|
+
import { ToggleComplementarySidebarButton } from './SidebarButton';
|
|
32
|
+
import { DeckCapabilities } from '../../capabilities';
|
|
33
|
+
import { useNode } from '../../hooks';
|
|
19
34
|
import { DECK_PLUGIN } from '../../meta';
|
|
20
35
|
import { type Panel } from '../../types';
|
|
21
|
-
import {
|
|
36
|
+
import { layoutAppliesTopbar, useBreakpoints, useHoistStatusbar } from '../../util';
|
|
22
37
|
|
|
23
38
|
export type ComplementarySidebarProps = {
|
|
24
|
-
panels: Panel[];
|
|
25
39
|
current?: string;
|
|
26
40
|
};
|
|
27
41
|
|
|
28
|
-
export const ComplementarySidebar = ({
|
|
29
|
-
const { popoverAnchorId } = useLayout();
|
|
30
|
-
const attended = useAttended();
|
|
31
|
-
const panelIds = useMemo(() => panels.map((p) => p.id), [panels]);
|
|
32
|
-
const activePanelId = panelIds.find((p) => p === current) ?? panels[0].id;
|
|
33
|
-
const activeEntryId = attended[0] ? `${attended[0]}${SLUG_PATH_SEPARATOR}${activePanelId}` : undefined;
|
|
34
|
-
const { graph } = useGraph();
|
|
35
|
-
const node = useNode(graph, activeEntryId);
|
|
42
|
+
export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) => {
|
|
36
43
|
const { t } = useTranslation(DECK_PLUGIN);
|
|
37
44
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
38
|
-
|
|
45
|
+
const layout = useCapability(DeckCapabilities.MutableDeckState);
|
|
46
|
+
const attended = useAttended();
|
|
47
|
+
const { graph } = useAppGraph();
|
|
48
|
+
const node = useNode(graph, attended[0]);
|
|
49
|
+
const breakpoint = useBreakpoints();
|
|
50
|
+
const topbar = layoutAppliesTopbar(breakpoint);
|
|
51
|
+
const hoistStatusbar = useHoistStatusbar(breakpoint);
|
|
52
|
+
|
|
53
|
+
const panels = useCapabilities(DeckCapabilities.ComplementaryPanel);
|
|
54
|
+
const availablePanels = panels
|
|
55
|
+
.filter((panel) => {
|
|
56
|
+
if (!node || !panel.filter) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
39
59
|
|
|
60
|
+
return panel.filter(node);
|
|
61
|
+
})
|
|
62
|
+
.toSorted(byPosition);
|
|
63
|
+
const activePanelId = availablePanels.find((panel) => panel.id === current)?.id ?? availablePanels[0]?.id;
|
|
40
64
|
const [internalValue, setInternalValue] = useState(activePanelId);
|
|
41
65
|
|
|
42
66
|
useEffect(() => {
|
|
43
67
|
setInternalValue(activePanelId);
|
|
44
68
|
}, [activePanelId]);
|
|
45
69
|
|
|
46
|
-
const
|
|
47
|
-
(
|
|
48
|
-
|
|
49
|
-
|
|
70
|
+
const handleTabClick = useCallback(
|
|
71
|
+
(event: MouseEvent) => {
|
|
72
|
+
const nextValue = event.currentTarget.getAttribute('data-value') as string;
|
|
73
|
+
if (nextValue === activePanelId) {
|
|
74
|
+
layout.complementarySidebarState = layout.complementarySidebarState === 'expanded' ? 'collapsed' : 'expanded';
|
|
75
|
+
} else {
|
|
76
|
+
setInternalValue(nextValue);
|
|
77
|
+
layout.complementarySidebarState = 'expanded';
|
|
78
|
+
void dispatch(createIntent(LayoutAction.UpdateComplementary, { part: 'complementary', subject: nextValue }));
|
|
79
|
+
}
|
|
50
80
|
},
|
|
51
|
-
[dispatch],
|
|
81
|
+
[layout, activePanelId, dispatch],
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const data = useMemo(
|
|
85
|
+
() =>
|
|
86
|
+
node && {
|
|
87
|
+
id: node.id,
|
|
88
|
+
subject: node.data,
|
|
89
|
+
workspace: layout.activeDeck,
|
|
90
|
+
popoverAnchorId: layout.popoverAnchorId,
|
|
91
|
+
},
|
|
92
|
+
[node, layout.popoverAnchorId],
|
|
52
93
|
);
|
|
53
94
|
|
|
54
95
|
// TODO(burdon): Scroll area should be controlled by surface.
|
|
55
96
|
return (
|
|
56
|
-
<Main.ComplementarySidebar
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
<ScrollArea.Thumb />
|
|
104
|
-
</ScrollArea.Scrollbar>
|
|
105
|
-
</ScrollArea.Viewport>
|
|
106
|
-
</ScrollArea.Root>
|
|
107
|
-
</Tabs.Root>
|
|
97
|
+
<Main.ComplementarySidebar
|
|
98
|
+
classNames={[
|
|
99
|
+
topbar && 'block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]',
|
|
100
|
+
hoistStatusbar && 'block-end-[--statusbar-size]',
|
|
101
|
+
]}
|
|
102
|
+
>
|
|
103
|
+
<Tabs.Root
|
|
104
|
+
orientation='vertical'
|
|
105
|
+
verticalVariant='stateless'
|
|
106
|
+
value={internalValue}
|
|
107
|
+
attendableId={attended[0]}
|
|
108
|
+
classNames='contents'
|
|
109
|
+
>
|
|
110
|
+
<div
|
|
111
|
+
role='none'
|
|
112
|
+
className='absolute z-[1] inset-block-0 inline-end-0 !is-[--r0-size] pbs-[env(safe-area-inset-top)] pbe-[env(safe-area-inset-bottom)] border-is border-separator grid grid-cols-1 grid-rows-[1fr_min-content] bg-baseSurface contain-layout app-drag'
|
|
113
|
+
>
|
|
114
|
+
<Tabs.Tablist classNames='grid grid-cols-1 auto-rows-[--rail-action] p-1 gap-1 !overflow-y-auto'>
|
|
115
|
+
{availablePanels.map((panel) => (
|
|
116
|
+
<Tabs.Tab key={panel.id} value={panel.id} asChild>
|
|
117
|
+
<IconButton
|
|
118
|
+
label={toLocalizedString(panel.label, t)}
|
|
119
|
+
icon={panel.icon}
|
|
120
|
+
size={5}
|
|
121
|
+
iconOnly
|
|
122
|
+
tooltipSide='left'
|
|
123
|
+
data-value={panel.id}
|
|
124
|
+
variant={
|
|
125
|
+
activePanelId === panel.id
|
|
126
|
+
? layout.complementarySidebarState === 'expanded'
|
|
127
|
+
? 'primary'
|
|
128
|
+
: 'default'
|
|
129
|
+
: 'ghost'
|
|
130
|
+
}
|
|
131
|
+
onClick={handleTabClick}
|
|
132
|
+
/>
|
|
133
|
+
</Tabs.Tab>
|
|
134
|
+
))}
|
|
135
|
+
</Tabs.Tablist>
|
|
136
|
+
{!hoistStatusbar && (
|
|
137
|
+
<div role='none' className='grid grid-cols-1 auto-rows-[--rail-item] p-1 overflow-y-auto'>
|
|
138
|
+
<Surface role='status-bar--r0-footer' limit={1} />
|
|
139
|
+
</div>
|
|
140
|
+
)}
|
|
141
|
+
<div role='none' className='hidden lg:grid grid-cols-1 auto-rows-[--rail-action] p-1'>
|
|
142
|
+
<ToggleComplementarySidebarButton />
|
|
143
|
+
</div>
|
|
108
144
|
</div>
|
|
109
|
-
|
|
145
|
+
{availablePanels.map((panel) => (
|
|
146
|
+
<Tabs.Tabpanel
|
|
147
|
+
key={panel.id}
|
|
148
|
+
value={panel.id}
|
|
149
|
+
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)]'
|
|
150
|
+
{...(layout.complementarySidebarState !== 'expanded' && { inert: 'true' })}
|
|
151
|
+
>
|
|
152
|
+
<ComplementarySidebarPanel
|
|
153
|
+
panel={panel}
|
|
154
|
+
activePanelId={activePanelId}
|
|
155
|
+
data={data}
|
|
156
|
+
hoistStatusbar={hoistStatusbar}
|
|
157
|
+
/>
|
|
158
|
+
</Tabs.Tabpanel>
|
|
159
|
+
))}
|
|
160
|
+
</Tabs.Root>
|
|
110
161
|
</Main.ComplementarySidebar>
|
|
111
162
|
);
|
|
112
163
|
};
|
|
164
|
+
|
|
165
|
+
type ComplementarySidebarPanelProps = {
|
|
166
|
+
panel: Panel;
|
|
167
|
+
activePanelId: string;
|
|
168
|
+
data?: {
|
|
169
|
+
id: string;
|
|
170
|
+
subject: any;
|
|
171
|
+
workspace: string;
|
|
172
|
+
popoverAnchorId?: string;
|
|
173
|
+
};
|
|
174
|
+
hoistStatusbar: boolean;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const ScrollArea = ({ children }: PropsWithChildren) => {
|
|
178
|
+
return (
|
|
179
|
+
<NaturalScrollArea.Root>
|
|
180
|
+
<NaturalScrollArea.Viewport>{children}</NaturalScrollArea.Viewport>
|
|
181
|
+
<NaturalScrollArea.Scrollbar orientation='vertical'>
|
|
182
|
+
<NaturalScrollArea.Thumb />
|
|
183
|
+
</NaturalScrollArea.Scrollbar>
|
|
184
|
+
</NaturalScrollArea.Root>
|
|
185
|
+
);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const ComplementarySidebarPanel = ({ panel, activePanelId, data, hoistStatusbar }: ComplementarySidebarPanelProps) => {
|
|
189
|
+
const { t } = useTranslation(DECK_PLUGIN);
|
|
190
|
+
|
|
191
|
+
if (panel.id !== activePanelId || !data) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const Wrapper = panel.fixed ? Fragment : ScrollArea;
|
|
196
|
+
|
|
197
|
+
return (
|
|
198
|
+
<>
|
|
199
|
+
<h2 className='flex items-center pli-2 border-separator border-be font-medium'>
|
|
200
|
+
{toLocalizedString(panel.label, t)}
|
|
201
|
+
</h2>
|
|
202
|
+
<Wrapper>
|
|
203
|
+
<Surface
|
|
204
|
+
role={`complementary--${activePanelId}`}
|
|
205
|
+
data={data}
|
|
206
|
+
fallback={PlankContentError}
|
|
207
|
+
placeholder={<PlankLoading />}
|
|
208
|
+
/>
|
|
209
|
+
</Wrapper>
|
|
210
|
+
{!hoistStatusbar && (
|
|
211
|
+
<div
|
|
212
|
+
role='contentinfo'
|
|
213
|
+
className='flex flex-wrap justify-center items-center border-bs border-separator pbs-1 pbe-[max(env(safe-area-inset-bottom),0.25rem)]'
|
|
214
|
+
>
|
|
215
|
+
<Surface role='status-bar--r1-footer' limit={1} />
|
|
216
|
+
</div>
|
|
217
|
+
)}
|
|
218
|
+
</>
|
|
219
|
+
);
|
|
220
|
+
};
|