@dxos/plugin-deck 0.8.4-main.21d9917 → 0.8.4-main.2244d791bb
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-DTVCULQ4.mjs → app-graph-builder-X7LCO5KE.mjs} +13 -12
- package/dist/lib/browser/app-graph-builder-X7LCO5KE.mjs.map +7 -0
- package/dist/lib/browser/{check-app-scheme-JSRXXIYF.mjs → check-app-scheme-PGISDJX7.mjs} +8 -8
- package/dist/lib/browser/check-app-scheme-PGISDJX7.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ATFPDN6J.mjs → chunk-DONG2FYU.mjs} +12 -9
- package/dist/lib/browser/chunk-DONG2FYU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-EREEXCHO.mjs → chunk-JGC4ZLG3.mjs} +102 -81
- package/dist/lib/browser/chunk-JGC4ZLG3.mjs.map +7 -0
- package/dist/lib/browser/{chunk-UNG4CLLP.mjs → chunk-YT3AJVUU.mjs} +8 -8
- package/dist/lib/browser/chunk-YT3AJVUU.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +36 -34
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{operation-resolver-CDYBLZJ4.mjs → operation-resolver-XJFR3PNQ.mjs} +86 -84
- package/dist/lib/browser/operation-resolver-XJFR3PNQ.mjs.map +7 -0
- package/dist/lib/browser/{react-root-LYNEKGHM.mjs → react-root-AJFHKHRL.mjs} +6 -6
- package/dist/lib/browser/react-root-AJFHKHRL.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-RPKD7XUR.mjs → react-surface-KBRBGEXY.mjs} +11 -10
- package/dist/lib/browser/react-surface-KBRBGEXY.mjs.map +7 -0
- package/dist/lib/browser/{settings-OMHVGZ6V.mjs → settings-ES42FGLG.mjs} +5 -4
- package/dist/lib/browser/settings-ES42FGLG.mjs.map +7 -0
- package/dist/lib/browser/{state-OC3BSB6E.mjs → state-YMI6IDEL.mjs} +7 -6
- package/dist/lib/browser/state-YMI6IDEL.mjs.map +7 -0
- package/dist/lib/browser/{toolkit-R53LD3EA.mjs → toolkit-VRD54KY3.mjs} +8 -7
- package/dist/lib/browser/toolkit-VRD54KY3.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/browser/{url-handler-53TE6JZO.mjs → url-handler-37UPOB3U.mjs} +11 -10
- package/dist/lib/browser/url-handler-37UPOB3U.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-473BNZDJ.mjs → app-graph-builder-US54I64T.mjs} +13 -12
- package/dist/lib/node-esm/app-graph-builder-US54I64T.mjs.map +7 -0
- package/dist/lib/node-esm/{check-app-scheme-IVYRHKRH.mjs → check-app-scheme-CK6EVG5D.mjs} +8 -8
- package/dist/lib/node-esm/check-app-scheme-CK6EVG5D.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-V6VEXRD4.mjs → chunk-7NPS347C.mjs} +102 -81
- package/dist/lib/node-esm/chunk-7NPS347C.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-XAKTY3EB.mjs → chunk-CVYHPJIN.mjs} +12 -9
- package/dist/lib/node-esm/chunk-CVYHPJIN.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-SKEVPQ7E.mjs → chunk-ZMJPCZ3V.mjs} +8 -8
- package/dist/lib/node-esm/chunk-ZMJPCZ3V.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +36 -34
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{operation-resolver-WUOE33ID.mjs → operation-resolver-ZQGNATPX.mjs} +86 -84
- package/dist/lib/node-esm/operation-resolver-ZQGNATPX.mjs.map +7 -0
- package/dist/lib/node-esm/{react-root-L7H43AS3.mjs → react-root-2S77ABBS.mjs} +6 -6
- package/dist/lib/node-esm/react-root-2S77ABBS.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-77DKVMDV.mjs → react-surface-FIHMAFXH.mjs} +11 -10
- package/dist/lib/node-esm/react-surface-FIHMAFXH.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-2HB6FKIK.mjs → settings-E3TH3FAW.mjs} +5 -4
- package/dist/lib/node-esm/settings-E3TH3FAW.mjs.map +7 -0
- package/dist/lib/node-esm/{state-JRQ45ACJ.mjs → state-WQEFBQMD.mjs} +7 -6
- package/dist/lib/node-esm/state-WQEFBQMD.mjs.map +7 -0
- package/dist/lib/node-esm/{toolkit-JLPZNNKB.mjs → toolkit-ME546G5T.mjs} +8 -7
- package/dist/lib/node-esm/toolkit-ME546G5T.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/lib/node-esm/{url-handler-QGF2R24T.mjs → url-handler-2KYHXINK.mjs} +11 -10
- package/dist/lib/node-esm/url-handler-2KYHXINK.mjs.map +7 -0
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/check-app-scheme/check-app-scheme.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings/index.d.ts +1 -1
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings/settings.d.ts +3 -2
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/state/index.d.ts +2 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/state/state.d.ts +2 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit/index.d.ts +1 -1
- package/dist/types/src/capabilities/toolkit/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts +3 -2
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +1 -1
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ActiveNode.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts +1 -0
- package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Popover.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Toast.d.ts +3 -3
- package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.stories.d.ts +1 -0
- package/dist/types/src/components/Plank/Plank.stories.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankHeading.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +2 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/events.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +2 -0
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +43 -42
- package/src/DeckPlugin.ts +12 -11
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +11 -10
- package/src/capabilities/check-app-scheme/check-app-scheme.ts +12 -8
- package/src/capabilities/operation-resolver/operation-resolver.ts +95 -80
- package/src/capabilities/react-root/react-root.tsx +2 -2
- package/src/capabilities/react-surface/react-surface.tsx +8 -7
- package/src/capabilities/settings/settings.ts +3 -2
- package/src/capabilities/state/state.ts +5 -4
- package/src/capabilities/toolkit/toolkit.ts +6 -5
- package/src/capabilities/url-handler/url-handler.ts +8 -7
- package/src/components/DeckLayout/ActiveNode.tsx +3 -2
- package/src/components/DeckLayout/Banner.tsx +4 -4
- package/src/components/DeckLayout/ContentEmpty.tsx +2 -2
- package/src/components/DeckLayout/DeckLayout.stories.tsx +5 -4
- package/src/components/DeckLayout/DeckMain.tsx +7 -7
- package/src/components/DeckLayout/Dialog.tsx +9 -3
- package/src/components/DeckLayout/Popover.tsx +21 -5
- package/src/components/DeckLayout/StatusBar.tsx +3 -3
- package/src/components/DeckLayout/Toast.tsx +3 -3
- package/src/components/DeckSettings/DeckSettings.tsx +21 -21
- package/src/components/Plank/Plank.stories.tsx +4 -3
- package/src/components/Plank/Plank.tsx +5 -4
- package/src/components/Plank/PlankControls.tsx +1 -1
- package/src/components/Plank/PlankHeading.tsx +7 -6
- package/src/components/Sidebar/ComplementarySidebar.tsx +19 -15
- package/src/components/Sidebar/Sidebar.tsx +2 -2
- package/src/components/Sidebar/SidebarButton.tsx +9 -9
- package/src/hooks/useCompanions.ts +1 -1
- package/src/hooks/useDeckCompanions.ts +1 -1
- package/src/hooks/useDeckState.ts +3 -3
- package/src/hooks/useHoistStatusbar.ts +1 -1
- package/src/translations.ts +1 -0
- package/src/types/capabilities.ts +2 -2
- package/src/types/events.ts +4 -3
- package/src/types/schema.ts +7 -3
- package/dist/lib/browser/app-graph-builder-DTVCULQ4.mjs.map +0 -7
- package/dist/lib/browser/check-app-scheme-JSRXXIYF.mjs.map +0 -7
- package/dist/lib/browser/chunk-ATFPDN6J.mjs.map +0 -7
- package/dist/lib/browser/chunk-EREEXCHO.mjs.map +0 -7
- package/dist/lib/browser/chunk-UNG4CLLP.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-CDYBLZJ4.mjs.map +0 -7
- package/dist/lib/browser/react-root-LYNEKGHM.mjs.map +0 -7
- package/dist/lib/browser/react-surface-RPKD7XUR.mjs.map +0 -7
- package/dist/lib/browser/settings-OMHVGZ6V.mjs.map +0 -7
- package/dist/lib/browser/state-OC3BSB6E.mjs.map +0 -7
- package/dist/lib/browser/toolkit-R53LD3EA.mjs.map +0 -7
- package/dist/lib/browser/url-handler-53TE6JZO.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-473BNZDJ.mjs.map +0 -7
- package/dist/lib/node-esm/check-app-scheme-IVYRHKRH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SKEVPQ7E.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-V6VEXRD4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XAKTY3EB.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-WUOE33ID.mjs.map +0 -7
- package/dist/lib/node-esm/react-root-L7H43AS3.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-77DKVMDV.mjs.map +0 -7
- package/dist/lib/node-esm/settings-2HB6FKIK.mjs.map +0 -7
- package/dist/lib/node-esm/state-JRQ45ACJ.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-JLPZNNKB.mjs.map +0 -7
- package/dist/lib/node-esm/url-handler-QGF2R24T.mjs.map +0 -7
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { Surface
|
|
7
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
8
|
+
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
8
9
|
import { useNode } from '@dxos/plugin-graph';
|
|
9
10
|
import { useAttended } from '@dxos/react-ui-attention';
|
|
10
11
|
|
|
@@ -21,7 +22,7 @@ export const ActiveNode = () => {
|
|
|
21
22
|
<div role='none' className='sr-only'>
|
|
22
23
|
{/* TODO(wittjosiah): Weird that this is a surface, feel like it's not really render logic.
|
|
23
24
|
Probably this lives in React-land currently in order to access translations? */}
|
|
24
|
-
<Surface role='document-title' data={{ subject: activeNode }} limit={1} />
|
|
25
|
+
<Surface.Surface role='document-title' data={{ subject: activeNode }} limit={1} />
|
|
25
26
|
</div>
|
|
26
27
|
);
|
|
27
28
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { Surface } from '@dxos/app-framework/
|
|
7
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
8
8
|
import { type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
import { mx, osTranslations } from '@dxos/ui-theme';
|
|
10
10
|
|
|
@@ -27,13 +27,13 @@ export const Banner = ({ variant, classNames }: ThemedClassName<{ variant?: 'top
|
|
|
27
27
|
{variant === 'topbar' && (
|
|
28
28
|
<div role='none' className='absolute inset-0 pointer-events-none'>
|
|
29
29
|
<div role='none' className='grid bs-full pointer-fine:p-1 max-is-md mli-auto pointer-events-auto'>
|
|
30
|
-
<Surface role='search-input' limit={1} />
|
|
30
|
+
<Surface.Surface role='search-input' limit={1} />
|
|
31
31
|
</div>
|
|
32
32
|
</div>
|
|
33
33
|
)}
|
|
34
34
|
<span role='none' className='grow' />
|
|
35
|
-
<Surface role='header-end' limit={1} />
|
|
36
|
-
<Surface role='notch-start' limit={1} />
|
|
35
|
+
<Surface.Surface role='header-end' limit={1} />
|
|
36
|
+
<Surface.Surface role='notch-start' limit={1} />
|
|
37
37
|
</header>
|
|
38
38
|
);
|
|
39
39
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { Surface } from '@dxos/app-framework/
|
|
7
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
8
8
|
|
|
9
9
|
import { useBreakpoints, useDeckState } from '../../hooks';
|
|
10
10
|
import { getMode } from '../../types';
|
|
@@ -23,7 +23,7 @@ export const ContentEmpty = () => {
|
|
|
23
23
|
className='grid place-items-center p-8 relative bg-deckSurface'
|
|
24
24
|
data-testid='layoutPlugin.firstRunMessage'
|
|
25
25
|
>
|
|
26
|
-
<Surface role='keyshortcuts' />
|
|
26
|
+
<Surface.Surface role='keyshortcuts' />
|
|
27
27
|
{!topbar && <ToggleSidebarButton variant='default' classNames={fixedSidebarToggleStyles} />}
|
|
28
28
|
</div>
|
|
29
29
|
);
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import { Capability,
|
|
8
|
+
import { Capability, Plugin } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { AppActivationEvents, AppPlugin } from '@dxos/app-toolkit';
|
|
10
11
|
import { corePlugins } from '@dxos/plugin-testing';
|
|
11
12
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
12
13
|
|
|
@@ -19,10 +20,10 @@ import { DeckLayout } from './DeckLayout';
|
|
|
19
20
|
const TestPlugin = Plugin.define(pluginMeta).pipe(
|
|
20
21
|
Plugin.addModule({
|
|
21
22
|
id: Capability.getModuleTag(DeckState),
|
|
22
|
-
activatesOn:
|
|
23
|
+
activatesOn: AppActivationEvents.AppGraphReady,
|
|
23
24
|
activate: () => DeckState(),
|
|
24
25
|
}),
|
|
25
|
-
|
|
26
|
+
AppPlugin.addOperationResolverModule({
|
|
26
27
|
activate: LayoutOperationResolver,
|
|
27
28
|
}),
|
|
28
29
|
Plugin.make,
|
|
@@ -33,7 +34,7 @@ const meta = {
|
|
|
33
34
|
component: DeckLayout,
|
|
34
35
|
render: (args) => <DeckLayout {...args} />,
|
|
35
36
|
decorators: [
|
|
36
|
-
withTheme,
|
|
37
|
+
withTheme(),
|
|
37
38
|
withPluginManager({
|
|
38
39
|
plugins: [...corePlugins(), TestPlugin()],
|
|
39
40
|
}),
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { Fragment, type UIEvent, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useAtomCapability, useOperationInvoker, usePluginManager } from '@dxos/app-framework/ui';
|
|
8
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
9
9
|
import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
10
|
-
import { Main, type
|
|
10
|
+
import { Main, type MainContentProps, useMediaQuery, useOnTransition } from '@dxos/react-ui';
|
|
11
11
|
import { DEFAULT_HORIZONTAL_SIZE, Stack, StackContext } from '@dxos/react-ui-stack';
|
|
12
12
|
import { mainPaddingTransitions, mx } from '@dxos/ui-theme';
|
|
13
13
|
|
|
@@ -61,9 +61,9 @@ export const DeckMain = () => {
|
|
|
61
61
|
const attended = attention.getCurrent();
|
|
62
62
|
|
|
63
63
|
shouldRevert.current = true;
|
|
64
|
-
invokeSync(
|
|
64
|
+
invokeSync(LayoutOperation.SetLayoutMode, { subject: attended[0], mode: 'solo' });
|
|
65
65
|
} else if (isNotMobile && layoutMode === 'solo' && shouldRevert.current) {
|
|
66
|
-
invokeSync(
|
|
66
|
+
invokeSync(LayoutOperation.SetLayoutMode, { revert: true });
|
|
67
67
|
}
|
|
68
68
|
// NOTE: Using `layoutMode` instead of `deck` to avoid infinite loops caused by object reference changes.
|
|
69
69
|
}, [isNotMobile, layoutMode, invokeSync]);
|
|
@@ -72,7 +72,7 @@ export const DeckMain = () => {
|
|
|
72
72
|
// TODO(thure): Applying this as an effect should be avoided over emitting the operation only when the setting changes.
|
|
73
73
|
useEffect(() => {
|
|
74
74
|
if (!settings?.enableDeck && layoutMode === 'deck') {
|
|
75
|
-
invokeSync(
|
|
75
|
+
invokeSync(LayoutOperation.SetLayoutMode, { subject: active[0], mode: 'solo' });
|
|
76
76
|
}
|
|
77
77
|
}, [settings?.enableDeck, invokeSync, active, layoutMode]);
|
|
78
78
|
|
|
@@ -196,7 +196,7 @@ export const DeckMain = () => {
|
|
|
196
196
|
: '0',
|
|
197
197
|
'--dx-main-contentFirstWidth': `${plankSizing[active[0] ?? 'never'] ?? DEFAULT_HORIZONTAL_SIZE}rem`,
|
|
198
198
|
'--dx-main-contentLastWidth': `${plankSizing[active[(active.length ?? 1) - 1] ?? 'never'] ?? DEFAULT_HORIZONTAL_SIZE}rem`,
|
|
199
|
-
} as
|
|
199
|
+
} as MainContentProps['style']
|
|
200
200
|
}
|
|
201
201
|
>
|
|
202
202
|
{/* Deck mode. */}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Surface } from '@dxos/app-framework/
|
|
7
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
8
8
|
import { AlertDialog, Dialog as NaturalDialog } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
10
|
import { useDeckState } from '../../hooks';
|
|
@@ -28,10 +28,16 @@ export const Dialog = () => {
|
|
|
28
28
|
<Root modal={dialogBlockAlign !== 'end'} open={dialogOpen} onOpenChange={handleOpenChange}>
|
|
29
29
|
{dialogBlockAlign === 'end' ? (
|
|
30
30
|
// TODO(burdon): Placeholder creates a suspense boundary; replace with defaults.
|
|
31
|
-
<Surface
|
|
31
|
+
<Surface.Surface
|
|
32
|
+
role='dialog'
|
|
33
|
+
data={dialogContent}
|
|
34
|
+
limit={1}
|
|
35
|
+
fallback={PlankContentError}
|
|
36
|
+
placeholder={<div />}
|
|
37
|
+
/>
|
|
32
38
|
) : (
|
|
33
39
|
<Overlay blockAlign={dialogBlockAlign} classNames={dialogOverlayClasses} style={dialogOverlayStyle}>
|
|
34
|
-
<Surface role='dialog' data={dialogContent} limit={1} fallback={PlankContentError} />
|
|
40
|
+
<Surface.Surface role='dialog' data={dialogContent} limit={1} fallback={PlankContentError} />
|
|
35
41
|
</Overlay>
|
|
36
42
|
)}
|
|
37
43
|
</Root>
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { createContext } from '@radix-ui/react-context';
|
|
6
6
|
import React, { type PropsWithChildren, useCallback, useEffect, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { Surface } from '@dxos/app-framework/
|
|
8
|
+
import { Surface, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
9
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
9
10
|
import { Popover, type PopoverContentInteractOutsideEvent, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
10
11
|
import { Card } from '@dxos/react-ui-mosaic';
|
|
11
12
|
|
|
@@ -59,6 +60,7 @@ export const PopoverContent = () => {
|
|
|
59
60
|
const { t } = useTranslation(meta.id);
|
|
60
61
|
const { state, updateEphemeral } = useDeckState();
|
|
61
62
|
const { setOpen } = useDeckPopoverContext('PopoverContent');
|
|
63
|
+
const { invokeSync } = useOperationInvoker();
|
|
62
64
|
|
|
63
65
|
const handleClose = useCallback(() => {
|
|
64
66
|
setOpen(false);
|
|
@@ -96,18 +98,32 @@ export const PopoverContent = () => {
|
|
|
96
98
|
onEscapeKeyDown={handleInteractOutside}
|
|
97
99
|
>
|
|
98
100
|
<Popover.Viewport>
|
|
101
|
+
{/* TODO(burdon): Set/disable column context. */}
|
|
102
|
+
{state.popoverKind === 'base' && <Surface.Surface role='popover' data={state.popoverContent} limit={1} />}
|
|
99
103
|
{state.popoverKind === 'card' && (
|
|
100
|
-
<Card.Root>
|
|
104
|
+
<Card.Root border={false} classNames='popover-card-max-width'>
|
|
101
105
|
<Card.Toolbar>
|
|
102
106
|
{/* TODO(wittjosiah): Cleaner way to handle no drag handle in toolbar? */}
|
|
103
|
-
|
|
107
|
+
{state.popoverContentRef ? (
|
|
108
|
+
<Card.ToolbarIconButton
|
|
109
|
+
icon='ph--arrow-square-out--regular'
|
|
110
|
+
iconOnly
|
|
111
|
+
label={t('open item label')}
|
|
112
|
+
onClick={() => {
|
|
113
|
+
invokeSync(LayoutOperation.Open, {
|
|
114
|
+
subject: [state.popoverContentRef!],
|
|
115
|
+
});
|
|
116
|
+
}}
|
|
117
|
+
/>
|
|
118
|
+
) : (
|
|
119
|
+
<div />
|
|
120
|
+
)}
|
|
104
121
|
{state.popoverTitle ? <Card.Title>{toLocalizedString(state.popoverTitle, t)}</Card.Title> : <span />}
|
|
105
122
|
<Card.Close onClick={handleClose} />
|
|
106
123
|
</Card.Toolbar>
|
|
107
|
-
<Surface role='card--content' data={state.popoverContent} limit={1} />
|
|
124
|
+
<Surface.Surface role='card--content' data={state.popoverContent} limit={1} />
|
|
108
125
|
</Card.Root>
|
|
109
126
|
)}
|
|
110
|
-
{state.popoverKind === 'base' && <Surface role='popover' data={state.popoverContent} limit={1} />}
|
|
111
127
|
</Popover.Viewport>
|
|
112
128
|
<Popover.Arrow />
|
|
113
129
|
</Popover.Content>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { Surface } from '@dxos/app-framework/
|
|
7
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
8
8
|
import { useLandmarkMover } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
10
|
export const StatusBar = ({ showHints }: { showHints?: boolean }) => {
|
|
@@ -15,8 +15,8 @@ export const StatusBar = ({ showHints }: { showHints?: boolean }) => {
|
|
|
15
15
|
className='fixed block-end-0 inset-inline-0 bs-[--statusbar-size] border-bs border-separator z-[2] flex text-description'
|
|
16
16
|
{...mover}
|
|
17
17
|
>
|
|
18
|
-
{showHints && <Surface role='hints' limit={1} />}
|
|
19
|
-
<Surface role='status-bar' limit={1} />
|
|
18
|
+
{showHints && <Surface.Surface role='hints' limit={1} />}
|
|
19
|
+
<Surface.Surface role='status-bar' limit={1} />
|
|
20
20
|
</div>
|
|
21
21
|
);
|
|
22
22
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type LayoutOperation } from '@dxos/app-toolkit';
|
|
8
8
|
import {
|
|
9
9
|
Button,
|
|
10
10
|
Icon,
|
|
@@ -28,7 +28,7 @@ export const Toast = ({
|
|
|
28
28
|
closeLabel,
|
|
29
29
|
onAction,
|
|
30
30
|
onOpenChange,
|
|
31
|
-
}:
|
|
31
|
+
}: LayoutOperation.Toast & Pick<ToastRootProps, 'onOpenChange'>) => {
|
|
32
32
|
const { t } = useTranslation(meta.id);
|
|
33
33
|
|
|
34
34
|
return (
|
|
@@ -61,7 +61,7 @@ export const Toast = ({
|
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
export type ToasterProps = {
|
|
64
|
-
toasts?:
|
|
64
|
+
toasts?: LayoutOperation.Toast[];
|
|
65
65
|
onDismissToast?: (id: string) => void;
|
|
66
66
|
};
|
|
67
67
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { Input, Select, useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import {
|
|
8
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
9
9
|
|
|
10
10
|
import { meta } from '../../meta';
|
|
11
11
|
import {
|
|
@@ -27,22 +27,22 @@ export const DeckSettings = ({ settings, onSettingsChange }: DeckSettingsCompone
|
|
|
27
27
|
const { t } = useTranslation(meta.id);
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
<
|
|
33
|
-
<
|
|
30
|
+
<Settings.Root>
|
|
31
|
+
<Settings.Section title={t('settings title', { ns: meta.id })}>
|
|
32
|
+
<Settings.Group>
|
|
33
|
+
<Settings.ItemInput title={t('settings enable deck label')}>
|
|
34
34
|
<Input.Switch
|
|
35
35
|
checked={settings.enableDeck}
|
|
36
36
|
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, enableDeck: checked }))}
|
|
37
37
|
/>
|
|
38
|
-
</
|
|
39
|
-
<
|
|
38
|
+
</Settings.ItemInput>
|
|
39
|
+
<Settings.ItemInput title={t('settings encapsulated planks label')}>
|
|
40
40
|
<Input.Switch
|
|
41
41
|
checked={settings.encapsulatedPlanks ?? false}
|
|
42
42
|
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, encapsulatedPlanks: checked }))}
|
|
43
43
|
/>
|
|
44
|
-
</
|
|
45
|
-
<
|
|
44
|
+
</Settings.ItemInput>
|
|
45
|
+
<Settings.ItemInput title={t('select new plank positioning label')}>
|
|
46
46
|
<Select.Root
|
|
47
47
|
disabled={!settings.enableDeck}
|
|
48
48
|
value={settings.newPlankPositioning ?? 'start'}
|
|
@@ -64,8 +64,8 @@ export const DeckSettings = ({ settings, onSettingsChange }: DeckSettingsCompone
|
|
|
64
64
|
</Select.Content>
|
|
65
65
|
</Select.Portal>
|
|
66
66
|
</Select.Root>
|
|
67
|
-
</
|
|
68
|
-
<
|
|
67
|
+
</Settings.ItemInput>
|
|
68
|
+
<Settings.ItemInput title={t('settings overscroll label')}>
|
|
69
69
|
<Select.Root
|
|
70
70
|
disabled={!settings.enableDeck}
|
|
71
71
|
value={settings.overscroll ?? 'none'}
|
|
@@ -85,29 +85,29 @@ export const DeckSettings = ({ settings, onSettingsChange }: DeckSettingsCompone
|
|
|
85
85
|
</Select.Content>
|
|
86
86
|
</Select.Portal>
|
|
87
87
|
</Select.Root>
|
|
88
|
-
</
|
|
89
|
-
<
|
|
88
|
+
</Settings.ItemInput>
|
|
89
|
+
<Settings.ItemInput title={t('settings enable statusbar label')}>
|
|
90
90
|
<Input.Switch
|
|
91
91
|
checked={settings.enableStatusbar}
|
|
92
92
|
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, enableStatusbar: checked }))}
|
|
93
93
|
/>
|
|
94
|
-
</
|
|
95
|
-
<
|
|
94
|
+
</Settings.ItemInput>
|
|
95
|
+
<Settings.ItemInput title={t('settings show hints label')}>
|
|
96
96
|
<Input.Switch
|
|
97
97
|
checked={settings.showHints}
|
|
98
98
|
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, showHints: checked }))}
|
|
99
99
|
/>
|
|
100
|
-
</
|
|
100
|
+
</Settings.ItemInput>
|
|
101
101
|
{!isSocket && (
|
|
102
|
-
<
|
|
102
|
+
<Settings.ItemInput title={t('settings native redirect label')}>
|
|
103
103
|
<Input.Switch
|
|
104
104
|
checked={settings.enableNativeRedirect}
|
|
105
105
|
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, enableNativeRedirect: checked }))}
|
|
106
106
|
/>
|
|
107
|
-
</
|
|
107
|
+
</Settings.ItemInput>
|
|
108
108
|
)}
|
|
109
|
-
</
|
|
110
|
-
</
|
|
111
|
-
</
|
|
109
|
+
</Settings.Group>
|
|
110
|
+
</Settings.Section>
|
|
111
|
+
</Settings.Root>
|
|
112
112
|
);
|
|
113
113
|
};
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import { Capability,
|
|
8
|
+
import { Capability, Plugin } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
10
11
|
import { corePlugins } from '@dxos/plugin-testing';
|
|
11
12
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
12
13
|
import { Stack } from '@dxos/react-ui-stack';
|
|
@@ -20,7 +21,7 @@ import { Plank } from './Plank';
|
|
|
20
21
|
const TestPlugin = Plugin.define(pluginMeta).pipe(
|
|
21
22
|
Plugin.addModule({
|
|
22
23
|
id: Capability.getModuleTag(DeckState),
|
|
23
|
-
activatesOn:
|
|
24
|
+
activatesOn: AppActivationEvents.AppGraphReady,
|
|
24
25
|
activate: () => DeckState(),
|
|
25
26
|
}),
|
|
26
27
|
Plugin.make,
|
|
@@ -37,7 +38,7 @@ const meta = {
|
|
|
37
38
|
);
|
|
38
39
|
},
|
|
39
40
|
decorators: [
|
|
40
|
-
withTheme,
|
|
41
|
+
withTheme(),
|
|
41
42
|
withPluginManager({
|
|
42
43
|
plugins: [...corePlugins(), TestPlugin()],
|
|
43
44
|
}),
|
|
@@ -13,8 +13,9 @@ import React, {
|
|
|
13
13
|
useRef,
|
|
14
14
|
} from 'react';
|
|
15
15
|
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { Surface, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
17
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
18
|
+
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
18
19
|
import { debounce } from '@dxos/async';
|
|
19
20
|
import { type Node, useNode } from '@dxos/plugin-graph';
|
|
20
21
|
import { ATTENDABLE_PATH_SEPARATOR, useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
@@ -200,7 +201,7 @@ const PlankComponent = memo(
|
|
|
200
201
|
if (scrollIntoView === id) {
|
|
201
202
|
layoutMode === 'deck' && rootElement.current?.scrollIntoView({ behavior: 'smooth', inline: 'center' });
|
|
202
203
|
// Clear the scroll into view state once it has been actioned.
|
|
203
|
-
void invokePromise(
|
|
204
|
+
void invokePromise(LayoutOperation.ScrollIntoView, { subject: undefined });
|
|
204
205
|
}
|
|
205
206
|
}, [id, scrollIntoView, layoutMode, invokePromise]);
|
|
206
207
|
|
|
@@ -280,7 +281,7 @@ const PlankComponent = memo(
|
|
|
280
281
|
companions={companions}
|
|
281
282
|
/>
|
|
282
283
|
)}
|
|
283
|
-
<Surface
|
|
284
|
+
<Surface.Surface
|
|
284
285
|
key={node.id}
|
|
285
286
|
role='article'
|
|
286
287
|
data={data}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { forwardRef, useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import { useOperationInvoker } from '@dxos/app-framework/
|
|
7
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
8
|
import { invariant } from '@dxos/invariant';
|
|
9
9
|
import { ButtonGroup, type ButtonGroupProps, type ButtonProps, IconButton, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { Fragment, type MouseEvent, memo, useCallback, useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { Surface, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
9
|
+
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
9
10
|
import { Graph, type Node, useActionRunner } from '@dxos/plugin-graph';
|
|
10
11
|
import { Icon, IconButton, Popover, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
11
12
|
import { StackItem, type StackItemSigilAction } from '@dxos/react-ui-stack';
|
|
@@ -121,9 +122,9 @@ export const PlankHeading = memo(
|
|
|
121
122
|
return invokePromise(DeckOperation.Adjust, { type: eventType, id });
|
|
122
123
|
} else if (eventType === 'close') {
|
|
123
124
|
if (part === 'complementary') {
|
|
124
|
-
return invokeSync(
|
|
125
|
+
return invokeSync(LayoutOperation.UpdateComplementary, { state: 'collapsed' });
|
|
125
126
|
} else {
|
|
126
|
-
return invokeSync(
|
|
127
|
+
return invokeSync(LayoutOperation.Close, { subject: [id] });
|
|
127
128
|
}
|
|
128
129
|
} else {
|
|
129
130
|
return invokePromise(DeckOperation.Adjust, { type: eventType, id });
|
|
@@ -191,7 +192,7 @@ export const PlankHeading = memo(
|
|
|
191
192
|
actions={sigilActions}
|
|
192
193
|
onAction={handleAction}
|
|
193
194
|
>
|
|
194
|
-
<Surface role='menu-footer' data={{ subject: node.data }} />
|
|
195
|
+
<Surface.Surface role='menu-footer' data={{ subject: node.data }} />
|
|
195
196
|
</StackItem.Sigil>
|
|
196
197
|
) : (
|
|
197
198
|
<StackItem.SigilButton>
|
|
@@ -211,7 +212,7 @@ export const PlankHeading = memo(
|
|
|
211
212
|
</TextTooltip>
|
|
212
213
|
</>
|
|
213
214
|
)}
|
|
214
|
-
{node && part !== 'complementary' && <Surface role='navbar-end' data={{ subject: node.data }} />}
|
|
215
|
+
{node && part !== 'complementary' && <Surface.Surface role='navbar-end' data={{ subject: node.data }} />}
|
|
215
216
|
{companioned === 'companion' ? (
|
|
216
217
|
<PlankCompanionControls primary={primaryId} />
|
|
217
218
|
) : (
|
|
@@ -12,9 +12,9 @@ import React, {
|
|
|
12
12
|
useState,
|
|
13
13
|
} from 'react';
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { IconButton, type Label, Main, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
15
|
+
import { Surface, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
16
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
17
|
+
import { IconButton, type Label, Main, ScrollArea, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
18
18
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
19
19
|
import { mx } from '@dxos/ui-theme';
|
|
20
20
|
|
|
@@ -61,14 +61,14 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
61
61
|
(event: MouseEvent) => {
|
|
62
62
|
const nextValue = event.currentTarget.getAttribute('data-value') as string;
|
|
63
63
|
if (nextValue === activeId) {
|
|
64
|
-
updateState((
|
|
65
|
-
...
|
|
66
|
-
complementarySidebarState:
|
|
64
|
+
updateState((state) => ({
|
|
65
|
+
...state,
|
|
66
|
+
complementarySidebarState: state.complementarySidebarState === 'expanded' ? 'collapsed' : 'expanded',
|
|
67
67
|
}));
|
|
68
68
|
} else {
|
|
69
69
|
setInternalValue(nextValue);
|
|
70
|
-
updateState((
|
|
71
|
-
invokeSync(
|
|
70
|
+
updateState((state) => ({ ...state, complementarySidebarState: 'expanded' }));
|
|
71
|
+
invokeSync(LayoutOperation.UpdateComplementary, { subject: nextValue });
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
[state.complementarySidebarState, activeId, invokeSync, updateState],
|
|
@@ -85,7 +85,7 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
85
85
|
|
|
86
86
|
useEffect(() => {
|
|
87
87
|
if (!activeId) {
|
|
88
|
-
invokeSync(
|
|
88
|
+
invokeSync(LayoutOperation.UpdateComplementary, { state: 'collapsed' });
|
|
89
89
|
}
|
|
90
90
|
}, [activeId, invokeSync]);
|
|
91
91
|
|
|
@@ -129,7 +129,7 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
129
129
|
</Tabs.Tablist>
|
|
130
130
|
{!hoistStatusbar && (
|
|
131
131
|
<div role='none' className='grid grid-cols-1 auto-rows-[--rail-item] p-1 overflow-y-auto'>
|
|
132
|
-
<Surface role='status-bar--r0-footer' limit={1} />
|
|
132
|
+
<Surface.Surface role='status-bar--r0-footer' limit={1} />
|
|
133
133
|
</div>
|
|
134
134
|
)}
|
|
135
135
|
<div role='none' className='hidden lg:grid grid-cols-1 auto-rows-[--rail-action] p-1'>
|
|
@@ -178,7 +178,7 @@ const ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }
|
|
|
178
178
|
return null;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
const Wrapper = companion.properties.fixed ? Fragment :
|
|
181
|
+
const Wrapper = companion.properties.fixed ? Fragment : ScrollAreaWrapper;
|
|
182
182
|
|
|
183
183
|
return (
|
|
184
184
|
<>
|
|
@@ -197,7 +197,7 @@ const ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }
|
|
|
197
197
|
</div>
|
|
198
198
|
</div>
|
|
199
199
|
<Wrapper>
|
|
200
|
-
<Surface
|
|
200
|
+
<Surface.Surface
|
|
201
201
|
role={`deck-companion--${getCompanionId(companion.id)}`}
|
|
202
202
|
data={data}
|
|
203
203
|
fallback={PlankContentError}
|
|
@@ -209,13 +209,17 @@ const ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }
|
|
|
209
209
|
role='contentinfo'
|
|
210
210
|
className='flex flex-wrap justify-center items-center border-bs border-subduedSeparator pbs-1 pbe-[max(env(safe-area-inset-bottom),0.25rem)]'
|
|
211
211
|
>
|
|
212
|
-
<Surface role='status-bar--r1-footer' limit={1} />
|
|
212
|
+
<Surface.Surface role='status-bar--r1-footer' limit={1} />
|
|
213
213
|
</div>
|
|
214
214
|
)}
|
|
215
215
|
</>
|
|
216
216
|
);
|
|
217
217
|
};
|
|
218
218
|
|
|
219
|
-
const
|
|
220
|
-
return
|
|
219
|
+
const ScrollAreaWrapper = ({ children }: PropsWithChildren) => {
|
|
220
|
+
return (
|
|
221
|
+
<ScrollArea.Root thin orientation='vertical' classNames='grow'>
|
|
222
|
+
<ScrollArea.Viewport>{children}</ScrollArea.Viewport>
|
|
223
|
+
</ScrollArea.Root>
|
|
224
|
+
);
|
|
221
225
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Surface } from '@dxos/app-framework/
|
|
7
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
8
8
|
import { type Label, Main } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
10
|
import { useBreakpoints, useDeckState, useHoistStatusbar } from '../../hooks';
|
|
@@ -36,7 +36,7 @@ export const Sidebar = () => {
|
|
|
36
36
|
hoistStatusbar && 'block-end-[--statusbar-size]',
|
|
37
37
|
]}
|
|
38
38
|
>
|
|
39
|
-
<Surface role='navigation' data={navigationData} limit={1} />
|
|
39
|
+
<Surface.Surface role='navigation' data={navigationData} limit={1} />
|
|
40
40
|
</Main.NavigationSidebar>
|
|
41
41
|
);
|
|
42
42
|
};
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
9
9
|
import { IconButton, type IconButtonProps, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
|
|
11
11
|
import { getCompanionId, useDeckCompanions, useDeckState } from '../../hooks';
|
|
@@ -15,13 +15,13 @@ export const ToggleSidebarButton = ({
|
|
|
15
15
|
classNames,
|
|
16
16
|
variant = 'ghost',
|
|
17
17
|
}: ThemedClassName<Pick<IconButtonProps, 'variant'>>) => {
|
|
18
|
-
const {
|
|
18
|
+
const { updateState } = useDeckState();
|
|
19
19
|
const { t } = useTranslation(meta.id);
|
|
20
20
|
|
|
21
21
|
const handleClick = useCallback(() => {
|
|
22
|
-
updateState((
|
|
23
|
-
...
|
|
24
|
-
sidebarState:
|
|
22
|
+
updateState((state) => ({
|
|
23
|
+
...state,
|
|
24
|
+
sidebarState: state.sidebarState === 'expanded' ? 'collapsed' : 'expanded',
|
|
25
25
|
}));
|
|
26
26
|
}, [updateState]);
|
|
27
27
|
|
|
@@ -43,7 +43,7 @@ export const CloseSidebarButton = () => {
|
|
|
43
43
|
const { t } = useTranslation(meta.id);
|
|
44
44
|
|
|
45
45
|
const handleClick = useCallback(() => {
|
|
46
|
-
updateState((
|
|
46
|
+
updateState((state) => ({ ...state, sidebarState: 'collapsed' }));
|
|
47
47
|
}, [updateState]);
|
|
48
48
|
|
|
49
49
|
return (
|
|
@@ -71,11 +71,11 @@ export const ToggleComplementarySidebarButton = ({
|
|
|
71
71
|
const companions = useDeckCompanions();
|
|
72
72
|
const handleClick = useCallback(() => {
|
|
73
73
|
const nextState = state.complementarySidebarState === 'expanded' ? 'collapsed' : 'expanded';
|
|
74
|
-
updateState((
|
|
74
|
+
updateState((state) => ({ ...state, complementarySidebarState: nextState }));
|
|
75
75
|
|
|
76
76
|
const subject = state.complementarySidebarPanel ?? (companions[0] && getCompanionId(companions[0].id));
|
|
77
77
|
if (nextState === 'expanded' && !current && subject) {
|
|
78
|
-
invokeSync(
|
|
78
|
+
invokeSync(LayoutOperation.UpdateComplementary, { subject });
|
|
79
79
|
}
|
|
80
80
|
}, [state, updateState, current, companions, invokeSync]);
|
|
81
81
|
|