@dxos/plugin-deck 0.7.5-labs.e27f9b9 → 0.7.5-main.2567c87
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-CI6ZFMNL.mjs → app-graph-builder-67VRUD5K.mjs} +31 -57
- package/dist/lib/browser/app-graph-builder-67VRUD5K.mjs.map +7 -0
- package/dist/lib/browser/{check-app-scheme-S3EYUPMF.mjs → check-app-scheme-GEX6W2R5.mjs} +3 -3
- package/dist/lib/browser/{check-app-scheme-S3EYUPMF.mjs.map → check-app-scheme-GEX6W2R5.mjs.map} +2 -2
- package/dist/lib/browser/chunk-2M4PXYNB.mjs +1052 -0
- package/dist/lib/browser/chunk-2M4PXYNB.mjs.map +7 -0
- package/dist/lib/browser/chunk-2PJNBVCY.mjs +39 -0
- package/dist/lib/browser/chunk-2PJNBVCY.mjs.map +7 -0
- package/dist/lib/browser/chunk-4C2AFTET.mjs +186 -0
- package/dist/lib/browser/chunk-4C2AFTET.mjs.map +7 -0
- package/dist/lib/browser/{chunk-YQ2GWTDU.mjs → chunk-5VFDMW5M.mjs} +2 -2
- package/dist/lib/browser/chunk-5VFDMW5M.mjs.map +7 -0
- package/dist/lib/browser/{chunk-N7TEPFVR.mjs → chunk-JQJ5UWVB.mjs} +2 -3
- package/dist/lib/browser/{chunk-N7TEPFVR.mjs.map → chunk-JQJ5UWVB.mjs.map} +3 -3
- package/dist/lib/browser/chunk-KY5WXIXY.mjs +44 -0
- package/dist/lib/browser/chunk-KY5WXIXY.mjs.map +7 -0
- package/dist/lib/browser/deck-PLCSKPGL.mjs +26 -0
- package/dist/lib/browser/deck-PLCSKPGL.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +76 -36
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-FVOQSTBX.mjs +152 -0
- package/dist/lib/browser/intent-resolver-FVOQSTBX.mjs.map +7 -0
- package/dist/lib/browser/intent-resolver-K7GW4A2I.mjs +249 -0
- package/dist/lib/browser/intent-resolver-K7GW4A2I.mjs.map +7 -0
- package/dist/lib/browser/location-QHRBQBQN.mjs +35 -0
- package/dist/lib/browser/location-QHRBQBQN.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-3BDW7W2N.mjs +32 -0
- package/dist/lib/browser/react-context-3BDW7W2N.mjs.map +7 -0
- package/dist/lib/browser/{react-root-HIHLRMCW.mjs → react-root-UL7ZDRVZ.mjs} +14 -10
- package/dist/lib/browser/react-root-UL7ZDRVZ.mjs.map +7 -0
- package/dist/lib/browser/react-surface-VPNOGGNN.mjs +28 -0
- package/dist/lib/browser/react-surface-VPNOGGNN.mjs.map +7 -0
- package/dist/lib/browser/{settings-WACNLCPB.mjs → settings-FNWW6WIJ.mjs} +7 -6
- package/dist/lib/browser/settings-FNWW6WIJ.mjs.map +7 -0
- package/dist/lib/browser/state-7I5BD7SE.mjs +34 -0
- package/dist/lib/browser/state-7I5BD7SE.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +4 -16
- package/dist/lib/browser/url-handler-Z5B7LD3N.mjs +76 -0
- package/dist/lib/browser/url-handler-Z5B7LD3N.mjs.map +7 -0
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +3 -132
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +3 -188
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/{app-graph-builder.d.ts → layout/app-graph-builder.d.ts} +22 -22
- package/dist/types/src/capabilities/layout/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/deck.d.ts +4 -0
- package/dist/types/src/capabilities/layout/deck.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/index.d.ts +229 -0
- package/dist/types/src/capabilities/layout/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/react-context.d.ts +8 -0
- package/dist/types/src/capabilities/layout/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/state.d.ts +42 -0
- package/dist/types/src/capabilities/layout/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/check-app-scheme.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/index.d.ts +5 -0
- package/dist/types/src/capabilities/navigation/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/intent-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/navigation/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/location.d.ts +4 -0
- package/dist/types/src/capabilities/navigation/location.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/set-location.d.ts +10 -0
- package/dist/types/src/capabilities/navigation/set-location.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/url-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +3 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/components/DeckContext.d.ts +11 -0
- package/dist/types/src/components/DeckContext.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/ActiveNode.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.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 +4 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Fullscreen.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts +3 -3
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Plank.d.ts +6 -8
- package/dist/types/src/components/DeckLayout/Plank.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/PlankControls.d.ts +2 -2
- package/dist/types/src/components/DeckLayout/PlankControls.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/PlankError.d.ts +3 -4
- package/dist/types/src/components/DeckLayout/PlankError.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/SidebarButton.d.ts +3 -5
- package/dist/types/src/components/DeckLayout/SidebarButton.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 +2 -2
- package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
- package/dist/types/src/components/LayoutContext.d.ts +5 -0
- package/dist/types/src/components/LayoutContext.d.ts.map +1 -0
- package/dist/types/src/components/fragments.d.ts +0 -2
- package/dist/types/src/components/fragments.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useMainSize.d.ts +2 -2
- package/dist/types/src/layout.d.ts +19 -5
- package/dist/types/src/layout.d.ts.map +1 -1
- package/dist/types/src/layout.test.d.ts +2 -0
- package/dist/types/src/layout.test.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -3
- package/dist/types/src/types.d.ts +2 -107
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -2
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/layout-parts.d.ts +7 -0
- package/dist/types/src/util/layout-parts.d.ts.map +1 -0
- package/dist/types/src/util/useHoistStatusbar.d.ts.map +1 -1
- package/package.json +31 -32
- package/src/DeckPlugin.ts +57 -17
- package/src/capabilities/capabilities.ts +3 -4
- package/src/capabilities/index.ts +3 -12
- package/src/capabilities/{app-graph-builder.ts → layout/app-graph-builder.ts} +28 -36
- package/src/capabilities/layout/deck.ts +25 -0
- package/src/capabilities/layout/index.ts +12 -0
- package/src/capabilities/layout/intent-resolver.ts +128 -0
- package/src/capabilities/layout/react-context.tsx +26 -0
- package/src/capabilities/{react-root.tsx → layout/react-root.tsx} +11 -7
- package/src/capabilities/layout/state.ts +32 -0
- package/src/capabilities/{check-app-scheme.ts → navigation/check-app-scheme.ts} +2 -2
- package/src/capabilities/navigation/index.ts +10 -0
- package/src/capabilities/navigation/intent-resolver.ts +216 -0
- package/src/capabilities/navigation/location.ts +28 -0
- package/src/capabilities/navigation/set-location.ts +38 -0
- package/src/capabilities/navigation/url-handler.ts +67 -0
- package/src/capabilities/settings/index.ts +8 -0
- package/src/capabilities/settings/react-surface.tsx +23 -0
- package/src/capabilities/{settings.ts → settings/settings.ts} +5 -4
- package/src/components/DeckContext.ts +19 -0
- package/src/components/DeckLayout/ActiveNode.tsx +3 -2
- package/src/components/DeckLayout/ComplementarySidebar.tsx +69 -120
- package/src/components/DeckLayout/ContentEmpty.tsx +10 -7
- package/src/components/DeckLayout/DeckLayout.tsx +61 -103
- package/src/components/DeckLayout/Fullscreen.tsx +3 -2
- package/src/components/DeckLayout/NodePlankHeading.tsx +65 -57
- package/src/components/DeckLayout/Plank.tsx +41 -32
- package/src/components/DeckLayout/PlankControls.tsx +10 -11
- package/src/components/DeckLayout/PlankError.tsx +5 -6
- package/src/components/DeckLayout/Sidebar.tsx +20 -17
- package/src/components/DeckLayout/SidebarButton.tsx +31 -25
- package/src/components/DeckLayout/StatusBar.tsx +11 -5
- package/src/components/DeckLayout/Toast.tsx +2 -2
- package/src/components/LayoutContext.ts +12 -0
- package/src/components/LayoutSettings.tsx +8 -8
- package/src/components/fragments.ts +0 -8
- package/src/components/index.ts +2 -0
- package/src/hooks/useMainSize.ts +3 -3
- package/src/layout.test.ts +380 -0
- package/src/layout.ts +212 -43
- package/src/meta.ts +0 -1
- package/src/translations.ts +8 -8
- package/src/types.ts +2 -88
- package/src/util/index.ts +1 -2
- package/src/util/layout-parts.ts +12 -0
- package/src/util/useHoistStatusbar.ts +8 -17
- package/dist/lib/browser/app-graph-builder-CI6ZFMNL.mjs.map +0 -7
- package/dist/lib/browser/chunk-BTDY6SES.mjs +0 -1119
- package/dist/lib/browser/chunk-BTDY6SES.mjs.map +0 -7
- package/dist/lib/browser/chunk-FZOBKOA2.mjs +0 -24
- package/dist/lib/browser/chunk-FZOBKOA2.mjs.map +0 -7
- package/dist/lib/browser/chunk-M2L53AIH.mjs +0 -126
- package/dist/lib/browser/chunk-M2L53AIH.mjs.map +0 -7
- package/dist/lib/browser/chunk-YQ2GWTDU.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-CSXFDKTC.mjs +0 -494
- package/dist/lib/browser/intent-resolver-CSXFDKTC.mjs.map +0 -7
- package/dist/lib/browser/react-root-HIHLRMCW.mjs.map +0 -7
- package/dist/lib/browser/react-surface-4QVWKQYY.mjs +0 -38
- package/dist/lib/browser/react-surface-4QVWKQYY.mjs.map +0 -7
- package/dist/lib/browser/settings-WACNLCPB.mjs.map +0 -7
- package/dist/lib/browser/state-VPOYUKK6.mjs +0 -117
- package/dist/lib/browser/state-VPOYUKK6.mjs.map +0 -7
- package/dist/lib/browser/tools-5LDJNU56.mjs +0 -51
- package/dist/lib/browser/tools-5LDJNU56.mjs.map +0 -7
- package/dist/lib/browser/url-handler-HLF42IHP.mjs +0 -70
- package/dist/lib/browser/url-handler-HLF42IHP.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/check-app-scheme.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/set-active.d.ts +0 -9
- package/dist/types/src/capabilities/set-active.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state.d.ts +0 -76
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/tools.d.ts +0 -10
- package/dist/types/src/capabilities/tools.d.ts.map +0 -1
- package/dist/types/src/capabilities/url-handler.d.ts.map +0 -1
- package/dist/types/src/util/layoutAppliesTopbar.d.ts +0 -2
- package/dist/types/src/util/layoutAppliesTopbar.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -350
- package/src/capabilities/react-surface.tsx +0 -31
- package/src/capabilities/set-active.ts +0 -43
- package/src/capabilities/state.ts +0 -102
- package/src/capabilities/tools.ts +0 -61
- package/src/capabilities/url-handler.ts +0 -63
- package/src/util/layoutAppliesTopbar.ts +0 -7
- /package/dist/types/src/capabilities/{intent-resolver.d.ts → layout/intent-resolver.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-root.d.ts → layout/react-root.d.ts} +0 -0
- /package/dist/types/src/capabilities/{check-app-scheme.d.ts → navigation/check-app-scheme.d.ts} +0 -0
- /package/dist/types/src/capabilities/{url-handler.d.ts → navigation/url-handler.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface.d.ts → settings/react-surface.d.ts} +0 -0
- /package/dist/types/src/capabilities/{settings.d.ts → settings/settings.d.ts} +0 -0
|
@@ -2,23 +2,30 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { Fragment, memo,
|
|
5
|
+
import React, { Fragment, memo, useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import {
|
|
8
|
+
createIntent,
|
|
9
|
+
LayoutAction,
|
|
10
|
+
NavigationAction,
|
|
11
|
+
SLUG_PATH_SEPARATOR,
|
|
12
|
+
Surface,
|
|
13
|
+
useIntentDispatcher,
|
|
14
|
+
type LayoutCoordinate,
|
|
15
|
+
} from '@dxos/app-framework';
|
|
16
|
+
import { type Node, useGraph } from '@dxos/plugin-graph';
|
|
9
17
|
import { Icon, Popover, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
10
18
|
import { StackItem, type StackItemSigilAction } from '@dxos/react-ui-stack';
|
|
11
19
|
import { TextTooltip } from '@dxos/react-ui-text-tooltip';
|
|
12
20
|
|
|
13
21
|
import { PlankControls } from './PlankControls';
|
|
22
|
+
import { ToggleComplementarySidebarButton, ToggleSidebarButton } from './SidebarButton';
|
|
14
23
|
import { DECK_PLUGIN } from '../../meta';
|
|
15
|
-
import { DeckAction, SLUG_PATH_SEPARATOR } from '../../types';
|
|
16
24
|
import { useBreakpoints } from '../../util';
|
|
17
25
|
import { soloInlinePadding } from '../fragments';
|
|
18
26
|
|
|
19
27
|
export type NodePlankHeadingProps = {
|
|
20
|
-
|
|
21
|
-
part: 'solo' | 'deck' | 'complementary';
|
|
28
|
+
coordinate: LayoutCoordinate;
|
|
22
29
|
node?: Node;
|
|
23
30
|
canIncrementStart?: boolean;
|
|
24
31
|
canIncrementEnd?: boolean;
|
|
@@ -29,8 +36,7 @@ export type NodePlankHeadingProps = {
|
|
|
29
36
|
|
|
30
37
|
export const NodePlankHeading = memo(
|
|
31
38
|
({
|
|
32
|
-
|
|
33
|
-
part,
|
|
39
|
+
coordinate,
|
|
34
40
|
node,
|
|
35
41
|
canIncrementStart,
|
|
36
42
|
canIncrementEnd,
|
|
@@ -39,14 +45,14 @@ export const NodePlankHeading = memo(
|
|
|
39
45
|
actions = [],
|
|
40
46
|
}: NodePlankHeadingProps) => {
|
|
41
47
|
const { t } = useTranslation(DECK_PLUGIN);
|
|
42
|
-
const { graph } =
|
|
43
|
-
const breakpoint = useBreakpoints();
|
|
48
|
+
const { graph } = useGraph();
|
|
44
49
|
const icon = node?.properties?.icon ?? 'ph--placeholder--regular';
|
|
45
50
|
const label = pending
|
|
46
51
|
? t('pending heading')
|
|
47
52
|
: toLocalizedString(node?.properties?.label ?? ['plank heading fallback label', { ns: DECK_PLUGIN }], t);
|
|
48
53
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
49
54
|
const ActionRoot = node && popoverAnchorId === `dxos.org/ui/${DECK_PLUGIN}/${node.id}` ? Popover.Anchor : Fragment;
|
|
55
|
+
const breakpoint = useBreakpoints();
|
|
50
56
|
|
|
51
57
|
useEffect(() => {
|
|
52
58
|
const frame = requestAnimationFrame(() => {
|
|
@@ -57,65 +63,36 @@ export const NodePlankHeading = memo(
|
|
|
57
63
|
return () => cancelAnimationFrame(frame);
|
|
58
64
|
}, [node]);
|
|
59
65
|
|
|
66
|
+
const layoutPart = coordinate.part;
|
|
60
67
|
// NOTE(Zan): Node ids may now contain a path like `${space}:${id}~comments`
|
|
61
|
-
const attendableId =
|
|
68
|
+
const attendableId = coordinate.entryId.split(SLUG_PATH_SEPARATOR).at(0);
|
|
62
69
|
const capabilities = useMemo(
|
|
63
70
|
() => ({
|
|
64
|
-
solo:
|
|
71
|
+
solo: layoutPart === 'solo' || layoutPart === 'main',
|
|
65
72
|
incrementStart: canIncrementStart,
|
|
66
73
|
incrementEnd: canIncrementEnd,
|
|
67
74
|
}),
|
|
68
|
-
[breakpoint,
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
const sigilActions = useMemo(
|
|
72
|
-
() => node && [actions, graph.actions(node)].filter((a) => a.length > 0),
|
|
73
|
-
[actions, node, graph],
|
|
74
|
-
);
|
|
75
|
-
const handleAction = useCallback((action: StackItemSigilAction) => {
|
|
76
|
-
typeof action.data === 'function' && action.data?.({ node: action as Node, caller: DECK_PLUGIN });
|
|
77
|
-
}, []);
|
|
78
|
-
|
|
79
|
-
const handlePlankAction = useCallback(
|
|
80
|
-
(eventType: DeckAction.PartAdjustment) => {
|
|
81
|
-
if (eventType === 'solo') {
|
|
82
|
-
return dispatch(createIntent(DeckAction.Adjust, { type: eventType, id }));
|
|
83
|
-
} else if (eventType === 'close') {
|
|
84
|
-
if (part === 'complementary') {
|
|
85
|
-
return dispatch(
|
|
86
|
-
createIntent(LayoutAction.UpdateComplementary, {
|
|
87
|
-
part: 'complementary',
|
|
88
|
-
options: { state: 'collapsed' },
|
|
89
|
-
}),
|
|
90
|
-
);
|
|
91
|
-
} else {
|
|
92
|
-
return dispatch(
|
|
93
|
-
createIntent(LayoutAction.Close, { part: 'main', subject: [id], options: { state: false } }),
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
} else {
|
|
97
|
-
return dispatch(createIntent(DeckAction.Adjust, { type: eventType, id }));
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
[dispatch, id, part],
|
|
75
|
+
[breakpoint, layoutPart, canIncrementStart, canIncrementEnd],
|
|
101
76
|
);
|
|
102
77
|
|
|
103
78
|
return (
|
|
104
79
|
<StackItem.Heading
|
|
105
80
|
classNames={[
|
|
106
|
-
'plb-1 border-be border-separator items-stretch gap-1
|
|
107
|
-
|
|
81
|
+
'plb-1 border-be border-separator items-stretch gap-1',
|
|
82
|
+
layoutPart === 'solo' ? soloInlinePadding : 'pli-1',
|
|
108
83
|
]}
|
|
109
84
|
>
|
|
110
85
|
<ActionRoot>
|
|
111
|
-
{node
|
|
86
|
+
{node ? (
|
|
112
87
|
<StackItem.Sigil
|
|
113
88
|
icon={icon}
|
|
114
|
-
related={
|
|
89
|
+
related={layoutPart === 'complementary'}
|
|
115
90
|
attendableId={attendableId}
|
|
116
91
|
triggerLabel={t('actions menu label')}
|
|
117
|
-
actions={
|
|
118
|
-
onAction={
|
|
92
|
+
actions={[actions, graph.actions(node)].filter((a) => a.length > 0)}
|
|
93
|
+
onAction={(action) =>
|
|
94
|
+
typeof action.data === 'function' && action.data?.({ node: action as Node, caller: DECK_PLUGIN })
|
|
95
|
+
}
|
|
119
96
|
>
|
|
120
97
|
<Surface role='menu-footer' data={{ subject: node.data }} />
|
|
121
98
|
</StackItem.Sigil>
|
|
@@ -126,22 +103,53 @@ export const NodePlankHeading = memo(
|
|
|
126
103
|
</StackItem.SigilButton>
|
|
127
104
|
)}
|
|
128
105
|
</ActionRoot>
|
|
106
|
+
{breakpoint !== 'desktop' && <ToggleSidebarButton />}
|
|
129
107
|
<TextTooltip text={label} onlyWhenTruncating>
|
|
130
108
|
<StackItem.HeadingLabel
|
|
131
109
|
attendableId={attendableId}
|
|
132
|
-
related={
|
|
110
|
+
related={layoutPart === 'complementary'}
|
|
133
111
|
{...(pending && { classNames: 'text-description' })}
|
|
134
112
|
>
|
|
135
113
|
{label}
|
|
136
114
|
</StackItem.HeadingLabel>
|
|
137
115
|
</TextTooltip>
|
|
138
|
-
{node &&
|
|
116
|
+
{node && layoutPart !== 'complementary' && (
|
|
117
|
+
// TODO(Zan): What are we doing with layout coordinate here?
|
|
118
|
+
<Surface role='navbar-end' data={{ subject: node.data }} />
|
|
119
|
+
)}
|
|
120
|
+
{/* NOTE(thure): Pinning & unpinning are temporarily disabled */}
|
|
139
121
|
<PlankControls
|
|
140
122
|
capabilities={capabilities}
|
|
141
|
-
isSolo={
|
|
142
|
-
onClick={
|
|
143
|
-
|
|
144
|
-
|
|
123
|
+
isSolo={layoutPart === 'solo'}
|
|
124
|
+
onClick={(eventType) => {
|
|
125
|
+
if (!layoutPart) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// TODO(Zan): Update this to use the new layout actions.
|
|
130
|
+
if (eventType === 'solo') {
|
|
131
|
+
return dispatch(
|
|
132
|
+
createIntent(NavigationAction.Adjust, {
|
|
133
|
+
type: eventType,
|
|
134
|
+
layoutCoordinate: { part: 'main', entryId: coordinate.entryId },
|
|
135
|
+
}),
|
|
136
|
+
);
|
|
137
|
+
} else if (eventType === 'close') {
|
|
138
|
+
if (layoutPart === 'complementary') {
|
|
139
|
+
return dispatch(createIntent(LayoutAction.SetLayout, { element: 'complementary', state: false }));
|
|
140
|
+
} else {
|
|
141
|
+
return dispatch(
|
|
142
|
+
createIntent(NavigationAction.Close, { activeParts: { [layoutPart]: [coordinate.entryId] } }),
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
return dispatch(createIntent(NavigationAction.Adjust, { type: eventType, layoutCoordinate: coordinate }));
|
|
147
|
+
}
|
|
148
|
+
}}
|
|
149
|
+
close={layoutPart === 'complementary' ? 'minify-end' : true}
|
|
150
|
+
>
|
|
151
|
+
<ToggleComplementarySidebarButton />
|
|
152
|
+
</PlankControls>
|
|
145
153
|
</StackItem.Heading>
|
|
146
154
|
);
|
|
147
155
|
},
|
|
@@ -6,56 +6,65 @@ import React, { type KeyboardEvent, memo, useCallback, useLayoutEffect, useMemo,
|
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
createIntent,
|
|
9
|
+
indexInPart,
|
|
9
10
|
LayoutAction,
|
|
11
|
+
partLength,
|
|
10
12
|
Surface,
|
|
11
|
-
useCapability,
|
|
12
|
-
useAppGraph,
|
|
13
13
|
useIntentDispatcher,
|
|
14
|
+
type Layout,
|
|
15
|
+
type LayoutCoordinate,
|
|
16
|
+
type LayoutEntry,
|
|
17
|
+
type LayoutPart,
|
|
18
|
+
type LayoutParts,
|
|
14
19
|
} from '@dxos/app-framework';
|
|
15
20
|
import { debounce } from '@dxos/async';
|
|
21
|
+
import { useGraph } from '@dxos/plugin-graph';
|
|
16
22
|
import { useAttendableAttributes } from '@dxos/react-ui-attention';
|
|
17
23
|
import { StackItem, railGridHorizontal } from '@dxos/react-ui-stack';
|
|
18
24
|
import { mainIntrinsicSize, mx } from '@dxos/react-ui-theme';
|
|
19
25
|
|
|
20
|
-
import { NodePlankHeading
|
|
26
|
+
import { NodePlankHeading } from './NodePlankHeading';
|
|
21
27
|
import { PlankContentError, PlankError } from './PlankError';
|
|
22
28
|
import { PlankLoading } from './PlankLoading';
|
|
23
|
-
import { DeckCapabilities } from '../../capabilities';
|
|
24
29
|
import { useNode, useMainSize } from '../../hooks';
|
|
25
|
-
import { DeckAction
|
|
30
|
+
import { DeckAction } from '../../types';
|
|
31
|
+
import { useDeckContext } from '../DeckContext';
|
|
32
|
+
import { useLayout } from '../LayoutContext';
|
|
26
33
|
|
|
27
34
|
const UNKNOWN_ID = 'unknown_id';
|
|
28
35
|
|
|
29
36
|
export type PlankProps = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
entry?: LayoutEntry;
|
|
38
|
+
layoutParts: LayoutParts;
|
|
39
|
+
// TODO(wittjosiah): Remove. Pass in LayoutCoordinate instead of LayoutEntry.
|
|
40
|
+
part: LayoutPart;
|
|
41
|
+
layoutMode: Layout['layoutMode'];
|
|
33
42
|
order?: number;
|
|
34
|
-
active?: string[];
|
|
35
|
-
layoutMode: LayoutMode;
|
|
36
43
|
};
|
|
37
44
|
|
|
38
|
-
export const Plank = memo(({
|
|
45
|
+
export const Plank = memo(({ entry, layoutParts, part, layoutMode, order }: PlankProps) => {
|
|
39
46
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
40
|
-
const {
|
|
41
|
-
const {
|
|
42
|
-
const
|
|
47
|
+
const coordinate: LayoutCoordinate = useMemo(() => ({ part, entryId: entry?.id ?? UNKNOWN_ID }), [entry?.id, part]);
|
|
48
|
+
const { popoverAnchorId, scrollIntoView } = useLayout();
|
|
49
|
+
const { plankSizing } = useDeckContext();
|
|
50
|
+
const { graph } = useGraph();
|
|
51
|
+
const node = useNode(graph, entry?.id);
|
|
43
52
|
const rootElement = useRef<HTMLDivElement | null>(null);
|
|
44
53
|
const canResize = layoutMode === 'deck';
|
|
45
54
|
const Root = part === 'solo' ? 'article' : StackItem.Root;
|
|
46
55
|
|
|
47
|
-
const attendableAttrs = useAttendableAttributes(
|
|
48
|
-
const index =
|
|
49
|
-
const length =
|
|
50
|
-
const canIncrementStart =
|
|
51
|
-
const canIncrementEnd =
|
|
56
|
+
const attendableAttrs = useAttendableAttributes(coordinate.entryId);
|
|
57
|
+
const index = indexInPart(layoutParts, coordinate);
|
|
58
|
+
const length = partLength(layoutParts, part);
|
|
59
|
+
const canIncrementStart = part === 'main' && index !== undefined && index > 0 && length !== undefined && length > 1;
|
|
60
|
+
const canIncrementEnd = part === 'main' && index !== undefined && index < length - 1 && length !== undefined;
|
|
52
61
|
|
|
53
|
-
const size =
|
|
62
|
+
const size = plankSizing?.[coordinate.entryId] as number | undefined;
|
|
54
63
|
const setSize = useCallback(
|
|
55
64
|
debounce((nextSize: number) => {
|
|
56
|
-
return dispatch(createIntent(DeckAction.UpdatePlankSize, { id, size: nextSize }));
|
|
65
|
+
return dispatch(createIntent(DeckAction.UpdatePlankSize, { id: coordinate.entryId, size: nextSize }));
|
|
57
66
|
}, 200),
|
|
58
|
-
[dispatch,
|
|
67
|
+
[dispatch, coordinate.entryId],
|
|
59
68
|
);
|
|
60
69
|
|
|
61
70
|
// TODO(thure): Tabster’s focus group should handle moving focus to Main, but something is blocking it.
|
|
@@ -66,19 +75,19 @@ export const Plank = memo(({ id = UNKNOWN_ID, part, path, order, active, layoutM
|
|
|
66
75
|
}, []);
|
|
67
76
|
|
|
68
77
|
useLayoutEffect(() => {
|
|
69
|
-
if (scrollIntoView ===
|
|
78
|
+
if (scrollIntoView === coordinate.entryId) {
|
|
70
79
|
// TODO(wittjosiah): When focused on page load, the focus is always visible.
|
|
71
80
|
// Forcing focus to something smaller than the plank prevents large focus ring in the interim.
|
|
72
81
|
const focusable = rootElement.current?.querySelector('button') || rootElement.current;
|
|
73
82
|
focusable?.focus({ preventScroll: true });
|
|
74
83
|
layoutMode === 'deck' && focusable?.scrollIntoView({ behavior: 'smooth', inline: 'center' });
|
|
75
84
|
// Clear the scroll into view state once it has been actioned.
|
|
76
|
-
void dispatch(createIntent(LayoutAction.ScrollIntoView, {
|
|
85
|
+
void dispatch(createIntent(LayoutAction.ScrollIntoView, { id: undefined }));
|
|
77
86
|
}
|
|
78
|
-
}, [
|
|
87
|
+
}, [coordinate.entryId, scrollIntoView, layoutMode]);
|
|
79
88
|
|
|
80
89
|
const isSolo = layoutMode === 'solo' && part === 'solo';
|
|
81
|
-
const isAttendable = isSolo || (layoutMode === 'deck' && part === '
|
|
90
|
+
const isAttendable = isSolo || (layoutMode === 'deck' && part === 'main');
|
|
82
91
|
|
|
83
92
|
const sizeAttrs = useMainSize();
|
|
84
93
|
|
|
@@ -86,10 +95,11 @@ export const Plank = memo(({ id = UNKNOWN_ID, part, path, order, active, layoutM
|
|
|
86
95
|
() =>
|
|
87
96
|
node && {
|
|
88
97
|
subject: node.data,
|
|
89
|
-
path,
|
|
98
|
+
path: entry?.path,
|
|
99
|
+
coordinate,
|
|
90
100
|
popoverAnchorId,
|
|
91
101
|
},
|
|
92
|
-
[node, node?.data, path, popoverAnchorId],
|
|
102
|
+
[node, node?.data, entry?.path, coordinate, popoverAnchorId],
|
|
93
103
|
);
|
|
94
104
|
|
|
95
105
|
// TODO(wittjosiah): Change prop to accept a component.
|
|
@@ -110,7 +120,7 @@ export const Plank = memo(({ id = UNKNOWN_ID, part, path, order, active, layoutM
|
|
|
110
120
|
{...(part === 'solo'
|
|
111
121
|
? ({ ...sizeAttrs, className } as any)
|
|
112
122
|
: {
|
|
113
|
-
item: { id },
|
|
123
|
+
item: { id: entry?.id ?? 'never' },
|
|
114
124
|
size,
|
|
115
125
|
onSizeChange: setSize,
|
|
116
126
|
classNames: className,
|
|
@@ -123,8 +133,7 @@ export const Plank = memo(({ id = UNKNOWN_ID, part, path, order, active, layoutM
|
|
|
123
133
|
{node ? (
|
|
124
134
|
<>
|
|
125
135
|
<NodePlankHeading
|
|
126
|
-
|
|
127
|
-
part={part}
|
|
136
|
+
coordinate={coordinate}
|
|
128
137
|
node={node}
|
|
129
138
|
canIncrementStart={canIncrementStart}
|
|
130
139
|
canIncrementEnd={canIncrementEnd}
|
|
@@ -140,7 +149,7 @@ export const Plank = memo(({ id = UNKNOWN_ID, part, path, order, active, layoutM
|
|
|
140
149
|
/>
|
|
141
150
|
</>
|
|
142
151
|
) : (
|
|
143
|
-
<PlankError
|
|
152
|
+
<PlankError layoutCoordinate={coordinate} />
|
|
144
153
|
)}
|
|
145
154
|
{canResize && <StackItem.ResizeHandle />}
|
|
146
155
|
</Root>
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { forwardRef } from 'react';
|
|
6
6
|
|
|
7
|
+
import { type PartAdjustment } from '@dxos/app-framework';
|
|
7
8
|
import {
|
|
8
9
|
Button,
|
|
9
10
|
ButtonGroup,
|
|
@@ -15,9 +16,8 @@ import {
|
|
|
15
16
|
} from '@dxos/react-ui';
|
|
16
17
|
|
|
17
18
|
import { DECK_PLUGIN } from '../../meta';
|
|
18
|
-
import { type DeckAction } from '../../types';
|
|
19
19
|
|
|
20
|
-
export type PlankControlHandler = (event:
|
|
20
|
+
export type PlankControlHandler = (event: PartAdjustment) => void;
|
|
21
21
|
|
|
22
22
|
export type PlankCapabilities = {
|
|
23
23
|
incrementStart?: boolean;
|
|
@@ -52,18 +52,17 @@ const PlankControl = ({ icon, label, ...props }: Omit<ButtonProps, 'children'> &
|
|
|
52
52
|
|
|
53
53
|
// TODO(wittjosiah): Duplicate of stack LayoutControls?
|
|
54
54
|
// Translations were to be duplicated between packages.
|
|
55
|
-
// NOTE(thure): Pinning & unpinning are disabled indefinitely.
|
|
56
55
|
export const PlankControls = forwardRef<HTMLDivElement, PlankControlsProps>(
|
|
57
56
|
(
|
|
58
|
-
{ onClick, variant = 'default', capabilities: can, isSolo, pin, close = false, children,
|
|
57
|
+
{ onClick, variant = 'default', capabilities: can, isSolo, pin, close = false, children, ...props },
|
|
59
58
|
forwardedRef,
|
|
60
59
|
) => {
|
|
61
60
|
const { t } = useTranslation(DECK_PLUGIN);
|
|
62
|
-
const buttonClassNames = variant === 'hide-disabled' ? 'disabled:hidden pli-2 plb-3' : 'pli-2 plb-3';
|
|
61
|
+
const buttonClassNames = variant === 'hide-disabled' ? 'disabled:hidden !pli-2 !plb-3' : '!pli-2 !plb-3';
|
|
63
62
|
|
|
64
63
|
return (
|
|
65
|
-
<ButtonGroup {...props}
|
|
66
|
-
{
|
|
64
|
+
<ButtonGroup {...props} ref={forwardedRef}>
|
|
65
|
+
{pin && !isSolo && ['both', 'start'].includes(pin) && (
|
|
67
66
|
<PlankControl
|
|
68
67
|
label={t('pin start label')}
|
|
69
68
|
variant='ghost'
|
|
@@ -71,14 +70,14 @@ export const PlankControls = forwardRef<HTMLDivElement, PlankControlsProps>(
|
|
|
71
70
|
onClick={() => onClick?.('pin-start')}
|
|
72
71
|
icon='ph--caret-line-left--regular'
|
|
73
72
|
/>
|
|
74
|
-
)}
|
|
73
|
+
)}
|
|
75
74
|
|
|
76
75
|
{can.solo && (
|
|
77
76
|
<PlankControl
|
|
78
77
|
label={isSolo ? t('show deck plank label') : t('show solo plank label')}
|
|
79
78
|
classNames={buttonClassNames}
|
|
80
79
|
onClick={() => onClick?.('solo')}
|
|
81
|
-
icon={isSolo ? 'ph--
|
|
80
|
+
icon={isSolo ? 'ph--arrow-u-down-left--regular' : 'ph--arrows-out--regular'}
|
|
82
81
|
/>
|
|
83
82
|
)}
|
|
84
83
|
|
|
@@ -101,14 +100,14 @@ export const PlankControls = forwardRef<HTMLDivElement, PlankControlsProps>(
|
|
|
101
100
|
</>
|
|
102
101
|
)}
|
|
103
102
|
|
|
104
|
-
{
|
|
103
|
+
{pin && !isSolo && ['both', 'end'].includes(pin) && (
|
|
105
104
|
<PlankControl
|
|
106
105
|
label={t('pin end label')}
|
|
107
106
|
classNames={buttonClassNames}
|
|
108
107
|
onClick={() => onClick?.('pin-end')}
|
|
109
108
|
icon='ph--caret-line-right--regular'
|
|
110
109
|
/>
|
|
111
|
-
)}
|
|
110
|
+
)}
|
|
112
111
|
|
|
113
112
|
{close && !isSolo && (
|
|
114
113
|
<PlankControl
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
|
+
import { type LayoutCoordinate } from '@dxos/app-framework';
|
|
7
8
|
import { type Node } from '@dxos/plugin-graph';
|
|
8
9
|
import { useTranslation } from '@dxos/react-ui';
|
|
9
10
|
import { descriptionText, mx } from '@dxos/react-ui-theme';
|
|
10
11
|
|
|
11
|
-
import { NodePlankHeading
|
|
12
|
+
import { NodePlankHeading } from './NodePlankHeading';
|
|
12
13
|
import { PlankLoading } from './PlankLoading';
|
|
13
14
|
import { DECK_PLUGIN } from '../../meta';
|
|
14
15
|
|
|
@@ -32,13 +33,11 @@ export const PlankContentError = ({ error }: { error?: Error }) => {
|
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
export const PlankError = ({
|
|
35
|
-
|
|
36
|
-
part,
|
|
36
|
+
layoutCoordinate,
|
|
37
37
|
node,
|
|
38
38
|
error,
|
|
39
39
|
}: {
|
|
40
|
-
|
|
41
|
-
part: NodePlankHeadingProps['part'];
|
|
40
|
+
layoutCoordinate: LayoutCoordinate;
|
|
42
41
|
node?: Node;
|
|
43
42
|
error?: Error;
|
|
44
43
|
}) => {
|
|
@@ -48,7 +47,7 @@ export const PlankError = ({
|
|
|
48
47
|
}, []);
|
|
49
48
|
return (
|
|
50
49
|
<>
|
|
51
|
-
<NodePlankHeading
|
|
50
|
+
<NodePlankHeading coordinate={layoutCoordinate} node={node} pending={!timedOut} />
|
|
52
51
|
{timedOut ? <PlankContentError error={error} /> : <PlankLoading />}
|
|
53
52
|
</>
|
|
54
53
|
);
|
|
@@ -4,32 +4,35 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Surface
|
|
7
|
+
import { Surface } from '@dxos/app-framework';
|
|
8
8
|
import { Main } from '@dxos/react-ui';
|
|
9
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
9
10
|
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
11
|
+
import { Banner } from './Banner';
|
|
12
|
+
import { useBreakpoints } from '../../util';
|
|
13
|
+
import { useHoistStatusbar } from '../../util/useHoistStatusbar';
|
|
14
|
+
import { useLayout } from '../LayoutContext';
|
|
12
15
|
|
|
13
16
|
export const Sidebar = () => {
|
|
14
|
-
const
|
|
17
|
+
const layoutContext = useLayout();
|
|
18
|
+
const { popoverAnchorId } = layoutContext;
|
|
15
19
|
const breakpoint = useBreakpoints();
|
|
16
|
-
const topbar = layoutAppliesTopbar(breakpoint);
|
|
17
20
|
const hoistStatusbar = useHoistStatusbar(breakpoint);
|
|
18
21
|
|
|
19
|
-
const navigationData = useMemo(
|
|
20
|
-
() => ({ popoverAnchorId, topbar, hoistStatusbar, current }),
|
|
21
|
-
[popoverAnchorId, topbar, hoistStatusbar, current],
|
|
22
|
-
);
|
|
22
|
+
const navigationData = useMemo(() => ({ popoverAnchorId }), [popoverAnchorId]);
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
|
-
<Main.NavigationSidebar
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<
|
|
25
|
+
<Main.NavigationSidebar classNames='grid grid-cols-1 grid-rows-[var(--rail-size)_var(--rail-action)_1fr_min-content_min-content] md:grid-rows-[var(--rail-size)_var(--rail-action)_1fr_min-content] lg:grid-rows-[1fr_min-content] overflow-hidden lg:block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]'>
|
|
26
|
+
{breakpoint !== 'desktop' && (
|
|
27
|
+
<>
|
|
28
|
+
<Banner variant='sidebar' />
|
|
29
|
+
<Surface role='search-input' limit={1} />
|
|
30
|
+
</>
|
|
31
|
+
)}
|
|
32
|
+
<div role='none' className={mx('!overflow-y-auto', breakpoint !== 'desktop' && 'border-be border-separator')}>
|
|
33
|
+
<Surface role='navigation' data={navigationData} limit={1} />
|
|
34
|
+
</div>
|
|
35
|
+
{!hoistStatusbar && <Surface role='status-bar--sidebar-footer' limit={1} />}
|
|
33
36
|
</Main.NavigationSidebar>
|
|
34
37
|
);
|
|
35
38
|
};
|
|
@@ -4,35 +4,29 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { IconButton, type IconButtonProps, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
7
|
+
import { IconButton, useTranslation } from '@dxos/react-ui';
|
|
9
8
|
|
|
10
|
-
import { DeckCapabilities } from '../../capabilities';
|
|
11
9
|
import { DECK_PLUGIN } from '../../meta';
|
|
10
|
+
import { useLayout } from '../LayoutContext';
|
|
12
11
|
|
|
13
|
-
export const ToggleSidebarButton = ({
|
|
14
|
-
|
|
15
|
-
variant = 'ghost',
|
|
16
|
-
}: ThemedClassName<Pick<IconButtonProps, 'variant'>>) => {
|
|
17
|
-
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
12
|
+
export const ToggleSidebarButton = () => {
|
|
13
|
+
const layoutContext = useLayout();
|
|
18
14
|
const { t } = useTranslation(DECK_PLUGIN);
|
|
19
15
|
return (
|
|
20
16
|
<IconButton
|
|
21
|
-
variant=
|
|
17
|
+
variant='ghost'
|
|
22
18
|
iconOnly
|
|
23
19
|
icon='ph--sidebar--regular'
|
|
24
20
|
size={4}
|
|
25
21
|
label={t('open navigation sidebar label')}
|
|
26
|
-
onClick={() =>
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
classNames={classNames}
|
|
22
|
+
onClick={() => (layoutContext.sidebarOpen = !layoutContext.sidebarOpen)}
|
|
23
|
+
classNames='!pli-2 order-first'
|
|
30
24
|
/>
|
|
31
25
|
);
|
|
32
26
|
};
|
|
33
27
|
|
|
34
28
|
export const CloseSidebarButton = () => {
|
|
35
|
-
const layoutContext =
|
|
29
|
+
const layoutContext = useLayout();
|
|
36
30
|
const { t } = useTranslation(DECK_PLUGIN);
|
|
37
31
|
return (
|
|
38
32
|
<IconButton
|
|
@@ -41,28 +35,40 @@ export const CloseSidebarButton = () => {
|
|
|
41
35
|
icon='ph--caret-line-left--regular'
|
|
42
36
|
size={4}
|
|
43
37
|
label={t('close navigation sidebar label')}
|
|
44
|
-
onClick={() => (layoutContext.
|
|
45
|
-
classNames='rounded-none pli-1
|
|
38
|
+
onClick={() => (layoutContext.sidebarOpen = false)}
|
|
39
|
+
classNames='!rounded-none !pli-1 ch-focus-ring-inset pie-[max(.5rem,env(safe-area-inset-left))]'
|
|
46
40
|
/>
|
|
47
41
|
);
|
|
48
42
|
};
|
|
49
43
|
|
|
50
|
-
export const ToggleComplementarySidebarButton = (
|
|
51
|
-
const layoutContext =
|
|
44
|
+
export const ToggleComplementarySidebarButton = () => {
|
|
45
|
+
const layoutContext = useLayout();
|
|
52
46
|
const { t } = useTranslation(DECK_PLUGIN);
|
|
53
47
|
return (
|
|
54
48
|
<IconButton
|
|
55
49
|
iconOnly
|
|
56
|
-
onClick={() =>
|
|
57
|
-
(layoutContext.complementarySidebarState =
|
|
58
|
-
layoutContext.complementarySidebarState === 'expanded' ? 'collapsed' : 'expanded')
|
|
59
|
-
}
|
|
50
|
+
onClick={() => (layoutContext.complementarySidebarOpen = !layoutContext.complementarySidebarOpen)}
|
|
60
51
|
variant='ghost'
|
|
61
52
|
label={t('open complementary sidebar label')}
|
|
62
|
-
classNames=
|
|
53
|
+
classNames='!pli-2 !plb-3 [&>svg]:-scale-x-100'
|
|
63
54
|
icon='ph--sidebar-simple--regular'
|
|
64
|
-
size={
|
|
65
|
-
|
|
55
|
+
size={4}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const CloseComplementarySidebarButton = () => {
|
|
61
|
+
const layoutContext = useLayout();
|
|
62
|
+
const { t } = useTranslation(DECK_PLUGIN);
|
|
63
|
+
return (
|
|
64
|
+
<IconButton
|
|
65
|
+
iconOnly
|
|
66
|
+
variant='ghost'
|
|
67
|
+
size={4}
|
|
68
|
+
icon='ph--caret-line-right--regular'
|
|
69
|
+
label={t('close complementary sidebar label')}
|
|
70
|
+
classNames='!rounded-none border-is border-separator ch-focus-ring-inset pie-2 lg:pie-[max(.5rem,env(safe-area-inset-right))]'
|
|
71
|
+
onClick={() => (layoutContext.complementarySidebarOpen = false)}
|
|
66
72
|
/>
|
|
67
73
|
);
|
|
68
74
|
};
|
|
@@ -5,17 +5,23 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { Surface } from '@dxos/app-framework';
|
|
8
|
-
import {
|
|
8
|
+
import { mainPadding, mainPaddingTransitions, mx } from '@dxos/react-ui-theme';
|
|
9
|
+
|
|
10
|
+
import { useMainSize } from '../../hooks';
|
|
9
11
|
|
|
10
12
|
export const StatusBar = ({ showHints }: { showHints?: boolean }) => {
|
|
11
|
-
const
|
|
13
|
+
const sizeAttrs = useMainSize();
|
|
12
14
|
return (
|
|
13
15
|
<div
|
|
14
16
|
role='contentinfo'
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
+
{...sizeAttrs}
|
|
18
|
+
className={mx(
|
|
19
|
+
'fixed block-end-0 inset-inline-0 flex justify-between items-center border-bs border-separator z-[2] pbe-[env(safe-area-inset-bottom)]',
|
|
20
|
+
mainPadding,
|
|
21
|
+
mainPaddingTransitions,
|
|
22
|
+
)}
|
|
17
23
|
>
|
|
18
|
-
{showHints && <Surface role='hints' limit={1} />}
|
|
24
|
+
<div role='none'>{showHints && <Surface role='hints' limit={1} />}</div>
|
|
19
25
|
<Surface role='status-bar' limit={1} />
|
|
20
26
|
</div>
|
|
21
27
|
);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import type { Toast as ToastProps } from '@dxos/app-framework';
|
|
8
8
|
import {
|
|
9
9
|
Button,
|
|
10
10
|
Icon,
|
|
@@ -28,7 +28,7 @@ export const Toast = ({
|
|
|
28
28
|
closeLabel,
|
|
29
29
|
onAction,
|
|
30
30
|
onOpenChange,
|
|
31
|
-
}:
|
|
31
|
+
}: ToastProps & Pick<ToastRootProps, 'onOpenChange'>) => {
|
|
32
32
|
const { t } = useTranslation(DECK_PLUGIN);
|
|
33
33
|
|
|
34
34
|
return (
|