@dxos/plugin-deck 0.7.4 → 0.7.5-main.9cb18ac
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/chunk-ZC3K6C2W.mjs +37 -0
- package/dist/lib/browser/chunk-ZC3K6C2W.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +392 -420
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types.mjs +6 -1
- package/dist/types/src/DeckPlugin.d.ts +1 -10
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts.map +1 -1
- 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/Sidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +16 -0
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +29 -28
- package/src/DeckPlugin.tsx +222 -256
- package/src/components/DeckLayout/ActiveNode.tsx +1 -1
- package/src/components/DeckLayout/ComplementarySidebar.tsx +4 -3
- package/src/components/DeckLayout/DeckLayout.tsx +3 -7
- package/src/components/DeckLayout/Fullscreen.tsx +1 -1
- package/src/components/DeckLayout/NodePlankHeading.tsx +15 -29
- package/src/components/DeckLayout/Plank.tsx +7 -5
- package/src/components/DeckLayout/PlankControls.tsx +3 -5
- package/src/components/DeckLayout/Sidebar.tsx +4 -21
- package/src/components/DeckLayout/Toast.tsx +19 -6
- package/src/translations.ts +3 -0
- package/src/types.ts +15 -0
- package/dist/lib/browser/chunk-NIRHDTX4.mjs +0 -17
- package/dist/lib/browser/chunk-NIRHDTX4.mjs.map +0 -7
|
@@ -21,7 +21,7 @@ export const ActiveNode = () => {
|
|
|
21
21
|
<div role='none' className='sr-only'>
|
|
22
22
|
{/* TODO(wittjosiah): Weird that this is a surface, feel like it's not really render logic.
|
|
23
23
|
Probably this lives in React-land currently in order to access translations? */}
|
|
24
|
-
<Surface role='document-title' data={{ activeNode }} limit={1} />
|
|
24
|
+
<Surface role='document-title' data={{ subject: activeNode }} limit={1} />
|
|
25
25
|
</div>
|
|
26
26
|
);
|
|
27
27
|
};
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
+
createIntent,
|
|
8
9
|
type LayoutCoordinate,
|
|
9
10
|
NavigationAction,
|
|
10
11
|
SLUG_PATH_SEPARATOR,
|
|
@@ -36,7 +37,7 @@ export const ComplementarySidebar = ({ panels, current }: ComplementarySidebarPr
|
|
|
36
37
|
const id = attended[0] ? `${attended[0]}${SLUG_PATH_SEPARATOR}${panel}` : undefined;
|
|
37
38
|
const { graph } = useGraph();
|
|
38
39
|
const node = useNode(graph, id);
|
|
39
|
-
const dispatch = useIntentDispatcher();
|
|
40
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
40
41
|
useNodeActionExpander(node);
|
|
41
42
|
|
|
42
43
|
const actions = useMemo(
|
|
@@ -44,7 +45,7 @@ export const ComplementarySidebar = ({ panels, current }: ComplementarySidebarPr
|
|
|
44
45
|
panels.map(({ id, label, icon }) => ({
|
|
45
46
|
id: `complementary-${id}`,
|
|
46
47
|
data: () => {
|
|
47
|
-
void dispatch(
|
|
48
|
+
void dispatch(createIntent(NavigationAction.Open, { activeParts: { complementary: id } }));
|
|
48
49
|
},
|
|
49
50
|
properties: {
|
|
50
51
|
label,
|
|
@@ -62,7 +63,7 @@ export const ComplementarySidebar = ({ panels, current }: ComplementarySidebarPr
|
|
|
62
63
|
// TODO(burdon): Scroll area should be controlled by surface.
|
|
63
64
|
return (
|
|
64
65
|
<Main.ComplementarySidebar>
|
|
65
|
-
<StackContext.Provider value={{ size: 'contain', orientation: 'horizontal',
|
|
66
|
+
<StackContext.Provider value={{ size: 'contain', orientation: 'horizontal', rail: true }}>
|
|
66
67
|
<div role='none' className={mx(railGridHorizontal, 'grid grid-cols-[100%] bs-full')}>
|
|
67
68
|
<NodePlankHeading coordinate={coordinate} node={node} popoverAnchorId={popoverAnchorId} actions={actions} />
|
|
68
69
|
<ScrollArea.Root>
|
|
@@ -198,7 +198,6 @@ export const DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels,
|
|
|
198
198
|
{...(isSoloModeLoaded && { inert: '' })}
|
|
199
199
|
>
|
|
200
200
|
<Stack
|
|
201
|
-
separators={false}
|
|
202
201
|
orientation='horizontal'
|
|
203
202
|
size='contain'
|
|
204
203
|
classNames={['absolute inset-block-0 -inset-inline-px', mainPaddingTransitions]}
|
|
@@ -226,9 +225,7 @@ export const DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels,
|
|
|
226
225
|
className={isSoloModeLoaded ? 'relative bg-deck overflow-hidden' : 'sr-only'}
|
|
227
226
|
{...(!isSoloModeLoaded && { inert: '' })}
|
|
228
227
|
>
|
|
229
|
-
<StackContext.Provider
|
|
230
|
-
value={{ size: 'contain', orientation: 'horizontal', separators: false, rail: true }}
|
|
231
|
-
>
|
|
228
|
+
<StackContext.Provider value={{ size: 'contain', orientation: 'horizontal', rail: true }}>
|
|
232
229
|
<Plank entry={layoutParts.solo?.[0]} layoutParts={layoutParts} part='solo' layoutMode={layoutMode} />
|
|
233
230
|
</StackContext.Provider>
|
|
234
231
|
</div>
|
|
@@ -243,14 +240,13 @@ export const DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels,
|
|
|
243
240
|
{/* Global popovers. */}
|
|
244
241
|
<Popover.Portal>
|
|
245
242
|
<Popover.Content
|
|
246
|
-
classNames='z-[60]'
|
|
247
243
|
onEscapeKeyDown={() => {
|
|
248
244
|
context.popoverOpen = false;
|
|
249
245
|
context.popoverAnchorId = undefined;
|
|
250
246
|
}}
|
|
251
247
|
>
|
|
252
248
|
<Popover.Viewport>
|
|
253
|
-
<Surface role='popover' data={popoverContent} />
|
|
249
|
+
<Surface role='popover' data={popoverContent} limit={1} />
|
|
254
250
|
</Popover.Viewport>
|
|
255
251
|
<Popover.Arrow />
|
|
256
252
|
</Popover.Content>
|
|
@@ -259,7 +255,7 @@ export const DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels,
|
|
|
259
255
|
{/* Global dialog. */}
|
|
260
256
|
<Dialog.Root open={dialogOpen} onOpenChange={(nextOpen) => (context.dialogOpen = nextOpen)}>
|
|
261
257
|
<Dialog.Overlay blockAlign={dialogBlockAlign}>
|
|
262
|
-
<Surface role='dialog' data={dialogContent} />
|
|
258
|
+
<Surface role='dialog' data={dialogContent} limit={1} />
|
|
263
259
|
</Dialog.Overlay>
|
|
264
260
|
</Dialog.Root>
|
|
265
261
|
|
|
@@ -23,7 +23,7 @@ export const Fullscreen = ({ id }: { id?: string }) => {
|
|
|
23
23
|
limit={1}
|
|
24
24
|
fallback={Fallback}
|
|
25
25
|
data={{
|
|
26
|
-
|
|
26
|
+
subject: fullScreenNode?.data,
|
|
27
27
|
component: id?.startsWith(SURFACE_PREFIX) ? id.slice(SURFACE_PREFIX.length) : undefined,
|
|
28
28
|
}}
|
|
29
29
|
/>
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import React, { Fragment, memo, useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
+
createIntent,
|
|
8
9
|
LayoutAction,
|
|
9
10
|
NavigationAction,
|
|
10
11
|
SLUG_PATH_SEPARATOR,
|
|
@@ -48,7 +49,7 @@ export const NodePlankHeading = memo(
|
|
|
48
49
|
const label = pending
|
|
49
50
|
? t('pending heading')
|
|
50
51
|
: toLocalizedString(node?.properties?.label ?? ['plank heading fallback label', { ns: DECK_PLUGIN }], t);
|
|
51
|
-
const dispatch = useIntentDispatcher();
|
|
52
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
52
53
|
const ActionRoot = node && popoverAnchorId === `dxos.org/ui/${DECK_PLUGIN}/${node.id}` ? Popover.Anchor : Fragment;
|
|
53
54
|
const [isNotMobile] = useMediaQuery('md');
|
|
54
55
|
|
|
@@ -87,7 +88,7 @@ export const NodePlankHeading = memo(
|
|
|
87
88
|
typeof action.data === 'function' && action.data?.({ node: action as Node, caller: DECK_PLUGIN })
|
|
88
89
|
}
|
|
89
90
|
>
|
|
90
|
-
<Surface role='menu-footer' data={{
|
|
91
|
+
<Surface role='menu-footer' data={{ subject: node.data }} />
|
|
91
92
|
</StackItem.Sigil>
|
|
92
93
|
) : (
|
|
93
94
|
<StackItem.SigilButton>
|
|
@@ -107,7 +108,7 @@ export const NodePlankHeading = memo(
|
|
|
107
108
|
</TextTooltip>
|
|
108
109
|
{node && layoutPart !== 'complementary' && (
|
|
109
110
|
// TODO(Zan): What are we doing with layout coordinate here?
|
|
110
|
-
<Surface role='navbar-end'
|
|
111
|
+
<Surface role='navbar-end' data={{ subject: node.data }} />
|
|
111
112
|
)}
|
|
112
113
|
{/* NOTE(thure): Pinning & unpinning are temporarily disabled */}
|
|
113
114
|
<PlankControls
|
|
@@ -121,36 +122,22 @@ export const NodePlankHeading = memo(
|
|
|
121
122
|
|
|
122
123
|
// TODO(Zan): Update this to use the new layout actions.
|
|
123
124
|
if (eventType === 'solo') {
|
|
124
|
-
return dispatch(
|
|
125
|
-
{
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
|
|
125
|
+
return dispatch(
|
|
126
|
+
createIntent(NavigationAction.Adjust, {
|
|
127
|
+
type: eventType,
|
|
128
|
+
layoutCoordinate: { part: 'main', entryId: coordinate.entryId },
|
|
129
|
+
}),
|
|
130
|
+
);
|
|
130
131
|
} else if (eventType === 'close') {
|
|
131
132
|
if (layoutPart === 'complementary') {
|
|
132
|
-
return dispatch({
|
|
133
|
-
action: LayoutAction.SET_LAYOUT,
|
|
134
|
-
data: {
|
|
135
|
-
element: 'complementary',
|
|
136
|
-
state: false,
|
|
137
|
-
},
|
|
138
|
-
});
|
|
133
|
+
return dispatch(createIntent(LayoutAction.SetLayout, { element: 'complementary', state: false }));
|
|
139
134
|
} else {
|
|
140
|
-
return dispatch(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
activeParts: {
|
|
144
|
-
[layoutPart]: [coordinate.entryId],
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
});
|
|
135
|
+
return dispatch(
|
|
136
|
+
createIntent(NavigationAction.Close, { activeParts: { [layoutPart]: [coordinate.entryId] } }),
|
|
137
|
+
);
|
|
148
138
|
}
|
|
149
139
|
} else {
|
|
150
|
-
return dispatch({
|
|
151
|
-
action: NavigationAction.ADJUST,
|
|
152
|
-
data: { type: eventType, layoutCoordinate: coordinate },
|
|
153
|
-
});
|
|
140
|
+
return dispatch(createIntent(NavigationAction.Adjust, { type: eventType, layoutCoordinate: coordinate }));
|
|
154
141
|
}
|
|
155
142
|
}}
|
|
156
143
|
close={layoutPart === 'complementary' ? 'minify-end' : true}
|
|
@@ -165,7 +152,6 @@ export const NodePlankHeading = memo(
|
|
|
165
152
|
classNames='!pli-2 !plb-3 [&>svg]:-scale-x-100'
|
|
166
153
|
icon='ph--sidebar-simple--regular'
|
|
167
154
|
size={4}
|
|
168
|
-
tooltipZIndex='70'
|
|
169
155
|
/>
|
|
170
156
|
)}
|
|
171
157
|
</PlankControls>
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
indexInPart,
|
|
16
16
|
partLength,
|
|
17
17
|
LayoutAction,
|
|
18
|
+
createIntent,
|
|
18
19
|
} from '@dxos/app-framework';
|
|
19
20
|
import { debounce } from '@dxos/async';
|
|
20
21
|
import { useGraph } from '@dxos/plugin-graph';
|
|
@@ -25,8 +26,8 @@ import { mainIntrinsicSize, mx } from '@dxos/react-ui-theme';
|
|
|
25
26
|
import { NodePlankHeading } from './NodePlankHeading';
|
|
26
27
|
import { PlankContentError, PlankError } from './PlankError';
|
|
27
28
|
import { PlankLoading } from './PlankLoading';
|
|
28
|
-
import { DeckAction } from '../../DeckPlugin';
|
|
29
29
|
import { useNode, useMainSize } from '../../hooks';
|
|
30
|
+
import { DeckAction } from '../../types';
|
|
30
31
|
import { useDeckContext } from '../DeckContext';
|
|
31
32
|
import { useLayout } from '../LayoutContext';
|
|
32
33
|
|
|
@@ -42,7 +43,7 @@ export type PlankProps = {
|
|
|
42
43
|
};
|
|
43
44
|
|
|
44
45
|
export const Plank = memo(({ entry, layoutParts, part, layoutMode, order }: PlankProps) => {
|
|
45
|
-
const dispatch = useIntentDispatcher();
|
|
46
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
46
47
|
const coordinate: LayoutCoordinate = useMemo(() => ({ part, entryId: entry?.id ?? UNKNOWN_ID }), [entry?.id, part]);
|
|
47
48
|
const { popoverAnchorId, scrollIntoView } = useLayout();
|
|
48
49
|
const { plankSizing } = useDeckContext();
|
|
@@ -61,7 +62,7 @@ export const Plank = memo(({ entry, layoutParts, part, layoutMode, order }: Plan
|
|
|
61
62
|
const size = plankSizing?.[coordinate.entryId] as number | undefined;
|
|
62
63
|
const setSize = useCallback(
|
|
63
64
|
debounce((nextSize: number) => {
|
|
64
|
-
return dispatch(
|
|
65
|
+
return dispatch(createIntent(DeckAction.UpdatePlankSize, { id: coordinate.entryId, size: nextSize }));
|
|
65
66
|
}, 200),
|
|
66
67
|
[dispatch, coordinate.entryId],
|
|
67
68
|
);
|
|
@@ -81,7 +82,7 @@ export const Plank = memo(({ entry, layoutParts, part, layoutMode, order }: Plan
|
|
|
81
82
|
focusable?.focus({ preventScroll: true });
|
|
82
83
|
layoutMode === 'deck' && focusable?.scrollIntoView({ behavior: 'smooth', inline: 'center' });
|
|
83
84
|
// Clear the scroll into view state once it has been actioned.
|
|
84
|
-
void dispatch(
|
|
85
|
+
void dispatch(createIntent(LayoutAction.ScrollIntoView, { id: undefined }));
|
|
85
86
|
}
|
|
86
87
|
}, [coordinate.entryId, scrollIntoView, layoutMode]);
|
|
87
88
|
|
|
@@ -93,7 +94,8 @@ export const Plank = memo(({ entry, layoutParts, part, layoutMode, order }: Plan
|
|
|
93
94
|
const data = useMemo(
|
|
94
95
|
() =>
|
|
95
96
|
node && {
|
|
96
|
-
|
|
97
|
+
subject: node.data,
|
|
98
|
+
path: entry?.path,
|
|
97
99
|
coordinate,
|
|
98
100
|
popoverAnchorId,
|
|
99
101
|
},
|
|
@@ -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,
|
|
@@ -16,8 +17,7 @@ import {
|
|
|
16
17
|
|
|
17
18
|
import { DECK_PLUGIN } from '../../meta';
|
|
18
19
|
|
|
19
|
-
export type
|
|
20
|
-
export type PlankControlHandler = (event: PlankControlEvent) => void;
|
|
20
|
+
export type PlankControlHandler = (event: PartAdjustment) => void;
|
|
21
21
|
|
|
22
22
|
export type PlankCapabilities = {
|
|
23
23
|
incrementStart?: boolean;
|
|
@@ -44,9 +44,7 @@ const PlankControl = ({ icon, label, ...props }: Omit<ButtonProps, 'children'> &
|
|
|
44
44
|
</Button>
|
|
45
45
|
</Tooltip.Trigger>
|
|
46
46
|
<Tooltip.Portal>
|
|
47
|
-
<Tooltip.Content side='bottom'
|
|
48
|
-
{label}
|
|
49
|
-
</Tooltip.Content>
|
|
47
|
+
<Tooltip.Content side='bottom'>{label}</Tooltip.Content>
|
|
50
48
|
</Tooltip.Portal>
|
|
51
49
|
</Tooltip.Root>
|
|
52
50
|
);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type LayoutParts,
|
|
7
|
+
import { type LayoutParts, Surface } from '@dxos/app-framework';
|
|
8
8
|
import { Main } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
10
|
import { useLayout } from '../LayoutContext';
|
|
@@ -14,29 +14,12 @@ export type SidebarProps = {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export const Sidebar = ({ layoutParts }: SidebarProps) => {
|
|
17
|
-
const {
|
|
17
|
+
const { popoverAnchorId } = useLayout();
|
|
18
|
+
const navigationData = useMemo(() => ({ popoverAnchorId }), [popoverAnchorId]);
|
|
18
19
|
|
|
19
|
-
// TODO(wittjosiah): The activeIds should be path-based to avoid conflicts.
|
|
20
|
-
const activeIds = useMemo(() => {
|
|
21
|
-
if (layoutMode === 'solo') {
|
|
22
|
-
return Array.from(new Set<string>(layoutParts?.solo?.map((e) => e.id) ?? []));
|
|
23
|
-
} else if (layoutMode === 'deck') {
|
|
24
|
-
return Array.from(new Set<string>(layoutParts?.main?.map((e) => e.id) ?? []));
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return Array.from(new Set<string>(openIds(layoutParts)));
|
|
28
|
-
}, [layoutParts, layoutMode]);
|
|
29
|
-
|
|
30
|
-
const navigationData = useMemo(
|
|
31
|
-
() => ({
|
|
32
|
-
popoverAnchorId,
|
|
33
|
-
activeIds,
|
|
34
|
-
}),
|
|
35
|
-
[popoverAnchorId, activeIds],
|
|
36
|
-
);
|
|
37
20
|
return (
|
|
38
21
|
<Main.NavigationSidebar>
|
|
39
|
-
<Surface role='navigation' data={
|
|
22
|
+
<Surface role='navigation' data={navigationData} limit={1} />
|
|
40
23
|
</Main.NavigationSidebar>
|
|
41
24
|
);
|
|
42
25
|
};
|
|
@@ -5,7 +5,16 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import type { Toast as ToastProps } from '@dxos/app-framework';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
Button,
|
|
10
|
+
Icon,
|
|
11
|
+
Toast as NaturalToast,
|
|
12
|
+
toLocalizedString,
|
|
13
|
+
useTranslation,
|
|
14
|
+
type ToastRootProps,
|
|
15
|
+
} from '@dxos/react-ui';
|
|
16
|
+
|
|
17
|
+
import { DECK_PLUGIN } from '../../meta';
|
|
9
18
|
|
|
10
19
|
// TODO(wittjosiah): Render remaining duration as a progress bar within the toast.
|
|
11
20
|
export const Toast = ({
|
|
@@ -20,26 +29,30 @@ export const Toast = ({
|
|
|
20
29
|
onAction,
|
|
21
30
|
onOpenChange,
|
|
22
31
|
}: ToastProps & Pick<ToastRootProps, 'onOpenChange'>) => {
|
|
32
|
+
const { t } = useTranslation(DECK_PLUGIN);
|
|
33
|
+
|
|
23
34
|
return (
|
|
24
35
|
<NaturalToast.Root data-testid={id} defaultOpen duration={duration} onOpenChange={onOpenChange}>
|
|
25
36
|
<NaturalToast.Body>
|
|
26
37
|
<NaturalToast.Title classNames='items-center'>
|
|
27
38
|
{icon && <Icon icon={icon} size={5} classNames='inline mr-1' />}
|
|
28
|
-
<span>{title}</span>
|
|
39
|
+
{title && <span>{toLocalizedString(title, t)}</span>}
|
|
29
40
|
</NaturalToast.Title>
|
|
30
|
-
{description &&
|
|
41
|
+
{description && (
|
|
42
|
+
<NaturalToast.Description>{description && toLocalizedString(description, t)}</NaturalToast.Description>
|
|
43
|
+
)}
|
|
31
44
|
</NaturalToast.Body>
|
|
32
45
|
<NaturalToast.Actions>
|
|
33
46
|
{onAction && actionAlt && actionLabel && (
|
|
34
|
-
<NaturalToast.Action altText={actionAlt} asChild>
|
|
47
|
+
<NaturalToast.Action altText={toLocalizedString(actionAlt, t)} asChild>
|
|
35
48
|
<Button data-testid='toast.action' variant='primary' onClick={() => onAction?.()}>
|
|
36
|
-
{actionLabel}
|
|
49
|
+
{toLocalizedString(actionLabel, t)}
|
|
37
50
|
</Button>
|
|
38
51
|
</NaturalToast.Action>
|
|
39
52
|
)}
|
|
40
53
|
{closeLabel && (
|
|
41
54
|
<NaturalToast.Close asChild>
|
|
42
|
-
<Button data-testid='toast.close'>{closeLabel}</Button>
|
|
55
|
+
<Button data-testid='toast.close'>{toLocalizedString(closeLabel, t)}</Button>
|
|
43
56
|
</NaturalToast.Close>
|
|
44
57
|
)}
|
|
45
58
|
</NaturalToast.Actions>
|
package/src/translations.ts
CHANGED
|
@@ -48,6 +48,9 @@ export default [
|
|
|
48
48
|
'settings overscroll centering label': 'Centering',
|
|
49
49
|
'settings overscroll none label': 'None',
|
|
50
50
|
'settings flat deck': 'Flatten deck appearance',
|
|
51
|
+
'close current label': 'Close current plank',
|
|
52
|
+
'close others label': 'Close other planks',
|
|
53
|
+
'close all label': 'Close all planks',
|
|
51
54
|
},
|
|
52
55
|
},
|
|
53
56
|
},
|
package/src/types.ts
CHANGED
|
@@ -12,8 +12,11 @@ import type {
|
|
|
12
12
|
SurfaceProvides,
|
|
13
13
|
TranslationsProvides,
|
|
14
14
|
} from '@dxos/app-framework';
|
|
15
|
+
import { S } from '@dxos/echo-schema';
|
|
15
16
|
import { type Label } from '@dxos/react-ui';
|
|
16
17
|
|
|
18
|
+
import { DECK_PLUGIN } from './meta';
|
|
19
|
+
|
|
17
20
|
// TODO(Zan): In the future we should consider adding new planks adjacent to the attended plank.
|
|
18
21
|
export const NewPlankPositions = ['start', 'end'] as const;
|
|
19
22
|
export type NewPlankPositioning = (typeof NewPlankPositions)[number];
|
|
@@ -51,3 +54,15 @@ export type DeckPluginProvides = SurfaceProvides &
|
|
|
51
54
|
SettingsProvides<DeckSettingsProps> &
|
|
52
55
|
LayoutProvides &
|
|
53
56
|
LocationProvides;
|
|
57
|
+
|
|
58
|
+
export const DECK_ACTION = `${DECK_PLUGIN}/action`;
|
|
59
|
+
|
|
60
|
+
export namespace DeckAction {
|
|
61
|
+
export class UpdatePlankSize extends S.TaggedClass<UpdatePlankSize>()(`${DECK_ACTION}/update-plank-size`, {
|
|
62
|
+
input: S.Struct({
|
|
63
|
+
id: S.String,
|
|
64
|
+
size: S.Number,
|
|
65
|
+
}),
|
|
66
|
+
output: S.Void,
|
|
67
|
+
}) {}
|
|
68
|
+
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// packages/plugins/plugin-deck/src/types.ts
|
|
2
|
-
var NewPlankPositions = [
|
|
3
|
-
"start",
|
|
4
|
-
"end"
|
|
5
|
-
];
|
|
6
|
-
var OverscrollOptions = [
|
|
7
|
-
"none",
|
|
8
|
-
"centering"
|
|
9
|
-
];
|
|
10
|
-
var parsePanelPlugin = (plugin) => Array.isArray(plugin?.provides.complementary?.panels) ? plugin : void 0;
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
NewPlankPositions,
|
|
14
|
-
OverscrollOptions,
|
|
15
|
-
parsePanelPlugin
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=chunk-NIRHDTX4.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport type {\n Plugin,\n GraphBuilderProvides,\n IntentResolverProvides,\n LayoutProvides,\n LocationProvides,\n SettingsProvides,\n SurfaceProvides,\n TranslationsProvides,\n} from '@dxos/app-framework';\nimport { type Label } from '@dxos/react-ui';\n\n// TODO(Zan): In the future we should consider adding new planks adjacent to the attended plank.\nexport const NewPlankPositions = ['start', 'end'] as const;\nexport type NewPlankPositioning = (typeof NewPlankPositions)[number];\n\nexport const OverscrollOptions = ['none', 'centering'] as const;\nexport type Overscroll = (typeof OverscrollOptions)[number];\n\n// TODO(wittjosiah): Include a predicate for whether the panel is visible for the current subject.\nexport type Panel = { id: string; label: Label; icon: string };\n\n// TODO(wittjosiah): Is this generic enough to be in the app framework?\nexport type PanelProvides = {\n complementary: {\n panels: Panel[];\n };\n};\n\nexport const parsePanelPlugin = (plugin?: Plugin) =>\n Array.isArray((plugin?.provides as any).complementary?.panels) ? (plugin as Plugin<PanelProvides>) : undefined;\n\nexport type DeckSettingsProps = {\n showHints: boolean;\n customSlots: boolean;\n flatDeck: boolean;\n enableNativeRedirect: boolean;\n disableDeck: boolean;\n newPlankPositioning: NewPlankPositioning;\n overscroll: Overscroll;\n};\n\nexport type DeckPluginProvides = SurfaceProvides &\n IntentResolverProvides &\n GraphBuilderProvides &\n TranslationsProvides &\n SettingsProvides<DeckSettingsProps> &\n LayoutProvides &\n LocationProvides;\n"],
|
|
5
|
-
"mappings": ";AAiBO,IAAMA,oBAAoB;EAAC;EAAS;;AAGpC,IAAMC,oBAAoB;EAAC;EAAQ;;AAanC,IAAMC,mBAAmB,CAACC,WAC/BC,MAAMC,QAASF,QAAQG,SAAiBC,eAAeC,MAAAA,IAAWL,SAAmCM;",
|
|
6
|
-
"names": ["NewPlankPositions", "OverscrollOptions", "parsePanelPlugin", "plugin", "Array", "isArray", "provides", "complementary", "panels", "undefined"]
|
|
7
|
-
}
|