@dxos/plugin-deck 0.7.5-labs.e27f9b9 → 0.7.5-main.2567c87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{app-graph-builder-CI6ZFMNL.mjs → app-graph-builder-67VRUD5K.mjs} +31 -57
- package/dist/lib/browser/app-graph-builder-67VRUD5K.mjs.map +7 -0
- package/dist/lib/browser/{check-app-scheme-S3EYUPMF.mjs → check-app-scheme-GEX6W2R5.mjs} +3 -3
- package/dist/lib/browser/{check-app-scheme-S3EYUPMF.mjs.map → check-app-scheme-GEX6W2R5.mjs.map} +2 -2
- package/dist/lib/browser/chunk-2M4PXYNB.mjs +1052 -0
- package/dist/lib/browser/chunk-2M4PXYNB.mjs.map +7 -0
- package/dist/lib/browser/chunk-2PJNBVCY.mjs +39 -0
- package/dist/lib/browser/chunk-2PJNBVCY.mjs.map +7 -0
- package/dist/lib/browser/chunk-4C2AFTET.mjs +186 -0
- package/dist/lib/browser/chunk-4C2AFTET.mjs.map +7 -0
- package/dist/lib/browser/{chunk-YQ2GWTDU.mjs → chunk-5VFDMW5M.mjs} +2 -2
- package/dist/lib/browser/chunk-5VFDMW5M.mjs.map +7 -0
- package/dist/lib/browser/{chunk-N7TEPFVR.mjs → chunk-JQJ5UWVB.mjs} +2 -3
- package/dist/lib/browser/{chunk-N7TEPFVR.mjs.map → chunk-JQJ5UWVB.mjs.map} +3 -3
- package/dist/lib/browser/chunk-KY5WXIXY.mjs +44 -0
- package/dist/lib/browser/chunk-KY5WXIXY.mjs.map +7 -0
- package/dist/lib/browser/deck-PLCSKPGL.mjs +26 -0
- package/dist/lib/browser/deck-PLCSKPGL.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +76 -36
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-FVOQSTBX.mjs +152 -0
- package/dist/lib/browser/intent-resolver-FVOQSTBX.mjs.map +7 -0
- package/dist/lib/browser/intent-resolver-K7GW4A2I.mjs +249 -0
- package/dist/lib/browser/intent-resolver-K7GW4A2I.mjs.map +7 -0
- package/dist/lib/browser/location-QHRBQBQN.mjs +35 -0
- package/dist/lib/browser/location-QHRBQBQN.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-3BDW7W2N.mjs +32 -0
- package/dist/lib/browser/react-context-3BDW7W2N.mjs.map +7 -0
- package/dist/lib/browser/{react-root-HIHLRMCW.mjs → react-root-UL7ZDRVZ.mjs} +14 -10
- package/dist/lib/browser/react-root-UL7ZDRVZ.mjs.map +7 -0
- package/dist/lib/browser/react-surface-VPNOGGNN.mjs +28 -0
- package/dist/lib/browser/react-surface-VPNOGGNN.mjs.map +7 -0
- package/dist/lib/browser/{settings-WACNLCPB.mjs → settings-FNWW6WIJ.mjs} +7 -6
- package/dist/lib/browser/settings-FNWW6WIJ.mjs.map +7 -0
- package/dist/lib/browser/state-7I5BD7SE.mjs +34 -0
- package/dist/lib/browser/state-7I5BD7SE.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +4 -16
- package/dist/lib/browser/url-handler-Z5B7LD3N.mjs +76 -0
- package/dist/lib/browser/url-handler-Z5B7LD3N.mjs.map +7 -0
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +3 -132
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +3 -188
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/{app-graph-builder.d.ts → layout/app-graph-builder.d.ts} +22 -22
- package/dist/types/src/capabilities/layout/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/deck.d.ts +4 -0
- package/dist/types/src/capabilities/layout/deck.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/index.d.ts +229 -0
- package/dist/types/src/capabilities/layout/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/react-context.d.ts +8 -0
- package/dist/types/src/capabilities/layout/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/state.d.ts +42 -0
- package/dist/types/src/capabilities/layout/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/check-app-scheme.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/index.d.ts +5 -0
- package/dist/types/src/capabilities/navigation/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/intent-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/navigation/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/location.d.ts +4 -0
- package/dist/types/src/capabilities/navigation/location.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/set-location.d.ts +10 -0
- package/dist/types/src/capabilities/navigation/set-location.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/url-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +3 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/components/DeckContext.d.ts +11 -0
- package/dist/types/src/components/DeckContext.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/ActiveNode.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +4 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Fullscreen.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts +3 -3
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Plank.d.ts +6 -8
- package/dist/types/src/components/DeckLayout/Plank.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/PlankControls.d.ts +2 -2
- package/dist/types/src/components/DeckLayout/PlankControls.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/PlankError.d.ts +3 -4
- package/dist/types/src/components/DeckLayout/PlankError.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/SidebarButton.d.ts +3 -5
- package/dist/types/src/components/DeckLayout/SidebarButton.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/StatusBar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Toast.d.ts +2 -2
- package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
- package/dist/types/src/components/LayoutContext.d.ts +5 -0
- package/dist/types/src/components/LayoutContext.d.ts.map +1 -0
- package/dist/types/src/components/fragments.d.ts +0 -2
- package/dist/types/src/components/fragments.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useMainSize.d.ts +2 -2
- package/dist/types/src/layout.d.ts +19 -5
- package/dist/types/src/layout.d.ts.map +1 -1
- package/dist/types/src/layout.test.d.ts +2 -0
- package/dist/types/src/layout.test.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -3
- package/dist/types/src/types.d.ts +2 -107
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -2
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/layout-parts.d.ts +7 -0
- package/dist/types/src/util/layout-parts.d.ts.map +1 -0
- package/dist/types/src/util/useHoistStatusbar.d.ts.map +1 -1
- package/package.json +31 -32
- package/src/DeckPlugin.ts +57 -17
- package/src/capabilities/capabilities.ts +3 -4
- package/src/capabilities/index.ts +3 -12
- package/src/capabilities/{app-graph-builder.ts → layout/app-graph-builder.ts} +28 -36
- package/src/capabilities/layout/deck.ts +25 -0
- package/src/capabilities/layout/index.ts +12 -0
- package/src/capabilities/layout/intent-resolver.ts +128 -0
- package/src/capabilities/layout/react-context.tsx +26 -0
- package/src/capabilities/{react-root.tsx → layout/react-root.tsx} +11 -7
- package/src/capabilities/layout/state.ts +32 -0
- package/src/capabilities/{check-app-scheme.ts → navigation/check-app-scheme.ts} +2 -2
- package/src/capabilities/navigation/index.ts +10 -0
- package/src/capabilities/navigation/intent-resolver.ts +216 -0
- package/src/capabilities/navigation/location.ts +28 -0
- package/src/capabilities/navigation/set-location.ts +38 -0
- package/src/capabilities/navigation/url-handler.ts +67 -0
- package/src/capabilities/settings/index.ts +8 -0
- package/src/capabilities/settings/react-surface.tsx +23 -0
- package/src/capabilities/{settings.ts → settings/settings.ts} +5 -4
- package/src/components/DeckContext.ts +19 -0
- package/src/components/DeckLayout/ActiveNode.tsx +3 -2
- package/src/components/DeckLayout/ComplementarySidebar.tsx +69 -120
- package/src/components/DeckLayout/ContentEmpty.tsx +10 -7
- package/src/components/DeckLayout/DeckLayout.tsx +61 -103
- package/src/components/DeckLayout/Fullscreen.tsx +3 -2
- package/src/components/DeckLayout/NodePlankHeading.tsx +65 -57
- package/src/components/DeckLayout/Plank.tsx +41 -32
- package/src/components/DeckLayout/PlankControls.tsx +10 -11
- package/src/components/DeckLayout/PlankError.tsx +5 -6
- package/src/components/DeckLayout/Sidebar.tsx +20 -17
- package/src/components/DeckLayout/SidebarButton.tsx +31 -25
- package/src/components/DeckLayout/StatusBar.tsx +11 -5
- package/src/components/DeckLayout/Toast.tsx +2 -2
- package/src/components/LayoutContext.ts +12 -0
- package/src/components/LayoutSettings.tsx +8 -8
- package/src/components/fragments.ts +0 -8
- package/src/components/index.ts +2 -0
- package/src/hooks/useMainSize.ts +3 -3
- package/src/layout.test.ts +380 -0
- package/src/layout.ts +212 -43
- package/src/meta.ts +0 -1
- package/src/translations.ts +8 -8
- package/src/types.ts +2 -88
- package/src/util/index.ts +1 -2
- package/src/util/layout-parts.ts +12 -0
- package/src/util/useHoistStatusbar.ts +8 -17
- package/dist/lib/browser/app-graph-builder-CI6ZFMNL.mjs.map +0 -7
- package/dist/lib/browser/chunk-BTDY6SES.mjs +0 -1119
- package/dist/lib/browser/chunk-BTDY6SES.mjs.map +0 -7
- package/dist/lib/browser/chunk-FZOBKOA2.mjs +0 -24
- package/dist/lib/browser/chunk-FZOBKOA2.mjs.map +0 -7
- package/dist/lib/browser/chunk-M2L53AIH.mjs +0 -126
- package/dist/lib/browser/chunk-M2L53AIH.mjs.map +0 -7
- package/dist/lib/browser/chunk-YQ2GWTDU.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-CSXFDKTC.mjs +0 -494
- package/dist/lib/browser/intent-resolver-CSXFDKTC.mjs.map +0 -7
- package/dist/lib/browser/react-root-HIHLRMCW.mjs.map +0 -7
- package/dist/lib/browser/react-surface-4QVWKQYY.mjs +0 -38
- package/dist/lib/browser/react-surface-4QVWKQYY.mjs.map +0 -7
- package/dist/lib/browser/settings-WACNLCPB.mjs.map +0 -7
- package/dist/lib/browser/state-VPOYUKK6.mjs +0 -117
- package/dist/lib/browser/state-VPOYUKK6.mjs.map +0 -7
- package/dist/lib/browser/tools-5LDJNU56.mjs +0 -51
- package/dist/lib/browser/tools-5LDJNU56.mjs.map +0 -7
- package/dist/lib/browser/url-handler-HLF42IHP.mjs +0 -70
- package/dist/lib/browser/url-handler-HLF42IHP.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/check-app-scheme.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/set-active.d.ts +0 -9
- package/dist/types/src/capabilities/set-active.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state.d.ts +0 -76
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/tools.d.ts +0 -10
- package/dist/types/src/capabilities/tools.d.ts.map +0 -1
- package/dist/types/src/capabilities/url-handler.d.ts.map +0 -1
- package/dist/types/src/util/layoutAppliesTopbar.d.ts +0 -2
- package/dist/types/src/util/layoutAppliesTopbar.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -350
- package/src/capabilities/react-surface.tsx +0 -31
- package/src/capabilities/set-active.ts +0 -43
- package/src/capabilities/state.ts +0 -102
- package/src/capabilities/tools.ts +0 -61
- package/src/capabilities/url-handler.ts +0 -63
- package/src/util/layoutAppliesTopbar.ts +0 -7
- /package/dist/types/src/capabilities/{intent-resolver.d.ts → layout/intent-resolver.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-root.d.ts → layout/react-root.d.ts} +0 -0
- /package/dist/types/src/capabilities/{check-app-scheme.d.ts → navigation/check-app-scheme.d.ts} +0 -0
- /package/dist/types/src/capabilities/{url-handler.d.ts → navigation/url-handler.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface.d.ts → settings/react-surface.d.ts} +0 -0
- /package/dist/types/src/capabilities/{settings.d.ts → settings/settings.d.ts} +0 -0
package/src/DeckPlugin.ts
CHANGED
|
@@ -5,17 +5,21 @@
|
|
|
5
5
|
import { setAutoFreeze } from 'immer';
|
|
6
6
|
|
|
7
7
|
import { allOf, Capabilities, contributes, defineModule, definePlugin, Events, oneOf } from '@dxos/app-framework';
|
|
8
|
+
import { AttentionEvents } from '@dxos/plugin-attention';
|
|
8
9
|
import { translations as stackTranslations } from '@dxos/react-ui-stack';
|
|
9
10
|
|
|
10
11
|
import {
|
|
11
12
|
AppGraphBuilder,
|
|
12
13
|
CheckAppScheme,
|
|
13
|
-
DeckSettings,
|
|
14
14
|
DeckState,
|
|
15
15
|
LayoutIntentResolver,
|
|
16
|
+
LayoutState,
|
|
17
|
+
LocationState,
|
|
18
|
+
NavigationIntentResolver,
|
|
19
|
+
ReactContext,
|
|
16
20
|
ReactRoot,
|
|
21
|
+
DeckSettings,
|
|
17
22
|
ReactSurface,
|
|
18
|
-
Tools,
|
|
19
23
|
UrlHandler,
|
|
20
24
|
} from './capabilities';
|
|
21
25
|
import { DeckEvents } from './events';
|
|
@@ -29,20 +33,35 @@ setAutoFreeze(false);
|
|
|
29
33
|
|
|
30
34
|
export const DeckPlugin = () =>
|
|
31
35
|
definePlugin(meta, [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}),
|
|
36
|
+
//
|
|
37
|
+
// Settings
|
|
38
|
+
//
|
|
39
|
+
|
|
37
40
|
defineModule({
|
|
38
41
|
id: `${meta.id}/module/settings`,
|
|
39
42
|
activatesOn: Events.SetupSettings,
|
|
40
43
|
activate: DeckSettings,
|
|
41
44
|
}),
|
|
45
|
+
defineModule({
|
|
46
|
+
id: `${meta.id}/module/react-surface`,
|
|
47
|
+
activatesOn: Events.Startup,
|
|
48
|
+
activate: ReactSurface,
|
|
49
|
+
}),
|
|
50
|
+
|
|
51
|
+
//
|
|
52
|
+
// Layout
|
|
53
|
+
//
|
|
54
|
+
|
|
42
55
|
defineModule({
|
|
43
56
|
id: `${meta.id}/module/layout`,
|
|
44
57
|
activatesOn: oneOf(Events.Startup, Events.SetupAppGraph),
|
|
45
|
-
activatesAfter: [Events.LayoutReady
|
|
58
|
+
activatesAfter: [Events.LayoutReady],
|
|
59
|
+
activate: LayoutState,
|
|
60
|
+
}),
|
|
61
|
+
defineModule({
|
|
62
|
+
id: `${meta.id}/module/deck`,
|
|
63
|
+
activatesOn: oneOf(Events.Startup, Events.SetupAppGraph),
|
|
64
|
+
activatesAfter: [DeckEvents.StateReady],
|
|
46
65
|
activate: DeckState,
|
|
47
66
|
}),
|
|
48
67
|
defineModule({
|
|
@@ -51,14 +70,14 @@ export const DeckPlugin = () =>
|
|
|
51
70
|
activate: () => contributes(Capabilities.Translations, [...translations, ...stackTranslations]),
|
|
52
71
|
}),
|
|
53
72
|
defineModule({
|
|
54
|
-
id: `${meta.id}/module/react-
|
|
73
|
+
id: `${meta.id}/module/react-context`,
|
|
55
74
|
activatesOn: Events.Startup,
|
|
56
|
-
activate:
|
|
75
|
+
activate: ReactContext,
|
|
57
76
|
}),
|
|
58
77
|
defineModule({
|
|
59
|
-
id: `${meta.id}/module/react-
|
|
60
|
-
activatesOn: Events.
|
|
61
|
-
activate:
|
|
78
|
+
id: `${meta.id}/module/react-root`,
|
|
79
|
+
activatesOn: Events.Startup,
|
|
80
|
+
activate: ReactRoot,
|
|
62
81
|
}),
|
|
63
82
|
defineModule({
|
|
64
83
|
id: `${meta.id}/module/layout-intent-resolver`,
|
|
@@ -70,14 +89,35 @@ export const DeckPlugin = () =>
|
|
|
70
89
|
activatesOn: Events.SetupAppGraph,
|
|
71
90
|
activate: AppGraphBuilder,
|
|
72
91
|
}),
|
|
92
|
+
|
|
93
|
+
//
|
|
94
|
+
// Navigation
|
|
95
|
+
//
|
|
96
|
+
|
|
73
97
|
defineModule({
|
|
74
|
-
id: `${meta.id}/module/
|
|
75
|
-
activatesOn: Events.Startup,
|
|
76
|
-
|
|
98
|
+
id: `${meta.id}/module/location`,
|
|
99
|
+
activatesOn: oneOf(Events.Startup, Events.SetupAppGraph),
|
|
100
|
+
activatesAfter: [Events.LocationReady],
|
|
101
|
+
activate: LocationState,
|
|
102
|
+
}),
|
|
103
|
+
defineModule({
|
|
104
|
+
id: `${meta.id}/module/check-app-scheme`,
|
|
105
|
+
activatesOn: Events.SettingsReady,
|
|
106
|
+
activate: CheckAppScheme,
|
|
77
107
|
}),
|
|
78
108
|
defineModule({
|
|
79
109
|
id: `${meta.id}/module/url`,
|
|
80
|
-
activatesOn: allOf(
|
|
110
|
+
activatesOn: allOf(
|
|
111
|
+
Events.DispatcherReady,
|
|
112
|
+
Events.LayoutReady,
|
|
113
|
+
Events.LocationReady,
|
|
114
|
+
AttentionEvents.AttentionReady,
|
|
115
|
+
),
|
|
81
116
|
activate: UrlHandler,
|
|
82
117
|
}),
|
|
118
|
+
defineModule({
|
|
119
|
+
id: `${meta.id}/module/navigation-intent-resolver`,
|
|
120
|
+
activatesOn: Events.SetupIntents,
|
|
121
|
+
activate: NavigationIntentResolver,
|
|
122
|
+
}),
|
|
83
123
|
]);
|
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
import { defineCapability, type Label } from '@dxos/app-framework';
|
|
6
6
|
import { type DeepReadonly } from '@dxos/util';
|
|
7
7
|
|
|
8
|
+
import { type DeckContextType } from '../components';
|
|
8
9
|
import { DECK_PLUGIN } from '../meta';
|
|
9
|
-
import { type DeckState } from '../types';
|
|
10
10
|
|
|
11
11
|
export namespace DeckCapabilities {
|
|
12
|
-
export const DeckState = defineCapability<DeepReadonly<
|
|
13
|
-
export const MutableDeckState = defineCapability<
|
|
14
|
-
|
|
12
|
+
export const DeckState = defineCapability<DeepReadonly<DeckContextType>>(`${DECK_PLUGIN}/capability/state`);
|
|
13
|
+
export const MutableDeckState = defineCapability<DeckContextType>(`${DECK_PLUGIN}/capability/state`);
|
|
15
14
|
export const ComplementaryPanel = defineCapability<{ id: string; label: Label; icon: string }>(
|
|
16
15
|
`${DECK_PLUGIN}/capability/complementary-panel`,
|
|
17
16
|
);
|
|
@@ -2,16 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { lazy } from '@dxos/app-framework';
|
|
6
|
-
|
|
7
|
-
export const AppGraphBuilder = lazy(() => import('./app-graph-builder'));
|
|
8
|
-
export const CheckAppScheme = lazy(() => import('./check-app-scheme'));
|
|
9
|
-
export const LayoutIntentResolver = lazy(() => import('./intent-resolver'));
|
|
10
|
-
export const ReactRoot = lazy(() => import('./react-root'));
|
|
11
|
-
export const ReactSurface = lazy(() => import('./react-surface'));
|
|
12
|
-
export const DeckSettings = lazy(() => import('./settings'));
|
|
13
|
-
export const DeckState = lazy(() => import('./state'));
|
|
14
|
-
export const Tools = lazy(() => import('./tools'));
|
|
15
|
-
export const UrlHandler = lazy(() => import('./url-handler'));
|
|
16
|
-
|
|
17
5
|
export * from './capabilities';
|
|
6
|
+
export * from './layout';
|
|
7
|
+
export * from './navigation';
|
|
8
|
+
export * from './settings';
|
|
@@ -2,12 +2,19 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
Capabilities,
|
|
7
|
+
contributes,
|
|
8
|
+
createIntent,
|
|
9
|
+
LayoutAction,
|
|
10
|
+
NavigationAction,
|
|
11
|
+
openIds,
|
|
12
|
+
type PluginsContext,
|
|
13
|
+
} from '@dxos/app-framework';
|
|
6
14
|
import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
7
15
|
import { createExtension, type Node, ROOT_ID } from '@dxos/plugin-graph';
|
|
8
16
|
|
|
9
|
-
import {
|
|
10
|
-
import { DECK_PLUGIN } from '../meta';
|
|
17
|
+
import { DECK_PLUGIN } from '../../meta';
|
|
11
18
|
|
|
12
19
|
export default (context: PluginsContext) =>
|
|
13
20
|
contributes(
|
|
@@ -16,15 +23,13 @@ export default (context: PluginsContext) =>
|
|
|
16
23
|
id: DECK_PLUGIN,
|
|
17
24
|
filter: (node): node is Node<null> => node.id === ROOT_ID,
|
|
18
25
|
actions: () => {
|
|
19
|
-
const state = context.requestCapability(DeckCapabilities.MutableDeckState);
|
|
20
|
-
|
|
21
26
|
// NOTE(Zan): This is currently disabled.
|
|
22
27
|
// TODO(Zan): Fullscreen needs to know the active node and provide that to the layout part.
|
|
23
28
|
const _fullscreen = {
|
|
24
|
-
id: `${LayoutAction.
|
|
29
|
+
id: `${LayoutAction.SetLayoutMode._tag}/fullscreen`,
|
|
25
30
|
data: async () => {
|
|
26
31
|
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
27
|
-
await dispatch(createIntent(LayoutAction.SetLayoutMode, {
|
|
32
|
+
await dispatch(createIntent(LayoutAction.SetLayoutMode, { layoutMode: 'fullscreen' }));
|
|
28
33
|
},
|
|
29
34
|
properties: {
|
|
30
35
|
label: ['toggle fullscreen label', { ns: DECK_PLUGIN }],
|
|
@@ -37,15 +42,13 @@ export default (context: PluginsContext) =>
|
|
|
37
42
|
};
|
|
38
43
|
|
|
39
44
|
const closeCurrent = {
|
|
40
|
-
id: `${
|
|
45
|
+
id: `${NavigationAction.Close._tag}/current`,
|
|
41
46
|
data: async () => {
|
|
42
47
|
const attention = context.requestCapability(AttentionCapabilities.Attention);
|
|
43
48
|
const attended = attention.current.at(-1);
|
|
44
49
|
if (attended) {
|
|
45
50
|
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
46
|
-
await dispatch(
|
|
47
|
-
createIntent(LayoutAction.Close, { part: 'main', subject: [attended], options: { state: false } }),
|
|
48
|
-
);
|
|
51
|
+
await dispatch(createIntent(NavigationAction.Close, { activeParts: { main: [attended] } }));
|
|
49
52
|
}
|
|
50
53
|
},
|
|
51
54
|
properties: {
|
|
@@ -55,13 +58,18 @@ export default (context: PluginsContext) =>
|
|
|
55
58
|
};
|
|
56
59
|
|
|
57
60
|
const closeOthers = {
|
|
58
|
-
id: `${
|
|
61
|
+
id: `${NavigationAction.Close._tag}/others`,
|
|
59
62
|
data: async () => {
|
|
60
63
|
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
64
|
+
const location = context.requestCapability(Capabilities.Location);
|
|
61
65
|
const attention = context.requestCapability(AttentionCapabilities.Attention);
|
|
62
66
|
const attended = attention.current.at(-1);
|
|
63
|
-
const ids =
|
|
64
|
-
await dispatch(
|
|
67
|
+
const ids = openIds(location.active, ['main']).filter((id) => id !== attended);
|
|
68
|
+
await dispatch(
|
|
69
|
+
createIntent(NavigationAction.Close, {
|
|
70
|
+
activeParts: { main: ids },
|
|
71
|
+
}),
|
|
72
|
+
);
|
|
65
73
|
},
|
|
66
74
|
properties: {
|
|
67
75
|
label: ['close others label', { ns: DECK_PLUGIN }],
|
|
@@ -70,14 +78,13 @@ export default (context: PluginsContext) =>
|
|
|
70
78
|
};
|
|
71
79
|
|
|
72
80
|
const closeAll = {
|
|
73
|
-
id: `${
|
|
81
|
+
id: `${NavigationAction.Close._tag}/all`,
|
|
74
82
|
data: async () => {
|
|
75
83
|
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
84
|
+
const location = context.requestCapability(Capabilities.Location);
|
|
76
85
|
await dispatch(
|
|
77
|
-
createIntent(
|
|
78
|
-
|
|
79
|
-
subject: state.deck.active,
|
|
80
|
-
options: { state: false },
|
|
86
|
+
createIntent(NavigationAction.Close, {
|
|
87
|
+
activeParts: { main: openIds(location.active, ['main']) },
|
|
81
88
|
}),
|
|
82
89
|
);
|
|
83
90
|
},
|
|
@@ -87,23 +94,8 @@ export default (context: PluginsContext) =>
|
|
|
87
94
|
},
|
|
88
95
|
};
|
|
89
96
|
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
data: async () => {
|
|
93
|
-
state.sidebarState = state.sidebarState === 'expanded' ? 'collapsed' : 'expanded';
|
|
94
|
-
},
|
|
95
|
-
properties: {
|
|
96
|
-
label: [
|
|
97
|
-
state.sidebarState === 'expanded' ? 'collapse navigation sidebar label' : 'open navigation sidebar label',
|
|
98
|
-
{ ns: DECK_PLUGIN },
|
|
99
|
-
],
|
|
100
|
-
icon: 'ph--sidebar--regular',
|
|
101
|
-
disposition: 'pin-end',
|
|
102
|
-
l0Breakpoint: 'lg',
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
return !state.deck.solo ? [closeCurrent, closeOthers, closeAll, toggleSidebar] : [toggleSidebar];
|
|
97
|
+
const layoutMode = context.requestCapabilities(Capabilities.Layout)[0]?.layoutMode;
|
|
98
|
+
return layoutMode === 'deck' ? [closeCurrent, closeOthers, closeAll] : [];
|
|
107
99
|
},
|
|
108
100
|
}),
|
|
109
101
|
);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { contributes } from '@dxos/app-framework';
|
|
6
|
+
import { LocalStorageStore } from '@dxos/local-storage';
|
|
7
|
+
|
|
8
|
+
import { type DeckContextType } from '../../components';
|
|
9
|
+
import { DeckCapabilities } from '../capabilities';
|
|
10
|
+
|
|
11
|
+
// NOTE: The key is this currently for backwards compatibility of storage.
|
|
12
|
+
const DECK_KEY = 'dxos.org/settings/deck';
|
|
13
|
+
|
|
14
|
+
export default () => {
|
|
15
|
+
const deck = new LocalStorageStore<DeckContextType>(DECK_KEY, {
|
|
16
|
+
plankSizing: {},
|
|
17
|
+
currentUndoId: undefined,
|
|
18
|
+
// TODO(Zan): Cap depth!
|
|
19
|
+
layoutModeHistory: [],
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
deck.prop({ key: 'plankSizing', type: LocalStorageStore.json<Record<string, number>>() });
|
|
23
|
+
|
|
24
|
+
return contributes(DeckCapabilities.DeckState, deck.values, () => deck.close());
|
|
25
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
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'));
|
|
@@ -0,0 +1,128 @@
|
|
|
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
|
+
]);
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
});
|
|
@@ -6,16 +6,18 @@ import React, { useCallback } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Capabilities, contributes, useCapabilities, useCapability } from '@dxos/app-framework';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
9
|
+
import { DeckLayout } from '../../components';
|
|
10
|
+
import { DECK_PLUGIN } from '../../meta';
|
|
11
|
+
import { type DeckSettingsProps } from '../../types';
|
|
12
|
+
import { DeckCapabilities } from '../capabilities';
|
|
13
13
|
|
|
14
14
|
export default () =>
|
|
15
15
|
contributes(Capabilities.ReactRoot, {
|
|
16
16
|
id: DECK_PLUGIN,
|
|
17
17
|
root: () => {
|
|
18
|
-
const layout = useCapability(
|
|
18
|
+
const layout = useCapability(Capabilities.Layout);
|
|
19
|
+
const location = useCapability(Capabilities.Location);
|
|
20
|
+
const deck = useCapability(DeckCapabilities.MutableDeckState);
|
|
19
21
|
const settings = useCapability(Capabilities.SettingsStore).getStore<DeckSettingsProps>(DECK_PLUGIN)!.value;
|
|
20
22
|
const panels = useCapabilities(DeckCapabilities.ComplementaryPanel);
|
|
21
23
|
|
|
@@ -26,8 +28,8 @@ export default () =>
|
|
|
26
28
|
// Allow time for the toast to animate out.
|
|
27
29
|
// TODO(burdon): Factor out and unregister timeout.
|
|
28
30
|
setTimeout(() => {
|
|
29
|
-
if (layout.toasts[index].id ===
|
|
30
|
-
|
|
31
|
+
if (layout.toasts[index].id === deck.currentUndoId) {
|
|
32
|
+
deck.currentUndoId = undefined;
|
|
31
33
|
}
|
|
32
34
|
layout.toasts.splice(index, 1);
|
|
33
35
|
}, 1_000);
|
|
@@ -38,8 +40,10 @@ export default () =>
|
|
|
38
40
|
|
|
39
41
|
return (
|
|
40
42
|
<DeckLayout
|
|
43
|
+
layoutParts={location.active}
|
|
41
44
|
showHints={settings.showHints}
|
|
42
45
|
overscroll={settings.overscroll}
|
|
46
|
+
toasts={layout.toasts}
|
|
43
47
|
panels={panels}
|
|
44
48
|
onDismissToast={handleDismissToast}
|
|
45
49
|
/>
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
};
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
import { Capabilities, contributes, type PluginsContext } from '@dxos/app-framework';
|
|
9
9
|
|
|
10
|
-
import { DECK_PLUGIN } from '
|
|
11
|
-
import { type DeckSettingsProps } from '
|
|
10
|
+
import { DECK_PLUGIN } from '../../meta';
|
|
11
|
+
import { type DeckSettingsProps } from '../../types';
|
|
12
12
|
|
|
13
13
|
const isSocket = !!(globalThis as any).__args;
|
|
14
14
|
|
|
@@ -0,0 +1,10 @@
|
|
|
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'));
|