@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
package/dist/lib/browser/{operation-resolver-CDYBLZJ4.mjs → operation-resolver-2TEGT4PG.mjs}
RENAMED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
createEntryId,
|
|
5
|
-
incrementPlank,
|
|
6
|
-
openEntry
|
|
7
|
-
} from "./chunk-NHABISX2.mjs";
|
|
2
|
+
computeActiveUpdates
|
|
3
|
+
} from "./chunk-BJDEG7YZ.mjs";
|
|
8
4
|
import {
|
|
9
5
|
DeckCapabilities,
|
|
10
6
|
DeckOperation,
|
|
11
7
|
PLANK_COMPANION_TYPE,
|
|
12
8
|
defaultDeck,
|
|
13
9
|
getMode,
|
|
14
|
-
isLayoutMode
|
|
10
|
+
isLayoutMode
|
|
11
|
+
} from "./chunk-3P2FJVXC.mjs";
|
|
12
|
+
import {
|
|
15
13
|
meta
|
|
16
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-L3RYMAV7.mjs";
|
|
17
15
|
|
|
18
16
|
// src/capabilities/operation-resolver/operation-resolver.ts
|
|
19
17
|
import * as Effect from "effect/Effect";
|
|
20
18
|
import * as Function from "effect/Function";
|
|
21
19
|
import * as Option from "effect/Option";
|
|
22
|
-
import { Capability,
|
|
20
|
+
import { Capabilities, Capability, UndoOperation } from "@dxos/app-framework";
|
|
21
|
+
import { AppCapabilities, LayoutOperation, getCompanionVariant, isPinnedWorkspace } from "@dxos/app-toolkit";
|
|
23
22
|
import { Obj } from "@dxos/echo";
|
|
24
23
|
import { invariant } from "@dxos/invariant";
|
|
25
24
|
import { log } from "@dxos/log";
|
|
@@ -29,12 +28,77 @@ import { AttentionCapabilities } from "@dxos/plugin-attention";
|
|
|
29
28
|
import { Graph, Node } from "@dxos/plugin-graph";
|
|
30
29
|
import { ObservabilityOperation } from "@dxos/plugin-observability/types";
|
|
31
30
|
import { byPosition, isNonNullable } from "@dxos/util";
|
|
31
|
+
|
|
32
|
+
// src/layout.ts
|
|
33
|
+
import { produce } from "immer";
|
|
34
|
+
var openEntry = (deck, entryId, options) => {
|
|
35
|
+
return produce(deck, (draft) => {
|
|
36
|
+
if (draft.find((id) => id === entryId)) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const key = options?.key;
|
|
40
|
+
const plankPositioning = options?.positioning ?? "start";
|
|
41
|
+
const pivotId = options?.pivotId;
|
|
42
|
+
if (key) {
|
|
43
|
+
const index = draft.findIndex((id) => id.split("+")[0] === key);
|
|
44
|
+
if (index !== -1) {
|
|
45
|
+
draft.splice(index, 1, entryId);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (pivotId) {
|
|
50
|
+
const pivotIndex = draft.findIndex((id) => id === pivotId);
|
|
51
|
+
if (pivotIndex !== -1) {
|
|
52
|
+
if (plankPositioning === "start") {
|
|
53
|
+
draft.splice(pivotIndex, 0, entryId);
|
|
54
|
+
} else {
|
|
55
|
+
draft.splice(pivotIndex + 1, 0, entryId);
|
|
56
|
+
}
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (plankPositioning === "start") {
|
|
61
|
+
draft.unshift(entryId);
|
|
62
|
+
} else {
|
|
63
|
+
draft.push(entryId);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
var closeEntry = (deck, entryId) => {
|
|
68
|
+
return produce(deck, (draft) => {
|
|
69
|
+
const index = draft.findIndex((id) => id === entryId);
|
|
70
|
+
if (index !== -1) {
|
|
71
|
+
draft.splice(index, 1);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
var incrementPlank = (deck, adjustment) => {
|
|
76
|
+
return produce(deck, (draft) => {
|
|
77
|
+
const index = draft.findIndex((id) => id === adjustment.id);
|
|
78
|
+
if (index === -1 || adjustment.type === "increment-start" && index === 0 || adjustment.type === "increment-end" && index === draft.length - 1) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (adjustment.type === "increment-start") {
|
|
82
|
+
[draft[index - 1], draft[index]] = [
|
|
83
|
+
draft[index],
|
|
84
|
+
draft[index - 1]
|
|
85
|
+
];
|
|
86
|
+
} else if (adjustment.type === "increment-end") {
|
|
87
|
+
[draft[index], draft[index + 1]] = [
|
|
88
|
+
draft[index + 1],
|
|
89
|
+
draft[index]
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// src/capabilities/operation-resolver/operation-resolver.ts
|
|
32
96
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-deck/src/capabilities/operation-resolver/operation-resolver.ts";
|
|
33
97
|
var updateActiveDeck = (current, deckUpdates) => {
|
|
34
98
|
const currentDeck = current.decks[current.activeDeck];
|
|
35
99
|
invariant(currentDeck, `Deck not found: ${current.activeDeck}`, {
|
|
36
100
|
F: __dxlog_file,
|
|
37
|
-
L:
|
|
101
|
+
L: 41,
|
|
38
102
|
S: void 0,
|
|
39
103
|
A: [
|
|
40
104
|
"currentDeck",
|
|
@@ -53,18 +117,18 @@ var updateActiveDeck = (current, deckUpdates) => {
|
|
|
53
117
|
};
|
|
54
118
|
};
|
|
55
119
|
var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
56
|
-
return Capability.contributes(
|
|
120
|
+
return Capability.contributes(Capabilities.OperationResolver, [
|
|
57
121
|
//
|
|
58
122
|
// UpdateSidebar
|
|
59
123
|
//
|
|
60
124
|
OperationResolver.make({
|
|
61
|
-
operation:
|
|
125
|
+
operation: LayoutOperation.UpdateSidebar,
|
|
62
126
|
handler: Effect.fnUntraced(function* (input) {
|
|
63
|
-
const state = yield*
|
|
127
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
64
128
|
const next = input.state ?? state.sidebarState;
|
|
65
129
|
if (next !== state.sidebarState) {
|
|
66
|
-
yield*
|
|
67
|
-
...
|
|
130
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state2) => ({
|
|
131
|
+
...state2,
|
|
68
132
|
sidebarState: next
|
|
69
133
|
}));
|
|
70
134
|
}
|
|
@@ -74,17 +138,17 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
74
138
|
// UpdateComplementary
|
|
75
139
|
//
|
|
76
140
|
OperationResolver.make({
|
|
77
|
-
operation:
|
|
141
|
+
operation: LayoutOperation.UpdateComplementary,
|
|
78
142
|
handler: Effect.fnUntraced(function* (input) {
|
|
79
|
-
const state = yield*
|
|
143
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
80
144
|
const panelChanged = state.complementarySidebarPanel !== input.subject;
|
|
81
145
|
const next = input.subject ? "expanded" : input.state ?? state.complementarySidebarState;
|
|
82
146
|
const stateChanged = next !== state.complementarySidebarState;
|
|
83
147
|
if (panelChanged || stateChanged) {
|
|
84
|
-
yield*
|
|
85
|
-
...
|
|
86
|
-
complementarySidebarPanel: panelChanged ? input.subject :
|
|
87
|
-
complementarySidebarState: stateChanged ? next :
|
|
148
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state2) => ({
|
|
149
|
+
...state2,
|
|
150
|
+
complementarySidebarPanel: panelChanged ? input.subject : state2.complementarySidebarPanel,
|
|
151
|
+
complementarySidebarState: stateChanged ? next : state2.complementarySidebarState
|
|
88
152
|
}));
|
|
89
153
|
}
|
|
90
154
|
})
|
|
@@ -93,10 +157,10 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
93
157
|
// UpdateDialog
|
|
94
158
|
//
|
|
95
159
|
OperationResolver.make({
|
|
96
|
-
operation:
|
|
160
|
+
operation: LayoutOperation.UpdateDialog,
|
|
97
161
|
handler: Effect.fnUntraced(function* (input) {
|
|
98
|
-
yield*
|
|
99
|
-
...
|
|
162
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.EphemeralState, (state) => ({
|
|
163
|
+
...state,
|
|
100
164
|
dialogOpen: input.state ?? Boolean(input.subject),
|
|
101
165
|
dialogType: input.type ?? "default",
|
|
102
166
|
dialogBlockAlign: input.blockAlign ?? "center",
|
|
@@ -113,13 +177,14 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
113
177
|
// UpdatePopover
|
|
114
178
|
//
|
|
115
179
|
OperationResolver.make({
|
|
116
|
-
operation:
|
|
180
|
+
operation: LayoutOperation.UpdatePopover,
|
|
117
181
|
handler: Effect.fnUntraced(function* (input) {
|
|
118
|
-
yield*
|
|
119
|
-
...
|
|
182
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.EphemeralState, (state) => ({
|
|
183
|
+
...state,
|
|
120
184
|
popoverOpen: input.state ?? Boolean(input.subject),
|
|
121
185
|
popoverKind: input.kind ?? "base",
|
|
122
186
|
popoverTitle: input.kind === "card" ? input.title : void 0,
|
|
187
|
+
popoverContentRef: input.subjectRef,
|
|
123
188
|
popoverContent: typeof input.subject === "string" ? {
|
|
124
189
|
component: input.subject,
|
|
125
190
|
props: input.props
|
|
@@ -127,8 +192,8 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
127
192
|
subject: input.subject
|
|
128
193
|
} : null,
|
|
129
194
|
popoverSide: input.side,
|
|
130
|
-
popoverAnchor: input.variant === "virtual" ? input.anchor :
|
|
131
|
-
popoverAnchorId: input.variant !== "virtual" ? input.anchorId :
|
|
195
|
+
popoverAnchor: input.variant === "virtual" ? input.anchor : state.popoverAnchor,
|
|
196
|
+
popoverAnchorId: input.variant !== "virtual" ? input.anchorId : state.popoverAnchorId
|
|
132
197
|
}));
|
|
133
198
|
})
|
|
134
199
|
}),
|
|
@@ -136,12 +201,12 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
136
201
|
// AddToast
|
|
137
202
|
//
|
|
138
203
|
OperationResolver.make({
|
|
139
|
-
operation:
|
|
204
|
+
operation: LayoutOperation.AddToast,
|
|
140
205
|
handler: Effect.fnUntraced(function* (input) {
|
|
141
|
-
yield*
|
|
142
|
-
...
|
|
206
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.EphemeralState, (state) => ({
|
|
207
|
+
...state,
|
|
143
208
|
toasts: [
|
|
144
|
-
...
|
|
209
|
+
...state.toasts,
|
|
145
210
|
input
|
|
146
211
|
]
|
|
147
212
|
}));
|
|
@@ -151,12 +216,12 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
151
216
|
// ShowUndo
|
|
152
217
|
//
|
|
153
218
|
OperationResolver.make({
|
|
154
|
-
operation:
|
|
219
|
+
operation: UndoOperation.ShowUndo,
|
|
155
220
|
handler: Effect.fnUntraced(function* (input) {
|
|
156
|
-
const historyTracker = yield* Capability.get(
|
|
221
|
+
const historyTracker = yield* Capability.get(Capabilities.HistoryTracker);
|
|
157
222
|
const newUndoId = `show-undo-${Date.now()}`;
|
|
158
|
-
yield*
|
|
159
|
-
const filteredToasts =
|
|
223
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.EphemeralState, (state) => {
|
|
224
|
+
const filteredToasts = state.currentUndoId ? state.toasts.filter((toast2) => toast2.id !== state.currentUndoId) : state.toasts;
|
|
160
225
|
const toast = {
|
|
161
226
|
id: newUndoId,
|
|
162
227
|
title: input.message ?? [
|
|
@@ -187,7 +252,7 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
187
252
|
onAction: () => historyTracker.undoPromise()
|
|
188
253
|
};
|
|
189
254
|
return {
|
|
190
|
-
...
|
|
255
|
+
...state,
|
|
191
256
|
currentUndoId: newUndoId,
|
|
192
257
|
toasts: [
|
|
193
258
|
...filteredToasts,
|
|
@@ -201,7 +266,7 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
201
266
|
// SetLayoutMode
|
|
202
267
|
//
|
|
203
268
|
OperationResolver.make({
|
|
204
|
-
operation:
|
|
269
|
+
operation: LayoutOperation.SetLayoutMode,
|
|
205
270
|
filter: (input) => {
|
|
206
271
|
if ("mode" in input) {
|
|
207
272
|
return isLayoutMode(input.mode);
|
|
@@ -209,7 +274,7 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
209
274
|
return true;
|
|
210
275
|
},
|
|
211
276
|
handler: Effect.fnUntraced(function* (input) {
|
|
212
|
-
const state = yield*
|
|
277
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
213
278
|
const deck = yield* DeckCapabilities.getDeck();
|
|
214
279
|
const computeModeUpdate = (mode, subject) => {
|
|
215
280
|
const current = deck.solo ? [
|
|
@@ -244,24 +309,24 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
244
309
|
if ("mode" in input) {
|
|
245
310
|
const currentMode = getMode(deck);
|
|
246
311
|
const deckUpdates = computeModeUpdate(input.mode, "subject" in input ? input.subject : void 0);
|
|
247
|
-
yield*
|
|
312
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state2) => {
|
|
248
313
|
const newPreviousMode = currentMode !== input.mode ? {
|
|
249
|
-
...
|
|
250
|
-
[
|
|
251
|
-
} :
|
|
314
|
+
...state2.previousMode,
|
|
315
|
+
[state2.activeDeck]: currentMode
|
|
316
|
+
} : state2.previousMode;
|
|
252
317
|
return {
|
|
253
|
-
...updateActiveDeck(
|
|
318
|
+
...updateActiveDeck(state2, deckUpdates),
|
|
254
319
|
previousMode: newPreviousMode
|
|
255
320
|
};
|
|
256
321
|
});
|
|
257
322
|
} else if ("revert" in input) {
|
|
258
323
|
const last = state.previousMode[state.activeDeck];
|
|
259
324
|
const deckUpdates = computeModeUpdate(last ?? "solo");
|
|
260
|
-
yield*
|
|
325
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state2) => updateActiveDeck(state2, deckUpdates));
|
|
261
326
|
} else {
|
|
262
327
|
log.warn("Invalid layout mode", input, {
|
|
263
328
|
F: __dxlog_file,
|
|
264
|
-
L:
|
|
329
|
+
L: 258,
|
|
265
330
|
S: this,
|
|
266
331
|
C: (f, a) => f(...a)
|
|
267
332
|
});
|
|
@@ -272,33 +337,33 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
272
337
|
// SwitchWorkspace
|
|
273
338
|
//
|
|
274
339
|
OperationResolver.make({
|
|
275
|
-
operation:
|
|
340
|
+
operation: LayoutOperation.SwitchWorkspace,
|
|
276
341
|
handler: Effect.fnUntraced(function* (input) {
|
|
277
|
-
const { graph } = yield* Capability.get(
|
|
342
|
+
const { graph } = yield* Capability.get(AppCapabilities.AppGraph);
|
|
278
343
|
{
|
|
279
|
-
const state = yield*
|
|
280
|
-
const shouldUpdatePrevious = !state.activeDeck
|
|
281
|
-
yield*
|
|
282
|
-
const newDecks =
|
|
283
|
-
...
|
|
344
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
345
|
+
const shouldUpdatePrevious = !isPinnedWorkspace(state.activeDeck);
|
|
346
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state2) => {
|
|
347
|
+
const newDecks = state2.decks[input.subject] ? state2.decks : {
|
|
348
|
+
...state2.decks,
|
|
284
349
|
[input.subject]: {
|
|
285
350
|
...defaultDeck
|
|
286
351
|
}
|
|
287
352
|
};
|
|
288
353
|
return {
|
|
289
|
-
...
|
|
290
|
-
previousDeck: shouldUpdatePrevious ?
|
|
354
|
+
...state2,
|
|
355
|
+
previousDeck: shouldUpdatePrevious ? state2.activeDeck : state2.previousDeck,
|
|
291
356
|
activeDeck: input.subject,
|
|
292
357
|
decks: newDecks
|
|
293
358
|
};
|
|
294
359
|
});
|
|
295
360
|
}
|
|
296
361
|
{
|
|
297
|
-
const state = yield*
|
|
362
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
298
363
|
const deck = state.decks[input.subject];
|
|
299
364
|
invariant(deck, `Deck not found: ${input.subject}`, {
|
|
300
365
|
F: __dxlog_file,
|
|
301
|
-
L:
|
|
366
|
+
L: 293,
|
|
302
367
|
S: this,
|
|
303
368
|
A: [
|
|
304
369
|
"deck",
|
|
@@ -307,13 +372,13 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
307
372
|
});
|
|
308
373
|
const first = deck.solo ? deck.solo : deck.active[0];
|
|
309
374
|
if (first) {
|
|
310
|
-
yield* Operation.schedule(
|
|
375
|
+
yield* Operation.schedule(LayoutOperation.ScrollIntoView, {
|
|
311
376
|
subject: first
|
|
312
377
|
});
|
|
313
378
|
} else {
|
|
314
|
-
const [item] = Graph.getConnections(graph, input.subject).filter((node) => !Node.isActionLike(node) && !node.properties.disposition);
|
|
379
|
+
const [item] = Graph.getConnections(graph, input.subject, "child").filter((node) => !Node.isActionLike(node) && !node.properties.disposition);
|
|
315
380
|
if (item) {
|
|
316
|
-
yield* Operation.schedule(
|
|
381
|
+
yield* Operation.schedule(LayoutOperation.Open, {
|
|
317
382
|
subject: [
|
|
318
383
|
item.id
|
|
319
384
|
]
|
|
@@ -327,10 +392,10 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
327
392
|
// RevertWorkspace
|
|
328
393
|
//
|
|
329
394
|
OperationResolver.make({
|
|
330
|
-
operation:
|
|
395
|
+
operation: LayoutOperation.RevertWorkspace,
|
|
331
396
|
handler: Effect.fnUntraced(function* () {
|
|
332
|
-
const state = yield*
|
|
333
|
-
yield* Operation.invoke(
|
|
397
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
398
|
+
yield* Operation.invoke(LayoutOperation.SwitchWorkspace, {
|
|
334
399
|
subject: state.previousDeck
|
|
335
400
|
});
|
|
336
401
|
})
|
|
@@ -339,15 +404,15 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
339
404
|
// Open
|
|
340
405
|
//
|
|
341
406
|
OperationResolver.make({
|
|
342
|
-
operation:
|
|
407
|
+
operation: LayoutOperation.Open,
|
|
343
408
|
handler: Effect.fnUntraced(function* (input) {
|
|
344
|
-
const { graph } = yield* Capability.get(
|
|
409
|
+
const { graph } = yield* Capability.get(AppCapabilities.AppGraph);
|
|
345
410
|
const attention = yield* Capability.get(AttentionCapabilities.Attention);
|
|
346
|
-
const settings = yield*
|
|
411
|
+
const settings = yield* Capabilities.getAtomValue(DeckCapabilities.Settings);
|
|
347
412
|
{
|
|
348
|
-
const state = yield*
|
|
413
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
349
414
|
if (input.workspace && state.activeDeck !== input.workspace) {
|
|
350
|
-
yield* Operation.invoke(
|
|
415
|
+
yield* Operation.invoke(LayoutOperation.SwitchWorkspace, {
|
|
351
416
|
subject: input.workspace
|
|
352
417
|
});
|
|
353
418
|
}
|
|
@@ -358,18 +423,19 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
358
423
|
previouslyOpenIds = new Set(deck.solo ? [
|
|
359
424
|
deck.solo
|
|
360
425
|
] : deck.active);
|
|
361
|
-
const next = deck.solo ?
|
|
426
|
+
const next = deck.solo ? [
|
|
427
|
+
...input.subject
|
|
428
|
+
] : input.subject.reduce((acc, entryId) => openEntry(acc, entryId, {
|
|
362
429
|
key: input.key,
|
|
363
430
|
positioning: input.positioning ?? settings?.newPlankPositioning,
|
|
364
|
-
pivotId: input.pivotId
|
|
365
|
-
variant: input.variant
|
|
431
|
+
pivotId: input.pivotId
|
|
366
432
|
}), deck.active);
|
|
367
433
|
const { deckUpdates, toAttend: _toAttend } = computeActiveUpdates({
|
|
368
434
|
next,
|
|
369
435
|
deck,
|
|
370
436
|
attention
|
|
371
437
|
});
|
|
372
|
-
yield*
|
|
438
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => updateActiveDeck(state, deckUpdates));
|
|
373
439
|
}
|
|
374
440
|
{
|
|
375
441
|
const deck = yield* DeckCapabilities.getDeck();
|
|
@@ -378,12 +444,12 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
378
444
|
] : deck.active;
|
|
379
445
|
const newlyOpen = ids.filter((i) => !previouslyOpenIds.has(i));
|
|
380
446
|
if (input.scrollIntoView !== false && (newlyOpen[0] ?? input.subject[0])) {
|
|
381
|
-
yield* Operation.schedule(
|
|
447
|
+
yield* Operation.schedule(LayoutOperation.ScrollIntoView, {
|
|
382
448
|
subject: newlyOpen[0] ?? input.subject[0]
|
|
383
449
|
});
|
|
384
450
|
}
|
|
385
451
|
if (newlyOpen[0] ?? input.subject[0]) {
|
|
386
|
-
yield* Operation.schedule(
|
|
452
|
+
yield* Operation.schedule(LayoutOperation.Expose, {
|
|
387
453
|
subject: newlyOpen[0] ?? input.subject[0]
|
|
388
454
|
});
|
|
389
455
|
}
|
|
@@ -412,9 +478,9 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
412
478
|
OperationResolver.make({
|
|
413
479
|
operation: DeckOperation.UpdatePlankSize,
|
|
414
480
|
handler: Effect.fnUntraced(function* (input) {
|
|
415
|
-
yield*
|
|
481
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => updateActiveDeck(state, {
|
|
416
482
|
plankSizing: {
|
|
417
|
-
...
|
|
483
|
+
...state.decks[state.activeDeck]?.plankSizing,
|
|
418
484
|
[input.id]: input.size
|
|
419
485
|
}
|
|
420
486
|
}));
|
|
@@ -426,10 +492,10 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
426
492
|
OperationResolver.make({
|
|
427
493
|
operation: DeckOperation.Adjust,
|
|
428
494
|
handler: Effect.fnUntraced(function* (input) {
|
|
429
|
-
const _state = yield*
|
|
495
|
+
const _state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
430
496
|
const deck = yield* DeckCapabilities.getDeck();
|
|
431
497
|
const attention = yield* Capability.get(AttentionCapabilities.Attention);
|
|
432
|
-
const { graph } = yield* Capability.get(
|
|
498
|
+
const { graph } = yield* Capability.get(AppCapabilities.AppGraph);
|
|
433
499
|
let soloOperation;
|
|
434
500
|
if (input.type === "increment-end" || input.type === "increment-start") {
|
|
435
501
|
const next = incrementPlank(deck.active, input);
|
|
@@ -438,7 +504,7 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
438
504
|
deck,
|
|
439
505
|
attention
|
|
440
506
|
});
|
|
441
|
-
yield*
|
|
507
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => updateActiveDeck(state, deckUpdates));
|
|
442
508
|
}
|
|
443
509
|
if (input.type.startsWith("solo")) {
|
|
444
510
|
const entryId = input.id;
|
|
@@ -464,25 +530,24 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
464
530
|
}
|
|
465
531
|
}
|
|
466
532
|
if (soloOperation?.type === "solo") {
|
|
467
|
-
yield* Operation.invoke(
|
|
533
|
+
yield* Operation.invoke(LayoutOperation.SetLayoutMode, {
|
|
468
534
|
subject: soloOperation.entryId,
|
|
469
535
|
mode: soloOperation.mode
|
|
470
536
|
});
|
|
471
537
|
} else if (soloOperation?.type === "unsolo") {
|
|
472
|
-
yield* Operation.invoke(
|
|
538
|
+
yield* Operation.invoke(LayoutOperation.SetLayoutMode, {
|
|
473
539
|
mode: "deck"
|
|
474
540
|
});
|
|
475
|
-
yield* Operation.invoke(
|
|
541
|
+
yield* Operation.invoke(LayoutOperation.Open, {
|
|
476
542
|
subject: [
|
|
477
543
|
soloOperation.entryId
|
|
478
544
|
]
|
|
479
545
|
});
|
|
480
546
|
}
|
|
481
547
|
if (input.type === "companion") {
|
|
482
|
-
const companion = Function.pipe(Graph.getNode(graph, input.id), Option.map((node) => Graph.getConnections(graph, node.id).filter((n) => n.type === PLANK_COMPANION_TYPE).toSorted((a, b) => byPosition(a.properties, b.properties))), Option.flatMap((companions) => companions.length > 0 ? Option.some(companions[0]) : Option.none()));
|
|
548
|
+
const companion = Function.pipe(Graph.getNode(graph, input.id), Option.map((node) => Graph.getConnections(graph, node.id, "child").filter((n) => n.type === PLANK_COMPANION_TYPE).toSorted((a, b) => byPosition(a.properties, b.properties))), Option.flatMap((companions) => companions.length > 0 ? Option.some(companions[0]) : Option.none()));
|
|
483
549
|
if (Option.isSome(companion)) {
|
|
484
550
|
yield* Operation.invoke(DeckOperation.ChangeCompanion, {
|
|
485
|
-
primary: input.id,
|
|
486
551
|
companion: companion.value.id
|
|
487
552
|
});
|
|
488
553
|
}
|
|
@@ -495,28 +560,15 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
495
560
|
OperationResolver.make({
|
|
496
561
|
operation: DeckOperation.ChangeCompanion,
|
|
497
562
|
handler: Effect.fnUntraced(function* (input) {
|
|
498
|
-
const deck = yield* DeckCapabilities.getDeck();
|
|
499
563
|
if (input.companion === null) {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
activeCompanions: nextActiveCompanions
|
|
564
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => updateActiveDeck(state, {
|
|
565
|
+
companionOpen: false
|
|
503
566
|
}));
|
|
504
567
|
} else {
|
|
505
|
-
const
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
S: this,
|
|
510
|
-
A: [
|
|
511
|
-
"companion !== input.primary",
|
|
512
|
-
""
|
|
513
|
-
]
|
|
514
|
-
});
|
|
515
|
-
yield* Common.Capability.updateAtomValue(DeckCapabilities.State, (s) => updateActiveDeck(s, {
|
|
516
|
-
activeCompanions: {
|
|
517
|
-
...deck.activeCompanions,
|
|
518
|
-
[input.primary]: companion
|
|
519
|
-
}
|
|
568
|
+
const variant = getCompanionVariant(input.companion);
|
|
569
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => updateActiveDeck(state, {
|
|
570
|
+
companionOpen: true,
|
|
571
|
+
companionVariant: variant
|
|
520
572
|
}));
|
|
521
573
|
}
|
|
522
574
|
})
|
|
@@ -525,7 +577,7 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
525
577
|
// Close
|
|
526
578
|
//
|
|
527
579
|
OperationResolver.make({
|
|
528
|
-
operation:
|
|
580
|
+
operation: LayoutOperation.Close,
|
|
529
581
|
handler: Effect.fnUntraced(function* (input) {
|
|
530
582
|
const deck = yield* DeckCapabilities.getDeck();
|
|
531
583
|
const attention = yield* Capability.get(AttentionCapabilities.Attention);
|
|
@@ -538,17 +590,9 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
538
590
|
deck,
|
|
539
591
|
attention
|
|
540
592
|
});
|
|
541
|
-
yield*
|
|
542
|
-
for (const id of input.subject) {
|
|
543
|
-
if (deck.activeCompanions && id in deck.activeCompanions) {
|
|
544
|
-
yield* Operation.invoke(DeckOperation.ChangeCompanion, {
|
|
545
|
-
primary: id,
|
|
546
|
-
companion: null
|
|
547
|
-
});
|
|
548
|
-
}
|
|
549
|
-
}
|
|
593
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => updateActiveDeck(state, deckUpdates));
|
|
550
594
|
if (toAttend) {
|
|
551
|
-
yield* Operation.schedule(
|
|
595
|
+
yield* Operation.schedule(LayoutOperation.ScrollIntoView, {
|
|
552
596
|
subject: toAttend
|
|
553
597
|
});
|
|
554
598
|
}
|
|
@@ -558,7 +602,7 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
558
602
|
// Set
|
|
559
603
|
//
|
|
560
604
|
OperationResolver.make({
|
|
561
|
-
operation:
|
|
605
|
+
operation: LayoutOperation.Set,
|
|
562
606
|
handler: Effect.fnUntraced(function* (input) {
|
|
563
607
|
const deck = yield* DeckCapabilities.getDeck();
|
|
564
608
|
const attention = yield* Capability.get(AttentionCapabilities.Attention);
|
|
@@ -567,9 +611,9 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
567
611
|
deck,
|
|
568
612
|
attention
|
|
569
613
|
});
|
|
570
|
-
yield*
|
|
614
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => updateActiveDeck(state, deckUpdates));
|
|
571
615
|
if (toAttend) {
|
|
572
|
-
yield* Operation.schedule(
|
|
616
|
+
yield* Operation.schedule(LayoutOperation.ScrollIntoView, {
|
|
573
617
|
subject: toAttend
|
|
574
618
|
});
|
|
575
619
|
}
|
|
@@ -579,10 +623,10 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
579
623
|
// ScrollIntoView
|
|
580
624
|
//
|
|
581
625
|
OperationResolver.make({
|
|
582
|
-
operation:
|
|
626
|
+
operation: LayoutOperation.ScrollIntoView,
|
|
583
627
|
handler: Effect.fnUntraced(function* (input) {
|
|
584
|
-
yield*
|
|
585
|
-
...
|
|
628
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.EphemeralState, (state) => ({
|
|
629
|
+
...state,
|
|
586
630
|
scrollIntoView: input.subject
|
|
587
631
|
}));
|
|
588
632
|
})
|
|
@@ -592,4 +636,4 @@ var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(functio
|
|
|
592
636
|
export {
|
|
593
637
|
operation_resolver_default as default
|
|
594
638
|
};
|
|
595
|
-
//# sourceMappingURL=operation-resolver-
|
|
639
|
+
//# sourceMappingURL=operation-resolver-2TEGT4PG.mjs.map
|