@dxos/plugin-deck 0.8.4-main.3c1ae3b → 0.8.4-main.3eb6e50203
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-X7LCO5KE.mjs +121 -0
- package/dist/lib/browser/app-graph-builder-X7LCO5KE.mjs.map +7 -0
- package/dist/lib/browser/check-app-scheme-PGISDJX7.mjs +32 -0
- package/dist/lib/browser/check-app-scheme-PGISDJX7.mjs.map +7 -0
- package/dist/lib/browser/{chunk-F3VCCHVL.mjs → chunk-DONG2FYU.mjs} +152 -19
- package/dist/lib/browser/chunk-DONG2FYU.mjs.map +7 -0
- package/dist/lib/browser/chunk-JGC4ZLG3.mjs +1469 -0
- package/dist/lib/browser/chunk-JGC4ZLG3.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-YT3AJVUU.mjs +161 -0
- package/dist/lib/browser/chunk-YT3AJVUU.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +81 -73
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-XJFR3PNQ.mjs +597 -0
- package/dist/lib/browser/operation-resolver-XJFR3PNQ.mjs.map +7 -0
- package/dist/lib/browser/react-root-AJFHKHRL.mjs +47 -0
- package/dist/lib/browser/react-root-AJFHKHRL.mjs.map +7 -0
- package/dist/lib/browser/react-surface-KBRBGEXY.mjs +43 -0
- package/dist/lib/browser/react-surface-KBRBGEXY.mjs.map +7 -0
- package/dist/lib/browser/settings-ES42FGLG.mjs +38 -0
- package/dist/lib/browser/settings-ES42FGLG.mjs.map +7 -0
- package/dist/lib/browser/state-YMI6IDEL.mjs +104 -0
- package/dist/lib/browser/state-YMI6IDEL.mjs.map +7 -0
- package/dist/lib/browser/{toolkit-L5CFXJCF.mjs → toolkit-VRD54KY3.mjs} +17 -15
- package/dist/lib/browser/toolkit-VRD54KY3.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +11 -4
- package/dist/lib/browser/url-handler-37UPOB3U.mjs +94 -0
- package/dist/lib/browser/url-handler-37UPOB3U.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-US54I64T.mjs +122 -0
- package/dist/lib/node-esm/app-graph-builder-US54I64T.mjs.map +7 -0
- package/dist/lib/node-esm/check-app-scheme-CK6EVG5D.mjs +33 -0
- package/dist/lib/node-esm/check-app-scheme-CK6EVG5D.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7NPS347C.mjs +1470 -0
- package/dist/lib/node-esm/chunk-7NPS347C.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-CVYHPJIN.mjs +297 -0
- package/dist/lib/node-esm/chunk-CVYHPJIN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZMJPCZ3V.mjs +162 -0
- package/dist/lib/node-esm/chunk-ZMJPCZ3V.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +183 -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-ZQGNATPX.mjs +598 -0
- package/dist/lib/node-esm/operation-resolver-ZQGNATPX.mjs.map +7 -0
- package/dist/lib/node-esm/react-root-2S77ABBS.mjs +48 -0
- package/dist/lib/node-esm/react-root-2S77ABBS.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-FIHMAFXH.mjs +44 -0
- package/dist/lib/node-esm/react-surface-FIHMAFXH.mjs.map +7 -0
- package/dist/lib/node-esm/settings-E3TH3FAW.mjs +39 -0
- package/dist/lib/node-esm/settings-E3TH3FAW.mjs.map +7 -0
- package/dist/lib/node-esm/state-WQEFBQMD.mjs +105 -0
- package/dist/lib/node-esm/state-WQEFBQMD.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-ME546G5T.mjs +55 -0
- package/dist/lib/node-esm/toolkit-ME546G5T.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +40 -0
- package/dist/lib/node-esm/url-handler-2KYHXINK.mjs +95 -0
- package/dist/lib/node-esm/url-handler-2KYHXINK.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 +22 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +174 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +177 -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.d.ts → toolkit/toolkit.d.ts} +5 -3
- 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/ActiveNode.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.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/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 -4
- 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 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/{capabilities → types}/capabilities.d.ts +98 -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 +88 -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 +54 -47
- package/src/DeckPlugin.ts +28 -48
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +119 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/check-app-scheme/check-app-scheme.ts +45 -0
- 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 +570 -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 +38 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +39 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +105 -0
- package/src/capabilities/toolkit/index.ts +7 -0
- package/src/capabilities/{toolkit.ts → toolkit/toolkit.ts} +19 -21
- 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 +96 -0
- package/src/components/DeckLayout/ActiveNode.tsx +3 -2
- package/src/components/DeckLayout/Banner.tsx +6 -6
- package/src/components/DeckLayout/ContentEmpty.tsx +4 -5
- package/src/components/DeckLayout/DeckLayout.stories.tsx +18 -29
- package/src/components/DeckLayout/DeckLayout.tsx +13 -11
- package/src/components/DeckLayout/DeckMain.tsx +43 -38
- package/src/components/DeckLayout/Dialog.tsx +21 -12
- package/src/components/DeckLayout/Fallback.tsx +1 -1
- package/src/components/DeckLayout/Popover.tsx +59 -22
- package/src/components/DeckLayout/StatusBar.tsx +3 -3
- package/src/components/DeckLayout/Toast.tsx +4 -4
- package/src/components/DeckSettings/DeckSettings.tsx +39 -29
- package/src/components/Plank/Plank.stories.tsx +16 -7
- package/src/components/Plank/Plank.tsx +21 -20
- package/src/components/Plank/PlankControls.tsx +5 -6
- package/src/components/Plank/PlankError.tsx +2 -2
- package/src/components/Plank/PlankHeading.tsx +31 -36
- package/src/components/Sidebar/ComplementarySidebar.tsx +37 -26
- package/src/components/Sidebar/Sidebar.tsx +5 -5
- package/src/components/Sidebar/SidebarButton.tsx +30 -24
- 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 -5
- package/src/hooks/useDeckState.ts +82 -0
- package/src/hooks/useHoistStatusbar.ts +3 -6
- package/src/hooks/useNodeActionExpander.ts +4 -4
- package/src/index.ts +1 -2
- package/src/meta.ts +2 -2
- package/src/translations.ts +1 -0
- package/src/types/capabilities.ts +33 -0
- package/src/types/events.ts +21 -0
- package/src/types/index.ts +2 -0
- package/src/types/schema.ts +85 -11
- package/src/util/layoutAppliesTopbar.ts +1 -1
- package/src/util/set-active.ts +49 -29
- package/dist/lib/browser/app-graph-builder-D74NTOMK.mjs +0 -128
- package/dist/lib/browser/app-graph-builder-D74NTOMK.mjs.map +0 -7
- package/dist/lib/browser/check-app-scheme-HIEVFAAX.mjs +0 -32
- package/dist/lib/browser/check-app-scheme-HIEVFAAX.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-QKCGZ45E.mjs +0 -128
- package/dist/lib/browser/chunk-QKCGZ45E.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/chunk-VBYJ664A.mjs +0 -132
- package/dist/lib/browser/chunk-VBYJ664A.mjs.map +0 -7
- package/dist/lib/browser/chunk-VUJ6UNIJ.mjs +0 -1553
- package/dist/lib/browser/chunk-VUJ6UNIJ.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-UA4YQGAC.mjs +0 -524
- package/dist/lib/browser/intent-resolver-UA4YQGAC.mjs.map +0 -7
- package/dist/lib/browser/react-root-JAMHKYWN.mjs +0 -44
- package/dist/lib/browser/react-root-JAMHKYWN.mjs.map +0 -7
- package/dist/lib/browser/react-surface-6LW337ZT.mjs +0 -40
- package/dist/lib/browser/react-surface-6LW337ZT.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-7IFAGZQO.mjs +0 -12
- package/dist/lib/browser/toolkit-L5CFXJCF.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.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/check-app-scheme.ts +0 -40
- package/src/capabilities/intent-resolver.ts +0 -471
- package/src/capabilities/react-root.tsx +0 -40
- package/src/capabilities/react-surface.tsx +0 -30
- package/src/capabilities/settings.ts +0 -27
- package/src/capabilities/state.ts +0 -113
- 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-7IFAGZQO.mjs.map → node-esm/types/index.mjs.map} +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import { useCallback, useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capabilities } from '@dxos/app-framework';
|
|
9
|
+
import { useCapability } from '@dxos/app-framework/ui';
|
|
10
|
+
import { invariant } from '@dxos/invariant';
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
DeckCapabilities,
|
|
14
|
+
type DeckEphemeralStateProps,
|
|
15
|
+
type DeckPluginState,
|
|
16
|
+
type DeckState,
|
|
17
|
+
type DeckStateProps,
|
|
18
|
+
} from '../types';
|
|
19
|
+
|
|
20
|
+
export type DeckStateHook = {
|
|
21
|
+
/** Combined state value (reactive). Includes both persisted and ephemeral state. */
|
|
22
|
+
state: DeckPluginState;
|
|
23
|
+
/** The active deck, computed from decks[activeDeck]. */
|
|
24
|
+
deck: DeckState;
|
|
25
|
+
/** Update persisted state. */
|
|
26
|
+
updateState: (fn: (current: DeckStateProps) => DeckStateProps) => void;
|
|
27
|
+
/** Update ephemeral state. */
|
|
28
|
+
updateEphemeral: (fn: (current: DeckEphemeralStateProps) => DeckEphemeralStateProps) => void;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Hook to access the deck plugin state reactively.
|
|
33
|
+
* Returns the combined state, the active deck, and update functions for each atom.
|
|
34
|
+
*/
|
|
35
|
+
export const useDeckState = (): DeckStateHook => {
|
|
36
|
+
const registry = useCapability(Capabilities.AtomRegistry);
|
|
37
|
+
const stateAtom = useCapability(DeckCapabilities.State);
|
|
38
|
+
const ephemeralAtom = useCapability(DeckCapabilities.EphemeralState);
|
|
39
|
+
|
|
40
|
+
const persistedState = useAtomValue(stateAtom);
|
|
41
|
+
const ephemeralState = useAtomValue(ephemeralAtom);
|
|
42
|
+
|
|
43
|
+
// Compute deck from decks[activeDeck] to ensure it's always current.
|
|
44
|
+
const deck = useMemo(() => {
|
|
45
|
+
const d = persistedState.decks[persistedState.activeDeck];
|
|
46
|
+
invariant(d, `Deck not found: ${persistedState.activeDeck}`);
|
|
47
|
+
return d;
|
|
48
|
+
}, [persistedState.decks, persistedState.activeDeck]);
|
|
49
|
+
|
|
50
|
+
// Combine persisted and ephemeral state into a unified view.
|
|
51
|
+
const state = useMemo(
|
|
52
|
+
(): DeckPluginState => ({
|
|
53
|
+
...persistedState,
|
|
54
|
+
...ephemeralState,
|
|
55
|
+
}),
|
|
56
|
+
[persistedState, ephemeralState],
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const updateState = useCallback(
|
|
60
|
+
(fn: (current: DeckStateProps) => DeckStateProps) => {
|
|
61
|
+
registry.set(stateAtom, fn(registry.get(stateAtom)));
|
|
62
|
+
},
|
|
63
|
+
[registry, stateAtom],
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const updateEphemeral = useCallback(
|
|
67
|
+
(fn: (current: DeckEphemeralStateProps) => DeckEphemeralStateProps) => {
|
|
68
|
+
registry.set(ephemeralAtom, fn(registry.get(ephemeralAtom)));
|
|
69
|
+
},
|
|
70
|
+
[registry, ephemeralAtom],
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
return useMemo(
|
|
74
|
+
() => ({
|
|
75
|
+
state,
|
|
76
|
+
deck,
|
|
77
|
+
updateState,
|
|
78
|
+
updateEphemeral,
|
|
79
|
+
}),
|
|
80
|
+
[state, deck, updateState, updateEphemeral],
|
|
81
|
+
);
|
|
82
|
+
};
|
|
@@ -4,17 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { useCapability } from '@dxos/app-framework/react';
|
|
7
|
+
import { useAtomCapability } from '@dxos/app-framework/ui';
|
|
9
8
|
import { useThemeContext } from '@dxos/react-ui';
|
|
10
9
|
|
|
11
|
-
import {
|
|
12
|
-
import type { DeckSettingsProps, LayoutMode } from '../types';
|
|
10
|
+
import { DeckCapabilities, type LayoutMode } from '../types';
|
|
13
11
|
|
|
14
12
|
export const useHoistStatusbar = (breakpoint: string, layoutMode?: LayoutMode): boolean => {
|
|
15
13
|
const { safeAreaPadding } = useThemeContext();
|
|
16
|
-
const enableStatusbar =
|
|
17
|
-
.enableStatusbar;
|
|
14
|
+
const enableStatusbar = useAtomCapability(DeckCapabilities.Settings).enableStatusbar;
|
|
18
15
|
|
|
19
16
|
return useMemo(() => {
|
|
20
17
|
return (
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type Node
|
|
7
|
+
import { Graph, type Node } from '@dxos/plugin-graph';
|
|
8
8
|
|
|
9
|
-
export const useNodeActionExpander = (node?: Node) => {
|
|
9
|
+
export const useNodeActionExpander = (node?: Node.Node) => {
|
|
10
10
|
useEffect(() => {
|
|
11
11
|
if (node) {
|
|
12
12
|
const frame = requestAnimationFrame(() => {
|
|
13
|
-
const graph = getGraph(node);
|
|
14
|
-
void
|
|
13
|
+
const graph = Graph.getGraph(node);
|
|
14
|
+
void Graph.expand(graph, node.id);
|
|
15
15
|
});
|
|
16
16
|
return () => cancelAnimationFrame(frame);
|
|
17
17
|
}
|
package/src/index.ts
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export { DeckCapabilities } from './
|
|
6
|
-
export { DeckEvents } from './events';
|
|
5
|
+
export { DeckCapabilities, DeckEvents } from './types';
|
|
7
6
|
export * from './DeckPlugin';
|
|
8
7
|
export * from './meta';
|
|
9
8
|
export { useCompanions } from './hooks';
|
package/src/meta.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
export const meta:
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
9
|
id: 'dxos.org/plugin/deck',
|
|
10
10
|
name: 'Layout',
|
|
11
11
|
description: trim`
|
package/src/translations.ts
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { invariant } from '@dxos/invariant';
|
|
10
|
+
|
|
11
|
+
import { meta } from '../meta';
|
|
12
|
+
import { type DeckEphemeralStateProps, type DeckSettingsProps, type DeckState, type DeckStateProps } from '../types';
|
|
13
|
+
|
|
14
|
+
export namespace DeckCapabilities {
|
|
15
|
+
export const Settings = Capability.make<Atom.Writable<DeckSettingsProps>>(`${meta.id}/capability/settings`);
|
|
16
|
+
|
|
17
|
+
/** Persisted state (stored in KVS/localStorage). */
|
|
18
|
+
export const State = Capability.make<Atom.Writable<DeckStateProps>>(`${meta.id}/capability/state`);
|
|
19
|
+
|
|
20
|
+
/** Transient/ephemeral state (not persisted). */
|
|
21
|
+
export const EphemeralState = Capability.make<Atom.Writable<DeckEphemeralStateProps>>(
|
|
22
|
+
`${meta.id}/capability/ephemeral-state`,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
/** Get the current active deck from state. */
|
|
26
|
+
export const getDeck = (): Effect.Effect<DeckState, Error, Capability.Service> =>
|
|
27
|
+
Effect.gen(function* () {
|
|
28
|
+
const state = yield* Capabilities.getAtomValue(State);
|
|
29
|
+
const deck = state.decks[state.activeDeck];
|
|
30
|
+
invariant(deck, `Deck not found: ${state.activeDeck}`);
|
|
31
|
+
return deck;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ActivationEvent } from '@dxos/app-framework';
|
|
6
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
7
|
+
|
|
8
|
+
import { meta } from '../meta';
|
|
9
|
+
|
|
10
|
+
import { DeckCapabilities } from './capabilities';
|
|
11
|
+
|
|
12
|
+
export namespace DeckEvents {
|
|
13
|
+
export const StateReady: ActivationEvent.ActivationEvent = AppActivationEvents.createStateEvent(
|
|
14
|
+
`${meta.id}/state-ready`,
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
/** Fired when DeckSettings capability is ready. */
|
|
18
|
+
export const SettingsReady: ActivationEvent.ActivationEvent = AppActivationEvents.createSettingsEvent(
|
|
19
|
+
DeckCapabilities.Settings.identifier,
|
|
20
|
+
);
|
|
21
|
+
}
|
package/src/types/index.ts
CHANGED
package/src/types/schema.ts
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Label, LayoutOperation } from '@dxos/app-toolkit';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
8
10
|
import { type DeepReadonly } from '@dxos/util';
|
|
9
11
|
|
|
10
12
|
import { meta } from '../meta';
|
|
@@ -77,12 +79,21 @@ export const getMode = (deck: DeckState | DeepReadonly<DeckState>): LayoutMode =
|
|
|
77
79
|
return 'deck';
|
|
78
80
|
};
|
|
79
81
|
|
|
80
|
-
//
|
|
81
|
-
export const
|
|
82
|
+
// Persisted plugin state (stored in KVS/localStorage).
|
|
83
|
+
export const DeckStateSchema = Schema.Struct({
|
|
82
84
|
sidebarState: Schema.Literal('closed', 'collapsed', 'expanded'),
|
|
83
85
|
complementarySidebarState: Schema.Literal('closed', 'collapsed', 'expanded'),
|
|
84
86
|
complementarySidebarPanel: Schema.optional(Schema.String),
|
|
87
|
+
activeDeck: Schema.String,
|
|
88
|
+
previousDeck: Schema.String,
|
|
89
|
+
decks: Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.mutable(DeckState) })),
|
|
90
|
+
previousMode: Schema.mutable(Schema.Record({ key: Schema.String, value: LayoutMode })),
|
|
91
|
+
}).pipe(Schema.mutable);
|
|
92
|
+
export type DeckStateProps = Schema.Schema.Type<typeof DeckStateSchema>;
|
|
85
93
|
|
|
94
|
+
// TODO(burdon): Factor out state (in common with other layouts?)
|
|
95
|
+
// Transient/ephemeral plugin state (not persisted).
|
|
96
|
+
export const DeckEphemeralStateSchema = Schema.Struct({
|
|
86
97
|
dialogOpen: Schema.Boolean,
|
|
87
98
|
dialogType: Schema.optional(Schema.Literal('default', 'alert')),
|
|
88
99
|
dialogBlockAlign: Schema.optional(Schema.Literal('start', 'center', 'end')),
|
|
@@ -95,23 +106,23 @@ export const DeckPluginState = Schema.Struct({
|
|
|
95
106
|
popoverSide: Schema.optional(Schema.Literal('top', 'right', 'bottom', 'left')),
|
|
96
107
|
popoverAnchor: Schema.optional(Schema.Any),
|
|
97
108
|
popoverAnchorId: Schema.optional(Schema.String),
|
|
109
|
+
popoverKind: Schema.optional(Schema.Literal('base', 'card')),
|
|
110
|
+
popoverTitle: Schema.optional(Label.annotations({ description: 'The title of the popover.' })),
|
|
111
|
+
/** Ref of the subject to be passed to the popover Surface. */
|
|
112
|
+
popoverContentRef: Schema.optional(Schema.String),
|
|
98
113
|
/** Data to be passed to the popover Surface. */
|
|
99
114
|
popoverContent: Schema.optional(Schema.Any),
|
|
100
115
|
|
|
101
|
-
toasts: Schema.mutable(Schema.Array(
|
|
116
|
+
toasts: Schema.mutable(Schema.Array(LayoutOperation.Toast)),
|
|
102
117
|
currentUndoId: Schema.optional(Schema.String),
|
|
103
118
|
|
|
104
|
-
activeDeck: Schema.String,
|
|
105
|
-
previousDeck: Schema.String,
|
|
106
|
-
decks: Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.mutable(DeckState) })),
|
|
107
|
-
previousMode: Schema.mutable(Schema.Record({ key: Schema.String, value: LayoutMode })),
|
|
108
|
-
deck: Schema.mutable(DeckState),
|
|
109
|
-
|
|
110
119
|
/** The identifier of a component to scroll into view when it is mounted. */
|
|
111
120
|
scrollIntoView: Schema.optional(Schema.String),
|
|
112
121
|
}).pipe(Schema.mutable);
|
|
122
|
+
export type DeckEphemeralStateProps = Schema.Schema.Type<typeof DeckEphemeralStateSchema>;
|
|
113
123
|
|
|
114
|
-
|
|
124
|
+
// Combined state type (for convenience in components that need both).
|
|
125
|
+
export type DeckPluginState = DeckStateProps & DeckEphemeralStateProps;
|
|
115
126
|
|
|
116
127
|
export namespace DeckAction {
|
|
117
128
|
const PartAdjustmentSchema = Schema.Union(
|
|
@@ -148,3 +159,66 @@ export namespace DeckAction {
|
|
|
148
159
|
output: Schema.Void,
|
|
149
160
|
}) {}
|
|
150
161
|
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Operations for the Deck plugin.
|
|
165
|
+
*/
|
|
166
|
+
export namespace DeckOperation {
|
|
167
|
+
const PartAdjustmentSchema = Schema.Union(
|
|
168
|
+
Schema.Literal('close').annotations({ description: 'Close the plank.' }),
|
|
169
|
+
Schema.Literal('companion').annotations({ description: 'Open the companion plank.' }),
|
|
170
|
+
Schema.Literal('solo').annotations({ description: 'Solo the plank.' }),
|
|
171
|
+
Schema.Literal('solo--fullscreen').annotations({ description: 'Fullscreen the plank.' }),
|
|
172
|
+
Schema.Literal('increment-start').annotations({ description: 'Move the plank towards the start of the deck.' }),
|
|
173
|
+
Schema.Literal('increment-end').annotations({ description: 'Move the plank towards the end of the deck.' }),
|
|
174
|
+
);
|
|
175
|
+
export type PartAdjustment = Schema.Schema.Type<typeof PartAdjustmentSchema>;
|
|
176
|
+
|
|
177
|
+
export const Adjust = Operation.make({
|
|
178
|
+
meta: {
|
|
179
|
+
key: `${meta.id}/operation/adjust`,
|
|
180
|
+
name: 'Adjust',
|
|
181
|
+
description: 'Adjust the layout of a plank.',
|
|
182
|
+
},
|
|
183
|
+
services: [Capability.Service],
|
|
184
|
+
schema: {
|
|
185
|
+
input: Schema.Struct({
|
|
186
|
+
id: Schema.String.annotations({ description: 'The id of the plank to adjust.' }),
|
|
187
|
+
type: PartAdjustmentSchema.annotations({ description: 'The type of adjustment to make.' }),
|
|
188
|
+
}),
|
|
189
|
+
output: Schema.Void,
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
export const UpdatePlankSize = Operation.make({
|
|
194
|
+
meta: {
|
|
195
|
+
key: `${meta.id}/operation/update-plank-size`,
|
|
196
|
+
name: 'Update Plank Size',
|
|
197
|
+
description: 'Update the size of a plank.',
|
|
198
|
+
},
|
|
199
|
+
services: [Capability.Service],
|
|
200
|
+
schema: {
|
|
201
|
+
input: Schema.Struct({
|
|
202
|
+
id: Schema.String.annotations({ description: 'The id of the plank to resize.' }),
|
|
203
|
+
size: Schema.Number.annotations({ description: 'The new size of the plank.' }),
|
|
204
|
+
}),
|
|
205
|
+
output: Schema.Void,
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
export const ChangeCompanion = Operation.make({
|
|
210
|
+
meta: {
|
|
211
|
+
key: `${meta.id}/operation/change-companion`,
|
|
212
|
+
name: 'Change Companion',
|
|
213
|
+
description: 'Change the companion plank for a primary plank.',
|
|
214
|
+
},
|
|
215
|
+
services: [Capability.Service],
|
|
216
|
+
schema: {
|
|
217
|
+
input: Schema.Struct({
|
|
218
|
+
primary: Schema.String,
|
|
219
|
+
companion: Schema.Union(Schema.String, Schema.Null),
|
|
220
|
+
}),
|
|
221
|
+
output: Schema.Void,
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
}
|
|
@@ -6,7 +6,7 @@ import { type LayoutMode } from '../types';
|
|
|
6
6
|
|
|
7
7
|
export const layoutAppliesTopbar = (breakpoint: string, layoutMode?: LayoutMode) => {
|
|
8
8
|
return (
|
|
9
|
-
document.body.getAttribute('data-platform') === '
|
|
9
|
+
document.body.getAttribute('data-platform') === 'windows' &&
|
|
10
10
|
breakpoint === 'desktop' &&
|
|
11
11
|
layoutMode !== 'solo--fullscreen'
|
|
12
12
|
);
|
package/src/util/set-active.ts
CHANGED
|
@@ -2,46 +2,66 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { batch } from '@preact/signals-core';
|
|
6
|
-
|
|
7
5
|
import { type AttentionManager } from '@dxos/plugin-attention';
|
|
8
6
|
|
|
9
|
-
import { type
|
|
7
|
+
import { type DeckState } from '../types';
|
|
10
8
|
|
|
11
9
|
export type SetActiveOptions = {
|
|
12
10
|
next: string[];
|
|
13
|
-
|
|
11
|
+
deck: DeckState;
|
|
14
12
|
attention?: AttentionManager;
|
|
15
13
|
};
|
|
16
14
|
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
export type SetActiveResult = {
|
|
16
|
+
/** Updates to apply to the deck. */
|
|
17
|
+
deckUpdates: {
|
|
18
|
+
inactive: string[];
|
|
19
|
+
solo: string | undefined;
|
|
20
|
+
active: string[];
|
|
21
|
+
fullscreen: boolean;
|
|
22
|
+
};
|
|
23
|
+
/** ID of the item to attend (scroll into view) if attention changed. */
|
|
24
|
+
toAttend?: string;
|
|
25
|
+
};
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Computes the new active state for the deck without mutating.
|
|
29
|
+
* Returns the updates to apply and optionally an item to attend.
|
|
30
|
+
*/
|
|
31
|
+
export const computeActiveUpdates = ({ next, deck, attention }: SetActiveOptions): SetActiveResult => {
|
|
32
|
+
const active = deck.solo ? [deck.solo] : deck.active;
|
|
33
|
+
const removed = active.filter((id) => !next.includes(id));
|
|
34
|
+
const closed = Array.from(new Set([...deck.inactive.filter((id) => !next.includes(id)), ...removed]));
|
|
24
35
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
const updates = {
|
|
37
|
+
inactive: closed,
|
|
38
|
+
solo: deck.solo,
|
|
39
|
+
active: deck.active,
|
|
40
|
+
fullscreen: deck.fullscreen,
|
|
41
|
+
};
|
|
30
42
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
43
|
+
if (deck.solo || !deck.initialized) {
|
|
44
|
+
updates.solo = next[0];
|
|
45
|
+
} else {
|
|
46
|
+
updates.active = next;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (deck.fullscreen && !updates.solo) {
|
|
50
|
+
updates.fullscreen = false;
|
|
51
|
+
}
|
|
34
52
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
53
|
+
let toAttend: string | undefined;
|
|
54
|
+
if (attention) {
|
|
55
|
+
const attended = attention.getCurrent();
|
|
56
|
+
const [attendedId] = Array.from(attended);
|
|
57
|
+
const isAttendedAvailable = !!attendedId && next.includes(attendedId);
|
|
58
|
+
if (!isAttendedAvailable) {
|
|
59
|
+
const attendedIndex = active.indexOf(attendedId);
|
|
60
|
+
// If outside of bounds, focus on the first/last plank, otherwise focus on the new plank in the same position.
|
|
61
|
+
const index = attendedIndex === -1 ? 0 : attendedIndex >= next.length ? next.length - 1 : attendedIndex;
|
|
62
|
+
toAttend = next[index];
|
|
45
63
|
}
|
|
46
|
-
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return { deckUpdates: updates, toAttend };
|
|
47
67
|
};
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DeckCapabilities
|
|
3
|
-
} from "./chunk-5KMJPIQC.mjs";
|
|
4
|
-
import {
|
|
5
|
-
meta
|
|
6
|
-
} from "./chunk-UXLU6CMW.mjs";
|
|
7
|
-
|
|
8
|
-
// src/capabilities/app-graph-builder.ts
|
|
9
|
-
import { Atom } from "@effect-atom/atom-react";
|
|
10
|
-
import * as Function from "effect/Function";
|
|
11
|
-
import * as Option from "effect/Option";
|
|
12
|
-
import { Capabilities, LayoutAction, contributes, createIntent } from "@dxos/app-framework";
|
|
13
|
-
import { AttentionCapabilities } from "@dxos/plugin-attention";
|
|
14
|
-
import { ROOT_ID, atomFromSignal, createExtension } from "@dxos/plugin-graph";
|
|
15
|
-
var app_graph_builder_default = ((context) => contributes(Capabilities.AppGraphBuilder, createExtension({
|
|
16
|
-
id: meta.id,
|
|
17
|
-
actions: (node) => Atom.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.id === ROOT_ID ? Option.some(node2) : Option.none()), Option.map(() => {
|
|
18
|
-
const state = context.getCapability(DeckCapabilities.MutableDeckState);
|
|
19
|
-
const closeCurrent = {
|
|
20
|
-
id: `${LayoutAction.Close._tag}/current`,
|
|
21
|
-
data: async () => {
|
|
22
|
-
const attention = context.getCapability(AttentionCapabilities.Attention);
|
|
23
|
-
const attended = attention.current.at(-1);
|
|
24
|
-
if (attended) {
|
|
25
|
-
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
26
|
-
await dispatch(createIntent(LayoutAction.Close, {
|
|
27
|
-
part: "main",
|
|
28
|
-
subject: [
|
|
29
|
-
attended
|
|
30
|
-
],
|
|
31
|
-
options: {
|
|
32
|
-
state: false
|
|
33
|
-
}
|
|
34
|
-
}));
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
properties: {
|
|
38
|
-
label: [
|
|
39
|
-
"close current label",
|
|
40
|
-
{
|
|
41
|
-
ns: meta.id
|
|
42
|
-
}
|
|
43
|
-
],
|
|
44
|
-
icon: "ph--x--regular"
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const closeOthers = {
|
|
48
|
-
id: `${LayoutAction.Close._tag}/others`,
|
|
49
|
-
data: async () => {
|
|
50
|
-
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
51
|
-
const attention = context.getCapability(AttentionCapabilities.Attention);
|
|
52
|
-
const attended = attention.current.at(-1);
|
|
53
|
-
const ids = state.deck.active.filter((id) => id !== attended) ?? [];
|
|
54
|
-
await dispatch(createIntent(LayoutAction.Close, {
|
|
55
|
-
part: "main",
|
|
56
|
-
subject: ids,
|
|
57
|
-
options: {
|
|
58
|
-
state: false
|
|
59
|
-
}
|
|
60
|
-
}));
|
|
61
|
-
},
|
|
62
|
-
properties: {
|
|
63
|
-
label: [
|
|
64
|
-
"close others label",
|
|
65
|
-
{
|
|
66
|
-
ns: meta.id
|
|
67
|
-
}
|
|
68
|
-
],
|
|
69
|
-
icon: "ph--x-square--regular"
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
const closeAll = {
|
|
73
|
-
id: `${LayoutAction.Close._tag}/all`,
|
|
74
|
-
data: async () => {
|
|
75
|
-
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
76
|
-
await dispatch(createIntent(LayoutAction.Close, {
|
|
77
|
-
part: "main",
|
|
78
|
-
subject: state.deck.active,
|
|
79
|
-
options: {
|
|
80
|
-
state: false
|
|
81
|
-
}
|
|
82
|
-
}));
|
|
83
|
-
},
|
|
84
|
-
properties: {
|
|
85
|
-
label: [
|
|
86
|
-
"close all label",
|
|
87
|
-
{
|
|
88
|
-
ns: meta.id
|
|
89
|
-
}
|
|
90
|
-
],
|
|
91
|
-
icon: "ph--x-circle--regular"
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
const toggleSidebar = {
|
|
95
|
-
id: `${LayoutAction.UpdateSidebar._tag}/nav`,
|
|
96
|
-
data: async () => {
|
|
97
|
-
state.sidebarState = state.sidebarState === "expanded" ? "collapsed" : "expanded";
|
|
98
|
-
},
|
|
99
|
-
properties: {
|
|
100
|
-
label: [
|
|
101
|
-
get(atomFromSignal(() => state.sidebarState === "expanded" ? "collapse navigation sidebar label" : "open navigation sidebar label")),
|
|
102
|
-
{
|
|
103
|
-
ns: meta.id
|
|
104
|
-
}
|
|
105
|
-
],
|
|
106
|
-
icon: "ph--sidebar--regular",
|
|
107
|
-
keyBinding: {
|
|
108
|
-
macos: "meta+'"
|
|
109
|
-
},
|
|
110
|
-
disposition: "pin-end",
|
|
111
|
-
position: "hoist",
|
|
112
|
-
l0Breakpoint: "lg"
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
return get(atomFromSignal(() => !state.deck.solo ? [
|
|
116
|
-
closeCurrent,
|
|
117
|
-
closeOthers,
|
|
118
|
-
closeAll,
|
|
119
|
-
toggleSidebar
|
|
120
|
-
] : [
|
|
121
|
-
toggleSidebar
|
|
122
|
-
]));
|
|
123
|
-
}), Option.getOrElse(() => [])))
|
|
124
|
-
})));
|
|
125
|
-
export {
|
|
126
|
-
app_graph_builder_default as default
|
|
127
|
-
};
|
|
128
|
-
//# sourceMappingURL=app-graph-builder-D74NTOMK.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/app-graph-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom-react';\nimport * as Function from 'effect/Function';\nimport * as Option from 'effect/Option';\n\nimport { Capabilities, LayoutAction, type PluginContext, contributes, createIntent } from '@dxos/app-framework';\nimport { AttentionCapabilities } from '@dxos/plugin-attention';\nimport { ROOT_ID, atomFromSignal, createExtension } from '@dxos/plugin-graph';\n\nimport { meta } from '../meta';\n\nimport { DeckCapabilities } from './capabilities';\n\nexport default (context: PluginContext) =>\n contributes(\n Capabilities.AppGraphBuilder,\n createExtension({\n id: meta.id,\n actions: (node) =>\n Atom.make((get) =>\n Function.pipe(\n get(node),\n Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),\n Option.map(() => {\n const state = context.getCapability(DeckCapabilities.MutableDeckState);\n\n // NOTE(Zan): This is currently disabled.\n // TODO(Zan): Fullscreen needs to know the active node and provide that to the layout part.\n // const _fullscreen = {\n // id: `${LayoutAction.UpdateLayout._tag}/fullscreen`,\n // data: async () => {\n // const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n // await dispatch(\n // createIntent(LayoutAction.SetLayoutMode, { part: 'mode', options: { mode: 'fullscreen' } }),\n // );\n // },\n // properties: {\n // label: ['toggle fullscreen label', { ns: meta.id }],\n // icon: 'ph--arrows-out--regular',\n // keyBinding: {\n // macos: 'ctrl+meta+f',\n // windows: 'shift+ctrl+f',\n // },\n // },\n // };\n\n const closeCurrent = {\n id: `${LayoutAction.Close._tag}/current`,\n data: async () => {\n const attention = context.getCapability(AttentionCapabilities.Attention);\n const attended = attention.current.at(-1);\n if (attended) {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n await dispatch(\n createIntent(LayoutAction.Close, {\n part: 'main',\n subject: [attended],\n options: { state: false },\n }),\n );\n }\n },\n properties: {\n label: ['close current label', { ns: meta.id }],\n icon: 'ph--x--regular',\n },\n };\n\n const closeOthers = {\n id: `${LayoutAction.Close._tag}/others`,\n data: async () => {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n const attention = context.getCapability(AttentionCapabilities.Attention);\n const attended = attention.current.at(-1);\n const ids = state.deck.active.filter((id) => id !== attended) ?? [];\n await dispatch(\n createIntent(LayoutAction.Close, { part: 'main', subject: ids, options: { state: false } }),\n );\n },\n properties: {\n label: ['close others label', { ns: meta.id }],\n icon: 'ph--x-square--regular',\n },\n };\n\n const closeAll = {\n id: `${LayoutAction.Close._tag}/all`,\n data: async () => {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n await dispatch(\n createIntent(LayoutAction.Close, {\n part: 'main',\n subject: state.deck.active,\n options: { state: false },\n }),\n );\n },\n properties: {\n label: ['close all label', { ns: meta.id }],\n icon: 'ph--x-circle--regular',\n },\n };\n\n const toggleSidebar = {\n id: `${LayoutAction.UpdateSidebar._tag}/nav`,\n data: async () => {\n state.sidebarState = state.sidebarState === 'expanded' ? 'collapsed' : 'expanded';\n },\n properties: {\n label: [\n get(\n atomFromSignal(() =>\n state.sidebarState === 'expanded'\n ? 'collapse navigation sidebar label'\n : 'open navigation sidebar label',\n ),\n ),\n { ns: meta.id },\n ],\n icon: 'ph--sidebar--regular',\n keyBinding: {\n macos: \"meta+'\",\n },\n disposition: 'pin-end',\n position: 'hoist',\n l0Breakpoint: 'lg',\n },\n };\n\n return get(\n atomFromSignal(() =>\n !state.deck.solo ? [closeCurrent, closeOthers, closeAll, toggleSidebar] : [toggleSidebar],\n ),\n );\n }),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n );\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": ["Atom", "Function", "Option", "Capabilities", "LayoutAction", "contributes", "createIntent", "AttentionCapabilities", "ROOT_ID", "atomFromSignal", "createExtension", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "meta", "actions", "node", "Atom", "make", "get", "pipe", "flatMap", "ROOT_ID", "some", "none", "map", "state", "getCapability", "DeckCapabilities", "MutableDeckState", "closeCurrent", "LayoutAction", "Close", "_tag", "data", "attention", "AttentionCapabilities", "Attention", "attended", "current", "at", "dispatchPromise", "dispatch", "IntentDispatcher", "createIntent", "part", "subject", "options", "properties", "label", "ns", "icon", "closeOthers", "ids", "deck", "active", "filter", "closeAll", "toggleSidebar", "UpdateSidebar", "sidebarState", "atomFromSignal", "keyBinding", "macos", "disposition", "position", "l0Breakpoint", "solo", "getOrElse"]
|
|
7
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
meta
|
|
3
|
-
} from "./chunk-UXLU6CMW.mjs";
|
|
4
|
-
|
|
5
|
-
// src/capabilities/check-app-scheme.ts
|
|
6
|
-
import { Capabilities, contributes } from "@dxos/app-framework";
|
|
7
|
-
var isSocket = !!globalThis.__args;
|
|
8
|
-
var appScheme = "composer://";
|
|
9
|
-
var checkAppScheme = (url) => {
|
|
10
|
-
const iframe = document.createElement("iframe");
|
|
11
|
-
iframe.style.display = "none";
|
|
12
|
-
document.body.appendChild(iframe);
|
|
13
|
-
iframe.src = url + window.location.pathname.replace(/^\/+/, "") + window.location.search;
|
|
14
|
-
const timer = setTimeout(() => {
|
|
15
|
-
document.body.removeChild(iframe);
|
|
16
|
-
}, 3e3);
|
|
17
|
-
window.addEventListener("pagehide", (event) => {
|
|
18
|
-
clearTimeout(timer);
|
|
19
|
-
document.body.removeChild(iframe);
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var check_app_scheme_default = (async (context) => {
|
|
23
|
-
const settings = context.getCapability(Capabilities.SettingsStore).getStore(meta.id)?.value;
|
|
24
|
-
if (!isSocket && settings?.enableNativeRedirect) {
|
|
25
|
-
checkAppScheme(appScheme);
|
|
26
|
-
}
|
|
27
|
-
return contributes(Capabilities.Null, null);
|
|
28
|
-
});
|
|
29
|
-
export {
|
|
30
|
-
check_app_scheme_default as default
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=check-app-scheme-HIEVFAAX.mjs.map
|