@dxos/plugin-deck 0.7.5-main.9d2a38b → 0.7.5-main.e9bb01b
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-67VRUD5K.mjs → app-graph-builder-CI6ZFMNL.mjs} +57 -31
- package/dist/lib/browser/app-graph-builder-CI6ZFMNL.mjs.map +7 -0
- package/dist/lib/browser/{check-app-scheme-GEX6W2R5.mjs → check-app-scheme-S3EYUPMF.mjs} +3 -3
- package/dist/lib/browser/{check-app-scheme-GEX6W2R5.mjs.map → check-app-scheme-S3EYUPMF.mjs.map} +2 -2
- package/dist/lib/browser/chunk-M2L53AIH.mjs +126 -0
- package/dist/lib/browser/chunk-M2L53AIH.mjs.map +7 -0
- package/dist/lib/browser/{chunk-JQJ5UWVB.mjs → chunk-N7TEPFVR.mjs} +3 -2
- package/dist/lib/browser/{chunk-JQJ5UWVB.mjs.map → chunk-N7TEPFVR.mjs.map} +3 -3
- package/dist/lib/browser/chunk-NYZJCVAU.mjs +22 -0
- package/dist/lib/browser/chunk-NYZJCVAU.mjs.map +7 -0
- package/dist/lib/browser/chunk-WXNLVMK2.mjs +1119 -0
- package/dist/lib/browser/chunk-WXNLVMK2.mjs.map +7 -0
- package/dist/lib/browser/{chunk-5VFDMW5M.mjs → chunk-YQ2GWTDU.mjs} +2 -2
- package/dist/lib/browser/chunk-YQ2GWTDU.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +32 -78
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-CSXFDKTC.mjs +494 -0
- package/dist/lib/browser/intent-resolver-CSXFDKTC.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-UL7ZDRVZ.mjs → react-root-ECDQZYQT.mjs} +10 -14
- package/dist/lib/browser/react-root-ECDQZYQT.mjs.map +7 -0
- package/dist/lib/browser/react-surface-4WIQZW2S.mjs +38 -0
- package/dist/lib/browser/react-surface-4WIQZW2S.mjs.map +7 -0
- package/dist/lib/browser/{settings-FNWW6WIJ.mjs → settings-WACNLCPB.mjs} +6 -7
- package/dist/lib/browser/settings-WACNLCPB.mjs.map +7 -0
- package/dist/lib/browser/state-VPOYUKK6.mjs +117 -0
- package/dist/lib/browser/state-VPOYUKK6.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +16 -4
- package/dist/lib/browser/url-handler-HLF42IHP.mjs +70 -0
- package/dist/lib/browser/url-handler-HLF42IHP.mjs.map +7 -0
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/{layout/app-graph-builder.d.ts → app-graph-builder.d.ts} +22 -22
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +132 -3
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/check-app-scheme.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +187 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/set-active.d.ts +9 -0
- package/dist/types/src/capabilities/set-active.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +76 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/url-handler.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 +1 -4
- 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 +8 -6
- 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 +4 -3
- 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 +5 -3
- 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/fragments.d.ts +2 -0
- package/dist/types/src/components/fragments.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -2
- 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 +5 -19
- package/dist/types/src/layout.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -0
- 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 +107 -2
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +2 -1
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/layoutAppliesTopbar.d.ts +2 -0
- package/dist/types/src/util/layoutAppliesTopbar.d.ts.map +1 -0
- package/dist/types/src/util/useHoistStatusbar.d.ts.map +1 -1
- package/package.json +30 -30
- package/src/DeckPlugin.ts +12 -58
- package/src/capabilities/{layout/app-graph-builder.ts → app-graph-builder.ts} +36 -28
- package/src/capabilities/capabilities.ts +4 -3
- package/src/capabilities/{navigation/check-app-scheme.ts → check-app-scheme.ts} +2 -2
- package/src/capabilities/index.ts +11 -3
- package/src/capabilities/intent-resolver.ts +350 -0
- package/src/capabilities/{layout/react-root.tsx → react-root.tsx} +7 -11
- package/src/capabilities/react-surface.tsx +31 -0
- package/src/capabilities/set-active.ts +43 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +4 -5
- package/src/capabilities/state.ts +102 -0
- package/src/capabilities/url-handler.ts +63 -0
- package/src/components/DeckLayout/ActiveNode.tsx +2 -3
- package/src/components/DeckLayout/ComplementarySidebar.tsx +118 -67
- package/src/components/DeckLayout/ContentEmpty.tsx +7 -10
- package/src/components/DeckLayout/DeckLayout.tsx +103 -61
- package/src/components/DeckLayout/Fullscreen.tsx +2 -3
- package/src/components/DeckLayout/NodePlankHeading.tsx +57 -65
- package/src/components/DeckLayout/Plank.tsx +32 -41
- package/src/components/DeckLayout/PlankControls.tsx +11 -10
- package/src/components/DeckLayout/PlankError.tsx +6 -5
- package/src/components/DeckLayout/Sidebar.tsx +17 -20
- package/src/components/DeckLayout/SidebarButton.tsx +25 -31
- package/src/components/DeckLayout/StatusBar.tsx +5 -11
- package/src/components/DeckLayout/Toast.tsx +2 -2
- package/src/components/LayoutSettings.tsx +8 -8
- package/src/components/fragments.ts +8 -0
- package/src/components/index.ts +0 -2
- package/src/hooks/useMainSize.ts +3 -3
- package/src/layout.ts +43 -212
- package/src/meta.ts +1 -0
- package/src/translations.ts +8 -8
- package/src/types.ts +88 -2
- package/src/util/index.ts +2 -1
- package/src/util/layoutAppliesTopbar.ts +7 -0
- package/src/util/useHoistStatusbar.ts +17 -8
- package/dist/lib/browser/app-graph-builder-67VRUD5K.mjs.map +0 -7
- package/dist/lib/browser/chunk-2M4PXYNB.mjs +0 -1052
- package/dist/lib/browser/chunk-2M4PXYNB.mjs.map +0 -7
- package/dist/lib/browser/chunk-2PJNBVCY.mjs +0 -39
- package/dist/lib/browser/chunk-2PJNBVCY.mjs.map +0 -7
- package/dist/lib/browser/chunk-4C2AFTET.mjs +0 -186
- package/dist/lib/browser/chunk-4C2AFTET.mjs.map +0 -7
- package/dist/lib/browser/chunk-5VFDMW5M.mjs.map +0 -7
- package/dist/lib/browser/chunk-KY5WXIXY.mjs +0 -44
- package/dist/lib/browser/chunk-KY5WXIXY.mjs.map +0 -7
- package/dist/lib/browser/deck-PLCSKPGL.mjs +0 -26
- package/dist/lib/browser/deck-PLCSKPGL.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-FVOQSTBX.mjs +0 -152
- package/dist/lib/browser/intent-resolver-FVOQSTBX.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-K7GW4A2I.mjs +0 -249
- package/dist/lib/browser/intent-resolver-K7GW4A2I.mjs.map +0 -7
- package/dist/lib/browser/location-QHRBQBQN.mjs +0 -35
- package/dist/lib/browser/location-QHRBQBQN.mjs.map +0 -7
- package/dist/lib/browser/react-context-3BDW7W2N.mjs +0 -32
- package/dist/lib/browser/react-context-3BDW7W2N.mjs.map +0 -7
- package/dist/lib/browser/react-root-UL7ZDRVZ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-VPNOGGNN.mjs +0 -28
- package/dist/lib/browser/react-surface-VPNOGGNN.mjs.map +0 -7
- package/dist/lib/browser/settings-FNWW6WIJ.mjs.map +0 -7
- package/dist/lib/browser/state-7I5BD7SE.mjs +0 -34
- package/dist/lib/browser/state-7I5BD7SE.mjs.map +0 -7
- package/dist/lib/browser/url-handler-Z5B7LD3N.mjs +0 -76
- package/dist/lib/browser/url-handler-Z5B7LD3N.mjs.map +0 -7
- package/dist/types/src/capabilities/layout/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/layout/deck.d.ts +0 -4
- package/dist/types/src/capabilities/layout/deck.d.ts.map +0 -1
- package/dist/types/src/capabilities/layout/index.d.ts +0 -229
- package/dist/types/src/capabilities/layout/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/layout/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/layout/react-context.d.ts +0 -8
- package/dist/types/src/capabilities/layout/react-context.d.ts.map +0 -1
- package/dist/types/src/capabilities/layout/react-root.d.ts.map +0 -1
- package/dist/types/src/capabilities/layout/state.d.ts +0 -42
- package/dist/types/src/capabilities/layout/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation/check-app-scheme.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation/index.d.ts +0 -5
- package/dist/types/src/capabilities/navigation/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/navigation/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation/location.d.ts +0 -4
- package/dist/types/src/capabilities/navigation/location.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation/set-location.d.ts +0 -10
- package/dist/types/src/capabilities/navigation/set-location.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation/url-handler.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -3
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
- package/dist/types/src/components/DeckContext.d.ts +0 -11
- package/dist/types/src/components/DeckContext.d.ts.map +0 -1
- package/dist/types/src/components/LayoutContext.d.ts +0 -5
- package/dist/types/src/components/LayoutContext.d.ts.map +0 -1
- package/dist/types/src/layout.test.d.ts +0 -2
- package/dist/types/src/layout.test.d.ts.map +0 -1
- package/dist/types/src/util/layout-parts.d.ts +0 -7
- package/dist/types/src/util/layout-parts.d.ts.map +0 -1
- package/src/capabilities/layout/deck.ts +0 -25
- package/src/capabilities/layout/index.ts +0 -12
- package/src/capabilities/layout/intent-resolver.ts +0 -128
- package/src/capabilities/layout/react-context.tsx +0 -26
- package/src/capabilities/layout/state.ts +0 -32
- package/src/capabilities/navigation/index.ts +0 -10
- package/src/capabilities/navigation/intent-resolver.ts +0 -216
- package/src/capabilities/navigation/location.ts +0 -28
- package/src/capabilities/navigation/set-location.ts +0 -38
- package/src/capabilities/navigation/url-handler.ts +0 -67
- package/src/capabilities/settings/index.ts +0 -8
- package/src/capabilities/settings/react-surface.tsx +0 -23
- package/src/components/DeckContext.ts +0 -19
- package/src/components/LayoutContext.ts +0 -12
- package/src/layout.test.ts +0 -380
- package/src/util/layout-parts.ts +0 -12
- /package/dist/types/src/capabilities/{navigation/check-app-scheme.d.ts → check-app-scheme.d.ts} +0 -0
- /package/dist/types/src/capabilities/{layout/intent-resolver.d.ts → intent-resolver.d.ts} +0 -0
- /package/dist/types/src/capabilities/{layout/react-root.d.ts → react-root.d.ts} +0 -0
- /package/dist/types/src/capabilities/{settings/react-surface.d.ts → react-surface.d.ts} +0 -0
- /package/dist/types/src/capabilities/{settings/settings.d.ts → settings.d.ts} +0 -0
- /package/dist/types/src/capabilities/{navigation/url-handler.d.ts → url-handler.d.ts} +0 -0
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { lazy } from '@dxos/app-framework';
|
|
6
|
-
|
|
7
|
-
export const DeckState = lazy(() => import('./deck'));
|
|
8
|
-
export const AppGraphBuilder = lazy(() => import('./app-graph-builder'));
|
|
9
|
-
export const LayoutIntentResolver = lazy(() => import('./intent-resolver'));
|
|
10
|
-
export const LayoutState = lazy(() => import('./state'));
|
|
11
|
-
export const ReactContext = lazy(() => import('./react-context'));
|
|
12
|
-
export const ReactRoot = lazy(() => import('./react-root'));
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { batch } from '@preact/signals-core';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
Capabilities,
|
|
9
|
-
createResolver,
|
|
10
|
-
contributes,
|
|
11
|
-
IntentAction,
|
|
12
|
-
LayoutAction,
|
|
13
|
-
openIds,
|
|
14
|
-
Toast as ToastSchema,
|
|
15
|
-
type LayoutMode,
|
|
16
|
-
type PluginsContext,
|
|
17
|
-
} from '@dxos/app-framework';
|
|
18
|
-
import { S } from '@dxos/echo-schema';
|
|
19
|
-
import { log } from '@dxos/log';
|
|
20
|
-
|
|
21
|
-
import { DECK_PLUGIN } from '../../meta';
|
|
22
|
-
import { DeckAction } from '../../types';
|
|
23
|
-
import { DeckCapabilities } from '../capabilities';
|
|
24
|
-
|
|
25
|
-
export default (context: PluginsContext) =>
|
|
26
|
-
contributes(Capabilities.IntentResolver, [
|
|
27
|
-
createResolver(DeckAction.UpdatePlankSize, (data) => {
|
|
28
|
-
const deck = context.requestCapability(DeckCapabilities.MutableDeckState);
|
|
29
|
-
deck.plankSizing[data.id] = data.size;
|
|
30
|
-
}),
|
|
31
|
-
createResolver(IntentAction.ShowUndo, (data) => {
|
|
32
|
-
const deck = context.requestCapability(DeckCapabilities.MutableDeckState);
|
|
33
|
-
const layout = context.requestCapability(Capabilities.MutableLayout);
|
|
34
|
-
const { undoPromise: undo } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
35
|
-
|
|
36
|
-
// TODO(wittjosiah): Support undoing further back than the last action.
|
|
37
|
-
if (deck.currentUndoId) {
|
|
38
|
-
layout.toasts = layout.toasts.filter((toast) => toast.id !== deck.currentUndoId);
|
|
39
|
-
}
|
|
40
|
-
deck.currentUndoId = `${IntentAction.ShowUndo._tag}-${Date.now()}`;
|
|
41
|
-
layout.toasts = [
|
|
42
|
-
...layout.toasts,
|
|
43
|
-
{
|
|
44
|
-
id: deck.currentUndoId,
|
|
45
|
-
title: data.message ?? ['undo available label', { ns: DECK_PLUGIN }],
|
|
46
|
-
duration: 10_000,
|
|
47
|
-
actionLabel: ['undo action label', { ns: DECK_PLUGIN }],
|
|
48
|
-
actionAlt: ['undo action alt', { ns: DECK_PLUGIN }],
|
|
49
|
-
closeLabel: ['undo close label', { ns: DECK_PLUGIN }],
|
|
50
|
-
onAction: () => undo(),
|
|
51
|
-
},
|
|
52
|
-
];
|
|
53
|
-
}),
|
|
54
|
-
createResolver(
|
|
55
|
-
LayoutAction.SetLayout,
|
|
56
|
-
({ element, state, component, subject, anchorId, dialogBlockAlign, dialogType }) => {
|
|
57
|
-
const layout = context.requestCapability(Capabilities.MutableLayout);
|
|
58
|
-
switch (element) {
|
|
59
|
-
case 'sidebar': {
|
|
60
|
-
layout.sidebarOpen = state ?? !layout.sidebarOpen;
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
case 'complementary': {
|
|
65
|
-
layout.complementarySidebarOpen = !!state;
|
|
66
|
-
// TODO(thure): Hoist content into the c11y sidebar of Deck.
|
|
67
|
-
// layout.complementarySidebarContent = component || subject ? { component, subject } : null;
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
case 'dialog': {
|
|
72
|
-
layout.dialogOpen = state ?? Boolean(component);
|
|
73
|
-
layout.dialogContent = component ? { component, subject } : null;
|
|
74
|
-
layout.dialogBlockAlign = dialogBlockAlign ?? 'center';
|
|
75
|
-
layout.dialogType = dialogType;
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
case 'popover': {
|
|
80
|
-
layout.popoverOpen = state ?? Boolean(component);
|
|
81
|
-
layout.popoverContent = component ? { component, subject } : null;
|
|
82
|
-
layout.popoverAnchorId = anchorId;
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
case 'toast': {
|
|
87
|
-
if (S.is(ToastSchema)(subject)) {
|
|
88
|
-
layout.toasts = [...layout.toasts, subject];
|
|
89
|
-
}
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
),
|
|
95
|
-
createResolver(LayoutAction.SetLayoutMode, (data) => {
|
|
96
|
-
const layout = context.requestCapability(Capabilities.MutableLayout);
|
|
97
|
-
const location = context.requestCapability(Capabilities.MutableLocation);
|
|
98
|
-
const deck = context.requestCapability(DeckCapabilities.MutableDeckState);
|
|
99
|
-
|
|
100
|
-
const setMode = (mode: LayoutMode) => {
|
|
101
|
-
const main = openIds(location.active, ['main']);
|
|
102
|
-
const solo = openIds(location.active, ['solo']);
|
|
103
|
-
const current = layout.layoutMode === 'solo' ? solo : main;
|
|
104
|
-
// When un-soloing, the solo entry is added to the deck.
|
|
105
|
-
const next = mode === 'solo' ? solo : [...main, ...solo];
|
|
106
|
-
const removed = current.filter((id) => !next.includes(id));
|
|
107
|
-
const closed = Array.from(new Set([...location.closed.filter((id) => !next.includes(id)), ...removed]));
|
|
108
|
-
|
|
109
|
-
location.closed = closed;
|
|
110
|
-
layout.layoutMode = mode;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
return batch(() => {
|
|
114
|
-
if ('layoutMode' in data) {
|
|
115
|
-
deck.layoutModeHistory.push(layout.layoutMode);
|
|
116
|
-
setMode(data.layoutMode);
|
|
117
|
-
} else if (data.revert) {
|
|
118
|
-
setMode(deck.layoutModeHistory.pop() ?? 'solo');
|
|
119
|
-
} else {
|
|
120
|
-
log.warn('Invalid layout mode', data);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
}),
|
|
124
|
-
createResolver(LayoutAction.ScrollIntoView, ({ id }) => {
|
|
125
|
-
const layout = context.requestCapability(Capabilities.MutableLayout);
|
|
126
|
-
layout.scrollIntoView = id;
|
|
127
|
-
}),
|
|
128
|
-
]);
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type PropsWithChildren } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Capabilities, contributes, useCapability } from '@dxos/app-framework';
|
|
8
|
-
|
|
9
|
-
import { DeckContext, LayoutContext } from '../../components';
|
|
10
|
-
import { DECK_PLUGIN } from '../../meta';
|
|
11
|
-
import { DeckCapabilities } from '../capabilities';
|
|
12
|
-
|
|
13
|
-
export default () =>
|
|
14
|
-
contributes(Capabilities.ReactContext, {
|
|
15
|
-
id: DECK_PLUGIN,
|
|
16
|
-
context: (props: PropsWithChildren) => {
|
|
17
|
-
const layout = useCapability(Capabilities.Layout);
|
|
18
|
-
const deck = useCapability(DeckCapabilities.MutableDeckState);
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<LayoutContext.Provider value={layout}>
|
|
22
|
-
<DeckContext.Provider value={deck}>{props.children}</DeckContext.Provider>
|
|
23
|
-
</LayoutContext.Provider>
|
|
24
|
-
);
|
|
25
|
-
},
|
|
26
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Capabilities, contributes, type LayoutMode, type Layout } from '@dxos/app-framework';
|
|
6
|
-
import { LocalStorageStore } from '@dxos/local-storage';
|
|
7
|
-
|
|
8
|
-
// NOTE: The key is this currently for backwards compatibility of storage.
|
|
9
|
-
const LAYOUT_KEY = 'dxos.org/settings/layout';
|
|
10
|
-
|
|
11
|
-
export default () => {
|
|
12
|
-
const layout = new LocalStorageStore<Layout>(LAYOUT_KEY, {
|
|
13
|
-
layoutMode: 'solo',
|
|
14
|
-
sidebarOpen: true,
|
|
15
|
-
complementarySidebarOpen: false,
|
|
16
|
-
dialogContent: null,
|
|
17
|
-
dialogOpen: false,
|
|
18
|
-
dialogBlockAlign: undefined,
|
|
19
|
-
dialogType: undefined,
|
|
20
|
-
popoverContent: null,
|
|
21
|
-
popoverAnchorId: undefined,
|
|
22
|
-
popoverOpen: false,
|
|
23
|
-
toasts: [],
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
layout
|
|
27
|
-
.prop({ key: 'layoutMode', type: LocalStorageStore.enum<LayoutMode>() })
|
|
28
|
-
.prop({ key: 'sidebarOpen', type: LocalStorageStore.bool() })
|
|
29
|
-
.prop({ key: 'complementarySidebarOpen', type: LocalStorageStore.bool() });
|
|
30
|
-
|
|
31
|
-
return contributes(Capabilities.Layout, layout.values, () => layout.close());
|
|
32
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { lazy } from '@dxos/app-framework';
|
|
6
|
-
|
|
7
|
-
export const CheckAppScheme = lazy(() => import('./check-app-scheme'));
|
|
8
|
-
export const LocationState = lazy(() => import('./location'));
|
|
9
|
-
export const NavigationIntentResolver = lazy(() => import('./intent-resolver'));
|
|
10
|
-
export const UrlHandler = lazy(() => import('./url-handler'));
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { batch } from '@preact/signals-core';
|
|
6
|
-
import { pipe } from 'effect';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
Capabilities,
|
|
10
|
-
chain,
|
|
11
|
-
contributes,
|
|
12
|
-
createIntent,
|
|
13
|
-
createResolver,
|
|
14
|
-
LayoutAction,
|
|
15
|
-
NavigationAction,
|
|
16
|
-
openIds,
|
|
17
|
-
SLUG_PATH_SEPARATOR,
|
|
18
|
-
type LayoutEntry,
|
|
19
|
-
type LayoutPart,
|
|
20
|
-
type PluginsContext,
|
|
21
|
-
} from '@dxos/app-framework';
|
|
22
|
-
import { isReactiveObject, getTypename } from '@dxos/live-object';
|
|
23
|
-
import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
24
|
-
import { ObservabilityAction } from '@dxos/plugin-observability/types';
|
|
25
|
-
|
|
26
|
-
import { setLocation } from './set-location';
|
|
27
|
-
import { closeEntry, incrementPlank, openEntry } from '../../layout';
|
|
28
|
-
import { DECK_PLUGIN } from '../../meta';
|
|
29
|
-
import { type DeckSettingsProps } from '../../types';
|
|
30
|
-
import { getEffectivePart } from '../../util';
|
|
31
|
-
|
|
32
|
-
// TODO(wittjosiah): Factor out navgiation from deck plugin.
|
|
33
|
-
export default (context: PluginsContext) =>
|
|
34
|
-
contributes(Capabilities.IntentResolver, [
|
|
35
|
-
createResolver(NavigationAction.Open, (data) => {
|
|
36
|
-
const { graph } = context.requestCapability(Capabilities.AppGraph);
|
|
37
|
-
const location = context.requestCapability(Capabilities.MutableLocation);
|
|
38
|
-
const layout = context.requestCapability(Capabilities.MutableLayout);
|
|
39
|
-
const attention = context.requestCapability(AttentionCapabilities.Attention);
|
|
40
|
-
const settings = context
|
|
41
|
-
.requestCapabilities(Capabilities.SettingsStore)[0]
|
|
42
|
-
?.getStore<DeckSettingsProps>(DECK_PLUGIN)?.value;
|
|
43
|
-
|
|
44
|
-
const previouslyOpenIds = new Set<string>(openIds(location.active));
|
|
45
|
-
const layoutMode = layout.layoutMode;
|
|
46
|
-
const toAttend = batch(() => {
|
|
47
|
-
const processLayoutEntry = (partName: string, entryString: string, currentLayout: any) => {
|
|
48
|
-
// TODO(burdon): Option to toggle?
|
|
49
|
-
const toggle = false;
|
|
50
|
-
const [id, path] = entryString.split(SLUG_PATH_SEPARATOR);
|
|
51
|
-
const layoutEntry: LayoutEntry = { id, ...(path ? { path } : {}) };
|
|
52
|
-
const effectivePart = getEffectivePart(partName as LayoutPart, layoutMode);
|
|
53
|
-
if (
|
|
54
|
-
toggle &&
|
|
55
|
-
layoutMode === 'deck' &&
|
|
56
|
-
effectivePart === 'main' &&
|
|
57
|
-
currentLayout[effectivePart]?.some((entry: LayoutEntry) => entry.id === id) &&
|
|
58
|
-
!data?.noToggle
|
|
59
|
-
) {
|
|
60
|
-
// If we're in deck mode and the main part is already open, toggle it closed.
|
|
61
|
-
return closeEntry(currentLayout, { part: effectivePart as LayoutPart, entryId: id });
|
|
62
|
-
} else {
|
|
63
|
-
return openEntry(currentLayout, effectivePart, layoutEntry, {
|
|
64
|
-
positioning: settings?.newPlankPositioning,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
let newLayout = location.active;
|
|
70
|
-
Object.entries(data.activeParts).forEach(([partName, layoutEntries]) => {
|
|
71
|
-
if (Array.isArray(layoutEntries)) {
|
|
72
|
-
layoutEntries.forEach((activePartEntry: string) => {
|
|
73
|
-
newLayout = processLayoutEntry(partName, activePartEntry, newLayout);
|
|
74
|
-
});
|
|
75
|
-
} else if (typeof layoutEntries === 'string') {
|
|
76
|
-
// Legacy single string entry.
|
|
77
|
-
newLayout = processLayoutEntry(partName, layoutEntries, newLayout);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
return setLocation({ next: newLayout, layout, location, attention });
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
const ids = openIds(location.active);
|
|
85
|
-
const newlyOpen = ids.filter((i) => !previouslyOpenIds.has(i));
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
data: { open: ids },
|
|
89
|
-
intents: [
|
|
90
|
-
createIntent(LayoutAction.ScrollIntoView, { id: newlyOpen[0] ?? toAttend }),
|
|
91
|
-
...(toAttend ? [createIntent(NavigationAction.Expose, { id: toAttend })] : []),
|
|
92
|
-
...newlyOpen.map((id) => {
|
|
93
|
-
const active = graph?.findNode(id)?.data;
|
|
94
|
-
const typename = isReactiveObject(active) ? getTypename(active) : undefined;
|
|
95
|
-
return createIntent(ObservabilityAction.SendEvent, {
|
|
96
|
-
name: 'navigation.activate',
|
|
97
|
-
properties: {
|
|
98
|
-
id,
|
|
99
|
-
typename,
|
|
100
|
-
},
|
|
101
|
-
});
|
|
102
|
-
}),
|
|
103
|
-
],
|
|
104
|
-
};
|
|
105
|
-
}),
|
|
106
|
-
createResolver(NavigationAction.AddToActive, (data) => {
|
|
107
|
-
const location = context.requestCapability(Capabilities.MutableLocation);
|
|
108
|
-
const layout = context.requestCapability(Capabilities.MutableLayout);
|
|
109
|
-
const attention = context.requestCapability(AttentionCapabilities.Attention);
|
|
110
|
-
const settings = context
|
|
111
|
-
.requestCapabilities(Capabilities.SettingsStore)[0]
|
|
112
|
-
?.getStore<DeckSettingsProps>(DECK_PLUGIN)?.value;
|
|
113
|
-
|
|
114
|
-
const layoutEntry = { id: data.id };
|
|
115
|
-
const effectivePart = getEffectivePart(data.part, layout.layoutMode);
|
|
116
|
-
|
|
117
|
-
setLocation({
|
|
118
|
-
next: openEntry(location.active, effectivePart, layoutEntry, {
|
|
119
|
-
positioning: data.positioning ?? settings?.newPlankPositioning,
|
|
120
|
-
pivotId: data.pivotId,
|
|
121
|
-
}),
|
|
122
|
-
layout,
|
|
123
|
-
location,
|
|
124
|
-
attention,
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
const intents = [];
|
|
128
|
-
if (data.scrollIntoView && layout.layoutMode === 'deck') {
|
|
129
|
-
intents.push(createIntent(LayoutAction.ScrollIntoView, { id: data.id }));
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return { intents };
|
|
133
|
-
}),
|
|
134
|
-
createResolver(NavigationAction.Close, (data) => {
|
|
135
|
-
const location = context.requestCapability(Capabilities.MutableLocation);
|
|
136
|
-
const layout = context.requestCapability(Capabilities.MutableLayout);
|
|
137
|
-
const attention = context.requestCapability(AttentionCapabilities.Attention);
|
|
138
|
-
|
|
139
|
-
let newLayout = location.active;
|
|
140
|
-
const layoutMode = layout.layoutMode;
|
|
141
|
-
const intentParts = data.activeParts;
|
|
142
|
-
Object.keys(intentParts).forEach((partName: string) => {
|
|
143
|
-
const effectivePart = getEffectivePart(partName as LayoutPart, layoutMode);
|
|
144
|
-
const ids = intentParts[partName];
|
|
145
|
-
if (Array.isArray(ids)) {
|
|
146
|
-
ids.forEach((id: string) => {
|
|
147
|
-
newLayout = closeEntry(newLayout, { part: effectivePart, entryId: id });
|
|
148
|
-
});
|
|
149
|
-
} else {
|
|
150
|
-
// Legacy single string entry
|
|
151
|
-
newLayout = closeEntry(newLayout, { part: effectivePart, entryId: ids });
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
const toAttend = setLocation({ next: newLayout, layout, location, attention });
|
|
156
|
-
return { intents: [createIntent(LayoutAction.ScrollIntoView, { id: toAttend })] };
|
|
157
|
-
}),
|
|
158
|
-
createResolver(NavigationAction.Set, (data) => {
|
|
159
|
-
const layout = context.requestCapability(Capabilities.MutableLayout);
|
|
160
|
-
const location = context.requestCapability(Capabilities.MutableLocation);
|
|
161
|
-
const attention = context.requestCapability(AttentionCapabilities.Attention);
|
|
162
|
-
|
|
163
|
-
return batch(() => {
|
|
164
|
-
const toAttend = setLocation({ next: data.activeParts, layout, location, attention });
|
|
165
|
-
return { intents: [createIntent(LayoutAction.ScrollIntoView, { id: toAttend })] };
|
|
166
|
-
});
|
|
167
|
-
}),
|
|
168
|
-
createResolver(NavigationAction.Adjust, (adjustment) => {
|
|
169
|
-
const location = context.requestCapability(Capabilities.MutableLocation);
|
|
170
|
-
const layout = context.requestCapability(Capabilities.MutableLayout);
|
|
171
|
-
const attention = context.requestCapability(AttentionCapabilities.Attention);
|
|
172
|
-
|
|
173
|
-
return batch(() => {
|
|
174
|
-
if (adjustment.type === 'increment-end' || adjustment.type === 'increment-start') {
|
|
175
|
-
setLocation({
|
|
176
|
-
next: incrementPlank(location.active, {
|
|
177
|
-
type: adjustment.type,
|
|
178
|
-
layoutCoordinate: adjustment.layoutCoordinate,
|
|
179
|
-
}),
|
|
180
|
-
layout,
|
|
181
|
-
location,
|
|
182
|
-
attention,
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if (adjustment.type === 'solo') {
|
|
187
|
-
const entryId = adjustment.layoutCoordinate.entryId;
|
|
188
|
-
if (layout.layoutMode !== 'solo') {
|
|
189
|
-
// Solo the entry.
|
|
190
|
-
return {
|
|
191
|
-
intents: [
|
|
192
|
-
// NOTE: The order of these is important.
|
|
193
|
-
pipe(
|
|
194
|
-
createIntent(NavigationAction.Open, { activeParts: { solo: [entryId] } }),
|
|
195
|
-
chain(LayoutAction.SetLayoutMode, { layoutMode: 'solo' }),
|
|
196
|
-
),
|
|
197
|
-
],
|
|
198
|
-
};
|
|
199
|
-
} else {
|
|
200
|
-
// Un-solo the current entry.
|
|
201
|
-
return {
|
|
202
|
-
intents: [
|
|
203
|
-
// NOTE: The order of these is important.
|
|
204
|
-
pipe(
|
|
205
|
-
createIntent(LayoutAction.SetLayoutMode, { layoutMode: 'deck' }),
|
|
206
|
-
chain(NavigationAction.Close, { activeParts: { solo: [entryId] } }),
|
|
207
|
-
chain(NavigationAction.Open, { activeParts: { main: [entryId] }, noToggle: true }),
|
|
208
|
-
chain(LayoutAction.ScrollIntoView, { id: entryId }),
|
|
209
|
-
),
|
|
210
|
-
],
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
}),
|
|
216
|
-
]);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Capabilities, contributes, type LayoutParts } from '@dxos/app-framework';
|
|
6
|
-
import { LocalStorageStore } from '@dxos/local-storage';
|
|
7
|
-
|
|
8
|
-
import { NAV_ID } from '../../components';
|
|
9
|
-
|
|
10
|
-
// NOTE: The key is this currently for backwards compatibility of storage.
|
|
11
|
-
const LOCATION_KEY = 'dxos.org/settings/layout';
|
|
12
|
-
|
|
13
|
-
export default () => {
|
|
14
|
-
// TODO(wittjosiah): This active state is not a generic navigation state but quite deck specific.
|
|
15
|
-
// It is also closely tied to the layout mode state (which also seems quite deck specific).
|
|
16
|
-
// The layout and navigation interfaces need to be revisited and cleaned up.
|
|
17
|
-
// Doing this cleanup should also help simplify some of the convoluted logic for managing it.
|
|
18
|
-
const location = new LocalStorageStore<Capabilities.MutableLocation>(LOCATION_KEY, {
|
|
19
|
-
active: { sidebar: [{ id: NAV_ID }] },
|
|
20
|
-
closed: [],
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
location
|
|
24
|
-
.prop({ key: 'active', type: LocalStorageStore.json<LayoutParts>() })
|
|
25
|
-
.prop({ key: 'closed', type: LocalStorageStore.json<string[]>() });
|
|
26
|
-
|
|
27
|
-
return contributes(Capabilities.Location, location.values, () => location.close());
|
|
28
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { openIds, type Layout, type LayoutParts, type Capabilities } from '@dxos/app-framework';
|
|
6
|
-
import { type AttentionManager } from '@dxos/plugin-attention';
|
|
7
|
-
|
|
8
|
-
export type SetLocationOptions = {
|
|
9
|
-
next: LayoutParts;
|
|
10
|
-
location: Capabilities.MutableLocation;
|
|
11
|
-
layout: Layout;
|
|
12
|
-
attention?: AttentionManager;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const setLocation = ({ next, location, layout, attention }: SetLocationOptions) => {
|
|
16
|
-
const part = layout.layoutMode === 'solo' ? 'solo' : 'main';
|
|
17
|
-
const ids = openIds(next, [part]);
|
|
18
|
-
|
|
19
|
-
const current = openIds(location.active, [part]);
|
|
20
|
-
const removed = current.filter((id) => !ids.includes(id));
|
|
21
|
-
const closed = Array.from(new Set([...location.closed.filter((id) => !ids.includes(id)), ...removed]));
|
|
22
|
-
|
|
23
|
-
location.closed = closed;
|
|
24
|
-
location.active = next;
|
|
25
|
-
|
|
26
|
-
if (attention) {
|
|
27
|
-
const attended = attention.current;
|
|
28
|
-
const [attendedId] = Array.from(attended);
|
|
29
|
-
const isAttendedAvailable = !!attendedId && ids.includes(attendedId);
|
|
30
|
-
if (!isAttendedAvailable) {
|
|
31
|
-
const currentIds = location.active[part]?.map(({ id }) => id) ?? [];
|
|
32
|
-
const attendedIndex = currentIds.indexOf(attendedId);
|
|
33
|
-
// If outside of bounds, focus on the first/last plank, otherwise focus on the new plank in the same position.
|
|
34
|
-
const index = attendedIndex === -1 ? 0 : attendedIndex >= ids.length ? ids.length - 1 : attendedIndex;
|
|
35
|
-
return next[part]?.[index].id;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
Capabilities,
|
|
7
|
-
contributes,
|
|
8
|
-
createIntent,
|
|
9
|
-
LayoutAction,
|
|
10
|
-
type LayoutParts,
|
|
11
|
-
type PluginsContext,
|
|
12
|
-
} from '@dxos/app-framework';
|
|
13
|
-
import { scheduledEffect } from '@dxos/echo-signals/core';
|
|
14
|
-
import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
15
|
-
|
|
16
|
-
import { setLocation as naturalSetLocation } from './set-location';
|
|
17
|
-
import { NAV_ID } from '../../components';
|
|
18
|
-
import { mergeLayoutParts, removePart, soloPartToUri, uriToSoloPart } from '../../layout';
|
|
19
|
-
|
|
20
|
-
export default async (context: PluginsContext) => {
|
|
21
|
-
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher) ?? {};
|
|
22
|
-
const location = context.requestCapability(Capabilities.MutableLocation);
|
|
23
|
-
const layout = context.requestCapability(Capabilities.MutableLayout);
|
|
24
|
-
const attention = context.requestCapability(AttentionCapabilities.Attention);
|
|
25
|
-
|
|
26
|
-
const handleNavigation = async () => {
|
|
27
|
-
const setLocation = (next: LayoutParts) => naturalSetLocation({ next, layout, location, attention });
|
|
28
|
-
|
|
29
|
-
const pathname = window.location.pathname;
|
|
30
|
-
if (pathname === '/reset') {
|
|
31
|
-
setLocation({ sidebar: [{ id: NAV_ID }] });
|
|
32
|
-
location.closed = [];
|
|
33
|
-
layout.layoutMode = 'solo';
|
|
34
|
-
window.location.pathname = '/';
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const startingLayout = removePart(location.active, 'solo');
|
|
39
|
-
const layoutFromUri = uriToSoloPart(pathname);
|
|
40
|
-
if (!layoutFromUri) {
|
|
41
|
-
const toAttend = setLocation(startingLayout);
|
|
42
|
-
layout.layoutMode = 'deck';
|
|
43
|
-
await dispatch?.(createIntent(LayoutAction.ScrollIntoView, { id: toAttend }));
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const toAttend = setLocation(mergeLayoutParts(layoutFromUri, startingLayout));
|
|
48
|
-
layout.layoutMode = 'solo';
|
|
49
|
-
await dispatch?.(createIntent(LayoutAction.ScrollIntoView, { id: toAttend }));
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
await handleNavigation();
|
|
53
|
-
window.addEventListener('popstate', handleNavigation);
|
|
54
|
-
|
|
55
|
-
const unsubscribe = scheduledEffect(
|
|
56
|
-
() => ({ selectedPath: soloPartToUri(location.active) }),
|
|
57
|
-
({ selectedPath }) => {
|
|
58
|
-
// TODO(thure): In some browsers, this only preserves the most recent state change, even though this is not `history.replace`…
|
|
59
|
-
history.pushState(null, '', `/${selectedPath}${window.location.search}`);
|
|
60
|
-
},
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
return contributes(Capabilities.Null, null, () => {
|
|
64
|
-
window.removeEventListener('popstate', handleNavigation);
|
|
65
|
-
unsubscribe();
|
|
66
|
-
});
|
|
67
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { Capabilities, contributes, useCapability } from '@dxos/app-framework';
|
|
8
|
-
|
|
9
|
-
import { LayoutSettings } from '../../components';
|
|
10
|
-
import { DECK_PLUGIN } from '../../meta';
|
|
11
|
-
import { type DeckSettingsProps } from '../../types';
|
|
12
|
-
|
|
13
|
-
export default () =>
|
|
14
|
-
contributes(Capabilities.ReactSurface, {
|
|
15
|
-
id: DECK_PLUGIN,
|
|
16
|
-
role: 'settings',
|
|
17
|
-
filter: (data): data is any => data.subject === DECK_PLUGIN,
|
|
18
|
-
component: () => {
|
|
19
|
-
const store = useCapability(Capabilities.SettingsStore);
|
|
20
|
-
const settings = store.getStore<DeckSettingsProps>(DECK_PLUGIN)!.value;
|
|
21
|
-
return <LayoutSettings settings={settings} />;
|
|
22
|
-
},
|
|
23
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Context, createContext, useContext } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type LayoutMode } from '@dxos/app-framework';
|
|
8
|
-
import { raise } from '@dxos/debug';
|
|
9
|
-
|
|
10
|
-
export type PlankSizing = Record<string, number>;
|
|
11
|
-
export type DeckContextType = {
|
|
12
|
-
plankSizing: PlankSizing;
|
|
13
|
-
currentUndoId: string | undefined;
|
|
14
|
-
layoutModeHistory: LayoutMode[];
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const DeckContext: Context<DeckContextType | null> = createContext<DeckContextType | null>(null);
|
|
18
|
-
|
|
19
|
-
export const useDeckContext = (): DeckContextType => useContext(DeckContext) ?? raise(new Error('Missing DeckContext'));
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Context, createContext, useContext } from 'react';
|
|
6
|
-
|
|
7
|
-
import type { Layout } from '@dxos/app-framework';
|
|
8
|
-
import { raise } from '@dxos/debug';
|
|
9
|
-
|
|
10
|
-
export const LayoutContext: Context<Layout | null> = createContext<Layout | null>(null);
|
|
11
|
-
|
|
12
|
-
export const useLayout = (): Layout => useContext(LayoutContext) ?? raise(new Error('Missing LayoutContext'));
|