@dxos/plugin-simple-layout 0.0.0 → 0.8.4-main.03d5cd7b56
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/neutral/SimpleLayoutPlugin.mjs +52 -0
- package/dist/lib/neutral/SimpleLayoutPlugin.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-EYQKLRRP.mjs +21 -0
- package/dist/lib/neutral/app-graph-builder-EYQKLRRP.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +21 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-7UDV3JDT.mjs +22 -0
- package/dist/lib/neutral/chunk-7UDV3JDT.mjs.map +7 -0
- package/dist/lib/neutral/chunk-AMTEDJHG.mjs +19 -0
- package/dist/lib/neutral/chunk-AMTEDJHG.mjs.map +7 -0
- package/dist/lib/neutral/chunk-FD2CAY4Q.mjs +26 -0
- package/dist/lib/neutral/chunk-FD2CAY4Q.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-XVUAQHKU.mjs +8 -0
- package/dist/lib/neutral/chunk-XVUAQHKU.mjs.map +7 -0
- package/dist/lib/neutral/close-WKMURGUB.mjs +35 -0
- package/dist/lib/neutral/close-WKMURGUB.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +924 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +332 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +14 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/open-XI2T7D5O.mjs +49 -0
- package/dist/lib/neutral/open-XI2T7D5O.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-EAIE7KPR.mjs +13 -0
- package/dist/lib/neutral/operation-handler-EAIE7KPR.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/operations/index.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-root-VE265VX4.mjs +18 -0
- package/dist/lib/neutral/react-root-VE265VX4.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-REZMYKQV.mjs +46 -0
- package/dist/lib/neutral/react-surface-REZMYKQV.mjs.map +7 -0
- package/dist/lib/neutral/revert-workspace-ST6NZUNG.mjs +22 -0
- package/dist/lib/neutral/revert-workspace-ST6NZUNG.mjs.map +7 -0
- package/dist/lib/neutral/set-6ZRLWPJS.mjs +22 -0
- package/dist/lib/neutral/set-6ZRLWPJS.mjs.map +7 -0
- package/dist/lib/neutral/set-layout-mode-L22HRCKS.mjs +13 -0
- package/dist/lib/neutral/set-layout-mode-L22HRCKS.mjs.map +7 -0
- package/dist/lib/neutral/spotlight-dismiss-EIYW5E7M.mjs +58 -0
- package/dist/lib/neutral/spotlight-dismiss-EIYW5E7M.mjs.map +7 -0
- package/dist/lib/neutral/state-7NXKBLPY.mjs +47 -0
- package/dist/lib/neutral/state-7NXKBLPY.mjs.map +7 -0
- package/dist/lib/neutral/switch-workspace-PYWPTMFO.mjs +25 -0
- package/dist/lib/neutral/switch-workspace-PYWPTMFO.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +36 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +10 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/lib/neutral/update-complementary-HKWF5OXT.mjs +33 -0
- package/dist/lib/neutral/update-complementary-HKWF5OXT.mjs.map +7 -0
- package/dist/lib/neutral/update-dialog-P4ASXCE7.mjs +30 -0
- package/dist/lib/neutral/update-dialog-P4ASXCE7.mjs.map +7 -0
- package/dist/lib/neutral/update-popover-REAKC2GN.mjs +34 -0
- package/dist/lib/neutral/update-popover-REAKC2GN.mjs.map +7 -0
- package/dist/lib/neutral/update-sidebar-O5SQPR6Q.mjs +12 -0
- package/dist/lib/neutral/update-sidebar-O5SQPR6Q.mjs.map +7 -0
- package/dist/lib/neutral/url-handler-GZXUUAHD.mjs +129 -0
- package/dist/lib/neutral/url-handler-GZXUUAHD.mjs.map +7 -0
- package/dist/types/src/SimpleLayoutPlugin.d.ts +8 -0
- package/dist/types/src/SimpleLayoutPlugin.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +22 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root.d.ts +9 -0
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/spotlight-dismiss.d.ts +14 -0
- package/dist/types/src/capabilities/spotlight-dismiss.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +19 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/url-handler.d.ts +12 -0
- package/dist/types/src/capabilities/url-handler.d.ts.map +1 -0
- package/dist/types/src/components/ContentError.stories.d.ts +46 -0
- package/dist/types/src/components/ContentError.stories.d.ts.map +1 -0
- package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts +19 -0
- package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts.map +1 -0
- package/dist/types/src/components/DebugOverlay/index.d.ts +2 -0
- package/dist/types/src/components/DebugOverlay/index.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/Dialog.d.ts +3 -0
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/index.d.ts +2 -0
- package/dist/types/src/components/Dialog/index.d.ts.map +1 -0
- package/dist/types/src/components/Home/Home.d.ts +7 -0
- package/dist/types/src/components/Home/Home.d.ts.map +1 -0
- package/dist/types/src/components/Home/index.d.ts +2 -0
- package/dist/types/src/components/Home/index.d.ts.map +1 -0
- package/dist/types/src/components/Loading/Loading.d.ts +3 -0
- package/dist/types/src/components/Loading/Loading.d.ts.map +1 -0
- package/dist/types/src/components/Loading/Loading.stories.d.ts +13 -0
- package/dist/types/src/components/Loading/Loading.stories.d.ts.map +1 -0
- package/dist/types/src/components/Loading/index.d.ts +2 -0
- package/dist/types/src/components/Loading/index.d.ts.map +1 -0
- package/dist/types/src/components/MobileLayout/MobileLayout.d.ts +35 -0
- package/dist/types/src/components/MobileLayout/MobileLayout.d.ts.map +1 -0
- package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts +7 -0
- package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts.map +1 -0
- package/dist/types/src/components/MobileLayout/index.d.ts +2 -0
- package/dist/types/src/components/MobileLayout/index.d.ts.map +1 -0
- package/dist/types/src/components/NavBranch/NavBranch.d.ts +11 -0
- package/dist/types/src/components/NavBranch/NavBranch.d.ts.map +1 -0
- package/dist/types/src/components/NavBranch/index.d.ts +2 -0
- package/dist/types/src/components/NavBranch/index.d.ts.map +1 -0
- package/dist/types/src/components/Popover/Popover.d.ts +4 -0
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -0
- package/dist/types/src/components/Popover/index.d.ts +2 -0
- package/dist/types/src/components/Popover/index.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/AppBar.d.ts +24 -0
- package/dist/types/src/components/SimpleLayout/AppBar.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts +54 -0
- package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/Drawer.d.ts +6 -0
- package/dist/types/src/components/SimpleLayout/Drawer.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/Main.d.ts +6 -0
- package/dist/types/src/components/SimpleLayout/Main.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/NavBar.d.ts +16 -0
- package/dist/types/src/components/SimpleLayout/NavBar.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts +49 -0
- package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/SimpleLayout.d.ts +3 -0
- package/dist/types/src/components/SimpleLayout/SimpleLayout.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts +48 -0
- package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/index.d.ts +5 -0
- package/dist/types/src/components/SimpleLayout/index.d.ts.map +1 -0
- package/dist/types/src/components/hooks.d.ts +7 -0
- package/dist/types/src/components/hooks.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +8 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/hooks/actions.d.ts +19 -0
- package/dist/types/src/hooks/actions.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +7 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useAppBarProps.d.ts +7 -0
- package/dist/types/src/hooks/useAppBarProps.d.ts.map +1 -0
- package/dist/types/src/hooks/useCompanions.d.ts +12 -0
- package/dist/types/src/hooks/useCompanions.d.ts.map +1 -0
- package/dist/types/src/hooks/useDrawerActions.d.ts +13 -0
- package/dist/types/src/hooks/useDrawerActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useNavbarActions.d.ts +14 -0
- package/dist/types/src/hooks/useNavbarActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useSimpleLayoutState.d.ts +7 -0
- package/dist/types/src/hooks/useSimpleLayoutState.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +3 -0
- package/dist/types/src/meta.d.ts.map +1 -0
- package/dist/types/src/operations/close.d.ts +5 -0
- package/dist/types/src/operations/close.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/open.d.ts +5 -0
- package/dist/types/src/operations/open.d.ts.map +1 -0
- package/dist/types/src/operations/revert-workspace.d.ts +5 -0
- package/dist/types/src/operations/revert-workspace.d.ts.map +1 -0
- package/dist/types/src/operations/set-layout-mode.d.ts +5 -0
- package/dist/types/src/operations/set-layout-mode.d.ts.map +1 -0
- package/dist/types/src/operations/set.d.ts +5 -0
- package/dist/types/src/operations/set.d.ts.map +1 -0
- package/dist/types/src/operations/state-access.d.ts +8 -0
- package/dist/types/src/operations/state-access.d.ts.map +1 -0
- package/dist/types/src/operations/switch-workspace.d.ts +5 -0
- package/dist/types/src/operations/switch-workspace.d.ts.map +1 -0
- package/dist/types/src/operations/update-complementary.d.ts +5 -0
- package/dist/types/src/operations/update-complementary.d.ts.map +1 -0
- package/dist/types/src/operations/update-dialog.d.ts +5 -0
- package/dist/types/src/operations/update-dialog.d.ts.map +1 -0
- package/dist/types/src/operations/update-popover.d.ts +5 -0
- package/dist/types/src/operations/update-popover.d.ts.map +1 -0
- package/dist/types/src/operations/update-sidebar.d.ts +5 -0
- package/dist/types/src/operations/update-sidebar.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +32 -0
- package/dist/types/src/translations.d.ts.map +1 -0
- package/dist/types/src/types/SimpleLayoutCapabilities.d.ts +38 -0
- package/dist/types/src/types/SimpleLayoutCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/SimpleLayoutEvents.d.ts +4 -0
- package/dist/types/src/types/SimpleLayoutEvents.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +94 -29
- package/src/SimpleLayoutPlugin.ts +39 -11
- package/src/capabilities/app-graph-builder.ts +21 -0
- package/src/capabilities/index.ts +13 -3
- package/src/capabilities/operation-handler.ts +14 -0
- package/src/capabilities/{react-root/react-root.tsx → react-root.tsx} +4 -4
- package/src/capabilities/react-surface.tsx +50 -0
- package/src/{hooks/useSpotlightDismiss.ts → capabilities/spotlight-dismiss.ts} +31 -40
- package/src/capabilities/state.tsx +51 -0
- package/src/capabilities/url-handler.ts +164 -0
- package/src/components/ContentError.stories.tsx +9 -8
- package/src/components/DebugOverlay/DebugOverlay.tsx +96 -0
- package/src/components/DebugOverlay/index.ts +5 -0
- package/src/components/Dialog/Dialog.tsx +26 -15
- package/src/components/Home/Home.tsx +80 -80
- package/src/components/{ContentLoading.stories.tsx → Loading/Loading.stories.tsx} +5 -5
- package/src/components/{ContentLoading.tsx → Loading/Loading.tsx} +2 -2
- package/src/components/Loading/index.ts +5 -0
- package/src/components/MobileLayout/MobileLayout.stories.tsx +133 -0
- package/src/components/MobileLayout/MobileLayout.tsx +372 -0
- package/src/components/MobileLayout/index.ts +5 -0
- package/src/components/NavBranch/NavBranch.tsx +124 -0
- package/src/components/NavBranch/index.ts +5 -0
- package/src/components/Popover/Popover.tsx +49 -27
- package/src/components/SimpleLayout/AppBar.stories.tsx +144 -0
- package/src/components/SimpleLayout/AppBar.tsx +94 -0
- package/src/components/SimpleLayout/Drawer.tsx +104 -0
- package/src/components/SimpleLayout/Main.tsx +54 -61
- package/src/components/SimpleLayout/NavBar.stories.tsx +164 -0
- package/src/components/SimpleLayout/NavBar.tsx +19 -83
- package/src/components/SimpleLayout/SimpleLayout.stories.tsx +46 -63
- package/src/components/SimpleLayout/SimpleLayout.tsx +45 -8
- package/src/components/SimpleLayout/index.ts +3 -0
- package/src/components/hooks.ts +26 -0
- package/src/components/index.ts +4 -1
- package/src/hooks/actions.ts +86 -0
- package/src/hooks/index.ts +6 -1
- package/src/hooks/useAppBarProps.ts +95 -0
- package/src/hooks/useCompanions.ts +22 -0
- package/src/hooks/useDrawerActions.ts +100 -0
- package/src/hooks/useNavbarActions.ts +87 -0
- package/src/hooks/useSimpleLayoutState.ts +32 -0
- package/src/index.ts +2 -1
- package/src/meta.ts +2 -1
- package/src/operations/close.ts +34 -0
- package/src/operations/index.ts +16 -0
- package/src/operations/open.ts +63 -0
- package/src/operations/revert-workspace.ts +22 -0
- package/src/operations/set-layout-mode.ts +12 -0
- package/src/operations/set.ts +23 -0
- package/src/operations/state-access.ts +21 -0
- package/src/operations/switch-workspace.ts +26 -0
- package/src/operations/update-complementary.ts +35 -0
- package/src/operations/update-dialog.ts +28 -0
- package/src/operations/update-popover.ts +35 -0
- package/src/operations/update-sidebar.ts +12 -0
- package/src/plugin.ts +11 -0
- package/src/translations.ts +21 -13
- package/src/types/{capabilities.ts → SimpleLayoutCapabilities.ts} +19 -15
- package/src/types/SimpleLayoutEvents.ts +15 -0
- package/src/types/index.ts +2 -1
- package/src/capabilities/operation-resolver/index.ts +0 -10
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -135
- package/src/capabilities/react-root/index.ts +0 -7
- package/src/capabilities/state/index.ts +0 -9
- package/src/capabilities/state/state.tsx +0 -60
- package/src/components/ContentError.tsx +0 -23
- package/src/components/SimpleLayout/Banner.tsx +0 -60
- package/src/components/SimpleLayout/NavBarstories.tsx +0 -59
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Copyright 2025 DXOS.org
|
|
2
|
+
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
|
|
5
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
6
|
+
import { Operation } from '@dxos/compute';
|
|
7
|
+
|
|
8
|
+
import { layoutStateAccess } from './state-access';
|
|
9
|
+
|
|
10
|
+
const handler: Operation.WithHandler<typeof LayoutOperation.UpdatePopover> = LayoutOperation.UpdatePopover.pipe(
|
|
11
|
+
Operation.withHandler(
|
|
12
|
+
Effect.fnUntraced(function* (input) {
|
|
13
|
+
const { updateState } = yield* layoutStateAccess;
|
|
14
|
+
|
|
15
|
+
updateState((state) => ({
|
|
16
|
+
...state,
|
|
17
|
+
popoverOpen: input.state ?? Boolean(input.subject),
|
|
18
|
+
popoverKind: input.kind ?? 'base',
|
|
19
|
+
popoverTitle: input.kind === 'card' ? input.title : undefined,
|
|
20
|
+
popoverContent:
|
|
21
|
+
typeof input.subject === 'string'
|
|
22
|
+
? { component: input.subject, props: input.props }
|
|
23
|
+
: input.subject
|
|
24
|
+
? { subject: input.subject }
|
|
25
|
+
: undefined,
|
|
26
|
+
popoverSide: input.side,
|
|
27
|
+
popoverVariant: input.variant,
|
|
28
|
+
popoverAnchor: input.variant === 'virtual' ? input.anchor : state.popoverAnchor,
|
|
29
|
+
popoverAnchorId: input.variant !== 'virtual' ? input.anchorId : state.popoverAnchorId,
|
|
30
|
+
}));
|
|
31
|
+
}),
|
|
32
|
+
),
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export default handler;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright 2025 DXOS.org
|
|
2
|
+
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
|
|
5
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
6
|
+
import { Operation } from '@dxos/compute';
|
|
7
|
+
|
|
8
|
+
const handler: Operation.WithHandler<typeof LayoutOperation.UpdateSidebar> = LayoutOperation.UpdateSidebar.pipe(
|
|
9
|
+
Operation.withHandler(() => Effect.void),
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
export default handler;
|
package/src/plugin.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const SimpleLayoutPlugin = Plugin.lazy(meta, () => import('#plugin'));
|
|
10
|
+
|
|
11
|
+
export { SimpleLayoutOperationHandlerSet } from './operations';
|
package/src/translations.ts
CHANGED
|
@@ -3,25 +3,33 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
|
+
import { translations as searchTranslations } from '@dxos/react-ui-search/translations';
|
|
6
7
|
|
|
7
|
-
import { meta } from '
|
|
8
|
+
import { meta } from '#meta';
|
|
8
9
|
|
|
9
10
|
export const translations = [
|
|
11
|
+
...searchTranslations,
|
|
10
12
|
{
|
|
11
13
|
'en-US': {
|
|
12
14
|
[meta.id]: {
|
|
13
|
-
'plugin
|
|
14
|
-
'settings
|
|
15
|
-
'workspaces
|
|
16
|
-
'settings
|
|
17
|
-
'back
|
|
18
|
-
'browse
|
|
19
|
-
'notifications
|
|
20
|
-
'profile
|
|
21
|
-
'app
|
|
22
|
-
'main
|
|
23
|
-
'
|
|
24
|
-
'
|
|
15
|
+
'plugin.name': 'Simple layout',
|
|
16
|
+
'settings.title': 'Simple layout settings',
|
|
17
|
+
'workspaces.heading': 'Workspaces',
|
|
18
|
+
'settings.heading': 'Settings',
|
|
19
|
+
'back.label': 'Back',
|
|
20
|
+
'browse.label': 'Browse',
|
|
21
|
+
'notifications.label': 'Notifications',
|
|
22
|
+
'profile.label': 'Profile',
|
|
23
|
+
'app-menu.label': 'App menu',
|
|
24
|
+
'main-menu.label': 'Main menu',
|
|
25
|
+
'companions-menu.label': 'Companions',
|
|
26
|
+
'error-fallback.message': 'An error occurred',
|
|
27
|
+
'drawer.label': 'Drawer',
|
|
28
|
+
'close-drawer.label': 'Close drawer',
|
|
29
|
+
'expand-drawer.label': 'Expand drawer',
|
|
30
|
+
'collapse-drawer.label': 'Collapse drawer',
|
|
31
|
+
'actions-menu.label': 'Actions',
|
|
32
|
+
'done.label': 'Done',
|
|
25
33
|
},
|
|
26
34
|
},
|
|
27
35
|
},
|
|
@@ -2,36 +2,40 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
8
|
+
|
|
5
9
|
import { Capability } from '@dxos/app-framework';
|
|
10
|
+
import { type Label } from '@dxos/react-ui';
|
|
6
11
|
|
|
7
|
-
import { meta } from '
|
|
12
|
+
import { meta } from '#meta';
|
|
13
|
+
|
|
14
|
+
export type DrawerState = 'closed' | 'open' | 'expanded';
|
|
8
15
|
|
|
9
|
-
// TODO(wittjosiah): Handle toasts.
|
|
10
16
|
export type SimpleLayoutState = {
|
|
11
|
-
/** Data to be passed to the main content Surface. */
|
|
12
17
|
content?: any;
|
|
13
|
-
|
|
18
|
+
previousWorkspace: string;
|
|
19
|
+
workspace: string;
|
|
20
|
+
active?: string;
|
|
14
21
|
dialogOpen: boolean;
|
|
15
22
|
dialogType?: 'default' | 'alert';
|
|
16
23
|
dialogBlockAlign?: 'start' | 'center' | 'end';
|
|
17
24
|
dialogOverlayClasses?: string;
|
|
18
25
|
dialogOverlayStyle?: Record<string, any>;
|
|
19
|
-
|
|
20
|
-
dialogContent?: any;
|
|
21
|
-
|
|
26
|
+
dialogContent?: { component: string; props?: any } | null;
|
|
22
27
|
popoverOpen?: boolean;
|
|
23
28
|
popoverSide?: 'top' | 'right' | 'bottom' | 'left';
|
|
24
29
|
popoverVariant?: 'virtual' | 'react';
|
|
25
30
|
popoverAnchor?: HTMLButtonElement;
|
|
26
31
|
popoverAnchorId?: string;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/** Whether running in popover window context (hides mobile-specific UI). */
|
|
32
|
+
popoverKind?: 'base' | 'card';
|
|
33
|
+
popoverTitle?: Label;
|
|
34
|
+
popoverContent?: { component: string; props?: any } | { subject: any } | null;
|
|
35
|
+
drawerState: DrawerState;
|
|
36
|
+
history: string[];
|
|
34
37
|
isPopover?: boolean;
|
|
38
|
+
companionVariant?: string;
|
|
35
39
|
};
|
|
36
40
|
|
|
37
|
-
export const
|
|
41
|
+
export const State = Capability.make<Atom.Writable<SimpleLayoutState>>(`${meta.id}.state`);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import { type ActivationEvent } from '@dxos/app-framework';
|
|
8
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
9
|
+
|
|
10
|
+
import * as SimpleLayoutCapabilities from './SimpleLayoutCapabilities';
|
|
11
|
+
|
|
12
|
+
/** Fired when State capability is ready. */
|
|
13
|
+
export const StateReady: ActivationEvent.ActivationEvent = AppActivationEvents.createStateEvent(
|
|
14
|
+
SimpleLayoutCapabilities.State.identifier,
|
|
15
|
+
);
|
package/src/types/index.ts
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Capability, Capability as Capability$ } from '@dxos/app-framework';
|
|
6
|
-
|
|
7
|
-
export const OperationResolver: Capability.LazyCapability = Capability$.lazy(
|
|
8
|
-
'OperationResolver',
|
|
9
|
-
() => import('./operation-resolver'),
|
|
10
|
-
);
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
-
import { Operation, OperationResolver } from '@dxos/operation';
|
|
9
|
-
|
|
10
|
-
import { SimpleLayoutState } from '../../types';
|
|
11
|
-
|
|
12
|
-
export default Capability.makeModule(
|
|
13
|
-
Effect.fnUntraced(function* () {
|
|
14
|
-
return Capability.contributes(Common.Capability.OperationResolver, [
|
|
15
|
-
//
|
|
16
|
-
// UpdateSidebar - No-op for simple layout.
|
|
17
|
-
//
|
|
18
|
-
OperationResolver.make({
|
|
19
|
-
operation: Common.LayoutOperation.UpdateSidebar,
|
|
20
|
-
handler: () => Effect.void,
|
|
21
|
-
}),
|
|
22
|
-
|
|
23
|
-
//
|
|
24
|
-
// UpdateComplementary - No-op for simple layout.
|
|
25
|
-
//
|
|
26
|
-
OperationResolver.make({
|
|
27
|
-
operation: Common.LayoutOperation.UpdateComplementary,
|
|
28
|
-
handler: () => Effect.void,
|
|
29
|
-
}),
|
|
30
|
-
|
|
31
|
-
//
|
|
32
|
-
// UpdateDialog
|
|
33
|
-
//
|
|
34
|
-
OperationResolver.make({
|
|
35
|
-
operation: Common.LayoutOperation.UpdateDialog,
|
|
36
|
-
handler: Effect.fnUntraced(function* (input) {
|
|
37
|
-
const layout = yield* Capability.get(SimpleLayoutState);
|
|
38
|
-
layout.dialogOpen = input.state ?? Boolean(input.subject);
|
|
39
|
-
layout.dialogType = input.type ?? 'default';
|
|
40
|
-
layout.dialogBlockAlign = input.blockAlign ?? 'center';
|
|
41
|
-
layout.dialogOverlayClasses = input.overlayClasses;
|
|
42
|
-
layout.dialogOverlayStyle = input.overlayStyle;
|
|
43
|
-
layout.dialogContent = input.subject ? { component: input.subject, props: input.props } : null;
|
|
44
|
-
}),
|
|
45
|
-
}),
|
|
46
|
-
|
|
47
|
-
//
|
|
48
|
-
// UpdatePopover
|
|
49
|
-
//
|
|
50
|
-
OperationResolver.make({
|
|
51
|
-
operation: Common.LayoutOperation.UpdatePopover,
|
|
52
|
-
handler: Effect.fnUntraced(function* (input) {
|
|
53
|
-
const layout = yield* Capability.get(SimpleLayoutState);
|
|
54
|
-
layout.popoverOpen = input.state ?? Boolean(input.subject);
|
|
55
|
-
layout.popoverContent =
|
|
56
|
-
typeof input.subject === 'string'
|
|
57
|
-
? { component: input.subject, props: input.props }
|
|
58
|
-
: input.subject
|
|
59
|
-
? { subject: input.subject }
|
|
60
|
-
: undefined;
|
|
61
|
-
layout.popoverSide = input.side;
|
|
62
|
-
layout.popoverVariant = input.variant;
|
|
63
|
-
if (input.variant === 'virtual') {
|
|
64
|
-
layout.popoverAnchor = input.anchor;
|
|
65
|
-
} else {
|
|
66
|
-
layout.popoverAnchorId = input.anchorId;
|
|
67
|
-
}
|
|
68
|
-
}),
|
|
69
|
-
}),
|
|
70
|
-
|
|
71
|
-
//
|
|
72
|
-
// SwitchWorkspace
|
|
73
|
-
//
|
|
74
|
-
OperationResolver.make({
|
|
75
|
-
operation: Common.LayoutOperation.SwitchWorkspace,
|
|
76
|
-
handler: Effect.fnUntraced(function* (input) {
|
|
77
|
-
const layout = yield* Capability.get(SimpleLayoutState);
|
|
78
|
-
// TODO(wittjosiah): This is a hack to prevent the previous deck from being set for pinned items.
|
|
79
|
-
// Ideally this should be worked into the data model in a generic way.
|
|
80
|
-
if (!layout.workspace.startsWith('!')) {
|
|
81
|
-
layout.previousWorkspace = layout.workspace;
|
|
82
|
-
}
|
|
83
|
-
layout.workspace = input.subject;
|
|
84
|
-
layout.active = undefined;
|
|
85
|
-
}),
|
|
86
|
-
}),
|
|
87
|
-
|
|
88
|
-
//
|
|
89
|
-
// RevertWorkspace
|
|
90
|
-
//
|
|
91
|
-
OperationResolver.make({
|
|
92
|
-
operation: Common.LayoutOperation.RevertWorkspace,
|
|
93
|
-
handler: Effect.fnUntraced(function* () {
|
|
94
|
-
const layout = yield* Capability.get(SimpleLayoutState);
|
|
95
|
-
yield* Operation.invoke(Common.LayoutOperation.SwitchWorkspace, {
|
|
96
|
-
subject: layout.previousWorkspace,
|
|
97
|
-
});
|
|
98
|
-
}),
|
|
99
|
-
}),
|
|
100
|
-
|
|
101
|
-
//
|
|
102
|
-
// Open
|
|
103
|
-
//
|
|
104
|
-
OperationResolver.make({
|
|
105
|
-
operation: Common.LayoutOperation.Open,
|
|
106
|
-
handler: Effect.fnUntraced(function* (input) {
|
|
107
|
-
const layout = yield* Capability.get(SimpleLayoutState);
|
|
108
|
-
layout.active = input.subject[0];
|
|
109
|
-
}),
|
|
110
|
-
}),
|
|
111
|
-
|
|
112
|
-
//
|
|
113
|
-
// Close
|
|
114
|
-
//
|
|
115
|
-
OperationResolver.make({
|
|
116
|
-
operation: Common.LayoutOperation.Close,
|
|
117
|
-
handler: Effect.fnUntraced(function* () {
|
|
118
|
-
const layout = yield* Capability.get(SimpleLayoutState);
|
|
119
|
-
layout.active = undefined;
|
|
120
|
-
}),
|
|
121
|
-
}),
|
|
122
|
-
|
|
123
|
-
//
|
|
124
|
-
// Set
|
|
125
|
-
//
|
|
126
|
-
OperationResolver.make({
|
|
127
|
-
operation: Common.LayoutOperation.Set,
|
|
128
|
-
handler: Effect.fnUntraced(function* (input) {
|
|
129
|
-
const layout = yield* Capability.get(SimpleLayoutState);
|
|
130
|
-
layout.active = input.subject[0];
|
|
131
|
-
}),
|
|
132
|
-
}),
|
|
133
|
-
]);
|
|
134
|
-
}),
|
|
135
|
-
);
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
-
import { live } from '@dxos/live-object';
|
|
9
|
-
|
|
10
|
-
import { type SimpleLayoutState } from '../../types';
|
|
11
|
-
import { SimpleLayoutState as SimpleLayoutStateCapability } from '../../types';
|
|
12
|
-
|
|
13
|
-
const defaultState: SimpleLayoutState = {
|
|
14
|
-
dialogOpen: false,
|
|
15
|
-
workspace: 'default',
|
|
16
|
-
previousWorkspace: 'default',
|
|
17
|
-
isPopover: false,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export type SimpleLayoutStateOptions = {
|
|
21
|
-
initialState?: Partial<SimpleLayoutState>;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default Capability.makeModule(({ initialState }: SimpleLayoutStateOptions = {}) =>
|
|
25
|
-
Effect.sync(() => {
|
|
26
|
-
const state = live<SimpleLayoutState>({ ...defaultState, ...initialState });
|
|
27
|
-
|
|
28
|
-
const layout = live<Common.Capability.Layout>({
|
|
29
|
-
get mode() {
|
|
30
|
-
return 'simple';
|
|
31
|
-
},
|
|
32
|
-
get dialogOpen() {
|
|
33
|
-
return state.dialogOpen;
|
|
34
|
-
},
|
|
35
|
-
get sidebarOpen() {
|
|
36
|
-
return false;
|
|
37
|
-
},
|
|
38
|
-
get complementarySidebarOpen() {
|
|
39
|
-
return false;
|
|
40
|
-
},
|
|
41
|
-
get workspace() {
|
|
42
|
-
return state.workspace;
|
|
43
|
-
},
|
|
44
|
-
get active() {
|
|
45
|
-
return state.active ? [state.active] : [];
|
|
46
|
-
},
|
|
47
|
-
get inactive() {
|
|
48
|
-
return [];
|
|
49
|
-
},
|
|
50
|
-
get scrollIntoView() {
|
|
51
|
-
return undefined;
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
return [
|
|
56
|
-
Capability.contributes(SimpleLayoutStateCapability, state),
|
|
57
|
-
Capability.contributes(Common.Capability.Layout, layout),
|
|
58
|
-
];
|
|
59
|
-
}),
|
|
60
|
-
);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import { descriptionMessage, mx } from '@dxos/ui-theme';
|
|
9
|
-
|
|
10
|
-
import { meta } from '../meta';
|
|
11
|
-
|
|
12
|
-
// TODO(burdon): Factor out.
|
|
13
|
-
export const ContentError = ({ error }: { error?: Error }) => {
|
|
14
|
-
const { t } = useTranslation(meta.id);
|
|
15
|
-
const errorString = error?.toString() ?? '';
|
|
16
|
-
return (
|
|
17
|
-
<div role='none' className='grid place-items-center overflow-y-auto attention-surface'>
|
|
18
|
-
<p role='alert' className={mx(descriptionMessage, 'p-2 break-all rounded-sm')}>
|
|
19
|
-
{error ? errorString : t('error fallback message')}
|
|
20
|
-
</p>
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Common } from '@dxos/app-framework';
|
|
8
|
-
import { useCapability, useOperationInvoker } from '@dxos/app-framework/react';
|
|
9
|
-
import { type Node } from '@dxos/plugin-graph';
|
|
10
|
-
import { IconButton, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
11
|
-
import { mx, osTranslations, surfaceZIndex } from '@dxos/ui-theme';
|
|
12
|
-
|
|
13
|
-
import { meta } from '../../meta';
|
|
14
|
-
import { SimpleLayoutState } from '../../types';
|
|
15
|
-
|
|
16
|
-
export type BannerProps = {
|
|
17
|
-
node?: Node.Node;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const Banner = ({ node }: BannerProps) => {
|
|
21
|
-
const { t } = useTranslation(meta.id);
|
|
22
|
-
const layout = useCapability(SimpleLayoutState);
|
|
23
|
-
const { invokePromise } = useOperationInvoker();
|
|
24
|
-
const label = node ? toLocalizedString(node.properties.label, t) : t('current app name', { ns: osTranslations });
|
|
25
|
-
|
|
26
|
-
const handleClick = useCallback(async () => {
|
|
27
|
-
if (layout.active) {
|
|
28
|
-
await invokePromise(Common.LayoutOperation.Close, { subject: [layout.active] });
|
|
29
|
-
} else {
|
|
30
|
-
await invokePromise(Common.LayoutOperation.SwitchWorkspace, { subject: 'default' });
|
|
31
|
-
}
|
|
32
|
-
}, [invokePromise, layout.active]);
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
// Note that the HTML5 element `header` has a default role of `banner`, hence the name of this component.
|
|
36
|
-
// It should not be confused with the `heading` role (elements h1-6).
|
|
37
|
-
// TODO(burdon): Fixed or not?
|
|
38
|
-
<header
|
|
39
|
-
className={mx(
|
|
40
|
-
'_fixed flex items-center gap-2 pli-2 block-start-0 inset-inline-0 bs-[--dx-mobile-topbar-content-height,48px] bg-baseSurface border-be border-separator',
|
|
41
|
-
'grid grid-cols-[min-content_1fr_min-content]',
|
|
42
|
-
surfaceZIndex({ level: 'menu' }),
|
|
43
|
-
)}
|
|
44
|
-
>
|
|
45
|
-
{node ? (
|
|
46
|
-
<IconButton
|
|
47
|
-
iconOnly
|
|
48
|
-
variant='ghost'
|
|
49
|
-
icon='ph--caret-left--regular'
|
|
50
|
-
label={t('back label')}
|
|
51
|
-
onClick={handleClick}
|
|
52
|
-
/>
|
|
53
|
-
) : (
|
|
54
|
-
<div />
|
|
55
|
-
)}
|
|
56
|
-
<h1 className={'grow text-center truncate font-medium'}>{label}</h1>
|
|
57
|
-
{/* TODO(burdon): Menu. */}
|
|
58
|
-
</header>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
-
|
|
7
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
8
|
-
import { corePlugins } from '@dxos/plugin-testing';
|
|
9
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
10
|
-
|
|
11
|
-
import { translations } from '../../translations';
|
|
12
|
-
|
|
13
|
-
import { NavBar } from './NavBar';
|
|
14
|
-
|
|
15
|
-
const meta = {
|
|
16
|
-
title: 'plugins/plugin-simple-layout/NavBar',
|
|
17
|
-
component: NavBar,
|
|
18
|
-
decorators: [
|
|
19
|
-
withTheme,
|
|
20
|
-
withPluginManager({
|
|
21
|
-
plugins: [...corePlugins()],
|
|
22
|
-
}),
|
|
23
|
-
],
|
|
24
|
-
parameters: {
|
|
25
|
-
layout: 'fullscreen',
|
|
26
|
-
translations,
|
|
27
|
-
},
|
|
28
|
-
argTypes: {
|
|
29
|
-
onActiveIdChange: { action: 'activeIdChanged' },
|
|
30
|
-
},
|
|
31
|
-
} satisfies Meta<typeof NavBar>;
|
|
32
|
-
|
|
33
|
-
export default meta;
|
|
34
|
-
|
|
35
|
-
type Story = StoryObj<typeof meta>;
|
|
36
|
-
|
|
37
|
-
export const Default: Story = {
|
|
38
|
-
args: {
|
|
39
|
-
activeId: undefined,
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const BrowseActive: Story = {
|
|
44
|
-
args: {
|
|
45
|
-
activeId: 'some-document',
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const NotificationsActive: Story = {
|
|
50
|
-
args: {
|
|
51
|
-
activeId: 'notifications',
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export const ProfileActive: Story = {
|
|
56
|
-
args: {
|
|
57
|
-
activeId: 'profile',
|
|
58
|
-
},
|
|
59
|
-
};
|