@dxos/plugin-deck 0.8.4-main.406dc2a → 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-7I6H3N4Q.mjs → chunk-DONG2FYU.mjs} +152 -19
- 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 +82 -74
- 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/ContentEmpty.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts +2 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckMain.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/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 +24 -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 +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 -2
- 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 +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 +88 -27
- 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 -47
- package/src/DeckPlugin.ts +28 -48
- 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 -14
- 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 +6 -6
- package/src/components/DeckLayout/ContentEmpty.tsx +4 -5
- package/src/components/DeckLayout/DeckLayout.stories.tsx +20 -32
- package/src/components/DeckLayout/DeckLayout.tsx +13 -11
- package/src/components/DeckLayout/DeckMain.tsx +46 -45
- package/src/components/DeckLayout/Dialog.tsx +21 -12
- package/src/components/DeckLayout/Fallback.tsx +2 -2
- package/src/components/DeckLayout/Popover.tsx +60 -32
- package/src/components/DeckLayout/StatusBar.tsx +3 -3
- package/src/components/DeckLayout/Toast.tsx +5 -5
- package/src/components/DeckSettings/DeckSettings.tsx +39 -29
- package/src/components/Plank/Plank.stories.tsx +16 -7
- package/src/components/Plank/Plank.tsx +70 -53
- package/src/components/Plank/PlankControls.tsx +6 -6
- package/src/components/Plank/PlankError.tsx +2 -2
- package/src/components/Plank/PlankHeading.tsx +34 -38
- package/src/components/Sidebar/ComplementarySidebar.tsx +63 -32
- package/src/components/Sidebar/Sidebar.tsx +5 -5
- package/src/components/Sidebar/SidebarButton.tsx +35 -28
- 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 +3 -5
- package/src/hooks/useNodeActionExpander.ts +4 -4
- package/src/index.ts +1 -2
- package/src/meta.ts +7 -2
- package/src/translations.ts +2 -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 +85 -11
- package/src/util/layoutAppliesTopbar.ts +1 -1
- package/src/util/set-active.ts +49 -29
- package/dist/lib/browser/app-graph-builder-YYP67JHW.mjs +0 -153
- package/dist/lib/browser/app-graph-builder-YYP67JHW.mjs.map +0 -7
- package/dist/lib/browser/check-app-scheme-GCOL6YDT.mjs +0 -32
- package/dist/lib/browser/check-app-scheme-GCOL6YDT.mjs.map +0 -7
- package/dist/lib/browser/chunk-7I6H3N4Q.mjs.map +0 -7
- package/dist/lib/browser/chunk-CNTGBCMK.mjs.map +0 -7
- package/dist/lib/browser/chunk-HUWUYTOI.mjs +0 -16
- package/dist/lib/browser/chunk-HUWUYTOI.mjs.map +0 -7
- package/dist/lib/browser/chunk-JQKOS2HB.mjs +0 -1531
- package/dist/lib/browser/chunk-JQKOS2HB.mjs.map +0 -7
- package/dist/lib/browser/chunk-MHP4GPX5.mjs +0 -11
- package/dist/lib/browser/chunk-MHP4GPX5.mjs.map +0 -7
- package/dist/lib/browser/chunk-RJP5R7PY.mjs +0 -127
- package/dist/lib/browser/chunk-RJP5R7PY.mjs.map +0 -7
- package/dist/lib/browser/chunk-VX7MMQOW.mjs +0 -129
- package/dist/lib/browser/chunk-VX7MMQOW.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-7XNOEPVN.mjs +0 -524
- package/dist/lib/browser/intent-resolver-7XNOEPVN.mjs.map +0 -7
- package/dist/lib/browser/react-root-OJEF7YCH.mjs +0 -43
- package/dist/lib/browser/react-root-OJEF7YCH.mjs.map +0 -7
- package/dist/lib/browser/react-surface-XN2NJYHO.mjs +0 -40
- package/dist/lib/browser/react-surface-XN2NJYHO.mjs.map +0 -7
- package/dist/lib/browser/settings-M3KSKRAP.mjs +0 -30
- package/dist/lib/browser/settings-M3KSKRAP.mjs.map +0 -7
- package/dist/lib/browser/state-6ZSDTF6Q.mjs +0 -12
- package/dist/lib/browser/toolkit-L7C3UAEU.mjs +0 -63
- package/dist/lib/browser/toolkit-L7C3UAEU.mjs.map +0 -7
- package/dist/lib/browser/url-handler-EHTLXZRR.mjs +0 -70
- package/dist/lib/browser/url-handler-EHTLXZRR.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 -104
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/toolkit.d.ts +0 -6
- 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 -143
- package/src/capabilities/capabilities.ts +0 -14
- package/src/capabilities/check-app-scheme.ts +0 -40
- package/src/capabilities/intent-resolver.ts +0 -472
- package/src/capabilities/react-root.tsx +0 -39
- package/src/capabilities/react-surface.tsx +0 -30
- package/src/capabilities/settings.ts +0 -27
- package/src/capabilities/state.ts +0 -108
- package/src/capabilities/toolkit.ts +0 -57
- 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-6ZSDTF6Q.mjs.map → node-esm/types/index.mjs.map} +0 -0
|
@@ -2,26 +2,17 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { untracked } from '@preact/signals-core';
|
|
6
5
|
import React, { Fragment, type UIEvent, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
7
6
|
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
LayoutAction,
|
|
11
|
-
createIntent,
|
|
12
|
-
useCapability,
|
|
13
|
-
useIntentDispatcher,
|
|
14
|
-
usePluginManager,
|
|
15
|
-
} from '@dxos/app-framework';
|
|
7
|
+
import { useAtomCapability, useOperationInvoker, usePluginManager } from '@dxos/app-framework/ui';
|
|
8
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
16
9
|
import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
17
|
-
import { Main, type
|
|
10
|
+
import { Main, type MainContentProps, useMediaQuery, useOnTransition } from '@dxos/react-ui';
|
|
18
11
|
import { DEFAULT_HORIZONTAL_SIZE, Stack, StackContext } from '@dxos/react-ui-stack';
|
|
19
|
-
import { mainPaddingTransitions, mx } from '@dxos/
|
|
12
|
+
import { mainPaddingTransitions, mx } from '@dxos/ui-theme';
|
|
20
13
|
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { meta } from '../../meta';
|
|
24
|
-
import { type DeckSettingsProps, getMode } from '../../types';
|
|
14
|
+
import { useBreakpoints, useDeckState, useHoistStatusbar } from '../../hooks';
|
|
15
|
+
import { DeckCapabilities, getMode } from '../../types';
|
|
25
16
|
import { calculateOverscroll, layoutAppliesTopbar } from '../../util';
|
|
26
17
|
import { fixedComplementarySidebarToggleStyles, fixedSidebarToggleStyles } from '../fragments';
|
|
27
18
|
import { Plank } from '../Plank';
|
|
@@ -32,10 +23,10 @@ import { StatusBar } from './StatusBar';
|
|
|
32
23
|
import { Topbar } from './Topbar';
|
|
33
24
|
|
|
34
25
|
export const DeckMain = () => {
|
|
35
|
-
const {
|
|
36
|
-
const settings =
|
|
37
|
-
const
|
|
38
|
-
const { sidebarState, complementarySidebarState, complementarySidebarPanel
|
|
26
|
+
const { invokeSync } = useOperationInvoker();
|
|
27
|
+
const settings = useAtomCapability(DeckCapabilities.Settings);
|
|
28
|
+
const { state, deck, updateState } = useDeckState();
|
|
29
|
+
const { sidebarState, complementarySidebarState, complementarySidebarPanel } = state;
|
|
39
30
|
const { active, activeCompanions, fullscreen, solo, plankSizing } = deck;
|
|
40
31
|
const layoutMode = getMode(deck);
|
|
41
32
|
const breakpoint = useBreakpoints();
|
|
@@ -49,10 +40,8 @@ export const DeckMain = () => {
|
|
|
49
40
|
// Ensure the first plank is attended when the deck is first rendered.
|
|
50
41
|
useEffect(() => {
|
|
51
42
|
// NOTE: Not `useAttended` so that the layout component is not re-rendered when the attended list changes.
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
return attention.current;
|
|
55
|
-
});
|
|
43
|
+
const attention = pluginManager.capabilities.get(AttentionCapabilities.Attention);
|
|
44
|
+
const attended = attention.getCurrent();
|
|
56
45
|
const firstId = solo ?? active[0];
|
|
57
46
|
if (attended.length === 0 && firstId) {
|
|
58
47
|
// TODO(wittjosiah): Focusing the type button is a workaround.
|
|
@@ -66,31 +55,26 @@ export const DeckMain = () => {
|
|
|
66
55
|
const [isNotMobile] = useMediaQuery('md');
|
|
67
56
|
const shouldRevert = useRef(false);
|
|
68
57
|
useEffect(() => {
|
|
69
|
-
if (!isNotMobile &&
|
|
58
|
+
if (!isNotMobile && layoutMode === 'deck') {
|
|
70
59
|
// NOTE: Not `useAttended` so that the layout component is not re-rendered when the attended list changes.
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
return attention.current;
|
|
74
|
-
});
|
|
60
|
+
const attention = pluginManager.capabilities.get(AttentionCapabilities.Attention);
|
|
61
|
+
const attended = attention.getCurrent();
|
|
75
62
|
|
|
76
63
|
shouldRevert.current = true;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
);
|
|
80
|
-
} else if (isNotMobile && getMode(deck) === 'solo' && shouldRevert.current) {
|
|
81
|
-
void dispatch(createIntent(LayoutAction.SetLayoutMode, { part: 'mode', options: { revert: true } }));
|
|
64
|
+
invokeSync(LayoutOperation.SetLayoutMode, { subject: attended[0], mode: 'solo' });
|
|
65
|
+
} else if (isNotMobile && layoutMode === 'solo' && shouldRevert.current) {
|
|
66
|
+
invokeSync(LayoutOperation.SetLayoutMode, { revert: true });
|
|
82
67
|
}
|
|
83
|
-
|
|
68
|
+
// NOTE: Using `layoutMode` instead of `deck` to avoid infinite loops caused by object reference changes.
|
|
69
|
+
}, [isNotMobile, layoutMode, invokeSync]);
|
|
84
70
|
|
|
85
71
|
// When deck is disabled in settings, set to solo mode if the current layout mode is deck.
|
|
86
|
-
// TODO(thure): Applying this as an effect should be avoided over emitting the
|
|
72
|
+
// TODO(thure): Applying this as an effect should be avoided over emitting the operation only when the setting changes.
|
|
87
73
|
useEffect(() => {
|
|
88
|
-
if (settings?.enableDeck && layoutMode === 'deck') {
|
|
89
|
-
|
|
90
|
-
createIntent(LayoutAction.SetLayoutMode, { part: 'mode', subject: active[0], options: { mode: 'solo' } }),
|
|
91
|
-
);
|
|
74
|
+
if (!settings?.enableDeck && layoutMode === 'deck') {
|
|
75
|
+
invokeSync(LayoutOperation.SetLayoutMode, { subject: active[0], mode: 'solo' });
|
|
92
76
|
}
|
|
93
|
-
}, [settings?.enableDeck,
|
|
77
|
+
}, [settings?.enableDeck, invokeSync, active, layoutMode]);
|
|
94
78
|
|
|
95
79
|
/**
|
|
96
80
|
* Clear scroll restoration state if the window is resized.
|
|
@@ -152,12 +136,26 @@ export const DeckMain = () => {
|
|
|
152
136
|
);
|
|
153
137
|
}, [active, activeCompanions]);
|
|
154
138
|
|
|
139
|
+
const handleNavigationSidebarStateChange = useCallback(
|
|
140
|
+
(next: typeof sidebarState) => {
|
|
141
|
+
updateState((s) => ({ ...s, sidebarState: next }));
|
|
142
|
+
},
|
|
143
|
+
[updateState],
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
const handleComplementarySidebarStateChange = useCallback(
|
|
147
|
+
(next: typeof complementarySidebarState) => {
|
|
148
|
+
updateState((s) => ({ ...s, complementarySidebarState: next }));
|
|
149
|
+
},
|
|
150
|
+
[updateState],
|
|
151
|
+
);
|
|
152
|
+
|
|
155
153
|
return (
|
|
156
154
|
<Main.Root
|
|
157
|
-
navigationSidebarState={fullscreen ? 'closed' :
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
onComplementarySidebarStateChange={
|
|
155
|
+
navigationSidebarState={fullscreen ? 'closed' : sidebarState}
|
|
156
|
+
complementarySidebarState={fullscreen ? 'closed' : complementarySidebarState}
|
|
157
|
+
onNavigationSidebarStateChange={handleNavigationSidebarStateChange}
|
|
158
|
+
onComplementarySidebarStateChange={handleComplementarySidebarStateChange}
|
|
161
159
|
>
|
|
162
160
|
{/* Left sidebar. */}
|
|
163
161
|
<Sidebar />
|
|
@@ -198,9 +196,10 @@ export const DeckMain = () => {
|
|
|
198
196
|
: '0',
|
|
199
197
|
'--dx-main-contentFirstWidth': `${plankSizing[active[0] ?? 'never'] ?? DEFAULT_HORIZONTAL_SIZE}rem`,
|
|
200
198
|
'--dx-main-contentLastWidth': `${plankSizing[active[(active.length ?? 1) - 1] ?? 'never'] ?? DEFAULT_HORIZONTAL_SIZE}rem`,
|
|
201
|
-
} as
|
|
199
|
+
} as MainContentProps['style']
|
|
202
200
|
}
|
|
203
201
|
>
|
|
202
|
+
{/* Deck mode. */}
|
|
204
203
|
<div
|
|
205
204
|
role='none'
|
|
206
205
|
className={!solo ? 'relative bg-deckSurface overflow-hidden' : 'sr-only'}
|
|
@@ -238,6 +237,8 @@ export const DeckMain = () => {
|
|
|
238
237
|
))}
|
|
239
238
|
</Stack>
|
|
240
239
|
</div>
|
|
240
|
+
|
|
241
|
+
{/* Solo mode. */}
|
|
241
242
|
<div
|
|
242
243
|
role='none'
|
|
243
244
|
className={solo ? 'relative overflow-hidden bg-deckSurface' : 'sr-only'}
|
|
@@ -2,33 +2,42 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Surface
|
|
7
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
8
8
|
import { AlertDialog, Dialog as NaturalDialog } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { useDeckState } from '../../hooks';
|
|
11
11
|
import { PlankContentError } from '../Plank';
|
|
12
12
|
|
|
13
13
|
export const Dialog = () => {
|
|
14
|
-
const
|
|
15
|
-
const { dialogOpen, dialogType, dialogBlockAlign, dialogOverlayClasses, dialogOverlayStyle, dialogContent } =
|
|
14
|
+
const { state, updateEphemeral } = useDeckState();
|
|
15
|
+
const { dialogOpen, dialogType, dialogBlockAlign, dialogOverlayClasses, dialogOverlayStyle, dialogContent } = state;
|
|
16
16
|
const Root = dialogType === 'alert' ? AlertDialog.Root : NaturalDialog.Root;
|
|
17
17
|
const Overlay = dialogType === 'alert' ? AlertDialog.Overlay : NaturalDialog.Overlay;
|
|
18
18
|
|
|
19
|
+
const handleOpenChange = useCallback(
|
|
20
|
+
(nextOpen: boolean) => {
|
|
21
|
+
updateEphemeral((s) => ({ ...s, dialogOpen: nextOpen }));
|
|
22
|
+
},
|
|
23
|
+
[updateEphemeral],
|
|
24
|
+
);
|
|
25
|
+
|
|
19
26
|
// TODO(thure): End block alignment affecting `modal` and whether the surface renders in an overlay is tailored to the needs of the ambient chat dialog. As the feature matures, consider separating concerns.
|
|
20
27
|
return (
|
|
21
|
-
<Root
|
|
22
|
-
modal={dialogBlockAlign !== 'end'}
|
|
23
|
-
open={dialogOpen}
|
|
24
|
-
onOpenChange={(nextOpen) => (context.dialogOpen = nextOpen)}
|
|
25
|
-
>
|
|
28
|
+
<Root modal={dialogBlockAlign !== 'end'} open={dialogOpen} onOpenChange={handleOpenChange}>
|
|
26
29
|
{dialogBlockAlign === 'end' ? (
|
|
27
30
|
// TODO(burdon): Placeholder creates a suspense boundary; replace with defaults.
|
|
28
|
-
<Surface
|
|
31
|
+
<Surface.Surface
|
|
32
|
+
role='dialog'
|
|
33
|
+
data={dialogContent}
|
|
34
|
+
limit={1}
|
|
35
|
+
fallback={PlankContentError}
|
|
36
|
+
placeholder={<div />}
|
|
37
|
+
/>
|
|
29
38
|
) : (
|
|
30
39
|
<Overlay blockAlign={dialogBlockAlign} classNames={dialogOverlayClasses} style={dialogOverlayStyle}>
|
|
31
|
-
<Surface role='dialog' data={dialogContent} limit={1} fallback={PlankContentError} />
|
|
40
|
+
<Surface.Surface role='dialog' data={dialogContent} limit={1} fallback={PlankContentError} />
|
|
32
41
|
</Overlay>
|
|
33
42
|
)}
|
|
34
43
|
</Root>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import { errorText, mx } from '@dxos/
|
|
8
|
+
import { errorText, mx } from '@dxos/ui-theme';
|
|
9
9
|
|
|
10
10
|
import { meta } from '../../meta';
|
|
11
11
|
|
|
@@ -18,7 +18,7 @@ export const Fallback = () => {
|
|
|
18
18
|
role='alert'
|
|
19
19
|
className={mx(
|
|
20
20
|
errorText,
|
|
21
|
-
'border border-
|
|
21
|
+
'border border-roseFill rounded-md flex items-center justify-center p-8 font-normal text-lg',
|
|
22
22
|
)}
|
|
23
23
|
>
|
|
24
24
|
{t('plugin error message')}
|
|
@@ -3,12 +3,15 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { createContext } from '@radix-ui/react-context';
|
|
6
|
-
import React, { type PropsWithChildren, useCallback, useEffect,
|
|
6
|
+
import React, { type PropsWithChildren, useCallback, useEffect, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { Surface,
|
|
9
|
-
import {
|
|
8
|
+
import { Surface, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
9
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
10
|
+
import { Popover, type PopoverContentInteractOutsideEvent, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
11
|
+
import { Card } from '@dxos/react-ui-mosaic';
|
|
10
12
|
|
|
11
|
-
import {
|
|
13
|
+
import { useDeckState } from '../../hooks';
|
|
14
|
+
import { meta } from '../../meta';
|
|
12
15
|
|
|
13
16
|
export type DeckPopoverRootProps = PropsWithChildren<{}>;
|
|
14
17
|
|
|
@@ -21,32 +24,32 @@ type DeckPopoverContextValue = {
|
|
|
21
24
|
const [DeckPopoverProvider, useDeckPopoverContext] = createContext<DeckPopoverContextValue>('DeckPopover');
|
|
22
25
|
|
|
23
26
|
export const PopoverRoot = ({ children }: DeckPopoverRootProps) => {
|
|
24
|
-
const
|
|
27
|
+
const { state } = useDeckState();
|
|
25
28
|
const virtualRef = useRef<HTMLButtonElement | null>(null);
|
|
26
29
|
const [virtualIter, setVirtualIter] = useState(0);
|
|
27
30
|
const [open, setOpen] = useState(false);
|
|
28
31
|
const debounceRef = useRef<NodeJS.Timeout | null>(null);
|
|
29
32
|
|
|
30
33
|
// TODO(thure): This is a workaround for the race condition between displaying a Popover and either rendering
|
|
31
|
-
// the anchor further down the tree or measuring the virtual trigger
|
|
34
|
+
// the anchor further down the tree or measuring the virtual trigger's client rect.
|
|
32
35
|
useEffect(() => {
|
|
33
36
|
setOpen(false);
|
|
34
|
-
if (
|
|
37
|
+
if (state.popoverOpen) {
|
|
35
38
|
if (debounceRef.current) {
|
|
36
39
|
clearTimeout(debounceRef.current);
|
|
37
40
|
}
|
|
38
|
-
if (
|
|
39
|
-
virtualRef.current =
|
|
41
|
+
if (state.popoverAnchor && virtualRef.current !== state.popoverAnchor) {
|
|
42
|
+
virtualRef.current = state.popoverAnchor ?? null;
|
|
40
43
|
setVirtualIter((iter) => iter + 1);
|
|
41
44
|
}
|
|
42
45
|
debounceRef.current = setTimeout(() => setOpen(true), DEBOUNCE_DELAY);
|
|
43
46
|
}
|
|
44
|
-
}, [
|
|
47
|
+
}, [state.popoverOpen, state.popoverAnchorId, state.popoverAnchor, state.popoverContent]);
|
|
45
48
|
|
|
46
49
|
return (
|
|
47
50
|
<DeckPopoverProvider setOpen={setOpen}>
|
|
48
51
|
<Popover.Root modal={false} open={open}>
|
|
49
|
-
{
|
|
52
|
+
{state.popoverAnchor && <Popover.VirtualTrigger key={virtualIter} virtualRef={virtualRef} />}
|
|
50
53
|
{children}
|
|
51
54
|
</Popover.Root>
|
|
52
55
|
</DeckPopoverProvider>
|
|
@@ -54,10 +57,23 @@ export const PopoverRoot = ({ children }: DeckPopoverRootProps) => {
|
|
|
54
57
|
};
|
|
55
58
|
|
|
56
59
|
export const PopoverContent = () => {
|
|
57
|
-
const
|
|
60
|
+
const { t } = useTranslation(meta.id);
|
|
61
|
+
const { state, updateEphemeral } = useDeckState();
|
|
58
62
|
const { setOpen } = useDeckPopoverContext('PopoverContent');
|
|
63
|
+
const { invokeSync } = useOperationInvoker();
|
|
59
64
|
|
|
60
|
-
const handleClose = useCallback(
|
|
65
|
+
const handleClose = useCallback(() => {
|
|
66
|
+
setOpen(false);
|
|
67
|
+
updateEphemeral((state) => ({
|
|
68
|
+
...state,
|
|
69
|
+
popoverOpen: false,
|
|
70
|
+
popoverAnchor: undefined,
|
|
71
|
+
popoverAnchorId: undefined,
|
|
72
|
+
popoverSide: undefined,
|
|
73
|
+
}));
|
|
74
|
+
}, [updateEphemeral]);
|
|
75
|
+
|
|
76
|
+
const handleInteractOutside = useCallback(
|
|
61
77
|
(event: KeyboardEvent | PopoverContentInteractOutsideEvent) => {
|
|
62
78
|
if (
|
|
63
79
|
// TODO(thure): CodeMirror should not focus itself when it updates.
|
|
@@ -66,36 +82,48 @@ export const PopoverContent = () => {
|
|
|
66
82
|
) {
|
|
67
83
|
event.preventDefault();
|
|
68
84
|
} else {
|
|
69
|
-
|
|
70
|
-
layout.popoverOpen = false;
|
|
71
|
-
layout.popoverAnchor = undefined;
|
|
72
|
-
layout.popoverAnchorId = undefined;
|
|
73
|
-
layout.popoverSide = undefined;
|
|
85
|
+
handleClose();
|
|
74
86
|
}
|
|
75
87
|
},
|
|
76
|
-
[
|
|
88
|
+
[handleClose],
|
|
77
89
|
);
|
|
78
90
|
|
|
79
|
-
const collisionBoundaries: HTMLElement[] = useMemo(() => {
|
|
80
|
-
const closest = layout.popoverAnchor?.closest('[data-popover-collision-boundary]') as
|
|
81
|
-
| HTMLElement
|
|
82
|
-
| null
|
|
83
|
-
| undefined;
|
|
84
|
-
return closest ? [closest] : [];
|
|
85
|
-
}, [layout.popoverAnchor]);
|
|
86
|
-
|
|
87
91
|
return (
|
|
88
92
|
<Popover.Portal>
|
|
89
93
|
<Popover.Content
|
|
90
|
-
side={
|
|
91
|
-
onInteractOutside={handleClose}
|
|
92
|
-
onEscapeKeyDown={handleClose}
|
|
93
|
-
collisionBoundary={collisionBoundaries}
|
|
94
|
+
side={state.popoverSide}
|
|
94
95
|
sticky='always'
|
|
95
96
|
hideWhenDetached
|
|
97
|
+
onInteractOutside={handleInteractOutside}
|
|
98
|
+
onEscapeKeyDown={handleInteractOutside}
|
|
96
99
|
>
|
|
97
100
|
<Popover.Viewport>
|
|
98
|
-
|
|
101
|
+
{/* TODO(burdon): Set/disable column context. */}
|
|
102
|
+
{state.popoverKind === 'base' && <Surface.Surface role='popover' data={state.popoverContent} limit={1} />}
|
|
103
|
+
{state.popoverKind === 'card' && (
|
|
104
|
+
<Card.Root border={false} classNames='popover-card-max-width'>
|
|
105
|
+
<Card.Toolbar>
|
|
106
|
+
{/* TODO(wittjosiah): Cleaner way to handle no drag handle in toolbar? */}
|
|
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
|
+
)}
|
|
121
|
+
{state.popoverTitle ? <Card.Title>{toLocalizedString(state.popoverTitle, t)}</Card.Title> : <span />}
|
|
122
|
+
<Card.Close onClick={handleClose} />
|
|
123
|
+
</Card.Toolbar>
|
|
124
|
+
<Surface.Surface role='card--content' data={state.popoverContent} limit={1} />
|
|
125
|
+
</Card.Root>
|
|
126
|
+
)}
|
|
99
127
|
</Popover.Viewport>
|
|
100
128
|
<Popover.Arrow />
|
|
101
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,14 +28,14 @@ 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 (
|
|
35
35
|
<NaturalToast.Root data-testid={id} defaultOpen duration={duration} onOpenChange={onOpenChange}>
|
|
36
36
|
<NaturalToast.Body>
|
|
37
37
|
<NaturalToast.Title classNames='items-center'>
|
|
38
|
-
{icon && <Icon icon={icon}
|
|
38
|
+
{icon && <Icon icon={icon} classNames='inline mr-1' />}
|
|
39
39
|
{title && <span>{toLocalizedString(title, t)}</span>}
|
|
40
40
|
</NaturalToast.Title>
|
|
41
41
|
{description && (
|
|
@@ -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
|
|
|
@@ -72,7 +72,7 @@ export const Toaster = ({ toasts, onDismissToast }: ToasterProps) => {
|
|
|
72
72
|
<Toast
|
|
73
73
|
{...toast}
|
|
74
74
|
key={toast.id}
|
|
75
|
-
onOpenChange={(open) => {
|
|
75
|
+
onOpenChange={(open: boolean) => {
|
|
76
76
|
if (!open) {
|
|
77
77
|
onDismissToast?.(toast.id);
|
|
78
78
|
}
|
|
@@ -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 {
|
|
@@ -18,30 +18,37 @@ import {
|
|
|
18
18
|
|
|
19
19
|
const isSocket = !!(globalThis as any).__args;
|
|
20
20
|
|
|
21
|
-
export
|
|
21
|
+
export type DeckSettingsComponentProps = {
|
|
22
|
+
settings: DeckSettingsProps;
|
|
23
|
+
onSettingsChange: (fn: (current: DeckSettingsProps) => DeckSettingsProps) => void;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const DeckSettings = ({ settings, onSettingsChange }: DeckSettingsComponentProps) => {
|
|
22
27
|
const { t } = useTranslation(meta.id);
|
|
23
28
|
|
|
24
29
|
return (
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
<
|
|
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')}>
|
|
29
34
|
<Input.Switch
|
|
30
35
|
checked={settings.enableDeck}
|
|
31
|
-
onCheckedChange={(checked) => (
|
|
36
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, enableDeck: checked }))}
|
|
32
37
|
/>
|
|
33
|
-
</
|
|
34
|
-
<
|
|
38
|
+
</Settings.ItemInput>
|
|
39
|
+
<Settings.ItemInput title={t('settings encapsulated planks label')}>
|
|
35
40
|
<Input.Switch
|
|
36
41
|
checked={settings.encapsulatedPlanks ?? false}
|
|
37
|
-
onCheckedChange={(checked) => (
|
|
42
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, encapsulatedPlanks: checked }))}
|
|
38
43
|
/>
|
|
39
|
-
</
|
|
40
|
-
<
|
|
44
|
+
</Settings.ItemInput>
|
|
45
|
+
<Settings.ItemInput title={t('select new plank positioning label')}>
|
|
41
46
|
<Select.Root
|
|
42
47
|
disabled={!settings.enableDeck}
|
|
43
48
|
value={settings.newPlankPositioning ?? 'start'}
|
|
44
|
-
onValueChange={(value) =>
|
|
49
|
+
onValueChange={(value) =>
|
|
50
|
+
onSettingsChange((s) => ({ ...s, newPlankPositioning: value as NewPlankPositioning }))
|
|
51
|
+
}
|
|
45
52
|
>
|
|
46
53
|
<Select.TriggerButton placeholder={t('select new plank positioning placeholder')} />
|
|
47
54
|
<Select.Portal>
|
|
@@ -57,12 +64,12 @@ export const DeckSettings = ({ settings }: { settings: DeckSettingsProps }) => {
|
|
|
57
64
|
</Select.Content>
|
|
58
65
|
</Select.Portal>
|
|
59
66
|
</Select.Root>
|
|
60
|
-
</
|
|
61
|
-
<
|
|
67
|
+
</Settings.ItemInput>
|
|
68
|
+
<Settings.ItemInput title={t('settings overscroll label')}>
|
|
62
69
|
<Select.Root
|
|
63
70
|
disabled={!settings.enableDeck}
|
|
64
71
|
value={settings.overscroll ?? 'none'}
|
|
65
|
-
onValueChange={(value) => (
|
|
72
|
+
onValueChange={(value) => onSettingsChange((s) => ({ ...s, overscroll: value as Overscroll }))}
|
|
66
73
|
>
|
|
67
74
|
<Select.TriggerButton placeholder={t('select overscroll placeholder')} />
|
|
68
75
|
<Select.Portal>
|
|
@@ -78,26 +85,29 @@ export const DeckSettings = ({ settings }: { settings: DeckSettingsProps }) => {
|
|
|
78
85
|
</Select.Content>
|
|
79
86
|
</Select.Portal>
|
|
80
87
|
</Select.Root>
|
|
81
|
-
</
|
|
82
|
-
<
|
|
88
|
+
</Settings.ItemInput>
|
|
89
|
+
<Settings.ItemInput title={t('settings enable statusbar label')}>
|
|
83
90
|
<Input.Switch
|
|
84
91
|
checked={settings.enableStatusbar}
|
|
85
|
-
onCheckedChange={(checked) => (
|
|
92
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, enableStatusbar: checked }))}
|
|
93
|
+
/>
|
|
94
|
+
</Settings.ItemInput>
|
|
95
|
+
<Settings.ItemInput title={t('settings show hints label')}>
|
|
96
|
+
<Input.Switch
|
|
97
|
+
checked={settings.showHints}
|
|
98
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, showHints: checked }))}
|
|
86
99
|
/>
|
|
87
|
-
</
|
|
88
|
-
<ControlItemInput title={t('settings show hints label')}>
|
|
89
|
-
<Input.Switch checked={settings.showHints} onCheckedChange={(checked) => (settings.showHints = checked)} />
|
|
90
|
-
</ControlItemInput>
|
|
100
|
+
</Settings.ItemInput>
|
|
91
101
|
{!isSocket && (
|
|
92
|
-
<
|
|
102
|
+
<Settings.ItemInput title={t('settings native redirect label')}>
|
|
93
103
|
<Input.Switch
|
|
94
104
|
checked={settings.enableNativeRedirect}
|
|
95
|
-
onCheckedChange={(checked) => (
|
|
105
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, enableNativeRedirect: checked }))}
|
|
96
106
|
/>
|
|
97
|
-
</
|
|
107
|
+
</Settings.ItemInput>
|
|
98
108
|
)}
|
|
99
|
-
</
|
|
100
|
-
</
|
|
101
|
-
</
|
|
109
|
+
</Settings.Group>
|
|
110
|
+
</Settings.Section>
|
|
111
|
+
</Settings.Root>
|
|
102
112
|
);
|
|
103
113
|
};
|
|
@@ -5,18 +5,28 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Capability, Plugin } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
11
|
+
import { corePlugins } from '@dxos/plugin-testing';
|
|
12
12
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
13
13
|
import { Stack } from '@dxos/react-ui-stack';
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { DeckState } from '../../capabilities';
|
|
16
|
+
import { meta as pluginMeta } from '../../meta';
|
|
16
17
|
import { translations } from '../../translations';
|
|
17
18
|
|
|
18
19
|
import { Plank } from './Plank';
|
|
19
20
|
|
|
21
|
+
const TestPlugin = Plugin.define(pluginMeta).pipe(
|
|
22
|
+
Plugin.addModule({
|
|
23
|
+
id: Capability.getModuleTag(DeckState),
|
|
24
|
+
activatesOn: AppActivationEvents.AppGraphReady,
|
|
25
|
+
activate: () => DeckState(),
|
|
26
|
+
}),
|
|
27
|
+
Plugin.make,
|
|
28
|
+
);
|
|
29
|
+
|
|
20
30
|
const meta = {
|
|
21
31
|
title: 'plugins/plugin-deck/Plank',
|
|
22
32
|
component: Plank,
|
|
@@ -28,10 +38,9 @@ const meta = {
|
|
|
28
38
|
);
|
|
29
39
|
},
|
|
30
40
|
decorators: [
|
|
31
|
-
withTheme,
|
|
41
|
+
withTheme(),
|
|
32
42
|
withPluginManager({
|
|
33
|
-
plugins: [
|
|
34
|
-
capabilities: () => DeckStateFactory(),
|
|
43
|
+
plugins: [...corePlugins(), TestPlugin()],
|
|
35
44
|
}),
|
|
36
45
|
],
|
|
37
46
|
parameters: {
|