@dxos/plugin-deck 0.8.2-main.f081794 → 0.8.2-main.fbd8ed0
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-R7COZ4A6.mjs} +16 -15
- package/dist/lib/browser/app-graph-builder-R7COZ4A6.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/chunk-3O2UZVBA.mjs +121 -0
- package/dist/lib/browser/chunk-3O2UZVBA.mjs.map +7 -0
- package/dist/lib/browser/chunk-JAYQ5BTF.mjs +157 -0
- package/dist/lib/browser/chunk-JAYQ5BTF.mjs.map +7 -0
- package/dist/lib/browser/{chunk-VP6FCWFV.mjs → chunk-KIGMELV2.mjs} +257 -247
- package/dist/lib/browser/chunk-KIGMELV2.mjs.map +7 -0
- package/dist/lib/browser/{state-Z6UY2Z3M.mjs → chunk-OF5RIATN.mjs} +6 -4
- package/dist/lib/browser/chunk-OF5RIATN.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/index.mjs +4 -5
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/{intent-resolver-6AK45PT5.mjs → intent-resolver-MAKOS57L.mjs} +86 -63
- package/dist/lib/browser/intent-resolver-MAKOS57L.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-KA2IL5RA.mjs → react-root-DGQVIHXP.mjs} +6 -6
- package/dist/lib/browser/{react-surface-LIPGYEYN.mjs → react-surface-PXBXIOPU.mjs} +6 -6
- package/dist/lib/browser/{settings-6NU7CF2B.mjs → settings-UBWJF7J7.mjs} +4 -4
- package/dist/lib/browser/{settings-6NU7CF2B.mjs.map → settings-UBWJF7J7.mjs.map} +3 -3
- package/dist/lib/browser/state-4WFB4SDO.mjs +10 -0
- package/dist/lib/browser/state-4WFB4SDO.mjs.map +7 -0
- package/dist/lib/browser/{tools-VDVQTJMD.mjs → tools-IVPIPTVA.mjs} +7 -7
- package/dist/lib/browser/tools-IVPIPTVA.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/browser/{url-handler-3CARFXQK.mjs → url-handler-JSYGSVSB.mjs} +4 -4
- package/dist/lib/browser/url-handler-JSYGSVSB.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/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 +5 -180
- 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 +2 -2
- package/dist/types/src/capabilities/state.d.ts.map +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/Popover.d.ts.map +1 -1
- 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 +1 -0
- 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.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.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/types.d.ts +104 -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.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 +36 -29
- package/src/capabilities/app-graph-builder.ts +120 -92
- package/src/capabilities/check-app-scheme.ts +3 -7
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/intent-resolver.ts +140 -114
- package/src/capabilities/settings.ts +2 -2
- package/src/capabilities/state.ts +4 -2
- package/src/capabilities/tools.ts +4 -3
- package/src/capabilities/url-handler.ts +4 -4
- package/src/components/DeckLayout/ContentEmpty.tsx +3 -2
- package/src/components/DeckLayout/DeckLayout.tsx +12 -10
- package/src/components/DeckLayout/Popover.tsx +71 -43
- package/src/components/Plank/Plank.stories.tsx +20 -8
- package/src/components/Plank/Plank.tsx +101 -66
- package/src/components/Plank/PlankControls.tsx +26 -30
- package/src/components/Plank/PlankError.tsx +2 -6
- package/src/components/Plank/PlankHeading.tsx +23 -8
- package/src/components/Sidebar/ComplementarySidebar.tsx +4 -35
- package/src/components/Sidebar/Sidebar.tsx +2 -1
- package/src/components/Sidebar/SidebarButton.tsx +30 -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/hooks/useNodeActionExpander.ts +3 -8
- package/src/index.ts +1 -1
- package/src/types.ts +72 -71
- package/src/util/index.ts +1 -4
- 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-4QSEGMY3.mjs +0 -24
- package/dist/lib/browser/chunk-4QSEGMY3.mjs.map +0 -7
- package/dist/lib/browser/chunk-6HJZL3WT.mjs +0 -118
- package/dist/lib/browser/chunk-6HJZL3WT.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-VP6FCWFV.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZMJMCN7O.mjs +0 -157
- package/dist/lib/browser/chunk-ZMJMCN7O.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-6AK45PT5.mjs.map +0 -7
- package/dist/lib/browser/state-Z6UY2Z3M.mjs.map +0 -7
- package/dist/lib/browser/tools-VDVQTJMD.mjs.map +0 -7
- package/dist/lib/browser/url-handler-3CARFXQK.mjs.map +0 -7
- 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.map +0 -1
- /package/dist/lib/browser/{react-root-KA2IL5RA.mjs.map → react-root-DGQVIHXP.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-LIPGYEYN.mjs.map → react-surface-PXBXIOPU.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/dist/types/src/{util → hooks}/useHoistStatusbar.d.ts +0 -0
- /package/src/{util → hooks}/useBreakpoints.ts +0 -0
- /package/src/{util → hooks}/useHoistStatusbar.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
|
};
|
|
@@ -8,9 +8,10 @@ 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
13
|
import { getMode } from '../../types';
|
|
13
|
-
import { layoutAppliesTopbar
|
|
14
|
+
import { layoutAppliesTopbar } from '../../util';
|
|
14
15
|
|
|
15
16
|
const label = ['sidebar title', { ns: DECK_PLUGIN }] satisfies Label;
|
|
16
17
|
|
|
@@ -2,12 +2,14 @@
|
|
|
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 } from '../../hooks';
|
|
12
|
+
import { getCompanionId } from '../../hooks/useDeckCompanions';
|
|
11
13
|
import { DECK_PLUGIN } from '../../meta';
|
|
12
14
|
|
|
13
15
|
export const ToggleSidebarButton = ({
|
|
@@ -47,16 +49,37 @@ export const CloseSidebarButton = () => {
|
|
|
47
49
|
);
|
|
48
50
|
};
|
|
49
51
|
|
|
50
|
-
export const ToggleComplementarySidebarButton = ({
|
|
52
|
+
export const ToggleComplementarySidebarButton = ({
|
|
53
|
+
inR0,
|
|
54
|
+
classNames,
|
|
55
|
+
current,
|
|
56
|
+
}: ThemedClassName<{ inR0?: boolean; current?: string }>) => {
|
|
57
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
51
58
|
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
52
59
|
const { t } = useTranslation(DECK_PLUGIN);
|
|
60
|
+
|
|
61
|
+
const companions = useDeckCompanions();
|
|
62
|
+
const handleClick = useCallback(async () => {
|
|
63
|
+
layoutContext.complementarySidebarState =
|
|
64
|
+
layoutContext.complementarySidebarState === 'expanded' ? 'collapsed' : 'expanded';
|
|
65
|
+
const firstCompanion = companions[0];
|
|
66
|
+
if (layoutContext.complementarySidebarState === 'expanded' && !current && firstCompanion) {
|
|
67
|
+
await dispatch(
|
|
68
|
+
createIntent(LayoutAction.UpdateComplementary, {
|
|
69
|
+
part: 'complementary',
|
|
70
|
+
subject: getCompanionId(firstCompanion.id),
|
|
71
|
+
}),
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
}, [layoutContext, current, companions, dispatch]);
|
|
75
|
+
|
|
76
|
+
// TODO(thure): This should have a tooltip but is suppressed because focus is getting set on this twice when the app
|
|
77
|
+
// first mounts, causing even `suppressNextTooltip` not to have the intended effect.
|
|
53
78
|
return (
|
|
54
79
|
<IconButton
|
|
80
|
+
noTooltip
|
|
55
81
|
iconOnly
|
|
56
|
-
onClick={
|
|
57
|
-
(layoutContext.complementarySidebarState =
|
|
58
|
-
layoutContext.complementarySidebarState === 'expanded' ? 'collapsed' : 'expanded')
|
|
59
|
-
}
|
|
82
|
+
onClick={handleClick}
|
|
60
83
|
variant='ghost'
|
|
61
84
|
label={t('open complementary sidebar label')}
|
|
62
85
|
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
|
+
};
|
|
@@ -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
|
+
graph.expand(node.id);
|
|
20
15
|
});
|
|
21
16
|
return () => cancelAnimationFrame(frame);
|
|
22
17
|
}
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
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 { S } from '@dxos/echo-schema';
|
|
7
8
|
import { type DeepReadonly } from '@dxos/util';
|
|
8
9
|
|
|
9
10
|
import { DECK_PLUGIN } from './meta';
|
|
@@ -23,33 +24,33 @@ export type Overscroll = (typeof OverscrollOptions)[number];
|
|
|
23
24
|
export type Part = 'solo' | 'deck' | 'complementary';
|
|
24
25
|
export type ResolvedPart = Part | 'solo-primary' | 'solo-companion';
|
|
25
26
|
|
|
26
|
-
export const DeckSettingsSchema =
|
|
27
|
-
showHints:
|
|
28
|
-
enableDeck:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
newPlankPositioning:
|
|
32
|
-
overscroll:
|
|
33
|
-
}).pipe(
|
|
34
|
-
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>;
|
|
35
36
|
|
|
36
|
-
export const PlankSizing =
|
|
37
|
-
export type PlankSizing =
|
|
37
|
+
export const PlankSizing = Schema.Record({ key: Schema.String, value: Schema.Number });
|
|
38
|
+
export type PlankSizing = Schema.Schema.Type<typeof PlankSizing>;
|
|
38
39
|
|
|
39
40
|
// State of an individual deck.
|
|
40
|
-
export const DeckState =
|
|
41
|
+
export const DeckState = Schema.Struct({
|
|
41
42
|
/** If false, the deck has not yet left solo mode and new planks should be soloed. */
|
|
42
|
-
initialized:
|
|
43
|
-
active:
|
|
43
|
+
initialized: Schema.Boolean,
|
|
44
|
+
active: Schema.mutable(Schema.Array(Schema.String)),
|
|
44
45
|
// TODO(wittjosiah): Piping into both mutable and optional caused invalid typescript output.
|
|
45
|
-
activeCompanions:
|
|
46
|
-
inactive:
|
|
47
|
-
solo:
|
|
48
|
-
fullscreen:
|
|
49
|
-
plankSizing:
|
|
50
|
-
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),
|
|
51
52
|
});
|
|
52
|
-
export type DeckState =
|
|
53
|
+
export type DeckState = Schema.Schema.Type<typeof DeckState>;
|
|
53
54
|
|
|
54
55
|
export const defaultDeck: DeckState = {
|
|
55
56
|
initialized: false,
|
|
@@ -62,9 +63,9 @@ export const defaultDeck: DeckState = {
|
|
|
62
63
|
companionFrameSizing: {},
|
|
63
64
|
};
|
|
64
65
|
|
|
65
|
-
const LayoutMode =
|
|
66
|
-
export type LayoutMode =
|
|
67
|
-
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);
|
|
68
69
|
|
|
69
70
|
export const getMode = (deck: DeckState | DeepReadonly<DeckState>): LayoutMode => {
|
|
70
71
|
if (deck.solo) {
|
|
@@ -75,73 +76,73 @@ export const getMode = (deck: DeckState | DeepReadonly<DeckState>): LayoutMode =
|
|
|
75
76
|
};
|
|
76
77
|
|
|
77
78
|
// State of the deck plugin.
|
|
78
|
-
export const DeckPluginState =
|
|
79
|
-
sidebarState:
|
|
80
|
-
complementarySidebarState:
|
|
81
|
-
complementarySidebarPanel:
|
|
82
|
-
|
|
83
|
-
dialogOpen:
|
|
84
|
-
dialogBlockAlign:
|
|
85
|
-
dialogType:
|
|
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
|
+
dialogBlockAlign: Schema.optional(Schema.Literal('start', 'center', 'end')),
|
|
86
|
+
dialogType: Schema.optional(Schema.Literal('default', 'alert')),
|
|
86
87
|
/** Data to be passed to the dialog Surface. */
|
|
87
|
-
dialogContent:
|
|
88
|
+
dialogContent: Schema.optional(Schema.Any),
|
|
88
89
|
|
|
89
|
-
popoverOpen:
|
|
90
|
-
popoverSide:
|
|
91
|
-
popoverAnchor:
|
|
92
|
-
popoverAnchorId:
|
|
90
|
+
popoverOpen: Schema.Boolean,
|
|
91
|
+
popoverSide: Schema.optional(Schema.Literal('top', 'right', 'bottom', 'left')),
|
|
92
|
+
popoverAnchor: Schema.optional(Schema.Any),
|
|
93
|
+
popoverAnchorId: Schema.optional(Schema.String),
|
|
93
94
|
/** Data to be passed to the popover Surface. */
|
|
94
|
-
popoverContent:
|
|
95
|
+
popoverContent: Schema.optional(Schema.Any),
|
|
95
96
|
|
|
96
|
-
toasts:
|
|
97
|
-
currentUndoId:
|
|
97
|
+
toasts: Schema.mutable(Schema.Array(LayoutAction.Toast)),
|
|
98
|
+
currentUndoId: Schema.optional(Schema.String),
|
|
98
99
|
|
|
99
|
-
activeDeck:
|
|
100
|
-
previousDeck:
|
|
101
|
-
decks:
|
|
102
|
-
previousMode:
|
|
103
|
-
deck:
|
|
100
|
+
activeDeck: Schema.String,
|
|
101
|
+
previousDeck: Schema.String,
|
|
102
|
+
decks: Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.mutable(DeckState) })),
|
|
103
|
+
previousMode: Schema.mutable(Schema.Record({ key: Schema.String, value: LayoutMode })),
|
|
104
|
+
deck: Schema.mutable(DeckState),
|
|
104
105
|
|
|
105
106
|
/** The identifier of a component to scroll into view when it is mounted. */
|
|
106
|
-
scrollIntoView:
|
|
107
|
-
}).pipe(
|
|
107
|
+
scrollIntoView: Schema.optional(Schema.String),
|
|
108
|
+
}).pipe(Schema.mutable);
|
|
108
109
|
|
|
109
|
-
export type DeckPluginState =
|
|
110
|
+
export type DeckPluginState = Schema.Schema.Type<typeof DeckPluginState>;
|
|
110
111
|
|
|
111
112
|
export const DECK_ACTION = `${DECK_PLUGIN}/action`;
|
|
112
113
|
|
|
113
114
|
export namespace DeckAction {
|
|
114
|
-
const PartAdjustmentSchema =
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
115
|
+
const PartAdjustmentSchema = Schema.Union(
|
|
116
|
+
Schema.Literal('close').annotations({ description: 'Close the plank.' }),
|
|
117
|
+
Schema.Literal('companion').annotations({ description: 'Open the companion plank.' }),
|
|
118
|
+
Schema.Literal('solo').annotations({ description: 'Solo the plank.' }),
|
|
119
|
+
Schema.Literal('solo--fullscreen').annotations({ description: 'Fullscreen the plank.' }),
|
|
120
|
+
Schema.Literal('increment-start').annotations({ description: 'Move the plank towards the start of the deck.' }),
|
|
121
|
+
Schema.Literal('increment-end').annotations({ description: 'Move the plank towards the end of the deck.' }),
|
|
121
122
|
);
|
|
122
|
-
export type PartAdjustment =
|
|
123
|
-
export const Adjustment =
|
|
124
|
-
export type Adjustment =
|
|
123
|
+
export type PartAdjustment = Schema.Schema.Type<typeof PartAdjustmentSchema>;
|
|
124
|
+
export const Adjustment = Schema.mutable(Schema.Struct({ id: Schema.String, type: PartAdjustmentSchema }));
|
|
125
|
+
export type Adjustment = Schema.Schema.Type<typeof Adjustment>;
|
|
125
126
|
|
|
126
127
|
// An atomic transaction to apply to the deck, describing which element to move to which location.
|
|
127
|
-
export class Adjust extends
|
|
128
|
+
export class Adjust extends Schema.TaggedClass<Adjust>()(`${DECK_ACTION}/adjust`, {
|
|
128
129
|
input: Adjustment,
|
|
129
|
-
output:
|
|
130
|
+
output: Schema.Void,
|
|
130
131
|
}) {}
|
|
131
132
|
|
|
132
|
-
export class UpdatePlankSize extends
|
|
133
|
-
input:
|
|
134
|
-
id:
|
|
135
|
-
size:
|
|
133
|
+
export class UpdatePlankSize extends Schema.TaggedClass<UpdatePlankSize>()(`${DECK_ACTION}/update-plank-size`, {
|
|
134
|
+
input: Schema.Struct({
|
|
135
|
+
id: Schema.String,
|
|
136
|
+
size: Schema.Number,
|
|
136
137
|
}),
|
|
137
|
-
output:
|
|
138
|
+
output: Schema.Void,
|
|
138
139
|
}) {}
|
|
139
140
|
|
|
140
|
-
export class ChangeCompanion extends
|
|
141
|
-
input:
|
|
142
|
-
primary:
|
|
143
|
-
companion:
|
|
141
|
+
export class ChangeCompanion extends Schema.TaggedClass<ChangeCompanion>()(`${DECK_ACTION}/change-companion`, {
|
|
142
|
+
input: Schema.Struct({
|
|
143
|
+
primary: Schema.String,
|
|
144
|
+
companion: Schema.Union(Schema.String, Schema.Null),
|
|
144
145
|
}),
|
|
145
|
-
output:
|
|
146
|
+
output: Schema.Void,
|
|
146
147
|
}) {}
|
|
147
148
|
}
|
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';
|
|
@@ -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": "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",
|
|
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
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/check-app-scheme.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes, type PluginsContext } from '@dxos/app-framework';\n\nimport { DECK_PLUGIN } from '../meta';\nimport { type DeckSettingsProps } from '../types';\n\nconst isSocket = !!(globalThis as any).__args;\n\n// TODO(mjamesderocher): Can we get this directly from Socket?\nconst appScheme = 'composer://';\n\n// TODO(mjamesderocher): Factor out as part of NavigationPlugin.\nconst checkAppScheme = (url: string) => {\n const iframe = document.createElement('iframe');\n iframe.style.display = 'none';\n document.body.appendChild(iframe);\n\n iframe.src = url + window.location.pathname.replace(/^\\/+/, '') + window.location.search;\n\n const timer = setTimeout(() => {\n document.body.removeChild(iframe);\n }, 3000);\n\n window.addEventListener('pagehide', (event) => {\n clearTimeout(timer);\n document.body.removeChild(iframe);\n });\n};\n\nexport default async (context: PluginsContext) => {\n const settingsStore = context.requestCapability(Capabilities.SettingsStore);\n const settings = settingsStore.getStore<DeckSettingsProps>(DECK_PLUGIN)?.value;\n if (!isSocket && settings?.enableNativeRedirect) {\n checkAppScheme(appScheme);\n }\n\n return contributes(Capabilities.Null, null);\n};\n"],
|
|
5
|
-
"mappings": ";;;;;AAOA,SAASA,cAAcC,mBAAwC;AAK/D,IAAMC,WAAW,CAAC,CAAEC,WAAmBC;AAGvC,IAAMC,YAAY;AAGlB,IAAMC,iBAAiB,CAACC,QAAAA;AACtB,QAAMC,SAASC,SAASC,cAAc,QAAA;AACtCF,SAAOG,MAAMC,UAAU;AACvBH,WAASI,KAAKC,YAAYN,MAAAA;AAE1BA,SAAOO,MAAMR,MAAMS,OAAOC,SAASC,SAASC,QAAQ,QAAQ,EAAA,IAAMH,OAAOC,SAASG;AAElF,QAAMC,QAAQC,WAAW,MAAA;AACvBb,aAASI,KAAKU,YAAYf,MAAAA;EAC5B,GAAG,GAAA;AAEHQ,SAAOQ,iBAAiB,YAAY,CAACC,UAAAA;AACnCC,iBAAaL,KAAAA;AACbZ,aAASI,KAAKU,YAAYf,MAAAA;EAC5B,CAAA;AACF;AAEA,IAAA,2BAAe,OAAOmB,YAAAA;AACpB,QAAMC,gBAAgBD,QAAQE,kBAAkBC,aAAaC,aAAa;AAC1E,QAAMC,WAAWJ,cAAcK,SAA4BC,WAAAA,GAAcC;AACzE,MAAI,CAACjC,YAAY8B,UAAUI,sBAAsB;AAC/C9B,mBAAeD,SAAAA;EACjB;AAEA,SAAOgC,YAAYP,aAAaQ,MAAM,IAAA;AACxC;",
|
|
6
|
-
"names": ["Capabilities", "contributes", "isSocket", "globalThis", "__args", "appScheme", "checkAppScheme", "url", "iframe", "document", "createElement", "style", "display", "body", "appendChild", "src", "window", "location", "pathname", "replace", "search", "timer", "setTimeout", "removeChild", "addEventListener", "event", "clearTimeout", "context", "settingsStore", "requestCapability", "Capabilities", "SettingsStore", "settings", "getStore", "DECK_PLUGIN", "value", "enableNativeRedirect", "contributes", "Null"]
|
|
7
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// packages/plugins/plugin-deck/src/capabilities/index.ts
|
|
2
|
-
import { lazy } from "@dxos/app-framework";
|
|
3
|
-
var AppGraphBuilder = lazy(() => import("./app-graph-builder-VYZ4IWI3.mjs"));
|
|
4
|
-
var CheckAppScheme = lazy(() => import("./check-app-scheme-SEYECDHI.mjs"));
|
|
5
|
-
var DeckSettings = lazy(() => import("./settings-6NU7CF2B.mjs"));
|
|
6
|
-
var DeckState = lazy(() => import("./state-Z6UY2Z3M.mjs"));
|
|
7
|
-
var LayoutIntentResolver = lazy(() => import("./intent-resolver-6AK45PT5.mjs"));
|
|
8
|
-
var ReactRoot = lazy(() => import("./react-root-KA2IL5RA.mjs"));
|
|
9
|
-
var ReactSurface = lazy(() => import("./react-surface-LIPGYEYN.mjs"));
|
|
10
|
-
var Tools = lazy(() => import("./tools-VDVQTJMD.mjs"));
|
|
11
|
-
var UrlHandler = lazy(() => import("./url-handler-3CARFXQK.mjs"));
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
AppGraphBuilder,
|
|
15
|
-
CheckAppScheme,
|
|
16
|
-
DeckSettings,
|
|
17
|
-
DeckState,
|
|
18
|
-
LayoutIntentResolver,
|
|
19
|
-
ReactRoot,
|
|
20
|
-
ReactSurface,
|
|
21
|
-
Tools,
|
|
22
|
-
UrlHandler
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=chunk-4QSEGMY3.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const AppGraphBuilder = lazy(() => import('./app-graph-builder'));\nexport const CheckAppScheme = lazy(() => import('./check-app-scheme'));\nexport const DeckSettings = lazy(() => import('./settings'));\nexport const DeckState = lazy(() => import('./state'));\nexport const LayoutIntentResolver = lazy(() => import('./intent-resolver'));\nexport const ReactRoot = lazy(() => import('./react-root'));\nexport const ReactSurface = lazy(() => import('./react-surface'));\nexport const Tools = lazy(() => import('./tools'));\nexport const UrlHandler = lazy(() => import('./url-handler'));\n\nexport * from './capabilities';\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,YAAY;AAEd,IAAMC,kBAAkBC,KAAK,MAAM,OAAO,kCAAA,CAAA;AAC1C,IAAMC,iBAAiBD,KAAK,MAAM,OAAO,iCAAA,CAAA;AACzC,IAAME,eAAeF,KAAK,MAAM,OAAO,yBAAA,CAAA;AACvC,IAAMG,YAAYH,KAAK,MAAM,OAAO,sBAAA,CAAA;AACpC,IAAMI,uBAAuBJ,KAAK,MAAM,OAAO,gCAAA,CAAA;AAC/C,IAAMK,YAAYL,KAAK,MAAM,OAAO,2BAAA,CAAA;AACpC,IAAMM,eAAeN,KAAK,MAAM,OAAO,8BAAA,CAAA;AACvC,IAAMO,QAAQP,KAAK,MAAM,OAAO,sBAAA,CAAA;AAChC,IAAMQ,aAAaR,KAAK,MAAM,OAAO,4BAAA,CAAA;",
|
|
6
|
-
"names": ["lazy", "AppGraphBuilder", "lazy", "CheckAppScheme", "DeckSettings", "DeckState", "LayoutIntentResolver", "ReactRoot", "ReactSurface", "Tools", "UrlHandler"]
|
|
7
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PLANK_COMPANION_TYPE
|
|
3
|
-
} from "./chunk-ZMJMCN7O.mjs";
|
|
4
|
-
import {
|
|
5
|
-
DECK_PLUGIN
|
|
6
|
-
} from "./chunk-NSATFAEE.mjs";
|
|
7
|
-
|
|
8
|
-
// packages/plugins/plugin-deck/src/util/set-active.ts
|
|
9
|
-
import { batch } from "@preact/signals-core";
|
|
10
|
-
var setActive = ({ next, state, attention }) => {
|
|
11
|
-
return batch(() => {
|
|
12
|
-
const active = state.deck.solo ? [
|
|
13
|
-
state.deck.solo
|
|
14
|
-
] : state.deck.active;
|
|
15
|
-
const removed = active.filter((id) => !next.includes(id));
|
|
16
|
-
const closed = Array.from(/* @__PURE__ */ new Set([
|
|
17
|
-
...state.deck.inactive.filter((id) => !next.includes(id)),
|
|
18
|
-
...removed
|
|
19
|
-
]));
|
|
20
|
-
state.deck.inactive = closed;
|
|
21
|
-
if (state.deck.solo || !state.deck.initialized) {
|
|
22
|
-
state.deck.solo = next[0];
|
|
23
|
-
} else {
|
|
24
|
-
state.deck.active = next;
|
|
25
|
-
}
|
|
26
|
-
if (state.deck.fullscreen && !state.deck.solo) {
|
|
27
|
-
state.deck.fullscreen = false;
|
|
28
|
-
}
|
|
29
|
-
if (attention) {
|
|
30
|
-
const attended = attention.current;
|
|
31
|
-
const [attendedId] = Array.from(attended);
|
|
32
|
-
const isAttendedAvailable = !!attendedId && next.includes(attendedId);
|
|
33
|
-
if (!isAttendedAvailable) {
|
|
34
|
-
const attendedIndex = active.indexOf(attendedId);
|
|
35
|
-
const index = attendedIndex === -1 ? 0 : attendedIndex >= next.length ? next.length - 1 : attendedIndex;
|
|
36
|
-
return next[index];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
// packages/plugins/plugin-deck/src/util/useCompanions.ts
|
|
43
|
-
import { useMemo } from "react";
|
|
44
|
-
import { useAppGraph } from "@dxos/app-framework";
|
|
45
|
-
import { useNode } from "@dxos/plugin-graph";
|
|
46
|
-
import { byPosition } from "@dxos/util";
|
|
47
|
-
var useCompanions = (id) => {
|
|
48
|
-
const { graph } = useAppGraph();
|
|
49
|
-
const node = useNode(graph, id);
|
|
50
|
-
const companions = node ? graph.nodes(node, {
|
|
51
|
-
type: PLANK_COMPANION_TYPE
|
|
52
|
-
}) : [];
|
|
53
|
-
return useMemo(() => companions.toSorted((a, b) => byPosition(a.properties, b.properties)), [
|
|
54
|
-
companions
|
|
55
|
-
]);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
// packages/plugins/plugin-deck/src/util/overscroll.ts
|
|
59
|
-
var calculateOverscroll = (planksCount) => {
|
|
60
|
-
if (!planksCount) {
|
|
61
|
-
return {
|
|
62
|
-
paddingInlineStart: 0,
|
|
63
|
-
paddingInlineEnd: 0
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
if (planksCount === 1) {
|
|
67
|
-
const overscrollPadding = "max(0px, calc(((100dvw - var(--dx-main-sidebarWidth) - var(--dx-main-complementaryWidth) - (var(--dx-main-contentFirstWidth) + 1px)) / 2)))";
|
|
68
|
-
return {
|
|
69
|
-
paddingInlineStart: overscrollPadding,
|
|
70
|
-
paddingInlineEnd: overscrollPadding
|
|
71
|
-
};
|
|
72
|
-
} else {
|
|
73
|
-
return {
|
|
74
|
-
paddingInlineStart: "max(0px, calc(((100dvw - (var(--dx-main-contentFirstWidth) + 1px)) / 2) - var(--dx-main-sidebarWidth)))",
|
|
75
|
-
paddingInlineEnd: "max(0px, calc(((100dvw - (var(--dx-main-contentLastWidth) + 1px)) / 2) - var(--dx-main-complementaryWidth)))"
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
// packages/plugins/plugin-deck/src/util/useBreakpoints.ts
|
|
81
|
-
import { useMediaQuery } from "@dxos/react-ui";
|
|
82
|
-
var useBreakpoints = () => {
|
|
83
|
-
const [isNotMobile] = useMediaQuery("md");
|
|
84
|
-
const [isDesktop] = useMediaQuery("lg");
|
|
85
|
-
return isDesktop ? "desktop" : isNotMobile ? "tablet" : "mobile";
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
// packages/plugins/plugin-deck/src/util/layoutAppliesTopbar.ts
|
|
89
|
-
var layoutAppliesTopbar = (breakpoint, layoutMode) => {
|
|
90
|
-
return document.body.getAttribute("data-platform") === "win" && breakpoint === "desktop" && layoutMode !== "solo--fullscreen";
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
// packages/plugins/plugin-deck/src/util/useHoistStatusbar.ts
|
|
94
|
-
import { useMemo as useMemo2 } from "react";
|
|
95
|
-
import { Capabilities, useCapability } from "@dxos/app-framework";
|
|
96
|
-
import { useThemeContext } from "@dxos/react-ui";
|
|
97
|
-
var useHoistStatusbar = (breakpoint, layoutMode) => {
|
|
98
|
-
const enableStatusbar = useCapability(Capabilities.SettingsStore).getStore(DECK_PLUGIN).value.enableStatusbar;
|
|
99
|
-
const { safeAreaPadding } = useThemeContext();
|
|
100
|
-
return useMemo2(() => {
|
|
101
|
-
return breakpoint === "desktop" && layoutMode !== "solo--fullscreen" && !!enableStatusbar && safeAreaPadding?.bottom === 0;
|
|
102
|
-
}, [
|
|
103
|
-
enableStatusbar,
|
|
104
|
-
breakpoint,
|
|
105
|
-
safeAreaPadding?.bottom,
|
|
106
|
-
layoutMode
|
|
107
|
-
]);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export {
|
|
111
|
-
calculateOverscroll,
|
|
112
|
-
setActive,
|
|
113
|
-
useBreakpoints,
|
|
114
|
-
layoutAppliesTopbar,
|
|
115
|
-
useHoistStatusbar,
|
|
116
|
-
useCompanions
|
|
117
|
-
};
|
|
118
|
-
//# sourceMappingURL=chunk-6HJZL3WT.mjs.map
|