@dxos/plugin-deck 0.8.4-main.f9ba587 → 0.8.4-main.fffef41
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-JTFSDT2I.mjs → app-graph-builder-D74NTOMK.mjs} +19 -43
- package/dist/lib/browser/app-graph-builder-D74NTOMK.mjs.map +7 -0
- package/dist/lib/browser/{check-app-scheme-57U62A3A.mjs → check-app-scheme-HIEVFAAX.mjs} +6 -6
- package/dist/lib/browser/check-app-scheme-HIEVFAAX.mjs.map +7 -0
- package/dist/lib/browser/chunk-5KMJPIQC.mjs +16 -0
- package/dist/lib/browser/chunk-5KMJPIQC.mjs.map +7 -0
- package/dist/lib/browser/{chunk-XL7EWOGI.mjs → chunk-F3VCCHVL.mjs} +13 -13
- package/dist/lib/browser/chunk-F3VCCHVL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-7LJDT5OH.mjs → chunk-QKCGZ45E.mjs} +19 -18
- package/dist/lib/browser/chunk-QKCGZ45E.mjs.map +7 -0
- package/dist/lib/browser/chunk-UXLU6CMW.mjs +16 -0
- package/dist/lib/browser/chunk-UXLU6CMW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-QO3VIMKQ.mjs → chunk-VBYJ664A.mjs} +13 -9
- package/dist/lib/browser/chunk-VBYJ664A.mjs.map +7 -0
- package/dist/lib/browser/{chunk-QBKDUEDV.mjs → chunk-VUJ6UNIJ.mjs} +579 -520
- package/dist/lib/browser/chunk-VUJ6UNIJ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +20 -14
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-6YMAE4SF.mjs → intent-resolver-UA4YQGAC.mjs} +21 -18
- package/dist/lib/browser/intent-resolver-UA4YQGAC.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-UVN2LMU3.mjs → react-root-JAMHKYWN.mjs} +13 -12
- package/dist/lib/browser/react-root-JAMHKYWN.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-WOLHGHMN.mjs → react-surface-6LW337ZT.mjs} +13 -13
- package/dist/lib/browser/react-surface-6LW337ZT.mjs.map +7 -0
- package/dist/lib/browser/{settings-L5CR5GTJ.mjs → settings-SDPTOCCM.mjs} +7 -6
- package/dist/lib/browser/{settings-L5CR5GTJ.mjs.map → settings-SDPTOCCM.mjs.map} +3 -3
- package/dist/lib/browser/state-7IFAGZQO.mjs +12 -0
- package/dist/lib/browser/toolkit-L5CFXJCF.mjs +52 -0
- package/dist/lib/browser/toolkit-L5CFXJCF.mjs.map +7 -0
- package/dist/lib/browser/{types.mjs → types/index.mjs} +3 -5
- package/dist/lib/browser/{url-handler-KZW7GBA2.mjs → url-handler-QEYGYE2H.mjs} +7 -7
- package/dist/lib/browser/url-handler-QEYGYE2H.mjs.map +7 -0
- package/dist/types/src/DeckPlugin.d.ts +1 -1
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/check-app-scheme.d.ts +1 -1
- package/dist/types/src/capabilities/check-app-scheme.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +9 -9
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-root.d.ts +2 -2
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +5 -2
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts +25 -0
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
- 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 +1 -1
- 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/DeckLayout.d.ts +2 -3
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts +74 -0
- package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/DeckMain.d.ts +3 -0
- package/dist/types/src/components/DeckLayout/DeckMain.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/Popover.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Toast.d.ts +5 -0
- 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 +1 -1
- package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.stories.d.ts +86 -5
- package/dist/types/src/components/Plank/Plank.stories.d.ts.map +1 -1
- 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 +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/SidebarButton.d.ts.map +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/hooks/useDeckCompanions.d.ts.map +1 -1
- package/dist/types/src/hooks/useHoistStatusbar.d.ts.map +1 -1
- package/dist/types/src/hooks/useNodeActionExpander.d.ts.map +1 -1
- 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 +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/{types.d.ts → types/schema.d.ts} +11 -11
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +49 -45
- package/src/DeckPlugin.ts +64 -59
- package/src/capabilities/app-graph-builder.ts +33 -31
- package/src/capabilities/capabilities.ts +3 -3
- package/src/capabilities/check-app-scheme.ts +3 -3
- package/src/capabilities/index.ts +2 -1
- package/src/capabilities/intent-resolver.ts +22 -19
- package/src/capabilities/react-root.tsx +6 -4
- package/src/capabilities/react-surface.tsx +5 -5
- package/src/capabilities/settings.ts +2 -1
- package/src/capabilities/state.ts +15 -6
- package/src/capabilities/toolkit.ts +66 -0
- package/src/capabilities/tools.ts +10 -7
- package/src/capabilities/url-handler.ts +3 -2
- package/src/components/DeckLayout/ActiveNode.tsx +1 -1
- package/src/components/DeckLayout/Banner.tsx +4 -4
- package/src/components/DeckLayout/ContentEmpty.tsx +2 -2
- package/src/components/DeckLayout/DeckLayout.stories.tsx +63 -0
- package/src/components/DeckLayout/DeckLayout.tsx +10 -279
- package/src/components/DeckLayout/DeckMain.tsx +281 -0
- package/src/components/DeckLayout/Dialog.tsx +1 -1
- package/src/components/DeckLayout/Fallback.tsx +3 -3
- package/src/components/DeckLayout/Popover.tsx +5 -14
- package/src/components/DeckLayout/StatusBar.tsx +1 -1
- package/src/components/DeckLayout/Toast.tsx +28 -3
- package/src/components/DeckSettings/DeckSettings.tsx +80 -65
- package/src/components/Plank/Plank.stories.tsx +10 -11
- package/src/components/Plank/Plank.tsx +75 -42
- package/src/components/Plank/PlankControls.tsx +6 -5
- package/src/components/Plank/PlankError.tsx +5 -7
- package/src/components/Plank/PlankHeading.tsx +14 -12
- package/src/components/Sidebar/ComplementarySidebar.tsx +40 -19
- package/src/components/Sidebar/Sidebar.tsx +3 -3
- package/src/components/Sidebar/SidebarButton.tsx +15 -14
- package/src/events.ts +2 -2
- package/src/hooks/useCompanions.ts +1 -1
- package/src/hooks/useDeckCompanions.ts +4 -3
- package/src/hooks/useHoistStatusbar.ts +6 -4
- package/src/hooks/useNodeActionExpander.ts +1 -1
- package/src/meta.ts +6 -3
- package/src/translations.ts +2 -0
- package/src/types/index.ts +5 -0
- package/src/{types.ts → types/schema.ts} +9 -9
- package/dist/lib/browser/app-graph-builder-JTFSDT2I.mjs.map +0 -7
- package/dist/lib/browser/check-app-scheme-57U62A3A.mjs.map +0 -7
- package/dist/lib/browser/chunk-7LJDT5OH.mjs.map +0 -7
- package/dist/lib/browser/chunk-M57WD3V6.mjs +0 -16
- package/dist/lib/browser/chunk-M57WD3V6.mjs.map +0 -7
- package/dist/lib/browser/chunk-QBKDUEDV.mjs.map +0 -7
- package/dist/lib/browser/chunk-QO3VIMKQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-XL7EWOGI.mjs.map +0 -7
- package/dist/lib/browser/chunk-Z5KITAZW.mjs +0 -13
- package/dist/lib/browser/chunk-Z5KITAZW.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-6YMAE4SF.mjs.map +0 -7
- package/dist/lib/browser/react-root-UVN2LMU3.mjs.map +0 -7
- package/dist/lib/browser/react-surface-WOLHGHMN.mjs.map +0 -7
- package/dist/lib/browser/state-ZTYWMORZ.mjs +0 -10
- package/dist/lib/browser/tools-2YYFHQAS.mjs +0 -88
- package/dist/lib/browser/tools-2YYFHQAS.mjs.map +0 -7
- package/dist/lib/browser/url-handler-KZW7GBA2.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-YCSX45KJ.mjs +0 -153
- package/dist/lib/node-esm/app-graph-builder-YCSX45KJ.mjs.map +0 -7
- package/dist/lib/node-esm/check-app-scheme-3YZIA73T.mjs +0 -33
- package/dist/lib/node-esm/check-app-scheme-3YZIA73T.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ANLUUC3J.mjs +0 -129
- package/dist/lib/node-esm/chunk-ANLUUC3J.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F4YIQ5GG.mjs +0 -128
- package/dist/lib/node-esm/chunk-F4YIQ5GG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HHG6H2BX.mjs +0 -15
- package/dist/lib/node-esm/chunk-HHG6H2BX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KTPDAVNM.mjs +0 -17
- package/dist/lib/node-esm/chunk-KTPDAVNM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NMSUKHE3.mjs +0 -1495
- package/dist/lib/node-esm/chunk-NMSUKHE3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QFKYT4JK.mjs +0 -163
- package/dist/lib/node-esm/chunk-QFKYT4JK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UJGQAMF7.mjs +0 -147
- package/dist/lib/node-esm/chunk-UJGQAMF7.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -169
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-URTWBGD7.mjs +0 -522
- package/dist/lib/node-esm/intent-resolver-URTWBGD7.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-root-GFX4GOJT.mjs +0 -44
- package/dist/lib/node-esm/react-root-GFX4GOJT.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-F6L5PLWK.mjs +0 -41
- package/dist/lib/node-esm/react-surface-F6L5PLWK.mjs.map +0 -7
- package/dist/lib/node-esm/settings-WE3TBMOC.mjs +0 -30
- package/dist/lib/node-esm/settings-WE3TBMOC.mjs.map +0 -7
- package/dist/lib/node-esm/state-DUK6WFDX.mjs +0 -11
- package/dist/lib/node-esm/state-DUK6WFDX.mjs.map +0 -7
- package/dist/lib/node-esm/tools-HH6NN7HB.mjs +0 -89
- package/dist/lib/node-esm/tools-HH6NN7HB.mjs.map +0 -7
- package/dist/lib/node-esm/types.mjs +0 -35
- package/dist/lib/node-esm/types.mjs.map +0 -7
- package/dist/lib/node-esm/url-handler-774BWWKI.mjs +0 -71
- package/dist/lib/node-esm/url-handler-774BWWKI.mjs.map +0 -7
- package/dist/types/src/types.d.ts.map +0 -1
- /package/dist/lib/browser/{state-ZTYWMORZ.mjs.map → state-7IFAGZQO.mjs.map} +0 -0
- /package/dist/lib/browser/{types.mjs.map → types/index.mjs.map} +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { useFocusFinders } from '@fluentui/react-tabster';
|
|
5
6
|
import React, {
|
|
6
7
|
type KeyboardEvent,
|
|
7
8
|
type PropsWithChildren,
|
|
@@ -12,30 +13,29 @@ import React, {
|
|
|
12
13
|
useRef,
|
|
13
14
|
} from 'react';
|
|
14
15
|
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
Surface,
|
|
18
|
-
createIntent,
|
|
19
|
-
useCapability,
|
|
20
|
-
useAppGraph,
|
|
21
|
-
useIntentDispatcher,
|
|
22
|
-
} from '@dxos/app-framework';
|
|
16
|
+
import { LayoutAction, createIntent } from '@dxos/app-framework';
|
|
17
|
+
import { Surface, useAppGraph, useCapability, useIntentDispatcher } from '@dxos/app-framework/react';
|
|
23
18
|
import { debounce } from '@dxos/async';
|
|
24
|
-
import {
|
|
19
|
+
import { type Node, useNode } from '@dxos/plugin-graph';
|
|
25
20
|
import { ATTENDABLE_PATH_SEPARATOR, useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
26
21
|
import { StackItem, railGridHorizontal } from '@dxos/react-ui-stack';
|
|
27
22
|
import { mainIntrinsicSize, mx } from '@dxos/react-ui-theme';
|
|
28
23
|
|
|
24
|
+
import { DeckCapabilities } from '../../capabilities';
|
|
25
|
+
import { useCompanions, useMainSize } from '../../hooks';
|
|
26
|
+
import { parseEntryId } from '../../layout';
|
|
27
|
+
import { DeckAction, type DeckSettingsProps, type LayoutMode, type ResolvedPart } from '../../types';
|
|
28
|
+
|
|
29
29
|
import { PlankContentError, PlankError } from './PlankError';
|
|
30
30
|
import { PlankHeading } from './PlankHeading';
|
|
31
31
|
import { PlankLoading } from './PlankLoading';
|
|
32
|
-
import { DeckCapabilities } from '../../capabilities';
|
|
33
|
-
import { useMainSize, useCompanions } from '../../hooks';
|
|
34
|
-
import { parseEntryId } from '../../layout';
|
|
35
|
-
import { DeckAction, type LayoutMode, type ResolvedPart, type DeckSettingsProps } from '../../types';
|
|
36
32
|
|
|
37
33
|
const UNKNOWN_ID = 'unknown_id';
|
|
38
34
|
|
|
35
|
+
//
|
|
36
|
+
// Plank
|
|
37
|
+
//
|
|
38
|
+
|
|
39
39
|
export type PlankProps = Pick<PlankComponentProps, 'layoutMode' | 'part' | 'path' | 'order' | 'active' | 'settings'> & {
|
|
40
40
|
id?: string;
|
|
41
41
|
companionId?: string;
|
|
@@ -67,7 +67,11 @@ export const Plank = memo(({ id = UNKNOWN_ID, companionId, ...props }: PlankProp
|
|
|
67
67
|
const hasCompanion = !!(companionId && currentCompanion);
|
|
68
68
|
|
|
69
69
|
return (
|
|
70
|
-
<PlankContainer
|
|
70
|
+
<PlankContainer
|
|
71
|
+
solo={props.part === 'solo'}
|
|
72
|
+
companion={hasCompanion}
|
|
73
|
+
encapsulate={!!props.settings?.encapsulatedPlanks}
|
|
74
|
+
>
|
|
71
75
|
<PlankComponent
|
|
72
76
|
id={id}
|
|
73
77
|
node={node}
|
|
@@ -91,7 +95,13 @@ export const Plank = memo(({ id = UNKNOWN_ID, companionId, ...props }: PlankProp
|
|
|
91
95
|
);
|
|
92
96
|
});
|
|
93
97
|
|
|
94
|
-
|
|
98
|
+
//
|
|
99
|
+
// PlankContainer
|
|
100
|
+
//
|
|
101
|
+
|
|
102
|
+
type PlankContainerProps = PropsWithChildren<{ solo: boolean; companion: boolean; encapsulate: boolean }>;
|
|
103
|
+
|
|
104
|
+
const PlankContainer = ({ children, solo, companion, encapsulate }: PlankContainerProps) => {
|
|
95
105
|
const sizeAttrs = useMainSize();
|
|
96
106
|
if (!solo) {
|
|
97
107
|
return children;
|
|
@@ -101,7 +111,14 @@ const PlankContainer = ({ children, solo, companion }: PropsWithChildren<{ solo:
|
|
|
101
111
|
return (
|
|
102
112
|
<div
|
|
103
113
|
role='none'
|
|
104
|
-
|
|
114
|
+
data-popover-collision-boundary={true}
|
|
115
|
+
className={mx(
|
|
116
|
+
'absolute inset-[--main-spacing] grid',
|
|
117
|
+
encapsulate && 'border border-separator rounded overflow-hidden',
|
|
118
|
+
companion && 'grid-cols-[6fr_4fr]', // TODO(burdon): Resize.
|
|
119
|
+
railGridHorizontal,
|
|
120
|
+
mainIntrinsicSize,
|
|
121
|
+
)}
|
|
105
122
|
{...sizeAttrs}
|
|
106
123
|
>
|
|
107
124
|
{children}
|
|
@@ -109,6 +126,10 @@ const PlankContainer = ({ children, solo, companion }: PropsWithChildren<{ solo:
|
|
|
109
126
|
);
|
|
110
127
|
};
|
|
111
128
|
|
|
129
|
+
//
|
|
130
|
+
// PlankComponent
|
|
131
|
+
//
|
|
132
|
+
|
|
112
133
|
type PlankComponentProps = {
|
|
113
134
|
layoutMode: LayoutMode;
|
|
114
135
|
id: string;
|
|
@@ -116,7 +137,6 @@ type PlankComponentProps = {
|
|
|
116
137
|
path?: string[];
|
|
117
138
|
order?: number;
|
|
118
139
|
active?: string[];
|
|
119
|
-
// TODO(burdon): Change to role?
|
|
120
140
|
companioned?: 'primary' | 'companion';
|
|
121
141
|
node?: Node;
|
|
122
142
|
primary?: Node;
|
|
@@ -140,6 +160,7 @@ const PlankComponent = memo(
|
|
|
140
160
|
}: PlankComponentProps) => {
|
|
141
161
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
142
162
|
const { deck, popoverAnchorId, scrollIntoView } = useCapability(DeckCapabilities.DeckState);
|
|
163
|
+
const { findFirstFocusable } = useFocusFinders();
|
|
143
164
|
const canResize = layoutMode === 'deck';
|
|
144
165
|
|
|
145
166
|
const attentionAttrs = useAttentionAttributes(primary?.id ?? id);
|
|
@@ -163,18 +184,21 @@ const PlankComponent = memo(
|
|
|
163
184
|
|
|
164
185
|
// TODO(thure): Tabster’s focus group should handle moving focus to Main, but something is blocking it.
|
|
165
186
|
const handleKeyDown = useCallback((event: KeyboardEvent) => {
|
|
166
|
-
if (event.target === event.currentTarget
|
|
167
|
-
|
|
187
|
+
if (event.target === event.currentTarget) {
|
|
188
|
+
switch (event.key) {
|
|
189
|
+
case 'Escape':
|
|
190
|
+
rootElement.current?.closest('main')?.focus();
|
|
191
|
+
break;
|
|
192
|
+
case 'Enter':
|
|
193
|
+
rootElement.current && findFirstFocusable(rootElement.current)?.focus();
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
168
196
|
}
|
|
169
197
|
}, []);
|
|
170
198
|
|
|
171
199
|
useLayoutEffect(() => {
|
|
172
200
|
if (scrollIntoView === id) {
|
|
173
|
-
|
|
174
|
-
// Forcing focus to something smaller than the plank prevents large focus ring in the interim.
|
|
175
|
-
const focusable = rootElement.current?.querySelector('button') || rootElement.current;
|
|
176
|
-
focusable?.focus({ preventScroll: true });
|
|
177
|
-
layoutMode === 'deck' && focusable?.scrollIntoView({ behavior: 'smooth', inline: 'center' });
|
|
201
|
+
layoutMode === 'deck' && rootElement.current?.scrollIntoView({ behavior: 'smooth', inline: 'center' });
|
|
178
202
|
// Clear the scroll into view state once it has been actioned.
|
|
179
203
|
void dispatch(createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: undefined }));
|
|
180
204
|
}
|
|
@@ -189,34 +213,42 @@ const PlankComponent = memo(
|
|
|
189
213
|
const data = useMemo(
|
|
190
214
|
() =>
|
|
191
215
|
node && {
|
|
216
|
+
attendableId: id,
|
|
192
217
|
subject: node.data,
|
|
193
218
|
companionTo: primary?.data,
|
|
219
|
+
properties: node.properties,
|
|
194
220
|
variant,
|
|
195
221
|
path,
|
|
196
222
|
popoverAnchorId,
|
|
197
223
|
},
|
|
198
|
-
[node, node?.data, path, popoverAnchorId, primary?.data, variant],
|
|
224
|
+
[node, node?.data, node?.properties, path, popoverAnchorId, primary?.data, variant],
|
|
199
225
|
);
|
|
200
226
|
|
|
201
227
|
// TODO(wittjosiah): Change prop to accept a component.
|
|
202
228
|
const placeholder = useMemo(() => <PlankLoading />, []);
|
|
203
229
|
|
|
204
230
|
const Root = part.startsWith('solo') ? 'article' : StackItem.Root;
|
|
231
|
+
const fullscreen = layoutMode === 'solo--fullscreen';
|
|
205
232
|
const className = mx(
|
|
206
233
|
'attention-surface relative dx-focus-ring-inset-over-all density-coarse',
|
|
207
|
-
isSolo && mainIntrinsicSize,
|
|
208
|
-
isSolo && railGridHorizontal,
|
|
209
234
|
isSolo && 'absolute inset-0',
|
|
235
|
+
isSolo && mainIntrinsicSize,
|
|
236
|
+
railGridHorizontal,
|
|
210
237
|
part.startsWith('solo') && 'grid',
|
|
238
|
+
part.startsWith('solo-') && 'grid-rows-subgrid row-span-2 min-is-0',
|
|
239
|
+
fullscreen && 'grid-rows-1',
|
|
211
240
|
part === 'deck' && (companioned === 'companion' ? '!border-separator border-ie' : '!border-separator border-li'),
|
|
212
|
-
part.startsWith('solo-') && 'row-span-2 grid-rows-subgrid min-is-0',
|
|
213
241
|
part === 'solo-companion' && '!border-separator border-is',
|
|
242
|
+
settings?.encapsulatedPlanks &&
|
|
243
|
+
!part.startsWith('solo') &&
|
|
244
|
+
'mli-[--main-spacing] !border-separator border rounded overflow-hidden',
|
|
214
245
|
);
|
|
215
246
|
|
|
216
247
|
return (
|
|
217
248
|
<Root
|
|
218
249
|
ref={rootElement}
|
|
219
250
|
data-testid='deck.plank'
|
|
251
|
+
data-popover-collision-boundary={true}
|
|
220
252
|
tabIndex={0}
|
|
221
253
|
{...(part.startsWith('solo')
|
|
222
254
|
? ({ ...sizeAttrs, className } as any)
|
|
@@ -233,19 +265,21 @@ const PlankComponent = memo(
|
|
|
233
265
|
>
|
|
234
266
|
{node ? (
|
|
235
267
|
<>
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
268
|
+
{!fullscreen && (
|
|
269
|
+
<PlankHeading
|
|
270
|
+
id={id}
|
|
271
|
+
part={part.startsWith('solo-') ? 'solo' : part}
|
|
272
|
+
node={node}
|
|
273
|
+
layoutMode={layoutMode}
|
|
274
|
+
deckEnabled={settings?.enableDeck}
|
|
275
|
+
canIncrementStart={canIncrementStart}
|
|
276
|
+
canIncrementEnd={canIncrementEnd}
|
|
277
|
+
popoverAnchorId={popoverAnchorId}
|
|
278
|
+
primaryId={primary?.id}
|
|
279
|
+
companioned={companioned}
|
|
280
|
+
companions={companions}
|
|
281
|
+
/>
|
|
282
|
+
)}
|
|
249
283
|
<Surface
|
|
250
284
|
key={node.id}
|
|
251
285
|
role='article'
|
|
@@ -258,7 +292,6 @@ const PlankComponent = memo(
|
|
|
258
292
|
) : (
|
|
259
293
|
<PlankError id={id} part={part} />
|
|
260
294
|
)}
|
|
261
|
-
|
|
262
295
|
{canResize && <StackItem.ResizeHandle />}
|
|
263
296
|
</Root>
|
|
264
297
|
);
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { forwardRef, useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import { createIntent
|
|
7
|
+
import { createIntent } from '@dxos/app-framework';
|
|
8
|
+
import { useIntentDispatcher } from '@dxos/app-framework/react';
|
|
8
9
|
import { invariant } from '@dxos/invariant';
|
|
9
10
|
import { ButtonGroup, type ButtonGroupProps, type ButtonProps, IconButton, useTranslation } from '@dxos/react-ui';
|
|
10
11
|
|
|
11
|
-
import {
|
|
12
|
+
import { meta } from '../../meta';
|
|
12
13
|
import { DeckAction, type LayoutMode } from '../../types';
|
|
13
14
|
|
|
14
15
|
export type PlankControlHandler = (event: DeckAction.PartAdjustment) => void;
|
|
@@ -32,7 +33,7 @@ export type PlankControlsProps = Omit<ButtonGroupProps, 'onClick'> & {
|
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
const PlankControl = ({ icon, label, ...props }: Omit<ButtonProps, 'children'> & { label: string; icon: string }) => {
|
|
35
|
-
return <IconButton
|
|
36
|
+
return <IconButton label={label} icon={icon} iconOnly variant='ghost' tooltipSide='bottom' {...props} />;
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
const plankControlSpacing = 'pli-2';
|
|
@@ -43,7 +44,7 @@ type PlankComplimentControlsProps = {
|
|
|
43
44
|
|
|
44
45
|
export const PlankCompanionControls = forwardRef<HTMLDivElement, PlankComplimentControlsProps>(
|
|
45
46
|
({ primary }, forwardedRef) => {
|
|
46
|
-
const { t } = useTranslation(
|
|
47
|
+
const { t } = useTranslation(meta.id);
|
|
47
48
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
48
49
|
const handleCloseCompanion = useCallback(() => {
|
|
49
50
|
invariant(primary);
|
|
@@ -71,7 +72,7 @@ export const PlankControls = forwardRef<HTMLDivElement, PlankControlsProps>(
|
|
|
71
72
|
{ children, classNames, variant = 'default', capabilities, layoutMode, pin, close = false, onClick, ...props },
|
|
72
73
|
forwardedRef,
|
|
73
74
|
) => {
|
|
74
|
-
const { t } = useTranslation(
|
|
75
|
+
const { t } = useTranslation(meta.id);
|
|
75
76
|
const buttonClassNames =
|
|
76
77
|
variant === 'hide-disabled' ? `disabled:hidden ${plankControlSpacing}` : plankControlSpacing;
|
|
77
78
|
|
|
@@ -8,19 +8,17 @@ import { type Node } from '@dxos/plugin-graph';
|
|
|
8
8
|
import { useTranslation } from '@dxos/react-ui';
|
|
9
9
|
import { descriptionMessage, mx } from '@dxos/react-ui-theme';
|
|
10
10
|
|
|
11
|
+
import { meta } from '../../meta';
|
|
12
|
+
|
|
11
13
|
import { PlankHeading, type PlankHeadingProps } from './PlankHeading';
|
|
12
14
|
import { PlankLoading } from './PlankLoading';
|
|
13
|
-
import { DECK_PLUGIN } from '../../meta';
|
|
14
15
|
|
|
15
16
|
export const PlankContentError = ({ error }: { error?: Error }) => {
|
|
16
|
-
const { t } = useTranslation(
|
|
17
|
+
const { t } = useTranslation(meta.id);
|
|
17
18
|
const errorString = error?.toString() ?? '';
|
|
18
19
|
return (
|
|
19
|
-
<div role='none' className='overflow-auto p-8 attention-surface grid place-items-center'>
|
|
20
|
-
<p
|
|
21
|
-
role='alert'
|
|
22
|
-
className={mx(descriptionMessage, 'break-words rounded-md p-8', errorString.length < 256 && 'text-lg')}
|
|
23
|
-
>
|
|
20
|
+
<div role='none' className='overflow-y-auto p-8 attention-surface grid place-items-center'>
|
|
21
|
+
<p role='alert' className={mx(descriptionMessage, 'break-all rounded-md p-4')}>
|
|
24
22
|
{error ? errorString : t('error fallback message')}
|
|
25
23
|
</p>
|
|
26
24
|
</div>
|
|
@@ -2,22 +2,24 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { Fragment, memo, useCallback, useEffect, useMemo
|
|
5
|
+
import React, { Fragment, type MouseEvent, memo, useCallback, useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { LayoutAction, createIntent } from '@dxos/app-framework';
|
|
8
|
+
import { Surface, useAppGraph, useIntentDispatcher } from '@dxos/app-framework/react';
|
|
8
9
|
import { type Node } from '@dxos/plugin-graph';
|
|
9
10
|
import { Icon, IconButton, Popover, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
10
11
|
import { StackItem, type StackItemSigilAction } from '@dxos/react-ui-stack';
|
|
11
12
|
import { TextTooltip } from '@dxos/react-ui-text-tooltip';
|
|
12
13
|
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/react-ui-theme';
|
|
13
14
|
|
|
14
|
-
import { PlankCompanionControls, PlankControls } from './PlankControls';
|
|
15
15
|
import { useBreakpoints } from '../../hooks';
|
|
16
16
|
import { parseEntryId } from '../../layout';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
17
|
+
import { meta } from '../../meta';
|
|
18
|
+
import { DeckAction, type LayoutMode, PLANK_COMPANION_TYPE, type ResolvedPart } from '../../types';
|
|
19
19
|
import { soloInlinePadding } from '../fragments';
|
|
20
20
|
|
|
21
|
+
import { PlankCompanionControls, PlankControls } from './PlankControls';
|
|
22
|
+
|
|
21
23
|
const MAX_COMPANIONS = 5;
|
|
22
24
|
|
|
23
25
|
export type PlankHeadingProps = {
|
|
@@ -52,14 +54,14 @@ export const PlankHeading = memo(
|
|
|
52
54
|
layoutMode,
|
|
53
55
|
actions = [],
|
|
54
56
|
}: PlankHeadingProps) => {
|
|
55
|
-
const { t } = useTranslation(
|
|
57
|
+
const { t } = useTranslation(meta.id);
|
|
56
58
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
57
59
|
const { graph } = useAppGraph();
|
|
58
60
|
const breakpoint = useBreakpoints();
|
|
59
61
|
const icon = node?.properties?.icon ?? 'ph--placeholder--regular';
|
|
60
62
|
const label = pending
|
|
61
63
|
? t('pending heading')
|
|
62
|
-
: toLocalizedString(node?.properties?.label ?? ['plank heading fallback label', { ns:
|
|
64
|
+
: toLocalizedString(node?.properties?.label ?? ['plank heading fallback label', { ns: meta.id }], t);
|
|
63
65
|
|
|
64
66
|
const isCompanionNode = node?.type === PLANK_COMPANION_TYPE;
|
|
65
67
|
|
|
@@ -105,7 +107,7 @@ export const PlankHeading = memo(
|
|
|
105
107
|
|
|
106
108
|
const handleAction = useCallback(
|
|
107
109
|
(action: StackItemSigilAction) => {
|
|
108
|
-
typeof action.data === 'function' && action.data?.({ parent: node, caller:
|
|
110
|
+
typeof action.data === 'function' && void action.data?.({ parent: node, caller: meta.id });
|
|
109
111
|
},
|
|
110
112
|
[node],
|
|
111
113
|
);
|
|
@@ -134,7 +136,7 @@ export const PlankHeading = memo(
|
|
|
134
136
|
[dispatch, id, part],
|
|
135
137
|
);
|
|
136
138
|
|
|
137
|
-
const ActionRoot = node && popoverAnchorId === `dxos.org/ui/${
|
|
139
|
+
const ActionRoot = node && popoverAnchorId === `dxos.org/ui/${meta.id}/${node.id}` ? Popover.Anchor : Fragment;
|
|
138
140
|
|
|
139
141
|
const handleTabClick = useCallback(
|
|
140
142
|
(event: MouseEvent) => {
|
|
@@ -161,7 +163,8 @@ export const PlankHeading = memo(
|
|
|
161
163
|
? [
|
|
162
164
|
hoverableControls,
|
|
163
165
|
hoverableFocusedWithinControls,
|
|
164
|
-
'*:transition-opacity *:opacity-[--controls-opacity] bg-transparent border-transparent transition-[background-color,border-color]
|
|
166
|
+
'*:transition-opacity *:opacity-[--controls-opacity] bg-transparent border-transparent transition-[background-color,border-color]',
|
|
167
|
+
'hover-hover:hover:bg-headerSurface focus-within:bg-headerSurface hover-hover:hover:border-subduedSeparator focus-within:border-subduedSeparator',
|
|
165
168
|
]
|
|
166
169
|
: []),
|
|
167
170
|
]}
|
|
@@ -177,7 +180,6 @@ export const PlankHeading = memo(
|
|
|
177
180
|
icon={icon}
|
|
178
181
|
iconOnly={companions.length > MAX_COMPANIONS && node?.id !== id}
|
|
179
182
|
label={toLocalizedString(label, t)}
|
|
180
|
-
size={5}
|
|
181
183
|
variant={node?.id === id ? 'primary' : 'ghost'}
|
|
182
184
|
onClick={handleTabClick}
|
|
183
185
|
/>
|
|
@@ -200,7 +202,7 @@ export const PlankHeading = memo(
|
|
|
200
202
|
) : (
|
|
201
203
|
<StackItem.SigilButton>
|
|
202
204
|
<span className='sr-only'>{label}</span>
|
|
203
|
-
<Icon icon={icon}
|
|
205
|
+
<Icon icon={icon} />
|
|
204
206
|
</StackItem.SigilButton>
|
|
205
207
|
)}
|
|
206
208
|
</ActionRoot>
|
|
@@ -12,26 +12,29 @@ import React, {
|
|
|
12
12
|
useState,
|
|
13
13
|
} from 'react';
|
|
14
14
|
|
|
15
|
-
import { LayoutAction,
|
|
16
|
-
import {
|
|
15
|
+
import { LayoutAction, createIntent } from '@dxos/app-framework';
|
|
16
|
+
import { Surface, useCapability, useIntentDispatcher } from '@dxos/app-framework/react';
|
|
17
|
+
import { IconButton, type Label, Main, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
17
18
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
19
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
18
20
|
|
|
19
|
-
import { ToggleComplementarySidebarButton } from './SidebarButton';
|
|
20
21
|
import { DeckCapabilities } from '../../capabilities';
|
|
21
|
-
import { type DeckCompanion, getCompanionId,
|
|
22
|
-
import {
|
|
22
|
+
import { type DeckCompanion, getCompanionId, useBreakpoints, useDeckCompanions, useHoistStatusbar } from '../../hooks';
|
|
23
|
+
import { meta } from '../../meta';
|
|
23
24
|
import { getMode } from '../../types';
|
|
24
25
|
import { layoutAppliesTopbar } from '../../util';
|
|
25
26
|
import { PlankContentError, PlankLoading } from '../Plank';
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
import { ToggleComplementarySidebarButton } from './SidebarButton';
|
|
29
|
+
|
|
30
|
+
const label = ['complementary sidebar title', { ns: meta.id }] satisfies Label;
|
|
28
31
|
|
|
29
32
|
export type ComplementarySidebarProps = {
|
|
30
33
|
current?: string;
|
|
31
34
|
};
|
|
32
35
|
|
|
33
36
|
export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) => {
|
|
34
|
-
const { t } = useTranslation(
|
|
37
|
+
const { t } = useTranslation(meta.id);
|
|
35
38
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
36
39
|
const layout = useCapability(DeckCapabilities.MutableDeckState);
|
|
37
40
|
const layoutMode = getMode(layout.deck);
|
|
@@ -90,7 +93,11 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
90
93
|
<Tabs.Root orientation='vertical' verticalVariant='stateless' value={internalValue} classNames='contents'>
|
|
91
94
|
<div
|
|
92
95
|
role='none'
|
|
93
|
-
className=
|
|
96
|
+
className={mx(
|
|
97
|
+
'absolute z-[1] inset-block-0 inline-end-0 !is-[--r0-size]',
|
|
98
|
+
'pbs-[env(safe-area-inset-top)] pbe-[env(safe-area-inset-bottom)] border-is border-subduedSeparator',
|
|
99
|
+
'grid grid-cols-1 grid-rows-[1fr_min-content] bg-baseSurface contain-layout app-drag',
|
|
100
|
+
)}
|
|
94
101
|
>
|
|
95
102
|
<Tabs.Tablist classNames='grid grid-cols-1 auto-rows-[--rail-action] p-1 gap-1 !overflow-y-auto'>
|
|
96
103
|
{companions.map((companion) => (
|
|
@@ -98,7 +105,6 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
98
105
|
<IconButton
|
|
99
106
|
label={toLocalizedString(companion.properties.label, t)}
|
|
100
107
|
icon={companion.properties.icon}
|
|
101
|
-
size={5}
|
|
102
108
|
iconOnly
|
|
103
109
|
tooltipSide='left'
|
|
104
110
|
data-value={getCompanionId(companion.id)}
|
|
@@ -128,8 +134,12 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
128
134
|
<Tabs.Tabpanel
|
|
129
135
|
key={getCompanionId(companion.id)}
|
|
130
136
|
value={getCompanionId(companion.id)}
|
|
131
|
-
classNames=
|
|
132
|
-
|
|
137
|
+
classNames={[
|
|
138
|
+
'absolute data-[state="inactive"]:-z-[1] overflow-hidden',
|
|
139
|
+
'inset-block-0 inline-start-0 is-[calc(100%-var(--r0-size))] lg:is-[--r1-size]',
|
|
140
|
+
'grid grid-cols-1 grid-rows-[var(--rail-size)_1fr_min-content] pbs-[env(safe-area-inset-top)]',
|
|
141
|
+
]}
|
|
142
|
+
{...(layout.complementarySidebarState !== 'expanded' && { inert: true })}
|
|
133
143
|
>
|
|
134
144
|
<ComplementarySidebarPanel
|
|
135
145
|
companion={companion}
|
|
@@ -154,12 +164,8 @@ type ComplementarySidebarPanelProps = {
|
|
|
154
164
|
hoistStatusbar: boolean;
|
|
155
165
|
};
|
|
156
166
|
|
|
157
|
-
const ScrollArea = ({ children }: PropsWithChildren) => {
|
|
158
|
-
return <div className='flex flex-col grow overflow-x-hidden overflow-y-auto scrollbar-thin'>{children}</div>;
|
|
159
|
-
};
|
|
160
|
-
|
|
161
167
|
const ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }: ComplementarySidebarPanelProps) => {
|
|
162
|
-
const { t } = useTranslation(
|
|
168
|
+
const { t } = useTranslation(meta.id);
|
|
163
169
|
|
|
164
170
|
if (getCompanionId(companion.id) !== activeId && !data) {
|
|
165
171
|
return null;
|
|
@@ -169,9 +175,20 @@ const ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }
|
|
|
169
175
|
|
|
170
176
|
return (
|
|
171
177
|
<>
|
|
172
|
-
<
|
|
173
|
-
|
|
174
|
-
|
|
178
|
+
<div role='none' className='flex items-center p-1 gap-1 border-be border-subduedSeparator'>
|
|
179
|
+
<IconButton
|
|
180
|
+
label={toLocalizedString(companion.properties.label, t)}
|
|
181
|
+
icon={companion.properties.icon}
|
|
182
|
+
iconOnly
|
|
183
|
+
tooltipSide='left'
|
|
184
|
+
data-value={getCompanionId(companion.id)}
|
|
185
|
+
classNames='bs-10 is-10'
|
|
186
|
+
variant='default'
|
|
187
|
+
/>
|
|
188
|
+
<div role='none' className='pli-1'>
|
|
189
|
+
{toLocalizedString(companion.properties.label, t)}
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
175
192
|
<Wrapper>
|
|
176
193
|
<Surface
|
|
177
194
|
role={`deck-companion--${getCompanionId(companion.id)}`}
|
|
@@ -191,3 +208,7 @@ const ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }
|
|
|
191
208
|
</>
|
|
192
209
|
);
|
|
193
210
|
};
|
|
211
|
+
|
|
212
|
+
const ScrollArea = ({ children }: PropsWithChildren) => {
|
|
213
|
+
return <div className='flex flex-col grow overflow-x-hidden overflow-y-auto scrollbar-thin'>{children}</div>;
|
|
214
|
+
};
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Surface, useCapability } from '@dxos/app-framework';
|
|
7
|
+
import { Surface, useCapability } from '@dxos/app-framework/react';
|
|
8
8
|
import { type Label, Main } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
10
|
import { DeckCapabilities } from '../../capabilities';
|
|
11
11
|
import { useBreakpoints, useHoistStatusbar } from '../../hooks';
|
|
12
|
-
import {
|
|
12
|
+
import { meta } from '../../meta';
|
|
13
13
|
import { getMode } from '../../types';
|
|
14
14
|
import { layoutAppliesTopbar } from '../../util';
|
|
15
15
|
|
|
16
|
-
const label = ['sidebar title', { ns:
|
|
16
|
+
const label = ['sidebar title', { ns: meta.id }] satisfies Label;
|
|
17
17
|
|
|
18
18
|
export const Sidebar = () => {
|
|
19
19
|
const { popoverAnchorId, activeDeck: current, deck } = useCapability(DeckCapabilities.DeckState);
|
|
@@ -4,24 +4,25 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { LayoutAction, createIntent } from '@dxos/app-framework';
|
|
8
|
+
import { useCapability, useIntentDispatcher } from '@dxos/app-framework/react';
|
|
8
9
|
import { IconButton, type IconButtonProps, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
9
10
|
|
|
10
11
|
import { DeckCapabilities } from '../../capabilities';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
12
|
+
import { getCompanionId, useDeckCompanions } from '../../hooks';
|
|
13
|
+
import { meta } from '../../meta';
|
|
13
14
|
|
|
14
15
|
export const ToggleSidebarButton = ({
|
|
15
16
|
classNames,
|
|
16
17
|
variant = 'ghost',
|
|
17
18
|
}: ThemedClassName<Pick<IconButtonProps, 'variant'>>) => {
|
|
18
19
|
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
19
|
-
const { t } = useTranslation(
|
|
20
|
+
const { t } = useTranslation(meta.id);
|
|
20
21
|
return (
|
|
21
22
|
<IconButton
|
|
22
23
|
variant={variant}
|
|
23
|
-
iconOnly
|
|
24
24
|
icon='ph--sidebar--regular'
|
|
25
|
+
iconOnly
|
|
25
26
|
size={4}
|
|
26
27
|
label={t('open navigation sidebar label')}
|
|
27
28
|
onClick={() =>
|
|
@@ -34,12 +35,12 @@ export const ToggleSidebarButton = ({
|
|
|
34
35
|
|
|
35
36
|
export const CloseSidebarButton = () => {
|
|
36
37
|
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
37
|
-
const { t } = useTranslation(
|
|
38
|
+
const { t } = useTranslation(meta.id);
|
|
38
39
|
return (
|
|
39
40
|
<IconButton
|
|
40
41
|
variant='ghost'
|
|
41
|
-
iconOnly
|
|
42
42
|
icon='ph--caret-line-left--regular'
|
|
43
|
+
iconOnly
|
|
43
44
|
size={4}
|
|
44
45
|
label={t('close navigation sidebar label')}
|
|
45
46
|
onClick={() => (layoutContext.sidebarState = 'collapsed')}
|
|
@@ -55,18 +56,18 @@ export const ToggleComplementarySidebarButton = ({
|
|
|
55
56
|
}: ThemedClassName<{ inR0?: boolean; current?: string }>) => {
|
|
56
57
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
57
58
|
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
58
|
-
const { t } = useTranslation(
|
|
59
|
+
const { t } = useTranslation(meta.id);
|
|
59
60
|
|
|
60
61
|
const companions = useDeckCompanions();
|
|
61
62
|
const handleClick = useCallback(async () => {
|
|
62
63
|
layoutContext.complementarySidebarState =
|
|
63
64
|
layoutContext.complementarySidebarState === 'expanded' ? 'collapsed' : 'expanded';
|
|
64
|
-
const
|
|
65
|
-
if (layoutContext.complementarySidebarState === 'expanded' && !current &&
|
|
65
|
+
const subject = layoutContext.complementarySidebarPanel ?? (companions[0] && getCompanionId(companions[0].id));
|
|
66
|
+
if (layoutContext.complementarySidebarState === 'expanded' && !current && subject) {
|
|
66
67
|
await dispatch(
|
|
67
68
|
createIntent(LayoutAction.UpdateComplementary, {
|
|
68
69
|
part: 'complementary',
|
|
69
|
-
subject
|
|
70
|
+
subject,
|
|
70
71
|
}),
|
|
71
72
|
);
|
|
72
73
|
}
|
|
@@ -74,14 +75,14 @@ export const ToggleComplementarySidebarButton = ({
|
|
|
74
75
|
|
|
75
76
|
return (
|
|
76
77
|
<IconButton
|
|
77
|
-
iconOnly
|
|
78
|
-
onClick={handleClick}
|
|
79
78
|
variant='ghost'
|
|
80
|
-
label={t('open complementary sidebar label')}
|
|
81
79
|
classNames={['[&>svg]:-scale-x-100', classNames]}
|
|
82
80
|
icon='ph--sidebar-simple--regular'
|
|
81
|
+
iconOnly
|
|
82
|
+
label={t('open complementary sidebar label')}
|
|
83
83
|
size={inR0 ? 5 : 4}
|
|
84
84
|
tooltipSide={inR0 ? 'left' : undefined}
|
|
85
|
+
onClick={handleClick}
|
|
85
86
|
/>
|
|
86
87
|
);
|
|
87
88
|
};
|
package/src/events.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { Events } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { meta } from './meta';
|
|
8
8
|
|
|
9
9
|
export namespace DeckEvents {
|
|
10
|
-
export const StateReady = Events.createStateEvent(`${
|
|
10
|
+
export const StateReady = Events.createStateEvent(`${meta.id}/state-ready`);
|
|
11
11
|
}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type Label
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { type Label } from '@dxos/app-framework';
|
|
6
|
+
import { useAppGraph } from '@dxos/app-framework/react';
|
|
7
|
+
import { type Node, ROOT_ID, useConnections } from '@dxos/plugin-graph';
|
|
8
|
+
import { type Position, byPosition } from '@dxos/util';
|
|
8
9
|
|
|
9
10
|
import { ATTENDABLE_PATH_SEPARATOR, DECK_COMPANION_TYPE } from '../types';
|
|
10
11
|
|