@dxos/plugin-deck 0.8.4-main.1da679c → 0.8.4-main.21d9917
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 +120 -0
- package/dist/lib/browser/app-graph-builder-DTVCULQ4.mjs.map +7 -0
- package/dist/lib/browser/{check-app-scheme-BKIOCWXT.mjs → check-app-scheme-JSRXXIYF.mjs} +9 -9
- package/dist/lib/browser/check-app-scheme-JSRXXIYF.mjs.map +7 -0
- package/dist/lib/browser/{chunk-F5BQOOEG.mjs → chunk-ATFPDN6J.mjs} +155 -23
- package/dist/lib/browser/chunk-ATFPDN6J.mjs.map +7 -0
- package/dist/lib/browser/chunk-EREEXCHO.mjs +1448 -0
- package/dist/lib/browser/chunk-EREEXCHO.mjs.map +7 -0
- package/dist/lib/browser/{chunk-CNTGBCMK.mjs → chunk-NHABISX2.mjs} +40 -33
- package/dist/lib/browser/chunk-NHABISX2.mjs.map +7 -0
- package/dist/lib/browser/chunk-UNG4CLLP.mjs +161 -0
- package/dist/lib/browser/chunk-UNG4CLLP.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +73 -68
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-CDYBLZJ4.mjs +595 -0
- package/dist/lib/browser/operation-resolver-CDYBLZJ4.mjs.map +7 -0
- package/dist/lib/browser/react-root-LYNEKGHM.mjs +47 -0
- package/dist/lib/browser/react-root-LYNEKGHM.mjs.map +7 -0
- package/dist/lib/browser/react-surface-RPKD7XUR.mjs +42 -0
- package/dist/lib/browser/react-surface-RPKD7XUR.mjs.map +7 -0
- package/dist/lib/browser/settings-OMHVGZ6V.mjs +37 -0
- package/dist/lib/browser/settings-OMHVGZ6V.mjs.map +7 -0
- package/dist/lib/browser/state-OC3BSB6E.mjs +103 -0
- package/dist/lib/browser/state-OC3BSB6E.mjs.map +7 -0
- package/dist/lib/browser/toolkit-R53LD3EA.mjs +53 -0
- package/dist/lib/browser/toolkit-R53LD3EA.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +11 -4
- package/dist/lib/browser/url-handler-53TE6JZO.mjs +93 -0
- package/dist/lib/browser/url-handler-53TE6JZO.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-473BNZDJ.mjs +121 -0
- package/dist/lib/node-esm/app-graph-builder-473BNZDJ.mjs.map +7 -0
- package/dist/lib/node-esm/check-app-scheme-IVYRHKRH.mjs +33 -0
- package/dist/lib/node-esm/check-app-scheme-IVYRHKRH.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ADPMWKLL.mjs +154 -0
- package/dist/lib/node-esm/chunk-ADPMWKLL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SKEVPQ7E.mjs +162 -0
- package/dist/lib/node-esm/chunk-SKEVPQ7E.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-V6VEXRD4.mjs +1449 -0
- package/dist/lib/node-esm/chunk-V6VEXRD4.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XAKTY3EB.mjs +294 -0
- package/dist/lib/node-esm/chunk-XAKTY3EB.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +181 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/operation-resolver-WUOE33ID.mjs +596 -0
- package/dist/lib/node-esm/operation-resolver-WUOE33ID.mjs.map +7 -0
- package/dist/lib/node-esm/react-root-L7H43AS3.mjs +48 -0
- package/dist/lib/node-esm/react-root-L7H43AS3.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-77DKVMDV.mjs +43 -0
- package/dist/lib/node-esm/react-surface-77DKVMDV.mjs.map +7 -0
- package/dist/lib/node-esm/settings-2HB6FKIK.mjs +38 -0
- package/dist/lib/node-esm/settings-2HB6FKIK.mjs.map +7 -0
- package/dist/lib/node-esm/state-JRQ45ACJ.mjs +104 -0
- package/dist/lib/node-esm/state-JRQ45ACJ.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-JLPZNNKB.mjs +54 -0
- package/dist/lib/node-esm/toolkit-JLPZNNKB.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +40 -0
- package/dist/lib/node-esm/url-handler-QGF2R24T.mjs +94 -0
- package/dist/lib/node-esm/url-handler-QGF2R24T.mjs.map +7 -0
- package/dist/types/src/DeckPlugin.d.ts +2 -1
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/check-app-scheme/check-app-scheme.d.ts +5 -0
- package/dist/types/src/capabilities/check-app-scheme/check-app-scheme.d.ts.map +1 -0
- package/dist/types/src/capabilities/check-app-scheme/index.d.ts +3 -0
- package/dist/types/src/capabilities/check-app-scheme/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +8 -13
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root/index.d.ts +6 -0
- package/dist/types/src/capabilities/react-root/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root/react-root.d.ts +9 -0
- package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +19 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +21 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +172 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +175 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit/index.d.ts +3 -0
- package/dist/types/src/capabilities/toolkit/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts +26 -0
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +1 -0
- package/dist/types/src/capabilities/tools/index.d.ts +3 -0
- package/dist/types/src/capabilities/tools/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/tools/tools.d.ts +12 -0
- package/dist/types/src/capabilities/tools/tools.d.ts.map +1 -0
- package/dist/types/src/capabilities/url-handler/index.d.ts +3 -0
- package/dist/types/src/capabilities/url-handler/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts +5 -0
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +2 -3
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts +74 -0
- package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/DeckMain.d.ts +3 -0
- package/dist/types/src/components/DeckLayout/DeckMain.d.ts.map +1 -0
- 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 +7 -2
- package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
- package/dist/types/src/components/DeckSettings/DeckSettings.d.ts +4 -2
- package/dist/types/src/components/DeckSettings/DeckSettings.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.d.ts +3 -3
- package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.stories.d.ts +25 -6
- package/dist/types/src/components/Plank/Plank.stories.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankControls.d.ts +1 -1
- package/dist/types/src/components/Plank/PlankControls.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankError.d.ts +1 -1
- package/dist/types/src/components/Plank/PlankError.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankHeading.d.ts +2 -2
- package/dist/types/src/components/Plank/PlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/ComplementarySidebar.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/Sidebar.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/SidebarButton.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useDeckCompanions.d.ts +3 -3
- package/dist/types/src/hooks/useDeckCompanions.d.ts.map +1 -1
- package/dist/types/src/hooks/useDeckState.d.ts +17 -0
- package/dist/types/src/hooks/useDeckState.d.ts.map +1 -0
- package/dist/types/src/hooks/useHoistStatusbar.d.ts +1 -1
- package/dist/types/src/hooks/useHoistStatusbar.d.ts.map +1 -1
- package/dist/types/src/hooks/useNodeActionExpander.d.ts +1 -1
- package/dist/types/src/hooks/useNodeActionExpander.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/{capabilities → types}/capabilities.d.ts +96 -90
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +7 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +90 -30
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/src/util/set-active.d.ts +18 -3
- package/dist/types/src/util/set-active.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +54 -48
- package/src/DeckPlugin.ts +44 -66
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +118 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/{check-app-scheme.ts → check-app-scheme/check-app-scheme.ts} +12 -11
- package/src/capabilities/check-app-scheme/index.ts +7 -0
- package/src/capabilities/index.ts +9 -14
- package/src/capabilities/operation-resolver/index.ts +10 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +555 -0
- package/src/capabilities/react-root/index.ts +7 -0
- package/src/capabilities/react-root/react-root.tsx +47 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +37 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +38 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +104 -0
- package/src/capabilities/toolkit/index.ts +7 -0
- package/src/capabilities/toolkit/toolkit.ts +63 -0
- package/src/capabilities/tools/index.ts +7 -0
- package/src/capabilities/tools/tools.ts +92 -0
- package/src/capabilities/url-handler/index.ts +7 -0
- package/src/capabilities/url-handler/url-handler.ts +95 -0
- package/src/components/DeckLayout/ActiveNode.tsx +1 -1
- package/src/components/DeckLayout/Banner.tsx +5 -5
- package/src/components/DeckLayout/ContentEmpty.tsx +3 -4
- package/src/components/DeckLayout/DeckLayout.stories.tsx +51 -0
- package/src/components/DeckLayout/DeckLayout.tsx +17 -285
- package/src/components/DeckLayout/DeckMain.tsx +286 -0
- package/src/components/DeckLayout/Dialog.tsx +13 -10
- package/src/components/DeckLayout/Fallback.tsx +4 -4
- package/src/components/DeckLayout/Popover.tsx +44 -32
- package/src/components/DeckLayout/StatusBar.tsx +1 -1
- package/src/components/DeckLayout/Toast.tsx +30 -5
- package/src/components/DeckSettings/DeckSettings.tsx +26 -10
- package/src/components/Plank/Plank.stories.tsx +17 -11
- package/src/components/Plank/Plank.tsx +86 -54
- package/src/components/Plank/PlankControls.tsx +9 -9
- package/src/components/Plank/PlankError.tsx +4 -4
- package/src/components/Plank/PlankHeading.tsx +35 -40
- package/src/components/Sidebar/ComplementarySidebar.tsx +58 -31
- package/src/components/Sidebar/Sidebar.tsx +6 -6
- package/src/components/Sidebar/SidebarButton.tsx +39 -32
- package/src/components/fragments.ts +1 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useCompanions.ts +1 -1
- package/src/hooks/useDeckCompanions.ts +6 -4
- package/src/hooks/useDeckState.ts +82 -0
- package/src/hooks/useHoistStatusbar.ts +4 -5
- package/src/hooks/useNodeActionExpander.ts +4 -4
- package/src/index.ts +1 -2
- package/src/meta.ts +8 -5
- package/src/translations.ts +2 -1
- package/src/types/capabilities.ts +33 -0
- package/src/types/events.ts +20 -0
- package/src/types/index.ts +2 -0
- package/src/types/schema.ts +86 -14
- package/src/util/layoutAppliesTopbar.ts +1 -1
- package/src/util/set-active.ts +49 -29
- package/dist/lib/browser/app-graph-builder-DD2EJBLZ.mjs +0 -152
- package/dist/lib/browser/app-graph-builder-DD2EJBLZ.mjs.map +0 -7
- package/dist/lib/browser/check-app-scheme-BKIOCWXT.mjs.map +0 -7
- package/dist/lib/browser/chunk-CNTGBCMK.mjs.map +0 -7
- package/dist/lib/browser/chunk-F5BQOOEG.mjs.map +0 -7
- package/dist/lib/browser/chunk-FMGWFTHR.mjs +0 -1498
- package/dist/lib/browser/chunk-FMGWFTHR.mjs.map +0 -7
- package/dist/lib/browser/chunk-KCXWTPSU.mjs +0 -127
- package/dist/lib/browser/chunk-KCXWTPSU.mjs.map +0 -7
- package/dist/lib/browser/chunk-M57WD3V6.mjs +0 -16
- package/dist/lib/browser/chunk-M57WD3V6.mjs.map +0 -7
- package/dist/lib/browser/chunk-NRCPV6AV.mjs +0 -129
- package/dist/lib/browser/chunk-NRCPV6AV.mjs.map +0 -7
- package/dist/lib/browser/chunk-Z5KITAZW.mjs +0 -13
- package/dist/lib/browser/chunk-Z5KITAZW.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-XSCCU7JI.mjs +0 -521
- package/dist/lib/browser/intent-resolver-XSCCU7JI.mjs.map +0 -7
- package/dist/lib/browser/react-root-E54PO26O.mjs +0 -43
- package/dist/lib/browser/react-root-E54PO26O.mjs.map +0 -7
- package/dist/lib/browser/react-surface-DIZC3J4P.mjs +0 -40
- package/dist/lib/browser/react-surface-DIZC3J4P.mjs.map +0 -7
- package/dist/lib/browser/settings-RNPLZT5S.mjs +0 -29
- package/dist/lib/browser/settings-RNPLZT5S.mjs.map +0 -7
- package/dist/lib/browser/state-CRXR7X63.mjs +0 -12
- package/dist/lib/browser/toolkit-HPFRHY67.mjs +0 -61
- package/dist/lib/browser/toolkit-HPFRHY67.mjs.map +0 -7
- package/dist/lib/browser/url-handler-6IJME37M.mjs +0 -70
- package/dist/lib/browser/url-handler-6IJME37M.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/check-app-scheme.d.ts +0 -4
- package/dist/types/src/capabilities/check-app-scheme.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-root.d.ts +0 -7
- package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state.d.ts +0 -101
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/toolkit.d.ts +0 -5
- package/dist/types/src/capabilities/toolkit.d.ts.map +0 -1
- package/dist/types/src/capabilities/tools.d.ts +0 -11
- package/dist/types/src/capabilities/tools.d.ts.map +0 -1
- package/dist/types/src/capabilities/url-handler.d.ts +0 -4
- package/dist/types/src/capabilities/url-handler.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -142
- package/src/capabilities/capabilities.ts +0 -14
- package/src/capabilities/intent-resolver.ts +0 -469
- package/src/capabilities/react-root.tsx +0 -39
- package/src/capabilities/react-surface.tsx +0 -30
- package/src/capabilities/settings.ts +0 -26
- package/src/capabilities/state.ts +0 -105
- package/src/capabilities/toolkit.ts +0 -55
- package/src/capabilities/tools.ts +0 -84
- package/src/capabilities/url-handler.ts +0 -60
- package/src/events.ts +0 -11
- /package/dist/lib/{browser/state-CRXR7X63.mjs.map → node-esm/types/index.mjs.map} +0 -0
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { forwardRef, useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { useOperationInvoker } from '@dxos/app-framework/react';
|
|
8
8
|
import { invariant } from '@dxos/invariant';
|
|
9
9
|
import { ButtonGroup, type ButtonGroupProps, type ButtonProps, IconButton, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
import { DeckAction, type LayoutMode } from '../../types';
|
|
11
|
+
import { meta } from '../../meta';
|
|
12
|
+
import { type DeckAction, DeckOperation, type LayoutMode } from '../../types';
|
|
13
13
|
|
|
14
14
|
export type PlankControlHandler = (event: DeckAction.PartAdjustment) => void;
|
|
15
15
|
|
|
@@ -32,7 +32,7 @@ export type PlankControlsProps = Omit<ButtonGroupProps, 'onClick'> & {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const PlankControl = ({ icon, label, ...props }: Omit<ButtonProps, 'children'> & { label: string; icon: string }) => {
|
|
35
|
-
return <IconButton
|
|
35
|
+
return <IconButton label={label} icon={icon} iconOnly variant='ghost' tooltipSide='bottom' {...props} />;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
const plankControlSpacing = 'pli-2';
|
|
@@ -43,12 +43,12 @@ type PlankComplimentControlsProps = {
|
|
|
43
43
|
|
|
44
44
|
export const PlankCompanionControls = forwardRef<HTMLDivElement, PlankComplimentControlsProps>(
|
|
45
45
|
({ primary }, forwardedRef) => {
|
|
46
|
-
const { t } = useTranslation(
|
|
47
|
-
const {
|
|
46
|
+
const { t } = useTranslation(meta.id);
|
|
47
|
+
const { invokePromise } = useOperationInvoker();
|
|
48
48
|
const handleCloseCompanion = useCallback(() => {
|
|
49
49
|
invariant(primary);
|
|
50
|
-
return
|
|
51
|
-
}, []);
|
|
50
|
+
return invokePromise(DeckOperation.ChangeCompanion, { primary, companion: null });
|
|
51
|
+
}, [invokePromise, primary]);
|
|
52
52
|
return (
|
|
53
53
|
<div ref={forwardedRef} className='contents app-no-drag'>
|
|
54
54
|
<PlankControl
|
|
@@ -71,7 +71,7 @@ export const PlankControls = forwardRef<HTMLDivElement, PlankControlsProps>(
|
|
|
71
71
|
{ children, classNames, variant = 'default', capabilities, layoutMode, pin, close = false, onClick, ...props },
|
|
72
72
|
forwardedRef,
|
|
73
73
|
) => {
|
|
74
|
-
const { t } = useTranslation(
|
|
74
|
+
const { t } = useTranslation(meta.id);
|
|
75
75
|
const buttonClassNames =
|
|
76
76
|
variant === 'hide-disabled' ? `disabled:hidden ${plankControlSpacing}` : plankControlSpacing;
|
|
77
77
|
|
|
@@ -6,15 +6,15 @@ import React, { useEffect, useState } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { type Node } from '@dxos/plugin-graph';
|
|
8
8
|
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { descriptionMessage, mx } from '@dxos/
|
|
9
|
+
import { descriptionMessage, mx } from '@dxos/ui-theme';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { meta } from '../../meta';
|
|
12
12
|
|
|
13
13
|
import { PlankHeading, type PlankHeadingProps } from './PlankHeading';
|
|
14
14
|
import { PlankLoading } from './PlankLoading';
|
|
15
15
|
|
|
16
16
|
export const PlankContentError = ({ error }: { error?: Error }) => {
|
|
17
|
-
const { t } = useTranslation(
|
|
17
|
+
const { t } = useTranslation(meta.id);
|
|
18
18
|
const errorString = error?.toString() ?? '';
|
|
19
19
|
return (
|
|
20
20
|
<div role='none' className='overflow-y-auto p-8 attention-surface grid place-items-center'>
|
|
@@ -33,7 +33,7 @@ export const PlankError = ({
|
|
|
33
33
|
}: {
|
|
34
34
|
id: string;
|
|
35
35
|
part: PlankHeadingProps['part'];
|
|
36
|
-
node?: Node;
|
|
36
|
+
node?: Node.Node;
|
|
37
37
|
error?: Error;
|
|
38
38
|
}) => {
|
|
39
39
|
const [timedOut, setTimedOut] = useState(false);
|
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { Fragment, type MouseEvent, memo, useCallback, useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { Common } from '@dxos/app-framework';
|
|
8
|
+
import { Surface, useAppGraph, useOperationInvoker } from '@dxos/app-framework/react';
|
|
9
|
+
import { Graph, type Node, useActionRunner } from '@dxos/plugin-graph';
|
|
9
10
|
import { Icon, IconButton, Popover, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
10
11
|
import { StackItem, type StackItemSigilAction } from '@dxos/react-ui-stack';
|
|
11
12
|
import { TextTooltip } from '@dxos/react-ui-text-tooltip';
|
|
12
|
-
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/
|
|
13
|
+
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/ui-theme';
|
|
13
14
|
|
|
14
15
|
import { useBreakpoints } from '../../hooks';
|
|
15
16
|
import { parseEntryId } from '../../layout';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
17
|
+
import { meta } from '../../meta';
|
|
18
|
+
import { DeckOperation, type LayoutMode, PLANK_COMPANION_TYPE, type ResolvedPart } from '../../types';
|
|
18
19
|
import { soloInlinePadding } from '../fragments';
|
|
19
20
|
|
|
20
21
|
import { PlankCompanionControls, PlankControls } from './PlankControls';
|
|
@@ -25,7 +26,7 @@ export type PlankHeadingProps = {
|
|
|
25
26
|
id: string;
|
|
26
27
|
part: ResolvedPart;
|
|
27
28
|
layoutMode?: LayoutMode;
|
|
28
|
-
node?: Node;
|
|
29
|
+
node?: Node.Node;
|
|
29
30
|
deckEnabled?: boolean;
|
|
30
31
|
canIncrementStart?: boolean;
|
|
31
32
|
canIncrementEnd?: boolean;
|
|
@@ -33,7 +34,7 @@ export type PlankHeadingProps = {
|
|
|
33
34
|
primaryId?: string;
|
|
34
35
|
pending?: boolean;
|
|
35
36
|
companioned?: 'primary' | 'companion';
|
|
36
|
-
companions?: Node[];
|
|
37
|
+
companions?: Node.Node[];
|
|
37
38
|
actions?: StackItemSigilAction[];
|
|
38
39
|
};
|
|
39
40
|
|
|
@@ -53,14 +54,15 @@ export const PlankHeading = memo(
|
|
|
53
54
|
layoutMode,
|
|
54
55
|
actions = [],
|
|
55
56
|
}: PlankHeadingProps) => {
|
|
56
|
-
const { t } = useTranslation(
|
|
57
|
-
const {
|
|
57
|
+
const { t } = useTranslation(meta.id);
|
|
58
|
+
const { invokePromise, invokeSync } = useOperationInvoker();
|
|
59
|
+
const runAction = useActionRunner();
|
|
58
60
|
const { graph } = useAppGraph();
|
|
59
61
|
const breakpoint = useBreakpoints();
|
|
60
62
|
const icon = node?.properties?.icon ?? 'ph--placeholder--regular';
|
|
61
63
|
const label = pending
|
|
62
64
|
? t('pending heading')
|
|
63
|
-
: toLocalizedString(node?.properties?.label ?? ['plank heading fallback label', { ns:
|
|
65
|
+
: toLocalizedString(node?.properties?.label ?? ['plank heading fallback label', { ns: meta.id }], t);
|
|
64
66
|
|
|
65
67
|
const isCompanionNode = node?.type === PLANK_COMPANION_TYPE;
|
|
66
68
|
|
|
@@ -68,7 +70,7 @@ export const PlankHeading = memo(
|
|
|
68
70
|
const frame = requestAnimationFrame(() => {
|
|
69
71
|
// Load actions for the node.
|
|
70
72
|
if (node) {
|
|
71
|
-
void
|
|
73
|
+
void Graph.expand(graph, node.id);
|
|
72
74
|
}
|
|
73
75
|
});
|
|
74
76
|
|
|
@@ -97,60 +99,53 @@ export const PlankHeading = memo(
|
|
|
97
99
|
} else {
|
|
98
100
|
return [
|
|
99
101
|
actions,
|
|
100
|
-
graph
|
|
101
|
-
.
|
|
102
|
-
|
|
102
|
+
Graph.getActions(graph, node.id).filter((a) =>
|
|
103
|
+
['list-item', 'list-item-primary', 'heading-list-item'].includes(a.properties.disposition),
|
|
104
|
+
),
|
|
103
105
|
].filter((a) => a.length > 0);
|
|
104
106
|
}
|
|
105
107
|
}, [actions, node, variant, graph]);
|
|
106
108
|
|
|
107
109
|
const handleAction = useCallback(
|
|
108
110
|
(action: StackItemSigilAction) => {
|
|
109
|
-
typeof action.data === 'function'
|
|
111
|
+
if (typeof action.data === 'function') {
|
|
112
|
+
void runAction(action as Node.Action, { parent: node, caller: meta.id });
|
|
113
|
+
}
|
|
110
114
|
},
|
|
111
|
-
[node],
|
|
115
|
+
[node, runAction],
|
|
112
116
|
);
|
|
113
117
|
|
|
114
118
|
const handlePlankAction = useCallback(
|
|
115
|
-
(eventType:
|
|
119
|
+
(eventType: DeckOperation.PartAdjustment) => {
|
|
116
120
|
if (eventType.startsWith('solo')) {
|
|
117
|
-
return
|
|
121
|
+
return invokePromise(DeckOperation.Adjust, { type: eventType, id });
|
|
118
122
|
} else if (eventType === 'close') {
|
|
119
123
|
if (part === 'complementary') {
|
|
120
|
-
return
|
|
121
|
-
createIntent(LayoutAction.UpdateComplementary, {
|
|
122
|
-
part: 'complementary',
|
|
123
|
-
options: { state: 'collapsed' },
|
|
124
|
-
}),
|
|
125
|
-
);
|
|
124
|
+
return invokeSync(Common.LayoutOperation.UpdateComplementary, { state: 'collapsed' });
|
|
126
125
|
} else {
|
|
127
|
-
return
|
|
128
|
-
createIntent(LayoutAction.Close, { part: 'main', subject: [id], options: { state: false } }),
|
|
129
|
-
);
|
|
126
|
+
return invokeSync(Common.LayoutOperation.Close, { subject: [id] });
|
|
130
127
|
}
|
|
131
128
|
} else {
|
|
132
|
-
return
|
|
129
|
+
return invokePromise(DeckOperation.Adjust, { type: eventType, id });
|
|
133
130
|
}
|
|
134
131
|
},
|
|
135
|
-
[
|
|
132
|
+
[invokePromise, invokeSync, id, part],
|
|
136
133
|
);
|
|
137
134
|
|
|
138
|
-
const ActionRoot = node && popoverAnchorId === `dxos.org/ui/${
|
|
135
|
+
const ActionRoot = node && popoverAnchorId === `dxos.org/ui/${meta.id}/${node.id}` ? Popover.Anchor : Fragment;
|
|
139
136
|
|
|
140
137
|
const handleTabClick = useCallback(
|
|
141
138
|
(event: MouseEvent) => {
|
|
142
139
|
const target = (event.target as HTMLElement).closest('[data-id]') as HTMLElement | null;
|
|
143
140
|
const tabId = target?.dataset?.id;
|
|
144
141
|
if (primaryId && tabId) {
|
|
145
|
-
void
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}),
|
|
150
|
-
);
|
|
142
|
+
void invokePromise(DeckOperation.ChangeCompanion, {
|
|
143
|
+
primary: primaryId,
|
|
144
|
+
companion: tabId,
|
|
145
|
+
});
|
|
151
146
|
}
|
|
152
147
|
},
|
|
153
|
-
[primaryId],
|
|
148
|
+
[primaryId, invokePromise],
|
|
154
149
|
);
|
|
155
150
|
|
|
156
151
|
return (
|
|
@@ -162,7 +157,8 @@ export const PlankHeading = memo(
|
|
|
162
157
|
? [
|
|
163
158
|
hoverableControls,
|
|
164
159
|
hoverableFocusedWithinControls,
|
|
165
|
-
'*:transition-opacity *:opacity-[--controls-opacity] bg-transparent border-transparent transition-[background-color,border-color]
|
|
160
|
+
'*:transition-opacity *:opacity-[--controls-opacity] bg-transparent border-transparent transition-[background-color,border-color]',
|
|
161
|
+
'hover-hover:hover:bg-headerSurface focus-within:bg-headerSurface hover-hover:hover:border-subduedSeparator focus-within:border-subduedSeparator',
|
|
166
162
|
]
|
|
167
163
|
: []),
|
|
168
164
|
]}
|
|
@@ -178,7 +174,6 @@ export const PlankHeading = memo(
|
|
|
178
174
|
icon={icon}
|
|
179
175
|
iconOnly={companions.length > MAX_COMPANIONS && node?.id !== id}
|
|
180
176
|
label={toLocalizedString(label, t)}
|
|
181
|
-
size={5}
|
|
182
177
|
variant={node?.id === id ? 'primary' : 'ghost'}
|
|
183
178
|
onClick={handleTabClick}
|
|
184
179
|
/>
|
|
@@ -201,7 +196,7 @@ export const PlankHeading = memo(
|
|
|
201
196
|
) : (
|
|
202
197
|
<StackItem.SigilButton>
|
|
203
198
|
<span className='sr-only'>{label}</span>
|
|
204
|
-
<Icon icon={icon}
|
|
199
|
+
<Icon icon={icon} />
|
|
205
200
|
</StackItem.SigilButton>
|
|
206
201
|
)}
|
|
207
202
|
</ActionRoot>
|
|
@@ -12,30 +12,38 @@ import React, {
|
|
|
12
12
|
useState,
|
|
13
13
|
} from 'react';
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { Common } from '@dxos/app-framework';
|
|
16
|
+
import { Surface, useOperationInvoker } from '@dxos/app-framework/react';
|
|
16
17
|
import { IconButton, type Label, Main, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
17
18
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import {
|
|
21
|
-
|
|
19
|
+
import { mx } from '@dxos/ui-theme';
|
|
20
|
+
|
|
21
|
+
import {
|
|
22
|
+
type DeckCompanion,
|
|
23
|
+
getCompanionId,
|
|
24
|
+
useBreakpoints,
|
|
25
|
+
useDeckCompanions,
|
|
26
|
+
useDeckState,
|
|
27
|
+
useHoistStatusbar,
|
|
28
|
+
} from '../../hooks';
|
|
29
|
+
import { meta } from '../../meta';
|
|
22
30
|
import { getMode } from '../../types';
|
|
23
31
|
import { layoutAppliesTopbar } from '../../util';
|
|
24
32
|
import { PlankContentError, PlankLoading } from '../Plank';
|
|
25
33
|
|
|
26
34
|
import { ToggleComplementarySidebarButton } from './SidebarButton';
|
|
27
35
|
|
|
28
|
-
const label = ['complementary sidebar title', { ns:
|
|
36
|
+
const label = ['complementary sidebar title', { ns: meta.id }] satisfies Label;
|
|
29
37
|
|
|
30
38
|
export type ComplementarySidebarProps = {
|
|
31
39
|
current?: string;
|
|
32
40
|
};
|
|
33
41
|
|
|
34
42
|
export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) => {
|
|
35
|
-
const { t } = useTranslation(
|
|
36
|
-
const {
|
|
37
|
-
const
|
|
38
|
-
const layoutMode = getMode(
|
|
43
|
+
const { t } = useTranslation(meta.id);
|
|
44
|
+
const { invokeSync } = useOperationInvoker();
|
|
45
|
+
const { state, deck, updateState } = useDeckState();
|
|
46
|
+
const layoutMode = getMode(deck);
|
|
39
47
|
const breakpoint = useBreakpoints();
|
|
40
48
|
const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
|
|
41
49
|
const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
|
|
@@ -53,14 +61,17 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
53
61
|
(event: MouseEvent) => {
|
|
54
62
|
const nextValue = event.currentTarget.getAttribute('data-value') as string;
|
|
55
63
|
if (nextValue === activeId) {
|
|
56
|
-
|
|
64
|
+
updateState((s) => ({
|
|
65
|
+
...s,
|
|
66
|
+
complementarySidebarState: s.complementarySidebarState === 'expanded' ? 'collapsed' : 'expanded',
|
|
67
|
+
}));
|
|
57
68
|
} else {
|
|
58
69
|
setInternalValue(nextValue);
|
|
59
|
-
|
|
60
|
-
|
|
70
|
+
updateState((s) => ({ ...s, complementarySidebarState: 'expanded' }));
|
|
71
|
+
invokeSync(Common.LayoutOperation.UpdateComplementary, { subject: nextValue });
|
|
61
72
|
}
|
|
62
73
|
},
|
|
63
|
-
[
|
|
74
|
+
[state.complementarySidebarState, activeId, invokeSync, updateState],
|
|
64
75
|
);
|
|
65
76
|
|
|
66
77
|
const data = useMemo(
|
|
@@ -74,11 +85,9 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
74
85
|
|
|
75
86
|
useEffect(() => {
|
|
76
87
|
if (!activeId) {
|
|
77
|
-
|
|
78
|
-
createIntent(LayoutAction.UpdateComplementary, { part: 'complementary', options: { state: 'collapsed' } }),
|
|
79
|
-
);
|
|
88
|
+
invokeSync(Common.LayoutOperation.UpdateComplementary, { state: 'collapsed' });
|
|
80
89
|
}
|
|
81
|
-
}, [activeId,
|
|
90
|
+
}, [activeId, invokeSync]);
|
|
82
91
|
|
|
83
92
|
return (
|
|
84
93
|
<Main.ComplementarySidebar
|
|
@@ -91,7 +100,11 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
91
100
|
<Tabs.Root orientation='vertical' verticalVariant='stateless' value={internalValue} classNames='contents'>
|
|
92
101
|
<div
|
|
93
102
|
role='none'
|
|
94
|
-
className=
|
|
103
|
+
className={mx(
|
|
104
|
+
'absolute z-[1] inset-block-0 inline-end-0 !is-[--r0-size]',
|
|
105
|
+
'pbs-[env(safe-area-inset-top)] pbe-[env(safe-area-inset-bottom)] border-is border-subduedSeparator',
|
|
106
|
+
'grid grid-cols-1 grid-rows-[1fr_min-content] bg-baseSurface contain-layout app-drag',
|
|
107
|
+
)}
|
|
95
108
|
>
|
|
96
109
|
<Tabs.Tablist classNames='grid grid-cols-1 auto-rows-[--rail-action] p-1 gap-1 !overflow-y-auto'>
|
|
97
110
|
{companions.map((companion) => (
|
|
@@ -99,13 +112,12 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
99
112
|
<IconButton
|
|
100
113
|
label={toLocalizedString(companion.properties.label, t)}
|
|
101
114
|
icon={companion.properties.icon}
|
|
102
|
-
size={5}
|
|
103
115
|
iconOnly
|
|
104
116
|
tooltipSide='left'
|
|
105
117
|
data-value={getCompanionId(companion.id)}
|
|
106
118
|
variant={
|
|
107
119
|
activeId === getCompanionId(companion.id)
|
|
108
|
-
?
|
|
120
|
+
? state.complementarySidebarState === 'expanded'
|
|
109
121
|
? 'primary'
|
|
110
122
|
: 'default'
|
|
111
123
|
: 'ghost'
|
|
@@ -129,8 +141,12 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
129
141
|
<Tabs.Tabpanel
|
|
130
142
|
key={getCompanionId(companion.id)}
|
|
131
143
|
value={getCompanionId(companion.id)}
|
|
132
|
-
classNames=
|
|
133
|
-
|
|
144
|
+
classNames={[
|
|
145
|
+
'absolute data-[state="inactive"]:-z-[1] overflow-hidden',
|
|
146
|
+
'inset-block-0 inline-start-0 is-[calc(100%-var(--r0-size))] lg:is-[--r1-size]',
|
|
147
|
+
'grid grid-cols-1 grid-rows-[var(--rail-size)_1fr_min-content] pbs-[env(safe-area-inset-top)]',
|
|
148
|
+
]}
|
|
149
|
+
{...(state.complementarySidebarState !== 'expanded' && { inert: true })}
|
|
134
150
|
>
|
|
135
151
|
<ComplementarySidebarPanel
|
|
136
152
|
companion={companion}
|
|
@@ -155,12 +171,8 @@ type ComplementarySidebarPanelProps = {
|
|
|
155
171
|
hoistStatusbar: boolean;
|
|
156
172
|
};
|
|
157
173
|
|
|
158
|
-
const ScrollArea = ({ children }: PropsWithChildren) => {
|
|
159
|
-
return <div className='flex flex-col grow overflow-x-hidden overflow-y-auto scrollbar-thin'>{children}</div>;
|
|
160
|
-
};
|
|
161
|
-
|
|
162
174
|
const ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }: ComplementarySidebarPanelProps) => {
|
|
163
|
-
const { t } = useTranslation(
|
|
175
|
+
const { t } = useTranslation(meta.id);
|
|
164
176
|
|
|
165
177
|
if (getCompanionId(companion.id) !== activeId && !data) {
|
|
166
178
|
return null;
|
|
@@ -170,9 +182,20 @@ const ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }
|
|
|
170
182
|
|
|
171
183
|
return (
|
|
172
184
|
<>
|
|
173
|
-
<
|
|
174
|
-
|
|
175
|
-
|
|
185
|
+
<div role='none' className='flex items-center p-1 gap-1 border-be border-subduedSeparator'>
|
|
186
|
+
<IconButton
|
|
187
|
+
label={toLocalizedString(companion.properties.label, t)}
|
|
188
|
+
icon={companion.properties.icon}
|
|
189
|
+
iconOnly
|
|
190
|
+
tooltipSide='left'
|
|
191
|
+
data-value={getCompanionId(companion.id)}
|
|
192
|
+
classNames='bs-10 is-10'
|
|
193
|
+
variant='default'
|
|
194
|
+
/>
|
|
195
|
+
<div role='none' className='pli-1'>
|
|
196
|
+
{toLocalizedString(companion.properties.label, t)}
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
176
199
|
<Wrapper>
|
|
177
200
|
<Surface
|
|
178
201
|
role={`deck-companion--${getCompanionId(companion.id)}`}
|
|
@@ -192,3 +215,7 @@ const ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }
|
|
|
192
215
|
</>
|
|
193
216
|
);
|
|
194
217
|
};
|
|
218
|
+
|
|
219
|
+
const ScrollArea = ({ children }: PropsWithChildren) => {
|
|
220
|
+
return <div className='flex flex-col grow overflow-x-hidden overflow-y-auto scrollbar-thin'>{children}</div>;
|
|
221
|
+
};
|
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Surface
|
|
7
|
+
import { Surface } from '@dxos/app-framework/react';
|
|
8
8
|
import { type Label, Main } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { DECK_PLUGIN } from '../../meta';
|
|
10
|
+
import { useBreakpoints, useDeckState, useHoistStatusbar } from '../../hooks';
|
|
11
|
+
import { meta } from '../../meta';
|
|
13
12
|
import { getMode } from '../../types';
|
|
14
13
|
import { layoutAppliesTopbar } from '../../util';
|
|
15
14
|
|
|
16
|
-
const label = ['sidebar title', { ns:
|
|
15
|
+
const label = ['sidebar title', { ns: meta.id }] satisfies Label;
|
|
17
16
|
|
|
18
17
|
export const Sidebar = () => {
|
|
19
|
-
const {
|
|
18
|
+
const { state, deck } = useDeckState();
|
|
19
|
+
const { popoverAnchorId, activeDeck: current } = state;
|
|
20
20
|
const breakpoint = useBreakpoints();
|
|
21
21
|
const layoutMode = getMode(deck);
|
|
22
22
|
const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
|
|
@@ -4,45 +4,56 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Common } from '@dxos/app-framework';
|
|
8
|
+
import { useOperationInvoker } from '@dxos/app-framework/react';
|
|
8
9
|
import { IconButton, type IconButtonProps, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
9
10
|
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { DECK_PLUGIN } from '../../meta';
|
|
11
|
+
import { getCompanionId, useDeckCompanions, useDeckState } from '../../hooks';
|
|
12
|
+
import { meta } from '../../meta';
|
|
13
13
|
|
|
14
14
|
export const ToggleSidebarButton = ({
|
|
15
15
|
classNames,
|
|
16
16
|
variant = 'ghost',
|
|
17
17
|
}: ThemedClassName<Pick<IconButtonProps, 'variant'>>) => {
|
|
18
|
-
const
|
|
19
|
-
const { t } = useTranslation(
|
|
18
|
+
const { state, updateState } = useDeckState();
|
|
19
|
+
const { t } = useTranslation(meta.id);
|
|
20
|
+
|
|
21
|
+
const handleClick = useCallback(() => {
|
|
22
|
+
updateState((s) => ({
|
|
23
|
+
...s,
|
|
24
|
+
sidebarState: s.sidebarState === 'expanded' ? 'collapsed' : 'expanded',
|
|
25
|
+
}));
|
|
26
|
+
}, [updateState]);
|
|
27
|
+
|
|
20
28
|
return (
|
|
21
29
|
<IconButton
|
|
22
30
|
variant={variant}
|
|
23
|
-
iconOnly
|
|
24
31
|
icon='ph--sidebar--regular'
|
|
32
|
+
iconOnly
|
|
25
33
|
size={4}
|
|
26
34
|
label={t('open navigation sidebar label')}
|
|
27
|
-
onClick={
|
|
28
|
-
(layoutContext.sidebarState = layoutContext.sidebarState === 'expanded' ? 'collapsed' : 'expanded')
|
|
29
|
-
}
|
|
35
|
+
onClick={handleClick}
|
|
30
36
|
classNames={classNames}
|
|
31
37
|
/>
|
|
32
38
|
);
|
|
33
39
|
};
|
|
34
40
|
|
|
35
41
|
export const CloseSidebarButton = () => {
|
|
36
|
-
const
|
|
37
|
-
const { t } = useTranslation(
|
|
42
|
+
const { updateState } = useDeckState();
|
|
43
|
+
const { t } = useTranslation(meta.id);
|
|
44
|
+
|
|
45
|
+
const handleClick = useCallback(() => {
|
|
46
|
+
updateState((s) => ({ ...s, sidebarState: 'collapsed' }));
|
|
47
|
+
}, [updateState]);
|
|
48
|
+
|
|
38
49
|
return (
|
|
39
50
|
<IconButton
|
|
40
51
|
variant='ghost'
|
|
41
|
-
iconOnly
|
|
42
52
|
icon='ph--caret-line-left--regular'
|
|
53
|
+
iconOnly
|
|
43
54
|
size={4}
|
|
44
55
|
label={t('close navigation sidebar label')}
|
|
45
|
-
onClick={
|
|
56
|
+
onClick={handleClick}
|
|
46
57
|
classNames='rounded-none pli-1 dx-focus-ring-inset pie-[max(.5rem,env(safe-area-inset-left))]'
|
|
47
58
|
/>
|
|
48
59
|
);
|
|
@@ -53,35 +64,31 @@ export const ToggleComplementarySidebarButton = ({
|
|
|
53
64
|
classNames,
|
|
54
65
|
current,
|
|
55
66
|
}: ThemedClassName<{ inR0?: boolean; current?: string }>) => {
|
|
56
|
-
const {
|
|
57
|
-
const
|
|
58
|
-
const { t } = useTranslation(
|
|
67
|
+
const { invokeSync } = useOperationInvoker();
|
|
68
|
+
const { state, updateState } = useDeckState();
|
|
69
|
+
const { t } = useTranslation(meta.id);
|
|
59
70
|
|
|
60
71
|
const companions = useDeckCompanions();
|
|
61
|
-
const handleClick = useCallback(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
part: 'complementary',
|
|
69
|
-
subject: getCompanionId(firstCompanion.id),
|
|
70
|
-
}),
|
|
71
|
-
);
|
|
72
|
+
const handleClick = useCallback(() => {
|
|
73
|
+
const nextState = state.complementarySidebarState === 'expanded' ? 'collapsed' : 'expanded';
|
|
74
|
+
updateState((s) => ({ ...s, complementarySidebarState: nextState }));
|
|
75
|
+
|
|
76
|
+
const subject = state.complementarySidebarPanel ?? (companions[0] && getCompanionId(companions[0].id));
|
|
77
|
+
if (nextState === 'expanded' && !current && subject) {
|
|
78
|
+
invokeSync(Common.LayoutOperation.UpdateComplementary, { subject });
|
|
72
79
|
}
|
|
73
|
-
}, [
|
|
80
|
+
}, [state, updateState, current, companions, invokeSync]);
|
|
74
81
|
|
|
75
82
|
return (
|
|
76
83
|
<IconButton
|
|
77
|
-
iconOnly
|
|
78
|
-
onClick={handleClick}
|
|
79
84
|
variant='ghost'
|
|
80
|
-
label={t('open complementary sidebar label')}
|
|
81
85
|
classNames={['[&>svg]:-scale-x-100', classNames]}
|
|
82
86
|
icon='ph--sidebar-simple--regular'
|
|
87
|
+
iconOnly
|
|
88
|
+
label={t('open complementary sidebar label')}
|
|
83
89
|
size={inR0 ? 5 : 4}
|
|
84
90
|
tooltipSide={inR0 ? 'left' : undefined}
|
|
91
|
+
onClick={handleClick}
|
|
85
92
|
/>
|
|
86
93
|
);
|
|
87
94
|
};
|
package/src/hooks/index.ts
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { type Node
|
|
5
|
+
import { useAppGraph } from '@dxos/app-framework/react';
|
|
6
|
+
import { Node, type Node as NodeType } from '@dxos/plugin-graph';
|
|
7
|
+
import { useConnections } from '@dxos/plugin-graph';
|
|
8
|
+
import { type Label } from '@dxos/ui-types';
|
|
7
9
|
import { type Position, byPosition } from '@dxos/util';
|
|
8
10
|
|
|
9
11
|
import { ATTENDABLE_PATH_SEPARATOR, DECK_COMPANION_TYPE } from '../types';
|
|
@@ -13,7 +15,7 @@ export const getCompanionId = (id: string) => {
|
|
|
13
15
|
return companionId ?? 'never';
|
|
14
16
|
};
|
|
15
17
|
|
|
16
|
-
export type DeckCompanion = Node<
|
|
18
|
+
export type DeckCompanion = NodeType.Node<
|
|
17
19
|
any,
|
|
18
20
|
{
|
|
19
21
|
label: Label;
|
|
@@ -27,7 +29,7 @@ export type DeckCompanion = Node<
|
|
|
27
29
|
|
|
28
30
|
export const useDeckCompanions = (): DeckCompanion[] => {
|
|
29
31
|
const { graph } = useAppGraph();
|
|
30
|
-
const connections = useConnections(graph,
|
|
32
|
+
const connections = useConnections(graph, Node.RootId);
|
|
31
33
|
const companions = connections.filter((node) => node.type === DECK_COMPANION_TYPE) as DeckCompanion[];
|
|
32
34
|
return companions.toSorted((a, b) => byPosition(a.properties, b.properties));
|
|
33
35
|
};
|