@dxos/plugin-deck 0.8.2-staging.7ac8446 → 0.8.2
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-VYZ4IWI3.mjs → app-graph-builder-M5BT34YG.mjs} +17 -16
- package/dist/lib/browser/app-graph-builder-M5BT34YG.mjs.map +7 -0
- package/dist/lib/browser/{check-app-scheme-SEYECDHI.mjs → check-app-scheme-7AXGR6UT.mjs} +2 -3
- package/dist/lib/browser/check-app-scheme-7AXGR6UT.mjs.map +7 -0
- package/dist/lib/browser/{state-7TN26M42.mjs → chunk-FX44YX3G.mjs} +11 -8
- package/dist/lib/browser/chunk-FX44YX3G.mjs.map +7 -0
- package/dist/lib/browser/chunk-JE2ARGEB.mjs +1487 -0
- package/dist/lib/browser/chunk-JE2ARGEB.mjs.map +7 -0
- package/dist/lib/browser/{chunk-XMCG42ID.mjs → chunk-KLN73CM3.mjs} +2 -2
- package/dist/lib/browser/{chunk-XMCG42ID.mjs.map → chunk-KLN73CM3.mjs.map} +1 -1
- package/dist/lib/browser/chunk-SLQNOATN.mjs +127 -0
- package/dist/lib/browser/chunk-SLQNOATN.mjs.map +7 -0
- package/dist/lib/browser/chunk-TRFYUEBA.mjs +145 -0
- package/dist/lib/browser/chunk-TRFYUEBA.mjs.map +7 -0
- package/dist/lib/browser/chunk-YN5OZEGS.mjs +162 -0
- package/dist/lib/browser/chunk-YN5OZEGS.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +8 -8
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/{intent-resolver-UDYKO2QW.mjs → intent-resolver-3GAC57UA.mjs} +135 -92
- package/dist/lib/browser/intent-resolver-3GAC57UA.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-XLXN2VEW.mjs → react-root-ISFFOJZX.mjs} +7 -7
- package/dist/lib/browser/{react-surface-WNGMZL7I.mjs → react-surface-A63RQB5N.mjs} +7 -7
- package/dist/lib/browser/{settings-HMDGSBGO.mjs → settings-X7GDEXU3.mjs} +6 -6
- package/dist/lib/browser/settings-X7GDEXU3.mjs.map +7 -0
- package/dist/lib/browser/state-VJ6E3ADY.mjs +10 -0
- package/dist/lib/browser/state-VJ6E3ADY.mjs.map +7 -0
- package/dist/lib/browser/{tools-SC6QEN7R.mjs → tools-N57NQ2LH.mjs} +28 -18
- package/dist/lib/browser/tools-N57NQ2LH.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/browser/{url-handler-ODG4B6NX.mjs → url-handler-BUGI6XRE.mjs} +5 -5
- package/dist/lib/browser/url-handler-BUGI6XRE.mjs.map +7 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +2 -179
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +18 -8
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/check-app-scheme.d.ts +2 -2
- package/dist/types/src/capabilities/check-app-scheme.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +8 -183
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +12 -7
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/tools.d.ts +1 -1
- package/dist/types/src/capabilities/tools.d.ts.map +1 -1
- package/dist/types/src/capabilities/url-handler.d.ts +2 -2
- package/dist/types/src/capabilities/url-handler.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.map +1 -1
- package/dist/types/src/components/DeckLayout/Dialog.d.ts +3 -0
- package/dist/types/src/components/DeckLayout/Dialog.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/Popover.d.ts +5 -0
- package/dist/types/src/components/DeckLayout/Popover.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/StatusBar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
- package/dist/types/src/components/DeckSettings/DeckSettings.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.d.ts +18 -5
- package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.stories.d.ts +3 -3
- package/dist/types/src/components/Plank/Plank.stories.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankControls.d.ts +3 -2
- package/dist/types/src/components/Plank/PlankControls.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankError.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankHeading.d.ts +3 -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 +2 -1
- package/dist/types/src/components/Sidebar/SidebarButton.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +5 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBreakpoints.d.ts.map +1 -0
- package/dist/types/src/hooks/useCompanions.d.ts.map +1 -0
- package/dist/types/src/hooks/useDeckCompanions.d.ts +13 -0
- package/dist/types/src/hooks/useDeckCompanions.d.ts.map +1 -0
- package/dist/types/src/hooks/useHoistStatusbar.d.ts +3 -0
- package/dist/types/src/hooks/useHoistStatusbar.d.ts.map +1 -0
- package/dist/types/src/hooks/useNodeActionExpander.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/layout.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/types.d.ts +108 -104
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -4
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/layoutAppliesTopbar.d.ts +2 -1
- package/dist/types/src/util/layoutAppliesTopbar.d.ts.map +1 -1
- package/dist/types/src/util/overscroll.d.ts.map +1 -1
- package/dist/types/src/util/set-active.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +39 -30
- package/src/capabilities/app-graph-builder.ts +120 -92
- package/src/capabilities/check-app-scheme.ts +3 -7
- package/src/capabilities/index.ts +3 -2
- package/src/capabilities/intent-resolver.ts +181 -135
- package/src/capabilities/settings.ts +4 -4
- package/src/capabilities/state.ts +7 -4
- package/src/capabilities/tools.ts +15 -12
- package/src/capabilities/url-handler.ts +4 -4
- package/src/components/DeckLayout/ContentEmpty.tsx +9 -4
- package/src/components/DeckLayout/DeckLayout.tsx +123 -188
- package/src/components/DeckLayout/Dialog.tsx +36 -0
- package/src/components/DeckLayout/Popover.tsx +104 -0
- package/src/components/Plank/Plank.stories.tsx +20 -8
- package/src/components/Plank/Plank.tsx +105 -69
- package/src/components/Plank/PlankControls.tsx +53 -57
- package/src/components/Plank/PlankError.tsx +2 -6
- package/src/components/Plank/PlankHeading.tsx +31 -12
- package/src/components/Sidebar/ComplementarySidebar.tsx +36 -57
- package/src/components/Sidebar/Sidebar.tsx +7 -4
- package/src/components/Sidebar/SidebarButton.tsx +26 -7
- package/src/components/fragments.ts +1 -1
- package/src/hooks/index.ts +5 -1
- package/src/{util → hooks}/useCompanions.ts +3 -3
- package/src/hooks/useDeckCompanions.ts +33 -0
- package/src/{util → hooks}/useHoistStatusbar.ts +9 -4
- package/src/hooks/useNodeActionExpander.ts +3 -8
- package/src/index.ts +1 -1
- package/src/translations.ts +2 -1
- package/src/types.ts +77 -71
- package/src/util/index.ts +1 -4
- package/src/util/layoutAppliesTopbar.ts +8 -2
- package/dist/lib/browser/app-graph-builder-VYZ4IWI3.mjs.map +0 -7
- package/dist/lib/browser/check-app-scheme-SEYECDHI.mjs.map +0 -7
- package/dist/lib/browser/chunk-6ZSOFCPP.mjs +0 -117
- package/dist/lib/browser/chunk-6ZSOFCPP.mjs.map +0 -7
- package/dist/lib/browser/chunk-B4LOJUWW.mjs +0 -24
- package/dist/lib/browser/chunk-B4LOJUWW.mjs.map +0 -7
- package/dist/lib/browser/chunk-FJBMNSUC.mjs +0 -1289
- package/dist/lib/browser/chunk-FJBMNSUC.mjs.map +0 -7
- package/dist/lib/browser/chunk-FLOVGNYB.mjs +0 -81
- package/dist/lib/browser/chunk-FLOVGNYB.mjs.map +0 -7
- package/dist/lib/browser/chunk-RJNCG4ND.mjs +0 -154
- package/dist/lib/browser/chunk-RJNCG4ND.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-UDYKO2QW.mjs.map +0 -7
- package/dist/lib/browser/settings-HMDGSBGO.mjs.map +0 -7
- package/dist/lib/browser/state-7TN26M42.mjs.map +0 -7
- package/dist/lib/browser/tools-SC6QEN7R.mjs.map +0 -7
- package/dist/lib/browser/url-handler-ODG4B6NX.mjs.map +0 -7
- package/dist/types/src/components/DeckLayout/Fullscreen.d.ts +0 -5
- package/dist/types/src/components/DeckLayout/Fullscreen.d.ts.map +0 -1
- package/dist/types/src/util/useBreakpoints.d.ts.map +0 -1
- package/dist/types/src/util/useCompanions.d.ts.map +0 -1
- package/dist/types/src/util/useHoistStatusbar.d.ts +0 -2
- package/dist/types/src/util/useHoistStatusbar.d.ts.map +0 -1
- package/src/components/DeckLayout/Fullscreen.tsx +0 -31
- /package/dist/lib/browser/{react-root-XLXN2VEW.mjs.map → react-root-ISFFOJZX.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-WNGMZL7I.mjs.map → react-surface-A63RQB5N.mjs.map} +0 -0
- /package/dist/types/src/{util → hooks}/useBreakpoints.d.ts +0 -0
- /package/dist/types/src/{util → hooks}/useCompanions.d.ts +0 -0
- /package/src/{util → hooks}/useBreakpoints.ts +0 -0
|
@@ -12,51 +12,20 @@ import React, {
|
|
|
12
12
|
useState,
|
|
13
13
|
} from 'react';
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
LayoutAction,
|
|
17
|
-
Surface,
|
|
18
|
-
createIntent,
|
|
19
|
-
useAppGraph,
|
|
20
|
-
useCapability,
|
|
21
|
-
useIntentDispatcher,
|
|
22
|
-
} from '@dxos/app-framework';
|
|
23
|
-
import { type Node } from '@dxos/plugin-graph';
|
|
15
|
+
import { LayoutAction, Surface, createIntent, useCapability, useIntentDispatcher } from '@dxos/app-framework';
|
|
24
16
|
import { Main, useTranslation, toLocalizedString, IconButton, type Label } from '@dxos/react-ui';
|
|
25
17
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
26
|
-
import { byPosition, type Position } from '@dxos/util';
|
|
27
18
|
|
|
28
19
|
import { ToggleComplementarySidebarButton } from './SidebarButton';
|
|
29
20
|
import { DeckCapabilities } from '../../capabilities';
|
|
21
|
+
import { type DeckCompanion, getCompanionId, useDeckCompanions, useBreakpoints, useHoistStatusbar } from '../../hooks';
|
|
30
22
|
import { DECK_PLUGIN } from '../../meta';
|
|
31
|
-
import {
|
|
32
|
-
import { layoutAppliesTopbar
|
|
23
|
+
import { getMode } from '../../types';
|
|
24
|
+
import { layoutAppliesTopbar } from '../../util';
|
|
33
25
|
import { PlankContentError, PlankLoading } from '../Plank';
|
|
34
26
|
|
|
35
27
|
const label = ['complementary sidebar title', { ns: DECK_PLUGIN }] satisfies Label;
|
|
36
28
|
|
|
37
|
-
const getCompanionId = (id: string) => {
|
|
38
|
-
const [_, companionId] = id.split(ATTENDABLE_PATH_SEPARATOR);
|
|
39
|
-
return companionId ?? 'never';
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
type DeckCompanion = Node<
|
|
43
|
-
any,
|
|
44
|
-
{
|
|
45
|
-
label: Label;
|
|
46
|
-
icon: string;
|
|
47
|
-
// TODO(burdon): Scroll area should be controlled by surface.
|
|
48
|
-
/** If true, the panel will not be wrapped in a scroll area. */
|
|
49
|
-
fixed?: boolean;
|
|
50
|
-
position?: Position;
|
|
51
|
-
}
|
|
52
|
-
>;
|
|
53
|
-
|
|
54
|
-
const useDeckCompanions = (): DeckCompanion[] => {
|
|
55
|
-
const { graph } = useAppGraph();
|
|
56
|
-
const companions = graph.nodes(graph.root, { type: DECK_COMPANION_TYPE }) as DeckCompanion[];
|
|
57
|
-
return companions.toSorted((a, b) => byPosition(a.properties, b.properties));
|
|
58
|
-
};
|
|
59
|
-
|
|
60
29
|
export type ComplementarySidebarProps = {
|
|
61
30
|
current?: string;
|
|
62
31
|
};
|
|
@@ -65,13 +34,14 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
65
34
|
const { t } = useTranslation(DECK_PLUGIN);
|
|
66
35
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
67
36
|
const layout = useCapability(DeckCapabilities.MutableDeckState);
|
|
37
|
+
const layoutMode = getMode(layout.deck);
|
|
68
38
|
const breakpoint = useBreakpoints();
|
|
69
|
-
const topbar = layoutAppliesTopbar(breakpoint);
|
|
70
|
-
const hoistStatusbar = useHoistStatusbar(breakpoint);
|
|
39
|
+
const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
|
|
40
|
+
const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
|
|
71
41
|
|
|
72
42
|
const companions = useDeckCompanions();
|
|
73
|
-
const activeCompanion = companions.find((companion) => getCompanionId(companion.id) === current)
|
|
74
|
-
const activeId = getCompanionId(activeCompanion
|
|
43
|
+
const activeCompanion = companions.find((companion) => getCompanionId(companion.id) === current);
|
|
44
|
+
const activeId = activeCompanion && getCompanionId(activeCompanion.id);
|
|
75
45
|
const [internalValue, setInternalValue] = useState(activeId);
|
|
76
46
|
|
|
77
47
|
useEffect(() => {
|
|
@@ -101,6 +71,14 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
101
71
|
[activeCompanion?.id, activeCompanion?.data],
|
|
102
72
|
);
|
|
103
73
|
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (!activeId) {
|
|
76
|
+
void dispatch(
|
|
77
|
+
createIntent(LayoutAction.UpdateComplementary, { part: 'complementary', options: { state: 'collapsed' } }),
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}, [activeId, dispatch]);
|
|
81
|
+
|
|
104
82
|
return (
|
|
105
83
|
<Main.ComplementarySidebar
|
|
106
84
|
label={label}
|
|
@@ -112,7 +90,7 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
112
90
|
<Tabs.Root orientation='vertical' verticalVariant='stateless' value={internalValue} classNames='contents'>
|
|
113
91
|
<div
|
|
114
92
|
role='none'
|
|
115
|
-
className='absolute z-[1] inset-block-0 inline-end-0 !is-[--r0-size] pbs-[env(safe-area-inset-top)] pbe-[env(safe-area-inset-bottom)] border-is border-
|
|
93
|
+
className='absolute z-[1] inset-block-0 inline-end-0 !is-[--r0-size] pbs-[env(safe-area-inset-top)] pbe-[env(safe-area-inset-bottom)] border-is border-subduedSeparator grid grid-cols-1 grid-rows-[1fr_min-content] bg-baseSurface contain-layout app-drag'
|
|
116
94
|
>
|
|
117
95
|
<Tabs.Tablist classNames='grid grid-cols-1 auto-rows-[--rail-action] p-1 gap-1 !overflow-y-auto'>
|
|
118
96
|
{companions.map((companion) => (
|
|
@@ -145,21 +123,22 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
145
123
|
<ToggleComplementarySidebarButton />
|
|
146
124
|
</div>
|
|
147
125
|
</div>
|
|
148
|
-
{
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
126
|
+
{activeId &&
|
|
127
|
+
companions.map((companion) => (
|
|
128
|
+
<Tabs.Tabpanel
|
|
129
|
+
key={getCompanionId(companion.id)}
|
|
130
|
+
value={getCompanionId(companion.id)}
|
|
131
|
+
classNames='absolute data-[state="inactive"]:-z-[1] inset-block-0 inline-start-0 is-[calc(100%-var(--r0-size))] lg:is-[--r1-size] grid grid-cols-1 grid-rows-[var(--rail-size)_1fr_min-content] pbs-[env(safe-area-inset-top)]'
|
|
132
|
+
{...(layout.complementarySidebarState !== 'expanded' && { inert: 'true' })}
|
|
133
|
+
>
|
|
134
|
+
<ComplementarySidebarPanel
|
|
135
|
+
companion={companion}
|
|
136
|
+
activeId={activeId}
|
|
137
|
+
data={data}
|
|
138
|
+
hoistStatusbar={hoistStatusbar}
|
|
139
|
+
/>
|
|
140
|
+
</Tabs.Tabpanel>
|
|
141
|
+
))}
|
|
163
142
|
</Tabs.Root>
|
|
164
143
|
</Main.ComplementarySidebar>
|
|
165
144
|
);
|
|
@@ -190,7 +169,7 @@ const ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }
|
|
|
190
169
|
|
|
191
170
|
return (
|
|
192
171
|
<>
|
|
193
|
-
<h2 className='flex items-center pli-2 border-
|
|
172
|
+
<h2 className='flex items-center pli-2 border-subduedSeparator border-be font-medium'>
|
|
194
173
|
{toLocalizedString(companion.properties.label, t)}
|
|
195
174
|
</h2>
|
|
196
175
|
<Wrapper>
|
|
@@ -204,7 +183,7 @@ const ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }
|
|
|
204
183
|
{!hoistStatusbar && (
|
|
205
184
|
<div
|
|
206
185
|
role='contentinfo'
|
|
207
|
-
className='flex flex-wrap justify-center items-center border-bs border-
|
|
186
|
+
className='flex flex-wrap justify-center items-center border-bs border-subduedSeparator pbs-1 pbe-[max(env(safe-area-inset-bottom),0.25rem)]'
|
|
208
187
|
>
|
|
209
188
|
<Surface role='status-bar--r1-footer' limit={1} />
|
|
210
189
|
</div>
|
|
@@ -8,16 +8,19 @@ import { Surface, useCapability } from '@dxos/app-framework';
|
|
|
8
8
|
import { type Label, Main } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
10
|
import { DeckCapabilities } from '../../capabilities';
|
|
11
|
+
import { useBreakpoints, useHoistStatusbar } from '../../hooks';
|
|
11
12
|
import { DECK_PLUGIN } from '../../meta';
|
|
12
|
-
import {
|
|
13
|
+
import { getMode } from '../../types';
|
|
14
|
+
import { layoutAppliesTopbar } from '../../util';
|
|
13
15
|
|
|
14
16
|
const label = ['sidebar title', { ns: DECK_PLUGIN }] satisfies Label;
|
|
15
17
|
|
|
16
18
|
export const Sidebar = () => {
|
|
17
|
-
const { popoverAnchorId, activeDeck: current } = useCapability(DeckCapabilities.DeckState);
|
|
19
|
+
const { popoverAnchorId, activeDeck: current, deck } = useCapability(DeckCapabilities.DeckState);
|
|
18
20
|
const breakpoint = useBreakpoints();
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
+
const layoutMode = getMode(deck);
|
|
22
|
+
const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
|
|
23
|
+
const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
|
|
21
24
|
|
|
22
25
|
const navigationData = useMemo(
|
|
23
26
|
() => ({ popoverAnchorId, topbar, hoistStatusbar, current }),
|
|
@@ -2,12 +2,13 @@
|
|
|
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 { useCapability } from '@dxos/app-framework';
|
|
7
|
+
import { createIntent, LayoutAction, useCapability, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { IconButton, type IconButtonProps, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
10
|
import { DeckCapabilities } from '../../capabilities';
|
|
11
|
+
import { useDeckCompanions, getCompanionId } from '../../hooks';
|
|
11
12
|
import { DECK_PLUGIN } from '../../meta';
|
|
12
13
|
|
|
13
14
|
export const ToggleSidebarButton = ({
|
|
@@ -47,16 +48,34 @@ export const CloseSidebarButton = () => {
|
|
|
47
48
|
);
|
|
48
49
|
};
|
|
49
50
|
|
|
50
|
-
export const ToggleComplementarySidebarButton = ({
|
|
51
|
+
export const ToggleComplementarySidebarButton = ({
|
|
52
|
+
inR0,
|
|
53
|
+
classNames,
|
|
54
|
+
current,
|
|
55
|
+
}: ThemedClassName<{ inR0?: boolean; current?: string }>) => {
|
|
56
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
51
57
|
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
52
58
|
const { t } = useTranslation(DECK_PLUGIN);
|
|
59
|
+
|
|
60
|
+
const companions = useDeckCompanions();
|
|
61
|
+
const handleClick = useCallback(async () => {
|
|
62
|
+
layoutContext.complementarySidebarState =
|
|
63
|
+
layoutContext.complementarySidebarState === 'expanded' ? 'collapsed' : 'expanded';
|
|
64
|
+
const firstCompanion = companions[0];
|
|
65
|
+
if (layoutContext.complementarySidebarState === 'expanded' && !current && firstCompanion) {
|
|
66
|
+
await dispatch(
|
|
67
|
+
createIntent(LayoutAction.UpdateComplementary, {
|
|
68
|
+
part: 'complementary',
|
|
69
|
+
subject: getCompanionId(firstCompanion.id),
|
|
70
|
+
}),
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
}, [layoutContext, current, companions, dispatch]);
|
|
74
|
+
|
|
53
75
|
return (
|
|
54
76
|
<IconButton
|
|
55
77
|
iconOnly
|
|
56
|
-
onClick={
|
|
57
|
-
(layoutContext.complementarySidebarState =
|
|
58
|
-
layoutContext.complementarySidebarState === 'expanded' ? 'collapsed' : 'expanded')
|
|
59
|
-
}
|
|
78
|
+
onClick={handleClick}
|
|
60
79
|
variant='ghost'
|
|
61
80
|
label={t('open complementary sidebar label')}
|
|
62
81
|
classNames={['[&>svg]:-scale-x-100', classNames]}
|
|
@@ -7,7 +7,7 @@ import { mx } from '@dxos/react-ui-theme';
|
|
|
7
7
|
export const soloInlinePadding =
|
|
8
8
|
'pis-[calc(env(safe-area-inset-left)+.25rem)] pie-[calc(env(safe-area-inset-left)+.25rem)]';
|
|
9
9
|
|
|
10
|
-
const sidebarToggleStyles = 'bs-[--rail-item] is-[--rail-item] absolute block-end-2 z-[1] !bg-
|
|
10
|
+
const sidebarToggleStyles = 'bs-[--rail-item] is-[--rail-item] absolute block-end-2 z-[1] !bg-deckSurface lg:hidden';
|
|
11
11
|
|
|
12
12
|
export const fixedSidebarToggleStyles = mx(sidebarToggleStyles, 'inline-start-2');
|
|
13
13
|
|
package/src/hooks/index.ts
CHANGED
|
@@ -2,5 +2,9 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './useBreakpoints';
|
|
6
|
+
export * from './useCompanions';
|
|
7
|
+
export * from './useDeckCompanions';
|
|
8
|
+
export * from './useHoistStatusbar';
|
|
6
9
|
export * from './useMainSize';
|
|
10
|
+
export * from './useNodeActionExpander';
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { useAppGraph } from '@dxos/app-framework';
|
|
8
|
-
import {
|
|
8
|
+
import { useConnections } from '@dxos/plugin-graph';
|
|
9
9
|
import { byPosition } from '@dxos/util';
|
|
10
10
|
|
|
11
11
|
import { PLANK_COMPANION_TYPE } from '../types';
|
|
12
12
|
|
|
13
13
|
export const useCompanions = (id?: string) => {
|
|
14
14
|
const { graph } = useAppGraph();
|
|
15
|
-
const
|
|
16
|
-
const companions =
|
|
15
|
+
const nodes = useConnections(graph, id);
|
|
16
|
+
const companions = nodes.filter((node) => node.type === PLANK_COMPANION_TYPE);
|
|
17
17
|
return useMemo(() => companions.toSorted((a, b) => byPosition(a.properties, b.properties)), [companions]);
|
|
18
18
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Label, useAppGraph } from '@dxos/app-framework';
|
|
6
|
+
import { ROOT_ID, useConnections, type Node } from '@dxos/plugin-graph';
|
|
7
|
+
import { byPosition, type Position } from '@dxos/util';
|
|
8
|
+
|
|
9
|
+
import { ATTENDABLE_PATH_SEPARATOR, DECK_COMPANION_TYPE } from '../types';
|
|
10
|
+
|
|
11
|
+
export const getCompanionId = (id: string) => {
|
|
12
|
+
const [_, companionId] = id.split(ATTENDABLE_PATH_SEPARATOR);
|
|
13
|
+
return companionId ?? 'never';
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type DeckCompanion = Node<
|
|
17
|
+
any,
|
|
18
|
+
{
|
|
19
|
+
label: Label;
|
|
20
|
+
icon: string;
|
|
21
|
+
// TODO(burdon): Scroll area should be controlled by surface.
|
|
22
|
+
/** If true, the panel will not be wrapped in a scroll area. */
|
|
23
|
+
fixed?: boolean;
|
|
24
|
+
position?: Position;
|
|
25
|
+
}
|
|
26
|
+
>;
|
|
27
|
+
|
|
28
|
+
export const useDeckCompanions = (): DeckCompanion[] => {
|
|
29
|
+
const { graph } = useAppGraph();
|
|
30
|
+
const connections = useConnections(graph, ROOT_ID);
|
|
31
|
+
const companions = connections.filter((node) => node.type === DECK_COMPANION_TYPE) as DeckCompanion[];
|
|
32
|
+
return companions.toSorted((a, b) => byPosition(a.properties, b.properties));
|
|
33
|
+
};
|
|
@@ -8,13 +8,18 @@ import { Capabilities, useCapability } from '@dxos/app-framework';
|
|
|
8
8
|
import { useThemeContext } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
10
|
import { DECK_PLUGIN } from '../meta';
|
|
11
|
-
import type { DeckSettingsProps } from '../types';
|
|
11
|
+
import type { DeckSettingsProps, LayoutMode } from '../types';
|
|
12
12
|
|
|
13
|
-
export const useHoistStatusbar = (breakpoint: string): boolean => {
|
|
13
|
+
export const useHoistStatusbar = (breakpoint: string, layoutMode?: LayoutMode): boolean => {
|
|
14
14
|
const enableStatusbar = useCapability(Capabilities.SettingsStore).getStore<DeckSettingsProps>(DECK_PLUGIN)!.value
|
|
15
15
|
.enableStatusbar;
|
|
16
16
|
const { safeAreaPadding } = useThemeContext();
|
|
17
17
|
return useMemo(() => {
|
|
18
|
-
return
|
|
19
|
-
|
|
18
|
+
return (
|
|
19
|
+
breakpoint === 'desktop' &&
|
|
20
|
+
layoutMode !== 'solo--fullscreen' &&
|
|
21
|
+
!!enableStatusbar &&
|
|
22
|
+
safeAreaPadding?.bottom === 0
|
|
23
|
+
);
|
|
24
|
+
}, [enableStatusbar, breakpoint, safeAreaPadding?.bottom, layoutMode]);
|
|
20
25
|
};
|
|
@@ -4,19 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const expandNodeActions = async (node: Node) => {
|
|
10
|
-
const graph = getGraph(node);
|
|
11
|
-
await graph.expand(node, 'outbound', ACTION_GROUP_TYPE);
|
|
12
|
-
await graph.expand(node, 'outbound', ACTION_TYPE);
|
|
13
|
-
};
|
|
7
|
+
import { getGraph, type Node } from '@dxos/plugin-graph';
|
|
14
8
|
|
|
15
9
|
export const useNodeActionExpander = (node?: Node) => {
|
|
16
10
|
useEffect(() => {
|
|
17
11
|
if (node) {
|
|
18
12
|
const frame = requestAnimationFrame(() => {
|
|
19
|
-
|
|
13
|
+
const graph = getGraph(node);
|
|
14
|
+
void graph.expand(node.id);
|
|
20
15
|
});
|
|
21
16
|
return () => cancelAnimationFrame(frame);
|
|
22
17
|
}
|
package/src/index.ts
CHANGED
package/src/translations.ts
CHANGED
|
@@ -35,7 +35,6 @@ export default [
|
|
|
35
35
|
'plank heading fallback label': 'Untitled',
|
|
36
36
|
'actions menu label': 'Options',
|
|
37
37
|
'settings deck label': 'Disable deck',
|
|
38
|
-
'reload required message': 'Reload required.',
|
|
39
38
|
'pending heading': 'Loading…',
|
|
40
39
|
'insert plank label': 'Open',
|
|
41
40
|
'resize label': 'Drag to resize',
|
|
@@ -45,6 +44,8 @@ export default [
|
|
|
45
44
|
'increment end label': 'Move to the right',
|
|
46
45
|
'show deck plank label': 'Return to deck',
|
|
47
46
|
'show solo plank label': 'Maximize',
|
|
47
|
+
'exit fullscreen label': 'Exit fullscreen',
|
|
48
|
+
'show fullscreen plank label': 'Fullscreen',
|
|
48
49
|
'close label': 'Close',
|
|
49
50
|
'minify label': 'Minify',
|
|
50
51
|
'open companion label': 'Open companion',
|
package/src/types.ts
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
6
|
+
|
|
5
7
|
import { LayoutAction } from '@dxos/app-framework';
|
|
6
|
-
import {
|
|
8
|
+
import { type DeepReadonly } from '@dxos/util';
|
|
7
9
|
|
|
8
10
|
import { DECK_PLUGIN } from './meta';
|
|
9
11
|
|
|
@@ -22,33 +24,33 @@ export type Overscroll = (typeof OverscrollOptions)[number];
|
|
|
22
24
|
export type Part = 'solo' | 'deck' | 'complementary';
|
|
23
25
|
export type ResolvedPart = Part | 'solo-primary' | 'solo-companion';
|
|
24
26
|
|
|
25
|
-
export const DeckSettingsSchema =
|
|
26
|
-
showHints:
|
|
27
|
-
enableDeck:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
newPlankPositioning:
|
|
31
|
-
overscroll:
|
|
32
|
-
}).pipe(
|
|
33
|
-
export type DeckSettingsProps =
|
|
27
|
+
export const DeckSettingsSchema = Schema.Struct({
|
|
28
|
+
showHints: Schema.optional(Schema.Boolean),
|
|
29
|
+
enableDeck: Schema.optional(Schema.Boolean),
|
|
30
|
+
enableStatusbar: Schema.optional(Schema.Boolean),
|
|
31
|
+
enableNativeRedirect: Schema.optional(Schema.Boolean),
|
|
32
|
+
newPlankPositioning: Schema.optional(Schema.Literal(...NewPlankPositions)),
|
|
33
|
+
overscroll: Schema.optional(Schema.Literal(...OverscrollOptions)),
|
|
34
|
+
}).pipe(Schema.mutable);
|
|
35
|
+
export type DeckSettingsProps = Schema.Schema.Type<typeof DeckSettingsSchema>;
|
|
34
36
|
|
|
35
|
-
export const PlankSizing =
|
|
36
|
-
export type PlankSizing =
|
|
37
|
+
export const PlankSizing = Schema.Record({ key: Schema.String, value: Schema.Number });
|
|
38
|
+
export type PlankSizing = Schema.Schema.Type<typeof PlankSizing>;
|
|
37
39
|
|
|
38
40
|
// State of an individual deck.
|
|
39
|
-
export const DeckState =
|
|
41
|
+
export const DeckState = Schema.Struct({
|
|
40
42
|
/** If false, the deck has not yet left solo mode and new planks should be soloed. */
|
|
41
|
-
initialized:
|
|
42
|
-
active:
|
|
43
|
+
initialized: Schema.Boolean,
|
|
44
|
+
active: Schema.mutable(Schema.Array(Schema.String)),
|
|
43
45
|
// TODO(wittjosiah): Piping into both mutable and optional caused invalid typescript output.
|
|
44
|
-
activeCompanions:
|
|
45
|
-
inactive:
|
|
46
|
-
solo:
|
|
47
|
-
fullscreen:
|
|
48
|
-
plankSizing:
|
|
49
|
-
companionFrameSizing:
|
|
46
|
+
activeCompanions: Schema.optional(Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.String }))),
|
|
47
|
+
inactive: Schema.mutable(Schema.Array(Schema.String)),
|
|
48
|
+
solo: Schema.optional(Schema.String),
|
|
49
|
+
fullscreen: Schema.Boolean,
|
|
50
|
+
plankSizing: Schema.mutable(PlankSizing),
|
|
51
|
+
companionFrameSizing: Schema.mutable(PlankSizing),
|
|
50
52
|
});
|
|
51
|
-
export type DeckState =
|
|
53
|
+
export type DeckState = Schema.Schema.Type<typeof DeckState>;
|
|
52
54
|
|
|
53
55
|
export const defaultDeck: DeckState = {
|
|
54
56
|
initialized: false,
|
|
@@ -61,84 +63,88 @@ export const defaultDeck: DeckState = {
|
|
|
61
63
|
companionFrameSizing: {},
|
|
62
64
|
};
|
|
63
65
|
|
|
64
|
-
const LayoutMode =
|
|
65
|
-
export type LayoutMode =
|
|
66
|
-
export const isLayoutMode = (value: any): value is LayoutMode =>
|
|
66
|
+
const LayoutMode = Schema.Literal('deck', 'solo', 'solo--fullscreen');
|
|
67
|
+
export type LayoutMode = Schema.Schema.Type<typeof LayoutMode>;
|
|
68
|
+
export const isLayoutMode = (value: any): value is LayoutMode => Schema.is(LayoutMode)(value);
|
|
67
69
|
|
|
68
|
-
export const getMode = (deck: DeckState): LayoutMode => {
|
|
70
|
+
export const getMode = (deck: DeckState | DeepReadonly<DeckState>): LayoutMode => {
|
|
69
71
|
if (deck.solo) {
|
|
70
|
-
return deck.fullscreen ? 'fullscreen' : 'solo';
|
|
72
|
+
return deck.fullscreen ? 'solo--fullscreen' : 'solo';
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
return 'deck';
|
|
74
76
|
};
|
|
75
77
|
|
|
76
78
|
// State of the deck plugin.
|
|
77
|
-
export const DeckPluginState =
|
|
78
|
-
sidebarState:
|
|
79
|
-
complementarySidebarState:
|
|
80
|
-
complementarySidebarPanel:
|
|
81
|
-
|
|
82
|
-
dialogOpen:
|
|
79
|
+
export const DeckPluginState = Schema.Struct({
|
|
80
|
+
sidebarState: Schema.Literal('closed', 'collapsed', 'expanded'),
|
|
81
|
+
complementarySidebarState: Schema.Literal('closed', 'collapsed', 'expanded'),
|
|
82
|
+
complementarySidebarPanel: Schema.optional(Schema.String),
|
|
83
|
+
|
|
84
|
+
dialogOpen: Schema.Boolean,
|
|
85
|
+
dialogType: Schema.optional(Schema.Literal('default', 'alert')),
|
|
86
|
+
dialogBlockAlign: Schema.optional(Schema.Literal('start', 'center', 'end')),
|
|
87
|
+
dialogOverlayClasses: Schema.optional(Schema.String),
|
|
88
|
+
dialogOverlayStyle: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),
|
|
83
89
|
/** Data to be passed to the dialog Surface. */
|
|
84
|
-
dialogContent:
|
|
85
|
-
dialogBlockAlign: S.optional(S.Literal('start', 'center', 'end')),
|
|
86
|
-
dialogType: S.optional(S.Literal('default', 'alert')),
|
|
90
|
+
dialogContent: Schema.optional(Schema.Any),
|
|
87
91
|
|
|
88
|
-
popoverOpen:
|
|
89
|
-
popoverSide:
|
|
92
|
+
popoverOpen: Schema.Boolean,
|
|
93
|
+
popoverSide: Schema.optional(Schema.Literal('top', 'right', 'bottom', 'left')),
|
|
94
|
+
popoverAnchor: Schema.optional(Schema.Any),
|
|
95
|
+
popoverAnchorId: Schema.optional(Schema.String),
|
|
90
96
|
/** Data to be passed to the popover Surface. */
|
|
91
|
-
popoverContent:
|
|
92
|
-
popoverAnchorId: S.optional(S.String),
|
|
97
|
+
popoverContent: Schema.optional(Schema.Any),
|
|
93
98
|
|
|
94
|
-
toasts:
|
|
95
|
-
currentUndoId:
|
|
99
|
+
toasts: Schema.mutable(Schema.Array(LayoutAction.Toast)),
|
|
100
|
+
currentUndoId: Schema.optional(Schema.String),
|
|
96
101
|
|
|
97
|
-
activeDeck:
|
|
98
|
-
previousDeck:
|
|
99
|
-
decks:
|
|
100
|
-
previousMode:
|
|
101
|
-
deck:
|
|
102
|
+
activeDeck: Schema.String,
|
|
103
|
+
previousDeck: Schema.String,
|
|
104
|
+
decks: Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.mutable(DeckState) })),
|
|
105
|
+
previousMode: Schema.mutable(Schema.Record({ key: Schema.String, value: LayoutMode })),
|
|
106
|
+
deck: Schema.mutable(DeckState),
|
|
102
107
|
|
|
103
108
|
/** The identifier of a component to scroll into view when it is mounted. */
|
|
104
|
-
scrollIntoView:
|
|
105
|
-
}).pipe(
|
|
109
|
+
scrollIntoView: Schema.optional(Schema.String),
|
|
110
|
+
}).pipe(Schema.mutable);
|
|
106
111
|
|
|
107
|
-
export type DeckPluginState =
|
|
112
|
+
export type DeckPluginState = Schema.Schema.Type<typeof DeckPluginState>;
|
|
108
113
|
|
|
109
114
|
export const DECK_ACTION = `${DECK_PLUGIN}/action`;
|
|
110
115
|
|
|
111
116
|
export namespace DeckAction {
|
|
112
|
-
const PartAdjustmentSchema =
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
const PartAdjustmentSchema = Schema.Union(
|
|
118
|
+
Schema.Literal('close').annotations({ description: 'Close the plank.' }),
|
|
119
|
+
Schema.Literal('companion').annotations({ description: 'Open the companion plank.' }),
|
|
120
|
+
Schema.Literal('solo').annotations({ description: 'Solo the plank.' }),
|
|
121
|
+
Schema.Literal('solo--fullscreen').annotations({ description: 'Fullscreen the plank.' }),
|
|
122
|
+
Schema.Literal('increment-start').annotations({ description: 'Move the plank towards the start of the deck.' }),
|
|
123
|
+
Schema.Literal('increment-end').annotations({ description: 'Move the plank towards the end of the deck.' }),
|
|
118
124
|
);
|
|
119
|
-
export type PartAdjustment =
|
|
120
|
-
export const Adjustment =
|
|
121
|
-
export type Adjustment =
|
|
125
|
+
export type PartAdjustment = Schema.Schema.Type<typeof PartAdjustmentSchema>;
|
|
126
|
+
export const Adjustment = Schema.mutable(Schema.Struct({ id: Schema.String, type: PartAdjustmentSchema }));
|
|
127
|
+
export type Adjustment = Schema.Schema.Type<typeof Adjustment>;
|
|
122
128
|
|
|
123
129
|
// An atomic transaction to apply to the deck, describing which element to move to which location.
|
|
124
|
-
export class Adjust extends
|
|
130
|
+
export class Adjust extends Schema.TaggedClass<Adjust>()(`${DECK_ACTION}/adjust`, {
|
|
125
131
|
input: Adjustment,
|
|
126
|
-
output:
|
|
132
|
+
output: Schema.Void,
|
|
127
133
|
}) {}
|
|
128
134
|
|
|
129
|
-
export class UpdatePlankSize extends
|
|
130
|
-
input:
|
|
131
|
-
id:
|
|
132
|
-
size:
|
|
135
|
+
export class UpdatePlankSize extends Schema.TaggedClass<UpdatePlankSize>()(`${DECK_ACTION}/update-plank-size`, {
|
|
136
|
+
input: Schema.Struct({
|
|
137
|
+
id: Schema.String,
|
|
138
|
+
size: Schema.Number,
|
|
133
139
|
}),
|
|
134
|
-
output:
|
|
140
|
+
output: Schema.Void,
|
|
135
141
|
}) {}
|
|
136
142
|
|
|
137
|
-
export class ChangeCompanion extends
|
|
138
|
-
input:
|
|
139
|
-
primary:
|
|
140
|
-
companion:
|
|
143
|
+
export class ChangeCompanion extends Schema.TaggedClass<ChangeCompanion>()(`${DECK_ACTION}/change-companion`, {
|
|
144
|
+
input: Schema.Struct({
|
|
145
|
+
primary: Schema.String,
|
|
146
|
+
companion: Schema.Union(Schema.String, Schema.Null),
|
|
141
147
|
}),
|
|
142
|
-
output:
|
|
148
|
+
output: Schema.Void,
|
|
143
149
|
}) {}
|
|
144
150
|
}
|
package/src/util/index.ts
CHANGED
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
export * from './layoutAppliesTopbar';
|
|
5
6
|
export * from './overscroll';
|
|
6
7
|
export * from './set-active';
|
|
7
|
-
export * from './useBreakpoints';
|
|
8
|
-
export * from './layoutAppliesTopbar';
|
|
9
|
-
export * from './useHoistStatusbar';
|
|
10
|
-
export * from './useCompanions';
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { type LayoutMode } from '../types';
|
|
6
|
+
|
|
7
|
+
export const layoutAppliesTopbar = (breakpoint: string, layoutMode?: LayoutMode) => {
|
|
8
|
+
return (
|
|
9
|
+
document.body.getAttribute('data-platform') === 'win' &&
|
|
10
|
+
breakpoint === 'desktop' &&
|
|
11
|
+
layoutMode !== 'solo--fullscreen'
|
|
12
|
+
);
|
|
7
13
|
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/app-graph-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes, createIntent, LayoutAction, type PluginsContext } from '@dxos/app-framework';\nimport { AttentionCapabilities } from '@dxos/plugin-attention';\nimport { createExtension, type Node, ROOT_ID } from '@dxos/plugin-graph';\n\nimport { DeckCapabilities } from './capabilities';\nimport { DECK_PLUGIN } from '../meta';\n\nexport default (context: PluginsContext) =>\n contributes(\n Capabilities.AppGraphBuilder,\n createExtension({\n id: DECK_PLUGIN,\n filter: (node): node is Node<null> => node.id === ROOT_ID,\n actions: () => {\n const state = context.requestCapability(DeckCapabilities.MutableDeckState);\n\n // NOTE(Zan): This is currently disabled.\n // TODO(Zan): Fullscreen needs to know the active node and provide that to the layout part.\n const _fullscreen = {\n id: `${LayoutAction.UpdateLayout._tag}/fullscreen`,\n data: async () => {\n const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n await dispatch(createIntent(LayoutAction.SetLayoutMode, { part: 'mode', options: { mode: 'fullscreen' } }));\n },\n properties: {\n label: ['toggle fullscreen label', { ns: DECK_PLUGIN }],\n icon: 'ph--arrows-out--regular',\n keyBinding: {\n macos: 'ctrl+meta+f',\n windows: 'shift+ctrl+f',\n },\n },\n };\n\n const closeCurrent = {\n id: `${LayoutAction.Close._tag}/current`,\n data: async () => {\n const attention = context.requestCapability(AttentionCapabilities.Attention);\n const attended = attention.current.at(-1);\n if (attended) {\n const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n await dispatch(\n createIntent(LayoutAction.Close, { part: 'main', subject: [attended], options: { state: false } }),\n );\n }\n },\n properties: {\n label: ['close current label', { ns: DECK_PLUGIN }],\n icon: 'ph--x--regular',\n },\n };\n\n const closeOthers = {\n id: `${LayoutAction.Close._tag}/others`,\n data: async () => {\n const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n const attention = context.requestCapability(AttentionCapabilities.Attention);\n const attended = attention.current.at(-1);\n const ids = state.deck.active.filter((id) => id !== attended) ?? [];\n await dispatch(createIntent(LayoutAction.Close, { part: 'main', subject: ids, options: { state: false } }));\n },\n properties: {\n label: ['close others label', { ns: DECK_PLUGIN }],\n icon: 'ph--x-square--regular',\n },\n };\n\n const closeAll = {\n id: `${LayoutAction.Close._tag}/all`,\n data: async () => {\n const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n await dispatch(\n createIntent(LayoutAction.Close, {\n part: 'main',\n subject: state.deck.active,\n options: { state: false },\n }),\n );\n },\n properties: {\n label: ['close all label', { ns: DECK_PLUGIN }],\n icon: 'ph--x-circle--regular',\n },\n };\n\n const toggleSidebar = {\n id: `${LayoutAction.UpdateSidebar._tag}/nav`,\n data: async () => {\n state.sidebarState = state.sidebarState === 'expanded' ? 'collapsed' : 'expanded';\n },\n properties: {\n label: [\n state.sidebarState === 'expanded' ? 'collapse navigation sidebar label' : 'open navigation sidebar label',\n { ns: DECK_PLUGIN },\n ],\n icon: 'ph--sidebar--regular',\n keyBinding: {\n macos: 'meta+b',\n },\n disposition: 'pin-end',\n position: 'hoist',\n l0Breakpoint: 'lg',\n },\n };\n\n return !state.deck.solo ? [closeCurrent, closeOthers, closeAll, toggleSidebar] : [toggleSidebar];\n },\n }),\n );\n"],
|
|
5
|
-
"mappings": ";;;;;;;;AAIA,SAASA,cAAcC,aAAaC,cAAcC,oBAAyC;AAC3F,SAASC,6BAA6B;AACtC,SAASC,iBAA4BC,eAAe;AAKpD,IAAA,4BAAe,CAACC,YACdC,YACEC,aAAaC,iBACbC,gBAAgB;EACdC,IAAIC;EACJC,QAAQ,CAACC,SAA6BA,KAAKH,OAAOI;EAClDC,SAAS,MAAA;AACP,UAAMC,QAAQX,QAAQY,kBAAkBC,iBAAiBC,gBAAgB;AAIzE,UAAMC,cAAc;MAClBV,IAAI,GAAGW,aAAaC,aAAaC,IAAI;MACrCC,MAAM,YAAA;AACJ,cAAM,EAAEC,iBAAiBC,SAAQ,IAAKrB,QAAQY,kBAAkBV,aAAaoB,gBAAgB;AAC7F,cAAMD,SAASE,aAAaP,aAAaQ,eAAe;UAAEC,MAAM;UAAQC,SAAS;YAAEC,MAAM;UAAa;QAAE,CAAA,CAAA;MAC1G;MACAC,YAAY;QACVC,OAAO;UAAC;UAA2B;YAAEC,IAAIxB;UAAY;;QACrDyB,MAAM;QACNC,YAAY;UACVC,OAAO;UACPC,SAAS;QACX;MACF;IACF;AAEA,UAAMC,eAAe;MACnB9B,IAAI,GAAGW,aAAaoB,MAAMlB,IAAI;MAC9BC,MAAM,YAAA;AACJ,cAAMkB,YAAYrC,QAAQY,kBAAkB0B,sBAAsBC,SAAS;AAC3E,cAAMC,WAAWH,UAAUI,QAAQC,GAAG,EAAC;AACvC,YAAIF,UAAU;AACZ,gBAAM,EAAEpB,iBAAiBC,SAAQ,IAAKrB,QAAQY,kBAAkBV,aAAaoB,gBAAgB;AAC7F,gBAAMD,SACJE,aAAaP,aAAaoB,OAAO;YAAEX,MAAM;YAAQkB,SAAS;cAACH;;YAAWd,SAAS;cAAEf,OAAO;YAAM;UAAE,CAAA,CAAA;QAEpG;MACF;MACAiB,YAAY;QACVC,OAAO;UAAC;UAAuB;YAAEC,IAAIxB;UAAY;;QACjDyB,MAAM;MACR;IACF;AAEA,UAAMa,cAAc;MAClBvC,IAAI,GAAGW,aAAaoB,MAAMlB,IAAI;MAC9BC,MAAM,YAAA;AACJ,cAAM,EAAEC,iBAAiBC,SAAQ,IAAKrB,QAAQY,kBAAkBV,aAAaoB,gBAAgB;AAC7F,cAAMe,YAAYrC,QAAQY,kBAAkB0B,sBAAsBC,SAAS;AAC3E,cAAMC,WAAWH,UAAUI,QAAQC,GAAG,EAAC;AACvC,cAAMG,MAAMlC,MAAMmC,KAAKC,OAAOxC,OAAO,CAACF,OAAOA,OAAOmC,QAAAA,KAAa,CAAA;AACjE,cAAMnB,SAASE,aAAaP,aAAaoB,OAAO;UAAEX,MAAM;UAAQkB,SAASE;UAAKnB,SAAS;YAAEf,OAAO;UAAM;QAAE,CAAA,CAAA;MAC1G;MACAiB,YAAY;QACVC,OAAO;UAAC;UAAsB;YAAEC,IAAIxB;UAAY;;QAChDyB,MAAM;MACR;IACF;AAEA,UAAMiB,WAAW;MACf3C,IAAI,GAAGW,aAAaoB,MAAMlB,IAAI;MAC9BC,MAAM,YAAA;AACJ,cAAM,EAAEC,iBAAiBC,SAAQ,IAAKrB,QAAQY,kBAAkBV,aAAaoB,gBAAgB;AAC7F,cAAMD,SACJE,aAAaP,aAAaoB,OAAO;UAC/BX,MAAM;UACNkB,SAAShC,MAAMmC,KAAKC;UACpBrB,SAAS;YAAEf,OAAO;UAAM;QAC1B,CAAA,CAAA;MAEJ;MACAiB,YAAY;QACVC,OAAO;UAAC;UAAmB;YAAEC,IAAIxB;UAAY;;QAC7CyB,MAAM;MACR;IACF;AAEA,UAAMkB,gBAAgB;MACpB5C,IAAI,GAAGW,aAAakC,cAAchC,IAAI;MACtCC,MAAM,YAAA;AACJR,cAAMwC,eAAexC,MAAMwC,iBAAiB,aAAa,cAAc;MACzE;MACAvB,YAAY;QACVC,OAAO;UACLlB,MAAMwC,iBAAiB,aAAa,sCAAsC;UAC1E;YAAErB,IAAIxB;UAAY;;QAEpByB,MAAM;QACNC,YAAY;UACVC,OAAO;QACT;QACAmB,aAAa;QACbC,UAAU;QACVC,cAAc;MAChB;IACF;AAEA,WAAO,CAAC3C,MAAMmC,KAAKS,OAAO;MAACpB;MAAcS;MAAaI;MAAUC;QAAiB;MAACA;;EACpF;AACF,CAAA,CAAA;",
|
|
6
|
-
"names": ["Capabilities", "contributes", "createIntent", "LayoutAction", "AttentionCapabilities", "createExtension", "ROOT_ID", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "DECK_PLUGIN", "filter", "node", "ROOT_ID", "actions", "state", "requestCapability", "DeckCapabilities", "MutableDeckState", "_fullscreen", "LayoutAction", "UpdateLayout", "_tag", "data", "dispatchPromise", "dispatch", "IntentDispatcher", "createIntent", "SetLayoutMode", "part", "options", "mode", "properties", "label", "ns", "icon", "keyBinding", "macos", "windows", "closeCurrent", "Close", "attention", "AttentionCapabilities", "Attention", "attended", "current", "at", "subject", "closeOthers", "ids", "deck", "active", "closeAll", "toggleSidebar", "UpdateSidebar", "sidebarState", "disposition", "position", "l0Breakpoint", "solo"]
|
|
7
|
-
}
|