@dxos/plugin-deck 0.8.4-main.3f58842 → 0.8.4-main.52d7546f51
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-X7LCO5KE.mjs +121 -0
- package/dist/lib/browser/app-graph-builder-X7LCO5KE.mjs.map +7 -0
- package/dist/lib/browser/check-app-scheme-PGISDJX7.mjs +32 -0
- package/dist/lib/browser/check-app-scheme-PGISDJX7.mjs.map +7 -0
- package/dist/lib/browser/chunk-DONG2FYU.mjs +295 -0
- package/dist/lib/browser/chunk-DONG2FYU.mjs.map +7 -0
- package/dist/lib/browser/chunk-JGC4ZLG3.mjs +1469 -0
- package/dist/lib/browser/chunk-JGC4ZLG3.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-YT3AJVUU.mjs +161 -0
- package/dist/lib/browser/chunk-YT3AJVUU.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +89 -75
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-XJFR3PNQ.mjs +597 -0
- package/dist/lib/browser/operation-resolver-XJFR3PNQ.mjs.map +7 -0
- package/dist/lib/browser/react-root-AJFHKHRL.mjs +47 -0
- package/dist/lib/browser/react-root-AJFHKHRL.mjs.map +7 -0
- package/dist/lib/browser/react-surface-KBRBGEXY.mjs +43 -0
- package/dist/lib/browser/react-surface-KBRBGEXY.mjs.map +7 -0
- package/dist/lib/browser/settings-ES42FGLG.mjs +38 -0
- package/dist/lib/browser/settings-ES42FGLG.mjs.map +7 -0
- package/dist/lib/browser/state-YMI6IDEL.mjs +104 -0
- package/dist/lib/browser/state-YMI6IDEL.mjs.map +7 -0
- package/dist/lib/browser/toolkit-VRD54KY3.mjs +54 -0
- package/dist/lib/browser/toolkit-VRD54KY3.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +11 -4
- package/dist/lib/browser/url-handler-37UPOB3U.mjs +94 -0
- package/dist/lib/browser/url-handler-37UPOB3U.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-US54I64T.mjs +122 -0
- package/dist/lib/node-esm/app-graph-builder-US54I64T.mjs.map +7 -0
- package/dist/lib/node-esm/check-app-scheme-CK6EVG5D.mjs +33 -0
- package/dist/lib/node-esm/check-app-scheme-CK6EVG5D.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7NPS347C.mjs +1470 -0
- package/dist/lib/node-esm/chunk-7NPS347C.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-CVYHPJIN.mjs +297 -0
- package/dist/lib/node-esm/chunk-CVYHPJIN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZMJPCZ3V.mjs +162 -0
- package/dist/lib/node-esm/chunk-ZMJPCZ3V.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +183 -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-ZQGNATPX.mjs +598 -0
- package/dist/lib/node-esm/operation-resolver-ZQGNATPX.mjs.map +7 -0
- package/dist/lib/node-esm/react-root-2S77ABBS.mjs +48 -0
- package/dist/lib/node-esm/react-root-2S77ABBS.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-FIHMAFXH.mjs +44 -0
- package/dist/lib/node-esm/react-surface-FIHMAFXH.mjs.map +7 -0
- package/dist/lib/node-esm/settings-E3TH3FAW.mjs +39 -0
- package/dist/lib/node-esm/settings-E3TH3FAW.mjs.map +7 -0
- package/dist/lib/node-esm/state-WQEFBQMD.mjs +105 -0
- package/dist/lib/node-esm/state-WQEFBQMD.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-ME546G5T.mjs +55 -0
- package/dist/lib/node-esm/toolkit-ME546G5T.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +40 -0
- package/dist/lib/node-esm/url-handler-2KYHXINK.mjs +95 -0
- package/dist/lib/node-esm/url-handler-2KYHXINK.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 +22 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +174 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +177 -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 +27 -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/ActiveNode.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Banner.d.ts.map +1 -1
- 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 +75 -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 +4 -4
- package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.stories.d.ts +105 -5
- 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 +3 -3
- 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 +4 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/{capabilities → types}/capabilities.d.ts +98 -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 +92 -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 +57 -46
- package/src/DeckPlugin.ts +46 -61
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +119 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/check-app-scheme/check-app-scheme.ts +45 -0
- package/src/capabilities/check-app-scheme/index.ts +7 -0
- package/src/capabilities/index.ts +9 -13
- package/src/capabilities/operation-resolver/index.ts +10 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +570 -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 +38 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +39 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +105 -0
- package/src/capabilities/toolkit/index.ts +7 -0
- package/src/capabilities/toolkit/toolkit.ts +64 -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 +96 -0
- package/src/components/DeckLayout/ActiveNode.tsx +3 -2
- package/src/components/DeckLayout/Banner.tsx +9 -9
- package/src/components/DeckLayout/ContentEmpty.tsx +5 -6
- package/src/components/DeckLayout/DeckLayout.stories.tsx +52 -0
- package/src/components/DeckLayout/DeckLayout.tsx +18 -285
- package/src/components/DeckLayout/DeckMain.tsx +286 -0
- package/src/components/DeckLayout/Dialog.tsx +21 -12
- package/src/components/DeckLayout/Fallback.tsx +4 -4
- package/src/components/DeckLayout/Popover.tsx +60 -32
- package/src/components/DeckLayout/StatusBar.tsx +3 -3
- package/src/components/DeckLayout/Toast.tsx +30 -5
- package/src/components/DeckSettings/DeckSettings.tsx +91 -66
- package/src/components/Plank/Plank.stories.tsx +24 -16
- package/src/components/Plank/Plank.tsx +91 -57
- package/src/components/Plank/PlankControls.tsx +9 -9
- package/src/components/Plank/PlankError.tsx +5 -4
- package/src/components/Plank/PlankHeading.tsx +41 -44
- package/src/components/Sidebar/ComplementarySidebar.tsx +69 -37
- package/src/components/Sidebar/Sidebar.tsx +7 -7
- 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 +7 -5
- 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 +4 -1
- package/src/types/capabilities.ts +33 -0
- package/src/types/events.ts +21 -0
- package/src/types/index.ts +2 -0
- package/src/types/schema.ts +90 -14
- package/src/util/layoutAppliesTopbar.ts +1 -1
- package/src/util/set-active.ts +49 -29
- package/dist/lib/browser/app-graph-builder-JTFSDT2I.mjs +0 -152
- package/dist/lib/browser/app-graph-builder-JTFSDT2I.mjs.map +0 -7
- package/dist/lib/browser/check-app-scheme-57U62A3A.mjs +0 -32
- package/dist/lib/browser/check-app-scheme-57U62A3A.mjs.map +0 -7
- package/dist/lib/browser/chunk-CNTGBCMK.mjs.map +0 -7
- package/dist/lib/browser/chunk-D7KTFCUV.mjs +0 -1494
- package/dist/lib/browser/chunk-D7KTFCUV.mjs.map +0 -7
- package/dist/lib/browser/chunk-F5BQOOEG.mjs +0 -160
- package/dist/lib/browser/chunk-F5BQOOEG.mjs.map +0 -7
- package/dist/lib/browser/chunk-JFTXENFN.mjs +0 -129
- package/dist/lib/browser/chunk-JFTXENFN.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-QDZO4AJ4.mjs +0 -127
- package/dist/lib/browser/chunk-QDZO4AJ4.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-P2OBK5HK.mjs +0 -521
- package/dist/lib/browser/intent-resolver-P2OBK5HK.mjs.map +0 -7
- package/dist/lib/browser/react-root-PO64J7ML.mjs +0 -43
- package/dist/lib/browser/react-root-PO64J7ML.mjs.map +0 -7
- package/dist/lib/browser/react-surface-E45YOVF5.mjs +0 -40
- package/dist/lib/browser/react-surface-E45YOVF5.mjs.map +0 -7
- package/dist/lib/browser/settings-6AJZPZPM.mjs +0 -29
- package/dist/lib/browser/settings-6AJZPZPM.mjs.map +0 -7
- package/dist/lib/browser/state-MVDYX77Y.mjs +0 -12
- package/dist/lib/browser/tools-TKQDPCHJ.mjs +0 -88
- package/dist/lib/browser/tools-TKQDPCHJ.mjs.map +0 -7
- package/dist/lib/browser/url-handler-7L7M6IKH.mjs +0 -70
- package/dist/lib/browser/url-handler-7L7M6IKH.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/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 -141
- package/src/capabilities/capabilities.ts +0 -14
- package/src/capabilities/check-app-scheme.ts +0 -40
- package/src/capabilities/intent-resolver.ts +0 -468
- package/src/capabilities/react-root.tsx +0 -38
- package/src/capabilities/react-surface.tsx +0 -30
- package/src/capabilities/settings.ts +0 -26
- package/src/capabilities/state.ts +0 -104
- package/src/capabilities/tools.ts +0 -81
- package/src/capabilities/url-handler.ts +0 -59
- package/src/events.ts +0 -11
- /package/dist/lib/{browser/state-MVDYX77Y.mjs.map → node-esm/types/index.mjs.map} +0 -0
|
@@ -12,29 +12,38 @@ import React, {
|
|
|
12
12
|
useState,
|
|
13
13
|
} from 'react';
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
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';
|
|
17
18
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
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';
|
|
23
30
|
import { getMode } from '../../types';
|
|
24
31
|
import { layoutAppliesTopbar } from '../../util';
|
|
25
32
|
import { PlankContentError, PlankLoading } from '../Plank';
|
|
26
33
|
|
|
27
|
-
|
|
34
|
+
import { ToggleComplementarySidebarButton } from './SidebarButton';
|
|
35
|
+
|
|
36
|
+
const label = ['complementary sidebar title', { ns: meta.id }] satisfies Label;
|
|
28
37
|
|
|
29
38
|
export type ComplementarySidebarProps = {
|
|
30
39
|
current?: string;
|
|
31
40
|
};
|
|
32
41
|
|
|
33
42
|
export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) => {
|
|
34
|
-
const { t } = useTranslation(
|
|
35
|
-
const {
|
|
36
|
-
const
|
|
37
|
-
const layoutMode = getMode(
|
|
43
|
+
const { t } = useTranslation(meta.id);
|
|
44
|
+
const { invokeSync } = useOperationInvoker();
|
|
45
|
+
const { state, deck, updateState } = useDeckState();
|
|
46
|
+
const layoutMode = getMode(deck);
|
|
38
47
|
const breakpoint = useBreakpoints();
|
|
39
48
|
const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
|
|
40
49
|
const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
|
|
@@ -52,14 +61,17 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
52
61
|
(event: MouseEvent) => {
|
|
53
62
|
const nextValue = event.currentTarget.getAttribute('data-value') as string;
|
|
54
63
|
if (nextValue === activeId) {
|
|
55
|
-
|
|
64
|
+
updateState((state) => ({
|
|
65
|
+
...state,
|
|
66
|
+
complementarySidebarState: state.complementarySidebarState === 'expanded' ? 'collapsed' : 'expanded',
|
|
67
|
+
}));
|
|
56
68
|
} else {
|
|
57
69
|
setInternalValue(nextValue);
|
|
58
|
-
|
|
59
|
-
|
|
70
|
+
updateState((state) => ({ ...state, complementarySidebarState: 'expanded' }));
|
|
71
|
+
invokeSync(LayoutOperation.UpdateComplementary, { subject: nextValue });
|
|
60
72
|
}
|
|
61
73
|
},
|
|
62
|
-
[
|
|
74
|
+
[state.complementarySidebarState, activeId, invokeSync, updateState],
|
|
63
75
|
);
|
|
64
76
|
|
|
65
77
|
const data = useMemo(
|
|
@@ -73,11 +85,9 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
73
85
|
|
|
74
86
|
useEffect(() => {
|
|
75
87
|
if (!activeId) {
|
|
76
|
-
|
|
77
|
-
createIntent(LayoutAction.UpdateComplementary, { part: 'complementary', options: { state: 'collapsed' } }),
|
|
78
|
-
);
|
|
88
|
+
invokeSync(LayoutOperation.UpdateComplementary, { state: 'collapsed' });
|
|
79
89
|
}
|
|
80
|
-
}, [activeId,
|
|
90
|
+
}, [activeId, invokeSync]);
|
|
81
91
|
|
|
82
92
|
return (
|
|
83
93
|
<Main.ComplementarySidebar
|
|
@@ -90,7 +100,11 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
90
100
|
<Tabs.Root orientation='vertical' verticalVariant='stateless' value={internalValue} classNames='contents'>
|
|
91
101
|
<div
|
|
92
102
|
role='none'
|
|
93
|
-
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
|
+
)}
|
|
94
108
|
>
|
|
95
109
|
<Tabs.Tablist classNames='grid grid-cols-1 auto-rows-[--rail-action] p-1 gap-1 !overflow-y-auto'>
|
|
96
110
|
{companions.map((companion) => (
|
|
@@ -98,13 +112,12 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
98
112
|
<IconButton
|
|
99
113
|
label={toLocalizedString(companion.properties.label, t)}
|
|
100
114
|
icon={companion.properties.icon}
|
|
101
|
-
size={5}
|
|
102
115
|
iconOnly
|
|
103
116
|
tooltipSide='left'
|
|
104
117
|
data-value={getCompanionId(companion.id)}
|
|
105
118
|
variant={
|
|
106
119
|
activeId === getCompanionId(companion.id)
|
|
107
|
-
?
|
|
120
|
+
? state.complementarySidebarState === 'expanded'
|
|
108
121
|
? 'primary'
|
|
109
122
|
: 'default'
|
|
110
123
|
: 'ghost'
|
|
@@ -116,7 +129,7 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
116
129
|
</Tabs.Tablist>
|
|
117
130
|
{!hoistStatusbar && (
|
|
118
131
|
<div role='none' className='grid grid-cols-1 auto-rows-[--rail-item] p-1 overflow-y-auto'>
|
|
119
|
-
<Surface role='status-bar--r0-footer' limit={1} />
|
|
132
|
+
<Surface.Surface role='status-bar--r0-footer' limit={1} />
|
|
120
133
|
</div>
|
|
121
134
|
)}
|
|
122
135
|
<div role='none' className='hidden lg:grid grid-cols-1 auto-rows-[--rail-action] p-1'>
|
|
@@ -128,8 +141,12 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
128
141
|
<Tabs.Tabpanel
|
|
129
142
|
key={getCompanionId(companion.id)}
|
|
130
143
|
value={getCompanionId(companion.id)}
|
|
131
|
-
classNames=
|
|
132
|
-
|
|
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 })}
|
|
133
150
|
>
|
|
134
151
|
<ComplementarySidebarPanel
|
|
135
152
|
companion={companion}
|
|
@@ -154,26 +171,33 @@ type ComplementarySidebarPanelProps = {
|
|
|
154
171
|
hoistStatusbar: boolean;
|
|
155
172
|
};
|
|
156
173
|
|
|
157
|
-
const ScrollArea = ({ children }: PropsWithChildren) => {
|
|
158
|
-
return <div className='flex flex-col grow overflow-x-hidden overflow-y-auto scrollbar-thin'>{children}</div>;
|
|
159
|
-
};
|
|
160
|
-
|
|
161
174
|
const ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }: ComplementarySidebarPanelProps) => {
|
|
162
|
-
const { t } = useTranslation(
|
|
175
|
+
const { t } = useTranslation(meta.id);
|
|
163
176
|
|
|
164
177
|
if (getCompanionId(companion.id) !== activeId && !data) {
|
|
165
178
|
return null;
|
|
166
179
|
}
|
|
167
180
|
|
|
168
|
-
const Wrapper = companion.properties.fixed ? Fragment :
|
|
181
|
+
const Wrapper = companion.properties.fixed ? Fragment : ScrollAreaWrapper;
|
|
169
182
|
|
|
170
183
|
return (
|
|
171
184
|
<>
|
|
172
|
-
<
|
|
173
|
-
|
|
174
|
-
|
|
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>
|
|
175
199
|
<Wrapper>
|
|
176
|
-
<Surface
|
|
200
|
+
<Surface.Surface
|
|
177
201
|
role={`deck-companion--${getCompanionId(companion.id)}`}
|
|
178
202
|
data={data}
|
|
179
203
|
fallback={PlankContentError}
|
|
@@ -185,9 +209,17 @@ const ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }
|
|
|
185
209
|
role='contentinfo'
|
|
186
210
|
className='flex flex-wrap justify-center items-center border-bs border-subduedSeparator pbs-1 pbe-[max(env(safe-area-inset-bottom),0.25rem)]'
|
|
187
211
|
>
|
|
188
|
-
<Surface role='status-bar--r1-footer' limit={1} />
|
|
212
|
+
<Surface.Surface role='status-bar--r1-footer' limit={1} />
|
|
189
213
|
</div>
|
|
190
214
|
)}
|
|
191
215
|
</>
|
|
192
216
|
);
|
|
193
217
|
};
|
|
218
|
+
|
|
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
|
+
);
|
|
225
|
+
};
|
|
@@ -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/ui';
|
|
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);
|
|
@@ -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,45 +4,56 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
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 { updateState } = useDeckState();
|
|
19
|
+
const { t } = useTranslation(meta.id);
|
|
20
|
+
|
|
21
|
+
const handleClick = useCallback(() => {
|
|
22
|
+
updateState((state) => ({
|
|
23
|
+
...state,
|
|
24
|
+
sidebarState: state.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((state) => ({ ...state, 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((state) => ({ ...state, complementarySidebarState: nextState }));
|
|
75
|
+
|
|
76
|
+
const subject = state.complementarySidebarPanel ?? (companions[0] && getCompanionId(companions[0].id));
|
|
77
|
+
if (nextState === 'expanded' && !current && subject) {
|
|
78
|
+
invokeSync(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,9 +2,11 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
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';
|
|
9
|
+
import { type Position, byPosition } from '@dxos/util';
|
|
8
10
|
|
|
9
11
|
import { ATTENDABLE_PATH_SEPARATOR, DECK_COMPANION_TYPE } from '../types';
|
|
10
12
|
|
|
@@ -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
|
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import { useCallback, useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capabilities } from '@dxos/app-framework';
|
|
9
|
+
import { useCapability } from '@dxos/app-framework/ui';
|
|
10
|
+
import { invariant } from '@dxos/invariant';
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
DeckCapabilities,
|
|
14
|
+
type DeckEphemeralStateProps,
|
|
15
|
+
type DeckPluginState,
|
|
16
|
+
type DeckState,
|
|
17
|
+
type DeckStateProps,
|
|
18
|
+
} from '../types';
|
|
19
|
+
|
|
20
|
+
export type DeckStateHook = {
|
|
21
|
+
/** Combined state value (reactive). Includes both persisted and ephemeral state. */
|
|
22
|
+
state: DeckPluginState;
|
|
23
|
+
/** The active deck, computed from decks[activeDeck]. */
|
|
24
|
+
deck: DeckState;
|
|
25
|
+
/** Update persisted state. */
|
|
26
|
+
updateState: (fn: (current: DeckStateProps) => DeckStateProps) => void;
|
|
27
|
+
/** Update ephemeral state. */
|
|
28
|
+
updateEphemeral: (fn: (current: DeckEphemeralStateProps) => DeckEphemeralStateProps) => void;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Hook to access the deck plugin state reactively.
|
|
33
|
+
* Returns the combined state, the active deck, and update functions for each atom.
|
|
34
|
+
*/
|
|
35
|
+
export const useDeckState = (): DeckStateHook => {
|
|
36
|
+
const registry = useCapability(Capabilities.AtomRegistry);
|
|
37
|
+
const stateAtom = useCapability(DeckCapabilities.State);
|
|
38
|
+
const ephemeralAtom = useCapability(DeckCapabilities.EphemeralState);
|
|
39
|
+
|
|
40
|
+
const persistedState = useAtomValue(stateAtom);
|
|
41
|
+
const ephemeralState = useAtomValue(ephemeralAtom);
|
|
42
|
+
|
|
43
|
+
// Compute deck from decks[activeDeck] to ensure it's always current.
|
|
44
|
+
const deck = useMemo(() => {
|
|
45
|
+
const d = persistedState.decks[persistedState.activeDeck];
|
|
46
|
+
invariant(d, `Deck not found: ${persistedState.activeDeck}`);
|
|
47
|
+
return d;
|
|
48
|
+
}, [persistedState.decks, persistedState.activeDeck]);
|
|
49
|
+
|
|
50
|
+
// Combine persisted and ephemeral state into a unified view.
|
|
51
|
+
const state = useMemo(
|
|
52
|
+
(): DeckPluginState => ({
|
|
53
|
+
...persistedState,
|
|
54
|
+
...ephemeralState,
|
|
55
|
+
}),
|
|
56
|
+
[persistedState, ephemeralState],
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const updateState = useCallback(
|
|
60
|
+
(fn: (current: DeckStateProps) => DeckStateProps) => {
|
|
61
|
+
registry.set(stateAtom, fn(registry.get(stateAtom)));
|
|
62
|
+
},
|
|
63
|
+
[registry, stateAtom],
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const updateEphemeral = useCallback(
|
|
67
|
+
(fn: (current: DeckEphemeralStateProps) => DeckEphemeralStateProps) => {
|
|
68
|
+
registry.set(ephemeralAtom, fn(registry.get(ephemeralAtom)));
|
|
69
|
+
},
|
|
70
|
+
[registry, ephemeralAtom],
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
return useMemo(
|
|
74
|
+
() => ({
|
|
75
|
+
state,
|
|
76
|
+
deck,
|
|
77
|
+
updateState,
|
|
78
|
+
updateEphemeral,
|
|
79
|
+
}),
|
|
80
|
+
[state, deck, updateState, updateEphemeral],
|
|
81
|
+
);
|
|
82
|
+
};
|
|
@@ -4,16 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { useAtomCapability } from '@dxos/app-framework/ui';
|
|
8
8
|
import { useThemeContext } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import type { DeckSettingsProps, LayoutMode } from '../types';
|
|
10
|
+
import { DeckCapabilities, type LayoutMode } from '../types';
|
|
12
11
|
|
|
13
12
|
export const useHoistStatusbar = (breakpoint: string, layoutMode?: LayoutMode): boolean => {
|
|
14
|
-
const enableStatusbar = useCapability(Capabilities.SettingsStore).getStore<DeckSettingsProps>(DECK_PLUGIN)!.value
|
|
15
|
-
.enableStatusbar;
|
|
16
13
|
const { safeAreaPadding } = useThemeContext();
|
|
14
|
+
const enableStatusbar = useAtomCapability(DeckCapabilities.Settings).enableStatusbar;
|
|
15
|
+
|
|
17
16
|
return useMemo(() => {
|
|
18
17
|
return (
|
|
19
18
|
breakpoint === 'desktop' &&
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Graph, type Node } from '@dxos/plugin-graph';
|
|
8
8
|
|
|
9
|
-
export const useNodeActionExpander = (node?: Node) => {
|
|
9
|
+
export const useNodeActionExpander = (node?: Node.Node) => {
|
|
10
10
|
useEffect(() => {
|
|
11
11
|
if (node) {
|
|
12
12
|
const frame = requestAnimationFrame(() => {
|
|
13
|
-
const graph = getGraph(node);
|
|
14
|
-
void
|
|
13
|
+
const graph = Graph.getGraph(node);
|
|
14
|
+
void Graph.expand(graph, node.id);
|
|
15
15
|
});
|
|
16
16
|
return () => cancelAnimationFrame(frame);
|
|
17
17
|
}
|
package/src/index.ts
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export { DeckCapabilities } from './
|
|
6
|
-
export { DeckEvents } from './events';
|
|
5
|
+
export { DeckCapabilities, DeckEvents } from './types';
|
|
7
6
|
export * from './DeckPlugin';
|
|
8
7
|
export * from './meta';
|
|
9
8
|
export { useCompanions } from './hooks';
|
package/src/meta.ts
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
export const meta: PluginMeta = {
|
|
10
|
-
id: DECK_PLUGIN,
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'dxos.org/plugin/deck',
|
|
11
10
|
name: 'Layout',
|
|
11
|
+
description: trim`
|
|
12
|
+
Flexible layout system for arranging workspace views in tabs, splits, and panels.
|
|
13
|
+
Customize your workspace organization with drag-and-drop layout management.
|
|
14
|
+
`,
|
|
12
15
|
icon: 'ph--layout--regular',
|
|
13
16
|
};
|
package/src/translations.ts
CHANGED
|
@@ -11,6 +11,7 @@ export const translations = [
|
|
|
11
11
|
'en-US': {
|
|
12
12
|
[meta.id]: {
|
|
13
13
|
'plugin name': 'Deck',
|
|
14
|
+
'settings title': 'Deck settings',
|
|
14
15
|
'main header label': 'Main header',
|
|
15
16
|
'open navigation sidebar label': 'Open sidebar',
|
|
16
17
|
'collapse navigation sidebar label': 'Minimize sidebar',
|
|
@@ -33,7 +34,7 @@ export const translations = [
|
|
|
33
34
|
'undo action label': 'Undo',
|
|
34
35
|
'undo action alt': 'Undo previous action',
|
|
35
36
|
'undo close label': 'Dismiss',
|
|
36
|
-
'error fallback message': 'Unable to open this
|
|
37
|
+
'error fallback message': 'Unable to open this object',
|
|
37
38
|
'plank heading fallback label': 'Untitled',
|
|
38
39
|
'actions menu label': 'Options',
|
|
39
40
|
'settings deck label': 'Disable deck',
|
|
@@ -58,10 +59,12 @@ export const translations = [
|
|
|
58
59
|
'settings overscroll none label': 'None',
|
|
59
60
|
'settings enable statusbar label': 'Show status bar',
|
|
60
61
|
'settings enable deck label': 'Enable Deck',
|
|
62
|
+
'settings encapsulated planks label': 'Encapsulated planks',
|
|
61
63
|
'close current label': 'Close current plank',
|
|
62
64
|
'close others label': 'Close other planks',
|
|
63
65
|
'close all label': 'Close all planks',
|
|
64
66
|
'companion plank heading fallback label': 'Related',
|
|
67
|
+
'open item label': 'Open',
|
|
65
68
|
},
|
|
66
69
|
},
|
|
67
70
|
},
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { invariant } from '@dxos/invariant';
|
|
10
|
+
|
|
11
|
+
import { meta } from '../meta';
|
|
12
|
+
import { type DeckEphemeralStateProps, type DeckSettingsProps, type DeckState, type DeckStateProps } from '../types';
|
|
13
|
+
|
|
14
|
+
export namespace DeckCapabilities {
|
|
15
|
+
export const Settings = Capability.make<Atom.Writable<DeckSettingsProps>>(`${meta.id}/capability/settings`);
|
|
16
|
+
|
|
17
|
+
/** Persisted state (stored in KVS/localStorage). */
|
|
18
|
+
export const State = Capability.make<Atom.Writable<DeckStateProps>>(`${meta.id}/capability/state`);
|
|
19
|
+
|
|
20
|
+
/** Transient/ephemeral state (not persisted). */
|
|
21
|
+
export const EphemeralState = Capability.make<Atom.Writable<DeckEphemeralStateProps>>(
|
|
22
|
+
`${meta.id}/capability/ephemeral-state`,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
/** Get the current active deck from state. */
|
|
26
|
+
export const getDeck = (): Effect.Effect<DeckState, Error, Capability.Service> =>
|
|
27
|
+
Effect.gen(function* () {
|
|
28
|
+
const state = yield* Capabilities.getAtomValue(State);
|
|
29
|
+
const deck = state.decks[state.activeDeck];
|
|
30
|
+
invariant(deck, `Deck not found: ${state.activeDeck}`);
|
|
31
|
+
return deck;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ActivationEvent } from '@dxos/app-framework';
|
|
6
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
7
|
+
|
|
8
|
+
import { meta } from '../meta';
|
|
9
|
+
|
|
10
|
+
import { DeckCapabilities } from './capabilities';
|
|
11
|
+
|
|
12
|
+
export namespace DeckEvents {
|
|
13
|
+
export const StateReady: ActivationEvent.ActivationEvent = AppActivationEvents.createStateEvent(
|
|
14
|
+
`${meta.id}/state-ready`,
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
/** Fired when DeckSettings capability is ready. */
|
|
18
|
+
export const SettingsReady: ActivationEvent.ActivationEvent = AppActivationEvents.createSettingsEvent(
|
|
19
|
+
DeckCapabilities.Settings.identifier,
|
|
20
|
+
);
|
|
21
|
+
}
|