@dxos/plugin-deck 0.8.4-main.bc674ce → 0.8.4-main.c351d160a8
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/Banner-AJW6225V.mjs +14 -0
- package/dist/lib/browser/Banner-AJW6225V.mjs.map +7 -0
- package/dist/lib/browser/DeckSettings-HSSQKFNE.mjs +96 -0
- package/dist/lib/browser/DeckSettings-HSSQKFNE.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-DTVCULQ4.mjs → app-graph-builder-MP6INIM2.mjs} +16 -13
- package/dist/lib/browser/app-graph-builder-MP6INIM2.mjs.map +7 -0
- package/dist/lib/browser/{check-app-scheme-JSRXXIYF.mjs → check-app-scheme-AUNCD2Y6.mjs} +9 -8
- package/dist/lib/browser/check-app-scheme-AUNCD2Y6.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ATFPDN6J.mjs → chunk-3P2FJVXC.mjs} +35 -49
- package/dist/lib/browser/chunk-3P2FJVXC.mjs.map +7 -0
- package/dist/lib/browser/chunk-BJDEG7YZ.mjs +74 -0
- package/dist/lib/browser/chunk-BJDEG7YZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-L3RYMAV7.mjs +16 -0
- package/dist/lib/browser/chunk-L3RYMAV7.mjs.map +7 -0
- package/dist/lib/browser/{chunk-UNG4CLLP.mjs → chunk-TAHLKBDO.mjs} +46 -20
- package/dist/lib/browser/chunk-TAHLKBDO.mjs.map +7 -0
- package/dist/lib/browser/{chunk-S4A5UO4K.mjs → chunk-WTNYSXY5.mjs} +221 -281
- package/dist/lib/browser/chunk-WTNYSXY5.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +39 -35
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{operation-resolver-CDYBLZJ4.mjs → operation-resolver-2TEGT4PG.mjs} +166 -122
- package/dist/lib/browser/operation-resolver-2TEGT4PG.mjs.map +7 -0
- package/dist/lib/browser/{react-root-XDCMNENQ.mjs → react-root-XBFHPSCP.mjs} +8 -7
- package/dist/lib/browser/react-root-XBFHPSCP.mjs.map +7 -0
- package/dist/lib/browser/react-surface-4J3BZNT2.mjs +44 -0
- package/dist/lib/browser/react-surface-4J3BZNT2.mjs.map +7 -0
- package/dist/lib/browser/{settings-OMHVGZ6V.mjs → settings-PTMGCSJH.mjs} +8 -5
- package/dist/lib/browser/settings-PTMGCSJH.mjs.map +7 -0
- package/dist/lib/browser/{state-OC3BSB6E.mjs → state-MA4SQ7BE.mjs} +11 -8
- package/dist/lib/browser/state-MA4SQ7BE.mjs.map +7 -0
- package/dist/lib/browser/{toolkit-R53LD3EA.mjs → toolkit-6B34QFU3.mjs} +10 -8
- package/dist/lib/browser/toolkit-6B34QFU3.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -5
- package/dist/lib/browser/{url-handler-53TE6JZO.mjs → url-handler-FEUFPQIP.mjs} +22 -17
- package/dist/lib/browser/url-handler-FEUFPQIP.mjs.map +7 -0
- package/dist/lib/node-esm/Banner-XBH2IIDR.mjs +15 -0
- package/dist/lib/node-esm/Banner-XBH2IIDR.mjs.map +7 -0
- package/dist/lib/node-esm/DeckSettings-DJRFLKQS.mjs +97 -0
- package/dist/lib/node-esm/DeckSettings-DJRFLKQS.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-473BNZDJ.mjs → app-graph-builder-ACHG5HY7.mjs} +16 -13
- package/dist/lib/node-esm/app-graph-builder-ACHG5HY7.mjs.map +7 -0
- package/dist/lib/node-esm/{check-app-scheme-IVYRHKRH.mjs → check-app-scheme-WN76GWVC.mjs} +9 -8
- package/dist/lib/node-esm/check-app-scheme-WN76GWVC.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-D34L3ECT.mjs → chunk-CQ3XYTNJ.mjs} +220 -280
- package/dist/lib/node-esm/chunk-CQ3XYTNJ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DGTRKKWZ.mjs +76 -0
- package/dist/lib/node-esm/chunk-DGTRKKWZ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-SKEVPQ7E.mjs → chunk-EMU4VIPH.mjs} +46 -20
- package/dist/lib/node-esm/chunk-EMU4VIPH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-XAKTY3EB.mjs → chunk-GZJAQ5IP.mjs} +34 -49
- package/dist/lib/node-esm/chunk-GZJAQ5IP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XCNF4COU.mjs +18 -0
- package/dist/lib/node-esm/chunk-XCNF4COU.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +39 -35
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{operation-resolver-WUOE33ID.mjs → operation-resolver-GCMCCI7A.mjs} +166 -122
- package/dist/lib/node-esm/operation-resolver-GCMCCI7A.mjs.map +7 -0
- package/dist/lib/node-esm/{react-root-O6GZO62Z.mjs → react-root-32LZ6APH.mjs} +8 -7
- package/dist/lib/node-esm/react-root-32LZ6APH.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-IHDJDGC5.mjs → react-surface-CO4ZDZKM.mjs} +18 -16
- package/dist/lib/node-esm/react-surface-CO4ZDZKM.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-2HB6FKIK.mjs → settings-LPPFLXNJ.mjs} +8 -5
- package/dist/lib/node-esm/settings-LPPFLXNJ.mjs.map +7 -0
- package/dist/lib/node-esm/{state-JRQ45ACJ.mjs → state-KNRU3GDC.mjs} +11 -8
- package/dist/lib/node-esm/state-KNRU3GDC.mjs.map +7 -0
- package/dist/lib/node-esm/{toolkit-JLPZNNKB.mjs → toolkit-SOWYKJY3.mjs} +10 -8
- package/dist/lib/node-esm/toolkit-SOWYKJY3.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +4 -5
- package/dist/lib/node-esm/{url-handler-QGF2R24T.mjs → url-handler-4LEB7UWF.mjs} +22 -17
- package/dist/lib/node-esm/url-handler-4LEB7UWF.mjs.map +7 -0
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/check-app-scheme/check-app-scheme.d.ts +1 -1
- package/dist/types/src/capabilities/check-app-scheme/check-app-scheme.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-root/react-root.d.ts +1 -1
- package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings/index.d.ts +1 -1
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings/settings.d.ts +4 -3
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/state/index.d.ts +6 -6
- package/dist/types/src/capabilities/state/state.d.ts +7 -7
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit/index.d.ts +1 -1
- package/dist/types/src/capabilities/toolkit/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts +4 -3
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +1 -1
- package/dist/types/src/capabilities/tools/tools.d.ts +1 -1
- package/dist/types/src/capabilities/tools/tools.d.ts.map +1 -1
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts +1 -1
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ActiveNode.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts +1 -0
- package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckMain.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Fallback.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Popover.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Toast.d.ts +3 -3
- package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.d.ts +2 -2
- package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.stories.d.ts +3 -2
- package/dist/types/src/components/Plank/Plank.stories.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankControls.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankError.d.ts +5 -3
- package/dist/types/src/components/Plank/PlankError.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/ComplementarySidebar.d.ts.map +1 -1
- package/dist/types/src/components/fragments.d.ts +4 -1
- package/dist/types/src/components/fragments.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/Banner/Banner.d.ts +2 -0
- package/dist/types/src/containers/Banner/Banner.d.ts.map +1 -0
- package/dist/types/src/containers/Banner/index.d.ts +3 -0
- package/dist/types/src/containers/Banner/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/DeckSettings/DeckSettings.d.ts.map +1 -1
- package/dist/types/src/containers/DeckSettings/index.d.ts +3 -0
- package/dist/types/src/containers/DeckSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +4 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useDeckCompanions.d.ts +0 -1
- package/dist/types/src/hooks/useDeckCompanions.d.ts.map +1 -1
- package/dist/types/src/hooks/useMainSize.d.ts +2 -2
- package/dist/types/src/hooks/useSelectedCompanion.d.ts +13 -0
- package/dist/types/src/hooks/useSelectedCompanion.d.ts.map +1 -0
- package/dist/types/src/layout.d.ts +1 -7
- package/dist/types/src/layout.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +6 -6
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/events.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +18 -16
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +48 -44
- package/src/DeckPlugin.ts +12 -11
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +11 -10
- package/src/capabilities/check-app-scheme/check-app-scheme.ts +12 -8
- package/src/capabilities/operation-resolver/operation-resolver.ts +110 -107
- package/src/capabilities/react-root/react-root.tsx +2 -2
- package/src/capabilities/react-surface/react-surface.tsx +11 -10
- package/src/capabilities/settings/settings.ts +3 -2
- package/src/capabilities/state/state.ts +6 -5
- package/src/capabilities/toolkit/toolkit.ts +7 -6
- package/src/capabilities/tools/tools.ts +0 -1
- package/src/capabilities/url-handler/url-handler.ts +16 -13
- package/src/components/DeckLayout/ActiveNode.tsx +3 -2
- package/src/components/DeckLayout/Banner.tsx +8 -8
- package/src/components/DeckLayout/ContentEmpty.tsx +3 -3
- package/src/components/DeckLayout/DeckLayout.stories.tsx +8 -6
- package/src/components/DeckLayout/DeckMain.tsx +26 -25
- package/src/components/DeckLayout/Dialog.tsx +10 -4
- package/src/components/DeckLayout/Fallback.tsx +2 -6
- package/src/components/DeckLayout/Popover.tsx +46 -14
- package/src/components/DeckLayout/StatusBar.tsx +4 -4
- package/src/components/DeckLayout/Toast.tsx +3 -3
- package/src/components/Plank/Plank.stories.tsx +7 -5
- package/src/components/Plank/Plank.tsx +32 -24
- package/src/components/Plank/PlankControls.tsx +6 -8
- package/src/components/Plank/PlankError.tsx +29 -15
- package/src/components/Plank/PlankHeading.tsx +24 -26
- package/src/components/Plank/PlankLoading.tsx +1 -1
- package/src/components/Sidebar/ComplementarySidebar.tsx +50 -51
- package/src/components/Sidebar/Sidebar.tsx +4 -4
- package/src/components/Sidebar/SidebarButton.tsx +12 -12
- package/src/components/fragments.ts +9 -4
- package/src/components/index.ts +0 -1
- package/src/containers/Banner/Banner.tsx +5 -0
- package/src/containers/Banner/index.ts +7 -0
- package/src/{components → containers}/DeckSettings/DeckSettings.tsx +23 -23
- package/src/containers/DeckSettings/index.ts +7 -0
- package/src/containers/index.ts +8 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useCompanions.ts +2 -2
- package/src/hooks/useDeckCompanions.ts +3 -8
- package/src/hooks/useDeckState.ts +3 -3
- package/src/hooks/useHoistStatusbar.ts +1 -1
- package/src/hooks/useMainSize.ts +2 -2
- package/src/hooks/useNodeActionExpander.ts +1 -1
- package/src/hooks/useSelectedCompanion.ts +32 -0
- package/src/layout.ts +1 -14
- package/src/meta.ts +1 -1
- package/src/translations.ts +1 -0
- package/src/types/capabilities.ts +5 -5
- package/src/types/events.ts +5 -4
- package/src/types/schema.ts +22 -21
- package/src/util/overscroll.ts +3 -3
- package/dist/lib/browser/app-graph-builder-DTVCULQ4.mjs.map +0 -7
- package/dist/lib/browser/check-app-scheme-JSRXXIYF.mjs.map +0 -7
- package/dist/lib/browser/chunk-ATFPDN6J.mjs.map +0 -7
- package/dist/lib/browser/chunk-NHABISX2.mjs +0 -152
- package/dist/lib/browser/chunk-NHABISX2.mjs.map +0 -7
- package/dist/lib/browser/chunk-S4A5UO4K.mjs.map +0 -7
- package/dist/lib/browser/chunk-UNG4CLLP.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-CDYBLZJ4.mjs.map +0 -7
- package/dist/lib/browser/react-root-XDCMNENQ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-HODERLOL.mjs +0 -42
- package/dist/lib/browser/react-surface-HODERLOL.mjs.map +0 -7
- package/dist/lib/browser/settings-OMHVGZ6V.mjs.map +0 -7
- package/dist/lib/browser/state-OC3BSB6E.mjs.map +0 -7
- package/dist/lib/browser/toolkit-R53LD3EA.mjs.map +0 -7
- package/dist/lib/browser/url-handler-53TE6JZO.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-473BNZDJ.mjs.map +0 -7
- package/dist/lib/node-esm/check-app-scheme-IVYRHKRH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ADPMWKLL.mjs +0 -154
- package/dist/lib/node-esm/chunk-ADPMWKLL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-D34L3ECT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SKEVPQ7E.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XAKTY3EB.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-WUOE33ID.mjs.map +0 -7
- package/dist/lib/node-esm/react-root-O6GZO62Z.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-IHDJDGC5.mjs.map +0 -7
- package/dist/lib/node-esm/settings-2HB6FKIK.mjs.map +0 -7
- package/dist/lib/node-esm/state-JRQ45ACJ.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-JLPZNNKB.mjs.map +0 -7
- package/dist/lib/node-esm/url-handler-QGF2R24T.mjs.map +0 -7
- package/dist/types/src/components/DeckSettings/index.d.ts +0 -2
- package/dist/types/src/components/DeckSettings/index.d.ts.map +0 -1
- package/src/components/DeckSettings/index.ts +0 -5
- /package/dist/types/src/{components → containers}/DeckSettings/DeckSettings.d.ts +0 -0
|
@@ -6,7 +6,8 @@ import * as Effect from 'effect/Effect';
|
|
|
6
6
|
import * as Function from 'effect/Function';
|
|
7
7
|
import * as Option from 'effect/Option';
|
|
8
8
|
|
|
9
|
-
import { Capability,
|
|
9
|
+
import { Capabilities, Capability, UndoOperation } from '@dxos/app-framework';
|
|
10
|
+
import { AppCapabilities, LayoutOperation, getCompanionVariant, isPinnedWorkspace } from '@dxos/app-toolkit';
|
|
10
11
|
import { Obj } from '@dxos/echo';
|
|
11
12
|
import { invariant } from '@dxos/invariant';
|
|
12
13
|
import { log } from '@dxos/log';
|
|
@@ -17,7 +18,7 @@ import { Graph, Node } from '@dxos/plugin-graph';
|
|
|
17
18
|
import { ObservabilityOperation } from '@dxos/plugin-observability/types';
|
|
18
19
|
import { byPosition, isNonNullable } from '@dxos/util';
|
|
19
20
|
|
|
20
|
-
import { closeEntry,
|
|
21
|
+
import { closeEntry, incrementPlank, openEntry } from '../../layout';
|
|
21
22
|
import { meta } from '../../meta';
|
|
22
23
|
import {
|
|
23
24
|
DeckCapabilities,
|
|
@@ -52,17 +53,20 @@ const updateActiveDeck = (current: DeckStateProps, deckUpdates: Partial<DeckStat
|
|
|
52
53
|
|
|
53
54
|
export default Capability.makeModule(
|
|
54
55
|
Effect.fnUntraced(function* () {
|
|
55
|
-
return Capability.contributes(
|
|
56
|
+
return Capability.contributes(Capabilities.OperationResolver, [
|
|
56
57
|
//
|
|
57
58
|
// UpdateSidebar
|
|
58
59
|
//
|
|
59
60
|
OperationResolver.make({
|
|
60
|
-
operation:
|
|
61
|
+
operation: LayoutOperation.UpdateSidebar,
|
|
61
62
|
handler: Effect.fnUntraced(function* (input) {
|
|
62
|
-
const state = yield*
|
|
63
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
63
64
|
const next = input.state ?? state.sidebarState;
|
|
64
65
|
if (next !== state.sidebarState) {
|
|
65
|
-
yield*
|
|
66
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => ({
|
|
67
|
+
...state,
|
|
68
|
+
sidebarState: next,
|
|
69
|
+
}));
|
|
66
70
|
}
|
|
67
71
|
}),
|
|
68
72
|
}),
|
|
@@ -71,18 +75,18 @@ export default Capability.makeModule(
|
|
|
71
75
|
// UpdateComplementary
|
|
72
76
|
//
|
|
73
77
|
OperationResolver.make({
|
|
74
|
-
operation:
|
|
78
|
+
operation: LayoutOperation.UpdateComplementary,
|
|
75
79
|
handler: Effect.fnUntraced(function* (input) {
|
|
76
|
-
const state = yield*
|
|
80
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
77
81
|
const panelChanged = state.complementarySidebarPanel !== input.subject;
|
|
78
82
|
const next = input.subject ? 'expanded' : (input.state ?? state.complementarySidebarState);
|
|
79
83
|
const stateChanged = next !== state.complementarySidebarState;
|
|
80
84
|
|
|
81
85
|
if (panelChanged || stateChanged) {
|
|
82
|
-
yield*
|
|
83
|
-
...
|
|
84
|
-
complementarySidebarPanel: panelChanged ? input.subject :
|
|
85
|
-
complementarySidebarState: stateChanged ? next :
|
|
86
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => ({
|
|
87
|
+
...state,
|
|
88
|
+
complementarySidebarPanel: panelChanged ? input.subject : state.complementarySidebarPanel,
|
|
89
|
+
complementarySidebarState: stateChanged ? next : state.complementarySidebarState,
|
|
86
90
|
}));
|
|
87
91
|
}
|
|
88
92
|
}),
|
|
@@ -92,16 +96,21 @@ export default Capability.makeModule(
|
|
|
92
96
|
// UpdateDialog
|
|
93
97
|
//
|
|
94
98
|
OperationResolver.make({
|
|
95
|
-
operation:
|
|
99
|
+
operation: LayoutOperation.UpdateDialog,
|
|
96
100
|
handler: Effect.fnUntraced(function* (input) {
|
|
97
|
-
yield*
|
|
98
|
-
...
|
|
101
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.EphemeralState, (state) => ({
|
|
102
|
+
...state,
|
|
99
103
|
dialogOpen: input.state ?? Boolean(input.subject),
|
|
100
104
|
dialogType: input.type ?? 'default',
|
|
101
105
|
dialogBlockAlign: input.blockAlign ?? 'center',
|
|
102
106
|
dialogOverlayClasses: input.overlayClasses,
|
|
103
107
|
dialogOverlayStyle: input.overlayStyle,
|
|
104
|
-
dialogContent: input.subject
|
|
108
|
+
dialogContent: input.subject
|
|
109
|
+
? {
|
|
110
|
+
component: input.subject,
|
|
111
|
+
props: input.props,
|
|
112
|
+
}
|
|
113
|
+
: null,
|
|
105
114
|
}));
|
|
106
115
|
}),
|
|
107
116
|
}),
|
|
@@ -110,13 +119,14 @@ export default Capability.makeModule(
|
|
|
110
119
|
// UpdatePopover
|
|
111
120
|
//
|
|
112
121
|
OperationResolver.make({
|
|
113
|
-
operation:
|
|
122
|
+
operation: LayoutOperation.UpdatePopover,
|
|
114
123
|
handler: Effect.fnUntraced(function* (input) {
|
|
115
|
-
yield*
|
|
116
|
-
...
|
|
124
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.EphemeralState, (state) => ({
|
|
125
|
+
...state,
|
|
117
126
|
popoverOpen: input.state ?? Boolean(input.subject),
|
|
118
127
|
popoverKind: input.kind ?? 'base',
|
|
119
128
|
popoverTitle: input.kind === 'card' ? input.title : undefined,
|
|
129
|
+
popoverContentRef: input.subjectRef,
|
|
120
130
|
popoverContent:
|
|
121
131
|
typeof input.subject === 'string'
|
|
122
132
|
? { component: input.subject, props: input.props }
|
|
@@ -124,8 +134,8 @@ export default Capability.makeModule(
|
|
|
124
134
|
? { subject: input.subject }
|
|
125
135
|
: null,
|
|
126
136
|
popoverSide: input.side,
|
|
127
|
-
popoverAnchor: input.variant === 'virtual' ? input.anchor :
|
|
128
|
-
popoverAnchorId: input.variant !== 'virtual' ? input.anchorId :
|
|
137
|
+
popoverAnchor: input.variant === 'virtual' ? input.anchor : state.popoverAnchor,
|
|
138
|
+
popoverAnchorId: input.variant !== 'virtual' ? input.anchorId : state.popoverAnchorId,
|
|
129
139
|
}));
|
|
130
140
|
}),
|
|
131
141
|
}),
|
|
@@ -134,11 +144,11 @@ export default Capability.makeModule(
|
|
|
134
144
|
// AddToast
|
|
135
145
|
//
|
|
136
146
|
OperationResolver.make({
|
|
137
|
-
operation:
|
|
147
|
+
operation: LayoutOperation.AddToast,
|
|
138
148
|
handler: Effect.fnUntraced(function* (input) {
|
|
139
|
-
yield*
|
|
140
|
-
...
|
|
141
|
-
toasts: [...
|
|
149
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.EphemeralState, (state) => ({
|
|
150
|
+
...state,
|
|
151
|
+
toasts: [...state.toasts, input as LayoutOperation.Toast],
|
|
142
152
|
}));
|
|
143
153
|
}),
|
|
144
154
|
}),
|
|
@@ -147,18 +157,18 @@ export default Capability.makeModule(
|
|
|
147
157
|
// ShowUndo
|
|
148
158
|
//
|
|
149
159
|
OperationResolver.make({
|
|
150
|
-
operation:
|
|
160
|
+
operation: UndoOperation.ShowUndo,
|
|
151
161
|
handler: Effect.fnUntraced(function* (input) {
|
|
152
|
-
const historyTracker = yield* Capability.get(
|
|
162
|
+
const historyTracker = yield* Capability.get(Capabilities.HistoryTracker);
|
|
153
163
|
|
|
154
164
|
const newUndoId = `show-undo-${Date.now()}`;
|
|
155
165
|
// TODO(wittjosiah): Support undoing further back than the last action.
|
|
156
|
-
yield*
|
|
157
|
-
const filteredToasts =
|
|
158
|
-
?
|
|
159
|
-
:
|
|
166
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.EphemeralState, (state) => {
|
|
167
|
+
const filteredToasts = state.currentUndoId
|
|
168
|
+
? state.toasts.filter((toast) => toast.id !== state.currentUndoId)
|
|
169
|
+
: state.toasts;
|
|
160
170
|
|
|
161
|
-
const toast:
|
|
171
|
+
const toast: LayoutOperation.Toast = {
|
|
162
172
|
id: newUndoId,
|
|
163
173
|
title: input.message ?? ['undo available label', { ns: meta.id }],
|
|
164
174
|
duration: 10_000,
|
|
@@ -169,7 +179,7 @@ export default Capability.makeModule(
|
|
|
169
179
|
};
|
|
170
180
|
|
|
171
181
|
return {
|
|
172
|
-
...
|
|
182
|
+
...state,
|
|
173
183
|
currentUndoId: newUndoId,
|
|
174
184
|
toasts: [...filteredToasts, toast],
|
|
175
185
|
};
|
|
@@ -181,7 +191,7 @@ export default Capability.makeModule(
|
|
|
181
191
|
// SetLayoutMode
|
|
182
192
|
//
|
|
183
193
|
OperationResolver.make({
|
|
184
|
-
operation:
|
|
194
|
+
operation: LayoutOperation.SetLayoutMode,
|
|
185
195
|
filter: (input) => {
|
|
186
196
|
if ('mode' in input) {
|
|
187
197
|
return isLayoutMode(input.mode);
|
|
@@ -189,7 +199,7 @@ export default Capability.makeModule(
|
|
|
189
199
|
return true;
|
|
190
200
|
},
|
|
191
201
|
handler: Effect.fnUntraced(function* (input) {
|
|
192
|
-
const state = yield*
|
|
202
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
193
203
|
const deck = yield* DeckCapabilities.getDeck();
|
|
194
204
|
|
|
195
205
|
const computeModeUpdate = (mode: LayoutMode, subject?: string): Partial<DeckState> => {
|
|
@@ -228,18 +238,22 @@ export default Capability.makeModule(
|
|
|
228
238
|
'subject' in input ? input.subject : undefined,
|
|
229
239
|
);
|
|
230
240
|
|
|
231
|
-
yield*
|
|
241
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => {
|
|
232
242
|
const newPreviousMode =
|
|
233
|
-
currentMode !== input.mode
|
|
243
|
+
currentMode !== input.mode
|
|
244
|
+
? { ...state.previousMode, [state.activeDeck]: currentMode }
|
|
245
|
+
: state.previousMode;
|
|
234
246
|
return {
|
|
235
|
-
...updateActiveDeck(
|
|
247
|
+
...updateActiveDeck(state, deckUpdates),
|
|
236
248
|
previousMode: newPreviousMode,
|
|
237
249
|
};
|
|
238
250
|
});
|
|
239
251
|
} else if ('revert' in input) {
|
|
240
252
|
const last = state.previousMode[state.activeDeck];
|
|
241
253
|
const deckUpdates = computeModeUpdate(last ?? 'solo');
|
|
242
|
-
yield*
|
|
254
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) =>
|
|
255
|
+
updateActiveDeck(state, deckUpdates),
|
|
256
|
+
);
|
|
243
257
|
} else {
|
|
244
258
|
log.warn('Invalid layout mode', input);
|
|
245
259
|
}
|
|
@@ -250,21 +264,23 @@ export default Capability.makeModule(
|
|
|
250
264
|
// SwitchWorkspace
|
|
251
265
|
//
|
|
252
266
|
OperationResolver.make({
|
|
253
|
-
operation:
|
|
267
|
+
operation: LayoutOperation.SwitchWorkspace,
|
|
254
268
|
handler: Effect.fnUntraced(function* (input) {
|
|
255
|
-
const { graph } = yield* Capability.get(
|
|
269
|
+
const { graph } = yield* Capability.get(AppCapabilities.AppGraph);
|
|
256
270
|
|
|
257
271
|
{
|
|
258
|
-
const state = yield*
|
|
272
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
259
273
|
// TODO(wittjosiah): This is a hack to prevent the previous deck from being set for pinned items.
|
|
260
274
|
// Ideally this should be worked into the data model in a generic way.
|
|
261
|
-
const shouldUpdatePrevious = !state.activeDeck
|
|
275
|
+
const shouldUpdatePrevious = !isPinnedWorkspace(state.activeDeck);
|
|
262
276
|
|
|
263
|
-
yield*
|
|
264
|
-
const newDecks =
|
|
277
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => {
|
|
278
|
+
const newDecks = state.decks[input.subject]
|
|
279
|
+
? state.decks
|
|
280
|
+
: { ...state.decks, [input.subject]: { ...defaultDeck } };
|
|
265
281
|
return {
|
|
266
|
-
...
|
|
267
|
-
previousDeck: shouldUpdatePrevious ?
|
|
282
|
+
...state,
|
|
283
|
+
previousDeck: shouldUpdatePrevious ? state.activeDeck : state.previousDeck,
|
|
268
284
|
activeDeck: input.subject,
|
|
269
285
|
decks: newDecks,
|
|
270
286
|
};
|
|
@@ -272,19 +288,19 @@ export default Capability.makeModule(
|
|
|
272
288
|
}
|
|
273
289
|
|
|
274
290
|
{
|
|
275
|
-
const state = yield*
|
|
291
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
276
292
|
const deck = state.decks[input.subject];
|
|
277
293
|
invariant(deck, `Deck not found: ${input.subject}`);
|
|
278
294
|
|
|
279
295
|
const first = deck.solo ? deck.solo : deck.active[0];
|
|
280
296
|
if (first) {
|
|
281
|
-
yield* Operation.schedule(
|
|
297
|
+
yield* Operation.schedule(LayoutOperation.ScrollIntoView, { subject: first });
|
|
282
298
|
} else {
|
|
283
|
-
const [item] = Graph.getConnections(graph, input.subject).filter(
|
|
299
|
+
const [item] = Graph.getConnections(graph, input.subject, 'child').filter(
|
|
284
300
|
(node) => !Node.isActionLike(node) && !node.properties.disposition,
|
|
285
301
|
);
|
|
286
302
|
if (item) {
|
|
287
|
-
yield* Operation.schedule(
|
|
303
|
+
yield* Operation.schedule(LayoutOperation.Open, { subject: [item.id] });
|
|
288
304
|
}
|
|
289
305
|
}
|
|
290
306
|
}
|
|
@@ -295,10 +311,10 @@ export default Capability.makeModule(
|
|
|
295
311
|
// RevertWorkspace
|
|
296
312
|
//
|
|
297
313
|
OperationResolver.make({
|
|
298
|
-
operation:
|
|
314
|
+
operation: LayoutOperation.RevertWorkspace,
|
|
299
315
|
handler: Effect.fnUntraced(function* () {
|
|
300
|
-
const state = yield*
|
|
301
|
-
yield* Operation.invoke(
|
|
316
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
317
|
+
yield* Operation.invoke(LayoutOperation.SwitchWorkspace, { subject: state.previousDeck });
|
|
302
318
|
}),
|
|
303
319
|
}),
|
|
304
320
|
|
|
@@ -306,16 +322,16 @@ export default Capability.makeModule(
|
|
|
306
322
|
// Open
|
|
307
323
|
//
|
|
308
324
|
OperationResolver.make({
|
|
309
|
-
operation:
|
|
325
|
+
operation: LayoutOperation.Open,
|
|
310
326
|
handler: Effect.fnUntraced(function* (input) {
|
|
311
|
-
const { graph } = yield* Capability.get(
|
|
327
|
+
const { graph } = yield* Capability.get(AppCapabilities.AppGraph);
|
|
312
328
|
const attention = yield* Capability.get(AttentionCapabilities.Attention);
|
|
313
|
-
const settings = yield*
|
|
329
|
+
const settings = yield* Capabilities.getAtomValue(DeckCapabilities.Settings);
|
|
314
330
|
|
|
315
331
|
{
|
|
316
|
-
const state = yield*
|
|
332
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
317
333
|
if (input.workspace && state.activeDeck !== input.workspace) {
|
|
318
|
-
yield* Operation.invoke(
|
|
334
|
+
yield* Operation.invoke(LayoutOperation.SwitchWorkspace, { subject: input.workspace });
|
|
319
335
|
}
|
|
320
336
|
}
|
|
321
337
|
|
|
@@ -324,20 +340,21 @@ export default Capability.makeModule(
|
|
|
324
340
|
const deck = yield* DeckCapabilities.getDeck();
|
|
325
341
|
previouslyOpenIds = new Set<string>(deck.solo ? [deck.solo] : deck.active);
|
|
326
342
|
const next = deck.solo
|
|
327
|
-
? input.subject
|
|
343
|
+
? [...input.subject]
|
|
328
344
|
: input.subject.reduce(
|
|
329
345
|
(acc, entryId) =>
|
|
330
346
|
openEntry(acc, entryId, {
|
|
331
347
|
key: input.key,
|
|
332
348
|
positioning: input.positioning ?? settings?.newPlankPositioning,
|
|
333
349
|
pivotId: input.pivotId,
|
|
334
|
-
variant: input.variant,
|
|
335
350
|
}),
|
|
336
351
|
deck.active,
|
|
337
352
|
);
|
|
338
353
|
|
|
339
354
|
const { deckUpdates, toAttend: _toAttend } = computeActiveUpdates({ next, deck, attention });
|
|
340
|
-
yield*
|
|
355
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) =>
|
|
356
|
+
updateActiveDeck(state, deckUpdates),
|
|
357
|
+
);
|
|
341
358
|
}
|
|
342
359
|
|
|
343
360
|
{
|
|
@@ -346,13 +363,13 @@ export default Capability.makeModule(
|
|
|
346
363
|
const newlyOpen = ids.filter((i: string) => !previouslyOpenIds.has(i));
|
|
347
364
|
|
|
348
365
|
if (input.scrollIntoView !== false && (newlyOpen[0] ?? input.subject[0])) {
|
|
349
|
-
yield* Operation.schedule(
|
|
366
|
+
yield* Operation.schedule(LayoutOperation.ScrollIntoView, {
|
|
350
367
|
subject: newlyOpen[0] ?? input.subject[0],
|
|
351
368
|
});
|
|
352
369
|
}
|
|
353
370
|
|
|
354
371
|
if (newlyOpen[0] ?? input.subject[0]) {
|
|
355
|
-
yield* Operation.schedule(
|
|
372
|
+
yield* Operation.schedule(LayoutOperation.Expose, { subject: newlyOpen[0] ?? input.subject[0] });
|
|
356
373
|
}
|
|
357
374
|
|
|
358
375
|
// Send analytics events for newly opened items.
|
|
@@ -379,10 +396,10 @@ export default Capability.makeModule(
|
|
|
379
396
|
OperationResolver.make({
|
|
380
397
|
operation: DeckOperation.UpdatePlankSize,
|
|
381
398
|
handler: Effect.fnUntraced(function* (input) {
|
|
382
|
-
yield*
|
|
383
|
-
updateActiveDeck(
|
|
399
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) =>
|
|
400
|
+
updateActiveDeck(state, {
|
|
384
401
|
plankSizing: {
|
|
385
|
-
...
|
|
402
|
+
...state.decks[state.activeDeck]?.plankSizing,
|
|
386
403
|
[input.id]: input.size,
|
|
387
404
|
},
|
|
388
405
|
}),
|
|
@@ -396,10 +413,10 @@ export default Capability.makeModule(
|
|
|
396
413
|
OperationResolver.make({
|
|
397
414
|
operation: DeckOperation.Adjust,
|
|
398
415
|
handler: Effect.fnUntraced(function* (input) {
|
|
399
|
-
const _state = yield*
|
|
416
|
+
const _state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
400
417
|
const deck = yield* DeckCapabilities.getDeck();
|
|
401
418
|
const attention = yield* Capability.get(AttentionCapabilities.Attention);
|
|
402
|
-
const { graph } = yield* Capability.get(
|
|
419
|
+
const { graph } = yield* Capability.get(AppCapabilities.AppGraph);
|
|
403
420
|
|
|
404
421
|
// Collect layout operations to run after state updates.
|
|
405
422
|
let soloOperation:
|
|
@@ -410,7 +427,9 @@ export default Capability.makeModule(
|
|
|
410
427
|
if (input.type === 'increment-end' || input.type === 'increment-start') {
|
|
411
428
|
const next = incrementPlank(deck.active, input);
|
|
412
429
|
const { deckUpdates } = computeActiveUpdates({ next, deck, attention });
|
|
413
|
-
yield*
|
|
430
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) =>
|
|
431
|
+
updateActiveDeck(state, deckUpdates),
|
|
432
|
+
);
|
|
414
433
|
}
|
|
415
434
|
|
|
416
435
|
if (input.type.startsWith('solo')) {
|
|
@@ -431,20 +450,20 @@ export default Capability.makeModule(
|
|
|
431
450
|
|
|
432
451
|
// Run collected solo operations.
|
|
433
452
|
if (soloOperation?.type === 'solo') {
|
|
434
|
-
yield* Operation.invoke(
|
|
453
|
+
yield* Operation.invoke(LayoutOperation.SetLayoutMode, {
|
|
435
454
|
subject: soloOperation.entryId,
|
|
436
455
|
mode: soloOperation.mode,
|
|
437
456
|
});
|
|
438
457
|
} else if (soloOperation?.type === 'unsolo') {
|
|
439
|
-
yield* Operation.invoke(
|
|
440
|
-
yield* Operation.invoke(
|
|
458
|
+
yield* Operation.invoke(LayoutOperation.SetLayoutMode, { mode: 'deck' });
|
|
459
|
+
yield* Operation.invoke(LayoutOperation.Open, { subject: [soloOperation.entryId] });
|
|
441
460
|
}
|
|
442
461
|
|
|
443
462
|
if (input.type === 'companion') {
|
|
444
463
|
const companion = Function.pipe(
|
|
445
464
|
Graph.getNode(graph, input.id),
|
|
446
465
|
Option.map((node) =>
|
|
447
|
-
Graph.getConnections(graph, node.id)
|
|
466
|
+
Graph.getConnections(graph, node.id, 'child')
|
|
448
467
|
.filter((n) => n.type === PLANK_COMPANION_TYPE)
|
|
449
468
|
.toSorted((a, b) => byPosition(a.properties, b.properties)),
|
|
450
469
|
),
|
|
@@ -452,11 +471,7 @@ export default Capability.makeModule(
|
|
|
452
471
|
);
|
|
453
472
|
|
|
454
473
|
if (Option.isSome(companion)) {
|
|
455
|
-
|
|
456
|
-
yield* Operation.invoke(DeckOperation.ChangeCompanion, {
|
|
457
|
-
primary: input.id,
|
|
458
|
-
companion: companion.value.id,
|
|
459
|
-
});
|
|
474
|
+
yield* Operation.invoke(DeckOperation.ChangeCompanion, { companion: companion.value.id });
|
|
460
475
|
}
|
|
461
476
|
}
|
|
462
477
|
}),
|
|
@@ -468,21 +483,16 @@ export default Capability.makeModule(
|
|
|
468
483
|
OperationResolver.make({
|
|
469
484
|
operation: DeckOperation.ChangeCompanion,
|
|
470
485
|
handler: Effect.fnUntraced(function* (input) {
|
|
471
|
-
const deck = yield* DeckCapabilities.getDeck();
|
|
472
486
|
if (input.companion === null) {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
updateActiveDeck(s, { activeCompanions: nextActiveCompanions }),
|
|
487
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) =>
|
|
488
|
+
updateActiveDeck(state, { companionOpen: false }),
|
|
476
489
|
);
|
|
477
490
|
} else {
|
|
478
|
-
const
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
...deck.activeCompanions,
|
|
484
|
-
[input.primary]: companion,
|
|
485
|
-
},
|
|
491
|
+
const variant = getCompanionVariant(input.companion);
|
|
492
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) =>
|
|
493
|
+
updateActiveDeck(state, {
|
|
494
|
+
companionOpen: true,
|
|
495
|
+
companionVariant: variant,
|
|
486
496
|
}),
|
|
487
497
|
);
|
|
488
498
|
}
|
|
@@ -493,7 +503,7 @@ export default Capability.makeModule(
|
|
|
493
503
|
// Close
|
|
494
504
|
//
|
|
495
505
|
OperationResolver.make({
|
|
496
|
-
operation:
|
|
506
|
+
operation: LayoutOperation.Close,
|
|
497
507
|
handler: Effect.fnUntraced(function* (input) {
|
|
498
508
|
const deck = yield* DeckCapabilities.getDeck();
|
|
499
509
|
const attention = yield* Capability.get(AttentionCapabilities.Attention);
|
|
@@ -501,17 +511,10 @@ export default Capability.makeModule(
|
|
|
501
511
|
const active = deck.solo ? [deck.solo] : deck.active;
|
|
502
512
|
const next = input.subject.reduce((acc, id) => closeEntry(acc, id), active);
|
|
503
513
|
const { deckUpdates, toAttend } = computeActiveUpdates({ next, deck, attention });
|
|
504
|
-
yield*
|
|
505
|
-
|
|
506
|
-
// Clear companions for closed entries.
|
|
507
|
-
for (const id of input.subject) {
|
|
508
|
-
if (deck.activeCompanions && id in deck.activeCompanions) {
|
|
509
|
-
yield* Operation.invoke(DeckOperation.ChangeCompanion, { primary: id, companion: null });
|
|
510
|
-
}
|
|
511
|
-
}
|
|
514
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => updateActiveDeck(state, deckUpdates));
|
|
512
515
|
|
|
513
516
|
if (toAttend) {
|
|
514
|
-
yield* Operation.schedule(
|
|
517
|
+
yield* Operation.schedule(LayoutOperation.ScrollIntoView, { subject: toAttend });
|
|
515
518
|
}
|
|
516
519
|
}),
|
|
517
520
|
}),
|
|
@@ -520,7 +523,7 @@ export default Capability.makeModule(
|
|
|
520
523
|
// Set
|
|
521
524
|
//
|
|
522
525
|
OperationResolver.make({
|
|
523
|
-
operation:
|
|
526
|
+
operation: LayoutOperation.Set,
|
|
524
527
|
handler: Effect.fnUntraced(function* (input) {
|
|
525
528
|
const deck = yield* DeckCapabilities.getDeck();
|
|
526
529
|
const attention = yield* Capability.get(AttentionCapabilities.Attention);
|
|
@@ -530,10 +533,10 @@ export default Capability.makeModule(
|
|
|
530
533
|
deck,
|
|
531
534
|
attention,
|
|
532
535
|
});
|
|
533
|
-
yield*
|
|
536
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => updateActiveDeck(state, deckUpdates));
|
|
534
537
|
|
|
535
538
|
if (toAttend) {
|
|
536
|
-
yield* Operation.schedule(
|
|
539
|
+
yield* Operation.schedule(LayoutOperation.ScrollIntoView, { subject: toAttend });
|
|
537
540
|
}
|
|
538
541
|
}),
|
|
539
542
|
}),
|
|
@@ -542,10 +545,10 @@ export default Capability.makeModule(
|
|
|
542
545
|
// ScrollIntoView
|
|
543
546
|
//
|
|
544
547
|
OperationResolver.make({
|
|
545
|
-
operation:
|
|
548
|
+
operation: LayoutOperation.ScrollIntoView,
|
|
546
549
|
handler: Effect.fnUntraced(function* (input) {
|
|
547
|
-
yield*
|
|
548
|
-
...
|
|
550
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.EphemeralState, (state) => ({
|
|
551
|
+
...state,
|
|
549
552
|
scrollIntoView: input.subject,
|
|
550
553
|
}));
|
|
551
554
|
}),
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
import React, { useCallback } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
9
|
|
|
10
10
|
import { DeckLayout } from '../../components';
|
|
11
11
|
import { useDeckState } from '../../hooks';
|
|
@@ -13,7 +13,7 @@ import { meta } from '../../meta';
|
|
|
13
13
|
|
|
14
14
|
export default Capability.makeModule(() =>
|
|
15
15
|
Effect.succeed(
|
|
16
|
-
Capability.contributes(
|
|
16
|
+
Capability.contributes(Capabilities.ReactRoot, {
|
|
17
17
|
id: meta.id,
|
|
18
18
|
root: () => {
|
|
19
19
|
const { state, updateEphemeral } = useDeckState();
|
|
@@ -5,28 +5,29 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import { useSettingsState } from '@dxos/app-framework/
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface, useSettingsState } from '@dxos/app-framework/ui';
|
|
10
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
10
11
|
|
|
11
|
-
import { Banner, DeckSettings } from '../../
|
|
12
|
+
import { Banner, DeckSettings } from '../../containers';
|
|
12
13
|
import { meta } from '../../meta';
|
|
13
14
|
import { type DeckSettingsProps } from '../../types';
|
|
14
15
|
|
|
15
16
|
export default Capability.makeModule(() =>
|
|
16
17
|
Effect.succeed(
|
|
17
|
-
Capability.contributes(
|
|
18
|
-
|
|
19
|
-
id: `${meta.id}
|
|
18
|
+
Capability.contributes(Capabilities.ReactSurface, [
|
|
19
|
+
Surface.create({
|
|
20
|
+
id: `${meta.id}.plugin-settings`,
|
|
20
21
|
role: 'article',
|
|
21
|
-
filter: (data): data is { subject:
|
|
22
|
-
|
|
22
|
+
filter: (data): data is { subject: AppCapabilities.Settings } =>
|
|
23
|
+
AppCapabilities.isSettings(data.subject) && data.subject.prefix === meta.id,
|
|
23
24
|
component: ({ data: { subject } }) => {
|
|
24
25
|
const { settings, updateSettings } = useSettingsState<DeckSettingsProps>(subject.atom);
|
|
25
26
|
return <DeckSettings settings={settings} onSettingsChange={updateSettings} />;
|
|
26
27
|
},
|
|
27
28
|
}),
|
|
28
|
-
|
|
29
|
-
id: `${meta.id}
|
|
29
|
+
Surface.create({
|
|
30
|
+
id: `${meta.id}.banner`,
|
|
30
31
|
role: 'banner',
|
|
31
32
|
component: ({ data }: { data: { variant?: 'topbar' | 'sidebar' } }) => {
|
|
32
33
|
return <Banner variant={data.variant} />;
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import { Capability
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
8
9
|
import { createKvsStore } from '@dxos/effect';
|
|
9
10
|
|
|
10
11
|
import { meta } from '../../meta';
|
|
@@ -28,7 +29,7 @@ export default Capability.makeModule(() =>
|
|
|
28
29
|
|
|
29
30
|
return [
|
|
30
31
|
Capability.contributes(DeckCapabilities.Settings, settingsAtom),
|
|
31
|
-
Capability.contributes(
|
|
32
|
+
Capability.contributes(AppCapabilities.Settings, {
|
|
32
33
|
prefix: meta.id,
|
|
33
34
|
schema: DeckSettingsSchema,
|
|
34
35
|
atom: settingsAtom,
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { Atom } from '@effect-atom/atom-react';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
10
|
import { createKvsStore } from '@dxos/effect';
|
|
10
11
|
import { invariant } from '@dxos/invariant';
|
|
11
12
|
|
|
@@ -49,11 +50,11 @@ const defaultDeckEphemeralState: DeckEphemeralStateProps = {
|
|
|
49
50
|
|
|
50
51
|
export default Capability.makeModule(
|
|
51
52
|
Effect.fnUntraced(function* () {
|
|
52
|
-
const registry = yield* Capability.get(
|
|
53
|
+
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
53
54
|
|
|
54
55
|
// Persisted state using KVS store.
|
|
55
56
|
const stateAtom = createKvsStore({
|
|
56
|
-
key: `${meta.id}
|
|
57
|
+
key: `${meta.id}.state`,
|
|
57
58
|
schema: DeckStateSchema,
|
|
58
59
|
defaultValue: () => ({ ...defaultDeckState }),
|
|
59
60
|
});
|
|
@@ -92,13 +93,13 @@ export default Capability.makeModule(
|
|
|
92
93
|
active: deck.solo ? [deck.solo] : deck.active,
|
|
93
94
|
inactive: deck.inactive,
|
|
94
95
|
scrollIntoView: ephemeral.scrollIntoView,
|
|
95
|
-
} satisfies
|
|
96
|
+
} satisfies AppCapabilities.Layout;
|
|
96
97
|
}).pipe(Atom.keepAlive);
|
|
97
98
|
|
|
98
99
|
return [
|
|
99
100
|
Capability.contributes(DeckCapabilities.State, stateAtom),
|
|
100
101
|
Capability.contributes(DeckCapabilities.EphemeralState, ephemeralAtom),
|
|
101
|
-
Capability.contributes(
|
|
102
|
+
Capability.contributes(AppCapabilities.Layout, layoutAtom),
|
|
102
103
|
];
|
|
103
104
|
}),
|
|
104
105
|
);
|