@dxos/plugin-deck 0.8.4-main.ae835ea → 0.8.4-main.bc674ce
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/app-graph-builder-DTVCULQ4.mjs +120 -0
- package/dist/lib/browser/app-graph-builder-DTVCULQ4.mjs.map +7 -0
- package/dist/lib/browser/{check-app-scheme-HIEVFAAX.mjs → check-app-scheme-JSRXXIYF.mjs} +9 -9
- package/dist/lib/browser/check-app-scheme-JSRXXIYF.mjs.map +7 -0
- package/dist/lib/browser/{chunk-F3VCCHVL.mjs → chunk-ATFPDN6J.mjs} +149 -19
- package/dist/lib/browser/chunk-ATFPDN6J.mjs.map +7 -0
- package/dist/lib/browser/{chunk-CNTGBCMK.mjs → chunk-NHABISX2.mjs} +40 -33
- package/dist/lib/browser/chunk-NHABISX2.mjs.map +7 -0
- package/dist/lib/browser/chunk-S4A5UO4K.mjs +1448 -0
- package/dist/lib/browser/chunk-S4A5UO4K.mjs.map +7 -0
- package/dist/lib/browser/chunk-UNG4CLLP.mjs +161 -0
- package/dist/lib/browser/chunk-UNG4CLLP.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +72 -66
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-CDYBLZJ4.mjs +595 -0
- package/dist/lib/browser/operation-resolver-CDYBLZJ4.mjs.map +7 -0
- package/dist/lib/browser/react-root-XDCMNENQ.mjs +47 -0
- package/dist/lib/browser/react-root-XDCMNENQ.mjs.map +7 -0
- package/dist/lib/browser/react-surface-HODERLOL.mjs +42 -0
- package/dist/lib/browser/react-surface-HODERLOL.mjs.map +7 -0
- package/dist/lib/browser/settings-OMHVGZ6V.mjs +37 -0
- package/dist/lib/browser/settings-OMHVGZ6V.mjs.map +7 -0
- package/dist/lib/browser/state-OC3BSB6E.mjs +103 -0
- package/dist/lib/browser/state-OC3BSB6E.mjs.map +7 -0
- package/dist/lib/browser/toolkit-R53LD3EA.mjs +53 -0
- package/dist/lib/browser/toolkit-R53LD3EA.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +11 -4
- package/dist/lib/browser/url-handler-53TE6JZO.mjs +93 -0
- package/dist/lib/browser/url-handler-53TE6JZO.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-473BNZDJ.mjs +121 -0
- package/dist/lib/node-esm/app-graph-builder-473BNZDJ.mjs.map +7 -0
- package/dist/lib/node-esm/check-app-scheme-IVYRHKRH.mjs +33 -0
- package/dist/lib/node-esm/check-app-scheme-IVYRHKRH.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ADPMWKLL.mjs +154 -0
- package/dist/lib/node-esm/chunk-ADPMWKLL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-D34L3ECT.mjs +1449 -0
- package/dist/lib/node-esm/chunk-D34L3ECT.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SKEVPQ7E.mjs +162 -0
- package/dist/lib/node-esm/chunk-SKEVPQ7E.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XAKTY3EB.mjs +294 -0
- package/dist/lib/node-esm/chunk-XAKTY3EB.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +181 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/operation-resolver-WUOE33ID.mjs +596 -0
- package/dist/lib/node-esm/operation-resolver-WUOE33ID.mjs.map +7 -0
- package/dist/lib/node-esm/react-root-O6GZO62Z.mjs +48 -0
- package/dist/lib/node-esm/react-root-O6GZO62Z.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-IHDJDGC5.mjs +43 -0
- package/dist/lib/node-esm/react-surface-IHDJDGC5.mjs.map +7 -0
- package/dist/lib/node-esm/settings-2HB6FKIK.mjs +38 -0
- package/dist/lib/node-esm/settings-2HB6FKIK.mjs.map +7 -0
- package/dist/lib/node-esm/state-JRQ45ACJ.mjs +104 -0
- package/dist/lib/node-esm/state-JRQ45ACJ.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-JLPZNNKB.mjs +54 -0
- package/dist/lib/node-esm/toolkit-JLPZNNKB.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +40 -0
- package/dist/lib/node-esm/url-handler-QGF2R24T.mjs +94 -0
- package/dist/lib/node-esm/url-handler-QGF2R24T.mjs.map +7 -0
- package/dist/types/src/DeckPlugin.d.ts +2 -1
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/check-app-scheme/check-app-scheme.d.ts +5 -0
- package/dist/types/src/capabilities/check-app-scheme/check-app-scheme.d.ts.map +1 -0
- package/dist/types/src/capabilities/check-app-scheme/index.d.ts +3 -0
- package/dist/types/src/capabilities/check-app-scheme/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +8 -13
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root/index.d.ts +6 -0
- package/dist/types/src/capabilities/react-root/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root/react-root.d.ts +9 -0
- package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +19 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +21 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +172 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +175 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit/index.d.ts +3 -0
- package/dist/types/src/capabilities/toolkit/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts +26 -0
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +1 -0
- package/dist/types/src/capabilities/tools/index.d.ts +3 -0
- package/dist/types/src/capabilities/tools/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/tools/tools.d.ts +12 -0
- package/dist/types/src/capabilities/tools/tools.d.ts.map +1 -0
- package/dist/types/src/capabilities/url-handler/index.d.ts +3 -0
- package/dist/types/src/capabilities/url-handler/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts +5 -0
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts +1 -1
- 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/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/DeckSettings/DeckSettings.d.ts +4 -2
- package/dist/types/src/components/DeckSettings/DeckSettings.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.d.ts +3 -3
- package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.stories.d.ts +23 -5
- package/dist/types/src/components/Plank/Plank.stories.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankControls.d.ts +1 -1
- package/dist/types/src/components/Plank/PlankControls.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankError.d.ts +1 -1
- package/dist/types/src/components/Plank/PlankError.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankHeading.d.ts +2 -2
- 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/Sidebar/Sidebar.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/SidebarButton.d.ts.map +1 -1
- 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 +3 -3
- package/dist/types/src/hooks/useDeckCompanions.d.ts.map +1 -1
- package/dist/types/src/hooks/useDeckState.d.ts +17 -0
- package/dist/types/src/hooks/useDeckState.d.ts.map +1 -0
- package/dist/types/src/hooks/useHoistStatusbar.d.ts +1 -1
- package/dist/types/src/hooks/useHoistStatusbar.d.ts.map +1 -1
- package/dist/types/src/hooks/useNodeActionExpander.d.ts +1 -1
- package/dist/types/src/hooks/useNodeActionExpander.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -1
- package/dist/types/src/{capabilities → types}/capabilities.d.ts +96 -90
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +7 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +86 -27
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/src/util/set-active.d.ts +18 -3
- package/dist/types/src/util/set-active.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +53 -47
- package/src/DeckPlugin.ts +27 -48
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +118 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/{check-app-scheme.ts → check-app-scheme/check-app-scheme.ts} +12 -11
- package/src/capabilities/check-app-scheme/index.ts +7 -0
- package/src/capabilities/index.ts +9 -14
- package/src/capabilities/operation-resolver/index.ts +10 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +555 -0
- package/src/capabilities/react-root/index.ts +7 -0
- package/src/capabilities/react-root/react-root.tsx +47 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +37 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +38 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +104 -0
- package/src/capabilities/toolkit/index.ts +7 -0
- package/src/capabilities/toolkit/toolkit.ts +63 -0
- package/src/capabilities/tools/index.ts +7 -0
- package/src/capabilities/tools/tools.ts +92 -0
- package/src/capabilities/url-handler/index.ts +7 -0
- package/src/capabilities/url-handler/url-handler.ts +95 -0
- package/src/components/DeckLayout/ActiveNode.tsx +1 -1
- package/src/components/DeckLayout/Banner.tsx +3 -3
- package/src/components/DeckLayout/ContentEmpty.tsx +3 -4
- package/src/components/DeckLayout/DeckLayout.stories.tsx +18 -31
- package/src/components/DeckLayout/DeckLayout.tsx +13 -11
- package/src/components/DeckLayout/DeckMain.tsx +45 -44
- package/src/components/DeckLayout/Dialog.tsx +13 -10
- package/src/components/DeckLayout/Fallback.tsx +2 -2
- package/src/components/DeckLayout/Popover.tsx +44 -32
- package/src/components/DeckLayout/StatusBar.tsx +1 -1
- package/src/components/DeckLayout/Toast.tsx +5 -5
- package/src/components/DeckSettings/DeckSettings.tsx +18 -8
- package/src/components/Plank/Plank.stories.tsx +14 -6
- package/src/components/Plank/Plank.tsx +66 -49
- package/src/components/Plank/PlankControls.tsx +6 -6
- package/src/components/Plank/PlankError.tsx +2 -2
- package/src/components/Plank/PlankHeading.tsx +29 -35
- package/src/components/Sidebar/ComplementarySidebar.tsx +54 -27
- package/src/components/Sidebar/Sidebar.tsx +4 -4
- package/src/components/Sidebar/SidebarButton.tsx +35 -28
- package/src/components/fragments.ts +1 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useCompanions.ts +1 -1
- package/src/hooks/useDeckCompanions.ts +6 -4
- package/src/hooks/useDeckState.ts +82 -0
- package/src/hooks/useHoistStatusbar.ts +3 -5
- package/src/hooks/useNodeActionExpander.ts +4 -4
- package/src/index.ts +1 -2
- package/src/meta.ts +2 -2
- package/src/translations.ts +1 -1
- package/src/types/capabilities.ts +33 -0
- package/src/types/events.ts +20 -0
- package/src/types/index.ts +2 -0
- package/src/types/schema.ts +81 -11
- package/src/util/layoutAppliesTopbar.ts +1 -1
- package/src/util/set-active.ts +49 -29
- package/dist/lib/browser/app-graph-builder-PCMSER2O.mjs +0 -153
- package/dist/lib/browser/app-graph-builder-PCMSER2O.mjs.map +0 -7
- package/dist/lib/browser/check-app-scheme-HIEVFAAX.mjs.map +0 -7
- package/dist/lib/browser/chunk-27I7DJUG.mjs +0 -129
- package/dist/lib/browser/chunk-27I7DJUG.mjs.map +0 -7
- package/dist/lib/browser/chunk-5KMJPIQC.mjs +0 -16
- package/dist/lib/browser/chunk-5KMJPIQC.mjs.map +0 -7
- package/dist/lib/browser/chunk-CNTGBCMK.mjs.map +0 -7
- package/dist/lib/browser/chunk-F3VCCHVL.mjs.map +0 -7
- package/dist/lib/browser/chunk-MFFZK4LT.mjs +0 -127
- package/dist/lib/browser/chunk-MFFZK4LT.mjs.map +0 -7
- package/dist/lib/browser/chunk-SBJLGRJV.mjs +0 -1532
- package/dist/lib/browser/chunk-SBJLGRJV.mjs.map +0 -7
- package/dist/lib/browser/chunk-UXLU6CMW.mjs +0 -16
- package/dist/lib/browser/chunk-UXLU6CMW.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-Q3KETDSS.mjs +0 -524
- package/dist/lib/browser/intent-resolver-Q3KETDSS.mjs.map +0 -7
- package/dist/lib/browser/react-root-LU3662ME.mjs +0 -43
- package/dist/lib/browser/react-root-LU3662ME.mjs.map +0 -7
- package/dist/lib/browser/react-surface-TDBFPN5T.mjs +0 -40
- package/dist/lib/browser/react-surface-TDBFPN5T.mjs.map +0 -7
- package/dist/lib/browser/settings-SDPTOCCM.mjs +0 -30
- package/dist/lib/browser/settings-SDPTOCCM.mjs.map +0 -7
- package/dist/lib/browser/state-QTVNH7N6.mjs +0 -12
- package/dist/lib/browser/toolkit-TM2Y6YL2.mjs +0 -53
- package/dist/lib/browser/toolkit-TM2Y6YL2.mjs.map +0 -7
- package/dist/lib/browser/url-handler-QEYGYE2H.mjs +0 -70
- package/dist/lib/browser/url-handler-QEYGYE2H.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/check-app-scheme.d.ts +0 -4
- package/dist/types/src/capabilities/check-app-scheme.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-root.d.ts +0 -7
- package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state.d.ts +0 -104
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/toolkit.d.ts +0 -23
- package/dist/types/src/capabilities/toolkit.d.ts.map +0 -1
- package/dist/types/src/capabilities/tools.d.ts +0 -11
- package/dist/types/src/capabilities/tools.d.ts.map +0 -1
- package/dist/types/src/capabilities/url-handler.d.ts +0 -4
- package/dist/types/src/capabilities/url-handler.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -143
- package/src/capabilities/capabilities.ts +0 -14
- package/src/capabilities/intent-resolver.ts +0 -472
- package/src/capabilities/react-root.tsx +0 -39
- package/src/capabilities/react-surface.tsx +0 -30
- package/src/capabilities/settings.ts +0 -27
- package/src/capabilities/state.ts +0 -108
- package/src/capabilities/toolkit.ts +0 -68
- package/src/capabilities/tools.ts +0 -84
- package/src/capabilities/url-handler.ts +0 -60
- package/src/events.ts +0 -11
- /package/dist/lib/{browser/state-QTVNH7N6.mjs.map → node-esm/types/index.mjs.map} +0 -0
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { defineCapability } from '@dxos/app-framework';
|
|
6
|
-
import { type DeepReadonly } from '@dxos/util';
|
|
7
|
-
|
|
8
|
-
import { meta } from '../meta';
|
|
9
|
-
import { type DeckPluginState } from '../types';
|
|
10
|
-
|
|
11
|
-
export namespace DeckCapabilities {
|
|
12
|
-
export const DeckState = defineCapability<DeepReadonly<DeckPluginState>>(`${meta.id}/capability/state`);
|
|
13
|
-
export const MutableDeckState = defineCapability<DeckPluginState>(`${meta.id}/capability/state`);
|
|
14
|
-
}
|
|
@@ -1,472 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { batch } from '@preact/signals-core';
|
|
6
|
-
import * as Effect from 'effect/Effect';
|
|
7
|
-
import * as Function from 'effect/Function';
|
|
8
|
-
import * as Option from 'effect/Option';
|
|
9
|
-
import * as Schema from 'effect/Schema';
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
Capabilities,
|
|
13
|
-
IntentAction,
|
|
14
|
-
LayoutAction,
|
|
15
|
-
type PluginContext,
|
|
16
|
-
chain,
|
|
17
|
-
contributes,
|
|
18
|
-
createIntent,
|
|
19
|
-
createResolver,
|
|
20
|
-
} from '@dxos/app-framework';
|
|
21
|
-
import { Obj } from '@dxos/echo';
|
|
22
|
-
import { invariant } from '@dxos/invariant';
|
|
23
|
-
import { isLiveObject } from '@dxos/live-object';
|
|
24
|
-
import { log } from '@dxos/log';
|
|
25
|
-
import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
26
|
-
import { isActionLike } from '@dxos/plugin-graph';
|
|
27
|
-
import { ObservabilityAction } from '@dxos/plugin-observability/types';
|
|
28
|
-
import { byPosition, isNonNullable } from '@dxos/util';
|
|
29
|
-
|
|
30
|
-
import { closeEntry, createEntryId, incrementPlank, openEntry } from '../layout';
|
|
31
|
-
import { meta } from '../meta';
|
|
32
|
-
import {
|
|
33
|
-
DeckAction,
|
|
34
|
-
type DeckSettingsProps,
|
|
35
|
-
type LayoutMode,
|
|
36
|
-
PLANK_COMPANION_TYPE,
|
|
37
|
-
defaultDeck,
|
|
38
|
-
getMode,
|
|
39
|
-
isLayoutMode,
|
|
40
|
-
} from '../types';
|
|
41
|
-
import { setActive } from '../util';
|
|
42
|
-
|
|
43
|
-
import { DeckCapabilities } from './capabilities';
|
|
44
|
-
|
|
45
|
-
export default (context: PluginContext) =>
|
|
46
|
-
contributes(Capabilities.IntentResolver, [
|
|
47
|
-
createResolver({
|
|
48
|
-
intent: IntentAction.ShowUndo,
|
|
49
|
-
resolve: (data) => {
|
|
50
|
-
const layout = context.getCapability(DeckCapabilities.MutableDeckState);
|
|
51
|
-
const { undoPromise: undo } = context.getCapability(Capabilities.IntentDispatcher);
|
|
52
|
-
|
|
53
|
-
// TODO(wittjosiah): Support undoing further back than the last action.
|
|
54
|
-
if (layout.currentUndoId) {
|
|
55
|
-
layout.toasts = layout.toasts.filter((toast) => toast.id !== layout.currentUndoId);
|
|
56
|
-
}
|
|
57
|
-
layout.currentUndoId = `${IntentAction.ShowUndo._tag}-${Date.now()}`;
|
|
58
|
-
layout.toasts = [
|
|
59
|
-
...layout.toasts,
|
|
60
|
-
{
|
|
61
|
-
id: layout.currentUndoId,
|
|
62
|
-
title: data.message ?? ['undo available label', { ns: meta.id }],
|
|
63
|
-
duration: 10_000,
|
|
64
|
-
actionLabel: ['undo action label', { ns: meta.id }],
|
|
65
|
-
actionAlt: ['undo action alt', { ns: meta.id }],
|
|
66
|
-
closeLabel: ['undo close label', { ns: meta.id }],
|
|
67
|
-
onAction: () => undo(),
|
|
68
|
-
},
|
|
69
|
-
];
|
|
70
|
-
},
|
|
71
|
-
}),
|
|
72
|
-
createResolver({
|
|
73
|
-
intent: LayoutAction.UpdateLayout,
|
|
74
|
-
// TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.UpdateSidebar.fields.input)`
|
|
75
|
-
// but the filter is not being applied correctly.
|
|
76
|
-
filter: (data): data is Schema.Schema.Type<typeof LayoutAction.UpdateSidebar.fields.input> =>
|
|
77
|
-
Schema.is(LayoutAction.UpdateSidebar.fields.input)(data),
|
|
78
|
-
resolve: ({ options }) => {
|
|
79
|
-
const layout = context.getCapability(DeckCapabilities.MutableDeckState);
|
|
80
|
-
const next = options?.state ?? layout.sidebarState;
|
|
81
|
-
if (next !== layout.sidebarState) {
|
|
82
|
-
layout.sidebarState = next;
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
}),
|
|
86
|
-
createResolver({
|
|
87
|
-
intent: LayoutAction.UpdateLayout,
|
|
88
|
-
// TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.UpdateComplementary.fields.input)`
|
|
89
|
-
// but the filter is not being applied correctly.
|
|
90
|
-
filter: (data): data is Schema.Schema.Type<typeof LayoutAction.UpdateComplementary.fields.input> =>
|
|
91
|
-
Schema.is(LayoutAction.UpdateComplementary.fields.input)(data),
|
|
92
|
-
resolve: ({ subject, options }) => {
|
|
93
|
-
const layout = context.getCapability(DeckCapabilities.MutableDeckState);
|
|
94
|
-
|
|
95
|
-
if (layout.complementarySidebarPanel !== subject) {
|
|
96
|
-
layout.complementarySidebarPanel = subject;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const next = subject ? 'expanded' : (options?.state ?? layout.complementarySidebarState);
|
|
100
|
-
if (next !== layout.complementarySidebarState) {
|
|
101
|
-
layout.complementarySidebarState = next;
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
}),
|
|
105
|
-
createResolver({
|
|
106
|
-
intent: LayoutAction.UpdateLayout,
|
|
107
|
-
// TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.UpdateDialog.fields.input)`
|
|
108
|
-
// but the filter is not being applied correctly.
|
|
109
|
-
filter: (data): data is Schema.Schema.Type<typeof LayoutAction.UpdateDialog.fields.input> =>
|
|
110
|
-
Schema.is(LayoutAction.UpdateDialog.fields.input)(data),
|
|
111
|
-
resolve: ({ subject, options }) => {
|
|
112
|
-
const layout = context.getCapability(DeckCapabilities.MutableDeckState);
|
|
113
|
-
layout.dialogOpen = options.state ?? Boolean(subject);
|
|
114
|
-
layout.dialogType = options.type ?? 'default';
|
|
115
|
-
layout.dialogBlockAlign = options.blockAlign ?? 'center';
|
|
116
|
-
layout.dialogOverlayClasses = options.overlayClasses;
|
|
117
|
-
layout.dialogOverlayStyle = options.overlayStyle;
|
|
118
|
-
layout.dialogContent = subject ? { component: subject, props: options.props } : null;
|
|
119
|
-
},
|
|
120
|
-
}),
|
|
121
|
-
createResolver({
|
|
122
|
-
intent: LayoutAction.UpdateLayout,
|
|
123
|
-
// TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.UpdatePopover.fields.input)`
|
|
124
|
-
// but the filter is not being applied correctly.
|
|
125
|
-
filter: (data): data is Schema.Schema.Type<typeof LayoutAction.UpdatePopover.fields.input> =>
|
|
126
|
-
Schema.is(LayoutAction.UpdatePopover.fields.input)(data),
|
|
127
|
-
resolve: ({ subject, options }) => {
|
|
128
|
-
const layout = context.getCapability(DeckCapabilities.MutableDeckState);
|
|
129
|
-
layout.popoverOpen = options.state ?? Boolean(subject);
|
|
130
|
-
layout.popoverContent =
|
|
131
|
-
typeof subject === 'string' ? { component: subject, props: options.props } : subject ? { subject } : null;
|
|
132
|
-
layout.popoverSide = options.side;
|
|
133
|
-
if (options.variant === 'virtual') {
|
|
134
|
-
layout.popoverAnchor = options.anchor;
|
|
135
|
-
} else {
|
|
136
|
-
layout.popoverAnchorId = options.anchorId;
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
}),
|
|
140
|
-
createResolver({
|
|
141
|
-
intent: LayoutAction.UpdateLayout,
|
|
142
|
-
// TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.AddToast.fields.input)`
|
|
143
|
-
// but the filter is not being applied correctly.
|
|
144
|
-
filter: (data): data is Schema.Schema.Type<typeof LayoutAction.AddToast.fields.input> =>
|
|
145
|
-
Schema.is(LayoutAction.AddToast.fields.input)(data),
|
|
146
|
-
resolve: ({ subject }) => {
|
|
147
|
-
const layout = context.getCapability(DeckCapabilities.MutableDeckState);
|
|
148
|
-
layout.toasts.push(subject);
|
|
149
|
-
},
|
|
150
|
-
}),
|
|
151
|
-
createResolver({
|
|
152
|
-
intent: LayoutAction.UpdateLayout,
|
|
153
|
-
// TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.SetLayoutMode.fields.input)`
|
|
154
|
-
// but the filter is not being applied correctly.
|
|
155
|
-
filter: (data): data is Schema.Schema.Type<typeof LayoutAction.SetLayoutMode.fields.input> => {
|
|
156
|
-
if (!Schema.is(LayoutAction.SetLayoutMode.fields.input)(data)) {
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
if ('mode' in data.options) {
|
|
161
|
-
return isLayoutMode(data.options.mode);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return true;
|
|
165
|
-
},
|
|
166
|
-
resolve: ({ subject, options }) => {
|
|
167
|
-
const state = context.getCapability(DeckCapabilities.MutableDeckState);
|
|
168
|
-
|
|
169
|
-
const setMode = (mode: LayoutMode) => {
|
|
170
|
-
const deck = state.deck;
|
|
171
|
-
const current = deck.solo ? [deck.solo] : deck.active;
|
|
172
|
-
// When un-soloing, the solo entry is added to the deck.
|
|
173
|
-
const next = (
|
|
174
|
-
mode !== 'deck' ? [subject ?? deck.solo ?? deck.active[0]] : [...deck.active, deck.solo]
|
|
175
|
-
).filter(isNonNullable);
|
|
176
|
-
|
|
177
|
-
const removed = current.filter((id) => !next.includes(id));
|
|
178
|
-
const closed = Array.from(new Set([...deck.inactive.filter((id) => !next.includes(id)), ...removed]));
|
|
179
|
-
deck.inactive = closed;
|
|
180
|
-
|
|
181
|
-
if (mode !== 'deck' && next[0]) {
|
|
182
|
-
deck.solo = next[0];
|
|
183
|
-
} else if (mode === 'deck' && deck.solo) {
|
|
184
|
-
deck.solo = undefined;
|
|
185
|
-
deck.initialized = true;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (mode === 'solo--fullscreen') {
|
|
189
|
-
deck.fullscreen = !deck.fullscreen;
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
return batch(() => {
|
|
194
|
-
if ('mode' in options) {
|
|
195
|
-
const current = getMode(state.deck);
|
|
196
|
-
if (current !== options.mode) {
|
|
197
|
-
state.previousMode[state.activeDeck] = current;
|
|
198
|
-
}
|
|
199
|
-
setMode(options.mode as LayoutMode);
|
|
200
|
-
} else if ('revert' in options) {
|
|
201
|
-
const last = state.previousMode[state.activeDeck];
|
|
202
|
-
setMode(last ?? 'solo');
|
|
203
|
-
} else {
|
|
204
|
-
log.warn('Invalid layout mode', options);
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
},
|
|
208
|
-
}),
|
|
209
|
-
createResolver({
|
|
210
|
-
intent: LayoutAction.UpdateLayout,
|
|
211
|
-
filter: (data): data is Schema.Schema.Type<typeof LayoutAction.SwitchWorkspace.fields.input> =>
|
|
212
|
-
Schema.is(LayoutAction.SwitchWorkspace.fields.input)(data),
|
|
213
|
-
resolve: ({ subject }) => {
|
|
214
|
-
const { graph } = context.getCapability(Capabilities.AppGraph);
|
|
215
|
-
const state = context.getCapability(DeckCapabilities.MutableDeckState);
|
|
216
|
-
batch(() => {
|
|
217
|
-
// TODO(wittjosiah): This is a hack to prevent the previous deck from being set for pinned items.
|
|
218
|
-
// Ideally this should be worked into the data model in a generic way.
|
|
219
|
-
if (!state.activeDeck.startsWith('!')) {
|
|
220
|
-
state.previousDeck = state.activeDeck;
|
|
221
|
-
}
|
|
222
|
-
state.activeDeck = subject;
|
|
223
|
-
if (!state.decks[subject]) {
|
|
224
|
-
state.decks[subject] = { ...defaultDeck };
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
const first = state.deck.solo ? state.deck.solo : state.deck.active[0];
|
|
229
|
-
if (first) {
|
|
230
|
-
return {
|
|
231
|
-
intents: [createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: first })],
|
|
232
|
-
};
|
|
233
|
-
} else {
|
|
234
|
-
const [item] = graph
|
|
235
|
-
.getConnections(subject)
|
|
236
|
-
.filter((node) => !isActionLike(node) && !node.properties.disposition);
|
|
237
|
-
if (item) {
|
|
238
|
-
return {
|
|
239
|
-
intents: [createIntent(LayoutAction.Open, { part: 'main', subject: [item.id] })],
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
}),
|
|
245
|
-
createResolver({
|
|
246
|
-
intent: LayoutAction.UpdateLayout,
|
|
247
|
-
filter: (data): data is Schema.Schema.Type<typeof LayoutAction.RevertWorkspace.fields.input> =>
|
|
248
|
-
Schema.is(LayoutAction.RevertWorkspace.fields.input)(data),
|
|
249
|
-
resolve: () => {
|
|
250
|
-
const state = context.getCapability(DeckCapabilities.MutableDeckState);
|
|
251
|
-
return {
|
|
252
|
-
intents: [createIntent(LayoutAction.SwitchWorkspace, { part: 'workspace', subject: state.previousDeck })],
|
|
253
|
-
};
|
|
254
|
-
},
|
|
255
|
-
}),
|
|
256
|
-
createResolver({
|
|
257
|
-
intent: LayoutAction.UpdateLayout,
|
|
258
|
-
filter: (data): data is Schema.Schema.Type<typeof LayoutAction.Open.fields.input> =>
|
|
259
|
-
Schema.is(LayoutAction.Open.fields.input)(data),
|
|
260
|
-
resolve: ({ subject, options }) =>
|
|
261
|
-
Effect.gen(function* () {
|
|
262
|
-
const { graph } = context.getCapability(Capabilities.AppGraph);
|
|
263
|
-
const state = context.getCapability(DeckCapabilities.MutableDeckState);
|
|
264
|
-
const attention = context.getCapability(AttentionCapabilities.Attention);
|
|
265
|
-
const settings = context
|
|
266
|
-
.getCapabilities(Capabilities.SettingsStore)[0]
|
|
267
|
-
?.getStore<DeckSettingsProps>(meta.id)?.value;
|
|
268
|
-
|
|
269
|
-
if (options?.workspace && state.activeDeck !== options?.workspace) {
|
|
270
|
-
const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
271
|
-
yield* dispatch(
|
|
272
|
-
createIntent(LayoutAction.SwitchWorkspace, { part: 'workspace', subject: options.workspace }),
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
const previouslyOpenIds = new Set<string>(state.deck.solo ? [state.deck.solo] : state.deck.active);
|
|
277
|
-
batch(() => {
|
|
278
|
-
const next = state.deck.solo
|
|
279
|
-
? (subject as string[]).map((id) => createEntryId(id, options?.variant))
|
|
280
|
-
: subject.reduce(
|
|
281
|
-
(acc, entryId) =>
|
|
282
|
-
openEntry(acc, entryId, {
|
|
283
|
-
key: options?.key,
|
|
284
|
-
positioning: options?.positioning ?? settings?.newPlankPositioning,
|
|
285
|
-
pivotId: options?.pivotId,
|
|
286
|
-
variant: options?.variant,
|
|
287
|
-
}),
|
|
288
|
-
state.deck.active,
|
|
289
|
-
);
|
|
290
|
-
|
|
291
|
-
return setActive({ next, state, attention });
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
const ids = state.deck.solo ? [state.deck.solo] : state.deck.active;
|
|
295
|
-
const newlyOpen = ids.filter((i) => !previouslyOpenIds.has(i));
|
|
296
|
-
|
|
297
|
-
return {
|
|
298
|
-
intents: [
|
|
299
|
-
...(options?.scrollIntoView !== false
|
|
300
|
-
? [createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: newlyOpen[0] ?? subject[0] })]
|
|
301
|
-
: []),
|
|
302
|
-
createIntent(LayoutAction.Expose, { part: 'navigation', subject: newlyOpen[0] ?? subject[0] }),
|
|
303
|
-
...newlyOpen.map((subjectId) => {
|
|
304
|
-
const typename = Option.match(graph.getNode(subjectId), {
|
|
305
|
-
onNone: () => undefined,
|
|
306
|
-
onSome: (node) => {
|
|
307
|
-
const active = node.data;
|
|
308
|
-
return isLiveObject(active) ? Obj.getTypename(active) : undefined;
|
|
309
|
-
},
|
|
310
|
-
});
|
|
311
|
-
return createIntent(ObservabilityAction.SendEvent, {
|
|
312
|
-
name: 'navigation.activate',
|
|
313
|
-
properties: {
|
|
314
|
-
subjectId,
|
|
315
|
-
typename,
|
|
316
|
-
},
|
|
317
|
-
});
|
|
318
|
-
}),
|
|
319
|
-
],
|
|
320
|
-
};
|
|
321
|
-
}),
|
|
322
|
-
}),
|
|
323
|
-
createResolver({
|
|
324
|
-
intent: LayoutAction.UpdateLayout,
|
|
325
|
-
filter: (data): data is Schema.Schema.Type<typeof LayoutAction.Close.fields.input> =>
|
|
326
|
-
Schema.is(LayoutAction.Close.fields.input)(data),
|
|
327
|
-
resolve: ({ subject }) => {
|
|
328
|
-
const state = context.getCapability(DeckCapabilities.MutableDeckState);
|
|
329
|
-
const attention = context.getCapability(AttentionCapabilities.Attention);
|
|
330
|
-
const active = state.deck.solo ? [state.deck.solo] : state.deck.active;
|
|
331
|
-
const next = subject.reduce((acc, id) => closeEntry(acc, id), active);
|
|
332
|
-
const toAttend = setActive({ next, state, attention });
|
|
333
|
-
|
|
334
|
-
const clearCompanionIntents = subject
|
|
335
|
-
.filter((id) => state.deck.activeCompanions && id in state.deck.activeCompanions)
|
|
336
|
-
.map((primary) => createIntent(DeckAction.ChangeCompanion, { primary, companion: null }));
|
|
337
|
-
|
|
338
|
-
return {
|
|
339
|
-
intents: [
|
|
340
|
-
...clearCompanionIntents,
|
|
341
|
-
...(toAttend ? [createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: toAttend })] : []),
|
|
342
|
-
],
|
|
343
|
-
};
|
|
344
|
-
},
|
|
345
|
-
}),
|
|
346
|
-
createResolver({
|
|
347
|
-
intent: LayoutAction.UpdateLayout,
|
|
348
|
-
filter: (data): data is Schema.Schema.Type<typeof LayoutAction.Set.fields.input> =>
|
|
349
|
-
Schema.is(LayoutAction.Set.fields.input)(data),
|
|
350
|
-
resolve: ({ subject }) => {
|
|
351
|
-
const state = context.getCapability(DeckCapabilities.MutableDeckState);
|
|
352
|
-
const attention = context.getCapability(AttentionCapabilities.Attention);
|
|
353
|
-
const toAttend = setActive({ next: subject as string[], state, attention });
|
|
354
|
-
return {
|
|
355
|
-
intents: toAttend ? [createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: toAttend })] : [],
|
|
356
|
-
};
|
|
357
|
-
},
|
|
358
|
-
}),
|
|
359
|
-
createResolver({
|
|
360
|
-
intent: LayoutAction.UpdateLayout,
|
|
361
|
-
filter: (data): data is Schema.Schema.Type<typeof LayoutAction.ScrollIntoView.fields.input> =>
|
|
362
|
-
Schema.is(LayoutAction.ScrollIntoView.fields.input)(data),
|
|
363
|
-
resolve: ({ subject }) => {
|
|
364
|
-
const layout = context.getCapability(DeckCapabilities.MutableDeckState);
|
|
365
|
-
layout.scrollIntoView = subject;
|
|
366
|
-
},
|
|
367
|
-
}),
|
|
368
|
-
createResolver({
|
|
369
|
-
intent: DeckAction.UpdatePlankSize,
|
|
370
|
-
resolve: (data) => {
|
|
371
|
-
const state = context.getCapability(DeckCapabilities.MutableDeckState);
|
|
372
|
-
state.deck.plankSizing[data.id] = data.size;
|
|
373
|
-
},
|
|
374
|
-
}),
|
|
375
|
-
createResolver({
|
|
376
|
-
intent: DeckAction.ChangeCompanion,
|
|
377
|
-
resolve: (data) => {
|
|
378
|
-
const state = context.getCapability(DeckCapabilities.MutableDeckState);
|
|
379
|
-
// TODO(thure): Reactivity only works when creating a lexically new `activeCompanions`… Are these not proxy objects?
|
|
380
|
-
if (data.companion === null) {
|
|
381
|
-
const { [data.primary]: _, ...nextActiveCompanions } = state.deck.activeCompanions ?? {};
|
|
382
|
-
state.deck.activeCompanions = nextActiveCompanions;
|
|
383
|
-
} else {
|
|
384
|
-
invariant(data.companion !== data.primary);
|
|
385
|
-
state.deck.activeCompanions = {
|
|
386
|
-
...state.deck.activeCompanions,
|
|
387
|
-
[data.primary]: data.companion,
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
},
|
|
391
|
-
}),
|
|
392
|
-
createResolver({
|
|
393
|
-
intent: DeckAction.Adjust,
|
|
394
|
-
resolve: (adjustment) => {
|
|
395
|
-
const state = context.getCapability(DeckCapabilities.MutableDeckState);
|
|
396
|
-
const attention = context.getCapability(AttentionCapabilities.Attention);
|
|
397
|
-
const { graph } = context.getCapability(Capabilities.AppGraph);
|
|
398
|
-
|
|
399
|
-
return batch(() => {
|
|
400
|
-
if (adjustment.type === 'increment-end' || adjustment.type === 'increment-start') {
|
|
401
|
-
setActive({
|
|
402
|
-
next: incrementPlank(state.deck.active, adjustment),
|
|
403
|
-
state,
|
|
404
|
-
attention,
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
if (adjustment.type === 'companion') {
|
|
409
|
-
return Function.pipe(
|
|
410
|
-
graph.getNode(adjustment.id),
|
|
411
|
-
Option.map((node) =>
|
|
412
|
-
graph
|
|
413
|
-
.getConnections(node.id)
|
|
414
|
-
.filter((n) => n.type === PLANK_COMPANION_TYPE)
|
|
415
|
-
.toSorted((a, b) => byPosition(a.properties, b.properties)),
|
|
416
|
-
),
|
|
417
|
-
Option.flatMap((companions) => (companions.length > 0 ? Option.some(companions[0]) : Option.none())),
|
|
418
|
-
Option.match({
|
|
419
|
-
onNone: () => ({}),
|
|
420
|
-
onSome: (companion) => ({
|
|
421
|
-
intents: [
|
|
422
|
-
// TODO(wittjosiah): This should remember the previously selected companion.
|
|
423
|
-
createIntent(DeckAction.ChangeCompanion, { primary: adjustment.id, companion: companion.id }),
|
|
424
|
-
],
|
|
425
|
-
}),
|
|
426
|
-
}),
|
|
427
|
-
);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
if (adjustment.type.startsWith('solo')) {
|
|
431
|
-
const entryId = adjustment.id;
|
|
432
|
-
if (!state.deck.solo) {
|
|
433
|
-
// Solo the entry.
|
|
434
|
-
return {
|
|
435
|
-
intents: [
|
|
436
|
-
createIntent(LayoutAction.SetLayoutMode, {
|
|
437
|
-
part: 'mode',
|
|
438
|
-
subject: entryId,
|
|
439
|
-
options: { mode: adjustment.type },
|
|
440
|
-
}),
|
|
441
|
-
],
|
|
442
|
-
};
|
|
443
|
-
} else {
|
|
444
|
-
if (adjustment.type === 'solo--fullscreen') {
|
|
445
|
-
// Toggle fullscreen on the current entry.
|
|
446
|
-
return {
|
|
447
|
-
intents: [
|
|
448
|
-
createIntent(LayoutAction.SetLayoutMode, {
|
|
449
|
-
part: 'mode',
|
|
450
|
-
subject: entryId,
|
|
451
|
-
options: { mode: 'solo--fullscreen' },
|
|
452
|
-
}),
|
|
453
|
-
],
|
|
454
|
-
};
|
|
455
|
-
} else if (adjustment.type === 'solo') {
|
|
456
|
-
// Un-solo the current entry.
|
|
457
|
-
return {
|
|
458
|
-
intents: [
|
|
459
|
-
// NOTE: The order of these is important.
|
|
460
|
-
Function.pipe(
|
|
461
|
-
createIntent(LayoutAction.SetLayoutMode, { part: 'mode', options: { mode: 'deck' } }),
|
|
462
|
-
chain(LayoutAction.Open, { part: 'main', subject: [entryId] }),
|
|
463
|
-
),
|
|
464
|
-
],
|
|
465
|
-
};
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
});
|
|
470
|
-
},
|
|
471
|
-
}),
|
|
472
|
-
]);
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Capabilities, contributes, useCapability } from '@dxos/app-framework';
|
|
8
|
-
|
|
9
|
-
import { DeckLayout } from '../components';
|
|
10
|
-
import { meta } from '../meta';
|
|
11
|
-
|
|
12
|
-
import { DeckCapabilities } from './capabilities';
|
|
13
|
-
|
|
14
|
-
export default () =>
|
|
15
|
-
contributes(Capabilities.ReactRoot, {
|
|
16
|
-
id: meta.id,
|
|
17
|
-
root: () => {
|
|
18
|
-
const layout = useCapability(DeckCapabilities.MutableDeckState);
|
|
19
|
-
|
|
20
|
-
const handleDismissToast = useCallback(
|
|
21
|
-
(id: string) => {
|
|
22
|
-
const index = layout.toasts.findIndex((toast) => toast.id === id);
|
|
23
|
-
if (index !== -1) {
|
|
24
|
-
// Allow time for the toast to animate out.
|
|
25
|
-
// TODO(burdon): Factor out and unregister timeout.
|
|
26
|
-
setTimeout(() => {
|
|
27
|
-
if (layout.toasts[index].id === layout.currentUndoId) {
|
|
28
|
-
layout.currentUndoId = undefined;
|
|
29
|
-
}
|
|
30
|
-
layout.toasts.splice(index, 1);
|
|
31
|
-
}, 1_000);
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
[layout.toasts],
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
return <DeckLayout onDismissToast={handleDismissToast} />;
|
|
38
|
-
},
|
|
39
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
8
|
-
import { SettingsStore } from '@dxos/local-storage';
|
|
9
|
-
|
|
10
|
-
import { Banner, DeckSettings } from '../components';
|
|
11
|
-
import { meta } from '../meta';
|
|
12
|
-
import { type DeckSettingsProps } from '../types';
|
|
13
|
-
|
|
14
|
-
export default () =>
|
|
15
|
-
contributes(Capabilities.ReactSurface, [
|
|
16
|
-
createSurface({
|
|
17
|
-
id: `${meta.id}/plugin-settings`,
|
|
18
|
-
role: 'article',
|
|
19
|
-
filter: (data): data is { subject: SettingsStore<DeckSettingsProps> } =>
|
|
20
|
-
data.subject instanceof SettingsStore && data.subject.prefix === meta.id,
|
|
21
|
-
component: ({ data: { subject } }) => <DeckSettings settings={subject.value} />,
|
|
22
|
-
}),
|
|
23
|
-
createSurface({
|
|
24
|
-
id: `${meta.id}/banner`,
|
|
25
|
-
role: 'banner',
|
|
26
|
-
component: ({ data }) => {
|
|
27
|
-
return <Banner variant={data.variant} />;
|
|
28
|
-
},
|
|
29
|
-
}),
|
|
30
|
-
]);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Capabilities, contributes } from '@dxos/app-framework';
|
|
6
|
-
import { live } from '@dxos/live-object';
|
|
7
|
-
|
|
8
|
-
import { meta } from '../meta';
|
|
9
|
-
import { type DeckSettingsProps, DeckSettingsSchema } from '../types';
|
|
10
|
-
|
|
11
|
-
export default () => {
|
|
12
|
-
const settings = live<DeckSettingsProps>({
|
|
13
|
-
showHints: false,
|
|
14
|
-
enableDeck: false,
|
|
15
|
-
enableStatusbar: false,
|
|
16
|
-
enableNativeRedirect: false,
|
|
17
|
-
newPlankPositioning: 'start',
|
|
18
|
-
overscroll: 'none',
|
|
19
|
-
encapsulatedPlanks: false,
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return contributes(Capabilities.Settings, {
|
|
23
|
-
prefix: meta.id,
|
|
24
|
-
schema: DeckSettingsSchema,
|
|
25
|
-
value: settings,
|
|
26
|
-
});
|
|
27
|
-
};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Capabilities, contributes } from '@dxos/app-framework';
|
|
6
|
-
import { invariant } from '@dxos/invariant';
|
|
7
|
-
import { live } from '@dxos/live-object';
|
|
8
|
-
import { LocalStorageStore } from '@dxos/local-storage';
|
|
9
|
-
import { type SidebarState } from '@dxos/react-ui';
|
|
10
|
-
|
|
11
|
-
import { meta } from '../meta';
|
|
12
|
-
import { type DeckPluginState, type DeckState, defaultDeck, getMode } from '../types';
|
|
13
|
-
|
|
14
|
-
import { DeckCapabilities } from './capabilities';
|
|
15
|
-
|
|
16
|
-
const boolean = /true|false/;
|
|
17
|
-
|
|
18
|
-
// TODO(thure, 18 Feb 2025): Remove after the next release.
|
|
19
|
-
|
|
20
|
-
const migrateSidebarStateDefaults = {
|
|
21
|
-
[`${meta.id}/complementary-sidebar-state`]: 'expanded',
|
|
22
|
-
[`${meta.id}/sidebar-state`]: 'collapsed',
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const migrateSidebarState = () => {
|
|
26
|
-
Object.entries(migrateSidebarStateDefaults).forEach(([key, defaultValue]) => {
|
|
27
|
-
if (boolean.test(localStorage.getItem(key) ?? 'never')) {
|
|
28
|
-
localStorage.setItem(key, defaultValue);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated
|
|
35
|
-
*/
|
|
36
|
-
export const DeckStateFactory = () => {
|
|
37
|
-
migrateSidebarState();
|
|
38
|
-
|
|
39
|
-
const state = new LocalStorageStore<DeckPluginState>(meta.id, {
|
|
40
|
-
sidebarState: 'expanded',
|
|
41
|
-
complementarySidebarState: 'collapsed',
|
|
42
|
-
complementarySidebarPanel: undefined,
|
|
43
|
-
dialogContent: null,
|
|
44
|
-
dialogOpen: false,
|
|
45
|
-
dialogBlockAlign: undefined,
|
|
46
|
-
dialogType: undefined,
|
|
47
|
-
popoverContent: null,
|
|
48
|
-
popoverAnchor: undefined,
|
|
49
|
-
popoverAnchorId: undefined,
|
|
50
|
-
popoverOpen: false,
|
|
51
|
-
toasts: [],
|
|
52
|
-
currentUndoId: undefined,
|
|
53
|
-
activeDeck: 'default',
|
|
54
|
-
previousDeck: 'default',
|
|
55
|
-
decks: {
|
|
56
|
-
default: { ...defaultDeck },
|
|
57
|
-
},
|
|
58
|
-
get deck() {
|
|
59
|
-
const deck = this.decks[this.activeDeck];
|
|
60
|
-
invariant(deck, `Deck not found: ${this.activeDeck}`);
|
|
61
|
-
return deck;
|
|
62
|
-
},
|
|
63
|
-
previousMode: {},
|
|
64
|
-
scrollIntoView: undefined,
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
state
|
|
68
|
-
.prop({ key: 'sidebarState', type: LocalStorageStore.enum<SidebarState>() })
|
|
69
|
-
.prop({ key: 'complementarySidebarState', type: LocalStorageStore.enum<SidebarState>() })
|
|
70
|
-
.prop({ key: 'complementarySidebarPanel', type: LocalStorageStore.string({ allowUndefined: true }) })
|
|
71
|
-
.prop({ key: 'decks', type: LocalStorageStore.json<Record<string, DeckState>>() })
|
|
72
|
-
.prop({ key: 'activeDeck', type: LocalStorageStore.string() })
|
|
73
|
-
.prop({ key: 'previousDeck', type: LocalStorageStore.string() });
|
|
74
|
-
|
|
75
|
-
const layout = live<Capabilities.Layout>({
|
|
76
|
-
get mode() {
|
|
77
|
-
return getMode(state.values.deck);
|
|
78
|
-
},
|
|
79
|
-
get dialogOpen() {
|
|
80
|
-
return state.values.dialogOpen;
|
|
81
|
-
},
|
|
82
|
-
get sidebarOpen() {
|
|
83
|
-
return state.values.sidebarState === 'expanded';
|
|
84
|
-
},
|
|
85
|
-
get complementarySidebarOpen() {
|
|
86
|
-
return state.values.complementarySidebarState === 'expanded';
|
|
87
|
-
},
|
|
88
|
-
get workspace() {
|
|
89
|
-
return state.values.activeDeck;
|
|
90
|
-
},
|
|
91
|
-
get active() {
|
|
92
|
-
return state.values.deck.solo ? [state.values.deck.solo] : state.values.deck.active;
|
|
93
|
-
},
|
|
94
|
-
get inactive() {
|
|
95
|
-
return state.values.deck.inactive;
|
|
96
|
-
},
|
|
97
|
-
get scrollIntoView() {
|
|
98
|
-
return state.values.scrollIntoView;
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
return [
|
|
103
|
-
contributes(DeckCapabilities.DeckState, state.values, () => state.close()),
|
|
104
|
-
contributes(Capabilities.Layout, layout),
|
|
105
|
-
];
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
export default DeckStateFactory;
|