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